okengine 0.17.0 → 0.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/flows-page-XDpAJO8f.js","assets/rolldown-runtime-hePW80VL.js","assets/shortcut-keys-DKxNTe_m.js","assets/react-dom-Bph1y7z7.js","assets/xyflow-D7n4g6go.js","assets/xyflow-DZ0Ws1xk.css","assets/react-D8E3mtu1.js","assets/duration-tone-sC3lGABz.js","assets/trace-detail-sheet-B09O8rA6.js","assets/element-icons-BVXtRyd3.js","assets/http-method-_UHM2ODJ.js","assets/highlighted-json-Awq7gYdu.js","assets/preload-helper-oH4irX4C.js","assets/request-meta-DV0ywz7t.js","assets/collapsible-DGnOM2ph.js","assets/useRender-BE2A9BWC.js","assets/cache-glyph-B5X-NM0-.js","assets/dagre.esm-ZwcdTuZZ.js","assets/agent-disclosure-BP0Y0Sux.js","assets/units-page-Ca2Z-E52.js","assets/link-BX6Vqztd.js","assets/dropdown-menu-_NjTEo5_.js","assets/tree-expand-toggle-BtyhmWb4.js","assets/useMutation-B8EO02Ej.js","assets/call-pii-button-ChAUiLo9.js","assets/explorer-empty-2uIhBu0_.js","assets/detail-header-DhHM1iaZ.js","assets/store-page-CS5-aETQ.js","assets/skeleton-D-czQJT6.js","assets/shortcut-JQIZlWfm.js","assets/copy-inline-button-DBHhgHKP.js","assets/replica-lag-DKRrbvdo.js","assets/vault-page-BmOeAFwg.js","assets/use-vault-list-uk4WVboC.js","assets/access-page-CXVWWMmD.js","assets/observability-page-BFaay44m.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/flows-page-BiZ4-6yQ.js","assets/rolldown-runtime-hePW80VL.js","assets/shortcut-keys-DKxNTe_m.js","assets/react-dom-Bph1y7z7.js","assets/xyflow-D7n4g6go.js","assets/xyflow-DZ0Ws1xk.css","assets/react-D8E3mtu1.js","assets/duration-tone-sC3lGABz.js","assets/trace-detail-sheet-B09O8rA6.js","assets/element-icons-BVXtRyd3.js","assets/http-method-_UHM2ODJ.js","assets/highlighted-json-Awq7gYdu.js","assets/preload-helper-oH4irX4C.js","assets/request-meta-DV0ywz7t.js","assets/collapsible-DGnOM2ph.js","assets/useRender-BE2A9BWC.js","assets/cache-glyph-B5X-NM0-.js","assets/dagre.esm-ZwcdTuZZ.js","assets/agent-disclosure-BP0Y0Sux.js","assets/units-page-CjtdlW8l.js","assets/link-BX6Vqztd.js","assets/dropdown-menu-_NjTEo5_.js","assets/tree-expand-toggle-BtyhmWb4.js","assets/useMutation-B8EO02Ej.js","assets/call-pii-button-ChAUiLo9.js","assets/explorer-empty-2uIhBu0_.js","assets/detail-header-DhHM1iaZ.js","assets/store-page-CS5-aETQ.js","assets/skeleton-D-czQJT6.js","assets/shortcut-JQIZlWfm.js","assets/copy-inline-button-DBHhgHKP.js","assets/replica-lag-DKRrbvdo.js","assets/vault-page-C6Xxm9SA.js","assets/use-vault-list-uk4WVboC.js","assets/access-page-DnWbnGzq.js","assets/observability-page-CrB6vd1T.js"])))=>i.map(i=>d[i]);
2
2
  import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$i as t,$o as n,Ao as r,Ba as i,Bo as a,Br as o,Co as s,Cr as c,Do as l,E as u,Eo as d,F as f,Fo as p,Gi as m,Go as h,Ha as g,Ho as _,Hr as v,I as y,Io as b,Jo as x,Ki as S,Ko as C,Kr as ee,L as te,La as ne,Mo as re,Mt as ie,No as ae,Oi as oe,Oo as se,P as ce,Pa as le,Pi as ue,Po as de,Qo as fe,Ra as pe,Rr as me,So as he,T as ge,Ta as _e,To as ve,Tr as ye,Ua as be,Ui as xe,Uo as Se,Ur as Ce,Va as we,Vo as Te,Vr as Ee,Wa as De,Wo as Oe,Xi as ke,Zi as Ae,Zo as je,Zr as Me,_ as Ne,_o as Pe,_r as Fe,ar as Ie,b as Le,bo as Re,br as ze,d as Be,da as Ve,do as He,dr as Ue,f as We,fa as Ge,fo as Ke,go as qe,gr as Je,h as Ye,ho as Xe,i as Ze,ir as Qe,ja as $e,jo as et,jr as tt,ki as nt,ko as rt,l as it,lr as at,mo as w,n as ot,na as st,nr as ct,o as lt,or as ut,po as dt,pr as ft,qo as pt,qr as mt,r as ht,s as gt,sr as _t,t as vt,u as yt,ua as bt,uo as T,ur as xt,vo as St,vr as Ct,wa as wt,wo as Tt,wr as E,x as Et,xo as Dt,xr as Ot,y as kt,yo as At,za as jt,zo as Mt}from"./shortcut-keys-DKxNTe_m.js";import{n as Nt,t as Pt}from"./useMutation-B8EO02Ej.js";import{n as Ft,r as It,t as Lt}from"./react-dom-Bph1y7z7.js";import{A as Rt,O as zt}from"./xyflow-D7n4g6go.js";import{_ as Bt,a as Vt,b as Ht,c as Ut,d as Wt,f as Gt,g as Kt,h as qt,i as Jt,l as Yt,m as Xt,n as Zt,o as Qt,p as $t,r as en,s as tn,t as nn,u as rn,v as an,y as on}from"./link-BX6Vqztd.js";import{r as sn,t as cn}from"./skeleton-D-czQJT6.js";import{H as ln,V as un,W as dn,n as fn,t as pn}from"./react-D8E3mtu1.js";import{n as mn,r as hn,t as gn}from"./preload-helper-oH4irX4C.js";import{t as _n}from"./useRender-BE2A9BWC.js";import{i as vn,n as yn,r as bn,t as xn}from"./shortcut-JQIZlWfm.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Sn=class extends n{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Nt({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Cn(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Cn(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Cn(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Cn(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){a.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Oe(t,e))}findAll(e={}){return this.getAll().filter(t=>Oe(e,t))}notify(e){a.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return a.batch(()=>Promise.all(e.map(e=>e.continue().catch(C))))}};function Cn(e){return e.options.scope?.id}var wn=class extends n{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Se(r,t),a=this.get(i);return a||(a=new b({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){a.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>h(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>h(e,t)):t}notify(e){a.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){a.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){a.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Tn=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new wn,this.#t=e.mutationCache||new Sn,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=fe.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Mt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(x(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Te(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return a.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;a.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return a.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=a.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(C).catch(C)}invalidateQueries(e,t={}){return a.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=a.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(C)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(C)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(x(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(C).catch(C)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(C).catch(C)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Mt.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(_(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{pt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(_(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{pt(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Se(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===je&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};function D(e){return e?.isNotFound===!0}function En(){try{return sessionStorage}catch{return}}var Dn=`tsr-scroll-restoration-v1_3`,On=En();function kn(){try{return JSON.parse(On?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function An(){try{On?.setItem(Dn,JSON.stringify(jn))}catch{}}var jn=kn(),Mn=`data-scroll-restoration-id`,Nn=e=>e.state.__TSR_key||e.href;function Pn(e){let t=e.getAttribute(Mn);if(t)return`[${Mn}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var Fn=!1,In=`window`;function Ln(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Rn(e){let t=new Set;for(let n of e){if(n===In)continue;let e=Ln(n);e&&t.add(e)}return t}function zn(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||Nn,a=new Set,o=e=>{let t=jn[e]||={};for(let e of a)e===document?t[In]={scrollX,scrollY}:e.isConnected&&(t[Pn(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,Fn=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{Fn||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{o(i(e.stores.resolvedLocation.get()??e.stores.location.get())),An()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c=r.hash,l;if(a.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.restoring&&d&&d!==u){let e=jn[d];if(e){let t=jn[u];for(let n in e){if(n===In){if(s)continue}else{let e=Ln(n);if(!e||s&&o&&(l??=Rn(o),l.has(e)))continue}t||=jn[u]={},t[n]??=e[n]}}}Fn=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=Rn(o));let t=e&&i&&c,s=r.restoring?jn[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===In){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=Ln(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{Fn=!1}}))}function Bn(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function Vn(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function Hn(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=Vn(r):Array.isArray(t)?t.push(Vn(r)):n[e]=[t,Vn(r)]}return n}var Un=Gn(JSON.parse),Wn=Kn(JSON.stringify,JSON.parse);function Gn(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=Hn(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function Kn(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=Bn(e,r);return t?`?${t}`:``}}var qn=`__root__`;function Jn(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function O(e){return e instanceof Response&&!!e.options}function Yn(e){return{input:({url:t})=>{for(let n of e)t=Zn(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=Qn(e[n],t);return t}}}function Xn(e){let t=Ut(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=Qt([`/`,t,e.pathname]),e)}}function Zn(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Qn(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function $n(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i,init:a}=t,o=new Map,s=new Map,c=new Map,l=n(e.status),u=n(e.loadedAt),d=n(e.isLoading),f=n(e.isTransitioning),p=n(e.location),m=n(e.resolvedLocation),h=n(e.statusCode),g=n(e.redirect),_=n([]),v=n([]),y=n([]),b=r(()=>er(o,_.get())),x=r(()=>er(s,v.get())),S=r(()=>er(c,y.get())),C=r(()=>_.get()[0]),ee=r(()=>_.get().some(e=>o.get(e)?.get().status===`pending`)),te=r(()=>({locationHref:p.get().href,resolvedLocationHref:m.get()?.href,status:l.get()})),ne=r(()=>({status:l.get(),loadedAt:u.get(),isLoading:d.get(),isTransitioning:f.get(),matches:b.get(),location:p.get(),resolvedLocation:m.get(),statusCode:h.get(),redirect:g.get()})),re=Bt(64);function ie(e){let t=re.get(e);return t||(t=r(()=>{let t=_.get();for(let n of t){let t=o.get(n);if(t&&t.routeId===e)return t.get()}}),re.set(e,t)),t}let ae={status:l,loadedAt:u,isLoading:d,isTransitioning:f,location:p,resolvedLocation:m,statusCode:h,redirect:g,matchesId:_,pendingIds:v,cachedIds:y,matches:b,pendingMatches:x,cachedMatches:S,firstId:C,hasPending:ee,matchRouteDeps:te,matchStores:o,pendingMatchStores:s,cachedMatchStores:c,__store:ne,getRouteMatchStore:ie,setMatches:oe,setPending:se,setCached:ce};oe(e.matches),a?.(ae);function oe(e){tr(e,o,_,n,i)}function se(e){tr(e,s,v,n,i)}function ce(e){tr(e,c,y,n,i)}return ae}function er(e,t){let n=[];for(let r of t){let t=e.get(r);t&&n.push(t.get())}return n}function tr(e,t,n,r,i){let a=e.map(e=>e.id),o=new Set(a);i(()=>{for(let e of t.keys())o.has(e)||t.delete(e);for(let n of e){let e=t.get(n.id);if(!e){let e=r(n);e.routeId=n.routeId,t.set(n.id,e);continue}e.routeId=n.routeId,e.get()!==n&&e.set(n)}Re(n.get(),a)||n.set(a)})}var nr=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},rr=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),ir=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),ar=(e,t,n=!0)=>{let r={...e.router.options.context??{}},i=n?t:t-1;for(let t=0;t<=i;t++){let n=e.matches[t];if(!n)continue;let i=e.router.getMatch(n.id);i&&Object.assign(r,i.__routeContext,i.__beforeLoadContext)}return r},or=(e,t)=>{if(!e.matches.length)return;let n=t.routeId,r=e.matches.findIndex(t=>t.routeId===e.router.routeTree.id),i=r>=0?r:0,a=n?e.matches.findIndex(e=>e.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=i);for(let t=a;t>=0;t--){let n=e.matches[t];if(e.router.looseRoutesById[n.routeId].options.notFoundComponent)return t}return n?a:i},sr=(e,t,n)=>{if(!(!O(n)&&!D(n)))throw O(n)&&n.redirectHandled&&!n.options.reloadDocument?n:(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,r=>({...r,status:O(n)?`redirected`:D(n)?`notFound`:r.status===`pending`?`success`:r.status,context:ar(e,t.index),isFetching:!1,error:n})),D(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),O(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n)),n)},cr=(e,t)=>{let n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},lr=(e,t,n)=>{let r=ar(e,n);e.updateMatch(t,e=>({...e,context:r}))},ur=(e,t,n)=>{let{id:r,routeId:i}=e.matches[t],a=e.router.looseRoutesById[i];if(n instanceof Promise)throw n;e.firstBadMatchIndex??=t,sr(e,e.router.getMatch(r),n);try{a.options.onError?.(n)}catch(t){n=t,sr(e,e.router.getMatch(r),n)}e.updateMatch(r,e=>(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loadPromise?.resolve(),{...e,error:n,status:`error`,isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!O(n)&&!D(n)&&(e.serialError??=n)},dr=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!ir(e,t)&&(n.options.loader||n.options.beforeLoad||Sr(n))&&typeof i==`number`&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){let t=setTimeout(()=>{nr(e)},i);r._nonReactive.pendingTimeout=t}},fr=(e,t,n)=>{let r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;dr(e,t,n,r);let i=()=>{let n=e.router.getMatch(t);n.preload&&(n.status===`redirected`||n.status===`notFound`)&&sr(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},pr=(e,t,n,r)=>{let i=e.router.getMatch(t),a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=Dt(()=>{a?.resolve(),a=void 0});let{paramsError:o,searchError:s}=i;o&&ur(e,n,o),s&&ur(e,n,s),dr(e,t,r,i);let c=new AbortController,l=!1,u=()=>{l||(l=!0,e.updateMatch(t,e=>({...e,isFetching:`beforeLoad`,fetchCount:e.fetchCount+1,abortController:c})))},d=()=>{i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,e=>({...e,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{u(),d()});return}i._nonReactive.beforeLoadPromise=Dt();let f={...ar(e,n,!1),...i.__routeContext},{search:p,params:m,cause:h}=i,g=ir(e,t),_={search:p,abortController:c,params:m,preload:g,context:f,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:g?`preload`:h,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},v=r=>{if(r===void 0){e.router.batch(()=>{u(),d()});return}(O(r)||D(r))&&(u(),ur(e,n,r)),e.router.batch(()=>{u(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r})),d()})},y;try{if(y=r.options.beforeLoad(_),rt(y))return u(),y.catch(t=>{ur(e,n,t)}).then(v)}catch(t){u(),ur(e,n,t)}v(y)},mr=(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],a=()=>s(),o=()=>pr(e,n,t,i),s=()=>{if(cr(e,n))return;let t=fr(e,n,i);return rt(t)?t.then(o):o()};return a()},hr=(e,t,n)=>{let r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;let i={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(i),n.options.scripts?.(i),n.options.headers?.(i)]).then(([e,t,n])=>({meta:e?.meta,links:e?.links,headScripts:e?.scripts,headers:n,scripts:t,styles:e?.styles}))},gr=(e,t,n,r,i)=>{let a=t[r-1],{params:o,loaderDeps:s,abortController:c,cause:l}=e.router.getMatch(n),u=ar(e,r),d=ir(e,n);return{params:o,deps:s,preload:!!d,parentMatchPromise:a,abortController:c,context:u,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),cause:d?`preload`:l,route:i,...e.router.options.additionalContext}},_r=async(e,t,n,r,i)=>{try{let a=e.router.getMatch(n);try{xr(i);let o=i.options.loader,s=typeof o==`function`?o:o?.handler,c=s?.(gr(e,t,n,r,i)),l=!!s&&rt(c);if((l||i._lazyPromise||i._componentsPromise||i.options.head||i.options.scripts||i.options.headers||a._nonReactive.minPendingPromise)&&e.updateMatch(n,e=>({...e,isFetching:`loader`})),s){let t=l?await c:c;sr(e,e.router.getMatch(n),t),t!==void 0&&e.updateMatch(n,e=>({...e,loaderData:t}))}i._lazyPromise&&await i._lazyPromise;let u=a._nonReactive.minPendingPromise;u&&await u,i._componentsPromise&&await i._componentsPromise,e.updateMatch(n,t=>({...t,error:void 0,context:ar(e,r),status:`success`,isFetching:!1,updatedAt:Date.now()}))}catch(t){let o=t;if(o?.name===`AbortError`){if(a.abortController.signal.aborted){a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,t=>({...t,status:t.status===`pending`?`success`:t.status,isFetching:!1,context:ar(e,r)}));return}let s=a._nonReactive.minPendingPromise;s&&await s,D(t)&&await i.options.notFoundComponent?.preload?.(),sr(e,e.router.getMatch(n),t);try{i.options.onError?.(t)}catch(t){o=t,sr(e,e.router.getMatch(n),t)}!O(o)&&!D(o)&&await xr(i,[`errorComponent`]),e.updateMatch(n,t=>({...t,error:o,context:ar(e,r),status:`error`,isFetching:!1}))}}catch(t){let r=e.router.getMatch(n);r&&(r._nonReactive.loaderPromise=void 0),sr(e,r,t)}},vr=async(e,t,n)=>{async function r(r,a,c,l,d){let f=Date.now()-a.updatedAt,p=r?d.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:d.options.staleTime??e.router.options.defaultStaleTime??0,m=d.options.shouldReload,h=typeof m==`function`?m(gr(e,t,i,n,d)):m,{status:g,invalid:_}=l,v=f>=p&&(!!e.forceStaleReload||l.cause===`enter`||c!==void 0&&c!==l.id);o=g===`success`&&(_||(h??v)),r&&d.options.preload===!1||(o&&!e.sync&&u?(s=!0,(async()=>{try{await _r(e,t,i,n,d);let r=e.router.getMatch(i);r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loadPromise?.resolve(),r._nonReactive.loaderPromise=void 0,r._nonReactive.loadPromise=void 0}catch(t){O(t)&&await e.router.navigate(t.options)}})()):g!==`success`||o?await _r(e,t,i,n,d):lr(e,i,n))}let{id:i,routeId:a}=e.matches[n],o=!1,s=!1,c=e.router.looseRoutesById[a],l=c.options.loader,u=((typeof l==`function`?void 0:l?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!==`blocking`;if(cr(e,i)){if(!e.router.getMatch(i))return e.matches[n];lr(e,i,n)}else{let t=e.router.getMatch(i),o=e.router.stores.matchesId.get()[n],s=(o&&e.router.stores.matchStores.get(o)||null)?.routeId===a?o:e.router.stores.matches.get().find(e=>e.routeId===a)?.id,l=ir(e,i);if(t._nonReactive.loaderPromise){if(t.status===`success`&&!e.sync&&!t.preload&&u)return t;await t._nonReactive.loaderPromise;let n=e.router.getMatch(i),a=n._nonReactive.error||n.error;a&&sr(e,n,a),n.status===`pending`&&await r(l,t,s,n,c)}else{let n=l&&!e.router.stores.matchStores.has(i),a=e.router.getMatch(i);a._nonReactive.loaderPromise=Dt(),n!==a.preload&&e.updateMatch(i,e=>({...e,preload:n})),await r(l,t,s,a,c)}}let d=e.router.getMatch(i);s||(d._nonReactive.loaderPromise?.resolve(),d._nonReactive.loadPromise?.resolve(),d._nonReactive.loadPromise=void 0),clearTimeout(d._nonReactive.pendingTimeout),d._nonReactive.pendingTimeout=void 0,s||(d._nonReactive.loaderPromise=void 0),d._nonReactive.dehydrated=void 0;let f=s?d.isFetching:!1;return f!==d.isFetching||d.invalid!==!1?(e.updateMatch(i,e=>({...e,isFetching:f,invalid:!1})),e.router.getMatch(i)):d};async function yr(e){let t=e,n=[];rr(t.router)&&nr(t);let r;for(let e=0;e<t.matches.length;e++){try{let n=mr(t,e);rt(n)&&await n}catch(e){if(O(e))throw e;if(D(e))r=e;else if(!t.preload)throw e;break}if(t.serialError||t.firstBadMatchIndex!=null)break}let i=t.firstBadMatchIndex??t.matches.length,a=r&&!t.preload?or(t,r):void 0,o=r&&t.preload?0:a===void 0?i:Math.min(a+1,i),s,c;for(let e=0;e<o;e++)n.push(vr(t,n,e));try{await Promise.all(n)}catch{let e=await Promise.allSettled(n);for(let t of e){if(t.status!==`rejected`)continue;let e=t.reason;if(O(e))throw e;D(e)?s??=e:c??=e}if(c!==void 0)throw c}let l=s??(r&&!t.preload?r:void 0),u=t.firstBadMatchIndex===void 0?t.matches.length-1:t.firstBadMatchIndex;if(!l&&r&&t.preload)return t.matches;if(l){let e=or(t,l);e===void 0&&St();let n=t.matches[e],r=t.router.looseRoutesById[n.routeId],i=t.router.options?.defaultNotFoundComponent;!r.options.notFoundComponent&&i&&(r.options.notFoundComponent=i),l.routeId=n.routeId;let a=n.routeId===t.router.routeTree.id;t.updateMatch(n.id,e=>({...e,...a?{status:`success`,globalNotFound:!0,error:void 0}:{status:`notFound`,error:l},isFetching:!1})),u=e,await xr(r,[`notFoundComponent`])}else if(!t.preload){let e=t.matches[0];e.globalNotFound||t.router.getMatch(e.id)?.globalNotFound&&t.updateMatch(e.id,e=>({...e,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){let e=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await xr(e,[`errorComponent`])}for(let e=0;e<=u;e++){let{id:n,routeId:r}=t.matches[e],i=t.router.looseRoutesById[r];try{let e=hr(t,n,i);if(e){let r=await e;t.updateMatch(n,e=>({...e,...r}))}}catch(e){console.error(`Error executing head for route ${r}:`,e)}}let d=nr(t);if(rt(d)&&await d,l)throw l;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function br(e,t){let n=t.map(t=>e.options[t]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function xr(e,t=Cr){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);let n=()=>e._componentsLoaded?void 0:t===Cr?(()=>{if(e._componentsPromise===void 0){let t=br(e,Cr);t?e._componentsPromise=t.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():br(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function Sr(e){for(let t of Cr)if(e.options[t]?.preload)return!0;return!1}var Cr=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`],wr=`__TSR_index`,Tr=`popstate`,Er=`beforeunload`;function Dr(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=jr(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[wr];i=Or(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[wr];i=Or(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[wr]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function Or(e,t){t||={};let n=Mr();return{...t,key:n,__TSR_key:n,[wr]:e}}function kr(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>jr(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Mr();t.history.replaceState({[wr]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(C._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),C._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=jr(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),C.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[wr]-l.state[wr],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),C.notify(u);return}}}l=c(),C.notify(u)},S=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},C=Dr({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Er,S,{capture:!0}),t.removeEventListener(Tr,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(Er,S,{capture:!0}),t.addEventListener(Tr,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return C._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return C._ignoreSubscribers||b(`REPLACE`),n},C}function Ar(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function jr(e,t){let n=Ar(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=Mr();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[wr]:0,key:a,__TSR_key:a}}}function Mr(){return(Math.random()+1).toString(36).substring(7)}function Nr(e,t){let n=t,r=e;return{fromLocation:n,toLocation:r,pathChanged:n?.pathname!==r.pathname,hrefChanged:n?.href!==r.href,hashChanged:n?.hash!==r.hash}}var Pr=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=e=>e(),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Jt(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:kr()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`,this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=Bt(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=$n(Lr(this.latestLocation),e),zn(this)}let a=!1,o=this.options.basepath??`/`,s=this.options.rewrite;if(r||n!==o||i!==s){this.basepath=o;let e=[],t=Ut(o);t&&t!==`/`&&e.push(Xn({basepath:o})),s&&e.push(s),this.rewrite=e.length===0?void 0:e.length===1?e[0]:Yn(e),this.history&&this.updateLatestLocation(),a=!0}a&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<`u`&&`CSS`in window&&typeof window.CSS?.supports==`function`&&(this.isViewTransitionTypesSupported=window.CSS.supports(`selector(:active-view-transition-type(a))`))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=Kt(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&qt(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(e)})},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:he(e).path,external:!1,searchStr:o,search:et(t?.search,i),hash:he(r.slice(1)).path,state:re(t?.state,a)}}let o=new URL(i,this.origin),s=Zn(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:he(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:et(t?.search,c),hash:he(s.hash.slice(1)).path,state:re(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>tn({base:e,to:t.includes(`//`)?en(t):t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>zr({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{let t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t._nonReactive.pendingTimeout),t._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(e=>{this.cancelMatch(e)}),this.stores.matchesId.get().forEach(e=>{if(this.stores.pendingMatchStores.has(e))return;let t=this.stores.matchStores.get(e)?.get();t&&(t.status===`pending`||t.isFetching===`loader`)&&this.cancelMatch(e)})},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this.pendingBuiltLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r.fullPath,a=t.to?`${t.to}`:void 0,o=r.search,s=Object.assign(Object.create(null),r.params),c=a?.charCodeAt(0)===47?`/`:this.resolvePathWithBase(i,`.`),l=a?this.resolvePathWithBase(c,a):c,u=t.params===!1||t.params===null?Object.create(null):(t.params??!0)===!0?s:Object.assign(s,ve(t.params,s)),f=this.routesByPath[rn(l)],p;if(f)p=this.getRouteBranch(f);else if(l.includes(`$`))p=[];else{let e=this.getMatchedRoutes(l);p=e.matchedRoutes,this.options.notFoundRoute&&(!e.foundRoute||e.foundRoute.path!==`/`&&e.routeParams[`**`])&&(p=[...p,this.options.notFoundRoute])}if(p.length&&d(u))for(let e of p){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(u,t(u))}catch{}}let m=e.leaveParams?l:he(Vt({path:l,params:u,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,h=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};p.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,Rr(t.options.validateSearch,{...e,...h}))}catch{}}),h=e}h=Br({search:h,dest:t,destRoutes:p,_includeValidateSearch:e._includeValidateSearch}),h=et(o,h);let g=this.options.stringifySearch(h),_=t.hash===!0?n.hash:t.hash?ve(t.hash,n.hash):void 0,v=_?`#${_}`:``,y=t.state===!0?n.state:t.state?ve(t.state,n.state):{};y=re(n.state,y);let b=`${m}${g}${v}`,x,S,C=!1;if(this.rewrite){let e=new URL(b,this.origin),t=Qn(this.rewrite,e);x=e.href.replace(e.origin,``),t.origin===this.origin?S=t.pathname+t.search+t.hash:(S=t.href,C=!0)}else x=Tt(b),S=x;return{publicHref:S,href:x,pathname:m,search:h,searchStr:g,state:y,hash:_??``,external:C,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=Gt(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=s===!1||s===null?Object.create(null):(s??!0)===!0?n:Object.assign(n,ve(s,n));r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=()=>{let e=[`key`,`__TSR_key`,`__TSR_index`,`__hashScrollIntoViewOptions`];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});let t=s(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},a=rn(this.latestLocation.href)===rn(n.href),o=this.commitLocationPromise;if(this.commitLocationPromise=Dt(()=>{o?.resolve(),o=void 0}),a&&i())this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t})}return this._scroll.next=n.resetScroll??!0,this.history.subscribers.size||this.load(r?{action:{type:r}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...o}={})=>{if(a){let t=this.history.location.state.__TSR_index,n=jr(a,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);o.to=Zn(this.rewrite,r).pathname,o.search=this.options.parseSearch(n.search),o.hash=n.hash.slice(1)}let s=this.buildLocation({...o,_includeValidateSearch:!0});this.pendingBuiltLocation=s;let c=this.commitLocation({...s,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this.pendingBuiltLocation===s&&(this.pendingBuiltLocation=void 0)}),c},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(l(t,this.protocolAllowlist))return;if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return}i.replace?window.location.replace(t):window.location.href=t;return}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();let e=this.matchRoutes(this.latestLocation),t=this.stores.cachedMatches.get().filter(t=>!e.some(e=>e.id===t.id));this.batch(()=>{this.stores.status.set(`pending`),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(e),this.stores.setCached(t)})},this.load=async e=>{let t=e?.action?.type,n,r,i,a=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(o=>{this.startTransition(async()=>{try{this.beforeLoad(),t&&(this._scroll.hash=t===`PUSH`||t===`REPLACE`);let n=this.latestLocation,r=Nr(n,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:`onBeforeNavigate`,...r}),this.emit({type:`onBeforeLoad`,...r}),await yr({router:this,sync:e?.sync,forceStaleReload:a.href===n.href,matches:this.stores.pendingMatches.get(),location:n,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let e=null,t=null,n=null,r=null;this.batch(()=>{let i=this.stores.pendingMatches.get(),a=i.length,o=this.stores.matches.get();e=a?o.filter(e=>!this.stores.pendingMatchStores.has(e.id)):null;let s=new Set;for(let e of this.stores.pendingMatchStores.values())e.routeId&&s.add(e.routeId);let c=new Set;for(let e of this.stores.matchStores.values())e.routeId&&c.add(e.routeId);t=a?o.filter(e=>!s.has(e.routeId)):null,n=a?i.filter(e=>!c.has(e.routeId)):null,r=a?i.filter(e=>c.has(e.routeId)):o,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),a&&(this.stores.setMatches(i),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...e.filter(e=>e.status!==`error`&&e.status!==`notFound`&&e.status!==`redirected`)]),this.clearExpiredCache())});for(let[e,i]of[[t,`onLeave`],[n,`onEnter`],[r,`onStay`]])if(e)for(let t of e)this.looseRoutesById[t.routeId].options[i]?.(t)})})}})}catch(e){O(e)?(n=e,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):D(e)&&(r=e);let t=n?n.status:r?404:this.stores.matches.get().some(e=>e.status===`error`)?500:200;this.batch(()=>{this.stores.statusCode.set(t),this.stores.redirect.set(n)})}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),o()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let o;this.hasNotFoundMatch()?o=404:this.stores.matches.get().some(e=>e.status===`error`)&&(o=500),o!==void 0&&this.stores.statusCode.set(o)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document<`u`&&`startViewTransition`in document&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&this.isViewTransitionTypesSupported){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(Nr(r,i)):t.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{this.startTransition(()=>{let n=this.stores.pendingMatchStores.get(e);if(n){n.set(t);return}let r=this.stores.matchStores.get(e);if(r){r.set(t);return}let i=this.stores.cachedMatchStores.get(e);if(i){let n=t(i.get());n.status===`redirected`?this.stores.cachedMatchStores.delete(e)&&this.stores.cachedIds.set(t=>t.filter(t=>t!==e)):i.set(n)}})},this.getMatch=e=>this.stores.cachedMatchStores.get(e)?.get()??this.stores.pendingMatchStores.get(e)?.get()??this.stores.matchStores.get(e)?.get(),this.invalidate=e=>{let t=t=>e?.filter?.(t)??!0?{...t,invalid:!0,...e?.forcePending||t.status===`error`||t.status===`notFound`?{status:`pending`,error:void 0}:void 0}:t;return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(t)),this.stores.setCached(this.stores.cachedMatches.get().map(t)),this.stores.setPending(this.stores.pendingMatches.get().map(t))}),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.getParsedLocationHref=e=>e.publicHref||`/`,this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=e.options._builtLocation??this.buildLocation(e.options),n=this.getParsedLocationHref(t);e.options.href=n,e.headers.set(`Location`,n)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&l(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=e?.filter;t===void 0?this.stores.setCached([]):this.stores.setCached(this.stores.cachedMatches.get().filter(e=>!t(e)))},this.clearExpiredCache=()=>{let e=Date.now();this.clearCache({filter:t=>{let n=this.looseRoutesById[t.routeId];if(!n.options.loader)return!0;let r=(t.preload?n.options.preloadGcTime??this.options.defaultPreloadGcTime:n.options.gcTime??this.options.defaultGcTime)??3e5;return t.status===`error`||e-t.updatedAt>=r}})},this.loadRouteChunk=xr,this.preloadRoute=async e=>{let t=e._builtLocation??this.buildLocation(e),n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e}),r=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...r,...this.stores.cachedIds.get()]),a=n.filter(e=>!i.has(e.id));if(a.length){let e=this.stores.cachedMatches.get();this.stores.setCached([...e,...a])}try{return n=await yr({router:this,matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(O(e))return e.options.reloadDocument?void 0:await this.preloadRoute({...e.options,_fromLocation:t});D(e)||console.error(e);return}},this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(t?.pending&&this.stores.status.get()!==`pending`)return!1;let i=(t?.pending===void 0?!this.stores.isLoading.get():t.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),a=Xt(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,i.pathname,this.processedTree);return!a||e.params&&!s(a.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?s(i.search,r.search,{partial:!0})?a.rawParams:!1:a.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(e=>e.status===`notFound`||e.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??Wn,parseSearch:e.parseSearch??Un,protocolAllowlist:e.protocolAllowlist??At}),typeof document<`u`&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=Wt(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i}=n,{matchedRoutes:a}=n,o=!1;(r?r.path!==`/`&&i[`**`]:rn(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?Hr(this.options.notFoundMode,a):void 0,c=Array(a.length),l=new Map;for(let e of this.stores.matchStores.values())e.routeId&&l.set(e.routeId,e.get());for(let n=0;n<a.length;n++){let r=a[n],o=c[n-1],u,d,f;{let n=o?.search??e.search,i=o?._strictSearch??void 0;try{let e=Rr(r.options.validateSearch,{...n})??void 0;u={...n,...e},d={...i,...e},f=void 0}catch(e){let r=e;if(e instanceof Fr||(r=new Fr(e.message,{cause:e})),t?.throwOnError)throw r;u=n,d={},f=r}}let p=r.options.loaderDeps?.({search:u})??``,m=p?JSON.stringify(p):``,{interpolatedPath:h,usedParams:g}=Vt({path:r.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),_=r.id+h+m,v=this.getMatch(_),y=l.get(r.id),b=v?._strictParams??g,x;if(!v)try{Ur(r,b)}catch(e){if(x=D(e)||O(e)?e:new Ir(e.message,{cause:e}),t?.throwOnError)throw x}Object.assign(i,b);let S=y?`stay`:`enter`,C;if(v)C={...v,cause:S,params:y?.params??i,_strictParams:b,search:et(y?y.search:v.search,u),_strictSearch:d};else{let e=r.options.loader||r.options.beforeLoad||r.lazyFn||Sr(r)?`pending`:`success`;C={id:_,ssr:r.options.ssr,index:n,routeId:r.id,params:y?.params??i,_strictParams:b,pathname:h,updatedAt:Date.now(),search:y?et(y.search,u):u,_strictSearch:d,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:x,__routeContext:void 0,_nonReactive:{loadPromise:Dt()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:S,loaderDeps:y?re(y.loaderDeps,p):p,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:r.options.staticData||{},fullPath:r.fullPath}}t?.preload||(C.globalNotFound=s===r.id),C.searchError=f;let ee=this.getParentContext(o);C.context={...ee,...C.__routeContext,...C.__beforeLoadContext},c[n]=C}for(let t=0;t<c.length;t++){let n=c[t],r=this.looseRoutesById[n.routeId],a=this.getMatch(n.id),o=l.get(n.routeId);if(n.params=o?et(o.params,i):i,!a){let i=c[t-1],a=this.getParentContext(i);if(r.options.context){let t={deps:n.loaderDeps,params:n.params,context:a??{},location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:c,routeId:r.id};n.__routeContext=r.options.context(t)??void 0}n.context={...a,...n.__routeContext,...n.__beforeLoadContext}}}return c}matchRoutesLightweight(e){let t=r(this.stores.matchesId.get()),n=this.lightweightCache.get(e);if(n&&n[0]===t)return n[1];let{matchedRoutes:i,routeParams:a}=this.getMatchedRoutes(e.pathname),o=r(i),s={...e.search};for(let e of i)try{Object.assign(s,Rr(e.options.validateSearch,s))}catch{}let c=t&&this.stores.matchStores.get(t)?.get(),l=c&&c.routeId===o.id&&c.pathname===e.pathname,u;if(l)u=c.params;else{let e=Object.assign(Object.create(null),a);for(let t of i)try{Ur(t,e)}catch{}u=e}let d={matchedRoutes:i,fullPath:o.fullPath,search:s,params:u};return this.lightweightCache.set(e,[t,d]),d}},Fr=class extends Error{},Ir=class extends Error{};function Lr(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function Rr(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Fr(`Async validation not supported`);if(n.issues)throw new Fr(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function zr({pathname:e,routesById:t,processedTree:n}){let r=Object.create(null),i=rn(e),a,o=$t(i,n,!0);return o&&(a=o.route,Object.assign(r,o.rawParams)),{matchedRoutes:o?.branch||[t.__root__],routeParams:r,foundRoute:a}}function Br({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return Vr(n)(e,t,r??!1)}function Vr(e){let t,n,r=[];for(let t of e){let e=t.options;`search`in e?e.search?.middlewares&&r.push(...e.search.middlewares):(e.preSearchFilters||e.postSearchFilters)&&r.push(({search:t,next:n})=>{let r=n(e.preSearchFilters?e.preSearchFilters.reduce((e,t)=>t(e),t):t);return e.postSearchFilters?e.postSearchFilters.reduce((e,t)=>t(e),r):r});let i=e.validateSearch;i&&r.push(({search:e,next:t,meta:r})=>{let a=t(e);if(n)try{let e=Rr(i,a);if(r&&e)for(let t in e)t in a||(r.defaulted||=new Map).set(t,e[t]);return{...a,...e}}catch{}return a})}let i=(e,n,a)=>{if(e>=r.length){if(!t.search)return{};if(t.search===!0)return n;let e=ve(t.search,n);return a&&(a.explicit=e),e}return r[e]({search:n,next:(t,n)=>{if(n){let n=a||{};return{search:i(e+1,t,n),meta:n}}return i(e+1,t,a)},meta:a})};return function(e,r,a){return t=r,n=a,i(0,e)}}function Hr(e,t){if(e!==`root`)for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.children)return n.id}return qn}function Ur(e,t){let n=e.options.params?.parse??e.options.parseParams;if(n){let e=n(t);if(e===!1)throw Error(`Route params.parse returned false for a matched route`);Object.assign(t,e)}}var Wr=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=qn:this.parentRoute||St();let r=n?qn:t?.path;r&&r!==`/`&&(r=Yt(r));let i=t?.id||r,a=n?qn:Qt([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=Qt([`/`,a]));let o=a===`__root__`?`/`:Qt([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=rn(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>Jn({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},Gr=class extends Wr{constructor(e){super(e)}},k=e(It(),1),A=Rt();function Kr(e){let t=e.errorComponent??Jr;return(0,A.jsx)(qr,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?k.createElement(t,{error:n,reset:r}):e.children})}var qr=class extends k.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function Jr({error:e}){let[t,n]=k.useState(!1);return(0,A.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,A.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,A.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,A.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,A.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,A.jsx)(`div`,{children:(0,A.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,A.jsx)(`code`,{children:e.message}):null})}):null]})}var j=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(j||{});function Yr({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function Xr(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Zr=[],Qr=0,{link:$r,unlink:ei,propagate:ti,checkDirty:ni,shallowPropagate:ri}=Yr({update(e){return e._update()},notify(e){Zr[ai++]=e,e.flags&=~j.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=j.Mutable|j.Dirty,ci(e))}}),ii=0,ai=0,M,oi=0;function si(e){try{++oi,e()}finally{--oi||li()}}function ci(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=ei(n,e)}function li(){if(!(oi>0)){for(;ii<ai;){let e=Zr[ii];Zr[ii++]=void 0,e.notify()}ii=0,ai=0}}function ui(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?j.None:j.Mutable,get(){return M!==void 0&&$r(i,M,Qr),i._snapshot},subscribe(e){let t=Xr(e),n={current:!1},r=di(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=M,o=t?.compare??Object.is;if(n)M=i,++Qr,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=j.Mutable|j.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{M=a,n&&(i.flags&=~j.RecursedCheck),ci(i)}}};return n?(i.flags=j.Mutable|j.Dirty,i.get=function(){let e=i.flags;if(e&j.Dirty||e&j.Pending&&ni(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&ri(e)}}else e&j.Pending&&(i.flags=e&~j.Pending);return M!==void 0&&$r(i,M,Qr),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(ti(e),ri(e),li())}},i}function di(e){let t=()=>{let t=M;M=n,++Qr,n.depsTail=void 0,n.flags=j.Watching|j.RecursedCheck;try{return e()}finally{M=t,n.flags&=~j.RecursedCheck,ci(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:j.Watching|j.RecursedCheck,notify(){let e=this.flags;e&j.Dirty||e&j.Pending&&ni(this.deps,this)?t():this.flags=j.Watching},stop(){this.flags=j.None,this.depsTail=void 0,ci(this)}};return t(),n}function fi(e){return Ke({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function pi(e){let{select:t,...n}=e;return Ke({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function mi(e){return Ke({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function hi(e){return Ke({...e,select:t=>e.select?e.select(t.context):t.context})}var gi=class extends Wr{constructor(e){super(e),this.useMatch=e=>Ke({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>hi({...e,from:this.id}),this.useSearch=e=>He({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>mi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>pi({...e,from:this.id}),this.useLoaderData=e=>fi({...e,from:this.id}),this.useNavigate=()=>T({from:this.fullPath}),this.Link=k.forwardRef((e,t)=>(0,A.jsx)(nn,{ref:t,from:this.fullPath,...e}))}};function N(e){return new gi(e)}var _i=class extends Gr{constructor(e){super(e),this.useMatch=e=>Ke({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>hi({...e,from:this.id}),this.useSearch=e=>He({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>mi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>pi({...e,from:this.id}),this.useLoaderData=e=>fi({...e,from:this.id}),this.useNavigate=()=>T({from:this.fullPath}),this.Link=k.forwardRef((e,t)=>(0,A.jsx)(nn,{ref:t,from:this.fullPath,...e}))}};function vi(e){return new _i(e)}function yi(e,t){let n,r,i,a,o=()=>(n||=e().then(e=>{n=void 0,r=e[t??`default`]}).catch(e=>{if(i=e,se(i)&&i instanceof Error&&typeof window<`u`&&typeof sessionStorage<`u`){let e=`tanstack_router_reload:${i.message}`;sessionStorage.getItem(e)||(sessionStorage.setItem(e,`1`),a=!0)}}),n),s=function(e){if(a)throw window.location.reload(),new Promise(()=>{});if(i)throw i;if(!r)if(an)an(o());else throw o();return k.createElement(r,e)};return s.preload=o,s}function bi(e){let t=qe(),n=`not-found-${w(t.stores.location,e=>e.pathname)}-${w(t.stores.status,e=>e)}`;return(0,A.jsx)(Kr,{getResetKey:()=>n,onCatch:(t,n)=>{if(D(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(D(t))return e.fallback?.(t);throw t},children:e.children})}function xi(){return(0,A.jsx)(`p`,{children:`Not Found`})}function Si(e){return(0,A.jsx)(A.Fragment,{children:e.children})}function Ci(e,t,n){return t.options.notFoundComponent?(0,A.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,A.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,A.jsx)(xi,{})}var wi=(e,t)=>e.routeId===t.routeId&&e._displayPending===t._displayPending,Ti=(e,t)=>e[0]===t[0]&&e[1]===t[1],Ei=k.memo(function({matchId:e}){let t=qe(),n=t.stores.matchStores.get(e);n||St();let r=w(t.stores.loadedAt,e=>e),i=w(n,e=>e,wi);return(0,A.jsx)(Di,{router:t,matchId:e,resetKey:r,matchState:k.useMemo(()=>{let e=i.routeId,n=t.routesById[e].parentRoute?.id;return{routeId:e,ssr:i.ssr,_displayPending:i._displayPending,parentRouteId:n}},[i._displayPending,i.routeId,i.ssr,t.routesById])})});function Di({router:e,matchId:t,resetKey:n,matchState:r}){let i=e.routesById[r.routeId],a=i.options.pendingComponent??e.options.defaultPendingComponent,o=a?(0,A.jsx)(a,{}):null,s=i.options.errorComponent??e.options.defaultErrorComponent,c=i.options.onCatch??e.options.defaultOnCatch,l=i.isRoot?i.options.notFoundComponent??e.options.notFoundRoute?.options.component:i.options.notFoundComponent,u=r.ssr===!1||r.ssr===`data-only`,d=(!i.isRoot||i.options.wrapInSuspense||u)&&(i.options.wrapInSuspense??a??(i.options.errorComponent?.preload||u))?k.Suspense:Si,f=s?Kr:Si,p=l?bi:Si;return(0,A.jsxs)(i.isRoot?i.options.shellComponent??Si:Si,{children:[(0,A.jsx)(Xe.Provider,{value:t,children:(0,A.jsx)(d,{fallback:o,children:(0,A.jsx)(f,{getResetKey:()=>n,errorComponent:s||Jr,onCatch:(e,t)=>{if(D(e))throw e.routeId??=r.routeId,e;c?.(e,t)},children:(0,A.jsx)(p,{fallback:e=>{if(e.routeId??=r.routeId,!l||e.routeId&&e.routeId!==r.routeId||!e.routeId&&!i.isRoot)throw e;return k.createElement(l,e)},children:u||r._displayPending?(0,A.jsx)(Zt,{fallback:o,children:(0,A.jsx)(ki,{matchId:t})}):(0,A.jsx)(ki,{matchId:t})})})})}),r.parentRouteId===`__root__`?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Oi,{}),(e.options.scrollRestoration,null)]}):null]})}function Oi(){let e=qe(),t=k.useRef();return on(()=>{let n=e.stores.resolvedLocation.get(),r=t.current;n&&(!r||r.href!==n.href)&&e.emit({type:`onRendered`,...Nr(e.stores.location.get(),r??n)}),t.current=n},[w(e.stores.resolvedLocation,e=>e?.state.__TSR_key),e]),null}var ki=k.memo(function({matchId:e}){let t=qe(),n=(e,n)=>t.getMatch(e.id)?._nonReactive[n]??e._nonReactive[n],r=t.stores.matchStores.get(e);r||St();let i=w(r,e=>e),a=i.routeId,o=t.routesById[a],s=k.useMemo(()=>{let e=(t.routesById[a].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:a,loaderDeps:i.loaderDeps,params:i._strictParams,search:i._strictSearch});return e?JSON.stringify(e):void 0},[a,i.loaderDeps,i._strictParams,i._strictSearch,t.options.defaultRemountDeps,t.routesById]),c=k.useMemo(()=>{let e=o.options.component??t.options.defaultComponent;return e?(0,A.jsx)(e,{},s):(0,A.jsx)(Ai,{})},[s,o.options.component,t.options.defaultComponent]);if(i._displayPending)throw n(i,`displayPendingPromise`);if(i._forcePending)throw n(i,`minPendingPromise`);if(i.status===`pending`){let e=o.options.pendingMinMs??t.options.defaultPendingMinMs;if(e){let n=t.getMatch(i.id);if(n&&!n._nonReactive.minPendingPromise){let t=Dt();n._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),n._nonReactive.minPendingPromise=void 0},e)}}throw n(i,`loadPromise`)}if(i.status===`notFound`)return D(i.error)||St(),Ci(t,o,i.error);if(i.status===`redirected`)throw O(i.error)||St(),n(i,`loadPromise`);if(i.status===`error`)throw i.error;return c}),Ai=k.memo(function(){let e=qe(),t=k.useContext(Xe),n,r=!1,i;{let a=t?e.stores.matchStores.get(t):void 0;[n,r]=w(a,e=>[e?.routeId,e?.globalNotFound??!1],Ti),i=w(e.stores.matchesId,e=>e[e.findIndex(e=>e===t)+1])}let a=n?e.routesById[n]:void 0,o=e.options.defaultPendingComponent?(0,A.jsx)(e.options.defaultPendingComponent,{}):null;if(r)return a||St(),Ci(e,a,void 0);if(!i)return null;let s=(0,A.jsx)(Ei,{matchId:i});return n===`__root__`?(0,A.jsx)(k.Suspense,{fallback:o,children:s}):s});function ji(){let e=qe(),t=k.useRef({router:e,mounted:!1}),[n,r]=k.useState(!1),i=w(e.stores.isLoading,e=>e),a=w(e.stores.hasPending,e=>e),o=Ht(i),s=i||n||a,c=Ht(s),l=i||a,u=Ht(l);return e.startTransition=e=>{r(!0),k.startTransition(()=>{e(),r(!1)})},k.useEffect(()=>{let t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return rn(e.latestLocation.publicHref)!==rn(n.publicHref)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),on(()=>{typeof window<`u`&&e.ssr||t.current.router===e&&t.current.mounted||(t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(e){console.error(e)}})())},[e]),on(()=>{o&&!i&&e.emit({type:`onLoad`,...Nr(e.stores.location.get(),e.stores.resolvedLocation.get())})},[o,e,i]),on(()=>{u&&!l&&e.emit({type:`onBeforeRouteMount`,...Nr(e.stores.location.get(),e.stores.resolvedLocation.get())})},[l,u,e]),on(()=>{if(c&&!s){let t=Nr(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:`onResolved`,...t}),si(()=>{e.stores.status.set(`idle`),e.stores.resolvedLocation.set(e.stores.location.get())})}},[s,c,e]),null}function Mi(){let e=qe(),t=e.routesById.__root__.options.pendingComponent??e.options.defaultPendingComponent,n=t?(0,A.jsx)(t,{}):null,r=(0,A.jsxs)(typeof document<`u`&&e.ssr?Si:k.Suspense,{fallback:n,children:[(0,A.jsx)(ji,{}),(0,A.jsx)(Ni,{})]});return e.options.InnerWrap?(0,A.jsx)(e.options.InnerWrap,{children:r}):r}function Ni(){let e=qe(),t=w(e.stores.firstId,e=>e),n=w(e.stores.loadedAt,e=>e),r=t?(0,A.jsx)(Ei,{matchId:t}):null;return(0,A.jsx)(Xe.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,A.jsx)(Kr,{getResetKey:()=>n,errorComponent:Jr,onCatch:void 0,children:r})})}var Pi=e=>({createMutableStore:ui,createReadonlyStore:ui,batch:si}),Fi=e=>new Ii(e),Ii=class extends Pr{constructor(e){super(e,Pi)}};function Li({router:e,children:t,...n}){d(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,A.jsx)(Pe.Provider,{value:e,children:t});return e.options.Wrap?(0,A.jsx)(e.options.Wrap,{children:r}):r}function Ri({router:e,...t}){return(0,A.jsx)(Li,{router:e,...t,children:(0,A.jsx)(Mi,{})})}function zi(e){let t=qe({warn:e?.router===void 0}),n=e?.router||t;return w(n.stores.__store,dt(e,n))}var Bi=null;function P(e,...t){Bi?.(e,t)}var Vi={303:`Multiple adapter contexts detected. This might happen in monorepos.`,404:`nuqs requires an adapter to work with your framework.`,409:"Multiple versions of the library are loaded. This may lead to unexpected behavior. Currently using `%s`, but `%s` (via the %s adapter) was about to load on top.",414:`Max safe URL length exceeded. Some browsers may not be able to accept this URL. Consider limiting the amount of state stored in the URL.`,429:"URL update rate-limited by the browser. Consider increasing `throttleMs` for key(s) `%s`. %O",500:`Empty search params cache. Search params can't be accessed in Layouts.`,501:"Search params cache already populated. Have you called `parse` twice?",502:"`processUrlSearchParams` threw while processing key(s) `%s`. %O"};function Hi(e){return`[nuqs] ${Vi[e]}
3
- See https://nuqs.dev/NUQS-${e}`}function Ui(e){if(e.size===0)return``;let t=[];for(let[n,r]of e.entries()){let e=n.replace(/#/g,`%23`).replace(/&/g,`%26`).replace(/\+/g,`%2B`).replace(/=/g,`%3D`).replace(/\?/g,`%3F`);t.push(`${e}=${Wi(r)}`)}return`?`+t.join(`&`)}function Wi(e){return e.replace(/%/g,`%25`).replace(/\+/g,`%2B`).replace(/ /g,`+`).replace(/#/g,`%23`).replace(/&/g,`%26`).replace(/"/g,`%22`).replace(/'/g,`%27`).replace(/`/g,`%60`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/[\x00-\x1F]/g,e=>encodeURIComponent(e))}var Gi=`2.9.5`,Ki={};function qi(e,t){let n=Symbol.for(`nuqs.${Gi}.${e}`),r=globalThis;if(r[n]!=null)return r[n];let i=Object.isExtensible(r)?r:Ki;return i[n]??=t()}function Ji(e,t,n){let r=qi(e,()=>new WeakMap);return r.has(t)||r.set(t,n()),r.get(t)}var Yi=Ji(`adapter-context`,k.createContext,()=>{let e=(0,k.createContext)({useAdapter(){throw Error(Hi(404))}});return e.displayName=`NuqsAdapterContext`,e});typeof window<`u`&&(window.__NuqsAdapterContext&&window.__NuqsAdapterContext!==Yi&&console.error(Hi(303)),window.__NuqsAdapterContext=Yi);function Xi(e){return({children:t,defaultOptions:n,processUrlSearchParams:r,...i})=>(0,k.createElement)(Yi.Provider,{...i,value:{useAdapter:e,defaultOptions:n,processUrlSearchParams:r}},t)}function Zi(e,t,n){if(t.length===0)return e;let r=n?new URLSearchParams(e):e;for(let n of Array.from(e.keys()))t.includes(n)||r.delete(n);return r}function Qi(){if(typeof window>`u`||!window.GestureEvent)return 50;try{let e=navigator.userAgent?.match(/version\/([\d\.]+) safari/i);return parseFloat(e[1])>=17?120:320}catch{return 320}}function $i(e){return{method:`throttle`,timeMs:e}}var ea=$i(Qi());function ta(e,t,n){if(typeof n==`string`)e.set(t,n);else{e.delete(t);for(let r of n)e.append(t,r);e.has(t)||e.set(t,``)}return e}function na(){let e=new Map;return{on(t,n){let r=e.get(t)||[];return r.push(n),e.set(t,r),()=>this.off(t,n)},off(t,n){let r=e.get(t);r&&e.set(t,r.filter(e=>e!==n))},emit(t,n){e.get(t)?.forEach(e=>e(n))}}}function ra(e,t,n){function r(){e(),n.removeEventListener(`abort`,a)}let i=setTimeout(r,t);function a(){clearTimeout(i),n.removeEventListener(`abort`,a)}n.addEventListener(`abort`,a)}function ia(){let e=Promise;if(Promise.hasOwnProperty(`withResolvers`))return Promise.withResolvers();let t=()=>{},n=()=>{};return{promise:new e((e,r)=>{t=e,n=r}),resolve:t,reject:n}}function aa(e,t){let n=t;for(let t=e.length-1;t>=0;t--){let r=e[t];if(!r)continue;let i=n;n=()=>r(i)}n()}function oa(){return new URLSearchParams(location.search)}var sa=class{updateMap=new Map;options={history:`replace`,scroll:!1,shallow:!0};timeMs=ea.timeMs;transitions=new Set;resolvers=null;controller=null;lastFlushedAt=0;resetQueueOnNextPush=!1;push({key:e,query:t,options:n},r=ea.timeMs){this.resetQueueOnNextPush&&=(this.reset(),!1),P(7,e,t,n),this.updateMap.set(e,t),n.history===`push`&&(this.options.history=`push`),n.scroll&&(this.options.scroll=!0),n.shallow===!1&&(this.options.shallow=!1),n.startTransition&&this.transitions.add(n.startTransition),(!Number.isFinite(this.timeMs)||r>this.timeMs)&&(this.timeMs=r)}getQueuedQuery(e){return this.updateMap.get(e)}getPendingPromise({getSearchParamsSnapshot:e=oa}){return this.resolvers?.promise??Promise.resolve(e())}flush({getSearchParamsSnapshot:e=oa,rateLimitFactor:t=1,...n},r){if(this.controller??=new AbortController,!Number.isFinite(this.timeMs))return P(8),Promise.resolve(e());if(this.resolvers)return this.resolvers.promise;this.resolvers=ia();let i=()=>{this.lastFlushedAt=performance.now();let[t,i]=this.applyPendingUpdates({...n,autoResetQueueOnUpdate:n.autoResetQueueOnUpdate??!0,getSearchParamsSnapshot:e},r);i===null?(this.resolvers.resolve(t),this.resetQueueOnNextPush=!0):this.resolvers.reject(t),this.resolvers=null};return ra(()=>{let e=performance.now()-this.lastFlushedAt,n=this.timeMs,r=t*Math.max(0,n-e);P(9,r,n,t),r===0?i():ra(i,r,this.controller.signal)},0,this.controller.signal),this.resolvers.promise}abort(){return this.controller?.abort(),this.controller=new AbortController,this.resolvers?.resolve(new URLSearchParams),this.resolvers=null,this.reset()}reset(){let e=Array.from(this.updateMap.keys());return P(10,JSON.stringify(Object.fromEntries(this.updateMap))),this.updateMap.clear(),this.transitions.clear(),this.options={history:`replace`,scroll:!1,shallow:!0},this.timeMs=ea.timeMs,e}applyPendingUpdates(e,t){let{updateUrl:n,getSearchParamsSnapshot:r}=e,i=r();if(P(11,this.updateMap.size,i.toString()),this.updateMap.size===0)return[i,null];let a=Array.from(this.updateMap.entries()),o={...this.options},s=Array.from(this.transitions);e.autoResetQueueOnUpdate&&this.reset(),P(12,a,o);for(let[e,t]of a)t===null?i.delete(e):i=ta(i,e,t);if(t)try{i=t(i)}catch(e){return console.error(Hi(502),a.map(([e])=>e).join(),e),this.resetQueueOnNextPush=!0,[i,e]}try{return aa(s,()=>n(i,o)),[i,null]}catch(e){return console.error(Hi(429),a.map(([e])=>e).join(),e),[i,e]}}},ca=qi(`throttle-queue`,()=>new sa),la=class{callback;resolvers=ia();controller=new AbortController;queuedValue=void 0;constructor(e){this.callback=e}abort(){this.controller.abort(),this.queuedValue=void 0}push(e,t){return this.queuedValue=e,this.controller.abort(),this.controller=new AbortController,ra(()=>{let t=this.resolvers;try{P(13,e);let n=this.callback(e);P(14,this.queuedValue),this.queuedValue=void 0,this.resolvers=ia(),n.then(e=>t.resolve(e)).catch(e=>t.reject(e))}catch(e){this.queuedValue=void 0,t.reject(e)}},t,this.controller.signal),this.resolvers.promise}},ua=class{throttleQueue;queues=new Map;queuedQuerySync=na();constructor(e=new sa){this.throttleQueue=e}push(e,t,n,r){if(!Number.isFinite(t)){let e=n.getSearchParamsSnapshot??oa;return Promise.resolve(e())}let i=e.key;if(!this.queues.has(i)){P(15,i);let e=new la(e=>(this.throttleQueue.push(e),this.throttleQueue.flush(n,r).finally(()=>{this.queues.get(e.key)?.queuedValue===void 0&&(P(16,e.key),this.queues.delete(e.key)),this.queuedQuerySync.emit(e.key)})));this.queues.set(i,e)}P(17,e);let a=this.queues.get(i).push(e,t);return this.queuedQuerySync.emit(i),a}abort(e){let t=this.queues.get(e);return t?(P(18,e,t.queuedValue?.query),this.queues.delete(e),t.abort(),this.queuedQuerySync.emit(e),e=>(e.then(t.resolvers.resolve,t.resolvers.reject),e)):e=>e}abortAll(){for(let[e,t]of this.queues.entries())P(18,e,t.queuedValue?.query),t.abort(),t.resolvers.resolve(new URLSearchParams),this.queuedQuerySync.emit(e);this.queues.clear()}getQueuedQuery(e){let t=this.queues.get(e)?.queuedValue?.query;return t===void 0?this.throttleQueue.getQueuedQuery(e):t}};qi(`debounce-controller`,()=>new ua(ca));function da(e){return qi(`history-emitter.${e}`,()=>na())}var fa=`__nuqs__`,pa=da(`react`);function ma(e){return function(t,n){let r=new URL(location.href);r.search=Ui(t),P(20,`react`,r),e&&n.shallow===!1?(n.history===`push`?location.assign:location.replace).call(location,r):(n.history===`push`?history.pushState:history.replaceState).call(history,history.state,fa,r),pa.emit(`update`,t),n.scroll===!0&&window.scrollTo({top:0})}}var ha=(0,k.createContext)({fullPageNavigationOnShallowFalseUpdates:!1}),ga=new URLSearchParams;function _a(){return ga}function va(e){return pa.on(`update`,e),window.addEventListener(`popstate`,e),()=>{pa.off(`update`,e),window.removeEventListener(`popstate`,e)}}function ya(e){let{fullPageNavigationOnShallowFalseUpdates:t}=(0,k.useContext)(ha),n=(0,k.useRef)(null);return{searchParams:(0,k.useSyncExternalStore)(va,()=>{let t=Zi(new URLSearchParams(location.search),e,!1),r=t.toString();return n.current?.key===r?n.current.search:(n.current={key:r,search:t},t)},_a),updateUrl:(0,k.useMemo)(()=>ma(t),[t])}}var ba=Xi(ya);function xa({children:e,fullPageNavigationOnShallowFalseUpdates:t=!1,...n}){return(0,k.createElement)(ha.Provider,{value:{fullPageNavigationOnShallowFalseUpdates:t}},(0,k.createElement)(ba,{...n,children:e}))}var Sa=Lt();function Ca(e){let t=typeof e.run==`string`&&e.run.length>0?e.run:void 0,n=typeof e.flow==`string`&&e.flow.length>0?e.flow:void 0,r=e.follow===!1||e.follow===`false`?!1:void 0;return{...t===void 0?{}:{run:t},...n===void 0?{}:{flow:n},...r===void 0?{}:{follow:r}}}function wa(){let e=He({strict:!1}),t=T();return{selectedRunId:typeof e.run==`string`?e.run:null,selectedFlowId:typeof e.flow==`string`?e.flow:null,follow:e.follow!==!1,setSelectedRun:(0,k.useCallback)(e=>{t({to:`.`,search:t=>({...t,run:e??void 0}),replace:!0})},[t]),setSelectedFlow:(0,k.useCallback)(e=>{t({to:`.`,search:t=>({...t,flow:e??void 0}),replace:!0})},[t]),setFollow:(0,k.useCallback)(e=>{t({to:`.`,search:t=>({...t,follow:e?void 0:!1}),replace:!0})},[t])}}function Ta(e){let t=typeof e.flow==`string`&&e.flow.length>0?e.flow:void 0;return{...t===void 0?{}:{flow:t}}}function Ea(){let e=He({strict:!1}),t=T();return{selectedFlowId:typeof e.flow==`string`?e.flow:null,setSelectedFlow:(0,k.useCallback)(e=>{t({to:`.`,search:t=>({...t,flow:e??void 0}),replace:!0})},[t])}}var Da={"15m":9e5,"1h":36e5,"24h":864e5,"7d":6048e5};function Oa(e){return e===`15m`||e===`1h`||e===`24h`||e===`7d`?e:`1h`}function ka(e){return e.error!=null&&e.error.length>0}function Aa(e,t){return e.length===0?0:e.length===1?e[0]:e[Math.min(e.length-1,Math.max(0,Math.ceil(t*e.length)-1))]}function ja(e,t,n){let r=t-Math.max(0,n);return e.filter(e=>e.startedAt>=r&&e.startedAt<=t)}function Ma(e,t,n){let r=ja(e,t,n);if(r.length===0)return{kind:`empty`};let i=r.map(e=>e.durationMs).sort((e,t)=>e-t),a=r.filter(ka).length,o=r.length;return{kind:`summary`,total:o,errors:a,errorRate:a/o,p50Ms:Aa(i,.5),p95Ms:Aa(i,.95),p99Ms:Aa(i,.99),from:t-Math.max(0,n),to:t,windowMs:n}}function Na(e){let t=typeof e.run==`string`&&e.run.length>0?e.run:void 0,n=Oa(e.window),r=typeof e.error==`string`&&e.error.length>0?e.error:void 0,i=typeof e.q==`string`&&e.q.length>0?e.q:void 0,a=e.view===`query`?`query`:void 0;return{...t===void 0?{}:{run:t},...n===`1h`?{}:{window:n},...r===void 0?{}:{error:r},...i===void 0?{}:{q:i},...a===void 0?{}:{view:a}}}function Pa(){let e=He({strict:!1}),t=T(),n=typeof e.run==`string`?e.run:null,r=Oa(e.window),i=typeof e.error==`string`?e.error:null,a=typeof e.q==`string`?e.q:``,o=e.view===`query`?`query`:`metrics`,s=(0,k.useCallback)(e=>{t({to:`.`,search:t=>Na({...t,...e}),replace:!0})},[t]);return{selectedRunId:n,window:r,selectedErrorKey:i,query:a,view:o,setSelectedRun:(0,k.useCallback)(e=>{s({run:e??void 0})},[s]),setWindow:(0,k.useCallback)(e=>{s({window:e})},[s]),setSelectedError:(0,k.useCallback)((e,t)=>{s({error:e??void 0,...t===void 0?{}:{run:t??void 0}})},[s]),setQuery:(0,k.useCallback)(e=>{s({q:e.length>0?e:void 0})},[s]),setView:(0,k.useCallback)(e=>{s({view:e===`metrics`?void 0:e})},[s])}}function Fa(e){let t=typeof e.q==`string`&&e.q.length>0?e.q:void 0,n=typeof e.name==`string`&&e.name.length>0?e.name:void 0,r=e.action===`set`||e.action===`rotate`||e.action===`rotate-master`||e.action===`create`?e.action:void 0;return{...t===void 0?{}:{q:t},...n===void 0?{}:{name:n},...r===void 0?{}:{action:r}}}function Ia(){let e=He({strict:!1}),t=T(),n=typeof e.q==`string`?e.q:``,r=typeof e.name==`string`?e.name:null,i=e.action??null,a=(0,k.useCallback)(e=>{t({to:`.`,search:t=>Fa({...t,...e}),replace:!0})},[t]);return{query:n,selectedName:r,action:i,setQuery:(0,k.useCallback)(e=>{a({q:e.length>0?e:void 0})},[a]),setSelectedName:(0,k.useCallback)(e=>{a({name:e??void 0,action:void 0})},[a]),setAction:(0,k.useCallback)(e=>{a({action:e??void 0})},[a])}}function La(e){let t=typeof e.q==`string`&&e.q.length>0?e.q:void 0,n=typeof e.key==`string`&&e.key.length>0?e.key:void 0,r=e.action===`create`||e.action===`edit`||e.action===`refresh`||e.action===`revoke`||e.action===`rotate`?e.action:void 0;return{...t===void 0?{}:{q:t},...n===void 0?{}:{key:n},...r===void 0?{}:{action:r}}}function Ra(){let e=He({strict:!1}),t=T(),n=typeof e.q==`string`?e.q:``,r=typeof e.key==`string`?e.key:null,i=e.action??null,a=(0,k.useCallback)(e=>{t({to:`.`,search:t=>La({...t,...e}),replace:!0})},[t]);return{query:n,selectedKey:r,action:i,setQuery:e=>{a({q:e.length>0?e:void 0})},setSelectedKey:e=>{a({key:e??void 0,action:void 0})},setAction:e=>{a({action:e??void 0})}}}var za=`/overview`,Ba=new Set([`/overview`,`/flows`,`/store`,`/vault`,`/access`,`/observability`]),Va=`/monitoring`,Ha=`/observability`,Ua=1024;function Wa(e){if(typeof e!=`string`)return;let t=e.trim();if(t.length===0||t.length>Ua||!t.startsWith(`/`)||t.startsWith(`//`)||t.includes(`://`))return;let n,r;try{let e=new URL(t,`http://console.local`);if(e.origin!==`http://console.local`)return;n=e.pathname,r=e.search}catch{return}if(n===Va&&(n=Ha),Ba.has(n))return r.length>0?`${n}${r}`:n}function Ga(e){let t=Wa(e.next);return t===void 0||t===`/overview`?{}:{next:t}}function Ka(e){return Ga({next:e})}function qa(e){let t=Wa(e);if(t===void 0)return{to:za,search:{}};let n=new URL(t,`http://console.local`),r=Object.fromEntries(n.searchParams.entries());return n.pathname===`/flows`?{to:`/flows`,search:Ta(r)}:n.pathname===`/store`?{to:`/store`,search:sn(r)}:n.pathname===`/vault`?{to:`/vault`,search:Fa(r)}:n.pathname===`/access`?{to:`/access`,search:La(r)}:n.pathname===Ha?{to:`/observability`,search:Na(r)}:{to:`/overview`,search:Ca(r)}}function Ja(e,t){let n=qa(t);switch(n.to){case`/flows`:e({to:`/flows`,search:n.search});return;case`/store`:e({to:`/store`,search:n.search});return;case`/vault`:e({to:`/vault`,search:n.search});return;case`/access`:e({to:`/access`,search:n.search});return;case`/observability`:e({to:`/observability`,search:n.search});return;default:e({to:`/overview`,search:n.search})}}function Ya(){let[e,t]=(0,k.useState)(!1);return(0,k.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(hover: hover) and (pointer: fine)`),n=()=>{t(e.matches)};return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var Xa=[1,.78,.54,.32,.16],Za=36;function Qa({className:e}){return(0,A.jsxs)(`svg`,{viewBox:`0 0 20 28`,fill:`none`,"aria-hidden":!0,className:e,children:[(0,A.jsx)(`circle`,{cx:`4`,cy:`4`,r:`2`,fill:`currentColor`}),(0,A.jsx)(`circle`,{cx:`10`,cy:`9`,r:`2`,fill:`currentColor`}),(0,A.jsx)(`circle`,{cx:`16`,cy:`14`,r:`2`,fill:`currentColor`}),(0,A.jsx)(`circle`,{cx:`10`,cy:`19`,r:`2`,fill:`currentColor`}),(0,A.jsx)(`circle`,{cx:`4`,cy:`24`,r:`2`,fill:`currentColor`})]})}var $a=(0,k.forwardRef)(function({children:e,className:t,accentClassName:n,labelClassName:r,expand:i=!0,disabled:a,onMouseEnter:o,onMouseLeave:s,onFocus:l,onBlur:u,...d},f){let p=fn(),m=Ya(),[h,g]=(0,k.useState)(!1),[_,v]=(0,k.useState)(!1),y=!!(i&&!a&&(m&&h||_)),b=p?{duration:0}:ln;return(0,A.jsxs)(pn.button,{ref:f,type:`button`,disabled:a,onMouseEnter:e=>{g(!0),o?.(e)},onMouseLeave:e=>{g(!1),s?.(e)},onFocus:e=>{v(!0),l?.(e)},onBlur:e=>{v(!1),u?.(e)},whileTap:p||a?void 0:{scale:.98},transition:dn,className:c(`relative inline-flex h-11 w-full items-center overflow-hidden rounded-none bg-primary p-1 text-primary-foreground select-none`,`outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,`disabled:pointer-events-none disabled:opacity-50`,t),...d,children:[i?(0,A.jsxs)(pn.span,{layout:`size`,"aria-hidden":!0,transition:b,style:{width:y?`calc(100% - 8px)`:Za,borderRadius:0},className:c(`absolute inset-y-1 left-1 z-10 overflow-hidden bg-background text-foreground`,n),children:[(0,A.jsx)(pn.span,{animate:{opacity:+!y},transition:{duration:p?0:.1,ease:un},className:`absolute inset-0 grid place-items-center`,children:(0,A.jsx)(Qa,{className:`h-5 w-3.5`})}),(0,A.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-around px-3`,children:Xa.map((e,t)=>(0,A.jsx)(pn.span,{animate:{opacity:y?e:0,transform:y&&!p?`translateX(0px)`:`translateX(-6px)`},transition:{duration:p?0:.18,delay:y&&!p?.04+t*.025:0,ease:un},className:`inline-grid place-items-center`,children:(0,A.jsx)(Qa,{className:`h-5 w-3.5`})},e))})]}):null,(0,A.jsx)(pn.span,{animate:{opacity:+!y,transform:y&&!p?`translateX(6px)`:`translateX(0px)`},transition:{duration:p?0:.12,ease:un},className:c(`relative z-0 flex w-full items-center justify-center text-sm font-medium text-primary-foreground`,i&&`pr-3 pl-11`,r),children:e})]})}),eo=`flex w-full flex-col rounded-none border border-border bg-card text-card-foreground`,to=`gap-0 border-t border-border/60`,no=`grid grid-cols-[6rem_minmax(0,1fr)] items-center gap-x-3 gap-y-1 border-b border-border/60 px-5 py-3.5 last:border-b-0 data-[invalid=true]:border-destructive`,ro=`h-8 rounded-none border-0 bg-transparent px-0 text-sm shadow-none focus-visible:border-0 focus-visible:ring-0 dark:bg-transparent autofill:bg-transparent autofill:shadow-none`,io=`col-start-2 min-w-0`,ao=`text-[10px] font-semibold tracking-[0.08em] text-muted-foreground uppercase group-focus-within/field:text-foreground`;function oo(e){return e.pending?`loading`:e.success?`success`:e.error?`error`:`idle`}function so({state:e=`idle`,children:t,loadingText:n=`Loading`,successText:r=`Done`,errorText:i=`Try again`,disabled:a,...s}){let c=e===`loading`,l=e===`loading`?n:e===`success`?r:e===`error`?i:t,u=e===`loading`?oe:e===`success`?st:e===`error`?o:null;return(0,A.jsx)($a,{disabled:a||c,expand:e===`idle`,"aria-busy":c||void 0,"data-slot":`auth-submit`,...s,children:(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[u?(0,A.jsx)(E,{icon:u,size:16,color:`currentColor`,strokeWidth:1.5,className:e===`loading`?`animate-spin`:void 0,"aria-hidden":!0}):null,l]})})}var co={neutral:`bg-foreground/35`,open:`bg-foreground`,alert:`bg-destructive`};function lo({label:e,tone:t=`neutral`}){return(0,A.jsxs)(`p`,{className:c(ao,`flex h-10 shrink-0 items-center gap-1.5 border-b border-border/60 px-5 group-focus-within/field:text-muted-foreground`),children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:c(`size-1.5 rounded-[1px]`,co[t])}),e]})}var uo=`pointer-events-none absolute size-3 border-foreground/50`;function fo(){return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:c(uo,`-top-1.5 -left-1.5 border-t border-l`)}),(0,A.jsx)(`span`,{"aria-hidden":!0,className:c(uo,`-top-1.5 -right-1.5 border-t border-r`)}),(0,A.jsx)(`span`,{"aria-hidden":!0,className:c(uo,`-bottom-1.5 -left-1.5 border-b border-l`)}),(0,A.jsx)(`span`,{"aria-hidden":!0,className:c(uo,`-right-1.5 -bottom-1.5 border-r border-b`)})]})}function po({title:e,description:t,status:n,children:r,footer:i,className:a}){let o=(0,k.useId)(),s=`auth-title-${o}`,l=t?`auth-desc-${o}`:void 0,u=fn()??!1;return(0,A.jsxs)(pn.div,{"data-slot":`auth-card`,initial:!u&&{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:u?0:.42,ease:un},className:c(`relative flex w-full flex-col gap-4`,a),children:[(0,A.jsx)(fo,{}),(0,A.jsxs)(`div`,{"data-auth-layer":`0`,className:eo,children:[n?(0,A.jsx)(lo,{...n}):null,(0,A.jsxs)(`header`,{"data-auth-layer":`1`,className:c(`flex flex-col gap-3 px-5`,n?`pt-7`:`pt-6`),children:[(0,A.jsx)(`h1`,{id:s,className:`text-[1.75rem] leading-none font-semibold tracking-[-0.03em] text-foreground`,children:e}),t?(0,A.jsx)(`p`,{id:l,className:`text-[13px] leading-snug text-muted-foreground`,children:t}):null]}),(0,A.jsx)(`div`,{className:`mt-7 flex flex-col pb-1`,children:typeof r==`function`?r({titleId:s,descriptionId:l}):r})]}),i?(0,A.jsx)(`div`,{"data-auth-layer":`footer`,className:`w-full`,children:i}):null]})}function mo(){return(0,A.jsxs)(`div`,{"data-slot":`auth-card`,className:`relative flex w-full flex-col gap-4`,role:`status`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,A.jsx)(`span`,{className:`sr-only`,children:`Checking setup…`}),(0,A.jsx)(fo,{}),(0,A.jsxs)(`div`,{"data-auth-layer":`0`,className:eo,children:[(0,A.jsx)(`div`,{className:`flex h-10 shrink-0 items-center border-b border-border/60 px-5`,children:(0,A.jsx)(cn,{className:`h-3 w-24 rounded-none`})}),(0,A.jsxs)(`header`,{"data-auth-layer":`1`,className:`flex flex-col gap-3 px-5 pt-7`,children:[(0,A.jsx)(cn,{className:`h-7 w-36 rounded-none`}),(0,A.jsx)(cn,{className:`h-4 w-full rounded-none`})]}),(0,A.jsx)(`div`,{className:`mt-7 flex flex-col border-t border-border/60 pb-1`,children:Array.from({length:2},(e,t)=>(0,A.jsxs)(`div`,{className:`grid grid-cols-[6rem_minmax(0,1fr)] items-center gap-x-3 border-b border-border/60 px-5 py-3.5 last:border-b-0`,children:[(0,A.jsx)(cn,{className:`h-3 w-14 rounded-none`}),(0,A.jsx)(cn,{className:`h-8 w-full rounded-none`})]},t))})]}),(0,A.jsx)(`div`,{"data-auth-layer":`footer`,className:`w-full`,children:(0,A.jsx)(cn,{className:`h-11 w-full rounded-none`})})]})}var ho=[{value:`light`,label:`Light`,icon:t},{value:`dark`,label:`Dark`,icon:ue},{value:`system`,label:`System`,icon:mt}];function go(){let{theme:e,setTheme:t}=hn();return(0,A.jsx)(`div`,{role:`group`,"aria-label":`Theme`,"data-slot":`mode-toggle`,className:`flex h-10 items-stretch`,children:ho.map(n=>{let r=e===n.value;return(0,A.jsxs)(ce,{disabled:r,children:[(0,A.jsx)(te,{render:e=>(0,A.jsxs)(`button`,{...e,type:`button`,"aria-label":n.label,"aria-pressed":r,onClick:r=>{e.onClick?.(r),t(n.value)},className:c(Fe,`font-semibold tracking-[0.08em] uppercase`,r?Je:Ct,e.className),children:[(0,A.jsx)(E,{icon:n.icon,className:`size-3`,color:`currentColor`,strokeWidth:1.5,"aria-hidden":!0}),r?n.label:null]})}),(0,A.jsx)(f,{side:`top`,sideOffset:6,children:n.label})]},n.value)})})}function _o({className:e,...t}){return(0,A.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 327 87`,fill:`none`,role:`img`,"aria-label":`OKE`,className:c(`text-foreground`,e),...t,children:[(0,A.jsx)(`path`,{d:`M231.08 84.672V0H320.648V13.824H250.088V33.696H303.944V47.952H250.088V70.848H321.224L326.984 83.088C326.984 83.472 325.688 83.856 323.096 84.24C320.504 84.528 316.04 84.672 309.704 84.672H231.08Z`,fill:`currentColor`}),(0,A.jsx)(`path`,{d:`M136.638 13.672V36.864H144.702C146.622 36.864 148.206 36.624 149.454 36.144C150.702 35.664 151.854 34.896 152.91 33.84C155.598 31.152 158.67 27.792 162.126 23.76C165.582 19.728 168.942 15.6 172.206 11.376C175.566 7.05599 178.446 3.264 180.846 0H204.174L198.27 8.64C195.582 11.424 192.702 14.448 189.63 17.712C186.558 20.976 183.534 24.192 180.558 27.36C177.582 30.432 174.894 33.168 172.494 35.568C170.094 37.872 168.318 39.552 167.166 40.608C169.758 41.472 172.11 42.576 174.222 43.92C176.43 45.264 179.118 47.232 182.286 49.824C184.686 51.744 186.99 53.712 189.198 55.728C191.502 57.744 194.142 60.144 197.118 62.928C200.478 66 203.646 68.256 206.622 69.696C209.598 71.136 212.094 72.048 214.11 72.432C216.222 72.816 217.566 73.008 218.142 73.008L215.262 84.672C214.974 84.96 214.11 85.248 212.67 85.536C211.23 85.92 209.166 86.112 206.478 86.112C201.774 86.112 197.694 85.152 194.238 83.232C190.782 81.312 187.374 78.72 184.014 75.456C180.366 71.616 175.95 67.2 170.766 62.208C168.366 59.712 165.918 57.648 163.422 56.016C160.926 54.384 158.094 53.136 154.926 52.272C151.854 51.408 148.014 50.976 143.406 50.976H136.638V70.672H117.63V13.672H136.638Z`,fill:`currentColor`}),(0,A.jsx)(`path`,{d:`M75.865 84.191C73.608 84.512 71.12 84.672 68.4 84.672H26.352C19.632 84.672 14.352 83.712 10.512 81.792C6.672 79.872 3.936 76.992 2.304 73.152C0.768001 69.312 0 64.56 0 58.896V25.632C0 20.064 0.768001 15.408 2.304 11.664C3.84 7.824 6.528 4.944 10.368 3.024C14.208 1.008 19.536 0 26.352 0H68.4C71.135 0 73.623 0.166992 75.865 0.500992V13.672H92.928C94.048 17.033 94.608 21.019 94.608 25.632V58.896C94.608 63.392 94.078 67.318 93.017 70.672H75.865V84.191ZM30.528 70.848H64.368C67.92 70.848 70.656 69.936 72.576 68.112C74.592 66.288 75.6 63.792 75.6 60.624V23.904C75.6 21.12 74.592 18.768 72.576 16.848C70.56 14.832 67.824 13.824 64.368 13.824H30.528C27.072 13.824 24.288 14.736 22.176 16.56C20.064 18.384 19.008 20.832 19.008 23.904V60.624C19.008 63.888 20.016 66.432 22.032 68.256C24.144 69.984 26.976 70.848 30.528 70.848Z`,fill:`currentColor`})]})}function vo({className:e,...t}){return(0,A.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 95 85`,fill:`none`,role:`img`,"aria-label":`OKE`,className:c(`text-foreground`,e),...t,children:(0,A.jsx)(`path`,{d:`M75.865 84.191C73.608 84.512 71.12 84.672 68.4 84.672H26.352C19.632 84.672 14.352 83.712 10.512 81.792C6.672 79.872 3.936 76.992 2.304 73.152C0.768001 69.312 0 64.56 0 58.896V25.632C0 20.064 0.768001 15.408 2.304 11.664C3.84 7.824 6.528 4.944 10.368 3.024C14.208 1.008 19.536 0 26.352 0H68.4C71.135 0 73.623 0.166992 75.865 0.500992V13.672H92.928C94.048 17.033 94.608 21.019 94.608 25.632V58.896C94.608 63.392 94.078 67.318 93.017 70.672H75.865V84.191ZM30.528 70.848H64.368C67.92 70.848 70.656 69.936 72.576 68.112C74.592 66.288 75.6 63.792 75.6 60.624V23.904C75.6 21.12 74.592 18.768 72.576 16.848C70.56 14.832 67.824 13.824 64.368 13.824H30.528C27.072 13.824 24.288 14.736 22.176 16.56C20.064 18.384 19.008 20.832 19.008 23.904V60.624C19.008 63.888 20.016 66.432 22.032 68.256C24.144 69.984 26.976 70.848 30.528 70.848Z`,fill:`currentColor`})})}function yo({children:e}){return(0,A.jsxs)(`div`,{className:`flex min-h-dvh w-full flex-col bg-background`,"data-slot":`console-chrome`,children:[(0,A.jsx)(`main`,{className:`mx-auto flex w-full max-w-md flex-1 flex-col justify-center px-4 py-10`,children:(0,A.jsxs)(`div`,{className:`flex flex-col items-stretch gap-10`,children:[(0,A.jsx)(_o,{className:`h-7 w-auto self-center`}),e]})}),(0,A.jsxs)(`footer`,{className:`grid h-10 shrink-0 grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-stretch border-t border-border/60`,children:[(0,A.jsx)(`p`,{className:`flex min-w-0 items-center truncate px-2 text-[10px] font-medium text-muted-foreground`,children:`OKE | Console`}),(0,A.jsx)(go,{}),(0,A.jsxs)(`p`,{className:`${ct} flex min-w-0 items-center justify-end gap-1.5 px-2`,children:[(0,A.jsx)(E,{icon:Me,size:12,color:`currentColor`,strokeWidth:1.5,"aria-hidden":!0}),(0,A.jsxs)(`span`,{children:[`v`,`0.17.0`]})]})]})]})}function bo(){return(0,A.jsx)(yo,{children:(0,A.jsxs)(`div`,{"data-slot":`not-found`,children:[(0,A.jsx)(`p`,{className:ao,children:`404`}),(0,A.jsx)(`h1`,{className:`mt-3 text-2xl font-semibold tracking-tight`,children:`Page not found`}),(0,A.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-muted-foreground`,children:`This URL is not a Console page.`})]})})}function xo({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function So(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Co=[],wo=0,{link:To,unlink:Eo,propagate:Do,checkDirty:Oo,shallowPropagate:ko}=xo({update(e){return e._update()},notify(e){Co[jo++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,No(e))}}),Ao=0,jo=0,F,Mo=0;function I(e){try{++Mo,e()}finally{--Mo||Po()}}function No(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Eo(n,e)}function Po(){if(!(Mo>0)){for(;Ao<jo;){let e=Co[Ao];Co[Ao++]=void 0,e.notify()}Ao=0,jo=0}}function Fo(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return F!==void 0&&To(i,F,wo),i._snapshot},subscribe(e){let t=So(e),n={current:!1},r=Io(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=F,o=t?.compare??Object.is;if(n)F=i,++wo,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{F=a,n&&(i.flags&=-5),No(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&Oo(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&ko(e)}}else e&32&&(i.flags=e&-33);return F!==void 0&&To(i,F,wo),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Do(e),ko(e),Po())}},i}function Io(e){let t=()=>{let t=F;F=n,++wo,n.depsTail=void 0,n.flags=6;try{return e()}finally{F=t,n.flags&=-5,No(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&Oo(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,No(this)}};return t(),n}var Lo=class{constructor(e,t){this.atom=Fo(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(So(e))}},Ro=class{constructor(e){this.atom=Fo(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(So(e))}};function zo(e,t){return typeof e==`function`?new Ro(e):t?new Lo(e,t):new Lo(e)}var Bo=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(()=>{this.lastArgs!==void 0&&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),void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function Vo(e,t){return new Bo(e,t).maybeExecute}var Ho=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{if(this.#c<this.#l){this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{});return}this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop()};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(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 n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{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){this.debugLog(`Event bus client is disabled, not emitting event`,e,t);return}if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d){this.debugLog(`Previously failed to connect, not emitting to bus`);return}if(!this.#a){this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().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 n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}},L=new class extends Ho{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function Uo(e,t){return typeof e==`function`?e(t):e}function Wo(e,t){return Qo(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function Go(e,t,n){let r=Qo(t);function i(e){if(!r.length)return Uo(n,e);let t=r.shift();if(typeof t==`string`||typeof t==`number`&&!Array.isArray(e))return typeof e==`object`?(e===null&&(e={}),{...e,[t]:i(e[t])}):{[t]:i()};if(Array.isArray(e)&&typeof t==`number`){let n=e.slice(0,t);return[...n.length?n:Array(t),i(e[t]),...e.slice(t+1)]}return[...Array(t),i()]}return i(e)}function Ko(e,t){let n=Qo(t);function r(e){if(!e)return;if(n.length===1){let t=n[0];if(Array.isArray(e)&&typeof t==`number`)return e.filter((e,n)=>n!==t);let{[t]:r,...i}=e;return i}let t=n.shift();if((typeof t==`string`||typeof t==`number`&&!Array.isArray(e))&&typeof e==`object`)return{...e,[t]:r(e[t])};if(typeof t==`number`&&Array.isArray(e)){if(t>=e.length)return e;let n=e.slice(0,t);return[...n.length?n:Array(t),r(e[t]),...e.slice(t+1)]}throw Error(`It seems we have created an infinite loop in deleteBy. `)}return r(e)}var qo=46,Jo=91,Yo=93,Xo=48,Zo=57;function Qo(e){if(Array.isArray(e))return[...e];if(typeof e!=`string`)throw Error(`Path must be a string.`);let t=e.length,n=[],r=+(t>0&&e.charCodeAt(0)===Jo),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===qo||s===Jo||s===Yo){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==Xo),s=e.slice(r,o);if(a){let e=parseInt(s,10);t<=15||String(e)===s?n.push(e):n.push(s)}else n.push(s)}else a!==Yo&&(a!==-1||s!==Yo)&&(a!==s||s!==qo&&s!==Jo)&&n.push(``);r=o+1,i=!0}else(s<Xo||s>Zo)&&(i=!1);a=s}return n.length||n.push(``),n}function $o(e){return!(Array.isArray(e)&&e.length===0)}function es(e,t){return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!1},runValidation:e=>e.validators.filter(Boolean).map(e=>({cause:e.cause,validate:e.fn}))})}function ts(e,t){let{asyncDebounceMs:n}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:i,onDynamicAsyncDebounceMs:a}=t.validators||{},o=n??0;return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!0},runValidation:t=>t.validators.filter(Boolean).map(t=>{let n=t?.cause||e,s=o;switch(n){case`change`:s=i??o;break;case`blur`:s=r??o;break;case`dynamic`:s=a??o;break;case`submit`:s=0}return e===`submit`&&(s=0),{cause:n,validate:t.fn,debounceMs:s}})})}var ns=e=>!!e&&typeof e==`object`&&`fields`in e;function rs(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!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[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||n.length===0&&!Array.isArray(e)&&!Array.isArray(t)&&(Object.getPrototypeOf(e)!==Object.prototype||Object.getPrototypeOf(t)!==Object.prototype))return!1;for(let i of n)if(!r.includes(i)||!rs(e[i],t[i]))return!1;return!0}var is=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:n})=>e?{newErrorValue:e,newSource:`form`}:t?{newErrorValue:void 0,newSource:void 0}:n?{newErrorValue:n,newSource:`field`}:{newErrorValue:void 0,newSource:void 0},as=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function R(e,t){return e==null?t:{...e,...t}}for(var os=256,ss=[],cs;os--;)ss[os]=(os+256).toString(16).substring(1);function ls(){let e=0,t,n=``;if(!cs||os+16>256){for(cs=Array(256),e=256;e--;)cs[e]=256*Math.random()|0;e=0,os=0}for(;e<16;e++)t=cs[os+e],n+=e===6?ss[t&15|64]:e===8?ss[t&63|128]:ss[t],e&1&&e>1&&e<11&&(n+=`-`);return os++,n}var us=Vo(e=>L.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function ds(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++)t[n]=ds(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,ds(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(ds(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=ds(e[n]));return t}function fs(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var z=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});let t=e.event.async,n=t?void 0:{fn:e.validators.onMount,cause:`mount`},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:`change`},i={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:`blur`},a={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:`submit`},o=t?void 0:{fn:()=>void 0,cause:`server`};switch(e.event.type){case`mount`:return e.runValidation({validators:[n],form:e.form});case`submit`:return e.runValidation({validators:[r,i,a,o],form:e.form});case`server`:return e.runValidation({validators:[],form:e.form});case`blur`:return e.runValidation({validators:[i,o],form:e.form});case`change`:return e.runValidation({validators:[r,o],form:e.form});default:throw Error(`Unknown validation event type: ${e.event.type}`)}};function ps(e,t){let n=new Map;for(let r of e){let e=r.path??[],i=t,a=``;for(let t=0;t<e.length;t++){let n=e[t];if(n===void 0)continue;let r=typeof n==`object`?n.key:n,o=Number(r);a+=Array.isArray(i)&&!Number.isNaN(o)?`[${o}]`:(t>0?`.`:``)+String(r),i=typeof i==`object`&&i?i[r]:void 0}n.set(a,(n.get(a)??[]).concat(r))}return Object.fromEntries(n)}var ms=(e,t)=>{let n=ps(e,t);return{form:n,fields:n}},hs={validate({value:e,validationSource:t},n){let r=n[`~standard`].validate(e);if(r instanceof Promise)throw Error(`async function passed to sync validator`);if(r.issues)return t===`field`?r.issues:ms(r.issues,e)},async validateAsync({value:e,validationSource:t},n){let r=await n[`~standard`].validate(e);if(r.issues)return t===`field`?r.issues:ms(r.issues,e)}},gs=e=>!!e&&`~standard`in e,B={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function _s(e){function t(t){let n=e.getFieldMeta(t)??B;e.setFieldMeta(t,{...n,_arrayVersion:(n._arrayVersion||0)+1})}function n(n,r,i){t(n);let a=s(n,r,`move`,i),c=Math.min(r,i),u=Math.max(r,i);for(let e=c;e<=u;e++)a.push(o(n,e));let d=Object.keys(e.fieldInfo).reduce((t,i)=>(i.startsWith(o(n,r))&&t.set(i,e.getFieldMeta(i)),t),new Map);l(a,r<i?`up`:`down`),Object.keys(e.fieldInfo).filter(e=>e.startsWith(o(n,i))).forEach(t=>{let a=t.replace(o(n,i),o(n,r)),s=d.get(a);s&&e.setFieldMeta(t,s)})}function r(e,n){t(e),l(s(e,n,`remove`),`up`)}function i(n,r,i){t(n),s(n,r,`swap`,i).forEach(t=>{if(!t.toString().startsWith(o(n,r)))return;let a=t.toString().replace(o(n,r),o(n,i)),[s,c]=[e.getFieldMeta(t),e.getFieldMeta(a)];s&&e.setFieldMeta(a,s),c&&e.setFieldMeta(t,c)})}function a(n,r){t(n);let i=s(n,r,`insert`);l(i,`down`),i.forEach(t=>{t.toString().startsWith(o(n,r))&&e.setFieldMeta(t,u())})}function o(e,t){return`${e}[${t}]`}function s(t,n,r,i){let a=[o(t,n)];switch(r){case`swap`:a.push(o(t,i));break;case`move`:{let[e,r]=[Math.min(n,i),Math.max(n,i)];for(let n=e;n<=r;n++)a.push(o(t,n));break}default:{let r=e.getFieldValue(t),i=Array.isArray(r)?r.length:0;for(let e=n+1;e<i;e++)a.push(o(t,e));break}}return Object.keys(e.fieldInfo).filter(e=>a.some(t=>e.startsWith(t)))}function c(e,t){return e.replace(/\[(\d+)\]/,(e,n)=>{let r=parseInt(n,10);return`[${t===`up`?r+1:Math.max(0,r-1)}]`})}function l(t,n){(n===`up`?t:[...t].reverse()).forEach(t=>{let r=c(t.toString(),n),i=e.getFieldMeta(r);i?e.setFieldMeta(t,i):e.setFieldMeta(t,u())})}let u=()=>B;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function vs(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},formGroupStateBase:e.formGroupStateBase??{},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}}}var ys=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{us(this)}),t=L.on(`request-form-state`,e=>{e.payload.id===this._formId&&L.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=L.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=L.on(`request-form-force-submit`,e=>{e.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),i=()=>{r(),n(),t(),e.unsubscribe(),L.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return L.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options}),a&&this.validateSync(`mount`),i},this.update=e=>{if(!e)return;let t=this.options;this.options=e;let n=e.defaultValues&&!rs(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!rs(e.defaultState,t.defaultState)&&!this.state.isTouched;if(!(!n&&!r)){if(I(()=>{this.baseStore.setState(()=>vs(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=_s(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}L.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(e,t)=>{let{fieldMeta:n}=this.state,r=this.resetFieldMeta(n);e&&!t?.keepDefaultValues&&(this.options={...this.options,defaultValues:e}),this.baseStore.setState(()=>{let t=e??this.options.defaultValues??this.options.defaultState?.values;return e||Object.values(this.fieldInfo).forEach(e=>{e.instance&&e.instance.options.defaultValue!==void 0&&(t=Go(t,e.instance.name,e.instance.options.defaultValue))}),vs({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return I(()=>{Object.values(this.fieldInfo).forEach(n=>{if(!n.instance)return;let r=n.instance;t.push(Promise.resolve().then(()=>r.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.instance.store.state.meta.isTouched||n.instance.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null,a=[`${e}[${t}]`];for(let n=t+1;n<=(i??0);n++)a.push(`${e}[${n}]`);let o=Object.keys(this.fieldInfo).filter(e=>a.some(t=>e.startsWith(t))),s=[];return I(()=>{o.forEach(e=>{s.push(Promise.resolve().then(()=>this.validateField(e,n)))})}),(await Promise.all(s)).flat()},this.validateField=(e,t)=>{let n=this.fieldInfo[e]?.instance;if(!n){let{hasErrored:n}=this.validateSync(t);return n&&!this.options.asyncAlways?this.getFieldMeta(e)?.errors??[]:this.validateAsync(t).then(()=>this.getFieldMeta(e)?.errors??[])}return n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0})),n.validate(t)},this.validateSync=(e,t)=>{let n=es(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||z}),r=!1,i={};return I(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=bs(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=xs(e.cause),s=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(a||{})]);t?.filterFieldNames&&(s=new Set([...s].filter(t.filterFieldNames)));for(let e of s){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!a?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??B,r=a?.[e],{newErrorValue:s,newSource:c}=is({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=B)=>({...e,errorMap:{...e.errorMap,[o]:s},errorSourceMap:{...e.errorSourceMap,[o]:c}}))}t?.dontUpdateFormErrorMap||this.state.errorMap?.[o]!==n&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:n}})),(n||a)&&(r=!0)}if(t?.dontUpdateFormErrorMap)return;let a=xs(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=xs(`server`);this.state.errorMap?.[o]&&e!==`server`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:void 0}}))}),{hasErrored:r,fieldsErrorMap:i}},this.validateAsync=async(e,t)=>{let n=ts(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||z});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=xs(e.cause);this.state.validationMetaMap[n]?.lastAbortController.abort();let a=new AbortController;this.state.validationMetaMap[n]={lastAbortController:a},r.push(new Promise(async n=>{let r;try{r=await new Promise((t,n)=>{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){n(e)}},e.debounceMs)})}catch(e){r=e}let{formError:o,fieldErrors:s}=bs(r);s&&(i=i?{...i,...s}:s);let c=xs(e.cause),l=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(i||{})]),u=Array.from(l);t?.filterFieldNames&&(u=u.filter(t.filterFieldNames));for(let e of u){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!i?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??B,r=i?.[e],{newErrorValue:a,newSource:o}=is({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=B)=>({...e,errorMap:{...e.errorMap,[c]:a},errorSourceMap:{...e.errorSourceMap,[c]:o}}))}t?.dontUpdateFormErrorMap||this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[c]:o}})),n(i?{fieldErrors:i,errorMapKey:c}:void 0)}))}let a=[],o={};if(r.length){a=await Promise.all(r);for(let e of a)if(e?.fieldErrors){let{errorMapKey:t}=e;for(let[n,r]of Object.entries(e.fieldErrors))o[n]={...o[n]||{},[t]:r}}}return this.baseStore.setState(e=>({...e,isFormValidating:!1})),o},this.validate=(e,t)=>{let{hasErrored:n,fieldsErrorMap:r}=this.validateSync(e,t);return n&&!this.options.asyncAlways?r:this.validateAsync(e,t)},this._handleSubmit=async e=>{this.baseStore.setState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),I(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance&&(e.instance.store.state.meta.isTouched||e.instance.setMeta(e=>({...e,isTouched:!0})))})});let t=e??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride&&this.baseStore.state.submissionAttempts<=1){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}this.baseStore.setState(e=>({...e,isSubmitting:!0}));let n=()=>{this.baseStore.setState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.state.isFieldsValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),L.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){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),L.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});return}I(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance?.triggerOnSubmitListener()})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),I(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),L.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),L.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}},this.getFieldValue=e=>Wo(this.state.values,e),this.getFieldMeta=e=>this.state.fieldMeta[e],this.getFormGroupMeta=e=>this.formGroupMetaDerived.state[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(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[e]:Uo(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=B,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;I(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:Go(n.values,e,t)}))}),i||this.getFieldInfo(e).instance?.triggerOnChangeListener(),a||this.validateField(e,`change`)},this.deleteField=e=>{let t=[...Object.keys(this.fieldInfo).filter(t=>{let n=e.toString();return t!==n&&t.startsWith(n)}),e];this.baseStore.setState(e=>{let n={...e};return t.forEach(e=>{n.values=Ko(n.values,e),delete this.fieldInfo[e],delete n.fieldMetaBase[e]}),n})},this.pushFieldValue=(e,t,n)=>{this.setFieldValue(e,e=>[...Array.isArray(e)?e:[],t],n),_s(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],R(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),_s(this).handleArrayInsert(e,t),i||await this.validateArrayFieldsStartingFrom(e,t,`change`)},this.replaceFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>e.map((e,r)=>r===t?n:e),R(r,{dontValidate:!0})),_s(this).bumpArrayVersion(e),(r?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.removeFieldValue=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null;if(this.setFieldValue(e,e=>e.filter((e,n)=>n!==t),R(n,{dontValidate:!0})),_s(this).handleArrayRemove(e,t),i!==null){let t=`${e}[${i}]`;this.deleteField(t)}(n?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.swapFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=e[t],i=e[n];return Go(Go(e,`${t}`,i),`${n}`,r)},R(r,{dontValidate:!0})),_s(this).handleArraySwap(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.moveFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=[...e];return r.splice(n,0,r.splice(t,1)[0]),r},R(r,{dontValidate:!0})),_s(this).handleArrayMove(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.clearFieldValues=(e,t)=>{let n=this.getFieldValue(e),r=Array.isArray(n)?Math.max(n.length-1,0):null;if(this.setFieldValue(e,[],R(t,{dontValidate:!0})),_s(this).bumpArrayVersion(e),r!==null)for(let t=0;t<=r;t++){let n=`${e}[${t}]`;this.deleteField(n)}(t?.dontValidate??!1)||this.validateField(e,`change`)},this.resetField=e=>{this.baseStore.setState(t=>{let n=this.getFieldInfo(e).instance?.options.defaultValue,r=Wo(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:B},values:i===void 0?t.values:Go(t.values,e,i)}})},this.setErrorMap=e=>{I(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(ns(t)){let{formError:e,fieldErrors:r}=bs(t);for(let e of Object.keys(this.fieldInfo))this.getFieldMeta(e)&&this.setFieldMeta(e,t=>({...t,errorMap:{...t.errorMap,[n]:r?.[e]},errorSourceMap:{...t.errorSourceMap,[n]:`form`}}));this.baseStore.setState(t=>({...t,errorMap:{...t.errorMap,[n]:e}}))}else this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[n]:t}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((e,[t,n])=>(Object.keys(n).length&&n.errors.length&&(e[t]={errors:n.errors,errorMap:n.errorMap}),e),{})}),this.parseValuesWithSchema=e=>hs.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>hs.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??ls(),this._devtoolsSubmissionOverride=!1;let t=vs({...e?.defaultState,values:e?.defaultValues??e?.defaultState?.values});if(e?.transform){t=e.transform({state:t}).state;for(let e of Object.keys(t.errorMap)){let n=t.errorMap[e];if(!(n===void 0||!ns(n)))for(let r of Object.keys(n.fields)){let i=n.fields[r];if(i===void 0)continue;let a=t.fieldMetaBase[r];t.fieldMetaBase[r]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...a??{},errorSourceMap:{...a?.errorSourceMap??{},onChange:`form`},errorMap:{...a?.errorMap??{},[e]:i}}}}}this.baseStore=zo(t);let n;this.fieldMetaDerived=zo(e=>{let t=this.baseStore.get(),r=0,i={};for(let a of Object.keys(t.fieldMetaBase)){let o=t.fieldMetaBase[a],s=n?.fieldMetaBase[a],c=e?.[a],l=Wo(t.values,a),u=c?.errors;if(!s||o.errorMap!==s.errorMap){u=Object.values(o.errorMap??{}).filter(e=>e!==void 0);let e=this.getFieldInfo(a)?.instance;(!e||!e.options.disableErrorFlat)&&(u=u.flat(1))}let d=!$o(u),f=!o.isDirty,p=rs(l,this.getFieldInfo(a)?.instance?.options.defaultValue??Wo(this.options.defaultValues,a));if(c&&c.isPristine===f&&c.isValid===d&&c.isDefaultValue===p&&c.errors===u&&o===s){i[a]=c,r++;continue}i[a]={...o,errors:u??[],isPristine:f,isValid:d,isDefaultValue:p}}return Object.keys(t.fieldMetaBase).length?e&&r===Object.keys(t.fieldMetaBase).length?e:(n=this.baseStore.get(),i):i}),this.formGroupMetaDerived=zo(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),r={};for(let i of this.formGroupApis){let a=i.name,o=t.formGroupStateBase[a]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},s=n[a],c=!1,l=!0,u=!1,d=!1,f=!0,p=!1;for(let e in n){if(e===a||!fs(a,e))continue;let t=n[e];t&&(t.isValidating&&(c=!0),t.isValid||(l=!1),t.isTouched&&(u=!0),t.isBlurred&&(d=!0),t.isDefaultValue||(f=!1),t.isDirty&&(p=!0))}let m=!p,h=!!c||o.isValidating,g=s?.errorMap??{},_=s?.errorSourceMap??{},v=!!(g.onMount||Object.entries(n).some(([e,t])=>t&&e!==a&&fs(a,e)&&t.errorMap.onMount)),y=e?.[a],b=y?.errors??[];(!y||y.__srcErrorMap!==g)&&(b=Object.values(g).reduce((e,t)=>{if(t===void 0)return e;if(t&&typeof t==`object`&&`fields`in t){let n=t.group;return n!==void 0&&e.push(n),e}return e.push(t),e},[]));let x=b.length===0,S=l&&x,C=i.options.canSubmitWhenInvalid??!1,ee=o.submissionAttempts===0&&!u&&!v||!h&&!o.isSubmitting&&S||C;if(y&&y.errorMap===g&&y.errorSourceMap===_&&y.errors===b&&y.isFieldsValidating===c&&y.isFieldsValid===l&&y.isGroupValid===x&&y.isValid===S&&y.canSubmit===ee&&y.isTouched===u&&y.isBlurred===d&&y.isPristine===m&&y.isDefaultValue===f&&y.isDirty===p&&y.isValidating===h&&y.isSubmitting===o.isSubmitting&&y.isSubmitted===o.isSubmitted&&y.submissionAttempts===o.submissionAttempts&&y.isSubmitSuccessful===o.isSubmitSuccessful){r[a]=y;continue}let te={...o,errorMap:g,errorSourceMap:_,_arrayVersion:s?._arrayVersion??0,isTouched:u,isBlurred:d,isDirty:p,isPristine:m,isDefaultValue:f,isValid:S,errors:b,isValidating:h,isFieldsValidating:c,isFieldsValid:l,isGroupValid:x,canSubmit:ee};Object.defineProperty(te,"__srcErrorMap",{value:g,enumerable:!1,configurable:!0}),r[a]=te}return r});let r;this.store=zo(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),i=Object.values(n).filter(Boolean),a=i.some(e=>e.isValidating),o=i.every(e=>e.isValid),s=i.some(e=>e.isTouched),c=i.some(e=>e.isBlurred),l=i.every(e=>e.isDefaultValue),u=s&&t.errorMap?.onMount,d=i.some(e=>e.isDirty),f=!d,p=!!(t.errorMap?.onMount||i.some(e=>e?.errorMap?.onMount)),m=!!a,h=e?.errors??[];(!r||t.errorMap!==r.errorMap)&&(h=Object.values(t.errorMap).reduce((e,t)=>t===void 0?e:t&&ns(t)?(e.push(t.form),e):(e.push(t),e),[]));let g=h.length===0,_=o&&g,v=this.options.canSubmitWhenInvalid??!1,y=t.submissionAttempts===0&&!s&&!p||!m&&!t.isSubmitting&&_||v,b=t.errorMap;if(u&&(h=h.filter(e=>e!==t.errorMap.onMount),b=Object.assign(b,{onMount:void 0})),e&&r&&e.errorMap===b&&e.fieldMeta===this.fieldMetaDerived.state&&e.errors===h&&e.isFieldsValidating===a&&e.isFieldsValid===o&&e.isFormValid===g&&e.isValid===_&&e.canSubmit===y&&e.isTouched===s&&e.isBlurred===c&&e.isPristine===f&&e.isDefaultValue===l&&e.isDirty===d&&rs(r,t))return e;let x={...t,errorMap:b,fieldMeta:this.fieldMetaDerived.state,errors:h,isFieldsValidating:a,isFieldsValid:o,isFormValid:g,isValid:_,canSubmit:y,isTouched:s,isBlurred:c,isPristine:f,isDefaultValue:l,isDirty:d};return r=this.baseStore.get(),x}),this.handleSubmit=this.handleSubmit.bind(this),this.update(e||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(e){return gs(e.validate)?hs[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function bs(e){return e?ns(e)?{formError:bs(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function xs(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 Ss=class e{constructor(t){this.options={},this.mount=()=>{this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});let e=this.getInfo();e.instance=this,this.update(this.options);let{onMount:t}=this.options.validators||{};if(t){let e=this.runValidator({validate:t,value:{value:this.state.value,fieldApi:this,validationSource:`field`},type:`validate`});e&&this.setMeta(t=>({...t,errorMap:{...t?.errorMap,onMount:e},errorSourceMap:{...t?.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,n]of Object.entries(e.validationMetaMap))n?.lastAbortController.abort(),e.validationMetaMap[t]=void 0;this.form.baseStore.setState(e=>({...e,fieldMetaBase:{...e.fieldMetaBase,[this.name]:{...B,isTouched:e.fieldMetaBase[this.name]?.isTouched??B.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??B.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??B.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&&this.options.defaultValue!==void 0&&(rs(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)=>{this.form.setFieldValue(this.name,e,R(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,R(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,R(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,R(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,R(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,R(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,R(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,R(e,{dontRunListeners:!0})),e?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=t=>{let n=Object.values(this.form.fieldInfo),r=[];for(let i of n){if(!i.instance||!(i.instance instanceof e))continue;let{onChangeListenTo:n,onBlurListenTo:a}=i.instance.options.validators||{};t===`change`&&n?.includes(this.name)&&r.push(i.instance),t===`blur`&&a?.includes(this.name)&&r.push(i.instance)}return r},this.validateSync=(e,t)=>{let n=es(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||z}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=es(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||z});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;I(()=>{let e=(e,n)=>{let r=ws(n.cause),a=n.validate?Cs(e.runValidator({validate:n.validate,value:{value:e.store.state.value,validationSource:`field`,fieldApi:e},type:`validate`})):void 0,o=t[r],{newErrorValue:s,newSource:c}=as({formLevelError:o,fieldLevelError:a});e.state.meta.errorMap?.[r]!==s&&e.setMeta(e=>({...e,errorMap:{...e.errorMap,[r]:s},errorSourceMap:{...e.errorSourceMap,[r]:c}})),s&&(i=!0)};for(let t of n)e(this,t);for(let t of r)t.validate&&e(t.field,t)});let a=ws(`submit`);return this.state.meta.errorMap?.[a]&&e!==`submit`&&!i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[a]:void 0},errorSourceMap:{...e.errorSourceMap,[a]:void 0}})),{hasErrored:i}},this.validateAsync=async(e,t)=>{let n=ts(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||z}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=ts(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||z});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),a=[],o=[],s=n.some(e=>e.validate),c=Array.from(new Set(i.filter(e=>e.validate).map(e=>e.field)));I(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=ws(t.cause),a=e.getInfo();a.validationMetaMap[i]?.lastAbortController.abort();let o=new AbortController;a.validationMetaMap[i]={lastAbortController:o},n.push(new Promise(async n=>{let a;try{a=await new Promise((n,r)=>{e.timeoutIds.validations[t.cause]&&(clearTimeout(e.timeoutIds.validations[t.cause]),e.endValidation()),e.timeoutIds.validations[t.cause]=setTimeout(async()=>{if(o.signal.aborted)return n(void 0);try{n(await this.runValidator({validate:t.validate,value:{value:e.store.state.value,fieldApi:e,signal:o.signal,validationSource:`field`},type:`validateAsync`}))}catch(e){r(e)}},t.debounceMs)})}catch(e){a=e}if(o.signal.aborted)return n(void 0);let s=Cs(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=as({formLevelError:c,fieldLevelError:s});if(e.getInfo().instance!==e)return n(void 0);e.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:l},errorSourceMap:{...e.errorSourceMap,[i]:u}})),n(l)}))};for(let e of n)e.validate&&l(this,e,a);for(let e of i)e.validate&&l(e.field,e,o);let u=[];return(a.length||o.length)&&(u=await Promise.all(a),await Promise.all(o)),I(()=>{s&&this.endValidation();for(let e of c)e.endValidation()}),u.filter(Boolean)},this.validate=(e,t)=>{if(!this.state.meta.isTouched)return[];let n=t?.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(e=>this.name.startsWith(e.name)),r=(t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e)).fieldsErrorMap[this.name]??{};if(!t?.skipFormValidation)for(let t of n){if(t.state.meta.submissionAttempts===0)continue;let{fieldsErrorMap:n}=this.form.validateSync(e,{group:t,dontUpdateFormErrorMap:!0,filterFieldNames:e=>fs(t.name,e)});r={...r,...n[this.name]??{}}}let{hasErrored:i}=this.validateSync(e,r),a=new WeakMap;for(let t of n){let{hasErrored:n}=t.validateSync(e,{},{skipRelatedFieldValidation:!0});a.set(t,n)}if(i&&!this.options.asyncAlways){this.getInfo().validationMetaMap[ws(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[ws(e)]?.lastAbortController.abort(),t.push(r.state.meta.errors);return[...this.state.meta.errors,...t.flat()]}let o=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),s=this.validateAsync(e,o),c=[];for(let t of n)a.get(t)&&!t.options.asyncAlways||c.push(t.validateAsync(e,o,{skipRelatedFieldValidation:!0}));return c.length===0?s:Promise.all([s,...c]).then(e=>e.flat())},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=>hs.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>hs.validateAsync({value:this.state.value,validationSource:`field`},e),this.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})},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});for(let e of this.form.formGroupApis)fs(e.name,this.name)&&e.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,fieldApi:this})},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=zo(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...B,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!rs(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}})}get state(){return this.store.state}runValidator(e){return gs(e.validate)?hs[e.type](e.value,e.validate):e.validate(e.value)}startValidation(){this.setMeta(e=>{let t=e._pendingValidationsCount+1;return{...e,_pendingValidationsCount:t,isValidating:t>0&&!e.isValidating||e.isValidating}})}endValidation(){this.setMeta(e=>{let t=Math.max(0,e._pendingValidationsCount-1);return{...e,_pendingValidationsCount:t,isValidating:t===0&&e.isValidating?!1:e.isValidating}})}};function Cs(e){if(e)return e}function ws(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 Ts(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function Es(e){return{...B,...e,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}var Ds=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??Ts({});return{...t,formGroupStateBase:{...t.formGroupStateBase,[this.name]:e(n)}}})},this._lastDistributedFieldNames={},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(rs(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,{...B,...this.options.defaultMeta})},this.mount=()=>{this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:e.formGroupStateBase[this.name]??Ts({...this.options.defaultState})}}));let{onMount:e}=this.options.validators||{};if(e){let t=this.runValidator({validate:e,value:{value:this.state.value,groupApi:this,validationSource:`form`},type:`validate`}),n=t,r;ks(t)&&(n=t.group,r=t.fields);let i=Os(n);i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,onMount:i},errorSourceMap:{...e.errorSourceMap,onMount:`field`}})),this.distributeFieldErrors(`onMount`,r)}return this.options.listeners?.onMount?.({value:this.state.value,groupApi: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);if(this.fieldInfo.instance===this){for(let[e,t]of Object.entries(this.fieldInfo.validationMetaMap))t?.lastAbortController.abort(),this.fieldInfo.validationMetaMap[e]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:Ts({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,R(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.fieldInfo,this.getRelatedFields=()=>{let e=Object.values(this.form.fieldInfo),t=[];for(let n of e)n.instance&&n.instance instanceof Ss&&n.instance.name.startsWith(this.name)&&t.push(n.instance);return t},this.getRelatedFieldMetasDerived=()=>{let e=Object.entries(this.form.fieldMetaDerived.state),t=[];for(let[n,r]of e)n!==this.name&&fs(this.name,n)&&t.push({...r,name:n});return t},this.buildChildFieldName=e=>e===``?this.name:e.startsWith(`[`)?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,t)=>{let n=this._lastDistributedFieldNames[e]??new Set,r=new Set;if(t)for(let[e,n]of Object.entries(t))n!=null&&n!==!1&&r.add(this.buildChildFieldName(e));let i=new Set([...n,...r]),a=!1;for(let n of i){let r=n.startsWith(this.name+`[`)?n.slice(this.name.length):n.slice(this.name.length+1),i=t?.[r],o=this.form.getFieldMeta(n);if(!o&&!i)continue;let s=o?.errorMap[e],{newErrorValue:c,newSource:l}=is({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=B)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=es(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||z}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=es(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||z});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;I(()=>{let t=(t,r)=>{let i=js(r.cause),a=t===this,s;r.validate&&(s=t.runValidator({validate:r.validate,value:{value:t.store.state.value,validationSource:a?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validate`}));let c=s,l;a&&ks(s)&&(c=s.group,l=s.fields);let u=Os(c),d=n[i],{newErrorValue:f,newSource:p}=as({formLevelError:d,fieldLevelError:u});t.state.meta.errorMap?.[i]!==f&&t.setMeta(e=>({...e,errorMap:{...e.errorMap,[i]:f},errorSourceMap:{...e.errorSourceMap,[i]:p}})),f&&(o=!0),a&&this.distributeFieldErrors(i,l)&&(o=!0)};for(let e of i)t(this,e);for(let e of a)e.validate&&t(e.field,e)});let s=js(`submit`);return this.state.meta.errorMap?.[s]&&t!==`submit`&&!o&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[s]:void 0},errorSourceMap:{...e.errorSourceMap,[s]:void 0}})),{hasErrored:o}},this.validateAsync=async(t,n,r={})=>{let i=ts(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||z}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=ts(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||z});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),c=[],l=[],u=i.some(e=>e.validate)||s.some(e=>e.validate);if(u){this.state.meta.isValidating||this.setMeta(e=>({...e,isValidating:!0}));for(let e of o)e.setMeta(e=>({...e,isValidating:!0}))}let d=(t,n,r)=>{let i=js(n.cause),o=t.getInfo();o.validationMetaMap[i]?.lastAbortController.abort();let s=new AbortController;o.validationMetaMap[i]={lastAbortController:s};let c=t===this;r.push(new Promise(async r=>{let o;try{o=await new Promise((r,i)=>{t.timeoutIds.validations[n.cause]&&clearTimeout(t.timeoutIds.validations[n.cause]),t.timeoutIds.validations[n.cause]=setTimeout(async()=>{if(s.signal.aborted)return r(void 0);try{r(await this.runValidator({validate:n.validate,value:{value:t.store.state.value,signal:s.signal,validationSource:c?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validateAsync`}))}catch(e){i(e)}},n.debounceMs)})}catch(e){o=e}if(s.signal.aborted)return r(void 0);let l=o,u;c&&ks(o)&&(l=o.group,u=o.fields);let d=Os(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=as({formLevelError:f,fieldLevelError:d});if(t.getInfo().instance!==t)return r(void 0);t.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:p},errorSourceMap:{...e.errorSourceMap,[i]:m}})),c&&this.distributeFieldErrors(i,u),r(p)}))};for(let e of i)e.validate&&d(this,e,c);for(let e of s)e.validate&&d(e.field,e,l);let f=[];if((c.length||l.length)&&(f=await Promise.all(c),await Promise.all(l)),u){this.setMeta(e=>({...e,isValidating:!1}));for(let e of o)e.setMeta(e=>({...e,isValidating:!1}))}return f.filter(Boolean)},this.validateAllFields=async e=>{let t=[];return I(()=>{Object.values(this.getRelatedFields()).forEach(n=>{t.push(Promise.resolve().then(()=>n.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=(e,t,n)=>this.form.validateArrayFieldsStartingFrom(e,t,n),this.validateField=(e,t)=>this.form.validateField(e,t),this.getFieldValue=e=>this.form.getFieldValue(e),this.getFieldMeta=e=>this.form.getFieldMeta(e),this.setFieldMeta=(e,t)=>this.form.setFieldMeta(e,t),this.setFieldValue=(e,t)=>this.form.setFieldValue(e,t),this.deleteField=e=>this.form.deleteField(e),this.pushFieldValue=(e,t)=>this.form.pushFieldValue(e,t),this.insertFieldValue=(e,t,n)=>this.form.insertFieldValue(e,t,n),this.replaceFieldValue=(e,t,n)=>this.form.replaceFieldValue(e,t,n),this.swapFieldValues=(e,t,n)=>this.form.swapFieldValues(e,t,n),this.moveFieldValues=(e,t,n)=>this.form.moveFieldValues(e,t,n),this.clearFieldValues=e=>this.form.clearFieldValues(e),this.resetField=e=>this.form.resetField(e),this.removeFieldValue=(e,t)=>this.form.removeFieldValue(e,t),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(e=>e.state.meta.isValid),this.validate=(e,t)=>{let{fieldsErrorMap:n}=t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>fs(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[js(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>fs(this.name,e)});return this.validateAsync(e,i,{skipRelatedFieldValidation:t?.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this})},e)):this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi: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,groupApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,groupApi:this})},this._handleSubmit=async e=>{this.setFormGroupState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),I(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.state.meta.isTouched||e.setMeta(e=>({...e,isTouched:!0}))})});let t=e??this.options.onSubmitMeta;this.setFormGroupState(e=>({...e,isSubmitting:!0}));let n=()=>{this.setFormGroupState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.areRelatedFieldsValid()){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}if(await this.validate(`submit`,{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}I(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.options.listeners?.onGroupSubmit?.({value:e.state.value,fieldApi:e})})}),this.options.listeners?.onSubmit?.({groupApi:this,value:this.state.value});try{await this.options.onGroupSubmit?.({value:this.state.value,groupApi:this,meta:t}),I(()=>{this.setFormGroupState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),n()})}catch(e){throw this.setFormGroupState(e=>({...e,isSubmitSuccessful:!1})),n(),e}},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=zo(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??Es(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!rs(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(e){if(gs(e.validate)){let t=hs[e.type](e.value,e.validate);return e.type===`validate`?As(t):t.then(As)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function Os(e){if(e)return e}function ks(e){return!!e&&typeof e==`object`&&`fields`in e}function As(e){if(!e||typeof e!=`object`||!(`form`in e)&&!(`fields`in e))return e;let{form:t,fields:n,...r}=e;return{...r,group:t,fields:n}}function js(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 Ms(e,t){if(!t)return;let n=Object.assign({},e,{state:ds(e.state)});t(n),n.fieldInfo!==e.fieldInfo&&(e.fieldInfo=n.fieldInfo),n.options!==e.options&&(e.options=n.options);let r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((t,r)=>(e.state[r]!==n.state[r]&&(t[r]=n.state[r]),t),{});return I(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}var Ns=e(zt(),1);function Ps(e,t){return e===t}function V(e,t=e=>e,n){let r=n?.compare??Ps,i=(0,k.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,k.useCallback)(()=>e.get(),[e]);return(0,Ns.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var Fs=typeof window<`u`?k.useLayoutEffect:k.useEffect;function Is(e){let[t,n]=(0,k.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,k.useState)(()=>new Ss({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new Ss({...e}),i(a),n({form:e.form,name:e.name}));let o=V(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=V(a.store,e=>e.meta.isTouched),c=V(a.store,e=>e.meta.isBlurred),l=V(a.store,e=>e.meta.isDirty),u=V(a.store,e=>e.meta.errorMap),d=V(a.store,e=>e.meta.errorSourceMap),f=V(a.store,e=>e.meta.isValidating),p=(0,k.useMemo)(()=>({...a,get state(){return{value:e.mode===`array`?a.state.value:o,get meta(){return{...a.state.meta,isTouched:s,isBlurred:c,isDirty:l,errorMap:u,errorSourceMap:d,isValidating:f}}}}}),[a,e.mode,o,s,c,l,u,d,f]);return Fs(a.mount,[a]),Fs(()=>{a.update(e)}),p}var Ls=(({children:e,...t})=>{let n=Is(t),r=(0,k.useMemo)(()=>Uo(e,n),[e,n]);return(0,A.jsx)(A.Fragment,{children:r})});function Rs(){return(0,k.useState)(()=>ls())[0]}var zs=k,Bs=`19.2.8`.split(`.`)[0]===`17`?Rs:zs.useId;function Vs(e){let[t,n]=(0,k.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,k.useState)(()=>new Ds({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new Ds({...e})),n({form:e.form,name:e.name}));let a=V(r.store,e=>e.value),o=V(r.store,e=>e.meta.isTouched),s=V(r.store,e=>e.meta.isBlurred),c=V(r.store,e=>e.meta.isDirty),l=V(r.store,e=>e.meta.errorMap),u=V(r.store,e=>e.meta.errorSourceMap),d=V(r.store,e=>e.meta.isValidating),f=V(r.store,e=>e.meta.isSubmitting),p=V(r.store,e=>e.meta.isSubmitted),m=V(r.store,e=>e.meta.submissionAttempts),h=V(r.store,e=>e.meta.isSubmitSuccessful),g=V(r.store,e=>e.meta.canSubmit),_=V(r.store,e=>e.meta.isValid),v=V(r.store,e=>e.meta.isFieldsValid),y=V(r.store,e=>e.meta.isFieldsValidating),b=V(r.store,e=>e.meta.isGroupValid),x=(0,k.useMemo)(()=>({...r,handleSubmit:((...e)=>r._handleSubmit(...e)),get state(){return{...r.state,value:a,get meta(){return{...r.state.meta,isTouched:o,isBlurred:s,isDirty:c,errorMap:l,errorSourceMap:u,isValidating:d,isSubmitting:f,isSubmitted:p,submissionAttempts:m,isSubmitSuccessful:h,canSubmit:g,isValid:_,isFieldsValid:v,isFieldsValidating:y,isGroupValid:b}}}}}),[r,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b]);return Fs(r.mount,[r]),Fs(()=>{r.update(e)}),x}var Hs=(({children:e,...t})=>{let n=Vs(t),r=(0,k.useMemo)(()=>Uo(e,n),[e,n]);return(0,A.jsx)(A.Fragment,{children:r})});function Us({form:e,selector:t=e=>e,children:n}){let r=V(e.store,t);return(0,A.jsx)(A.Fragment,{children:Uo(n,r)})}function Ws(e){let t=Bs(),[n,r]=(0,k.useState)(e?.formId),[i,a]=(0,k.useState)(()=>new ys({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new ys({...e,formId:n})),r(n)}let o=(0,k.useMemo)(()=>{let e={...i,handleSubmit:((...e)=>i._handleSubmit(...e)),get formId(){return i._formId},get state(){return i.store.state}};return e.Field=function(e){return(0,A.jsx)(Ls,{...e,form:i})},e.FormGroup=function(e){return(0,A.jsx)(Hs,{...e,form:i})},e.Subscribe=function(e){return(0,A.jsx)(Us,{form:i,selector:e.selector,children:e.children})},e},[i]);Fs(i.mount,[]),Fs(()=>{i.update(e)});let s=(0,k.useRef)(!1);return Fs(()=>{s.current&&e?.transform&&Ms(i,e.transform)},[i,e?.transform]),Fs(()=>{s.current=!0}),o}var Gs;function H(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Ks=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},qs=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Gs=globalThis).__zod_globalConfig??(Gs.__zod_globalConfig={});var Js=globalThis.__zod_globalConfig;function Ys(e){return e&&Object.assign(Js,e),Js}function Xs(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Zs(e,t){return typeof t==`bigint`?t.toString():t}function Qs(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function $s(e){return e==null}function ec(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}var tc=Symbol(`evaluating`);function U(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==tc)return r===void 0&&(r=tc,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function nc(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function rc(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ic(e){return JSON.stringify(e)}function ac(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var oc=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function sc(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var cc=Qs(()=>{if(Js.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function lc(e){if(sc(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return sc(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function uc(e){return lc(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var dc=new Set([`string`,`number`,`symbol`]);function fc(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function pc(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function W(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function mc(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function hc(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return pc(e,rc(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return nc(this,`shape`,e),e},checks:[]}))}function gc(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return pc(e,rc(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return nc(this,`shape`,r),r},checks:[]}))}function _c(e,t){if(!lc(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return pc(e,rc(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return nc(this,`shape`,n),n}}))}function vc(e,t){if(!lc(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return pc(e,rc(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return nc(this,`shape`,n),n}}))}function yc(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return pc(e,rc(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return nc(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function bc(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return pc(t,rc(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return nc(this,`shape`,i),i},checks:[]}))}function xc(e,t,n){return pc(t,rc(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return nc(this,`shape`,i),i}}))}function Sc(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Cc(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function wc(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Tc(e){return typeof e==`string`?e:e?.message}function Ec(e,t,n){let r=e.message?e.message:Tc(e.inst?._zod.def?.error?.(e))??Tc(t?.error?.(e))??Tc(n.customError?.(e))??Tc(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Dc(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Oc(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var kc=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Zs,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ac=H(`$ZodError`,kc),jc=H(`$ZodError`,kc,{Parent:Error});function Mc(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Nc(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var Pc=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Ks;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ec(e,a,Ys())));throw oc(t,i?.callee),t}return o.value},Fc=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ec(e,a,Ys())));throw oc(t,i?.callee),t}return o.value},Ic=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Ks;return a.issues.length?{success:!1,error:new(e??Ac)(a.issues.map(e=>Ec(e,i,Ys())))}:{success:!0,data:a.value}},Lc=Ic(jc),Rc=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Ec(e,i,Ys())))}:{success:!0,data:a.value}},zc=Rc(jc),Bc=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Pc(e)(t,n,i)},Vc=e=>(t,n,r)=>Pc(e)(t,n,r),Hc=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Fc(e)(t,n,i)},Uc=e=>async(t,n,r)=>Fc(e)(t,n,r),Wc=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ic(e)(t,n,i)},Gc=e=>(t,n,r)=>Ic(e)(t,n,r),Kc=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Rc(e)(t,n,i)},qc=e=>async(t,n,r)=>Rc(e)(t,n,r),Jc=/^[cC][0-9a-z]{6,}$/,Yc=/^[0-9a-z]+$/,Xc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Zc=/^[0-9a-vA-V]{20}$/,Qc=/^[A-Za-z0-9]{27}$/,$c=/^[a-zA-Z0-9_-]{21}$/,el=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,tl=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,nl=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,rl=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,il=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function al(){return new RegExp(il,`u`)}var ol=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,sl=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,cl=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ll=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ul=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dl=/^[A-Za-z0-9_-]*$/,fl=/^https?$/,pl=/^\+[1-9]\d{6,14}$/,ml=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,hl=RegExp(`^${ml}$`);function gl(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function _l(e){return RegExp(`^${gl(e)}$`)}function vl(e){let t=gl({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${ml}T(?:${r})$`)}var yl=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},bl=/^[^A-Z]*$/,xl=/^[^a-z]*$/,G=H(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Sl=H(`$ZodCheckMaxLength`,(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!$s(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Dc(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Cl=H(`$ZodCheckMinLength`,(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!$s(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Dc(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),wl=H(`$ZodCheckLengthEquals`,(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!$s(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Dc(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Tl=H(`$ZodCheckStringFormat`,(e,t)=>{var n,r;G.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),El=H(`$ZodCheckRegex`,(e,t)=>{Tl.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Dl=H(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=bl,Tl.init(e,t)}),Ol=H(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=xl,Tl.init(e,t)}),kl=H(`$ZodCheckIncludes`,(e,t)=>{G.init(e,t);let n=fc(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Al=H(`$ZodCheckStartsWith`,(e,t)=>{G.init(e,t);let n=RegExp(`^${fc(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),jl=H(`$ZodCheckEndsWith`,(e,t)=>{G.init(e,t);let n=RegExp(`.*${fc(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Ml=H(`$ZodCheckOverwrite`,(e,t)=>{G.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Nl=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
3
+ See https://nuqs.dev/NUQS-${e}`}function Ui(e){if(e.size===0)return``;let t=[];for(let[n,r]of e.entries()){let e=n.replace(/#/g,`%23`).replace(/&/g,`%26`).replace(/\+/g,`%2B`).replace(/=/g,`%3D`).replace(/\?/g,`%3F`);t.push(`${e}=${Wi(r)}`)}return`?`+t.join(`&`)}function Wi(e){return e.replace(/%/g,`%25`).replace(/\+/g,`%2B`).replace(/ /g,`+`).replace(/#/g,`%23`).replace(/&/g,`%26`).replace(/"/g,`%22`).replace(/'/g,`%27`).replace(/`/g,`%60`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/[\x00-\x1F]/g,e=>encodeURIComponent(e))}var Gi=`2.9.5`,Ki={};function qi(e,t){let n=Symbol.for(`nuqs.${Gi}.${e}`),r=globalThis;if(r[n]!=null)return r[n];let i=Object.isExtensible(r)?r:Ki;return i[n]??=t()}function Ji(e,t,n){let r=qi(e,()=>new WeakMap);return r.has(t)||r.set(t,n()),r.get(t)}var Yi=Ji(`adapter-context`,k.createContext,()=>{let e=(0,k.createContext)({useAdapter(){throw Error(Hi(404))}});return e.displayName=`NuqsAdapterContext`,e});typeof window<`u`&&(window.__NuqsAdapterContext&&window.__NuqsAdapterContext!==Yi&&console.error(Hi(303)),window.__NuqsAdapterContext=Yi);function Xi(e){return({children:t,defaultOptions:n,processUrlSearchParams:r,...i})=>(0,k.createElement)(Yi.Provider,{...i,value:{useAdapter:e,defaultOptions:n,processUrlSearchParams:r}},t)}function Zi(e,t,n){if(t.length===0)return e;let r=n?new URLSearchParams(e):e;for(let n of Array.from(e.keys()))t.includes(n)||r.delete(n);return r}function Qi(){if(typeof window>`u`||!window.GestureEvent)return 50;try{let e=navigator.userAgent?.match(/version\/([\d\.]+) safari/i);return parseFloat(e[1])>=17?120:320}catch{return 320}}function $i(e){return{method:`throttle`,timeMs:e}}var ea=$i(Qi());function ta(e,t,n){if(typeof n==`string`)e.set(t,n);else{e.delete(t);for(let r of n)e.append(t,r);e.has(t)||e.set(t,``)}return e}function na(){let e=new Map;return{on(t,n){let r=e.get(t)||[];return r.push(n),e.set(t,r),()=>this.off(t,n)},off(t,n){let r=e.get(t);r&&e.set(t,r.filter(e=>e!==n))},emit(t,n){e.get(t)?.forEach(e=>e(n))}}}function ra(e,t,n){function r(){e(),n.removeEventListener(`abort`,a)}let i=setTimeout(r,t);function a(){clearTimeout(i),n.removeEventListener(`abort`,a)}n.addEventListener(`abort`,a)}function ia(){let e=Promise;if(Promise.hasOwnProperty(`withResolvers`))return Promise.withResolvers();let t=()=>{},n=()=>{};return{promise:new e((e,r)=>{t=e,n=r}),resolve:t,reject:n}}function aa(e,t){let n=t;for(let t=e.length-1;t>=0;t--){let r=e[t];if(!r)continue;let i=n;n=()=>r(i)}n()}function oa(){return new URLSearchParams(location.search)}var sa=class{updateMap=new Map;options={history:`replace`,scroll:!1,shallow:!0};timeMs=ea.timeMs;transitions=new Set;resolvers=null;controller=null;lastFlushedAt=0;resetQueueOnNextPush=!1;push({key:e,query:t,options:n},r=ea.timeMs){this.resetQueueOnNextPush&&=(this.reset(),!1),P(7,e,t,n),this.updateMap.set(e,t),n.history===`push`&&(this.options.history=`push`),n.scroll&&(this.options.scroll=!0),n.shallow===!1&&(this.options.shallow=!1),n.startTransition&&this.transitions.add(n.startTransition),(!Number.isFinite(this.timeMs)||r>this.timeMs)&&(this.timeMs=r)}getQueuedQuery(e){return this.updateMap.get(e)}getPendingPromise({getSearchParamsSnapshot:e=oa}){return this.resolvers?.promise??Promise.resolve(e())}flush({getSearchParamsSnapshot:e=oa,rateLimitFactor:t=1,...n},r){if(this.controller??=new AbortController,!Number.isFinite(this.timeMs))return P(8),Promise.resolve(e());if(this.resolvers)return this.resolvers.promise;this.resolvers=ia();let i=()=>{this.lastFlushedAt=performance.now();let[t,i]=this.applyPendingUpdates({...n,autoResetQueueOnUpdate:n.autoResetQueueOnUpdate??!0,getSearchParamsSnapshot:e},r);i===null?(this.resolvers.resolve(t),this.resetQueueOnNextPush=!0):this.resolvers.reject(t),this.resolvers=null};return ra(()=>{let e=performance.now()-this.lastFlushedAt,n=this.timeMs,r=t*Math.max(0,n-e);P(9,r,n,t),r===0?i():ra(i,r,this.controller.signal)},0,this.controller.signal),this.resolvers.promise}abort(){return this.controller?.abort(),this.controller=new AbortController,this.resolvers?.resolve(new URLSearchParams),this.resolvers=null,this.reset()}reset(){let e=Array.from(this.updateMap.keys());return P(10,JSON.stringify(Object.fromEntries(this.updateMap))),this.updateMap.clear(),this.transitions.clear(),this.options={history:`replace`,scroll:!1,shallow:!0},this.timeMs=ea.timeMs,e}applyPendingUpdates(e,t){let{updateUrl:n,getSearchParamsSnapshot:r}=e,i=r();if(P(11,this.updateMap.size,i.toString()),this.updateMap.size===0)return[i,null];let a=Array.from(this.updateMap.entries()),o={...this.options},s=Array.from(this.transitions);e.autoResetQueueOnUpdate&&this.reset(),P(12,a,o);for(let[e,t]of a)t===null?i.delete(e):i=ta(i,e,t);if(t)try{i=t(i)}catch(e){return console.error(Hi(502),a.map(([e])=>e).join(),e),this.resetQueueOnNextPush=!0,[i,e]}try{return aa(s,()=>n(i,o)),[i,null]}catch(e){return console.error(Hi(429),a.map(([e])=>e).join(),e),[i,e]}}},ca=qi(`throttle-queue`,()=>new sa),la=class{callback;resolvers=ia();controller=new AbortController;queuedValue=void 0;constructor(e){this.callback=e}abort(){this.controller.abort(),this.queuedValue=void 0}push(e,t){return this.queuedValue=e,this.controller.abort(),this.controller=new AbortController,ra(()=>{let t=this.resolvers;try{P(13,e);let n=this.callback(e);P(14,this.queuedValue),this.queuedValue=void 0,this.resolvers=ia(),n.then(e=>t.resolve(e)).catch(e=>t.reject(e))}catch(e){this.queuedValue=void 0,t.reject(e)}},t,this.controller.signal),this.resolvers.promise}},ua=class{throttleQueue;queues=new Map;queuedQuerySync=na();constructor(e=new sa){this.throttleQueue=e}push(e,t,n,r){if(!Number.isFinite(t)){let e=n.getSearchParamsSnapshot??oa;return Promise.resolve(e())}let i=e.key;if(!this.queues.has(i)){P(15,i);let e=new la(e=>(this.throttleQueue.push(e),this.throttleQueue.flush(n,r).finally(()=>{this.queues.get(e.key)?.queuedValue===void 0&&(P(16,e.key),this.queues.delete(e.key)),this.queuedQuerySync.emit(e.key)})));this.queues.set(i,e)}P(17,e);let a=this.queues.get(i).push(e,t);return this.queuedQuerySync.emit(i),a}abort(e){let t=this.queues.get(e);return t?(P(18,e,t.queuedValue?.query),this.queues.delete(e),t.abort(),this.queuedQuerySync.emit(e),e=>(e.then(t.resolvers.resolve,t.resolvers.reject),e)):e=>e}abortAll(){for(let[e,t]of this.queues.entries())P(18,e,t.queuedValue?.query),t.abort(),t.resolvers.resolve(new URLSearchParams),this.queuedQuerySync.emit(e);this.queues.clear()}getQueuedQuery(e){let t=this.queues.get(e)?.queuedValue?.query;return t===void 0?this.throttleQueue.getQueuedQuery(e):t}};qi(`debounce-controller`,()=>new ua(ca));function da(e){return qi(`history-emitter.${e}`,()=>na())}var fa=`__nuqs__`,pa=da(`react`);function ma(e){return function(t,n){let r=new URL(location.href);r.search=Ui(t),P(20,`react`,r),e&&n.shallow===!1?(n.history===`push`?location.assign:location.replace).call(location,r):(n.history===`push`?history.pushState:history.replaceState).call(history,history.state,fa,r),pa.emit(`update`,t),n.scroll===!0&&window.scrollTo({top:0})}}var ha=(0,k.createContext)({fullPageNavigationOnShallowFalseUpdates:!1}),ga=new URLSearchParams;function _a(){return ga}function va(e){return pa.on(`update`,e),window.addEventListener(`popstate`,e),()=>{pa.off(`update`,e),window.removeEventListener(`popstate`,e)}}function ya(e){let{fullPageNavigationOnShallowFalseUpdates:t}=(0,k.useContext)(ha),n=(0,k.useRef)(null);return{searchParams:(0,k.useSyncExternalStore)(va,()=>{let t=Zi(new URLSearchParams(location.search),e,!1),r=t.toString();return n.current?.key===r?n.current.search:(n.current={key:r,search:t},t)},_a),updateUrl:(0,k.useMemo)(()=>ma(t),[t])}}var ba=Xi(ya);function xa({children:e,fullPageNavigationOnShallowFalseUpdates:t=!1,...n}){return(0,k.createElement)(ha.Provider,{value:{fullPageNavigationOnShallowFalseUpdates:t}},(0,k.createElement)(ba,{...n,children:e}))}var Sa=Lt();function Ca(e){let t=typeof e.run==`string`&&e.run.length>0?e.run:void 0,n=typeof e.flow==`string`&&e.flow.length>0?e.flow:void 0,r=e.follow===!1||e.follow===`false`?!1:void 0;return{...t===void 0?{}:{run:t},...n===void 0?{}:{flow:n},...r===void 0?{}:{follow:r}}}function wa(){let e=He({strict:!1}),t=T();return{selectedRunId:typeof e.run==`string`?e.run:null,selectedFlowId:typeof e.flow==`string`?e.flow:null,follow:e.follow!==!1,setSelectedRun:(0,k.useCallback)(e=>{t({to:`.`,search:t=>({...t,run:e??void 0}),replace:!0})},[t]),setSelectedFlow:(0,k.useCallback)(e=>{t({to:`.`,search:t=>({...t,flow:e??void 0}),replace:!0})},[t]),setFollow:(0,k.useCallback)(e=>{t({to:`.`,search:t=>({...t,follow:e?void 0:!1}),replace:!0})},[t])}}function Ta(e){let t=typeof e.flow==`string`&&e.flow.length>0?e.flow:void 0;return{...t===void 0?{}:{flow:t}}}function Ea(){let e=He({strict:!1}),t=T();return{selectedFlowId:typeof e.flow==`string`?e.flow:null,setSelectedFlow:(0,k.useCallback)(e=>{t({to:`.`,search:t=>({...t,flow:e??void 0}),replace:!0})},[t])}}var Da={"15m":9e5,"1h":36e5,"24h":864e5,"7d":6048e5};function Oa(e){return e===`15m`||e===`1h`||e===`24h`||e===`7d`?e:`1h`}function ka(e){return e.error!=null&&e.error.length>0}function Aa(e,t){return e.length===0?0:e.length===1?e[0]:e[Math.min(e.length-1,Math.max(0,Math.ceil(t*e.length)-1))]}function ja(e,t,n){let r=t-Math.max(0,n);return e.filter(e=>e.startedAt>=r&&e.startedAt<=t)}function Ma(e,t,n){let r=ja(e,t,n);if(r.length===0)return{kind:`empty`};let i=r.map(e=>e.durationMs).sort((e,t)=>e-t),a=r.filter(ka).length,o=r.length;return{kind:`summary`,total:o,errors:a,errorRate:a/o,p50Ms:Aa(i,.5),p95Ms:Aa(i,.95),p99Ms:Aa(i,.99),from:t-Math.max(0,n),to:t,windowMs:n}}function Na(e){let t=typeof e.run==`string`&&e.run.length>0?e.run:void 0,n=Oa(e.window),r=typeof e.error==`string`&&e.error.length>0?e.error:void 0,i=typeof e.q==`string`&&e.q.length>0?e.q:void 0,a=e.view===`query`?`query`:void 0;return{...t===void 0?{}:{run:t},...n===`1h`?{}:{window:n},...r===void 0?{}:{error:r},...i===void 0?{}:{q:i},...a===void 0?{}:{view:a}}}function Pa(){let e=He({strict:!1}),t=T(),n=typeof e.run==`string`?e.run:null,r=Oa(e.window),i=typeof e.error==`string`?e.error:null,a=typeof e.q==`string`?e.q:``,o=e.view===`query`?`query`:`metrics`,s=(0,k.useCallback)(e=>{t({to:`.`,search:t=>Na({...t,...e}),replace:!0})},[t]);return{selectedRunId:n,window:r,selectedErrorKey:i,query:a,view:o,setSelectedRun:(0,k.useCallback)(e=>{s({run:e??void 0})},[s]),setWindow:(0,k.useCallback)(e=>{s({window:e})},[s]),setSelectedError:(0,k.useCallback)((e,t)=>{s({error:e??void 0,...t===void 0?{}:{run:t??void 0}})},[s]),setQuery:(0,k.useCallback)(e=>{s({q:e.length>0?e:void 0})},[s]),setView:(0,k.useCallback)(e=>{s({view:e===`metrics`?void 0:e})},[s])}}function Fa(e){let t=typeof e.q==`string`&&e.q.length>0?e.q:void 0,n=typeof e.name==`string`&&e.name.length>0?e.name:void 0,r=e.action===`set`||e.action===`rotate`||e.action===`rotate-master`||e.action===`create`?e.action:void 0;return{...t===void 0?{}:{q:t},...n===void 0?{}:{name:n},...r===void 0?{}:{action:r}}}function Ia(){let e=He({strict:!1}),t=T(),n=typeof e.q==`string`?e.q:``,r=typeof e.name==`string`?e.name:null,i=e.action??null,a=(0,k.useCallback)(e=>{t({to:`.`,search:t=>Fa({...t,...e}),replace:!0})},[t]);return{query:n,selectedName:r,action:i,setQuery:(0,k.useCallback)(e=>{a({q:e.length>0?e:void 0})},[a]),setSelectedName:(0,k.useCallback)(e=>{a({name:e??void 0,action:void 0})},[a]),setAction:(0,k.useCallback)(e=>{a({action:e??void 0})},[a])}}function La(e){let t=typeof e.q==`string`&&e.q.length>0?e.q:void 0,n=typeof e.key==`string`&&e.key.length>0?e.key:void 0,r=e.action===`create`||e.action===`edit`||e.action===`refresh`||e.action===`revoke`||e.action===`rotate`?e.action:void 0;return{...t===void 0?{}:{q:t},...n===void 0?{}:{key:n},...r===void 0?{}:{action:r}}}function Ra(){let e=He({strict:!1}),t=T(),n=typeof e.q==`string`?e.q:``,r=typeof e.key==`string`?e.key:null,i=e.action??null,a=(0,k.useCallback)(e=>{t({to:`.`,search:t=>La({...t,...e}),replace:!0})},[t]);return{query:n,selectedKey:r,action:i,setQuery:e=>{a({q:e.length>0?e:void 0})},setSelectedKey:e=>{a({key:e??void 0,action:void 0})},setAction:e=>{a({action:e??void 0})}}}var za=`/overview`,Ba=new Set([`/overview`,`/flows`,`/store`,`/vault`,`/access`,`/observability`]),Va=`/monitoring`,Ha=`/observability`,Ua=1024;function Wa(e){if(typeof e!=`string`)return;let t=e.trim();if(t.length===0||t.length>Ua||!t.startsWith(`/`)||t.startsWith(`//`)||t.includes(`://`))return;let n,r;try{let e=new URL(t,`http://console.local`);if(e.origin!==`http://console.local`)return;n=e.pathname,r=e.search}catch{return}if(n===Va&&(n=Ha),Ba.has(n))return r.length>0?`${n}${r}`:n}function Ga(e){let t=Wa(e.next);return t===void 0||t===`/overview`?{}:{next:t}}function Ka(e){return Ga({next:e})}function qa(e){let t=Wa(e);if(t===void 0)return{to:za,search:{}};let n=new URL(t,`http://console.local`),r=Object.fromEntries(n.searchParams.entries());return n.pathname===`/flows`?{to:`/flows`,search:Ta(r)}:n.pathname===`/store`?{to:`/store`,search:sn(r)}:n.pathname===`/vault`?{to:`/vault`,search:Fa(r)}:n.pathname===`/access`?{to:`/access`,search:La(r)}:n.pathname===Ha?{to:`/observability`,search:Na(r)}:{to:`/overview`,search:Ca(r)}}function Ja(e,t){let n=qa(t);switch(n.to){case`/flows`:e({to:`/flows`,search:n.search});return;case`/store`:e({to:`/store`,search:n.search});return;case`/vault`:e({to:`/vault`,search:n.search});return;case`/access`:e({to:`/access`,search:n.search});return;case`/observability`:e({to:`/observability`,search:n.search});return;default:e({to:`/overview`,search:n.search})}}function Ya(){let[e,t]=(0,k.useState)(!1);return(0,k.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(hover: hover) and (pointer: fine)`),n=()=>{t(e.matches)};return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var Xa=[1,.78,.54,.32,.16],Za=36;function Qa({className:e}){return(0,A.jsxs)(`svg`,{viewBox:`0 0 20 28`,fill:`none`,"aria-hidden":!0,className:e,children:[(0,A.jsx)(`circle`,{cx:`4`,cy:`4`,r:`2`,fill:`currentColor`}),(0,A.jsx)(`circle`,{cx:`10`,cy:`9`,r:`2`,fill:`currentColor`}),(0,A.jsx)(`circle`,{cx:`16`,cy:`14`,r:`2`,fill:`currentColor`}),(0,A.jsx)(`circle`,{cx:`10`,cy:`19`,r:`2`,fill:`currentColor`}),(0,A.jsx)(`circle`,{cx:`4`,cy:`24`,r:`2`,fill:`currentColor`})]})}var $a=(0,k.forwardRef)(function({children:e,className:t,accentClassName:n,labelClassName:r,expand:i=!0,disabled:a,onMouseEnter:o,onMouseLeave:s,onFocus:l,onBlur:u,...d},f){let p=fn(),m=Ya(),[h,g]=(0,k.useState)(!1),[_,v]=(0,k.useState)(!1),y=!!(i&&!a&&(m&&h||_)),b=p?{duration:0}:ln;return(0,A.jsxs)(pn.button,{ref:f,type:`button`,disabled:a,onMouseEnter:e=>{g(!0),o?.(e)},onMouseLeave:e=>{g(!1),s?.(e)},onFocus:e=>{v(!0),l?.(e)},onBlur:e=>{v(!1),u?.(e)},whileTap:p||a?void 0:{scale:.98},transition:dn,className:c(`relative inline-flex h-11 w-full items-center overflow-hidden rounded-none bg-primary p-1 text-primary-foreground select-none`,`outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,`disabled:pointer-events-none disabled:opacity-50`,t),...d,children:[i?(0,A.jsxs)(pn.span,{layout:`size`,"aria-hidden":!0,transition:b,style:{width:y?`calc(100% - 8px)`:Za,borderRadius:0},className:c(`absolute inset-y-1 left-1 z-10 overflow-hidden bg-background text-foreground`,n),children:[(0,A.jsx)(pn.span,{animate:{opacity:+!y},transition:{duration:p?0:.1,ease:un},className:`absolute inset-0 grid place-items-center`,children:(0,A.jsx)(Qa,{className:`h-5 w-3.5`})}),(0,A.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-around px-3`,children:Xa.map((e,t)=>(0,A.jsx)(pn.span,{animate:{opacity:y?e:0,transform:y&&!p?`translateX(0px)`:`translateX(-6px)`},transition:{duration:p?0:.18,delay:y&&!p?.04+t*.025:0,ease:un},className:`inline-grid place-items-center`,children:(0,A.jsx)(Qa,{className:`h-5 w-3.5`})},e))})]}):null,(0,A.jsx)(pn.span,{animate:{opacity:+!y,transform:y&&!p?`translateX(6px)`:`translateX(0px)`},transition:{duration:p?0:.12,ease:un},className:c(`relative z-0 flex w-full items-center justify-center text-sm font-medium text-primary-foreground`,i&&`pr-3 pl-11`,r),children:e})]})}),eo=`flex w-full flex-col rounded-none border border-border bg-card text-card-foreground`,to=`gap-0 border-t border-border/60`,no=`grid grid-cols-[6rem_minmax(0,1fr)] items-center gap-x-3 gap-y-1 border-b border-border/60 px-5 py-3.5 last:border-b-0 data-[invalid=true]:border-destructive`,ro=`h-8 rounded-none border-0 bg-transparent px-0 text-sm shadow-none focus-visible:border-0 focus-visible:ring-0 dark:bg-transparent autofill:bg-transparent autofill:shadow-none`,io=`col-start-2 min-w-0`,ao=`text-[10px] font-semibold tracking-[0.08em] text-muted-foreground uppercase group-focus-within/field:text-foreground`;function oo(e){return e.pending?`loading`:e.success?`success`:e.error?`error`:`idle`}function so({state:e=`idle`,children:t,loadingText:n=`Loading`,successText:r=`Done`,errorText:i=`Try again`,disabled:a,...s}){let c=e===`loading`,l=e===`loading`?n:e===`success`?r:e===`error`?i:t,u=e===`loading`?oe:e===`success`?st:e===`error`?o:null;return(0,A.jsx)($a,{disabled:a||c,expand:e===`idle`,"aria-busy":c||void 0,"data-slot":`auth-submit`,...s,children:(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[u?(0,A.jsx)(E,{icon:u,size:16,color:`currentColor`,strokeWidth:1.5,className:e===`loading`?`animate-spin`:void 0,"aria-hidden":!0}):null,l]})})}var co={neutral:`bg-foreground/35`,open:`bg-foreground`,alert:`bg-destructive`};function lo({label:e,tone:t=`neutral`}){return(0,A.jsxs)(`p`,{className:c(ao,`flex h-10 shrink-0 items-center gap-1.5 border-b border-border/60 px-5 group-focus-within/field:text-muted-foreground`),children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:c(`size-1.5 rounded-[1px]`,co[t])}),e]})}var uo=`pointer-events-none absolute size-3 border-foreground/50`;function fo(){return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:c(uo,`-top-1.5 -left-1.5 border-t border-l`)}),(0,A.jsx)(`span`,{"aria-hidden":!0,className:c(uo,`-top-1.5 -right-1.5 border-t border-r`)}),(0,A.jsx)(`span`,{"aria-hidden":!0,className:c(uo,`-bottom-1.5 -left-1.5 border-b border-l`)}),(0,A.jsx)(`span`,{"aria-hidden":!0,className:c(uo,`-right-1.5 -bottom-1.5 border-r border-b`)})]})}function po({title:e,description:t,status:n,children:r,footer:i,className:a}){let o=(0,k.useId)(),s=`auth-title-${o}`,l=t?`auth-desc-${o}`:void 0,u=fn()??!1;return(0,A.jsxs)(pn.div,{"data-slot":`auth-card`,initial:!u&&{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:u?0:.42,ease:un},className:c(`relative flex w-full flex-col gap-4`,a),children:[(0,A.jsx)(fo,{}),(0,A.jsxs)(`div`,{"data-auth-layer":`0`,className:eo,children:[n?(0,A.jsx)(lo,{...n}):null,(0,A.jsxs)(`header`,{"data-auth-layer":`1`,className:c(`flex flex-col gap-3 px-5`,n?`pt-7`:`pt-6`),children:[(0,A.jsx)(`h1`,{id:s,className:`text-[1.75rem] leading-none font-semibold tracking-[-0.03em] text-foreground`,children:e}),t?(0,A.jsx)(`p`,{id:l,className:`text-[13px] leading-snug text-muted-foreground`,children:t}):null]}),(0,A.jsx)(`div`,{className:`mt-7 flex flex-col pb-1`,children:typeof r==`function`?r({titleId:s,descriptionId:l}):r})]}),i?(0,A.jsx)(`div`,{"data-auth-layer":`footer`,className:`w-full`,children:i}):null]})}function mo(){return(0,A.jsxs)(`div`,{"data-slot":`auth-card`,className:`relative flex w-full flex-col gap-4`,role:`status`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,A.jsx)(`span`,{className:`sr-only`,children:`Checking setup…`}),(0,A.jsx)(fo,{}),(0,A.jsxs)(`div`,{"data-auth-layer":`0`,className:eo,children:[(0,A.jsx)(`div`,{className:`flex h-10 shrink-0 items-center border-b border-border/60 px-5`,children:(0,A.jsx)(cn,{className:`h-3 w-24 rounded-none`})}),(0,A.jsxs)(`header`,{"data-auth-layer":`1`,className:`flex flex-col gap-3 px-5 pt-7`,children:[(0,A.jsx)(cn,{className:`h-7 w-36 rounded-none`}),(0,A.jsx)(cn,{className:`h-4 w-full rounded-none`})]}),(0,A.jsx)(`div`,{className:`mt-7 flex flex-col border-t border-border/60 pb-1`,children:Array.from({length:2},(e,t)=>(0,A.jsxs)(`div`,{className:`grid grid-cols-[6rem_minmax(0,1fr)] items-center gap-x-3 border-b border-border/60 px-5 py-3.5 last:border-b-0`,children:[(0,A.jsx)(cn,{className:`h-3 w-14 rounded-none`}),(0,A.jsx)(cn,{className:`h-8 w-full rounded-none`})]},t))})]}),(0,A.jsx)(`div`,{"data-auth-layer":`footer`,className:`w-full`,children:(0,A.jsx)(cn,{className:`h-11 w-full rounded-none`})})]})}var ho=[{value:`light`,label:`Light`,icon:t},{value:`dark`,label:`Dark`,icon:ue},{value:`system`,label:`System`,icon:mt}];function go(){let{theme:e,setTheme:t}=hn();return(0,A.jsx)(`div`,{role:`group`,"aria-label":`Theme`,"data-slot":`mode-toggle`,className:`flex h-10 items-stretch`,children:ho.map(n=>{let r=e===n.value;return(0,A.jsxs)(ce,{disabled:r,children:[(0,A.jsx)(te,{render:e=>(0,A.jsxs)(`button`,{...e,type:`button`,"aria-label":n.label,"aria-pressed":r,onClick:r=>{e.onClick?.(r),t(n.value)},className:c(Fe,`font-semibold tracking-[0.08em] uppercase`,r?Je:Ct,e.className),children:[(0,A.jsx)(E,{icon:n.icon,className:`size-3`,color:`currentColor`,strokeWidth:1.5,"aria-hidden":!0}),r?n.label:null]})}),(0,A.jsx)(f,{side:`top`,sideOffset:6,children:n.label})]},n.value)})})}function _o({className:e,...t}){return(0,A.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 327 87`,fill:`none`,role:`img`,"aria-label":`OKE`,className:c(`text-foreground`,e),...t,children:[(0,A.jsx)(`path`,{d:`M231.08 84.672V0H320.648V13.824H250.088V33.696H303.944V47.952H250.088V70.848H321.224L326.984 83.088C326.984 83.472 325.688 83.856 323.096 84.24C320.504 84.528 316.04 84.672 309.704 84.672H231.08Z`,fill:`currentColor`}),(0,A.jsx)(`path`,{d:`M136.638 13.672V36.864H144.702C146.622 36.864 148.206 36.624 149.454 36.144C150.702 35.664 151.854 34.896 152.91 33.84C155.598 31.152 158.67 27.792 162.126 23.76C165.582 19.728 168.942 15.6 172.206 11.376C175.566 7.05599 178.446 3.264 180.846 0H204.174L198.27 8.64C195.582 11.424 192.702 14.448 189.63 17.712C186.558 20.976 183.534 24.192 180.558 27.36C177.582 30.432 174.894 33.168 172.494 35.568C170.094 37.872 168.318 39.552 167.166 40.608C169.758 41.472 172.11 42.576 174.222 43.92C176.43 45.264 179.118 47.232 182.286 49.824C184.686 51.744 186.99 53.712 189.198 55.728C191.502 57.744 194.142 60.144 197.118 62.928C200.478 66 203.646 68.256 206.622 69.696C209.598 71.136 212.094 72.048 214.11 72.432C216.222 72.816 217.566 73.008 218.142 73.008L215.262 84.672C214.974 84.96 214.11 85.248 212.67 85.536C211.23 85.92 209.166 86.112 206.478 86.112C201.774 86.112 197.694 85.152 194.238 83.232C190.782 81.312 187.374 78.72 184.014 75.456C180.366 71.616 175.95 67.2 170.766 62.208C168.366 59.712 165.918 57.648 163.422 56.016C160.926 54.384 158.094 53.136 154.926 52.272C151.854 51.408 148.014 50.976 143.406 50.976H136.638V70.672H117.63V13.672H136.638Z`,fill:`currentColor`}),(0,A.jsx)(`path`,{d:`M75.865 84.191C73.608 84.512 71.12 84.672 68.4 84.672H26.352C19.632 84.672 14.352 83.712 10.512 81.792C6.672 79.872 3.936 76.992 2.304 73.152C0.768001 69.312 0 64.56 0 58.896V25.632C0 20.064 0.768001 15.408 2.304 11.664C3.84 7.824 6.528 4.944 10.368 3.024C14.208 1.008 19.536 0 26.352 0H68.4C71.135 0 73.623 0.166992 75.865 0.500992V13.672H92.928C94.048 17.033 94.608 21.019 94.608 25.632V58.896C94.608 63.392 94.078 67.318 93.017 70.672H75.865V84.191ZM30.528 70.848H64.368C67.92 70.848 70.656 69.936 72.576 68.112C74.592 66.288 75.6 63.792 75.6 60.624V23.904C75.6 21.12 74.592 18.768 72.576 16.848C70.56 14.832 67.824 13.824 64.368 13.824H30.528C27.072 13.824 24.288 14.736 22.176 16.56C20.064 18.384 19.008 20.832 19.008 23.904V60.624C19.008 63.888 20.016 66.432 22.032 68.256C24.144 69.984 26.976 70.848 30.528 70.848Z`,fill:`currentColor`})]})}function vo({className:e,...t}){return(0,A.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 95 85`,fill:`none`,role:`img`,"aria-label":`OKE`,className:c(`text-foreground`,e),...t,children:(0,A.jsx)(`path`,{d:`M75.865 84.191C73.608 84.512 71.12 84.672 68.4 84.672H26.352C19.632 84.672 14.352 83.712 10.512 81.792C6.672 79.872 3.936 76.992 2.304 73.152C0.768001 69.312 0 64.56 0 58.896V25.632C0 20.064 0.768001 15.408 2.304 11.664C3.84 7.824 6.528 4.944 10.368 3.024C14.208 1.008 19.536 0 26.352 0H68.4C71.135 0 73.623 0.166992 75.865 0.500992V13.672H92.928C94.048 17.033 94.608 21.019 94.608 25.632V58.896C94.608 63.392 94.078 67.318 93.017 70.672H75.865V84.191ZM30.528 70.848H64.368C67.92 70.848 70.656 69.936 72.576 68.112C74.592 66.288 75.6 63.792 75.6 60.624V23.904C75.6 21.12 74.592 18.768 72.576 16.848C70.56 14.832 67.824 13.824 64.368 13.824H30.528C27.072 13.824 24.288 14.736 22.176 16.56C20.064 18.384 19.008 20.832 19.008 23.904V60.624C19.008 63.888 20.016 66.432 22.032 68.256C24.144 69.984 26.976 70.848 30.528 70.848Z`,fill:`currentColor`})})}function yo({children:e}){return(0,A.jsxs)(`div`,{className:`flex min-h-dvh w-full flex-col bg-background`,"data-slot":`console-chrome`,children:[(0,A.jsx)(`main`,{className:`mx-auto flex w-full max-w-md flex-1 flex-col justify-center px-4 py-10`,children:(0,A.jsxs)(`div`,{className:`flex flex-col items-stretch gap-10`,children:[(0,A.jsx)(_o,{className:`h-7 w-auto self-center`}),e]})}),(0,A.jsxs)(`footer`,{className:`grid h-10 shrink-0 grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-stretch border-t border-border/60`,children:[(0,A.jsx)(`p`,{className:`flex min-w-0 items-center truncate px-2 text-[10px] font-medium text-muted-foreground`,children:`OKE | Console`}),(0,A.jsx)(go,{}),(0,A.jsxs)(`p`,{className:`${ct} flex min-w-0 items-center justify-end gap-1.5 px-2`,children:[(0,A.jsx)(E,{icon:Me,size:12,color:`currentColor`,strokeWidth:1.5,"aria-hidden":!0}),(0,A.jsxs)(`span`,{children:[`v`,`0.17.2`]})]})]})]})}function bo(){return(0,A.jsx)(yo,{children:(0,A.jsxs)(`div`,{"data-slot":`not-found`,children:[(0,A.jsx)(`p`,{className:ao,children:`404`}),(0,A.jsx)(`h1`,{className:`mt-3 text-2xl font-semibold tracking-tight`,children:`Page not found`}),(0,A.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-muted-foreground`,children:`This URL is not a Console page.`})]})})}function xo({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function So(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Co=[],wo=0,{link:To,unlink:Eo,propagate:Do,checkDirty:Oo,shallowPropagate:ko}=xo({update(e){return e._update()},notify(e){Co[jo++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,No(e))}}),Ao=0,jo=0,F,Mo=0;function I(e){try{++Mo,e()}finally{--Mo||Po()}}function No(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Eo(n,e)}function Po(){if(!(Mo>0)){for(;Ao<jo;){let e=Co[Ao];Co[Ao++]=void 0,e.notify()}Ao=0,jo=0}}function Fo(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return F!==void 0&&To(i,F,wo),i._snapshot},subscribe(e){let t=So(e),n={current:!1},r=Io(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=F,o=t?.compare??Object.is;if(n)F=i,++wo,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{F=a,n&&(i.flags&=-5),No(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&Oo(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&ko(e)}}else e&32&&(i.flags=e&-33);return F!==void 0&&To(i,F,wo),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Do(e),ko(e),Po())}},i}function Io(e){let t=()=>{let t=F;F=n,++wo,n.depsTail=void 0,n.flags=6;try{return e()}finally{F=t,n.flags&=-5,No(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&Oo(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,No(this)}};return t(),n}var Lo=class{constructor(e,t){this.atom=Fo(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(So(e))}},Ro=class{constructor(e){this.atom=Fo(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(So(e))}};function zo(e,t){return typeof e==`function`?new Ro(e):t?new Lo(e,t):new Lo(e)}var Bo=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(()=>{this.lastArgs!==void 0&&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),void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function Vo(e,t){return new Bo(e,t).maybeExecute}var Ho=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{if(this.#c<this.#l){this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{});return}this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop()};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(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 n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{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){this.debugLog(`Event bus client is disabled, not emitting event`,e,t);return}if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d){this.debugLog(`Previously failed to connect, not emitting to bus`);return}if(!this.#a){this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().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 n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}},L=new class extends Ho{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function Uo(e,t){return typeof e==`function`?e(t):e}function Wo(e,t){return Qo(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function Go(e,t,n){let r=Qo(t);function i(e){if(!r.length)return Uo(n,e);let t=r.shift();if(typeof t==`string`||typeof t==`number`&&!Array.isArray(e))return typeof e==`object`?(e===null&&(e={}),{...e,[t]:i(e[t])}):{[t]:i()};if(Array.isArray(e)&&typeof t==`number`){let n=e.slice(0,t);return[...n.length?n:Array(t),i(e[t]),...e.slice(t+1)]}return[...Array(t),i()]}return i(e)}function Ko(e,t){let n=Qo(t);function r(e){if(!e)return;if(n.length===1){let t=n[0];if(Array.isArray(e)&&typeof t==`number`)return e.filter((e,n)=>n!==t);let{[t]:r,...i}=e;return i}let t=n.shift();if((typeof t==`string`||typeof t==`number`&&!Array.isArray(e))&&typeof e==`object`)return{...e,[t]:r(e[t])};if(typeof t==`number`&&Array.isArray(e)){if(t>=e.length)return e;let n=e.slice(0,t);return[...n.length?n:Array(t),r(e[t]),...e.slice(t+1)]}throw Error(`It seems we have created an infinite loop in deleteBy. `)}return r(e)}var qo=46,Jo=91,Yo=93,Xo=48,Zo=57;function Qo(e){if(Array.isArray(e))return[...e];if(typeof e!=`string`)throw Error(`Path must be a string.`);let t=e.length,n=[],r=+(t>0&&e.charCodeAt(0)===Jo),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===qo||s===Jo||s===Yo){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==Xo),s=e.slice(r,o);if(a){let e=parseInt(s,10);t<=15||String(e)===s?n.push(e):n.push(s)}else n.push(s)}else a!==Yo&&(a!==-1||s!==Yo)&&(a!==s||s!==qo&&s!==Jo)&&n.push(``);r=o+1,i=!0}else(s<Xo||s>Zo)&&(i=!1);a=s}return n.length||n.push(``),n}function $o(e){return!(Array.isArray(e)&&e.length===0)}function es(e,t){return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!1},runValidation:e=>e.validators.filter(Boolean).map(e=>({cause:e.cause,validate:e.fn}))})}function ts(e,t){let{asyncDebounceMs:n}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:i,onDynamicAsyncDebounceMs:a}=t.validators||{},o=n??0;return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!0},runValidation:t=>t.validators.filter(Boolean).map(t=>{let n=t?.cause||e,s=o;switch(n){case`change`:s=i??o;break;case`blur`:s=r??o;break;case`dynamic`:s=a??o;break;case`submit`:s=0}return e===`submit`&&(s=0),{cause:n,validate:t.fn,debounceMs:s}})})}var ns=e=>!!e&&typeof e==`object`&&`fields`in e;function rs(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!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[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||n.length===0&&!Array.isArray(e)&&!Array.isArray(t)&&(Object.getPrototypeOf(e)!==Object.prototype||Object.getPrototypeOf(t)!==Object.prototype))return!1;for(let i of n)if(!r.includes(i)||!rs(e[i],t[i]))return!1;return!0}var is=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:n})=>e?{newErrorValue:e,newSource:`form`}:t?{newErrorValue:void 0,newSource:void 0}:n?{newErrorValue:n,newSource:`field`}:{newErrorValue:void 0,newSource:void 0},as=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function R(e,t){return e==null?t:{...e,...t}}for(var os=256,ss=[],cs;os--;)ss[os]=(os+256).toString(16).substring(1);function ls(){let e=0,t,n=``;if(!cs||os+16>256){for(cs=Array(256),e=256;e--;)cs[e]=256*Math.random()|0;e=0,os=0}for(;e<16;e++)t=cs[os+e],n+=e===6?ss[t&15|64]:e===8?ss[t&63|128]:ss[t],e&1&&e>1&&e<11&&(n+=`-`);return os++,n}var us=Vo(e=>L.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function ds(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++)t[n]=ds(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,ds(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(ds(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=ds(e[n]));return t}function fs(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var z=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});let t=e.event.async,n=t?void 0:{fn:e.validators.onMount,cause:`mount`},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:`change`},i={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:`blur`},a={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:`submit`},o=t?void 0:{fn:()=>void 0,cause:`server`};switch(e.event.type){case`mount`:return e.runValidation({validators:[n],form:e.form});case`submit`:return e.runValidation({validators:[r,i,a,o],form:e.form});case`server`:return e.runValidation({validators:[],form:e.form});case`blur`:return e.runValidation({validators:[i,o],form:e.form});case`change`:return e.runValidation({validators:[r,o],form:e.form});default:throw Error(`Unknown validation event type: ${e.event.type}`)}};function ps(e,t){let n=new Map;for(let r of e){let e=r.path??[],i=t,a=``;for(let t=0;t<e.length;t++){let n=e[t];if(n===void 0)continue;let r=typeof n==`object`?n.key:n,o=Number(r);a+=Array.isArray(i)&&!Number.isNaN(o)?`[${o}]`:(t>0?`.`:``)+String(r),i=typeof i==`object`&&i?i[r]:void 0}n.set(a,(n.get(a)??[]).concat(r))}return Object.fromEntries(n)}var ms=(e,t)=>{let n=ps(e,t);return{form:n,fields:n}},hs={validate({value:e,validationSource:t},n){let r=n[`~standard`].validate(e);if(r instanceof Promise)throw Error(`async function passed to sync validator`);if(r.issues)return t===`field`?r.issues:ms(r.issues,e)},async validateAsync({value:e,validationSource:t},n){let r=await n[`~standard`].validate(e);if(r.issues)return t===`field`?r.issues:ms(r.issues,e)}},gs=e=>!!e&&`~standard`in e,B={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function _s(e){function t(t){let n=e.getFieldMeta(t)??B;e.setFieldMeta(t,{...n,_arrayVersion:(n._arrayVersion||0)+1})}function n(n,r,i){t(n);let a=s(n,r,`move`,i),c=Math.min(r,i),u=Math.max(r,i);for(let e=c;e<=u;e++)a.push(o(n,e));let d=Object.keys(e.fieldInfo).reduce((t,i)=>(i.startsWith(o(n,r))&&t.set(i,e.getFieldMeta(i)),t),new Map);l(a,r<i?`up`:`down`),Object.keys(e.fieldInfo).filter(e=>e.startsWith(o(n,i))).forEach(t=>{let a=t.replace(o(n,i),o(n,r)),s=d.get(a);s&&e.setFieldMeta(t,s)})}function r(e,n){t(e),l(s(e,n,`remove`),`up`)}function i(n,r,i){t(n),s(n,r,`swap`,i).forEach(t=>{if(!t.toString().startsWith(o(n,r)))return;let a=t.toString().replace(o(n,r),o(n,i)),[s,c]=[e.getFieldMeta(t),e.getFieldMeta(a)];s&&e.setFieldMeta(a,s),c&&e.setFieldMeta(t,c)})}function a(n,r){t(n);let i=s(n,r,`insert`);l(i,`down`),i.forEach(t=>{t.toString().startsWith(o(n,r))&&e.setFieldMeta(t,u())})}function o(e,t){return`${e}[${t}]`}function s(t,n,r,i){let a=[o(t,n)];switch(r){case`swap`:a.push(o(t,i));break;case`move`:{let[e,r]=[Math.min(n,i),Math.max(n,i)];for(let n=e;n<=r;n++)a.push(o(t,n));break}default:{let r=e.getFieldValue(t),i=Array.isArray(r)?r.length:0;for(let e=n+1;e<i;e++)a.push(o(t,e));break}}return Object.keys(e.fieldInfo).filter(e=>a.some(t=>e.startsWith(t)))}function c(e,t){return e.replace(/\[(\d+)\]/,(e,n)=>{let r=parseInt(n,10);return`[${t===`up`?r+1:Math.max(0,r-1)}]`})}function l(t,n){(n===`up`?t:[...t].reverse()).forEach(t=>{let r=c(t.toString(),n),i=e.getFieldMeta(r);i?e.setFieldMeta(t,i):e.setFieldMeta(t,u())})}let u=()=>B;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function vs(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},formGroupStateBase:e.formGroupStateBase??{},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}}}var ys=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{us(this)}),t=L.on(`request-form-state`,e=>{e.payload.id===this._formId&&L.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=L.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=L.on(`request-form-force-submit`,e=>{e.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),i=()=>{r(),n(),t(),e.unsubscribe(),L.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return L.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options}),a&&this.validateSync(`mount`),i},this.update=e=>{if(!e)return;let t=this.options;this.options=e;let n=e.defaultValues&&!rs(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!rs(e.defaultState,t.defaultState)&&!this.state.isTouched;if(!(!n&&!r)){if(I(()=>{this.baseStore.setState(()=>vs(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=_s(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}L.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(e,t)=>{let{fieldMeta:n}=this.state,r=this.resetFieldMeta(n);e&&!t?.keepDefaultValues&&(this.options={...this.options,defaultValues:e}),this.baseStore.setState(()=>{let t=e??this.options.defaultValues??this.options.defaultState?.values;return e||Object.values(this.fieldInfo).forEach(e=>{e.instance&&e.instance.options.defaultValue!==void 0&&(t=Go(t,e.instance.name,e.instance.options.defaultValue))}),vs({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return I(()=>{Object.values(this.fieldInfo).forEach(n=>{if(!n.instance)return;let r=n.instance;t.push(Promise.resolve().then(()=>r.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.instance.store.state.meta.isTouched||n.instance.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null,a=[`${e}[${t}]`];for(let n=t+1;n<=(i??0);n++)a.push(`${e}[${n}]`);let o=Object.keys(this.fieldInfo).filter(e=>a.some(t=>e.startsWith(t))),s=[];return I(()=>{o.forEach(e=>{s.push(Promise.resolve().then(()=>this.validateField(e,n)))})}),(await Promise.all(s)).flat()},this.validateField=(e,t)=>{let n=this.fieldInfo[e]?.instance;if(!n){let{hasErrored:n}=this.validateSync(t);return n&&!this.options.asyncAlways?this.getFieldMeta(e)?.errors??[]:this.validateAsync(t).then(()=>this.getFieldMeta(e)?.errors??[])}return n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0})),n.validate(t)},this.validateSync=(e,t)=>{let n=es(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||z}),r=!1,i={};return I(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=bs(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=xs(e.cause),s=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(a||{})]);t?.filterFieldNames&&(s=new Set([...s].filter(t.filterFieldNames)));for(let e of s){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!a?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??B,r=a?.[e],{newErrorValue:s,newSource:c}=is({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=B)=>({...e,errorMap:{...e.errorMap,[o]:s},errorSourceMap:{...e.errorSourceMap,[o]:c}}))}t?.dontUpdateFormErrorMap||this.state.errorMap?.[o]!==n&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:n}})),(n||a)&&(r=!0)}if(t?.dontUpdateFormErrorMap)return;let a=xs(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=xs(`server`);this.state.errorMap?.[o]&&e!==`server`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:void 0}}))}),{hasErrored:r,fieldsErrorMap:i}},this.validateAsync=async(e,t)=>{let n=ts(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||z});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=xs(e.cause);this.state.validationMetaMap[n]?.lastAbortController.abort();let a=new AbortController;this.state.validationMetaMap[n]={lastAbortController:a},r.push(new Promise(async n=>{let r;try{r=await new Promise((t,n)=>{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){n(e)}},e.debounceMs)})}catch(e){r=e}let{formError:o,fieldErrors:s}=bs(r);s&&(i=i?{...i,...s}:s);let c=xs(e.cause),l=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(i||{})]),u=Array.from(l);t?.filterFieldNames&&(u=u.filter(t.filterFieldNames));for(let e of u){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!i?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??B,r=i?.[e],{newErrorValue:a,newSource:o}=is({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=B)=>({...e,errorMap:{...e.errorMap,[c]:a},errorSourceMap:{...e.errorSourceMap,[c]:o}}))}t?.dontUpdateFormErrorMap||this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[c]:o}})),n(i?{fieldErrors:i,errorMapKey:c}:void 0)}))}let a=[],o={};if(r.length){a=await Promise.all(r);for(let e of a)if(e?.fieldErrors){let{errorMapKey:t}=e;for(let[n,r]of Object.entries(e.fieldErrors))o[n]={...o[n]||{},[t]:r}}}return this.baseStore.setState(e=>({...e,isFormValidating:!1})),o},this.validate=(e,t)=>{let{hasErrored:n,fieldsErrorMap:r}=this.validateSync(e,t);return n&&!this.options.asyncAlways?r:this.validateAsync(e,t)},this._handleSubmit=async e=>{this.baseStore.setState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),I(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance&&(e.instance.store.state.meta.isTouched||e.instance.setMeta(e=>({...e,isTouched:!0})))})});let t=e??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride&&this.baseStore.state.submissionAttempts<=1){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}this.baseStore.setState(e=>({...e,isSubmitting:!0}));let n=()=>{this.baseStore.setState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.state.isFieldsValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),L.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){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),L.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});return}I(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance?.triggerOnSubmitListener()})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),I(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),L.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),L.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}},this.getFieldValue=e=>Wo(this.state.values,e),this.getFieldMeta=e=>this.state.fieldMeta[e],this.getFormGroupMeta=e=>this.formGroupMetaDerived.state[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(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[e]:Uo(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=B,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;I(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:Go(n.values,e,t)}))}),i||this.getFieldInfo(e).instance?.triggerOnChangeListener(),a||this.validateField(e,`change`)},this.deleteField=e=>{let t=[...Object.keys(this.fieldInfo).filter(t=>{let n=e.toString();return t!==n&&t.startsWith(n)}),e];this.baseStore.setState(e=>{let n={...e};return t.forEach(e=>{n.values=Ko(n.values,e),delete this.fieldInfo[e],delete n.fieldMetaBase[e]}),n})},this.pushFieldValue=(e,t,n)=>{this.setFieldValue(e,e=>[...Array.isArray(e)?e:[],t],n),_s(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],R(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),_s(this).handleArrayInsert(e,t),i||await this.validateArrayFieldsStartingFrom(e,t,`change`)},this.replaceFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>e.map((e,r)=>r===t?n:e),R(r,{dontValidate:!0})),_s(this).bumpArrayVersion(e),(r?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.removeFieldValue=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null;if(this.setFieldValue(e,e=>e.filter((e,n)=>n!==t),R(n,{dontValidate:!0})),_s(this).handleArrayRemove(e,t),i!==null){let t=`${e}[${i}]`;this.deleteField(t)}(n?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.swapFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=e[t],i=e[n];return Go(Go(e,`${t}`,i),`${n}`,r)},R(r,{dontValidate:!0})),_s(this).handleArraySwap(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.moveFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=[...e];return r.splice(n,0,r.splice(t,1)[0]),r},R(r,{dontValidate:!0})),_s(this).handleArrayMove(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.clearFieldValues=(e,t)=>{let n=this.getFieldValue(e),r=Array.isArray(n)?Math.max(n.length-1,0):null;if(this.setFieldValue(e,[],R(t,{dontValidate:!0})),_s(this).bumpArrayVersion(e),r!==null)for(let t=0;t<=r;t++){let n=`${e}[${t}]`;this.deleteField(n)}(t?.dontValidate??!1)||this.validateField(e,`change`)},this.resetField=e=>{this.baseStore.setState(t=>{let n=this.getFieldInfo(e).instance?.options.defaultValue,r=Wo(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:B},values:i===void 0?t.values:Go(t.values,e,i)}})},this.setErrorMap=e=>{I(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(ns(t)){let{formError:e,fieldErrors:r}=bs(t);for(let e of Object.keys(this.fieldInfo))this.getFieldMeta(e)&&this.setFieldMeta(e,t=>({...t,errorMap:{...t.errorMap,[n]:r?.[e]},errorSourceMap:{...t.errorSourceMap,[n]:`form`}}));this.baseStore.setState(t=>({...t,errorMap:{...t.errorMap,[n]:e}}))}else this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[n]:t}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((e,[t,n])=>(Object.keys(n).length&&n.errors.length&&(e[t]={errors:n.errors,errorMap:n.errorMap}),e),{})}),this.parseValuesWithSchema=e=>hs.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>hs.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??ls(),this._devtoolsSubmissionOverride=!1;let t=vs({...e?.defaultState,values:e?.defaultValues??e?.defaultState?.values});if(e?.transform){t=e.transform({state:t}).state;for(let e of Object.keys(t.errorMap)){let n=t.errorMap[e];if(!(n===void 0||!ns(n)))for(let r of Object.keys(n.fields)){let i=n.fields[r];if(i===void 0)continue;let a=t.fieldMetaBase[r];t.fieldMetaBase[r]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...a??{},errorSourceMap:{...a?.errorSourceMap??{},onChange:`form`},errorMap:{...a?.errorMap??{},[e]:i}}}}}this.baseStore=zo(t);let n;this.fieldMetaDerived=zo(e=>{let t=this.baseStore.get(),r=0,i={};for(let a of Object.keys(t.fieldMetaBase)){let o=t.fieldMetaBase[a],s=n?.fieldMetaBase[a],c=e?.[a],l=Wo(t.values,a),u=c?.errors;if(!s||o.errorMap!==s.errorMap){u=Object.values(o.errorMap??{}).filter(e=>e!==void 0);let e=this.getFieldInfo(a)?.instance;(!e||!e.options.disableErrorFlat)&&(u=u.flat(1))}let d=!$o(u),f=!o.isDirty,p=rs(l,this.getFieldInfo(a)?.instance?.options.defaultValue??Wo(this.options.defaultValues,a));if(c&&c.isPristine===f&&c.isValid===d&&c.isDefaultValue===p&&c.errors===u&&o===s){i[a]=c,r++;continue}i[a]={...o,errors:u??[],isPristine:f,isValid:d,isDefaultValue:p}}return Object.keys(t.fieldMetaBase).length?e&&r===Object.keys(t.fieldMetaBase).length?e:(n=this.baseStore.get(),i):i}),this.formGroupMetaDerived=zo(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),r={};for(let i of this.formGroupApis){let a=i.name,o=t.formGroupStateBase[a]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},s=n[a],c=!1,l=!0,u=!1,d=!1,f=!0,p=!1;for(let e in n){if(e===a||!fs(a,e))continue;let t=n[e];t&&(t.isValidating&&(c=!0),t.isValid||(l=!1),t.isTouched&&(u=!0),t.isBlurred&&(d=!0),t.isDefaultValue||(f=!1),t.isDirty&&(p=!0))}let m=!p,h=!!c||o.isValidating,g=s?.errorMap??{},_=s?.errorSourceMap??{},v=!!(g.onMount||Object.entries(n).some(([e,t])=>t&&e!==a&&fs(a,e)&&t.errorMap.onMount)),y=e?.[a],b=y?.errors??[];(!y||y.__srcErrorMap!==g)&&(b=Object.values(g).reduce((e,t)=>{if(t===void 0)return e;if(t&&typeof t==`object`&&`fields`in t){let n=t.group;return n!==void 0&&e.push(n),e}return e.push(t),e},[]));let x=b.length===0,S=l&&x,C=i.options.canSubmitWhenInvalid??!1,ee=o.submissionAttempts===0&&!u&&!v||!h&&!o.isSubmitting&&S||C;if(y&&y.errorMap===g&&y.errorSourceMap===_&&y.errors===b&&y.isFieldsValidating===c&&y.isFieldsValid===l&&y.isGroupValid===x&&y.isValid===S&&y.canSubmit===ee&&y.isTouched===u&&y.isBlurred===d&&y.isPristine===m&&y.isDefaultValue===f&&y.isDirty===p&&y.isValidating===h&&y.isSubmitting===o.isSubmitting&&y.isSubmitted===o.isSubmitted&&y.submissionAttempts===o.submissionAttempts&&y.isSubmitSuccessful===o.isSubmitSuccessful){r[a]=y;continue}let te={...o,errorMap:g,errorSourceMap:_,_arrayVersion:s?._arrayVersion??0,isTouched:u,isBlurred:d,isDirty:p,isPristine:m,isDefaultValue:f,isValid:S,errors:b,isValidating:h,isFieldsValidating:c,isFieldsValid:l,isGroupValid:x,canSubmit:ee};Object.defineProperty(te,"__srcErrorMap",{value:g,enumerable:!1,configurable:!0}),r[a]=te}return r});let r;this.store=zo(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),i=Object.values(n).filter(Boolean),a=i.some(e=>e.isValidating),o=i.every(e=>e.isValid),s=i.some(e=>e.isTouched),c=i.some(e=>e.isBlurred),l=i.every(e=>e.isDefaultValue),u=s&&t.errorMap?.onMount,d=i.some(e=>e.isDirty),f=!d,p=!!(t.errorMap?.onMount||i.some(e=>e?.errorMap?.onMount)),m=!!a,h=e?.errors??[];(!r||t.errorMap!==r.errorMap)&&(h=Object.values(t.errorMap).reduce((e,t)=>t===void 0?e:t&&ns(t)?(e.push(t.form),e):(e.push(t),e),[]));let g=h.length===0,_=o&&g,v=this.options.canSubmitWhenInvalid??!1,y=t.submissionAttempts===0&&!s&&!p||!m&&!t.isSubmitting&&_||v,b=t.errorMap;if(u&&(h=h.filter(e=>e!==t.errorMap.onMount),b=Object.assign(b,{onMount:void 0})),e&&r&&e.errorMap===b&&e.fieldMeta===this.fieldMetaDerived.state&&e.errors===h&&e.isFieldsValidating===a&&e.isFieldsValid===o&&e.isFormValid===g&&e.isValid===_&&e.canSubmit===y&&e.isTouched===s&&e.isBlurred===c&&e.isPristine===f&&e.isDefaultValue===l&&e.isDirty===d&&rs(r,t))return e;let x={...t,errorMap:b,fieldMeta:this.fieldMetaDerived.state,errors:h,isFieldsValidating:a,isFieldsValid:o,isFormValid:g,isValid:_,canSubmit:y,isTouched:s,isBlurred:c,isPristine:f,isDefaultValue:l,isDirty:d};return r=this.baseStore.get(),x}),this.handleSubmit=this.handleSubmit.bind(this),this.update(e||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(e){return gs(e.validate)?hs[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function bs(e){return e?ns(e)?{formError:bs(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function xs(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 Ss=class e{constructor(t){this.options={},this.mount=()=>{this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});let e=this.getInfo();e.instance=this,this.update(this.options);let{onMount:t}=this.options.validators||{};if(t){let e=this.runValidator({validate:t,value:{value:this.state.value,fieldApi:this,validationSource:`field`},type:`validate`});e&&this.setMeta(t=>({...t,errorMap:{...t?.errorMap,onMount:e},errorSourceMap:{...t?.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,n]of Object.entries(e.validationMetaMap))n?.lastAbortController.abort(),e.validationMetaMap[t]=void 0;this.form.baseStore.setState(e=>({...e,fieldMetaBase:{...e.fieldMetaBase,[this.name]:{...B,isTouched:e.fieldMetaBase[this.name]?.isTouched??B.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??B.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??B.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&&this.options.defaultValue!==void 0&&(rs(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)=>{this.form.setFieldValue(this.name,e,R(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,R(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,R(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,R(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,R(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,R(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,R(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,R(e,{dontRunListeners:!0})),e?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=t=>{let n=Object.values(this.form.fieldInfo),r=[];for(let i of n){if(!i.instance||!(i.instance instanceof e))continue;let{onChangeListenTo:n,onBlurListenTo:a}=i.instance.options.validators||{};t===`change`&&n?.includes(this.name)&&r.push(i.instance),t===`blur`&&a?.includes(this.name)&&r.push(i.instance)}return r},this.validateSync=(e,t)=>{let n=es(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||z}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=es(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||z});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;I(()=>{let e=(e,n)=>{let r=ws(n.cause),a=n.validate?Cs(e.runValidator({validate:n.validate,value:{value:e.store.state.value,validationSource:`field`,fieldApi:e},type:`validate`})):void 0,o=t[r],{newErrorValue:s,newSource:c}=as({formLevelError:o,fieldLevelError:a});e.state.meta.errorMap?.[r]!==s&&e.setMeta(e=>({...e,errorMap:{...e.errorMap,[r]:s},errorSourceMap:{...e.errorSourceMap,[r]:c}})),s&&(i=!0)};for(let t of n)e(this,t);for(let t of r)t.validate&&e(t.field,t)});let a=ws(`submit`);return this.state.meta.errorMap?.[a]&&e!==`submit`&&!i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[a]:void 0},errorSourceMap:{...e.errorSourceMap,[a]:void 0}})),{hasErrored:i}},this.validateAsync=async(e,t)=>{let n=ts(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||z}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=ts(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||z});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),a=[],o=[],s=n.some(e=>e.validate),c=Array.from(new Set(i.filter(e=>e.validate).map(e=>e.field)));I(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=ws(t.cause),a=e.getInfo();a.validationMetaMap[i]?.lastAbortController.abort();let o=new AbortController;a.validationMetaMap[i]={lastAbortController:o},n.push(new Promise(async n=>{let a;try{a=await new Promise((n,r)=>{e.timeoutIds.validations[t.cause]&&(clearTimeout(e.timeoutIds.validations[t.cause]),e.endValidation()),e.timeoutIds.validations[t.cause]=setTimeout(async()=>{if(o.signal.aborted)return n(void 0);try{n(await this.runValidator({validate:t.validate,value:{value:e.store.state.value,fieldApi:e,signal:o.signal,validationSource:`field`},type:`validateAsync`}))}catch(e){r(e)}},t.debounceMs)})}catch(e){a=e}if(o.signal.aborted)return n(void 0);let s=Cs(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=as({formLevelError:c,fieldLevelError:s});if(e.getInfo().instance!==e)return n(void 0);e.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:l},errorSourceMap:{...e.errorSourceMap,[i]:u}})),n(l)}))};for(let e of n)e.validate&&l(this,e,a);for(let e of i)e.validate&&l(e.field,e,o);let u=[];return(a.length||o.length)&&(u=await Promise.all(a),await Promise.all(o)),I(()=>{s&&this.endValidation();for(let e of c)e.endValidation()}),u.filter(Boolean)},this.validate=(e,t)=>{if(!this.state.meta.isTouched)return[];let n=t?.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(e=>this.name.startsWith(e.name)),r=(t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e)).fieldsErrorMap[this.name]??{};if(!t?.skipFormValidation)for(let t of n){if(t.state.meta.submissionAttempts===0)continue;let{fieldsErrorMap:n}=this.form.validateSync(e,{group:t,dontUpdateFormErrorMap:!0,filterFieldNames:e=>fs(t.name,e)});r={...r,...n[this.name]??{}}}let{hasErrored:i}=this.validateSync(e,r),a=new WeakMap;for(let t of n){let{hasErrored:n}=t.validateSync(e,{},{skipRelatedFieldValidation:!0});a.set(t,n)}if(i&&!this.options.asyncAlways){this.getInfo().validationMetaMap[ws(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[ws(e)]?.lastAbortController.abort(),t.push(r.state.meta.errors);return[...this.state.meta.errors,...t.flat()]}let o=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),s=this.validateAsync(e,o),c=[];for(let t of n)a.get(t)&&!t.options.asyncAlways||c.push(t.validateAsync(e,o,{skipRelatedFieldValidation:!0}));return c.length===0?s:Promise.all([s,...c]).then(e=>e.flat())},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=>hs.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>hs.validateAsync({value:this.state.value,validationSource:`field`},e),this.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})},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});for(let e of this.form.formGroupApis)fs(e.name,this.name)&&e.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,fieldApi:this})},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=zo(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...B,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!rs(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}})}get state(){return this.store.state}runValidator(e){return gs(e.validate)?hs[e.type](e.value,e.validate):e.validate(e.value)}startValidation(){this.setMeta(e=>{let t=e._pendingValidationsCount+1;return{...e,_pendingValidationsCount:t,isValidating:t>0&&!e.isValidating||e.isValidating}})}endValidation(){this.setMeta(e=>{let t=Math.max(0,e._pendingValidationsCount-1);return{...e,_pendingValidationsCount:t,isValidating:t===0&&e.isValidating?!1:e.isValidating}})}};function Cs(e){if(e)return e}function ws(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 Ts(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function Es(e){return{...B,...e,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}var Ds=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??Ts({});return{...t,formGroupStateBase:{...t.formGroupStateBase,[this.name]:e(n)}}})},this._lastDistributedFieldNames={},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(rs(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,{...B,...this.options.defaultMeta})},this.mount=()=>{this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:e.formGroupStateBase[this.name]??Ts({...this.options.defaultState})}}));let{onMount:e}=this.options.validators||{};if(e){let t=this.runValidator({validate:e,value:{value:this.state.value,groupApi:this,validationSource:`form`},type:`validate`}),n=t,r;ks(t)&&(n=t.group,r=t.fields);let i=Os(n);i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,onMount:i},errorSourceMap:{...e.errorSourceMap,onMount:`field`}})),this.distributeFieldErrors(`onMount`,r)}return this.options.listeners?.onMount?.({value:this.state.value,groupApi: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);if(this.fieldInfo.instance===this){for(let[e,t]of Object.entries(this.fieldInfo.validationMetaMap))t?.lastAbortController.abort(),this.fieldInfo.validationMetaMap[e]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:Ts({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,R(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.fieldInfo,this.getRelatedFields=()=>{let e=Object.values(this.form.fieldInfo),t=[];for(let n of e)n.instance&&n.instance instanceof Ss&&n.instance.name.startsWith(this.name)&&t.push(n.instance);return t},this.getRelatedFieldMetasDerived=()=>{let e=Object.entries(this.form.fieldMetaDerived.state),t=[];for(let[n,r]of e)n!==this.name&&fs(this.name,n)&&t.push({...r,name:n});return t},this.buildChildFieldName=e=>e===``?this.name:e.startsWith(`[`)?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,t)=>{let n=this._lastDistributedFieldNames[e]??new Set,r=new Set;if(t)for(let[e,n]of Object.entries(t))n!=null&&n!==!1&&r.add(this.buildChildFieldName(e));let i=new Set([...n,...r]),a=!1;for(let n of i){let r=n.startsWith(this.name+`[`)?n.slice(this.name.length):n.slice(this.name.length+1),i=t?.[r],o=this.form.getFieldMeta(n);if(!o&&!i)continue;let s=o?.errorMap[e],{newErrorValue:c,newSource:l}=is({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=B)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=es(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||z}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=es(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||z});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;I(()=>{let t=(t,r)=>{let i=js(r.cause),a=t===this,s;r.validate&&(s=t.runValidator({validate:r.validate,value:{value:t.store.state.value,validationSource:a?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validate`}));let c=s,l;a&&ks(s)&&(c=s.group,l=s.fields);let u=Os(c),d=n[i],{newErrorValue:f,newSource:p}=as({formLevelError:d,fieldLevelError:u});t.state.meta.errorMap?.[i]!==f&&t.setMeta(e=>({...e,errorMap:{...e.errorMap,[i]:f},errorSourceMap:{...e.errorSourceMap,[i]:p}})),f&&(o=!0),a&&this.distributeFieldErrors(i,l)&&(o=!0)};for(let e of i)t(this,e);for(let e of a)e.validate&&t(e.field,e)});let s=js(`submit`);return this.state.meta.errorMap?.[s]&&t!==`submit`&&!o&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[s]:void 0},errorSourceMap:{...e.errorSourceMap,[s]:void 0}})),{hasErrored:o}},this.validateAsync=async(t,n,r={})=>{let i=ts(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||z}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=ts(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||z});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),c=[],l=[],u=i.some(e=>e.validate)||s.some(e=>e.validate);if(u){this.state.meta.isValidating||this.setMeta(e=>({...e,isValidating:!0}));for(let e of o)e.setMeta(e=>({...e,isValidating:!0}))}let d=(t,n,r)=>{let i=js(n.cause),o=t.getInfo();o.validationMetaMap[i]?.lastAbortController.abort();let s=new AbortController;o.validationMetaMap[i]={lastAbortController:s};let c=t===this;r.push(new Promise(async r=>{let o;try{o=await new Promise((r,i)=>{t.timeoutIds.validations[n.cause]&&clearTimeout(t.timeoutIds.validations[n.cause]),t.timeoutIds.validations[n.cause]=setTimeout(async()=>{if(s.signal.aborted)return r(void 0);try{r(await this.runValidator({validate:n.validate,value:{value:t.store.state.value,signal:s.signal,validationSource:c?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validateAsync`}))}catch(e){i(e)}},n.debounceMs)})}catch(e){o=e}if(s.signal.aborted)return r(void 0);let l=o,u;c&&ks(o)&&(l=o.group,u=o.fields);let d=Os(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=as({formLevelError:f,fieldLevelError:d});if(t.getInfo().instance!==t)return r(void 0);t.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:p},errorSourceMap:{...e.errorSourceMap,[i]:m}})),c&&this.distributeFieldErrors(i,u),r(p)}))};for(let e of i)e.validate&&d(this,e,c);for(let e of s)e.validate&&d(e.field,e,l);let f=[];if((c.length||l.length)&&(f=await Promise.all(c),await Promise.all(l)),u){this.setMeta(e=>({...e,isValidating:!1}));for(let e of o)e.setMeta(e=>({...e,isValidating:!1}))}return f.filter(Boolean)},this.validateAllFields=async e=>{let t=[];return I(()=>{Object.values(this.getRelatedFields()).forEach(n=>{t.push(Promise.resolve().then(()=>n.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=(e,t,n)=>this.form.validateArrayFieldsStartingFrom(e,t,n),this.validateField=(e,t)=>this.form.validateField(e,t),this.getFieldValue=e=>this.form.getFieldValue(e),this.getFieldMeta=e=>this.form.getFieldMeta(e),this.setFieldMeta=(e,t)=>this.form.setFieldMeta(e,t),this.setFieldValue=(e,t)=>this.form.setFieldValue(e,t),this.deleteField=e=>this.form.deleteField(e),this.pushFieldValue=(e,t)=>this.form.pushFieldValue(e,t),this.insertFieldValue=(e,t,n)=>this.form.insertFieldValue(e,t,n),this.replaceFieldValue=(e,t,n)=>this.form.replaceFieldValue(e,t,n),this.swapFieldValues=(e,t,n)=>this.form.swapFieldValues(e,t,n),this.moveFieldValues=(e,t,n)=>this.form.moveFieldValues(e,t,n),this.clearFieldValues=e=>this.form.clearFieldValues(e),this.resetField=e=>this.form.resetField(e),this.removeFieldValue=(e,t)=>this.form.removeFieldValue(e,t),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(e=>e.state.meta.isValid),this.validate=(e,t)=>{let{fieldsErrorMap:n}=t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>fs(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[js(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>fs(this.name,e)});return this.validateAsync(e,i,{skipRelatedFieldValidation:t?.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this})},e)):this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi: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,groupApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,groupApi:this})},this._handleSubmit=async e=>{this.setFormGroupState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),I(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.state.meta.isTouched||e.setMeta(e=>({...e,isTouched:!0}))})});let t=e??this.options.onSubmitMeta;this.setFormGroupState(e=>({...e,isSubmitting:!0}));let n=()=>{this.setFormGroupState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.areRelatedFieldsValid()){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}if(await this.validate(`submit`,{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}I(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.options.listeners?.onGroupSubmit?.({value:e.state.value,fieldApi:e})})}),this.options.listeners?.onSubmit?.({groupApi:this,value:this.state.value});try{await this.options.onGroupSubmit?.({value:this.state.value,groupApi:this,meta:t}),I(()=>{this.setFormGroupState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),n()})}catch(e){throw this.setFormGroupState(e=>({...e,isSubmitSuccessful:!1})),n(),e}},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=zo(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??Es(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!rs(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(e){if(gs(e.validate)){let t=hs[e.type](e.value,e.validate);return e.type===`validate`?As(t):t.then(As)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function Os(e){if(e)return e}function ks(e){return!!e&&typeof e==`object`&&`fields`in e}function As(e){if(!e||typeof e!=`object`||!(`form`in e)&&!(`fields`in e))return e;let{form:t,fields:n,...r}=e;return{...r,group:t,fields:n}}function js(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 Ms(e,t){if(!t)return;let n=Object.assign({},e,{state:ds(e.state)});t(n),n.fieldInfo!==e.fieldInfo&&(e.fieldInfo=n.fieldInfo),n.options!==e.options&&(e.options=n.options);let r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((t,r)=>(e.state[r]!==n.state[r]&&(t[r]=n.state[r]),t),{});return I(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}var Ns=e(zt(),1);function Ps(e,t){return e===t}function V(e,t=e=>e,n){let r=n?.compare??Ps,i=(0,k.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,k.useCallback)(()=>e.get(),[e]);return(0,Ns.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var Fs=typeof window<`u`?k.useLayoutEffect:k.useEffect;function Is(e){let[t,n]=(0,k.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,k.useState)(()=>new Ss({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new Ss({...e}),i(a),n({form:e.form,name:e.name}));let o=V(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=V(a.store,e=>e.meta.isTouched),c=V(a.store,e=>e.meta.isBlurred),l=V(a.store,e=>e.meta.isDirty),u=V(a.store,e=>e.meta.errorMap),d=V(a.store,e=>e.meta.errorSourceMap),f=V(a.store,e=>e.meta.isValidating),p=(0,k.useMemo)(()=>({...a,get state(){return{value:e.mode===`array`?a.state.value:o,get meta(){return{...a.state.meta,isTouched:s,isBlurred:c,isDirty:l,errorMap:u,errorSourceMap:d,isValidating:f}}}}}),[a,e.mode,o,s,c,l,u,d,f]);return Fs(a.mount,[a]),Fs(()=>{a.update(e)}),p}var Ls=(({children:e,...t})=>{let n=Is(t),r=(0,k.useMemo)(()=>Uo(e,n),[e,n]);return(0,A.jsx)(A.Fragment,{children:r})});function Rs(){return(0,k.useState)(()=>ls())[0]}var zs=k,Bs=`19.2.8`.split(`.`)[0]===`17`?Rs:zs.useId;function Vs(e){let[t,n]=(0,k.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,k.useState)(()=>new Ds({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new Ds({...e})),n({form:e.form,name:e.name}));let a=V(r.store,e=>e.value),o=V(r.store,e=>e.meta.isTouched),s=V(r.store,e=>e.meta.isBlurred),c=V(r.store,e=>e.meta.isDirty),l=V(r.store,e=>e.meta.errorMap),u=V(r.store,e=>e.meta.errorSourceMap),d=V(r.store,e=>e.meta.isValidating),f=V(r.store,e=>e.meta.isSubmitting),p=V(r.store,e=>e.meta.isSubmitted),m=V(r.store,e=>e.meta.submissionAttempts),h=V(r.store,e=>e.meta.isSubmitSuccessful),g=V(r.store,e=>e.meta.canSubmit),_=V(r.store,e=>e.meta.isValid),v=V(r.store,e=>e.meta.isFieldsValid),y=V(r.store,e=>e.meta.isFieldsValidating),b=V(r.store,e=>e.meta.isGroupValid),x=(0,k.useMemo)(()=>({...r,handleSubmit:((...e)=>r._handleSubmit(...e)),get state(){return{...r.state,value:a,get meta(){return{...r.state.meta,isTouched:o,isBlurred:s,isDirty:c,errorMap:l,errorSourceMap:u,isValidating:d,isSubmitting:f,isSubmitted:p,submissionAttempts:m,isSubmitSuccessful:h,canSubmit:g,isValid:_,isFieldsValid:v,isFieldsValidating:y,isGroupValid:b}}}}}),[r,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b]);return Fs(r.mount,[r]),Fs(()=>{r.update(e)}),x}var Hs=(({children:e,...t})=>{let n=Vs(t),r=(0,k.useMemo)(()=>Uo(e,n),[e,n]);return(0,A.jsx)(A.Fragment,{children:r})});function Us({form:e,selector:t=e=>e,children:n}){let r=V(e.store,t);return(0,A.jsx)(A.Fragment,{children:Uo(n,r)})}function Ws(e){let t=Bs(),[n,r]=(0,k.useState)(e?.formId),[i,a]=(0,k.useState)(()=>new ys({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new ys({...e,formId:n})),r(n)}let o=(0,k.useMemo)(()=>{let e={...i,handleSubmit:((...e)=>i._handleSubmit(...e)),get formId(){return i._formId},get state(){return i.store.state}};return e.Field=function(e){return(0,A.jsx)(Ls,{...e,form:i})},e.FormGroup=function(e){return(0,A.jsx)(Hs,{...e,form:i})},e.Subscribe=function(e){return(0,A.jsx)(Us,{form:i,selector:e.selector,children:e.children})},e},[i]);Fs(i.mount,[]),Fs(()=>{i.update(e)});let s=(0,k.useRef)(!1);return Fs(()=>{s.current&&e?.transform&&Ms(i,e.transform)},[i,e?.transform]),Fs(()=>{s.current=!0}),o}var Gs;function H(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Ks=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},qs=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Gs=globalThis).__zod_globalConfig??(Gs.__zod_globalConfig={});var Js=globalThis.__zod_globalConfig;function Ys(e){return e&&Object.assign(Js,e),Js}function Xs(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Zs(e,t){return typeof t==`bigint`?t.toString():t}function Qs(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function $s(e){return e==null}function ec(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}var tc=Symbol(`evaluating`);function U(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==tc)return r===void 0&&(r=tc,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function nc(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function rc(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ic(e){return JSON.stringify(e)}function ac(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var oc=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function sc(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var cc=Qs(()=>{if(Js.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function lc(e){if(sc(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return sc(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function uc(e){return lc(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var dc=new Set([`string`,`number`,`symbol`]);function fc(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function pc(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function W(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function mc(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function hc(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return pc(e,rc(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return nc(this,`shape`,e),e},checks:[]}))}function gc(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return pc(e,rc(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return nc(this,`shape`,r),r},checks:[]}))}function _c(e,t){if(!lc(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return pc(e,rc(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return nc(this,`shape`,n),n}}))}function vc(e,t){if(!lc(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return pc(e,rc(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return nc(this,`shape`,n),n}}))}function yc(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return pc(e,rc(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return nc(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function bc(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return pc(t,rc(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return nc(this,`shape`,i),i},checks:[]}))}function xc(e,t,n){return pc(t,rc(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return nc(this,`shape`,i),i}}))}function Sc(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Cc(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function wc(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Tc(e){return typeof e==`string`?e:e?.message}function Ec(e,t,n){let r=e.message?e.message:Tc(e.inst?._zod.def?.error?.(e))??Tc(t?.error?.(e))??Tc(n.customError?.(e))??Tc(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Dc(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Oc(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var kc=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Zs,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ac=H(`$ZodError`,kc),jc=H(`$ZodError`,kc,{Parent:Error});function Mc(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Nc(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var Pc=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Ks;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ec(e,a,Ys())));throw oc(t,i?.callee),t}return o.value},Fc=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ec(e,a,Ys())));throw oc(t,i?.callee),t}return o.value},Ic=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Ks;return a.issues.length?{success:!1,error:new(e??Ac)(a.issues.map(e=>Ec(e,i,Ys())))}:{success:!0,data:a.value}},Lc=Ic(jc),Rc=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Ec(e,i,Ys())))}:{success:!0,data:a.value}},zc=Rc(jc),Bc=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Pc(e)(t,n,i)},Vc=e=>(t,n,r)=>Pc(e)(t,n,r),Hc=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Fc(e)(t,n,i)},Uc=e=>async(t,n,r)=>Fc(e)(t,n,r),Wc=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ic(e)(t,n,i)},Gc=e=>(t,n,r)=>Ic(e)(t,n,r),Kc=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Rc(e)(t,n,i)},qc=e=>async(t,n,r)=>Rc(e)(t,n,r),Jc=/^[cC][0-9a-z]{6,}$/,Yc=/^[0-9a-z]+$/,Xc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Zc=/^[0-9a-vA-V]{20}$/,Qc=/^[A-Za-z0-9]{27}$/,$c=/^[a-zA-Z0-9_-]{21}$/,el=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,tl=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,nl=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,rl=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,il=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function al(){return new RegExp(il,`u`)}var ol=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,sl=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,cl=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ll=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ul=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dl=/^[A-Za-z0-9_-]*$/,fl=/^https?$/,pl=/^\+[1-9]\d{6,14}$/,ml=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,hl=RegExp(`^${ml}$`);function gl(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function _l(e){return RegExp(`^${gl(e)}$`)}function vl(e){let t=gl({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${ml}T(?:${r})$`)}var yl=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},bl=/^[^A-Z]*$/,xl=/^[^a-z]*$/,G=H(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Sl=H(`$ZodCheckMaxLength`,(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!$s(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Dc(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Cl=H(`$ZodCheckMinLength`,(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!$s(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Dc(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),wl=H(`$ZodCheckLengthEquals`,(e,t)=>{var n;G.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!$s(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Dc(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Tl=H(`$ZodCheckStringFormat`,(e,t)=>{var n,r;G.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),El=H(`$ZodCheckRegex`,(e,t)=>{Tl.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Dl=H(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=bl,Tl.init(e,t)}),Ol=H(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=xl,Tl.init(e,t)}),kl=H(`$ZodCheckIncludes`,(e,t)=>{G.init(e,t);let n=fc(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Al=H(`$ZodCheckStartsWith`,(e,t)=>{G.init(e,t);let n=RegExp(`^${fc(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),jl=H(`$ZodCheckEndsWith`,(e,t)=>{G.init(e,t);let n=RegExp(`.*${fc(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Ml=H(`$ZodCheckOverwrite`,(e,t)=>{G.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Nl=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
4
4
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
5
5
  `))}},Pl={major:4,minor:4,patch:3},K=H(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Pl;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=Sc(e),i;for(let a of t){if(a._zod.def.when){if(Cc(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Ks;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Sc(e,t))});else{if(e.issues.length===t)continue;r||=Sc(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Sc(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Ks;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Ks;return o.then(e=>t(e,r,a))}return t(o,r,a)}}U(e,`~standard`,()=>({validate:t=>{try{let n=Lc(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return zc(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Fl=H(`$ZodString`,(e,t)=>{K.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??yl(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),q=H(`$ZodStringFormat`,(e,t)=>{Tl.init(e,t),Fl.init(e,t)}),Il=H(`$ZodGUID`,(e,t)=>{t.pattern??=tl,q.init(e,t)}),Ll=H(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=nl(e)}else t.pattern??=nl();q.init(e,t)}),Rl=H(`$ZodEmail`,(e,t)=>{t.pattern??=rl,q.init(e,t)}),zl=H(`$ZodURL`,(e,t)=>{q.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===fl.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),n.value=t.normalize?i.href:r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Bl=H(`$ZodEmoji`,(e,t)=>{t.pattern??=al(),q.init(e,t)}),Vl=H(`$ZodNanoID`,(e,t)=>{t.pattern??=$c,q.init(e,t)}),Hl=H(`$ZodCUID`,(e,t)=>{t.pattern??=Jc,q.init(e,t)}),Ul=H(`$ZodCUID2`,(e,t)=>{t.pattern??=Yc,q.init(e,t)}),Wl=H(`$ZodULID`,(e,t)=>{t.pattern??=Xc,q.init(e,t)}),Gl=H(`$ZodXID`,(e,t)=>{t.pattern??=Zc,q.init(e,t)}),Kl=H(`$ZodKSUID`,(e,t)=>{t.pattern??=Qc,q.init(e,t)}),ql=H(`$ZodISODateTime`,(e,t)=>{t.pattern??=vl(t),q.init(e,t)}),Jl=H(`$ZodISODate`,(e,t)=>{t.pattern??=hl,q.init(e,t)}),Yl=H(`$ZodISOTime`,(e,t)=>{t.pattern??=_l(t),q.init(e,t)}),Xl=H(`$ZodISODuration`,(e,t)=>{t.pattern??=el,q.init(e,t)}),Zl=H(`$ZodIPv4`,(e,t)=>{t.pattern??=ol,q.init(e,t),e._zod.bag.format=`ipv4`}),Ql=H(`$ZodIPv6`,(e,t)=>{t.pattern??=sl,q.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),$l=H(`$ZodCIDRv4`,(e,t)=>{t.pattern??=cl,q.init(e,t)}),eu=H(`$ZodCIDRv6`,(e,t)=>{t.pattern??=ll,q.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function tu(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var nu=H(`$ZodBase64`,(e,t)=>{t.pattern??=ul,q.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{tu(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function ru(e){if(!dl.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return tu(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var iu=H(`$ZodBase64URL`,(e,t)=>{t.pattern??=dl,q.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{ru(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),au=H(`$ZodE164`,(e,t)=>{t.pattern??=pl,q.init(e,t)});function ou(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var su=H(`$ZodJWT`,(e,t)=>{q.init(e,t),e._zod.check=n=>{ou(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),cu=H(`$ZodUnknown`,(e,t)=>{K.init(e,t),e._zod.parse=e=>e}),lu=H(`$ZodNever`,(e,t)=>{K.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function uu(e,t,n){e.issues.length&&t.issues.push(...wc(n,e.issues)),t.value[n]=e.value}var du=H(`$ZodArray`,(e,t)=>{K.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>uu(t,n,e))):uu(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function fu(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...wc(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function pu(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=mc(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function mu(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>fu(e,n,i,t,u,d))):fu(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var hu=H(`$ZodObject`,(e,t)=>{if(K.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=Qs(()=>pu(t));U(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=sc,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>fu(n,t,e,s,r,i))):fu(a,t,e,s,r,i)}return i?mu(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),gu=H(`$ZodObjectJIT`,(e,t)=>{hu.init(e,t);let n=e._zod.parse,r=Qs(()=>pu(t)),i=e=>{let t=new Nl([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=ic(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=ic(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
6
6
  if (${n}.issues.length) {
@@ -63,4 +63,4 @@ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$i as t,$o as n,Ao as
63
63
 
64
64
  `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=sc,s=!Js.jitless,c=s&&cc.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?mu([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function _u(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Sc(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Ec(e,r,Ys())))}),t)}var vu=H(`$ZodUnion`,(e,t)=>{K.init(e,t),U(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),U(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),U(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),U(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>ec(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>_u(t,r,e,i)):_u(o,r,e,i)}}),yu=H(`$ZodIntersection`,(e,t)=>{K.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>xu(e,t,n)):xu(e,i,a)}});function bu(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(lc(e)&&lc(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=bu(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=bu(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function xu(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Sc(e))return e;let o=bu(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Su=H(`$ZodEnum`,(e,t)=>{K.init(e,t);let n=Xs(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>dc.has(typeof e)).map(e=>typeof e==`string`?fc(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Cu=H(`$ZodTransform`,(e,t)=>{K.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new qs(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new Ks;return n.value=i,n.fallback=!0,n}});function wu(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Tu=H(`$ZodOptional`,(e,t)=>{K.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,U(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),U(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ec(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>wu(e,r)):wu(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Eu=H(`$ZodExactOptional`,(e,t)=>{Tu.init(e,t),U(e._zod,`values`,()=>t.innerType._zod.values),U(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Du=H(`$ZodNullable`,(e,t)=>{K.init(e,t),U(e._zod,`optin`,()=>t.innerType._zod.optin),U(e._zod,`optout`,()=>t.innerType._zod.optout),U(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ec(e.source)}|null)$`):void 0}),U(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Ou=H(`$ZodDefault`,(e,t)=>{K.init(e,t),e._zod.optin=`optional`,U(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>ku(e,t)):ku(r,t)}});function ku(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Au=H(`$ZodPrefault`,(e,t)=>{K.init(e,t),e._zod.optin=`optional`,U(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),ju=H(`$ZodNonOptional`,(e,t)=>{K.init(e,t),U(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Mu(t,e)):Mu(i,e)}});function Mu(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Nu=H(`$ZodCatch`,(e,t)=>{K.init(e,t),e._zod.optin=`optional`,U(e._zod,`optout`,()=>t.innerType._zod.optout),U(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Ec(e,n,Ys()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Ec(e,n,Ys()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Pu=H(`$ZodPipe`,(e,t)=>{K.init(e,t),U(e._zod,`values`,()=>t.in._zod.values),U(e._zod,`optin`,()=>t.in._zod.optin),U(e._zod,`optout`,()=>t.out._zod.optout),U(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Fu(e,t.in,n)):Fu(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Fu(e,t.out,n)):Fu(r,t.out,n)}});function Fu(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Iu=H(`$ZodReadonly`,(e,t)=>{K.init(e,t),U(e._zod,`propValues`,()=>t.innerType._zod.propValues),U(e._zod,`values`,()=>t.innerType._zod.values),U(e._zod,`optin`,()=>t.innerType?._zod?.optin),U(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Lu):Lu(r)}});function Lu(e){return e.value=Object.freeze(e.value),e}var Ru=H(`$ZodCustom`,(e,t)=>{G.init(e,t),K.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>zu(t,n,r,e));zu(i,n,r,e)}});function zu(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Oc(e))}}var Bu,Vu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Hu(){return new Vu}(Bu=globalThis).__zod_globalRegistry??(Bu.__zod_globalRegistry=Hu());var Uu=globalThis.__zod_globalRegistry;function Wu(e,t){return new e({type:`string`,...W(t)})}function Gu(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...W(t)})}function Ku(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...W(t)})}function qu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...W(t)})}function Ju(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...W(t)})}function Yu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...W(t)})}function Xu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...W(t)})}function Zu(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...W(t)})}function Qu(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...W(t)})}function $u(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...W(t)})}function ed(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...W(t)})}function td(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...W(t)})}function nd(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...W(t)})}function rd(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...W(t)})}function id(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...W(t)})}function ad(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...W(t)})}function od(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...W(t)})}function sd(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...W(t)})}function cd(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...W(t)})}function ld(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...W(t)})}function ud(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...W(t)})}function dd(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...W(t)})}function fd(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...W(t)})}function pd(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...W(t)})}function md(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...W(t)})}function hd(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...W(t)})}function gd(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...W(t)})}function _d(e){return new e({type:`unknown`})}function vd(e,t){return new e({type:`never`,...W(t)})}function yd(e,t){return new Sl({check:`max_length`,...W(t),maximum:e})}function bd(e,t){return new Cl({check:`min_length`,...W(t),minimum:e})}function xd(e,t){return new wl({check:`length_equals`,...W(t),length:e})}function Sd(e,t){return new El({check:`string_format`,format:`regex`,...W(t),pattern:e})}function Cd(e){return new Dl({check:`string_format`,format:`lowercase`,...W(e)})}function wd(e){return new Ol({check:`string_format`,format:`uppercase`,...W(e)})}function Td(e,t){return new kl({check:`string_format`,format:`includes`,...W(t),includes:e})}function Ed(e,t){return new Al({check:`string_format`,format:`starts_with`,...W(t),prefix:e})}function Dd(e,t){return new jl({check:`string_format`,format:`ends_with`,...W(t),suffix:e})}function Od(e){return new Ml({check:`overwrite`,tx:e})}function kd(e){return Od(t=>t.normalize(e))}function Ad(){return Od(e=>e.trim())}function jd(){return Od(e=>e.toLowerCase())}function Md(){return Od(e=>e.toUpperCase())}function Nd(){return Od(e=>ac(e))}function Pd(e,t,n){return new e({type:`array`,element:t,...W(n)})}function Fd(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...W(n)})}function Id(e,t){let n=Ld(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Oc(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Oc(r))}},e(t.value,t)),t);return n}function Ld(e,t){let n=new G({check:`custom`,...W(t)});return n._zod.check=e,n}function Rd(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Uu,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function J(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,J(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Y(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function zd(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
65
65
 
66
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Bd(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Hd(t,`input`,e.processors),output:Hd(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Y(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Y(r.element,n);if(r.type===`set`)return Y(r.valueType,n);if(r.type===`lazy`)return Y(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return Y(r.innerType,n);if(r.type===`intersection`)return Y(r.left,n)||Y(r.right,n);if(r.type===`record`||r.type===`map`)return Y(r.keyType,n)||Y(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Y(r.in,n)||Y(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Y(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Y(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Y(e,n))return!0;return!!(r.rest&&Y(r.rest,n))}return!1}var Vd=(e,t={})=>n=>{let r=Rd({...n,processors:t});return J(e,r),zd(r,e),Bd(r,e)},Hd=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Rd({...i??{},target:a,io:t,processors:n});return J(e,o),zd(o,e),Bd(o,e)},Ud={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Wd=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ud[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Gd=(e,t,n,r)=>{n.not={}},Kd=(e,t,n,r)=>{let i=e._zod.def,a=Xs(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},qd=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Jd=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Yd=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=J(a.element,t,{...r,path:[...r.path,`items`]})},Xd=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=J(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=J(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Zd=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>J(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Qd=(e,t,n,r)=>{let i=e._zod.def,a=J(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=J(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},$d=(e,t,n,r)=>{let i=e._zod.def,a=J(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},ef=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},tf=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},nf=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},rf=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},af=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;J(o,t,r);let s=t.seen.get(e);s.ref=o},of=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},sf=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},cf=H(`ZodISODateTime`,(e,t)=>{ql.init(e,t),Q.init(e,t)});function lf(e){return pd(cf,e)}var uf=H(`ZodISODate`,(e,t)=>{Jl.init(e,t),Q.init(e,t)});function df(e){return md(uf,e)}var ff=H(`ZodISOTime`,(e,t)=>{Yl.init(e,t),Q.init(e,t)});function pf(e){return hd(ff,e)}var mf=H(`ZodISODuration`,(e,t)=>{Xl.init(e,t),Q.init(e,t)});function hf(e){return gd(mf,e)}var X=H(`ZodError`,(e,t)=>{Ac.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Nc(e,t)},flatten:{value:t=>Mc(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Zs,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Zs,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),gf=Pc(X),_f=Fc(X),vf=Ic(X),yf=Rc(X),bf=Bc(X),xf=Vc(X),Sf=Hc(X),Cf=Uc(X),wf=Wc(X),Tf=Gc(X),Ef=Kc(X),Df=qc(X),Of=new WeakMap;function kf(e,t,n){let r=Object.getPrototypeOf(e),i=Of.get(r);if(i||(i=new Set,Of.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var Z=H(`ZodType`,(e,t)=>(K.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Hd(e,`input`),output:Hd(e,`output`)}}),e.toJSONSchema=Vd(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>gf(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>vf(e,t,n),e.parseAsync=async(t,n)=>_f(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>yf(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>bf(e,t,n),e.decode=(t,n)=>xf(e,t,n),e.encodeAsync=async(t,n)=>Sf(e,t,n),e.decodeAsync=async(t,n)=>Cf(e,t,n),e.safeEncode=(t,n)=>wf(e,t,n),e.safeDecode=(t,n)=>Tf(e,t,n),e.safeEncodeAsync=async(t,n)=>Ef(e,t,n),e.safeDecodeAsync=async(t,n)=>Df(e,t,n),kf(e,`ZodType`,{check(...e){let t=this.def;return this.clone(rc(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return pc(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Np(e,t))},superRefine(e,t){return this.check(Pp(e,t))},overwrite(e){return this.check(Od(e))},optional(){return hp(this)},exactOptional(){return _p(this)},nullable(){return yp(this)},nullish(){return hp(yp(this))},nonoptional(e){return Tp(this,e)},array(){return rp(this)},or(e){return sp([this,e])},and(e){return lp(this,e)},transform(e){return kp(this,pp(e))},default(e){return xp(this,e)},prefault(e){return Cp(this,e)},catch(e){return Dp(this,e)},pipe(e){return kp(this,e)},readonly(){return jp(this)},describe(e){let t=this.clone();return Uu.add(t,{description:e}),t},meta(...e){if(e.length===0)return Uu.get(this);let t=this.clone();return Uu.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return Uu.get(e)?.description},configurable:!0}),e)),Af=H(`_ZodString`,(e,t)=>{Fl.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wd(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,kf(e,`_ZodString`,{regex(...e){return this.check(Sd(...e))},includes(...e){return this.check(Td(...e))},startsWith(...e){return this.check(Ed(...e))},endsWith(...e){return this.check(Dd(...e))},min(...e){return this.check(bd(...e))},max(...e){return this.check(yd(...e))},length(...e){return this.check(xd(...e))},nonempty(...e){return this.check(bd(1,...e))},lowercase(e){return this.check(Cd(e))},uppercase(e){return this.check(wd(e))},trim(){return this.check(Ad())},normalize(...e){return this.check(kd(...e))},toLowerCase(){return this.check(jd())},toUpperCase(){return this.check(Md())},slugify(){return this.check(Nd())}})}),jf=H(`ZodString`,(e,t)=>{Fl.init(e,t),Af.init(e,t),e.email=t=>e.check(Gu(Nf,t)),e.url=t=>e.check(Zu(If,t)),e.jwt=t=>e.check(fd(Zf,t)),e.emoji=t=>e.check(Qu(Lf,t)),e.guid=t=>e.check(Ku(Pf,t)),e.uuid=t=>e.check(qu(Ff,t)),e.uuidv4=t=>e.check(Ju(Ff,t)),e.uuidv6=t=>e.check(Yu(Ff,t)),e.uuidv7=t=>e.check(Xu(Ff,t)),e.nanoid=t=>e.check($u(Rf,t)),e.guid=t=>e.check(Ku(Pf,t)),e.cuid=t=>e.check(ed(zf,t)),e.cuid2=t=>e.check(td(Bf,t)),e.ulid=t=>e.check(nd(Vf,t)),e.base64=t=>e.check(ld(Jf,t)),e.base64url=t=>e.check(ud(Yf,t)),e.xid=t=>e.check(rd(Hf,t)),e.ksuid=t=>e.check(id(Uf,t)),e.ipv4=t=>e.check(ad(Wf,t)),e.ipv6=t=>e.check(od(Gf,t)),e.cidrv4=t=>e.check(sd(Kf,t)),e.cidrv6=t=>e.check(cd(qf,t)),e.e164=t=>e.check(dd(Xf,t)),e.datetime=t=>e.check(lf(t)),e.date=t=>e.check(df(t)),e.time=t=>e.check(pf(t)),e.duration=t=>e.check(hf(t))});function Mf(e){return Wu(jf,e)}var Q=H(`ZodStringFormat`,(e,t)=>{q.init(e,t),Af.init(e,t)}),Nf=H(`ZodEmail`,(e,t)=>{Rl.init(e,t),Q.init(e,t)}),Pf=H(`ZodGUID`,(e,t)=>{Il.init(e,t),Q.init(e,t)}),Ff=H(`ZodUUID`,(e,t)=>{Ll.init(e,t),Q.init(e,t)}),If=H(`ZodURL`,(e,t)=>{zl.init(e,t),Q.init(e,t)}),Lf=H(`ZodEmoji`,(e,t)=>{Bl.init(e,t),Q.init(e,t)}),Rf=H(`ZodNanoID`,(e,t)=>{Vl.init(e,t),Q.init(e,t)}),zf=H(`ZodCUID`,(e,t)=>{Hl.init(e,t),Q.init(e,t)}),Bf=H(`ZodCUID2`,(e,t)=>{Ul.init(e,t),Q.init(e,t)}),Vf=H(`ZodULID`,(e,t)=>{Wl.init(e,t),Q.init(e,t)}),Hf=H(`ZodXID`,(e,t)=>{Gl.init(e,t),Q.init(e,t)}),Uf=H(`ZodKSUID`,(e,t)=>{Kl.init(e,t),Q.init(e,t)}),Wf=H(`ZodIPv4`,(e,t)=>{Zl.init(e,t),Q.init(e,t)}),Gf=H(`ZodIPv6`,(e,t)=>{Ql.init(e,t),Q.init(e,t)}),Kf=H(`ZodCIDRv4`,(e,t)=>{$l.init(e,t),Q.init(e,t)}),qf=H(`ZodCIDRv6`,(e,t)=>{eu.init(e,t),Q.init(e,t)}),Jf=H(`ZodBase64`,(e,t)=>{nu.init(e,t),Q.init(e,t)}),Yf=H(`ZodBase64URL`,(e,t)=>{iu.init(e,t),Q.init(e,t)}),Xf=H(`ZodE164`,(e,t)=>{au.init(e,t),Q.init(e,t)}),Zf=H(`ZodJWT`,(e,t)=>{su.init(e,t),Q.init(e,t)}),Qf=H(`ZodUnknown`,(e,t)=>{cu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function $f(){return _d(Qf)}var ep=H(`ZodNever`,(e,t)=>{lu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gd(e,t,n,r)});function tp(e){return vd(ep,e)}var np=H(`ZodArray`,(e,t)=>{du.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yd(e,t,n,r),e.element=t.element,kf(e,`ZodArray`,{min(e,t){return this.check(bd(e,t))},nonempty(e){return this.check(bd(1,e))},max(e,t){return this.check(yd(e,t))},length(e,t){return this.check(xd(e,t))},unwrap(){return this.element}})});function rp(e,t){return Pd(np,e,t)}var ip=H(`ZodObject`,(e,t)=>{gu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xd(e,t,n,r),U(e,`shape`,()=>t.shape),kf(e,`ZodObject`,{keyof(){return dp(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:$f()})},loose(){return this.clone({...this._zod.def,catchall:$f()})},strict(){return this.clone({...this._zod.def,catchall:tp()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return _c(this,e)},safeExtend(e){return vc(this,e)},merge(e){return yc(this,e)},pick(e){return hc(this,e)},omit(e){return gc(this,e)},partial(...e){return bc(mp,this,e[0])},required(...e){return xc(wp,this,e[0])}})});function ap(e,t){return new ip({type:`object`,shape:e??{},...W(t)})}var op=H(`ZodUnion`,(e,t)=>{vu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zd(e,t,n,r),e.options=t.options});function sp(e,t){return new op({type:`union`,options:e,...W(t)})}var cp=H(`ZodIntersection`,(e,t)=>{yu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qd(e,t,n,r)});function lp(e,t){return new cp({type:`intersection`,left:e,right:t})}var up=H(`ZodEnum`,(e,t)=>{Su.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kd(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new up({...t,checks:[],...W(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new up({...t,checks:[],...W(r),entries:i})}});function dp(e,t){return new up({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...W(t)})}var fp=H(`ZodTransform`,(e,t)=>{Cu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jd(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new qs(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Oc(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Oc(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function pp(e){return new fp({type:`transform`,transform:e})}var mp=H(`ZodOptional`,(e,t)=>{Tu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hp(e){return new mp({type:`optional`,innerType:e})}var gp=H(`ZodExactOptional`,(e,t)=>{Eu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _p(e){return new gp({type:`optional`,innerType:e})}var vp=H(`ZodNullable`,(e,t)=>{Du.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$d(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yp(e){return new vp({type:`nullable`,innerType:e})}var bp=H(`ZodDefault`,(e,t)=>{Ou.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function xp(e,t){return new bp({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():uc(t)}})}var Sp=H(`ZodPrefault`,(e,t)=>{Au.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cp(e,t){return new Sp({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():uc(t)}})}var wp=H(`ZodNonOptional`,(e,t)=>{ju.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ef(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Tp(e,t){return new wp({type:`nonoptional`,innerType:e,...W(t)})}var Ep=H(`ZodCatch`,(e,t)=>{Nu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Dp(e,t){return new Ep({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Op=H(`ZodPipe`,(e,t)=>{Pu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>af(e,t,n,r),e.in=t.in,e.out=t.out});function kp(e,t){return new Op({type:`pipe`,in:e,out:t})}var Ap=H(`ZodReadonly`,(e,t)=>{Iu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>of(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jp(e){return new Ap({type:`readonly`,innerType:e})}var Mp=H(`ZodCustom`,(e,t)=>{Ru.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qd(e,t,n,r)});function Np(e,t={}){return Fd(Mp,e,t)}function Pp(e,t){return Id(e,t)}function Fp({className:e,id:t,revealNonce:n,...r}){let[i,a]=(0,k.useState)(!1);(0,k.useEffect)(()=>{n!==void 0&&n>0&&a(!0)},[n]);let o=(0,k.useId)(),s=t??`password-${o}`,l=`${s}-visibility`,d=i?`text`:`password`;return(0,A.jsxs)(`div`,{className:`relative w-full min-w-0`,children:[(0,A.jsx)(u,{...r,id:s,type:d,inputMode:`text`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,className:c(`pr-10`,e)},d),(0,A.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),"aria-label":i?`Hide password`:`Show password`,"aria-pressed":i,"aria-controls":s,"aria-describedby":l,className:c(Qe,`absolute top-1/2 right-0 -translate-y-1/2`),children:(0,A.jsx)(E,{icon:i?Ve:bt,size:16,color:`currentColor`,strokeWidth:1.5,"aria-hidden":!0})}),(0,A.jsx)(`span`,{id:l,className:`sr-only`,"aria-live":`polite`,children:i?`Password is visible`:`Password is hidden`})]})}function Ip({className:e,...t}){return(0,A.jsx)(`label`,{"data-slot":`label`,className:c(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function Lp({className:e,...t}){return(0,A.jsx)(`div`,{"data-slot":`field-group`,className:c(`group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var Rp=ge(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function zp({className:e,orientation:t=`vertical`,...n}){return(0,A.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:c(Rp({orientation:t}),e),...n})}function Bp({className:e,...t}){return(0,A.jsx)(Ip,{"data-slot":`field-label`,className:c(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}function Vp({className:e,children:t,errors:n,...r}){let i=(0,k.useMemo)(()=>{if(t)return t;if(!n?.length)return null;let e=[...new Map(n.map(e=>[e?.message,e])).values()];return e?.length==1?e[0]?.message:(0,A.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:e.map((e,t)=>e?.message&&(0,A.jsx)(`li`,{children:e.message},t))})},[t,n]);return i?(0,A.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:c(`text-sm font-normal text-destructive`,e),...r,children:i}):null}var Hp=ap({email:Mf().email(`Enter a valid email.`),password:Mf().min(1,`Password is required.`)});function Up(...e){let t=e.filter(e=>typeof e==`string`&&e.length>0).join(` `);return t.length>0?t:void 0}function Wp(){return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`span`,{className:`text-destructive`,"aria-hidden":!0,children:[` `,`*`]}),(0,A.jsx)(`span`,{className:`sr-only`,children:` (required)`})]})}function Gp(){let e=p(),t=T(),n=He({from:`/`}),[r,i]=(0,k.useState)(null),a=Pt({mutationFn:async e=>{let t=await ne(e);if(t.error)throw Error(_e(t.error));if(!t.data)throw Error(`Empty login response`);return t.data},onSuccess:r=>{wt(r),i(null),e.invalidateQueries({queryKey:[`console.setup.status`]}),window.setTimeout(()=>{Ja(t,n.next)},650)},onError:e=>{i(e.message)}}),o=Ws({defaultValues:{email:``,password:``},validators:{onSubmit:Hp},onSubmit:async({value:e})=>{i(null),await a.mutateAsync(e)}});return(0,A.jsx)(po,{title:`Sign in`,status:{label:`Setup closed`},description:`Sign in with an existing operator account.`,footer:(0,A.jsx)(so,{type:`submit`,form:`login-form`,state:oo({pending:a.isPending,success:a.isSuccess,error:a.isError||r!==null}),loadingText:`Signing in`,successText:`Signed in`,errorText:`Try again`,children:`Sign in`}),children:({titleId:e,descriptionId:t})=>(0,A.jsxs)(`form`,{id:`login-form`,className:`flex flex-col`,autoComplete:`on`,noValidate:!0,"aria-labelledby":e,"aria-describedby":t,"aria-busy":a.isPending||void 0,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),o.handleSubmit()},children:[(0,A.jsxs)(Lp,{className:to,role:`group`,"aria-label":`Operator credentials`,children:[(0,A.jsx)(o.Field,{name:`email`,children:e=>{let t=e.state.meta.isTouched&&!e.state.meta.isValid,n=`${e.name}-error`;return(0,A.jsxs)(zp,{"data-invalid":t||void 0,className:no,children:[(0,A.jsxs)(Bp,{htmlFor:e.name,className:ao,children:[`Email`,(0,A.jsx)(Wp,{})]}),(0,A.jsx)(u,{id:e.name,name:e.name,type:`email`,inputMode:`email`,autoComplete:`username`,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value),placeholder:`Email`,"aria-invalid":t,"aria-required":!0,"aria-describedby":Up(t&&n),required:!0,className:ro}),t?(0,A.jsx)(Vp,{id:n,className:io,errors:e.state.meta.errors}):null]})}}),(0,A.jsx)(o.Field,{name:`password`,children:e=>{let t=e.state.meta.isTouched&&!e.state.meta.isValid,n=`${e.name}-error`;return(0,A.jsxs)(zp,{"data-invalid":t||void 0,className:no,children:[(0,A.jsxs)(Bp,{htmlFor:e.name,className:ao,children:[`Password`,(0,A.jsx)(Wp,{})]}),(0,A.jsx)(Fp,{id:e.name,name:e.name,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value),autoComplete:`current-password`,placeholder:`Password`,"aria-invalid":t,"aria-required":!0,"aria-describedby":Up(t&&n),required:!0,className:ro}),t?(0,A.jsx)(Vp,{id:n,className:io,errors:e.state.meta.errors}):null]})}})]}),r?(0,A.jsx)(`p`,{id:`login-form-error`,className:`px-5 py-3.5 text-sm text-destructive`,role:`alert`,"aria-live":`assertive`,children:r}):null]})})}function Kp(e){return e.claimSucceeded?`claim`:e.setupClosed?`login`:`claim`}var qp=/[^A-Za-z0-9]/,Jp={minLength:8,requireLetter:!0,requireNumber:!0,requireUppercase:!0,requireLowercase:!0,requireSpecial:!0};function Yp(e={}){return{minLength:e.minLength??Jp.minLength,requireLetter:e.requireLetter??Jp.requireLetter,requireNumber:e.requireNumber??Jp.requireNumber,requireUppercase:e.requireUppercase??Jp.requireUppercase,requireLowercase:e.requireLowercase??Jp.requireLowercase,requireSpecial:e.requireSpecial??Jp.requireSpecial}}function Xp(e){return qp.test(e)}function Zp(e,t={}){let n=Yp(t),r=[];if(e.length<n.minLength&&r.push(`minLength ${n.minLength} (got ${e.length})`),n.requireLetter&&!/[A-Za-z]/.test(e)&&r.push(`requireLetter`),n.requireUppercase&&!/[A-Z]/.test(e)&&r.push(`requireUppercase`),n.requireLowercase&&!/[a-z]/.test(e)&&r.push(`requireLowercase`),n.requireNumber&&!/\d/.test(e)&&r.push(`requireNumber`),n.requireSpecial&&!Xp(e)&&r.push(`requireSpecial`),r.length>0)throw new om(r)}var Qp=`ABCDEFGHJKLMNPQRSTUVWXYZ`,$p=`abcdefghijkmnpqrstuvwxyz`,em=`23456789`,tm=`!@#$%^&*-_=+?`;function nm(e={}){let t=Yp(e),n=e.length??Math.max(t.minLength,16);if(n<t.minLength)throw Error(`generatePassword: length ${n} is below minLength ${t.minLength}`);let r=[];t.requireUppercase&&r.push(Qp),t.requireLowercase&&r.push($p),t.requireLetter&&!t.requireUppercase&&!t.requireLowercase&&r.push(`ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz`),t.requireNumber&&r.push(em),t.requireSpecial&&r.push(tm);let i=r.length>0?r.join(``):`ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789`;if(n<r.length)throw Error(`generatePassword: length ${n} cannot cover ${r.length} classes`);let a=r.map(e=>rm(e));for(;a.length<n;)a.push(rm(i));im(a);let o=a.join(``);return Zp(o,t),o}function rm(e){return e[am(e.length)]??e[0]}function im(e){for(let t=e.length-1;t>0;t--){let n=am(t+1),r=e[t];e[t]=e[n],e[n]=r}}function am(e){if(!Number.isInteger(e)||e<=0)throw Error(`randomInt: maxExclusive must be a positive integer`);let t=e<=256?1:2,n=t===1?256:65536;if(e>n)throw Error(`randomInt: maxExclusive ${e} exceeds ${n}`);let r=n-n%e,i=new Uint8Array(t);for(;;){crypto.getRandomValues(i);let n=t===1?i[0]??0:(i[0]??0)<<8|(i[1]??0);if(n<r)return n%e}}var om=class extends Error{reasons;constructor(e){super(`password policy failed: ${e.join(`, `)}`),this.name=`PasswordPolicyError`,this.reasons=e}},sm={minLength:12,requireLetter:!0,requireNumber:!0,requireUppercase:!0,requireLowercase:!0,requireSpecial:!0};function cm(e){let t=Yp(sm);return[{id:`length`,label:`At least ${t.minLength} characters`,met:e.length>=t.minLength},{id:`uppercase`,label:`Contains an uppercase letter`,met:/[A-Z]/.test(e)},{id:`lowercase`,label:`Contains a lowercase letter`,met:/[a-z]/.test(e)},{id:`number`,label:`Contains a number`,met:/\d/.test(e)},{id:`special`,label:`Contains a special character`,met:Xp(e)}]}function lm(){return nm(sm)}function um({onGenerate:e,disabled:t,copyText:n=async e=>{await navigator.clipboard.writeText(e)}}){let[r,i]=(0,k.useState)(!1),a=(0,k.useRef)(null);return(0,k.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),(0,A.jsxs)(Et,{type:`button`,variant:`ghost`,size:`xs`,disabled:t,"data-slot":`generate-password`,"aria-label":r?`Password generated and copied`:`Generate a password and copy it`,className:`text-muted-foreground`,onClick:()=>{let t=lm();e(t),n(t).then(()=>{i(!0),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>i(!1),1600)}).catch(()=>{i(!1)})},children:[(0,A.jsx)(E,{icon:r?st:ke,"data-icon":`inline-start`,color:`currentColor`,strokeWidth:1.5,"aria-hidden":!0}),r?`Copied`:`Generate`]})}function dm(e){return cm(e)}function fm(e,t){if(e<=0)return{label:`Empty`,bar:`bg-muted-foreground/35`,text:`text-muted-foreground`};if(e===t)return{label:`Strong`,bar:`bg-emerald-500`,text:`text-emerald-600 dark:text-emerald-400`};let n=e/t;return n<=.4?{label:`Weak`,bar:`bg-destructive`,text:`text-destructive`}:n<=.6?{label:`Fair`,bar:`bg-amber-500`,text:`text-amber-600 dark:text-amber-400`}:{label:`Good`,bar:`bg-lime-500`,text:`text-lime-700 dark:text-lime-400`}}function pm({password:e,id:t=`password-strength`}){let n=dm(e),r=n.filter(e=>e.met).length,i=Math.round(r/n.length*100),a=fm(r,n.length),o=e.length===0;return(0,A.jsxs)(`div`,{id:t,className:`flex flex-col gap-3`,"aria-live":`polite`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,A.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,id:`${t}-label`,children:`Password strength`}),(0,A.jsx)(`p`,{className:c(`text-xs tabular-nums font-medium`,o?`text-muted-foreground`:a.text),"aria-hidden":!0,children:o?`0/${n.length}`:`${a.label} · ${r}/${n.length}`})]}),(0,A.jsx)(`div`,{role:`progressbar`,"aria-labelledby":`${t}-label`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i,"aria-valuetext":o?`No password entered`:`${a.label}: ${r} of ${n.length} requirements met`,className:`h-2 w-full overflow-hidden rounded-full bg-muted`,children:(0,A.jsx)(`div`,{className:c(`h-full rounded-full transition-[width,background-color] duration-200 ease-out`,o?`bg-muted-foreground/35`:a.bar),style:{width:`${o?0:Math.max(i,r>0?12:0)}%`}})})]}),(0,A.jsx)(`ul`,{className:`flex flex-col gap-1.5`,"aria-label":`Password requirements`,children:n.map(e=>(0,A.jsxs)(`li`,{className:c(`flex items-center gap-2 text-xs transition-colors`,e.met?`text-foreground`:`text-muted-foreground`),children:[(0,A.jsx)(E,{icon:e.met?v:Ce,size:14,color:`currentColor`,strokeWidth:1.5,className:c(e.met?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground/60`),"aria-hidden":!0}),(0,A.jsxs)(`span`,{children:[(0,A.jsx)(`span`,{className:`sr-only`,children:e.met?`Met: `:`Not met: `}),e.label]})]},e.id))})]})}var mm=ap({claimCode:Mf().min(1,`Claim code is required.`),name:Mf().min(1,`Name is required.`),email:Mf().email(`Enter a valid email.`),password:Mf().min(12,`Password must be at least 12 characters.`).refine(e=>cm(e).every(e=>e.met),{message:`Password needs uppercase, lowercase, a number, and a special character.`})});function hm(...e){let t=e.filter(e=>typeof e==`string`&&e.length>0).join(` `);return t.length>0?t:void 0}function gm(){return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`span`,{className:`text-destructive`,"aria-hidden":!0,children:[` `,`*`]}),(0,A.jsx)(`span`,{className:`sr-only`,children:` (required)`})]})}function _m({children:e}){return(0,A.jsx)(yo,{children:e})}function vm(){let e=p(),t=T(),n=He({from:`/`}),[r,a]=(0,k.useState)(null),[o,s]=(0,k.useState)(0),l=ae({queryKey:[`console.setup.status`],queryFn:async()=>{let e=await De();if(e.error)throw Error(_e(e.error));if(!e.data)throw Error(`Empty setup status`);return e.data},retry:2});(0,k.useEffect)(()=>{l.data?.claimRequired&&i(null)},[l.data?.claimRequired]);let d=Pt({mutationFn:async e=>{let t=await be(e);if(t.error)throw Error(_e(t.error));if(!t.data)throw Error(`Empty claim response`);return t.data},onSuccess:r=>{wt(r),a(null),e.setQueryData([`console.setup.status`],{setupClosed:!0,claimRequired:!1}),window.setTimeout(()=>{Ja(t,n.next)},650)},onError:e=>{a(e.message)}}),f=Ws({defaultValues:{claimCode:``,name:``,email:``,password:``},validators:{onSubmit:mm},onSubmit:async({value:e})=>{a(null),await d.mutateAsync(e)}});return l.isLoading?(0,A.jsx)(_m,{children:(0,A.jsx)(mo,{})}):l.isError?(0,A.jsx)(_m,{children:(0,A.jsx)(po,{title:`Console unreachable`,status:{label:`Offline`,tone:`alert`},description:`Could not reach the setup API.`,children:(0,A.jsx)(`p`,{className:`px-5 pb-6 text-sm text-muted-foreground`,role:`alert`,children:l.error instanceof Error?l.error.message:`Is the Console kernel running on :6533?`})})}):Kp({setupClosed:l.data?.setupClosed===!0,claimSucceeded:d.isSuccess})===`login`?(0,A.jsx)(_m,{children:(0,A.jsx)(Gp,{})}):(0,A.jsx)(_m,{children:(0,A.jsx)(po,{title:`First admin`,status:{label:`Setup open`,tone:`open`},description:"Enter the claim code from the `oke dev` board, or run `oke console claim-code`. This wizard closes permanently after the first operator.",footer:(0,A.jsx)(so,{type:`submit`,form:`claim-form`,state:oo({pending:d.isPending,success:d.isSuccess,error:d.isError||r!==null}),loadingText:`Creating`,successText:`Created`,errorText:`Try again`,children:`Create admin account`}),children:({titleId:e,descriptionId:t})=>(0,A.jsxs)(`form`,{id:`claim-form`,className:`flex flex-col`,autoComplete:`off`,noValidate:!0,"aria-labelledby":e,"aria-describedby":t,"aria-busy":d.isPending||void 0,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),f.handleSubmit()},children:[(0,A.jsxs)(Lp,{className:to,role:`group`,"aria-label":`First admin details`,children:[(0,A.jsx)(f.Field,{name:`claimCode`,children:e=>{let t=e.state.meta.isTouched&&!e.state.meta.isValid,n=`${e.name}-error`;return(0,A.jsxs)(zp,{"data-invalid":t||void 0,className:no,children:[(0,A.jsxs)(Bp,{htmlFor:e.name,className:ao,children:[`Claim code`,(0,A.jsx)(gm,{})]}),(0,A.jsx)(u,{id:e.name,name:e.name,type:`text`,inputMode:`text`,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value),autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,placeholder:`Claim code`,"aria-invalid":t,"aria-required":!0,"aria-describedby":hm(t&&n),required:!0,className:ro}),t?(0,A.jsx)(Vp,{id:n,className:io,errors:e.state.meta.errors}):null]})}}),(0,A.jsx)(f.Field,{name:`name`,children:e=>{let t=e.state.meta.isTouched&&!e.state.meta.isValid,n=`${e.name}-error`;return(0,A.jsxs)(zp,{"data-invalid":t||void 0,className:no,children:[(0,A.jsxs)(Bp,{htmlFor:e.name,className:ao,children:[`Name`,(0,A.jsx)(gm,{})]}),(0,A.jsx)(u,{id:e.name,name:e.name,type:`text`,autoComplete:`name`,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value),placeholder:`Name`,"aria-invalid":t,"aria-required":!0,"aria-describedby":hm(t&&n),required:!0,className:ro}),t?(0,A.jsx)(Vp,{id:n,className:io,errors:e.state.meta.errors}):null]})}}),(0,A.jsx)(f.Field,{name:`email`,children:e=>{let t=e.state.meta.isTouched&&!e.state.meta.isValid,n=`${e.name}-error`;return(0,A.jsxs)(zp,{"data-invalid":t||void 0,className:no,children:[(0,A.jsxs)(Bp,{htmlFor:e.name,className:ao,children:[`Email`,(0,A.jsx)(gm,{})]}),(0,A.jsx)(u,{id:e.name,name:e.name,type:`email`,inputMode:`email`,autoComplete:`email`,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value),placeholder:`Email`,"aria-invalid":t,"aria-required":!0,"aria-describedby":hm(t&&n),required:!0,className:ro}),t?(0,A.jsx)(Vp,{id:n,className:io,errors:e.state.meta.errors}):null]})}}),(0,A.jsx)(f.Field,{name:`password`,children:e=>{let t=e.state.meta.isTouched&&!e.state.meta.isValid,n=`${e.name}-strength`,r=`${e.name}-error`;return(0,A.jsxs)(zp,{"data-invalid":t||void 0,className:c(no,`items-start`),children:[(0,A.jsxs)(`div`,{className:`flex flex-col items-start gap-1.5 pt-1.5`,children:[(0,A.jsxs)(Bp,{htmlFor:e.name,className:ao,children:[`Password`,(0,A.jsx)(gm,{})]}),(0,A.jsx)(um,{disabled:d.isPending,onGenerate:t=>{e.handleChange(t),s(e=>e+1)}})]}),(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,A.jsx)(Fp,{id:e.name,name:e.name,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value),revealNonce:o,minLength:12,autoComplete:`new-password`,placeholder:`Password`,"aria-invalid":t,"aria-required":!0,"aria-describedby":hm(n,t&&r),required:!0,className:ro}),(0,A.jsx)(pm,{id:n,password:e.state.value}),t?(0,A.jsx)(Vp,{id:r,errors:e.state.meta.errors}):null]})]})}})]}),r?(0,A.jsx)(`p`,{id:`claim-form-error`,className:`px-5 py-3.5 text-sm text-destructive`,role:`alert`,"aria-live":`assertive`,children:r}):null]})})})}var ym=`okengine Console`,bm={"/overview":`Overview`,"/flows":`Flows`,"/store":`Store`,"/observability":`Observability`,"/vault":`Vault`,"/access":`Access`,"/monitoring":`Observability`};function xm(e){if(e===`/`||e===``)return ym;let t=bm[e];return t?`${t} · ${ym}`:`Not found · ${ym}`}function Sm(){let e=zi({select:e=>e.location.pathname});return(0,k.useEffect)(()=>{document.title=xm(e)},[e]),null}var Cm=768;function wm(){let[e,t]=k.useState(void 0);return k.useEffect(()=>{let e=window.matchMedia(`(max-width: 767px)`),n=()=>{t(window.innerWidth<Cm)};return e.addEventListener(`change`,n),t(window.innerWidth<Cm),()=>e.removeEventListener(`change`,n)},[]),!!e}var Tm=`sidebar_state`,Em=604800,Dm=`16rem`,Om=`18rem`,km=`3rem`,Am=`b`,jm=k.createContext(null);function Mm(){let e=k.useContext(jm);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Nm({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=wm(),[l,u]=k.useState(!1),[d,f]=k.useState(e),p=t??d,m=k.useCallback(e=>{let t=typeof e==`function`?e(p):e;n?n(t):f(t),document.cookie=`${Tm}=${t}; path=/; max-age=${Em}`},[n,p]),h=k.useCallback(()=>s?u(e=>!e):m(e=>!e),[s,m,u]);k.useEffect(()=>{let e=e=>{e.key===Am&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),h())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h]);let g=p?`expanded`:`collapsed`,_=k.useMemo(()=>({state:g,open:p,setOpen:m,isMobile:s,openMobile:l,setOpenMobile:u,toggleSidebar:h}),[g,p,m,s,l,u,h]);return(0,A.jsx)(jm.Provider,{value:_,children:(0,A.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{"--sidebar-width":Dm,"--sidebar-width-icon":km,...i},className:c(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...o,children:a})})}function Pm({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,dir:a,...o}){let{isMobile:s,state:l,openMobile:u,setOpenMobile:d}=Mm();return n===`none`?(0,A.jsx)(`div`,{"data-slot":`sidebar`,className:c(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),...o,children:i}):s?(0,A.jsx)(Ze,{open:u,onOpenChange:d,...o,children:(0,A.jsxs)(lt,{dir:a,"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden`,style:{"--sidebar-width":Om},side:e,children:[(0,A.jsxs)(it,{className:`sr-only`,children:[(0,A.jsx)(yt,{children:`Sidebar`}),(0,A.jsx)(gt,{children:`Displays the mobile sidebar.`})]}),(0,A.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})]})}):(0,A.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":l,"data-collapsible":l===`collapsed`?n:``,"data-variant":t,"data-side":e,"data-slot":`sidebar`,children:[(0,A.jsx)(`div`,{"data-slot":`sidebar-gap`,className:c(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)}),(0,A.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":e,className:c(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...o,children:(0,A.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:i})})]})}function Fm({className:e,onClick:t,...n}){let{toggleSidebar:r}=Mm();return(0,A.jsxs)(Et,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,className:c(e),onClick:e=>{t?.(e),r()},...n,children:[(0,A.jsx)(E,{icon:Ae,className:`cn-rtl-flip`}),(0,A.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})}function Im({className:e,...t}){return(0,A.jsx)(`main`,{"data-slot":`sidebar-inset`,className:c(`relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,e),...t})}function Lm({className:e,...t}){return(0,A.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:c(`flex flex-col gap-2 p-2`,e),...t})}function Rm({className:e,...t}){return(0,A.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:c(`flex flex-col gap-2 p-2`,e),...t})}function zm({className:e,...t}){return(0,A.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:c(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function Bm({className:e,...t}){return(0,A.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:c(`relative flex w-full min-w-0 flex-col p-2`,e),...t})}function Vm({className:e,render:t,...n}){return _n({defaultTagName:`div`,props:ie({className:c(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,e)},n),render:t,state:{slot:`sidebar-group-label`,sidebar:`group-label`}})}function Hm({className:e,...t}){return(0,A.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:c(`flex w-full min-w-0 flex-col gap-0`,e),...t})}function Um({className:e,...t}){return(0,A.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:c(`group/menu-item relative`,e),...t})}var Wm=ge(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm text-muted-foreground ring-sidebar-ring outline-hidden transition-[width,height,padding,color] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function Gm({render:e,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...o}){let{isMobile:s,state:l}=Mm(),u=_n({defaultTagName:`button`,props:ie({className:c(Wm({variant:n,size:r}),a)},o),render:i?(0,A.jsx)(te,{render:e}):e,state:{slot:`sidebar-menu-button`,sidebar:`menu-button`,size:r,active:t}});return i?(typeof i==`string`&&(i={children:i}),(0,A.jsxs)(ce,{children:[u,(0,A.jsx)(f,{side:`right`,align:`center`,hidden:l!==`collapsed`||s,...i})]})):u}var Km=`rounded-none! justify-center data-active:bg-muted/70! data-active:text-foreground group-data-[collapsible=icon]:h-10! group-data-[collapsible=icon]:w-full! group-data-[collapsible=icon]:p-0!`;function qm({onFast:e,onSettings:t,onLogout:n}){let{isMobile:r,setOpenMobile:i}=Mm(),a=()=>{r&&i(!1)};return(0,A.jsxs)(Hm,{className:`items-stretch gap-0`,children:[(0,A.jsx)(Jm,{label:`Fast`,keys:yn(`fast`),icon:ee,slot:`sidebar-fast`,onClick:()=>{a(),e()}}),(0,A.jsx)(Jm,{label:`Settings`,keys:yn(`settings`),icon:m,slot:`sidebar-settings`,onClick:()=>{a(),t()}}),(0,A.jsx)(Jm,{label:`Logout`,keys:yn(`logout`),icon:nt,slot:`sidebar-logout`,danger:!0,onClick:()=>{a(),n()}})]})}function Jm({label:e,keys:t,icon:n,slot:r,danger:i,onClick:a}){return(0,A.jsx)(Um,{className:`w-full`,children:(0,A.jsxs)(Gm,{tooltip:t?{children:(0,A.jsx)(ot,{label:e,keys:t})}:e,onClick:a,"data-slot":r,className:c(Km,i?`hover:bg-destructive/10! hover:text-destructive`:`hover:bg-muted/50! hover:text-foreground`),children:[(0,A.jsx)(E,{icon:n}),(0,A.jsx)(`span`,{className:`sr-only`,children:e})]})})}var Ym=[`/overview`,`/flows`,`/store`,`/observability`,`/vault`,`/access`],Xm=`oke.console.last-module-search`;function Zm(e){return Ym.includes(e)}function Qm(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:{...e}}function $m(e,t){if(e===void 0)return Object.keys(t).length===0;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>e[n]===t[n])}function eh(e,t,n){let r=t===`/monitoring`?`/observability`:t;return!Zm(r)||$m(e[r],n)?e:{...e,[r]:{...n}}}function th(e,t){return e[t]??{}}function nh(e){if(e===null||e.length===0)return{};try{let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))return{};let n={},r=t;for(let e of Ym){let t=r[e];t&&typeof t==`object`&&!Array.isArray(t)&&(n[e]={...t})}let i=r[`/monitoring`];return n[`/observability`]===void 0&&i&&typeof i==`object`&&!Array.isArray(i)&&(n[`/observability`]={...i}),n}catch{return{}}}function rh(e=ah()){if(!e)return{};try{return nh(e.getItem(Xm))}catch{return{}}}function ih(e,t=ah()){if(t)try{t.setItem(Xm,JSON.stringify(e))}catch{}}function ah(){try{return typeof sessionStorage>`u`?null:sessionStorage}catch{return null}}function oh(){let e=zi({select:e=>({pathname:e.location.pathname,search:e.location.search})}),[t,n]=(0,k.useState)(rh);return(0,k.useEffect)(()=>{if(!Zm(e.pathname))return;let t=Qm(e.search);n(n=>{let r=eh(n,e.pathname,t);return r===n?n:(ih(r),r)})},[e.pathname,e.search]),t}var sh=`rounded-none! justify-center hover:bg-muted/50! hover:text-foreground data-active:bg-muted/70! data-active:text-foreground group-data-[collapsible=icon]:h-10! group-data-[collapsible=icon]:w-full! group-data-[collapsible=icon]:p-0!`,ch=[{title:`Overview`,to:`/overview`,icon:Ge,shortcut:`overview`},{title:`Flows`,to:`/flows`,icon:S,shortcut:`flows`},{title:`Store`,to:`/store`,icon:tt,shortcut:`store`},{title:`Observability`,to:`/observability`,icon:Ee,shortcut:`observability`},{title:`Vault`,to:`/vault`,icon:ye,shortcut:`vault`},{title:`Access`,to:`/access`,icon:me,shortcut:`access`}];function lh(){return(0,A.jsx)(`div`,{className:`flex w-full items-center justify-center px-0`,children:(0,A.jsx)(vo,{className:`size-5`})})}function uh({onFast:e,onSettings:t,onLogout:n,...r}){let i=zi({select:e=>e.location.pathname}),a=oh();return(0,A.jsxs)(Pm,{collapsible:`icon`,...r,children:[(0,A.jsx)(Lm,{className:`h-10 justify-center border-b border-border/60 p-0`,children:(0,A.jsx)(lh,{})}),(0,A.jsx)(zm,{children:(0,A.jsxs)(Bm,{className:`items-stretch p-0`,children:[(0,A.jsx)(Vm,{children:`Console`}),(0,A.jsx)(Hm,{className:`items-stretch gap-0`,children:ch.map(e=>(0,A.jsx)(Um,{className:`w-full`,children:(0,A.jsxs)(Gm,{render:(0,A.jsx)(nn,{to:e.to,search:th(a,e.to)}),isActive:i===e.to,tooltip:{children:(0,A.jsx)(ot,{label:e.title,keys:yn(e.shortcut)})},className:sh,children:[(0,A.jsx)(E,{icon:e.icon}),(0,A.jsx)(`span`,{className:`sr-only`,children:e.title})]})},e.to))})]})}),(0,A.jsx)(Rm,{className:`border-t border-border/60 p-0`,children:(0,A.jsx)(qm,{onFast:e,onSettings:t,onLogout:n})})]})}var dh=[{title:`Overview`,to:`/overview`,icon:Ge,keywords:[`home`,`traces`],shortcut:`overview`},{title:`Flows`,to:`/flows`,icon:S,keywords:[`units`,`call`],shortcut:`flows`},{title:`Store`,to:`/store`,icon:tt,keywords:[`sql`,`kv`,`files`],shortcut:`store`},{title:`Observability`,to:`/observability`,icon:Ee,keywords:[`runs`,`metrics`,`monitoring`],shortcut:`observability`},{title:`Vault`,to:`/vault`,icon:ye,keywords:[`secrets`,`contracts`],shortcut:`vault`},{title:`Access`,to:`/access`,icon:me,keywords:[`keys`,`api`,`scopes`],shortcut:`access`}];function fh(e){let n=dh.map(t=>({id:`go:${t.to}`,label:t.title,group:`Navigate`,keys:yn(t.shortcut),keywords:t.keywords,icon:t.icon,onSelect:()=>e.go(t.to,th(e.memory,t.to))})),r=[{id:`theme:light`,label:`Light`,group:`Appearance`,keywords:[`theme`,`day`],icon:t,onSelect:()=>e.setTheme(`light`)},{id:`theme:dark`,label:`Dark`,group:`Appearance`,keywords:[`theme`,`night`],icon:ue,onSelect:()=>e.setTheme(`dark`)},{id:`theme:system`,label:`System`,group:`Appearance`,keywords:[`theme`,`auto`],icon:mt,onSelect:()=>e.setTheme(`system`)}],i=[{id:`settings`,label:`Settings`,group:`Account`,keys:yn(`settings`),keywords:[`preferences`,`operator`],icon:m,onSelect:e.openSettings},{id:`logout`,label:`Logout`,group:`Account`,keys:yn(`logout`),keywords:[`sign out`,`exit`],icon:nt,onSelect:e.logout}];return[...n,...r,...i]}var ph=e(Ft(),1);function mh(e,t){if(e.length===0)return!0;let n=e.toLowerCase(),r=t.toLowerCase(),i=0;for(let e of r)if(e===n[i]&&(i+=1),i===n.length)return!0;return!1}function hh(e,t){return t.length===0?e:e.filter(e=>[e.label,e.group??``,...e.keywords??[]].some(e=>mh(t,e)))}var gh=`h-auto min-w-0 bg-transparent px-0 font-mono text-[10px] tracking-[0.08em] text-muted-foreground`,_h={type:`spring`,stiffness:560,damping:40,mass:.5};function vh({items:e,shortcut:t=`k`,placeholder:n=`Type a command or search…`,emptyMessage:r=`No results found.`,open:i,onOpenChange:a}){let[o,s]=(0,k.useState)(!1),l=i!==void 0,u=l?i:o,d=(0,k.useCallback)(e=>{l||s(e),a?.(e)},[l,a]),[f,p]=(0,k.useState)(``),[m,h]=(0,k.useState)(0),[g,_]=(0,k.useState)(!1);(0,k.useEffect)(()=>_(!0),[]);let v=(0,k.useId)(),y=fn(),b=(0,k.useCallback)(e=>{p(e),h(0)},[]),x=(0,k.useRef)(null),S=(0,k.useRef)(null);(0,k.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===t.toLowerCase()){e.preventDefault(),d(!u);return}e.key===`Escape`&&u&&(e.preventDefault(),d(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[u,t,d]),(0,k.useEffect)(()=>{u&&(b(``),h(0),requestAnimationFrame(()=>x.current?.focus()))},[u,b]),(0,k.useEffect)(()=>{if(!u)return;let e=document.documentElement,t=e.style.overflow,n=document.body.style.overflow;return e.style.overflow=`hidden`,document.body.style.overflow=`hidden`,()=>{e.style.overflow=t,document.body.style.overflow=n}},[u]);let C=(0,k.useMemo)(()=>hh(e,f),[e,f]),ee=(0,k.useMemo)(()=>e.some(e=>e.icon!==void 0),[e]),te=(0,k.useMemo)(()=>{let e=new Map;for(let t of C){let n=t.group??`Results`,r=e.get(n)??[];r.push(t),e.set(n,r)}return Array.from(e.entries())},[C]),ne=e=>{if(C.length!==0){if(e.key===`ArrowDown`)e.preventDefault(),h(e=>Math.min(C.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),h(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=C[m];t&&(t.onSelect(),d(!1))}}};if((0,k.useEffect)(()=>{u&&(S.current?.querySelector(`[data-index="${m}"]`))?.scrollIntoView({block:`nearest`})},[m,u]),!g)return null;let re=0,ie=vn(t.toUpperCase());return(0,ph.createPortal)((0,A.jsxs)(`div`,{"aria-hidden":!u,inert:!u,"data-slot":`command-palette`,className:c(`fixed inset-0 z-100 flex items-start justify-center px-4 pt-[12vh]`,u?`pointer-events-auto`:`pointer-events-none`),children:[(0,A.jsx)(pn.button,{type:`button`,"aria-label":`Close command palette`,initial:!1,animate:{opacity:+!!u},transition:{duration:u?.18:.12},onClick:()=>d(!1),className:c(`absolute inset-0 bg-black/20`,u?`pointer-events-auto`:`pointer-events-none`)}),(0,A.jsxs)(pn.div,{role:`dialog`,"aria-modal":`true`,"aria-label":`Command palette`,initial:!1,animate:{opacity:+!!u,y:u||y?0:-8,scale:u||y?1:.97},transition:y?{duration:.1}:u?_h:{duration:.12},onKeyDown:ne,className:c(`relative w-full max-w-xl overflow-hidden rounded-none border border-border bg-popover text-popover-foreground shadow-lg will-change-transform`,u?`pointer-events-auto`:`pointer-events-none`),children:[(0,A.jsxs)(`div`,{className:ze,children:[(0,A.jsx)(`span`,{className:c(Ie,`pointer-events-none`),children:(0,A.jsx)(E,{icon:xe,className:ut})}),(0,A.jsx)(`input`,{ref:x,value:f,onChange:e=>b(e.target.value),placeholder:n,tabIndex:u?0:-1,role:`combobox`,"aria-expanded":u,"aria-controls":`${v}-list`,"aria-activedescendant":C.length>0?`${v}-opt-${m}`:void 0,"aria-autocomplete":`list`,className:ft}),(0,A.jsxs)(`span`,{className:`flex h-full shrink-0 items-center gap-2 pr-2`,children:[(0,A.jsx)(`span`,{className:`inline-flex items-center gap-0.5`,children:ie.map(e=>(0,A.jsx)(ht,{className:gh,children:e},e))}),(0,A.jsx)(ht,{className:gh,children:`Esc`})]})]}),(0,A.jsx)(`div`,{ref:S,id:`${v}-list`,role:`listbox`,"aria-label":`Commands`,className:`max-h-[60vh] overflow-y-auto overscroll-contain`,children:C.length===0?(0,A.jsx)(`p`,{className:_t,children:r}):te.map(([e,t])=>(0,A.jsxs)(`div`,{className:`border-b border-border/60 last:border-b-0`,children:[(0,A.jsx)(`div`,{"aria-hidden":!0,className:c(Ot,`px-2 py-1.5`),children:e}),t.map(e=>{let t=re;re+=1;let n=t===m,r=e.icon;return(0,A.jsxs)(`button`,{type:`button`,id:`${v}-opt-${t}`,role:`option`,"aria-selected":n,"data-index":t,onMouseEnter:()=>h(t),onClick:()=>{e.onSelect(),d(!1)},tabIndex:u?0:-1,className:c(Ue,`border-b-0`,n&&`bg-muted/70 text-foreground`),children:[n?(0,A.jsx)(`span`,{className:c(xt,at)}):null,r?(0,A.jsx)(E,{icon:r,className:`relative z-10 size-3.5 shrink-0 text-muted-foreground`}):ee?(0,A.jsx)(`span`,{className:`size-3.5 shrink-0`}):null,(0,A.jsx)(`span`,{className:`relative z-10 min-w-0 flex-1 truncate`,children:e.label}),e.badge?(0,A.jsx)(`span`,{className:`relative z-10 shrink-0 text-[10px] text-muted-foreground`,children:e.badge}):null,e.keys&&e.keys.length>0?(0,A.jsx)(vt,{keys:e.keys,className:`relative z-10`}):e.hint?(0,A.jsx)(`span`,{className:`relative z-10 shrink-0 text-[10px] text-muted-foreground`,children:e.hint}):null]},e.id)})]},e))})]})]}),document.body)}function yh({...e}){return(0,A.jsx)(We,{"data-slot":`dialog`,...e})}function bh({...e}){return(0,A.jsx)(Ye,{"data-slot":`dialog-portal`,...e})}function xh({className:e,...t}){return(0,A.jsx)(Le,{"data-slot":`dialog-overlay`,className:c(`fixed inset-0 z-50 bg-black/20 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs`,e),...t})}function Sh({className:e,children:t,...n}){return(0,A.jsxs)(bh,{children:[(0,A.jsx)(xh,{}),(0,A.jsx)(Ne,{"data-slot":`dialog-content`,className:c(`fixed top-1/2 left-1/2 z-50 w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-none border border-border bg-popover text-sm text-popover-foreground shadow-lg outline-none transition duration-150 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0`,e),...n,children:t})]})}function Ch({className:e,...t}){return(0,A.jsx)(`div`,{"data-slot":`dialog-header`,className:c(`flex flex-col gap-1 border-b border-border/60 px-4 py-3`,e),...t})}function wh({className:e,...t}){return(0,A.jsx)(Be,{"data-slot":`dialog-title`,className:c(`text-sm font-medium text-foreground`,e),...t})}function Th({className:e,...t}){return(0,A.jsx)(kt,{"data-slot":`dialog-description`,className:c(`text-[11px] text-muted-foreground`,e),...t})}function Eh({open:e,onOpenChange:t,operator:n}){return(0,A.jsx)(yh,{open:e,onOpenChange:t,children:(0,A.jsxs)(Sh,{"data-slot":`settings-dialog`,children:[(0,A.jsxs)(Ch,{children:[(0,A.jsx)(wh,{children:`Settings`}),(0,A.jsx)(Th,{children:`Operator account and appearance.`})]}),(0,A.jsxs)(`dl`,{className:`flex flex-col`,children:[(0,A.jsx)(Dh,{label:`Name`,value:n.name}),(0,A.jsx)(Dh,{label:`Email`,value:n.email}),(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-2`,children:[(0,A.jsx)(`dt`,{className:Ot,children:`Theme`}),(0,A.jsx)(`dd`,{children:(0,A.jsx)(go,{})})]})]})]})})}function Dh({label:e,value:t}){return(0,A.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 border-b border-border/60 px-4 py-2`,children:[(0,A.jsx)(`dt`,{className:Ot,children:e}),(0,A.jsx)(`dd`,{className:`min-w-0 truncate text-xs text-foreground`,children:t})]})}async function Oh(){try{await pe()}finally{i(null)}}function kh(e){let t=(0,k.useRef)(e);t.current=e,(0,k.useEffect)(()=>{let e=e=>{let{enabled:n,go:r,openSettings:i,logout:a}=t.current;if(!n||e.repeat||bn(e.target)||!(e.metaKey||e.ctrlKey)||e.altKey)return;if(e.key===`,`){e.preventDefault(),i();return}if(e.key.toLowerCase()===`e`){e.preventDefault(),a();return}let o=xn[e.key];o&&(e.preventDefault(),r(o))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}function Ah({operator:e}){let t=zi({select:e=>e.location.pathname}),n=T(),r=oh(),{setTheme:i}=hn(),[a,o]=(0,k.useState)(!1),[s,l]=(0,k.useState)(!1),u=t===`/overview`||t===`/flows`||t===`/store`||t===`/vault`||t===`/access`||t===`/observability`,d=(0,k.useCallback)(()=>{Oh().then(()=>{n({to:`/`})})},[n]),f=(0,k.useCallback)((e,t)=>{n({to:e,search:t})},[n]),p=(0,k.useMemo)(()=>fh({memory:r,go:f,openSettings:()=>o(!0),logout:d,setTheme:i}),[f,d,r,i]);return kh({enabled:!s&&!a,go:e=>f(e,th(r,e)),openSettings:()=>o(!0),logout:d}),(0,A.jsxs)(Nm,{open:!1,className:u?`h-svh max-h-svh overflow-hidden`:void 0,children:[(0,A.jsx)(uh,{onFast:()=>l(!0),onSettings:()=>o(!0),onLogout:d}),(0,A.jsx)(Im,{className:u?`min-h-0 max-h-svh overflow-hidden`:void 0,children:(0,A.jsxs)(`div`,{className:c(`flex flex-col`,u?`h-svh max-h-svh min-h-0 overflow-hidden`:`flex-1 gap-4 p-4`),children:[(0,A.jsx)(Fm,{className:`-ml-1 md:hidden`}),(0,A.jsx)(Ai,{})]})}),(0,A.jsx)(Eh,{open:a,onOpenChange:o,operator:e}),(0,A.jsx)(vh,{open:s,onOpenChange:l,items:p})]})}async function jh({location:e}){let t=Ka(`${e.pathname}${e.searchStr}`);if(!$e())throw Jn({to:`/`,search:t});let n=await jt();if(n.error||!n.data)throw i(null),Jn({to:`/`,search:t});let r={operatorId:n.data.operatorId,email:n.data.email,name:n.data.name};return g(r),{operator:r}}var Mh=vi({component:function(){return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Sm,{}),(0,A.jsx)(Ai,{})]})}}),Nh=N({getParentRoute:()=>Mh,path:`/`,validateSearch:Ga,component:vm}),$=N({getParentRoute:()=>Mh,id:`authenticated`,beforeLoad:jh,component:function(){let{operator:e}=$.useRouteContext();return(0,A.jsx)(Ah,{operator:e})}}),Ph=N({getParentRoute:()=>$,path:`/overview`,validateSearch:Ca,component:yi(()=>gn(()=>import(`./flows-page-XDpAJO8f.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])),`FlowsPage`)}),Fh=N({getParentRoute:()=>$,path:`/flows`,validateSearch:Ta,component:yi(()=>gn(()=>import(`./units-page-Ca2Z-E52.js`),__vite__mapDeps([19,1,2,3,4,5,20,21,22,23,9,17,24,25,26,10,11,12,13,16,14,15])),`UnitsPage`)}),Ih=N({getParentRoute:()=>$,path:`/store`,validateSearch:sn,component:yi(()=>gn(()=>import(`./store-page-CS5-aETQ.js`),__vite__mapDeps([27,1,2,3,4,5,23,20,28,6,7,12,21,22,9,17,24,15,29,25,26,30,11,18,14,31])),`StorePage`)}),Lh=N({getParentRoute:()=>$,path:`/vault`,validateSearch:Fa,component:yi(()=>gn(()=>import(`./vault-page-BmOeAFwg.js`),__vite__mapDeps([32,1,2,3,4,5,23,20,21,9,25,26,30,14,15,33])),`VaultPage`)}),Rh=N({getParentRoute:()=>$,path:`/access`,validateSearch:La,component:yi(()=>gn(()=>import(`./access-page-CXVWWMmD.js`),__vite__mapDeps([34,1,2,3,4,5,23,9,25,26,30,10])),`AccessPage`)}),zh=N({getParentRoute:()=>$,path:`/observability`,validateSearch:Na,component:yi(()=>gn(()=>import(`./observability-page-BFaay44m.js`),__vite__mapDeps([35,1,2,3,4,5,23,20,6,7,8,9,10,11,12,13,14,15,25,31,29,24,33])),`ObservabilityPage`)}),Bh=N({getParentRoute:()=>$,path:`/monitoring`,validateSearch:Na,beforeLoad:({search:e})=>{throw Jn({to:`/observability`,search:e})}}),Vh=Fi({routeTree:Mh.addChildren([Nh,$.addChildren([Ph,Fh,Ih,Lh,Rh,zh,Bh])]),defaultNotFoundComponent:bo,defaultPendingComponent:()=>(0,A.jsx)(`div`,{className:`grid min-h-dvh place-items-center text-sm text-muted-foreground`,children:`Loading…`})});we(e=>{let t=e.split(`?`)[0]??``;t!==`/`&&t!==``&&Vh.navigate({to:`/`,search:Ka(e)})}),le();var Hh=new Tn({defaultOptions:{queries:{staleTime:5e3,refetchOnWindowFocus:!1}}}),Uh=document.getElementById(`root`);if(!Uh)throw Error(`Missing #root`);(0,Sa.createRoot)(Uh).render((0,A.jsx)(k.StrictMode,{children:(0,A.jsx)(mn,{defaultTheme:`system`,storageKey:`oke-console-theme`,children:(0,A.jsx)(y,{delay:0,children:(0,A.jsx)(de,{client:Hh,children:(0,A.jsx)(xa,{children:(0,A.jsx)(Ri,{router:Vh})})})})})}));export{Da as a,ja as c,wa as d,Pa as i,Ma as l,Ra as n,Aa as o,Ia as r,ka as s,_o as t,Ea as u};
66
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Bd(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Hd(t,`input`,e.processors),output:Hd(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Y(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Y(r.element,n);if(r.type===`set`)return Y(r.valueType,n);if(r.type===`lazy`)return Y(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return Y(r.innerType,n);if(r.type===`intersection`)return Y(r.left,n)||Y(r.right,n);if(r.type===`record`||r.type===`map`)return Y(r.keyType,n)||Y(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Y(r.in,n)||Y(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Y(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Y(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Y(e,n))return!0;return!!(r.rest&&Y(r.rest,n))}return!1}var Vd=(e,t={})=>n=>{let r=Rd({...n,processors:t});return J(e,r),zd(r,e),Bd(r,e)},Hd=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Rd({...i??{},target:a,io:t,processors:n});return J(e,o),zd(o,e),Bd(o,e)},Ud={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Wd=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ud[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Gd=(e,t,n,r)=>{n.not={}},Kd=(e,t,n,r)=>{let i=e._zod.def,a=Xs(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},qd=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Jd=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Yd=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=J(a.element,t,{...r,path:[...r.path,`items`]})},Xd=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=J(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=J(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Zd=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>J(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Qd=(e,t,n,r)=>{let i=e._zod.def,a=J(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=J(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},$d=(e,t,n,r)=>{let i=e._zod.def,a=J(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},ef=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},tf=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},nf=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},rf=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},af=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;J(o,t,r);let s=t.seen.get(e);s.ref=o},of=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},sf=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},cf=H(`ZodISODateTime`,(e,t)=>{ql.init(e,t),Q.init(e,t)});function lf(e){return pd(cf,e)}var uf=H(`ZodISODate`,(e,t)=>{Jl.init(e,t),Q.init(e,t)});function df(e){return md(uf,e)}var ff=H(`ZodISOTime`,(e,t)=>{Yl.init(e,t),Q.init(e,t)});function pf(e){return hd(ff,e)}var mf=H(`ZodISODuration`,(e,t)=>{Xl.init(e,t),Q.init(e,t)});function hf(e){return gd(mf,e)}var X=H(`ZodError`,(e,t)=>{Ac.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Nc(e,t)},flatten:{value:t=>Mc(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Zs,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Zs,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),gf=Pc(X),_f=Fc(X),vf=Ic(X),yf=Rc(X),bf=Bc(X),xf=Vc(X),Sf=Hc(X),Cf=Uc(X),wf=Wc(X),Tf=Gc(X),Ef=Kc(X),Df=qc(X),Of=new WeakMap;function kf(e,t,n){let r=Object.getPrototypeOf(e),i=Of.get(r);if(i||(i=new Set,Of.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var Z=H(`ZodType`,(e,t)=>(K.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Hd(e,`input`),output:Hd(e,`output`)}}),e.toJSONSchema=Vd(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>gf(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>vf(e,t,n),e.parseAsync=async(t,n)=>_f(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>yf(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>bf(e,t,n),e.decode=(t,n)=>xf(e,t,n),e.encodeAsync=async(t,n)=>Sf(e,t,n),e.decodeAsync=async(t,n)=>Cf(e,t,n),e.safeEncode=(t,n)=>wf(e,t,n),e.safeDecode=(t,n)=>Tf(e,t,n),e.safeEncodeAsync=async(t,n)=>Ef(e,t,n),e.safeDecodeAsync=async(t,n)=>Df(e,t,n),kf(e,`ZodType`,{check(...e){let t=this.def;return this.clone(rc(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return pc(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Np(e,t))},superRefine(e,t){return this.check(Pp(e,t))},overwrite(e){return this.check(Od(e))},optional(){return hp(this)},exactOptional(){return _p(this)},nullable(){return yp(this)},nullish(){return hp(yp(this))},nonoptional(e){return Tp(this,e)},array(){return rp(this)},or(e){return sp([this,e])},and(e){return lp(this,e)},transform(e){return kp(this,pp(e))},default(e){return xp(this,e)},prefault(e){return Cp(this,e)},catch(e){return Dp(this,e)},pipe(e){return kp(this,e)},readonly(){return jp(this)},describe(e){let t=this.clone();return Uu.add(t,{description:e}),t},meta(...e){if(e.length===0)return Uu.get(this);let t=this.clone();return Uu.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return Uu.get(e)?.description},configurable:!0}),e)),Af=H(`_ZodString`,(e,t)=>{Fl.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wd(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,kf(e,`_ZodString`,{regex(...e){return this.check(Sd(...e))},includes(...e){return this.check(Td(...e))},startsWith(...e){return this.check(Ed(...e))},endsWith(...e){return this.check(Dd(...e))},min(...e){return this.check(bd(...e))},max(...e){return this.check(yd(...e))},length(...e){return this.check(xd(...e))},nonempty(...e){return this.check(bd(1,...e))},lowercase(e){return this.check(Cd(e))},uppercase(e){return this.check(wd(e))},trim(){return this.check(Ad())},normalize(...e){return this.check(kd(...e))},toLowerCase(){return this.check(jd())},toUpperCase(){return this.check(Md())},slugify(){return this.check(Nd())}})}),jf=H(`ZodString`,(e,t)=>{Fl.init(e,t),Af.init(e,t),e.email=t=>e.check(Gu(Nf,t)),e.url=t=>e.check(Zu(If,t)),e.jwt=t=>e.check(fd(Zf,t)),e.emoji=t=>e.check(Qu(Lf,t)),e.guid=t=>e.check(Ku(Pf,t)),e.uuid=t=>e.check(qu(Ff,t)),e.uuidv4=t=>e.check(Ju(Ff,t)),e.uuidv6=t=>e.check(Yu(Ff,t)),e.uuidv7=t=>e.check(Xu(Ff,t)),e.nanoid=t=>e.check($u(Rf,t)),e.guid=t=>e.check(Ku(Pf,t)),e.cuid=t=>e.check(ed(zf,t)),e.cuid2=t=>e.check(td(Bf,t)),e.ulid=t=>e.check(nd(Vf,t)),e.base64=t=>e.check(ld(Jf,t)),e.base64url=t=>e.check(ud(Yf,t)),e.xid=t=>e.check(rd(Hf,t)),e.ksuid=t=>e.check(id(Uf,t)),e.ipv4=t=>e.check(ad(Wf,t)),e.ipv6=t=>e.check(od(Gf,t)),e.cidrv4=t=>e.check(sd(Kf,t)),e.cidrv6=t=>e.check(cd(qf,t)),e.e164=t=>e.check(dd(Xf,t)),e.datetime=t=>e.check(lf(t)),e.date=t=>e.check(df(t)),e.time=t=>e.check(pf(t)),e.duration=t=>e.check(hf(t))});function Mf(e){return Wu(jf,e)}var Q=H(`ZodStringFormat`,(e,t)=>{q.init(e,t),Af.init(e,t)}),Nf=H(`ZodEmail`,(e,t)=>{Rl.init(e,t),Q.init(e,t)}),Pf=H(`ZodGUID`,(e,t)=>{Il.init(e,t),Q.init(e,t)}),Ff=H(`ZodUUID`,(e,t)=>{Ll.init(e,t),Q.init(e,t)}),If=H(`ZodURL`,(e,t)=>{zl.init(e,t),Q.init(e,t)}),Lf=H(`ZodEmoji`,(e,t)=>{Bl.init(e,t),Q.init(e,t)}),Rf=H(`ZodNanoID`,(e,t)=>{Vl.init(e,t),Q.init(e,t)}),zf=H(`ZodCUID`,(e,t)=>{Hl.init(e,t),Q.init(e,t)}),Bf=H(`ZodCUID2`,(e,t)=>{Ul.init(e,t),Q.init(e,t)}),Vf=H(`ZodULID`,(e,t)=>{Wl.init(e,t),Q.init(e,t)}),Hf=H(`ZodXID`,(e,t)=>{Gl.init(e,t),Q.init(e,t)}),Uf=H(`ZodKSUID`,(e,t)=>{Kl.init(e,t),Q.init(e,t)}),Wf=H(`ZodIPv4`,(e,t)=>{Zl.init(e,t),Q.init(e,t)}),Gf=H(`ZodIPv6`,(e,t)=>{Ql.init(e,t),Q.init(e,t)}),Kf=H(`ZodCIDRv4`,(e,t)=>{$l.init(e,t),Q.init(e,t)}),qf=H(`ZodCIDRv6`,(e,t)=>{eu.init(e,t),Q.init(e,t)}),Jf=H(`ZodBase64`,(e,t)=>{nu.init(e,t),Q.init(e,t)}),Yf=H(`ZodBase64URL`,(e,t)=>{iu.init(e,t),Q.init(e,t)}),Xf=H(`ZodE164`,(e,t)=>{au.init(e,t),Q.init(e,t)}),Zf=H(`ZodJWT`,(e,t)=>{su.init(e,t),Q.init(e,t)}),Qf=H(`ZodUnknown`,(e,t)=>{cu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function $f(){return _d(Qf)}var ep=H(`ZodNever`,(e,t)=>{lu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gd(e,t,n,r)});function tp(e){return vd(ep,e)}var np=H(`ZodArray`,(e,t)=>{du.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yd(e,t,n,r),e.element=t.element,kf(e,`ZodArray`,{min(e,t){return this.check(bd(e,t))},nonempty(e){return this.check(bd(1,e))},max(e,t){return this.check(yd(e,t))},length(e,t){return this.check(xd(e,t))},unwrap(){return this.element}})});function rp(e,t){return Pd(np,e,t)}var ip=H(`ZodObject`,(e,t)=>{gu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xd(e,t,n,r),U(e,`shape`,()=>t.shape),kf(e,`ZodObject`,{keyof(){return dp(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:$f()})},loose(){return this.clone({...this._zod.def,catchall:$f()})},strict(){return this.clone({...this._zod.def,catchall:tp()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return _c(this,e)},safeExtend(e){return vc(this,e)},merge(e){return yc(this,e)},pick(e){return hc(this,e)},omit(e){return gc(this,e)},partial(...e){return bc(mp,this,e[0])},required(...e){return xc(wp,this,e[0])}})});function ap(e,t){return new ip({type:`object`,shape:e??{},...W(t)})}var op=H(`ZodUnion`,(e,t)=>{vu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zd(e,t,n,r),e.options=t.options});function sp(e,t){return new op({type:`union`,options:e,...W(t)})}var cp=H(`ZodIntersection`,(e,t)=>{yu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qd(e,t,n,r)});function lp(e,t){return new cp({type:`intersection`,left:e,right:t})}var up=H(`ZodEnum`,(e,t)=>{Su.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kd(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new up({...t,checks:[],...W(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new up({...t,checks:[],...W(r),entries:i})}});function dp(e,t){return new up({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...W(t)})}var fp=H(`ZodTransform`,(e,t)=>{Cu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jd(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new qs(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Oc(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Oc(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function pp(e){return new fp({type:`transform`,transform:e})}var mp=H(`ZodOptional`,(e,t)=>{Tu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hp(e){return new mp({type:`optional`,innerType:e})}var gp=H(`ZodExactOptional`,(e,t)=>{Eu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _p(e){return new gp({type:`optional`,innerType:e})}var vp=H(`ZodNullable`,(e,t)=>{Du.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$d(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yp(e){return new vp({type:`nullable`,innerType:e})}var bp=H(`ZodDefault`,(e,t)=>{Ou.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function xp(e,t){return new bp({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():uc(t)}})}var Sp=H(`ZodPrefault`,(e,t)=>{Au.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cp(e,t){return new Sp({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():uc(t)}})}var wp=H(`ZodNonOptional`,(e,t)=>{ju.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ef(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Tp(e,t){return new wp({type:`nonoptional`,innerType:e,...W(t)})}var Ep=H(`ZodCatch`,(e,t)=>{Nu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Dp(e,t){return new Ep({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Op=H(`ZodPipe`,(e,t)=>{Pu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>af(e,t,n,r),e.in=t.in,e.out=t.out});function kp(e,t){return new Op({type:`pipe`,in:e,out:t})}var Ap=H(`ZodReadonly`,(e,t)=>{Iu.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>of(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jp(e){return new Ap({type:`readonly`,innerType:e})}var Mp=H(`ZodCustom`,(e,t)=>{Ru.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qd(e,t,n,r)});function Np(e,t={}){return Fd(Mp,e,t)}function Pp(e,t){return Id(e,t)}function Fp({className:e,id:t,revealNonce:n,...r}){let[i,a]=(0,k.useState)(!1);(0,k.useEffect)(()=>{n!==void 0&&n>0&&a(!0)},[n]);let o=(0,k.useId)(),s=t??`password-${o}`,l=`${s}-visibility`,d=i?`text`:`password`;return(0,A.jsxs)(`div`,{className:`relative w-full min-w-0`,children:[(0,A.jsx)(u,{...r,id:s,type:d,inputMode:`text`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,className:c(`pr-10`,e)},d),(0,A.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),"aria-label":i?`Hide password`:`Show password`,"aria-pressed":i,"aria-controls":s,"aria-describedby":l,className:c(Qe,`absolute top-1/2 right-0 -translate-y-1/2`),children:(0,A.jsx)(E,{icon:i?Ve:bt,size:16,color:`currentColor`,strokeWidth:1.5,"aria-hidden":!0})}),(0,A.jsx)(`span`,{id:l,className:`sr-only`,"aria-live":`polite`,children:i?`Password is visible`:`Password is hidden`})]})}function Ip({className:e,...t}){return(0,A.jsx)(`label`,{"data-slot":`label`,className:c(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function Lp({className:e,...t}){return(0,A.jsx)(`div`,{"data-slot":`field-group`,className:c(`group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var Rp=ge(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function zp({className:e,orientation:t=`vertical`,...n}){return(0,A.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:c(Rp({orientation:t}),e),...n})}function Bp({className:e,...t}){return(0,A.jsx)(Ip,{"data-slot":`field-label`,className:c(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}function Vp({className:e,children:t,errors:n,...r}){let i=(0,k.useMemo)(()=>{if(t)return t;if(!n?.length)return null;let e=[...new Map(n.map(e=>[e?.message,e])).values()];return e?.length==1?e[0]?.message:(0,A.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:e.map((e,t)=>e?.message&&(0,A.jsx)(`li`,{children:e.message},t))})},[t,n]);return i?(0,A.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:c(`text-sm font-normal text-destructive`,e),...r,children:i}):null}var Hp=ap({email:Mf().email(`Enter a valid email.`),password:Mf().min(1,`Password is required.`)});function Up(...e){let t=e.filter(e=>typeof e==`string`&&e.length>0).join(` `);return t.length>0?t:void 0}function Wp(){return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`span`,{className:`text-destructive`,"aria-hidden":!0,children:[` `,`*`]}),(0,A.jsx)(`span`,{className:`sr-only`,children:` (required)`})]})}function Gp(){let e=p(),t=T(),n=He({from:`/`}),[r,i]=(0,k.useState)(null),a=Pt({mutationFn:async e=>{let t=await ne(e);if(t.error)throw Error(_e(t.error));if(!t.data)throw Error(`Empty login response`);return t.data},onSuccess:r=>{wt(r),i(null),e.invalidateQueries({queryKey:[`console.setup.status`]}),window.setTimeout(()=>{Ja(t,n.next)},650)},onError:e=>{i(e.message)}}),o=Ws({defaultValues:{email:``,password:``},validators:{onSubmit:Hp},onSubmit:async({value:e})=>{i(null),await a.mutateAsync(e)}});return(0,A.jsx)(po,{title:`Sign in`,status:{label:`Setup closed`},description:`Sign in with an existing operator account.`,footer:(0,A.jsx)(so,{type:`submit`,form:`login-form`,state:oo({pending:a.isPending,success:a.isSuccess,error:a.isError||r!==null}),loadingText:`Signing in`,successText:`Signed in`,errorText:`Try again`,children:`Sign in`}),children:({titleId:e,descriptionId:t})=>(0,A.jsxs)(`form`,{id:`login-form`,className:`flex flex-col`,autoComplete:`on`,noValidate:!0,"aria-labelledby":e,"aria-describedby":t,"aria-busy":a.isPending||void 0,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),o.handleSubmit()},children:[(0,A.jsxs)(Lp,{className:to,role:`group`,"aria-label":`Operator credentials`,children:[(0,A.jsx)(o.Field,{name:`email`,children:e=>{let t=e.state.meta.isTouched&&!e.state.meta.isValid,n=`${e.name}-error`;return(0,A.jsxs)(zp,{"data-invalid":t||void 0,className:no,children:[(0,A.jsxs)(Bp,{htmlFor:e.name,className:ao,children:[`Email`,(0,A.jsx)(Wp,{})]}),(0,A.jsx)(u,{id:e.name,name:e.name,type:`email`,inputMode:`email`,autoComplete:`username`,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value),placeholder:`Email`,"aria-invalid":t,"aria-required":!0,"aria-describedby":Up(t&&n),required:!0,className:ro}),t?(0,A.jsx)(Vp,{id:n,className:io,errors:e.state.meta.errors}):null]})}}),(0,A.jsx)(o.Field,{name:`password`,children:e=>{let t=e.state.meta.isTouched&&!e.state.meta.isValid,n=`${e.name}-error`;return(0,A.jsxs)(zp,{"data-invalid":t||void 0,className:no,children:[(0,A.jsxs)(Bp,{htmlFor:e.name,className:ao,children:[`Password`,(0,A.jsx)(Wp,{})]}),(0,A.jsx)(Fp,{id:e.name,name:e.name,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value),autoComplete:`current-password`,placeholder:`Password`,"aria-invalid":t,"aria-required":!0,"aria-describedby":Up(t&&n),required:!0,className:ro}),t?(0,A.jsx)(Vp,{id:n,className:io,errors:e.state.meta.errors}):null]})}})]}),r?(0,A.jsx)(`p`,{id:`login-form-error`,className:`px-5 py-3.5 text-sm text-destructive`,role:`alert`,"aria-live":`assertive`,children:r}):null]})})}function Kp(e){return e.claimSucceeded?`claim`:e.setupClosed?`login`:`claim`}var qp=/[^A-Za-z0-9]/,Jp={minLength:8,requireLetter:!0,requireNumber:!0,requireUppercase:!0,requireLowercase:!0,requireSpecial:!0};function Yp(e={}){return{minLength:e.minLength??Jp.minLength,requireLetter:e.requireLetter??Jp.requireLetter,requireNumber:e.requireNumber??Jp.requireNumber,requireUppercase:e.requireUppercase??Jp.requireUppercase,requireLowercase:e.requireLowercase??Jp.requireLowercase,requireSpecial:e.requireSpecial??Jp.requireSpecial}}function Xp(e){return qp.test(e)}function Zp(e,t={}){let n=Yp(t),r=[];if(e.length<n.minLength&&r.push(`minLength ${n.minLength} (got ${e.length})`),n.requireLetter&&!/[A-Za-z]/.test(e)&&r.push(`requireLetter`),n.requireUppercase&&!/[A-Z]/.test(e)&&r.push(`requireUppercase`),n.requireLowercase&&!/[a-z]/.test(e)&&r.push(`requireLowercase`),n.requireNumber&&!/\d/.test(e)&&r.push(`requireNumber`),n.requireSpecial&&!Xp(e)&&r.push(`requireSpecial`),r.length>0)throw new om(r)}var Qp=`ABCDEFGHJKLMNPQRSTUVWXYZ`,$p=`abcdefghijkmnpqrstuvwxyz`,em=`23456789`,tm=`!@#$%^&*-_=+?`;function nm(e={}){let t=Yp(e),n=e.length??Math.max(t.minLength,16);if(n<t.minLength)throw Error(`generatePassword: length ${n} is below minLength ${t.minLength}`);let r=[];t.requireUppercase&&r.push(Qp),t.requireLowercase&&r.push($p),t.requireLetter&&!t.requireUppercase&&!t.requireLowercase&&r.push(`ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz`),t.requireNumber&&r.push(em),t.requireSpecial&&r.push(tm);let i=r.length>0?r.join(``):`ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789`;if(n<r.length)throw Error(`generatePassword: length ${n} cannot cover ${r.length} classes`);let a=r.map(e=>rm(e));for(;a.length<n;)a.push(rm(i));im(a);let o=a.join(``);return Zp(o,t),o}function rm(e){return e[am(e.length)]??e[0]}function im(e){for(let t=e.length-1;t>0;t--){let n=am(t+1),r=e[t];e[t]=e[n],e[n]=r}}function am(e){if(!Number.isInteger(e)||e<=0)throw Error(`randomInt: maxExclusive must be a positive integer`);let t=e<=256?1:2,n=t===1?256:65536;if(e>n)throw Error(`randomInt: maxExclusive ${e} exceeds ${n}`);let r=n-n%e,i=new Uint8Array(t);for(;;){crypto.getRandomValues(i);let n=t===1?i[0]??0:(i[0]??0)<<8|(i[1]??0);if(n<r)return n%e}}var om=class extends Error{reasons;constructor(e){super(`password policy failed: ${e.join(`, `)}`),this.name=`PasswordPolicyError`,this.reasons=e}},sm={minLength:12,requireLetter:!0,requireNumber:!0,requireUppercase:!0,requireLowercase:!0,requireSpecial:!0};function cm(e){let t=Yp(sm);return[{id:`length`,label:`At least ${t.minLength} characters`,met:e.length>=t.minLength},{id:`uppercase`,label:`Contains an uppercase letter`,met:/[A-Z]/.test(e)},{id:`lowercase`,label:`Contains a lowercase letter`,met:/[a-z]/.test(e)},{id:`number`,label:`Contains a number`,met:/\d/.test(e)},{id:`special`,label:`Contains a special character`,met:Xp(e)}]}function lm(){return nm(sm)}function um({onGenerate:e,disabled:t,copyText:n=async e=>{await navigator.clipboard.writeText(e)}}){let[r,i]=(0,k.useState)(!1),a=(0,k.useRef)(null);return(0,k.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),(0,A.jsxs)(Et,{type:`button`,variant:`ghost`,size:`xs`,disabled:t,"data-slot":`generate-password`,"aria-label":r?`Password generated and copied`:`Generate a password and copy it`,className:`text-muted-foreground`,onClick:()=>{let t=lm();e(t),n(t).then(()=>{i(!0),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>i(!1),1600)}).catch(()=>{i(!1)})},children:[(0,A.jsx)(E,{icon:r?st:ke,"data-icon":`inline-start`,color:`currentColor`,strokeWidth:1.5,"aria-hidden":!0}),r?`Copied`:`Generate`]})}function dm(e){return cm(e)}function fm(e,t){if(e<=0)return{label:`Empty`,bar:`bg-muted-foreground/35`,text:`text-muted-foreground`};if(e===t)return{label:`Strong`,bar:`bg-emerald-500`,text:`text-emerald-600 dark:text-emerald-400`};let n=e/t;return n<=.4?{label:`Weak`,bar:`bg-destructive`,text:`text-destructive`}:n<=.6?{label:`Fair`,bar:`bg-amber-500`,text:`text-amber-600 dark:text-amber-400`}:{label:`Good`,bar:`bg-lime-500`,text:`text-lime-700 dark:text-lime-400`}}function pm({password:e,id:t=`password-strength`}){let n=dm(e),r=n.filter(e=>e.met).length,i=Math.round(r/n.length*100),a=fm(r,n.length),o=e.length===0;return(0,A.jsxs)(`div`,{id:t,className:`flex flex-col gap-3`,"aria-live":`polite`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,A.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,id:`${t}-label`,children:`Password strength`}),(0,A.jsx)(`p`,{className:c(`text-xs tabular-nums font-medium`,o?`text-muted-foreground`:a.text),"aria-hidden":!0,children:o?`0/${n.length}`:`${a.label} · ${r}/${n.length}`})]}),(0,A.jsx)(`div`,{role:`progressbar`,"aria-labelledby":`${t}-label`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i,"aria-valuetext":o?`No password entered`:`${a.label}: ${r} of ${n.length} requirements met`,className:`h-2 w-full overflow-hidden rounded-full bg-muted`,children:(0,A.jsx)(`div`,{className:c(`h-full rounded-full transition-[width,background-color] duration-200 ease-out`,o?`bg-muted-foreground/35`:a.bar),style:{width:`${o?0:Math.max(i,r>0?12:0)}%`}})})]}),(0,A.jsx)(`ul`,{className:`flex flex-col gap-1.5`,"aria-label":`Password requirements`,children:n.map(e=>(0,A.jsxs)(`li`,{className:c(`flex items-center gap-2 text-xs transition-colors`,e.met?`text-foreground`:`text-muted-foreground`),children:[(0,A.jsx)(E,{icon:e.met?v:Ce,size:14,color:`currentColor`,strokeWidth:1.5,className:c(e.met?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground/60`),"aria-hidden":!0}),(0,A.jsxs)(`span`,{children:[(0,A.jsx)(`span`,{className:`sr-only`,children:e.met?`Met: `:`Not met: `}),e.label]})]},e.id))})]})}var mm=ap({claimCode:Mf().min(1,`Claim code is required.`),name:Mf().min(1,`Name is required.`),email:Mf().email(`Enter a valid email.`),password:Mf().min(12,`Password must be at least 12 characters.`).refine(e=>cm(e).every(e=>e.met),{message:`Password needs uppercase, lowercase, a number, and a special character.`})});function hm(...e){let t=e.filter(e=>typeof e==`string`&&e.length>0).join(` `);return t.length>0?t:void 0}function gm(){return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`span`,{className:`text-destructive`,"aria-hidden":!0,children:[` `,`*`]}),(0,A.jsx)(`span`,{className:`sr-only`,children:` (required)`})]})}function _m({children:e}){return(0,A.jsx)(yo,{children:e})}function vm(){let e=p(),t=T(),n=He({from:`/`}),[r,a]=(0,k.useState)(null),[o,s]=(0,k.useState)(0),l=ae({queryKey:[`console.setup.status`],queryFn:async()=>{let e=await De();if(e.error)throw Error(_e(e.error));if(!e.data)throw Error(`Empty setup status`);return e.data},retry:2});(0,k.useEffect)(()=>{l.data?.claimRequired&&i(null)},[l.data?.claimRequired]);let d=Pt({mutationFn:async e=>{let t=await be(e);if(t.error)throw Error(_e(t.error));if(!t.data)throw Error(`Empty claim response`);return t.data},onSuccess:r=>{wt(r),a(null),e.setQueryData([`console.setup.status`],{setupClosed:!0,claimRequired:!1}),window.setTimeout(()=>{Ja(t,n.next)},650)},onError:e=>{a(e.message)}}),f=Ws({defaultValues:{claimCode:``,name:``,email:``,password:``},validators:{onSubmit:mm},onSubmit:async({value:e})=>{a(null),await d.mutateAsync(e)}});return l.isLoading?(0,A.jsx)(_m,{children:(0,A.jsx)(mo,{})}):l.isError?(0,A.jsx)(_m,{children:(0,A.jsx)(po,{title:`Console unreachable`,status:{label:`Offline`,tone:`alert`},description:`Could not reach the setup API.`,children:(0,A.jsx)(`p`,{className:`px-5 pb-6 text-sm text-muted-foreground`,role:`alert`,children:l.error instanceof Error?l.error.message:`Is the Console kernel running on :6533?`})})}):Kp({setupClosed:l.data?.setupClosed===!0,claimSucceeded:d.isSuccess})===`login`?(0,A.jsx)(_m,{children:(0,A.jsx)(Gp,{})}):(0,A.jsx)(_m,{children:(0,A.jsx)(po,{title:`First admin`,status:{label:`Setup open`,tone:`open`},description:"Enter the claim code from the `oke dev` board, or run `oke console claim-code`. This wizard closes permanently after the first operator.",footer:(0,A.jsx)(so,{type:`submit`,form:`claim-form`,state:oo({pending:d.isPending,success:d.isSuccess,error:d.isError||r!==null}),loadingText:`Creating`,successText:`Created`,errorText:`Try again`,children:`Create admin account`}),children:({titleId:e,descriptionId:t})=>(0,A.jsxs)(`form`,{id:`claim-form`,className:`flex flex-col`,autoComplete:`off`,noValidate:!0,"aria-labelledby":e,"aria-describedby":t,"aria-busy":d.isPending||void 0,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),f.handleSubmit()},children:[(0,A.jsxs)(Lp,{className:to,role:`group`,"aria-label":`First admin details`,children:[(0,A.jsx)(f.Field,{name:`claimCode`,children:e=>{let t=e.state.meta.isTouched&&!e.state.meta.isValid,n=`${e.name}-error`;return(0,A.jsxs)(zp,{"data-invalid":t||void 0,className:no,children:[(0,A.jsxs)(Bp,{htmlFor:e.name,className:ao,children:[`Claim code`,(0,A.jsx)(gm,{})]}),(0,A.jsx)(u,{id:e.name,name:e.name,type:`text`,inputMode:`text`,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value),autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,placeholder:`Claim code`,"aria-invalid":t,"aria-required":!0,"aria-describedby":hm(t&&n),required:!0,className:ro}),t?(0,A.jsx)(Vp,{id:n,className:io,errors:e.state.meta.errors}):null]})}}),(0,A.jsx)(f.Field,{name:`name`,children:e=>{let t=e.state.meta.isTouched&&!e.state.meta.isValid,n=`${e.name}-error`;return(0,A.jsxs)(zp,{"data-invalid":t||void 0,className:no,children:[(0,A.jsxs)(Bp,{htmlFor:e.name,className:ao,children:[`Name`,(0,A.jsx)(gm,{})]}),(0,A.jsx)(u,{id:e.name,name:e.name,type:`text`,autoComplete:`name`,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value),placeholder:`Name`,"aria-invalid":t,"aria-required":!0,"aria-describedby":hm(t&&n),required:!0,className:ro}),t?(0,A.jsx)(Vp,{id:n,className:io,errors:e.state.meta.errors}):null]})}}),(0,A.jsx)(f.Field,{name:`email`,children:e=>{let t=e.state.meta.isTouched&&!e.state.meta.isValid,n=`${e.name}-error`;return(0,A.jsxs)(zp,{"data-invalid":t||void 0,className:no,children:[(0,A.jsxs)(Bp,{htmlFor:e.name,className:ao,children:[`Email`,(0,A.jsx)(gm,{})]}),(0,A.jsx)(u,{id:e.name,name:e.name,type:`email`,inputMode:`email`,autoComplete:`email`,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value),placeholder:`Email`,"aria-invalid":t,"aria-required":!0,"aria-describedby":hm(t&&n),required:!0,className:ro}),t?(0,A.jsx)(Vp,{id:n,className:io,errors:e.state.meta.errors}):null]})}}),(0,A.jsx)(f.Field,{name:`password`,children:e=>{let t=e.state.meta.isTouched&&!e.state.meta.isValid,n=`${e.name}-strength`,r=`${e.name}-error`;return(0,A.jsxs)(zp,{"data-invalid":t||void 0,className:c(no,`items-start`),children:[(0,A.jsxs)(`div`,{className:`flex flex-col items-start gap-1.5 pt-1.5`,children:[(0,A.jsxs)(Bp,{htmlFor:e.name,className:ao,children:[`Password`,(0,A.jsx)(gm,{})]}),(0,A.jsx)(um,{disabled:d.isPending,onGenerate:t=>{e.handleChange(t),s(e=>e+1)}})]}),(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,A.jsx)(Fp,{id:e.name,name:e.name,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value),revealNonce:o,minLength:12,autoComplete:`new-password`,placeholder:`Password`,"aria-invalid":t,"aria-required":!0,"aria-describedby":hm(n,t&&r),required:!0,className:ro}),(0,A.jsx)(pm,{id:n,password:e.state.value}),t?(0,A.jsx)(Vp,{id:r,errors:e.state.meta.errors}):null]})]})}})]}),r?(0,A.jsx)(`p`,{id:`claim-form-error`,className:`px-5 py-3.5 text-sm text-destructive`,role:`alert`,"aria-live":`assertive`,children:r}):null]})})})}var ym=`okengine Console`,bm={"/overview":`Overview`,"/flows":`Flows`,"/store":`Store`,"/observability":`Observability`,"/vault":`Vault`,"/access":`Access`,"/monitoring":`Observability`};function xm(e){if(e===`/`||e===``)return ym;let t=bm[e];return t?`${t} · ${ym}`:`Not found · ${ym}`}function Sm(){let e=zi({select:e=>e.location.pathname});return(0,k.useEffect)(()=>{document.title=xm(e)},[e]),null}var Cm=768;function wm(){let[e,t]=k.useState(void 0);return k.useEffect(()=>{let e=window.matchMedia(`(max-width: 767px)`),n=()=>{t(window.innerWidth<Cm)};return e.addEventListener(`change`,n),t(window.innerWidth<Cm),()=>e.removeEventListener(`change`,n)},[]),!!e}var Tm=`sidebar_state`,Em=604800,Dm=`16rem`,Om=`18rem`,km=`3rem`,Am=`b`,jm=k.createContext(null);function Mm(){let e=k.useContext(jm);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Nm({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=wm(),[l,u]=k.useState(!1),[d,f]=k.useState(e),p=t??d,m=k.useCallback(e=>{let t=typeof e==`function`?e(p):e;n?n(t):f(t),document.cookie=`${Tm}=${t}; path=/; max-age=${Em}`},[n,p]),h=k.useCallback(()=>s?u(e=>!e):m(e=>!e),[s,m,u]);k.useEffect(()=>{let e=e=>{e.key===Am&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),h())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h]);let g=p?`expanded`:`collapsed`,_=k.useMemo(()=>({state:g,open:p,setOpen:m,isMobile:s,openMobile:l,setOpenMobile:u,toggleSidebar:h}),[g,p,m,s,l,u,h]);return(0,A.jsx)(jm.Provider,{value:_,children:(0,A.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{"--sidebar-width":Dm,"--sidebar-width-icon":km,...i},className:c(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...o,children:a})})}function Pm({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,dir:a,...o}){let{isMobile:s,state:l,openMobile:u,setOpenMobile:d}=Mm();return n===`none`?(0,A.jsx)(`div`,{"data-slot":`sidebar`,className:c(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),...o,children:i}):s?(0,A.jsx)(Ze,{open:u,onOpenChange:d,...o,children:(0,A.jsxs)(lt,{dir:a,"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden`,style:{"--sidebar-width":Om},side:e,children:[(0,A.jsxs)(it,{className:`sr-only`,children:[(0,A.jsx)(yt,{children:`Sidebar`}),(0,A.jsx)(gt,{children:`Displays the mobile sidebar.`})]}),(0,A.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})]})}):(0,A.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":l,"data-collapsible":l===`collapsed`?n:``,"data-variant":t,"data-side":e,"data-slot":`sidebar`,children:[(0,A.jsx)(`div`,{"data-slot":`sidebar-gap`,className:c(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)}),(0,A.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":e,className:c(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...o,children:(0,A.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:i})})]})}function Fm({className:e,onClick:t,...n}){let{toggleSidebar:r}=Mm();return(0,A.jsxs)(Et,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,className:c(e),onClick:e=>{t?.(e),r()},...n,children:[(0,A.jsx)(E,{icon:Ae,className:`cn-rtl-flip`}),(0,A.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})}function Im({className:e,...t}){return(0,A.jsx)(`main`,{"data-slot":`sidebar-inset`,className:c(`relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,e),...t})}function Lm({className:e,...t}){return(0,A.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:c(`flex flex-col gap-2 p-2`,e),...t})}function Rm({className:e,...t}){return(0,A.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:c(`flex flex-col gap-2 p-2`,e),...t})}function zm({className:e,...t}){return(0,A.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:c(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function Bm({className:e,...t}){return(0,A.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:c(`relative flex w-full min-w-0 flex-col p-2`,e),...t})}function Vm({className:e,render:t,...n}){return _n({defaultTagName:`div`,props:ie({className:c(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,e)},n),render:t,state:{slot:`sidebar-group-label`,sidebar:`group-label`}})}function Hm({className:e,...t}){return(0,A.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:c(`flex w-full min-w-0 flex-col gap-0`,e),...t})}function Um({className:e,...t}){return(0,A.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:c(`group/menu-item relative`,e),...t})}var Wm=ge(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm text-muted-foreground ring-sidebar-ring outline-hidden transition-[width,height,padding,color] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function Gm({render:e,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...o}){let{isMobile:s,state:l}=Mm(),u=_n({defaultTagName:`button`,props:ie({className:c(Wm({variant:n,size:r}),a)},o),render:i?(0,A.jsx)(te,{render:e}):e,state:{slot:`sidebar-menu-button`,sidebar:`menu-button`,size:r,active:t}});return i?(typeof i==`string`&&(i={children:i}),(0,A.jsxs)(ce,{children:[u,(0,A.jsx)(f,{side:`right`,align:`center`,hidden:l!==`collapsed`||s,...i})]})):u}var Km=`rounded-none! justify-center data-active:bg-muted/70! data-active:text-foreground group-data-[collapsible=icon]:h-10! group-data-[collapsible=icon]:w-full! group-data-[collapsible=icon]:p-0!`;function qm({onFast:e,onSettings:t,onLogout:n}){let{isMobile:r,setOpenMobile:i}=Mm(),a=()=>{r&&i(!1)};return(0,A.jsxs)(Hm,{className:`items-stretch gap-0`,children:[(0,A.jsx)(Jm,{label:`Fast`,keys:yn(`fast`),icon:ee,slot:`sidebar-fast`,onClick:()=>{a(),e()}}),(0,A.jsx)(Jm,{label:`Settings`,keys:yn(`settings`),icon:m,slot:`sidebar-settings`,onClick:()=>{a(),t()}}),(0,A.jsx)(Jm,{label:`Logout`,keys:yn(`logout`),icon:nt,slot:`sidebar-logout`,danger:!0,onClick:()=>{a(),n()}})]})}function Jm({label:e,keys:t,icon:n,slot:r,danger:i,onClick:a}){return(0,A.jsx)(Um,{className:`w-full`,children:(0,A.jsxs)(Gm,{tooltip:t?{children:(0,A.jsx)(ot,{label:e,keys:t})}:e,onClick:a,"data-slot":r,className:c(Km,i?`hover:bg-destructive/10! hover:text-destructive`:`hover:bg-muted/50! hover:text-foreground`),children:[(0,A.jsx)(E,{icon:n}),(0,A.jsx)(`span`,{className:`sr-only`,children:e})]})})}var Ym=[`/overview`,`/flows`,`/store`,`/observability`,`/vault`,`/access`],Xm=`oke.console.last-module-search`;function Zm(e){return Ym.includes(e)}function Qm(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:{...e}}function $m(e,t){if(e===void 0)return Object.keys(t).length===0;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>e[n]===t[n])}function eh(e,t,n){let r=t===`/monitoring`?`/observability`:t;return!Zm(r)||$m(e[r],n)?e:{...e,[r]:{...n}}}function th(e,t){return e[t]??{}}function nh(e){if(e===null||e.length===0)return{};try{let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))return{};let n={},r=t;for(let e of Ym){let t=r[e];t&&typeof t==`object`&&!Array.isArray(t)&&(n[e]={...t})}let i=r[`/monitoring`];return n[`/observability`]===void 0&&i&&typeof i==`object`&&!Array.isArray(i)&&(n[`/observability`]={...i}),n}catch{return{}}}function rh(e=ah()){if(!e)return{};try{return nh(e.getItem(Xm))}catch{return{}}}function ih(e,t=ah()){if(t)try{t.setItem(Xm,JSON.stringify(e))}catch{}}function ah(){try{return typeof sessionStorage>`u`?null:sessionStorage}catch{return null}}function oh(){let e=zi({select:e=>({pathname:e.location.pathname,search:e.location.search})}),[t,n]=(0,k.useState)(rh);return(0,k.useEffect)(()=>{if(!Zm(e.pathname))return;let t=Qm(e.search);n(n=>{let r=eh(n,e.pathname,t);return r===n?n:(ih(r),r)})},[e.pathname,e.search]),t}var sh=`rounded-none! justify-center hover:bg-muted/50! hover:text-foreground data-active:bg-muted/70! data-active:text-foreground group-data-[collapsible=icon]:h-10! group-data-[collapsible=icon]:w-full! group-data-[collapsible=icon]:p-0!`,ch=[{title:`Overview`,to:`/overview`,icon:Ge,shortcut:`overview`},{title:`Flows`,to:`/flows`,icon:S,shortcut:`flows`},{title:`Store`,to:`/store`,icon:tt,shortcut:`store`},{title:`Observability`,to:`/observability`,icon:Ee,shortcut:`observability`},{title:`Vault`,to:`/vault`,icon:ye,shortcut:`vault`},{title:`Access`,to:`/access`,icon:me,shortcut:`access`}];function lh(){return(0,A.jsx)(`div`,{className:`flex w-full items-center justify-center px-0`,children:(0,A.jsx)(vo,{className:`size-5`})})}function uh({onFast:e,onSettings:t,onLogout:n,...r}){let i=zi({select:e=>e.location.pathname}),a=oh();return(0,A.jsxs)(Pm,{collapsible:`icon`,...r,children:[(0,A.jsx)(Lm,{className:`h-10 justify-center border-b border-border/60 p-0`,children:(0,A.jsx)(lh,{})}),(0,A.jsx)(zm,{children:(0,A.jsxs)(Bm,{className:`items-stretch p-0`,children:[(0,A.jsx)(Vm,{children:`Console`}),(0,A.jsx)(Hm,{className:`items-stretch gap-0`,children:ch.map(e=>(0,A.jsx)(Um,{className:`w-full`,children:(0,A.jsxs)(Gm,{render:(0,A.jsx)(nn,{to:e.to,search:th(a,e.to)}),isActive:i===e.to,tooltip:{children:(0,A.jsx)(ot,{label:e.title,keys:yn(e.shortcut)})},className:sh,children:[(0,A.jsx)(E,{icon:e.icon}),(0,A.jsx)(`span`,{className:`sr-only`,children:e.title})]})},e.to))})]})}),(0,A.jsx)(Rm,{className:`border-t border-border/60 p-0`,children:(0,A.jsx)(qm,{onFast:e,onSettings:t,onLogout:n})})]})}var dh=[{title:`Overview`,to:`/overview`,icon:Ge,keywords:[`home`,`traces`],shortcut:`overview`},{title:`Flows`,to:`/flows`,icon:S,keywords:[`units`,`call`],shortcut:`flows`},{title:`Store`,to:`/store`,icon:tt,keywords:[`sql`,`kv`,`files`],shortcut:`store`},{title:`Observability`,to:`/observability`,icon:Ee,keywords:[`runs`,`metrics`,`monitoring`],shortcut:`observability`},{title:`Vault`,to:`/vault`,icon:ye,keywords:[`secrets`,`contracts`],shortcut:`vault`},{title:`Access`,to:`/access`,icon:me,keywords:[`keys`,`api`,`scopes`],shortcut:`access`}];function fh(e){let n=dh.map(t=>({id:`go:${t.to}`,label:t.title,group:`Navigate`,keys:yn(t.shortcut),keywords:t.keywords,icon:t.icon,onSelect:()=>e.go(t.to,th(e.memory,t.to))})),r=[{id:`theme:light`,label:`Light`,group:`Appearance`,keywords:[`theme`,`day`],icon:t,onSelect:()=>e.setTheme(`light`)},{id:`theme:dark`,label:`Dark`,group:`Appearance`,keywords:[`theme`,`night`],icon:ue,onSelect:()=>e.setTheme(`dark`)},{id:`theme:system`,label:`System`,group:`Appearance`,keywords:[`theme`,`auto`],icon:mt,onSelect:()=>e.setTheme(`system`)}],i=[{id:`settings`,label:`Settings`,group:`Account`,keys:yn(`settings`),keywords:[`preferences`,`operator`],icon:m,onSelect:e.openSettings},{id:`logout`,label:`Logout`,group:`Account`,keys:yn(`logout`),keywords:[`sign out`,`exit`],icon:nt,onSelect:e.logout}];return[...n,...r,...i]}var ph=e(Ft(),1);function mh(e,t){if(e.length===0)return!0;let n=e.toLowerCase(),r=t.toLowerCase(),i=0;for(let e of r)if(e===n[i]&&(i+=1),i===n.length)return!0;return!1}function hh(e,t){return t.length===0?e:e.filter(e=>[e.label,e.group??``,...e.keywords??[]].some(e=>mh(t,e)))}var gh=`h-auto min-w-0 bg-transparent px-0 font-mono text-[10px] tracking-[0.08em] text-muted-foreground`,_h={type:`spring`,stiffness:560,damping:40,mass:.5};function vh({items:e,shortcut:t=`k`,placeholder:n=`Type a command or search…`,emptyMessage:r=`No results found.`,open:i,onOpenChange:a}){let[o,s]=(0,k.useState)(!1),l=i!==void 0,u=l?i:o,d=(0,k.useCallback)(e=>{l||s(e),a?.(e)},[l,a]),[f,p]=(0,k.useState)(``),[m,h]=(0,k.useState)(0),[g,_]=(0,k.useState)(!1);(0,k.useEffect)(()=>_(!0),[]);let v=(0,k.useId)(),y=fn(),b=(0,k.useCallback)(e=>{p(e),h(0)},[]),x=(0,k.useRef)(null),S=(0,k.useRef)(null);(0,k.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===t.toLowerCase()){e.preventDefault(),d(!u);return}e.key===`Escape`&&u&&(e.preventDefault(),d(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[u,t,d]),(0,k.useEffect)(()=>{u&&(b(``),h(0),requestAnimationFrame(()=>x.current?.focus()))},[u,b]),(0,k.useEffect)(()=>{if(!u)return;let e=document.documentElement,t=e.style.overflow,n=document.body.style.overflow;return e.style.overflow=`hidden`,document.body.style.overflow=`hidden`,()=>{e.style.overflow=t,document.body.style.overflow=n}},[u]);let C=(0,k.useMemo)(()=>hh(e,f),[e,f]),ee=(0,k.useMemo)(()=>e.some(e=>e.icon!==void 0),[e]),te=(0,k.useMemo)(()=>{let e=new Map;for(let t of C){let n=t.group??`Results`,r=e.get(n)??[];r.push(t),e.set(n,r)}return Array.from(e.entries())},[C]),ne=e=>{if(C.length!==0){if(e.key===`ArrowDown`)e.preventDefault(),h(e=>Math.min(C.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),h(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=C[m];t&&(t.onSelect(),d(!1))}}};if((0,k.useEffect)(()=>{u&&(S.current?.querySelector(`[data-index="${m}"]`))?.scrollIntoView({block:`nearest`})},[m,u]),!g)return null;let re=0,ie=vn(t.toUpperCase());return(0,ph.createPortal)((0,A.jsxs)(`div`,{"aria-hidden":!u,inert:!u,"data-slot":`command-palette`,className:c(`fixed inset-0 z-100 flex items-start justify-center px-4 pt-[12vh]`,u?`pointer-events-auto`:`pointer-events-none`),children:[(0,A.jsx)(pn.button,{type:`button`,"aria-label":`Close command palette`,initial:!1,animate:{opacity:+!!u},transition:{duration:u?.18:.12},onClick:()=>d(!1),className:c(`absolute inset-0 bg-black/20`,u?`pointer-events-auto`:`pointer-events-none`)}),(0,A.jsxs)(pn.div,{role:`dialog`,"aria-modal":`true`,"aria-label":`Command palette`,initial:!1,animate:{opacity:+!!u,y:u||y?0:-8,scale:u||y?1:.97},transition:y?{duration:.1}:u?_h:{duration:.12},onKeyDown:ne,className:c(`relative w-full max-w-xl overflow-hidden rounded-none border border-border bg-popover text-popover-foreground shadow-lg will-change-transform`,u?`pointer-events-auto`:`pointer-events-none`),children:[(0,A.jsxs)(`div`,{className:ze,children:[(0,A.jsx)(`span`,{className:c(Ie,`pointer-events-none`),children:(0,A.jsx)(E,{icon:xe,className:ut})}),(0,A.jsx)(`input`,{ref:x,value:f,onChange:e=>b(e.target.value),placeholder:n,tabIndex:u?0:-1,role:`combobox`,"aria-expanded":u,"aria-controls":`${v}-list`,"aria-activedescendant":C.length>0?`${v}-opt-${m}`:void 0,"aria-autocomplete":`list`,className:ft}),(0,A.jsxs)(`span`,{className:`flex h-full shrink-0 items-center gap-2 pr-2`,children:[(0,A.jsx)(`span`,{className:`inline-flex items-center gap-0.5`,children:ie.map(e=>(0,A.jsx)(ht,{className:gh,children:e},e))}),(0,A.jsx)(ht,{className:gh,children:`Esc`})]})]}),(0,A.jsx)(`div`,{ref:S,id:`${v}-list`,role:`listbox`,"aria-label":`Commands`,className:`max-h-[60vh] overflow-y-auto overscroll-contain`,children:C.length===0?(0,A.jsx)(`p`,{className:_t,children:r}):te.map(([e,t])=>(0,A.jsxs)(`div`,{className:`border-b border-border/60 last:border-b-0`,children:[(0,A.jsx)(`div`,{"aria-hidden":!0,className:c(Ot,`px-2 py-1.5`),children:e}),t.map(e=>{let t=re;re+=1;let n=t===m,r=e.icon;return(0,A.jsxs)(`button`,{type:`button`,id:`${v}-opt-${t}`,role:`option`,"aria-selected":n,"data-index":t,onMouseEnter:()=>h(t),onClick:()=>{e.onSelect(),d(!1)},tabIndex:u?0:-1,className:c(Ue,`border-b-0`,n&&`bg-muted/70 text-foreground`),children:[n?(0,A.jsx)(`span`,{className:c(xt,at)}):null,r?(0,A.jsx)(E,{icon:r,className:`relative z-10 size-3.5 shrink-0 text-muted-foreground`}):ee?(0,A.jsx)(`span`,{className:`size-3.5 shrink-0`}):null,(0,A.jsx)(`span`,{className:`relative z-10 min-w-0 flex-1 truncate`,children:e.label}),e.badge?(0,A.jsx)(`span`,{className:`relative z-10 shrink-0 text-[10px] text-muted-foreground`,children:e.badge}):null,e.keys&&e.keys.length>0?(0,A.jsx)(vt,{keys:e.keys,className:`relative z-10`}):e.hint?(0,A.jsx)(`span`,{className:`relative z-10 shrink-0 text-[10px] text-muted-foreground`,children:e.hint}):null]},e.id)})]},e))})]})]}),document.body)}function yh({...e}){return(0,A.jsx)(We,{"data-slot":`dialog`,...e})}function bh({...e}){return(0,A.jsx)(Ye,{"data-slot":`dialog-portal`,...e})}function xh({className:e,...t}){return(0,A.jsx)(Le,{"data-slot":`dialog-overlay`,className:c(`fixed inset-0 z-50 bg-black/20 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs`,e),...t})}function Sh({className:e,children:t,...n}){return(0,A.jsxs)(bh,{children:[(0,A.jsx)(xh,{}),(0,A.jsx)(Ne,{"data-slot":`dialog-content`,className:c(`fixed top-1/2 left-1/2 z-50 w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-none border border-border bg-popover text-sm text-popover-foreground shadow-lg outline-none transition duration-150 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0`,e),...n,children:t})]})}function Ch({className:e,...t}){return(0,A.jsx)(`div`,{"data-slot":`dialog-header`,className:c(`flex flex-col gap-1 border-b border-border/60 px-4 py-3`,e),...t})}function wh({className:e,...t}){return(0,A.jsx)(Be,{"data-slot":`dialog-title`,className:c(`text-sm font-medium text-foreground`,e),...t})}function Th({className:e,...t}){return(0,A.jsx)(kt,{"data-slot":`dialog-description`,className:c(`text-[11px] text-muted-foreground`,e),...t})}function Eh({open:e,onOpenChange:t,operator:n}){return(0,A.jsx)(yh,{open:e,onOpenChange:t,children:(0,A.jsxs)(Sh,{"data-slot":`settings-dialog`,children:[(0,A.jsxs)(Ch,{children:[(0,A.jsx)(wh,{children:`Settings`}),(0,A.jsx)(Th,{children:`Operator account and appearance.`})]}),(0,A.jsxs)(`dl`,{className:`flex flex-col`,children:[(0,A.jsx)(Dh,{label:`Name`,value:n.name}),(0,A.jsx)(Dh,{label:`Email`,value:n.email}),(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-2`,children:[(0,A.jsx)(`dt`,{className:Ot,children:`Theme`}),(0,A.jsx)(`dd`,{children:(0,A.jsx)(go,{})})]})]})]})})}function Dh({label:e,value:t}){return(0,A.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 border-b border-border/60 px-4 py-2`,children:[(0,A.jsx)(`dt`,{className:Ot,children:e}),(0,A.jsx)(`dd`,{className:`min-w-0 truncate text-xs text-foreground`,children:t})]})}async function Oh(){try{await pe()}finally{i(null)}}function kh(e){let t=(0,k.useRef)(e);t.current=e,(0,k.useEffect)(()=>{let e=e=>{let{enabled:n,go:r,openSettings:i,logout:a}=t.current;if(!n||e.repeat||bn(e.target)||!(e.metaKey||e.ctrlKey)||e.altKey)return;if(e.key===`,`){e.preventDefault(),i();return}if(e.key.toLowerCase()===`e`){e.preventDefault(),a();return}let o=xn[e.key];o&&(e.preventDefault(),r(o))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}function Ah({operator:e}){let t=zi({select:e=>e.location.pathname}),n=T(),r=oh(),{setTheme:i}=hn(),[a,o]=(0,k.useState)(!1),[s,l]=(0,k.useState)(!1),u=t===`/overview`||t===`/flows`||t===`/store`||t===`/vault`||t===`/access`||t===`/observability`,d=(0,k.useCallback)(()=>{Oh().then(()=>{n({to:`/`})})},[n]),f=(0,k.useCallback)((e,t)=>{n({to:e,search:t})},[n]),p=(0,k.useMemo)(()=>fh({memory:r,go:f,openSettings:()=>o(!0),logout:d,setTheme:i}),[f,d,r,i]);return kh({enabled:!s&&!a,go:e=>f(e,th(r,e)),openSettings:()=>o(!0),logout:d}),(0,A.jsxs)(Nm,{open:!1,className:u?`h-svh max-h-svh overflow-hidden`:void 0,children:[(0,A.jsx)(uh,{onFast:()=>l(!0),onSettings:()=>o(!0),onLogout:d}),(0,A.jsx)(Im,{className:u?`min-h-0 max-h-svh overflow-hidden`:void 0,children:(0,A.jsxs)(`div`,{className:c(`flex flex-col`,u?`h-svh max-h-svh min-h-0 overflow-hidden`:`flex-1 gap-4 p-4`),children:[(0,A.jsx)(Fm,{className:`-ml-1 md:hidden`}),(0,A.jsx)(Ai,{})]})}),(0,A.jsx)(Eh,{open:a,onOpenChange:o,operator:e}),(0,A.jsx)(vh,{open:s,onOpenChange:l,items:p})]})}async function jh({location:e}){let t=Ka(`${e.pathname}${e.searchStr}`);if(!$e())throw Jn({to:`/`,search:t});let n=await jt();if(n.error||!n.data)throw i(null),Jn({to:`/`,search:t});let r={operatorId:n.data.operatorId,email:n.data.email,name:n.data.name};return g(r),{operator:r}}var Mh=vi({component:function(){return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Sm,{}),(0,A.jsx)(Ai,{})]})}}),Nh=N({getParentRoute:()=>Mh,path:`/`,validateSearch:Ga,component:vm}),$=N({getParentRoute:()=>Mh,id:`authenticated`,beforeLoad:jh,component:function(){let{operator:e}=$.useRouteContext();return(0,A.jsx)(Ah,{operator:e})}}),Ph=N({getParentRoute:()=>$,path:`/overview`,validateSearch:Ca,component:yi(()=>gn(()=>import(`./flows-page-BiZ4-6yQ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])),`FlowsPage`)}),Fh=N({getParentRoute:()=>$,path:`/flows`,validateSearch:Ta,component:yi(()=>gn(()=>import(`./units-page-CjtdlW8l.js`),__vite__mapDeps([19,1,2,3,4,5,20,21,22,23,9,17,24,25,26,10,11,12,13,16,14,15])),`UnitsPage`)}),Ih=N({getParentRoute:()=>$,path:`/store`,validateSearch:sn,component:yi(()=>gn(()=>import(`./store-page-CS5-aETQ.js`),__vite__mapDeps([27,1,2,3,4,5,23,20,28,6,7,12,21,22,9,17,24,15,29,25,26,30,11,18,14,31])),`StorePage`)}),Lh=N({getParentRoute:()=>$,path:`/vault`,validateSearch:Fa,component:yi(()=>gn(()=>import(`./vault-page-C6Xxm9SA.js`),__vite__mapDeps([32,1,2,3,4,5,23,20,21,9,25,26,30,14,15,33])),`VaultPage`)}),Rh=N({getParentRoute:()=>$,path:`/access`,validateSearch:La,component:yi(()=>gn(()=>import(`./access-page-DnWbnGzq.js`),__vite__mapDeps([34,1,2,3,4,5,23,9,25,26,30,10])),`AccessPage`)}),zh=N({getParentRoute:()=>$,path:`/observability`,validateSearch:Na,component:yi(()=>gn(()=>import(`./observability-page-CrB6vd1T.js`),__vite__mapDeps([35,1,2,3,4,5,23,20,6,7,8,9,10,11,12,13,14,15,25,31,29,24,33])),`ObservabilityPage`)}),Bh=N({getParentRoute:()=>$,path:`/monitoring`,validateSearch:Na,beforeLoad:({search:e})=>{throw Jn({to:`/observability`,search:e})}}),Vh=Fi({routeTree:Mh.addChildren([Nh,$.addChildren([Ph,Fh,Ih,Lh,Rh,zh,Bh])]),defaultNotFoundComponent:bo,defaultPendingComponent:()=>(0,A.jsx)(`div`,{className:`grid min-h-dvh place-items-center text-sm text-muted-foreground`,children:`Loading…`})});we(e=>{let t=e.split(`?`)[0]??``;t!==`/`&&t!==``&&Vh.navigate({to:`/`,search:Ka(e)})}),le();var Hh=new Tn({defaultOptions:{queries:{staleTime:5e3,refetchOnWindowFocus:!1}}}),Uh=document.getElementById(`root`);if(!Uh)throw Error(`Missing #root`);(0,Sa.createRoot)(Uh).render((0,A.jsx)(k.StrictMode,{children:(0,A.jsx)(mn,{defaultTheme:`system`,storageKey:`oke-console-theme`,children:(0,A.jsx)(y,{delay:0,children:(0,A.jsx)(de,{client:Hh,children:(0,A.jsx)(xa,{children:(0,A.jsx)(Ri,{router:Vh})})})})})}));export{Da as a,ja as c,wa as d,Pa as i,Ma as l,Ra as n,Aa as o,Ia as r,ka as s,_o as t,Ea as u};