From fa8dadb011c92101bf395a37b6c3d7830020b3f6 Mon Sep 17 00:00:00 2001 From: xuhongyuan Date: Thu, 20 Aug 2026 15:03:03 +0800 Subject: [PATCH] feat(web): rewrite frontend as SolidJS + Tailwind v4 SPA with chat UI Replace the legacy vanilla HTML/CSS/JS pages with a SolidJS single-page app (TanStack Router/Query, Ark UI, Tailwind v4) and embed its build output into the Go binary via //go:embed. SPA routes fall back to index.html. Includes the room chat/danmaku panel, color picker and broadcaster overlay on the watch/publish pages. Add web/node_modules and local data to .gitignore. --- .gitignore | 3 + internal/server/static/app.js | 343 --- .../static/assets/arrow-right-DNPSxlbJ.js | 1 + .../server/static/assets/cloud-CTCP3hC3.js | 1 + .../server/static/assets/index-CFU6bGFM.js | 2 + .../server/static/assets/index-Djwy0HhI.css | 2 + ...s-mono-cyrillic-wght-normal-D73BlboJ.woff2 | Bin 0 -> 12108 bytes ...ains-mono-greek-wght-normal-Bw9x6K1M.woff2 | Bin 0 -> 9004 bytes ...-mono-latin-ext-wght-normal-DBQx-q_a.woff2 | Bin 0 -> 15196 bytes ...ains-mono-latin-wght-normal-B9CIFXIH.woff2 | Bin 0 -> 40404 bytes ...mono-vietnamese-wght-normal-Bt-aOZkq.woff2 | Bin 0 -> 7504 bytes .../server/static/assets/login-BDg6Zp6A.js | 1 + .../server/static/assets/publish-B-tBrFGx.js | 1 + .../server/static/assets/radio-CvpQ__fB.js | 1 + .../server/static/assets/rooms-IMfi_6M2.js | 1 + .../server/static/assets/routes-Dwgi66GM.js | 1 + .../server/static/assets/server-C0Pmpptj.js | 1 + .../static/assets/shield-check-D8IU7TWB.js | 1 + ...otesk-latin-ext-wght-normal-D9tNdqV9.woff2 | Bin 0 -> 18940 bytes ...e-grotesk-latin-wght-normal-BhU9QXUp.woff2 | Bin 0 -> 22288 bytes ...tesk-vietnamese-wght-normal-D0rl6rjA.woff2 | Bin 0 -> 6712 bytes internal/server/static/assets/ui-W1Pm8dqI.js | 1 + .../server/static/assets/users-C6m5OUWT.js | 1 + .../server/static/assets/watch-D3IYLpWT.js | 42 + .../server/static/assets/webrtc-D2p8RYHA.js | 1 + internal/server/static/index.html | 83 +- internal/server/static/login.html | 152 -- internal/server/static/publish.html | 46 - internal/server/static/styles.css | 79 - internal/server/static/watch.html | 44 - web/index.html | 27 + web/package.json | 30 + web/pnpm-lock.yaml | 2424 +++++++++++++++++ web/src/app/router.tsx | 52 + web/src/app/routes/index.tsx | 209 ++ web/src/app/routes/layout.tsx | 119 + web/src/app/routes/login.tsx | 127 + web/src/app/routes/publish.tsx | 294 ++ web/src/app/routes/rooms.tsx | 114 + web/src/app/routes/users.tsx | 129 + web/src/app/routes/watch.tsx | 260 ++ web/src/components/danmaku.tsx | 140 + web/src/components/ui.tsx | 322 +++ web/src/index.css | 297 ++ web/src/index.tsx | 23 + web/src/lib/api.ts | 56 + web/src/lib/auth.ts | 20 + web/src/lib/chat.ts | 45 + web/src/lib/hls.ts | 19 + web/src/lib/permissions.ts | 31 + web/src/lib/sse.ts | 16 + web/src/lib/theme.ts | 39 + web/src/lib/types.ts | 69 + web/src/lib/webrtc.ts | 110 + web/src/vite-env.d.ts | 1 + web/tsconfig.json | 17 + web/vite.config.ts | 16 + 57 files changed, 5093 insertions(+), 721 deletions(-) delete mode 100644 internal/server/static/app.js create mode 100644 internal/server/static/assets/arrow-right-DNPSxlbJ.js create mode 100644 internal/server/static/assets/cloud-CTCP3hC3.js create mode 100644 internal/server/static/assets/index-CFU6bGFM.js create mode 100644 internal/server/static/assets/index-Djwy0HhI.css create mode 100644 internal/server/static/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 create mode 100644 internal/server/static/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 create mode 100644 internal/server/static/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 create mode 100644 internal/server/static/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 create mode 100644 internal/server/static/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 create mode 100644 internal/server/static/assets/login-BDg6Zp6A.js create mode 100644 internal/server/static/assets/publish-B-tBrFGx.js create mode 100644 internal/server/static/assets/radio-CvpQ__fB.js create mode 100644 internal/server/static/assets/rooms-IMfi_6M2.js create mode 100644 internal/server/static/assets/routes-Dwgi66GM.js create mode 100644 internal/server/static/assets/server-C0Pmpptj.js create mode 100644 internal/server/static/assets/shield-check-D8IU7TWB.js create mode 100644 internal/server/static/assets/space-grotesk-latin-ext-wght-normal-D9tNdqV9.woff2 create mode 100644 internal/server/static/assets/space-grotesk-latin-wght-normal-BhU9QXUp.woff2 create mode 100644 internal/server/static/assets/space-grotesk-vietnamese-wght-normal-D0rl6rjA.woff2 create mode 100644 internal/server/static/assets/ui-W1Pm8dqI.js create mode 100644 internal/server/static/assets/users-C6m5OUWT.js create mode 100644 internal/server/static/assets/watch-D3IYLpWT.js create mode 100644 internal/server/static/assets/webrtc-D2p8RYHA.js delete mode 100644 internal/server/static/login.html delete mode 100644 internal/server/static/publish.html delete mode 100644 internal/server/static/styles.css delete mode 100644 internal/server/static/watch.html create mode 100644 web/index.html create mode 100644 web/package.json create mode 100644 web/pnpm-lock.yaml create mode 100644 web/src/app/router.tsx create mode 100644 web/src/app/routes/index.tsx create mode 100644 web/src/app/routes/layout.tsx create mode 100644 web/src/app/routes/login.tsx create mode 100644 web/src/app/routes/publish.tsx create mode 100644 web/src/app/routes/rooms.tsx create mode 100644 web/src/app/routes/users.tsx create mode 100644 web/src/app/routes/watch.tsx create mode 100644 web/src/components/danmaku.tsx create mode 100644 web/src/components/ui.tsx create mode 100644 web/src/index.css create mode 100644 web/src/index.tsx create mode 100644 web/src/lib/api.ts create mode 100644 web/src/lib/auth.ts create mode 100644 web/src/lib/chat.ts create mode 100644 web/src/lib/hls.ts create mode 100644 web/src/lib/permissions.ts create mode 100644 web/src/lib/sse.ts create mode 100644 web/src/lib/theme.ts create mode 100644 web/src/lib/types.ts create mode 100644 web/src/lib/webrtc.ts create mode 100644 web/src/vite-env.d.ts create mode 100644 web/tsconfig.json create mode 100644 web/vite.config.ts diff --git a/.gitignore b/.gitignore index 25e198e..3823a9d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ *.local.env data/* !data/.gitkeep + +# 前端工程 +web/node_modules diff --git a/internal/server/static/app.js b/internal/server/static/app.js deleted file mode 100644 index ead3935..0000000 --- a/internal/server/static/app.js +++ /dev/null @@ -1,343 +0,0 @@ -// 直播 SFU 分流 Demo 前端逻辑。控制面走 JSON 网关(protojson),媒体面走反向代理直连 SFU。 -// 已集成登录与 Casbin 权限:自动附加 Authorization header,未登录重定向到 /login -window.LiveSFU = (function () { - const ENUM = { cloudflare: "BACKEND_KIND_CLOUDFLARE", srs: "BACKEND_KIND_SRS" }; - const NAME = { BACKEND_KIND_CLOUDFLARE: "Cloudflare Realtime", BACKEND_KIND_SRS: "SRS" }; - - function getRoom() { - const p = new URLSearchParams(location.search).get("room"); - return (p && p.trim()) || "demo"; - } - function shortName(enumStr) { return NAME[enumStr] || enumStr; } - - // ----- Auth helpers ----- - function getToken() { - return localStorage.getItem("token") || ""; - } - function setToken(t) { - if (t) localStorage.setItem("token", t); - } - function clearToken() { - localStorage.removeItem("token"); - } - function authHeaders() { - const h = {}; - const tok = getToken(); - if (tok) h["Authorization"] = "Bearer " + tok; - return h; - } - function handleAuthError(status) { - if (status === 401) { - const next = encodeURIComponent(location.pathname + location.search); - if (!location.pathname.startsWith("/login")) { - location.href = "/login?next=" + next; - } - } - } - - async function apiGet(path) { - const r = await fetch(path, { headers: { ...authHeaders() } }); - if (!r.ok) { - handleAuthError(r.status); - throw new Error(path + " -> " + r.status + " " + (await r.text())); - } - return r.json(); - } - async function apiGetWithAuth(path) { - const r = await fetch(path, { headers: { ...authHeaders() } }); - const text = await r.text(); - if (!r.ok) { - handleAuthError(r.status); - throw new Error(text || (path + " -> " + r.status)); - } - return text ? JSON.parse(text) : {}; - } - async function apiPost(path, body) { - const r = await fetch(path, { - method: "POST", - headers: { "Content-Type": "application/json", ...authHeaders() }, - body: JSON.stringify(body), - }); - const text = await r.text(); - if (!r.ok) { - handleAuthError(r.status); - throw new Error((text || r.status)); - } - return text ? JSON.parse(text) : {}; - } - async function apiPostWithAuth(path, body) { - return apiPost(path, body); - } - - async function login(username, password) { - const r = await fetch("/api/auth/login", { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ username, password }), - }); - const text = await r.text(); - if (!r.ok) throw new Error(text || ("login -> " + r.status)); - const data = text ? JSON.parse(text) : {}; - if (data.token) setToken(data.token); - return data; - } - async function register(username, password, role) { - const r = await fetch("/api/auth/register", { - method: "POST", - headers: { "Content-Type": "application/json", ...authHeaders() }, - body: JSON.stringify({ username, password, role }), - }); - const text = await r.text(); - if (!r.ok) throw new Error(text || ("register -> " + r.status)); - const data = text ? JSON.parse(text) : {}; - if (data.token) setToken(data.token); - return data; - } - async function getMe() { - return apiGetWithAuth("/api/auth/me"); - } - async function authCheck() { - try { - const r = await fetch("/api/auth/check", { headers: { ...authHeaders() } }); - return await r.json(); - } catch(e) { - return { enabled: false }; - } - } - - async function loadConfig(el) { - try { - const cfg = await apiGet("/api/config"); - el.innerHTML = ""; - (cfg.backends || []).forEach((b) => { - const span = document.createElement("span"); - span.className = "badge" + (b.primary ? " primary" : ""); - span.textContent = shortName(b.kind) + (b.primary ? " · 主" : "") + (b.configured ? " · 就绪" : " · 未配置"); - el.appendChild(span); - }); - const chk = await authCheck(); - const authBadge = document.createElement("span"); - authBadge.className = "badge " + (chk.authenticated ? "ok" : "bad"); - authBadge.textContent = chk.authenticated ? ("已登录:" + chk.username + " / " + chk.role) : "未登录"; - authBadge.style.cursor="pointer"; - authBadge.onclick=()=>location.href="/login"; - authBadge.title="点击去登录"; - el.appendChild(authBadge); - } catch (e) { - el.innerHTML = '控制面不可达'; - } - } - - function log(el, msg) { - const t = new Date().toLocaleTimeString(); - el.textContent += "[" + t + "] " + msg + "\\n"; - el.scrollTop = el.scrollHeight; - } - - async function publishCF(sessionId, localStream, iceServers) { - const pc = new RTCPeerConnection({ iceServers }); - localStream.getTracks().forEach((t) => pc.addTrack(t, localStream)); - const offer = await pc.createOffer(); - await pc.setLocalDescription(offer); - const resp = await fetch("/api/cf/sessions/" + sessionId + "/tracks/new", { - method: "POST", - headers: { "Content-Type": "application/json", ...authHeaders() }, - body: JSON.stringify({ - sessionDescription: { type: "offer", sdp: offer.sdp }, - tracks: localStream.getTracks().map((t) => ({ location: "local", trackName: t.kind, kind: t.kind })), - autoDiscover: true, - }), - }); - if (!resp.ok) { - handleAuthError(resp.status); - throw new Error("cf publish failed: " + resp.status); - } - const data = await resp.json(); - await pc.setRemoteDescription({ type: data.sessionDescription.type, sdp: data.sessionDescription.sdp }); - return pc; - } - - async function watchCF(viewerSessionId, publisherSessionId, iceServers, video) { - const pc = new RTCPeerConnection({ iceServers }); - pc.ontrack = (e) => { video.srcObject = e.streams[0]; }; - const offer = await pc.createOffer(); - await pc.setLocalDescription(offer); - const resp = await fetch("/api/cf/sessions/" + viewerSessionId + "/tracks/new", { - method: "POST", - headers: { "Content-Type": "application/json", ...authHeaders() }, - body: JSON.stringify({ - sessionDescription: { type: "offer", sdp: offer.sdp }, - tracks: [ - { location: "remote", sessionId: publisherSessionId, trackName: "audio" }, - { location: "remote", sessionId: publisherSessionId, trackName: "video" }, - ], - autoDiscover: true, - }), - }); - if (!resp.ok) { - handleAuthError(resp.status); - throw new Error("cf watch failed: " + resp.status); - } - const data = await resp.json(); - await pc.setRemoteDescription({ type: data.sessionDescription.type, sdp: data.sessionDescription.sdp }); - return pc; - } - - async function publishSRS(room, token, stream, iceServers, localStream) { - const pc = new RTCPeerConnection({ iceServers }); - localStream.getTracks().forEach((t) => pc.addTrack(t, localStream)); - const offer = await pc.createOffer(); - await pc.setLocalDescription(offer); - const url = "/rtc/v1/whip/?app=live&stream=" + encodeURIComponent(stream) + "&token=" + encodeURIComponent(token); - const resp = await fetch(url, { method: "POST", headers: { "Content-Type": "application/sdp", ...authHeaders() }, body: offer.sdp }); - if (!resp.ok) { - handleAuthError(resp.status); - throw new Error("SRS publish failed: " + resp.status + " " + (await resp.text())); - } - const answer = await resp.text(); - await pc.setRemoteDescription({ type: "answer", sdp: answer }); - return pc; - } - - async function watchSRS(room, stream, iceServers, video) { - const pc = new RTCPeerConnection({ iceServers }); - pc.ontrack = (e) => { video.srcObject = e.streams[0]; }; - const offer = await pc.createOffer(); - await pc.setLocalDescription(offer); - const url = "/rtc/v1/whep/?app=live&stream=" + encodeURIComponent(stream); - const resp = await fetch(url, { method: "POST", headers: { "Content-Type": "application/sdp", ...authHeaders() }, body: offer.sdp }); - if (!resp.ok) { - handleAuthError(resp.status); - throw new Error("SRS watch failed: " + resp.status + " " + (await resp.text())); - } - const answer = await resp.text(); - await pc.setRemoteDescription({ type: "answer", sdp: answer }); - return pc; - } - - function findTarget(targets, enumStr) { - return (targets || []).find((t) => t.backend === enumStr); - } - - function initPublish() { - const room = getRoom(); - document.getElementById("roomName").textContent = room; - const localVideo = document.getElementById("local"); - const logEl = document.getElementById("log"); - const statusEl = document.getElementById("status"); - const pcs = {}; - authCheck().then(chk=>{ - if (!chk.authenticated) { - log(logEl, "提示:未登录,发布需要 publisher 权限,将自动跳转登录页"); - } else if (chk.permissions && !chk.permissions["room:publish"]) { - log(logEl, "提示:当前角色 "+chk.role+" 无发布权限,需要 publisher 或 admin"); - } - }); - document.getElementById("start").onclick = async () => { - try { - const backends = Array.from(document.querySelectorAll('input[name="backend"]:checked')).map((i) => i.value); - if (!backends.length) return log(logEl, "请至少选择一个分发后端"); - const stream = await navigator.mediaDevices.getUserMedia({ video: true, audio: true }); - localVideo.srcObject = stream; - for (const b of backends) { - try { - const resp = await apiPost("/api/publish", { room, backend: ENUM[b] }); - if (b === "cloudflare") { - pcs[b] = await publishCF(resp.sessionId, stream, resp.iceServers); - } else { - pcs[b] = await publishSRS(room, resp.publishToken, resp.stream, resp.iceServers, stream); - } - log(logEl, "已在 " + shortName(resp.target.backend) + " 发布(" + (resp.stream || resp.sessionId) + ")"); - } catch (e) { - log(logEl, "发布到 " + b + " 失败:" + e.message); - } - } - renderStatus(statusEl, pcs); - } catch (e) { - log(logEl, "获取摄像头失败:" + e.message); - } - }; - document.getElementById("stop").onclick = async () => { - for (const b of Object.keys(pcs)) { - try { await apiPost("/api/stop", { room, backend: ENUM[b] }); } catch (e) {} - if (pcs[b]) pcs[b].close(); - delete pcs[b]; - } - if (localVideo.srcObject) localVideo.srcObject.getTracks().forEach((t) => t.stop()); - log(logEl, "已停止推流"); - renderStatus(statusEl, pcs); - }; - } - - function renderStatus(el, pcs) { - const keys = Object.keys(pcs); - el.innerHTML = keys.length - ? keys.map((k) => '分发中:' + shortName(ENUM[k]) + "").join("") - : '未发布'; - } - - function initWatch() { - const room = getRoom(); - document.getElementById("roomName").textContent = room; - const remoteVideo = document.getElementById("remote"); - const logEl = document.getElementById("log"); - const statusEl = document.getElementById("status"); - let pc = null; - let es = null; - let watching = false; - function backend() { return document.querySelector('input[name="watchBackend"]:checked').value; } - authCheck().then(chk=>{ - if (!chk.authenticated) { - log(logEl, "提示:未登录,观看需要登录,将自动跳转"); - } else if (chk.permissions && !chk.permissions["room:subscribe"]) { - log(logEl, "提示:当前角色 "+chk.role+" 无订阅权限"); - } - }); - async function subscribe() { - if (watching) return; - const b = backend(); - try { - const resp = await apiPost("/api/subscribe", { room, backend: ENUM[b] }); - if (b === "cloudflare") { - pc = await watchCF(resp.sessionId, resp.publisherSessionId, resp.iceServers, remoteVideo); - } else { - pc = await watchSRS(room, resp.stream, resp.iceServers, remoteVideo); - } - watching = true; - log(logEl, "已从 " + shortName(ENUM[b]) + " 拉流"); - statusEl.innerHTML = '观看中:' + shortName(ENUM[b]) + ""; - } catch (e) { - log(logEl, "订阅失败:" + e.message); - } - } - document.getElementById("start").onclick = () => { - const token = getToken(); - const esUrl = "/api/room/" + encodeURIComponent(room) + "/events" + (token ? "?token="+encodeURIComponent(token) : ""); - es = new EventSource(esUrl); - es.addEventListener("room", (ev) => { - const data = JSON.parse(ev.data); - const t = findTarget(data.targets, ENUM[backend()]); - statusEl.innerHTML = t - ? '房间在 ' + shortName(ENUM[backend()]) + " 已直播" - : '等待 ' + shortName(ENUM[backend()]) + " 推流…"; - if (t && !watching) subscribe(); - }); - es.onerror = (e)=>{ - log(logEl, "房间事件流错误,可能是未登录或权限不足"); - }; - log(logEl, "已连接房间事件流"); - }; - document.getElementById("stop").onclick = () => { - if (pc) pc.close(); - pc = null; - if (es) es.close(); - es = null; - watching = false; - remoteVideo.srcObject = null; - statusEl.innerHTML = '未观看'; - log(logEl, "已停止观看"); - }; - } - - return { ENUM, getRoom, loadConfig, log, initPublish, initWatch, apiGet, apiPost, apiGetWithAuth, apiPostWithAuth, login, register, getMe, authCheck, getToken, setToken, clearToken, authHeaders }; -})(); diff --git a/internal/server/static/assets/arrow-right-DNPSxlbJ.js b/internal/server/static/assets/arrow-right-DNPSxlbJ.js new file mode 100644 index 0000000..68fa04e --- /dev/null +++ b/internal/server/static/assets/arrow-right-DNPSxlbJ.js @@ -0,0 +1 @@ +import{F as e,U as t,h as n}from"./ui-W1Pm8dqI.js";var r=[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]],i=i=>e(n,t(i,{iconNode:r,name:`arrow-right`}));export{i as t}; \ No newline at end of file diff --git a/internal/server/static/assets/cloud-CTCP3hC3.js b/internal/server/static/assets/cloud-CTCP3hC3.js new file mode 100644 index 0000000..33df2fe --- /dev/null +++ b/internal/server/static/assets/cloud-CTCP3hC3.js @@ -0,0 +1 @@ +import{F as e,U as t,h as n}from"./ui-W1Pm8dqI.js";var r=[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]],i=i=>e(n,t(i,{iconNode:r,name:`cloud`}));export{i as t}; \ No newline at end of file diff --git a/internal/server/static/assets/index-CFU6bGFM.js b/internal/server/static/assets/index-CFU6bGFM.js new file mode 100644 index 0000000..093f36a --- /dev/null +++ b/internal/server/static/assets/index-CFU6bGFM.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-Dwgi66GM.js","assets/ui-W1Pm8dqI.js","assets/arrow-right-DNPSxlbJ.js","assets/cloud-CTCP3hC3.js","assets/server-C0Pmpptj.js","assets/shield-check-D8IU7TWB.js","assets/publish-B-tBrFGx.js","assets/webrtc-D2p8RYHA.js","assets/watch-D3IYLpWT.js","assets/radio-CvpQ__fB.js","assets/rooms-IMfi_6M2.js","assets/users-C6m5OUWT.js","assets/login-BDg6Zp6A.js"])))=>i.map(i=>d[i]); +import{A as e,B as t,E as n,F as r,G as i,H as a,I as o,J as s,K as c,L as l,M as u,N as d,O as f,P as p,R as m,S as h,T as g,U as _,V as v,W as y,X as b,Y as x,Z as S,_ as C,b as w,d as T,f as E,g as ee,h as D,j as O,k as te,n as ne,p as re,q as ie,x as k,y as ae,z as oe}from"./ui-W1Pm8dqI.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function se(e){return e[e.length-1]}function ce(e,t){return typeof e==`function`?e(t):e}var le=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable;function de(e){for(let t in e)if(le.call(e,t))return!0;return!1}var fe=()=>Object.create(null),pe=(e,t)=>A(e,t,fe);function A(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=_e(e)&&_e(i);if(!a&&!(he(e)&&he(i)))return i;let o=a?e:me(e);if(!o)return i;let s=a?i:me(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;ti||!j(e[o],t[o],n)))return!1;return i===a}return!1}var ve=/[\x00-\x1f\x7f"<>`{}]/g;function ye(e){return e.replace(ve,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function be(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return ye(t)}var xe=[`http:`,`https:`,`mailto:`,`tel:`];function Se(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Ce(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=be(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=be(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function we(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Te(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var M=4,Oe=5;function ke(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=a.indexOf(`{`),s;if(o!==-1&&o+1!e.parse&&e.caseSensitive===p&&e.prefix===m&&e.suffix===h);if(_)n=_;else{let e=Ne(f,r,p,m,h);n=e,e.parent=i,e.depth=a;let t;t=f===1?i.dynamic??=[]:f===3?i.optional??=[]:i.wildcard??=[],t.push(e),t.length===2&&o?.push(t)}break}}i=n}if(d&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=Me(r);e.kind=Oe,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let f=(n.path||!n.children)&&!n.isRoot;if(f&&r.endsWith(`/`)){let e=Me(r);e.kind=M,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=d??null,i.priority=s?.params?.priority??0,f&&!i.route&&(i.route=n,i.fullPath=r)}if(n.children)for(let r of n.children)Ae(e,t,r,c,i,a,o,s)}function je(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Me(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function Ne(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function Pe(e,t){let n=Me(`/`),r=new Uint16Array(6),i=[];for(let t of e)Ae(!1,r,t,1,n,0,i);for(let e of i)e.sort(je);t.masksTree=n,t.flatCache=De(1e3)}function Fe(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=Be(e,t.masksTree);return t.flatCache.set(e,r),r}function Ie(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Me(`/`),Ae(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),Be(r,o,n)}function Le(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=Be(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=He(a.route)),t.matchCache.set(r,a),a}function Re(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function ze(e,t=!1,n){let r=Me(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;Ae(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&Ee(),o[e.id]=e,c!==0&&e.path){let t=Re(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(je);return{processedTree:{segmentTree:r,singleCache:De(1e3),matchCache:De(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function Be(e,t,n=!1){let r=e.split(`/`),i=We(e,r,t,n);if(!i)return null;let[a]=Ve(e,r,i);return{route:i.node.route,rawParams:a}}function Ve(e,t,n){let r=Ue(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(_||!(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)))){if(a){if(_)continue;let e=t.slice(u).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(i.optional){let e=d|1<=0;t--){let n=i.optional[t];s.push({node:n,index:u,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p,optionals:m+Ge(o,u),extract:h,rawParams:g})}}if(!_&&i.dynamic&&v)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p+Ge(o,u),optionals:m,extract:h,rawParams:g})}if(!_&&i.staticInsensitive){let e=i.staticInsensitive.get(y??=v.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,statics:f+Ge(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_&&i.static){let e=i.static.get(v);e&&s.push({node:e,index:u+1,skipped:d,statics:f+Ge(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(i.pathless)for(let e=i.pathless.length-1;e>=0;e--){let t=i.pathless[e];s.push({node:t,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;ee.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===M)>(e.node.kind===M)||t.node.kind===M==(e.node.kind===M)&&t.node.depth>e.node.depth)))}function Ye(e){return Xe(e.filter(e=>e!==void 0).join(`/`))}function Xe(e){return e.replace(/\/{2,}/g,`/`)}function Ze(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function N(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function Qe(e){return N(Ze(e))}function $e(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function et(e,t,n){return $e(e,n)===$e(t,n)}function tt({base:e,to:t,trailingSlash:n=`never`,cache:r}){if(t.includes(`//`)&&(t=Xe(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=Xe(e)),o=e.split(`/`);o.length>1&&se(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(se(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?Xe(s):s)||`/`;return a&&r&&r.set(a,c),c}function nt(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function rt(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>at(e,n)).join(`/`):at(r,n):r}function it({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;se.state.__TSR_key||e.href;function ht(e){let t=e.getAttribute(pt);if(t)return`[${pt}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var gt=!1,_t=`window`;function vt(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function yt(e){let t=new Set;for(let n of e){if(n===_t)continue;let e=vt(n);e&&t.add(e)}return t}function bt(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||mt,a=new Set,o=e=>{let t=ft[e]||={};for(let e of a)e===document?t[_t]={scrollX,scrollY}:e.isConnected&&(t[ht(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,gt=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{gt||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{o(i(e.stores.resolvedLocation.get()??e.stores.location.get())),dt()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c=r.hash,l;if(a.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.restoring&&d&&d!==u){let e=ft[d];if(e){let t=ft[u];for(let n in e){if(n===_t){if(s)continue}else{let e=vt(n);if(!e||s&&o&&(l??=yt(o),l.has(e)))continue}t||=ft[u]={},t[n]??=e[n]}}}gt=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=yt(o));let t=e&&i&&c,s=r.restoring?ft[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===_t){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=vt(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{gt=!1}}))}function xt(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function St(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function Ct(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=St(r):Array.isArray(t)?t.push(St(r)):n[e]=[t,St(r)]}return n}var wt=/^(?:\s|["[{\d-]|fa|nu|tr)/,Tt=Dt(JSON.parse),Et=Ot(JSON.stringify,JSON.parse);function Dt(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=Ct(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function Ot(e,t){let n=t===JSON.parse;function r(r){if(r&&typeof r==`object`)try{return e(r)}catch{}else if(t&&typeof r==`string`){if(n&&!wt.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=xt(e,r);return t?`?${t}`:``}}var kt=`__root__`;function At(e){if(e.statusCode=e.statusCode||e.code||307,!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function jt(e){return e instanceof Response&&!!e.options}function Mt(e){return{input:({url:t})=>{for(let n of e)t=Pt(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=Ft(e[n],t);return t}}}function Nt(e){let t=Qe(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=Ye([`/`,t,e.pathname]),e)}}function Pt(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Ft(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function It(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{Te(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var P=`__TSR_index`,Lt=`popstate`,Rt=`beforeunload`;function zt(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=Ut(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[P];i=Bt(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[P];i=Bt(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[P]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function Bt(e,t){t||={};let n=Wt();return{...t,key:n,__TSR_key:n,[P]:e}}function Vt(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>Ut(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Wt();t.history.replaceState({[P]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),S._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(e,t,n)=>{let r=s(t),i=!!g;i||(u=l),l=Ut(t,n),g=[r,n,g?.[2]||e],i||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(f){f=!1;return}let e=c(),n=e.state[P]-l.state[P],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),S.notify(u);return}}}l=c(),S.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=zt({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Rt,x,{capture:!0}),t.removeEventListener(Lt,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(Rt,x,{capture:!0}),t.addEventListener(Lt,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||y(`REPLACE`),n},S}function Ht(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function Ut(e,t){let n=Ht(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=Wt();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[P]:0,key:a,__TSR_key:a}}}function Wt(){return(Math.random()+1).toString(36).substring(7)}function Gt(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function Kt(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function qt({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function Jt(e,t,n,r){for(let i of t){if(r&&e._tx!==r)return;n.some(e=>e.routeId===i.routeId)||e.routesById[i.routeId].options.onLeave?.(i)}for(let i of n){if(r&&e._tx!==r)return;e.routesById[i.routeId].options[t.some(e=>e.routeId===i.routeId)?`onStay`:`onEnter`]?.(i)}}var Yt=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=nt(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:Vt()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`,this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=De(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=It(this.latestLocation,e),bt(this)}let a=this.options.basepath??`/`,o=this.options.rewrite;if(r||n!==a||i!==o){this.basepath=a;let e=[],t=Qe(a);t&&t!==`/`&&e.push(Nt({basepath:a})),o&&e.push(o),this.rewrite=e.length===0?void 0:e.length===1?e[0]:Mt(e),this.history&&this.updateLatestLocation(),this.stores&&this.stores.location.set(this.latestLocation)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=ze(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&Pe(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:Ce(e).path,external:!1,searchStr:o,search:pe(t?.search,i),hash:Ce(r.slice(1)).path,state:A(t?.state,a)}}let o=new URL(i,this.origin),s=Pt(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:Ce(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:pe(t?.search,c),hash:Ce(s.hash.slice(1)).path,state:A(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>tt({base:e,to:t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=Le(N(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{let t=(t={})=>{if(t.href){let e=Ut(t.href,{});t={...t,to:Pt(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}let n=t._fromLocation||this._pendingLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r[1],a=r[2],o=r[3],s=this.resolvePathWithBase(i,t.to?`${t.to}`:`.`),c=tn(t.params,o),l=this.routesByPath[N(s)],u;if(l)u=this.getRouteBranch(l);else if(s.includes(`$`))u=[];else{let[e,t,n]=this.getMatchedRoutes(s);u=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(u=[...u,this.options.notFoundRoute])}if(u.length&&de(c))for(let e of u){let t=e.options.params?.stringify??e.options.stringifyParams;if(t){c===o&&(c=Object.assign(Object.create(null),c));try{Object.assign(c,t(c))}catch{}}}let d=e.leaveParams?s:Ce(it({path:s,params:c,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,f=a;if(e._includeValidateSearch&&this.options.search?.strict){let e={};u.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,Qt(t.options.validateSearch,{...e,...f}))}catch{}}),f=e}f=$t(f,t,u,e._includeValidateSearch),f=pe(a,f);let p=this.options.stringifySearch(f),m=t.hash===!0?n.hash:t.hash?ce(t.hash,n.hash):void 0,h=m?`#${m}`:``,g=t.state===!0?n.state:t.state?ce(t.state,n.state):{};t.state&&(g=A(n.state,g));let _=`${d}${p}${h}`,v,y,b=!1;if(this.rewrite){let e=new URL(_,this.origin),t=Ft(this.rewrite,e);v=e.href.replace(e.origin,``),t.origin===this.origin?y=t.pathname+t.search+t.hash:(y=t.href,b=!0)}else v=we(_),y=v;return{publicHref:y,href:v,pathname:d,search:f,searchStr:p,state:g,hash:m??``,external:b,unmaskOnReload:t.unmaskOnReload}},n=t(e);if(e.mask)n.maskedLocation=t({from:e.from,...e.mask});else if(this.options.routeMasks){let r=Fe(n.pathname,this.processedTree);if(r){let i=Object.assign(Object.create(null),r.rawParams),{from:a,params:o,...s}=r.route,c=tn(o,i);n.maskedLocation=t({from:e.from,...s,params:c})}}return n},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=N(this.latestLocation.href)===N(n.href)&&j(qt(n.state),qt(this.latestLocation.state)),a=this._commitPromise,o,s=new Promise(e=>{o=e});if(s.resolve=()=>{o(),a?.resolve()},this._commitPromise=s,i)this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:r}})}return this._scroll.next=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,...a}={})=>{let o=this.buildLocation({...a,_includeValidateSearch:!0});this._pendingLocation=o;let s=this.commitLocation({...o,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===o&&(this._pendingLocation=void 0)}),s},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(Se(t,this.protocolAllowlist))return;if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return}i.replace?window.location.replace(t):window.location.href=t;return}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.hash=e.action.type===`PUSH`||e.action.type===`REPLACE`),await Ln(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(Kt(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set([...t,...this._cache.values(),...[...r?.values()??[]].flat(),...this._tx?.[3]??[]].filter(e=>!n||n(e)).map(e=>e.id)),a=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),a.push(e));let o=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&Gt(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(o);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i)this._flights?.delete(e);for(let e of a)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href){let t=this.buildLocation(e.options).publicHref||`/`;e.options.href=t,e.headers.set(`Location`,t)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&Se(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=on,this.preloadRoute=(e,t)=>Rn(this,e,0,t),this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=Ie(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!j(o.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?j(a.search,r.search,{partial:!0})?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??Et,parseSearch:e.parseSearch??Tt,protocolAllowlist:e.protocolAllowlist??xe}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=He(e),this.routeBranchCache.set(e,t)),t}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:N(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?en(this.options.notFoundMode,a):void 0,c=Array(a.length),l=this._committed,u=(e,t)=>{let n=l[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?l.find(t=>t.routeId===e.id):void 0},d;for(let n=0;n{let r=n(t.preSearchFilters?t.preSearchFilters.reduce((e,t)=>t(e),e):e);return t.postSearchFilters?t.postSearchFilters.reduce((e,t)=>t(e),r):r});let n=t.validateSearch;r&&n&&i.push(({search:e,next:t,meta:r})=>{let i=t(e);try{let e=Qt(n,i);if(r&&e)for(let t in e)t in i||(r.defaulted||=new Map).set(t,e[t]);return{...i,...e}}catch{}return i})}let a=(e,n,r)=>{if(e>=i.length){if(!t.search)return{};if(t.search===!0)return n;let e=ce(t.search,n);return r&&(r.explicit=e),e}return i[e]({search:n,next:(t,n)=>{if(n){let n=r||{};return{search:a(e+1,t,n),meta:n}}return a(e+1,t,r)},meta:r})};return a(0,e)}function en(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return kt}function tn(e,t){if(e===!1||e===null)return Object.create(null);if((e??!0)===!0)return t;let n=Object.assign(Object.create(null),t);return Object.assign(n,ce(e,n))}function nn(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function rn(e,t){return e.options[t]?.preload?.()}function an(e,t){let n=rn(e,`component`),r=rn(e,`pendingComponent`),i=t&&r?r.then(t):r;return t&&!r&&t(),n&&i?Promise.all([n,i]).then(()=>{}):n??i}function on(e,t,n){let r=()=>t===!1?void 0:t?rn(e,t):an(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function sn(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).finally(()=>t.removeEventListener(`abort`,i))})}function B(e,t){return e.routesById[t.routeId]}function un(e,t,n){return jt(e)?[L,e]:ot(e)?(e.routeId||=n,[cn,e]):(t&&typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),t?[I,e]:[F,e])}function dn(e,t){let n=un(t,!0,e.id);if(n[0]!==I)return n;try{e.options.onError?.(n[1])}catch(t){n=un(t,!0,e.id)}return n}function fn(e,t,n,r,i){return i[0].signal.aborted?R:Tn(e,t,n,dn(n,r),i)}async function pn(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[3];for(let i=n[6]??0;ie.navigate({...t,_fromLocation:o}),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:u.id},p=d;try{let e=r._ctx;!e&&u.options.context&&(e=r._ctx=u.options.context({...f,deps:r.loaderDeps,context:d})||{}),p={...d,...e},r.context=p}catch(a){return V(e,r),[i,fn(e,t,u,a,n)]}if(c.aborted)return[i,R];let m=r.paramsError??r.searchError;if(m!==void 0)return V(e,r),[i,fn(e,t,u,m,n)];let h=u.options.beforeLoad;if(!h)continue;let g={...f,search:r.search,context:p,...e.options.additionalContext},_=r.status;i>=a&&(r.status=`pending`,n[7]?.());try{gn(e,r,`beforeLoad`,n[0]);let a=await z(h(g),c);if(c.aborted)return[i,R];let o=Tn(e,t,u,un(a,!1,u.id),n);if(o[0]!==F)return V(e,r),[i,o];r.context={...p,...a}}catch(a){return V(e,r),[i,fn(e,t,u,a,n)]}finally{r.status===`pending`&&(r.status=_),gn(e,r,!1,n[0])}}i()}function mn(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function V(e,t){let n=t._flight;t._flight=void 0,mn(e,t,n)?.abort()}function H(e,t,n,r){let i=[];for(let a of t)if(!n?.includes(a)){let t=a._flight;if(a._flight=void 0,r&&t?.[2]===1&&e._flights?.get(a.id)===t&&n?.some(e=>e.id===a.id))t[2]=0;else{let n=mn(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function hn(e){for(let t of e){let e=t._flight;e&&e[2]++}}function gn(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function _n(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:t=>e.navigate({...t,_fromLocation:s}),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function vn(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return R;if(!i)return[F,void 0];let l=n._flight;gn(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(_n(e,t,n,r,s,a,!!o[3]))).then(e=>un(e,!1,r.id),e=>un(e,!0,r.id)).then(t=>(t[0]!==F&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===I&&l[2]?dn(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],Tn(e,t,r,await z(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return V(e,n),R}finally{gn(e,n,!1,s)}}function yn(e,t,n){t[0]===F?(e.loaderData=t[1],e.error=void 0,e.status=`success`,e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):t[0]!==L&&(e.status=`success`,e.error=void 0,e.invalid=!0)}function bn(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&V(e,r)}function xn(e,t){return t[0]===I||t[0]===cn?{...e,status:t[0]===I?`error`:`notFound`,error:t[1],_flight:void 0}:e}function Sn(e,t,n,r,i,a,o){let s=t[1][n],c=B(e,s),l=!!a[3],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d(_n(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=R)),!p){if(s.status!==`success`)f=!0;else{let t=a[3]||s.preload?c.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.options.defaultStaleTime??0;f=!!(s.invalid||d||d===void 0&&Date.now()-s.updatedAt>=t&&(a[5]||s.cause===`enter`||a[2].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(n){s.invalid=!0,V(e,s),p=fn(e,t,c,n,a)}let m=c.options.loader,h=typeof m==`function`?m:m?.handler,g=(!l||c.options.preload!==!1)&&m?e._flights?.get(s.id):void 0;g===s._flight||p?g=void 0:g&&!f&&!l&&d===void 0?f=!0:f||(g=void 0);let _=!!(m&&f&&s.status===`success`&&!l&&!a[4]&&((typeof m==`function`?void 0:m?.staleReloadMode)??e.options.defaultStaleReloadMode)!==`blocking`),v=f&&(!l||c.options.preload!==!1),y=v&&!_&&(s.status!==`success`||!!m),b=n>=o?a[7]:void 0,x=c.lazyFn&&c._lazy!==!0?b:void 0;if(v&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),g&&g[2]++,y){let t=s._flight;s._flight=g,mn(e,s,t)?.abort(),n>=o&&(s.status=`pending`),b?.()}v||(s.isFetching=!1);let S=(p?Promise.resolve(p):y?vn(e,t,s,c,h,i,a):Promise.resolve([F,s.loaderData])).then(t=>(y&&(yn(s,t,l),t[0]===F&&(m&&!a[0].signal.aborted&&bn(e,s,u),n>=o&&(s.status=`pending`))),t)),C=z(Promise.resolve().then(()=>on(c,void 0,x)),a[0].signal).then(()=>void 0,r=>t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound))?void 0:[n,fn(e,t,c,r,a)]).then(e=>S.then(t=>(y&&!e&&t[0]===F&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,b?.()),e)));if(r.push([n,S,C]),!_)return S.then(e=>xn(s,e));let w={...s,status:`pending`,preload:!1,_flight:g};s.invalid=!1,s.isFetching=`loader`;let T=vn(e,t,w,c,h,i,a).then(e=>(s.isFetching=!1,yn(w,e,!1),e));return(t[2]??=[]).push([n,T,C,w]),T.then(e=>xn(w,e))}async function Cn(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=B(e,t[n]);try{let e=on(i,!1);e&&await z(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function U(e,t){t[2]&&=(H(e,t[2].map(e=>e[3])),void 0)}async function wn(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=L)throw[a,t];!i&&t[0]!==F&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===L)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function Tn(e,t,n,r,i,a){for(;r[0]===L;){let o=r[1];if(o.options.reloadDocument?i[3]:i[1]>=20)return r;try{return o.options.href&&o.options.reloadDocument?(e.resolveRedirect(o),r):[L,o,e.buildLocation({...o.options,_fromLocation:t[0],_includeValidateSearch:!0})]}catch(e){r=a?[I,e]:dn(n,e),a=!0}}return r}async function En(e,t,n,r,i,a){let o=t[1],s=await i,c=!1,l=o.findIndex(e=>e._notFound),u=t=>t[1][0]===cn?Cn(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=L)d=0;else if(s){d=s[2]??=await u(s);for(let e of n){if(e[0]>=d)break;let t=await e[1];if(t[0]!==F&&t[0]=d)break;let t=await e[2];if(t){s=t;break}}if((s?.[1][0]??0)>=L){let n=s[1];if(n[0]!==L||n[1].options.reloadDocument||n[2])return U(e,t),n;c=!0,s=[0,[I,Error(`Too many redirects`)]]}let f=s?s[2]??await u(s):l;if(f>=0){let i=s?.[1],l=i?.[0],u=o[f],d=i?.[1],p=()=>{i&&(u._notFound=void 0,l===I?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};p(),i||a?.();let m=B(e,u);try{await z(i?Promise.resolve().then(()=>on(m,l===I?`errorComponent`:`notFoundComponent`)):Promise.all([on(m),on(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return U(e,t),R}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),U(e,t),H(e,o),p()):u.status=`success`}return t}async function Dn(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;te._notFound);if(e.options.notFoundMode!==`root`&&s>=0){let t=await Cn(e,i[1],void 0,a,s);t!==s&&(n[s]._notFound=void 0,n[t]._notFound=!0),s=t}let c=s<0?n.length:s+1,l=0;for(;l{for(let t=d;t=L&&(c=0);p()}if(!a.aborted&&!r[3]){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}let h=En(e,i,u,r[0],wn(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=wn(i[2],void 0,void 0,h.then(e=>ln(e)?0:sn(e[1]).length,()=>0))),o=await h}catch(t){if(U(e,i),t===a&&a.aborted)return R;throw t}return ln(o)?o:Dn(e,o,a,r[6]===o[1].length?r[6]:0)}function kn(e,t){if(e._tx!==t)return;let n=t[3],r=e.stores.matches.get(),i=e._pending;for(let a=0;a0){i[3]=setTimeout(()=>kn(e,t),n);return}i[2]=0}let m=n.map(e=>({...e,_flight:void 0}));m[a].status=`pending`;let h=i[4]=e.startTransition(()=>e.stores.setMatches(m),m).then(t=>(t&&e._pending===i&&i[4]===h&&!i[2]&&(i[2]=Date.now()+f),t));return}}function W(e,t){let n=e._pending;(e._tx===t||!e._tx?.[3].some(e=>e.id===n?.[1]))&&(clearTimeout(n?.[3]),e._pending=void 0)}async function An(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!sn(t[3]).some(e=>e.id===n[1]))return;let i;try{await z(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function jn(e,t){e._committed=t,e.stores.setMatches(t)}function Mn(e,t,n,r){let i=e._committed,a=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let o=sn(n).length,s=new Map;{let t=Date.now();for(let r of[...i,...a.values()]){if(r.status!==`success`||n.some((e,t)=>e.id===r.id&&(t=(r.preload?i.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:i.options.gcTime??e.options.defaultGcTime??3e5)||s.set(r.id,a.get(r.id)===r?r:{...r,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=s,jn(e,n),H(e,[...a.values(),...i],[...n,...s.values()]),Jt(e,i,n,t)}async function Nn(e,t){let n=e._tx;for(;n&&n!==t;){if(await n[5],e._tx===n)return;n=e._tx}}async function Pn(e,t,n){let r=n[1],i=n[2];if(!i){await e.navigate({...r.options,replace:!0,ignoreBlocker:!0});return}if(r.options.reloadDocument){await e.navigate({href:i.publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});return}i._redirects=t[1]+1,e._pendingLocation=i;let a=e.commitLocation({...i,viewTransition:r.options.viewTransition,replace:!0,resetScroll:r.options.resetScroll,hashScrollIntoView:r.options.hashScrollIntoView,ignoreBlocker:!0});queueMicrotask(()=>{e._pendingLocation===i&&(e._pendingLocation=void 0)}),await a}async function Fn(e,t,n,r,i){let a=n.map(e=>({...e}));hn(a);for(let t of r)V(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await En(e,o,r,t[0],i)}catch(t){throw H(e,a),t}if(ln(s)){H(e,a),s[0]===L&&e._tx===t&&e._committed===n&&await Pn(e,t,s);return}let c=await Dn(e,s,t[0].signal);if(e._tx!==t||e._committed!==n){H(e,c[1]);return}for(let t of c[1]){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),V(e,n))}jn(e,c[1]),H(e,n,c[1])}async function In(e,t,n,r,i,a){let o=[t[0],t[1],e._committed,void 0,i,n,a,r],s=await On(e,t[2],t[3],o);if(ln(s)){let n=s[0]===L&&e._tx===t;if((!n||s[1].options.reloadDocument)&&W(e,t),H(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){W(e,t);return}await Pn(e,t,s);return}if(e._tx!==t){W(e,t),H(e,s[1]),U(e,s);return}if(await An(e,t),e._tx!==t){W(e,t),H(e,s[1]),U(e,s);return}let c=t[2],l=Kt(c,e.stores.resolvedLocation.get()),u=s[2];await e.startViewTransition(async()=>{if(e._tx!==t){W(e,t),H(e,s[1]),U(e,s);return}if(await An(e,t),e._tx!==t){W(e,t),H(e,s[1]),U(e,s);return}let n=await e.startTransition(()=>{W(e,t),Mn(e,t,s[1],a),e._tx===t&&(e.emit({type:`onLoad`,...l}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...l}))},s[1]);if(e._tx!==t){U(e,s);return}u?.length&&Fn(e,t,s[1],u,s[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...l}),n&&e._tx===t&&e.emit({type:`onRendered`,...l})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)})}async function Ln(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),u.signal.aborted){await Nn(e,n);return}let f=Kt(a,r);if(e.emit({type:`onBeforeNavigate`,...f}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...f}),u.signal.aborted){await Nn(e,n);return}let p=i.href===a.href,m=u,h=e.matchRoutes(a,{_controller:u});hn(h);let g=l?c[1](h):void 0;if(g?m=l:l?.abort(),u.signal.aborted){H(e,h),await Nn(e,n);return}e._preflight=void 0;let _=[m,s,a,h,Date.now(),Promise.resolve().then(()=>In(e,_,p,()=>kn(e,_),t?.sync,g)).then()];if(e._tx=_,n){for(let t of e.stores.matches.get()){if(e._tx!==_)break;t.isFetching&&gn(e,t,!1)}n[0].abort(),H(e,n[3],_[3],!0)}if(e._tx!==_){H(e,_[3]),_[3]=[],await Nn(e,_);return}e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),(g||!e._committed.length&&!h.some(e=>e._notFound))&&kn(e,_),await _[5],await Nn(e,_)}async function Rn(e,t,n=0,r){let i=r??e.buildLocation(t),a=e._committed,o=new AbortController,s;try{s=e.matchRoutes(i,{_controller:o}),hn(s)}catch(e){o.abort(),ot(e)||console.error(e);return}(e._preloads??=new Map).set(o,s);let c;try{let t;try{t=await On(e,i,s,[o,n,a,!0])}finally{c=e._preloads.delete(o),H(e,s),o.abort()}if(!ln(t))return t[1];if(c&&t[0]===L&&!t[1].options.reloadDocument)return Rn(e,t[1].options,n+1,t[2])}catch(e){ot(e)||console.error(e)}}var zn=`Error preloading route! ☝️`,Bn=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=kt:this.parentRoute||Ee();let r=n?kt:t?.path;r&&r!==`/`&&(r=Ze(r));let i=t?.id||r,a=n?kt:Ye([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=Ye([`/`,a]));let o=a===`__root__`?`/`:Ye([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=N(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>At({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},Vn=class extends Bn{constructor(e){super(e)}},Hn=n(`
Something went wrong!
`),Un=n(`
`),Wn=n(``);function Gn(e){return r(f,{fallback:(t,n)=>(e.onCatch?.(t),l(y(e.getResetKey,()=>n(),{defer:!0})),r(C,{get component(){return e.errorComponent??Kn},error:t,reset:n})),get children(){return e.children}})}function Kn({error:e}){let[t,n]=v(!1);return(()=>{var r=Hn(),i=r.firstChild,a=i.firstChild.nextSibling;return i.nextSibling,a.$$click=()=>n(e=>!e),w(a,()=>t()?`Hide Error`:`Show Error`),w(r,(()=>{var n=k(()=>!!t());return()=>n()?(()=>{var t=Un(),n=t.firstChild;return w(n,(()=>{var t=k(()=>!!e.message);return()=>t()?(()=>{var t=Wn();return w(t,()=>e.message),t})():null})()),t})():null})(),null),r})()}ae([`click`]);function qn(e){let t=Yn();return r(O,{get when(){return t()},get fallback(){return e.fallback??null},get children(){return k(()=>e.children)}})}var Jn=!1;function Yn(){let[e,t]=v(Jn&&!ie.context);return c(()=>{Jn=!0,t(!0)}),e}function Xn(e){return(...t)=>{for(let n of e)n&&n(...t)}}function Zn(...e){return Xn(e)}var Qn=o(null);function G(e){return S(Qn)}function $n(e,t,n){let r=typeof IntersectionObserver==`function`,a=null;return l(()=>{let o=e();if(n()||!o||!r){i(()=>t());return}a=new IntersectionObserver(e=>{t(e.pop())},{rootMargin:`100px`}),a.observe(o),i(()=>{a?.disconnect(),t()})}),()=>a}var er=n(``),tr=n(``),nr=new WeakMap,rr=e=>{clearTimeout(nr.get(e)),nr.delete(e)};function ir(e){let t=G(),n=!!t.options.ssr,r=Yn(),i=!1,[a,o]=s(_({activeProps:or,inactiveProps:cr},e),[`activeProps`,`inactiveProps`,`activeOptions`,`to`,`preload`,`preloadDelay`,`preloadIntentProximity`,`hashScrollIntoView`,`replace`,`startTransition`,`resetScroll`,`viewTransition`,`target`,`disabled`,`style`,`class`,`onClick`,`onBlur`,`onFocus`,`onMouseEnter`,`onMouseLeave`,`onMouseOver`,`onMouseOut`,`onTouchStart`,`ignoreBlocker`]),[c,u]=s(o,[`params`,`search`,`hash`,`state`,`mask`,`reloadDocument`,`unsafeRelative`,`from`]),d=m(()=>t.stores.location.get(),void 0,{equals:(e,t)=>e.href===t.href}),f=m(()=>{let n={_fromLocation:d(),...e};return b(()=>t.buildLocation(n))}),p=m(()=>{if(e.disabled)return;let n=f().maskedLocation??f(),r=n.publicHref;return n.external?{href:r,external:!0}:{href:t.history.createHref(r)||`/`,external:!1}}),h=m(()=>{let n=p();if(n?.external)return Se(n.href,t.protocolAllowlist)?void 0:n.href;let r=e.to;if(!mr(r)&&typeof r==`string`&&r.indexOf(`:`)!==-1)try{return new URL(r),Se(r,t.protocolAllowlist)?void 0:r}catch{}}),g=m(()=>e.reloadDocument||h()||a.disabled?!1:a.preload??t.options.defaultPreload),y=()=>a.preloadDelay??t.options.defaultPreloadDelay??0,x=m(()=>{if(h())return!1;let e=a.activeOptions,i=d(),o=f();if(e?.exact){if(!et(i.pathname,o.pathname,t.basepath))return!1}else{let e=$e(i.pathname,t.basepath),n=$e(o.pathname,t.basepath);if(!(e.startsWith(n)&&(e.length===n.length||e[n.length]===`/`)))return!1}return(e?.includeSearch??!0)&&!j(i.search,o.search,{partial:!e?.exact,ignoreUndefined:!e?.explicitUndefined})?!1:!e?.includeHash||(n&&!r()?``:i.hash)===o.hash}),S=()=>t.preloadRoute(e,f()).catch(e=>{console.warn(e),console.warn(zn)}),[C,w]=v(null),T=e=>{if(!e){rr(C);return}if(!(e.isIntersecting??g()===`intent`)){e.isIntersecting===!1&&rr(C);return}if(!y()){S();return}nr.has(C)||nr.set(C,setTimeout(()=>{nr.delete(C),S()},y()))};if($n(C,T,()=>g()!==`viewport`),l(()=>{i||g()===`render`&&(S(),i=!0)}),h())return _(u,{ref:Zn(w,e.ref),href:h()},s(a,[`target`,`disabled`,`style`,`class`,`onClick`,`onBlur`,`onFocus`,`onMouseEnter`,`onMouseLeave`,`onMouseOut`,`onMouseOver`,`onTouchStart`])[0]);let E=n=>{let r=n.currentTarget.getAttribute(`target`),i=a.target===void 0?r:a.target;!a.disabled&&!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)&&!n.defaultPrevented&&(!i||i===`_self`)&&n.button===0&&(n.preventDefault(),t.navigate({...e,replace:a.replace,resetScroll:a.resetScroll,hashScrollIntoView:a.hashScrollIntoView,startTransition:a.startTransition,viewTransition:a.viewTransition,ignoreBlocker:a.ignoreBlocker}))},ee=()=>{g()===`intent`&&S()},D=()=>{g()===`intent`&&rr(C)},O=m(()=>a.activeProps===or&&a.inactiveProps===cr&&a.class===void 0&&a.style===void 0),te=K(()=>a.onClick,E),ne=K(()=>a.onBlur,D),re=K(()=>a.onFocus,T),ie=K(()=>a.onMouseEnter,T),k=K(()=>a.onMouseOver,T),ae=K(()=>a.onMouseLeave,D),oe=K(()=>a.onMouseOut,D),se=K(()=>a.onTouchStart,ee),le=m(()=>{let t=x(),n={href:p()?.href,ref:Zn(w,e.ref),onClick:te,onBlur:ne,onFocus:re,onMouseEnter:ie,onMouseOver:k,onMouseLeave:ae,onMouseOut:oe,onTouchStart:se,disabled:!!a.disabled,target:a.target,...a.disabled&&ur};if(O())return{...n,...t&&lr};let r=t?ce(a.activeProps,{})??sr:sr,i=t?sr:ce(a.inactiveProps,{}),o={...a.style,...r.style,...i.style},s=[a.class,r.class,i.class].filter(Boolean).join(` `);return{...r,...i,...n,...de(o)?{style:o}:void 0,...s?{class:s}:void 0,...t&&dr}});return _(u,le)}var ar={class:`active`},or=()=>ar,sr={},cr=()=>sr,lr={class:`active`,"data-status":`active`,"aria-current":`page`},ur={role:`link`,"aria-disabled":!0},dr={"data-status":`active`,"aria-current":`page`};function fr(e,t){return typeof t==`function`?t(e):t[0](t[1],e),e.defaultPrevented}function K(e,t){return n=>{let r=e();(!r||!fr(n,r))&&t(n)}}var pr=e=>{let[t,n]=s(e,[`_asChild`,`children`]),[i,a]=s(ir(n),[`type`]),o=m(()=>{let e=t.children;return typeof e==`function`?e({get isActive(){return a[`data-status`]===`active`}}):e});if(t._asChild===`svg`){let[e,t]=s(a,[`class`]);return(()=>{var e=er(),n=e.firstChild;return g(n,t,!1,!0),w(n,o),e})()}return t._asChild?r(C,_({get component(){return t._asChild}},a,{get children(){return o()}})):(()=>{var e=tr();return g(e,a,!1,!0),w(e,o),e})()};function mr(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var hr=o([()=>void 0,()=>void 0]);function q(e){let t=G(),n=S(hr),r=e.from?void 0:n,i=()=>e.from?t.stores.getMatchStore(e.from).get():r?.[1]();return l(()=>{i()===void 0&&(e.shouldThrow??!0)&&Ee()}),m(t=>{let n=i();if(n===void 0)return;let r=e.select?e.select(n):n;return t===void 0?r:A(t,r)})}function gr(e){return q({from:e.from,strict:e.strict,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function _r(e){return q({...e,select:t=>e.select?e.select(t.loaderDeps):t.loaderDeps})}function vr(e){return q({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function yr(e){return q({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,select:t=>{let n=t.search;return e.select?e.select(n):n}})}function br(e){let t=G();return n=>t.navigate({...n,from:n.from??e?.from})}function xr(e){return q({...e,select:t=>e.select?e.select(t.context):t.context})}var J=class extends Bn{constructor(e){super(e),this.useMatch=e=>q({select:e?.select,from:this.id}),this.useRouteContext=e=>xr({...e,from:this.id}),this.useSearch=e=>yr({select:e?.select,from:this.id}),this.useParams=e=>vr({select:e?.select,from:this.id}),this.useLoaderDeps=e=>_r({...e,from:this.id}),this.useLoaderData=e=>gr({...e,from:this.id}),this.useNavigate=()=>br({from:this.fullPath}),this.Link=e=>{let t=this;return r(pr,_({get from(){return t.fullPath}},e))}}},Sr=class extends Vn{constructor(e){super(e),this.useMatch=e=>q({select:e?.select,from:this.id}),this.useRouteContext=e=>xr({...e,from:this.id}),this.useSearch=e=>yr({select:e?.select,from:this.id}),this.useParams=e=>vr({select:e?.select,from:this.id}),this.useLoaderDeps=e=>_r({...e,from:this.id}),this.useLoaderData=e=>gr({...e,from:this.id}),this.useNavigate=()=>br({from:this.fullPath}),this.Link=e=>{let t=this;return r(pr,_({get from(){return t.fullPath}},e))}}};function Cr(e){let t=e.stores.resolvedLocation.get();if(t?.href===e.latestLocation.href&&t.state.__TSR_key===e.latestLocation.state.__TSR_key)return t}function wr(){let e=G(),t;return e.startTransition=e=>(t?.(!1),new Promise((n,r)=>{let i=e=>{t===i&&(t=void 0,n(e))},a=e=>{t===i&&(t=void 0,r(e))};t=i,x(()=>{if(t===i)try{e()}catch(e){a(e)}}).then(()=>i(!0),a)})),i(()=>{t?.(!1)}),c(()=>{i(e.history.subscribe(e.load));let t=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(N(e.latestLocation.publicHref)!==N(t.publicHref)){e.commitLocation({...t,replace:!0,ignoreBlocker:!0});return}!Cr(e)&&!e._tx&&e.load().catch(console.error)}),null}function Tr(){let e=G();return c(()=>{let t=Cr(e);t&&e.emit({type:`onRendered`,...Kt(t,t)})}),null}function Y(e){return k(()=>e.children)}var Er=n(`

