scriptorium 0.0.1
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.
- package/README.md +110 -0
- package/bin/scriptorium.js +18 -0
- package/build/client/apple-touch-icon.png +0 -0
- package/build/client/assets/_layout-D-bxuQBW.js +1 -0
- package/build/client/assets/_layout-D2eOWFrG.js +1 -0
- package/build/client/assets/_layout-D4m0RbUC.js +1 -0
- package/build/client/assets/_layout-DggtTDZp.js +1 -0
- package/build/client/assets/ack-yx2DGjj6.js +1 -0
- package/build/client/assets/auth-shell-FEL5QDuP.js +1 -0
- package/build/client/assets/begin-DP2rzg_V.js +1 -0
- package/build/client/assets/begin-l0sNRNKZ.js +1 -0
- package/build/client/assets/chunk-EPOLDU6W-B-j6nV8T.js +26 -0
- package/build/client/assets/cn-Kn7NbJqM.js +1 -0
- package/build/client/assets/confirm-passkey-ntLsS7_k.js +1 -0
- package/build/client/assets/entry.client-BkscxSA6.js +5 -0
- package/build/client/assets/events-l0sNRNKZ.js +1 -0
- package/build/client/assets/file-list-DBDZbrBp.js +1 -0
- package/build/client/assets/files-Bzkr7-i7.js +1 -0
- package/build/client/assets/files-browser-KNurSsen.js +1 -0
- package/build/client/assets/files-cnv1kfgp.js +1 -0
- package/build/client/assets/files.browse-9p4xl9MV.js +1 -0
- package/build/client/assets/finish-DP2rzg_V.js +1 -0
- package/build/client/assets/finish-l0sNRNKZ.js +1 -0
- package/build/client/assets/git-CjSY0eSC.js +1 -0
- package/build/client/assets/git-T0lLjMNd.js +1 -0
- package/build/client/assets/git-browser-DwSOY6QN.js +1 -0
- package/build/client/assets/iconify-BDcX0yw8.js +1 -0
- package/build/client/assets/index-8zQ7Fizv.js +9 -0
- package/build/client/assets/index-BUN6tnpl.js +1 -0
- package/build/client/assets/index-BlNoCKAt.js +1 -0
- package/build/client/assets/index-g2QB9BbT.js +1 -0
- package/build/client/assets/instance-events-provider-DTYnvumj.js +39 -0
- package/build/client/assets/instance-route-C25LRYYo.js +1 -0
- package/build/client/assets/instances-CzjXhR3c.js +1 -0
- package/build/client/assets/instances._instanceId.proxy._-l0sNRNKZ.js +1 -0
- package/build/client/assets/instances._instanceId.sessions._sessionId.test-COZIMxji.js +208 -0
- package/build/client/assets/instances.new-BZi5xwEV.js +1 -0
- package/build/client/assets/login-Bwt79t7_.js +1 -0
- package/build/client/assets/logout-l0sNRNKZ.js +1 -0
- package/build/client/assets/magic-string.es-DjU5CGuV.js +10 -0
- package/build/client/assets/manifest-3c01c628.js +1 -0
- package/build/client/assets/message-card-BclR_JqA.css +1 -0
- package/build/client/assets/message-card-DJ5C3WNp.js +34 -0
- package/build/client/assets/passkeys-DpNQs4bn.js +1 -0
- package/build/client/assets/register-DXPj5RLZ.js +1 -0
- package/build/client/assets/root-DxD-Skic.css +1 -0
- package/build/client/assets/root-DxyfhNRI.js +1 -0
- package/build/client/assets/route-handle-DcEil3NY.js +1 -0
- package/build/client/assets/safe-area-DTPfLjT-.css +1 -0
- package/build/client/assets/safe-area.module-CwCzHS6V.js +1 -0
- package/build/client/assets/scroll-indicator-CFaTM_rb.js +12 -0
- package/build/client/assets/scroll-indicator-D4qxLVUu.css +1 -0
- package/build/client/assets/scrollable-layout-CS-vPTNM.js +1 -0
- package/build/client/assets/session-route-oxi4s_Qg.js +1 -0
- package/build/client/assets/sessions-provider-D1t07kir.js +1 -0
- package/build/client/assets/settings-CameSNIM.js +1 -0
- package/build/client/assets/sidebar-DRhB33rT.js +1 -0
- package/build/client/assets/use-double-check-CbbarqDt.js +1 -0
- package/build/client/assets/webauthn.client-C1ZSQfKs.js +2 -0
- package/build/client/dev-sw.js +7 -0
- package/build/client/favicon.ico +0 -0
- package/build/client/icon-192.png +0 -0
- package/build/client/icon-512.png +0 -0
- package/build/client/icon-maskable-512.png +0 -0
- package/build/client/icon-maskable.svg +8 -0
- package/build/client/icon.svg +8 -0
- package/build/client/manifest.webmanifest +28 -0
- package/build/client/sw.js +73 -0
- package/build/runtime/app/lib/runtime-config.server.js +422 -0
- package/build/runtime/cli/scriptorium.js +21 -0
- package/build/runtime/cli/serve.js +101 -0
- package/build/server/index.js +8574 -0
- package/docs/config.md +49 -0
- package/drizzle/20260312181200_fair_caretaker/migration.sql +54 -0
- package/drizzle/20260312181200_fair_caretaker/snapshot.json +484 -0
- package/drizzle/20260313000548_windy_paibok/migration.sql +37 -0
- package/drizzle/20260313000548_windy_paibok/snapshot.json +617 -0
- package/drizzle/20260318120000_session_read_statuses/migration.sql +11 -0
- package/drizzle/20260318120000_session_read_statuses/snapshot.json +710 -0
- package/drizzle/20260318213224_dear_captain_midlands/migration.sql +24 -0
- package/drizzle/20260318213224_dear_captain_midlands/snapshot.json +695 -0
- package/package.json +88 -0
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Scriptorium
|
|
2
|
+
|
|
3
|
+
Scriptorium is an experimental single-user, multi-device app for browsing local workspaces and running OpenCode-backed coding sessions through a React Router interface.
|
|
4
|
+
|
|
5
|
+
This repo is intentionally exploratory. Expect rough edges, fast iteration, and incomplete product decisions while the project settles.
|
|
6
|
+
|
|
7
|
+
## What It Does
|
|
8
|
+
|
|
9
|
+
- Launches and tracks local coding instances
|
|
10
|
+
- Browses workspace files and git state from the app
|
|
11
|
+
- Streams session events and message history
|
|
12
|
+
- Uses passkey-based authentication for local access
|
|
13
|
+
|
|
14
|
+
## Requirements
|
|
15
|
+
|
|
16
|
+
- Node.js 20+
|
|
17
|
+
- npm
|
|
18
|
+
- `opencode` available on your PATH, or an explicit `OPENCODE_BIN`
|
|
19
|
+
- Optional: Tailscale if you want `npm start` to expose the app through `tailscale serve`
|
|
20
|
+
|
|
21
|
+
## Getting Started
|
|
22
|
+
|
|
23
|
+
Install dependencies:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Run the development server:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm run dev
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`npm run dev` uses the React Router/Vite dev server directly. It does not use the production CLI entrypoint or start Tailscale.
|
|
36
|
+
|
|
37
|
+
Create a production build:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm run build
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Start the built app:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm start
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The published package uses the same entrypoint:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npx scriptorium
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Pass runtime flags through `npm start --`:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm start -- --host=127.0.0.1 --port=6200 --no-tailscale
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
By default, development and production both run on port `5174`.
|
|
62
|
+
|
|
63
|
+
For the full generated config reference, see `docs/config.md`.
|
|
64
|
+
|
|
65
|
+
## Configuration
|
|
66
|
+
|
|
67
|
+
Scriptorium reads runtime settings from:
|
|
68
|
+
|
|
69
|
+
- CLI flags passed to `npm start -- ...`
|
|
70
|
+
- environment variables
|
|
71
|
+
- `config.yml` for non-sensitive settings
|
|
72
|
+
- `secrets.yml` for secrets such as the session signing secret
|
|
73
|
+
|
|
74
|
+
Precedence is: CLI flags -> environment variables -> YAML values -> schema defaults.
|
|
75
|
+
|
|
76
|
+
Common flags and env vars include:
|
|
77
|
+
|
|
78
|
+
- `--host` / `HOST`
|
|
79
|
+
- `--port` / `PORT`
|
|
80
|
+
- `--browser-root` / `SCRIPTORIUM_BROWSER_ROOT`
|
|
81
|
+
- `--db-path` / `SCRIPTORIUM_DB_PATH`
|
|
82
|
+
- `--opencode-bin` / `OPENCODE_BIN`
|
|
83
|
+
- `--tailscale` / `--no-tailscale`
|
|
84
|
+
- `SESSION_SECRET` to override the generated session secret
|
|
85
|
+
|
|
86
|
+
Example:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
HOST=127.0.0.1 \
|
|
90
|
+
PORT=6200 \
|
|
91
|
+
SCRIPTORIUM_BROWSER_ROOT=$HOME/src \
|
|
92
|
+
OPENCODE_BIN=opencode \
|
|
93
|
+
npm start -- --no-tailscale
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Tailscale On Launch
|
|
97
|
+
|
|
98
|
+
The production entrypoint starts the built React Router server and optionally runs `tailscale serve` when `tailscale: true` is set in config or `--tailscale` is passed.
|
|
99
|
+
|
|
100
|
+
Use `--no-tailscale` to force local-only startup for a run.
|
|
101
|
+
|
|
102
|
+
If Tailscale is enabled and installed/authenticated, that makes the app reachable through your Tailnet. If Tailscale is missing or unavailable, startup continues normally and the app stays local-only.
|
|
103
|
+
|
|
104
|
+
On shutdown, the script also tries to turn the Tailscale serve configuration back off.
|
|
105
|
+
|
|
106
|
+
## Notes
|
|
107
|
+
|
|
108
|
+
- The app is designed around a personal/local workflow, not a multi-tenant hosted service
|
|
109
|
+
- Runtime config and secrets live in the per-user Scriptorium data directory, documented in `docs/config.md`
|
|
110
|
+
- This repository does not include Docker configuration
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
|
+
|
|
7
|
+
process.env.NODE_ENV = process.env.NODE_ENV ?? "production";
|
|
8
|
+
|
|
9
|
+
const runtimeCliPath = fileURLToPath(new URL("../build/runtime/cli/scriptorium.js", import.meta.url));
|
|
10
|
+
|
|
11
|
+
if (!existsSync(runtimeCliPath)) {
|
|
12
|
+
process.stderr.write(
|
|
13
|
+
"Scriptorium is not built yet. Run `npm run build` before `npm start`, or install the published package.\n",
|
|
14
|
+
);
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
await import(pathToFileURL(path.resolve(runtimeCliPath)).href);
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{w as t}from"./chunk-EPOLDU6W-B-j6nV8T.js";import{j as o}from"./files.browse-9p4xl9MV.js";import{A as r}from"./auth-shell-FEL5QDuP.js";import"./safe-area.module-CwCzHS6V.js";const i=t(function(){return o.jsx(r,{})});export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{w as he,b as xe,u as X,z as be,O as ye}from"./chunk-EPOLDU6W-B-j6nV8T.js";import{r as i,j as a}from"./files.browse-9p4xl9MV.js";import{I as P}from"./iconify-BDcX0yw8.js";import{u as je}from"./instance-events-provider-DTYnvumj.js";import{S as Se}from"./scrollable-layout-CS-vPTNM.js";import{d as we}from"./route-handle-DcEil3NY.js";import{s as Ie}from"./safe-area.module-CwCzHS6V.js";import{a as Ne,g as ve}from"./session-route-oxi4s_Qg.js";function ke(s,r){return`/instances/${s}/proxy${r}`}async function Pe(s,r,n){const o=await fetch(ke(s,`/permission/${r}/reply`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reply:n})});if(!o.ok)throw new Error(`Permission reply failed with ${o.status}`)}function Y(s){return[...s].sort((r,n)=>r.info.time.created-n.info.time.created)}function Re(s,r){return s.find(o=>o.info.id===r.id)?Y(s.map(o=>o.info.id===r.id?{...o,info:r}:o)):Y([...s,{info:r,parts:[]}])}function Ee(s,r){return s.filter(n=>n.info.id!==r)}function De(s,r){return s.map(n=>{if(n.info.id!==r.messageID)return n;const o=n.parts.some(l=>l.id===r.id)?n.parts.map(l=>l.id===r.id?r:l):[...n.parts,r];return{...n,parts:o}})}function Ce(s,r,n){return s.map(o=>o.info.id!==r?o:{...o,parts:o.parts.filter(l=>l.id!==n)})}function Ae(s,r,n,o,l){return s.map(d=>d.info.id!==r?d:{...d,parts:d.parts.map(u=>u.id!==n||u.type!=="text"&&u.type!=="reasoning"||o!=="text"?u:{...u,text:u.text+l})})}const Te=s=>s.mode!=="subagent"&&s.hidden!==!0;function O(s){return s.filter(Te)}function Me(s,r){const n=O(r);if(!n.length)return null;const o=n.findIndex(l=>l.name===s);return o<0?n[0].name:n[(o+1)%n.length].name}function $e(s,r){const n=O(r);if(!n.length)return null;const o=new Set(n.map(d=>d.name)),l=s.reduce((d,u)=>{const m=u.info.agent;return typeof m!="string"||!o.has(m)?d:d?u.info.time.created>d.info.time.created?u:d:u},null);return l?.info.agent?l.info.agent:n[0].name}function R(s){return s.type.startsWith("image/")}const Je=we({title:({data:s,params:r})=>ve({instanceId:r.instanceId,instanceName:s?.instance?.name,session:s?.session,sessionId:r.sessionId}),iconNavActions:({params:s})=>{const r=s.instanceId??"",n=s.sessionId??"";return Ne(r,n)}}),Ke=he(function({loaderData:r}){const{initialAgents:n,initialMessages:o,initialPermissions:l,initialStatus:d,instance:u,session:m}=r,[Z]=xe(),h=Z.get("prompt")??"",[E,S]=i.useState(""),[ee,x]=i.useState(o),[D,w]=i.useState(l),[te,U]=i.useState(m),[z,F]=i.useState(d),[C,B]=i.useState(null),f=X(),I=X(),q=be(),H=i.useRef(null),N=i.useRef(null),g=i.useRef({start:0,end:0}),se=i.useRef(0),J=i.useRef([]),A=i.useMemo(()=>O(n),[n]),T=i.useMemo(()=>$e(o,n),[o,n]),[v,K]=i.useState(T),[b,M]=i.useState([]),ne=i.useMemo(()=>["message.updated","message.removed","message.part.updated","message.part.delta","message.part.removed","permission.asked","permission.replied","session.updated","session.status","session.error"],[]);i.useEffect(()=>{x(o)},[o,m.id]),i.useEffect(()=>{F(d)},[d,m.id]),i.useEffect(()=>{U(m)},[m]),i.useEffect(()=>{w(l)},[l,m.id]),i.useEffect(()=>{S(h);const e=h.length;g.current={start:e,end:e}},[h,m.id]),i.useEffect(()=>{f.data?.ok&&f.data.intent==="prompt"&&(S(""),M(e=>(e.forEach(t=>URL.revokeObjectURL(t.preview)),[])),B(null),g.current={start:0,end:0})},[f.data]),i.useEffect(()=>{J.current=b},[b]),i.useEffect(()=>()=>{J.current.forEach(e=>URL.revokeObjectURL(e.preview))},[]);const y=i.useCallback(e=>{const t=e??N.current;t&&(g.current={start:t.selectionStart??0,end:t.selectionEnd??t.selectionStart??0})},[]),re=i.useCallback(e=>{let t=0,p=0;S(c=>{const Q=c.length,de=g.current.start,pe=g.current.end,j=Math.max(0,Math.min(de,Q)),L=Math.max(j,Math.min(pe,Q)),me=j>0&&/\S/.test(c[j-1]??"")?" ":"",fe=L===c.length||/\S/.test(c[L]??"")?" ":"",V=`${me}${e}${fe}`,ge=`${c.slice(0,j)}${V}${c.slice(L)}`,k=j+V.length;return t=k,p=k,g.current={start:k,end:k},ge}),window.requestAnimationFrame(()=>{const c=N.current;c&&(c.focus(),c.setSelectionRange(t,p),g.current={start:t,end:p})})},[]),$=i.useCallback(async e=>{const t=Array.from(e).filter(R);if(t.length===0)return;const p=await Promise.all(t.map(async c=>({id:`image-${se.current++}`,file:c,preview:URL.createObjectURL(c)})));M(c=>[...c,...p])},[]),ie=i.useCallback(e=>{M(t=>{const p=t.find(c=>c.id===e);return p&&URL.revokeObjectURL(p.preview),t.filter(c=>c.id!==e)})},[]),ae=i.useCallback(()=>{K(e=>Me(e,A))},[A]),oe=i.useCallback(()=>{const e=new FormData;e.set("intent","prompt"),e.set("agent",v??""),e.set("text",E),b.forEach(t=>e.append("attachments",t.file,t.file.name)),f.submit(e,{method:"post",encType:"multipart/form-data"})},[E,b,f,v]);i.useEffect(()=>{h&&window.requestAnimationFrame(()=>{const e=N.current;if(!e)return;const t=h.length;e.focus(),e.setSelectionRange(t,t),g.current={start:t,end:t}})},[h]);const ce=i.useCallback(async(e,t)=>{const p=D.filter(c=>c.id!==e);w(p);try{await Pe(u.id,e,t)}catch{q.revalidate()}},[u.id,D,q]);i.useEffect(()=>{K(T)},[T,m.id]),je(e=>{switch(e.type){case"session.status":{F(e.properties.status);return}case"session.updated":{U(e.properties.info);return}case"session.error":{B(e.properties.error.message??e.properties.error.name);return}case"message.updated":{x(t=>Re(t,e.properties.info));return}case"message.removed":{x(t=>Ee(t,e.properties.messageID));return}case"message.part.updated":{x(t=>De(t,e.properties.part));return}case"message.part.delta":{x(t=>Ae(t,e.properties.messageID,e.properties.partID,e.properties.field,e.properties.delta));return}case"message.part.removed":{x(t=>Ce(t,e.properties.messageID,e.properties.partID));return}case"permission.asked":{w(t=>t.some(p=>p.id===e.properties.id)?t:[...t,e.properties]);return}case"permission.replied":{w(t=>t.filter(p=>p.id!==e.properties.requestID));return}default:return}},{instanceId:u.id,sessionId:m.id,types:ne});const W=f.data?.intent==="prompt"?f.data.error:null,_=I.data?.intent==="abort"?I.data.error:null,G=f.state!=="idle",le=I.state!=="idle",ue=z.type!=="idle";return a.jsx(Se,{stickToBottom:!0,footer:a.jsx("div",{className:`${Ie.footerPad4} border-t-2 border-black px-6 pt-4 sm:px-8`,children:a.jsxs("div",{className:"space-y-3",children:[W?a.jsx("p",{className:"text-base leading-6",children:W}):null,_?a.jsx("p",{className:"text-base leading-6",children:_}):null,C?a.jsx("p",{className:"text-base leading-6",children:C}):null,a.jsxs("div",{className:"flex items-stretch gap-2",children:[a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs(f.Form,{className:"min-w-0 flex-1",method:"post",onSubmit:e=>e.preventDefault(),children:[a.jsx("input",{name:"intent",type:"hidden",value:"prompt"}),a.jsx("input",{name:"agent",type:"hidden",value:v??""}),a.jsx("input",{accept:"image/*",className:"hidden",multiple:!0,onChange:e=>{e.currentTarget.files&&$(e.currentTarget.files),e.currentTarget.value=""},ref:H,type:"file"}),b.length?a.jsx("div",{className:"flex flex-wrap gap-2 border-b-2 border-black px-3 py-3",children:b.map(e=>a.jsxs("div",{className:"relative size-20 overflow-hidden border-2 border-black bg-white",children:[a.jsx("img",{alt:e.file.name,className:"size-full object-cover",src:e.preview}),a.jsx("button",{"aria-label":`Remove ${e.file.name}`,className:"absolute right-1 top-1 inline-flex size-6 items-center justify-center border-2 border-black bg-white",onClick:()=>ie(e.id),type:"button",children:a.jsx(P,{className:"size-4",icon:"mdi:close"})})]},e.id))}):null,a.jsx("textarea",{className:"min-h-32 w-full px-3 py-2 text-base leading-7",name:"text",onBlur:e=>y(e.currentTarget),onChange:e=>{S(e.currentTarget.value),y(e.currentTarget)},onClick:e=>y(e.currentTarget),onKeyUp:e=>y(e.currentTarget),onPaste:e=>{const t=Array.from(e.clipboardData.files??[]).filter(R);t.length!==0&&(e.preventDefault(),$(t))},onDragOver:e=>{Array.from(e.dataTransfer?.files??[]).some(R)&&e.preventDefault()},onDrop:e=>{const t=Array.from(e.dataTransfer.files??[]).filter(R);t.length!==0&&(e.preventDefault(),$(t))},onSelect:e=>y(e.currentTarget),placeholder:"Send a message, paste an image, or attach one",ref:N,value:E})]})}),a.jsxs("div",{className:"flex shrink-0 self-stretch flex-col items-stretch justify-between gap-1",children:[a.jsx("button",{"aria-label":"Cycle agent",className:"min-h-11 bg-white px-3 py-2 text-left text-sm leading-5 disabled:opacity-25",disabled:!A.length,onClick:ae,onPointerDown:e=>e.preventDefault(),type:"button",children:v??"No agent"}),a.jsxs("div",{className:"flex items-end gap-2",children:[a.jsx("button",{"aria-label":"Attach image",className:"inline-flex min-h-11 min-w-11 items-center justify-center bg-white disabled:opacity-25",disabled:G,onClick:()=>H.current?.click(),type:"button",children:a.jsx(P,{className:"size-6",icon:"mdi:image-plus"})}),a.jsxs(I.Form,{method:"post",children:[a.jsx("input",{name:"intent",type:"hidden",value:"abort"}),a.jsx("button",{"aria-label":"Stop current response",className:"inline-flex min-h-11 min-w-11 items-center justify-center disabled:opacity-25",disabled:le||!ue,onPointerDown:e=>e.preventDefault(),type:"submit",children:a.jsx(P,{className:"size-6",icon:"mdi:stop-circle"})})]}),a.jsx("button",{"aria-label":"Send message",className:"inline-flex min-h-11 min-w-11 items-center justify-center bg-black text-white disabled:opacity-25",disabled:G,onClick:oe,onPointerDown:e=>e.preventDefault(),type:"button",children:a.jsx(P,{className:"size-6",icon:"mdi:send"})})]})]})]})]})}),children:a.jsx(ye,{context:{instance:u,insertComposerReference:re,messages:ee,pendingPermissions:D,replyPermission:ce,session:te,sessionError:C,status:z}})})});export{Ke as default,Je as handle};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{w as n,O as o}from"./chunk-EPOLDU6W-B-j6nV8T.js";import{j as i}from"./files.browse-9p4xl9MV.js";import{d as s}from"./route-handle-DcEil3NY.js";const l=s({iconNavActions:t=>{const e=t.params.instanceId??"";return[{icon:"mdi:view-dashboard-outline",label:"Instance overview",to:`/instances/${e}`,end:!0},{icon:"mdi:source-branch",label:"Git view",to:`/instances/${e}/git`,end:!0},{icon:"mdi:file-document-multiple-outline",label:"Files view",to:`/instances/${e}/files`,end:!0}]}}),u=n(function(e){return i.jsx(o,{})});export{u as default,l as handle};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as d,F as h,B as y,O as g,w as S}from"./chunk-EPOLDU6W-B-j6nV8T.js";import{r as o,j as e}from"./files.browse-9p4xl9MV.js";import{u as k,I as E}from"./instance-events-provider-DTYnvumj.js";import{b as j,c as C,u as R,R as $,S as z}from"./sessions-provider-D1t07kir.js";import{I as x}from"./iconify-BDcX0yw8.js";import{c as u}from"./cn-Kn7NbJqM.js";import{S as b,i as L,f as A}from"./sidebar-DRhB33rT.js";import{s as f}from"./safe-area.module-CwCzHS6V.js";import{n as _,r as p}from"./route-handle-DcEil3NY.js";const w=o.createContext(null);function P(n,s){switch(s.type){case"reset":return s.instances;case"add-session":{const t=n[s.instanceId];return!t||t.sessionIds.includes(s.sessionId)?n:{...n,[s.instanceId]:{...t,sessionIds:[...t.sessionIds,s.sessionId]}}}case"remove-session":{const t=n[s.instanceId];return!t||!t.sessionIds.includes(s.sessionId)?n:{...n,[s.instanceId]:{...t,sessionIds:t.sessionIds.filter(a=>a!==s.sessionId)}}}}}function O({children:n,initialInstances:s}){const[t,a]=o.useReducer(P,s);return o.useEffect(()=>{a({type:"reset",instances:s})},[s]),k(i=>{switch(i.type){case"session.created":case"session.updated":a({type:"add-session",instanceId:i.instanceId,sessionId:i.properties.info.id});return;case"session.deleted":a({type:"remove-session",instanceId:i.instanceId,sessionId:i.properties.info.id})}},{types:["session.created","session.updated","session.deleted"]}),e.jsx(w.Provider,{value:t,children:n})}function U(){const n=o.useContext(w);if(!n)throw new Error("useInstances must be used within an InstancesProvider.");return n}function I(){return e.jsx("span",{"aria-hidden":"true",className:"inline-block size-2 rounded-full bg-black","data-testid":"unread-badge"})}function F(n){return[...n].sort((s,t)=>s.name.localeCompare(t.name))}function N(){const n=U(),s=j(),[t,a]=o.useState(()=>Date.now());return o.useEffect(()=>{const i=window.setInterval(()=>{a(Date.now())},6e4);return()=>{window.clearInterval(i)}},[]),o.useMemo(()=>F(Object.values(n).map(i=>{const m=A(i.sessionIds.map(c=>s[c]).filter(c=>c!==void 0),t).map(c=>c.id);return{...i,sessionIds:m}})).filter(i=>i.sessionIds.length>0),[n,t,s])}function M(){const n=N(),s=j();return n.some(t=>t.sessionIds.slice(0,b).some(a=>{const i=s[a];return i?L(i,i.lastReadAt):!1}))}function B(n,s){return n||s.slice(0,12)}function H({instance:n}){const s=n.sessionIds.slice(0,b);return e.jsxs("li",{className:"space-y-0.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 px-3 py-1",children:[e.jsx(d,{className:({isActive:t})=>u("block min-h-9 flex-1 py-2 text-base text-black",{"underline underline-offset-4":t}),to:`/instances/${n.id}`,children:e.jsx("span",{className:"font-bold",children:n.name})}),e.jsxs(h,{action:`/instances/${n.id}?index`,method:"post",children:[e.jsx("input",{name:"intent",type:"hidden",value:"create-session"}),e.jsx("button",{"aria-label":`New session for ${n.name}`,className:"inline-flex h-9 min-w-9 items-center justify-center",type:"submit",children:e.jsx(x,{className:"size-5",icon:"mdi:plus"})})]})]}),e.jsx("ul",{className:"space-y-0.5 pl-6",children:s.map(t=>e.jsx(V,{instanceId:n.id,sessionId:t},t))})]})}function V({instanceId:n,sessionId:s}){const t=C(s),a=R(n,s);return t?e.jsx("li",{children:e.jsx(d,{className:()=>u("grid min-h-9 grid-cols-[0.5rem_minmax(0,1fr)] items-center gap-2 px-3 py-1 text-sm leading-6","text-black"),to:`/instances/${n}/sessions/${s}`,children:({isActive:i})=>e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"flex justify-center",children:a?e.jsx(I,{}):null}),e.jsx("span",{className:u({"underline underline-offset-4":i}),children:B(t.title,s)})]})})}):null}function D(){const n=N();return n.length?e.jsx("ul",{className:"space-y-1",children:n.map(s=>e.jsx(H,{instance:s},s.id))}):null}function T(){return e.jsx("nav",{"aria-label":"Sidebar",className:"pt-2",children:e.jsx(D,{})})}function K({breadcrumbs:n,iconNavActions:s}){const[t,a]=o.useState(!1),i=M(),m=y(),c=n.map(l=>l.label).join(" / "),v=t?"mdi:menu-open":"mdi:menu";return o.useEffect(()=>{a(!1)},[m.pathname]),o.useEffect(()=>{if(!t)return;function l(r){r.key==="Escape"&&a(!1)}return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[t]),e.jsxs("main",{className:`${f.appShell} relative flex min-h-dvh flex-col bg-white text-black`,children:[t?e.jsxs(e.Fragment,{children:[e.jsx("button",{"aria-label":"Close navigation",className:"fixed inset-0 z-20 bg-white/0",onClick:()=>a(!1),type:"button"}),e.jsx("aside",{className:`${f.sidebarShell} fixed inset-y-0 left-0 z-30 w-80 border-r-2 border-black bg-white`,children:e.jsxs("div",{className:"flex h-full flex-col gap-4",children:[e.jsxs("header",{className:"flex items-center justify-between gap-3",children:[e.jsx(d,{className:"inline-flex min-h-11 items-center px-3 py-2 text-sm uppercase tracking-[0.08em] text-black",to:"/instances",children:e.jsx("span",{className:"font-bold",children:"Instances"})}),e.jsx("button",{"aria-label":"Close navigation",className:"inline-flex min-h-11 min-w-11 items-center justify-center",onClick:()=>a(!1),type:"button",children:e.jsx(x,{className:"size-6",icon:"mdi:close"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(T,{})}),e.jsxs("div",{className:"mt-auto space-y-2 border-t-2 border-black",children:[e.jsx(d,{className:"inline-flex min-h-11 w-full items-center justify-center px-3 py-2 text-base",to:"/settings",children:"Settings"}),e.jsx(h,{action:"/logout",method:"post",children:e.jsx("button",{className:"inline-flex min-h-11 min-w-full items-center justify-center bg-black px-3 py-2 text-base text-white",type:"submit",children:"Log out"})})]})]})})]}):null,e.jsxs("div",{className:u(f.appShellContent,"mx-auto flex w-full max-w-5xl flex-col"),children:[e.jsxs("header",{className:"grid grid-cols-[auto_1fr_auto] items-center gap-3 border-b-2 border-black",children:[e.jsxs("button",{"aria-label":"Toggle navigation",className:"relative inline-flex min-h-11 min-w-11 items-center justify-center",onClick:()=>a(l=>!l),type:"button",children:[e.jsx(x,{className:"size-6",icon:v}),i?e.jsx("span",{className:u("pointer-events-none absolute right-1.5 top-0 z-10"),children:e.jsx(I,{})}):null]}),e.jsx("div",{className:"min-w-0",children:e.jsx("h1",{"aria-label":c,className:"overflow-hidden text-2xl font-bold",children:e.jsx("span",{className:"flex w-full min-w-0 items-center overflow-hidden whitespace-nowrap",style:{"--count":n.length},children:n.map((l,r)=>e.jsxs("span",{className:"flex flex-[1_1_0] items-center overflow-hidden min-w-[min(max-content,calc(100%/var(--count)))] max-w-max",children:[r>0?e.jsx("span",{className:"mx-2 shrink-0",children:"/"}):null,l.to?e.jsx(d,{className:"block min-w-0 truncate",to:l.to,children:l.label}):e.jsx("span",{className:"block min-w-0 truncate",children:l.label})]},`${l.to??l.label}-${r}`))})})}),e.jsx("div",{className:"flex items-center",children:s.map(l=>e.jsx(d,{"aria-label":l.label,className:({isActive:r})=>`inline-flex min-h-11 min-w-11 items-center justify-center ${r?"bg-black text-white":"bg-white text-black"}`,end:l.end,to:l.to,children:e.jsx(x,{className:"size-6",icon:l.icon})},l.to))})]}),e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:e.jsx(g,{})})]})]})}const se=S(function({loaderData:s,matches:t}){const a=_(t),i=p(a,"title")??[{label:"Scriptorium"}],m=p(a,"iconNavActions")??[];return e.jsx(E,{instanceIds:s.liveInstanceIds,children:e.jsx($,{children:e.jsx(z,{initialSessions:s.initialSessions,children:e.jsx(O,{initialInstances:s.initialInstances,children:e.jsx(K,{breadcrumbs:i,iconNavActions:m})})})})})});export{se as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(){return!1}export{e as shouldRevalidate};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./files.browse-9p4xl9MV.js";import{O as s}from"./chunk-EPOLDU6W-B-j6nV8T.js";import{s as l}from"./safe-area.module-CwCzHS6V.js";function i(){return e.jsx("main",{className:`${l.pageShell} flex min-h-dvh bg-white text-black`,children:e.jsxs("div",{className:"mx-auto flex min-h-0 max-w-4xl flex-1 flex-col gap-8",children:[e.jsx("header",{className:"border-b-2 border-black pb-4",children:e.jsx("p",{className:"text-sm uppercase tracking-[0.08em]",children:"Scriptorium"})}),e.jsx("section",{className:"max-w-xl self-start",children:e.jsx(s,{})})]})})}function r(a){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("header",{className:"space-y-2",children:[e.jsx("h2",{className:"text-3xl font-bold",children:a.title}),a.copy?e.jsx("p",{className:"max-w-xl text-base leading-6",children:a.copy}):null]}),a.children,a.footer?e.jsx("footer",{className:"pt-2 text-sm leading-6",children:a.footer}):null]})}function x(a){return a.message?e.jsx("p",{className:`text-base leading-6 ${a.tone==="muted"?"opacity-60":"font-bold"}`,children:a.message}):null}export{i as A,x as S,r as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import{r as f,R as Un}from"./files.browse-9p4xl9MV.js";var wa=e=>{throw TypeError(e)},zn=(e,t,r)=>t.has(e)||wa("Cannot "+r),Yt=(e,t,r)=>(zn(e,t,"read from private field"),r?r.call(e):t.get(e)),Hn=(e,t,r)=>t.has(e)?wa("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Br="popstate";function Xl(e={}){function t(a,n){let{pathname:o,search:i,hash:l}=a.location;return st("",{pathname:o,search:i,hash:l},n.state&&n.state.usr||null,n.state&&n.state.key||"default")}function r(a,n){return typeof n=="string"?n:xe(n)}return Wn(t,r,null,e)}function A(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function G(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Bn(){return Math.random().toString(36).substring(2,10)}function Wr(e,t){return{usr:e.state,key:e.key,idx:t}}function st(e,t,r=null,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ie(t):t,state:r,key:t&&t.key||a||Bn()}}function xe({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 Ie(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function Wn(e,t,r,a={}){let{window:n=document.defaultView,v5Compat:o=!1}=a,i=n.history,l="POP",s=null,u=h();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function h(){return(i.state||{idx:null}).idx}function c(){l="POP";let w=h(),x=w==null?null:w-u;u=w,s&&s({action:l,location:b.location,delta:x})}function m(w,x){l="PUSH";let E=st(b.location,w,x);u=h()+1;let P=Wr(E,u),M=b.createHref(E);try{i.pushState(P,"",M)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;n.location.assign(M)}o&&s&&s({action:l,location:b.location,delta:1})}function y(w,x){l="REPLACE";let E=st(b.location,w,x);u=h();let P=Wr(E,u),M=b.createHref(E);i.replaceState(P,"",M),o&&s&&s({action:l,location:b.location,delta:0})}function R(w){return Ea(w)}let b={get action(){return l},get location(){return e(n,i)},listen(w){if(s)throw new Error("A history only accepts one active listener");return n.addEventListener(Br,c),s=w,()=>{n.removeEventListener(Br,c),s=null}},createHref(w){return t(n,w)},createURL:R,encodeLocation(w){let x=R(w);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:m,replace:y,go(w){return i.go(w)}};return b}function Ea(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),A(r,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:xe(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=r+a),new URL(a,r)}var ot,Vr=class{constructor(e){if(Hn(this,ot,new Map),e)for(let[t,r]of e)this.set(t,r)}get(e){if(Yt(this,ot).has(e))return Yt(this,ot).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){Yt(this,ot).set(e,t)}};ot=new WeakMap;var Vn=new Set(["lazy","caseSensitive","path","id","index","children"]);function Yn(e){return Vn.has(e)}var Jn=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function Kn(e){return Jn.has(e)}function Gn(e){return e.index===!0}function ut(e,t,r=[],a={},n=!1){return e.map((o,i)=>{let l=[...r,String(i)],s=typeof o.id=="string"?o.id:l.join("-");if(A(o.index!==!0||!o.children,"Cannot specify children on an index route"),A(n||!a[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),Gn(o)){let u={...o,id:s};return a[s]=Yr(u,t(u)),u}else{let u={...o,id:s,children:void 0};return a[s]=Yr(u,t(u)),o.children&&(u.children=ut(o.children,t,l,a,n)),u}})}function Yr(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function De(e,t,r="/"){return it(e,t,r,!1)}function it(e,t,r,a){let n=typeof t=="string"?Ie(t):t,o=he(n.pathname||"/",r);if(o==null)return null;let i=ba(e);Xn(i);let l=null;for(let s=0;l==null&&s<i.length;++s){let u=io(o);l=oo(i[s],u,a)}return l}function Ra(e,t){let{route:r,pathname:a,params:n}=e;return{id:r.id,pathname:a,params:n,data:t[r.id],loaderData:t[r.id],handle:r.handle}}function ba(e,t=[],r=[],a="",n=!1){let o=(i,l,s=n,u)=>{let h={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(a)&&s)return;A(h.relativePath.startsWith(a),`Absolute route path "${h.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(a.length)}let c=Se([a,h.relativePath]),m=r.concat(h);i.children&&i.children.length>0&&(A(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${c}".`),ba(i.children,t,m,c,s)),!(i.path==null&&!i.index)&&t.push({path:c,score:ao(c,i.index),routesMeta:m})};return e.forEach((i,l)=>{if(i.path===""||!i.path?.includes("?"))o(i,l);else for(let s of Sa(i.path))o(i,l,!0,s)}),t}function Sa(e){let t=e.split("/");if(t.length===0)return[];let[r,...a]=t,n=r.endsWith("?"),o=r.replace(/\?$/,"");if(a.length===0)return n?[o,""]:[o];let i=Sa(a.join("/")),l=[];return l.push(...i.map(s=>s===""?o:[o,s].join("/"))),n&&l.push(...i),l.map(s=>e.startsWith("/")&&s===""?"/":s)}function Xn(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:no(t.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var qn=/^:[\w-]+$/,Qn=3,Zn=2,eo=1,to=10,ro=-2,Jr=e=>e==="*";function ao(e,t){let r=e.split("/"),a=r.length;return r.some(Jr)&&(a+=ro),t&&(a+=Zn),r.filter(n=>!Jr(n)).reduce((n,o)=>n+(qn.test(o)?Qn:o===""?eo:to),a)}function no(e,t){return e.length===t.length&&e.slice(0,-1).every((a,n)=>a===t[n])?e[e.length-1]-t[t.length-1]:0}function oo(e,t,r=!1){let{routesMeta:a}=e,n={},o="/",i=[];for(let l=0;l<a.length;++l){let s=a[l],u=l===a.length-1,h=o==="/"?t:t.slice(o.length)||"/",c=Ft({path:s.relativePath,caseSensitive:s.caseSensitive,end:u},h),m=s.route;if(!c&&u&&r&&!a[a.length-1].route.index&&(c=Ft({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},h)),!c)return null;Object.assign(n,c.params),i.push({params:n,pathname:Se([o,c.pathname]),pathnameBase:uo(Se([o,c.pathnameBase])),route:m}),c.pathnameBase!=="/"&&(o=Se([o,c.pathnameBase]))}return i}function Ft(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=xa(e.path,e.caseSensitive,e.end),n=t.match(r);if(!n)return null;let o=n[0],i=o.replace(/(.)\/+$/,"$1"),l=n.slice(1);return{params:a.reduce((u,{paramName:h,isOptional:c},m)=>{if(h==="*"){let R=l[m]||"";i=o.slice(0,o.length-R.length).replace(/(.)\/+$/,"$1")}const y=l[m];return c&&!y?u[h]=void 0:u[h]=(y||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function xa(e,t=!1,r=!0){G(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 a=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,s)=>(a.push({paramName:l,isOptional:s!=null}),s?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,t?void 0:"i"),a]}function io(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return G(!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 he(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function lo({basename:e,pathname:t}){return t==="/"?e:Se([e,t])}var La=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,kt=e=>La.test(e);function so(e,t="/"){let{pathname:r,search:a="",hash:n=""}=typeof e=="string"?Ie(e):e,o;if(r)if(kt(r))o=r;else{if(r.includes("//")){let i=r;r=r.replace(/\/\/+/g,"/"),G(!1,`Pathnames cannot have embedded double slashes - normalizing ${i} -> ${r}`)}r.startsWith("/")?o=Kr(r.substring(1),"/"):o=Kr(r,t)}else o=t;return{pathname:o,search:co(a),hash:fo(n)}}function Kr(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function Jt(e,t,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. 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 Pa(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function mr(e){let t=Pa(e);return t.map((r,a)=>a===t.length-1?r.pathname:r.pathnameBase)}function pr(e,t,r,a=!1){let n;typeof e=="string"?n=Ie(e):(n={...e},A(!n.pathname||!n.pathname.includes("?"),Jt("?","pathname","search",n)),A(!n.pathname||!n.pathname.includes("#"),Jt("#","pathname","hash",n)),A(!n.search||!n.search.includes("#"),Jt("#","search","hash",n)));let o=e===""||n.pathname==="",i=o?"/":n.pathname,l;if(i==null)l=r;else{let c=t.length-1;if(!a&&i.startsWith("..")){let m=i.split("/");for(;m[0]==="..";)m.shift(),c-=1;n.pathname=m.join("/")}l=c>=0?t[c]:"/"}let s=so(n,l),u=i&&i!=="/"&&i.endsWith("/"),h=(o||i===".")&&r.endsWith("/");return!s.pathname.endsWith("/")&&(u||h)&&(s.pathname+="/"),s}var Se=e=>e.join("/").replace(/\/\/+/g,"/"),uo=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),co=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,fo=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,ho=class{constructor(e,t){this.type="DataWithResponseInit",this.data=e,this.init=t||null}};function mo(e,t){return new ho(e,typeof t=="number"?{status:t}:t)}var po=(e,t=302)=>{let r=t;typeof r=="number"?r={status:r}:typeof r.status>"u"&&(r.status=302);let a=new Headers(r.headers);return a.set("Location",e),new Response(null,{...r,headers:a})},Ne=class{constructor(e,t,r,a=!1){this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function He(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function dt(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Ca=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ma(e,t){let r=e;if(typeof r!="string"||!La.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,n=!1;if(Ca)try{let o=new URL(window.location.href),i=r.startsWith("//")?new URL(o.protocol+r):new URL(r),l=he(i.pathname,t);i.origin===o.origin&&l!=null?r=l+i.search+i.hash:n=!0}catch{G(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:n,to:r}}var Fe=Symbol("Uninstrumented");function yo(e,t){let r={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(n=>n({id:t.id,index:t.index,path:t.path,instrument(o){let i=Object.keys(r);for(let l of i)o[l]&&r[l].push(o[l])}}));let a={};if(typeof t.lazy=="function"&&r.lazy.length>0){let n=Je(r.lazy,t.lazy,()=>{});n&&(a.lazy=n)}if(typeof t.lazy=="object"){let n=t.lazy;["middleware","loader","action"].forEach(o=>{let i=n[o],l=r[`lazy.${o}`];if(typeof i=="function"&&l.length>0){let s=Je(l,i,()=>{});s&&(a.lazy=Object.assign(a.lazy||{},{[o]:s}))}})}return["loader","action"].forEach(n=>{let o=t[n];if(typeof o=="function"&&r[n].length>0){let i=o[Fe]??o,l=Je(r[n],i,(...s)=>Gr(s[0]));l&&(n==="loader"&&i.hydrate===!0&&(l.hydrate=!0),l[Fe]=i,a[n]=l)}}),t.middleware&&t.middleware.length>0&&r.middleware.length>0&&(a.middleware=t.middleware.map(n=>{let o=n[Fe]??n,i=Je(r.middleware,o,(...l)=>Gr(l[0]));return i?(i[Fe]=o,i):n})),a}function vo(e,t){let r={navigate:[],fetch:[]};if(t.forEach(a=>a({instrument(n){let o=Object.keys(n);for(let i of o)n[i]&&r[i].push(n[i])}})),r.navigate.length>0){let a=e.navigate[Fe]??e.navigate,n=Je(r.navigate,a,(...o)=>{let[i,l]=o;return{to:typeof i=="number"||typeof i=="string"?i:i?xe(i):".",...Xr(e,l??{})}});n&&(n[Fe]=a,e.navigate=n)}if(r.fetch.length>0){let a=e.fetch[Fe]??e.fetch,n=Je(r.fetch,a,(...o)=>{let[i,,l,s]=o;return{href:l??".",fetcherKey:i,...Xr(e,s??{})}});n&&(n[Fe]=a,e.fetch=n)}return e}function Je(e,t,r){return e.length===0?null:async(...a)=>{let n=await Da(e,r(...a),()=>t(...a),e.length-1);if(n.type==="error")throw n.value;return n.value}}async function Da(e,t,r,a){let n=e[a],o;if(n){let i,l=async()=>(i?console.error("You cannot call instrumented handlers more than once"):i=Da(e,t,r,a-1),o=await i,A(o,"Expected a result"),o.type==="error"&&o.value instanceof Error?{status:"error",error:o.value}:{status:"success",error:void 0});try{await n(l,t)}catch(s){console.error("An instrumentation function threw an error:",s)}i||await l(),await i}else try{o={type:"success",value:await r()}}catch(i){o={type:"error",value:i}}return o||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function Gr(e){let{request:t,context:r,params:a,unstable_pattern:n}=e;return{request:go(t),params:{...a},unstable_pattern:n,context:wo(r)}}function Xr(e,t){return{currentUrl:xe(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function go(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function wo(e){if(Ro(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var Eo=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Ro(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===Eo}var Ta=["POST","PUT","PATCH","DELETE"],bo=new Set(Ta),So=["GET",...Ta],xo=new Set(So),Oa=new Set([301,302,303,307,308]),Lo=new Set([307,308]),Kt={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Fa={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},rt={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Po=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Ia="remix-router-transitions",Na=Symbol("ResetLoaderData");function ql(e){const t=e.window?e.window:typeof window<"u"?window:void 0,r=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";A(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let a=e.hydrationRouteProperties||[],n=e.mapRouteProperties||Po,o=n;if(e.unstable_instrumentations){let d=e.unstable_instrumentations;o=p=>({...n(p),...yo(d.map(g=>g.route).filter(Boolean),p)})}let i={},l=ut(e.routes,o,void 0,i),s,u=e.basename||"/";u.startsWith("/")||(u=`/${u}`);let h=e.dataStrategy||Oo,c={...e.future},m=null,y=new Set,R=null,b=null,w=null,x=e.hydrationData!=null,E=De(l,e.history.location,u),P=!1,M=null,C;if(E==null&&!e.patchRoutesOnNavigation){let d=ge(404,{pathname:e.history.location.pathname}),{matches:p,route:g}=bt(l);C=!0,E=p,M={[g.id]:d}}else if(E&&!e.hydrationData&&vt(E,l,e.history.location.pathname).active&&(E=null),E)if(E.some(d=>d.route.lazy))C=!1;else if(!E.some(d=>yr(d.route)))C=!0;else{let d=e.hydrationData?e.hydrationData.loaderData:null,p=e.hydrationData?e.hydrationData.errors:null;if(p){let g=E.findIndex(S=>p[S.route.id]!==void 0);C=E.slice(0,g+1).every(S=>!rr(S.route,d,p))}else C=E.every(g=>!rr(g.route,d,p))}else{C=!1,E=[];let d=vt(null,l,e.history.location.pathname);d.active&&d.matches&&(P=!0,E=d.matches)}let O,v={historyAction:e.history.action,location:e.history.location,matches:E,initialized:C,navigation:Kt,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||M,fetchers:new Map,blockers:new Map},T="POP",j=null,W=!1,U,X=!1,oe=new Map,Q=null,V=!1,J=!1,me=new Set,Y=new Map,Z=0,se=-1,Ee=new Map,ue=new Set,pe=new Map,ye=new Map,de=new Set,ke=new Map,pt,Qe=null;function bn(){if(m=e.history.listen(({action:d,location:p,delta:g})=>{if(pt){pt(),pt=void 0;return}G(ke.size===0||g!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let S=Ar({currentLocation:v.location,nextLocation:p,historyAction:d});if(S&&g!=null){let L=new Promise(I=>{pt=I});e.history.go(g*-1),yt(S,{state:"blocked",location:p,proceed(){yt(S,{state:"proceeding",proceed:void 0,reset:void 0,location:p}),L.then(()=>e.history.go(g))},reset(){let I=new Map(v.blockers);I.set(S,rt),re({blockers:I})}}),j?.resolve(),j=null;return}return $e(d,p)}),r){Go(t,oe);let d=()=>Xo(t,oe);t.addEventListener("pagehide",d),Q=()=>t.removeEventListener("pagehide",d)}return v.initialized||$e("POP",v.location,{initialHydration:!0}),O}function Sn(){m&&m(),Q&&Q(),y.clear(),U&&U.abort(),v.fetchers.forEach((d,p)=>Bt(p)),v.blockers.forEach((d,p)=>_r(p))}function xn(d){return y.add(d),()=>y.delete(d)}function re(d,p={}){d.matches&&(d.matches=d.matches.map(L=>{let I=i[L.route.id],D=L.route;return D.element!==I.element||D.errorElement!==I.errorElement||D.hydrateFallbackElement!==I.hydrateFallbackElement?{...L,route:I}:L})),v={...v,...d};let g=[],S=[];v.fetchers.forEach((L,I)=>{L.state==="idle"&&(de.has(I)?g.push(I):S.push(I))}),de.forEach(L=>{!v.fetchers.has(L)&&!Y.has(L)&&g.push(L)}),[...y].forEach(L=>L(v,{deletedFetchers:g,newErrors:d.errors??null,viewTransitionOpts:p.viewTransitionOpts,flushSync:p.flushSync===!0})),g.forEach(L=>Bt(L)),S.forEach(L=>v.fetchers.delete(L))}function We(d,p,{flushSync:g}={}){let S=v.actionData!=null&&v.navigation.formMethod!=null&&ne(v.navigation.formMethod)&&v.navigation.state==="loading"&&d.state?._isRedirect!==!0,L;p.actionData?Object.keys(p.actionData).length>0?L=p.actionData:L=null:S?L=v.actionData:L=null;let I=p.loaderData?ia(v.loaderData,p.loaderData,p.matches||[],p.errors):v.loaderData,D=v.blockers;D.size>0&&(D=new Map(D),D.forEach((_,k)=>D.set(k,rt)));let F=V?!1:Ur(d,p.matches||v.matches),N=W===!0||v.navigation.formMethod!=null&&ne(v.navigation.formMethod)&&d.state?._isRedirect!==!0;s&&(l=s,s=void 0),V||T==="POP"||(T==="PUSH"?e.history.push(d,d.state):T==="REPLACE"&&e.history.replace(d,d.state));let $;if(T==="POP"){let _=oe.get(v.location.pathname);_&&_.has(d.pathname)?$={currentLocation:v.location,nextLocation:d}:oe.has(d.pathname)&&($={currentLocation:d,nextLocation:v.location})}else if(X){let _=oe.get(v.location.pathname);_?_.add(d.pathname):(_=new Set([d.pathname]),oe.set(v.location.pathname,_)),$={currentLocation:v.location,nextLocation:d}}re({...p,actionData:L,loaderData:I,historyAction:T,location:d,initialized:!0,navigation:Kt,revalidation:"idle",restoreScrollPosition:F,preventScrollReset:N,blockers:D},{viewTransitionOpts:$,flushSync:g===!0}),T="POP",W=!1,X=!1,V=!1,J=!1,j?.resolve(),j=null,Qe?.resolve(),Qe=null}async function Tr(d,p){if(j?.resolve(),j=null,typeof d=="number"){j||(j=ua());let B=j.promise;return e.history.go(d),B}let g=tr(v.location,v.matches,u,d,p?.fromRouteId,p?.relative),{path:S,submission:L,error:I}=qr(!1,g,p),D=v.location,F=st(v.location,S,p&&p.state);F={...F,...e.history.encodeLocation(F)};let N=p&&p.replace!=null?p.replace:void 0,$="PUSH";N===!0?$="REPLACE":N===!1||L!=null&&ne(L.formMethod)&&L.formAction===v.location.pathname+v.location.search&&($="REPLACE");let _=p&&"preventScrollReset"in p?p.preventScrollReset===!0:void 0,k=(p&&p.flushSync)===!0,H=Ar({currentLocation:D,nextLocation:F,historyAction:$});if(H){yt(H,{state:"blocked",location:F,proceed(){yt(H,{state:"proceeding",proceed:void 0,reset:void 0,location:F}),Tr(d,p)},reset(){let B=new Map(v.blockers);B.set(H,rt),re({blockers:B})}});return}await $e($,F,{submission:L,pendingError:I,preventScrollReset:_,replace:p&&p.replace,enableViewTransition:p&&p.viewTransition,flushSync:k,callSiteDefaultShouldRevalidate:p&&p.unstable_defaultShouldRevalidate})}function Ln(){Qe||(Qe=ua()),Ht(),re({revalidation:"loading"});let d=Qe.promise;return v.navigation.state==="submitting"?d:v.navigation.state==="idle"?($e(v.historyAction,v.location,{startUninterruptedRevalidation:!0}),d):($e(T||v.historyAction,v.navigation.location,{overrideNavigation:v.navigation,enableViewTransition:X===!0}),d)}async function $e(d,p,g){U&&U.abort(),U=null,T=d,V=(g&&g.startUninterruptedRevalidation)===!0,$n(v.location,v.matches),W=(g&&g.preventScrollReset)===!0,X=(g&&g.enableViewTransition)===!0;let S=s||l,L=g&&g.overrideNavigation,I=g?.initialHydration&&v.matches&&v.matches.length>0&&!P?v.matches:De(S,p,u),D=(g&&g.flushSync)===!0;if(I&&v.initialized&&!J&&jo(v.location,p)&&!(g&&g.submission&&ne(g.submission.formMethod))){We(p,{matches:I},{flushSync:D});return}let F=vt(I,S,p.pathname);if(F.active&&F.matches&&(I=F.matches),!I){let{error:ee,notFoundMatches:ie,route:K}=Wt(p.pathname);We(p,{matches:ie,loaderData:{},errors:{[K.id]:ee}},{flushSync:D});return}U=new AbortController;let N=Ye(e.history,p,U.signal,g&&g.submission),$=e.getContext?await e.getContext():new Vr,_;if(g&&g.pendingError)_=[Oe(I).route.id,{type:"error",error:g.pendingError}];else if(g&&g.submission&&ne(g.submission.formMethod)){let ee=await Pn(N,p,g.submission,I,$,F.active,g&&g.initialHydration===!0,{replace:g.replace,flushSync:D});if(ee.shortCircuited)return;if(ee.pendingActionResult){let[ie,K]=ee.pendingActionResult;if(fe(K)&&He(K.error)&&K.error.status===404){U=null,We(p,{matches:ee.matches,loaderData:{},errors:{[ie]:K.error}});return}}I=ee.matches||I,_=ee.pendingActionResult,L=Gt(p,g.submission),D=!1,F.active=!1,N=Ye(e.history,N.url,N.signal)}let{shortCircuited:k,matches:H,loaderData:B,errors:te}=await Cn(N,p,I,$,F.active,L,g&&g.submission,g&&g.fetcherSubmission,g&&g.replace,g&&g.initialHydration===!0,D,_,g&&g.callSiteDefaultShouldRevalidate);k||(U=null,We(p,{matches:H||I,...la(_),loaderData:B,errors:te}))}async function Pn(d,p,g,S,L,I,D,F={}){Ht();let N=Jo(p,g);if(re({navigation:N},{flushSync:F.flushSync===!0}),I){let k=await gt(S,p.pathname,d.signal);if(k.type==="aborted")return{shortCircuited:!0};if(k.type==="error"){if(k.partialMatches.length===0){let{matches:B,route:te}=bt(l);return{matches:B,pendingActionResult:[te.id,{type:"error",error:k.error}]}}let H=Oe(k.partialMatches).route.id;return{matches:k.partialMatches,pendingActionResult:[H,{type:"error",error:k.error}]}}else if(k.matches)S=k.matches;else{let{notFoundMatches:H,error:B,route:te}=Wt(p.pathname);return{matches:H,pendingActionResult:[te.id,{type:"error",error:B}]}}}let $,_=Mt(S,p);if(!_.route.action&&!_.route.lazy)$={type:"error",error:ge(405,{method:d.method,pathname:p.pathname,routeId:_.route.id})};else{let k=Ke(o,i,d,S,_,D?[]:a,L),H=await Ze(d,k,L,null);if($=H[_.route.id],!$){for(let B of S)if(H[B.route.id]){$=H[B.route.id];break}}if(d.signal.aborted)return{shortCircuited:!0}}if(ze($)){let k;return F&&F.replace!=null?k=F.replace:k=aa($.response.headers.get("Location"),new URL(d.url),u,e.history)===v.location.pathname+v.location.search,await _e(d,$,!0,{submission:g,replace:k}),{shortCircuited:!0}}if(fe($)){let k=Oe(S,_.route.id);return(F&&F.replace)!==!0&&(T="PUSH"),{matches:S,pendingActionResult:[k.route.id,$,_.route.id]}}return{matches:S,pendingActionResult:[_.route.id,$]}}async function Cn(d,p,g,S,L,I,D,F,N,$,_,k,H){let B=I||Gt(p,D),te=D||F||sa(B),ee=!V&&!$;if(L){if(ee){let ae=Or(k);re({navigation:B,...ae!==void 0?{actionData:ae}:{}},{flushSync:_})}let z=await gt(g,p.pathname,d.signal);if(z.type==="aborted")return{shortCircuited:!0};if(z.type==="error"){if(z.partialMatches.length===0){let{matches:Ve,route:Ue}=bt(l);return{matches:Ve,loaderData:{},errors:{[Ue.id]:z.error}}}let ae=Oe(z.partialMatches).route.id;return{matches:z.partialMatches,loaderData:{},errors:{[ae]:z.error}}}else if(z.matches)g=z.matches;else{let{error:ae,notFoundMatches:Ve,route:Ue}=Wt(p.pathname);return{matches:Ve,loaderData:{},errors:{[Ue.id]:ae}}}}let ie=s||l,{dsMatches:K,revalidatingFetchers:ve}=Qr(d,S,o,i,e.history,v,g,te,p,$?[]:a,$===!0,J,me,de,pe,ue,ie,u,e.patchRoutesOnNavigation!=null,k,H);if(se=++Z,!e.dataStrategy&&!K.some(z=>z.shouldLoad)&&!K.some(z=>z.route.middleware&&z.route.middleware.length>0)&&ve.length===0){let z=kr();return We(p,{matches:g,loaderData:{},errors:k&&fe(k[1])?{[k[0]]:k[1].error}:null,...la(k),...z?{fetchers:new Map(v.fetchers)}:{}},{flushSync:_}),{shortCircuited:!0}}if(ee){let z={};if(!L){z.navigation=B;let ae=Or(k);ae!==void 0&&(z.actionData=ae)}ve.length>0&&(z.fetchers=Mn(ve)),re(z,{flushSync:_})}ve.forEach(z=>{Ce(z.key),z.controller&&Y.set(z.key,z.controller)});let Ae=()=>ve.forEach(z=>Ce(z.key));U&&U.signal.addEventListener("abort",Ae);let{loaderResults:et,fetcherResults:Te}=await Fr(K,ve,d,S);if(d.signal.aborted)return{shortCircuited:!0};U&&U.signal.removeEventListener("abort",Ae),ve.forEach(z=>Y.delete(z.key));let be=St(et);if(be)return await _e(d,be.result,!0,{replace:N}),{shortCircuited:!0};if(be=St(Te),be)return ue.add(be.key),await _e(d,be.result,!0,{replace:N}),{shortCircuited:!0};let{loaderData:Vt,errors:tt}=oa(v,g,et,k,ve,Te);$&&v.errors&&(tt={...v.errors,...tt});let je=kr(),wt=$r(se),Et=je||wt||ve.length>0;return{matches:g,loaderData:Vt,errors:tt,...Et?{fetchers:new Map(v.fetchers)}:{}}}function Or(d){if(d&&!fe(d[1]))return{[d[0]]:d[1].data};if(v.actionData)return Object.keys(v.actionData).length===0?null:v.actionData}function Mn(d){return d.forEach(p=>{let g=v.fetchers.get(p.key),S=at(void 0,g?g.data:void 0);v.fetchers.set(p.key,S)}),new Map(v.fetchers)}async function Dn(d,p,g,S){Ce(d);let L=(S&&S.flushSync)===!0,I=s||l,D=tr(v.location,v.matches,u,g,p,S?.relative),F=De(I,D,u),N=vt(F,I,D);if(N.active&&N.matches&&(F=N.matches),!F){Pe(d,p,ge(404,{pathname:D}),{flushSync:L});return}let{path:$,submission:_,error:k}=qr(!0,D,S);if(k){Pe(d,p,k,{flushSync:L});return}let H=e.getContext?await e.getContext():new Vr,B=(S&&S.preventScrollReset)===!0;if(_&&ne(_.formMethod)){await Tn(d,p,$,F,H,N.active,L,B,_,S&&S.unstable_defaultShouldRevalidate);return}pe.set(d,{routeId:p,path:$}),await On(d,p,$,F,H,N.active,L,B,_)}async function Tn(d,p,g,S,L,I,D,F,N,$){Ht(),pe.delete(d);let _=v.fetchers.get(d);Le(d,Ko(N,_),{flushSync:D});let k=new AbortController,H=Ye(e.history,g,k.signal,N);if(I){let q=await gt(S,new URL(H.url).pathname,H.signal,d);if(q.type==="aborted")return;if(q.type==="error"){Pe(d,p,q.error,{flushSync:D});return}else if(q.matches)S=q.matches;else{Pe(d,p,ge(404,{pathname:g}),{flushSync:D});return}}let B=Mt(S,g);if(!B.route.action&&!B.route.lazy){let q=ge(405,{method:N.formMethod,pathname:g,routeId:p});Pe(d,p,q,{flushSync:D});return}Y.set(d,k);let te=Z,ee=Ke(o,i,H,S,B,a,L),ie=await Ze(H,ee,L,d),K=ie[B.route.id];if(!K){for(let q of ee)if(ie[q.route.id]){K=ie[q.route.id];break}}if(H.signal.aborted){Y.get(d)===k&&Y.delete(d);return}if(de.has(d)){if(ze(K)||fe(K)){Le(d,Me(void 0));return}}else{if(ze(K))if(Y.delete(d),se>te){Le(d,Me(void 0));return}else return ue.add(d),Le(d,at(N)),_e(H,K,!1,{fetcherSubmission:N,preventScrollReset:F});if(fe(K)){Pe(d,p,K.error);return}}let ve=v.navigation.location||v.location,Ae=Ye(e.history,ve,k.signal),et=s||l,Te=v.navigation.state!=="idle"?De(et,v.navigation.location,u):v.matches;A(Te,"Didn't find any matches after fetcher action");let be=++Z;Ee.set(d,be);let Vt=at(N,K.data);v.fetchers.set(d,Vt);let{dsMatches:tt,revalidatingFetchers:je}=Qr(Ae,L,o,i,e.history,v,Te,N,ve,a,!1,J,me,de,pe,ue,et,u,e.patchRoutesOnNavigation!=null,[B.route.id,K],$);je.filter(q=>q.key!==d).forEach(q=>{let Rt=q.key,Hr=v.fetchers.get(Rt),jn=at(void 0,Hr?Hr.data:void 0);v.fetchers.set(Rt,jn),Ce(Rt),q.controller&&Y.set(Rt,q.controller)}),re({fetchers:new Map(v.fetchers)});let wt=()=>je.forEach(q=>Ce(q.key));k.signal.addEventListener("abort",wt);let{loaderResults:Et,fetcherResults:z}=await Fr(tt,je,Ae,L);if(k.signal.aborted)return;if(k.signal.removeEventListener("abort",wt),Ee.delete(d),Y.delete(d),je.forEach(q=>Y.delete(q.key)),v.fetchers.has(d)){let q=Me(K.data);v.fetchers.set(d,q)}let ae=St(Et);if(ae)return _e(Ae,ae.result,!1,{preventScrollReset:F});if(ae=St(z),ae)return ue.add(ae.key),_e(Ae,ae.result,!1,{preventScrollReset:F});let{loaderData:Ve,errors:Ue}=oa(v,Te,Et,void 0,je,z);$r(be),v.navigation.state==="loading"&&be>se?(A(T,"Expected pending action"),U&&U.abort(),We(v.navigation.location,{matches:Te,loaderData:Ve,errors:Ue,fetchers:new Map(v.fetchers)})):(re({errors:Ue,loaderData:ia(v.loaderData,Ve,Te,Ue),fetchers:new Map(v.fetchers)}),J=!1)}async function On(d,p,g,S,L,I,D,F,N){let $=v.fetchers.get(d);Le(d,at(N,$?$.data:void 0),{flushSync:D});let _=new AbortController,k=Ye(e.history,g,_.signal);if(I){let K=await gt(S,new URL(k.url).pathname,k.signal,d);if(K.type==="aborted")return;if(K.type==="error"){Pe(d,p,K.error,{flushSync:D});return}else if(K.matches)S=K.matches;else{Pe(d,p,ge(404,{pathname:g}),{flushSync:D});return}}let H=Mt(S,g);Y.set(d,_);let B=Z,te=Ke(o,i,k,S,H,a,L),ie=(await Ze(k,te,L,d))[H.route.id];if(Y.get(d)===_&&Y.delete(d),!k.signal.aborted){if(de.has(d)){Le(d,Me(void 0));return}if(ze(ie))if(se>B){Le(d,Me(void 0));return}else{ue.add(d),await _e(k,ie,!1,{preventScrollReset:F});return}if(fe(ie)){Pe(d,p,ie.error);return}Le(d,Me(ie.data))}}async function _e(d,p,g,{submission:S,fetcherSubmission:L,preventScrollReset:I,replace:D}={}){g||(j?.resolve(),j=null),p.response.headers.has("X-Remix-Revalidate")&&(J=!0);let F=p.response.headers.get("Location");A(F,"Expected a Location header on the redirect Response"),F=aa(F,new URL(d.url),u,e.history);let N=st(v.location,F,{_isRedirect:!0});if(r){let te=!1;if(p.response.headers.has("X-Remix-Reload-Document"))te=!0;else if(kt(F)){const ee=Ea(F,!0);te=ee.origin!==t.location.origin||he(ee.pathname,u)==null}if(te){D?t.location.replace(F):t.location.assign(F);return}}U=null;let $=D===!0||p.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:_,formAction:k,formEncType:H}=v.navigation;!S&&!L&&_&&k&&H&&(S=sa(v.navigation));let B=S||L;if(Lo.has(p.response.status)&&B&&ne(B.formMethod))await $e($,N,{submission:{...B,formAction:F},preventScrollReset:I||W,enableViewTransition:g?X:void 0});else{let te=Gt(N,S);await $e($,N,{overrideNavigation:te,fetcherSubmission:L,preventScrollReset:I||W,enableViewTransition:g?X:void 0})}}async function Ze(d,p,g,S){let L,I={};try{L=await Io(h,d,p,S,g,!1)}catch(D){return p.filter(F=>F.shouldLoad).forEach(F=>{I[F.route.id]={type:"error",error:D}}),I}if(d.signal.aborted)return I;if(!ne(d.method))for(let D of p){if(L[D.route.id]?.type==="error")break;!L.hasOwnProperty(D.route.id)&&!v.loaderData.hasOwnProperty(D.route.id)&&(!v.errors||!v.errors.hasOwnProperty(D.route.id))&&D.shouldCallHandler()&&(L[D.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${D.route.id}`)})}for(let[D,F]of Object.entries(L))if(Bo(F)){let N=F.result;I[D]={type:"redirect",response:_o(N,d,D,p,u)}}else I[D]=await $o(F);return I}async function Fr(d,p,g,S){let L=Ze(g,d,S,null),I=Promise.all(p.map(async N=>{if(N.matches&&N.match&&N.request&&N.controller){let _=(await Ze(N.request,N.matches,S,N.key))[N.match.route.id];return{[N.key]:_}}else return Promise.resolve({[N.key]:{type:"error",error:ge(404,{pathname:N.path})}})})),D=await L,F=(await I).reduce((N,$)=>Object.assign(N,$),{});return{loaderResults:D,fetcherResults:F}}function Ht(){J=!0,pe.forEach((d,p)=>{Y.has(p)&&me.add(p),Ce(p)})}function Le(d,p,g={}){v.fetchers.set(d,p),re({fetchers:new Map(v.fetchers)},{flushSync:(g&&g.flushSync)===!0})}function Pe(d,p,g,S={}){let L=Oe(v.matches,p);Bt(d),re({errors:{[L.route.id]:g},fetchers:new Map(v.fetchers)},{flushSync:(S&&S.flushSync)===!0})}function Ir(d){return ye.set(d,(ye.get(d)||0)+1),de.has(d)&&de.delete(d),v.fetchers.get(d)||Fa}function Fn(d,p){Ce(d,p?.reason),Le(d,Me(null))}function Bt(d){let p=v.fetchers.get(d);Y.has(d)&&!(p&&p.state==="loading"&&Ee.has(d))&&Ce(d),pe.delete(d),Ee.delete(d),ue.delete(d),de.delete(d),me.delete(d),v.fetchers.delete(d)}function In(d){let p=(ye.get(d)||0)-1;p<=0?(ye.delete(d),de.add(d)):ye.set(d,p),re({fetchers:new Map(v.fetchers)})}function Ce(d,p){let g=Y.get(d);g&&(g.abort(p),Y.delete(d))}function Nr(d){for(let p of d){let g=Ir(p),S=Me(g.data);v.fetchers.set(p,S)}}function kr(){let d=[],p=!1;for(let g of ue){let S=v.fetchers.get(g);A(S,`Expected fetcher: ${g}`),S.state==="loading"&&(ue.delete(g),d.push(g),p=!0)}return Nr(d),p}function $r(d){let p=[];for(let[g,S]of Ee)if(S<d){let L=v.fetchers.get(g);A(L,`Expected fetcher: ${g}`),L.state==="loading"&&(Ce(g),Ee.delete(g),p.push(g))}return Nr(p),p.length>0}function Nn(d,p){let g=v.blockers.get(d)||rt;return ke.get(d)!==p&&ke.set(d,p),g}function _r(d){v.blockers.delete(d),ke.delete(d)}function yt(d,p){let g=v.blockers.get(d)||rt;A(g.state==="unblocked"&&p.state==="blocked"||g.state==="blocked"&&p.state==="blocked"||g.state==="blocked"&&p.state==="proceeding"||g.state==="blocked"&&p.state==="unblocked"||g.state==="proceeding"&&p.state==="unblocked",`Invalid blocker state transition: ${g.state} -> ${p.state}`);let S=new Map(v.blockers);S.set(d,p),re({blockers:S})}function Ar({currentLocation:d,nextLocation:p,historyAction:g}){if(ke.size===0)return;ke.size>1&&G(!1,"A router only supports one blocker at a time");let S=Array.from(ke.entries()),[L,I]=S[S.length-1],D=v.blockers.get(L);if(!(D&&D.state==="proceeding")&&I({currentLocation:d,nextLocation:p,historyAction:g}))return L}function Wt(d){let p=ge(404,{pathname:d}),g=s||l,{matches:S,route:L}=bt(g);return{notFoundMatches:S,route:L,error:p}}function kn(d,p,g){if(R=d,w=p,b=g||null,!x&&v.navigation===Kt){x=!0;let S=Ur(v.location,v.matches);S!=null&&re({restoreScrollPosition:S})}return()=>{R=null,w=null,b=null}}function jr(d,p){return b&&b(d,p.map(S=>Ra(S,v.loaderData)))||d.key}function $n(d,p){if(R&&w){let g=jr(d,p);R[g]=w()}}function Ur(d,p){if(R){let g=jr(d,p),S=R[g];if(typeof S=="number")return S}return null}function vt(d,p,g){if(e.patchRoutesOnNavigation)if(d){if(Object.keys(d[0].params).length>0)return{active:!0,matches:it(p,g,u,!0)}}else return{active:!0,matches:it(p,g,u,!0)||[]};return{active:!1,matches:null}}async function gt(d,p,g,S){if(!e.patchRoutesOnNavigation)return{type:"success",matches:d};let L=d;for(;;){let I=s==null,D=s||l,F=i;try{await e.patchRoutesOnNavigation({signal:g,path:p,matches:L,fetcherKey:S,patch:(_,k)=>{g.aborted||Zr(_,k,D,F,o,!1)}})}catch(_){return{type:"error",error:_,partialMatches:L}}finally{I&&!g.aborted&&(l=[...l])}if(g.aborted)return{type:"aborted"};let N=De(D,p,u),$=null;if(N){if(Object.keys(N[0].params).length===0)return{type:"success",matches:N};if($=it(D,p,u,!0),!($&&L.length<$.length&&zr(L,$.slice(0,L.length))))return{type:"success",matches:N}}if($||($=it(D,p,u,!0)),!$||zr(L,$))return{type:"success",matches:null};L=$}}function zr(d,p){return d.length===p.length&&d.every((g,S)=>g.route.id===p[S].route.id)}function _n(d){i={},s=ut(d,o,void 0,i)}function An(d,p,g=!1){let S=s==null;Zr(d,p,s||l,i,o,g),S&&(l=[...l],re({}))}return O={get basename(){return u},get future(){return c},get state(){return v},get routes(){return l},get window(){return t},initialize:bn,subscribe:xn,enableScrollRestoration:kn,navigate:Tr,fetch:Dn,revalidate:Ln,createHref:d=>e.history.createHref(d),encodeLocation:d=>e.history.encodeLocation(d),getFetcher:Ir,resetFetcher:Fn,deleteFetcher:In,dispose:Sn,getBlocker:Nn,deleteBlocker:_r,patchRoutes:An,_internalFetchControllers:Y,_internalSetRoutes:_n,_internalSetStateDoNotUseOrYouWillBreakYourApp(d){re(d)}},e.unstable_instrumentations&&(O=vo(O,e.unstable_instrumentations.map(d=>d.router).filter(Boolean))),O}function Co(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function tr(e,t,r,a,n,o){let i,l;if(n){i=[];for(let u of t)if(i.push(u),u.route.id===n){l=u;break}}else i=t,l=t[t.length-1];let s=pr(a||".",mr(i),he(e.pathname,r)||e.pathname,o==="path");if(a==null&&(s.search=e.search,s.hash=e.hash),(a==null||a===""||a===".")&&l){let u=vr(s.search);if(l.route.index&&!u)s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index";else if(!l.route.index&&u){let h=new URLSearchParams(s.search),c=h.getAll("index");h.delete("index"),c.filter(y=>y).forEach(y=>h.append("index",y));let m=h.toString();s.search=m?`?${m}`:""}}return r!=="/"&&(s.pathname=lo({basename:r,pathname:s.pathname})),xe(s)}function qr(e,t,r){if(!r||!Co(r))return{path:t};if(r.formMethod&&!Yo(r.formMethod))return{path:t,error:ge(405,{method:r.formMethod})};let a=()=>({path:t,error:ge(400,{type:"invalid-body"})}),o=(r.formMethod||"get").toUpperCase(),i=Ua(t);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!ne(o))return a();let c=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((m,[y,R])=>`${m}${y}=${R}
|
|
2
|
+
`,""):String(r.body);return{path:t,submission:{formMethod:o,formAction:i,formEncType:r.formEncType,formData:void 0,json:void 0,text:c}}}else if(r.formEncType==="application/json"){if(!ne(o))return a();try{let c=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:t,submission:{formMethod:o,formAction:i,formEncType:r.formEncType,formData:void 0,json:c,text:void 0}}}catch{return a()}}}A(typeof FormData=="function","FormData is not available in this environment");let l,s;if(r.formData)l=nr(r.formData),s=r.formData;else if(r.body instanceof FormData)l=nr(r.body),s=r.body;else if(r.body instanceof URLSearchParams)l=r.body,s=na(l);else if(r.body==null)l=new URLSearchParams,s=new FormData;else try{l=new URLSearchParams(r.body),s=na(l)}catch{return a()}let u={formMethod:o,formAction:i,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:s,json:void 0,text:void 0};if(ne(u.formMethod))return{path:t,submission:u};let h=Ie(t);return e&&h.search&&vr(h.search)&&l.append("index",""),h.search=`?${l}`,{path:xe(h),submission:u}}function Qr(e,t,r,a,n,o,i,l,s,u,h,c,m,y,R,b,w,x,E,P,M){let C=P?fe(P[1])?P[1].error:P[1].data:void 0,O=n.createURL(o.location),v=n.createURL(s),T;if(h&&o.errors){let V=Object.keys(o.errors)[0];T=i.findIndex(J=>J.route.id===V)}else if(P&&fe(P[1])){let V=P[0];T=i.findIndex(J=>J.route.id===V)-1}let j=P?P[1].statusCode:void 0,W=j&&j>=400,U={currentUrl:O,currentParams:o.matches[0]?.params||{},nextUrl:v,nextParams:i[0].params,...l,actionResult:C,actionStatus:j},X=dt(i),oe=i.map((V,J)=>{let{route:me}=V,Y=null;if(T!=null&&J>T?Y=!1:me.lazy?Y=!0:yr(me)?h?Y=rr(me,o.loaderData,o.errors):Mo(o.loaderData,o.matches[J],V)&&(Y=!0):Y=!1,Y!==null)return ar(r,a,e,X,V,u,t,Y);let Z=!1;typeof M=="boolean"?Z=M:W?Z=!1:(c||O.pathname+O.search===v.pathname+v.search||O.search!==v.search||Do(o.matches[J],V))&&(Z=!0);let se={...U,defaultShouldRevalidate:Z},Ee=lt(V,se);return ar(r,a,e,X,V,u,t,Ee,se,M)}),Q=[];return R.forEach((V,J)=>{if(h||!i.some(ye=>ye.route.id===V.routeId)||y.has(J))return;let me=o.fetchers.get(J),Y=me&&me.state!=="idle"&&me.data===void 0,Z=De(w,V.path,x);if(!Z){if(E&&Y)return;Q.push({key:J,routeId:V.routeId,path:V.path,matches:null,match:null,request:null,controller:null});return}if(b.has(J))return;let se=Mt(Z,V.path),Ee=new AbortController,ue=Ye(n,V.path,Ee.signal),pe=null;if(m.has(J))m.delete(J),pe=Ke(r,a,ue,Z,se,u,t);else if(Y)c&&(pe=Ke(r,a,ue,Z,se,u,t));else{let ye;typeof M=="boolean"?ye=M:W?ye=!1:ye=c;let de={...U,defaultShouldRevalidate:ye};lt(se,de)&&(pe=Ke(r,a,ue,Z,se,u,t,de))}pe&&Q.push({key:J,routeId:V.routeId,path:V.path,matches:pe,match:se,request:ue,controller:Ee})}),{dsMatches:oe,revalidatingFetchers:Q}}function yr(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function rr(e,t,r){if(e.lazy)return!0;if(!yr(e))return!1;let a=t!=null&&e.id in t,n=r!=null&&r[e.id]!==void 0;return!a&&n?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!a&&!n}function Mo(e,t,r){let a=!t||r.route.id!==t.route.id,n=!e.hasOwnProperty(r.route.id);return a||n}function Do(e,t){let r=e.route.path;return e.pathname!==t.pathname||r!=null&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function lt(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if(typeof r=="boolean")return r}return t.defaultShouldRevalidate}function Zr(e,t,r,a,n,o){let i;if(e){let u=a[e];A(u,`No route found to patch children into: routeId = ${e}`),u.children||(u.children=[]),i=u.children}else i=r;let l=[],s=[];if(t.forEach(u=>{let h=i.find(c=>ka(u,c));h?s.push({existingRoute:h,newRoute:u}):l.push(u)}),l.length>0){let u=ut(l,n,[e||"_","patch",String(i?.length||"0")],a);i.push(...u)}if(o&&s.length>0)for(let u=0;u<s.length;u++){let{existingRoute:h,newRoute:c}=s[u],m=h,[y]=ut([c],n,[],{},!0);Object.assign(m,{element:y.element?y.element:m.element,errorElement:y.errorElement?y.errorElement:m.errorElement,hydrateFallbackElement:y.hydrateFallbackElement?y.hydrateFallbackElement:m.hydrateFallbackElement})}}function ka(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((r,a)=>t.children?.some(n=>ka(r,n))):!1}var ea=new WeakMap,$a=({key:e,route:t,manifest:r,mapRouteProperties:a})=>{let n=r[t.id];if(A(n,"No route found in manifest"),!n.lazy||typeof n.lazy!="object")return;let o=n.lazy[e];if(!o)return;let i=ea.get(n);i||(i={},ea.set(n,i));let l=i[e];if(l)return l;let s=(async()=>{let u=Yn(e),c=n[e]!==void 0&&e!=="hasErrorBoundary";if(u)G(!u,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),i[e]=Promise.resolve();else if(c)G(!1,`Route "${n.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let m=await o();m!=null&&(Object.assign(n,{[e]:m}),Object.assign(n,a(n)))}typeof n.lazy=="object"&&(n.lazy[e]=void 0,Object.values(n.lazy).every(m=>m===void 0)&&(n.lazy=void 0))})();return i[e]=s,s},ta=new WeakMap;function To(e,t,r,a,n){let o=r[e.id];if(A(o,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let h=ta.get(o);if(h)return{lazyRoutePromise:h,lazyHandlerPromise:h};let c=(async()=>{A(typeof e.lazy=="function","No lazy route function found");let m=await e.lazy(),y={};for(let R in m){let b=m[R];if(b===void 0)continue;let w=Kn(R),E=o[R]!==void 0&&R!=="hasErrorBoundary";w?G(!w,"Route property "+R+" is not a supported property to be returned from a lazy route function. This property will be ignored."):E?G(!E,`Route "${o.id}" has a static property "${R}" defined but its lazy function is also returning a value for this property. The lazy route property "${R}" will be ignored.`):y[R]=b}Object.assign(o,y),Object.assign(o,{...a(o),lazy:void 0})})();return ta.set(o,c),c.catch(()=>{}),{lazyRoutePromise:c,lazyHandlerPromise:c}}let i=Object.keys(e.lazy),l=[],s;for(let h of i){if(n&&n.includes(h))continue;let c=$a({key:h,route:e,manifest:r,mapRouteProperties:a});c&&(l.push(c),h===t&&(s=c))}let u=l.length>0?Promise.all(l).then(()=>{}):void 0;return u?.catch(()=>{}),s?.catch(()=>{}),{lazyRoutePromise:u,lazyHandlerPromise:s}}async function ra(e){let t=e.matches.filter(n=>n.shouldLoad),r={};return(await Promise.all(t.map(n=>n.resolve()))).forEach((n,o)=>{r[t[o].route.id]=n}),r}async function Oo(e){return e.matches.some(t=>t.route.middleware)?_a(e,()=>ra(e)):ra(e)}function _a(e,t){return Fo(e,t,a=>{if(Vo(a))throw a;return a},zo,r);function r(a,n,o){if(o)return Promise.resolve(Object.assign(o.value,{[n]:{type:"error",result:a}}));{let{matches:i}=e,l=Math.min(Math.max(i.findIndex(u=>u.route.id===n),0),Math.max(i.findIndex(u=>u.shouldCallHandler()),0)),s=Oe(i,i[l].route.id).route.id;return Promise.resolve({[s]:{type:"error",result:a}})}}}async function Fo(e,t,r,a,n){let{matches:o,request:i,params:l,context:s,unstable_pattern:u}=e,h=o.flatMap(m=>m.route.middleware?m.route.middleware.map(y=>[m.route.id,y]):[]);return await Aa({request:i,params:l,context:s,unstable_pattern:u},h,t,r,a,n)}async function Aa(e,t,r,a,n,o,i=0){let{request:l}=e;if(l.signal.aborted)throw l.signal.reason??new Error(`Request aborted: ${l.method} ${l.url}`);let s=t[i];if(!s)return await r();let[u,h]=s,c,m=async()=>{if(c)throw new Error("You may only call `next()` once per middleware");try{return c={value:await Aa(e,t,r,a,n,o,i+1)},c.value}catch(y){return c={value:await o(y,u,c)},c.value}};try{let y=await h(e,m),R=y!=null?a(y):void 0;return n(R)?R:c?R??c.value:(c={value:await m()},c.value)}catch(y){return await o(y,u,c)}}function ja(e,t,r,a,n){let o=$a({key:"middleware",route:a.route,manifest:t,mapRouteProperties:e}),i=To(a.route,ne(r.method)?"action":"loader",t,e,n);return{middleware:o,route:i.lazyRoutePromise,handler:i.lazyHandlerPromise}}function ar(e,t,r,a,n,o,i,l,s=null,u){let h=!1,c=ja(e,t,r,n,o);return{...n,_lazyPromises:c,shouldLoad:l,shouldRevalidateArgs:s,shouldCallHandler(m){return h=!0,s?typeof u=="boolean"?lt(n,{...s,defaultShouldRevalidate:u}):typeof m=="boolean"?lt(n,{...s,defaultShouldRevalidate:m}):lt(n,s):l},resolve(m){let{lazy:y,loader:R,middleware:b}=n.route,w=h||l||m&&!ne(r.method)&&(y||R),x=b&&b.length>0&&!R&&!y;return w&&(ne(r.method)||!x)?No({request:r,unstable_pattern:a,match:n,lazyHandlerPromise:c?.handler,lazyRoutePromise:c?.route,handlerOverride:m,scopedContext:i}):Promise.resolve({type:"data",result:void 0})}}}function Ke(e,t,r,a,n,o,i,l=null){return a.map(s=>s.route.id!==n.route.id?{...s,shouldLoad:!1,shouldRevalidateArgs:l,shouldCallHandler:()=>!1,_lazyPromises:ja(e,t,r,s,o),resolve:()=>Promise.resolve({type:"data",result:void 0})}:ar(e,t,r,dt(a),s,o,i,!0,l))}async function Io(e,t,r,a,n,o){r.some(u=>u._lazyPromises?.middleware)&&await Promise.all(r.map(u=>u._lazyPromises?.middleware));let i={request:t,unstable_pattern:dt(r),params:r[0].params,context:n,matches:r},s=await e({...i,fetcherKey:a,runClientMiddleware:u=>{let h=i;return _a(h,()=>u({...h,fetcherKey:a,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(r.flatMap(u=>[u._lazyPromises?.handler,u._lazyPromises?.route]))}catch{}return s}async function No({request:e,unstable_pattern:t,match:r,lazyHandlerPromise:a,lazyRoutePromise:n,handlerOverride:o,scopedContext:i}){let l,s,u=ne(e.method),h=u?"action":"loader",c=m=>{let y,R=new Promise((x,E)=>y=E);s=()=>y(),e.signal.addEventListener("abort",s);let b=x=>typeof m!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${h}" [routeId: ${r.route.id}]`)):m({request:e,unstable_pattern:t,params:r.params,context:i},...x!==void 0?[x]:[]),w=(async()=>{try{return{type:"data",result:await(o?o(E=>b(E)):b())}}catch(x){return{type:"error",result:x}}})();return Promise.race([w,R])};try{let m=u?r.route.action:r.route.loader;if(a||n)if(m){let y,[R]=await Promise.all([c(m).catch(b=>{y=b}),a,n]);if(y!==void 0)throw y;l=R}else{await a;let y=u?r.route.action:r.route.loader;if(y)[l]=await Promise.all([c(y),n]);else if(h==="action"){let R=new URL(e.url),b=R.pathname+R.search;throw ge(405,{method:e.method,pathname:b,routeId:r.route.id})}else return{type:"data",result:void 0}}else if(m)l=await c(m);else{let y=new URL(e.url),R=y.pathname+y.search;throw ge(404,{pathname:R})}}catch(m){return{type:"error",result:m}}finally{s&&e.signal.removeEventListener("abort",s)}return l}async function ko(e){let t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function $o(e){let{result:t,type:r}=e;if($t(t)){let a;try{a=await ko(t)}catch(n){return{type:"error",error:n}}return r==="error"?{type:"error",error:new Ne(t.status,t.statusText,a),statusCode:t.status,headers:t.headers}:{type:"data",data:a,statusCode:t.status,headers:t.headers}}return r==="error"?or(t)?t.data instanceof Error?{type:"error",error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:Uo(t),statusCode:He(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:He(t)?t.status:void 0}:or(t)?{type:"data",data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"data",data:t}}function _o(e,t,r,a,n){let o=e.headers.get("Location");if(A(o,"Redirects returned/thrown from loaders/actions must have a Location header"),!kt(o)){let i=a.slice(0,a.findIndex(l=>l.route.id===r)+1);o=tr(new URL(t.url),i,n,o),e.headers.set("Location",o)}return e}function aa(e,t,r,a){let n=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(kt(e)){let o=e,i=o.startsWith("//")?new URL(t.protocol+o):new URL(o);if(n.includes(i.protocol))throw new Error("Invalid redirect location");let l=he(i.pathname,r)!=null;if(i.origin===t.origin&&l)return i.pathname+i.search+i.hash}try{let o=a.createURL(e);if(n.includes(o.protocol))throw new Error("Invalid redirect location")}catch{}return e}function Ye(e,t,r,a){let n=e.createURL(Ua(t)).toString(),o={signal:r};if(a&&ne(a.formMethod)){let{formMethod:i,formEncType:l}=a;o.method=i.toUpperCase(),l==="application/json"?(o.headers=new Headers({"Content-Type":l}),o.body=JSON.stringify(a.json)):l==="text/plain"?o.body=a.text:l==="application/x-www-form-urlencoded"&&a.formData?o.body=nr(a.formData):o.body=a.formData}return new Request(n,o)}function nr(e){let t=new URLSearchParams;for(let[r,a]of e.entries())t.append(r,typeof a=="string"?a:a.name);return t}function na(e){let t=new FormData;for(let[r,a]of e.entries())t.append(r,a);return t}function Ao(e,t,r,a=!1,n=!1){let o={},i=null,l,s=!1,u={},h=r&&fe(r[1])?r[1].error:void 0;return e.forEach(c=>{if(!(c.route.id in t))return;let m=c.route.id,y=t[m];if(A(!ze(y),"Cannot handle redirect results in processLoaderData"),fe(y)){let R=y.error;if(h!==void 0&&(R=h,h=void 0),i=i||{},n)i[m]=R;else{let b=Oe(e,m);i[b.route.id]==null&&(i[b.route.id]=R)}a||(o[m]=Na),s||(s=!0,l=He(y.error)?y.error.status:500),y.headers&&(u[m]=y.headers)}else o[m]=y.data,y.statusCode&&y.statusCode!==200&&!s&&(l=y.statusCode),y.headers&&(u[m]=y.headers)}),h!==void 0&&r&&(i={[r[0]]:h},r[2]&&(o[r[2]]=void 0)),{loaderData:o,errors:i,statusCode:l||200,loaderHeaders:u}}function oa(e,t,r,a,n,o){let{loaderData:i,errors:l}=Ao(t,r,a);return n.filter(s=>!s.matches||s.matches.some(u=>u.shouldLoad)).forEach(s=>{let{key:u,match:h,controller:c}=s;if(c&&c.signal.aborted)return;let m=o[u];if(A(m,"Did not find corresponding fetcher result"),fe(m)){let y=Oe(e.matches,h?.route.id);l&&l[y.route.id]||(l={...l,[y.route.id]:m.error}),e.fetchers.delete(u)}else if(ze(m))A(!1,"Unhandled fetcher revalidation redirect");else{let y=Me(m.data);e.fetchers.set(u,y)}}),{loaderData:i,errors:l}}function ia(e,t,r,a){let n=Object.entries(t).filter(([,o])=>o!==Na).reduce((o,[i,l])=>(o[i]=l,o),{});for(let o of r){let i=o.route.id;if(!t.hasOwnProperty(i)&&e.hasOwnProperty(i)&&o.route.loader&&(n[i]=e[i]),a&&a.hasOwnProperty(i))break}return n}function la(e){return e?fe(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Oe(e,t){return(t?e.slice(0,e.findIndex(a=>a.route.id===t)+1):[...e]).reverse().find(a=>a.route.hasErrorBoundary===!0)||e[0]}function bt(e){let t=e.length===1?e[0]:e.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function ge(e,{pathname:t,routeId:r,method:a,type:n,message:o}={}){let i="Unknown Server Error",l="Unknown @remix-run/router error";return e===400?(i="Bad Request",a&&t&&r?l=`You made a ${a} request to "${t}" but did not provide a \`loader\` for route "${r}", so there is no way to handle the request.`:n==="invalid-body"&&(l="Unable to encode submission body")):e===403?(i="Forbidden",l=`Route "${r}" does not match URL "${t}"`):e===404?(i="Not Found",l=`No route matches URL "${t}"`):e===405&&(i="Method Not Allowed",a&&t&&r?l=`You made a ${a.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${r}", so there is no way to handle the request.`:a&&(l=`Invalid request method "${a.toUpperCase()}"`)),new Ne(e||500,i,new Error(l),!0)}function St(e){let t=Object.entries(e);for(let r=t.length-1;r>=0;r--){let[a,n]=t[r];if(ze(n))return{key:a,result:n}}}function Ua(e){let t=typeof e=="string"?Ie(e):e;return xe({...t,hash:""})}function jo(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function Uo(e){return new Ne(e.init?.status??500,e.init?.statusText??"Internal Server Error",e.data)}function zo(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,r])=>typeof t=="string"&&Ho(r))}function Ho(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function Bo(e){return $t(e.result)&&Oa.has(e.result.status)}function fe(e){return e.type==="error"}function ze(e){return(e&&e.type)==="redirect"}function or(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function $t(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function Wo(e){return Oa.has(e)}function Vo(e){return $t(e)&&Wo(e.status)&&e.headers.has("Location")}function Yo(e){return xo.has(e.toUpperCase())}function ne(e){return bo.has(e.toUpperCase())}function vr(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Mt(e,t){let r=typeof t=="string"?Ie(t).search:t.search;if(e[e.length-1].route.index&&vr(r||""))return e[e.length-1];let a=Pa(e);return a[a.length-1]}function sa(e){let{formMethod:t,formAction:r,formEncType:a,text:n,formData:o,json:i}=e;if(!(!t||!r||!a)){if(n!=null)return{formMethod:t,formAction:r,formEncType:a,formData:void 0,json:void 0,text:n};if(o!=null)return{formMethod:t,formAction:r,formEncType:a,formData:o,json:void 0,text:void 0};if(i!==void 0)return{formMethod:t,formAction:r,formEncType:a,formData:void 0,json:i,text:void 0}}}function Gt(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Jo(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function at(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Ko(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function Me(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Go(e,t){try{let r=e.sessionStorage.getItem(Ia);if(r){let a=JSON.parse(r);for(let[n,o]of Object.entries(a||{}))o&&Array.isArray(o)&&t.set(n,new Set(o||[]))}}catch{}}function Xo(e,t){if(t.size>0){let r={};for(let[a,n]of t)r[a]=[...n];try{e.sessionStorage.setItem(Ia,JSON.stringify(r))}catch(a){G(!1,`Failed to save applied view transitions in sessionStorage (${a}).`)}}}function ua(){let e,t,r=new Promise((a,n)=>{e=async o=>{a(o);try{await r}catch{}},t=async o=>{n(o);try{await r}catch{}}});return{promise:r,resolve:e,reject:t}}var Be=f.createContext(null);Be.displayName="DataRouter";var Ge=f.createContext(null);Ge.displayName="DataRouterState";var za=f.createContext(!1);function Ha(){return f.useContext(za)}var gr=f.createContext({isTransitioning:!1});gr.displayName="ViewTransition";var wr=f.createContext(new Map);wr.displayName="Fetchers";var qo=f.createContext(null);qo.displayName="Await";var ce=f.createContext(null);ce.displayName="Navigation";var _t=f.createContext(null);_t.displayName="Location";var we=f.createContext({outlet:null,matches:[],isDataRoute:!1});we.displayName="Route";var Er=f.createContext(null);Er.displayName="RouteError";var Ba="REACT_ROUTER_ERROR",Qo="REDIRECT",Zo="ROUTE_ERROR_RESPONSE";function ei(e){if(e.startsWith(`${Ba}:${Qo}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function ti(e){if(e.startsWith(`${Ba}:${Zo}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Ne(t.status,t.statusText,t.data)}catch{}}function ri(e,{relative:t}={}){A(ft(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=f.useContext(ce),{hash:n,pathname:o,search:i}=ht(e,{relative:t}),l=o;return r!=="/"&&(l=o==="/"?r:Se([r,o])),a.createHref({pathname:l,search:i,hash:n})}function ft(){return f.useContext(_t)!=null}function Re(){return A(ft(),"useLocation() may be used only in the context of a <Router> component."),f.useContext(_t).location}var Wa="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Va(e){f.useContext(ce).static||f.useLayoutEffect(e)}function Ya(){let{isDataRoute:e}=f.useContext(we);return e?mi():ai()}function ai(){A(ft(),"useNavigate() may be used only in the context of a <Router> component.");let e=f.useContext(Be),{basename:t,navigator:r}=f.useContext(ce),{matches:a}=f.useContext(we),{pathname:n}=Re(),o=JSON.stringify(mr(a)),i=f.useRef(!1);return Va(()=>{i.current=!0}),f.useCallback((s,u={})=>{if(G(i.current,Wa),!i.current)return;if(typeof s=="number"){r.go(s);return}let h=pr(s,JSON.parse(o),n,u.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:Se([t,h.pathname])),(u.replace?r.replace:r.push)(h,u.state,u)},[t,r,o,n,e])}var Ja=f.createContext(null);function Ql(){return f.useContext(Ja)}function ni(e){let t=f.useContext(we).outlet;return f.useMemo(()=>t&&f.createElement(Ja.Provider,{value:e},t),[t,e])}function Ka(){let{matches:e}=f.useContext(we),t=e[e.length-1];return t?t.params:{}}function ht(e,{relative:t}={}){let{matches:r}=f.useContext(we),{pathname:a}=Re(),n=JSON.stringify(mr(r));return f.useMemo(()=>pr(e,JSON.parse(n),a,t==="path"),[e,n,a,t])}function oi(e,t,r,a,n){A(ft(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=f.useContext(ce),{matches:i}=f.useContext(we),l=i[i.length-1],s=l?l.params:{},u=l?l.pathname:"/",h=l?l.pathnameBase:"/",c=l&&l.route;{let E=c&&c.path||"";Za(u,!c||E.endsWith("*")||E.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (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.
|
|
3
|
+
|
|
4
|
+
Please change the parent <Route path="${E}"> to <Route path="${E==="/"?"*":`${E}/*`}">.`)}let m=Re(),y;y=m;let R=y.pathname||"/",b=R;if(h!=="/"){let E=h.replace(/^\//,"").split("/");b="/"+R.replace(/^\//,"").split("/").slice(E.length).join("/")}let w=De(e,{pathname:b});return G(c||w!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),G(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${y.pathname}${y.search}${y.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.`),ci(w&&w.map(E=>Object.assign({},E,{params:Object.assign({},s,E.params),pathname:Se([h,o.encodeLocation?o.encodeLocation(E.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?h:Se([h,o.encodeLocation?o.encodeLocation(E.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathnameBase])})),i,r,a,n)}function ii(){let e=Sr(),t=He(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",n={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=f.createElement(f.Fragment,null,f.createElement("p",null,"💿 Hey developer 👋"),f.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",f.createElement("code",{style:o},"ErrorBoundary")," or"," ",f.createElement("code",{style:o},"errorElement")," prop on your route.")),f.createElement(f.Fragment,null,f.createElement("h2",null,"Unexpected Application Error!"),f.createElement("h3",{style:{fontStyle:"italic"}},t),r?f.createElement("pre",{style:n},r):null,i)}var li=f.createElement(ii,null),Ga=class extends f.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||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=ti(e.digest);r&&(e=r)}let t=e!==void 0?f.createElement(we.Provider,{value:this.props.routeContext},f.createElement(Er.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?f.createElement(si,{error:e},t):t}};Ga.contextType=za;var Xt=new WeakMap;function si({children:e,error:t}){let{basename:r}=f.useContext(ce);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=ei(t.digest);if(a){let n=Xt.get(t);if(n)throw n;let o=Ma(a.location,r);if(Ca&&!Xt.get(t))if(o.isExternal||a.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const i=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:a.replace}));throw Xt.set(t,i),i}return f.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function ui({routeContext:e,match:t,children:r}){let a=f.useContext(Be);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),f.createElement(we.Provider,{value:e},r)}function ci(e,t=[],r=null,a=null,n=null){if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,i=r?.errors;if(i!=null){let h=o.findIndex(c=>c.route.id&&i?.[c.route.id]!==void 0);A(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,h+1))}let l=!1,s=-1;if(r)for(let h=0;h<o.length;h++){let c=o[h];if((c.route.HydrateFallback||c.route.hydrateFallbackElement)&&(s=h),c.route.id){let{loaderData:m,errors:y}=r,R=c.route.loader&&!m.hasOwnProperty(c.route.id)&&(!y||y[c.route.id]===void 0);if(c.route.lazy||R){l=!0,s>=0?o=o.slice(0,s+1):o=[o[0]];break}}}let u=r&&a?(h,c)=>{a(h,{location:r.location,params:r.matches?.[0]?.params??{},unstable_pattern:dt(r.matches),errorInfo:c})}:void 0;return o.reduceRight((h,c,m)=>{let y,R=!1,b=null,w=null;r&&(y=i&&c.route.id?i[c.route.id]:void 0,b=c.route.errorElement||li,l&&(s<0&&m===0?(Za("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),R=!0,w=null):s===m&&(R=!0,w=c.route.hydrateFallbackElement||null)));let x=t.concat(o.slice(0,m+1)),E=()=>{let P;return y?P=b:R?P=w:c.route.Component?P=f.createElement(c.route.Component,null):c.route.element?P=c.route.element:P=h,f.createElement(ui,{match:c,routeContext:{outlet:h,matches:x,isDataRoute:r!=null},children:P})};return r&&(c.route.ErrorBoundary||c.route.errorElement||m===0)?f.createElement(Ga,{location:r.location,revalidation:r.revalidation,component:b,error:y,children:E(),routeContext:{outlet:null,matches:x,isDataRoute:!0},onError:u}):E()},null)}function Rr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Xa(e){let t=f.useContext(Be);return A(t,Rr(e)),t}function Xe(e){let t=f.useContext(Ge);return A(t,Rr(e)),t}function di(e){let t=f.useContext(we);return A(t,Rr(e)),t}function mt(e){let t=di(e),r=t.matches[t.matches.length-1];return A(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function fi(){return mt("useRouteId")}function hi(){return Xe("useNavigation").navigation}function Zl(){let e=Xa("useRevalidator"),t=Xe("useRevalidator"),r=f.useCallback(async()=>{await e.router.revalidate()},[e.router]);return f.useMemo(()=>({revalidate:r,state:t.revalidation}),[r,t.revalidation])}function br(){let{matches:e,loaderData:t}=Xe("useMatches");return f.useMemo(()=>e.map(r=>Ra(r,t)),[e,t])}function qa(){let e=Xe("useLoaderData"),t=mt("useLoaderData");return e.loaderData[t]}function Qa(){let e=Xe("useActionData"),t=mt("useLoaderData");return e.actionData?e.actionData[t]:void 0}function Sr(){let e=f.useContext(Er),t=Xe("useRouteError"),r=mt("useRouteError");return e!==void 0?e:t.errors?.[r]}function mi(){let{router:e}=Xa("useNavigate"),t=mt("useNavigate"),r=f.useRef(!1);return Va(()=>{r.current=!0}),f.useCallback(async(n,o={})=>{G(r.current,Wa),r.current&&(typeof n=="number"?await e.navigate(n):await e.navigate(n,{fromRouteId:t,...o}))},[e,t])}var ca={};function Za(e,t,r){!t&&!ca[e]&&(ca[e]=!0,G(!1,r))}var da={};function ir(e,t){!e&&!da[t]&&(da[t]=!0,console.warn(t))}var pi="useOptimistic",fa=Un[pi],yi=()=>{};function vi(e){return fa?fa(e):[e,yi]}function es(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&G(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:f.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&G(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:f.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&G(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:f.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var ts=["HydrateFallback","hydrateFallbackElement"],gi=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",e(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",t(r))}})}};function rs({router:e,flushSync:t,onError:r,unstable_useTransitions:a}){a=Ha()||a;let[o,i]=f.useState(e.state),[l,s]=vi(o),[u,h]=f.useState(),[c,m]=f.useState({isTransitioning:!1}),[y,R]=f.useState(),[b,w]=f.useState(),[x,E]=f.useState(),P=f.useRef(new Map),M=f.useCallback((T,{deletedFetchers:j,newErrors:W,flushSync:U,viewTransitionOpts:X})=>{W&&r&&Object.values(W).forEach(Q=>r(Q,{location:T.location,params:T.matches[0]?.params??{},unstable_pattern:dt(T.matches)})),T.fetchers.forEach((Q,V)=>{Q.data!==void 0&&P.current.set(V,Q.data)}),j.forEach(Q=>P.current.delete(Q)),ir(U===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let oe=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(ir(X==null||oe,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!X||!oe){t&&U?t(()=>i(T)):a===!1?i(T):f.startTransition(()=>{a===!0&&s(Q=>ha(Q,T)),i(T)});return}if(t&&U){t(()=>{b&&(y?.resolve(),b.skipTransition()),m({isTransitioning:!0,flushSync:!0,currentLocation:X.currentLocation,nextLocation:X.nextLocation})});let Q=e.window.document.startViewTransition(()=>{t(()=>i(T))});Q.finished.finally(()=>{t(()=>{R(void 0),w(void 0),h(void 0),m({isTransitioning:!1})})}),t(()=>w(Q));return}b?(y?.resolve(),b.skipTransition(),E({state:T,currentLocation:X.currentLocation,nextLocation:X.nextLocation})):(h(T),m({isTransitioning:!0,flushSync:!1,currentLocation:X.currentLocation,nextLocation:X.nextLocation}))},[e.window,t,b,y,a,s,r]);f.useLayoutEffect(()=>e.subscribe(M),[e,M]),f.useEffect(()=>{c.isTransitioning&&!c.flushSync&&R(new gi)},[c]),f.useEffect(()=>{if(y&&u&&e.window){let T=u,j=y.promise,W=e.window.document.startViewTransition(async()=>{a===!1?i(T):f.startTransition(()=>{a===!0&&s(U=>ha(U,T)),i(T)}),await j});W.finished.finally(()=>{R(void 0),w(void 0),h(void 0),m({isTransitioning:!1})}),w(W)}},[u,y,e.window,a,s]),f.useEffect(()=>{y&&u&&l.location.key===u.location.key&&y.resolve()},[y,b,l.location,u]),f.useEffect(()=>{!c.isTransitioning&&x&&(h(x.state),m({isTransitioning:!0,flushSync:!1,currentLocation:x.currentLocation,nextLocation:x.nextLocation}),E(void 0))},[c.isTransitioning,x]);let C=f.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:T=>e.navigate(T),push:(T,j,W)=>e.navigate(T,{state:j,preventScrollReset:W?.preventScrollReset}),replace:(T,j,W)=>e.navigate(T,{replace:!0,state:j,preventScrollReset:W?.preventScrollReset})}),[e]),O=e.basename||"/",v=f.useMemo(()=>({router:e,navigator:C,static:!1,basename:O,onError:r}),[e,C,O,r]);return f.createElement(f.Fragment,null,f.createElement(Be.Provider,{value:v},f.createElement(Ge.Provider,{value:l},f.createElement(wr.Provider,{value:P.current},f.createElement(gr.Provider,{value:c},f.createElement(Ri,{basename:O,location:l.location,navigationType:l.historyAction,navigator:C,unstable_useTransitions:a},f.createElement(wi,{routes:e.routes,future:e.future,state:l,onError:r})))))),null)}function ha(e,t){return{...e,navigation:t.navigation.state!=="idle"?t.navigation:e.navigation,revalidation:t.revalidation!=="idle"?t.revalidation:e.revalidation,actionData:t.navigation.state!=="submitting"?t.actionData:e.actionData,fetchers:t.fetchers}}var wi=f.memo(Ei);function Ei({routes:e,future:t,state:r,onError:a}){return oi(e,void 0,r,a,t)}function as(e){return ni(e.context)}function Ri({basename:e="/",children:t=null,location:r,navigationType:a="POP",navigator:n,static:o=!1,unstable_useTransitions:i}){A(!ft(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),s=f.useMemo(()=>({basename:l,navigator:n,static:o,unstable_useTransitions:i,future:{}}),[l,n,o,i]);typeof r=="string"&&(r=Ie(r));let{pathname:u="/",search:h="",hash:c="",state:m=null,key:y="default"}=r,R=f.useMemo(()=>{let b=he(u,l);return b==null?null:{location:{pathname:b,search:h,hash:c,state:m,key:y},navigationType:a}},[l,u,h,c,m,y,a]);return G(R!=null,`<Router basename="${l}"> is not able to match the URL "${u}${h}${c}" because it does not start with the basename, so the <Router> won't render anything.`),R==null?null:f.createElement(ce.Provider,{value:s},f.createElement(_t.Provider,{children:t,value:R}))}function bi(){return{params:Ka(),loaderData:qa(),actionData:Qa(),matches:br()}}function ns(e){return function(){const r=bi();return f.createElement(e,r)}}function Si(){return{params:Ka(),loaderData:qa(),actionData:Qa(),error:Sr()}}function os(e){return function(){const r=Si();return f.createElement(e,r)}}var Dt="get",Tt="application/x-www-form-urlencoded";function At(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function xi(e){return At(e)&&e.tagName.toLowerCase()==="button"}function Li(e){return At(e)&&e.tagName.toLowerCase()==="form"}function Pi(e){return At(e)&&e.tagName.toLowerCase()==="input"}function Ci(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Mi(e,t){return e.button===0&&(!t||t==="_self")&&!Ci(e)}function lr(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let a=e[r];return t.concat(Array.isArray(a)?a.map(n=>[r,n]):[[r,a]])},[]))}function Di(e,t){let r=lr(e);return t&&t.forEach((a,n)=>{r.has(n)||t.getAll(n).forEach(o=>{r.append(n,o)})}),r}var xt=null;function Ti(){if(xt===null)try{new FormData(document.createElement("form"),0),xt=!1}catch{xt=!0}return xt}var Oi=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function qt(e){return e!=null&&!Oi.has(e)?(G(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Tt}"`),null):e}function Fi(e,t){let r,a,n,o,i;if(Li(e)){let l=e.getAttribute("action");a=l?he(l,t):null,r=e.getAttribute("method")||Dt,n=qt(e.getAttribute("enctype"))||Tt,o=new FormData(e)}else if(xi(e)||Pi(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||l.getAttribute("action");if(a=s?he(s,t):null,r=e.getAttribute("formmethod")||l.getAttribute("method")||Dt,n=qt(e.getAttribute("formenctype"))||qt(l.getAttribute("enctype"))||Tt,o=new FormData(l,e),!Ti()){let{name:u,type:h,value:c}=e;if(h==="image"){let m=u?`${u}.`:"";o.append(`${m}x`,"0"),o.append(`${m}y`,"0")}else u&&o.append(u,c)}}else{if(At(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Dt,a=null,n=Tt,i=e}return o&&n==="text/plain"&&(i=o,o=void 0),{action:a,method:r.toLowerCase(),encType:n,formData:o,body:i}}var Ii=-1,Ni=-2,ki=-3,$i=-4,_i=-5,Ai=-6,ji=-7,Ui="B",zi="D",en="E",Hi="M",Bi="N",tn="P",Wi="R",Vi="S",Yi="Y",Ji="U",Ki="Z",rn=class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}};function Gi(){const e=new TextDecoder;let t="";return new TransformStream({transform(r,a){const n=e.decode(r,{stream:!0}),o=(t+n).split(`
|
|
5
|
+
`);t=o.pop()||"";for(const i of o)a.enqueue(i)},flush(r){t&&r.enqueue(t)}})}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Qt=typeof window<"u"?window:typeof globalThis<"u"?globalThis:void 0;function sr(e){const{hydrated:t,values:r}=this;if(typeof e=="number")return ma.call(this,e);if(!Array.isArray(e)||!e.length)throw new SyntaxError;const a=r.length;for(const n of e)r.push(n);return t.length=r.length,ma.call(this,a)}function ma(e){const{hydrated:t,values:r,deferred:a,plugins:n}=this;let o;const i=[[e,s=>{o=s}]];let l=[];for(;i.length>0;){const[s,u]=i.pop();switch(s){case ji:u(void 0);continue;case _i:u(null);continue;case Ni:u(NaN);continue;case Ai:u(1/0);continue;case ki:u(-1/0);continue;case $i:u(-0);continue}if(t[s]){u(t[s]);continue}const h=r[s];if(!h||typeof h!="object"){t[s]=h,u(h);continue}if(Array.isArray(h))if(typeof h[0]=="string"){const[c,m,y]=h;switch(c){case zi:u(t[s]=new Date(m));continue;case Ji:u(t[s]=new URL(m));continue;case Ui:u(t[s]=BigInt(m));continue;case Wi:u(t[s]=new RegExp(m,y));continue;case Yi:u(t[s]=Symbol.for(m));continue;case Vi:const R=new Set;t[s]=R;for(let M=h.length-1;M>0;M--)i.push([h[M],C=>{R.add(C)}]);u(R);continue;case Hi:const b=new Map;t[s]=b;for(let M=h.length-2;M>0;M-=2){const C=[];i.push([h[M+1],O=>{C[1]=O}]),i.push([h[M],O=>{C[0]=O}]),l.push(()=>{b.set(C[0],C[1])})}u(b);continue;case Bi:const w=Object.create(null);t[s]=w;for(const M of Object.keys(m).reverse()){const C=[];i.push([m[M],O=>{C[1]=O}]),i.push([Number(M.slice(1)),O=>{C[0]=O}]),l.push(()=>{w[C[0]]=C[1]})}u(w);continue;case tn:if(t[m])u(t[s]=t[m]);else{const M=new rn;a[m]=M,u(t[s]=M.promise)}continue;case en:const[,x,E]=h;let P=E&&Qt&&Qt[E]?new Qt[E](x):new Error(x);t[s]=P,u(P);continue;case Ki:u(t[s]=t[m]);continue;default:if(Array.isArray(n)){const M=[],C=h.slice(1);for(let O=0;O<C.length;O++){const v=C[O];i.push([v,T=>{M[O]=T}])}l.push(()=>{for(const O of n){const v=O(h[0],...M);if(v){u(t[s]=v.value);return}}throw new SyntaxError});continue}throw new SyntaxError}}else{const c=[];t[s]=c;for(let m=0;m<h.length;m++){const y=h[m];y!==Ii&&i.push([y,R=>{c[m]=R}])}u(c);continue}else{const c={};t[s]=c;for(const m of Object.keys(h).reverse()){const y=[];i.push([h[m],R=>{y[1]=R}]),i.push([Number(m.slice(1)),R=>{y[0]=R}]),l.push(()=>{c[y[0]]=y[1]})}u(c);continue}}for(;l.length>0;)l.pop()();return o}async function Xi(e,t){const{plugins:r}=t??{},a=new rn,n=e.pipeThrough(Gi()).getReader(),o={values:[],hydrated:[],deferred:{},plugins:r},i=await qi.call(o,n);let l=a.promise;return i.done?a.resolve():l=Qi.call(o,n).then(a.resolve).catch(s=>{for(const u of Object.values(o.deferred))u.reject(s);a.reject(s)}),{done:l.then(()=>n.closed),value:i.value}}async function qi(e){const t=await e.read();if(!t.value)throw new SyntaxError;let r;try{r=JSON.parse(t.value)}catch{throw new SyntaxError}return{done:t.done,value:sr.call(this,r)}}async function Qi(e){let t=await e.read();for(;!t.done;){if(!t.value)continue;const r=t.value;switch(r[0]){case tn:{const a=r.indexOf(":"),n=Number(r.slice(1,a)),o=this.deferred[n];if(!o)throw new Error(`Deferred ID ${n} not found in stream`);const i=r.slice(a+1);let l;try{l=JSON.parse(i)}catch{throw new SyntaxError}const s=sr.call(this,l);o.resolve(s);break}case en:{const a=r.indexOf(":"),n=Number(r.slice(1,a)),o=this.deferred[n];if(!o)throw new Error(`Deferred ID ${n} not found in stream`);const i=r.slice(a+1);let l;try{l=JSON.parse(i)}catch{throw new SyntaxError}const s=sr.call(this,l);o.reject(s);break}default:throw new SyntaxError}t=await e.read()}}async function Zi(e){let t={signal:e.signal};if(e.method!=="GET"){t.method=e.method;let r=e.headers.get("Content-Type");r&&/\bapplication\/json\b/.test(r)?(t.headers={"Content-Type":r},t.body=JSON.stringify(await e.json())):r&&/\btext\/plain\b/.test(r)?(t.headers={"Content-Type":r},t.body=await e.text()):r&&/\bapplication\/x-www-form-urlencoded\b/.test(r)?t.body=new URLSearchParams(await e.text()):t.body=await e.formData()}return t}var el={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},tl=/[&><\u2028\u2029]/g;function ur(e){return e.replace(tl,t=>el[t])}function le(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}var cr=Symbol("SingleFetchRedirect"),an=class extends Error{},rl=202,al=new Set([100,101,204,205]);function is(e,t,r,a,n,o){let i=nl(e,l=>{let s=t.routes[l.route.id];le(s,"Route not found in manifest");let u=r[l.route.id];return{hasLoader:s.hasLoader,hasClientLoader:s.hasClientLoader,hasShouldRevalidate:!!u?.shouldRevalidate}},dl,a,n,o);return async l=>l.runClientMiddleware(i)}function nl(e,t,r,a,n,o,i=()=>!0){return async l=>{let{request:s,matches:u,fetcherKey:h}=l,c=e();if(s.method!=="GET")return ol(l,r,n,o);let m=u.some(y=>{let{hasLoader:R,hasClientLoader:b}=t(y);return y.shouldCallHandler()&&R&&!b});return!a&&!m?il(l,t,r,n,o):h?ul(l,r,n,o):ll(l,c,t,r,a,n,o,i)}}async function ol(e,t,r,a){let n=e.matches.find(l=>l.shouldCallHandler());le(n,"No action match found");let o,i=await n.resolve(async l=>await l(async()=>{let{data:u,status:h}=await t(e,r,a,[n.route.id]);return o=h,ct(u,n.route.id)}));return $t(i.result)||He(i.result)||or(i.result)?{[n.route.id]:i}:{[n.route.id]:{type:i.type,result:mo(i.result,o)}}}async function il(e,t,r,a,n){let o=e.matches.filter(l=>l.shouldCallHandler()),i={};return await Promise.all(o.map(l=>l.resolve(async s=>{try{let{hasClientLoader:u}=t(l),h=l.route.id,c=u?await s(async()=>{let{data:m}=await r(e,a,n,[h]);return ct(m,h)}):await s();i[l.route.id]={type:"data",result:c}}catch(u){i[l.route.id]={type:"error",result:u}}}))),i}async function ll(e,t,r,a,n,o,i,l=()=>!0){let s=new Set,u=!1,h=e.matches.map(()=>pa()),c=pa(),m={},y=Promise.all(e.matches.map(async(b,w)=>b.resolve(async x=>{h[w].resolve();let E=b.route.id,{hasLoader:P,hasClientLoader:M,hasShouldRevalidate:C}=r(b),O=!b.shouldRevalidateArgs||b.shouldRevalidateArgs.actionStatus==null||b.shouldRevalidateArgs.actionStatus<400;if(!b.shouldCallHandler(O)){u||(u=b.shouldRevalidateArgs!=null&&P&&C===!0);return}if(l(b)&&M){P&&(u=!0);try{let T=await x(async()=>{let{data:j}=await a(e,o,i,[E]);return ct(j,E)});m[E]={type:"data",result:T}}catch(T){m[E]={type:"error",result:T}}return}P&&s.add(E);try{let T=await x(async()=>{let j=await c.promise;return ct(j,E)});m[E]={type:"data",result:T}}catch(T){m[E]={type:"error",result:T}}})));if(await Promise.all(h.map(b=>b.promise)),(!t.state.initialized&&t.state.navigation.state==="idle"||s.size===0)&&!window.__reactRouterHdrActive)c.resolve({routes:{}});else{let b=n&&u&&s.size>0?[...s.keys()]:void 0;try{let w=await a(e,o,i,b);c.resolve(w.data)}catch(w){c.reject(w)}}return await y,await sl(c.promise,e.matches,s,m),m}async function sl(e,t,r,a){try{let n,o=await e;if("routes"in o){for(let i of t)if(i.route.id in o.routes){let l=o.routes[i.route.id];if("error"in l){n=l.error,a[i.route.id]?.result==null&&(a[i.route.id]={type:"error",result:n});break}}}n!==void 0&&Array.from(r.values()).forEach(i=>{a[i].result instanceof an&&(a[i].result=n)})}catch{}}async function ul(e,t,r,a){let n=e.matches.find(l=>l.shouldCallHandler());le(n,"No fetcher match found");let o=n.route.id,i=await n.resolve(async l=>l(async()=>{let{data:s}=await t(e,r,a,[o]);return ct(s,o)}));return{[n.route.id]:i}}function cl(e){let t=e.searchParams.getAll("index");e.searchParams.delete("index");let r=[];for(let a of t)a&&r.push(a);for(let a of r)e.searchParams.append("index",a);return e}function nn(e,t,r,a){let n=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?n.pathname.endsWith("/")?n.pathname=`${n.pathname}_.${a}`:n.pathname=`${n.pathname}.${a}`:n.pathname==="/"?n.pathname=`_root.${a}`:t&&he(n.pathname,t)==="/"?n.pathname=`${t.replace(/\/$/,"")}/_root.${a}`:n.pathname=`${n.pathname.replace(/\/$/,"")}.${a}`,n}async function dl(e,t,r,a){let{request:n}=e,o=nn(n.url,t,r,"data");n.method==="GET"&&(o=cl(o),a&&o.searchParams.set("_routes",a.join(",")));let i=await fetch(o,await Zi(n));if(i.status>=400&&!i.headers.has("X-Remix-Response"))throw new Ne(i.status,i.statusText,await i.text());if(i.status===204&&i.headers.has("X-Remix-Redirect"))return{status:rl,data:{redirect:{redirect:i.headers.get("X-Remix-Redirect"),status:Number(i.headers.get("X-Remix-Status")||"302"),revalidate:i.headers.get("X-Remix-Revalidate")==="true",reload:i.headers.get("X-Remix-Reload-Document")==="true",replace:i.headers.get("X-Remix-Replace")==="true"}}};if(al.has(i.status)){let l={};return a&&n.method!=="GET"&&(l[a[0]]={data:void 0}),{status:i.status,data:{routes:l}}}le(i.body,"No response body to decode");try{let l=await fl(i.body,window),s;if(n.method==="GET"){let u=l.value;cr in u?s={redirect:u[cr]}:s={routes:u}}else{let u=l.value,h=a?.[0];le(h,"No routeId found for single fetch call decoding"),"redirect"in u?s={redirect:u}:s={routes:{[h]:u}}}return{status:i.status,data:s}}catch{throw new Error("Unable to decode turbo-stream response")}}function fl(e,t){return Xi(e,{plugins:[(r,...a)=>{if(r==="SanitizedError"){let[n,o,i]=a,l=Error;n&&n in t&&typeof t[n]=="function"&&(l=t[n]);let s=new l(o);return s.stack=i,{value:s}}if(r==="ErrorResponse"){let[n,o,i]=a;return{value:new Ne(o,i,n)}}if(r==="SingleFetchRedirect")return{value:{[cr]:a[0]}};if(r==="SingleFetchClassInstance")return{value:a[0]};if(r==="SingleFetchFallback")return{value:void 0}}]})}function ct(e,t){if("redirect"in e){let{redirect:a,revalidate:n,reload:o,replace:i,status:l}=e.redirect;throw po(a,{status:l,headers:{...n?{"X-Remix-Revalidate":"yes"}:null,...o?{"X-Remix-Reload-Document":"yes"}:null,...i?{"X-Remix-Replace":"yes"}:null}})}let r=e.routes[t];if(r==null)throw new an(`No result found for routeId "${t}"`);if("error"in r)throw r.error;if("data"in r)return r.data;throw new Error(`Invalid response found for routeId "${t}"`)}function pa(){let e,t,r=new Promise((a,n)=>{e=async o=>{a(o);try{await r}catch{}},t=async o=>{n(o);try{await r}catch{}}});return{promise:r,resolve:e,reject:t}}async function on(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(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function hl(e,t,r){let a=e.map(o=>{let i=t[o.route.id],l=r.routes[o.route.id];return[l&&l.css?l.css.map(s=>({rel:"stylesheet",href:s})):[],i?.links?.()||[]]}).flat(2),n=Lr(e,r);return cn(a,n)}function ln(e){return e.css?e.css.map(t=>({rel:"stylesheet",href:t})):[]}async function ml(e){if(!e.css)return;let t=ln(e);await Promise.all(t.map(un))}async function sn(e,t){if(!e.css&&!t.links||!wl())return;let r=[];if(e.css&&r.push(...ln(e)),t.links&&r.push(...t.links()),r.length===0)return;let a=[];for(let n of r)!xr(n)&&n.rel==="stylesheet"&&a.push({...n,rel:"preload",as:"style"});await Promise.all(a.map(un))}async function un(e){return new Promise(t=>{if(e.media&&!window.matchMedia(e.media).matches||document.querySelector(`link[rel="stylesheet"][href="${e.href}"]`))return t();let r=document.createElement("link");Object.assign(r,e);function a(){document.head.contains(r)&&document.head.removeChild(r)}r.onload=()=>{a(),t()},r.onerror=()=>{a(),t()},document.head.appendChild(r)})}function xr(e){return e!=null&&typeof e.page=="string"}function pl(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function yl(e,t,r){let a=await Promise.all(e.map(async n=>{let o=t.routes[n.route.id];if(o){let i=await on(o,r);return i.links?i.links():[]}return[]}));return cn(a.flat(1).filter(pl).filter(n=>n.rel==="stylesheet"||n.rel==="preload").map(n=>n.rel==="stylesheet"?{...n,rel:"prefetch",as:"style"}:{...n,rel:"prefetch"}))}function ya(e,t,r,a,n,o){let i=(s,u)=>r[u]?s.route.id!==r[u].route.id:!0,l=(s,u)=>r[u].pathname!==s.pathname||r[u].route.path?.endsWith("*")&&r[u].params["*"]!==s.params["*"];return o==="assets"?t.filter((s,u)=>i(s,u)||l(s,u)):o==="data"?t.filter((s,u)=>{let h=a.routes[s.route.id];if(!h||!h.hasLoader)return!1;if(i(s,u)||l(s,u))return!0;if(s.route.shouldRevalidate){let c=s.route.shouldRevalidate({currentUrl:new URL(n.pathname+n.search+n.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:s.params,defaultShouldRevalidate:!0});if(typeof c=="boolean")return c}return!0}):[]}function Lr(e,t,{includeHydrateFallback:r}={}){return vl(e.map(a=>{let n=t.routes[a.route.id];if(!n)return[];let o=[n.module];return n.clientActionModule&&(o=o.concat(n.clientActionModule)),n.clientLoaderModule&&(o=o.concat(n.clientLoaderModule)),r&&n.hydrateFallbackModule&&(o=o.concat(n.hydrateFallbackModule)),n.imports&&(o=o.concat(n.imports)),o}).flat(1))}function vl(e){return[...new Set(e)]}function gl(e){let t={},r=Object.keys(e).sort();for(let a of r)t[a]=e[a];return t}function cn(e,t){let r=new Set,a=new Set(t);return e.reduce((n,o)=>{if(t&&!xr(o)&&o.as==="script"&&o.href&&a.has(o.href))return n;let l=JSON.stringify(gl(o));return r.has(l)||(r.add(l),n.push({key:l,link:o})),n},[])}var Lt;function wl(){if(Lt!==void 0)return Lt;let e=document.createElement("link");return Lt=e.relList.supports("preload"),e=null,Lt}function El(){return f.createElement(dr,{title:"Loading...",renderScripts:!0},f.createElement("script",{dangerouslySetInnerHTML:{__html:`
|
|
6
|
+
console.log(
|
|
7
|
+
"💿 Hey developer 👋. You can provide a way better UX than this " +
|
|
8
|
+
"when your app is loading JS modules and/or running \`clientLoader\` " +
|
|
9
|
+
"functions. Check out https://reactrouter.com/start/framework/route-module#hydratefallback " +
|
|
10
|
+
"for more information."
|
|
11
|
+
);
|
|
12
|
+
`}}))}function dn(e){let t={};return Object.values(e).forEach(r=>{if(r){let a=r.parentId||"";t[a]||(t[a]=[]),t[a].push(r)}}),t}function Rl(e,t,r){let a=fn(t),n=t.HydrateFallback&&(!r||e.id==="root")?t.HydrateFallback:e.id==="root"?El:void 0,o=t.ErrorBoundary?t.ErrorBoundary:e.id==="root"?()=>f.createElement(pn,{error:Sr()}):void 0;return e.id==="root"&&t.Layout?{...a?{element:f.createElement(t.Layout,null,f.createElement(a,null))}:{Component:a},...o?{errorElement:f.createElement(t.Layout,null,f.createElement(o,null))}:{ErrorBoundary:o},...n?{hydrateFallbackElement:f.createElement(t.Layout,null,f.createElement(n,null))}:{HydrateFallback:n}}:{Component:a,ErrorBoundary:o,HydrateFallback:n}}function ls(e,t,r,a,n,o){return Pr(t,r,a,n,o,"",dn(t),e)}function Pt(e,t){if(e==="loader"&&!t.hasLoader||e==="action"&&!t.hasAction){let a=`You are trying to call ${e==="action"?"serverAction()":"serverLoader()"} on a route that does not have a server ${e} (routeId: "${t.id}")`;throw console.error(a),new Ne(400,"Bad Request",new Error(a),!0)}}function Zt(e,t){let r=e==="clientAction"?"a":"an",a=`Route "${t}" does not have ${r} ${e}, but you are trying to submit to it. To fix this, please add ${r} \`${e}\` function to the route`;throw console.error(a),new Ne(405,"Method Not Allowed",new Error(a),!0)}function Pr(e,t,r,a,n,o="",i=dn(e),l){return(i[o]||[]).map(s=>{let u=t[s.id];function h(E){return le(typeof E=="function","No single fetch function available for route handler"),E()}function c(E){return s.hasLoader?h(E):Promise.resolve(null)}function m(E){if(!s.hasAction)throw Zt("action",s.id);return h(E)}function y(E){import(E)}function R(E){E.clientActionModule&&y(E.clientActionModule),E.clientLoaderModule&&y(E.clientLoaderModule)}async function b(E){let P=t[s.id],M=P?sn(s,P):Promise.resolve();try{return E()}finally{await M}}let w={id:s.id,index:s.index,path:s.path};if(u){Object.assign(w,{...w,...Rl(s,u,n),middleware:u.clientMiddleware,handle:u.handle,shouldRevalidate:va(w.path,u,s,a,l)});let E=r&&r.loaderData&&s.id in r.loaderData,P=E?r?.loaderData?.[s.id]:void 0,M=r&&r.errors&&s.id in r.errors,C=M?r?.errors?.[s.id]:void 0,O=l==null&&(u.clientLoader?.hydrate===!0||!s.hasLoader);w.loader=async({request:v,params:T,context:j,unstable_pattern:W},U)=>{try{return await b(async()=>(le(u,"No `routeModule` available for critical-route loader"),u.clientLoader?u.clientLoader({request:v,params:T,context:j,unstable_pattern:W,async serverLoader(){if(Pt("loader",s),O){if(E)return P;if(M)throw C}return c(U)}}):c(U)))}finally{O=!1}},w.loader.hydrate=xl(s.id,u.clientLoader,s.hasLoader,n),w.action=({request:v,params:T,context:j,unstable_pattern:W},U)=>b(async()=>{if(le(u,"No `routeModule` available for critical-route action"),!u.clientAction){if(n)throw Zt("clientAction",s.id);return m(U)}return u.clientAction({request:v,params:T,context:j,unstable_pattern:W,async serverAction(){return Pt("action",s),m(U)}})})}else{s.hasClientLoader||(w.loader=(M,C)=>b(()=>c(C))),s.hasClientAction||(w.action=(M,C)=>b(()=>{if(n)throw Zt("clientAction",s.id);return m(C)}));let E;async function P(){return E?await E:(E=(async()=>{(s.clientLoaderModule||s.clientActionModule)&&await new Promise(C=>setTimeout(C,0));let M=Sl(s,t);return R(s),await M})(),await E)}w.lazy={loader:s.hasClientLoader?async()=>{let{clientLoader:M}=s.clientLoaderModule?await import(s.clientLoaderModule):await P();return le(M,"No `clientLoader` export found"),(C,O)=>M({...C,async serverLoader(){return Pt("loader",s),c(O)}})}:void 0,action:s.hasClientAction?async()=>{let M=s.clientActionModule?import(s.clientActionModule):P();R(s);let{clientAction:C}=await M;return le(C,"No `clientAction` export found"),(O,v)=>C({...O,async serverAction(){return Pt("action",s),m(v)}})}:void 0,middleware:s.hasClientMiddleware?async()=>{let{clientMiddleware:M}=s.clientMiddlewareModule?await import(s.clientMiddlewareModule):await P();return le(M,"No `clientMiddleware` export found"),M}:void 0,shouldRevalidate:async()=>{let M=await P();return va(w.path,M,s,a,l)},handle:async()=>(await P()).handle,Component:async()=>(await P()).Component,ErrorBoundary:s.hasErrorBoundary?async()=>(await P()).ErrorBoundary:void 0}}let x=Pr(e,t,r,a,n,s.id,i,l);return x.length>0&&(w.children=x),w})}function va(e,t,r,a,n){if(n)return bl(r.id,t.shouldRevalidate,n);if(!a&&r.hasLoader&&!r.hasClientLoader){let o=e?xa(e)[1].map(l=>l.paramName):[];const i=l=>o.some(s=>l.currentParams[s]!==l.nextParams[s]);if(t.shouldRevalidate){let l=t.shouldRevalidate;return s=>l({...s,defaultShouldRevalidate:i(s)})}else return l=>i(l)}return t.shouldRevalidate}function bl(e,t,r){let a=!1;return n=>a?t?t(n):n.defaultShouldRevalidate:(a=!0,r.has(e))}async function Sl(e,t){let r=on(e,t),a=ml(e),n=await r;return await Promise.all([a,sn(e,n)]),{Component:fn(n),ErrorBoundary:n.ErrorBoundary,clientMiddleware:n.clientMiddleware,clientAction:n.clientAction,clientLoader:n.clientLoader,handle:n.handle,links:n.links,meta:n.meta,shouldRevalidate:n.shouldRevalidate}}function fn(e){if(e.default==null)return;if(!(typeof e.default=="object"&&Object.keys(e.default).length===0))return e.default}function xl(e,t,r,a){return a&&e!=="root"||t!=null&&(t.hydrate===!0||r!==!0)}var Ot=new Set,Ll=1e3,It=new Set,Pl=7680;function Cr(e,t){return e.mode==="lazy"&&t===!0}function Cl({sri:e,...t},r){let a=new Set(r.state.matches.map(l=>l.route.id)),n=r.state.location.pathname.split("/").filter(Boolean),o=["/"];for(n.pop();n.length>0;)o.push(`/${n.join("/")}`),n.pop();o.forEach(l=>{let s=De(r.routes,l,r.basename);s&&s.forEach(u=>a.add(u.route.id))});let i=[...a].reduce((l,s)=>Object.assign(l,{[s]:t.routes[s]}),{});return{...t,routes:i,sri:e?!0:void 0}}function ss(e,t,r,a,n,o){if(Cr(a,r))return async({path:i,patch:l,signal:s,fetcherKey:u})=>{It.has(i)||await hn([i],u?window.location.href:i,e,t,r,n,o,a.manifestPath,l,s)}}function us(e,t,r,a,n,o){f.useEffect(()=>{if(!Cr(n,a)||window.navigator?.connection?.saveData===!0)return;function i(h){let c=h.tagName==="FORM"?h.getAttribute("action"):h.getAttribute("href");if(!c)return;let m=h.tagName==="A"?h.pathname:new URL(c,window.location.origin).pathname;It.has(m)||Ot.add(m)}async function l(){document.querySelectorAll("a[data-discover], form[data-discover]").forEach(i);let h=Array.from(Ot.keys()).filter(c=>It.has(c)?(Ot.delete(c),!1):!0);if(h.length!==0)try{await hn(h,null,t,r,a,o,e.basename,n.manifestPath,e.patchRoutes)}catch(c){console.error("Failed to fetch manifest patches",c)}}let s=Tl(l,100);l();let u=new MutationObserver(()=>s());return u.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["data-discover","href","action"]}),()=>u.disconnect()},[a,o,t,r,e,n])}function Ml(e,t){let r=e||"/__manifest";return t==null?r:`${t}${r}`.replace(/\/+/g,"/")}var er="react-router-manifest-version";async function hn(e,t,r,a,n,o,i,l,s,u){const h=new URLSearchParams;h.set("paths",e.sort().join(",")),h.set("version",r.version);let c=new URL(Ml(l,i),window.location.origin);if(c.search=h.toString(),c.toString().length>Pl){Ot.clear();return}let m;try{let w=await fetch(c,{signal:u});if(w.ok){if(w.status===204&&w.headers.has("X-Remix-Reload-Document")){if(!t){console.warn("Detected a manifest version mismatch during eager route discovery. The next navigation/fetch to an undiscovered route will result in a new document navigation to sync up with the latest manifest.");return}try{if(sessionStorage.getItem(er)===r.version){console.error("Unable to discover routes due to manifest version mismatch.");return}sessionStorage.setItem(er,r.version)}catch{}window.location.href=t,console.warn("Detected manifest version mismatch, reloading..."),await new Promise(()=>{})}else if(w.status>=400)throw new Error(await w.text())}else throw new Error(`${w.status} ${w.statusText}`);try{sessionStorage.removeItem(er)}catch{}m=await w.json()}catch(w){if(u?.aborted)return;throw w}let y=new Set(Object.keys(r.routes)),R=Object.values(m).reduce((w,x)=>(x&&!y.has(x.id)&&(w[x.id]=x),w),{});Object.assign(r.routes,R),e.forEach(w=>Dl(w,It));let b=new Set;Object.values(R).forEach(w=>{w&&(!w.parentId||!R[w.parentId])&&b.add(w.parentId)}),b.forEach(w=>s(w||null,Pr(R,a,null,n,o,w)))}function Dl(e,t){if(t.size>=Ll){let r=t.values().next().value;t.delete(r)}t.add(e)}function Tl(e,t){let r;return(...a)=>{window.clearTimeout(r),r=window.setTimeout(()=>e(...a),t)}}function Mr(){let e=f.useContext(Be);return le(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function jt(){let e=f.useContext(Ge);return le(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Ut=f.createContext(void 0);Ut.displayName="FrameworkContext";function qe(){let e=f.useContext(Ut);return le(e,"You must render this element inside a <HydratedRouter> element"),e}function Ol(e,t){let r=f.useContext(Ut),[a,n]=f.useState(!1),[o,i]=f.useState(!1),{onFocus:l,onBlur:s,onMouseEnter:u,onMouseLeave:h,onTouchStart:c}=t,m=f.useRef(null);f.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let b=x=>{x.forEach(E=>{i(E.isIntersecting)})},w=new IntersectionObserver(b,{threshold:.5});return m.current&&w.observe(m.current),()=>{w.disconnect()}}},[e]),f.useEffect(()=>{if(a){let b=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(b)}}},[a]);let y=()=>{n(!0)},R=()=>{n(!1),i(!1)};return r?e!=="intent"?[o,m,{}]:[o,m,{onFocus:nt(l,y),onBlur:nt(s,R),onMouseEnter:nt(u,y),onMouseLeave:nt(h,R),onTouchStart:nt(c,y)}]:[!1,m,{}]}function nt(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function Dr(e,t,r){if(r&&!Nt)return[e[0]];if(t){let a=e.findIndex(n=>t[n.route.id]!==void 0);return e.slice(0,a+1)}return e}var ga="data-react-router-critical-css";function cs({nonce:e}){let{isSpaMode:t,manifest:r,routeModules:a,criticalCss:n}=qe(),{errors:o,matches:i}=jt(),l=Dr(i,o,t),s=f.useMemo(()=>hl(l,a,r),[l,a,r]);return f.createElement(f.Fragment,null,typeof n=="string"?f.createElement("style",{[ga]:"",dangerouslySetInnerHTML:{__html:n}}):null,typeof n=="object"?f.createElement("link",{[ga]:"",rel:"stylesheet",href:n.href,nonce:e}):null,s.map(({key:u,link:h})=>xr(h)?f.createElement(mn,{key:u,nonce:e,...h}):f.createElement("link",{key:u,nonce:e,...h})))}function mn({page:e,...t}){let{router:r}=Mr(),a=f.useMemo(()=>De(r.routes,e,r.basename),[r.routes,e,r.basename]);return a?f.createElement(Il,{page:e,matches:a,...t}):null}function Fl(e){let{manifest:t,routeModules:r}=qe(),[a,n]=f.useState([]);return f.useEffect(()=>{let o=!1;return yl(e,t,r).then(i=>{o||n(i)}),()=>{o=!0}},[e,t,r]),a}function Il({page:e,matches:t,...r}){let a=Re(),{future:n,manifest:o,routeModules:i}=qe(),{basename:l}=Mr(),{loaderData:s,matches:u}=jt(),h=f.useMemo(()=>ya(e,t,u,o,a,"data"),[e,t,u,o,a]),c=f.useMemo(()=>ya(e,t,u,o,a,"assets"),[e,t,u,o,a]),m=f.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let b=new Set,w=!1;if(t.forEach(E=>{let P=o.routes[E.route.id];!P||!P.hasLoader||(!h.some(M=>M.route.id===E.route.id)&&E.route.id in s&&i[E.route.id]?.shouldRevalidate||P.hasClientLoader?w=!0:b.add(E.route.id))}),b.size===0)return[];let x=nn(e,l,n.unstable_trailingSlashAwareDataRequests,"data");return w&&b.size>0&&x.searchParams.set("_routes",t.filter(E=>b.has(E.route.id)).map(E=>E.route.id).join(",")),[x.pathname+x.search]},[l,n.unstable_trailingSlashAwareDataRequests,s,a,o,h,t,e,i]),y=f.useMemo(()=>Lr(c,o),[c,o]),R=Fl(c);return f.createElement(f.Fragment,null,m.map(b=>f.createElement("link",{key:b,rel:"prefetch",as:"fetch",href:b,...r})),y.map(b=>f.createElement("link",{key:b,rel:"modulepreload",href:b,...r})),R.map(({key:b,link:w})=>f.createElement("link",{key:b,nonce:r.nonce,...w})))}function ds(){let{isSpaMode:e,routeModules:t}=qe(),{errors:r,matches:a,loaderData:n}=jt(),o=Re(),i=Dr(a,r,e),l=null;r&&(l=r[i[i.length-1].route.id]);let s=[],u=null,h=[];for(let c=0;c<i.length;c++){let m=i[c],y=m.route.id,R=n[y],b=m.params,w=t[y],x=[],E={id:y,data:R,loaderData:R,meta:[],params:m.params,pathname:m.pathname,handle:m.route.handle,error:l};if(h[c]=E,w?.meta?x=typeof w.meta=="function"?w.meta({data:R,loaderData:R,params:b,location:o,matches:h,error:l}):Array.isArray(w.meta)?[...w.meta]:w.meta:u&&(x=[...u]),x=x||[],!Array.isArray(x))throw new Error("The route at "+m.route.path+` returns an invalid value. All route meta functions must return an array of meta objects.
|
|
13
|
+
|
|
14
|
+
To reference the meta function API, see https://remix.run/route/meta`);E.meta=x,h[c]=E,s=[...x],u=s}return f.createElement(f.Fragment,null,s.flat().map(c=>{if(!c)return null;if("tagName"in c){let{tagName:m,...y}=c;if(!Nl(m))return console.warn(`A meta object uses an invalid tagName: ${m}. Expected either 'link' or 'meta'`),null;let R=m;return f.createElement(R,{key:JSON.stringify(y),...y})}if("title"in c)return f.createElement("title",{key:"title"},String(c.title));if("charset"in c&&(c.charSet??(c.charSet=c.charset),delete c.charset),"charSet"in c&&c.charSet!=null)return typeof c.charSet=="string"?f.createElement("meta",{key:"charSet",charSet:c.charSet}):null;if("script:ld+json"in c)try{let m=JSON.stringify(c["script:ld+json"]);return f.createElement("script",{key:`script:ld+json:${m}`,type:"application/ld+json",dangerouslySetInnerHTML:{__html:ur(m)}})}catch{return null}return f.createElement("meta",{key:JSON.stringify(c),...c})}))}function Nl(e){return typeof e=="string"&&/^(meta|link)$/.test(e)}var Nt=!1;function kl(){Nt=!0}function $l(e){let{manifest:t,serverHandoffString:r,isSpaMode:a,renderMeta:n,routeDiscovery:o,ssr:i}=qe(),{router:l,static:s,staticContext:u}=Mr(),{matches:h}=jt(),c=Ha(),m=Cr(o,i);n&&(n.didRenderScripts=!0);let y=Dr(h,null,a);f.useEffect(()=>{kl()},[]);let R=f.useMemo(()=>{if(c)return null;let E=u?`window.__reactRouterContext = ${r};window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());`:" ",P=s?`${t.hmr?.runtime?`import ${JSON.stringify(t.hmr.runtime)};`:""}${m?"":`import ${JSON.stringify(t.url)}`};
|
|
15
|
+
${y.map((M,C)=>{let O=`route${C}`,v=t.routes[M.route.id];le(v,`Route ${M.route.id} not found in manifest`);let{clientActionModule:T,clientLoaderModule:j,clientMiddlewareModule:W,hydrateFallbackModule:U,module:X}=v,oe=[...T?[{module:T,varName:`${O}_clientAction`}]:[],...j?[{module:j,varName:`${O}_clientLoader`}]:[],...W?[{module:W,varName:`${O}_clientMiddleware`}]:[],...U?[{module:U,varName:`${O}_HydrateFallback`}]:[],{module:X,varName:`${O}_main`}];if(oe.length===1)return`import * as ${O} from ${JSON.stringify(X)};`;let Q=oe.map(J=>`import * as ${J.varName} from "${J.module}";`).join(`
|
|
16
|
+
`),V=`const ${O} = {${oe.map(J=>`...${J.varName}`).join(",")}};`;return[Q,V].join(`
|
|
17
|
+
`)}).join(`
|
|
18
|
+
`)}
|
|
19
|
+
${m?`window.__reactRouterManifest = ${JSON.stringify(Cl(t,l),null,2)};`:""}
|
|
20
|
+
window.__reactRouterRouteModules = {${y.map((M,C)=>`${JSON.stringify(M.route.id)}:route${C}`).join(",")}};
|
|
21
|
+
|
|
22
|
+
import(${JSON.stringify(t.entry.module)});`:" ";return f.createElement(f.Fragment,null,f.createElement("script",{...e,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:E},type:void 0}),f.createElement("script",{...e,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:P},type:"module",async:!0}))},[]),b=Nt||c?[]:_l(t.entry.imports.concat(Lr(y,t,{includeHydrateFallback:!0}))),w=typeof t.sri=="object"?t.sri:{};return ir(!c,"The <Scripts /> element is a no-op when using RSC and can be safely removed."),Nt||c?null:f.createElement(f.Fragment,null,typeof t.sri=="object"?f.createElement("script",{...e,"rr-importmap":"",type:"importmap",suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:JSON.stringify({integrity:w})}}):null,m?null:f.createElement("link",{rel:"modulepreload",href:t.url,crossOrigin:e.crossOrigin,integrity:w[t.url],suppressHydrationWarning:!0}),f.createElement("link",{rel:"modulepreload",href:t.entry.module,crossOrigin:e.crossOrigin,integrity:w[t.entry.module],suppressHydrationWarning:!0}),b.map(x=>f.createElement("link",{key:x,rel:"modulepreload",href:x,crossOrigin:e.crossOrigin,integrity:w[x],suppressHydrationWarning:!0})),R)}function _l(e){return[...new Set(e)]}function Al(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var fs=class extends f.Component{constructor(e){super(e),this.state={error:e.error||null,location:e.location}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location?{error:e.error||null,location:e.location}:{error:e.error||t.error,location:t.location}}render(){return this.state.error?f.createElement(pn,{error:this.state.error,isOutsideRemixApp:!0}):this.props.children}};function pn({error:e,isOutsideRemixApp:t}){console.error(e);let r=f.createElement("script",{dangerouslySetInnerHTML:{__html:`
|
|
23
|
+
console.log(
|
|
24
|
+
"💿 Hey developer 👋. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information."
|
|
25
|
+
);
|
|
26
|
+
`}});if(He(e))return f.createElement(dr,{title:"Unhandled Thrown Response!"},f.createElement("h1",{style:{fontSize:"24px"}},e.status," ",e.statusText),r);let a;if(e instanceof Error)a=e;else{let n=e==null?"Unknown Error":typeof e=="object"&&"toString"in e?e.toString():JSON.stringify(e);a=new Error(n)}return f.createElement(dr,{title:"Application Error!",isOutsideRemixApp:t},f.createElement("h1",{style:{fontSize:"24px"}},"Application Error"),f.createElement("pre",{style:{padding:"2rem",background:"hsla(10, 50%, 50%, 0.1)",color:"red",overflow:"auto"}},a.stack),r)}function dr({title:e,renderScripts:t,isOutsideRemixApp:r,children:a}){let{routeModules:n}=qe();return n.root?.Layout&&!r?a:f.createElement("html",{lang:"en"},f.createElement("head",null,f.createElement("meta",{charSet:"utf-8"}),f.createElement("meta",{name:"viewport",content:"width=device-width,initial-scale=1,viewport-fit=cover"}),f.createElement("title",null,e)),f.createElement("body",null,f.createElement("main",{style:{fontFamily:"system-ui, sans-serif",padding:"2rem"}},a,t?f.createElement($l,null):null)))}var jl=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{jl&&(window.__reactRouterVersion="7.12.0")}catch{}var yn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,vn=f.forwardRef(function({onClick:t,discover:r="render",prefetch:a="none",relative:n,reloadDocument:o,replace:i,state:l,target:s,to:u,preventScrollReset:h,viewTransition:c,unstable_defaultShouldRevalidate:m,...y},R){let{basename:b,unstable_useTransitions:w}=f.useContext(ce),x=typeof u=="string"&&yn.test(u),E=Ma(u,b);u=E.to;let P=ri(u,{relative:n}),[M,C,O]=Ol(a,y),v=Hl(u,{replace:i,state:l,target:s,preventScrollReset:h,relative:n,viewTransition:c,unstable_defaultShouldRevalidate:m,unstable_useTransitions:w});function T(W){t&&t(W),W.defaultPrevented||v(W)}let j=f.createElement("a",{...y,...O,href:E.absoluteURL||P,onClick:E.isExternal||o?t:T,ref:Al(R,C),target:s,"data-discover":!x&&r==="render"?"true":void 0});return M&&!x?f.createElement(f.Fragment,null,j,f.createElement(mn,{page:P})):j});vn.displayName="Link";var Ul=f.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:a="",end:n=!1,style:o,to:i,viewTransition:l,children:s,...u},h){let c=ht(i,{relative:u.relative}),m=Re(),y=f.useContext(Ge),{navigator:R,basename:b}=f.useContext(ce),w=y!=null&&Kl(c)&&l===!0,x=R.encodeLocation?R.encodeLocation(c).pathname:c.pathname,E=m.pathname,P=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;r||(E=E.toLowerCase(),P=P?P.toLowerCase():null,x=x.toLowerCase()),P&&b&&(P=he(P,b)||P);const M=x!=="/"&&x.endsWith("/")?x.length-1:x.length;let C=E===x||!n&&E.startsWith(x)&&E.charAt(M)==="/",O=P!=null&&(P===x||!n&&P.startsWith(x)&&P.charAt(x.length)==="/"),v={isActive:C,isPending:O,isTransitioning:w},T=C?t:void 0,j;typeof a=="function"?j=a(v):j=[a,C?"active":null,O?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let W=typeof o=="function"?o(v):o;return f.createElement(vn,{...u,"aria-current":T,className:j,ref:h,style:W,to:i,viewTransition:l},typeof s=="function"?s(v):s)});Ul.displayName="NavLink";var gn=f.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:a,replace:n,state:o,method:i=Dt,action:l,onSubmit:s,relative:u,preventScrollReset:h,viewTransition:c,unstable_defaultShouldRevalidate:m,...y},R)=>{let{unstable_useTransitions:b}=f.useContext(ce),w=Rn(),x=Vl(l,{relative:u}),E=i.toLowerCase()==="get"?"get":"post",P=typeof l=="string"&&yn.test(l),M=C=>{if(s&&s(C),C.defaultPrevented)return;C.preventDefault();let O=C.nativeEvent.submitter,v=O?.getAttribute("formmethod")||i,T=()=>w(O||C.currentTarget,{fetcherKey:t,method:v,navigate:r,replace:n,state:o,relative:u,preventScrollReset:h,viewTransition:c,unstable_defaultShouldRevalidate:m});b&&r!==!1?f.startTransition(()=>T()):T()};return f.createElement("form",{ref:R,method:E,action:x,onSubmit:a?s:M,...y,"data-discover":!P&&e==="render"?"true":void 0})});gn.displayName="Form";function zl({getKey:e,storageKey:t,...r}){let a=f.useContext(Ut),{basename:n}=f.useContext(ce),o=Re(),i=br();Yl({getKey:e,storageKey:t});let l=f.useMemo(()=>{if(!a||!e)return null;let u=hr(o,i,n,e);return u!==o.key?u:null},[]);if(!a||a.isSpaMode)return null;let s=((u,h)=>{if(!window.history.state||!window.history.state.key){let c=Math.random().toString(32).slice(2);window.history.replaceState({key:c},"")}try{let m=JSON.parse(sessionStorage.getItem(u)||"{}")[h||window.history.state.key];typeof m=="number"&&window.scrollTo(0,m)}catch(c){console.error(c),sessionStorage.removeItem(u)}}).toString();return f.createElement("script",{...r,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${s})(${ur(JSON.stringify(t||fr))}, ${ur(JSON.stringify(l))})`}})}zl.displayName="ScrollRestoration";function wn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function zt(e){let t=f.useContext(Be);return A(t,wn(e)),t}function En(e){let t=f.useContext(Ge);return A(t,wn(e)),t}function Hl(e,{target:t,replace:r,state:a,preventScrollReset:n,relative:o,viewTransition:i,unstable_defaultShouldRevalidate:l,unstable_useTransitions:s}={}){let u=Ya(),h=Re(),c=ht(e,{relative:o});return f.useCallback(m=>{if(Mi(m,t)){m.preventDefault();let y=r!==void 0?r:xe(h)===xe(c),R=()=>u(e,{replace:y,state:a,preventScrollReset:n,relative:o,viewTransition:i,unstable_defaultShouldRevalidate:l});s?f.startTransition(()=>R()):R()}},[h,u,c,r,a,t,e,n,o,i,l,s])}function hs(e){G(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=f.useRef(lr(e)),r=f.useRef(!1),a=Re(),n=f.useMemo(()=>Di(a.search,r.current?null:t.current),[a.search]),o=Ya(),i=f.useCallback((l,s)=>{const u=lr(typeof l=="function"?l(new URLSearchParams(n)):l);r.current=!0,o("?"+u,s)},[o,n]);return[n,i]}var Bl=0,Wl=()=>`__${String(++Bl)}__`;function Rn(){let{router:e}=zt("useSubmit"),{basename:t}=f.useContext(ce),r=fi(),a=e.fetch,n=e.navigate;return f.useCallback(async(o,i={})=>{let{action:l,method:s,encType:u,formData:h,body:c}=Fi(o,t);if(i.navigate===!1){let m=i.fetcherKey||Wl();await a(m,r,i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:h,body:c,formMethod:i.method||s,formEncType:i.encType||u,flushSync:i.flushSync})}else await n(i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:h,body:c,formMethod:i.method||s,formEncType:i.encType||u,replace:i.replace,state:i.state,fromRouteId:r,flushSync:i.flushSync,viewTransition:i.viewTransition})},[a,n,t,r])}function Vl(e,{relative:t}={}){let{basename:r}=f.useContext(ce),a=f.useContext(we);A(a,"useFormAction must be used inside a RouteContext");let[n]=a.matches.slice(-1),o={...ht(e||".",{relative:t})},i=Re();if(e==null){o.search=i.search;let l=new URLSearchParams(o.search),s=l.getAll("index");if(s.some(h=>h==="")){l.delete("index"),s.filter(c=>c).forEach(c=>l.append("index",c));let h=l.toString();o.search=h?`?${h}`:""}}return(!e||e===".")&&n.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:Se([r,o.pathname])),xe(o)}function ms({key:e}={}){let{router:t}=zt("useFetcher"),r=En("useFetcher"),a=f.useContext(wr),n=f.useContext(we),o=n.matches[n.matches.length-1]?.route.id;A(a,"useFetcher must be used inside a FetchersContext"),A(n,"useFetcher must be used inside a RouteContext"),A(o!=null,'useFetcher can only be used on routes that contain a unique "id"');let i=f.useId(),[l,s]=f.useState(e||i);e&&e!==l&&s(e);let{deleteFetcher:u,getFetcher:h,resetFetcher:c,fetch:m}=t;f.useEffect(()=>(h(l),()=>u(l)),[u,h,l]);let y=f.useCallback(async(C,O)=>{A(o,"No routeId available for fetcher.load()"),await m(l,o,C,O)},[l,o,m]),R=Rn(),b=f.useCallback(async(C,O)=>{await R(C,{...O,navigate:!1,fetcherKey:l})},[l,R]),w=f.useCallback(C=>c(l,C),[c,l]),x=f.useMemo(()=>{let C=f.forwardRef((O,v)=>f.createElement(gn,{...O,navigate:!1,fetcherKey:l,ref:v}));return C.displayName="fetcher.Form",C},[l]),E=r.fetchers.get(l)||Fa,P=a.get(l);return f.useMemo(()=>({Form:x,submit:b,load:y,reset:w,...E,data:P}),[x,b,y,w,E,P])}var fr="react-router-scroll-positions",Ct={};function hr(e,t,r,a){let n=null;return a&&(r!=="/"?n=a({...e,pathname:he(e.pathname,r)||e.pathname},t):n=a(e,t)),n==null&&(n=e.key),n}function Yl({getKey:e,storageKey:t}={}){let{router:r}=zt("useScrollRestoration"),{restoreScrollPosition:a,preventScrollReset:n}=En("useScrollRestoration"),{basename:o}=f.useContext(ce),i=Re(),l=br(),s=hi();f.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),Jl(f.useCallback(()=>{if(s.state==="idle"){let u=hr(i,l,o,e);Ct[u]=window.scrollY}try{sessionStorage.setItem(t||fr,JSON.stringify(Ct))}catch(u){G(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${u}).`)}window.history.scrollRestoration="auto"},[s.state,e,o,i,l,t])),typeof document<"u"&&(f.useLayoutEffect(()=>{try{let u=sessionStorage.getItem(t||fr);u&&(Ct=JSON.parse(u))}catch{}},[t]),f.useLayoutEffect(()=>{let u=r?.enableScrollRestoration(Ct,()=>window.scrollY,e?(h,c)=>hr(h,c,o,e):void 0);return()=>u&&u()},[r,o,e]),f.useLayoutEffect(()=>{if(a!==!1){if(typeof a=="number"){window.scrollTo(0,a);return}try{if(i.hash){let u=document.getElementById(decodeURIComponent(i.hash.slice(1)));if(u){u.scrollIntoView();return}}}catch{G(!1,`"${i.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}n!==!0&&window.scrollTo(0,0)}},[i,a,n]))}function Jl(e,t){let{capture:r}={};f.useEffect(()=>{let a=r!=null?{capture:r}:void 0;return window.addEventListener("pagehide",e,a),()=>{window.removeEventListener("pagehide",e,a)}},[e,r])}function Kl(e,{relative:t}={}){let r=f.useContext(gr);A(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=zt("useViewTransitionState"),n=ht(e,{relative:t});if(!r.isTransitioning)return!1;let o=he(r.currentLocation.pathname,a)||r.currentLocation.pathname,i=he(r.nextLocation.pathname,a)||r.nextLocation.pathname;return Ft(n.pathname,i)!=null||Ft(n.pathname,o)!=null}export{Ul as A,Re as B,Ne as E,gn as F,vn as L,ds as M,al as N,as as O,fs as R,zl as S,Ql as a,hs as b,Qa as c,Ya as d,A as e,us as f,Ut as g,rs as h,He as i,fl as j,Pr as k,ql as l,De as m,ss as n,is as o,Xl as p,ls as q,es as r,xl as s,ts as t,ms as u,os as v,ns as w,cs as x,$l as y,Zl as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(n,o){if(n){if(typeof n=="string"){o.push(n);return}if(Array.isArray(n)){for(const r of n)e(r,o);return}for(const[r,f]of Object.entries(n))f&&o.push(r)}}function t(...n){const o=[];for(const r of n)e(r,o);return o.join(" ")}export{t as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{w as r,c as l,L as c,F as m}from"./chunk-EPOLDU6W-B-j6nV8T.js";import{j as e}from"./files.browse-9p4xl9MV.js";import{a as n,S as o}from"./auth-shell-FEL5QDuP.js";import"./safe-area.module-CwCzHS6V.js";const h=r(function({loaderData:s}){const i=l(),t=s.enrollment,a=t&&t.expiresAt<=new Date().toISOString();return!t||t.status!=="pending"||t.consumedAt||a?e.jsx(n,{title:"That enrollment is no longer available",copy:"Pending registrations are intentionally short-lived. Start again from registration and use the newest console code.",footer:e.jsx(c,{className:"underline underline-offset-4",to:"/register",children:"Register a passkey"}),children:e.jsx(o,{message:null})}):e.jsxs(n,{title:`Activate ${t.label}`,copy:"Check the server console for the one-time confirmation code (expires in 10 minutes).",children:[e.jsxs(m,{className:"space-y-4",method:"post",children:[e.jsx("input",{name:"enrollmentId",type:"hidden",value:s.enrollmentId}),e.jsxs("label",{className:"block space-y-2",children:[e.jsx("span",{className:"text-sm uppercase tracking-[0.08em]",children:"Confirmation code"}),e.jsx("input",{autoComplete:"one-time-code",className:"min-h-11 w-full bg-white px-0 py-2 font-mono text-base uppercase tracking-[0.12em] text-black focus-visible:outline-2 focus-visible:outline-black focus-visible:outline-offset-2",name:"code",placeholder:"AB12-CD34",required:!0})]}),e.jsx("button",{className:"inline-flex min-h-11 w-full items-center justify-center bg-black px-3 py-2 text-base text-white sm:w-auto",type:"submit",children:"Activate passkey"})]}),e.jsx(o,{message:i?.error??null})]})});export{h as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as l,r as u,j as p}from"./files.browse-9p4xl9MV.js";import{r as E,c as R}from"./index-8zQ7Fizv.js";import{m as x,s as g,E as S,N as _,i as v,e as y,f as D,g as M,R as b,h as C,j as P,k,l as F,n as L,o as T,p as H,q as I,r as z,t as O}from"./chunk-EPOLDU6W-B-j6nV8T.js";[..._];new TextEncoder;(class extends l.Component{constructor(t){super(t),this.state={error:null,location:t.location}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,o){return o.location!==t.location?{error:null,location:t.location}:{error:o.error,location:o.location}}render(){return this.state.error?l.createElement(j,{error:this.state.error,renderAppShell:!0}):this.props.children}});function h({renderAppShell:t,title:o,children:a}){return t?l.createElement("html",{lang:"en"},l.createElement("head",null,l.createElement("meta",{charSet:"utf-8"}),l.createElement("meta",{name:"viewport",content:"width=device-width,initial-scale=1,viewport-fit=cover"}),l.createElement("title",null,o)),l.createElement("body",null,l.createElement("main",{style:{fontFamily:"system-ui, sans-serif",padding:"2rem"}},a))):a}function j({error:t,renderAppShell:o}){console.error(t);let a=l.createElement("script",{dangerouslySetInnerHTML:{__html:`
|
|
2
|
+
console.log(
|
|
3
|
+
"💿 Hey developer 👋. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information."
|
|
4
|
+
);
|
|
5
|
+
`}});if(v(t))return l.createElement(h,{renderAppShell:o,title:"Unhandled Thrown Response!"},l.createElement("h1",{style:{fontSize:"24px"}},t.status," ",t.statusText),a);let n;if(t instanceof Error)n=t;else{let r=t==null?"Unknown Error":typeof t=="object"&&"toString"in t?t.toString():JSON.stringify(t);n=new Error(r)}return l.createElement(h,{renderAppShell:o,title:"Application Error!"},l.createElement("h1",{style:{fontSize:"24px"}},"Application Error"),l.createElement("pre",{style:{padding:"2rem",background:"hsla(10, 50%, 50%, 0.1)",color:"red",overflow:"auto"}},n.stack),a)}function N(t){if(!t)return null;let o=Object.entries(t),a={};for(let[n,r]of o)if(r&&r.__type==="RouteErrorResponse")a[n]=new S(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type==="Error"){if(r.__subType){let i=window[r.__subType];if(typeof i=="function")try{let s=new i(r.message);s.stack=r.stack,a[n]=s}catch{}}if(a[n]==null){let i=new Error(r.message);i.stack=r.stack,a[n]=i}}else a[n]=r;return a}function A({state:t,routes:o,getRouteInfo:a,location:n,basename:r,isSpaMode:i}){let s={...t,loaderData:{...t.loaderData}},c=x(o,n,r);if(c)for(let w of c){let m=w.route.id,d=a(m);g(m,d.clientLoader,d.hasLoader,i)&&(d.hasHydrateFallback||!d.hasLoader)?delete s.loaderData[m]:d.hasLoader||(s.loaderData[m]=null)}return s}function B(t){return u.createElement(C,{flushSync:E.flushSync,...t})}var e=null,f=null;function U(){if(!e&&window.__reactRouterContext&&window.__reactRouterManifest&&window.__reactRouterRouteModules){if(window.__reactRouterManifest.sri===!0){const t=document.querySelector("script[rr-importmap]");if(t?.textContent)try{window.__reactRouterManifest.sri=JSON.parse(t.textContent).integrity}catch(o){console.error("Failed to parse import map",o)}}e={context:window.__reactRouterContext,manifest:window.__reactRouterManifest,routeModules:window.__reactRouterRouteModules,stateDecodingPromise:void 0,router:void 0,routerInitialized:!1}}}function q({getContext:t,unstable_instrumentations:o}){if(U(),!e)throw new Error("You must be using the SSR features of React Router in order to skip passing a `router` prop to `<RouterProvider>`");let a=e;if(!e.stateDecodingPromise){let s=e.context.stream;y(s,"No stream found for single fetch decoding"),e.context.stream=void 0,e.stateDecodingPromise=P(s,window).then(c=>{e.context.state=c.value,a.stateDecodingPromise.value=!0}).catch(c=>{a.stateDecodingPromise.error=c})}if(e.stateDecodingPromise.error)throw e.stateDecodingPromise.error;if(!e.stateDecodingPromise.value)throw e.stateDecodingPromise;let n=k(e.manifest.routes,e.routeModules,e.context.state,e.context.ssr,e.context.isSpaMode),r;if(e.context.isSpaMode){let{loaderData:s}=e.context.state;e.manifest.routes.root?.hasLoader&&s&&"root"in s&&(r={loaderData:{root:s.root}})}else r=A({state:e.context.state,routes:n,getRouteInfo:s=>({clientLoader:e.routeModules[s]?.clientLoader,hasLoader:e.manifest.routes[s]?.hasLoader===!0,hasHydrateFallback:e.routeModules[s]?.HydrateFallback!=null}),location:window.location,basename:window.__reactRouterContext?.basename,isSpaMode:e.context.isSpaMode}),r&&r.errors&&(r.errors=N(r.errors));let i=F({routes:n,history:H(),basename:e.context.basename,getContext:t,hydrationData:r,hydrationRouteProperties:O,unstable_instrumentations:o,mapRouteProperties:z,future:{middleware:e.context.future.v8_middleware},dataStrategy:T(()=>i,e.manifest,e.routeModules,e.context.ssr,e.context.basename,e.context.future.unstable_trailingSlashAwareDataRequests),patchRoutesOnNavigation:L(e.manifest,e.routeModules,e.context.ssr,e.context.routeDiscovery,e.context.isSpaMode,e.context.basename)});return e.router=i,i.state.initialized&&(e.routerInitialized=!0,i.initialize()),i.createRoutesForHMR=I,window.__reactRouterDataRouter=i,i}function W(t){f||(f=q({getContext:t.getContext,unstable_instrumentations:t.unstable_instrumentations}));let[o,a]=u.useState(void 0);u.useEffect(()=>{},[]),u.useEffect(()=>{},[o]);let[n,r]=u.useState(f.state.location);return u.useLayoutEffect(()=>{e&&e.router&&!e.routerInitialized&&(e.routerInitialized=!0,e.router.initialize())},[]),u.useLayoutEffect(()=>{if(e&&e.router)return e.router.subscribe(i=>{i.location!==n&&r(i.location)})},[n]),y(e,"ssrInfo unavailable for HydratedRouter"),D(f,e.manifest,e.routeModules,e.context.ssr,e.context.routeDiscovery,e.context.isSpaMode),u.createElement(u.Fragment,null,u.createElement(M.Provider,{value:{manifest:e.manifest,routeModules:e.routeModules,future:e.context.future,criticalCss:o,ssr:e.context.ssr,isSpaMode:e.context.isSpaMode,routeDiscovery:e.context.routeDiscovery}},u.createElement(b,{location:n},u.createElement(B,{router:f,unstable_useTransitions:t.unstable_useTransitions,onError:t.onError}))),u.createElement(u.Fragment,null))}u.startTransition(()=>{R.hydrateRoot(document,p.jsx(u.StrictMode,{children:p.jsx(W,{})}))});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as j,j as e}from"./files.browse-9p4xl9MV.js";function N(n){return n.split("/").filter(Boolean).at(-1)||n}function D({currentPath:n,parentPath:d,entries:x,selectionMode:a="either",label:m,name:u,value:c=null,selectedPath:i,isLoading:p=!1,onBrowseTo:o,onSelectionChange:f,emptyLabel:y="This folder is empty.",getItemPrefix:l,getItemDescription:k}){const w=a==="directory"||a==="either",[S,r]=j.useState(c?{path:c,type:"directory",name:N(c)}:null);j.useEffect(()=>{const s=i??c;if(!s){r(null);return}r({path:s,type:"directory",name:N(s)})},[i,c]);const h=i!==void 0?i:S?.path??null,C=w?n:h??"";function E(s){r(s),f?.(s)}return e.jsxs("section",{className:"space-y-3",children:[m?e.jsx("p",{className:"text-sm uppercase tracking-[0.08em]",children:m}):null,u?e.jsx("input",{name:u,type:"hidden",value:C}):null,e.jsx("div",{role:"listbox",children:e.jsxs("ul",{className:"space-y-1",children:[d?e.jsx("li",{children:e.jsx("button",{className:"block min-h-9 w-full px-3 py-1 text-left text-base disabled:opacity-25",disabled:p,onClick:()=>o?.(d),type:"button",children:e.jsx("p",{className:"truncate",children:"../"})})}):null,x.length?x.map(s=>{const g=a==="either"||a==="directory"&&s.type==="directory"||a==="file"&&s.type==="file",b=h===s.path,t=k?.(s);return e.jsx("li",{className:b?"border-l-4 border-l-black font-bold":"",children:s.type==="directory"?e.jsxs("button",{className:"block min-h-9 w-full px-3 py-1 text-left text-base disabled:opacity-25",disabled:p,onClick:()=>o?.(s.path),type:"button",children:[e.jsxs("p",{className:"flex min-w-0 items-baseline gap-2 truncate",children:[l?.(s)?e.jsx("span",{className:"w-5 shrink-0",children:l(s)}):null,e.jsxs("span",{className:"truncate",children:[s.name,"/"]})]}),t?e.jsx("p",{className:"truncate text-sm opacity-60",children:t}):null]}):g?e.jsxs("button",{className:`block min-h-9 w-full px-3 py-1 text-left text-base disabled:opacity-25 ${b?"bg-black text-white":""}`,disabled:p,onClick:()=>E({name:s.name,path:s.path,type:s.type}),type:"button",children:[e.jsxs("p",{className:"flex min-w-0 items-baseline gap-2 truncate",children:[l?.(s)?e.jsx("span",{className:"w-5 shrink-0",children:l(s)}):null,e.jsx("span",{className:"truncate",children:s.name})]}),t?e.jsx("p",{className:"truncate text-sm opacity-60",children:t}):null]}):e.jsxs("div",{className:"px-3 py-1",children:[e.jsxs("p",{className:"flex min-w-0 items-baseline gap-2 truncate text-base",children:[l?.(s)?e.jsx("span",{className:"w-5 shrink-0",children:l(s)}):null,e.jsx("span",{className:"truncate",children:s.name})]}),t?e.jsx("p",{className:"truncate text-sm opacity-60",children:t}):null]})},s.path)}):e.jsx("li",{className:"min-h-11 px-3 py-2 text-base",children:p?"Loading directory...":y})]})})]})}export{D as S};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{w as a}from"./chunk-EPOLDU6W-B-j6nV8T.js";import{j as m}from"./files.browse-9p4xl9MV.js";import{F as c}from"./files-browser-KNurSsen.js";import{d as l}from"./route-handle-DcEil3NY.js";import{g as p}from"./instance-route-C25LRYYo.js";import"./iconify-BDcX0yw8.js";import"./scroll-indicator-CFaTM_rb.js";import"./cn-Kn7NbJqM.js";import"./file-list-DBDZbrBp.js";import"./scrollable-layout-CS-vPTNM.js";const P=l({title:({data:e,params:t})=>[...p(e?.instance?.name,t.instanceId),{label:"files"}]}),R=a(function({loaderData:t}){const{instance:o,listing:r,selected:s,selectedError:i,selectedPath:n}=t;return m.jsx(c,{listing:r,rootPath:o.directory,selected:s,selectedError:i,selectedPath:n})});export{R as default,P as handle};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,r as f}from"./files.browse-9p4xl9MV.js";import{b as F}from"./chunk-EPOLDU6W-B-j6nV8T.js";import{I as p}from"./iconify-BDcX0yw8.js";import{C as g,L as k,S as y,a as R}from"./scroll-indicator-CFaTM_rb.js";import{S as v}from"./file-list-DBDZbrBp.js";import{S as j}from"./scrollable-layout-CS-vPTNM.js";function C(n){const t=Math.min(n.start,n.end),s=Math.max(n.start,n.end);return t===s?`${t}`:`${t}-${s}`}function I({onClear:n,onInsert:t,range:s}){return e.jsxs("div",{className:"pointer-events-auto inline-flex items-center gap-0 bg-white",children:[e.jsx("button",{"aria-label":"Insert selected line reference",className:"inline-flex min-h-11 min-w-11 items-center justify-center bg-black text-white",onClick:t,type:"button",children:e.jsx(p,{className:"size-5",icon:"mdi:arrow-down"})}),e.jsx("button",{"aria-label":"Clear selected lines",className:"inline-flex min-h-11 min-w-11 items-center justify-center border-2 border-black bg-white",onClick:n,type:"button",children:e.jsx(p,{className:"size-5",icon:"mdi:close"})}),e.jsx("span",{className:"inline-flex min-h-11 items-center border-2 border-l-0 border-black px-3 text-sm leading-6",children:C(s)})]})}function $({children:n,onInsert:t}){const[s,i]=f.useState(null),[c,l]=f.useState(null),[u,o]=f.useState(null),d=()=>{i(null),l(null),o(null)},m=r=>{if(!s){i(r),l(r.currentFileLine===null?null:{start:r.currentFileLine,end:r.currentFileLine}),o({start:r.rowIndex,end:r.rowIndex});return}l(s.currentFileLine===null||r.currentFileLine===null?null:{start:s.currentFileLine,end:r.currentFileLine}),o({start:s.rowIndex,end:r.rowIndex})},x=()=>{!t||!c||(t(c),d())};return e.jsxs("div",{className:"relative flex min-h-0 min-w-0 flex-1",children:[n({onSelectLine:m,selectedRowRange:u}),!!c&&e.jsx("div",{className:"pointer-events-none absolute bottom-4 left-8 z-10",children:e.jsx(I,{onClear:d,onInsert:x,range:c})})]})}function b(n,t){return t===n?".":t.startsWith(`${n}/`)?t.slice(n.length+1):t}function B(n,t){const s=Math.min(t.start,t.end),i=Math.max(t.start,t.end);return s===i?`@${n}:${s}`:`@${n}:${s}-${i}`}function M({label:n,onBack:t}){return e.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-2",children:[e.jsx("button",{"aria-label":"Back to workspace files",className:"inline-flex min-h-11 min-w-11 items-center justify-center",onClick:t,type:"button",children:e.jsx(p,{className:"size-5",icon:"mdi:arrow-left"})}),e.jsx("p",{className:"text-base font-bold break-all",children:n})]})}function z({path:n}){return e.jsx("div",{className:"grid min-h-11 w-full grid-cols-[1fr] items-center gap-3",children:e.jsx("p",{className:"truncate text-base font-bold",children:n})})}function V({listing:n,onInsertReference:t,rootPath:s,selected:i,selectedError:c,selectedPath:l}){const[u,o]=F();function d(r){const a=new URLSearchParams(u);a.set("path",r),a.delete("file"),o(a)}function m(r){const a=new URLSearchParams(u);a.set("path",n.currentPath),r?a.set("file",r):a.delete("file"),o(a)}function x(){m(null)}return l?e.jsx(j,{header:e.jsx(M,{label:i?b(s,i.path):l,onBack:x}),children:c?e.jsx("p",{className:"text-base leading-6",children:c}):i?.binary?e.jsx("p",{className:"text-base leading-6",children:"This file cannot be previewed as text."}):i?e.jsx(g,{children:e.jsx(k,{content:i.content,fileName:i.name,children:({changeMarkers:r,highlightedLines:a,lines:w})=>e.jsx(y,{changeMarkers:r,mode:"text",children:({indicator:L,scrollPaneRef:S})=>e.jsxs(e.Fragment,{children:[e.jsx($,{onInsert:h=>{t&&t(B(b(s,i.path),h))},children:({onSelectLine:h,selectedRowRange:N})=>e.jsx(R,{highlightedLines:a,lines:w,mode:"text",onSelectLine:h,scrollPaneRef:S,selectedRowRange:N??null,showDualGutters:!1,showLineNumbers:!0,showDiffMarkers:!0})},l),L]})})})}):e.jsx("p",{className:"text-base leading-6",children:"No file content is available for this selection."})}):e.jsx(j,{header:e.jsx(z,{path:b(s,n.currentPath)}),children:e.jsx("section",{className:"space-y-8 pr-1",children:e.jsx(v,{currentPath:n.currentPath,entries:n.entries,emptyLabel:"This folder is empty.",onBrowseTo:d,onSelectionChange:r=>m(r?.path??null),parentPath:n.parentPath,selectedPath:l,selectionMode:"either"})})})}export{V as F,$ as L,B as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{w as m,a as c}from"./chunk-EPOLDU6W-B-j6nV8T.js";import{j as p}from"./files.browse-9p4xl9MV.js";import{F as d}from"./files-browser-KNurSsen.js";import{d as l}from"./route-handle-DcEil3NY.js";import{g as u}from"./session-route-oxi4s_Qg.js";import"./iconify-BDcX0yw8.js";import"./scroll-indicator-CFaTM_rb.js";import"./cn-Kn7NbJqM.js";import"./file-list-DBDZbrBp.js";import"./scrollable-layout-CS-vPTNM.js";const P=l({title:e=>{const s=e.requireMatch("routes/_app/instances.$instanceId/sessions.$sessionId/_layout");return[...u({instanceId:s.params.instanceId,instanceName:s.data.instance?.name,session:s.data.session,sessionId:s.params.sessionId}),{label:"files"}]}}),b=m(function({loaderData:s}){const{insertComposerReference:t}=c(),{instance:o,listing:n,selected:r,selectedError:i,selectedPath:a}=s;return p.jsx(d,{listing:n,onInsertReference:t,rootPath:o.directory,selected:r,selectedError:i,selectedPath:a})});export{b as default,P as handle};
|