diff --git a/pyproject.toml b/pyproject.toml
index 97fc8bd..a7415ba 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "uipath-dev"
-version = "0.0.71"
+version = "0.0.72"
description = "UiPath Developer Console"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
@@ -12,6 +12,7 @@ dependencies = [
"uvicorn[standard]>=0.40.0",
"uipath>=2.10.0, <2.11.0",
"openai",
+ "aiosqlite>=0.20.0",
]
classifiers = [
"Intended Audience :: Developers",
diff --git a/src/uipath/dev/server/app.py b/src/uipath/dev/server/app.py
index 2da16f6..6359d66 100644
--- a/src/uipath/dev/server/app.py
+++ b/src/uipath/dev/server/app.py
@@ -200,6 +200,10 @@ def _on_reload_done(t: asyncio.Task[None]) -> None:
app.include_router(evals_router, prefix="/api")
app.include_router(agent_router, prefix="/api")
app.include_router(files_router, prefix="/api")
+
+ from uipath.dev.server.routes.statedb import router as statedb_router
+
+ app.include_router(statedb_router, prefix="/api")
app.include_router(ws_router)
# Auto-build frontend if source is available and build is stale
diff --git a/src/uipath/dev/server/frontend/src/App.tsx b/src/uipath/dev/server/frontend/src/App.tsx
index 9adbc81..748f69b 100644
--- a/src/uipath/dev/server/frontend/src/App.tsx
+++ b/src/uipath/dev/server/frontend/src/App.tsx
@@ -27,6 +27,7 @@ import EvaluatorsView from "./components/evaluators/EvaluatorDetail";
import CreateEvaluatorView from "./components/evaluators/CreateEvaluatorView";
import ExplorerSidebar from "./components/explorer/ExplorerSidebar";
import FileEditor from "./components/explorer/FileEditor";
+import StateDbViewer from "./components/explorer/StateDbViewer";
import AgentChatSidebar from "./components/agent/AgentChatSidebar";
import { useExplorerStore } from "./store/useExplorerStore";
@@ -67,6 +68,7 @@ export default function App() {
evaluatorId,
evaluatorFilter,
explorerFile,
+ stateDbTable,
navigate,
} = useHashRoute();
@@ -342,6 +344,7 @@ export default function App() {
// --- Render main content based on section ---
const renderMainContent = () => {
if (section === "explorer") {
+ if (stateDbTable !== null) return ;
if (explorerTabs.length > 0 || explorerFile) return ;
return (
diff --git a/src/uipath/dev/server/frontend/src/api/statedb-client.ts b/src/uipath/dev/server/frontend/src/api/statedb-client.ts
new file mode 100644
index 0000000..cfd2556
--- /dev/null
+++ b/src/uipath/dev/server/frontend/src/api/statedb-client.ts
@@ -0,0 +1,54 @@
+import type {
+ StateDbTable,
+ StateDbTableData,
+ StateDbQueryResult,
+} from "../types/statedb";
+
+const BASE = "/api";
+
+async function fetchJson
(url: string, options?: RequestInit): Promise {
+ const res = await fetch(url, options);
+ if (!res.ok) {
+ let errorDetail;
+ try {
+ const body = await res.json();
+ errorDetail = body.detail || res.statusText;
+ } catch {
+ errorDetail = res.statusText;
+ }
+ const error = new Error(`HTTP ${res.status}`);
+ (error as any).detail = errorDetail;
+ (error as any).status = res.status;
+ throw error;
+ }
+ return res.json();
+}
+
+export async function getStateDbStatus(): Promise<{ exists: boolean }> {
+ return fetchJson(`${BASE}/statedb/status`);
+}
+
+export async function getStateDbTables(): Promise {
+ return fetchJson(`${BASE}/statedb/tables`);
+}
+
+export async function getStateDbTableData(
+ table: string,
+ limit = 100,
+ offset = 0,
+): Promise {
+ return fetchJson(
+ `${BASE}/statedb/tables/${encodeURIComponent(table)}?limit=${limit}&offset=${offset}`,
+ );
+}
+
+export async function executeStateDbQuery(
+ sql: string,
+ limit?: number,
+): Promise {
+ return fetchJson(`${BASE}/statedb/query`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ sql, limit }),
+ });
+}
diff --git a/src/uipath/dev/server/frontend/src/components/explorer/ExplorerSidebar.tsx b/src/uipath/dev/server/frontend/src/components/explorer/ExplorerSidebar.tsx
index 45aaab5..51b5e68 100644
--- a/src/uipath/dev/server/frontend/src/components/explorer/ExplorerSidebar.tsx
+++ b/src/uipath/dev/server/frontend/src/components/explorer/ExplorerSidebar.tsx
@@ -1,7 +1,9 @@
-import { useEffect, useCallback } from "react";
+import { useEffect, useCallback, useState } from "react";
import { useExplorerStore } from "../../store/useExplorerStore";
import { useHashRoute } from "../../hooks/useHashRoute";
import { listDirectory } from "../../api/explorer-client";
+import { getStateDbStatus, getStateDbTables } from "../../api/statedb-client";
+import type { StateDbTable } from "../../types/statedb";
function FileTreeNode({ path, name, type, depth }: {
path: string;
@@ -113,9 +115,114 @@ function FileTreeNode({ path, name, type, depth }: {
);
}
+function StateDbSection({ onDbMissing }: { onDbMissing: () => void }) {
+ const [tables, setTables] = useState([]);
+ const [expanded, setExpanded] = useState(true);
+ const [refreshing, setRefreshing] = useState(false);
+ const { stateDbTable, navigate } = useHashRoute();
+
+ const refresh = useCallback(() => {
+ setRefreshing(true);
+ getStateDbStatus()
+ .then(({ exists }) => {
+ if (!exists) {
+ onDbMissing();
+ return;
+ }
+ return getStateDbTables().then(setTables);
+ })
+ .catch(console.error)
+ .finally(() => setRefreshing(false));
+ }, [onDbMissing]);
+
+ useEffect(() => { refresh(); }, [refresh]);
+
+ return (
+
+ {/* Section header */}
+
+
+
+
+ {expanded && tables.map((t) => (
+
+ ))}
+
+ );
+}
+
export default function ExplorerSidebar() {
const rootChildren = useExplorerStore((s) => s.children[""]);
const { setChildren } = useExplorerStore();
+ const [hasStateDb, setHasStateDb] = useState(false);
+ const [filesExpanded, setFilesExpanded] = useState(true);
// Load root directory on mount
useEffect(() => {
@@ -126,22 +233,51 @@ export default function ExplorerSidebar() {
}
}, [rootChildren, setChildren]);
+ // Check if state.db exists
+ useEffect(() => {
+ getStateDbStatus()
+ .then(({ exists }) => setHasStateDb(exists))
+ .catch(() => setHasStateDb(false));
+ }, []);
+
return (
- {rootChildren ? (
- rootChildren.map((entry) => (
-
- ))
- ) : (
-
- Loading...
-
+ {hasStateDb && (
+
setHasStateDb(false)} />
+ )}
+ {/* Collapsible FILES section */}
+
+ {filesExpanded && (
+ rootChildren ? (
+ rootChildren.map((entry) => (
+
+ ))
+ ) : (
+
+ Loading...
+
+ )
)}
);
diff --git a/src/uipath/dev/server/frontend/src/components/explorer/StateDbViewer.tsx b/src/uipath/dev/server/frontend/src/components/explorer/StateDbViewer.tsx
new file mode 100644
index 0000000..870134a
--- /dev/null
+++ b/src/uipath/dev/server/frontend/src/components/explorer/StateDbViewer.tsx
@@ -0,0 +1,406 @@
+import { useState, useEffect, useCallback, useMemo, useRef } from "react";
+import { createPortal } from "react-dom";
+import hljs from "highlight.js/lib/core";
+import json from "highlight.js/lib/languages/json";
+import { getStateDbTableData, getStateDbTables, executeStateDbQuery } from "../../api/statedb-client";
+import { useHashRoute } from "../../hooks/useHashRoute";
+import type { StateDbColumn, StateDbTable } from "../../types/statedb";
+
+hljs.registerLanguage("json", json);
+
+const PAGE_SIZE = 100;
+
+function isObject(val: unknown): val is Record | unknown[] {
+ return val !== null && typeof val === "object";
+}
+
+function blobPreview(value: Record | unknown[]): string {
+ if (Array.isArray(value)) return `Array(${value.length})`;
+ const keys = Object.keys(value);
+ return keys.length <= 3
+ ? `{${keys.join(", ")}}`
+ : `{${keys.slice(0, 3).join(", ")}, \u2026} (${keys.length} keys)`;
+}
+
+function BlobModal({ value, onClose }: { value: Record | unknown[]; onClose: () => void }) {
+ const codeRef = useRef(null);
+ const formatted = useMemo(() => JSON.stringify(value, null, 2), [value]);
+ const highlighted = useMemo(() => hljs.highlight(formatted, { language: "json" }).value, [formatted]);
+
+ useEffect(() => {
+ const handleKey = (e: KeyboardEvent) => { if (e.key === "Escape") onClose(); };
+ document.addEventListener("keydown", handleKey);
+ return () => document.removeEventListener("keydown", handleKey);
+ }, [onClose]);
+
+ return createPortal(
+ { if (e.target === e.currentTarget) onClose(); }}
+ >
+
+
+
+ {Array.isArray(value) ? `Array (${value.length} items)` : `Object (${Object.keys(value).length} keys)`}
+
+
+
+
+
+
,
+ document.body,
+ );
+}
+
+function BlobCell({ value }: { value: Record | unknown[] }) {
+ const [open, setOpen] = useState(false);
+ const preview = blobPreview(value);
+
+ return (
+ <>
+
+ {open && setOpen(false)} />}
+ >
+ );
+}
+
+function TableListView() {
+ const [tables, setTables] = useState([]);
+ const [loading, setLoading] = useState(true);
+ const { navigate } = useHashRoute();
+
+ useEffect(() => {
+ setLoading(true);
+ getStateDbTables()
+ .then(setTables)
+ .catch(console.error)
+ .finally(() => setLoading(false));
+ }, []);
+
+ return (
+
+ {/* Header */}
+
+ State Database Tables
+
+ {loading ? (
+
+ Loading tables...
+
+ ) : tables.length === 0 ? (
+
+ No tables found in state.db
+
+ ) : (
+
+
+ {tables.map((t) => (
+
+ ))}
+
+
+ )}
+
+ );
+}
+
+export default function StateDbViewer({ table }: { table: string }) {
+ // Empty string means "show table list"
+ if (!table) return ;
+
+ return ;
+}
+
+function TableDataView({ table }: { table: string }) {
+ const { navigate } = useHashRoute();
+
+ const [columns, setColumns] = useState([]);
+ const [rows, setRows] = useState([]);
+ const [total, setTotal] = useState(0);
+ const [offset, setOffset] = useState(0);
+ const [loading, setLoading] = useState(true);
+ const [error, setError] = useState(null);
+
+ // Custom query state
+ const [sql, setSql] = useState("");
+ const [queryMode, setQueryMode] = useState(false);
+
+ const loadTable = useCallback((newOffset: number) => {
+ setLoading(true);
+ setError(null);
+ setQueryMode(false);
+ getStateDbTableData(table, PAGE_SIZE, newOffset)
+ .then((data) => {
+ setColumns(data.columns);
+ setRows(data.rows);
+ setTotal(data.total);
+ setOffset(newOffset);
+ })
+ .catch((err) => setError(err.detail || err.message))
+ .finally(() => setLoading(false));
+ }, [table]);
+
+ useEffect(() => {
+ loadTable(0);
+ setSql("");
+ }, [table, loadTable]);
+
+ const runQuery = useCallback(() => {
+ if (!sql.trim()) return;
+ setLoading(true);
+ setError(null);
+ setQueryMode(true);
+ executeStateDbQuery(sql)
+ .then((data) => {
+ setColumns(data.columns);
+ setRows(data.rows);
+ setTotal(data.row_count);
+ setOffset(0);
+ })
+ .catch((err) => setError(err.detail || err.message))
+ .finally(() => setLoading(false));
+ }, [sql]);
+
+ const handleKeyDown = (e: React.KeyboardEvent) => {
+ if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
+ e.preventDefault();
+ runQuery();
+ }
+ };
+
+ const hasPrev = !queryMode && offset > 0;
+ const hasNext = !queryMode && offset + PAGE_SIZE < total;
+ const currentPage = Math.floor(offset / PAGE_SIZE) + 1;
+ const totalPages = Math.max(1, Math.ceil(total / PAGE_SIZE));
+
+ return (
+
+ {/* Header */}
+
+
+
|
+
{table}
+
+ {total} rows
+
+
+
+ {/* Query bar */}
+
+ setSql(e.target.value)}
+ onKeyDown={handleKeyDown}
+ placeholder={`SELECT * FROM [${table}] WHERE ...`}
+ className="flex-1 text-[13px] px-3 py-1.5 rounded"
+ style={{
+ background: "var(--bg-primary)",
+ border: "1px solid var(--border)",
+ color: "var(--text-primary)",
+ outline: "none",
+ }}
+ />
+
+ {queryMode && (
+
+ )}
+
+
+ {/* Error */}
+ {error && (
+
+ {error}
+
+ )}
+
+ {/* Data grid */}
+
+ {loading ? (
+
+ Loading...
+
+ ) : rows.length === 0 ? (
+
+ No rows
+
+ ) : (
+
+
+
+ {columns.map((col) => (
+ |
+ {col.name}
+
+ {col.type}
+
+ |
+ ))}
+
+
+
+ {rows.map((row, i) => (
+ { e.currentTarget.style.background = "var(--bg-hover)"; }}
+ onMouseLeave={(e) => { e.currentTarget.style.background = "transparent"; }}
+ >
+ {row.map((cell, j) => (
+ |
+ {cell == null ? (
+ NULL
+ ) : isObject(cell) ? (
+
+ ) : (
+ String(cell)
+ )}
+ |
+ ))}
+
+ ))}
+
+
+ )}
+
+
+ {/* Pagination */}
+ {(hasPrev || hasNext) && !loading && (
+
+
+
+ Page {currentPage} of {totalPages}
+
+
+
+ )}
+
+ );
+}
diff --git a/src/uipath/dev/server/frontend/src/hooks/useHashRoute.ts b/src/uipath/dev/server/frontend/src/hooks/useHashRoute.ts
index 0836906..bb6e7aa 100644
--- a/src/uipath/dev/server/frontend/src/hooks/useHashRoute.ts
+++ b/src/uipath/dev/server/frontend/src/hooks/useHashRoute.ts
@@ -18,6 +18,7 @@ interface Route {
evaluatorCreateType: string | null;
evaluatorFilter: string | null;
explorerFile: string | null;
+ stateDbTable: string | null;
}
function parseHash(hash: string): Route {
@@ -38,6 +39,7 @@ function parseHash(hash: string): Route {
evaluatorCreateType: null,
evaluatorFilter: null,
explorerFile: null,
+ stateDbTable: null,
};
if (!path || path === "new" || path === "debug" || path === "debug/new") {
@@ -124,6 +126,17 @@ function parseHash(hash: string): Route {
// --- Explorer section ---
+ // #/explorer/statedb/:tableName
+ const stateDbTable = path.match(/^explorer\/statedb\/(.+)$/);
+ if (stateDbTable) {
+ return { ...base, section: "explorer", stateDbTable: decodeURIComponent(stateDbTable[1]) };
+ }
+
+ // #/explorer/statedb (no table selected)
+ if (path === "explorer/statedb") {
+ return { ...base, section: "explorer", stateDbTable: "" };
+ }
+
// #/explorer/file/:path
const explorerFile = path.match(/^explorer\/file\/(.+)$/);
if (explorerFile) {
diff --git a/src/uipath/dev/server/frontend/src/types/statedb.ts b/src/uipath/dev/server/frontend/src/types/statedb.ts
new file mode 100644
index 0000000..f96cce3
--- /dev/null
+++ b/src/uipath/dev/server/frontend/src/types/statedb.ts
@@ -0,0 +1,21 @@
+export interface StateDbTable {
+ name: string;
+ row_count: number;
+}
+
+export interface StateDbColumn {
+ name: string;
+ type: string;
+}
+
+export interface StateDbTableData {
+ columns: StateDbColumn[];
+ rows: unknown[][];
+ total: number;
+}
+
+export interface StateDbQueryResult {
+ columns: StateDbColumn[];
+ rows: unknown[][];
+ row_count: number;
+}
diff --git a/src/uipath/dev/server/frontend/tsconfig.tsbuildinfo b/src/uipath/dev/server/frontend/tsconfig.tsbuildinfo
index dd84d5c..927b5e6 100644
--- a/src/uipath/dev/server/frontend/tsconfig.tsbuildinfo
+++ b/src/uipath/dev/server/frontend/tsconfig.tsbuildinfo
@@ -1 +1 @@
-{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/api/agent-client.ts","./src/api/auth.ts","./src/api/client.ts","./src/api/eval-client.ts","./src/api/explorer-client.ts","./src/api/websocket.ts","./src/components/agent/agentchatsidebar.tsx","./src/components/agent/agentmessage.tsx","./src/components/agent/agentstatepanel.tsx","./src/components/agent/diffview.tsx","./src/components/agent/questioncard.tsx","./src/components/chat/chatinput.tsx","./src/components/chat/chatinterrupt.tsx","./src/components/chat/chatmessage.tsx","./src/components/chat/chatpanel.tsx","./src/components/debug/debugcontrols.tsx","./src/components/evals/createevalsetview.tsx","./src/components/evals/evalrunresults.tsx","./src/components/evals/evalsetdetail.tsx","./src/components/evals/evalssidebar.tsx","./src/components/evaluators/createevaluatorview.tsx","./src/components/evaluators/evaluatordetail.tsx","./src/components/evaluators/evaluatorssidebar.tsx","./src/components/explorer/explorersidebar.tsx","./src/components/explorer/fileeditor.tsx","./src/components/graph/graphpanel.tsx","./src/components/graph/edges/elkedge.tsx","./src/components/graph/nodes/defaultnode.tsx","./src/components/graph/nodes/endnode.tsx","./src/components/graph/nodes/groupnode.tsx","./src/components/graph/nodes/modelnode.tsx","./src/components/graph/nodes/startnode.tsx","./src/components/graph/nodes/toolnode.tsx","./src/components/layout/activitybar.tsx","./src/components/layout/debugsidebar.tsx","./src/components/layout/sidepanel.tsx","./src/components/layout/sidebar.tsx","./src/components/layout/statusbar.tsx","./src/components/logs/logpanel.tsx","./src/components/runs/addtoevalmodal.tsx","./src/components/runs/newrunpanel.tsx","./src/components/runs/rundetailspanel.tsx","./src/components/runs/runeventspanel.tsx","./src/components/runs/runhistoryitem.tsx","./src/components/runs/setupview.tsx","./src/components/shared/datasection.tsx","./src/components/shared/jsonhighlight.tsx","./src/components/shared/reloadtoast.tsx","./src/components/shared/toastcontainer.tsx","./src/components/traces/spandetails.tsx","./src/components/traces/tracetree.tsx","./src/components/traces/waterfallview.tsx","./src/hooks/usehashroute.ts","./src/hooks/useismobile.ts","./src/store/useagentstore.ts","./src/store/useauthstore.ts","./src/store/useconfigstore.ts","./src/store/useevalstore.ts","./src/store/useexplorerstore.ts","./src/store/userunstore.ts","./src/store/usetheme.ts","./src/store/usetoaststore.ts","./src/store/usewebsocket.ts","./src/types/agent.ts","./src/types/eval.ts","./src/types/explorer.ts","./src/types/graph.ts","./src/types/run.ts","./src/types/ws.ts"],"version":"5.7.3"}
\ No newline at end of file
+{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/api/agent-client.ts","./src/api/auth.ts","./src/api/client.ts","./src/api/eval-client.ts","./src/api/explorer-client.ts","./src/api/statedb-client.ts","./src/api/websocket.ts","./src/components/agent/agentchatsidebar.tsx","./src/components/agent/agentmessage.tsx","./src/components/agent/agentstatepanel.tsx","./src/components/agent/diffview.tsx","./src/components/agent/questioncard.tsx","./src/components/chat/chatinput.tsx","./src/components/chat/chatinterrupt.tsx","./src/components/chat/chatmessage.tsx","./src/components/chat/chatpanel.tsx","./src/components/debug/debugcontrols.tsx","./src/components/evals/createevalsetview.tsx","./src/components/evals/evalrunresults.tsx","./src/components/evals/evalsetdetail.tsx","./src/components/evals/evalssidebar.tsx","./src/components/evaluators/createevaluatorview.tsx","./src/components/evaluators/evaluatordetail.tsx","./src/components/evaluators/evaluatorssidebar.tsx","./src/components/explorer/explorersidebar.tsx","./src/components/explorer/fileeditor.tsx","./src/components/explorer/statedbviewer.tsx","./src/components/graph/graphpanel.tsx","./src/components/graph/edges/elkedge.tsx","./src/components/graph/nodes/defaultnode.tsx","./src/components/graph/nodes/endnode.tsx","./src/components/graph/nodes/groupnode.tsx","./src/components/graph/nodes/modelnode.tsx","./src/components/graph/nodes/startnode.tsx","./src/components/graph/nodes/toolnode.tsx","./src/components/layout/activitybar.tsx","./src/components/layout/debugsidebar.tsx","./src/components/layout/sidepanel.tsx","./src/components/layout/sidebar.tsx","./src/components/layout/statusbar.tsx","./src/components/logs/logpanel.tsx","./src/components/runs/addtoevalmodal.tsx","./src/components/runs/newrunpanel.tsx","./src/components/runs/rundetailspanel.tsx","./src/components/runs/runeventspanel.tsx","./src/components/runs/runhistoryitem.tsx","./src/components/runs/setupview.tsx","./src/components/shared/datasection.tsx","./src/components/shared/jsonhighlight.tsx","./src/components/shared/reloadtoast.tsx","./src/components/shared/toastcontainer.tsx","./src/components/traces/spandetails.tsx","./src/components/traces/tracetree.tsx","./src/components/traces/waterfallview.tsx","./src/hooks/usehashroute.ts","./src/hooks/useismobile.ts","./src/store/useagentstore.ts","./src/store/useauthstore.ts","./src/store/useconfigstore.ts","./src/store/useevalstore.ts","./src/store/useexplorerstore.ts","./src/store/userunstore.ts","./src/store/usetheme.ts","./src/store/usetoaststore.ts","./src/store/usewebsocket.ts","./src/types/agent.ts","./src/types/eval.ts","./src/types/explorer.ts","./src/types/graph.ts","./src/types/run.ts","./src/types/statedb.ts","./src/types/ws.ts"],"version":"5.7.3"}
\ No newline at end of file
diff --git a/src/uipath/dev/server/routes/statedb.py b/src/uipath/dev/server/routes/statedb.py
new file mode 100644
index 0000000..4567c40
--- /dev/null
+++ b/src/uipath/dev/server/routes/statedb.py
@@ -0,0 +1,223 @@
+"""State database explorer API routes."""
+
+from __future__ import annotations
+
+import base64
+import json
+import zlib
+from pathlib import Path
+from typing import Any
+
+import aiosqlite
+from fastapi import APIRouter, HTTPException, Query
+from pydantic import BaseModel, Field
+
+try:
+ import msgpack # type: ignore[import-untyped]
+
+ _has_msgpack = True
+except ImportError:
+ _has_msgpack = False
+
+router = APIRouter(tags=["statedb"])
+
+DB_PATH = Path.cwd() / "__uipath" / "state.db"
+
+
+def _quote_ident(name: str) -> str:
+ """Quote a SQLite identifier safely using double quotes."""
+ return '"' + name.replace('"', '""') + '"'
+
+
+def _db_uri() -> str:
+ """Return a read-only SQLite URI for the state database."""
+ # Forward slashes required for SQLite URI on all platforms
+ return f"file:{DB_PATH.as_posix()}?mode=ro"
+
+
+def _try_decode_blob(val: bytes) -> Any:
+ """Try to decode a BLOB using common serialization formats.
+
+ Attempts (in order): JSON, msgpack, zlib+JSON, zlib+msgpack,
+ UTF-8 string, base64 fallback.
+ """
+ # 1. Raw JSON
+ try:
+ return json.loads(val)
+ except (json.JSONDecodeError, UnicodeDecodeError):
+ pass
+
+ # 2. msgpack
+ if _has_msgpack:
+ try:
+ return msgpack.unpackb(val, raw=False)
+ except Exception:
+ pass
+
+ # 3. zlib + JSON
+ try:
+ decompressed = zlib.decompress(val)
+ return json.loads(decompressed)
+ except Exception:
+ pass
+
+ # 4. zlib + msgpack
+ if _has_msgpack:
+ try:
+ decompressed = zlib.decompress(val)
+ return msgpack.unpackb(decompressed, raw=False)
+ except Exception:
+ pass
+
+ # 5. UTF-8 string
+ try:
+ return val.decode("utf-8")
+ except UnicodeDecodeError:
+ pass
+
+ # 6. base64 fallback
+ return f"base64:{base64.b64encode(val).decode('ascii')}"
+
+
+def _deep_sanitize(val: Any) -> Any:
+ """Recursively make a value JSON-serializable.
+
+ Handles bytes (via blob decoder), msgpack ExtType, and nested
+ dicts/lists that may contain non-serializable leaves.
+ """
+ if isinstance(val, bytes):
+ decoded = _try_decode_blob(val)
+ # The decoded result may itself contain non-serializable values
+ return _deep_sanitize(decoded) if not isinstance(decoded, str) else decoded
+ if isinstance(val, dict):
+ return {str(k): _deep_sanitize(v) for k, v in val.items()}
+ if isinstance(val, (list, tuple)):
+ return [_deep_sanitize(v) for v in val]
+ # msgpack ExtType or any other unknown type → try blob decode on its data
+ if _has_msgpack and isinstance(val, msgpack.ExtType):
+ decoded = _try_decode_blob(val.data)
+ return _deep_sanitize(decoded) if not isinstance(decoded, str) else decoded
+ # Primitives (str, int, float, bool, None) pass through
+ if isinstance(val, (str, int, float, bool, type(None))):
+ return val
+ # Catch-all for unexpected types
+ return str(val)
+
+
+def _sanitize_rows(rows: Any) -> list[list[Any]]:
+ """Sanitize all cell values in a list of rows."""
+ return [[_deep_sanitize(cell) for cell in row] for row in rows]
+
+
+async def _connect() -> aiosqlite.Connection:
+ """Open a read-only connection to the state database."""
+ if not DB_PATH.is_file():
+ raise HTTPException(status_code=404, detail="state.db not found")
+ return await aiosqlite.connect(_db_uri(), uri=True)
+
+
+@router.get("/statedb/status")
+async def statedb_status() -> dict[str, bool]:
+ """Check whether the state database file exists."""
+ return {"exists": DB_PATH.is_file()}
+
+
+@router.get("/statedb/tables")
+async def statedb_tables() -> list[dict[str, Any]]:
+ """List all tables with their row counts."""
+ db = await _connect()
+ try:
+ cursor = await db.execute(
+ "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name"
+ )
+ tables = await cursor.fetchall()
+ result: list[dict[str, Any]] = []
+ for (name,) in tables:
+ cnt = await db.execute(f"SELECT COUNT(*) FROM {_quote_ident(name)}") # noqa: S608
+ cnt_row = await cnt.fetchone()
+ row_count = cnt_row[0] if cnt_row else 0
+ result.append({"name": name, "row_count": row_count})
+ return result
+ finally:
+ await db.close()
+
+
+@router.get("/statedb/tables/{table}")
+async def statedb_table_data(
+ table: str,
+ limit: int = Query(default=100, ge=1, le=1000),
+ offset: int = Query(default=0, ge=0),
+) -> dict[str, Any]:
+ """Return paginated rows for a single table."""
+ db = await _connect()
+ try:
+ # Verify table exists
+ cursor = await db.execute(
+ "SELECT name FROM sqlite_master WHERE type='table' AND name=?",
+ (table,),
+ )
+ if not await cursor.fetchone():
+ raise HTTPException(status_code=404, detail=f"Table '{table}' not found")
+
+ # Total row count
+ quoted = _quote_ident(table)
+
+ cnt = await db.execute(f"SELECT COUNT(*) FROM {quoted}") # noqa: S608
+ cnt_row = await cnt.fetchone()
+ total = cnt_row[0] if cnt_row else 0
+
+ # Column info
+ pragma = await db.execute(f"PRAGMA table_info({quoted})")
+ cols_raw = await pragma.fetchall()
+ columns = [{"name": row[1], "type": row[2] or "TEXT"} for row in cols_raw]
+
+ # Data
+ data = await db.execute(
+ f"SELECT * FROM {quoted} LIMIT ? OFFSET ?", # noqa: S608
+ (limit, offset),
+ )
+ rows = _sanitize_rows(await data.fetchall())
+
+ return {"columns": columns, "rows": rows, "total": total}
+ finally:
+ await db.close()
+
+
+class QueryBody(BaseModel):
+ """Request body for custom SQL queries."""
+
+ sql: str
+ limit: int | None = Field(default=None, ge=1, le=10000)
+
+
+@router.post("/statedb/query")
+async def statedb_query(body: QueryBody) -> dict[str, Any]:
+ """Execute a read-only SQL query against the state database."""
+ # Normalize: trim whitespace and strip trailing semicolons
+ sql = body.sql.strip().rstrip("; \t\r\n")
+ upper_sql = sql.upper()
+ # Allow common read-only forms: SELECT, WITH (CTEs), and EXPLAIN
+ allowed_prefixes = ("SELECT", "WITH", "EXPLAIN")
+ if not upper_sql.startswith(allowed_prefixes):
+ raise HTTPException(
+ status_code=400, detail="Only read-only SQL statements are allowed"
+ )
+
+ limit = min(body.limit or 500, 10000)
+ # Wrap in LIMIT if the user didn't include one
+ if "LIMIT" not in upper_sql:
+ sql = f"{sql} LIMIT {limit}"
+
+ db = await _connect()
+ try:
+ cursor = await db.execute(sql)
+ desc = cursor.description
+ columns: list[dict[str, str]] = [
+ {"name": d[0], "type": "TEXT"} for d in (desc if desc else [])
+ ]
+ rows = _sanitize_rows(await cursor.fetchall())
+ return {"columns": columns, "rows": rows, "row_count": len(rows)}
+ except Exception as exc:
+ raise HTTPException(status_code=400, detail=str(exc)) from exc
+ finally:
+ await db.close()
diff --git a/src/uipath/dev/server/static/assets/ChatPanel-22tyOge8.js b/src/uipath/dev/server/static/assets/ChatPanel-CGRbCuiU.js
similarity index 98%
rename from src/uipath/dev/server/static/assets/ChatPanel-22tyOge8.js
rename to src/uipath/dev/server/static/assets/ChatPanel-CGRbCuiU.js
index f734b43..0e6d5c0 100644
--- a/src/uipath/dev/server/static/assets/ChatPanel-22tyOge8.js
+++ b/src/uipath/dev/server/static/assets/ChatPanel-CGRbCuiU.js
@@ -1,2 +1,2 @@
-import{j as e,a as y}from"./vendor-react-N5xbSGOh.js";import{M,r as T,a as O,u as S}from"./index-B6Qbh6OY.js";import"./vendor-reactflow-CxoS0d5s.js";const J={user:{label:"You",color:"var(--info)"},tool:{label:"Tool",color:"var(--warning)"},assistant:{label:"AI",color:"var(--success)"}};function A({message:t,onToolCallClick:r,toolCallIndices:o}){const i=t.role==="user",l=t.tool_calls&&t.tool_calls.length>0,a=J[i?"user":l?"tool":"assistant"];return e.jsxs("div",{className:"py-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[e.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:a.color}}),e.jsx("span",{className:"text-[11px] font-semibold",style:{color:a.color},children:a.label})]}),t.content&&(i?e.jsx("div",{className:"text-sm leading-relaxed pl-2.5 max-w-prose",style:{color:"var(--text-primary)"},children:t.content}):e.jsx("div",{className:"text-sm leading-relaxed pl-2.5 max-w-prose chat-markdown",style:{color:"var(--text-secondary)"},children:e.jsx(M,{remarkPlugins:[O],rehypePlugins:[T],children:t.content})})),t.tool_calls&&t.tool_calls.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-1 pl-2.5",children:t.tool_calls.map((p,c)=>e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-mono px-2 py-1 rounded cursor-pointer hover:brightness-125",style:{background:"var(--bg-primary)",border:"1px solid var(--border)",color:p.has_result?"var(--success)":"var(--text-muted)"},onClick:()=>r==null?void 0:r(p.name,(o==null?void 0:o[c])??0),children:[p.has_result?"✓":"•"," ",p.name]},`${p.name}-${c}`))})]})}function L({onSend:t,disabled:r,placeholder:o}){const[i,l]=y.useState(""),u=()=>{const c=i.trim();c&&(t(c),l(""))},a=c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),u())},p=!r&&i.trim().length>0;return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-t",style:{borderColor:"var(--border)"},children:[e.jsx("input",{value:i,onChange:c=>l(c.target.value),onKeyDown:a,disabled:r,placeholder:o??"Message...",className:"flex-1 bg-transparent text-sm py-1 disabled:opacity-40 placeholder:text-[var(--text-muted)]",style:{color:"var(--text-primary)"}}),e.jsx("button",{onClick:u,disabled:!p,className:"text-xs font-semibold px-3 py-1.5 rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed","aria-label":"Send message",style:{color:p?"var(--accent)":"var(--text-muted)",background:"transparent"},onMouseEnter:c=>{p&&(c.currentTarget.style.background="color-mix(in srgb, var(--accent) 10%, transparent)")},onMouseLeave:c=>{c.currentTarget.style.background="transparent"},children:"Send"})]})}function $(t){if(typeof t!="object"||t===null)return!1;const r=t;return typeof r.properties=="object"&&r.properties!==null&&Object.keys(r.properties).length>0}const f={color:"var(--text-primary)",border:"1px solid var(--border)",background:"var(--bg-primary)"},j="w-full text-[11px] font-mono py-1 px-2 rounded focus:outline-none";function R({name:t,prop:r,value:o,onChange:i}){const l=e.jsxs("label",{className:"text-[11px] font-medium block mb-1",style:{color:"var(--text-muted)"},children:[t,r.description&&e.jsxs("span",{className:"font-normal normal-case tracking-normal ml-1",style:{color:"var(--text-muted)",opacity:.7},children:["— ",r.description]})]});if(r.enum&&Array.isArray(r.enum))return e.jsxs("div",{children:[l,e.jsx("select",{value:String(o??""),onChange:a=>i(a.target.value),className:j,style:f,children:r.enum.map(a=>e.jsx("option",{value:String(a),children:String(a)},String(a)))})]});if(r.type==="boolean")return e.jsxs("div",{children:[l,e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-1",children:[e.jsx("input",{type:"checkbox",checked:!!o,onChange:a=>i(a.target.checked),className:"accent-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-secondary)"},children:o?"true":"false"})]})]});if(r.type==="number"||r.type==="integer")return e.jsxs("div",{children:[l,e.jsx("input",{type:"number",value:o==null?"":String(o),onChange:a=>i(a.target.value===""?null:Number(a.target.value)),step:r.type==="integer"?1:"any",className:j,style:f})]});if(r.type==="object"||r.type==="array"){const a=typeof o=="string"?o:JSON.stringify(o??null,null,2);return e.jsxs("div",{children:[l,e.jsx("textarea",{value:a,onChange:p=>i(p.target.value),rows:3,className:`${j} resize-y`,style:f})]})}const u=o==null?"":String(o);return u.length>100||u.includes(`
+import{j as e,a as y}from"./vendor-react-VzyiTEsu.js";import{M,r as T,a as O,u as S}from"./index-6OKj3VFw.js";import"./vendor-reactflow-B_2yZyR4.js";const J={user:{label:"You",color:"var(--info)"},tool:{label:"Tool",color:"var(--warning)"},assistant:{label:"AI",color:"var(--success)"}};function A({message:t,onToolCallClick:r,toolCallIndices:o}){const i=t.role==="user",l=t.tool_calls&&t.tool_calls.length>0,a=J[i?"user":l?"tool":"assistant"];return e.jsxs("div",{className:"py-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[e.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:a.color}}),e.jsx("span",{className:"text-[11px] font-semibold",style:{color:a.color},children:a.label})]}),t.content&&(i?e.jsx("div",{className:"text-sm leading-relaxed pl-2.5 max-w-prose",style:{color:"var(--text-primary)"},children:t.content}):e.jsx("div",{className:"text-sm leading-relaxed pl-2.5 max-w-prose chat-markdown",style:{color:"var(--text-secondary)"},children:e.jsx(M,{remarkPlugins:[O],rehypePlugins:[T],children:t.content})})),t.tool_calls&&t.tool_calls.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-1 pl-2.5",children:t.tool_calls.map((p,c)=>e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-mono px-2 py-1 rounded cursor-pointer hover:brightness-125",style:{background:"var(--bg-primary)",border:"1px solid var(--border)",color:p.has_result?"var(--success)":"var(--text-muted)"},onClick:()=>r==null?void 0:r(p.name,(o==null?void 0:o[c])??0),children:[p.has_result?"✓":"•"," ",p.name]},`${p.name}-${c}`))})]})}function L({onSend:t,disabled:r,placeholder:o}){const[i,l]=y.useState(""),u=()=>{const c=i.trim();c&&(t(c),l(""))},a=c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),u())},p=!r&&i.trim().length>0;return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-t",style:{borderColor:"var(--border)"},children:[e.jsx("input",{value:i,onChange:c=>l(c.target.value),onKeyDown:a,disabled:r,placeholder:o??"Message...",className:"flex-1 bg-transparent text-sm py-1 disabled:opacity-40 placeholder:text-[var(--text-muted)]",style:{color:"var(--text-primary)"}}),e.jsx("button",{onClick:u,disabled:!p,className:"text-xs font-semibold px-3 py-1.5 rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed","aria-label":"Send message",style:{color:p?"var(--accent)":"var(--text-muted)",background:"transparent"},onMouseEnter:c=>{p&&(c.currentTarget.style.background="color-mix(in srgb, var(--accent) 10%, transparent)")},onMouseLeave:c=>{c.currentTarget.style.background="transparent"},children:"Send"})]})}function $(t){if(typeof t!="object"||t===null)return!1;const r=t;return typeof r.properties=="object"&&r.properties!==null&&Object.keys(r.properties).length>0}const f={color:"var(--text-primary)",border:"1px solid var(--border)",background:"var(--bg-primary)"},j="w-full text-[11px] font-mono py-1 px-2 rounded focus:outline-none";function R({name:t,prop:r,value:o,onChange:i}){const l=e.jsxs("label",{className:"text-[11px] font-medium block mb-1",style:{color:"var(--text-muted)"},children:[t,r.description&&e.jsxs("span",{className:"font-normal normal-case tracking-normal ml-1",style:{color:"var(--text-muted)",opacity:.7},children:["— ",r.description]})]});if(r.enum&&Array.isArray(r.enum))return e.jsxs("div",{children:[l,e.jsx("select",{value:String(o??""),onChange:a=>i(a.target.value),className:j,style:f,children:r.enum.map(a=>e.jsx("option",{value:String(a),children:String(a)},String(a)))})]});if(r.type==="boolean")return e.jsxs("div",{children:[l,e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-1",children:[e.jsx("input",{type:"checkbox",checked:!!o,onChange:a=>i(a.target.checked),className:"accent-[var(--accent)]"}),e.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-secondary)"},children:o?"true":"false"})]})]});if(r.type==="number"||r.type==="integer")return e.jsxs("div",{children:[l,e.jsx("input",{type:"number",value:o==null?"":String(o),onChange:a=>i(a.target.value===""?null:Number(a.target.value)),step:r.type==="integer"?1:"any",className:j,style:f})]});if(r.type==="object"||r.type==="array"){const a=typeof o=="string"?o:JSON.stringify(o??null,null,2);return e.jsxs("div",{children:[l,e.jsx("textarea",{value:a,onChange:p=>i(p.target.value),rows:3,className:`${j} resize-y`,style:f})]})}const u=o==null?"":String(o);return u.length>100||u.includes(`
`)?e.jsxs("div",{children:[l,e.jsx("textarea",{value:u,onChange:a=>i(a.target.value),rows:3,className:`${j} resize-y`,style:f})]}):e.jsxs("div",{children:[l,e.jsx("input",{type:"text",value:u,onChange:a=>i(a.target.value),className:j,style:f})]})}function _({label:t,color:r,onClick:o}){return e.jsx("button",{onClick:o,className:"text-xs font-semibold px-3 py-1.5 rounded cursor-pointer transition-colors",style:{background:`color-mix(in srgb, var(--${r}) 15%, var(--bg-secondary))`,color:`var(--${r})`,border:`1px solid color-mix(in srgb, var(--${r}) 30%, var(--border))`},onMouseEnter:i=>{i.currentTarget.style.background=`color-mix(in srgb, var(--${r}) 25%, var(--bg-secondary))`},onMouseLeave:i=>{i.currentTarget.style.background=`color-mix(in srgb, var(--${r}) 15%, var(--bg-secondary))`},children:t})}function F({interrupt:t,onRespond:r}){const[o,i]=y.useState(""),[l,u]=y.useState(!1),[a,p]=y.useState({}),[c,N]=y.useState(""),[k,h]=y.useState(null),g=t.input_schema,b=$(g),C=y.useCallback(()=>{const s=typeof t.input_value=="object"&&t.input_value!==null?t.input_value:{};if(b){const d={...s};for(const m of Object.keys(g.properties))m in d||(d[m]=null);const x=g.properties;for(const[m,v]of Object.entries(x))(v.type==="object"||v.type==="array")&&typeof d[m]!="string"&&(d[m]=JSON.stringify(d[m]??null,null,2));p(d)}else N(typeof t.input_value=="string"?t.input_value:JSON.stringify(t.input_value??null,null,2));h(null),u(!0)},[t.input_value,b,g]),E=()=>{u(!1),h(null)},w=()=>{if(b){const s={},d=g.properties;for(const[x,m]of Object.entries(a)){const v=d[x];if(((v==null?void 0:v.type)==="object"||(v==null?void 0:v.type)==="array")&&typeof m=="string")try{s[x]=JSON.parse(m)}catch{h(`Invalid JSON for "${x}"`);return}else s[x]=m}r({approved:!0,input:s})}else try{const s=JSON.parse(c);r({approved:!0,input:s})}catch{h("Invalid JSON");return}},n=y.useCallback((s,d)=>{p(x=>({...x,[s]:d}))},[]);return t.interrupt_type==="tool_call_confirmation"?e.jsxs("div",{className:"mx-3 my-2 rounded-lg overflow-hidden",style:{border:"1px solid color-mix(in srgb, var(--warning) 40%, var(--border))"},children:[e.jsxs("div",{className:"px-3 py-2 flex items-center gap-2",style:{background:"color-mix(in srgb, var(--warning) 10%, var(--bg-secondary))"},children:[e.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--warning)"},children:l?"Edit Arguments":"Action Required"}),t.tool_name&&e.jsx("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded",style:{background:"color-mix(in srgb, var(--warning) 15%, var(--bg-secondary))",color:"var(--text-primary)"},children:t.tool_name}),!l&&(t.input_value!=null||b)&&e.jsx("button",{onClick:C,className:"ml-auto p-1.5 rounded cursor-pointer transition-colors",style:{color:"var(--text-muted)"},"aria-label":"Edit arguments",onMouseEnter:s=>{s.currentTarget.style.color="var(--warning)"},onMouseLeave:s=>{s.currentTarget.style.color="var(--text-muted)"},title:"Edit arguments",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),e.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})})]}),l?e.jsxs("div",{className:"px-3 py-2 space-y-3 overflow-y-auto",style:{background:"var(--bg-secondary)",maxHeight:300},children:[b?Object.entries(g.properties).map(([s,d])=>e.jsx(R,{name:s,prop:d,value:a[s],onChange:x=>n(s,x)},s)):e.jsx("textarea",{value:c,onChange:s=>{N(s.target.value),h(null)},rows:8,className:"w-full text-[11px] font-mono py-1 px-2 rounded focus:outline-none resize-y",style:f}),k&&e.jsx("p",{className:"text-[11px]",style:{color:"var(--error)"},children:k})]}):t.input_value!=null&&e.jsx("pre",{className:"px-3 py-2 text-[11px] font-mono whitespace-pre-wrap break-words overflow-y-auto leading-normal",style:{background:"var(--bg-secondary)",color:"var(--text-secondary)",maxHeight:200},children:typeof t.input_value=="string"?t.input_value:JSON.stringify(t.input_value,null,2)}),e.jsx("div",{className:"flex items-center gap-2 px-3 py-2",style:{background:"var(--bg-secondary)",borderTop:"1px solid var(--border)"},children:l?e.jsxs(e.Fragment,{children:[e.jsx(_,{label:"Approve",color:"success",onClick:w}),e.jsx(_,{label:"Cancel",color:"text-muted",onClick:E})]}):e.jsxs(e.Fragment,{children:[e.jsx(_,{label:"Approve",color:"success",onClick:()=>r({approved:!0})}),e.jsx(_,{label:"Reject",color:"error",onClick:()=>r({approved:!1})})]})})]}):e.jsxs("div",{className:"mx-3 my-2 rounded-lg overflow-hidden",style:{border:"1px solid color-mix(in srgb, var(--accent) 40%, var(--border))"},children:[e.jsx("div",{className:"px-3 py-2",style:{background:"color-mix(in srgb, var(--accent) 10%, var(--bg-secondary))"},children:e.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--accent)"},children:"Input Required"})}),t.content!=null&&e.jsx("div",{className:"px-3 py-2 text-sm leading-relaxed",style:{background:"var(--bg-secondary)",color:"var(--text-secondary)"},children:typeof t.content=="string"?t.content:JSON.stringify(t.content,null,2)}),e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{background:"var(--bg-secondary)",borderTop:"1px solid var(--border)"},children:[e.jsx("input",{value:o,onChange:s=>i(s.target.value),onKeyDown:s=>{s.key==="Enter"&&!s.shiftKey&&o.trim()&&(s.preventDefault(),r({response:o.trim()}))},placeholder:"Type your response...",className:"flex-1 bg-transparent text-sm py-1 placeholder:text-[var(--text-muted)]",style:{color:"var(--text-primary)"}}),e.jsx("button",{onClick:()=>{o.trim()&&r({response:o.trim()})},disabled:!o.trim(),className:"text-xs font-semibold px-3 py-1.5 rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed",style:{color:o.trim()?"var(--accent)":"var(--text-muted)",background:"transparent"},children:"Send"})]})]})}function I({messages:t,runId:r,runStatus:o,ws:i}){const l=y.useRef(null),u=y.useRef(!0),a=S(n=>n.addLocalChatMessage),p=S(n=>n.setFocusedSpan),c=S(n=>n.activeInterrupt[r]??null),N=S(n=>n.setActiveInterrupt),k=y.useMemo(()=>{const n=new Map,s=new Map;for(const d of t)if(d.tool_calls){const x=[];for(const m of d.tool_calls){const v=s.get(m.name)??0;x.push(v),s.set(m.name,v+1)}n.set(d.message_id,x)}return n},[t]),[h,g]=y.useState(!1),b=()=>{const n=l.current;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight<40;u.current=s,g(n.scrollTop>100)};y.useEffect(()=>{u.current&&l.current&&(l.current.scrollTop=l.current.scrollHeight)});const C=n=>{u.current=!0,a(r,{message_id:`local-${Date.now()}`,role:"user",content:n}),i.sendChatMessage(r,n)},E=n=>{u.current=!0,i.sendInterruptResponse(r,n),N(r,null)},w=o==="running"||!!c;return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"relative flex-1 overflow-hidden",children:[e.jsxs("div",{ref:l,onScroll:b,className:"h-full overflow-y-auto px-3 py-2 space-y-0.5",children:[t.length===0&&e.jsx("p",{className:"text-[var(--text-muted)] text-sm text-center py-6",children:"No messages yet"}),t.map(n=>e.jsx(A,{message:n,toolCallIndices:k.get(n.message_id),onToolCallClick:(s,d)=>p({name:s,index:d})},n.message_id)),c&&e.jsx(F,{interrupt:c,onRespond:E})]}),h&&e.jsx("button",{onClick:()=>{var n;return(n=l.current)==null?void 0:n.scrollTo({top:0,behavior:"smooth"})},className:"absolute top-2 right-3 w-6 h-6 flex items-center justify-center rounded-full cursor-pointer transition-opacity opacity-70 hover:opacity-100",style:{background:"var(--bg-tertiary)",color:"var(--text-primary)"},title:"Scroll to top",children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"18 15 12 9 6 15"})})})]}),e.jsx(L,{onSend:C,disabled:w,placeholder:c?"Respond to the interrupt above...":w?"Waiting for response...":"Message..."})]})}export{I as default};
diff --git a/src/uipath/dev/server/static/assets/index-6OKj3VFw.js b/src/uipath/dev/server/static/assets/index-6OKj3VFw.js
new file mode 100644
index 0000000..6ef3f01
--- /dev/null
+++ b/src/uipath/dev/server/static/assets/index-6OKj3VFw.js
@@ -0,0 +1,121 @@
+const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-elk-BkmlSRbk.js","assets/vendor-react-VzyiTEsu.js","assets/ChatPanel-CGRbCuiU.js","assets/vendor-reactflow-B_2yZyR4.js","assets/vendor-reactflow-B5DZHykP.css"])))=>i.map(i=>d[i]);
+var ql=Object.defineProperty;var Vl=(e,t,n)=>t in e?ql(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Rt=(e,t,n)=>Vl(e,typeof t!="symbol"?t+"":t,n);import{W as Mn,a as E,j as o,w as Yl,F as Xl,g as is,b as Zl,d as Jl}from"./vendor-react-VzyiTEsu.js";import{H as xt,P as bt,B as Ql,M as ec,u as tc,a as nc,R as rc,b as sc,C as oc,c as ic,d as ac}from"./vendor-reactflow-B_2yZyR4.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();const Ws=e=>{let t;const n=new Set,r=(u,d)=>{const p=typeof u=="function"?u(t):u;if(!Object.is(p,t)){const m=t;t=d??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(f=>f(t,m))}},s=()=>t,l={setState:r,getState:s,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u))},c=t=e(r,s,l);return l},lc=(e=>e?Ws(e):Ws),cc=e=>e;function uc(e,t=cc){const n=Mn.useSyncExternalStore(e.subscribe,Mn.useCallback(()=>t(e.getState()),[e,t]),Mn.useCallback(()=>t(e.getInitialState()),[e,t]));return Mn.useDebugValue(n),n}const Ks=e=>{const t=lc(e),n=r=>uc(t,r);return Object.assign(n,t),n},Ot=(e=>e?Ks(e):Ks),ve=Ot(e=>({runs:{},selectedRunId:null,traces:{},logs:{},chatMessages:{},entrypoints:[],setRuns:t=>e(n=>{var a;let r=n.breakpoints;for(const i of t)(a=i.breakpoints)!=null&&a.length&&!r[i.id]&&(r={...r,[i.id]:Object.fromEntries(i.breakpoints.map(l=>[l,!0]))});const s={runs:Object.fromEntries(t.map(i=>[i.id,i]))};return r!==n.breakpoints&&(s.breakpoints=r),s}),upsertRun:t=>e(n=>{var s;const r={runs:{...n.runs,[t.id]:t}};if((s=t.breakpoints)!=null&&s.length&&!n.breakpoints[t.id]&&(r.breakpoints={...n.breakpoints,[t.id]:Object.fromEntries(t.breakpoints.map(a=>[a,!0]))}),(t.status==="completed"||t.status==="failed")&&n.activeNodes[t.id]){const{[t.id]:a,...i}=n.activeNodes;r.activeNodes=i}if(t.status!=="suspended"&&n.activeInterrupt[t.id]){const{[t.id]:a,...i}=n.activeInterrupt;r.activeInterrupt=i}return r}),selectRun:t=>e({selectedRunId:t}),addTrace:t=>e(n=>{const r=n.traces[t.run_id]??[],s=r.findIndex(i=>i.span_id===t.span_id),a=s>=0?r.map((i,l)=>l===s?t:i):[...r,t];return{traces:{...n.traces,[t.run_id]:a}}}),setTraces:(t,n)=>e(r=>({traces:{...r.traces,[t]:n}})),addLog:t=>e(n=>{const r=n.logs[t.run_id]??[];return{logs:{...n.logs,[t.run_id]:[...r,t]}}}),setLogs:(t,n)=>e(r=>({logs:{...r.logs,[t]:n}})),addChatEvent:(t,n)=>e(r=>{const s=r.chatMessages[t]??[],a=n.message;if(!a)return r;const i=a.messageId??a.message_id,l=a.role??"assistant",d=(a.contentParts??a.content_parts??[]).filter(h=>{const v=h.mimeType??h.mime_type??"";return v.startsWith("text/")||v==="application/json"}).map(h=>{const v=h.data;return(v==null?void 0:v.inline)??""}).join(`
+`).trim(),p=(a.toolCalls??a.tool_calls??[]).map(h=>({name:h.name??"",has_result:!!h.result})),m={message_id:i,role:l,content:d,tool_calls:p.length>0?p:void 0},f=s.findIndex(h=>h.message_id===i);if(f>=0)return{chatMessages:{...r.chatMessages,[t]:s.map((h,v)=>v===f?m:h)}};if(l==="user"){const h=s.findIndex(v=>v.message_id.startsWith("local-")&&v.role==="user"&&v.content===d);if(h>=0)return{chatMessages:{...r.chatMessages,[t]:s.map((v,y)=>y===h?m:v)}}}const x=[...s,m];return{chatMessages:{...r.chatMessages,[t]:x}}}),addLocalChatMessage:(t,n)=>e(r=>{const s=r.chatMessages[t]??[];return{chatMessages:{...r.chatMessages,[t]:[...s,n]}}}),setChatMessages:(t,n)=>e(r=>({chatMessages:{...r.chatMessages,[t]:n}})),setEntrypoints:t=>e({entrypoints:t}),breakpoints:{},toggleBreakpoint:(t,n)=>e(r=>{const s={...r.breakpoints[t]??{}};return s[n]?delete s[n]:s[n]=!0,{breakpoints:{...r.breakpoints,[t]:s}}}),clearBreakpoints:t=>e(n=>{const{[t]:r,...s}=n.breakpoints;return{breakpoints:s}}),activeNodes:{},setActiveNode:(t,n,r)=>e(s=>{const a=s.activeNodes[t]??{executing:{},prev:null};return{activeNodes:{...s.activeNodes,[t]:{executing:{...a.executing,[n]:r??null},prev:a.prev}}}}),removeActiveNode:(t,n)=>e(r=>{const s=r.activeNodes[t];if(!s)return r;const{[n]:a,...i}=s.executing;return{activeNodes:{...r.activeNodes,[t]:{executing:i,prev:n}}}}),resetRunGraphState:t=>e(n=>({stateEvents:{...n.stateEvents,[t]:[]},activeNodes:{...n.activeNodes,[t]:{executing:{},prev:null}}})),stateEvents:{},addStateEvent:(t,n,r,s,a)=>e(i=>{const l=i.stateEvents[t]??[];return{stateEvents:{...i.stateEvents,[t]:[...l,{node_name:n,qualified_node_name:s,phase:a,timestamp:Date.now(),payload:r}]}}}),setStateEvents:(t,n)=>e(r=>({stateEvents:{...r.stateEvents,[t]:n}})),focusedSpan:null,setFocusedSpan:t=>e({focusedSpan:t}),activeInterrupt:{},setActiveInterrupt:(t,n)=>e(r=>({activeInterrupt:{...r.activeInterrupt,[t]:n}})),reloadPending:!1,setReloadPending:t=>e({reloadPending:t}),graphCache:{},setGraphCache:(t,n)=>e(r=>({graphCache:{...r.graphCache,[t]:n}}))})),tr="/api";async function dc(e){const t=await fetch(`${tr}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({environment:e})});if(!t.ok)throw new Error(`Login failed: ${t.status}`);return t.json()}async function gr(){const e=await fetch(`${tr}/auth/status`);if(!e.ok)throw new Error(`Status check failed: ${e.status}`);return e.json()}async function pc(e){const t=await fetch(`${tr}/auth/select-tenant`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tenant_name:e})});if(!t.ok)throw new Error(`Tenant selection failed: ${t.status}`);return t.json()}async function fc(){await fetch(`${tr}/auth/logout`,{method:"POST"})}const Oi="uipath-env",mc=["cloud","staging","alpha"];function hc(){const e=localStorage.getItem(Oi);return mc.includes(e)?e:"cloud"}const Kn=Ot((e,t)=>({enabled:!0,status:"unauthenticated",environment:hc(),tenants:[],uipathUrl:null,pollTimer:null,expiryTimer:null,init:async()=>{try{const n=await fetch("/api/config");if(n.ok&&!(await n.json()).auth_enabled){e({enabled:!1});return}const r=await gr();e({status:r.status,tenants:r.tenants??[],uipathUrl:r.uipath_url??null}),r.status==="authenticated"&&t().startExpiryCheck()}catch(n){console.error("Auth init failed",n)}},setEnvironment:n=>{localStorage.setItem(Oi,n),e({environment:n})},startLogin:async()=>{const{environment:n}=t();try{const r=await dc(n);e({status:"pending"}),window.open(r.auth_url,"_blank"),t().pollStatus()}catch(r){console.error("Login failed",r)}},pollStatus:()=>{const{pollTimer:n}=t();if(n)return;const r=setInterval(async()=>{try{const s=await gr();s.status!=="pending"&&(t().stopPolling(),e({status:s.status,tenants:s.tenants??[],uipathUrl:s.uipath_url??null}),s.status==="authenticated"&&t().startExpiryCheck())}catch{}},2e3);e({pollTimer:r})},stopPolling:()=>{const{pollTimer:n}=t();n&&(clearInterval(n),e({pollTimer:null}))},startExpiryCheck:()=>{const{expiryTimer:n}=t();if(n)return;const r=setInterval(async()=>{try{(await gr()).status==="expired"&&(t().stopExpiryCheck(),e({status:"expired"}))}catch{}},3e4);e({expiryTimer:r})},stopExpiryCheck:()=>{const{expiryTimer:n}=t();n&&(clearInterval(n),e({expiryTimer:null}))},selectTenant:async n=>{try{const r=await pc(n);e({status:"authenticated",uipathUrl:r.uipath_url,tenants:[]}),t().startExpiryCheck()}catch(r){console.error("Tenant selection failed",r)}},logout:async()=>{t().stopPolling(),t().stopExpiryCheck();try{await fc()}catch{}e({status:"unauthenticated",tenants:[],uipathUrl:null})}})),Li=Ot(e=>({projectName:null,projectVersion:null,projectAuthors:null,init:async()=>{try{const t=await fetch("/api/config");if(t.ok){const n=await t.json();e({projectName:n.project_name??null,projectVersion:n.project_version??null,projectAuthors:n.project_authors??null})}}catch{}}}));class gc{constructor(t){Rt(this,"ws",null);Rt(this,"url");Rt(this,"handlers",new Set);Rt(this,"reconnectTimer",null);Rt(this,"shouldReconnect",!0);Rt(this,"pendingMessages",[]);Rt(this,"activeSubscriptions",new Set);const n=window.location.protocol==="https:"?"wss:":"ws:";this.url=t??`${n}//${window.location.host}/ws`}connect(){var t;((t=this.ws)==null?void 0:t.readyState)!==WebSocket.OPEN&&(this.ws=new WebSocket(this.url),this.ws.onopen=()=>{console.log("[ws] connected");for(const n of this.activeSubscriptions)this.sendRaw(JSON.stringify({type:"subscribe",payload:{run_id:n}}));for(const n of this.pendingMessages)this.sendRaw(n);this.pendingMessages=[]},this.ws.onmessage=n=>{let r;try{r=JSON.parse(n.data)}catch{console.warn("[ws] failed to parse message",n.data);return}this.handlers.forEach(s=>{try{s(r)}catch(a){console.error("[ws] handler error",a)}})},this.ws.onclose=()=>{console.log("[ws] disconnected"),this.shouldReconnect&&(this.reconnectTimer=setTimeout(()=>this.connect(),2e3))},this.ws.onerror=()=>{var n;(n=this.ws)==null||n.close()})}disconnect(){var t;this.shouldReconnect=!1,this.reconnectTimer&&clearTimeout(this.reconnectTimer),(t=this.ws)==null||t.close(),this.ws=null}onMessage(t){return this.handlers.add(t),()=>this.handlers.delete(t)}sendRaw(t){var n;((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN&&this.ws.send(t)}send(t,n){var s;const r=JSON.stringify({type:t,payload:n});((s=this.ws)==null?void 0:s.readyState)===WebSocket.OPEN?this.ws.send(r):this.pendingMessages.push(r)}subscribe(t){this.activeSubscriptions.add(t),this.send("subscribe",{run_id:t})}unsubscribe(t){this.activeSubscriptions.delete(t),this.send("unsubscribe",{run_id:t})}sendChatMessage(t,n){this.send("chat.message",{run_id:t,text:n})}sendInterruptResponse(t,n){this.send("chat.interrupt_response",{run_id:t,data:n})}debugStep(t){this.send("debug.step",{run_id:t})}debugContinue(t){this.send("debug.continue",{run_id:t})}debugStop(t){this.send("debug.stop",{run_id:t})}setBreakpoints(t,n){this.send("debug.set_breakpoints",{run_id:t,breakpoints:n})}sendAgentMessage(t,n,r,s){this.send("agent.message",{text:t,model:n,session_id:r??void 0,skill_ids:s&&s.length>0?s:void 0})}sendAgentStop(t){this.send("agent.stop",{session_id:t})}sendToolApproval(t,n,r){this.send("agent.tool_response",{session_id:t,tool_call_id:n,approved:r})}sendQuestionResponse(t,n,r){this.send("agent.question_response",{session_id:t,question_id:n,answer:r})}}const Lt="/api";async function Dt(e,t){const n=await fetch(e,t);if(!n.ok){let r;try{r=(await n.json()).detail||n.statusText}catch{r=n.statusText}const s=new Error(`HTTP ${n.status}`);throw s.detail=r,s.status=n.status,s}return n.json()}async function as(){return Dt(`${Lt}/entrypoints`)}async function xc(e){return Dt(`${Lt}/entrypoints/${encodeURIComponent(e)}/schema`)}async function bc(e){return Dt(`${Lt}/entrypoints/${encodeURIComponent(e)}/mock-input`)}async function yc(e){return Dt(`${Lt}/entrypoints/${encodeURIComponent(e)}/graph`)}async function Gs(e,t,n="run",r=[]){return Dt(`${Lt}/runs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entrypoint:e,input_data:t,mode:n,breakpoints:r})})}async function vc(){return Dt(`${Lt}/runs`)}async function xr(e){return Dt(`${Lt}/runs/${e}`)}async function kc(){return Dt(`${Lt}/reload`,{method:"POST"})}const Ae=Ot(e=>({evaluators:[],localEvaluators:[],evalSets:{},evalRuns:{},setEvaluators:t=>e({evaluators:t}),setLocalEvaluators:t=>e({localEvaluators:t}),addLocalEvaluator:t=>e(n=>({localEvaluators:[...n.localEvaluators,t]})),upsertLocalEvaluator:t=>e(n=>({localEvaluators:n.localEvaluators.some(r=>r.id===t.id)?n.localEvaluators.map(r=>r.id===t.id?t:r):[...n.localEvaluators,t]})),setEvalSets:t=>e({evalSets:Object.fromEntries(t.map(n=>[n.id,n]))}),addEvalSet:t=>e(n=>({evalSets:{...n.evalSets,[t.id]:t}})),updateEvalSetEvaluators:(t,n)=>e(r=>{const s=r.evalSets[t];return s?{evalSets:{...r.evalSets,[t]:{...s,evaluator_ids:n}}}:r}),incrementEvalSetCount:(t,n=1)=>e(r=>{const s=r.evalSets[t];return s?{evalSets:{...r.evalSets,[t]:{...s,eval_count:s.eval_count+n}}}:r}),setEvalRuns:t=>e({evalRuns:Object.fromEntries(t.map(n=>[n.id,n]))}),upsertEvalRun:t=>e(n=>({evalRuns:{...n.evalRuns,[t.id]:t}})),updateEvalRunProgress:(t,n,r)=>e(s=>{const a=s.evalRuns[t];return a?{evalRuns:{...s.evalRuns,[t]:{...a,progress_completed:n,progress_total:r,status:"running"}}}:s}),completeEvalRun:(t,n,r)=>e(s=>{const a=s.evalRuns[t];return a?{evalRuns:{...s.evalRuns,[t]:{...a,status:"completed",overall_score:n,evaluator_scores:r,end_time:new Date().toISOString()}}}:s})}));let Ec=0;function $t(){return`agent-msg-${++Ec}`}const De=Ot(e=>({sessionId:null,status:"idle",_lastActiveAt:null,messages:[],plan:[],activeQuestion:null,models:[],selectedModel:null,modelsLoading:!1,skills:[],selectedSkillIds:[],skillsLoading:!1,setStatus:t=>e(n=>{const r=n.status==="thinking"||n.status==="planning"||n.status==="executing"||n.status==="awaiting_approval";return{status:t,_lastActiveAt:r&&!(t==="thinking"||t==="planning"||t==="executing"||t==="awaiting_approval")?Date.now():n._lastActiveAt}}),addUserMessage:t=>e(n=>({messages:[...n.messages,{id:$t(),role:"user",content:t,timestamp:Date.now()}]})),appendAssistantText:(t,n)=>e(r=>{const s=[...r.messages],a=s[s.length-1];return a&&a.role==="assistant"&&!a.done?s[s.length-1]={...a,content:a.content+t,done:n}:s.push({id:$t(),role:"assistant",content:t,timestamp:Date.now(),done:n}),{messages:s}}),setPlan:t=>e(n=>{const r=[...n.messages],s=r.findIndex(i=>i.role==="plan"),a={id:s>=0?r[s].id:$t(),role:"plan",content:"",timestamp:Date.now(),planItems:t};return s>=0?r[s]=a:r.push(a),{messages:r,plan:t}}),addToolUse:(t,n)=>e(r=>{const s=[...r.messages],a=s[s.length-1],i={tool:t,args:n};return a&&a.role==="tool"&&a.toolCalls?s[s.length-1]={...a,toolCalls:[...a.toolCalls,i]}:s.push({id:$t(),role:"tool",content:"",timestamp:Date.now(),toolCalls:[i]}),{messages:s}}),addToolResult:(t,n,r)=>e(s=>{const a=[...s.messages];for(let i=a.length-1;i>=0;i--){const l=a[i];if(l.role==="tool"&&l.toolCalls){const c=[...l.toolCalls];for(let u=c.length-1;u>=0;u--)if(c[u].tool===t&&c[u].result===void 0)return c[u]={...c[u],result:n,is_error:r},a[i]={...l,toolCalls:c},{messages:a}}}return{messages:a}}),addToolApprovalRequest:(t,n,r)=>e(s=>{const a=[...s.messages];for(let c=a.length-1;c>=0;c--){const u=a[c];if(u.role==="tool"&&u.toolCalls){const d=[...u.toolCalls];for(let p=d.length-1;p>=0;p--)if(d[p].tool===n&&!d[p].status&&d[p].result===void 0)return d[p]={...d[p],tool_call_id:t,status:"pending"},a[c]={...u,toolCalls:d},{messages:a}}if(u.role!=="tool")break}const i={tool:n,args:r,tool_call_id:t,status:"pending"},l=a[a.length-1];return l&&l.role==="tool"&&l.toolCalls?a[a.length-1]={...l,toolCalls:[...l.toolCalls,i]}:a.push({id:$t(),role:"tool",content:"",timestamp:Date.now(),toolCalls:[i]}),{messages:a}}),resolveToolApproval:(t,n)=>e(r=>{const s=[...r.messages];for(let a=s.length-1;a>=0;a--){const i=s[a];if(i.role==="tool"&&i.toolCalls){const l=[...i.toolCalls];for(let c=l.length-1;c>=0;c--)if(l[c].tool_call_id===t)return l[c]={...l[c],status:n?"approved":"denied"},s[a]={...i,toolCalls:l},{messages:s}}}return{messages:s}}),appendThinking:t=>e(n=>{const r=[...n.messages],s=r[r.length-1];return s&&s.role==="thinking"?r[r.length-1]={...s,content:s.content+t}:r.push({id:$t(),role:"thinking",content:t,timestamp:Date.now()}),{messages:r}}),addError:t=>e(n=>({status:"error",messages:[...n.messages,{id:$t(),role:"assistant",content:`Error: ${t}`,timestamp:Date.now(),done:!0}]})),setActiveQuestion:t=>e({activeQuestion:t}),setSessionId:t=>{sessionStorage.setItem("agent_session_id",t),e({sessionId:t})},setModels:t=>e({models:t}),setSelectedModel:t=>e({selectedModel:t}),setModelsLoading:t=>e({modelsLoading:t}),setSkills:t=>e({skills:t}),setSelectedSkillIds:t=>e({selectedSkillIds:t}),toggleSkill:t=>e(n=>({selectedSkillIds:n.selectedSkillIds.includes(t)?n.selectedSkillIds.filter(s=>s!==t):[...n.selectedSkillIds,t]})),setSkillsLoading:t=>e({skillsLoading:t}),hydrateSession:t=>e({sessionId:t.session_id,status:t.status||"done",messages:t.messages,plan:t.plan,selectedModel:t.model||null}),clearSession:()=>{sessionStorage.removeItem("agent_session_id"),e({sessionId:null,status:"idle",_lastActiveAt:null,messages:[],plan:[],activeQuestion:null})}})),ge=Ot(e=>({children:{},expanded:{},selectedFile:null,openTabs:[],fileCache:{},dirty:{},buffers:{},loadingDirs:{},loadingFile:!1,agentChangedFiles:{},diffView:null,setChildren:(t,n)=>e(r=>({children:{...r.children,[t]:n}})),toggleExpanded:t=>e(n=>({expanded:{...n.expanded,[t]:!n.expanded[t]}})),setSelectedFile:t=>e({selectedFile:t}),openTab:t=>e(n=>({selectedFile:t,openTabs:n.openTabs.includes(t)?n.openTabs:[...n.openTabs,t]})),closeTab:t=>e(n=>{const r=n.openTabs.filter(u=>u!==t);let s=n.selectedFile;if(s===t){const u=n.openTabs.indexOf(t);s=r[Math.min(u,r.length-1)]??null}const{[t]:a,...i}=n.dirty,{[t]:l,...c}=n.buffers;return{openTabs:r,selectedFile:s,dirty:i,buffers:c}}),setFileContent:(t,n)=>e(r=>({fileCache:{...r.fileCache,[t]:n}})),updateBuffer:(t,n)=>e(r=>({buffers:{...r.buffers,[t]:n},dirty:{...r.dirty,[t]:!0}})),markClean:t=>e(n=>{const{[t]:r,...s}=n.dirty,{[t]:a,...i}=n.buffers;return{dirty:s,buffers:i}}),setLoadingDir:(t,n)=>e(r=>({loadingDirs:{...r.loadingDirs,[t]:n}})),setLoadingFile:t=>e({loadingFile:t}),markAgentChanged:t=>e(n=>({agentChangedFiles:{...n.agentChangedFiles,[t]:Date.now()}})),clearAgentChanged:t=>e(n=>{const{[t]:r,...s}=n.agentChangedFiles;return{agentChangedFiles:s}}),setDiffView:t=>e({diffView:t}),expandPath:t=>e(n=>{const r=t.split("/"),s={...n.expanded};for(let a=1;ae.current.onMessage(h=>{var v,y;switch(h.type){case"run.updated":t(h.payload);break;case"trace":n(h.payload);break;case"log":r(h.payload);break;case"chat":{const b=h.payload.run_id;s(b,h.payload);break}case"chat.interrupt":{const b=h.payload.run_id;a(b,h.payload);break}case"state":{const b=h.payload.run_id,A=h.payload.node_name,I=h.payload.qualified_node_name??null,L=h.payload.phase??null,T=h.payload.payload;A==="__start__"&&L==="started"&&c(b),L==="started"?i(b,A,I):L==="completed"&&l(b,A),u(b,A,T,I,L);break}case"reload":{h.payload.reloaded?as().then(A=>{const I=ve.getState();I.setEntrypoints(A.map(L=>L.name)),I.setReloadPending(!1)}).catch(A=>console.error("Failed to refresh entrypoints:",A)):ve.getState().setReloadPending(!0);break}case"files.changed":{const b=h.payload.files,A=new Set(b),I=ge.getState(),L=De.getState(),T=L.status,B=T==="thinking"||T==="planning"||T==="executing"||T==="awaiting_approval",D=!B&&L._lastActiveAt!=null&&Date.now()-L._lastActiveAt<3e3,C=b.filter(N=>N in I.children?!1:(N.split("/").pop()??"").includes("."));if(console.log("[files.changed]",{all:b,files:C,agentStatus:T,agentIsActive:B,recentlyActive:D}),B||D){let N=!1;for(const O of C){if(I.dirty[O])continue;const M=((v=I.fileCache[O])==null?void 0:v.content)??null,_=((y=I.fileCache[O])==null?void 0:y.language)??null;Hr(O).then(w=>{const R=ge.getState();if(R.dirty[O])return;R.setFileContent(O,w),R.expandPath(O);const H=O.split("/");for(let q=1;qge.getState().setChildren(g,F)).catch(()=>{})}const z=ge.getState().openTabs.includes(O);!N&&z&&M!==null&&w.content!==null&&M!==w.content&&(N=!0,ge.getState().setSelectedFile(O),R.setDiffView({path:O,original:M,modified:w.content,language:_}),setTimeout(()=>{const q=ge.getState().diffView;q&&q.path===O&&q.original===M&&ge.getState().setDiffView(null)},5e3)),R.markAgentChanged(O),setTimeout(()=>ge.getState().clearAgentChanged(O),1e4)}).catch(()=>{const w=ge.getState();w.openTabs.includes(O)&&w.closeTab(O)})}}else for(const N of I.openTabs)I.dirty[N]||!A.has(N)||Hr(N).then(O=>{var _;const M=ge.getState();M.dirty[N]||((_=M.fileCache[N])==null?void 0:_.content)!==O.content&&M.setFileContent(N,O)}).catch(()=>{});const S=new Set;for(const N of b){const O=N.lastIndexOf("/"),M=O===-1?"":N.substring(0,O);M in I.children&&S.add(M)}for(const N of S)Gn(N).then(O=>ge.getState().setChildren(N,O)).catch(()=>{});break}case"eval_run.created":d(h.payload);break;case"eval_run.progress":{const{run_id:b,completed:A,total:I,item_result:L}=h.payload;p(b,A,I,L);break}case"eval_run.completed":{const{run_id:b,overall_score:A,evaluator_scores:I}=h.payload;m(b,A,I);break}case"agent.status":{const{session_id:b,status:A}=h.payload,I=De.getState();I.sessionId||I.setSessionId(b),I.setStatus(A),(A==="done"||A==="error"||A==="idle")&&I.setActiveQuestion(null);break}case"agent.text":{const{session_id:b,content:A,done:I}=h.payload,L=De.getState();L.sessionId||L.setSessionId(b),L.appendAssistantText(A,I);break}case"agent.plan":{const{session_id:b,items:A}=h.payload,I=De.getState();I.sessionId||I.setSessionId(b),I.setPlan(A);break}case"agent.tool_use":{const{session_id:b,tool:A,args:I}=h.payload,L=De.getState();L.sessionId||L.setSessionId(b),L.addToolUse(A,I);break}case"agent.tool_result":{const{tool:b,result:A,is_error:I}=h.payload;De.getState().addToolResult(b,A,I);break}case"agent.tool_approval":{const{session_id:b,tool_call_id:A,tool:I,args:L}=h.payload,T=De.getState();T.sessionId||T.setSessionId(b),T.addToolApprovalRequest(A,I,L);break}case"agent.thinking":{const{content:b}=h.payload;De.getState().appendThinking(b);break}case"agent.text_delta":{const{session_id:b,delta:A}=h.payload,I=De.getState();I.sessionId||I.setSessionId(b),I.appendAssistantText(A,!1);break}case"agent.question":{const{session_id:b,question_id:A,question:I,options:L}=h.payload,T=De.getState();T.sessionId||T.setSessionId(b),T.setActiveQuestion({question_id:A,question:I,options:L});break}case"agent.token_usage":break;case"agent.error":{const{message:b}=h.payload;De.getState().addError(b);break}}}),[t,n,r,s,a,i,l,c,u,d,p,m]),e.current}function Nc(e){const t=e.replace(/^#\/?/,""),n={section:"debug",view:"new",runId:null,tab:"traces",setupEntrypoint:null,setupMode:null,evalCreating:!1,evalSetId:null,evalRunId:null,evalRunItemName:null,evaluatorId:null,evaluatorCreateType:null,evaluatorFilter:null,explorerFile:null,stateDbTable:null};if(!t||t==="new"||t==="debug"||t==="debug/new")return n;const r=t.match(/^(?:debug\/)?setup\/([^/]+)\/(run|chat)$/);if(r)return{...n,view:"setup",setupEntrypoint:decodeURIComponent(r[1]),setupMode:r[2]};const s=t.match(/^(?:debug\/)?runs\/([^/]+)(?:\/(traces|output))?$/);if(s)return{...n,view:"details",runId:s[1],tab:s[2]??"traces"};if(t==="evals/new")return{...n,section:"evals",evalCreating:!0};const a=t.match(/^evals\/runs\/([^/]+?)(?:\/([^/]+))?$/);if(a)return{...n,section:"evals",evalRunId:a[1],evalRunItemName:a[2]?decodeURIComponent(a[2]):null};const i=t.match(/^evals\/sets\/([^/]+)$/);if(i)return{...n,section:"evals",evalSetId:i[1]};if(t==="evals")return{...n,section:"evals"};const l=t.match(/^evaluators\/new(?:\/(deterministic|llm|tool))?$/);if(l)return{...n,section:"evaluators",evaluatorCreateType:l[1]??"any"};const c=t.match(/^evaluators\/category\/(deterministic|llm|tool)$/);if(c)return{...n,section:"evaluators",evaluatorFilter:c[1]};const u=t.match(/^evaluators\/([^/]+)$/);if(u)return{...n,section:"evaluators",evaluatorId:u[1]};if(t==="evaluators")return{...n,section:"evaluators"};const d=t.match(/^explorer\/statedb\/(.+)$/);if(d)return{...n,section:"explorer",stateDbTable:decodeURIComponent(d[1])};if(t==="explorer/statedb")return{...n,section:"explorer",stateDbTable:""};const p=t.match(/^explorer\/file\/(.+)$/);return p?{...n,section:"explorer",explorerFile:decodeURIComponent(p[1])}:t==="explorer"?{...n,section:"explorer"}:n}function Sc(){return window.location.hash}function Tc(e){return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)}function Ve(){const e=E.useSyncExternalStore(Tc,Sc),t=Nc(e),n=E.useCallback(r=>{window.location.hash=r},[]);return{...t,navigate:n}}const qs="(max-width: 767px)";function Cc(){const[e,t]=E.useState(()=>window.matchMedia(qs).matches);return E.useEffect(()=>{const n=window.matchMedia(qs),r=s=>t(s.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const Ac=[{section:"debug",label:"Developer Console",icon:o.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("rect",{x:"8",y:"6",width:"8",height:"14",rx:"4"}),o.jsx("path",{d:"M6 10H4"}),o.jsx("path",{d:"M6 18H4"}),o.jsx("path",{d:"M18 10h2"}),o.jsx("path",{d:"M18 18h2"}),o.jsx("path",{d:"M8 14h8"}),o.jsx("path",{d:"M9 6l-1.5-2"}),o.jsx("path",{d:"M15 6l1.5-2"}),o.jsx("path",{d:"M6 14H4"}),o.jsx("path",{d:"M18 14h2"})]})},{section:"evals",label:"Evals",icon:o.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M9 3h6"}),o.jsx("path",{d:"M10 3v6.5L5 20a1 1 0 0 0 .9 1.4h12.2a1 1 0 0 0 .9-1.4L14 9.5V3"}),o.jsx("path",{d:"M8.5 14h7"})]})},{section:"evaluators",label:"Evaluators",icon:o.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M12 2l7 4v5c0 5.25-3.5 9.74-7 11-3.5-1.26-7-5.75-7-11V6l7-4z"}),o.jsx("path",{d:"M9 12l2 2 4-4"})]})},{section:"explorer",label:"Explorer",icon:o.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:o.jsx("path",{d:"M7.5 22.5H17.595C17.07 23.4 16.11 24 15 24H7.5C4.185 24 1.5 21.315 1.5 18V6C1.5 4.89 2.1 3.93 3 3.405V18C3 20.475 5.025 22.5 7.5 22.5ZM21 8.121V18C21 19.6545 19.6545 21 18 21H7.5C5.8455 21 4.5 19.6545 4.5 18V3C4.5 1.3455 5.8455 0 7.5 0H12.879C13.4715 0 14.0505 0.24 14.4705 0.6585L20.3415 6.5295C20.766 6.954 21 7.5195 21 8.121ZM13.5 6.75C13.5 7.164 13.8375 7.5 14.25 7.5H19.1895L13.5 1.8105V6.75ZM19.5 18V9H14.25C13.0095 9 12 7.9905 12 6.75V1.5H7.5C6.672 1.5 6 2.1735 6 3V18C6 18.8265 6.672 19.5 7.5 19.5H18C18.828 19.5 19.5 18.8265 19.5 18Z"})})}];function jc({section:e,onSectionChange:t}){return o.jsx("div",{className:"w-12 flex flex-col items-center shrink-0 border-r",style:{background:"var(--activity-bar-bg)",borderColor:"var(--border)"},children:o.jsx("div",{className:"flex flex-col items-center gap-1 pt-2",children:Ac.map(n=>{const r=e===n.section;return o.jsxs("button",{onClick:()=>t(n.section),className:"w-10 h-10 flex items-center justify-center rounded cursor-pointer transition-colors relative",style:{color:r?"var(--text-primary)":"var(--text-muted)",background:r?"var(--bg-hover)":"transparent",border:"none"},title:n.label,onMouseEnter:s=>{r||(s.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:s=>{r||(s.currentTarget.style.color="var(--text-muted)")},children:[r&&o.jsx("div",{className:"absolute left-0 top-1.5 bottom-1.5 w-0.5 rounded-r",style:{background:"var(--accent)"}}),n.icon]},n.section)})})})}const tt="/api";async function nt(e,t){const n=await fetch(e,t);if(!n.ok){let r;try{r=(await n.json()).detail||n.statusText}catch{r=n.statusText}const s=new Error(`HTTP ${n.status}`);throw s.detail=r,s.status=n.status,s}return n.json()}async function Mc(){return nt(`${tt}/evaluators`)}async function Di(){return nt(`${tt}/eval-sets`)}async function Rc(e){return nt(`${tt}/eval-sets`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Ic(e,t){return nt(`${tt}/eval-sets/${encodeURIComponent(e)}/items`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function Oc(e,t){await nt(`${tt}/eval-sets/${encodeURIComponent(e)}/items/${encodeURIComponent(t)}`,{method:"DELETE"})}async function Lc(e){return nt(`${tt}/eval-sets/${encodeURIComponent(e)}`)}async function Dc(e){return nt(`${tt}/eval-sets/${encodeURIComponent(e)}/runs`,{method:"POST"})}async function Pc(){return nt(`${tt}/eval-runs`)}async function Vs(e){return nt(`${tt}/eval-runs/${encodeURIComponent(e)}`)}async function us(){return nt(`${tt}/local-evaluators`)}async function Bc(e){return nt(`${tt}/local-evaluators`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function Fc(e,t){return nt(`${tt}/eval-sets/${encodeURIComponent(e)}/evaluators`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({evaluator_refs:t})})}async function $c(e,t){return nt(`${tt}/local-evaluators/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}const zc={"uipath-exact-match":e=>({expectedOutput:e}),"uipath-json-similarity":e=>({expectedOutput:e}),"uipath-contains":()=>({searchText:""}),"uipath-llm-judge-output-semantic-similarity":e=>({expectedOutput:e}),"uipath-llm-judge-output-strict-json-similarity":e=>({expectedOutput:e}),"uipath-llm-judge-trajectory-similarity":()=>({expectedAgentBehavior:""}),"uipath-llm-judge-trajectory-simulation":()=>({expectedAgentBehavior:""}),"uipath-tool-call-count":()=>({}),"uipath-tool-call-args":()=>({}),"uipath-tool-call-order":()=>({}),"uipath-tool-call-output":()=>({})};function Uc(e,t){if(!e)return{};const n=zc[e.evaluator_type_id];return n?n(t):e.type==="tool"?{}:e.evaluator_type_id.includes("trajectory")?{expectedAgentBehavior:""}:{expectedOutput:t}}function Pi(e){return e?e.type==="tool"?!0:e.evaluator_type_id.includes("tool-call"):!1}function Hc(e){return e?Pi(e)?{label:"tools",color:"var(--warning, #e5a00d)"}:e.evaluator_type_id.includes("trajectory")?{label:"quality",color:"var(--info, #3b82f6)"}:{label:"output",color:"var(--success, #22c55e)"}:{label:"output",color:"var(--success, #22c55e)"}}function Wc({run:e,onClose:t}){const n=Ae(C=>C.evalSets),r=Ae(C=>C.setEvalSets),s=Ae(C=>C.incrementEvalSetCount),a=Ae(C=>C.localEvaluators),i=Ae(C=>C.setLocalEvaluators),[l,c]=E.useState(`run-${e.id.slice(0,8)}`),[u,d]=E.useState(new Set),[p,m]=E.useState({}),f=E.useRef(new Set),[x,h]=E.useState(!1),[v,y]=E.useState(null),[b,A]=E.useState(!1),I=Object.values(n),L=E.useMemo(()=>Object.fromEntries(a.map(C=>[C.id,C])),[a]),T=E.useMemo(()=>{const C=new Set;for(const S of u){const N=n[S];N&&N.evaluator_ids.forEach(O=>C.add(O))}return[...C]},[u,n]);E.useEffect(()=>{const C=e.output_data,S=f.current;m(N=>{const O={};for(const M of T)if(S.has(M)&&N[M]!==void 0)O[M]=N[M];else{const _=L[M],w=Uc(_,C);O[M]=JSON.stringify(w,null,2)}return O})},[T,L,e.output_data]),E.useEffect(()=>{const C=S=>{S.key==="Escape"&&t()};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[t]),E.useEffect(()=>{I.length===0&&Di().then(r).catch(()=>{}),a.length===0&&us().then(i).catch(()=>{})},[]);const B=C=>{d(S=>{const N=new Set(S);return N.has(C)?N.delete(C):N.add(C),N})},D=async()=>{var S;if(!l.trim()||u.size===0)return;y(null),h(!0);const C={};for(const N of T){const O=p[N];if(O!==void 0)try{C[N]=JSON.parse(O)}catch{y(`Invalid JSON for evaluator "${((S=L[N])==null?void 0:S.name)??N}"`),h(!1);return}}try{for(const N of u){const O=n[N],M=new Set((O==null?void 0:O.evaluator_ids)??[]),_={};for(const[w,R]of Object.entries(C))M.has(w)&&(_[w]=R);await Ic(N,{name:l.trim(),inputs:e.input_data,expected_output:null,evaluation_criterias:_}),s(N)}A(!0),setTimeout(t,3e3)}catch(N){y(N.detail||N.message||"Failed to add item")}finally{h(!1)}};return o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.5)"},onClick:C=>{C.target===C.currentTarget&&t()},children:o.jsxs("div",{className:"w-full max-w-2xl rounded-lg p-6 shadow-xl max-h-[85vh] flex flex-col",style:{background:"var(--bg-primary)",border:"1px solid var(--border)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-6",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:"var(--accent)"}}),o.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--text-muted)"},children:"Add to Eval Set"})]}),o.jsx("button",{onClick:t,className:"w-7 h-7 flex items-center justify-center rounded cursor-pointer transition-colors",style:{color:"var(--text-muted)",background:"transparent",border:"none"},onMouseEnter:C=>{C.currentTarget.style.color="var(--text-primary)"},onMouseLeave:C=>{C.currentTarget.style.color="var(--text-muted)"},"aria-label":"Close",children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 space-y-4 pr-1",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Item Name"}),o.jsx("input",{type:"text",value:l,onChange:C=>c(C.target.value),className:"w-full rounded-md px-3 py-2 text-xs",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)",color:"var(--text-primary)"}})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Inputs"}),o.jsx("pre",{className:"rounded-md px-3 py-2 text-xs font-mono whitespace-pre-wrap break-words max-h-32 overflow-y-auto",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)",color:"var(--text-secondary)"},children:JSON.stringify(e.input_data,null,2)})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Eval Sets"}),I.length===0?o.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:"No eval sets found. Create one first."}):o.jsx("div",{className:"rounded-md border overflow-hidden max-h-40 overflow-y-auto",style:{borderColor:"var(--border)",background:"var(--bg-secondary)"},children:I.map(C=>o.jsxs("label",{className:"flex items-center gap-2.5 px-3 py-2 text-xs cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--border)"},onMouseEnter:S=>{S.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:S=>{S.currentTarget.style.background="transparent"},children:[o.jsx("input",{type:"checkbox",checked:u.has(C.id),onChange:()=>B(C.id),className:"accent-[var(--accent)]"}),o.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:C.name}),o.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-muted)"},children:[C.eval_count," items"]})]},C.id))})]}),T.length>0&&o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Evaluation Criteria"}),o.jsx("div",{className:"space-y-2",children:T.map(C=>{const S=L[C],N=Pi(S),O=Hc(S);return o.jsxs("div",{className:"rounded-md",style:{border:"1px solid var(--border)",background:"var(--bg-primary)",opacity:N?.6:1},children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{borderBottom:N?"none":"1px solid var(--border)"},children:[o.jsx("span",{className:"text-xs font-medium truncate flex-1",style:{color:"var(--text-primary)"},children:(S==null?void 0:S.name)??C}),o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium",style:{color:O.color,background:`color-mix(in srgb, ${O.color} 12%, transparent)`},children:O.label})]}),N?o.jsx("div",{className:"px-3 pb-2",children:o.jsx("span",{className:"text-[10px] italic",style:{color:"var(--text-muted)"},children:"Default criteria — uses evaluator config"})}):o.jsx("div",{className:"px-3 pb-2 pt-1",children:o.jsx("textarea",{value:p[C]??"{}",onChange:M=>{f.current.add(C),m(_=>({..._,[C]:M.target.value}))},rows:8,className:"w-full rounded px-2 py-1.5 text-xs font-mono resize-y",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)",color:"var(--text-primary)"}})})]},C)})})]})]}),o.jsxs("div",{className:"mt-4 space-y-3",children:[v&&o.jsx("p",{className:"text-xs px-3 py-2 rounded",style:{color:"var(--error)",background:"color-mix(in srgb, var(--error) 10%, var(--bg-secondary))"},children:v}),b&&o.jsxs("p",{className:"text-xs px-3 py-2 rounded",style:{color:"var(--success)",background:"color-mix(in srgb, var(--success) 10%, var(--bg-secondary))"},children:["Added to ",u.size," eval set",u.size!==1?"s":"","."]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{onClick:t,className:"flex-1 py-2 rounded-md text-xs font-semibold cursor-pointer",style:{background:"var(--bg-secondary)",color:"var(--text-secondary)",border:"1px solid var(--border)"},children:"Cancel"}),o.jsx("button",{onClick:D,disabled:!l.trim()||u.size===0||x||b,className:"flex-1 py-2 rounded-md text-[13px] font-semibold transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"var(--accent)",color:"var(--bg-primary)",border:"none"},children:x?"Adding...":b?"Added":"Add Item"})]})]})]})})}const Kc={pending:"var(--text-muted)",running:"var(--warning)",suspended:"var(--info)",completed:"var(--success)",failed:"var(--error)"};function Gc({run:e,isSelected:t,onClick:n}){var p;const r=Kc[e.status]??"var(--text-muted)",s=((p=e.entrypoint.split("/").pop())==null?void 0:p.slice(0,16))??e.entrypoint,a=e.start_time?new Date(e.start_time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"",[i,l]=E.useState(!1),[c,u]=E.useState(!1),d=E.useRef(null);return E.useEffect(()=>{if(!i)return;const m=f=>{d.current&&!d.current.contains(f.target)&&l(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[i]),o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"group relative w-full text-left px-3 py-1.5 flex items-center gap-2 transition-colors cursor-pointer",style:{background:t?"color-mix(in srgb, var(--accent) 15%, var(--bg-primary))":void 0,borderLeft:t?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:m=>{t||(m.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:m=>{t||(m.currentTarget.style.background="")},onClick:n,children:[o.jsx("span",{className:"shrink-0 w-2 h-2 rounded-full",style:{background:r}}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-xs truncate",style:{color:t?"var(--text-primary)":"var(--text-secondary)"},children:s}),o.jsxs("div",{className:"text-[11px] tabular-nums",style:{color:"var(--text-muted)"},children:[a,e.duration?` · ${e.duration}`:""]})]}),e.status==="completed"&&o.jsxs("div",{ref:d,className:"relative shrink-0",children:[o.jsx("button",{onClick:m=>{m.stopPropagation(),l(f=>!f)},className:"opacity-40 group-hover:opacity-100 focus:opacity-100 w-7 h-7 flex items-center justify-center rounded transition-opacity cursor-pointer",style:{color:"var(--text-muted)"},onMouseEnter:m=>{m.currentTarget.style.color="var(--text-primary)",m.currentTarget.style.background="var(--bg-secondary)"},onMouseLeave:m=>{m.currentTarget.style.color="var(--text-muted)",m.currentTarget.style.background=""},"aria-label":"Actions",title:"Actions",children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",children:[o.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),o.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),o.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}),i&&o.jsx("div",{className:"absolute right-0 top-full mt-1 z-50 min-w-[140px] rounded-md shadow-lg py-1",style:{background:"var(--bg-primary)",border:"1px solid var(--border)"},children:o.jsx("button",{onClick:m=>{m.stopPropagation(),l(!1),u(!0)},className:"w-full text-left px-3 py-1.5 text-xs cursor-pointer transition-colors",style:{color:"var(--text-secondary)"},onMouseEnter:m=>{m.currentTarget.style.background="var(--bg-hover)",m.currentTarget.style.color="var(--text-primary)"},onMouseLeave:m=>{m.currentTarget.style.background="",m.currentTarget.style.color="var(--text-secondary)"},children:"Add to Eval Set"})})]})]}),c&&o.jsx(Wc,{run:e,onClose:()=>u(!1)})]})}function Ys({runs:e,selectedRunId:t,onSelectRun:n,onNewRun:r}){const s=[...e].sort((a,i)=>new Date(i.start_time??0).getTime()-new Date(a.start_time??0).getTime());return o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:r,className:"mx-3 mt-2.5 mb-1 px-3 py-1.5 text-[11px] font-medium rounded border border-[var(--border)] bg-transparent transition-colors cursor-pointer",style:{color:"var(--text-secondary)"},onMouseEnter:a=>{a.currentTarget.style.color="var(--text-primary)",a.currentTarget.style.borderColor="var(--text-muted)"},onMouseLeave:a=>{a.currentTarget.style.color="var(--text-secondary)",a.currentTarget.style.borderColor=""},children:"+ New Run"}),o.jsx("div",{className:"px-3 pt-3 pb-1 text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"History"}),o.jsxs("div",{className:"flex-1 overflow-y-auto",children:[s.map(a=>o.jsx(Gc,{run:a,isSelected:a.id===t,onClick:()=>n(a.id)},a.id)),s.length===0&&o.jsx("p",{className:"text-xs px-3 py-4 text-center",style:{color:"var(--text-muted)"},children:"No runs yet"})]})]})}function Bi(){const e=localStorage.getItem("uipath-dev-theme");return e==="light"||e==="dark"?e:"dark"}function Fi(e){document.documentElement.setAttribute("data-theme",e),localStorage.setItem("uipath-dev-theme",e)}Fi(Bi());const $i=Ot(e=>({theme:Bi(),toggleTheme:()=>e(t=>{const n=t.theme==="dark"?"light":"dark";return Fi(n),{theme:n}})}));function Xs(){const{theme:e,toggleTheme:t}=$i(),{enabled:n,status:r,environment:s,tenants:a,uipathUrl:i,setEnvironment:l,startLogin:c,selectTenant:u,logout:d}=Kn(),{projectName:p,projectVersion:m,projectAuthors:f}=Li(),[x,h]=E.useState(!1),[v,y]=E.useState(""),b=E.useRef(null),A=E.useRef(null);E.useEffect(()=>{if(!x)return;const _=w=>{b.current&&!b.current.contains(w.target)&&A.current&&!A.current.contains(w.target)&&h(!1)};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[x]);const I=r==="authenticated",L=r==="expired",T=r==="pending",B=r==="needs_tenant";let D="UiPath: Disconnected",C=null,S=!0;I?(D=`UiPath: ${i?i.replace(/^https?:\/\/[^/]+\//,""):""}`,C="var(--success)",S=!1):L?(D=`UiPath: ${i?i.replace(/^https?:\/\/[^/]+\//,""):""} (expired)`,C="var(--error)",S=!1):T?D="UiPath: Signing in…":B&&(D="UiPath: Select Tenant");const N=()=>{T||(L?c():h(_=>!_))},O="flex items-center gap-1 px-1.5 rounded transition-colors",M={onMouseEnter:_=>{_.currentTarget.style.background="var(--bg-hover)",_.currentTarget.style.color="var(--text-primary)"},onMouseLeave:_=>{_.currentTarget.style.background="",_.currentTarget.style.color="var(--text-muted)"}};return o.jsxs("div",{className:"h-6 flex items-center justify-end gap-3 px-2 text-xs border-t shrink-0",style:{background:"var(--bg-secondary)",color:"var(--text-muted)",borderColor:"var(--border)",fontSize:"11px"},children:[n&&o.jsxs("div",{className:"relative flex items-center",children:[o.jsxs("div",{ref:A,className:`${O} cursor-pointer`,onClick:N,...M,title:I?i??"":L?"Token expired — click to re-authenticate":T?"Signing in…":B?"Select a tenant":"Click to sign in",children:[T?o.jsxs("svg",{className:"animate-spin",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("circle",{cx:"12",cy:"12",r:"10",strokeOpacity:"0.25"}),o.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",strokeLinecap:"round"})]}):C?o.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:C}}):S?o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),o.jsx("path",{d:"M7 11V7a5 5 0 0 1 9.9-1"})]}):null,o.jsx("span",{className:"truncate max-w-[200px]",children:D})]}),x&&o.jsx("div",{ref:b,className:"absolute bottom-full right-0 mb-1 rounded border shadow-lg p-1 min-w-[180px]",style:{background:"var(--bg-secondary)",borderColor:"var(--border)"},children:I||L?o.jsxs(o.Fragment,{children:[o.jsxs("button",{onClick:()=>{i&&window.open(i,"_blank","noopener,noreferrer"),h(!1)},className:"w-full flex items-center gap-2 px-2 py-2 text-[11px] rounded cursor-pointer transition-colors text-left",style:{color:"var(--text-muted)",background:"transparent",border:"none"},onMouseEnter:_=>{_.currentTarget.style.background="var(--bg-hover)",_.currentTarget.style.color="var(--text-primary)"},onMouseLeave:_=>{_.currentTarget.style.background="transparent",_.currentTarget.style.color="var(--text-muted)"},children:[o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),o.jsx("polyline",{points:"15 3 21 3 21 9"}),o.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),"Go to Platform"]}),o.jsxs("button",{onClick:()=>{d(),h(!1)},className:"w-full flex items-center gap-2 px-2 py-2 text-[11px] rounded cursor-pointer transition-colors text-left",style:{color:"var(--text-muted)",background:"transparent",border:"none"},onMouseEnter:_=>{_.currentTarget.style.background="var(--bg-hover)",_.currentTarget.style.color="var(--text-primary)"},onMouseLeave:_=>{_.currentTarget.style.background="transparent",_.currentTarget.style.color="var(--text-muted)"},children:[o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),o.jsx("polyline",{points:"16 17 21 12 16 7"}),o.jsx("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]}),"Sign Out"]})]}):B?o.jsxs("div",{className:"p-1",children:[o.jsx("label",{className:"block text-[10px] font-medium mb-1",style:{color:"var(--text-muted)"},children:"Tenant"}),o.jsxs("select",{value:v,onChange:_=>y(_.target.value),className:"w-full rounded px-1.5 py-1 text-[10px] mb-1.5 appearance-auto",style:{background:"var(--bg-primary)",border:"1px solid var(--border)",color:"var(--text-primary)"},children:[o.jsx("option",{value:"",children:"Select…"}),a.map(_=>o.jsx("option",{value:_,children:_},_))]}),o.jsx("button",{onClick:()=>{v&&(u(v),h(!1))},disabled:!v,className:"w-full px-2 py-1 text-[10px] font-medium rounded border border-[var(--border)] bg-transparent cursor-pointer transition-colors disabled:opacity-30 disabled:cursor-not-allowed",style:{color:"var(--text-muted)"},children:"Confirm"})]}):o.jsxs("div",{className:"p-1",children:[o.jsx("label",{className:"block text-[10px] font-medium mb-1",style:{color:"var(--text-muted)"},children:"Environment"}),o.jsxs("select",{value:s,onChange:_=>l(_.target.value),className:"w-full rounded px-1.5 py-0.5 text-[10px] mb-1.5 appearance-auto",style:{background:"var(--bg-primary)",border:"1px solid var(--border)",color:"var(--text-muted)"},children:[o.jsx("option",{value:"cloud",children:"cloud"}),o.jsx("option",{value:"staging",children:"staging"}),o.jsx("option",{value:"alpha",children:"alpha"})]}),o.jsx("button",{onClick:()=>{c(),h(!1)},className:"w-full px-2 py-1 text-[10px] font-medium rounded border border-[var(--border)] bg-transparent cursor-pointer transition-colors",style:{color:"var(--text-muted)"},onMouseEnter:_=>{_.currentTarget.style.color="var(--text-primary)",_.currentTarget.style.borderColor="var(--text-muted)"},onMouseLeave:_=>{_.currentTarget.style.color="var(--text-muted)",_.currentTarget.style.borderColor="var(--border)"},children:"Sign In"})]})})]}),p&&o.jsxs("span",{className:O,children:["Project: ",p]}),m&&o.jsxs("span",{className:O,children:["Version: v",m]}),f&&o.jsxs("span",{className:O,children:["Author: ",f]}),o.jsxs("a",{href:"https://github.com/UiPath/uipath-dev-python",target:"_blank",rel:"noopener noreferrer",className:`${O} cursor-pointer no-underline`,style:{color:"var(--text-muted)"},...M,title:"View on GitHub",children:[o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z"})}),o.jsx("span",{children:"uipath-dev-python"})]}),o.jsxs("div",{className:`${O} cursor-pointer`,onClick:t,...M,title:`Switch to ${e==="dark"?"light":"dark"} theme`,children:[o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e==="dark"?o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"12",cy:"12",r:"5"}),o.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),o.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),o.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),o.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),o.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),o.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),o.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),o.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]}):o.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),o.jsx("span",{children:e==="dark"?"Dark":"Light"})]})]})}function qc(){const{navigate:e}=Ve(),t=ve(u=>u.entrypoints),[n,r]=E.useState(""),[s,a]=E.useState(!0),[i,l]=E.useState(null);E.useEffect(()=>{!n&&t.length>0&&r(t[0])},[t,n]),E.useEffect(()=>{n&&(a(!0),l(null),xc(n).then(u=>{var p;const d=(p=u.input)==null?void 0:p.properties;a(!!(d!=null&&d.messages))}).catch(u=>{const d=u.detail||{};l(d.error||d.message||`Failed to load entrypoint "${n}"`)}))},[n]);const c=u=>{n&&e(`#/setup/${encodeURIComponent(n)}/${u}`)};return o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsxs("div",{className:"w-full max-w-xl px-6",children:[o.jsxs("div",{className:"mb-8 text-center",children:[o.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[o.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:i?"var(--error)":"var(--accent)"}}),o.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--text-muted)"},children:"New Run"})]}),!i&&o.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:t.length>1?"Select an entrypoint and choose a mode":"Choose a mode"})]}),t.length>1&&o.jsxs("div",{className:"mb-8",children:[o.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Entrypoint"}),o.jsx("select",{id:"entrypoint-select",value:n,onChange:u=>r(u.target.value),className:"w-full rounded-md px-3 py-2 text-xs font-mono cursor-pointer appearance-auto",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)",color:"var(--text-primary)"},children:t.map(u=>o.jsx("option",{value:u,children:u},u))})]}),i?o.jsxs("div",{className:"rounded-md border overflow-hidden",style:{borderColor:"color-mix(in srgb, var(--error) 25%, var(--border))",background:"var(--bg-secondary)"},children:[o.jsxs("div",{className:"px-3 py-2 flex items-center gap-2",style:{borderBottom:"1px solid color-mix(in srgb, var(--error) 15%, var(--border))",background:"color-mix(in srgb, var(--error) 4%, var(--bg-secondary))"},children:[o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:o.jsx("path",{d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM7.25 4.75h1.5v4h-1.5v-4zm.75 6.75a.75.75 0 110-1.5.75.75 0 010 1.5z",fill:"var(--error)"})}),o.jsx("span",{className:"text-[11px] font-medium",style:{color:"var(--error)"},children:"Failed to load entrypoint"})]}),o.jsx("div",{className:"overflow-auto max-h-48 p-3",children:o.jsx("pre",{className:"text-[11px] font-mono whitespace-pre-wrap break-words leading-relaxed m-0",style:{color:"var(--text-muted)"},children:i})})]}):o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(Zs,{title:"Autonomous",description:"Run the agent end-to-end. Set breakpoints to pause and inspect execution.",icon:o.jsx(Vc,{}),color:"var(--success)",onClick:()=>c("run"),disabled:!n}),o.jsx(Zs,{title:"Conversational",description:s?"Interactive chat session. Send messages and receive responses in real time.":'Requires a "messages" property in the input schema.',icon:o.jsx(Yc,{}),color:"var(--accent)",onClick:()=>c("chat"),disabled:!n||!s})]})]})})}function Zs({title:e,description:t,icon:n,color:r,onClick:s,disabled:a}){return o.jsxs("button",{onClick:s,disabled:a,className:"group flex flex-col items-center text-center p-6 rounded-md border transition-all cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"var(--bg-secondary)",borderColor:"var(--border)"},onMouseEnter:i=>{a||(i.currentTarget.style.borderColor=r,i.currentTarget.style.background=`color-mix(in srgb, ${r} 5%, var(--bg-secondary))`)},onMouseLeave:i=>{i.currentTarget.style.borderColor="var(--border)",i.currentTarget.style.background="var(--bg-secondary)"},children:[o.jsx("div",{className:"mb-4 p-3 rounded-xl transition-colors",style:{background:`color-mix(in srgb, ${r} 10%, var(--bg-primary))`,color:r},children:n}),o.jsx("h3",{className:"text-sm font-semibold mb-1.5",style:{color:"var(--text-primary)"},children:e}),o.jsx("p",{className:"text-xs leading-relaxed",style:{color:"var(--text-muted)"},children:t})]})}function Vc(){return o.jsx("svg",{width:"28",height:"28",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o.jsx("path",{d:"M23.832 15.166H22.7487C22.7487 10.9735 19.3579 7.58268 15.1654 7.58268H14.082V6.20685C14.732 5.83852 15.1654 5.13435 15.1654 4.33268C15.1654 3.14102 14.2012 2.16602 12.9987 2.16602C11.7962 2.16602 10.832 3.14102 10.832 4.33268C10.832 5.13435 11.2654 5.83852 11.9154 6.20685V7.58268H10.832C6.63953 7.58268 3.2487 10.9735 3.2487 15.166H2.16536C1.56953 15.166 1.08203 15.6535 1.08203 16.2493V19.4993C1.08203 20.0952 1.56953 20.5827 2.16536 20.5827H3.2487V21.666C3.2487 22.8685 4.2237 23.8327 5.41536 23.8327H20.582C21.7845 23.8327 22.7487 22.8685 22.7487 21.666V20.5827H23.832C24.4279 20.5827 24.9154 20.0952 24.9154 19.4993V16.2493C24.9154 15.6535 24.4279 15.166 23.832 15.166ZM22.7487 18.416H20.582V21.666H5.41536V18.416H3.2487V17.3327H5.41536V15.166C5.41536 12.176 7.84203 9.74935 10.832 9.74935H15.1654C18.1554 9.74935 20.582 12.176 20.582 15.166V17.3327H22.7487V18.416ZM9.20703 14.6243L11.7637 17.181L10.4854 18.4594L9.20703 17.181L7.9287 18.4594L6.65036 17.181L9.20703 14.6243ZM16.7904 14.6243L19.347 17.181L18.0687 18.4594L16.7904 17.181L15.512 18.4594L14.2337 17.181L16.7904 14.6243Z",fill:"currentColor"})})}function Yc(){return o.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("path",{d:"M9.20901 13.541L11.7657 16.0977L10.4873 17.376L9.20901 16.0977L7.93068 17.376L6.65234 16.0977L9.20901 13.541ZM16.7923 13.541L19.349 16.0977L18.0707 17.376L16.7923 16.0977L15.514 17.376L14.2357 16.0977L16.7923 13.541Z",fill:"currentColor"}),o.jsx("path",{d:"M5.25 8.58398H20.75C21.3023 8.58398 21.75 9.0317 21.75 9.58398V23.5293L16.874 21.9043C16.5683 21.8024 16.248 21.751 15.9258 21.751H5.25C4.69782 21.751 4.25018 21.3031 4.25 20.751V9.58398C4.25 9.0317 4.69772 8.58398 5.25 8.58398Z",stroke:"currentColor",strokeWidth:"2"}),o.jsx("ellipse",{cx:"12.9987",cy:"4.33268",rx:"2.16667",ry:"2.16667",fill:"currentColor"}),o.jsx("rect",{x:"11.918",y:"5.41602",width:"2.16667",height:"2.16667",fill:"currentColor"}),o.jsx("path",{d:"M1.08203 14C1.08203 13.4477 1.52975 13 2.08203 13H3.2487V18.4167H2.08203C1.52975 18.4167 1.08203 17.969 1.08203 17.4167V14Z",fill:"currentColor"}),o.jsx("rect",{x:"3.25",y:"15.166",width:"2.16667",height:"1.08333",fill:"currentColor"}),o.jsx("path",{d:"M22.75 13H23.9167C24.4689 13 24.9167 13.4477 24.9167 14V17.4167C24.9167 17.969 24.469 18.4167 23.9167 18.4167H22.75V13Z",fill:"currentColor"}),o.jsx("rect",{x:"20.582",y:"15.166",width:"2.16667",height:"1.08333",fill:"currentColor"})]})}const Xc="modulepreload",Zc=function(e){return"/"+e},Js={},zi=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let i=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));s=i(n.map(u=>{if(u=Zc(u),u in Js)return;Js[u]=!0;const d=u.endsWith(".css"),p=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${p}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":Xc,d||(m.as="script"),m.crossOrigin="",m.href=u,c&&m.setAttribute("nonce",c),document.head.appendChild(m),d)return new Promise((f,x)=>{m.addEventListener("load",f),m.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${u}`)))})}))}function a(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return s.then(i=>{for(const l of i||[])l.status==="rejected"&&a(l.reason);return t().catch(a)})},Jc={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Qc({data:e}){const t=e.status,n=e.nodeWidth,r=e.label??"Start",s=e.hasBreakpoint,a=e.isPausedHere,i=e.isActiveNode,l=e.isExecutingNode,c=a?"var(--error)":l?"var(--success)":i?"var(--accent)":t==="completed"?"var(--success)":t==="running"?"var(--warning)":"var(--node-border)",u=a?"var(--error)":l?"var(--success)":"var(--accent)";return o.jsxs("div",{className:"px-3 py-1.5 rounded-full text-center text-xs overflow-hidden text-ellipsis whitespace-nowrap cursor-pointer relative",style:{width:n,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${c}`,boxShadow:a||i||l?`0 0 4px ${u}`:void 0,animation:a||i||l?`node-pulse-${a?"red":l?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:r,children:[s&&o.jsx("div",{className:"absolute",style:{top:2,left:2,width:12,height:12,borderRadius:"50%",background:"var(--error)",border:"2px solid var(--node-bg)",boxShadow:"0 0 4px var(--error)"}}),r,o.jsx(xt,{type:"source",position:bt.Bottom,style:Jc})]})}const eu={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function tu({data:e}){const t=e.status,n=e.nodeWidth,r=e.label??"End",s=e.hasBreakpoint,a=e.isPausedHere,i=e.isActiveNode,l=e.isExecutingNode,c=a?"var(--error)":l?"var(--success)":i?"var(--accent)":t==="completed"?"var(--success)":t==="failed"?"var(--error)":"var(--node-border)",u=a?"var(--error)":l?"var(--success)":"var(--accent)";return o.jsxs("div",{className:"px-3 py-1.5 rounded-full text-center text-xs overflow-hidden text-ellipsis whitespace-nowrap cursor-pointer relative",style:{width:n,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${c}`,boxShadow:a||i||l?`0 0 4px ${u}`:void 0,animation:a||i||l?`node-pulse-${a?"red":l?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:r,children:[s&&o.jsx("div",{className:"absolute",style:{top:2,left:2,width:12,height:12,borderRadius:"50%",background:"var(--error)",border:"2px solid var(--node-bg)",boxShadow:"0 0 4px var(--error)"}}),o.jsx(xt,{type:"target",position:bt.Top,style:eu}),r]})}const Qs={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function nu({data:e}){const t=e.status,n=e.nodeWidth,r=e.model_name,s=e.label??"Model",a=e.hasBreakpoint,i=e.isPausedHere,l=e.isActiveNode,c=e.isExecutingNode,u=i?"var(--error)":c?"var(--success)":l?"var(--accent)":t==="completed"?"var(--success)":t==="running"?"var(--warning)":t==="failed"?"var(--error)":"var(--node-border)",d=i?"var(--error)":c?"var(--success)":"var(--accent)";return o.jsxs("div",{className:"px-3 py-1.5 rounded-lg text-center text-xs overflow-hidden cursor-pointer relative",style:{width:n,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${u}`,boxShadow:i||l||c?`0 0 4px ${d}`:void 0,animation:i||l||c?`node-pulse-${i?"red":c?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:r?`${s}
+${r}`:s,children:[a&&o.jsx("div",{className:"absolute",style:{top:2,left:2,width:12,height:12,borderRadius:"50%",background:"var(--error)",border:"2px solid var(--node-bg)",boxShadow:"0 0 4px var(--error)"}}),o.jsx(xt,{type:"target",position:bt.Top,style:Qs}),o.jsx("div",{style:{color:"var(--info)",fontSize:9,marginBottom:1},children:"model"}),o.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:s}),r&&o.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",style:{color:"var(--text-muted)",fontSize:9,marginTop:1},title:r,children:r}),o.jsx(xt,{type:"source",position:bt.Bottom,style:Qs})]})}const eo={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0},ru=3;function su({data:e}){const t=e.status,n=e.nodeWidth,r=e.tool_names,s=e.tool_count,a=e.label??"Tool",i=e.hasBreakpoint,l=e.isPausedHere,c=e.isActiveNode,u=e.isExecutingNode,d=l?"var(--error)":u?"var(--success)":c?"var(--accent)":t==="completed"?"var(--success)":t==="running"?"var(--warning)":t==="failed"?"var(--error)":"var(--node-border)",p=l?"var(--error)":u?"var(--success)":"var(--accent)",m=(r==null?void 0:r.slice(0,ru))??[],f=(s??(r==null?void 0:r.length)??0)-m.length;return o.jsxs("div",{className:"px-3 py-1.5 rounded-lg text-center text-xs overflow-hidden cursor-pointer relative",style:{width:n,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${d}`,boxShadow:l||c||u?`0 0 4px ${p}`:void 0,animation:l||c||u?`node-pulse-${l?"red":u?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:r!=null&&r.length?`${a}
+
+${r.join(`
+`)}`:a,children:[i&&o.jsx("div",{className:"absolute",style:{top:2,left:2,width:12,height:12,borderRadius:"50%",background:"var(--error)",border:"2px solid var(--node-bg)",boxShadow:"0 0 4px var(--error)"}}),o.jsx(xt,{type:"target",position:bt.Top,style:eo}),o.jsxs("div",{style:{color:"var(--warning)",fontSize:9,marginBottom:1},children:["tools",s?` (${s})`:""]}),o.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:a}),m.length>0&&o.jsxs("div",{style:{marginTop:3,fontSize:9,color:"var(--text-muted)",textAlign:"left"},children:[m.map(x=>o.jsx("div",{className:"truncate",children:x},x)),f>0&&o.jsxs("div",{style:{fontStyle:"italic"},children:["+",f," more"]})]}),o.jsx(xt,{type:"source",position:bt.Bottom,style:eo})]})}const to={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function ou({data:e}){const t=e.label??"",n=e.status,r=e.hasBreakpoint,s=e.isPausedHere,a=e.isActiveNode,i=e.isExecutingNode,l=s?"var(--error)":i?"var(--success)":a?"var(--accent)":n==="completed"?"var(--success)":n==="running"?"var(--warning)":n==="failed"?"var(--error)":"var(--bg-tertiary)",c=s?"var(--error)":i?"var(--success)":"var(--accent)";return o.jsxs("div",{className:"relative cursor-pointer",style:{width:"100%",height:"100%",background:"var(--bg-secondary)",border:`1.5px ${s||a||i?"solid":"dashed"} ${l}`,borderRadius:8,boxShadow:s||a||i?`0 0 4px ${c}`:void 0,animation:s||a||i?`node-pulse-${s?"red":i?"green":"accent"} 1.5s ease-in-out infinite`:void 0},children:[r&&o.jsx("div",{className:"absolute",style:{top:4,left:4,width:12,height:12,borderRadius:"50%",background:"var(--error)",border:"2px solid var(--bg-tertiary)",boxShadow:"0 0 4px var(--error)",zIndex:1}}),o.jsx(xt,{type:"target",position:bt.Top,style:to}),o.jsx("div",{style:{padding:"4px 10px",fontSize:10,color:"var(--text-muted)",fontWeight:600,textAlign:"center",borderBottom:`1px solid ${l}`,background:"var(--bg-tertiary)",borderRadius:"8px 8px 0 0"},children:t}),o.jsx(xt,{type:"source",position:bt.Bottom,style:to})]})}function iu({data:e}){const t=e.status,n=e.nodeWidth,r=e.label??"",s=e.hasBreakpoint,a=e.isPausedHere,i=e.isActiveNode,l=e.isExecutingNode,c=a?"var(--error)":l?"var(--success)":i?"var(--accent)":t==="completed"?"var(--success)":t==="running"?"var(--warning)":t==="failed"?"var(--error)":"var(--node-border)",u=a?"var(--error)":l?"var(--success)":"var(--accent)";return o.jsxs("div",{className:"px-3 py-1.5 rounded-lg text-center text-xs overflow-hidden cursor-pointer relative",style:{width:n,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${c}`,boxShadow:a||i||l?`0 0 4px ${u}`:void 0,animation:a||i||l?`node-pulse-${a?"red":l?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:r,children:[s&&o.jsx("div",{className:"absolute",style:{top:2,left:2,width:12,height:12,borderRadius:"50%",background:"var(--error)",border:"2px solid var(--node-bg)",boxShadow:"0 0 4px var(--error)"}}),o.jsx(xt,{type:"target",position:bt.Top}),o.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:r}),o.jsx(xt,{type:"source",position:bt.Bottom})]})}function au(e,t=8){if(e.length<2)return"";if(e.length===2)return`M ${e[0].x} ${e[0].y} L ${e[1].x} ${e[1].y}`;let n=`M ${e[0].x} ${e[0].y}`;for(let s=1;s0&&(n+=Math.min(r.length,3)*12+(r.length>3?12:0)+4),e!=null&&e.model_name&&(n+=14),n}let br=null;async function mu(){if(!br){const{default:e}=await zi(async()=>{const{default:t}=await import("./vendor-elk-BkmlSRbk.js").then(n=>n.e);return{default:t}},__vite__mapDeps([0,1]));br=new e}return br}const so={"elk.algorithm":"layered","elk.direction":"DOWN","elk.edgeRouting":"ORTHOGONAL","elk.layered.crossingMinimization.strategy":"LAYER_SWEEP","elk.layered.nodePlacement.strategy":"NETWORK_SIMPLEX","elk.spacing.nodeNode":"25","elk.layered.spacing.nodeNodeBetweenLayers":"50","elk.spacing.edgeNode":"30","elk.spacing.edgeEdge":"15","elk.layered.spacing.edgeNodeBetweenLayers":"25","elk.layered.spacing.edgeEdgeBetweenLayers":"15","elk.portAlignment.default":"CENTER","elk.layered.considerModelOrder.strategy":"NODES_AND_EDGES"},hu="[top=35,left=15,bottom=15,right=15]";function gu(e){const t=[],n=[];for(const r of e.nodes){const s=r.data,a={id:r.id,width:no(s),height:ro(s,r.type)};if(r.data.subgraph){const i=r.data.subgraph;delete a.width,delete a.height,a.layoutOptions={...so,"elk.padding":hu},a.children=i.nodes.map(l=>({id:`${r.id}/${l.id}`,width:no(l.data),height:ro(l.data,l.type)})),a.edges=i.edges.map(l=>({id:`${r.id}/${l.id}`,sources:[`${r.id}/${l.source}`],targets:[`${r.id}/${l.target}`]}))}t.push(a)}for(const r of e.edges)n.push({id:r.id,sources:[r.source],targets:[r.target]});return{id:"root",layoutOptions:so,children:t,edges:n}}const Wr={type:ec.ArrowClosed,width:12,height:12,color:"var(--node-border)"};function Ui(e){return{stroke:"var(--node-border)",strokeWidth:1.5,...e?{strokeDasharray:"6 3"}:{}}}function oo(e,t,n,r,s){var u;const a=(u=e.sections)==null?void 0:u[0],i=(s==null?void 0:s.x)??0,l=(s==null?void 0:s.y)??0;let c;if(a)c={sourcePoint:{x:a.startPoint.x+i,y:a.startPoint.y+l},targetPoint:{x:a.endPoint.x+i,y:a.endPoint.y+l},bendPoints:(a.bendPoints??[]).map(d=>({x:d.x+i,y:d.y+l}))};else{const d=t.get(e.sources[0]),p=t.get(e.targets[0]);d&&p&&(c={sourcePoint:{x:d.x+d.width/2,y:d.y+d.height},targetPoint:{x:p.x+p.width/2,y:p.y},bendPoints:[]})}return{id:e.id,source:e.sources[0],target:e.targets[0],type:"elk",data:c,style:Ui(r),markerEnd:Wr,...n?{label:n,labelStyle:{fill:"var(--text-muted)",fontSize:10},labelBgStyle:{fill:"var(--bg-primary)",fillOpacity:.8}}:{}}}async function xu(e){var c,u;const t=gu(e),r=await(await mu()).layout(t),s=new Map;for(const d of e.nodes)if(s.set(d.id,{type:d.type,data:d.data}),d.data.subgraph)for(const p of d.data.subgraph.nodes)s.set(`${d.id}/${p.id}`,{type:p.type,data:p.data});const a=[],i=[],l=new Map;for(const d of r.children??[]){const p=d.x??0,m=d.y??0;l.set(d.id,{x:p,y:m,width:d.width??0,height:d.height??0});for(const f of d.children??[])l.set(f.id,{x:p+(f.x??0),y:m+(f.y??0),width:f.width??0,height:f.height??0})}for(const d of r.children??[]){const p=s.get(d.id);if((((c=d.children)==null?void 0:c.length)??0)>0){a.push({id:d.id,type:"groupNode",data:{...(p==null?void 0:p.data)??{},nodeWidth:d.width,nodeHeight:d.height},position:{x:d.x??0,y:d.y??0},style:{width:d.width,height:d.height}});for(const h of d.children??[]){const v=s.get(h.id);a.push({id:h.id,type:(v==null?void 0:v.type)??"defaultNode",data:{...(v==null?void 0:v.data)??{},nodeWidth:h.width},position:{x:h.x??0,y:h.y??0},parentNode:d.id,extent:"parent"})}const f=d.x??0,x=d.y??0;for(const h of d.edges??[]){const v=e.nodes.find(b=>b.id===d.id),y=(u=v==null?void 0:v.data.subgraph)==null?void 0:u.edges.find(b=>`${d.id}/${b.id}`===h.id);i.push(oo(h,l,y==null?void 0:y.label,y==null?void 0:y.conditional,{x:f,y:x}))}}else a.push({id:d.id,type:(p==null?void 0:p.type)??"defaultNode",data:{...(p==null?void 0:p.data)??{},nodeWidth:d.width},position:{x:d.x??0,y:d.y??0}})}for(const d of r.edges??[]){const p=e.edges.find(m=>m.id===d.id);i.push(oo(d,l,p==null?void 0:p.label,p==null?void 0:p.conditional))}return{nodes:a,edges:i}}function qn({entrypoint:e,runId:t,breakpointNode:n,breakpointNextNodes:r,onBreakpointChange:s}){const[a,i,l]=tc([]),[c,u,d]=nc([]),[p,m]=E.useState(!0),[f,x]=E.useState(!1),[h,v]=E.useState(0),y=E.useRef(0),b=E.useRef(null),A=ve(_=>_.breakpoints[t]),I=ve(_=>_.toggleBreakpoint),L=ve(_=>_.clearBreakpoints),T=ve(_=>_.activeNodes[t]),B=ve(_=>{var w;return(w=_.runs[t])==null?void 0:w.status}),D=E.useCallback((_,w)=>{if(w.type==="startNode"||w.type==="endNode")return;const R=w.type==="groupNode"?w.id:w.id.includes("/")?w.id.split("/").pop():w.id;I(t,R);const H=ve.getState().breakpoints[t]??{};s==null||s(Object.keys(H))},[t,I,s]),C=A&&Object.keys(A).length>0,S=E.useCallback(()=>{if(C)L(t),s==null||s([]);else{const _=[];for(const R of a){if(R.type==="startNode"||R.type==="endNode"||R.parentNode)continue;const H=R.type==="groupNode"?R.id:R.id.includes("/")?R.id.split("/").pop():R.id;_.push(H)}for(const R of _)A!=null&&A[R]||I(t,R);const w=ve.getState().breakpoints[t]??{};s==null||s(Object.keys(w))}},[t,C,A,a,L,I,s]);E.useEffect(()=>{i(_=>_.map(w=>{var z;if(w.type==="startNode"||w.type==="endNode")return w;const R=w.type==="groupNode"?w.id:w.id.includes("/")?w.id.split("/").pop():w.id,H=!!(A&&A[R]);return H!==!!((z=w.data)!=null&&z.hasBreakpoint)?{...w,data:{...w.data,hasBreakpoint:H}}:w}))},[A,i]),E.useEffect(()=>{const _=n?new Set(n.split(",").map(w=>w.trim()).filter(Boolean)):null;i(w=>w.map(R=>{var g,F;if(R.type==="startNode"||R.type==="endNode")return R;const H=R.type==="groupNode"?R.id:R.id.includes("/")?R.id.split("/").pop():R.id,z=(g=R.data)==null?void 0:g.label,q=_!=null&&(_.has(H)||z!=null&&_.has(z));return q!==!!((F=R.data)!=null&&F.isPausedHere)?{...R,data:{...R.data,isPausedHere:q}}:R}))},[n,h,i]);const N=ve(_=>_.stateEvents[t]);E.useEffect(()=>{const _=!!n;let w=new Set;const R=new Set,H=new Set,z=new Set,q=new Map,g=new Map;if(N)for(const F of N)F.phase==="started"?g.set(F.node_name,F.qualified_node_name??null):F.phase==="completed"&&g.delete(F.node_name);i(F=>{var k;for(const se of F)se.type&&q.set(se.id,se.type);const K=se=>{var U;const G=[];for(const re of F){const de=re.type==="groupNode"?re.id:re.id.includes("/")?re.id.split("/").pop():re.id,be=(U=re.data)==null?void 0:U.label;(de===se||be!=null&&be===se)&&G.push(re.id)}return G};if(_&&n){const se=n.split(",").map(G=>G.trim()).filter(Boolean);for(const G of se)K(G).forEach(U=>w.add(U));if(r!=null&&r.length)for(const G of r)K(G).forEach(U=>H.add(U));T!=null&&T.prev&&K(T.prev).forEach(G=>R.add(G))}else if(g.size>0){const se=new Map;for(const G of F){const U=(k=G.data)==null?void 0:k.label;if(!U)continue;const re=G.id.includes("/")?G.id.split("/").pop():G.id;for(const de of[re,U]){let be=se.get(de);be||(be=new Set,se.set(de,be)),be.add(G.id)}}for(const[G,U]of g){let re=!1;if(U){const de=U.replace(/:/g,"/");for(const be of F)be.id===de&&(w.add(be.id),re=!0)}if(!re){const de=se.get(G);de&&de.forEach(be=>w.add(be))}}}return F}),u(F=>{const K=R.size===0||F.some(k=>w.has(k.target)&&R.has(k.source));return F.map(k=>{var G,U;let se;return _?se=w.has(k.target)&&(R.size===0||!K||R.has(k.source))||w.has(k.source)&&H.has(k.target):(se=w.has(k.source),!se&&q.get(k.target)==="endNode"&&w.has(k.target)&&(se=!0)),se?(_||z.add(k.target),{...k,style:{stroke:"var(--accent)",strokeWidth:2.5},markerEnd:{...Wr,color:"var(--accent)"},data:{...k.data,highlighted:!0},animated:!0}):(G=k.data)!=null&&G.highlighted?{...k,style:Ui((U=k.data)==null?void 0:U.conditional),markerEnd:Wr,data:{...k.data,highlighted:!1},animated:!1}:k})}),i(F=>F.map(K=>{var G,U,re,de;const k=!_&&w.has(K.id);if(K.type==="startNode"||K.type==="endNode"){const be=z.has(K.id)||!_&&w.has(K.id);return be!==!!((G=K.data)!=null&&G.isActiveNode)||k!==!!((U=K.data)!=null&&U.isExecutingNode)?{...K,data:{...K.data,isActiveNode:be,isExecutingNode:k}}:K}const se=_?H.has(K.id):z.has(K.id);return se!==!!((re=K.data)!=null&&re.isActiveNode)||k!==!!((de=K.data)!=null&&de.isExecutingNode)?{...K,data:{...K.data,isActiveNode:se,isExecutingNode:k}}:K}))},[N,T,n,r,B,h,i,u]);const O=ve(_=>_.graphCache[t]);E.useEffect(()=>{if(!O&&t!=="__setup__")return;const _=O?Promise.resolve(O):yc(e),w=++y.current;m(!0),x(!1),_.then(async R=>{if(y.current!==w)return;if(!R.nodes.length){x(!0);return}const{nodes:H,edges:z}=await xu(R);if(y.current!==w)return;const q=ve.getState().breakpoints[t],g=q?H.map(F=>{if(F.type==="startNode"||F.type==="endNode")return F;const K=F.type==="groupNode"?F.id:F.id.includes("/")?F.id.split("/").pop():F.id;return q[K]?{...F,data:{...F.data,hasBreakpoint:!0}}:F}):H;i(g),u(z),v(F=>F+1),setTimeout(()=>{var F;(F=b.current)==null||F.fitView({padding:.1,duration:200})},100)}).catch(()=>{y.current===w&&x(!0)}).finally(()=>{y.current===w&&m(!1)})},[e,t,O,i,u]),E.useEffect(()=>{const _=setTimeout(()=>{var w;(w=b.current)==null||w.fitView({padding:.1,duration:200})},100);return()=>clearTimeout(_)},[t]);const M=E.useRef(null);return E.useEffect(()=>{const _=M.current;if(!_)return;const w=new ResizeObserver(()=>{var R;(R=b.current)==null||R.fitView({padding:.1,duration:200})});return w.observe(_),()=>w.disconnect()},[p,f]),E.useEffect(()=>{i(_=>{var k,se,G;const w=!!(N!=null&&N.length),R=B==="completed"||B==="failed",H=new Set,z=new Set(_.map(U=>U.id)),q=new Map;for(const U of _){const re=(k=U.data)==null?void 0:k.label;if(!re)continue;const de=U.id.includes("/")?U.id.split("/").pop():U.id;for(const be of[de,re]){let je=q.get(be);je||(je=new Set,q.set(be,je)),je.add(U.id)}}if(w)for(const U of N){let re=!1;if(U.qualified_node_name){const de=U.qualified_node_name.replace(/:/g,"/");z.has(de)&&(H.add(de),re=!0)}if(!re){const de=q.get(U.node_name);de&&de.forEach(be=>H.add(be))}}const g=new Set;for(const U of _)U.parentNode&&H.has(U.id)&&g.add(U.parentNode);let F;B==="failed"&&H.size===0&&(F=(se=_.find(U=>!U.parentNode&&U.type!=="startNode"&&U.type!=="endNode"&&U.type!=="groupNode"))==null?void 0:se.id);let K;if(B==="completed"){const U=(G=_.find(re=>!re.parentNode&&re.type!=="startNode"&&re.type!=="endNode"&&re.type!=="groupNode"))==null?void 0:G.id;U&&!H.has(U)&&(K=U)}return _.map(U=>{var de;let re;return U.id===F?re="failed":U.id===K||H.has(U.id)?re="completed":U.type==="startNode"?(!U.parentNode&&w||U.parentNode&&g.has(U.parentNode))&&(re="completed"):U.type==="endNode"?!U.parentNode&&R?re=B==="failed"?"failed":"completed":U.parentNode&&g.has(U.parentNode)&&(re="completed"):U.type==="groupNode"&&g.has(U.id)&&(re="completed"),re!==((de=U.data)==null?void 0:de.status)?{...U,data:{...U.data,status:re}}:U})})},[N,B,h,i]),p?o.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:"Loading graph..."}):f?o.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",style:{color:"var(--text-muted)"},children:[o.jsxs("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("rect",{x:"38",y:"10",width:"44",height:"24",rx:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.4"}),o.jsx("line",{x1:"60",y1:"34",x2:"60",y2:"46",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),o.jsx("rect",{x:"12",y:"46",width:"44",height:"24",rx:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),o.jsx("rect",{x:"64",y:"46",width:"44",height:"24",rx:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),o.jsx("line",{x1:"60",y1:"46",x2:"34",y2:"46",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),o.jsx("line",{x1:"60",y1:"46",x2:"86",y2:"46",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),o.jsx("line",{x1:"34",y1:"70",x2:"34",y2:"82",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),o.jsx("line",{x1:"86",y1:"70",x2:"86",y2:"82",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),o.jsx("line",{x1:"34",y1:"82",x2:"60",y2:"82",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),o.jsx("line",{x1:"86",y1:"82",x2:"60",y2:"82",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),o.jsx("line",{x1:"60",y1:"82",x2:"60",y2:"86",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),o.jsx("rect",{x:"38",y:"86",width:"44",height:"24",rx:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.4"})]}),o.jsx("span",{className:"text-xs",children:"No graph schema available"})]}):o.jsxs("div",{ref:M,className:"h-full graph-panel",children:[o.jsx("style",{children:`
+ .graph-panel .react-flow__handle {
+ opacity: 0 !important;
+ width: 0 !important;
+ height: 0 !important;
+ min-width: 0 !important;
+ min-height: 0 !important;
+ border: none !important;
+ pointer-events: none !important;
+ }
+ .graph-panel .react-flow__edges {
+ overflow: visible !important;
+ z-index: 1 !important;
+ }
+ .graph-panel .react-flow__edge.animated path {
+ stroke-dasharray: 8 4;
+ animation: edge-flow 0.6s linear infinite;
+ }
+ @keyframes edge-flow {
+ to { stroke-dashoffset: -12; }
+ }
+ @keyframes node-pulse-accent {
+ 0%, 100% { box-shadow: 0 0 4px var(--accent); }
+ 50% { box-shadow: 0 0 10px var(--accent); }
+ }
+ @keyframes node-pulse-green {
+ 0%, 100% { box-shadow: 0 0 4px var(--success); }
+ 50% { box-shadow: 0 0 10px var(--success); }
+ }
+ @keyframes node-pulse-red {
+ 0%, 100% { box-shadow: 0 0 4px var(--error); }
+ 50% { box-shadow: 0 0 10px var(--error); }
+ }
+ `}),o.jsxs(rc,{nodes:a,edges:c,onNodesChange:l,onEdgesChange:d,nodeTypes:cu,edgeTypes:uu,onInit:_=>{b.current=_},onNodeClick:D,fitView:!0,proOptions:{hideAttribution:!0},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,children:[o.jsx(sc,{color:"var(--bg-tertiary)",gap:16}),o.jsx(oc,{showInteractive:!1}),o.jsx(ic,{position:"top-right",children:o.jsxs("button",{onClick:S,title:C?"Remove all breakpoints":"Set breakpoints on all nodes",style:{background:"var(--bg-secondary)",color:C?"var(--error)":"var(--text-muted)",border:`1px solid ${C?"var(--error)":"var(--node-border)"}`,borderRadius:6,padding:"4px 10px",fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",gap:4},children:[o.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:C?"var(--error)":"var(--node-border)"}}),C?"Clear all":"Break all"]})}),o.jsx(ac,{nodeColor:_=>{var R;if(_.type==="groupNode")return"var(--bg-tertiary)";const w=(R=_.data)==null?void 0:R.status;return w==="completed"?"var(--success)":w==="running"?"var(--warning)":w==="failed"?"var(--error)":"var(--node-border)"},nodeStrokeWidth:0,style:{background:"var(--bg-secondary)",width:120,height:80}})]})]})}const zt="__setup__";function bu({entrypoint:e,mode:t,ws:n,onRunCreated:r,isMobile:s}){const[a,i]=E.useState("{}"),[l,c]=E.useState({}),[u,d]=E.useState(!1),[p,m]=E.useState(!0),[f,x]=E.useState(null),[h,v]=E.useState(""),[y,b]=E.useState(!0),[A,I]=E.useState(()=>{const R=localStorage.getItem("setupTextareaHeight");return R?parseInt(R,10):140}),L=E.useRef(null),[T,B]=E.useState(()=>{const R=localStorage.getItem("setupPanelWidth");return R?parseInt(R,10):380}),D=t==="run";E.useEffect(()=>{m(!0),x(null),bc(e).then(R=>{c(R.mock_input),i(JSON.stringify(R.mock_input,null,2))}).catch(R=>{console.error("Failed to load mock input:",R);const H=R.detail||{};x(H.message||`Failed to load schema for "${e}"`),i("{}")}).finally(()=>m(!1))},[e]),E.useEffect(()=>{ve.getState().clearBreakpoints(zt)},[]);const C=async()=>{let R;try{R=JSON.parse(a)}catch{alert("Invalid JSON input");return}d(!0);try{const H=ve.getState().breakpoints[zt]??{},z=Object.keys(H),q=await Gs(e,R,t,z);ve.getState().clearBreakpoints(zt),ve.getState().upsertRun(q),r(q.id)}catch(H){console.error("Failed to create run:",H)}finally{d(!1)}},S=async()=>{const R=h.trim();if(R){d(!0);try{const H=ve.getState().breakpoints[zt]??{},z=Object.keys(H),q=await Gs(e,l,"chat",z);ve.getState().clearBreakpoints(zt),ve.getState().upsertRun(q),ve.getState().addLocalChatMessage(q.id,{message_id:`local-${Date.now()}`,role:"user",content:R}),n.sendChatMessage(q.id,R),r(q.id)}catch(H){console.error("Failed to create chat run:",H)}finally{d(!1)}}};E.useEffect(()=>{try{JSON.parse(a),b(!0)}catch{b(!1)}},[a]);const N=E.useCallback(R=>{R.preventDefault();const H="touches"in R?R.touches[0].clientY:R.clientY,z=A,q=F=>{const K="touches"in F?F.touches[0].clientY:F.clientY,k=Math.max(60,z+(H-K));I(k)},g=()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",g),document.removeEventListener("touchmove",q),document.removeEventListener("touchend",g),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("setupTextareaHeight",String(A))};document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",q),document.addEventListener("mouseup",g),document.addEventListener("touchmove",q,{passive:!1}),document.addEventListener("touchend",g)},[A]),O=E.useCallback(R=>{R.preventDefault();const H="touches"in R?R.touches[0].clientX:R.clientX,z=T,q=F=>{const K=L.current;if(!K)return;const k="touches"in F?F.touches[0].clientX:F.clientX,se=K.clientWidth-300,G=Math.max(280,Math.min(se,z+(H-k)));B(G)},g=()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",g),document.removeEventListener("touchmove",q),document.removeEventListener("touchend",g),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("setupPanelWidth",String(T))};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",q),document.addEventListener("mouseup",g),document.addEventListener("touchmove",q,{passive:!1}),document.addEventListener("touchend",g)},[T]),M=D?"Autonomous":"Conversational",_=D?"var(--success)":"var(--accent)",w=o.jsxs("div",{className:"shrink-0 flex flex-col",style:s?{background:"var(--bg-primary)"}:{width:T,background:"var(--bg-primary)"},children:[o.jsxs("div",{className:"px-4 text-xs font-semibold border-b flex items-center gap-2 h-10",style:{color:"var(--text-muted)",borderColor:"var(--border)",background:"var(--bg-secondary)"},children:[o.jsx("span",{style:{color:_},children:"●"}),M]}),o.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col items-center justify-center gap-4 px-6",children:[o.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--text-muted)",opacity:.5},children:D?o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("polyline",{points:"12 6 12 12 16 14"})]}):o.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),o.jsxs("div",{className:"text-center space-y-1.5",children:[o.jsx("p",{className:"text-sm font-medium",style:{color:"var(--text-secondary)"},children:D?"Ready to execute":"Ready to chat"}),o.jsxs("p",{className:"text-xs leading-relaxed",style:{color:"var(--text-muted)"},children:["Click nodes to set breakpoints",D?o.jsxs(o.Fragment,{children:[",",o.jsx("br",{}),"configure input below, then run"]}):o.jsxs(o.Fragment,{children:[",",o.jsx("br",{}),"then send your first message"]})]})]})]}),D?o.jsxs("div",{className:"flex flex-col",style:{background:"var(--bg-primary)"},children:[!s&&o.jsx("div",{onMouseDown:N,onTouchStart:N,className:"shrink-0 drag-handle-row"}),o.jsxs("div",{className:"px-4 py-3",children:[f?o.jsx("div",{className:"text-xs mb-3 px-3 py-2 rounded",style:{color:"var(--error)",background:"color-mix(in srgb, var(--error) 10%, var(--bg-secondary))"},children:f}):o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:["Input",p&&o.jsx("span",{className:"ml-2 font-normal",children:"Loading..."})]}),o.jsx("textarea",{value:a,onChange:R=>i(R.target.value),spellCheck:!1,className:"w-full rounded-md px-3 py-2 text-xs font-mono leading-relaxed resize-none mb-3",style:{height:s?120:A,background:"var(--bg-secondary)",border:`1px solid ${y?"var(--border)":"#b91c1c"}`,color:"var(--text-primary)"}})]}),o.jsx("button",{onClick:C,disabled:u||p||!!f,className:"w-full py-2 text-sm font-semibold rounded-md border cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed transition-colors flex items-center justify-center gap-2",style:{background:"transparent",borderColor:_,color:_},onMouseEnter:R=>{u||(R.currentTarget.style.background=`color-mix(in srgb, ${_} 10%, transparent)`)},onMouseLeave:R=>{R.currentTarget.style.background="transparent"},children:u?"Starting...":o.jsxs(o.Fragment,{children:[o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",children:o.jsx("polygon",{points:"5,3 19,12 5,21"})}),"Execute"]})})]})]}):o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-t",style:{borderColor:"var(--border)"},children:[o.jsx("input",{value:h,onChange:R=>v(R.target.value),onKeyDown:R=>{R.key==="Enter"&&!R.shiftKey&&(R.preventDefault(),S())},disabled:u||p,placeholder:u?"Starting...":"Message...",className:"flex-1 bg-transparent text-sm py-1 disabled:opacity-40 placeholder:text-[var(--text-muted)]",style:{color:"var(--text-primary)"}}),o.jsx("button",{onClick:S,disabled:u||p||!h.trim(),className:"text-xs font-semibold px-3 py-1.5 rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed",style:{color:!u&&h.trim()?"var(--accent)":"var(--text-muted)",background:"transparent"},onMouseEnter:R=>{!u&&h.trim()&&(R.currentTarget.style.background="color-mix(in srgb, var(--accent) 10%, transparent)")},onMouseLeave:R=>{R.currentTarget.style.background="transparent"},children:"Send"})]})]});return s?o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsx("div",{className:"shrink-0",style:{height:"40vh"},children:o.jsx(qn,{entrypoint:e,traces:[],runId:zt})}),o.jsx("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:w})]}):o.jsxs("div",{ref:L,className:"flex h-full",children:[o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx(qn,{entrypoint:e,traces:[],runId:zt})}),o.jsx("div",{onMouseDown:O,onTouchStart:O,className:"shrink-0 drag-handle-col"}),w]})}const yu={key:"var(--info)",string:"var(--success)",number:"var(--warning)",boolean:"var(--accent)",null:"var(--accent)",punctuation:"var(--text-muted)"};function vu(e){const t=[],n=/("(?:[^"\\]|\\.)*")\s*:|("(?:[^"\\]|\\.)*")|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)\b|(true|false)\b|(null)\b|([{}[\]:,])/g;let r=0,s;for(;(s=n.exec(e))!==null;){if(s.index>r&&t.push({type:"punctuation",text:e.slice(r,s.index)}),s[1]!==void 0){t.push({type:"key",text:s[1]});const a=e.indexOf(":",s.index+s[1].length);a!==-1&&(a>s.index+s[1].length&&t.push({type:"punctuation",text:e.slice(s.index+s[1].length,a)}),t.push({type:"punctuation",text:":"}),n.lastIndex=a+1)}else s[2]!==void 0?t.push({type:"string",text:s[2]}):s[3]!==void 0?t.push({type:"number",text:s[3]}):s[4]!==void 0?t.push({type:"boolean",text:s[4]}):s[5]!==void 0?t.push({type:"null",text:s[5]}):s[6]!==void 0&&t.push({type:"punctuation",text:s[6]});r=n.lastIndex}return rvu(e),[e]);return o.jsx("pre",{className:t,style:n,children:r.map((s,a)=>o.jsx("span",{style:{color:yu[s.type]},children:s.text},a))})}const ku={started:{color:"var(--info)",label:"Started"},running:{color:"var(--warning)",label:"Running"},completed:{color:"var(--success)",label:"Completed"},failed:{color:"var(--error)",label:"Failed"},error:{color:"var(--error)",label:"Error"}},Eu={color:"var(--text-muted)",label:"Unknown"};function wu(e){if(typeof e!="string")return null;const t=e.trim();if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return JSON.stringify(JSON.parse(t),null,2)}catch{return null}return null}const io=200;function _u(e){if(typeof e=="string")return e;if(e==null)return String(e);try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Nu({value:e}){const[t,n]=E.useState(!1),r=_u(e),s=E.useMemo(()=>wu(e),[e]),a=s!==null,i=s??r,l=i.length>io||i.includes(`
+`),c=E.useCallback(()=>n(u=>!u),[]);return l?o.jsxs("div",{children:[t?a?o.jsx(ot,{json:i,className:"font-mono text-[11px] whitespace-pre-wrap break-all",style:{}}):o.jsx("pre",{className:"font-mono text-[11px] whitespace-pre-wrap break-all",style:{color:"var(--text-primary)"},children:i}):o.jsxs("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:[i.slice(0,io),"..."]}),o.jsx("button",{onClick:c,className:"text-[11px] cursor-pointer ml-1 px-1",style:{color:"var(--info)"},children:t?"[less]":"[more]"})]}):a?o.jsx(ot,{json:i,className:"font-mono text-[11px] break-all whitespace-pre-wrap",style:{}}):o.jsx("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:i})}function Su({span:e}){const[t,n]=E.useState(!0),[r,s]=E.useState(!1),[a,i]=E.useState("table"),[l,c]=E.useState(!1),u=ku[e.status.toLowerCase()]??{...Eu,label:e.status},d=E.useMemo(()=>JSON.stringify(e,null,2),[e]),p=E.useCallback(()=>{navigator.clipboard.writeText(d).then(()=>{c(!0),setTimeout(()=>c(!1),1500)})},[d]),m=Object.entries(e.attributes),f=[{label:"Span",value:e.span_id},...e.trace_id?[{label:"Trace",value:e.trace_id}]:[],{label:"Run",value:e.run_id},...e.parent_span_id?[{label:"Parent",value:e.parent_span_id}]:[]];return o.jsxs("div",{className:"flex flex-col h-full text-xs leading-normal",children:[o.jsxs("div",{className:"px-2 border-b flex items-center gap-1 shrink-0",style:{borderColor:"var(--border)",background:"var(--bg-secondary)",height:"32px"},children:[o.jsx("button",{onClick:()=>i("table"),className:"px-2.5 h-6 text-[11px] font-semibold rounded transition-colors cursor-pointer inline-flex items-center",style:{color:a==="table"?"var(--accent)":"var(--text-muted)",background:a==="table"?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},onMouseEnter:x=>{a!=="table"&&(x.currentTarget.style.color="var(--text-primary)")},onMouseLeave:x=>{a!=="table"&&(x.currentTarget.style.color="var(--text-muted)")},children:"Table"}),o.jsx("button",{onClick:()=>i("json"),className:"px-2.5 h-6 text-[11px] font-semibold rounded transition-colors cursor-pointer inline-flex items-center",style:{color:a==="json"?"var(--accent)":"var(--text-muted)",background:a==="json"?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},onMouseEnter:x=>{a!=="json"&&(x.currentTarget.style.color="var(--text-primary)")},onMouseLeave:x=>{a!=="json"&&(x.currentTarget.style.color="var(--text-muted)")},children:"JSON"}),o.jsxs("span",{className:"ml-auto shrink-0 inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-bold uppercase tracking-wider",style:{background:`color-mix(in srgb, ${u.color} 15%, var(--bg-secondary))`,color:u.color},children:[o.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:u.color}}),u.label]})]}),o.jsx("div",{className:"overflow-y-auto flex-1 p-0.5 pr-0 pt-0 mr-0.5 mt-0.5",children:a==="table"?o.jsxs(o.Fragment,{children:[m.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"px-2 py-1 text-[11px] uppercase font-bold tracking-wider border-b cursor-pointer flex items-center",style:{color:"var(--success)",borderColor:"var(--border)",background:"var(--bg-secondary)"},onClick:()=>n(x=>!x),children:[o.jsxs("span",{className:"flex-1",children:["Attributes (",m.length,")"]}),o.jsx("span",{style:{color:"var(--text-muted)",transform:t?"rotate(0deg)":"rotate(-90deg)"},children:"▾"})]}),t&&m.map(([x,h],v)=>o.jsxs("div",{className:"flex gap-2 px-2 py-1 items-start border-b",style:{borderColor:"var(--border)",background:v%2===0?"var(--bg-primary)":"var(--bg-secondary)"},children:[o.jsx("span",{className:"font-mono font-semibold shrink-0 pt-px truncate text-[11px]",style:{color:"var(--info)",width:"35%"},title:x,children:x}),o.jsx("span",{className:"flex-1 min-w-0",children:o.jsx(Nu,{value:h})})]},x))]}),o.jsxs("div",{className:"px-2 py-1 text-[11px] uppercase font-bold tracking-wider border-b cursor-pointer flex items-center",style:{color:"var(--success)",borderColor:"var(--border)",background:"var(--bg-secondary)"},onClick:()=>s(x=>!x),children:[o.jsxs("span",{className:"flex-1",children:["Identifiers (",f.length,")"]}),o.jsx("span",{style:{color:"var(--text-muted)",transform:r?"rotate(0deg)":"rotate(-90deg)"},children:"▾"})]}),r&&f.map((x,h)=>o.jsxs("div",{className:"flex gap-2 px-2 py-1 items-start border-b",style:{borderColor:"var(--border)",background:h%2===0?"var(--bg-primary)":"var(--bg-secondary)"},children:[o.jsx("span",{className:"font-mono font-semibold shrink-0 pt-px truncate text-[11px]",style:{color:"var(--info)",width:"35%"},title:x.label,children:x.label}),o.jsx("span",{className:"flex-1 min-w-0",children:o.jsx("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:x.value})})]},x.label))]}):o.jsxs("div",{className:"relative",children:[o.jsx("button",{onClick:p,className:"absolute top-1 right-1 z-10 text-[11px] cursor-pointer px-2 py-1 rounded transition-colors",style:{color:l?"var(--success)":"var(--text-muted)",background:"var(--bg-secondary)",border:"1px solid var(--border)"},onMouseEnter:x=>{l||(x.currentTarget.style.color="var(--text-primary)")},onMouseLeave:x=>{x.currentTarget.style.color=l?"var(--success)":"var(--text-muted)"},children:l?"Copied!":"Copy"}),o.jsx(ot,{json:d,className:"font-mono text-[11px] whitespace-pre-wrap p-2",style:{}})]})})]})}function Tu(e){const t=[];function n(r,s){t.push({span:r.span,depth:s});for(const a of r.children)n(a,s+1)}for(const r of e)n(r,0);return t}function Cu({tree:e,selectedSpan:t,onSelect:n}){const r=E.useMemo(()=>Tu(e),[e]),{globalStart:s,totalDuration:a}=E.useMemo(()=>{if(r.length===0)return{globalStart:0,totalDuration:1};let i=1/0,l=-1/0;for(const{span:c}of r){const u=new Date(c.timestamp).getTime();i=Math.min(i,u),l=Math.max(l,u+(c.duration_ms??0))}return{globalStart:i,totalDuration:Math.max(l-i,1)}},[r]);return r.length===0?null:o.jsx(o.Fragment,{children:r.map(({span:i,depth:l})=>{var h;const c=new Date(i.timestamp).getTime()-s,u=i.duration_ms??0,d=c/a*100,p=Math.max(u/a*100,.3),m=Hi[i.status.toLowerCase()]??"var(--text-muted)",f=i.span_id===(t==null?void 0:t.span_id),x=(h=i.attributes)==null?void 0:h["openinference.span.kind"];return o.jsxs("button",{"data-span-id":i.span_id,onClick:()=>n(i),className:"w-full text-left text-xs leading-normal py-1 flex items-center transition-colors",style:{background:f?"color-mix(in srgb, var(--accent) 10%, var(--bg-primary))":void 0,borderLeft:f?"2px solid var(--accent)":"2px solid transparent"},onMouseEnter:v=>{f||(v.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:v=>{f||(v.currentTarget.style.background="")},children:[o.jsxs("div",{className:"shrink-0 flex items-center gap-1 overflow-hidden",style:{width:"35%",minWidth:"80px",paddingLeft:`${l*12+4}px`},children:[o.jsx("span",{className:"shrink-0 flex items-center justify-center w-3.5 h-3.5",children:o.jsx(Wi,{kind:x,statusColor:m})}),o.jsx("span",{className:"text-[var(--text-primary)] truncate",children:i.span_name})]}),o.jsx("div",{className:"flex-1 relative h-[14px] mx-1 rounded-sm",style:{background:"var(--bg-secondary)"},children:o.jsx("div",{className:"absolute rounded-sm",style:{left:`${d}%`,width:`${p}%`,top:"2px",bottom:"2px",background:m,opacity:.8,minWidth:"2px"}})}),o.jsx("span",{className:"shrink-0 text-[10px] tabular-nums pr-2",style:{width:"52px",textAlign:"right",color:"var(--text-muted)"},children:Ki(i.duration_ms)})]},i.span_id)})})}const Hi={started:"var(--info)",running:"var(--warning)",completed:"var(--success)",failed:"var(--error)",error:"var(--error)"};function Wi({kind:e,statusColor:t}){const n=t,r=14,s={width:r,height:r,viewBox:"0 0 16 16",fill:"none",stroke:n,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"};switch(e){case"LLM":return o.jsx("svg",{...s,children:o.jsx("path",{d:"M8 2L9 5L12 4L10 7L14 8L10 9L12 12L9 11L8 14L7 11L4 12L6 9L2 8L6 7L4 4L7 5Z",fill:n,stroke:"none"})});case"TOOL":return o.jsx("svg",{...s,children:o.jsx("path",{d:"M10.5 2.5a3.5 3.5 0 0 0-3.17 4.93L3.5 11.27a1 1 0 0 0 0 1.41l.82.82a1 1 0 0 0 1.41 0l3.84-3.83A3.5 3.5 0 1 0 10.5 2.5z"})});case"AGENT":return o.jsxs("svg",{...s,children:[o.jsx("rect",{x:"3",y:"5",width:"10",height:"8",rx:"2"}),o.jsx("circle",{cx:"6",cy:"9",r:"1",fill:n,stroke:"none"}),o.jsx("circle",{cx:"10",cy:"9",r:"1",fill:n,stroke:"none"}),o.jsx("path",{d:"M8 2v3"}),o.jsx("path",{d:"M6 2h4"})]});case"CHAIN":return o.jsxs("svg",{...s,children:[o.jsx("path",{d:"M6.5 9.5L9.5 6.5"}),o.jsx("path",{d:"M4.5 8.5l-1 1a2 2 0 0 0 2.83 2.83l1-1"}),o.jsx("path",{d:"M11.5 7.5l1-1a2 2 0 0 0-2.83-2.83l-1 1"})]});case"RETRIEVER":return o.jsxs("svg",{...s,children:[o.jsx("circle",{cx:"7",cy:"7",r:"4"}),o.jsx("path",{d:"M10 10l3.5 3.5"})]});case"EMBEDDING":return o.jsxs("svg",{...s,children:[o.jsx("rect",{x:"2",y:"2",width:"4",height:"4",rx:"0.5"}),o.jsx("rect",{x:"10",y:"2",width:"4",height:"4",rx:"0.5"}),o.jsx("rect",{x:"2",y:"10",width:"4",height:"4",rx:"0.5"}),o.jsx("rect",{x:"10",y:"10",width:"4",height:"4",rx:"0.5"})]});default:return o.jsx("span",{className:"shrink-0 w-2 h-2 rounded-full",style:{background:t}})}}function Au(e){const t=new Map(e.map(i=>[i.span_id,i])),n=new Map;for(const i of e)if(i.parent_span_id){const l=n.get(i.parent_span_id)??[];l.push(i),n.set(i.parent_span_id,l)}const r=e.filter(i=>i.parent_span_id===null||!t.has(i.parent_span_id));function s(i){const l=(n.get(i.span_id)??[]).sort((c,u)=>c.timestamp.localeCompare(u.timestamp));return{span:i,children:l.map(s)}}return r.sort((i,l)=>i.timestamp.localeCompare(l.timestamp)).map(s).flatMap(i=>i.span.span_name==="root"?i.children:[i])}function Ki(e){return e==null?"":e<1e3?`${e.toFixed(0)}ms`:`${(e/1e3).toFixed(2)}s`}function Gi(e){return e.map(t=>{const{span:n}=t;return t.children.length>0?{name:n.span_name,children:Gi(t.children)}:{name:n.span_name}})}function Kr({traces:e}){const[t,n]=E.useState(null),[r,s]=E.useState(new Set),[a,i]=E.useState(()=>{const D=localStorage.getItem("traceTreeSplitWidth");return D?parseFloat(D):50}),[l,c]=E.useState(!1),[u,d]=E.useState(!1),[p,m]=E.useState(()=>localStorage.getItem("traceViewMode")||"tree"),f=Au(e),x=E.useMemo(()=>JSON.stringify(Gi(f),null,2),[e]),h=E.useCallback(()=>{navigator.clipboard.writeText(x).then(()=>{d(!0),setTimeout(()=>d(!1),1500)})},[x]),v=ve(D=>D.focusedSpan),y=ve(D=>D.setFocusedSpan),[b,A]=E.useState(null),I=E.useRef(null),L=E.useCallback(D=>{s(C=>{const S=new Set(C);return S.has(D)?S.delete(D):S.add(D),S})},[]),T=E.useRef(null);E.useEffect(()=>{const D=f.length>0?f[0].span.span_id:null,C=T.current;if(T.current=D,D&&D!==C)n(f[0].span);else if(t===null)f.length>0&&n(f[0].span);else{const S=e.find(N=>N.span_id===t.span_id);S&&S!==t&&n(S)}},[e]),E.useEffect(()=>{if(!v)return;const C=e.filter(S=>S.span_name===v.name).sort((S,N)=>S.timestamp.localeCompare(N.timestamp))[v.index];if(C){n(C),A(C.span_id);const S=new Map(e.map(N=>[N.span_id,N.parent_span_id]));s(N=>{const O=new Set(N);let M=C.parent_span_id;for(;M;)O.delete(M),M=S.get(M)??null;return O})}y(null)},[v,e,y]),E.useEffect(()=>{if(!b)return;const D=b;A(null),requestAnimationFrame(()=>{const C=I.current,S=C==null?void 0:C.querySelector(`[data-span-id="${D}"]`);C&&S&&S.scrollIntoView({block:"center",behavior:"smooth"})})},[b]),E.useEffect(()=>{if(!l)return;const D=S=>{const N=document.querySelector(".trace-tree-container");if(!N)return;const O=N.getBoundingClientRect(),M=(S.clientX-O.left)/O.width*100,_=Math.max(20,Math.min(80,M));i(_),localStorage.setItem("traceTreeSplitWidth",String(_))},C=()=>{c(!1)};return window.addEventListener("mousemove",D),window.addEventListener("mouseup",C),()=>{window.removeEventListener("mousemove",D),window.removeEventListener("mouseup",C)}},[l]);const B=D=>{D.preventDefault(),c(!0)};return o.jsxs("div",{className:"flex h-full trace-tree-container",style:{cursor:l?"col-resize":void 0},children:[o.jsxs("div",{className:"flex flex-col",style:{width:`${a}%`},children:[e.length>0&&o.jsxs("div",{className:"flex items-center gap-1 px-2 border-b shrink-0",style:{borderColor:"var(--border)",background:"var(--bg-secondary)",height:"32px"},children:[o.jsx("button",{onClick:()=>{m("tree"),localStorage.setItem("traceViewMode","tree")},className:"px-2.5 h-6 text-[11px] font-semibold rounded transition-colors cursor-pointer inline-flex items-center",style:{color:p==="tree"?"var(--accent)":"var(--text-muted)",background:p==="tree"?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},onMouseEnter:D=>{p!=="tree"&&(D.currentTarget.style.color="var(--text-primary)")},onMouseLeave:D=>{p!=="tree"&&(D.currentTarget.style.color="var(--text-muted)")},children:"Tree"}),o.jsx("button",{onClick:()=>{m("timeline"),localStorage.setItem("traceViewMode","timeline")},className:"px-2.5 h-6 text-[11px] font-semibold rounded transition-colors cursor-pointer inline-flex items-center",style:{color:p==="timeline"?"var(--accent)":"var(--text-muted)",background:p==="timeline"?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},onMouseEnter:D=>{p!=="timeline"&&(D.currentTarget.style.color="var(--text-primary)")},onMouseLeave:D=>{p!=="timeline"&&(D.currentTarget.style.color="var(--text-muted)")},children:"Timeline"}),o.jsx("button",{onClick:()=>{m("json"),localStorage.setItem("traceViewMode","json")},className:"px-2.5 h-6 text-[11px] font-semibold rounded transition-colors cursor-pointer inline-flex items-center",style:{color:p==="json"?"var(--accent)":"var(--text-muted)",background:p==="json"?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},onMouseEnter:D=>{p!=="json"&&(D.currentTarget.style.color="var(--text-primary)")},onMouseLeave:D=>{p!=="json"&&(D.currentTarget.style.color="var(--text-muted)")},children:"JSON"})]}),o.jsx("div",{ref:I,className:"overflow-y-auto flex-1 p-0.5 pr-0 pt-0 mr-0.5 mt-0.5",children:f.length===0?o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"No traces yet"})}):p==="tree"?f.map((D,C)=>o.jsx(qi,{node:D,depth:0,selectedId:(t==null?void 0:t.span_id)??null,onSelect:n,isLast:C===f.length-1,collapsedIds:r,toggleExpanded:L},D.span.span_id)):p==="timeline"?o.jsx(Cu,{tree:f,selectedSpan:t,onSelect:n}):o.jsxs("div",{className:"relative",children:[o.jsx("button",{onClick:h,className:"absolute top-1 right-1 z-10 text-[11px] cursor-pointer px-2 py-1 rounded transition-colors",style:{color:u?"var(--success)":"var(--text-muted)",background:"var(--bg-secondary)",border:"1px solid var(--border)"},onMouseEnter:D=>{u||(D.currentTarget.style.color="var(--text-primary)")},onMouseLeave:D=>{D.currentTarget.style.color=u?"var(--success)":"var(--text-muted)"},children:u?"Copied!":"Copy"}),o.jsx(ot,{json:x,className:"font-mono text-[11px] whitespace-pre-wrap p-2",style:{}})]})})]}),o.jsx("div",{onMouseDown:B,className:"shrink-0 drag-handle-col",style:l?{background:"var(--accent)"}:void 0}),o.jsx("div",{className:"flex-1 overflow-hidden",children:t?o.jsx(Su,{span:t}):o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"Select a span to view details"})})})]})}function qi({node:e,depth:t,selectedId:n,onSelect:r,isLast:s,collapsedIds:a,toggleExpanded:i}){var h;const{span:l}=e,c=!a.has(l.span_id),u=Hi[l.status.toLowerCase()]??"var(--text-muted)",d=Ki(l.duration_ms),p=l.span_id===n,m=e.children.length>0,f=t*20,x=(h=l.attributes)==null?void 0:h["openinference.span.kind"];return o.jsxs("div",{className:"relative",children:[t>0&&o.jsx("div",{className:"absolute top-0 z-10 pointer-events-none",style:{left:`${f-10}px`,width:"1px",height:s?"16px":"100%",background:"var(--border)"}}),o.jsxs("button",{"data-span-id":l.span_id,onClick:()=>r(l),className:"w-full text-left text-xs leading-normal py-1.5 pr-2 flex items-center gap-1.5 transition-colors relative",style:{paddingLeft:`${f+4}px`,background:p?"color-mix(in srgb, var(--accent) 15%, var(--bg-primary))":void 0,borderLeft:p?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:v=>{p||(v.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:v=>{p||(v.currentTarget.style.background="")},children:[t>0&&o.jsx("div",{className:"absolute z-10 pointer-events-none",style:{left:`${f-10}px`,top:"50%",width:"10px",height:"1px",background:"var(--border)"}}),m?o.jsx("span",{onClick:v=>{v.stopPropagation(),i(l.span_id)},className:"shrink-0 w-5 h-5 flex items-center justify-center cursor-pointer rounded hover:bg-[var(--bg-hover)]",style:{color:"var(--text-muted)"},children:o.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",style:{transform:c?"rotate(90deg)":"rotate(0deg)"},children:o.jsx("path",{d:"M3 1.5L7 5L3 8.5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})}):o.jsx("span",{className:"shrink-0 w-4"}),o.jsx("span",{className:"shrink-0 flex items-center justify-center w-4 h-4",children:o.jsx(Wi,{kind:x,statusColor:u})}),o.jsx("span",{className:"text-[var(--text-primary)] truncate min-w-0 flex-1",children:l.span_name}),d&&o.jsx("span",{className:"text-[var(--text-muted)] shrink-0 ml-auto pl-2 tabular-nums",children:d})]}),c&&e.children.map((v,y)=>o.jsx(qi,{node:v,depth:t+1,selectedId:n,onSelect:r,isLast:y===e.children.length-1,collapsedIds:a,toggleExpanded:i},v.span.span_id))]})}const ju={DEBUG:{color:"var(--text-muted)",bg:"color-mix(in srgb, var(--text-muted) 15%, var(--bg-secondary))",border:"var(--text-muted)"},INFO:{color:"var(--info)",bg:"color-mix(in srgb, var(--info) 15%, var(--bg-secondary))",border:"var(--info)"},WARN:{color:"var(--warning)",bg:"color-mix(in srgb, var(--warning) 15%, var(--bg-secondary))",border:"var(--warning)"},WARNING:{color:"var(--warning)",bg:"color-mix(in srgb, var(--warning) 15%, var(--bg-secondary))",border:"var(--warning)"},ERROR:{color:"var(--error)",bg:"color-mix(in srgb, var(--error) 15%, var(--bg-secondary))",border:"var(--error)"},CRITICAL:{color:"var(--error)",bg:"color-mix(in srgb, var(--error) 15%, var(--bg-secondary))",border:"var(--error)"}},Mu={color:"var(--text-muted)",bg:"transparent"};function ao({logs:e}){const t=E.useRef(null),n=E.useRef(null),[r,s]=E.useState(!1);E.useEffect(()=>{var i;(i=n.current)==null||i.scrollIntoView({behavior:"smooth"})},[e.length]);const a=()=>{const i=t.current;i&&s(i.scrollTop>100)};return e.length===0?o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"No logs yet"})}):o.jsxs("div",{className:"h-full relative",children:[o.jsxs("div",{ref:t,onScroll:a,className:"h-full overflow-y-auto font-mono text-xs leading-normal",children:[e.map((i,l)=>{const c=new Date(i.timestamp).toLocaleTimeString(void 0,{hour12:!1}),u=i.level.toUpperCase(),d=u.slice(0,4),p=ju[u]??Mu,m=l%2===0;return o.jsxs("div",{className:"flex gap-3 px-3 py-1.5",style:{background:m?"var(--bg-primary)":"var(--bg-secondary)"},children:[o.jsx("span",{className:"text-[var(--text-muted)] shrink-0",children:c}),o.jsx("span",{className:"shrink-0 self-start px-1.5 py-0.5 rounded text-[10px] font-semibold leading-none inline-flex items-center",style:{color:p.color,background:p.bg},children:d}),o.jsx("span",{className:"text-[var(--text-primary)] whitespace-pre-wrap break-all",children:i.message})]},l)}),o.jsx("div",{ref:n})]}),r&&o.jsx("button",{onClick:()=>{var i;return(i=t.current)==null?void 0:i.scrollTo({top:0,behavior:"smooth"})},className:"absolute top-2 right-3 w-6 h-6 flex items-center justify-center rounded-full cursor-pointer transition-opacity opacity-70 hover:opacity-100",style:{background:"var(--bg-tertiary)",color:"var(--text-primary)"},title:"Scroll to top",children:o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("polyline",{points:"18 15 12 9 6 15"})})})]})}const Ru={started:{color:"var(--accent)",label:"started"},updated:{color:"var(--info)",label:"updated"},completed:{color:"var(--success)",label:"completed"},faulted:{color:"var(--error)",label:"faulted"}},lo={color:"var(--text-muted)",label:""};function In({events:e,runStatus:t}){const n=E.useRef(null),r=E.useRef(!0),[s,a]=E.useState(null),i=()=>{const l=n.current;l&&(r.current=l.scrollHeight-l.scrollTop-l.clientHeight<40)};return E.useEffect(()=>{r.current&&n.current&&(n.current.scrollTop=n.current.scrollHeight)}),e.length===0?o.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:o.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:t==="running"?"Waiting for events...":"No events yet"})}):o.jsx("div",{ref:n,onScroll:i,className:"h-full overflow-y-auto font-mono text-xs leading-normal",children:e.map((l,c)=>{const u=new Date(l.timestamp).toLocaleTimeString(void 0,{hour12:!1}),d=l.payload&&Object.keys(l.payload).length>0,p=s===c,m=l.phase?Ru[l.phase]??lo:lo;return o.jsxs("div",{children:[o.jsxs("div",{onClick:()=>{d&&a(p?null:c)},className:"flex items-center gap-2 px-3 py-1.5",style:{background:c%2===0?"var(--bg-primary)":"var(--bg-secondary)",cursor:d?"pointer":"default"},children:[o.jsx("span",{className:"shrink-0",style:{color:"var(--text-muted)"},children:u}),o.jsx("span",{className:"shrink-0",style:{color:m.color},children:"●"}),o.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:l.node_name}),m.label&&o.jsx("span",{className:"shrink-0 text-[10px]",style:{color:"var(--text-muted)"},children:m.label}),d&&o.jsx("span",{className:"shrink-0 text-[9px] transition-transform",style:{color:"var(--text-muted)",transform:p?"rotate(90deg)":"rotate(0deg)"},children:"▸"})]}),p&&d&&o.jsx("div",{className:"px-3 py-2 border-t border-b",style:{borderColor:"var(--border)",background:"color-mix(in srgb, var(--bg-secondary) 80%, var(--bg-primary))"},children:o.jsx(ot,{json:JSON.stringify(l.payload,null,2),className:"text-[11px] font-mono whitespace-pre-wrap break-words"})})]},c)})})}function wt({title:e,copyText:t,trailing:n,children:r}){const[s,a]=E.useState(!1),i=E.useCallback(()=>{t&&navigator.clipboard.writeText(t).then(()=>{a(!0),setTimeout(()=>a(!1),1500)})},[t]);return o.jsxs("div",{className:"overflow-hidden",style:{border:"1px solid var(--border)"},children:[o.jsxs("div",{className:"px-3 py-2 flex items-center gap-2",style:{background:"var(--bg-secondary)"},children:[o.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:e}),n,t&&o.jsx("button",{onClick:i,className:`${n?"":"ml-auto "}text-[10px] cursor-pointer px-1.5 py-0.5 rounded transition-colors`,style:{color:s?"var(--success)":"var(--text-muted)",background:"var(--bg-tertiary)",border:"none"},onMouseEnter:l=>{s||(l.currentTarget.style.color="var(--text-primary)")},onMouseLeave:l=>{l.currentTarget.style.color=s?"var(--success)":"var(--text-muted)"},children:s?"Copied":"Copy"})]}),r]})}function co({runId:e,status:t,ws:n,breakpointNode:r}){const s=t==="suspended",a=i=>{const l=ve.getState().breakpoints[e]??{};n.setBreakpoints(e,Object.keys(l)),i==="step"?n.debugStep(e):i==="continue"?n.debugContinue(e):n.debugStop(e)};return o.jsxs("div",{className:"flex items-center gap-1 px-4 h-10 border-b shrink-0",style:{borderColor:"var(--border)",background:"var(--bg-secondary)"},children:[o.jsx("span",{className:"text-[11px] font-semibold mr-1",style:{color:"var(--text-muted)"},children:"Debug"}),o.jsx(yr,{label:"Step",onClick:()=>a("step"),disabled:!s,color:"var(--info)",active:s}),o.jsx(yr,{label:"Continue",onClick:()=>a("continue"),disabled:!s,color:"var(--success)",active:s}),o.jsx(yr,{label:"Stop",onClick:()=>a("stop"),disabled:!s,color:"var(--error)",active:s}),o.jsx("span",{className:"text-[11px] ml-auto truncate",style:{color:s?"var(--accent)":"var(--text-muted)"},children:s?r?`Paused at ${r}`:"Paused":t})]})}function yr({label:e,onClick:t,disabled:n,color:r,active:s}){return o.jsx("button",{onClick:t,disabled:n,className:"px-3 py-1 h-7 text-[11px] font-semibold rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed",style:{color:s?r:"var(--text-muted)",background:s?`color-mix(in srgb, ${r} 10%, transparent)`:"transparent"},onMouseEnter:a=>{n||(a.currentTarget.style.background=`color-mix(in srgb, ${r} 20%, transparent)`)},onMouseLeave:a=>{a.currentTarget.style.background=s?`color-mix(in srgb, ${r} 10%, transparent)`:"transparent"},children:e})}const uo=E.lazy(()=>zi(()=>import("./ChatPanel-CGRbCuiU.js"),__vite__mapDeps([2,1,3,4]))),Iu=[],Ou=[],Lu=[],Du=[];function Pu({run:e,ws:t,isMobile:n}){const r=e.mode==="chat",[s,a]=E.useState(280),[i,l]=E.useState(()=>{const M=localStorage.getItem("chatPanelWidth");return M?parseInt(M,10):380}),[c,u]=E.useState("primary"),[d,p]=E.useState(r?"primary":"traces"),m=E.useRef(null),f=E.useRef(null),x=E.useRef(!1),h=ve(M=>M.traces[e.id]||Iu),v=ve(M=>M.logs[e.id]||Ou),y=ve(M=>M.chatMessages[e.id]||Lu),b=ve(M=>M.stateEvents[e.id]||Du),A=ve(M=>M.breakpoints[e.id]);E.useEffect(()=>{t.setBreakpoints(e.id,A?Object.keys(A):[])},[e.id]);const I=E.useCallback(M=>{t.setBreakpoints(e.id,M)},[e.id,t]),L=E.useCallback(M=>{M.preventDefault(),x.current=!0;const _="touches"in M?M.touches[0].clientY:M.clientY,w=s,R=z=>{if(!x.current)return;const q=m.current;if(!q)return;const g="touches"in z?z.touches[0].clientY:z.clientY,F=q.clientHeight-100,K=Math.max(80,Math.min(F,w+(g-_)));a(K)},H=()=>{x.current=!1,document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",H),document.removeEventListener("touchmove",R),document.removeEventListener("touchend",H),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",R),document.addEventListener("mouseup",H),document.addEventListener("touchmove",R,{passive:!1}),document.addEventListener("touchend",H)},[s]),T=E.useCallback(M=>{M.preventDefault();const _="touches"in M?M.touches[0].clientX:M.clientX,w=i,R=z=>{const q=f.current;if(!q)return;const g="touches"in z?z.touches[0].clientX:z.clientX,F=q.clientWidth-300,K=Math.max(280,Math.min(F,w+(_-g)));l(K)},H=()=>{document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",H),document.removeEventListener("touchmove",R),document.removeEventListener("touchend",H),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("chatPanelWidth",String(i))};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",R),document.addEventListener("mouseup",H),document.addEventListener("touchmove",R,{passive:!1}),document.addEventListener("touchend",H)},[i]),B=r?"Chat":"Events",D=r?"var(--accent)":"var(--success)",C=M=>M==="primary"?D:M==="events"?"var(--success)":"var(--accent)",S=ve(M=>M.activeInterrupt[e.id]??null),N=e.status==="running"?o.jsx("span",{className:"ml-auto text-[11px] px-2 py-0.5 rounded-full shrink-0",style:{background:"color-mix(in srgb, var(--warning) 15%, var(--bg-secondary))",color:"var(--warning)"},children:r?"Thinking...":"Running..."}):r&&e.status==="suspended"&&S?o.jsx("span",{className:"ml-auto text-[11px] px-2 py-0.5 rounded-full shrink-0",style:{background:"color-mix(in srgb, var(--warning) 15%, var(--bg-secondary))",color:"var(--warning)"},children:"Action Required"}):null;if(n){const M=[{id:"traces",label:"Traces",count:h.length},{id:"primary",label:B},...r?[{id:"events",label:"Events",count:b.length}]:[],{id:"io",label:"I/O"},{id:"logs",label:"Logs",count:v.length}];return o.jsxs("div",{className:"flex flex-col h-full",children:[(e.mode==="debug"||e.status==="suspended"&&!S||A&&Object.keys(A).length>0)&&o.jsx(co,{runId:e.id,status:e.status,ws:t,breakpointNode:e.breakpoint_node}),o.jsx("div",{className:"shrink-0",style:{height:"40vh"},children:o.jsx(qn,{entrypoint:e.entrypoint,traces:h,runId:e.id,breakpointNode:e.breakpoint_node,breakpointNextNodes:e.breakpoint_next_nodes,onBreakpointChange:I})}),o.jsxs("div",{className:"flex items-center gap-1 px-2 h-10 border-y shrink-0",style:{borderColor:"var(--border)",background:"var(--bg-secondary)"},children:[M.map(_=>o.jsxs("button",{onClick:()=>p(_.id),className:"px-2.5 py-1 h-7 text-xs font-semibold rounded transition-colors cursor-pointer",style:{color:d===_.id?C(_.id):"var(--text-muted)",background:d===_.id?`color-mix(in srgb, ${C(_.id)} 10%, transparent)`:"transparent"},children:[_.label,_.count!==void 0&&_.count>0&&o.jsx("span",{className:"ml-1 font-normal",style:{color:"var(--text-muted)"},children:_.count})]},_.id)),N]}),o.jsxs("div",{className:"flex-1 overflow-hidden",children:[d==="traces"&&o.jsx(Kr,{traces:h}),d==="primary"&&(r?o.jsx(E.Suspense,{fallback:o.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:o.jsx("span",{className:"text-xs",children:"Loading chat..."})}),children:o.jsx(uo,{messages:y,runId:e.id,runStatus:e.status,ws:t})}):o.jsx(In,{events:b,runStatus:e.status})),d==="events"&&o.jsx(In,{events:b,runStatus:e.status}),d==="io"&&o.jsx(po,{run:e}),d==="logs"&&o.jsx(ao,{logs:v})]})]})}const O=[{id:"primary",label:B},...r?[{id:"events",label:"Events",count:b.length}]:[],{id:"io",label:"I/O"},{id:"logs",label:"Logs",count:v.length}];return o.jsxs("div",{ref:f,className:"flex h-full",children:[o.jsxs("div",{ref:m,className:"flex flex-col flex-1 min-w-0",children:[(e.mode==="debug"||e.status==="suspended"&&!S||A&&Object.keys(A).length>0)&&o.jsx(co,{runId:e.id,status:e.status,ws:t,breakpointNode:e.breakpoint_node}),o.jsx("div",{className:"shrink-0 overflow-hidden",style:{height:s},children:o.jsx(qn,{entrypoint:e.entrypoint,traces:h,runId:e.id,breakpointNode:e.breakpoint_node,breakpointNextNodes:e.breakpoint_next_nodes,onBreakpointChange:I})}),o.jsx("div",{onMouseDown:L,onTouchStart:L,className:"shrink-0 drag-handle-row"}),o.jsx("div",{className:"flex-1 overflow-hidden",children:o.jsx(Kr,{traces:h})})]}),o.jsx("div",{onMouseDown:T,onTouchStart:T,className:"shrink-0 drag-handle-col"}),o.jsxs("div",{className:"shrink-0 flex flex-col",style:{width:i,background:"var(--bg-primary)"},children:[o.jsxs("div",{className:"flex items-center gap-1 px-2 h-10 border-b shrink-0",style:{borderColor:"var(--border)",background:"var(--bg-secondary)"},children:[O.map(M=>o.jsxs("button",{onClick:()=>u(M.id),className:"px-2.5 py-1 h-7 text-xs font-semibold rounded transition-colors cursor-pointer",style:{color:c===M.id?C(M.id):"var(--text-muted)",background:c===M.id?`color-mix(in srgb, ${C(M.id)} 10%, transparent)`:"transparent"},onMouseEnter:_=>{c!==M.id&&(_.currentTarget.style.color="var(--text-primary)")},onMouseLeave:_=>{c!==M.id&&(_.currentTarget.style.color="var(--text-muted)")},children:[M.label,M.count!==void 0&&M.count>0&&o.jsx("span",{className:"ml-1 font-normal",style:{color:"var(--text-muted)"},children:M.count})]},M.id)),N]}),o.jsxs("div",{className:"flex-1 overflow-hidden",children:[c==="primary"&&(r?o.jsx(E.Suspense,{fallback:o.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:o.jsx("span",{className:"text-xs",children:"Loading chat..."})}),children:o.jsx(uo,{messages:y,runId:e.id,runStatus:e.status,ws:t})}):o.jsx(In,{events:b,runStatus:e.status})),c==="events"&&o.jsx(In,{events:b,runStatus:e.status}),c==="io"&&o.jsx(po,{run:e}),c==="logs"&&o.jsx(ao,{logs:v})]})]})]})}function po({run:e}){return o.jsxs("div",{className:"p-2 overflow-y-auto h-full space-y-1.5",children:[o.jsx(wt,{title:"Input",copyText:JSON.stringify(e.input_data,null,2),children:o.jsx(ot,{json:JSON.stringify(e.input_data,null,2),className:"px-3 py-2 text-xs font-mono whitespace-pre-wrap break-words"})}),e.output_data&&o.jsx(wt,{title:"Output",copyText:typeof e.output_data=="string"?e.output_data:JSON.stringify(e.output_data,null,2),children:o.jsx(ot,{json:typeof e.output_data=="string"?e.output_data:JSON.stringify(e.output_data,null,2),className:"px-3 py-2 text-xs font-mono whitespace-pre-wrap break-words"})}),e.error&&o.jsxs("div",{className:"overflow-hidden",style:{border:"1px solid color-mix(in srgb, var(--error) 40%, var(--border))"},children:[o.jsxs("div",{className:"px-3 py-2 text-xs font-semibold flex items-center gap-2",style:{background:"color-mix(in srgb, var(--error) 15%, var(--bg-secondary))",color:"var(--error)"},children:[o.jsx("span",{children:"Error"}),o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono",style:{background:"color-mix(in srgb, var(--error) 20%, var(--bg-secondary))"},children:e.error.code}),o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono",style:{background:"color-mix(in srgb, var(--error) 20%, var(--bg-secondary))"},children:e.error.category})]}),o.jsxs("div",{className:"px-3 py-2 text-xs leading-normal",children:[o.jsx("div",{className:"font-semibold mb-2",style:{color:"var(--text-primary)"},children:e.error.title}),o.jsx("pre",{className:"whitespace-pre-wrap font-mono text-[11px] max-w-prose",style:{color:"var(--text-secondary)"},children:e.error.detail})]})]})]})}function fo(){const{reloadPending:e,setReloadPending:t,setEntrypoints:n}=ve(),[r,s]=E.useState(!1);if(!e)return null;const a=async()=>{s(!0);try{await kc();const i=await as();n(i.map(l=>l.name)),t(!1)}catch(i){console.error("Reload failed:",i)}finally{s(!1)}};return o.jsxs("div",{className:"fixed top-4 left-1/2 -translate-x-1/2 z-50 flex items-center gap-3 px-4 py-2 rounded-lg shadow-lg",style:{background:"var(--bg-secondary)",border:"1px solid var(--bg-tertiary)"},children:[o.jsx("span",{className:"text-xs",style:{color:"var(--text-secondary)"},children:"Files changed"}),o.jsx("button",{onClick:a,disabled:r,className:"px-2.5 py-0.5 text-xs font-medium rounded cursor-pointer",style:{background:"var(--accent)",color:"#fff",opacity:r?.6:1},children:r?"Reloading...":"Reload"}),o.jsx("button",{onClick:()=>t(!1),"aria-label":"Dismiss reload prompt",className:"text-xs cursor-pointer px-0.5",style:{color:"var(--text-muted)",background:"none",border:"none"},children:"✕"})]})}let Bu=0;const mo=Ot(e=>({toasts:[],addToast:(t,n)=>{const r=String(++Bu);e(a=>({toasts:[...a.toasts,{id:r,type:t,message:n}]})),setTimeout(()=>{e(a=>({toasts:a.toasts.filter(i=>i.id!==r)}))},t==="error"?8e3:5e3)},removeToast:t=>{e(n=>({toasts:n.toasts.filter(r=>r.id!==t)}))}})),ho={success:{color:"var(--success)",bg:"color-mix(in srgb, var(--success) 10%, var(--bg-elevated))",border:"color-mix(in srgb, var(--success) 30%, var(--border))"},error:{color:"var(--error)",bg:"color-mix(in srgb, var(--error) 10%, var(--bg-elevated))",border:"color-mix(in srgb, var(--error) 30%, var(--border))"},info:{color:"var(--info)",bg:"color-mix(in srgb, var(--info) 10%, var(--bg-elevated))",border:"color-mix(in srgb, var(--info) 30%, var(--border))"}};function go(){const e=mo(n=>n.toasts),t=mo(n=>n.removeToast);return e.length===0?null:o.jsx("div",{className:"fixed bottom-8 right-4 z-[100] flex flex-col gap-2 pointer-events-none",children:e.map(n=>{const r=ho[n.type]??ho.info;return o.jsxs("div",{className:"pointer-events-auto flex items-center gap-2 px-4 py-2.5 rounded-lg shadow-lg text-xs font-medium max-w-xs animate-[slideIn_0.2s_ease-out]",style:{background:r.bg,border:`1px solid ${r.border}`,color:r.color},children:[o.jsx("span",{className:"flex-1",children:n.message}),o.jsx("button",{onClick:()=>t(n.id),className:"shrink-0 w-5 h-5 flex items-center justify-center rounded cursor-pointer transition-opacity opacity-60 hover:opacity-100",style:{color:r.color,background:"transparent",border:"none"},"aria-label":"Dismiss",children:o.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:[o.jsx("line",{x1:"1",y1:"1",x2:"9",y2:"9"}),o.jsx("line",{x1:"9",y1:"1",x2:"1",y2:"9"})]})})]},n.id)})})}function Fu(e){return e===null?"-":`${Math.round(e*100)}%`}function $u(e){if(e===null)return"var(--text-muted)";const t=e*100;return t>=80?"var(--success)":t>=50?"var(--warning)":"var(--error)"}const xo={pending:{color:"var(--text-muted)",label:"Pending"},running:{color:"var(--info)",label:"Running"},completed:{color:"var(--success)",label:"Completed"},failed:{color:"var(--error)",label:"Failed"}};function bo(){const e=Ae(l=>l.evalSets),t=Ae(l=>l.evalRuns),{evalSetId:n,evalRunId:r,navigate:s}=Ve(),a=Object.values(e),i=Object.values(t).sort((l,c)=>new Date(c.start_time??0).getTime()-new Date(l.start_time??0).getTime());return o.jsxs("div",{className:"flex-1 overflow-y-auto",children:[o.jsx("button",{onClick:()=>s("#/evals/new"),className:"w-[calc(100%-24px)] mx-3 mt-2.5 mb-1 px-3 py-1.5 text-[11px] text-center font-medium rounded border border-[var(--border)] bg-transparent transition-colors cursor-pointer",style:{color:"var(--text-secondary)"},onMouseEnter:l=>{l.currentTarget.style.color="var(--text-primary)",l.currentTarget.style.borderColor="var(--text-muted)"},onMouseLeave:l=>{l.currentTarget.style.color="var(--text-secondary)",l.currentTarget.style.borderColor=""},children:"+ New Eval Set"}),o.jsx("div",{className:"px-3 pt-3 pb-1 text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"Eval Sets"}),a.map(l=>{const c=n===l.id;return o.jsxs("button",{onClick:()=>s(`#/evals/sets/${l.id}`),className:"w-full text-left px-3 py-1.5 text-xs cursor-pointer transition-colors",style:{background:c?"color-mix(in srgb, var(--accent) 15%, var(--bg-primary))":"transparent",color:c?"var(--text-primary)":"var(--text-secondary)",borderLeft:c?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:u=>{c||(u.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:u=>{c||(u.currentTarget.style.background="transparent")},children:[o.jsx("div",{className:"truncate font-medium",children:l.name}),o.jsxs("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-muted)"},children:[l.eval_count," items · ",l.evaluator_ids.length," evaluator",l.evaluator_ids.length!==1?"s":""]})]},l.id)}),a.length===0&&o.jsx("p",{className:"text-[11px] px-3 py-2",style:{color:"var(--text-muted)"},children:"No eval sets yet"}),o.jsx("div",{className:"px-3 pt-4 pb-1 text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"History"}),i.map(l=>{const c=r===l.id,u=xo[l.status]??xo.pending;return o.jsx("button",{onClick:()=>s(`#/evals/runs/${l.id}`),className:"w-full text-left px-3 py-1.5 text-xs cursor-pointer transition-colors",style:{background:c?"color-mix(in srgb, var(--accent) 15%, var(--bg-primary))":"transparent",color:c?"var(--text-primary)":"var(--text-secondary)",borderLeft:c?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:d=>{c||(d.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:d=>{c||(d.currentTarget.style.background="transparent")},children:o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:u.color}}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"truncate font-medium",children:l.eval_set_name}),o.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-muted)"},children:l.start_time?new Date(l.start_time).toLocaleString():u.label})]}),o.jsx("span",{className:"font-mono shrink-0",style:{color:$u(l.overall_score)},children:Fu(l.overall_score)})]})},l.id)}),i.length===0&&o.jsx("p",{className:"text-[11px] px-3 py-2",style:{color:"var(--text-muted)"},children:"No eval runs yet"})]})}function yo(e,t=60){const n=typeof e=="string"?e:JSON.stringify(e);return!n||n==="null"?"-":n.length>t?n.slice(0,t)+"...":n}function zu({evalSetId:e}){const[t,n]=E.useState(null),[r,s]=E.useState(!0),[a,i]=E.useState(null),[l,c]=E.useState(!1),[u,d]=E.useState("io"),p=Ae(g=>g.evaluators),m=Ae(g=>g.localEvaluators),f=Ae(g=>g.updateEvalSetEvaluators),x=Ae(g=>g.incrementEvalSetCount),h=Ae(g=>g.upsertEvalRun),{navigate:v}=Ve(),[y,b]=E.useState(!1),[A,I]=E.useState(new Set),[L,T]=E.useState(!1),B=E.useRef(null),[D,C]=E.useState(()=>{const g=localStorage.getItem("evalSetSidebarWidth");return g?parseInt(g,10):320}),[S,N]=E.useState(!1),O=E.useRef(null);E.useEffect(()=>{localStorage.setItem("evalSetSidebarWidth",String(D))},[D]),E.useEffect(()=>{s(!0),i(null),Lc(e).then(g=>{n(g),g.items.length>0&&i(g.items[0].name)}).catch(console.error).finally(()=>s(!1))},[e]);const M=async()=>{c(!0);try{const g=await Dc(e);h(g),v(`#/evals/runs/${g.id}`)}catch(g){console.error(g)}finally{c(!1)}},_=async g=>{if(t)try{await Oc(e,g),n(F=>{if(!F)return F;const K=F.items.filter(k=>k.name!==g);return{...F,items:K,eval_count:K.length}}),x(e,-1),a===g&&i(null)}catch(F){console.error(F)}},w=E.useCallback(()=>{t&&I(new Set(t.evaluator_ids)),b(!0)},[t]),R=g=>{I(F=>{const K=new Set(F);return K.has(g)?K.delete(g):K.add(g),K})},H=async()=>{if(t){T(!0);try{const g=await Fc(e,Array.from(A));n(g),f(e,g.evaluator_ids),b(!1)}catch(g){console.error(g)}finally{T(!1)}}};E.useEffect(()=>{if(!y)return;const g=F=>{B.current&&!B.current.contains(F.target)&&b(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[y]);const z=E.useCallback(g=>{g.preventDefault(),N(!0);const F="touches"in g?g.touches[0].clientX:g.clientX,K=D,k=G=>{const U=O.current;if(!U)return;const re="touches"in G?G.touches[0].clientX:G.clientX,de=U.clientWidth-300,be=Math.max(280,Math.min(de,K+(F-re)));C(be)},se=()=>{N(!1),document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",se),document.removeEventListener("touchmove",k),document.removeEventListener("touchend",se),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",k),document.addEventListener("mouseup",se),document.addEventListener("touchmove",k,{passive:!1}),document.addEventListener("touchend",se)},[D]);if(r)return o.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)] text-sm",children:"Loading..."});if(!t)return o.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)]",children:"Eval set not found"});const q=t.items.find(g=>g.name===a)??null;return o.jsxs("div",{ref:O,className:"flex h-full",children:[o.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[o.jsxs("div",{className:"px-4 h-10 border-b shrink-0 flex items-center gap-4",style:{borderColor:"var(--border)"},children:[o.jsx("h1",{className:"text-base font-semibold",style:{color:"var(--text-primary)"},children:t.name}),o.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-muted)"},children:[t.eval_count," items"]}),o.jsxs("div",{className:"flex gap-1 items-center ml-auto relative",children:[o.jsx("button",{onClick:w,className:"w-7 h-7 flex items-center justify-center rounded cursor-pointer transition-colors",style:{color:"var(--text-muted)",background:"transparent",border:"none"},onMouseEnter:g=>{g.currentTarget.style.color="var(--text-primary)",g.currentTarget.style.background="var(--bg-secondary)"},onMouseLeave:g=>{g.currentTarget.style.color="var(--text-muted)",g.currentTarget.style.background="transparent"},title:"Edit evaluators","aria-label":"Edit evaluators",children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"}),o.jsx("path",{d:"m15 5 4 4"})]})}),t.evaluator_ids.map(g=>{const F=p.find(K=>K.id===g);return o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[11px] font-medium",style:{background:"var(--bg-tertiary)",color:"var(--text-secondary)"},children:(F==null?void 0:F.name)??g},g)}),y&&o.jsxs("div",{ref:B,className:"absolute top-full right-0 mt-1 z-50 rounded-md border shadow-lg",style:{background:"var(--bg-primary)",borderColor:"var(--border)",minWidth:220},children:[o.jsx("div",{className:"px-3 py-2 border-b text-[10px] uppercase tracking-wide font-semibold",style:{color:"var(--text-muted)",borderColor:"var(--border)"},children:"Evaluators"}),o.jsx("div",{className:"max-h-48 overflow-y-auto",children:m.length===0?o.jsx("div",{className:"px-3 py-3 text-xs",style:{color:"var(--text-muted)"},children:"No evaluators available"}):m.map(g=>o.jsxs("label",{className:"flex items-center gap-2 px-3 py-1.5 text-xs cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--border)"},onMouseEnter:F=>{F.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:F=>{F.currentTarget.style.background="transparent"},children:[o.jsx("input",{type:"checkbox",checked:A.has(g.id),onChange:()=>R(g.id),className:"accent-[var(--accent)]"}),o.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:g.name})]},g.id))}),o.jsx("div",{className:"px-3 py-2 border-t flex justify-end",style:{borderColor:"var(--border)"},children:o.jsx("button",{onClick:H,disabled:L,className:"px-3 py-1 text-[11px] font-semibold rounded cursor-pointer transition-colors disabled:opacity-50",style:{background:"var(--accent)",color:"var(--bg-primary)",border:"none"},onMouseEnter:g=>{g.currentTarget.style.background="var(--accent-hover)"},onMouseLeave:g=>{g.currentTarget.style.background="var(--accent)"},children:L?"Saving...":"Update"})})]})]}),o.jsxs("button",{onClick:M,disabled:l,className:"ml-2 px-3 py-1 h-7 text-xs font-semibold rounded border flex items-center gap-1.5 cursor-pointer transition-colors disabled:opacity-30 disabled:cursor-not-allowed",style:{color:"var(--success)",borderColor:"var(--success)",background:"transparent"},onMouseEnter:g=>{l||(g.currentTarget.style.background="color-mix(in srgb, var(--success) 10%, transparent)")},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},title:"Run eval set","aria-label":"Run eval set",children:[o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",children:o.jsx("polygon",{points:"5,3 19,12 5,21"})}),l?"Running...":"Run"]})]}),o.jsxs("div",{className:"flex items-center px-3 h-7 text-[11px] font-semibold shrink-0 border-b",style:{color:"var(--text-muted)",background:"var(--bg-secondary)",borderColor:"var(--border)"},children:[o.jsx("span",{className:"w-56 shrink-0",children:"Name"}),o.jsx("span",{className:"flex-1 min-w-0",children:"Input"}),o.jsx("span",{className:"w-32 shrink-0 pl-2",children:"Expected Behavior"}),o.jsx("span",{className:"w-32 shrink-0 pl-2",children:"Expected Output"}),o.jsx("span",{className:"w-32 shrink-0 pl-2",children:"Simulation Instr."}),o.jsx("span",{className:"w-8 shrink-0"})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto",children:[t.items.map(g=>{const F=g.name===a;return o.jsxs("button",{onClick:()=>i(F?null:g.name),className:"group w-full text-left px-3 py-1.5 flex items-center text-xs border-b transition-colors cursor-pointer",style:{borderColor:"var(--border)",background:F?"color-mix(in srgb, var(--accent) 10%, var(--bg-primary))":void 0,borderLeft:F?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:K=>{F||(K.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:K=>{F||(K.currentTarget.style.background="")},children:[o.jsx("span",{className:"w-56 shrink-0 truncate",style:{color:"var(--text-primary)"},children:g.name}),o.jsx("span",{className:"flex-1 min-w-0 truncate font-mono text-[11px]",style:{color:"var(--text-muted)"},children:yo(g.inputs)}),o.jsx("span",{className:"w-32 shrink-0 truncate pl-2 text-[11px]",style:{color:"var(--text-muted)"},children:g.expected_behavior||"-"}),o.jsx("span",{className:"w-32 shrink-0 truncate pl-2 font-mono text-[11px]",style:{color:"var(--text-muted)"},children:yo(g.expected_output,40)}),o.jsx("span",{className:"w-32 shrink-0 truncate pl-2 text-[11px]",style:{color:"var(--text-muted)"},children:g.simulation_instructions||"-"}),o.jsx("span",{role:"button",tabIndex:0,className:"w-8 shrink-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",onClick:K=>{K.stopPropagation(),_(g.name)},onKeyDown:K=>{K.key==="Enter"&&(K.stopPropagation(),_(g.name))},style:{color:"var(--text-muted)"},onMouseEnter:K=>{K.currentTarget.style.color="var(--error)"},onMouseLeave:K=>{K.currentTarget.style.color="var(--text-muted)"},title:"Delete item",children:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.name)}),t.items.length===0&&o.jsx("div",{className:"flex items-center justify-center py-8 text-[var(--text-muted)] text-xs",children:"No items in this eval set"})]})]}),o.jsx("div",{onMouseDown:z,onTouchStart:z,className:`shrink-0 drag-handle-col${S?"":" transition-all"}`,style:{width:q?3:0,opacity:q?1:0}}),o.jsxs("div",{className:`shrink-0 flex flex-col overflow-hidden${S?"":" transition-[width] duration-200 ease-in-out"}`,style:{width:q?D:0,background:"var(--bg-primary)"},children:[o.jsx("div",{className:"flex items-center gap-1 px-2 h-10 border-b shrink-0",style:{borderColor:"var(--border)",background:"var(--bg-secondary)",minWidth:D},children:["io","evaluators"].map(g=>{const F=u===g,K=g==="io"?"I/O":"Evaluators";return o.jsx("button",{onClick:()=>d(g),className:"px-2.5 py-1 h-7 text-xs font-semibold rounded inline-flex items-center cursor-pointer transition-colors",style:{color:F?"var(--accent)":"var(--text-muted)",background:F?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent",border:"none"},children:K},g)})}),o.jsx("div",{className:"flex-1 overflow-hidden",style:{minWidth:D},children:q?u==="io"?o.jsx(Uu,{item:q}):o.jsx(Hu,{item:q,evaluators:p}):null})]})]})}function Uu({item:e}){const t=JSON.stringify(e.inputs,null,2),n=e.expected_output!=null?typeof e.expected_output=="string"?e.expected_output:JSON.stringify(e.expected_output,null,2):null;return o.jsxs("div",{className:"p-2 overflow-y-auto h-full space-y-1.5",children:[o.jsx(wt,{title:"Input",copyText:t,children:o.jsx(ot,{json:t,className:"px-3 py-2 text-xs font-mono whitespace-pre-wrap break-words"})}),e.expected_behavior&&o.jsx(wt,{title:"Expected Behavior",copyText:e.expected_behavior,children:o.jsx("div",{className:"px-3 py-2 text-xs leading-relaxed whitespace-pre-wrap",style:{color:"var(--text-secondary)"},children:e.expected_behavior})}),n&&o.jsx(wt,{title:"Expected Output",copyText:n,children:o.jsx(ot,{json:n,className:"px-3 py-2 text-xs font-mono whitespace-pre-wrap break-words"})}),e.simulation_instructions&&o.jsx(wt,{title:"Simulation Instructions",copyText:e.simulation_instructions,children:o.jsx("div",{className:"px-3 py-2 text-xs leading-relaxed whitespace-pre-wrap",style:{color:"var(--text-secondary)"},children:e.simulation_instructions})})]})}function Hu({item:e,evaluators:t}){return o.jsx("div",{className:"p-2 overflow-y-auto h-full space-y-1.5",children:e.evaluator_ids.length>0?o.jsx(o.Fragment,{children:e.evaluator_ids.map(n=>{var a;const r=t.find(i=>i.id===n),s=(a=e.evaluation_criterias)==null?void 0:a[n];return o.jsxs("div",{className:"overflow-hidden",style:{border:"1px solid var(--border)"},children:[o.jsxs("div",{className:"px-3 py-2 flex items-center gap-2",style:{background:"var(--bg-secondary)"},children:[o.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:(r==null?void 0:r.name)??n}),o.jsx("span",{className:"ml-auto text-[10px]",style:{color:"var(--text-muted)"},children:s?"Custom criteria":"Default criteria"})]}),s&&o.jsx("pre",{className:"px-3 py-2 border-t text-[11px] font-mono overflow-x-auto max-h-32 whitespace-pre-wrap break-words",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:JSON.stringify(s,null,2)})]},n)})}):o.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)] text-xs",children:"No evaluators configured for this item"})})}function tn(e){return e===null?"-":`${Math.round(e*100)}%`}function Et(e){if(e===null)return"var(--text-muted)";const t=e*100;return t>=80?"var(--success)":t>=50?"var(--warning)":"var(--error)"}function Wu(e,t){if(!e)return"-";const n=new Date(e).getTime(),r=t?new Date(t).getTime():Date.now(),s=Math.round((r-n)/1e3);return s<60?`${s}s`:`${Math.floor(s/60)}m ${s%60}s`}function vo(e){return e.replace(/\s*Evaluator$/i,"")}const ko={pending:{color:"var(--text-muted)",bg:"var(--bg-tertiary)",label:"Pending"},running:{color:"var(--info)",bg:"rgba(59,130,246,0.1)",label:"Running"},completed:{color:"var(--success)",bg:"rgba(34,197,94,0.1)",label:"Completed"},failed:{color:"var(--error)",bg:"rgba(239,68,68,0.1)",label:"Failed"}};function Ku({evalRunId:e,itemName:t}){const[n,r]=E.useState(null),[s,a]=E.useState(!0),{navigate:i}=Ve(),l=t??null,[c,u]=E.useState(220),d=E.useRef(null),p=E.useRef(!1),[m,f]=E.useState(()=>{const N=localStorage.getItem("evalSidebarWidth");return N?parseInt(N,10):320}),[x,h]=E.useState(!1),v=E.useRef(null);E.useEffect(()=>{localStorage.setItem("evalSidebarWidth",String(m))},[m]);const y=Ae(N=>N.evalRuns[e]),b=Ae(N=>N.evaluators);E.useEffect(()=>{a(!0),Vs(e).then(N=>{if(r(N),!t){const O=N.results.find(M=>M.status==="completed")??N.results[0];O&&i(`#/evals/runs/${e}/${encodeURIComponent(O.name)}`)}}).catch(console.error).finally(()=>a(!1))},[e]),E.useEffect(()=>{((y==null?void 0:y.status)==="completed"||(y==null?void 0:y.status)==="failed")&&Vs(e).then(r).catch(console.error)},[y==null?void 0:y.status,e]),E.useEffect(()=>{if(t||!(n!=null&&n.results))return;const N=n.results.find(O=>O.status==="completed")??n.results[0];N&&i(`#/evals/runs/${e}/${encodeURIComponent(N.name)}`)},[n==null?void 0:n.results]);const A=E.useCallback(N=>{N.preventDefault(),p.current=!0;const O="touches"in N?N.touches[0].clientY:N.clientY,M=c,_=R=>{if(!p.current)return;const H=d.current;if(!H)return;const z="touches"in R?R.touches[0].clientY:R.clientY,q=H.clientHeight-100,g=Math.max(80,Math.min(q,M+(z-O)));u(g)},w=()=>{p.current=!1,document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",w),document.removeEventListener("touchmove",_),document.removeEventListener("touchend",w),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",_),document.addEventListener("mouseup",w),document.addEventListener("touchmove",_,{passive:!1}),document.addEventListener("touchend",w)},[c]),I=E.useCallback(N=>{N.preventDefault(),h(!0);const O="touches"in N?N.touches[0].clientX:N.clientX,M=m,_=R=>{const H=v.current;if(!H)return;const z="touches"in R?R.touches[0].clientX:R.clientX,q=H.clientWidth-300,g=Math.max(280,Math.min(q,M+(O-z)));f(g)},w=()=>{h(!1),document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",w),document.removeEventListener("touchmove",_),document.removeEventListener("touchend",w),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",_),document.addEventListener("mouseup",w),document.addEventListener("touchmove",_,{passive:!1}),document.addEventListener("touchend",w)},[m]);if(s)return o.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)] text-sm",children:"Loading..."});if(!n)return o.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)]",children:"Eval run not found"});const L=y??n,T=ko[L.status]??ko.pending,B=L.status==="running",D=Object.keys(L.evaluator_scores??{}),C=n.results.find(N=>N.name===l)??null,S=((C==null?void 0:C.traces)??[]).map(N=>({...N,run_id:""}));return o.jsxs("div",{ref:v,className:"flex h-full",children:[o.jsxs("div",{ref:d,className:"flex flex-col flex-1 min-w-0",children:[o.jsxs("div",{className:"px-4 h-10 border-b shrink-0 flex items-center gap-4",style:{borderColor:"var(--border)"},children:[o.jsx("h1",{className:"text-base font-semibold truncate min-w-0",style:{color:"var(--text-primary)"},children:L.eval_set_name}),o.jsx("span",{className:"px-2 py-0.5 rounded text-[11px] font-semibold uppercase tracking-wide",style:{color:T.color,background:T.bg},children:T.label}),o.jsx("span",{className:"text-sm font-bold font-mono",style:{color:Et(L.overall_score)},children:tn(L.overall_score)}),o.jsx("span",{className:"text-[11px]",style:{color:"var(--text-muted)"},children:Wu(L.start_time,L.end_time)}),B&&o.jsxs("div",{className:"flex items-center gap-2 max-w-[160px]",children:[o.jsx("div",{className:"flex-1 h-2 rounded-full overflow-hidden",style:{background:"var(--bg-tertiary)"},children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${L.progress_total>0?L.progress_completed/L.progress_total*100:0}%`,background:"var(--info)"}})}),o.jsxs("span",{className:"text-[11px] shrink-0",style:{color:"var(--text-muted)"},children:[L.progress_completed,"/",L.progress_total]})]}),D.length>0&&o.jsx("div",{className:"flex gap-3 ml-auto",children:D.map(N=>{const O=b.find(_=>_.id===N),M=L.evaluator_scores[N];return o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"text-[11px]",style:{color:"var(--text-muted)"},children:vo((O==null?void 0:O.name)??N)}),o.jsx("div",{className:"w-12 h-2 rounded-full overflow-hidden",style:{background:"var(--bg-tertiary)"},children:o.jsx("div",{className:"h-full rounded-full",style:{width:`${M*100}%`,background:Et(M)}})}),o.jsx("span",{className:"text-[11px] font-mono",style:{color:Et(M)},children:tn(M)})]},N)})})]}),o.jsxs("div",{className:"shrink-0 overflow-hidden flex flex-col",style:{height:c},children:[o.jsxs("div",{className:"flex items-center px-3 h-7 text-[11px] font-semibold shrink-0 border-b",style:{color:"var(--text-muted)",background:"var(--bg-secondary)",borderColor:"var(--border)"},children:[o.jsx("span",{className:"w-5 shrink-0"}),o.jsx("span",{className:"flex-1 min-w-0",children:"Name"}),o.jsx("span",{className:"w-14 shrink-0 text-right",children:"Score"}),D.map(N=>{const O=b.find(M=>M.id===N);return o.jsx("span",{className:"w-36 shrink-0 text-right truncate pl-2",title:(O==null?void 0:O.name)??N,children:vo((O==null?void 0:O.name)??N)},N)}),o.jsx("span",{className:"w-14 shrink-0 text-right",children:"Time"})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto",children:[n.results.map(N=>{const O=N.status==="pending",M=N.status==="failed",_=N.name===l;return o.jsxs("button",{onClick:()=>{i(_?`#/evals/runs/${e}`:`#/evals/runs/${e}/${encodeURIComponent(N.name)}`)},className:"w-full text-left px-3 py-1.5 flex items-center text-xs border-b transition-colors cursor-pointer",style:{borderColor:"var(--border)",background:_?"color-mix(in srgb, var(--accent) 10%, var(--bg-primary))":void 0,borderLeft:_?"2px solid var(--accent)":"2px solid transparent",opacity:O?.5:1},onMouseEnter:w=>{_||(w.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:w=>{_||(w.currentTarget.style.background="")},children:[o.jsx("span",{className:"w-5 shrink-0 flex justify-center",children:o.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:O?"var(--text-muted)":M?"var(--error)":N.overall_score>=.8?"var(--success)":N.overall_score>=.5?"var(--warning)":"var(--error)"}})}),o.jsx("span",{className:"flex-1 min-w-0 truncate",style:{color:"var(--text-primary)"},children:N.name}),o.jsx("span",{className:"w-14 shrink-0 text-right font-mono font-semibold",style:{color:Et(O?null:N.overall_score)},children:O?"-":tn(N.overall_score)}),D.map(w=>o.jsx("span",{className:"w-36 shrink-0 text-right font-mono pl-2",style:{color:Et(O?null:N.scores[w]??null)},children:O?"-":tn(N.scores[w]??null)},w)),o.jsx("span",{className:"w-14 shrink-0 text-right",style:{color:"var(--text-muted)"},children:N.duration_ms!==null?`${(N.duration_ms/1e3).toFixed(1)}s`:"-"})]},N.name)}),n.results.length===0&&o.jsx("div",{className:"flex items-center justify-center py-8 text-[var(--text-muted)] text-xs",children:B?"Waiting for results...":"No results"})]})]}),o.jsx("div",{onMouseDown:A,onTouchStart:A,className:"shrink-0 drag-handle-row"}),o.jsx("div",{className:"flex-1 overflow-hidden",children:C&&S.length>0?o.jsx(Kr,{traces:S}):o.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)] text-xs",children:(C==null?void 0:C.status)==="pending"?"Pending...":"No traces available"})})]}),o.jsx("div",{onMouseDown:I,onTouchStart:I,className:`shrink-0 drag-handle-col${x?"":" transition-all"}`,style:{width:C?3:0,opacity:C?1:0}}),o.jsx(qu,{width:m,item:C,evaluators:b,isRunning:B,isDragging:x})]})}const Gu=[{id:"score",label:"Score"},{id:"io",label:"I/O"},{id:"logs",label:"Logs"}];function qu({width:e,item:t,evaluators:n,isRunning:r,isDragging:s}){const[a,i]=E.useState("score"),l=!!t;return o.jsxs("div",{className:`shrink-0 flex flex-col overflow-hidden${s?"":" transition-[width] duration-200 ease-in-out"}`,style:{width:l?e:0,background:"var(--bg-primary)"},children:[o.jsxs("div",{className:"flex items-center gap-1 px-2 h-10 border-b shrink-0",style:{borderColor:"var(--border)",background:"var(--bg-secondary)",minWidth:e},children:[Gu.map(c=>o.jsx("button",{onClick:()=>i(c.id),className:"px-2.5 py-1 h-7 text-xs font-semibold rounded transition-colors cursor-pointer",style:{color:a===c.id?"var(--accent)":"var(--text-muted)",background:a===c.id?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent",border:"none"},onMouseEnter:u=>{a!==c.id&&(u.currentTarget.style.color="var(--text-primary)")},onMouseLeave:u=>{a!==c.id&&(u.currentTarget.style.color="var(--text-muted)")},children:c.label},c.id)),r&&o.jsx("span",{className:"ml-auto text-[11px] px-2 py-0.5 rounded-full shrink-0",style:{background:"color-mix(in srgb, var(--warning) 15%, var(--bg-secondary))",color:"var(--warning)"},children:"Running..."})]}),o.jsx("div",{className:"flex-1 overflow-y-auto",style:{minWidth:e},children:t?t.status==="pending"?o.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)] text-xs",children:"Pending..."}):o.jsxs(o.Fragment,{children:[t.status==="failed"&&o.jsxs("div",{className:"mx-2 mt-2 px-3 py-2 rounded text-xs",style:{background:"rgba(239,68,68,0.1)",color:"var(--error)"},children:[o.jsxs("div",{className:"flex items-center gap-2 font-semibold",children:[o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[o.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("path",{d:"M8 4.5v4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),o.jsx("circle",{cx:"8",cy:"11",r:"0.75",fill:"currentColor"})]}),o.jsx("span",{children:"Evaluator error"})]}),t.error&&o.jsx("div",{className:"mt-1 pl-[22px] text-[11px] opacity-80 break-words",style:{color:"var(--text-secondary)"},children:t.error})]}),a==="score"?o.jsx(Vu,{item:t,evaluators:n}):a==="io"?o.jsx(Yu,{item:t}):o.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)] text-xs",children:"Logs coming soon"})]}):null})]})}function Vu({item:e,evaluators:t}){const n=Object.keys(e.scores);return o.jsxs("div",{className:"p-2 overflow-y-auto h-full space-y-1.5",children:[o.jsx("div",{className:"overflow-hidden",style:{border:"1px solid var(--border)"},children:o.jsxs("div",{className:"px-3 py-2 flex items-center gap-2",style:{background:"var(--bg-secondary)"},children:[o.jsx("span",{className:"truncate text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Overall"}),o.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[o.jsx("div",{className:"w-24 h-2.5 rounded-full overflow-hidden",style:{background:"var(--bg-tertiary)"},children:o.jsx("div",{className:"h-full rounded-full",style:{width:`${e.overall_score*100}%`,background:Et(e.overall_score)}})}),o.jsx("span",{className:"text-xs font-mono font-bold shrink-0 w-10 text-right",style:{color:Et(e.overall_score)},children:tn(e.overall_score)})]})]})}),e.status==="failed"&&n.length===0&&o.jsx("div",{className:"px-3 py-3 text-xs text-center",style:{color:"var(--text-muted)"},children:"All evaluators failed — no scores available"}),n.map(r=>{const s=t.find(l=>l.id===r),a=e.scores[r],i=e.justifications[r];return o.jsxs("div",{className:"overflow-hidden",style:{border:"1px solid var(--border)"},children:[o.jsxs("div",{className:"px-3 py-2 flex items-center gap-2",style:{background:"var(--bg-secondary)"},children:[o.jsx("span",{className:"truncate text-[11px] font-semibold",style:{color:"var(--text-primary)"},title:(s==null?void 0:s.name)??r,children:(s==null?void 0:s.name)??r}),o.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[o.jsx("div",{className:"w-24 h-2.5 rounded-full overflow-hidden",style:{background:"var(--bg-tertiary)"},children:o.jsx("div",{className:"h-full rounded-full",style:{width:`${a*100}%`,background:Et(a)}})}),o.jsx("span",{className:"text-xs font-mono font-bold shrink-0 w-10 text-right",style:{color:Et(a)},children:tn(a)})]})]}),i&&o.jsx(Zu,{text:i})]},r)})]})}function Yu({item:e}){const t=JSON.stringify(e.inputs,null,2),n=typeof e.output=="string"?e.output:JSON.stringify(e.output,null,2),r=e.expected_output!=null?typeof e.expected_output=="string"?e.expected_output:JSON.stringify(e.expected_output,null,2):null;return o.jsxs("div",{className:"p-2 overflow-y-auto h-full space-y-1.5",children:[o.jsx(wt,{title:"Input",copyText:t,children:o.jsx(ot,{json:t,className:"px-3 py-2 text-xs font-mono whitespace-pre-wrap break-words"})}),r&&o.jsx(wt,{title:"Expected Output",copyText:r,children:o.jsx(ot,{json:r,className:"px-3 py-2 text-xs font-mono whitespace-pre-wrap break-words"})}),o.jsx(wt,{title:"Output",copyText:n,trailing:e.duration_ms!==null?o.jsxs("span",{className:"ml-auto text-[10px]",style:{color:"var(--text-muted)"},children:[(e.duration_ms/1e3).toFixed(2),"s"]}):void 0,children:o.jsx(ot,{json:n,className:"px-3 py-2 text-xs font-mono whitespace-pre-wrap break-words"})})]})}function Xu(e){var s;const t=e.match(/expected="(.+?)"\s+actual="(.+?)"(.*)/s);if(!t)return null;const n={},r=((s=t[3])==null?void 0:s.trim())??"";if(r)for(const a of r.match(/(\w+)=([\S]+)/g)??[]){const i=a.indexOf("=");n[a.slice(0,i)]=a.slice(i+1)}return{expected:t[1],actual:t[2],meta:n}}function Eo(e){try{const t=e.replace(/'/g,'"').replace(/\bTrue\b/g,"true").replace(/\bFalse\b/g,"false").replace(/\bNone\b/g,"null"),n=JSON.parse(t);return JSON.stringify(n,null,2)}catch{return e}}function Zu({text:e}){const t=Xu(e);if(!t)return o.jsx("div",{className:"px-3 py-2 border-t",style:{borderColor:"var(--border)"},children:o.jsx("div",{className:"text-xs leading-relaxed",style:{color:"var(--text-secondary)"},children:e})});const n=Eo(t.expected),r=Eo(t.actual),s=n===r;return o.jsxs("div",{className:"border-t",style:{borderColor:"var(--border)"},children:[o.jsxs("div",{className:"grid grid-cols-2 gap-0",children:[o.jsxs("div",{className:"px-3 py-2 border-r",style:{borderColor:"var(--border)"},children:[o.jsx("div",{className:"text-[10px] font-semibold mb-1",style:{color:"var(--text-muted)"},children:"Expected"}),o.jsx("pre",{className:"text-[11px] font-mono whitespace-pre-wrap break-words",style:{color:"var(--text-secondary)"},children:n})]}),o.jsxs("div",{className:"px-3 py-2",children:[o.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[o.jsx("span",{className:"text-[10px] font-semibold",style:{color:"var(--text-muted)"},children:"Actual"}),o.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:s?"var(--success)":"var(--error)"}})]}),o.jsx("pre",{className:"text-[11px] font-mono whitespace-pre-wrap break-words",style:{color:s?"var(--success)":"var(--error)"},children:r})]})]}),Object.keys(t.meta).length>0&&o.jsx("div",{className:"px-3 py-1.5 border-t flex items-center gap-3",style:{borderColor:"var(--border)"},children:Object.entries(t.meta).map(([a,i])=>o.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-muted)"},children:[o.jsx("span",{className:"font-medium",children:a.replace(/_/g," ")})," ",o.jsx("span",{className:"font-mono",children:i})]},a))})]})}const wo={deterministic:"var(--success)",llm:"#a78bfa",tool:"var(--info)"};function _o(){const e=Ae(f=>f.localEvaluators),t=Ae(f=>f.addEvalSet),{navigate:n}=Ve(),[r,s]=E.useState(""),[a,i]=E.useState(new Set),[l,c]=E.useState(null),[u,d]=E.useState(!1),p=f=>{i(x=>{const h=new Set(x);return h.has(f)?h.delete(f):h.add(f),h})},m=async()=>{if(r.trim()){c(null),d(!0);try{const f=await Rc({name:r.trim(),evaluator_refs:Array.from(a)});t(f),n(`#/evals/sets/${f.id}`)}catch(f){c(f.detail||f.message||"Failed to create eval set")}finally{d(!1)}}};return o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsxs("div",{className:"w-full max-w-xl px-6",children:[o.jsxs("div",{className:"mb-8 text-center",children:[o.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[o.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:"var(--accent)"}}),o.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--text-muted)"},children:"New Eval Set"})]}),o.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:"Create an evaluation set with a name and evaluators"})]}),o.jsxs("div",{className:"mb-6",children:[o.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Name"}),o.jsx("input",{type:"text",value:r,onChange:f=>s(f.target.value),placeholder:"e.g. Basic QA Tests",className:"w-full rounded-md px-3 py-2 text-xs",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)",color:"var(--text-primary)"},onKeyDown:f=>{f.key==="Enter"&&r.trim()&&m()}})]}),o.jsxs("div",{className:"mb-6",children:[o.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Evaluators"}),e.length===0?o.jsxs("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:["No evaluators configured."," ",o.jsx("button",{onClick:()=>n("#/evaluators/new"),className:"underline cursor-pointer",style:{color:"var(--accent)",background:"none",border:"none",padding:0,font:"inherit"},children:"Create one first"})]}):o.jsx("div",{className:"rounded-md border overflow-hidden",style:{borderColor:"var(--border)",background:"var(--bg-secondary)"},children:e.map(f=>o.jsxs("label",{className:"flex items-center gap-2.5 px-3 py-2 text-xs cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--border)"},onMouseEnter:x=>{x.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent"},children:[o.jsx("input",{type:"checkbox",checked:a.has(f.id),onChange:()=>p(f.id),className:"accent-[var(--accent)]"}),o.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:f.name}),o.jsx("span",{className:"text-[11px] font-medium px-1.5 py-0.5 rounded",style:{background:`color-mix(in srgb, ${wo[f.type]??"var(--text-muted)"} 15%, transparent)`,color:wo[f.type]??"var(--text-muted)"},children:f.type})]},f.id))})]}),l&&o.jsx("p",{className:"text-xs mb-4 px-3 py-2 rounded",style:{color:"var(--error)",background:"color-mix(in srgb, var(--error) 10%, var(--bg-secondary))"},children:l}),o.jsx("button",{onClick:m,disabled:!r.trim()||u,className:"w-full py-2 rounded-md text-[13px] font-semibold transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"var(--accent)",color:"var(--bg-primary)",border:"none"},children:u?"Creating...":"Create Eval Set"})]})})}const Ju=[{type:"deterministic",label:"Deterministic",badgeColor:"var(--success)"},{type:"llm",label:"LLM Judge",badgeColor:"#a78bfa"},{type:"tool",label:"Tool-Based",badgeColor:"var(--info)"}];function No(){const e=Ae(a=>a.localEvaluators),{evaluatorFilter:t,evaluatorCreateType:n,navigate:r}=Ve(),s=!t&&!n;return o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>r("#/evaluators/new"),className:"mx-3 mt-2.5 mb-1 px-3 py-1.5 text-[11px] font-medium rounded border border-[var(--border)] bg-transparent transition-colors cursor-pointer",style:{color:"var(--text-secondary)"},onMouseEnter:a=>{a.currentTarget.style.color="var(--text-primary)",a.currentTarget.style.borderColor="var(--text-muted)"},onMouseLeave:a=>{a.currentTarget.style.color="var(--text-secondary)",a.currentTarget.style.borderColor=""},children:"+ New Evaluator"}),o.jsx("div",{className:"px-3 pt-3 pb-1 text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"Categories"}),o.jsxs("div",{className:"flex-1 overflow-y-auto",children:[o.jsxs("button",{onClick:()=>r("#/evaluators"),className:"w-full text-left px-3 py-2 text-xs flex items-center gap-2 cursor-pointer transition-colors",style:{background:s?"color-mix(in srgb, var(--accent) 15%, var(--bg-primary))":"transparent",color:s?"var(--text-primary)":"var(--text-secondary)",borderLeft:s?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:a=>{s||(a.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:a=>{s||(a.currentTarget.style.background="transparent")},children:[o.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:"var(--text-muted)"}}),o.jsx("span",{className:"flex-1 truncate",children:"All"}),e.length>0&&o.jsx("span",{className:"text-[10px] px-1.5 rounded-full",style:{background:"var(--bg-tertiary)",color:"var(--text-muted)"},children:e.length})]}),Ju.map(a=>{const i=e.filter(c=>c.type===a.type).length,l=t===a.type;return o.jsxs("button",{onClick:()=>r(l?"#/evaluators":`#/evaluators/category/${a.type}`),className:"w-full text-left px-3 py-2 text-xs flex items-center gap-2 cursor-pointer transition-colors",style:{background:l?"color-mix(in srgb, var(--accent) 15%, var(--bg-primary))":"transparent",color:l?"var(--text-primary)":"var(--text-secondary)",borderLeft:l?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:c=>{l||(c.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:c=>{l||(c.currentTarget.style.background="transparent")},children:[o.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:a.badgeColor}}),o.jsx("span",{className:"flex-1 truncate",children:a.label}),i>0&&o.jsx("span",{className:"text-[10px] px-1.5 rounded-full",style:{background:"var(--bg-tertiary)",color:"var(--text-muted)"},children:i})]},a.type)})]})]})}const So={deterministic:{label:"Deterministic",color:"var(--success)",bg:"rgba(34,197,94,0.1)"},llm:{label:"LLM Judge",color:"#a78bfa",bg:"rgba(167,139,250,0.1)"},tool:{label:"Tool-Based",color:"var(--info)",bg:"rgba(59,130,246,0.1)"}},Gr={deterministic:"Deterministic",llm:"LLM Judge",tool:"Tool-Based"},mn={deterministic:[{id:"uipath-exact-match",name:"Exact Match"},{id:"uipath-contains",name:"Contains"},{id:"uipath-json-similarity",name:"JSON Similarity"}],llm:[{id:"uipath-llm-judge-output-semantic-similarity",name:"LLM Judge Output"},{id:"uipath-llm-judge-output-strict-json-similarity",name:"LLM Judge Strict JSON"},{id:"uipath-llm-judge-trajectory-similarity",name:"LLM Judge Trajectory"},{id:"uipath-llm-judge-trajectory-simulation",name:"LLM Judge Trajectory Simulation"}],tool:[{id:"uipath-tool-call-order",name:"Tool Call Order"},{id:"uipath-tool-call-args",name:"Tool Call Args"},{id:"uipath-tool-call-count",name:"Tool Call Count"},{id:"uipath-tool-call-output",name:"Tool Call Output"}]};function Vi(e){return e.includes("trajectory")?{targetOutputKey:!1,prompt:!0}:e.includes("llm-judge")?{targetOutputKey:!0,prompt:!0}:e.includes("tool-call-output")?{targetOutputKey:!0,prompt:!1}:e.includes("exact-match")||e.includes("contains")||e.includes("json-similarity")?{targetOutputKey:!0,prompt:!1}:{targetOutputKey:!1,prompt:!1}}const vr={"uipath-exact-match":{description:"Checks whether the agent output exactly matches the expected output.",prompt:""},"uipath-contains":{description:"Checks whether the agent output contains the expected substring.",prompt:""},"uipath-json-similarity":{description:"Compares JSON structures for semantic similarity, ignoring key ordering and whitespace.",prompt:""},"uipath-llm-judge-output-semantic-similarity":{description:"Uses an LLM to score semantic similarity between the agent's actual output and the expected output, accounting for synonyms, paraphrases, and equivalent expressions.",prompt:`As an expert evaluator, analyze the semantic similarity between the expected and actual outputs and determine a score from 0 to 100. Focus on comparing meaning and contextual equivalence of corresponding fields, accounting for alternative valid expressions, synonyms, and reasonable variations in language while maintaining high standards for accuracy and completeness. Provide your score with a brief justification.
+----
+ExpectedOutput:
+{{ExpectedOutput}}
+----
+ActualOutput:
+{{ActualOutput}}`},"uipath-llm-judge-output-strict-json-similarity":{description:"Uses an LLM to perform strict structural and value comparison between JSON outputs, checking key names, nesting, types, and values.",prompt:`As an expert evaluator, perform a strict comparison of the expected and actual JSON outputs and determine a score from 0 to 100. Check that all keys are present, values match in type and content, and nesting structure is preserved. Minor formatting differences (whitespace, key ordering) should not affect the score. Provide your score with a brief justification.
+----
+ExpectedOutput:
+{{ExpectedOutput}}
+----
+ActualOutput:
+{{ActualOutput}}`},"uipath-llm-judge-trajectory-similarity":{description:"Uses an LLM to evaluate whether the agent's tool-call trajectory matches the expected sequence of actions, considering order, arguments, and completeness.",prompt:`As an expert evaluator, compare the agent's actual tool-call trajectory against the expected trajectory and determine a score from 0 to 100. Consider the order of tool calls, the correctness of arguments passed, and whether all expected steps were completed. Minor variations in argument formatting are acceptable if semantically equivalent. Provide your score with a brief justification.
+----
+ExpectedTrajectory:
+{{ExpectedTrajectory}}
+----
+ActualTrajectory:
+{{ActualTrajectory}}`},"uipath-llm-judge-trajectory-simulation":{description:"Uses an LLM to evaluate the agent's behavior against simulation instructions and expected outcomes by analyzing the full run history.",prompt:`As an expert evaluator, determine how well the agent performed on a scale of 0 to 100. Focus on whether the simulation was successful and whether the agent behaved according to the expected output, accounting for alternative valid expressions and reasonable variations in language while maintaining high standards for accuracy and completeness. Provide your score with a brief justification.
+----
+UserOrSyntheticInputGivenToAgent:
+{{UserOrSyntheticInput}}
+----
+SimulationInstructions:
+{{SimulationInstructions}}
+----
+ExpectedAgentBehavior:
+{{ExpectedAgentBehavior}}
+----
+AgentRunHistory:
+{{AgentRunHistory}}`},"uipath-tool-call-order":{description:"Validates that the agent called tools in the expected sequence.",prompt:""},"uipath-tool-call-args":{description:"Checks whether the agent called tools with the expected arguments.",prompt:""},"uipath-tool-call-count":{description:"Validates that the agent made the expected number of tool calls.",prompt:""},"uipath-tool-call-output":{description:"Validates the output returned by the agent's tool calls.",prompt:""}};function Qu(e){for(const[t,n]of Object.entries(mn))if(n.some(r=>r.id===e))return t;return"deterministic"}function ed({evaluatorId:e,evaluatorFilter:t}){const n=Ae(b=>b.localEvaluators),r=Ae(b=>b.setLocalEvaluators),s=Ae(b=>b.upsertLocalEvaluator),a=Ae(b=>b.evaluators),{navigate:i}=Ve(),l=e?n.find(b=>b.id===e)??null:null,c=!!l,u=t?n.filter(b=>b.type===t):n,[d,p]=E.useState(()=>{const b=localStorage.getItem("evaluatorSidebarWidth");return b?parseInt(b,10):320}),[m,f]=E.useState(!1),x=E.useRef(null);E.useEffect(()=>{localStorage.setItem("evaluatorSidebarWidth",String(d))},[d]),E.useEffect(()=>{us().then(r).catch(console.error)},[r]);const h=E.useCallback(b=>{b.preventDefault(),f(!0);const A="touches"in b?b.touches[0].clientX:b.clientX,I=d,L=B=>{const D=x.current;if(!D)return;const C="touches"in B?B.touches[0].clientX:B.clientX,S=D.clientWidth-300,N=Math.max(280,Math.min(S,I+(A-C)));p(N)},T=()=>{f(!1),document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",T),document.removeEventListener("touchmove",L),document.removeEventListener("touchend",T),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",L),document.addEventListener("mouseup",T),document.addEventListener("touchmove",L,{passive:!1}),document.addEventListener("touchend",T)},[d]),v=b=>{s(b)},y=()=>{i("#/evaluators")};return o.jsxs("div",{ref:x,className:"flex h-full",children:[o.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[o.jsxs("div",{className:"px-4 h-10 border-b shrink-0 flex items-center gap-4",style:{borderColor:"var(--border)"},children:[o.jsx("h1",{className:"text-base font-semibold",style:{color:"var(--text-primary)"},children:"Evaluators"}),o.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-muted)"},children:[u.length,t?` / ${n.length}`:""," configured"]})]}),o.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:u.length===0?o.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)] text-xs",children:n.length===0?"No evaluators configured yet.":"No evaluators in this category."}):o.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(320px, 1fr))"},children:u.map(b=>o.jsx(td,{evaluator:b,evaluators:a,selected:b.id===e,onClick:()=>i(b.id===e?"#/evaluators":`#/evaluators/${encodeURIComponent(b.id)}`)},b.id))})})]}),o.jsx("div",{onMouseDown:h,onTouchStart:h,className:`shrink-0 drag-handle-col${m?"":" transition-all"}`,style:{width:c?3:0,opacity:c?1:0}}),o.jsxs("div",{className:`shrink-0 flex flex-col overflow-hidden${m?"":" transition-[width] duration-200 ease-in-out"}`,style:{width:c?d:0,background:"var(--bg-primary)"},children:[o.jsxs("div",{className:"flex items-center gap-1 px-2 h-10 border-b shrink-0",style:{borderColor:"var(--border)",background:"var(--bg-secondary)",minWidth:d},children:[o.jsx("span",{className:"px-2 py-0.5 h-7 text-xs font-semibold rounded inline-flex items-center",style:{color:"var(--accent)",background:"color-mix(in srgb, var(--accent) 10%, transparent)"},children:"Edit Evaluator"}),o.jsx("button",{onClick:y,"aria-label":"Close editor",className:"ml-auto w-7 h-7 flex items-center justify-center rounded cursor-pointer transition-colors",style:{color:"var(--text-muted)",background:"transparent",border:"none"},onMouseEnter:b=>{b.currentTarget.style.color="var(--text-primary)"},onMouseLeave:b=>{b.currentTarget.style.color="var(--text-muted)"},children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.jsx("div",{className:"flex-1 overflow-hidden",style:{minWidth:d},children:l&&o.jsx(nd,{evaluator:l,onUpdated:v})})]})]})}function td({evaluator:e,evaluators:t,selected:n,onClick:r}){const s=So[e.type]??So.deterministic,a=t.find(l=>l.id===e.evaluator_type_id),i=e.evaluator_type_id.startsWith("file://");return o.jsxs("div",{className:"rounded-md p-4 flex flex-col cursor-pointer transition-colors",style:{border:n?"1px solid var(--accent)":"1px solid var(--border)",background:n?"color-mix(in srgb, var(--accent) 5%, var(--card-bg))":"var(--card-bg)"},onClick:r,onMouseEnter:l=>{n||(l.currentTarget.style.borderColor="var(--text-muted)")},onMouseLeave:l=>{n||(l.currentTarget.style.borderColor="var(--border)")},children:[o.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--text-primary)"},children:e.name}),e.description&&o.jsx("div",{className:"text-xs leading-relaxed mt-2",style:{color:"var(--text-secondary)"},children:e.description}),o.jsxs("div",{className:"flex flex-wrap gap-1.5 mt-auto pt-3",children:[o.jsxs("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium",style:{color:s.color,background:s.bg},children:["Category: ",s.label]}),o.jsxs("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium",style:{background:"var(--bg-tertiary)",color:"var(--text-secondary)"},children:["Type: ",i?"Custom":(a==null?void 0:a.name)??e.evaluator_type_id]}),o.jsxs("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium font-mono",style:{background:"var(--bg-tertiary)",color:"var(--text-secondary)"},children:["Target: ",e.target_output_key||"*"]})]})]})}function nd({evaluator:e,onUpdated:t}){var L,T;const n=Qu(e.evaluator_type_id),r=mn[n]??[],[s,a]=E.useState(e.description),[i,l]=E.useState(e.evaluator_type_id),[c,u]=E.useState(((L=e.config)==null?void 0:L.targetOutputKey)??"*"),[d,p]=E.useState(((T=e.config)==null?void 0:T.prompt)??""),[m,f]=E.useState(!1),[x,h]=E.useState(null),[v,y]=E.useState(!1);E.useEffect(()=>{var B,D;a(e.description),l(e.evaluator_type_id),u(((B=e.config)==null?void 0:B.targetOutputKey)??"*"),p(((D=e.config)==null?void 0:D.prompt)??""),h(null),y(!1)},[e.id]);const b=Vi(i),A=async()=>{f(!0),h(null),y(!1);try{const B={};b.targetOutputKey&&(B.targetOutputKey=c),b.prompt&&d.trim()&&(B.prompt=d);const D=await $c(e.id,{description:s.trim(),evaluator_type_id:i,config:B});t(D),y(!0),setTimeout(()=>y(!1),2e3)}catch(B){const D=B==null?void 0:B.detail;h(D??"Failed to update evaluator")}finally{f(!1)}},I={background:"var(--bg-secondary)",color:"var(--text-primary)",border:"1px solid var(--border)"};return o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"p-4 overflow-y-auto flex-1 space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-[11px] font-medium block mb-1",style:{color:"var(--text-muted)"},children:"Name"}),o.jsx("div",{className:"px-3 py-2 rounded-lg text-xs",style:{background:"var(--bg-tertiary)",color:"var(--text-secondary)"},children:e.name})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-[11px] font-medium block mb-1",style:{color:"var(--text-muted)"},children:"Category"}),o.jsx("div",{className:"px-3 py-2 rounded-lg text-xs",style:{background:"var(--bg-tertiary)",color:"var(--text-secondary)"},children:Gr[n]??n})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-[11px] font-medium block mb-1",style:{color:"var(--text-muted)"},children:"Type"}),o.jsx("select",{value:i,onChange:B=>l(B.target.value),className:"w-full px-3 py-2 rounded-lg text-xs outline-none cursor-pointer",style:I,children:r.map(B=>o.jsx("option",{value:B.id,children:B.name},B.id))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-[11px] font-medium block mb-1",style:{color:"var(--text-muted)"},children:"Description"}),o.jsx("textarea",{value:s,onChange:B=>a(B.target.value),placeholder:"What does this evaluator check?",rows:4,className:"w-full px-3 py-2 rounded-lg text-xs leading-relaxed outline-none resize-y",style:I})]}),b.targetOutputKey&&o.jsxs("div",{children:[o.jsx("label",{className:"text-[11px] font-medium block mb-1",style:{color:"var(--text-muted)"},children:"Target Output Key"}),o.jsx("input",{type:"text",value:c,onChange:B=>u(B.target.value),placeholder:"*",className:"w-full px-3 py-2 rounded-lg text-xs outline-none",style:I}),o.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-muted)"},children:"Use * for entire output or a specific key name"})]}),b.prompt&&o.jsxs("div",{children:[o.jsx("label",{className:"text-[11px] font-medium block mb-1",style:{color:"var(--text-muted)"},children:"Prompt"}),o.jsx("textarea",{value:d,onChange:B=>p(B.target.value),placeholder:"Evaluation prompt for the LLM judge...",rows:8,className:"w-full px-3 py-2 rounded-lg text-xs font-mono leading-relaxed outline-none resize-y",style:I})]})]}),o.jsxs("div",{className:"shrink-0 p-4 space-y-2",children:[x&&o.jsx("div",{className:"text-xs px-3 py-2 rounded-lg",style:{background:"rgba(239,68,68,0.1)",color:"var(--error)"},children:x}),v&&o.jsx("div",{className:"text-xs px-3 py-2 rounded-lg",style:{background:"rgba(34,197,94,0.1)",color:"var(--success)"},children:"Saved successfully"}),o.jsx("button",{onClick:A,disabled:m,className:"w-full py-2.5 text-xs font-semibold rounded-md border cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed transition-colors",style:{background:"transparent",borderColor:"var(--accent)",color:"var(--accent)"},onMouseEnter:B=>{B.currentTarget.style.background="color-mix(in srgb, var(--accent) 15%, transparent)"},onMouseLeave:B=>{B.currentTarget.style.background="transparent"},children:m?"Saving...":"Save Changes"})]})]})}const rd=["deterministic","llm","tool"];function sd({category:e}){var _;const t=Ae(w=>w.addLocalEvaluator),{navigate:n}=Ve(),r=e!=="any",[s,a]=E.useState(r?e:"deterministic"),i=mn[s]??[],[l,c]=E.useState(""),[u,d]=E.useState(""),[p,m]=E.useState(((_=i[0])==null?void 0:_.id)??""),[f,x]=E.useState("*"),[h,v]=E.useState(""),[y,b]=E.useState(!1),[A,I]=E.useState(null),[L,T]=E.useState(!1),[B,D]=E.useState(!1);E.useEffect(()=>{var q;const w=r?e:"deterministic";a(w);const H=((q=(mn[w]??[])[0])==null?void 0:q.id)??"",z=vr[H];c(""),d((z==null?void 0:z.description)??""),m(H),x("*"),v((z==null?void 0:z.prompt)??""),I(null),T(!1),D(!1)},[e,r]);const C=w=>{var q;a(w);const H=((q=(mn[w]??[])[0])==null?void 0:q.id)??"",z=vr[H];m(H),L||d((z==null?void 0:z.description)??""),B||v((z==null?void 0:z.prompt)??"")},S=w=>{m(w);const R=vr[w];R&&(L||d(R.description),B||v(R.prompt))},N=Vi(p),O=async()=>{if(!l.trim()){I("Name is required");return}b(!0),I(null);try{const w={};N.targetOutputKey&&(w.targetOutputKey=f),N.prompt&&h.trim()&&(w.prompt=h);const R=await Bc({name:l.trim(),description:u.trim(),evaluator_type_id:p,config:w});t(R),n("#/evaluators")}catch(w){const R=w==null?void 0:w.detail;I(R??"Failed to create evaluator")}finally{b(!1)}},M={background:"var(--bg-secondary)",border:"1px solid var(--border)",color:"var(--text-primary)"};return o.jsx("div",{className:"h-full overflow-y-auto",children:o.jsx("div",{className:"flex items-center justify-center min-h-full py-8",children:o.jsxs("div",{className:"w-full max-w-xl px-6",children:[o.jsxs("div",{className:"mb-8 text-center",children:[o.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[o.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:"var(--accent)"}}),o.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--text-muted)"},children:"New Evaluator"})]}),o.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:"Create an evaluator to score agent outputs"})]}),o.jsxs("div",{className:"mb-6",children:[o.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Name"}),o.jsx("input",{type:"text",value:l,onChange:w=>c(w.target.value),placeholder:"e.g. MyEvaluator",className:"w-full rounded-md px-3 py-2 text-xs",style:M,onKeyDown:w=>{w.key==="Enter"&&l.trim()&&O()}})]}),o.jsxs("div",{className:"mb-6",children:[o.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Category"}),r?o.jsx("div",{className:"px-3 py-2 rounded-md text-xs",style:{background:"var(--bg-tertiary)",color:"var(--text-secondary)"},children:Gr[s]??s}):o.jsx("select",{value:s,onChange:w=>C(w.target.value),className:"w-full rounded-md px-3 py-2 text-xs cursor-pointer appearance-auto",style:M,children:rd.map(w=>o.jsx("option",{value:w,children:Gr[w]},w))})]}),o.jsxs("div",{className:"mb-6",children:[o.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Type"}),o.jsx("select",{value:p,onChange:w=>S(w.target.value),className:"w-full rounded-md px-3 py-2 text-xs cursor-pointer appearance-auto",style:M,children:i.map(w=>o.jsx("option",{value:w.id,children:w.name},w.id))})]}),o.jsxs("div",{className:"mb-6",children:[o.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Description"}),o.jsx("textarea",{value:u,onChange:w=>{d(w.target.value),T(!0)},placeholder:"What does this evaluator check?",rows:3,className:"w-full rounded-md px-3 py-2 text-xs leading-relaxed resize-y",style:M})]}),N.targetOutputKey&&o.jsxs("div",{className:"mb-6",children:[o.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Target Output Key"}),o.jsx("input",{type:"text",value:f,onChange:w=>x(w.target.value),placeholder:"*",className:"w-full rounded-md px-3 py-2 text-xs",style:M}),o.jsx("div",{className:"text-xs mt-1",style:{color:"var(--text-muted)"},children:"Use * for entire output or a specific key name"})]}),N.prompt&&o.jsxs("div",{className:"mb-6",children:[o.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Prompt"}),o.jsx("textarea",{value:h,onChange:w=>{v(w.target.value),D(!0)},placeholder:"Evaluation prompt for the LLM judge...",rows:6,className:"w-full rounded-md px-3 py-2 text-xs font-mono leading-relaxed resize-y",style:M})]}),A&&o.jsx("p",{className:"text-xs mb-4 px-3 py-2 rounded",style:{color:"var(--error)",background:"color-mix(in srgb, var(--error) 10%, var(--bg-secondary))"},children:A}),o.jsx("button",{onClick:O,disabled:y||!l.trim(),className:"w-full py-2 rounded-md text-[13px] font-semibold transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"var(--accent)",color:"var(--bg-primary)",border:"none"},children:y?"Creating...":"Create Evaluator"})]})})})}const rr="/api";async function sr(e,t){const n=await fetch(e,t);if(!n.ok){let r;try{r=(await n.json()).detail||n.statusText}catch{r=n.statusText}const s=new Error(`HTTP ${n.status}`);throw s.detail=r,s.status=n.status,s}return n.json()}async function Yi(){return sr(`${rr}/statedb/status`)}async function Xi(){return sr(`${rr}/statedb/tables`)}async function od(e,t=100,n=0){return sr(`${rr}/statedb/tables/${encodeURIComponent(e)}?limit=${t}&offset=${n}`)}async function id(e,t){return sr(`${rr}/statedb/query`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:e,limit:t})})}function Zi({path:e,name:t,type:n,depth:r}){const s=ge(b=>b.children[e]),a=ge(b=>!!b.expanded[e]),i=ge(b=>!!b.loadingDirs[e]),l=ge(b=>!!b.dirty[e]),c=ge(b=>!!b.agentChangedFiles[e]),u=ge(b=>b.selectedFile),{setChildren:d,toggleExpanded:p,setLoadingDir:m,openTab:f}=ge(),{navigate:x}=Ve(),h=n==="directory",v=!h&&u===e,y=E.useCallback(()=>{h?(!s&&!i&&(m(e,!0),Gn(e).then(b=>d(e,b)).catch(console.error).finally(()=>m(e,!1))),p(e)):(f(e),x(`#/explorer/file/${encodeURIComponent(e)}`))},[h,s,i,e,d,p,m,f,x]);return o.jsxs(o.Fragment,{children:[o.jsxs("button",{onClick:y,className:`w-full text-left flex items-center gap-1 py-[3px] text-[13px] cursor-pointer transition-colors group${c?" agent-changed-file":""}`,style:{paddingLeft:`${12+r*16}px`,paddingRight:"8px",background:v?"color-mix(in srgb, var(--accent) 15%, var(--bg-primary))":"transparent",color:v?"var(--text-primary)":"var(--text-secondary)",border:"none"},onMouseEnter:b=>{v||(b.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:b=>{v||(b.currentTarget.style.background="transparent")},children:[o.jsx("span",{className:"w-3 shrink-0 flex items-center justify-center",style:{color:"var(--text-muted)"},children:h&&o.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",style:{transform:a?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:o.jsx("path",{d:"M3 1.5L7 5L3 8.5z"})})}),o.jsx("span",{className:"shrink-0",style:{color:h?"var(--accent)":"var(--text-muted)"},children:h?o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})}):o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),o.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),o.jsx("span",{className:"truncate flex-1",children:t}),l&&o.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:"var(--accent)"}}),i&&o.jsx("span",{className:"text-[10px] shrink-0",style:{color:"var(--text-muted)"},children:"..."})]}),h&&a&&s&&s.map(b=>o.jsx(Zi,{path:b.path,name:b.name,type:b.type,depth:r+1},b.path))]})}function ad({onDbMissing:e}){const[t,n]=E.useState([]),[r,s]=E.useState(!0),[a,i]=E.useState(!1),{stateDbTable:l,navigate:c}=Ve(),u=E.useCallback(()=>{i(!0),Yi().then(({exists:d})=>{if(!d){e();return}return Xi().then(n)}).catch(console.error).finally(()=>i(!1))},[e]);return E.useEffect(()=>{u()},[u]),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center",children:[o.jsxs("button",{onClick:()=>s(!r),className:"flex-1 text-left flex items-center gap-1 py-[5px] text-[11px] uppercase tracking-wider font-semibold cursor-pointer",style:{paddingLeft:"12px",background:"none",border:"none",color:"var(--text-muted)"},children:[o.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",style:{transform:r?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:o.jsx("path",{d:"M3 1.5L7 5L3 8.5z"})}),"State Database"]}),o.jsx("button",{onClick:d=>{d.stopPropagation(),u()},className:"shrink-0 flex items-center justify-center w-5 h-5 rounded cursor-pointer",style:{background:"none",border:"none",color:"var(--text-muted)",marginRight:"8px"},onMouseEnter:d=>{d.currentTarget.style.color="var(--text-primary)"},onMouseLeave:d=>{d.currentTarget.style.color="var(--text-muted)"},title:"Refresh tables",children:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:a?{animation:"spin 0.6s linear infinite"}:void 0,children:[o.jsx("polyline",{points:"23 4 23 10 17 10"}),o.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]})})]}),r&&t.map(d=>o.jsxs("button",{onClick:()=>c(`#/explorer/statedb/${encodeURIComponent(d.name)}`),className:"w-full text-left flex items-center gap-1 py-[3px] text-[13px] cursor-pointer transition-colors",style:{paddingLeft:"28px",paddingRight:"8px",background:l===d.name?"color-mix(in srgb, var(--accent) 15%, var(--bg-primary))":"transparent",color:l===d.name?"var(--text-primary)":"var(--text-secondary)",border:"none"},onMouseEnter:p=>{l!==d.name&&(p.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:p=>{l!==d.name&&(p.currentTarget.style.background="transparent")},children:[o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--accent)"},className:"shrink-0",children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),o.jsx("line",{x1:"3",y1:"9",x2:"21",y2:"9"}),o.jsx("line",{x1:"3",y1:"15",x2:"21",y2:"15"}),o.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"})]}),o.jsx("span",{className:"truncate flex-1",children:d.name}),o.jsx("span",{className:"text-[10px] shrink-0",style:{color:"var(--text-muted)"},children:d.row_count})]},d.name))]})}function To(){const e=ge(i=>i.children[""]),{setChildren:t}=ge(),[n,r]=E.useState(!1),[s,a]=E.useState(!0);return E.useEffect(()=>{e||Gn("").then(i=>t("",i)).catch(console.error)},[e,t]),E.useEffect(()=>{Yi().then(({exists:i})=>r(i)).catch(()=>r(!1))},[]),o.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[n&&o.jsx(ad,{onDbMissing:()=>r(!1)}),o.jsxs("button",{onClick:()=>a(!s),className:"w-full text-left flex items-center gap-1 py-[5px] text-[11px] uppercase tracking-wider font-semibold cursor-pointer",style:{paddingLeft:"12px",paddingRight:"8px",background:"none",border:"none",color:"var(--text-muted)"},children:[o.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",style:{transform:s?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:o.jsx("path",{d:"M3 1.5L7 5L3 8.5z"})}),"Files"]}),s&&(e?e.map(i=>o.jsx(Zi,{path:i.path,name:i.name,type:i.type,depth:0},i.path)):o.jsx("p",{className:"text-[11px] px-3 py-2",style:{color:"var(--text-muted)"},children:"Loading..."}))]})}const kn="/api";async function ld(){const e=await fetch(`${kn}/agent/models`);if(!e.ok){if(e.status===401)return[];throw new Error(`HTTP ${e.status}`)}return e.json()}async function cd(e){const t=await fetch(`${kn}/agent/session/${e}/diagnostics`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}async function ud(e){const t=await fetch(`${kn}/agent/session/${e}/state`);if(t.status===404)return null;if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}async function dd(e){const t=await fetch(`${kn}/agent/session/${e}/raw-state`);if(t.status===404)return null;if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}async function pd(){const e=await fetch(`${kn}/agent/skills`);if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function fd(e,t){const n=e.split(`
+`),r=t.split(`
+`),s=n.length,a=r.length,i=Array.from({length:s+1},()=>new Array(a+1).fill(0));for(let d=1;d<=s;d++)for(let p=1;p<=a;p++)i[d][p]=n[d-1]===r[p-1]?i[d-1][p-1]+1:Math.max(i[d-1][p],i[d][p-1]);const l=[];let c=s,u=a;for(;c>0||u>0;)c>0&&u>0&&n[c-1]===r[u-1]?(l.push({type:"ctx",text:n[c-1]}),c--,u--):u>0&&(c===0||i[c][u-1]>=i[c-1][u])?(l.push({type:"add",text:r[u-1]}),u--):(l.push({type:"del",text:n[c-1]}),c--);return l.reverse(),l}const md={del:{bg:"color-mix(in srgb, #ef4444 12%, transparent)",color:"#f87171",prefix:"-"},add:{bg:"color-mix(in srgb, #22c55e 12%, transparent)",color:"#4ade80",prefix:"+"},ctx:{bg:"transparent",color:"var(--text-muted)",prefix:" "}};function ds({path:e,oldStr:t,newStr:n}){const r=fd(t,n),s=r.filter(i=>i.type==="del").length,a=r.filter(i=>i.type==="add").length;return o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--text-muted)"},children:"Diff"}),e&&o.jsx("span",{className:"text-[11px] font-mono truncate",style:{color:"var(--text-secondary)"},children:e}),o.jsx("div",{className:"flex-1"}),o.jsxs("span",{className:"text-[11px] font-mono font-medium",style:{color:"#4ade80"},children:["+",a]}),o.jsxs("span",{className:"text-[11px] font-mono font-medium",style:{color:"#f87171"},children:["-",s]})]}),o.jsx("div",{className:"rounded overflow-auto max-h-64",style:{background:"var(--bg-primary)"},children:r.map((i,l)=>{const c=md[i.type];return o.jsxs("div",{className:"flex",style:{background:c.bg},children:[o.jsx("span",{className:"shrink-0 w-5 text-right pr-1 select-none text-[11px] font-mono leading-relaxed",style:{color:c.color,opacity:.6},children:c.prefix}),o.jsx("pre",{className:"text-[11px] leading-relaxed whitespace-pre-wrap break-words font-mono m-0 pl-1 flex-1",style:{color:c.color},children:i.text})]},l)})})]})}const Vn={user:{border:"#22c55e",fg:"#22c55e",bg:"color-mix(in srgb, #22c55e 8%, transparent)",label:"USER"},assistant:{border:"#a855f7",fg:"#a855f7",bg:"color-mix(in srgb, #a855f7 8%, transparent)",label:"ASSISTANT"},tool:{border:"#f59e0b",fg:"#f59e0b",bg:"color-mix(in srgb, #f59e0b 8%, transparent)",label:"TOOL"},system:{border:"#3b82f6",fg:"#3b82f6",bg:"color-mix(in srgb, #3b82f6 8%, transparent)",label:"SYSTEM"},thinking:{border:"#64748b",fg:"#94a3b8",bg:"color-mix(in srgb, #64748b 6%, transparent)",label:"THINKING"}};function Ji(e){return Vn[e]||Vn.system}function hd(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}function Hn(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Qi(e,t){return e.length<=t?e:e.slice(0,t)+"…"}function ea(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function ps({open:e}){return o.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",style:{transition:"transform .12s",transform:e?"rotate(90deg)":"rotate(0)",flexShrink:0,opacity:.5},children:o.jsx("path",{d:"M9 18l6-6-6-6"})})}function gd(){const e=De(c=>c.sessionId),t=De(c=>c.status),[n,r]=E.useState(null),[s,a]=E.useState(!1),i=E.useCallback(()=>{e&&(a(!0),dd(e).then(c=>{c&&r(c)}).catch(console.error).finally(()=>a(!1)))},[e]);if(E.useEffect(()=>{i()},[i]),E.useEffect(()=>{i()},[t,i]),!e)return o.jsx(kr,{text:"No active agent session"});if(!n&&s)return o.jsx(kr,{text:"Loading trace data\\u2026"});if(!n)return o.jsx(kr,{text:"No trace data available"});const l=n.total_prompt_tokens+n.total_completion_tokens;return o.jsxs("div",{className:"flex flex-col h-full",style:{background:"var(--bg-primary)"},children:[o.jsxs("div",{className:"shrink-0 flex items-center gap-3 px-4 h-10 border-b",style:{borderColor:"var(--border)",background:"var(--bg-secondary)"},children:[o.jsx("span",{className:"text-[12px] font-bold",style:{color:"var(--text-primary)"},children:"Trace"}),o.jsx(hn,{text:n.model||"?"}),o.jsx(hn,{text:`${n.turn_count} turn${n.turn_count!==1?"s":""}`}),o.jsx(hn,{text:`${Hn(l)} tok`}),o.jsx(xd,{status:n.status}),o.jsx("div",{className:"flex-1"}),o.jsx("button",{onClick:i,className:"text-[11px] px-2 py-0.5 rounded cursor-pointer",style:{background:"var(--bg-hover)",color:"var(--text-secondary)",border:"none"},children:s?"…":"Refresh"})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto",children:[o.jsx(Co,{label:"System Prompt",children:o.jsx("pre",{className:"text-[11px] leading-relaxed whitespace-pre-wrap break-words font-mono m-0",style:{color:"var(--text-secondary)"},children:n.system_prompt||"(empty)"})}),o.jsx(Co,{label:`Tools (${n.tool_schemas.length})`,children:o.jsx("div",{className:"space-y-0.5",children:n.tool_schemas.map(c=>o.jsxs("div",{className:"flex items-baseline gap-2 py-px",children:[o.jsx("code",{className:"text-[11px] font-semibold shrink-0",style:{color:"var(--accent)"},children:c.function.name}),c.function.description&&o.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-muted)"},children:c.function.description})]},c.function.name))})}),n.traces.length===0?o.jsx("div",{className:"px-4 py-10 text-center text-sm",style:{color:"var(--text-muted)"},children:"No spans yet — send a message to the agent."}):n.traces.map((c,u)=>o.jsx(bd,{span:c,index:u,defaultOpen:u===n.traces.length-1},u))]})]})}function kr({text:e}){return o.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:o.jsx("p",{className:"text-sm",children:e})})}function hn({text:e}){return o.jsx("span",{className:"text-[11px] px-1.5 py-0.5 rounded",style:{background:"var(--bg-hover)",color:"var(--text-muted)"},children:e})}function xd({status:e}){const t=["thinking","executing","awaiting_approval"].includes(e),n=e==="error"?"var(--error)":t?"var(--accent)":"var(--success)";return o.jsxs("span",{className:"flex items-center gap-1 text-[11px]",style:{color:n},children:[o.jsx("span",{className:`w-1.5 h-1.5 rounded-full${t?" animate-pulse":""}`,style:{background:n}}),e]})}function Co({label:e,children:t}){const[n,r]=E.useState(!1);return o.jsxs("div",{className:"border-b",style:{borderColor:"var(--border)"},children:[o.jsxs("button",{onClick:()=>r(!n),className:"w-full flex items-center gap-2 px-4 py-2 cursor-pointer",style:{background:n?"var(--bg-secondary)":"transparent",border:"none"},children:[o.jsx(ps,{open:n}),o.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:e})]}),n&&o.jsx("div",{className:"px-4 pb-3 pt-1",style:{background:"var(--bg-secondary)"},children:t})]})}function bd({span:e,index:t,defaultOpen:n}){const[r,s]=E.useState(n),a=e.prompt_tokens+e.completion_tokens,i=e.output_tool_calls.length;return o.jsxs("div",{className:"border-b",style:{borderColor:"var(--border)"},children:[o.jsxs("button",{onClick:()=>s(!r),className:"w-full flex items-center gap-2 px-4 py-2.5 cursor-pointer",style:{background:"transparent",border:"none"},children:[o.jsx(ps,{open:r}),o.jsxs("span",{className:"text-[12px] font-bold tabular-nums w-14 shrink-0",style:{color:"var(--text-primary)"},children:["Turn ",t+1]}),o.jsx(hn,{text:hd(e.duration_ms)}),o.jsx(hn,{text:`${Hn(a)} tok`}),i>0&&o.jsxs("span",{className:"text-[11px] px-1.5 py-0.5 rounded font-medium",style:{background:Vn.tool.bg,color:Vn.tool.fg},children:[i," tool",i>1?"s":""]}),o.jsx("div",{className:"flex-1"}),o.jsxs("span",{className:"text-[11px] tabular-nums",style:{color:"var(--text-muted)"},children:[Hn(e.prompt_tokens)," in · ",Hn(e.completion_tokens)," out"]})]}),r&&o.jsxs("div",{className:"px-4 pb-4",children:[o.jsx(yd,{label:`Input (${e.input_messages.length} messages)`,messages:e.input_messages,defaultOpen:!1}),o.jsxs("div",{className:"flex items-center gap-2 my-3",children:[o.jsx("div",{className:"flex-1 h-px",style:{background:"var(--border)"}}),o.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest",style:{color:"var(--text-muted)"},children:"Response"}),o.jsx("div",{className:"flex-1 h-px",style:{background:"var(--border)"}})]}),o.jsxs("div",{className:"space-y-2",children:[e.output_thinking&&o.jsx(qr,{role:"thinking",content:e.output_thinking}),e.output_content?o.jsx(qr,{role:"assistant",content:e.output_content}):e.output_thinking?null:o.jsx("div",{className:"text-[11px] italic pl-3",style:{color:"var(--text-muted)"},children:"(no text output)"})]}),i>0&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center gap-2 my-3",children:[o.jsx("div",{className:"flex-1 h-px",style:{background:"var(--border)"}}),o.jsxs("span",{className:"text-[10px] font-bold uppercase tracking-widest",style:{color:"var(--text-muted)"},children:["Tool Calls (",i,")"]}),o.jsx("div",{className:"flex-1 h-px",style:{background:"var(--border)"}})]}),o.jsx("div",{className:"space-y-2",children:e.output_tool_calls.map((l,c)=>{var d;const u=(d=e.tool_results)==null?void 0:d.find(p=>p.name===l.name);return o.jsx(vd,{name:l.name,args:l.arguments,result:u==null?void 0:u.result},c)})})]})]})]})}function yd({label:e,messages:t,defaultOpen:n}){const[r,s]=E.useState(n),a=4,[i,l]=E.useState(!1),c=r?i?t:t.slice(-a):[],u=t.length-(i?0:Math.min(t.length,a));return o.jsxs("div",{children:[o.jsxs("button",{onClick:()=>s(!r),className:"flex items-center gap-1.5 cursor-pointer mb-2",style:{background:"none",border:"none",padding:0},children:[o.jsx(ps,{open:r}),o.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--text-muted)"},children:e})]}),r&&o.jsxs("div",{className:"space-y-1.5",children:[!i&&u>0&&o.jsxs("button",{onClick:()=>l(!0),className:"text-[11px] cursor-pointer",style:{color:"var(--accent)",background:"none",border:"none",padding:"2px 12px"},children:["Show ",u," earlier message",u!==1?"s":""]}),c.map((d,p)=>o.jsx(qr,{role:d.role,content:d.content,toolCalls:d.tool_calls,toolCallId:d.tool_call_id},p))]})]})}function qr({role:e,content:t,toolCalls:n,toolCallId:r}){const[s,a]=E.useState(!1),i=Ji(e),l=t.length>200,c=l&&!s?Qi(t,200):t,u=!t&&!(n!=null&&n.length);return o.jsxs("div",{className:"rounded",style:{background:i.bg,borderLeft:`3px solid ${i.border}`},children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5",children:[o.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider leading-none",style:{color:i.fg},children:i.label}),r&&o.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-muted)"},children:[r.slice(0,12),"\\u2026"]}),n&&n.length>0&&o.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-muted)"},children:["calls: ",n.map(d=>d.name).join(", ")]}),o.jsx("div",{className:"flex-1"}),(l||(n==null?void 0:n.length))&&o.jsx("button",{onClick:()=>a(!s),className:"text-[11px] cursor-pointer font-medium",style:{color:"var(--accent)",background:"none",border:"none",padding:0},children:s?"Collapse":"Expand"})]}),!u&&o.jsxs("div",{className:"px-3 pb-2",children:[t&&o.jsx("pre",{className:"text-[11px] leading-relaxed whitespace-pre-wrap break-words font-[inherit] m-0",style:{color:e==="thinking"?"var(--text-muted)":"var(--text-secondary)"},children:c}),s&&n&&n.length>0&&o.jsx("div",{className:"mt-2 space-y-1.5",children:n.map((d,p)=>o.jsxs("div",{className:"rounded p-2",style:{background:"var(--bg-secondary)"},children:[o.jsx("code",{className:"text-[11px] font-semibold",style:{color:"var(--accent)"},children:d.name}),o.jsx("pre",{className:"text-[11px] leading-relaxed whitespace-pre-wrap break-words font-mono mt-1 m-0 max-h-32 overflow-auto",style:{color:"var(--text-muted)"},children:ea(d.arguments)})]},p))})]}),u&&o.jsx("div",{className:"px-3 pb-2 text-[11px] italic",style:{color:"var(--text-muted)"},children:"(empty)"})]})}function vd({name:e,args:t,result:n}){const[r,s]=E.useState(!1),a=Ji("tool"),i=e==="edit_file";let l=null;if(i)try{l=JSON.parse(t)}catch{}const c=i&&(l==null?void 0:l.old_string)!=null&&(l==null?void 0:l.new_string)!=null;return o.jsxs("div",{className:"rounded",style:{background:a.bg,borderLeft:`3px solid ${a.border}`},children:[o.jsxs("button",{onClick:()=>s(!r),className:"w-full flex items-center gap-2 px-3 py-1.5 cursor-pointer text-left",style:{background:"none",border:"none"},children:[o.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:a.fg},children:"CALL"}),o.jsx("code",{className:"text-[11px] font-semibold",style:{color:"var(--accent)"},children:e}),i&&(l==null?void 0:l.path)&&o.jsx("span",{className:"text-[11px] font-mono truncate",style:{color:"var(--text-muted)"},children:l.path}),n!==void 0&&!r&&!i&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-[11px]",style:{color:"var(--text-muted)"},children:"→"}),o.jsx("span",{className:"text-[11px] truncate flex-1 min-w-0",style:{color:"var(--text-secondary)"},children:Qi(n,80)})]}),o.jsx("div",{className:"flex-1"}),n!==void 0&&o.jsx("span",{className:"text-[11px] px-1.5 py-0.5 rounded",style:{background:n.startsWith("Error")?"color-mix(in srgb, var(--error) 12%, transparent)":"color-mix(in srgb, var(--success) 12%, transparent)",color:n.startsWith("Error")?"var(--error)":"var(--success)"},children:n.startsWith("Error")?"failed":"ok"}),o.jsx("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:r?"Collapse":"Expand"})]}),r&&o.jsxs("div",{className:"px-3 pb-2.5 space-y-2",children:[c?o.jsx(ds,{path:l.path||"",oldStr:l.old_string,newStr:l.new_string}):o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-1",style:{color:"var(--text-muted)"},children:"Arguments"}),o.jsx("pre",{className:"text-[11px] leading-relaxed whitespace-pre-wrap break-words p-2 rounded overflow-auto max-h-52 font-mono m-0",style:{background:"var(--bg-primary)",color:"var(--text-secondary)"},children:ea(t)})]}),n!==void 0&&o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-1",style:{color:"var(--text-muted)"},children:"Result"}),o.jsx("pre",{className:"text-[11px] leading-relaxed whitespace-pre-wrap break-words p-2 rounded overflow-auto max-h-52 font-mono m-0",style:{background:"var(--bg-primary)",color:"var(--text-secondary)"},children:n})]})]})]})}const Er="__agent_state__",Ao=e=>{e.editor.defineTheme("uipath-dark",{base:"vs-dark",inherit:!0,rules:[{token:"comment",foreground:"64748b",fontStyle:"italic"},{token:"keyword",foreground:"c084fc"},{token:"string",foreground:"86efac"},{token:"number",foreground:"fcd34d"},{token:"type",foreground:"7dd3fc"}],colors:{"editor.background":"#0f172a","editor.foreground":"#cbd5e1","editor.lineHighlightBackground":"#1e293b","editor.selectionBackground":"#334155","editor.inactiveSelectionBackground":"#263348","editorLineNumber.foreground":"#64748b","editorLineNumber.activeForeground":"#94a3b8","editorCursor.foreground":"#fa4616","editorIndentGuide.background":"#334155","editorIndentGuide.activeBackground":"#64748b","editorWidget.background":"#1e293b","editorWidget.border":"#334155","editorSuggestWidget.background":"#1e293b","editorSuggestWidget.border":"#334155","editorSuggestWidget.selectedBackground":"#263348","editorHoverWidget.background":"#1e293b","editorHoverWidget.border":"#334155","scrollbarSlider.background":"#33415580","scrollbarSlider.hoverBackground":"#33415599","scrollbarSlider.activeBackground":"#334155cc"}}),e.editor.defineTheme("uipath-light",{base:"vs",inherit:!0,rules:[{token:"comment",foreground:"94a3b8",fontStyle:"italic"},{token:"keyword",foreground:"7c3aed"},{token:"string",foreground:"16a34a"},{token:"number",foreground:"d97706"},{token:"type",foreground:"0284c7"}],colors:{"editor.background":"#f8fafc","editor.foreground":"#0f172a","editor.lineHighlightBackground":"#f1f5f9","editor.selectionBackground":"#e2e8f0","editor.inactiveSelectionBackground":"#f1f5f9","editorLineNumber.foreground":"#94a3b8","editorLineNumber.activeForeground":"#475569","editorCursor.foreground":"#fa4616","editorIndentGuide.background":"#e2e8f0","editorIndentGuide.activeBackground":"#94a3b8","editorWidget.background":"#ffffff","editorWidget.border":"#e2e8f0","editorSuggestWidget.background":"#ffffff","editorSuggestWidget.border":"#e2e8f0","editorSuggestWidget.selectedBackground":"#f1f5f9","editorHoverWidget.background":"#ffffff","editorHoverWidget.border":"#e2e8f0","scrollbarSlider.background":"#d1d5db80","scrollbarSlider.hoverBackground":"#d1d5db99","scrollbarSlider.activeBackground":"#d1d5dbcc"}})};function jo(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function kd(e){const t=e.replace(/\\/g,"/").split("/");return t[t.length-1]||e}function Ed(){const e=ge(M=>M.openTabs),n=ge(M=>M.selectedFile),r=ge(M=>n?M.fileCache[n]:void 0),s=ge(M=>n?!!M.dirty[n]:!1),a=ge(M=>n?M.buffers[n]:void 0),i=ge(M=>M.loadingFile),l=ge(M=>M.dirty),c=ge(M=>M.diffView),u=ge(M=>n?!!M.agentChangedFiles[n]:!1),{setFileContent:d,updateBuffer:p,markClean:m,setLoadingFile:f,openTab:x,closeTab:h,setDiffView:v}=ge(),{navigate:y}=Ve(),b=$i(M=>M.theme),A=E.useRef(null),{explorerFile:I}=Ve();E.useEffect(()=>{I&&x(I)},[I,x]),E.useEffect(()=>{!n||n===Er||ge.getState().fileCache[n]||(f(!0),Hr(n).then(M=>d(n,M)).catch(console.error).finally(()=>f(!1)))},[n,d,f]);const L=E.useCallback(()=>{if(!n)return;const M=ge.getState().fileCache[n],w=ge.getState().buffers[n]??(M==null?void 0:M.content);w!=null&&wc(n,w).then(()=>{m(n),d(n,{...M,content:w})}).catch(console.error)},[n,m,d]);E.useEffect(()=>{const M=_=>{(_.ctrlKey||_.metaKey)&&_.key==="s"&&(_.preventDefault(),L())};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[L]);const T=M=>{A.current=M},B=E.useCallback(M=>{M!==void 0&&n&&p(n,M)},[n,p]),D=E.useCallback(M=>{x(M),y(`#/explorer/file/${encodeURIComponent(M)}`)},[x,y]),C=E.useCallback((M,_)=>{M.stopPropagation();const w=ge.getState(),R=w.openTabs.filter(H=>H!==_);if(h(_),w.selectedFile===_){const H=w.openTabs.indexOf(_),z=R[Math.min(H,R.length-1)];y(z?`#/explorer/file/${encodeURIComponent(z)}`:"#/explorer")}},[h,y]),S=E.useCallback((M,_)=>{M.button===1&&C(M,_)},[C]),N=e.length>0&&o.jsx("div",{className:"h-10 flex items-end overflow-x-auto shrink-0",style:{background:"var(--bg-secondary)",borderBottom:"1px solid var(--border)"},children:e.map(M=>{const _=M===n,w=!!l[M];return o.jsxs("button",{onClick:()=>D(M),onMouseDown:R=>S(R,M),className:"h-full flex items-center gap-1.5 px-3 text-[12px] shrink-0 cursor-pointer transition-colors relative",style:{background:_?"var(--bg-primary)":"transparent",color:_?"var(--text-primary)":"var(--text-secondary)",border:"none",borderBottom:_?"2px solid var(--accent)":"2px solid transparent",maxWidth:"180px"},onMouseEnter:R=>{_||(R.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:R=>{_||(R.currentTarget.style.background="transparent")},children:[o.jsx("span",{className:"truncate",children:M===Er?"Agent Trace":kd(M)}),w?o.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:"var(--accent)"},title:"Unsaved changes"}):o.jsx("span",{className:"w-4 h-4 flex items-center justify-center rounded shrink-0 transition-colors",style:{color:"var(--text-muted)"},onClick:R=>C(R,M),onMouseEnter:R=>{R.currentTarget.style.background="var(--bg-hover)",R.currentTarget.style.color="var(--text-primary)"},onMouseLeave:R=>{R.currentTarget.style.background="transparent",R.currentTarget.style.color="var(--text-muted)"},children:o.jsx("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("path",{d:"M8 8.707l3.646 3.647.708-.707L8.707 8l3.647-3.646-.707-.708L8 7.293 4.354 3.646l-.708.708L7.293 8l-3.647 3.646.708.708L8 8.707z"})})})]},M)})});if(n===Er)return o.jsxs("div",{className:"flex flex-col h-full",children:[N,o.jsx("div",{className:"flex-1 overflow-hidden",children:o.jsx(gd,{})})]});if(!n)return o.jsxs("div",{className:"flex flex-col h-full",children:[N,o.jsx("div",{className:"flex-1 flex items-center justify-center",style:{color:"var(--text-muted)"},children:"Select a file to view"})]});if(i&&!r)return o.jsxs("div",{className:"flex flex-col h-full",children:[N,o.jsx("div",{className:"flex-1 flex items-center justify-center",style:{color:"var(--text-muted)"},children:o.jsx("div",{className:"text-sm",children:"Loading file..."})})]});if(!r&&!i)return o.jsxs("div",{className:"flex flex-col h-full",children:[N,o.jsx("div",{className:"flex-1 flex items-center justify-center",style:{color:"var(--text-muted)"},children:o.jsx("div",{className:"text-sm",children:"Failed to load file"})})]});if(!r)return null;if(r.binary)return o.jsxs("div",{className:"flex flex-col h-full",children:[N,o.jsx("div",{className:"h-8 flex items-center px-3 gap-2 text-xs shrink-0 border-b",style:{borderColor:"var(--border)",background:"var(--bg-secondary)"},children:o.jsx("span",{style:{color:"var(--text-muted)"},children:jo(r.size)})}),o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3",style:{color:"var(--text-muted)"},children:[o.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),o.jsx("polyline",{points:"14 2 14 8 20 8"}),o.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),o.jsx("span",{className:"text-sm",children:"Binary file — preview not available"})]})]});const O=c&&c.path===n;return o.jsxs("div",{className:"flex flex-col h-full",children:[N,o.jsxs("div",{className:"h-8 flex items-center px-3 gap-2 text-xs shrink-0 border-b",style:{borderColor:"var(--border)",background:"var(--bg-secondary)"},children:[r.language&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"var(--bg-hover)",color:"var(--text-muted)"},children:r.language}),o.jsx("span",{style:{color:"var(--text-muted)"},children:jo(r.size)}),u&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{background:"color-mix(in srgb, var(--info) 20%, transparent)",color:"var(--info)"},children:"Agent modified"}),o.jsx("div",{className:"flex-1"}),s&&o.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--accent)"},children:"Modified"}),o.jsx("button",{onClick:L,className:"px-2 py-0.5 rounded text-[11px] font-medium cursor-pointer transition-colors",style:{background:s?"var(--accent)":"var(--bg-hover)",color:s?"white":"var(--text-muted)",border:"none"},children:"Save"})]}),O&&o.jsxs("div",{className:"h-8 flex items-center px-3 gap-2 text-xs shrink-0 border-b",style:{borderColor:"var(--border)",background:"color-mix(in srgb, var(--info) 10%, var(--bg-secondary))"},children:[o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--info)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),o.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),o.jsx("span",{style:{color:"var(--info)"},children:"Agent modified this file"}),o.jsx("div",{className:"flex-1"}),o.jsx("button",{onClick:()=>v(null),className:"px-2 py-0.5 rounded text-[11px] font-medium cursor-pointer transition-colors",style:{background:"var(--bg-hover)",color:"var(--text-secondary)",border:"none"},children:"Dismiss"})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:O?o.jsx(Yl,{original:c.original,modified:c.modified,language:c.language??"plaintext",theme:b==="dark"?"uipath-dark":"uipath-light",beforeMount:Ao,options:{readOnly:!0,minimap:{enabled:!1},fontSize:13,lineNumbersMinChars:4,scrollBeyondLastLine:!1,automaticLayout:!0,renderSideBySide:!0}},`diff-${n}`):o.jsx(Xl,{language:r.language??"plaintext",theme:b==="dark"?"uipath-dark":"uipath-light",value:a??r.content??"",onChange:B,beforeMount:Ao,onMount:T,options:{minimap:{enabled:!1},fontSize:13,lineNumbersMinChars:4,scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,tabSize:2,renderWhitespace:"selection"}},n)})]})}var wr,Mo;function wd(){if(Mo)return wr;Mo=1;function e(j){return j instanceof Map?j.clear=j.delete=j.set=function(){throw new Error("map is read-only")}:j instanceof Set&&(j.add=j.clear=j.delete=function(){throw new Error("set is read-only")}),Object.freeze(j),Object.getOwnPropertyNames(j).forEach($=>{const X=j[$],ce=typeof X;(ce==="object"||ce==="function")&&!Object.isFrozen(X)&&e(X)}),j}class t{constructor($){$.data===void 0&&($.data={}),this.data=$.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(j){return j.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function r(j,...$){const X=Object.create(null);for(const ce in j)X[ce]=j[ce];return $.forEach(function(ce){for(const Me in ce)X[Me]=ce[Me]}),X}const s="",a=j=>!!j.scope,i=(j,{prefix:$})=>{if(j.startsWith("language:"))return j.replace("language:","language-");if(j.includes(".")){const X=j.split(".");return[`${$}${X.shift()}`,...X.map((ce,Me)=>`${ce}${"_".repeat(Me+1)}`)].join(" ")}return`${$}${j}`};class l{constructor($,X){this.buffer="",this.classPrefix=X.classPrefix,$.walk(this)}addText($){this.buffer+=n($)}openNode($){if(!a($))return;const X=i($.scope,{prefix:this.classPrefix});this.span(X)}closeNode($){a($)&&(this.buffer+=s)}value(){return this.buffer}span($){this.buffer+=``}}const c=(j={})=>{const $={children:[]};return Object.assign($,j),$};class u{constructor(){this.rootNode=c(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add($){this.top.children.push($)}openNode($){const X=c({scope:$});this.add(X),this.stack.push(X)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk($){return this.constructor._walk($,this.rootNode)}static _walk($,X){return typeof X=="string"?$.addText(X):X.children&&($.openNode(X),X.children.forEach(ce=>this._walk($,ce)),$.closeNode(X)),$}static _collapse($){typeof $!="string"&&$.children&&($.children.every(X=>typeof X=="string")?$.children=[$.children.join("")]:$.children.forEach(X=>{u._collapse(X)}))}}class d extends u{constructor($){super(),this.options=$}addText($){$!==""&&this.add($)}startScope($){this.openNode($)}endScope(){this.closeNode()}__addSublanguage($,X){const ce=$.root;X&&(ce.scope=`language:${X}`),this.add(ce)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function p(j){return j?typeof j=="string"?j:j.source:null}function m(j){return h("(?=",j,")")}function f(j){return h("(?:",j,")*")}function x(j){return h("(?:",j,")?")}function h(...j){return j.map(X=>p(X)).join("")}function v(j){const $=j[j.length-1];return typeof $=="object"&&$.constructor===Object?(j.splice(j.length-1,1),$):{}}function y(...j){return"("+(v(j).capture?"":"?:")+j.map(ce=>p(ce)).join("|")+")"}function b(j){return new RegExp(j.toString()+"|").exec("").length-1}function A(j,$){const X=j&&j.exec($);return X&&X.index===0}const I=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function L(j,{joinWith:$}){let X=0;return j.map(ce=>{X+=1;const Me=X;let Re=p(ce),ee="";for(;Re.length>0;){const Q=I.exec(Re);if(!Q){ee+=Re;break}ee+=Re.substring(0,Q.index),Re=Re.substring(Q.index+Q[0].length),Q[0][0]==="\\"&&Q[1]?ee+="\\"+String(Number(Q[1])+Me):(ee+=Q[0],Q[0]==="("&&X++)}return ee}).map(ce=>`(${ce})`).join($)}const T=/\b\B/,B="[a-zA-Z]\\w*",D="[a-zA-Z_]\\w*",C="\\b\\d+(\\.\\d+)?",S="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",N="\\b(0b[01]+)",O="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",M=(j={})=>{const $=/^#![ ]*\//;return j.binary&&(j.begin=h($,/.*\b/,j.binary,/\b.*/)),r({scope:"meta",begin:$,end:/$/,relevance:0,"on:begin":(X,ce)=>{X.index!==0&&ce.ignoreMatch()}},j)},_={begin:"\\\\[\\s\\S]",relevance:0},w={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[_]},R={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[_]},H={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},z=function(j,$,X={}){const ce=r({scope:"comment",begin:j,end:$,contains:[]},X);ce.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const Me=y("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return ce.contains.push({begin:h(/[ ]+/,"(",Me,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),ce},q=z("//","$"),g=z("/\\*","\\*/"),F=z("#","$"),K={scope:"number",begin:C,relevance:0},k={scope:"number",begin:S,relevance:0},se={scope:"number",begin:N,relevance:0},G={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[_,{begin:/\[/,end:/\]/,relevance:0,contains:[_]}]},U={scope:"title",begin:B,relevance:0},re={scope:"title",begin:D,relevance:0},de={begin:"\\.\\s*"+D,relevance:0};var je=Object.freeze({__proto__:null,APOS_STRING_MODE:w,BACKSLASH_ESCAPE:_,BINARY_NUMBER_MODE:se,BINARY_NUMBER_RE:N,COMMENT:z,C_BLOCK_COMMENT_MODE:g,C_LINE_COMMENT_MODE:q,C_NUMBER_MODE:k,C_NUMBER_RE:S,END_SAME_AS_BEGIN:function(j){return Object.assign(j,{"on:begin":($,X)=>{X.data._beginMatch=$[1]},"on:end":($,X)=>{X.data._beginMatch!==$[1]&&X.ignoreMatch()}})},HASH_COMMENT_MODE:F,IDENT_RE:B,MATCH_NOTHING_RE:T,METHOD_GUARD:de,NUMBER_MODE:K,NUMBER_RE:C,PHRASAL_WORDS_MODE:H,QUOTE_STRING_MODE:R,REGEXP_MODE:G,RE_STARTERS_RE:O,SHEBANG:M,TITLE_MODE:U,UNDERSCORE_IDENT_RE:D,UNDERSCORE_TITLE_MODE:re});function it(j,$){j.input[j.index-1]==="."&&$.ignoreMatch()}function Ie(j,$){j.className!==void 0&&(j.scope=j.className,delete j.className)}function at(j,$){$&&j.beginKeywords&&(j.begin="\\b("+j.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",j.__beforeBegin=it,j.keywords=j.keywords||j.beginKeywords,delete j.beginKeywords,j.relevance===void 0&&(j.relevance=0))}function Nt(j,$){Array.isArray(j.illegal)&&(j.illegal=y(...j.illegal))}function St(j,$){if(j.match){if(j.begin||j.end)throw new Error("begin & end are not supported with match");j.begin=j.match,delete j.match}}function ke(j,$){j.relevance===void 0&&(j.relevance=1)}const rt=(j,$)=>{if(!j.beforeMatch)return;if(j.starts)throw new Error("beforeMatch cannot be used with starts");const X=Object.assign({},j);Object.keys(j).forEach(ce=>{delete j[ce]}),j.keywords=X.keywords,j.begin=h(X.beforeMatch,m(X.begin)),j.starts={relevance:0,contains:[Object.assign(X,{endsParent:!0})]},j.relevance=0,delete X.beforeMatch},lt=["of","and","for","in","not","or","if","then","parent","list","value"],vt="keyword";function Tt(j,$,X=vt){const ce=Object.create(null);return typeof j=="string"?Me(X,j.split(" ")):Array.isArray(j)?Me(X,j):Object.keys(j).forEach(function(Re){Object.assign(ce,Tt(j[Re],$,Re))}),ce;function Me(Re,ee){$&&(ee=ee.map(Q=>Q.toLowerCase())),ee.forEach(function(Q){const le=Q.split("|");ce[le[0]]=[Re,an(le[0],le[1])]})}}function an(j,$){return $?Number($):Gt(j)?0:1}function Gt(j){return lt.includes(j.toLowerCase())}const J={},pe=j=>{console.error(j)},Fe=(j,...$)=>{console.log(`WARN: ${j}`,...$)},P=(j,$)=>{J[`${j}/${$}`]||(console.log(`Deprecated as of ${j}. ${$}`),J[`${j}/${$}`]=!0)},W=new Error;function te(j,$,{key:X}){let ce=0;const Me=j[X],Re={},ee={};for(let Q=1;Q<=$.length;Q++)ee[Q+ce]=Me[Q],Re[Q+ce]=!0,ce+=b($[Q-1]);j[X]=ee,j[X]._emit=Re,j[X]._multi=!0}function ae(j){if(Array.isArray(j.begin)){if(j.skip||j.excludeBegin||j.returnBegin)throw pe("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),W;if(typeof j.beginScope!="object"||j.beginScope===null)throw pe("beginScope must be object"),W;te(j,j.begin,{key:"beginScope"}),j.begin=L(j.begin,{joinWith:""})}}function fe(j){if(Array.isArray(j.end)){if(j.skip||j.excludeEnd||j.returnEnd)throw pe("skip, excludeEnd, returnEnd not compatible with endScope: {}"),W;if(typeof j.endScope!="object"||j.endScope===null)throw pe("endScope must be object"),W;te(j,j.end,{key:"endScope"}),j.end=L(j.end,{joinWith:""})}}function We(j){j.scope&&typeof j.scope=="object"&&j.scope!==null&&(j.beginScope=j.scope,delete j.scope)}function ct(j){We(j),typeof j.beginScope=="string"&&(j.beginScope={_wrap:j.beginScope}),typeof j.endScope=="string"&&(j.endScope={_wrap:j.endScope}),ae(j),fe(j)}function ut(j){function $(ee,Q){return new RegExp(p(ee),"m"+(j.case_insensitive?"i":"")+(j.unicodeRegex?"u":"")+(Q?"g":""))}class X{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Q,le){le.position=this.position++,this.matchIndexes[this.matchAt]=le,this.regexes.push([le,Q]),this.matchAt+=b(Q)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Q=this.regexes.map(le=>le[1]);this.matcherRe=$(L(Q,{joinWith:"|"}),!0),this.lastIndex=0}exec(Q){this.matcherRe.lastIndex=this.lastIndex;const le=this.matcherRe.exec(Q);if(!le)return null;const Be=le.findIndex((ln,ur)=>ur>0&&ln!==void 0),Oe=this.matchIndexes[Be];return le.splice(0,Be),Object.assign(le,Oe)}}class ce{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Q){if(this.multiRegexes[Q])return this.multiRegexes[Q];const le=new X;return this.rules.slice(Q).forEach(([Be,Oe])=>le.addRule(Be,Oe)),le.compile(),this.multiRegexes[Q]=le,le}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Q,le){this.rules.push([Q,le]),le.type==="begin"&&this.count++}exec(Q){const le=this.getMatcher(this.regexIndex);le.lastIndex=this.lastIndex;let Be=le.exec(Q);if(this.resumingScanAtSamePosition()&&!(Be&&Be.index===this.lastIndex)){const Oe=this.getMatcher(0);Oe.lastIndex=this.lastIndex+1,Be=Oe.exec(Q)}return Be&&(this.regexIndex+=Be.position+1,this.regexIndex===this.count&&this.considerAll()),Be}}function Me(ee){const Q=new ce;return ee.contains.forEach(le=>Q.addRule(le.begin,{rule:le,type:"begin"})),ee.terminatorEnd&&Q.addRule(ee.terminatorEnd,{type:"end"}),ee.illegal&&Q.addRule(ee.illegal,{type:"illegal"}),Q}function Re(ee,Q){const le=ee;if(ee.isCompiled)return le;[Ie,St,ct,rt].forEach(Oe=>Oe(ee,Q)),j.compilerExtensions.forEach(Oe=>Oe(ee,Q)),ee.__beforeBegin=null,[at,Nt,ke].forEach(Oe=>Oe(ee,Q)),ee.isCompiled=!0;let Be=null;return typeof ee.keywords=="object"&&ee.keywords.$pattern&&(ee.keywords=Object.assign({},ee.keywords),Be=ee.keywords.$pattern,delete ee.keywords.$pattern),Be=Be||/\w+/,ee.keywords&&(ee.keywords=Tt(ee.keywords,j.case_insensitive)),le.keywordPatternRe=$(Be,!0),Q&&(ee.begin||(ee.begin=/\B|\b/),le.beginRe=$(le.begin),!ee.end&&!ee.endsWithParent&&(ee.end=/\B|\b/),ee.end&&(le.endRe=$(le.end)),le.terminatorEnd=p(le.end)||"",ee.endsWithParent&&Q.terminatorEnd&&(le.terminatorEnd+=(ee.end?"|":"")+Q.terminatorEnd)),ee.illegal&&(le.illegalRe=$(ee.illegal)),ee.contains||(ee.contains=[]),ee.contains=[].concat(...ee.contains.map(function(Oe){return Bt(Oe==="self"?ee:Oe)})),ee.contains.forEach(function(Oe){Re(Oe,le)}),ee.starts&&Re(ee.starts,Q),le.matcher=Me(le),le}if(j.compilerExtensions||(j.compilerExtensions=[]),j.contains&&j.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return j.classNameAliases=r(j.classNameAliases||{}),Re(j)}function Ct(j){return j?j.endsWithParent||Ct(j.starts):!1}function Bt(j){return j.variants&&!j.cachedVariants&&(j.cachedVariants=j.variants.map(function($){return r(j,{variants:null},$)})),j.cachedVariants?j.cachedVariants:Ct(j)?r(j,{starts:j.starts?r(j.starts):null}):Object.isFrozen(j)?r(j):j}var Ke="11.11.1";class At extends Error{constructor($,X){super($),this.name="HTMLInjectionError",this.html=X}}const Ze=n,Is=r,Os=Symbol("nomatch"),Cl=7,Ls=function(j){const $=Object.create(null),X=Object.create(null),ce=[];let Me=!0;const Re="Could not find the language '{}', did you forget to load/include a language module?",ee={disableAutodetect:!0,name:"Plain text",contains:[]};let Q={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:d};function le(Y){return Q.noHighlightRe.test(Y)}function Be(Y){let oe=Y.className+" ";oe+=Y.parentNode?Y.parentNode.className:"";const ye=Q.languageDetectRe.exec(oe);if(ye){const Se=jt(ye[1]);return Se||(Fe(Re.replace("{}",ye[1])),Fe("Falling back to no-highlight mode for this block.",Y)),Se?ye[1]:"no-highlight"}return oe.split(/\s+/).find(Se=>le(Se)||jt(Se))}function Oe(Y,oe,ye){let Se="",Pe="";typeof oe=="object"?(Se=Y,ye=oe.ignoreIllegals,Pe=oe.language):(P("10.7.0","highlight(lang, code, ...args) has been deprecated."),P("10.7.0",`Please use highlight(code, options) instead.
+https://github.com/highlightjs/highlight.js/issues/2277`),Pe=Y,Se=oe),ye===void 0&&(ye=!0);const dt={code:Se,language:Pe};Tn("before:highlight",dt);const Mt=dt.result?dt.result:ln(dt.language,dt.code,ye);return Mt.code=dt.code,Tn("after:highlight",Mt),Mt}function ln(Y,oe,ye,Se){const Pe=Object.create(null);function dt(Z,ne){return Z.keywords[ne]}function Mt(){if(!ue.keywords){$e.addText(Te);return}let Z=0;ue.keywordPatternRe.lastIndex=0;let ne=ue.keywordPatternRe.exec(Te),he="";for(;ne;){he+=Te.substring(Z,ne.index);const we=mt.case_insensitive?ne[0].toLowerCase():ne[0],ze=dt(ue,we);if(ze){const[kt,Kl]=ze;if($e.addText(he),he="",Pe[we]=(Pe[we]||0)+1,Pe[we]<=Cl&&(jn+=Kl),kt.startsWith("_"))he+=ne[0];else{const Gl=mt.classNameAliases[kt]||kt;ft(ne[0],Gl)}}else he+=ne[0];Z=ue.keywordPatternRe.lastIndex,ne=ue.keywordPatternRe.exec(Te)}he+=Te.substring(Z),$e.addText(he)}function Cn(){if(Te==="")return;let Z=null;if(typeof ue.subLanguage=="string"){if(!$[ue.subLanguage]){$e.addText(Te);return}Z=ln(ue.subLanguage,Te,!0,Hs[ue.subLanguage]),Hs[ue.subLanguage]=Z._top}else Z=dr(Te,ue.subLanguage.length?ue.subLanguage:null);ue.relevance>0&&(jn+=Z.relevance),$e.__addSublanguage(Z._emitter,Z.language)}function Je(){ue.subLanguage!=null?Cn():Mt(),Te=""}function ft(Z,ne){Z!==""&&($e.startScope(ne),$e.addText(Z),$e.endScope())}function Fs(Z,ne){let he=1;const we=ne.length-1;for(;he<=we;){if(!Z._emit[he]){he++;continue}const ze=mt.classNameAliases[Z[he]]||Z[he],kt=ne[he];ze?ft(kt,ze):(Te=kt,Mt(),Te=""),he++}}function $s(Z,ne){return Z.scope&&typeof Z.scope=="string"&&$e.openNode(mt.classNameAliases[Z.scope]||Z.scope),Z.beginScope&&(Z.beginScope._wrap?(ft(Te,mt.classNameAliases[Z.beginScope._wrap]||Z.beginScope._wrap),Te=""):Z.beginScope._multi&&(Fs(Z.beginScope,ne),Te="")),ue=Object.create(Z,{parent:{value:ue}}),ue}function zs(Z,ne,he){let we=A(Z.endRe,he);if(we){if(Z["on:end"]){const ze=new t(Z);Z["on:end"](ne,ze),ze.isMatchIgnored&&(we=!1)}if(we){for(;Z.endsParent&&Z.parent;)Z=Z.parent;return Z}}if(Z.endsWithParent)return zs(Z.parent,ne,he)}function $l(Z){return ue.matcher.regexIndex===0?(Te+=Z[0],1):(hr=!0,0)}function zl(Z){const ne=Z[0],he=Z.rule,we=new t(he),ze=[he.__beforeBegin,he["on:begin"]];for(const kt of ze)if(kt&&(kt(Z,we),we.isMatchIgnored))return $l(ne);return he.skip?Te+=ne:(he.excludeBegin&&(Te+=ne),Je(),!he.returnBegin&&!he.excludeBegin&&(Te=ne)),$s(he,Z),he.returnBegin?0:ne.length}function Ul(Z){const ne=Z[0],he=oe.substring(Z.index),we=zs(ue,Z,he);if(!we)return Os;const ze=ue;ue.endScope&&ue.endScope._wrap?(Je(),ft(ne,ue.endScope._wrap)):ue.endScope&&ue.endScope._multi?(Je(),Fs(ue.endScope,Z)):ze.skip?Te+=ne:(ze.returnEnd||ze.excludeEnd||(Te+=ne),Je(),ze.excludeEnd&&(Te=ne));do ue.scope&&$e.closeNode(),!ue.skip&&!ue.subLanguage&&(jn+=ue.relevance),ue=ue.parent;while(ue!==we.parent);return we.starts&&$s(we.starts,Z),ze.returnEnd?0:ne.length}function Hl(){const Z=[];for(let ne=ue;ne!==mt;ne=ne.parent)ne.scope&&Z.unshift(ne.scope);Z.forEach(ne=>$e.openNode(ne))}let An={};function Us(Z,ne){const he=ne&&ne[0];if(Te+=Z,he==null)return Je(),0;if(An.type==="begin"&&ne.type==="end"&&An.index===ne.index&&he===""){if(Te+=oe.slice(ne.index,ne.index+1),!Me){const we=new Error(`0 width match regex (${Y})`);throw we.languageName=Y,we.badRule=An.rule,we}return 1}if(An=ne,ne.type==="begin")return zl(ne);if(ne.type==="illegal"&&!ye){const we=new Error('Illegal lexeme "'+he+'" for mode "'+(ue.scope||"")+'"');throw we.mode=ue,we}else if(ne.type==="end"){const we=Ul(ne);if(we!==Os)return we}if(ne.type==="illegal"&&he==="")return Te+=`
+`,1;if(mr>1e5&&mr>ne.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Te+=he,he.length}const mt=jt(Y);if(!mt)throw pe(Re.replace("{}",Y)),new Error('Unknown language: "'+Y+'"');const Wl=ut(mt);let fr="",ue=Se||Wl;const Hs={},$e=new Q.__emitter(Q);Hl();let Te="",jn=0,Ft=0,mr=0,hr=!1;try{if(mt.__emitTokens)mt.__emitTokens(oe,$e);else{for(ue.matcher.considerAll();;){mr++,hr?hr=!1:ue.matcher.considerAll(),ue.matcher.lastIndex=Ft;const Z=ue.matcher.exec(oe);if(!Z)break;const ne=oe.substring(Ft,Z.index),he=Us(ne,Z);Ft=Z.index+he}Us(oe.substring(Ft))}return $e.finalize(),fr=$e.toHTML(),{language:Y,value:fr,relevance:jn,illegal:!1,_emitter:$e,_top:ue}}catch(Z){if(Z.message&&Z.message.includes("Illegal"))return{language:Y,value:Ze(oe),illegal:!0,relevance:0,_illegalBy:{message:Z.message,index:Ft,context:oe.slice(Ft-100,Ft+100),mode:Z.mode,resultSoFar:fr},_emitter:$e};if(Me)return{language:Y,value:Ze(oe),illegal:!1,relevance:0,errorRaised:Z,_emitter:$e,_top:ue};throw Z}}function ur(Y){const oe={value:Ze(Y),illegal:!1,relevance:0,_top:ee,_emitter:new Q.__emitter(Q)};return oe._emitter.addText(Y),oe}function dr(Y,oe){oe=oe||Q.languages||Object.keys($);const ye=ur(Y),Se=oe.filter(jt).filter(Bs).map(Je=>ln(Je,Y,!1));Se.unshift(ye);const Pe=Se.sort((Je,ft)=>{if(Je.relevance!==ft.relevance)return ft.relevance-Je.relevance;if(Je.language&&ft.language){if(jt(Je.language).supersetOf===ft.language)return 1;if(jt(ft.language).supersetOf===Je.language)return-1}return 0}),[dt,Mt]=Pe,Cn=dt;return Cn.secondBest=Mt,Cn}function Al(Y,oe,ye){const Se=oe&&X[oe]||ye;Y.classList.add("hljs"),Y.classList.add(`language-${Se}`)}function pr(Y){let oe=null;const ye=Be(Y);if(le(ye))return;if(Tn("before:highlightElement",{el:Y,language:ye}),Y.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",Y);return}if(Y.children.length>0&&(Q.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(Y)),Q.throwUnescapedHTML))throw new At("One of your code blocks includes unescaped HTML.",Y.innerHTML);oe=Y;const Se=oe.textContent,Pe=ye?Oe(Se,{language:ye,ignoreIllegals:!0}):dr(Se);Y.innerHTML=Pe.value,Y.dataset.highlighted="yes",Al(Y,ye,Pe.language),Y.result={language:Pe.language,re:Pe.relevance,relevance:Pe.relevance},Pe.secondBest&&(Y.secondBest={language:Pe.secondBest.language,relevance:Pe.secondBest.relevance}),Tn("after:highlightElement",{el:Y,result:Pe,text:Se})}function jl(Y){Q=Is(Q,Y)}const Ml=()=>{Sn(),P("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Rl(){Sn(),P("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Ds=!1;function Sn(){function Y(){Sn()}if(document.readyState==="loading"){Ds||window.addEventListener("DOMContentLoaded",Y,!1),Ds=!0;return}document.querySelectorAll(Q.cssSelector).forEach(pr)}function Il(Y,oe){let ye=null;try{ye=oe(j)}catch(Se){if(pe("Language definition for '{}' could not be registered.".replace("{}",Y)),Me)pe(Se);else throw Se;ye=ee}ye.name||(ye.name=Y),$[Y]=ye,ye.rawDefinition=oe.bind(null,j),ye.aliases&&Ps(ye.aliases,{languageName:Y})}function Ol(Y){delete $[Y];for(const oe of Object.keys(X))X[oe]===Y&&delete X[oe]}function Ll(){return Object.keys($)}function jt(Y){return Y=(Y||"").toLowerCase(),$[Y]||$[X[Y]]}function Ps(Y,{languageName:oe}){typeof Y=="string"&&(Y=[Y]),Y.forEach(ye=>{X[ye.toLowerCase()]=oe})}function Bs(Y){const oe=jt(Y);return oe&&!oe.disableAutodetect}function Dl(Y){Y["before:highlightBlock"]&&!Y["before:highlightElement"]&&(Y["before:highlightElement"]=oe=>{Y["before:highlightBlock"](Object.assign({block:oe.el},oe))}),Y["after:highlightBlock"]&&!Y["after:highlightElement"]&&(Y["after:highlightElement"]=oe=>{Y["after:highlightBlock"](Object.assign({block:oe.el},oe))})}function Pl(Y){Dl(Y),ce.push(Y)}function Bl(Y){const oe=ce.indexOf(Y);oe!==-1&&ce.splice(oe,1)}function Tn(Y,oe){const ye=Y;ce.forEach(function(Se){Se[ye]&&Se[ye](oe)})}function Fl(Y){return P("10.7.0","highlightBlock will be removed entirely in v12.0"),P("10.7.0","Please use highlightElement now."),pr(Y)}Object.assign(j,{highlight:Oe,highlightAuto:dr,highlightAll:Sn,highlightElement:pr,highlightBlock:Fl,configure:jl,initHighlighting:Ml,initHighlightingOnLoad:Rl,registerLanguage:Il,unregisterLanguage:Ol,listLanguages:Ll,getLanguage:jt,registerAliases:Ps,autoDetection:Bs,inherit:Is,addPlugin:Pl,removePlugin:Bl}),j.debugMode=function(){Me=!1},j.safeMode=function(){Me=!0},j.versionString=Ke,j.regex={concat:h,lookahead:m,either:y,optional:x,anyNumberOfTimes:f};for(const Y in je)typeof je[Y]=="object"&&e(je[Y]);return Object.assign(j,je),j},qt=Ls({});return qt.newInstance=()=>Ls({}),wr=qt,qt.HighlightJS=qt,qt.default=qt,wr}var _d=wd();const fs=is(_d);function ta(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],s={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,s,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}fs.registerLanguage("json",ta);const Vt=100;function Yt(e){return e!==null&&typeof e=="object"}function Nd(e){if(Array.isArray(e))return`Array(${e.length})`;const t=Object.keys(e);return t.length<=3?`{${t.join(", ")}}`:`{${t.slice(0,3).join(", ")}, …} (${t.length} keys)`}function Sd({value:e,onClose:t}){const n=E.useRef(null),r=E.useMemo(()=>JSON.stringify(e,null,2),[e]),s=E.useMemo(()=>fs.highlight(r,{language:"json"}).value,[r]);return E.useEffect(()=>{const a=i=>{i.key==="Escape"&&t()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[t]),Zl.createPortal(o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.5)"},onClick:a=>{a.target===a.currentTarget&&t()},children:o.jsxs("div",{className:"w-full max-w-2xl rounded-lg shadow-xl flex flex-col",style:{background:"var(--bg-primary)",border:"1px solid var(--border)",maxHeight:"80vh"},children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 shrink-0",style:{borderBottom:"1px solid var(--border)"},children:[o.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:Array.isArray(e)?`Array (${e.length} items)`:`Object (${Object.keys(e).length} keys)`}),o.jsx("button",{onClick:t,className:"w-7 h-7 flex items-center justify-center rounded cursor-pointer",style:{color:"var(--text-muted)",background:"transparent",border:"none"},onMouseEnter:a=>{a.currentTarget.style.color="var(--text-primary)"},onMouseLeave:a=>{a.currentTarget.style.color="var(--text-muted)"},children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.jsx("div",{className:"flex-1 overflow-auto chat-markdown",children:o.jsx("pre",{className:"m-0 p-4",style:{background:"transparent"},children:o.jsx("code",{ref:n,className:"hljs language-json text-[13px] leading-relaxed",style:{background:"transparent",whiteSpace:"pre-wrap",wordBreak:"break-all"},dangerouslySetInnerHTML:{__html:s}})})})]})}),document.body)}function Td({value:e}){const[t,n]=E.useState(!1),r=Nd(e);return o.jsxs(o.Fragment,{children:[o.jsxs("button",{onClick:()=>n(!0),className:"text-left text-[12px] cursor-pointer flex items-center gap-1 max-w-[300px]",style:{background:"none",border:"none",padding:0,color:"var(--accent)"},children:[o.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),o.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"})]}),o.jsx("span",{className:"truncate",style:{color:"var(--text-secondary)"},children:r})]}),t&&o.jsx(Sd,{value:e,onClose:()=>n(!1)})]})}function Cd(){const[e,t]=E.useState([]),[n,r]=E.useState(!0),{navigate:s}=Ve();return E.useEffect(()=>{r(!0),Xi().then(t).catch(console.error).finally(()=>r(!1))},[]),o.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[o.jsx("div",{className:"flex items-center gap-3 px-4 h-10 shrink-0 border-b",style:{borderColor:"var(--border)",background:"var(--bg-secondary)"},children:o.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:"State Database Tables"})}),n?o.jsx("div",{className:"flex items-center justify-center flex-1",style:{color:"var(--text-muted)"},children:"Loading tables..."}):e.length===0?o.jsx("div",{className:"flex items-center justify-center flex-1",style:{color:"var(--text-muted)"},children:"No tables found in state.db"}):o.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:o.jsx("div",{className:"grid gap-2",children:e.map(a=>o.jsxs("button",{onClick:()=>s(`#/explorer/statedb/${encodeURIComponent(a.name)}`),className:"flex items-center justify-between px-4 py-3 rounded-lg text-left cursor-pointer transition-colors",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)",color:"var(--text-primary)"},onMouseEnter:i=>{i.currentTarget.style.borderColor="var(--accent)"},onMouseLeave:i=>{i.currentTarget.style.borderColor="var(--border)"},children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--accent)"},children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),o.jsx("line",{x1:"3",y1:"9",x2:"21",y2:"9"}),o.jsx("line",{x1:"3",y1:"15",x2:"21",y2:"15"}),o.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"})]}),o.jsx("span",{className:"text-[13px]",children:a.name})]}),o.jsxs("span",{className:"text-[11px] px-2 py-0.5 rounded-full",style:{background:"var(--bg-hover)",color:"var(--text-muted)"},children:[a.row_count," rows"]})]},a.name))})})]})}function Ad({table:e}){return e?o.jsx(jd,{table:e}):o.jsx(Cd,{})}function jd({table:e}){const{navigate:t}=Ve(),[n,r]=E.useState([]),[s,a]=E.useState([]),[i,l]=E.useState(0),[c,u]=E.useState(0),[d,p]=E.useState(!0),[m,f]=E.useState(null),[x,h]=E.useState(""),[v,y]=E.useState(!1),b=E.useCallback(C=>{p(!0),f(null),y(!1),od(e,Vt,C).then(S=>{r(S.columns),a(S.rows),l(S.total),u(C)}).catch(S=>f(S.detail||S.message)).finally(()=>p(!1))},[e]);E.useEffect(()=>{b(0),h("")},[e,b]);const A=E.useCallback(()=>{x.trim()&&(p(!0),f(null),y(!0),id(x).then(C=>{r(C.columns),a(C.rows),l(C.row_count),u(0)}).catch(C=>f(C.detail||C.message)).finally(()=>p(!1)))},[x]),I=C=>{C.key==="Enter"&&(C.ctrlKey||C.metaKey)&&(C.preventDefault(),A())},L=!v&&c>0,T=!v&&c+Vtt("#/explorer/statedb"),className:"flex items-center gap-1 text-[12px] cursor-pointer transition-colors",style:{background:"none",border:"none",color:"var(--text-muted)"},onMouseEnter:C=>{C.currentTarget.style.color="var(--text-primary)"},onMouseLeave:C=>{C.currentTarget.style.color="var(--text-muted)"},children:[o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Tables"]}),o.jsx("span",{style:{color:"var(--border)"},children:"|"}),o.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:e}),o.jsxs("span",{className:"text-[11px] px-2 py-0.5 rounded-full",style:{background:"var(--bg-hover)",color:"var(--text-muted)"},children:[i," rows"]})]}),o.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0 border-b",style:{borderColor:"var(--border)"},children:[o.jsx("input",{type:"text",value:x,onChange:C=>h(C.target.value),onKeyDown:I,placeholder:`SELECT * FROM [${e}] WHERE ...`,className:"flex-1 text-[13px] px-3 py-1.5 rounded",style:{background:"var(--bg-primary)",border:"1px solid var(--border)",color:"var(--text-primary)",outline:"none"}}),o.jsx("button",{onClick:A,disabled:!x.trim(),className:"text-[12px] px-3 py-1.5 rounded cursor-pointer shrink-0",style:{background:x.trim()?"var(--accent)":"var(--bg-hover)",color:x.trim()?"#fff":"var(--text-muted)",border:"none"},children:"Run"}),v&&o.jsx("button",{onClick:()=>b(0),className:"text-[12px] px-3 py-1.5 rounded cursor-pointer shrink-0",style:{background:"var(--bg-hover)",color:"var(--text-secondary)",border:"none"},children:"Reset"})]}),m&&o.jsx("div",{className:"px-4 py-2 text-[12px] shrink-0",style:{background:"rgba(239,68,68,0.1)",color:"#ef4444"},children:m}),o.jsx("div",{className:"flex-1 overflow-auto",children:d?o.jsx("div",{className:"flex items-center justify-center h-32",style:{color:"var(--text-muted)"},children:"Loading..."}):s.length===0?o.jsx("div",{className:"flex items-center justify-center h-32",style:{color:"var(--text-muted)"},children:"No rows"}):o.jsxs("table",{className:"w-full text-[12px]",style:{borderCollapse:"collapse"},children:[o.jsx("thead",{children:o.jsx("tr",{children:n.map(C=>o.jsxs("th",{className:"text-left px-3 py-2 whitespace-nowrap sticky top-0",style:{background:"var(--bg-secondary)",borderBottom:"1px solid var(--border)",color:"var(--text-primary)",fontWeight:600},children:[C.name,o.jsx("span",{className:"ml-1 font-normal",style:{color:"var(--text-muted)",fontSize:"10px"},children:C.type})]},C.name))})}),o.jsx("tbody",{children:s.map((C,S)=>o.jsx("tr",{style:{borderBottom:"1px solid var(--border)"},onMouseEnter:N=>{N.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:N=>{N.currentTarget.style.background="transparent"},children:C.map((N,O)=>o.jsx("td",{className:"px-3 py-1.5",style:{color:N==null?"var(--text-muted)":"var(--text-secondary)",maxWidth:Yt(N)?void 0:"300px",overflow:Yt(N)?void 0:"hidden",textOverflow:Yt(N)?void 0:"ellipsis",whiteSpace:Yt(N)?void 0:"nowrap",verticalAlign:"top"},title:N!=null&&!Yt(N)?String(N):void 0,children:N==null?o.jsx("span",{style:{fontStyle:"italic"},children:"NULL"}):Yt(N)?o.jsx(Td,{value:N}):String(N)},O))},S))})]})}),(L||T)&&!d&&o.jsxs("div",{className:"flex items-center justify-center gap-3 py-2 shrink-0 border-t",style:{borderColor:"var(--border)"},children:[o.jsx("button",{onClick:()=>b(c-Vt),disabled:!L,className:"text-[12px] px-3 py-1 rounded cursor-pointer",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)",color:L?"var(--text-secondary)":"var(--text-muted)",opacity:L?1:.5},children:"Previous"}),o.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-muted)"},children:["Page ",B," of ",D]}),o.jsx("button",{onClick:()=>b(c+Vt),disabled:!T,className:"text-[12px] px-3 py-1 rounded cursor-pointer",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)",color:T?"var(--text-secondary)":"var(--text-muted)",opacity:T?1:.5},children:"Next"})]})]})}function Md(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Rd=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Id=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Od={};function Ro(e,t){return(Od.jsx?Id:Rd).test(e)}const Ld=/[ \t\n\f\r]/g;function Dd(e){return typeof e=="object"?e.type==="text"?Io(e.value):!1:Io(e)}function Io(e){return e.replace(Ld,"")===""}class En{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}En.prototype.normal={};En.prototype.property={};En.prototype.space=void 0;function na(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new En(n,r,t)}function Vr(e){return e.toLowerCase()}class Xe{constructor(t,n){this.attribute=n,this.property=t}}Xe.prototype.attribute="";Xe.prototype.booleanish=!1;Xe.prototype.boolean=!1;Xe.prototype.commaOrSpaceSeparated=!1;Xe.prototype.commaSeparated=!1;Xe.prototype.defined=!1;Xe.prototype.mustUseProperty=!1;Xe.prototype.number=!1;Xe.prototype.overloadedBoolean=!1;Xe.prototype.property="";Xe.prototype.spaceSeparated=!1;Xe.prototype.space=void 0;let Pd=0;const me=Wt(),Le=Wt(),Yr=Wt(),V=Wt(),Ce=Wt(),nn=Wt(),Qe=Wt();function Wt(){return 2**++Pd}const Xr=Object.freeze(Object.defineProperty({__proto__:null,boolean:me,booleanish:Le,commaOrSpaceSeparated:Qe,commaSeparated:nn,number:V,overloadedBoolean:Yr,spaceSeparated:Ce},Symbol.toStringTag,{value:"Module"})),_r=Object.keys(Xr);class ms extends Xe{constructor(t,n,r,s){let a=-1;if(super(t,n),Oo(this,"space",s),typeof r=="number")for(;++a<_r.length;){const i=_r[a];Oo(this,_r[a],(r&Xr[i])===Xr[i])}}}ms.prototype.defined=!0;function Oo(e,t,n){n&&(e[t]=n)}function sn(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const a=new ms(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Vr(r)]=r,n[Vr(a.attribute)]=r}return new En(t,n,e.space)}const ra=sn({properties:{ariaActiveDescendant:null,ariaAtomic:Le,ariaAutoComplete:null,ariaBusy:Le,ariaChecked:Le,ariaColCount:V,ariaColIndex:V,ariaColSpan:V,ariaControls:Ce,ariaCurrent:null,ariaDescribedBy:Ce,ariaDetails:null,ariaDisabled:Le,ariaDropEffect:Ce,ariaErrorMessage:null,ariaExpanded:Le,ariaFlowTo:Ce,ariaGrabbed:Le,ariaHasPopup:null,ariaHidden:Le,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ce,ariaLevel:V,ariaLive:null,ariaModal:Le,ariaMultiLine:Le,ariaMultiSelectable:Le,ariaOrientation:null,ariaOwns:Ce,ariaPlaceholder:null,ariaPosInSet:V,ariaPressed:Le,ariaReadOnly:Le,ariaRelevant:null,ariaRequired:Le,ariaRoleDescription:Ce,ariaRowCount:V,ariaRowIndex:V,ariaRowSpan:V,ariaSelected:Le,ariaSetSize:V,ariaSort:null,ariaValueMax:V,ariaValueMin:V,ariaValueNow:V,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function sa(e,t){return t in e?e[t]:t}function oa(e,t){return sa(e,t.toLowerCase())}const Bd=sn({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:nn,acceptCharset:Ce,accessKey:Ce,action:null,allow:null,allowFullScreen:me,allowPaymentRequest:me,allowUserMedia:me,alt:null,as:null,async:me,autoCapitalize:null,autoComplete:Ce,autoFocus:me,autoPlay:me,blocking:Ce,capture:null,charSet:null,checked:me,cite:null,className:Ce,cols:V,colSpan:null,content:null,contentEditable:Le,controls:me,controlsList:Ce,coords:V|nn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:me,defer:me,dir:null,dirName:null,disabled:me,download:Yr,draggable:Le,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:me,formTarget:null,headers:Ce,height:V,hidden:Yr,high:V,href:null,hrefLang:null,htmlFor:Ce,httpEquiv:Ce,id:null,imageSizes:null,imageSrcSet:null,inert:me,inputMode:null,integrity:null,is:null,isMap:me,itemId:null,itemProp:Ce,itemRef:Ce,itemScope:me,itemType:Ce,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:me,low:V,manifest:null,max:null,maxLength:V,media:null,method:null,min:null,minLength:V,multiple:me,muted:me,name:null,nonce:null,noModule:me,noValidate:me,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:me,optimum:V,pattern:null,ping:Ce,placeholder:null,playsInline:me,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:me,referrerPolicy:null,rel:Ce,required:me,reversed:me,rows:V,rowSpan:V,sandbox:Ce,scope:null,scoped:me,seamless:me,selected:me,shadowRootClonable:me,shadowRootDelegatesFocus:me,shadowRootMode:null,shape:null,size:V,sizes:null,slot:null,span:V,spellCheck:Le,src:null,srcDoc:null,srcLang:null,srcSet:null,start:V,step:null,style:null,tabIndex:V,target:null,title:null,translate:null,type:null,typeMustMatch:me,useMap:null,value:Le,width:V,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ce,axis:null,background:null,bgColor:null,border:V,borderColor:null,bottomMargin:V,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:me,declare:me,event:null,face:null,frame:null,frameBorder:null,hSpace:V,leftMargin:V,link:null,longDesc:null,lowSrc:null,marginHeight:V,marginWidth:V,noResize:me,noHref:me,noShade:me,noWrap:me,object:null,profile:null,prompt:null,rev:null,rightMargin:V,rules:null,scheme:null,scrolling:Le,standby:null,summary:null,text:null,topMargin:V,valueType:null,version:null,vAlign:null,vLink:null,vSpace:V,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:me,disableRemotePlayback:me,prefix:null,property:null,results:V,security:null,unselectable:null},space:"html",transform:oa}),Fd=sn({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Qe,accentHeight:V,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:V,amplitude:V,arabicForm:null,ascent:V,attributeName:null,attributeType:null,azimuth:V,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:V,by:null,calcMode:null,capHeight:V,className:Ce,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:V,diffuseConstant:V,direction:null,display:null,dur:null,divisor:V,dominantBaseline:null,download:me,dx:null,dy:null,edgeMode:null,editable:null,elevation:V,enableBackground:null,end:null,event:null,exponent:V,externalResourcesRequired:null,fill:null,fillOpacity:V,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:nn,g2:nn,glyphName:nn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:V,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:V,horizOriginX:V,horizOriginY:V,id:null,ideographic:V,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:V,k:V,k1:V,k2:V,k3:V,k4:V,kernelMatrix:Qe,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:V,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:V,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:V,overlineThickness:V,paintOrder:null,panose1:null,path:null,pathLength:V,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ce,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:V,pointsAtY:V,pointsAtZ:V,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Qe,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Qe,rev:Qe,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Qe,requiredFeatures:Qe,requiredFonts:Qe,requiredFormats:Qe,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:V,specularExponent:V,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:V,strikethroughThickness:V,string:null,stroke:null,strokeDashArray:Qe,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:V,strokeOpacity:V,strokeWidth:null,style:null,surfaceScale:V,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Qe,tabIndex:V,tableValues:null,target:null,targetX:V,targetY:V,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Qe,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:V,underlineThickness:V,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:V,values:null,vAlphabetic:V,vMathematical:V,vectorEffect:null,vHanging:V,vIdeographic:V,version:null,vertAdvY:V,vertOriginX:V,vertOriginY:V,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:V,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:sa}),ia=sn({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),aa=sn({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:oa}),la=sn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),$d={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},zd=/[A-Z]/g,Lo=/-[a-z]/g,Ud=/^data[-\w.:]+$/i;function Hd(e,t){const n=Vr(t);let r=t,s=Xe;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Ud.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(Lo,Kd);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!Lo.test(a)){let i=a.replace(zd,Wd);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}s=ms}return new s(r,t)}function Wd(e){return"-"+e.toLowerCase()}function Kd(e){return e.charAt(1).toUpperCase()}const Gd=na([ra,Bd,ia,aa,la],"html"),hs=na([ra,Fd,ia,aa,la],"svg");function qd(e){return e.join(" ").trim()}var Xt={},Nr,Do;function Vd(){if(Do)return Nr;Do=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,i=/^[;\s]*/,l=/^\s+|\s+$/g,c=`
+`,u="/",d="*",p="",m="comment",f="declaration";function x(v,y){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];y=y||{};var b=1,A=1;function I(_){var w=_.match(t);w&&(b+=w.length);var R=_.lastIndexOf(c);A=~R?_.length-R:A+_.length}function L(){var _={line:b,column:A};return function(w){return w.position=new T(_),C(),w}}function T(_){this.start=_,this.end={line:b,column:A},this.source=y.source}T.prototype.content=v;function B(_){var w=new Error(y.source+":"+b+":"+A+": "+_);if(w.reason=_,w.filename=y.source,w.line=b,w.column=A,w.source=v,!y.silent)throw w}function D(_){var w=_.exec(v);if(w){var R=w[0];return I(R),v=v.slice(R.length),w}}function C(){D(n)}function S(_){var w;for(_=_||[];w=N();)w!==!1&&_.push(w);return _}function N(){var _=L();if(!(u!=v.charAt(0)||d!=v.charAt(1))){for(var w=2;p!=v.charAt(w)&&(d!=v.charAt(w)||u!=v.charAt(w+1));)++w;if(w+=2,p===v.charAt(w-1))return B("End of comment missing");var R=v.slice(2,w-2);return A+=2,I(R),v=v.slice(w),A+=2,_({type:m,comment:R})}}function O(){var _=L(),w=D(r);if(w){if(N(),!D(s))return B("property missing ':'");var R=D(a),H=_({type:f,property:h(w[0].replace(e,p)),value:R?h(R[0].replace(e,p)):p});return D(i),H}}function M(){var _=[];S(_);for(var w;w=O();)w!==!1&&(_.push(w),S(_));return _}return C(),M()}function h(v){return v?v.replace(l,p):p}return Nr=x,Nr}var Po;function Yd(){if(Po)return Xt;Po=1;var e=Xt&&Xt.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.default=n;const t=e(Vd());function n(r,s){let a=null;if(!r||typeof r!="string")return a;const i=(0,t.default)(r),l=typeof s=="function";return i.forEach(c=>{if(c.type!=="declaration")return;const{property:u,value:d}=c;l?s(u,d,c):d&&(a=a||{},a[u]=d)}),a}return Xt}var cn={},Bo;function Xd(){if(Bo)return cn;Bo=1,Object.defineProperty(cn,"__esModule",{value:!0}),cn.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,a=function(u){return!u||n.test(u)||e.test(u)},i=function(u,d){return d.toUpperCase()},l=function(u,d){return"".concat(d,"-")},c=function(u,d){return d===void 0&&(d={}),a(u)?u:(u=u.toLowerCase(),d.reactCompat?u=u.replace(s,l):u=u.replace(r,l),u.replace(t,i))};return cn.camelCase=c,cn}var un,Fo;function Zd(){if(Fo)return un;Fo=1;var e=un&&un.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(Yd()),n=Xd();function r(s,a){var i={};return!s||typeof s!="string"||(0,t.default)(s,function(l,c){l&&c&&(i[(0,n.camelCase)(l,a)]=c)}),i}return r.default=r,un=r,un}var Jd=Zd();const Qd=is(Jd),ca=ua("end"),gs=ua("start");function ua(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 ep(e){const t=gs(e),n=ca(e);if(t&&n)return{start:t,end:n}}function gn(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?$o(e.position):"start"in e||"end"in e?$o(e):"line"in e||"column"in e?Zr(e):""}function Zr(e){return zo(e&&e.line)+":"+zo(e&&e.column)}function $o(e){return Zr(e&&e.start)+"-"+Zr(e&&e.end)}function zo(e){return e&&typeof e=="number"?e:1}class He extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",a={},i=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?s=t:!a.cause&&t&&(i=!0,s=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?a.ruleId=r:(a.source=r.slice(0,c),a.ruleId=r.slice(c+1))}if(!a.place&&a.ancestors&&a.ancestors){const c=a.ancestors[a.ancestors.length-1];c&&(a.place=c.position)}const l=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=gn(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=i&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}He.prototype.file="";He.prototype.name="";He.prototype.reason="";He.prototype.message="";He.prototype.stack="";He.prototype.column=void 0;He.prototype.line=void 0;He.prototype.ancestors=void 0;He.prototype.cause=void 0;He.prototype.fatal=void 0;He.prototype.place=void 0;He.prototype.ruleId=void 0;He.prototype.source=void 0;const xs={}.hasOwnProperty,tp=new Map,np=/[A-Z]/g,rp=new Set(["table","tbody","thead","tfoot","tr"]),sp=new Set(["td","th"]),da="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function op(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=fp(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=pp(n,t.jsx,t.jsxs)}const s={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"?hs:Gd,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=pa(s,e,void 0);return a&&typeof a!="string"?a:s.create(e,s.Fragment,{children:a||void 0},void 0)}function pa(e,t,n){if(t.type==="element")return ip(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return ap(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return cp(e,t,n);if(t.type==="mdxjsEsm")return lp(e,t);if(t.type==="root")return up(e,t,n);if(t.type==="text")return dp(e,t)}function ip(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=hs,e.schema=s),e.ancestors.push(t);const a=ma(e,t.tagName,!1),i=mp(e,t);let l=ys(e,t);return rp.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!Dd(c):!0})),fa(e,i,a,t),bs(i,l),e.ancestors.pop(),e.schema=r,e.create(t,a,i,n)}function ap(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)}yn(e,t.position)}function lp(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);yn(e,t.position)}function cp(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=hs,e.schema=s),e.ancestors.push(t);const a=t.name===null?e.Fragment:ma(e,t.name,!0),i=hp(e,t),l=ys(e,t);return fa(e,i,a,t),bs(i,l),e.ancestors.pop(),e.schema=r,e.create(t,a,i,n)}function up(e,t,n){const r={};return bs(r,ys(e,t)),e.create(t,e.Fragment,r,n)}function dp(e,t){return t.value}function fa(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function bs(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function pp(e,t,n){return r;function r(s,a,i,l){const u=Array.isArray(i.children)?n:t;return l?u(a,i,l):u(a,i)}}function fp(e,t){return n;function n(r,s,a,i){const l=Array.isArray(a.children),c=gs(r);return t(s,a,i,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function mp(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&xs.call(t.properties,s)){const a=gp(e,s,t.properties[s]);if(a){const[i,l]=a;e.tableCellAlignToStyle&&i==="align"&&typeof l=="string"&&sp.has(t.tagName)?r=l:n[i]=l}}if(r){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function hp(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const a=r.data.estree.body[0];a.type;const i=a.expression;i.type;const l=i.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else yn(e,t.position);else{const s=r.name;let a;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,a=e.evaluater.evaluateExpression(l.expression)}else yn(e,t.position);else a=r.value===null?!0:r.value;n[s]=a}return n}function ys(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:tp;for(;++rs?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)i=Array.from(r),i.unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);a0?(et(e,e.length,0,t),e):t}const Wo={}.hasOwnProperty;function ga(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 pt(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const qe=Pt(/[A-Za-z]/),Ue=Pt(/[\dA-Za-z]/),Np=Pt(/[#-'*+\--9=?A-Z^-~]/);function Yn(e){return e!==null&&(e<32||e===127)}const Jr=Pt(/\d/),Sp=Pt(/[\dA-Fa-f]/),Tp=Pt(/[!-/:-@[-`{-~]/);function ie(e){return e!==null&&e<-2}function Ne(e){return e!==null&&(e<0||e===32)}function xe(e){return e===-2||e===-1||e===32}const or=Pt(new RegExp("\\p{P}|\\p{S}","u")),Ht=Pt(/\s/);function Pt(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function on(e){const t=[];let n=-1,r=0,s=0;for(;++n55295&&a<57344){const l=e.charCodeAt(n+1);a<56320&&l>56319&&l<57344?(i=String.fromCharCode(a,l),s=1):i="�"}else i=String.fromCharCode(a);i&&(t.push(e.slice(r,n),encodeURIComponent(i)),r=n+s+1,i=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function Ee(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let a=0;return i;function i(c){return xe(c)?(e.enter(n),l(c)):t(c)}function l(c){return xe(c)&&a++i))return;const B=t.events.length;let D=B,C,S;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){if(C){S=t.events[D][1].end;break}C=!0}for(y(r),T=B;TA;){const L=n[I];t.containerState=L[1],L[0].exit.call(t,e)}n.length=A}function b(){s.write([null]),a=void 0,s=void 0,t.containerState._closeFlow=void 0}}function Rp(e,t,n){return Ee(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function rn(e){if(e===null||Ne(e)||Ht(e))return 1;if(or(e))return 2}function ir(e,t,n){const r=[];let s=-1;for(;++s1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p={...e[r][1].end},m={...e[n][1].start};Go(p,-c),Go(m,c),i={type:c>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:m},a={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...i.start},end:{...l.end}},e[r][1].end={...i.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=st(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=st(u,[["enter",s,t],["enter",i,t],["exit",i,t],["enter",a,t]]),u=st(u,ir(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=st(u,[["exit",a,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=st(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,et(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n0&&xe(T)?Ee(e,b,"linePrefix",a+1)(T):b(T)}function b(T){return T===null||ie(T)?e.check(qo,h,I)(T):(e.enter("codeFlowValue"),A(T))}function A(T){return T===null||ie(T)?(e.exit("codeFlowValue"),b(T)):(e.consume(T),A)}function I(T){return e.exit("codeFenced"),t(T)}function L(T,B,D){let C=0;return S;function S(w){return T.enter("lineEnding"),T.consume(w),T.exit("lineEnding"),N}function N(w){return T.enter("codeFencedFence"),xe(w)?Ee(T,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):O(w)}function O(w){return w===l?(T.enter("codeFencedFenceSequence"),M(w)):D(w)}function M(w){return w===l?(C++,T.consume(w),M):C>=i?(T.exit("codeFencedFenceSequence"),xe(w)?Ee(T,_,"whitespace")(w):_(w)):D(w)}function _(w){return w===null||ie(w)?(T.exit("codeFencedFence"),B(w)):D(w)}}}function Wp(e,t,n){const r=this;return s;function s(i){return i===null?n(i):(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),a)}function a(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}const Tr={name:"codeIndented",tokenize:Gp},Kp={partial:!0,tokenize:qp};function Gp(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),Ee(e,a,"linePrefix",5)(u)}function a(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?i(u):n(u)}function i(u){return u===null?c(u):ie(u)?e.attempt(Kp,i,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||ie(u)?(e.exit("codeFlowValue"),i(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function qp(e,t,n){const r=this;return s;function s(i){return r.parser.lazy[r.now().line]?n(i):ie(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s):Ee(e,a,"linePrefix",5)(i)}function a(i){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(i):ie(i)?s(i):n(i)}}const Vp={name:"codeText",previous:Xp,resolve:Yp,tokenize:Zp};function Yp(e){let t=e.length-4,n=3,r,s;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 s=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&dn(this.left,r),a.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),dn(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),dn(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(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Ea(e,t,n,r,s,a,i,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return p;function p(y){return y===60?(e.enter(r),e.enter(s),e.enter(a),e.consume(y),e.exit(a),m):y===null||y===32||y===41||Yn(y)?n(y):(e.enter(r),e.enter(i),e.enter(l),e.enter("chunkString",{contentType:"string"}),h(y))}function m(y){return y===62?(e.enter(a),e.consume(y),e.exit(a),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),f(y))}function f(y){return y===62?(e.exit("chunkString"),e.exit(l),m(y)):y===null||y===60||ie(y)?n(y):(e.consume(y),y===92?x:f)}function x(y){return y===60||y===62||y===92?(e.consume(y),f):f(y)}function h(y){return!d&&(y===null||y===41||Ne(y))?(e.exit("chunkString"),e.exit(l),e.exit(i),e.exit(r),t(y)):d999||f===null||f===91||f===93&&!c||f===94&&!l&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):f===93?(e.exit(a),e.enter(s),e.consume(f),e.exit(s),e.exit(r),t):ie(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),p(f))}function p(f){return f===null||f===91||f===93||ie(f)||l++>999?(e.exit("chunkString"),d(f)):(e.consume(f),c||(c=!xe(f)),f===92?m:p)}function m(f){return f===91||f===92||f===93?(e.consume(f),l++,p):p(f)}}function _a(e,t,n,r,s,a){let i;return l;function l(m){return m===34||m===39||m===40?(e.enter(r),e.enter(s),e.consume(m),e.exit(s),i=m===40?41:m,c):n(m)}function c(m){return m===i?(e.enter(s),e.consume(m),e.exit(s),e.exit(r),t):(e.enter(a),u(m))}function u(m){return m===i?(e.exit(a),c(i)):m===null?n(m):ie(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Ee(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===i||m===null||ie(m)?(e.exit("chunkString"),u(m)):(e.consume(m),m===92?p:d)}function p(m){return m===i||m===92?(e.consume(m),d):d(m)}}function xn(e,t){let n;return r;function r(s){return ie(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):xe(s)?Ee(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const of={name:"definition",tokenize:lf},af={partial:!0,tokenize:cf};function lf(e,t,n){const r=this;let s;return a;function a(f){return e.enter("definition"),i(f)}function i(f){return wa.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function l(f){return s=pt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),c):n(f)}function c(f){return Ne(f)?xn(e,u)(f):u(f)}function u(f){return Ea(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function d(f){return e.attempt(af,p,p)(f)}function p(f){return xe(f)?Ee(e,m,"whitespace")(f):m(f)}function m(f){return f===null||ie(f)?(e.exit("definition"),r.parser.defined.push(s),t(f)):n(f)}}function cf(e,t,n){return r;function r(l){return Ne(l)?xn(e,s)(l):n(l)}function s(l){return _a(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function a(l){return xe(l)?Ee(e,i,"whitespace")(l):i(l)}function i(l){return l===null||ie(l)?t(l):n(l)}}const uf={name:"hardBreakEscape",tokenize:df};function df(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),s}function s(a){return ie(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const pf={name:"headingAtx",resolve:ff,tokenize:mf};function ff(e,t){let n=e.length-2,r=3,s,a;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&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},et(e,r,n-r+1,[["enter",s,t],["enter",a,t],["exit",a,t],["exit",s,t]])),e}function mf(e,t,n){let r=0;return s;function s(d){return e.enter("atxHeading"),a(d)}function a(d){return e.enter("atxHeadingSequence"),i(d)}function i(d){return d===35&&r++<6?(e.consume(d),i):d===null||Ne(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||ie(d)?(e.exit("atxHeading"),t(d)):xe(d)?Ee(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||Ne(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const hf=["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"],Yo=["pre","script","style","textarea"],gf={concrete:!0,name:"htmlFlow",resolveTo:yf,tokenize:vf},xf={partial:!0,tokenize:Ef},bf={partial:!0,tokenize:kf};function yf(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 vf(e,t,n){const r=this;let s,a,i,l,c;return u;function u(k){return d(k)}function d(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),p}function p(k){return k===33?(e.consume(k),m):k===47?(e.consume(k),a=!0,h):k===63?(e.consume(k),s=3,r.interrupt?t:g):qe(k)?(e.consume(k),i=String.fromCharCode(k),v):n(k)}function m(k){return k===45?(e.consume(k),s=2,f):k===91?(e.consume(k),s=5,l=0,x):qe(k)?(e.consume(k),s=4,r.interrupt?t:g):n(k)}function f(k){return k===45?(e.consume(k),r.interrupt?t:g):n(k)}function x(k){const se="CDATA[";return k===se.charCodeAt(l++)?(e.consume(k),l===se.length?r.interrupt?t:O:x):n(k)}function h(k){return qe(k)?(e.consume(k),i=String.fromCharCode(k),v):n(k)}function v(k){if(k===null||k===47||k===62||Ne(k)){const se=k===47,G=i.toLowerCase();return!se&&!a&&Yo.includes(G)?(s=1,r.interrupt?t(k):O(k)):hf.includes(i.toLowerCase())?(s=6,se?(e.consume(k),y):r.interrupt?t(k):O(k)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(k):a?b(k):A(k))}return k===45||Ue(k)?(e.consume(k),i+=String.fromCharCode(k),v):n(k)}function y(k){return k===62?(e.consume(k),r.interrupt?t:O):n(k)}function b(k){return xe(k)?(e.consume(k),b):S(k)}function A(k){return k===47?(e.consume(k),S):k===58||k===95||qe(k)?(e.consume(k),I):xe(k)?(e.consume(k),A):S(k)}function I(k){return k===45||k===46||k===58||k===95||Ue(k)?(e.consume(k),I):L(k)}function L(k){return k===61?(e.consume(k),T):xe(k)?(e.consume(k),L):A(k)}function T(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),c=k,B):xe(k)?(e.consume(k),T):D(k)}function B(k){return k===c?(e.consume(k),c=null,C):k===null||ie(k)?n(k):(e.consume(k),B)}function D(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||Ne(k)?L(k):(e.consume(k),D)}function C(k){return k===47||k===62||xe(k)?A(k):n(k)}function S(k){return k===62?(e.consume(k),N):n(k)}function N(k){return k===null||ie(k)?O(k):xe(k)?(e.consume(k),N):n(k)}function O(k){return k===45&&s===2?(e.consume(k),R):k===60&&s===1?(e.consume(k),H):k===62&&s===4?(e.consume(k),F):k===63&&s===3?(e.consume(k),g):k===93&&s===5?(e.consume(k),q):ie(k)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(xf,K,M)(k)):k===null||ie(k)?(e.exit("htmlFlowData"),M(k)):(e.consume(k),O)}function M(k){return e.check(bf,_,K)(k)}function _(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),w}function w(k){return k===null||ie(k)?M(k):(e.enter("htmlFlowData"),O(k))}function R(k){return k===45?(e.consume(k),g):O(k)}function H(k){return k===47?(e.consume(k),i="",z):O(k)}function z(k){if(k===62){const se=i.toLowerCase();return Yo.includes(se)?(e.consume(k),F):O(k)}return qe(k)&&i.length<8?(e.consume(k),i+=String.fromCharCode(k),z):O(k)}function q(k){return k===93?(e.consume(k),g):O(k)}function g(k){return k===62?(e.consume(k),F):k===45&&s===2?(e.consume(k),g):O(k)}function F(k){return k===null||ie(k)?(e.exit("htmlFlowData"),K(k)):(e.consume(k),F)}function K(k){return e.exit("htmlFlow"),t(k)}}function kf(e,t,n){const r=this;return s;function s(i){return ie(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),a):n(i)}function a(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}function Ef(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(wn,t,n)}}const wf={name:"htmlText",tokenize:_f};function _f(e,t,n){const r=this;let s,a,i;return l;function l(g){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(g),c}function c(g){return g===33?(e.consume(g),u):g===47?(e.consume(g),L):g===63?(e.consume(g),A):qe(g)?(e.consume(g),D):n(g)}function u(g){return g===45?(e.consume(g),d):g===91?(e.consume(g),a=0,x):qe(g)?(e.consume(g),b):n(g)}function d(g){return g===45?(e.consume(g),f):n(g)}function p(g){return g===null?n(g):g===45?(e.consume(g),m):ie(g)?(i=p,H(g)):(e.consume(g),p)}function m(g){return g===45?(e.consume(g),f):p(g)}function f(g){return g===62?R(g):g===45?m(g):p(g)}function x(g){const F="CDATA[";return g===F.charCodeAt(a++)?(e.consume(g),a===F.length?h:x):n(g)}function h(g){return g===null?n(g):g===93?(e.consume(g),v):ie(g)?(i=h,H(g)):(e.consume(g),h)}function v(g){return g===93?(e.consume(g),y):h(g)}function y(g){return g===62?R(g):g===93?(e.consume(g),y):h(g)}function b(g){return g===null||g===62?R(g):ie(g)?(i=b,H(g)):(e.consume(g),b)}function A(g){return g===null?n(g):g===63?(e.consume(g),I):ie(g)?(i=A,H(g)):(e.consume(g),A)}function I(g){return g===62?R(g):A(g)}function L(g){return qe(g)?(e.consume(g),T):n(g)}function T(g){return g===45||Ue(g)?(e.consume(g),T):B(g)}function B(g){return ie(g)?(i=B,H(g)):xe(g)?(e.consume(g),B):R(g)}function D(g){return g===45||Ue(g)?(e.consume(g),D):g===47||g===62||Ne(g)?C(g):n(g)}function C(g){return g===47?(e.consume(g),R):g===58||g===95||qe(g)?(e.consume(g),S):ie(g)?(i=C,H(g)):xe(g)?(e.consume(g),C):R(g)}function S(g){return g===45||g===46||g===58||g===95||Ue(g)?(e.consume(g),S):N(g)}function N(g){return g===61?(e.consume(g),O):ie(g)?(i=N,H(g)):xe(g)?(e.consume(g),N):C(g)}function O(g){return g===null||g===60||g===61||g===62||g===96?n(g):g===34||g===39?(e.consume(g),s=g,M):ie(g)?(i=O,H(g)):xe(g)?(e.consume(g),O):(e.consume(g),_)}function M(g){return g===s?(e.consume(g),s=void 0,w):g===null?n(g):ie(g)?(i=M,H(g)):(e.consume(g),M)}function _(g){return g===null||g===34||g===39||g===60||g===61||g===96?n(g):g===47||g===62||Ne(g)?C(g):(e.consume(g),_)}function w(g){return g===47||g===62||Ne(g)?C(g):n(g)}function R(g){return g===62?(e.consume(g),e.exit("htmlTextData"),e.exit("htmlText"),t):n(g)}function H(g){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),z}function z(g){return xe(g)?Ee(e,q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(g):q(g)}function q(g){return e.enter("htmlTextData"),i(g)}}const Es={name:"labelEnd",resolveAll:Cf,resolveTo:Af,tokenize:jf},Nf={tokenize:Mf},Sf={tokenize:Rf},Tf={tokenize:If};function Cf(e){let t=-1;const n=[];for(;++t=3&&(u===null||ie(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),xe(u)?Ee(e,l,"whitespace")(u):l(u))}}const Ye={continuation:{tokenize:Hf},exit:Kf,name:"list",tokenize:Uf},$f={partial:!0,tokenize:Gf},zf={partial:!0,tokenize:Wf};function Uf(e,t,n){const r=this,s=r.events[r.events.length-1];let a=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,i=0;return l;function l(f){const x=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:Jr(f)){if(r.containerState.type||(r.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Wn,n,u)(f):u(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(f)}return n(f)}function c(f){return Jr(f)&&++i<10?(e.consume(f),c):(!r.interrupt||i<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),u(f)):n(f)}function u(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(wn,r.interrupt?n:d,e.attempt($f,m,p))}function d(f){return r.containerState.initialBlankLine=!0,a++,m(f)}function p(f){return xe(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),m):n(f)}function m(f){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function Hf(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(wn,s,a);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ee(e,t,"listItemIndent",r.containerState.size+1)(l)}function a(l){return r.containerState.furtherBlankLines||!xe(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(zf,t,i)(l))}function i(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ee(e,e.attempt(Ye,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Wf(e,t,n){const r=this;return Ee(e,s,"listItemIndent",r.containerState.size+1);function s(a){const i=r.events[r.events.length-1];return i&&i[1].type==="listItemIndent"&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(a):n(a)}}function Kf(e){e.exit(this.containerState.type)}function Gf(e,t,n){const r=this;return Ee(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(a){const i=r.events[r.events.length-1];return!xe(a)&&i&&i[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const Xo={name:"setextUnderline",resolveTo:qf,tokenize:Vf};function qf(e,t){let n=e.length,r,s,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const i={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",a?(e.splice(s,0,["enter",i,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=i,e.push(["exit",i,t]),e}function Vf(e,t,n){const r=this;let s;return a;function a(u){let d=r.events.length,p;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){p=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(e.enter("setextHeadingLine"),s=u,i(u)):n(u)}function i(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===s?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),xe(u)?Ee(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||ie(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Yf={tokenize:Xf};function Xf(e){const t=this,n=e.attempt(wn,r,e.attempt(this.parser.constructs.flowInitial,s,Ee(e,e.attempt(this.parser.constructs.flow,s,e.attempt(ef,s)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Zf={resolveAll:Sa()},Jf=Na("string"),Qf=Na("text");function Na(e){return{resolveAll:Sa(e==="text"?em:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],a=n.attempt(s,i,l);return i;function i(d){return u(d)?a(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),a(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const p=s[d];let m=-1;if(p)for(;++m-1){const l=i[0];typeof l=="string"?i[0]=l.slice(r):i.shift()}a>0&&i.push(e[s].slice(0,a))}return i}function fm(e,t){let n=-1;const r=[];let s;for(;++n0){const We=te.tokenStack[te.tokenStack.length-1];(We[1]||Jo).call(te,void 0,We[0])}for(W.position={start:It(P.length>0?P[0][1].start:{line:1,column:1,offset:0}),end:It(P.length>0?P[P.length-2][1].end:{line:1,column:1,offset:0})},fe=-1;++fe0&&(r.className=["language-"+s[0]]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(t,a),a}function Tm(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Cm(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Am(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=on(r.toLowerCase()),a=e.footnoteOrder.indexOf(r);let i,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),i=e.footnoteOrder.length):i=a+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function jm(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 Mm(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Aa(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 s=e.all(t),a=s[0];a&&a.type==="text"?a.value="["+a.value:s.unshift({type:"text",value:"["});const i=s[s.length-1];return i&&i.type==="text"?i.value+=r:s.push({type:"text",value:r}),s}function Rm(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Aa(e,t);const s={src:on(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const a={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,a),e.applyData(t,a)}function Im(e,t){const n={src:on(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 Om(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 Lm(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Aa(e,t);const s={href:on(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const a={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Dm(e,t){const n={href:on(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 Pm(e,t,n){const r=e.all(t),s=n?Bm(n):ja(t),a={},i=[];if(typeof t.checked=="boolean"){const d=r[0];let p;d&&d.type==="element"&&d.tagName==="p"?p=d:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let l=-1;for(;++l1}function Fm(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s0){const i={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=gs(t.children[1]),c=ca(t.children[t.children.length-1]);l&&c&&(i.position={start:l,end:c}),s.push(i)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,a),e.applyData(t,a)}function Wm(e,t,n){const r=n?n.children:void 0,a=(r?r.indexOf(t):1)===0?"th":"td",i=n&&n.type==="table"?n.align:void 0,l=i?i.length:t.children.length;let c=-1;const u=[];for(;++c0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return a.push(ti(t.slice(s),s>0,!1)),a.join("")}function ti(e,t,n){let r=0,s=e.length;if(t){let a=e.codePointAt(r);for(;a===Qo||a===ei;)r++,a=e.codePointAt(r)}if(n){let a=e.codePointAt(s-1);for(;a===Qo||a===ei;)s--,a=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function qm(e,t){const n={type:"text",value:Gm(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Vm(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Ym={blockquote:_m,break:Nm,code:Sm,delete:Tm,emphasis:Cm,footnoteReference:Am,heading:jm,html:Mm,imageReference:Rm,image:Im,inlineCode:Om,linkReference:Lm,link:Dm,listItem:Pm,list:Fm,paragraph:$m,root:zm,strong:Um,table:Hm,tableCell:Km,tableRow:Wm,text:qm,thematicBreak:Vm,toml:On,yaml:On,definition:On,footnoteDefinition:On};function On(){}const Ma=-1,ar=0,bn=1,Xn=2,ws=3,_s=4,Ns=5,Ss=6,Ra=7,Ia=8,ni=typeof self=="object"?self:globalThis,Xm=(e,t)=>{const n=(s,a)=>(e.set(a,s),s),r=s=>{if(e.has(s))return e.get(s);const[a,i]=t[s];switch(a){case ar:case Ma:return n(i,s);case bn:{const l=n([],s);for(const c of i)l.push(r(c));return l}case Xn:{const l=n({},s);for(const[c,u]of i)l[r(c)]=r(u);return l}case ws:return n(new Date(i),s);case _s:{const{source:l,flags:c}=i;return n(new RegExp(l,c),s)}case Ns:{const l=n(new Map,s);for(const[c,u]of i)l.set(r(c),r(u));return l}case Ss:{const l=n(new Set,s);for(const c of i)l.add(r(c));return l}case Ra:{const{name:l,message:c}=i;return n(new ni[l](c),s)}case Ia:return n(BigInt(i),s);case"BigInt":return n(Object(BigInt(i)),s);case"ArrayBuffer":return n(new Uint8Array(i).buffer,i);case"DataView":{const{buffer:l}=new Uint8Array(i);return n(new DataView(l),i)}}return n(new ni[a](i),s)};return r},ri=e=>Xm(new Map,e)(0),Zt="",{toString:Zm}={},{keys:Jm}=Object,pn=e=>{const t=typeof e;if(t!=="object"||!e)return[ar,t];const n=Zm.call(e).slice(8,-1);switch(n){case"Array":return[bn,Zt];case"Object":return[Xn,Zt];case"Date":return[ws,Zt];case"RegExp":return[_s,Zt];case"Map":return[Ns,Zt];case"Set":return[Ss,Zt];case"DataView":return[bn,n]}return n.includes("Array")?[bn,n]:n.includes("Error")?[Ra,n]:[Xn,n]},Ln=([e,t])=>e===ar&&(t==="function"||t==="symbol"),Qm=(e,t,n,r)=>{const s=(i,l)=>{const c=r.push(i)-1;return n.set(l,c),c},a=i=>{if(n.has(i))return n.get(i);let[l,c]=pn(i);switch(l){case ar:{let d=i;switch(c){case"bigint":l=Ia,d=i.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return s([Ma],i)}return s([l,d],i)}case bn:{if(c){let m=i;return c==="DataView"?m=new Uint8Array(i.buffer):c==="ArrayBuffer"&&(m=new Uint8Array(i)),s([c,[...m]],i)}const d=[],p=s([l,d],i);for(const m of i)d.push(a(m));return p}case Xn:{if(c)switch(c){case"BigInt":return s([c,i.toString()],i);case"Boolean":case"Number":case"String":return s([c,i.valueOf()],i)}if(t&&"toJSON"in i)return a(i.toJSON());const d=[],p=s([l,d],i);for(const m of Jm(i))(e||!Ln(pn(i[m])))&&d.push([a(m),a(i[m])]);return p}case ws:return s([l,i.toISOString()],i);case _s:{const{source:d,flags:p}=i;return s([l,{source:d,flags:p}],i)}case Ns:{const d=[],p=s([l,d],i);for(const[m,f]of i)(e||!(Ln(pn(m))||Ln(pn(f))))&&d.push([a(m),a(f)]);return p}case Ss:{const d=[],p=s([l,d],i);for(const m of i)(e||!Ln(pn(m)))&&d.push(a(m));return p}}const{message:u}=i;return s([l,{name:c,message:u}],i)};return a},si=(e,{json:t,lossy:n}={})=>{const r=[];return Qm(!(t||n),!!t,new Map,r)(e),r},Zn=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?ri(si(e,t)):structuredClone(e):(e,t)=>ri(si(e,t));function eh(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 th(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||eh,r=e.options.footnoteBackLabel||th,s=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",i=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c0&&x.push({type:"text",value:" "});let b=typeof n=="string"?n:n(c,f);typeof b=="string"&&(b={type:"text",value:b}),x.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,f),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const v=d[d.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const b=v.children[v.children.length-1];b&&b.type==="text"?b.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...x)}else d.push(...x);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(d,!0)};e.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...Zn(i),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
+`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
+`}]}}const _n=(function(e){if(e==null)return ih;if(typeof e=="function")return lr(e);if(typeof e=="object")return Array.isArray(e)?rh(e):sh(e);if(typeof e=="string")return oh(e);throw new Error("Expected function, string, or object as test")});function rh(e){const t=[];let n=-1;for(;++n":""))+")"})}return m;function m(){let f=Oa,x,h,v;if((!t||a(c,u,d[d.length-1]||void 0))&&(f=uh(n(c,d)),f[0]===es))return f;if("children"in c&&c.children){const y=c;if(y.children&&f[0]!==ch)for(h=(r?y.children.length:-1)+i,v=d.concat(y);h>-1&&h0&&n.push({type:"text",value:`
+`}),n}function oi(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function ii(e,t){const n=ph(e,t),r=n.one(e,void 0),s=nh(n),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&a.children.push({type:"text",value:`
+`},s),a}function xh(e,t){return e&&"run"in e?async function(n,r){const s=ii(n,{file:r,...t});await e.run(s,r)}:function(n,r){return ii(n,{file:r,...e||t})}}function ai(e){if(e)throw e}var Ar,li;function bh(){if(li)return Ar;li=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},a=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var d=e.call(u,"constructor"),p=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!d&&!p)return!1;var m;for(m in u);return typeof m>"u"||e.call(u,m)},i=function(u,d){n&&d.name==="__proto__"?n(u,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):u[d.name]=d.newValue},l=function(u,d){if(d==="__proto__")if(e.call(u,d)){if(r)return r(u,d).value}else return;return u[d]};return Ar=function c(){var u,d,p,m,f,x,h=arguments[0],v=1,y=arguments.length,b=!1;for(typeof h=="boolean"&&(b=h,h=arguments[1]||{},v=2),(h==null||typeof h!="object"&&typeof h!="function")&&(h={});vi.length;let c;l&&i.push(s);try{c=e.apply(this,i)}catch(u){const d=u;if(l&&n)throw d;return s(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(a,s):c instanceof Error?s(c):a(c))}function s(i,...l){n||(n=!0,t(i,...l))}function a(i){s(null,i)}}const gt={basename:Eh,dirname:wh,extname:_h,join:Nh,sep:"/"};function Eh(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Nn(e);let n=0,r=-1,s=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(a){n=s+1;break}}else r<0&&(a=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let i=-1,l=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(a){n=s+1;break}}else i<0&&(a=!0,i=s+1),l>-1&&(e.codePointAt(s)===t.codePointAt(l--)?l<0&&(r=s):(l=-1,r=i));return n===r?r=i:r<0&&(r=e.length),e.slice(n,r)}function wh(e){if(Nn(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 _h(e){Nn(e);let t=e.length,n=-1,r=0,s=-1,a=0,i;for(;t--;){const l=e.codePointAt(t);if(l===47){if(i){r=t+1;break}continue}n<0&&(i=!0,n=t+1),l===46?s<0?s=t:a!==1&&(a=1):s>-1&&(a=-1)}return s<0||n<0||a===0||a===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function Nh(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Th(e,t){let n="",r=0,s=-1,a=0,i=-1,l,c;for(;++i<=e.length;){if(i2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=i,a=0;continue}}else if(n.length>0){n="",r=0,s=i,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,i):n=e.slice(s+1,i),r=i-s-1;s=i,a=0}else l===46&&a>-1?a++:a=-1}return n}function Nn(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Ch={cwd:Ah};function Ah(){return"/"}function rs(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function jh(e){if(typeof e=="string")e=new URL(e);else if(!rs(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 Mh(e)}function Mh(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[f,...x]=d;const h=r[m][1];ns(h)&&ns(f)&&(f=jr(!0,h,f)),r[m]=[u,f,...x]}}}}const Lh=new Ts().freeze();function Or(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Lr(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Dr(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 ui(e){if(!ns(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function di(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Dn(e){return Dh(e)?e:new Da(e)}function Dh(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Ph(e){return typeof e=="string"||Bh(e)}function Bh(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Fh="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",pi=[],fi={allowDangerousHtml:!0},$h=/^(https?|ircs?|mailto|xmpp)$/i,zh=[{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 Uh(e){const t=Hh(e),n=Wh(e);return Kh(t.runSync(t.parse(n),n),e)}function Hh(e){const t=e.rehypePlugins||pi,n=e.remarkPlugins||pi,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...fi}:fi;return Lh().use(wm).use(n).use(xh,r).use(t)}function Wh(e){const t=e.children||"",n=new Da;return typeof t=="string"&&(n.value=t),n}function Kh(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,a=t.disallowedElements,i=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||Gh;for(const d of zh)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Fh+d.id,void 0);return cr(e,u),op(e,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function u(d,p,m){if(d.type==="raw"&&m&&typeof p=="number")return i?m.children.splice(p,1):m.children[p]={type:"text",value:d.value},p;if(d.type==="element"){let f;for(f in Sr)if(Object.hasOwn(Sr,f)&&Object.hasOwn(d.properties,f)){const x=d.properties[f],h=Sr[f];(h===null||h.includes(d.tagName))&&(d.properties[f]=c(String(x||""),f,d))}}if(d.type==="element"){let f=n?!n.includes(d.tagName):a?a.includes(d.tagName):!1;if(!f&&r&&typeof p=="number"&&(f=!r(d,p,m)),f&&m&&typeof p=="number")return l&&d.children?m.children.splice(p,1,...d.children):m.children.splice(p,1),p}}}function Gh(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||$h.test(e.slice(0,t))?e:""}const mi=(function(e,t,n){const r=_n(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++tu&&(u=d):d&&(u!==void 0&&u>-1&&c.push(`
+`.repeat(u)||" "),u=-1,c.push(d))}return c.join("")}function Ba(e,t,n){return e.type==="element"?eg(e,t,n):e.type==="text"?n.whitespace==="normal"?Fa(e,n):tg(e):[]}function eg(e,t,n){const r=$a(e,n),s=e.children||[];let a=-1,i=[];if(Jh(e))return i;let l,c;for(ss(e)||bi(e)&&mi(t,e,bi)?c=`
+`:Zh(e)?(l=2,c=2):Pa(e)&&(l=1,c=1);++a]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},p={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},f=t.optional(s)+e.IDENT_RE+"\\s*\\(",x=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],h=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],v=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],I={type:h,keyword:x,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},L={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},T=[L,p,l,n,e.C_BLOCK_COMMENT_MODE,d,u],B={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:I,contains:T.concat([{begin:/\(/,end:/\)/,keywords:I,contains:T.concat(["self"]),relevance:0}]),relevance:0},D={className:"function",begin:"("+i+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:I,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:I,relevance:0},{begin:f,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:I,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:I,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,p]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:I,illegal:"",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(B,D,L,T,[p,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:I,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:I},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function ag(e){const t={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=ig(e),r=n.keywords;return r.type=[...r.type,...t.type],r.literal=[...r.literal,...t.literal],r.built_in=[...r.built_in,...t.built_in],r._hints=t._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function lg(e){const t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const s={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},a=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),i={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},l={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,s]};s.contains.push(l);const c={match:/\\"/},u={className:"string",begin:/'/,end:/'/},d={match:/\\'/},p={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},m=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=e.SHEBANG({binary:`(${m.join("|")})`,relevance:10}),x={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},h=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],v=["true","false"],y={match:/(\/[a-z._-]+)+/},b=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],A=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],I=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],L=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:h,literal:v,built_in:[...b,...A,"set","shopt",...I,...L]},contains:[f,e.SHEBANG(),x,p,a,i,y,l,c,u,d,n]}}function cg(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",i="("+r+"|"+t.optional(s)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},p={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},f=t.optional(s)+e.IDENT_RE+"\\s*\\(",v={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},y=[p,l,n,e.C_BLOCK_COMMENT_MODE,d,u],b={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:v,contains:y.concat([{begin:/\(/,end:/\)/,keywords:v,contains:y.concat(["self"]),relevance:0}]),relevance:0},A={begin:"("+i+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:v,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:v,relevance:0},{begin:f,returnBegin:!0,contains:[e.inherit(m,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,p]};return{name:"C",aliases:["h"],keywords:v,disableAutodetect:!0,illegal:"",contains:[].concat(b,A,y,[p,{begin:e.IDENT_RE+"::",keywords:v},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:p,strings:u,keywords:v}}}function ug(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",i="(?!struct)("+r+"|"+t.optional(s)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},p={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},f=t.optional(s)+e.IDENT_RE+"\\s*\\(",x=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],h=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],v=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],I={type:h,keyword:x,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},L={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},T=[L,p,l,n,e.C_BLOCK_COMMENT_MODE,d,u],B={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:I,contains:T.concat([{begin:/\(/,end:/\)/,keywords:I,contains:T.concat(["self"]),relevance:0}]),relevance:0},D={className:"function",begin:"("+i+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:I,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:I,relevance:0},{begin:f,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:I,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:I,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,p]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:I,illegal:"",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(B,D,L,T,[p,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:I,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:I},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function dg(e){const t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],s=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],a=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],i={keyword:s.concat(a),built_in:t,literal:r},l=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),c={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},u={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},p=e.inherit(d,{illegal:/\n/}),m={className:"subst",begin:/\{/,end:/\}/,keywords:i},f=e.inherit(m,{illegal:/\n/}),x={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,f]},h={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},m]},v=e.inherit(h,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]});m.contains=[h,x,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.C_BLOCK_COMMENT_MODE],f.contains=[v,x,p,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const y={variants:[u,h,x,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},b={begin:"<",end:">",contains:[{beginKeywords:"in out"},l]},A=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",I={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:i,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:"?",end:">"}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},y,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},l,b,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,b,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+A+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:i,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,b],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,relevance:0,contains:[y,c,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},I]}}const pg=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),fg=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],mg=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],hg=[...fg,...mg],gg=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),xg=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),bg=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),yg=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function vg(e){const t=e.regex,n=pg(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s="and or not only",a=/@-?\w[\w]*(-\w+)*/,i="[a-zA-Z-][a-zA-Z0-9_-]*",l=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+i,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+xg.join("|")+")"},{begin:":(:)?("+bg.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+yg.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...l,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...l,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:a},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:gg.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+hg.join("|")+")\\b"}]}}function kg(e){const t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function Eg(e){const a={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:a,illegal:"",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:a,illegal:/["']/}]}]}}function wg(e){const t=e.regex,n=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:t.concat(n,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function _g(e){const t=e.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},r=e.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const s={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},a={className:"literal",begin:/\bon|off|true|false|yes|no\b/},i={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},l={begin:/\[/,end:/\]/,contains:[r,a,s,i,n,"self"],relevance:0},c=/[A-Za-z0-9_-]+/,u=/"(\\"|[^"])*"/,d=/'[^']*'/,p=t.either(c,u,d),m=t.concat(p,"(\\s*\\.\\s*",p,")*",t.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:m,className:"attr",starts:{end:/$/,contains:[r,l,a,s,i,n]}}]}}var Jt="[0-9](_*[0-9])*",Pn=`\\.(${Jt})`,Bn="[0-9a-fA-F](_*[0-9a-fA-F])*",yi={className:"number",variants:[{begin:`(\\b(${Jt})((${Pn})|\\.)?|(${Pn}))[eE][+-]?(${Jt})[fFdD]?\\b`},{begin:`\\b(${Jt})((${Pn})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Pn})[fFdD]?\\b`},{begin:`\\b(${Jt})[fFdD]\\b`},{begin:`\\b0[xX]((${Bn})\\.?|(${Bn})?\\.(${Bn}))[pP][+-]?(${Jt})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Bn})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function za(e,t,n){return n===-1?"":e.replace(t,r=>za(e,t,n-1))}function Ng(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+za("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),c={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},u={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:c,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[d,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:c,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[u,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,yi,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},yi,u]}}const vi="[A-Za-z$_][0-9A-Za-z$_]*",Sg=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Tg=["true","false","null","undefined","NaN","Infinity"],Ua=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Ha=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Wa=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Cg=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Ag=[].concat(Wa,Ua,Ha);function jg(e){const t=e.regex,n=(z,{after:q})=>{const g=""+z[0].slice(1);return z.input.indexOf(g,q)!==-1},r=vi,s={begin:"<>",end:">"},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(z,q)=>{const g=z[0].length+z.index,F=z.input[g];if(F==="<"||F===","){q.ignoreMatch();return}F===">"&&(n(z,{after:g})||q.ignoreMatch());let K;const k=z.input.substring(g);if(K=k.match(/^\s*=/)){q.ignoreMatch();return}if((K=k.match(/^\s+extends\s+/))&&K.index===0){q.ignoreMatch();return}}},l={$pattern:vi,keyword:Sg,literal:Tg,built_in:Ag,"variable.language":Cg},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",p={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},m={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"xml"}},x={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"css"}},h={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,m]},b={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},A=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,x,h,v,{match:/\$\d+/},p];m.contains=A.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(A)});const I=[].concat(b,m.contains),L=I.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(I)}]),T={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:L},B={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},D={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Ua,...Ha]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},S={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[T],illegal:/%/},N={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function O(z){return t.concat("(?!",z.join("|"),")")}const M={match:t.concat(/\b/,O([...Wa,"super","import"].map(z=>`${z}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},_={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},w={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},T]},R="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",H={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(R)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[T]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:L,CLASS_REFERENCE:D},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,x,h,v,b,{match:/\$\d+/},p,D,{scope:"attr",match:r+t.lookahead(":"),relevance:0},H,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[b,e.REGEXP_MODE,{className:"function",begin:R,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:L}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:a},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:!0,contains:["self"]}]}]},S,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[T,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},_,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[T]},M,N,B,w,{match:/\$[(.]/}]}}var Qt="[0-9](_*[0-9])*",Fn=`\\.(${Qt})`,$n="[0-9a-fA-F](_*[0-9a-fA-F])*",Mg={className:"number",variants:[{begin:`(\\b(${Qt})((${Fn})|\\.)?|(${Fn}))[eE][+-]?(${Qt})[fFdD]?\\b`},{begin:`\\b(${Qt})((${Fn})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Fn})[fFdD]?\\b`},{begin:`\\b(${Qt})[fFdD]\\b`},{begin:`\\b0[xX]((${$n})\\.?|(${$n})?\\.(${$n}))[pP][+-]?(${Qt})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${$n})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Rg(e){const t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},s={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},a={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},i={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[a,s]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,a,s]}]};s.contains.push(i);const l={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},c={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(i,{className:"string"}),"self"]}]},u=Mg,d=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),p={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},m=p;return m.variants[1].contains=[p],p.variants[1].contains=[m],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,d,n,r,l,c,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[p,e.C_LINE_COMMENT_MODE,d],relevance:0},e.C_LINE_COMMENT_MODE,d,l,c,i,e.C_NUMBER_MODE]},d]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin:/,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},l,c]},i,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
+`},u]}}const Ig=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Og=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],Lg=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],Dg=[...Og,...Lg],Pg=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Ka=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Ga=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Bg=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),Fg=Ka.concat(Ga).sort().reverse();function $g(e){const t=Ig(e),n=Fg,r="and or not only",s="[\\w-]+",a="("+s+"|@\\{"+s+"\\})",i=[],l=[],c=function(A){return{className:"string",begin:"~?"+A+".*?"+A}},u=function(A,I,L){return{className:A,begin:I,relevance:L}},d={$pattern:/[a-z-]+/,keyword:r,attribute:Pg.join(" ")},p={begin:"\\(",end:"\\)",contains:l,keywords:d,relevance:0};l.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,c("'"),c('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,p,u("variable","@@?"+s,10),u("variable","@\\{"+s+"\\}"),u("built_in","~?`[^`]*?`"),{className:"attribute",begin:s+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const m=l.concat({begin:/\{/,end:/\}/,contains:i}),f={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(l)},x={begin:a+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Bg.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},h={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:d,returnEnd:!0,contains:l,relevance:0}},v={className:"variable",variants:[{begin:"@"+s+"\\s*:",relevance:15},{begin:"@"+s}],starts:{end:"[;}]",returnEnd:!0,contains:m}},y={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:a,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,f,u("keyword","all\\b"),u("variable","@\\{"+s+"\\}"),{begin:"\\b("+Dg.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,u("selector-tag",a,0),u("selector-id","#"+a),u("selector-class","\\."+a,0),u("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+Ka.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Ga.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:m},{begin:"!important"},t.FUNCTION_DISPATCH]},b={begin:s+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return i.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,h,v,b,x,y,f,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:i}}function zg(e){const t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},s=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:s.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:s}].concat(s)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function Ug(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[t,n]},s={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},a={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},i={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[t]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[e.HASH_COMMENT_MODE,t,n,r,s,a,i]}}function Hg(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},s={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},a={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},i={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},l=/[A-Za-z][A-Za-z0-9+.-]*/,c={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,l,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},u={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},p=e.inherit(u,{contains:[]}),m=e.inherit(d,{contains:[]});u.contains.push(m),d.contains.push(p);let f=[n,c];return[u,d,p,m].forEach(y=>{y.contains=y.contains.concat(f)}),f=f.concat(u,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:f},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:f}]}]},n,a,u,d,{className:"quote",begin:"^>\\s+",contains:f,end:"$"},s,r,c,i,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function Wg(e){const t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,l={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},c={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:l,illegal:"",contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+c.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function Kg(e){const t=e.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,s={$pattern:/[\w.]+/,keyword:n.join(" ")},a={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:s},i={begin:/->\{/,end:/\}/},l={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[l]},u={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},d=[e.BACKSLASH_ESCAPE,a,c],p=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],m=(h,v,y="\\1")=>{const b=y==="\\1"?y:t.concat(y,v);return t.concat(t.concat("(?:",h,")"),v,/(?:\\.|[^\\\/])*?/,b,/(?:\\.|[^\\\/])*?/,y,r)},f=(h,v,y)=>t.concat(t.concat("(?:",h,")"),v,/(?:\\.|[^\\\/])*?/,y,r),x=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),i,{className:"string",contains:d,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},u,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:m("s|tr|y",t.either(...p,{capture:!0}))},{begin:m("s|tr|y","\\(","\\)")},{begin:m("s|tr|y","\\[","\\]")},{begin:m("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:f("(?:m|qr)?",/\//,/\//)},{begin:f("m|qr",t.either(...p,{capture:!0}),/\1/)},{begin:f("m|qr",/\(/,/\)/)},{begin:f("m|qr",/\[/,/\]/)},{begin:f("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,l]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,l,u]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return a.contains=x,i.contains=x,{name:"Perl",aliases:["pl","pm"],keywords:s,contains:x}}function Gg(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),s=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),a=t.concat(/[A-Z]+/,n),i={scope:"variable",match:"\\$+"+r},l={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},u=e.inherit(e.APOS_STRING_MODE,{illegal:null}),d=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(c)}),p={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(_,w)=>{w.data._beginMatch=_[1]||_[2]},"on:end":(_,w)=>{w.data._beginMatch!==_[1]&&w.ignoreMatch()}},m=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),f=`[
+]`,x={scope:"string",variants:[d,u,p,m]},h={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},v=["false","null","true"],y=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],b=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],I={keyword:y,literal:(_=>{const w=[];return _.forEach(R=>{w.push(R),R.toLowerCase()===R?w.push(R.toUpperCase()):w.push(R.toLowerCase())}),w})(v),built_in:b},L=_=>_.map(w=>w.replace(/\|\d+$/,"")),T={variants:[{match:[/new/,t.concat(f,"+"),t.concat("(?!",L(b).join("\\b|"),"\\b)"),s],scope:{1:"keyword",4:"title.class"}}]},B=t.concat(r,"\\b(?!\\()"),D={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),B],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[s,t.concat(/::/,t.lookahead(/(?!class\b)/)),B],scope:{1:"title.class",3:"variable.constant"}},{match:[s,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[s,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},C={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},S={relevance:0,begin:/\(/,end:/\)/,keywords:I,contains:[C,i,D,e.C_BLOCK_COMMENT_MODE,x,h,T]},N={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",L(y).join("\\b|"),"|",L(b).join("\\b|"),"\\b)"),r,t.concat(f,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[S]};S.contains.push(N);const O=[C,D,e.C_BLOCK_COMMENT_MODE,x,h,T],M={begin:t.concat(/#\[\s*\\?/,t.either(s,a)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:v,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:v,keyword:["new","array"]},contains:["self",...O]},...O,{scope:"meta",variants:[{match:s},{match:a}]}]};return{case_insensitive:!1,keywords:I,contains:[M,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},l,{scope:"variable.language",match:/\$this\b/},i,N,D,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},T,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:I,contains:["self",M,i,D,e.C_BLOCK_COMMENT_MODE,x,h]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},x,h]}}function qg(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function Vg(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function Yg(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],l={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},c={className:"meta",begin:/^(>>>|\.\.\.) /},u={className:"subst",begin:/\{/,end:/\}/,keywords:l,illegal:/#/},d={begin:/\{\{/,relevance:0},p={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,d,u]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},m="[0-9](_?[0-9])*",f=`(\\b(${m}))?\\.(${m})|\\b(${m})\\.`,x=`\\b|${r.join("|")}`,h={className:"number",relevance:0,variants:[{begin:`(\\b(${m})|(${f}))[eE][+-]?(${m})[jJ]?(?=${x})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${x})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${x})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${x})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${x})`},{begin:`\\b(${m})[jJ](?=${x})`}]},v={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},y={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",c,h,p,e.HASH_COMMENT_MODE]}]};return u.contains=[p,h,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[c,h,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},p,v,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[y]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[h,y,p]}]}}function Xg(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function Zg(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),s=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,a=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[s,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[a,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:s},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:a},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function Jg(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),s=t.concat(r,/(::\w+)*/),i={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},l={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},u=[e.COMMENT("#","$",{contains:[l]}),e.COMMENT("^=begin","^=end",{contains:[l],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:i},p={className:"string",contains:[e.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,d]})]}]},m="[1-9](_?[0-9])*|0",f="[0-9](_?[0-9])*",x={className:"number",relevance:0,variants:[{begin:`\\b(${m})(\\.(${f}))?([eE][+-]?(${f})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},h={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:i}]},T=[p,{variants:[{match:[/class\s+/,s,/\s+<\s+/,s]},{match:[/\b(class|module)\s+/,s]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:i},{match:[/(include|extend)\s+/,s],scope:{2:"title.class"},keywords:i},{relevance:0,match:[s,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[h]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[p,{begin:n}],relevance:0},x,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:i},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,d],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(c,u),relevance:0}].concat(c,u);d.contains=T,h.contains=T;const S=[{begin:/^\s*=>/,starts:{end:"$",contains:T}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:i,contains:T}}];return u.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:i,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(S).concat(u).concat(T)}}function Qg(e){const t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),s=t.concat(n,e.IDENT_RE),a={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,s,t.lookahead(/\s*\(/))},i="([ui](8|16|32|64|128|size)|f(32|64))?",l=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],c=["true","false","Some","None","Ok","Err"],u=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],d=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:d,keyword:l,literal:c,built_in:u},illegal:"",contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+i},{begin:"\\b0o([0-7_]+)"+i},{begin:"\\b0x([A-Fa-f0-9_]+)"+i},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+i}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{keyword:"Self",built_in:u,type:d}},{className:"punctuation",begin:"->"},a]}}const ex=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),tx=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],nx=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],rx=[...tx,...nx],sx=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),ox=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),ix=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),ax=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function lx(e){const t=ex(e),n=ix,r=ox,s="@[a-z-]+",a="and or not only",l={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+rx.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},l,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+ax.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,l,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:s,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:a,attribute:sx.join(" ")},contains:[{begin:s,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},l,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function cx(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function ux(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},s={begin:/"/,end:/"/,contains:[{match:/""/}]},a=["true","false","unknown"],i=["double precision","large object","with timezone","without timezone"],l=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],c=["add","asc","collation","desc","final","first","last","view"],u=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],p=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],m=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],f=d,x=[...u,...c].filter(L=>!d.includes(L)),h={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},v={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},y={match:t.concat(/\b/,t.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function b(L){return t.concat(/\b/,t.either(...L.map(T=>T.replace(/\s+/,"\\s+"))),/\b/)}const A={scope:"keyword",match:b(m),relevance:0};function I(L,{exceptions:T,when:B}={}){const D=B;return T=T||[],L.map(C=>C.match(/\|\d+$/)||T.includes(C)?C:D(C)?`${C}|0`:C)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:I(x,{when:L=>L.length<3}),literal:a,type:l,built_in:p},contains:[{scope:"type",match:b(i)},A,y,h,r,s,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,v]}}function qa(e){return e?typeof e=="string"?e:e.source:null}function fn(e){return _e("(?=",e,")")}function _e(...e){return e.map(n=>qa(n)).join("")}function dx(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Ge(...e){return"("+(dx(e).capture?"":"?:")+e.map(r=>qa(r)).join("|")+")"}const As=e=>_e(/\b/,e,/\w$/.test(e)?/\b/:/\B/),px=["Protocol","Type"].map(As),ki=["init","self"].map(As),fx=["Any","Self"],Pr=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],Ei=["false","nil","true"],mx=["assignment","associativity","higherThan","left","lowerThan","none","right"],hx=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],wi=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],Va=Ge(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),Ya=Ge(Va,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Br=_e(Va,Ya,"*"),Xa=Ge(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),Jn=Ge(Xa,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),ht=_e(Xa,Jn,"*"),zn=_e(/[A-Z]/,Jn,"*"),gx=["attached","autoclosure",_e(/convention\(/,Ge("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",_e(/objc\(/,ht,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],xx=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function bx(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],s={match:[/\./,Ge(...px,...ki)],className:{2:"keyword"}},a={match:_e(/\./,Ge(...Pr)),relevance:0},i=Pr.filter(ke=>typeof ke=="string").concat(["_|0"]),l=Pr.filter(ke=>typeof ke!="string").concat(fx).map(As),c={variants:[{className:"keyword",match:Ge(...l,...ki)}]},u={$pattern:Ge(/\b\w+/,/#\w+/),keyword:i.concat(hx),literal:Ei},d=[s,a,c],p={match:_e(/\./,Ge(...wi)),relevance:0},m={className:"built_in",match:_e(/\b/,Ge(...wi),/(?=\()/)},f=[p,m],x={match:/->/,relevance:0},h={className:"operator",relevance:0,variants:[{match:Br},{match:`\\.(\\.|${Ya})+`}]},v=[x,h],y="([0-9]_*)+",b="([0-9a-fA-F]_*)+",A={className:"number",relevance:0,variants:[{match:`\\b(${y})(\\.(${y}))?([eE][+-]?(${y}))?\\b`},{match:`\\b0x(${b})(\\.(${b}))?([pP][+-]?(${y}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},I=(ke="")=>({className:"subst",variants:[{match:_e(/\\/,ke,/[0\\tnr"']/)},{match:_e(/\\/,ke,/u\{[0-9a-fA-F]{1,8}\}/)}]}),L=(ke="")=>({className:"subst",match:_e(/\\/,ke,/[\t ]*(?:[\r\n]|\r\n)/)}),T=(ke="")=>({className:"subst",label:"interpol",begin:_e(/\\/,ke,/\(/),end:/\)/}),B=(ke="")=>({begin:_e(ke,/"""/),end:_e(/"""/,ke),contains:[I(ke),L(ke),T(ke)]}),D=(ke="")=>({begin:_e(ke,/"/),end:_e(/"/,ke),contains:[I(ke),T(ke)]}),C={className:"string",variants:[B(),B("#"),B("##"),B("###"),D(),D("#"),D("##"),D("###")]},S=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],N={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:S},O=ke=>{const rt=_e(ke,/\//),lt=_e(/\//,ke);return{begin:rt,end:lt,contains:[...S,{scope:"comment",begin:`#(?!.*${lt})`,end:/$/}]}},M={scope:"regexp",variants:[O("###"),O("##"),O("#"),N]},_={match:_e(/`/,ht,/`/)},w={className:"variable",match:/\$\d+/},R={className:"variable",match:`\\$${Jn}+`},H=[_,w,R],z={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:xx,contains:[...v,A,C]}]}},q={scope:"keyword",match:_e(/@/,Ge(...gx),fn(Ge(/\(/,/\s+/)))},g={scope:"meta",match:_e(/@/,ht)},F=[z,q,g],K={match:fn(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:_e(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Jn,"+")},{className:"type",match:zn,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:_e(/\s+&\s+/,fn(zn)),relevance:0}]},k={begin:/,end:/>/,keywords:u,contains:[...r,...d,...F,x,K]};K.contains.push(k);const se={match:_e(ht,/\s*:/),keywords:"_|0",relevance:0},G={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",se,...r,M,...d,...f,...v,A,C,...H,...F,K]},U={begin:/,end:/>/,keywords:"repeat each",contains:[...r,K]},re={begin:Ge(fn(_e(ht,/\s*:/)),fn(_e(ht,/\s+/,ht,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:ht}]},de={begin:/\(/,end:/\)/,keywords:u,contains:[re,...r,...d,...v,A,C,...F,K,G],endsParent:!0,illegal:/["']/},be={match:[/(func|macro)/,/\s+/,Ge(_.match,ht,Br)],className:{1:"keyword",3:"title.function"},contains:[U,de,t],illegal:[/\[/,/%/]},je={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[U,de,t],illegal:/\[|%/},it={match:[/operator/,/\s+/,Br],className:{1:"keyword",3:"title"}},Ie={begin:[/precedencegroup/,/\s+/,zn],className:{1:"keyword",3:"title"},contains:[K],keywords:[...mx,...Ei],end:/}/},at={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Nt={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},St={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,ht,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[U,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:zn},...d],relevance:0}]};for(const ke of C.variants){const rt=ke.contains.find(vt=>vt.label==="interpol");rt.keywords=u;const lt=[...d,...f,...v,A,C,...H];rt.contains=[...lt,{begin:/\(/,end:/\)/,contains:["self",...lt]}]}return{name:"Swift",keywords:u,contains:[...r,be,je,at,Nt,St,it,Ie,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},M,...d,...f,...v,A,C,...H,...F,K,G]}}const Qn="[A-Za-z$_][0-9A-Za-z$_]*",Za=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Ja=["true","false","null","undefined","NaN","Infinity"],Qa=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],el=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],tl=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],nl=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],rl=[].concat(tl,Qa,el);function yx(e){const t=e.regex,n=(z,{after:q})=>{const g=""+z[0].slice(1);return z.input.indexOf(g,q)!==-1},r=Qn,s={begin:"<>",end:">"},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(z,q)=>{const g=z[0].length+z.index,F=z.input[g];if(F==="<"||F===","){q.ignoreMatch();return}F===">"&&(n(z,{after:g})||q.ignoreMatch());let K;const k=z.input.substring(g);if(K=k.match(/^\s*=/)){q.ignoreMatch();return}if((K=k.match(/^\s+extends\s+/))&&K.index===0){q.ignoreMatch();return}}},l={$pattern:Qn,keyword:Za,literal:Ja,built_in:rl,"variable.language":nl},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",p={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},m={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"xml"}},x={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"css"}},h={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,m]},b={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},A=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,x,h,v,{match:/\$\d+/},p];m.contains=A.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(A)});const I=[].concat(b,m.contains),L=I.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(I)}]),T={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:L},B={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},D={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Qa,...el]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},S={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[T],illegal:/%/},N={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function O(z){return t.concat("(?!",z.join("|"),")")}const M={match:t.concat(/\b/,O([...tl,"super","import"].map(z=>`${z}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},_={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},w={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},T]},R="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",H={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(R)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[T]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:L,CLASS_REFERENCE:D},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,x,h,v,b,{match:/\$\d+/},p,D,{scope:"attr",match:r+t.lookahead(":"),relevance:0},H,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[b,e.REGEXP_MODE,{className:"function",begin:R,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:L}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:a},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:!0,contains:["self"]}]}]},S,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[T,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},_,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[T]},M,N,B,w,{match:/\$[(.]/}]}}function vx(e){const t=e.regex,n=yx(e),r=Qn,s=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],a={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},i={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:s},contains:[n.exports.CLASS_REFERENCE]},l={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:Qn,keyword:Za.concat(c),literal:Ja,built_in:rl.concat(s),"variable.language":nl},d={className:"meta",begin:"@"+r},p=(h,v,y)=>{const b=h.contains.findIndex(A=>A.label===v);if(b===-1)throw new Error("can not find mode to replace");h.contains.splice(b,1,y)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(d);const m=n.contains.find(h=>h.scope==="attr"),f=Object.assign({},m,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,m,f]),n.contains=n.contains.concat([d,a,i,f]),p(n,"shebang",e.SHEBANG()),p(n,"use_strict",l);const x=n.contains.find(h=>h.label==="func.def");return x.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function kx(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},s=/\d{1,2}\/\d{1,2}\/\d{4}/,a=/\d{4}-\d{1,2}-\d{1,2}/,i=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,l=/\d{1,2}(:\d{1,2}){1,2}/,c={className:"literal",variants:[{begin:t.concat(/# */,t.either(a,s),/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,i,/ *#/)},{begin:t.concat(/# */,t.either(a,s),/ +/,t.either(i,l),/ *#/)}]},u={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},d={className:"label",begin:/^\w+:/},p=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),m=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,c,u,d,p,m,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[m]}]}}function Ex(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],s={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},a={className:"variable",begin:/\$[\w_]+/},i={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},l={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},c={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},u={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},a,i,s,e.QUOTE_STRING_MODE,c,u,l]}}function wx(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,s={className:"symbol",begin:/&[a-z]+;|[0-9]+;|[a-f0-9]+;/},a={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},i=e.inherit(a,{begin:/\(/,end:/\)/}),l=e.inherit(e.APOS_STRING_MODE,{className:"string"}),c=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),u={endsWithParent:!0,illegal:/,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[s]},{begin:/'/,end:/'/,contains:[s]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[a,c,l,i,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[a,i,c,l]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/