diff --git a/docs/react-migration-prd.md b/docs/react-migration-prd.md index caa8d16..3549ac0 100644 --- a/docs/react-migration-prd.md +++ b/docs/react-migration-prd.md @@ -39,10 +39,15 @@ blockers in §Status at the bottom. details; never expect or display human actor emails from the heat API. 4. **Never commit `internal/webapp/manual_serve_test.go`** (untracked local demo harness). Check `git status` before every commit. -5. Runtime deps allowed: `react`, `react-dom`, `react-router-dom`, - `@tanstack/react-query`. Anything beyond these requires updating this - PRD with a justification first. Dev deps: `vite`, `typescript`, - `@vitejs/plugin-react`, `@playwright/test` (+ types). +5. Runtime deps allowed: `react`, `react-dom`, `@tanstack/react-query`. + (`react-router-dom` was allowed, adopted, then REMOVED in Phase 3: v7 + wraps navigation in React.startTransition, which left the old view on + screen for seconds after the URL changed. Routing is `src/nav.ts` — a + ~40-line synchronous history router — plus the hand-ported `parseRoute` + in `src/router.ts`. Do not reintroduce a router library.) Anything + beyond these requires updating this PRD with a justification first. + Dev deps: `vite`, `typescript`, `@vitejs/plugin-react`, + `@playwright/test` (+ types). ## Toolchain & layout @@ -160,16 +165,25 @@ refresh; invalidate after uploads/renames/admin actions — mirror today's form logins trip it with flaky timeouts. ### Phase 3 — project home, insights, history -- [ ] Project home at `/`: connect guide (3 tabs: "Claude Code & +- [x] Project home at `/`: connect guide (3 tabs: "Claude Code & Cowork" plugin flow, Hermes CLI, Codex CLI; copy buttons; persisted - tab; commands pre-filled with hub origin + project id). -- [ ] Insights embedded below the guide for admins/org-owners only - (`canSeeInsights` logic), plus dedicated `/insights` route. -- [ ] Insights views: treemap (squarify), device matrix, chart, hot-path - list — visually equivalent. -- [ ] History view: `?path=`/`?prefix=` modes, newest-first entries, blob - version links, device attribution. -- [ ] Vault-name click returns to project home. + tab with stale-value fallback; commands pre-filled with hub origin + + project id). +- [x] Insights embedded below the guide for admins/org-owners only + (`canInsights` = hub admin or project-org owner), plus dedicated + `/insights` route; members see neither. +- [x] Insights views: squarified treemap, reads×freshness scatter with + danger quadrant, hot-path list with agent/human split, agent + coverage matrix — math ported as-is into JSX SVG. +- [x] History view: whole-project / subtree (`prefix`) / per-file (`path`) + modes, newest first, add/edit/delete tags, device attribution, + expandable linkified notes; folder listings link into the subtree + feed. (Blob version links remain server-side; the classic app had + no version-viewer UI either.) +- [x] Vault-name click returns to project home. + NOTE (structural, discovered here): react-router-dom removed — see + invariant 5. The original 17 parity checks are ported in + `e2e/home.spec.ts`; suite is 34 specs, ~13s, stable across runs. ### Phase 4 — admin surfaces - [ ] Org admin: rename, members (role change/remove), invite create/list/ @@ -238,7 +252,7 @@ file path; reload on `/insights`. - [x] Phase 0 - [x] Phase 1 - [x] Phase 2 -- [ ] Phase 3 +- [x] Phase 3 - [ ] Phase 4 - [ ] Phase 5 diff --git a/internal/webapp/frontend/e2e/home.spec.ts b/internal/webapp/frontend/e2e/home.spec.ts new file mode 100644 index 0000000..2b291c6 --- /dev/null +++ b/internal/webapp/frontend/e2e/home.spec.ts @@ -0,0 +1,153 @@ +import { test, expect } from "@playwright/test"; +import { login, wikiId, MEMBER } from "./helpers"; + +// Phase 3: project home (connect guide + embedded insights), the dedicated +// insights route, and the history views. Ports the original parity checks +// from the pre-migration smoke suite. + +test("landing is the project home (guide), not an insights redirect", async ({ page }) => { + await login(page); + const pid = await wikiId(page); + await page.waitForURL("/" + pid); + await expect(page.locator(".guide")).toBeVisible(); + await expect(page.locator("#crumb")).toHaveText("wiki"); +}); + +test("guide: three agent tabs, one active, choice persisted", async ({ page }) => { + await login(page); + await page.waitForSelector(".guide"); + await expect(page.locator(".gd-tab")).toHaveText(["Claude Code & Cowork", "Hermes", "Codex"]); + await expect(page.locator(".gd-tab.active")).toHaveCount(1); + await page.click('.gd-tab[data-key="codex"]'); + expect(await page.evaluate(() => localStorage.getItem("bdrive-guide-agent"))).toBe("codex"); + await page.click('.gd-tab[data-key="claude"]'); +}); + +test("claude tab: plugin flow with real hub origin and project id, no raw CLI", async ({ page }) => { + await login(page); + const pid = await wikiId(page); + await page.click('.gd-tab[data-key="claude"]'); + const codes = await page.$$eval(".gd-code code", (els) => els.map((e) => e.textContent).join("\n")); + expect(codes).toContain("/plugin marketplace add runbear-io/beardrive"); + expect(codes).toContain("/plugin install beardrive@beardrive"); + expect(codes).toContain(`/beardrive:install connect to http://localhost:8993, project ${pid}`); + expect(codes).not.toContain("brew install"); + expect(codes).not.toContain("hooks install"); + await expect(page.locator(".gd-body")).toContainText("Cowork"); +}); + +test("codex tab keeps the full CLI flow", async ({ page }) => { + await login(page); + const pid = await wikiId(page); + await page.click('.gd-tab[data-key="codex"]'); + const codes = await page.$$eval(".gd-code code", (els) => els.map((e) => e.textContent).join("\n")); + expect(codes).toContain("brew install runbear-io/tap/beardrive"); + expect(codes).toContain("bdrive login http://localhost:8993"); + expect(codes).toContain(`bdrive init --project ${pid}`); + expect(codes).toContain("bdrive hooks install --agent codex"); + await page.click('.gd-tab[data-key="claude"]'); +}); + +test("a stale saved tab choice falls back to the first tab", async ({ page }) => { + await login(page); + await page.waitForSelector(".guide"); + await page.evaluate(() => localStorage.setItem("bdrive-guide-agent", "cowork")); + await page.reload(); + await page.waitForSelector(".guide"); + await expect(page.locator(".gd-tab.active")).toHaveText("Claude Code & Cowork"); + await page.evaluate(() => localStorage.setItem("bdrive-guide-agent", "claude")); +}); + +test("admin home embeds insights below the guide; member home does not", async ({ page, browser }) => { + await login(page); + await page.waitForSelector(".guide"); + await expect(page.locator(".home-insights .insights")).toBeVisible(); + // Guide renders above the embedded insights + const order = await page.evaluate(() => { + const g = document.querySelector(".guide"); + const i = document.querySelector(".home-insights"); + return g && i ? (g.compareDocumentPosition(i) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0 : false; + }); + expect(order).toBe(true); + await expect(page.locator(".in-treemap")).toBeVisible(); + await expect(page.locator(".in-hotpath .in-hp-row").first()).toBeVisible(); + + const ctx = await browser.newContext(); + const p2 = await ctx.newPage(); + await login(p2, MEMBER); + await p2.waitForSelector(".guide"); + await expect(p2.locator(".home-insights")).toHaveCount(0); + await ctx.close(); +}); + +test("dedicated insights route still works and survives reload", async ({ page }) => { + await login(page); + const pid = await wikiId(page); + await page.goto(`/${pid}/insights`); + await expect(page.locator("#crumb")).toHaveText("Insights — wiki"); + await expect(page.locator(".in-treemap")).toBeVisible(); + await page.reload(); + await expect(page.locator(".in-treemap")).toBeVisible(); +}); + +test("hot path row opens the file", async ({ page }) => { + await login(page); + const pid = await wikiId(page); + await page.goto(`/${pid}/insights`); + await page.click(".in-hp-row:first-child"); + await page.waitForURL(/\/(index|guide)\.md$/); + await expect(page.locator("#content h1")).toBeVisible(); +}); + +test("vault name returns to the project home", async ({ page }) => { + await login(page); + const pid = await wikiId(page); + await page.goto(`/${pid}/index.md`); + await page.click("#vault-name"); + await page.waitForURL("/" + pid); + await expect(page.locator(".guide")).toBeVisible(); +}); + +test("back/forward walks home → file → insights", async ({ page }) => { + await login(page); + const pid = await wikiId(page); + await page.waitForURL("/" + pid); + await page.click('#tree .row[data-path="index.md"]'); + await page.waitForURL(`/${pid}/index.md`); + await page.goto(`/${pid}/insights`); + await page.goBack(); + await expect(page.locator("#content h1")).toHaveText("Wiki"); + await page.goBack(); + await expect(page.locator(".guide")).toBeVisible(); + await page.goForward(); + await expect(page.locator("#content h1")).toHaveText("Wiki"); +}); + +test("history: whole project, newest first, and per-file versions", async ({ page }) => { + await login(page); + const pid = await wikiId(page); + await page.click("#history-btn"); // from home: whole project + await page.waitForURL(`/${pid}/history`); + await expect(page.locator("#crumb")).toContainText("History — all changes"); + await expect(page.locator(".history .hentry").first()).toBeVisible(); + expect(await page.locator(".history .hentry").count()).toBeGreaterThanOrEqual(6); // all seeded ops + // guide.md has two versions + await page.goto(`/${pid}/history/guide.md`); + await expect(page.locator("#crumb")).toContainText("History — guide.md"); + await expect(page.locator(".history .hentry")).toHaveCount(2); + await expect(page.locator(".history .hentry").first()).toContainText("edited"); + // clicking an entry opens the file + await page.click(".history .hentry.clickable >> nth=0"); + await page.waitForURL(`/${pid}/guide.md`); +}); + +test("folder listing's Full history goes to the subtree feed", async ({ page }) => { + await login(page); + const pid = await wikiId(page); + await page.goto(`/${pid}/notes`); + await page.click(".dl-more"); + await page.waitForURL(`/${pid}/history/notes`); + await expect(page.locator("#crumb")).toContainText("History — notes/ (folder)"); + const paths = await page.$$eval(".history .hpath", (els) => els.map((e) => e.textContent)); + for (const p of paths) expect(p).toContain("notes/"); +}); diff --git a/internal/webapp/frontend/package-lock.json b/internal/webapp/frontend/package-lock.json index e3abb46..ca61e98 100644 --- a/internal/webapp/frontend/package-lock.json +++ b/internal/webapp/frontend/package-lock.json @@ -10,8 +10,7 @@ "dependencies": { "@tanstack/react-query": "^5.90.0", "react": "^19.2.0", - "react-dom": "^19.2.0", - "react-router-dom": "^7.9.0" + "react-dom": "^19.2.0" }, "devDependencies": { "@playwright/test": "1.61.1", @@ -1363,19 +1362,6 @@ "dev": true, "license": "MIT" }, - "node_modules/cookie": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz", - "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==", - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" - } - }, "node_modules/csstype": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", @@ -1694,44 +1680,6 @@ "node": ">=0.10.0" } }, - "node_modules/react-router": { - "version": "7.18.1", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.18.1.tgz", - "integrity": "sha512-GDLgg3i3uM0aeJO3Fm+TCS+sDQ7gu12T6x0qdTEzcwqEfleci7JwugVNIF3U//0FWKnJT7ptG+20B2jfDqnZAg==", - "license": "MIT", - "dependencies": { - "cookie": "^1.0.1", - "set-cookie-parser": "^2.6.0" - }, - "engines": { - "node": ">=20.0.0" - }, - "peerDependencies": { - "react": ">=18", - "react-dom": ">=18" - }, - "peerDependenciesMeta": { - "react-dom": { - "optional": true - } - } - }, - "node_modules/react-router-dom": { - "version": "7.18.1", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.18.1.tgz", - "integrity": "sha512-KaZh+X/6UtEp28x51AUYZDMg9NGoz2ja3dNHa+ta/tk40vCzKhQ/RypCWBMLbmDr6//E24Vv5uPsrqXFozdkAg==", - "license": "MIT", - "dependencies": { - "react-router": "7.18.1" - }, - "engines": { - "node": ">=20.0.0" - }, - "peerDependencies": { - "react": ">=18", - "react-dom": ">=18" - } - }, "node_modules/rollup": { "version": "4.62.2", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.62.2.tgz", @@ -1793,12 +1741,6 @@ "semver": "bin/semver.js" } }, - "node_modules/set-cookie-parser": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.2.tgz", - "integrity": "sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==", - "license": "MIT" - }, "node_modules/source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", diff --git a/internal/webapp/frontend/package.json b/internal/webapp/frontend/package.json index 7db8bec..19b3c55 100644 --- a/internal/webapp/frontend/package.json +++ b/internal/webapp/frontend/package.json @@ -11,8 +11,7 @@ "dependencies": { "@tanstack/react-query": "^5.90.0", "react": "^19.2.0", - "react-dom": "^19.2.0", - "react-router-dom": "^7.9.0" + "react-dom": "^19.2.0" }, "devDependencies": { "@playwright/test": "1.61.1", diff --git a/internal/webapp/frontend/src/apps/Browser.tsx b/internal/webapp/frontend/src/apps/Browser.tsx index bb09295..cf415c4 100644 --- a/internal/webapp/frontend/src/apps/Browser.tsx +++ b/internal/webapp/frontend/src/apps/Browser.tsx @@ -5,11 +5,11 @@ import { useState, type ReactNode, } from "react"; -import { useLocation, useNavigate, useNavigationType } from "react-router-dom"; import { useQueryClient } from "@tanstack/react-query"; import type { Project, ServerConfig } from "../api/types"; import { useHeat, useTree } from "../hooks/useBrowse"; import { urlForPath, urlForView, type Route } from "../router"; +import { currentNavType, navigate, useLocationPath } from "../nav"; import { uploadFile } from "../upload"; import { copyText } from "../util"; import { toast } from "../toast"; @@ -20,6 +20,9 @@ import { FolderListing } from "../components/FolderListing"; import { FileView } from "../components/FileView"; import { ShareDialog } from "../components/ShareDialog"; import { Palette, type PaletteItem } from "../components/Palette"; +import { ConnectGuide } from "../components/ConnectGuide"; +import { Insights, useInsightsDevices } from "../components/Insights"; +import { HistoryView, historyTitle } from "../components/HistoryView"; // The browsing surface shared by hub projects and single-volume mode: the // file tree, folder listings, file views, and every topbar action. Sidebar @@ -34,16 +37,21 @@ export default function Browser(props: { projects?: Project[]; canInsights?: boolean; sidebar: { vault: ReactNode; projectsNav?: ReactNode; orgBar?: ReactNode }; - home?: ReactNode; // hub landing view (project home); default prompt otherwise }) { const { config, apiBase, route, hub, project } = props; - const navigate = useNavigate(); - const location = useLocation(); - const navType = useNavigationType(); + const routeKey = useLocationPath(); // scroll memo key, one slot per URL const qc = useQueryClient(); const { tree, flatFiles, dirIndex, loaded } = useTree(apiBase, !hub || !!project); const heatMap = useHeat(apiBase, hub && !!project && !!config.reads?.enabled); + // Insights data: the per-device breakdown, plus a fresh heat fetch when + // an insights surface opens (the ambient heat cache may be a minute old). + const isHome = hub && !!project && !route.path && !route.view; + const insightsOpen = !!props.canInsights && (route.view === "insights" || isHome); + const devices = useInsightsDevices(apiBase, insightsOpen); + useEffect(() => { + if (insightsOpen) qc.invalidateQueries({ queryKey: ["heat", apiBase] }); + }, [insightsOpen, apiBase, qc]); const path = route.path; const isDir = !!path && dirIndex.has(path); @@ -92,21 +100,21 @@ export default function Browser(props: { const scrollGoal = useRef({ key: "", want: 0, attempts: 0 }); useEffect(() => { scrollGoal.current = { - key: location.key, - want: navType === "POP" ? (memo.current.get(location.key) ?? 0) : 0, + key: routeKey, + want: currentNavType() === "POP" ? (memo.current.get(routeKey) ?? 0) : 0, attempts: 0, }; - }, [location.key, navType]); + }, [routeKey]); const onRendered = useCallback(() => { const c = contentRef.current; const g = scrollGoal.current; - if (!c || g.key !== location.key || g.attempts >= 3) return; + if (!c || g.key !== routeKey || g.attempts >= 3) return; g.attempts++; c.scrollTo({ top: g.want, behavior: "instant" }); - }, [location.key]); + }, [routeKey]); const onScroll = useCallback(() => { - if (contentRef.current) memo.current.set(location.key, contentRef.current.scrollTop); - }, [location.key]); + if (contentRef.current) memo.current.set(routeKey, contentRef.current.scrollTop); + }, [routeKey]); /* ---- navigation ---- */ const openPath = useCallback( @@ -114,11 +122,11 @@ export default function Browser(props: { navigate(urlForPath(p, project?.id)); closeSidebarOnMobile(); }, - [navigate, project?.id], + [project?.id], ); const openHistory = useCallback( (target: string) => navigate(urlForView("history", project?.id, target)), - [navigate, project?.id], + [project?.id], ); /* ---- topbar state + actions ---- */ @@ -183,7 +191,7 @@ export default function Browser(props: { useEffect(() => { // Any navigation clears a stale upload status from the meta slot. setUploadStatus(""); - }, [location.key]); + }, [routeKey]); /* ---- ⌘K palette ---- */ useEffect(() => { @@ -221,7 +229,7 @@ export default function Browser(props: { for (const d of dirIndex.keys()) add("folder", d, "folder", () => openPath(d)); for (const f of flatFiles) add("doc", f.path, "file", () => openPath(f.path)); return items; - }, [hub, project, path, isFile, canUpload, config.auth?.enabled, dirIndex, flatFiles, props.projects, shareNow, historyNow, uploadNow, openHistory, openPath, navigate]); + }, [hub, project, path, isFile, canUpload, config.auth?.enabled, dirIndex, flatFiles, props.projects, shareNow, historyNow, uploadNow, openHistory, openPath]); /* ---- "⋯ More" menu (secondary actions on narrow screens) ---- */ useEffect(() => { @@ -232,12 +240,35 @@ export default function Browser(props: { }, [moreOpen]); /* ---- content view ---- */ + const isFolderFn = useCallback((p: string) => dirIndex.has(p), [dirIndex]); let contentClass = "markdown"; let view: ReactNode; - if (route.view === "insights" || route.view === "history") { - // Phase 3 delivers these views. + if (route.view === "insights") { contentClass = "view"; - view =
{route.view} view is on its way.
; + view = props.canInsights ? ( + + ) : ( +
Insights is for hub admins and org owners.
+ ); + } else if (route.view === "history") { + contentClass = "view"; + view = ( + + ); } else if (path) { if (!loaded) { view =
Loading…
; @@ -267,14 +298,40 @@ export default function Browser(props: { /> ); } - } else if (props.home) { + } else if (isHome) { + // The project's index page: the connect-an-agent guide, with Insights + // below for admins/owners. contentClass = "view"; - view = props.home; + view = ( + <> + + {props.canInsights && ( +
+ +
+ )} + + ); } else { view =
Select a file to read it.
; } - const crumb = path ? : null; + const crumb = path ? ( + + ) : route.view === "insights" ? ( + "Insights — " + (project?.name ?? "") + ) : route.view === "history" ? ( + "History — " + historyTitle(route.viewTarget || "", isFolderFn) + ) : isHome ? ( + project!.name + ) : null; const topbar = ( (null); const joinToken = useMemo(() => { - const m = location.pathname.match(/^\/join\/([0-9a-f]+)\/?$/); + const m = pathname.match(/^\/join\/([0-9a-f]+)\/?$/); return m ? m[1] : null; - }, [location.pathname]); + }, [pathname]); const { data: projects } = useProjects(!joinToken); const { data: orgs } = useOrgs(!joinToken); const isAdmin = !!config.auth.admin; const { data: pending } = usePending(isAdmin); - const route = useMemo( - () => parseRoute(location.pathname, "hub"), - [location.pathname], - ); + const route = useMemo(() => parseRoute(pathname, "hub"), [pathname]); const current: Project | null = useMemo(() => { if (!projects) return null; @@ -124,7 +120,7 @@ export default function HubApp({ config }: { config: ServerConfig }) { // Landing ("/") and unknown project ids both resolve to a real project // URL; replace so back/forward never bounces through the redirect. if (route.project !== current.id) { - return ; + return ; } return ( diff --git a/internal/webapp/frontend/src/apps/VolumeApp.tsx b/internal/webapp/frontend/src/apps/VolumeApp.tsx index 9687f19..37f257a 100644 --- a/internal/webapp/frontend/src/apps/VolumeApp.tsx +++ b/internal/webapp/frontend/src/apps/VolumeApp.tsx @@ -1,22 +1,19 @@ import { useEffect, useMemo } from "react"; -import { useLocation } from "react-router-dom"; import type { ServerConfig } from "../api/types"; import { VaultHeader } from "../components/shell"; import { parseRoute } from "../router"; +import { useLocationPath } from "../nav"; import Browser from "./Browser"; // Single-volume mode: one folder, no projects or orgs — but the full // browsing surface (tree, listings, files, upload when enabled). export default function VolumeApp({ config }: { config: ServerConfig }) { - const location = useLocation(); + const pathname = useLocationPath(); const name = config.volume || "BearDrive"; useEffect(() => { document.title = config.brand || name; }, [config, name]); - const route = useMemo( - () => parseRoute(location.pathname, "volume"), - [location.pathname], - ); + const route = useMemo(() => parseRoute(pathname, "volume"), [pathname]); return ( a.key === agentKey) || GUIDE_AGENTS[0]; + + return ( +
+

{project.name}

+

+ Mount this project as a folder on any machine and connect your coding agent: files sync both + ways in the background, every change is journaled with who made it, and agent reads feed + Insights. +

+
+ {GUIDE_AGENTS.map((a) => ( + + ))} +
+
+ {guideSteps(agent, project).map((s, i) => ( +
+
+ {i + 1} + {s.title} +
+ {s.desc &&

{s.desc}

} + {s.code && } + {s.extra &&

{s.extra}

} +
+ ))} +

+ That's it — the folder now syncs on its own. Every agent turn starts from the latest + state, edits appear here (and on every teammate's mount) within seconds, and what your + agents read shows up in Insights. +

+
+
+ ); +} + +function GuideCode({ code }: { code: string }) { + const [label, setLabel] = useState("Copy"); + return ( +
+      {code}
+      
+    
+ ); +} diff --git a/internal/webapp/frontend/src/components/HistoryView.tsx b/internal/webapp/frontend/src/components/HistoryView.tsx new file mode 100644 index 0000000..ad5eece --- /dev/null +++ b/internal/webapp/frontend/src/components/HistoryView.tsx @@ -0,0 +1,59 @@ +import { useEffect } from "react"; +import { useQuery } from "@tanstack/react-query"; +import { getJSON } from "../api/http"; +import type { HistoryEntry } from "../api/types"; +import { HistoryRow } from "./HistoryRow"; + +/* ---- history ---- + Every change ever made, straight from the journals: who (account), when, + from which device (name, OS, IP as the server saw it). The route stores + one target; the tree says whether it is a folder (subtree feed) or a + file (version list). */ +export function HistoryView(props: { + apiBase: string; + target: string; // "" = whole project + isFolder: (p: string) => boolean; + onOpen: (path: string) => void; + onMeta: (meta: string) => void; + onRendered?: () => void; +}) { + const { apiBase, target, isFolder, onMeta, onRendered } = props; + const q = !target + ? { prefix: "" } + : isFolder(target) + ? { prefix: target + "/" } + : { path: target }; + const qs = + "path" in q && q.path !== undefined + ? "path=" + encodeURIComponent(q.path) + : "prefix=" + encodeURIComponent(q.prefix ?? ""); + const { data, error } = useQuery({ + queryKey: ["history", apiBase, qs, 200], + queryFn: () => getJSON<{ entries: HistoryEntry[] }>(apiBase + "history?" + qs + "&n=200"), + staleTime: 15_000, + }); + + useEffect(() => { + if (error) onMeta("History unavailable: " + (error as Error).message); + }, [error, onMeta]); + useEffect(() => { + if (data) onRendered?.(); + }, [data, onRendered]); + + if (!data) return null; + const entries = data.entries || []; + return ( +
+ {entries.length === 0 &&
No history yet.
} + {entries.map((e, i) => ( + + ))} +
+ ); +} + +// The crumb title for a history route target. +export function historyTitle(target: string, isFolder: (p: string) => boolean): string { + if (!target) return "all changes"; + return isFolder(target) ? target + "/ (folder)" : target; +} diff --git a/internal/webapp/frontend/src/components/Insights.tsx b/internal/webapp/frontend/src/components/Insights.tsx new file mode 100644 index 0000000..bd00cc6 --- /dev/null +++ b/internal/webapp/frontend/src/components/Insights.tsx @@ -0,0 +1,492 @@ +import { useState } from "react"; +import { useQuery } from "@tanstack/react-query"; +import { getJSON } from "../api/http"; +import type { HeatMap, Node } from "../api/types"; +import { heatTotal } from "../hooks/useBrowse"; + +/* ---- insights: the read×write matrix ---- + Every file plotted by how much it is read (30 days, from the heat API) + against how long since it last changed (from the tree). The hot-but-stale + quadrant is the danger zone: knowledge people still rely on that nobody + maintains. Admin/org-owner only — members get the ambient heat dots. */ + +const HOT_READS = 3; // ≥ this many reads/30d = hot +const STALE_DAYS = 30; // ≥ this many days since last write = stale + +interface DeviceHeat { + id?: string; + name?: string; + folders?: Record; +} + +// /heat?by=device breakdown; older servers lack it — the coverage section +// simply doesn't render. +export function useInsightsDevices(apiBase: string, enabled: boolean) { + const q = useQuery({ + queryKey: ["heatDevices", apiBase], + queryFn: () => + getJSON<{ devices: DeviceHeat[] }>(apiBase + "heat?by=device&days=30"), + enabled, + retry: false, + staleTime: 60_000, + }); + return q.data?.devices ?? null; +} + +interface Pt { + path: string; + reads: number; + agent: number; + total: number; + days: number; + danger: boolean; +} + +type Lens = "all" | "human" | "agent"; + +export function Insights(props: { + flatFiles: Node[]; + heatMap: HeatMap | null; + devices: DeviceHeat[] | null; + onOpenFile: (path: string) => void; + onOpenFolder: (path: string) => void; + isFolder: (path: string) => boolean; +}) { + const [lens, setLens] = useState("all"); + const { flatFiles, heatMap, devices } = props; + + const now = Date.now(); + const pts: Pt[] = flatFiles.map((f) => { + const e = (heatMap && heatMap[f.path]) || {}; + const days = f.time ? Math.max(0, (now - new Date(f.time).getTime()) / 86400000) : 0; + const reads = lens === "all" ? heatTotal(e) : e[lens] || 0; + return { + path: f.path, + reads, + agent: e.agent || 0, + total: heatTotal(e), + days, + danger: reads >= HOT_READS && days >= STALE_DAYS, + }; + }); + + return ( +
+

Knowledge insights

+

+ Reads over the last 30 days × how long since each file changed. Hot but stale knowledge — + read a lot, maintained by nobody — is the danger zone. +

+
+ {(["all", "human", "agent"] as const).map((l) => ( + + ))} +
+ +

Map — cell size = reads, color = freshness

+ + +

Reads × freshness

+ + +

Hot path — top files by reads