Not Found`);function Dr(e){if(ot(e))return e;if(ot(e?.cause))return e.cause}function Or(e){let t=G(),n=m(()=>t.stores.location.get().pathname),i=m(()=>t.stores.status.get());return r(Gn,{getResetKey:()=>`not-found-${n()}-${i()}`,onCatch:t=>{let n=Dr(t);if(n)e.onCatch?.(n);else throw t},errorComponent:({error:t})=>{let n=Dr(t);if(n)return e.fallback?.(n);throw t},get children(){return e.children}})}function kr(){return Er()}function Ar(e,t,n){return t.options.notFoundComponent?r(t.options.notFoundComponent,n):e.options.defaultNotFoundComponent?r(e.options.defaultNotFoundComponent,n):r(kr,{})}var jr=void 0,Mr=t=>{let n=G(),i=m(()=>n.stores.byRoute.get(t.routeId).get()),a=[()=>t.routeId,i],o=n.routesById[t.routeId],s=()=>(i(),o.options),c=()=>s().pendingComponent??n.options.defaultPendingComponent,l=()=>s().errorComponent??n.options.defaultErrorComponent,f=()=>o.isRoot?s().notFoundComponent??n.options.notFoundRoute?.options.component:s().notFoundComponent,p=()=>i().ssr===!1||i().ssr===`data-only`,h=()=>i().ssr===`data-only`,g=o.isRoot?o.options.shellComponent??Y:Y,v=()=>r(O,{get when(){return i().status!==`pending`},get fallback(){return r(C,{get component(){return c()}})},get children(){return r(Nr,{})}});return r(g,{get children(){return[r(hr.Provider,{value:a,get children(){return r(u,{get fallback(){if(!h())return r(C,{get component(){return c()}})},get children(){return r(C,{get component(){return l()?Gn:Y},getResetKey:i,get errorComponent(){return l()},onCatch:e=>{let t=Dr(e);if(t)throw t.routeId??=i().routeId,t;(o.options.onCatch??n.options.defaultOnCatch)?.(e)},get children(){return r(C,{get component(){return f()?Or:Y},fallback:e=>{let t=Dr(e)??e;if(t.routeId??=i().routeId,t.routeId!==i().routeId)throw t;return r(C,_({get component(){return f()}},t))},get children(){return r(d,{get children(){return[r(e,{get when(){return p()},get children(){return r(qn,{get fallback(){return r(C,{get component(){return c()}})},get children(){return r(v,{})}})}}),r(e,{get when(){return!p()},get children(){return r(v,{})}})]}})}})}})}})}}),k(()=>jr?.(n,o))]}})},Nr=()=>{let t=G(),n=S(hr),i=n[1],a=n[0],o=t.routesById[a()],s=()=>i(),c=()=>{let e=s(),n=o.options.remountDeps??t.options.defaultRemountDeps;if(!n)return a();let r=n({routeId:a(),loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return JSON.stringify(r)??a()},l=()=>{let e=o.options.component??t.options.defaultComponent;return r(e||Pr,{})},u=()=>r(O,{get when(){return c()},keyed:!0,children:e=>l()});return r(d,{get children(){return[r(e,{get when(){return s().status===`notFound`},children:e=>Ar(t,o,s().error)}),r(e,{get when(){return s().status===`error`},children:e=>{throw s().error}}),r(e,{get when(){return s().status===`success`},get children(){return u()}})]}})},Pr=()=>{let e=G(),t=S(hr),n=t[1],i=t[0],a=e.routesById[i()],o=()=>{if(n()._notFound)return;let t=e.stores.ids.get();return t[t.indexOf(i())+1]};return r(O,{get when(){return o()},keyed:!0,get fallback(){return k(()=>!!n()._notFound)()?Ar(e,a,n().error):void 0},children:t=>r(O,{get when(){return i()===kt},get fallback(){return r(Mr,{get routeId(){return o()}})},get children(){return r(u,{get fallback(){return r(C,{get component(){return e.options.defaultPendingComponent}})},get children(){return r(Mr,{get routeId(){return o()}})}})}})})};function Fr(){let e=G(),t=typeof document<`u`&&e.ssr?Y:u,n=e.routesById[kt].options.pendingComponent??e.options.defaultPendingComponent,i=e.options.InnerWrap||Y;return r(i,{get children(){return r(t,{get fallback(){return n?r(n,{}):null},get children(){return[r(wr,{}),r(Ir,{}),r(Tr,{})]}})}})}function Ir(){let e=G(),t=()=>e.stores.ids.get()[0],n=()=>t()?e.stores.byRoute.get(t())?.get():void 0,i=[t,n],a=()=>r(O,{get when(){return t()},get children(){return r(Mr,{get routeId(){return t()}})}});return r(hr.Provider,{value:i,get children(){return k(()=>!!e.options.disableGlobalCatchBoundary)()?a():r(Gn,{getResetKey:n,errorComponent:Kn,get onCatch(){},get children(){return a()}})}})}function Lr(e){let[t,n]=v(e);return{get:t,set:n}}function Rr(e){return{get:t(()=>m(e))}}var zr=e=>({createMutableStore:Lr,createReadonlyStore:Rr,batch:p}),Br=e=>new Vr(e),Vr=class extends Yt{constructor(e){super(e,zr)}};function Hr({router:e,children:t,...n}){e.update({...e.options,...n,context:{...e.options.context,...n.context}});let i=e.options.Wrap||Y;return r(i,{get children(){return r(Qn.Provider,{value:e,get children(){return t()}})}})}function Ur({router:e,...t}){return r(Hr,_({router:e},t,{children:()=>r(Fr,{})}))}function Wr(e){let t=G();if(!e?.select)return()=>t.stores.location.get();let n=e.select;return m(e=>{let r=n(t.stores.location.get());return e===void 0?r:A(e,r)})}var Gr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Kr=new class extends Gr{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},qr={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Jr=new class{#e=qr;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Yr(e){setTimeout(e,0)}var Xr=typeof window>`u`||`Deno`in globalThis;function X(){}function Zr(e,t){return typeof e==`function`?e(t):e}function Qr(e){return typeof e==`number`&&e>=0&&e!==1/0}function $r(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ei(e,t){return typeof e==`function`?e(t):e}function ti(e,t){return typeof e==`function`?e(t):e}function ni(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==ii(o,t.options))return!1}else if(!oi(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function ri(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(ai(t.options.mutationKey)!==ai(a))return!1}else if(!oi(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ii(e,t){return(t?.queryKeyHashFn||ai)(e)}function ai(e){return JSON.stringify(e,(e,t)=>ui(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function oi(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n500)return t;let r=li(e)&&li(t);if(!r&&!(ui(e)&&ui(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{Jr.setTimeout(t,e)})}function pi(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ci(e,t)}function mi(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function hi(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var gi=Symbol();function _i(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===gi?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function vi(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var yi=(()=>{let e=()=>Xr;return{isServer(){return e()},setIsServer(t){e=t}}})();function bi(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var xi=Yr;function Si(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=xi,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var Z=Si(),Ci=new class extends Gr{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function wi(e){return Math.min(1e3*2**e,3e4)}function Ti(e){return(e??`online`)!==`online`||Ci.isOnline()}var Ei=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Di(e){let t=!1,n=0,r,i=bi(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Ei(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>Kr.isFocused()&&(e.networkMode===`always`||Ci.isOnline())&&e.canRun(),u=()=>Ti(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(yi.isServer()?0:3),o=e.retryDelay??wi,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&nl()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Oi=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Qr(this.gcTime)&&(this.#e=Jr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(yi.isServer()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Jr.clearTimeout(this.#e),this.#e=void 0)}};function ki(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{vi(e,()=>t.signal,()=>n=!0)},u=_i(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?hi:mi;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?ji:Ai,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Ai(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Ai(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function ji(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Mi=class extends Oi{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Fi(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Fi(this.options);e.data!==void 0&&(this.setState(Pi(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=pi(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(X).catch(X):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>ti(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===gi||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>ei(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!$r(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=_i(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?ki(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=Di({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Ei&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Ei){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Ni(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Pi(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Z.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ni(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ti(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Pi(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Fi(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Ii=class extends Oi{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Li(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Di({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),Z.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Li(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ri=class extends Gr{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Ii({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=zi(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=zi(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=zi(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=zi(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Z.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ri(t,e))}findAll(e={}){return this.getAll().filter(t=>ri(e,t))}notify(e){Z.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Z.batch(()=>Promise.all(e.map(e=>e.continue().catch(X))))}};function zi(e){return e.options.scope?.id}var Bi=class extends Gr{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??ii(r,t),a=this.get(i);return a||(a=new Mi({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Z.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ni(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ni(e,t)):t}notify(e){Z.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Z.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Z.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Vi=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Bi,this.#t=e.mutationCache||new Ri,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Kr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Ci.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ei(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Zr(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Z.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Z.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Z.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Z.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(X).catch(X)}invalidateQueries(e,t={}){return Z.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Z.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(X)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(X)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(ei(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(X).catch(X)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(X).catch(X)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Ci.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(ai(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{oi(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ai(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{oi(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=ii(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===gi&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Hi=o(void 0),Ui=e=>(oe(t=>(t?.(),e.client.mount(),e.client.unmount.bind(e.client))),i(()=>e.client.unmount()),r(Hi.Provider,{value:()=>e.client,get children(){return e.children}}));o(()=>!1).Provider;var Wi=class extends Vi{constructor(e={}){super(e)}},Gi=[[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]],Ki=e=>r(D,_(e,{iconNode:Gi,name:`circle-play`})),qi=[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]],Ji=e=>r(D,_(e,{iconNode:qi,name:`house`})),Yi=[[`path`,{d:`M15.033 9.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56V7.648a.645.645 0 0 1 .967-.56z`,key:`vbtd3f`}],[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`rect`,{x:`2`,y:`3`,width:`20`,height:`14`,rx:`2`,key:`x3v2xh`}]],Xi=e=>r(D,_(e,{iconNode:Yi,name:`monitor-play`})),Zi=[[`path`,{d:`M4.9 16.1C1 12.2 1 5.8 4.9 1.9`,key:`s0qx1y`}],[`path`,{d:`M7.8 4.7a6.14 6.14 0 0 0-.8 7.5`,key:`1idnkw`}],[`circle`,{cx:`12`,cy:`9`,r:`2`,key:`1092wv`}],[`path`,{d:`M16.2 4.8c2 2 2.26 5.11.8 7.47`,key:`ojru2q`}],[`path`,{d:`M19.1 1.9a9.96 9.96 0 0 1 0 14.1`,key:`rhi7fg`}],[`path`,{d:`M9.5 18h5`,key:`mfy3pd`}],[`path`,{d:`m8 22 4-11 4 11`,key:`25yftu`}]],Qi=e=>r(D,_(e,{iconNode:Zi,name:`radio-tower`})),$i=[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]],ea=e=>r(D,_(e,{iconNode:$i,name:`users`})),ta=[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]],na=e=>r(D,_(e,{iconNode:ta,name:`video`})),ra=n(``),ia=n(`直播 SFU 分流台`),aa=n(`