"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4366],{316:(e,t,r)=>{var a,s,i,n,l,d,u;let o;r.d(t,{zM:()=>eF,ai:()=>eT,Ik:()=>eN,Yj:()=>eC,KC:()=>eZ}),(l=a||(a={})).assertEqual=e=>{},l.assertIs=function(e){},l.assertNever=function(e){throw Error()},l.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},l.getValidEnumValues=e=>{let t=l.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let a of t)r[a]=e[a];return l.objectValues(r)},l.objectValues=e=>l.objectKeys(e).map(function(t){return e[t]}),l.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},l.find=(e,t)=>{for(let r of e)if(t(r))return r},l.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,l.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},l.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(s||(s={})).mergeShapes=(e,t)=>({...e,...t});let c=a.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),f=e=>{switch(typeof e){case"undefined":return c.undefined;case"string":return c.string;case"number":return Number.isNaN(e)?c.nan:c.number;case"boolean":return c.boolean;case"function":return c.function;case"bigint":return c.bigint;case"symbol":return c.symbol;case"object":if(Array.isArray(e))return c.array;if(null===e)return c.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return c.promise;if("u">typeof Map&&e instanceof Map)return c.map;if("u">typeof Set&&e instanceof Set)return c.set;if("u">typeof Date&&e instanceof Date)return c.date;return c.object;default:return c.unknown}},h=a.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 p extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},r={_errors:[]},a=e=>{for(let s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(a);else if("invalid_return_type"===s.code)a(s.returnTypeError);else if("invalid_arguments"===s.code)a(s.argumentsError);else if(0===s.path.length)r._errors.push(t(s));else{let e=r,a=0;for(;a<s.path.length;){let r=s.path[a];a===s.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(s))):e[r]=e[r]||{_errors:[]},e=e[r],a++}}};return a(this),r}static assert(e){if(!(e instanceof p))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,a.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t={},r=[];for(let a of this.issues)if(a.path.length>0){let r=a.path[0];t[r]=t[r]||[],t[r].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}p.create=e=>new p(e);let m=(e,t)=>{let r;switch(e.code){case h.invalid_type:r=e.received===c.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case h.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,a.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:r=`Unrecognized key(s) in object: ${a.joinValues(e.keys,", ")}`;break;case h.invalid_union:r="Invalid input";break;case h.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${a.joinValues(e.options)}`;break;case h.invalid_enum_value:r=`Invalid enum value. Expected ${a.joinValues(e.options)}, received '${e.received}'`;break;case h.invalid_arguments:r="Invalid function arguments";break;case h.invalid_return_type:r="Invalid function return type";break;case h.invalid_date:r="Invalid date";break;case h.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:a.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case h.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case h.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case h.custom:r="Invalid input";break;case h.invalid_intersection_types:r="Intersection results could not be merged";break;case h.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case h.not_finite:r="Number must be finite";break;default:r=t.defaultError,a.assertNever(e)}return{message:r}};(d=i||(i={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},d.toString=e=>"string"==typeof e?e:e?.message;let y=e=>{let{data:t,path:r,errorMaps:a,issueData:s}=e,i=[...r,...s.path||[]],n={...s,path:i};if(void 0!==s.message)return{...s,path:i,message:s.message};let l="";for(let e of a.filter(e=>!!e).slice().reverse())l=e(n,{data:t,defaultError:l}).message;return{...s,path:i,message:l}};function _(e,t){let r=y({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,m,void 0].filter(e=>!!e)});e.common.issues.push(r)}class v{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if("aborted"===a.status)return g;"dirty"===a.status&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,a=await e.value;r.push({key:t,value:a})}return v.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:t,value:s}=a;if("aborted"===t.status||"aborted"===s.status)return g;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==s.value||a.alwaysSet)&&(r[t.value]=s.value)}return{status:e.value,value:r}}}let g=Object.freeze({status:"aborted"}),b=e=>({status:"dirty",value:e}),k=e=>({status:"valid",value:e}),x=e=>"u">typeof Promise&&e instanceof Promise;class w{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let A=(e,t)=>{if("valid"===t.status)return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new p(e.common.issues);return this._error=t,this._error}}};function V(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:a,description:s}=e;if(t&&(r||a))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:s}:{errorMap:(t,s)=>{let{message:i}=e;return"invalid_enum_value"===t.code?{message:i??s.defaultError}:void 0===s.data?{message:i??a??s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:i??r??s.defaultError}},description:s}}class S{get description(){return this._def.description}_getType(e){return f(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:f(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new v,ctx:{common:e.parent.common,data:e.data,parsedType:f(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(x(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:f(e)},a=this._parseSync({data:e,path:r.path,parent:r});return A(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:f(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return"valid"===r.status?{value:r.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>"valid"===e.status?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:f(e)},a=this._parse({data:e,path:r.path,parent:r});return A(r,await (x(a)?a:Promise.resolve(a)))}refine(e,t){return this._refinement((r,a)=>{let s=e(r),i=()=>a.addIssue({code:h.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"u">typeof Promise&&s instanceof Promise?s.then(e=>!!e||(i(),!1)):!!s||(i(),!1)})}refinement(e,t){return this._refinement((r,a)=>!!e(r)||(a.addIssue("function"==typeof t?t(r,a):t),!1))}_refinement(e){return new eg({schema:this,typeName:n.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return eb.create(this,this._def)}nullable(){return ek.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return er.create(this)}promise(){return ev.create(this,this._def)}or(e){return es.create([this,e],this._def)}and(e){return el.create(this,e,this._def)}transform(e){return new eg({...V(this._def),schema:this,typeName:n.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new ex({...V(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:n.ZodDefault})}brand(){return new eV({typeName:n.ZodBranded,type:this,...V(this._def)})}catch(e){return new ew({...V(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:n.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return eS.create(this,e)}readonly(){return eO.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let O=/^c[^\s-]{8,}$/i,C=/^[0-9a-z]+$/,T=/^[0-9A-HJKMNP-TV-Z]{26}$/i,F=/^[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,N=/^[a-z0-9_-]{21}$/i,Z=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,j=/^[-+]?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)?)??$/,E=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,R=/^(?:(?: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])$/,D=/^(?:(?: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])$/,I=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,$=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,P=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,M=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,L="((\\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])))",z=RegExp(`^${L}$`);function U(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}class B extends S{_parse(e){var t,r,s,i;let n;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==c.string){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.string,received:t.parsedType}),g}let l=new v;for(let d of this._def.checks)if("min"===d.kind)e.data.length<d.value&&(_(n=this._getOrReturnCtx(e,n),{code:h.too_small,minimum:d.value,type:"string",inclusive:!0,exact:!1,message:d.message}),l.dirty());else if("max"===d.kind)e.data.length>d.value&&(_(n=this._getOrReturnCtx(e,n),{code:h.too_big,maximum:d.value,type:"string",inclusive:!0,exact:!1,message:d.message}),l.dirty());else if("length"===d.kind){let t=e.data.length>d.value,r=e.data.length<d.value;(t||r)&&(n=this._getOrReturnCtx(e,n),t?_(n,{code:h.too_big,maximum:d.value,type:"string",inclusive:!0,exact:!0,message:d.message}):r&&_(n,{code:h.too_small,minimum:d.value,type:"string",inclusive:!0,exact:!0,message:d.message}),l.dirty())}else if("email"===d.kind)E.test(e.data)||(_(n=this._getOrReturnCtx(e,n),{validation:"email",code:h.invalid_string,message:d.message}),l.dirty());else if("emoji"===d.kind)o||(o=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),o.test(e.data)||(_(n=this._getOrReturnCtx(e,n),{validation:"emoji",code:h.invalid_string,message:d.message}),l.dirty());else if("uuid"===d.kind)F.test(e.data)||(_(n=this._getOrReturnCtx(e,n),{validation:"uuid",code:h.invalid_string,message:d.message}),l.dirty());else if("nanoid"===d.kind)N.test(e.data)||(_(n=this._getOrReturnCtx(e,n),{validation:"nanoid",code:h.invalid_string,message:d.message}),l.dirty());else if("cuid"===d.kind)O.test(e.data)||(_(n=this._getOrReturnCtx(e,n),{validation:"cuid",code:h.invalid_string,message:d.message}),l.dirty());else if("cuid2"===d.kind)C.test(e.data)||(_(n=this._getOrReturnCtx(e,n),{validation:"cuid2",code:h.invalid_string,message:d.message}),l.dirty());else if("ulid"===d.kind)T.test(e.data)||(_(n=this._getOrReturnCtx(e,n),{validation:"ulid",code:h.invalid_string,message:d.message}),l.dirty());else if("url"===d.kind)try{new URL(e.data)}catch{_(n=this._getOrReturnCtx(e,n),{validation:"url",code:h.invalid_string,message:d.message}),l.dirty()}else"regex"===d.kind?(d.regex.lastIndex=0,d.regex.test(e.data)||(_(n=this._getOrReturnCtx(e,n),{validation:"regex",code:h.invalid_string,message:d.message}),l.dirty())):"trim"===d.kind?e.data=e.data.trim():"includes"===d.kind?e.data.includes(d.value,d.position)||(_(n=this._getOrReturnCtx(e,n),{code:h.invalid_string,validation:{includes:d.value,position:d.position},message:d.message}),l.dirty()):"toLowerCase"===d.kind?e.data=e.data.toLowerCase():"toUpperCase"===d.kind?e.data=e.data.toUpperCase():"startsWith"===d.kind?e.data.startsWith(d.value)||(_(n=this._getOrReturnCtx(e,n),{code:h.invalid_string,validation:{startsWith:d.value},message:d.message}),l.dirty()):"endsWith"===d.kind?e.data.endsWith(d.value)||(_(n=this._getOrReturnCtx(e,n),{code:h.invalid_string,validation:{endsWith:d.value},message:d.message}),l.dirty()):"datetime"===d.kind?(function(e){let t=`${L}T${U(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)})(d).test(e.data)||(_(n=this._getOrReturnCtx(e,n),{code:h.invalid_string,validation:"datetime",message:d.message}),l.dirty()):"date"===d.kind?z.test(e.data)||(_(n=this._getOrReturnCtx(e,n),{code:h.invalid_string,validation:"date",message:d.message}),l.dirty()):"time"===d.kind?RegExp(`^${U(d)}$`).test(e.data)||(_(n=this._getOrReturnCtx(e,n),{code:h.invalid_string,validation:"time",message:d.message}),l.dirty()):"duration"===d.kind?j.test(e.data)||(_(n=this._getOrReturnCtx(e,n),{validation:"duration",code:h.invalid_string,message:d.message}),l.dirty()):"ip"===d.kind?(t=e.data,!(("v4"===(r=d.version)||!r)&&R.test(t)||("v6"===r||!r)&&I.test(t))&&1&&(_(n=this._getOrReturnCtx(e,n),{validation:"ip",code:h.invalid_string,message:d.message}),l.dirty())):"jwt"===d.kind?!function(e,t){if(!Z.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(a));if("object"!=typeof s||null===s||"typ"in s&&s?.typ!=="JWT"||!s.alg||t&&s.alg!==t)return!1;return!0}catch{return!1}}(e.data,d.alg)&&(_(n=this._getOrReturnCtx(e,n),{validation:"jwt",code:h.invalid_string,message:d.message}),l.dirty()):"cidr"===d.kind?(s=e.data,!(("v4"===(i=d.version)||!i)&&D.test(s)||("v6"===i||!i)&&$.test(s))&&1&&(_(n=this._getOrReturnCtx(e,n),{validation:"cidr",code:h.invalid_string,message:d.message}),l.dirty())):"base64"===d.kind?P.test(e.data)||(_(n=this._getOrReturnCtx(e,n),{validation:"base64",code:h.invalid_string,message:d.message}),l.dirty()):"base64url"===d.kind?M.test(e.data)||(_(n=this._getOrReturnCtx(e,n),{validation:"base64url",code:h.invalid_string,message:d.message}),l.dirty()):a.assertNever(d);return{status:l.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:h.invalid_string,...i.errToObj(r)})}_addCheck(e){return new B({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...i.errToObj(e)})}url(e){return this._addCheck({kind:"url",...i.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...i.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...i.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...i.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...i.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...i.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...i.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...i.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...i.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...i.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...i.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...i.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...i.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...i.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...i.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...i.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...i.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...i.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...i.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...i.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...i.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...i.errToObj(t)})}nonempty(e){return this.min(1,i.errToObj(e))}trim(){return new B({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new B({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new B({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}B.create=e=>new B({checks:[],typeName:n.ZodString,coerce:e?.coerce??!1,...V(e)});class W extends S{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==c.number){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.number,received:t.parsedType}),g}let r=new v;for(let s of this._def.checks)"int"===s.kind?a.isInteger(e.data)||(_(t=this._getOrReturnCtx(e,t),{code:h.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(_(t=this._getOrReturnCtx(e,t),{code:h.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):"max"===s.kind?(s.inclusive?e.data>s.value:e.data>=s.value)&&(_(t=this._getOrReturnCtx(e,t),{code:h.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):"multipleOf"===s.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,s=r>a?r:a;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}(e.data,s.value)&&(_(t=this._getOrReturnCtx(e,t),{code:h.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):"finite"===s.kind?Number.isFinite(e.data)||(_(t=this._getOrReturnCtx(e,t),{code:h.not_finite,message:s.message}),r.dirty()):a.assertNever(s);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,i.toString(t))}gt(e,t){return this.setLimit("min",e,!1,i.toString(t))}lte(e,t){return this.setLimit("max",e,!0,i.toString(t))}lt(e,t){return this.setLimit("max",e,!1,i.toString(t))}setLimit(e,t,r,a){return new W({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:i.toString(a)}]})}_addCheck(e){return new W({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:i.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:i.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:i.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:i.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:i.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:i.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:i.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:i.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:i.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&a.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;else"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value);return Number.isFinite(t)&&Number.isFinite(e)}}W.create=e=>new W({checks:[],typeName:n.ZodNumber,coerce:e?.coerce||!1,...V(e)});class K extends S{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==c.bigint)return this._getInvalidInput(e);let r=new v;for(let s of this._def.checks)"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(_(t=this._getOrReturnCtx(e,t),{code:h.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):"max"===s.kind?(s.inclusive?e.data>s.value:e.data>=s.value)&&(_(t=this._getOrReturnCtx(e,t),{code:h.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):"multipleOf"===s.kind?e.data%s.value!==BigInt(0)&&(_(t=this._getOrReturnCtx(e,t),{code:h.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):a.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.bigint,received:t.parsedType}),g}gte(e,t){return this.setLimit("min",e,!0,i.toString(t))}gt(e,t){return this.setLimit("min",e,!1,i.toString(t))}lte(e,t){return this.setLimit("max",e,!0,i.toString(t))}lt(e,t){return this.setLimit("max",e,!1,i.toString(t))}setLimit(e,t,r,a){return new K({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:i.toString(a)}]})}_addCheck(e){return new K({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:i.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:i.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:i.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:i.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:i.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}K.create=e=>new K({checks:[],typeName:n.ZodBigInt,coerce:e?.coerce??!1,...V(e)});class q extends S{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==c.boolean){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.boolean,received:t.parsedType}),g}return k(e.data)}}q.create=e=>new q({typeName:n.ZodBoolean,coerce:e?.coerce||!1,...V(e)});class H extends S{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==c.date){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.date,received:t.parsedType}),g}if(Number.isNaN(e.data.getTime()))return _(this._getOrReturnCtx(e),{code:h.invalid_date}),g;let r=new v;for(let s of this._def.checks)"min"===s.kind?e.data.getTime()<s.value&&(_(t=this._getOrReturnCtx(e,t),{code:h.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):"max"===s.kind?e.data.getTime()>s.value&&(_(t=this._getOrReturnCtx(e,t),{code:h.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):a.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new H({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:i.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:i.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}H.create=e=>new H({checks:[],coerce:e?.coerce||!1,typeName:n.ZodDate,...V(e)});class J extends S{_parse(e){if(this._getType(e)!==c.symbol){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.symbol,received:t.parsedType}),g}return k(e.data)}}J.create=e=>new J({typeName:n.ZodSymbol,...V(e)});class Y extends S{_parse(e){if(this._getType(e)!==c.undefined){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.undefined,received:t.parsedType}),g}return k(e.data)}}Y.create=e=>new Y({typeName:n.ZodUndefined,...V(e)});class G extends S{_parse(e){if(this._getType(e)!==c.null){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.null,received:t.parsedType}),g}return k(e.data)}}G.create=e=>new G({typeName:n.ZodNull,...V(e)});class X extends S{constructor(){super(...arguments),this._any=!0}_parse(e){return k(e.data)}}X.create=e=>new X({typeName:n.ZodAny,...V(e)});class Q extends S{constructor(){super(...arguments),this._unknown=!0}_parse(e){return k(e.data)}}Q.create=e=>new Q({typeName:n.ZodUnknown,...V(e)});class ee extends S{_parse(e){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.never,received:t.parsedType}),g}}ee.create=e=>new ee({typeName:n.ZodNever,...V(e)});class et extends S{_parse(e){if(this._getType(e)!==c.undefined){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.void,received:t.parsedType}),g}return k(e.data)}}et.create=e=>new et({typeName:n.ZodVoid,...V(e)});class er extends S{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==c.array)return _(t,{code:h.invalid_type,expected:c.array,received:t.parsedType}),g;if(null!==a.exactLength){let e=t.data.length>a.exactLength.value,s=t.data.length<a.exactLength.value;(e||s)&&(_(t,{code:e?h.too_big:h.too_small,minimum:s?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(_(t,{code:h.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(_(t,{code:h.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>a.type._parseAsync(new w(t,e,t.path,r)))).then(e=>v.mergeArray(r,e));let s=[...t.data].map((e,r)=>a.type._parseSync(new w(t,e,t.path,r)));return v.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new er({...this._def,minLength:{value:e,message:i.toString(t)}})}max(e,t){return new er({...this._def,maxLength:{value:e,message:i.toString(t)}})}length(e,t){return new er({...this._def,exactLength:{value:e,message:i.toString(t)}})}nonempty(e){return this.min(1,e)}}er.create=(e,t)=>new er({type:e,minLength:null,maxLength:null,exactLength:null,typeName:n.ZodArray,...V(t)});class ea extends S{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=a.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==c.object){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.object,received:t.parsedType}),g}let{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof ee&&"strip"===this._def.unknownKeys))for(let e in r.data)s.includes(e)||i.push(e);let n=[];for(let e of s){let t=a[e],s=r.data[e];n.push({key:{status:"valid",value:e},value:t._parse(new w(r,s,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof ee){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of i)n.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)i.length>0&&(_(r,{code:h.unrecognized_keys,keys:i}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of i){let a=r.data[t];n.push({key:{status:"valid",value:t},value:e._parse(new w(r,a,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of n){let r=await t.key,a=await t.value;e.push({key:r,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>v.mergeObjectSync(t,e)):v.mergeObjectSync(t,n)}get shape(){return this._def.shape()}strict(e){return i.errToObj,new ea({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{let a=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:i.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new ea({...this._def,unknownKeys:"strip"})}passthrough(){return new ea({...this._def,unknownKeys:"passthrough"})}extend(e){return new ea({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ea({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:n.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ea({...this._def,catchall:e})}pick(e){let t={};for(let r of a.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new ea({...this._def,shape:()=>t})}omit(e){let t={};for(let r of a.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new ea({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof ea){let r={};for(let a in t.shape){let s=t.shape[a];r[a]=eb.create(e(s))}return new ea({...t._def,shape:()=>r})}if(t instanceof er)return new er({...t._def,type:e(t.element)});if(t instanceof eb)return eb.create(e(t.unwrap()));if(t instanceof ek)return ek.create(e(t.unwrap()));if(t instanceof ed)return ed.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};for(let r of a.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new ea({...this._def,shape:()=>t})}required(e){let t={};for(let r of a.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof eb;)e=e._def.innerType;t[r]=e}return new ea({...this._def,shape:()=>t})}keyof(){return em(a.objectKeys(this.shape))}}ea.create=(e,t)=>new ea({shape:()=>e,unknownKeys:"strip",catchall:ee.create(),typeName:n.ZodObject,...V(t)}),ea.strictCreate=(e,t)=>new ea({shape:()=>e,unknownKeys:"strict",catchall:ee.create(),typeName:n.ZodObject,...V(t)}),ea.lazycreate=(e,t)=>new ea({shape:e,unknownKeys:"strip",catchall:ee.create(),typeName:n.ZodObject,...V(t)});class es extends S{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new p(e.ctx.common.issues));return _(t,{code:h.invalid_union,unionErrors:r}),g});{let e,a=[];for(let s of r){let r={...t,common:{...t.common,issues:[]},parent:null},i=s._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:r}),r.common.issues.length&&a.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let s=a.map(e=>new p(e));return _(t,{code:h.invalid_union,unionErrors:s}),g}}get options(){return this._def.options}}es.create=(e,t)=>new es({options:e,typeName:n.ZodUnion,...V(t)});let ei=e=>{if(e instanceof eh)return ei(e.schema);if(e instanceof eg)return ei(e.innerType());if(e instanceof ep)return[e.value];if(e instanceof ey)return e.options;if(e instanceof e_)return a.objectValues(e.enum);else if(e instanceof ex)return ei(e._def.innerType);else if(e instanceof Y)return[void 0];else if(e instanceof G)return[null];else if(e instanceof eb)return[void 0,...ei(e.unwrap())];else if(e instanceof ek)return[null,...ei(e.unwrap())];else if(e instanceof eV)return ei(e.unwrap());else if(e instanceof eO)return ei(e.unwrap());else if(e instanceof ew)return ei(e._def.innerType);else return[]};class en extends S{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==c.object)return _(t,{code:h.invalid_type,expected:c.object,received:t.parsedType}),g;let r=this.discriminator,a=t.data[r],s=this.optionsMap.get(a);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(_(t,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),g)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let a=new Map;for(let r of t){let t=ei(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of t){if(a.has(s))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);a.set(s,r)}}return new en({typeName:n.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...V(r)})}}class el extends S{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),s=(e,s)=>{if("aborted"===e.status||"aborted"===s.status)return g;let i=function e(t,r){let s=f(t),i=f(r);if(t===r)return{valid:!0,data:t};if(s===c.object&&i===c.object){let s=a.objectKeys(r),i=a.objectKeys(t).filter(e=>-1!==s.indexOf(e)),n={...t,...r};for(let a of i){let s=e(t[a],r[a]);if(!s.valid)return{valid:!1};n[a]=s.data}return{valid:!0,data:n}}if(s===c.array&&i===c.array){if(t.length!==r.length)return{valid:!1};let a=[];for(let s=0;s<t.length;s++){let i=e(t[s],r[s]);if(!i.valid)return{valid:!1};a.push(i.data)}return{valid:!0,data:a}}if(s===c.date&&i===c.date&&+t==+r)return{valid:!0,data:t};return{valid:!1}}(e.value,s.value);return i.valid?(("dirty"===e.status||"dirty"===s.status)&&t.dirty(),{status:t.value,value:i.data}):(_(r,{code:h.invalid_intersection_types}),g)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>s(e,t)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}el.create=(e,t,r)=>new el({left:e,right:t,typeName:n.ZodIntersection,...V(r)});class ed extends S{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==c.array)return _(r,{code:h.invalid_type,expected:c.array,received:r.parsedType}),g;if(r.data.length<this._def.items.length)return _(r,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),g;!this._def.rest&&r.data.length>this._def.items.length&&(_(r,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...r.data].map((e,t)=>{let a=this._def.items[t]||this._def.rest;return a?a._parse(new w(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(a).then(e=>v.mergeArray(t,e)):v.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new ed({...this._def,rest:e})}}ed.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new ed({items:e,typeName:n.ZodTuple,rest:null,...V(t)})};class eu extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==c.object)return _(r,{code:h.invalid_type,expected:c.object,received:r.parsedType}),g;let a=[],s=this._def.keyType,i=this._def.valueType;for(let e in r.data)a.push({key:s._parse(new w(r,e,r.path,e)),value:i._parse(new w(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?v.mergeObjectAsync(t,a):v.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return new eu(t instanceof S?{keyType:e,valueType:t,typeName:n.ZodRecord,...V(r)}:{keyType:B.create(),valueType:e,typeName:n.ZodRecord,...V(t)})}}class eo extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==c.map)return _(r,{code:h.invalid_type,expected:c.map,received:r.parsedType}),g;let a=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([e,t],i)=>({key:a._parse(new w(r,e,r.path,[i,"key"])),value:s._parse(new w(r,t,r.path,[i,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of i){let a=await r.key,s=await r.value;if("aborted"===a.status||"aborted"===s.status)return g;("dirty"===a.status||"dirty"===s.status)&&t.dirty(),e.set(a.value,s.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of i){let a=r.key,s=r.value;if("aborted"===a.status||"aborted"===s.status)return g;("dirty"===a.status||"dirty"===s.status)&&t.dirty(),e.set(a.value,s.value)}return{status:t.value,value:e}}}}eo.create=(e,t,r)=>new eo({valueType:t,keyType:e,typeName:n.ZodMap,...V(r)});class ec extends S{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==c.set)return _(r,{code:h.invalid_type,expected:c.set,received:r.parsedType}),g;let a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(_(r,{code:h.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&r.data.size>a.maxSize.value&&(_(r,{code:h.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let s=this._def.valueType;function i(e){let r=new Set;for(let a of e){if("aborted"===a.status)return g;"dirty"===a.status&&t.dirty(),r.add(a.value)}return{status:t.value,value:r}}let n=[...r.data.values()].map((e,t)=>s._parse(new w(r,e,r.path,t)));return r.common.async?Promise.all(n).then(e=>i(e)):i(n)}min(e,t){return new ec({...this._def,minSize:{value:e,message:i.toString(t)}})}max(e,t){return new ec({...this._def,maxSize:{value:e,message:i.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ec.create=(e,t)=>new ec({valueType:e,minSize:null,maxSize:null,typeName:n.ZodSet,...V(t)});class ef extends S{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==c.function)return _(t,{code:h.invalid_type,expected:c.function,received:t.parsedType}),g;function r(e,r){return y({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,m,m].filter(e=>!!e),issueData:{code:h.invalid_arguments,argumentsError:r}})}function a(e,r){return y({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,m,m].filter(e=>!!e),issueData:{code:h.invalid_return_type,returnTypeError:r}})}let s={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof ev){let e=this;return k(async function(...t){let n=new p([]),l=await e._def.args.parseAsync(t,s).catch(e=>{throw n.addIssue(r(t,e)),n}),d=await Reflect.apply(i,this,l);return await e._def.returns._def.type.parseAsync(d,s).catch(e=>{throw n.addIssue(a(d,e)),n})})}{let e=this;return k(function(...t){let n=e._def.args.safeParse(t,s);if(!n.success)throw new p([r(t,n.error)]);let l=Reflect.apply(i,this,n.data),d=e._def.returns.safeParse(l,s);if(!d.success)throw new p([a(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ef({...this._def,args:ed.create(e).rest(Q.create())})}returns(e){return new ef({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new ef({args:e||ed.create([]).rest(Q.create()),returns:t||Q.create(),typeName:n.ZodFunction,...V(r)})}}class eh extends S{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}eh.create=(e,t)=>new eh({getter:e,typeName:n.ZodLazy,...V(t)});class ep extends S{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return _(t,{received:t.data,code:h.invalid_literal,expected:this._def.value}),g}return{status:"valid",value:e.data}}get value(){return this._def.value}}function em(e,t){return new ey({values:e,typeName:n.ZodEnum,...V(t)})}ep.create=(e,t)=>new ep({value:e,typeName:n.ZodLiteral,...V(t)});class ey extends S{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return _(t,{expected:a.joinValues(r),received:t.parsedType,code:h.invalid_type}),g}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return _(t,{received:t.data,code:h.invalid_enum_value,options:r}),g}return k(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ey.create(e,{...this._def,...t})}exclude(e,t=this._def){return ey.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}ey.create=em;class e_ extends S{_parse(e){let t=a.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==c.string&&r.parsedType!==c.number){let e=a.objectValues(t);return _(r,{expected:a.joinValues(e),received:r.parsedType,code:h.invalid_type}),g}if(this._cache||(this._cache=new Set(a.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=a.objectValues(t);return _(r,{received:r.data,code:h.invalid_enum_value,options:e}),g}return k(e.data)}get enum(){return this._def.values}}e_.create=(e,t)=>new e_({values:e,typeName:n.ZodNativeEnum,...V(t)});class ev extends S{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==c.promise&&!1===t.common.async?(_(t,{code:h.invalid_type,expected:c.promise,received:t.parsedType}),g):k((t.parsedType===c.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ev.create=(e,t)=>new ev({type:e,typeName:n.ZodPromise,...V(t)});class eg extends S{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===n.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:e=>{_(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===s.type){let e=s.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return g;let a=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===a.status?g:"dirty"===a.status||"dirty"===t.value?b(a.value):a});{if("aborted"===t.value)return g;let a=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===a.status?g:"dirty"===a.status||"dirty"===t.value?b(a.value):a}}if("refinement"===s.type){let e=e=>{let t=s.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?g:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===a.status?g:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}}if("transform"===s.type)if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>"valid"!==e.status?g:Promise.resolve(s.transform(e.value,i)).then(e=>({status:t.value,value:e})));else{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if("valid"!==e.status)return g;let a=s.transform(e.value,i);if(a instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}a.assertNever(s)}}eg.create=(e,t,r)=>new eg({schema:e,typeName:n.ZodEffects,effect:t,...V(r)}),eg.createWithPreprocess=(e,t,r)=>new eg({schema:t,effect:{type:"preprocess",transform:e},typeName:n.ZodEffects,...V(r)});class eb extends S{_parse(e){return this._getType(e)===c.undefined?k(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}eb.create=(e,t)=>new eb({innerType:e,typeName:n.ZodOptional,...V(t)});class ek extends S{_parse(e){return this._getType(e)===c.null?k(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ek.create=(e,t)=>new ek({innerType:e,typeName:n.ZodNullable,...V(t)});class ex extends S{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===c.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ex.create=(e,t)=>new ex({innerType:e,typeName:n.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...V(t)});class ew extends S{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return x(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new p(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new p(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ew.create=(e,t)=>new ew({innerType:e,typeName:n.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...V(t)});class eA extends S{_parse(e){if(this._getType(e)!==c.nan){let t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:c.nan,received:t.parsedType}),g}return{status:"valid",value:e.data}}}eA.create=e=>new eA({typeName:n.ZodNaN,...V(e)}),Symbol("zod_brand");class eV extends S{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class eS extends S{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?g:"dirty"===e.status?(t.dirty(),b(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?g:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new eS({in:e,out:t,typeName:n.ZodPipeline})}}class eO extends S{_parse(e){let t=this._def.innerType._parse(e),r=e=>("valid"===e.status&&(e.value=Object.freeze(e.value)),e);return x(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}eO.create=(e,t)=>new eO({innerType:e,typeName:n.ZodReadonly,...V(t)}),ea.lazycreate,(u=n||(n={})).ZodString="ZodString",u.ZodNumber="ZodNumber",u.ZodNaN="ZodNaN",u.ZodBigInt="ZodBigInt",u.ZodBoolean="ZodBoolean",u.ZodDate="ZodDate",u.ZodSymbol="ZodSymbol",u.ZodUndefined="ZodUndefined",u.ZodNull="ZodNull",u.ZodAny="ZodAny",u.ZodUnknown="ZodUnknown",u.ZodNever="ZodNever",u.ZodVoid="ZodVoid",u.ZodArray="ZodArray",u.ZodObject="ZodObject",u.ZodUnion="ZodUnion",u.ZodDiscriminatedUnion="ZodDiscriminatedUnion",u.ZodIntersection="ZodIntersection",u.ZodTuple="ZodTuple",u.ZodRecord="ZodRecord",u.ZodMap="ZodMap",u.ZodSet="ZodSet",u.ZodFunction="ZodFunction",u.ZodLazy="ZodLazy",u.ZodLiteral="ZodLiteral",u.ZodEnum="ZodEnum",u.ZodEffects="ZodEffects",u.ZodNativeEnum="ZodNativeEnum",u.ZodOptional="ZodOptional",u.ZodNullable="ZodNullable",u.ZodDefault="ZodDefault",u.ZodCatch="ZodCatch",u.ZodPromise="ZodPromise",u.ZodBranded="ZodBranded",u.ZodPipeline="ZodPipeline",u.ZodReadonly="ZodReadonly";let eC=B.create,eT=W.create;eA.create,K.create;let eF=q.create;H.create,J.create,Y.create,G.create,X.create,Q.create,ee.create,et.create,er.create;let eN=ea.create;ea.strictCreate;let eZ=es.create;en.create,el.create,ed.create,eu.create,eo.create,ec.create,ef.create,eh.create,ep.create,ey.create,e_.create,ev.create,eg.create,eb.create,ek.create,eg.createWithPreprocess,eS.create},99003:(e,t,r)=>{r.d(t,{FH:()=>M,mN:()=>eV,xI:()=>L});var a=r(12115),s=e=>e instanceof Date,i=e=>null==e;let n=e=>"object"==typeof e;var l=e=>!i(e)&&!Array.isArray(e)&&n(e)&&!s(e),d=e=>l(e)&&e.target?"checkbox"===e.target.type?e.target.checked:"file"===e.target.type?e.target.files:e.target.value:e,u=(e,t)=>t.split(".").some((t,r,a)=>!isNaN(Number(t))&&e.has(a.slice(0,r).join("."))),o=e=>{let t=e.constructor&&e.constructor.prototype;return l(t)&&t.hasOwnProperty("isPrototypeOf")},c="u">typeof window&&void 0!==window.HTMLElement&&"u">typeof document;function f(e){if(e instanceof Date)return new Date(e);let t="u">typeof FileList&&e instanceof FileList;if(c&&(e instanceof Blob||t))return e;let r=Array.isArray(e);if(!r&&!(l(e)&&o(e)))return e;let a=r?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(a[t]=f(e[t]));return a}let h="blur",p="trigger",m="onChange",y="onSubmit",_="maxLength",v="minLength",g="pattern",b="required",k="validate",x="root",w=["__proto__","constructor","prototype"],A=/^\w*$/;var V=e=>void 0===e;let S=/[.[\]'"]/;var O=e=>e.split(S).filter(Boolean),C=(e,t,r)=>{if(!t||!l(e))return r;let a=A.test(t)?[t]:O(t);if(a.some(e=>w.includes(e)))return r;let s=a.reduce((e,t)=>i(e)?void 0:e[t],e);return V(s)||s===e?V(e[t])?r:e[t]:s},T=e=>"function"==typeof e,F=(e,t,r)=>{let a=-1,s=A.test(t)?[t]:O(t),i=s.length,n=i-1;for(;++a<i;){let t=s[a],i=r;if(a!==n){let r=e[t];i=l(r)||Array.isArray(r)?r:isNaN(+s[a+1])?{}:[]}if(w.includes(t))return;e[t]=i,e=e[t]}};let N=a.createContext(null);N.displayName="HookFormControlContext";var Z=(e,t,r,a=!0)=>{let s={};for(let i in e)Object.defineProperty(s,i,{get:()=>("all"!==t._proxyFormState[i]&&(t._proxyFormState[i]=!a||"all"),r&&(r[i]=!0),e[i])});return s};let j=c?a.useLayoutEffect:a.useEffect;var E=e=>i(e)||!n(e);let R=(e,t)=>0===t.length&&!Array.isArray(e)&&!o(e);function D(e,t,r=new WeakMap){if(e===t)return!0;if(E(e)||E(t))return Object.is(e,t);if(s(e)&&s(t))return Object.is(e.getTime(),t.getTime());let a=Object.keys(e),i=Object.keys(t);if(a.length!==i.length)return!1;if(R(e,a)||R(t,i))return Object.is(e,t);if(!a.length&&Array.isArray(e)!==Array.isArray(t))return!1;let n=r.get(e);if(n&&n.has(t))return!0;if(n)n.add(t);else{let a=new WeakSet;a.add(t),r.set(e,a)}for(let i of a){let a=e[i];if(!(i in t))return!1;if("ref"!==i){let e=t[i];if(s(a)&&s(e)||(l(a)||Array.isArray(a))&&(l(e)||Array.isArray(e))?!D(a,e,r):!Object.is(a,e))return!1}}return!0}function I(){let e=a.useRef(!1),t=a.useRef(void 0);return{resyncIfNeeded:a.useCallback((r,a,s)=>{if(r&&e.current){let e=a();D(t.current,e)||s(e)}e.current=!0},[]),snapshot:a.useCallback((e,r)=>{e&&(t.current=f(r()))},[])}}var $=e=>"string"==typeof e,P=(e,t,r,a,s)=>$(e)?(a&&t.watch.add(e),C(r,e,s)):Array.isArray(e)?e.map(e=>(a&&t.watch.add(e),C(r,e))):(a&&(t.watchAll=!0),r);function M(e){let t=a.useContext(N),{control:r=t,name:s,defaultValue:i,disabled:n,exact:l,compute:d}=e||{},u=a.useRef(i),o=a.useRef(d),c=a.useRef(void 0),f=a.useRef(r),h=a.useRef(s);o.current=d;let[p,m]=a.useState(()=>{let e=r._getWatch(s,u.current);return o.current?o.current(e):e}),y=a.useCallback(e=>{let t=P(s,r._names,e||r._formValues,!1,u.current);return o.current?o.current(t):t},[r._formValues,r._names,s]),_=a.useCallback(e=>{if(!n){let t=P(s,r._names,e||r._formValues,!1,u.current);if(o.current){let e=o.current(t);D(e,c.current)||(m(e),c.current=e)}else m(t)}},[r._formValues,r._names,n,s]),{resyncIfNeeded:v,snapshot:g}=I(),b=a.useRef(_);b.current=_;let k=a.useRef(y);k.current=y,j(()=>{f.current===r&&D(h.current,s)?v(!n,()=>k.current(),e=>{m(e),c.current=e}):(f.current=r,h.current=s,b.current());let e=r._subscribe({name:s,formState:{values:!0},exact:l,callback:e=>{b.current(e.values)}});return()=>{e(),g(!n,()=>k.current())}},[r,l,s,n,v,g]),a.useEffect(()=>r._removeUnmounted());let x=f.current!==r,w=h.current,A=a.useMemo(()=>{if(n)return null;let e=!x&&!D(w,s);return x||e?y():null},[n,x,s,w,y]);return null!==A?A:p}let L=e=>e.render(function(e){let t=a.useContext(N),{name:r,disabled:s,control:i=t,shouldUnregister:n,defaultValue:l,exact:o=!0}=e,c=u(i._names.array,r),p=a.useMemo(()=>C(i._formValues,r,C(i._defaultValues,r,l)),[i,r,l]),m=M({control:i,name:r,defaultValue:p,exact:o}),y=function(e){let t=a.useContext(N),{control:r=t,disabled:s,name:i,exact:n}=e||{},[l,d]=a.useState(()=>({...r._formState,defaultValues:r._defaultValues})),u=a.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),{resyncIfNeeded:o,snapshot:c}=I();return j(()=>{let e=()=>({...r._formState,defaultValues:r._defaultValues});o(!s,e,d);let t=r._subscribe({name:i,formState:u.current,exact:n,callback:e=>{s||d({...r._formState,...e,defaultValues:r._defaultValues})}});return()=>{t(),c(!s,e)}},[i,s,n,o,c]),a.useEffect(()=>{u.current.isValid&&r._setValid(!0)},[r]),a.useMemo(()=>Z(l,r,u.current,!1),[l,r])}({control:i,name:r,exact:o}),_=a.useRef(e),v=a.useRef(null),g=a.useRef(i.register(r,{...e.rules,value:m,..."boolean"==typeof e.disabled?{disabled:e.disabled}:{}}));_.current=e;let b=a.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!C(y.errors,r)},isDirty:{enumerable:!0,get:()=>!!C(y.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!C(y.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!C(y.validatingFields,r)},error:{enumerable:!0,get:()=>C(y.errors,r)}}),[y,r]),k=a.useCallback(e=>{let t=d(e);return C(i._fields,r)||(g.current=i.register(r,{..._.current.rules,value:t})),g.current.onChange({target:{value:d(e),name:r},type:"change"})},[r,i]),x=a.useCallback(()=>g.current.onBlur({target:{value:C(i._formValues,r),name:r},type:h}),[r,i._formValues]),w=a.useCallback(e=>{e&&(v.current={focus:()=>T(e.focus)&&e.focus(),select:()=>T(e.select)&&e.select(),setCustomValidity:t=>T(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>T(e.reportValidity)&&e.reportValidity()});let t=C(i._fields,r);t&&t._f&&e&&(t._f.ref=v.current)},[i._fields,r]),A=a.useMemo(()=>({name:r,value:m,..."boolean"==typeof s||y.disabled?{disabled:y.disabled||s}:{},onChange:k,onBlur:x,ref:w}),[r,s,y.disabled,k,x,w,m]);return a.useEffect(()=>{let e=i._options.shouldUnregister||n;g.current=i.register(r,{..._.current.rules,..."boolean"==typeof _.current.disabled?{disabled:_.current.disabled}:{}});let t=(e,t)=>{let r=C(i._fields,e);r&&r._f&&(r._f.mount=t)};if(t(r,!0),e){let e=f(C(n?i._defaultValues:i._options.values||i._defaultValues,r,C(i._options.defaultValues,r,_.current.defaultValue)));F(i._defaultValues,r,e),V(C(i._formValues,r))&&F(i._formValues,r,e)}if(c||i.register(r),v.current){let e=C(i._fields,r);e&&e._f&&(e._f.ref=v.current)}return()=>{(c?e&&!i._state.action:e)?i.unregister(r):t(r,!1)}},[r,i,c,n]),a.useEffect(()=>{i._setDisabledField({disabled:s,name:r})},[s,r,i]),a.useMemo(()=>({field:A,formState:y,fieldState:b}),[A,y,b])}(e));var z=e=>({isOnSubmit:!e||e===y,isOnBlur:"onBlur"===e,isOnChange:e===m,isOnAll:"all"===e,isOnTouch:"onTouched"===e}),U=(e,t,r)=>{if(r)return!1;if(t.watchAll||t.watch.has(e))return!0;for(let r of t.watch)if(e.startsWith(r)&&"."===e.charAt(r.length))return!0;return!1};let B=(e,t,r,a)=>{for(let s of r||Object.keys(e)){if("_f"===s)continue;let i=r?C(e,s):e[s];if(i){let{_f:e}=i;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],s)&&!a)return!0;else if(e.ref&&t(e.ref,e.name)&&!a)return!0;else if(B(i,t))break}else if((l(i)||Array.isArray(i))&&B(i,t))break}}};var W=(e,t,r)=>{let a=C(e,r),s=Array.isArray(a)?a:[];return F(s,x,t[r]),F(e,r,s),e},K=e=>l(e)&&!Object.keys(e).length,q=e=>{if(!c)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},H=(e,t,r,a,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[a]:s||!0}}:{};let J={value:!1,isValid:!1},Y={value:!0,isValid:!0};var G=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!V(e[0].attributes.value)?V(e[0].value)||""===e[0].value?Y:{value:e[0].value,isValid:!0}:Y:J}return J};let X={isValid:!1,value:null};var Q=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,X):X;function ee(e,t,r="validate"){if($(e)||Array.isArray(e)&&e.every($)||"boolean"==typeof e&&!e)return{type:r,message:$(e)?e:"",ref:t}}var et=e=>!l(e)||e instanceof RegExp?{value:e,message:""}:e,er=async(e,t,r,a,n,d)=>{let{ref:u,refs:o,required:c,maxLength:f,minLength:h,min:p,max:m,pattern:y,validate:x,name:w,valueAsNumber:A,mount:S}=e._f,O=C(r,w);if(!S||t.has(w))return{};let F=o?o[0]:u,N=e=>{if(n&&F.reportValidity){let t="boolean"==typeof e?"":e||"";o?o.forEach(e=>e.setCustomValidity(t)):F.setCustomValidity(t),F.reportValidity()}},Z={},j="radio"===u.type,E="checkbox"===u.type,R=(A||"file"===u.type)&&V(u.value)&&V(O)||q(u)&&""===u.value||""===O||Array.isArray(O)&&!O.length,D=H.bind(null,w,a,Z),I=(e,t,r,a=_,s=v)=>{let i=e?t:r;Z[w]={type:e?a:s,message:i,ref:u,...D(e?a:s,i)}};if(d?!Array.isArray(O)||!O.length:c&&(!(j||E)&&(R||i(O))||"boolean"==typeof O&&!O||E&&!G(o).isValid||j&&!Q(o).isValid)){let{value:e,message:t}=$(c)?{value:!!c,message:c}:et(c);if(e&&(Z[w]={type:b,message:t,ref:F,...D(b,t)},!a))return N(t),Z}if(!R&&(!i(p)||!i(m))){let e,t,r=et(m),n=et(p);if(i(O)||s(O)||isNaN(O)){let a=u.valueAsDate||new Date(O),s=e=>new Date(new Date().toDateString()+" "+e),i="time"==u.type,l="week"==u.type;$(r.value)&&O&&(e=i?s(O)>s(r.value):l?O>r.value:a>new Date(r.value)),$(n.value)&&O&&(t=i?s(O)<s(n.value):l?O<n.value:a<new Date(n.value))}else{let a=u.valueAsNumber||(O?+O:O);i(r.value)||(e=a>r.value),i(n.value)||(t=a<n.value)}if((e||t)&&(I(!!e,r.message,n.message,"max","min"),!a))return N(Z[w].message),Z}if((f||h)&&!R&&($(O)||d&&Array.isArray(O))){let e=et(f),t=et(h),r=!i(e.value)&&O.length>+e.value,s=!i(t.value)&&O.length<+t.value;if((r||s)&&(I(r,e.message,t.message),!a))return N(Z[w].message),Z}if(y&&!R&&$(O)){let{value:e,message:t}=et(y);if(e instanceof RegExp&&!O.match(e)&&(Z[w]={type:g,message:t,ref:u,...D(g,t)},!a))return N(t),Z}if(x){if(T(x)){let e=ee(await x(O,r),F);if(e&&(Z[w]={...e,...D(k,e.message)},!a))return N(e.message),Z}else if(l(x)){let e={};for(let t in x){if(!K(e)&&!a)break;let s=ee(await x[t](O,r),F,t);s&&(e={...s,...D(t,s.message)},N(s.message),a&&(Z[w]=e))}if(!K(e)&&(Z[w]={ref:F,...e},!a))return Z}}return N(!0),Z},ea=e=>Array.isArray(e)?e:[e],es=e=>Array.isArray(e)?e.filter(Boolean):[];function ei(e,t){if($(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;let r=Array.isArray(t)?t:A.test(t)?[t]:O(t);if(r.some(e=>w.includes(String(e))))return e;let a=1===r.length?e:function(e,t){let r=t.length-1,a=0;for(;a<r;){if(i(e)){e=void 0;break}e=e[t[a]],a++}return e}(e,r),s=r.length-1,n=r[s];return a&&delete a[n],0!==s&&(l(a)&&K(a)||Array.isArray(a)&&function(e){for(let t in e)if(e.hasOwnProperty(t)&&!V(e[t]))return!1;return!0}(a))&&ei(e,r.slice(0,-1)),e}let en=e=>{let t={};for(let r of Object.keys(e))if(n(e[r])&&null!==e[r]&&!s(e[r])){let a=en(e[r]);for(let e of Object.keys(a))t[`${r}.${e}`]=a[e]}else t[r]=e[r];return t};a.createContext(null).displayName="HookFormContext";var el=()=>{let e=[];return{get observers(){return e},next:t=>{for(let r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}},ed=e=>q(e)&&e.isConnected;function eu(e){return Array.isArray(e)||l(e)}function eo(e){return Array.isArray(e)||l(e)&&!(e=>{for(let t in e)if(T(e[t]))return!0;return!1})(e)}function ec(e){return!!(e&&"_f"in e)}function ef(e){return Array.isArray(e)?!e.some(e=>!V(e)):!Object.keys(e).length}function eh(e,t){Array.isArray(e)?e[t]=void 0:delete e[t]}function ep(e,t={},r){for(let a in e){let s=e[a],i=r&&r[a];!eo(s)||Array.isArray(s)&&ec(i)?V(s)||(t[a]=!0):(t[a]=Array.isArray(s)?[]:{},ep(s,t[a],i),ef(t[a])&&eh(t,a))}return t}function em(e,t,r,a){for(let s in r||(r=ep(t,{},a)),e){let n=e[s],l=a&&a[s];!eo(n)||Array.isArray(n)&&ec(l)?D(n,t[s])?eh(r,s):r[s]=!0:(V(t)||E(r[s])?r[s]=ep(n,Array.isArray(n)?[]:{},l):em(n,i(t)?{}:t[s],r[s],l),ef(r[s])&&eh(r,s))}return r}var ey=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:a})=>V(e)?e:t?""===e?NaN:e?+e:e:r&&$(e)?new Date(e):a?a(e):e;function e_(e){let t=e.ref;return"file"===t.type?t.files:"radio"===t.type?Q(e.refs).value:"select-multiple"===t.type?[...t.selectedOptions].map(({value:e})=>e):"checkbox"===t.type?G(e.refs).value:ey(t.value,e)}var ev=e=>V(e)?e:e instanceof RegExp?e.source:l(e)?e.value instanceof RegExp?e.value.source:e.value:e;let eg="AsyncFunction";var eb=e=>{if(!e||!e.validate)return!1;if(T(e.validate))return e.validate.constructor.name===eg;if(l(e.validate)){for(let t in e.validate)if(e.validate[t].constructor.name===eg)return!0}return!1};function ek(e,t,r){let a=C(e,r);if(a||A.test(r))return{error:a,name:r};let s=r.split(".");for(;s.length;){let a=s.join("."),i=C(t,a),n=C(e,a);if(i&&!Array.isArray(i)&&r!==a)break;if(n&&n.type)return{name:a,error:n};if(n&&n.root&&n.root.type)return{name:`${a}.root`,error:n.root};s.pop()}return{name:r}}let ex={mode:y,reValidateMode:m,shouldFocusError:!0},ew="form",eA={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function eV(e={}){let t=a.useRef(void 0),r=a.useRef(void 0),n=a.useRef(e.formControl),[o,m]=a.useState(()=>({...f(eA),isLoading:T(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:T(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&n.current!==e.formControl)if(n.current=e.formControl,e.formControl)t.current={...e.formControl,formState:o},e.defaultValues&&!T(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:r,...a}=function(e={}){let t={...ex,...e},r={...f(eA),isLoading:T(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},a={},n=(l(t.defaultValues)||l(t.values))&&f(t.defaultValues||t.values)||{},o=t.shouldUnregister?{}:f(n),m={action:!1,actionArrayLengths:new Map,mount:!1,watch:!1,keepIsValid:!1},y={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},_={},v={},g=0,b=z(t.mode),w=z(t.reValidateMode),S={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},N={...S},Z={...N},j={array:el(),state:el()},E=0,R="all"===t.criteriaMode,I=(e,t)=>r=>{clearTimeout(v[e]),v[e]=setTimeout(t,r)},M=async e=>{if(!m.keepIsValid&&!t.disabled&&(N.isValid||Z.isValid||e)){let e,s=++E;t.resolver?(e=K((await X()).errors),s===E&&L()):e=await et({fields:a,onlyCheckValid:!0,eventType:"valid"}),s===E&&e!==r.isValid&&j.state.next({isValid:e})}},L=(e,a)=>{!t.disabled&&(N.isValidating||N.validatingFields||Z.isValidating||Z.validatingFields)&&((e||Array.from(y.mount)).forEach(e=>{e&&(a?F(r.validatingFields,e,a):ei(r.validatingFields,e))}),j.state.next({validatingFields:r.validatingFields,isValidating:!K(r.validatingFields)}))},H=()=>{r.dirtyFields=em(n,o,void 0,a)},J=(e,t)=>{F(r.errors,e,t),r.errors={...r.errors},j.state.next({errors:r.errors})},Y=(t,s,l,d)=>{let u=C(a,t);if(u){if((e=>{let t=A.test(e)?[e]:O(e),r=o,a=n;for(let e=0;e<t.length-1;e++){let s=t[e];if(r=i(r)?r:r[s],a=i(a)?a:a[s],null===r&&null!==a)return!0}return!1})(t)||(e=>{if(!m.actionArrayLengths.size)return!1;let t=A.test(e)?[e]:O(e),r=o,a="",s=-1,n=0;for(let e=0;e<t.length&&!i(r);e++){let i=t[e];if(a=a?`${a}.${i}`:i,Array.isArray(r)&&+i>=r.length)return -1!==s&&(e!==s||+i<n);m.actionArrayLengths.has(a)&&(s=e+1,n=m.actionArrayLengths.get(a)),r=r[i]}return!1})(t))return;let a=V(C(o,t)),c=C(o,t,V(l)?C(n,t):l);V(c)||d&&d.defaultChecked||s?F(o,t,s?c:e_(u._f)):ef(t,c),m.mount&&!m.action&&(M(),a&&r.isDirty&&(N.isDirty||Z.isDirty)&&(eo()||(r.isDirty=!1,j.state.next({...r}))),e.shouldUnregister&&a&&!V(C(o,t))&&U(t,y)&&(m.watch=!0))}},G=(e,s,i,l,d)=>{let u=!1,c=!1,f={name:e};if(!t.disabled||!0===l){if(!i||l){let t=D(C(n,e),s);if((N.isDirty||Z.isDirty)&&(c=r.isDirty,r.isDirty=f.isDirty=!t||eo(),u=c!==f.isDirty),c=!!C(r.dirtyFields,e),t!==r.isDirty){var h=r.dirtyFields,p=em(n,o,void 0,a);for(let e in h)e in p||delete h[e];Object.assign(h,p)}else t?ei(r.dirtyFields,e):F(r.dirtyFields,e,!0);f.dirtyFields=r.dirtyFields,u=u||(N.dirtyFields||Z.dirtyFields)&&!t!==c}if(i){let t=C(r.touchedFields,e);t||(F(r.touchedFields,e,i),f.touchedFields=r.touchedFields,u=u||(N.touchedFields||Z.touchedFields)&&t!==i)}u&&d&&j.state.next(f)}return u?f:{}},X=async e=>(L(e,!0),await t.resolver(o,t.context,((e,t,r,a)=>{let s={};for(let r of e){let e=C(t,r);e&&F(s,r,e._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:a}})(e||y.mount,a,t.criteriaMode,t.shouldUseNativeValidation))),Q=async e=>{let{errors:t}=await X(e);if(L(e),e){for(let a of e){let e=C(t,a);e?y.array.has(a)&&l(e)&&!Object.keys(e).some(e=>!Number.isNaN(Number(e)))?W(r.errors,{[a]:e},a):F(r.errors,a,e):ei(r.errors,a)}r.errors={...r.errors}}else r.errors=t;return t},ee=async({name:t,eventType:a})=>{if(e.validate){let s=await e.validate({formValues:o,formState:r,name:t,eventType:a});if(l(s))for(let e in s){let t=s[e];t&&eF(`${ew}.${e}`,{message:$(t.message)?t.message:"",type:t.type||k})}else $(s)||!s?eF(ew,{message:s||"",type:k}):eT(ew);return s}return!0},et=async({fields:a,onlyCheckValid:s,name:i,eventType:n,context:l={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(l.runRootValidation=!0,!await ee({name:i,eventType:n}))&&(l.valid=!1,s))return l.valid;for(let i in a){let d=a[i];if(d){let{_f:a,...u}=d;if(a){let i=y.array.has(a.name),n=d._f&&eb(d._f),u=N.validatingFields||N.isValidating||Z.validatingFields||Z.isValidating;n&&u&&L([a.name],!0);let c=await er(d,y.disabled,o,R,t.shouldUseNativeValidation&&!s,i);if(n&&u&&L([a.name]),c[a.name]&&(l.valid=!1,s)||(s||(C(c,a.name)?i?W(r.errors,c,a.name):F(r.errors,a.name,c[a.name]):ei(r.errors,a.name)),e.shouldUseNativeValidation&&c[a.name]))break}K(u)||await et({context:l,onlyCheckValid:s,fields:u,name:i,eventType:n})}}return l.valid},eo=(e,t)=>(e&&t&&F(o,e,t),!D(m.mount?o:n,n)),ec=(e,t,r)=>P(e,y,{...m.mount?o:V(t)||$(e)?n:t},r,t),ef=(e,t,r={},s=!1,n=!1,l=!1)=>{let d=C(a,e),u=t;if(d){let r=d._f;r&&(r.disabled||F(o,e,ey(t,r)),u=q(r.ref)&&i(t)?"":t,"select-multiple"===r.ref.type?[...r.ref.options].forEach(e=>e.selected=u.includes(e.value)):r.refs?"checkbox"===r.ref.type?r.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(u)?e.checked=!!u.find(t=>t===e.value):e.checked=u===e.value||!!u)}):r.refs.forEach(e=>e.checked=e.value===u):"file"===r.ref.type?r.ref.value="":(r.ref.value=u,r.ref.type||n||l||j.state.next({name:e,values:s?o:f(o)})))}(r.shouldDirty||r.shouldTouch)&&G(e,u,r.shouldTouch,r.shouldDirty,!n),r.shouldValidate&&eO(e,{delayError:r.delayError})},eh=(e,t,r,i=!1,n=!1,d=!1)=>{for(let u in y.array.has(e)&&j.array.next({name:e,values:i?o:f(o)}),t){if(!t.hasOwnProperty(u))return;let o=t[u],c=e+"."+u,f=C(a,c);(y.array.has(e)||l(o)||f&&!f._f)&&!s(o)?eh(c,o,r,i,n,d):ef(c,o,r,i,n,d)}},ep=(e,t,s,n,l=!1)=>{let d=C(a,e),u=y.array.has(e),c=n?t:f(t),h=D(C(o,e),c);if(h||F(o,e,c),u)j.array.next({name:e,values:n?o:f(o)}),(N.isDirty||N.dirtyFields||Z.isDirty||Z.dirtyFields)&&s.shouldDirty&&(H(),l||j.state.next({name:e,dirtyFields:r.dirtyFields,isDirty:eo(e,c)}));else{let t=Array.isArray(c)&&!c.length||K(c),r=!h&&!l;!d||d._f||i(c)||t?ef(e,c,s,n,l,r):eh(e,c,s,n,l,r)}if(!h&&!l){let t=U(e,y),a=n?o:f(o);j.state.next({...t&&r,name:m.mount||t?e:void 0,values:a})}},eg=(e,t,r={})=>ep(e,t,r,!1),eV=async i=>{m.mount=!0;let n=i.target,l=n.name,u=!0,c=C(a,l),p=e=>{u=Number.isNaN(e)||s(e)&&isNaN(e.getTime())||D(e,C(o,l,e))};if(c){var k,x,A,V,S;let s,m,$,P=n.type?e_(c._f):d(i),z=i.type===h||"focusout"===i.type,B=!(($=c._f).mount&&($.required||$.min||$.max||$.maxLength||$.minLength||$.pattern||$.validate))&&!e.validate&&!t.resolver&&!C(r.errors,l)&&!c._f.deps,W=B||(k=z,x=C(r.touchedFields,l),A=r.isSubmitted,V=w,!(S=b).isOnAll&&(!A&&S.isOnTouch?!(x||k):(A?V.isOnBlur:S.isOnBlur)?!k:(A?!V.isOnChange:!S.isOnChange)||k)),q=U(l,y,z);if(F(o,l,P),z){if(!n||!n.readOnly){c._f.onBlur&&c._f.onBlur(i);let e=_[l];e&&e(0)}}else c._f.onChange&&c._f.onChange(i);let H=G(l,P,z),Y=!K(H)||q;if(z||j.state.next({name:l,type:i.type,...g?{values:f(o)}:{}}),W)return(!B||!r.isValid)&&(N.isValid||Z.isValid)&&("onBlur"===t.mode?z&&M():z||M()),Y&&j.state.next({name:l,...q?{}:H});if(!t.resolver&&e.validate&&await ee({name:l,eventType:i.type}),!z&&q&&j.state.next({...r}),t.resolver){let{errors:e}=await X([l]);if(L([l]),p(P),!u){K(H)||j.state.next(H);return}let t=ek(r.errors,a,l),i=ek(e,a,t.name||l);s=i.error,l=i.name,m=K(e)}else L([l],!0),s=(await er(c,y.disabled,o,R,t.shouldUseNativeValidation))[l],L([l]),p(P),u&&(s?m=!1:(N.isValid||Z.isValid)&&(m=await et({fields:a,onlyCheckValid:!0,name:l,eventType:i.type})));if(u){c._f.deps&&(!Array.isArray(c._f.deps)||c._f.deps.length>0)&&eO(c._f.deps);var O=l,T=m,E=s;let e=C(r.errors,O),a=(N.isValid||Z.isValid)&&"boolean"==typeof T&&r.isValid!==T;if(t.delayError&&E?(_[O]=I(O,()=>J(O,E)),_[O](t.delayError)):(clearTimeout(v[O]),delete _[O],E?F(r.errors,O,E):ei(r.errors,O),r.errors={...r.errors}),(E?!D(e,E):e)||!K(H)||a){let e={...H,...a&&"boolean"==typeof T?{isValid:T}:{},errors:r.errors,name:O};r={...r,...e},j.state.next(e)}}}},eS=(e,t)=>{if(C(r.errors,t)&&e.focus)return e.focus(),1},eO=async(e,s={})=>{let i,n,l=ea(e);if(t.resolver){let t=await Q(V(e)?e:l);i=K(t),n=e?!l.some(e=>C(t,e)):i}else e?((n=(await Promise.all(l.map(async e=>{let t=C(a,e);return await et({fields:t&&t._f?{[e]:t}:t,eventType:p})}))).every(Boolean))||r.isValid)&&M():n=i=await et({fields:a,name:e,eventType:p});if(s.delayError&&t.delayError&&$(e)){let a=C(r.errors,e);a?(ei(r.errors,e),_[e]=I(e,()=>J(e,a)),_[e](t.delayError)):(clearTimeout(v[e]),delete _[e])}return j.state.next({...!$(e)||(N.isValid||Z.isValid)&&i!==r.isValid?{}:{name:e},...t.resolver||!e?{isValid:i}:{},errors:r.errors}),s.shouldFocus&&!n&&B(a,eS,e?l:y.mount),n},eC=(e,t)=>({invalid:!!C((t||r).errors,e),isDirty:!!C((t||r).dirtyFields,e),error:C((t||r).errors,e),isValidating:!!C(r.validatingFields,e),isTouched:!!C((t||r).touchedFields,e)}),eT=e=>{let t=e?ea(e):void 0;null==t||t.forEach(e=>ei(r.errors,e)),t?t.forEach(e=>{j.state.next({name:e,errors:r.errors})}):(r.errors={},j.state.next({errors:r.errors}))},eF=(e,t,s)=>{let i=(C(a,e,{_f:{}})._f||{}).ref,{ref:n,message:l,type:d,...u}=C(r.errors,e)||{};F(r.errors,e,{...u,...t,ref:i}),j.state.next({name:e,errors:r.errors,isValid:!1}),s&&s.shouldFocus&&i&&i.focus&&i.focus()},eN=e=>{var t;let a=!!(null==(t=e.formState)?void 0:t.values);a&&g++;let{unsubscribe:s}=j.state.subscribe({next:t=>{var a,s;let i,l,d,u;if(i=e.name,l=t.name,d=e.exact,(!i||!l||i===l||ea(i).some(e=>e&&(d?e===l||e.startsWith(l+"."):e.startsWith(l)||l.startsWith(e))))&&(a=e.formState||N,s=e.reRenderRoot,eP(t),!(u=Object.keys(t).filter(e=>"name"!==e)).length||s&&u.length>=Object.keys(a).length||u.find(e=>a[e]===(!s||"all")))){let a={...o};e.callback({values:a,...r,...t,defaultValues:n})}}});if(!a)return s;let i=!1;return()=>{i||(i=!0,g--,s())}},eZ=(e,s={})=>{for(let i of e?ea(e):y.mount)y.mount.delete(i),y.array.delete(i),s.keepValue||(ei(a,i),ei(o,i)),s.keepError||ei(r.errors,i),s.keepDirty||ei(r.dirtyFields,i),s.keepTouched||ei(r.touchedFields,i),s.keepIsValidating||ei(r.validatingFields,i),t.shouldUnregister||s.keepDefaultValue||ei(n,i);j.state.next({values:f(o)}),j.state.next({...r,...!s.keepDirty?{}:{isDirty:eo()}}),s.keepIsValid||M()},ej=({disabled:e,name:t})=>{if("boolean"==typeof e&&m.mount||e||y.disabled.has(t)){let r=y.disabled.has(t);e?y.disabled.add(t):y.disabled.delete(t),!!e!==r&&m.mount&&!m.action&&M()}},eE=(e,r={})=>{let s=C(a,e),i="boolean"==typeof r.disabled||"boolean"==typeof t.disabled,l=!y.registerName.has(e)&&s&&s._f&&!s._f.mount;return(F(a,e,{...s||{},_f:{...s&&s._f?s._f:{ref:{name:e}},name:e,mount:!0,...r}}),y.mount.add(e),s&&!l)?ej({disabled:"boolean"==typeof r.disabled?r.disabled:t.disabled,name:e}):Y(e,!0,r.value),{...i?{disabled:r.disabled||t.disabled}:{},...t.progressive?{required:!!r.required,min:ev(r.min),max:ev(r.max),minLength:ev(r.minLength),maxLength:ev(r.maxLength),pattern:ev(r.pattern)}:{},name:e,onChange:eV,onBlur:eV,ref:i=>{if(i){let t;y.registerName.add(e),eE(e,r),y.registerName.delete(e),s=C(a,e);let l=V(i.value)&&i.querySelectorAll&&i.querySelectorAll("input,select,textarea")[0]||i,d="radio"===(t=l).type||"checkbox"===t.type,u=s._f.refs||[];if(d?u.find(e=>e===l):l===s._f.ref)return;let o={...s._f};d?(o.refs=[...u.filter(ed),l,...Array.isArray(C(n,e))?[{}]:[]],o.ref={type:l.type,name:e}):(o.ref=l,delete o.refs),F(a,e,{_f:o}),Y(e,!1,void 0,l)}else(s=C(a,e,{}))._f&&(s._f.mount=!1),(t.shouldUnregister||r.shouldUnregister)&&!(u(y.array,e)&&m.action)&&y.unMount.add(e)}}},eR=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&B(a,eS,y.mount),eD=(e,s)=>async i=>{let n,l;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let d=f(o);if(j.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await X();L(),r.errors=e,d=f(t)}else await et({fields:a,eventType:"submit"});if(y.disabled.size)for(let e of y.disabled)ei(d,e);if(ei(r.errors,x),K(r.errors)){j.state.next({errors:{}});try{n=await e(d,i)}catch(e){l=e}}else s&&await s({...r.errors},i),eR(),setTimeout(eR);if(j.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:K(r.errors)&&!l,submitCount:r.submitCount+1,errors:r.errors}),l)throw l;return n},eI=(e,s={})=>{let i=e?f(e):n,l=f(i),d=K(e),u=a;if(s.keepDefaultValues||(n=i),!s.keepValues){if(s.keepDirtyValues)for(let e of Array.from(new Set([...y.mount,...function e(t,r,a="",s=[]){for(let i in t){let n=a?`${a}.${i}`:i,l=t[i];eu(l)&&eu(C(r,n))?e(l,r,n,s):s.push(n)}return s}(em(n,o,void 0,u),r.dirtyFields)]))){let t=C(r.dirtyFields,e),a=C(o,e),s=C(l,e);t&&!V(a)?F(l,e,a):t||V(s)||eg(e,s)}else{if(c&&V(e))for(let e of y.mount){let t=C(a,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(q(e)){let t=e.closest("form");if(t){t.reset();break}}}}if(s.keepFieldsRef)for(let e of y.mount)eg(e,C(l,e));else a={}}if(t.shouldUnregister){if(o=s.keepDefaultValues?f(n):{},s.keepFieldsRef)for(let e of y.mount)F(o,e,C(l,e))}else o=f(l);j.array.next({values:{...l}}),j.state.next({name:void 0,type:void 0,values:{...l}})}y={mount:s.keepDirtyValues?y.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},m.mount=!N.isValid||!!s.keepIsValid||!!s.keepDirtyValues||!t.shouldUnregister&&!K(l),m.watch=!!t.shouldUnregister,m.keepIsValid=!!s.keepIsValid,m.action=!1,m.actionArrayLengths.clear(),s.keepErrors||(r.errors={}),j.state.next({submitCount:s.keepSubmitCount?r.submitCount:0,isDirty:!d&&(s.keepDirty?r.isDirty:s.keepValues?eo():!!(s.keepDefaultValues&&!D(e,n))),isSubmitted:!!s.keepIsSubmitted&&r.isSubmitted,dirtyFields:d?{}:s.keepDirtyValues?s.keepDefaultValues&&o?em(n,o,void 0,u):r.dirtyFields:s.keepDefaultValues&&e?em(n,e,void 0,u):s.keepDirty?r.dirtyFields:{},touchedFields:s.keepTouched?r.touchedFields:{},errors:s.keepErrors?r.errors:{},isSubmitSuccessful:!!s.keepIsSubmitSuccessful&&r.isSubmitSuccessful,isSubmitting:!1,defaultValues:n})},e$=(e,r)=>eI(T(e)?e(o):e,{...t.resetOptions,...r}),eP=e=>{let{name:t,type:a,values:s,...i}=e;r={...r,...i}};j.state.subscribe({next:eP});let eM={control:{register:eE,unregister:eZ,getFieldState:eC,handleSubmit:eD,setError:eF,_subscribe:eN,_runSchema:X,_updateIsValidating:L,_focusError:eR,_getWatch:ec,_getDirty:eo,_setValid:M,_setFieldArray:(e,s=[],i,n,l=!0,d=!0)=>{if(n&&i&&!t.disabled){if(m.action=!0,!m.actionArrayLengths.has(e)){let t=C(a,e);m.actionArrayLengths.set(e,Array.isArray(t)?t.length:0)}if(d&&Array.isArray(C(a,e))){let t=i(C(a,e),n.argA,n.argB);l&&F(a,e,t)}if(d&&Array.isArray(C(r.errors,e))){var u;let t,a=C(r.errors,e),s=a.root,d=i(a,n.argA,n.argB)||a;s&&(d.root=s),l&&F(r.errors,e,d),es(t=C(u=r.errors,e)).length||(null==t?void 0:t.root)||ei(u,e)}if((N.touchedFields||Z.touchedFields)&&d&&Array.isArray(C(r.touchedFields,e))){let t=i(C(r.touchedFields,e),n.argA,n.argB);l&&F(r.touchedFields,e,t)}(N.dirtyFields||Z.dirtyFields)&&H(),j.state.next({name:e,isDirty:eo(e,s),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else F(o,e,s)},_setDisabledField:ej,_setErrors:e=>{r.errors=e,j.state.next({errors:r.errors,isValid:!1})},_getFieldArray:e=>es(C(m.mount?o:n,e,t.shouldUnregister?C(n,e,[]):[])),_reset:eI,_resetDefaultValues:()=>T(t.defaultValues)&&t.defaultValues().then(e=>{e$(e,t.resetOptions),j.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(let e of y.unMount){let t=C(a,e);t&&(t._f.refs?t._f.refs.every(e=>!ed(e)):!ed(t._f.ref))&&eZ(e)}y.unMount=new Set},_disableForm:e=>{"boolean"==typeof e&&(j.state.next({disabled:e}),B(a,(t,r)=>{let s=C(a,r);s&&(t.disabled=s._f.disabled||e,Array.isArray(s._f.refs)&&s._f.refs.forEach(t=>{t.disabled=s._f.disabled||e}))},0,!1))},_subjects:j,_proxyFormState:N,get _fields(){return a},get _formValues(){return o},get _state(){return m},set _state(value){m=value},get _defaultValues(){return n},get _names(){return y},set _names(value){y=value},get _formState(){return r},get _options(){return t},set _options(value){b=z((t={...t,...value}).mode),w=z(t.reValidateMode)}},subscribe:e=>(m.mount=!0,Z={...Z,...e.formState},eN({...e,formState:{...S,...e.formState}})),trigger:eO,register:eE,handleSubmit:eD,watch:(e,t)=>{if(T(e)){g++;let{unsubscribe:r}=j.state.subscribe({next:r=>"values"in r&&e(r.values||ec(void 0,t),r)}),a=!1;return{unsubscribe:()=>{a||(a=!0,g--,r())}}}return ec(e,t,!0)},setValue:eg,setValues:(e,t={})=>{let a=T(e)?e(o):e;if(!D(o,a)){o={...o,...a};let e=en(a);for(let r of y.mount)r in e&&ep(r,e[r],t,!0,!0);j.state.next({...r,name:void 0,type:void 0,...g?{values:o}:{}}),t.shouldValidate&&M()}},getValues:(e,t)=>{let a={...m.mount?o:n};return t&&(a=function e(t,r){let a={};for(let s in t)if(t.hasOwnProperty(s)){let i=t[s],n=r[s];if(i&&l(i)&&n){let t=e(i,n);l(t)&&(a[s]=t)}else t[s]&&(a[s]=n)}return a}(t.dirtyFields?r.dirtyFields:r.touchedFields,a)),V(e)?a:$(e)?C(a,e):e.map(e=>C(a,e))},reset:e$,resetField:(e,t={})=>{C(a,e)&&(V(t.defaultValue)?eg(e,f(C(n,e))):(eg(e,t.defaultValue),F(n,e,f(t.defaultValue))),t.keepTouched||ei(r.touchedFields,e),t.keepDirty||(ei(r.dirtyFields,e),r.isDirty=t.defaultValue?eo(e,f(C(n,e))):eo()),!t.keepError&&(ei(r.errors,e),N.isValid&&M()),j.state.next({...r}))},resetDefaultValues:(e,t={})=>{if(n=f(e),!t.keepDirty){let e=em(n,o,void 0,a);r.dirtyFields=e,r.isDirty=!K(e)}t.keepIsValid||M(),j.state.next({...r,defaultValues:n})},clearErrors:eT,unregister:eZ,setError:eF,setFocus:(e,t={})=>{let r=C(a,e),s=r&&r._f;if(s){let e=s.refs?s.refs[0]:s.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&T(e.select)&&e.select()})}},getFieldState:eC};return{...eM,formControl:eM}}(e);t.current={...a,formState:o}}let y=t.current.control;y._options=e;let{resyncIfNeeded:_,snapshot:v}=I();return j(()=>{let e=()=>({...y._formState,defaultValues:y._defaultValues});_(!0,e,m);let t=y._subscribe({formState:y._proxyFormState,callback:()=>m({...y._formState,defaultValues:y._defaultValues}),reRenderRoot:!0});return m(e=>({...e,isReady:!0})),y._formState.isReady=!0,()=>{t(),v(!0,e)}},[y,_,v]),a.useEffect(()=>y._disableForm(e.disabled),[y,e.disabled]),a.useEffect(()=>{e.mode&&(y._options.mode=e.mode),e.reValidateMode&&(y._options.reValidateMode=e.reValidateMode)},[y,e.mode,e.reValidateMode]),a.useEffect(()=>{e.errors&&(y._setErrors(e.errors),y._focusError())},[y,e.errors]),a.useEffect(()=>{e.shouldUnregister&&y._subjects.state.next({values:y._getWatch()})},[y,e.shouldUnregister]),a.useEffect(()=>{if(y._proxyFormState.isDirty){let e=y._getDirty();e!==o.isDirty&&y._subjects.state.next({isDirty:e})}},[y,o.isDirty]),a.useEffect(()=>{var t;e.values&&!D(e.values,r.current)?(y._reset(e.values,{keepFieldsRef:!0,...y._options.resetOptions}),(null==(t=y._options.resetOptions)?void 0:t.keepIsValid)||y._setValid(),r.current=e.values,m(e=>({...e}))):y._resetDefaultValues()},[y,e.values]),a.useEffect(()=>{y._state.mount||(y._setValid(),y._state.mount=!0),y._state.watch&&(y._state.watch=!1,y._subjects.state.next({...y._formState})),y._removeUnmounted()}),t.current.formState=a.useMemo(()=>Z(o,y),[y,o]),t.current}}}]);