+ + + {devices && devices.length > 0 && ( + <> +

Agent coverage — which agents read which areas

+ + + )} +
+ ); +} + +/* Staleness color: fresh green → amber → red over 0..300 days. */ +function staleColor(days: number): string { + const stops = [ + [76, 195, 138], + [232, 196, 84], + [224, 93, 93], + ]; + const t = Math.min(1, Math.max(0, days / 300)) * (stops.length - 1); + const i = Math.min(stops.length - 2, Math.floor(t)), + f = t - i; + const c = stops[i].map((v, k) => Math.round(v + (stops[i + 1][k] - v) * f)); + return `rgb(${c[0]},${c[1]},${c[2]})`; +} + +/* Squarified treemap (Bruls et al.), dependency-free: items sorted by value + fill a rect in rows along the shorter side, keeping cells near-square. */ +interface TmItem { + value: number; +} +function squarify( + items: T[], + x: number, + y: number, + w: number, + h: number, +): Array<{ item: T; x: number; y: number; w: number; h: number }> { + const total = items.reduce((s, it) => s + it.value, 0); + if (!total || w <= 0 || h <= 0) return []; + const rest = items + .slice() + .sort((a, b) => b.value - a.value) + .map((it) => ({ it, a: (it.value / total) * w * h })); + const worst = (row: Array<{ a: number }>, side: number) => { + const sum = row.reduce((t, r) => t + r.a, 0); + const d = sum / side; + let m = 0; + for (const r of row) { + const l = r.a / d; + m = Math.max(m, l / d, d / l); + } + return m; + }; + const out: Array<{ item: T; x: number; y: number; w: number; h: number }> = []; + while (rest.length) { + const horiz = w >= h; // row = a strip along the shorter side + const side = horiz ? h : w; + const row = [rest.shift()!]; + while (rest.length && worst(row.concat(rest[0]), side) <= worst(row, side)) { + row.push(rest.shift()!); + } + const d = row.reduce((t, r) => t + r.a, 0) / side; + let off = 0; + for (const r of row) { + const l = r.a / d; + if (horiz) out.push({ item: r.it, x, y: y + off, w: d, h: l }); + else out.push({ item: r.it, x: x + off, y, w: l, h: d }); + off += l; + } + if (horiz) { + x += d; + w -= d; + } else { + y += d; + h -= d; + } + } + return out; +} + +const TM_HEADER = 15; // group label strip height + +function Treemap({ + pts, + onOpenFile, + onOpenFolder, + isFolder, +}: { + pts: Pt[]; + onOpenFile: (p: string) => void; + onOpenFolder: (p: string) => void; + isFolder: (p: string) => boolean; +}) { + const W = 720, + H = 480; + // Two levels: top-level folder groups, files within each. + const groups = new Map(); + for (const p of pts) { + const top = p.path.includes("/") ? p.path.split("/")[0] : "/"; + let g = groups.get(top); + if (!g) groups.set(top, (g = { name: top, files: [], value: 0 })); + g.files.push(p); + g.value += p.reads + 1; // +1: unread files still occupy a sliver + } + const cells: React.ReactNode[] = []; + for (const gc of squarify([...groups.values()], 0, 0, W, H)) { + const g = gc.item; + const dir = g.name === "/" ? "" : g.name; + cells.push( + , + ); + if (gc.w > 46 && gc.h > TM_HEADER + 10) { + let label = g.name === "/" ? "(root)" : g.name; + const fit = Math.floor((gc.w - 8) / 6); + if (label.length > fit) label = label.slice(0, Math.max(1, fit - 1)) + "…"; + cells.push( + + {label} + , + ); + } + const fcells = squarify( + g.files.map((f) => ({ ...f, name: f.path.split("/").pop()!, value: f.reads + 1 })), + gc.x + 2, + gc.y + TM_HEADER, + Math.max(0, gc.w - 4), + Math.max(0, gc.h - TM_HEADER - 2), + ); + for (const c of fcells) { + cells.push( + + + {`${c.item.path} — ${c.item.reads} read${c.item.reads === 1 ? "" : "s"}/30d · changed ${Math.round(c.item.days)}d ago`} + + , + ); + if (c.w > 54 && c.h > 16) { + const fit = Math.floor((c.w - 8) / 6); + let label = (c.item.danger ? "⚠ " : "") + c.item.name; + if (label.length > fit) label = label.slice(0, Math.max(1, fit - 1)) + "…"; + if (fit >= 5) + cells.push( + + {label} + , + ); + } + } + } + return ( + { + // One delegated click handler for thousands of cells. + const t = (e.target as Element).closest("[data-path], [data-dir]"); + if (!t) return; + const path = t.getAttribute("data-path"); + if (path) return onOpenFile(path); + const dir = t.getAttribute("data-dir"); + if (dir && isFolder(dir)) onOpenFolder(dir); + }} + > + {cells} + + ); +} + +/* Dependency-free SVG scatter: x = days since last write, y = reads, both + log-scaled; threshold lines split the quadrants. */ +function Scatter({ pts, onOpenFile }: { pts: Pt[]; onOpenFile: (p: string) => void }) { + const W = 720, + H = 360, + M = { l: 44, r: 16, t: 20, b: 34 }; + const maxDays = Math.max(STALE_DAYS * 2, ...pts.map((p) => p.days)); + const maxReads = Math.max(HOT_READS * 2, ...pts.map((p) => p.reads)); + const lx = (d: number) => Math.log10(d + 1) / Math.log10(maxDays + 1); + const ly = (r: number) => Math.log10(r + 1) / Math.log10(maxReads + 1); + const X = (d: number) => M.l + lx(d) * (W - M.l - M.r); + const Y = (r: number) => H - M.b - ly(r) * (H - M.t - M.b); + + return ( + + + + + + + + days since last change → + + + reads / 30d → + + + hot + stale + + + hot + fresh + + + cold + stale + + + dot size = agent share of reads + + {pts.map((p) => { + // Radius encodes the agent share of the file's reads; translucent + // dots keep the cloud readable at hundreds of files. + const share = p.total ? (p.agent || 0) / p.total : 0; + return ( + onOpenFile(p.path)} + > + + {`${p.path} — ${p.reads} read${p.reads === 1 ? "" : "s"} / 30d · changed ${Math.round(p.days)}d ago`} + + + ); + })} + + ); +} + +/* ---- hot path: top-20 files by reads, agent/human split ---- */ +function HotPath({ + pts, + lens, + onOpenFile, +}: { + pts: Pt[]; + lens: Lens; + onOpenFile: (p: string) => void; +}) { + const top = pts + .filter((p) => p.reads > 0) + .sort((a, b) => b.reads - a.reads || b.days - a.days) + .slice(0, 20); + if (!top.length) return
No reads in the window yet.
; + const max = top[0].reads; + return ( + <> +
+ {top.map((p) => { + // Split of the lens reads: pure lenses are single-color by definition. + const aFrac = lens === "agent" ? 1 : lens === "human" ? 0 : p.total ? p.agent / p.total : 0; + const pct = (p.reads / max) * 100; + return ( +
onOpenFile(p.path)} + onKeyDown={(e) => { + if (e.key === "Enter" || e.key === " ") { + e.preventDefault(); + onOpenFile(p.path); + } + }} + > + + {p.path + (p.danger ? " ⚠" : "")} + + + + + + {p.reads} +
+ ); + })} +
+

+ agent reads human reads +

+ + ); +} + +/* ---- agent coverage matrix: devices × top-level folders ---- */ +function CoverageMatrix({ devices }: { devices: DeviceHeat[] }) { + const totals = new Map(); + for (const d of devices) { + for (const [f, n] of Object.entries(d.folders || {})) totals.set(f, (totals.get(f) || 0) + n); + } + const cols = [...totals.entries()] + .sort((a, b) => b[1] - a[1]) + .slice(0, 12) + .map((e) => e[0]); + const rows = devices.slice(0, 12); // server sorts by total desc + const left = 140, + top = 6, + cw = Math.min(76, Math.max(34, (720 - left - 8) / cols.length)), + ch = 26; + const W = 720, + H = top + rows.length * ch + 58; + const max = Math.max(1, ...rows.flatMap((d) => cols.map((c) => (d.folders || {})[c] || 0))); + const shade = (t: number) => { + // #17191f → amber by intensity + const a = [23, 25, 31], + b = [245, 166, 35]; + const c = a.map((v, i) => Math.round(v + (b[i] - v) * t)); + return `rgb(${c[0]},${c[1]},${c[2]})`; + }; + return ( + + {rows.map((d, i) => { + let label = d.name || d.id || ""; + if (label.length > 20) label = label.slice(0, 19) + "…"; + return ( + + + {label} + + {cols.map((c, j) => { + const v = (d.folders || {})[c] || 0; + return ( + + {`${d.name || d.id} × ${c || "(root)"}: ${v} read${v === 1 ? "" : "s"}/30d`} + + ); + })} + + ); + })} + {cols.map((c, j) => { + const cx = left + j * cw + (cw - 4) / 2, + cy = top + rows.length * ch + 14; + return ( + + {c || "(root)"} + + ); + })} + + ); +} diff --git a/internal/webapp/frontend/src/components/ProjectNav.tsx b/internal/webapp/frontend/src/components/ProjectNav.tsx index 6333b84..fdd44c5 100644 --- a/internal/webapp/frontend/src/components/ProjectNav.tsx +++ b/internal/webapp/frontend/src/components/ProjectNav.tsx @@ -1,4 +1,4 @@ -import { useNavigate } from "react-router-dom"; +import { navigate } from "../nav"; import { postJSON } from "../api/http"; import type { Project, ProjectCreated } from "../api/types"; import { modalPrompt } from "../modal"; @@ -16,7 +16,6 @@ export function projColor(s: string): string { } export function ProjectNav({ projects, currentId }: { projects: Project[]; currentId?: string }) { - const navigate = useNavigate(); const refresh = useHubRefresh(); const create = async () => { diff --git a/internal/webapp/frontend/src/main.tsx b/internal/webapp/frontend/src/main.tsx index a0b6ef3..b69996b 100644 --- a/internal/webapp/frontend/src/main.tsx +++ b/internal/webapp/frontend/src/main.tsx @@ -1,6 +1,5 @@ import { StrictMode } from "react"; import { createRoot } from "react-dom/client"; -import { BrowserRouter } from "react-router-dom"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import App from "./App"; import "./style.css"; @@ -14,9 +13,7 @@ const queryClient = new QueryClient({ createRoot(document.getElementById("root")!).render( - - - + , ); diff --git a/internal/webapp/frontend/src/nav.ts b/internal/webapp/frontend/src/nav.ts new file mode 100644 index 0000000..db95f27 --- /dev/null +++ b/internal/webapp/frontend/src/nav.ts @@ -0,0 +1,55 @@ +import { useEffect, useSyncExternalStore } from "react"; + +// Minimal synchronous history router. React Router v7 wraps navigation in +// React.startTransition, which can leave the old view on screen for +// seconds after the URL changes (the transition gets starved by query +// updates) — the classic app's routing was synchronous, and parity needs +// it to stay that way. This is the whole router: pushState/replaceState + +// popstate, delivered through useSyncExternalStore. + +export type NavType = "PUSH" | "REPLACE" | "POP"; +let navType: NavType = "POP"; +const listeners = new Set<() => void>(); +function emit() { + for (const l of listeners) l(); +} +window.addEventListener("popstate", () => { + navType = "POP"; + emit(); +}); + +export function navigate(url: string, opts?: { replace?: boolean }) { + // Skip a no-op push that would just stack a duplicate history entry + // (e.g. when boot opens the file already in the URL). + const cur = location.pathname + location.search; + if (!opts?.replace && cur === url) return; + history[opts?.replace ? "replaceState" : "pushState"](null, "", url); + navType = opts?.replace ? "REPLACE" : "PUSH"; + emit(); +} + +export function useLocationPath(): string { + return useSyncExternalStore( + (l) => { + listeners.add(l); + return () => { + listeners.delete(l); + }; + }, + () => location.pathname, + ); +} + +// How the current location was reached — POP means back/forward, which is +// what scroll restoration keys off. +export function currentNavType(): NavType { + return navType; +} + +// Render-time redirect (the declarative equivalent). +export function Redirect({ to }: { to: string }) { + useEffect(() => { + navigate(to, { replace: true }); + }, [to]); + return null; +} diff --git a/internal/webapp/static/assets/index-D-n_MmWw.js b/internal/webapp/static/assets/index-D-n_MmWw.js new file mode 100644 index 0000000..d04760d --- /dev/null +++ b/internal/webapp/static/assets/index-D-n_MmWw.js @@ -0,0 +1,11 @@ +(function(){const c=document.createElement("link").relList;if(c&&c.supports&&c.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const m of o)if(m.type==="childList")for(const S of m.addedNodes)S.tagName==="LINK"&&S.rel==="modulepreload"&&r(S)}).observe(document,{childList:!0,subtree:!0});function f(o){const m={};return o.integrity&&(m.integrity=o.integrity),o.referrerPolicy&&(m.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?m.credentials="include":o.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function r(o){if(o.ep)return;o.ep=!0;const m=f(o);fetch(o.href,m)}})();var Qs={exports:{}},Zn={};var rd;function Mv(){if(rd)return Zn;rd=1;var u=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function f(r,o,m){var S=null;if(m!==void 0&&(S=""+m),o.key!==void 0&&(S=""+o.key),"key"in o){m={};for(var M in o)M!=="key"&&(m[M]=o[M])}else m=o;return o=m.ref,{$$typeof:u,type:r,key:S,ref:o!==void 0?o:null,props:m}}return Zn.Fragment=c,Zn.jsx=f,Zn.jsxs=f,Zn}var od;function Cv(){return od||(od=1,Qs.exports=Mv()),Qs.exports}var d=Cv(),Bs={exports:{}},P={};var hd;function Nv(){if(hd)return P;hd=1;var u=Symbol.for("react.transitional.element"),c=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),S=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),j=Symbol.iterator;function H(b){return b===null||typeof b!="object"?null:(b=j&&b[j]||b["@@iterator"],typeof b=="function"?b:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Q=Object.assign,G={};function L(b,U,Y){this.props=b,this.context=U,this.refs=G,this.updater=Y||w}L.prototype.isReactComponent={},L.prototype.setState=function(b,U){if(typeof b!="object"&&typeof b!="function"&&b!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,b,U,"setState")},L.prototype.forceUpdate=function(b){this.updater.enqueueForceUpdate(this,b,"forceUpdate")};function $(){}$.prototype=L.prototype;function nt(b,U,Y){this.props=b,this.context=U,this.refs=G,this.updater=Y||w}var Nt=nt.prototype=new $;Nt.constructor=nt,Q(Nt,L.prototype),Nt.isPureReactComponent=!0;var Mt=Array.isArray;function Rt(){}var W={H:null,A:null,T:null,S:null},rt=Object.prototype.hasOwnProperty;function Gt(b,U,Y){var X=Y.ref;return{$$typeof:u,type:b,key:U,ref:X!==void 0?X:null,props:Y}}function ae(b,U){return Gt(b.type,U,b.props)}function Vt(b){return typeof b=="object"&&b!==null&&b.$$typeof===u}function Ut(b){var U={"=":"=0",":":"=2"};return"$"+b.replace(/[=:]/g,function(Y){return U[Y]})}var Tt=/\/+/g;function te(b,U){return typeof b=="object"&&b!==null&&b.key!=null?Ut(""+b.key):U.toString(36)}function he(b){switch(b.status){case"fulfilled":return b.value;case"rejected":throw b.reason;default:switch(typeof b.status=="string"?b.then(Rt,Rt):(b.status="pending",b.then(function(U){b.status==="pending"&&(b.status="fulfilled",b.value=U)},function(U){b.status==="pending"&&(b.status="rejected",b.reason=U)})),b.status){case"fulfilled":return b.value;case"rejected":throw b.reason}}throw b}function D(b,U,Y,X,I){var et=typeof b;(et==="undefined"||et==="boolean")&&(b=null);var ht=!1;if(b===null)ht=!0;else switch(et){case"bigint":case"string":case"number":ht=!0;break;case"object":switch(b.$$typeof){case u:case c:ht=!0;break;case z:return ht=b._init,D(ht(b._payload),U,Y,X,I)}}if(ht)return I=I(b),ht=X===""?"."+te(b,0):X,Mt(I)?(Y="",ht!=null&&(Y=ht.replace(Tt,"$&/")+"/"),D(I,U,Y,"",function(hl){return hl})):I!=null&&(Vt(I)&&(I=ae(I,Y+(I.key==null||b&&b.key===I.key?"":(""+I.key).replace(Tt,"$&/")+"/")+ht)),U.push(I)),1;ht=0;var Xt=X===""?".":X+":";if(Mt(b))for(var Ot=0;Ot>>1,vt=D[ot];if(0>>1;oto(Y,J))Xo(I,Y)?(D[ot]=I,D[X]=J,ot=X):(D[ot]=Y,D[U]=J,ot=U);else if(Xo(I,J))D[ot]=I,D[X]=J,ot=X;else break t}}return B}function o(D,B){var J=D.sortIndex-B.sortIndex;return J!==0?J:D.id-B.id}if(u.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var m=performance;u.unstable_now=function(){return m.now()}}else{var S=Date,M=S.now();u.unstable_now=function(){return S.now()-M}}var g=[],y=[],z=1,x=null,j=3,H=!1,w=!1,Q=!1,G=!1,L=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,nt=typeof setImmediate<"u"?setImmediate:null;function Nt(D){for(var B=f(y);B!==null;){if(B.callback===null)r(y);else if(B.startTime<=D)r(y),B.sortIndex=B.expirationTime,c(g,B);else break;B=f(y)}}function Mt(D){if(Q=!1,Nt(D),!w)if(f(g)!==null)w=!0,Rt||(Rt=!0,Ut());else{var B=f(y);B!==null&&he(Mt,B.startTime-D)}}var Rt=!1,W=-1,rt=5,Gt=-1;function ae(){return G?!0:!(u.unstable_now()-GtD&&ae());){var ot=x.callback;if(typeof ot=="function"){x.callback=null,j=x.priorityLevel;var vt=ot(x.expirationTime<=D);if(D=u.unstable_now(),typeof vt=="function"){x.callback=vt,Nt(D),B=!0;break e}x===f(g)&&r(g),Nt(D)}else r(g);x=f(g)}if(x!==null)B=!0;else{var b=f(y);b!==null&&he(Mt,b.startTime-D),B=!1}}break t}finally{x=null,j=J,H=!1}B=void 0}}finally{B?Ut():Rt=!1}}}var Ut;if(typeof nt=="function")Ut=function(){nt(Vt)};else if(typeof MessageChannel<"u"){var Tt=new MessageChannel,te=Tt.port2;Tt.port1.onmessage=Vt,Ut=function(){te.postMessage(null)}}else Ut=function(){L(Vt,0)};function he(D,B){W=L(function(){D(u.unstable_now())},B)}u.unstable_IdlePriority=5,u.unstable_ImmediatePriority=1,u.unstable_LowPriority=4,u.unstable_NormalPriority=3,u.unstable_Profiling=null,u.unstable_UserBlockingPriority=2,u.unstable_cancelCallback=function(D){D.callback=null},u.unstable_forceFrameRate=function(D){0>D||125ot?(D.sortIndex=J,c(y,D),f(g)===null&&D===f(y)&&(Q?($(W),W=-1):Q=!0,he(Mt,J-ot))):(D.sortIndex=vt,c(g,D),w||H||(w=!0,Rt||(Rt=!0,Ut()))),D},u.unstable_shouldYield=ae,u.unstable_wrapCallback=function(D){var B=j;return function(){var J=j;j=B;try{return D.apply(this,arguments)}finally{j=J}}}})(Ls)),Ls}var yd;function _v(){return yd||(yd=1,Gs.exports=Dv()),Gs.exports}var Xs={exports:{}},ee={};var vd;function Rv(){if(vd)return ee;vd=1;var u=tf();function c(g){var y="https://react.dev/errors/"+g;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(u)}catch(c){console.error(c)}}return u(),Xs.exports=Rv(),Xs.exports}var pd;function Hv(){if(pd)return Vn;pd=1;var u=_v(),c=tf(),f=Uv();function r(t){var e="https://react.dev/errors/"+t;if(1vt||(t.current=ot[vt],ot[vt]=null,vt--)}function Y(t,e){vt++,ot[vt]=t.current,t.current=e}var X=b(null),I=b(null),et=b(null),ht=b(null);function Xt(t,e){switch(Y(et,e),Y(I,t),Y(X,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?Rh(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=Rh(e),t=Uh(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}U(X),Y(X,t)}function Ot(){U(X),U(I),U(et)}function hl(t){t.memoizedState!==null&&Y(ht,t);var e=X.current,l=Uh(e,t.type);e!==l&&(Y(I,t),Y(X,l))}function ia(t){I.current===t&&(U(X),U(I)),ht.current===t&&(U(ht),Gn._currentValue=J)}var Fa,ca;function je(t){if(Fa===void 0)try{throw Error()}catch(l){var e=l.stack.trim().match(/\n( *(at )?)/);Fa=e&&e[1]||"",ca=-1)":-1n||v[a]!==O[n]){var N=` +`+v[a].replace(" at new "," at ");return t.displayName&&N.includes("")&&(N=N.replace("",t.displayName)),N}while(1<=a&&0<=n);break}}}finally{dl=!1,Error.prepareStackTrace=l}return(l=t?t.displayName||t.name:"")?je(l):""}function Ti(t,e){switch(t.tag){case 26:case 27:case 5:return je(t.type);case 16:return je("Lazy");case 13:return t.child!==e&&e!==null?je("Suspense Fallback"):je("Suspense");case 19:return je("SuspenseList");case 0:case 15:return $a(t.type,!1);case 11:return $a(t.type.render,!1);case 1:return $a(t.type,!0);case 31:return je("Activity");default:return""}}function Yl(t){try{var e="",l=null;do e+=Ti(t,l),l=t,t=t.return;while(t);return e}catch(a){return` +Error generating stack: `+a.message+` +`+a.stack}}var Je=Object.prototype.hasOwnProperty,Te=u.unstable_scheduleCallback,Wa=u.unstable_cancelCallback,Oi=u.unstable_shouldYield,at=u.unstable_requestPaint,F=u.unstable_now,gt=u.unstable_getCurrentPriorityLevel,qe=u.unstable_ImmediatePriority,sa=u.unstable_UserBlockingPriority,fa=u.unstable_NormalPriority,fm=u.unstable_LowPriority,hf=u.unstable_IdlePriority,rm=u.log,om=u.unstable_setDisableYieldValue,Ia=null,de=null;function ml(t){if(typeof rm=="function"&&om(t),de&&typeof de.setStrictMode=="function")try{de.setStrictMode(Ia,t)}catch{}}var me=Math.clz32?Math.clz32:mm,hm=Math.log,dm=Math.LN2;function mm(t){return t>>>=0,t===0?32:31-(hm(t)/dm|0)|0}var eu=256,lu=262144,au=4194304;function Gl(t){var e=t&42;if(e!==0)return e;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function nu(t,e,l){var a=t.pendingLanes;if(a===0)return 0;var n=0,i=t.suspendedLanes,s=t.pingedLanes;t=t.warmLanes;var h=a&134217727;return h!==0?(a=h&~i,a!==0?n=Gl(a):(s&=h,s!==0?n=Gl(s):l||(l=h&~t,l!==0&&(n=Gl(l))))):(h=a&~i,h!==0?n=Gl(h):s!==0?n=Gl(s):l||(l=a&~t,l!==0&&(n=Gl(l)))),n===0?0:e!==0&&e!==n&&(e&i)===0&&(i=n&-n,l=e&-e,i>=l||i===32&&(l&4194048)!==0)?e:n}function Pa(t,e){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&e)===0}function ym(t,e){switch(t){case 1:case 2:case 4:case 8:case 64:return e+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function df(){var t=au;return au<<=1,(au&62914560)===0&&(au=4194304),t}function Ai(t){for(var e=[],l=0;31>l;l++)e.push(t);return e}function tn(t,e){t.pendingLanes|=e,e!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function vm(t,e,l,a,n,i){var s=t.pendingLanes;t.pendingLanes=l,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=l,t.entangledLanes&=l,t.errorRecoveryDisabledLanes&=l,t.shellSuspendCounter=0;var h=t.entanglements,v=t.expirationTimes,O=t.hiddenUpdates;for(l=s&~l;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Em=/[\n"\\]/g;function Ae(t){return t.replace(Em,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function _i(t,e,l,a,n,i,s,h){t.name="",s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?t.type=s:t.removeAttribute("type"),e!=null?s==="number"?(e===0&&t.value===""||t.value!=e)&&(t.value=""+Oe(e)):t.value!==""+Oe(e)&&(t.value=""+Oe(e)):s!=="submit"&&s!=="reset"||t.removeAttribute("value"),e!=null?Ri(t,s,Oe(e)):l!=null?Ri(t,s,Oe(l)):a!=null&&t.removeAttribute("value"),n==null&&i!=null&&(t.defaultChecked=!!i),n!=null&&(t.checked=n&&typeof n!="function"&&typeof n!="symbol"),h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?t.name=""+Oe(h):t.removeAttribute("name")}function Af(t,e,l,a,n,i,s,h){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(t.type=i),e!=null||l!=null){if(!(i!=="submit"&&i!=="reset"||e!=null)){Di(t);return}l=l!=null?""+Oe(l):"",e=e!=null?""+Oe(e):l,h||e===t.value||(t.value=e),t.defaultValue=e}a=a??n,a=typeof a!="function"&&typeof a!="symbol"&&!!a,t.checked=h?t.checked:!!a,t.defaultChecked=!!a,s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(t.name=s),Di(t)}function Ri(t,e,l){e==="number"&&cu(t.ownerDocument)===t||t.defaultValue===""+l||(t.defaultValue=""+l)}function ya(t,e,l,a){if(t=t.options,e){e={};for(var n=0;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qi=!1;if($e)try{var nn={};Object.defineProperty(nn,"passive",{get:function(){Qi=!0}}),window.addEventListener("test",nn,nn),window.removeEventListener("test",nn,nn)}catch{Qi=!1}var vl=null,Bi=null,fu=null;function Rf(){if(fu)return fu;var t,e=Bi,l=e.length,a,n="value"in vl?vl.value:vl.textContent,i=n.length;for(t=0;t=sn),Bf=" ",Yf=!1;function Gf(t,e){switch(t){case"keyup":return $m.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ba=!1;function Im(t,e){switch(t){case"compositionend":return Lf(e);case"keypress":return e.which!==32?null:(Yf=!0,Bf);case"textInput":return t=e.data,t===Bf&&Yf?null:t;default:return null}}function Pm(t,e){if(ba)return t==="compositionend"||!Ki&&Gf(t,e)?(t=Rf(),fu=Bi=vl=null,ba=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:l,offset:e-t};t=a}t:{for(;l;){if(l.nextSibling){l=l.nextSibling;break t}l=l.parentNode}l=void 0}l=$f(l)}}function If(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?If(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Pf(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var e=cu(t.document);e instanceof t.HTMLIFrameElement;){try{var l=typeof e.contentWindow.location.href=="string"}catch{l=!1}if(l)t=e.contentWindow;else break;e=cu(t.document)}return e}function Ji(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}var cy=$e&&"documentMode"in document&&11>=document.documentMode,Sa=null,ki=null,hn=null,Fi=!1;function tr(t,e,l){var a=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Fi||Sa==null||Sa!==cu(a)||(a=Sa,"selectionStart"in a&&Ji(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),hn&&on(hn,a)||(hn=a,a=li(ki,"onSelect"),0>=s,n-=s,Ge=1<<32-me(e)+n|l<lt?(st=Z,Z=null):st=Z.sibling;var mt=A(E,Z,T[lt],_);if(mt===null){Z===null&&(Z=st);break}t&&Z&&mt.alternate===null&&e(E,Z),p=i(mt,p,lt),dt===null?V=mt:dt.sibling=mt,dt=mt,Z=st}if(lt===T.length)return l(E,Z),ft&&Ie(E,lt),V;if(Z===null){for(;ltlt?(st=Z,Z=null):st=Z.sibling;var Ql=A(E,Z,mt.value,_);if(Ql===null){Z===null&&(Z=st);break}t&&Z&&Ql.alternate===null&&e(E,Z),p=i(Ql,p,lt),dt===null?V=Ql:dt.sibling=Ql,dt=Ql,Z=st}if(mt.done)return l(E,Z),ft&&Ie(E,lt),V;if(Z===null){for(;!mt.done;lt++,mt=T.next())mt=R(E,mt.value,_),mt!==null&&(p=i(mt,p,lt),dt===null?V=mt:dt.sibling=mt,dt=mt);return ft&&Ie(E,lt),V}for(Z=a(Z);!mt.done;lt++,mt=T.next())mt=C(Z,E,lt,mt.value,_),mt!==null&&(t&&mt.alternate!==null&&Z.delete(mt.key===null?lt:mt.key),p=i(mt,p,lt),dt===null?V=mt:dt.sibling=mt,dt=mt);return t&&Z.forEach(function(zv){return e(E,zv)}),ft&&Ie(E,lt),V}function Et(E,p,T,_){if(typeof T=="object"&&T!==null&&T.type===Q&&T.key===null&&(T=T.props.children),typeof T=="object"&&T!==null){switch(T.$$typeof){case H:t:{for(var V=T.key;p!==null;){if(p.key===V){if(V=T.type,V===Q){if(p.tag===7){l(E,p.sibling),_=n(p,T.props.children),_.return=E,E=_;break t}}else if(p.elementType===V||typeof V=="object"&&V!==null&&V.$$typeof===rt&&Il(V)===p.type){l(E,p.sibling),_=n(p,T.props),pn(_,T),_.return=E,E=_;break t}l(E,p);break}else e(E,p);p=p.sibling}T.type===Q?(_=Jl(T.props.children,E.mode,_,T.key),_.return=E,E=_):(_=bu(T.type,T.key,T.props,null,E.mode,_),pn(_,T),_.return=E,E=_)}return s(E);case w:t:{for(V=T.key;p!==null;){if(p.key===V)if(p.tag===4&&p.stateNode.containerInfo===T.containerInfo&&p.stateNode.implementation===T.implementation){l(E,p.sibling),_=n(p,T.children||[]),_.return=E,E=_;break t}else{l(E,p);break}else e(E,p);p=p.sibling}_=lc(T,E.mode,_),_.return=E,E=_}return s(E);case rt:return T=Il(T),Et(E,p,T,_)}if(he(T))return K(E,p,T,_);if(Ut(T)){if(V=Ut(T),typeof V!="function")throw Error(r(150));return T=V.call(T),k(E,p,T,_)}if(typeof T.then=="function")return Et(E,p,Au(T),_);if(T.$$typeof===nt)return Et(E,p,Eu(E,T),_);zu(E,T)}return typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint"?(T=""+T,p!==null&&p.tag===6?(l(E,p.sibling),_=n(p,T),_.return=E,E=_):(l(E,p),_=ec(T,E.mode,_),_.return=E,E=_),s(E)):l(E,p)}return function(E,p,T,_){try{gn=0;var V=Et(E,p,T,_);return Da=null,V}catch(Z){if(Z===Na||Z===Tu)throw Z;var dt=ve(29,Z,null,E.mode);return dt.lanes=_,dt.return=E,dt}}}var ta=jr(!0),Tr=jr(!1),xl=!1;function mc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yc(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function El(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function jl(t,e,l){var a=t.updateQueue;if(a===null)return null;if(a=a.shared,(yt&2)!==0){var n=a.pending;return n===null?e.next=e:(e.next=n.next,n.next=e),a.pending=e,e=pu(t),cr(t,null,l),e}return gu(t,a,e,l),pu(t)}function bn(t,e,l){if(e=e.updateQueue,e!==null&&(e=e.shared,(l&4194048)!==0)){var a=e.lanes;a&=t.pendingLanes,l|=a,e.lanes=l,yf(t,l)}}function vc(t,e){var l=t.updateQueue,a=t.alternate;if(a!==null&&(a=a.updateQueue,l===a)){var n=null,i=null;if(l=l.firstBaseUpdate,l!==null){do{var s={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};i===null?n=i=s:i=i.next=s,l=l.next}while(l!==null);i===null?n=i=e:i=i.next=e}else n=i=e;l={baseState:a.baseState,firstBaseUpdate:n,lastBaseUpdate:i,shared:a.shared,callbacks:a.callbacks},t.updateQueue=l;return}t=l.lastBaseUpdate,t===null?l.firstBaseUpdate=e:t.next=e,l.lastBaseUpdate=e}var gc=!1;function Sn(){if(gc){var t=Ca;if(t!==null)throw t}}function xn(t,e,l,a){gc=!1;var n=t.updateQueue;xl=!1;var i=n.firstBaseUpdate,s=n.lastBaseUpdate,h=n.shared.pending;if(h!==null){n.shared.pending=null;var v=h,O=v.next;v.next=null,s===null?i=O:s.next=O,s=v;var N=t.alternate;N!==null&&(N=N.updateQueue,h=N.lastBaseUpdate,h!==s&&(h===null?N.firstBaseUpdate=O:h.next=O,N.lastBaseUpdate=v))}if(i!==null){var R=n.baseState;s=0,N=O=v=null,h=i;do{var A=h.lane&-536870913,C=A!==h.lane;if(C?(ct&A)===A:(a&A)===A){A!==0&&A===Ma&&(gc=!0),N!==null&&(N=N.next={lane:0,tag:h.tag,payload:h.payload,callback:null,next:null});t:{var K=t,k=h;A=e;var Et=l;switch(k.tag){case 1:if(K=k.payload,typeof K=="function"){R=K.call(Et,R,A);break t}R=K;break t;case 3:K.flags=K.flags&-65537|128;case 0:if(K=k.payload,A=typeof K=="function"?K.call(Et,R,A):K,A==null)break t;R=x({},R,A);break t;case 2:xl=!0}}A=h.callback,A!==null&&(t.flags|=64,C&&(t.flags|=8192),C=n.callbacks,C===null?n.callbacks=[A]:C.push(A))}else C={lane:A,tag:h.tag,payload:h.payload,callback:h.callback,next:null},N===null?(O=N=C,v=R):N=N.next=C,s|=A;if(h=h.next,h===null){if(h=n.shared.pending,h===null)break;C=h,h=C.next,C.next=null,n.lastBaseUpdate=C,n.shared.pending=null}}while(!0);N===null&&(v=R),n.baseState=v,n.firstBaseUpdate=O,n.lastBaseUpdate=N,i===null&&(n.shared.lanes=0),Ml|=s,t.lanes=s,t.memoizedState=R}}function Or(t,e){if(typeof t!="function")throw Error(r(191,t));t.call(e)}function Ar(t,e){var l=t.callbacks;if(l!==null)for(t.callbacks=null,t=0;ti?i:8;var s=D.T,h={};D.T=h,qc(t,!1,e,l);try{var v=n(),O=D.S;if(O!==null&&O(h,v),v!==null&&typeof v=="object"&&typeof v.then=="function"){var N=vy(v,a);Tn(t,e,N,xe(t))}else Tn(t,e,a,xe(t))}catch(R){Tn(t,e,{then:function(){},status:"rejected",reason:R},xe())}finally{B.p=i,s!==null&&h.types!==null&&(s.types=h.types),D.T=s}}function Ey(){}function Uc(t,e,l,a){if(t.tag!==5)throw Error(r(476));var n=no(t).queue;ao(t,n,e,J,l===null?Ey:function(){return uo(t),l(a)})}function no(t){var e=t.memoizedState;if(e!==null)return e;e={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ll,lastRenderedState:J},next:null};var l={};return e.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ll,lastRenderedState:l},next:null},t.memoizedState=e,t=t.alternate,t!==null&&(t.memoizedState=e),e}function uo(t){var e=no(t);e.next===null&&(e=t.alternate.memoizedState),Tn(t,e.next.queue,{},xe())}function Hc(){return Ft(Gn)}function io(){return qt().memoizedState}function co(){return qt().memoizedState}function jy(t){for(var e=t.return;e!==null;){switch(e.tag){case 24:case 3:var l=xe();t=El(l);var a=jl(e,t,l);a!==null&&(re(a,e,l),bn(a,e,l)),e={cache:rc()},t.payload=e;return}e=e.return}}function Ty(t,e,l){var a=xe();l={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},wu(t)?fo(e,l):(l=Pi(t,e,l,a),l!==null&&(re(l,t,a),ro(l,e,a)))}function so(t,e,l){var a=xe();Tn(t,e,l,a)}function Tn(t,e,l,a){var n={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(wu(t))fo(e,n);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var s=e.lastRenderedState,h=i(s,l);if(n.hasEagerState=!0,n.eagerState=h,ye(h,s))return gu(t,e,n,0),jt===null&&vu(),!1}catch{}if(l=Pi(t,e,n,a),l!==null)return re(l,t,a),ro(l,e,a),!0}return!1}function qc(t,e,l,a){if(a={lane:2,revertLane:ms(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},wu(t)){if(e)throw Error(r(479))}else e=Pi(t,l,a,2),e!==null&&re(e,t,2)}function wu(t){var e=t.alternate;return t===tt||e!==null&&e===tt}function fo(t,e){Ra=Nu=!0;var l=t.pending;l===null?e.next=e:(e.next=l.next,l.next=e),t.pending=e}function ro(t,e,l){if((l&4194048)!==0){var a=e.lanes;a&=t.pendingLanes,l|=a,e.lanes=l,yf(t,l)}}var On={readContext:Ft,use:Ru,useCallback:Dt,useContext:Dt,useEffect:Dt,useImperativeHandle:Dt,useLayoutEffect:Dt,useInsertionEffect:Dt,useMemo:Dt,useReducer:Dt,useRef:Dt,useState:Dt,useDebugValue:Dt,useDeferredValue:Dt,useTransition:Dt,useSyncExternalStore:Dt,useId:Dt,useHostTransitionStatus:Dt,useFormState:Dt,useActionState:Dt,useOptimistic:Dt,useMemoCache:Dt,useCacheRefresh:Dt};On.useEffectEvent=Dt;var oo={readContext:Ft,use:Ru,useCallback:function(t,e){return le().memoizedState=[t,e===void 0?null:e],t},useContext:Ft,useEffect:kr,useImperativeHandle:function(t,e,l){l=l!=null?l.concat([t]):null,Hu(4194308,4,Ir.bind(null,e,t),l)},useLayoutEffect:function(t,e){return Hu(4194308,4,t,e)},useInsertionEffect:function(t,e){Hu(4,2,t,e)},useMemo:function(t,e){var l=le();e=e===void 0?null:e;var a=t();if(ea){ml(!0);try{t()}finally{ml(!1)}}return l.memoizedState=[a,e],a},useReducer:function(t,e,l){var a=le();if(l!==void 0){var n=l(e);if(ea){ml(!0);try{l(e)}finally{ml(!1)}}}else n=e;return a.memoizedState=a.baseState=n,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:n},a.queue=t,t=t.dispatch=Ty.bind(null,tt,t),[a.memoizedState,t]},useRef:function(t){var e=le();return t={current:t},e.memoizedState=t},useState:function(t){t=Cc(t);var e=t.queue,l=so.bind(null,tt,e);return e.dispatch=l,[t.memoizedState,l]},useDebugValue:_c,useDeferredValue:function(t,e){var l=le();return Rc(l,t,e)},useTransition:function(){var t=Cc(!1);return t=ao.bind(null,tt,t.queue,!0,!1),le().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,e,l){var a=tt,n=le();if(ft){if(l===void 0)throw Error(r(407));l=l()}else{if(l=e(),jt===null)throw Error(r(349));(ct&127)!==0||_r(a,e,l)}n.memoizedState=l;var i={value:l,getSnapshot:e};return n.queue=i,kr(Ur.bind(null,a,i,t),[t]),a.flags|=2048,Ha(9,{destroy:void 0},Rr.bind(null,a,i,l,e),null),l},useId:function(){var t=le(),e=jt.identifierPrefix;if(ft){var l=Le,a=Ge;l=(a&~(1<<32-me(a)-1)).toString(32)+l,e="_"+e+"R_"+l,l=Du++,0<\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof a.is=="string"?s.createElement("select",{is:a.is}):s.createElement("select"),a.multiple?i.multiple=!0:a.size&&(i.size=a.size);break;default:i=typeof a.is=="string"?s.createElement(n,{is:a.is}):s.createElement(n)}}i[Jt]=e,i[ne]=a;t:for(s=e.child;s!==null;){if(s.tag===5||s.tag===6)i.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===e)break t;for(;s.sibling===null;){if(s.return===null||s.return===e)break t;s=s.return}s.sibling.return=s.return,s=s.sibling}e.stateNode=i;t:switch(Wt(i,n,a),n){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break t;case"img":a=!0;break t;default:a=!1}a&&nl(e)}}return zt(e),$c(e,e.type,t===null?null:t.memoizedProps,e.pendingProps,l),null;case 6:if(t&&e.stateNode!=null)t.memoizedProps!==a&&nl(e);else{if(typeof a!="string"&&e.stateNode===null)throw Error(r(166));if(t=et.current,Aa(e)){if(t=e.stateNode,l=e.memoizedProps,a=null,n=kt,n!==null)switch(n.tag){case 27:case 5:a=n.memoizedProps}t[Jt]=e,t=!!(t.nodeValue===l||a!==null&&a.suppressHydrationWarning===!0||Dh(t.nodeValue,l)),t||bl(e,!0)}else t=ai(t).createTextNode(a),t[Jt]=e,e.stateNode=t}return zt(e),null;case 31:if(l=e.memoizedState,t===null||t.memoizedState!==null){if(a=Aa(e),l!==null){if(t===null){if(!a)throw Error(r(318));if(t=e.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(557));t[Jt]=e}else kl(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;zt(e),t=!1}else l=ic(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=l),t=!0;if(!t)return e.flags&256?(pe(e),e):(pe(e),null);if((e.flags&128)!==0)throw Error(r(558))}return zt(e),null;case 13:if(a=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(n=Aa(e),a!==null&&a.dehydrated!==null){if(t===null){if(!n)throw Error(r(318));if(n=e.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));n[Jt]=e}else kl(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;zt(e),n=!1}else n=ic(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=n),n=!0;if(!n)return e.flags&256?(pe(e),e):(pe(e),null)}return pe(e),(e.flags&128)!==0?(e.lanes=l,e):(l=a!==null,t=t!==null&&t.memoizedState!==null,l&&(a=e.child,n=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(n=a.alternate.memoizedState.cachePool.pool),i=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(i=a.memoizedState.cachePool.pool),i!==n&&(a.flags|=2048)),l!==t&&l&&(e.child.flags|=8192),Lu(e,e.updateQueue),zt(e),null);case 4:return Ot(),t===null&&ps(e.stateNode.containerInfo),zt(e),null;case 10:return tl(e.type),zt(e),null;case 19:if(U(Ht),a=e.memoizedState,a===null)return zt(e),null;if(n=(e.flags&128)!==0,i=a.rendering,i===null)if(n)zn(a,!1);else{if(_t!==0||t!==null&&(t.flags&128)!==0)for(t=e.child;t!==null;){if(i=Cu(t),i!==null){for(e.flags|=128,zn(a,!1),t=i.updateQueue,e.updateQueue=t,Lu(e,t),e.subtreeFlags=0,t=l,l=e.child;l!==null;)sr(l,t),l=l.sibling;return Y(Ht,Ht.current&1|2),ft&&Ie(e,a.treeForkCount),e.child}t=t.sibling}a.tail!==null&&F()>Ju&&(e.flags|=128,n=!0,zn(a,!1),e.lanes=4194304)}else{if(!n)if(t=Cu(i),t!==null){if(e.flags|=128,n=!0,t=t.updateQueue,e.updateQueue=t,Lu(e,t),zn(a,!0),a.tail===null&&a.tailMode==="hidden"&&!i.alternate&&!ft)return zt(e),null}else 2*F()-a.renderingStartTime>Ju&&l!==536870912&&(e.flags|=128,n=!0,zn(a,!1),e.lanes=4194304);a.isBackwards?(i.sibling=e.child,e.child=i):(t=a.last,t!==null?t.sibling=i:e.child=i,a.last=i)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=F(),t.sibling=null,l=Ht.current,Y(Ht,n?l&1|2:l&1),ft&&Ie(e,a.treeForkCount),t):(zt(e),null);case 22:case 23:return pe(e),bc(),a=e.memoizedState!==null,t!==null?t.memoizedState!==null!==a&&(e.flags|=8192):a&&(e.flags|=8192),a?(l&536870912)!==0&&(e.flags&128)===0&&(zt(e),e.subtreeFlags&6&&(e.flags|=8192)):zt(e),l=e.updateQueue,l!==null&&Lu(e,l.retryQueue),l=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),a=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),a!==l&&(e.flags|=2048),t!==null&&U(Wl),null;case 24:return l=null,t!==null&&(l=t.memoizedState.cache),e.memoizedState.cache!==l&&(e.flags|=2048),tl(wt),zt(e),null;case 25:return null;case 30:return null}throw Error(r(156,e.tag))}function Cy(t,e){switch(nc(e),e.tag){case 1:return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return tl(wt),Ot(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 26:case 27:case 5:return ia(e),null;case 31:if(e.memoizedState!==null){if(pe(e),e.alternate===null)throw Error(r(340));kl()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 13:if(pe(e),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(r(340));kl()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return U(Ht),null;case 4:return Ot(),null;case 10:return tl(e.type),null;case 22:case 23:return pe(e),bc(),t!==null&&U(Wl),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 24:return tl(wt),null;case 25:return null;default:return null}}function qo(t,e){switch(nc(e),e.tag){case 3:tl(wt),Ot();break;case 26:case 27:case 5:ia(e);break;case 4:Ot();break;case 31:e.memoizedState!==null&&pe(e);break;case 13:pe(e);break;case 19:U(Ht);break;case 10:tl(e.type);break;case 22:case 23:pe(e),bc(),t!==null&&U(Wl);break;case 24:tl(wt)}}function Mn(t,e){try{var l=e.updateQueue,a=l!==null?l.lastEffect:null;if(a!==null){var n=a.next;l=n;do{if((l.tag&t)===t){a=void 0;var i=l.create,s=l.inst;a=i(),s.destroy=a}l=l.next}while(l!==n)}}catch(h){bt(e,e.return,h)}}function Al(t,e,l){try{var a=e.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var i=n.next;a=i;do{if((a.tag&t)===t){var s=a.inst,h=s.destroy;if(h!==void 0){s.destroy=void 0,n=e;var v=l,O=h;try{O()}catch(N){bt(n,v,N)}}}a=a.next}while(a!==i)}}catch(N){bt(e,e.return,N)}}function wo(t){var e=t.updateQueue;if(e!==null){var l=t.stateNode;try{Ar(e,l)}catch(a){bt(t,t.return,a)}}}function Qo(t,e,l){l.props=la(t.type,t.memoizedProps),l.state=t.memoizedState;try{l.componentWillUnmount()}catch(a){bt(t,e,a)}}function Cn(t,e){try{var l=t.ref;if(l!==null){switch(t.tag){case 26:case 27:case 5:var a=t.stateNode;break;case 30:a=t.stateNode;break;default:a=t.stateNode}typeof l=="function"?t.refCleanup=l(a):l.current=a}}catch(n){bt(t,e,n)}}function Xe(t,e){var l=t.ref,a=t.refCleanup;if(l!==null)if(typeof a=="function")try{a()}catch(n){bt(t,e,n)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(n){bt(t,e,n)}else l.current=null}function Bo(t){var e=t.type,l=t.memoizedProps,a=t.stateNode;try{t:switch(e){case"button":case"input":case"select":case"textarea":l.autoFocus&&a.focus();break t;case"img":l.src?a.src=l.src:l.srcSet&&(a.srcset=l.srcSet)}}catch(n){bt(t,t.return,n)}}function Wc(t,e,l){try{var a=t.stateNode;Wy(a,t.type,l,e),a[ne]=e}catch(n){bt(t,t.return,n)}}function Yo(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Rl(t.type)||t.tag===4}function Ic(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||Yo(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Rl(t.type)||t.flags&2||t.child===null||t.tag===4)continue t;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Pc(t,e,l){var a=t.tag;if(a===5||a===6)t=t.stateNode,e?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(t,e):(e=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,e.appendChild(t),l=l._reactRootContainer,l!=null||e.onclick!==null||(e.onclick=Fe));else if(a!==4&&(a===27&&Rl(t.type)&&(l=t.stateNode,e=null),t=t.child,t!==null))for(Pc(t,e,l),t=t.sibling;t!==null;)Pc(t,e,l),t=t.sibling}function Xu(t,e,l){var a=t.tag;if(a===5||a===6)t=t.stateNode,e?l.insertBefore(t,e):l.appendChild(t);else if(a!==4&&(a===27&&Rl(t.type)&&(l=t.stateNode),t=t.child,t!==null))for(Xu(t,e,l),t=t.sibling;t!==null;)Xu(t,e,l),t=t.sibling}function Go(t){var e=t.stateNode,l=t.memoizedProps;try{for(var a=t.type,n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Wt(e,a,l),e[Jt]=t,e[ne]=l}catch(i){bt(t,t.return,i)}}var ul=!1,Yt=!1,ts=!1,Lo=typeof WeakSet=="function"?WeakSet:Set,Zt=null;function Ny(t,e){if(t=t.containerInfo,xs=ri,t=Pf(t),Ji(t)){if("selectionStart"in t)var l={start:t.selectionStart,end:t.selectionEnd};else t:{l=(l=t.ownerDocument)&&l.defaultView||window;var a=l.getSelection&&l.getSelection();if(a&&a.rangeCount!==0){l=a.anchorNode;var n=a.anchorOffset,i=a.focusNode;a=a.focusOffset;try{l.nodeType,i.nodeType}catch{l=null;break t}var s=0,h=-1,v=-1,O=0,N=0,R=t,A=null;e:for(;;){for(var C;R!==l||n!==0&&R.nodeType!==3||(h=s+n),R!==i||a!==0&&R.nodeType!==3||(v=s+a),R.nodeType===3&&(s+=R.nodeValue.length),(C=R.firstChild)!==null;)A=R,R=C;for(;;){if(R===t)break e;if(A===l&&++O===n&&(h=s),A===i&&++N===a&&(v=s),(C=R.nextSibling)!==null)break;R=A,A=R.parentNode}R=C}l=h===-1||v===-1?null:{start:h,end:v}}else l=null}l=l||{start:0,end:0}}else l=null;for(Es={focusedElem:t,selectionRange:l},ri=!1,Zt=e;Zt!==null;)if(e=Zt,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Zt=t;else for(;Zt!==null;){switch(e=Zt,i=e.alternate,t=e.flags,e.tag){case 0:if((t&4)!==0&&(t=e.updateQueue,t=t!==null?t.events:null,t!==null))for(l=0;l title"))),Wt(i,a,l),i[Jt]=t,Kt(i),a=i;break t;case"link":var s=kh("link","href",n).get(a+(l.href||""));if(s){for(var h=0;hEt&&(s=Et,Et=k,k=s);var E=Wf(h,k),p=Wf(h,Et);if(E&&p&&(C.rangeCount!==1||C.anchorNode!==E.node||C.anchorOffset!==E.offset||C.focusNode!==p.node||C.focusOffset!==p.offset)){var T=R.createRange();T.setStart(E.node,E.offset),C.removeAllRanges(),k>Et?(C.addRange(T),C.extend(p.node,p.offset)):(T.setEnd(p.node,p.offset),C.addRange(T))}}}}for(R=[],C=h;C=C.parentNode;)C.nodeType===1&&R.push({element:C,left:C.scrollLeft,top:C.scrollTop});for(typeof h.focus=="function"&&h.focus(),h=0;hl?32:l,D.T=null,l=cs,cs=null;var i=Nl,s=rl;if(Lt=0,Ya=Nl=null,rl=0,(yt&6)!==0)throw Error(r(331));var h=yt;if(yt|=4,Po(i.current),$o(i,i.current,s,l),yt=h,Hn(0,!1),de&&typeof de.onPostCommitFiberRoot=="function")try{de.onPostCommitFiberRoot(Ia,i)}catch{}return!0}finally{B.p=n,D.T=a,gh(t,e)}}function bh(t,e,l){e=Me(l,e),e=Yc(t.stateNode,e,2),t=jl(t,e,2),t!==null&&(tn(t,2),Ke(t))}function bt(t,e,l){if(t.tag===3)bh(t,t,l);else for(;e!==null;){if(e.tag===3){bh(e,t,l);break}else if(e.tag===1){var a=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Cl===null||!Cl.has(a))){t=Me(l,t),l=So(2),a=jl(e,l,2),a!==null&&(xo(l,a,e,t),tn(a,2),Ke(a));break}}e=e.return}}function os(t,e,l){var a=t.pingCache;if(a===null){a=t.pingCache=new Ry;var n=new Set;a.set(e,n)}else n=a.get(e),n===void 0&&(n=new Set,a.set(e,n));n.has(l)||(as=!0,n.add(l),t=Qy.bind(null,t,e,l),e.then(t,t))}function Qy(t,e,l){var a=t.pingCache;a!==null&&a.delete(e),t.pingedLanes|=t.suspendedLanes&l,t.warmLanes&=~l,jt===t&&(ct&l)===l&&(_t===4||_t===3&&(ct&62914560)===ct&&300>F()-Vu?(yt&2)===0&&Ga(t,0):ns|=l,Ba===ct&&(Ba=0)),Ke(t)}function Sh(t,e){e===0&&(e=df()),t=Vl(t,e),t!==null&&(tn(t,e),Ke(t))}function By(t){var e=t.memoizedState,l=0;e!==null&&(l=e.retryLane),Sh(t,l)}function Yy(t,e){var l=0;switch(t.tag){case 31:case 13:var a=t.stateNode,n=t.memoizedState;n!==null&&(l=n.retryLane);break;case 19:a=t.stateNode;break;case 22:a=t.stateNode._retryCache;break;default:throw Error(r(314))}a!==null&&a.delete(e),Sh(t,l)}function Gy(t,e){return Te(t,e)}var Pu=null,Xa=null,hs=!1,ti=!1,ds=!1,_l=0;function Ke(t){t!==Xa&&t.next===null&&(Xa===null?Pu=Xa=t:Xa=Xa.next=t),ti=!0,hs||(hs=!0,Xy())}function Hn(t,e){if(!ds&&ti){ds=!0;do for(var l=!1,a=Pu;a!==null;){if(t!==0){var n=a.pendingLanes;if(n===0)var i=0;else{var s=a.suspendedLanes,h=a.pingedLanes;i=(1<<31-me(42|t)+1)-1,i&=n&~(s&~h),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(l=!0,Th(a,i))}else i=ct,i=nu(a,a===jt?i:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(i&3)===0||Pa(a,i)||(l=!0,Th(a,i));a=a.next}while(l);ds=!1}}function Ly(){xh()}function xh(){ti=hs=!1;var t=0;_l!==0&&Py()&&(t=_l);for(var e=F(),l=null,a=Pu;a!==null;){var n=a.next,i=Eh(a,e);i===0?(a.next=null,l===null?Pu=n:l.next=n,n===null&&(Xa=l)):(l=a,(t!==0||(i&3)!==0)&&(ti=!0)),a=n}Lt!==0&&Lt!==5||Hn(t),_l!==0&&(_l=0)}function Eh(t,e){for(var l=t.suspendedLanes,a=t.pingedLanes,n=t.expirationTimes,i=t.pendingLanes&-62914561;0h)break;var N=v.transferSize,R=v.initiatorType;N&&_h(R)&&(v=v.responseEnd,s+=N*(v"u"?null:document;function Kh(t,e,l){var a=Ka;if(a&&typeof e=="string"&&e){var n=Ae(e);n='link[rel="'+t+'"][href="'+n+'"]',typeof l=="string"&&(n+='[crossorigin="'+l+'"]'),Xh.has(n)||(Xh.add(n),t={rel:t,crossOrigin:l,href:e},a.querySelector(n)===null&&(e=a.createElement("link"),Wt(e,"link",t),Kt(e),a.head.appendChild(e)))}}function sv(t){ol.D(t),Kh("dns-prefetch",t,null)}function fv(t,e){ol.C(t,e),Kh("preconnect",t,e)}function rv(t,e,l){ol.L(t,e,l);var a=Ka;if(a&&t&&e){var n='link[rel="preload"][as="'+Ae(e)+'"]';e==="image"&&l&&l.imageSrcSet?(n+='[imagesrcset="'+Ae(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(n+='[imagesizes="'+Ae(l.imageSizes)+'"]')):n+='[href="'+Ae(t)+'"]';var i=n;switch(e){case"style":i=Za(t);break;case"script":i=Va(t)}Ue.has(i)||(t=x({rel:"preload",href:e==="image"&&l&&l.imageSrcSet?void 0:t,as:e},l),Ue.set(i,t),a.querySelector(n)!==null||e==="style"&&a.querySelector(Bn(i))||e==="script"&&a.querySelector(Yn(i))||(e=a.createElement("link"),Wt(e,"link",t),Kt(e),a.head.appendChild(e)))}}function ov(t,e){ol.m(t,e);var l=Ka;if(l&&t){var a=e&&typeof e.as=="string"?e.as:"script",n='link[rel="modulepreload"][as="'+Ae(a)+'"][href="'+Ae(t)+'"]',i=n;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=Va(t)}if(!Ue.has(i)&&(t=x({rel:"modulepreload",href:t},e),Ue.set(i,t),l.querySelector(n)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Yn(i)))return}a=l.createElement("link"),Wt(a,"link",t),Kt(a),l.head.appendChild(a)}}}function hv(t,e,l){ol.S(t,e,l);var a=Ka;if(a&&t){var n=da(a).hoistableStyles,i=Za(t);e=e||"default";var s=n.get(i);if(!s){var h={loading:0,preload:null};if(s=a.querySelector(Bn(i)))h.loading=5;else{t=x({rel:"stylesheet",href:t,"data-precedence":e},l),(l=Ue.get(i))&&Cs(t,l);var v=s=a.createElement("link");Kt(v),Wt(v,"link",t),v._p=new Promise(function(O,N){v.onload=O,v.onerror=N}),v.addEventListener("load",function(){h.loading|=1}),v.addEventListener("error",function(){h.loading|=2}),h.loading|=4,ui(s,e,a)}s={type:"stylesheet",instance:s,count:1,state:h},n.set(i,s)}}}function dv(t,e){ol.X(t,e);var l=Ka;if(l&&t){var a=da(l).hoistableScripts,n=Va(t),i=a.get(n);i||(i=l.querySelector(Yn(n)),i||(t=x({src:t,async:!0},e),(e=Ue.get(n))&&Ns(t,e),i=l.createElement("script"),Kt(i),Wt(i,"link",t),l.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},a.set(n,i))}}function mv(t,e){ol.M(t,e);var l=Ka;if(l&&t){var a=da(l).hoistableScripts,n=Va(t),i=a.get(n);i||(i=l.querySelector(Yn(n)),i||(t=x({src:t,async:!0,type:"module"},e),(e=Ue.get(n))&&Ns(t,e),i=l.createElement("script"),Kt(i),Wt(i,"link",t),l.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},a.set(n,i))}}function Zh(t,e,l,a){var n=(n=et.current)?ni(n):null;if(!n)throw Error(r(446));switch(t){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(e=Za(l.href),l=da(n).hoistableStyles,a=l.get(e),a||(a={type:"style",instance:null,count:0,state:null},l.set(e,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){t=Za(l.href);var i=da(n).hoistableStyles,s=i.get(t);if(s||(n=n.ownerDocument||n,s={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(t,s),(i=n.querySelector(Bn(t)))&&!i._p&&(s.instance=i,s.state.loading=5),Ue.has(t)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Ue.set(t,l),i||yv(n,t,l,s.state))),e&&a===null)throw Error(r(528,""));return s}if(e&&a!==null)throw Error(r(529,""));return null;case"script":return e=l.async,l=l.src,typeof l=="string"&&e&&typeof e!="function"&&typeof e!="symbol"?(e=Va(l),l=da(n).hoistableScripts,a=l.get(e),a||(a={type:"script",instance:null,count:0,state:null},l.set(e,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,t))}}function Za(t){return'href="'+Ae(t)+'"'}function Bn(t){return'link[rel="stylesheet"]['+t+"]"}function Vh(t){return x({},t,{"data-precedence":t.precedence,precedence:null})}function yv(t,e,l,a){t.querySelector('link[rel="preload"][as="style"]['+e+"]")?a.loading=1:(e=t.createElement("link"),a.preload=e,e.addEventListener("load",function(){return a.loading|=1}),e.addEventListener("error",function(){return a.loading|=2}),Wt(e,"link",l),Kt(e),t.head.appendChild(e))}function Va(t){return'[src="'+Ae(t)+'"]'}function Yn(t){return"script[async]"+t}function Jh(t,e,l){if(e.count++,e.instance===null)switch(e.type){case"style":var a=t.querySelector('style[data-href~="'+Ae(l.href)+'"]');if(a)return e.instance=a,Kt(a),a;var n=x({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return a=(t.ownerDocument||t).createElement("style"),Kt(a),Wt(a,"style",n),ui(a,l.precedence,t),e.instance=a;case"stylesheet":n=Za(l.href);var i=t.querySelector(Bn(n));if(i)return e.state.loading|=4,e.instance=i,Kt(i),i;a=Vh(l),(n=Ue.get(n))&&Cs(a,n),i=(t.ownerDocument||t).createElement("link"),Kt(i);var s=i;return s._p=new Promise(function(h,v){s.onload=h,s.onerror=v}),Wt(i,"link",a),e.state.loading|=4,ui(i,l.precedence,t),e.instance=i;case"script":return i=Va(l.src),(n=t.querySelector(Yn(i)))?(e.instance=n,Kt(n),n):(a=l,(n=Ue.get(i))&&(a=x({},l),Ns(a,n)),t=t.ownerDocument||t,n=t.createElement("script"),Kt(n),Wt(n,"link",a),t.head.appendChild(n),e.instance=n);case"void":return null;default:throw Error(r(443,e.type))}else e.type==="stylesheet"&&(e.state.loading&4)===0&&(a=e.instance,e.state.loading|=4,ui(a,l.precedence,t));return e.instance}function ui(t,e,l){for(var a=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=a.length?a[a.length-1]:null,i=n,s=0;s title"):null)}function vv(t,e,l){if(l===1||e.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof e.precedence!="string"||typeof e.href!="string"||e.href==="")break;return!0;case"link":if(typeof e.rel!="string"||typeof e.href!="string"||e.href===""||e.onLoad||e.onError)break;return e.rel==="stylesheet"?(t=e.disabled,typeof e.precedence=="string"&&t==null):!0;case"script":if(e.async&&typeof e.async!="function"&&typeof e.async!="symbol"&&!e.onLoad&&!e.onError&&e.src&&typeof e.src=="string")return!0}return!1}function $h(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function gv(t,e,l,a){if(l.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var n=Za(a.href),i=e.querySelector(Bn(n));if(i){e=i._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(t.count++,t=ci.bind(t),e.then(t,t)),l.state.loading|=4,l.instance=i,Kt(i);return}i=e.ownerDocument||e,a=Vh(a),(n=Ue.get(n))&&Cs(a,n),i=i.createElement("link"),Kt(i);var s=i;s._p=new Promise(function(h,v){s.onload=h,s.onerror=v}),Wt(i,"link",a),l.instance=i}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(l,e),(e=l.state.preload)&&(l.state.loading&3)===0&&(t.count++,l=ci.bind(t),e.addEventListener("load",l),e.addEventListener("error",l))}}var Ds=0;function pv(t,e){return t.stylesheets&&t.count===0&&fi(t,t.stylesheets),0Ds?50:800)+e);return t.unsuspend=l,function(){t.unsuspend=null,clearTimeout(a),clearTimeout(n)}}:null}function ci(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)fi(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var si=null;function fi(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,si=new Map,e.forEach(bv,t),si=null,ci.call(t))}function bv(t,e){if(!(e.state.loading&4)){var l=si.get(t);if(l)var a=l.get(null);else{l=new Map,si.set(t,l);for(var n=t.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(u)}catch(c){console.error(c)}}return u(),Ys.exports=Hv(),Ys.exports}var wv=qv(),tu=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(u){return this.listeners.add(u),this.onSubscribe(),()=>{this.listeners.delete(u),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Qv=class extends tu{#t;#e;#l;constructor(){super(),this.#l=u=>{if(typeof window<"u"&&window.addEventListener){const c=()=>u();return window.addEventListener("visibilitychange",c,!1),()=>{window.removeEventListener("visibilitychange",c)}}}}onSubscribe(){this.#e||this.setEventListener(this.#l)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(u){this.#l=u,this.#e?.(),this.#e=u(c=>{typeof c=="boolean"?this.setFocused(c):this.onFocus()})}setFocused(u){this.#t!==u&&(this.#t=u,this.onFocus())}onFocus(){const u=this.isFocused();this.listeners.forEach(c=>{c(u)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},ef=new Qv,Bv={setTimeout:(u,c)=>setTimeout(u,c),clearTimeout:u=>clearTimeout(u),setInterval:(u,c)=>setInterval(u,c),clearInterval:u=>clearInterval(u)},Yv=class{#t=Bv;#e=!1;setTimeoutProvider(u){this.#t=u}setTimeout(u,c){return this.#t.setTimeout(u,c)}clearTimeout(u){this.#t.clearTimeout(u)}setInterval(u,c){return this.#t.setInterval(u,c)}clearInterval(u){this.#t.clearInterval(u)}},ua=new Yv;function Gv(u){setTimeout(u,0)}var Lv=typeof window>"u"||"Deno"in globalThis;function oe(){}function Xv(u,c){return typeof u=="function"?u(c):u}function Vs(u){return typeof u=="number"&&u>=0&&u!==1/0}function Yd(u,c){return Math.max(u+(c||0)-Date.now(),0)}function Bl(u,c){return typeof u=="function"?u(c):u}function Ee(u,c){return typeof u=="function"?u(c):u}function Sd(u,c){const{type:f="all",exact:r,fetchStatus:o,predicate:m,queryKey:S,stale:M}=u;if(S){if(r){if(c.queryHash!==lf(S,c.options))return!1}else if(!Fn(c.queryKey,S))return!1}if(f!=="all"){const g=c.isActive();if(f==="active"&&!g||f==="inactive"&&g)return!1}return!(typeof M=="boolean"&&c.isStale()!==M||o&&o!==c.state.fetchStatus||m&&!m(c))}function xd(u,c){const{exact:f,status:r,predicate:o,mutationKey:m}=u;if(m){if(!c.options.mutationKey)return!1;if(f){if(kn(c.options.mutationKey)!==kn(m))return!1}else if(!Fn(c.options.mutationKey,m))return!1}return!(r&&c.state.status!==r||o&&!o(c))}function lf(u,c){return(c?.queryKeyHashFn||kn)(u)}function kn(u){return JSON.stringify(u,(c,f)=>ks(f)?Object.keys(f).sort().reduce((r,o)=>(r[o]=f[o],r),{}):f)}function Fn(u,c){return u===c?!0:typeof u!=typeof c?!1:u&&c&&typeof u=="object"&&typeof c=="object"?Object.keys(c).every(f=>Fn(u[f],c[f])):!1}var Kv=Object.prototype.hasOwnProperty;function Gd(u,c,f=0){if(u===c)return u;if(f>500)return c;const r=Ed(u)&&Ed(c);if(!r&&!(ks(u)&&ks(c)))return c;const m=(r?u:Object.keys(u)).length,S=r?c:Object.keys(c),M=S.length,g=r?new Array(M):{};let y=0;for(let z=0;z{ua.setTimeout(c,u)})}function Fs(u,c,f){return typeof f.structuralSharing=="function"?f.structuralSharing(u,c):f.structuralSharing!==!1?Gd(u,c):c}function Vv(u,c,f=0){const r=[...u,c];return f&&r.length>f?r.slice(1):r}function Jv(u,c,f=0){const r=[c,...u];return f&&r.length>f?r.slice(0,-1):r}var af=Symbol();function Ld(u,c){return!u.queryFn&&c?.initialPromise?()=>c.initialPromise:!u.queryFn||u.queryFn===af?()=>Promise.reject(new Error(`Missing queryFn: '${u.queryHash}'`)):u.queryFn}function Xd(u,c){return typeof u=="function"?u(...c):!!u}function kv(u,c,f){let r=!1,o;return Object.defineProperty(u,"signal",{enumerable:!0,get:()=>(o??=c(),r||(r=!0,o.aborted?f():o.addEventListener("abort",f,{once:!0})),o)}),u}var $n=(()=>{let u=()=>Lv;return{isServer(){return u()},setIsServer(c){u=c}}})();function $s(){let u,c;const f=new Promise((o,m)=>{u=o,c=m});f.status="pending",f.catch(()=>{});function r(o){Object.assign(f,o),delete f.resolve,delete f.reject}return f.resolve=o=>{r({status:"fulfilled",value:o}),u(o)},f.reject=o=>{r({status:"rejected",reason:o}),c(o)},f}var Fv=Gv;function $v(){let u=[],c=0,f=M=>{M()},r=M=>{M()},o=Fv;const m=M=>{c?u.push(M):o(()=>{f(M)})},S=()=>{const M=u;u=[],M.length&&o(()=>{r(()=>{M.forEach(g=>{f(g)})})})};return{batch:M=>{let g;c++;try{g=M()}finally{c--,c||S()}return g},batchCalls:M=>(...g)=>{m(()=>{M(...g)})},schedule:m,setNotifyFunction:M=>{f=M},setBatchNotifyFunction:M=>{r=M},setScheduler:M=>{o=M}}}var It=$v(),Wv=class extends tu{#t=!0;#e;#l;constructor(){super(),this.#l=u=>{if(typeof window<"u"&&window.addEventListener){const c=()=>u(!0),f=()=>u(!1);return window.addEventListener("online",c,!1),window.addEventListener("offline",f,!1),()=>{window.removeEventListener("online",c),window.removeEventListener("offline",f)}}}}onSubscribe(){this.#e||this.setEventListener(this.#l)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(u){this.#l=u,this.#e?.(),this.#e=u(this.setOnline.bind(this))}setOnline(u){this.#t!==u&&(this.#t=u,this.listeners.forEach(f=>{f(u)}))}isOnline(){return this.#t}},xi=new Wv;function Iv(u){return Math.min(1e3*2**u,3e4)}function Kd(u){return(u??"online")==="online"?xi.isOnline():!0}var Ws=class extends Error{constructor(u){super("CancelledError"),this.revert=u?.revert,this.silent=u?.silent}};function Zd(u){let c=!1,f=0,r;const o=$s(),m=()=>o.status!=="pending",S=Q=>{if(!m()){const G=new Ws(Q);j(G),u.onCancel?.(G)}},M=()=>{c=!0},g=()=>{c=!1},y=()=>ef.isFocused()&&(u.networkMode==="always"||xi.isOnline())&&u.canRun(),z=()=>Kd(u.networkMode)&&u.canRun(),x=Q=>{m()||(r?.(),o.resolve(Q))},j=Q=>{m()||(r?.(),o.reject(Q))},H=()=>new Promise(Q=>{r=G=>{(m()||y())&&Q(G)},u.onPause?.()}).then(()=>{r=void 0,m()||u.onContinue?.()}),w=()=>{if(m())return;let Q;const G=f===0?u.initialPromise:void 0;try{Q=G??u.fn()}catch(L){Q=Promise.reject(L)}Promise.resolve(Q).then(x).catch(L=>{if(m())return;const $=u.retry??($n.isServer()?0:3),nt=u.retryDelay??Iv,Nt=typeof nt=="function"?nt(f,L):nt,Mt=$===!0||typeof $=="number"&&f<$||typeof $=="function"&&$(f,L);if(c||!Mt){j(L);return}f++,u.onFail?.(f,L),Zv(Nt).then(()=>y()?void 0:H()).then(()=>{c?j(L):w()})})};return{promise:o,status:()=>o.status,cancel:S,continue:()=>(r?.(),o),cancelRetry:M,continueRetry:g,canStart:z,start:()=>(z()?w():H().then(w),o)}}var Vd=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Vs(this.gcTime)&&(this.#t=ua.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(u){this.gcTime=Math.max(this.gcTime||0,u??($n.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#t!==void 0&&(ua.clearTimeout(this.#t),this.#t=void 0)}};function Pv(u){return{onFetch:(c,f)=>{const r=c.options,o=c.fetchOptions?.meta?.fetchMore?.direction,m=c.state.data?.pages||[],S=c.state.data?.pageParams||[];let M={pages:[],pageParams:[]},g=0;const y=async()=>{let z=!1;const x=w=>{kv(w,()=>c.signal,()=>z=!0)},j=Ld(c.options,c.fetchOptions),H=async(w,Q,G)=>{if(z)return Promise.reject(c.signal.reason);if(Q==null&&w.pages.length)return Promise.resolve(w);const $=(()=>{const Rt={client:c.client,queryKey:c.queryKey,pageParam:Q,direction:G?"backward":"forward",meta:c.options.meta};return x(Rt),Rt})(),nt=await j($),{maxPages:Nt}=c.options,Mt=G?Jv:Vv;return{pages:Mt(w.pages,nt,Nt),pageParams:Mt(w.pageParams,Q,Nt)}};if(o&&m.length){const w=o==="backward",Q=w?t0:Td,G={pages:m,pageParams:S},L=Q(r,G);M=await H(G,L,w)}else{const w=u??m.length;do{const Q=g===0?S[0]??r.initialPageParam:Td(r,M);if(g>0&&Q==null)break;M=await H(M,Q),g++}while(gc.options.persister?.(y,{client:c.client,queryKey:c.queryKey,meta:c.options.meta,signal:c.signal},f):c.fetchFn=y}}}function Td(u,{pages:c,pageParams:f}){const r=c.length-1;return c.length>0?u.getNextPageParam(c[r],c,f[r],f):void 0}function t0(u,{pages:c,pageParams:f}){return c.length>0?u.getPreviousPageParam?.(c[0],c,f[0],f):void 0}var e0=class extends Vd{#t;#e;#l;#a;#u;#n;#c;#i;constructor(u){super(),this.#i=!1,this.#c=u.defaultOptions,this.setOptions(u.options),this.observers=[],this.#u=u.client,this.#a=this.#u.getQueryCache(),this.queryKey=u.queryKey,this.queryHash=u.queryHash,this.#e=Ad(this.options),this.state=u.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#t}get promise(){return this.#n?.promise}setOptions(u){if(this.options={...this.#c,...u},u?._type&&(this.#t=u._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const c=Ad(this.options);c.data!==void 0&&(this.setState(Od(c.data,c.dataUpdatedAt)),this.#e=c)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#a.remove(this)}setData(u,c){const f=Fs(this.state.data,u,this.options);return this.#s({data:f,type:"success",dataUpdatedAt:c?.updatedAt,manual:c?.manual}),f}setState(u){this.#s({type:"setState",state:u})}cancel(u){const c=this.#n?.promise;return this.#n?.cancel(u),c?c.then(oe).catch(oe):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(u=>Ee(u.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===af||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(u=>Bl(u.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(u=>u.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(u=0){return this.state.data===void 0?!0:u==="static"?!1:this.state.isInvalidated?!0:!Yd(this.state.dataUpdatedAt,u)}onFocus(){this.observers.find(c=>c.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(c=>c.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(u){this.observers.includes(u)||(this.observers.push(u),this.clearGcTimeout(),this.#a.notify({type:"observerAdded",query:this,observer:u}))}removeObserver(u){this.observers.includes(u)&&(this.observers=this.observers.filter(c=>c!==u),this.observers.length||(this.#n&&(this.#i||this.#r()?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#a.notify({type:"observerRemoved",query:this,observer:u}))}getObserversCount(){return this.observers.length}#r(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}async fetch(u,c){if(this.state.fetchStatus!=="idle"&&this.#n?.status()!=="rejected"){if(this.state.data!==void 0&&c?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(u&&this.setOptions(u),!this.options.queryFn){const g=this.observers.find(y=>y.options.queryFn);g&&this.setOptions(g.options)}const f=new AbortController,r=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(this.#i=!0,f.signal)})},o=()=>{const g=Ld(this.options,c),z=(()=>{const x={client:this.#u,queryKey:this.queryKey,meta:this.meta};return r(x),x})();return this.#i=!1,this.options.persister?this.options.persister(g,z,this):g(z)},S=(()=>{const g={fetchOptions:c,options:this.options,queryKey:this.queryKey,client:this.#u,state:this.state,fetchFn:o};return r(g),g})();(this.#t==="infinite"?Pv(this.options.pages):this.options.behavior)?.onFetch(S,this),this.#l=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==S.fetchOptions?.meta)&&this.#s({type:"fetch",meta:S.fetchOptions?.meta}),this.#n=Zd({initialPromise:c?.initialPromise,fn:S.fetchFn,onCancel:g=>{g instanceof Ws&&g.revert&&this.setState({...this.#l,fetchStatus:"idle"}),f.abort()},onFail:(g,y)=>{this.#s({type:"failed",failureCount:g,error:y})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:S.options.retry,retryDelay:S.options.retryDelay,networkMode:S.options.networkMode,canRun:()=>!0});try{const g=await this.#n.start();if(g===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(g),this.#a.config.onSuccess?.(g,this),this.#a.config.onSettled?.(g,this.state.error,this),g}catch(g){if(g instanceof Ws){if(g.silent)return this.#n.promise;if(g.revert){if(this.state.data===void 0)throw g;return this.state.data}}throw this.#s({type:"error",error:g}),this.#a.config.onError?.(g,this),this.#a.config.onSettled?.(this.state.data,g,this),g}finally{this.scheduleGc()}}#s(u){const c=f=>{switch(u.type){case"failed":return{...f,fetchFailureCount:u.failureCount,fetchFailureReason:u.error};case"pause":return{...f,fetchStatus:"paused"};case"continue":return{...f,fetchStatus:"fetching"};case"fetch":return{...f,...Jd(f.data,this.options),fetchMeta:u.meta??null};case"success":const r={...f,...Od(u.data,u.dataUpdatedAt),dataUpdateCount:f.dataUpdateCount+1,...!u.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=u.manual?r:void 0,r;case"error":const o=u.error;return{...f,error:o,errorUpdateCount:f.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:f.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...f,isInvalidated:!0};case"setState":return{...f,...u.state}}};this.state=c(this.state),It.batch(()=>{this.observers.forEach(f=>{f.onQueryUpdate()}),this.#a.notify({query:this,type:"updated",action:u})})}};function Jd(u,c){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Kd(c.networkMode)?"fetching":"paused",...u===void 0&&{error:null,status:"pending"}}}function Od(u,c){return{data:u,dataUpdatedAt:c??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ad(u){const c=typeof u.initialData=="function"?u.initialData():u.initialData,f=c!==void 0,r=f?typeof u.initialDataUpdatedAt=="function"?u.initialDataUpdatedAt():u.initialDataUpdatedAt:0;return{data:c,dataUpdateCount:0,dataUpdatedAt:f?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:f?"success":"pending",fetchStatus:"idle"}}var l0=class extends tu{constructor(u,c){super(),this.options=c,this.#t=u,this.#i=null,this.#c=$s(),this.bindMethods(),this.setOptions(c)}#t;#e=void 0;#l=void 0;#a=void 0;#u;#n;#c;#i;#r;#s;#m;#o;#h;#f;#y=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),zd(this.#e,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Is(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Is(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#S(),this.#x(),this.#e.removeObserver(this)}setOptions(u){const c=this.options,f=this.#e;if(this.options=this.#t.defaultQueryOptions(u),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ee(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#E(),this.#e.setOptions(this.options),c._defaulted&&!Js(this.options,c)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&Md(this.#e,f,this.options,c)&&this.#d(),this.updateResult(),r&&(this.#e!==f||Ee(this.options.enabled,this.#e)!==Ee(c.enabled,this.#e)||Bl(this.options.staleTime,this.#e)!==Bl(c.staleTime,this.#e))&&this.#v();const o=this.#g();r&&(this.#e!==f||Ee(this.options.enabled,this.#e)!==Ee(c.enabled,this.#e)||o!==this.#f)&&this.#p(o)}getOptimisticResult(u){const c=this.#t.getQueryCache().build(this.#t,u),f=this.createResult(c,u);return n0(this,f)&&(this.#a=f,this.#n=this.options,this.#u=this.#e.state),f}getCurrentResult(){return this.#a}trackResult(u,c){return new Proxy(u,{get:(f,r)=>(this.trackProp(r),c?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#c.status==="pending"&&this.#c.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(f,r))})}trackProp(u){this.#y.add(u)}getCurrentQuery(){return this.#e}refetch({...u}={}){return this.fetch({...u})}fetchOptimistic(u){const c=this.#t.defaultQueryOptions(u),f=this.#t.getQueryCache().build(this.#t,c);return f.fetch().then(()=>this.createResult(f,c))}fetch(u){return this.#d({...u,cancelRefetch:u.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#a))}#d(u){this.#E();let c=this.#e.fetch(this.options,u);return u?.throwOnError||(c=c.catch(oe)),c}#v(){this.#S();const u=Bl(this.options.staleTime,this.#e);if($n.isServer()||this.#a.isStale||!Vs(u))return;const f=Yd(this.#a.dataUpdatedAt,u)+1;this.#o=ua.setTimeout(()=>{this.#a.isStale||this.updateResult()},f)}#g(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#p(u){this.#x(),this.#f=u,!($n.isServer()||Ee(this.options.enabled,this.#e)===!1||!Vs(this.#f)||this.#f===0)&&(this.#h=ua.setInterval(()=>{(this.options.refetchIntervalInBackground||ef.isFocused())&&this.#d()},this.#f))}#b(){this.#v(),this.#p(this.#g())}#S(){this.#o!==void 0&&(ua.clearTimeout(this.#o),this.#o=void 0)}#x(){this.#h!==void 0&&(ua.clearInterval(this.#h),this.#h=void 0)}createResult(u,c){const f=this.#e,r=this.options,o=this.#a,m=this.#u,S=this.#n,g=u!==f?u.state:this.#l,{state:y}=u;let z={...y},x=!1,j;if(c._optimisticResults){const rt=this.hasListeners(),Gt=!rt&&zd(u,c),ae=rt&&Md(u,f,c,r);(Gt||ae)&&(z={...z,...Jd(y.data,u.options)}),c._optimisticResults==="isRestoring"&&(z.fetchStatus="idle")}let{error:H,errorUpdatedAt:w,status:Q}=z;j=z.data;let G=!1;if(c.placeholderData!==void 0&&j===void 0&&Q==="pending"){let rt;o?.isPlaceholderData&&c.placeholderData===S?.placeholderData?(rt=o.data,G=!0):rt=typeof c.placeholderData=="function"?c.placeholderData(this.#m?.state.data,this.#m):c.placeholderData,rt!==void 0&&(Q="success",j=Fs(o?.data,rt,c),x=!0)}if(c.select&&j!==void 0&&!G)if(o&&j===m?.data&&c.select===this.#r)j=this.#s;else try{this.#r=c.select,j=c.select(j),j=Fs(o?.data,j,c),this.#s=j,this.#i=null}catch(rt){this.#i=rt}this.#i&&(H=this.#i,j=this.#s,w=Date.now(),Q="error");const L=z.fetchStatus==="fetching",$=Q==="pending",nt=Q==="error",Nt=$&&L,Mt=j!==void 0,W={status:Q,fetchStatus:z.fetchStatus,isPending:$,isSuccess:Q==="success",isError:nt,isInitialLoading:Nt,isLoading:Nt,data:j,dataUpdatedAt:z.dataUpdatedAt,error:H,errorUpdatedAt:w,failureCount:z.fetchFailureCount,failureReason:z.fetchFailureReason,errorUpdateCount:z.errorUpdateCount,isFetched:u.isFetched(),isFetchedAfterMount:z.dataUpdateCount>g.dataUpdateCount||z.errorUpdateCount>g.errorUpdateCount,isFetching:L,isRefetching:L&&!$,isLoadingError:nt&&!Mt,isPaused:z.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:nt&&Mt,isStale:nf(u,c),refetch:this.refetch,promise:this.#c,isEnabled:Ee(c.enabled,u)!==!1};if(this.options.experimental_prefetchInRender){const rt=W.data!==void 0,Gt=W.status==="error"&&!rt,ae=Tt=>{Gt?Tt.reject(W.error):rt&&Tt.resolve(W.data)},Vt=()=>{const Tt=this.#c=W.promise=$s();ae(Tt)},Ut=this.#c;switch(Ut.status){case"pending":u.queryHash===f.queryHash&&ae(Ut);break;case"fulfilled":(Gt||W.data!==Ut.value)&&Vt();break;case"rejected":(!Gt||W.error!==Ut.reason)&&Vt();break}}return W}updateResult(){const u=this.#a,c=this.createResult(this.#e,this.options);if(this.#u=this.#e.state,this.#n=this.options,this.#u.data!==void 0&&(this.#m=this.#e),Js(c,u))return;this.#a=c;const f=()=>{if(!u)return!0;const{notifyOnChangeProps:r}=this.options,o=typeof r=="function"?r():r;if(o==="all"||!o&&!this.#y.size)return!0;const m=new Set(o??this.#y);return this.options.throwOnError&&m.add("error"),Object.keys(this.#a).some(S=>{const M=S;return this.#a[M]!==u[M]&&m.has(M)})};this.#j({listeners:f()})}#E(){const u=this.#t.getQueryCache().build(this.#t,this.options);if(u===this.#e)return;const c=this.#e;this.#e=u,this.#l=u.state,this.hasListeners()&&(c?.removeObserver(this),u.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#j(u){It.batch(()=>{u.listeners&&this.listeners.forEach(c=>{c(this.#a)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function a0(u,c){return Ee(c.enabled,u)!==!1&&u.state.data===void 0&&!(u.state.status==="error"&&Ee(c.retryOnMount,u)===!1)}function zd(u,c){return a0(u,c)||u.state.data!==void 0&&Is(u,c,c.refetchOnMount)}function Is(u,c,f){if(Ee(c.enabled,u)!==!1&&Bl(c.staleTime,u)!=="static"){const r=typeof f=="function"?f(u):f;return r==="always"||r!==!1&&nf(u,c)}return!1}function Md(u,c,f,r){return(u!==c||Ee(r.enabled,u)===!1)&&(!f.suspense||u.state.status!=="error")&&nf(u,f)}function nf(u,c){return Ee(c.enabled,u)!==!1&&u.isStaleByTime(Bl(c.staleTime,u))}function n0(u,c){return!Js(u.getCurrentResult(),c)}var u0=class extends Vd{#t;#e;#l;#a;constructor(u){super(),this.#t=u.client,this.mutationId=u.mutationId,this.#l=u.mutationCache,this.#e=[],this.state=u.state||i0(),this.setOptions(u.options),this.scheduleGc()}setOptions(u){this.options=u,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(u){this.#e.includes(u)||(this.#e.push(u),this.clearGcTimeout(),this.#l.notify({type:"observerAdded",mutation:this,observer:u}))}removeObserver(u){this.#e=this.#e.filter(c=>c!==u),this.scheduleGc(),this.#l.notify({type:"observerRemoved",mutation:this,observer:u})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#l.remove(this))}continue(){return this.#a?.continue()??this.execute(this.state.variables)}async execute(u){const c=()=>{this.#u({type:"continue"})},f={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#a=Zd({fn:()=>this.options.mutationFn?this.options.mutationFn(u,f):Promise.reject(new Error("No mutationFn found")),onFail:(m,S)=>{this.#u({type:"failed",failureCount:m,error:S})},onPause:()=>{this.#u({type:"pause"})},onContinue:c,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#l.canRun(this)});const r=this.state.status==="pending",o=!this.#a.canStart();try{if(r)c();else{this.#u({type:"pending",variables:u,isPaused:o}),this.#l.config.onMutate&&await this.#l.config.onMutate(u,this,f);const S=await this.options.onMutate?.(u,f);S!==this.state.context&&this.#u({type:"pending",context:S,variables:u,isPaused:o})}const m=await this.#a.start();return await this.#l.config.onSuccess?.(m,u,this.state.context,this,f),await this.options.onSuccess?.(m,u,this.state.context,f),await this.#l.config.onSettled?.(m,null,this.state.variables,this.state.context,this,f),await this.options.onSettled?.(m,null,u,this.state.context,f),this.#u({type:"success",data:m}),m}catch(m){try{await this.#l.config.onError?.(m,u,this.state.context,this,f)}catch(S){Promise.reject(S)}try{await this.options.onError?.(m,u,this.state.context,f)}catch(S){Promise.reject(S)}try{await this.#l.config.onSettled?.(void 0,m,this.state.variables,this.state.context,this,f)}catch(S){Promise.reject(S)}try{await this.options.onSettled?.(void 0,m,u,this.state.context,f)}catch(S){Promise.reject(S)}throw this.#u({type:"error",error:m}),m}finally{this.#l.runNext(this)}}#u(u){const c=f=>{switch(u.type){case"failed":return{...f,failureCount:u.failureCount,failureReason:u.error};case"pause":return{...f,isPaused:!0};case"continue":return{...f,isPaused:!1};case"pending":return{...f,context:u.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:u.isPaused,status:"pending",variables:u.variables,submittedAt:Date.now()};case"success":return{...f,data:u.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...f,data:void 0,error:u.error,failureCount:f.failureCount+1,failureReason:u.error,isPaused:!1,status:"error"}}};this.state=c(this.state),It.batch(()=>{this.#e.forEach(f=>{f.onMutationUpdate(u)}),this.#l.notify({mutation:this,type:"updated",action:u})})}};function i0(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var c0=class extends tu{constructor(u={}){super(),this.config=u,this.#t=new Set,this.#e=new Map,this.#l=0}#t;#e;#l;build(u,c,f){const r=new u0({client:u,mutationCache:this,mutationId:++this.#l,options:u.defaultMutationOptions(c),state:f});return this.add(r),r}add(u){this.#t.add(u);const c=gi(u);if(typeof c=="string"){const f=this.#e.get(c);f?f.push(u):this.#e.set(c,[u])}this.notify({type:"added",mutation:u})}remove(u){if(this.#t.delete(u)){const c=gi(u);if(typeof c=="string"){const f=this.#e.get(c);if(f)if(f.length>1){const r=f.indexOf(u);r!==-1&&f.splice(r,1)}else f[0]===u&&this.#e.delete(c)}}this.notify({type:"removed",mutation:u})}canRun(u){const c=gi(u);if(typeof c=="string"){const r=this.#e.get(c)?.find(o=>o.state.status==="pending");return!r||r===u}else return!0}runNext(u){const c=gi(u);return typeof c=="string"?this.#e.get(c)?.find(r=>r!==u&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){It.batch(()=>{this.#t.forEach(u=>{this.notify({type:"removed",mutation:u})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(u){const c={exact:!0,...u};return this.getAll().find(f=>xd(c,f))}findAll(u={}){return this.getAll().filter(c=>xd(u,c))}notify(u){It.batch(()=>{this.listeners.forEach(c=>{c(u)})})}resumePausedMutations(){const u=this.getAll().filter(c=>c.state.isPaused);return It.batch(()=>Promise.all(u.map(c=>c.continue().catch(oe))))}};function gi(u){return u.options.scope?.id}var s0=class extends tu{constructor(u={}){super(),this.config=u,this.#t=new Map}#t;build(u,c,f){const r=c.queryKey,o=c.queryHash??lf(r,c);let m=this.get(o);return m||(m=new e0({client:u,queryKey:r,queryHash:o,options:u.defaultQueryOptions(c),state:f,defaultOptions:u.getQueryDefaults(r)}),this.add(m)),m}add(u){this.#t.has(u.queryHash)||(this.#t.set(u.queryHash,u),this.notify({type:"added",query:u}))}remove(u){const c=this.#t.get(u.queryHash);c&&(u.destroy(),c===u&&this.#t.delete(u.queryHash),this.notify({type:"removed",query:u}))}clear(){It.batch(()=>{this.getAll().forEach(u=>{this.remove(u)})})}get(u){return this.#t.get(u)}getAll(){return[...this.#t.values()]}find(u){const c={exact:!0,...u};return this.getAll().find(f=>Sd(c,f))}findAll(u={}){const c=this.getAll();return Object.keys(u).length>0?c.filter(f=>Sd(u,f)):c}notify(u){It.batch(()=>{this.listeners.forEach(c=>{c(u)})})}onFocus(){It.batch(()=>{this.getAll().forEach(u=>{u.onFocus()})})}onOnline(){It.batch(()=>{this.getAll().forEach(u=>{u.onOnline()})})}},f0=class{#t;#e;#l;#a;#u;#n;#c;#i;constructor(u={}){this.#t=u.queryCache||new s0,this.#e=u.mutationCache||new c0,this.#l=u.defaultOptions||{},this.#a=new Map,this.#u=new Map,this.#n=0}mount(){this.#n++,this.#n===1&&(this.#c=ef.subscribe(async u=>{u&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#i=xi.subscribe(async u=>{u&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#n--,this.#n===0&&(this.#c?.(),this.#c=void 0,this.#i?.(),this.#i=void 0)}isFetching(u){return this.#t.findAll({...u,fetchStatus:"fetching"}).length}isMutating(u){return this.#e.findAll({...u,status:"pending"}).length}getQueryData(u){const c=this.defaultQueryOptions({queryKey:u});return this.#t.get(c.queryHash)?.state.data}ensureQueryData(u){const c=this.defaultQueryOptions(u),f=this.#t.build(this,c),r=f.state.data;return r===void 0?this.fetchQuery(u):(u.revalidateIfStale&&f.isStaleByTime(Bl(c.staleTime,f))&&this.prefetchQuery(c),Promise.resolve(r))}getQueriesData(u){return this.#t.findAll(u).map(({queryKey:c,state:f})=>{const r=f.data;return[c,r]})}setQueryData(u,c,f){const r=this.defaultQueryOptions({queryKey:u}),m=this.#t.get(r.queryHash)?.state.data,S=Xv(c,m);if(S!==void 0)return this.#t.build(this,r).setData(S,{...f,manual:!0})}setQueriesData(u,c,f){return It.batch(()=>this.#t.findAll(u).map(({queryKey:r})=>[r,this.setQueryData(r,c,f)]))}getQueryState(u){const c=this.defaultQueryOptions({queryKey:u});return this.#t.get(c.queryHash)?.state}removeQueries(u){const c=this.#t;It.batch(()=>{c.findAll(u).forEach(f=>{c.remove(f)})})}resetQueries(u,c){const f=this.#t;return It.batch(()=>(f.findAll(u).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...u},c)))}cancelQueries(u,c={}){const f={revert:!0,...c},r=It.batch(()=>this.#t.findAll(u).map(o=>o.cancel(f)));return Promise.all(r).then(oe).catch(oe)}invalidateQueries(u,c={}){return It.batch(()=>(this.#t.findAll(u).forEach(f=>{f.invalidate()}),u?.refetchType==="none"?Promise.resolve():this.refetchQueries({...u,type:u?.refetchType??u?.type??"active"},c)))}refetchQueries(u,c={}){const f={...c,cancelRefetch:c.cancelRefetch??!0},r=It.batch(()=>this.#t.findAll(u).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let m=o.fetch(void 0,f);return f.throwOnError||(m=m.catch(oe)),o.state.fetchStatus==="paused"?Promise.resolve():m}));return Promise.all(r).then(oe)}fetchQuery(u){const c=this.defaultQueryOptions(u);c.retry===void 0&&(c.retry=!1);const f=this.#t.build(this,c);return f.isStaleByTime(Bl(c.staleTime,f))?f.fetch(c):Promise.resolve(f.state.data)}prefetchQuery(u){return this.fetchQuery(u).then(oe).catch(oe)}fetchInfiniteQuery(u){return u._type="infinite",this.fetchQuery(u)}prefetchInfiniteQuery(u){return this.fetchInfiniteQuery(u).then(oe).catch(oe)}ensureInfiniteQueryData(u){return u._type="infinite",this.ensureQueryData(u)}resumePausedMutations(){return xi.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#l}setDefaultOptions(u){this.#l=u}setQueryDefaults(u,c){this.#a.set(kn(u),{queryKey:u,defaultOptions:c})}getQueryDefaults(u){const c=[...this.#a.values()],f={};return c.forEach(r=>{Fn(u,r.queryKey)&&Object.assign(f,r.defaultOptions)}),f}setMutationDefaults(u,c){this.#u.set(kn(u),{mutationKey:u,defaultOptions:c})}getMutationDefaults(u){const c=[...this.#u.values()],f={};return c.forEach(r=>{Fn(u,r.mutationKey)&&Object.assign(f,r.defaultOptions)}),f}defaultQueryOptions(u){if(u._defaulted)return u;const c={...this.#l.queries,...this.getQueryDefaults(u.queryKey),...u,_defaulted:!0};return c.queryHash||(c.queryHash=lf(c.queryKey,c)),c.refetchOnReconnect===void 0&&(c.refetchOnReconnect=c.networkMode!=="always"),c.throwOnError===void 0&&(c.throwOnError=!!c.suspense),!c.networkMode&&c.persister&&(c.networkMode="offlineFirst"),c.queryFn===af&&(c.enabled=!1),c}defaultMutationOptions(u){return u?._defaulted?u:{...this.#l.mutations,...u?.mutationKey&&this.getMutationDefaults(u.mutationKey),...u,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},kd=q.createContext(void 0),uf=u=>{const c=q.useContext(kd);if(!c)throw new Error("No QueryClient set, use QueryClientProvider to set one");return c},r0=({client:u,children:c})=>(q.useEffect(()=>(u.mount(),()=>{u.unmount()}),[u]),d.jsx(kd.Provider,{value:u,children:c})),Fd=q.createContext(!1),o0=()=>q.useContext(Fd);Fd.Provider;function h0(){let u=!1;return{clearReset:()=>{u=!1},reset:()=>{u=!0},isReset:()=>u}}var d0=q.createContext(h0()),m0=()=>q.useContext(d0),y0=(u,c,f)=>{const r=f?.state.error&&typeof u.throwOnError=="function"?Xd(u.throwOnError,[f.state.error,f]):u.throwOnError;(u.suspense||u.experimental_prefetchInRender||r)&&(c.isReset()||(u.retryOnMount=!1))},v0=u=>{q.useEffect(()=>{u.clearReset()},[u])},g0=({result:u,errorResetBoundary:c,throwOnError:f,query:r,suspense:o})=>u.isError&&!c.isReset()&&!u.isFetching&&r&&(o&&u.data===void 0||Xd(f,[u.error,r])),p0=u=>{if(u.suspense){const f=o=>o==="static"?o:Math.max(o??1e3,1e3),r=u.staleTime;u.staleTime=typeof r=="function"?(...o)=>f(r(...o)):f(r),typeof u.gcTime=="number"&&(u.gcTime=Math.max(u.gcTime,1e3))}},b0=(u,c)=>u.isLoading&&u.isFetching&&!c,S0=(u,c)=>u?.suspense&&c.isPending,Cd=(u,c,f)=>c.fetchOptimistic(u).catch(()=>{f.clearReset()});function x0(u,c,f){const r=o0(),o=m0(),m=uf(),S=m.defaultQueryOptions(u);m.getDefaultOptions().queries?._experimental_beforeQuery?.(S);const M=m.getQueryCache().get(S.queryHash),g=u.subscribed!==!1;S._optimisticResults=r?"isRestoring":g?"optimistic":void 0,p0(S),y0(S,o,M),v0(o);const y=!m.getQueryCache().get(S.queryHash),[z]=q.useState(()=>new c(m,S)),x=z.getOptimisticResult(S),j=!r&&g;if(q.useSyncExternalStore(q.useCallback(H=>{const w=j?z.subscribe(It.batchCalls(H)):oe;return z.updateResult(),w},[z,j]),()=>z.getCurrentResult(),()=>z.getCurrentResult()),q.useEffect(()=>{z.setOptions(S)},[S,z]),S0(S,x))throw Cd(S,z,o);if(g0({result:x,errorResetBoundary:o,throwOnError:S.throwOnError,query:M,suspense:S.suspense}))throw x.error;return m.getDefaultOptions().queries?._experimental_afterQuery?.(S,x),S.experimental_prefetchInRender&&!$n.isServer()&&b0(x,r)&&(y?Cd(S,z,o):M?.promise)?.catch(oe).finally(()=>{z.updateResult()}),S.notifyOnChangeProps?x:z.trackResult(x)}function Ye(u,c){return x0(u,l0)}function $d(){throw location.href="/auth/login?next="+encodeURIComponent(location.pathname+location.search),new Error("signing in…")}async function Ve(u){const c=await fetch(u);if(c.status===401&&$d(),!c.ok)throw new Error(await c.text());return c.json()}async function E0(u,c,f){const o=await fetch(c,{method:u});if(!o.ok)throw new Error(await o.text());return o.status===204?{}:o.json()}async function cf(u,c){const f=await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c||{})});if(f.status===401&&$d(),!f.ok)throw new Error(await f.text());return f.json()}function j0(){return Ye({queryKey:["config"],queryFn:async()=>{const u=await Ve("/api/config");return u.auth.enabled&&!u.me&&(location.href="/auth/login?next="+encodeURIComponent(location.pathname+location.search),await new Promise(()=>{})),u},staleTime:1/0})}function T0(){document.body.classList.toggle("sb-open")}function Ei(){document.body.classList.remove("sb-open")}function Pt({name:u}){return d.jsx("svg",{className:"ico","aria-hidden":"true",children:d.jsx("use",{href:`#i-${u}`})})}function Wn(u){return d.jsxs(d.Fragment,{children:[d.jsx("div",{id:"sb-backdrop",onClick:Ei}),d.jsxs("aside",{id:"sidebar",children:[u.vault,u.projectsNav,u.tree??d.jsx("nav",{id:"tree","aria-label":"Files"}),u.orgBar]}),d.jsxs("main",{id:"main",children:[u.topbar,d.jsx("article",{id:"content",className:u.contentClass??"markdown",ref:u.contentRef,onScroll:u.onContentScroll,children:u.children})]})]})}function ji(u){const{name:c,onHome:f,showSignout:r,admin:o,gear:m}=u;return d.jsxs("header",{id:"vault",children:[d.jsx("span",{id:"vault-badge","aria-hidden":"true",children:"🐻"}),d.jsx("span",{id:"vault-name",className:f?"vault-link":void 0,onClick:f,role:f?"button":void 0,tabIndex:f?0:void 0,onKeyDown:S=>{f&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),f())},children:c}),d.jsxs("div",{className:"vault-actions",children:[o&&d.jsxs("button",{id:"adminbar",className:"adminbar",title:"Hub administration — signup policy"+(o.pending?" and pending approvals":""),onClick:o.onClick,children:[d.jsx(Pt,{name:"shield"}),d.jsxs("span",{children:["Admin",o.pending?" · "+o.pending:""]})]}),m&&d.jsx("button",{id:"settings-btn",className:"icon-btn2",title:"Manage organization","aria-label":"Manage organization",onClick:m.onClick,children:d.jsx(Pt,{name:"users"})}),r&&d.jsx("a",{id:"signout",href:"/auth/logout",title:"Sign out","aria-label":"Sign out",children:d.jsx(Pt,{name:"power"})})]})]})}function In(u){return d.jsxs("header",{id:"topbar",children:[d.jsx("button",{id:"menu-btn",className:"icon-btn",title:"Menu","aria-label":"Menu",onClick:T0,children:d.jsx(Pt,{name:"menu"})}),d.jsx("span",{id:"crumb",children:u.crumb}),d.jsx("span",{id:"meta",children:u.meta}),u.actions]})}let sf={msg:"",err:!1,shown:!1},pi=[],Nd;function Dd(u){sf=u,pi.forEach(c=>c())}function He(u,c=!1){Dd({msg:u,err:c,shown:!0}),clearTimeout(Nd),Nd=setTimeout(()=>Dd({...sf,shown:!1}),3200)}function O0(){const u=q.useSyncExternalStore(c=>(pi.push(c),()=>{pi=pi.filter(f=>f!==c)}),()=>sf);return d.jsx("div",{id:"toast",className:u.shown?"show"+(u.err?" err":""):"",children:u.msg})}let Wd=null,bi=[];function Id(u){Wd=u,bi.forEach(c=>c())}function A0(u,c,f="",r="OK"){return new Promise(o=>Id({kind:"prompt",title:u,label:c,value:f,okLabel:r,resolve:o}))}function z0(){const u=q.useSyncExternalStore(c=>(bi.push(c),()=>{bi=bi.filter(f=>f!==c)}),()=>Wd);return u?u.kind==="prompt"?d.jsx(M0,{m:u}):d.jsx(C0,{m:u}):null}function Pd(){Id(null)}function M0({m:u}){const c=q.useRef(null),f=o=>{Pd(),u.resolve(o)},r=()=>f(c.current.value.trim()||null);return q.useEffect(()=>{c.current.focus(),c.current.select();const o=m=>{m.key==="Escape"&&f(null),m.key==="Enter"&&r()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[]),d.jsx("div",{className:"modal-back",onClick:o=>o.target===o.currentTarget&&f(null),children:d.jsxs("div",{className:"modal",children:[d.jsx("h3",{children:u.title}),d.jsx("label",{className:"modal-label",children:u.label}),d.jsx("input",{className:"modal-input",type:"text",autoComplete:"off",defaultValue:u.value,ref:c}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("button",{className:"ai-btn",onClick:()=>f(null),children:"Cancel"}),d.jsx("button",{className:"pbtn",onClick:r,children:u.okLabel})]})]})})}function C0({m:u}){const c=q.useRef(null),f=r=>{Pd(),u.resolve(r)};return q.useEffect(()=>{c.current.focus();const r=o=>{o.key==="Escape"&&f(!1),o.key==="Enter"&&f(!0)};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[]),d.jsx("div",{className:"modal-back",onClick:r=>r.target===r.currentTarget&&f(!1),children:d.jsxs("div",{className:"modal",children:[d.jsx("h3",{children:u.title}),d.jsx("p",{className:"modal-msg",children:u.message}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("button",{className:"ai-btn",onClick:()=>f(!1),children:"Cancel"}),d.jsx("button",{className:u.danger?"danger-btn":"pbtn",onClick:()=>f(!0),ref:c,children:u.confirmLabel})]})]})})}function N0(u){return Ye({queryKey:["projects"],queryFn:()=>Ve("/api/projects"),enabled:u,refetchInterval:3e4,select:c=>c.projects||[]})}function D0(u){return Ye({queryKey:["orgs"],queryFn:()=>Ve("/api/orgs"),enabled:u,select:c=>c.orgs||[]})}function _0(u){return Ye({queryKey:["admin","pending"],queryFn:()=>Ve("/api/admin/pending"),enabled:u,select:c=>c.pending||[]})}function tm(){const u=uf();return()=>Promise.all([u.invalidateQueries({queryKey:["projects"]}),u.invalidateQueries({queryKey:["orgs"]})]).then(()=>{})}function em(u){return u.split("/").map(encodeURIComponent).join("/")}function _d(u){return u.split("/").map(decodeURIComponent).join("/")}const R0=new Set(["insights","history"]);function lm(u,c){const f=u.replace(/^\/+/,"");if(c!=="hub")return{path:f?_d(f):""};const r=f.indexOf("/");if(r===-1)return{project:f,path:""};const o={project:f.slice(0,r),path:_d(f.slice(r+1))},m=o.path.indexOf("/"),S=m===-1?o.path:o.path.slice(0,m);return R0.has(S)&&(o.view=S,o.viewTarget=m===-1?"":o.path.slice(m+1).replace(/\/+$/,""),o.path=""),o}function U0(u,c){const f=em(u);return c?"/"+c+(f?"/"+f:""):"/"+f}function Rd(u,c,f){let r=(c?"/"+c:"")+"/"+u;return u==="history"&&f&&(r+="/"+em(f.replace(/\/+$/,""))),r}let ff="POP";const Ps=new Set;function am(){for(const u of Ps)u()}window.addEventListener("popstate",()=>{ff="POP",am()});function Ze(u,c){const f=location.pathname+location.search;!c?.replace&&f===u||(history[c?.replace?"replaceState":"pushState"](null,"",u),ff=c?.replace?"REPLACE":"PUSH",am())}function rf(){return q.useSyncExternalStore(u=>(Ps.add(u),()=>{Ps.delete(u)}),()=>location.pathname)}function H0(){return ff}function q0({to:u}){return q.useEffect(()=>{Ze(u,{replace:!0})},[u]),null}const Ud=["#5b8def","#f5a623","#4cc38a","#e0679b","#8b7bf0","#3ec8c8","#e6934a"];function w0(u){let c=0;for(const f of u)c=c*31+f.charCodeAt(0)>>>0;return Ud[c%Ud.length]}function Hd({projects:u,currentId:c}){const f=tm(),r=async()=>{const o=await A0("New project","Project name","","Create");if(o)try{const m=await cf("/api/projects",{name:o});await f(),Ze("/"+m.project.id),He(`Created “${m.project.name}”.`)}catch(m){He("Could not create the project: "+m.message,!0)}};return d.jsxs("nav",{id:"projects","aria-label":"Projects",children:[d.jsxs("div",{className:"nav-head",children:[d.jsx("span",{children:"Projects"}),d.jsx("button",{className:"nav-add",title:"New project",onClick:r,children:"+"})]}),d.jsx("ul",{children:u.map(o=>d.jsx("li",{children:d.jsxs("div",{className:"row"+(c===o.id?" active":""),title:o.name,tabIndex:0,role:"button",onClick:()=>{Ze("/"+o.id),Ei()},onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),m.currentTarget.click())},children:[d.jsx("span",{className:"proj-mark",style:{background:w0(o.name)},children:o.name.trim()[0]||"?"}),d.jsx("span",{className:"label",children:o.name})]})},o.id))})]})}function Q0({org:u,onManage:c}){return u?d.jsxs("footer",{id:"orgbar",children:[d.jsx("span",{id:"org-name",title:"Manage organization",role:"button",tabIndex:0,onClick:()=>c(u),onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),c(u))},children:u.name}),u.role==="owner"&&d.jsx("button",{id:"invite-btn",title:"Manage this organization",onClick:()=>c(u),children:"Manage"})]}):null}function B0({authEnabled:u,onCreate:c}){const f=q.useRef(null),r=q.useRef(null),o=()=>{const m=f.current.value.trim(),S=m.match(/join\/([0-9a-f]+)/)||m.match(/^([0-9a-f]{8,})$/);if(!S){He("That doesn't look like an invite link.",!0);return}location.href="/join/"+S[1]};return d.jsxs("div",{className:"onboard",children:[d.jsx("h1",{children:"Welcome to BearDrive"}),d.jsx("p",{children:"You're signed in, but you're not part of any project yet."}),u&&d.jsxs("div",{className:"ob-card",children:[d.jsx("h3",{children:"Have an invite link?"}),d.jsx("p",{children:"A teammate can send you a join link. Paste it here:"}),d.jsxs("div",{className:"ob-row",children:[d.jsx("input",{id:"ob-invite",type:"text",placeholder:"https://…/join/…",autoComplete:"off",ref:f}),d.jsx("button",{id:"ob-join",className:"pbtn",onClick:o,children:"Join"})]})]}),d.jsxs("div",{className:"ob-card",children:[d.jsx("h3",{children:"Or start a new project"}),d.jsx("p",{children:"Create a shared space for your team's files."}),d.jsxs("div",{className:"ob-row",children:[d.jsx("input",{id:"ob-name",type:"text",placeholder:"Project name, e.g. wiki",autoComplete:"off",ref:r}),d.jsx("button",{id:"ob-create",className:"pbtn",onClick:()=>c(r.current.value.trim()),children:"Create"})]})]})]})}function Y0(u,c=!0){const f=Ye({queryKey:["tree",u],queryFn:()=>Ve(u+"tree"),enabled:c,refetchInterval:15e3}),r=q.useMemo(()=>{const o=[],m=new Map,S=M=>{for(const g of M.children||[])g.dir?(m.set(g.path,g),S(g)):o.push(g)};return f.data&&S(f.data),{flatFiles:o,dirIndex:m}},[f.data]);return{tree:f.data,...r,loaded:!!f.data}}function G0(u,c){return Ye({queryKey:["heat",u],queryFn:()=>Ve(u+"heat?days=30"),enabled:c,staleTime:6e4,refetchInterval:6e4}).data?.entries??null}function L0(u,c,f){return Ye({queryKey:["history",u,"prefix",c,20],queryFn:()=>Ve(u+"history?prefix="+encodeURIComponent(c)+"&n=20"),enabled:f,staleTime:15e3}).data?.entries??null}function qd(u,c,f){if(!u)return null;if(!f)return u[c]||null;const r={human:0,agent:0,share:0};for(const[o,m]of Object.entries(u))o.startsWith(c+"/")&&(r.human+=m.human||0,r.agent+=m.agent||0,r.share+=m.share||0);return r.human||r.agent||r.share?r:null}function Pn(u){return(u.human||0)+(u.agent||0)+(u.share||0)}function Si(u){const c=Pn(u);if(!c)return"";let f=c+(c===1?" read":" reads");return u.agent&&(f+=" ("+u.agent+" agent)"),f}function X0(u){const c=Pn(u);return c?c<3?1:c<10?2:c<30?3:4:0}async function K0(u,c,f){const r=await f.arrayBuffer(),o=await Z0(r),m=async(g,y)=>{const z=await fetch(g,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(y)});if(!z.ok)throw new Error(await z.text());return z.json()},S={path:c,sha256:o,size:f.size},M=await m(u+"upload/init",S);if(M.mode==="direct"){if(!M.exists){const g=await fetch(M.url,{method:M.method||"PUT",headers:M.headers||{},body:r});if(!g.ok)throw new Error("storage upload failed: "+g.status)}await m(u+"upload/commit",S)}else{const g=await fetch(u+"upload/content?path="+encodeURIComponent(c),{method:"PUT",body:r});if(!g.ok)throw new Error(await g.text())}}async function Z0(u){if(crypto.subtle){const c=await crypto.subtle.digest("SHA-256",u);return[...new Uint8Array(c)].map(f=>f.toString(16).padStart(2,"0")).join("")}return V0(new Uint8Array(u))}function V0(u){const c=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),f=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),r=(g,y)=>g>>>y|g<<32-y,o=u.length,m=new Uint8Array((o+8>>6)+1<<6);m.set(u),m[o]=128;const S=new DataView(m.buffer);S.setUint32(m.length-8,Math.floor(o*8/4294967296)),S.setUint32(m.length-4,o*8>>>0);const M=new Uint32Array(64);for(let g=0;g>>3,nt=r(M[L-2],17)^r(M[L-2],19)^M[L-2]>>>10;M[L]=M[L-16]+$+M[L-7]+nt>>>0}let[y,z,x,j,H,w,Q,G]=f;for(let L=0;L<64;L++){const $=r(H,6)^r(H,11)^r(H,25),nt=G+$+(H&w^~H&Q)+c[L]+M[L]>>>0,Mt=(r(y,2)^r(y,13)^r(y,22))+(y&z^y&x^z&x)>>>0;G=Q,Q=w,w=H,H=j+nt>>>0,j=x,x=z,z=y,y=nt+Mt>>>0}f[0]+=y,f[1]+=z,f[2]+=x,f[3]+=j,f[4]+=H,f[5]+=w,f[6]+=Q,f[7]+=G}return[...f].map(g=>(g>>>0).toString(16).padStart(8,"0")).join("")}const J0=/\.(md|markdown)$/i,k0=/\.(png|jpe?g|gif|svg|webp|ico|bmp|avif)$/i,F0=/\.(txt|log|json|ya?ml|toml|csv|go|py|js|ts|jsx|tsx|sh|bash|zsh|rb|rs|c|h|cpp|java|kt|swift|sql|html|css|xml|ini|conf|env|mod|sum|jsonl)$/i;function nm(u){if(u<1024)return u+" B";const c=["KB","MB","GB","TB"];let f=-1;do u/=1024,f++;while(u>=1024&&fd.jsx(W0,{node:f,...c},f.path))})}function W0({node:u,...c}){const{expanded:f,onToggle:r,currentPath:o,listingShowing:m,onOpen:S}=c,M=u.dir?f.has(u.path):!1,g=()=>{if(u.dir&&o===u.path&&m){r(u.path);return}S(u.path),u.dir||Ei()};return d.jsxs("li",{className:(u.dir?"dir":"file")+(u.dir&&!M?" collapsed":""),children:[d.jsxs("div",{className:"row"+(o===u.path?" active":""),"data-path":u.path,tabIndex:0,role:"button",title:u.name,"aria-expanded":u.dir?M:void 0,onClick:g,onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),g())},children:[d.jsx("span",{className:"chev",onClick:y=>{u.dir&&(y.stopPropagation(),r(u.path))},children:d.jsx(Pt,{name:"chevd"})}),d.jsx("span",{className:"ticon",children:d.jsx(Pt,{name:u.dir?"folder":"doc"})}),d.jsx("span",{className:"label",children:u.name})]}),u.dir&&d.jsx(im,{nodes:u.children||[],...c})]})}function I0(u){const c=u.split("/"),f=[];let r="";for(let o=0;o{r=r?r+"/"+o:o;const S=r,M=m===f.length-1;return d.jsxs("span",{children:[m>0&&d.jsx("span",{className:"crumb-sep",children:"/"}),M?d.jsx("span",{children:o}):d.jsx("span",{className:"crumb-seg",title:S,onClick:()=>c(S),children:o})]},S)})})}const tg={add:"plus",edit:"edit",delete:"x"},eg={add:"added",edit:"edited",delete:"deleted"};function cm({entry:u,onOpen:c}){const[f,r]=q.useState(!1),o=u.kind==="put"?"edit":u.kind,m=u.user_name?`${u.user_name} <${u.user}>`:u.user||u.author||"unknown",S=[u.device.name||u.device.id,u.device.os,u.device.ip].filter(Boolean).join(" · "),M=o!=="delete",g=y=>{y.target.tagName!=="A"&&M&&c(u.path)};return d.jsxs("div",{className:"hentry "+o+(M?" clickable":""),tabIndex:M?0:void 0,role:M?"button":void 0,onClick:g,onKeyDown:y=>{M&&(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),c(u.path))},children:[d.jsxs("div",{className:"hline",children:[d.jsx("span",{className:"hkind",children:d.jsx(Pt,{name:tg[o]||"dot"})}),d.jsx("span",{className:"hpath",children:u.path}),d.jsx("span",{className:"htag",children:eg[o]||o}),d.jsx("span",{className:"htime",children:new Date(u.time).toLocaleString()})]}),d.jsxs("div",{className:"hmeta",children:[d.jsx("span",{className:"hwho",children:m}),d.jsx("span",{className:"hdev",children:S}),d.jsx("span",{className:"hsize",children:u.size?nm(u.size):""})]}),u.note&&d.jsx("div",{className:"hnote"+(f?" open":""),tabIndex:0,role:"button",title:f?"Collapse note":"Show full note","aria-expanded":f,onClick:y=>{y.stopPropagation(),y.target.tagName!=="A"&&r(!f)},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),y.stopPropagation(),r(!f))},children:u.note.split(/(https?:\/\/\S+)/).map((y,z)=>/^https?:\/\//.test(y)?d.jsx("a",{href:y,target:"_blank",rel:"noopener",children:y},z):y)})]})}function lg(u){const{node:c,heatMap:f,onOpen:r}=u,o=(c.children||[]).slice().sort((y,z)=>Number(z.dir||!1)-Number(y.dir||!1)||y.name.localeCompare(z.name)),m=o.filter(y=>y.dir).length,S=o.length-m,M=[];m&&M.push(m+(m===1?" folder":" folders")),S&&M.push(S+(S===1?" file":" files"));const g=qd(f,c.path,!0);return g&&M.push(Si(g)+" in 30 days"),d.jsxs("div",{className:"dirlist",children:[d.jsxs("h1",{className:"dl-title",children:[d.jsx("span",{className:"dl-title-icon",children:d.jsx(Pt,{name:"folder"})}),d.jsx("span",{children:c.name})]}),d.jsx("p",{className:"dl-sub",children:M.join(" · ")||"Empty folder"}),o.length===0?d.jsx("div",{className:"dl-empty",children:"Nothing in this folder yet."}):d.jsx("div",{className:"dl-items",children:o.map(y=>{let z="";if(y.dir){const j=(y.children||[]).length;z=j+(j===1?" item":" items")}else z=[y.size?nm(y.size):"",y.time?new Date(y.time).toLocaleDateString():""].filter(Boolean).join(" · ");const x=qd(f,y.path,!!y.dir);return x&&(z=Si(x)+(z?" · "+z:"")),d.jsxs("div",{className:"dl-row",tabIndex:0,role:"button",title:y.path,onClick:()=>r(y.path),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),r(y.path))},children:[d.jsx("span",{className:"ticon",children:d.jsx(Pt,{name:y.dir?"folder":"doc"})}),d.jsx("span",{className:"dl-name",children:y.name}),x&&d.jsx("span",{className:"heatdot lvl"+X0(x),title:Si(x)+" in 30 days"}),d.jsx("span",{className:"dl-meta",children:z})]},y.path)})}),u.hub&&d.jsx(ag,{apiBase:u.apiBase,prefix:c.path+"/",onOpen:r,onFullHistory:()=>u.onFullHistory(c.path+"/"),onRendered:u.onRendered})]})}function ag(u){const c=L0(u.apiBase,u.prefix,!0),{onRendered:f}=u;return q.useEffect(()=>{c&&c.length&&f&&f()},[c,f]),!c||c.length===0?null:d.jsxs("div",{className:"dl-history",children:[d.jsx("h3",{className:"dl-h3",children:"Recent changes"}),d.jsx("div",{className:"history dl-hlist",children:c.map((r,o)=>d.jsx(cm,{entry:r,onOpen:u.onOpen},o))}),d.jsx("button",{className:"ai-btn dl-more",onClick:u.onFullHistory,children:"Full history"})]})}function ng(u){const{apiBase:c,path:f,onMeta:r}=u,o=c+"file?path="+encodeURIComponent(f);return q.useEffect(()=>()=>r(""),[f,r]),J0.test(f)?d.jsx(ug,{...u}):k0.test(f)?d.jsx(sg,{src:o,alt:f,onRendered:u.onRendered}):F0.test(f)?d.jsx(fg,{...u,fileURL:o}):d.jsxs("div",{className:"filecard",children:[d.jsx("div",{className:"name",children:f.split("/").pop()}),d.jsx("p",{children:"No preview for this file type."}),d.jsx("a",{className:"btn",download:!0,href:c+"download?path="+encodeURIComponent(f),children:"Download"})]})}function ug(u){const{apiBase:c,path:f,heatMap:r,flatFiles:o,onOpenFile:m,onMeta:S,onRendered:M}=u,{data:g,error:y}=Ye({queryKey:["render",c,f],queryFn:()=>Ve(c+"render?path="+encodeURIComponent(f))}),z=q.useMemo(()=>g?cg(g.html,f,c):"",[g,f,c]);return q.useEffect(()=>{if(!g)return;const x=[];g.author&&x.push(g.author+(g.device?" on "+g.device:"")),g.time&&x.push(new Date(g.time).toLocaleString());const j=r&&r[g.path];j&&Pn(j)&&x.push(Si(j)+" / 30d"),S(x.join(" · ")),M?.()},[g,r,S,M]),y?d.jsxs("div",{className:"empty",children:["Could not load file: ",y.message]}):g?d.jsx("div",{dangerouslySetInnerHTML:{__html:z},onClick:x=>ig(x,f,o,m)}):null}function ig(u,c,f,r){const o=u.target.closest("a");if(!o||!u.currentTarget.contains(o))return;const m=o.getAttribute("href")||"",S=c.includes("/")?c.slice(0,c.lastIndexOf("/")):"";m.startsWith("wiki:")?(u.preventDefault(),rg(decodeURIComponent(m.slice(5)),f,r)):/^([a-z]+:|\/|#)/i.test(m)||(u.preventDefault(),r(um(S,decodeURIComponent(m))))}function cg(u,c,f){const r=c.includes("/")?c.slice(0,c.lastIndexOf("/")):"",o=S=>f+"file?path="+encodeURIComponent(S),m=new DOMParser().parseFromString(u,"text/html");for(const S of m.querySelectorAll("img")){const M=S.getAttribute("src")||"";/^([a-z]+:|\/)/i.test(M)||S.setAttribute("src",o(um(r,M)))}for(const S of m.querySelectorAll("a")){const M=S.getAttribute("href")||"";/^https?:/i.test(M)&&(S.setAttribute("target","_blank"),S.setAttribute("rel","noopener"))}return m.body.innerHTML}function sg({src:u,alt:c,onRendered:f}){return d.jsx("img",{src:u,alt:c,onLoad:f})}function fg(u){const{path:c,fileURL:f,onRendered:r}=u,{data:o,error:m}=Ye({queryKey:["text",f],queryFn:async()=>{const S=await fetch(f);if(!S.ok)throw new Error(await S.text());return S.text()}});return q.useEffect(()=>{o!=null&&r?.()},[o,r]),m?d.jsxs("div",{className:"empty",children:["Could not load file: ",m.message]}):o==null?null:d.jsx("pre",{className:"plain",children:o},c)}function rg(u,c,f){const r=u.toLowerCase(),o=c.find(m=>m.path.toLowerCase()===r||m.path.toLowerCase()===r+".md")||c.find(m=>{const S=m.name.toLowerCase();return S===r||S===r+".md"});o&&f(o.path)}function og({url:u,copied:c,onClose:f}){const r=u.split("/s/")[1];return d.jsx("div",{className:"modal-back",onClick:o=>o.target===o.currentTarget&&f(),children:d.jsxs("div",{className:"modal",children:[d.jsx("h3",{children:"Public link created"}),d.jsxs("p",{children:[d.jsx("b",{children:"Anyone with this link can view this file"})," — no account needed. It always shows the latest version until you revoke it."]}),d.jsx("div",{className:"modal-url",children:u}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("button",{className:"pbtn",onClick:()=>of(u).then(o=>He(o?"Copied.":"Select and copy the link above.")),children:c?"Copied ✓":"Copy link"}),d.jsx("button",{className:"ai-btn",onClick:()=>window.open(u,"_blank"),children:"Open"}),d.jsx("button",{className:"ai-del",onClick:async()=>{try{await E0("DELETE","/api/shares/"+r),He("Link revoked — it no longer works."),f()}catch(o){He(o.message,!0)}},children:"Revoke"}),d.jsx("button",{className:"ai-btn",onClick:f,children:"Done"})]})]})})}function wd(u,c){if(!u)return{score:0,hits:[]};const f=u.toLowerCase(),r=c.toLowerCase();let o=0,m=0,S=0;const M=[];for(let g=0;g3&&r.endsWith("ies")?o=r.slice(0,-3)+"y":r.length>3&&r.endsWith("es")?o=r.slice(0,-2):r.length>2&&r.endsWith("s")&&(o=r.slice(0,-1)),o?wd(o,c):null}function dg({text:u,hits:c}){const f=[];let r=0;return c.forEach((o,m)=>{o>r&&f.push(u.slice(r,o)),f.push(d.jsx("b",{children:u[o]},m)),r=o+1}),f.push(u.slice(r)),d.jsx("span",{className:"plabel",children:f})}function mg({open:u,onClose:c,candidates:f}){const[r,o]=q.useState(""),[m,S]=q.useState(0),M=q.useRef(null),g=q.useRef(null),y=q.useMemo(()=>{if(!u)return[];const x=[];for(const j of f()){const H=hg(r,j.label);H&&x.push({...j,score:H.score,hits:H.hits})}return x.sort((j,H)=>H.score-j.score),x.slice(0,40)},[u,r,f]);q.useEffect(()=>{u&&(o(""),S(0),M.current?.focus())},[u]),q.useEffect(()=>S(0),[r]),q.useEffect(()=>{g.current?.children[m]?.scrollIntoView({block:"nearest"})},[m,y]);const z=x=>{c(),x.run()};return q.useEffect(()=>{if(!u)return;const x=j=>{if(j.key==="Escape")j.preventDefault(),c();else if(j.key==="ArrowDown"||j.key==="ArrowUp"){j.preventDefault();const H=y.length;H&&S(w=>(w+(j.key==="ArrowDown"?1:H-1))%H)}else j.key==="Enter"&&(j.preventDefault(),y[m]&&z(y[m]))};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[u,y,m]),u?d.jsx("div",{id:"palette-overlay",onClick:x=>x.target===x.currentTarget&&c(),children:d.jsxs("div",{id:"palette",role:"dialog","aria-label":"Search and quick actions",children:[d.jsxs("div",{id:"palette-inputwrap",children:[d.jsx(Pt,{name:"search"}),d.jsx("input",{id:"palette-input",type:"text",placeholder:"Search file names, projects, actions…",autoComplete:"off",spellCheck:!1,ref:M,value:r,onChange:x=>o(x.target.value)})]}),d.jsx("ul",{id:"palette-results",ref:g,children:y.length===0?d.jsx("li",{className:"pempty",children:"No matches — search covers file names, projects, and actions"}):y.map((x,j)=>d.jsxs("li",{className:j===m?"selected":void 0,onClick:()=>z(x),onMouseMove:()=>m!==j&&S(j),children:[d.jsx("span",{className:"picon",children:d.jsx(Pt,{name:x.icon})}),d.jsx(dg,{text:x.label,hits:x.hits}),d.jsx("span",{className:"pkind",children:x.kind})]},x.kind+":"+x.label))}),d.jsx("footer",{id:"palette-hint",children:"↑↓ navigate · ⏎ select · esc close"})]})}):null}const Ks=[{key:"claude",label:"Claude Code & Cowork"},{key:"hermes",label:"Hermes",hook:"hermes",note:"Registers BearDrive's hooks in Hermes's config: pull before every turn, push after edits with a session note, and report file reads to Insights."},{key:"codex",label:"Codex",hook:"codex",note:"Registers hooks in .codex/hooks.json.",extra:"Run /hooks inside Codex once to trust the project's .codex layer — after that every turn pulls, edits push automatically, and reads are reported to Insights."}];function yg(u,c){const f=window.location.origin,r=c.id;if(u.key==="claude")return[{title:"Add the BearDrive plugin",desc:"One time, in any Claude Code session. The plugin ships the beardrive skill, the /beardrive commands, and turn-boundary sync hooks — and Claude Cowork shares the same plugins, so installing it once covers both.",code:`/plugin marketplace add runbear-io/beardrive +/plugin install beardrive@beardrive`},{title:"Set up this project conversationally",desc:"In a Claude Code or Cowork session in the folder where you want the files, run:",code:"/beardrive:install connect to "+f+", project "+r,extra:"Claude installs the CLI, signs this machine in, mounts the project, and registers the sync hooks — pull the latest before every turn, push after edits (stamped with the session that made them), and report file reads to Insights. It asks before anything it changes."}];const o=(c.name||"project").toLowerCase().replace(/[^a-z0-9._-]+/g,"-")||"project";return[{title:"Install the BearDrive CLI",desc:"One static binary. Homebrew on macOS and Linux; releases and `go install` also work.",code:"brew install runbear-io/tap/beardrive"},{title:"Sign in to this hub",desc:"Opens the browser once and stores a device token on this machine — the synced folder itself never holds credentials.",code:"bdrive login "+f},{title:"Mount the project into a local folder",desc:"Run it where you want the files. An existing folder works too — contents merge, and re-running init later (or after moving the folder) just resumes.",code:"mkdir -p ~/"+o+" && cd ~/"+o+` +bdrive init --project `+r},{title:"Connect "+u.label,desc:u.note,code:"bdrive hooks install --agent "+u.hook,extra:u.extra}]}function vg(){try{return localStorage.getItem("bdrive-guide-agent")||"claude"}catch{return"claude"}}function gg({project:u}){const[c,f]=q.useState(vg),r=Ks.find(o=>o.key===c)||Ks[0];return d.jsxs("div",{className:"guide",children:[d.jsx("h1",{className:"in-title",children:u.name}),d.jsx("p",{className:"dl-sub",children:"Mount this project as a folder on any machine and connect your coding agent: files sync both ways in the background, every change is journaled with who made it, and agent reads feed Insights."}),d.jsx("div",{className:"gd-tabs",children:Ks.map(o=>d.jsx("button",{className:"gd-tab"+(o.key===r.key?" active":""),"data-key":o.key,onClick:()=>{f(o.key);try{localStorage.setItem("bdrive-guide-agent",o.key)}catch{}},children:o.label},o.key))}),d.jsxs("div",{className:"gd-body",children:[yg(r,u).map((o,m)=>d.jsxs("div",{className:"gd-step",children:[d.jsxs("div",{className:"gd-step-head",children:[d.jsx("span",{className:"gd-num",children:m+1}),d.jsx("span",{className:"gd-step-title",children:o.title})]}),o.desc&&d.jsx("p",{className:"gd-desc",children:o.desc}),o.code&&d.jsx(pg,{code:o.code}),o.extra&&d.jsx("p",{className:"gd-desc gd-extra",children:o.extra})]},m)),d.jsx("p",{className:"gd-done",children:"That's it — the folder now syncs on its own. Every agent turn starts from the latest state, edits appear here (and on every teammate's mount) within seconds, and what your agents read shows up in Insights."})]})]})}function pg({code:u}){const[c,f]=q.useState("Copy");return d.jsxs("pre",{className:"gd-code",children:[d.jsx("code",{children:u}),d.jsx("button",{className:"gd-copy",onClick:async()=>{f(await of(u)?"Copied":"Copy failed"),setTimeout(()=>f("Copy"),1400)},children:c})]})}const Jn=3,ka=30;function bg(u,c){return Ye({queryKey:["heatDevices",u],queryFn:()=>Ve(u+"heat?by=device&days=30"),enabled:c,retry:!1,staleTime:6e4}).data?.devices??null}function Qd(u){const[c,f]=q.useState("all"),{flatFiles:r,heatMap:o,devices:m}=u,S=Date.now(),M=r.map(g=>{const y=o&&o[g.path]||{},z=g.time?Math.max(0,(S-new Date(g.time).getTime())/864e5):0,x=c==="all"?Pn(y):y[c]||0;return{path:g.path,reads:x,agent:y.agent||0,total:Pn(y),days:z,danger:x>=Jn&&z>=ka}});return d.jsxs("div",{className:"insights",children:[d.jsx("h1",{className:"in-title",children:"Knowledge insights"}),d.jsx("p",{className:"dl-sub",children:"Reads over the last 30 days × how long since each file changed. Hot but stale knowledge — read a lot, maintained by nobody — is the danger zone."}),d.jsx("div",{className:"in-lens",children:["all","human","agent"].map(g=>d.jsx("button",{className:"in-lens-btn"+(g===c?" active":""),onClick:()=>f(g),children:g==="all"?"All reads":g==="human"?"Human reads":"Agent reads"},g))}),d.jsx("h3",{className:"dl-h3",children:"Map — cell size = reads, color = freshness"}),d.jsx(xg,{pts:M,onOpenFile:u.onOpenFile,onOpenFolder:u.onOpenFolder,isFolder:u.isFolder}),d.jsx("h3",{className:"dl-h3",children:"Reads × freshness"}),d.jsx(Eg,{pts:M,onOpenFile:u.onOpenFile}),d.jsx("h3",{className:"dl-h3",children:"Hot path — top files by reads"}),d.jsx(jg,{pts:M,lens:c,onOpenFile:u.onOpenFile}),m&&m.length>0&&d.jsxs(d.Fragment,{children:[d.jsx("h3",{className:"dl-h3",children:"Agent coverage — which agents read which areas"}),d.jsx(Tg,{devices:m})]})]})}function Sg(u){const c=[[76,195,138],[232,196,84],[224,93,93]],f=Math.min(1,Math.max(0,u/300))*(c.length-1),r=Math.min(c.length-2,Math.floor(f)),o=f-r,m=c[r].map((S,M)=>Math.round(S+(c[r+1][M]-S)*o));return`rgb(${m[0]},${m[1]},${m[2]})`}function Bd(u,c,f,r,o){const m=u.reduce((y,z)=>y+z.value,0);if(!m||r<=0||o<=0)return[];const S=u.slice().sort((y,z)=>z.value-y.value).map(y=>({it:y,a:y.value/m*r*o})),M=(y,z)=>{const j=y.reduce((w,Q)=>w+Q.a,0)/z;let H=0;for(const w of y){const Q=w.a/j;H=Math.max(H,Q/j,j/Q)}return H},g=[];for(;S.length;){const y=r>=o,z=y?o:r,x=[S.shift()];for(;S.length&&M(x.concat(S[0]),z)<=M(x,z);)x.push(S.shift());const j=x.reduce((w,Q)=>w+Q.a,0)/z;let H=0;for(const w of x){const Q=w.a/j;y?g.push({item:w.it,x:c,y:f+H,w:j,h:Q}):g.push({item:w.it,x:c+H,y:f,w:Q,h:j}),H+=Q}y?(c+=j,r-=j):(f+=j,o-=j)}return g}const Zs=15;function xg({pts:u,onOpenFile:c,onOpenFolder:f,isFolder:r}){const S=new Map;for(const g of u){const y=g.path.includes("/")?g.path.split("/")[0]:"/";let z=S.get(y);z||S.set(y,z={name:y,files:[],value:0}),z.files.push(g),z.value+=g.reads+1}const M=[];for(const g of Bd([...S.values()],0,0,720,480)){const y=g.item,z=y.name==="/"?"":y.name;if(M.push(d.jsx("rect",{x:g.x+1,y:g.y+1,width:Math.max(0,g.w-2),height:Math.max(0,g.h-2),rx:3,className:"in-tm-group","data-dir":z},"g"+y.name)),g.w>46&&g.h>Zs+10){let j=y.name==="/"?"(root)":y.name;const H=Math.floor((g.w-8)/6);j.length>H&&(j=j.slice(0,Math.max(1,H-1))+"…"),M.push(d.jsx("text",{x:g.x+5,y:g.y+12,className:"in-tm-glabel","data-dir":z,children:j},"gl"+y.name))}const x=Bd(y.files.map(j=>({...j,name:j.path.split("/").pop(),value:j.reads+1})),g.x+2,g.y+Zs,Math.max(0,g.w-4),Math.max(0,g.h-Zs-2));for(const j of x)if(M.push(d.jsx("rect",{x:j.x+.6,y:j.y+.6,width:Math.max(.4,j.w-1.2),height:Math.max(.4,j.h-1.2),rx:1.5,fill:Sg(j.item.days),className:"in-tm-cell","data-path":j.item.path,children:d.jsx("title",{children:`${j.item.path} — ${j.item.reads} read${j.item.reads===1?"":"s"}/30d · changed ${Math.round(j.item.days)}d ago`})},j.item.path)),j.w>54&&j.h>16){const H=Math.floor((j.w-8)/6);let w=(j.item.danger?"⚠ ":"")+j.item.name;w.length>H&&(w=w.slice(0,Math.max(1,H-1))+"…"),H>=5&&M.push(d.jsx("text",{x:j.x+4.5,y:j.y+12.5,className:"in-tm-label","data-path":j.item.path,children:w},"l"+j.item.path))}}return d.jsx("svg",{viewBox:"0 0 720 480",className:"in-chart in-treemap",onClick:g=>{const y=g.target.closest("[data-path], [data-dir]");if(!y)return;const z=y.getAttribute("data-path");if(z)return c(z);const x=y.getAttribute("data-dir");x&&r(x)&&f(x)},children:M})}function Eg({pts:u,onOpenFile:c}){const o={l:44,r:16,t:20,b:34},m=Math.max(ka*2,...u.map(x=>x.days)),S=Math.max(Jn*2,...u.map(x=>x.reads)),M=x=>Math.log10(x+1)/Math.log10(m+1),g=x=>Math.log10(x+1)/Math.log10(S+1),y=x=>o.l+M(x)*(720-o.l-o.r),z=x=>360-o.b-g(x)*(360-o.t-o.b);return d.jsxs("svg",{viewBox:"0 0 720 360",className:"in-chart",children:[d.jsx("rect",{x:y(ka),y:o.t,width:720-o.r-y(ka),height:z(Jn)-o.t,className:"in-danger-zone"}),d.jsx("line",{x1:y(ka),y1:o.t,x2:y(ka),y2:360-o.b,className:"in-threshold"}),d.jsx("line",{x1:o.l,y1:z(Jn),x2:720-o.r,y2:z(Jn),className:"in-threshold"}),d.jsx("line",{x1:o.l,y1:360-o.b,x2:720-o.r,y2:360-o.b,className:"in-axis"}),d.jsx("line",{x1:o.l,y1:o.t,x2:o.l,y2:360-o.b,className:"in-axis"}),d.jsx("text",{x:(o.l+720-o.r)/2,y:352,className:"in-label",children:"days since last change →"}),d.jsx("text",{x:12,y:(o.t+360-o.b)/2,className:"in-label",transform:`rotate(-90 12 ${(o.t+360-o.b)/2})`,children:"reads / 30d →"}),d.jsx("text",{x:720-o.r-6,y:o.t+14,className:"in-quad in-quad-danger",textAnchor:"end",children:"hot + stale"}),d.jsx("text",{x:o.l+6,y:o.t+14,className:"in-quad",children:"hot + fresh"}),d.jsx("text",{x:720-o.r-6,y:360-o.b-8,className:"in-quad",textAnchor:"end",children:"cold + stale"}),d.jsx("text",{x:720-o.r-6,y:o.t+28,className:"in-label",textAnchor:"end",children:"dot size = agent share of reads"}),u.map(x=>{const j=x.total?(x.agent||0)/x.total:0;return d.jsx("circle",{cx:Number(y(x.days).toFixed(1)),cy:Number(z(x.reads).toFixed(1)),r:Number((3+4*j).toFixed(1)),className:"in-pt"+(x.danger?" danger":x.reads?"":" cold"),onClick:()=>c(x.path),children:d.jsx("title",{children:`${x.path} — ${x.reads} read${x.reads===1?"":"s"} / 30d · changed ${Math.round(x.days)}d ago`})},x.path)})]})}function jg({pts:u,lens:c,onOpenFile:f}){const r=u.filter(m=>m.reads>0).sort((m,S)=>S.reads-m.reads||S.days-m.days).slice(0,20);if(!r.length)return d.jsx("div",{className:"dl-empty",children:"No reads in the window yet."});const o=r[0].reads;return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"in-hotpath",children:r.map(m=>{const S=c==="agent"?1:c==="human"?0:m.total?m.agent/m.total:0,M=m.reads/o*100;return d.jsxs("div",{className:"in-hp-row",tabIndex:0,role:"button",title:m.danger?`${m.reads} read${m.reads===1?"":"s"}/30d · unchanged ${Math.round(m.days)}d — review this file`:m.path,onClick:()=>f(m.path),onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),f(m.path))},children:[d.jsx("span",{className:"in-hp-name"+(m.danger?" danger":""),children:m.path+(m.danger?" ⚠":"")}),d.jsxs("span",{className:"in-hp-bar",children:[d.jsx("span",{className:"in-hp-agent",style:{width:(M*S).toFixed(1)+"%"}}),d.jsx("span",{className:"in-hp-human",style:{width:(M*(1-S)).toFixed(1)+"%"}})]}),d.jsx("span",{className:"in-hp-count",children:m.reads})]},m.path)})}),d.jsxs("p",{className:"in-legend",children:[d.jsx("span",{className:"in-sw agent"})," agent reads ",d.jsx("span",{className:"in-sw human"})," human reads"]})]})}function Tg({devices:u}){const c=new Map;for(const j of u)for(const[H,w]of Object.entries(j.folders||{}))c.set(H,(c.get(H)||0)+w);const f=[...c.entries()].sort((j,H)=>H[1]-j[1]).slice(0,12).map(j=>j[0]),r=u.slice(0,12),o=140,m=6,S=Math.min(76,Math.max(34,(720-o-8)/f.length)),M=26,g=720,y=m+r.length*M+58,z=Math.max(1,...r.flatMap(j=>f.map(H=>(j.folders||{})[H]||0))),x=j=>{const H=[23,25,31],w=[245,166,35],Q=H.map((G,L)=>Math.round(G+(w[L]-G)*j));return`rgb(${Q[0]},${Q[1]},${Q[2]})`};return d.jsxs("svg",{viewBox:`0 0 ${g} ${y}`,className:"in-chart in-matrix",children:[r.map((j,H)=>{let w=j.name||j.id||"";return w.length>20&&(w=w.slice(0,19)+"…"),d.jsxs("g",{children:[d.jsx("text",{x:o-8,y:m+H*M+17,textAnchor:"end",className:"in-label",children:w}),f.map((Q,G)=>{const L=(j.folders||{})[Q]||0;return d.jsx("rect",{x:o+G*S,y:m+H*M,width:S-4,height:M-4,rx:3,fill:x(Math.sqrt(L/z)),children:d.jsx("title",{children:`${j.name||j.id} × ${Q||"(root)"}: ${L} read${L===1?"":"s"}/30d`})},Q)})]},j.id||H)}),f.map((j,H)=>{const w=o+H*S+(S-4)/2,Q=m+r.length*M+14;return d.jsx("text",{x:w,y:Q,className:"in-label",textAnchor:"end",transform:`rotate(-28 ${w} ${Q})`,children:j||"(root)"},j)})]})}function Og(u){const{apiBase:c,target:f,isFolder:r,onMeta:o,onRendered:m}=u,S=f?r(f)?{prefix:f+"/"}:{path:f}:{prefix:""},M="path"in S&&S.path!==void 0?"path="+encodeURIComponent(S.path):"prefix="+encodeURIComponent(S.prefix??""),{data:g,error:y}=Ye({queryKey:["history",c,M,200],queryFn:()=>Ve(c+"history?"+M+"&n=200"),staleTime:15e3});if(q.useEffect(()=>{y&&o("History unavailable: "+y.message)},[y,o]),q.useEffect(()=>{g&&m?.()},[g,m]),!g)return null;const z=g.entries||[];return d.jsxs("div",{className:"history",children:[z.length===0&&d.jsx("div",{className:"empty",children:"No history yet."}),z.map((x,j)=>d.jsx(cm,{entry:x,onOpen:u.onOpen},j))]})}function Ag(u,c){return u?c(u)?u+"/ (folder)":u:"all changes"}function sm(u){const{config:c,apiBase:f,route:r,hub:o,project:m}=u,S=rf(),M=uf(),{tree:g,flatFiles:y,dirIndex:z,loaded:x}=Y0(f,!o||!!m),j=G0(f,o&&!!m&&!!c.reads?.enabled),H=o&&!!m&&!r.path&&!r.view,w=!!u.canInsights&&(r.view==="insights"||H),Q=bg(f,w);q.useEffect(()=>{w&&M.invalidateQueries({queryKey:["heat",f]})},[w,f,M]);const G=r.path,L=!!G&&z.has(G),$=!!G&&x&&!z.has(G),nt=L&&!r.view,[Nt,Mt]=q.useState(()=>new Set),Rt=q.useRef(!0);q.useEffect(()=>{if(!g||!Rt.current)return;Rt.current=!1;const at=(g.children||[]).filter(F=>F.dir);at.length===1&&Mt(F=>new Set(F).add(at[0].path))},[g]),q.useEffect(()=>{if(!G||!x)return;Mt(F=>{const gt=new Set(F);for(const qe of I0(G))gt.add(qe);return z.has(G)&>.add(G),gt});const at=document.querySelector(`#tree .row[data-path="${CSS.escape(G)}"]`);at&&at.scrollIntoView({block:"nearest"})},[G,x,z]);const W=q.useCallback(at=>{Mt(F=>{const gt=new Set(F);return gt.has(at)?gt.delete(at):gt.add(at),gt})},[]),rt=q.useRef(null),Gt=q.useRef(new Map),ae=q.useRef({key:"",want:0,attempts:0});q.useEffect(()=>{ae.current={key:S,want:H0()==="POP"?Gt.current.get(S)??0:0,attempts:0}},[S]);const Vt=q.useCallback(()=>{const at=rt.current,F=ae.current;!at||F.key!==S||F.attempts>=3||(F.attempts++,at.scrollTo({top:F.want,behavior:"instant"}))},[S]),Ut=q.useCallback(()=>{rt.current&&Gt.current.set(S,rt.current.scrollTop)},[S]),Tt=q.useCallback(at=>{Ze(U0(at,m?.id)),Ei()},[m?.id]),te=q.useCallback(at=>Ze(Rd("history",m?.id,at)),[m?.id]),[he,D]=q.useState(""),[B,J]=q.useState(""),[ot,vt]=q.useState(null),[b,U]=q.useState(!1),[Y,X]=q.useState(!1),I=q.useRef(null),et=q.useRef(null),ht=o&&!!m&&$,Xt=o&&!!m,Ot=!!c.upload?.enabled&&(!o||!!m),hl=$,ia=$||o&&!!m&&L,Fa=f+"download?path="+encodeURIComponent(G),ca=q.useCallback(async()=>{try{const at=await fetch(f+"shares",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:G})});if(!at.ok)throw new Error(await at.text());const F=await at.json(),gt=await of(F.url);vt({url:F.url,copied:gt})}catch(at){He("Share failed: "+at.message,!0)}},[f,G]),je=q.useCallback(()=>{if(!G)return te("");te(L?G+"/":G)},[G,L,te]),dl=q.useCallback(()=>I.current?.click(),[]),$a=async()=>{const at=I.current,F=at.files?.[0];if(at.value="",!F)return;const gt=G?L?G:G.includes("/")?G.slice(0,G.lastIndexOf("/")):"":"",qe=gt?gt+"/"+F.name:F.name;try{J(`Uploading ${qe}…`),await K0(f,qe,F),J(`Uploaded ${qe}`),await M.invalidateQueries({queryKey:["tree",f]}),Tt(qe)}catch(sa){J("Upload failed: "+sa.message)}};q.useEffect(()=>{J("")},[S]),q.useEffect(()=>{const at=F=>{(F.metaKey||F.ctrlKey)&&F.key.toLowerCase()==="k"&&(F.preventDefault(),X(gt=>!gt))};return window.addEventListener("keydown",at),()=>window.removeEventListener("keydown",at)},[]);const Ti=q.useCallback(()=>{const at=[],F=(gt,qe,sa,fa)=>at.push({icon:gt,label:qe,kind:sa,run:fa});if(o&&m&&G&&($&&F("share","Share: "+G,"action",ca),F("hist","History: "+G,"action",je),$&&F("download","Download: "+G,"action",()=>et.current?.click())),o&&m&&F("hist","History: whole project","action",()=>te("")),Ot&&F("upload","Upload a file…","action",dl),o)for(const gt of u.projects||[])(!m||gt.id!==m.id)&&F("folder","Switch to project: "+gt.name,"project",()=>Ze("/"+gt.id));c.auth?.enabled&&F("power","Sign out","action",()=>window.location.href="/auth/logout");for(const gt of z.keys())F("folder",gt,"folder",()=>Tt(gt));for(const gt of y)F("doc",gt.path,"file",()=>Tt(gt.path));return at},[o,m,G,$,Ot,c.auth?.enabled,z,y,u.projects,ca,je,dl,te,Tt]);q.useEffect(()=>{if(!b)return;const at=()=>U(!1);return document.addEventListener("click",at),()=>document.removeEventListener("click",at)},[b]);const Yl=q.useCallback(at=>z.has(at),[z]);let Je="markdown",Te;r.view==="insights"?(Je="view",Te=u.canInsights?d.jsx(Qd,{flatFiles:y,heatMap:j,devices:Q,onOpenFile:Tt,onOpenFolder:Tt,isFolder:Yl}):d.jsx("div",{className:"empty",children:"Insights is for hub admins and org owners."})):r.view==="history"?(Je="view",Te=d.jsx(Og,{apiBase:f,target:r.viewTarget||"",isFolder:Yl,onOpen:Tt,onMeta:D,onRendered:Vt})):G?x?L?(Je="view",Te=d.jsx(lg,{node:z.get(G),heatMap:j,hub:o&&!!m,apiBase:f,onOpen:Tt,onFullHistory:te,onRendered:Vt})):Te=d.jsx(ng,{apiBase:f,path:G,heatMap:j,flatFiles:y,onOpenFile:Tt,onMeta:D,onRendered:Vt}):Te=d.jsx("div",{className:"empty",children:"Loading…"}):H?(Je="view",Te=d.jsxs(d.Fragment,{children:[d.jsx(gg,{project:m}),u.canInsights&&d.jsx("div",{className:"home-insights",children:d.jsx(Qd,{flatFiles:y,heatMap:j,devices:Q,onOpenFile:Tt,onOpenFolder:Tt,isFolder:Yl})})]})):Te=d.jsx("div",{className:"empty",children:"Select a file to read it."});const Wa=G?d.jsx(P0,{path:G,onOpenFolder:Tt}):r.view==="insights"?"Insights — "+(m?.name??""):r.view==="history"?"History — "+Ag(r.viewTarget||"",Yl):H?m.name:null,Oi=d.jsx(In,{crumb:Wa,meta:B||he,actions:d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"btn ghost",title:"Search (⌘K)",onClick:()=>X(!0),children:[d.jsx(Pt,{name:"search"})," ",d.jsx("span",{className:"lbl",children:"Search"})," ",d.jsx("kbd",{children:"⌘K"})]}),ht&&d.jsxs("button",{id:"share-btn",className:"btn",onClick:ca,children:[d.jsx(Pt,{name:"share"})," ",d.jsx("span",{className:"lbl",children:"Share"})]}),Xt&&d.jsxs("button",{id:"history-btn",className:"btn",onClick:je,children:[d.jsx(Pt,{name:"hist"})," ",d.jsx("span",{className:"lbl",children:"History"})]}),Ot&&d.jsxs("button",{id:"upload-btn",className:"btn",onClick:dl,children:[d.jsx(Pt,{name:"upload"})," ",d.jsx("span",{className:"lbl",children:"Upload"})]}),d.jsx("input",{type:"file",hidden:!0,ref:I,onChange:$a}),hl&&d.jsxs("a",{id:"download",className:"btn",download:!0,href:Fa,ref:et,children:[d.jsx(Pt,{name:"download"})," ",d.jsx("span",{className:"lbl",children:"Download"})]}),ia&&d.jsx("button",{id:"more-btn",className:"btn icon-only",title:"More actions","aria-label":"More actions",onClick:at=>{at.stopPropagation(),U(!b)},children:d.jsx(Pt,{name:"dots"})}),b&&d.jsxs("div",{id:"more-menu",role:"menu",children:[Xt&&d.jsx("button",{className:"more-item",onClick:je,children:"History"}),Ot&&d.jsx("button",{className:"more-item",onClick:dl,children:"Upload"}),hl&&d.jsx("button",{className:"more-item",onClick:()=>et.current?.click(),children:"Download"}),u.canInsights&&d.jsx("button",{className:"more-item",onClick:()=>Ze(Rd("insights",m?.id)),children:"Insights"})]})]})});return d.jsxs(d.Fragment,{children:[d.jsx(Wn,{vault:u.sidebar.vault,projectsNav:u.sidebar.projectsNav,orgBar:u.sidebar.orgBar,tree:d.jsx($0,{root:g,expanded:Nt,onToggle:W,currentPath:G,listingShowing:nt,onOpen:Tt}),topbar:Oi,contentClass:Je,contentRef:rt,onContentScroll:Ut,children:Te}),ot&&d.jsx(og,{url:ot.url,copied:ot.copied,onClose:()=>vt(null)}),d.jsx(mg,{open:Y,onClose:()=>X(!1),candidates:Ti})]})}function zg({config:u}){const c=rf(),f=tm(),[r,o]=q.useState(null),m=q.useMemo(()=>{const $=c.match(/^\/join\/([0-9a-f]+)\/?$/);return $?$[1]:null},[c]),{data:S}=N0(!m),{data:M}=D0(!m),g=!!u.auth.admin,{data:y}=_0(g),z=q.useMemo(()=>lm(c,"hub"),[c]),x=q.useMemo(()=>S&&(S.find($=>$.id===z.project)||r&&S.find($=>$.org===r)||S[0])||null,[S,z.project,r]);if(q.useEffect(()=>{document.title=x?x.name+" — BearDrive":u.brand||u.volume||"BearDrive"},[x,u]),m)return d.jsx(Mg,{token:m,onDone:async $=>{o($),await f(),Ze("/",{replace:!0})}});const j=u.brand||u.volume||"BearDrive",H=x&&M?.find($=>$.id===x.org)||null,w=M?.find($=>$.role==="owner")||null,Q=H&&H.role==="owner"?H:w,G=g||(H?H.role==="owner":!1),L=d.jsx(ji,{name:S?x?x.name:j:"…",onHome:x?()=>Ze("/"+x.id):void 0,showSignout:u.auth.enabled,admin:g?{pending:y?.length||0,onClick:()=>{}}:void 0,gear:Q?{onClick:()=>{}}:void 0});return!S||!M?d.jsx(Wn,{vault:L,topbar:d.jsx(In,{}),children:d.jsx("div",{className:"empty",children:"Loading…"})}):x?z.project!==x.id?d.jsx(q0,{to:"/"+x.id}):d.jsx(sm,{config:u,apiBase:"/api/p/"+x.id+"/",route:z,hub:!0,project:x,projects:S,canInsights:G,sidebar:{vault:L,projectsNav:d.jsx(Hd,{projects:S,currentId:x.id}),orgBar:d.jsx(Q0,{org:H,onManage:()=>{}})}},x.id):d.jsx(Wn,{vault:L,projectsNav:d.jsx(Hd,{projects:S}),topbar:d.jsx(In,{}),contentClass:"view",children:d.jsx(B0,{authEnabled:u.auth.enabled,onCreate:async $=>{if(!$){He("Give the project a name.",!0);return}try{const nt=await cf("/api/projects",{name:$});await f(),Ze("/"+nt.project.id),He(`Created “${nt.project.name}”.`)}catch(nt){He("Could not create the project: "+nt.message,!0)}}})})}function Mg({token:u,onDone:c}){return q.useEffect(()=>{let f=!1;return cf("/api/invites/"+u).then(r=>{f||(He(`Welcome — you joined the “${r.org.name}” team. Opening its projects…`),c(r.org.id))}).catch(r=>{f||String(r.message).includes("signing in")||(He("Could not accept the invite: "+r.message,!0),c(null))}),()=>{f=!0}},[u]),d.jsx(Wn,{vault:d.jsx(ji,{name:"…",showSignout:!0}),topbar:d.jsx(In,{}),children:d.jsx("div",{className:"empty",children:"Joining…"})})}function Cg({config:u}){const c=rf(),f=u.volume||"BearDrive";q.useEffect(()=>{document.title=u.brand||f},[u,f]);const r=q.useMemo(()=>lm(c,"volume"),[c]);return d.jsx(sm,{config:u,apiBase:"/api/",route:r,hub:!1,sidebar:{vault:d.jsx(ji,{name:f,showSignout:u.auth.enabled})}})}function Ng(){const{data:u}=j0();return d.jsxs(d.Fragment,{children:[u?u.mode==="hub"?d.jsx(zg,{config:u}):d.jsx(Cg,{config:u}):d.jsx(Wn,{vault:d.jsx(ji,{name:"…",showSignout:!1}),topbar:d.jsx(In,{}),children:d.jsx("div",{className:"empty",children:"Loading…"})}),d.jsx(O0,{}),d.jsx(z0,{})]})}const Dg=new f0({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});wv.createRoot(document.getElementById("root")).render(d.jsx(q.StrictMode,{children:d.jsx(r0,{client:Dg,children:d.jsx(Ng,{})})})); diff --git a/internal/webapp/static/assets/index-DAT78awr.js b/internal/webapp/static/assets/index-DAT78awr.js deleted file mode 100644 index 7f41624..0000000 --- a/internal/webapp/static/assets/index-DAT78awr.js +++ /dev/null @@ -1,11 +0,0 @@ -(function(){const c=document.createElement("link").relList;if(c&&c.supports&&c.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const h of o)if(h.type==="childList")for(const m of h.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&r(m)}).observe(document,{childList:!0,subtree:!0});function s(o){const h={};return o.integrity&&(h.integrity=o.integrity),o.referrerPolicy&&(h.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?h.credentials="include":o.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function r(o){if(o.ep)return;o.ep=!0;const h=s(o);fetch(o.href,h)}})();var ar={exports:{}},Wn={};var qd;function xp(){if(qd)return Wn;qd=1;var n=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function s(r,o,h){var m=null;if(h!==void 0&&(m=""+h),o.key!==void 0&&(m=""+o.key),"key"in o){h={};for(var p in o)p!=="key"&&(h[p]=o[p])}else h=o;return o=h.ref,{$$typeof:n,type:r,key:m,ref:o!==void 0?o:null,props:h}}return Wn.Fragment=c,Wn.jsx=s,Wn.jsxs=s,Wn}var Bd;function Cp(){return Bd||(Bd=1,ar.exports=xp()),ar.exports}var g=Cp(),nr={exports:{}},tt={};var Ld;function Ap(){if(Ld)return tt;Ld=1;var n=Symbol.for("react.transitional.element"),c=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),m=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),C=Symbol.iterator;function B(T){return T===null||typeof T!="object"?null:(T=C&&T[C]||T["@@iterator"],typeof T=="function"?T:null)}var L={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D=Object.assign,q={};function Q(T,H,X){this.props=T,this.context=H,this.refs=q,this.updater=X||L}Q.prototype.isReactComponent={},Q.prototype.setState=function(T,H){if(typeof T!="object"&&typeof T!="function"&&T!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,T,H,"setState")},Q.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function V(){}V.prototype=Q.prototype;function Y(T,H,X){this.props=T,this.context=H,this.refs=q,this.updater=X||L}var P=Y.prototype=new V;P.constructor=Y,D(P,Q.prototype),P.isPureReactComponent=!0;var at=Array.isArray;function St(){}var k={H:null,A:null,T:null,S:null},it=Object.prototype.hasOwnProperty;function jt(T,H,X){var K=X.ref;return{$$typeof:n,type:T,key:H,ref:K!==void 0?K:null,props:X}}function Jt(T,H){return jt(T.type,H,T.props)}function $t(T){return typeof T=="object"&&T!==null&&T.$$typeof===n}function bt(T){var H={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(X){return H[X]})}var Nt=/\/+/g;function ie(T,H){return typeof T=="object"&&T!==null&&T.key!=null?bt(""+T.key):H.toString(36)}function Ut(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(St,St):(T.status="pending",T.then(function(H){T.status==="pending"&&(T.status="fulfilled",T.value=H)},function(H){T.status==="pending"&&(T.status="rejected",T.reason=H)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function N(T,H,X,K,I){var ut=typeof T;(ut==="undefined"||ut==="boolean")&&(T=null);var dt=!1;if(T===null)dt=!0;else switch(ut){case"bigint":case"string":case"number":dt=!0;break;case"object":switch(T.$$typeof){case n:case c:dt=!0;break;case R:return dt=T._init,N(dt(T._payload),H,X,K,I)}}if(dt)return I=I(T),dt=K===""?"."+ie(T,0):K,at(I)?(X="",dt!=null&&(X=dt.replace(Nt,"$&/")+"/"),N(I,H,X,"",function(Xl){return Xl})):I!=null&&($t(I)&&(I=Jt(I,X+(I.key==null||T&&T.key===I.key?"":(""+I.key).replace(Nt,"$&/")+"/")+dt)),H.push(I)),1;dt=0;var Qt=K===""?".":K+":";if(at(T))for(var Dt=0;Dt>>1,mt=N[pt];if(0>>1;pto(X,$))Ko(I,X)?(N[pt]=I,N[K]=$,pt=K):(N[pt]=X,N[H]=$,pt=H);else if(Ko(I,$))N[pt]=I,N[K]=$,pt=K;else break t}}return G}function o(N,G){var $=N.sortIndex-G.sortIndex;return $!==0?$:N.id-G.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var h=performance;n.unstable_now=function(){return h.now()}}else{var m=Date,p=m.now();n.unstable_now=function(){return m.now()-p}}var v=[],y=[],R=1,S=null,C=3,B=!1,L=!1,D=!1,q=!1,Q=typeof setTimeout=="function"?setTimeout:null,V=typeof clearTimeout=="function"?clearTimeout:null,Y=typeof setImmediate<"u"?setImmediate:null;function P(N){for(var G=s(y);G!==null;){if(G.callback===null)r(y);else if(G.startTime<=N)r(y),G.sortIndex=G.expirationTime,c(v,G);else break;G=s(y)}}function at(N){if(D=!1,P(N),!L)if(s(v)!==null)L=!0,St||(St=!0,bt());else{var G=s(y);G!==null&&Ut(at,G.startTime-N)}}var St=!1,k=-1,it=5,jt=-1;function Jt(){return q?!0:!(n.unstable_now()-jtN&&Jt());){var pt=S.callback;if(typeof pt=="function"){S.callback=null,C=S.priorityLevel;var mt=pt(S.expirationTime<=N);if(N=n.unstable_now(),typeof mt=="function"){S.callback=mt,P(N),G=!0;break e}S===s(v)&&r(v),P(N)}else r(v);S=s(v)}if(S!==null)G=!0;else{var T=s(y);T!==null&&Ut(at,T.startTime-N),G=!1}}break t}finally{S=null,C=$,B=!1}G=void 0}}finally{G?bt():St=!1}}}var bt;if(typeof Y=="function")bt=function(){Y($t)};else if(typeof MessageChannel<"u"){var Nt=new MessageChannel,ie=Nt.port2;Nt.port1.onmessage=$t,bt=function(){ie.postMessage(null)}}else bt=function(){Q($t,0)};function Ut(N,G){k=Q(function(){N(n.unstable_now())},G)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(N){N.callback=null},n.unstable_forceFrameRate=function(N){0>N||125pt?(N.sortIndex=$,c(y,N),s(v)===null&&N===s(y)&&(D?(V(k),k=-1):D=!0,Ut(at,$-pt))):(N.sortIndex=mt,c(v,N),L||B||(L=!0,St||(St=!0,bt()))),N},n.unstable_shouldYield=Jt,n.unstable_wrapCallback=function(N){var G=C;return function(){var $=C;C=G;try{return N.apply(this,arguments)}finally{C=$}}}})(cr)),cr}var Gd;function zp(){return Gd||(Gd=1,ir.exports=jp()),ir.exports}var sr={exports:{}},ne={};var Xd;function Mp(){if(Xd)return ne;Xd=1;var n=Sr();function c(v){var y="https://react.dev/errors/"+v;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(c){console.error(c)}}return n(),sr.exports=Mp(),sr.exports}var Zd;function _p(){if(Zd)return In;Zd=1;var n=zp(),c=Sr(),s=Dp();function r(t){var e="https://react.dev/errors/"+t;if(1mt||(t.current=pt[mt],pt[mt]=null,mt--)}function X(t,e){mt++,pt[mt]=t.current,t.current=e}var K=T(null),I=T(null),ut=T(null),dt=T(null);function Qt(t,e){switch(X(ut,e),X(I,t),X(K,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?id(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=id(e),t=cd(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}H(K),X(K,t)}function Dt(){H(K),H(I),H(ut)}function Xl(t){t.memoizedState!==null&&X(dt,t);var e=K.current,l=cd(e,t.type);e!==l&&(X(I,t),X(K,l))}function oa(t){I.current===t&&(H(K),H(I)),dt.current===t&&(H(dt),Jn._currentValue=$)}var Kl,Zl;function Ae(t){if(Kl===void 0)try{throw Error()}catch(l){var e=l.stack.trim().match(/\n( *(at )?)/);Kl=e&&e[1]||"",Zl=-1)":-1u||b[a]!==j[u]){var _=` -`+b[a].replace(" at new "," at ");return t.displayName&&_.includes("")&&(_=_.replace("",t.displayName)),_}while(1<=a&&0<=u);break}}}finally{Pa=!1,Error.prepareStackTrace=l}return(l=t?t.displayName||t.name:"")?Ae(l):""}function ha(t,e){switch(t.tag){case 26:case 27:case 5:return Ae(t.type);case 16:return Ae("Lazy");case 13:return t.child!==e&&e!==null?Ae("Suspense Fallback"):Ae("Suspense");case 19:return Ae("SuspenseList");case 0:case 15:return tn(t.type,!1);case 11:return tn(t.type.render,!1);case 1:return tn(t.type,!0);case 31:return Ae("Activity");default:return""}}function Ke(t){try{var e="",l=null;do e+=ha(t,l),l=t,t=t.return;while(t);return e}catch(a){return` -Error generating stack: `+a.message+` -`+a.stack}}var en=Object.prototype.hasOwnProperty,ln=n.unstable_scheduleCallback,nt=n.unstable_cancelCallback,ct=n.unstable_shouldYield,Et=n.unstable_requestPaint,wt=n.unstable_now,an=n.unstable_getCurrentPriorityLevel,ou=n.unstable_ImmediatePriority,qr=n.unstable_UserBlockingPriority,hu=n.unstable_NormalPriority,iy=n.unstable_LowPriority,Br=n.unstable_IdlePriority,cy=n.log,sy=n.unstable_setDisableYieldValue,nn=null,ye=null;function vl(t){if(typeof cy=="function"&&sy(t),ye&&typeof ye.setStrictMode=="function")try{ye.setStrictMode(nn,t)}catch{}}var ve=Math.clz32?Math.clz32:oy,ry=Math.log,fy=Math.LN2;function oy(t){return t>>>=0,t===0?32:31-(ry(t)/fy|0)|0}var du=256,mu=262144,yu=4194304;function Vl(t){var e=t&42;if(e!==0)return e;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function vu(t,e,l){var a=t.pendingLanes;if(a===0)return 0;var u=0,i=t.suspendedLanes,f=t.pingedLanes;t=t.warmLanes;var d=a&134217727;return d!==0?(a=d&~i,a!==0?u=Vl(a):(f&=d,f!==0?u=Vl(f):l||(l=d&~t,l!==0&&(u=Vl(l))))):(d=a&~i,d!==0?u=Vl(d):f!==0?u=Vl(f):l||(l=a&~t,l!==0&&(u=Vl(l)))),u===0?0:e!==0&&e!==u&&(e&i)===0&&(i=u&-u,l=e&-e,i>=l||i===32&&(l&4194048)!==0)?e:u}function un(t,e){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&e)===0}function hy(t,e){switch(t){case 1:case 2:case 4:case 8:case 64:return e+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Lr(){var t=yu;return yu<<=1,(yu&62914560)===0&&(yu=4194304),t}function Zi(t){for(var e=[],l=0;31>l;l++)e.push(t);return e}function cn(t,e){t.pendingLanes|=e,e!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function dy(t,e,l,a,u,i){var f=t.pendingLanes;t.pendingLanes=l,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=l,t.entangledLanes&=l,t.errorRecoveryDisabledLanes&=l,t.shellSuspendCounter=0;var d=t.entanglements,b=t.expirationTimes,j=t.hiddenUpdates;for(l=f&~l;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var by=/[\n"\\]/g;function ze(t){return t.replace(by,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function Wi(t,e,l,a,u,i,f,d){t.name="",f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?t.type=f:t.removeAttribute("type"),e!=null?f==="number"?(e===0&&t.value===""||t.value!=e)&&(t.value=""+je(e)):t.value!==""+je(e)&&(t.value=""+je(e)):f!=="submit"&&f!=="reset"||t.removeAttribute("value"),e!=null?Ii(t,f,je(e)):l!=null?Ii(t,f,je(l)):a!=null&&t.removeAttribute("value"),u==null&&i!=null&&(t.defaultChecked=!!i),u!=null&&(t.checked=u&&typeof u!="function"&&typeof u!="symbol"),d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"?t.name=""+je(d):t.removeAttribute("name")}function Ir(t,e,l,a,u,i,f,d){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(t.type=i),e!=null||l!=null){if(!(i!=="submit"&&i!=="reset"||e!=null)){$i(t);return}l=l!=null?""+je(l):"",e=e!=null?""+je(e):l,d||e===t.value||(t.value=e),t.defaultValue=e}a=a??u,a=typeof a!="function"&&typeof a!="symbol"&&!!a,t.checked=d?t.checked:!!a,t.defaultChecked=!!a,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(t.name=f),$i(t)}function Ii(t,e,l){e==="number"&&bu(t.ownerDocument)===t||t.defaultValue===""+l||(t.defaultValue=""+l)}function ga(t,e,l,a){if(t=t.options,e){e={};for(var u=0;u"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ac=!1;if(Ie)try{var on={};Object.defineProperty(on,"passive",{get:function(){ac=!0}}),window.addEventListener("test",on,on),window.removeEventListener("test",on,on)}catch{ac=!1}var gl=null,nc=null,Eu=null;function uf(){if(Eu)return Eu;var t,e=nc,l=e.length,a,u="value"in gl?gl.value:gl.textContent,i=u.length;for(t=0;t=mn),hf=" ",df=!1;function mf(t,e){switch(t){case"keyup":return Jy.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ta=!1;function Fy(t,e){switch(t){case"compositionend":return yf(e);case"keypress":return e.which!==32?null:(df=!0,hf);case"textInput":return t=e.data,t===hf&&df?null:t;default:return null}}function $y(t,e){if(Ta)return t==="compositionend"||!rc&&mf(t,e)?(t=uf(),Eu=nc=gl=null,Ta=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:l,offset:e-t};t=a}t:{for(;l;){if(l.nextSibling){l=l.nextSibling;break t}l=l.parentNode}l=void 0}l=Rf(l)}}function xf(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?xf(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Cf(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var e=bu(t.document);e instanceof t.HTMLIFrameElement;){try{var l=typeof e.contentWindow.location.href=="string"}catch{l=!1}if(l)t=e.contentWindow;else break;e=bu(t.document)}return e}function hc(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}var nv=Ie&&"documentMode"in document&&11>=document.documentMode,Ra=null,dc=null,gn=null,mc=!1;function Af(t,e,l){var a=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;mc||Ra==null||Ra!==bu(a)||(a=Ra,"selectionStart"in a&&hc(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),gn&&pn(gn,a)||(gn=a,a=mi(dc,"onSelect"),0>=f,u-=f,Ze=1<<32-ve(e)+u|l<lt?(ot=J,J=null):ot=J.sibling;var vt=z(x,J,A[lt],U);if(vt===null){J===null&&(J=ot);break}t&&J&&vt.alternate===null&&e(x,J),E=i(vt,E,lt),yt===null?F=vt:yt.sibling=vt,yt=vt,J=ot}if(lt===A.length)return l(x,J),ht&&tl(x,lt),F;if(J===null){for(;ltlt?(ot=J,J=null):ot=J.sibling;var Ql=z(x,J,vt.value,U);if(Ql===null){J===null&&(J=ot);break}t&&J&&Ql.alternate===null&&e(x,J),E=i(Ql,E,lt),yt===null?F=Ql:yt.sibling=Ql,yt=Ql,J=ot}if(vt.done)return l(x,J),ht&&tl(x,lt),F;if(J===null){for(;!vt.done;lt++,vt=A.next())vt=w(x,vt.value,U),vt!==null&&(E=i(vt,E,lt),yt===null?F=vt:yt.sibling=vt,yt=vt);return ht&&tl(x,lt),F}for(J=a(J);!vt.done;lt++,vt=A.next())vt=M(J,x,lt,vt.value,U),vt!==null&&(t&&vt.alternate!==null&&J.delete(vt.key===null?lt:vt.key),E=i(vt,E,lt),yt===null?F=vt:yt.sibling=vt,yt=vt);return t&&J.forEach(function(Op){return e(x,Op)}),ht&&tl(x,lt),F}function Ct(x,E,A,U){if(typeof A=="object"&&A!==null&&A.type===D&&A.key===null&&(A=A.props.children),typeof A=="object"&&A!==null){switch(A.$$typeof){case B:t:{for(var F=A.key;E!==null;){if(E.key===F){if(F=A.type,F===D){if(E.tag===7){l(x,E.sibling),U=u(E,A.props.children),U.return=x,x=U;break t}}else if(E.elementType===F||typeof F=="object"&&F!==null&&F.$$typeof===it&&aa(F)===E.type){l(x,E.sibling),U=u(E,A.props),On(U,A),U.return=x,x=U;break t}l(x,E);break}else e(x,E);E=E.sibling}A.type===D?(U=Il(A.props.children,x.mode,U,A.key),U.return=x,x=U):(U=Du(A.type,A.key,A.props,null,x.mode,U),On(U,A),U.return=x,x=U)}return f(x);case L:t:{for(F=A.key;E!==null;){if(E.key===F)if(E.tag===4&&E.stateNode.containerInfo===A.containerInfo&&E.stateNode.implementation===A.implementation){l(x,E.sibling),U=u(E,A.children||[]),U.return=x,x=U;break t}else{l(x,E);break}else e(x,E);E=E.sibling}U=Ec(A,x.mode,U),U.return=x,x=U}return f(x);case it:return A=aa(A),Ct(x,E,A,U)}if(Ut(A))return Z(x,E,A,U);if(bt(A)){if(F=bt(A),typeof F!="function")throw Error(r(150));return A=F.call(A),W(x,E,A,U)}if(typeof A.then=="function")return Ct(x,E,Bu(A),U);if(A.$$typeof===Y)return Ct(x,E,Uu(x,A),U);Lu(x,A)}return typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint"?(A=""+A,E!==null&&E.tag===6?(l(x,E.sibling),U=u(E,A),U.return=x,x=U):(l(x,E),U=Sc(A,x.mode,U),U.return=x,x=U),f(x)):l(x,E)}return function(x,E,A,U){try{Rn=0;var F=Ct(x,E,A,U);return Ua=null,F}catch(J){if(J===Na||J===Hu)throw J;var yt=ge(29,J,null,x.mode);return yt.lanes=U,yt.return=x,yt}}}var ua=$f(!0),Wf=$f(!1),Rl=!1;function Nc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Uc(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Ol(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function xl(t,e,l){var a=t.updateQueue;if(a===null)return null;if(a=a.shared,(gt&2)!==0){var u=a.pending;return u===null?e.next=e:(e.next=u.next,u.next=e),a.pending=e,e=Mu(t),Uf(t,null,l),e}return zu(t,a,e,l),Mu(t)}function xn(t,e,l){if(e=e.updateQueue,e!==null&&(e=e.shared,(l&4194048)!==0)){var a=e.lanes;a&=t.pendingLanes,l|=a,e.lanes=l,Yr(t,l)}}function wc(t,e){var l=t.updateQueue,a=t.alternate;if(a!==null&&(a=a.updateQueue,l===a)){var u=null,i=null;if(l=l.firstBaseUpdate,l!==null){do{var f={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};i===null?u=i=f:i=i.next=f,l=l.next}while(l!==null);i===null?u=i=e:i=i.next=e}else u=i=e;l={baseState:a.baseState,firstBaseUpdate:u,lastBaseUpdate:i,shared:a.shared,callbacks:a.callbacks},t.updateQueue=l;return}t=l.lastBaseUpdate,t===null?l.firstBaseUpdate=e:t.next=e,l.lastBaseUpdate=e}var Hc=!1;function Cn(){if(Hc){var t=_a;if(t!==null)throw t}}function An(t,e,l,a){Hc=!1;var u=t.updateQueue;Rl=!1;var i=u.firstBaseUpdate,f=u.lastBaseUpdate,d=u.shared.pending;if(d!==null){u.shared.pending=null;var b=d,j=b.next;b.next=null,f===null?i=j:f.next=j,f=b;var _=t.alternate;_!==null&&(_=_.updateQueue,d=_.lastBaseUpdate,d!==f&&(d===null?_.firstBaseUpdate=j:d.next=j,_.lastBaseUpdate=b))}if(i!==null){var w=u.baseState;f=0,_=j=b=null,d=i;do{var z=d.lane&-536870913,M=z!==d.lane;if(M?(ft&z)===z:(a&z)===z){z!==0&&z===Da&&(Hc=!0),_!==null&&(_=_.next={lane:0,tag:d.tag,payload:d.payload,callback:null,next:null});t:{var Z=t,W=d;z=e;var Ct=l;switch(W.tag){case 1:if(Z=W.payload,typeof Z=="function"){w=Z.call(Ct,w,z);break t}w=Z;break t;case 3:Z.flags=Z.flags&-65537|128;case 0:if(Z=W.payload,z=typeof Z=="function"?Z.call(Ct,w,z):Z,z==null)break t;w=S({},w,z);break t;case 2:Rl=!0}}z=d.callback,z!==null&&(t.flags|=64,M&&(t.flags|=8192),M=u.callbacks,M===null?u.callbacks=[z]:M.push(z))}else M={lane:z,tag:d.tag,payload:d.payload,callback:d.callback,next:null},_===null?(j=_=M,b=w):_=_.next=M,f|=z;if(d=d.next,d===null){if(d=u.shared.pending,d===null)break;M=d,d=M.next,M.next=null,u.lastBaseUpdate=M,u.shared.pending=null}}while(!0);_===null&&(b=w),u.baseState=b,u.firstBaseUpdate=j,u.lastBaseUpdate=_,i===null&&(u.shared.lanes=0),Ml|=f,t.lanes=f,t.memoizedState=w}}function If(t,e){if(typeof t!="function")throw Error(r(191,t));t.call(e)}function Pf(t,e){var l=t.callbacks;if(l!==null)for(t.callbacks=null,t=0;ti?i:8;var f=N.T,d={};N.T=d,es(t,!1,e,l);try{var b=u(),j=N.S;if(j!==null&&j(d,b),b!==null&&typeof b=="object"&&typeof b.then=="function"){var _=dv(b,a);Mn(t,e,_,Re(t))}else Mn(t,e,a,Re(t))}catch(w){Mn(t,e,{then:function(){},status:"rejected",reason:w},Re())}finally{G.p=i,f!==null&&d.types!==null&&(f.types=d.types),N.T=f}}function bv(){}function Pc(t,e,l,a){if(t.tag!==5)throw Error(r(476));var u=_o(t).queue;Do(t,u,e,$,l===null?bv:function(){return No(t),l(a)})}function _o(t){var e=t.memoizedState;if(e!==null)return e;e={memoizedState:$,baseState:$,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nl,lastRenderedState:$},next:null};var l={};return e.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nl,lastRenderedState:l},next:null},t.memoizedState=e,t=t.alternate,t!==null&&(t.memoizedState=e),e}function No(t){var e=_o(t);e.next===null&&(e=t.alternate.memoizedState),Mn(t,e.next.queue,{},Re())}function ts(){return Pt(Jn)}function Uo(){return Lt().memoizedState}function wo(){return Lt().memoizedState}function Sv(t){for(var e=t.return;e!==null;){switch(e.tag){case 24:case 3:var l=Re();t=Ol(l);var a=xl(e,t,l);a!==null&&(de(a,e,l),xn(a,e,l)),e={cache:zc()},t.payload=e;return}e=e.return}}function Ev(t,e,l){var a=Re();l={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Fu(t)?qo(e,l):(l=gc(t,e,l,a),l!==null&&(de(l,t,a),Bo(l,e,a)))}function Ho(t,e,l){var a=Re();Mn(t,e,l,a)}function Mn(t,e,l,a){var u={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Fu(t))qo(e,u);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var f=e.lastRenderedState,d=i(f,l);if(u.hasEagerState=!0,u.eagerState=d,pe(d,f))return zu(t,e,u,0),At===null&&ju(),!1}catch{}if(l=gc(t,e,u,a),l!==null)return de(l,t,a),Bo(l,e,a),!0}return!1}function es(t,e,l,a){if(a={lane:2,revertLane:Ns(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Fu(t)){if(e)throw Error(r(479))}else e=gc(t,l,a,2),e!==null&&de(e,t,2)}function Fu(t){var e=t.alternate;return t===et||e!==null&&e===et}function qo(t,e){Ha=Gu=!0;var l=t.pending;l===null?e.next=e:(e.next=l.next,l.next=e),t.pending=e}function Bo(t,e,l){if((l&4194048)!==0){var a=e.lanes;a&=t.pendingLanes,l|=a,e.lanes=l,Yr(t,l)}}var Dn={readContext:Pt,use:Zu,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useLayoutEffect:Ht,useInsertionEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useSyncExternalStore:Ht,useId:Ht,useHostTransitionStatus:Ht,useFormState:Ht,useActionState:Ht,useOptimistic:Ht,useMemoCache:Ht,useCacheRefresh:Ht};Dn.useEffectEvent=Ht;var Lo={readContext:Pt,use:Zu,useCallback:function(t,e){return ue().memoizedState=[t,e===void 0?null:e],t},useContext:Pt,useEffect:To,useImperativeHandle:function(t,e,l){l=l!=null?l.concat([t]):null,Ju(4194308,4,Co.bind(null,e,t),l)},useLayoutEffect:function(t,e){return Ju(4194308,4,t,e)},useInsertionEffect:function(t,e){Ju(4,2,t,e)},useMemo:function(t,e){var l=ue();e=e===void 0?null:e;var a=t();if(ia){vl(!0);try{t()}finally{vl(!1)}}return l.memoizedState=[a,e],a},useReducer:function(t,e,l){var a=ue();if(l!==void 0){var u=l(e);if(ia){vl(!0);try{l(e)}finally{vl(!1)}}}else u=e;return a.memoizedState=a.baseState=u,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:u},a.queue=t,t=t.dispatch=Ev.bind(null,et,t),[a.memoizedState,t]},useRef:function(t){var e=ue();return t={current:t},e.memoizedState=t},useState:function(t){t=kc(t);var e=t.queue,l=Ho.bind(null,et,e);return e.dispatch=l,[t.memoizedState,l]},useDebugValue:Wc,useDeferredValue:function(t,e){var l=ue();return Ic(l,t,e)},useTransition:function(){var t=kc(!1);return t=Do.bind(null,et,t.queue,!0,!1),ue().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,e,l){var a=et,u=ue();if(ht){if(l===void 0)throw Error(r(407));l=l()}else{if(l=e(),At===null)throw Error(r(349));(ft&127)!==0||uo(a,e,l)}u.memoizedState=l;var i={value:l,getSnapshot:e};return u.queue=i,To(co.bind(null,a,i,t),[t]),a.flags|=2048,Ba(9,{destroy:void 0},io.bind(null,a,i,l,e),null),l},useId:function(){var t=ue(),e=At.identifierPrefix;if(ht){var l=Ve,a=Ze;l=(a&~(1<<32-ve(a)-1)).toString(32)+l,e="_"+e+"R_"+l,l=Xu++,0<\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof a.is=="string"?f.createElement("select",{is:a.is}):f.createElement("select"),a.multiple?i.multiple=!0:a.size&&(i.size=a.size);break;default:i=typeof a.is=="string"?f.createElement(u,{is:a.is}):f.createElement(u)}}i[Wt]=e,i[ce]=a;t:for(f=e.child;f!==null;){if(f.tag===5||f.tag===6)i.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break t;for(;f.sibling===null;){if(f.return===null||f.return===e)break t;f=f.return}f.sibling.return=f.return,f=f.sibling}e.stateNode=i;t:switch(ee(i,u,a),u){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break t;case"img":a=!0;break t;default:a=!1}a&&il(e)}}return Mt(e),ys(e,e.type,t===null?null:t.memoizedProps,e.pendingProps,l),null;case 6:if(t&&e.stateNode!=null)t.memoizedProps!==a&&il(e);else{if(typeof a!="string"&&e.stateNode===null)throw Error(r(166));if(t=ut.current,za(e)){if(t=e.stateNode,l=e.memoizedProps,a=null,u=It,u!==null)switch(u.tag){case 27:case 5:a=u.memoizedProps}t[Wt]=e,t=!!(t.nodeValue===l||a!==null&&a.suppressHydrationWarning===!0||nd(t.nodeValue,l)),t||El(e,!0)}else t=yi(t).createTextNode(a),t[Wt]=e,e.stateNode=t}return Mt(e),null;case 31:if(l=e.memoizedState,t===null||t.memoizedState!==null){if(a=za(e),l!==null){if(t===null){if(!a)throw Error(r(318));if(t=e.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(557));t[Wt]=e}else Pl(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;Mt(e),t=!1}else l=xc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=l),t=!0;if(!t)return e.flags&256?(Se(e),e):(Se(e),null);if((e.flags&128)!==0)throw Error(r(558))}return Mt(e),null;case 13:if(a=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(u=za(e),a!==null&&a.dehydrated!==null){if(t===null){if(!u)throw Error(r(318));if(u=e.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));u[Wt]=e}else Pl(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;Mt(e),u=!1}else u=xc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=u),u=!0;if(!u)return e.flags&256?(Se(e),e):(Se(e),null)}return Se(e),(e.flags&128)!==0?(e.lanes=l,e):(l=a!==null,t=t!==null&&t.memoizedState!==null,l&&(a=e.child,u=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(u=a.alternate.memoizedState.cachePool.pool),i=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(i=a.memoizedState.cachePool.pool),i!==u&&(a.flags|=2048)),l!==t&&l&&(e.child.flags|=8192),ti(e,e.updateQueue),Mt(e),null);case 4:return Dt(),t===null&&qs(e.stateNode.containerInfo),Mt(e),null;case 10:return ll(e.type),Mt(e),null;case 19:if(H(Bt),a=e.memoizedState,a===null)return Mt(e),null;if(u=(e.flags&128)!==0,i=a.rendering,i===null)if(u)Nn(a,!1);else{if(qt!==0||t!==null&&(t.flags&128)!==0)for(t=e.child;t!==null;){if(i=Yu(t),i!==null){for(e.flags|=128,Nn(a,!1),t=i.updateQueue,e.updateQueue=t,ti(e,t),e.subtreeFlags=0,t=l,l=e.child;l!==null;)wf(l,t),l=l.sibling;return X(Bt,Bt.current&1|2),ht&&tl(e,a.treeForkCount),e.child}t=t.sibling}a.tail!==null&&wt()>ui&&(e.flags|=128,u=!0,Nn(a,!1),e.lanes=4194304)}else{if(!u)if(t=Yu(i),t!==null){if(e.flags|=128,u=!0,t=t.updateQueue,e.updateQueue=t,ti(e,t),Nn(a,!0),a.tail===null&&a.tailMode==="hidden"&&!i.alternate&&!ht)return Mt(e),null}else 2*wt()-a.renderingStartTime>ui&&l!==536870912&&(e.flags|=128,u=!0,Nn(a,!1),e.lanes=4194304);a.isBackwards?(i.sibling=e.child,e.child=i):(t=a.last,t!==null?t.sibling=i:e.child=i,a.last=i)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=wt(),t.sibling=null,l=Bt.current,X(Bt,u?l&1|2:l&1),ht&&tl(e,a.treeForkCount),t):(Mt(e),null);case 22:case 23:return Se(e),Bc(),a=e.memoizedState!==null,t!==null?t.memoizedState!==null!==a&&(e.flags|=8192):a&&(e.flags|=8192),a?(l&536870912)!==0&&(e.flags&128)===0&&(Mt(e),e.subtreeFlags&6&&(e.flags|=8192)):Mt(e),l=e.updateQueue,l!==null&&ti(e,l.retryQueue),l=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),a=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),a!==l&&(e.flags|=2048),t!==null&&H(la),null;case 24:return l=null,t!==null&&(l=t.memoizedState.cache),e.memoizedState.cache!==l&&(e.flags|=2048),ll(Yt),Mt(e),null;case 25:return null;case 30:return null}throw Error(r(156,e.tag))}function Cv(t,e){switch(Rc(e),e.tag){case 1:return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return ll(Yt),Dt(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 26:case 27:case 5:return oa(e),null;case 31:if(e.memoizedState!==null){if(Se(e),e.alternate===null)throw Error(r(340));Pl()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 13:if(Se(e),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(r(340));Pl()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return H(Bt),null;case 4:return Dt(),null;case 10:return ll(e.type),null;case 22:case 23:return Se(e),Bc(),t!==null&&H(la),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 24:return ll(Yt),null;case 25:return null;default:return null}}function rh(t,e){switch(Rc(e),e.tag){case 3:ll(Yt),Dt();break;case 26:case 27:case 5:oa(e);break;case 4:Dt();break;case 31:e.memoizedState!==null&&Se(e);break;case 13:Se(e);break;case 19:H(Bt);break;case 10:ll(e.type);break;case 22:case 23:Se(e),Bc(),t!==null&&H(la);break;case 24:ll(Yt)}}function Un(t,e){try{var l=e.updateQueue,a=l!==null?l.lastEffect:null;if(a!==null){var u=a.next;l=u;do{if((l.tag&t)===t){a=void 0;var i=l.create,f=l.inst;a=i(),f.destroy=a}l=l.next}while(l!==u)}}catch(d){Rt(e,e.return,d)}}function jl(t,e,l){try{var a=e.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var i=u.next;a=i;do{if((a.tag&t)===t){var f=a.inst,d=f.destroy;if(d!==void 0){f.destroy=void 0,u=e;var b=l,j=d;try{j()}catch(_){Rt(u,b,_)}}}a=a.next}while(a!==i)}}catch(_){Rt(e,e.return,_)}}function fh(t){var e=t.updateQueue;if(e!==null){var l=t.stateNode;try{Pf(e,l)}catch(a){Rt(t,t.return,a)}}}function oh(t,e,l){l.props=ca(t.type,t.memoizedProps),l.state=t.memoizedState;try{l.componentWillUnmount()}catch(a){Rt(t,e,a)}}function wn(t,e){try{var l=t.ref;if(l!==null){switch(t.tag){case 26:case 27:case 5:var a=t.stateNode;break;case 30:a=t.stateNode;break;default:a=t.stateNode}typeof l=="function"?t.refCleanup=l(a):l.current=a}}catch(u){Rt(t,e,u)}}function Je(t,e){var l=t.ref,a=t.refCleanup;if(l!==null)if(typeof a=="function")try{a()}catch(u){Rt(t,e,u)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(u){Rt(t,e,u)}else l.current=null}function hh(t){var e=t.type,l=t.memoizedProps,a=t.stateNode;try{t:switch(e){case"button":case"input":case"select":case"textarea":l.autoFocus&&a.focus();break t;case"img":l.src?a.src=l.src:l.srcSet&&(a.srcset=l.srcSet)}}catch(u){Rt(t,t.return,u)}}function vs(t,e,l){try{var a=t.stateNode;kv(a,t.type,l,e),a[ce]=e}catch(u){Rt(t,t.return,u)}}function dh(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&wl(t.type)||t.tag===4}function ps(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||dh(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&wl(t.type)||t.flags&2||t.child===null||t.tag===4)continue t;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function gs(t,e,l){var a=t.tag;if(a===5||a===6)t=t.stateNode,e?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(t,e):(e=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,e.appendChild(t),l=l._reactRootContainer,l!=null||e.onclick!==null||(e.onclick=We));else if(a!==4&&(a===27&&wl(t.type)&&(l=t.stateNode,e=null),t=t.child,t!==null))for(gs(t,e,l),t=t.sibling;t!==null;)gs(t,e,l),t=t.sibling}function ei(t,e,l){var a=t.tag;if(a===5||a===6)t=t.stateNode,e?l.insertBefore(t,e):l.appendChild(t);else if(a!==4&&(a===27&&wl(t.type)&&(l=t.stateNode),t=t.child,t!==null))for(ei(t,e,l),t=t.sibling;t!==null;)ei(t,e,l),t=t.sibling}function mh(t){var e=t.stateNode,l=t.memoizedProps;try{for(var a=t.type,u=e.attributes;u.length;)e.removeAttributeNode(u[0]);ee(e,a,l),e[Wt]=t,e[ce]=l}catch(i){Rt(t,t.return,i)}}var cl=!1,Kt=!1,bs=!1,yh=typeof WeakSet=="function"?WeakSet:Set,Ft=null;function Av(t,e){if(t=t.containerInfo,Qs=Ti,t=Cf(t),hc(t)){if("selectionStart"in t)var l={start:t.selectionStart,end:t.selectionEnd};else t:{l=(l=t.ownerDocument)&&l.defaultView||window;var a=l.getSelection&&l.getSelection();if(a&&a.rangeCount!==0){l=a.anchorNode;var u=a.anchorOffset,i=a.focusNode;a=a.focusOffset;try{l.nodeType,i.nodeType}catch{l=null;break t}var f=0,d=-1,b=-1,j=0,_=0,w=t,z=null;e:for(;;){for(var M;w!==l||u!==0&&w.nodeType!==3||(d=f+u),w!==i||a!==0&&w.nodeType!==3||(b=f+a),w.nodeType===3&&(f+=w.nodeValue.length),(M=w.firstChild)!==null;)z=w,w=M;for(;;){if(w===t)break e;if(z===l&&++j===u&&(d=f),z===i&&++_===a&&(b=f),(M=w.nextSibling)!==null)break;w=z,z=w.parentNode}w=M}l=d===-1||b===-1?null:{start:d,end:b}}else l=null}l=l||{start:0,end:0}}else l=null;for(Ys={focusedElem:t,selectionRange:l},Ti=!1,Ft=e;Ft!==null;)if(e=Ft,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Ft=t;else for(;Ft!==null;){switch(e=Ft,i=e.alternate,t=e.flags,e.tag){case 0:if((t&4)!==0&&(t=e.updateQueue,t=t!==null?t.events:null,t!==null))for(l=0;l title"))),ee(i,a,l),i[Wt]=t,kt(i),a=i;break t;case"link":var f=Ed("link","href",u).get(a+(l.href||""));if(f){for(var d=0;dCt&&(f=Ct,Ct=W,W=f);var x=Of(d,W),E=Of(d,Ct);if(x&&E&&(M.rangeCount!==1||M.anchorNode!==x.node||M.anchorOffset!==x.offset||M.focusNode!==E.node||M.focusOffset!==E.offset)){var A=w.createRange();A.setStart(x.node,x.offset),M.removeAllRanges(),W>Ct?(M.addRange(A),M.extend(E.node,E.offset)):(A.setEnd(E.node,E.offset),M.addRange(A))}}}}for(w=[],M=d;M=M.parentNode;)M.nodeType===1&&w.push({element:M,left:M.scrollLeft,top:M.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;dl?32:l,N.T=null,l=Cs,Cs=null;var i=_l,f=hl;if(Vt=0,Xa=_l=null,hl=0,(gt&6)!==0)throw Error(r(331));var d=gt;if(gt|=4,Ch(i.current),Rh(i,i.current,f,l),gt=d,Yn(0,!1),ye&&typeof ye.onPostCommitFiberRoot=="function")try{ye.onPostCommitFiberRoot(nn,i)}catch{}return!0}finally{G.p=u,N.T=a,Kh(t,e)}}function Vh(t,e,l){e=De(l,e),e=us(t.stateNode,e,2),t=xl(t,e,2),t!==null&&(cn(t,2),ke(t))}function Rt(t,e,l){if(t.tag===3)Vh(t,t,l);else for(;e!==null;){if(e.tag===3){Vh(e,t,l);break}else if(e.tag===1){var a=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Dl===null||!Dl.has(a))){t=De(l,t),l=Jo(2),a=xl(e,l,2),a!==null&&(ko(l,a,e,t),cn(a,2),ke(a));break}}e=e.return}}function Ms(t,e,l){var a=t.pingCache;if(a===null){a=t.pingCache=new Mv;var u=new Set;a.set(e,u)}else u=a.get(e),u===void 0&&(u=new Set,a.set(e,u));u.has(l)||(Ts=!0,u.add(l),t=wv.bind(null,t,e,l),e.then(t,t))}function wv(t,e,l){var a=t.pingCache;a!==null&&a.delete(e),t.pingedLanes|=t.suspendedLanes&l,t.warmLanes&=~l,At===t&&(ft&l)===l&&(qt===4||qt===3&&(ft&62914560)===ft&&300>wt()-ni?(gt&2)===0&&Ka(t,0):Rs|=l,Ga===ft&&(Ga=0)),ke(t)}function Jh(t,e){e===0&&(e=Lr()),t=Wl(t,e),t!==null&&(cn(t,e),ke(t))}function Hv(t){var e=t.memoizedState,l=0;e!==null&&(l=e.retryLane),Jh(t,l)}function qv(t,e){var l=0;switch(t.tag){case 31:case 13:var a=t.stateNode,u=t.memoizedState;u!==null&&(l=u.retryLane);break;case 19:a=t.stateNode;break;case 22:a=t.stateNode._retryCache;break;default:throw Error(r(314))}a!==null&&a.delete(e),Jh(t,l)}function Bv(t,e){return ln(t,e)}var oi=null,Va=null,Ds=!1,hi=!1,_s=!1,Ul=0;function ke(t){t!==Va&&t.next===null&&(Va===null?oi=Va=t:Va=Va.next=t),hi=!0,Ds||(Ds=!0,Qv())}function Yn(t,e){if(!_s&&hi){_s=!0;do for(var l=!1,a=oi;a!==null;){if(t!==0){var u=a.pendingLanes;if(u===0)var i=0;else{var f=a.suspendedLanes,d=a.pingedLanes;i=(1<<31-ve(42|t)+1)-1,i&=u&~(f&~d),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(l=!0,Wh(a,i))}else i=ft,i=vu(a,a===At?i:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(i&3)===0||un(a,i)||(l=!0,Wh(a,i));a=a.next}while(l);_s=!1}}function Lv(){kh()}function kh(){hi=Ds=!1;var t=0;Ul!==0&&$v()&&(t=Ul);for(var e=wt(),l=null,a=oi;a!==null;){var u=a.next,i=Fh(a,e);i===0?(a.next=null,l===null?oi=u:l.next=u,u===null&&(Va=l)):(l=a,(t!==0||(i&3)!==0)&&(hi=!0)),a=u}Vt!==0&&Vt!==5||Yn(t),Ul!==0&&(Ul=0)}function Fh(t,e){for(var l=t.suspendedLanes,a=t.pingedLanes,u=t.expirationTimes,i=t.pendingLanes&-62914561;0d)break;var _=b.transferSize,w=b.initiatorType;_&&ud(w)&&(b=b.responseEnd,f+=_*(b"u"?null:document;function pd(t,e,l){var a=Ja;if(a&&typeof e=="string"&&e){var u=ze(e);u='link[rel="'+t+'"][href="'+u+'"]',typeof l=="string"&&(u+='[crossorigin="'+l+'"]'),vd.has(u)||(vd.add(u),t={rel:t,crossOrigin:l,href:e},a.querySelector(u)===null&&(e=a.createElement("link"),ee(e,"link",t),kt(e),a.head.appendChild(e)))}}function up(t){dl.D(t),pd("dns-prefetch",t,null)}function ip(t,e){dl.C(t,e),pd("preconnect",t,e)}function cp(t,e,l){dl.L(t,e,l);var a=Ja;if(a&&t&&e){var u='link[rel="preload"][as="'+ze(e)+'"]';e==="image"&&l&&l.imageSrcSet?(u+='[imagesrcset="'+ze(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(u+='[imagesizes="'+ze(l.imageSizes)+'"]')):u+='[href="'+ze(t)+'"]';var i=u;switch(e){case"style":i=ka(t);break;case"script":i=Fa(t)}qe.has(i)||(t=S({rel:"preload",href:e==="image"&&l&&l.imageSrcSet?void 0:t,as:e},l),qe.set(i,t),a.querySelector(u)!==null||e==="style"&&a.querySelector(Zn(i))||e==="script"&&a.querySelector(Vn(i))||(e=a.createElement("link"),ee(e,"link",t),kt(e),a.head.appendChild(e)))}}function sp(t,e){dl.m(t,e);var l=Ja;if(l&&t){var a=e&&typeof e.as=="string"?e.as:"script",u='link[rel="modulepreload"][as="'+ze(a)+'"][href="'+ze(t)+'"]',i=u;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=Fa(t)}if(!qe.has(i)&&(t=S({rel:"modulepreload",href:t},e),qe.set(i,t),l.querySelector(u)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Vn(i)))return}a=l.createElement("link"),ee(a,"link",t),kt(a),l.head.appendChild(a)}}}function rp(t,e,l){dl.S(t,e,l);var a=Ja;if(a&&t){var u=va(a).hoistableStyles,i=ka(t);e=e||"default";var f=u.get(i);if(!f){var d={loading:0,preload:null};if(f=a.querySelector(Zn(i)))d.loading=5;else{t=S({rel:"stylesheet",href:t,"data-precedence":e},l),(l=qe.get(i))&&ks(t,l);var b=f=a.createElement("link");kt(b),ee(b,"link",t),b._p=new Promise(function(j,_){b.onload=j,b.onerror=_}),b.addEventListener("load",function(){d.loading|=1}),b.addEventListener("error",function(){d.loading|=2}),d.loading|=4,pi(f,e,a)}f={type:"stylesheet",instance:f,count:1,state:d},u.set(i,f)}}}function fp(t,e){dl.X(t,e);var l=Ja;if(l&&t){var a=va(l).hoistableScripts,u=Fa(t),i=a.get(u);i||(i=l.querySelector(Vn(u)),i||(t=S({src:t,async:!0},e),(e=qe.get(u))&&Fs(t,e),i=l.createElement("script"),kt(i),ee(i,"link",t),l.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},a.set(u,i))}}function op(t,e){dl.M(t,e);var l=Ja;if(l&&t){var a=va(l).hoistableScripts,u=Fa(t),i=a.get(u);i||(i=l.querySelector(Vn(u)),i||(t=S({src:t,async:!0,type:"module"},e),(e=qe.get(u))&&Fs(t,e),i=l.createElement("script"),kt(i),ee(i,"link",t),l.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},a.set(u,i))}}function gd(t,e,l,a){var u=(u=ut.current)?vi(u):null;if(!u)throw Error(r(446));switch(t){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(e=ka(l.href),l=va(u).hoistableStyles,a=l.get(e),a||(a={type:"style",instance:null,count:0,state:null},l.set(e,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){t=ka(l.href);var i=va(u).hoistableStyles,f=i.get(t);if(f||(u=u.ownerDocument||u,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(t,f),(i=u.querySelector(Zn(t)))&&!i._p&&(f.instance=i,f.state.loading=5),qe.has(t)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},qe.set(t,l),i||hp(u,t,l,f.state))),e&&a===null)throw Error(r(528,""));return f}if(e&&a!==null)throw Error(r(529,""));return null;case"script":return e=l.async,l=l.src,typeof l=="string"&&e&&typeof e!="function"&&typeof e!="symbol"?(e=Fa(l),l=va(u).hoistableScripts,a=l.get(e),a||(a={type:"script",instance:null,count:0,state:null},l.set(e,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,t))}}function ka(t){return'href="'+ze(t)+'"'}function Zn(t){return'link[rel="stylesheet"]['+t+"]"}function bd(t){return S({},t,{"data-precedence":t.precedence,precedence:null})}function hp(t,e,l,a){t.querySelector('link[rel="preload"][as="style"]['+e+"]")?a.loading=1:(e=t.createElement("link"),a.preload=e,e.addEventListener("load",function(){return a.loading|=1}),e.addEventListener("error",function(){return a.loading|=2}),ee(e,"link",l),kt(e),t.head.appendChild(e))}function Fa(t){return'[src="'+ze(t)+'"]'}function Vn(t){return"script[async]"+t}function Sd(t,e,l){if(e.count++,e.instance===null)switch(e.type){case"style":var a=t.querySelector('style[data-href~="'+ze(l.href)+'"]');if(a)return e.instance=a,kt(a),a;var u=S({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return a=(t.ownerDocument||t).createElement("style"),kt(a),ee(a,"style",u),pi(a,l.precedence,t),e.instance=a;case"stylesheet":u=ka(l.href);var i=t.querySelector(Zn(u));if(i)return e.state.loading|=4,e.instance=i,kt(i),i;a=bd(l),(u=qe.get(u))&&ks(a,u),i=(t.ownerDocument||t).createElement("link"),kt(i);var f=i;return f._p=new Promise(function(d,b){f.onload=d,f.onerror=b}),ee(i,"link",a),e.state.loading|=4,pi(i,l.precedence,t),e.instance=i;case"script":return i=Fa(l.src),(u=t.querySelector(Vn(i)))?(e.instance=u,kt(u),u):(a=l,(u=qe.get(i))&&(a=S({},l),Fs(a,u)),t=t.ownerDocument||t,u=t.createElement("script"),kt(u),ee(u,"link",a),t.head.appendChild(u),e.instance=u);case"void":return null;default:throw Error(r(443,e.type))}else e.type==="stylesheet"&&(e.state.loading&4)===0&&(a=e.instance,e.state.loading|=4,pi(a,l.precedence,t));return e.instance}function pi(t,e,l){for(var a=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=a.length?a[a.length-1]:null,i=u,f=0;f title"):null)}function dp(t,e,l){if(l===1||e.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof e.precedence!="string"||typeof e.href!="string"||e.href==="")break;return!0;case"link":if(typeof e.rel!="string"||typeof e.href!="string"||e.href===""||e.onLoad||e.onError)break;return e.rel==="stylesheet"?(t=e.disabled,typeof e.precedence=="string"&&t==null):!0;case"script":if(e.async&&typeof e.async!="function"&&typeof e.async!="symbol"&&!e.onLoad&&!e.onError&&e.src&&typeof e.src=="string")return!0}return!1}function Rd(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function mp(t,e,l,a){if(l.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var u=ka(a.href),i=e.querySelector(Zn(u));if(i){e=i._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(t.count++,t=bi.bind(t),e.then(t,t)),l.state.loading|=4,l.instance=i,kt(i);return}i=e.ownerDocument||e,a=bd(a),(u=qe.get(u))&&ks(a,u),i=i.createElement("link"),kt(i);var f=i;f._p=new Promise(function(d,b){f.onload=d,f.onerror=b}),ee(i,"link",a),l.instance=i}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(l,e),(e=l.state.preload)&&(l.state.loading&3)===0&&(t.count++,l=bi.bind(t),e.addEventListener("load",l),e.addEventListener("error",l))}}var $s=0;function yp(t,e){return t.stylesheets&&t.count===0&&Ei(t,t.stylesheets),0$s?50:800)+e);return t.unsuspend=l,function(){t.unsuspend=null,clearTimeout(a),clearTimeout(u)}}:null}function bi(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ei(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Si=null;function Ei(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Si=new Map,e.forEach(vp,t),Si=null,bi.call(t))}function vp(t,e){if(!(e.state.loading&4)){var l=Si.get(t);if(l)var a=l.get(null);else{l=new Map,Si.set(t,l);for(var u=t.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(c){console.error(c)}}return n(),ur.exports=_p(),ur.exports}var Up=Np();var Er=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,gm=/^[\\/]{2}/;function wp(n,c){return c+n.replace(/\\/g,"/")}var Jd="popstate";function kd(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function Hp(n={}){function c(r,o){let h=o.state?.masked,{pathname:m,search:p,hash:v}=h||r.location;return hr("",{pathname:m,search:p,hash:v},o.state&&o.state.usr||null,o.state&&o.state.key||"default",h?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function s(r,o){return typeof o=="string"?o:tu(o)}return Bp(c,s,null,n)}function Zt(n,c){if(n===!1||n===null||typeof n>"u")throw new Error(c)}function Xe(n,c){if(!n){typeof console<"u"&&console.warn(c);try{throw new Error(c)}catch{}}}function qp(){return Math.random().toString(36).substring(2,10)}function Fd(n,c){return{usr:n.state,key:n.key,idx:c,masked:n.mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function hr(n,c,s=null,r,o){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof c=="string"?iu(c):c,state:s,key:c&&c.key||r||qp(),mask:o}}function tu({pathname:n="/",search:c="",hash:s=""}){return c&&c!=="?"&&(n+=c.charAt(0)==="?"?c:"?"+c),s&&s!=="#"&&(n+=s.charAt(0)==="#"?s:"#"+s),n}function iu(n){let c={};if(n){let s=n.indexOf("#");s>=0&&(c.hash=n.substring(s),n=n.substring(0,s));let r=n.indexOf("?");r>=0&&(c.search=n.substring(r),n=n.substring(0,r)),n&&(c.pathname=n)}return c}function Bp(n,c,s,r={}){let{window:o=document.defaultView,v5Compat:h=!1}=r,m=o.history,p="POP",v=null,y=R();y==null&&(y=0,m.replaceState({...m.state,idx:y},""));function R(){return(m.state||{idx:null}).idx}function S(){p="POP";let q=R(),Q=q==null?null:q-y;y=q,v&&v({action:p,location:D.location,delta:Q})}function C(q,Q){p="PUSH";let V=kd(q)?q:hr(D.location,q,Q);y=R()+1;let Y=Fd(V,y),P=D.createHref(V.mask||V);try{m.pushState(Y,"",P)}catch(at){if(at instanceof DOMException&&at.name==="DataCloneError")throw at;o.location.assign(P)}h&&v&&v({action:p,location:D.location,delta:1})}function B(q,Q){p="REPLACE";let V=kd(q)?q:hr(D.location,q,Q);y=R();let Y=Fd(V,y),P=D.createHref(V.mask||V);m.replaceState(Y,"",P),h&&v&&v({action:p,location:D.location,delta:0})}function L(q){return Lp(o,q)}let D={get action(){return p},get location(){return n(o,m)},listen(q){if(v)throw new Error("A history only accepts one active listener");return o.addEventListener(Jd,S),v=q,()=>{o.removeEventListener(Jd,S),v=null}},createHref(q){return c(o,q)},createURL:L,encodeLocation(q){let Q=L(q);return{pathname:Q.pathname,search:Q.search,hash:Q.hash}},push:C,replace:B,go(q){return m.go(q)}};return D}function Lp(n,c,s=!1){let r="http://localhost";n&&(r=n.location.origin!=="null"?n.location.origin:n.location.href),Zt(r,"No window.location.(origin|href) available to create URL");let o=typeof c=="string"?c:tu(c);return o=o.replace(/ $/,"%20"),!s&&gm.test(o)&&(o=r+o),new URL(o,r)}function bm(n,c,s="/"){return Qp(n,c,s,!1)}function Qp(n,c,s,r,o){let h=typeof c=="string"?iu(c):c,m=ml(h.pathname||"/",s);if(m==null)return null;let p=Yp(n),v=null,y=Ip(m);for(let R=0;v==null&&R{let R={relativePath:y===void 0?m.path||"":y,caseSensitive:m.caseSensitive===!0,childrenIndex:p,route:m};if(R.relativePath.startsWith("/")){if(!R.relativePath.startsWith(r)&&v)return;Zt(R.relativePath.startsWith(r),`Absolute route path "${R.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),R.relativePath=R.relativePath.slice(r.length)}let S=Ge([r,R.relativePath]),C=s.concat(R);m.children&&m.children.length>0&&(Zt(m.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${S}".`),Sm(m.children,c,C,S,v)),!(m.path==null&&!m.index)&&c.push({path:S,score:Fp(S,m.index),routesMeta:C.map((B,L)=>{let[D,q]=Rm(B.relativePath,B.caseSensitive,L===C.length-1);return{...B,matcher:D,compiledParams:q}})})};return n.forEach((m,p)=>{if(m.path===""||!m.path?.includes("?"))h(m,p);else for(let v of Em(m.path))h(m,p,!0,v)}),c}function Em(n){let c=n.split("/");if(c.length===0)return[];let[s,...r]=c,o=s.endsWith("?"),h=s.replace(/\?$/,"");if(r.length===0)return o?[h,""]:[h];let m=Em(r.join("/")),p=[];return p.push(...m.map(v=>v===""?h:[h,v].join("/"))),o&&p.push(...m),p.map(v=>n.startsWith("/")&&v===""?"/":v)}function Gp(n){n.sort((c,s)=>c.score!==s.score?s.score-c.score:$p(c.routesMeta.map(r=>r.childrenIndex),s.routesMeta.map(r=>r.childrenIndex)))}var Xp=/^:[\w-]+$/,Kp=3,Zp=2,Vp=1,Jp=10,kp=-2,$d=n=>n==="*";function Fp(n,c){let s=n.split("/"),r=s.length;return s.some($d)&&(r+=kp),c&&(r+=Zp),s.filter(o=>!$d(o)).reduce((o,h)=>o+(Xp.test(h)?Kp:h===""?Vp:Jp),r)}function $p(n,c){return n.length===c.length&&n.slice(0,-1).every((r,o)=>r===c[o])?n[n.length-1]-c[c.length-1]:0}function Wp(n,c,s=!1){let{routesMeta:r}=n,o={},h="/",m=[];for(let p=0;p{if(R==="*"){let L=p[C]||"";m=h.slice(0,h.length-L.length).replace(/(.)\/+$/,"$1")}const B=p[C];return S&&!B?y[R]=void 0:y[R]=(B||"").replace(/%2F/g,"/"),y},{}),pathname:h,pathnameBase:m,pattern:n}}function Rm(n,c=!1,s=!0){Xe(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let r=[],o="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(m,p,v,y,R)=>{if(r.push({paramName:p,isOptional:v!=null}),v){let S=R.charAt(y+m.length);return S&&S!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(r.push({paramName:"*"}),o+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?o+="\\/*$":n!==""&&n!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,c?void 0:"i"),r]}function Ip(n){try{return n.split("/").map(c=>decodeURIComponent(c).replace(/\//g,"%2F")).join("/")}catch(c){return Xe(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${c}).`),n}}function ml(n,c){if(c==="/")return n;if(!n.toLowerCase().startsWith(c.toLowerCase()))return null;let s=c.endsWith("/")?c.length-1:c.length,r=n.charAt(s);return r&&r!=="/"?null:n.slice(s)||"/"}function Pp(n,c="/"){let{pathname:s,search:r="",hash:o=""}=typeof n=="string"?iu(n):n,h;return s?(s=Om(s),s.startsWith("/")?h=Wd(s.substring(1),"/"):h=Wd(s,c)):h=c,{pathname:h,search:l0(r),hash:a0(o)}}function Wd(n,c){let s=qi(c).split("/");return n.split("/").forEach(o=>{o===".."?s.length>1&&s.pop():o!=="."&&s.push(o)}),s.length>1?s.join("/"):"/"}function rr(n,c,s,r){return`Cannot include a '${n}' character in a manually specified \`to.${c}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${s}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function t0(n){return n.filter((c,s)=>s===0||c.route.path&&c.route.path.length>0)}function Tr(n){let c=t0(n);return c.map((s,r)=>r===c.length-1?s.pathname:s.pathnameBase)}function Li(n,c,s,r=!1){let o;typeof n=="string"?o=iu(n):(o={...n},Zt(!o.pathname||!o.pathname.includes("?"),rr("?","pathname","search",o)),Zt(!o.pathname||!o.pathname.includes("#"),rr("#","pathname","hash",o)),Zt(!o.search||!o.search.includes("#"),rr("#","search","hash",o)));let h=n===""||o.pathname==="",m=h?"/":o.pathname,p;if(m==null)p=s;else{let S=c.length-1;if(!r&&m.startsWith("..")){let C=m.split("/");for(;C[0]==="..";)C.shift(),S-=1;o.pathname=C.join("/")}p=S>=0?c[S]:"/"}let v=Pp(o,p),y=m&&m!=="/"&&m.endsWith("/"),R=(h||m===".")&&s.endsWith("/");return!v.pathname.endsWith("/")&&(y||R)&&(v.pathname+="/"),v}var Om=n=>n.replace(/[\\/]{2,}/g,"/"),Ge=n=>Om(n.join("/")),qi=n=>n.replace(/\/+$/,""),e0=n=>qi(n).replace(/^\/*/,"/"),l0=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,a0=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,n0=class{constructor(n,c,s,r=!1){this.status=n,this.statusText=c||"",this.internal=r,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}};function u0(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function i0(n){let c=n.map(s=>s.route.path).filter(Boolean);return Ge(c)||"/"}var xm=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Cm(n,c){let s=n;if(typeof s!="string"||!Er.test(s))return{absoluteURL:void 0,isExternal:!1,to:s};let r=s,o=!1;if(xm)try{let h=new URL(window.location.href),m=gm.test(s)?new URL(wp(s,h.protocol)):new URL(s),p=ml(m.pathname,c);m.origin===h.origin&&p!=null?s=p+m.search+m.hash:o=!0}catch{Xe(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:o,to:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Am=["POST","PUT","PATCH","DELETE"];new Set(Am);var c0=["GET",...Am];new Set(c0);var s0=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function r0(n){try{return s0.includes(new URL(n).protocol)}catch{return!1}}var Wa=O.createContext(null);Wa.displayName="DataRouter";var Qi=O.createContext(null);Qi.displayName="DataRouterState";var jm=O.createContext(!1);function f0(){return O.useContext(jm)}var zm=O.createContext({isTransitioning:!1});zm.displayName="ViewTransition";var o0=O.createContext(new Map);o0.displayName="Fetchers";var h0=O.createContext(null);h0.displayName="Await";var xe=O.createContext(null);xe.displayName="Navigation";var cu=O.createContext(null);cu.displayName="Location";var Fe=O.createContext({outlet:null,matches:[],isDataRoute:!1});Fe.displayName="Route";var Rr=O.createContext(null);Rr.displayName="RouteError";var Mm="REACT_ROUTER_ERROR",d0="REDIRECT",m0="ROUTE_ERROR_RESPONSE";function y0(n){if(n.startsWith(`${Mm}:${d0}:{`))try{let c=JSON.parse(n.slice(28));if(typeof c=="object"&&c&&typeof c.status=="number"&&typeof c.statusText=="string"&&typeof c.location=="string"&&typeof c.reloadDocument=="boolean"&&typeof c.replace=="boolean")return c}catch{}}function v0(n){if(n.startsWith(`${Mm}:${m0}:{`))try{let c=JSON.parse(n.slice(40));if(typeof c=="object"&&c&&typeof c.status=="number"&&typeof c.statusText=="string")return new n0(c.status,c.statusText,c.data)}catch{}}function p0(n,{relative:c}={}){Zt(Ia(),"useHref() may be used only in the context of a component.");let{basename:s,navigator:r}=O.useContext(xe),{hash:o,pathname:h,search:m}=ru(n,{relative:c}),p=h;return s!=="/"&&(p=h==="/"?s:Ge([s,h])),r.createHref({pathname:p,search:m,hash:o})}function Ia(){return O.useContext(cu)!=null}function Ce(){return Zt(Ia(),"useLocation() may be used only in the context of a component."),O.useContext(cu).location}function g0(){return O.useContext(cu).navigationType}var Dm="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function _m(n){O.useContext(xe).static||O.useLayoutEffect(n)}function su(){let{isDataRoute:n}=O.useContext(Fe);return n?D0():b0()}function b0(){Zt(Ia(),"useNavigate() may be used only in the context of a component.");let n=O.useContext(Wa),{basename:c,navigator:s}=O.useContext(xe),{matches:r}=O.useContext(Fe),{pathname:o}=Ce(),h=JSON.stringify(Tr(r)),m=O.useRef(!1);return _m(()=>{m.current=!0}),O.useCallback((v,y={})=>{if(Xe(m.current,Dm),!m.current)return;if(typeof v=="number"){s.go(v);return}let R=Li(v,JSON.parse(h),o,y.relative==="path");n==null&&c!=="/"&&(R.pathname=R.pathname==="/"?c:Ge([c,R.pathname])),(y.replace?s.replace:s.push)(R,y.state,y)},[c,s,h,o,n])}O.createContext(null);function ru(n,{relative:c}={}){let{matches:s}=O.useContext(Fe),{pathname:r}=Ce(),o=JSON.stringify(Tr(s));return O.useMemo(()=>Li(n,JSON.parse(o),r,c==="path"),[n,o,r,c])}function S0(n,c,s){Zt(Ia(),"useRoutes() may be used only in the context of a component.");let{navigator:r}=O.useContext(xe),{matches:o}=O.useContext(Fe),h=o[o.length-1],m=h?h.params:{},p=h?h.pathname:"/",v=h?h.pathnameBase:"/",y=h&&h.route;{let q=y&&y.path||"";Um(p,!y||q.endsWith("*")||q.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${p}" (under ) 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. - -Please change the parent to .`)}let R=Ce(),S;S=R;let C=S.pathname||"/",B=C;if(v!=="/"){let q=v.replace(/^\//,"").split("/");B="/"+C.replace(/^\//,"").split("/").slice(q.length).join("/")}let L=s&&s.state.matches.length?s.state.matches.map(q=>Object.assign(q,{route:s.manifest[q.route.id]||q.route})):bm(n,{pathname:B});return Xe(y||L!=null,`No routes matched location "${S.pathname}${S.search}${S.hash}" `),Xe(L==null||L[L.length-1].route.element!==void 0||L[L.length-1].route.Component!==void 0||L[L.length-1].route.lazy!==void 0,`Matched leaf route at location "${S.pathname}${S.search}${S.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`),x0(L&&L.map(q=>Object.assign({},q,{params:Object.assign({},m,q.params),pathname:Ge([v,r.encodeLocation?r.encodeLocation(q.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:q.pathname]),pathnameBase:q.pathnameBase==="/"?v:Ge([v,r.encodeLocation?r.encodeLocation(q.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:q.pathnameBase])})),o,s)}function E0(){let n=M0(),c=u0(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),s=n instanceof Error?n.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},h={padding:"2px 4px",backgroundColor:r},m=null;return console.error("Error handled by React Router default ErrorBoundary:",n),m=O.createElement(O.Fragment,null,O.createElement("p",null,"💿 Hey developer 👋"),O.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",O.createElement("code",{style:h},"ErrorBoundary")," or"," ",O.createElement("code",{style:h},"errorElement")," prop on your route.")),O.createElement(O.Fragment,null,O.createElement("h2",null,"Unexpected Application Error!"),O.createElement("h3",{style:{fontStyle:"italic"}},c),s?O.createElement("pre",{style:o},s):null,m)}var T0=O.createElement(E0,null),Nm=class extends O.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,c){return c.location!==n.location||c.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:c.error,location:c.location,revalidation:n.revalidation||c.revalidation}}componentDidCatch(n,c){this.props.onError?this.props.onError(n,c):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const s=v0(n.digest);s&&(n=s)}let c=n!==void 0?O.createElement(Fe.Provider,{value:this.props.routeContext},O.createElement(Rr.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?O.createElement(R0,{error:n},c):c}};Nm.contextType=jm;var fr=new WeakMap;function R0({children:n,error:c}){let{basename:s}=O.useContext(xe);if(typeof c=="object"&&c&&"digest"in c&&typeof c.digest=="string"){let r=y0(c.digest);if(r){let o=fr.get(c);if(o)throw o;let h=Cm(r.location,s),m=h.absoluteURL||h.to;if(r0(m))throw new Error("Invalid redirect location");if(xm&&!fr.get(c))if(h.isExternal||r.reloadDocument)window.location.href=m;else{const p=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(h.to,{replace:r.replace}));throw fr.set(c,p),p}return O.createElement("meta",{httpEquiv:"refresh",content:`0;url=${m}`})}}return n}function O0({routeContext:n,match:c,children:s}){let r=O.useContext(Wa);return r&&r.static&&r.staticContext&&(c.route.errorElement||c.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=c.route.id),O.createElement(Fe.Provider,{value:n},s)}function x0(n,c=[],s){let r=s?.state;if(n==null){if(!r)return null;if(r.errors)n=r.matches;else if(c.length===0&&!r.initialized&&r.matches.length>0)n=r.matches;else return null}let o=n,h=r?.errors;if(h!=null){let R=o.findIndex(S=>S.route.id&&h?.[S.route.id]!==void 0);Zt(R>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(h).join(",")}`),o=o.slice(0,Math.min(o.length,R+1))}let m=!1,p=-1;if(s&&r){m=r.renderFallback;for(let R=0;R=0?o=o.slice(0,p+1):o=[o[0]];break}}}}let v=s?.onError,y=r&&v?(R,S)=>{v(R,{location:r.location,params:r.matches?.[0]?.params??{},pattern:i0(r.matches),errorInfo:S})}:void 0;return o.reduceRight((R,S,C)=>{let B,L=!1,D=null,q=null;r&&(B=h&&S.route.id?h[S.route.id]:void 0,D=S.route.errorElement||T0,m&&(p<0&&C===0?(Um("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),L=!0,q=null):p===C&&(L=!0,q=S.route.hydrateFallbackElement||null)));let Q=c.concat(o.slice(0,C+1)),V=()=>{let Y;return B?Y=D:L?Y=q:S.route.Component?Y=O.createElement(S.route.Component,null):S.route.element?Y=S.route.element:Y=R,O.createElement(O0,{match:S,routeContext:{outlet:R,matches:Q,isDataRoute:r!=null},children:Y})};return r&&(S.route.ErrorBoundary||S.route.errorElement||C===0)?O.createElement(Nm,{location:r.location,revalidation:r.revalidation,component:D,error:B,children:V(),routeContext:{outlet:null,matches:Q,isDataRoute:!0},onError:y}):V()},null)}function Or(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function C0(n){let c=O.useContext(Wa);return Zt(c,Or(n)),c}function A0(n){let c=O.useContext(Qi);return Zt(c,Or(n)),c}function j0(n){let c=O.useContext(Fe);return Zt(c,Or(n)),c}function xr(n){let c=j0(n),s=c.matches[c.matches.length-1];return Zt(s.route.id,`${n} can only be used on routes that contain a unique "id"`),s.route.id}function z0(){return xr("useRouteId")}function M0(){let n=O.useContext(Rr),c=A0("useRouteError"),s=xr("useRouteError");return n!==void 0?n:c.errors?.[s]}function D0(){let{router:n}=C0("useNavigate"),c=xr("useNavigate"),s=O.useRef(!1);return _m(()=>{s.current=!0}),O.useCallback(async(o,h={})=>{Xe(s.current,Dm),s.current&&(typeof o=="number"?await n.navigate(o):await n.navigate(o,{fromRouteId:c,...h}))},[n,c])}var Id={};function Um(n,c,s){!c&&!Id[n]&&(Id[n]=!0,Xe(!1,s))}O.memo(_0);function _0({routes:n,manifest:c,future:s,state:r,isStatic:o,onError:h}){return S0(n,void 0,{manifest:c,state:r,isStatic:o,onError:h})}function N0({to:n,replace:c,state:s,relative:r}){Zt(Ia()," may be used only in the context of a component.");let{static:o}=O.useContext(xe);Xe(!o," must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.");let{matches:h}=O.useContext(Fe),{pathname:m}=Ce(),p=su(),v=Li(n,Tr(h),m,r==="path"),y=JSON.stringify(v);return O.useEffect(()=>{p(JSON.parse(y),{replace:c,state:s,relative:r})},[p,y,r,c,s]),null}function U0({basename:n="/",children:c=null,location:s,navigationType:r="POP",navigator:o,static:h=!1,useTransitions:m}){Zt(!Ia(),"You cannot render a inside another . You should never have more than one in your app.");let p=n.replace(/^\/*/,"/"),v=O.useMemo(()=>({basename:p,navigator:o,static:h,useTransitions:m,future:{}}),[p,o,h,m]);typeof s=="string"&&(s=iu(s));let{pathname:y="/",search:R="",hash:S="",state:C=null,key:B="default",mask:L}=s,D=O.useMemo(()=>{let q=ml(y,p);return q==null?null:{location:{pathname:q,search:R,hash:S,state:C,key:B,mask:L},navigationType:r}},[p,y,R,S,C,B,r,L]);return Xe(D!=null,` is not able to match the URL "${y}${R}${S}" because it does not start with the basename, so the won't render anything.`),D==null?null:O.createElement(xe.Provider,{value:v},O.createElement(cu.Provider,{children:c,value:D}))}var Di="get",_i="application/x-www-form-urlencoded";function Yi(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function w0(n){return Yi(n)&&n.tagName.toLowerCase()==="button"}function H0(n){return Yi(n)&&n.tagName.toLowerCase()==="form"}function q0(n){return Yi(n)&&n.tagName.toLowerCase()==="input"}function B0(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function L0(n,c){return n.button===0&&(!c||c==="_self")&&!B0(n)}var zi=null;function Q0(){if(zi===null)try{new FormData(document.createElement("form"),0),zi=!1}catch{zi=!0}return zi}var Y0=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function or(n){return n!=null&&!Y0.has(n)?(Xe(!1,`"${n}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${_i}"`),null):n}function G0(n,c){let s,r,o,h,m;if(H0(n)){let p=n.getAttribute("action");r=p?ml(p,c):null,s=n.getAttribute("method")||Di,o=or(n.getAttribute("enctype"))||_i,h=new FormData(n)}else if(w0(n)||q0(n)&&(n.type==="submit"||n.type==="image")){let p=n.form;if(p==null)throw new Error('Cannot submit a