diff --git a/README.md b/README.md index 72b2858..8a43662 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ flowchart LR | **Coalescing** | Duplicate notifications for active threads fold into existing work. | | **Policy gates** | Trust, canary scope, actions, routes, and repo roles live in JSON policy. | | **Safe rollout** | Replay, shadow, dry-run, canary, then live. | -| **Agent knowledge MCP** | Local agents can query acquired repository knowledge through an authenticated read-only MCP server. | +| **Agent knowledge MCP** | Agents can query acquired repository knowledge through an authenticated read-only HTTP MCP server. | | **Automatic releases** | Conventional commits drive tags, changelog, GitHub Releases, wheel/sdist. | ## Installation @@ -166,7 +166,7 @@ See [`docs/shadow-canary.md`](docs/shadow-canary.md). | Understand the system shape | [`docs/architecture.md`](docs/architecture.md) | | Develop or test changes | [`docs/development.md`](docs/development.md) | | Operate the bridge | [`docs/operations.md`](docs/operations.md) | -| Expose bridge knowledge to local agents | [`docs/mcp.md`](docs/mcp.md) | +| Expose bridge knowledge to agents | [`docs/mcp.md`](docs/mcp.md) | | Configure trust, actions, routes, roles | [`docs/policy-reference.md`](docs/policy-reference.md) | | Plan rollout safely | [`docs/shadow-canary.md`](docs/shadow-canary.md) | | Understand releases | [`docs/releases.md`](docs/releases.md) | diff --git a/dashboard/src/main.test.tsx b/dashboard/src/main.test.tsx index 1ea5820..e225bc8 100644 --- a/dashboard/src/main.test.tsx +++ b/dashboard/src/main.test.tsx @@ -172,6 +172,7 @@ describe("MCP access page", () => { error={null} user={admin} dashboardUrl="https://bridge.example.com/ops" + dashboardUrlSource="configured" now={Date.parse("2026-06-23T11:05:00Z")} onCreate={onCreate} onRevoke={onRevoke} @@ -181,9 +182,15 @@ describe("MCP access page", () => { expect(screen.getByText("Connect an agent")).toBeInTheDocument(); expect(screen.getByText("Public dashboard URL")).toBeInTheDocument(); + expect(screen.getByText("Configured public URL")).toBeInTheDocument(); expect(screen.getByText("https://bridge.example.com/ops/mcp")).toBeInTheDocument(); - expect(screen.getByText("This release exposes the MCP server over local stdio. It does not publish an HTTP MCP endpoint.")).toBeInTheDocument(); - expect(screen.getByText(/\"command\": \"gab\"/)).toBeInTheDocument(); + expect(screen.getByText("https://bridge.example.com/ops/api/mcp")).toBeInTheDocument(); + expect(screen.queryByText(/Set GITHUB_AGENT_BRIDGE_DASHBOARD_PUBLIC_URL/)).not.toBeInTheDocument(); + expect(screen.getByText("Remote agents connect directly with a bearer token; no local `gab` binary is required on the agent host.")).toBeInTheDocument(); + expect(screen.getByText(/\"url\": \"https:\/\/bridge.example.com\/ops\/api\/mcp\"/)).toBeInTheDocument(); + expect(screen.getByText(/\"Authorization\": \"Bearer/)).toBeInTheDocument(); + expect(screen.queryByText("Local fallback")).not.toBeInTheDocument(); + expect(screen.queryByText(/mcp-serve/)).not.toBeInTheDocument(); await user.type(screen.getByLabelText("Token name"), "local agent"); await user.click(screen.getByRole("button", { name: "Create token" })); @@ -206,6 +213,7 @@ describe("MCP access page", () => { error={null} user={{ login: "reader", avatar_url: "", html_url: "https://github.com/reader", is_admin: false }} dashboardUrl="https://bridge.example.com" + dashboardUrlSource="configured" now={Date.parse("2026-06-23T11:05:00Z")} onCreate={vi.fn()} onRevoke={vi.fn()} @@ -216,6 +224,30 @@ describe("MCP access page", () => { expect(screen.getByText("Admin access is required to manage MCP tokens.")).toBeInTheDocument(); expect(screen.queryByRole("button", { name: "Create token" })).not.toBeInTheDocument(); }); + + it("requires a configured public URL before showing a remote MCP endpoint", () => { + render( + , + ); + + expect(screen.getByText("Needs public URL")).toBeInTheDocument(); + expect(screen.getByText("Set GITHUB_AGENT_BRIDGE_DASHBOARD_PUBLIC_URL or forward X-Forwarded-* headers")).toBeInTheDocument(); + expect(screen.getByText("Public dashboard URL required before connecting remote agents")).toBeInTheDocument(); + expect(screen.queryByText("http://127.0.0.1:8765/mcp")).not.toBeInTheDocument(); + expect(screen.queryByText("http://127.0.0.1:8765/api/mcp")).not.toBeInTheDocument(); + expect(screen.getByText(/\"url\": \"https:\/\/bridge.example.com\/api\/mcp\"/)).toBeInTheDocument(); + }); }); describe("status badges", () => { diff --git a/dashboard/src/main.tsx b/dashboard/src/main.tsx index 6f6c51c..cd47da4 100644 --- a/dashboard/src/main.tsx +++ b/dashboard/src/main.tsx @@ -51,6 +51,7 @@ type DashboardStatus = { service: string; read_only: boolean; dashboard_url?: string; + dashboard_url_source?: "configured" | "forwarded" | "request"; admin_actions: string[]; autoupdate: AutoupdateState; metrics?: { @@ -934,6 +935,7 @@ function App() { error={mcpTokens.error} user={me.data?.user} dashboardUrl={dashboardStatus.data?.dashboard_url} + dashboardUrlSource={dashboardStatus.data?.dashboard_url_source} now={now} onCreate={createMcpToken} onRevoke={revokeMcpToken} @@ -1831,6 +1833,7 @@ function McpPage({ error, user, dashboardUrl, + dashboardUrlSource, now, onCreate, onRevoke, @@ -1841,6 +1844,7 @@ function McpPage({ error: Error | null; user: UserProfile | undefined; dashboardUrl?: string; + dashboardUrlSource?: "configured" | "forwarded" | "request"; now: number; onCreate: (name: string) => Promise; onRevoke: (tokenId: string) => Promise; @@ -1852,21 +1856,23 @@ function McpPage({ const [createdToken, setCreatedToken] = React.useState(null); const [actionError, setActionError] = React.useState(""); const activeTokens = tokens ?? []; - const mcpDashboardUrl = `${(dashboardUrl || (typeof window === "undefined" ? "" : window.location.origin)).replace(/\/$/, "")}/mcp`; + const publicBaseUrl = (dashboardUrl || (typeof window === "undefined" ? "" : window.location.origin)).replace(/\/$/, ""); + const mcpDashboardUrl = `${publicBaseUrl}/mcp`; + const mcpEndpointUrl = `${publicBaseUrl}/api/mcp`; if (user && !user.is_admin) { return (
- } title="MCP access" subtitle="Read-only local-agent access is limited to dashboard admins." action={} /> + } title="MCP access" subtitle="Read-only agent access is limited to dashboard admins." action={} />
); } return (
- } title="MCP access" subtitle="Issue and revoke read-only tokens for local agents." action={} /> + } title="MCP access" subtitle="Issue and revoke read-only tokens for agents." action={} /> {error ? : null} {actionError ? : null} - + {createdToken ? (
@@ -1929,37 +1935,45 @@ function McpPage({ ); } -function McpSetupGuide({ dashboardUrl }: { dashboardUrl: string }) { +function McpSetupGuide({ dashboardUrl, endpointUrl, dashboardUrlSource }: { dashboardUrl: string; endpointUrl: string; dashboardUrlSource: "configured" | "forwarded" | "request" }) { + const sourceLabel = dashboardUrlSource === "configured" ? "Configured public URL" : dashboardUrlSource === "forwarded" ? "Forwarded public URL" : "Needs public URL"; + const needsPublicUrlConfig = dashboardUrlSource === "request"; + const displayDashboardUrl = needsPublicUrlConfig ? "Set GITHUB_AGENT_BRIDGE_DASHBOARD_PUBLIC_URL or forward X-Forwarded-* headers" : dashboardUrl; + const displayEndpointUrl = needsPublicUrlConfig ? "Public dashboard URL required before connecting remote agents" : endpointUrl; + const configEndpointUrl = needsPublicUrlConfig ? "https://bridge.example.com/api/mcp" : endpointUrl; const agentConfig = `{ "mcpServers": { "github-agent-bridge": { - "command": "gab", - "args": ["--db", "~/.local/state/github-agent-bridge/bridge.sqlite3", "mcp-serve"], - "env": { - "GITHUB_AGENT_BRIDGE_MCP_TOKEN": "gab_mcp_..." + "url": "${configEndpointUrl}", + "headers": { + "Authorization": "Bearer \${GITHUB_AGENT_BRIDGE_MCP_TOKEN}" } } } }`; return ( + {needsPublicUrlConfig ? ( + + ) : null}
-
+
Public dashboard URL + {sourceLabel}
-

Share this proxy-aware page URL with bridge admins who need to issue or revoke MCP tokens.

-
{dashboardUrl}
+

Share this page URL with bridge admins only after it resolves to the external dashboard origin.

+
{displayDashboardUrl}
- - Transport + + HTTP MCP endpoint
-

This release exposes the MCP server over local stdio. It does not publish an HTTP MCP endpoint.

-
gab --db ~/.local/state/github-agent-bridge/bridge.sqlite3 mcp-serve
+

Remote agents connect directly with a bearer token; no local `gab` binary is required on the agent host.

+
{displayEndpointUrl}
@@ -1968,7 +1982,7 @@ function McpSetupGuide({ dashboardUrl }: { dashboardUrl: string }) { Agent config
-

Create a token below, then store the one-time secret in the agent environment.

+

Create a token below, then store the one-time secret as `GITHUB_AGENT_BRIDGE_MCP_TOKEN` for the agent.

{agentConfig}
@@ -3318,8 +3332,8 @@ function EmptyState({ text }: { text: string }) { return
{text}
; } -function Banner({ tone, text }: { tone: "error"; text: string }) { - return
{text}
; +function Banner({ tone, text }: { tone: "error" | "warning"; text: string }) { + return
{text}
; } function RefreshButton({ onClick, compactOnMobile = false }: { onClick: () => void; compactOnMobile?: boolean }) { diff --git a/docs/README.md b/docs/README.md index 1800fc7..252b9af 100644 --- a/docs/README.md +++ b/docs/README.md @@ -13,7 +13,7 @@ A compact map of the `github-agent-bridge` documentation set. | Roll out safely | [`shadow-canary.md`](shadow-canary.md) | How-to | | Operate production | [`operations.md`](operations.md) | How-to | | Configure dashboard GitHub OAuth | [`dashboard-github-oauth.md`](dashboard-github-oauth.md) | How-to | -| Expose bridge knowledge to local agents | [`mcp.md`](mcp.md) | How-to | +| Expose bridge knowledge to agents | [`mcp.md`](mcp.md) | How-to | | Develop the bridge | [`development.md`](development.md) | How-to | | Diagnose known failures | [`failure-modes.md`](failure-modes.md) | Reference | | Understand release automation | [`releases.md`](releases.md) | Reference | diff --git a/docs/mcp.md b/docs/mcp.md index 5b8ca6f..dbd4d6a 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -1,7 +1,8 @@ # MCP server -`github-agent-bridge` includes a stdio MCP server for local agents that need -read-only access to acquired bridge knowledge. +`github-agent-bridge` includes an authenticated read-only MCP server for agents +that need access to acquired bridge knowledge. The dashboard exposes the server +over HTTP so agents can connect without installing or launching `gab`. ## Create a token @@ -31,23 +32,41 @@ Dashboard admins can manage the same records through: - `POST /api/mcp/tokens` - `DELETE /api/mcp/tokens/{token_id}` -The dashboard MCP page shows a public dashboard URL for sharing this token -management page with admins. Behind a reverse proxy, set +The dashboard MCP page shows both a public dashboard URL for token management +and the public MCP endpoint URL. Behind a reverse proxy, set `GITHUB_AGENT_BRIDGE_DASHBOARD_PUBLIC_URL` to the external origin, for example `https://bridge.example.com`. If that variable is unset, the dashboard derives the origin from `X-Forwarded-Proto`, `X-Forwarded-Host`, and `X-Forwarded-Prefix` when the proxy sends them. -## Run the server +## Connect over HTTP -Configure the local MCP client to launch: +Remote agents should connect to the dashboard endpoint: -```bash -gab --db ~/.local/state/github-agent-bridge/bridge.sqlite3 mcp-serve +```text +https://bridge.example.com/api/mcp ``` -`mcp-serve` rejects startup unless `GITHUB_AGENT_BRIDGE_MCP_TOKEN` or -`--token` matches an active token in the bridge database. +Authenticate every MCP request with: + +```text +Authorization: Bearer gab_mcp_... +``` + +For clients that accept JSON MCP server config: + +```json +{ + "mcpServers": { + "github-agent-bridge": { + "url": "https://bridge.example.com/api/mcp", + "headers": { + "Authorization": "Bearer ${GITHUB_AGENT_BRIDGE_MCP_TOKEN}" + } + } + } +} +``` ## Exposed capabilities diff --git a/src/github_agent_bridge/backend.py b/src/github_agent_bridge/backend.py index a08bec9..e8451f4 100644 --- a/src/github_agent_bridge/backend.py +++ b/src/github_agent_bridge/backend.py @@ -47,7 +47,7 @@ transcript_entry_from_session_event, ) from .monitor import monitor -from .mcp import create_token, list_tokens, revoke_token +from .mcp import MCPServer, authenticate_token, create_token, list_tokens, revoke_token from .observability import configure_sentry, list_alerts, recent_process_samples from .queue import JobQueue from .systemd_status import allowed_unit_names, stream_journal_lines, systemd_status @@ -166,19 +166,25 @@ def _redacted_headers() -> dict[str, str]: def _dashboard_public_url(request: Request) -> str: + url, _ = _dashboard_public_url_with_source(request) + return url + + +def _dashboard_public_url_with_source(request: Request) -> tuple[str, str]: cfg: DashboardConfig = request.app.state.dashboard_config if cfg.public_url: - return cfg.public_url + return cfg.public_url, "configured" forwarded_host = request.headers.get("x-forwarded-host", "").split(",", 1)[0].strip() host = forwarded_host or request.headers.get("host", "").strip() if not host: - return str(request.base_url).rstrip("/") + return str(request.base_url).rstrip("/"), "request" forwarded_proto = request.headers.get("x-forwarded-proto", "").split(",", 1)[0].strip() scheme = forwarded_proto or request.url.scheme forwarded_prefix = request.headers.get("x-forwarded-prefix", "").split(",", 1)[0].strip().rstrip("/") - return f"{scheme}://{host}{forwarded_prefix}" + source = "forwarded" if forwarded_host or forwarded_proto or forwarded_prefix else "request" + return f"{scheme}://{host}{forwarded_prefix}", source def _sse_headers() -> dict[str, str]: @@ -199,6 +205,14 @@ def _transcript_sse_key(entry: dict[str, Any]) -> str: return json.dumps(entry, ensure_ascii=False, sort_keys=True, separators=(",", ":")) +def _bearer_token(request: Request) -> str: + authorization = request.headers.get("authorization", "") + scheme, _, token = authorization.partition(" ") + if scheme.lower() != "bearer" or not token.strip(): + raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="mcp_token_required") + return token.strip() + + async def _session_stream_events(db: str | Path, job_id: int, *, after_id: int | None = None, sleep_seconds: float = 2.0): last_id = after_id or 0 sent_transcript_keys: set[str] = set() @@ -466,6 +480,7 @@ async def dashboard_system(system_path: str, request: Request) -> Response: @app.get("/api/status") def api_status(request: Request, profile: dict[str, Any] = Depends(current_profile)) -> dict[str, Any]: queue = JobQueue(config.db) + dashboard_url, dashboard_url_source = _dashboard_public_url_with_source(request) admin_actions = [ "retry_job", "dismiss_job", @@ -481,7 +496,8 @@ def api_status(request: Request, profile: dict[str, Any] = Depends(current_profi return { "service": "github-agent-bridge-dashboard", "read_only": False, - "dashboard_url": _dashboard_public_url(request), + "dashboard_url": dashboard_url, + "dashboard_url_source": dashboard_url_source, "admin_actions": admin_actions, "metrics": inspect_db_read_only(config.db), "autoupdate": load_update_state(queue) if profile.get("is_admin") else {}, @@ -759,6 +775,23 @@ def api_mcp_token_revoke(token_id: str, _: dict[str, Any] = Depends(current_admi raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="mcp_token_not_found") return {"detail": "mcp_token_revoked"} + @app.post("/api/mcp") + @app.post("/api/mcp/") + async def api_mcp_http(request: Request) -> Response: + if authenticate_token(config.db, _bearer_token(request)) is None: + raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="invalid_mcp_token") + try: + payload = await request.json() + except json.JSONDecodeError as exc: + raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="invalid_json") from exc + if not isinstance(payload, dict): + raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="mcp_request_must_be_object") + + response = MCPServer(config.db).handle(payload) + if response is None: + return Response(status_code=status.HTTP_202_ACCEPTED, headers=_redacted_headers()) + return JSONResponse(response, headers=_redacted_headers()) + @app.get("/api/events/stream") def api_events(_: str = Depends(current_user)) -> Response: return Response("event: ready\ndata: {}\n\n", media_type="text/event-stream", headers=_sse_headers()) diff --git a/src/github_agent_bridge/dashboard_static/assets/index-CO4L0W2l.js b/src/github_agent_bridge/dashboard_static/assets/index-CO4L0W2l.js new file mode 100644 index 0000000..3fd0c93 --- /dev/null +++ b/src/github_agent_bridge/dashboard_static/assets/index-CO4L0W2l.js @@ -0,0 +1,172 @@ +var os=e=>{throw TypeError(e)};var Ir=(e,t,n)=>t.has(e)||os("Cannot "+n);var g=(e,t,n)=>(Ir(e,t,"read from private field"),n?n.call(e):t.get(e)),B=(e,t,n)=>t.has(e)?os("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),M=(e,t,n,r)=>(Ir(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),J=(e,t,n)=>(Ir(e,t,"access private method"),n);var nr=(e,t,n,r)=>({set _(i){M(e,t,i,n)},get _(){return g(e,t,r)}});import{e as Ko,f as Vo,g as Ni,r as ge,R as z,c as yr,a as Si,C as wr,X as vr,Y as kr,T as jr,B as Ci,d as Go,b as Jo,L as Wo}from"./charts-DRWoArYU.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var Tr={exports:{}},gn={};/** + * @license React + * react-jsx-runtime.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var ls;function Xo(){if(ls)return gn;ls=1;var e=Ko(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(l,u,c){var d,h={},f=null,p=null;c!==void 0&&(f=""+c),u.key!==void 0&&(f=""+u.key),u.ref!==void 0&&(p=u.ref);for(d in u)r.call(u,d)&&!s.hasOwnProperty(d)&&(h[d]=u[d]);if(l&&l.defaultProps)for(d in u=l.defaultProps,u)h[d]===void 0&&(h[d]=u[d]);return{$$typeof:t,type:l,key:f,ref:p,props:h,_owner:i.current}}return gn.Fragment=n,gn.jsx=o,gn.jsxs=o,gn}var us;function Yo(){return us||(us=1,Tr.exports=Xo()),Tr.exports}var a=Yo(),rr={},cs;function Zo(){if(cs)return rr;cs=1;var e=Vo();return rr.createRoot=e.createRoot,rr.hydrateRoot=e.hydrateRoot,rr}var el=Zo();const tl=Ni(el);var Un=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(){}},Lt,bt,Xt,ba,nl=(ba=class extends Un{constructor(){super();B(this,Lt);B(this,bt);B(this,Xt);M(this,Xt,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){g(this,bt)||this.setEventListener(g(this,Xt))}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,bt))==null||t.call(this),M(this,bt,void 0))}setEventListener(t){var n;M(this,Xt,t),(n=g(this,bt))==null||n.call(this),M(this,bt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){g(this,Lt)!==t&&(M(this,Lt,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof g(this,Lt)=="boolean"?g(this,Lt):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Lt=new WeakMap,bt=new WeakMap,Xt=new WeakMap,ba),Ei=new nl,rl={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},yt,ji,ya,il=(ya=class{constructor(){B(this,yt,rl);B(this,ji,!1)}setTimeoutProvider(e){M(this,yt,e)}setTimeout(e,t){return g(this,yt).setTimeout(e,t)}clearTimeout(e){g(this,yt).clearTimeout(e)}setInterval(e,t){return g(this,yt).setInterval(e,t)}clearInterval(e){g(this,yt).clearInterval(e)}},yt=new WeakMap,ji=new WeakMap,ya),Mt=new il;function sl(e){setTimeout(e,0)}var al=typeof window>"u"||"Deno"in globalThis;function Re(){}function ol(e,t){return typeof e=="function"?e(t):e}function Wr(e){return typeof e=="number"&&e>=0&&e!==1/0}function _a(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Et(e,t){return typeof e=="function"?e(t):e}function Oe(e,t){return typeof e=="function"?e(t):e}function ds(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:l}=e;if(o){if(r){if(t.queryHash!==_i(o,t.options))return!1}else if(!Tn(t.queryKey,o))return!1}if(n!=="all"){const u=t.isActive();if(n==="active"&&!u||n==="inactive"&&u)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||i&&i!==t.state.fetchStatus||s&&!s(t))}function hs(e,t){const{exact:n,status:r,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(In(t.options.mutationKey)!==In(s))return!1}else if(!Tn(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function _i(e,t){return((t==null?void 0:t.queryKeyHashFn)||In)(e)}function In(e){return JSON.stringify(e,(t,n)=>Yr(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Tn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Tn(e[n],t[n])):!1}var ll=Object.prototype.hasOwnProperty;function Pa(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=ps(e)&&ps(t);if(!r&&!(Yr(e)&&Yr(t)))return t;const s=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),l=o.length,u=r?new Array(l):{};let c=0;for(let d=0;d{Mt.setTimeout(t,e)})}function Zr(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Pa(e,t):t}function cl(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function dl(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Pi=Symbol();function Ra(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Pi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ia(e,t){return typeof e=="function"?e(...t):!!e}function hl(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??(i=t()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),e}var An=(()=>{let e=()=>al;return{isServer(){return e()},setIsServer(t){e=t}}})();function ei(){let e,t;const n=new Promise((i,s)=>{e=i,t=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}var pl=sl;function fl(){let e=[],t=0,n=l=>{l()},r=l=>{l()},i=pl;const s=l=>{t?e.push(l):i(()=>{n(l)})},o=()=>{const l=e;e=[],l.length&&i(()=>{r(()=>{l.forEach(u=>{n(u)})})})};return{batch:l=>{let u;t++;try{u=l()}finally{t--,t||o()}return u},batchCalls:l=>(...u)=>{s(()=>{l(...u)})},schedule:s,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{i=l}}}var xe=fl(),Yt,wt,Zt,wa,ml=(wa=class extends Un{constructor(){super();B(this,Yt,!0);B(this,wt);B(this,Zt);M(this,Zt,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){g(this,wt)||this.setEventListener(g(this,Zt))}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,wt))==null||t.call(this),M(this,wt,void 0))}setEventListener(t){var n;M(this,Zt,t),(n=g(this,wt))==null||n.call(this),M(this,wt,t(this.setOnline.bind(this)))}setOnline(t){g(this,Yt)!==t&&(M(this,Yt,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return g(this,Yt)}},Yt=new WeakMap,wt=new WeakMap,Zt=new WeakMap,wa),hr=new ml;function xl(e){return Math.min(1e3*2**e,3e4)}function Ta(e){return(e??"online")==="online"?hr.isOnline():!0}var ti=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Aa(e){let t=!1,n=0,r;const i=ei(),s=()=>i.status!=="pending",o=w=>{var k;if(!s()){const b=new ti(w);f(b),(k=e.onCancel)==null||k.call(e,b)}},l=()=>{t=!0},u=()=>{t=!1},c=()=>Ei.isFocused()&&(e.networkMode==="always"||hr.isOnline())&&e.canRun(),d=()=>Ta(e.networkMode)&&e.canRun(),h=w=>{s()||(r==null||r(),i.resolve(w))},f=w=>{s()||(r==null||r(),i.reject(w))},p=()=>new Promise(w=>{var k;r=b=>{(s()||c())&&w(b)},(k=e.onPause)==null||k.call(e)}).then(()=>{var w;r=void 0,s()||(w=e.onContinue)==null||w.call(e)}),y=()=>{if(s())return;let w;const k=n===0?e.initialPromise:void 0;try{w=k??e.fn()}catch(b){w=Promise.reject(b)}Promise.resolve(w).then(h).catch(b=>{var v;if(s())return;const S=e.retry??(An.isServer()?0:3),N=e.retryDelay??xl,C=typeof N=="function"?N(n,b):N,E=S===!0||typeof S=="number"&&nc()?void 0:p()).then(()=>{t?f(b):y()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:l,continueRetry:u,canStart:d,start:()=>(d()?y():p().then(y),i)}}var Ot,va,Ma=(va=class{constructor(){B(this,Ot)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Wr(this.gcTime)&&M(this,Ot,Mt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(An.isServer()?1/0:300*1e3))}clearGcTimeout(){g(this,Ot)!==void 0&&(Mt.clearTimeout(g(this,Ot)),M(this,Ot,void 0))}},Ot=new WeakMap,va);function gl(e){return{onFetch:(t,n)=>{var d,h,f,p,y;const r=t.options,i=(f=(h=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:f.direction,s=((p=t.state.data)==null?void 0:p.pages)||[],o=((y=t.state.data)==null?void 0:y.pageParams)||[];let l={pages:[],pageParams:[]},u=0;const c=async()=>{let w=!1;const k=N=>{hl(N,()=>t.signal,()=>w=!0)},b=Ra(t.options,t.fetchOptions),S=async(N,C,E)=>{if(w)return Promise.reject(t.signal.reason);if(C==null&&N.pages.length)return Promise.resolve(N);const F=(()=>{const L={client:t.client,queryKey:t.queryKey,pageParam:C,direction:E?"backward":"forward",meta:t.options.meta};return k(L),L})(),T=await b(F),{maxPages:A}=t.options,D=E?dl:cl;return{pages:D(N.pages,T,A),pageParams:D(N.pageParams,C,A)}};if(i&&s.length){const N=i==="backward",C=N?bl:ms,E={pages:s,pageParams:o},v=C(r,E);l=await S(E,v,N)}else{const N=e??s.length;do{const C=u===0?o[0]??r.initialPageParam:ms(r,l);if(u>0&&C==null)break;l=await S(l,C),u++}while(u{var w,k;return(k=(w=t.options).persister)==null?void 0:k.call(w,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function ms(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function bl(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var en,Ft,tn,qe,Dt,fe,Fn,zt,Le,La,at,ka,yl=(ka=class extends Ma{constructor(t){super();B(this,Le);B(this,en);B(this,Ft);B(this,tn);B(this,qe);B(this,Dt);B(this,fe);B(this,Fn);B(this,zt);M(this,zt,!1),M(this,Fn,t.defaultOptions),this.setOptions(t.options),this.observers=[],M(this,Dt,t.client),M(this,qe,g(this,Dt).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,M(this,Ft,gs(this.options)),this.state=t.state??g(this,Ft),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return g(this,en)}get promise(){var t;return(t=g(this,fe))==null?void 0:t.promise}setOptions(t){if(this.options={...g(this,Fn),...t},t!=null&&t._type&&M(this,en,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=gs(this.options);n.data!==void 0&&(this.setState(xs(n.data,n.dataUpdatedAt)),M(this,Ft,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&g(this,qe).remove(this)}setData(t,n){const r=Zr(this.state.data,t,this.options);return J(this,Le,at).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){J(this,Le,at).call(this,{type:"setState",state:t})}cancel(t){var r,i;const n=(r=g(this,fe))==null?void 0:r.promise;return(i=g(this,fe))==null||i.cancel(t),n?n.then(Re).catch(Re):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return g(this,Ft)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Oe(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Pi||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Et(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!_a(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=g(this,fe))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=g(this,fe))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),g(this,qe).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(g(this,fe)&&(g(this,zt)||J(this,Le,La).call(this)?g(this,fe).cancel({revert:!0}):g(this,fe).cancelRetry()),this.scheduleGc()),g(this,qe).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||J(this,Le,at).call(this,{type:"invalidate"})}async fetch(t,n){var c,d,h,f,p,y,w,k,b,S,N;if(this.state.fetchStatus!=="idle"&&((c=g(this,fe))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(g(this,fe))return g(this,fe).continueRetry(),g(this,fe).promise}if(t&&this.setOptions(t),!this.options.queryFn){const C=this.observers.find(E=>E.options.queryFn);C&&this.setOptions(C.options)}const r=new AbortController,i=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(M(this,zt,!0),r.signal)})},s=()=>{const C=Ra(this.options,n),v=(()=>{const F={client:g(this,Dt),queryKey:this.queryKey,meta:this.meta};return i(F),F})();return M(this,zt,!1),this.options.persister?this.options.persister(C,v,this):C(v)},l=(()=>{const C={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:g(this,Dt),state:this.state,fetchFn:s};return i(C),C})(),u=g(this,en)==="infinite"?gl(this.options.pages):this.options.behavior;u==null||u.onFetch(l,this),M(this,tn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=l.fetchOptions)==null?void 0:d.meta))&&J(this,Le,at).call(this,{type:"fetch",meta:(h=l.fetchOptions)==null?void 0:h.meta}),M(this,fe,Aa({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,onCancel:C=>{C instanceof ti&&C.revert&&this.setState({...g(this,tn),fetchStatus:"idle"}),r.abort()},onFail:(C,E)=>{J(this,Le,at).call(this,{type:"failed",failureCount:C,error:E})},onPause:()=>{J(this,Le,at).call(this,{type:"pause"})},onContinue:()=>{J(this,Le,at).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const C=await g(this,fe).start();if(C===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(C),(p=(f=g(this,qe).config).onSuccess)==null||p.call(f,C,this),(w=(y=g(this,qe).config).onSettled)==null||w.call(y,C,this.state.error,this),C}catch(C){if(C instanceof ti){if(C.silent)return g(this,fe).promise;if(C.revert){if(this.state.data===void 0)throw C;return this.state.data}}throw J(this,Le,at).call(this,{type:"error",error:C}),(b=(k=g(this,qe).config).onError)==null||b.call(k,C,this),(N=(S=g(this,qe).config).onSettled)==null||N.call(S,this.state.data,C,this),C}finally{this.scheduleGc()}}},en=new WeakMap,Ft=new WeakMap,tn=new WeakMap,qe=new WeakMap,Dt=new WeakMap,fe=new WeakMap,Fn=new WeakMap,zt=new WeakMap,Le=new WeakSet,La=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},at=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Oa(r.data,this.options),fetchMeta:t.meta??null};case"success":const i={...r,...xs(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return M(this,tn,t.manual?i:void 0),i;case"error":const s=t.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),xe.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),g(this,qe).notify({query:this,type:"updated",action:t})})},ka);function Oa(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ta(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function xs(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function gs(e){const 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 Pe,W,Dn,je,Bt,nn,ot,vt,zn,rn,sn,qt,Ut,kt,an,ee,Nn,ni,ri,ii,si,ai,oi,li,Fa,ja,wl=(ja=class extends Un{constructor(t,n){super();B(this,ee);B(this,Pe);B(this,W);B(this,Dn);B(this,je);B(this,Bt);B(this,nn);B(this,ot);B(this,vt);B(this,zn);B(this,rn);B(this,sn);B(this,qt);B(this,Ut);B(this,kt);B(this,an,new Set);this.options=n,M(this,Pe,t),M(this,vt,null),M(this,ot,ei()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(g(this,W).addObserver(this),bs(g(this,W),this.options)?J(this,ee,Nn).call(this):this.updateResult(),J(this,ee,si).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ui(g(this,W),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ui(g(this,W),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,J(this,ee,ai).call(this),J(this,ee,oi).call(this),g(this,W).removeObserver(this)}setOptions(t){const n=this.options,r=g(this,W);if(this.options=g(this,Pe).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Oe(this.options.enabled,g(this,W))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");J(this,ee,li).call(this),g(this,W).setOptions(this.options),n._defaulted&&!Xr(this.options,n)&&g(this,Pe).getQueryCache().notify({type:"observerOptionsUpdated",query:g(this,W),observer:this});const i=this.hasListeners();i&&ys(g(this,W),r,this.options,n)&&J(this,ee,Nn).call(this),this.updateResult(),i&&(g(this,W)!==r||Oe(this.options.enabled,g(this,W))!==Oe(n.enabled,g(this,W))||Et(this.options.staleTime,g(this,W))!==Et(n.staleTime,g(this,W)))&&J(this,ee,ni).call(this);const s=J(this,ee,ri).call(this);i&&(g(this,W)!==r||Oe(this.options.enabled,g(this,W))!==Oe(n.enabled,g(this,W))||s!==g(this,kt))&&J(this,ee,ii).call(this,s)}getOptimisticResult(t){const n=g(this,Pe).getQueryCache().build(g(this,Pe),t),r=this.createResult(n,t);return kl(this,r)&&(M(this,je,r),M(this,nn,this.options),M(this,Bt,g(this,W).state)),r}getCurrentResult(){return g(this,je)}trackResult(t,n){return new Proxy(t,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&g(this,ot).status==="pending"&&g(this,ot).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(t){g(this,an).add(t)}getCurrentQuery(){return g(this,W)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=g(this,Pe).defaultQueryOptions(t),r=g(this,Pe).getQueryCache().build(g(this,Pe),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return J(this,ee,Nn).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),g(this,je)))}createResult(t,n){var A;const r=g(this,W),i=this.options,s=g(this,je),o=g(this,Bt),l=g(this,nn),c=t!==r?t.state:g(this,Dn),{state:d}=t;let h={...d},f=!1,p;if(n._optimisticResults){const D=this.hasListeners(),L=!D&&bs(t,n),_=D&&ys(t,r,n,i);(L||_)&&(h={...h,...Oa(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:y,errorUpdatedAt:w,status:k}=h;p=h.data;let b=!1;if(n.placeholderData!==void 0&&p===void 0&&k==="pending"){let D;s!=null&&s.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(D=s.data,b=!0):D=typeof n.placeholderData=="function"?n.placeholderData((A=g(this,sn))==null?void 0:A.state.data,g(this,sn)):n.placeholderData,D!==void 0&&(k="success",p=Zr(s==null?void 0:s.data,D,n),f=!0)}if(n.select&&p!==void 0&&!b)if(s&&p===(o==null?void 0:o.data)&&n.select===g(this,zn))p=g(this,rn);else try{M(this,zn,n.select),p=n.select(p),p=Zr(s==null?void 0:s.data,p,n),M(this,rn,p),M(this,vt,null)}catch(D){M(this,vt,D)}g(this,vt)&&(y=g(this,vt),p=g(this,rn),w=Date.now(),k="error");const S=h.fetchStatus==="fetching",N=k==="pending",C=k==="error",E=N&&S,v=p!==void 0,T={status:k,fetchStatus:h.fetchStatus,isPending:N,isSuccess:k==="success",isError:C,isInitialLoading:E,isLoading:E,data:p,dataUpdatedAt:h.dataUpdatedAt,error:y,errorUpdatedAt:w,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:h.dataUpdateCount>c.dataUpdateCount||h.errorUpdateCount>c.errorUpdateCount,isFetching:S,isRefetching:S&&!N,isLoadingError:C&&!v,isPaused:h.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:C&&v,isStale:Ri(t,n),refetch:this.refetch,promise:g(this,ot),isEnabled:Oe(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const D=T.data!==void 0,L=T.status==="error"&&!D,_=R=>{L?R.reject(T.error):D&&R.resolve(T.data)},K=()=>{const R=M(this,ot,T.promise=ei());_(R)},O=g(this,ot);switch(O.status){case"pending":t.queryHash===r.queryHash&&_(O);break;case"fulfilled":(L||T.data!==O.value)&&K();break;case"rejected":(!L||T.error!==O.reason)&&K();break}}return T}updateResult(){const t=g(this,je),n=this.createResult(g(this,W),this.options);if(M(this,Bt,g(this,W).state),M(this,nn,this.options),g(this,Bt).data!==void 0&&M(this,sn,g(this,W)),Xr(n,t))return;M(this,je,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!g(this,an).size)return!0;const o=new Set(s??g(this,an));return this.options.throwOnError&&o.add("error"),Object.keys(g(this,je)).some(l=>{const u=l;return g(this,je)[u]!==t[u]&&o.has(u)})};J(this,ee,Fa).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&J(this,ee,si).call(this)}},Pe=new WeakMap,W=new WeakMap,Dn=new WeakMap,je=new WeakMap,Bt=new WeakMap,nn=new WeakMap,ot=new WeakMap,vt=new WeakMap,zn=new WeakMap,rn=new WeakMap,sn=new WeakMap,qt=new WeakMap,Ut=new WeakMap,kt=new WeakMap,an=new WeakMap,ee=new WeakSet,Nn=function(t){J(this,ee,li).call(this);let n=g(this,W).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Re)),n},ni=function(){J(this,ee,ai).call(this);const t=Et(this.options.staleTime,g(this,W));if(An.isServer()||g(this,je).isStale||!Wr(t))return;const r=_a(g(this,je).dataUpdatedAt,t)+1;M(this,qt,Mt.setTimeout(()=>{g(this,je).isStale||this.updateResult()},r))},ri=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(g(this,W)):this.options.refetchInterval)??!1},ii=function(t){J(this,ee,oi).call(this),M(this,kt,t),!(An.isServer()||Oe(this.options.enabled,g(this,W))===!1||!Wr(g(this,kt))||g(this,kt)===0)&&M(this,Ut,Mt.setInterval(()=>{(this.options.refetchIntervalInBackground||Ei.isFocused())&&J(this,ee,Nn).call(this)},g(this,kt)))},si=function(){J(this,ee,ni).call(this),J(this,ee,ii).call(this,J(this,ee,ri).call(this))},ai=function(){g(this,qt)!==void 0&&(Mt.clearTimeout(g(this,qt)),M(this,qt,void 0))},oi=function(){g(this,Ut)!==void 0&&(Mt.clearInterval(g(this,Ut)),M(this,Ut,void 0))},li=function(){const t=g(this,Pe).getQueryCache().build(g(this,Pe),this.options);if(t===g(this,W))return;const n=g(this,W);M(this,W,t),M(this,Dn,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Fa=function(t){xe.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(g(this,je))}),g(this,Pe).getQueryCache().notify({query:g(this,W),type:"observerResultsUpdated"})})},ja);function vl(e,t){return Oe(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Oe(t.retryOnMount,e)===!1)}function bs(e,t){return vl(e,t)||e.state.data!==void 0&&ui(e,t,t.refetchOnMount)}function ui(e,t,n){if(Oe(t.enabled,e)!==!1&&Et(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Ri(e,t)}return!1}function ys(e,t,n,r){return(e!==t||Oe(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Ri(e,n)}function Ri(e,t){return Oe(t.enabled,e)!==!1&&e.isStaleByTime(Et(t.staleTime,e))}function kl(e,t){return!Xr(e.getCurrentResult(),t)}var Bn,Xe,ye,$t,Ye,gt,Na,jl=(Na=class extends Ma{constructor(t){super();B(this,Ye);B(this,Bn);B(this,Xe);B(this,ye);B(this,$t);M(this,Bn,t.client),this.mutationId=t.mutationId,M(this,ye,t.mutationCache),M(this,Xe,[]),this.state=t.state||Nl(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){g(this,Xe).includes(t)||(g(this,Xe).push(t),this.clearGcTimeout(),g(this,ye).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){M(this,Xe,g(this,Xe).filter(n=>n!==t)),this.scheduleGc(),g(this,ye).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){g(this,Xe).length||(this.state.status==="pending"?this.scheduleGc():g(this,ye).remove(this))}continue(){var t;return((t=g(this,$t))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,u,c,d,h,f,p,y,w,k,b,S,N,C,E,v,F;const n=()=>{J(this,Ye,gt).call(this,{type:"continue"})},r={client:g(this,Bn),meta:this.options.meta,mutationKey:this.options.mutationKey};M(this,$t,Aa({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(T,A)=>{J(this,Ye,gt).call(this,{type:"failed",failureCount:T,error:A})},onPause:()=>{J(this,Ye,gt).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>g(this,ye).canRun(this)}));const i=this.state.status==="pending",s=!g(this,$t).canStart();try{if(i)n();else{J(this,Ye,gt).call(this,{type:"pending",variables:t,isPaused:s}),g(this,ye).config.onMutate&&await g(this,ye).config.onMutate(t,this,r);const A=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t,r));A!==this.state.context&&J(this,Ye,gt).call(this,{type:"pending",context:A,variables:t,isPaused:s})}const T=await g(this,$t).start();return await((c=(u=g(this,ye).config).onSuccess)==null?void 0:c.call(u,T,t,this.state.context,this,r)),await((h=(d=this.options).onSuccess)==null?void 0:h.call(d,T,t,this.state.context,r)),await((p=(f=g(this,ye).config).onSettled)==null?void 0:p.call(f,T,null,this.state.variables,this.state.context,this,r)),await((w=(y=this.options).onSettled)==null?void 0:w.call(y,T,null,t,this.state.context,r)),J(this,Ye,gt).call(this,{type:"success",data:T}),T}catch(T){try{await((b=(k=g(this,ye).config).onError)==null?void 0:b.call(k,T,t,this.state.context,this,r))}catch(A){Promise.reject(A)}try{await((N=(S=this.options).onError)==null?void 0:N.call(S,T,t,this.state.context,r))}catch(A){Promise.reject(A)}try{await((E=(C=g(this,ye).config).onSettled)==null?void 0:E.call(C,void 0,T,this.state.variables,this.state.context,this,r))}catch(A){Promise.reject(A)}try{await((F=(v=this.options).onSettled)==null?void 0:F.call(v,void 0,T,t,this.state.context,r))}catch(A){Promise.reject(A)}throw J(this,Ye,gt).call(this,{type:"error",error:T}),T}finally{g(this,ye).runNext(this)}}},Bn=new WeakMap,Xe=new WeakMap,ye=new WeakMap,$t=new WeakMap,Ye=new WeakSet,gt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),xe.batch(()=>{g(this,Xe).forEach(r=>{r.onMutationUpdate(t)}),g(this,ye).notify({mutation:this,type:"updated",action:t})})},Na);function Nl(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var lt,Ke,qn,Sa,Sl=(Sa=class extends Un{constructor(t={}){super();B(this,lt);B(this,Ke);B(this,qn);this.config=t,M(this,lt,new Set),M(this,Ke,new Map),M(this,qn,0)}build(t,n,r){const i=new jl({client:t,mutationCache:this,mutationId:++nr(this,qn)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){g(this,lt).add(t);const n=ir(t);if(typeof n=="string"){const r=g(this,Ke).get(n);r?r.push(t):g(this,Ke).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(g(this,lt).delete(t)){const n=ir(t);if(typeof n=="string"){const r=g(this,Ke).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&g(this,Ke).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=ir(t);if(typeof n=="string"){const r=g(this,Ke).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r;const n=ir(t);if(typeof n=="string"){const i=(r=g(this,Ke).get(n))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){xe.batch(()=>{g(this,lt).forEach(t=>{this.notify({type:"removed",mutation:t})}),g(this,lt).clear(),g(this,Ke).clear()})}getAll(){return Array.from(g(this,lt))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>hs(n,r))}findAll(t={}){return this.getAll().filter(n=>hs(t,n))}notify(t){xe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return xe.batch(()=>Promise.all(t.map(n=>n.continue().catch(Re))))}},lt=new WeakMap,Ke=new WeakMap,qn=new WeakMap,Sa);function ir(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Ze,Ca,Cl=(Ca=class extends Un{constructor(t={}){super();B(this,Ze);this.config=t,M(this,Ze,new Map)}build(t,n,r){const i=n.queryKey,s=n.queryHash??_i(i,n);let o=this.get(s);return o||(o=new yl({client:t,queryKey:i,queryHash:s,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(o)),o}add(t){g(this,Ze).has(t.queryHash)||(g(this,Ze).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=g(this,Ze).get(t.queryHash);n&&(t.destroy(),n===t&&g(this,Ze).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){xe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return g(this,Ze).get(t)}getAll(){return[...g(this,Ze).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>ds(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>ds(t,r)):n}notify(t){xe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){xe.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){xe.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ze=new WeakMap,Ca),ue,jt,Nt,on,ln,St,un,cn,Ea,El=(Ea=class{constructor(e={}){B(this,ue);B(this,jt);B(this,Nt);B(this,on);B(this,ln);B(this,St);B(this,un);B(this,cn);M(this,ue,e.queryCache||new Cl),M(this,jt,e.mutationCache||new Sl),M(this,Nt,e.defaultOptions||{}),M(this,on,new Map),M(this,ln,new Map),M(this,St,0)}mount(){nr(this,St)._++,g(this,St)===1&&(M(this,un,Ei.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,ue).onFocus())})),M(this,cn,hr.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,ue).onOnline())})))}unmount(){var e,t;nr(this,St)._--,g(this,St)===0&&((e=g(this,un))==null||e.call(this),M(this,un,void 0),(t=g(this,cn))==null||t.call(this),M(this,cn,void 0))}isFetching(e){return g(this,ue).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return g(this,jt).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=g(this,ue).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=g(this,ue).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Et(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return g(this,ue).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=g(this,ue).get(r.queryHash),s=i==null?void 0:i.state.data,o=ol(t,s);if(o!==void 0)return g(this,ue).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return xe.batch(()=>g(this,ue).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=g(this,ue).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=g(this,ue);xe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=g(this,ue);return xe.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=xe.batch(()=>g(this,ue).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(Re).catch(Re)}invalidateQueries(e,t={}){return xe.batch(()=>(g(this,ue).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=xe.batch(()=>g(this,ue).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Re)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Re)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=g(this,ue).build(this,t);return n.isStaleByTime(Et(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Re).catch(Re)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Re).catch(Re)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return hr.isOnline()?g(this,jt).resumePausedMutations():Promise.resolve()}getQueryCache(){return g(this,ue)}getMutationCache(){return g(this,jt)}getDefaultOptions(){return g(this,Nt)}setDefaultOptions(e){M(this,Nt,e)}setQueryDefaults(e,t){g(this,on).set(In(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...g(this,on).values()],n={};return t.forEach(r=>{Tn(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){g(this,ln).set(In(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...g(this,ln).values()],n={};return t.forEach(r=>{Tn(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...g(this,Nt).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=_i(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===Pi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...g(this,Nt).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){g(this,ue).clear(),g(this,jt).clear()}},ue=new WeakMap,jt=new WeakMap,Nt=new WeakMap,on=new WeakMap,ln=new WeakMap,St=new WeakMap,un=new WeakMap,cn=new WeakMap,Ea),Da=ge.createContext(void 0),za=e=>{const t=ge.useContext(Da);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},_l=({client:e,children:t})=>(ge.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(Da.Provider,{value:e,children:t})),Ba=ge.createContext(!1),Pl=()=>ge.useContext(Ba);Ba.Provider;function Rl(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Il=ge.createContext(Rl()),Tl=()=>ge.useContext(Il),Al=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Ia(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Ml=e=>{ge.useEffect(()=>{e.clearReset()},[e])},Ll=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Ia(n,[e.error,r])),Ol=e=>{if(e.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Fl=(e,t)=>e.isLoading&&e.isFetching&&!t,Dl=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,ws=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function zl(e,t,n){var f,p,y,w;const r=Pl(),i=Tl(),s=za(),o=s.defaultQueryOptions(e);(p=(f=s.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||p.call(f,o);const l=s.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",Ol(o),Al(o,i,l),Ml(i);const u=!s.getQueryCache().get(o.queryHash),[c]=ge.useState(()=>new t(s,o)),d=c.getOptimisticResult(o),h=!r&&e.subscribed!==!1;if(ge.useSyncExternalStore(ge.useCallback(k=>{const b=h?c.subscribe(xe.batchCalls(k)):Re;return c.updateResult(),b},[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),ge.useEffect(()=>{c.setOptions(o)},[o,c]),Dl(o,d))throw ws(o,c,i);if(Ll({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:l,suspense:o.suspense}))throw d.error;if((w=(y=s.getDefaultOptions().queries)==null?void 0:y._experimental_afterQuery)==null||w.call(y,o,d),o.experimental_prefetchInRender&&!An.isServer()&&Fl(d,r)){const k=u?ws(o,c,i):l==null?void 0:l.promise;k==null||k.catch(Re).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?d:c.trackResult(d)}function ke(e,t){return zl(e,wl)}/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Bl=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),qa=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var ql={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ul=ge.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...l},u)=>ge.createElement("svg",{ref:u,...ql,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:qa("lucide",i),...l},[...o.map(([c,d])=>ge.createElement(c,d)),...Array.isArray(s)?s:[s]]));/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oe=(e,t)=>{const n=ge.forwardRef(({className:r,...i},s)=>ge.createElement(Ul,{ref:s,iconNode:t,className:qa(`lucide-${Bl(e)}`,r),...i}));return n.displayName=`${e}`,n};/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ua=oe("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $l=oe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ii=oe("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $n=oe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dn=oe("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pr=oe("CircleUserRound",[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $a=oe("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vs=oe("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Mn=oe("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Hl=oe("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ql=oe("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Cn=oe("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Nr=oe("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Kl=oe("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ha=oe("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Sr=oe("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Vl=oe("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Gl=oe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Qa=oe("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ka=oe("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Jl=oe("TimerReset",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M12 14v-4",key:"1evpnu"}],["path",{d:"M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6",key:"1ts96g"}],["path",{d:"M9 17H4v5",key:"8t5av"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ci=oe("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ti=oe("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + * @license lucide-react v0.468.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Cr=oe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Wl(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Xl=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Yl=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Zl={};function ks(e,t){return(Zl.jsx?Yl:Xl).test(e)}const eu=/[ \t\n\f\r]/g;function tu(e){return typeof e=="object"?e.type==="text"?js(e.value):!1:js(e)}function js(e){return e.replace(eu,"")===""}class Hn{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Hn.prototype.normal={};Hn.prototype.property={};Hn.prototype.space=void 0;function Va(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Hn(n,r,t)}function di(e){return e.toLowerCase()}class Ae{constructor(t,n){this.attribute=n,this.property=t}}Ae.prototype.attribute="";Ae.prototype.booleanish=!1;Ae.prototype.boolean=!1;Ae.prototype.commaOrSpaceSeparated=!1;Ae.prototype.commaSeparated=!1;Ae.prototype.defined=!1;Ae.prototype.mustUseProperty=!1;Ae.prototype.number=!1;Ae.prototype.overloadedBoolean=!1;Ae.prototype.property="";Ae.prototype.spaceSeparated=!1;Ae.prototype.space=void 0;let nu=0;const $=Qt(),de=Qt(),hi=Qt(),P=Qt(),ne=Qt(),Ht=Qt(),Me=Qt();function Qt(){return 2**++nu}const pi=Object.freeze(Object.defineProperty({__proto__:null,boolean:$,booleanish:de,commaOrSpaceSeparated:Me,commaSeparated:Ht,number:P,overloadedBoolean:hi,spaceSeparated:ne},Symbol.toStringTag,{value:"Module"})),Ar=Object.keys(pi);class Ai extends Ae{constructor(t,n,r,i){let s=-1;if(super(t,n),Ns(this,"space",i),typeof r=="number")for(;++s4&&n.slice(0,4)==="data"&&ou.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Ss,cu);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Ss.test(s)){let o=s.replace(au,uu);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Ai}return new i(r,t)}function uu(e){return"-"+e.toLowerCase()}function cu(e){return e.charAt(1).toUpperCase()}const du=Va([Ga,ru,Xa,Ya,Za],"html"),Mi=Va([Ga,iu,Xa,Ya,Za],"svg");function hu(e){return e.join(" ").trim()}var Vt={},Mr,Cs;function pu(){if(Cs)return Mr;Cs=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g,u=` +`,c="/",d="*",h="",f="comment",p="declaration";function y(k,b){if(typeof k!="string")throw new TypeError("First argument must be a string");if(!k)return[];b=b||{};var S=1,N=1;function C(O){var R=O.match(t);R&&(S+=R.length);var V=O.lastIndexOf(u);N=~V?O.length-V:N+O.length}function E(){var O={line:S,column:N};return function(R){return R.position=new v(O),A(),R}}function v(O){this.start=O,this.end={line:S,column:N},this.source=b.source}v.prototype.content=k;function F(O){var R=new Error(b.source+":"+S+":"+N+": "+O);if(R.reason=O,R.filename=b.source,R.line=S,R.column=N,R.source=k,!b.silent)throw R}function T(O){var R=O.exec(k);if(R){var V=R[0];return C(V),k=k.slice(V.length),R}}function A(){T(n)}function D(O){var R;for(O=O||[];R=L();)R!==!1&&O.push(R);return O}function L(){var O=E();if(!(c!=k.charAt(0)||d!=k.charAt(1))){for(var R=2;h!=k.charAt(R)&&(d!=k.charAt(R)||c!=k.charAt(R+1));)++R;if(R+=2,h===k.charAt(R-1))return F("End of comment missing");var V=k.slice(2,R-2);return N+=2,C(V),k=k.slice(R),N+=2,O({type:f,comment:V})}}function _(){var O=E(),R=T(r);if(R){if(L(),!T(i))return F("property missing ':'");var V=T(s),te=O({type:p,property:w(R[0].replace(e,h)),value:V?w(V[0].replace(e,h)):h});return T(o),te}}function K(){var O=[];D(O);for(var R;R=_();)R!==!1&&(O.push(R),D(O));return O}return A(),K()}function w(k){return k?k.replace(l,h):h}return Mr=y,Mr}var Es;function fu(){if(Es)return Vt;Es=1;var e=Vt&&Vt.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.default=n;const t=e(pu());function n(r,i){let s=null;if(!r||typeof r!="string")return s;const o=(0,t.default)(r),l=typeof i=="function";return o.forEach(u=>{if(u.type!=="declaration")return;const{property:c,value:d}=u;l?i(c,d,u):d&&(s=s||{},s[c]=d)}),s}return Vt}var bn={},_s;function mu(){if(_s)return bn;_s=1,Object.defineProperty(bn,"__esModule",{value:!0}),bn.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(c){return!c||n.test(c)||e.test(c)},o=function(c,d){return d.toUpperCase()},l=function(c,d){return"".concat(d,"-")},u=function(c,d){return d===void 0&&(d={}),s(c)?c:(c=c.toLowerCase(),d.reactCompat?c=c.replace(i,l):c=c.replace(r,l),c.replace(t,o))};return bn.camelCase=u,bn}var yn,Ps;function xu(){if(Ps)return yn;Ps=1;var e=yn&&yn.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(fu()),n=mu();function r(i,s){var o={};return!i||typeof i!="string"||(0,t.default)(i,function(l,u){l&&u&&(o[(0,n.camelCase)(l,s)]=u)}),o}return r.default=r,yn=r,yn}var gu=xu();const bu=Ni(gu),eo=to("end"),Li=to("start");function to(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function yu(e){const t=Li(e),n=eo(e);if(t&&n)return{start:t,end:n}}function En(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Rs(e.position):"start"in e||"end"in e?Rs(e):"line"in e||"column"in e?fi(e):""}function fi(e){return Is(e&&e.line)+":"+Is(e&&e.column)}function Rs(e){return fi(e&&e.start)+"-"+fi(e&&e.end)}function Is(e){return e&&typeof e=="number"?e:1}class we extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?s.ruleId=r:(s.source=r.slice(0,u),s.ruleId=r.slice(u+1))}if(!s.place&&s.ancestors&&s.ancestors){const u=s.ancestors[s.ancestors.length-1];u&&(s.place=u.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=En(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}we.prototype.file="";we.prototype.name="";we.prototype.reason="";we.prototype.message="";we.prototype.stack="";we.prototype.column=void 0;we.prototype.line=void 0;we.prototype.ancestors=void 0;we.prototype.cause=void 0;we.prototype.fatal=void 0;we.prototype.place=void 0;we.prototype.ruleId=void 0;we.prototype.source=void 0;const Oi={}.hasOwnProperty,wu=new Map,vu=/[A-Z]/g,ku=new Set(["table","tbody","thead","tfoot","tr"]),ju=new Set(["td","th"]),no="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Nu(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Tu(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Iu(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Mi:du,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=ro(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function ro(e,t,n){if(t.type==="element")return Su(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Cu(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return _u(e,t,n);if(t.type==="mdxjsEsm")return Eu(e,t);if(t.type==="root")return Pu(e,t,n);if(t.type==="text")return Ru(e,t)}function Su(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Mi,e.schema=i),e.ancestors.push(t);const s=so(e,t.tagName,!1),o=Au(e,t);let l=Di(e,t);return ku.has(t.tagName)&&(l=l.filter(function(u){return typeof u=="string"?!tu(u):!0})),io(e,o,s,t),Fi(o,l),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function Cu(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Ln(e,t.position)}function Eu(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ln(e,t.position)}function _u(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Mi,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:so(e,t.name,!0),o=Mu(e,t),l=Di(e,t);return io(e,o,s,t),Fi(o,l),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function Pu(e,t,n){const r={};return Fi(r,Di(e,t)),e.create(t,e.Fragment,r,n)}function Ru(e,t){return t.value}function io(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Fi(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Iu(e,t,n){return r;function r(i,s,o,l){const c=Array.isArray(o.children)?n:t;return l?c(s,o,l):c(s,o)}}function Tu(e,t){return n;function n(r,i,s,o){const l=Array.isArray(s.children),u=Li(r);return t(i,s,o,l,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function Au(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Oi.call(t.properties,i)){const s=Lu(e,i,t.properties[i]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&ju.has(t.tagName)?r=l:n[o]=l}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Mu(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Ln(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else Ln(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Di(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:wu;for(;++ri?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s0?(nt(e,e.length,0,t),e):t}const Ms={}.hasOwnProperty;function $u(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Jt(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const tt=Pt(/[A-Za-z]/),Fe=Pt(/[\dA-Za-z]/),Ku=Pt(/[#-'*+\--9=?A-Z^-~]/);function mi(e){return e!==null&&(e<32||e===127)}const xi=Pt(/\d/),Vu=Pt(/[\dA-Fa-f]/),Gu=Pt(/[!-/:-@[-`{-~]/);function q(e){return e!==null&&e<-2}function Te(e){return e!==null&&(e<0||e===32)}function X(e){return e===-2||e===-1||e===32}const Ju=Pt(new RegExp("\\p{P}|\\p{S}","u")),Wu=Pt(/\s/);function Pt(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function pn(e){const t=[];let n=-1,r=0,i=0;for(;++n55295&&s<57344){const l=e.charCodeAt(n+1);s<56320&&l>56319&&l<57344?(o=String.fromCharCode(s,l),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function ie(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(u){return X(u)?(e.enter(n),l(u)):t(u)}function l(u){return X(u)&&s++o))return;const F=t.events.length;let T=F,A,D;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(A){D=t.events[T][1].end;break}A=!0}for(b(r),v=F;vN;){const E=n[C];t.containerState=E[1],E[0].exit.call(t,e)}n.length=N}function S(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function tc(e,t,n){return ie(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Os(e){if(e===null||Te(e)||Wu(e))return 1;if(Ju(e))return 2}function Bi(e,t,n){const r=[];let i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[r][1].end},f={...e[n][1].start};Fs(h,-u),Fs(f,u),o={type:u>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},l={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},s={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:u>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=Ue(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Ue(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=Ue(c,Bi(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Ue(c,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,c=Ue(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,nt(e,r-1,n-r+3,c),n=r+c.length-d-2;break}}for(n=-1;++n0&&X(v)?ie(e,S,"linePrefix",s+1)(v):S(v)}function S(v){return v===null||q(v)?e.check(Ds,w,C)(v):(e.enter("codeFlowValue"),N(v))}function N(v){return v===null||q(v)?(e.exit("codeFlowValue"),S(v)):(e.consume(v),N)}function C(v){return e.exit("codeFenced"),t(v)}function E(v,F,T){let A=0;return D;function D(R){return v.enter("lineEnding"),v.consume(R),v.exit("lineEnding"),L}function L(R){return v.enter("codeFencedFence"),X(R)?ie(v,_,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):_(R)}function _(R){return R===l?(v.enter("codeFencedFenceSequence"),K(R)):T(R)}function K(R){return R===l?(A++,v.consume(R),K):A>=o?(v.exit("codeFencedFenceSequence"),X(R)?ie(v,O,"whitespace")(R):O(R)):T(R)}function O(R){return R===null||q(R)?(v.exit("codeFencedFence"),F(R)):T(R)}}}function pc(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Or={name:"codeIndented",tokenize:mc},fc={partial:!0,tokenize:xc};function mc(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),ie(e,s,"linePrefix",5)(c)}function s(c){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?u(c):q(c)?e.attempt(fc,o,u)(c):(e.enter("codeFlowValue"),l(c))}function l(c){return c===null||q(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),l)}function u(c){return e.exit("codeIndented"),t(c)}}function xc(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):q(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):ie(e,s,"linePrefix",5)(o)}function s(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):q(o)?i(o):n(o)}}const gc={name:"codeText",previous:yc,resolve:bc,tokenize:wc};function bc(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&wn(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),wn(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),wn(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function po(e,t,n,r,i,s,o,l,u){const c=u||Number.POSITIVE_INFINITY;let d=0;return h;function h(b){return b===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(b),e.exit(s),f):b===null||b===32||b===41||mi(b)?n(b):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),w(b))}function f(b){return b===62?(e.enter(s),e.consume(b),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(b))}function p(b){return b===62?(e.exit("chunkString"),e.exit(l),f(b)):b===null||b===60||q(b)?n(b):(e.consume(b),b===92?y:p)}function y(b){return b===60||b===62||b===92?(e.consume(b),p):p(b)}function w(b){return!d&&(b===null||b===41||Te(b))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(b)):d999||p===null||p===91||p===93&&!u||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(s),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):q(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||q(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),u||(u=!X(p)),p===92?f:h)}function f(p){return p===91||p===92||p===93?(e.consume(p),l++,h):h(p)}}function mo(e,t,n,r,i,s){let o;return l;function l(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,u):n(f)}function u(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(s),c(f))}function c(f){return f===o?(e.exit(s),u(o)):f===null?n(f):q(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ie(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===o||f===null||q(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?h:d)}function h(f){return f===o||f===92?(e.consume(f),d):d(f)}}function _n(e,t){let n;return r;function r(i){return q(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):X(i)?ie(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const _c={name:"definition",tokenize:Rc},Pc={partial:!0,tokenize:Ic};function Rc(e,t,n){const r=this;let i;return s;function s(p){return e.enter("definition"),o(p)}function o(p){return fo.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return i=Jt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),u):n(p)}function u(p){return Te(p)?_n(e,c)(p):c(p)}function c(p){return po(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(Pc,h,h)(p)}function h(p){return X(p)?ie(e,f,"whitespace")(p):f(p)}function f(p){return p===null||q(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function Ic(e,t,n){return r;function r(l){return Te(l)?_n(e,i)(l):n(l)}function i(l){return mo(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return X(l)?ie(e,o,"whitespace")(l):o(l)}function o(l){return l===null||q(l)?t(l):n(l)}}const Tc={name:"hardBreakEscape",tokenize:Ac};function Ac(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return q(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const Mc={name:"headingAtx",resolve:Lc,tokenize:Oc};function Lc(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},nt(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function Oc(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||Te(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),u(d)):d===null||q(d)?(e.exit("atxHeading"),t(d)):X(d)?ie(e,l,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function u(d){return d===35?(e.consume(d),u):(e.exit("atxHeadingSequence"),l(d))}function c(d){return d===null||d===35||Te(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),c)}}const Fc=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Bs=["pre","script","style","textarea"],Dc={concrete:!0,name:"htmlFlow",resolveTo:qc,tokenize:Uc},zc={partial:!0,tokenize:Hc},Bc={partial:!0,tokenize:$c};function qc(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Uc(e,t,n){const r=this;let i,s,o,l,u;return c;function c(x){return d(x)}function d(x){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(x),h}function h(x){return x===33?(e.consume(x),f):x===47?(e.consume(x),s=!0,w):x===63?(e.consume(x),i=3,r.interrupt?t:m):tt(x)?(e.consume(x),o=String.fromCharCode(x),k):n(x)}function f(x){return x===45?(e.consume(x),i=2,p):x===91?(e.consume(x),i=5,l=0,y):tt(x)?(e.consume(x),i=4,r.interrupt?t:m):n(x)}function p(x){return x===45?(e.consume(x),r.interrupt?t:m):n(x)}function y(x){const Ce="CDATA[";return x===Ce.charCodeAt(l++)?(e.consume(x),l===Ce.length?r.interrupt?t:_:y):n(x)}function w(x){return tt(x)?(e.consume(x),o=String.fromCharCode(x),k):n(x)}function k(x){if(x===null||x===47||x===62||Te(x)){const Ce=x===47,rt=o.toLowerCase();return!Ce&&!s&&Bs.includes(rt)?(i=1,r.interrupt?t(x):_(x)):Fc.includes(o.toLowerCase())?(i=6,Ce?(e.consume(x),b):r.interrupt?t(x):_(x)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(x):s?S(x):N(x))}return x===45||Fe(x)?(e.consume(x),o+=String.fromCharCode(x),k):n(x)}function b(x){return x===62?(e.consume(x),r.interrupt?t:_):n(x)}function S(x){return X(x)?(e.consume(x),S):D(x)}function N(x){return x===47?(e.consume(x),D):x===58||x===95||tt(x)?(e.consume(x),C):X(x)?(e.consume(x),N):D(x)}function C(x){return x===45||x===46||x===58||x===95||Fe(x)?(e.consume(x),C):E(x)}function E(x){return x===61?(e.consume(x),v):X(x)?(e.consume(x),E):N(x)}function v(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),u=x,F):X(x)?(e.consume(x),v):T(x)}function F(x){return x===u?(e.consume(x),u=null,A):x===null||q(x)?n(x):(e.consume(x),F)}function T(x){return x===null||x===34||x===39||x===47||x===60||x===61||x===62||x===96||Te(x)?E(x):(e.consume(x),T)}function A(x){return x===47||x===62||X(x)?N(x):n(x)}function D(x){return x===62?(e.consume(x),L):n(x)}function L(x){return x===null||q(x)?_(x):X(x)?(e.consume(x),L):n(x)}function _(x){return x===45&&i===2?(e.consume(x),V):x===60&&i===1?(e.consume(x),te):x===62&&i===4?(e.consume(x),ae):x===63&&i===3?(e.consume(x),m):x===93&&i===5?(e.consume(x),pe):q(x)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(zc,De,K)(x)):x===null||q(x)?(e.exit("htmlFlowData"),K(x)):(e.consume(x),_)}function K(x){return e.check(Bc,O,De)(x)}function O(x){return e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),R}function R(x){return x===null||q(x)?K(x):(e.enter("htmlFlowData"),_(x))}function V(x){return x===45?(e.consume(x),m):_(x)}function te(x){return x===47?(e.consume(x),o="",ce):_(x)}function ce(x){if(x===62){const Ce=o.toLowerCase();return Bs.includes(Ce)?(e.consume(x),ae):_(x)}return tt(x)&&o.length<8?(e.consume(x),o+=String.fromCharCode(x),ce):_(x)}function pe(x){return x===93?(e.consume(x),m):_(x)}function m(x){return x===62?(e.consume(x),ae):x===45&&i===2?(e.consume(x),m):_(x)}function ae(x){return x===null||q(x)?(e.exit("htmlFlowData"),De(x)):(e.consume(x),ae)}function De(x){return e.exit("htmlFlow"),t(x)}}function $c(e,t,n){const r=this;return i;function i(o){return q(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function Hc(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Er,t,n)}}const Qc={name:"htmlText",tokenize:Kc};function Kc(e,t,n){const r=this;let i,s,o;return l;function l(m){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(m),u}function u(m){return m===33?(e.consume(m),c):m===47?(e.consume(m),E):m===63?(e.consume(m),N):tt(m)?(e.consume(m),T):n(m)}function c(m){return m===45?(e.consume(m),d):m===91?(e.consume(m),s=0,y):tt(m)?(e.consume(m),S):n(m)}function d(m){return m===45?(e.consume(m),p):n(m)}function h(m){return m===null?n(m):m===45?(e.consume(m),f):q(m)?(o=h,te(m)):(e.consume(m),h)}function f(m){return m===45?(e.consume(m),p):h(m)}function p(m){return m===62?V(m):m===45?f(m):h(m)}function y(m){const ae="CDATA[";return m===ae.charCodeAt(s++)?(e.consume(m),s===ae.length?w:y):n(m)}function w(m){return m===null?n(m):m===93?(e.consume(m),k):q(m)?(o=w,te(m)):(e.consume(m),w)}function k(m){return m===93?(e.consume(m),b):w(m)}function b(m){return m===62?V(m):m===93?(e.consume(m),b):w(m)}function S(m){return m===null||m===62?V(m):q(m)?(o=S,te(m)):(e.consume(m),S)}function N(m){return m===null?n(m):m===63?(e.consume(m),C):q(m)?(o=N,te(m)):(e.consume(m),N)}function C(m){return m===62?V(m):N(m)}function E(m){return tt(m)?(e.consume(m),v):n(m)}function v(m){return m===45||Fe(m)?(e.consume(m),v):F(m)}function F(m){return q(m)?(o=F,te(m)):X(m)?(e.consume(m),F):V(m)}function T(m){return m===45||Fe(m)?(e.consume(m),T):m===47||m===62||Te(m)?A(m):n(m)}function A(m){return m===47?(e.consume(m),V):m===58||m===95||tt(m)?(e.consume(m),D):q(m)?(o=A,te(m)):X(m)?(e.consume(m),A):V(m)}function D(m){return m===45||m===46||m===58||m===95||Fe(m)?(e.consume(m),D):L(m)}function L(m){return m===61?(e.consume(m),_):q(m)?(o=L,te(m)):X(m)?(e.consume(m),L):A(m)}function _(m){return m===null||m===60||m===61||m===62||m===96?n(m):m===34||m===39?(e.consume(m),i=m,K):q(m)?(o=_,te(m)):X(m)?(e.consume(m),_):(e.consume(m),O)}function K(m){return m===i?(e.consume(m),i=void 0,R):m===null?n(m):q(m)?(o=K,te(m)):(e.consume(m),K)}function O(m){return m===null||m===34||m===39||m===60||m===61||m===96?n(m):m===47||m===62||Te(m)?A(m):(e.consume(m),O)}function R(m){return m===47||m===62||Te(m)?A(m):n(m)}function V(m){return m===62?(e.consume(m),e.exit("htmlTextData"),e.exit("htmlText"),t):n(m)}function te(m){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),ce}function ce(m){return X(m)?ie(e,pe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m):pe(m)}function pe(m){return e.enter("htmlTextData"),o(m)}}const qi={name:"labelEnd",resolveAll:Wc,resolveTo:Xc,tokenize:Yc},Vc={tokenize:Zc},Gc={tokenize:ed},Jc={tokenize:td};function Wc(e){let t=-1;const n=[];for(;++t=3&&(c===null||q(c))?(e.exit("thematicBreak"),t(c)):n(c)}function u(c){return c===i?(e.consume(c),r++,u):(e.exit("thematicBreakSequence"),X(c)?ie(e,l,"whitespace")(c):l(c))}}const _e={continuation:{tokenize:dd},exit:pd,name:"list",tokenize:cd},ld={partial:!0,tokenize:fd},ud={partial:!0,tokenize:hd};function cd(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return l;function l(p){const y=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:xi(p)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(dr,n,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(p)}return n(p)}function u(p){return xi(p)&&++o<10?(e.consume(p),u):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Er,r.interrupt?n:d,e.attempt(ld,f,h))}function d(p){return r.containerState.initialBlankLine=!0,s++,f(p)}function h(p){return X(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function dd(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Er,i,s);function i(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ie(e,t,"listItemIndent",r.containerState.size+1)(l)}function s(l){return r.containerState.furtherBlankLines||!X(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(ud,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,ie(e,e.attempt(_e,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function hd(e,t,n){const r=this;return ie(e,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(s):n(s)}}function pd(e){e.exit(this.containerState.type)}function fd(e,t,n){const r=this;return ie(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!X(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const qs={name:"setextUnderline",resolveTo:md,tokenize:xd};function md(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function xd(e,t,n){const r=this;let i;return s;function s(c){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),l(c)}function l(c){return c===i?(e.consume(c),l):(e.exit("setextHeadingLineSequence"),X(c)?ie(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||q(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const gd={tokenize:bd};function bd(e){const t=this,n=e.attempt(Er,r,e.attempt(this.parser.constructs.flowInitial,i,ie(e,e.attempt(this.parser.constructs.flow,i,e.attempt(jc,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const yd={resolveAll:go()},wd=xo("string"),vd=xo("text");function xo(e){return{resolveAll:go(e==="text"?kd:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,l);return o;function o(d){return c(d)?s(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),u}function u(d){return c(d)?(n.exit("data"),s(d)):(n.consume(d),u)}function c(d){if(d===null)return!0;const h=i[d];let f=-1;if(h)for(;++f-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function Ld(e,t){let n=-1;const r=[];let i;for(;++n0){const Ee=U.tokenStack[U.tokenStack.length-1];(Ee[1]||$s).call(U,void 0,Ee[0])}for(I.position={start:ft(j.length>0?j[0][1].start:{line:1,column:1,offset:0}),end:ft(j.length>0?j[j.length-2][1].end:{line:1,column:1,offset:0})},Y=-1;++Y0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function Jd(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Wd(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Xd(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=pn(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let o,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=s+1,l+=1,e.footnoteCounts.set(r,l);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,u);const c={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,c),e.applyData(t,c)}function Yd(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Zd(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function wo(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function eh(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return wo(e,t);const i={src:pn(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function th(e,t){const n={src:pn(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function nh(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function rh(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return wo(e,t);const i={href:pn(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function ih(e,t){const n={href:pn(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function sh(e,t,n){const r=e.all(t),i=n?ah(n):vo(t),s={},o=[];if(typeof t.checked=="boolean"){const d=r[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let l=-1;for(;++l1}function oh(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=Li(t.children[1]),u=eo(t.children[t.children.length-1]);l&&u&&(o.position={start:l,end:u}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function hh(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let u=-1;const c=[];for(;++u0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(Ks(t.slice(i),i>0,!1)),s.join("")}function Ks(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===Hs||s===Qs;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===Hs||s===Qs;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function mh(e,t){const n={type:"text",value:fh(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function xh(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const gh={blockquote:Kd,break:Vd,code:Gd,delete:Jd,emphasis:Wd,footnoteReference:Xd,heading:Yd,html:Zd,imageReference:eh,image:th,inlineCode:nh,linkReference:rh,link:ih,listItem:sh,list:oh,paragraph:lh,root:uh,strong:ch,table:dh,tableCell:ph,tableRow:hh,text:mh,thematicBreak:xh,toml:sr,yaml:sr,definition:sr,footnoteDefinition:sr};function sr(){}const ko=-1,_r=0,Pn=1,fr=2,Ui=3,$i=4,Hi=5,Qi=6,jo=7,No=8,bh=typeof self=="object"?self:globalThis,Vs=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new bh[e](t)},yh=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case _r:case ko:return n(o,i);case Pn:{const l=n([],i);for(const u of o)l.push(r(u));return l}case fr:{const l=n({},i);for(const[u,c]of o)l[r(u)]=r(c);return l}case Ui:return n(new Date(o),i);case $i:{const{source:l,flags:u}=o;return n(new RegExp(l,u),i)}case Hi:{const l=n(new Map,i);for(const[u,c]of o)l.set(r(u),r(c));return l}case Qi:{const l=n(new Set,i);for(const u of o)l.add(r(u));return l}case jo:{const{name:l,message:u}=o;return n(Vs(l,u),i)}case No:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(Vs(s,o),i)};return r},Gs=e=>yh(new Map,e)(0),Gt="",{toString:wh}={},{keys:vh}=Object,vn=e=>{const t=typeof e;if(t!=="object"||!e)return[_r,t];const n=wh.call(e).slice(8,-1);switch(n){case"Array":return[Pn,Gt];case"Object":return[fr,Gt];case"Date":return[Ui,Gt];case"RegExp":return[$i,Gt];case"Map":return[Hi,Gt];case"Set":return[Qi,Gt];case"DataView":return[Pn,n]}return n.includes("Array")?[Pn,n]:n.includes("Error")?[jo,n]:[fr,n]},ar=([e,t])=>e===_r&&(t==="function"||t==="symbol"),kh=(e,t,n,r)=>{const i=(o,l)=>{const u=r.push(o)-1;return n.set(l,u),u},s=o=>{if(n.has(o))return n.get(o);let[l,u]=vn(o);switch(l){case _r:{let d=o;switch(u){case"bigint":l=No,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);d=null;break;case"undefined":return i([ko],o)}return i([l,d],o)}case Pn:{if(u){let f=o;return u==="DataView"?f=new Uint8Array(o.buffer):u==="ArrayBuffer"&&(f=new Uint8Array(o)),i([u,[...f]],o)}const d=[],h=i([l,d],o);for(const f of o)d.push(s(f));return h}case fr:{if(u)switch(u){case"BigInt":return i([u,o.toString()],o);case"Boolean":case"Number":case"String":return i([u,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const d=[],h=i([l,d],o);for(const f of vh(o))(e||!ar(vn(o[f])))&&d.push([s(f),s(o[f])]);return h}case Ui:return i([l,o.toISOString()],o);case $i:{const{source:d,flags:h}=o;return i([l,{source:d,flags:h}],o)}case Hi:{const d=[],h=i([l,d],o);for(const[f,p]of o)(e||!(ar(vn(f))||ar(vn(p))))&&d.push([s(f),s(p)]);return h}case Qi:{const d=[],h=i([l,d],o);for(const f of o)(e||!ar(vn(f)))&&d.push(s(f));return h}}const{message:c}=o;return i([l,{name:u,message:c}],o)};return s},Js=(e,{json:t,lossy:n}={})=>{const r=[];return kh(!(t||n),!!t,new Map,r)(e),r},mr=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Gs(Js(e,t)):structuredClone(e):(e,t)=>Gs(Js(e,t));function jh(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Nh(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Sh(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||jh,r=e.options.footnoteBackLabel||Nh,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let u=-1;for(;++u0&&y.push({type:"text",value:" "});let S=typeof n=="string"?n:n(u,p);typeof S=="string"&&(S={type:"text",value:S}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,p),className:["data-footnote-backref"]},children:Array.isArray(S)?S:[S]})}const k=d[d.length-1];if(k&&k.type==="element"&&k.tagName==="p"){const S=k.children[k.children.length-1];S&&S.type==="text"?S.value+=" ":k.children.push({type:"text",value:" "}),k.children.push(...y)}else d.push(...y);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(d,!0)};e.patch(c,b),l.push(b)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...mr(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:` +`}]}}const So=(function(e){if(e==null)return Ph;if(typeof e=="function")return Pr(e);if(typeof e=="object")return Array.isArray(e)?Ch(e):Eh(e);if(typeof e=="string")return _h(e);throw new Error("Expected function, string, or object as test")});function Ch(e){const t=[];let n=-1;for(;++n":""))+")"})}return f;function f(){let p=Co,y,w,k;if((!t||s(u,c,d[d.length-1]||void 0))&&(p=Mh(n(u,d)),p[0]===Ws))return p;if("children"in u&&u.children){const b=u;if(b.children&&p[0]!==Th)for(w=(r?b.children.length:-1)+o,k=d.concat(b);w>-1&&w0&&n.push({type:"text",value:` +`}),n}function Xs(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Ys(e,t){const n=Oh(e,t),r=n.one(e,void 0),i=Sh(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:` +`},i),s}function qh(e,t){return e&&"run"in e?async function(n,r){const i=Ys(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Ys(n,{file:r,...e||t})}}function Zs(e){if(e)throw e}var Dr,ea;function Uh(){if(ea)return Dr;ea=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(c){return typeof Array.isArray=="function"?Array.isArray(c):t.call(c)==="[object Array]"},s=function(c){if(!c||t.call(c)!=="[object Object]")return!1;var d=e.call(c,"constructor"),h=c.constructor&&c.constructor.prototype&&e.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!d&&!h)return!1;var f;for(f in c);return typeof f>"u"||e.call(c,f)},o=function(c,d){n&&d.name==="__proto__"?n(c,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):c[d.name]=d.newValue},l=function(c,d){if(d==="__proto__")if(e.call(c,d)){if(r)return r(c,d).value}else return;return c[d]};return Dr=function u(){var c,d,h,f,p,y,w=arguments[0],k=1,b=arguments.length,S=!1;for(typeof w=="boolean"&&(S=w,w=arguments[1]||{},k=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});ko.length;let u;l&&o.push(i);try{u=e.apply(this,o)}catch(c){const d=c;if(l&&n)throw d;return i(d)}l||(u&&u.then&&typeof u.then=="function"?u.then(s,i):u instanceof Error?i(u):s(u))}function i(o,...l){n||(n=!0,t(o,...l))}function s(o){i(null,o)}}const We={basename:Kh,dirname:Vh,extname:Gh,join:Jh,sep:"/"};function Kh(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Qn(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(r=i):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Vh(e){if(Qn(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Gh(e){Qn(e);let t=e.length,n=-1,r=0,i=-1,s=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function Jh(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Xh(e,t){let n="",r=0,i=-1,s=0,o=-1,l,u;for(;++o<=e.length;){if(o2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,s=0}else l===46&&s>-1?s++:s=-1}return n}function Qn(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Yh={cwd:Zh};function Zh(){return"/"}function wi(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function ep(e){if(typeof e=="string")e=new URL(e);else if(!wi(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return tp(e)}function tp(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n0){let[p,...y]=d;const w=r[f][1];yi(w)&&yi(p)&&(p=zr(!0,w,p)),r[f]=[c,p,...y]}}}}const sp=new Ki().freeze();function $r(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Hr(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Qr(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function na(e){if(!yi(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ra(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function or(e){return ap(e)?e:new _o(e)}function ap(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function op(e){return typeof e=="string"||lp(e)}function lp(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const up="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",ia=[],sa={allowDangerousHtml:!0},cp=/^(https?|ircs?|mailto|xmpp)$/i,dp=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function hp(e){const t=pp(e),n=fp(e);return mp(t.runSync(t.parse(n),n),e)}function pp(e){const t=e.rehypePlugins||ia,n=e.remarkPlugins||ia,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...sa}:sa;return sp().use(Qd).use(n).use(qh,r).use(t)}function fp(e){const t=e.children||"",n=new _o;return typeof t=="string"&&(n.value=t),n}function mp(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,u=t.urlTransform||xp;for(const d of dp)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+up+d.id,void 0);return Eo(e,c),Nu(e,{Fragment:a.Fragment,components:i,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function c(d,h,f){if(d.type==="raw"&&f&&typeof h=="number")return o?f.children.splice(h,1):f.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let p;for(p in Lr)if(Object.hasOwn(Lr,p)&&Object.hasOwn(d.properties,p)){const y=d.properties[p],w=Lr[p];(w===null||w.includes(d.tagName))&&(d.properties[p]=u(String(y||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!p&&r&&typeof h=="number"&&(p=!r(d,h,f)),p&&f&&typeof h=="number")return l&&d.children?f.children.splice(h,1,...d.children):f.children.splice(h,1),h}}}function xp(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||cp.test(e.slice(0,t))?e:""}const Vi="-",gp=e=>{const t=yp(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const l=o.split(Vi);return l[0]===""&&l.length!==1&&l.shift(),Po(l,t)||bp(o)},getConflictingClassGroupIds:(o,l)=>{const u=n[o]||[];return l&&r[o]?[...u,...r[o]]:u}}},Po=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),i=r?Po(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;const s=e.join(Vi);return(o=t.validators.find(({validator:l})=>l(s)))==null?void 0:o.classGroupId},aa=/^\[(.+)\]$/,bp=e=>{if(aa.test(e)){const t=aa.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},yp=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return vp(Object.entries(e.classGroups),n).forEach(([s,o])=>{vi(o,r,s,t)}),r},vi=(e,t,n,r)=>{e.forEach(i=>{if(typeof i=="string"){const s=i===""?t:oa(t,i);s.classGroupId=n;return}if(typeof i=="function"){if(wp(i)){vi(i(r),t,n,r);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{vi(o,oa(t,s),n,r)})})},oa=(e,t)=>{let n=e;return t.split(Vi).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},wp=e=>e.isThemeGetter,vp=(e,t)=>t?e.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,l])=>[t+o,l])):s);return[n,i]}):e,kp=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const i=(s,o)=>{n.set(s,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){n.has(s)?n.set(s,o):i(s,o)}}},Ro="!",jp=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],s=t.length,o=l=>{const u=[];let c=0,d=0,h;for(let k=0;kd?h-d:void 0;return{modifiers:u,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:w}};return n?l=>n({className:l,parseClassName:o}):o},Np=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},Sp=e=>({cache:kp(e.cacheSize),parseClassName:jp(e),...gp(e)}),Cp=/\s+/,Ep=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,s=[],o=e.trim().split(Cp);let l="";for(let u=o.length-1;u>=0;u-=1){const c=o[u],{modifiers:d,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:p}=n(c);let y=!!p,w=r(y?f.substring(0,p):f);if(!w){if(!y){l=c+(l.length>0?" "+l:l);continue}if(w=r(f),!w){l=c+(l.length>0?" "+l:l);continue}y=!1}const k=Np(d).join(":"),b=h?k+Ro:k,S=b+w;if(s.includes(S))continue;s.push(S);const N=i(w,y);for(let C=0;C0?" "+l:l)}return l};function _p(){let e=0,t,n,r="";for(;e{if(typeof e=="string")return e;let t,n="";for(let r=0;rh(d),e());return n=Sp(c),r=n.cache.get,i=n.cache.set,s=l,l(u)}function l(u){const c=r(u);if(c)return c;const d=Ep(u,n);return i(u,d),d}return function(){return s(_p.apply(null,arguments))}}const se=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},To=/^\[(?:([a-z-]+):)?(.+)\]$/i,Rp=/^\d+\/\d+$/,Ip=new Set(["px","full","screen"]),Tp=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ap=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Mp=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Lp=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Op=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,st=e=>Wt(e)||Ip.has(e)||Rp.test(e),mt=e=>fn(e,"length",Hp),Wt=e=>!!e&&!Number.isNaN(Number(e)),Kr=e=>fn(e,"number",Wt),kn=e=>!!e&&Number.isInteger(Number(e)),Fp=e=>e.endsWith("%")&&Wt(e.slice(0,-1)),Q=e=>To.test(e),xt=e=>Tp.test(e),Dp=new Set(["length","size","percentage"]),zp=e=>fn(e,Dp,Ao),Bp=e=>fn(e,"position",Ao),qp=new Set(["image","url"]),Up=e=>fn(e,qp,Kp),$p=e=>fn(e,"",Qp),jn=()=>!0,fn=(e,t,n)=>{const r=To.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},Hp=e=>Ap.test(e)&&!Mp.test(e),Ao=()=>!1,Qp=e=>Lp.test(e),Kp=e=>Op.test(e),Vp=()=>{const e=se("colors"),t=se("spacing"),n=se("blur"),r=se("brightness"),i=se("borderColor"),s=se("borderRadius"),o=se("borderSpacing"),l=se("borderWidth"),u=se("contrast"),c=se("grayscale"),d=se("hueRotate"),h=se("invert"),f=se("gap"),p=se("gradientColorStops"),y=se("gradientColorStopPositions"),w=se("inset"),k=se("margin"),b=se("opacity"),S=se("padding"),N=se("saturate"),C=se("scale"),E=se("sepia"),v=se("skew"),F=se("space"),T=se("translate"),A=()=>["auto","contain","none"],D=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto",Q,t],_=()=>[Q,t],K=()=>["",st,mt],O=()=>["auto",Wt,Q],R=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],V=()=>["solid","dashed","dotted","double","none"],te=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ce=()=>["start","end","center","between","around","evenly","stretch"],pe=()=>["","0",Q],m=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ae=()=>[Wt,Q];return{cacheSize:500,separator:":",theme:{colors:[jn],spacing:[st,mt],blur:["none","",xt,Q],brightness:ae(),borderColor:[e],borderRadius:["none","","full",xt,Q],borderSpacing:_(),borderWidth:K(),contrast:ae(),grayscale:pe(),hueRotate:ae(),invert:pe(),gap:_(),gradientColorStops:[e],gradientColorStopPositions:[Fp,mt],inset:L(),margin:L(),opacity:ae(),padding:_(),saturate:ae(),scale:ae(),sepia:pe(),skew:ae(),space:_(),translate:_()},classGroups:{aspect:[{aspect:["auto","square","video",Q]}],container:["container"],columns:[{columns:[xt]}],"break-after":[{"break-after":m()}],"break-before":[{"break-before":m()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...R(),Q]}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[w]}],"inset-x":[{"inset-x":[w]}],"inset-y":[{"inset-y":[w]}],start:[{start:[w]}],end:[{end:[w]}],top:[{top:[w]}],right:[{right:[w]}],bottom:[{bottom:[w]}],left:[{left:[w]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",kn,Q]}],basis:[{basis:L()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Q]}],grow:[{grow:pe()}],shrink:[{shrink:pe()}],order:[{order:["first","last","none",kn,Q]}],"grid-cols":[{"grid-cols":[jn]}],"col-start-end":[{col:["auto",{span:["full",kn,Q]},Q]}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":[jn]}],"row-start-end":[{row:["auto",{span:[kn,Q]},Q]}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Q]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Q]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...ce()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ce(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ce(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[S]}],px:[{px:[S]}],py:[{py:[S]}],ps:[{ps:[S]}],pe:[{pe:[S]}],pt:[{pt:[S]}],pr:[{pr:[S]}],pb:[{pb:[S]}],pl:[{pl:[S]}],m:[{m:[k]}],mx:[{mx:[k]}],my:[{my:[k]}],ms:[{ms:[k]}],me:[{me:[k]}],mt:[{mt:[k]}],mr:[{mr:[k]}],mb:[{mb:[k]}],ml:[{ml:[k]}],"space-x":[{"space-x":[F]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[F]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Q,t]}],"min-w":[{"min-w":[Q,t,"min","max","fit"]}],"max-w":[{"max-w":[Q,t,"none","full","min","max","fit","prose",{screen:[xt]},xt]}],h:[{h:[Q,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Q,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Q,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Q,t,"auto","min","max","fit"]}],"font-size":[{text:["base",xt,mt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Kr]}],"font-family":[{font:[jn]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Q]}],"line-clamp":[{"line-clamp":["none",Wt,Kr]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",st,Q]}],"list-image":[{"list-image":["none",Q]}],"list-style-type":[{list:["none","disc","decimal",Q]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",st,mt]}],"underline-offset":[{"underline-offset":["auto",st,Q]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Q]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Q]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...R(),Bp]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",zp]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Up]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...V(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:V()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...V()]}],"outline-offset":[{"outline-offset":[st,Q]}],"outline-w":[{outline:[st,mt]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[st,mt]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",xt,$p]}],"shadow-color":[{shadow:[jn]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...te(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":te()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",xt,Q]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[h]}],saturate:[{saturate:[N]}],sepia:[{sepia:[E]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[E]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Q]}],duration:[{duration:ae()}],ease:[{ease:["linear","in","out","in-out",Q]}],delay:[{delay:ae()}],animate:[{animate:["none","spin","ping","pulse","bounce",Q]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[kn,Q]}],"translate-x":[{"translate-x":[T]}],"translate-y":[{"translate-y":[T]}],"skew-x":[{"skew-x":[v]}],"skew-y":[{"skew-y":[v]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Q]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Q]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Q]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[st,mt,Kr]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Gp=Pp(Vp),ki={status:"",repo:"",thread:"",action:"",intent:"",actor:""},Jp=new El({defaultOptions:{queries:{retry:1}}}),la=12,Wp=12,Xp=10080*60*1e3,Yp=1e3,Mo=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";function re(...e){return Gp(Go(e))}async function le(e,t){const n=new Headers(t==null?void 0:t.headers);n.set("Accept","application/json");const r=await fetch(e,{...t,headers:n});if(!r.ok)throw new Error(`${r.status} ${r.statusText}`);return r.json()}function $e(e){if(e==null)return"n/a";const t=Math.max(0,Math.floor(e));if(t<60)return`${t}s`;const n=Math.floor(t/60);return n<60?`${n}m ${t%60}s`:`${Math.floor(n/60)}h ${n%60}m`}const Zp=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:"short"}),ef=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});function Kn(e){if(!e)return null;const t=new Date(e);return Number.isNaN(t.getTime())?null:t}function tf(e){const t=Kn(e);return t?Zp.format(t):e??""}function Rn(e){const t=Kn(e);return t?ef.format(t):e??""}function Lo(e,t){const n=Kn(e);if(!n)return e??"";const r=t-n.getTime(),i=Math.abs(r);if(i>Xp)return Rn(e);const s=r>=0?"ago":"from now",o=Math.round(i/1e3);if(o<45)return r>=0?"just now":"soon";if(o<90)return`1m ${s}`;const l=Math.round(o/60);if(l<60)return`${l}m ${s}`;if(l<90)return`1h ${s}`;const u=Math.round(l/60);return u<24?`${u}h ${s}`:u<36?`1d ${s}`:`${Math.round(u/24)}d ${s}`}function Ne({value:e,compact:t=!1,relative:n=!1,now:r=Date.now()}){const i=Kn(e);return i?a.jsx("time",{dateTime:i.toISOString(),title:`UTC: ${i.toISOString()}`,children:n?Lo(e,r):t?Rn(e):tf(e)}):a.jsx(a.Fragment,{children:e??""})}function Oo(e,t){const n=Kn(e);return n?Math.max(0,Math.floor((t-n.getTime())/1e3)):null}function Gi(e,t){return e.status==="running"?Oo(e.started_at,t)??e.runtime_seconds:e.runtime_seconds}function Ji(e,t){return e.status==="pending"?Oo(e.created_at,t)??e.queue_wait_seconds:e.queue_wait_seconds}function nf(e){const[t,n]=z.useState(()=>Date.now());return z.useEffect(()=>{if(!e)return;n(Date.now());const r=window.setInterval(()=>n(Date.now()),Yp);return()=>window.clearInterval(r)},[e]),t}function rf(e){return(e??"").split(/\r?\n/).map(n=>n.trim()).find(Boolean)??""}function xr(e,t,n=1){const r=rf(t),i=n>1?` (${n})`:"";return r?`${e}${i}: ${r}`:`${e}${i}`}function gr(e){return e==="openclaw_stdout"||e==="openclaw_stderr"}function Fo(e){return e.map(t=>t==null?void 0:t.trim()).filter(Boolean).join(` +`)}function sf(e){const t=[];for(const n of e){const r=t[t.length-1];if(r&&gr(n.event_type)&&r.eventType===n.event_type){r.count+=1,r.meta=n.ts,r.detail=Fo([r.detail,n.detail]),r.summary=xr(n.summary,r.detail,r.count);continue}t.push({id:String(n.id),badge:n.event_type,meta:n.ts,summary:gr(n.event_type)?xr(n.summary,n.detail):n.summary,detail:n.detail,eventType:n.event_type,count:1})}return t}function af(e){const t=[];return e.forEach((n,r)=>{const i=t[t.length-1];if(i&&gr(n.kind)&&i.kind===n.kind){i.count+=1,i.meta=n.timestamp,i.text=Fo([i.text,n.text]),i.summary=xr(`${n.role} · ${n.kind}`,i.text,i.count);return}t.push({id:`${n.timestamp??"entry"}-${r}`,badge:n.title,meta:n.timestamp,summary:gr(n.kind)?xr(`${n.role} · ${n.kind}`,n.text):`${n.role} · ${n.kind}`,text:n.text,kind:n.kind,count:1})}),t}function ua(e,t,n,r){return e==="openclaw_stdout"?!1:t||n>=r-2}function of(e){return{pending:{badge:"border-amber-300 bg-amber-50 text-amber-800",dot:"bg-amber-500"},running:{badge:"border-blue-300 bg-blue-50 text-blue-700",dot:"bg-blue-600"},blocked:{badge:"border-red-300 bg-red-50 text-red-700",dot:"bg-red-600"},denied:{badge:"border-red-300 bg-red-50 text-red-700",dot:"bg-red-600"},done:{badge:"border-emerald-300 bg-emerald-50 text-emerald-700",dot:"bg-emerald-600"},waiting_approval:{badge:"border-slate-300 bg-slate-50 text-slate-700",dot:"bg-slate-500"}}[e]??{badge:"border-slate-300 bg-slate-50 text-slate-700",dot:"bg-slate-500"}}function lf(e,t){const n=new URLSearchParams;for(const[r,i]of Object.entries(e))i.trim()&&n.set(r,i.trim());return n.set("limit",String(t)),`/api/jobs?${n.toString()}`}function uf(e,t,n=50){const r=new URLSearchParams;return e.trim()&&r.set("repo",e.trim()),t.trim()&&r.set("status",t.trim()),r.set("limit",String(n)),`/api/knowledge?${r.toString()}`}function cf(e=Mo){return`/api/metrics/summary?timezone=${encodeURIComponent(e)}`}function _t(e){try{const t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"?t.href:"#"}catch{return"#"}}function Vn(e){return`/jobs/${e}`}function br(e){try{return JSON.parse(e.data)}catch{return null}}function df(e,t){return e.some(n=>n.id===t.id)?e:[...e,t]}function hf(e,t){const n=ca(t);return e.some(r=>ca(r)===n)?e:[...e,t]}function ca(e){return`${e.timestamp??""}:${e.role}:${e.kind}:${e.title}:${e.text}`}function pf(e){return["claimed","dispatch_started","dispatch_finished","done","blocked","denied","waiting_approval"].includes(e)}function Sn(e){return["blocked","denied","waiting_approval"].includes(e)}function ff(e=window.location.pathname){const t=e.match(/^\/jobs\/(\d+)\/?$/);return t?Number(t[1]):null}function mf(e=window.location.pathname){return/^\/knowledge\/?$/.test(e)}function xf(e=window.location.pathname){return/^\/mcp\/?$/.test(e)}function gf(e=window.location.pathname){return/^\/system\/?$/.test(e)}function Do(e){return e.startsWith("repo:")?e.slice(5):e}function da(e){return Object.values(e).some(t=>t.trim()!=="")}function bf(){var xn,Xn,Yn,Zn,er,tr,j,I,U,G,Y,Ee,Je,ze,ht,pt,be,it,Be,Xi,Yi,Zi,es,ts,ns,rs,is,ss,as;const e=za(),[t,n]=z.useState(ki),[r,i]=z.useState(la),s=z.useRef(!1),[o,l]=z.useState(""),[u,c]=z.useState("proposed"),[d,h]=z.useState(null),[f,p]=z.useState(""),[y,w]=z.useState(()=>window.location.pathname),k=ff(y),b=k!==null,S=mf(y),N=xf(y),C=gf(y),E=!b&&!S&&!N&&!C,v=k,F=ke({queryKey:["metrics",Mo],queryFn:()=>le(cf()),enabled:E||C}),T=ke({queryKey:["dashboard-status"],queryFn:()=>le("/api/status")}),A=ke({queryKey:["me"],queryFn:()=>le("/api/me"),refetchInterval:!1}),D=ke({queryKey:["about"],queryFn:()=>le("/api/about")}),L=ke({queryKey:["job-actors"],queryFn:()=>le("/api/jobs/actors"),enabled:E}),_=ke({queryKey:["jobs",t,r],queryFn:()=>le(lf(t,r)),enabled:E,placeholderData:H=>H}),K=ke({queryKey:["processes"],queryFn:()=>le("/api/processes"),enabled:C}),O=ke({queryKey:["systemd"],queryFn:()=>le("/api/systemd"),enabled:C}),R=ke({queryKey:["alerts"],queryFn:()=>le("/api/alerts"),enabled:C}),V=ke({queryKey:["knowledge",o,u],queryFn:()=>le(uf(o,u)),enabled:S}),te=ke({queryKey:["mcp-tokens"],queryFn:()=>le("/api/mcp/tokens"),enabled:N&&!!((Xn=(xn=A.data)==null?void 0:xn.user)!=null&&Xn.is_admin)}),ce=ke({queryKey:["job",v],queryFn:()=>le(`/api/jobs/${v}`),enabled:v!==null}),pe=ke({queryKey:["job-session",v],queryFn:()=>le(`/api/jobs/${v}/session`),enabled:v!==null}),m=ke({queryKey:["job-session-events",v],queryFn:()=>le(`/api/jobs/${v}/session/events`),enabled:v!==null}),ae=ke({queryKey:["job-session-transcript",v],queryFn:()=>le(`/api/jobs/${v}/session/transcript`),enabled:v!==null}),De=z.useCallback(async H=>{const ve=await le(`/api/jobs/${H}/retry`,{method:"POST"});e.setQueryData(["job",H],{job:ve.job}),e.invalidateQueries({queryKey:["jobs"]}),e.invalidateQueries({queryKey:["metrics"]})},[e]),x=z.useCallback(async H=>{const ve=await le(`/api/jobs/${H}/dismiss`,{method:"POST"});e.setQueryData(["job",H],{job:ve.job}),e.invalidateQueries({queryKey:["jobs"]}),e.invalidateQueries({queryKey:["metrics"]})},[e]),Ce=z.useCallback(async(H,ve)=>{await le(`/api/knowledge/proposals/${encodeURIComponent(H)}/${ve}`,{method:"POST"}),e.invalidateQueries({queryKey:["knowledge"]}),e.invalidateQueries({queryKey:["dashboard-status"]})},[e]),rt=z.useCallback(async H=>{await le(`/api/knowledge/rules/${encodeURIComponent(H)}`,{method:"DELETE"}),e.invalidateQueries({queryKey:["knowledge"]})},[e]),he=z.useCallback(async(H,ve)=>{await le(`/api/knowledge/rules/${encodeURIComponent(H)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:ve})}),e.invalidateQueries({queryKey:["knowledge"]})},[e]),Rt=z.useCallback(async H=>{const ve=await le("/api/mcp/tokens",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:H})});return e.invalidateQueries({queryKey:["mcp-tokens"]}),ve},[e]),Ve=z.useCallback(async H=>{await le(`/api/mcp/tokens/${encodeURIComponent(H)}`,{method:"DELETE"}),e.invalidateQueries({queryKey:["mcp-tokens"]})},[e]),Ge=z.useCallback(async H=>{const ve={refresh:"/api/autoupdate/refresh",apply:"/api/autoupdate/apply",complete:"/api/autoupdate/complete-pending"}[H];h(H),p("");try{await le(ve,{method:"POST"}),e.invalidateQueries({queryKey:["dashboard-status"]})}catch(Qe){e.invalidateQueries({queryKey:["dashboard-status"]}),p(Qe instanceof Error?Qe.message:String(Qe))}finally{h(null)}},[e]);z.useEffect(()=>{if(v===null)return;const H=new EventSource(`/api/jobs/${v}/session/stream`);return H.addEventListener("session_event",ve=>{const Qe=br(ve);Qe&&(e.setQueryData(["job-session-events",v],At=>({events:df((At==null?void 0:At.events)??[],Qe)})),pf(Qe.event_type)&&(e.invalidateQueries({queryKey:["job",v]}),e.invalidateQueries({queryKey:["jobs"]})))}),H.addEventListener("transcript_entry",ve=>{const Qe=br(ve);!Qe||Qe.job_id!==v||e.setQueryData(["job-session-transcript",v],At=>({entries:hf((At==null?void 0:At.entries)??[],Qe.entry)}))}),H.onerror=()=>{e.invalidateQueries({queryKey:["job",v]}),e.invalidateQueries({queryKey:["job-session-events",v]}),e.invalidateQueries({queryKey:["job-session-transcript",v]})},()=>H.close()},[v,e]),z.useEffect(()=>{const H=()=>{w(window.location.pathname)};return window.addEventListener("popstate",H),()=>window.removeEventListener("popstate",H)},[]);const ct=z.useCallback(H=>{window.history.pushState({},"",Vn(H)),w(window.location.pathname)},[]),It=z.useCallback(H=>{window.history.pushState({},"",H),w(window.location.pathname)},[]),dt=((Yn=F.data)==null?void 0:Yn.metrics.status_counts)??{},Kt=((Zn=_.data)==null?void 0:Zn.jobs)??[],Rr=z.useCallback(H=>{n(H),i(la),s.current=!1},[]);z.useEffect(()=>{_.isFetching||(s.current=!1)},[_.isFetching]);const Gn=z.useCallback(()=>{s.current||(s.current=!0,i(H=>H+Wp))},[]),He=v?((er=ce.data)==null?void 0:er.job)??null:null,Jn=Kt.some(H=>H.status==="running"||H.status==="pending")||(He==null?void 0:He.status)==="running"||(He==null?void 0:He.status)==="pending"||!!((tr=K.data)!=null&&tr.running_jobs.length),Tt=nf(Jn),Wn=a.jsx(_f,{selectedJobId:v,selectedJob:He,loading:ce.isLoading,error:ce.error,session:(j=pe.data)==null?void 0:j.session,sessionEvents:(I=m.data)==null?void 0:I.events,transcript:(U=ae.data)==null?void 0:U.entries,now:Tt});return a.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[a.jsx("header",{className:"border-b border-slate-800 bg-slate-950 text-white",children:a.jsxs("div",{className:"mx-auto flex w-full max-w-[1440px] items-center justify-between gap-3 px-4 py-4 md:px-6",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("h1",{className:"truncate text-xl font-semibold",children:"GitHub Agent Bridge"}),a.jsx(yf,{about:D.data})]}),a.jsx(zf,{user:(G=A.data)==null?void 0:G.user,loading:A.isLoading})]})}),a.jsxs("main",{className:"mx-auto grid w-full max-w-[1440px] gap-4 px-3 py-4 sm:px-4 md:px-6 md:py-5",children:[a.jsx(Sf,{isDashboardRoute:E,isSystemRoute:C,isKnowledgeRoute:S,isMcpRoute:N,knowledgeBadgeCount:((Je=(Ee=(Y=T.data)==null?void 0:Y.metrics)==null?void 0:Ee.knowledge)==null?void 0:Je.proposed)??0,onNavigate:It}),k!==null?a.jsx(Ef,{jobId:k,detail:Wn,selectedJob:He,user:(ze=A.data)==null?void 0:ze.user,onBackToDashboard:()=>It("/"),onRetry:De,onDismiss:x,onRefresh:()=>{ce.refetch(),pe.refetch(),m.refetch(),ae.refetch()}}):S?a.jsx(Pf,{data:V.data,loading:V.isLoading,error:V.error,repo:o,status:u,user:(ht=A.data)==null?void 0:ht.user,now:Tt,onRepoChange:l,onStatusChange:c,onApprove:H=>Ce(H,"approve"),onReject:H=>Ce(H,"reject"),onUpdateRuleScope:he,onDeleteRule:rt,onRefresh:()=>V.refetch()}):N?a.jsx(Lf,{tokens:(pt=te.data)==null?void 0:pt.tokens,loading:te.isLoading,error:te.error,user:(be=A.data)==null?void 0:be.user,dashboardUrl:(it=T.data)==null?void 0:it.dashboard_url,dashboardUrlSource:(Be=T.data)==null?void 0:Be.dashboard_url_source,now:Tt,onCreate:Rt,onRevoke:Ve,onRefresh:()=>te.refetch()}):C?a.jsx(Cf,{processes:K.data,processesLoading:K.isLoading,processesError:K.error,systemd:O.data,systemdLoading:O.isLoading,systemdError:O.error,alerts:(Xi=R.data)==null?void 0:Xi.alerts,alertsLoading:R.isLoading,alertsError:R.error,now:Tt,onRefreshProcesses:()=>K.refetch(),onRefreshSystemd:()=>O.refetch(),onRefreshAlerts:()=>R.refetch()}):a.jsxs(a.Fragment,{children:[F.error?a.jsx(Se,{tone:"error",text:F.error.message}):null,T.error?a.jsx(Se,{tone:"error",text:T.error.message}):null,a.jsx(wf,{state:(Yi=T.data)==null?void 0:Yi.autoupdate,isAdmin:!!((es=(Zi=A.data)==null?void 0:Zi.user)!=null&&es.is_admin),runningAction:d,actionError:f,onRefresh:()=>Ge("refresh"),onApply:()=>Ge("apply"),onCompletePending:()=>Ge("complete")}),a.jsxs("section",{className:"grid grid-cols-2 gap-3 xl:grid-cols-4","aria-label":"Summary metrics",children:[a.jsx(Ct,{title:"Pending",value:dt.pending??0,icon:a.jsx($a,{className:"h-5 w-5"})}),a.jsx(Ct,{title:"Running",value:dt.running??0,icon:a.jsx(Ua,{className:"h-5 w-5"})}),a.jsx(Ct,{title:"Blocked",value:dt.blocked??0,icon:a.jsx(Ti,{className:"h-5 w-5"})}),a.jsx(Ct,{title:"Done",value:dt.done??0,icon:a.jsx(dn,{className:"h-5 w-5"})})]}),a.jsxs("section",{className:"grid gap-3",children:[a.jsx(Bf,{count:Kt.length,limit:r,loading:_.isLoading,onRefresh:()=>_.refetch()}),a.jsxs(Ie,{title:"Recent jobs",flushHeader:!0,children:[a.jsx(qf,{filters:t,actorOptions:((ts=L.data)==null?void 0:ts.actors)??[],onChange:Rr}),_.error?a.jsx(Se,{tone:"error",text:_.error.message}):null,a.jsx($f,{jobs:Kt,loading:_.isLoading,loadingMore:_.isFetching&&!_.isLoading,hasMore:Kt.length>=r,onLoadMore:Gn,onViewJob:ct,now:Tt,user:(ns=A.data)==null?void 0:ns.user,onRetry:De,onDismiss:x})]}),a.jsx(Ie,{title:"Runtime usage",action:a.jsx(ut,{onClick:()=>F.refetch()}),children:a.jsx(em,{usage:(rs=F.data)==null?void 0:rs.metrics.runtime_usage,loading:F.isLoading,totalJobs:fa(dt)})})]}),a.jsxs("section",{className:"grid gap-4 xl:grid-cols-3",children:[a.jsx(Ie,{title:"Runtime percentiles",children:a.jsx(pa,{label:"runtime",values:(is=F.data)==null?void 0:is.metrics.runtime_seconds})}),a.jsx(Ie,{title:"Jobs per day",children:a.jsx(Zf,{values:(ss=F.data)==null?void 0:ss.metrics.by_created_day,loading:F.isLoading,totalJobs:fa(dt)})}),a.jsx(Ie,{title:"Queue wait percentiles",children:a.jsx(pa,{label:"queue wait",values:(as=F.data)==null?void 0:as.metrics.queue_wait_seconds})})]})]})]})]})}function yf({about:e}){const t=e!=null&&e.version?`v${e.version}`:"version loading";return a.jsxs("p",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-slate-300",children:[a.jsx("span",{children:"Operational dashboard"}),a.jsx("span",{className:"font-mono text-xs text-slate-400",children:t}),e!=null&&e.repository_url?a.jsxs("a",{className:"inline-flex items-center gap-1 text-xs font-semibold text-slate-200 hover:underline",href:_t(e.repository_url),rel:"noreferrer",target:"_blank",children:[a.jsx(Mn,{className:"h-3.5 w-3.5","aria-hidden":!0}),"GitHub"]}):null]})}function wf({state:e,isAdmin:t,runningAction:n=null,actionError:r="",onRefresh:i,onApply:s,onCompletePending:o}){var k,b,S,N,C,E,v,F,T,A,D;if(!e)return null;const l=(b=(k=e==null?void 0:e.target)==null?void 0:k.tag_name)==null?void 0:b.trim();if(!t||!l||(e==null?void 0:e.decision)==="noop")return null;const u=vf(e.decision),c=((S=e.queue)==null?void 0:S.active_total)??0,d=kf((N=e.classification)==null?void 0:N.risk),h=jf((C=e.target)==null?void 0:C.body),f=((v=(E=e.classification)==null?void 0:E.migration_files)==null?void 0:v.length)??0,p=((T=(F=e.classification)==null?void 0:F.risky_files)==null?void 0:T.length)??0,y=!!(e.executor_reload_pending&&e.dashboard_applied_at&&o),w=!!(s&&f===0);return a.jsxs("section",{className:"rounded-md border border-amber-300 bg-amber-50 p-3 text-amber-950 shadow-sm","aria-label":"Update available",children:[a.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(Ti,{className:"h-4 w-4 text-amber-700","aria-hidden":!0}),a.jsx("h2",{className:"text-sm font-semibold",children:"Update available"}),a.jsx("span",{className:"rounded-sm border border-amber-300 bg-white px-1.5 py-0.5 font-mono text-[11px] text-amber-800",children:l}),(A=e.target)!=null&&A.url?a.jsxs("a",{className:"inline-flex items-center gap-1 text-xs font-semibold text-amber-800 hover:underline",href:_t(e.target.url),rel:"noreferrer",target:"_blank",children:[a.jsx(Mn,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Release"]}):null]}),a.jsxs("p",{className:"mt-1 text-sm text-amber-900",children:[u,e.installed_tag?a.jsxs("span",{className:"font-mono",children:[" from ",e.installed_tag]}):null]}),a.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[i?a.jsxs("button",{className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-md border border-amber-300 bg-white px-2.5 text-xs font-semibold text-amber-900 hover:bg-amber-100 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:n!==null,onClick:i,children:[a.jsx(Ha,{className:re("h-3.5 w-3.5",n==="refresh"&&"animate-spin"),"aria-hidden":!0}),n==="refresh"?"Checking...":"Check now"]}):null,w?a.jsxs("button",{className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-md bg-amber-800 px-2.5 text-xs font-semibold text-white hover:bg-amber-900 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:n!==null,onClick:()=>{window.confirm(`Apply ${l}? This can restart bridge services according to the recorded safe plan.`)&&(s==null||s())},children:[a.jsx(dn,{className:"h-3.5 w-3.5","aria-hidden":!0}),n==="apply"?"Applying...":"Apply update"]}):null,y?a.jsxs("button",{className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-md border border-amber-300 bg-white px-2.5 text-xs font-semibold text-amber-900 hover:bg-amber-100 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:n!==null,onClick:o,children:[a.jsx(Sr,{className:"h-3.5 w-3.5","aria-hidden":!0}),n==="complete"?"Completing...":"Complete reload"]}):null]})]}),a.jsxs("div",{className:"grid gap-2 text-xs sm:grid-cols-3 lg:min-w-[420px]",children:[a.jsx(Vr,{label:"Impact",value:d}),a.jsx(Vr,{label:"Active jobs",value:String(c)}),a.jsx(Vr,{label:"Admin only",value:"autoupdate"})]})]}),e.blocked_reason||e.executor_reload_pending||f>0||p>0?a.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-xs",children:[e.executor_reload_pending?a.jsx("span",{className:"rounded-sm border border-amber-300 bg-white px-2 py-1 font-semibold",children:"executor reload pending"}):null,e.blocked_reason?a.jsx("span",{className:"rounded-sm border border-amber-300 bg-white px-2 py-1 font-mono",children:e.blocked_reason}):null,f>0?a.jsxs("span",{className:"rounded-sm border border-amber-300 bg-white px-2 py-1",children:[f," migration file",f===1?"":"s"]}):null,p>0?a.jsxs("span",{className:"rounded-sm border border-amber-300 bg-white px-2 py-1",children:[p," executor/shared file",p===1?"":"s"]}):null]}):null,h?a.jsxs("div",{className:"mt-3 rounded-md border border-amber-200 bg-white/70 p-2.5",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase text-amber-800",children:"Changelog preview"}),a.jsx(Nf,{markdown:h})]}):null,(D=e.warnings)!=null&&D.length?a.jsx("div",{className:"mt-2 font-mono text-xs text-amber-800",children:e.warnings[0]}):null,r?a.jsxs("div",{className:"mt-2 rounded-sm border border-amber-300 bg-white px-2 py-1 font-mono text-xs text-amber-900",children:["Action failed: ",r]}):null]})}function Vr({label:e,value:t}){return a.jsxs("div",{className:"min-w-0 rounded-md border border-amber-200 bg-white/80 px-2 py-1.5",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase text-amber-700",children:e}),a.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-amber-950",children:t})]})}function vf(e){return{stage_dashboard_reload:"Dashboard reload can be staged now",stage_defer_executor_reload:"Dashboard reload can be staged; executor reload waits for the queue",stage_full_reload:"Full reload can be staged now",defer_migration:"Migration release is waiting for a quiet queue"}[e??""]??"Update plan recorded"}function kf(e){return{dashboard_only:"dashboard only",executor_or_queue:"executor or queue",executor_or_shared:"executor or shared",migration_required:"migration",none:"none"}[e??""]??"unknown"}function jf(e){return(e??"").trim()}function Nf({markdown:e}){return a.jsx("div",{className:"mt-1 text-sm leading-relaxed text-amber-950",children:a.jsx(hp,{allowedElements:["a","blockquote","code","em","h1","h2","h3","h4","li","ol","p","strong","ul"],components:{a:({href:t,children:n})=>a.jsx("a",{className:"font-semibold text-amber-800 underline underline-offset-2",href:_t(t??""),rel:"noreferrer",target:"_blank",children:n}),blockquote:({children:t})=>a.jsx("blockquote",{className:"mt-2 border-l-2 border-amber-300 pl-2 text-amber-900",children:t}),code:({children:t})=>a.jsx("code",{className:"rounded-sm bg-amber-100 px-1 py-0.5 font-mono text-[0.85em] text-amber-950",children:t}),h1:({children:t})=>a.jsx("h3",{className:"mt-2 text-sm font-semibold text-amber-950 first:mt-0",children:t}),h2:({children:t})=>a.jsx("h3",{className:"mt-2 text-sm font-semibold text-amber-950 first:mt-0",children:t}),h3:({children:t})=>a.jsx("h3",{className:"mt-2 text-sm font-semibold text-amber-950 first:mt-0",children:t}),h4:({children:t})=>a.jsx("h4",{className:"mt-2 text-xs font-semibold uppercase text-amber-800 first:mt-0",children:t}),li:({children:t})=>a.jsx("li",{className:"break-words pl-0.5 [overflow-wrap:anywhere]",children:t}),ol:({children:t})=>a.jsx("ol",{className:"mt-1 list-decimal space-y-1 pl-5 first:mt-0",children:t}),p:({children:t})=>a.jsx("p",{className:"mt-1 break-words [overflow-wrap:anywhere] first:mt-0",children:t}),strong:({children:t})=>a.jsx("strong",{className:"font-semibold",children:t}),em:({children:t})=>a.jsx("em",{className:"italic",children:t}),ul:({children:t})=>a.jsx("ul",{className:"mt-1 list-disc space-y-1 pl-5 first:mt-0",children:t})},children:e})})}function Sf({isDashboardRoute:e,isSystemRoute:t=!1,isKnowledgeRoute:n,isMcpRoute:r=!1,knowledgeBadgeCount:i=0,onNavigate:s}){return a.jsxs("nav",{className:"flex min-w-0 rounded-lg border border-border bg-panel p-1 shadow-sm","aria-label":"Dashboard sections",children:[a.jsxs(lr,{href:"/",active:e,onNavigate:s,children:[a.jsx(Ka,{className:"h-4 w-4","aria-hidden":!0}),a.jsx("span",{children:"Jobs"})]}),a.jsxs(lr,{href:"/system",active:t,onNavigate:s,children:[a.jsx(Ql,{className:"h-4 w-4","aria-hidden":!0}),a.jsx("span",{children:"System"})]}),a.jsxs(lr,{href:"/knowledge",active:n,onNavigate:s,children:[a.jsx(Ii,{className:"h-4 w-4","aria-hidden":!0}),a.jsx("span",{children:"Knowledge"}),i>0?a.jsx("span",{className:re("inline-flex h-5 min-w-5 items-center justify-center rounded-full border px-1 font-mono text-[11px] leading-none",n?"border-white/40 bg-white/15 text-white":"border-amber-200 bg-amber-100 text-amber-800"),"aria-label":`${i} proposed knowledge ${i===1?"item":"items"}`,children:i}):null]}),a.jsxs(lr,{href:"/mcp",active:r,onNavigate:s,children:[a.jsx(Cn,{className:"h-4 w-4","aria-hidden":!0}),a.jsx("span",{children:"MCP"})]})]})}function Cf({processes:e,processesLoading:t,processesError:n,systemd:r,systemdLoading:i,systemdError:s,alerts:o,alertsLoading:l,alertsError:u,now:c,onRefreshProcesses:d,onRefreshSystemd:h,onRefreshAlerts:f}){return a.jsxs("section",{className:"grid gap-4","aria-label":"Bridge system",children:[a.jsxs(Ie,{title:"Systemd",action:a.jsx(ut,{onClick:h}),children:[s?a.jsx(Se,{tone:"error",text:s.message}):null,a.jsx(nm,{data:r,loading:i})]}),a.jsxs(Ie,{title:"Process activity",action:a.jsx(ut,{onClick:d}),children:[n?a.jsx(Se,{tone:"error",text:n.message}):null,a.jsx(sm,{data:e,loading:t})]}),a.jsxs(Ie,{title:"Monitor alerts",action:a.jsx(ut,{onClick:f}),children:[u?a.jsx(Se,{tone:"error",text:u.message}):null,a.jsx(am,{alerts:o,loading:l,now:c})]})]})}function lr({href:e,active:t,children:n,onNavigate:r}){return a.jsx("a",{className:re("inline-flex h-8 min-w-0 flex-1 items-center justify-center gap-1 rounded-md px-1.5 text-xs font-semibold sm:flex-none sm:gap-1.5 sm:px-3 sm:text-sm [&>span]:truncate [&>svg]:shrink-0",t?"bg-primary text-white shadow-sm":"text-muted hover:bg-slate-50 hover:text-foreground"),href:e,onClick:i=>{!r||i.defaultPrevented||i.button!==0||i.metaKey||i.ctrlKey||i.altKey||i.shiftKey||(i.preventDefault(),r(e))},children:n})}function Ef({jobId:e,detail:t,selectedJob:n,user:r,onBackToDashboard:i,onRetry:s,onDismiss:o,onRefresh:l}){const[u,c]=z.useState(!1),[d,h]=z.useState(!1),f=!!(r!=null&&r.is_admin&&n&&Sn(n.status)),p=u?"Retrying...":"Retry",y=d?"Dismissing...":"Dismiss";return a.jsxs("div",{className:"grid min-w-0 gap-3 sm:gap-4",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("a",{className:"inline-flex h-9 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-foreground hover:bg-slate-50",href:"/",onClick:w=>{w.defaultPrevented||w.button!==0||w.metaKey||w.ctrlKey||w.altKey||w.shiftKey||(w.preventDefault(),i())},children:[a.jsx($l,{className:"h-4 w-4","aria-hidden":!0}),"Dashboard"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[f?a.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary px-3 text-sm font-semibold text-white disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:u,onClick:async()=>{if(window.confirm(`Retry job #${e}?`)){c(!0);try{await s(e)}finally{c(!1)}}},children:[a.jsx(Sr,{className:"h-4 w-4","aria-hidden":!0}),p]}):null,f?a.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 rounded-md border border-border bg-white px-3 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:d,onClick:async()=>{if(window.confirm(`Dismiss job #${e}?`)){h(!0);try{await o(e)}finally{h(!1)}}},children:[a.jsx(dn,{className:"h-4 w-4","aria-hidden":!0}),y]}):null,a.jsx(ut,{onClick:l})]})]}),a.jsx(Ie,{title:`Job #${e}`,className:"p-3 sm:p-4",children:t})]})}function _f({selectedJobId:e,selectedJob:t,loading:n,error:r,session:i,sessionEvents:s,transcript:o,now:l}){return t?a.jsx(Wf,{job:t,session:i,sessionEvents:s,transcript:o,now:l}):e!==null&&n?a.jsx(Z,{text:"Loading selected job..."}):e!==null&&r?a.jsx(Se,{tone:"error",text:`Job #${e}: ${r.message}`}):a.jsx(Z,{text:"Select a job to inspect its timeline, worklog and GitHub links."})}function Pf({data:e,loading:t,error:n,repo:r,status:i,user:s,now:o,onRepoChange:l,onStatusChange:u,onApprove:c,onReject:d,onUpdateRuleScope:h,onDeleteRule:f,onRefresh:p}){const y=(e==null?void 0:e.summary)??{},[w,k]=z.useState("proposals"),b=[{id:"proposals",label:"Proposals",count:(e==null?void 0:e.proposals.length)??0},{id:"rules",label:"Rules",count:(e==null?void 0:e.rules.length)??0},{id:"events",label:"Events",count:(e==null?void 0:e.events.length)??0}];return a.jsxs("div",{className:"grid min-w-0 gap-4",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("h2",{className:"flex items-center gap-2 text-base font-semibold",children:[a.jsx(Ii,{className:"h-5 w-5 text-muted","aria-hidden":!0}),"Acquired knowledge"]}),a.jsx("p",{className:"text-xs text-muted",children:"Captured feedback, proposed rules and curated agent memory."})]}),a.jsx(ut,{onClick:p})]}),n?a.jsx(Se,{tone:"error",text:n.message}):null,a.jsxs("section",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4","aria-label":"Knowledge metrics",children:[a.jsx(Ct,{title:"Proposed",value:y.proposed??0,icon:a.jsx($a,{className:"h-5 w-5"})}),a.jsx(Ct,{title:"Approved",value:y.approved??0,icon:a.jsx(dn,{className:"h-5 w-5"})}),a.jsx(Ct,{title:"Rules",value:y.rules??0,icon:a.jsx(Qa,{className:"h-5 w-5"})}),a.jsx(Ct,{title:"Events",value:y.events??0,icon:a.jsx(Ua,{className:"h-5 w-5"})})]}),a.jsx(Ie,{title:"Filters",className:"p-3",children:a.jsxs("div",{className:re("grid gap-3",w==="proposals"?"md:grid-cols-[minmax(0,1fr)_220px]":"md:grid-cols-[minmax(0,1fr)]"),children:[a.jsx(et,{label:"Repository",children:a.jsxs("select",{className:"control",value:r,onChange:S=>l(S.target.value),children:[a.jsx("option",{value:"",children:"All repositories"}),((e==null?void 0:e.repositories)??[]).map(S=>a.jsx("option",{value:S,children:S},S))]})}),w==="proposals"?a.jsx(et,{label:"Proposal status",children:a.jsxs("select",{className:"control",value:i,onChange:S=>u(S.target.value),children:[a.jsx("option",{value:"",children:"All statuses"}),a.jsx("option",{value:"proposed",children:"proposed"}),a.jsx("option",{value:"approved",children:"approved"}),a.jsx("option",{value:"rejected",children:"rejected"}),a.jsx("option",{value:"error",children:"error"})]})}):null]})}),a.jsxs(Ie,{title:"Knowledge records",action:a.jsx("div",{className:"flex max-w-full flex-wrap rounded-md border border-border bg-white p-0.5",role:"tablist","aria-label":"Knowledge record type",children:b.map(S=>a.jsxs("button",{className:re("inline-flex h-8 items-center gap-1.5 rounded px-2.5 text-xs font-semibold",w===S.id?"bg-primary text-white":"text-muted hover:bg-slate-50 hover:text-foreground"),type:"button",role:"tab","aria-label":`${S.label} (${S.count})`,"aria-selected":w===S.id,onClick:()=>k(S.id),children:[a.jsx("span",{children:S.label}),a.jsx("span",{className:re("rounded-sm border px-1 font-mono text-[10px]",w===S.id?"border-white/40 text-white":"border-border text-muted"),children:S.count})]},S.id))}),children:[w==="proposals"?a.jsx(Rf,{proposals:(e==null?void 0:e.proposals)??[],loading:t,isAdmin:!!(s!=null&&s.is_admin),now:o,onApprove:c,onReject:d}):null,w==="rules"?a.jsx(Af,{rules:(e==null?void 0:e.rules)??[],loading:t,isAdmin:!!(s!=null&&s.is_admin),now:o,onUpdateRuleScope:h,onDeleteRule:f}):null,w==="events"?a.jsx(Mf,{events:(e==null?void 0:e.events)??[],loading:t,now:o}):null]})]})}function Rf({proposals:e,loading:t,isAdmin:n,now:r,onApprove:i,onReject:s}){const[o,l]=z.useState(null);return t&&e.length===0?a.jsx(Z,{text:"Loading proposals..."}):e.length===0?a.jsx(Z,{text:"No proposals match the current filters."}):a.jsx("div",{className:"grid gap-2",children:e.map(u=>a.jsxs("article",{className:"grid min-w-0 gap-2 rounded-md border border-border bg-white p-3",children:[a.jsx(zo,{scope:u.scope,type:u.type,confidence:u.confidence,status:u.status,timestamp:u.updated_at,now:r}),a.jsx("p",{className:"min-w-0 break-words text-sm font-medium [overflow-wrap:anywhere]",children:u.rule||u.reason||"No reusable rule proposed."}),u.reason?a.jsx("p",{className:"min-w-0 break-words text-xs text-muted [overflow-wrap:anywhere]",children:u.reason}):null,u.source_event?a.jsx(If,{event:u.source_event}):a.jsxs("p",{className:"font-mono text-xs text-muted",children:["Source event ",u.event_id]}),u.error?a.jsx(Se,{tone:"error",text:u.error}):null,n&&u.status==="proposed"?a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md bg-primary px-3 text-sm font-semibold text-white disabled:opacity-60",type:"button",disabled:o===u.id,onClick:async()=>{l(u.id);try{await i(u.id)}finally{l(null)}},children:[a.jsx(dn,{className:"h-4 w-4","aria-hidden":!0}),"Approve"]}),a.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:opacity-60",type:"button",disabled:o===u.id,onClick:async()=>{l(u.id);try{await s(u.id)}finally{l(null)}},children:[a.jsx(Cr,{className:"h-4 w-4","aria-hidden":!0}),"Reject"]})]}):null]},u.id))})}function If({event:e}){const t=e.trigger_actor||(e.actor!=="github"?e.actor:null);return a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 rounded-md border border-border bg-slate-50 px-2 py-1.5",children:[a.jsx(mn,{actor:t,avatarUrl:e.trigger_actor_avatar_url,framed:!0}),e.source_job_id?a.jsxs("a",{className:"inline-flex h-7 items-center gap-1 rounded-md border border-border bg-white px-2 text-xs font-semibold text-foreground hover:bg-slate-50",href:Vn(e.source_job_id),children:[a.jsx(Nr,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Job #",e.source_job_id]}):null,e.github_urls.length>0?a.jsx(On,{urls:e.github_urls,compact:!0}):a.jsx("span",{className:"font-mono text-xs text-muted",children:"No GitHub link"})]})}function Tf(e){const t=[{value:"global",label:"global"}];if(e.startsWith("repo:")){const n=e.slice(5),[r,i]=n.split("/",2);r&&i&&(t.push({value:`org:${r}`,label:`org:${r}`}),t.push({value:`repo:${r}/${i}`,label:`repo:${r}/${i}`}))}else e.startsWith("org:")&&t.push({value:e,label:e});return t.some(n=>n.value===e)||t.push({value:e,label:e}),t}function Af({rules:e,loading:t,isAdmin:n,now:r,onUpdateRuleScope:i,onDeleteRule:s}){const[o,l]=z.useState(null),[u,c]=z.useState(null),[d,h]=z.useState("");return t&&e.length===0?a.jsx(Z,{text:"Loading curated rules..."}):e.length===0?a.jsx(Z,{text:"No curated rules match the current filters."}):a.jsx("div",{className:"grid gap-2",children:e.map(f=>{const p=f.source_event_details??[],y=p[0],w=y?y.trigger_actor||(y.actor!=="github"?y.actor:null):null,k=p.flatMap(C=>C.github_urls??[]),b=Tf(f.scope),S=u===f.id,N=o===f.id;return a.jsxs("article",{className:"grid min-w-0 gap-2 rounded-md border border-border bg-white p-3",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsx(zo,{scope:f.scope,type:f.type,confidence:f.confidence,status:`${f.observations} observation${f.observations===1?"":"s"}`,timestamp:f.last_seen,now:r}),n?a.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[S?a.jsxs(a.Fragment,{children:[a.jsx(et,{label:"Scope",children:a.jsx("select",{className:"control h-8 min-w-[180px] py-1 text-xs",value:d,disabled:N,onChange:C=>h(C.target.value),children:b.map(C=>a.jsx("option",{value:C.value,children:C.label},C.value))})}),a.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:opacity-60",type:"button",disabled:N||d===f.scope,title:"Save scope",onClick:async()=>{if(d!==f.scope){l(f.id);try{await i(f.id,d),c(null)}finally{l(null)}}},children:[a.jsx(Vl,{className:"h-4 w-4","aria-hidden":!0}),"Save"]}),a.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-muted hover:bg-slate-50 disabled:opacity-60",type:"button",disabled:N,title:"Cancel scope edit",onClick:()=>{c(null),h("")},children:[a.jsx(Cr,{className:"h-4 w-4","aria-hidden":!0}),"Cancel"]})]}):a.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:opacity-60",type:"button",disabled:N,title:"Edit scope",onClick:()=>{c(f.id),h(f.scope)},children:[a.jsx(Kl,{className:"h-4 w-4","aria-hidden":!0}),"Edit"]}),a.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-red-200 px-3 text-sm font-semibold text-red-700 hover:bg-red-50 disabled:opacity-60",type:"button",disabled:N,onClick:async()=>{if(window.confirm("Delete this curated rule?")){l(f.id);try{await s(f.id)}finally{l(null)}}},children:[a.jsx(ci,{className:"h-4 w-4","aria-hidden":!0}),"Delete"]})]}):null]}),a.jsx("p",{className:"min-w-0 break-words text-sm font-medium [overflow-wrap:anywhere]",children:f.rule}),a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[a.jsx(mn,{actor:w,avatarUrl:y==null?void 0:y.trigger_actor_avatar_url,framed:!0}),y!=null&&y.source_job_id?a.jsxs("a",{className:"inline-flex h-7 items-center gap-1 rounded-md border border-border px-2 text-xs font-semibold text-foreground hover:bg-white",href:Vn(y.source_job_id),children:[a.jsx(Nr,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Job #",y.source_job_id]}):null,k.length>0?a.jsx(On,{urls:k,compact:!0}):a.jsx("span",{className:"font-mono text-xs text-muted",children:"No GitHub link"})]})]},f.id)})})}function Mf({events:e,loading:t,now:n}){return t&&e.length===0?a.jsx(Z,{text:"Loading captured events..."}):e.length===0?a.jsx(Z,{text:"No captured feedback events match the current filters."}):a.jsx("div",{className:"grid gap-2",children:e.map(r=>{const i=r.trigger_actor||(r.actor!=="github"?r.actor:null);return a.jsxs("details",{className:"group rounded-md border border-border bg-white",children:[a.jsxs("summary",{className:"grid cursor-pointer list-none gap-2 px-3 py-2 marker:hidden hover:bg-slate-50",children:[a.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[a.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2 font-mono text-xs font-semibold text-muted",children:[a.jsx($n,{className:"h-3.5 w-3.5 shrink-0 transition-transform group-open:rotate-180","aria-hidden":!0}),a.jsx("span",{className:"truncate",children:Do(r.scope)})]}),a.jsx("span",{className:"shrink-0 font-mono text-xs text-muted",children:a.jsx(Ne,{value:r.occurred_at,relative:!0,now:n})})]}),a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[a.jsx(mn,{actor:i,avatarUrl:r.trigger_actor_avatar_url,framed:!0}),r.source_job_id?a.jsxs("a",{className:"inline-flex h-7 items-center gap-1 rounded-md border border-border px-2 text-xs font-semibold text-foreground hover:bg-white",href:Vn(r.source_job_id),children:[a.jsx(Nr,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Job #",r.source_job_id]}):null,r.github_urls.length>0?a.jsx(On,{urls:r.github_urls,compact:!0}):a.jsx("span",{className:"font-mono text-xs text-muted",children:"No GitHub link"})]}),a.jsx("p",{className:"line-clamp-2 break-words text-sm [overflow-wrap:anywhere]",children:r.comment})]}),a.jsxs("div",{className:"grid gap-2 border-t border-border px-3 py-2",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"mb-1 text-xs font-semibold text-muted",children:"GitHub links"}),r.github_urls.length>0?a.jsx(On,{urls:r.github_urls}):a.jsx("p",{className:"text-xs text-muted",children:"No links recorded."})]}),a.jsx("pre",{className:"max-h-72 overflow-auto rounded-md bg-slate-950 px-3 py-2 font-mono text-xs leading-relaxed text-slate-100",children:JSON.stringify(r.context,null,2)})]})]},r.id)})})}function Lf({tokens:e,loading:t,error:n,user:r,dashboardUrl:i,dashboardUrlSource:s,now:o,onCreate:l,onRevoke:u,onRefresh:c}){const[d,h]=z.useState(""),[f,p]=z.useState(!1),[y,w]=z.useState(null),[k,b]=z.useState(null),[S,N]=z.useState(""),C=e??[],E=(i||(typeof window>"u"?"":window.location.origin)).replace(/\/$/,""),v=`${E}/mcp`,F=`${E}/api/mcp`;return r&&!r.is_admin?a.jsxs("div",{className:"grid min-w-0 gap-4",children:[a.jsx(ha,{icon:a.jsx(Cn,{className:"h-5 w-5 text-muted","aria-hidden":!0}),title:"MCP access",subtitle:"Read-only agent access is limited to dashboard admins.",action:a.jsx(ut,{onClick:c})}),a.jsx(Z,{text:"Admin access is required to manage MCP tokens."})]}):a.jsxs("div",{className:"grid min-w-0 gap-4",children:[a.jsx(ha,{icon:a.jsx(Cn,{className:"h-5 w-5 text-muted","aria-hidden":!0}),title:"MCP access",subtitle:"Issue and revoke read-only tokens for agents.",action:a.jsx(ut,{onClick:c})}),n?a.jsx(Se,{tone:"error",text:n.message}):null,S?a.jsx(Se,{tone:"error",text:S}):null,a.jsx(Of,{dashboardUrl:v,endpointUrl:F,dashboardUrlSource:s??"request"}),k?a.jsxs("section",{className:"rounded-md border border-emerald-300 bg-emerald-50 p-3 text-emerald-950","aria-label":"Created MCP token",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold",children:"Token created"}),a.jsx("p",{className:"mt-1 text-xs text-emerald-800",children:"This secret is shown once. Store it in the local agent environment before leaving this page."})]}),a.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-emerald-300 bg-white px-3 text-sm font-semibold text-emerald-900 hover:bg-emerald-100",type:"button",onClick:()=>b(null),children:[a.jsx(Cr,{className:"h-4 w-4","aria-hidden":!0}),"Hide"]})]}),a.jsx("pre",{className:"mt-3 overflow-auto rounded bg-emerald-950 px-3 py-2 font-mono text-xs text-emerald-50",children:k.token})]}):null,a.jsx(Ie,{title:"Create token",children:a.jsxs("form",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_auto]",onSubmit:async T=>{T.preventDefault();const A=d.trim();if(A){p(!0),N("");try{const D=await l(A);b(D),h("")}catch(D){N(D instanceof Error?D.message:String(D))}finally{p(!1)}}},children:[a.jsx(et,{label:"Token name",children:a.jsx("input",{className:"control",value:d,placeholder:"local agent",disabled:f,onChange:T=>h(T.target.value)})}),a.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 self-end rounded-md bg-primary px-3 text-sm font-semibold text-white disabled:cursor-not-allowed disabled:opacity-60",type:"submit",disabled:f||!d.trim(),children:[a.jsx(Cn,{className:"h-4 w-4","aria-hidden":!0}),f?"Creating...":"Create token"]})]})}),a.jsx(Ie,{title:"Active tokens",children:a.jsx(Ff,{tokens:C,loading:t,now:o,revokingId:y,onRevoke:async T=>{if(window.confirm("Revoke this MCP token?")){w(T),N("");try{await u(T)}catch(A){N(A instanceof Error?A.message:String(A))}finally{w(null)}}}})})]})}function Of({dashboardUrl:e,endpointUrl:t,dashboardUrlSource:n}){const r=n==="configured"?"Configured public URL":n==="forwarded"?"Forwarded public URL":"Needs public URL",i=n==="request",s=i?"Set GITHUB_AGENT_BRIDGE_DASHBOARD_PUBLIC_URL or forward X-Forwarded-* headers":e,o=i?"Public dashboard URL required before connecting remote agents":t,u=`{ + "mcpServers": { + "github-agent-bridge": { + "url": "${i?"https://bridge.example.com/api/mcp":t}", + "headers": { + "Authorization": "Bearer \${GITHUB_AGENT_BRIDGE_MCP_TOKEN}" + } + } + } +}`;return a.jsxs(Ie,{title:"Connect an agent",children:[i?a.jsx(Se,{tone:"warning",text:"Set GITHUB_AGENT_BRIDGE_DASHBOARD_PUBLIC_URL, or forward X-Forwarded-* headers from the proxy, before connecting remote agents."}):null,a.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]",children:[a.jsxs("div",{className:"grid min-w-0 gap-3",children:[a.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-white p-3",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm font-semibold",children:[a.jsx(Mn,{className:"h-4 w-4 text-muted","aria-hidden":!0}),"Public dashboard URL",a.jsx("span",{className:"rounded-sm border border-border bg-slate-50 px-1.5 py-0.5 font-mono text-[11px] font-normal text-muted",children:r})]}),a.jsx("p",{className:"mt-1 text-xs text-muted",children:"Share this page URL with bridge admins only after it resolves to the external dashboard origin."}),a.jsx("pre",{className:"mt-3 overflow-auto rounded-md bg-slate-950 px-3 py-2 font-mono text-xs text-slate-100",children:s})]}),a.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-white p-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[a.jsx(Mn,{className:"h-4 w-4 text-muted","aria-hidden":!0}),"HTTP MCP endpoint"]}),a.jsx("p",{className:"mt-1 text-xs text-muted",children:"Remote agents connect directly with a bearer token; no local `gab` binary is required on the agent host."}),a.jsx("pre",{className:"mt-3 overflow-auto rounded-md bg-slate-950 px-3 py-2 font-mono text-xs text-slate-100",children:o})]})]}),a.jsxs("div",{className:"grid min-w-0 gap-3",children:[a.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-white p-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[a.jsx(Cn,{className:"h-4 w-4 text-muted","aria-hidden":!0}),"Agent config"]}),a.jsx("p",{className:"mt-1 text-xs text-muted",children:"Create a token below, then store the one-time secret as `GITHUB_AGENT_BRIDGE_MCP_TOKEN` for the agent."}),a.jsx("pre",{className:"mt-3 max-h-64 overflow-auto rounded-md bg-slate-950 px-3 py-2 font-mono text-xs leading-relaxed text-slate-100",children:u})]}),a.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-white p-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[a.jsx(Ii,{className:"h-4 w-4 text-muted","aria-hidden":!0}),"Agent prompt"]}),a.jsx("p",{className:"mt-1 text-xs text-muted",children:"Ask the agent to use the read-only bridge knowledge server before acting on repository work."}),a.jsx("pre",{className:"mt-3 max-h-40 overflow-auto rounded-md bg-slate-950 px-3 py-2 font-mono text-xs leading-relaxed text-slate-100",children:"Use the github-agent-bridge MCP server for repository knowledge. Query list_repositories and list_knowledge before making repository decisions."})]})]})]})]})}function ha({icon:e,title:t,subtitle:n,action:r}){return a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("h2",{className:"flex items-center gap-2 text-base font-semibold",children:[e,t]}),a.jsx("p",{className:"text-xs text-muted",children:n})]}),r]})}function Ff({tokens:e,loading:t,now:n,revokingId:r,onRevoke:i}){return t&&e.length===0?a.jsx(Z,{text:"Loading MCP tokens..."}):e.length===0?a.jsx(Z,{text:"No active MCP tokens."}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"grid gap-2 md:hidden",children:e.map(s=>a.jsxs("article",{className:"grid min-w-0 gap-3 rounded-md border border-border bg-white p-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"break-words text-sm font-semibold [overflow-wrap:anywhere]",children:s.name}),a.jsx("div",{className:"mt-1 break-all font-mono text-xs text-muted",children:s.id})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[a.jsx(me,{label:"Created",value:a.jsx(Ne,{value:s.created_at,relative:!0,now:n})}),a.jsx(me,{label:"Last used",value:s.last_used_at?a.jsx(Ne,{value:s.last_used_at,relative:!0,now:n}):"never"})]}),a.jsxs("button",{className:"inline-flex h-8 items-center justify-center gap-2 rounded-md border border-red-200 px-3 text-sm font-semibold text-red-700 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:r===s.id,onClick:()=>i(s.id),children:[a.jsx(ci,{className:"h-4 w-4","aria-hidden":!0}),r===s.id?"Revoking...":"Revoke"]})]},s.id))}),a.jsx("div",{className:"hidden overflow-auto rounded-md border border-border md:block",children:a.jsxs("table",{className:"min-w-full border-collapse text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-slate-50 text-left text-xs text-muted",children:[a.jsx("th",{className:"px-3 py-2 font-semibold",children:"Name"}),a.jsx("th",{className:"px-3 py-2 font-semibold",children:"Created"}),a.jsx("th",{className:"px-3 py-2 font-semibold",children:"Last used"}),a.jsx("th",{className:"px-3 py-2 font-semibold",children:"ID"}),a.jsx("th",{className:"px-3 py-2 text-right font-semibold",children:"Actions"})]})}),a.jsx("tbody",{children:e.map(s=>a.jsxs("tr",{className:"border-b border-border last:border-b-0",children:[a.jsx("td",{className:"px-3 py-3 font-semibold",children:s.name}),a.jsx("td",{className:"px-3 py-3 font-mono text-xs",children:a.jsx(Ne,{value:s.created_at,relative:!0,now:n})}),a.jsx("td",{className:"px-3 py-3 font-mono text-xs",children:s.last_used_at?a.jsx(Ne,{value:s.last_used_at,relative:!0,now:n}):"never"}),a.jsx("td",{className:"px-3 py-3 font-mono text-xs text-muted",children:s.id}),a.jsx("td",{className:"px-3 py-3 text-right",children:a.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-red-200 px-3 text-sm font-semibold text-red-700 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:r===s.id,onClick:()=>i(s.id),children:[a.jsx(ci,{className:"h-4 w-4","aria-hidden":!0}),r===s.id?"Revoking...":"Revoke"]})})]},s.id))})]})})]})}function On({urls:e,compact:t=!1}){const n=t?e.slice(0,2):e,r=e.length-n.length;return a.jsxs("div",{className:"flex min-w-0 max-w-full flex-wrap gap-1.5",children:[n.map(i=>a.jsxs("a",{className:re("inline-flex max-w-full items-center gap-1 rounded-md border border-border font-semibold text-primary hover:bg-white hover:underline",t?"h-7 px-2 text-xs":"min-h-7 px-2 py-1 text-xs"),href:_t(i),"aria-label":i,rel:"noreferrer",target:"_blank",children:[a.jsx(Mn,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),a.jsx("span",{className:"truncate",children:t?Df(i):i})]},i)),r>0?a.jsxs("span",{className:"inline-flex h-7 items-center rounded-md border border-border px-2 font-mono text-xs text-muted",children:["+",r]}):null]})}function Df(e){try{const t=new URL(e);return t.pathname.replace(/^\//,"")+t.hash}catch{return e}}function zo({scope:e,type:t,confidence:n,status:r,timestamp:i,now:s}){return a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-xs text-muted",children:[a.jsx("span",{className:"truncate font-mono font-semibold text-foreground",children:Do(e)}),a.jsx("span",{className:"rounded-sm border border-border px-1.5 py-0.5 font-mono",children:t}),a.jsxs("span",{className:"rounded-sm border border-border px-1.5 py-0.5 font-mono",children:[Math.round(n*100),"%"]}),a.jsx("span",{className:"rounded-sm border border-border px-1.5 py-0.5 font-mono",children:r}),a.jsx("span",{className:"font-mono",children:a.jsx(Ne,{value:i,relative:!0,now:s})})]})}function zf({user:e,loading:t}){const n=e!=null&&e.login?`@${e.login}`:t?"Loading profile...":"GitHub OAuth",r=e!=null&&e.is_admin?"admin":"read-only",i=e!=null&&e.avatar_url?a.jsx("img",{className:"h-10 w-10 rounded-full border border-slate-700 bg-slate-800",src:e.avatar_url,alt:e.login?`${e.login} avatar`:"",referrerPolicy:"no-referrer"}):a.jsx("span",{className:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-slate-700 bg-slate-900",children:a.jsx(pr,{className:"h-5 w-5","aria-hidden":!0})}),s=e!=null&&e.html_url?a.jsx("a",{className:"truncate font-semibold text-white hover:underline",href:_t(e.html_url),rel:"noreferrer",target:"_blank",children:n}):a.jsx("div",{className:"truncate font-semibold text-white",children:n});return a.jsxs("div",{className:"flex max-w-full shrink-0 items-center gap-3 text-sm text-slate-300","aria-label":e!=null&&e.login?`Signed in as ${e.login}`:"Dashboard account",children:[a.jsx(Qa,{className:"hidden h-4 w-4 shrink-0 sm:block","aria-hidden":!0}),a.jsxs("div",{className:"hidden min-w-0 text-right sm:block",children:[s,a.jsxs("div",{className:"text-xs text-slate-400",children:["Signed in · ",r]})]}),i]})}function Bf({count:e,limit:t,loading:n,onRefresh:r}){return a.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 rounded-lg border border-border bg-white px-3 py-3 shadow-sm md:px-4",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"text-base font-semibold",children:"Jobs"}),a.jsx("p",{className:"text-xs text-muted",children:n?"Refreshing latest jobs...":`Showing ${e} of the latest ${t} requested jobs`})]}),a.jsx(ut,{onClick:r,compactOnMobile:!0})]})}function Ie({title:e,action:t,children:n,className:r,flushHeader:i=!1}){return a.jsxs("section",{className:re("min-w-0 rounded-lg border border-border bg-panel p-4 shadow-sm",r),children:[a.jsxs("div",{className:re("flex flex-wrap items-center justify-between gap-3",!i&&"mb-4"),children:[a.jsx("h2",{className:"text-sm font-semibold",children:e}),t]}),n]})}function Ct({title:e,value:t,icon:n}){return a.jsxs("div",{className:"rounded-lg border border-border bg-panel p-3 shadow-sm md:p-4",children:[a.jsxs("div",{className:"flex items-center justify-between text-muted",children:[a.jsx("span",{className:"text-sm font-medium",children:e}),n]}),a.jsx("strong",{className:"mt-3 block text-2xl leading-none md:mt-4 md:text-3xl",children:t})]})}function qf({filters:e,actorOptions:t,onChange:n}){const[r,i]=z.useState(e);z.useEffect(()=>i(e),[e]);const s=da(e)||da(r),o=()=>{i(ki),n(ki)};return a.jsxs("details",{className:"my-3 rounded-md border border-border bg-slate-50/70",children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2 text-sm font-semibold marker:hidden",children:[a.jsxs("span",{className:"inline-flex items-center gap-2",children:[a.jsx(Hl,{className:"h-4 w-4 text-muted","aria-hidden":!0}),"Filters"]}),a.jsx($n,{className:"h-4 w-4 text-muted","aria-hidden":!0})]}),a.jsxs("form",{className:"grid gap-3 border-t border-border bg-white p-3 md:grid-cols-3 xl:grid-cols-9",onSubmit:l=>{l.preventDefault(),n(r)},children:[a.jsx(et,{label:"Status",children:a.jsxs("select",{className:"control",value:r.status,onChange:l=>i({...r,status:l.target.value}),children:[a.jsx("option",{value:"",children:"All"}),a.jsx("option",{value:"pending",children:"pending"}),a.jsx("option",{value:"running",children:"running"}),a.jsx("option",{value:"blocked",children:"blocked"}),a.jsx("option",{value:"done",children:"done"}),a.jsx("option",{value:"denied",children:"denied"}),a.jsx("option",{value:"waiting_approval",children:"waiting_approval"})]})}),a.jsx(et,{label:"Repository",children:a.jsx("input",{className:"control",value:r.repo,placeholder:"owner/repo",onChange:l=>i({...r,repo:l.target.value})})}),a.jsx(et,{label:"Thread",children:a.jsx("input",{className:"control",value:r.thread,inputMode:"numeric",placeholder:"issue or PR",onChange:l=>i({...r,thread:l.target.value})})}),a.jsx(et,{label:"Action",children:a.jsx("input",{className:"control",value:r.action,placeholder:"reply_comment",onChange:l=>i({...r,action:l.target.value})})}),a.jsx(et,{label:"Actor",className:"xl:col-span-2",children:a.jsx(Uf,{value:r.actor,options:t,onChange:l=>i({...r,actor:l})})}),a.jsx(et,{label:"Intent",children:a.jsxs("select",{className:"control",value:r.intent,onChange:l=>i({...r,intent:l.target.value}),children:[a.jsx("option",{value:"",children:"All"}),a.jsx("option",{value:"review_only",children:"review_only"}),a.jsx("option",{value:"work_allowed",children:"work_allowed"})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 self-end xl:col-span-2",children:[a.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-white",type:"button",disabled:!s,onClick:o,children:[a.jsx(Sr,{className:"h-4 w-4","aria-hidden":!0}),"Clear"]}),a.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary px-3 text-sm font-semibold text-white",type:"submit",children:[a.jsx(Gl,{className:"h-4 w-4","aria-hidden":!0}),"Apply"]})]})]})]})}function Uf({value:e,options:t,onChange:n}){const[r,i]=z.useState(!1),s=e.trim().replace(/^@/,"").toLowerCase(),o=t.filter(u=>!s||u.login.toLowerCase().includes(s)).slice(0,8),l=t.find(u=>u.login.toLowerCase()===s);return a.jsxs("div",{className:"relative min-w-0",children:[a.jsxs("div",{className:"control flex items-center gap-2 px-2",children:[l?a.jsx("img",{className:"h-5 w-5 shrink-0 rounded-full bg-slate-100",src:_t(l.avatar_url??""),alt:`${l.login} avatar`,referrerPolicy:"no-referrer"}):a.jsx(pr,{className:"h-4 w-4 shrink-0 text-muted","aria-hidden":!0}),a.jsx("input",{className:"min-w-0 flex-1 bg-transparent font-mono text-sm outline-none",value:e,placeholder:"@login",onChange:u=>{n(u.target.value),i(!0)},onFocus:()=>i(!0),onBlur:()=>window.setTimeout(()=>i(!1),100)}),e?a.jsx("button",{className:"rounded-sm p-1 text-muted hover:bg-slate-100",type:"button","aria-label":"Clear actor filter",onClick:()=>n(""),children:a.jsx(Cr,{className:"h-3.5 w-3.5","aria-hidden":!0})}):null]}),r&&o.length>0?a.jsx("div",{className:"absolute left-0 right-0 z-20 mt-1 max-h-72 overflow-auto rounded-md border border-border bg-white p-1 shadow-lg",children:o.map(u=>a.jsxs("button",{className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left hover:bg-slate-50",type:"button",onMouseDown:c=>c.preventDefault(),onClick:()=>{n(u.login),i(!1)},children:[u.avatar_url?a.jsx("img",{className:"h-6 w-6 shrink-0 rounded-full bg-slate-100",src:_t(u.avatar_url),alt:`${u.login} avatar`,referrerPolicy:"no-referrer"}):a.jsx(pr,{className:"h-5 w-5 shrink-0 text-muted","aria-hidden":!0}),a.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:["@",u.login]}),a.jsx("span",{className:"shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] font-semibold text-muted",children:u.job_count})]},u.login))}):null]})}function et({label:e,children:t,className:n}){return a.jsxs("label",{className:re("grid min-w-0 gap-1 text-xs font-semibold text-muted",n),children:[e,t]})}function $f({jobs:e,loading:t,loadingMore:n=!1,hasMore:r=!1,onLoadMore:i,onViewJob:s,now:o,user:l,onRetry:u,onDismiss:c}){const[d,h]=z.useState(null),[f,p]=z.useState(null),y=z.useRef(!1),w=z.useRef(n),k=!!(l!=null&&l.is_admin&&u),b=!!(l!=null&&l.is_admin&&c);z.useEffect(()=>{w.current&&!n&&(y.current=!1),w.current=n},[n]);const S=z.useCallback(()=>{y.current||(y.current=!0,i==null||i())},[i]),N=z.useCallback(async E=>{if(u){h(E);try{await u(E)}finally{h(null)}}},[u]),C=z.useCallback(async E=>{if(c){p(E);try{await c(E)}finally{p(null)}}},[c]);return t&&e.length===0?a.jsx(Z,{text:"Loading jobs..."}):e.length===0?a.jsx(Z,{text:"No jobs match the current filters."}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-2 md:hidden",children:[e.map(E=>a.jsx(Kf,{job:E,onViewJob:s,now:o,canRetry:k&&Sn(E.status),retrying:d===E.id,onRetry:N,canDismiss:b&&Sn(E.status),dismissing:f===E.id,onDismiss:C},E.id)),a.jsx(Hf,{hasMore:r,loading:n,onLoadMore:S})]}),a.jsxs("div",{className:"hidden max-h-[640px] overflow-auto rounded-md border border-border md:block",children:[a.jsxs("table",{className:"min-w-full border-collapse text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"sticky top-0 z-10 border-b border-border bg-panel text-left text-xs text-muted",children:[a.jsx("th",{className:"px-2 py-2 font-semibold",children:"ID"}),a.jsx("th",{className:"px-2 py-2 font-semibold",children:"Status"}),a.jsx("th",{className:"px-2 py-2 font-semibold",children:"Repo / thread"}),a.jsx("th",{className:"px-2 py-2 font-semibold",children:"Action"}),a.jsx("th",{className:"px-2 py-2 font-semibold",children:"Actor"}),a.jsx("th",{className:"px-2 py-2 font-semibold",children:"Attempts"}),a.jsx("th",{className:"px-2 py-2 font-semibold",children:"Queue wait"}),a.jsx("th",{className:"px-2 py-2 font-semibold",children:"Runtime"}),a.jsx("th",{className:"px-2 py-2 font-semibold",children:"Updated"}),a.jsx("th",{className:"px-2 py-2 text-right font-semibold",children:"Actions"})]})}),a.jsx("tbody",{children:e.map(E=>a.jsxs("tr",{className:"cursor-pointer border-b border-border hover:bg-slate-50",onClick:()=>s(E.id),children:[a.jsxs("td",{className:"px-2 py-3 font-mono",children:["#",E.id]}),a.jsx("td",{className:"px-2 py-3",children:a.jsx(Wi,{status:E.status})}),a.jsxs("td",{className:"px-2 py-3",children:[a.jsx("div",{className:"font-mono",children:E.repo??E.work_key}),a.jsxs("div",{className:"text-xs text-muted",children:["thread ",E.thread??"n/a"]})]}),a.jsxs("td",{className:"px-2 py-3",children:[a.jsx("div",{children:E.action}),a.jsx("div",{className:"text-xs text-muted",children:E.intent})]}),a.jsx("td",{className:"px-2 py-3",children:a.jsx(mn,{actor:E.trigger_actor,avatarUrl:E.trigger_actor_avatar_url})}),a.jsx("td",{className:"px-2 py-3",children:E.attempts}),a.jsx("td",{className:"px-2 py-3",children:$e(Ji(E,o))}),a.jsx("td",{className:"px-2 py-3",children:$e(Gi(E,o))}),a.jsx("td",{className:"px-2 py-3 font-mono text-xs",children:a.jsx(Ne,{value:E.updated_at,compact:!0,relative:!0,now:o})}),a.jsx("td",{className:"px-2 py-3 text-right",children:a.jsxs("div",{className:"inline-flex items-center gap-1",children:[a.jsx(Bo,{jobId:E.id,canRetry:k&&Sn(E.status),retrying:d===E.id,onRetry:N,compact:!0}),a.jsx(qo,{jobId:E.id,canDismiss:b&&Sn(E.status),dismissing:f===E.id,onDismiss:C,compact:!0})]})})]},E.id))})]}),a.jsx(Qf,{hasMore:r,loading:n,onLoadMore:S})]})]})}function Hf({hasMore:e,loading:t,onLoadMore:n}){return!e&&!t?null:a.jsxs("button",{className:"inline-flex min-h-10 w-full items-center justify-center gap-2 rounded-md border border-border px-3 py-2 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60 md:hidden",type:"button",disabled:t||!e,onClick:()=>n==null?void 0:n(),children:[a.jsx($n,{className:"h-4 w-4","aria-hidden":!0}),t?"Loading more jobs...":"Load more jobs"]})}function Qf({hasMore:e,loading:t,onLoadMore:n}){const r=z.useRef(null);return z.useEffect(()=>{const i=r.current;if(!i||!e||t||!n)return;if(!("IntersectionObserver"in window)){n();return}const s=new IntersectionObserver(o=>{o.some(l=>l.isIntersecting)&&n()},{rootMargin:"240px 0px"});return s.observe(i),()=>s.disconnect()},[e,t,n]),!e&&!t?null:a.jsx("div",{ref:r,className:"flex min-h-10 items-center justify-center px-3 py-2 text-xs font-medium text-muted","aria-live":"polite",children:t?"Loading more jobs...":"Scroll for more jobs"})}function Kf({job:e,onViewJob:t,now:n,canRetry:r,retrying:i,onRetry:s,canDismiss:o,dismissing:l,onDismiss:u}){return a.jsxs("article",{className:"rounded-md border border-border bg-white shadow-[0_1px_0_rgba(15,23,42,0.03)]",children:[a.jsxs("button",{className:"grid w-full gap-2 p-3 text-left hover:bg-slate-50",type:"button",onClick:()=>t(e.id),children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0 space-y-1",children:[a.jsxs("div",{className:"grid min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-2",children:[a.jsxs("span",{className:"shrink-0 font-mono text-xs font-semibold text-muted",children:["#",e.id]}),a.jsx("span",{className:"truncate font-mono text-sm",children:e.repo??e.work_key})]}),a.jsx("div",{className:"line-clamp-2 text-sm leading-snug text-foreground",children:e.subject}),a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted",children:[a.jsxs("span",{children:["thread ",e.thread??"n/a"," · ",e.action]}),a.jsx(mn,{actor:e.trigger_actor,avatarUrl:e.trigger_actor_avatar_url})]})]}),a.jsx(Wi,{status:e.status})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-2 text-xs",children:[a.jsx(me,{label:"Wait",value:$e(Ji(e,n))}),a.jsx(me,{label:"Runtime",value:$e(Gi(e,n))}),a.jsx(me,{label:"Updated",value:a.jsx(Ne,{value:e.updated_at,compact:!0,relative:!0,now:n})})]})]}),r||o?a.jsxs("div",{className:"flex flex-wrap gap-2 border-t border-border px-3 py-2",children:[a.jsx(Bo,{jobId:e.id,canRetry:r,retrying:i,onRetry:s}),a.jsx(qo,{jobId:e.id,canDismiss:o,dismissing:l,onDismiss:u})]}):null]})}function Bo({jobId:e,canRetry:t,retrying:n,onRetry:r,compact:i=!1}){if(!t)return null;const s=n?"Retrying...":"Retry";return a.jsxs("button",{className:re("inline-flex h-8 items-center justify-center gap-2 rounded-md border border-border text-sm font-semibold text-foreground hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60",i?"w-8 px-0":"px-3"),type:"button",disabled:n,"aria-label":`Retry job #${e}`,title:`Retry job #${e}`,onClick:async o=>{o.stopPropagation(),window.confirm(`Retry job #${e}?`)&&await r(e)},children:[a.jsx(Sr,{className:"h-4 w-4","aria-hidden":!0}),a.jsx("span",{className:re(i&&"sr-only"),children:s})]})}function qo({jobId:e,canDismiss:t,dismissing:n,onDismiss:r,compact:i=!1}){if(!t)return null;const s=n?"Dismissing...":"Dismiss";return a.jsxs("button",{className:re("inline-flex h-8 items-center justify-center gap-2 rounded-md border border-border text-sm font-semibold text-foreground hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60",i?"w-8 px-0":"px-3"),type:"button",disabled:n,"aria-label":`Dismiss job #${e}`,title:`Dismiss job #${e}`,onClick:async o=>{o.stopPropagation(),window.confirm(`Dismiss job #${e}?`)&&await r(e)},children:[a.jsx(dn,{className:"h-4 w-4","aria-hidden":!0}),a.jsx("span",{className:re(i&&"sr-only"),children:s})]})}function mn({actor:e,avatarUrl:t,framed:n=!1}){const r=t?a.jsx("img",{className:"h-4 w-4 shrink-0 rounded-full bg-slate-100",src:_t(t),alt:e?`${e} avatar`:"",referrerPolicy:"no-referrer"}):a.jsx(pr,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),i=a.jsxs(a.Fragment,{children:[r,a.jsx("span",{className:"min-w-0 truncate",children:e?`@${e}`:"unknown actor"})]});return n?a.jsx("span",{className:"inline-flex h-7 max-w-full items-center gap-1 rounded-md border border-border px-2 text-xs font-semibold text-muted",children:i}):a.jsx("span",{className:"inline-flex min-w-0 max-w-full items-center gap-1 font-mono text-xs text-muted",children:i})}function Vf(e){return(e==null?void 0:e.model)??"OpenClaw default"}function Gf(e){return(e==null?void 0:e.thinking)??"OpenClaw default"}function Jf(e){return e?e.configured?"configured":e.summary:"n/a"}function Wf({job:e,session:t,sessionEvents:n,transcript:r,now:i,compact:s=!1}){var p;const o=Vn(e.id),l=n??[],u=r??[],c=sf(l),d=af(u),h=Gi(e,i),f=Ji(e,i);return a.jsxs("div",{className:"grid min-w-0 gap-4",children:[a.jsxs("div",{className:"sticky top-0 z-20 -mx-3 -mt-3 grid gap-2 border-b border-border bg-panel/95 px-3 py-2 shadow-sm backdrop-blur sm:-mx-4 sm:-mt-4 sm:px-4","aria-label":"Sticky job header",children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[a.jsx(Wi,{status:e.status}),a.jsxs("a",{className:"inline-flex h-7 items-center gap-1 rounded-md border border-border bg-white px-2 text-xs font-semibold text-foreground hover:bg-slate-50",href:o,children:[a.jsx(Nr,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Job #",e.id]}),a.jsx(mn,{actor:e.trigger_actor,avatarUrl:e.trigger_actor_avatar_url,framed:!0}),a.jsx("span",{className:"min-w-0 break-words font-mono text-xs text-muted [overflow-wrap:anywhere]",children:e.work_key})]}),a.jsxs("div",{className:"grid min-w-0 gap-2 lg:grid-cols-[minmax(0,1fr)_minmax(280px,auto)] lg:items-start",children:[a.jsx("p",{className:"min-w-0 break-words text-sm text-muted [overflow-wrap:anywhere]",children:e.subject}),a.jsxs("div",{className:"grid min-w-0 gap-1",children:[a.jsx("h3",{className:"text-xs font-semibold text-muted",children:"GitHub links"}),e.github_urls.length>0?a.jsx(On,{urls:e.github_urls,compact:!0}):a.jsx("p",{className:"text-xs text-muted",children:"No links recorded."})]})]})]}),a.jsxs("div",{className:re("grid gap-2 text-sm sm:gap-3",s?"grid-cols-1":"grid-cols-3"),children:[a.jsx(me,{label:"Queue wait",value:$e(f)}),a.jsx(me,{label:e.status==="running"?"Running for":"Runtime",value:$e(h)}),a.jsx(me,{label:"Coalesced",value:String(e.coalesced_count)})]}),a.jsxs("div",{className:re("grid gap-2 text-sm sm:gap-3",s?"grid-cols-1":"grid-cols-3"),children:[a.jsx(me,{label:"Model",value:Vf(e.model_route)}),a.jsx(me,{label:"Reasoning",value:Gf(e.model_route)}),a.jsx(me,{label:"Route",value:Jf(e.model_route)})]}),a.jsxs("div",{className:re("grid gap-2 text-sm sm:gap-3",s?"grid-cols-1":"grid-cols-2 xl:grid-cols-4"),children:[a.jsx(me,{label:"Created",value:a.jsx(Ne,{value:e.created_at,compact:!0,relative:!0,now:i})}),a.jsx(me,{label:"Started",value:e.started_at?a.jsx(Ne,{value:e.started_at,compact:!0,relative:!0,now:i}):"n/a"}),a.jsx(me,{label:"Updated",value:a.jsx(Ne,{value:e.updated_at,compact:!0,relative:!0,now:i})}),a.jsx(me,{label:"Finished",value:e.finished_at?a.jsx(Ne,{value:e.finished_at,compact:!0,relative:!0,now:i}):"n/a"})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"mb-2 text-sm font-semibold",children:"Timeline"}),a.jsx("div",{className:"grid min-w-0 gap-3",children:(e.worklog??[]).length>0?(p=e.worklog)==null?void 0:p.map(y=>a.jsxs("div",{className:"min-w-0 border-l-2 border-primary pl-3",children:[a.jsx("div",{className:"text-sm font-semibold",children:y.phase}),a.jsx("div",{className:"font-mono text-xs text-muted",children:a.jsx(Ne,{value:y.ts,relative:!0,now:i})}),a.jsx("div",{className:"break-words text-sm [overflow-wrap:anywhere]",children:y.summary}),y.detail?a.jsx("div",{className:"mt-1 break-words font-mono text-xs text-muted [overflow-wrap:anywhere]",children:y.detail}):null]},y.id)):a.jsx(Z,{text:"No worklog entries."})})]}),a.jsxs("div",{children:[a.jsxs("h3",{className:"mb-2 flex items-center gap-2 text-sm font-semibold",children:[a.jsx(Ka,{className:"h-4 w-4","aria-hidden":!0}),"OpenClaw session"]}),t?a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[a.jsx(me,{label:"Session ID",value:t.id}),a.jsx(me,{label:"Source",value:t.source})]}),a.jsx("p",{className:"break-words text-xs text-muted [overflow-wrap:anywhere]",children:t.detail})]}):a.jsx(Z,{text:"Session correlation is loading."})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"mb-2 text-sm font-semibold",children:"Agent activity"}),a.jsx("div",{className:"grid max-h-[460px] min-w-0 gap-2 overflow-auto pr-1",children:c.length>0?c.map((y,w)=>a.jsx(Yf,{event:y,defaultOpen:ua(y.eventType,e.status==="running",w,c.length),now:i},y.id)):a.jsx(Z,{text:e.status==="running"?"Waiting for live agent output...":"No agent activity has been recorded for this session."})})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"mb-2 text-sm font-semibold",children:"Session transcript"}),a.jsx("div",{className:"grid max-h-[620px] min-w-0 gap-2 overflow-auto pr-1",children:d.length>0?d.map((y,w)=>a.jsx(Xf,{entry:y,defaultOpen:ua(y.kind,e.status==="running",w,d.length),now:i},y.id)):a.jsx(Z,{text:e.status==="running"?"Waiting for live transcript entries...":"No OpenClaw transcript entries are available for this session."})})]})]})}function Xf({entry:e,defaultOpen:t,now:n}){return a.jsx(Uo,{badge:e.badge,meta:a.jsx(Ne,{value:e.meta,relative:!0,now:n}),count:e.count,summary:e.summary,defaultOpen:t,children:a.jsx("pre",{className:"max-h-72 max-w-full overflow-auto whitespace-pre-wrap break-words rounded bg-slate-950 px-2 py-1.5 font-mono text-xs leading-relaxed text-slate-100 [overflow-wrap:anywhere]",children:e.text})})}function Yf({event:e,defaultOpen:t,now:n}){return a.jsx(Uo,{badge:e.badge,meta:a.jsx(Ne,{value:e.meta,relative:!0,now:n}),count:e.count,summary:e.summary,defaultOpen:t,children:e.detail?a.jsx("pre",{className:"max-h-56 max-w-full overflow-auto whitespace-pre-wrap break-words rounded bg-slate-950 px-2 py-1.5 font-mono text-xs leading-relaxed text-slate-100 [overflow-wrap:anywhere]",children:e.detail}):null})}function Uo({badge:e,meta:t,count:n,summary:r,defaultOpen:i,children:s}){const[o,l]=z.useState(!!i);return a.jsxs("details",{className:"group min-w-0 rounded border border-border bg-slate-50/60",open:o,onToggle:u=>l(u.currentTarget.open),children:[a.jsxs("summary",{className:"grid cursor-pointer list-none gap-1 px-2 py-1.5 marker:hidden hover:bg-white",children:[a.jsxs("div",{className:"grid min-w-0 gap-1 sm:flex sm:items-center sm:justify-between sm:gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[a.jsx($n,{className:"h-3.5 w-3.5 shrink-0 text-muted transition-transform group-open:rotate-180","aria-hidden":!0}),a.jsx("span",{className:"truncate font-mono text-[11px] font-semibold text-muted",children:e}),n&&n>1?a.jsx("span",{className:"rounded-sm border border-border px-1 font-mono text-[10px] text-muted",children:n}):null]}),a.jsx("span",{className:"min-w-0 truncate pl-5 font-mono text-[11px] text-muted sm:shrink-0 sm:pl-0",children:t})]}),a.jsx("div",{className:"min-w-0 break-words pl-5 text-xs text-foreground [overflow-wrap:anywhere] sm:truncate",children:r})]}),a.jsx("div",{className:"min-w-0 border-t border-border bg-white px-2 py-2",children:s})]})}function pa({label:e,values:t}){const n=[{name:"median",seconds:(t==null?void 0:t.median)??0},{name:"p90",seconds:(t==null?void 0:t.p90)??0},{name:"p99",seconds:(t==null?void 0:t.p99)??0}];return a.jsx("div",{className:"h-56",children:a.jsx(yr,{width:"100%",height:"100%",children:a.jsxs(Si,{data:n,children:[a.jsx(wr,{strokeDasharray:"3 3"}),a.jsx(vr,{dataKey:"name"}),a.jsx(kr,{tickFormatter:$e}),a.jsx(jr,{formatter:r=>[$e(Number(r)),e]}),a.jsx(Ci,{dataKey:"seconds",fill:"#0969da",radius:[4,4,0,0]})]})})})}function Zf({values:e,loading:t,totalJobs:n}){const r=Object.entries(e??{}).map(([i,s])=>({day:i,count:s}));return t&&r.length===0?a.jsx(Z,{text:"Loading job history..."}):r.length===0?a.jsx(Z,{text:n>0?"Job history has no valid creation dates.":"No job history available."}):a.jsx("div",{className:"h-56",children:a.jsx(yr,{width:"100%",height:"100%",children:a.jsxs(Si,{data:r,children:[a.jsx(wr,{strokeDasharray:"3 3"}),a.jsx(vr,{dataKey:"day",minTickGap:16}),a.jsx(kr,{allowDecimals:!1}),a.jsx(jr,{formatter:i=>[Number(i),"jobs"]}),a.jsx(Ci,{dataKey:"count",fill:"#16a34a",radius:[4,4,0,0]})]})})})}function em({usage:e,loading:t,totalJobs:n}){const[r,i]=z.useState("day"),s=(e==null?void 0:e[r])??[],o=s.map(u=>({...u,label:tm(u.bucket,r)})),l=s.reduce((u,c)=>u+c.seconds,0);return t&&o.length===0?a.jsx(Z,{text:"Loading runtime usage..."}):o.length===0?a.jsx(Z,{text:n>0?"No jobs have recorded runtime yet.":"No job history available."}):a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted",children:[a.jsx(Jl,{className:"h-4 w-4","aria-hidden":!0}),a.jsxs("span",{children:[Gr(l)," consumed across ",s.reduce((u,c)=>u+c.jobs,0)," job",s.reduce((u,c)=>u+c.jobs,0)===1?"":"s"]})]}),a.jsx("div",{className:"inline-flex h-8 rounded-md border border-border bg-white p-0.5","aria-label":"Runtime grouping",children:["day","month"].map(u=>a.jsx("button",{className:re("rounded px-2.5 text-xs font-semibold capitalize",r===u?"bg-primary text-white":"text-muted hover:bg-slate-50"),type:"button",onClick:()=>i(u),children:u},u))})]}),a.jsx("div",{className:"h-64",children:a.jsx(yr,{width:"100%",height:"100%",children:a.jsxs(Si,{data:o,children:[a.jsx(wr,{strokeDasharray:"3 3"}),a.jsx(vr,{dataKey:"label",minTickGap:16,tick:{fontSize:11}}),a.jsx(kr,{tickFormatter:u=>Gr(Number(u))}),a.jsx(jr,{formatter:(u,c)=>c==="seconds"?[Gr(Number(u)),"runtime"]:[Number(u),String(c)],labelFormatter:u=>String(u)}),a.jsx(Ci,{dataKey:"seconds",fill:"#0969da",radius:[4,4,0,0],isAnimationActive:!1})]})})})]})}function tm(e,t){if(t==="month"){const[s,o]=e.split("-").map(Number);return!s||!o?e:new Intl.DateTimeFormat(void 0,{month:"short",year:"numeric"}).format(new Date(s,o-1,1))}const[n,r,i]=e.split("-").map(Number);return!n||!r||!i?e:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(new Date(n,r-1,i))}function Gr(e){const t=Math.max(0,Math.round(e));if(t<60)return`${t}s`;const n=Math.round(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60),i=n%60;return i===0?`${r}h`:`${r}h ${i}m`}function fa(e){return Object.values(e).reduce((t,n)=>t+n,0)}function nm({data:e,loading:t}){if(t&&!e)return a.jsx(Z,{text:"Loading systemd units..."});if(!e)return a.jsx(Z,{text:"No systemd snapshot available."});const n=e.units??[],r=n.filter(o=>o.active_state==="active").length,i=n.filter(o=>o.active_state==="failed"||o.result==="failed").length,s=n.filter(o=>o.kind==="timer").length;return a.jsxs("div",{className:"grid min-w-0 gap-3",children:[e.errors.length>0?a.jsx(Se,{tone:"error",text:e.errors[0]}):null,n.length===0?a.jsx(Z,{text:"No configured bridge units found."}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[a.jsx(ur,{label:"Units",value:String(n.length)}),a.jsx(ur,{label:"Active",value:String(r)}),a.jsx(ur,{label:"Failed",value:String(i),tone:i>0?"bad":"neutral"}),a.jsx(ur,{label:"Timers",value:String(s)})]}),a.jsxs("div",{className:"overflow-hidden rounded-md border border-border bg-white",children:[a.jsxs("div",{className:"hidden grid-cols-[minmax(0,1.35fr)_90px_120px_90px_minmax(0,1fr)] gap-3 border-b border-border bg-slate-50 px-3 py-2 text-[11px] font-semibold uppercase text-muted md:grid",children:[a.jsx("span",{children:"Unit"}),a.jsx("span",{children:"Status"}),a.jsx("span",{children:"State"}),a.jsx("span",{children:"PID"}),a.jsx("span",{children:"Schedule"})]}),a.jsx("div",{className:"divide-y divide-border",children:n.map(o=>a.jsx(rm,{unit:o},o.unit))})]})]})]})}function ur({label:e,value:t,tone:n="neutral"}){return a.jsxs("div",{className:re("min-w-0 rounded-md border bg-white px-3 py-2",n==="bad"?"border-red-200":"border-border"),children:[a.jsx("div",{className:re("font-mono text-lg font-semibold",n==="bad"?"text-red-700":"text-foreground"),children:t}),a.jsx("div",{className:"mt-0.5 text-[11px] font-semibold uppercase text-muted",children:e})]})}function rm({unit:e}){const[t,n]=z.useState(!1),r=e.active_state==="active",i=e.active_state==="failed"||e.result==="failed",s=e.next_elapse||e.last_trigger||"n/a";return a.jsxs("details",{className:"group min-w-0",open:t,onToggle:o=>n(o.currentTarget.open),children:[a.jsxs("summary",{className:"grid min-w-0 cursor-pointer list-none grid-cols-2 gap-2 px-3 py-3 text-sm marker:hidden hover:bg-slate-50 md:grid-cols-[minmax(0,1.35fr)_90px_120px_90px_minmax(0,1fr)] md:items-center md:gap-3",children:[a.jsxs("div",{className:"col-span-2 min-w-0 md:col-span-1",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx($n,{className:"h-3.5 w-3.5 shrink-0 text-muted transition-transform group-open:rotate-180","aria-hidden":!0}),a.jsx("span",{className:"truncate font-mono text-xs font-semibold text-foreground",children:e.unit})]}),a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 pl-5 text-[11px] font-semibold uppercase text-muted",children:[a.jsx("span",{children:e.role}),a.jsx("span",{children:e.kind}),a.jsx("span",{children:e.load_state}),a.jsx("span",{children:t?"following log":"expand log"})]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2 md:block",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase text-muted md:hidden",children:"Status"}),a.jsx("span",{className:re("inline-flex h-6 items-center rounded-full border px-2 text-xs font-semibold",i?"border-red-300 bg-red-50 text-red-700":r?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-slate-300 bg-slate-50 text-slate-700"),children:e.active_state})]}),a.jsx(ma,{label:"State",value:e.sub_state,detail:e.result||"unknown"}),a.jsx(ma,{label:"PID",value:e.main_pid?String(e.main_pid):"n/a",detail:$e(e.uptime_seconds)}),a.jsxs("div",{className:"col-span-2 min-w-0 md:col-span-1",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase text-muted md:hidden",children:"Schedule"}),a.jsx("div",{className:"truncate font-mono text-[11px] text-foreground",title:s,children:e.next_elapse?`next ${e.next_elapse}`:s})]})]}),a.jsx("div",{className:"border-t border-border bg-slate-50 px-3 pb-3 pt-2",children:a.jsx(im,{unit:e.unit,active:t})})]})}function ma({label:e,value:t,detail:n}){return a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase text-muted md:hidden",children:e}),a.jsx("div",{className:"truncate font-mono text-[11px] text-foreground",children:t}),n?a.jsx("div",{className:"truncate font-mono text-[11px] text-muted",children:n}):null]})}function im({unit:e,active:t}){const[n,r]=z.useState([]),[i,s]=z.useState(""),o=z.useRef(null);return z.useEffect(()=>{if(!t){r([]),s("");return}r([]),s("");const l=new EventSource(`/api/systemd/journal/stream?unit=${encodeURIComponent(e)}`);return l.addEventListener("journal_line",u=>{const c=br(u);c&&r(d=>[...d.slice(-199),c])}),l.addEventListener("journal_error",u=>{const c=br(u);s((c==null?void 0:c.error)??"journal stream failed")}),l.onerror=()=>{},()=>l.close()},[t,e]),z.useEffect(()=>{const l=o.current;l&&(l.scrollTop=l.scrollHeight)},[n]),a.jsxs("div",{className:"grid min-w-0 gap-2",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase text-muted",children:"Live journal"}),a.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px] text-muted",children:n.length>0?`${n.length} lines streamed`:"waiting for journal output"})]}),a.jsx("div",{className:"font-mono text-[11px] text-muted",children:"journalctl -f"})]}),i?a.jsx(Se,{tone:"error",text:i}):null,a.jsx("div",{ref:o,className:"h-72 overflow-auto rounded-md border border-slate-800 bg-slate-950 p-3 font-mono text-xs leading-relaxed text-slate-100",children:n.length>0?n.map((l,u)=>a.jsx("div",{className:"break-words [overflow-wrap:anywhere]",children:l.line},`${l.unit}-${u}`)):a.jsx("div",{className:"text-slate-400",children:"No journal lines received yet."})})]})}function sm({data:e,loading:t}){var h,f,p,y,w,k;if(t&&!e)return a.jsx(Z,{text:"Loading process activity..."});if(!e)return a.jsx(Z,{text:"No process snapshot available."});const n=e.executor.children??[],r=n.flatMap(b=>Ho(b)),i=r.reduce((b,S)=>b+S.cpu_ticks,0),s=r.reduce((b,S)=>b+om(S),0),o=e.executor.service==="active",l=r.slice(0,8).map(b=>({label:`pid ${b.pid}`,ticks:b.cpu_ticks})),u=(e.samples??[]).map(b=>({label:Rn(b.ts),ticks:b.cpu_ticks,io:b.io_bytes,active:b.active_since_last_sample?"active":"quiet"})),c=u.length>0?u:l,d=(h=e.samples)==null?void 0:h[e.samples.length-1];return a.jsxs("div",{className:"grid gap-4",children:[a.jsx("div",{className:"rounded-md border border-slate-200 bg-slate-50 p-3",children:a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("span",{className:re("inline-flex h-6 items-center rounded-full border px-2 text-xs font-semibold",o?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-slate-300 bg-white text-slate-600"),children:o?"active":"idle"}),a.jsxs("span",{className:"font-mono text-xs text-muted",children:["service ",e.executor.service]})]}),a.jsx("div",{className:"mt-2 text-sm font-semibold text-foreground",children:e.running_jobs.length>0?`${e.running_jobs.length} running job${e.running_jobs.length===1?"":"s"}`:"No running jobs"}),e.running_jobs.length>0?a.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:e.running_jobs.slice(0,4).map(b=>a.jsxs("span",{className:"inline-flex min-h-6 items-center gap-1.5 rounded-full border border-blue-200 bg-white px-2 font-mono text-[11px] font-semibold text-blue-700",children:[a.jsx("span",{className:"h-2 w-2 rounded-full bg-blue-600 animate-live-pulse","aria-hidden":!0}),"#",b.id," ",$e(b.age_seconds)]},b.id))}):null,d?a.jsxs("p",{className:"mt-1 text-xs text-muted",children:["Last persisted sample ",Rn(d.ts)," · ",d.active_since_last_sample?"activity observed":`quiet ${$e(d.idle_seconds)}`]}):null,a.jsx("p",{className:"mt-1 text-xs text-muted",children:e.detail})]}),a.jsxs("div",{className:"grid min-w-[190px] grid-cols-3 gap-2 text-center text-xs",children:[a.jsx(Jr,{label:"PID",value:e.executor.pid?String(e.executor.pid):"n/a"}),a.jsx(Jr,{label:"Children",value:String(r.length)}),a.jsx(Jr,{label:"CPU ticks",value:String(i)})]})]})}),a.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[a.jsx(cr,{label:"Live process",value:((f=e.signals)==null?void 0:f.live_process.state)??(r.length>0?"live":"no_child_process"),detail:`${((p=e.signals)==null?void 0:p.live_process.child_count)??r.length} children`}),a.jsx(cr,{label:"Process activity",value:((y=e.signals)==null?void 0:y.process_activity.state)??(d!=null&&d.active_since_last_sample?"active":"quiet"),detail:d?`sample ${Rn(d.ts)}`:"no sample"}),a.jsx(cr,{label:"Semantic progress",value:(w=e.signals)!=null&&w.semantic_progress.length?"recent":"none",detail:xa(e.running_jobs,"semantic_progress")}),a.jsx(cr,{label:"Visible progress",value:(k=e.signals)!=null&&k.visible_progress.length?"streaming":"none",detail:xa(e.running_jobs,"visible_progress")})]}),e.alerts.length>0?a.jsx(Se,{tone:"error",text:e.alerts[0]}):null,a.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",children:[a.jsxs("div",{className:"min-w-0 rounded-md border border-border p-3",children:[a.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[a.jsxs("h3",{className:"flex items-center gap-2 text-sm font-semibold",children:[a.jsx(vs,{className:"h-4 w-4","aria-hidden":!0}),u.length>0?"CPU history":"CPU ticks"]}),a.jsxs("span",{className:"font-mono text-xs text-muted",children:[Qo(s)," I/O"]})]}),c.length>0?a.jsx("div",{className:"h-40",children:a.jsx(yr,{width:"100%",height:"100%",children:a.jsxs(Jo,{data:c,children:[a.jsx(wr,{strokeDasharray:"3 3"}),a.jsx(vr,{dataKey:"label",tick:!1}),a.jsx(kr,{allowDecimals:!1,tick:{fontSize:11}}),a.jsx(jr,{formatter:b=>[Number(b),"cpu ticks"]}),a.jsx(Wo,{type:"monotone",dataKey:"ticks",stroke:"#0f766e",strokeWidth:2,dot:{r:3},activeDot:{r:5},isAnimationActive:!1})]})})}):a.jsx(Z,{text:"No executor CPU samples available."})]}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("h3",{className:"mb-2 flex items-center gap-2 text-sm font-semibold",children:[a.jsx(vs,{className:"h-4 w-4","aria-hidden":!0}),"Executor children"]}),n.length>0?a.jsx("div",{className:"grid gap-2",children:n.map(b=>a.jsx($o,{process:b},b.pid))}):a.jsx(Z,{text:"No child process detected for the executor."})]})]})]})}function am({alerts:e,loading:t,now:n}){if(t&&!e)return a.jsx(Z,{text:"Loading monitor alerts..."});const r=e??[];return r.length===0?a.jsx(Z,{text:"No active monitor alerts."}):a.jsx("div",{className:"grid gap-2",children:r.slice(0,5).map(i=>a.jsxs("div",{className:"rounded-md border border-red-200 bg-red-50 p-2.5",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs font-semibold text-red-700",children:[a.jsx(Ti,{className:"h-3.5 w-3.5","aria-hidden":!0}),a.jsx("span",{children:i.severity}),a.jsx("span",{className:"font-normal text-red-600",children:Lo(i.last_seen,n)}),i.observations>1?a.jsxs("span",{className:"rounded-full border border-red-200 bg-white px-1.5",children:[i.observations,"x"]}):null]}),a.jsx("p",{className:"mt-1 break-words text-sm font-medium text-red-950 [overflow-wrap:anywhere]",children:i.message})]},i.fingerprint))})}function $o({process:e}){var r,i;const t=((r=e.io_bytes)==null?void 0:r.read_bytes)??0,n=((i=e.io_bytes)==null?void 0:i.write_bytes)??0;return a.jsxs("div",{className:"rounded-md border border-border bg-white p-2.5",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[a.jsxs("span",{className:"font-mono",children:["pid ",e.pid]}),a.jsxs("span",{className:"rounded-full border border-border px-2 text-xs text-muted",children:["state ",e.state]}),a.jsxs("span",{className:"rounded-full border border-border px-2 text-xs text-muted",children:["cpu ",e.cpu_ticks]}),a.jsxs("span",{className:"rounded-full border border-border px-2 text-xs text-muted",children:["I/O ",Qo(t+n)]})]}),a.jsx("div",{className:"mt-2 break-words font-mono text-xs text-muted",children:e.cmd||"unknown command"}),e.children&&e.children.length>0?a.jsx("div",{className:"mt-3 border-l-2 border-border pl-3",children:e.children.map(s=>a.jsx($o,{process:s},s.pid))}):null]})}function Jr({label:e,value:t}){return a.jsxs("div",{className:"rounded-md border border-border bg-white px-2 py-2",children:[a.jsx("div",{className:"font-mono text-sm font-semibold text-foreground",children:t}),a.jsx("div",{className:"mt-0.5 text-[11px] font-semibold uppercase text-muted",children:e})]})}function cr({label:e,value:t,detail:n}){return a.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-white p-2.5",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase text-muted",children:e}),a.jsx("div",{className:"mt-1 truncate text-sm font-semibold text-foreground",children:t}),a.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted",children:n})]})}function xa(e,t){const n=e.find(i=>i[t]),r=n==null?void 0:n[t];return!n||!r?"no running heartbeat":`#${n.id} ${r.phase} ${$e(r.age_seconds??null)}`}function Ho(e){return[e,...(e.children??[]).flatMap(t=>Ho(t))]}function om(e){var t,n;return(((t=e.io_bytes)==null?void 0:t.read_bytes)??0)+(((n=e.io_bytes)==null?void 0:n.write_bytes)??0)}function Qo(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}function me({label:e,value:t}){return a.jsxs("div",{className:"min-w-0 rounded-md border border-border p-3",children:[a.jsx("div",{className:"text-xs font-semibold text-muted",children:e}),a.jsx("div",{className:"mt-1 min-w-0 break-words text-sm [overflow-wrap:anywhere]",children:t})]})}function Wi({status:e}){const t=of(e),n=e==="running"||e==="pending";return a.jsxs("span",{className:re("inline-flex min-h-6 items-center gap-1.5 rounded-full border px-2 text-xs font-semibold",t.badge),children:[a.jsx("span",{className:re("h-2.5 w-2.5 rounded-full",t.dot,n&&"animate-live-pulse"),"aria-hidden":!0}),e]})}function Z({text:e}){return a.jsx("div",{className:"rounded-md border border-dashed border-border p-6 text-center text-sm text-muted",children:e})}function Se({tone:e,text:t}){return a.jsx("div",{className:re("rounded-md border p-3 text-sm",e==="error"&&"border-red-300 bg-red-50 text-red-700",e==="warning"&&"border-amber-300 bg-amber-50 text-amber-800"),children:t})}function ut({onClick:e,compactOnMobile:t=!1}){return a.jsxs("button",{className:re("inline-flex h-8 items-center justify-center gap-2 rounded-md border border-border text-sm font-semibold text-foreground hover:bg-slate-50",t?"w-8 px-0 sm:w-auto sm:px-3":"px-3"),onClick:e,type:"button","aria-label":"Refresh",children:[a.jsx(Ha,{className:"h-4 w-4","aria-hidden":!0}),a.jsx("span",{className:re(t&&"hidden sm:inline"),children:"Refresh"})]})}const ga=document.getElementById("root");ga&&tl.createRoot(ga).render(a.jsx(z.StrictMode,{children:a.jsx(_l,{client:Jp,children:a.jsx(bf,{})})})); diff --git a/src/github_agent_bridge/dashboard_static/assets/index-DVXa4vsi.js b/src/github_agent_bridge/dashboard_static/assets/index-DVXa4vsi.js deleted file mode 100644 index 3e2c388..0000000 --- a/src/github_agent_bridge/dashboard_static/assets/index-DVXa4vsi.js +++ /dev/null @@ -1,173 +0,0 @@ -var os=e=>{throw TypeError(e)};var Ir=(e,t,n)=>t.has(e)||os("Cannot "+n);var g=(e,t,n)=>(Ir(e,t,"read from private field"),n?n.call(e):t.get(e)),q=(e,t,n)=>t.has(e)?os("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),T=(e,t,n,r)=>(Ir(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),J=(e,t,n)=>(Ir(e,t,"access private method"),n);var tr=(e,t,n,r)=>({set _(i){T(e,t,i,n)},get _(){return g(e,t,r)}});import{e as Qo,f as Ko,g as Ni,r as ge,R as D,c as br,a as Si,C as yr,X as wr,Y as vr,T as kr,B as Ci,d as Vo,b as Go,L as Jo}from"./charts-DRWoArYU.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var Tr={exports:{}},gn={};/** - * @license React - * react-jsx-runtime.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var ls;function Wo(){if(ls)return gn;ls=1;var e=Qo(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(l,u,c){var d,h={},f=null,p=null;c!==void 0&&(f=""+c),u.key!==void 0&&(f=""+u.key),u.ref!==void 0&&(p=u.ref);for(d in u)r.call(u,d)&&!s.hasOwnProperty(d)&&(h[d]=u[d]);if(l&&l.defaultProps)for(d in u=l.defaultProps,u)h[d]===void 0&&(h[d]=u[d]);return{$$typeof:t,type:l,key:f,ref:p,props:h,_owner:i.current}}return gn.Fragment=n,gn.jsx=o,gn.jsxs=o,gn}var us;function Xo(){return us||(us=1,Tr.exports=Wo()),Tr.exports}var a=Xo(),nr={},cs;function Yo(){if(cs)return nr;cs=1;var e=Ko();return nr.createRoot=e.createRoot,nr.hydrateRoot=e.hydrateRoot,nr}var Zo=Yo();const el=Ni(Zo);var Bn=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(){}},Ot,bt,Xt,ba,tl=(ba=class extends Bn{constructor(){super();q(this,Ot);q(this,bt);q(this,Xt);T(this,Xt,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){g(this,bt)||this.setEventListener(g(this,Xt))}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,bt))==null||t.call(this),T(this,bt,void 0))}setEventListener(t){var n;T(this,Xt,t),(n=g(this,bt))==null||n.call(this),T(this,bt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){g(this,Ot)!==t&&(T(this,Ot,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof g(this,Ot)=="boolean"?g(this,Ot):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Ot=new WeakMap,bt=new WeakMap,Xt=new WeakMap,ba),Ei=new tl,nl={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},yt,ji,ya,rl=(ya=class{constructor(){q(this,yt,nl);q(this,ji,!1)}setTimeoutProvider(e){T(this,yt,e)}setTimeout(e,t){return g(this,yt).setTimeout(e,t)}clearTimeout(e){g(this,yt).clearTimeout(e)}setInterval(e,t){return g(this,yt).setInterval(e,t)}clearInterval(e){g(this,yt).clearInterval(e)}},yt=new WeakMap,ji=new WeakMap,ya),Mt=new rl;function il(e){setTimeout(e,0)}var sl=typeof window>"u"||"Deno"in globalThis;function Pe(){}function al(e,t){return typeof e=="function"?e(t):e}function Wr(e){return typeof e=="number"&&e>=0&&e!==1/0}function _a(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Et(e,t){return typeof e=="function"?e(t):e}function Le(e,t){return typeof e=="function"?e(t):e}function ds(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:l}=e;if(o){if(r){if(t.queryHash!==_i(o,t.options))return!1}else if(!Tn(t.queryKey,o))return!1}if(n!=="all"){const u=t.isActive();if(n==="active"&&!u||n==="inactive"&&u)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||i&&i!==t.state.fetchStatus||s&&!s(t))}function hs(e,t){const{exact:n,status:r,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(In(t.options.mutationKey)!==In(s))return!1}else if(!Tn(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function _i(e,t){return((t==null?void 0:t.queryKeyHashFn)||In)(e)}function In(e){return JSON.stringify(e,(t,n)=>Yr(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Tn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Tn(e[n],t[n])):!1}var ol=Object.prototype.hasOwnProperty;function Pa(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=ps(e)&&ps(t);if(!r&&!(Yr(e)&&Yr(t)))return t;const s=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),l=o.length,u=r?new Array(l):{};let c=0;for(let d=0;d{Mt.setTimeout(t,e)})}function Zr(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Pa(e,t):t}function ul(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function cl(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Pi=Symbol();function Ra(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Pi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ia(e,t){return typeof e=="function"?e(...t):!!e}function dl(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??(i=t()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),e}var An=(()=>{let e=()=>sl;return{isServer(){return e()},setIsServer(t){e=t}}})();function ei(){let e,t;const n=new Promise((i,s)=>{e=i,t=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}var hl=il;function pl(){let e=[],t=0,n=l=>{l()},r=l=>{l()},i=hl;const s=l=>{t?e.push(l):i(()=>{n(l)})},o=()=>{const l=e;e=[],l.length&&i(()=>{r(()=>{l.forEach(u=>{n(u)})})})};return{batch:l=>{let u;t++;try{u=l()}finally{t--,t||o()}return u},batchCalls:l=>(...u)=>{s(()=>{l(...u)})},schedule:s,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{i=l}}}var xe=pl(),Yt,wt,Zt,wa,fl=(wa=class extends Bn{constructor(){super();q(this,Yt,!0);q(this,wt);q(this,Zt);T(this,Zt,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){g(this,wt)||this.setEventListener(g(this,Zt))}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,wt))==null||t.call(this),T(this,wt,void 0))}setEventListener(t){var n;T(this,Zt,t),(n=g(this,wt))==null||n.call(this),T(this,wt,t(this.setOnline.bind(this)))}setOnline(t){g(this,Yt)!==t&&(T(this,Yt,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return g(this,Yt)}},Yt=new WeakMap,wt=new WeakMap,Zt=new WeakMap,wa),dr=new fl;function ml(e){return Math.min(1e3*2**e,3e4)}function Ta(e){return(e??"online")==="online"?dr.isOnline():!0}var ti=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Aa(e){let t=!1,n=0,r;const i=ei(),s=()=>i.status!=="pending",o=w=>{var k;if(!s()){const b=new ti(w);f(b),(k=e.onCancel)==null||k.call(e,b)}},l=()=>{t=!0},u=()=>{t=!1},c=()=>Ei.isFocused()&&(e.networkMode==="always"||dr.isOnline())&&e.canRun(),d=()=>Ta(e.networkMode)&&e.canRun(),h=w=>{s()||(r==null||r(),i.resolve(w))},f=w=>{s()||(r==null||r(),i.reject(w))},p=()=>new Promise(w=>{var k;r=b=>{(s()||c())&&w(b)},(k=e.onPause)==null||k.call(e)}).then(()=>{var w;r=void 0,s()||(w=e.onContinue)==null||w.call(e)}),y=()=>{if(s())return;let w;const k=n===0?e.initialPromise:void 0;try{w=k??e.fn()}catch(b){w=Promise.reject(b)}Promise.resolve(w).then(h).catch(b=>{var v;if(s())return;const N=e.retry??(An.isServer()?0:3),S=e.retryDelay??ml,C=typeof S=="function"?S(n,b):S,E=N===!0||typeof N=="number"&&nc()?void 0:p()).then(()=>{t?f(b):y()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:l,continueRetry:u,canStart:d,start:()=>(d()?y():p().then(y),i)}}var Lt,va,Ma=(va=class{constructor(){q(this,Lt)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Wr(this.gcTime)&&T(this,Lt,Mt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(An.isServer()?1/0:300*1e3))}clearGcTimeout(){g(this,Lt)!==void 0&&(Mt.clearTimeout(g(this,Lt)),T(this,Lt,void 0))}},Lt=new WeakMap,va);function xl(e){return{onFetch:(t,n)=>{var d,h,f,p,y;const r=t.options,i=(f=(h=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:f.direction,s=((p=t.state.data)==null?void 0:p.pages)||[],o=((y=t.state.data)==null?void 0:y.pageParams)||[];let l={pages:[],pageParams:[]},u=0;const c=async()=>{let w=!1;const k=S=>{dl(S,()=>t.signal,()=>w=!0)},b=Ra(t.options,t.fetchOptions),N=async(S,C,E)=>{if(w)return Promise.reject(t.signal.reason);if(C==null&&S.pages.length)return Promise.resolve(S);const L=(()=>{const A={client:t.client,queryKey:t.queryKey,pageParam:C,direction:E?"backward":"forward",meta:t.options.meta};return k(A),A})(),M=await b(L),{maxPages:O}=t.options,z=E?cl:ul;return{pages:z(S.pages,M,O),pageParams:z(S.pageParams,C,O)}};if(i&&s.length){const S=i==="backward",C=S?gl:ms,E={pages:s,pageParams:o},v=C(r,E);l=await N(E,v,S)}else{const S=e??s.length;do{const C=u===0?o[0]??r.initialPageParam:ms(r,l);if(u>0&&C==null)break;l=await N(l,C),u++}while(u{var w,k;return(k=(w=t.options).persister)==null?void 0:k.call(w,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function ms(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function gl(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var en,Ft,tn,Be,Dt,fe,Ln,zt,Oe,Oa,at,ka,bl=(ka=class extends Ma{constructor(t){super();q(this,Oe);q(this,en);q(this,Ft);q(this,tn);q(this,Be);q(this,Dt);q(this,fe);q(this,Ln);q(this,zt);T(this,zt,!1),T(this,Ln,t.defaultOptions),this.setOptions(t.options),this.observers=[],T(this,Dt,t.client),T(this,Be,g(this,Dt).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,T(this,Ft,gs(this.options)),this.state=t.state??g(this,Ft),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return g(this,en)}get promise(){var t;return(t=g(this,fe))==null?void 0:t.promise}setOptions(t){if(this.options={...g(this,Ln),...t},t!=null&&t._type&&T(this,en,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=gs(this.options);n.data!==void 0&&(this.setState(xs(n.data,n.dataUpdatedAt)),T(this,Ft,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&g(this,Be).remove(this)}setData(t,n){const r=Zr(this.state.data,t,this.options);return J(this,Oe,at).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){J(this,Oe,at).call(this,{type:"setState",state:t})}cancel(t){var r,i;const n=(r=g(this,fe))==null?void 0:r.promise;return(i=g(this,fe))==null||i.cancel(t),n?n.then(Pe).catch(Pe):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return g(this,Ft)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Le(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Pi||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Et(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!_a(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=g(this,fe))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=g(this,fe))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),g(this,Be).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(g(this,fe)&&(g(this,zt)||J(this,Oe,Oa).call(this)?g(this,fe).cancel({revert:!0}):g(this,fe).cancelRetry()),this.scheduleGc()),g(this,Be).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||J(this,Oe,at).call(this,{type:"invalidate"})}async fetch(t,n){var c,d,h,f,p,y,w,k,b,N,S;if(this.state.fetchStatus!=="idle"&&((c=g(this,fe))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(g(this,fe))return g(this,fe).continueRetry(),g(this,fe).promise}if(t&&this.setOptions(t),!this.options.queryFn){const C=this.observers.find(E=>E.options.queryFn);C&&this.setOptions(C.options)}const r=new AbortController,i=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(T(this,zt,!0),r.signal)})},s=()=>{const C=Ra(this.options,n),v=(()=>{const L={client:g(this,Dt),queryKey:this.queryKey,meta:this.meta};return i(L),L})();return T(this,zt,!1),this.options.persister?this.options.persister(C,v,this):C(v)},l=(()=>{const C={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:g(this,Dt),state:this.state,fetchFn:s};return i(C),C})(),u=g(this,en)==="infinite"?xl(this.options.pages):this.options.behavior;u==null||u.onFetch(l,this),T(this,tn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=l.fetchOptions)==null?void 0:d.meta))&&J(this,Oe,at).call(this,{type:"fetch",meta:(h=l.fetchOptions)==null?void 0:h.meta}),T(this,fe,Aa({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,onCancel:C=>{C instanceof ti&&C.revert&&this.setState({...g(this,tn),fetchStatus:"idle"}),r.abort()},onFail:(C,E)=>{J(this,Oe,at).call(this,{type:"failed",failureCount:C,error:E})},onPause:()=>{J(this,Oe,at).call(this,{type:"pause"})},onContinue:()=>{J(this,Oe,at).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const C=await g(this,fe).start();if(C===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(C),(p=(f=g(this,Be).config).onSuccess)==null||p.call(f,C,this),(w=(y=g(this,Be).config).onSettled)==null||w.call(y,C,this.state.error,this),C}catch(C){if(C instanceof ti){if(C.silent)return g(this,fe).promise;if(C.revert){if(this.state.data===void 0)throw C;return this.state.data}}throw J(this,Oe,at).call(this,{type:"error",error:C}),(b=(k=g(this,Be).config).onError)==null||b.call(k,C,this),(S=(N=g(this,Be).config).onSettled)==null||S.call(N,this.state.data,C,this),C}finally{this.scheduleGc()}}},en=new WeakMap,Ft=new WeakMap,tn=new WeakMap,Be=new WeakMap,Dt=new WeakMap,fe=new WeakMap,Ln=new WeakMap,zt=new WeakMap,Oe=new WeakSet,Oa=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},at=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...La(r.data,this.options),fetchMeta:t.meta??null};case"success":const i={...r,...xs(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return T(this,tn,t.manual?i:void 0),i;case"error":const s=t.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),xe.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),g(this,Be).notify({query:this,type:"updated",action:t})})},ka);function La(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ta(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function xs(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function gs(e){const 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 _e,W,Fn,je,qt,nn,ot,vt,Dn,rn,sn,Bt,Ut,kt,an,ee,Nn,ni,ri,ii,si,ai,oi,li,Fa,ja,yl=(ja=class extends Bn{constructor(t,n){super();q(this,ee);q(this,_e);q(this,W);q(this,Fn);q(this,je);q(this,qt);q(this,nn);q(this,ot);q(this,vt);q(this,Dn);q(this,rn);q(this,sn);q(this,Bt);q(this,Ut);q(this,kt);q(this,an,new Set);this.options=n,T(this,_e,t),T(this,vt,null),T(this,ot,ei()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(g(this,W).addObserver(this),bs(g(this,W),this.options)?J(this,ee,Nn).call(this):this.updateResult(),J(this,ee,si).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ui(g(this,W),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ui(g(this,W),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,J(this,ee,ai).call(this),J(this,ee,oi).call(this),g(this,W).removeObserver(this)}setOptions(t){const n=this.options,r=g(this,W);if(this.options=g(this,_e).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Le(this.options.enabled,g(this,W))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");J(this,ee,li).call(this),g(this,W).setOptions(this.options),n._defaulted&&!Xr(this.options,n)&&g(this,_e).getQueryCache().notify({type:"observerOptionsUpdated",query:g(this,W),observer:this});const i=this.hasListeners();i&&ys(g(this,W),r,this.options,n)&&J(this,ee,Nn).call(this),this.updateResult(),i&&(g(this,W)!==r||Le(this.options.enabled,g(this,W))!==Le(n.enabled,g(this,W))||Et(this.options.staleTime,g(this,W))!==Et(n.staleTime,g(this,W)))&&J(this,ee,ni).call(this);const s=J(this,ee,ri).call(this);i&&(g(this,W)!==r||Le(this.options.enabled,g(this,W))!==Le(n.enabled,g(this,W))||s!==g(this,kt))&&J(this,ee,ii).call(this,s)}getOptimisticResult(t){const n=g(this,_e).getQueryCache().build(g(this,_e),t),r=this.createResult(n,t);return vl(this,r)&&(T(this,je,r),T(this,nn,this.options),T(this,qt,g(this,W).state)),r}getCurrentResult(){return g(this,je)}trackResult(t,n){return new Proxy(t,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&g(this,ot).status==="pending"&&g(this,ot).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(t){g(this,an).add(t)}getCurrentQuery(){return g(this,W)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=g(this,_e).defaultQueryOptions(t),r=g(this,_e).getQueryCache().build(g(this,_e),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return J(this,ee,Nn).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),g(this,je)))}createResult(t,n){var O;const r=g(this,W),i=this.options,s=g(this,je),o=g(this,qt),l=g(this,nn),c=t!==r?t.state:g(this,Fn),{state:d}=t;let h={...d},f=!1,p;if(n._optimisticResults){const z=this.hasListeners(),A=!z&&bs(t,n),_=z&&ys(t,r,n,i);(A||_)&&(h={...h,...La(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:y,errorUpdatedAt:w,status:k}=h;p=h.data;let b=!1;if(n.placeholderData!==void 0&&p===void 0&&k==="pending"){let z;s!=null&&s.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(z=s.data,b=!0):z=typeof n.placeholderData=="function"?n.placeholderData((O=g(this,sn))==null?void 0:O.state.data,g(this,sn)):n.placeholderData,z!==void 0&&(k="success",p=Zr(s==null?void 0:s.data,z,n),f=!0)}if(n.select&&p!==void 0&&!b)if(s&&p===(o==null?void 0:o.data)&&n.select===g(this,Dn))p=g(this,rn);else try{T(this,Dn,n.select),p=n.select(p),p=Zr(s==null?void 0:s.data,p,n),T(this,rn,p),T(this,vt,null)}catch(z){T(this,vt,z)}g(this,vt)&&(y=g(this,vt),p=g(this,rn),w=Date.now(),k="error");const N=h.fetchStatus==="fetching",S=k==="pending",C=k==="error",E=S&&N,v=p!==void 0,M={status:k,fetchStatus:h.fetchStatus,isPending:S,isSuccess:k==="success",isError:C,isInitialLoading:E,isLoading:E,data:p,dataUpdatedAt:h.dataUpdatedAt,error:y,errorUpdatedAt:w,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:h.dataUpdateCount>c.dataUpdateCount||h.errorUpdateCount>c.errorUpdateCount,isFetching:N,isRefetching:N&&!S,isLoadingError:C&&!v,isPaused:h.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:C&&v,isStale:Ri(t,n),refetch:this.refetch,promise:g(this,ot),isEnabled:Le(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const z=M.data!==void 0,A=M.status==="error"&&!z,_=R=>{A?R.reject(M.error):z&&R.resolve(M.data)},K=()=>{const R=T(this,ot,M.promise=ei());_(R)},F=g(this,ot);switch(F.status){case"pending":t.queryHash===r.queryHash&&_(F);break;case"fulfilled":(A||M.data!==F.value)&&K();break;case"rejected":(!A||M.error!==F.reason)&&K();break}}return M}updateResult(){const t=g(this,je),n=this.createResult(g(this,W),this.options);if(T(this,qt,g(this,W).state),T(this,nn,this.options),g(this,qt).data!==void 0&&T(this,sn,g(this,W)),Xr(n,t))return;T(this,je,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!g(this,an).size)return!0;const o=new Set(s??g(this,an));return this.options.throwOnError&&o.add("error"),Object.keys(g(this,je)).some(l=>{const u=l;return g(this,je)[u]!==t[u]&&o.has(u)})};J(this,ee,Fa).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&J(this,ee,si).call(this)}},_e=new WeakMap,W=new WeakMap,Fn=new WeakMap,je=new WeakMap,qt=new WeakMap,nn=new WeakMap,ot=new WeakMap,vt=new WeakMap,Dn=new WeakMap,rn=new WeakMap,sn=new WeakMap,Bt=new WeakMap,Ut=new WeakMap,kt=new WeakMap,an=new WeakMap,ee=new WeakSet,Nn=function(t){J(this,ee,li).call(this);let n=g(this,W).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Pe)),n},ni=function(){J(this,ee,ai).call(this);const t=Et(this.options.staleTime,g(this,W));if(An.isServer()||g(this,je).isStale||!Wr(t))return;const r=_a(g(this,je).dataUpdatedAt,t)+1;T(this,Bt,Mt.setTimeout(()=>{g(this,je).isStale||this.updateResult()},r))},ri=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(g(this,W)):this.options.refetchInterval)??!1},ii=function(t){J(this,ee,oi).call(this),T(this,kt,t),!(An.isServer()||Le(this.options.enabled,g(this,W))===!1||!Wr(g(this,kt))||g(this,kt)===0)&&T(this,Ut,Mt.setInterval(()=>{(this.options.refetchIntervalInBackground||Ei.isFocused())&&J(this,ee,Nn).call(this)},g(this,kt)))},si=function(){J(this,ee,ni).call(this),J(this,ee,ii).call(this,J(this,ee,ri).call(this))},ai=function(){g(this,Bt)!==void 0&&(Mt.clearTimeout(g(this,Bt)),T(this,Bt,void 0))},oi=function(){g(this,Ut)!==void 0&&(Mt.clearInterval(g(this,Ut)),T(this,Ut,void 0))},li=function(){const t=g(this,_e).getQueryCache().build(g(this,_e),this.options);if(t===g(this,W))return;const n=g(this,W);T(this,W,t),T(this,Fn,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Fa=function(t){xe.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(g(this,je))}),g(this,_e).getQueryCache().notify({query:g(this,W),type:"observerResultsUpdated"})})},ja);function wl(e,t){return Le(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Le(t.retryOnMount,e)===!1)}function bs(e,t){return wl(e,t)||e.state.data!==void 0&&ui(e,t,t.refetchOnMount)}function ui(e,t,n){if(Le(t.enabled,e)!==!1&&Et(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Ri(e,t)}return!1}function ys(e,t,n,r){return(e!==t||Le(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Ri(e,n)}function Ri(e,t){return Le(t.enabled,e)!==!1&&e.isStaleByTime(Et(t.staleTime,e))}function vl(e,t){return!Xr(e.getCurrentResult(),t)}var zn,Xe,ye,$t,Ye,gt,Na,kl=(Na=class extends Ma{constructor(t){super();q(this,Ye);q(this,zn);q(this,Xe);q(this,ye);q(this,$t);T(this,zn,t.client),this.mutationId=t.mutationId,T(this,ye,t.mutationCache),T(this,Xe,[]),this.state=t.state||jl(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){g(this,Xe).includes(t)||(g(this,Xe).push(t),this.clearGcTimeout(),g(this,ye).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){T(this,Xe,g(this,Xe).filter(n=>n!==t)),this.scheduleGc(),g(this,ye).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){g(this,Xe).length||(this.state.status==="pending"?this.scheduleGc():g(this,ye).remove(this))}continue(){var t;return((t=g(this,$t))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,u,c,d,h,f,p,y,w,k,b,N,S,C,E,v,L;const n=()=>{J(this,Ye,gt).call(this,{type:"continue"})},r={client:g(this,zn),meta:this.options.meta,mutationKey:this.options.mutationKey};T(this,$t,Aa({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(M,O)=>{J(this,Ye,gt).call(this,{type:"failed",failureCount:M,error:O})},onPause:()=>{J(this,Ye,gt).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>g(this,ye).canRun(this)}));const i=this.state.status==="pending",s=!g(this,$t).canStart();try{if(i)n();else{J(this,Ye,gt).call(this,{type:"pending",variables:t,isPaused:s}),g(this,ye).config.onMutate&&await g(this,ye).config.onMutate(t,this,r);const O=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t,r));O!==this.state.context&&J(this,Ye,gt).call(this,{type:"pending",context:O,variables:t,isPaused:s})}const M=await g(this,$t).start();return await((c=(u=g(this,ye).config).onSuccess)==null?void 0:c.call(u,M,t,this.state.context,this,r)),await((h=(d=this.options).onSuccess)==null?void 0:h.call(d,M,t,this.state.context,r)),await((p=(f=g(this,ye).config).onSettled)==null?void 0:p.call(f,M,null,this.state.variables,this.state.context,this,r)),await((w=(y=this.options).onSettled)==null?void 0:w.call(y,M,null,t,this.state.context,r)),J(this,Ye,gt).call(this,{type:"success",data:M}),M}catch(M){try{await((b=(k=g(this,ye).config).onError)==null?void 0:b.call(k,M,t,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((S=(N=this.options).onError)==null?void 0:S.call(N,M,t,this.state.context,r))}catch(O){Promise.reject(O)}try{await((E=(C=g(this,ye).config).onSettled)==null?void 0:E.call(C,void 0,M,this.state.variables,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((L=(v=this.options).onSettled)==null?void 0:L.call(v,void 0,M,t,this.state.context,r))}catch(O){Promise.reject(O)}throw J(this,Ye,gt).call(this,{type:"error",error:M}),M}finally{g(this,ye).runNext(this)}}},zn=new WeakMap,Xe=new WeakMap,ye=new WeakMap,$t=new WeakMap,Ye=new WeakSet,gt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),xe.batch(()=>{g(this,Xe).forEach(r=>{r.onMutationUpdate(t)}),g(this,ye).notify({mutation:this,type:"updated",action:t})})},Na);function jl(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var lt,Ke,qn,Sa,Nl=(Sa=class extends Bn{constructor(t={}){super();q(this,lt);q(this,Ke);q(this,qn);this.config=t,T(this,lt,new Set),T(this,Ke,new Map),T(this,qn,0)}build(t,n,r){const i=new kl({client:t,mutationCache:this,mutationId:++tr(this,qn)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){g(this,lt).add(t);const n=rr(t);if(typeof n=="string"){const r=g(this,Ke).get(n);r?r.push(t):g(this,Ke).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(g(this,lt).delete(t)){const n=rr(t);if(typeof n=="string"){const r=g(this,Ke).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&g(this,Ke).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=rr(t);if(typeof n=="string"){const r=g(this,Ke).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r;const n=rr(t);if(typeof n=="string"){const i=(r=g(this,Ke).get(n))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){xe.batch(()=>{g(this,lt).forEach(t=>{this.notify({type:"removed",mutation:t})}),g(this,lt).clear(),g(this,Ke).clear()})}getAll(){return Array.from(g(this,lt))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>hs(n,r))}findAll(t={}){return this.getAll().filter(n=>hs(t,n))}notify(t){xe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return xe.batch(()=>Promise.all(t.map(n=>n.continue().catch(Pe))))}},lt=new WeakMap,Ke=new WeakMap,qn=new WeakMap,Sa);function rr(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Ze,Ca,Sl=(Ca=class extends Bn{constructor(t={}){super();q(this,Ze);this.config=t,T(this,Ze,new Map)}build(t,n,r){const i=n.queryKey,s=n.queryHash??_i(i,n);let o=this.get(s);return o||(o=new bl({client:t,queryKey:i,queryHash:s,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(o)),o}add(t){g(this,Ze).has(t.queryHash)||(g(this,Ze).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=g(this,Ze).get(t.queryHash);n&&(t.destroy(),n===t&&g(this,Ze).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){xe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return g(this,Ze).get(t)}getAll(){return[...g(this,Ze).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>ds(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>ds(t,r)):n}notify(t){xe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){xe.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){xe.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ze=new WeakMap,Ca),ue,jt,Nt,on,ln,St,un,cn,Ea,Cl=(Ea=class{constructor(e={}){q(this,ue);q(this,jt);q(this,Nt);q(this,on);q(this,ln);q(this,St);q(this,un);q(this,cn);T(this,ue,e.queryCache||new Sl),T(this,jt,e.mutationCache||new Nl),T(this,Nt,e.defaultOptions||{}),T(this,on,new Map),T(this,ln,new Map),T(this,St,0)}mount(){tr(this,St)._++,g(this,St)===1&&(T(this,un,Ei.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,ue).onFocus())})),T(this,cn,dr.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,ue).onOnline())})))}unmount(){var e,t;tr(this,St)._--,g(this,St)===0&&((e=g(this,un))==null||e.call(this),T(this,un,void 0),(t=g(this,cn))==null||t.call(this),T(this,cn,void 0))}isFetching(e){return g(this,ue).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return g(this,jt).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=g(this,ue).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=g(this,ue).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Et(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return g(this,ue).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=g(this,ue).get(r.queryHash),s=i==null?void 0:i.state.data,o=al(t,s);if(o!==void 0)return g(this,ue).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return xe.batch(()=>g(this,ue).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=g(this,ue).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=g(this,ue);xe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=g(this,ue);return xe.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=xe.batch(()=>g(this,ue).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(Pe).catch(Pe)}invalidateQueries(e,t={}){return xe.batch(()=>(g(this,ue).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=xe.batch(()=>g(this,ue).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Pe)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Pe)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=g(this,ue).build(this,t);return n.isStaleByTime(Et(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Pe).catch(Pe)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Pe).catch(Pe)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return dr.isOnline()?g(this,jt).resumePausedMutations():Promise.resolve()}getQueryCache(){return g(this,ue)}getMutationCache(){return g(this,jt)}getDefaultOptions(){return g(this,Nt)}setDefaultOptions(e){T(this,Nt,e)}setQueryDefaults(e,t){g(this,on).set(In(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...g(this,on).values()],n={};return t.forEach(r=>{Tn(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){g(this,ln).set(In(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...g(this,ln).values()],n={};return t.forEach(r=>{Tn(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...g(this,Nt).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=_i(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===Pi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...g(this,Nt).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){g(this,ue).clear(),g(this,jt).clear()}},ue=new WeakMap,jt=new WeakMap,Nt=new WeakMap,on=new WeakMap,ln=new WeakMap,St=new WeakMap,un=new WeakMap,cn=new WeakMap,Ea),Da=ge.createContext(void 0),za=e=>{const t=ge.useContext(Da);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},El=({client:e,children:t})=>(ge.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(Da.Provider,{value:e,children:t})),qa=ge.createContext(!1),_l=()=>ge.useContext(qa);qa.Provider;function Pl(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Rl=ge.createContext(Pl()),Il=()=>ge.useContext(Rl),Tl=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Ia(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Al=e=>{ge.useEffect(()=>{e.clearReset()},[e])},Ml=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Ia(n,[e.error,r])),Ol=e=>{if(e.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Ll=(e,t)=>e.isLoading&&e.isFetching&&!t,Fl=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,ws=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Dl(e,t,n){var f,p,y,w;const r=_l(),i=Il(),s=za(),o=s.defaultQueryOptions(e);(p=(f=s.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||p.call(f,o);const l=s.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",Ol(o),Tl(o,i,l),Al(i);const u=!s.getQueryCache().get(o.queryHash),[c]=ge.useState(()=>new t(s,o)),d=c.getOptimisticResult(o),h=!r&&e.subscribed!==!1;if(ge.useSyncExternalStore(ge.useCallback(k=>{const b=h?c.subscribe(xe.batchCalls(k)):Pe;return c.updateResult(),b},[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),ge.useEffect(()=>{c.setOptions(o)},[o,c]),Fl(o,d))throw ws(o,c,i);if(Ml({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:l,suspense:o.suspense}))throw d.error;if((w=(y=s.getDefaultOptions().queries)==null?void 0:y._experimental_afterQuery)==null||w.call(y,o,d),o.experimental_prefetchInRender&&!An.isServer()&&Ll(d,r)){const k=u?ws(o,c,i):l==null?void 0:l.promise;k==null||k.catch(Pe).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?d:c.trackResult(d)}function ke(e,t){return Dl(e,yl)}/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zl=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ba=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var ql={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Bl=ge.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...l},u)=>ge.createElement("svg",{ref:u,...ql,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Ba("lucide",i),...l},[...o.map(([c,d])=>ge.createElement(c,d)),...Array.isArray(s)?s:[s]]));/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oe=(e,t)=>{const n=ge.forwardRef(({className:r,...i},s)=>ge.createElement(Bl,{ref:s,iconNode:t,className:Ba(`lucide-${zl(e)}`,r),...i}));return n.displayName=`${e}`,n};/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ua=oe("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ul=oe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ii=oe("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Un=oe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dn=oe("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hr=oe("CircleUserRound",[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $a=oe("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vs=oe("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jr=oe("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $l=oe("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Hl=oe("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Cn=oe("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Nr=oe("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ql=oe("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ha=oe("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Sr=oe("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Kl=oe("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Vl=oe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Qa=oe("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ti=oe("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Gl=oe("TimerReset",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M12 14v-4",key:"1evpnu"}],["path",{d:"M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6",key:"1ts96g"}],["path",{d:"M9 17H4v5",key:"8t5av"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ci=oe("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ai=oe("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** - * @license lucide-react v0.468.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Cr=oe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Jl(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Wl=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xl=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Yl={};function ks(e,t){return(Yl.jsx?Xl:Wl).test(e)}const Zl=/[ \t\n\f\r]/g;function eu(e){return typeof e=="object"?e.type==="text"?js(e.value):!1:js(e)}function js(e){return e.replace(Zl,"")===""}class $n{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}$n.prototype.normal={};$n.prototype.property={};$n.prototype.space=void 0;function Ka(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new $n(n,r,t)}function di(e){return e.toLowerCase()}class Ae{constructor(t,n){this.attribute=n,this.property=t}}Ae.prototype.attribute="";Ae.prototype.booleanish=!1;Ae.prototype.boolean=!1;Ae.prototype.commaOrSpaceSeparated=!1;Ae.prototype.commaSeparated=!1;Ae.prototype.defined=!1;Ae.prototype.mustUseProperty=!1;Ae.prototype.number=!1;Ae.prototype.overloadedBoolean=!1;Ae.prototype.property="";Ae.prototype.spaceSeparated=!1;Ae.prototype.space=void 0;let tu=0;const $=Qt(),de=Qt(),hi=Qt(),P=Qt(),ne=Qt(),Ht=Qt(),Me=Qt();function Qt(){return 2**++tu}const pi=Object.freeze(Object.defineProperty({__proto__:null,boolean:$,booleanish:de,commaOrSpaceSeparated:Me,commaSeparated:Ht,number:P,overloadedBoolean:hi,spaceSeparated:ne},Symbol.toStringTag,{value:"Module"})),Ar=Object.keys(pi);class Mi extends Ae{constructor(t,n,r,i){let s=-1;if(super(t,n),Ns(this,"space",i),typeof r=="number")for(;++s4&&n.slice(0,4)==="data"&&au.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Ss,uu);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Ss.test(s)){let o=s.replace(su,lu);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Mi}return new i(r,t)}function lu(e){return"-"+e.toLowerCase()}function uu(e){return e.charAt(1).toUpperCase()}const cu=Ka([Va,nu,Wa,Xa,Ya],"html"),Oi=Ka([Va,ru,Wa,Xa,Ya],"svg");function du(e){return e.join(" ").trim()}var Vt={},Mr,Cs;function hu(){if(Cs)return Mr;Cs=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g,u=` -`,c="/",d="*",h="",f="comment",p="declaration";function y(k,b){if(typeof k!="string")throw new TypeError("First argument must be a string");if(!k)return[];b=b||{};var N=1,S=1;function C(F){var R=F.match(t);R&&(N+=R.length);var V=F.lastIndexOf(u);S=~V?F.length-V:S+F.length}function E(){var F={line:N,column:S};return function(R){return R.position=new v(F),O(),R}}function v(F){this.start=F,this.end={line:N,column:S},this.source=b.source}v.prototype.content=k;function L(F){var R=new Error(b.source+":"+N+":"+S+": "+F);if(R.reason=F,R.filename=b.source,R.line=N,R.column=S,R.source=k,!b.silent)throw R}function M(F){var R=F.exec(k);if(R){var V=R[0];return C(V),k=k.slice(V.length),R}}function O(){M(n)}function z(F){var R;for(F=F||[];R=A();)R!==!1&&F.push(R);return F}function A(){var F=E();if(!(c!=k.charAt(0)||d!=k.charAt(1))){for(var R=2;h!=k.charAt(R)&&(d!=k.charAt(R)||c!=k.charAt(R+1));)++R;if(R+=2,h===k.charAt(R-1))return L("End of comment missing");var V=k.slice(2,R-2);return S+=2,C(V),k=k.slice(R),S+=2,F({type:f,comment:V})}}function _(){var F=E(),R=M(r);if(R){if(A(),!M(i))return L("property missing ':'");var V=M(s),te=F({type:p,property:w(R[0].replace(e,h)),value:V?w(V[0].replace(e,h)):h});return M(o),te}}function K(){var F=[];z(F);for(var R;R=_();)R!==!1&&(F.push(R),z(F));return F}return O(),K()}function w(k){return k?k.replace(l,h):h}return Mr=y,Mr}var Es;function pu(){if(Es)return Vt;Es=1;var e=Vt&&Vt.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.default=n;const t=e(hu());function n(r,i){let s=null;if(!r||typeof r!="string")return s;const o=(0,t.default)(r),l=typeof i=="function";return o.forEach(u=>{if(u.type!=="declaration")return;const{property:c,value:d}=u;l?i(c,d,u):d&&(s=s||{},s[c]=d)}),s}return Vt}var bn={},_s;function fu(){if(_s)return bn;_s=1,Object.defineProperty(bn,"__esModule",{value:!0}),bn.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(c){return!c||n.test(c)||e.test(c)},o=function(c,d){return d.toUpperCase()},l=function(c,d){return"".concat(d,"-")},u=function(c,d){return d===void 0&&(d={}),s(c)?c:(c=c.toLowerCase(),d.reactCompat?c=c.replace(i,l):c=c.replace(r,l),c.replace(t,o))};return bn.camelCase=u,bn}var yn,Ps;function mu(){if(Ps)return yn;Ps=1;var e=yn&&yn.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(pu()),n=fu();function r(i,s){var o={};return!i||typeof i!="string"||(0,t.default)(i,function(l,u){l&&u&&(o[(0,n.camelCase)(l,s)]=u)}),o}return r.default=r,yn=r,yn}var xu=mu();const gu=Ni(xu),Za=eo("end"),Li=eo("start");function eo(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function bu(e){const t=Li(e),n=Za(e);if(t&&n)return{start:t,end:n}}function En(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Rs(e.position):"start"in e||"end"in e?Rs(e):"line"in e||"column"in e?fi(e):""}function fi(e){return Is(e&&e.line)+":"+Is(e&&e.column)}function Rs(e){return fi(e&&e.start)+"-"+fi(e&&e.end)}function Is(e){return e&&typeof e=="number"?e:1}class we extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?s.ruleId=r:(s.source=r.slice(0,u),s.ruleId=r.slice(u+1))}if(!s.place&&s.ancestors&&s.ancestors){const u=s.ancestors[s.ancestors.length-1];u&&(s.place=u.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=En(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}we.prototype.file="";we.prototype.name="";we.prototype.reason="";we.prototype.message="";we.prototype.stack="";we.prototype.column=void 0;we.prototype.line=void 0;we.prototype.ancestors=void 0;we.prototype.cause=void 0;we.prototype.fatal=void 0;we.prototype.place=void 0;we.prototype.ruleId=void 0;we.prototype.source=void 0;const Fi={}.hasOwnProperty,yu=new Map,wu=/[A-Z]/g,vu=new Set(["table","tbody","thead","tfoot","tr"]),ku=new Set(["td","th"]),to="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function ju(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Iu(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Ru(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Oi:cu,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=no(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function no(e,t,n){if(t.type==="element")return Nu(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Su(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Eu(e,t,n);if(t.type==="mdxjsEsm")return Cu(e,t);if(t.type==="root")return _u(e,t,n);if(t.type==="text")return Pu(e,t)}function Nu(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Oi,e.schema=i),e.ancestors.push(t);const s=io(e,t.tagName,!1),o=Tu(e,t);let l=zi(e,t);return vu.has(t.tagName)&&(l=l.filter(function(u){return typeof u=="string"?!eu(u):!0})),ro(e,o,s,t),Di(o,l),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function Su(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Mn(e,t.position)}function Cu(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Mn(e,t.position)}function Eu(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Oi,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:io(e,t.name,!0),o=Au(e,t),l=zi(e,t);return ro(e,o,s,t),Di(o,l),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function _u(e,t,n){const r={};return Di(r,zi(e,t)),e.create(t,e.Fragment,r,n)}function Pu(e,t){return t.value}function ro(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Di(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Ru(e,t,n){return r;function r(i,s,o,l){const c=Array.isArray(o.children)?n:t;return l?c(s,o,l):c(s,o)}}function Iu(e,t){return n;function n(r,i,s,o){const l=Array.isArray(s.children),u=Li(r);return t(i,s,o,l,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function Tu(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Fi.call(t.properties,i)){const s=Mu(e,i,t.properties[i]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&ku.has(t.tagName)?r=l:n[o]=l}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Au(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Mn(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else Mn(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function zi(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:yu;for(;++ri?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s0?(nt(e,e.length,0,t),e):t}const Ms={}.hasOwnProperty;function Uu(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Jt(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const tt=Pt(/[A-Za-z]/),Fe=Pt(/[\dA-Za-z]/),Qu=Pt(/[#-'*+\--9=?A-Z^-~]/);function mi(e){return e!==null&&(e<32||e===127)}const xi=Pt(/\d/),Ku=Pt(/[\dA-Fa-f]/),Vu=Pt(/[!-/:-@[-`{-~]/);function B(e){return e!==null&&e<-2}function Ie(e){return e!==null&&(e<0||e===32)}function X(e){return e===-2||e===-1||e===32}const Gu=Pt(new RegExp("\\p{P}|\\p{S}","u")),Ju=Pt(/\s/);function Pt(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function pn(e){const t=[];let n=-1,r=0,i=0;for(;++n55295&&s<57344){const l=e.charCodeAt(n+1);s<56320&&l>56319&&l<57344?(o=String.fromCharCode(s,l),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function ie(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(u){return X(u)?(e.enter(n),l(u)):t(u)}function l(u){return X(u)&&s++o))return;const L=t.events.length;let M=L,O,z;for(;M--;)if(t.events[M][0]==="exit"&&t.events[M][1].type==="chunkFlow"){if(O){z=t.events[M][1].end;break}O=!0}for(b(r),v=L;vS;){const E=n[C];t.containerState=E[1],E[0].exit.call(t,e)}n.length=S}function N(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function ec(e,t,n){return ie(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ls(e){if(e===null||Ie(e)||Ju(e))return 1;if(Gu(e))return 2}function Bi(e,t,n){const r=[];let i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[r][1].end},f={...e[n][1].start};Fs(h,-u),Fs(f,u),o={type:u>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},l={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},s={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:u>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=Ue(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Ue(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=Ue(c,Bi(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Ue(c,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,c=Ue(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,nt(e,r-1,n-r+3,c),n=r+c.length-d-2;break}}for(n=-1;++n0&&X(v)?ie(e,N,"linePrefix",s+1)(v):N(v)}function N(v){return v===null||B(v)?e.check(Ds,w,C)(v):(e.enter("codeFlowValue"),S(v))}function S(v){return v===null||B(v)?(e.exit("codeFlowValue"),N(v)):(e.consume(v),S)}function C(v){return e.exit("codeFenced"),t(v)}function E(v,L,M){let O=0;return z;function z(R){return v.enter("lineEnding"),v.consume(R),v.exit("lineEnding"),A}function A(R){return v.enter("codeFencedFence"),X(R)?ie(v,_,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):_(R)}function _(R){return R===l?(v.enter("codeFencedFenceSequence"),K(R)):M(R)}function K(R){return R===l?(O++,v.consume(R),K):O>=o?(v.exit("codeFencedFenceSequence"),X(R)?ie(v,F,"whitespace")(R):F(R)):M(R)}function F(R){return R===null||B(R)?(v.exit("codeFencedFence"),L(R)):M(R)}}}function hc(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Lr={name:"codeIndented",tokenize:fc},pc={partial:!0,tokenize:mc};function fc(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),ie(e,s,"linePrefix",5)(c)}function s(c){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?u(c):B(c)?e.attempt(pc,o,u)(c):(e.enter("codeFlowValue"),l(c))}function l(c){return c===null||B(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),l)}function u(c){return e.exit("codeIndented"),t(c)}}function mc(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):B(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):ie(e,s,"linePrefix",5)(o)}function s(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):B(o)?i(o):n(o)}}const xc={name:"codeText",previous:bc,resolve:gc,tokenize:yc};function gc(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&wn(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),wn(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),wn(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function ho(e,t,n,r,i,s,o,l,u){const c=u||Number.POSITIVE_INFINITY;let d=0;return h;function h(b){return b===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(b),e.exit(s),f):b===null||b===32||b===41||mi(b)?n(b):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),w(b))}function f(b){return b===62?(e.enter(s),e.consume(b),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(b))}function p(b){return b===62?(e.exit("chunkString"),e.exit(l),f(b)):b===null||b===60||B(b)?n(b):(e.consume(b),b===92?y:p)}function y(b){return b===60||b===62||b===92?(e.consume(b),p):p(b)}function w(b){return!d&&(b===null||b===41||Ie(b))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(b)):d999||p===null||p===91||p===93&&!u||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(s),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):B(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||B(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),u||(u=!X(p)),p===92?f:h)}function f(p){return p===91||p===92||p===93?(e.consume(p),l++,h):h(p)}}function fo(e,t,n,r,i,s){let o;return l;function l(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,u):n(f)}function u(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(s),c(f))}function c(f){return f===o?(e.exit(s),u(o)):f===null?n(f):B(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ie(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===o||f===null||B(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?h:d)}function h(f){return f===o||f===92?(e.consume(f),d):d(f)}}function _n(e,t){let n;return r;function r(i){return B(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):X(i)?ie(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const Ec={name:"definition",tokenize:Pc},_c={partial:!0,tokenize:Rc};function Pc(e,t,n){const r=this;let i;return s;function s(p){return e.enter("definition"),o(p)}function o(p){return po.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return i=Jt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),u):n(p)}function u(p){return Ie(p)?_n(e,c)(p):c(p)}function c(p){return ho(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(_c,h,h)(p)}function h(p){return X(p)?ie(e,f,"whitespace")(p):f(p)}function f(p){return p===null||B(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function Rc(e,t,n){return r;function r(l){return Ie(l)?_n(e,i)(l):n(l)}function i(l){return fo(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return X(l)?ie(e,o,"whitespace")(l):o(l)}function o(l){return l===null||B(l)?t(l):n(l)}}const Ic={name:"hardBreakEscape",tokenize:Tc};function Tc(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return B(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const Ac={name:"headingAtx",resolve:Mc,tokenize:Oc};function Mc(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},nt(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function Oc(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||Ie(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),u(d)):d===null||B(d)?(e.exit("atxHeading"),t(d)):X(d)?ie(e,l,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function u(d){return d===35?(e.consume(d),u):(e.exit("atxHeadingSequence"),l(d))}function c(d){return d===null||d===35||Ie(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),c)}}const Lc=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],qs=["pre","script","style","textarea"],Fc={concrete:!0,name:"htmlFlow",resolveTo:qc,tokenize:Bc},Dc={partial:!0,tokenize:$c},zc={partial:!0,tokenize:Uc};function qc(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Bc(e,t,n){const r=this;let i,s,o,l,u;return c;function c(x){return d(x)}function d(x){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(x),h}function h(x){return x===33?(e.consume(x),f):x===47?(e.consume(x),s=!0,w):x===63?(e.consume(x),i=3,r.interrupt?t:m):tt(x)?(e.consume(x),o=String.fromCharCode(x),k):n(x)}function f(x){return x===45?(e.consume(x),i=2,p):x===91?(e.consume(x),i=5,l=0,y):tt(x)?(e.consume(x),i=4,r.interrupt?t:m):n(x)}function p(x){return x===45?(e.consume(x),r.interrupt?t:m):n(x)}function y(x){const Se="CDATA[";return x===Se.charCodeAt(l++)?(e.consume(x),l===Se.length?r.interrupt?t:_:y):n(x)}function w(x){return tt(x)?(e.consume(x),o=String.fromCharCode(x),k):n(x)}function k(x){if(x===null||x===47||x===62||Ie(x)){const Se=x===47,rt=o.toLowerCase();return!Se&&!s&&qs.includes(rt)?(i=1,r.interrupt?t(x):_(x)):Lc.includes(o.toLowerCase())?(i=6,Se?(e.consume(x),b):r.interrupt?t(x):_(x)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(x):s?N(x):S(x))}return x===45||Fe(x)?(e.consume(x),o+=String.fromCharCode(x),k):n(x)}function b(x){return x===62?(e.consume(x),r.interrupt?t:_):n(x)}function N(x){return X(x)?(e.consume(x),N):z(x)}function S(x){return x===47?(e.consume(x),z):x===58||x===95||tt(x)?(e.consume(x),C):X(x)?(e.consume(x),S):z(x)}function C(x){return x===45||x===46||x===58||x===95||Fe(x)?(e.consume(x),C):E(x)}function E(x){return x===61?(e.consume(x),v):X(x)?(e.consume(x),E):S(x)}function v(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),u=x,L):X(x)?(e.consume(x),v):M(x)}function L(x){return x===u?(e.consume(x),u=null,O):x===null||B(x)?n(x):(e.consume(x),L)}function M(x){return x===null||x===34||x===39||x===47||x===60||x===61||x===62||x===96||Ie(x)?E(x):(e.consume(x),M)}function O(x){return x===47||x===62||X(x)?S(x):n(x)}function z(x){return x===62?(e.consume(x),A):n(x)}function A(x){return x===null||B(x)?_(x):X(x)?(e.consume(x),A):n(x)}function _(x){return x===45&&i===2?(e.consume(x),V):x===60&&i===1?(e.consume(x),te):x===62&&i===4?(e.consume(x),ae):x===63&&i===3?(e.consume(x),m):x===93&&i===5?(e.consume(x),pe):B(x)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Dc,De,K)(x)):x===null||B(x)?(e.exit("htmlFlowData"),K(x)):(e.consume(x),_)}function K(x){return e.check(zc,F,De)(x)}function F(x){return e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),R}function R(x){return x===null||B(x)?K(x):(e.enter("htmlFlowData"),_(x))}function V(x){return x===45?(e.consume(x),m):_(x)}function te(x){return x===47?(e.consume(x),o="",ce):_(x)}function ce(x){if(x===62){const Se=o.toLowerCase();return qs.includes(Se)?(e.consume(x),ae):_(x)}return tt(x)&&o.length<8?(e.consume(x),o+=String.fromCharCode(x),ce):_(x)}function pe(x){return x===93?(e.consume(x),m):_(x)}function m(x){return x===62?(e.consume(x),ae):x===45&&i===2?(e.consume(x),m):_(x)}function ae(x){return x===null||B(x)?(e.exit("htmlFlowData"),De(x)):(e.consume(x),ae)}function De(x){return e.exit("htmlFlow"),t(x)}}function Uc(e,t,n){const r=this;return i;function i(o){return B(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function $c(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Er,t,n)}}const Hc={name:"htmlText",tokenize:Qc};function Qc(e,t,n){const r=this;let i,s,o;return l;function l(m){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(m),u}function u(m){return m===33?(e.consume(m),c):m===47?(e.consume(m),E):m===63?(e.consume(m),S):tt(m)?(e.consume(m),M):n(m)}function c(m){return m===45?(e.consume(m),d):m===91?(e.consume(m),s=0,y):tt(m)?(e.consume(m),N):n(m)}function d(m){return m===45?(e.consume(m),p):n(m)}function h(m){return m===null?n(m):m===45?(e.consume(m),f):B(m)?(o=h,te(m)):(e.consume(m),h)}function f(m){return m===45?(e.consume(m),p):h(m)}function p(m){return m===62?V(m):m===45?f(m):h(m)}function y(m){const ae="CDATA[";return m===ae.charCodeAt(s++)?(e.consume(m),s===ae.length?w:y):n(m)}function w(m){return m===null?n(m):m===93?(e.consume(m),k):B(m)?(o=w,te(m)):(e.consume(m),w)}function k(m){return m===93?(e.consume(m),b):w(m)}function b(m){return m===62?V(m):m===93?(e.consume(m),b):w(m)}function N(m){return m===null||m===62?V(m):B(m)?(o=N,te(m)):(e.consume(m),N)}function S(m){return m===null?n(m):m===63?(e.consume(m),C):B(m)?(o=S,te(m)):(e.consume(m),S)}function C(m){return m===62?V(m):S(m)}function E(m){return tt(m)?(e.consume(m),v):n(m)}function v(m){return m===45||Fe(m)?(e.consume(m),v):L(m)}function L(m){return B(m)?(o=L,te(m)):X(m)?(e.consume(m),L):V(m)}function M(m){return m===45||Fe(m)?(e.consume(m),M):m===47||m===62||Ie(m)?O(m):n(m)}function O(m){return m===47?(e.consume(m),V):m===58||m===95||tt(m)?(e.consume(m),z):B(m)?(o=O,te(m)):X(m)?(e.consume(m),O):V(m)}function z(m){return m===45||m===46||m===58||m===95||Fe(m)?(e.consume(m),z):A(m)}function A(m){return m===61?(e.consume(m),_):B(m)?(o=A,te(m)):X(m)?(e.consume(m),A):O(m)}function _(m){return m===null||m===60||m===61||m===62||m===96?n(m):m===34||m===39?(e.consume(m),i=m,K):B(m)?(o=_,te(m)):X(m)?(e.consume(m),_):(e.consume(m),F)}function K(m){return m===i?(e.consume(m),i=void 0,R):m===null?n(m):B(m)?(o=K,te(m)):(e.consume(m),K)}function F(m){return m===null||m===34||m===39||m===60||m===61||m===96?n(m):m===47||m===62||Ie(m)?O(m):(e.consume(m),F)}function R(m){return m===47||m===62||Ie(m)?O(m):n(m)}function V(m){return m===62?(e.consume(m),e.exit("htmlTextData"),e.exit("htmlText"),t):n(m)}function te(m){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),ce}function ce(m){return X(m)?ie(e,pe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m):pe(m)}function pe(m){return e.enter("htmlTextData"),o(m)}}const Ui={name:"labelEnd",resolveAll:Jc,resolveTo:Wc,tokenize:Xc},Kc={tokenize:Yc},Vc={tokenize:Zc},Gc={tokenize:ed};function Jc(e){let t=-1;const n=[];for(;++t=3&&(c===null||B(c))?(e.exit("thematicBreak"),t(c)):n(c)}function u(c){return c===i?(e.consume(c),r++,u):(e.exit("thematicBreakSequence"),X(c)?ie(e,l,"whitespace")(c):l(c))}}const Ee={continuation:{tokenize:cd},exit:hd,name:"list",tokenize:ud},od={partial:!0,tokenize:pd},ld={partial:!0,tokenize:dd};function ud(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return l;function l(p){const y=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:xi(p)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(cr,n,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(p)}return n(p)}function u(p){return xi(p)&&++o<10?(e.consume(p),u):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Er,r.interrupt?n:d,e.attempt(od,f,h))}function d(p){return r.containerState.initialBlankLine=!0,s++,f(p)}function h(p){return X(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function cd(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Er,i,s);function i(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ie(e,t,"listItemIndent",r.containerState.size+1)(l)}function s(l){return r.containerState.furtherBlankLines||!X(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(ld,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,ie(e,e.attempt(Ee,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function dd(e,t,n){const r=this;return ie(e,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(s):n(s)}}function hd(e){e.exit(this.containerState.type)}function pd(e,t,n){const r=this;return ie(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!X(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const Bs={name:"setextUnderline",resolveTo:fd,tokenize:md};function fd(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function md(e,t,n){const r=this;let i;return s;function s(c){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),l(c)}function l(c){return c===i?(e.consume(c),l):(e.exit("setextHeadingLineSequence"),X(c)?ie(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||B(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const xd={tokenize:gd};function gd(e){const t=this,n=e.attempt(Er,r,e.attempt(this.parser.constructs.flowInitial,i,ie(e,e.attempt(this.parser.constructs.flow,i,e.attempt(kc,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const bd={resolveAll:xo()},yd=mo("string"),wd=mo("text");function mo(e){return{resolveAll:xo(e==="text"?vd:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,l);return o;function o(d){return c(d)?s(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),u}function u(d){return c(d)?(n.exit("data"),s(d)):(n.consume(d),u)}function c(d){if(d===null)return!0;const h=i[d];let f=-1;if(h)for(;++f-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function Md(e,t){let n=-1;const r=[];let i;for(;++n0){const Ce=U.tokenStack[U.tokenStack.length-1];(Ce[1]||$s).call(U,void 0,Ce[0])}for(I.position={start:ft(j.length>0?j[0][1].start:{line:1,column:1,offset:0}),end:ft(j.length>0?j[j.length-2][1].end:{line:1,column:1,offset:0})},Y=-1;++Y0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function Gd(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Jd(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Wd(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=pn(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let o,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=s+1,l+=1,e.footnoteCounts.set(r,l);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,u);const c={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,c),e.applyData(t,c)}function Xd(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Yd(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function yo(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function Zd(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return yo(e,t);const i={src:pn(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function eh(e,t){const n={src:pn(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function th(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function nh(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return yo(e,t);const i={href:pn(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function rh(e,t){const n={href:pn(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function ih(e,t,n){const r=e.all(t),i=n?sh(n):wo(t),s={},o=[];if(typeof t.checked=="boolean"){const d=r[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let l=-1;for(;++l1}function ah(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=Li(t.children[1]),u=Za(t.children[t.children.length-1]);l&&u&&(o.position={start:l,end:u}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function dh(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let u=-1;const c=[];for(;++u0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(Ks(t.slice(i),i>0,!1)),s.join("")}function Ks(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===Hs||s===Qs;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===Hs||s===Qs;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function fh(e,t){const n={type:"text",value:ph(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function mh(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const xh={blockquote:Qd,break:Kd,code:Vd,delete:Gd,emphasis:Jd,footnoteReference:Wd,heading:Xd,html:Yd,imageReference:Zd,image:eh,inlineCode:th,linkReference:nh,link:rh,listItem:ih,list:ah,paragraph:oh,root:lh,strong:uh,table:ch,tableCell:hh,tableRow:dh,text:fh,thematicBreak:mh,toml:ir,yaml:ir,definition:ir,footnoteDefinition:ir};function ir(){}const vo=-1,_r=0,Pn=1,pr=2,$i=3,Hi=4,Qi=5,Ki=6,ko=7,jo=8,gh=typeof self=="object"?self:globalThis,Vs=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new gh[e](t)},bh=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case _r:case vo:return n(o,i);case Pn:{const l=n([],i);for(const u of o)l.push(r(u));return l}case pr:{const l=n({},i);for(const[u,c]of o)l[r(u)]=r(c);return l}case $i:return n(new Date(o),i);case Hi:{const{source:l,flags:u}=o;return n(new RegExp(l,u),i)}case Qi:{const l=n(new Map,i);for(const[u,c]of o)l.set(r(u),r(c));return l}case Ki:{const l=n(new Set,i);for(const u of o)l.add(r(u));return l}case ko:{const{name:l,message:u}=o;return n(Vs(l,u),i)}case jo:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(Vs(s,o),i)};return r},Gs=e=>bh(new Map,e)(0),Gt="",{toString:yh}={},{keys:wh}=Object,vn=e=>{const t=typeof e;if(t!=="object"||!e)return[_r,t];const n=yh.call(e).slice(8,-1);switch(n){case"Array":return[Pn,Gt];case"Object":return[pr,Gt];case"Date":return[$i,Gt];case"RegExp":return[Hi,Gt];case"Map":return[Qi,Gt];case"Set":return[Ki,Gt];case"DataView":return[Pn,n]}return n.includes("Array")?[Pn,n]:n.includes("Error")?[ko,n]:[pr,n]},sr=([e,t])=>e===_r&&(t==="function"||t==="symbol"),vh=(e,t,n,r)=>{const i=(o,l)=>{const u=r.push(o)-1;return n.set(l,u),u},s=o=>{if(n.has(o))return n.get(o);let[l,u]=vn(o);switch(l){case _r:{let d=o;switch(u){case"bigint":l=jo,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);d=null;break;case"undefined":return i([vo],o)}return i([l,d],o)}case Pn:{if(u){let f=o;return u==="DataView"?f=new Uint8Array(o.buffer):u==="ArrayBuffer"&&(f=new Uint8Array(o)),i([u,[...f]],o)}const d=[],h=i([l,d],o);for(const f of o)d.push(s(f));return h}case pr:{if(u)switch(u){case"BigInt":return i([u,o.toString()],o);case"Boolean":case"Number":case"String":return i([u,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const d=[],h=i([l,d],o);for(const f of wh(o))(e||!sr(vn(o[f])))&&d.push([s(f),s(o[f])]);return h}case $i:return i([l,o.toISOString()],o);case Hi:{const{source:d,flags:h}=o;return i([l,{source:d,flags:h}],o)}case Qi:{const d=[],h=i([l,d],o);for(const[f,p]of o)(e||!(sr(vn(f))||sr(vn(p))))&&d.push([s(f),s(p)]);return h}case Ki:{const d=[],h=i([l,d],o);for(const f of o)(e||!sr(vn(f)))&&d.push(s(f));return h}}const{message:c}=o;return i([l,{name:u,message:c}],o)};return s},Js=(e,{json:t,lossy:n}={})=>{const r=[];return vh(!(t||n),!!t,new Map,r)(e),r},fr=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Gs(Js(e,t)):structuredClone(e):(e,t)=>Gs(Js(e,t));function kh(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function jh(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Nh(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||kh,r=e.options.footnoteBackLabel||jh,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let u=-1;for(;++u0&&y.push({type:"text",value:" "});let N=typeof n=="string"?n:n(u,p);typeof N=="string"&&(N={type:"text",value:N}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,p),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const k=d[d.length-1];if(k&&k.type==="element"&&k.tagName==="p"){const N=k.children[k.children.length-1];N&&N.type==="text"?N.value+=" ":k.children.push({type:"text",value:" "}),k.children.push(...y)}else d.push(...y);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(d,!0)};e.patch(c,b),l.push(b)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...fr(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` -`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:` -`}]}}const No=(function(e){if(e==null)return _h;if(typeof e=="function")return Pr(e);if(typeof e=="object")return Array.isArray(e)?Sh(e):Ch(e);if(typeof e=="string")return Eh(e);throw new Error("Expected function, string, or object as test")});function Sh(e){const t=[];let n=-1;for(;++n":""))+")"})}return f;function f(){let p=So,y,w,k;if((!t||s(u,c,d[d.length-1]||void 0))&&(p=Ah(n(u,d)),p[0]===Ws))return p;if("children"in u&&u.children){const b=u;if(b.children&&p[0]!==Ih)for(w=(r?b.children.length:-1)+o,k=d.concat(b);w>-1&&w0&&n.push({type:"text",value:` -`}),n}function Xs(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Ys(e,t){const n=Oh(e,t),r=n.one(e,void 0),i=Nh(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:` -`},i),s}function qh(e,t){return e&&"run"in e?async function(n,r){const i=Ys(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Ys(n,{file:r,...e||t})}}function Zs(e){if(e)throw e}var Dr,ea;function Bh(){if(ea)return Dr;ea=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(c){return typeof Array.isArray=="function"?Array.isArray(c):t.call(c)==="[object Array]"},s=function(c){if(!c||t.call(c)!=="[object Object]")return!1;var d=e.call(c,"constructor"),h=c.constructor&&c.constructor.prototype&&e.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!d&&!h)return!1;var f;for(f in c);return typeof f>"u"||e.call(c,f)},o=function(c,d){n&&d.name==="__proto__"?n(c,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):c[d.name]=d.newValue},l=function(c,d){if(d==="__proto__")if(e.call(c,d)){if(r)return r(c,d).value}else return;return c[d]};return Dr=function u(){var c,d,h,f,p,y,w=arguments[0],k=1,b=arguments.length,N=!1;for(typeof w=="boolean"&&(N=w,w=arguments[1]||{},k=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});ko.length;let u;l&&o.push(i);try{u=e.apply(this,o)}catch(c){const d=c;if(l&&n)throw d;return i(d)}l||(u&&u.then&&typeof u.then=="function"?u.then(s,i):u instanceof Error?i(u):s(u))}function i(o,...l){n||(n=!0,t(o,...l))}function s(o){i(null,o)}}const We={basename:Qh,dirname:Kh,extname:Vh,join:Gh,sep:"/"};function Qh(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Hn(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(r=i):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Kh(e){if(Hn(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Vh(e){Hn(e);let t=e.length,n=-1,r=0,i=-1,s=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function Gh(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Wh(e,t){let n="",r=0,i=-1,s=0,o=-1,l,u;for(;++o<=e.length;){if(o2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,s=0}else l===46&&s>-1?s++:s=-1}return n}function Hn(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Xh={cwd:Yh};function Yh(){return"/"}function wi(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Zh(e){if(typeof e=="string")e=new URL(e);else if(!wi(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return ep(e)}function ep(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n0){let[p,...y]=d;const w=r[f][1];yi(w)&&yi(p)&&(p=zr(!0,w,p)),r[f]=[c,p,...y]}}}}const ip=new Vi().freeze();function $r(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Hr(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Qr(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function na(e){if(!yi(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ra(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ar(e){return sp(e)?e:new Eo(e)}function sp(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function ap(e){return typeof e=="string"||op(e)}function op(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const lp="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",ia=[],sa={allowDangerousHtml:!0},up=/^(https?|ircs?|mailto|xmpp)$/i,cp=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function dp(e){const t=hp(e),n=pp(e);return fp(t.runSync(t.parse(n),n),e)}function hp(e){const t=e.rehypePlugins||ia,n=e.remarkPlugins||ia,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...sa}:sa;return ip().use(Hd).use(n).use(qh,r).use(t)}function pp(e){const t=e.children||"",n=new Eo;return typeof t=="string"&&(n.value=t),n}function fp(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,u=t.urlTransform||mp;for(const d of cp)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+lp+d.id,void 0);return Co(e,c),ju(e,{Fragment:a.Fragment,components:i,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function c(d,h,f){if(d.type==="raw"&&f&&typeof h=="number")return o?f.children.splice(h,1):f.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let p;for(p in Or)if(Object.hasOwn(Or,p)&&Object.hasOwn(d.properties,p)){const y=d.properties[p],w=Or[p];(w===null||w.includes(d.tagName))&&(d.properties[p]=u(String(y||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!p&&r&&typeof h=="number"&&(p=!r(d,h,f)),p&&f&&typeof h=="number")return l&&d.children?f.children.splice(h,1,...d.children):f.children.splice(h,1),h}}}function mp(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||up.test(e.slice(0,t))?e:""}const Gi="-",xp=e=>{const t=bp(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const l=o.split(Gi);return l[0]===""&&l.length!==1&&l.shift(),_o(l,t)||gp(o)},getConflictingClassGroupIds:(o,l)=>{const u=n[o]||[];return l&&r[o]?[...u,...r[o]]:u}}},_o=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),i=r?_o(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;const s=e.join(Gi);return(o=t.validators.find(({validator:l})=>l(s)))==null?void 0:o.classGroupId},aa=/^\[(.+)\]$/,gp=e=>{if(aa.test(e)){const t=aa.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},bp=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return wp(Object.entries(e.classGroups),n).forEach(([s,o])=>{vi(o,r,s,t)}),r},vi=(e,t,n,r)=>{e.forEach(i=>{if(typeof i=="string"){const s=i===""?t:oa(t,i);s.classGroupId=n;return}if(typeof i=="function"){if(yp(i)){vi(i(r),t,n,r);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{vi(o,oa(t,s),n,r)})})},oa=(e,t)=>{let n=e;return t.split(Gi).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},yp=e=>e.isThemeGetter,wp=(e,t)=>t?e.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,l])=>[t+o,l])):s);return[n,i]}):e,vp=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const i=(s,o)=>{n.set(s,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){n.has(s)?n.set(s,o):i(s,o)}}},Po="!",kp=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],s=t.length,o=l=>{const u=[];let c=0,d=0,h;for(let k=0;kd?h-d:void 0;return{modifiers:u,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:w}};return n?l=>n({className:l,parseClassName:o}):o},jp=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},Np=e=>({cache:vp(e.cacheSize),parseClassName:kp(e),...xp(e)}),Sp=/\s+/,Cp=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,s=[],o=e.trim().split(Sp);let l="";for(let u=o.length-1;u>=0;u-=1){const c=o[u],{modifiers:d,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:p}=n(c);let y=!!p,w=r(y?f.substring(0,p):f);if(!w){if(!y){l=c+(l.length>0?" "+l:l);continue}if(w=r(f),!w){l=c+(l.length>0?" "+l:l);continue}y=!1}const k=jp(d).join(":"),b=h?k+Po:k,N=b+w;if(s.includes(N))continue;s.push(N);const S=i(w,y);for(let C=0;C0?" "+l:l)}return l};function Ep(){let e=0,t,n,r="";for(;e{if(typeof e=="string")return e;let t,n="";for(let r=0;rh(d),e());return n=Np(c),r=n.cache.get,i=n.cache.set,s=l,l(u)}function l(u){const c=r(u);if(c)return c;const d=Cp(u,n);return i(u,d),d}return function(){return s(Ep.apply(null,arguments))}}const se=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Io=/^\[(?:([a-z-]+):)?(.+)\]$/i,Pp=/^\d+\/\d+$/,Rp=new Set(["px","full","screen"]),Ip=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Tp=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ap=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Mp=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Op=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,st=e=>Wt(e)||Rp.has(e)||Pp.test(e),mt=e=>fn(e,"length",$p),Wt=e=>!!e&&!Number.isNaN(Number(e)),Kr=e=>fn(e,"number",Wt),kn=e=>!!e&&Number.isInteger(Number(e)),Lp=e=>e.endsWith("%")&&Wt(e.slice(0,-1)),Q=e=>Io.test(e),xt=e=>Ip.test(e),Fp=new Set(["length","size","percentage"]),Dp=e=>fn(e,Fp,To),zp=e=>fn(e,"position",To),qp=new Set(["image","url"]),Bp=e=>fn(e,qp,Qp),Up=e=>fn(e,"",Hp),jn=()=>!0,fn=(e,t,n)=>{const r=Io.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},$p=e=>Tp.test(e)&&!Ap.test(e),To=()=>!1,Hp=e=>Mp.test(e),Qp=e=>Op.test(e),Kp=()=>{const e=se("colors"),t=se("spacing"),n=se("blur"),r=se("brightness"),i=se("borderColor"),s=se("borderRadius"),o=se("borderSpacing"),l=se("borderWidth"),u=se("contrast"),c=se("grayscale"),d=se("hueRotate"),h=se("invert"),f=se("gap"),p=se("gradientColorStops"),y=se("gradientColorStopPositions"),w=se("inset"),k=se("margin"),b=se("opacity"),N=se("padding"),S=se("saturate"),C=se("scale"),E=se("sepia"),v=se("skew"),L=se("space"),M=se("translate"),O=()=>["auto","contain","none"],z=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto",Q,t],_=()=>[Q,t],K=()=>["",st,mt],F=()=>["auto",Wt,Q],R=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],V=()=>["solid","dashed","dotted","double","none"],te=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ce=()=>["start","end","center","between","around","evenly","stretch"],pe=()=>["","0",Q],m=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ae=()=>[Wt,Q];return{cacheSize:500,separator:":",theme:{colors:[jn],spacing:[st,mt],blur:["none","",xt,Q],brightness:ae(),borderColor:[e],borderRadius:["none","","full",xt,Q],borderSpacing:_(),borderWidth:K(),contrast:ae(),grayscale:pe(),hueRotate:ae(),invert:pe(),gap:_(),gradientColorStops:[e],gradientColorStopPositions:[Lp,mt],inset:A(),margin:A(),opacity:ae(),padding:_(),saturate:ae(),scale:ae(),sepia:pe(),skew:ae(),space:_(),translate:_()},classGroups:{aspect:[{aspect:["auto","square","video",Q]}],container:["container"],columns:[{columns:[xt]}],"break-after":[{"break-after":m()}],"break-before":[{"break-before":m()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...R(),Q]}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[w]}],"inset-x":[{"inset-x":[w]}],"inset-y":[{"inset-y":[w]}],start:[{start:[w]}],end:[{end:[w]}],top:[{top:[w]}],right:[{right:[w]}],bottom:[{bottom:[w]}],left:[{left:[w]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",kn,Q]}],basis:[{basis:A()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Q]}],grow:[{grow:pe()}],shrink:[{shrink:pe()}],order:[{order:["first","last","none",kn,Q]}],"grid-cols":[{"grid-cols":[jn]}],"col-start-end":[{col:["auto",{span:["full",kn,Q]},Q]}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":[jn]}],"row-start-end":[{row:["auto",{span:[kn,Q]},Q]}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Q]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Q]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...ce()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ce(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ce(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[N]}],px:[{px:[N]}],py:[{py:[N]}],ps:[{ps:[N]}],pe:[{pe:[N]}],pt:[{pt:[N]}],pr:[{pr:[N]}],pb:[{pb:[N]}],pl:[{pl:[N]}],m:[{m:[k]}],mx:[{mx:[k]}],my:[{my:[k]}],ms:[{ms:[k]}],me:[{me:[k]}],mt:[{mt:[k]}],mr:[{mr:[k]}],mb:[{mb:[k]}],ml:[{ml:[k]}],"space-x":[{"space-x":[L]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[L]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Q,t]}],"min-w":[{"min-w":[Q,t,"min","max","fit"]}],"max-w":[{"max-w":[Q,t,"none","full","min","max","fit","prose",{screen:[xt]},xt]}],h:[{h:[Q,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Q,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Q,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Q,t,"auto","min","max","fit"]}],"font-size":[{text:["base",xt,mt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Kr]}],"font-family":[{font:[jn]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Q]}],"line-clamp":[{"line-clamp":["none",Wt,Kr]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",st,Q]}],"list-image":[{"list-image":["none",Q]}],"list-style-type":[{list:["none","disc","decimal",Q]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",st,mt]}],"underline-offset":[{"underline-offset":["auto",st,Q]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Q]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Q]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...R(),zp]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Dp]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Bp]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...V(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:V()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...V()]}],"outline-offset":[{"outline-offset":[st,Q]}],"outline-w":[{outline:[st,mt]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[st,mt]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",xt,Up]}],"shadow-color":[{shadow:[jn]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...te(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":te()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",xt,Q]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[h]}],saturate:[{saturate:[S]}],sepia:[{sepia:[E]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[E]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Q]}],duration:[{duration:ae()}],ease:[{ease:["linear","in","out","in-out",Q]}],delay:[{delay:ae()}],animate:[{animate:["none","spin","ping","pulse","bounce",Q]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[kn,Q]}],"translate-x":[{"translate-x":[M]}],"translate-y":[{"translate-y":[M]}],"skew-x":[{"skew-x":[v]}],"skew-y":[{"skew-y":[v]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Q]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Q]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Q]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[st,mt,Kr]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Vp=_p(Kp),ki={status:"",repo:"",thread:"",action:"",intent:"",actor:""},Gp=new Cl({defaultOptions:{queries:{retry:1}}}),la=12,Jp=12,Wp=10080*60*1e3,Xp=1e3,Ao=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";function re(...e){return Vp(Vo(e))}async function le(e,t){const n=new Headers(t==null?void 0:t.headers);n.set("Accept","application/json");const r=await fetch(e,{...t,headers:n});if(!r.ok)throw new Error(`${r.status} ${r.statusText}`);return r.json()}function $e(e){if(e==null)return"n/a";const t=Math.max(0,Math.floor(e));if(t<60)return`${t}s`;const n=Math.floor(t/60);return n<60?`${n}m ${t%60}s`:`${Math.floor(n/60)}h ${n%60}m`}const Yp=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:"short"}),Zp=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});function Qn(e){if(!e)return null;const t=new Date(e);return Number.isNaN(t.getTime())?null:t}function ef(e){const t=Qn(e);return t?Yp.format(t):e??""}function Rn(e){const t=Qn(e);return t?Zp.format(t):e??""}function Mo(e,t){const n=Qn(e);if(!n)return e??"";const r=t-n.getTime(),i=Math.abs(r);if(i>Wp)return Rn(e);const s=r>=0?"ago":"from now",o=Math.round(i/1e3);if(o<45)return r>=0?"just now":"soon";if(o<90)return`1m ${s}`;const l=Math.round(o/60);if(l<60)return`${l}m ${s}`;if(l<90)return`1h ${s}`;const u=Math.round(l/60);return u<24?`${u}h ${s}`:u<36?`1d ${s}`:`${Math.round(u/24)}d ${s}`}function Ne({value:e,compact:t=!1,relative:n=!1,now:r=Date.now()}){const i=Qn(e);return i?a.jsx("time",{dateTime:i.toISOString(),title:`UTC: ${i.toISOString()}`,children:n?Mo(e,r):t?Rn(e):ef(e)}):a.jsx(a.Fragment,{children:e??""})}function Oo(e,t){const n=Qn(e);return n?Math.max(0,Math.floor((t-n.getTime())/1e3)):null}function Ji(e,t){return e.status==="running"?Oo(e.started_at,t)??e.runtime_seconds:e.runtime_seconds}function Wi(e,t){return e.status==="pending"?Oo(e.created_at,t)??e.queue_wait_seconds:e.queue_wait_seconds}function tf(e){const[t,n]=D.useState(()=>Date.now());return D.useEffect(()=>{if(!e)return;n(Date.now());const r=window.setInterval(()=>n(Date.now()),Xp);return()=>window.clearInterval(r)},[e]),t}function nf(e){return(e??"").split(/\r?\n/).map(n=>n.trim()).find(Boolean)??""}function mr(e,t,n=1){const r=nf(t),i=n>1?` (${n})`:"";return r?`${e}${i}: ${r}`:`${e}${i}`}function xr(e){return e==="openclaw_stdout"||e==="openclaw_stderr"}function Lo(e){return e.map(t=>t==null?void 0:t.trim()).filter(Boolean).join(` -`)}function rf(e){const t=[];for(const n of e){const r=t[t.length-1];if(r&&xr(n.event_type)&&r.eventType===n.event_type){r.count+=1,r.meta=n.ts,r.detail=Lo([r.detail,n.detail]),r.summary=mr(n.summary,r.detail,r.count);continue}t.push({id:String(n.id),badge:n.event_type,meta:n.ts,summary:xr(n.event_type)?mr(n.summary,n.detail):n.summary,detail:n.detail,eventType:n.event_type,count:1})}return t}function sf(e){const t=[];return e.forEach((n,r)=>{const i=t[t.length-1];if(i&&xr(n.kind)&&i.kind===n.kind){i.count+=1,i.meta=n.timestamp,i.text=Lo([i.text,n.text]),i.summary=mr(`${n.role} · ${n.kind}`,i.text,i.count);return}t.push({id:`${n.timestamp??"entry"}-${r}`,badge:n.title,meta:n.timestamp,summary:xr(n.kind)?mr(`${n.role} · ${n.kind}`,n.text):`${n.role} · ${n.kind}`,text:n.text,kind:n.kind,count:1})}),t}function ua(e,t,n,r){return e==="openclaw_stdout"?!1:t||n>=r-2}function af(e){return{pending:{badge:"border-amber-300 bg-amber-50 text-amber-800",dot:"bg-amber-500"},running:{badge:"border-blue-300 bg-blue-50 text-blue-700",dot:"bg-blue-600"},blocked:{badge:"border-red-300 bg-red-50 text-red-700",dot:"bg-red-600"},denied:{badge:"border-red-300 bg-red-50 text-red-700",dot:"bg-red-600"},done:{badge:"border-emerald-300 bg-emerald-50 text-emerald-700",dot:"bg-emerald-600"},waiting_approval:{badge:"border-slate-300 bg-slate-50 text-slate-700",dot:"bg-slate-500"}}[e]??{badge:"border-slate-300 bg-slate-50 text-slate-700",dot:"bg-slate-500"}}function of(e,t){const n=new URLSearchParams;for(const[r,i]of Object.entries(e))i.trim()&&n.set(r,i.trim());return n.set("limit",String(t)),`/api/jobs?${n.toString()}`}function lf(e,t,n=50){const r=new URLSearchParams;return e.trim()&&r.set("repo",e.trim()),t.trim()&&r.set("status",t.trim()),r.set("limit",String(n)),`/api/knowledge?${r.toString()}`}function uf(e=Ao){return`/api/metrics/summary?timezone=${encodeURIComponent(e)}`}function _t(e){try{const t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"?t.href:"#"}catch{return"#"}}function Kn(e){return`/jobs/${e}`}function gr(e){try{return JSON.parse(e.data)}catch{return null}}function cf(e,t){return e.some(n=>n.id===t.id)?e:[...e,t]}function df(e,t){const n=ca(t);return e.some(r=>ca(r)===n)?e:[...e,t]}function ca(e){return`${e.timestamp??""}:${e.role}:${e.kind}:${e.title}:${e.text}`}function hf(e){return["claimed","dispatch_started","dispatch_finished","done","blocked","denied","waiting_approval"].includes(e)}function Sn(e){return["blocked","denied","waiting_approval"].includes(e)}function pf(e=window.location.pathname){const t=e.match(/^\/jobs\/(\d+)\/?$/);return t?Number(t[1]):null}function ff(e=window.location.pathname){return/^\/knowledge\/?$/.test(e)}function mf(e=window.location.pathname){return/^\/mcp\/?$/.test(e)}function xf(e=window.location.pathname){return/^\/system\/?$/.test(e)}function Fo(e){return e.startsWith("repo:")?e.slice(5):e}function da(e){return Object.values(e).some(t=>t.trim()!=="")}function gf(){var xn,Wn,Xn,Yn,Zn,er,j,I,U,G,Y,Ce,Je,ze,ht,pt,be,it,qe,Yi,Zi,es,ts,ns,rs,is,ss,as;const e=za(),[t,n]=D.useState(ki),[r,i]=D.useState(la),s=D.useRef(!1),[o,l]=D.useState(""),[u,c]=D.useState("proposed"),[d,h]=D.useState(null),[f,p]=D.useState(""),[y,w]=D.useState(()=>window.location.pathname),k=pf(y),b=k!==null,N=ff(y),S=mf(y),C=xf(y),E=!b&&!N&&!S&&!C,v=k,L=ke({queryKey:["metrics",Ao],queryFn:()=>le(uf()),enabled:E||C}),M=ke({queryKey:["dashboard-status"],queryFn:()=>le("/api/status")}),O=ke({queryKey:["me"],queryFn:()=>le("/api/me"),refetchInterval:!1}),z=ke({queryKey:["about"],queryFn:()=>le("/api/about")}),A=ke({queryKey:["job-actors"],queryFn:()=>le("/api/jobs/actors"),enabled:E}),_=ke({queryKey:["jobs",t,r],queryFn:()=>le(of(t,r)),enabled:E,placeholderData:H=>H}),K=ke({queryKey:["processes"],queryFn:()=>le("/api/processes"),enabled:C}),F=ke({queryKey:["systemd"],queryFn:()=>le("/api/systemd"),enabled:C}),R=ke({queryKey:["alerts"],queryFn:()=>le("/api/alerts"),enabled:C}),V=ke({queryKey:["knowledge",o,u],queryFn:()=>le(lf(o,u)),enabled:N}),te=ke({queryKey:["mcp-tokens"],queryFn:()=>le("/api/mcp/tokens"),enabled:S&&!!((Wn=(xn=O.data)==null?void 0:xn.user)!=null&&Wn.is_admin)}),ce=ke({queryKey:["job",v],queryFn:()=>le(`/api/jobs/${v}`),enabled:v!==null}),pe=ke({queryKey:["job-session",v],queryFn:()=>le(`/api/jobs/${v}/session`),enabled:v!==null}),m=ke({queryKey:["job-session-events",v],queryFn:()=>le(`/api/jobs/${v}/session/events`),enabled:v!==null}),ae=ke({queryKey:["job-session-transcript",v],queryFn:()=>le(`/api/jobs/${v}/session/transcript`),enabled:v!==null}),De=D.useCallback(async H=>{const ve=await le(`/api/jobs/${H}/retry`,{method:"POST"});e.setQueryData(["job",H],{job:ve.job}),e.invalidateQueries({queryKey:["jobs"]}),e.invalidateQueries({queryKey:["metrics"]})},[e]),x=D.useCallback(async H=>{const ve=await le(`/api/jobs/${H}/dismiss`,{method:"POST"});e.setQueryData(["job",H],{job:ve.job}),e.invalidateQueries({queryKey:["jobs"]}),e.invalidateQueries({queryKey:["metrics"]})},[e]),Se=D.useCallback(async(H,ve)=>{await le(`/api/knowledge/proposals/${encodeURIComponent(H)}/${ve}`,{method:"POST"}),e.invalidateQueries({queryKey:["knowledge"]}),e.invalidateQueries({queryKey:["dashboard-status"]})},[e]),rt=D.useCallback(async H=>{await le(`/api/knowledge/rules/${encodeURIComponent(H)}`,{method:"DELETE"}),e.invalidateQueries({queryKey:["knowledge"]})},[e]),he=D.useCallback(async(H,ve)=>{await le(`/api/knowledge/rules/${encodeURIComponent(H)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:ve})}),e.invalidateQueries({queryKey:["knowledge"]})},[e]),Rt=D.useCallback(async H=>{const ve=await le("/api/mcp/tokens",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:H})});return e.invalidateQueries({queryKey:["mcp-tokens"]}),ve},[e]),Ve=D.useCallback(async H=>{await le(`/api/mcp/tokens/${encodeURIComponent(H)}`,{method:"DELETE"}),e.invalidateQueries({queryKey:["mcp-tokens"]})},[e]),Ge=D.useCallback(async H=>{const ve={refresh:"/api/autoupdate/refresh",apply:"/api/autoupdate/apply",complete:"/api/autoupdate/complete-pending"}[H];h(H),p("");try{await le(ve,{method:"POST"}),e.invalidateQueries({queryKey:["dashboard-status"]})}catch(Qe){e.invalidateQueries({queryKey:["dashboard-status"]}),p(Qe instanceof Error?Qe.message:String(Qe))}finally{h(null)}},[e]);D.useEffect(()=>{if(v===null)return;const H=new EventSource(`/api/jobs/${v}/session/stream`);return H.addEventListener("session_event",ve=>{const Qe=gr(ve);Qe&&(e.setQueryData(["job-session-events",v],At=>({events:cf((At==null?void 0:At.events)??[],Qe)})),hf(Qe.event_type)&&(e.invalidateQueries({queryKey:["job",v]}),e.invalidateQueries({queryKey:["jobs"]})))}),H.addEventListener("transcript_entry",ve=>{const Qe=gr(ve);!Qe||Qe.job_id!==v||e.setQueryData(["job-session-transcript",v],At=>({entries:df((At==null?void 0:At.entries)??[],Qe.entry)}))}),H.onerror=()=>{e.invalidateQueries({queryKey:["job",v]}),e.invalidateQueries({queryKey:["job-session-events",v]}),e.invalidateQueries({queryKey:["job-session-transcript",v]})},()=>H.close()},[v,e]),D.useEffect(()=>{const H=()=>{w(window.location.pathname)};return window.addEventListener("popstate",H),()=>window.removeEventListener("popstate",H)},[]);const ct=D.useCallback(H=>{window.history.pushState({},"",Kn(H)),w(window.location.pathname)},[]),It=D.useCallback(H=>{window.history.pushState({},"",H),w(window.location.pathname)},[]),dt=((Xn=L.data)==null?void 0:Xn.metrics.status_counts)??{},Kt=((Yn=_.data)==null?void 0:Yn.jobs)??[],Rr=D.useCallback(H=>{n(H),i(la),s.current=!1},[]);D.useEffect(()=>{_.isFetching||(s.current=!1)},[_.isFetching]);const Vn=D.useCallback(()=>{s.current||(s.current=!0,i(H=>H+Jp))},[]),He=v?((Zn=ce.data)==null?void 0:Zn.job)??null:null,Gn=Kt.some(H=>H.status==="running"||H.status==="pending")||(He==null?void 0:He.status)==="running"||(He==null?void 0:He.status)==="pending"||!!((er=K.data)!=null&&er.running_jobs.length),Tt=tf(Gn),Jn=a.jsx(Ef,{selectedJobId:v,selectedJob:He,loading:ce.isLoading,error:ce.error,session:(j=pe.data)==null?void 0:j.session,sessionEvents:(I=m.data)==null?void 0:I.events,transcript:(U=ae.data)==null?void 0:U.entries,now:Tt});return a.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[a.jsx("header",{className:"border-b border-slate-800 bg-slate-950 text-white",children:a.jsxs("div",{className:"mx-auto flex w-full max-w-[1440px] items-center justify-between gap-3 px-4 py-4 md:px-6",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("h1",{className:"truncate text-xl font-semibold",children:"GitHub Agent Bridge"}),a.jsx(bf,{about:z.data})]}),a.jsx(Df,{user:(G=O.data)==null?void 0:G.user,loading:O.isLoading})]})}),a.jsxs("main",{className:"mx-auto grid w-full max-w-[1440px] gap-4 px-3 py-4 sm:px-4 md:px-6 md:py-5",children:[a.jsx(Nf,{isDashboardRoute:E,isSystemRoute:C,isKnowledgeRoute:N,isMcpRoute:S,knowledgeBadgeCount:((Je=(Ce=(Y=M.data)==null?void 0:Y.metrics)==null?void 0:Ce.knowledge)==null?void 0:Je.proposed)??0,onNavigate:It}),k!==null?a.jsx(Cf,{jobId:k,detail:Jn,selectedJob:He,user:(ze=O.data)==null?void 0:ze.user,onBackToDashboard:()=>It("/"),onRetry:De,onDismiss:x,onRefresh:()=>{ce.refetch(),pe.refetch(),m.refetch(),ae.refetch()}}):N?a.jsx(_f,{data:V.data,loading:V.isLoading,error:V.error,repo:o,status:u,user:(ht=O.data)==null?void 0:ht.user,now:Tt,onRepoChange:l,onStatusChange:c,onApprove:H=>Se(H,"approve"),onReject:H=>Se(H,"reject"),onUpdateRuleScope:he,onDeleteRule:rt,onRefresh:()=>V.refetch()}):S?a.jsx(Mf,{tokens:(pt=te.data)==null?void 0:pt.tokens,loading:te.isLoading,error:te.error,user:(be=O.data)==null?void 0:be.user,dashboardUrl:(it=M.data)==null?void 0:it.dashboard_url,now:Tt,onCreate:Rt,onRevoke:Ve,onRefresh:()=>te.refetch()}):C?a.jsx(Sf,{processes:K.data,processesLoading:K.isLoading,processesError:K.error,systemd:F.data,systemdLoading:F.isLoading,systemdError:F.error,alerts:(qe=R.data)==null?void 0:qe.alerts,alertsLoading:R.isLoading,alertsError:R.error,now:Tt,onRefreshProcesses:()=>K.refetch(),onRefreshSystemd:()=>F.refetch(),onRefreshAlerts:()=>R.refetch()}):a.jsxs(a.Fragment,{children:[L.error?a.jsx(Te,{tone:"error",text:L.error.message}):null,M.error?a.jsx(Te,{tone:"error",text:M.error.message}):null,a.jsx(yf,{state:(Yi=M.data)==null?void 0:Yi.autoupdate,isAdmin:!!((es=(Zi=O.data)==null?void 0:Zi.user)!=null&&es.is_admin),runningAction:d,actionError:f,onRefresh:()=>Ge("refresh"),onApply:()=>Ge("apply"),onCompletePending:()=>Ge("complete")}),a.jsxs("section",{className:"grid grid-cols-2 gap-3 xl:grid-cols-4","aria-label":"Summary metrics",children:[a.jsx(Ct,{title:"Pending",value:dt.pending??0,icon:a.jsx($a,{className:"h-5 w-5"})}),a.jsx(Ct,{title:"Running",value:dt.running??0,icon:a.jsx(Ua,{className:"h-5 w-5"})}),a.jsx(Ct,{title:"Blocked",value:dt.blocked??0,icon:a.jsx(Ai,{className:"h-5 w-5"})}),a.jsx(Ct,{title:"Done",value:dt.done??0,icon:a.jsx(dn,{className:"h-5 w-5"})})]}),a.jsxs("section",{className:"grid gap-3",children:[a.jsx(zf,{count:Kt.length,limit:r,loading:_.isLoading,onRefresh:()=>_.refetch()}),a.jsxs(Re,{title:"Recent jobs",flushHeader:!0,children:[a.jsx(qf,{filters:t,actorOptions:((ts=A.data)==null?void 0:ts.actors)??[],onChange:Rr}),_.error?a.jsx(Te,{tone:"error",text:_.error.message}):null,a.jsx(Uf,{jobs:Kt,loading:_.isLoading,loadingMore:_.isFetching&&!_.isLoading,hasMore:Kt.length>=r,onLoadMore:Vn,onViewJob:ct,now:Tt,user:(ns=O.data)==null?void 0:ns.user,onRetry:De,onDismiss:x})]}),a.jsx(Re,{title:"Runtime usage",action:a.jsx(ut,{onClick:()=>L.refetch()}),children:a.jsx(Zf,{usage:(rs=L.data)==null?void 0:rs.metrics.runtime_usage,loading:L.isLoading,totalJobs:fa(dt)})})]}),a.jsxs("section",{className:"grid gap-4 xl:grid-cols-3",children:[a.jsx(Re,{title:"Runtime percentiles",children:a.jsx(pa,{label:"runtime",values:(is=L.data)==null?void 0:is.metrics.runtime_seconds})}),a.jsx(Re,{title:"Jobs per day",children:a.jsx(Yf,{values:(ss=L.data)==null?void 0:ss.metrics.by_created_day,loading:L.isLoading,totalJobs:fa(dt)})}),a.jsx(Re,{title:"Queue wait percentiles",children:a.jsx(pa,{label:"queue wait",values:(as=L.data)==null?void 0:as.metrics.queue_wait_seconds})})]})]})]})]})}function bf({about:e}){const t=e!=null&&e.version?`v${e.version}`:"version loading";return a.jsxs("p",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-slate-300",children:[a.jsx("span",{children:"Operational dashboard"}),a.jsx("span",{className:"font-mono text-xs text-slate-400",children:t}),e!=null&&e.repository_url?a.jsxs("a",{className:"inline-flex items-center gap-1 text-xs font-semibold text-slate-200 hover:underline",href:_t(e.repository_url),rel:"noreferrer",target:"_blank",children:[a.jsx(jr,{className:"h-3.5 w-3.5","aria-hidden":!0}),"GitHub"]}):null]})}function yf({state:e,isAdmin:t,runningAction:n=null,actionError:r="",onRefresh:i,onApply:s,onCompletePending:o}){var k,b,N,S,C,E,v,L,M,O,z;if(!e)return null;const l=(b=(k=e==null?void 0:e.target)==null?void 0:k.tag_name)==null?void 0:b.trim();if(!t||!l||(e==null?void 0:e.decision)==="noop")return null;const u=wf(e.decision),c=((N=e.queue)==null?void 0:N.active_total)??0,d=vf((S=e.classification)==null?void 0:S.risk),h=kf((C=e.target)==null?void 0:C.body),f=((v=(E=e.classification)==null?void 0:E.migration_files)==null?void 0:v.length)??0,p=((M=(L=e.classification)==null?void 0:L.risky_files)==null?void 0:M.length)??0,y=!!(e.executor_reload_pending&&e.dashboard_applied_at&&o),w=!!(s&&f===0);return a.jsxs("section",{className:"rounded-md border border-amber-300 bg-amber-50 p-3 text-amber-950 shadow-sm","aria-label":"Update available",children:[a.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(Ai,{className:"h-4 w-4 text-amber-700","aria-hidden":!0}),a.jsx("h2",{className:"text-sm font-semibold",children:"Update available"}),a.jsx("span",{className:"rounded-sm border border-amber-300 bg-white px-1.5 py-0.5 font-mono text-[11px] text-amber-800",children:l}),(O=e.target)!=null&&O.url?a.jsxs("a",{className:"inline-flex items-center gap-1 text-xs font-semibold text-amber-800 hover:underline",href:_t(e.target.url),rel:"noreferrer",target:"_blank",children:[a.jsx(jr,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Release"]}):null]}),a.jsxs("p",{className:"mt-1 text-sm text-amber-900",children:[u,e.installed_tag?a.jsxs("span",{className:"font-mono",children:[" from ",e.installed_tag]}):null]}),a.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[i?a.jsxs("button",{className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-md border border-amber-300 bg-white px-2.5 text-xs font-semibold text-amber-900 hover:bg-amber-100 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:n!==null,onClick:i,children:[a.jsx(Ha,{className:re("h-3.5 w-3.5",n==="refresh"&&"animate-spin"),"aria-hidden":!0}),n==="refresh"?"Checking...":"Check now"]}):null,w?a.jsxs("button",{className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-md bg-amber-800 px-2.5 text-xs font-semibold text-white hover:bg-amber-900 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:n!==null,onClick:()=>{window.confirm(`Apply ${l}? This can restart bridge services according to the recorded safe plan.`)&&(s==null||s())},children:[a.jsx(dn,{className:"h-3.5 w-3.5","aria-hidden":!0}),n==="apply"?"Applying...":"Apply update"]}):null,y?a.jsxs("button",{className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-md border border-amber-300 bg-white px-2.5 text-xs font-semibold text-amber-900 hover:bg-amber-100 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:n!==null,onClick:o,children:[a.jsx(Sr,{className:"h-3.5 w-3.5","aria-hidden":!0}),n==="complete"?"Completing...":"Complete reload"]}):null]})]}),a.jsxs("div",{className:"grid gap-2 text-xs sm:grid-cols-3 lg:min-w-[420px]",children:[a.jsx(Vr,{label:"Impact",value:d}),a.jsx(Vr,{label:"Active jobs",value:String(c)}),a.jsx(Vr,{label:"Admin only",value:"autoupdate"})]})]}),e.blocked_reason||e.executor_reload_pending||f>0||p>0?a.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-xs",children:[e.executor_reload_pending?a.jsx("span",{className:"rounded-sm border border-amber-300 bg-white px-2 py-1 font-semibold",children:"executor reload pending"}):null,e.blocked_reason?a.jsx("span",{className:"rounded-sm border border-amber-300 bg-white px-2 py-1 font-mono",children:e.blocked_reason}):null,f>0?a.jsxs("span",{className:"rounded-sm border border-amber-300 bg-white px-2 py-1",children:[f," migration file",f===1?"":"s"]}):null,p>0?a.jsxs("span",{className:"rounded-sm border border-amber-300 bg-white px-2 py-1",children:[p," executor/shared file",p===1?"":"s"]}):null]}):null,h?a.jsxs("div",{className:"mt-3 rounded-md border border-amber-200 bg-white/70 p-2.5",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase text-amber-800",children:"Changelog preview"}),a.jsx(jf,{markdown:h})]}):null,(z=e.warnings)!=null&&z.length?a.jsx("div",{className:"mt-2 font-mono text-xs text-amber-800",children:e.warnings[0]}):null,r?a.jsxs("div",{className:"mt-2 rounded-sm border border-amber-300 bg-white px-2 py-1 font-mono text-xs text-amber-900",children:["Action failed: ",r]}):null]})}function Vr({label:e,value:t}){return a.jsxs("div",{className:"min-w-0 rounded-md border border-amber-200 bg-white/80 px-2 py-1.5",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase text-amber-700",children:e}),a.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-amber-950",children:t})]})}function wf(e){return{stage_dashboard_reload:"Dashboard reload can be staged now",stage_defer_executor_reload:"Dashboard reload can be staged; executor reload waits for the queue",stage_full_reload:"Full reload can be staged now",defer_migration:"Migration release is waiting for a quiet queue"}[e??""]??"Update plan recorded"}function vf(e){return{dashboard_only:"dashboard only",executor_or_queue:"executor or queue",executor_or_shared:"executor or shared",migration_required:"migration",none:"none"}[e??""]??"unknown"}function kf(e){return(e??"").trim()}function jf({markdown:e}){return a.jsx("div",{className:"mt-1 text-sm leading-relaxed text-amber-950",children:a.jsx(dp,{allowedElements:["a","blockquote","code","em","h1","h2","h3","h4","li","ol","p","strong","ul"],components:{a:({href:t,children:n})=>a.jsx("a",{className:"font-semibold text-amber-800 underline underline-offset-2",href:_t(t??""),rel:"noreferrer",target:"_blank",children:n}),blockquote:({children:t})=>a.jsx("blockquote",{className:"mt-2 border-l-2 border-amber-300 pl-2 text-amber-900",children:t}),code:({children:t})=>a.jsx("code",{className:"rounded-sm bg-amber-100 px-1 py-0.5 font-mono text-[0.85em] text-amber-950",children:t}),h1:({children:t})=>a.jsx("h3",{className:"mt-2 text-sm font-semibold text-amber-950 first:mt-0",children:t}),h2:({children:t})=>a.jsx("h3",{className:"mt-2 text-sm font-semibold text-amber-950 first:mt-0",children:t}),h3:({children:t})=>a.jsx("h3",{className:"mt-2 text-sm font-semibold text-amber-950 first:mt-0",children:t}),h4:({children:t})=>a.jsx("h4",{className:"mt-2 text-xs font-semibold uppercase text-amber-800 first:mt-0",children:t}),li:({children:t})=>a.jsx("li",{className:"break-words pl-0.5 [overflow-wrap:anywhere]",children:t}),ol:({children:t})=>a.jsx("ol",{className:"mt-1 list-decimal space-y-1 pl-5 first:mt-0",children:t}),p:({children:t})=>a.jsx("p",{className:"mt-1 break-words [overflow-wrap:anywhere] first:mt-0",children:t}),strong:({children:t})=>a.jsx("strong",{className:"font-semibold",children:t}),em:({children:t})=>a.jsx("em",{className:"italic",children:t}),ul:({children:t})=>a.jsx("ul",{className:"mt-1 list-disc space-y-1 pl-5 first:mt-0",children:t})},children:e})})}function Nf({isDashboardRoute:e,isSystemRoute:t=!1,isKnowledgeRoute:n,isMcpRoute:r=!1,knowledgeBadgeCount:i=0,onNavigate:s}){return a.jsxs("nav",{className:"flex min-w-0 rounded-lg border border-border bg-panel p-1 shadow-sm","aria-label":"Dashboard sections",children:[a.jsxs(or,{href:"/",active:e,onNavigate:s,children:[a.jsx(Ti,{className:"h-4 w-4","aria-hidden":!0}),a.jsx("span",{children:"Jobs"})]}),a.jsxs(or,{href:"/system",active:t,onNavigate:s,children:[a.jsx(Hl,{className:"h-4 w-4","aria-hidden":!0}),a.jsx("span",{children:"System"})]}),a.jsxs(or,{href:"/knowledge",active:n,onNavigate:s,children:[a.jsx(Ii,{className:"h-4 w-4","aria-hidden":!0}),a.jsx("span",{children:"Knowledge"}),i>0?a.jsx("span",{className:re("inline-flex h-5 min-w-5 items-center justify-center rounded-full border px-1 font-mono text-[11px] leading-none",n?"border-white/40 bg-white/15 text-white":"border-amber-200 bg-amber-100 text-amber-800"),"aria-label":`${i} proposed knowledge ${i===1?"item":"items"}`,children:i}):null]}),a.jsxs(or,{href:"/mcp",active:r,onNavigate:s,children:[a.jsx(Cn,{className:"h-4 w-4","aria-hidden":!0}),a.jsx("span",{children:"MCP"})]})]})}function Sf({processes:e,processesLoading:t,processesError:n,systemd:r,systemdLoading:i,systemdError:s,alerts:o,alertsLoading:l,alertsError:u,now:c,onRefreshProcesses:d,onRefreshSystemd:h,onRefreshAlerts:f}){return a.jsxs("section",{className:"grid gap-4","aria-label":"Bridge system",children:[a.jsxs(Re,{title:"Systemd",action:a.jsx(ut,{onClick:h}),children:[s?a.jsx(Te,{tone:"error",text:s.message}):null,a.jsx(tm,{data:r,loading:i})]}),a.jsxs(Re,{title:"Process activity",action:a.jsx(ut,{onClick:d}),children:[n?a.jsx(Te,{tone:"error",text:n.message}):null,a.jsx(im,{data:e,loading:t})]}),a.jsxs(Re,{title:"Monitor alerts",action:a.jsx(ut,{onClick:f}),children:[u?a.jsx(Te,{tone:"error",text:u.message}):null,a.jsx(sm,{alerts:o,loading:l,now:c})]})]})}function or({href:e,active:t,children:n,onNavigate:r}){return a.jsx("a",{className:re("inline-flex h-8 min-w-0 flex-1 items-center justify-center gap-1 rounded-md px-1.5 text-xs font-semibold sm:flex-none sm:gap-1.5 sm:px-3 sm:text-sm [&>span]:truncate [&>svg]:shrink-0",t?"bg-primary text-white shadow-sm":"text-muted hover:bg-slate-50 hover:text-foreground"),href:e,onClick:i=>{!r||i.defaultPrevented||i.button!==0||i.metaKey||i.ctrlKey||i.altKey||i.shiftKey||(i.preventDefault(),r(e))},children:n})}function Cf({jobId:e,detail:t,selectedJob:n,user:r,onBackToDashboard:i,onRetry:s,onDismiss:o,onRefresh:l}){const[u,c]=D.useState(!1),[d,h]=D.useState(!1),f=!!(r!=null&&r.is_admin&&n&&Sn(n.status)),p=u?"Retrying...":"Retry",y=d?"Dismissing...":"Dismiss";return a.jsxs("div",{className:"grid min-w-0 gap-3 sm:gap-4",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("a",{className:"inline-flex h-9 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-foreground hover:bg-slate-50",href:"/",onClick:w=>{w.defaultPrevented||w.button!==0||w.metaKey||w.ctrlKey||w.altKey||w.shiftKey||(w.preventDefault(),i())},children:[a.jsx(Ul,{className:"h-4 w-4","aria-hidden":!0}),"Dashboard"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[f?a.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary px-3 text-sm font-semibold text-white disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:u,onClick:async()=>{if(window.confirm(`Retry job #${e}?`)){c(!0);try{await s(e)}finally{c(!1)}}},children:[a.jsx(Sr,{className:"h-4 w-4","aria-hidden":!0}),p]}):null,f?a.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 rounded-md border border-border bg-white px-3 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:d,onClick:async()=>{if(window.confirm(`Dismiss job #${e}?`)){h(!0);try{await o(e)}finally{h(!1)}}},children:[a.jsx(dn,{className:"h-4 w-4","aria-hidden":!0}),y]}):null,a.jsx(ut,{onClick:l})]})]}),a.jsx(Re,{title:`Job #${e}`,className:"p-3 sm:p-4",children:t})]})}function Ef({selectedJobId:e,selectedJob:t,loading:n,error:r,session:i,sessionEvents:s,transcript:o,now:l}){return t?a.jsx(Jf,{job:t,session:i,sessionEvents:s,transcript:o,now:l}):e!==null&&n?a.jsx(Z,{text:"Loading selected job..."}):e!==null&&r?a.jsx(Te,{tone:"error",text:`Job #${e}: ${r.message}`}):a.jsx(Z,{text:"Select a job to inspect its timeline, worklog and GitHub links."})}function _f({data:e,loading:t,error:n,repo:r,status:i,user:s,now:o,onRepoChange:l,onStatusChange:u,onApprove:c,onReject:d,onUpdateRuleScope:h,onDeleteRule:f,onRefresh:p}){const y=(e==null?void 0:e.summary)??{},[w,k]=D.useState("proposals"),b=[{id:"proposals",label:"Proposals",count:(e==null?void 0:e.proposals.length)??0},{id:"rules",label:"Rules",count:(e==null?void 0:e.rules.length)??0},{id:"events",label:"Events",count:(e==null?void 0:e.events.length)??0}];return a.jsxs("div",{className:"grid min-w-0 gap-4",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("h2",{className:"flex items-center gap-2 text-base font-semibold",children:[a.jsx(Ii,{className:"h-5 w-5 text-muted","aria-hidden":!0}),"Acquired knowledge"]}),a.jsx("p",{className:"text-xs text-muted",children:"Captured feedback, proposed rules and curated agent memory."})]}),a.jsx(ut,{onClick:p})]}),n?a.jsx(Te,{tone:"error",text:n.message}):null,a.jsxs("section",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4","aria-label":"Knowledge metrics",children:[a.jsx(Ct,{title:"Proposed",value:y.proposed??0,icon:a.jsx($a,{className:"h-5 w-5"})}),a.jsx(Ct,{title:"Approved",value:y.approved??0,icon:a.jsx(dn,{className:"h-5 w-5"})}),a.jsx(Ct,{title:"Rules",value:y.rules??0,icon:a.jsx(Qa,{className:"h-5 w-5"})}),a.jsx(Ct,{title:"Events",value:y.events??0,icon:a.jsx(Ua,{className:"h-5 w-5"})})]}),a.jsx(Re,{title:"Filters",className:"p-3",children:a.jsxs("div",{className:re("grid gap-3",w==="proposals"?"md:grid-cols-[minmax(0,1fr)_220px]":"md:grid-cols-[minmax(0,1fr)]"),children:[a.jsx(et,{label:"Repository",children:a.jsxs("select",{className:"control",value:r,onChange:N=>l(N.target.value),children:[a.jsx("option",{value:"",children:"All repositories"}),((e==null?void 0:e.repositories)??[]).map(N=>a.jsx("option",{value:N,children:N},N))]})}),w==="proposals"?a.jsx(et,{label:"Proposal status",children:a.jsxs("select",{className:"control",value:i,onChange:N=>u(N.target.value),children:[a.jsx("option",{value:"",children:"All statuses"}),a.jsx("option",{value:"proposed",children:"proposed"}),a.jsx("option",{value:"approved",children:"approved"}),a.jsx("option",{value:"rejected",children:"rejected"}),a.jsx("option",{value:"error",children:"error"})]})}):null]})}),a.jsxs(Re,{title:"Knowledge records",action:a.jsx("div",{className:"flex max-w-full flex-wrap rounded-md border border-border bg-white p-0.5",role:"tablist","aria-label":"Knowledge record type",children:b.map(N=>a.jsxs("button",{className:re("inline-flex h-8 items-center gap-1.5 rounded px-2.5 text-xs font-semibold",w===N.id?"bg-primary text-white":"text-muted hover:bg-slate-50 hover:text-foreground"),type:"button",role:"tab","aria-label":`${N.label} (${N.count})`,"aria-selected":w===N.id,onClick:()=>k(N.id),children:[a.jsx("span",{children:N.label}),a.jsx("span",{className:re("rounded-sm border px-1 font-mono text-[10px]",w===N.id?"border-white/40 text-white":"border-border text-muted"),children:N.count})]},N.id))}),children:[w==="proposals"?a.jsx(Pf,{proposals:(e==null?void 0:e.proposals)??[],loading:t,isAdmin:!!(s!=null&&s.is_admin),now:o,onApprove:c,onReject:d}):null,w==="rules"?a.jsx(Tf,{rules:(e==null?void 0:e.rules)??[],loading:t,isAdmin:!!(s!=null&&s.is_admin),now:o,onUpdateRuleScope:h,onDeleteRule:f}):null,w==="events"?a.jsx(Af,{events:(e==null?void 0:e.events)??[],loading:t,now:o}):null]})]})}function Pf({proposals:e,loading:t,isAdmin:n,now:r,onApprove:i,onReject:s}){const[o,l]=D.useState(null);return t&&e.length===0?a.jsx(Z,{text:"Loading proposals..."}):e.length===0?a.jsx(Z,{text:"No proposals match the current filters."}):a.jsx("div",{className:"grid gap-2",children:e.map(u=>a.jsxs("article",{className:"grid min-w-0 gap-2 rounded-md border border-border bg-white p-3",children:[a.jsx(Do,{scope:u.scope,type:u.type,confidence:u.confidence,status:u.status,timestamp:u.updated_at,now:r}),a.jsx("p",{className:"min-w-0 break-words text-sm font-medium [overflow-wrap:anywhere]",children:u.rule||u.reason||"No reusable rule proposed."}),u.reason?a.jsx("p",{className:"min-w-0 break-words text-xs text-muted [overflow-wrap:anywhere]",children:u.reason}):null,u.source_event?a.jsx(Rf,{event:u.source_event}):a.jsxs("p",{className:"font-mono text-xs text-muted",children:["Source event ",u.event_id]}),u.error?a.jsx(Te,{tone:"error",text:u.error}):null,n&&u.status==="proposed"?a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md bg-primary px-3 text-sm font-semibold text-white disabled:opacity-60",type:"button",disabled:o===u.id,onClick:async()=>{l(u.id);try{await i(u.id)}finally{l(null)}},children:[a.jsx(dn,{className:"h-4 w-4","aria-hidden":!0}),"Approve"]}),a.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:opacity-60",type:"button",disabled:o===u.id,onClick:async()=>{l(u.id);try{await s(u.id)}finally{l(null)}},children:[a.jsx(Cr,{className:"h-4 w-4","aria-hidden":!0}),"Reject"]})]}):null]},u.id))})}function Rf({event:e}){const t=e.trigger_actor||(e.actor!=="github"?e.actor:null);return a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 rounded-md border border-border bg-slate-50 px-2 py-1.5",children:[a.jsx(mn,{actor:t,avatarUrl:e.trigger_actor_avatar_url,framed:!0}),e.source_job_id?a.jsxs("a",{className:"inline-flex h-7 items-center gap-1 rounded-md border border-border bg-white px-2 text-xs font-semibold text-foreground hover:bg-slate-50",href:Kn(e.source_job_id),children:[a.jsx(Nr,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Job #",e.source_job_id]}):null,e.github_urls.length>0?a.jsx(On,{urls:e.github_urls,compact:!0}):a.jsx("span",{className:"font-mono text-xs text-muted",children:"No GitHub link"})]})}function If(e){const t=[{value:"global",label:"global"}];if(e.startsWith("repo:")){const n=e.slice(5),[r,i]=n.split("/",2);r&&i&&(t.push({value:`org:${r}`,label:`org:${r}`}),t.push({value:`repo:${r}/${i}`,label:`repo:${r}/${i}`}))}else e.startsWith("org:")&&t.push({value:e,label:e});return t.some(n=>n.value===e)||t.push({value:e,label:e}),t}function Tf({rules:e,loading:t,isAdmin:n,now:r,onUpdateRuleScope:i,onDeleteRule:s}){const[o,l]=D.useState(null),[u,c]=D.useState(null),[d,h]=D.useState("");return t&&e.length===0?a.jsx(Z,{text:"Loading curated rules..."}):e.length===0?a.jsx(Z,{text:"No curated rules match the current filters."}):a.jsx("div",{className:"grid gap-2",children:e.map(f=>{const p=f.source_event_details??[],y=p[0],w=y?y.trigger_actor||(y.actor!=="github"?y.actor:null):null,k=p.flatMap(C=>C.github_urls??[]),b=If(f.scope),N=u===f.id,S=o===f.id;return a.jsxs("article",{className:"grid min-w-0 gap-2 rounded-md border border-border bg-white p-3",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsx(Do,{scope:f.scope,type:f.type,confidence:f.confidence,status:`${f.observations} observation${f.observations===1?"":"s"}`,timestamp:f.last_seen,now:r}),n?a.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[N?a.jsxs(a.Fragment,{children:[a.jsx(et,{label:"Scope",children:a.jsx("select",{className:"control h-8 min-w-[180px] py-1 text-xs",value:d,disabled:S,onChange:C=>h(C.target.value),children:b.map(C=>a.jsx("option",{value:C.value,children:C.label},C.value))})}),a.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:opacity-60",type:"button",disabled:S||d===f.scope,title:"Save scope",onClick:async()=>{if(d!==f.scope){l(f.id);try{await i(f.id,d),c(null)}finally{l(null)}}},children:[a.jsx(Kl,{className:"h-4 w-4","aria-hidden":!0}),"Save"]}),a.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-muted hover:bg-slate-50 disabled:opacity-60",type:"button",disabled:S,title:"Cancel scope edit",onClick:()=>{c(null),h("")},children:[a.jsx(Cr,{className:"h-4 w-4","aria-hidden":!0}),"Cancel"]})]}):a.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:opacity-60",type:"button",disabled:S,title:"Edit scope",onClick:()=>{c(f.id),h(f.scope)},children:[a.jsx(Ql,{className:"h-4 w-4","aria-hidden":!0}),"Edit"]}),a.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-red-200 px-3 text-sm font-semibold text-red-700 hover:bg-red-50 disabled:opacity-60",type:"button",disabled:S,onClick:async()=>{if(window.confirm("Delete this curated rule?")){l(f.id);try{await s(f.id)}finally{l(null)}}},children:[a.jsx(ci,{className:"h-4 w-4","aria-hidden":!0}),"Delete"]})]}):null]}),a.jsx("p",{className:"min-w-0 break-words text-sm font-medium [overflow-wrap:anywhere]",children:f.rule}),a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[a.jsx(mn,{actor:w,avatarUrl:y==null?void 0:y.trigger_actor_avatar_url,framed:!0}),y!=null&&y.source_job_id?a.jsxs("a",{className:"inline-flex h-7 items-center gap-1 rounded-md border border-border px-2 text-xs font-semibold text-foreground hover:bg-white",href:Kn(y.source_job_id),children:[a.jsx(Nr,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Job #",y.source_job_id]}):null,k.length>0?a.jsx(On,{urls:k,compact:!0}):a.jsx("span",{className:"font-mono text-xs text-muted",children:"No GitHub link"})]})]},f.id)})})}function Af({events:e,loading:t,now:n}){return t&&e.length===0?a.jsx(Z,{text:"Loading captured events..."}):e.length===0?a.jsx(Z,{text:"No captured feedback events match the current filters."}):a.jsx("div",{className:"grid gap-2",children:e.map(r=>{const i=r.trigger_actor||(r.actor!=="github"?r.actor:null);return a.jsxs("details",{className:"group rounded-md border border-border bg-white",children:[a.jsxs("summary",{className:"grid cursor-pointer list-none gap-2 px-3 py-2 marker:hidden hover:bg-slate-50",children:[a.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[a.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2 font-mono text-xs font-semibold text-muted",children:[a.jsx(Un,{className:"h-3.5 w-3.5 shrink-0 transition-transform group-open:rotate-180","aria-hidden":!0}),a.jsx("span",{className:"truncate",children:Fo(r.scope)})]}),a.jsx("span",{className:"shrink-0 font-mono text-xs text-muted",children:a.jsx(Ne,{value:r.occurred_at,relative:!0,now:n})})]}),a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[a.jsx(mn,{actor:i,avatarUrl:r.trigger_actor_avatar_url,framed:!0}),r.source_job_id?a.jsxs("a",{className:"inline-flex h-7 items-center gap-1 rounded-md border border-border px-2 text-xs font-semibold text-foreground hover:bg-white",href:Kn(r.source_job_id),children:[a.jsx(Nr,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Job #",r.source_job_id]}):null,r.github_urls.length>0?a.jsx(On,{urls:r.github_urls,compact:!0}):a.jsx("span",{className:"font-mono text-xs text-muted",children:"No GitHub link"})]}),a.jsx("p",{className:"line-clamp-2 break-words text-sm [overflow-wrap:anywhere]",children:r.comment})]}),a.jsxs("div",{className:"grid gap-2 border-t border-border px-3 py-2",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"mb-1 text-xs font-semibold text-muted",children:"GitHub links"}),r.github_urls.length>0?a.jsx(On,{urls:r.github_urls}):a.jsx("p",{className:"text-xs text-muted",children:"No links recorded."})]}),a.jsx("pre",{className:"max-h-72 overflow-auto rounded-md bg-slate-950 px-3 py-2 font-mono text-xs leading-relaxed text-slate-100",children:JSON.stringify(r.context,null,2)})]})]},r.id)})})}function Mf({tokens:e,loading:t,error:n,user:r,dashboardUrl:i,now:s,onCreate:o,onRevoke:l,onRefresh:u}){const[c,d]=D.useState(""),[h,f]=D.useState(!1),[p,y]=D.useState(null),[w,k]=D.useState(null),[b,N]=D.useState(""),S=e??[],C=`${(i||(typeof window>"u"?"":window.location.origin)).replace(/\/$/,"")}/mcp`;return r&&!r.is_admin?a.jsxs("div",{className:"grid min-w-0 gap-4",children:[a.jsx(ha,{icon:a.jsx(Cn,{className:"h-5 w-5 text-muted","aria-hidden":!0}),title:"MCP access",subtitle:"Read-only local-agent access is limited to dashboard admins.",action:a.jsx(ut,{onClick:u})}),a.jsx(Z,{text:"Admin access is required to manage MCP tokens."})]}):a.jsxs("div",{className:"grid min-w-0 gap-4",children:[a.jsx(ha,{icon:a.jsx(Cn,{className:"h-5 w-5 text-muted","aria-hidden":!0}),title:"MCP access",subtitle:"Issue and revoke read-only tokens for local agents.",action:a.jsx(ut,{onClick:u})}),n?a.jsx(Te,{tone:"error",text:n.message}):null,b?a.jsx(Te,{tone:"error",text:b}):null,a.jsx(Of,{dashboardUrl:C}),w?a.jsxs("section",{className:"rounded-md border border-emerald-300 bg-emerald-50 p-3 text-emerald-950","aria-label":"Created MCP token",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold",children:"Token created"}),a.jsx("p",{className:"mt-1 text-xs text-emerald-800",children:"This secret is shown once. Store it in the local agent environment before leaving this page."})]}),a.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-emerald-300 bg-white px-3 text-sm font-semibold text-emerald-900 hover:bg-emerald-100",type:"button",onClick:()=>k(null),children:[a.jsx(Cr,{className:"h-4 w-4","aria-hidden":!0}),"Hide"]})]}),a.jsx("pre",{className:"mt-3 overflow-auto rounded bg-emerald-950 px-3 py-2 font-mono text-xs text-emerald-50",children:w.token})]}):null,a.jsx(Re,{title:"Create token",children:a.jsxs("form",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_auto]",onSubmit:async E=>{E.preventDefault();const v=c.trim();if(v){f(!0),N("");try{const L=await o(v);k(L),d("")}catch(L){N(L instanceof Error?L.message:String(L))}finally{f(!1)}}},children:[a.jsx(et,{label:"Token name",children:a.jsx("input",{className:"control",value:c,placeholder:"local agent",disabled:h,onChange:E=>d(E.target.value)})}),a.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 self-end rounded-md bg-primary px-3 text-sm font-semibold text-white disabled:cursor-not-allowed disabled:opacity-60",type:"submit",disabled:h||!c.trim(),children:[a.jsx(Cn,{className:"h-4 w-4","aria-hidden":!0}),h?"Creating...":"Create token"]})]})}),a.jsx(Re,{title:"Active tokens",children:a.jsx(Lf,{tokens:S,loading:t,now:s,revokingId:p,onRevoke:async E=>{if(window.confirm("Revoke this MCP token?")){y(E),N("");try{await l(E)}catch(v){N(v instanceof Error?v.message:String(v))}finally{y(null)}}}})})]})}function Of({dashboardUrl:e}){return a.jsx(Re,{title:"Connect an agent",children:a.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]",children:[a.jsxs("div",{className:"grid min-w-0 gap-3",children:[a.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-white p-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[a.jsx(jr,{className:"h-4 w-4 text-muted","aria-hidden":!0}),"Public dashboard URL"]}),a.jsx("p",{className:"mt-1 text-xs text-muted",children:"Share this proxy-aware page URL with bridge admins who need to issue or revoke MCP tokens."}),a.jsx("pre",{className:"mt-3 overflow-auto rounded-md bg-slate-950 px-3 py-2 font-mono text-xs text-slate-100",children:e})]}),a.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-white p-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[a.jsx(Ti,{className:"h-4 w-4 text-muted","aria-hidden":!0}),"Transport"]}),a.jsx("p",{className:"mt-1 text-xs text-muted",children:"This release exposes the MCP server over local stdio. It does not publish an HTTP MCP endpoint."}),a.jsx("pre",{className:"mt-3 overflow-auto rounded-md bg-slate-950 px-3 py-2 font-mono text-xs text-slate-100",children:"gab --db ~/.local/state/github-agent-bridge/bridge.sqlite3 mcp-serve"})]})]}),a.jsxs("div",{className:"grid min-w-0 gap-3",children:[a.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-white p-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[a.jsx(Cn,{className:"h-4 w-4 text-muted","aria-hidden":!0}),"Agent config"]}),a.jsx("p",{className:"mt-1 text-xs text-muted",children:"Create a token below, then store the one-time secret in the agent environment."}),a.jsx("pre",{className:"mt-3 max-h-64 overflow-auto rounded-md bg-slate-950 px-3 py-2 font-mono text-xs leading-relaxed text-slate-100",children:`{ - "mcpServers": { - "github-agent-bridge": { - "command": "gab", - "args": ["--db", "~/.local/state/github-agent-bridge/bridge.sqlite3", "mcp-serve"], - "env": { - "GITHUB_AGENT_BRIDGE_MCP_TOKEN": "gab_mcp_..." - } - } - } -}`})]}),a.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-white p-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[a.jsx(Ii,{className:"h-4 w-4 text-muted","aria-hidden":!0}),"Agent prompt"]}),a.jsx("p",{className:"mt-1 text-xs text-muted",children:"Ask the agent to use the read-only bridge knowledge server before acting on repository work."}),a.jsx("pre",{className:"mt-3 max-h-40 overflow-auto rounded-md bg-slate-950 px-3 py-2 font-mono text-xs leading-relaxed text-slate-100",children:"Use the github-agent-bridge MCP server for repository knowledge. Query list_repositories and list_knowledge before making repository decisions."})]})]})]})})}function ha({icon:e,title:t,subtitle:n,action:r}){return a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("h2",{className:"flex items-center gap-2 text-base font-semibold",children:[e,t]}),a.jsx("p",{className:"text-xs text-muted",children:n})]}),r]})}function Lf({tokens:e,loading:t,now:n,revokingId:r,onRevoke:i}){return t&&e.length===0?a.jsx(Z,{text:"Loading MCP tokens..."}):e.length===0?a.jsx(Z,{text:"No active MCP tokens."}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"grid gap-2 md:hidden",children:e.map(s=>a.jsxs("article",{className:"grid min-w-0 gap-3 rounded-md border border-border bg-white p-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("h3",{className:"break-words text-sm font-semibold [overflow-wrap:anywhere]",children:s.name}),a.jsx("div",{className:"mt-1 break-all font-mono text-xs text-muted",children:s.id})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[a.jsx(me,{label:"Created",value:a.jsx(Ne,{value:s.created_at,relative:!0,now:n})}),a.jsx(me,{label:"Last used",value:s.last_used_at?a.jsx(Ne,{value:s.last_used_at,relative:!0,now:n}):"never"})]}),a.jsxs("button",{className:"inline-flex h-8 items-center justify-center gap-2 rounded-md border border-red-200 px-3 text-sm font-semibold text-red-700 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:r===s.id,onClick:()=>i(s.id),children:[a.jsx(ci,{className:"h-4 w-4","aria-hidden":!0}),r===s.id?"Revoking...":"Revoke"]})]},s.id))}),a.jsx("div",{className:"hidden overflow-auto rounded-md border border-border md:block",children:a.jsxs("table",{className:"min-w-full border-collapse text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-slate-50 text-left text-xs text-muted",children:[a.jsx("th",{className:"px-3 py-2 font-semibold",children:"Name"}),a.jsx("th",{className:"px-3 py-2 font-semibold",children:"Created"}),a.jsx("th",{className:"px-3 py-2 font-semibold",children:"Last used"}),a.jsx("th",{className:"px-3 py-2 font-semibold",children:"ID"}),a.jsx("th",{className:"px-3 py-2 text-right font-semibold",children:"Actions"})]})}),a.jsx("tbody",{children:e.map(s=>a.jsxs("tr",{className:"border-b border-border last:border-b-0",children:[a.jsx("td",{className:"px-3 py-3 font-semibold",children:s.name}),a.jsx("td",{className:"px-3 py-3 font-mono text-xs",children:a.jsx(Ne,{value:s.created_at,relative:!0,now:n})}),a.jsx("td",{className:"px-3 py-3 font-mono text-xs",children:s.last_used_at?a.jsx(Ne,{value:s.last_used_at,relative:!0,now:n}):"never"}),a.jsx("td",{className:"px-3 py-3 font-mono text-xs text-muted",children:s.id}),a.jsx("td",{className:"px-3 py-3 text-right",children:a.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-red-200 px-3 text-sm font-semibold text-red-700 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:r===s.id,onClick:()=>i(s.id),children:[a.jsx(ci,{className:"h-4 w-4","aria-hidden":!0}),r===s.id?"Revoking...":"Revoke"]})})]},s.id))})]})})]})}function On({urls:e,compact:t=!1}){const n=t?e.slice(0,2):e,r=e.length-n.length;return a.jsxs("div",{className:"flex min-w-0 max-w-full flex-wrap gap-1.5",children:[n.map(i=>a.jsxs("a",{className:re("inline-flex max-w-full items-center gap-1 rounded-md border border-border font-semibold text-primary hover:bg-white hover:underline",t?"h-7 px-2 text-xs":"min-h-7 px-2 py-1 text-xs"),href:_t(i),"aria-label":i,rel:"noreferrer",target:"_blank",children:[a.jsx(jr,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),a.jsx("span",{className:"truncate",children:t?Ff(i):i})]},i)),r>0?a.jsxs("span",{className:"inline-flex h-7 items-center rounded-md border border-border px-2 font-mono text-xs text-muted",children:["+",r]}):null]})}function Ff(e){try{const t=new URL(e);return t.pathname.replace(/^\//,"")+t.hash}catch{return e}}function Do({scope:e,type:t,confidence:n,status:r,timestamp:i,now:s}){return a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-xs text-muted",children:[a.jsx("span",{className:"truncate font-mono font-semibold text-foreground",children:Fo(e)}),a.jsx("span",{className:"rounded-sm border border-border px-1.5 py-0.5 font-mono",children:t}),a.jsxs("span",{className:"rounded-sm border border-border px-1.5 py-0.5 font-mono",children:[Math.round(n*100),"%"]}),a.jsx("span",{className:"rounded-sm border border-border px-1.5 py-0.5 font-mono",children:r}),a.jsx("span",{className:"font-mono",children:a.jsx(Ne,{value:i,relative:!0,now:s})})]})}function Df({user:e,loading:t}){const n=e!=null&&e.login?`@${e.login}`:t?"Loading profile...":"GitHub OAuth",r=e!=null&&e.is_admin?"admin":"read-only",i=e!=null&&e.avatar_url?a.jsx("img",{className:"h-10 w-10 rounded-full border border-slate-700 bg-slate-800",src:e.avatar_url,alt:e.login?`${e.login} avatar`:"",referrerPolicy:"no-referrer"}):a.jsx("span",{className:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-slate-700 bg-slate-900",children:a.jsx(hr,{className:"h-5 w-5","aria-hidden":!0})}),s=e!=null&&e.html_url?a.jsx("a",{className:"truncate font-semibold text-white hover:underline",href:_t(e.html_url),rel:"noreferrer",target:"_blank",children:n}):a.jsx("div",{className:"truncate font-semibold text-white",children:n});return a.jsxs("div",{className:"flex max-w-full shrink-0 items-center gap-3 text-sm text-slate-300","aria-label":e!=null&&e.login?`Signed in as ${e.login}`:"Dashboard account",children:[a.jsx(Qa,{className:"hidden h-4 w-4 shrink-0 sm:block","aria-hidden":!0}),a.jsxs("div",{className:"hidden min-w-0 text-right sm:block",children:[s,a.jsxs("div",{className:"text-xs text-slate-400",children:["Signed in · ",r]})]}),i]})}function zf({count:e,limit:t,loading:n,onRefresh:r}){return a.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 rounded-lg border border-border bg-white px-3 py-3 shadow-sm md:px-4",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"text-base font-semibold",children:"Jobs"}),a.jsx("p",{className:"text-xs text-muted",children:n?"Refreshing latest jobs...":`Showing ${e} of the latest ${t} requested jobs`})]}),a.jsx(ut,{onClick:r,compactOnMobile:!0})]})}function Re({title:e,action:t,children:n,className:r,flushHeader:i=!1}){return a.jsxs("section",{className:re("min-w-0 rounded-lg border border-border bg-panel p-4 shadow-sm",r),children:[a.jsxs("div",{className:re("flex flex-wrap items-center justify-between gap-3",!i&&"mb-4"),children:[a.jsx("h2",{className:"text-sm font-semibold",children:e}),t]}),n]})}function Ct({title:e,value:t,icon:n}){return a.jsxs("div",{className:"rounded-lg border border-border bg-panel p-3 shadow-sm md:p-4",children:[a.jsxs("div",{className:"flex items-center justify-between text-muted",children:[a.jsx("span",{className:"text-sm font-medium",children:e}),n]}),a.jsx("strong",{className:"mt-3 block text-2xl leading-none md:mt-4 md:text-3xl",children:t})]})}function qf({filters:e,actorOptions:t,onChange:n}){const[r,i]=D.useState(e);D.useEffect(()=>i(e),[e]);const s=da(e)||da(r),o=()=>{i(ki),n(ki)};return a.jsxs("details",{className:"my-3 rounded-md border border-border bg-slate-50/70",children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2 text-sm font-semibold marker:hidden",children:[a.jsxs("span",{className:"inline-flex items-center gap-2",children:[a.jsx($l,{className:"h-4 w-4 text-muted","aria-hidden":!0}),"Filters"]}),a.jsx(Un,{className:"h-4 w-4 text-muted","aria-hidden":!0})]}),a.jsxs("form",{className:"grid gap-3 border-t border-border bg-white p-3 md:grid-cols-3 xl:grid-cols-9",onSubmit:l=>{l.preventDefault(),n(r)},children:[a.jsx(et,{label:"Status",children:a.jsxs("select",{className:"control",value:r.status,onChange:l=>i({...r,status:l.target.value}),children:[a.jsx("option",{value:"",children:"All"}),a.jsx("option",{value:"pending",children:"pending"}),a.jsx("option",{value:"running",children:"running"}),a.jsx("option",{value:"blocked",children:"blocked"}),a.jsx("option",{value:"done",children:"done"}),a.jsx("option",{value:"denied",children:"denied"}),a.jsx("option",{value:"waiting_approval",children:"waiting_approval"})]})}),a.jsx(et,{label:"Repository",children:a.jsx("input",{className:"control",value:r.repo,placeholder:"owner/repo",onChange:l=>i({...r,repo:l.target.value})})}),a.jsx(et,{label:"Thread",children:a.jsx("input",{className:"control",value:r.thread,inputMode:"numeric",placeholder:"issue or PR",onChange:l=>i({...r,thread:l.target.value})})}),a.jsx(et,{label:"Action",children:a.jsx("input",{className:"control",value:r.action,placeholder:"reply_comment",onChange:l=>i({...r,action:l.target.value})})}),a.jsx(et,{label:"Actor",className:"xl:col-span-2",children:a.jsx(Bf,{value:r.actor,options:t,onChange:l=>i({...r,actor:l})})}),a.jsx(et,{label:"Intent",children:a.jsxs("select",{className:"control",value:r.intent,onChange:l=>i({...r,intent:l.target.value}),children:[a.jsx("option",{value:"",children:"All"}),a.jsx("option",{value:"review_only",children:"review_only"}),a.jsx("option",{value:"work_allowed",children:"work_allowed"})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 self-end xl:col-span-2",children:[a.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-white",type:"button",disabled:!s,onClick:o,children:[a.jsx(Sr,{className:"h-4 w-4","aria-hidden":!0}),"Clear"]}),a.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary px-3 text-sm font-semibold text-white",type:"submit",children:[a.jsx(Vl,{className:"h-4 w-4","aria-hidden":!0}),"Apply"]})]})]})]})}function Bf({value:e,options:t,onChange:n}){const[r,i]=D.useState(!1),s=e.trim().replace(/^@/,"").toLowerCase(),o=t.filter(u=>!s||u.login.toLowerCase().includes(s)).slice(0,8),l=t.find(u=>u.login.toLowerCase()===s);return a.jsxs("div",{className:"relative min-w-0",children:[a.jsxs("div",{className:"control flex items-center gap-2 px-2",children:[l?a.jsx("img",{className:"h-5 w-5 shrink-0 rounded-full bg-slate-100",src:_t(l.avatar_url??""),alt:`${l.login} avatar`,referrerPolicy:"no-referrer"}):a.jsx(hr,{className:"h-4 w-4 shrink-0 text-muted","aria-hidden":!0}),a.jsx("input",{className:"min-w-0 flex-1 bg-transparent font-mono text-sm outline-none",value:e,placeholder:"@login",onChange:u=>{n(u.target.value),i(!0)},onFocus:()=>i(!0),onBlur:()=>window.setTimeout(()=>i(!1),100)}),e?a.jsx("button",{className:"rounded-sm p-1 text-muted hover:bg-slate-100",type:"button","aria-label":"Clear actor filter",onClick:()=>n(""),children:a.jsx(Cr,{className:"h-3.5 w-3.5","aria-hidden":!0})}):null]}),r&&o.length>0?a.jsx("div",{className:"absolute left-0 right-0 z-20 mt-1 max-h-72 overflow-auto rounded-md border border-border bg-white p-1 shadow-lg",children:o.map(u=>a.jsxs("button",{className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left hover:bg-slate-50",type:"button",onMouseDown:c=>c.preventDefault(),onClick:()=>{n(u.login),i(!1)},children:[u.avatar_url?a.jsx("img",{className:"h-6 w-6 shrink-0 rounded-full bg-slate-100",src:_t(u.avatar_url),alt:`${u.login} avatar`,referrerPolicy:"no-referrer"}):a.jsx(hr,{className:"h-5 w-5 shrink-0 text-muted","aria-hidden":!0}),a.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:["@",u.login]}),a.jsx("span",{className:"shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] font-semibold text-muted",children:u.job_count})]},u.login))}):null]})}function et({label:e,children:t,className:n}){return a.jsxs("label",{className:re("grid min-w-0 gap-1 text-xs font-semibold text-muted",n),children:[e,t]})}function Uf({jobs:e,loading:t,loadingMore:n=!1,hasMore:r=!1,onLoadMore:i,onViewJob:s,now:o,user:l,onRetry:u,onDismiss:c}){const[d,h]=D.useState(null),[f,p]=D.useState(null),y=D.useRef(!1),w=D.useRef(n),k=!!(l!=null&&l.is_admin&&u),b=!!(l!=null&&l.is_admin&&c);D.useEffect(()=>{w.current&&!n&&(y.current=!1),w.current=n},[n]);const N=D.useCallback(()=>{y.current||(y.current=!0,i==null||i())},[i]),S=D.useCallback(async E=>{if(u){h(E);try{await u(E)}finally{h(null)}}},[u]),C=D.useCallback(async E=>{if(c){p(E);try{await c(E)}finally{p(null)}}},[c]);return t&&e.length===0?a.jsx(Z,{text:"Loading jobs..."}):e.length===0?a.jsx(Z,{text:"No jobs match the current filters."}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid gap-2 md:hidden",children:[e.map(E=>a.jsx(Qf,{job:E,onViewJob:s,now:o,canRetry:k&&Sn(E.status),retrying:d===E.id,onRetry:S,canDismiss:b&&Sn(E.status),dismissing:f===E.id,onDismiss:C},E.id)),a.jsx($f,{hasMore:r,loading:n,onLoadMore:N})]}),a.jsxs("div",{className:"hidden max-h-[640px] overflow-auto rounded-md border border-border md:block",children:[a.jsxs("table",{className:"min-w-full border-collapse text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"sticky top-0 z-10 border-b border-border bg-panel text-left text-xs text-muted",children:[a.jsx("th",{className:"px-2 py-2 font-semibold",children:"ID"}),a.jsx("th",{className:"px-2 py-2 font-semibold",children:"Status"}),a.jsx("th",{className:"px-2 py-2 font-semibold",children:"Repo / thread"}),a.jsx("th",{className:"px-2 py-2 font-semibold",children:"Action"}),a.jsx("th",{className:"px-2 py-2 font-semibold",children:"Actor"}),a.jsx("th",{className:"px-2 py-2 font-semibold",children:"Attempts"}),a.jsx("th",{className:"px-2 py-2 font-semibold",children:"Queue wait"}),a.jsx("th",{className:"px-2 py-2 font-semibold",children:"Runtime"}),a.jsx("th",{className:"px-2 py-2 font-semibold",children:"Updated"}),a.jsx("th",{className:"px-2 py-2 text-right font-semibold",children:"Actions"})]})}),a.jsx("tbody",{children:e.map(E=>a.jsxs("tr",{className:"cursor-pointer border-b border-border hover:bg-slate-50",onClick:()=>s(E.id),children:[a.jsxs("td",{className:"px-2 py-3 font-mono",children:["#",E.id]}),a.jsx("td",{className:"px-2 py-3",children:a.jsx(Xi,{status:E.status})}),a.jsxs("td",{className:"px-2 py-3",children:[a.jsx("div",{className:"font-mono",children:E.repo??E.work_key}),a.jsxs("div",{className:"text-xs text-muted",children:["thread ",E.thread??"n/a"]})]}),a.jsxs("td",{className:"px-2 py-3",children:[a.jsx("div",{children:E.action}),a.jsx("div",{className:"text-xs text-muted",children:E.intent})]}),a.jsx("td",{className:"px-2 py-3",children:a.jsx(mn,{actor:E.trigger_actor,avatarUrl:E.trigger_actor_avatar_url})}),a.jsx("td",{className:"px-2 py-3",children:E.attempts}),a.jsx("td",{className:"px-2 py-3",children:$e(Wi(E,o))}),a.jsx("td",{className:"px-2 py-3",children:$e(Ji(E,o))}),a.jsx("td",{className:"px-2 py-3 font-mono text-xs",children:a.jsx(Ne,{value:E.updated_at,compact:!0,relative:!0,now:o})}),a.jsx("td",{className:"px-2 py-3 text-right",children:a.jsxs("div",{className:"inline-flex items-center gap-1",children:[a.jsx(zo,{jobId:E.id,canRetry:k&&Sn(E.status),retrying:d===E.id,onRetry:S,compact:!0}),a.jsx(qo,{jobId:E.id,canDismiss:b&&Sn(E.status),dismissing:f===E.id,onDismiss:C,compact:!0})]})})]},E.id))})]}),a.jsx(Hf,{hasMore:r,loading:n,onLoadMore:N})]})]})}function $f({hasMore:e,loading:t,onLoadMore:n}){return!e&&!t?null:a.jsxs("button",{className:"inline-flex min-h-10 w-full items-center justify-center gap-2 rounded-md border border-border px-3 py-2 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60 md:hidden",type:"button",disabled:t||!e,onClick:()=>n==null?void 0:n(),children:[a.jsx(Un,{className:"h-4 w-4","aria-hidden":!0}),t?"Loading more jobs...":"Load more jobs"]})}function Hf({hasMore:e,loading:t,onLoadMore:n}){const r=D.useRef(null);return D.useEffect(()=>{const i=r.current;if(!i||!e||t||!n)return;if(!("IntersectionObserver"in window)){n();return}const s=new IntersectionObserver(o=>{o.some(l=>l.isIntersecting)&&n()},{rootMargin:"240px 0px"});return s.observe(i),()=>s.disconnect()},[e,t,n]),!e&&!t?null:a.jsx("div",{ref:r,className:"flex min-h-10 items-center justify-center px-3 py-2 text-xs font-medium text-muted","aria-live":"polite",children:t?"Loading more jobs...":"Scroll for more jobs"})}function Qf({job:e,onViewJob:t,now:n,canRetry:r,retrying:i,onRetry:s,canDismiss:o,dismissing:l,onDismiss:u}){return a.jsxs("article",{className:"rounded-md border border-border bg-white shadow-[0_1px_0_rgba(15,23,42,0.03)]",children:[a.jsxs("button",{className:"grid w-full gap-2 p-3 text-left hover:bg-slate-50",type:"button",onClick:()=>t(e.id),children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0 space-y-1",children:[a.jsxs("div",{className:"grid min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-2",children:[a.jsxs("span",{className:"shrink-0 font-mono text-xs font-semibold text-muted",children:["#",e.id]}),a.jsx("span",{className:"truncate font-mono text-sm",children:e.repo??e.work_key})]}),a.jsx("div",{className:"line-clamp-2 text-sm leading-snug text-foreground",children:e.subject}),a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted",children:[a.jsxs("span",{children:["thread ",e.thread??"n/a"," · ",e.action]}),a.jsx(mn,{actor:e.trigger_actor,avatarUrl:e.trigger_actor_avatar_url})]})]}),a.jsx(Xi,{status:e.status})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-2 text-xs",children:[a.jsx(me,{label:"Wait",value:$e(Wi(e,n))}),a.jsx(me,{label:"Runtime",value:$e(Ji(e,n))}),a.jsx(me,{label:"Updated",value:a.jsx(Ne,{value:e.updated_at,compact:!0,relative:!0,now:n})})]})]}),r||o?a.jsxs("div",{className:"flex flex-wrap gap-2 border-t border-border px-3 py-2",children:[a.jsx(zo,{jobId:e.id,canRetry:r,retrying:i,onRetry:s}),a.jsx(qo,{jobId:e.id,canDismiss:o,dismissing:l,onDismiss:u})]}):null]})}function zo({jobId:e,canRetry:t,retrying:n,onRetry:r,compact:i=!1}){if(!t)return null;const s=n?"Retrying...":"Retry";return a.jsxs("button",{className:re("inline-flex h-8 items-center justify-center gap-2 rounded-md border border-border text-sm font-semibold text-foreground hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60",i?"w-8 px-0":"px-3"),type:"button",disabled:n,"aria-label":`Retry job #${e}`,title:`Retry job #${e}`,onClick:async o=>{o.stopPropagation(),window.confirm(`Retry job #${e}?`)&&await r(e)},children:[a.jsx(Sr,{className:"h-4 w-4","aria-hidden":!0}),a.jsx("span",{className:re(i&&"sr-only"),children:s})]})}function qo({jobId:e,canDismiss:t,dismissing:n,onDismiss:r,compact:i=!1}){if(!t)return null;const s=n?"Dismissing...":"Dismiss";return a.jsxs("button",{className:re("inline-flex h-8 items-center justify-center gap-2 rounded-md border border-border text-sm font-semibold text-foreground hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60",i?"w-8 px-0":"px-3"),type:"button",disabled:n,"aria-label":`Dismiss job #${e}`,title:`Dismiss job #${e}`,onClick:async o=>{o.stopPropagation(),window.confirm(`Dismiss job #${e}?`)&&await r(e)},children:[a.jsx(dn,{className:"h-4 w-4","aria-hidden":!0}),a.jsx("span",{className:re(i&&"sr-only"),children:s})]})}function mn({actor:e,avatarUrl:t,framed:n=!1}){const r=t?a.jsx("img",{className:"h-4 w-4 shrink-0 rounded-full bg-slate-100",src:_t(t),alt:e?`${e} avatar`:"",referrerPolicy:"no-referrer"}):a.jsx(hr,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),i=a.jsxs(a.Fragment,{children:[r,a.jsx("span",{className:"min-w-0 truncate",children:e?`@${e}`:"unknown actor"})]});return n?a.jsx("span",{className:"inline-flex h-7 max-w-full items-center gap-1 rounded-md border border-border px-2 text-xs font-semibold text-muted",children:i}):a.jsx("span",{className:"inline-flex min-w-0 max-w-full items-center gap-1 font-mono text-xs text-muted",children:i})}function Kf(e){return(e==null?void 0:e.model)??"OpenClaw default"}function Vf(e){return(e==null?void 0:e.thinking)??"OpenClaw default"}function Gf(e){return e?e.configured?"configured":e.summary:"n/a"}function Jf({job:e,session:t,sessionEvents:n,transcript:r,now:i,compact:s=!1}){var p;const o=Kn(e.id),l=n??[],u=r??[],c=rf(l),d=sf(u),h=Ji(e,i),f=Wi(e,i);return a.jsxs("div",{className:"grid min-w-0 gap-4",children:[a.jsxs("div",{className:"sticky top-0 z-20 -mx-3 -mt-3 grid gap-2 border-b border-border bg-panel/95 px-3 py-2 shadow-sm backdrop-blur sm:-mx-4 sm:-mt-4 sm:px-4","aria-label":"Sticky job header",children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[a.jsx(Xi,{status:e.status}),a.jsxs("a",{className:"inline-flex h-7 items-center gap-1 rounded-md border border-border bg-white px-2 text-xs font-semibold text-foreground hover:bg-slate-50",href:o,children:[a.jsx(Nr,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Job #",e.id]}),a.jsx(mn,{actor:e.trigger_actor,avatarUrl:e.trigger_actor_avatar_url,framed:!0}),a.jsx("span",{className:"min-w-0 break-words font-mono text-xs text-muted [overflow-wrap:anywhere]",children:e.work_key})]}),a.jsxs("div",{className:"grid min-w-0 gap-2 lg:grid-cols-[minmax(0,1fr)_minmax(280px,auto)] lg:items-start",children:[a.jsx("p",{className:"min-w-0 break-words text-sm text-muted [overflow-wrap:anywhere]",children:e.subject}),a.jsxs("div",{className:"grid min-w-0 gap-1",children:[a.jsx("h3",{className:"text-xs font-semibold text-muted",children:"GitHub links"}),e.github_urls.length>0?a.jsx(On,{urls:e.github_urls,compact:!0}):a.jsx("p",{className:"text-xs text-muted",children:"No links recorded."})]})]})]}),a.jsxs("div",{className:re("grid gap-2 text-sm sm:gap-3",s?"grid-cols-1":"grid-cols-3"),children:[a.jsx(me,{label:"Queue wait",value:$e(f)}),a.jsx(me,{label:e.status==="running"?"Running for":"Runtime",value:$e(h)}),a.jsx(me,{label:"Coalesced",value:String(e.coalesced_count)})]}),a.jsxs("div",{className:re("grid gap-2 text-sm sm:gap-3",s?"grid-cols-1":"grid-cols-3"),children:[a.jsx(me,{label:"Model",value:Kf(e.model_route)}),a.jsx(me,{label:"Reasoning",value:Vf(e.model_route)}),a.jsx(me,{label:"Route",value:Gf(e.model_route)})]}),a.jsxs("div",{className:re("grid gap-2 text-sm sm:gap-3",s?"grid-cols-1":"grid-cols-2 xl:grid-cols-4"),children:[a.jsx(me,{label:"Created",value:a.jsx(Ne,{value:e.created_at,compact:!0,relative:!0,now:i})}),a.jsx(me,{label:"Started",value:e.started_at?a.jsx(Ne,{value:e.started_at,compact:!0,relative:!0,now:i}):"n/a"}),a.jsx(me,{label:"Updated",value:a.jsx(Ne,{value:e.updated_at,compact:!0,relative:!0,now:i})}),a.jsx(me,{label:"Finished",value:e.finished_at?a.jsx(Ne,{value:e.finished_at,compact:!0,relative:!0,now:i}):"n/a"})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"mb-2 text-sm font-semibold",children:"Timeline"}),a.jsx("div",{className:"grid min-w-0 gap-3",children:(e.worklog??[]).length>0?(p=e.worklog)==null?void 0:p.map(y=>a.jsxs("div",{className:"min-w-0 border-l-2 border-primary pl-3",children:[a.jsx("div",{className:"text-sm font-semibold",children:y.phase}),a.jsx("div",{className:"font-mono text-xs text-muted",children:a.jsx(Ne,{value:y.ts,relative:!0,now:i})}),a.jsx("div",{className:"break-words text-sm [overflow-wrap:anywhere]",children:y.summary}),y.detail?a.jsx("div",{className:"mt-1 break-words font-mono text-xs text-muted [overflow-wrap:anywhere]",children:y.detail}):null]},y.id)):a.jsx(Z,{text:"No worklog entries."})})]}),a.jsxs("div",{children:[a.jsxs("h3",{className:"mb-2 flex items-center gap-2 text-sm font-semibold",children:[a.jsx(Ti,{className:"h-4 w-4","aria-hidden":!0}),"OpenClaw session"]}),t?a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[a.jsx(me,{label:"Session ID",value:t.id}),a.jsx(me,{label:"Source",value:t.source})]}),a.jsx("p",{className:"break-words text-xs text-muted [overflow-wrap:anywhere]",children:t.detail})]}):a.jsx(Z,{text:"Session correlation is loading."})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"mb-2 text-sm font-semibold",children:"Agent activity"}),a.jsx("div",{className:"grid max-h-[460px] min-w-0 gap-2 overflow-auto pr-1",children:c.length>0?c.map((y,w)=>a.jsx(Xf,{event:y,defaultOpen:ua(y.eventType,e.status==="running",w,c.length),now:i},y.id)):a.jsx(Z,{text:e.status==="running"?"Waiting for live agent output...":"No agent activity has been recorded for this session."})})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"mb-2 text-sm font-semibold",children:"Session transcript"}),a.jsx("div",{className:"grid max-h-[620px] min-w-0 gap-2 overflow-auto pr-1",children:d.length>0?d.map((y,w)=>a.jsx(Wf,{entry:y,defaultOpen:ua(y.kind,e.status==="running",w,d.length),now:i},y.id)):a.jsx(Z,{text:e.status==="running"?"Waiting for live transcript entries...":"No OpenClaw transcript entries are available for this session."})})]})]})}function Wf({entry:e,defaultOpen:t,now:n}){return a.jsx(Bo,{badge:e.badge,meta:a.jsx(Ne,{value:e.meta,relative:!0,now:n}),count:e.count,summary:e.summary,defaultOpen:t,children:a.jsx("pre",{className:"max-h-72 max-w-full overflow-auto whitespace-pre-wrap break-words rounded bg-slate-950 px-2 py-1.5 font-mono text-xs leading-relaxed text-slate-100 [overflow-wrap:anywhere]",children:e.text})})}function Xf({event:e,defaultOpen:t,now:n}){return a.jsx(Bo,{badge:e.badge,meta:a.jsx(Ne,{value:e.meta,relative:!0,now:n}),count:e.count,summary:e.summary,defaultOpen:t,children:e.detail?a.jsx("pre",{className:"max-h-56 max-w-full overflow-auto whitespace-pre-wrap break-words rounded bg-slate-950 px-2 py-1.5 font-mono text-xs leading-relaxed text-slate-100 [overflow-wrap:anywhere]",children:e.detail}):null})}function Bo({badge:e,meta:t,count:n,summary:r,defaultOpen:i,children:s}){const[o,l]=D.useState(!!i);return a.jsxs("details",{className:"group min-w-0 rounded border border-border bg-slate-50/60",open:o,onToggle:u=>l(u.currentTarget.open),children:[a.jsxs("summary",{className:"grid cursor-pointer list-none gap-1 px-2 py-1.5 marker:hidden hover:bg-white",children:[a.jsxs("div",{className:"grid min-w-0 gap-1 sm:flex sm:items-center sm:justify-between sm:gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[a.jsx(Un,{className:"h-3.5 w-3.5 shrink-0 text-muted transition-transform group-open:rotate-180","aria-hidden":!0}),a.jsx("span",{className:"truncate font-mono text-[11px] font-semibold text-muted",children:e}),n&&n>1?a.jsx("span",{className:"rounded-sm border border-border px-1 font-mono text-[10px] text-muted",children:n}):null]}),a.jsx("span",{className:"min-w-0 truncate pl-5 font-mono text-[11px] text-muted sm:shrink-0 sm:pl-0",children:t})]}),a.jsx("div",{className:"min-w-0 break-words pl-5 text-xs text-foreground [overflow-wrap:anywhere] sm:truncate",children:r})]}),a.jsx("div",{className:"min-w-0 border-t border-border bg-white px-2 py-2",children:s})]})}function pa({label:e,values:t}){const n=[{name:"median",seconds:(t==null?void 0:t.median)??0},{name:"p90",seconds:(t==null?void 0:t.p90)??0},{name:"p99",seconds:(t==null?void 0:t.p99)??0}];return a.jsx("div",{className:"h-56",children:a.jsx(br,{width:"100%",height:"100%",children:a.jsxs(Si,{data:n,children:[a.jsx(yr,{strokeDasharray:"3 3"}),a.jsx(wr,{dataKey:"name"}),a.jsx(vr,{tickFormatter:$e}),a.jsx(kr,{formatter:r=>[$e(Number(r)),e]}),a.jsx(Ci,{dataKey:"seconds",fill:"#0969da",radius:[4,4,0,0]})]})})})}function Yf({values:e,loading:t,totalJobs:n}){const r=Object.entries(e??{}).map(([i,s])=>({day:i,count:s}));return t&&r.length===0?a.jsx(Z,{text:"Loading job history..."}):r.length===0?a.jsx(Z,{text:n>0?"Job history has no valid creation dates.":"No job history available."}):a.jsx("div",{className:"h-56",children:a.jsx(br,{width:"100%",height:"100%",children:a.jsxs(Si,{data:r,children:[a.jsx(yr,{strokeDasharray:"3 3"}),a.jsx(wr,{dataKey:"day",minTickGap:16}),a.jsx(vr,{allowDecimals:!1}),a.jsx(kr,{formatter:i=>[Number(i),"jobs"]}),a.jsx(Ci,{dataKey:"count",fill:"#16a34a",radius:[4,4,0,0]})]})})})}function Zf({usage:e,loading:t,totalJobs:n}){const[r,i]=D.useState("day"),s=(e==null?void 0:e[r])??[],o=s.map(u=>({...u,label:em(u.bucket,r)})),l=s.reduce((u,c)=>u+c.seconds,0);return t&&o.length===0?a.jsx(Z,{text:"Loading runtime usage..."}):o.length===0?a.jsx(Z,{text:n>0?"No jobs have recorded runtime yet.":"No job history available."}):a.jsxs("div",{className:"grid gap-3",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted",children:[a.jsx(Gl,{className:"h-4 w-4","aria-hidden":!0}),a.jsxs("span",{children:[Gr(l)," consumed across ",s.reduce((u,c)=>u+c.jobs,0)," job",s.reduce((u,c)=>u+c.jobs,0)===1?"":"s"]})]}),a.jsx("div",{className:"inline-flex h-8 rounded-md border border-border bg-white p-0.5","aria-label":"Runtime grouping",children:["day","month"].map(u=>a.jsx("button",{className:re("rounded px-2.5 text-xs font-semibold capitalize",r===u?"bg-primary text-white":"text-muted hover:bg-slate-50"),type:"button",onClick:()=>i(u),children:u},u))})]}),a.jsx("div",{className:"h-64",children:a.jsx(br,{width:"100%",height:"100%",children:a.jsxs(Si,{data:o,children:[a.jsx(yr,{strokeDasharray:"3 3"}),a.jsx(wr,{dataKey:"label",minTickGap:16,tick:{fontSize:11}}),a.jsx(vr,{tickFormatter:u=>Gr(Number(u))}),a.jsx(kr,{formatter:(u,c)=>c==="seconds"?[Gr(Number(u)),"runtime"]:[Number(u),String(c)],labelFormatter:u=>String(u)}),a.jsx(Ci,{dataKey:"seconds",fill:"#0969da",radius:[4,4,0,0],isAnimationActive:!1})]})})})]})}function em(e,t){if(t==="month"){const[s,o]=e.split("-").map(Number);return!s||!o?e:new Intl.DateTimeFormat(void 0,{month:"short",year:"numeric"}).format(new Date(s,o-1,1))}const[n,r,i]=e.split("-").map(Number);return!n||!r||!i?e:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(new Date(n,r-1,i))}function Gr(e){const t=Math.max(0,Math.round(e));if(t<60)return`${t}s`;const n=Math.round(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60),i=n%60;return i===0?`${r}h`:`${r}h ${i}m`}function fa(e){return Object.values(e).reduce((t,n)=>t+n,0)}function tm({data:e,loading:t}){if(t&&!e)return a.jsx(Z,{text:"Loading systemd units..."});if(!e)return a.jsx(Z,{text:"No systemd snapshot available."});const n=e.units??[],r=n.filter(o=>o.active_state==="active").length,i=n.filter(o=>o.active_state==="failed"||o.result==="failed").length,s=n.filter(o=>o.kind==="timer").length;return a.jsxs("div",{className:"grid min-w-0 gap-3",children:[e.errors.length>0?a.jsx(Te,{tone:"error",text:e.errors[0]}):null,n.length===0?a.jsx(Z,{text:"No configured bridge units found."}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[a.jsx(lr,{label:"Units",value:String(n.length)}),a.jsx(lr,{label:"Active",value:String(r)}),a.jsx(lr,{label:"Failed",value:String(i),tone:i>0?"bad":"neutral"}),a.jsx(lr,{label:"Timers",value:String(s)})]}),a.jsxs("div",{className:"overflow-hidden rounded-md border border-border bg-white",children:[a.jsxs("div",{className:"hidden grid-cols-[minmax(0,1.35fr)_90px_120px_90px_minmax(0,1fr)] gap-3 border-b border-border bg-slate-50 px-3 py-2 text-[11px] font-semibold uppercase text-muted md:grid",children:[a.jsx("span",{children:"Unit"}),a.jsx("span",{children:"Status"}),a.jsx("span",{children:"State"}),a.jsx("span",{children:"PID"}),a.jsx("span",{children:"Schedule"})]}),a.jsx("div",{className:"divide-y divide-border",children:n.map(o=>a.jsx(nm,{unit:o},o.unit))})]})]})]})}function lr({label:e,value:t,tone:n="neutral"}){return a.jsxs("div",{className:re("min-w-0 rounded-md border bg-white px-3 py-2",n==="bad"?"border-red-200":"border-border"),children:[a.jsx("div",{className:re("font-mono text-lg font-semibold",n==="bad"?"text-red-700":"text-foreground"),children:t}),a.jsx("div",{className:"mt-0.5 text-[11px] font-semibold uppercase text-muted",children:e})]})}function nm({unit:e}){const[t,n]=D.useState(!1),r=e.active_state==="active",i=e.active_state==="failed"||e.result==="failed",s=e.next_elapse||e.last_trigger||"n/a";return a.jsxs("details",{className:"group min-w-0",open:t,onToggle:o=>n(o.currentTarget.open),children:[a.jsxs("summary",{className:"grid min-w-0 cursor-pointer list-none grid-cols-2 gap-2 px-3 py-3 text-sm marker:hidden hover:bg-slate-50 md:grid-cols-[minmax(0,1.35fr)_90px_120px_90px_minmax(0,1fr)] md:items-center md:gap-3",children:[a.jsxs("div",{className:"col-span-2 min-w-0 md:col-span-1",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx(Un,{className:"h-3.5 w-3.5 shrink-0 text-muted transition-transform group-open:rotate-180","aria-hidden":!0}),a.jsx("span",{className:"truncate font-mono text-xs font-semibold text-foreground",children:e.unit})]}),a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 pl-5 text-[11px] font-semibold uppercase text-muted",children:[a.jsx("span",{children:e.role}),a.jsx("span",{children:e.kind}),a.jsx("span",{children:e.load_state}),a.jsx("span",{children:t?"following log":"expand log"})]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2 md:block",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase text-muted md:hidden",children:"Status"}),a.jsx("span",{className:re("inline-flex h-6 items-center rounded-full border px-2 text-xs font-semibold",i?"border-red-300 bg-red-50 text-red-700":r?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-slate-300 bg-slate-50 text-slate-700"),children:e.active_state})]}),a.jsx(ma,{label:"State",value:e.sub_state,detail:e.result||"unknown"}),a.jsx(ma,{label:"PID",value:e.main_pid?String(e.main_pid):"n/a",detail:$e(e.uptime_seconds)}),a.jsxs("div",{className:"col-span-2 min-w-0 md:col-span-1",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase text-muted md:hidden",children:"Schedule"}),a.jsx("div",{className:"truncate font-mono text-[11px] text-foreground",title:s,children:e.next_elapse?`next ${e.next_elapse}`:s})]})]}),a.jsx("div",{className:"border-t border-border bg-slate-50 px-3 pb-3 pt-2",children:a.jsx(rm,{unit:e.unit,active:t})})]})}function ma({label:e,value:t,detail:n}){return a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase text-muted md:hidden",children:e}),a.jsx("div",{className:"truncate font-mono text-[11px] text-foreground",children:t}),n?a.jsx("div",{className:"truncate font-mono text-[11px] text-muted",children:n}):null]})}function rm({unit:e,active:t}){const[n,r]=D.useState([]),[i,s]=D.useState(""),o=D.useRef(null);return D.useEffect(()=>{if(!t){r([]),s("");return}r([]),s("");const l=new EventSource(`/api/systemd/journal/stream?unit=${encodeURIComponent(e)}`);return l.addEventListener("journal_line",u=>{const c=gr(u);c&&r(d=>[...d.slice(-199),c])}),l.addEventListener("journal_error",u=>{const c=gr(u);s((c==null?void 0:c.error)??"journal stream failed")}),l.onerror=()=>{},()=>l.close()},[t,e]),D.useEffect(()=>{const l=o.current;l&&(l.scrollTop=l.scrollHeight)},[n]),a.jsxs("div",{className:"grid min-w-0 gap-2",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase text-muted",children:"Live journal"}),a.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px] text-muted",children:n.length>0?`${n.length} lines streamed`:"waiting for journal output"})]}),a.jsx("div",{className:"font-mono text-[11px] text-muted",children:"journalctl -f"})]}),i?a.jsx(Te,{tone:"error",text:i}):null,a.jsx("div",{ref:o,className:"h-72 overflow-auto rounded-md border border-slate-800 bg-slate-950 p-3 font-mono text-xs leading-relaxed text-slate-100",children:n.length>0?n.map((l,u)=>a.jsx("div",{className:"break-words [overflow-wrap:anywhere]",children:l.line},`${l.unit}-${u}`)):a.jsx("div",{className:"text-slate-400",children:"No journal lines received yet."})})]})}function im({data:e,loading:t}){var h,f,p,y,w,k;if(t&&!e)return a.jsx(Z,{text:"Loading process activity..."});if(!e)return a.jsx(Z,{text:"No process snapshot available."});const n=e.executor.children??[],r=n.flatMap(b=>$o(b)),i=r.reduce((b,N)=>b+N.cpu_ticks,0),s=r.reduce((b,N)=>b+am(N),0),o=e.executor.service==="active",l=r.slice(0,8).map(b=>({label:`pid ${b.pid}`,ticks:b.cpu_ticks})),u=(e.samples??[]).map(b=>({label:Rn(b.ts),ticks:b.cpu_ticks,io:b.io_bytes,active:b.active_since_last_sample?"active":"quiet"})),c=u.length>0?u:l,d=(h=e.samples)==null?void 0:h[e.samples.length-1];return a.jsxs("div",{className:"grid gap-4",children:[a.jsx("div",{className:"rounded-md border border-slate-200 bg-slate-50 p-3",children:a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("span",{className:re("inline-flex h-6 items-center rounded-full border px-2 text-xs font-semibold",o?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-slate-300 bg-white text-slate-600"),children:o?"active":"idle"}),a.jsxs("span",{className:"font-mono text-xs text-muted",children:["service ",e.executor.service]})]}),a.jsx("div",{className:"mt-2 text-sm font-semibold text-foreground",children:e.running_jobs.length>0?`${e.running_jobs.length} running job${e.running_jobs.length===1?"":"s"}`:"No running jobs"}),e.running_jobs.length>0?a.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:e.running_jobs.slice(0,4).map(b=>a.jsxs("span",{className:"inline-flex min-h-6 items-center gap-1.5 rounded-full border border-blue-200 bg-white px-2 font-mono text-[11px] font-semibold text-blue-700",children:[a.jsx("span",{className:"h-2 w-2 rounded-full bg-blue-600 animate-live-pulse","aria-hidden":!0}),"#",b.id," ",$e(b.age_seconds)]},b.id))}):null,d?a.jsxs("p",{className:"mt-1 text-xs text-muted",children:["Last persisted sample ",Rn(d.ts)," · ",d.active_since_last_sample?"activity observed":`quiet ${$e(d.idle_seconds)}`]}):null,a.jsx("p",{className:"mt-1 text-xs text-muted",children:e.detail})]}),a.jsxs("div",{className:"grid min-w-[190px] grid-cols-3 gap-2 text-center text-xs",children:[a.jsx(Jr,{label:"PID",value:e.executor.pid?String(e.executor.pid):"n/a"}),a.jsx(Jr,{label:"Children",value:String(r.length)}),a.jsx(Jr,{label:"CPU ticks",value:String(i)})]})]})}),a.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[a.jsx(ur,{label:"Live process",value:((f=e.signals)==null?void 0:f.live_process.state)??(r.length>0?"live":"no_child_process"),detail:`${((p=e.signals)==null?void 0:p.live_process.child_count)??r.length} children`}),a.jsx(ur,{label:"Process activity",value:((y=e.signals)==null?void 0:y.process_activity.state)??(d!=null&&d.active_since_last_sample?"active":"quiet"),detail:d?`sample ${Rn(d.ts)}`:"no sample"}),a.jsx(ur,{label:"Semantic progress",value:(w=e.signals)!=null&&w.semantic_progress.length?"recent":"none",detail:xa(e.running_jobs,"semantic_progress")}),a.jsx(ur,{label:"Visible progress",value:(k=e.signals)!=null&&k.visible_progress.length?"streaming":"none",detail:xa(e.running_jobs,"visible_progress")})]}),e.alerts.length>0?a.jsx(Te,{tone:"error",text:e.alerts[0]}):null,a.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",children:[a.jsxs("div",{className:"min-w-0 rounded-md border border-border p-3",children:[a.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[a.jsxs("h3",{className:"flex items-center gap-2 text-sm font-semibold",children:[a.jsx(vs,{className:"h-4 w-4","aria-hidden":!0}),u.length>0?"CPU history":"CPU ticks"]}),a.jsxs("span",{className:"font-mono text-xs text-muted",children:[Ho(s)," I/O"]})]}),c.length>0?a.jsx("div",{className:"h-40",children:a.jsx(br,{width:"100%",height:"100%",children:a.jsxs(Go,{data:c,children:[a.jsx(yr,{strokeDasharray:"3 3"}),a.jsx(wr,{dataKey:"label",tick:!1}),a.jsx(vr,{allowDecimals:!1,tick:{fontSize:11}}),a.jsx(kr,{formatter:b=>[Number(b),"cpu ticks"]}),a.jsx(Jo,{type:"monotone",dataKey:"ticks",stroke:"#0f766e",strokeWidth:2,dot:{r:3},activeDot:{r:5},isAnimationActive:!1})]})})}):a.jsx(Z,{text:"No executor CPU samples available."})]}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("h3",{className:"mb-2 flex items-center gap-2 text-sm font-semibold",children:[a.jsx(vs,{className:"h-4 w-4","aria-hidden":!0}),"Executor children"]}),n.length>0?a.jsx("div",{className:"grid gap-2",children:n.map(b=>a.jsx(Uo,{process:b},b.pid))}):a.jsx(Z,{text:"No child process detected for the executor."})]})]})]})}function sm({alerts:e,loading:t,now:n}){if(t&&!e)return a.jsx(Z,{text:"Loading monitor alerts..."});const r=e??[];return r.length===0?a.jsx(Z,{text:"No active monitor alerts."}):a.jsx("div",{className:"grid gap-2",children:r.slice(0,5).map(i=>a.jsxs("div",{className:"rounded-md border border-red-200 bg-red-50 p-2.5",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs font-semibold text-red-700",children:[a.jsx(Ai,{className:"h-3.5 w-3.5","aria-hidden":!0}),a.jsx("span",{children:i.severity}),a.jsx("span",{className:"font-normal text-red-600",children:Mo(i.last_seen,n)}),i.observations>1?a.jsxs("span",{className:"rounded-full border border-red-200 bg-white px-1.5",children:[i.observations,"x"]}):null]}),a.jsx("p",{className:"mt-1 break-words text-sm font-medium text-red-950 [overflow-wrap:anywhere]",children:i.message})]},i.fingerprint))})}function Uo({process:e}){var r,i;const t=((r=e.io_bytes)==null?void 0:r.read_bytes)??0,n=((i=e.io_bytes)==null?void 0:i.write_bytes)??0;return a.jsxs("div",{className:"rounded-md border border-border bg-white p-2.5",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[a.jsxs("span",{className:"font-mono",children:["pid ",e.pid]}),a.jsxs("span",{className:"rounded-full border border-border px-2 text-xs text-muted",children:["state ",e.state]}),a.jsxs("span",{className:"rounded-full border border-border px-2 text-xs text-muted",children:["cpu ",e.cpu_ticks]}),a.jsxs("span",{className:"rounded-full border border-border px-2 text-xs text-muted",children:["I/O ",Ho(t+n)]})]}),a.jsx("div",{className:"mt-2 break-words font-mono text-xs text-muted",children:e.cmd||"unknown command"}),e.children&&e.children.length>0?a.jsx("div",{className:"mt-3 border-l-2 border-border pl-3",children:e.children.map(s=>a.jsx(Uo,{process:s},s.pid))}):null]})}function Jr({label:e,value:t}){return a.jsxs("div",{className:"rounded-md border border-border bg-white px-2 py-2",children:[a.jsx("div",{className:"font-mono text-sm font-semibold text-foreground",children:t}),a.jsx("div",{className:"mt-0.5 text-[11px] font-semibold uppercase text-muted",children:e})]})}function ur({label:e,value:t,detail:n}){return a.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-white p-2.5",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase text-muted",children:e}),a.jsx("div",{className:"mt-1 truncate text-sm font-semibold text-foreground",children:t}),a.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted",children:n})]})}function xa(e,t){const n=e.find(i=>i[t]),r=n==null?void 0:n[t];return!n||!r?"no running heartbeat":`#${n.id} ${r.phase} ${$e(r.age_seconds??null)}`}function $o(e){return[e,...(e.children??[]).flatMap(t=>$o(t))]}function am(e){var t,n;return(((t=e.io_bytes)==null?void 0:t.read_bytes)??0)+(((n=e.io_bytes)==null?void 0:n.write_bytes)??0)}function Ho(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}function me({label:e,value:t}){return a.jsxs("div",{className:"min-w-0 rounded-md border border-border p-3",children:[a.jsx("div",{className:"text-xs font-semibold text-muted",children:e}),a.jsx("div",{className:"mt-1 min-w-0 break-words text-sm [overflow-wrap:anywhere]",children:t})]})}function Xi({status:e}){const t=af(e),n=e==="running"||e==="pending";return a.jsxs("span",{className:re("inline-flex min-h-6 items-center gap-1.5 rounded-full border px-2 text-xs font-semibold",t.badge),children:[a.jsx("span",{className:re("h-2.5 w-2.5 rounded-full",t.dot,n&&"animate-live-pulse"),"aria-hidden":!0}),e]})}function Z({text:e}){return a.jsx("div",{className:"rounded-md border border-dashed border-border p-6 text-center text-sm text-muted",children:e})}function Te({tone:e,text:t}){return a.jsx("div",{className:re("rounded-md border p-3 text-sm",e==="error"&&"border-red-300 bg-red-50 text-red-700"),children:t})}function ut({onClick:e,compactOnMobile:t=!1}){return a.jsxs("button",{className:re("inline-flex h-8 items-center justify-center gap-2 rounded-md border border-border text-sm font-semibold text-foreground hover:bg-slate-50",t?"w-8 px-0 sm:w-auto sm:px-3":"px-3"),onClick:e,type:"button","aria-label":"Refresh",children:[a.jsx(Ha,{className:"h-4 w-4","aria-hidden":!0}),a.jsx("span",{className:re(t&&"hidden sm:inline"),children:"Refresh"})]})}const ga=document.getElementById("root");ga&&el.createRoot(ga).render(a.jsx(D.StrictMode,{children:a.jsx(El,{client:Gp,children:a.jsx(gf,{})})})); diff --git a/src/github_agent_bridge/dashboard_static/index.html b/src/github_agent_bridge/dashboard_static/index.html index aa9ea45..399d495 100644 --- a/src/github_agent_bridge/dashboard_static/index.html +++ b/src/github_agent_bridge/dashboard_static/index.html @@ -4,7 +4,7 @@ GitHub Agent Bridge Dashboard - + diff --git a/tests/test_backend.py b/tests/test_backend.py index 0411f9c..2aea89a 100644 --- a/tests/test_backend.py +++ b/tests/test_backend.py @@ -13,6 +13,7 @@ from github_agent_bridge.dashboard_data import get_job_detail, job_session, job_session_events, job_session_transcript, list_job_actors, list_jobs, metrics_summary from github_agent_bridge.monitor import MonitorReport from github_agent_bridge.models import GitHubContext, Notification +from github_agent_bridge.mcp import create_token from github_agent_bridge.observability import record_monitor_observation from github_agent_bridge.policy import Policy from github_agent_bridge.queue import JobQueue @@ -62,6 +63,7 @@ def test_dashboard_status_is_read_only_and_lists_recent_jobs(tmp_path): assert response.status_code == 200 assert response.json()["read_only"] is False assert response.json()["dashboard_url"] == "http://testserver" + assert response.json()["dashboard_url_source"] == "request" assert response.json()["admin_actions"] == [ "retry_job", "dismiss_job", @@ -98,6 +100,7 @@ def test_dashboard_status_reports_configured_public_url(tmp_path): assert response.status_code == 200 assert response.json()["dashboard_url"] == "https://bridge.example.com" + assert response.json()["dashboard_url_source"] == "configured" def test_dashboard_status_reports_forwarded_public_url(tmp_path): @@ -116,6 +119,7 @@ def test_dashboard_status_reports_forwarded_public_url(tmp_path): assert response.status_code == 200 assert response.json()["dashboard_url"] == "https://bridge.example.com/ops" + assert response.json()["dashboard_url_source"] == "forwarded" def test_dashboard_autoupdate_state_requires_admin_profile(tmp_path): @@ -950,6 +954,38 @@ def test_dashboard_admin_manages_mcp_tokens(tmp_path): assert listed_after_revoke.json()["tokens"] == [] +def test_http_mcp_uses_bearer_tokens_and_shared_server(tmp_path): + db = tmp_path / "bridge.sqlite3" + JobQueue(db) + feedback.add_rule(db, "repo:gisce/erp", "technical_criterion", "Prefer the HTTP MCP endpoint for remote agents.", 0.9) + token = create_token(db, "remote agent")["token"] + app = create_app(DashboardConfig(db=db, require_auth=False)) + client = TestClient(app) + + missing = client.post("/api/mcp", json={"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}) + invalid = client.post("/api/mcp", headers={"Authorization": "Bearer bad-token"}, json={"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}) + response = client.post( + "/api/mcp", + headers={"Authorization": f"Bearer {token}"}, + json={ + "jsonrpc": "2.0", + "id": 2, + "method": "tools/call", + "params": {"name": "list_knowledge", "arguments": {"repo": "gisce/erp"}}, + }, + ) + + assert missing.status_code == 401 + assert missing.json()["detail"] == "mcp_token_required" + assert invalid.status_code == 401 + assert invalid.json()["detail"] == "invalid_mcp_token" + assert response.status_code == 200 + assert response.json()["jsonrpc"] == "2.0" + assert response.json()["id"] == 2 + knowledge = json.loads(response.json()["result"]["content"][0]["text"]) + assert knowledge["rules"][0]["rule"] == "Prefer the HTTP MCP endpoint for remote agents." + + def test_dashboard_retry_requires_admin_and_requeues_retryable_job(tmp_path): db = tmp_path / "bridge.sqlite3" q = JobQueue(db)