@dhzh/foundry 1.0.0-beta.2 → 1.0.0

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.
Files changed (32) hide show
  1. package/README.md +18 -3
  2. package/dist/app/index.html +1 -1
  3. package/dist/app/static/css/index.d70550a45d.css +2 -0
  4. package/dist/app/static/font/inter-cyrillic-ext-wght-normal.460bdf14be.woff2 +0 -0
  5. package/dist/app/static/font/inter-cyrillic-wght-normal.491cbc05ce.woff2 +0 -0
  6. package/dist/app/static/font/inter-greek-ext-wght-normal.23aae5683d.woff2 +0 -0
  7. package/dist/app/static/font/inter-greek-wght-normal.4449bf7aab.woff2 +0 -0
  8. package/dist/app/static/font/inter-latin-ext-wght-normal.3835a68e46.woff2 +0 -0
  9. package/dist/app/static/font/inter-latin-wght-normal.6c596dfcdd.woff2 +0 -0
  10. package/dist/app/static/font/inter-vietnamese-wght-normal.113a630f76.woff2 +0 -0
  11. package/dist/app/static/js/291.86e65fdc76.js +2 -0
  12. package/dist/app/static/js/291.86e65fdc76.js.LICENSE.txt +19 -0
  13. package/dist/app/static/js/index.44302bff22.js +1 -0
  14. package/dist/app/static/js/lib-react.2d16964d11.js +2 -0
  15. package/dist/app/static/js/lib-router.1aa7ec2bfc.js +3 -0
  16. package/dist/app/static/js/lib-router.1aa7ec2bfc.js.LICENSE.txt +10 -0
  17. package/dist/cli.d.mts +1 -5
  18. package/dist/cli.mjs +25 -1
  19. package/dist/index.mjs +1 -1
  20. package/dist/migrations/0000_initial-settings.sql +26 -0
  21. package/dist/migrations/0001_youthful_tigra.sql +28 -0
  22. package/dist/migrations/0002_brainy_patriot.sql +15 -0
  23. package/dist/migrations/meta/0000_snapshot.json +103 -0
  24. package/dist/migrations/meta/0001_snapshot.json +240 -0
  25. package/dist/migrations/meta/0002_snapshot.json +306 -0
  26. package/dist/migrations/meta/_journal.json +27 -0
  27. package/dist/package-Dg-nUTkb.mjs +2 -0
  28. package/package.json +13 -2
  29. package/dist/app/static/js/index.a19e8d569b.js +0 -1
  30. package/dist/app/static/js/lib-react.4b996dfd19.js +0 -2
  31. package/dist/package-BksDGVza.mjs +0 -2
  32. /package/dist/app/static/js/{lib-react.4b996dfd19.js.LICENSE.txt → lib-react.2d16964d11.js.LICENSE.txt} +0 -0
