(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,14516,e=>{"use strict";class t{#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=>this.emitEventToBus(e)),this.#r=[],this.stopConnectLoop(),this.#i().removeEventListener("tanstack-connect-success",this.#f)};#v=()=>{if(this.#l{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(){for(var e=arguments.length,t=Array(e),i=0;itypeof 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)}}e.s(["EventClient",()=>t])},194594,e=>{"use strict";var t=e.i(14516);class i extends t.EventClient{constructor(){super({pluginId:"form-devtools",reconnectEveryMs:1e3})}}let s=new i;e.s(["formEventClient",()=>s])},622111,e=>{"use strict";var t=e.i(942347),i=e.i(596482);function s(e,t){return e===t}function r(e,r){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s,n=(0,t.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:i}=e.subscribe(t);return i},[e]),o=(0,t.useCallback)(()=>e?.get(),[e]);return(0,i.useSyncExternalStoreWithSelector)(n,o,o,r,a)}e.s(["useStore",()=>r])},306101,e=>{"use strict";var t=e.i(162115),i=e.i(869931),s=e.i(942347);e.i(816688);var r=e.i(675066),a=e.i(391185),n=e.i(935139);e.s(["default",0,e=>{let{options:o,containerProps:l,triggerProps:u,popupProps:d,placeholder:h,disabled:c,triggerPopupSameWidth:f,multiple:v,value:m,onChange:p}=e,{t:g}=(0,r.useTranslation)(),{open:b,onOpenChange:y,placement:M,offset:S}=l||{},{className:V}=u||{},{wrapperClassName:E,className:A,itemClassName:F,title:T,titleClassName:w}=d||{},[I,L]=(0,s.useState)(!1),C=b??I,x=(0,s.useCallback)(e=>{y?.(e),L(e)},[y]),k=(0,s.useMemo)(()=>{let e=h||g("placeholder.select",{ns:"common"});return v?m?.length?g("dynamicSelect.selected",{ns:"common",count:m.length}):e:o.find(e=>e.value===m)?.label||e},[v,m,o,h]);return(0,t.jsxs)(a.PortalToFollowElem,{placement:M||"bottom-start",offset:S||4,open:C,onOpenChange:x,triggerPopupSameWidth:f,children:[(0,t.jsx)(a.PortalToFollowElemTrigger,{onClick:()=>!c&&x(!C),asChild:!0,children:(0,t.jsxs)("div",{className:(0,n.cn)("system-sm-regular group flex h-8 items-center rounded-lg bg-components-input-bg-normal px-2 text-components-input-text-filled",!c&&"cursor-pointer hover:bg-state-base-hover-alt",c&&"cursor-not-allowed opacity-50",C&&!c&&"bg-state-base-hover-alt",V),children:[(0,t.jsx)("div",{className:"grow",title:k,children:k}),(0,t.jsx)(i.RiArrowDownSLine,{className:(0,n.cn)("h-4 w-4 shrink-0 text-text-quaternary group-hover:text-text-secondary",C&&"text-text-secondary")})]})}),(0,t.jsx)(a.PortalToFollowElemContent,{className:(0,n.cn)("z-[9999]",E),children:(0,t.jsxs)("div",{className:(0,n.cn)("max-h-80 overflow-auto rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-1 shadow-lg",A),children:[T&&(0,t.jsx)("div",{className:(0,n.cn)("system-xs-medium-uppercase flex h-[22px] items-center px-3 text-text-tertiary",w),children:T}),o.map(e=>(0,t.jsxs)("div",{className:(0,n.cn)("system-sm-medium flex h-8 cursor-pointer items-center rounded-lg px-2 text-text-secondary hover:bg-state-base-hover",F),title:e.label,onClick:()=>{if(!c){if(v){let t=m??[],i=t.includes(e.value)?t.filter(t=>t!==e.value):[...t,e.value];p?.(i);return}p?.(e.value),x(!1)}},children:[(0,t.jsx)("div",{className:"mr-1 grow truncate px-1",children:e.label}),(v?(m??[]).includes(e.value):m===e.value)&&(0,t.jsx)(i.RiCheckLine,{className:"h-4 w-4 shrink-0 text-text-accent"})]},e.value))]})})]})}])},830748,276827,69386,243931,795229,376368,368887,65762,e=>{"use strict";let t,i;var s,r=((s=r||{})[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 a(e){let{update:t,notify:i,unwatched:s}=e;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){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.sub,i=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:i.subsTail=o,void 0!==o?o.nextSub=n:void 0===(i.subs=n)&&s(i),a},propagate:function(e){let t,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&&i(r),1&a){let i=r.subs;if(void 0!==i){let r=(e=i).nextSub;void 0!==r&&(t={value:s,prev:t},s=r);continue}}if(void 0!==(e=s)){s=e.nextSub;continue}for(;void 0!==t;)if(e=t.value,t=t.prev,void 0!==e){s=e.nextSub;continue e}break}},checkDirty:function(e,i){let s,a=0,n=!1;e:for(;;){let o=e.dep,l=o.flags;if(16&i.flags)n=!0;else if((17&l)==17){if(t(o)){let e=o.subs;void 0!==e.nextSub&&r(e),n=!0}}else if((33&l)==33){(void 0!==e.nextSub||void 0!==e.prevSub)&&(s={value:e,prev:s}),e=o.deps,i=o,++a;continue}if(!n){let t=e.nextDep;if(void 0!==t){e=t;continue}}for(;a--;){let a=i.subs,o=void 0!==a.nextSub;if(o?(e=s.value,s=s.prev):e=a,n){if(t(i)){o&&r(a),i=e.sub;continue}n=!1}else i.flags&=-33;i=e.sub;let l=e.nextDep;if(void 0!==l){e=l;continue e}}return n}},shallowPropagate:r};function r(e){do{let t=e.sub,s=t.flags;(48&s)==32&&(t.flags=16|s,(6&s)==2&&i(t))}while(void 0!==(e=e.nextSub))}}let n=0,o=0,l=0,u=[],{link:d,unlink:h,propagate:c,checkDirty:f,shallowPropagate:v}=a({update:e=>{var t;return void 0!==e.depsTail?function(e){e.depsTail=void 0,e.flags=5;try{let t=e.value;return t!==(e.value=e.getter(t))}finally{e.flags&=-5,p(e)}}(e):((t=e).flags=1,t.currentValue!==(t.currentValue=t.pendingValue))},notify(e){let t=l,i=t;for(;u[t++]=e,e.flags&=-3,void 0!==(e=e.subs?.sub)&&2&e.flags;);for(l=t;i<--t;){let e=u[i];u[i++]=u[t],u[t]=e}},unwatched(e){1&e.flags?void 0!==e.depsTail&&(e.depsTail=void 0,e.flags=17,p(e)):m.call(e)}});function m(){this.depsTail=void 0,this.flags=0,p(this);let e=this.subs;void 0!==e&&h(e)}function p(e){let t=e.depsTail,i=void 0!==t?t.nextDep:e.deps;for(;void 0!==i;)i=h(i,e)}function g(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 b=[],y=0,{link:M,unlink:S,propagate:V,checkDirty:E,shallowPropagate:A}=a({update:e=>e._update(),notify(e){b[T++]=e,e.flags&=~r.Watching},unwatched(e){void 0!==e.depsTail&&(e.depsTail=void 0,e.flags=r.Mutable|r.Dirty,w(e))}}),F=0,T=0;function w(e){let t=e.depsTail,i=void 0!==t?t.nextDep:e.deps;for(;void 0!==i;)i=S(i,e)}function I(){if(!(n>0)){for(;F(void 0!==t&&M(a,t,y),a._snapshot),subscribe(e){var i;let s,n,o=g(e),l={current:!1},u=(i=()=>{a.get(),l.current?o.next?.(a._snapshot):l.current=!0},s=()=>{let e=t;t=n,++y,n.depsTail=void 0,n.flags=r.Watching|r.RecursedCheck;try{return i()}finally{t=e,n.flags&=~r.RecursedCheck,w(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:r.Watching|r.RecursedCheck,notify(){let e=this.flags;e&r.Dirty||e&r.Pending&&E(this.deps,this)?s():this.flags=r.Watching},stop(){this.flags=r.None,this.depsTail=void 0,w(this)}},s(),n);return{unsubscribe:()=>{u.stop()}}},_update(n){let o=t,l=i?.compare??Object.is;if(s)t=a,++y,a.depsTail=void 0;else if(void 0===n)return!1;s&&(a.flags=r.Mutable|r.RecursedCheck);try{let t=a._snapshot,i="function"==typeof n?n(t):void 0===n&&s?e(t):n;if(void 0===t||!l(t,i))return a._snapshot=i,!0;return!1}finally{t=o,s&&(a.flags&=~r.RecursedCheck),w(a)}}};return s?(a.flags=r.Mutable|r.Dirty,a.get=function(){let e=a.flags;if(e&r.Dirty||e&r.Pending&&E(a.deps,a)){if(a._update()){let e=a.subs;void 0!==e&&A(e)}}else e&r.Pending&&(a.flags=e&~r.Pending);return void 0!==t&&M(a,t,y),a._snapshot}):a.set=function(e){if(a._update(e)){let e=a.subs;void 0!==e&&(V(e),A(e),I())}},a}function C(e){try{++n,e()}finally{--n||function(){try{for(;oC],276827);class x{constructor(e){this.atom=L(e)}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(g(e))}}class k{constructor(e){this.atom=L(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(g(e))}}function O(e){return"function"==typeof e?new k(e):new x(e)}e.s(["createStore",()=>O],69386);var j=class{constructor(e,t){var i=this;this.fn=e,this.options=t,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=function(){for(var e=arguments.length,t=Array(e),s=0;s=i.options.wait)i.execute(...t);else if(i.lastArgs=t,!i.timeoutId&&i.options.trailing){let e=i.options.wait-r;i.isPending=!0,i.timeoutId=setTimeout(()=>{void 0!==i.lastArgs&&i.execute(...i.lastArgs)},e)}},this.execute=function(){for(var e=arguments.length,t=Array(e),s=0;s{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)}},B=e.i(194594);function D(e,t){return"function"==typeof e?e(t):e}function _(e,t){return K(t).reduce((e,t)=>null===e?null:void 0!==e?e[t]:void 0,e)}function P(e,t,i){let s=K(t);return function e(t){if(!s.length)return D(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)}function R(e,t){let i=K(t);return function e(t){if(!t)return;if(1===i.length){let e=i[0];if(Array.isArray(t)&&"number"==typeof e)return t.filter((t,i)=>i!==e);let{[e]:s,...r}=t;return r}let s=i.shift();if(("string"==typeof s||"number"==typeof s&&!Array.isArray(t))&&"object"==typeof t)return{...t,[s]:e(t[s])};if("number"==typeof s&&Array.isArray(t)){if(s>=t.length)return t;let i=t.slice(0,s);return[...i.length?i:Array(s),e(t[s]),...t.slice(s+1)]}throw Error("It seems we have created an infinite loop in deleteBy. ")}(e)}let $=/^(\d+)$/gm,N=/\.(\d+)(?=\.)/gm,W=/^(\d+)\./gm,U=/\.(\d+$)/gm,q=/\.{2,}/gm,z="__int__",G=`${z}$1`;function K(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($,G).replace(N,`.${G}.`).replace(W,`${G}.`).replace(U,`.${G}`).replace(q,".").split(".").map(e=>{if(e.startsWith(z)){let t=e.substring(z.length),i=parseInt(t,10);return String(i)===t?i:t}return e})}function H(e,t){return 0===e.length?t:0===t.length?e:t.startsWith("[")||t.startsWith(".")?e+t:`${e}.${t}`}function J(e){return!(Array.isArray(e)&&0===e.length)}function Q(e,t){return t.validationLogic({form:t.form,validators:t.validators,event:{type:e,async:!1},runValidation:e=>e.validators.filter(Boolean).map(e=>({cause:e.cause,validate:e.fn}))})}function X(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 Y=e=>!!e&&"object"==typeof e&&"fields"in e;function Z(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)||!Z(e[r],t[r]))return!1;return!0}let ee=e=>{let{newFormValidatorError:t,isPreviousErrorFromFormValidator:i,previousErrorValue:s}=e;return t?{newErrorValue:t,newSource:"form"}:i?{newErrorValue:void 0,newSource:void 0}:s?{newErrorValue:s,newSource:"field"}:{newErrorValue:void 0,newSource:void 0}},et=e=>{let{formLevelError:t,fieldLevelError:i}=e;return i?{newErrorValue:i,newSource:"field"}:t?{newErrorValue:t,newSource:"form"}:{newErrorValue:void 0,newSource:void 0}};function ei(e,t){return null==e?t:{...e,...t}}let es=256,er=[];for(;es--;)er[es]=(es+256).toString(16).substring(1);function ea(){let e,t=0,s="";if(!i||es+16>256){for(i=Array(256),t=256;t--;)i[t]=256*Math.random()|0;t=0,es=0}for(;t<16;t++)e=i[es+t],6===t?s+=er[15&e|64]:8===t?s+=er[63&e|128]:s+=er[e],1&t&&t>1&&t<11&&(s+="-");return es++,s}let en=new j(e=>B.formEventClient.emit("form-state",{id:e.formId,state:e.store.state}),{wait:300}).maybeExecute;function eo(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let t=[];for(let i=0;i{t.set(i,eo(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(eo(e))}),t}let t={};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=eo(e[i]));return t}e.s(["concatenatePaths",()=>H,"deepCopy",()=>eo,"deleteBy",()=>R,"determineFieldLevelErrorSourceAndValue",()=>et,"determineFormLevelErrorSourceAndValue",()=>ee,"evaluate",()=>Z,"functionalUpdate",()=>D,"getAsyncValidatorArray",()=>X,"getBy",()=>_,"getSyncValidatorArray",()=>Q,"isGlobalFormValidationError",()=>Y,"isNonEmptyArray",()=>J,"makePathArray",()=>K,"mergeOpts",()=>ei,"setBy",()=>P,"throttleFormState",()=>en,"uuid",()=>ea],243931);let el=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}`)}};e.s(["defaultValidationLogic",()=>el],795229);let eu=(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;t0?".":"")+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}},ed={validate(e,t){let{value:i,validationSource:s}=e,r=t["~standard"].validate(i);if(r instanceof Promise)throw Error("async function passed to sync validator");if(r.issues)return"field"===s?r.issues:eu(r.issues,i)},async validateAsync(e,t){let{value:i,validationSource:s}=e,r=await t["~standard"].validate(i);if(r.issues)return"field"===s?r.issues:eu(r.issues,i)}},eh=e=>!!e&&"~standard"in e;e.s(["isStandardSchemaValidator",()=>eh,"standardSchemaValidators",()=>ed],376368);let ec={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{}};function ef(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;en.some(t=>e.startsWith(t)))}function 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=()=>ec;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,ae.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 ev(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}}}e.s(["defaultFieldMeta",()=>ec,"metaHelper",()=>ef],368887);class em{constructor(e){let t,i;this.options={},this.fieldInfo={},this.mount=()=>{let e=this.store.subscribe(()=>{en(this)}),t=B.formEventClient.on("request-form-state",e=>{e.payload.id===this._formId&&B.formEventClient.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}),i=B.formEventClient.on("request-form-reset",e=>{e.payload.id===this._formId&&this.reset()}),s=B.formEventClient.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(),B.formEventClient.emit("form-unmounted",{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return B.formEventClient.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&&!Z(e.defaultValues,t.defaultValues)&&!this.state.isTouched,s=!Z(e.defaultState,t.defaultState)&&!this.state.isTouched;(i||s)&&(C(()=>{this.baseStore.setState(()=>ev(Object.assign({},this.state,s?e.defaultState:{},i?{values:e.defaultValues}:{})))}),B.formEventClient.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(()=>ev({...this.options.defaultState,values:e??this.options.defaultValues??this.options.defaultState?.values,fieldMetaBase:s}))},this.validateAllFields=async e=>{let t=[];return C(()=>{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 C(()=>{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=Q(e,{...this.options,form:this,validationLogic:this.options.validationLogic||el}),i=!1,s={};return C(()=>{for(let e of t){if(!e.validate)continue;let{formError:t,fieldErrors:r}=ep(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:"form"},type:"validate"})),a=eg(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)??ec,n=r?.[e],{newErrorValue:o,newSource:l}=ee({newFormValidatorError:n,isPreviousErrorFromFormValidator:i?.[a]==="form",previousErrorValue:t?.[a]});"form"===l&&(s[e]={...s[e],[a]:n}),t?.[a]!==o&&this.setFieldMeta(e,function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ec;return{...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=eg("submit");this.state.errorMap?.[r]&&"submit"!==e&&!i&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[r]:void 0}}));let a=eg("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=X(e,{...this.options,form:this,validationLogic:this.options.validationLogic||el});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let s=[];for(let e of i){if(!e.validate)continue;let i=eg(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}=ep(s);n&&(t=t?{...t,...n}:n);let o=eg(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}=ee({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})),C(()=>{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}),B.formEventClient.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}),B.formEventClient.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validate",errors:this.state.errors});return}C(()=>{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}),C(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),B.formEventClient.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),i()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),B.formEventClient.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"inflight",onError:e}),i(),e}},this.getFieldValue=e=>_(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]:D(t,i.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>(e[t]=ec,e),{}),this.setFieldValue=(e,t,i)=>{let s=i?.dontUpdateMeta??!1,r=i?.dontRunListeners??!1,a=i?.dontValidate??!1;C(()=>{s||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(i=>({...i,values:P(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=>{i.values=R(i.values,e),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)],ei(s,{dontValidate:!0}));let r=s?.dontValidate??!1;r||await this.validateField(e,"change"),ef(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),ei(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),ei(i,{dontValidate:!0})),ef(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 P(P(e,`${t}`,r),`${i}`,s)},ei(s,{dontValidate:!0})),ef(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},ei(s,{dontValidate:!0})),ef(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,[],ei(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]:ec},values:this.options.defaultValues?P(t.values,e,_(this.options.defaultValues,e)):t.values}))},this.setErrorMap=e=>{C(()=>{Object.entries(e).forEach(e=>{let[t,i]=e;if(Y(i)){let{formError:e,fieldErrors:s}=ep(i);for(let e of Object.keys(this.fieldInfo))this.getFieldMeta(e)&&this.setFieldMeta(e,i=>({...i,errorMap:{...i.errorMap,[t]:s?.[e]},errorSourceMap:{...i.errorSourceMap,[t]:"form"}}));this.baseStore.setState(i=>({...i,errorMap:{...i.errorMap,[t]:e}}))}else this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[t]:i}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((e,t)=>{let[i,s]=t;return Object.keys(s).length&&s.errors.length&&(e[i]={errors:s.errors,errorMap:s.errorMap}),e},{})}),this.parseValuesWithSchema=e=>ed.validate({value:this.state.values,validationSource:"form"},e),this.parseValuesWithSchemaAsync=e=>ed.validateAsync({value:this.state.values,validationSource:"form"},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??ea(),this._devtoolsSubmissionOverride=!1;let s=ev({...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&&Y(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=O(s),this.fieldMetaDerived=O(e=>{let i=this.baseStore.get(),s=0,r={};for(let a of Object.keys(i.fieldMetaBase)){let n=i.fieldMetaBase[a],o=t?.fieldMetaBase[a],l=e?.[a],u=_(i.values,a),d=l?.errors;if(!o||n.errorMap!==o.errorMap){d=Object.values(n.errorMap??{}).filter(e=>void 0!==e);let e=this.getFieldInfo(a)?.instance;e&&e.options.disableErrorFlat||(d=d.flat(1))}let h=!J(d),c=!n.isDirty,f=Z(u,_(this.options.defaultValues,a))||Z(u,this.getFieldInfo(a)?.instance?.options.defaultValue);if(l&&l.isPristine===c&&l.isValid===h&&l.isDefaultValue===f&&l.errors===d&&n===o){r[a]=l,s++;continue}r[a]={...n,errors:d??[],isPristine:c,isValid:h,isDefaultValue:f}}return Object.keys(i.fieldMetaBase).length?e&&s===Object.keys(i.fieldMetaBase).length?e:(t=this.baseStore.get(),r):r}),this.store=O(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&&Y(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&&Z(i,t))return e;let y={...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(),y}),this.handleSubmit=this.handleSubmit.bind(this),this.update(e||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(e){return eh(e.validate)?ed[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}}function ep(e){if(e)return Y(e)?{formError:ep(e.form).formError,fieldErrors:e.fields}:{formError:e};return{formError:void 0}}function eg(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"}}function eb(e,t){if(!t)return;let i=Object.assign({},e,{state:eo(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),{});return C(()=>{Object.keys(s).length&&e.baseStore.setState(e=>({...e,...s})),i.state.errorMap!==e.state.errorMap&&e.setErrorMap(i.state.errorMap)}),i}e.s(["FormApi",()=>em],830748),e.s(["mergeAndUpdate",()=>eb],65762)},301293,15814,e=>{"use strict";var t=e.i(162115),i=e.i(830748),s=e.i(65762),r=e.i(243931),a=e.i(622111),n=e.i(942347),o=e.i(276827),l=e.i(69386),u=e.i(376368),d=e.i(368887),h=e.i(795229);class c{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}),()=>{}},this.update=e=>{if(this.options=e,this.name=e.name,!this.state.meta.isTouched&&void 0!==this.options.defaultValue){let t=this.form.getFieldValue(this.name);(0,r.evaluate)(t,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)=>{this.form.setFieldValue(this.name,e,(0,r.mergeOpts)(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,(0,r.mergeOpts)(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,i)=>{this.form.insertFieldValue(this.name,e,t,(0,r.mergeOpts)(i,{dontRunListeners:!0})),i?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,i)=>{this.form.replaceFieldValue(this.name,e,t,(0,r.mergeOpts)(i,{dontRunListeners:!0})),i?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,(0,r.mergeOpts)(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,i)=>{this.form.swapFieldValues(this.name,e,t,(0,r.mergeOpts)(i,{dontRunListeners:!0})),i?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,i)=>{this.form.moveFieldValues(this.name,e,t,(0,r.mergeOpts)(i,{dontRunListeners:!0})),i?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,(0,r.mergeOpts)(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=(0,r.getSyncValidatorArray)(e,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||h.defaultValidationLogic}),s=this.getLinkedFields(e).reduce((t,i)=>{let s=(0,r.getSyncValidatorArray)(e,{...i.options,form:i.form,validationLogic:i.form.options.validationLogic||h.defaultValidationLogic});return s.forEach(e=>{e.field=i}),t.concat(s)},[]),a=!1;(0,o.batch)(()=>{let e=(e,i)=>{let s=v(i.cause),n=i.validate?f(e.runValidator({validate:i.validate,value:{value:e.store.state.value,validationSource:"field",fieldApi:e},type:"validate"})):void 0,o=t[s],{newErrorValue:l,newSource:u}=(0,r.determineFieldLevelErrorSourceAndValue)({formLevelError:o,fieldLevelError:n});e.state.meta.errorMap?.[s]!==l&&e.setMeta(e=>({...e,errorMap:{...e.errorMap,[s]:l},errorSourceMap:{...e.errorSourceMap,[s]:u}})),l&&(a=!0)};for(let t of i)e(this,t);for(let t of s)t.validate&&e(t.field,t)});let n=v("submit");return this.state.meta.errorMap?.[n]&&"submit"!==e&&!a&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[n]:void 0},errorSourceMap:{...e.errorSourceMap,[n]:void 0}})),{hasErrored:a}},this.validateAsync=async(e,t)=>{let i=(0,r.getAsyncValidatorArray)(e,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||h.defaultValidationLogic}),s=await t,a=this.getLinkedFields(e),n=a.reduce((t,i)=>{let s=(0,r.getAsyncValidatorArray)(e,{...i.options,form:i.form,validationLogic:i.form.options.validationLogic||h.defaultValidationLogic});return s.forEach(e=>{e.field=i}),t.concat(s)},[]),o=[],l=[],u=i.some(e=>e.validate)||n.some(e=>e.validate);if(u)for(let e of(this.state.meta.isValidating||this.setMeta(e=>({...e,isValidating:!0})),a))e.setMeta(e=>({...e,isValidating:!0}));let d=(e,t,i)=>{let a=v(t.cause),n=e.getInfo().validationMetaMap[a];n?.lastAbortController.abort();let o=new AbortController;this.getInfo().validationMetaMap[a]={lastAbortController:o},i.push(new Promise(async i=>{let n;try{n=await new Promise((i,s)=>{this.timeoutIds.validations[t.cause]&&clearTimeout(this.timeoutIds.validations[t.cause]),this.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){n=e}if(o.signal.aborted)return i(void 0);let l=f(n),u=s[this.name]?.[a],{newErrorValue:d,newSource:h}=(0,r.determineFieldLevelErrorSourceAndValue)({formLevelError:u,fieldLevelError:l});e.setMeta(e=>({...e,errorMap:{...e?.errorMap,[a]:d},errorSourceMap:{...e.errorSourceMap,[a]:h}})),i(d)}))};for(let e of i)e.validate&&d(this,e,o);for(let e of n)e.validate&&d(e.field,e,l);let c=[];if((o.length||l.length)&&(c=await Promise.all(o),await Promise.all(l)),u)for(let e of(this.setMeta(e=>({...e,isValidating:!1})),a))e.setMeta(e=>({...e,isValidating:!1}));return c.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[v(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=>u.standardSchemaValidators.validate({value:this.state.value,validationSource:"field"},e),this.parseValueWithSchemaAsync=e=>u.standardSchemaValidators.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=(0,l.createStore)(t=>{this.form.store.get();let i=this.form.getFieldMeta(this.name)??{...d.defaultFieldMeta,...e.defaultMeta},s=this.form.getFieldValue(this.name);return(i.isTouched||void 0!==s||void 0===this.options.defaultValue||(0,r.evaluate)(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(0,u.isStandardSchemaValidator)(e.validate)?u.standardSchemaValidators[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 f(e){if(e)return e}function v(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 m="u">typeof window?n.useLayoutEffect:n.useEffect;e.s(["useIsomorphicLayoutEffect",()=>m],15814);let p=e=>{let{children:i,...s}=e,o=function(e){let[t,i]=(0,n.useState)(()=>({form:e.form,name:e.name})),[s,r]=(0,n.useState)(()=>new c({...e}));(t.form!==e.form||t.name!==e.name)&&(r(new c({...e})),i({form:e.form,name:e.name}));let o=(0,a.useStore)(s.store,"array"===e.mode?e=>Object.keys(e.value??[]).length:e=>e.value),l=(0,a.useStore)(s.store,e=>e.meta.isTouched),u=(0,a.useStore)(s.store,e=>e.meta.isBlurred),d=(0,a.useStore)(s.store,e=>e.meta.isDirty),h=(0,a.useStore)(s.store,e=>e.meta.errorMap),f=(0,a.useStore)(s.store,e=>e.meta.errorSourceMap),v=(0,a.useStore)(s.store,e=>e.meta.isValidating),g=(0,n.useMemo)(()=>{let t={...s,get state(){return{value:"array"===e.mode?s.state.value:o,get meta(){return{...s.state.meta,isTouched:l,isBlurred:u,isDirty:d,errorMap:h,errorSourceMap:f,isValidating:v}}}}};return t.Field=p,t},[s,e.mode,o,l,u,d,h,f,v]);return m(s.mount,[s]),m(()=>{s.update(e)}),g}(s),l=(0,n.useMemo)(()=>(0,r.functionalUpdate)(i,o),[i,o]);return(0,t.jsx)(t.Fragment,{children:l})},g="17"===n.version.split(".")[0]?function(){return(0,n.useState)(()=>(0,r.uuid)())[0]}:n.useId;function b(e){let{form:i,selector:s=e=>e,children:n}=e,o=(0,a.useStore)(i.store,s);return(0,t.jsx)(t.Fragment,{children:(0,r.functionalUpdate)(n,o)})}function y(e){let r=g(),[a,o]=(0,n.useState)(e?.formId),[l,u]=(0,n.useState)(()=>new i.FormApi({...e,formId:e?.formId??r}));if(a!==e?.formId){let t=e?.formId??r;u(new i.FormApi({...e,formId:t})),o(t)}let d=(0,n.useMemo)(()=>{let e={...l,handleSubmit:function(){for(var e=arguments.length,t=Array(e),i=0;i{l.update(e)});let h=(0,n.useRef)(!1);return m(()=>{!h.current||e?.transform&&(0,s.mergeAndUpdate)(l,e.transform)},[l,e?.transform]),m(()=>{h.current=!0}),d}e.s(["useForm",()=>y],301293)}]);