1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="ef6b934b-dbf3-7b1f-17e6-275059fc1861")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,757890,(e,t,i)=>{"use strict";var s=e.r(17772),r=e.r(3909),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=r.useSyncExternalStore,o=s.useRef,l=s.useEffect,u=s.useMemo,d=s.useDebugValue;i.useSyncExternalStoreWithSelector=function(e,t,i,s,r){var h=o(null);if(null===h.current){var c={hasValue:!1,value:null};h.current=c}else c=h.current;var f=n(e,(h=u(function(){function e(e){if(!l){if(l=!0,n=e,e=s(e),void 0!==r&&c.hasValue){var t=c.value;if(r(t,e))return o=t}return o=e}if(t=o,a(n,e))return t;var i=s(e);return void 0!==r&&r(t,i)?(n=e,t):(n=e,o=i)}var n,o,l=!1,u=void 0===i?null:i;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]},[t,i,s,r]))[0],h[1]);return l(function(){c.hasValue=!0,c.value=f},[f]),d(f),f}},383835,(e,t,i)=>{"use strict";t.exports=e.r(757890)},943594,724361,e=>{"use strict";let t,i;var s,r=e.i(45113),a=((s=a||{})[s.None=0]="None",s[s.Mutable=1]="Mutable",s[s.Watching=2]="Watching",s[s.RecursedCheck=4]="RecursedCheck",s[s.Recursed=8]="Recursed",s[s.Dirty=16]="Dirty",s[s.Pending=32]="Pending",s);function n(e,t,i){let s="object"==typeof e,r=s?e:void 0;return{next:(s?e.next:e)?.bind(r),error:(s?e.error:t)?.bind(r),complete:(s?e.complete:i)?.bind(r)}}let o=[],l=0,{link:u,unlink:d,propagate:h,checkDirty:c,shallowPropagate:f}=function({update:e,notify:t,unwatched:i}){return{link:function(e,t,i){let s=t.depsTail;if(void 0!==s&&s.dep===e)return;let r=void 0!==s?s.nextDep:t.deps;if(void 0!==r&&r.dep===e){r.version=i,t.depsTail=r;return}let a=e.subsTail;if(void 0!==a&&a.version===i&&a.sub===t)return;let n=t.depsTail=e.subsTail={version:i,dep:e,sub:t,prevDep:s,nextDep:r,prevSub:a,nextSub:void 0};void 0!==r&&(r.prevDep=n),void 0!==s?s.nextDep=n:t.deps=n,void 0!==a?a.nextSub=n:e.subs=n},unlink:function(e,t=e.sub){let s=e.dep,r=e.prevDep,a=e.nextDep,n=e.nextSub,o=e.prevSub;return void 0!==a?a.prevDep=r:t.depsTail=r,void 0!==r?r.nextDep=a:t.deps=a,void 0!==n?n.prevSub=o:s.subsTail=o,void 0!==o?o.nextSub=n:void 0===(s.subs=n)&&i(s),a},propagate:function(e){let i,s=e.nextSub;e:for(;;){let r=e.sub,a=r.flags;if(60&a?12&a?4&a?!(48&a)&&function(e,t){let i=t.depsTail;for(;void 0!==i;){if(i===e)return!0;i=i.prevDep}return!1}(e,r)?(r.flags=40|a,a&=1):a=0:r.flags=-9&a|32:a=0:r.flags=32|a,2&a&&t(r),1&a){let t=r.subs;if(void 0!==t){let r=(e=t).nextSub;void 0!==r&&(i={value:s,prev:i},s=r);continue}}if(void 0!==(e=s)){s=e.nextSub;continue}for(;void 0!==i;)if(e=i.value,i=i.prev,void 0!==e){s=e.nextSub;continue e}break}},checkDirty:function(t,i){let r,a=0,n=!1;e:for(;;){let o=t.dep,l=o.flags;if(16&i.flags)n=!0;else if((17&l)==17){if(e(o)){let e=o.subs;void 0!==e.nextSub&&s(e),n=!0}}else if((33&l)==33){(void 0!==t.nextSub||void 0!==t.prevSub)&&(r={value:t,prev:r}),t=o.deps,i=o,++a;continue}if(!n){let e=t.nextDep;if(void 0!==e){t=e;continue}}for(;a--;){let a=i.subs,o=void 0!==a.nextSub;if(o?(t=r.value,r=r.prev):t=a,n){if(e(i)){o&&s(a),i=t.sub;continue}n=!1}else i.flags&=-33;i=t.sub;let l=t.nextDep;if(void 0!==l){t=l;continue e}}return n}},shallowPropagate:s};function s(e){do{let i=e.sub,s=i.flags;(48&s)==32&&(i.flags=16|s,(6&s)==2&&t(i))}while(void 0!==(e=e.nextSub))}}({update:e=>e._update(),notify(e){o[m++]=e,e.flags&=~a.Watching},unwatched(e){void 0!==e.depsTail&&(e.depsTail=void 0,e.flags=a.Mutable|a.Dirty,b(e))}}),v=0,m=0,p=0;function g(e){try{++p,e()}finally{--p||M()}}function b(e){let t=e.depsTail,i=void 0!==t?t.nextDep:e.deps;for(;void 0!==i;)i=d(i,e)}function M(){if(!(p>0)){for(;v<m;){let e=o[v];o[v++]=void 0,e.notify()}v=0,m=0}}function y(e,i){let s="function"==typeof e,r={_snapshot:s?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:s?a.None:a.Mutable,get:()=>(void 0!==t&&u(r,t,l),r._snapshot),subscribe(e){var i;let s,o,u=n(e),d={current:!1},h=(i=()=>{r.get(),d.current?u.next?.(r._snapshot):d.current=!0},s=()=>{let e=t;t=o,++l,o.depsTail=void 0,o.flags=a.Watching|a.RecursedCheck;try{return i()}finally{t=e,o.flags&=~a.RecursedCheck,b(o)}},o={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:a.Watching|a.RecursedCheck,notify(){let e=this.flags;e&a.Dirty||e&a.Pending&&c(this.deps,this)?s():this.flags=a.Watching},stop(){this.flags=a.None,this.depsTail=void 0,b(this)}},s(),o);return{unsubscribe:()=>{h.stop()}}},_update(n){let o=t,u=i?.compare??Object.is;if(s)t=r,++l,r.depsTail=void 0;else if(void 0===n)return!1;s&&(r.flags=a.Mutable|a.RecursedCheck);try{let t=r._snapshot,i="function"==typeof n?n(t):void 0===n&&s?e(t):n;if(void 0===t||!u(t,i))return r._snapshot=i,!0;return!1}finally{t=o,s&&(r.flags&=~a.RecursedCheck),b(r)}}};return s?(r.flags=a.Mutable|a.Dirty,r.get=function(){let e=r.flags;if(e&a.Dirty||e&a.Pending&&c(r.deps,r)){if(r._update()){let e=r.subs;void 0!==e&&f(e)}}else e&a.Pending&&(r.flags=e&~a.Pending);return void 0!==t&&u(r,t,l),r._snapshot}):r.set=function(e){if(r._update(e)){let e=r.subs;void 0!==e&&(h(e),f(e),M())}},r}class S{constructor(e){this.atom=y(e)}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(n(e))}}class V{constructor(e){this.atom=y(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(n(e))}}function E(e){return"function"==typeof e?new V(e):new S(e)}var A=class{constructor(e,t){this.fn=e,this.options=t,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{let t=Date.now()-this.lastExecutionTime;if(this.options.leading&&t>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){let e=this.options.wait-t;this.isPending=!0,this.timeoutId=setTimeout(()=>{void 0!==this.lastArgs&&this.execute(...this.lastArgs)},e)}},this.execute=(...e)=>{this.fn(...e),this.options.onExecute?.(e,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0)},void 0===this.options.leading&&void 0===this.options.trailing&&(this.options.leading=!0,this.options.trailing=!0)}};class I{#e=!0;#t;#i;#s;#r;#a;#n;#o;#l=0;#u=5;#d=!1;#h=!1;#c=null;#f=()=>{this.debugLog("Connected to event bus"),this.#a=!0,this.#d=!1,this.debugLog("Emitting queued events",this.#r),this.#r.forEach(e
2=>this.emitEventToBus(e)),this.#r=[],this.stopConnectLoop(),this.#i().removeEventListener("tanstack-connect-success",this.#f)};#v=()=>{if(this.#l<this.#u){this.#l++,this.dispatchCustomEvent("tanstack-connect",{});return}this.#i().removeEventListener("tanstack-connect",this.#v),this.#h=!0,this.debugLog("Max retries reached, giving up on connection"),this.stopConnectLoop()};#m=()=>{this.#d||(this.#d=!0,this.#i().addEventListener("tanstack-connect-success",this.#f),this.#v())};constructor({pluginId:e,debug:t=!1,enabled:i=!0,reconnectEveryMs:s=300}){this.#t=e,this.#e=i,this.#i=this.getGlobalTarget,this.#s=t,this.debugLog(" Initializing event subscription for plugin",this.#t),this.#r=[],this.#a=!1,this.#h=!1,this.#n=null,this.#o=s}startConnectLoop(){null!==this.#n||this.#a||(this.debugLog(`Starting connect loop (every ${this.#o}ms)`),this.#n=setInterval(this.#v,this.#o))}stopConnectLoop(){this.#d=!1,null!==this.#n&&(clearInterval(this.#n),this.#n=null,this.#r=[],this.debugLog("Stopped connect loop"))}debugLog(...e){this.#s&&console.log(`ð´ [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if("u">typeof globalThis&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog("Using global event target"),globalThis.__TANSTACK_EVENT_TARGET__;if("u">typeof window&&void 0!==window.addEventListener)return this.debugLog("Using window as event target"),window;let e="u">typeof EventTarget?new EventTarget:void 0;return void 0===e||void 0===e.addEventListener?(this.debugLog("No event mechanism available, running in non-web environment"),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog("Using new EventTarget as fallback"),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let i=new Event(e,{detail:t});this.#i().dispatchEvent(i)}catch(e){this.debugLog("Failed to dispatch shim event")}}dispatchCustomEvent(e,t){try{this.#i().dispatchEvent(new CustomEvent(e,{detail:t}))}catch(i){this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog("Emitting event to client bus",e),this.dispatchCustomEvent("tanstack-dispatch-event",e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e)return void this.debugLog("Event bus client is disabled, not emitting event",e,t);if(this.#c&&(this.debugLog("Emitting event to internal event target",e,t),this.#c.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#h)return void this.debugLog("Previously failed to connect, not emitting to bus");if(!this.#a){this.debugLog("Bus not available, will be pushed as soon as connected"),this.#r.push(this.createEventPayload(e,t)),"u">typeof CustomEvent&&!this.#d&&(this.#m(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,i){let s=i?.withEventTarget??!1,r=`${this.#t}:${e}`;if(s&&(this.#c||(this.#c=new EventTarget),this.#c.addEventListener(r,e=>{t(e.detail)})),!this.#e)return this.debugLog("Event bus client is disabled, not registering event",r),()=>{};let a=e=>{this.debugLog("Received event from bus",e.detail),t(e.detail)};return this.#i().addEventListener(r,a),this.debugLog("Registered event to bus",r),()=>{s&&this.#c?.removeEventListener(r,a),this.#i().removeEventListener(r,a)}}onAll(e){if(!this.#e)return this.debugLog("Event bus client is disabled, not registering event"),()=>{};let t=t=>{e(t.detail)};return this.#i().addEventListener("tanstack-devtools-global",t),()=>this.#i().removeEventListener("tanstack-devtools-global",t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog("Event bus client is disabled, not registering event"),()=>{};let t=t=>{let i=t.detail;this.#t&&i.pluginId!==this.#t||e(i)};return this.#i().addEventListener("tanstack-devtools-global",t),()=>this.#i().removeEventListener("tanstack-devtools-global",t)}}let F=new class extends I{constructor(){super({pluginId:"form-devtools",reconnectEveryMs:1e3})}};function T(e,t){return"function"==typeof e?e(t):e}function w(e,t){return _(t).reduce((e,t)=>null===e?null:void 0!==e?e[t]:void 0,e)}function L(e,t,i){let s=_(t);return function e(t){if(!s.length)return T(i,t);let r=s.shift();if("string"==typeof r||"number"==typeof r&&!Array.isArray(t))return"object"==typeof t?(null===t&&(t={}),{...t,[r]:e(t[r])}):{[r]:e()};if(Array.isArray(t)&&"number"==typeof r){let i=t.slice(0,r);return[...i.length?i:Array(r),e(t[r]),...t.slice(r+1)]}return[...Array(r),e()]}(e)}let C=/^(\d+)$/gm,O=/\.(\d+)(?=\.)/gm,B=/^(\d+)\./gm,j=/\.(\d+$)/gm,k=/\.{2,}/gm,D="__int__",x=`${D}$1`;function _(e){if(Array.isArray(e))return[...e];if("string"!=typeof e)throw Error("Path must be a string.");return e.replace(/(^\[)|]/gm,"").replace(/\[/g,".").replace(C,x).replace(O,`.${x}.`).replace(B,`${x}.`).replace(j,`.${x}`).replace(k,".").split(".").map(e=>{if(e.startsWith(D)){let t=e.substring(D.length),i=parseInt(t,10);return String(i)===t?i:t}return e})}function P(e,t){return t.validationLogic({form:t.form,validators:t.validators,event:{type:e,async:!1},runValidation:e=>
2e.validators.filter(Boolean).map(e=>({cause:e.cause,validate:e.fn}))})}function R(e,t){let{asyncDebounceMs:i}=t,{onBlurAsyncDebounceMs:s,onChangeAsyncDebounceMs:r,onDynamicAsyncDebounceMs:a}=t.validators||{},n=i??0;return t.validationLogic({form:t.form,validators:t.validators,event:{type:e,async:!0},runValidation:t=>t.validators.filter(Boolean).map(t=>{let i=t?.cause||e,o=n;switch(i){case"change":o=r??n;break;case"blur":o=s??n;break;case"dynamic":o=a??n;break;case"submit":o=0}return"submit"===e&&(o=0),{cause:i,validate:t.fn,debounceMs:o}})})}let $=e=>!!e&&"object"==typeof e&&"fields"in e;function W(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[i,s]of e)if(!t.has(i)||!Object.is(s,t.get(i)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let i of e)if(!t.has(i))return!1;return!0}let i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;for(let r of i)if(!s.includes(r)||!W(e[r],t[r]))return!1;return!0}let N=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:i})=>e?{newErrorValue:e,newSource:"form"}:t?{newErrorValue:void 0,newSource:void 0}:i?{newErrorValue:i,newSource:"field"}:{newErrorValue:void 0,newSource:void 0},q=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:"field"}:e?{newErrorValue:e,newSource:"form"}:{newErrorValue:void 0,newSource:void 0};function U(e,t){return null==e?t:{...e,...t}}let z=256,G=[];for(;z--;)G[z]=(z+256).toString(16).substring(1);function K(){let e,t=0,s="";if(!i||z+16>256){for(i=Array(256),t=256;t--;)i[t]=256*Math.random()|0;t=0,z=0}for(;t<16;t++)e=i[z+t],6===t?s+=G[15&e|64]:8===t?s+=G[63&e|128]:s+=G[e],1&t&&t>1&&t<11&&(s+="-");return z++,s}let H=new A(e=>F.emit("form-state",{id:e.formId,state:e.store.state}),{wait:300}).maybeExecute,J=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});let t=e.event.async,i=t?void 0:{fn:e.validators.onMount,cause:"mount"},s={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:"change"},r={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:"blur"},a={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:"submit"},n=t?void 0:{fn:()=>void 0,cause:"server"};switch(e.event.type){case"mount":return e.runValidation({validators:[i],form:e.form});case"submit":return e.runValidation({validators:[s,r,a,n],form:e.form});case"server":return e.runValidation({validators:[],form:e.form});case"blur":return e.runValidation({validators:[r,n],form:e.form});case"change":return e.runValidation({validators:[s,n],form:e.form});default:throw Error(`Unknown validation event type: ${e.event.type}`)}},Q=(e,t)=>{let i=function(e,t){let i=new Map;for(let s of e){let e=s.path??[],r=t,a="";for(let t=0;t<e.length;t++){let i=e[t];if(void 0===i)continue;let s="object"==typeof i?i.key:i,n=Number(s);Array.isArray(r)&&!Number.isNaN(n)?a+=`[${n}]`:a+=(t>0?".":"")+String(s),r="object"==typeof r&&null!==r?r[s]:void 0}i.set(a,(i.get(a)??[]).concat(s))}return Object.fromEntries(i)}(e,t);return{form:i,fields:i}},X={validate({value:e,validationSource:t},i){let s=i["~standard"].validate(e);if(s instanceof Promise)throw Error("async function passed to sync validator");if(s.issues)return"field"===t?s.issues:Q(s.issues,e)},async validateAsync({value:e,validationSource:t},i){let s=await i["~standard"].validate(e);if(s.issues)return"field"===t?s.issues:Q(s.issues,e)}},Y=e=>!!e&&"~standard"in e,Z={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{}};function ee(e){function t(e,t){return`${e}[${t}]`}function i(i,s,r,a){let n=[t(i,s)];switch(r){case"swap":n.push(t(i,a));break;case"move":{let[e,r]=[Math.min(s,a),Math.max(s,a)];for(let s=e;s<=r;s++)n.push(t(i,s));break}default:{let r=e.getFieldValue(i),a=Array.isArray(r)?r.length:0;for(let e=s+1;e<a;e++)n.push(t(i,e))}}return Object.keys(e.fieldInfo).filter(e=>n.some(t=>e.startsWith(t)))}
2function s(t,i){("up"===i?t:[...t].reverse()).forEach(t=>{var s;let a=(s=t.toString(),s.replace(/\[(\d+)\]/,(e,t)=>{let s=parseInt(t,10),r="up"===i?s+1:Math.max(0,s-1);return`[${r}]`})),n=e.getFieldMeta(a);n?e.setFieldMeta(t,n):e.setFieldMeta(t,r())})}let r=()=>Z;return{handleArrayMove:function(r,a,n){let o=i(r,a,"move",n),l=Math.min(a,n),u=Math.max(a,n);for(let e=l;e<=u;e++)o.push(t(r,e));let d=Object.keys(e.fieldInfo).reduce((i,s)=>(s.startsWith(t(r,a))&&i.set(s,e.getFieldMeta(s)),i),new Map);s(o,a<n?"up":"down"),Object.keys(e.fieldInfo).filter(e=>e.startsWith(t(r,n))).forEach(i=>{let s=i.replace(t(r,n),t(r,a)),o=d.get(s);o&&e.setFieldMeta(i,o)})},handleArrayRemove:function(e,t){s(i(e,t,"remove"),"up")},handleArraySwap:function(s,r,a){i(s,r,"swap",a).forEach(i=>{if(!i.toString().startsWith(t(s,r)))return;let n=i.toString().replace(t(s,r),t(s,a)),[o,l]=[e.getFieldMeta(i),e.getFieldMeta(n)];o&&e.setFieldMeta(n,o),l&&e.setFieldMeta(i,l)})},handleArrayInsert:function(a,n){let o=i(a,n,"insert");s(o,"down"),o.forEach(i=>{i.toString().startsWith(t(a,n))&&e.setFieldMeta(i,r())})}}}function et(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1,validationMetaMap:e.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}class ei{constructor(e){let t,i;this.options={},this.fieldInfo={},this.mount=()=>{let e=this.store.subscribe(()=>{H(this)}),t=F.on("request-form-state",e=>{e.payload.id===this._formId&&F.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}),i=F.on("request-form-reset",e=>{e.payload.id===this._formId&&this.reset()}),s=F.on("request-form-force-submit",e=>{e.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),r=()=>{s(),i(),t(),e.unsubscribe(),F.emit("form-unmounted",{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return F.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}),a&&this.validateSync("mount"),r},this.update=e=>{if(!e)return;let t=this.options;this.options=e;let i=e.defaultValues&&!W(e.defaultValues,t.defaultValues)&&!this.state.isTouched,s=!W(e.defaultState,t.defaultState)&&!this.state.isTouched;
2(i||s)&&(g(()=>{this.baseStore.setState(()=>et(Object.assign({},this.state,s?e.defaultState:{},i?{values:e.defaultValues}:{})))}),F.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}))},this.reset=(e,t)=>{let{fieldMeta:i}=this.state,s=this.resetFieldMeta(i);e&&!t?.keepDefaultValues&&(this.options={...this.options,defaultValues:e}),this.baseStore.setState(()=>et({...this.options.defaultState,values:e??this.options.defaultValues??this.options.defaultState?.values,fieldMetaBase:s}))},this.validateAllFields=async e=>{let t=[];return g(()=>{Object.values(this.fieldInfo).forEach(i=>{if(!i.instance)return;let s=i.instance;t.push(Promise.resolve().then(()=>s.validate(e,{skipFormValidation:!0}))),i.instance.state.meta.isTouched||i.instance.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=async(e,t,i)=>{let s=this.getFieldValue(e),r=Array.isArray(s)?Math.max(s.length-1,0):null,a=[`${e}[${t}]`];for(let i=t+1;i<=(r??0);i++)a.push(`${e}[${i}]`);let n=Object.keys(this.fieldInfo).filter(e=>a.some(t=>e.startsWith(t))),o=[];return g(()=>{n.forEach(e=>{o.push(Promise.resolve().then(()=>this.validateField(e,i)))})}),(await Promise.all(o)).flat()},this.validateField=(e,t)=>{let i=this.fieldInfo[e]?.instance;if(!i){let{hasErrored:i}=this.validateSync(t);return i&&!this.options.asyncAlways?this.getFieldMeta(e)?.errors??[]:this.validateAsync(t).then(()=>this.getFieldMeta(e)?.errors??[])}return i.state.meta.isTouched||i.setMeta(e=>({...e,isTouched:!0})),i.validate(t)},this.validateSync=e=>{let t=P(e,{...this.options,form:this,validationLogic:this.options.validationLogic||J}),i=!1,s={};return g(()=>{for(let e of t){if(!e.validate)continue;let{formError:t,fieldErrors:r}=es(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:"form"},type:"validate"})),a=er(e.cause);for(let e of new Set([...Object.keys(this.state.fieldMeta),...Object.keys(r||{})])){if(void 0===this.baseStore.state.fieldMetaBase[e]&&!r?.[e])continue;let{errorMap:t,errorSourceMap:i}=this.getFieldMeta(e)??Z,n=r?.[e],{newErrorValue:o,newSource:l}=N({newFormValidatorError:n,isPreviousErrorFromFormValidator:i?.[a]==="form",previousErrorValue:t?.[a]});"form"===l&&(s[e]={...s[e],[a]:n}),t?.[a]!==o&&this.setFieldMeta(e,(e=Z)=>({...e,errorMap:{...e.errorMap,[a]:o},errorSourceMap:{...e.errorSourceMap,[a]:l}}))}this.state.errorMap?.[a]!==t&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:t}})),(t||r)&&(i=!0)}let r=er("submit");this.state.errorMap?.[r]&&"submit"!==e&&!i&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[r]:void 0}}));let a=er("server");this.state.errorMap?.[a]&&"server"!==e&&!i&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}))}),{hasErrored:i,fieldsErrorMap:s}},this.validateAsync=async e=>{let t,i=R(e,{...this.options,form:this,validationLogic:this.options.validationLogic||J});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let s=[];for(let e of i){if(!e.validate)continue;let i=er(e.cause),r=this.state.validationMetaMap[i];r?.lastAbortController.abort();let a=new AbortController;this.state.validationMetaMap[i]={lastAbortController:a},s.push(new Promise(async i=>{let s;try{s=await new Promise((t,i)=>{setTimeout(async()=>{if(a.signal.aborted)return t(void 0);try{t(await this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:"form",signal:a.signal},type:"validateAsync"}))}catch(e){i(e)}},e.debounceMs)})}catch(e){s=e}let{formError:r,fieldErrors:n}=es(s);n&&(t=t?{...t,...n}:n);let o=er(e.cause);for(let e of Object.keys(this.state.fieldMeta)){if(void 0===this.baseStore.state.fieldMetaBase[e])continue;let i=this.getFieldMeta(e);if(!i)continue;let{errorMap:s,errorSourceMap:r}=i,{newErrorValue:a,newSource:n}=N({newFormValidatorError:t?.[e],isPreviousErrorFromFormValidator:r?.[o]==="form",previousErrorValue:s?.[o]});s?.[o]!==a&&this.setFieldMeta(e,e=>({...e,errorMap:{...e.errorMap,[o]:a},errorSourceMap:{...e.errorSourceMap,[o]:n}}))}this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:r}})),i(t?{fieldErrors:t,errorMapKey:o}:void 0)}))}let r={};if(s.length){for(let e of(await Promise.all(s)))if(e?.fieldErrors){let{errorMapKey:t}=e;for(let[i,s]of Object.entries(e.fieldErrors)){let e={...r[i]||{},[t]:s};r[i]=e}}}return this.baseStore.setState(e=>({...e,isFormValidating:!1})),r},this.validate=e=>{let{hasErrored:t,fieldsErrorMap:i}=this.validateSync(e);return t&&!this.options.asyncAlways?i:this.validateAsync(e)},this._handleSubmit=async e=>{this.baseStore.setState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),g(()=>
2{Object.values(this.fieldInfo).forEach(e=>{e.instance&&(e.instance.state.meta.isTouched||e.instance.setMeta(e=>({...e,isTouched:!0})))})});let t=e??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride)return void this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});this.baseStore.setState(e=>({...e,isSubmitting:!0}));let i=()=>{this.baseStore.setState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.state.isFieldsValid){i(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),F.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validateAllFields",errors:Object.values(this.state.fieldMeta).map(e=>e.errors).flat()});return}if(await this.validate("submit"),!this.state.isValid){i(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),F.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validate",errors:this.state.errors});return}g(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance?.options.listeners?.onSubmit?.({value:e.instance.state.value,fieldApi:e.instance})})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),g(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),F.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),i()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),F.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"inflight",onError:e}),i(),e}},this.getFieldValue=e=>w(this.state.values,e),this.getFieldMeta=e=>this.state.fieldMeta[e],this.getFieldInfo=e=>this.fieldInfo[e]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(e,t)=>{this.baseStore.setState(i=>({...i,fieldMetaBase:{...i.fieldMetaBase,[e]:T(t,i.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>(e[t]=Z,e),{}),this.setFieldValue=(e,t,i)=>{let s=i?.dontUpdateMeta??!1,r=i?.dontRunListeners??!1,a=i?.dontValidate??!1;g(()=>{s||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(i=>({...i,values:L(i.values,e,t)}))}),r||this.getFieldInfo(e).instance?.triggerOnChangeListener(),a||this.validateField(e,"change")},this.deleteField=e=>{let t=[...Object.keys(this.fieldInfo).filter(t=>{let i=e.toString();return t!==i&&t.startsWith(i)}),e];this.baseStore.setState(e=>{let i={...e};return t.forEach(e=>{var t;let s;t=i.values,s=_(e),i.values=function e(t){if(!t)return;if(1===s.length){let e=s[0];if(Array.isArray(t)&&"number"==typeof e)return t.filter((t,i)=>i!==e);let{[e]:i,...r}=t;return r}let i=s.shift();if(("string"==typeof i||"number"==typeof i&&!Array.isArray(t))&&"object"==typeof t)return{...t,[i]:e(t[i])};if("number"==typeof i&&Array.isArray(t)){if(i>=t.length)return t;let s=t.slice(0,i);return[...s.length?s:Array(i),e(t[i]),...t.slice(i+1)]}throw Error("It seems we have created an infinite loop in deleteBy. ")}(t),delete this.fieldInfo[e],delete i.fieldMetaBase[e]}),i})},this.pushFieldValue=(e,t,i)=>{this.setFieldValue(e,e=>[...Array.isArray(e)?e:[],t],i)},this.insertFieldValue=async(e,t,i,s)=>{this.setFieldValue(e,e=>[...e.slice(0,t),i,...e.slice(t)],U(s,{dontValidate:!0}));let r=s?.dontValidate??!1;r||await this.validateField(e,"change"),ee(this).handleArrayInsert(e,t),r||await this.validateArrayFieldsStartingFrom(e,t,"change")},this.replaceFieldValue=async(e,t,i,s)=>{this.setFieldValue(e,e=>e.map((e,s)=>s===t?i:e),U(s,{dontValidate:!0})),s?.dontValidate||(await this.validateField(e,"change"),await this.validateArrayFieldsStartingFrom(e,t,"change"))},this.removeFieldValue=async(e,t,i)=>{let s=this.getFieldValue(e),r=Array.isArray(s)?Math.max(s.length-1,0):null;if(this.setFieldValue(e,e=>e.filter((e,i)=>i!==t),U(i,{dontValidate:!0})),ee(this).handleArrayRemove(e,t),null!==r){let t=`${e}[${r}]`;this.deleteField(t)}i?.dontValidate||(await this.validateField(e,"change"),await this.validateArrayFieldsStartingFrom(e,t,"change"))},this.swapFieldValues=(e,t,i,s)=>{this.setFieldValue(e,e=>{let s=e[t],r=e[i];return L(L(e,`${t}`,r),`${i}`,s)},U(s,{dontValidate:!0})),ee(this).handleArraySwap(e,t,i),s?.dontValidate||(this.validateField(e,"change"),this.validateField(`${e}[${t}]`,"change"),this.validateField(`${e}[${i}]`,"change"))},this.moveFieldValues=(e,t,i,s)=>{this.setFieldValue(e,e=>{let s=[...e];return s.splice(i,0,s.splice(t,1)[0]),s},U(s,{dontValidate:!0})),ee(this).handleArrayMove(e,t,i),s?.dontValidate||(this.validateField(e,"change"),this.validateField(`${e}[${t}]`,"change"),this.validateField(`${e}[${i}]`,"change"))},this.clearFieldValues=(e,t)=>{let i=this.getFieldValue(e),s=Array.isArray(i)?Math.max(i.length-1,0):null;if(this.setFieldValue(e,[],U(t,{dontValidate:!0})),null!==s)for(let t=0;t<=s;t++){let i=`${e}[${t}]`;this.deleteField(i)}t?.dontValidate||this.validateField(e,"change")},this.resetField=e=>{this.baseStore.setState(t=>({...t,fieldMetaBase:{...t.fieldMetaBase,[e]:Z},values:this.options.defaultValues?L(t.values,e,w(this.options.defaultValues,e)):t.values}))},this.setErrorMap=e=>{g(()=>{Object.entries(e).forEach(([e,t])=>
2{if($(t)){let{formError:i,fieldErrors:s}=es(t);for(let t of Object.keys(this.fieldInfo))this.getFieldMeta(t)&&this.setFieldMeta(t,i=>({...i,errorMap:{...i.errorMap,[e]:s?.[t]},errorSourceMap:{...i.errorSourceMap,[e]:"form"}}));this.baseStore.setState(t=>({...t,errorMap:{...t.errorMap,[e]:i}}))}else this.baseStore.setState(i=>({...i,errorMap:{...i.errorMap,[e]:t}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((e,[t,i])=>(Object.keys(i).length&&i.errors.length&&(e[t]={errors:i.errors,errorMap:i.errorMap}),e),{})}),this.parseValuesWithSchema=e=>X.validate({value:this.state.values,validationSource:"form"},e),this.parseValuesWithSchemaAsync=e=>X.validateAsync({value:this.state.values,validationSource:"form"},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??K(),this._devtoolsSubmissionOverride=!1;let s=et({...e?.defaultState,values:e?.defaultValues??e?.defaultState?.values});if(e?.transform)for(const t of Object.keys((s=e.transform({state:s}).state).errorMap)){const e=s.errorMap[t];if(void 0!==e&&$(e))for(const i of Object.keys(e.fields)){const r=e.fields[i];if(void 0===r)continue;const a=s.fieldMetaBase[i];s.fieldMetaBase[i]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,...a??{},errorSourceMap:{...a?.errorSourceMap??{},onChange:"form"},errorMap:{...a?.errorMap??{},[t]:r}}}}this.baseStore=E(s),this.fieldMetaDerived=E(e=>{let i=this.baseStore.get(),s=0,r={};for(let n of Object.keys(i.fieldMetaBase)){var a;let o=i.fieldMetaBase[n],l=t?.fieldMetaBase[n],u=e?.[n],d=w(i.values,n),h=u?.errors;if(!l||o.errorMap!==l.errorMap){h=Object.values(o.errorMap??{}).filter(e=>void 0!==e);let e=this.getFieldInfo(n)?.instance;e&&e.options.disableErrorFlat||(h=h.flat(1))}let c=!!(Array.isArray(a=h)&&0===a.length),f=!o.isDirty,v=W(d,w(this.options.defaultValues,n))||W(d,this.getFieldInfo(n)?.instance?.options.defaultValue);if(u&&u.isPristine===f&&u.isValid===c&&u.isDefaultValue===v&&u.errors===h&&o===l){r[n]=u,s++;continue}r[n]={...o,errors:h??[],isPristine:f,isValid:c,isDefaultValue:v}}return Object.keys(i.fieldMetaBase).length?e&&s===Object.keys(i.fieldMetaBase).length?e:(t=this.baseStore.get(),r):r}),this.store=E(e=>{let t=this.baseStore.get(),s=Object.values(this.fieldMetaDerived.get()).filter(Boolean),r=s.some(e=>e.isValidating),a=s.every(e=>e.isValid),n=s.some(e=>e.isTouched),o=s.some(e=>e.isBlurred),l=s.every(e=>e.isDefaultValue),u=n&&t.errorMap?.onMount,d=s.some(e=>e.isDirty),h=!d,c=!!(t.errorMap?.onMount||s.some(e=>e?.errorMap?.onMount)),f=e?.errors??[];i&&t.errorMap===i.errorMap||(f=Object.values(t.errorMap).reduce((e,t)=>(void 0===t||(t&&$(t)?e.push(t.form):e.push(t)),e),[]));let v=0===f.length,m=a&&v,p=this.options.canSubmitWhenInvalid??!1,g=0===t.submissionAttempts&&!n&&!c||!r&&!t.isSubmitting&&m||p,b=t.errorMap;if(u&&(f=f.filter(e=>e!==t.errorMap.onMount),b=Object.assign(b,{onMount:void 0})),e&&i&&e.errorMap===b&&e.fieldMeta===this.fieldMetaDerived.state&&e.errors===f&&e.isFieldsValidating===r&&e.isFieldsValid===a&&e.isFormValid===v&&e.isValid===m&&e.canSubmit===g&&e.isTouched===n&&e.isBlurred===o&&e.isPristine===h&&e.isDefaultValue===l&&e.isDirty===d&&W(i,t))return e;let M={...t,errorMap:b,fieldMeta:this.fieldMetaDerived.state,errors:f,isFieldsValidating:r,isFieldsValid:a,isFormValid:v,isValid:m,canSubmit:g,isTouched:n,isBlurred:o,isPristine:h,isDefaultValue:l,isDirty:d};return i=this.baseStore.get(),M}),this.handleSubmit=this.handleSubmit.bind(this),this.update(e||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(e){return Y(e.validate)?X[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}}function es(e){if(e)return $(e)?{formError:es(e.form).formError,fieldErrors:e.fields}:{formError:e};return{formError:void 0}}function er(e){switch(e){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";default:return"onChange"}}var ea=e.i(17772),en=e.i(383835);function eo(e,t){return e===t}function el(e,t,i=eo){let s=(0,ea.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:i}=e.subscribe(t);return i},[e]),r=(0,ea.useCallback)(()=>e?.get(),[e]);return(0,en.useSyncExternalStoreWithSelector)(s,r,r,t,i)}e.s(["useStore",0,el],724361);class eu{constructor(e){this.options={},this.mount=()=>{void 0===this.options.defaultValue||this.getMeta().isTouched||this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0}),this.getInfo().instance=this,this.update(this.options);let{onMount:e}=this.options.validators||{};if(e){let t=this.runValidator({validate:e,value:{value:this.state.value,fieldApi:this,validationSource:"field"},type:"validate"});t&&this.setMeta(e=>({...e,errorMap:{...e?.errorMap,onMount:t},errorSourceMap:{...e?.errorSourceMap,onMount:"field"}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);let e=this.form.fieldInfo[this.name];if(e&&e.instance===this){for(let[t,i]of Object.entries(e.validationMetaMap))i?.lastAbortController.abort(),e.validationMetaMap[t]=void 0;this.form.baseStore.setState(e=>({...e,fieldMetaBase:{...e.fieldMetaBase,[this.name]:{...Z,isTouched:e.fieldMetaBase[this.name]?.isTouched??Z.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??Z.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??Z.isDirty}}})),e.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,fieldApi:this}),this.form.options.listeners?.onFieldUnmount?.({formApi:this.form,fieldApi:this})}}},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&void 0!==this.options.defaultValue&&(W(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,t)=>
2{this.form.setFieldValue(this.name,e,U(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,t)=>{this.form.pushFieldValue(this.name,e,U(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,i)=>{this.form.insertFieldValue(this.name,e,t,U(i,{dontRunListeners:!0})),i?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,i)=>{this.form.replaceFieldValue(this.name,e,t,U(i,{dontRunListeners:!0})),i?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,U(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,i)=>{this.form.swapFieldValues(this.name,e,t,U(i,{dontRunListeners:!0})),i?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,i)=>{this.form.moveFieldValues(this.name,e,t,U(i,{dontRunListeners:!0})),i?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,U(e,{dontRunListeners:!0})),e?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=e=>{let t=Object.values(this.form.fieldInfo),i=[];for(let s of t){if(!s.instance)continue;let{onChangeListenTo:t,onBlurListenTo:r}=s.instance.options.validators||{};"change"===e&&t?.includes(this.name)&&i.push(s.instance),"blur"===e&&r?.includes(this.name)&&i.push(s.instance)}return i},this.validateSync=(e,t)=>{let i=P(e,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||J}),s=this.getLinkedFields(e).reduce((t,i)=>{let s=P(e,{...i.options,form:i.form,validationLogic:i.form.options.validationLogic||J});return s.forEach(e=>{e.field=i}),t.concat(s)},[]),r=!1;g(()=>{let e=(e,i)=>{let s=eh(i.cause),a=i.validate?ed(e.runValidator({validate:i.validate,value:{value:e.store.state.value,validationSource:"field",fieldApi:e},type:"validate"})):void 0,{newErrorValue:n,newSource:o}=q({formLevelError:t[s],fieldLevelError:a});e.state.meta.errorMap?.[s]!==n&&e.setMeta(e=>({...e,errorMap:{...e.errorMap,[s]:n},errorSourceMap:{...e.errorSourceMap,[s]:o}})),n&&(r=!0)};for(let t of i)e(this,t);for(let t of s)t.validate&&e(t.field,t)});let a=eh("submit");return this.state.meta.errorMap?.[a]&&"submit"!==e&&!r&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[a]:void 0},errorSourceMap:{...e.errorSourceMap,[a]:void 0}})),{hasErrored:r}},this.validateAsync=async(e,t)=>{let i=R(e,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||J}),s=await t,r=this.getLinkedFields(e),a=r.reduce((t,i)=>{let s=R(e,{...i.options,form:i.form,validationLogic:i.form.options.validationLogic||J});return s.forEach(e=>{e.field=i}),t.concat(s)},[]),n=[],o=[],l=i.some(e=>e.validate)||a.some(e=>e.validate);if(l)for(let e of(this.state.meta.isValidating||this.setMeta(e=>({...e,isValidating:!0})),r))e.setMeta(e=>({...e,isValidating:!0}));let u=(e,t,i)=>{let r=eh(t.cause),a=e.getInfo(),n=a.validationMetaMap[r];n?.lastAbortController.abort();let o=new AbortController;a.validationMetaMap[r]={lastAbortController:o},i.push(new Promise(async i=>{let a;try{a=await new Promise((i,s)=>{e.timeoutIds.validations[t.cause]&&clearTimeout(e.timeoutIds.validations[t.cause]),e.timeoutIds.validations[t.cause]=setTimeout(async()=>{if(o.signal.aborted)return i(void 0);try{i(await this.runValidator({validate:t.validate,value:{value:e.store.state.value,fieldApi:e,signal:o.signal,validationSource:"field"},type:"validateAsync"}))}catch(e){s(e)}},t.debounceMs)})}catch(e){a=e}if(o.signal.aborted)return i(void 0);let n=ed(a),{newErrorValue:l,newSource:u}=q({formLevelError:s[e.name]?.[r],fieldLevelError:n});if(e.getInfo().instance!==e)return i(void 0);e.setMeta(e=>({...e,errorMap:{...e?.errorMap,[r]:l},errorSourceMap:{...e.errorSourceMap,[r]:u}})),i(l)}))};for(let e of i)e.validate&&u(this,e,n);for(let e of a)e.validate&&u(e.field,e,o);let d=[];if((n.length||o.length)&&(d=await Promise.all(n),await Promise.all(o)),l)for(let e of(this.setMeta(e=>({...e,isValidating:!1})),r))e.setMeta(e=>({...e,isValidating:!1}));
2return d.filter(Boolean)},this.validate=(e,t)=>{if(!this.state.meta.isTouched)return[];let{fieldsErrorMap:i}=t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e),{hasErrored:s}=this.validateSync(e,i[this.name]??{});if(s&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[eh(e)]?.lastAbortController.abort(),this.state.meta.errors;let r=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e);return this.validateAsync(e,r)},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(e=>({...e,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(e=>({...e,isBlurred:!0})),this.validate("blur"),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(t=>({...t,errorMap:{...t.errorMap,...e}}))},this.parseValueWithSchema=e=>X.validate({value:this.state.value,validationSource:"field"},e),this.parseValueWithSchemaAsync=e=>X.validateAsync({value:this.state.value,validationSource:"field"},e),this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},this.form=e.form,this.name=e.name,this.options=e,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=E(t=>{this.form.store.get();let i=this.form.getFieldMeta(this.name)??{...Z,...e.defaultMeta},s=this.form.getFieldValue(this.name);return(i.isTouched||void 0!==s||void 0===this.options.defaultValue||W(s,this.options.defaultValue)||(s=this.options.defaultValue),t&&t.value===s&&t.meta===i)?t:{value:s,meta:i}})}get state(){return this.store.state}runValidator(e){return Y(e.validate)?X[e.type](e.value,e.validate):e.validate(e.value)}triggerOnBlurListener(){let e=this.form.options.listeners?.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onBlurDebounceMs;t&&t>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})}}function ed(e){if(e)return e}function eh(e){switch(e){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";default:return"onChange"}}let ec="u">typeof window?ea.useLayoutEffect:ea.useEffect,ef=({children:e,...t})=>{let i=function(e){let[t,i]=(0,ea.useState)(()=>({form:e.form,name:e.name})),[s,r]=(0,ea.useState)(()=>new eu({...e}));(t.form!==e.form||t.name!==e.name)&&(r(new eu({...e})),i({form:e.form,name:e.name}));let a=el(s.store,"array"===e.mode?e=>Object.keys(e.value??[]).length:e=>e.value),n=el(s.store,e=>e.meta.isTouched),o=el(s.store,e=>e.meta.isBlurred),l=el(s.store,e=>e.meta.isDirty),u=el(s.store,e=>e.meta.errorMap),d=el(s.store,e=>e.meta.errorSourceMap),h=el(s.store,e=>e.meta.isValidating),c=(0,ea.useMemo)(()=>{let t={...s,get state(){return{value:"array"===e.mode?s.state.value:a,get meta(){return{...s.state.meta,isTouched:n,isBlurred:o,isDirty:l,errorMap:u,errorSourceMap:d,isValidating:h}}}}};return t.Field=ef,t},[s,e.mode,a,n,o,l,u,d,h]);return ec(s.mount,[s]),ec(()=>{s.update(e)}),c}(t),s=(0,ea.useMemo)(()=>T(e,i),[e,i]);return(0,r.jsx)(r.Fragment,{children:s})},ev="17"===ea.version.split(".")[0]?function(){return(0,ea.useState)(()=>K())[0]}:ea.useId;function em({form:e,selector:t=e=>e,children:i}){let s=el(e.store,t);return(0,r.jsx)(r.Fragment,{children:T(i,s)})}e.s(["useForm",0,function(e){let t=ev(),[i,s]=(0,ea.useState)(e?.formId),[a,n]=(0,ea.useState)(()=>new ei({...e,formId:e?.formId??t}));if(i!==e?.formId){let i=e?.formId??t;n(new ei({...e,formId:i})),s(i)}let o=(0,ea.useMemo)(()=>{let e={...a,handleSubmit:(...e)=>a._handleSubmit(...e),get formId(){return a._formId},get state(){return a.store.state}};return e.Field=function(e){return(0,r.jsx)(ef,{...e,form:a})},e.Subscribe=function(e){return(0,r.jsx)(em,{form:a,selector:e.selector,children:e.children})},e},[a]);ec(a.mount,[]),ec(()=>{a.update(e)});let l=(0,ea.useRef)(!1);return ec(()=>{!l.current||e?.transform&&function(e,t){if(!t)return;let i=Object.assign({},e,{state:function e(t){if(null===t||"object"!=typeof t)return t;if(t instanceof Date)return new Date(t.getTime());if(Array.isArray(t)){let i=[];for(let s=0;s<t.length;s++)i[s]=e(t[s]);return i}if(t instanceof Map){let i=new Map;return t.forEach((t,s)=>{i.set(s,e(t))}),i}if(t instanceof Set){let i=new Set;return t.forEach(t=>{i.add(e(t))}),i}let i={};for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=e(t[s]));return i}(e.state)});t(i),i.fieldInfo!==e.fieldInfo&&(e.fieldInfo=i.fieldInfo),i.options!==e.options&&(e.options=i.options);let s=["values","validationMetaMap","fieldMetaBase","isSubmitting","isSubmitted","isValidating","submissionAttempts","isSubmitSuccessful","_force_re_eval"].reduce((t,s)=>(e.state[s]!==i.state[s]&&(t[s]=i.state[s]),t),{});g(()=>{Object.keys(s).length&&e.baseStore.setState(e=>({...e,...s})),i.state.errorMap!==e.state.errorMap&&e.setErrorMap(i.state.errorMap)})}(a,e.transform)},[a,e?.transform]),ec(()=>{l.current=!0}),o}],943594)}]); 3 4//# debugId=ef6b934b-dbf3-7b1f-17e6-275059fc1861
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.