proje-react-panel 1.0.5 → 1.0.7

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.
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="EslintConfiguration">
4
+ <option name="fix-on-save" value="true" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="PrettierConfiguration">
4
+ <option name="myConfigurationMode" value="AUTOMATIC" />
5
+ <option name="myRunOnSave" value="true" />
6
+ </component>
7
+ </project>
package/.idea/vcs.xml CHANGED
@@ -2,5 +2,6 @@
2
2
  <project version="4">
3
3
  <component name="VcsDirectoryMappings">
4
4
  <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ <mapping directory="$PROJECT_DIR$/examples/src/types/generated" vcs="Git" />
5
6
  </component>
6
7
  </project>
package/README.md CHANGED
@@ -1,24 +1,32 @@
1
1
  # React Panel
2
2
 
3
3
  ## Overview
4
- React Panel is a web application built using as the backend framework and React for the frontend. It features a customizable sidebar and supports CRUD operations on entities. This project is designed to be a foundational template for building admin panels or other web-based interfaces.
4
+ React Panel is a web application built using as the backend framework and React for the frontend. It features a customizable sidebar and supports CRUD operations on entities. This project is designed to be a foundational template for building admin panels or other web-based interfaces.
5
5
 
6
6
  ---
7
-
8
7
  ## Features
9
8
  - **Entity CRUD Operations**: Easily create, read, update, and delete entities through the panel.
10
9
  - **Sidebar Navigation**: The application includes a sidebar for easy navigation, which is fully customizable.
11
10
  - **Single Design Template**: Comes with a default design that can be customized to fit your needs.
12
-
11
+ - **NestJS Integration**: It's designed especially for NestJS applications.
12
+ - **Class-validator Support**: If you work with class-validator, you can easily copy-paste entity definitions to create tables and forms based on your entities.
13
13
  ---
14
14
 
15
15
  ## Getting Started
16
- ### Prerequisites
17
- - Node.js (LTS version recommended)
18
- - npm or yarn package manager
19
- - A supported database (e.g., PostgreSQL, MySQL, MongoDB)
20
-
21
16
  ### Installation