@@ -0,0 +1,3 @@
1
+ /*! LICENSE: lib-router.1aa7ec2bfc.js.LICENSE.txt */
2
+ "use strict";(self.rspackChunk_dhzh_foundry_app=self.rspackChunk_dhzh_foundry_app||[]).push([[535],{8071(e,t,r){r.d(t,{C5:()=>y,sv:()=>v,Ix:()=>g,pg:()=>f,jC:()=>d});var n=r(7629),a=r(9932),o=r(7527),i=r(4508),l=r(8189);let s={};function u(e,t){e||s[t]||(s[t]=!0,console.warn(t))}var c=r(6255);let d=["HydrateFallback","hydrateFallbackElement"];var h=class{status="pending";promise;resolve;reject;constructor(){this.promise=new Promise((e,t)=>{this.resolve=t=>{"pending"===this.status&&(this.status="resolved",e(t))},this.reject=e=>{"pending"===this.status&&(this.status="rejected",t(e))}})}};function f({router:e,flushSync:t,onError:r,useTransitions:n}){n=(0,i.OA)()||n;let[o,l]=c.useState(e.state),[s,d]=(0,c.useOptimistic)(o),[y,v]=c.useState(),[w,b]=c.useState({isTransitioning:!1}),[R,E]=c.useState(),[x,S]=c.useState(),[L,P]=c.useState(),k=c.useRef(new Map),C=c.useCallback((o,{deletedFetchers:i,newErrors:s,flushSync:h,viewTransitionOpts:f})=>{s&&r&&Object.values(s).forEach(e=>r(e,{location:o.location,params:o.matches[0]?.params??{},pattern:(0,a.gU)(o.matches)})),o.fetchers.forEach((e,t)=>{void 0!==e.data&&k.current.set(t,e.data)}),i.forEach(e=>k.current.delete(e)),u(!1===h||null!=t,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let m=null!=e.window&&null!=e.window.document&&"function"==typeof e.window.document.startViewTransition;if(u(null==f||m,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!f||!m)return void(t&&h?t(()=>l(o)):!1===n?l(o):c.startTransition(()=>{!0===n&&d(e=>p(e,o)),l(o)}));if(t&&h){t(()=>{x&&(R?.resolve(),x.skipTransition()),b({isTransitioning:!0,flushSync:!0,currentLocation:f.currentLocation,nextLocation:f.nextLocation})});let r=e.window.document.startViewTransition(()=>{t(()=>l(o))});r.finished.finally(()=>{t(()=>{E(void 0),S(void 0),v(void 0),b({isTransitioning:!1})})}),t(()=>S(r));return}x?(R?.resolve(),x.skipTransition(),P({state:o,currentLocation:f.currentLocation,nextLocation:f.nextLocation})):(v(o),b({isTransitioning:!0,flushSync:!1,currentLocation:f.currentLocation,nextLocation:f.nextLocation}))},[e.window,t,x,R,n,d,r]);c.useLayoutEffect(()=>e.subscribe(C),[e,C]),c.useEffect(()=>{w.isTransitioning&&!w.flushSync&&E(new h)},[w]),c.useEffect(()=>{if(R&&y&&e.window){let t=R.promise,r=e.window.document.startViewTransition(async()=>{!1===n?l(y):c.startTransition(()=>{!0===n&&d(e=>p(e,y)),l(y)}),await t});r.finished.finally(()=>{E(void 0),S(void 0),v(void 0),b({isTransitioning:!1})}),S(r)}},[y,R,e.window,n,d]),c.useEffect(()=>{R&&y&&s.location.key===y.location.key&&R.resolve()},[R,x,s.location,y]),c.useEffect(()=>{!w.isTransitioning&&L&&(v(L.state),b({isTransitioning:!0,flushSync:!1,currentLocation:L.currentLocation,nextLocation:L.nextLocation}),P(void 0))},[w.isTransitioning,L]);let D=c.useMemo(()=>({createHref:e.createHref,createURL:e.createURL,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,r,n)=>e.navigate(t,{state:r,preventScrollReset:n?.preventScrollReset}),replace:(t,r,n)=>e.navigate(t,{replace:!0,state:r,preventScrollReset:n?.preventScrollReset})}),[e]),M=e.basename||"/",O=c.useMemo(()=>({router:e,navigator:D,static:!1,basename:M,onError:r}),[e,D,M,r]);return c.createElement(c.Fragment,null,c.createElement(i.hf.Provider,{value:O},c.createElement(i.ay.Provider,{value:s},c.createElement(i.QH.Provider,{value:k.current},c.createElement(i.KZ.Provider,{value:w},c.createElement(g,{basename:M,location:s.location,navigationType:s.historyAction,navigator:D,useTransitions:n},c.createElement(m,{routes:e.routes,manifest:e.manifest,future:e.future,state:s,isStatic:!1,onError:r})))))),null)}function p(e,t){return{...e,navigation:"idle"!==t.navigation.state?t.navigation:e.navigation,revalidation:"idle"!==t.revalidation?t.revalidation:e.revalidation,actionData:"submitting"!==t.navigation.state?t.actionData:e.actionData,fetchers:t.fetchers}}let m=c.memo(function({routes:e,manifest:t,future:r,state:n,isStatic:a,onError:o}){return(0,l.uG)(e,void 0,{manifest:t,state:n,isStatic:a,onError:o,future:r})});function y({to:e,replace:t,state:r,relative:s}){(0,n.V1)((0,l.Ri)(),"<Navigate> may be used only in the context of a <Router> component.");let{static:u,navigator:d}=c.useContext(i._3);(0,n.$e)(!u,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:h}=c.useContext(i.Pl),{pathname:f}=(0,l.zy)(),p=(0,l.Zp)(),m=(0,a.Gh)(e,(0,a.PD)(h),f,"path"===s);(0,o.c)("string"==typeof e?e:(0,n.AO)(e),d.createHref(m),(0,o.Y)(d),"reject");let v=JSON.stringify(m);return c.useEffect(()=>{p(JSON.parse(v),{replace:t,state:r,relative:s})},[p,v,s,t,r]),null}function v(e){return(0,l.P1)(e.context)}function g({basename:e="/",children:t=null,location:r,navigationType:o="POP",navigator:s,static:u=!1,useTransitions:d}){(0,n.V1)(!(0,l.Ri)(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=e.replace(/^\/*/,"/"),f=c.useMemo(()=>({basename:h,navigator:s,static:u,useTransitions:d,future:{}}),[h,s,u,d]);"string"==typeof r&&(r=(0,n.Rr)(r));let{pathname:p="/",search:m="",hash:y="",state:v=null,key:w="default",mask:b}=r,R=c.useMemo(()=>{let e=(0,a.pb)(p,h);return null==e?null:{location:{pathname:e,search:m,hash:y,state:v,key:w,mask:b},navigationType:o}},[h,p,m,y,v,w,o,b]);return((0,n.$e)(null!=R,`<Router basename="${h}"> is not able to match the URL "${p}${m}${y}" because it does not start with the basename, so the <Router> won't render anything.`),null==R)?null:c.createElement(i._3.Provider,{value:f},c.createElement(i.di.Provider,{children:t,value:R}))}c.Component},4508(e,t,r){var n=r(6255);let a=n.createContext(null);a.displayName="DataRouter";let o=n.createContext(null);o.displayName="DataRouterState";let i=n.createContext(!1);function l(){return n.useContext(i)}let s=n.createContext({isTransitioning:!1});s.displayName="ViewTransition";let u=n.createContext(new Map);u.displayName="Fetchers";let c=n.createContext(null);c.displayName="Await";let d=n.createContext(null);d.displayName="Navigation";let h=n.createContext(null);h.displayName="Location";let f=n.createContext({outlet:null,matches:[],isDataRoute:!1});f.displayName="Route";let p=n.createContext(null);p.displayName="RouteError",r.d(t,{OA:()=>l},{Bu:i,KZ:s,Pl:f,QH:u,_3:d,ay:o,di:h,hf:a,m4:c,xN:p})},6653(e,t,r){var n=r(6255),a=r(7965),o=r(8071);function i(e){return n.createElement(o.pg,{flushSync:a.flushSync,...e})}r.d(t,{p:()=>i})},6551(e,t,r){r.d(t,{N_:()=>O,k2:()=>T,Ge:()=>M,ok:()=>A});var n=r(2872),a=r(7629),o=r(9932),i=r(9667),l=r(4508),s=r(8189),u=r(8071);let c="application/x-www-form-urlencoded";function d(e){return"u">typeof HTMLElement&&e instanceof HTMLElement}function h(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(e=>[r,e]):[[r,n]])},[]))}let f=null,p=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function m(e){return null==e||p.has(e)?e:((0,a.$e)(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${c}"`),null)}function y(e,t){if(!1===e||null==e)throw Error(t)}async function v(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function g(e){return null!=e&&(null==e.href?"preload"===e.rel&&"string"==typeof e.imageSrcSet&&"string"==typeof e.imageSizes:"string"==typeof e.rel&&"string"==typeof e.href)}async function w(e,t,r){var n;let a,o;return n=(await Promise.all(e.map(async e=>{let n=t.routes[e.route.id];if(n){let e=await v(n,r);return e.links?e.links():[]}return[]}))).flat(1).filter(g).filter(e=>"stylesheet"===e.rel||"preload"===e.rel).map(e=>"stylesheet"===e.rel?{...e,rel:"prefetch",as:"style"}:{...e,rel:"prefetch"}),a=new Set,o=new Set(void 0),n.reduce((e,t)=>{!1;let r=JSON.stringify(function(e){let t={};for(let r of Object.keys(e).sort())t[r]=e[r];return t}(t));return a.has(r)||(a.add(r),e.push({key:r,link:t})),e},[])}function b(e,t,r,n,a,o){let i=(e,t)=>!r[t]||e.route.id!==r[t].route.id,l=(e,t)=>r[t].pathname!==e.pathname||r[t].route.path?.endsWith("*")&&r[t].params["*"]!==e.params["*"];return"assets"===o?t.filter((e,t)=>i(e,t)||l(e,t)):"data"===o?t.filter((t,o)=>{let s=n.routes[t.route.id];if(!s||!s.hasLoader)return!1;if(i(t,o)||l(t,o))return!0;if(t.route.shouldRevalidate){let n=t.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if("boolean"==typeof n)return n}return!0}):[]}var R=r(6255);function E(e,t){let r="string"==typeof e?new URL(e,"u"<typeof window?"server://singlefetch/":window.location.origin):e;return r.pathname.endsWith("/")?r.pathname=`${r.pathname}_.${t}`:r.pathname=`${r.pathname}.${t}`,r}Symbol("SingleFetchRedirect");let x=R.createContext(void 0);function S(){let e=R.useContext(x);return y(e,"You must render this element inside a <HydratedRouter> element"),e}function L(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function P({page:e,...t}){let r,n=(0,l.OA)(),{nonce:a}=S(),{router:i}=(y(r=R.useContext(l.hf),"You must render this element inside a <DataRouterContext.Provider> element"),r),s=R.useMemo(()=>(0,o.ue)(i.routes,e,i.basename),[i.routes,e,i.basename]);return s?(null==t.nonce&&a&&(t={...t,nonce:a}),n)?R.createElement(k,{page:e,matches:s,...t}):R.createElement(C,{page:e,matches:s,...t}):null}function k({page:e,matches:t,...r}){let n=(0,s.zy)(),a=R.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let r=E(e,"rsc"),a=!1,o=[];for(let e of t)"function"==typeof e.route.shouldRevalidate?a=!0:o.push(e.route.id);return a&&o.length>0&&r.searchParams.set("_routes",o.join(",")),[r.pathname+r.search]},[e,n,t]);return R.createElement(R.Fragment,null,a.map(e=>R.createElement("link",{key:e,rel:"prefetch",as:"fetch",href:e,...r})))}function C({page:e,matches:t,...r}){let n,a=(0,s.zy)(),{manifest:o,routeModules:i}=S(),{loaderData:u,matches:c}=(y(n=R.useContext(l.ay),"You must render this element inside a <DataRouterStateContext.Provider> element"),n),d=R.useMemo(()=>b(e,t,c,o,a,"data"),[e,t,c,o,a]),h=R.useMemo(()=>b(e,t,c,o,a,"assets"),[e,t,c,o,a]),f=R.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let r=new Set,n=!1;if(t.forEach(e=>{let t=o.routes[e.route.id];t&&t.hasLoader&&(!d.some(t=>t.route.id===e.route.id)&&e.route.id in u&&i[e.route.id]?.shouldRevalidate||t.hasClientLoader?n=!0:r.add(e.route.id))}),0===r.size)return[];let l=E(e,"data");return n&&r.size>0&&l.searchParams.set("_routes",t.filter(e=>r.has(e.route.id)).map(e=>e.route.id).join(",")),[l.pathname+l.search]},[u,a,o,d,t,e,i]),p=R.useMemo(()=>(function(e,t,{includeHydrateFallback:r}={}){return[...new Set(e.map(e=>{let n=t.routes[e.route.id];if(!n)return[];let a=[n.module];return n.clientActionModule&&(a=a.concat(n.clientActionModule)),n.clientLoaderModule&&(a=a.concat(n.clientLoaderModule)),r&&n.hydrateFallbackModule&&(a=a.concat(n.hydrateFallbackModule)),n.imports&&(a=a.concat(n.imports)),a}).flat(1))]})(h,o),[h,o]),m=function(e){let{manifest:t,routeModules:r}=S(),[n,a]=R.useState([]);return R.useEffect(()=>{let n=!1;return w(e,t,r).then(e=>{n||a(e)}),()=>{n=!0}},[e,t,r]),n}(h);return R.createElement(R.Fragment,null,f.map(e=>R.createElement("link",{key:e,rel:"prefetch",as:"fetch",href:e,...r})),p.map(e=>R.createElement("link",{key:e,rel:"modulepreload",href:e,...r})),m.map(({key:e,link:t})=>R.createElement("link",{key:e,nonce:r.nonce,...t,crossOrigin:t.crossOrigin??r.crossOrigin})))}x.displayName="FrameworkContext";let D="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement;try{D&&(window.__reactRouterVersion="8")}catch{}function M(e,t){let r;return(0,i.aE)({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:(0,a.TM)({window:t?.window}),hydrationData:t?.hydrationData||((r=window?.__staticRouterHydrationData)&&r.errors&&(r={...r,errors:function(e){if(!e)return null;let t=Object.entries(e),r={};for(let[e,n]of t)if(n&&"RouteErrorResponse"===n.__type)r[e]=new o.cj(n.status,n.statusText,n.data,!0===n.internal);else if(n&&"Error"===n.__type){if("string"==typeof n.__subType&&o.WF.includes(n.__subType)){let t=window[n.__subType];if("function"==typeof t)try{let a=new t(n.message);a.stack="",r[e]=a}catch{}}if(null==r[e]){let t=Error(n.message);t.stack="",r[e]=t}}else r[e]=n;return r}(r.errors)}),r),routes:e,mapRouteProperties:o.MT,hydrationRouteProperties:u.jC,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}let O=R.forwardRef(function({onClick:e,discover:t="render",prefetch:r="none",relative:i,reloadDocument:u,replace:c,mask:d,state:h,target:f,to:p,preventScrollReset:m,viewTransition:y,defaultShouldRevalidate:v,...g},w){let{basename:b,navigator:E,useTransitions:S}=R.useContext(l._3),k="string"==typeof p&&n.E6.test(p),C=(0,o.X9)(p,b);p=C.to;let D=(0,s.$P)(p,{relative:i}),M=(0,s.zy)(),O=null;if(d){let e=(0,o.Gh)(d,[],M.mask?M.mask.pathname:"/",!0);"/"!==b&&(e.pathname="/"===e.pathname?b:(0,o.HS)([b,e.pathname])),O=E.createHref(e)}let[T,$,A]=function(e,t){let r=R.useContext(x),[n,a]=R.useState(!1),[o,i]=R.useState(!1),{onFocus:l,onBlur:s,onMouseEnter:u,onMouseLeave:c,onTouchStart:d}=t,h=R.useRef(null);R.useEffect(()=>{if("render"===e&&i(!0),"viewport"===e){let e=new IntersectionObserver(e=>{e.forEach(e=>{i(e.isIntersecting)})},{threshold:.5});return h.current&&e.observe(h.current),()=>{e.disconnect()}}},[e]),R.useEffect(()=>{if(n){let e=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(e)}}},[n]);let f=()=>{a(!0)},p=()=>{a(!1),i(!1)};return r?"intent"!==e?[o,h,{}]:[o,h,{onFocus:L(l,f),onBlur:L(s,p),onMouseEnter:L(u,f),onMouseLeave:L(c,p),onTouchStart:L(d,f)}]:[!1,h,{}]}(r,g),j=function(e,{target:t,replace:r,mask:n,state:o,preventScrollReset:i,relative:l,viewTransition:u,defaultShouldRevalidate:c,useTransitions:d}={}){let h=(0,s.Zp)(),f=(0,s.zy)(),p=(0,s.x$)(e,{relative:l});return R.useCallback(s=>{if(0===s.button&&(!t||"_self"===t)&&!(s.metaKey||s.altKey||s.ctrlKey||s.shiftKey)){s.preventDefault();let t=void 0!==r?r:(0,a.AO)(f)===(0,a.AO)(p),m=()=>h(e,{replace:t,mask:n,state:o,preventScrollReset:i,relative:l,viewTransition:u,defaultShouldRevalidate:c});d?R.startTransition(()=>m()):m()}},[f,h,p,r,n,o,t,e,i,l,u,c,d])}(p,{replace:c,mask:d,state:h,target:f,preventScrollReset:m,relative:i,viewTransition:y,defaultShouldRevalidate:v,useTransitions:S}),U=!(C.isExternal||u),z=R.createElement("a",{...g,...A,href:(U?O:void 0)||C.absoluteURL||D,onClick:U?function(t){e&&e(t),t.defaultPrevented||j(t)}:e,ref:function(...e){return t=>{e.forEach(e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)})}}(w,$),target:f,"data-discover":k||"render"!==t?void 0:"true"});return T&&!k?R.createElement(R.Fragment,null,z,R.createElement(P,{page:D})):z});O.displayName="Link";let T=R.forwardRef(function({"aria-current":e="page",caseSensitive:t=!1,className:r="",end:n=!1,style:i,to:u,viewTransition:c,children:d,...h},f){let p,m=(0,s.x$)(u,{relative:h.relative}),y=(0,s.zy)(),v=R.useContext(l.ay),{navigator:g,basename:w}=R.useContext(l._3),b=null!=v&&function(e,{relative:t}={}){let r=R.useContext(l.KZ);(0,a.V1)(null!=r,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=$("useViewTransitionState"),i=(0,s.x$)(e,{relative:t});if(!r.isTransitioning)return!1;let u=(0,o.pb)(r.currentLocation.pathname,n)||r.currentLocation.pathname,c=(0,o.pb)(r.nextLocation.pathname,n)||r.nextLocation.pathname;return null!=(0,o.B6)(i.pathname,c)||null!=(0,o.B6)(i.pathname,u)}(m)&&!0===c,E=g.encodeLocation?g.encodeLocation(m).pathname:m.pathname,x=y.pathname,S=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;t||(x=x.toLowerCase(),S=S?S.toLowerCase():null,E=E.toLowerCase()),S&&w&&(S=(0,o.pb)(S,w)||S);let L="/"!==E&&E.endsWith("/")?E.length-1:E.length,P=x===E||!n&&x.startsWith(E)&&"/"===x.charAt(L),k=null!=S&&(S===E||!n&&S.startsWith(E)&&"/"===S.charAt(L)),C={isActive:P,isPending:k,isTransitioning:b},D=P?e:void 0;p="function"==typeof r?r(C):[r,P?"active":null,k?"pending":null,b?"transitioning":null].filter(Boolean).join(" ");let M="function"==typeof i?i(C):i;return R.createElement(O,{...h,"aria-current":D,className:p,ref:f,style:M,to:u,viewTransition:c},"function"==typeof d?d(C):d)});T.displayName="NavLink",R.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:i,replace:u,state:h,method:p="get",action:y,onSubmit:v,relative:g,preventScrollReset:w,viewTransition:b,defaultShouldRevalidate:E,...x},S)=>{let{useTransitions:L}=R.useContext(l._3),P=function(){let{router:e}=$("useSubmit"),{basename:t}=R.useContext(l._3),r=(0,s.Gw)(),n=e.fetch,a=e.navigate;return R.useCallback(async(e,i={})=>{let{action:l,method:s,encType:u,formData:h,body:p}=function(e,t){let r,n,a,i,l;if(d(e)&&"form"===e.tagName.toLowerCase()){let l=e.getAttribute("action");n=l?(0,o.pb)(l,t):null,r=e.getAttribute("method")||"get",a=m(e.getAttribute("enctype"))||c,i=new FormData(e)}else if(d(e)&&"button"===e.tagName.toLowerCase()||d(e)&&"input"===e.tagName.toLowerCase()&&("submit"===e.type||"image"===e.type)){let l=e.form;if(null==l)throw Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||l.getAttribute("action");if(n=s?(0,o.pb)(s,t):null,r=e.getAttribute("formmethod")||l.getAttribute("method")||"get",a=m(e.getAttribute("formenctype"))||m(l.getAttribute("enctype"))||c,i=new FormData(l,e),!function(){if(null===f)try{new FormData(document.createElement("form"),0),f=!1}catch{f=!0}return f}()){let{name:t,type:r,value:n}=e;if("image"===r){let e=t?`${t}.`:"";i.append(`${e}x`,"0"),i.append(`${e}y`,"0")}else t&&i.append(t,n)}}else if(d(e))throw Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');else r="get",n=null,a=c,l=e;return i&&"text/plain"===a&&(l=i,i=void 0),{action:n,method:r.toLowerCase(),encType:a,formData:i,body:l}}(e,t);!1===i.navigate?await n(i.fetcherKey||`__${String(++j)}__`,r,i.action||l,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,relative:i.relative,formData:h,body:p,formMethod:i.method||s,formEncType:i.encType||u,flushSync:i.flushSync}):await a(i.action||l,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,relative:i.relative,formData:h,body:p,formMethod:i.method||s,formEncType:i.encType||u,replace:i.replace,state:i.state,fromRouteId:r,flushSync:i.flushSync,viewTransition:i.viewTransition})},[n,a,t,r])}(),k=function(e,{relative:t}={}){let{basename:r}=R.useContext(l._3),n=R.useContext(l.Pl);(0,a.V1)(n,"useFormAction must be used inside a RouteContext");let[i]=n.matches.slice(-1),u={...(0,s.x$)(e||".",{relative:t})},c=(0,s.zy)();if(null==e){u.search=c.search;let e=new URLSearchParams(u.search),t=e.getAll("index");if(t.some(e=>""===e)){e.delete("index"),t.filter(e=>e).forEach(t=>e.append("index",t));let r=e.toString();u.search=r?`?${r}`:""}}return(!e||"."===e)&&i.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),"/"!==r&&(u.pathname="/"===u.pathname?r:(0,o.HS)([r,u.pathname])),(0,a.AO)(u)}(y,{relative:g}),C="get"===p.toLowerCase()?"get":"post",D="string"==typeof y&&n.E6.test(y);return R.createElement("form",{ref:S,method:C,action:k,onSubmit:i?v:e=>{if(v&&v(e),e.defaultPrevented)return;e.preventDefault();let n=e.nativeEvent.submitter,a=n?.getAttribute("formmethod")||p,o=()=>P(n||e.currentTarget,{fetcherKey:t,method:a,navigate:r,replace:u,state:h,relative:g,preventScrollReset:w,viewTransition:b,defaultShouldRevalidate:E});L&&!1!==r?R.startTransition(()=>o()):o()},...x,"data-discover":D||"render"!==e?void 0:"true"})}).displayName="Form";function $(e){var t;let r=R.useContext(l.hf);return(0,a.V1)(r,(t=e,`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`)),r}function A(e){(0,a.$e)("u">typeof URLSearchParams,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=R.useRef(h(e)),r=R.useRef(!1),n=(0,s.zy)(),o=R.useMemo(()=>{var e,a;let o;return e=n.search,a=r.current?null:t.current,o=h(e),a&&a.forEach((e,t)=>{o.has(t)||a.getAll(t).forEach(e=>{o.append(t,e)})}),o},[n.search]),i=(0,s.Zp)();return[o,R.useCallback((e,t)=>{let n=h("function"==typeof e?e(new URLSearchParams(o)):e);r.current=!0,i("?"+n,t)},[i,o])]}let j=0},8189(e,t,r){r.d(t,{$P:()=>c,Ri:()=>d,zy:()=>h,FE:()=>D,Zp:()=>p,cq:()=>C,P1:()=>y,x$:()=>v,Gw:()=>k,uG:()=>g});var n=r(7629),a=r(9932),o=r(7527),i=r(9667),l=r(4508);let s="REACT_ROUTER_ERROR";var u=r(6255);function c(e,{relative:t}={}){(0,n.V1)(d(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:o}=u.useContext(l._3),{hash:i,pathname:s,search:h}=v(e,{relative:t}),f=s;return"/"!==r&&(f="/"===s?r:(0,a.HS)([r,s])),o.createHref({pathname:f,search:h,hash:i})}function d(){return null!=u.useContext(l.di)}function h(){return(0,n.V1)(d(),"useLocation() may be used only in the context of a <Router> component."),u.useContext(l.di).location}let f="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function p(){let{isDataRoute:e}=u.useContext(l.Pl);return e?function(){let e,{router:t}=(e=u.useContext(l.hf),(0,n.V1)(e,S("useNavigate")),e),r=P("useNavigate"),a=u.useRef(!1);return u.useLayoutEffect(()=>{a.current=!0}),u.useCallback(async(e,o={})=>{(0,n.$e)(a.current,f),a.current&&("number"==typeof e?await t.navigate(e):await t.navigate(e,{fromRouteId:r,...o}))},[t,r])}():function(){(0,n.V1)(d(),"useNavigate() may be used only in the context of a <Router> component.");let e=u.useContext(l.hf),{basename:t,navigator:r}=u.useContext(l._3),{matches:i}=u.useContext(l.Pl),{pathname:s}=h(),c=JSON.stringify((0,a.PD)(i)),p=u.useRef(!1);return u.useLayoutEffect(()=>{p.current=!0}),u.useCallback((i,l={})=>{if((0,n.$e)(p.current,f),!p.current)return;if("number"==typeof i)return void r.go(i);let u=(0,a.Gh)(i,JSON.parse(c),s,"path"===l.relative);null==e&&"/"!==t&&(u.pathname="/"===u.pathname?t:(0,a.HS)([t,u.pathname])),(0,o.c)("string"==typeof i?i:(0,n.AO)(i),r.createHref(u),(0,o.Y)(r),"reject"),(l.replace?r.replace:r.push)(u,l.state,l)},[t,r,c,s,e])}()}let m=u.createContext(null);function y(e){let t=u.useContext(l.Pl).outlet;return u.useMemo(()=>t&&u.createElement(m.Provider,{value:e},t),[t,e])}function v(e,{relative:t}={}){let{matches:r}=u.useContext(l.Pl),{pathname:n}=h(),o=JSON.stringify((0,a.PD)(r));return u.useMemo(()=>(0,a.Gh)(e,JSON.parse(o),n,"path"===t),[e,o,n,t])}function g(e,t,r){let o;(0,n.V1)(d(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=u.useContext(l._3),{matches:s}=u.useContext(l.Pl),c=s[s.length-1],f=c?c.params:{};c&&c.pathname;let p=c?c.pathnameBase:"/";c&&c.route;let m=h();if(t){let e="string"==typeof t?(0,n.Rr)(t):t;(0,n.V1)("/"===p||e.pathname?.startsWith(p),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${e.pathname}" was given in the \`location\` prop.`),o=e}else o=m;let y=o.pathname||"/",v=y;if("/"!==p){let e=p.replace(/^\//,"").split("/");v="/"+y.replace(/^\//,"").split("/").slice(e.length).join("/")}let g=r&&r.state.matches.length?r.state.matches.map(e=>Object.assign(e,{route:r.manifest[e.route.id]||e.route})):(0,a.ue)(e,{pathname:v}),R=function(e,t=[],r){let o=r?.state;if(null==e){if(!o)return null;if(o.errors)e=o.matches;else{if(0!==t.length||o.initialized||!(o.matches.length>0))return null;e=o.matches}}let i=e,l=o?.errors;if(null!=l){let e=i.findIndex(e=>e.route.id&&l?.[e.route.id]!==void 0);(0,n.V1)(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),i=i.slice(0,Math.min(i.length,e+1))}let s=!1,c=-1;if(r&&o){s=o.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:n}=o,a=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!n||void 0===n[t.route.id]);if(t.route.lazy||a){r.isStatic&&(s=!0),i=c>=0?i.slice(0,c+1):[i[0]];break}}}}let d=r?.onError,h=o&&d?(e,t)=>{d(e,{location:o.location,params:o.matches?.[0]?.params??{},pattern:(0,a.gU)(o.matches),errorInfo:t})}:void 0;return i.reduceRight((e,r,a)=>{var d,f;let p,m=!1,y=null,v=null;o&&(p=l&&r.route.id?l[r.route.id]:void 0,y=r.route.errorElement||w,s&&(c<0&&0===a?(d="route-fallback",f="No `HydrateFallback` element provided to render during initial hydration",M[d]||(M[d]=!0,(0,n.$e)(!1,f)),m=!0,v=null):c===a&&(m=!0,v=r.route.hydrateFallbackElement||null)));let g=t.concat(i.slice(0,a+1)),R=()=>{let t;return t=p?y:m?v:r.route.Component?u.createElement(r.route.Component,null):r.route.element?r.route.element:e,u.createElement(x,{match:r,routeContext:{outlet:e,matches:g,isDataRoute:null!=o},children:t})};return o&&(r.route.ErrorBoundary||r.route.errorElement||0===a)?u.createElement(b,{location:o.location,revalidation:o.revalidation,component:y,error:p,children:R(),routeContext:{outlet:null,matches:g,isDataRoute:!0},onError:h}):R()},null)}(g&&g.map(e=>Object.assign({},e,{params:Object.assign({},f,e.params),pathname:(0,a.HS)([p,i.encodeLocation?i.encodeLocation(e.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?p:(0,a.HS)([p,i.encodeLocation?i.encodeLocation(e.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:e.pathnameBase])})),s,r);return t&&R?u.createElement(l.di.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...o},navigationType:"POP"}},R):R}let w=u.createElement(function(){let e,t,r,n=(e=u.useContext(l.xN),t=L("useRouteError"),r=P("useRouteError"),void 0!==e?e:t.errors?.[r]),o=(0,a.pX)(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),i=n instanceof Error?n.stack:null;return u.createElement(u.Fragment,null,u.createElement("h2",null,"Unexpected Application Error!"),u.createElement("h3",{style:{fontStyle:"italic"}},o),i?u.createElement("pre",{style:{padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"}},i):null,null)},null);var b=class extends u.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=l.Bu;static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&"object"==typeof e&&e&&"digest"in e&&"string"==typeof e.digest){let t=function(e){if(e.startsWith(`${s}:ROUTE_ERROR_RESPONSE:{`))try{let t=JSON.parse(e.slice(40));if("object"==typeof t&&t&&"number"==typeof t.status&&"string"==typeof t.statusText)return new a.cj(t.status,t.statusText,t.data)}catch{}}(e.digest);t&&(e=t)}let t=void 0!==e?u.createElement(l.Pl.Provider,{value:this.props.routeContext},u.createElement(l.xN.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?u.createElement(E,{error:e},t):t}};let R=new WeakMap;function E({children:e,error:t}){let{basename:r,navigator:n}=u.useContext(l._3);if("object"==typeof t&&t&&"digest"in t&&"string"==typeof t.digest){let e=function(e){if(e.startsWith(`${s}:REDIRECT:{`))try{let t=JSON.parse(e.slice(28));if("object"==typeof t&&t&&"number"==typeof t.status&&"string"==typeof t.statusText&&"string"==typeof t.location&&"boolean"==typeof t.reloadDocument&&"boolean"==typeof t.replace)return t}catch{}}(t.digest);if(e){let l=R.get(t);if(l)throw l;let s=(0,a.X9)(e.location,r),c=s.absoluteURL||s.to;if((0,o.c)(e.location,c,(0,o.Y)(n),"allow-explicit"),(0,i.yf)(c))throw Error("Invalid redirect location");if(a.Bd&&!R.get(t))if(s.isExternal||e.reloadDocument)window.location.href=c;else{let r=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:e.replace}));throw R.set(t,r),r}return u.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c}`})}}return e}function x({routeContext:e,match:t,children:r}){let n=u.useContext(l.hf);return n&&n.static&&n.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=t.route.id),u.createElement(l.Pl.Provider,{value:e},r)}function S(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function L(e){let t=u.useContext(l.ay);return(0,n.V1)(t,S(e)),t}function P(e){let t,r=(t=u.useContext(l.Pl),(0,n.V1)(t,S(e)),t),a=r.matches[r.matches.length-1];return(0,n.V1)(a.route.id,`${e} can only be used on routes that contain a unique "id"`),a.route.id}function k(){return P("useRouteId")}function C(){let e=L("useNavigation");return u.useMemo(()=>{let{matches:t,historyAction:r,...n}=e.navigation;return n},[e.navigation])}function D(){let{matches:e,loaderData:t}=L("useMatches");return u.useMemo(()=>e.map(e=>(0,a.wy)(e,t)),[e,t])}let M={}},7629(e,t,r){var n=r(2872);let a="popstate";function o(e){return"object"==typeof e&&null!=e&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function i(e={}){return function(e,t,r,n={}){let{window:i=document.defaultView,v5Compat:l=!1}=n,s=i.history,d="POP",h=null,p=m();function m(){return(s.state||{idx:null}).idx}function y(){d="POP";let e=m(),t=null==e?null:e-p;p=e,h&&h({action:d,location:g.location,delta:t})}function v(e){return f(i,e)}null==p&&(p=0,s.replaceState({...s.state,idx:p},""));let g={get action(){return d},get location(){return e(i,s)},listen(e){if(h)throw Error("A history only accepts one active listener");return i.addEventListener(a,y),h=e,()=>{i.removeEventListener(a,y),h=null}},createHref:e=>t(i,e),createURL:v,encodeLocation(e){let t=v(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){d="PUSH";let n=o(e)?e:c(g.location,e,t);r&&r(n,e);let a=u(n,p=m()+1),f=g.createHref(n.mask||n);try{s.pushState(a,"",f)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;i.location.assign(f)}l&&h&&h({action:d,location:g.location,delta:1})},replace:function(e,t){d="REPLACE";let n=o(e)?e:c(g.location,e,t);r&&r(n,e);let a=u(n,p=m()),i=g.createHref(n.mask||n);s.replaceState(a,"",i),l&&h&&h({action:d,location:g.location,delta:0})},go:e=>s.go(e)};return g}(function(e,t){let{pathname:r="/",search:n="",hash:a=""}=h(e.location.hash.substring(1));return r.startsWith("/")||r.startsWith(".")||(r="/"+r),c("",{pathname:r,search:n,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||"default")},function(e,t){let r=e.document.querySelector("base"),n="";if(r&&r.getAttribute("href")){let t=e.location.href,r=t.indexOf("#");n=-1===r?t:t.slice(0,r)}return n+"#"+("string"==typeof t?t:d(t))},function(e,t){s("/"===e.pathname.charAt(0),`relative pathnames are not supported in hash history.push(${JSON.stringify(t)})`)},e)}function l(e,t){if(!1===e||null==e)throw Error(t)}function s(e,t){if(!e){"u">typeof console&&console.warn(t);try{throw Error(t)}catch{}}}function u(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function c(e,t,r=null,n,a){return{pathname:"string"==typeof e?e:e.pathname,search:"",hash:"",..."string"==typeof t?h(t):t,state:r,key:t&&t.key||n||Math.random().toString(36).substring(2,10),mask:a}}function d({pathname:e="/",search:t="",hash:r=""}){return t&&"?"!==t&&(e+="?"===t.charAt(0)?t:"?"+t),r&&"#"!==r&&(e+="#"===r.charAt(0)?r:"#"+r),e}function h(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substring(n),e=e.substring(0,n)),e&&(t.pathname=e)}return t}function f(e,t,r=!1){let a="http://localhost";e&&(a="null"!==e.location.origin?e.location.origin:e.location.href),l(a,"No window.location.(origin|href) available to create URL");let o="string"==typeof t?t:d(t);return o=o.replace(/ $/,"%20"),!r&&n.iA.test(o)&&(o=a+o),new URL(o,a)}r.d(t,{$e:()=>s,A4:()=>f,AO:()=>d,Rr:()=>h,TM:()=>i,V1:()=>l,yJ:()=>c})},7527(e,t,r){let n=new URL("http://localhost");function a(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),n)}catch{return n}}function o(e,t){return e.origin===t.origin&&("null"!==e.origin||e.protocol===t.protocol&&e.host===t.host)}function i(e,t,r,n){let a=null;try{a=null==e?null:new URL(e,r)}catch{}let i=new URL(t,r),l=null!=a&&!o(a,r),s=!o(i,r);if("reject"===n){if(l||s)throw Error("External navigation is not allowed")}else if(s&&(null==a||!function(e,t){if(e.startsWith("//"))return!0;let r=t.protocol.toLowerCase();return!!e.toLowerCase().startsWith(r)&&(""===t.host||e.slice(r.length).startsWith("//"))}(e,a)||!o(a,i)))throw Error("External navigation is not allowed")}r.d(t,{Y:()=>a,c:()=>i})},9667(e,t,r){r.d(t,{aE:()=>C,yf:()=>Z});var n=r(2872),a=r(7629),o=r(9932);let i=Symbol("Uninstrumented"),l=new WeakMap;function s(e){return e[i]??e}function u(e,t){return l.set(e,t),()=>{l.get(e)===t&&l.delete(e)}}function c(e){let t=l.get(e);return l.delete(e),t}function d(e){if("error"===e.type)throw e.value;return e.value}async function h(e,t,r,n,o={result:null,innerResult:null},i=e.length-1){let l=e[i];if(l){let s,u=async()=>(s?console.error("You cannot call instrumented handlers more than once"):s=h(e,t,r,n,o,i-1),await s,(0,a.V1)(o.innerResult,"Expected an inner result"),o.innerResult);try{await l(u,t)}catch(e){console.error("An instrumentation function threw an error:",e)}s||await u(),await s}else{try{o.result={type:"success",value:await r()}}catch(e){o.result={type:"error",value:e}}o.innerResult=n(o.result,t)}return o.result||(o.result={type:"error",value:Error("No result assigned in instrumentation chain.")},o.innerResult=n(o.result,t)),o.result}function f(e){return"error"===e.type&&e.value instanceof Error?{status:"error",error:e.value}:{status:"success",error:void 0}}function p(e){var t,r;let{request:n,context:a,params:o}=e;return{...e,request:{method:(t=n).method,url:t.url,headers:{get:(...e)=>t.headers.get(...e)}},params:{...o},context:(r=a,{get:e=>r.get(e)})}}function m(e,t){return{currentUrl:(0,a.AO)(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}var y=r(7527);let v=["POST","PUT","PATCH","DELETE"],g=new Set(v),w=new Set(["GET",...v]),b=new Set([301,302,303,307,308]),R=new Set([307,308]),E={state:"idle",location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},x={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},S={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},L="remix-router-transitions",P=Symbol("ResetLoaderData");var k=class{#e;#t;#r;#n;constructor(e){this.#e=e,this.#t=(0,o.oI)(e)}get stableRoutes(){return this.#e}get activeRoutes(){return this.#r??this.#e}get branches(){return this.#n??this.#t}get hasHMRRoutes(){return null!=this.#r}setRoutes(e){this.#e=e,this.#t=(0,o.oI)(e)}setHmrRoutes(e){this.#r=e,this.#n=(0,o.oI)(e)}commitHmrRoutes(){this.#r&&(this.#e=this.#r,this.#t=this.#n,this.#r=void 0,this.#n=void 0)}};function C(e){let t,r,l,v,g,w=e.window?e.window:"u">typeof window?window:void 0,P=void 0!==w&&void 0!==w.document&&void 0!==w.document.createElement;(0,a.V1)(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let C=e.hydrationRouteProperties||[],A=e.mapRouteProperties,U=A||(()=>({}));if(e.instrumentations){let t=e.instrumentations;U=e=>({...A?.(e),...function(e,t){var r,n,a,o;let l=[],u=[],c=[],m=[],y=[],v=[],g=[];e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){null!=e.lazy&&l.push(e.lazy),null!=e["lazy.loader"]&&u.push(e["lazy.loader"]),null!=e["lazy.action"]&&c.push(e["lazy.action"]),null!=e["lazy.middleware"]&&m.push(e["lazy.middleware"]),null!=e.middleware&&y.push(e.middleware),null!=e.loader&&v.push(e.loader),null!=e.action&&g.push(e.action)}}));let w={};if("function"==typeof t.lazy&&l.length>0){let e=t.lazy;w.lazy=async(...t)=>d(await h(l,void 0,()=>e(...t),f))}if("object"==typeof t.lazy){let e=t.lazy;if("function"==typeof e.middleware&&m.length>0){let t=e.middleware;w.lazy=Object.assign(w.lazy||{},{middleware:async(...e)=>d(await h(m,void 0,()=>t(...e),f))})}if("function"==typeof e.loader&&u.length>0){let t=e.loader;w.lazy=Object.assign(w.lazy||{},{loader:async(...e)=>d(await h(u,void 0,()=>t(...e),f))})}if("function"==typeof e.action&&c.length>0){let t=e.action;w.lazy=Object.assign(w.lazy||{},{action:async(...e)=>d(await h(c,void 0,()=>t(...e),f))})}}if("function"==typeof t.loader&&v.length>0){let e=s(t.loader),a=async(...t)=>d(await h(v,p(t[0]),()=>e(...t),f));!0===e.hydrate&&(a.hydrate=!0),r=a,n=e,r[i]=n,w.loader=a}if("function"==typeof t.action&&g.length>0){let e=s(t.action),r=async(...t)=>d(await h(g,p(t[0]),()=>e(...t),f));a=r,o=e,a[i]=o,w.action=r}return t.middleware&&t.middleware.length>0&&y.length>0&&(w.middleware=t.middleware.map(e=>{var t,r;let n=s(e),a=async(...e)=>d(await h(y,p(e[0]),()=>n(...e),f));return t=a,r=n,t[i]=r,a})),w}(t.map(e=>e.route).filter(Boolean),e)})}let z={},N=new k((0,o.R_)(e.routes,U,void 0,z)),_=e.basename||"/";_.startsWith("/")||(_=`/${_}`);let H=e.dataStrategy||F,V={...e.future},I=null,W=new Set,B=null,J=null,G=null,K=null,Z=null!=e.hydrationData,et=(0,o.et)(N.activeRoutes,e.history.location,_,!1,N.branches),er=!1,ec=null;if(null!=et||e.patchRoutesOnNavigation)if(et&&!e.hydrationData&&ta(et,N.activeRoutes,e.history.location.pathname).active&&(et=null),et)if(et.some(e=>e.route.lazy))t=!1,r=!0;else if(et.some(e=>T(e.route))){let n=e.hydrationData?e.hydrationData.loaderData:null,a=e.hydrationData?e.hydrationData.errors:null,o=et;if(a){let e=et.findIndex(e=>void 0!==a[e.route.id]);o=o.slice(0,e+1)}r=!1,t=!0,o.forEach(e=>{let o=$(e.route,n,a);r=r||o.renderFallback,t=t&&!o.shouldLoad})}else t=!0,r=!1;else{t=!1,r=!0,et=[];let n=ta(null,N.activeRoutes,e.history.location.pathname);n.active&&n.matches&&(er=!0,et=n.matches)}else{let n=es(404,{pathname:e.history.location.pathname}),{matches:a,route:o}=el(N.activeRoutes);t=!0,r=!1,et=a,ec={[o.id]:n}}let ed={historyAction:e.history.action,location:e.history.location,matches:et,initialized:t,renderFallback:r,navigation:E,restoreScrollPosition:null==e.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||ec,fetchers:new Map,blockers:new Map},ep="POP",ev=null,eL=!1,eP=!1,ek=new Map,eC=null,eD=!1,eM=!1,eO=new Set,eT=new Map,e$=0,eA=-1,ej=new Map,eU=new Set,ez=new Map,eN=new Map,e_=new Set,eF=new Map,eH=null;function eV(e,t={}){e.matches&&(e.matches=e.matches.map(e=>{let t=z[e.route.id],r=e.route;return r.element!==t.element||r.errorElement!==t.errorElement||r.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}));let r=[],n=[];(ed={...ed,...e}).fetchers.forEach((e,t)=>{"idle"===e.state&&(e_.has(t)?r.push(t):n.push(t))}),e_.forEach(e=>{ed.fetchers.has(e)||eT.has(e)||r.push(e)}),0===W.size&&(B={newErrors:e.errors??null}),[...W].forEach(n=>n(ed,{deletedFetchers:r,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:!0===t.flushSync})),r.forEach(e=>e5(ed.fetchers,e)),n.forEach(e=>ed.fetchers.delete(e))}function eI(t,r,{flushSync:n}={}){let a,o,i=null!=ed.actionData&&null!=ed.navigation.formMethod&&ey(ed.navigation.formMethod)&&"loading"===ed.navigation.state&&t.state?._isRedirect!==!0;a=r.actionData?Object.keys(r.actionData).length>0?r.actionData:null:i?ed.actionData:null;let l=r.loaderData?ea(ed.loaderData,r.loaderData,r.matches||[],r.errors):ed.loaderData,s=ed.blockers;s.size>0&&!eD&&(s=new Map(s)).forEach((e,t)=>s.set(t,S));let u=!eD&&tn(t,r.matches||ed.matches),c=!0===eL||null!=ed.navigation.formMethod&&ey(ed.navigation.formMethod)&&t.state?._isRedirect!==!0;if(N.commitHmrRoutes(),eD||"POP"===ep||("PUSH"===ep?e.history.push(t,t.state):"REPLACE"===ep&&e.history.replace(t,t.state)),"POP"===ep){let e=ek.get(ed.location.pathname);e&&e.has(t.pathname)?o={currentLocation:ed.location,nextLocation:t}:ek.has(t.pathname)&&(o={currentLocation:t,nextLocation:ed.location})}else if(eP){let e=ek.get(ed.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),ek.set(ed.location.pathname,e)),o={currentLocation:ed.location,nextLocation:t}}eV({...r,actionData:a,loaderData:l,historyAction:ep,location:t,initialized:!0,renderFallback:!1,navigation:E,revalidation:"idle",restoreScrollPosition:u,preventScrollReset:c,blockers:s},{viewTransitionOpts:o,flushSync:!0===n}),ep="POP",eL=!1,eP=!1,eD=!1,eM=!1,ev?.resolve(),ev=null,eH?.resolve(),eH=null}async function eW(t,r){let o;if(ev?.resolve(),ev=null,"number"==typeof t){ev||(ev=eS());let r=ev.promise;return e.history.go(t),r}let i=c(l),{path:s,submission:u,error:d}=M(!1,D(ed.location,ed.matches,_,t,r?.fromRouteId,r?.relative),r);if(r?.mask){let t="string"==typeof r.mask?(0,a.Rr)(r.mask):{...ed.location.mask,...r.mask};if(o={pathname:t.pathname??"",search:t.search??"",hash:t.hash??""},n.iA.test(o.pathname))throw Error("External navigation is not allowed");o.pathname.startsWith("\\")&&(o.pathname=o.pathname.replace(/^\\+/,"/")),(0,y.c)("string"==typeof r.mask?r.mask:(0,a.AO)(r.mask),(0,a.AO)(o),e.history.createURL("/"),"reject")}let h=ed.location,f=(0,a.yJ)(h,s,r&&r.state,void 0,o);f={...f,...e.history.encodeLocation(f)},(0,y.c)(null==t?e.history.createHref(ed.location):"string"==typeof t?t:(0,a.AO)(t),e.history.createHref(f.mask||f),e.history.createURL("/"),"reject");let p=r&&null!=r.replace?r.replace:void 0,m="PUSH";!0===p?m="REPLACE":!1===p||null!=u&&ey(u.formMethod)&&u.formAction===ed.location.pathname+ed.location.search&&(m="REPLACE");let v=r&&"preventScrollReset"in r?!0===r.preventScrollReset:void 0,g=!0===(r&&r.flushSync),w=te({currentLocation:h,nextLocation:f,historyAction:m});w?e8(w,{state:"blocked",location:f,proceed(){e8(w,{state:"proceeding",proceed:void 0,reset:void 0,location:f}),eW(t,r)},reset(){let e=new Map(ed.blockers);e.set(w,S),eV({blockers:e})}}):await eB(m,f,{submission:u,pendingError:d,preventScrollReset:v,replace:r&&r.replace,enableViewTransition:r&&r.viewTransition,flushSync:g,callSiteDefaultShouldRevalidate:r&&r.defaultShouldRevalidate,instrumentationNavigateMetaReceiver:i})}async function eB(t,r,n){var a,i,l,s;let u;v&&v.abort(),v=null,ep=t,eD=!0===(n&&n.startUninterruptedRevalidation),a=ed.location,i=ed.matches,J&&K&&(J[tr(a,i)]=K()),eL=!0===(n&&n.preventScrollReset),eP=!0===(n&&n.enableViewTransition);let c=N.activeRoutes,d=n?.initialHydration&&ed.matches&&ed.matches.length>0&&!er?ed.matches:(0,o.et)(c,r,_,!1,N.branches),h=!0===(n&&n.flushSync);if(d&&ed.initialized&&!eM&&(l=ed.location,s=r,l.pathname===s.pathname&&l.search===s.search&&(""===l.hash?""!==s.hash:l.hash===s.hash||""!==s.hash||!1))&&!(n&&n.submission&&ey(n.submission.formMethod)))return void eI(r,{matches:d},{flushSync:h});let f=ta(d,c,r.pathname);if(f.active&&f.matches&&(d=f.matches),n?.instrumentationNavigateMetaReceiver){let t=ew(e.history,r,d);n.instrumentationNavigateMetaReceiver(t)}if(!d){let{error:e,notFoundMatches:t,route:n}=tt(r.pathname);eI(r,{matches:t,loaderData:{},errors:{[n.id]:e}},{flushSync:h});return}let p=n&&n.overrideNavigation?{...n.overrideNavigation,matches:d,historyAction:t}:void 0;v=new AbortController;let m=ee(e.history,r,v.signal,n&&n.submission),y=e.getContext?await e.getContext():new o.aB;if(n&&n.pendingError)u=[ei(d).route.id,{type:"error",error:n.pendingError}];else if(n&&n.submission&&ey(n.submission.formMethod)){let a=await eY(m,r,n.submission,d,t,y,f.active,n&&!0===n.initialHydration,{replace:n.replace,flushSync:h});if(a.shortCircuited)return;if(a.pendingActionResult){let[e,t]=a.pendingActionResult;if(eh(t)&&(0,o.pX)(t.error)&&404===t.error.status){v=null,eI(r,{matches:a.matches,loaderData:{},errors:{[e]:t.error}});return}}d=a.matches||d,u=a.pendingActionResult,p=eR(r,d,t,n.submission),h=!1,f.active=!1,m=ee(e.history,m.url,m.signal)}let{shortCircuited:g,matches:w,loaderData:b,errors:R,workingFetchers:E}=await eq(m,r,d,t,y,f.active,p,n&&n.submission,n&&n.fetcherSubmission,n&&n.replace,n&&!0===n.initialHydration,h,u,n&&n.callSiteDefaultShouldRevalidate);g||(v=null,eI(r,{matches:w||d,...eo(u),loaderData:b,errors:R,...E?{fetchers:E}:{}}))}async function eY(t,r,n,a,o,i,l,s,u={}){var c,d,h;let f;if(e0(),eV({navigation:(c=r,d=a,{state:"submitting",location:c,matches:d,historyAction:o,formMethod:(h=n).formMethod,formAction:h.formAction,formEncType:h.formEncType,formData:h.formData,json:h.json,text:h.text})},{flushSync:!0===u.flushSync}),l){let e=await to(a,r.pathname,t.signal);if("aborted"===e.type)return{shortCircuited:!0};if("error"===e.type){if(0===e.partialMatches.length){let{matches:t,route:r}=el(N.activeRoutes);return{matches:t,pendingActionResult:[r.id,{type:"error",error:e.error}]}}let t=ei(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:"error",error:e.error}]}}if(e.matches)a=e.matches;else{let{notFoundMatches:e,error:t,route:n}=tt(r.pathname);return{matches:e,pendingActionResult:[n.id,{type:"error",error:t}]}}}let p=eg(a,r);if(p.route.action||p.route.lazy){let e=await eZ(t,r,Y(U,z,t,r,a,p,s?[]:C,i),i,null);if(!(f=e[p.route.id])){for(let t of a)if(e[t.route.id]){f=e[t.route.id];break}}if(t.signal.aborted)return{shortCircuited:!0}}else f={type:"error",error:es(405,{method:t.method,pathname:r.pathname,routeId:p.route.id})};if(ef(f)){let r;return r=u&&null!=u.replace?u.replace:Q(f.response.headers.get("Location"),new URL(t.url),_,e.history)===ed.location.pathname+ed.location.search,await eK(t,f,!0,{submission:n,replace:r}),{shortCircuited:!0}}if(eh(f)){let e=ei(a,p.route.id);return!0!==(u&&u.replace)&&(ep="PUSH"),{matches:a,pendingActionResult:[e.route.id,f,p.route.id]}}return{matches:a,pendingActionResult:[p.route.id,f]}}async function eq(t,r,n,a,o,i,l,s,u,c,d,h,f,p){let m=l||eR(r,n,a,s),y=s||u||eb(m),g=!eD&&!d;if(i){if(g){let e=eJ(f);eV({navigation:m,...void 0!==e?{actionData:e}:{}},{flushSync:h})}let e=await to(n,r.pathname,t.signal);if("aborted"===e.type)return{shortCircuited:!0};if("error"===e.type){if(0===e.partialMatches.length){let{matches:t,route:r}=el(N.activeRoutes);return{matches:t,loaderData:{},errors:{[r.id]:e.error}}}let t=ei(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}if(e.matches)n=e.matches;else{let{error:e,notFoundMatches:t,route:n}=tt(r.pathname);return{matches:t,loaderData:{},errors:{[n.id]:e}}}}let w=N.activeRoutes,{dsMatches:b,revalidatingFetchers:R}=O(t,o,U,z,e.history,ed,n,y,r,d?[]:C,!0===d,eM,eO,e_,ez,eU,w,_,null!=e.patchRoutesOnNavigation,N.branches,f,p);if(eA=++e$,!e.dataStrategy&&!b.some(e=>e.shouldLoad)&&!b.some(e=>e.route.middleware&&e.route.middleware.length>0)&&0===R.length){let e=new Map(ed.fetchers),t=e6(e);return eI(r,{matches:n,loaderData:{},errors:f&&eh(f[1])?{[f[0]]:f[1].error}:null,...eo(f),...t?{fetchers:e}:{}},{flushSync:h}),{shortCircuited:!0}}if(g){var E;let e,t={};if(!i){t.navigation=m;let e=eJ(f);void 0!==e&&(t.actionData=e)}R.length>0&&(E=R,e=new Map(ed.fetchers),E.forEach(t=>{let r=e.get(t.key),n=eE(void 0,r?r.data:void 0);e.set(t.key,n)}),t.fetchers=e),eV(t,{flushSync:h})}R.forEach(e=>{e3(e.key),e.controller&&eT.set(e.key,e.controller)});let x=()=>R.forEach(e=>e3(e.key));v&&v.signal.addEventListener("abort",x);let{loaderResults:S,fetcherResults:L}=await eQ(b,R,t,r,o);if(t.signal.aborted)return{shortCircuited:!0};v&&v.signal.removeEventListener("abort",x),R.forEach(e=>eT.delete(e.key));let P=eu(S);if(P)return await eK(t,P.result,!0,{replace:c}),{shortCircuited:!0};if(P=eu(L))return eU.add(P.key),await eK(t,P.result,!0,{replace:c}),{shortCircuited:!0};let k=new Map(ed.fetchers),{loaderData:D,errors:M}=en(ed,n,S,f,R,L,k);d&&ed.errors&&(M={...ed.errors,...M});let T=e6(k),$=e7(eA,k);return{matches:n,loaderData:D,errors:M,...T||$||R.length>0?{workingFetchers:k}:{}}}function eJ(e){if(e&&!eh(e[1]))return{[e[0]]:e[1].data};if(ed.actionData)if(0===Object.keys(ed.actionData).length)return null;else return ed.actionData}async function eG(t,r,n,i,l,s,u,c,d,h){var f,p;e0(),ez.delete(t),e1(t,(f=d,p=ed.fetchers.get(t),{state:"submitting",formMethod:f.formMethod,formAction:f.formAction,formEncType:f.formEncType,formData:f.formData,json:f.json,text:f.text,data:p?p.data:void 0}),{flushSync:u});let m=new AbortController,y=ee(e.history,n,m.signal,d);if(s){let e=await to(i,new URL(y.url).pathname,y.signal,t);if("aborted"===e.type)return;if("error"===e.type)return void e2(t,r,e.error,{flushSync:u});if(!e.matches)return void e2(t,r,es(404,{pathname:n}),{flushSync:u});i=e.matches}let g=eg(i,n);if(!g.route.action&&!g.route.lazy)return void e2(t,r,es(405,{method:d.formMethod,pathname:n,routeId:r}),{flushSync:u});eT.set(t,m);let w=e$,b=Y(U,z,y,n,i,g,C,l),R=await eZ(y,n,b,l,t),E=R[g.route.id];if(!E){for(let e of b)if(R[e.route.id]){E=R[e.route.id];break}}if(y.signal.aborted){eT.get(t)===m&&eT.delete(t);return}if(e_.has(t)){if(ef(E)||eh(E))return void e1(t,ex(void 0))}else{if(ef(E))return(eT.delete(t),eA>w)?void e1(t,ex(void 0)):(eU.add(t),e1(t,eE(d)),eK(y,E,!1,{fetcherSubmission:d,preventScrollReset:c}));if(eh(E))return void e2(t,r,E.error)}let x=ed.navigation.location||ed.location,S=ee(e.history,x,m.signal),L=N.activeRoutes,P="idle"!==ed.navigation.state?(0,o.et)(L,ed.navigation.location,_,!1,N.branches):ed.matches;(0,a.V1)(P,"Didn't find any matches after fetcher action");let k=++e$;ej.set(t,k);let{dsMatches:D,revalidatingFetchers:M}=O(S,l,U,z,e.history,ed,P,d,x,C,!1,eM,eO,e_,ez,eU,L,_,null!=e.patchRoutesOnNavigation,N.branches,[g.route.id,E],h),T=eE(d,E.data),$=new Map(ed.fetchers);$.set(t,T),M.filter(e=>e.key!==t).forEach(e=>{let t=e.key,r=$.get(t),n=eE(void 0,r?r.data:void 0);$.set(t,n),e3(t),e.controller&&eT.set(t,e.controller)}),eV({fetchers:$});let A=()=>M.forEach(e=>e3(e.key));m.signal.addEventListener("abort",A);let{loaderResults:j,fetcherResults:F}=await eQ(D,M,S,x,l);if(m.signal.aborted){ej.get(t)===k&&ej.delete(t);return}m.signal.removeEventListener("abort",A),ej.delete(t),eT.delete(t),M.forEach(e=>eT.delete(e.key));let H=ed.fetchers.has(t),V=e=>{if(!H)return e;let r=new Map(e.fetchers);return r.set(t,ex(E.data)),{...e,fetchers:r}},I=eu(j);if(I)return ed=V(ed),eK(S,I.result,!1,{preventScrollReset:c});if(I=eu(F))return eU.add(I.key),ed=V(ed),eK(S,I.result,!1,{preventScrollReset:c});let W=new Map(ed.fetchers);H&&W.set(t,ex(E.data));let{loaderData:B,errors:q}=en(ed,P,j,void 0,M,F,W);e7(k,W),"loading"===ed.navigation.state&&k>eA?((0,a.V1)(ep,"Expected pending action"),v&&v.abort(),eI(ed.navigation.location,{matches:P,loaderData:B,errors:q,fetchers:W})):(eV({errors:q,loaderData:ea(ed.loaderData,B,P,q),fetchers:W}),eM=!1)}async function eX(t,r,n,a,o,i,l,s,u){let c=ed.fetchers.get(t);e1(t,eE(u,c?c.data:void 0),{flushSync:l});let d=new AbortController,h=ee(e.history,n,d.signal);if(i){let e=await to(a,new URL(h.url).pathname,h.signal,t);if("aborted"===e.type)return;if("error"===e.type)return void e2(t,r,e.error,{flushSync:l});if(!e.matches)return void e2(t,r,es(404,{pathname:n}),{flushSync:l});a=e.matches}let f=eg(a,n);eT.set(t,d);let p=e$,m=await eZ(h,n,Y(U,z,h,n,a,f,C,o),o,t),y=m[f.route.id];if(!y){for(let e of a)if(m[e.route.id]){y=m[e.route.id];break}}if(eT.get(t)===d&&eT.delete(t),!h.signal.aborted){if(e_.has(t))return void e1(t,ex(void 0));if(ef(y))if(eA>p)return void e1(t,ex(void 0));else{eU.add(t),await eK(h,y,!1,{preventScrollReset:s});return}if(eh(y))return void e2(t,r,y.error);e1(t,ex(y.data))}}async function eK(t,r,n,{submission:i,fetcherSubmission:l,preventScrollReset:s,replace:u}={}){n||(ev?.resolve(),ev=null),r.response.headers.has("X-Remix-Revalidate")&&(eM=!0);let c=r.response.headers.get("Location");(0,a.V1)(c,"Expected a Location header on the redirect Response");let d=c,h=new URL(t.url);c=Q(c,h,_,e.history),(0,y.c)(d,c,h,"allow-explicit");let f=(0,a.yJ)(ed.location,c,{_isRedirect:!0});if(P){let e=!1;if(r.response.headers.has("X-Remix-Reload-Document"))e=!0;else if((0,o.vh)(c)){let t=(0,a.A4)(w,c,!0);e=t.origin!==w.location.origin||null==(0,o.pb)(t.pathname,_)}if(e)return void(u?w.location.replace(c):w.location.assign(c))}v=null;let p=!0===u||r.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:m,formAction:g,formEncType:b}=ed.navigation;!i&&!l&&m&&g&&b&&(i=eb(ed.navigation));let E=i||l;R.has(r.response.status)&&E&&ey(E.formMethod)?await eB(p,f,{submission:{...E,formAction:c},preventScrollReset:s||eL,enableViewTransition:n?eP:void 0}):await eB(p,f,{overrideNavigation:eR(f,[],p,i),fetcherSubmission:l,preventScrollReset:s||eL,enableViewTransition:n?eP:void 0})}async function eZ(e,t,r,n,i){let l,s={};try{l=await q(H,e,t,r,i,n,!1)}catch(e){return r.filter(e=>e.shouldLoad).forEach(t=>{s[t.route.id]={type:"error",error:e}}),s}if(e.signal.aborted)return s;if(!ey(e.method))for(let e of r){if(l[e.route.id]?.type==="error")break;!l.hasOwnProperty(e.route.id)&&!ed.loaderData.hasOwnProperty(e.route.id)&&(!ed.errors||!ed.errors.hasOwnProperty(e.route.id))&&e.shouldCallHandler()&&(l[e.route.id]={type:"error",result:Error(`No result returned from dataStrategy for route ${e.route.id}`)})}for(let[t,n]of Object.entries(l)){var u;if(em((u=n).result)&&b.has(u.result.status)){let i=n.result;s[t]={type:"redirect",response:function(e,t,r,n,i){let l=e.headers.get("Location");if((0,a.V1)(l,"Redirects returned/thrown from loaders/actions must have a Location header"),!(0,o.vh)(l)){let a=n.slice(0,n.findIndex(e=>e.route.id===r)+1);l=D(new URL(t.url),a,i,l),e.headers.set("Location",l)}return e}(i,e,t,r,_)}}else s[t]=await X(n)}return s}async function eQ(e,t,r,n,a){let o=eZ(r,n,e,a,null),i=Promise.all(t.map(async e=>{if(!e.matches||!e.match||!e.request||!e.controller)return Promise.resolve({[e.key]:{type:"error",error:es(404,{pathname:e.path})}});{let t=(await eZ(e.request,e.path,e.matches,a,e.key))[e.match.route.id];return{[e.key]:t}}}));return{loaderResults:await o,fetcherResults:(await i).reduce((e,t)=>Object.assign(e,t),{})}}function e0(){eM=!0,ez.forEach((e,t)=>{eT.has(t)&&eO.add(t),e3(t)})}function e1(e,t,r={}){let n=new Map(ed.fetchers);n.set(e,t),eV({fetchers:n},{flushSync:!0===(r&&r.flushSync)})}function e2(e,t,r,n={}){let a=ei(ed.matches,t),o=new Map(ed.fetchers);e5(o,e),eV({errors:{[a.route.id]:r},fetchers:o},{flushSync:!0===(n&&n.flushSync)})}function e5(e,t){let r=ed.fetchers.get(t);eT.has(t)&&!(r&&"loading"===r.state&&ej.has(t))&&e3(t),ez.delete(t),ej.delete(t),eU.delete(t),e_.delete(t),eO.delete(t),e.delete(t)}function e3(e,t){let r=eT.get(e);r&&(r.abort(t),eT.delete(e))}function e4(e,t){for(let r of e){let e=t.get(r);(0,a.V1)(e,`Expected fetcher: ${r}`);let n=ex(e.data);t.set(r,n)}}function e6(e){let t=[],r=!1;for(let n of eU){let o=e.get(n);(0,a.V1)(o,`Expected fetcher: ${n}`),"loading"===o.state&&(eU.delete(n),t.push(n),r=!0)}return e4(t,e),r}function e7(e,t){let r=[];for(let[n,o]of ej)if(o<e){let e=t.get(n);(0,a.V1)(e,`Expected fetcher: ${n}`),"loading"===e.state&&(e3(n),ej.delete(n),r.push(n))}return e4(r,t),r.length>0}function e9(e){ed.blockers.delete(e),eF.delete(e)}function e8(e,t){let r=ed.blockers.get(e)||S;(0,a.V1)("unblocked"===r.state&&"blocked"===t.state||"blocked"===r.state&&"blocked"===t.state||"blocked"===r.state&&"proceeding"===t.state||"blocked"===r.state&&"unblocked"===t.state||"proceeding"===r.state&&"unblocked"===t.state,`Invalid blocker state transition: ${r.state} -> ${t.state}`);let n=new Map(ed.blockers);n.set(e,t),eV({blockers:n})}function te({currentLocation:e,nextLocation:t,historyAction:r}){if(0===eF.size)return;eF.size>1&&(0,a.$e)(!1,"A router only supports one blocker at a time");let n=Array.from(eF.entries()),[o,i]=n[n.length-1],l=ed.blockers.get(o);if((!l||"proceeding"!==l.state)&&i({currentLocation:e,nextLocation:t,historyAction:r}))return o}function tt(e){let t=es(404,{pathname:e}),{matches:r,route:n}=el(N.activeRoutes);return{notFoundMatches:r,route:n,error:t}}function tr(e,t){return G&&G(e,t.map(e=>(0,o.wy)(e,ed.loaderData)))||e.key}function tn(e,t){if(J){let r=J[tr(e,t)];if("number"==typeof r)return r}return null}function ta(t,r,n){if(e.patchRoutesOnNavigation){let e=N.branches;if(!t)return{active:!0,matches:(0,o.et)(r,n,_,!0,e)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:(0,o.et)(r,n,_,!0,e)}}return{active:!1,matches:null}}async function to(t,r,n,a){if(!e.patchRoutesOnNavigation)return{type:"success",matches:t};let i=t;for(;;){let t=z;try{await e.patchRoutesOnNavigation({signal:n,path:r,matches:i,fetcherKey:a,patch:(e,r)=>{n.aborted||j(e,r,N,t,U,!1)}})}catch(e){return{type:"error",error:e,partialMatches:i}}if(n.aborted)return{type:"aborted"};let l=N.branches,s=(0,o.et)(N.activeRoutes,r,_,!1,l),u=null;if(s){if(0===Object.keys(s[0].params).length)return{type:"success",matches:s};else if(!((u=(0,o.et)(N.activeRoutes,r,_,!0,l))&&i.length<u.length&&ti(i,u.slice(0,i.length))))return{type:"success",matches:s}}if(u||(u=(0,o.et)(N.activeRoutes,r,_,!0,l)),!u||ti(i,u))return{type:"success",matches:null};i=u}}function ti(e,t){return e.length===t.length&&e.every((e,r)=>e.route.id===t[r].route.id)}return l={get basename(){return _},get future(){return V},get state(){return ed},get routes(){return N.stableRoutes},get branches(){return N.branches},get manifest(){return z},get window(){return w},initialize:function(){if(I=e.history.listen(({action:t,location:r,delta:n})=>{if(g){g(),g=void 0;return}(0,a.$e)(0===eF.size||null!=n,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let o=te({currentLocation:ed.location,nextLocation:r,historyAction:t});if(o&&null!=n){let t=new Promise(e=>{g=e});e.history.go(-1*n),e8(o,{state:"blocked",location:r,proceed(){e8(o,{state:"proceeding",proceed:void 0,reset:void 0,location:r}),t.then(()=>e.history.go(n))},reset(){let e=new Map(ed.blockers);e.set(o,S),eV({blockers:e})}}),ev?.resolve(),ev=null;return}return eB(t,r)}),P){var t=w,r=ek;try{let e=t.sessionStorage.getItem(L);if(e){let t=JSON.parse(e);for(let[e,n]of Object.entries(t||{}))n&&Array.isArray(n)&&r.set(e,new Set(n||[]))}}catch{}let e=()=>(function(e,t){if(t.size>0){let r={};for(let[e,n]of t)r[e]=[...n];try{e.sessionStorage.setItem(L,JSON.stringify(r))}catch(e){(0,a.$e)(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}})(w,ek);w.addEventListener("pagehide",e),eC=()=>w.removeEventListener("pagehide",e)}return ed.initialized||eB("POP",ed.location,{initialHydration:!0}),l},subscribe:function(e){if(W.add(e),B){let{newErrors:t}=B;B=null,e(ed,{deletedFetchers:[],newErrors:t,viewTransitionOpts:void 0,flushSync:!1})}return()=>W.delete(e)},enableScrollRestoration:function(e,t,r){if(J=e,K=t,G=r||null,!Z&&ed.navigation===E){Z=!0;let e=tn(ed.location,ed.matches);null!=e&&eV({restoreScrollPosition:e})}return()=>{J=null,K=null,G=null}},navigate:eW,fetch:async function t(t,r,n,a){e3(t);let i=!0===(a&&a.flushSync),s=c(l),u=N.activeRoutes,d=D(ed.location,ed.matches,_,n,r,a?.relative),h=(0,o.et)(u,d,_,!1,N.branches),f=ta(h,u,d);if(f.active&&f.matches&&(h=f.matches),s&&s(ew(e.history,d,h)),!h)return void e2(t,r,es(404,{pathname:d}),{flushSync:i});let{path:p,submission:m,error:y}=M(!0,d,a);if(y)return void e2(t,r,y,{flushSync:i});let v=e.getContext?await e.getContext():new o.aB,g=!0===(a&&a.preventScrollReset);m&&ey(m.formMethod)?await eG(t,r,p,h,v,f.active,i,g,m,a&&a.defaultShouldRevalidate):(ez.set(t,{routeId:r,path:p}),await eX(t,r,p,h,v,f.active,i,g,m))},revalidate:function(){eH||(eH=eS()),e0(),eV({revalidation:"loading"});let e=eH.promise;return"submitting"===ed.navigation.state||("idle"===ed.navigation.state?eB(ed.historyAction,ed.location,{startUninterruptedRevalidation:!0}):eB(ep||ed.historyAction,ed.navigation.location,{overrideNavigation:ed.navigation,enableViewTransition:!0===eP})),e},createHref:t=>e.history.createHref(t),createURL:t=>e.history.createURL(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:function(e){return eN.set(e,(eN.get(e)||0)+1),e_.has(e)&&e_.delete(e),ed.fetchers.get(e)||x},resetFetcher:function(e,t){e3(e,t?.reason),e1(e,ex(null))},deleteFetcher:function(e){let t=(eN.get(e)||0)-1;t<=0?(eN.delete(e),e_.add(e)):eN.set(e,t),eV({fetchers:new Map(ed.fetchers)})},dispose:function(){I&&I(),eC&&eC(),W.clear(),v&&v.abort(),ed.fetchers.forEach((e,t)=>e5(ed.fetchers,t)),ed.blockers.forEach((e,t)=>e9(t))},getBlocker:function(e,t){let r=ed.blockers.get(e)||S;return eF.get(e)!==t&&eF.set(e,t),r},deleteBlocker:e9,patchRoutes:function(e,t,r=!1){j(e,t,N,z,U,r),N.hasHMRRoutes||eV({})},_internalFetchControllers:eT,_internalSetRoutes:function(e){z={},N.setHmrRoutes((0,o.R_)(e,U,void 0,z))},_internalSetStateDoNotUseOrYouWillBreakYourApp(e){eV(e)}},e.instrumentations&&(l=function(e,t){var r,n,o,l;let c=[],p=[];if(t.forEach(e=>e({instrument(e){null!=e.navigate&&c.push(e.navigate),null!=e.fetch&&p.push(e.fetch)}})),c.length>0){let t=s(e.navigate),o=async(...r)=>{let n,[o,i]=r,l={to:"number"==typeof o||"string"==typeof o?o:o?(0,a.AO)(o):".",...m(e,i??{})};return d(await h(c,l,async()=>{if("number"==typeof o)return await t(...r);let a=u(e,e=>{n=e});try{return await t(...r)}finally{a()}},e=>({...f(e),meta:n})))};r=o,n=t,r[i]=n,e.navigate=o}if(p.length>0){let t=s(e.fetch),r=async(...r)=>{let n,[a,o,i,l]=r;return d(await h(p,{href:i??".",fetcherKey:a,...m(e,l??{})},async()=>{let a=u(e,e=>{n=e});try{return await t(...r)}finally{a()}},e=>({...f(e),meta:n})))};o=r,l=t,o[i]=l,e.fetch=r}return e}(l,e.instrumentations.map(e=>e.router).filter(Boolean))),l}function D(e,t,r,n,i,l){let s,u;if(i){for(let e of(s=[],t))if(s.push(e),e.route.id===i){u=e;break}}else s=t,u=t[t.length-1];let c=(0,o.Gh)(n||".",(0,o.PD)(s),(0,o.pb)(e.pathname,r)||e.pathname,"path"===l);if(null==n&&(c.search=e.search,c.hash=e.hash),(null==n||""===n||"."===n)&&u){let e=ev(c.search);if(u.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index";else if(!u.route.index&&e){let e=new URLSearchParams(c.search),t=e.getAll("index");e.delete("index"),t.filter(e=>e).forEach(t=>e.append("index",t));let r=e.toString();c.search=r?`?${r}`:""}}return"/"!==r&&(c.pathname=(0,o.RW)({basename:r,pathname:c.pathname})),(0,a.AO)(c)}function M(e,t,r){var n;let o,i;if(!r||!(null!=r&&("formData"in r&&null!=r.formData||"body"in r&&void 0!==r.body)))return{path:t};if(r.formMethod&&(n=r.formMethod,!w.has(n.toUpperCase())))return{path:t,error:es(405,{method:r.formMethod})};let l=()=>({path:t,error:es(400,{type:"invalid-body"})}),s=(r.formMethod||"get").toUpperCase(),u=ec(t);if(void 0!==r.body){if("text/plain"===r.formEncType){if(!ey(s))return l();let e="string"==typeof r.body?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((e,[t,r])=>`${e}${t}=${r}
3
+ `,""):String(r.body);return{path:t,submission:{formMethod:s,formAction:u,formEncType:r.formEncType,formData:void 0,json:void 0,text:e}}}else if("application/json"===r.formEncType){if(!ey(s))return l();try{let e="string"==typeof r.body?JSON.parse(r.body):r.body;return{path:t,submission:{formMethod:s,formAction:u,formEncType:r.formEncType,formData:void 0,json:e,text:void 0}}}catch{return l()}}}if((0,a.V1)("function"==typeof FormData,"FormData is not available in this environment"),r.formData)o=et(r.formData),i=r.formData;else if(r.body instanceof FormData)o=et(r.body),i=r.body;else if(r.body instanceof URLSearchParams)i=er(o=r.body);else if(null==r.body)o=new URLSearchParams,i=new FormData;else try{o=new URLSearchParams(r.body),i=er(o)}catch{return l()}let c={formMethod:s,formAction:u,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:i,json:void 0,text:void 0};if(ey(c.formMethod))return{path:t,submission:c};let d=(0,a.Rr)(t);return e&&d.search&&ev(d.search)&&o.append("index",""),d.search=`?${o}`,{path:(0,a.AO)(d),submission:c}}function O(e,t,r,n,a,i,l,s,u,c,d,h,f,p,m,y,v,g,w,b,R,E){let x,S=R?eh(R[1])?R[1].error:R[1].data:void 0,L=a.createURL(i.location),P=a.createURL(u);if(d&&i.errors){let e=Object.keys(i.errors)[0];x=l.findIndex(t=>t.route.id===e)}else if(R&&eh(R[1])){let e=R[0];x=l.findIndex(t=>t.route.id===e)-1}let k=R?R[1].statusCode:void 0,C=k&&k>=400,D={currentUrl:L,currentParams:i.matches[0]?.params||{},nextUrl:P,nextParams:l[0].params,...s,actionResult:S,actionStatus:k},M=(0,o.gU)(l),O=l.map((a,o)=>{var l,s,f,p,m;let y,{route:v}=a,g=null;if(null!=x&&o>x)g=!1;else if(v.lazy)g=!0;else if(T(v))if(d){let{shouldLoad:e}=$(v,i.loaderData,i.errors);g=e}else{let e,t;l=i.loaderData,s=i.matches[o],f=a,e=!s||f.route.id!==s.route.id,t=!l.hasOwnProperty(f.route.id),(e||t)&&(g=!0)}else g=!1;if(null!==g)return B(r,n,e,u,M,a,c,t,g);let w=!1;"boolean"==typeof E?w=E:C?w=!1:h||L.pathname+L.search===P.pathname+P.search||L.search!==P.search?w=!0:(p=i.matches[o],m=a,y=p.route.path,(p.pathname!==m.pathname||null!=y&&y.endsWith("*")&&p.params["*"]!==m.params["*"])&&(w=!0));let b={...D,defaultShouldRevalidate:w};return B(r,n,e,u,M,a,c,t,A(a,b),b,E)}),j=[];return m.forEach((e,s)=>{if(d||!l.some(t=>t.route.id===e.routeId)||p.has(s))return;let u=i.fetchers.get(s),m=u&&"idle"!==u.state&&void 0===u.data,R=(0,o.et)(v,e.path,g??"/",!1,b);if(!R){if(w&&m)return;j.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(y.has(s))return;let x=eg(R,e.path),S=new AbortController,L=ee(a,e.path,S.signal),P=null;if(f.has(s))f.delete(s),P=Y(r,n,L,e.path,R,x,c,t);else if(m)h&&(P=Y(r,n,L,e.path,R,x,c,t));else{let a={...D,defaultShouldRevalidate:"boolean"==typeof E?E:!C&&h};A(x,a)&&(P=Y(r,n,L,e.path,R,x,c,t,a))}P&&j.push({key:s,routeId:e.routeId,path:e.path,matches:P,match:x,request:L,controller:S})}),{dsMatches:O,revalidatingFetchers:j}}function T(e){return null!=e.loader||null!=e.middleware&&e.middleware.length>0}function $(e,t,r){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!T(e))return{shouldLoad:!1,renderFallback:!1};let n=null!=t&&e.id in t,a=null!=r&&void 0!==r[e.id];if(!n&&a)return{shouldLoad:!1,renderFallback:!1};if("function"==typeof e.loader&&!0===e.loader.hydrate)return{shouldLoad:!0,renderFallback:!n};let o=!n&&!a;return{shouldLoad:o,renderFallback:o}}function A(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if("boolean"==typeof r)return r}return t.defaultShouldRevalidate}function j(e,t,r,n,i,l){let s;if(e){let t=n[e];(0,a.V1)(t,`No route found to patch children into: routeId = ${e}`),t.children||(t.children=[]),s=t.children}else s=r.activeRoutes;let u=[],c=[];if(t.forEach(e=>{let t=s.find(t=>(function e(t,r){return"id"in t&&"id"in r&&t.id===r.id||t.index===r.index&&t.path===r.path&&t.caseSensitive===r.caseSensitive&&((!t.children||0===t.children.length)&&(!r.children||0===r.children.length)||(t.children?.every((t,n)=>r.children?.some(r=>e(t,r)))??!1))})(e,t));t?c.push({existingRoute:t,newRoute:e}):u.push(e)}),u.length>0){let t=(0,o.R_)(u,i,[e||"_","patch",String(s?.length||"0")],n);s.push(...t)}if(l&&c.length>0)for(let e=0;e<c.length;e++){let{existingRoute:t,newRoute:r}=c[e],[n]=(0,o.R_)([r],i,[],{},!0);Object.assign(t,{element:n.element?n.element:t.element,errorElement:n.errorElement?n.errorElement:t.errorElement,hydrateFallbackElement:n.hydrateFallbackElement?n.hydrateFallbackElement:t.hydrateFallbackElement})}r.hasHMRRoutes||r.setRoutes([...r.activeRoutes])}let U=new WeakMap,z=({key:e,route:t,manifest:r,mapRouteProperties:n})=>{let i=r[t.id];if((0,a.V1)(i,"No route found in manifest"),!i.lazy||"object"!=typeof i.lazy)return;let l=i.lazy[e];if(!l)return;let s=U.get(i);s||(s={},U.set(i,s));let u=s[e];if(u)return u;let c=(async()=>{let t=(0,o.pr)(e),r=void 0!==i[e];if(t)(0,a.$e)(!t,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),s[e]=Promise.resolve();else if(r)(0,a.$e)(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let t=await l();null!=t&&(Object.assign(i,{[e]:t}),Object.assign(i,n(i)))}"object"==typeof i.lazy&&(i.lazy[e]=void 0,Object.values(i.lazy).every(e=>void 0===e)&&(i.lazy=void 0))})();return s[e]=c,c},N=new WeakMap;async function _(e){let t=e.matches.filter(e=>e.shouldLoad),r={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,n)=>{r[t[n].route.id]=e}),r}async function F(e){return e.matches.some(e=>e.route.middleware)?H(e,()=>_(e)):_(e)}function H(e,t){return V(e,t,e=>{var t,r;if(em(t=e)&&(r=t.status,b.has(r))&&t.headers.has("Location"))throw e;return e},ed,r);async function r(t,r,n){if(n)return Object.assign(n.value,{[r]:{type:"error",result:t}});{let{matches:n}=e,a=Math.min(Math.max(n.findIndex(e=>e.route.id===r),0),Math.max(n.findIndex(e=>e.shouldCallHandler()),0)),o=n[a].route.id;for(let e of n.slice(0,a+1))try{await e._lazyPromises?.route}catch{o=e.route.id;break}return{[ei(n,o).route.id]:{type:"error",result:t}}}}}async function V(e,t,r,n,a){let{matches:o,...i}=e;return await I(i,o.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,r,n,a)}async function I(e,t,r,n,a,o,i=0){let l,{request:s}=e;if(s.signal.aborted)throw s.signal.reason??Error(`Request aborted: ${s.method} ${s.url}`);let u=t[i];if(!u)return await r();let[c,d]=u,h=async()=>{if(l)throw Error("You may only call `next()` once per middleware");try{return(l={value:await I(e,t,r,n,a,o,i+1)}).value}catch(e){return(l={value:await o(e,c,l)}).value}};try{let t=await d(e,h),r=null!=t?n(t):void 0;if(a(r))return r;if(l)return r??l.value;return(l={value:await h()}).value}catch(e){return await o(e,c,l)}}function W(e,t,r,n,i){let l=z({key:"middleware",route:n.route,manifest:t,mapRouteProperties:e}),s=function(e,t,r,n,i){let l,s=r[e.id];if((0,a.V1)(s,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if("function"==typeof e.lazy){let t=N.get(s);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let r=(async()=>{(0,a.V1)("function"==typeof e.lazy,"No lazy route function found");let t=await e.lazy(),r={};for(let e in t){let n=t[e];if(void 0===n)continue;let i=(0,o.ep)(e),l=void 0!==s[e];i?(0,a.$e)(!i,"Route property "+e+" is not a supported property to be returned from a lazy route function. This property will be ignored."):l?(0,a.$e)(!l,`Route "${s.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):r[e]=n}Object.assign(s,r),Object.assign(s,{...n(s),lazy:void 0})})();return N.set(s,r),r.catch(()=>{}),{lazyRoutePromise:r,lazyHandlerPromise:r}}let u=Object.keys(e.lazy),c=[];for(let a of u){if(i&&i.includes(a))continue;let o=z({key:a,route:e,manifest:r,mapRouteProperties:n});o&&(c.push(o),a===t&&(l=o))}let d=c.length>0?Promise.all(c).then(()=>{}):void 0;return d?.catch(()=>{}),l?.catch(()=>{}),{lazyRoutePromise:d,lazyHandlerPromise:l}}(n.route,ey(r.method)?"action":"loader",t,e,i);return{middleware:l,route:s.lazyRoutePromise,handler:s.lazyHandlerPromise}}function B(e,t,r,n,a,o,i,l,s,u=null,c){let d=!1,h=W(e,t,r,o,i);return{...o,_lazyPromises:h,shouldLoad:s,shouldRevalidateArgs:u,shouldCallHandler:e=>(d=!0,u)?"boolean"==typeof c?A(o,{...u,defaultShouldRevalidate:c}):"boolean"==typeof e?A(o,{...u,defaultShouldRevalidate:e}):A(o,u):s,resolve(e){let{lazy:t,loader:i,middleware:u}=o.route,c=d||s||e&&!ey(r.method)&&(t||i),f=u&&u.length>0&&!i&&!t;return c&&(ey(r.method)||!f)?J({request:r,path:n,pattern:a,match:o,lazyHandlerPromise:h?.handler,lazyRoutePromise:h?.route,handlerOverride:e,scopedContext:l}):Promise.resolve({type:"data",result:void 0})}}}function Y(e,t,r,n,a,i,l,s,u=null){return a.map(c=>c.route.id!==i.route.id?{...c,shouldLoad:!1,shouldRevalidateArgs:u,shouldCallHandler:()=>!1,_lazyPromises:W(e,t,r,c,l),resolve:()=>Promise.resolve({type:"data",result:void 0})}:B(e,t,r,n,(0,o.gU)(a),c,l,s,!0,u))}async function q(e,t,r,n,a,i,l){n.some(e=>e._lazyPromises?.middleware)&&await Promise.all(n.map(e=>e._lazyPromises?.middleware));let s={request:t,url:(0,o.cg)(t,r),pattern:(0,o.gU)(n),params:n[0].params,context:i,matches:n},u=l?()=>{throw Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:e=>H(s,()=>e({...s,fetcherKey:a,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}})),c=await e({...s,fetcherKey:a,runClientMiddleware:u});try{await Promise.all(n.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return c}async function J({request:e,path:t,pattern:r,match:n,lazyHandlerPromise:a,lazyRoutePromise:i,handlerOverride:l,scopedContext:s}){let u,c,d=ey(e.method),h=d?"action":"loader",f=a=>{let i,u=new Promise((e,t)=>i=t);c=()=>i(),e.signal.addEventListener("abort",c);let d=i=>"function"!=typeof a?Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${h}" [routeId: ${n.route.id}]`)):a({request:e,url:(0,o.cg)(e,t),pattern:r,params:n.params,context:s},...void 0!==i?[i]:[]);return Promise.race([(async()=>{try{return{type:"data",result:await (l?l(e=>d(e)):d())}}catch(e){return{type:"error",result:e}}})(),u])};try{let t=d?n.route.action:n.route.loader;if(a||i)if(t){let e,[r]=await Promise.all([f(t).catch(t=>{e=t}),a,i]);if(void 0!==e)throw e;u=r}else{await a;let t=d?n.route.action:n.route.loader;if(t)[u]=await Promise.all([f(t),i]);else{if("action"!==h)return{type:"data",result:void 0};let t=new URL(e.url),r=t.pathname+t.search;throw es(405,{method:e.method,pathname:r,routeId:n.route.id})}}else if(t)u=await f(t);else{let t=new URL(e.url);throw es(404,{pathname:t.pathname+t.search})}}catch(e){return{type:"error",result:e}}finally{c&&e.signal.removeEventListener("abort",c)}return u}async function G(e){let t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?null==e.body?null:e.json():e.text()}async function X(e){let{result:t,type:r}=e;if(em(t)){let e;try{e=await G(t)}catch(e){return{type:"error",error:e}}return"error"===r?{type:"error",error:new o.cj(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:"data",data:e,statusCode:t.status,headers:t.headers}}if("error"===r){if(ep(t)){var n;return t.data instanceof Error?{type:"error",error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:(n=t,new o.cj(n.init?.status??500,n.init?.statusText??"Internal Server Error",n.data)),statusCode:(0,o.pX)(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}}return{type:"error",error:t,statusCode:(0,o.pX)(t)?t.status:void 0}}return ep(t)?{type:"data",data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"data",data:t}}let K=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function Z(e){try{return K.includes(new URL(e).protocol)}catch{return!1}}function Q(e,t,r,a){if((0,o.vh)(e)){let a=new URL(n.iA.test(e)?(0,n.lS)(e,t.protocol):e);if(Z(a.toString()))throw Error("Invalid redirect location");let i=null!=(0,o.pb)(a.pathname,r);if(a.origin===t.origin&&i)return(0,o.Hv)(a.pathname)+a.search+a.hash}try{if(Z(a.createURL(e).toString()))throw Error("Invalid redirect location")}catch{}return e}function ee(e,t,r,n){let a=e.createURL(ec(t)).toString(),o={signal:r};if(n&&ey(n.formMethod)){let{formMethod:e,formEncType:t}=n;o.method=e.toUpperCase(),"application/json"===t?(o.headers=new Headers({"Content-Type":t}),o.body=JSON.stringify(n.json)):"text/plain"===t?o.body=n.text:"application/x-www-form-urlencoded"===t&&n.formData?o.body=et(n.formData):o.body=n.formData}return new Request(a,o)}function et(e){let t=new URLSearchParams;for(let[r,n]of e.entries())t.append(r,"string"==typeof n?n:n.name);return t}function er(e){let t=new FormData;for(let[r,n]of e.entries())t.append(r,n);return t}function en(e,t,r,n,i,l,s){let{loaderData:u,errors:c}=function(e,t,r,n=!1,i=!1){let l,s={},u=null,c=!1,d={},h=r&&eh(r[1])?r[1].error:void 0;return e.forEach(r=>{if(!(r.route.id in t))return;let f=r.route.id,p=t[f];if((0,a.V1)(!ef(p),"Cannot handle redirect results in processLoaderData"),eh(p)){let t=p.error;if(void 0!==h&&(t=h,h=void 0),u=u||{},i)u[f]=t;else{let r=ei(e,f);null==u[r.route.id]&&(u[r.route.id]=t)}n||(s[f]=P),c||(c=!0,l=(0,o.pX)(p.error)?p.error.status:500),p.headers&&(d[f]=p.headers)}else s[f]=p.data,p.statusCode&&200!==p.statusCode&&!c&&(l=p.statusCode),p.headers&&(d[f]=p.headers)}),void 0!==h&&r&&(u={[r[0]]:h},r[2]&&(s[r[2]]=void 0)),{loaderData:s,errors:u,statusCode:l||200,loaderHeaders:d}}(t,r,n);return i.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{let{key:r,match:n,controller:o}=t;if(o&&o.signal.aborted)return;let i=l[r];if((0,a.V1)(i,"Did not find corresponding fetcher result"),eh(i)){let t=ei(e.matches,n?.route.id);c&&c[t.route.id]||(c={...c,[t.route.id]:i.error}),s.delete(r)}else if(ef(i))(0,a.V1)(!1,"Unhandled fetcher revalidation redirect");else{let e=ex(i.data);s.set(r,e)}}),{loaderData:u,errors:c}}function ea(e,t,r,n){let a=Object.entries(t).filter(([,e])=>e!==P).reduce((e,[t,r])=>(e[t]=r,e),{});for(let o of r){let r=o.route.id;if(!t.hasOwnProperty(r)&&e.hasOwnProperty(r)&&o.route.loader&&(a[r]=e[r]),n&&n.hasOwnProperty(r))break}return a}function eo(e){return e?eh(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function ei(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>null!=e.route.ErrorBoundary||null!=e.route.errorElement)||e[0]}function el(e){let t=1===e.length?e[0]:e.find(e=>e.index||!e.path||"/"===e.path)||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function es(e,{pathname:t,routeId:r,method:n,type:a,message:i}={}){let l="Unknown Server Error",s="Unknown @remix-run/router error";return 400===e?(l="Bad Request",n&&t&&r?s=`You made a ${n} request to "${t}" but did not provide a \`loader\` for route "${r}", so there is no way to handle the request.`:"invalid-body"===a&&(s="Unable to encode submission body")):403===e?(l="Forbidden",s=`Route "${r}" does not match URL "${t}"`):404===e?(l="Not Found",s=`No route matches URL "${t}"`):405===e&&(l="Method Not Allowed",n&&t&&r?s=`You made a ${n.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${r}", so there is no way to handle the request.`:n&&(s=`Invalid request method "${n.toUpperCase()}"`)),new o.cj(e||500,l,Error(s),!0)}function eu(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[r,n]=t[e];if(ef(n))return{key:r,result:n}}}function ec(e){return(0,a.AO)({..."string"==typeof e?(0,a.Rr)(e):e,hash:""})}function ed(e){return null!=e&&"object"==typeof e&&Object.entries(e).every(([e,t])=>{var r;return"string"==typeof e&&null!=(r=t)&&"object"==typeof r&&"type"in r&&"result"in r&&("data"===r.type||"error"===r.type)})}function eh(e){return"error"===e.type}function ef(e){return"redirect"===(e&&e.type)}function ep(e){return"object"==typeof e&&null!=e&&"type"in e&&"data"in e&&"init"in e&&"DataWithResponseInit"===e.type}function em(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"object"==typeof e.headers&&void 0!==e.body}function ey(e){return g.has(e.toUpperCase())}function ev(e){return new URLSearchParams(e).getAll("index").some(e=>""===e)}function eg(e,t){let r="string"==typeof t?(0,a.Rr)(t).search:t.search;if(e[e.length-1].route.index&&ev(r||""))return e[e.length-1];let n=(0,o.nr)(e);return n[n.length-1]}function ew(e,t,r){return{url:(0,o.cg)(e.createURL(t),t),pattern:r?(0,o.gU)(r):"",params:r?.[0]?.params?{...r[0].params}:{}}}function eb(e){let{formMethod:t,formAction:r,formEncType:n,text:a,formData:o,json:i}=e;if(t&&r&&n){if(null!=a)return{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:void 0,text:a};else if(null!=o)return{formMethod:t,formAction:r,formEncType:n,formData:o,json:void 0,text:void 0};else if(void 0!==i)return{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:i,text:void 0}}}function eR(e,t,r,n){return n?{state:"loading",location:e,matches:t,historyAction:r,formMethod:n.formMethod,formAction:n.formAction,formEncType:n.formEncType,formData:n.formData,json:n.json,text:n.text}:{state:"loading",location:e,matches:t,historyAction:r,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function eE(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function ex(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function eS(){let e,t,r=new Promise((n,a)=>{e=async e=>{n(e);try{await r}catch{}},t=async e=>{a(e);try{await r}catch{}}});return{promise:r,resolve:e,reject:t}}},2872(e,t,r){function n(e,t){return t+e.replace(/\\/g,"/")}r.d(t,{lS:()=>n},{E6:/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,iA:/^[\\/]{2}/})},9932(e,t,r){var n=r(2872),a=r(7629),o=r(6255),i=class{#a=new Map;constructor(e){if(e)for(let[t,r]of e)this.set(t,r)}get(e){if(this.#a.has(e))return this.#a.get(e);if(void 0!==e.defaultValue)return e.defaultValue;throw Error("No value found for context")}set(e,t){this.#a.set(e,t)}};let l=new Set(["lazy","caseSensitive","path","id","index","children"]);function s(e){return l.has(e)}let u=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function c(e){return u.has(e)}function d(e){let t={};return e.Component&&Object.assign(t,{element:o.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:o.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:o.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}function h(e,t){return Object.assign(e,{...t,..."object"==typeof t.lazy&&null!=t.lazy?{lazy:{...e.lazy,...t.lazy}}:{}})}function f(e,t,r="/"){return p(e,t,r,!1)}function p(e,t,r,n,o){let i=x(("string"==typeof t?(0,a.Rr)(t):t).pathname||"/",r);if(null==i)return null;let l=o??y(e),s=null,u=function(e){try{return e.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(t){return(0,a.$e)(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}(i);for(let e=0;null==s&&e<l.length;++e)s=function(e,t,r=!1){let{routesMeta:n}=e,a={},o="/",i=[];for(let e=0;e<n.length;++e){let l=n[e],s=e===n.length-1,u="/"===o?t:t.slice(o.length)||"/",c={path:l.relativePath,caseSensitive:l.caseSensitive,end:s},d=l.matcher&&l.compiledParams?R(c,u,l.matcher,l.compiledParams):b(c,u),h=l.route;if(!d&&s&&r&&!n[n.length-1].route.index&&(d=b({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},u)),!d)return null;Object.assign(a,d.params),i.push({params:a,pathname:O([o,d.pathname]),pathnameBase:$(O([o,d.pathnameBase])),route:h}),"/"!==d.pathnameBase&&(o=O([o,d.pathnameBase]))}return i}(l[e],u,n);return s}function m(e,t){let{route:r,pathname:n,params:a}=e;return{id:r.id,pathname:n,params:a,loaderData:t[r.id],handle:r.handle}}function y(e){let t=function e(t,r=[],n=[],o="",i=!1){let l=(t,l,s=i,u)=>{var c,d;let h,f,p={relativePath:void 0===u?t.path||"":u,caseSensitive:!0===t.caseSensitive,childrenIndex:l,route:t};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(o)&&s)return;(0,a.V1)(p.relativePath.startsWith(o),`Absolute route path "${p.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(o.length)}let m=O([o,p.relativePath]),y=n.concat(p);t.children&&t.children.length>0&&((0,a.V1)(!0!==t.index,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),e(t.children,r,y,m,s)),(null!=t.path||t.index)&&r.push({path:m,score:(c=m,d=t.index,f=(h=c.split("/")).length,h.some(w)&&(f+=-2),d&&(f+=2),h.filter(e=>!w(e)).reduce((e,t)=>e+(v.test(t)?3:g.test(t)?3.5:""===t?1:10),f)),routesMeta:y.map((e,t)=>{let[r,n]=E(e.relativePath,e.caseSensitive,t===y.length-1);return{...e,matcher:r,compiledParams:n}})})};return t.forEach((e,t)=>{if(""!==e.path&&e.path?.includes("?"))for(let r of function e(t){let r=t.split("/");if(0===r.length)return[];let[n,...a]=r,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(0===a.length)return o?[i,""]:[i];let l=e(a.join("/")),s=[];return s.push(...l.map(e=>""===e?i:[i,e].join("/"))),o&&s.push(...l),s.map(e=>t.startsWith("/")&&""===e?"/":e)}(e.path))l(e,t,!0,r);else l(e,t)}),r}(e);return t.sort((e,t)=>{var r,n;return e.score!==t.score?t.score-e.score:(r=e.routesMeta.map(e=>e.childrenIndex),n=t.routesMeta.map(e=>e.childrenIndex),r.length===n.length&&r.slice(0,-1).every((e,t)=>e===n[t])?r[r.length-1]-n[n.length-1]:0)}),t}let v=/^:[\w-]+$/,g=/^:[\w-]+/,w=e=>"*"===e;function b(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=E(e.path,e.caseSensitive,e.end);return R(e,t,r,n)}function R(e,t,r,n){let a=t.match(r);if(!a)return null;let o=a[0],i=T(o,1),l=a.slice(1);return{params:n.reduce((e,{paramName:t,isOptional:r},n)=>{if("*"===t){let e=l[n]||"";i=T(o.slice(0,o.length-e.length),1)}let a=l[n];return r&&!a?e[t]=void 0:e[t]=(a||"").replace(/%2F/g,"/"),e},{}),pathname:o,pathnameBase:i,pattern:e}}function E(e,t=!1,r=!0){(0,a.$e)("*"===e||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let n=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(e,t,r,a,o)=>{if(n.push({paramName:t,isOptional:null!=r}),r){let t=o.charAt(a+e.length);return t&&"/"!==t?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(?=\/|$|\()/g,"(?:/$1)?");return e.endsWith("*")?(n.push({paramName:"*"}),o+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":""!==e&&"/"!==e&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),n]}function x(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&"/"!==n?null:e.slice(r)||"/"}function S({basename:e,pathname:t}){return"/"===t?e:O([e,t])}function L(e,t){let r=T(t).split("/");return e.split("/").forEach(e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)}),r.length>1?r.join("/"):"/"}function P(e,t,r,n){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(n)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function k(e){return e.filter((e,t)=>0===t||e.route.path&&e.route.path.length>0)}function C(e){let t=k(e);return t.map((e,r)=>r===t.length-1?e.pathname:e.pathnameBase)}function D(e,t,r,n=!1){let o,i;"string"==typeof e?o=(0,a.Rr)(e):(o={...e},(0,a.V1)(!o.pathname||!o.pathname.includes("?"),P("?","pathname","search",o)),(0,a.V1)(!o.pathname||!o.pathname.includes("#"),P("#","pathname","hash",o)),(0,a.V1)(!o.search||!o.search.includes("#"),P("#","search","hash",o)));let l=""===e||""===o.pathname,s=l?"/":o.pathname;if(null==s)i=r;else{let e=t.length-1;if(!n&&s.startsWith("..")){let t=s.split("/");for(;".."===t[0];)t.shift(),e-=1;o.pathname=t.join("/")}i=e>=0?t[e]:"/"}let u=function(e,t="/"){let{pathname:r,search:n="",hash:o=""}="string"==typeof e?(0,a.Rr)(e):e;return{pathname:r?(r=M(r)).startsWith("/")||r.startsWith("\\")?L(r.substring(1),"/"):L(r,t):t,search:A(n),hash:j(o)}}(o,i),c=s&&"/"!==s&&s.endsWith("/"),d=(l||"."===s)&&r.endsWith("/");return!u.pathname.endsWith("/")&&(c||d)&&(u.pathname+="/"),u}let M=e=>e.replace(/[\\/]{2,}/g,"/"),O=e=>M(e.join("/"));function T(e,t=0){let r=e.length;for(;r>t&&47===e.charCodeAt(r-1);)r--;return r===e.length?e:e.slice(0,r)}let $=e=>T(e).replace(/^\/*/,"/"),A=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",j=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";var U=class{status;statusText;data;error;internal;constructor(e,t,r,n=!1){this.status=e,this.statusText=t||"",this.internal=n,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function z(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}function N(e){return O(e.map(e=>e.route.path).filter(Boolean))||"/"}function _(e,t){let r=new URL("string"==typeof e||e instanceof URL?e:e.url),n="string"==typeof t?(0,a.Rr)(t):t;if(r.pathname=n.pathname||"/",n.search){let e=new URLSearchParams(n.search),t=e.getAll("index");for(let r of(e.delete("index"),t.filter(Boolean)))e.append("index",r);let a=e.toString();r.search=a?`?${a}`:""}else r.search="";return r.hash=n.hash||"",r}let F="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function H(e,t){let r=e;if("string"!=typeof r||!n.E6.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let o=r,i=!1;if(F)try{let e=new URL(window.location.href),a=new URL(n.iA.test(r)?(0,n.lS)(r,e.protocol):r),o=x(a.pathname,t);a.origin===e.origin&&null!=o?r=o+a.search+a.hash:i=!0}catch{(0,a.$e)(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:i,to:r}}r.d(t,{B6:()=>b,Gh:()=>D,MT:()=>d,PD:()=>C,RW:()=>S,R_:()=>function e(t,r=d,n=[],o={},i=!1){return t.map((t,l)=>{let s=[...n,String(l)],u="string"==typeof t.id?t.id:s.join("-");if((0,a.V1)(!0!==t.index||!t.children,"Cannot specify children on an index route"),(0,a.V1)(i||!o[u],`Found a route id collision on id "${u}". Route id's must be globally unique within Data Router usages`),!0===t.index){let e={...t,id:u};return o[u]=h(e,r(e)),e}{let n={...t,id:u,children:void 0};return o[u]=h(n,r(n)),t.children&&(n.children=e(t.children,r,s,o,i)),n}})},X9:()=>H,aB:()=>i,cg:()=>_,cj:()=>U,ep:()=>c,et:()=>p,gU:()=>N,nr:()=>k,oI:()=>y,pX:()=>z,pb:()=>x,pr:()=>s,ue:()=>f,wy:()=>m},{Bd:F,HS:O,Hv:M,WF:["EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],vh:e=>n.E6.test(e)})}}]);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * react-router v8.3.1
3
+ *
4
+ * Copyright (c) Remix Software Inc.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
package/dist/cli.d.mts CHANGED
@@ -1,6 +1,2 @@
1
1
 
2
- //#region src/cli/index.d.ts
3
- declare const foundryCommand: import("citty").CommandDef<import("citty").ArgsDef>;
4
- declare function runCli(rawArgs?: string[]): Promise<void>;
5
- //#endregion
6
- export { foundryCommand, runCli };
2
+ export {}
package/dist/cli.mjs CHANGED
@@ -1,2 +1,26 @@
1
1
  #!/usr/bin/env node
2
- import{t as e}from"./package-BksDGVza.mjs";import{defineCommand as t,renderUsage as n,runMain as r}from"citty";import i from"node:process";import{pathToFileURL as a}from"node:url";import o from"open";import{serve as s}from"@hono/node-server";import{serveStatic as c}from"@hono/node-server/serve-static";import{zValidator as l}from"@hono/zod-validator";import{existsSync as u}from"node:fs";import d from"node:path";import{Hono as f}from"hono";import{z as p}from"zod";const m={success:`SUCCESS`},h=p.strictObject({});function g(){return[d.resolve(import.meta.dirname,`app`),d.resolve(import.meta.dirname,`../../dist/app`)].find(e=>u(e))}function _(e={}){let t=new f;t.get(`/api/health`,l(`query`,h),e=>e.json({status:m.success,data:!0,message:`Service is healthy.`}));let n=e.webRoot??g();return n&&t.use(`*`,c({root:n})),t}const v=`127.0.0.1`;function y(e){return new Promise((t,n)=>{e.close(e=>{if(e){n(e);return}t()})})}async function b(e={}){let t=e.port??54321;return new Promise((e,n)=>{let r=e=>{n(e)},i=s({fetch:_().fetch,hostname:v,port:t},t=>{i.off(`error`,r);let n,a=t.port;e({close:()=>(n??=y(i),n),hostname:v,port:a,url:`http://${v}:${a}`})});i.once(`error`,r)})}function x(e,t){return e instanceof Error&&`code`in e&&e.code===`EADDRINUSE`?`Port ${t} is already in use on 127.0.0.1.`:`Could not start Foundry Server: ${e instanceof Error?e.message:String(e)}`}function S(e,t=i,n=console.error){let r=!1,a=()=>{r||(r=!0,t.off(`SIGINT`,a),t.off(`SIGTERM`,a),e.close().catch(e=>{n(`Could not stop Foundry Server: ${e instanceof Error?e.message:String(e)}`),t.exitCode=1}))};return t.once(`SIGINT`,a),t.once(`SIGTERM`,a),()=>{t.off(`SIGINT`,a),t.off(`SIGTERM`,a)}}const C={error:console.error,log:console.info,openBrowser:o,registerShutdown:e=>{S(e)},setExitCode:e=>{i.exitCode=e},startServer:b};function w(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n===`--port`){if(t+1>=e.length||e[t+1].startsWith(`--`))return`Missing value for option: --port`;t+=1;continue}if(!n.startsWith(`--port=`)&&n!==`--open`&&n!==`--no-open`)return`${n.startsWith(`-`)?`Unknown option`:`Unexpected argument`}: ${n}`}}function T(e){let t=Number(e);if(!Number.isSafeInteger(t)||t<1||t>65535)throw RangeError(`Port must be an integer between 1 and 65535. Received "${e}".`);return t}function E(e=C){return t({meta:{description:`Start the Local Web UI`,name:`ui`},args:{port:{default:`54321`,description:`Port for the Local Web UI`,type:`string`,valueHint:`port`},open:{default:!0,description:`Open the Local Web UI in the default browser`,negativeDescription:`Do not open the default browser`,type:`boolean`}},async run({args:t,rawArgs:n}){let r=w(n);if(r){e.error(`${r}\nRun \`foundry ui --help\` for usage.`),e.setExitCode(1);return}let i;try{i=T(t.port)}catch(t){e.error(`${t instanceof Error?t.message:String(t)}\nRun \`foundry ui --help\` for usage.`),e.setExitCode(1);return}let a;try{a=await e.startServer({port:i})}catch(t){e.error(x(t,i)),e.setExitCode(1);return}if(e.registerShutdown(a),e.log(`Foundry Local Web UI: ${a.url}`),t.open)try{await e.openBrowser(a.url)}catch{e.error(`Could not open the default browser. Open ${a.url} manually.`)}}})}const D=t({meta:{description:`An AI-native local developer runtime`,name:`foundry`,version:e},subCommands:{ui:E()}});function O(e){if(!e.some(e=>e===`--help`||e===`-h`)&&(e.length!==1||e[0]!==`--version`&&e[0]!==`-v`)&&!(e[0]===`ui`||!e[0]?.startsWith(`-`)))return`Unknown option: ${e[0]}`}async function k(e=i.argv.slice(2)){if(e.length===0){console.info(`${await n(D)}\n`);return}let t=O(e);if(t){console.error(`${t}\nRun \`foundry --help\` for usage.`),i.exitCode=1;return}await r(D,{rawArgs:e})}i.argv[1]&&a(i.argv[1]).href===import.meta.url&&k();export{D as foundryCommand,k as runCli};
2
+ import{t as e}from"./package-Dg-nUTkb.mjs";import{defineCommand as t,renderUsage as n,runMain as r}from"citty";import i from"node:process";import a from"open";import{serve as o}from"@hono/node-server";import{serveStatic as s}from"@hono/node-server/serve-static";import{zValidator as c}from"@hono/zod-validator";import{constants as l,existsSync as u}from"node:fs";import d from"node:path";import{Hono as f}from"hono";import{z as p}from"zod";import{Buffer as m}from"node:buffer";import{TextDecoder as ee,promisify as te}from"node:util";import ne from"better-sqlite3";import{drizzle as re}from"drizzle-orm/better-sqlite3";import{createHash as ie,randomUUID as ae,randomUUIDv7 as oe}from"node:crypto";import{access as se,chmod as ce,lstat as le,mkdir as h,readFile as ue,readdir as de,realpath as fe,rename as pe,rm as g,stat as me,writeFile as he}from"node:fs/promises";import{readMigrationFiles as ge}from"drizzle-orm/migrator";import _e from"env-paths";import{homedir as ve}from"node:os";import{and as _,desc as v,eq as y,isNull as b,sql as x}from"drizzle-orm";import{blob as ye,check as S,index as be,integer as C,sqliteTable as w,text as T,uniqueIndex as xe}from"drizzle-orm/sqlite-core";import{parse as Se,patch as Ce,stringify as we}from"@decimalturn/toml-patch";import{execFile as Te}from"node:child_process";var E=Object.defineProperty,Ee=(e,t)=>{let n={};for(var r in e)E(n,r,{get:e[r],enumerable:!0});return t||E(n,Symbol.toStringTag,{value:`Module`}),n};const D={providerNotFound:`PROVIDER_NOT_FOUND`,runtimeApplyFailed:`RUNTIME_APPLY_FAILED`,runtimeConfigurationChanged:`RUNTIME_CONFIGURATION_CHANGED`,runtimeConfigurationInvalid:`RUNTIME_CONFIGURATION_INVALID`,runtimeNotDetected:`RUNTIME_NOT_DETECTED`,success:`SUCCESS`},De=[`system`,`light`,`dark`],O=[`codex`,`claude-code`],Oe=[`image/png`,`image/jpeg`,`image/webp`,`image/svg+xml`],ke=[`authorization`,`x-api-key`],Ae=[`effort`,`xhigh_effort`,`max_effort`,`thinking`,`adaptive_thinking`,`interleaved_thinking`],je=/^[A-Za-z0-9+/]+={0,2}$/u;function Me(e,t){for(let n of e){let e=n.codePointAt(0)??0,r=t&&[9,10,13].includes(e);if(e===127||!r&&e<32)return!0}return!1}function k(e){return p.string().trim().max(e).refine(e=>!Me(e,!0),{message:`Control characters are not allowed.`})}function A(e){return k(e).nullable().transform(e=>e===``?null:e)}function Ne(e,t){try{let n=new URL(e);return[`http:`,`https:`].includes(n.protocol)&&n.username===``&&n.password===``&&(t||n.search===``&&n.hash===``)}catch{return!1}}const Pe=k(2048).min(1).refine(e=>Ne(e,!1),{message:`Provide an HTTP or HTTPS URL without credentials, a query, or a fragment.`}),Fe=A(2048).refine(e=>e===null||Ne(e,!0),{message:`Provide an HTTP or HTTPS URL without credentials.`}),Ie=k(100).min(1),Le=A(100),Re=A(2e3),j=k(200).min(1),M=A(200),ze=A(2e3),Be=p.string().min(1).max(16384).refine(e=>!Me(e,!1),{message:`Control characters are not allowed.`}),Ve=p.union([Be,p.literal(``),p.null()]).transform(e=>e===``?null:e);function He(e,t){if(e===`image/png`)return[137,80,78,71,13,10,26,10].every((e,n)=>t[n]===e);if(e===`image/jpeg`)return t[0]===255&&t[1]===216&&t[2]===255;if(e===`image/svg+xml`)try{let e=new ee(`utf-8`,{fatal:!0}).decode(t);return/^\s*(?:(?:<\?xml[\s\S]*?\?>|<!--[\s\S]*?-->|<!DOCTYPE[\s\S]*?>)\s*)*<svg(?:\s|>)/u.test(e)}catch{return!1}return t[0]===82&&t[1]===73&&t[2]===70&&t[3]===70&&t[8]===87&&t[9]===69&&t[10]===66&&t[11]===80}const Ue=p.strictObject({data:p.string().min(1).max(2796204),mimeType:p.enum(Oe)}).superRefine((e,t)=>{if(!je.test(e.data)){t.addIssue({code:`custom`,message:`Avatar data must be valid Base64.`});return}let n=m.from(e.data,`base64`);(n.byteLength===0||n.byteLength>2097152||n.toString(`base64`)!==e.data||!He(e.mimeType,n))&&t.addIssue({code:`custom`,message:`Avatar data must be a valid PNG, JPEG, WebP, or SVG image no larger than 2 MB.`})}),We=p.array(p.enum(Ae)).max(Ae.length).refine(e=>new Set(e).size===e.length,{message:`Model capabilities must be unique.`}),N=p.strictObject({description:Re,displayName:Le,model:j,supportedCapabilities:We}),Ge=p.strictObject({apiKey:Ve,baseUrl:Pe,primaryModel:j,protocol:p.literal(`responses`),reviewModel:M}),Ke=p.strictObject({apiKey:Be,apiKeyHeader:p.enum(ke),baseUrl:Pe,fableModel:N.nullable(),haikuModel:N.nullable(),opusModel:N.nullable(),primaryModel:N,protocol:p.literal(`messages`),sonnetModel:N.nullable(),subagentModel:M}),qe={avatar:Ue.nullable(),name:Ie,officialWebsite:Fe,remark:ze},Je=p.discriminatedUnion(`runtime`,[p.strictObject({...qe,configuration:Ge,runtime:p.literal(`codex`)}),p.strictObject({...qe,configuration:Ke,runtime:p.literal(`claude-code`)})]),Ye=p.strictObject({runtime:p.enum(O)});function Xe(e){return Je.parse(e)}function Ze(e){return Ge.parse(e)}function Qe(e){return Ke.parse(e)}function $e(e){return e===null?null:m.from(Ue.parse(e).data,`base64`)}function et(e,t){e.get(`/api/providers`,c(`query`,Ye),e=>e.json({status:D.success,data:t.listProviders(e.req.valid(`query`).runtime)})),e.post(`/api/providers`,c(`json`,Je),e=>e.json({status:D.success,data:t.createProvider(e.req.valid(`json`))},201))}var P=class extends Error{status;constructor(e,t){super(t),this.status=e}};const F=p.discriminatedUnion(`kind`,[p.strictObject({kind:p.literal(`official-default`)}),p.strictObject({kind:p.literal(`provider`),providerId:p.string().min(1)})]),I=p.strictObject({runtime:p.enum(O)}),tt=p.strictObject({}),nt=p.strictObject({providerKey:p.string().min(1).max(200).optional(),target:F}),rt=p.strictObject({expectedFileHash:p.string().regex(/^[0-9a-f]{64}$/),providerKey:p.string().min(1).max(200).optional(),target:F});function it(e,t){e.get(`/api/runtimes`,c(`query`,tt),async e=>e.json({status:D.success,data:await t.listRuntimes()})),e.post(`/api/runtimes/:runtime/preview`,c(`param`,I),c(`json`,nt),async e=>{try{return e.json({status:D.success,data:await t.previewConfiguration(e.req.valid(`param`).runtime,e.req.valid(`json`))})}catch(t){if(t instanceof P)return e.json({status:t.status,data:null,message:t.message});throw t}}),e.post(`/api/runtimes/:runtime/apply`,c(`param`,I),c(`json`,rt),async e=>{try{return e.json({status:D.success,data:await t.applyConfiguration(e.req.valid(`param`).runtime,e.req.valid(`json`))})}catch(t){if(t instanceof P)return e.json({status:t.status,data:null,message:t.message});throw t}})}const at=p.strictObject({}),ot=p.strictObject({colorMode:p.enum(De)});function st(e,t){e.get(`/api/settings`,c(`query`,at),e=>e.json({status:D.success,data:t.getApplicationSettings()})),e.patch(`/api/settings`,c(`json`,ot),e=>e.json({status:D.success,data:t.updateApplicationSettings(e.req.valid(`json`))}))}const ct=p.strictObject({});function lt(){return[d.resolve(import.meta.dirname,`app`),d.resolve(import.meta.dirname,`../../dist/app`)].find(e=>u(e))}function ut(e){let t=new f;t.get(`/api/health`,c(`query`,ct),e=>e.json({status:D.success,data:!0,message:`Service is healthy.`})),st(t,e.settingsStore),et(t,e.providerStore),it(t,e.runtimeService);let n=e.webRoot??lt();return n&&t.use(`*`,s({root:n})),t}const L=`__drizzle_migrations`;function dt(e){return!!e.prepare(`
3
+ SELECT 1
4
+ FROM sqlite_master
5
+ WHERE type = 'table' AND name = ?
6
+ `).pluck().get(L)}function R(e){return dt(e)?e.prepare(`
7
+ SELECT hash, created_at
8
+ FROM ${L}
9
+ ORDER BY created_at ASC
10
+ `).all():[]}function z(e,t){if(e.length>t.length)throw Error(`The Foundry database was migrated by a newer CLI version.`);for(let[n,r]of e.entries()){let e=t[n];if(r.hash!==e.hash||r.created_at!==e.folderMillis)throw Error(`The Foundry database migration history is incompatible.`)}}async function ft(e){let t=(await de(e)).filter(e=>e.endsWith(`.sqlite`)).toSorted((e,t)=>e.localeCompare(t)).slice(0,-1);await Promise.all(t.map(t=>g(d.join(e,t),{force:!0})))}async function pt(e,t,n){let r=d.join(d.dirname(t),`backups`);await h(r,{recursive:!0});let a=new Date(n()).toISOString().replaceAll(`:`,`-`),o=d.join(r,`foundry-before-${a}-${i.pid}.sqlite`);await e.backup(o),await ft(r)}function mt(e,t){e.exec(`BEGIN IMMEDIATE`);try{e.exec(`
11
+ CREATE TABLE IF NOT EXISTS ${L} (
12
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
13
+ hash TEXT NOT NULL,
14
+ created_at INTEGER NOT NULL
15
+ )
16
+ `);let n=R(e);z(n,t);let r=e.prepare(`
17
+ INSERT INTO ${L} (hash, created_at)
18
+ VALUES (?, ?)
19
+ `);for(let i of t.slice(n.length)){for(let t of i.sql)e.exec(t);r.run(i.hash,i.folderMillis)}e.exec(`COMMIT`)}catch(t){throw e.exec(`ROLLBACK`),t}}async function ht(e,t){let n=ge({migrationsFolder:t.migrationsFolder}),r=R(e);z(r,n),r.length!==n.length&&(t.isExistingDatabase&&await pt(e,t.databasePath,t.now??Date.now),mt(e,n))}function gt(){return i.platform!==`darwin`&&i.platform!==`win32`&&i.env.XDG_DATA_HOME&&!d.isAbsolute(i.env.XDG_DATA_HOME)?d.join(ve(),`.local`,`share`,`foundry`):_e(`foundry`,{suffix:``}).data}function _t(){return d.join(gt(),`foundry.sqlite`)}var vt=Ee({providers:()=>V,runtimes:()=>H,settings:()=>B});const B=w(`settings`,{id:T(`id`).primaryKey(),key:T(`key`).notNull(),value:T(`value`,{mode:`json`}).$type().notNull(),createdAt:C(`created_at`).notNull(),updatedAt:C(`updated_at`).notNull(),deletedAt:C(`deleted_at`)},e=>[xe(`settings_key_unique`).on(e.key),S(`settings_id_not_empty`,x`length(${e.id}) > 0`),S(`settings_key_not_empty`,x`length(trim(${e.key})) > 0`),S(`settings_value_json`,x`json_valid(${e.value})`),S(`settings_created_at_nonnegative`,x`${e.createdAt} >= 0`),S(`settings_updated_at_valid`,x`${e.updatedAt} >= ${e.createdAt}`),S(`settings_deleted_at_valid`,x`${e.deletedAt} IS NULL OR ${e.deletedAt} >= ${e.createdAt}`)]),V=w(`providers`,{id:T(`id`).primaryKey(),runtime:T(`runtime`,{enum:[`codex`,`claude-code`]}).notNull(),name:T(`name`).notNull(),officialWebsite:T(`official_website`),remark:T(`remark`),avatarMimeType:T(`avatar_mime_type`,{enum:[`image/png`,`image/jpeg`,`image/webp`,`image/svg+xml`]}),avatarData:ye(`avatar_data`,{mode:`buffer`}),configuration:T(`configuration`,{mode:`json`}).$type().notNull(),createdAt:C(`created_at`).notNull(),updatedAt:C(`updated_at`).notNull(),deletedAt:C(`deleted_at`)},e=>[be(`providers_runtime_created_at_index`).on(e.runtime,e.createdAt),S(`providers_id_not_empty`,x`length(${e.id}) > 0`),S(`providers_runtime_valid`,x`${e.runtime} IN ('codex', 'claude-code')`),S(`providers_name_valid`,x`length(trim(${e.name})) BETWEEN 1 AND 100`),S(`providers_official_website_valid`,x`${e.officialWebsite} IS NULL OR length(${e.officialWebsite}) <= 2048`),S(`providers_remark_valid`,x`${e.remark} IS NULL OR length(${e.remark}) <= 2000`),S(`providers_avatar_valid`,x`(${e.avatarMimeType} IS NULL AND ${e.avatarData} IS NULL) OR (${e.avatarMimeType} IN ('image/png', 'image/jpeg', 'image/webp', 'image/svg+xml') AND ${e.avatarData} IS NOT NULL AND length(${e.avatarData}) BETWEEN 1 AND 2097152)`),S(`providers_configuration_json`,x`json_valid(${e.configuration})`),S(`providers_created_at_nonnegative`,x`${e.createdAt} >= 0`),S(`providers_updated_at_valid`,x`${e.updatedAt} >= ${e.createdAt}`),S(`providers_deleted_at_valid`,x`${e.deletedAt} IS NULL OR ${e.deletedAt} >= ${e.createdAt}`)]),H=w(`runtimes`,{runtime:T(`runtime`,{enum:[`codex`,`claude-code`]}).primaryKey(),managed:C(`managed`,{mode:`boolean`}).notNull().default(!1),providerId:T(`provider_id`).references(()=>V.id,{onDelete:`restrict`}),appliedAt:C(`applied_at`)},e=>[S(`runtimes_runtime_valid`,x`${e.runtime} IN ('codex', 'claude-code')`),S(`runtimes_state_valid`,x`(${e.managed} = 0 AND ${e.providerId} IS NULL AND ${e.appliedAt} IS NULL) OR (${e.managed} = 1 AND ${e.appliedAt} IS NOT NULL)`),S(`runtimes_applied_at_nonnegative`,x`${e.appliedAt} IS NULL OR ${e.appliedAt} >= 0`)]);function yt(){let e=[d.resolve(import.meta.dirname,`migrations`),d.resolve(import.meta.dirname,`../../../drizzle`)].find(e=>u(e));if(!e)throw Error(`Foundry database migrations could not be found.`);return e}async function bt(e={}){let t=e.databasePath??_t(),n=u(t);await h(d.dirname(t),{recursive:!0});let r=new ne(t,{timeout:5e3});try{return r.pragma(`foreign_keys = ON`),r.function(`uuid_v7`,()=>oe()),await ht(r,{isExistingDatabase:n,databasePath:t,migrationsFolder:e.migrationsFolder??yt(),now:e.now}),{client:r,db:re({client:r,schema:vt})}}catch(e){throw r.close(),e}}function xt(e){if(e.avatarMimeType===null&&e.avatarData===null)return null;if(e.avatarMimeType===null||e.avatarData===null)throw Error(`Stored Provider avatar is invalid.`);return{data:e.avatarData.toString(`base64`),mimeType:e.avatarMimeType}}function U(e){let t={avatar:xt(e),createdAt:e.createdAt,id:e.id,name:e.name,officialWebsite:e.officialWebsite,remark:e.remark,updatedAt:e.updatedAt};return e.runtime===`codex`?{...t,configuration:Ze(e.configuration),runtime:e.runtime}:{...t,configuration:Qe(e.configuration),runtime:e.runtime}}var St=class{database;now;createId;constructor(e,t=Date.now,n=oe){this.database=e,this.now=t,this.createId=n}createProvider(e){let t=Xe(e),n=$e(t.avatar),r=this.now(),i=this.createId();return this.database.insert(V).values({avatarData:n,avatarMimeType:t.avatar?.mimeType??null,configuration:t.configuration,createdAt:r,deletedAt:null,id:i,name:t.name,officialWebsite:t.officialWebsite,remark:t.remark,runtime:t.runtime,updatedAt:r}).run(),U({avatarData:n,avatarMimeType:t.avatar?.mimeType??null,configuration:t.configuration,createdAt:r,deletedAt:null,id:i,name:t.name,officialWebsite:t.officialWebsite,remark:t.remark,runtime:t.runtime,updatedAt:r})}getProvider(e){let t=this.database.select().from(V).where(_(y(V.id,e),b(V.deletedAt))).get();return t?U(t):null}listProviders(e){return this.database.select().from(V).where(_(y(V.runtime,e),b(V.deletedAt))).orderBy(v(V.createdAt),v(V.id)).all().map(e=>U(e))}};function W(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ct(e){if(typeof e==`string`)return e;if(typeof e==`bigint`)return e.toString();let t=JSON.stringify(e);return typeof t==`string`?t:String(e)}function wt(e,t){return e===void 0?{kind:`absent`}:t?{kind:`secret`,value:Ct(e)}:{kind:`plain`,value:Ct(e)}}function G(e,t,n,r=!1){let i;return i=t===void 0&&n===void 0?`unchanged`:t===void 0?`add`:n===void 0?`remove`:t===n?`unchanged`:`update`,{current:wt(t,r),key:e,operation:i,proposed:wt(n,r)}}function K(e){return{changes:e.filter(e=>e.operation!==`unchanged`),unchanged:e.filter(e=>e.operation===`unchanged`)}}function q(e){return ie(`sha256`).update(e===null?`absent\0`:`present\0${e}`).digest(`hex`)}function Tt(e,t){try{let n=e===`codex`?Se(t):JSON.parse(t);if(!W(n))throw Error(`Configuration root must be an object.`);return n}catch{throw new P(`RUNTIME_CONFIGURATION_INVALID`,`The ${e===`codex`?`Codex`:`Claude Code`} configuration cannot be safely parsed.`)}}async function Et(e,t){try{let n=await le(t);if(!n.isFile())throw new P(`RUNTIME_CONFIGURATION_INVALID`,`The Runtime configuration path is not a regular file.`);let r=await ue(t,`utf8`);return{content:r,exists:!0,hash:q(r),mode:n.mode&511,values:Tt(e,r)}}catch(e){if(e&&typeof e==`object`&&`code`in e&&e.code===`ENOENT`)return{content:null,exists:!1,hash:q(null),mode:384,values:{}};throw e instanceof P?e:new P(`RUNTIME_APPLY_FAILED`,`The Runtime configuration could not be read.`)}}function J(e){return structuredClone(e)}function Y(e,t,n){n===void 0?delete e[t]:e[t]=n}function Dt(e,t){return e.content===null?we(t):Ce(e.content,t)}function Ot(e){let t=/(?:\r\n|\n)([\t ]+)"/.exec(e)?.[1];if(t!==void 0)return t.includes(` `)?` `:t.length}function kt(e,t){if(e.content===null)return`${JSON.stringify(t,null,2)}\n`;let n=e.content.includes(`\r
20
+ `)?`\r
21
+ `:`
22
+ `,r=e.content.endsWith(`
23
+ `),i=JSON.stringify(t,null,Ot(e.content));return n===`\r
24
+ `&&(i=i.replaceAll(`
25
+ `,`\r
26
+ `)),r?`${i}${n}`:i}function At(e,t){return d.join(d.dirname(e),`.${d.basename(e)}.foundry-${t}-${ae()}.tmp`)}async function X(e,t,n,r){let i=At(e,r);try{await he(i,t,{encoding:`utf8`,flag:`wx`,mode:n}),await ce(i,n),await pe(i,e)}catch(e){try{await g(i,{force:!0})}catch{}throw e}}async function jt(e,t,n,r){if(n.source.hash!==r)throw new P(`RUNTIME_CONFIGURATION_CHANGED`,`The Runtime configuration changed after Preview. Refresh and review it again.`);let{source:i}=n,a=d.dirname(t),o=`${t}.foundry-backup`;if(!(!i.exists||n.content!==i.content))return{rollback:async()=>{}};Tt(e,n.content);try{await h(a,{mode:448,recursive:!0}),i.exists&&i.content!==null?await X(o,i.content,384,`backup`):await g(o,{force:!0}),await X(t,n.content,i.mode,`write`)}catch(e){throw e instanceof P?e:new P(`RUNTIME_APPLY_FAILED`,`The Runtime configuration could not be safely updated.`)}return{rollback:async()=>{try{i.exists&&i.content!==null?await X(t,i.content,i.mode,`rollback`):await g(t,{force:!0})}catch{throw new P(`RUNTIME_APPLY_FAILED`,`The previous Runtime configuration could not be restored.`)}}}}const Mt=[`ANTHROPIC_DEFAULT_MODEL`,`ANTHROPIC_DEFAULT_OPUS_MODEL`,`ANTHROPIC_DEFAULT_SONNET_MODEL`,`ANTHROPIC_DEFAULT_HAIKU_MODEL`,`ANTHROPIC_DEFAULT_FABLE_MODEL`],Nt=[``,`_NAME`,`_DESCRIPTION`,`_SUPPORTED_CAPABILITIES`],Z=[`ANTHROPIC_BASE_URL`,`ANTHROPIC_AUTH_TOKEN`,`ANTHROPIC_API_KEY`,...Mt.flatMap(e=>Nt.map(t=>`${e}${t}`)),`CLAUDE_CODE_SUBAGENT_MODEL`];function Pt(e){return e===null?[void 0,void 0,void 0,void 0]:[e.model,e.displayName??void 0,e.description??void 0,e.supportedCapabilities.length>0?e.supportedCapabilities.join(`,`):void 0]}function Ft(e){let t=Object.fromEntries(Z.map(e=>[e,void 0]));if(e===null)return t;t.ANTHROPIC_BASE_URL=e.baseUrl,t.ANTHROPIC_AUTH_TOKEN=e.apiKeyHeader===`authorization`?e.apiKey:void 0,t.ANTHROPIC_API_KEY=e.apiKeyHeader===`x-api-key`?e.apiKey:void 0;let n=[e.primaryModel,e.opusModel,e.sonnetModel,e.haikuModel,e.fableModel];for(let[e,r]of Mt.entries()){let i=Pt(n[e]);for(let[e,n]of Nt.entries())t[`${r}${n}`]=i[e]}return t.CLAUDE_CODE_SUBAGENT_MODEL=e.subagentModel??void 0,t}function It(e,t,n,r){let i=e.values.env;if(i!==void 0&&!W(i))throw new P(`RUNTIME_CONFIGURATION_INVALID`,`Claude Code env must be an object.`);let a=i??{},o=Ft(r?.configuration??null),s=Z.map(e=>G(`env.${e}`,a[e],o[e],e===`ANTHROPIC_AUTH_TOKEN`||e===`ANTHROPIC_API_KEY`)),c=J(e.values),l=W(c.env)?c.env:{};c.env=l;for(let e of Z)Y(l,e,o[e]);Object.keys(l).length===0&&delete c.env;let u=K(s);return{content:kt(e,c),preview:{...u,file:{exists:e.exists,hash:e.hash,path:t},kind:`ready`,providerKey:null,runtime:`claude-code`,target:n},source:e}}const Q=[`model`,`review_model`,`model_provider`],Lt=[`name`,`base_url`,`wire_api`,`experimental_bearer_token`];function Rt(e){let t=e.model_providers;if(t===void 0)return{};if(!W(t))throw new P(`RUNTIME_CONFIGURATION_INVALID`,`Codex model_providers must be a table.`);return t}function zt(e){return Object.entries(Rt(e)).filter(e=>W(e[1])).map(([e])=>e)}function Bt(e,t){let n=zt(e);if(n.length===0){if(t!==void 0&&t!==`foundry`)throw new P(`RUNTIME_CONFIGURATION_INVALID`,`The selected Codex Provider key is unavailable.`);return{key:`foundry`,keys:n}}if(n.length===1){if(t!==void 0&&t!==n[0])throw new P(`RUNTIME_CONFIGURATION_INVALID`,`The selected Codex Provider key is unavailable.`);return{key:n[0],keys:n}}if(t===void 0)return{key:null,keys:n};if(!n.includes(t))throw new P(`RUNTIME_CONFIGURATION_INVALID`,`The selected Codex Provider key is unavailable.`);return{key:t,keys:n}}function Vt(e,t){let n=Rt(e)[t];if(n===void 0)return{};if(!W(n))throw new P(`RUNTIME_CONFIGURATION_INVALID`,`Codex model_providers.${t} must be a table.`);return n}function Ht(e,t,n,r,i){if(n.kind===`official-default`){let r=Q.map(t=>G(t,e.values[t],void 0)),i=J(e.values);for(let e of Q)delete i[e];let a=K(r);return{content:Dt(e,i),preview:{...a,file:{exists:e.exists,hash:e.hash,path:t},kind:`ready`,providerKey:null,runtime:`codex`,target:n},source:e}}if(r===null)throw new P(`PROVIDER_NOT_FOUND`,`The selected Provider is unavailable.`);let a=Bt(e.values,i);if(a.key===null)return{file:{exists:e.exists,hash:e.hash,path:t},kind:`provider-key-selection`,providerKeys:a.keys,runtime:`codex`,target:n};let o=a.key,s=Vt(e.values,o),c={model:r.configuration.primaryModel,model_provider:o,review_model:r.configuration.reviewModel??void 0},l={base_url:r.configuration.baseUrl,experimental_bearer_token:r.configuration.apiKey??void 0,name:r.name,wire_api:`responses`},u=[...Q.map(t=>G(t,e.values[t],c[t])),...Lt.map(e=>G(`[model_providers.${o}].${e}`,s[e],l[e],e===`experimental_bearer_token`))],d=J(e.values);for(let e of Q)Y(d,e,c[e]);let f=W(d.model_providers)?d.model_providers:{};d.model_providers=f;let p=W(f[o])?f[o]:{};f[o]=p;for(let e of Lt)Y(p,e,l[e]);let m=K(u);return{content:Dt(e,d),preview:{...m,file:{exists:e.exists,hash:e.hash,path:t},kind:`ready`,providerKey:o,runtime:`codex`,target:n},source:e}}function Ut(e,t,n){if(t.kind===`official-default`)return null;if(n?.id!==t.providerId||n.runtime!==e)throw new P(`PROVIDER_NOT_FOUND`,`The selected Provider is unavailable.`);return n}async function Wt(e,t,n,r,i){let a=await Et(e,t),o=Ut(e,n,r);return e===`codex`?Ht(a,t,n,o,i):It(a,t,n,o)}function Gt(e){return`preview`in e}var Kt=class{async preview(e,t,n,r,i){let a=await Wt(e,t,n,r,i);return Gt(a)?a.preview:a}async apply(e,t,n,r,i,a){let o=await Wt(e,t,n,r,a);if(!Gt(o))throw new P(`RUNTIME_CONFIGURATION_INVALID`,`Select a Codex Provider key before applying changes.`);return jt(e,t,o,i)}};const qt=te(Te),Jt={"claude-code":{command:`claude`,configurationPath:d.join(`.claude`,`settings.json`)},codex:{command:`codex`,configurationPath:d.join(`.codex`,`config.toml`)}};async function Yt(e){try{return await me(e),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code!==`ENOENT`)}}async function Xt(e,t){let n=i.platform===`win32`?(i.env.PATHEXT??`.EXE;.CMD;.BAT;.COM`).split(`;`):[``];for(let r of t.split(d.delimiter))if(r)for(let t of n){let n=d.join(r,`${e}${t}`);try{return await se(n,i.platform===`win32`?l.F_OK:l.X_OK),await fe(n)}catch{}}return null}var Zt=class{homeDirectory;environmentPath;runVersion;constructor(e=ve(),t=i.env.PATH??``,n=async e=>{let t=await qt(e,[`--version`],{timeout:3e3,windowsHide:!0});return(t.stdout||t.stderr).trim()}){this.homeDirectory=e,this.environmentPath=t,this.runVersion=n}async detect(e){let t=Jt[e],n=d.join(this.homeDirectory,t.configurationPath),r=await Yt(n),i=await Xt(t.command,this.environmentPath);if(!i)return{configurationExists:r,configurationPath:n,executablePath:null,message:`${t.command} was not found in PATH.`,status:`not-detected`,version:null};try{return{configurationExists:r,configurationPath:n,executablePath:i,message:null,status:`detected`,version:await this.runVersion(i)}}catch{return{configurationExists:r,configurationPath:n,executablePath:i,message:`${t.command} --version could not be completed.`,status:`failed`,version:null}}}},Qt=class{runtimeStore;providerStore;detector;configurationManager;inFlightRuntimes=new Set;constructor(e,t,n,r){this.runtimeStore=e,this.providerStore=t,this.detector=n,this.configurationManager=r}resolveProvider(e,t){if(t.kind===`official-default`)return null;let n=this.providerStore.getProvider(t.providerId);if(n?.runtime!==e)throw new P(`PROVIDER_NOT_FOUND`,`The selected Provider is unavailable.`);return n}async requireDetection(e){let t=await this.detector.detect(e);if(t.status!==`detected`)throw new P(`RUNTIME_NOT_DETECTED`,t.message??`The Runtime could not be detected.`);return t}async listRuntimes(){let e=new Map(this.runtimeStore.listAssignments().map(e=>[e.runtime,e])),t=await Promise.all(O.map(e=>this.detector.detect(e)));return O.map((n,r)=>{let i=e.get(n);if(!i)throw Error(`Runtime assignment ${n} is missing.`);return{...i,detection:t[r]}})}async previewConfiguration(e,t){let n=await this.requireDetection(e),r=this.resolveProvider(e,t.target);return this.configurationManager.preview(e,n.configurationPath,t.target,r,t.providerKey)}async applyConfiguration(e,t){if(this.inFlightRuntimes.has(e))throw new P(`RUNTIME_APPLY_FAILED`,`A configuration update is already running for this Runtime.`);this.inFlightRuntimes.add(e);try{let n=await this.requireDetection(e),r=this.resolveProvider(e,t.target),i=await this.configurationManager.apply(e,n.configurationPath,t.target,r,t.expectedFileHash,t.providerKey);try{return{...this.runtimeStore.recordAssignment(e,t.target),detection:{...n,configurationExists:!0}}}catch(e){throw await i.rollback(),e}}finally{this.inFlightRuntimes.delete(e)}}},$t=class{database;now;constructor(e,t=Date.now){this.database=e,this.now=t}listAssignments(){let e=new Map(this.database.select().from(H).all().map(e=>[e.runtime,{appliedAt:e.appliedAt,managed:e.managed,providerId:e.providerId,runtime:e.runtime}]));return O.map(t=>{let n=e.get(t);if(!n)throw Error(`Runtime assignment ${t} is missing.`);return n})}recordAssignment(e,t){return this.database.transaction(()=>{let n=t.kind===`provider`?t.providerId:null;if(n!==null&&!this.database.select({runtime:V.runtime}).from(V).where(_(y(V.id,n),y(V.runtime,e),b(V.deletedAt))).get())throw new P(`PROVIDER_NOT_FOUND`,`The selected Provider is unavailable.`);let r=this.now();if(this.database.update(H).set({appliedAt:r,managed:!0,providerId:n}).where(y(H.runtime,e)).run().changes!==1)throw Error(`Runtime assignment ${e} could not be saved.`);return{appliedAt:r,managed:!0,providerId:n,runtime:e}})}};const en=`color_mode`,tn=p.enum(De);var nn=class{database;now;constructor(e,t=Date.now){this.database=e,this.now=t}getApplicationSettings(){let e=this.database.select({deletedAt:B.deletedAt,key:B.key,value:B.value}).from(B).all();if(e.length!==1)throw Error(`Stored Application Settings are invalid.`);let[t]=e;if(t.key!==en||t.deletedAt!==null)throw Error(`Stored Application Settings are invalid.`);return{colorMode:tn.parse(t.value)}}updateApplicationSettings(e){if(this.database.update(B).set({updatedAt:this.now(),value:e.colorMode}).where(y(B.key,en)).run().changes!==1)throw Error(`Stored Application Settings are invalid.`);return this.getApplicationSettings()}};const $=`127.0.0.1`;function rn(e){return new Promise((t,n)=>{e.close(e=>{if(e){n(e);return}t()})})}async function an(e={}){let t=e.port??54321,n=await bt({databasePath:e.databasePath,migrationsFolder:e.migrationsFolder}),r=new St(n.db),i=ut({providerStore:r,runtimeService:new Qt(new $t(n.db),r,new Zt,new Kt),settingsStore:new nn(n.db)});return new Promise((e,r)=>{let a=e=>{n.client.close(),r(e)},s=o({fetch:i.fetch,hostname:$,port:t},t=>{s.off(`error`,a);let r,i=t.port,o=async()=>{try{await rn(s)}finally{n.client.close()}};e({close:()=>(r??=o(),r),hostname:$,port:i,url:`http://${$}:${i}`})});s.once(`error`,a)})}function on(e,t){return e instanceof Error&&`code`in e&&e.code===`EADDRINUSE`?`Port ${t} is already in use on 127.0.0.1.`:`Could not start Foundry Server: ${e instanceof Error?e.message:String(e)}`}function sn(e,t=i,n=console.error){let r=!1,a=()=>{r||(r=!0,t.off(`SIGINT`,a),t.off(`SIGTERM`,a),e.close().catch(e=>{n(`Could not stop Foundry Server: ${e instanceof Error?e.message:String(e)}`),t.exitCode=1}))};return t.once(`SIGINT`,a),t.once(`SIGTERM`,a),()=>{t.off(`SIGINT`,a),t.off(`SIGTERM`,a)}}const cn={error:console.error,log:console.info,openBrowser:a,registerShutdown:e=>{sn(e)},setExitCode:e=>{i.exitCode=e},startServer:an};function ln(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n===`--port`){if(t+1>=e.length||e[t+1].startsWith(`--`))return`Missing value for option: --port`;t+=1;continue}if(!n.startsWith(`--port=`)&&n!==`--open`&&n!==`--no-open`)return`${n.startsWith(`-`)?`Unknown option`:`Unexpected argument`}: ${n}`}}function un(e){let t=Number(e);if(!Number.isSafeInteger(t)||t<1||t>65535)throw RangeError(`Port must be an integer between 1 and 65535. Received "${e}".`);return t}function dn(e=cn){return t({meta:{description:`Start the Local Web UI`,name:`ui`},args:{port:{default:`54321`,description:`Port for the Local Web UI`,type:`string`,valueHint:`port`},open:{default:!0,description:`Open the Local Web UI in the default browser`,negativeDescription:`Do not open the default browser`,type:`boolean`}},async run({args:t,rawArgs:n}){let r=ln(n);if(r){e.error(`${r}\nRun \`foundry ui --help\` for usage.`),e.setExitCode(1);return}let i;try{i=un(t.port)}catch(t){e.error(`${t instanceof Error?t.message:String(t)}\nRun \`foundry ui --help\` for usage.`),e.setExitCode(1);return}let a;try{a=await e.startServer({port:i})}catch(t){e.error(on(t,i)),e.setExitCode(1);return}if(e.registerShutdown(a),e.log(`Foundry Local Web UI: ${a.url}`),t.open)try{await e.openBrowser(a.url)}catch{e.error(`Could not open the default browser. Open ${a.url} manually.`)}}})}const fn=t({meta:{description:`An AI-native local developer runtime`,name:`foundry`,version:e},subCommands:{ui:dn()}});function pn(e){if(!e.some(e=>e===`--help`||e===`-h`)&&(e.length!==1||e[0]!==`--version`&&e[0]!==`-v`)&&!(e[0]===`ui`||!e[0]?.startsWith(`-`)))return`Unknown option: ${e[0]}`}async function mn(e=i.argv.slice(2)){if(e.length===0){console.info(`${await n(fn)}\n`);return}let t=pn(e);if(t){console.error(`${t}\nRun \`foundry --help\` for usage.`),i.exitCode=1;return}await r(fn,{rawArgs:e})}mn();export{};
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
 
2
- import{t as e}from"./package-BksDGVza.mjs";function t(){return e}export{t as getVersion};
2
+ import{t as e}from"./package-Dg-nUTkb.mjs";function t(){return e}export{t as getVersion};
@@ -0,0 +1,26 @@
1
+ CREATE TABLE `settings` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `key` text NOT NULL,
4
+ `value` text NOT NULL,
5
+ `created_at` integer NOT NULL,
6
+ `updated_at` integer NOT NULL,
7
+ `deleted_at` integer,
8
+ CONSTRAINT "settings_id_not_empty" CHECK(length("settings"."id") > 0),
9
+ CONSTRAINT "settings_key_not_empty" CHECK(length(trim("settings"."key")) > 0),
10
+ CONSTRAINT "settings_value_json" CHECK(json_valid("settings"."value")),
11
+ CONSTRAINT "settings_created_at_nonnegative" CHECK("settings"."created_at" >= 0),
12
+ CONSTRAINT "settings_updated_at_valid" CHECK("settings"."updated_at" >= "settings"."created_at"),
13
+ CONSTRAINT "settings_deleted_at_valid" CHECK("settings"."deleted_at" IS NULL OR "settings"."deleted_at" >= "settings"."created_at")
14
+ );
15
+ --> statement-breakpoint
16
+ CREATE UNIQUE INDEX `settings_key_unique` ON `settings` (`key`);
17
+ --> statement-breakpoint
18
+ INSERT INTO `settings` (`id`, `key`, `value`, `created_at`, `updated_at`, `deleted_at`)
19
+ VALUES (
20
+ uuid_v7(),
21
+ 'color_mode',
22
+ '"system"',
23
+ CAST(unixepoch('subsec') * 1000 AS INTEGER),
24
+ CAST(unixepoch('subsec') * 1000 AS INTEGER),
25
+ NULL
26
+ );
@@ -0,0 +1,28 @@
1
+ CREATE TABLE `providers` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `runtime` text NOT NULL,
4
+ `name` text NOT NULL,
5
+ `official_website` text,
6
+ `remark` text,
7
+ `avatar_mime_type` text,
8
+ `avatar_data` blob,
9
+ `configuration` text NOT NULL,
10
+ `created_at` integer NOT NULL,
11
+ `updated_at` integer NOT NULL,
12
+ `deleted_at` integer,
13
+ CONSTRAINT "providers_id_not_empty" CHECK(length("providers"."id") > 0),
14
+ CONSTRAINT "providers_runtime_valid" CHECK("providers"."runtime" IN ('codex', 'claude-code')),
15
+ CONSTRAINT "providers_name_valid" CHECK(length(trim("providers"."name")) BETWEEN 1 AND 100),
16
+ CONSTRAINT "providers_official_website_valid" CHECK("providers"."official_website" IS NULL OR length("providers"."official_website") <= 2048),
17
+ CONSTRAINT "providers_remark_valid" CHECK("providers"."remark" IS NULL OR length("providers"."remark") <= 2000),
18
+ CONSTRAINT "providers_avatar_valid" CHECK(("providers"."avatar_mime_type" IS NULL AND "providers"."avatar_data" IS NULL)
19
+ OR ("providers"."avatar_mime_type" IN ('image/png', 'image/jpeg', 'image/webp', 'image/svg+xml')
20
+ AND "providers"."avatar_data" IS NOT NULL
21
+ AND length("providers"."avatar_data") BETWEEN 1 AND 2097152)),
22
+ CONSTRAINT "providers_configuration_json" CHECK(json_valid("providers"."configuration")),
23
+ CONSTRAINT "providers_created_at_nonnegative" CHECK("providers"."created_at" >= 0),
24
+ CONSTRAINT "providers_updated_at_valid" CHECK("providers"."updated_at" >= "providers"."created_at"),
25
+ CONSTRAINT "providers_deleted_at_valid" CHECK("providers"."deleted_at" IS NULL OR "providers"."deleted_at" >= "providers"."created_at")
26
+ );
27
+ --> statement-breakpoint
28
+ CREATE INDEX `providers_runtime_created_at_index` ON `providers` (`runtime`,`created_at`);
@@ -0,0 +1,15 @@
1
+ CREATE TABLE `runtimes` (
2
+ `runtime` text PRIMARY KEY NOT NULL,
3
+ `managed` integer DEFAULT false NOT NULL,
4
+ `provider_id` text,
5
+ `applied_at` integer,
6
+ FOREIGN KEY (`provider_id`) REFERENCES `providers`(`id`) ON UPDATE no action ON DELETE restrict,
7
+ CONSTRAINT "runtimes_runtime_valid" CHECK("runtimes"."runtime" IN ('codex', 'claude-code')),
8
+ CONSTRAINT "runtimes_state_valid" CHECK(("runtimes"."managed" = 0 AND "runtimes"."provider_id" IS NULL AND "runtimes"."applied_at" IS NULL) OR ("runtimes"."managed" = 1 AND "runtimes"."applied_at" IS NOT NULL)),
9
+ CONSTRAINT "runtimes_applied_at_nonnegative" CHECK("runtimes"."applied_at" IS NULL OR "runtimes"."applied_at" >= 0)
10
+ );
11
+ --> statement-breakpoint
12
+ INSERT INTO `runtimes` (`runtime`, `managed`, `provider_id`, `applied_at`)
13
+ VALUES
14
+ ('codex', false, NULL, NULL),
15
+ ('claude-code', false, NULL, NULL);
@@ -0,0 +1,103 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "93932b5e-7d6b-4010-8b64-0e2d01cc1756",
5
+ "prevId": "00000000-0000-0000-0000-000000000000",
6
+ "tables": {
7
+ "settings": {
8
+ "name": "settings",
9
+ "columns": {
10
+ "id": {
11
+ "name": "id",
12
+ "type": "text",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "key": {
18
+ "name": "key",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true,
22
+ "autoincrement": false
23
+ },
24
+ "value": {
25
+ "name": "value",
26
+ "type": "text",
27
+ "primaryKey": false,
28
+ "notNull": true,
29
+ "autoincrement": false
30
+ },
31
+ "created_at": {
32
+ "name": "created_at",
33
+ "type": "integer",
34
+ "primaryKey": false,
35
+ "notNull": true,
36
+ "autoincrement": false
37
+ },
38
+ "updated_at": {
39
+ "name": "updated_at",
40
+ "type": "integer",
41
+ "primaryKey": false,
42
+ "notNull": true,
43
+ "autoincrement": false
44
+ },
45
+ "deleted_at": {
46
+ "name": "deleted_at",
47
+ "type": "integer",
48
+ "primaryKey": false,
49
+ "notNull": false,
50
+ "autoincrement": false
51
+ }
52
+ },
53
+ "indexes": {
54
+ "settings_key_unique": {
55
+ "name": "settings_key_unique",
56
+ "columns": [
57
+ "key"
58
+ ],
59
+ "isUnique": true
60
+ }
61
+ },
62
+ "foreignKeys": {},
63
+ "compositePrimaryKeys": {},
64
+ "uniqueConstraints": {},
65
+ "checkConstraints": {
66
+ "settings_id_not_empty": {
67
+ "name": "settings_id_not_empty",
68
+ "value": "length(\"settings\".\"id\") > 0"
69
+ },
70
+ "settings_key_not_empty": {
71
+ "name": "settings_key_not_empty",
72
+ "value": "length(trim(\"settings\".\"key\")) > 0"
73
+ },
74
+ "settings_value_json": {
75
+ "name": "settings_value_json",
76
+ "value": "json_valid(\"settings\".\"value\")"
77
+ },
78
+ "settings_created_at_nonnegative": {
79
+ "name": "settings_created_at_nonnegative",
80
+ "value": "\"settings\".\"created_at\" >= 0"
81
+ },
82
+ "settings_updated_at_valid": {
83
+ "name": "settings_updated_at_valid",
84
+ "value": "\"settings\".\"updated_at\" >= \"settings\".\"created_at\""
85
+ },
86
+ "settings_deleted_at_valid": {
87
+ "name": "settings_deleted_at_valid",
88
+ "value": "\"settings\".\"deleted_at\" IS NULL OR \"settings\".\"deleted_at\" >= \"settings\".\"created_at\""
89
+ }
90
+ }
91
+ }
92
+ },
93
+ "views": {},
94
+ "enums": {},
95
+ "_meta": {
96
+ "schemas": {},
97
+ "tables": {},
98
+ "columns": {}
99
+ },
100
+ "internal": {
101
+ "indexes": {}
102
+ }
103
+ }