22
- 1. Clone the repository:
17
+ 1. Install dependencies:
23
18
  ```bash
24
- git clone <repository-url>
19
+ yarn add
20
+ ```
21
+
22
+ ### TypeScript Configuration
23
+ Add these options to your `tsconfig.json` file:
24
+ ```json
25
+ {
26
+ "compilerOptions": {
27
+ "experimentalDecorators": true,
28
+ "strictPropertyInitialization": false
29
+ // other compiler options...
30
+ }
31
+ }
32
+ ```
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- export declare function Layout({ children, noSidebar, }: {
2
+ export declare function Layout({ children, }: {
3
3
  children?: React.ReactNode;
4
- noSidebar?: boolean;
5
4
  }): React.JSX.Element;
package/dist/index.cjs.js CHANGED
@@ -9,4 +9,4 @@
9
9
  *
10
10
  * @license MIT
11
11
  */
12
- function o(e,t){if(!1===e||null==e)throw new Error(t)}function s(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function l({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 u(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 c(e,t,r="/"){return function(e,t,r,n){let a="string"==typeof t?u(t):t,i=_(a.pathname||"/",r);if(null==i)return null;let o=d(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let r=e.length===t.length&&e.slice(0,-1).every(((e,r)=>e===t[r]));return r?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(o);let s=null;for(let e=0;null==s&&e<o.length;++e){let t=S(i);s=E(o[e],t,n)}return s}(e,t,r,!1)}function d(e,t=[],r=[],n=""){let a=(e,a,i)=>{let s={relativePath:void 0===i?e.path||"":i,caseSensitive:!0===e.caseSensitive,childrenIndex:a,route:e};s.relativePath.startsWith("/")&&(o(s.relativePath.startsWith(n),`Absolute route path "${s.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),s.relativePath=s.relativePath.slice(n.length));let l=F([n,s.relativePath]),u=r.concat(s);e.children&&e.children.length>0&&(o(!0!==e.index,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),d(e.children,t,u,l)),(null!=e.path||e.index)&&t.push({path:l,score:w(l,e.index),routesMeta:u})};return e.forEach(((e,t)=>{if(""!==e.path&&e.path?.includes("?"))for(let r of f(e.path))a(e,t,r);else a(e,t)})),t}function f(e){let t=e.split("/");if(0===t.length)return[];let[r,...n]=t,a=r.endsWith("?"),i=r.replace(/\?$/,"");if(0===n.length)return a?[i,""]:[i];let o=f(n.join("/")),s=[];return s.push(...o.map((e=>""===e?i:[i,e].join("/")))),a&&s.push(...o),s.map((t=>e.startsWith("/")&&""===t?"/":t))}!function(){if(a)return i;a=1,Object.defineProperty(i,"__esModule",{value:!0}),i.parse=function(e,t){const r=new s,n=e.length;if(n<2)return r;const a=t?.decode||c;let i=0;do{const t=e.indexOf("=",i);if(-1===t)break;const o=e.indexOf(";",i),s=-1===o?n:o;if(t>s){i=e.lastIndexOf(";",t-1)+1;continue}const c=l(e,i,t),d=u(e,t,c),f=e.slice(c,d);if(void 0===r[f]){let n=l(e,t+1,s),i=u(e,s,n);const o=a(e.slice(n,i));r[f]=o}i=s+1}while(i<n);return r},i.serialize=function(a,i,s){const l=s?.encode||encodeURIComponent;if(!e.test(a))throw new TypeError(`argument name is invalid: ${a}`);const u=l(i);if(!t.test(u))throw new TypeError(`argument val is invalid: ${i}`);let c=a+"="+u;if(!s)return c;if(void 0!==s.maxAge){if(!Number.isInteger(s.maxAge))throw new TypeError(`option maxAge is invalid: ${s.maxAge}`);c+="; Max-Age="+s.maxAge}if(s.domain){if(!r.test(s.domain))throw new TypeError(`option domain is invalid: ${s.domain}`);c+="; Domain="+s.domain}if(s.path){if(!n.test(s.path))throw new TypeError(`option path is invalid: ${s.path}`);c+="; Path="+s.path}if(s.expires){if(!function(e){return"[object Date]"===o.call(e)}(s.expires)||!Number.isFinite(s.expires.valueOf()))throw new TypeError(`option expires is invalid: ${s.expires}`);c+="; Expires="+s.expires.toUTCString()}s.httpOnly&&(c+="; HttpOnly");s.secure&&(c+="; Secure");s.partitioned&&(c+="; Partitioned");if(s.priority){switch("string"==typeof s.priority?s.priority.toLowerCase():void 0){case"low":c+="; Priority=Low";break;case"medium":c+="; Priority=Medium";break;case"high":c+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${s.priority}`)}}if(s.sameSite){switch("string"==typeof s.sameSite?s.sameSite.toLowerCase():s.sameSite){case!0:case"strict":c+="; SameSite=Strict";break;case"lax":c+="; SameSite=Lax";break;case"none":c+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${s.sameSite}`)}}return c};const e=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,t=/^[\u0021-\u003A\u003C-\u007E]*$/,r=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,n=/^[\u0020-\u003A\u003D-\u007E]*$/,o=Object.prototype.toString,s=(()=>{const e=function(){};return e.prototype=Object.create(null),e})();function l(e,t,r){do{const r=e.charCodeAt(t);if(32!==r&&9!==r)return t}while(++t<r);return r}function u(e,t,r){for(;t>r;){const r=e.charCodeAt(--t);if(32!==r&&9!==r)return t+1}return r}function c(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch(t){return e}}}();var m=/^:[\w-]+$/,h=3,p=2,y=1,v=10,g=-2,b=e=>"*"===e;function w(e,t){let r=e.split("/"),n=r.length;return r.some(b)&&(n+=g),t&&(n+=p),r.filter((e=>!b(e))).reduce(((e,t)=>e+(m.test(t)?h:""===t?y:v)),n)}function E(e,t,r=!1){let{routesMeta:n}=e,a={},i="/",o=[];for(let e=0;e<n.length;++e){let s=n[e],l=e===n.length-1,u="/"===i?t:t.slice(i.length)||"/",c=x({path:s.relativePath,caseSensitive:s.caseSensitive,end:l},u),d=s.route;if(!c&&l&&r&&!n[n.length-1].route.index&&(c=x({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},u)),!c)return null;Object.assign(a,c.params),o.push({params:a,pathname:F([i,c.pathname]),pathnameBase:D(F([i,c.pathnameBase])),route:d}),"/"!==c.pathnameBase&&(i=F([i,c.pathnameBase]))}return o}function x(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=function(e,t=!1,r=!0){s("*"===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=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,r)=>(n.push({paramName:t,isOptional:null!=r}),r?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(n.push({paramName:"*"}),a+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":""!==e&&"/"!==e&&(a+="(?:(?=\\/|$))");let i=new RegExp(a,t?void 0:"i");return[i,n]}(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let i=a[0],o=i.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:n.reduce(((e,{paramName:t,isOptional:r},n)=>{if("*"===t){let e=l[n]||"";o=i.slice(0,i.length-e.length).replace(/(.)\/+$/,"$1")}const a=l[n];return e[t]=r&&!a?void 0:(a||"").replace(/%2F/g,"/"),e}),{}),pathname:i,pathnameBase:o,pattern:e}}function S(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return s(!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}}function _(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 A(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 C(e){let t=function(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}(e);return t.map(((e,r)=>r===t.length-1?e.pathname:e.pathnameBase))}function k(e,t,r,n=!1){let a;"string"==typeof e?a=u(e):(a={...e},o(!a.pathname||!a.pathname.includes("?"),A("?","pathname","search",a)),o(!a.pathname||!a.pathname.includes("#"),A("#","pathname","hash",a)),o(!a.search||!a.search.includes("#"),A("#","search","hash",a)));let i,s=""===e||""===a.pathname,l=s?"/":a.pathname;if(null==l)i=r;else{let e=t.length-1;if(!n&&l.startsWith("..")){let t=l.split("/");for(;".."===t[0];)t.shift(),e-=1;a.pathname=t.join("/")}i=e>=0?t[e]:"/"}let c=function(e,t="/"){let{pathname:r,search:n="",hash:a=""}="string"==typeof e?u(e):e,i=r?r.startsWith("/")?r:function(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)})),r.length>1?r.join("/"):"/"}(r,t):t;return{pathname:i,search:V(n),hash:$(a)}}(a,i),d=l&&"/"!==l&&l.endsWith("/"),f=(s||"."===l)&&r.endsWith("/");return c.pathname.endsWith("/")||!d&&!f||(c.pathname+="/"),c}var F=e=>e.join("/").replace(/\/\/+/g,"/"),D=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),V=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",$=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";var R=["POST","PUT","PATCH","DELETE"];new Set(R);var T=["GET",...R];new Set(T);var N=r.createContext(null);N.displayName="DataRouter";var L=r.createContext(null);L.displayName="DataRouterState";var O=r.createContext({isTransitioning:!1});O.displayName="ViewTransition",r.createContext(new Map).displayName="Fetchers",r.createContext(null).displayName="Await";var j=r.createContext(null);j.displayName="Navigation";var P=r.createContext(null);P.displayName="Location";var M=r.createContext({outlet:null,matches:[],isDataRoute:!1});M.displayName="Route";var U=r.createContext(null);function B(){return null!=r.useContext(P)}function W(){return o(B(),"useLocation() may be used only in the context of a <Router> component."),r.useContext(P).location}U.displayName="RouteError";var I="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function z(e){r.useContext(j).static||r.useLayoutEffect(e)}function H(){let{isDataRoute:e}=r.useContext(M);return e?function(){let{router:e}=function(e){let t=r.useContext(N);return o(t,ee(e)),t}("useNavigate"),t=te("useNavigate"),n=r.useRef(!1);return z((()=>{n.current=!0})),r.useCallback((async(r,a={})=>{s(n.current,I),n.current&&("number"==typeof r?e.navigate(r):await e.navigate(r,{fromRouteId:t,...a}))}),[e,t])}():function(){o(B(),"useNavigate() may be used only in the context of a <Router> component.");let e=r.useContext(N),{basename:t,navigator:n}=r.useContext(j),{matches:a}=r.useContext(M),{pathname:i}=W(),l=JSON.stringify(C(a)),u=r.useRef(!1);return z((()=>{u.current=!0})),r.useCallback(((r,a={})=>{if(s(u.current,I),!u.current)return;if("number"==typeof r)return void n.go(r);let o=k(r,JSON.parse(l),i,"path"===a.relative);null==e&&"/"!==t&&(o.pathname="/"===o.pathname?t:F([t,o.pathname])),(a.replace?n.replace:n.push)(o,a.state,a)}),[t,n,l,i,e])}()}var J=r.createContext(null);function q(){let{matches:e}=r.useContext(M),t=e[e.length-1];return t?t.params:{}}function K(e,{relative:t}={}){let{matches:n}=r.useContext(M),{pathname:a}=W(),i=JSON.stringify(C(n));return r.useMemo((()=>k(e,JSON.parse(i),a,"path"===t)),[e,i,a,t])}function Y(e,t,n,a){o(B(),"useRoutes() may be used only in the context of a <Router> component.");let i,{navigator:l,static:u}=r.useContext(j),{matches:d}=r.useContext(M),f=d[d.length-1],m=f?f.params:{},h=f?f.pathname:"/",p=f?f.pathnameBase:"/",y=f&&f.route;{let e=y&&y.path||"";ne(h,!y||e.endsWith("*")||e.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.\n\nPlease change the parent <Route path="${e}"> to <Route path="${"/"===e?"*":`${e}/*`}">.`)}i=W();let v=i.pathname||"/",g=v;if("/"!==p){let e=p.replace(/^\//,"").split("/");g="/"+v.replace(/^\//,"").split("/").slice(e.length).join("/")}let b=!u&&n&&n.matches&&n.matches.length>0?n.matches:c(e,{pathname:g});s(y||null!=b,`No routes matched location "${i.pathname}${i.search}${i.hash}" `),s(null==b||void 0!==b[b.length-1].route.element||void 0!==b[b.length-1].route.Component||void 0!==b[b.length-1].route.lazy,`Matched leaf route at location "${i.pathname}${i.search}${i.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let w=function(e,t=[],n=null){if(null==e){if(!n)return null;if(n.errors)e=n.matches;else{if(0!==t.length||n.initialized||!(n.matches.length>0))return null;e=n.matches}}let a=e,i=n?.errors;if(null!=i){let e=a.findIndex((e=>e.route.id&&void 0!==i?.[e.route.id]));o(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,l=-1;if(n)for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(l=e),t.route.id){let{loaderData:e,errors:r}=n,i=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!r||void 0===r[t.route.id]);if(t.route.lazy||i){s=!0,a=l>=0?a.slice(0,l+1):[a[0]];break}}}return a.reduceRight(((e,o,u)=>{let c,d=!1,f=null,m=null;n&&(c=i&&o.route.id?i[o.route.id]:void 0,f=o.route.errorElement||X,s&&(l<0&&0===u?(ne("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,m=null):l===u&&(d=!0,m=o.route.hydrateFallbackElement||null)));let h=t.concat(a.slice(0,u+1)),p=()=>{let t;return t=c?f:d?m:o.route.Component?r.createElement(o.route.Component,null):o.route.element?o.route.element:e,r.createElement(Z,{match:o,routeContext:{outlet:e,matches:h,isDataRoute:null!=n},children:t})};return n&&(o.route.ErrorBoundary||o.route.errorElement||0===u)?r.createElement(Q,{location:n.location,revalidation:n.revalidation,component:f,error:c,children:p(),routeContext:{outlet:null,matches:h,isDataRoute:!0}}):p()}),null)}(b&&b.map((e=>Object.assign({},e,{params:Object.assign({},m,e.params),pathname:F([p,l.encodeLocation?l.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?p:F([p,l.encodeLocation?l.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),d,n,a);return w}function G(){let e=function(){let e=r.useContext(U),t=function(e){let t=r.useContext(L);return o(t,ee(e)),t}("useRouteError"),n=te("useRouteError");if(void 0!==e)return e;return t.errors?.[n]}(),t=function(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:a},s={padding:"2px 4px",backgroundColor:a},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=r.createElement(r.Fragment,null,r.createElement("p",null,"💿 Hey developer 👋"),r.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",r.createElement("code",{style:s},"ErrorBoundary")," or"," ",r.createElement("code",{style:s},"errorElement")," prop on your route.")),r.createElement(r.Fragment,null,r.createElement("h2",null,"Unexpected Application Error!"),r.createElement("h3",{style:{fontStyle:"italic"}},t),n?r.createElement("pre",{style:i},n):null,l)}var X=r.createElement(G,null),Q=class extends r.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}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){console.error("React Router caught the following error during render",e,t)}render(){return void 0!==this.state.error?r.createElement(M.Provider,{value:this.props.routeContext},r.createElement(U.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Z({routeContext:e,match:t,children:n}){let a=r.useContext(N);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),r.createElement(M.Provider,{value:e},n)}function ee(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function te(e){let t=function(e){let t=r.useContext(M);return o(t,ee(e)),t}(e),n=t.matches[t.matches.length-1];return o(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}var re={};function ne(e,t,r){t||re[e]||(re[e]=!0,s(!1,r))}function ae(e){return function(e){let t=r.useContext(M).outlet;return t?r.createElement(J.Provider,{value:e},t):t}(e.context)}function ie(e){o(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}r.memo((function({routes:e,future:t,state:r}){return Y(e,0,r,t)}));var oe="get",se="application/x-www-form-urlencoded";function le(e){return null!=e&&"string"==typeof e.tagName}var ue=null;var ce=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function de(e){return null==e||ce.has(e)?e:(s(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${se}"`),null)}function fe(e,t){let r,n,a,i,o;if(le(s=e)&&"form"===s.tagName.toLowerCase()){let o=e.getAttribute("action");n=o?_(o,t):null,r=e.getAttribute("method")||oe,a=de(e.getAttribute("enctype"))||se,i=new FormData(e)}else if(function(e){return le(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return le(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let o=e.form;if(null==o)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||o.getAttribute("action");if(n=s?_(s,t):null,r=e.getAttribute("formmethod")||o.getAttribute("method")||oe,a=de(e.getAttribute("formenctype"))||de(o.getAttribute("enctype"))||se,i=new FormData(o,e),!function(){if(null===ue)try{new FormData(document.createElement("form"),0),ue=!1}catch(e){ue=!0}return ue}()){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(le(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=oe,n=null,a=se,o=e}var s;return i&&"text/plain"===a&&(o=i,i=void 0),{action:n,method:r.toLowerCase(),encType:a,formData:i,body:o}}function me(e,t){if(!1===e||null==e)throw new Error(t)}function he(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 pe(e,t,r){return function(e,t){let r=new Set;return new Set(t),e.reduce(((e,t)=>{let n=JSON.stringify(function(e){let t={},r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}(t));return r.has(n)||(r.add(n),e.push({key:n,link:t})),e}),[])}((await Promise.all(e.map((async e=>{let n=t.routes[e.route.id];if(n){let e=await async function(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((()=>{}))}}(n,r);return e.links?e.links():[]}return[]})))).flat(1).filter(he).filter((e=>"stylesheet"===e.rel||"preload"===e.rel)).map((e=>"stylesheet"===e.rel?{...e,rel:"prefetch",as:"style"}:{...e,rel:"prefetch"})))}function ye(e,t,r,n,a,i){let o=(e,t)=>!r[t]||e.route.id!==r[t].route.id,s=(e,t)=>r[t].pathname!==e.pathname||r[t].route.path?.endsWith("*")&&r[t].params["*"]!==e.params["*"];return"assets"===i?t.filter(((e,t)=>o(e,t)||s(e,t))):"data"===i?t.filter(((t,i)=>{let l=n.routes[t.route.id];if(!l||!l.hasLoader)return!1;if(o(t,i)||s(t,i))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})):[]}function ve(e,t,{includeHydrateFallback:r}={}){return n=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),[...new Set(n)];var n}function ge(){let e=r.useContext(N);return me(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}var be=r.createContext(void 0);function we(){let e=r.useContext(be);return me(e,"You must render this element inside a <HydratedRouter> element"),e}function Ee(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function xe({page:e,...t}){let{router:n}=ge(),a=r.useMemo((()=>c(n.routes,e,n.basename)),[n.routes,e,n.basename]);return a?r.createElement(Se,{page:e,matches:a,...t}):null}function Se({page:e,matches:t,...n}){let a=W(),{manifest:i,routeModules:o}=we(),{basename:s}=ge(),{loaderData:l,matches:u}=function(){let e=r.useContext(L);return me(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}(),c=r.useMemo((()=>ye(e,t,u,i,a,"data")),[e,t,u,i,a]),d=r.useMemo((()=>ye(e,t,u,i,a,"assets")),[e,t,u,i,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=i.routes[e.route.id];t&&t.hasLoader&&(!c.some((t=>t.route.id===e.route.id))&&e.route.id in l&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?n=!0:r.add(e.route.id))})),0===r.size)return[];let u=function(e,t){let r="string"==typeof e?new URL(e,"undefined"==typeof window?"server://singlefetch/":window.location.origin):e;return"/"===r.pathname?r.pathname="_root.data":t&&"/"===_(r.pathname,t)?r.pathname=`${t.replace(/\/$/,"")}/_root.data`:r.pathname=`${r.pathname.replace(/\/$/,"")}.data`,r}(e,s);return n&&r.size>0&&u.searchParams.set("_routes",t.filter((e=>r.has(e.route.id))).map((e=>e.route.id)).join(",")),[u.pathname+u.search]}),[s,l,a,i,c,t,e,o]),m=r.useMemo((()=>ve(d,i)),[d,i]),h=function(e){let{manifest:t,routeModules:n}=we(),[a,i]=r.useState([]);return r.useEffect((()=>{let r=!1;return pe(e,t,n).then((e=>{r||i(e)})),()=>{r=!0}}),[e,t,n]),a}(d);return r.createElement(r.Fragment,null,f.map((e=>r.createElement("link",{key:e,rel:"prefetch",as:"fetch",href:e,...n}))),m.map((e=>r.createElement("link",{key:e,rel:"modulepreload",href:e,...n}))),h.map((({key:e,link:t})=>r.createElement("link",{key:e,...t}))))}function _e(...e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}be.displayName="FrameworkContext";var Ae="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;try{Ae&&(window.__reactRouterVersion="7.3.0")}catch(e){}var Ce=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ke=r.forwardRef((function({onClick:e,discover:t="render",prefetch:n="none",relative:a,reloadDocument:i,replace:u,state:c,target:d,to:f,preventScrollReset:m,viewTransition:h,...p},y){let v,{basename:g}=r.useContext(j),b="string"==typeof f&&Ce.test(f),w=!1;if("string"==typeof f&&b&&(v=f,Ae))try{let e=new URL(window.location.href),t=f.startsWith("//")?new URL(e.protocol+f):new URL(f),r=_(t.pathname,g);t.origin===e.origin&&null!=r?f=r+t.search+t.hash:w=!0}catch(e){s(!1,`<Link to="${f}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let E=function(e,{relative:t}={}){o(B(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=r.useContext(j),{hash:i,pathname:s,search:l}=K(e,{relative:t}),u=s;return"/"!==n&&(u="/"===s?n:F([n,s])),a.createHref({pathname:u,search:l,hash:i})}(f,{relative:a}),[x,S,A]=function(e,t){let n=r.useContext(be),[a,i]=r.useState(!1),[o,s]=r.useState(!1),{onFocus:l,onBlur:u,onMouseEnter:c,onMouseLeave:d,onTouchStart:f}=t,m=r.useRef(null);r.useEffect((()=>{if("render"===e&&s(!0),"viewport"===e){let e=new IntersectionObserver((e=>{e.forEach((e=>{s(e.isIntersecting)}))}),{threshold:.5});return m.current&&e.observe(m.current),()=>{e.disconnect()}}}),[e]),r.useEffect((()=>{if(a){let e=setTimeout((()=>{s(!0)}),100);return()=>{clearTimeout(e)}}}),[a]);let h=()=>{i(!0)},p=()=>{i(!1),s(!1)};return n?"intent"!==e?[o,m,{}]:[o,m,{onFocus:Ee(l,h),onBlur:Ee(u,p),onMouseEnter:Ee(c,h),onMouseLeave:Ee(d,p),onTouchStart:Ee(f,h)}]:[!1,m,{}]}(n,p),C=function(e,{target:t,replace:n,state:a,preventScrollReset:i,relative:o,viewTransition:s}={}){let u=H(),c=W(),d=K(e,{relative:o});return r.useCallback((r=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(r,t)){r.preventDefault();let t=void 0!==n?n:l(c)===l(d);u(e,{replace:t,state:a,preventScrollReset:i,relative:o,viewTransition:s})}}),[c,u,d,n,a,t,e,i,o,s])}(f,{replace:u,state:c,target:d,preventScrollReset:m,relative:a,viewTransition:h});let k=r.createElement("a",{...p,...A,href:v||E,onClick:w||i?e:function(t){e&&e(t),t.defaultPrevented||C(t)},ref:_e(y,S),target:d,"data-discover":b||"render"!==t?void 0:"true"});return x&&!b?r.createElement(r.Fragment,null,k,r.createElement(xe,{page:E})):k}));function Fe(e){let t=r.useContext(N);return o(t,function(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}(e)),t}ke.displayName="Link",r.forwardRef((function({"aria-current":e="page",caseSensitive:t=!1,className:n="",end:a=!1,style:i,to:s,viewTransition:l,children:u,...c},d){let f=K(s,{relative:c.relative}),m=W(),h=r.useContext(L),{navigator:p,basename:y}=r.useContext(j),v=null!=h&&function(e,t={}){let n=r.useContext(O);o(null!=n,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=Fe("useViewTransitionState"),i=K(e,{relative:t.relative});if(!n.isTransitioning)return!1;let s=_(n.currentLocation.pathname,a)||n.currentLocation.pathname,l=_(n.nextLocation.pathname,a)||n.nextLocation.pathname;return null!=x(i.pathname,l)||null!=x(i.pathname,s)}(f)&&!0===l,g=p.encodeLocation?p.encodeLocation(f).pathname:f.pathname,b=m.pathname,w=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;t||(b=b.toLowerCase(),w=w?w.toLowerCase():null,g=g.toLowerCase()),w&&y&&(w=_(w,y)||w);const E="/"!==g&&g.endsWith("/")?g.length-1:g.length;let S,A=b===g||!a&&b.startsWith(g)&&"/"===b.charAt(E),C=null!=w&&(w===g||!a&&w.startsWith(g)&&"/"===w.charAt(g.length)),k={isActive:A,isPending:C,isTransitioning:v},F=A?e:void 0;S="function"==typeof n?n(k):[n,A?"active":null,C?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let D="function"==typeof i?i(k):i;return r.createElement(ke,{...c,"aria-current":F,className:S,ref:d,style:D,to:s,viewTransition:l},"function"==typeof u?u(k):u)})).displayName="NavLink",r.forwardRef((({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:a,replace:i,state:s,method:u=oe,action:c,onSubmit:d,relative:f,preventScrollReset:m,viewTransition:h,...p},y)=>{let v=function(){let{router:e}=Fe("useSubmit"),{basename:t}=r.useContext(j),n=te("useRouteId");return r.useCallback((async(r,a={})=>{let{action:i,method:o,encType:s,formData:l,body:u}=fe(r,t);if(!1===a.navigate){let t=a.fetcherKey||Ve();await e.fetch(t,n,a.action||i,{preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||o,formEncType:a.encType||s,flushSync:a.flushSync})}else await e.navigate(a.action||i,{preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||o,formEncType:a.encType||s,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})}),[e,t,n])}(),g=function(e,{relative:t}={}){let{basename:n}=r.useContext(j),a=r.useContext(M);o(a,"useFormAction must be used inside a RouteContext");let[i]=a.matches.slice(-1),s={...K(e||".",{relative:t})},u=W();if(null==e){s.search=u.search;let e=new URLSearchParams(s.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();s.search=r?`?${r}`:""}}e&&"."!==e||!i.route.index||(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index");"/"!==n&&(s.pathname="/"===s.pathname?n:F([n,s.pathname]));return l(s)}(c,{relative:f}),b="get"===u.toLowerCase()?"get":"post",w="string"==typeof c&&Ce.test(c);return r.createElement("form",{ref:y,method:b,action:g,onSubmit:a?d:e=>{if(d&&d(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,a=r?.getAttribute("formmethod")||u;v(r||e.currentTarget,{fetcherKey:t,method:a,navigate:n,replace:i,state:s,relative:f,preventScrollReset:m,viewTransition:h})},...p,"data-discover":w||"render"!==e?void 0:"true"})})).displayName="Form";var De=0,Ve=()=>`__${String(++De)}__`;function $e(){const[t,r]=e.useState(!0);return e.createElement("div",{className:"sidebar "+(t?"open":"closed")},e.createElement("button",{className:"toggle-button",onClick:()=>r(!t)},t?"<":">"),e.createElement("nav",{className:"nav-links"},e.createElement(ke,{to:"/"},"Home"),e.createElement(ke,{to:"/accounts"},"Accounts"),e.createElement(ke,{to:"/maps"},"Maps"),e.createElement("div",{className:"bottom-link"},e.createElement(ke,{to:"/settings"},"Settings"))))}function Re({children:t,noSidebar:r=!1}){return e.createElement("div",{className:"layout"},!r&&e.createElement($e,null),e.createElement("main",{className:"content"},t||e.createElement(ae,null)))}new TextEncoder;var Te=e=>"checkbox"===e.type,Ne=e=>e instanceof Date,Le=e=>null==e;const Oe=e=>"object"==typeof e;var je=e=>!Le(e)&&!Array.isArray(e)&&Oe(e)&&!Ne(e),Pe="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function Me(e){let t;const r=Array.isArray(e),n="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(Pe&&(e instanceof Blob||n)||!r&&!je(e))return e;if(t=r?[]:{},r||(e=>{const t=e.constructor&&e.constructor.prototype;return je(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const r in e)e.hasOwnProperty(r)&&(t[r]=Me(e[r]));else t=e}return t}var Ue=e=>Array.isArray(e)?e.filter(Boolean):[],Be=e=>void 0===e,We=(e,t,r)=>{if(!t||!je(e))return r;const n=Ue(t.split(/[,[\].]+?/)).reduce(((e,t)=>Le(e)?e:e[t]),e);return Be(n)||n===e?Be(e[t])?r:e[t]:n},Ie=e=>"boolean"==typeof e,ze=e=>/^\w*$/.test(e),He=e=>Ue(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Je=(e,t,r)=>{let n=-1;const a=ze(t)?[t]:He(t),i=a.length,o=i-1;for(;++n<i;){const t=a[n];let i=r;if(n!==o){const r=e[t];i=je(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=i,e=e[t]}return e};const qe="blur",Ke="focusout",Ye="onBlur",Ge="onChange",Xe="onSubmit",Qe="onTouched",Ze="all",et="max",tt="min",rt="maxLength",nt="minLength",at="pattern",it="required",ot="validate";e.createContext(null);var st=e=>je(e)&&!Object.keys(e).length,lt=e=>Array.isArray(e)?e:[e];var ut=e=>"string"==typeof e,ct=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},dt=e=>({isOnSubmit:!e||e===Xe,isOnBlur:e===Ye,isOnChange:e===Ge,isOnAll:e===Ze,isOnTouch:e===Qe}),ft=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const mt=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const r=We(e,a);if(r){const{_f:e,...i}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],a)&&!n)return!0;if(e.ref&&t(e.ref,e.name)&&!n)return!0;if(mt(i,t))break}else if(je(i)&&mt(i,t))break}}};var ht=(e,t,r)=>{const n=lt(We(e,r));return Je(n,"root",t[r]),Je(e,r,n),e},pt=e=>"file"===e.type,yt=e=>"function"==typeof e,vt=e=>{if(!Pe)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},gt=e=>ut(e),bt=e=>"radio"===e.type,wt=e=>e instanceof RegExp;const Et={value:!1,isValid:!1},xt={value:!0,isValid:!0};var St=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Be(e[0].attributes.value)?Be(e[0].value)||""===e[0].value?xt:{value:e[0].value,isValid:!0}:xt:Et}return Et};const _t={isValid:!1,value:null};var At=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),_t):_t;function Ct(e,t,r="validate"){if(gt(e)||Array.isArray(e)&&e.every(gt)||Ie(e)&&!e)return{type:r,message:gt(e)?e:"",ref:t}}var kt=e=>je(e)&&!wt(e)?e:{value:e,message:""},Ft=async(e,t,r,n,a,i)=>{const{ref:o,refs:s,required:l,maxLength:u,minLength:c,min:d,max:f,pattern:m,validate:h,name:p,valueAsNumber:y,mount:v}=e._f,g=We(r,p);if(!v||t.has(p))return{};const b=s?s[0]:o,w=e=>{a&&b.reportValidity&&(b.setCustomValidity(Ie(e)?"":e||""),b.reportValidity())},E={},x=bt(o),S=Te(o),_=x||S,A=(y||pt(o))&&Be(o.value)&&Be(g)||vt(o)&&""===o.value||""===g||Array.isArray(g)&&!g.length,C=ct.bind(null,p,n,E),k=(e,t,r,n=rt,a=nt)=>{const i=e?t:r;E[p]={type:e?n:a,message:i,ref:o,...C(e?n:a,i)}};if(i?!Array.isArray(g)||!g.length:l&&(!_&&(A||Le(g))||Ie(g)&&!g||S&&!St(s).isValid||x&&!At(s).isValid)){const{value:e,message:t}=gt(l)?{value:!!l,message:l}:kt(l);if(e&&(E[p]={type:it,message:t,ref:b,...C(it,t)},!n))return w(t),E}if(!(A||Le(d)&&Le(f))){let e,t;const r=kt(f),a=kt(d);if(Le(g)||isNaN(g)){const n=o.valueAsDate||new Date(g),i=e=>new Date((new Date).toDateString()+" "+e),s="time"==o.type,l="week"==o.type;ut(r.value)&&g&&(e=s?i(g)>i(r.value):l?g>r.value:n>new Date(r.value)),ut(a.value)&&g&&(t=s?i(g)<i(a.value):l?g<a.value:n<new Date(a.value))}else{const n=o.valueAsNumber||(g?+g:g);Le(r.value)||(e=n>r.value),Le(a.value)||(t=n<a.value)}if((e||t)&&(k(!!e,r.message,a.message,et,tt),!n))return w(E[p].message),E}if((u||c)&&!A&&(ut(g)||i&&Array.isArray(g))){const e=kt(u),t=kt(c),r=!Le(e.value)&&g.length>+e.value,a=!Le(t.value)&&g.length<+t.value;if((r||a)&&(k(r,e.message,t.message),!n))return w(E[p].message),E}if(m&&!A&&ut(g)){const{value:e,message:t}=kt(m);if(wt(e)&&!g.match(e)&&(E[p]={type:at,message:t,ref:o,...C(at,t)},!n))return w(t),E}if(h)if(yt(h)){const e=Ct(await h(g,r),b);if(e&&(E[p]={...e,...C(ot,e.message)},!n))return w(e.message),E}else if(je(h)){let e={};for(const t in h){if(!st(e)&&!n)break;const a=Ct(await h[t](g,r),b,t);a&&(e={...a,...C(t,a.message)},w(a.message),n&&(E[p]=e))}if(!st(e)&&(E[p]={ref:b,...e},!n))return E}return w(!0),E};function Dt(e,t){const r=Array.isArray(t)?t:ze(t)?[t]:He(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Be(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,i=r[a];return n&&delete n[i],0!==a&&(je(n)&&st(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!Be(e[t]))return!1;return!0}(n))&&Dt(e,r.slice(0,-1)),e}var Vt=()=>{let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}},$t=e=>Le(e)||!Oe(e);function Rt(e,t){if($t(e)||$t(t))return e===t;if(Ne(e)&&Ne(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const a of r){const r=e[a];if(!n.includes(a))return!1;if("ref"!==a){const e=t[a];if(Ne(r)&&Ne(e)||je(r)&&je(e)||Array.isArray(r)&&Array.isArray(e)?!Rt(r,e):r!==e)return!1}}return!0}var Tt=e=>"select-multiple"===e.type,Nt=e=>vt(e)&&e.isConnected,Lt=e=>{for(const t in e)if(yt(e[t]))return!0;return!1};function Ot(e,t={}){const r=Array.isArray(e);if(je(e)||r)for(const r in e)Array.isArray(e[r])||je(e[r])&&!Lt(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Ot(e[r],t[r])):Le(e[r])||(t[r]=!0);return t}function jt(e,t,r){const n=Array.isArray(e);if(je(e)||n)for(const n in e)Array.isArray(e[n])||je(e[n])&&!Lt(e[n])?Be(t)||$t(r[n])?r[n]=Array.isArray(e[n])?Ot(e[n],[]):{...Ot(e[n])}:jt(e[n],Le(t)?{}:t[n],r[n]):r[n]=!Rt(e[n],t[n]);return r}var Pt=(e,t)=>jt(e,t,Ot(t)),Mt=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Be(e)?e:t?""===e?NaN:e?+e:e:r&&ut(e)?new Date(e):n?n(e):e;function Ut(e){const t=e.ref;return pt(t)?t.files:bt(t)?At(e.refs).value:Tt(t)?[...t.selectedOptions].map((({value:e})=>e)):Te(t)?St(e.refs).value:Mt(Be(t.value)?e.ref.value:t.value,e)}var Bt=e=>Be(e)?e:wt(e)?e.source:je(e)?wt(e.value)?e.value.source:e.value:e;const Wt="AsyncFunction";function It(e,t,r){const n=We(e,r);if(n||ze(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),i=We(t,n),o=We(e,n);if(i&&!Array.isArray(i)&&r!==n)return{name:r};if(o&&o.type)return{name:n,error:o};a.pop()}return{name:r}}const zt={mode:Xe,reValidateMode:Ge,shouldFocusError:!0};function Ht(e={}){let t,r={...zt,...e},n={submitCount:0,isDirty:!1,isLoading:yt(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},i=(je(r.defaultValues)||je(r.values))&&Me(r.defaultValues||r.values)||{},o=r.shouldUnregister?{}:Me(i),s={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},u=0;const c={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={values:Vt(),array:Vt(),state:Vt()},f=dt(r.mode),m=dt(r.reValidateMode),h=r.criteriaMode===Ze,p=async e=>{if(!r.disabled&&(c.isValid||e)){const e=r.resolver?st((await w()).errors):await E(a,!0);e!==n.isValid&&d.state.next({isValid:e})}},y=(e,t)=>{r.disabled||!c.isValidating&&!c.validatingFields||((e||Array.from(l.mount)).forEach((e=>{e&&(t?Je(n.validatingFields,e,t):Dt(n.validatingFields,e))})),d.state.next({validatingFields:n.validatingFields,isValidating:!st(n.validatingFields)}))},v=(e,t,r,n)=>{const l=We(a,e);if(l){const a=We(o,e,Be(r)?We(i,e):r);Be(a)||n&&n.defaultChecked||t?Je(o,e,t?a:Ut(l._f)):_(e,a),s.mount&&p()}},g=(e,t,o,s,l)=>{let u=!1,f=!1;const m={name:e};if(!r.disabled){const r=!!(We(a,e)&&We(a,e)._f&&We(a,e)._f.disabled);if(!o||s){c.isDirty&&(f=n.isDirty,n.isDirty=m.isDirty=x(),u=f!==m.isDirty);const a=r||Rt(We(i,e),t);f=!(r||!We(n.dirtyFields,e)),a||r?Dt(n.dirtyFields,e):Je(n.dirtyFields,e,!0),m.dirtyFields=n.dirtyFields,u=u||c.dirtyFields&&f!==!a}if(o){const t=We(n.touchedFields,e);t||(Je(n.touchedFields,e,o),m.touchedFields=n.touchedFields,u=u||c.touchedFields&&t!==o)}u&&l&&d.state.next(m)}return u?m:{}},b=(e,a,i,o)=>{const s=We(n.errors,e),l=c.isValid&&Ie(a)&&n.isValid!==a;var f;if(r.delayError&&i?(f=()=>((e,t)=>{Je(n.errors,e,t),d.state.next({errors:n.errors})})(e,i),t=e=>{clearTimeout(u),u=setTimeout(f,e)},t(r.delayError)):(clearTimeout(u),t=null,i?Je(n.errors,e,i):Dt(n.errors,e)),(i?!Rt(s,i):s)||!st(o)||l){const t={...o,...l&&Ie(a)?{isValid:a}:{},errors:n.errors,name:e};n={...n,...t},d.state.next(t)}},w=async e=>{y(e,!0);const t=await r.resolver(o,r.context,((e,t,r,n)=>{const a={};for(const r of e){const e=We(t,r);e&&Je(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}})(e||l.mount,a,r.criteriaMode,r.shouldUseNativeValidation));return y(e),t},E=async(e,t,a={valid:!0})=>{for(const s in e){const u=e[s];if(u){const{_f:e,...d}=u;if(e){const d=l.array.has(e.name),f=u._f&&(!!(i=u._f)&&!!i.validate&&!!(yt(i.validate)&&i.validate.constructor.name===Wt||je(i.validate)&&Object.values(i.validate).find((e=>e.constructor.name===Wt))));f&&c.validatingFields&&y([s],!0);const m=await Ft(u,l.disabled,o,h,r.shouldUseNativeValidation&&!t,d);if(f&&c.validatingFields&&y([s]),m[e.name]&&(a.valid=!1,t))break;!t&&(We(m,e.name)?d?ht(n.errors,m,e.name):Je(n.errors,e.name,m[e.name]):Dt(n.errors,e.name))}!st(d)&&await E(d,t,a)}}var i;return a.valid},x=(e,t)=>!r.disabled&&(e&&t&&Je(o,e,t),!Rt(V(),i)),S=(e,t,r)=>((e,t,r,n,a)=>ut(e)?(n&&t.watch.add(e),We(r,e,a)):Array.isArray(e)?e.map((e=>(n&&t.watch.add(e),We(r,e)))):(n&&(t.watchAll=!0),r))(e,l,{...s.mount?o:Be(t)?i:ut(e)?{[e]:t}:t},r,t),_=(e,t,r={})=>{const n=We(a,e);let i=t;if(n){const r=n._f;r&&(!r.disabled&&Je(o,e,Mt(t,r)),i=vt(r.ref)&&Le(t)?"":t,Tt(r.ref)?[...r.ref.options].forEach((e=>e.selected=i.includes(e.value))):r.refs?Te(r.ref)?r.refs.length>1?r.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(i)?!!i.find((t=>t===e.value)):i===e.value))):r.refs[0]&&(r.refs[0].checked=!!i):r.refs.forEach((e=>e.checked=e.value===i)):pt(r.ref)?r.ref.value="":(r.ref.value=i,r.ref.type||d.values.next({name:e,values:{...o}})))}(r.shouldDirty||r.shouldTouch)&&g(e,i,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&D(e)},A=(e,t,r)=>{for(const n in t){const i=t[n],o=`${e}.${n}`,s=We(a,o);(l.array.has(e)||je(i)||s&&!s._f)&&!Ne(i)?A(o,i,r):_(o,i,r)}},C=(e,t,r={})=>{const u=We(a,e),f=l.array.has(e),m=Me(t);Je(o,e,m),f?(d.array.next({name:e,values:{...o}}),(c.isDirty||c.dirtyFields)&&r.shouldDirty&&d.state.next({name:e,dirtyFields:Pt(i,o),isDirty:x(e,m)})):!u||u._f||Le(m)?_(e,m,r):A(e,m,r),ft(e,l)&&d.state.next({...n}),d.values.next({name:s.mount?e:void 0,values:{...o}})},k=async e=>{s.mount=!0;const i=e.target;let u=i.name,v=!0;const x=We(a,u),S=()=>i.type?Ut(x._f):(e=>je(e)&&e.target?Te(e.target)?e.target.checked:e.target.value:e)(e),_=e=>{v=Number.isNaN(e)||Ne(e)&&isNaN(e.getTime())||Rt(e,We(o,u,e))};if(x){let i,s;const C=S(),k=e.type===qe||e.type===Ke,F=!((A=x._f).mount&&(A.required||A.min||A.max||A.maxLength||A.minLength||A.pattern||A.validate)||r.resolver||We(n.errors,u)||x._f.deps)||((e,t,r,n,a)=>!a.isOnAll&&(!r&&a.isOnTouch?!(t||e):(r?n.isOnBlur:a.isOnBlur)?!e:!(r?n.isOnChange:a.isOnChange)||e))(k,We(n.touchedFields,u),n.isSubmitted,m,f),V=ft(u,l,k);Je(o,u,C),k?(x._f.onBlur&&x._f.onBlur(e),t&&t(0)):x._f.onChange&&x._f.onChange(e);const $=g(u,C,k,!1),R=!st($)||V;if(!k&&d.values.next({name:u,type:e.type,values:{...o}}),F)return c.isValid&&("onBlur"===r.mode&&k?p():k||p()),R&&d.state.next({name:u,...V?{}:$});if(!k&&V&&d.state.next({...n}),r.resolver){const{errors:e}=await w([u]);if(_(C),v){const t=It(n.errors,a,u),r=It(e,a,t.name||u);i=r.error,u=r.name,s=st(e)}}else y([u],!0),i=(await Ft(x,l.disabled,o,h,r.shouldUseNativeValidation))[u],y([u]),_(C),v&&(i?s=!1:c.isValid&&(s=await E(a,!0)));v&&(x._f.deps&&D(x._f.deps),b(u,s,i,$))}var A},F=(e,t)=>{if(We(n.errors,t)&&e.focus)return e.focus(),1},D=async(e,t={})=>{let i,o;const s=lt(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await w(e);if(e)for(const r of e){const e=We(t,r);e?Je(n.errors,r,e):Dt(n.errors,r)}else n.errors=t;return t})(Be(e)?e:s);i=st(t),o=e?!s.some((e=>We(t,e))):i}else e?(o=(await Promise.all(s.map((async e=>{const t=We(a,e);return await E(t&&t._f?{[e]:t}:t)})))).every(Boolean),(o||n.isValid)&&p()):o=i=await E(a);return d.state.next({...!ut(e)||c.isValid&&i!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:i}:{},errors:n.errors}),t.shouldFocus&&!o&&mt(a,F,e?s:l.mount),o},V=e=>{const t={...s.mount?o:i};return Be(e)?t:ut(e)?We(t,e):e.map((e=>We(t,e)))},$=(e,t)=>({invalid:!!We((t||n).errors,e),isDirty:!!We((t||n).dirtyFields,e),error:We((t||n).errors,e),isValidating:!!We(n.validatingFields,e),isTouched:!!We((t||n).touchedFields,e)}),R=(e,t,r)=>{const i=(We(a,e,{_f:{}})._f||{}).ref,o=We(n.errors,e)||{},{ref:s,message:l,type:u,...c}=o;Je(n.errors,e,{...c,...t,ref:i}),d.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&i&&i.focus&&i.focus()},T=(e,t={})=>{for(const s of e?lt(e):l.mount)l.mount.delete(s),l.array.delete(s),t.keepValue||(Dt(a,s),Dt(o,s)),!t.keepError&&Dt(n.errors,s),!t.keepDirty&&Dt(n.dirtyFields,s),!t.keepTouched&&Dt(n.touchedFields,s),!t.keepIsValidating&&Dt(n.validatingFields,s),!r.shouldUnregister&&!t.keepDefaultValue&&Dt(i,s);d.values.next({values:{...o}}),d.state.next({...n,...t.keepDirty?{isDirty:x()}:{}}),!t.keepIsValid&&p()},N=({disabled:e,name:t,field:r,fields:n})=>{(Ie(e)&&s.mount||e||l.disabled.has(t))&&(e?l.disabled.add(t):l.disabled.delete(t),g(t,Ut(r?r._f:We(n,t)._f),!1,!1,!0))},L=(e,t={})=>{let n=We(a,e);const o=Ie(t.disabled)||Ie(r.disabled);return Je(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),l.mount.add(e),n?N({field:n,disabled:Ie(t.disabled)?t.disabled:r.disabled,name:e}):v(e,!0,t.value),{...o?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:Bt(t.min),max:Bt(t.max),minLength:Bt(t.minLength),maxLength:Bt(t.maxLength),pattern:Bt(t.pattern)}:{},name:e,onChange:k,onBlur:k,ref:o=>{if(o){L(e,t),n=We(a,e);const r=Be(o.value)&&o.querySelectorAll&&o.querySelectorAll("input,select,textarea")[0]||o,s=(e=>bt(e)||Te(e))(r),l=n._f.refs||[];if(s?l.find((e=>e===r)):r===n._f.ref)return;Je(a,e,{_f:{...n._f,...s?{refs:[...l.filter(Nt),r,...Array.isArray(We(i,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),v(e,!1,void 0,r)}else n=We(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!((e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)))(l.array,e)||!s.action)&&l.unMount.add(e)}}},O=()=>r.shouldFocusError&&mt(a,F,l.mount),j=(e,t)=>async i=>{let s;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let u=Me(o);if(l.disabled.size)for(const e of l.disabled)Je(u,e,void 0);if(d.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await w();n.errors=e,u=t}else await E(a);if(Dt(n.errors,"root"),st(n.errors)){d.state.next({errors:{}});try{await e(u,i)}catch(e){s=e}}else t&&await t({...n.errors},i),O(),setTimeout(O);if(d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:st(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},P=(e,t={})=>{const u=e?Me(e):i,f=Me(u),m=st(e),h=m?i:f;if(t.keepDefaultValues||(i=u),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(Pt(i,o))]);for(const t of Array.from(e))We(n.dirtyFields,t)?Je(h,t,We(o,t)):C(t,We(h,t))}else{if(Pe&&Be(e))for(const e of l.mount){const t=We(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(vt(e)){const t=e.closest("form");if(t){t.reset();break}}}}a={}}o=r.shouldUnregister?t.keepDefaultValues?Me(i):{}:Me(h),d.array.next({values:{...h}}),d.values.next({values:{...h}})}l={mount:t.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!c.isValid||!!t.keepIsValid||!!t.keepDirtyValues,s.watch=!!r.shouldUnregister,d.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!m&&(t.keepDirty?n.isDirty:!(!t.keepDefaultValues||Rt(e,i))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:m?{}:t.keepDirtyValues?t.keepDefaultValues&&o?Pt(i,o):n.dirtyFields:t.keepDefaultValues&&e?Pt(i,e):t.keepDirty?n.dirtyFields:{},touchedFields:t.keepTouched?n.touchedFields:{},errors:t.keepErrors?n.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1})},M=(e,t)=>P(yt(e)?e(o):e,t);return{control:{register:L,unregister:T,getFieldState:$,handleSubmit:j,setError:R,_executeSchema:w,_getWatch:S,_getDirty:x,_updateValid:p,_removeUnmounted:()=>{for(const e of l.unMount){const t=We(a,e);t&&(t._f.refs?t._f.refs.every((e=>!Nt(e))):!Nt(t._f.ref))&&T(e)}l.unMount=new Set},_updateFieldArray:(e,t=[],l,u,f=!0,m=!0)=>{if(u&&l&&!r.disabled){if(s.action=!0,m&&Array.isArray(We(a,e))){const t=l(We(a,e),u.argA,u.argB);f&&Je(a,e,t)}if(m&&Array.isArray(We(n.errors,e))){const t=l(We(n.errors,e),u.argA,u.argB);f&&Je(n.errors,e,t),((e,t)=>{!Ue(We(e,t)).length&&Dt(e,t)})(n.errors,e)}if(c.touchedFields&&m&&Array.isArray(We(n.touchedFields,e))){const t=l(We(n.touchedFields,e),u.argA,u.argB);f&&Je(n.touchedFields,e,t)}c.dirtyFields&&(n.dirtyFields=Pt(i,o)),d.state.next({name:e,isDirty:x(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Je(o,e,t)},_updateDisabledField:N,_getFieldArray:e=>Ue(We(s.mount?o:i,e,r.shouldUnregister?We(i,e,[]):[])),_reset:P,_resetDefaultValues:()=>yt(r.defaultValues)&&r.defaultValues().then((e=>{M(e,r.resetOptions),d.state.next({isLoading:!1})})),_updateFormState:e=>{n={...n,...e}},_disableForm:e=>{Ie(e)&&(d.state.next({disabled:e}),mt(a,((t,r)=>{const n=We(a,r);n&&(t.disabled=n._f.disabled||e,Array.isArray(n._f.refs)&&n._f.refs.forEach((t=>{t.disabled=n._f.disabled||e})))}),0,!1))},_subjects:d,_proxyFormState:c,_setErrors:e=>{n.errors=e,d.state.next({errors:n.errors,isValid:!1})},get _fields(){return a},get _formValues(){return o},get _state(){return s},set _state(e){s=e},get _defaultValues(){return i},get _names(){return l},set _names(e){l=e},get _formState(){return n},set _formState(e){n=e},get _options(){return r},set _options(e){r={...r,...e}}},trigger:D,register:L,handleSubmit:j,watch:(e,t)=>yt(e)?d.values.subscribe({next:r=>e(S(void 0,t),r)}):S(e,t,!0),setValue:C,getValues:V,reset:M,resetField:(e,t={})=>{We(a,e)&&(Be(t.defaultValue)?C(e,Me(We(i,e))):(C(e,t.defaultValue),Je(i,e,Me(t.defaultValue))),t.keepTouched||Dt(n.touchedFields,e),t.keepDirty||(Dt(n.dirtyFields,e),n.isDirty=t.defaultValue?x(e,Me(We(i,e))):x()),t.keepError||(Dt(n.errors,e),c.isValid&&p()),d.state.next({...n}))},clearErrors:e=>{e&&lt(e).forEach((e=>Dt(n.errors,e))),d.state.next({errors:e?n.errors:{}})},unregister:T,setError:R,setFocus:(e,t={})=>{const r=We(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&(e.focus(),t.shouldSelect&&yt(e.select)&&e.select())}},getFieldState:$}}function Jt(t={}){const r=e.useRef(void 0),n=e.useRef(void 0),[a,i]=e.useState({isDirty:!1,isValidating:!1,isLoading:yt(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,defaultValues:yt(t.defaultValues)?void 0:t.defaultValues});r.current||(r.current={...Ht(t),formState:a});const o=r.current.control;return o._options=t,function(t){const r=e.useRef(t);r.current=t,e.useEffect((()=>{const e=!t.disabled&&r.current.subject&&r.current.subject.subscribe({next:r.current.next});return()=>{e&&e.unsubscribe()}}),[t.disabled])}({subject:o._subjects.state,next:e=>{((e,t,r)=>{r(e);const{name:n,...a}=e;return st(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find((e=>t[e]===Ze))})(e,o._proxyFormState,o._updateFormState)&&i({...o._formState})}}),e.useEffect((()=>o._disableForm(t.disabled)),[o,t.disabled]),e.useEffect((()=>{if(o._proxyFormState.isDirty){const e=o._getDirty();e!==a.isDirty&&o._subjects.state.next({isDirty:e})}}),[o,a.isDirty]),e.useEffect((()=>{t.values&&!Rt(t.values,n.current)?(o._reset(t.values,o._options.resetOptions),n.current=t.values,i((e=>({...e})))):o._resetDefaultValues()}),[t.values,o]),e.useEffect((()=>{t.errors&&o._setErrors(t.errors)}),[t.errors,o]),e.useEffect((()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()})),e.useEffect((()=>{t.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})}),[t.shouldUnregister,o]),r.current.formState=((e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const r in e)Object.defineProperty(a,r,{get:()=>{const a=r;return t._proxyFormState[a]!==Ze&&(t._proxyFormState[a]=!n||Ze),e[a]}});return a})(a,o),r.current}const qt={getList:(e,t)=>fetch(e,{method:"GET",headers:{"Content-Type":"application/json"},body:JSON.stringify({page:t})}).then((e=>e.json())),create:(e,t)=>fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then((e=>e.json())),details:(e,t)=>fetch(`${e}/${t}`,{method:"GET",headers:{"Content-Type":"application/json"}}).then((e=>e.json())),edit:(e,t)=>fetch(`${e}/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then((e=>e.json()))};function Kt({data:t,screen:r}){const{register:a,handleSubmit:i,reset:o,formState:{errors:s}}=Jt({resolver:n.screens[r.controller].resolver,defaultValues:t}),l=H(),u=n.screens[r.controller].fields;return e.useEffect((()=>{o(t)}),[t,o]),e.createElement("div",{className:"form-wrapper"},e.createElement("form",{onSubmit:i((e=>{t?qt.edit(r.controller,e).then((()=>{l("/"+r.controller,{replace:!0})})):qt.create(r.controller,e).then((()=>{l("/"+r.controller,{replace:!0})}))}))},u.map((t=>e.createElement("div",{className:"form-field",key:t},e.createElement("label",{htmlFor:t},t.charAt(0).toUpperCase()+t.slice(1)),e.createElement("input",{type:"text",...a(t),placeholder:`Enter ${t}`,id:t}),s[t]&&e.createElement("span",{className:"error-message"},s[t]?.message)))),e.createElement("button",{type:"submit",className:"submit-button"},"Submit")))}function Yt({screen:t}){return e.createElement(Re,null,e.createElement(Kt,{screen:t}))}function Gt({screen:t}){const{id:r}=q(),[n,a]=e.useState(null),[i,o]=e.useState(null);return e.useEffect((()=>{t.controller&&r&&qt.details(t.controller,r).then((e=>{a(e.data)})).catch((e=>{o(e),console.error(e)}))}),[r,t]),e.createElement(Re,null,e.createElement("p",{dangerouslySetInnerHTML:{__html:JSON.stringify(n,null," <br/>")}}))}function Xt({screen:t}){const{id:r}=q(),[n,a]=e.useState(null),[i,o]=e.useState(null);return e.useEffect((()=>{t.controller&&r&&qt.details(t.controller,r).then((e=>{a(e.data)})).catch((e=>{o(e),console.error(e)}))}),[r,t]),e.createElement(Re,null,e.createElement(Kt,{data:n,screen:t}))}function Qt({data:t,cells:r,screen:n}){return t&&0!==t.length?e.createElement("div",{className:"list-wrapper"},e.createElement("div",{className:"header"},"List"),e.createElement("table",{className:"list-table"},e.createElement("thead",null,e.createElement("tr",null,r.map((t=>e.createElement("th",{key:t.name},t.title??t.name))),e.createElement("th",null))),e.createElement("tbody",null,t.map(((t,n)=>e.createElement("tr",{key:n},r.map((r=>{const n=t[r.name];let a=n??"-";if("date"===r.type){if(n){const e=new Date(n);a=`${e.getDate().toString().padStart(2,"0")}/${(e.getMonth()+1).toString().padStart(2,"0")}/${e.getFullYear()} ${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}`}}else a=n?n.toString():r?.placeHolder??"-";let i=a;return r.linkTo&&(i=e.createElement(ke,{to:r.linkTo(t)},a)),e.createElement("td",{key:r.name},i)})),e.createElement("td",null,e.createElement(ke,{to:"edit/"+(t?.id??"-")},"Edit"),e.createElement(ke,{to:"details/"+(t?.id??"-")},"Details")))))))):e.createElement("div",null,"No items available")}function Zt({screen:t}){const[r,a]=e.useState(0),[i,o]=e.useState(null),[s,l]=e.useState(null);return e.useEffect((()=>{t.controller&&qt.getList(t.controller,r).then((e=>{o(e.data)})).catch((e=>{l(e),console.error(e)}))}),[r,t.controller]),e.createElement(Re,null,e.createElement(ke,{to:"/maps/create"},"Create"),s?e.createElement("p",null,"Error ",s):null,e.createElement(Qt,{screen:t,cells:n.screens[t.key].cells,data:i}))}exports.Layout=Re,exports.Panel=function({children:t}){return e.createElement(e.Fragment,null,t)},exports.SideBar=$e,exports.createScreens=function(e){n.screens=e},exports.getScreenForRoutes=function(){const t=Object.entries(n.screens);return e.createElement(e.Fragment,null,t.map((([t,r])=>{let n=`/${r.crud.controller}`;const a={key:t,controller:r.crud.controller};return e.createElement(e.Fragment,{key:"index"},e.createElement(ie,{path:n+"/create",element:e.createElement(Yt,{screen:a})}),e.createElement(ie,{path:n+"/details/:id",element:e.createElement(Gt,{screen:a})}),e.createElement(ie,{path:n+"/edit/:id",element:e.createElement(Xt,{screen:a})}),e.createElement(ie,{path:n,element:e.createElement(Zt,{screen:a})}))})),e.createElement(ie,{path:"*",element:e.createElement("div",null,"404 - Not Found")}))};
12
+ function o(e,t){if(!1===e||null==e)throw new Error(t)}function s(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function l({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 u(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 c(e,t,r="/"){return function(e,t,r,n){let a="string"==typeof t?u(t):t,i=_(a.pathname||"/",r);if(null==i)return null;let o=d(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let r=e.length===t.length&&e.slice(0,-1).every(((e,r)=>e===t[r]));return r?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(o);let s=null;for(let e=0;null==s&&e<o.length;++e){let t=S(i);s=E(o[e],t,n)}return s}(e,t,r,!1)}function d(e,t=[],r=[],n=""){let a=(e,a,i)=>{let s={relativePath:void 0===i?e.path||"":i,caseSensitive:!0===e.caseSensitive,childrenIndex:a,route:e};s.relativePath.startsWith("/")&&(o(s.relativePath.startsWith(n),`Absolute route path "${s.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),s.relativePath=s.relativePath.slice(n.length));let l=F([n,s.relativePath]),u=r.concat(s);e.children&&e.children.length>0&&(o(!0!==e.index,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),d(e.children,t,u,l)),(null!=e.path||e.index)&&t.push({path:l,score:w(l,e.index),routesMeta:u})};return e.forEach(((e,t)=>{if(""!==e.path&&e.path?.includes("?"))for(let r of f(e.path))a(e,t,r);else a(e,t)})),t}function f(e){let t=e.split("/");if(0===t.length)return[];let[r,...n]=t,a=r.endsWith("?"),i=r.replace(/\?$/,"");if(0===n.length)return a?[i,""]:[i];let o=f(n.join("/")),s=[];return s.push(...o.map((e=>""===e?i:[i,e].join("/")))),a&&s.push(...o),s.map((t=>e.startsWith("/")&&""===t?"/":t))}!function(){if(a)return i;a=1,Object.defineProperty(i,"__esModule",{value:!0}),i.parse=function(e,t){const r=new s,n=e.length;if(n<2)return r;const a=t?.decode||c;let i=0;do{const t=e.indexOf("=",i);if(-1===t)break;const o=e.indexOf(";",i),s=-1===o?n:o;if(t>s){i=e.lastIndexOf(";",t-1)+1;continue}const c=l(e,i,t),d=u(e,t,c),f=e.slice(c,d);if(void 0===r[f]){let n=l(e,t+1,s),i=u(e,s,n);const o=a(e.slice(n,i));r[f]=o}i=s+1}while(i<n);return r},i.serialize=function(a,i,s){const l=s?.encode||encodeURIComponent;if(!e.test(a))throw new TypeError(`argument name is invalid: ${a}`);const u=l(i);if(!t.test(u))throw new TypeError(`argument val is invalid: ${i}`);let c=a+"="+u;if(!s)return c;if(void 0!==s.maxAge){if(!Number.isInteger(s.maxAge))throw new TypeError(`option maxAge is invalid: ${s.maxAge}`);c+="; Max-Age="+s.maxAge}if(s.domain){if(!r.test(s.domain))throw new TypeError(`option domain is invalid: ${s.domain}`);c+="; Domain="+s.domain}if(s.path){if(!n.test(s.path))throw new TypeError(`option path is invalid: ${s.path}`);c+="; Path="+s.path}if(s.expires){if(!function(e){return"[object Date]"===o.call(e)}(s.expires)||!Number.isFinite(s.expires.valueOf()))throw new TypeError(`option expires is invalid: ${s.expires}`);c+="; Expires="+s.expires.toUTCString()}s.httpOnly&&(c+="; HttpOnly");s.secure&&(c+="; Secure");s.partitioned&&(c+="; Partitioned");if(s.priority){switch("string"==typeof s.priority?s.priority.toLowerCase():void 0){case"low":c+="; Priority=Low";break;case"medium":c+="; Priority=Medium";break;case"high":c+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${s.priority}`)}}if(s.sameSite){switch("string"==typeof s.sameSite?s.sameSite.toLowerCase():s.sameSite){case!0:case"strict":c+="; SameSite=Strict";break;case"lax":c+="; SameSite=Lax";break;case"none":c+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${s.sameSite}`)}}return c};const e=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,t=/^[\u0021-\u003A\u003C-\u007E]*$/,r=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,n=/^[\u0020-\u003A\u003D-\u007E]*$/,o=Object.prototype.toString,s=(()=>{const e=function(){};return e.prototype=Object.create(null),e})();function l(e,t,r){do{const r=e.charCodeAt(t);if(32!==r&&9!==r)return t}while(++t<r);return r}function u(e,t,r){for(;t>r;){const r=e.charCodeAt(--t);if(32!==r&&9!==r)return t+1}return r}function c(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch(t){return e}}}();var m=/^:[\w-]+$/,h=3,p=2,y=1,v=10,g=-2,b=e=>"*"===e;function w(e,t){let r=e.split("/"),n=r.length;return r.some(b)&&(n+=g),t&&(n+=p),r.filter((e=>!b(e))).reduce(((e,t)=>e+(m.test(t)?h:""===t?y:v)),n)}function E(e,t,r=!1){let{routesMeta:n}=e,a={},i="/",o=[];for(let e=0;e<n.length;++e){let s=n[e],l=e===n.length-1,u="/"===i?t:t.slice(i.length)||"/",c=x({path:s.relativePath,caseSensitive:s.caseSensitive,end:l},u),d=s.route;if(!c&&l&&r&&!n[n.length-1].route.index&&(c=x({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},u)),!c)return null;Object.assign(a,c.params),o.push({params:a,pathname:F([i,c.pathname]),pathnameBase:D(F([i,c.pathnameBase])),route:d}),"/"!==c.pathnameBase&&(i=F([i,c.pathnameBase]))}return o}function x(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=function(e,t=!1,r=!0){s("*"===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=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,r)=>(n.push({paramName:t,isOptional:null!=r}),r?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(n.push({paramName:"*"}),a+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":""!==e&&"/"!==e&&(a+="(?:(?=\\/|$))");let i=new RegExp(a,t?void 0:"i");return[i,n]}(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let i=a[0],o=i.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:n.reduce(((e,{paramName:t,isOptional:r},n)=>{if("*"===t){let e=l[n]||"";o=i.slice(0,i.length-e.length).replace(/(.)\/+$/,"$1")}const a=l[n];return e[t]=r&&!a?void 0:(a||"").replace(/%2F/g,"/"),e}),{}),pathname:i,pathnameBase:o,pattern:e}}function S(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return s(!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}}function _(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 A(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 C(e){let t=function(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}(e);return t.map(((e,r)=>r===t.length-1?e.pathname:e.pathnameBase))}function k(e,t,r,n=!1){let a;"string"==typeof e?a=u(e):(a={...e},o(!a.pathname||!a.pathname.includes("?"),A("?","pathname","search",a)),o(!a.pathname||!a.pathname.includes("#"),A("#","pathname","hash",a)),o(!a.search||!a.search.includes("#"),A("#","search","hash",a)));let i,s=""===e||""===a.pathname,l=s?"/":a.pathname;if(null==l)i=r;else{let e=t.length-1;if(!n&&l.startsWith("..")){let t=l.split("/");for(;".."===t[0];)t.shift(),e-=1;a.pathname=t.join("/")}i=e>=0?t[e]:"/"}let c=function(e,t="/"){let{pathname:r,search:n="",hash:a=""}="string"==typeof e?u(e):e,i=r?r.startsWith("/")?r:function(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)})),r.length>1?r.join("/"):"/"}(r,t):t;return{pathname:i,search:V(n),hash:$(a)}}(a,i),d=l&&"/"!==l&&l.endsWith("/"),f=(s||"."===l)&&r.endsWith("/");return c.pathname.endsWith("/")||!d&&!f||(c.pathname+="/"),c}var F=e=>e.join("/").replace(/\/\/+/g,"/"),D=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),V=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",$=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";var R=["POST","PUT","PATCH","DELETE"];new Set(R);var T=["GET",...R];new Set(T);var N=r.createContext(null);N.displayName="DataRouter";var L=r.createContext(null);L.displayName="DataRouterState";var O=r.createContext({isTransitioning:!1});O.displayName="ViewTransition",r.createContext(new Map).displayName="Fetchers",r.createContext(null).displayName="Await";var j=r.createContext(null);j.displayName="Navigation";var P=r.createContext(null);P.displayName="Location";var M=r.createContext({outlet:null,matches:[],isDataRoute:!1});M.displayName="Route";var U=r.createContext(null);function B(){return null!=r.useContext(P)}function W(){return o(B(),"useLocation() may be used only in the context of a <Router> component."),r.useContext(P).location}U.displayName="RouteError";var I="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function z(e){r.useContext(j).static||r.useLayoutEffect(e)}function H(){let{isDataRoute:e}=r.useContext(M);return e?function(){let{router:e}=function(e){let t=r.useContext(N);return o(t,ee(e)),t}("useNavigate"),t=te("useNavigate"),n=r.useRef(!1);return z((()=>{n.current=!0})),r.useCallback((async(r,a={})=>{s(n.current,I),n.current&&("number"==typeof r?e.navigate(r):await e.navigate(r,{fromRouteId:t,...a}))}),[e,t])}():function(){o(B(),"useNavigate() may be used only in the context of a <Router> component.");let e=r.useContext(N),{basename:t,navigator:n}=r.useContext(j),{matches:a}=r.useContext(M),{pathname:i}=W(),l=JSON.stringify(C(a)),u=r.useRef(!1);return z((()=>{u.current=!0})),r.useCallback(((r,a={})=>{if(s(u.current,I),!u.current)return;if("number"==typeof r)return void n.go(r);let o=k(r,JSON.parse(l),i,"path"===a.relative);null==e&&"/"!==t&&(o.pathname="/"===o.pathname?t:F([t,o.pathname])),(a.replace?n.replace:n.push)(o,a.state,a)}),[t,n,l,i,e])}()}var J=r.createContext(null);function q(){let{matches:e}=r.useContext(M),t=e[e.length-1];return t?t.params:{}}function K(e,{relative:t}={}){let{matches:n}=r.useContext(M),{pathname:a}=W(),i=JSON.stringify(C(n));return r.useMemo((()=>k(e,JSON.parse(i),a,"path"===t)),[e,i,a,t])}function Y(e,t,n,a){o(B(),"useRoutes() may be used only in the context of a <Router> component.");let i,{navigator:l,static:u}=r.useContext(j),{matches:d}=r.useContext(M),f=d[d.length-1],m=f?f.params:{},h=f?f.pathname:"/",p=f?f.pathnameBase:"/",y=f&&f.route;{let e=y&&y.path||"";ne(h,!y||e.endsWith("*")||e.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.\n\nPlease change the parent <Route path="${e}"> to <Route path="${"/"===e?"*":`${e}/*`}">.`)}i=W();let v=i.pathname||"/",g=v;if("/"!==p){let e=p.replace(/^\//,"").split("/");g="/"+v.replace(/^\//,"").split("/").slice(e.length).join("/")}let b=!u&&n&&n.matches&&n.matches.length>0?n.matches:c(e,{pathname:g});s(y||null!=b,`No routes matched location "${i.pathname}${i.search}${i.hash}" `),s(null==b||void 0!==b[b.length-1].route.element||void 0!==b[b.length-1].route.Component||void 0!==b[b.length-1].route.lazy,`Matched leaf route at location "${i.pathname}${i.search}${i.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let w=function(e,t=[],n=null){if(null==e){if(!n)return null;if(n.errors)e=n.matches;else{if(0!==t.length||n.initialized||!(n.matches.length>0))return null;e=n.matches}}let a=e,i=n?.errors;if(null!=i){let e=a.findIndex((e=>e.route.id&&void 0!==i?.[e.route.id]));o(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,l=-1;if(n)for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(l=e),t.route.id){let{loaderData:e,errors:r}=n,i=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!r||void 0===r[t.route.id]);if(t.route.lazy||i){s=!0,a=l>=0?a.slice(0,l+1):[a[0]];break}}}return a.reduceRight(((e,o,u)=>{let c,d=!1,f=null,m=null;n&&(c=i&&o.route.id?i[o.route.id]:void 0,f=o.route.errorElement||X,s&&(l<0&&0===u?(ne("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,m=null):l===u&&(d=!0,m=o.route.hydrateFallbackElement||null)));let h=t.concat(a.slice(0,u+1)),p=()=>{let t;return t=c?f:d?m:o.route.Component?r.createElement(o.route.Component,null):o.route.element?o.route.element:e,r.createElement(Z,{match:o,routeContext:{outlet:e,matches:h,isDataRoute:null!=n},children:t})};return n&&(o.route.ErrorBoundary||o.route.errorElement||0===u)?r.createElement(Q,{location:n.location,revalidation:n.revalidation,component:f,error:c,children:p(),routeContext:{outlet:null,matches:h,isDataRoute:!0}}):p()}),null)}(b&&b.map((e=>Object.assign({},e,{params:Object.assign({},m,e.params),pathname:F([p,l.encodeLocation?l.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?p:F([p,l.encodeLocation?l.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),d,n,a);return w}function G(){let e=function(){let e=r.useContext(U),t=function(e){let t=r.useContext(L);return o(t,ee(e)),t}("useRouteError"),n=te("useRouteError");if(void 0!==e)return e;return t.errors?.[n]}(),t=function(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:a},s={padding:"2px 4px",backgroundColor:a},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=r.createElement(r.Fragment,null,r.createElement("p",null,"💿 Hey developer 👋"),r.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",r.createElement("code",{style:s},"ErrorBoundary")," or"," ",r.createElement("code",{style:s},"errorElement")," prop on your route.")),r.createElement(r.Fragment,null,r.createElement("h2",null,"Unexpected Application Error!"),r.createElement("h3",{style:{fontStyle:"italic"}},t),n?r.createElement("pre",{style:i},n):null,l)}var X=r.createElement(G,null),Q=class extends r.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}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){console.error("React Router caught the following error during render",e,t)}render(){return void 0!==this.state.error?r.createElement(M.Provider,{value:this.props.routeContext},r.createElement(U.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Z({routeContext:e,match:t,children:n}){let a=r.useContext(N);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),r.createElement(M.Provider,{value:e},n)}function ee(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function te(e){let t=function(e){let t=r.useContext(M);return o(t,ee(e)),t}(e),n=t.matches[t.matches.length-1];return o(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}var re={};function ne(e,t,r){t||re[e]||(re[e]=!0,s(!1,r))}function ae(e){return function(e){let t=r.useContext(M).outlet;return t?r.createElement(J.Provider,{value:e},t):t}(e.context)}function ie(e){o(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}r.memo((function({routes:e,future:t,state:r}){return Y(e,0,r,t)}));var oe="get",se="application/x-www-form-urlencoded";function le(e){return null!=e&&"string"==typeof e.tagName}var ue=null;var ce=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function de(e){return null==e||ce.has(e)?e:(s(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${se}"`),null)}function fe(e,t){let r,n,a,i,o;if(le(s=e)&&"form"===s.tagName.toLowerCase()){let o=e.getAttribute("action");n=o?_(o,t):null,r=e.getAttribute("method")||oe,a=de(e.getAttribute("enctype"))||se,i=new FormData(e)}else if(function(e){return le(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return le(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let o=e.form;if(null==o)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||o.getAttribute("action");if(n=s?_(s,t):null,r=e.getAttribute("formmethod")||o.getAttribute("method")||oe,a=de(e.getAttribute("formenctype"))||de(o.getAttribute("enctype"))||se,i=new FormData(o,e),!function(){if(null===ue)try{new FormData(document.createElement("form"),0),ue=!1}catch(e){ue=!0}return ue}()){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(le(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=oe,n=null,a=se,o=e}var s;return i&&"text/plain"===a&&(o=i,i=void 0),{action:n,method:r.toLowerCase(),encType:a,formData:i,body:o}}function me(e,t){if(!1===e||null==e)throw new Error(t)}function he(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 pe(e,t,r){return function(e,t){let r=new Set;return new Set(t),e.reduce(((e,t)=>{let n=JSON.stringify(function(e){let t={},r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}(t));return r.has(n)||(r.add(n),e.push({key:n,link:t})),e}),[])}((await Promise.all(e.map((async e=>{let n=t.routes[e.route.id];if(n){let e=await async function(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((()=>{}))}}(n,r);return e.links?e.links():[]}return[]})))).flat(1).filter(he).filter((e=>"stylesheet"===e.rel||"preload"===e.rel)).map((e=>"stylesheet"===e.rel?{...e,rel:"prefetch",as:"style"}:{...e,rel:"prefetch"})))}function ye(e,t,r,n,a,i){let o=(e,t)=>!r[t]||e.route.id!==r[t].route.id,s=(e,t)=>r[t].pathname!==e.pathname||r[t].route.path?.endsWith("*")&&r[t].params["*"]!==e.params["*"];return"assets"===i?t.filter(((e,t)=>o(e,t)||s(e,t))):"data"===i?t.filter(((t,i)=>{let l=n.routes[t.route.id];if(!l||!l.hasLoader)return!1;if(o(t,i)||s(t,i))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})):[]}function ve(e,t,{includeHydrateFallback:r}={}){return n=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),[...new Set(n)];var n}function ge(){let e=r.useContext(N);return me(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}var be=r.createContext(void 0);function we(){let e=r.useContext(be);return me(e,"You must render this element inside a <HydratedRouter> element"),e}function Ee(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function xe({page:e,...t}){let{router:n}=ge(),a=r.useMemo((()=>c(n.routes,e,n.basename)),[n.routes,e,n.basename]);return a?r.createElement(Se,{page:e,matches:a,...t}):null}function Se({page:e,matches:t,...n}){let a=W(),{manifest:i,routeModules:o}=we(),{basename:s}=ge(),{loaderData:l,matches:u}=function(){let e=r.useContext(L);return me(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}(),c=r.useMemo((()=>ye(e,t,u,i,a,"data")),[e,t,u,i,a]),d=r.useMemo((()=>ye(e,t,u,i,a,"assets")),[e,t,u,i,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=i.routes[e.route.id];t&&t.hasLoader&&(!c.some((t=>t.route.id===e.route.id))&&e.route.id in l&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?n=!0:r.add(e.route.id))})),0===r.size)return[];let u=function(e,t){let r="string"==typeof e?new URL(e,"undefined"==typeof window?"server://singlefetch/":window.location.origin):e;return"/"===r.pathname?r.pathname="_root.data":t&&"/"===_(r.pathname,t)?r.pathname=`${t.replace(/\/$/,"")}/_root.data`:r.pathname=`${r.pathname.replace(/\/$/,"")}.data`,r}(e,s);return n&&r.size>0&&u.searchParams.set("_routes",t.filter((e=>r.has(e.route.id))).map((e=>e.route.id)).join(",")),[u.pathname+u.search]}),[s,l,a,i,c,t,e,o]),m=r.useMemo((()=>ve(d,i)),[d,i]),h=function(e){let{manifest:t,routeModules:n}=we(),[a,i]=r.useState([]);return r.useEffect((()=>{let r=!1;return pe(e,t,n).then((e=>{r||i(e)})),()=>{r=!0}}),[e,t,n]),a}(d);return r.createElement(r.Fragment,null,f.map((e=>r.createElement("link",{key:e,rel:"prefetch",as:"fetch",href:e,...n}))),m.map((e=>r.createElement("link",{key:e,rel:"modulepreload",href:e,...n}))),h.map((({key:e,link:t})=>r.createElement("link",{key:e,...t}))))}function _e(...e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}be.displayName="FrameworkContext";var Ae="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;try{Ae&&(window.__reactRouterVersion="7.3.0")}catch(e){}var Ce=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ke=r.forwardRef((function({onClick:e,discover:t="render",prefetch:n="none",relative:a,reloadDocument:i,replace:u,state:c,target:d,to:f,preventScrollReset:m,viewTransition:h,...p},y){let v,{basename:g}=r.useContext(j),b="string"==typeof f&&Ce.test(f),w=!1;if("string"==typeof f&&b&&(v=f,Ae))try{let e=new URL(window.location.href),t=f.startsWith("//")?new URL(e.protocol+f):new URL(f),r=_(t.pathname,g);t.origin===e.origin&&null!=r?f=r+t.search+t.hash:w=!0}catch(e){s(!1,`<Link to="${f}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let E=function(e,{relative:t}={}){o(B(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=r.useContext(j),{hash:i,pathname:s,search:l}=K(e,{relative:t}),u=s;return"/"!==n&&(u="/"===s?n:F([n,s])),a.createHref({pathname:u,search:l,hash:i})}(f,{relative:a}),[x,S,A]=function(e,t){let n=r.useContext(be),[a,i]=r.useState(!1),[o,s]=r.useState(!1),{onFocus:l,onBlur:u,onMouseEnter:c,onMouseLeave:d,onTouchStart:f}=t,m=r.useRef(null);r.useEffect((()=>{if("render"===e&&s(!0),"viewport"===e){let e=new IntersectionObserver((e=>{e.forEach((e=>{s(e.isIntersecting)}))}),{threshold:.5});return m.current&&e.observe(m.current),()=>{e.disconnect()}}}),[e]),r.useEffect((()=>{if(a){let e=setTimeout((()=>{s(!0)}),100);return()=>{clearTimeout(e)}}}),[a]);let h=()=>{i(!0)},p=()=>{i(!1),s(!1)};return n?"intent"!==e?[o,m,{}]:[o,m,{onFocus:Ee(l,h),onBlur:Ee(u,p),onMouseEnter:Ee(c,h),onMouseLeave:Ee(d,p),onTouchStart:Ee(f,h)}]:[!1,m,{}]}(n,p),C=function(e,{target:t,replace:n,state:a,preventScrollReset:i,relative:o,viewTransition:s}={}){let u=H(),c=W(),d=K(e,{relative:o});return r.useCallback((r=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(r,t)){r.preventDefault();let t=void 0!==n?n:l(c)===l(d);u(e,{replace:t,state:a,preventScrollReset:i,relative:o,viewTransition:s})}}),[c,u,d,n,a,t,e,i,o,s])}(f,{replace:u,state:c,target:d,preventScrollReset:m,relative:a,viewTransition:h});let k=r.createElement("a",{...p,...A,href:v||E,onClick:w||i?e:function(t){e&&e(t),t.defaultPrevented||C(t)},ref:_e(y,S),target:d,"data-discover":b||"render"!==t?void 0:"true"});return x&&!b?r.createElement(r.Fragment,null,k,r.createElement(xe,{page:E})):k}));function Fe(e){let t=r.useContext(N);return o(t,function(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}(e)),t}ke.displayName="Link",r.forwardRef((function({"aria-current":e="page",caseSensitive:t=!1,className:n="",end:a=!1,style:i,to:s,viewTransition:l,children:u,...c},d){let f=K(s,{relative:c.relative}),m=W(),h=r.useContext(L),{navigator:p,basename:y}=r.useContext(j),v=null!=h&&function(e,t={}){let n=r.useContext(O);o(null!=n,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=Fe("useViewTransitionState"),i=K(e,{relative:t.relative});if(!n.isTransitioning)return!1;let s=_(n.currentLocation.pathname,a)||n.currentLocation.pathname,l=_(n.nextLocation.pathname,a)||n.nextLocation.pathname;return null!=x(i.pathname,l)||null!=x(i.pathname,s)}(f)&&!0===l,g=p.encodeLocation?p.encodeLocation(f).pathname:f.pathname,b=m.pathname,w=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;t||(b=b.toLowerCase(),w=w?w.toLowerCase():null,g=g.toLowerCase()),w&&y&&(w=_(w,y)||w);const E="/"!==g&&g.endsWith("/")?g.length-1:g.length;let S,A=b===g||!a&&b.startsWith(g)&&"/"===b.charAt(E),C=null!=w&&(w===g||!a&&w.startsWith(g)&&"/"===w.charAt(g.length)),k={isActive:A,isPending:C,isTransitioning:v},F=A?e:void 0;S="function"==typeof n?n(k):[n,A?"active":null,C?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let D="function"==typeof i?i(k):i;return r.createElement(ke,{...c,"aria-current":F,className:S,ref:d,style:D,to:s,viewTransition:l},"function"==typeof u?u(k):u)})).displayName="NavLink",r.forwardRef((({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:a,replace:i,state:s,method:u=oe,action:c,onSubmit:d,relative:f,preventScrollReset:m,viewTransition:h,...p},y)=>{let v=function(){let{router:e}=Fe("useSubmit"),{basename:t}=r.useContext(j),n=te("useRouteId");return r.useCallback((async(r,a={})=>{let{action:i,method:o,encType:s,formData:l,body:u}=fe(r,t);if(!1===a.navigate){let t=a.fetcherKey||Ve();await e.fetch(t,n,a.action||i,{preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||o,formEncType:a.encType||s,flushSync:a.flushSync})}else await e.navigate(a.action||i,{preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||o,formEncType:a.encType||s,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})}),[e,t,n])}(),g=function(e,{relative:t}={}){let{basename:n}=r.useContext(j),a=r.useContext(M);o(a,"useFormAction must be used inside a RouteContext");let[i]=a.matches.slice(-1),s={...K(e||".",{relative:t})},u=W();if(null==e){s.search=u.search;let e=new URLSearchParams(s.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();s.search=r?`?${r}`:""}}e&&"."!==e||!i.route.index||(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index");"/"!==n&&(s.pathname="/"===s.pathname?n:F([n,s.pathname]));return l(s)}(c,{relative:f}),b="get"===u.toLowerCase()?"get":"post",w="string"==typeof c&&Ce.test(c);return r.createElement("form",{ref:y,method:b,action:g,onSubmit:a?d:e=>{if(d&&d(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,a=r?.getAttribute("formmethod")||u;v(r||e.currentTarget,{fetcherKey:t,method:a,navigate:n,replace:i,state:s,relative:f,preventScrollReset:m,viewTransition:h})},...p,"data-discover":w||"render"!==e?void 0:"true"})})).displayName="Form";var De=0,Ve=()=>`__${String(++De)}__`;function $e(){const[t,r]=e.useState(!0);return e.createElement("div",{className:"sidebar "+(t?"open":"closed")},e.createElement("button",{className:"toggle-button",onClick:()=>r(!t)},t?"<":">"),e.createElement("nav",{className:"nav-links"},e.createElement(ke,{to:"/"},"Home")))}function Re({children:t}){return e.createElement("div",{className:"layout"},e.createElement($e,null),e.createElement("main",{className:"content"},t||e.createElement(ae,null)))}new TextEncoder;var Te=e=>"checkbox"===e.type,Ne=e=>e instanceof Date,Le=e=>null==e;const Oe=e=>"object"==typeof e;var je=e=>!Le(e)&&!Array.isArray(e)&&Oe(e)&&!Ne(e),Pe="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function Me(e){let t;const r=Array.isArray(e),n="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(Pe&&(e instanceof Blob||n)||!r&&!je(e))return e;if(t=r?[]:{},r||(e=>{const t=e.constructor&&e.constructor.prototype;return je(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const r in e)e.hasOwnProperty(r)&&(t[r]=Me(e[r]));else t=e}return t}var Ue=e=>Array.isArray(e)?e.filter(Boolean):[],Be=e=>void 0===e,We=(e,t,r)=>{if(!t||!je(e))return r;const n=Ue(t.split(/[,[\].]+?/)).reduce(((e,t)=>Le(e)?e:e[t]),e);return Be(n)||n===e?Be(e[t])?r:e[t]:n},Ie=e=>"boolean"==typeof e,ze=e=>/^\w*$/.test(e),He=e=>Ue(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Je=(e,t,r)=>{let n=-1;const a=ze(t)?[t]:He(t),i=a.length,o=i-1;for(;++n<i;){const t=a[n];let i=r;if(n!==o){const r=e[t];i=je(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=i,e=e[t]}return e};const qe="blur",Ke="focusout",Ye="onBlur",Ge="onChange",Xe="onSubmit",Qe="onTouched",Ze="all",et="max",tt="min",rt="maxLength",nt="minLength",at="pattern",it="required",ot="validate";e.createContext(null);var st=e=>je(e)&&!Object.keys(e).length,lt=e=>Array.isArray(e)?e:[e];var ut=e=>"string"==typeof e,ct=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},dt=e=>({isOnSubmit:!e||e===Xe,isOnBlur:e===Ye,isOnChange:e===Ge,isOnAll:e===Ze,isOnTouch:e===Qe}),ft=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const mt=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const r=We(e,a);if(r){const{_f:e,...i}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],a)&&!n)return!0;if(e.ref&&t(e.ref,e.name)&&!n)return!0;if(mt(i,t))break}else if(je(i)&&mt(i,t))break}}};var ht=(e,t,r)=>{const n=lt(We(e,r));return Je(n,"root",t[r]),Je(e,r,n),e},pt=e=>"file"===e.type,yt=e=>"function"==typeof e,vt=e=>{if(!Pe)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},gt=e=>ut(e),bt=e=>"radio"===e.type,wt=e=>e instanceof RegExp;const Et={value:!1,isValid:!1},xt={value:!0,isValid:!0};var St=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Be(e[0].attributes.value)?Be(e[0].value)||""===e[0].value?xt:{value:e[0].value,isValid:!0}:xt:Et}return Et};const _t={isValid:!1,value:null};var At=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),_t):_t;function Ct(e,t,r="validate"){if(gt(e)||Array.isArray(e)&&e.every(gt)||Ie(e)&&!e)return{type:r,message:gt(e)?e:"",ref:t}}var kt=e=>je(e)&&!wt(e)?e:{value:e,message:""},Ft=async(e,t,r,n,a,i)=>{const{ref:o,refs:s,required:l,maxLength:u,minLength:c,min:d,max:f,pattern:m,validate:h,name:p,valueAsNumber:y,mount:v}=e._f,g=We(r,p);if(!v||t.has(p))return{};const b=s?s[0]:o,w=e=>{a&&b.reportValidity&&(b.setCustomValidity(Ie(e)?"":e||""),b.reportValidity())},E={},x=bt(o),S=Te(o),_=x||S,A=(y||pt(o))&&Be(o.value)&&Be(g)||vt(o)&&""===o.value||""===g||Array.isArray(g)&&!g.length,C=ct.bind(null,p,n,E),k=(e,t,r,n=rt,a=nt)=>{const i=e?t:r;E[p]={type:e?n:a,message:i,ref:o,...C(e?n:a,i)}};if(i?!Array.isArray(g)||!g.length:l&&(!_&&(A||Le(g))||Ie(g)&&!g||S&&!St(s).isValid||x&&!At(s).isValid)){const{value:e,message:t}=gt(l)?{value:!!l,message:l}:kt(l);if(e&&(E[p]={type:it,message:t,ref:b,...C(it,t)},!n))return w(t),E}if(!(A||Le(d)&&Le(f))){let e,t;const r=kt(f),a=kt(d);if(Le(g)||isNaN(g)){const n=o.valueAsDate||new Date(g),i=e=>new Date((new Date).toDateString()+" "+e),s="time"==o.type,l="week"==o.type;ut(r.value)&&g&&(e=s?i(g)>i(r.value):l?g>r.value:n>new Date(r.value)),ut(a.value)&&g&&(t=s?i(g)<i(a.value):l?g<a.value:n<new Date(a.value))}else{const n=o.valueAsNumber||(g?+g:g);Le(r.value)||(e=n>r.value),Le(a.value)||(t=n<a.value)}if((e||t)&&(k(!!e,r.message,a.message,et,tt),!n))return w(E[p].message),E}if((u||c)&&!A&&(ut(g)||i&&Array.isArray(g))){const e=kt(u),t=kt(c),r=!Le(e.value)&&g.length>+e.value,a=!Le(t.value)&&g.length<+t.value;if((r||a)&&(k(r,e.message,t.message),!n))return w(E[p].message),E}if(m&&!A&&ut(g)){const{value:e,message:t}=kt(m);if(wt(e)&&!g.match(e)&&(E[p]={type:at,message:t,ref:o,...C(at,t)},!n))return w(t),E}if(h)if(yt(h)){const e=Ct(await h(g,r),b);if(e&&(E[p]={...e,...C(ot,e.message)},!n))return w(e.message),E}else if(je(h)){let e={};for(const t in h){if(!st(e)&&!n)break;const a=Ct(await h[t](g,r),b,t);a&&(e={...a,...C(t,a.message)},w(a.message),n&&(E[p]=e))}if(!st(e)&&(E[p]={ref:b,...e},!n))return E}return w(!0),E};function Dt(e,t){const r=Array.isArray(t)?t:ze(t)?[t]:He(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Be(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,i=r[a];return n&&delete n[i],0!==a&&(je(n)&&st(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!Be(e[t]))return!1;return!0}(n))&&Dt(e,r.slice(0,-1)),e}var Vt=()=>{let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}},$t=e=>Le(e)||!Oe(e);function Rt(e,t){if($t(e)||$t(t))return e===t;if(Ne(e)&&Ne(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const a of r){const r=e[a];if(!n.includes(a))return!1;if("ref"!==a){const e=t[a];if(Ne(r)&&Ne(e)||je(r)&&je(e)||Array.isArray(r)&&Array.isArray(e)?!Rt(r,e):r!==e)return!1}}return!0}var Tt=e=>"select-multiple"===e.type,Nt=e=>vt(e)&&e.isConnected,Lt=e=>{for(const t in e)if(yt(e[t]))return!0;return!1};function Ot(e,t={}){const r=Array.isArray(e);if(je(e)||r)for(const r in e)Array.isArray(e[r])||je(e[r])&&!Lt(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Ot(e[r],t[r])):Le(e[r])||(t[r]=!0);return t}function jt(e,t,r){const n=Array.isArray(e);if(je(e)||n)for(const n in e)Array.isArray(e[n])||je(e[n])&&!Lt(e[n])?Be(t)||$t(r[n])?r[n]=Array.isArray(e[n])?Ot(e[n],[]):{...Ot(e[n])}:jt(e[n],Le(t)?{}:t[n],r[n]):r[n]=!Rt(e[n],t[n]);return r}var Pt=(e,t)=>jt(e,t,Ot(t)),Mt=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Be(e)?e:t?""===e?NaN:e?+e:e:r&&ut(e)?new Date(e):n?n(e):e;function Ut(e){const t=e.ref;return pt(t)?t.files:bt(t)?At(e.refs).value:Tt(t)?[...t.selectedOptions].map((({value:e})=>e)):Te(t)?St(e.refs).value:Mt(Be(t.value)?e.ref.value:t.value,e)}var Bt=e=>Be(e)?e:wt(e)?e.source:je(e)?wt(e.value)?e.value.source:e.value:e;const Wt="AsyncFunction";function It(e,t,r){const n=We(e,r);if(n||ze(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),i=We(t,n),o=We(e,n);if(i&&!Array.isArray(i)&&r!==n)return{name:r};if(o&&o.type)return{name:n,error:o};a.pop()}return{name:r}}const zt={mode:Xe,reValidateMode:Ge,shouldFocusError:!0};function Ht(e={}){let t,r={...zt,...e},n={submitCount:0,isDirty:!1,isLoading:yt(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},i=(je(r.defaultValues)||je(r.values))&&Me(r.defaultValues||r.values)||{},o=r.shouldUnregister?{}:Me(i),s={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},u=0;const c={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={values:Vt(),array:Vt(),state:Vt()},f=dt(r.mode),m=dt(r.reValidateMode),h=r.criteriaMode===Ze,p=async e=>{if(!r.disabled&&(c.isValid||e)){const e=r.resolver?st((await w()).errors):await E(a,!0);e!==n.isValid&&d.state.next({isValid:e})}},y=(e,t)=>{r.disabled||!c.isValidating&&!c.validatingFields||((e||Array.from(l.mount)).forEach((e=>{e&&(t?Je(n.validatingFields,e,t):Dt(n.validatingFields,e))})),d.state.next({validatingFields:n.validatingFields,isValidating:!st(n.validatingFields)}))},v=(e,t,r,n)=>{const l=We(a,e);if(l){const a=We(o,e,Be(r)?We(i,e):r);Be(a)||n&&n.defaultChecked||t?Je(o,e,t?a:Ut(l._f)):_(e,a),s.mount&&p()}},g=(e,t,o,s,l)=>{let u=!1,f=!1;const m={name:e};if(!r.disabled){const r=!!(We(a,e)&&We(a,e)._f&&We(a,e)._f.disabled);if(!o||s){c.isDirty&&(f=n.isDirty,n.isDirty=m.isDirty=x(),u=f!==m.isDirty);const a=r||Rt(We(i,e),t);f=!(r||!We(n.dirtyFields,e)),a||r?Dt(n.dirtyFields,e):Je(n.dirtyFields,e,!0),m.dirtyFields=n.dirtyFields,u=u||c.dirtyFields&&f!==!a}if(o){const t=We(n.touchedFields,e);t||(Je(n.touchedFields,e,o),m.touchedFields=n.touchedFields,u=u||c.touchedFields&&t!==o)}u&&l&&d.state.next(m)}return u?m:{}},b=(e,a,i,o)=>{const s=We(n.errors,e),l=c.isValid&&Ie(a)&&n.isValid!==a;var f;if(r.delayError&&i?(f=()=>((e,t)=>{Je(n.errors,e,t),d.state.next({errors:n.errors})})(e,i),t=e=>{clearTimeout(u),u=setTimeout(f,e)},t(r.delayError)):(clearTimeout(u),t=null,i?Je(n.errors,e,i):Dt(n.errors,e)),(i?!Rt(s,i):s)||!st(o)||l){const t={...o,...l&&Ie(a)?{isValid:a}:{},errors:n.errors,name:e};n={...n,...t},d.state.next(t)}},w=async e=>{y(e,!0);const t=await r.resolver(o,r.context,((e,t,r,n)=>{const a={};for(const r of e){const e=We(t,r);e&&Je(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}})(e||l.mount,a,r.criteriaMode,r.shouldUseNativeValidation));return y(e),t},E=async(e,t,a={valid:!0})=>{for(const s in e){const u=e[s];if(u){const{_f:e,...d}=u;if(e){const d=l.array.has(e.name),f=u._f&&(!!(i=u._f)&&!!i.validate&&!!(yt(i.validate)&&i.validate.constructor.name===Wt||je(i.validate)&&Object.values(i.validate).find((e=>e.constructor.name===Wt))));f&&c.validatingFields&&y([s],!0);const m=await Ft(u,l.disabled,o,h,r.shouldUseNativeValidation&&!t,d);if(f&&c.validatingFields&&y([s]),m[e.name]&&(a.valid=!1,t))break;!t&&(We(m,e.name)?d?ht(n.errors,m,e.name):Je(n.errors,e.name,m[e.name]):Dt(n.errors,e.name))}!st(d)&&await E(d,t,a)}}var i;return a.valid},x=(e,t)=>!r.disabled&&(e&&t&&Je(o,e,t),!Rt(V(),i)),S=(e,t,r)=>((e,t,r,n,a)=>ut(e)?(n&&t.watch.add(e),We(r,e,a)):Array.isArray(e)?e.map((e=>(n&&t.watch.add(e),We(r,e)))):(n&&(t.watchAll=!0),r))(e,l,{...s.mount?o:Be(t)?i:ut(e)?{[e]:t}:t},r,t),_=(e,t,r={})=>{const n=We(a,e);let i=t;if(n){const r=n._f;r&&(!r.disabled&&Je(o,e,Mt(t,r)),i=vt(r.ref)&&Le(t)?"":t,Tt(r.ref)?[...r.ref.options].forEach((e=>e.selected=i.includes(e.value))):r.refs?Te(r.ref)?r.refs.length>1?r.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(i)?!!i.find((t=>t===e.value)):i===e.value))):r.refs[0]&&(r.refs[0].checked=!!i):r.refs.forEach((e=>e.checked=e.value===i)):pt(r.ref)?r.ref.value="":(r.ref.value=i,r.ref.type||d.values.next({name:e,values:{...o}})))}(r.shouldDirty||r.shouldTouch)&&g(e,i,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&D(e)},A=(e,t,r)=>{for(const n in t){const i=t[n],o=`${e}.${n}`,s=We(a,o);(l.array.has(e)||je(i)||s&&!s._f)&&!Ne(i)?A(o,i,r):_(o,i,r)}},C=(e,t,r={})=>{const u=We(a,e),f=l.array.has(e),m=Me(t);Je(o,e,m),f?(d.array.next({name:e,values:{...o}}),(c.isDirty||c.dirtyFields)&&r.shouldDirty&&d.state.next({name:e,dirtyFields:Pt(i,o),isDirty:x(e,m)})):!u||u._f||Le(m)?_(e,m,r):A(e,m,r),ft(e,l)&&d.state.next({...n}),d.values.next({name:s.mount?e:void 0,values:{...o}})},k=async e=>{s.mount=!0;const i=e.target;let u=i.name,v=!0;const x=We(a,u),S=()=>i.type?Ut(x._f):(e=>je(e)&&e.target?Te(e.target)?e.target.checked:e.target.value:e)(e),_=e=>{v=Number.isNaN(e)||Ne(e)&&isNaN(e.getTime())||Rt(e,We(o,u,e))};if(x){let i,s;const C=S(),k=e.type===qe||e.type===Ke,F=!((A=x._f).mount&&(A.required||A.min||A.max||A.maxLength||A.minLength||A.pattern||A.validate)||r.resolver||We(n.errors,u)||x._f.deps)||((e,t,r,n,a)=>!a.isOnAll&&(!r&&a.isOnTouch?!(t||e):(r?n.isOnBlur:a.isOnBlur)?!e:!(r?n.isOnChange:a.isOnChange)||e))(k,We(n.touchedFields,u),n.isSubmitted,m,f),V=ft(u,l,k);Je(o,u,C),k?(x._f.onBlur&&x._f.onBlur(e),t&&t(0)):x._f.onChange&&x._f.onChange(e);const $=g(u,C,k,!1),R=!st($)||V;if(!k&&d.values.next({name:u,type:e.type,values:{...o}}),F)return c.isValid&&("onBlur"===r.mode&&k?p():k||p()),R&&d.state.next({name:u,...V?{}:$});if(!k&&V&&d.state.next({...n}),r.resolver){const{errors:e}=await w([u]);if(_(C),v){const t=It(n.errors,a,u),r=It(e,a,t.name||u);i=r.error,u=r.name,s=st(e)}}else y([u],!0),i=(await Ft(x,l.disabled,o,h,r.shouldUseNativeValidation))[u],y([u]),_(C),v&&(i?s=!1:c.isValid&&(s=await E(a,!0)));v&&(x._f.deps&&D(x._f.deps),b(u,s,i,$))}var A},F=(e,t)=>{if(We(n.errors,t)&&e.focus)return e.focus(),1},D=async(e,t={})=>{let i,o;const s=lt(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await w(e);if(e)for(const r of e){const e=We(t,r);e?Je(n.errors,r,e):Dt(n.errors,r)}else n.errors=t;return t})(Be(e)?e:s);i=st(t),o=e?!s.some((e=>We(t,e))):i}else e?(o=(await Promise.all(s.map((async e=>{const t=We(a,e);return await E(t&&t._f?{[e]:t}:t)})))).every(Boolean),(o||n.isValid)&&p()):o=i=await E(a);return d.state.next({...!ut(e)||c.isValid&&i!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:i}:{},errors:n.errors}),t.shouldFocus&&!o&&mt(a,F,e?s:l.mount),o},V=e=>{const t={...s.mount?o:i};return Be(e)?t:ut(e)?We(t,e):e.map((e=>We(t,e)))},$=(e,t)=>({invalid:!!We((t||n).errors,e),isDirty:!!We((t||n).dirtyFields,e),error:We((t||n).errors,e),isValidating:!!We(n.validatingFields,e),isTouched:!!We((t||n).touchedFields,e)}),R=(e,t,r)=>{const i=(We(a,e,{_f:{}})._f||{}).ref,o=We(n.errors,e)||{},{ref:s,message:l,type:u,...c}=o;Je(n.errors,e,{...c,...t,ref:i}),d.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&i&&i.focus&&i.focus()},T=(e,t={})=>{for(const s of e?lt(e):l.mount)l.mount.delete(s),l.array.delete(s),t.keepValue||(Dt(a,s),Dt(o,s)),!t.keepError&&Dt(n.errors,s),!t.keepDirty&&Dt(n.dirtyFields,s),!t.keepTouched&&Dt(n.touchedFields,s),!t.keepIsValidating&&Dt(n.validatingFields,s),!r.shouldUnregister&&!t.keepDefaultValue&&Dt(i,s);d.values.next({values:{...o}}),d.state.next({...n,...t.keepDirty?{isDirty:x()}:{}}),!t.keepIsValid&&p()},N=({disabled:e,name:t,field:r,fields:n})=>{(Ie(e)&&s.mount||e||l.disabled.has(t))&&(e?l.disabled.add(t):l.disabled.delete(t),g(t,Ut(r?r._f:We(n,t)._f),!1,!1,!0))},L=(e,t={})=>{let n=We(a,e);const o=Ie(t.disabled)||Ie(r.disabled);return Je(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),l.mount.add(e),n?N({field:n,disabled:Ie(t.disabled)?t.disabled:r.disabled,name:e}):v(e,!0,t.value),{...o?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:Bt(t.min),max:Bt(t.max),minLength:Bt(t.minLength),maxLength:Bt(t.maxLength),pattern:Bt(t.pattern)}:{},name:e,onChange:k,onBlur:k,ref:o=>{if(o){L(e,t),n=We(a,e);const r=Be(o.value)&&o.querySelectorAll&&o.querySelectorAll("input,select,textarea")[0]||o,s=(e=>bt(e)||Te(e))(r),l=n._f.refs||[];if(s?l.find((e=>e===r)):r===n._f.ref)return;Je(a,e,{_f:{...n._f,...s?{refs:[...l.filter(Nt),r,...Array.isArray(We(i,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),v(e,!1,void 0,r)}else n=We(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!((e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)))(l.array,e)||!s.action)&&l.unMount.add(e)}}},O=()=>r.shouldFocusError&&mt(a,F,l.mount),j=(e,t)=>async i=>{let s;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let u=Me(o);if(l.disabled.size)for(const e of l.disabled)Je(u,e,void 0);if(d.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await w();n.errors=e,u=t}else await E(a);if(Dt(n.errors,"root"),st(n.errors)){d.state.next({errors:{}});try{await e(u,i)}catch(e){s=e}}else t&&await t({...n.errors},i),O(),setTimeout(O);if(d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:st(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},P=(e,t={})=>{const u=e?Me(e):i,f=Me(u),m=st(e),h=m?i:f;if(t.keepDefaultValues||(i=u),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(Pt(i,o))]);for(const t of Array.from(e))We(n.dirtyFields,t)?Je(h,t,We(o,t)):C(t,We(h,t))}else{if(Pe&&Be(e))for(const e of l.mount){const t=We(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(vt(e)){const t=e.closest("form");if(t){t.reset();break}}}}a={}}o=r.shouldUnregister?t.keepDefaultValues?Me(i):{}:Me(h),d.array.next({values:{...h}}),d.values.next({values:{...h}})}l={mount:t.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!c.isValid||!!t.keepIsValid||!!t.keepDirtyValues,s.watch=!!r.shouldUnregister,d.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!m&&(t.keepDirty?n.isDirty:!(!t.keepDefaultValues||Rt(e,i))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:m?{}:t.keepDirtyValues?t.keepDefaultValues&&o?Pt(i,o):n.dirtyFields:t.keepDefaultValues&&e?Pt(i,e):t.keepDirty?n.dirtyFields:{},touchedFields:t.keepTouched?n.touchedFields:{},errors:t.keepErrors?n.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1})},M=(e,t)=>P(yt(e)?e(o):e,t);return{control:{register:L,unregister:T,getFieldState:$,handleSubmit:j,setError:R,_executeSchema:w,_getWatch:S,_getDirty:x,_updateValid:p,_removeUnmounted:()=>{for(const e of l.unMount){const t=We(a,e);t&&(t._f.refs?t._f.refs.every((e=>!Nt(e))):!Nt(t._f.ref))&&T(e)}l.unMount=new Set},_updateFieldArray:(e,t=[],l,u,f=!0,m=!0)=>{if(u&&l&&!r.disabled){if(s.action=!0,m&&Array.isArray(We(a,e))){const t=l(We(a,e),u.argA,u.argB);f&&Je(a,e,t)}if(m&&Array.isArray(We(n.errors,e))){const t=l(We(n.errors,e),u.argA,u.argB);f&&Je(n.errors,e,t),((e,t)=>{!Ue(We(e,t)).length&&Dt(e,t)})(n.errors,e)}if(c.touchedFields&&m&&Array.isArray(We(n.touchedFields,e))){const t=l(We(n.touchedFields,e),u.argA,u.argB);f&&Je(n.touchedFields,e,t)}c.dirtyFields&&(n.dirtyFields=Pt(i,o)),d.state.next({name:e,isDirty:x(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Je(o,e,t)},_updateDisabledField:N,_getFieldArray:e=>Ue(We(s.mount?o:i,e,r.shouldUnregister?We(i,e,[]):[])),_reset:P,_resetDefaultValues:()=>yt(r.defaultValues)&&r.defaultValues().then((e=>{M(e,r.resetOptions),d.state.next({isLoading:!1})})),_updateFormState:e=>{n={...n,...e}},_disableForm:e=>{Ie(e)&&(d.state.next({disabled:e}),mt(a,((t,r)=>{const n=We(a,r);n&&(t.disabled=n._f.disabled||e,Array.isArray(n._f.refs)&&n._f.refs.forEach((t=>{t.disabled=n._f.disabled||e})))}),0,!1))},_subjects:d,_proxyFormState:c,_setErrors:e=>{n.errors=e,d.state.next({errors:n.errors,isValid:!1})},get _fields(){return a},get _formValues(){return o},get _state(){return s},set _state(e){s=e},get _defaultValues(){return i},get _names(){return l},set _names(e){l=e},get _formState(){return n},set _formState(e){n=e},get _options(){return r},set _options(e){r={...r,...e}}},trigger:D,register:L,handleSubmit:j,watch:(e,t)=>yt(e)?d.values.subscribe({next:r=>e(S(void 0,t),r)}):S(e,t,!0),setValue:C,getValues:V,reset:M,resetField:(e,t={})=>{We(a,e)&&(Be(t.defaultValue)?C(e,Me(We(i,e))):(C(e,t.defaultValue),Je(i,e,Me(t.defaultValue))),t.keepTouched||Dt(n.touchedFields,e),t.keepDirty||(Dt(n.dirtyFields,e),n.isDirty=t.defaultValue?x(e,Me(We(i,e))):x()),t.keepError||(Dt(n.errors,e),c.isValid&&p()),d.state.next({...n}))},clearErrors:e=>{e&&lt(e).forEach((e=>Dt(n.errors,e))),d.state.next({errors:e?n.errors:{}})},unregister:T,setError:R,setFocus:(e,t={})=>{const r=We(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&(e.focus(),t.shouldSelect&&yt(e.select)&&e.select())}},getFieldState:$}}function Jt(t={}){const r=e.useRef(void 0),n=e.useRef(void 0),[a,i]=e.useState({isDirty:!1,isValidating:!1,isLoading:yt(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,defaultValues:yt(t.defaultValues)?void 0:t.defaultValues});r.current||(r.current={...Ht(t),formState:a});const o=r.current.control;return o._options=t,function(t){const r=e.useRef(t);r.current=t,e.useEffect((()=>{const e=!t.disabled&&r.current.subject&&r.current.subject.subscribe({next:r.current.next});return()=>{e&&e.unsubscribe()}}),[t.disabled])}({subject:o._subjects.state,next:e=>{((e,t,r)=>{r(e);const{name:n,...a}=e;return st(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find((e=>t[e]===Ze))})(e,o._proxyFormState,o._updateFormState)&&i({...o._formState})}}),e.useEffect((()=>o._disableForm(t.disabled)),[o,t.disabled]),e.useEffect((()=>{if(o._proxyFormState.isDirty){const e=o._getDirty();e!==a.isDirty&&o._subjects.state.next({isDirty:e})}}),[o,a.isDirty]),e.useEffect((()=>{t.values&&!Rt(t.values,n.current)?(o._reset(t.values,o._options.resetOptions),n.current=t.values,i((e=>({...e})))):o._resetDefaultValues()}),[t.values,o]),e.useEffect((()=>{t.errors&&o._setErrors(t.errors)}),[t.errors,o]),e.useEffect((()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()})),e.useEffect((()=>{t.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})}),[t.shouldUnregister,o]),r.current.formState=((e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const r in e)Object.defineProperty(a,r,{get:()=>{const a=r;return t._proxyFormState[a]!==Ze&&(t._proxyFormState[a]=!n||Ze),e[a]}});return a})(a,o),r.current}const qt={getList:(e,t)=>fetch(e,{method:"GET",headers:{"Content-Type":"application/json"},body:JSON.stringify({page:t})}).then((e=>e.json())),create:(e,t)=>fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then((e=>e.json())),details:(e,t)=>fetch(`${e}/${t}`,{method:"GET",headers:{"Content-Type":"application/json"}}).then((e=>e.json())),edit:(e,t)=>fetch(`${e}/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then((e=>e.json()))};function Kt({data:t,screen:r}){const{register:a,handleSubmit:i,reset:o,formState:{errors:s}}=Jt({resolver:n.screens[r.controller].resolver,defaultValues:t}),l=H(),u=n.screens[r.controller].fields;return e.useEffect((()=>{o(t)}),[t,o]),e.createElement("div",{className:"form-wrapper"},e.createElement("form",{onSubmit:i((e=>{t?qt.edit(r.controller,e).then((()=>{l("/"+r.controller,{replace:!0})})):qt.create(r.controller,e).then((()=>{l("/"+r.controller,{replace:!0})}))}))},u.map((t=>e.createElement("div",{className:"form-field",key:t},e.createElement("label",{htmlFor:t},t.charAt(0).toUpperCase()+t.slice(1)),e.createElement("input",{type:"text",...a(t),placeholder:`Enter ${t}`,id:t}),s[t]&&e.createElement("span",{className:"error-message"},s[t]?.message)))),e.createElement("button",{type:"submit",className:"submit-button"},"Submit")))}function Yt({screen:t}){return e.createElement(Re,null,e.createElement(Kt,{screen:t}))}function Gt({screen:t}){const{id:r}=q(),[n,a]=e.useState(null),[i,o]=e.useState(null);return e.useEffect((()=>{t.controller&&r&&qt.details(t.controller,r).then((e=>{a(e.data)})).catch((e=>{o(e),console.error(e)}))}),[r,t]),e.createElement(Re,null,e.createElement("p",{dangerouslySetInnerHTML:{__html:JSON.stringify(n,null," <br/>")}}))}function Xt({screen:t}){const{id:r}=q(),[n,a]=e.useState(null),[i,o]=e.useState(null);return e.useEffect((()=>{t.controller&&r&&qt.details(t.controller,r).then((e=>{a(e.data)})).catch((e=>{o(e),console.error(e)}))}),[r,t]),e.createElement(Re,null,e.createElement(Kt,{data:n,screen:t}))}function Qt({data:t,cells:r,screen:n}){return t&&0!==t.length?e.createElement("div",{className:"list-wrapper"},e.createElement("div",{className:"header"},"List"),e.createElement("table",{className:"list-table"},e.createElement("thead",null,e.createElement("tr",null,r.map((t=>e.createElement("th",{key:t.name},t.title??t.name))),e.createElement("th",null))),e.createElement("tbody",null,t.map(((t,n)=>e.createElement("tr",{key:n},r.map((r=>{const n=t[r.name];let a=n??"-";if("date"===r.type){if(n){const e=new Date(n);a=`${e.getDate().toString().padStart(2,"0")}/${(e.getMonth()+1).toString().padStart(2,"0")}/${e.getFullYear()} ${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}`}}else a=n?n.toString():r?.placeHolder??"-";let i=a;return r.linkTo&&(i=e.createElement(ke,{to:r.linkTo(t)},a)),e.createElement("td",{key:r.name},i)})),e.createElement("td",null,e.createElement(ke,{to:"edit/"+(t?.id??"-")},"Edit"),e.createElement(ke,{to:"details/"+(t?.id??"-")},"Details")))))))):e.createElement("div",null,"No items available")}function Zt({screen:t}){const[r,a]=e.useState(0),[i,o]=e.useState(null),[s,l]=e.useState(null);return e.useEffect((()=>{t.controller&&qt.getList(t.controller,r).then((e=>{o(e.data)})).catch((e=>{l(e),console.error(e)}))}),[r,t.controller]),e.createElement(Re,null,e.createElement(ke,{to:"/maps/create"},"Create"),s?e.createElement("p",null,"Error ",s):null,e.createElement(Qt,{screen:t,cells:n.screens[t.key].cells,data:i}))}exports.Layout=Re,exports.Panel=function({children:t}){return e.createElement(e.Fragment,null,t)},exports.createScreens=function(e){n.screens=e},exports.getScreenForRoutes=function(){const t=Object.entries(n.screens);return e.createElement(e.Fragment,null,t.map((([t,r])=>{let n=`/${r.crud.controller}`;const a={key:t,controller:r.crud.controller};return e.createElement(e.Fragment,{key:"index"},e.createElement(ie,{path:n+"/create",element:e.createElement(Yt,{screen:a})}),e.createElement(ie,{path:n+"/details/:id",element:e.createElement(Gt,{screen:a})}),e.createElement(ie,{path:n+"/edit/:id",element:e.createElement(Xt,{screen:a})}),e.createElement(ie,{path:n,element:e.createElement(Zt,{screen:a})}))})),e.createElement(ie,{path:"*",element:e.createElement("div",null,"404 - Not Found")}))};
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export { createScreens } from "./utils/createScreens";
2
2
  export { getScreenForRoutes } from "./utils/getScreenForRoutes";
3
3
  export { Layout } from "./components/layout/Layout";
4
- export { SideBar } from "./components/layout/SideBar";
5
4
  export { Panel } from "./components/Panel";
package/dist/index.esm.js CHANGED
@@ -9,4 +9,4 @@ import*as e from"react";import t,{useState as r,useEffect as n}from"react";const
9
9
  *
10
10
  * @license MIT
11
11
  */
12
- function l(e,t){if(!1===e||null==e)throw new Error(t)}function u(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function c({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 d(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="/"){return function(e,t,r,n){let a="string"==typeof t?d(t):t,i=C(a.pathname||"/",r);if(null==i)return null;let o=m(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let r=e.length===t.length&&e.slice(0,-1).every(((e,r)=>e===t[r]));return r?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(o);let s=null;for(let e=0;null==s&&e<o.length;++e){let t=A(i);s=S(o[e],t,n)}return s}(e,t,r,!1)}function m(e,t=[],r=[],n=""){let a=(e,a,i)=>{let o={relativePath:void 0===i?e.path||"":i,caseSensitive:!0===e.caseSensitive,childrenIndex:a,route:e};o.relativePath.startsWith("/")&&(l(o.relativePath.startsWith(n),`Absolute route path "${o.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),o.relativePath=o.relativePath.slice(n.length));let s=V([n,o.relativePath]),u=r.concat(o);e.children&&e.children.length>0&&(l(!0!==e.index,`Index routes must not have child routes. Please remove all child routes from route path "${s}".`),m(e.children,t,u,s)),(null!=e.path||e.index)&&t.push({path:s,score:x(s,e.index),routesMeta:u})};return e.forEach(((e,t)=>{if(""!==e.path&&e.path?.includes("?"))for(let r of h(e.path))a(e,t,r);else a(e,t)})),t}function h(e){let t=e.split("/");if(0===t.length)return[];let[r,...n]=t,a=r.endsWith("?"),i=r.replace(/\?$/,"");if(0===n.length)return a?[i,""]:[i];let o=h(n.join("/")),s=[];return s.push(...o.map((e=>""===e?i:[i,e].join("/")))),a&&s.push(...o),s.map((t=>e.startsWith("/")&&""===t?"/":t))}!function(){if(o)return s;o=1,Object.defineProperty(s,"__esModule",{value:!0}),s.parse=function(e,t){const r=new i,n=e.length;if(n<2)return r;const a=t?.decode||c;let o=0;do{const t=e.indexOf("=",o);if(-1===t)break;const i=e.indexOf(";",o),s=-1===i?n:i;if(t>s){o=e.lastIndexOf(";",t-1)+1;continue}const c=l(e,o,t),d=u(e,t,c),f=e.slice(c,d);if(void 0===r[f]){let n=l(e,t+1,s),i=u(e,s,n);const o=a(e.slice(n,i));r[f]=o}o=s+1}while(o<n);return r},s.serialize=function(i,o,s){const l=s?.encode||encodeURIComponent;if(!e.test(i))throw new TypeError(`argument name is invalid: ${i}`);const u=l(o);if(!t.test(u))throw new TypeError(`argument val is invalid: ${o}`);let c=i+"="+u;if(!s)return c;if(void 0!==s.maxAge){if(!Number.isInteger(s.maxAge))throw new TypeError(`option maxAge is invalid: ${s.maxAge}`);c+="; Max-Age="+s.maxAge}if(s.domain){if(!r.test(s.domain))throw new TypeError(`option domain is invalid: ${s.domain}`);c+="; Domain="+s.domain}if(s.path){if(!n.test(s.path))throw new TypeError(`option path is invalid: ${s.path}`);c+="; Path="+s.path}if(s.expires){if(!function(e){return"[object Date]"===a.call(e)}(s.expires)||!Number.isFinite(s.expires.valueOf()))throw new TypeError(`option expires is invalid: ${s.expires}`);c+="; Expires="+s.expires.toUTCString()}s.httpOnly&&(c+="; HttpOnly");s.secure&&(c+="; Secure");s.partitioned&&(c+="; Partitioned");if(s.priority){switch("string"==typeof s.priority?s.priority.toLowerCase():void 0){case"low":c+="; Priority=Low";break;case"medium":c+="; Priority=Medium";break;case"high":c+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${s.priority}`)}}if(s.sameSite){switch("string"==typeof s.sameSite?s.sameSite.toLowerCase():s.sameSite){case!0:case"strict":c+="; SameSite=Strict";break;case"lax":c+="; SameSite=Lax";break;case"none":c+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${s.sameSite}`)}}return c};const e=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,t=/^[\u0021-\u003A\u003C-\u007E]*$/,r=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,n=/^[\u0020-\u003A\u003D-\u007E]*$/,a=Object.prototype.toString,i=(()=>{const e=function(){};return e.prototype=Object.create(null),e})();function l(e,t,r){do{const r=e.charCodeAt(t);if(32!==r&&9!==r)return t}while(++t<r);return r}function u(e,t,r){for(;t>r;){const r=e.charCodeAt(--t);if(32!==r&&9!==r)return t+1}return r}function c(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch(t){return e}}}();var p=/^:[\w-]+$/,y=3,v=2,g=1,b=10,w=-2,E=e=>"*"===e;function x(e,t){let r=e.split("/"),n=r.length;return r.some(E)&&(n+=w),t&&(n+=v),r.filter((e=>!E(e))).reduce(((e,t)=>e+(p.test(t)?y:""===t?g:b)),n)}function S(e,t,r=!1){let{routesMeta:n}=e,a={},i="/",o=[];for(let e=0;e<n.length;++e){let s=n[e],l=e===n.length-1,u="/"===i?t:t.slice(i.length)||"/",c=_({path:s.relativePath,caseSensitive:s.caseSensitive,end:l},u),d=s.route;if(!c&&l&&r&&!n[n.length-1].route.index&&(c=_({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},u)),!c)return null;Object.assign(a,c.params),o.push({params:a,pathname:V([i,c.pathname]),pathnameBase:$(V([i,c.pathnameBase])),route:d}),"/"!==c.pathnameBase&&(i=V([i,c.pathnameBase]))}return o}function _(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=function(e,t=!1,r=!0){u("*"===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=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,r)=>(n.push({paramName:t,isOptional:null!=r}),r?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(n.push({paramName:"*"}),a+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":""!==e&&"/"!==e&&(a+="(?:(?=\\/|$))");let i=new RegExp(a,t?void 0:"i");return[i,n]}(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let i=a[0],o=i.replace(/(.)\/+$/,"$1"),s=a.slice(1);return{params:n.reduce(((e,{paramName:t,isOptional:r},n)=>{if("*"===t){let e=s[n]||"";o=i.slice(0,i.length-e.length).replace(/(.)\/+$/,"$1")}const a=s[n];return e[t]=r&&!a?void 0:(a||"").replace(/%2F/g,"/"),e}),{}),pathname:i,pathnameBase:o,pattern:e}}function A(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return u(!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}}function C(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 k(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 F(e){let t=function(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}(e);return t.map(((e,r)=>r===t.length-1?e.pathname:e.pathnameBase))}function D(e,t,r,n=!1){let a;"string"==typeof e?a=d(e):(a={...e},l(!a.pathname||!a.pathname.includes("?"),k("?","pathname","search",a)),l(!a.pathname||!a.pathname.includes("#"),k("#","pathname","hash",a)),l(!a.search||!a.search.includes("#"),k("#","search","hash",a)));let i,o=""===e||""===a.pathname,s=o?"/":a.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;a.pathname=t.join("/")}i=e>=0?t[e]:"/"}let u=function(e,t="/"){let{pathname:r,search:n="",hash:a=""}="string"==typeof e?d(e):e,i=r?r.startsWith("/")?r:function(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)})),r.length>1?r.join("/"):"/"}(r,t):t;return{pathname:i,search:R(n),hash:T(a)}}(a,i),c=s&&"/"!==s&&s.endsWith("/"),f=(o||"."===s)&&r.endsWith("/");return u.pathname.endsWith("/")||!c&&!f||(u.pathname+="/"),u}var V=e=>e.join("/").replace(/\/\/+/g,"/"),$=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),R=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",T=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";var N=["POST","PUT","PATCH","DELETE"];new Set(N);var L=["GET",...N];new Set(L);var O=e.createContext(null);O.displayName="DataRouter";var P=e.createContext(null);P.displayName="DataRouterState";var j=e.createContext({isTransitioning:!1});j.displayName="ViewTransition",e.createContext(new Map).displayName="Fetchers",e.createContext(null).displayName="Await";var M=e.createContext(null);M.displayName="Navigation";var U=e.createContext(null);U.displayName="Location";var B=e.createContext({outlet:null,matches:[],isDataRoute:!1});B.displayName="Route";var W=e.createContext(null);function I(){return null!=e.useContext(U)}function H(){return l(I(),"useLocation() may be used only in the context of a <Router> component."),e.useContext(U).location}W.displayName="RouteError";var z="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function J(t){e.useContext(M).static||e.useLayoutEffect(t)}function q(){let{isDataRoute:t}=e.useContext(B);return t?function(){let{router:t}=function(t){let r=e.useContext(O);return l(r,re(t)),r}("useNavigate"),r=ne("useNavigate"),n=e.useRef(!1);return J((()=>{n.current=!0})),e.useCallback((async(e,a={})=>{u(n.current,z),n.current&&("number"==typeof e?t.navigate(e):await t.navigate(e,{fromRouteId:r,...a}))}),[t,r])}():function(){l(I(),"useNavigate() may be used only in the context of a <Router> component.");let t=e.useContext(O),{basename:r,navigator:n}=e.useContext(M),{matches:a}=e.useContext(B),{pathname:i}=H(),o=JSON.stringify(F(a)),s=e.useRef(!1);return J((()=>{s.current=!0})),e.useCallback(((e,a={})=>{if(u(s.current,z),!s.current)return;if("number"==typeof e)return void n.go(e);let l=D(e,JSON.parse(o),i,"path"===a.relative);null==t&&"/"!==r&&(l.pathname="/"===l.pathname?r:V([r,l.pathname])),(a.replace?n.replace:n.push)(l,a.state,a)}),[r,n,o,i,t])}()}var K=e.createContext(null);function Y(){let{matches:t}=e.useContext(B),r=t[t.length-1];return r?r.params:{}}function G(t,{relative:r}={}){let{matches:n}=e.useContext(B),{pathname:a}=H(),i=JSON.stringify(F(n));return e.useMemo((()=>D(t,JSON.parse(i),a,"path"===r)),[t,i,a,r])}function X(t,r,n,a){l(I(),"useRoutes() may be used only in the context of a <Router> component.");let i,{navigator:o,static:s}=e.useContext(M),{matches:c}=e.useContext(B),d=c[c.length-1],m=d?d.params:{},h=d?d.pathname:"/",p=d?d.pathnameBase:"/",y=d&&d.route;{let e=y&&y.path||"";ie(h,!y||e.endsWith("*")||e.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.\n\nPlease change the parent <Route path="${e}"> to <Route path="${"/"===e?"*":`${e}/*`}">.`)}i=H();let v=i.pathname||"/",g=v;if("/"!==p){let e=p.replace(/^\//,"").split("/");g="/"+v.replace(/^\//,"").split("/").slice(e.length).join("/")}let b=!s&&n&&n.matches&&n.matches.length>0?n.matches:f(t,{pathname:g});u(y||null!=b,`No routes matched location "${i.pathname}${i.search}${i.hash}" `),u(null==b||void 0!==b[b.length-1].route.element||void 0!==b[b.length-1].route.Component||void 0!==b[b.length-1].route.lazy,`Matched leaf route at location "${i.pathname}${i.search}${i.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let w=function(t,r=[],n=null){if(null==t){if(!n)return null;if(n.errors)t=n.matches;else{if(0!==r.length||n.initialized||!(n.matches.length>0))return null;t=n.matches}}let a=t,i=n?.errors;if(null!=i){let e=a.findIndex((e=>e.route.id&&void 0!==i?.[e.route.id]));l(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),a=a.slice(0,Math.min(a.length,e+1))}let o=!1,s=-1;if(n)for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:r}=n,i=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!r||void 0===r[t.route.id]);if(t.route.lazy||i){o=!0,a=s>=0?a.slice(0,s+1):[a[0]];break}}}return a.reduceRight(((t,l,u)=>{let c,d=!1,f=null,m=null;n&&(c=i&&l.route.id?i[l.route.id]:void 0,f=l.route.errorElement||Z,o&&(s<0&&0===u?(ie("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,m=null):s===u&&(d=!0,m=l.route.hydrateFallbackElement||null)));let h=r.concat(a.slice(0,u+1)),p=()=>{let r;return r=c?f:d?m:l.route.Component?e.createElement(l.route.Component,null):l.route.element?l.route.element:t,e.createElement(te,{match:l,routeContext:{outlet:t,matches:h,isDataRoute:null!=n},children:r})};return n&&(l.route.ErrorBoundary||l.route.errorElement||0===u)?e.createElement(ee,{location:n.location,revalidation:n.revalidation,component:f,error:c,children:p(),routeContext:{outlet:null,matches:h,isDataRoute:!0}}):p()}),null)}(b&&b.map((e=>Object.assign({},e,{params:Object.assign({},m,e.params),pathname:V([p,o.encodeLocation?o.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?p:V([p,o.encodeLocation?o.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),c,n,a);return w}function Q(){let t=function(){let t=e.useContext(W),r=function(t){let r=e.useContext(P);return l(r,re(t)),r}("useRouteError"),n=ne("useRouteError");if(void 0!==t)return t;return r.errors?.[n]}(),r=function(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,a="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},s=null;return console.error("Error handled by React Router default ErrorBoundary:",t),s=e.createElement(e.Fragment,null,e.createElement("p",null,"💿 Hey developer 👋"),e.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",e.createElement("code",{style:o},"ErrorBoundary")," or"," ",e.createElement("code",{style:o},"errorElement")," prop on your route.")),e.createElement(e.Fragment,null,e.createElement("h2",null,"Unexpected Application Error!"),e.createElement("h3",{style:{fontStyle:"italic"}},r),n?e.createElement("pre",{style:i},n):null,s)}var Z=e.createElement(Q,null),ee=class extends e.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}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){console.error("React Router caught the following error during render",e,t)}render(){return void 0!==this.state.error?e.createElement(B.Provider,{value:this.props.routeContext},e.createElement(W.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function te({routeContext:t,match:r,children:n}){let a=e.useContext(O);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),e.createElement(B.Provider,{value:t},n)}function re(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ne(t){let r=function(t){let r=e.useContext(B);return l(r,re(t)),r}(t),n=r.matches[r.matches.length-1];return l(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}var ae={};function ie(e,t,r){t||ae[e]||(ae[e]=!0,u(!1,r))}function oe(t){return function(t){let r=e.useContext(B).outlet;return r?e.createElement(K.Provider,{value:t},r):r}(t.context)}function se(e){l(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}e.memo((function({routes:e,future:t,state:r}){return X(e,0,r,t)}));var le="get",ue="application/x-www-form-urlencoded";function ce(e){return null!=e&&"string"==typeof e.tagName}var de=null;var fe=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function me(e){return null==e||fe.has(e)?e:(u(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ue}"`),null)}function he(e,t){let r,n,a,i,o;if(ce(s=e)&&"form"===s.tagName.toLowerCase()){let o=e.getAttribute("action");n=o?C(o,t):null,r=e.getAttribute("method")||le,a=me(e.getAttribute("enctype"))||ue,i=new FormData(e)}else if(function(e){return ce(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return ce(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let o=e.form;if(null==o)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||o.getAttribute("action");if(n=s?C(s,t):null,r=e.getAttribute("formmethod")||o.getAttribute("method")||le,a=me(e.getAttribute("formenctype"))||me(o.getAttribute("enctype"))||ue,i=new FormData(o,e),!function(){if(null===de)try{new FormData(document.createElement("form"),0),de=!1}catch(e){de=!0}return de}()){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(ce(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=le,n=null,a=ue,o=e}var s;return i&&"text/plain"===a&&(o=i,i=void 0),{action:n,method:r.toLowerCase(),encType:a,formData:i,body:o}}function pe(e,t){if(!1===e||null==e)throw new Error(t)}function ye(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 ve(e,t,r){return function(e,t){let r=new Set;return new Set(t),e.reduce(((e,t)=>{let n=JSON.stringify(function(e){let t={},r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}(t));return r.has(n)||(r.add(n),e.push({key:n,link:t})),e}),[])}((await Promise.all(e.map((async e=>{let n=t.routes[e.route.id];if(n){let e=await async function(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){if(console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode&&import.meta.hot)throw t;return window.location.reload(),new Promise((()=>{}))}}(n,r);return e.links?e.links():[]}return[]})))).flat(1).filter(ye).filter((e=>"stylesheet"===e.rel||"preload"===e.rel)).map((e=>"stylesheet"===e.rel?{...e,rel:"prefetch",as:"style"}:{...e,rel:"prefetch"})))}function ge(e,t,r,n,a,i){let o=(e,t)=>!r[t]||e.route.id!==r[t].route.id,s=(e,t)=>r[t].pathname!==e.pathname||r[t].route.path?.endsWith("*")&&r[t].params["*"]!==e.params["*"];return"assets"===i?t.filter(((e,t)=>o(e,t)||s(e,t))):"data"===i?t.filter(((t,i)=>{let l=n.routes[t.route.id];if(!l||!l.hasLoader)return!1;if(o(t,i)||s(t,i))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})):[]}function be(e,t,{includeHydrateFallback:r}={}){return n=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),[...new Set(n)];var n}function we(){let t=e.useContext(O);return pe(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}var Ee=e.createContext(void 0);function xe(){let t=e.useContext(Ee);return pe(t,"You must render this element inside a <HydratedRouter> element"),t}function Se(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function _e({page:t,...r}){let{router:n}=we(),a=e.useMemo((()=>f(n.routes,t,n.basename)),[n.routes,t,n.basename]);return a?e.createElement(Ae,{page:t,matches:a,...r}):null}function Ae({page:t,matches:r,...n}){let a=H(),{manifest:i,routeModules:o}=xe(),{basename:s}=we(),{loaderData:l,matches:u}=function(){let t=e.useContext(P);return pe(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}(),c=e.useMemo((()=>ge(t,r,u,i,a,"data")),[t,r,u,i,a]),d=e.useMemo((()=>ge(t,r,u,i,a,"assets")),[t,r,u,i,a]),f=e.useMemo((()=>{if(t===a.pathname+a.search+a.hash)return[];let e=new Set,n=!1;if(r.forEach((t=>{let r=i.routes[t.route.id];r&&r.hasLoader&&(!c.some((e=>e.route.id===t.route.id))&&t.route.id in l&&o[t.route.id]?.shouldRevalidate||r.hasClientLoader?n=!0:e.add(t.route.id))})),0===e.size)return[];let u=function(e,t){let r="string"==typeof e?new URL(e,"undefined"==typeof window?"server://singlefetch/":window.location.origin):e;return"/"===r.pathname?r.pathname="_root.data":t&&"/"===C(r.pathname,t)?r.pathname=`${t.replace(/\/$/,"")}/_root.data`:r.pathname=`${r.pathname.replace(/\/$/,"")}.data`,r}(t,s);return n&&e.size>0&&u.searchParams.set("_routes",r.filter((t=>e.has(t.route.id))).map((e=>e.route.id)).join(",")),[u.pathname+u.search]}),[s,l,a,i,c,r,t,o]),m=e.useMemo((()=>be(d,i)),[d,i]),h=function(t){let{manifest:r,routeModules:n}=xe(),[a,i]=e.useState([]);return e.useEffect((()=>{let e=!1;return ve(t,r,n).then((t=>{e||i(t)})),()=>{e=!0}}),[t,r,n]),a}(d);return e.createElement(e.Fragment,null,f.map((t=>e.createElement("link",{key:t,rel:"prefetch",as:"fetch",href:t,...n}))),m.map((t=>e.createElement("link",{key:t,rel:"modulepreload",href:t,...n}))),h.map((({key:t,link:r})=>e.createElement("link",{key:t,...r}))))}function Ce(...e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}Ee.displayName="FrameworkContext";var ke="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;try{ke&&(window.__reactRouterVersion="7.3.0")}catch(e){}var Fe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,De=e.forwardRef((function({onClick:t,discover:r="render",prefetch:n="none",relative:a,reloadDocument:i,replace:o,state:s,target:d,to:f,preventScrollReset:m,viewTransition:h,...p},y){let v,{basename:g}=e.useContext(M),b="string"==typeof f&&Fe.test(f),w=!1;if("string"==typeof f&&b&&(v=f,ke))try{let e=new URL(window.location.href),t=f.startsWith("//")?new URL(e.protocol+f):new URL(f),r=C(t.pathname,g);t.origin===e.origin&&null!=r?f=r+t.search+t.hash:w=!0}catch(e){u(!1,`<Link to="${f}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let E=function(t,{relative:r}={}){l(I(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=e.useContext(M),{hash:i,pathname:o,search:s}=G(t,{relative:r}),u=o;return"/"!==n&&(u="/"===o?n:V([n,o])),a.createHref({pathname:u,search:s,hash:i})}(f,{relative:a}),[x,S,_]=function(t,r){let n=e.useContext(Ee),[a,i]=e.useState(!1),[o,s]=e.useState(!1),{onFocus:l,onBlur:u,onMouseEnter:c,onMouseLeave:d,onTouchStart:f}=r,m=e.useRef(null);e.useEffect((()=>{if("render"===t&&s(!0),"viewport"===t){let e=new IntersectionObserver((e=>{e.forEach((e=>{s(e.isIntersecting)}))}),{threshold:.5});return m.current&&e.observe(m.current),()=>{e.disconnect()}}}),[t]),e.useEffect((()=>{if(a){let e=setTimeout((()=>{s(!0)}),100);return()=>{clearTimeout(e)}}}),[a]);let h=()=>{i(!0)},p=()=>{i(!1),s(!1)};return n?"intent"!==t?[o,m,{}]:[o,m,{onFocus:Se(l,h),onBlur:Se(u,p),onMouseEnter:Se(c,h),onMouseLeave:Se(d,p),onTouchStart:Se(f,h)}]:[!1,m,{}]}(n,p),A=function(t,{target:r,replace:n,state:a,preventScrollReset:i,relative:o,viewTransition:s}={}){let l=q(),u=H(),d=G(t,{relative:o});return e.useCallback((e=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(e,r)){e.preventDefault();let r=void 0!==n?n:c(u)===c(d);l(t,{replace:r,state:a,preventScrollReset:i,relative:o,viewTransition:s})}}),[u,l,d,n,a,r,t,i,o,s])}(f,{replace:o,state:s,target:d,preventScrollReset:m,relative:a,viewTransition:h});let k=e.createElement("a",{...p,..._,href:v||E,onClick:w||i?t:function(e){t&&t(e),e.defaultPrevented||A(e)},ref:Ce(y,S),target:d,"data-discover":b||"render"!==r?void 0:"true"});return x&&!b?e.createElement(e.Fragment,null,k,e.createElement(_e,{page:E})):k}));function Ve(t){let r=e.useContext(O);return l(r,function(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}(t)),r}De.displayName="Link",e.forwardRef((function({"aria-current":t="page",caseSensitive:r=!1,className:n="",end:a=!1,style:i,to:o,viewTransition:s,children:u,...c},d){let f=G(o,{relative:c.relative}),m=H(),h=e.useContext(P),{navigator:p,basename:y}=e.useContext(M),v=null!=h&&function(t,r={}){let n=e.useContext(j);l(null!=n,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=Ve("useViewTransitionState"),i=G(t,{relative:r.relative});if(!n.isTransitioning)return!1;let o=C(n.currentLocation.pathname,a)||n.currentLocation.pathname,s=C(n.nextLocation.pathname,a)||n.nextLocation.pathname;return null!=_(i.pathname,s)||null!=_(i.pathname,o)}(f)&&!0===s,g=p.encodeLocation?p.encodeLocation(f).pathname:f.pathname,b=m.pathname,w=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;r||(b=b.toLowerCase(),w=w?w.toLowerCase():null,g=g.toLowerCase()),w&&y&&(w=C(w,y)||w);const E="/"!==g&&g.endsWith("/")?g.length-1:g.length;let x,S=b===g||!a&&b.startsWith(g)&&"/"===b.charAt(E),A=null!=w&&(w===g||!a&&w.startsWith(g)&&"/"===w.charAt(g.length)),k={isActive:S,isPending:A,isTransitioning:v},F=S?t:void 0;x="function"==typeof n?n(k):[n,S?"active":null,A?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let D="function"==typeof i?i(k):i;return e.createElement(De,{...c,"aria-current":F,className:x,ref:d,style:D,to:o,viewTransition:s},"function"==typeof u?u(k):u)})).displayName="NavLink",e.forwardRef((({discover:t="render",fetcherKey:r,navigate:n,reloadDocument:a,replace:i,state:o,method:s=le,action:u,onSubmit:d,relative:f,preventScrollReset:m,viewTransition:h,...p},y)=>{let v=function(){let{router:t}=Ve("useSubmit"),{basename:r}=e.useContext(M),n=ne("useRouteId");return e.useCallback((async(e,a={})=>{let{action:i,method:o,encType:s,formData:l,body:u}=he(e,r);if(!1===a.navigate){let e=a.fetcherKey||Re();await t.fetch(e,n,a.action||i,{preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||o,formEncType:a.encType||s,flushSync:a.flushSync})}else await t.navigate(a.action||i,{preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||o,formEncType:a.encType||s,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})}),[t,r,n])}(),g=function(t,{relative:r}={}){let{basename:n}=e.useContext(M),a=e.useContext(B);l(a,"useFormAction must be used inside a RouteContext");let[i]=a.matches.slice(-1),o={...G(t||".",{relative:r})},s=H();if(null==t){o.search=s.search;let e=new URLSearchParams(o.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();o.search=r?`?${r}`:""}}t&&"."!==t||!i.route.index||(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index");"/"!==n&&(o.pathname="/"===o.pathname?n:V([n,o.pathname]));return c(o)}(u,{relative:f}),b="get"===s.toLowerCase()?"get":"post",w="string"==typeof u&&Fe.test(u);return e.createElement("form",{ref:y,method:b,action:g,onSubmit:a?d:e=>{if(d&&d(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter,a=t?.getAttribute("formmethod")||s;v(t||e.currentTarget,{fetcherKey:r,method:a,navigate:n,replace:i,state:o,relative:f,preventScrollReset:m,viewTransition:h})},...p,"data-discover":w||"render"!==t?void 0:"true"})})).displayName="Form";var $e=0,Re=()=>`__${String(++$e)}__`;function Te(){const[e,n]=r(!0);return t.createElement("div",{className:"sidebar "+(e?"open":"closed")},t.createElement("button",{className:"toggle-button",onClick:()=>n(!e)},e?"<":">"),t.createElement("nav",{className:"nav-links"},t.createElement(De,{to:"/"},"Home"),t.createElement(De,{to:"/accounts"},"Accounts"),t.createElement(De,{to:"/maps"},"Maps"),t.createElement("div",{className:"bottom-link"},t.createElement(De,{to:"/settings"},"Settings"))))}function Ne({children:e,noSidebar:r=!1}){return t.createElement("div",{className:"layout"},!r&&t.createElement(Te,null),t.createElement("main",{className:"content"},e||t.createElement(oe,null)))}new TextEncoder;var Le=e=>"checkbox"===e.type,Oe=e=>e instanceof Date,Pe=e=>null==e;const je=e=>"object"==typeof e;var Me=e=>!Pe(e)&&!Array.isArray(e)&&je(e)&&!Oe(e),Ue="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function Be(e){let t;const r=Array.isArray(e),n="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(Ue&&(e instanceof Blob||n)||!r&&!Me(e))return e;if(t=r?[]:{},r||(e=>{const t=e.constructor&&e.constructor.prototype;return Me(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const r in e)e.hasOwnProperty(r)&&(t[r]=Be(e[r]));else t=e}return t}var We=e=>Array.isArray(e)?e.filter(Boolean):[],Ie=e=>void 0===e,He=(e,t,r)=>{if(!t||!Me(e))return r;const n=We(t.split(/[,[\].]+?/)).reduce(((e,t)=>Pe(e)?e:e[t]),e);return Ie(n)||n===e?Ie(e[t])?r:e[t]:n},ze=e=>"boolean"==typeof e,Je=e=>/^\w*$/.test(e),qe=e=>We(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Ke=(e,t,r)=>{let n=-1;const a=Je(t)?[t]:qe(t),i=a.length,o=i-1;for(;++n<i;){const t=a[n];let i=r;if(n!==o){const r=e[t];i=Me(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=i,e=e[t]}return e};const Ye="blur",Ge="focusout",Xe="onBlur",Qe="onChange",Ze="onSubmit",et="onTouched",tt="all",rt="max",nt="min",at="maxLength",it="minLength",ot="pattern",st="required",lt="validate";t.createContext(null);var ut=e=>Me(e)&&!Object.keys(e).length,ct=e=>Array.isArray(e)?e:[e];var dt=e=>"string"==typeof e,ft=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},mt=e=>({isOnSubmit:!e||e===Ze,isOnBlur:e===Xe,isOnChange:e===Qe,isOnAll:e===tt,isOnTouch:e===et}),ht=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const pt=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const r=He(e,a);if(r){const{_f:e,...i}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],a)&&!n)return!0;if(e.ref&&t(e.ref,e.name)&&!n)return!0;if(pt(i,t))break}else if(Me(i)&&pt(i,t))break}}};var yt=(e,t,r)=>{const n=ct(He(e,r));return Ke(n,"root",t[r]),Ke(e,r,n),e},vt=e=>"file"===e.type,gt=e=>"function"==typeof e,bt=e=>{if(!Ue)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},wt=e=>dt(e),Et=e=>"radio"===e.type,xt=e=>e instanceof RegExp;const St={value:!1,isValid:!1},_t={value:!0,isValid:!0};var At=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ie(e[0].attributes.value)?Ie(e[0].value)||""===e[0].value?_t:{value:e[0].value,isValid:!0}:_t:St}return St};const Ct={isValid:!1,value:null};var kt=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),Ct):Ct;function Ft(e,t,r="validate"){if(wt(e)||Array.isArray(e)&&e.every(wt)||ze(e)&&!e)return{type:r,message:wt(e)?e:"",ref:t}}var Dt=e=>Me(e)&&!xt(e)?e:{value:e,message:""},Vt=async(e,t,r,n,a,i)=>{const{ref:o,refs:s,required:l,maxLength:u,minLength:c,min:d,max:f,pattern:m,validate:h,name:p,valueAsNumber:y,mount:v}=e._f,g=He(r,p);if(!v||t.has(p))return{};const b=s?s[0]:o,w=e=>{a&&b.reportValidity&&(b.setCustomValidity(ze(e)?"":e||""),b.reportValidity())},E={},x=Et(o),S=Le(o),_=x||S,A=(y||vt(o))&&Ie(o.value)&&Ie(g)||bt(o)&&""===o.value||""===g||Array.isArray(g)&&!g.length,C=ft.bind(null,p,n,E),k=(e,t,r,n=at,a=it)=>{const i=e?t:r;E[p]={type:e?n:a,message:i,ref:o,...C(e?n:a,i)}};if(i?!Array.isArray(g)||!g.length:l&&(!_&&(A||Pe(g))||ze(g)&&!g||S&&!At(s).isValid||x&&!kt(s).isValid)){const{value:e,message:t}=wt(l)?{value:!!l,message:l}:Dt(l);if(e&&(E[p]={type:st,message:t,ref:b,...C(st,t)},!n))return w(t),E}if(!(A||Pe(d)&&Pe(f))){let e,t;const r=Dt(f),a=Dt(d);if(Pe(g)||isNaN(g)){const n=o.valueAsDate||new Date(g),i=e=>new Date((new Date).toDateString()+" "+e),s="time"==o.type,l="week"==o.type;dt(r.value)&&g&&(e=s?i(g)>i(r.value):l?g>r.value:n>new Date(r.value)),dt(a.value)&&g&&(t=s?i(g)<i(a.value):l?g<a.value:n<new Date(a.value))}else{const n=o.valueAsNumber||(g?+g:g);Pe(r.value)||(e=n>r.value),Pe(a.value)||(t=n<a.value)}if((e||t)&&(k(!!e,r.message,a.message,rt,nt),!n))return w(E[p].message),E}if((u||c)&&!A&&(dt(g)||i&&Array.isArray(g))){const e=Dt(u),t=Dt(c),r=!Pe(e.value)&&g.length>+e.value,a=!Pe(t.value)&&g.length<+t.value;if((r||a)&&(k(r,e.message,t.message),!n))return w(E[p].message),E}if(m&&!A&&dt(g)){const{value:e,message:t}=Dt(m);if(xt(e)&&!g.match(e)&&(E[p]={type:ot,message:t,ref:o,...C(ot,t)},!n))return w(t),E}if(h)if(gt(h)){const e=Ft(await h(g,r),b);if(e&&(E[p]={...e,...C(lt,e.message)},!n))return w(e.message),E}else if(Me(h)){let e={};for(const t in h){if(!ut(e)&&!n)break;const a=Ft(await h[t](g,r),b,t);a&&(e={...a,...C(t,a.message)},w(a.message),n&&(E[p]=e))}if(!ut(e)&&(E[p]={ref:b,...e},!n))return E}return w(!0),E};function $t(e,t){const r=Array.isArray(t)?t:Je(t)?[t]:qe(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Ie(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,i=r[a];return n&&delete n[i],0!==a&&(Me(n)&&ut(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!Ie(e[t]))return!1;return!0}(n))&&$t(e,r.slice(0,-1)),e}var Rt=()=>{let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}},Tt=e=>Pe(e)||!je(e);function Nt(e,t){if(Tt(e)||Tt(t))return e===t;if(Oe(e)&&Oe(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const a of r){const r=e[a];if(!n.includes(a))return!1;if("ref"!==a){const e=t[a];if(Oe(r)&&Oe(e)||Me(r)&&Me(e)||Array.isArray(r)&&Array.isArray(e)?!Nt(r,e):r!==e)return!1}}return!0}var Lt=e=>"select-multiple"===e.type,Ot=e=>bt(e)&&e.isConnected,Pt=e=>{for(const t in e)if(gt(e[t]))return!0;return!1};function jt(e,t={}){const r=Array.isArray(e);if(Me(e)||r)for(const r in e)Array.isArray(e[r])||Me(e[r])&&!Pt(e[r])?(t[r]=Array.isArray(e[r])?[]:{},jt(e[r],t[r])):Pe(e[r])||(t[r]=!0);return t}function Mt(e,t,r){const n=Array.isArray(e);if(Me(e)||n)for(const n in e)Array.isArray(e[n])||Me(e[n])&&!Pt(e[n])?Ie(t)||Tt(r[n])?r[n]=Array.isArray(e[n])?jt(e[n],[]):{...jt(e[n])}:Mt(e[n],Pe(t)?{}:t[n],r[n]):r[n]=!Nt(e[n],t[n]);return r}var Ut=(e,t)=>Mt(e,t,jt(t)),Bt=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Ie(e)?e:t?""===e?NaN:e?+e:e:r&&dt(e)?new Date(e):n?n(e):e;function Wt(e){const t=e.ref;return vt(t)?t.files:Et(t)?kt(e.refs).value:Lt(t)?[...t.selectedOptions].map((({value:e})=>e)):Le(t)?At(e.refs).value:Bt(Ie(t.value)?e.ref.value:t.value,e)}var It=e=>Ie(e)?e:xt(e)?e.source:Me(e)?xt(e.value)?e.value.source:e.value:e;const Ht="AsyncFunction";function zt(e,t,r){const n=He(e,r);if(n||Je(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),i=He(t,n),o=He(e,n);if(i&&!Array.isArray(i)&&r!==n)return{name:r};if(o&&o.type)return{name:n,error:o};a.pop()}return{name:r}}const Jt={mode:Ze,reValidateMode:Qe,shouldFocusError:!0};function qt(e={}){let t,r={...Jt,...e},n={submitCount:0,isDirty:!1,isLoading:gt(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},i=(Me(r.defaultValues)||Me(r.values))&&Be(r.defaultValues||r.values)||{},o=r.shouldUnregister?{}:Be(i),s={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},u=0;const c={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={values:Rt(),array:Rt(),state:Rt()},f=mt(r.mode),m=mt(r.reValidateMode),h=r.criteriaMode===tt,p=async e=>{if(!r.disabled&&(c.isValid||e)){const e=r.resolver?ut((await w()).errors):await E(a,!0);e!==n.isValid&&d.state.next({isValid:e})}},y=(e,t)=>{r.disabled||!c.isValidating&&!c.validatingFields||((e||Array.from(l.mount)).forEach((e=>{e&&(t?Ke(n.validatingFields,e,t):$t(n.validatingFields,e))})),d.state.next({validatingFields:n.validatingFields,isValidating:!ut(n.validatingFields)}))},v=(e,t,r,n)=>{const l=He(a,e);if(l){const a=He(o,e,Ie(r)?He(i,e):r);Ie(a)||n&&n.defaultChecked||t?Ke(o,e,t?a:Wt(l._f)):_(e,a),s.mount&&p()}},g=(e,t,o,s,l)=>{let u=!1,f=!1;const m={name:e};if(!r.disabled){const r=!!(He(a,e)&&He(a,e)._f&&He(a,e)._f.disabled);if(!o||s){c.isDirty&&(f=n.isDirty,n.isDirty=m.isDirty=x(),u=f!==m.isDirty);const a=r||Nt(He(i,e),t);f=!(r||!He(n.dirtyFields,e)),a||r?$t(n.dirtyFields,e):Ke(n.dirtyFields,e,!0),m.dirtyFields=n.dirtyFields,u=u||c.dirtyFields&&f!==!a}if(o){const t=He(n.touchedFields,e);t||(Ke(n.touchedFields,e,o),m.touchedFields=n.touchedFields,u=u||c.touchedFields&&t!==o)}u&&l&&d.state.next(m)}return u?m:{}},b=(e,a,i,o)=>{const s=He(n.errors,e),l=c.isValid&&ze(a)&&n.isValid!==a;var f;if(r.delayError&&i?(f=()=>((e,t)=>{Ke(n.errors,e,t),d.state.next({errors:n.errors})})(e,i),t=e=>{clearTimeout(u),u=setTimeout(f,e)},t(r.delayError)):(clearTimeout(u),t=null,i?Ke(n.errors,e,i):$t(n.errors,e)),(i?!Nt(s,i):s)||!ut(o)||l){const t={...o,...l&&ze(a)?{isValid:a}:{},errors:n.errors,name:e};n={...n,...t},d.state.next(t)}},w=async e=>{y(e,!0);const t=await r.resolver(o,r.context,((e,t,r,n)=>{const a={};for(const r of e){const e=He(t,r);e&&Ke(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}})(e||l.mount,a,r.criteriaMode,r.shouldUseNativeValidation));return y(e),t},E=async(e,t,a={valid:!0})=>{for(const s in e){const u=e[s];if(u){const{_f:e,...d}=u;if(e){const d=l.array.has(e.name),f=u._f&&(!!(i=u._f)&&!!i.validate&&!!(gt(i.validate)&&i.validate.constructor.name===Ht||Me(i.validate)&&Object.values(i.validate).find((e=>e.constructor.name===Ht))));f&&c.validatingFields&&y([s],!0);const m=await Vt(u,l.disabled,o,h,r.shouldUseNativeValidation&&!t,d);if(f&&c.validatingFields&&y([s]),m[e.name]&&(a.valid=!1,t))break;!t&&(He(m,e.name)?d?yt(n.errors,m,e.name):Ke(n.errors,e.name,m[e.name]):$t(n.errors,e.name))}!ut(d)&&await E(d,t,a)}}var i;return a.valid},x=(e,t)=>!r.disabled&&(e&&t&&Ke(o,e,t),!Nt(V(),i)),S=(e,t,r)=>((e,t,r,n,a)=>dt(e)?(n&&t.watch.add(e),He(r,e,a)):Array.isArray(e)?e.map((e=>(n&&t.watch.add(e),He(r,e)))):(n&&(t.watchAll=!0),r))(e,l,{...s.mount?o:Ie(t)?i:dt(e)?{[e]:t}:t},r,t),_=(e,t,r={})=>{const n=He(a,e);let i=t;if(n){const r=n._f;r&&(!r.disabled&&Ke(o,e,Bt(t,r)),i=bt(r.ref)&&Pe(t)?"":t,Lt(r.ref)?[...r.ref.options].forEach((e=>e.selected=i.includes(e.value))):r.refs?Le(r.ref)?r.refs.length>1?r.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(i)?!!i.find((t=>t===e.value)):i===e.value))):r.refs[0]&&(r.refs[0].checked=!!i):r.refs.forEach((e=>e.checked=e.value===i)):vt(r.ref)?r.ref.value="":(r.ref.value=i,r.ref.type||d.values.next({name:e,values:{...o}})))}(r.shouldDirty||r.shouldTouch)&&g(e,i,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&D(e)},A=(e,t,r)=>{for(const n in t){const i=t[n],o=`${e}.${n}`,s=He(a,o);(l.array.has(e)||Me(i)||s&&!s._f)&&!Oe(i)?A(o,i,r):_(o,i,r)}},C=(e,t,r={})=>{const u=He(a,e),f=l.array.has(e),m=Be(t);Ke(o,e,m),f?(d.array.next({name:e,values:{...o}}),(c.isDirty||c.dirtyFields)&&r.shouldDirty&&d.state.next({name:e,dirtyFields:Ut(i,o),isDirty:x(e,m)})):!u||u._f||Pe(m)?_(e,m,r):A(e,m,r),ht(e,l)&&d.state.next({...n}),d.values.next({name:s.mount?e:void 0,values:{...o}})},k=async e=>{s.mount=!0;const i=e.target;let u=i.name,v=!0;const x=He(a,u),S=()=>i.type?Wt(x._f):(e=>Me(e)&&e.target?Le(e.target)?e.target.checked:e.target.value:e)(e),_=e=>{v=Number.isNaN(e)||Oe(e)&&isNaN(e.getTime())||Nt(e,He(o,u,e))};if(x){let i,s;const C=S(),k=e.type===Ye||e.type===Ge,F=!((A=x._f).mount&&(A.required||A.min||A.max||A.maxLength||A.minLength||A.pattern||A.validate)||r.resolver||He(n.errors,u)||x._f.deps)||((e,t,r,n,a)=>!a.isOnAll&&(!r&&a.isOnTouch?!(t||e):(r?n.isOnBlur:a.isOnBlur)?!e:!(r?n.isOnChange:a.isOnChange)||e))(k,He(n.touchedFields,u),n.isSubmitted,m,f),V=ht(u,l,k);Ke(o,u,C),k?(x._f.onBlur&&x._f.onBlur(e),t&&t(0)):x._f.onChange&&x._f.onChange(e);const $=g(u,C,k,!1),R=!ut($)||V;if(!k&&d.values.next({name:u,type:e.type,values:{...o}}),F)return c.isValid&&("onBlur"===r.mode&&k?p():k||p()),R&&d.state.next({name:u,...V?{}:$});if(!k&&V&&d.state.next({...n}),r.resolver){const{errors:e}=await w([u]);if(_(C),v){const t=zt(n.errors,a,u),r=zt(e,a,t.name||u);i=r.error,u=r.name,s=ut(e)}}else y([u],!0),i=(await Vt(x,l.disabled,o,h,r.shouldUseNativeValidation))[u],y([u]),_(C),v&&(i?s=!1:c.isValid&&(s=await E(a,!0)));v&&(x._f.deps&&D(x._f.deps),b(u,s,i,$))}var A},F=(e,t)=>{if(He(n.errors,t)&&e.focus)return e.focus(),1},D=async(e,t={})=>{let i,o;const s=ct(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await w(e);if(e)for(const r of e){const e=He(t,r);e?Ke(n.errors,r,e):$t(n.errors,r)}else n.errors=t;return t})(Ie(e)?e:s);i=ut(t),o=e?!s.some((e=>He(t,e))):i}else e?(o=(await Promise.all(s.map((async e=>{const t=He(a,e);return await E(t&&t._f?{[e]:t}:t)})))).every(Boolean),(o||n.isValid)&&p()):o=i=await E(a);return d.state.next({...!dt(e)||c.isValid&&i!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:i}:{},errors:n.errors}),t.shouldFocus&&!o&&pt(a,F,e?s:l.mount),o},V=e=>{const t={...s.mount?o:i};return Ie(e)?t:dt(e)?He(t,e):e.map((e=>He(t,e)))},$=(e,t)=>({invalid:!!He((t||n).errors,e),isDirty:!!He((t||n).dirtyFields,e),error:He((t||n).errors,e),isValidating:!!He(n.validatingFields,e),isTouched:!!He((t||n).touchedFields,e)}),R=(e,t,r)=>{const i=(He(a,e,{_f:{}})._f||{}).ref,o=He(n.errors,e)||{},{ref:s,message:l,type:u,...c}=o;Ke(n.errors,e,{...c,...t,ref:i}),d.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&i&&i.focus&&i.focus()},T=(e,t={})=>{for(const s of e?ct(e):l.mount)l.mount.delete(s),l.array.delete(s),t.keepValue||($t(a,s),$t(o,s)),!t.keepError&&$t(n.errors,s),!t.keepDirty&&$t(n.dirtyFields,s),!t.keepTouched&&$t(n.touchedFields,s),!t.keepIsValidating&&$t(n.validatingFields,s),!r.shouldUnregister&&!t.keepDefaultValue&&$t(i,s);d.values.next({values:{...o}}),d.state.next({...n,...t.keepDirty?{isDirty:x()}:{}}),!t.keepIsValid&&p()},N=({disabled:e,name:t,field:r,fields:n})=>{(ze(e)&&s.mount||e||l.disabled.has(t))&&(e?l.disabled.add(t):l.disabled.delete(t),g(t,Wt(r?r._f:He(n,t)._f),!1,!1,!0))},L=(e,t={})=>{let n=He(a,e);const o=ze(t.disabled)||ze(r.disabled);return Ke(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),l.mount.add(e),n?N({field:n,disabled:ze(t.disabled)?t.disabled:r.disabled,name:e}):v(e,!0,t.value),{...o?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:It(t.min),max:It(t.max),minLength:It(t.minLength),maxLength:It(t.maxLength),pattern:It(t.pattern)}:{},name:e,onChange:k,onBlur:k,ref:o=>{if(o){L(e,t),n=He(a,e);const r=Ie(o.value)&&o.querySelectorAll&&o.querySelectorAll("input,select,textarea")[0]||o,s=(e=>Et(e)||Le(e))(r),l=n._f.refs||[];if(s?l.find((e=>e===r)):r===n._f.ref)return;Ke(a,e,{_f:{...n._f,...s?{refs:[...l.filter(Ot),r,...Array.isArray(He(i,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),v(e,!1,void 0,r)}else n=He(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!((e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)))(l.array,e)||!s.action)&&l.unMount.add(e)}}},O=()=>r.shouldFocusError&&pt(a,F,l.mount),P=(e,t)=>async i=>{let s;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let u=Be(o);if(l.disabled.size)for(const e of l.disabled)Ke(u,e,void 0);if(d.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await w();n.errors=e,u=t}else await E(a);if($t(n.errors,"root"),ut(n.errors)){d.state.next({errors:{}});try{await e(u,i)}catch(e){s=e}}else t&&await t({...n.errors},i),O(),setTimeout(O);if(d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ut(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},j=(e,t={})=>{const u=e?Be(e):i,f=Be(u),m=ut(e),h=m?i:f;if(t.keepDefaultValues||(i=u),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(Ut(i,o))]);for(const t of Array.from(e))He(n.dirtyFields,t)?Ke(h,t,He(o,t)):C(t,He(h,t))}else{if(Ue&&Ie(e))for(const e of l.mount){const t=He(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(bt(e)){const t=e.closest("form");if(t){t.reset();break}}}}a={}}o=r.shouldUnregister?t.keepDefaultValues?Be(i):{}:Be(h),d.array.next({values:{...h}}),d.values.next({values:{...h}})}l={mount:t.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!c.isValid||!!t.keepIsValid||!!t.keepDirtyValues,s.watch=!!r.shouldUnregister,d.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!m&&(t.keepDirty?n.isDirty:!(!t.keepDefaultValues||Nt(e,i))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:m?{}:t.keepDirtyValues?t.keepDefaultValues&&o?Ut(i,o):n.dirtyFields:t.keepDefaultValues&&e?Ut(i,e):t.keepDirty?n.dirtyFields:{},touchedFields:t.keepTouched?n.touchedFields:{},errors:t.keepErrors?n.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1})},M=(e,t)=>j(gt(e)?e(o):e,t);return{control:{register:L,unregister:T,getFieldState:$,handleSubmit:P,setError:R,_executeSchema:w,_getWatch:S,_getDirty:x,_updateValid:p,_removeUnmounted:()=>{for(const e of l.unMount){const t=He(a,e);t&&(t._f.refs?t._f.refs.every((e=>!Ot(e))):!Ot(t._f.ref))&&T(e)}l.unMount=new Set},_updateFieldArray:(e,t=[],l,u,f=!0,m=!0)=>{if(u&&l&&!r.disabled){if(s.action=!0,m&&Array.isArray(He(a,e))){const t=l(He(a,e),u.argA,u.argB);f&&Ke(a,e,t)}if(m&&Array.isArray(He(n.errors,e))){const t=l(He(n.errors,e),u.argA,u.argB);f&&Ke(n.errors,e,t),((e,t)=>{!We(He(e,t)).length&&$t(e,t)})(n.errors,e)}if(c.touchedFields&&m&&Array.isArray(He(n.touchedFields,e))){const t=l(He(n.touchedFields,e),u.argA,u.argB);f&&Ke(n.touchedFields,e,t)}c.dirtyFields&&(n.dirtyFields=Ut(i,o)),d.state.next({name:e,isDirty:x(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Ke(o,e,t)},_updateDisabledField:N,_getFieldArray:e=>We(He(s.mount?o:i,e,r.shouldUnregister?He(i,e,[]):[])),_reset:j,_resetDefaultValues:()=>gt(r.defaultValues)&&r.defaultValues().then((e=>{M(e,r.resetOptions),d.state.next({isLoading:!1})})),_updateFormState:e=>{n={...n,...e}},_disableForm:e=>{ze(e)&&(d.state.next({disabled:e}),pt(a,((t,r)=>{const n=He(a,r);n&&(t.disabled=n._f.disabled||e,Array.isArray(n._f.refs)&&n._f.refs.forEach((t=>{t.disabled=n._f.disabled||e})))}),0,!1))},_subjects:d,_proxyFormState:c,_setErrors:e=>{n.errors=e,d.state.next({errors:n.errors,isValid:!1})},get _fields(){return a},get _formValues(){return o},get _state(){return s},set _state(e){s=e},get _defaultValues(){return i},get _names(){return l},set _names(e){l=e},get _formState(){return n},set _formState(e){n=e},get _options(){return r},set _options(e){r={...r,...e}}},trigger:D,register:L,handleSubmit:P,watch:(e,t)=>gt(e)?d.values.subscribe({next:r=>e(S(void 0,t),r)}):S(e,t,!0),setValue:C,getValues:V,reset:M,resetField:(e,t={})=>{He(a,e)&&(Ie(t.defaultValue)?C(e,Be(He(i,e))):(C(e,t.defaultValue),Ke(i,e,Be(t.defaultValue))),t.keepTouched||$t(n.touchedFields,e),t.keepDirty||($t(n.dirtyFields,e),n.isDirty=t.defaultValue?x(e,Be(He(i,e))):x()),t.keepError||($t(n.errors,e),c.isValid&&p()),d.state.next({...n}))},clearErrors:e=>{e&&ct(e).forEach((e=>$t(n.errors,e))),d.state.next({errors:e?n.errors:{}})},unregister:T,setError:R,setFocus:(e,t={})=>{const r=He(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&(e.focus(),t.shouldSelect&&gt(e.select)&&e.select())}},getFieldState:$}}function Kt(e={}){const r=t.useRef(void 0),n=t.useRef(void 0),[a,i]=t.useState({isDirty:!1,isValidating:!1,isLoading:gt(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:gt(e.defaultValues)?void 0:e.defaultValues});r.current||(r.current={...qt(e),formState:a});const o=r.current.control;return o._options=e,function(e){const r=t.useRef(e);r.current=e,t.useEffect((()=>{const t=!e.disabled&&r.current.subject&&r.current.subject.subscribe({next:r.current.next});return()=>{t&&t.unsubscribe()}}),[e.disabled])}({subject:o._subjects.state,next:e=>{((e,t,r)=>{r(e);const{name:n,...a}=e;return ut(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find((e=>t[e]===tt))})(e,o._proxyFormState,o._updateFormState)&&i({...o._formState})}}),t.useEffect((()=>o._disableForm(e.disabled)),[o,e.disabled]),t.useEffect((()=>{if(o._proxyFormState.isDirty){const e=o._getDirty();e!==a.isDirty&&o._subjects.state.next({isDirty:e})}}),[o,a.isDirty]),t.useEffect((()=>{e.values&&!Nt(e.values,n.current)?(o._reset(e.values,o._options.resetOptions),n.current=e.values,i((e=>({...e})))):o._resetDefaultValues()}),[e.values,o]),t.useEffect((()=>{e.errors&&o._setErrors(e.errors)}),[e.errors,o]),t.useEffect((()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()})),t.useEffect((()=>{e.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})}),[e.shouldUnregister,o]),r.current.formState=((e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const r in e)Object.defineProperty(a,r,{get:()=>{const a=r;return t._proxyFormState[a]!==tt&&(t._proxyFormState[a]=!n||tt),e[a]}});return a})(a,o),r.current}const Yt={getList:(e,t)=>fetch(e,{method:"GET",headers:{"Content-Type":"application/json"},body:JSON.stringify({page:t})}).then((e=>e.json())),create:(e,t)=>fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then((e=>e.json())),details:(e,t)=>fetch(`${e}/${t}`,{method:"GET",headers:{"Content-Type":"application/json"}}).then((e=>e.json())),edit:(e,t)=>fetch(`${e}/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then((e=>e.json()))};function Gt({data:e,screen:r}){const{register:i,handleSubmit:o,reset:s,formState:{errors:l}}=Kt({resolver:a.screens[r.controller].resolver,defaultValues:e}),u=q(),c=a.screens[r.controller].fields;return n((()=>{s(e)}),[e,s]),t.createElement("div",{className:"form-wrapper"},t.createElement("form",{onSubmit:o((t=>{e?Yt.edit(r.controller,t).then((()=>{u("/"+r.controller,{replace:!0})})):Yt.create(r.controller,t).then((()=>{u("/"+r.controller,{replace:!0})}))}))},c.map((e=>t.createElement("div",{className:"form-field",key:e},t.createElement("label",{htmlFor:e},e.charAt(0).toUpperCase()+e.slice(1)),t.createElement("input",{type:"text",...i(e),placeholder:`Enter ${e}`,id:e}),l[e]&&t.createElement("span",{className:"error-message"},l[e]?.message)))),t.createElement("button",{type:"submit",className:"submit-button"},"Submit")))}function Xt({screen:e}){return t.createElement(Ne,null,t.createElement(Gt,{screen:e}))}function Qt({screen:e}){const{id:a}=Y(),[i,o]=r(null),[s,l]=r(null);return n((()=>{e.controller&&a&&Yt.details(e.controller,a).then((e=>{o(e.data)})).catch((e=>{l(e),console.error(e)}))}),[a,e]),t.createElement(Ne,null,t.createElement("p",{dangerouslySetInnerHTML:{__html:JSON.stringify(i,null," <br/>")}}))}function Zt({screen:e}){const{id:a}=Y(),[i,o]=r(null),[s,l]=r(null);return n((()=>{e.controller&&a&&Yt.details(e.controller,a).then((e=>{o(e.data)})).catch((e=>{l(e),console.error(e)}))}),[a,e]),t.createElement(Ne,null,t.createElement(Gt,{data:i,screen:e}))}function er({data:e,cells:r,screen:n}){return e&&0!==e.length?t.createElement("div",{className:"list-wrapper"},t.createElement("div",{className:"header"},"List"),t.createElement("table",{className:"list-table"},t.createElement("thead",null,t.createElement("tr",null,r.map((e=>t.createElement("th",{key:e.name},e.title??e.name))),t.createElement("th",null))),t.createElement("tbody",null,e.map(((e,n)=>t.createElement("tr",{key:n},r.map((r=>{const n=e[r.name];let a=n??"-";if("date"===r.type){if(n){const e=new Date(n);a=`${e.getDate().toString().padStart(2,"0")}/${(e.getMonth()+1).toString().padStart(2,"0")}/${e.getFullYear()} ${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}`}}else a=n?n.toString():r?.placeHolder??"-";let i=a;return r.linkTo&&(i=t.createElement(De,{to:r.linkTo(e)},a)),t.createElement("td",{key:r.name},i)})),t.createElement("td",null,t.createElement(De,{to:"edit/"+(e?.id??"-")},"Edit"),t.createElement(De,{to:"details/"+(e?.id??"-")},"Details")))))))):t.createElement("div",null,"No items available")}function tr({screen:e}){const[i,o]=r(0),[s,l]=r(null),[u,c]=r(null);return n((()=>{e.controller&&Yt.getList(e.controller,i).then((e=>{l(e.data)})).catch((e=>{c(e),console.error(e)}))}),[i,e.controller]),t.createElement(Ne,null,t.createElement(De,{to:"/maps/create"},"Create"),u?t.createElement("p",null,"Error ",u):null,t.createElement(er,{screen:e,cells:a.screens[e.key].cells,data:s}))}function rr(){const e=Object.entries(a.screens);return t.createElement(t.Fragment,null,e.map((([e,r])=>{let n=`/${r.crud.controller}`;const a={key:e,controller:r.crud.controller};return t.createElement(t.Fragment,{key:"index"},t.createElement(se,{path:n+"/create",element:t.createElement(Xt,{screen:a})}),t.createElement(se,{path:n+"/details/:id",element:t.createElement(Qt,{screen:a})}),t.createElement(se,{path:n+"/edit/:id",element:t.createElement(Zt,{screen:a})}),t.createElement(se,{path:n,element:t.createElement(tr,{screen:a})}))})),t.createElement(se,{path:"*",element:t.createElement("div",null,"404 - Not Found")}))}function nr({children:e}){return t.createElement(t.Fragment,null,e)}export{Ne as Layout,nr as Panel,Te as SideBar,i as createScreens,rr as getScreenForRoutes};
12
+ function l(e,t){if(!1===e||null==e)throw new Error(t)}function u(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function c({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 d(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="/"){return function(e,t,r,n){let a="string"==typeof t?d(t):t,i=C(a.pathname||"/",r);if(null==i)return null;let o=m(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let r=e.length===t.length&&e.slice(0,-1).every(((e,r)=>e===t[r]));return r?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(o);let s=null;for(let e=0;null==s&&e<o.length;++e){let t=A(i);s=S(o[e],t,n)}return s}(e,t,r,!1)}function m(e,t=[],r=[],n=""){let a=(e,a,i)=>{let o={relativePath:void 0===i?e.path||"":i,caseSensitive:!0===e.caseSensitive,childrenIndex:a,route:e};o.relativePath.startsWith("/")&&(l(o.relativePath.startsWith(n),`Absolute route path "${o.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),o.relativePath=o.relativePath.slice(n.length));let s=V([n,o.relativePath]),u=r.concat(o);e.children&&e.children.length>0&&(l(!0!==e.index,`Index routes must not have child routes. Please remove all child routes from route path "${s}".`),m(e.children,t,u,s)),(null!=e.path||e.index)&&t.push({path:s,score:x(s,e.index),routesMeta:u})};return e.forEach(((e,t)=>{if(""!==e.path&&e.path?.includes("?"))for(let r of h(e.path))a(e,t,r);else a(e,t)})),t}function h(e){let t=e.split("/");if(0===t.length)return[];let[r,...n]=t,a=r.endsWith("?"),i=r.replace(/\?$/,"");if(0===n.length)return a?[i,""]:[i];let o=h(n.join("/")),s=[];return s.push(...o.map((e=>""===e?i:[i,e].join("/")))),a&&s.push(...o),s.map((t=>e.startsWith("/")&&""===t?"/":t))}!function(){if(o)return s;o=1,Object.defineProperty(s,"__esModule",{value:!0}),s.parse=function(e,t){const r=new i,n=e.length;if(n<2)return r;const a=t?.decode||c;let o=0;do{const t=e.indexOf("=",o);if(-1===t)break;const i=e.indexOf(";",o),s=-1===i?n:i;if(t>s){o=e.lastIndexOf(";",t-1)+1;continue}const c=l(e,o,t),d=u(e,t,c),f=e.slice(c,d);if(void 0===r[f]){let n=l(e,t+1,s),i=u(e,s,n);const o=a(e.slice(n,i));r[f]=o}o=s+1}while(o<n);return r},s.serialize=function(i,o,s){const l=s?.encode||encodeURIComponent;if(!e.test(i))throw new TypeError(`argument name is invalid: ${i}`);const u=l(o);if(!t.test(u))throw new TypeError(`argument val is invalid: ${o}`);let c=i+"="+u;if(!s)return c;if(void 0!==s.maxAge){if(!Number.isInteger(s.maxAge))throw new TypeError(`option maxAge is invalid: ${s.maxAge}`);c+="; Max-Age="+s.maxAge}if(s.domain){if(!r.test(s.domain))throw new TypeError(`option domain is invalid: ${s.domain}`);c+="; Domain="+s.domain}if(s.path){if(!n.test(s.path))throw new TypeError(`option path is invalid: ${s.path}`);c+="; Path="+s.path}if(s.expires){if(!function(e){return"[object Date]"===a.call(e)}(s.expires)||!Number.isFinite(s.expires.valueOf()))throw new TypeError(`option expires is invalid: ${s.expires}`);c+="; Expires="+s.expires.toUTCString()}s.httpOnly&&(c+="; HttpOnly");s.secure&&(c+="; Secure");s.partitioned&&(c+="; Partitioned");if(s.priority){switch("string"==typeof s.priority?s.priority.toLowerCase():void 0){case"low":c+="; Priority=Low";break;case"medium":c+="; Priority=Medium";break;case"high":c+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${s.priority}`)}}if(s.sameSite){switch("string"==typeof s.sameSite?s.sameSite.toLowerCase():s.sameSite){case!0:case"strict":c+="; SameSite=Strict";break;case"lax":c+="; SameSite=Lax";break;case"none":c+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${s.sameSite}`)}}return c};const e=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,t=/^[\u0021-\u003A\u003C-\u007E]*$/,r=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,n=/^[\u0020-\u003A\u003D-\u007E]*$/,a=Object.prototype.toString,i=(()=>{const e=function(){};return e.prototype=Object.create(null),e})();function l(e,t,r){do{const r=e.charCodeAt(t);if(32!==r&&9!==r)return t}while(++t<r);return r}function u(e,t,r){for(;t>r;){const r=e.charCodeAt(--t);if(32!==r&&9!==r)return t+1}return r}function c(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch(t){return e}}}();var p=/^:[\w-]+$/,y=3,v=2,g=1,b=10,w=-2,E=e=>"*"===e;function x(e,t){let r=e.split("/"),n=r.length;return r.some(E)&&(n+=w),t&&(n+=v),r.filter((e=>!E(e))).reduce(((e,t)=>e+(p.test(t)?y:""===t?g:b)),n)}function S(e,t,r=!1){let{routesMeta:n}=e,a={},i="/",o=[];for(let e=0;e<n.length;++e){let s=n[e],l=e===n.length-1,u="/"===i?t:t.slice(i.length)||"/",c=_({path:s.relativePath,caseSensitive:s.caseSensitive,end:l},u),d=s.route;if(!c&&l&&r&&!n[n.length-1].route.index&&(c=_({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},u)),!c)return null;Object.assign(a,c.params),o.push({params:a,pathname:V([i,c.pathname]),pathnameBase:$(V([i,c.pathnameBase])),route:d}),"/"!==c.pathnameBase&&(i=V([i,c.pathnameBase]))}return o}function _(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=function(e,t=!1,r=!0){u("*"===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=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,r)=>(n.push({paramName:t,isOptional:null!=r}),r?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(n.push({paramName:"*"}),a+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":""!==e&&"/"!==e&&(a+="(?:(?=\\/|$))");let i=new RegExp(a,t?void 0:"i");return[i,n]}(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let i=a[0],o=i.replace(/(.)\/+$/,"$1"),s=a.slice(1);return{params:n.reduce(((e,{paramName:t,isOptional:r},n)=>{if("*"===t){let e=s[n]||"";o=i.slice(0,i.length-e.length).replace(/(.)\/+$/,"$1")}const a=s[n];return e[t]=r&&!a?void 0:(a||"").replace(/%2F/g,"/"),e}),{}),pathname:i,pathnameBase:o,pattern:e}}function A(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return u(!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}}function C(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 k(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 F(e){let t=function(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}(e);return t.map(((e,r)=>r===t.length-1?e.pathname:e.pathnameBase))}function D(e,t,r,n=!1){let a;"string"==typeof e?a=d(e):(a={...e},l(!a.pathname||!a.pathname.includes("?"),k("?","pathname","search",a)),l(!a.pathname||!a.pathname.includes("#"),k("#","pathname","hash",a)),l(!a.search||!a.search.includes("#"),k("#","search","hash",a)));let i,o=""===e||""===a.pathname,s=o?"/":a.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;a.pathname=t.join("/")}i=e>=0?t[e]:"/"}let u=function(e,t="/"){let{pathname:r,search:n="",hash:a=""}="string"==typeof e?d(e):e,i=r?r.startsWith("/")?r:function(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)})),r.length>1?r.join("/"):"/"}(r,t):t;return{pathname:i,search:R(n),hash:T(a)}}(a,i),c=s&&"/"!==s&&s.endsWith("/"),f=(o||"."===s)&&r.endsWith("/");return u.pathname.endsWith("/")||!c&&!f||(u.pathname+="/"),u}var V=e=>e.join("/").replace(/\/\/+/g,"/"),$=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),R=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",T=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";var N=["POST","PUT","PATCH","DELETE"];new Set(N);var L=["GET",...N];new Set(L);var O=e.createContext(null);O.displayName="DataRouter";var P=e.createContext(null);P.displayName="DataRouterState";var j=e.createContext({isTransitioning:!1});j.displayName="ViewTransition",e.createContext(new Map).displayName="Fetchers",e.createContext(null).displayName="Await";var M=e.createContext(null);M.displayName="Navigation";var U=e.createContext(null);U.displayName="Location";var B=e.createContext({outlet:null,matches:[],isDataRoute:!1});B.displayName="Route";var W=e.createContext(null);function I(){return null!=e.useContext(U)}function H(){return l(I(),"useLocation() may be used only in the context of a <Router> component."),e.useContext(U).location}W.displayName="RouteError";var z="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function J(t){e.useContext(M).static||e.useLayoutEffect(t)}function q(){let{isDataRoute:t}=e.useContext(B);return t?function(){let{router:t}=function(t){let r=e.useContext(O);return l(r,re(t)),r}("useNavigate"),r=ne("useNavigate"),n=e.useRef(!1);return J((()=>{n.current=!0})),e.useCallback((async(e,a={})=>{u(n.current,z),n.current&&("number"==typeof e?t.navigate(e):await t.navigate(e,{fromRouteId:r,...a}))}),[t,r])}():function(){l(I(),"useNavigate() may be used only in the context of a <Router> component.");let t=e.useContext(O),{basename:r,navigator:n}=e.useContext(M),{matches:a}=e.useContext(B),{pathname:i}=H(),o=JSON.stringify(F(a)),s=e.useRef(!1);return J((()=>{s.current=!0})),e.useCallback(((e,a={})=>{if(u(s.current,z),!s.current)return;if("number"==typeof e)return void n.go(e);let l=D(e,JSON.parse(o),i,"path"===a.relative);null==t&&"/"!==r&&(l.pathname="/"===l.pathname?r:V([r,l.pathname])),(a.replace?n.replace:n.push)(l,a.state,a)}),[r,n,o,i,t])}()}var K=e.createContext(null);function Y(){let{matches:t}=e.useContext(B),r=t[t.length-1];return r?r.params:{}}function G(t,{relative:r}={}){let{matches:n}=e.useContext(B),{pathname:a}=H(),i=JSON.stringify(F(n));return e.useMemo((()=>D(t,JSON.parse(i),a,"path"===r)),[t,i,a,r])}function X(t,r,n,a){l(I(),"useRoutes() may be used only in the context of a <Router> component.");let i,{navigator:o,static:s}=e.useContext(M),{matches:c}=e.useContext(B),d=c[c.length-1],m=d?d.params:{},h=d?d.pathname:"/",p=d?d.pathnameBase:"/",y=d&&d.route;{let e=y&&y.path||"";ie(h,!y||e.endsWith("*")||e.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.\n\nPlease change the parent <Route path="${e}"> to <Route path="${"/"===e?"*":`${e}/*`}">.`)}i=H();let v=i.pathname||"/",g=v;if("/"!==p){let e=p.replace(/^\//,"").split("/");g="/"+v.replace(/^\//,"").split("/").slice(e.length).join("/")}let b=!s&&n&&n.matches&&n.matches.length>0?n.matches:f(t,{pathname:g});u(y||null!=b,`No routes matched location "${i.pathname}${i.search}${i.hash}" `),u(null==b||void 0!==b[b.length-1].route.element||void 0!==b[b.length-1].route.Component||void 0!==b[b.length-1].route.lazy,`Matched leaf route at location "${i.pathname}${i.search}${i.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let w=function(t,r=[],n=null){if(null==t){if(!n)return null;if(n.errors)t=n.matches;else{if(0!==r.length||n.initialized||!(n.matches.length>0))return null;t=n.matches}}let a=t,i=n?.errors;if(null!=i){let e=a.findIndex((e=>e.route.id&&void 0!==i?.[e.route.id]));l(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),a=a.slice(0,Math.min(a.length,e+1))}let o=!1,s=-1;if(n)for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:r}=n,i=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!r||void 0===r[t.route.id]);if(t.route.lazy||i){o=!0,a=s>=0?a.slice(0,s+1):[a[0]];break}}}return a.reduceRight(((t,l,u)=>{let c,d=!1,f=null,m=null;n&&(c=i&&l.route.id?i[l.route.id]:void 0,f=l.route.errorElement||Z,o&&(s<0&&0===u?(ie("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,m=null):s===u&&(d=!0,m=l.route.hydrateFallbackElement||null)));let h=r.concat(a.slice(0,u+1)),p=()=>{let r;return r=c?f:d?m:l.route.Component?e.createElement(l.route.Component,null):l.route.element?l.route.element:t,e.createElement(te,{match:l,routeContext:{outlet:t,matches:h,isDataRoute:null!=n},children:r})};return n&&(l.route.ErrorBoundary||l.route.errorElement||0===u)?e.createElement(ee,{location:n.location,revalidation:n.revalidation,component:f,error:c,children:p(),routeContext:{outlet:null,matches:h,isDataRoute:!0}}):p()}),null)}(b&&b.map((e=>Object.assign({},e,{params:Object.assign({},m,e.params),pathname:V([p,o.encodeLocation?o.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?p:V([p,o.encodeLocation?o.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),c,n,a);return w}function Q(){let t=function(){let t=e.useContext(W),r=function(t){let r=e.useContext(P);return l(r,re(t)),r}("useRouteError"),n=ne("useRouteError");if(void 0!==t)return t;return r.errors?.[n]}(),r=function(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,a="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},s=null;return console.error("Error handled by React Router default ErrorBoundary:",t),s=e.createElement(e.Fragment,null,e.createElement("p",null,"💿 Hey developer 👋"),e.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",e.createElement("code",{style:o},"ErrorBoundary")," or"," ",e.createElement("code",{style:o},"errorElement")," prop on your route.")),e.createElement(e.Fragment,null,e.createElement("h2",null,"Unexpected Application Error!"),e.createElement("h3",{style:{fontStyle:"italic"}},r),n?e.createElement("pre",{style:i},n):null,s)}var Z=e.createElement(Q,null),ee=class extends e.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}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){console.error("React Router caught the following error during render",e,t)}render(){return void 0!==this.state.error?e.createElement(B.Provider,{value:this.props.routeContext},e.createElement(W.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function te({routeContext:t,match:r,children:n}){let a=e.useContext(O);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),e.createElement(B.Provider,{value:t},n)}function re(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ne(t){let r=function(t){let r=e.useContext(B);return l(r,re(t)),r}(t),n=r.matches[r.matches.length-1];return l(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}var ae={};function ie(e,t,r){t||ae[e]||(ae[e]=!0,u(!1,r))}function oe(t){return function(t){let r=e.useContext(B).outlet;return r?e.createElement(K.Provider,{value:t},r):r}(t.context)}function se(e){l(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}e.memo((function({routes:e,future:t,state:r}){return X(e,0,r,t)}));var le="get",ue="application/x-www-form-urlencoded";function ce(e){return null!=e&&"string"==typeof e.tagName}var de=null;var fe=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function me(e){return null==e||fe.has(e)?e:(u(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ue}"`),null)}function he(e,t){let r,n,a,i,o;if(ce(s=e)&&"form"===s.tagName.toLowerCase()){let o=e.getAttribute("action");n=o?C(o,t):null,r=e.getAttribute("method")||le,a=me(e.getAttribute("enctype"))||ue,i=new FormData(e)}else if(function(e){return ce(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return ce(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let o=e.form;if(null==o)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||o.getAttribute("action");if(n=s?C(s,t):null,r=e.getAttribute("formmethod")||o.getAttribute("method")||le,a=me(e.getAttribute("formenctype"))||me(o.getAttribute("enctype"))||ue,i=new FormData(o,e),!function(){if(null===de)try{new FormData(document.createElement("form"),0),de=!1}catch(e){de=!0}return de}()){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(ce(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=le,n=null,a=ue,o=e}var s;return i&&"text/plain"===a&&(o=i,i=void 0),{action:n,method:r.toLowerCase(),encType:a,formData:i,body:o}}function pe(e,t){if(!1===e||null==e)throw new Error(t)}function ye(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 ve(e,t,r){return function(e,t){let r=new Set;return new Set(t),e.reduce(((e,t)=>{let n=JSON.stringify(function(e){let t={},r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}(t));return r.has(n)||(r.add(n),e.push({key:n,link:t})),e}),[])}((await Promise.all(e.map((async e=>{let n=t.routes[e.route.id];if(n){let e=await async function(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){if(console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode&&import.meta.hot)throw t;return window.location.reload(),new Promise((()=>{}))}}(n,r);return e.links?e.links():[]}return[]})))).flat(1).filter(ye).filter((e=>"stylesheet"===e.rel||"preload"===e.rel)).map((e=>"stylesheet"===e.rel?{...e,rel:"prefetch",as:"style"}:{...e,rel:"prefetch"})))}function ge(e,t,r,n,a,i){let o=(e,t)=>!r[t]||e.route.id!==r[t].route.id,s=(e,t)=>r[t].pathname!==e.pathname||r[t].route.path?.endsWith("*")&&r[t].params["*"]!==e.params["*"];return"assets"===i?t.filter(((e,t)=>o(e,t)||s(e,t))):"data"===i?t.filter(((t,i)=>{let l=n.routes[t.route.id];if(!l||!l.hasLoader)return!1;if(o(t,i)||s(t,i))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})):[]}function be(e,t,{includeHydrateFallback:r}={}){return n=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),[...new Set(n)];var n}function we(){let t=e.useContext(O);return pe(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}var Ee=e.createContext(void 0);function xe(){let t=e.useContext(Ee);return pe(t,"You must render this element inside a <HydratedRouter> element"),t}function Se(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function _e({page:t,...r}){let{router:n}=we(),a=e.useMemo((()=>f(n.routes,t,n.basename)),[n.routes,t,n.basename]);return a?e.createElement(Ae,{page:t,matches:a,...r}):null}function Ae({page:t,matches:r,...n}){let a=H(),{manifest:i,routeModules:o}=xe(),{basename:s}=we(),{loaderData:l,matches:u}=function(){let t=e.useContext(P);return pe(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}(),c=e.useMemo((()=>ge(t,r,u,i,a,"data")),[t,r,u,i,a]),d=e.useMemo((()=>ge(t,r,u,i,a,"assets")),[t,r,u,i,a]),f=e.useMemo((()=>{if(t===a.pathname+a.search+a.hash)return[];let e=new Set,n=!1;if(r.forEach((t=>{let r=i.routes[t.route.id];r&&r.hasLoader&&(!c.some((e=>e.route.id===t.route.id))&&t.route.id in l&&o[t.route.id]?.shouldRevalidate||r.hasClientLoader?n=!0:e.add(t.route.id))})),0===e.size)return[];let u=function(e,t){let r="string"==typeof e?new URL(e,"undefined"==typeof window?"server://singlefetch/":window.location.origin):e;return"/"===r.pathname?r.pathname="_root.data":t&&"/"===C(r.pathname,t)?r.pathname=`${t.replace(/\/$/,"")}/_root.data`:r.pathname=`${r.pathname.replace(/\/$/,"")}.data`,r}(t,s);return n&&e.size>0&&u.searchParams.set("_routes",r.filter((t=>e.has(t.route.id))).map((e=>e.route.id)).join(",")),[u.pathname+u.search]}),[s,l,a,i,c,r,t,o]),m=e.useMemo((()=>be(d,i)),[d,i]),h=function(t){let{manifest:r,routeModules:n}=xe(),[a,i]=e.useState([]);return e.useEffect((()=>{let e=!1;return ve(t,r,n).then((t=>{e||i(t)})),()=>{e=!0}}),[t,r,n]),a}(d);return e.createElement(e.Fragment,null,f.map((t=>e.createElement("link",{key:t,rel:"prefetch",as:"fetch",href:t,...n}))),m.map((t=>e.createElement("link",{key:t,rel:"modulepreload",href:t,...n}))),h.map((({key:t,link:r})=>e.createElement("link",{key:t,...r}))))}function Ce(...e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}Ee.displayName="FrameworkContext";var ke="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;try{ke&&(window.__reactRouterVersion="7.3.0")}catch(e){}var Fe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,De=e.forwardRef((function({onClick:t,discover:r="render",prefetch:n="none",relative:a,reloadDocument:i,replace:o,state:s,target:d,to:f,preventScrollReset:m,viewTransition:h,...p},y){let v,{basename:g}=e.useContext(M),b="string"==typeof f&&Fe.test(f),w=!1;if("string"==typeof f&&b&&(v=f,ke))try{let e=new URL(window.location.href),t=f.startsWith("//")?new URL(e.protocol+f):new URL(f),r=C(t.pathname,g);t.origin===e.origin&&null!=r?f=r+t.search+t.hash:w=!0}catch(e){u(!1,`<Link to="${f}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let E=function(t,{relative:r}={}){l(I(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=e.useContext(M),{hash:i,pathname:o,search:s}=G(t,{relative:r}),u=o;return"/"!==n&&(u="/"===o?n:V([n,o])),a.createHref({pathname:u,search:s,hash:i})}(f,{relative:a}),[x,S,_]=function(t,r){let n=e.useContext(Ee),[a,i]=e.useState(!1),[o,s]=e.useState(!1),{onFocus:l,onBlur:u,onMouseEnter:c,onMouseLeave:d,onTouchStart:f}=r,m=e.useRef(null);e.useEffect((()=>{if("render"===t&&s(!0),"viewport"===t){let e=new IntersectionObserver((e=>{e.forEach((e=>{s(e.isIntersecting)}))}),{threshold:.5});return m.current&&e.observe(m.current),()=>{e.disconnect()}}}),[t]),e.useEffect((()=>{if(a){let e=setTimeout((()=>{s(!0)}),100);return()=>{clearTimeout(e)}}}),[a]);let h=()=>{i(!0)},p=()=>{i(!1),s(!1)};return n?"intent"!==t?[o,m,{}]:[o,m,{onFocus:Se(l,h),onBlur:Se(u,p),onMouseEnter:Se(c,h),onMouseLeave:Se(d,p),onTouchStart:Se(f,h)}]:[!1,m,{}]}(n,p),A=function(t,{target:r,replace:n,state:a,preventScrollReset:i,relative:o,viewTransition:s}={}){let l=q(),u=H(),d=G(t,{relative:o});return e.useCallback((e=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(e,r)){e.preventDefault();let r=void 0!==n?n:c(u)===c(d);l(t,{replace:r,state:a,preventScrollReset:i,relative:o,viewTransition:s})}}),[u,l,d,n,a,r,t,i,o,s])}(f,{replace:o,state:s,target:d,preventScrollReset:m,relative:a,viewTransition:h});let k=e.createElement("a",{...p,..._,href:v||E,onClick:w||i?t:function(e){t&&t(e),e.defaultPrevented||A(e)},ref:Ce(y,S),target:d,"data-discover":b||"render"!==r?void 0:"true"});return x&&!b?e.createElement(e.Fragment,null,k,e.createElement(_e,{page:E})):k}));function Ve(t){let r=e.useContext(O);return l(r,function(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}(t)),r}De.displayName="Link",e.forwardRef((function({"aria-current":t="page",caseSensitive:r=!1,className:n="",end:a=!1,style:i,to:o,viewTransition:s,children:u,...c},d){let f=G(o,{relative:c.relative}),m=H(),h=e.useContext(P),{navigator:p,basename:y}=e.useContext(M),v=null!=h&&function(t,r={}){let n=e.useContext(j);l(null!=n,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=Ve("useViewTransitionState"),i=G(t,{relative:r.relative});if(!n.isTransitioning)return!1;let o=C(n.currentLocation.pathname,a)||n.currentLocation.pathname,s=C(n.nextLocation.pathname,a)||n.nextLocation.pathname;return null!=_(i.pathname,s)||null!=_(i.pathname,o)}(f)&&!0===s,g=p.encodeLocation?p.encodeLocation(f).pathname:f.pathname,b=m.pathname,w=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;r||(b=b.toLowerCase(),w=w?w.toLowerCase():null,g=g.toLowerCase()),w&&y&&(w=C(w,y)||w);const E="/"!==g&&g.endsWith("/")?g.length-1:g.length;let x,S=b===g||!a&&b.startsWith(g)&&"/"===b.charAt(E),A=null!=w&&(w===g||!a&&w.startsWith(g)&&"/"===w.charAt(g.length)),k={isActive:S,isPending:A,isTransitioning:v},F=S?t:void 0;x="function"==typeof n?n(k):[n,S?"active":null,A?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let D="function"==typeof i?i(k):i;return e.createElement(De,{...c,"aria-current":F,className:x,ref:d,style:D,to:o,viewTransition:s},"function"==typeof u?u(k):u)})).displayName="NavLink",e.forwardRef((({discover:t="render",fetcherKey:r,navigate:n,reloadDocument:a,replace:i,state:o,method:s=le,action:u,onSubmit:d,relative:f,preventScrollReset:m,viewTransition:h,...p},y)=>{let v=function(){let{router:t}=Ve("useSubmit"),{basename:r}=e.useContext(M),n=ne("useRouteId");return e.useCallback((async(e,a={})=>{let{action:i,method:o,encType:s,formData:l,body:u}=he(e,r);if(!1===a.navigate){let e=a.fetcherKey||Re();await t.fetch(e,n,a.action||i,{preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||o,formEncType:a.encType||s,flushSync:a.flushSync})}else await t.navigate(a.action||i,{preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||o,formEncType:a.encType||s,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})}),[t,r,n])}(),g=function(t,{relative:r}={}){let{basename:n}=e.useContext(M),a=e.useContext(B);l(a,"useFormAction must be used inside a RouteContext");let[i]=a.matches.slice(-1),o={...G(t||".",{relative:r})},s=H();if(null==t){o.search=s.search;let e=new URLSearchParams(o.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();o.search=r?`?${r}`:""}}t&&"."!==t||!i.route.index||(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index");"/"!==n&&(o.pathname="/"===o.pathname?n:V([n,o.pathname]));return c(o)}(u,{relative:f}),b="get"===s.toLowerCase()?"get":"post",w="string"==typeof u&&Fe.test(u);return e.createElement("form",{ref:y,method:b,action:g,onSubmit:a?d:e=>{if(d&&d(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter,a=t?.getAttribute("formmethod")||s;v(t||e.currentTarget,{fetcherKey:r,method:a,navigate:n,replace:i,state:o,relative:f,preventScrollReset:m,viewTransition:h})},...p,"data-discover":w||"render"!==t?void 0:"true"})})).displayName="Form";var $e=0,Re=()=>`__${String(++$e)}__`;function Te(){const[e,n]=r(!0);return t.createElement("div",{className:"sidebar "+(e?"open":"closed")},t.createElement("button",{className:"toggle-button",onClick:()=>n(!e)},e?"<":">"),t.createElement("nav",{className:"nav-links"},t.createElement(De,{to:"/"},"Home")))}function Ne({children:e}){return t.createElement("div",{className:"layout"},t.createElement(Te,null),t.createElement("main",{className:"content"},e||t.createElement(oe,null)))}new TextEncoder;var Le=e=>"checkbox"===e.type,Oe=e=>e instanceof Date,Pe=e=>null==e;const je=e=>"object"==typeof e;var Me=e=>!Pe(e)&&!Array.isArray(e)&&je(e)&&!Oe(e),Ue="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function Be(e){let t;const r=Array.isArray(e),n="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(Ue&&(e instanceof Blob||n)||!r&&!Me(e))return e;if(t=r?[]:{},r||(e=>{const t=e.constructor&&e.constructor.prototype;return Me(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const r in e)e.hasOwnProperty(r)&&(t[r]=Be(e[r]));else t=e}return t}var We=e=>Array.isArray(e)?e.filter(Boolean):[],Ie=e=>void 0===e,He=(e,t,r)=>{if(!t||!Me(e))return r;const n=We(t.split(/[,[\].]+?/)).reduce(((e,t)=>Pe(e)?e:e[t]),e);return Ie(n)||n===e?Ie(e[t])?r:e[t]:n},ze=e=>"boolean"==typeof e,Je=e=>/^\w*$/.test(e),qe=e=>We(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Ke=(e,t,r)=>{let n=-1;const a=Je(t)?[t]:qe(t),i=a.length,o=i-1;for(;++n<i;){const t=a[n];let i=r;if(n!==o){const r=e[t];i=Me(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=i,e=e[t]}return e};const Ye="blur",Ge="focusout",Xe="onBlur",Qe="onChange",Ze="onSubmit",et="onTouched",tt="all",rt="max",nt="min",at="maxLength",it="minLength",ot="pattern",st="required",lt="validate";t.createContext(null);var ut=e=>Me(e)&&!Object.keys(e).length,ct=e=>Array.isArray(e)?e:[e];var dt=e=>"string"==typeof e,ft=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},mt=e=>({isOnSubmit:!e||e===Ze,isOnBlur:e===Xe,isOnChange:e===Qe,isOnAll:e===tt,isOnTouch:e===et}),ht=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const pt=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const r=He(e,a);if(r){const{_f:e,...i}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],a)&&!n)return!0;if(e.ref&&t(e.ref,e.name)&&!n)return!0;if(pt(i,t))break}else if(Me(i)&&pt(i,t))break}}};var yt=(e,t,r)=>{const n=ct(He(e,r));return Ke(n,"root",t[r]),Ke(e,r,n),e},vt=e=>"file"===e.type,gt=e=>"function"==typeof e,bt=e=>{if(!Ue)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},wt=e=>dt(e),Et=e=>"radio"===e.type,xt=e=>e instanceof RegExp;const St={value:!1,isValid:!1},_t={value:!0,isValid:!0};var At=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ie(e[0].attributes.value)?Ie(e[0].value)||""===e[0].value?_t:{value:e[0].value,isValid:!0}:_t:St}return St};const Ct={isValid:!1,value:null};var kt=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),Ct):Ct;function Ft(e,t,r="validate"){if(wt(e)||Array.isArray(e)&&e.every(wt)||ze(e)&&!e)return{type:r,message:wt(e)?e:"",ref:t}}var Dt=e=>Me(e)&&!xt(e)?e:{value:e,message:""},Vt=async(e,t,r,n,a,i)=>{const{ref:o,refs:s,required:l,maxLength:u,minLength:c,min:d,max:f,pattern:m,validate:h,name:p,valueAsNumber:y,mount:v}=e._f,g=He(r,p);if(!v||t.has(p))return{};const b=s?s[0]:o,w=e=>{a&&b.reportValidity&&(b.setCustomValidity(ze(e)?"":e||""),b.reportValidity())},E={},x=Et(o),S=Le(o),_=x||S,A=(y||vt(o))&&Ie(o.value)&&Ie(g)||bt(o)&&""===o.value||""===g||Array.isArray(g)&&!g.length,C=ft.bind(null,p,n,E),k=(e,t,r,n=at,a=it)=>{const i=e?t:r;E[p]={type:e?n:a,message:i,ref:o,...C(e?n:a,i)}};if(i?!Array.isArray(g)||!g.length:l&&(!_&&(A||Pe(g))||ze(g)&&!g||S&&!At(s).isValid||x&&!kt(s).isValid)){const{value:e,message:t}=wt(l)?{value:!!l,message:l}:Dt(l);if(e&&(E[p]={type:st,message:t,ref:b,...C(st,t)},!n))return w(t),E}if(!(A||Pe(d)&&Pe(f))){let e,t;const r=Dt(f),a=Dt(d);if(Pe(g)||isNaN(g)){const n=o.valueAsDate||new Date(g),i=e=>new Date((new Date).toDateString()+" "+e),s="time"==o.type,l="week"==o.type;dt(r.value)&&g&&(e=s?i(g)>i(r.value):l?g>r.value:n>new Date(r.value)),dt(a.value)&&g&&(t=s?i(g)<i(a.value):l?g<a.value:n<new Date(a.value))}else{const n=o.valueAsNumber||(g?+g:g);Pe(r.value)||(e=n>r.value),Pe(a.value)||(t=n<a.value)}if((e||t)&&(k(!!e,r.message,a.message,rt,nt),!n))return w(E[p].message),E}if((u||c)&&!A&&(dt(g)||i&&Array.isArray(g))){const e=Dt(u),t=Dt(c),r=!Pe(e.value)&&g.length>+e.value,a=!Pe(t.value)&&g.length<+t.value;if((r||a)&&(k(r,e.message,t.message),!n))return w(E[p].message),E}if(m&&!A&&dt(g)){const{value:e,message:t}=Dt(m);if(xt(e)&&!g.match(e)&&(E[p]={type:ot,message:t,ref:o,...C(ot,t)},!n))return w(t),E}if(h)if(gt(h)){const e=Ft(await h(g,r),b);if(e&&(E[p]={...e,...C(lt,e.message)},!n))return w(e.message),E}else if(Me(h)){let e={};for(const t in h){if(!ut(e)&&!n)break;const a=Ft(await h[t](g,r),b,t);a&&(e={...a,...C(t,a.message)},w(a.message),n&&(E[p]=e))}if(!ut(e)&&(E[p]={ref:b,...e},!n))return E}return w(!0),E};function $t(e,t){const r=Array.isArray(t)?t:Je(t)?[t]:qe(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Ie(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,i=r[a];return n&&delete n[i],0!==a&&(Me(n)&&ut(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!Ie(e[t]))return!1;return!0}(n))&&$t(e,r.slice(0,-1)),e}var Rt=()=>{let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}},Tt=e=>Pe(e)||!je(e);function Nt(e,t){if(Tt(e)||Tt(t))return e===t;if(Oe(e)&&Oe(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const a of r){const r=e[a];if(!n.includes(a))return!1;if("ref"!==a){const e=t[a];if(Oe(r)&&Oe(e)||Me(r)&&Me(e)||Array.isArray(r)&&Array.isArray(e)?!Nt(r,e):r!==e)return!1}}return!0}var Lt=e=>"select-multiple"===e.type,Ot=e=>bt(e)&&e.isConnected,Pt=e=>{for(const t in e)if(gt(e[t]))return!0;return!1};function jt(e,t={}){const r=Array.isArray(e);if(Me(e)||r)for(const r in e)Array.isArray(e[r])||Me(e[r])&&!Pt(e[r])?(t[r]=Array.isArray(e[r])?[]:{},jt(e[r],t[r])):Pe(e[r])||(t[r]=!0);return t}function Mt(e,t,r){const n=Array.isArray(e);if(Me(e)||n)for(const n in e)Array.isArray(e[n])||Me(e[n])&&!Pt(e[n])?Ie(t)||Tt(r[n])?r[n]=Array.isArray(e[n])?jt(e[n],[]):{...jt(e[n])}:Mt(e[n],Pe(t)?{}:t[n],r[n]):r[n]=!Nt(e[n],t[n]);return r}var Ut=(e,t)=>Mt(e,t,jt(t)),Bt=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Ie(e)?e:t?""===e?NaN:e?+e:e:r&&dt(e)?new Date(e):n?n(e):e;function Wt(e){const t=e.ref;return vt(t)?t.files:Et(t)?kt(e.refs).value:Lt(t)?[...t.selectedOptions].map((({value:e})=>e)):Le(t)?At(e.refs).value:Bt(Ie(t.value)?e.ref.value:t.value,e)}var It=e=>Ie(e)?e:xt(e)?e.source:Me(e)?xt(e.value)?e.value.source:e.value:e;const Ht="AsyncFunction";function zt(e,t,r){const n=He(e,r);if(n||Je(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),i=He(t,n),o=He(e,n);if(i&&!Array.isArray(i)&&r!==n)return{name:r};if(o&&o.type)return{name:n,error:o};a.pop()}return{name:r}}const Jt={mode:Ze,reValidateMode:Qe,shouldFocusError:!0};function qt(e={}){let t,r={...Jt,...e},n={submitCount:0,isDirty:!1,isLoading:gt(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},i=(Me(r.defaultValues)||Me(r.values))&&Be(r.defaultValues||r.values)||{},o=r.shouldUnregister?{}:Be(i),s={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},u=0;const c={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={values:Rt(),array:Rt(),state:Rt()},f=mt(r.mode),m=mt(r.reValidateMode),h=r.criteriaMode===tt,p=async e=>{if(!r.disabled&&(c.isValid||e)){const e=r.resolver?ut((await w()).errors):await E(a,!0);e!==n.isValid&&d.state.next({isValid:e})}},y=(e,t)=>{r.disabled||!c.isValidating&&!c.validatingFields||((e||Array.from(l.mount)).forEach((e=>{e&&(t?Ke(n.validatingFields,e,t):$t(n.validatingFields,e))})),d.state.next({validatingFields:n.validatingFields,isValidating:!ut(n.validatingFields)}))},v=(e,t,r,n)=>{const l=He(a,e);if(l){const a=He(o,e,Ie(r)?He(i,e):r);Ie(a)||n&&n.defaultChecked||t?Ke(o,e,t?a:Wt(l._f)):_(e,a),s.mount&&p()}},g=(e,t,o,s,l)=>{let u=!1,f=!1;const m={name:e};if(!r.disabled){const r=!!(He(a,e)&&He(a,e)._f&&He(a,e)._f.disabled);if(!o||s){c.isDirty&&(f=n.isDirty,n.isDirty=m.isDirty=x(),u=f!==m.isDirty);const a=r||Nt(He(i,e),t);f=!(r||!He(n.dirtyFields,e)),a||r?$t(n.dirtyFields,e):Ke(n.dirtyFields,e,!0),m.dirtyFields=n.dirtyFields,u=u||c.dirtyFields&&f!==!a}if(o){const t=He(n.touchedFields,e);t||(Ke(n.touchedFields,e,o),m.touchedFields=n.touchedFields,u=u||c.touchedFields&&t!==o)}u&&l&&d.state.next(m)}return u?m:{}},b=(e,a,i,o)=>{const s=He(n.errors,e),l=c.isValid&&ze(a)&&n.isValid!==a;var f;if(r.delayError&&i?(f=()=>((e,t)=>{Ke(n.errors,e,t),d.state.next({errors:n.errors})})(e,i),t=e=>{clearTimeout(u),u=setTimeout(f,e)},t(r.delayError)):(clearTimeout(u),t=null,i?Ke(n.errors,e,i):$t(n.errors,e)),(i?!Nt(s,i):s)||!ut(o)||l){const t={...o,...l&&ze(a)?{isValid:a}:{},errors:n.errors,name:e};n={...n,...t},d.state.next(t)}},w=async e=>{y(e,!0);const t=await r.resolver(o,r.context,((e,t,r,n)=>{const a={};for(const r of e){const e=He(t,r);e&&Ke(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}})(e||l.mount,a,r.criteriaMode,r.shouldUseNativeValidation));return y(e),t},E=async(e,t,a={valid:!0})=>{for(const s in e){const u=e[s];if(u){const{_f:e,...d}=u;if(e){const d=l.array.has(e.name),f=u._f&&(!!(i=u._f)&&!!i.validate&&!!(gt(i.validate)&&i.validate.constructor.name===Ht||Me(i.validate)&&Object.values(i.validate).find((e=>e.constructor.name===Ht))));f&&c.validatingFields&&y([s],!0);const m=await Vt(u,l.disabled,o,h,r.shouldUseNativeValidation&&!t,d);if(f&&c.validatingFields&&y([s]),m[e.name]&&(a.valid=!1,t))break;!t&&(He(m,e.name)?d?yt(n.errors,m,e.name):Ke(n.errors,e.name,m[e.name]):$t(n.errors,e.name))}!ut(d)&&await E(d,t,a)}}var i;return a.valid},x=(e,t)=>!r.disabled&&(e&&t&&Ke(o,e,t),!Nt(V(),i)),S=(e,t,r)=>((e,t,r,n,a)=>dt(e)?(n&&t.watch.add(e),He(r,e,a)):Array.isArray(e)?e.map((e=>(n&&t.watch.add(e),He(r,e)))):(n&&(t.watchAll=!0),r))(e,l,{...s.mount?o:Ie(t)?i:dt(e)?{[e]:t}:t},r,t),_=(e,t,r={})=>{const n=He(a,e);let i=t;if(n){const r=n._f;r&&(!r.disabled&&Ke(o,e,Bt(t,r)),i=bt(r.ref)&&Pe(t)?"":t,Lt(r.ref)?[...r.ref.options].forEach((e=>e.selected=i.includes(e.value))):r.refs?Le(r.ref)?r.refs.length>1?r.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(i)?!!i.find((t=>t===e.value)):i===e.value))):r.refs[0]&&(r.refs[0].checked=!!i):r.refs.forEach((e=>e.checked=e.value===i)):vt(r.ref)?r.ref.value="":(r.ref.value=i,r.ref.type||d.values.next({name:e,values:{...o}})))}(r.shouldDirty||r.shouldTouch)&&g(e,i,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&D(e)},A=(e,t,r)=>{for(const n in t){const i=t[n],o=`${e}.${n}`,s=He(a,o);(l.array.has(e)||Me(i)||s&&!s._f)&&!Oe(i)?A(o,i,r):_(o,i,r)}},C=(e,t,r={})=>{const u=He(a,e),f=l.array.has(e),m=Be(t);Ke(o,e,m),f?(d.array.next({name:e,values:{...o}}),(c.isDirty||c.dirtyFields)&&r.shouldDirty&&d.state.next({name:e,dirtyFields:Ut(i,o),isDirty:x(e,m)})):!u||u._f||Pe(m)?_(e,m,r):A(e,m,r),ht(e,l)&&d.state.next({...n}),d.values.next({name:s.mount?e:void 0,values:{...o}})},k=async e=>{s.mount=!0;const i=e.target;let u=i.name,v=!0;const x=He(a,u),S=()=>i.type?Wt(x._f):(e=>Me(e)&&e.target?Le(e.target)?e.target.checked:e.target.value:e)(e),_=e=>{v=Number.isNaN(e)||Oe(e)&&isNaN(e.getTime())||Nt(e,He(o,u,e))};if(x){let i,s;const C=S(),k=e.type===Ye||e.type===Ge,F=!((A=x._f).mount&&(A.required||A.min||A.max||A.maxLength||A.minLength||A.pattern||A.validate)||r.resolver||He(n.errors,u)||x._f.deps)||((e,t,r,n,a)=>!a.isOnAll&&(!r&&a.isOnTouch?!(t||e):(r?n.isOnBlur:a.isOnBlur)?!e:!(r?n.isOnChange:a.isOnChange)||e))(k,He(n.touchedFields,u),n.isSubmitted,m,f),V=ht(u,l,k);Ke(o,u,C),k?(x._f.onBlur&&x._f.onBlur(e),t&&t(0)):x._f.onChange&&x._f.onChange(e);const $=g(u,C,k,!1),R=!ut($)||V;if(!k&&d.values.next({name:u,type:e.type,values:{...o}}),F)return c.isValid&&("onBlur"===r.mode&&k?p():k||p()),R&&d.state.next({name:u,...V?{}:$});if(!k&&V&&d.state.next({...n}),r.resolver){const{errors:e}=await w([u]);if(_(C),v){const t=zt(n.errors,a,u),r=zt(e,a,t.name||u);i=r.error,u=r.name,s=ut(e)}}else y([u],!0),i=(await Vt(x,l.disabled,o,h,r.shouldUseNativeValidation))[u],y([u]),_(C),v&&(i?s=!1:c.isValid&&(s=await E(a,!0)));v&&(x._f.deps&&D(x._f.deps),b(u,s,i,$))}var A},F=(e,t)=>{if(He(n.errors,t)&&e.focus)return e.focus(),1},D=async(e,t={})=>{let i,o;const s=ct(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await w(e);if(e)for(const r of e){const e=He(t,r);e?Ke(n.errors,r,e):$t(n.errors,r)}else n.errors=t;return t})(Ie(e)?e:s);i=ut(t),o=e?!s.some((e=>He(t,e))):i}else e?(o=(await Promise.all(s.map((async e=>{const t=He(a,e);return await E(t&&t._f?{[e]:t}:t)})))).every(Boolean),(o||n.isValid)&&p()):o=i=await E(a);return d.state.next({...!dt(e)||c.isValid&&i!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:i}:{},errors:n.errors}),t.shouldFocus&&!o&&pt(a,F,e?s:l.mount),o},V=e=>{const t={...s.mount?o:i};return Ie(e)?t:dt(e)?He(t,e):e.map((e=>He(t,e)))},$=(e,t)=>({invalid:!!He((t||n).errors,e),isDirty:!!He((t||n).dirtyFields,e),error:He((t||n).errors,e),isValidating:!!He(n.validatingFields,e),isTouched:!!He((t||n).touchedFields,e)}),R=(e,t,r)=>{const i=(He(a,e,{_f:{}})._f||{}).ref,o=He(n.errors,e)||{},{ref:s,message:l,type:u,...c}=o;Ke(n.errors,e,{...c,...t,ref:i}),d.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&i&&i.focus&&i.focus()},T=(e,t={})=>{for(const s of e?ct(e):l.mount)l.mount.delete(s),l.array.delete(s),t.keepValue||($t(a,s),$t(o,s)),!t.keepError&&$t(n.errors,s),!t.keepDirty&&$t(n.dirtyFields,s),!t.keepTouched&&$t(n.touchedFields,s),!t.keepIsValidating&&$t(n.validatingFields,s),!r.shouldUnregister&&!t.keepDefaultValue&&$t(i,s);d.values.next({values:{...o}}),d.state.next({...n,...t.keepDirty?{isDirty:x()}:{}}),!t.keepIsValid&&p()},N=({disabled:e,name:t,field:r,fields:n})=>{(ze(e)&&s.mount||e||l.disabled.has(t))&&(e?l.disabled.add(t):l.disabled.delete(t),g(t,Wt(r?r._f:He(n,t)._f),!1,!1,!0))},L=(e,t={})=>{let n=He(a,e);const o=ze(t.disabled)||ze(r.disabled);return Ke(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),l.mount.add(e),n?N({field:n,disabled:ze(t.disabled)?t.disabled:r.disabled,name:e}):v(e,!0,t.value),{...o?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:It(t.min),max:It(t.max),minLength:It(t.minLength),maxLength:It(t.maxLength),pattern:It(t.pattern)}:{},name:e,onChange:k,onBlur:k,ref:o=>{if(o){L(e,t),n=He(a,e);const r=Ie(o.value)&&o.querySelectorAll&&o.querySelectorAll("input,select,textarea")[0]||o,s=(e=>Et(e)||Le(e))(r),l=n._f.refs||[];if(s?l.find((e=>e===r)):r===n._f.ref)return;Ke(a,e,{_f:{...n._f,...s?{refs:[...l.filter(Ot),r,...Array.isArray(He(i,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),v(e,!1,void 0,r)}else n=He(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!((e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)))(l.array,e)||!s.action)&&l.unMount.add(e)}}},O=()=>r.shouldFocusError&&pt(a,F,l.mount),P=(e,t)=>async i=>{let s;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let u=Be(o);if(l.disabled.size)for(const e of l.disabled)Ke(u,e,void 0);if(d.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await w();n.errors=e,u=t}else await E(a);if($t(n.errors,"root"),ut(n.errors)){d.state.next({errors:{}});try{await e(u,i)}catch(e){s=e}}else t&&await t({...n.errors},i),O(),setTimeout(O);if(d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ut(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},j=(e,t={})=>{const u=e?Be(e):i,f=Be(u),m=ut(e),h=m?i:f;if(t.keepDefaultValues||(i=u),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(Ut(i,o))]);for(const t of Array.from(e))He(n.dirtyFields,t)?Ke(h,t,He(o,t)):C(t,He(h,t))}else{if(Ue&&Ie(e))for(const e of l.mount){const t=He(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(bt(e)){const t=e.closest("form");if(t){t.reset();break}}}}a={}}o=r.shouldUnregister?t.keepDefaultValues?Be(i):{}:Be(h),d.array.next({values:{...h}}),d.values.next({values:{...h}})}l={mount:t.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!c.isValid||!!t.keepIsValid||!!t.keepDirtyValues,s.watch=!!r.shouldUnregister,d.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!m&&(t.keepDirty?n.isDirty:!(!t.keepDefaultValues||Nt(e,i))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:m?{}:t.keepDirtyValues?t.keepDefaultValues&&o?Ut(i,o):n.dirtyFields:t.keepDefaultValues&&e?Ut(i,e):t.keepDirty?n.dirtyFields:{},touchedFields:t.keepTouched?n.touchedFields:{},errors:t.keepErrors?n.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1})},M=(e,t)=>j(gt(e)?e(o):e,t);return{control:{register:L,unregister:T,getFieldState:$,handleSubmit:P,setError:R,_executeSchema:w,_getWatch:S,_getDirty:x,_updateValid:p,_removeUnmounted:()=>{for(const e of l.unMount){const t=He(a,e);t&&(t._f.refs?t._f.refs.every((e=>!Ot(e))):!Ot(t._f.ref))&&T(e)}l.unMount=new Set},_updateFieldArray:(e,t=[],l,u,f=!0,m=!0)=>{if(u&&l&&!r.disabled){if(s.action=!0,m&&Array.isArray(He(a,e))){const t=l(He(a,e),u.argA,u.argB);f&&Ke(a,e,t)}if(m&&Array.isArray(He(n.errors,e))){const t=l(He(n.errors,e),u.argA,u.argB);f&&Ke(n.errors,e,t),((e,t)=>{!We(He(e,t)).length&&$t(e,t)})(n.errors,e)}if(c.touchedFields&&m&&Array.isArray(He(n.touchedFields,e))){const t=l(He(n.touchedFields,e),u.argA,u.argB);f&&Ke(n.touchedFields,e,t)}c.dirtyFields&&(n.dirtyFields=Ut(i,o)),d.state.next({name:e,isDirty:x(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Ke(o,e,t)},_updateDisabledField:N,_getFieldArray:e=>We(He(s.mount?o:i,e,r.shouldUnregister?He(i,e,[]):[])),_reset:j,_resetDefaultValues:()=>gt(r.defaultValues)&&r.defaultValues().then((e=>{M(e,r.resetOptions),d.state.next({isLoading:!1})})),_updateFormState:e=>{n={...n,...e}},_disableForm:e=>{ze(e)&&(d.state.next({disabled:e}),pt(a,((t,r)=>{const n=He(a,r);n&&(t.disabled=n._f.disabled||e,Array.isArray(n._f.refs)&&n._f.refs.forEach((t=>{t.disabled=n._f.disabled||e})))}),0,!1))},_subjects:d,_proxyFormState:c,_setErrors:e=>{n.errors=e,d.state.next({errors:n.errors,isValid:!1})},get _fields(){return a},get _formValues(){return o},get _state(){return s},set _state(e){s=e},get _defaultValues(){return i},get _names(){return l},set _names(e){l=e},get _formState(){return n},set _formState(e){n=e},get _options(){return r},set _options(e){r={...r,...e}}},trigger:D,register:L,handleSubmit:P,watch:(e,t)=>gt(e)?d.values.subscribe({next:r=>e(S(void 0,t),r)}):S(e,t,!0),setValue:C,getValues:V,reset:M,resetField:(e,t={})=>{He(a,e)&&(Ie(t.defaultValue)?C(e,Be(He(i,e))):(C(e,t.defaultValue),Ke(i,e,Be(t.defaultValue))),t.keepTouched||$t(n.touchedFields,e),t.keepDirty||($t(n.dirtyFields,e),n.isDirty=t.defaultValue?x(e,Be(He(i,e))):x()),t.keepError||($t(n.errors,e),c.isValid&&p()),d.state.next({...n}))},clearErrors:e=>{e&&ct(e).forEach((e=>$t(n.errors,e))),d.state.next({errors:e?n.errors:{}})},unregister:T,setError:R,setFocus:(e,t={})=>{const r=He(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&(e.focus(),t.shouldSelect&&gt(e.select)&&e.select())}},getFieldState:$}}function Kt(e={}){const r=t.useRef(void 0),n=t.useRef(void 0),[a,i]=t.useState({isDirty:!1,isValidating:!1,isLoading:gt(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:gt(e.defaultValues)?void 0:e.defaultValues});r.current||(r.current={...qt(e),formState:a});const o=r.current.control;return o._options=e,function(e){const r=t.useRef(e);r.current=e,t.useEffect((()=>{const t=!e.disabled&&r.current.subject&&r.current.subject.subscribe({next:r.current.next});return()=>{t&&t.unsubscribe()}}),[e.disabled])}({subject:o._subjects.state,next:e=>{((e,t,r)=>{r(e);const{name:n,...a}=e;return ut(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find((e=>t[e]===tt))})(e,o._proxyFormState,o._updateFormState)&&i({...o._formState})}}),t.useEffect((()=>o._disableForm(e.disabled)),[o,e.disabled]),t.useEffect((()=>{if(o._proxyFormState.isDirty){const e=o._getDirty();e!==a.isDirty&&o._subjects.state.next({isDirty:e})}}),[o,a.isDirty]),t.useEffect((()=>{e.values&&!Nt(e.values,n.current)?(o._reset(e.values,o._options.resetOptions),n.current=e.values,i((e=>({...e})))):o._resetDefaultValues()}),[e.values,o]),t.useEffect((()=>{e.errors&&o._setErrors(e.errors)}),[e.errors,o]),t.useEffect((()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()})),t.useEffect((()=>{e.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})}),[e.shouldUnregister,o]),r.current.formState=((e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const r in e)Object.defineProperty(a,r,{get:()=>{const a=r;return t._proxyFormState[a]!==tt&&(t._proxyFormState[a]=!n||tt),e[a]}});return a})(a,o),r.current}const Yt={getList:(e,t)=>fetch(e,{method:"GET",headers:{"Content-Type":"application/json"},body:JSON.stringify({page:t})}).then((e=>e.json())),create:(e,t)=>fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then((e=>e.json())),details:(e,t)=>fetch(`${e}/${t}`,{method:"GET",headers:{"Content-Type":"application/json"}}).then((e=>e.json())),edit:(e,t)=>fetch(`${e}/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then((e=>e.json()))};function Gt({data:e,screen:r}){const{register:i,handleSubmit:o,reset:s,formState:{errors:l}}=Kt({resolver:a.screens[r.controller].resolver,defaultValues:e}),u=q(),c=a.screens[r.controller].fields;return n((()=>{s(e)}),[e,s]),t.createElement("div",{className:"form-wrapper"},t.createElement("form",{onSubmit:o((t=>{e?Yt.edit(r.controller,t).then((()=>{u("/"+r.controller,{replace:!0})})):Yt.create(r.controller,t).then((()=>{u("/"+r.controller,{replace:!0})}))}))},c.map((e=>t.createElement("div",{className:"form-field",key:e},t.createElement("label",{htmlFor:e},e.charAt(0).toUpperCase()+e.slice(1)),t.createElement("input",{type:"text",...i(e),placeholder:`Enter ${e}`,id:e}),l[e]&&t.createElement("span",{className:"error-message"},l[e]?.message)))),t.createElement("button",{type:"submit",className:"submit-button"},"Submit")))}function Xt({screen:e}){return t.createElement(Ne,null,t.createElement(Gt,{screen:e}))}function Qt({screen:e}){const{id:a}=Y(),[i,o]=r(null),[s,l]=r(null);return n((()=>{e.controller&&a&&Yt.details(e.controller,a).then((e=>{o(e.data)})).catch((e=>{l(e),console.error(e)}))}),[a,e]),t.createElement(Ne,null,t.createElement("p",{dangerouslySetInnerHTML:{__html:JSON.stringify(i,null," <br/>")}}))}function Zt({screen:e}){const{id:a}=Y(),[i,o]=r(null),[s,l]=r(null);return n((()=>{e.controller&&a&&Yt.details(e.controller,a).then((e=>{o(e.data)})).catch((e=>{l(e),console.error(e)}))}),[a,e]),t.createElement(Ne,null,t.createElement(Gt,{data:i,screen:e}))}function er({data:e,cells:r,screen:n}){return e&&0!==e.length?t.createElement("div",{className:"list-wrapper"},t.createElement("div",{className:"header"},"List"),t.createElement("table",{className:"list-table"},t.createElement("thead",null,t.createElement("tr",null,r.map((e=>t.createElement("th",{key:e.name},e.title??e.name))),t.createElement("th",null))),t.createElement("tbody",null,e.map(((e,n)=>t.createElement("tr",{key:n},r.map((r=>{const n=e[r.name];let a=n??"-";if("date"===r.type){if(n){const e=new Date(n);a=`${e.getDate().toString().padStart(2,"0")}/${(e.getMonth()+1).toString().padStart(2,"0")}/${e.getFullYear()} ${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}`}}else a=n?n.toString():r?.placeHolder??"-";let i=a;return r.linkTo&&(i=t.createElement(De,{to:r.linkTo(e)},a)),t.createElement("td",{key:r.name},i)})),t.createElement("td",null,t.createElement(De,{to:"edit/"+(e?.id??"-")},"Edit"),t.createElement(De,{to:"details/"+(e?.id??"-")},"Details")))))))):t.createElement("div",null,"No items available")}function tr({screen:e}){const[i,o]=r(0),[s,l]=r(null),[u,c]=r(null);return n((()=>{e.controller&&Yt.getList(e.controller,i).then((e=>{l(e.data)})).catch((e=>{c(e),console.error(e)}))}),[i,e.controller]),t.createElement(Ne,null,t.createElement(De,{to:"/maps/create"},"Create"),u?t.createElement("p",null,"Error ",u):null,t.createElement(er,{screen:e,cells:a.screens[e.key].cells,data:s}))}function rr(){const e=Object.entries(a.screens);return t.createElement(t.Fragment,null,e.map((([e,r])=>{let n=`/${r.crud.controller}`;const a={key:e,controller:r.crud.controller};return t.createElement(t.Fragment,{key:"index"},t.createElement(se,{path:n+"/create",element:t.createElement(Xt,{screen:a})}),t.createElement(se,{path:n+"/details/:id",element:t.createElement(Qt,{screen:a})}),t.createElement(se,{path:n+"/edit/:id",element:t.createElement(Zt,{screen:a})}),t.createElement(se,{path:n,element:t.createElement(tr,{screen:a})}))})),t.createElement(se,{path:"*",element:t.createElement("div",null,"404 - Not Found")}))}function nr({children:e}){return t.createElement(t.Fragment,null,e)}export{Ne as Layout,nr as Panel,i as createScreens,rr as getScreenForRoutes};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proje-react-panel",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "author": "SEFA DEMİR",
6
6
  "license": "ISC",
@@ -14,8 +14,7 @@
14
14
  "scripts": {
15
15
  "test": "echo \"Error: no test specified\" && exit 1",
16
16
  "build": "rollup -c ",
17
- "lint": "eslint src --ext .ts,.tsx",
18
- "generate-nestjs-entity": "node scripts/generate-nestjs-entity.js"
17
+ "lint": "eslint src --ext .ts,.tsx"
19
18
  },
20
19
  "repository": {
21
20
  "type": "git",
@@ -4,14 +4,12 @@ import { SideBar } from './SideBar';
4
4
 
5
5
  export function Layout({
6
6
  children,
7
- noSidebar = false,
8
7
  }: {
9
8
  children?: React.ReactNode;
10
- noSidebar?: boolean;
11
9
  }) {
12
10
  return (
13
11
  <div className="layout">
14
- {!noSidebar && <SideBar />}
12
+ <SideBar />
15
13
  <main className="content">{children || <Outlet />}</main>
16
14
  </div>
17
15
  );
@@ -12,11 +12,6 @@ export function SideBar() {
12
12
  </button>
13
13
  <nav className='nav-links'>
14
14
  <Link to='/'>Home</Link>
15
- <Link to='/accounts'>Accounts</Link>
16
- <Link to='/maps'>Maps</Link>
17
- <div className='bottom-link'>
18
- <Link to='/settings'>Settings</Link>
19
- </div>
20
15
  </nav>
21
16
  </div>
22
17
  );
package/src/index.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export { createScreens } from "./utils/createScreens";
2
2
  export { getScreenForRoutes } from "./utils/getScreenForRoutes";
3
3
  export { Layout } from "./components/layout/Layout";
4
- export { SideBar } from "./components/layout/SideBar";
5
4
  export {Panel} from "./components/Panel"
@@ -1,147 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require('fs');
4
- const path = require('path');
5
- const { execSync } = require('child_process');
6
- const { program } = require('commander');
7
-
8
- // Define command line parameters
9
- program
10
- .option('--src <path>', 'Source path containing NestJS entity files')
11
- .option('--to <path>', 'Destination path for generated entity files')
12
- .parse(process.argv);
13
-
14
- const options = program.opts();
15
-
16
- // Check if required parameters are provided
17
- if (!options.src || !options.to) {
18
- console.error('Error: Both --src and --to parameters are required');
19
- process.exit(1);
20
- }
21
-
22
- // Resolve paths
23
- const srcPath = path.resolve(process.cwd(), options.src);
24
- const destPath = path.resolve(process.cwd(), options.to);
25
-
26
- // Ensure destination directory exists
27
- if (!fs.existsSync(destPath)) {
28
- fs.mkdirSync(destPath, { recursive: true });
29
- }
30
-
31
- // Find all entity files in the source directory recursively
32
- function findEntityFiles(dir) {
33
- let results = [];
34
-
35
- const files = fs.readdirSync(dir, { withFileTypes: true });
36
-
37
- for (const file of files) {
38
- const fullPath = path.join(dir, file.name);
39
-
40
- if (file.isDirectory()) {
41
- results = results.concat(findEntityFiles(fullPath));
42
- } else if (file.name.endsWith('.entity.ts')) {
43
- results.push(fullPath);
44
- }
45
- }
46
-
47
- return results;
48
- }
49
-
50
- // Extract interfaces ending with *Entity and class-validator decorators
51
- function processEntityFile(filePath) {
52
- const content = fs.readFileSync(filePath, 'utf8');
53
- const fileName = path.basename(filePath);
54
-
55
- // Regular expression to find interfaces ending with Entity
56
- const interfaceRegex = /export\s+interface\s+(\w+Entity)\s*{([^}]*)}/gs;
57
- const interfaceMatches = Array.from(content.matchAll(interfaceRegex));
58
-
59
- const results = [];
60
-
61
- for (const match of interfaceMatches) {
62
- const interfaceName = match[1];
63
- const interfaceContent = match[2];
64
-
65
- // Create a new file with only the interface and class-validator imports
66
- let newContent = `import { ${getClassValidatorImports(content)} } from 'class-validator';\n\n`;
67
- newContent += `export interface ${interfaceName} {\n${extractPropertiesWithDecorators(interfaceContent, content)}\n}`;
68
-
69
- results.push({
70
- name: interfaceName,
71
- content: newContent
72
- });
73
- }
74
-
75
- return results;
76
- }
77
-
78
- // Extract class-validator imports from the original file
79
- function getClassValidatorImports(content) {
80
- const importRegex = /import\s+{([^}]*?)}\s+from\s+['"]class-validator['"]/;
81
- const match = content.match(importRegex);
82
-
83
- if (match && match[1]) {
84
- return match[1].split(',')
85
- .map(imp => imp.trim())
86
- .filter(imp => imp !== '')
87
- .join(', ');
88
- }
89
-
90
- return '';
91
- }
92
-
93
- // Extract properties with class-validator decorators
94
- function extractPropertiesWithDecorators(interfaceContent, fullContent) {
95
- const lines = interfaceContent.split('\n');
96
- let result = '';
97
-
98
- for (const line of lines) {
99
- const propertyMatch = line.match(/^\s*(\w+)[\?:].*$/);
100
-
101
- if (propertyMatch) {
102
- const propName = propertyMatch[1];
103
- const decoratorRegex = new RegExp(`@\\w+\\([^)]*\\)\\s*${propName}`, 'g');
104
- const decoratorMatches = Array.from(fullContent.matchAll(decoratorRegex));
105
-
106
- // Add all decorators for this property
107
- if (decoratorMatches.length > 0) {
108
- for (const dMatch of decoratorMatches) {
109
- const decorator = dMatch[0].split(propName)[0].trim();
110
- result += ` ${decorator}\n`;
111
- }
112
- }
113
-
114
- result += ` ${line.trim()}\n\n`;
115
- }
116
- }
117
-
118
- return result;
119
- }
120
-
121
- // Main function
122
- function main() {
123
- try {
124
- console.log(`Searching for entity files in ${srcPath}...`);
125
- const entityFiles = findEntityFiles(srcPath);
126
-
127
- console.log(`Found ${entityFiles.length} entity files.`);
128
-
129
- for (const file of entityFiles) {
130
- console.log(`Processing ${file}...`);
131
- const entities = processEntityFile(file);
132
-
133
- for (const entity of entities) {
134
- const outputPath = path.join(destPath, `${entity.name}.ts`);
135
- fs.writeFileSync(outputPath, entity.content);
136
- console.log(`Generated ${outputPath}`);
137
- }
138
- }
139
-
140
- console.log('Done!');
141
- } catch (error) {
142
- console.error('Error:', error.message);
143
- process.exit(1);
144
- }
145
- }
146
-
147
- main();