From e39db744603290f349cb3eab7ea2caee9c66b56b Mon Sep 17 00:00:00 2001 From: Cristian Pufu Date: Sat, 28 Feb 2026 14:54:50 +0200 Subject: [PATCH] fix: improve agent --- pyproject.toml | 2 +- src/uipath/dev/server/__init__.py | 5 + src/uipath/dev/server/frontend/src/App.tsx | 2 +- .../server/frontend/src/api/agent-client.ts | 17 +- .../dev/server/frontend/src/api/websocket.ts | 8 + .../src/components/agent/AgentChatSidebar.tsx | 122 +++++- .../src/components/agent/AgentMessage.tsx | 369 ++++++++++++------ .../src/components/agent/QuestionCard.tsx | 104 +++++ .../frontend/src/store/useAgentStore.ts | 46 ++- .../server/frontend/src/store/useWebSocket.ts | 16 + .../dev/server/frontend/src/types/agent.ts | 20 +- .../dev/server/frontend/src/types/ws.ts | 6 +- .../dev/server/frontend/tsconfig.tsbuildinfo | 2 +- src/uipath/dev/server/routes/agent.py | 24 ++ ...anel-DAnMwTFj.js => ChatPanel-C97Mws6P.js} | 2 +- .../server/static/assets/index-Cp7BsqrO.js | 119 ++++++ .../server/static/assets/index-DKf_uUe0.css | 1 - .../server/static/assets/index-DYl0Xnov.js | 106 ----- .../server/static/assets/index-DcgkONKP.css | 1 + src/uipath/dev/server/static/index.html | 4 +- src/uipath/dev/server/ws/handler.py | 6 + src/uipath/dev/server/ws/manager.py | 20 + src/uipath/dev/server/ws/protocol.py | 2 + src/uipath/dev/services/agent/__init__.py | 2 + src/uipath/dev/services/agent/context.py | 22 +- src/uipath/dev/services/agent/events.py | 9 + src/uipath/dev/services/agent/loop.py | 213 ++++++++-- src/uipath/dev/services/agent/provider.py | 81 +++- src/uipath/dev/services/agent/service.py | 271 ++++++++++++- src/uipath/dev/services/agent/session.py | 2 + src/uipath/dev/services/agent/tools.py | 191 +++++++-- src/uipath/dev/services/skill_service.py | 42 ++ uv.lock | 2 +- 33 files changed, 1479 insertions(+), 360 deletions(-) create mode 100644 src/uipath/dev/server/frontend/src/components/agent/QuestionCard.tsx rename src/uipath/dev/server/static/assets/{ChatPanel-DAnMwTFj.js => ChatPanel-C97Mws6P.js} (99%) create mode 100644 src/uipath/dev/server/static/assets/index-Cp7BsqrO.js delete mode 100644 src/uipath/dev/server/static/assets/index-DKf_uUe0.css delete mode 100644 src/uipath/dev/server/static/assets/index-DYl0Xnov.js create mode 100644 src/uipath/dev/server/static/assets/index-DcgkONKP.css diff --git a/pyproject.toml b/pyproject.toml index e8a34bc..7af4b1f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath-dev" -version = "0.0.64" +version = "0.0.65" description = "UiPath Developer Console" readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.11" diff --git a/src/uipath/dev/server/__init__.py b/src/uipath/dev/server/__init__.py index facf47c..d969075 100644 --- a/src/uipath/dev/server/__init__.py +++ b/src/uipath/dev/server/__init__.py @@ -298,6 +298,7 @@ def _on_agent_event(self, event: Any) -> None: ToolApprovalRequired, ToolCompleted, ToolStarted, + UserQuestionAsked, ) cm = self.connection_manager @@ -322,6 +323,10 @@ def _on_agent_event(self, event: Any) -> None: session_id=sid, tool_call_id=tcid, tool=tool, args=args ): cm.broadcast_agent_tool_approval(sid, tcid, tool, args) + case UserQuestionAsked( + session_id=sid, question_id=qid, question=q, options=opts + ): + cm.broadcast_agent_question(sid, qid, q, opts) case ErrorOccurred(session_id=sid, message=message): cm.broadcast_agent_error(sid, message) case TokenUsageUpdated( diff --git a/src/uipath/dev/server/frontend/src/App.tsx b/src/uipath/dev/server/frontend/src/App.tsx index af87a67..9adbc81 100644 --- a/src/uipath/dev/server/frontend/src/App.tsx +++ b/src/uipath/dev/server/frontend/src/App.tsx @@ -315,7 +315,7 @@ export default function App() { const onMove = (ev: MouseEvent | TouchEvent) => { const clientX = "touches" in ev ? ev.touches[0].clientX : ev.clientX; // Dragging left increases width (panel is on the right) - const newW = Math.max(280, Math.min(500, startW - (clientX - startX))); + const newW = Math.max(280, Math.min(700, startW - (clientX - startX))); setAgentWidth(newW); }; diff --git a/src/uipath/dev/server/frontend/src/api/agent-client.ts b/src/uipath/dev/server/frontend/src/api/agent-client.ts index 318b247..17a37f4 100644 --- a/src/uipath/dev/server/frontend/src/api/agent-client.ts +++ b/src/uipath/dev/server/frontend/src/api/agent-client.ts @@ -1,4 +1,4 @@ -import type { AgentModel, AgentSkill } from "../types/agent"; +import type { AgentModel, AgentSessionState, AgentSkill } from "../types/agent"; const BASE = "/api"; @@ -11,6 +11,21 @@ export async function listAgentModels(): Promise { return res.json(); } +export async function getAgentSessionDiagnostics(sessionId: string): Promise> { + const res = await fetch(`${BASE}/agent/session/${sessionId}/diagnostics`); + if (!res.ok) { + throw new Error(`HTTP ${res.status}`); + } + return res.json(); +} + +export async function getAgentSessionState(sessionId: string): Promise { + const res = await fetch(`${BASE}/agent/session/${sessionId}/state`); + if (res.status === 404) return null; + if (!res.ok) throw new Error(`HTTP ${res.status}`); + return res.json(); +} + export async function listAgentSkills(): Promise { const res = await fetch(`${BASE}/agent/skills`); if (!res.ok) { diff --git a/src/uipath/dev/server/frontend/src/api/websocket.ts b/src/uipath/dev/server/frontend/src/api/websocket.ts index b0012fe..c86209d 100644 --- a/src/uipath/dev/server/frontend/src/api/websocket.ts +++ b/src/uipath/dev/server/frontend/src/api/websocket.ts @@ -144,4 +144,12 @@ export class WsClient { approved, }); } + + sendQuestionResponse(sessionId: string, questionId: string, answer: string): void { + this.send("agent.question_response", { + session_id: sessionId, + question_id: questionId, + answer, + }); + } } diff --git a/src/uipath/dev/server/frontend/src/components/agent/AgentChatSidebar.tsx b/src/uipath/dev/server/frontend/src/components/agent/AgentChatSidebar.tsx index 3b70af9..8092445 100644 --- a/src/uipath/dev/server/frontend/src/components/agent/AgentChatSidebar.tsx +++ b/src/uipath/dev/server/frontend/src/components/agent/AgentChatSidebar.tsx @@ -1,10 +1,11 @@ import { useCallback, useEffect, useRef, useState } from "react"; import { useAgentStore } from "../../store/useAgentStore"; import { useAuthStore } from "../../store/useAuthStore"; -import { listAgentModels, listAgentSkills } from "../../api/agent-client"; +import { getAgentSessionState, listAgentModels, listAgentSkills } from "../../api/agent-client"; import { getWs } from "../../store/useWebSocket"; import AgentMessageComponent from "./AgentMessage"; -import type { AgentSkill } from "../../types/agent"; +import QuestionCard from "./QuestionCard"; +import type { AgentPlanItem, AgentSkill } from "../../types/agent"; export default function AgentChatSidebar() { const ws = useRef(getWs()).current; @@ -20,6 +21,7 @@ export default function AgentChatSidebar() { sessionId, status, messages, + plan, models, selectedModel, modelsLoading, @@ -34,6 +36,7 @@ export default function AgentChatSidebar() { toggleSkill, setSkillsLoading, addUserMessage, + hydrateSession, clearSession, } = useAgentStore(); @@ -67,6 +70,24 @@ export default function AgentChatSidebar() { .finally(() => setSkillsLoading(false)); }, [skills.length, setSkills, setSelectedSkillIds, setSkillsLoading]); + // Hydrate session from sessionStorage on mount + useEffect(() => { + if (sessionId) return; // Already have a session + const storedId = sessionStorage.getItem("agent_session_id"); + if (!storedId) return; + getAgentSessionState(storedId) + .then((state) => { + if (state) { + hydrateSession(state); + } else { + sessionStorage.removeItem("agent_session_id"); + } + }) + .catch(() => { + sessionStorage.removeItem("agent_session_id"); + }); + }, []); // eslint-disable-line react-hooks/exhaustive-deps + const [showScrollTop, setShowScrollTop] = useState(false); const handleScroll = () => { @@ -84,7 +105,7 @@ export default function AgentChatSidebar() { } }); - const isBusy = status === "thinking" || status === "executing" || status === "planning"; + const isBusy = status === "thinking" || status === "executing" || status === "planning" || status === "awaiting_input"; const lastMsg = messages[messages.length - 1]; const isStreaming = isBusy && lastMsg?.role === "assistant" && !lastMsg.done; const showBusyIndicator = isBusy && !isStreaming; @@ -173,6 +194,9 @@ export default function AgentChatSidebar() { isBusy={isBusy} /> + {/* Sticky Plan */} + + {/* Messages */}
)} - {messages.map((msg) => ( + {messages.filter((msg) => msg.role !== "plan").map((msg) => ( ))} {showBusyIndicator && ( @@ -199,7 +223,7 @@ export default function AgentChatSidebar() {
- {status === "thinking" ? "Thinking..." : status === "executing" ? "Executing..." : "Planning..."} + {status === "thinking" ? "Thinking..." : status === "executing" ? "Executing..." : status === "awaiting_input" ? "Waiting for answer..." : "Planning..."}
@@ -219,6 +243,9 @@ export default function AgentChatSidebar() { )}
+ {/* Question card */} + + {/* Input */}
); } + +const MAX_VISIBLE_PLAN_ITEMS = 10; + +function StickyPlan({ plan }: { plan: AgentPlanItem[] }) { + const completed = plan.filter((t) => t.status === "completed").length; + const uncompleted = plan.filter((t) => t.status !== "completed"); + const allDone = plan.length > 0 && completed === plan.length; + const [collapsed, setCollapsed] = useState(false); + const prevUncompletedCount = useRef(uncompleted.length); + + // Auto-collapse when all tasks complete + useEffect(() => { + if (allDone) setCollapsed(true); + }, [allDone]); + + // Auto-expand when new uncompleted items appear + useEffect(() => { + if (uncompleted.length > prevUncompletedCount.current) { + setCollapsed(false); + } + prevUncompletedCount.current = uncompleted.length; + }, [uncompleted.length]); + + if (plan.length === 0) return null; + + // Show all uncompleted + fill remaining slots with most recent completed + const completedItems = plan.filter((t) => t.status === "completed"); + const remainingSlots = Math.max(0, MAX_VISIBLE_PLAN_ITEMS - uncompleted.length); + const recentCompleted = completedItems.slice(-remainingSlots); + // Preserve original order: show recent completed first, then uncompleted + const visibleItems = [...recentCompleted, ...uncompleted]; + const hiddenCount = plan.length - visibleItems.length; + + return ( +
+ + {!collapsed && ( +
+ {hiddenCount > 0 && ( +
+ {hiddenCount} earlier completed task{hiddenCount !== 1 ? "s" : ""} hidden +
+ )} + {visibleItems.map((item, i) => ( +
+ {item.status === "completed" ? ( + + ) : item.status === "in_progress" ? ( + + + + ) : ( + + + + )} + + {item.title} + +
+ ))} +
+ )} +
+ ); +} diff --git a/src/uipath/dev/server/frontend/src/components/agent/AgentMessage.tsx b/src/uipath/dev/server/frontend/src/components/agent/AgentMessage.tsx index d6bd831..23b4e93 100644 --- a/src/uipath/dev/server/frontend/src/components/agent/AgentMessage.tsx +++ b/src/uipath/dev/server/frontend/src/components/agent/AgentMessage.tsx @@ -5,6 +5,7 @@ import remarkGfm from "remark-gfm"; import type { AgentMessage as AgentMessageType, AgentToolCall } from "../../types/agent"; import { useAgentStore } from "../../store/useAgentStore"; import { getWs } from "../../store/useWebSocket"; +import { getAgentSessionDiagnostics } from "../../api/agent-client"; interface Props { message: AgentMessageType; @@ -80,12 +81,7 @@ function PlanCard({ message }: Props) { ); } -function SingleToolCall({ tc }: { tc: AgentToolCall }) { - const isPending = tc.status === "pending"; - const isDenied = tc.status === "denied"; - const [expanded, setExpanded] = useState(false); - const hasResult = tc.result !== undefined; - +function ToolApprovalCard({ tc }: { tc: AgentToolCall }) { const handleApproval = (approved: boolean) => { if (!tc.tool_call_id) return; const sessionId = useAgentStore.getState().sessionId; @@ -94,128 +90,150 @@ function SingleToolCall({ tc }: { tc: AgentToolCall }) { getWs().sendToolApproval(sessionId, tc.tool_call_id, approved); }; - /* ── Pending: card layout matching ChatInterrupt ── */ - if (isPending) { - return ( + return ( +
-
+ Action Required + + - - Action Required - - - {tc.tool} - -
+ {tc.tool} + +
- {tc.args != null && ( -
-            {JSON.stringify(tc.args, null, 2)}
-          
- )} + {tc.args != null && ( +
+          {JSON.stringify(tc.args, null, 2)}
+        
+ )} -
+ - -
+ Approve + +
- ); - } +
+ ); +} + +function ToolChip({ tc, active, onClick }: { tc: AgentToolCall; active: boolean; onClick: () => void }) { + const isDenied = tc.status === "denied"; + const hasResult = tc.result !== undefined; - /* ── Resolved / completed: compact inline style ── */ const statusColor = isDenied ? "var(--error)" : hasResult - ? tc.is_error - ? "var(--error)" - : "var(--success)" + ? tc.is_error ? "var(--error)" : "var(--success)" : "var(--text-muted)"; const statusIcon = isDenied ? "\u2717" : hasResult ? (tc.is_error ? "\u2717" : "\u2713") : "\u2022"; return ( -
-
- + + ); +} + +function ToolDetailPanel({ tc }: { tc: AgentToolCall }) { + const hasResult = tc.result !== undefined; + const hasArgs = tc.args != null && Object.keys(tc.args).length > 0; + + return ( +
+ {/* Header */} +
+ + {tc.tool} + + {tc.is_error && ( + + Error + + )}
- {expanded && ( -
-
-
Arguments
-
+
+      {/* Args + Result side by side (or stacked) */}
+      
+ {hasArgs && ( +
+
+ Input +
+
               {JSON.stringify(tc.args, null, 2)}
             
- {hasResult && ( -
-
- {tc.is_error ? "Error" : "Result"} -
-
-                {tc.result}
-              
+ )} + {hasResult && ( +
+
+ + Output +
- )} -
- )} +
+              {tc.result}
+            
+
+ )} +
); } @@ -225,11 +243,23 @@ const VISIBLE_TOOL_CALLS = 3; function ToolCard({ message }: Props) { const calls = message.toolCalls ?? (message.toolCall ? [message.toolCall] : []); const [showAll, setShowAll] = useState(false); + const [expandedIdx, setExpandedIdx] = useState(null); if (calls.length === 0) return null; + // Check if any call is pending approval — show approval card instead + const pendingCall = calls.find((tc) => tc.status === "pending"); + if (pendingCall) { + return ( +
+ +
+ ); + } + const hiddenCount = calls.length - VISIBLE_TOOL_CALLS; const shouldCollapse = hiddenCount > 0 && !showAll; const visibleCalls = shouldCollapse ? calls.slice(-VISIBLE_TOOL_CALLS) : calls; + const indexOffset = shouldCollapse ? hiddenCount : 0; return (
@@ -239,31 +269,115 @@ function ToolCard({ message }: Props) { {calls.length === 1 ? "Tool" : `Tools (${calls.length})`}
-
- {shouldCollapse && ( - +
+ {/* Chip row */} +
+ {shouldCollapse && ( + + )} + {visibleCalls.map((tc, i) => { + const realIdx = i + indexOffset; + return ( + setExpandedIdx(expandedIdx === realIdx ? null : realIdx)} + /> + ); + })} +
+ {/* Detail panel below chips */} + {expandedIdx !== null && calls[expandedIdx] && ( + )} - {visibleCalls.map((tc, i) => ( - - ))}
); } +function formatDiagnostics(d: Record): string { + const total = (d.total_prompt_tokens as number) + (d.total_completion_tokens as number); + let text = `## Agent Diagnostics +- Model: ${d.model} +- Turns: ${d.turn_count}/50 (max reached) +- Tokens: ${d.total_prompt_tokens} prompt + ${d.total_completion_tokens} completion = ${total} total +- Compactions: ${d.compaction_count}`; + + const tools = d.tool_summary as Array<{ tool: string; calls: number; errors?: number }>; + if (tools && tools.length > 0) { + text += "\n\n## Tool Usage"; + for (const t of tools) { + text += `\n- ${t.tool}: ${t.calls} call${t.calls !== 1 ? "s" : ""}`; + if (t.errors) text += ` (${t.errors} error${t.errors !== 1 ? "s" : ""})`; + } + } + + const tasks = d.tasks as Array<{ title: string; status: string }>; + if (tasks && tasks.length > 0) { + text += "\n\n## Tasks"; + for (const t of tasks) { + text += `\n- [${t.status}] ${t.title}`; + } + } + + const msgs = d.last_messages as Array<{ role: string; tool?: string; content?: string }>; + if (msgs && msgs.length > 0) { + text += "\n\n## Last Messages"; + msgs.forEach((m, i) => { + const label = m.tool ? `${m.role}:${m.tool}` : m.role; + const content = m.content ? m.content.replace(/\n/g, " ") : ""; + text += `\n${i + 1}. [${label}] ${content}`; + }); + } + + return text; +} + +function CopyDiagnosticsButton() { + const [state, setState] = useState<"idle" | "loading" | "copied">("idle"); + + const handleClick = async () => { + const sessionId = useAgentStore.getState().sessionId; + if (!sessionId) return; + setState("loading"); + try { + const data = await getAgentSessionDiagnostics(sessionId); + const text = formatDiagnostics(data); + await navigator.clipboard.writeText(text); + setState("copied"); + setTimeout(() => setState("idle"), 2000); + } catch { + setState("idle"); + } + }; + + return ( + + ); +} + export default function AgentMessageComponent({ message }: Props) { if (message.role === "thinking") return ; if (message.role === "plan") return ; @@ -294,6 +408,9 @@ export default function AgentMessageComponent({ message }: Props) { style={{ color: "var(--text-secondary)" }} > {message.content} + {message.content.includes("Reached maximum iterations") && ( + + )}
) )} diff --git a/src/uipath/dev/server/frontend/src/components/agent/QuestionCard.tsx b/src/uipath/dev/server/frontend/src/components/agent/QuestionCard.tsx new file mode 100644 index 0000000..9e1bbb9 --- /dev/null +++ b/src/uipath/dev/server/frontend/src/components/agent/QuestionCard.tsx @@ -0,0 +1,104 @@ +import { useState } from "react"; +import { useAgentStore } from "../../store/useAgentStore"; +import { getWs } from "../../store/useWebSocket"; + +export default function QuestionCard() { + const activeQuestion = useAgentStore((s) => s.activeQuestion); + const sessionId = useAgentStore((s) => s.sessionId); + const setActiveQuestion = useAgentStore((s) => s.setActiveQuestion); + const [customInput, setCustomInput] = useState(""); + + if (!activeQuestion) return null; + + const handleAnswer = (answer: string) => { + if (!sessionId) return; + getWs().sendQuestionResponse(sessionId, activeQuestion.question_id, answer); + setActiveQuestion(null); + setCustomInput(""); + }; + + const hasOptions = activeQuestion.options.length > 0; + + return ( +
+
+ + Question + +
+
+

+ {activeQuestion.question} +

+ {hasOptions && ( +
+ {activeQuestion.options.map((opt, i) => ( + + ))} +
+ )} +
+ setCustomInput(e.target.value)} + onKeyDown={(e) => { + if (e.key === "Enter" && customInput.trim()) { + handleAnswer(customInput.trim()); + } + }} + placeholder={hasOptions ? "Or type a custom answer..." : "Type your answer..."} + className="flex-1 text-sm px-2 py-1.5 rounded outline-none" + style={{ + background: "var(--bg-primary)", + border: "1px solid var(--border)", + color: "var(--text-primary)", + }} + /> + +
+
+
+ ); +} diff --git a/src/uipath/dev/server/frontend/src/store/useAgentStore.ts b/src/uipath/dev/server/frontend/src/store/useAgentStore.ts index e32d896..7de9922 100644 --- a/src/uipath/dev/server/frontend/src/store/useAgentStore.ts +++ b/src/uipath/dev/server/frontend/src/store/useAgentStore.ts @@ -1,5 +1,5 @@ import { create } from "zustand"; -import type { AgentMessage, AgentPlanItem, AgentStatus, AgentModel, AgentSkill, AgentToolCall } from "../types/agent"; +import type { AgentMessage, AgentPlanItem, AgentQuestion, AgentSessionState, AgentStatus, AgentModel, AgentSkill, AgentToolCall } from "../types/agent"; let msgCounter = 0; function nextId() { @@ -11,6 +11,7 @@ interface AgentStore { status: AgentStatus; messages: AgentMessage[]; plan: AgentPlanItem[]; + activeQuestion: AgentQuestion | null; models: AgentModel[]; selectedModel: string | null; modelsLoading: boolean; @@ -28,6 +29,7 @@ interface AgentStore { resolveToolApproval: (toolCallId: string, approved: boolean) => void; appendThinking: (content: string) => void; addError: (message: string) => void; + setActiveQuestion: (q: AgentQuestion | null) => void; setSessionId: (id: string) => void; setModels: (models: AgentModel[]) => void; setSelectedModel: (model: string) => void; @@ -36,6 +38,7 @@ interface AgentStore { setSelectedSkillIds: (ids: string[]) => void; toggleSkill: (id: string) => void; setSkillsLoading: (loading: boolean) => void; + hydrateSession: (state: AgentSessionState) => void; clearSession: () => void; } @@ -44,6 +47,7 @@ export const useAgentStore = create((set) => ({ status: "idle", messages: [], plan: [], + activeQuestion: null, models: [], selectedModel: null, modelsLoading: false, @@ -151,6 +155,24 @@ export const useAgentStore = create((set) => ({ addToolApprovalRequest: (toolCallId, tool, args) => set((state) => { const msgs = [...state.messages]; + // ToolStarted fires before ToolApprovalRequired, so an existing + // chip (same tool, no status, no result) may already be present. + // Upgrade it in-place instead of adding a duplicate. + for (let i = msgs.length - 1; i >= 0; i--) { + const msg = msgs[i]; + if (msg.role === "tool" && msg.toolCalls) { + const calls = [...msg.toolCalls]; + for (let j = calls.length - 1; j >= 0; j--) { + if (calls[j].tool === tool && !calls[j].status && calls[j].result === undefined) { + calls[j] = { ...calls[j], tool_call_id: toolCallId, status: "pending" }; + msgs[i] = { ...msg, toolCalls: calls }; + return { messages: msgs }; + } + } + } + if (msg.role !== "tool") break; + } + // No existing chip found — create new const newCall: AgentToolCall = { tool, args, tool_call_id: toolCallId, status: "pending" }; const last = msgs[msgs.length - 1]; if (last && last.role === "tool" && last.toolCalls) { @@ -222,7 +244,11 @@ export const useAgentStore = create((set) => ({ ], })), - setSessionId: (id) => set({ sessionId: id }), + setActiveQuestion: (q) => set({ activeQuestion: q }), + setSessionId: (id) => { + sessionStorage.setItem("agent_session_id", id); + set({ sessionId: id }); + }, setModels: (models) => set({ models }), setSelectedModel: (model) => set({ selectedModel: model }), setModelsLoading: (loading) => set({ modelsLoading: loading }), @@ -237,11 +263,23 @@ export const useAgentStore = create((set) => ({ }), setSkillsLoading: (loading) => set({ skillsLoading: loading }), - clearSession: () => + hydrateSession: (state: AgentSessionState) => + set({ + sessionId: state.session_id, + status: (state.status as AgentStatus) || "done", + messages: state.messages, + plan: state.plan, + selectedModel: state.model || null, + }), + + clearSession: () => { + sessionStorage.removeItem("agent_session_id"); set({ sessionId: null, status: "idle", messages: [], plan: [], - }), + activeQuestion: null, + }); + }, })); diff --git a/src/uipath/dev/server/frontend/src/store/useWebSocket.ts b/src/uipath/dev/server/frontend/src/store/useWebSocket.ts index ba4aea2..21d9f75 100644 --- a/src/uipath/dev/server/frontend/src/store/useWebSocket.ts +++ b/src/uipath/dev/server/frontend/src/store/useWebSocket.ts @@ -127,6 +127,10 @@ export function useWebSocket() { const agent = useAgentStore.getState(); if (!agent.sessionId) agent.setSessionId(session_id); agent.setStatus(status); + // Clear pending question when agent finishes or errors + if (status === "done" || status === "error" || status === "idle") { + agent.setActiveQuestion(null); + } break; } case "agent.text": { @@ -179,6 +183,18 @@ export function useWebSocket() { agentDelta.appendAssistantText(delta, false); break; } + case "agent.question": { + const { session_id: qSid, question_id, question, options } = msg.payload as { + session_id: string; + question_id: string; + question: string; + options: string[]; + }; + const agentQ = useAgentStore.getState(); + if (!agentQ.sessionId) agentQ.setSessionId(qSid); + agentQ.setActiveQuestion({ question_id, question, options }); + break; + } case "agent.token_usage": { // Token usage received — could store for display if needed break; diff --git a/src/uipath/dev/server/frontend/src/types/agent.ts b/src/uipath/dev/server/frontend/src/types/agent.ts index b06b39f..3d6fda9 100644 --- a/src/uipath/dev/server/frontend/src/types/agent.ts +++ b/src/uipath/dev/server/frontend/src/types/agent.ts @@ -23,7 +23,13 @@ export interface AgentMessage { done?: boolean; } -export type AgentStatus = "idle" | "thinking" | "planning" | "executing" | "awaiting_approval" | "done" | "error"; +export interface AgentQuestion { + question_id: string; + question: string; + options: string[]; +} + +export type AgentStatus = "idle" | "thinking" | "planning" | "executing" | "awaiting_approval" | "awaiting_input" | "done" | "error"; export interface AgentModel { model_name: string; @@ -35,3 +41,15 @@ export interface AgentSkill { name: string; description: string; } + +export interface AgentSessionState { + session_id: string; + status: string; + model: string; + messages: AgentMessage[]; + plan: AgentPlanItem[]; + total_prompt_tokens: number; + total_completion_tokens: number; + turn_count: number; + compaction_count: number; +} diff --git a/src/uipath/dev/server/frontend/src/types/ws.ts b/src/uipath/dev/server/frontend/src/types/ws.ts index ac08143..64f39df 100644 --- a/src/uipath/dev/server/frontend/src/types/ws.ts +++ b/src/uipath/dev/server/frontend/src/types/ws.ts @@ -19,7 +19,8 @@ export type ServerEventType = | "agent.error" | "agent.thinking" | "agent.text_delta" - | "agent.token_usage"; + | "agent.token_usage" + | "agent.question"; export interface ServerMessage { type: ServerEventType; @@ -37,7 +38,8 @@ export type ClientCommandType = | "debug.set_breakpoints" | "agent.message" | "agent.stop" - | "agent.tool_response"; + | "agent.tool_response" + | "agent.question_response"; export interface ClientMessage { type: ClientCommandType; diff --git a/src/uipath/dev/server/frontend/tsconfig.tsbuildinfo b/src/uipath/dev/server/frontend/tsconfig.tsbuildinfo index ea7be58..4889e6f 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/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/websocket.ts","./src/components/agent/agentchatsidebar.tsx","./src/components/agent/agentmessage.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 diff --git a/src/uipath/dev/server/routes/agent.py b/src/uipath/dev/server/routes/agent.py index 34e9cb1..649e09b 100644 --- a/src/uipath/dev/server/routes/agent.py +++ b/src/uipath/dev/server/routes/agent.py @@ -55,6 +55,30 @@ async def list_agent_models() -> list[dict[str, Any]]: ] +@router.get("/agent/session/{session_id}/diagnostics") +async def get_session_diagnostics(session_id: str, request: Request) -> dict[str, Any]: + """Return structured diagnostics for an agent session.""" + from uipath.dev.services.agent import AgentService + + agent_service: AgentService = request.app.state.server.agent_service + result = agent_service.get_session_diagnostics(session_id) + if result is None: + raise HTTPException(status_code=404, detail="Session not found") + return result + + +@router.get("/agent/session/{session_id}/state") +async def get_session_state(session_id: str, request: Request) -> dict[str, Any]: + """Return the full session state for hydrating the frontend after refresh.""" + from uipath.dev.services.agent import AgentService + + agent_service: AgentService = request.app.state.server.agent_service + result = agent_service.get_session_state(session_id) + if result is None: + raise HTTPException(status_code=404, detail="Session not found") + return result + + @router.get("/agent/skills") async def list_agent_skills(request: Request) -> list[dict[str, str]]: """List available built-in skills.""" diff --git a/src/uipath/dev/server/static/assets/ChatPanel-DAnMwTFj.js b/src/uipath/dev/server/static/assets/ChatPanel-C97Mws6P.js similarity index 99% rename from src/uipath/dev/server/static/assets/ChatPanel-DAnMwTFj.js rename to src/uipath/dev/server/static/assets/ChatPanel-C97Mws6P.js index 02b77bb..5ddb215 100644 --- a/src/uipath/dev/server/static/assets/ChatPanel-DAnMwTFj.js +++ b/src/uipath/dev/server/static/assets/ChatPanel-C97Mws6P.js @@ -1,2 +1,2 @@ -import{j as e,a as y}from"./vendor-react-BN_uQvcy.js";import{M,r as T,a as O,u as S}from"./index-DYl0Xnov.js";import"./vendor-reactflow-BP_V7ttx.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-BN_uQvcy.js";import{M,r as T,a as O,u as S}from"./index-Cp7BsqrO.js";import"./vendor-reactflow-BP_V7ttx.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-Cp7BsqrO.js b/src/uipath/dev/server/static/assets/index-Cp7BsqrO.js new file mode 100644 index 0000000..1e49b11 --- /dev/null +++ b/src/uipath/dev/server/static/assets/index-Cp7BsqrO.js @@ -0,0 +1,119 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-elk-CzxJ-xdZ.js","assets/vendor-react-BN_uQvcy.js","assets/ChatPanel-C97Mws6P.js","assets/vendor-reactflow-BP_V7ttx.js","assets/vendor-reactflow-B5DZHykP.css"])))=>i.map(i=>d[i]); +var Nl=Object.defineProperty;var Sl=(e,t,n)=>t in e?Nl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var It=(e,t,n)=>Sl(e,typeof t!="symbol"?t+"":t,n);import{W as Tn,a as S,j as a,F as Tl,g as Vr,b as Cl}from"./vendor-react-BN_uQvcy.js";import{H as gt,P as bt,B as Al,M as Ml,u as Il,a as Rl,R as Ol,b as Ll,C as jl,c as Dl,d as Pl}from"./vendor-reactflow-BP_V7ttx.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();const Ai=e=>{let t;const n=new Set,r=(c,d)=>{const p=typeof c=="function"?c(t):c;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))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>u,subscribe:c=>(n.add(c),()=>n.delete(c))},u=t=e(r,i,l);return l},Bl=(e=>e?Ai(e):Ai),Fl=e=>e;function zl(e,t=Fl){const n=Tn.useSyncExternalStore(e.subscribe,Tn.useCallback(()=>t(e.getState()),[e,t]),Tn.useCallback(()=>t(e.getInitialState()),[e,t]));return Tn.useDebugValue(n),n}const Mi=e=>{const t=Bl(e),n=r=>zl(t,r);return Object.assign(n,t),n},Ot=(e=>e?Mi(e):Mi),ke=Ot(e=>({runs:{},selectedRunId:null,traces:{},logs:{},chatMessages:{},entrypoints:[],setRuns:t=>e(n=>{var s;let r=n.breakpoints;for(const o of t)(s=o.breakpoints)!=null&&s.length&&!r[o.id]&&(r={...r,[o.id]:Object.fromEntries(o.breakpoints.map(l=>[l,!0]))});const i={runs:Object.fromEntries(t.map(o=>[o.id,o]))};return r!==n.breakpoints&&(i.breakpoints=r),i}),upsertRun:t=>e(n=>{var i;const r={runs:{...n.runs,[t.id]:t}};if((i=t.breakpoints)!=null&&i.length&&!n.breakpoints[t.id]&&(r.breakpoints={...n.breakpoints,[t.id]:Object.fromEntries(t.breakpoints.map(s=>[s,!0]))}),(t.status==="completed"||t.status==="failed")&&n.activeNodes[t.id]){const{[t.id]:s,...o}=n.activeNodes;r.activeNodes=o}if(t.status!=="suspended"&&n.activeInterrupt[t.id]){const{[t.id]:s,...o}=n.activeInterrupt;r.activeInterrupt=o}return r}),selectRun:t=>e({selectedRunId:t}),addTrace:t=>e(n=>{const r=n.traces[t.run_id]??[],i=r.findIndex(o=>o.span_id===t.span_id),s=i>=0?r.map((o,l)=>l===i?t:o):[...r,t];return{traces:{...n.traces,[t.run_id]:s}}}),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 i=r.chatMessages[t]??[],s=n.message;if(!s)return r;const o=s.messageId??s.message_id,l=s.role??"assistant",d=(s.contentParts??s.content_parts??[]).filter(x=>{const y=x.mimeType??x.mime_type??"";return y.startsWith("text/")||y==="application/json"}).map(x=>{const y=x.data;return(y==null?void 0:y.inline)??""}).join(` +`).trim(),p=(s.toolCalls??s.tool_calls??[]).map(x=>({name:x.name??"",has_result:!!x.result})),m={message_id:o,role:l,content:d,tool_calls:p.length>0?p:void 0},f=i.findIndex(x=>x.message_id===o);if(f>=0)return{chatMessages:{...r.chatMessages,[t]:i.map((x,y)=>y===f?m:x)}};if(l==="user"){const x=i.findIndex(y=>y.message_id.startsWith("local-")&&y.role==="user"&&y.content===d);if(x>=0)return{chatMessages:{...r.chatMessages,[t]:i.map((y,b)=>b===x?m:y)}}}const g=[...i,m];return{chatMessages:{...r.chatMessages,[t]:g}}}),addLocalChatMessage:(t,n)=>e(r=>{const i=r.chatMessages[t]??[];return{chatMessages:{...r.chatMessages,[t]:[...i,n]}}}),setChatMessages:(t,n)=>e(r=>({chatMessages:{...r.chatMessages,[t]:n}})),setEntrypoints:t=>e({entrypoints:t}),breakpoints:{},toggleBreakpoint:(t,n)=>e(r=>{const i={...r.breakpoints[t]??{}};return i[n]?delete i[n]:i[n]=!0,{breakpoints:{...r.breakpoints,[t]:i}}}),clearBreakpoints:t=>e(n=>{const{[t]:r,...i}=n.breakpoints;return{breakpoints:i}}),activeNodes:{},setActiveNode:(t,n,r)=>e(i=>{const s=i.activeNodes[t]??{executing:{},prev:null};return{activeNodes:{...i.activeNodes,[t]:{executing:{...s.executing,[n]:r??null},prev:s.prev}}}}),removeActiveNode:(t,n)=>e(r=>{const i=r.activeNodes[t];if(!i)return r;const{[n]:s,...o}=i.executing;return{activeNodes:{...r.activeNodes,[t]:{executing:o,prev:n}}}}),resetRunGraphState:t=>e(n=>({stateEvents:{...n.stateEvents,[t]:[]},activeNodes:{...n.activeNodes,[t]:{executing:{},prev:null}}})),stateEvents:{},addStateEvent:(t,n,r,i,s)=>e(o=>{const l=o.stateEvents[t]??[];return{stateEvents:{...o.stateEvents,[t]:[...l,{node_name:n,qualified_node_name:i,phase:s,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}}))})),Vn="/api";async function $l(e){const t=await fetch(`${Vn}/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 lr(){const e=await fetch(`${Vn}/auth/status`);if(!e.ok)throw new Error(`Status check failed: ${e.status}`);return e.json()}async function Ul(e){const t=await fetch(`${Vn}/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 Hl(){await fetch(`${Vn}/auth/logout`,{method:"POST"})}const bs="uipath-env",Wl=["cloud","staging","alpha"];function Kl(){const e=localStorage.getItem(bs);return Wl.includes(e)?e:"cloud"}const zn=Ot((e,t)=>({enabled:!0,status:"unauthenticated",environment:Kl(),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 lr();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(bs,n),e({environment:n})},startLogin:async()=>{const{environment:n}=t();try{const r=await $l(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 i=await lr();i.status!=="pending"&&(t().stopPolling(),e({status:i.status,tenants:i.tenants??[],uipathUrl:i.uipath_url??null}),i.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 lr()).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 Ul(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 Hl()}catch{}e({status:"unauthenticated",tenants:[],uipathUrl:null})}})),xs=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 Gl{constructor(t){It(this,"ws",null);It(this,"url");It(this,"handlers",new Set);It(this,"reconnectTimer",null);It(this,"shouldReconnect",!0);It(this,"pendingMessages",[]);It(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(i=>{try{i(r)}catch(s){console.error("[ws] handler error",s)}})},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 i;const r=JSON.stringify({type:t,payload:n});((i=this.ws)==null?void 0:i.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,i){this.send("agent.message",{text:t,model:n,session_id:r??void 0,skill_ids:i&&i.length>0?i: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 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 i=r.evalSets[t];return i?{evalSets:{...r.evalSets,[t]:{...i,evaluator_ids:n}}}:r}),incrementEvalSetCount:(t,n=1)=>e(r=>{const i=r.evalSets[t];return i?{evalSets:{...r.evalSets,[t]:{...i,eval_count:i.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(i=>{const s=i.evalRuns[t];return s?{evalRuns:{...i.evalRuns,[t]:{...s,progress_completed:n,progress_total:r,status:"running"}}}:i}),completeEvalRun:(t,n,r)=>e(i=>{const s=i.evalRuns[t];return s?{evalRuns:{...i.evalRuns,[t]:{...s,status:"completed",overall_score:n,evaluator_scores:r,end_time:new Date().toISOString()}}}:i})}));let ql=0;function $t(){return`agent-msg-${++ql}`}const $e=Ot(e=>({sessionId:null,status:"idle",messages:[],plan:[],activeQuestion:null,models:[],selectedModel:null,modelsLoading:!1,skills:[],selectedSkillIds:[],skillsLoading:!1,setStatus:t=>e({status:t}),addUserMessage:t=>e(n=>({messages:[...n.messages,{id:$t(),role:"user",content:t,timestamp:Date.now()}]})),appendAssistantText:(t,n)=>e(r=>{const i=[...r.messages],s=i[i.length-1];return s&&s.role==="assistant"&&!s.done?i[i.length-1]={...s,content:s.content+t,done:n}:i.push({id:$t(),role:"assistant",content:t,timestamp:Date.now(),done:n}),{messages:i}}),setPlan:t=>e(n=>{const r=[...n.messages],i=r.findIndex(o=>o.role==="plan"),s={id:i>=0?r[i].id:$t(),role:"plan",content:"",timestamp:Date.now(),planItems:t};return i>=0?r[i]=s:r.push(s),{messages:r,plan:t}}),addToolUse:(t,n)=>e(r=>{const i=[...r.messages],s=i[i.length-1],o={tool:t,args:n};return s&&s.role==="tool"&&s.toolCalls?i[i.length-1]={...s,toolCalls:[...s.toolCalls,o]}:i.push({id:$t(),role:"tool",content:"",timestamp:Date.now(),toolCalls:[o]}),{messages:i}}),addToolResult:(t,n,r)=>e(i=>{const s=[...i.messages];for(let o=s.length-1;o>=0;o--){const l=s[o];if(l.role==="tool"&&l.toolCalls){const u=[...l.toolCalls];for(let c=u.length-1;c>=0;c--)if(u[c].tool===t&&u[c].result===void 0)return u[c]={...u[c],result:n,is_error:r},s[o]={...l,toolCalls:u},{messages:s}}}return{messages:s}}),addToolApprovalRequest:(t,n,r)=>e(i=>{const s=[...i.messages];for(let u=s.length-1;u>=0;u--){const c=s[u];if(c.role==="tool"&&c.toolCalls){const d=[...c.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"},s[u]={...c,toolCalls:d},{messages:s}}if(c.role!=="tool")break}const o={tool:n,args:r,tool_call_id:t,status:"pending"},l=s[s.length-1];return l&&l.role==="tool"&&l.toolCalls?s[s.length-1]={...l,toolCalls:[...l.toolCalls,o]}:s.push({id:$t(),role:"tool",content:"",timestamp:Date.now(),toolCalls:[o]}),{messages:s}}),resolveToolApproval:(t,n)=>e(r=>{const i=[...r.messages];for(let s=i.length-1;s>=0;s--){const o=i[s];if(o.role==="tool"&&o.toolCalls){const l=[...o.toolCalls];for(let u=l.length-1;u>=0;u--)if(l[u].tool_call_id===t)return l[u]={...l[u],status:n?"approved":"denied"},i[s]={...o,toolCalls:l},{messages:i}}}return{messages:i}}),appendThinking:t=>e(n=>{const r=[...n.messages],i=r[r.length-1];return i&&i.role==="thinking"?r[r.length-1]={...i,content:i.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(i=>i!==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",messages:[],plan:[],activeQuestion:null})}})),Me=Ot(e=>({children:{},expanded:{},selectedFile:null,openTabs:[],fileCache:{},dirty:{},buffers:{},loadingDirs:{},loadingFile:!1,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(c=>c!==t);let i=n.selectedFile;if(i===t){const c=n.openTabs.indexOf(t);i=r[Math.min(c,r.length-1)]??null}const{[t]:s,...o}=n.dirty,{[t]:l,...u}=n.buffers;return{openTabs:r,selectedFile:i,dirty:o,buffers:u}}),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,...i}=n.dirty,{[t]:s,...o}=n.buffers;return{dirty:i,buffers:o}}),setLoadingDir:(t,n)=>e(r=>({loadingDirs:{...r.loadingDirs,[t]:n}})),setLoadingFile:t=>e({loadingFile:t})})),Yr="/api";async function Xr(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 i=new Error(`HTTP ${n.status}`);throw i.detail=r,i.status=n.status,i}return n.json()}async function Zr(e){return Xr(`${Yr}/files/tree?path=${encodeURIComponent(e)}`)}async function ys(e){return Xr(`${Yr}/files/content?path=${encodeURIComponent(e)}`)}async function Vl(e,t){await Xr(`${Yr}/files/content?path=${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t})})}let Cn=null;function Yn(){return Cn||(Cn=new Gl,Cn.connect()),Cn}function Yl(){const e=S.useRef(Yn()),{upsertRun:t,addTrace:n,addLog:r,addChatEvent:i,setActiveInterrupt:s,setActiveNode:o,removeActiveNode:l,resetRunGraphState:u,addStateEvent:c,setReloadPending:d}=ke(),{upsertEvalRun:p,updateEvalRunProgress:m,completeEvalRun:f}=Ae();return S.useEffect(()=>e.current.onMessage(y=>{switch(y.type){case"run.updated":t(y.payload);break;case"trace":n(y.payload);break;case"log":r(y.payload);break;case"chat":{const b=y.payload.run_id;i(b,y.payload);break}case"chat.interrupt":{const b=y.payload.run_id;s(b,y.payload);break}case"state":{const b=y.payload.run_id,k=y.payload.node_name,C=y.payload.qualified_node_name??null,j=y.payload.phase??null,L=y.payload.payload;k==="__start__"&&j==="started"&&u(b),j==="started"?o(b,k,C):j==="completed"&&l(b,k),c(b,k,L,C,j);break}case"reload":d(!0);break;case"files.changed":{const b=y.payload.files,k=new Set(b),C=Me.getState();for(const L of C.openTabs)C.dirty[L]||!k.has(L)||ys(L).then(T=>{var O;const B=Me.getState();B.dirty[L]||((O=B.fileCache[L])==null?void 0:O.content)!==T.content&&B.setFileContent(L,T)}).catch(()=>{});const j=new Set;for(const L of b){const T=L.lastIndexOf("/"),B=T===-1?"":L.substring(0,T);B in C.children&&j.add(B)}for(const L of j)Zr(L).then(T=>Me.getState().setChildren(L,T)).catch(()=>{});break}case"eval_run.created":p(y.payload);break;case"eval_run.progress":{const{run_id:b,completed:k,total:C,item_result:j}=y.payload;m(b,k,C,j);break}case"eval_run.completed":{const{run_id:b,overall_score:k,evaluator_scores:C}=y.payload;f(b,k,C);break}case"agent.status":{const{session_id:b,status:k}=y.payload,C=$e.getState();C.sessionId||C.setSessionId(b),C.setStatus(k),(k==="done"||k==="error"||k==="idle")&&C.setActiveQuestion(null);break}case"agent.text":{const{session_id:b,content:k,done:C}=y.payload,j=$e.getState();j.sessionId||j.setSessionId(b),j.appendAssistantText(k,C);break}case"agent.plan":{const{session_id:b,items:k}=y.payload,C=$e.getState();C.sessionId||C.setSessionId(b),C.setPlan(k);break}case"agent.tool_use":{const{session_id:b,tool:k,args:C}=y.payload,j=$e.getState();j.sessionId||j.setSessionId(b),j.addToolUse(k,C);break}case"agent.tool_result":{const{tool:b,result:k,is_error:C}=y.payload;$e.getState().addToolResult(b,k,C);break}case"agent.tool_approval":{const{session_id:b,tool_call_id:k,tool:C,args:j}=y.payload,L=$e.getState();L.sessionId||L.setSessionId(b),L.addToolApprovalRequest(k,C,j);break}case"agent.thinking":{const{content:b}=y.payload;$e.getState().appendThinking(b);break}case"agent.text_delta":{const{session_id:b,delta:k}=y.payload,C=$e.getState();C.sessionId||C.setSessionId(b),C.appendAssistantText(k,!1);break}case"agent.question":{const{session_id:b,question_id:k,question:C,options:j}=y.payload,L=$e.getState();L.sessionId||L.setSessionId(b),L.setActiveQuestion({question_id:k,question:C,options:j});break}case"agent.token_usage":break;case"agent.error":{const{message:b}=y.payload;$e.getState().addError(b);break}}}),[t,n,r,i,s,o,l,u,c,d,p,m,f]),e.current}const Lt="/api";async function jt(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 i=new Error(`HTTP ${n.status}`);throw i.detail=r,i.status=n.status,i}return n.json()}async function vs(){return jt(`${Lt}/entrypoints`)}async function Xl(e){return jt(`${Lt}/entrypoints/${encodeURIComponent(e)}/schema`)}async function Zl(e){return jt(`${Lt}/entrypoints/${encodeURIComponent(e)}/mock-input`)}async function Jl(e){return jt(`${Lt}/entrypoints/${encodeURIComponent(e)}/graph`)}async function Ii(e,t,n="run",r=[]){return jt(`${Lt}/runs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entrypoint:e,input_data:t,mode:n,breakpoints:r})})}async function Ql(){return jt(`${Lt}/runs`)}async function cr(e){return jt(`${Lt}/runs/${e}`)}async function ec(){return jt(`${Lt}/reload`,{method:"POST"})}function tc(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};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 i=t.match(/^(?:debug\/)?runs\/([^/]+)(?:\/(traces|output))?$/);if(i)return{...n,view:"details",runId:i[1],tab:i[2]??"traces"};if(t==="evals/new")return{...n,section:"evals",evalCreating:!0};const s=t.match(/^evals\/runs\/([^/]+?)(?:\/([^/]+))?$/);if(s)return{...n,section:"evals",evalRunId:s[1],evalRunItemName:s[2]?decodeURIComponent(s[2]):null};const o=t.match(/^evals\/sets\/([^/]+)$/);if(o)return{...n,section:"evals",evalSetId:o[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 u=t.match(/^evaluators\/category\/(deterministic|llm|tool)$/);if(u)return{...n,section:"evaluators",evaluatorFilter:u[1]};const c=t.match(/^evaluators\/([^/]+)$/);if(c)return{...n,section:"evaluators",evaluatorId:c[1]};if(t==="evaluators")return{...n,section:"evaluators"};const d=t.match(/^explorer\/file\/(.+)$/);return d?{...n,section:"explorer",explorerFile:decodeURIComponent(d[1])}:t==="explorer"?{...n,section:"explorer"}:n}function nc(){return window.location.hash}function rc(e){return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)}function st(){const e=S.useSyncExternalStore(rc,nc),t=tc(e),n=S.useCallback(r=>{window.location.hash=r},[]);return{...t,navigate:n}}const Ri="(max-width: 767px)";function ic(){const[e,t]=S.useState(()=>window.matchMedia(Ri).matches);return S.useEffect(()=>{const n=window.matchMedia(Ri),r=i=>t(i.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const oc=[{section:"debug",label:"Developer Console",icon:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"8",y:"6",width:"8",height:"14",rx:"4"}),a.jsx("path",{d:"M6 10H4"}),a.jsx("path",{d:"M6 18H4"}),a.jsx("path",{d:"M18 10h2"}),a.jsx("path",{d:"M18 18h2"}),a.jsx("path",{d:"M8 14h8"}),a.jsx("path",{d:"M9 6l-1.5-2"}),a.jsx("path",{d:"M15 6l1.5-2"}),a.jsx("path",{d:"M6 14H4"}),a.jsx("path",{d:"M18 14h2"})]})},{section:"evals",label:"Evals",icon:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M9 3h6"}),a.jsx("path",{d:"M10 3v6.5L5 20a1 1 0 0 0 .9 1.4h12.2a1 1 0 0 0 .9-1.4L14 9.5V3"}),a.jsx("path",{d:"M8.5 14h7"})]})},{section:"evaluators",label:"Evaluators",icon:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2l7 4v5c0 5.25-3.5 9.74-7 11-3.5-1.26-7-5.75-7-11V6l7-4z"}),a.jsx("path",{d:"M9 12l2 2 4-4"})]})},{section:"explorer",label:"Explorer",icon:a.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:a.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 sc({section:e,onSectionChange:t}){return a.jsx("div",{className:"w-12 flex flex-col items-center shrink-0 border-r",style:{background:"var(--activity-bar-bg)",borderColor:"var(--border)"},children:a.jsx("div",{className:"flex flex-col items-center gap-1 pt-2",children:oc.map(n=>{const r=e===n.section;return a.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:i=>{r||(i.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:i=>{r||(i.currentTarget.style.color="var(--text-muted)")},children:[r&&a.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 i=new Error(`HTTP ${n.status}`);throw i.detail=r,i.status=n.status,i}return n.json()}async function ac(){return nt(`${tt}/evaluators`)}async function ks(){return nt(`${tt}/eval-sets`)}async function lc(e){return nt(`${tt}/eval-sets`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function cc(e,t){return nt(`${tt}/eval-sets/${encodeURIComponent(e)}/items`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function uc(e,t){await nt(`${tt}/eval-sets/${encodeURIComponent(e)}/items/${encodeURIComponent(t)}`,{method:"DELETE"})}async function dc(e){return nt(`${tt}/eval-sets/${encodeURIComponent(e)}`)}async function pc(e){return nt(`${tt}/eval-sets/${encodeURIComponent(e)}/runs`,{method:"POST"})}async function fc(){return nt(`${tt}/eval-runs`)}async function Oi(e){return nt(`${tt}/eval-runs/${encodeURIComponent(e)}`)}async function Jr(){return nt(`${tt}/local-evaluators`)}async function mc(e){return nt(`${tt}/local-evaluators`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function hc(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 gc(e,t){return nt(`${tt}/local-evaluators/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}const bc={"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 xc(e,t){if(!e)return{};const n=bc[e.evaluator_type_id];return n?n(t):e.type==="tool"?{}:e.evaluator_type_id.includes("trajectory")?{expectedAgentBehavior:""}:{expectedOutput:t}}function Es(e){return e?e.type==="tool"?!0:e.evaluator_type_id.includes("tool-call"):!1}function yc(e){return e?Es(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 vc({run:e,onClose:t}){const n=Ae(w=>w.evalSets),r=Ae(w=>w.setEvalSets),i=Ae(w=>w.incrementEvalSetCount),s=Ae(w=>w.localEvaluators),o=Ae(w=>w.setLocalEvaluators),[l,u]=S.useState(`run-${e.id.slice(0,8)}`),[c,d]=S.useState(new Set),[p,m]=S.useState({}),f=S.useRef(new Set),[g,x]=S.useState(!1),[y,b]=S.useState(null),[k,C]=S.useState(!1),j=Object.values(n),L=S.useMemo(()=>Object.fromEntries(s.map(w=>[w.id,w])),[s]),T=S.useMemo(()=>{const w=new Set;for(const _ of c){const M=n[_];M&&M.evaluator_ids.forEach(R=>w.add(R))}return[...w]},[c,n]);S.useEffect(()=>{const w=e.output_data,_=f.current;m(M=>{const R={};for(const D of T)if(_.has(D)&&M[D]!==void 0)R[D]=M[D];else{const N=L[D],E=xc(N,w);R[D]=JSON.stringify(E,null,2)}return R})},[T,L,e.output_data]),S.useEffect(()=>{const w=_=>{_.key==="Escape"&&t()};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[t]),S.useEffect(()=>{j.length===0&&ks().then(r).catch(()=>{}),s.length===0&&Jr().then(o).catch(()=>{})},[]);const B=w=>{d(_=>{const M=new Set(_);return M.has(w)?M.delete(w):M.add(w),M})},O=async()=>{var _;if(!l.trim()||c.size===0)return;b(null),x(!0);const w={};for(const M of T){const R=p[M];if(R!==void 0)try{w[M]=JSON.parse(R)}catch{b(`Invalid JSON for evaluator "${((_=L[M])==null?void 0:_.name)??M}"`),x(!1);return}}try{for(const M of c){const R=n[M],D=new Set((R==null?void 0:R.evaluator_ids)??[]),N={};for(const[E,I]of Object.entries(w))D.has(E)&&(N[E]=I);await cc(M,{name:l.trim(),inputs:e.input_data,expected_output:null,evaluation_criterias:N}),i(M)}C(!0),setTimeout(t,3e3)}catch(M){b(M.detail||M.message||"Failed to add item")}finally{x(!1)}};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.5)"},onClick:w=>{w.target===w.currentTarget&&t()},children:a.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:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:"var(--accent)"}}),a.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--text-muted)"},children:"Add to Eval Set"})]}),a.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:w=>{w.currentTarget.style.color="var(--text-primary)"},onMouseLeave:w=>{w.currentTarget.style.color="var(--text-muted)"},"aria-label":"Close",children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 space-y-4 pr-1",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Item Name"}),a.jsx("input",{type:"text",value:l,onChange:w=>u(w.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)"}})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Inputs"}),a.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)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Eval Sets"}),j.length===0?a.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:"No eval sets found. Create one first."}):a.jsx("div",{className:"rounded-md border overflow-hidden max-h-40 overflow-y-auto",style:{borderColor:"var(--border)",background:"var(--bg-secondary)"},children:j.map(w=>a.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:_=>{_.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:_=>{_.currentTarget.style.background="transparent"},children:[a.jsx("input",{type:"checkbox",checked:c.has(w.id),onChange:()=>B(w.id),className:"accent-[var(--accent)]"}),a.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:w.name}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-muted)"},children:[w.eval_count," items"]})]},w.id))})]}),T.length>0&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Evaluation Criteria"}),a.jsx("div",{className:"space-y-2",children:T.map(w=>{const _=L[w],M=Es(_),R=yc(_);return a.jsxs("div",{className:"rounded-md",style:{border:"1px solid var(--border)",background:"var(--bg-primary)",opacity:M?.6:1},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{borderBottom:M?"none":"1px solid var(--border)"},children:[a.jsx("span",{className:"text-xs font-medium truncate flex-1",style:{color:"var(--text-primary)"},children:(_==null?void 0:_.name)??w}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium",style:{color:R.color,background:`color-mix(in srgb, ${R.color} 12%, transparent)`},children:R.label})]}),M?a.jsx("div",{className:"px-3 pb-2",children:a.jsx("span",{className:"text-[10px] italic",style:{color:"var(--text-muted)"},children:"Default criteria — uses evaluator config"})}):a.jsx("div",{className:"px-3 pb-2 pt-1",children:a.jsx("textarea",{value:p[w]??"{}",onChange:D=>{f.current.add(w),m(N=>({...N,[w]:D.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)"}})})]},w)})})]})]}),a.jsxs("div",{className:"mt-4 space-y-3",children:[y&&a.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:y}),k&&a.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 ",c.size," eval set",c.size!==1?"s":"","."]}),a.jsxs("div",{className:"flex gap-2",children:[a.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"}),a.jsx("button",{onClick:O,disabled:!l.trim()||c.size===0||g||k,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:g?"Adding...":k?"Added":"Add Item"})]})]})]})})}const kc={pending:"var(--text-muted)",running:"var(--warning)",suspended:"var(--info)",completed:"var(--success)",failed:"var(--error)"};function Ec({run:e,isSelected:t,onClick:n}){var p;const r=kc[e.status]??"var(--text-muted)",i=((p=e.entrypoint.split("/").pop())==null?void 0:p.slice(0,16))??e.entrypoint,s=e.start_time?new Date(e.start_time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"",[o,l]=S.useState(!1),[u,c]=S.useState(!1),d=S.useRef(null);return S.useEffect(()=>{if(!o)return;const m=f=>{d.current&&!d.current.contains(f.target)&&l(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]),a.jsxs(a.Fragment,{children:[a.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:[a.jsx("span",{className:"shrink-0 w-2 h-2 rounded-full",style:{background:r}}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-xs truncate",style:{color:t?"var(--text-primary)":"var(--text-secondary)"},children:i}),a.jsxs("div",{className:"text-[11px] tabular-nums",style:{color:"var(--text-muted)"},children:[s,e.duration?` · ${e.duration}`:""]})]}),e.status==="completed"&&a.jsxs("div",{ref:d,className:"relative shrink-0",children:[a.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:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",children:[a.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),a.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),a.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}),o&&a.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:a.jsx("button",{onClick:m=>{m.stopPropagation(),l(!1),c(!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"})})]})]}),u&&a.jsx(vc,{run:e,onClose:()=>c(!1)})]})}function Li({runs:e,selectedRunId:t,onSelectRun:n,onNewRun:r}){const i=[...e].sort((s,o)=>new Date(o.start_time??0).getTime()-new Date(s.start_time??0).getTime());return a.jsxs(a.Fragment,{children:[a.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:s=>{s.currentTarget.style.color="var(--text-primary)",s.currentTarget.style.borderColor="var(--text-muted)"},onMouseLeave:s=>{s.currentTarget.style.color="var(--text-secondary)",s.currentTarget.style.borderColor=""},children:"+ New Run"}),a.jsx("div",{className:"px-3 pt-3 pb-1 text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"History"}),a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[i.map(s=>a.jsx(Ec,{run:s,isSelected:s.id===t,onClick:()=>n(s.id)},s.id)),i.length===0&&a.jsx("p",{className:"text-xs px-3 py-4 text-center",style:{color:"var(--text-muted)"},children:"No runs yet"})]})]})}function ws(){const e=localStorage.getItem("uipath-dev-theme");return e==="light"||e==="dark"?e:"dark"}function _s(e){document.documentElement.setAttribute("data-theme",e),localStorage.setItem("uipath-dev-theme",e)}_s(ws());const Ns=Ot(e=>({theme:ws(),toggleTheme:()=>e(t=>{const n=t.theme==="dark"?"light":"dark";return _s(n),{theme:n}})}));function ji(){const{theme:e,toggleTheme:t}=Ns(),{enabled:n,status:r,environment:i,tenants:s,uipathUrl:o,setEnvironment:l,startLogin:u,selectTenant:c,logout:d}=zn(),{projectName:p,projectVersion:m,projectAuthors:f}=xs(),[g,x]=S.useState(!1),[y,b]=S.useState(""),k=S.useRef(null),C=S.useRef(null);S.useEffect(()=>{if(!g)return;const N=E=>{k.current&&!k.current.contains(E.target)&&C.current&&!C.current.contains(E.target)&&x(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[g]);const j=r==="authenticated",L=r==="expired",T=r==="pending",B=r==="needs_tenant";let O="UiPath: Disconnected",w=null,_=!0;j?(O=`UiPath: ${o?o.replace(/^https?:\/\/[^/]+\//,""):""}`,w="var(--success)",_=!1):L?(O=`UiPath: ${o?o.replace(/^https?:\/\/[^/]+\//,""):""} (expired)`,w="var(--error)",_=!1):T?O="UiPath: Signing in…":B&&(O="UiPath: Select Tenant");const M=()=>{T||(L?u():x(N=>!N))},R="flex items-center gap-1 px-1.5 rounded transition-colors",D={onMouseEnter:N=>{N.currentTarget.style.background="var(--bg-hover)",N.currentTarget.style.color="var(--text-primary)"},onMouseLeave:N=>{N.currentTarget.style.background="",N.currentTarget.style.color="var(--text-muted)"}};return a.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&&a.jsxs("div",{className:"relative flex items-center",children:[a.jsxs("div",{ref:C,className:`${R} cursor-pointer`,onClick:M,...D,title:j?o??"":L?"Token expired — click to re-authenticate":T?"Signing in…":B?"Select a tenant":"Click to sign in",children:[T?a.jsxs("svg",{className:"animate-spin",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10",strokeOpacity:"0.25"}),a.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",strokeLinecap:"round"})]}):w?a.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:w}}):_?a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 9.9-1"})]}):null,a.jsx("span",{className:"truncate max-w-[200px]",children:O})]}),g&&a.jsx("div",{ref:k,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:j||L?a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>{o&&window.open(o,"_blank","noopener,noreferrer"),x(!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:N=>{N.currentTarget.style.background="var(--bg-hover)",N.currentTarget.style.color="var(--text-primary)"},onMouseLeave:N=>{N.currentTarget.style.background="transparent",N.currentTarget.style.color="var(--text-muted)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),a.jsx("polyline",{points:"15 3 21 3 21 9"}),a.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),"Go to Platform"]}),a.jsxs("button",{onClick:()=>{d(),x(!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:N=>{N.currentTarget.style.background="var(--bg-hover)",N.currentTarget.style.color="var(--text-primary)"},onMouseLeave:N=>{N.currentTarget.style.background="transparent",N.currentTarget.style.color="var(--text-muted)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),a.jsx("polyline",{points:"16 17 21 12 16 7"}),a.jsx("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]}),"Sign Out"]})]}):B?a.jsxs("div",{className:"p-1",children:[a.jsx("label",{className:"block text-[10px] font-medium mb-1",style:{color:"var(--text-muted)"},children:"Tenant"}),a.jsxs("select",{value:y,onChange:N=>b(N.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:[a.jsx("option",{value:"",children:"Select…"}),s.map(N=>a.jsx("option",{value:N,children:N},N))]}),a.jsx("button",{onClick:()=>{y&&(c(y),x(!1))},disabled:!y,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"})]}):a.jsxs("div",{className:"p-1",children:[a.jsx("label",{className:"block text-[10px] font-medium mb-1",style:{color:"var(--text-muted)"},children:"Environment"}),a.jsxs("select",{value:i,onChange:N=>l(N.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:[a.jsx("option",{value:"cloud",children:"cloud"}),a.jsx("option",{value:"staging",children:"staging"}),a.jsx("option",{value:"alpha",children:"alpha"})]}),a.jsx("button",{onClick:()=>{u(),x(!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:N=>{N.currentTarget.style.color="var(--text-primary)",N.currentTarget.style.borderColor="var(--text-muted)"},onMouseLeave:N=>{N.currentTarget.style.color="var(--text-muted)",N.currentTarget.style.borderColor="var(--border)"},children:"Sign In"})]})})]}),p&&a.jsxs("span",{className:R,children:["Project: ",p]}),m&&a.jsxs("span",{className:R,children:["Version: v",m]}),f&&a.jsxs("span",{className:R,children:["Author: ",f]}),a.jsxs("a",{href:"https://github.com/UiPath/uipath-dev-python",target:"_blank",rel:"noopener noreferrer",className:`${R} cursor-pointer no-underline`,style:{color:"var(--text-muted)"},...D,title:"View on GitHub",children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:a.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"})}),a.jsx("span",{children:"uipath-dev-python"})]}),a.jsxs("div",{className:`${R} cursor-pointer`,onClick:t,...D,title:`Switch to ${e==="dark"?"light":"dark"} theme`,children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e==="dark"?a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"12",cy:"12",r:"5"}),a.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),a.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),a.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),a.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),a.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),a.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),a.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),a.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]}):a.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),a.jsx("span",{children:e==="dark"?"Dark":"Light"})]})]})}function wc(){const{navigate:e}=st(),t=ke(c=>c.entrypoints),[n,r]=S.useState(""),[i,s]=S.useState(!0),[o,l]=S.useState(null);S.useEffect(()=>{!n&&t.length>0&&r(t[0])},[t,n]),S.useEffect(()=>{n&&(s(!0),l(null),Xl(n).then(c=>{var p;const d=(p=c.input)==null?void 0:p.properties;s(!!(d!=null&&d.messages))}).catch(c=>{const d=c.detail||{};l(d.error||d.message||`Failed to load entrypoint "${n}"`)}))},[n]);const u=c=>{n&&e(`#/setup/${encodeURIComponent(n)}/${c}`)};return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"w-full max-w-xl px-6",children:[a.jsxs("div",{className:"mb-8 text-center",children:[a.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:o?"var(--error)":"var(--accent)"}}),a.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--text-muted)"},children:"New Run"})]}),!o&&a.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&&a.jsxs("div",{className:"mb-8",children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Entrypoint"}),a.jsx("select",{id:"entrypoint-select",value:n,onChange:c=>r(c.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(c=>a.jsx("option",{value:c,children:c},c))})]}),o?a.jsxs("div",{className:"rounded-md border overflow-hidden",style:{borderColor:"color-mix(in srgb, var(--error) 25%, var(--border))",background:"var(--bg-secondary)"},children:[a.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:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:a.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)"})}),a.jsx("span",{className:"text-[11px] font-medium",style:{color:"var(--error)"},children:"Failed to load entrypoint"})]}),a.jsx("div",{className:"overflow-auto max-h-48 p-3",children:a.jsx("pre",{className:"text-[11px] font-mono whitespace-pre-wrap break-words leading-relaxed m-0",style:{color:"var(--text-muted)"},children:o})})]}):a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(Di,{title:"Autonomous",description:"Run the agent end-to-end. Set breakpoints to pause and inspect execution.",icon:a.jsx(_c,{}),color:"var(--success)",onClick:()=>u("run"),disabled:!n}),a.jsx(Di,{title:"Conversational",description:i?"Interactive chat session. Send messages and receive responses in real time.":'Requires a "messages" property in the input schema.',icon:a.jsx(Nc,{}),color:"var(--accent)",onClick:()=>u("chat"),disabled:!n||!i})]})]})})}function Di({title:e,description:t,icon:n,color:r,onClick:i,disabled:s}){return a.jsxs("button",{onClick:i,disabled:s,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:o=>{s||(o.currentTarget.style.borderColor=r,o.currentTarget.style.background=`color-mix(in srgb, ${r} 5%, var(--bg-secondary))`)},onMouseLeave:o=>{o.currentTarget.style.borderColor="var(--border)",o.currentTarget.style.background="var(--bg-secondary)"},children:[a.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}),a.jsx("h3",{className:"text-sm font-semibold mb-1.5",style:{color:"var(--text-primary)"},children:e}),a.jsx("p",{className:"text-xs leading-relaxed",style:{color:"var(--text-muted)"},children:t})]})}function _c(){return a.jsx("svg",{width:"28",height:"28",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.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 Nc(){return a.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.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"}),a.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"}),a.jsx("ellipse",{cx:"12.9987",cy:"4.33268",rx:"2.16667",ry:"2.16667",fill:"currentColor"}),a.jsx("rect",{x:"11.918",y:"5.41602",width:"2.16667",height:"2.16667",fill:"currentColor"}),a.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"}),a.jsx("rect",{x:"3.25",y:"15.166",width:"2.16667",height:"1.08333",fill:"currentColor"}),a.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"}),a.jsx("rect",{x:"20.582",y:"15.166",width:"2.16667",height:"1.08333",fill:"currentColor"})]})}const Sc="modulepreload",Tc=function(e){return"/"+e},Pi={},Ss=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(c){return Promise.all(c.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]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=o(n.map(c=>{if(c=Tc(c),c in Pi)return;Pi[c]=!0;const d=c.endsWith(".css"),p=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${p}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":Sc,d||(m.as="script"),m.crossOrigin="",m.href=c,u&&m.setAttribute("nonce",u),document.head.appendChild(m),d)return new Promise((f,g)=>{m.addEventListener("load",f),m.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})},Cc={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Ac({data:e}){const t=e.status,n=e.nodeWidth,r=e.label??"Start",i=e.hasBreakpoint,s=e.isPausedHere,o=e.isActiveNode,l=e.isExecutingNode,u=s?"var(--error)":l?"var(--success)":o?"var(--accent)":t==="completed"?"var(--success)":t==="running"?"var(--warning)":"var(--node-border)",c=s?"var(--error)":l?"var(--success)":"var(--accent)";return a.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 ${u}`,boxShadow:s||o||l?`0 0 4px ${c}`:void 0,animation:s||o||l?`node-pulse-${s?"red":l?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:r,children:[i&&a.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,a.jsx(gt,{type:"source",position:bt.Bottom,style:Cc})]})}const Mc={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Ic({data:e}){const t=e.status,n=e.nodeWidth,r=e.label??"End",i=e.hasBreakpoint,s=e.isPausedHere,o=e.isActiveNode,l=e.isExecutingNode,u=s?"var(--error)":l?"var(--success)":o?"var(--accent)":t==="completed"?"var(--success)":t==="failed"?"var(--error)":"var(--node-border)",c=s?"var(--error)":l?"var(--success)":"var(--accent)";return a.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 ${u}`,boxShadow:s||o||l?`0 0 4px ${c}`:void 0,animation:s||o||l?`node-pulse-${s?"red":l?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:r,children:[i&&a.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)"}}),a.jsx(gt,{type:"target",position:bt.Top,style:Mc}),r]})}const Bi={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Rc({data:e}){const t=e.status,n=e.nodeWidth,r=e.model_name,i=e.label??"Model",s=e.hasBreakpoint,o=e.isPausedHere,l=e.isActiveNode,u=e.isExecutingNode,c=o?"var(--error)":u?"var(--success)":l?"var(--accent)":t==="completed"?"var(--success)":t==="running"?"var(--warning)":t==="failed"?"var(--error)":"var(--node-border)",d=o?"var(--error)":u?"var(--success)":"var(--accent)";return a.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:o||l||u?`0 0 4px ${d}`:void 0,animation:o||l||u?`node-pulse-${o?"red":u?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:r?`${i} +${r}`:i,children:[s&&a.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)"}}),a.jsx(gt,{type:"target",position:bt.Top,style:Bi}),a.jsx("div",{style:{color:"var(--info)",fontSize:9,marginBottom:1},children:"model"}),a.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:i}),r&&a.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",style:{color:"var(--text-muted)",fontSize:9,marginTop:1},title:r,children:r}),a.jsx(gt,{type:"source",position:bt.Bottom,style:Bi})]})}const Fi={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0},Oc=3;function Lc({data:e}){const t=e.status,n=e.nodeWidth,r=e.tool_names,i=e.tool_count,s=e.label??"Tool",o=e.hasBreakpoint,l=e.isPausedHere,u=e.isActiveNode,c=e.isExecutingNode,d=l?"var(--error)":c?"var(--success)":u?"var(--accent)":t==="completed"?"var(--success)":t==="running"?"var(--warning)":t==="failed"?"var(--error)":"var(--node-border)",p=l?"var(--error)":c?"var(--success)":"var(--accent)",m=(r==null?void 0:r.slice(0,Oc))??[],f=(i??(r==null?void 0:r.length)??0)-m.length;return a.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||u||c?`0 0 4px ${p}`:void 0,animation:l||u||c?`node-pulse-${l?"red":c?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:r!=null&&r.length?`${s} + +${r.join(` +`)}`:s,children:[o&&a.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)"}}),a.jsx(gt,{type:"target",position:bt.Top,style:Fi}),a.jsxs("div",{style:{color:"var(--warning)",fontSize:9,marginBottom:1},children:["tools",i?` (${i})`:""]}),a.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:s}),m.length>0&&a.jsxs("div",{style:{marginTop:3,fontSize:9,color:"var(--text-muted)",textAlign:"left"},children:[m.map(g=>a.jsx("div",{className:"truncate",children:g},g)),f>0&&a.jsxs("div",{style:{fontStyle:"italic"},children:["+",f," more"]})]}),a.jsx(gt,{type:"source",position:bt.Bottom,style:Fi})]})}const zi={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function jc({data:e}){const t=e.label??"",n=e.status,r=e.hasBreakpoint,i=e.isPausedHere,s=e.isActiveNode,o=e.isExecutingNode,l=i?"var(--error)":o?"var(--success)":s?"var(--accent)":n==="completed"?"var(--success)":n==="running"?"var(--warning)":n==="failed"?"var(--error)":"var(--bg-tertiary)",u=i?"var(--error)":o?"var(--success)":"var(--accent)";return a.jsxs("div",{className:"relative cursor-pointer",style:{width:"100%",height:"100%",background:"var(--bg-secondary)",border:`1.5px ${i||s||o?"solid":"dashed"} ${l}`,borderRadius:8,boxShadow:i||s||o?`0 0 4px ${u}`:void 0,animation:i||s||o?`node-pulse-${i?"red":o?"green":"accent"} 1.5s ease-in-out infinite`:void 0},children:[r&&a.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}}),a.jsx(gt,{type:"target",position:bt.Top,style:zi}),a.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}),a.jsx(gt,{type:"source",position:bt.Bottom,style:zi})]})}function Dc({data:e}){const t=e.status,n=e.nodeWidth,r=e.label??"",i=e.hasBreakpoint,s=e.isPausedHere,o=e.isActiveNode,l=e.isExecutingNode,u=s?"var(--error)":l?"var(--success)":o?"var(--accent)":t==="completed"?"var(--success)":t==="running"?"var(--warning)":t==="failed"?"var(--error)":"var(--node-border)",c=s?"var(--error)":l?"var(--success)":"var(--accent)";return a.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:s||o||l?`0 0 4px ${c}`:void 0,animation:s||o||l?`node-pulse-${s?"red":l?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:r,children:[i&&a.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)"}}),a.jsx(gt,{type:"target",position:bt.Top}),a.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:r}),a.jsx(gt,{type:"source",position:bt.Bottom})]})}function Pc(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 i=1;i0&&(n+=Math.min(r.length,3)*12+(r.length>3?12:0)+4),e!=null&&e.model_name&&(n+=14),n}let ur=null;async function Wc(){if(!ur){const{default:e}=await Ss(async()=>{const{default:t}=await import("./vendor-elk-CzxJ-xdZ.js").then(n=>n.e);return{default:t}},__vite__mapDeps([0,1]));ur=new e}return ur}const Hi={"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"},Kc="[top=35,left=15,bottom=15,right=15]";function Gc(e){const t=[],n=[];for(const r of e.nodes){const i=r.data,s={id:r.id,width:$i(i),height:Ui(i,r.type)};if(r.data.subgraph){const o=r.data.subgraph;delete s.width,delete s.height,s.layoutOptions={...Hi,"elk.padding":Kc},s.children=o.nodes.map(l=>({id:`${r.id}/${l.id}`,width:$i(l.data),height:Ui(l.data,l.type)})),s.edges=o.edges.map(l=>({id:`${r.id}/${l.id}`,sources:[`${r.id}/${l.source}`],targets:[`${r.id}/${l.target}`]}))}t.push(s)}for(const r of e.edges)n.push({id:r.id,sources:[r.source],targets:[r.target]});return{id:"root",layoutOptions:Hi,children:t,edges:n}}const Or={type:Ml.ArrowClosed,width:12,height:12,color:"var(--node-border)"};function Ts(e){return{stroke:"var(--node-border)",strokeWidth:1.5,...e?{strokeDasharray:"6 3"}:{}}}function Wi(e,t,n,r,i){var c;const s=(c=e.sections)==null?void 0:c[0],o=(i==null?void 0:i.x)??0,l=(i==null?void 0:i.y)??0;let u;if(s)u={sourcePoint:{x:s.startPoint.x+o,y:s.startPoint.y+l},targetPoint:{x:s.endPoint.x+o,y:s.endPoint.y+l},bendPoints:(s.bendPoints??[]).map(d=>({x:d.x+o,y:d.y+l}))};else{const d=t.get(e.sources[0]),p=t.get(e.targets[0]);d&&p&&(u={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:u,style:Ts(r),markerEnd:Or,...n?{label:n,labelStyle:{fill:"var(--text-muted)",fontSize:10},labelBgStyle:{fill:"var(--bg-primary)",fillOpacity:.8}}:{}}}async function qc(e){var u,c;const t=Gc(e),r=await(await Wc()).layout(t),i=new Map;for(const d of e.nodes)if(i.set(d.id,{type:d.type,data:d.data}),d.data.subgraph)for(const p of d.data.subgraph.nodes)i.set(`${d.id}/${p.id}`,{type:p.type,data:p.data});const s=[],o=[],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=i.get(d.id);if((((u=d.children)==null?void 0:u.length)??0)>0){s.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 x of d.children??[]){const y=i.get(x.id);s.push({id:x.id,type:(y==null?void 0:y.type)??"defaultNode",data:{...(y==null?void 0:y.data)??{},nodeWidth:x.width},position:{x:x.x??0,y:x.y??0},parentNode:d.id,extent:"parent"})}const f=d.x??0,g=d.y??0;for(const x of d.edges??[]){const y=e.nodes.find(k=>k.id===d.id),b=(c=y==null?void 0:y.data.subgraph)==null?void 0:c.edges.find(k=>`${d.id}/${k.id}`===x.id);o.push(Wi(x,l,b==null?void 0:b.label,b==null?void 0:b.conditional,{x:f,y:g}))}}else s.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);o.push(Wi(d,l,p==null?void 0:p.label,p==null?void 0:p.conditional))}return{nodes:s,edges:o}}function $n({entrypoint:e,runId:t,breakpointNode:n,breakpointNextNodes:r,onBreakpointChange:i}){const[s,o,l]=Il([]),[u,c,d]=Rl([]),[p,m]=S.useState(!0),[f,g]=S.useState(!1),[x,y]=S.useState(0),b=S.useRef(0),k=S.useRef(null),C=ke(N=>N.breakpoints[t]),j=ke(N=>N.toggleBreakpoint),L=ke(N=>N.clearBreakpoints),T=ke(N=>N.activeNodes[t]),B=ke(N=>{var E;return(E=N.runs[t])==null?void 0:E.status}),O=S.useCallback((N,E)=>{if(E.type==="startNode"||E.type==="endNode")return;const I=E.type==="groupNode"?E.id:E.id.includes("/")?E.id.split("/").pop():E.id;j(t,I);const G=ke.getState().breakpoints[t]??{};i==null||i(Object.keys(G))},[t,j,i]),w=C&&Object.keys(C).length>0,_=S.useCallback(()=>{if(w)L(t),i==null||i([]);else{const N=[];for(const I of s){if(I.type==="startNode"||I.type==="endNode"||I.parentNode)continue;const G=I.type==="groupNode"?I.id:I.id.includes("/")?I.id.split("/").pop():I.id;N.push(G)}for(const I of N)C!=null&&C[I]||j(t,I);const E=ke.getState().breakpoints[t]??{};i==null||i(Object.keys(E))}},[t,w,C,s,L,j,i]);S.useEffect(()=>{o(N=>N.map(E=>{var H;if(E.type==="startNode"||E.type==="endNode")return E;const I=E.type==="groupNode"?E.id:E.id.includes("/")?E.id.split("/").pop():E.id,G=!!(C&&C[I]);return G!==!!((H=E.data)!=null&&H.hasBreakpoint)?{...E,data:{...E.data,hasBreakpoint:G}}:E}))},[C,o]),S.useEffect(()=>{const N=n?new Set(n.split(",").map(E=>E.trim()).filter(Boolean)):null;o(E=>E.map(I=>{var h,F;if(I.type==="startNode"||I.type==="endNode")return I;const G=I.type==="groupNode"?I.id:I.id.includes("/")?I.id.split("/").pop():I.id,H=(h=I.data)==null?void 0:h.label,V=N!=null&&(N.has(G)||H!=null&&N.has(H));return V!==!!((F=I.data)!=null&&F.isPausedHere)?{...I,data:{...I.data,isPausedHere:V}}:I}))},[n,x,o]);const M=ke(N=>N.stateEvents[t]);S.useEffect(()=>{const N=!!n;let E=new Set;const I=new Set,G=new Set,H=new Set,V=new Map,h=new Map;if(M)for(const F of M)F.phase==="started"?h.set(F.node_name,F.qualified_node_name??null):F.phase==="completed"&&h.delete(F.node_name);o(F=>{var v;for(const ie of F)ie.type&&V.set(ie.id,ie.type);const $=ie=>{var U;const W=[];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===ie||be!=null&&be===ie)&&W.push(re.id)}return W};if(N&&n){const ie=n.split(",").map(W=>W.trim()).filter(Boolean);for(const W of ie)$(W).forEach(U=>E.add(U));if(r!=null&&r.length)for(const W of r)$(W).forEach(U=>G.add(U));T!=null&&T.prev&&$(T.prev).forEach(W=>I.add(W))}else if(h.size>0){const ie=new Map;for(const W of F){const U=(v=W.data)==null?void 0:v.label;if(!U)continue;const re=W.id.includes("/")?W.id.split("/").pop():W.id;for(const de of[re,U]){let be=ie.get(de);be||(be=new Set,ie.set(de,be)),be.add(W.id)}}for(const[W,U]of h){let re=!1;if(U){const de=U.replace(/:/g,"/");for(const be of F)be.id===de&&(E.add(be.id),re=!0)}if(!re){const de=ie.get(W);de&&de.forEach(be=>E.add(be))}}}return F}),c(F=>{const $=I.size===0||F.some(v=>E.has(v.target)&&I.has(v.source));return F.map(v=>{var W,U;let ie;return N?ie=E.has(v.target)&&(I.size===0||!$||I.has(v.source))||E.has(v.source)&&G.has(v.target):(ie=E.has(v.source),!ie&&V.get(v.target)==="endNode"&&E.has(v.target)&&(ie=!0)),ie?(N||H.add(v.target),{...v,style:{stroke:"var(--accent)",strokeWidth:2.5},markerEnd:{...Or,color:"var(--accent)"},data:{...v.data,highlighted:!0},animated:!0}):(W=v.data)!=null&&W.highlighted?{...v,style:Ts((U=v.data)==null?void 0:U.conditional),markerEnd:Or,data:{...v.data,highlighted:!1},animated:!1}:v})}),o(F=>F.map($=>{var W,U,re,de;const v=!N&&E.has($.id);if($.type==="startNode"||$.type==="endNode"){const be=H.has($.id)||!N&&E.has($.id);return be!==!!((W=$.data)!=null&&W.isActiveNode)||v!==!!((U=$.data)!=null&&U.isExecutingNode)?{...$,data:{...$.data,isActiveNode:be,isExecutingNode:v}}:$}const ie=N?G.has($.id):H.has($.id);return ie!==!!((re=$.data)!=null&&re.isActiveNode)||v!==!!((de=$.data)!=null&&de.isExecutingNode)?{...$,data:{...$.data,isActiveNode:ie,isExecutingNode:v}}:$}))},[M,T,n,r,B,x,o,c]);const R=ke(N=>N.graphCache[t]);S.useEffect(()=>{if(!R&&t!=="__setup__")return;const N=R?Promise.resolve(R):Jl(e),E=++b.current;m(!0),g(!1),N.then(async I=>{if(b.current!==E)return;if(!I.nodes.length){g(!0);return}const{nodes:G,edges:H}=await qc(I);if(b.current!==E)return;const V=ke.getState().breakpoints[t],h=V?G.map(F=>{if(F.type==="startNode"||F.type==="endNode")return F;const $=F.type==="groupNode"?F.id:F.id.includes("/")?F.id.split("/").pop():F.id;return V[$]?{...F,data:{...F.data,hasBreakpoint:!0}}:F}):G;o(h),c(H),y(F=>F+1),setTimeout(()=>{var F;(F=k.current)==null||F.fitView({padding:.1,duration:200})},100)}).catch(()=>{b.current===E&&g(!0)}).finally(()=>{b.current===E&&m(!1)})},[e,t,R,o,c]),S.useEffect(()=>{const N=setTimeout(()=>{var E;(E=k.current)==null||E.fitView({padding:.1,duration:200})},100);return()=>clearTimeout(N)},[t]);const D=S.useRef(null);return S.useEffect(()=>{const N=D.current;if(!N)return;const E=new ResizeObserver(()=>{var I;(I=k.current)==null||I.fitView({padding:.1,duration:200})});return E.observe(N),()=>E.disconnect()},[p,f]),S.useEffect(()=>{o(N=>{var v,ie,W;const E=!!(M!=null&&M.length),I=B==="completed"||B==="failed",G=new Set,H=new Set(N.map(U=>U.id)),V=new Map;for(const U of N){const re=(v=U.data)==null?void 0:v.label;if(!re)continue;const de=U.id.includes("/")?U.id.split("/").pop():U.id;for(const be of[de,re]){let Oe=V.get(be);Oe||(Oe=new Set,V.set(be,Oe)),Oe.add(U.id)}}if(E)for(const U of M){let re=!1;if(U.qualified_node_name){const de=U.qualified_node_name.replace(/:/g,"/");H.has(de)&&(G.add(de),re=!0)}if(!re){const de=V.get(U.node_name);de&&de.forEach(be=>G.add(be))}}const h=new Set;for(const U of N)U.parentNode&&G.has(U.id)&&h.add(U.parentNode);let F;B==="failed"&&G.size===0&&(F=(ie=N.find(U=>!U.parentNode&&U.type!=="startNode"&&U.type!=="endNode"&&U.type!=="groupNode"))==null?void 0:ie.id);let $;if(B==="completed"){const U=(W=N.find(re=>!re.parentNode&&re.type!=="startNode"&&re.type!=="endNode"&&re.type!=="groupNode"))==null?void 0:W.id;U&&!G.has(U)&&($=U)}return N.map(U=>{var de;let re;return U.id===F?re="failed":U.id===$||G.has(U.id)?re="completed":U.type==="startNode"?(!U.parentNode&&E||U.parentNode&&h.has(U.parentNode))&&(re="completed"):U.type==="endNode"?!U.parentNode&&I?re=B==="failed"?"failed":"completed":U.parentNode&&h.has(U.parentNode)&&(re="completed"):U.type==="groupNode"&&h.has(U.id)&&(re="completed"),re!==((de=U.data)==null?void 0:de.status)?{...U,data:{...U.data,status:re}}:U})})},[M,B,x,o]),p?a.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:"Loading graph..."}):f?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",style:{color:"var(--text-muted)"},children:[a.jsxs("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("rect",{x:"38",y:"10",width:"44",height:"24",rx:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.4"}),a.jsx("line",{x1:"60",y1:"34",x2:"60",y2:"46",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),a.jsx("rect",{x:"12",y:"46",width:"44",height:"24",rx:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),a.jsx("rect",{x:"64",y:"46",width:"44",height:"24",rx:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),a.jsx("line",{x1:"60",y1:"46",x2:"34",y2:"46",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),a.jsx("line",{x1:"60",y1:"46",x2:"86",y2:"46",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),a.jsx("line",{x1:"34",y1:"70",x2:"34",y2:"82",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),a.jsx("line",{x1:"86",y1:"70",x2:"86",y2:"82",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),a.jsx("line",{x1:"34",y1:"82",x2:"60",y2:"82",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),a.jsx("line",{x1:"86",y1:"82",x2:"60",y2:"82",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),a.jsx("line",{x1:"60",y1:"82",x2:"60",y2:"86",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),a.jsx("rect",{x:"38",y:"86",width:"44",height:"24",rx:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.4"})]}),a.jsx("span",{className:"text-xs",children:"No graph schema available"})]}):a.jsxs("div",{ref:D,className:"h-full graph-panel",children:[a.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); } + } + `}),a.jsxs(Ol,{nodes:s,edges:u,onNodesChange:l,onEdgesChange:d,nodeTypes:Fc,edgeTypes:zc,onInit:N=>{k.current=N},onNodeClick:O,fitView:!0,proOptions:{hideAttribution:!0},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,children:[a.jsx(Ll,{color:"var(--bg-tertiary)",gap:16}),a.jsx(jl,{showInteractive:!1}),a.jsx(Dl,{position:"top-right",children:a.jsxs("button",{onClick:_,title:w?"Remove all breakpoints":"Set breakpoints on all nodes",style:{background:"var(--bg-secondary)",color:w?"var(--error)":"var(--text-muted)",border:`1px solid ${w?"var(--error)":"var(--node-border)"}`,borderRadius:6,padding:"4px 10px",fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",gap:4},children:[a.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:w?"var(--error)":"var(--node-border)"}}),w?"Clear all":"Break all"]})}),a.jsx(Pl,{nodeColor:N=>{var I;if(N.type==="groupNode")return"var(--bg-tertiary)";const E=(I=N.data)==null?void 0:I.status;return E==="completed"?"var(--success)":E==="running"?"var(--warning)":E==="failed"?"var(--error)":"var(--node-border)"},nodeStrokeWidth:0,style:{background:"var(--bg-secondary)",width:120,height:80}})]})]})}const Ut="__setup__";function Vc({entrypoint:e,mode:t,ws:n,onRunCreated:r,isMobile:i}){const[s,o]=S.useState("{}"),[l,u]=S.useState({}),[c,d]=S.useState(!1),[p,m]=S.useState(!0),[f,g]=S.useState(null),[x,y]=S.useState(""),[b,k]=S.useState(!0),[C,j]=S.useState(()=>{const I=localStorage.getItem("setupTextareaHeight");return I?parseInt(I,10):140}),L=S.useRef(null),[T,B]=S.useState(()=>{const I=localStorage.getItem("setupPanelWidth");return I?parseInt(I,10):380}),O=t==="run";S.useEffect(()=>{m(!0),g(null),Zl(e).then(I=>{u(I.mock_input),o(JSON.stringify(I.mock_input,null,2))}).catch(I=>{console.error("Failed to load mock input:",I);const G=I.detail||{};g(G.message||`Failed to load schema for "${e}"`),o("{}")}).finally(()=>m(!1))},[e]),S.useEffect(()=>{ke.getState().clearBreakpoints(Ut)},[]);const w=async()=>{let I;try{I=JSON.parse(s)}catch{alert("Invalid JSON input");return}d(!0);try{const G=ke.getState().breakpoints[Ut]??{},H=Object.keys(G),V=await Ii(e,I,t,H);ke.getState().clearBreakpoints(Ut),ke.getState().upsertRun(V),r(V.id)}catch(G){console.error("Failed to create run:",G)}finally{d(!1)}},_=async()=>{const I=x.trim();if(I){d(!0);try{const G=ke.getState().breakpoints[Ut]??{},H=Object.keys(G),V=await Ii(e,l,"chat",H);ke.getState().clearBreakpoints(Ut),ke.getState().upsertRun(V),ke.getState().addLocalChatMessage(V.id,{message_id:`local-${Date.now()}`,role:"user",content:I}),n.sendChatMessage(V.id,I),r(V.id)}catch(G){console.error("Failed to create chat run:",G)}finally{d(!1)}}};S.useEffect(()=>{try{JSON.parse(s),k(!0)}catch{k(!1)}},[s]);const M=S.useCallback(I=>{I.preventDefault();const G="touches"in I?I.touches[0].clientY:I.clientY,H=C,V=F=>{const $="touches"in F?F.touches[0].clientY:F.clientY,v=Math.max(60,H+(G-$));j(v)},h=()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",h),document.removeEventListener("touchmove",V),document.removeEventListener("touchend",h),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("setupTextareaHeight",String(C))};document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",V),document.addEventListener("mouseup",h),document.addEventListener("touchmove",V,{passive:!1}),document.addEventListener("touchend",h)},[C]),R=S.useCallback(I=>{I.preventDefault();const G="touches"in I?I.touches[0].clientX:I.clientX,H=T,V=F=>{const $=L.current;if(!$)return;const v="touches"in F?F.touches[0].clientX:F.clientX,ie=$.clientWidth-300,W=Math.max(280,Math.min(ie,H+(G-v)));B(W)},h=()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",h),document.removeEventListener("touchmove",V),document.removeEventListener("touchend",h),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",V),document.addEventListener("mouseup",h),document.addEventListener("touchmove",V,{passive:!1}),document.addEventListener("touchend",h)},[T]),D=O?"Autonomous":"Conversational",N=O?"var(--success)":"var(--accent)",E=a.jsxs("div",{className:"shrink-0 flex flex-col",style:i?{background:"var(--bg-primary)"}:{width:T,background:"var(--bg-primary)"},children:[a.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:[a.jsx("span",{style:{color:N},children:"●"}),D]}),a.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col items-center justify-center gap-4 px-6",children:[a.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:O?a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("polyline",{points:"12 6 12 12 16 14"})]}):a.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"})}),a.jsxs("div",{className:"text-center space-y-1.5",children:[a.jsx("p",{className:"text-sm font-medium",style:{color:"var(--text-secondary)"},children:O?"Ready to execute":"Ready to chat"}),a.jsxs("p",{className:"text-xs leading-relaxed",style:{color:"var(--text-muted)"},children:["Click nodes to set breakpoints",O?a.jsxs(a.Fragment,{children:[",",a.jsx("br",{}),"configure input below, then run"]}):a.jsxs(a.Fragment,{children:[",",a.jsx("br",{}),"then send your first message"]})]})]})]}),O?a.jsxs("div",{className:"flex flex-col",style:{background:"var(--bg-primary)"},children:[!i&&a.jsx("div",{onMouseDown:M,onTouchStart:M,className:"shrink-0 drag-handle-row"}),a.jsxs("div",{className:"px-4 py-3",children:[f?a.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}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:["Input",p&&a.jsx("span",{className:"ml-2 font-normal",children:"Loading..."})]}),a.jsx("textarea",{value:s,onChange:I=>o(I.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:i?120:C,background:"var(--bg-secondary)",border:`1px solid ${b?"var(--border)":"#b91c1c"}`,color:"var(--text-primary)"}})]}),a.jsx("button",{onClick:w,disabled:c||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:N,color:N},onMouseEnter:I=>{c||(I.currentTarget.style.background=`color-mix(in srgb, ${N} 10%, transparent)`)},onMouseLeave:I=>{I.currentTarget.style.background="transparent"},children:c?"Starting...":a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",children:a.jsx("polygon",{points:"5,3 19,12 5,21"})}),"Execute"]})})]})]}):a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-t",style:{borderColor:"var(--border)"},children:[a.jsx("input",{value:x,onChange:I=>y(I.target.value),onKeyDown:I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),_())},disabled:c||p,placeholder:c?"Starting...":"Message...",className:"flex-1 bg-transparent text-sm py-1 disabled:opacity-40 placeholder:text-[var(--text-muted)]",style:{color:"var(--text-primary)"}}),a.jsx("button",{onClick:_,disabled:c||p||!x.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:!c&&x.trim()?"var(--accent)":"var(--text-muted)",background:"transparent"},onMouseEnter:I=>{!c&&x.trim()&&(I.currentTarget.style.background="color-mix(in srgb, var(--accent) 10%, transparent)")},onMouseLeave:I=>{I.currentTarget.style.background="transparent"},children:"Send"})]})]});return i?a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsx("div",{className:"shrink-0",style:{height:"40vh"},children:a.jsx($n,{entrypoint:e,traces:[],runId:Ut})}),a.jsx("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:E})]}):a.jsxs("div",{ref:L,className:"flex h-full",children:[a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx($n,{entrypoint:e,traces:[],runId:Ut})}),a.jsx("div",{onMouseDown:R,onTouchStart:R,className:"shrink-0 drag-handle-col"}),E]})}const Yc={key:"var(--info)",string:"var(--success)",number:"var(--warning)",boolean:"var(--accent)",null:"var(--accent)",punctuation:"var(--text-muted)"};function Xc(e){const t=[],n=/("(?:[^"\\]|\\.)*")\s*:|("(?:[^"\\]|\\.)*")|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)\b|(true|false)\b|(null)\b|([{}[\]:,])/g;let r=0,i;for(;(i=n.exec(e))!==null;){if(i.index>r&&t.push({type:"punctuation",text:e.slice(r,i.index)}),i[1]!==void 0){t.push({type:"key",text:i[1]});const s=e.indexOf(":",i.index+i[1].length);s!==-1&&(s>i.index+i[1].length&&t.push({type:"punctuation",text:e.slice(i.index+i[1].length,s)}),t.push({type:"punctuation",text:":"}),n.lastIndex=s+1)}else i[2]!==void 0?t.push({type:"string",text:i[2]}):i[3]!==void 0?t.push({type:"number",text:i[3]}):i[4]!==void 0?t.push({type:"boolean",text:i[4]}):i[5]!==void 0?t.push({type:"null",text:i[5]}):i[6]!==void 0&&t.push({type:"punctuation",text:i[6]});r=n.lastIndex}return rXc(e),[e]);return a.jsx("pre",{className:t,style:n,children:r.map((i,s)=>a.jsx("span",{style:{color:Yc[i.type]},children:i.text},s))})}const Zc={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"}},Jc={color:"var(--text-muted)",label:"Unknown"};function Qc(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 Ki=200;function eu(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 tu({value:e}){const[t,n]=S.useState(!1),r=eu(e),i=S.useMemo(()=>Qc(e),[e]),s=i!==null,o=i??r,l=o.length>Ki||o.includes(` +`),u=S.useCallback(()=>n(c=>!c),[]);return l?a.jsxs("div",{children:[t?s?a.jsx(ot,{json:o,className:"font-mono text-[11px] whitespace-pre-wrap break-all",style:{}}):a.jsx("pre",{className:"font-mono text-[11px] whitespace-pre-wrap break-all",style:{color:"var(--text-primary)"},children:o}):a.jsxs("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:[o.slice(0,Ki),"..."]}),a.jsx("button",{onClick:u,className:"text-[11px] cursor-pointer ml-1 px-1",style:{color:"var(--info)"},children:t?"[less]":"[more]"})]}):s?a.jsx(ot,{json:o,className:"font-mono text-[11px] break-all whitespace-pre-wrap",style:{}}):a.jsx("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:o})}function nu({span:e}){const[t,n]=S.useState(!0),[r,i]=S.useState(!1),[s,o]=S.useState("table"),[l,u]=S.useState(!1),c=Zc[e.status.toLowerCase()]??{...Jc,label:e.status},d=S.useMemo(()=>JSON.stringify(e,null,2),[e]),p=S.useCallback(()=>{navigator.clipboard.writeText(d).then(()=>{u(!0),setTimeout(()=>u(!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 a.jsxs("div",{className:"flex flex-col h-full text-xs leading-normal",children:[a.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:[a.jsx("button",{onClick:()=>o("table"),className:"px-2.5 h-6 text-[11px] font-semibold rounded transition-colors cursor-pointer inline-flex items-center",style:{color:s==="table"?"var(--accent)":"var(--text-muted)",background:s==="table"?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},onMouseEnter:g=>{s!=="table"&&(g.currentTarget.style.color="var(--text-primary)")},onMouseLeave:g=>{s!=="table"&&(g.currentTarget.style.color="var(--text-muted)")},children:"Table"}),a.jsx("button",{onClick:()=>o("json"),className:"px-2.5 h-6 text-[11px] font-semibold rounded transition-colors cursor-pointer inline-flex items-center",style:{color:s==="json"?"var(--accent)":"var(--text-muted)",background:s==="json"?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},onMouseEnter:g=>{s!=="json"&&(g.currentTarget.style.color="var(--text-primary)")},onMouseLeave:g=>{s!=="json"&&(g.currentTarget.style.color="var(--text-muted)")},children:"JSON"}),a.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, ${c.color} 15%, var(--bg-secondary))`,color:c.color},children:[a.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:c.color}}),c.label]})]}),a.jsx("div",{className:"overflow-y-auto flex-1 p-0.5 pr-0 pt-0 mr-0.5 mt-0.5",children:s==="table"?a.jsxs(a.Fragment,{children:[m.length>0&&a.jsxs(a.Fragment,{children:[a.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(g=>!g),children:[a.jsxs("span",{className:"flex-1",children:["Attributes (",m.length,")"]}),a.jsx("span",{style:{color:"var(--text-muted)",transform:t?"rotate(0deg)":"rotate(-90deg)"},children:"▾"})]}),t&&m.map(([g,x],y)=>a.jsxs("div",{className:"flex gap-2 px-2 py-1 items-start border-b",style:{borderColor:"var(--border)",background:y%2===0?"var(--bg-primary)":"var(--bg-secondary)"},children:[a.jsx("span",{className:"font-mono font-semibold shrink-0 pt-px truncate text-[11px]",style:{color:"var(--info)",width:"35%"},title:g,children:g}),a.jsx("span",{className:"flex-1 min-w-0",children:a.jsx(tu,{value:x})})]},g))]}),a.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:()=>i(g=>!g),children:[a.jsxs("span",{className:"flex-1",children:["Identifiers (",f.length,")"]}),a.jsx("span",{style:{color:"var(--text-muted)",transform:r?"rotate(0deg)":"rotate(-90deg)"},children:"▾"})]}),r&&f.map((g,x)=>a.jsxs("div",{className:"flex gap-2 px-2 py-1 items-start border-b",style:{borderColor:"var(--border)",background:x%2===0?"var(--bg-primary)":"var(--bg-secondary)"},children:[a.jsx("span",{className:"font-mono font-semibold shrink-0 pt-px truncate text-[11px]",style:{color:"var(--info)",width:"35%"},title:g.label,children:g.label}),a.jsx("span",{className:"flex-1 min-w-0",children:a.jsx("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:g.value})})]},g.label))]}):a.jsxs("div",{className:"relative",children:[a.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:g=>{l||(g.currentTarget.style.color="var(--text-primary)")},onMouseLeave:g=>{g.currentTarget.style.color=l?"var(--success)":"var(--text-muted)"},children:l?"Copied!":"Copy"}),a.jsx(ot,{json:d,className:"font-mono text-[11px] whitespace-pre-wrap p-2",style:{}})]})})]})}function ru(e){const t=[];function n(r,i){t.push({span:r.span,depth:i});for(const s of r.children)n(s,i+1)}for(const r of e)n(r,0);return t}function iu({tree:e,selectedSpan:t,onSelect:n}){const r=S.useMemo(()=>ru(e),[e]),{globalStart:i,totalDuration:s}=S.useMemo(()=>{if(r.length===0)return{globalStart:0,totalDuration:1};let o=1/0,l=-1/0;for(const{span:u}of r){const c=new Date(u.timestamp).getTime();o=Math.min(o,c),l=Math.max(l,c+(u.duration_ms??0))}return{globalStart:o,totalDuration:Math.max(l-o,1)}},[r]);return r.length===0?null:a.jsx(a.Fragment,{children:r.map(({span:o,depth:l})=>{var x;const u=new Date(o.timestamp).getTime()-i,c=o.duration_ms??0,d=u/s*100,p=Math.max(c/s*100,.3),m=Cs[o.status.toLowerCase()]??"var(--text-muted)",f=o.span_id===(t==null?void 0:t.span_id),g=(x=o.attributes)==null?void 0:x["openinference.span.kind"];return a.jsxs("button",{"data-span-id":o.span_id,onClick:()=>n(o),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:y=>{f||(y.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:y=>{f||(y.currentTarget.style.background="")},children:[a.jsxs("div",{className:"shrink-0 flex items-center gap-1 overflow-hidden",style:{width:"35%",minWidth:"80px",paddingLeft:`${l*12+4}px`},children:[a.jsx("span",{className:"shrink-0 flex items-center justify-center w-3.5 h-3.5",children:a.jsx(As,{kind:g,statusColor:m})}),a.jsx("span",{className:"text-[var(--text-primary)] truncate",children:o.span_name})]}),a.jsx("div",{className:"flex-1 relative h-[14px] mx-1 rounded-sm",style:{background:"var(--bg-secondary)"},children:a.jsx("div",{className:"absolute rounded-sm",style:{left:`${d}%`,width:`${p}%`,top:"2px",bottom:"2px",background:m,opacity:.8,minWidth:"2px"}})}),a.jsx("span",{className:"shrink-0 text-[10px] tabular-nums pr-2",style:{width:"52px",textAlign:"right",color:"var(--text-muted)"},children:Ms(o.duration_ms)})]},o.span_id)})})}const Cs={started:"var(--info)",running:"var(--warning)",completed:"var(--success)",failed:"var(--error)",error:"var(--error)"};function As({kind:e,statusColor:t}){const n=t,r=14,i={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 a.jsx("svg",{...i,children:a.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 a.jsx("svg",{...i,children:a.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 a.jsxs("svg",{...i,children:[a.jsx("rect",{x:"3",y:"5",width:"10",height:"8",rx:"2"}),a.jsx("circle",{cx:"6",cy:"9",r:"1",fill:n,stroke:"none"}),a.jsx("circle",{cx:"10",cy:"9",r:"1",fill:n,stroke:"none"}),a.jsx("path",{d:"M8 2v3"}),a.jsx("path",{d:"M6 2h4"})]});case"CHAIN":return a.jsxs("svg",{...i,children:[a.jsx("path",{d:"M6.5 9.5L9.5 6.5"}),a.jsx("path",{d:"M4.5 8.5l-1 1a2 2 0 0 0 2.83 2.83l1-1"}),a.jsx("path",{d:"M11.5 7.5l1-1a2 2 0 0 0-2.83-2.83l-1 1"})]});case"RETRIEVER":return a.jsxs("svg",{...i,children:[a.jsx("circle",{cx:"7",cy:"7",r:"4"}),a.jsx("path",{d:"M10 10l3.5 3.5"})]});case"EMBEDDING":return a.jsxs("svg",{...i,children:[a.jsx("rect",{x:"2",y:"2",width:"4",height:"4",rx:"0.5"}),a.jsx("rect",{x:"10",y:"2",width:"4",height:"4",rx:"0.5"}),a.jsx("rect",{x:"2",y:"10",width:"4",height:"4",rx:"0.5"}),a.jsx("rect",{x:"10",y:"10",width:"4",height:"4",rx:"0.5"})]});default:return a.jsx("span",{className:"shrink-0 w-2 h-2 rounded-full",style:{background:t}})}}function ou(e){const t=new Map(e.map(o=>[o.span_id,o])),n=new Map;for(const o of e)if(o.parent_span_id){const l=n.get(o.parent_span_id)??[];l.push(o),n.set(o.parent_span_id,l)}const r=e.filter(o=>o.parent_span_id===null||!t.has(o.parent_span_id));function i(o){const l=(n.get(o.span_id)??[]).sort((u,c)=>u.timestamp.localeCompare(c.timestamp));return{span:o,children:l.map(i)}}return r.sort((o,l)=>o.timestamp.localeCompare(l.timestamp)).map(i).flatMap(o=>o.span.span_name==="root"?o.children:[o])}function Ms(e){return e==null?"":e<1e3?`${e.toFixed(0)}ms`:`${(e/1e3).toFixed(2)}s`}function Is(e){return e.map(t=>{const{span:n}=t;return t.children.length>0?{name:n.span_name,children:Is(t.children)}:{name:n.span_name}})}function Lr({traces:e}){const[t,n]=S.useState(null),[r,i]=S.useState(new Set),[s,o]=S.useState(()=>{const O=localStorage.getItem("traceTreeSplitWidth");return O?parseFloat(O):50}),[l,u]=S.useState(!1),[c,d]=S.useState(!1),[p,m]=S.useState(()=>localStorage.getItem("traceViewMode")||"tree"),f=ou(e),g=S.useMemo(()=>JSON.stringify(Is(f),null,2),[e]),x=S.useCallback(()=>{navigator.clipboard.writeText(g).then(()=>{d(!0),setTimeout(()=>d(!1),1500)})},[g]),y=ke(O=>O.focusedSpan),b=ke(O=>O.setFocusedSpan),[k,C]=S.useState(null),j=S.useRef(null),L=S.useCallback(O=>{i(w=>{const _=new Set(w);return _.has(O)?_.delete(O):_.add(O),_})},[]),T=S.useRef(null);S.useEffect(()=>{const O=f.length>0?f[0].span.span_id:null,w=T.current;if(T.current=O,O&&O!==w)n(f[0].span);else if(t===null)f.length>0&&n(f[0].span);else{const _=e.find(M=>M.span_id===t.span_id);_&&_!==t&&n(_)}},[e]),S.useEffect(()=>{if(!y)return;const w=e.filter(_=>_.span_name===y.name).sort((_,M)=>_.timestamp.localeCompare(M.timestamp))[y.index];if(w){n(w),C(w.span_id);const _=new Map(e.map(M=>[M.span_id,M.parent_span_id]));i(M=>{const R=new Set(M);let D=w.parent_span_id;for(;D;)R.delete(D),D=_.get(D)??null;return R})}b(null)},[y,e,b]),S.useEffect(()=>{if(!k)return;const O=k;C(null),requestAnimationFrame(()=>{const w=j.current,_=w==null?void 0:w.querySelector(`[data-span-id="${O}"]`);w&&_&&_.scrollIntoView({block:"center",behavior:"smooth"})})},[k]),S.useEffect(()=>{if(!l)return;const O=_=>{const M=document.querySelector(".trace-tree-container");if(!M)return;const R=M.getBoundingClientRect(),D=(_.clientX-R.left)/R.width*100,N=Math.max(20,Math.min(80,D));o(N),localStorage.setItem("traceTreeSplitWidth",String(N))},w=()=>{u(!1)};return window.addEventListener("mousemove",O),window.addEventListener("mouseup",w),()=>{window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",w)}},[l]);const B=O=>{O.preventDefault(),u(!0)};return a.jsxs("div",{className:"flex h-full trace-tree-container",style:{cursor:l?"col-resize":void 0},children:[a.jsxs("div",{className:"flex flex-col",style:{width:`${s}%`},children:[e.length>0&&a.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:[a.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:O=>{p!=="tree"&&(O.currentTarget.style.color="var(--text-primary)")},onMouseLeave:O=>{p!=="tree"&&(O.currentTarget.style.color="var(--text-muted)")},children:"Tree"}),a.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:O=>{p!=="timeline"&&(O.currentTarget.style.color="var(--text-primary)")},onMouseLeave:O=>{p!=="timeline"&&(O.currentTarget.style.color="var(--text-muted)")},children:"Timeline"}),a.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:O=>{p!=="json"&&(O.currentTarget.style.color="var(--text-primary)")},onMouseLeave:O=>{p!=="json"&&(O.currentTarget.style.color="var(--text-muted)")},children:"JSON"})]}),a.jsx("div",{ref:j,className:"overflow-y-auto flex-1 p-0.5 pr-0 pt-0 mr-0.5 mt-0.5",children:f.length===0?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"No traces yet"})}):p==="tree"?f.map((O,w)=>a.jsx(Rs,{node:O,depth:0,selectedId:(t==null?void 0:t.span_id)??null,onSelect:n,isLast:w===f.length-1,collapsedIds:r,toggleExpanded:L},O.span.span_id)):p==="timeline"?a.jsx(iu,{tree:f,selectedSpan:t,onSelect:n}):a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:x,className:"absolute top-1 right-1 z-10 text-[11px] cursor-pointer px-2 py-1 rounded transition-colors",style:{color:c?"var(--success)":"var(--text-muted)",background:"var(--bg-secondary)",border:"1px solid var(--border)"},onMouseEnter:O=>{c||(O.currentTarget.style.color="var(--text-primary)")},onMouseLeave:O=>{O.currentTarget.style.color=c?"var(--success)":"var(--text-muted)"},children:c?"Copied!":"Copy"}),a.jsx(ot,{json:g,className:"font-mono text-[11px] whitespace-pre-wrap p-2",style:{}})]})})]}),a.jsx("div",{onMouseDown:B,className:"shrink-0 drag-handle-col",style:l?{background:"var(--accent)"}:void 0}),a.jsx("div",{className:"flex-1 overflow-hidden",children:t?a.jsx(nu,{span:t}):a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"Select a span to view details"})})})]})}function Rs({node:e,depth:t,selectedId:n,onSelect:r,isLast:i,collapsedIds:s,toggleExpanded:o}){var x;const{span:l}=e,u=!s.has(l.span_id),c=Cs[l.status.toLowerCase()]??"var(--text-muted)",d=Ms(l.duration_ms),p=l.span_id===n,m=e.children.length>0,f=t*20,g=(x=l.attributes)==null?void 0:x["openinference.span.kind"];return a.jsxs("div",{className:"relative",children:[t>0&&a.jsx("div",{className:"absolute top-0 z-10 pointer-events-none",style:{left:`${f-10}px`,width:"1px",height:i?"16px":"100%",background:"var(--border)"}}),a.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:y=>{p||(y.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:y=>{p||(y.currentTarget.style.background="")},children:[t>0&&a.jsx("div",{className:"absolute z-10 pointer-events-none",style:{left:`${f-10}px`,top:"50%",width:"10px",height:"1px",background:"var(--border)"}}),m?a.jsx("span",{onClick:y=>{y.stopPropagation(),o(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:a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",style:{transform:u?"rotate(90deg)":"rotate(0deg)"},children:a.jsx("path",{d:"M3 1.5L7 5L3 8.5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})}):a.jsx("span",{className:"shrink-0 w-4"}),a.jsx("span",{className:"shrink-0 flex items-center justify-center w-4 h-4",children:a.jsx(As,{kind:g,statusColor:c})}),a.jsx("span",{className:"text-[var(--text-primary)] truncate min-w-0 flex-1",children:l.span_name}),d&&a.jsx("span",{className:"text-[var(--text-muted)] shrink-0 ml-auto pl-2 tabular-nums",children:d})]}),u&&e.children.map((y,b)=>a.jsx(Rs,{node:y,depth:t+1,selectedId:n,onSelect:r,isLast:b===e.children.length-1,collapsedIds:s,toggleExpanded:o},y.span.span_id))]})}const su={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)"}},au={color:"var(--text-muted)",bg:"transparent"};function Gi({logs:e}){const t=S.useRef(null),n=S.useRef(null),[r,i]=S.useState(!1);S.useEffect(()=>{var o;(o=n.current)==null||o.scrollIntoView({behavior:"smooth"})},[e.length]);const s=()=>{const o=t.current;o&&i(o.scrollTop>100)};return e.length===0?a.jsx("div",{className:"h-full flex items-center justify-center",children:a.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"No logs yet"})}):a.jsxs("div",{className:"h-full relative",children:[a.jsxs("div",{ref:t,onScroll:s,className:"h-full overflow-y-auto font-mono text-xs leading-normal",children:[e.map((o,l)=>{const u=new Date(o.timestamp).toLocaleTimeString(void 0,{hour12:!1}),c=o.level.toUpperCase(),d=c.slice(0,4),p=su[c]??au,m=l%2===0;return a.jsxs("div",{className:"flex gap-3 px-3 py-1.5",style:{background:m?"var(--bg-primary)":"var(--bg-secondary)"},children:[a.jsx("span",{className:"text-[var(--text-muted)] shrink-0",children:u}),a.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}),a.jsx("span",{className:"text-[var(--text-primary)] whitespace-pre-wrap break-all",children:o.message})]},l)}),a.jsx("div",{ref:n})]}),r&&a.jsx("button",{onClick:()=>{var o;return(o=t.current)==null?void 0:o.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:a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"18 15 12 9 6 15"})})})]})}const lu={started:{color:"var(--accent)",label:"started"},updated:{color:"var(--info)",label:"updated"},completed:{color:"var(--success)",label:"completed"},faulted:{color:"var(--error)",label:"faulted"}},qi={color:"var(--text-muted)",label:""};function An({events:e,runStatus:t}){const n=S.useRef(null),r=S.useRef(!0),[i,s]=S.useState(null),o=()=>{const l=n.current;l&&(r.current=l.scrollHeight-l.scrollTop-l.clientHeight<40)};return S.useEffect(()=>{r.current&&n.current&&(n.current.scrollTop=n.current.scrollHeight)}),e.length===0?a.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:a.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:t==="running"?"Waiting for events...":"No events yet"})}):a.jsx("div",{ref:n,onScroll:o,className:"h-full overflow-y-auto font-mono text-xs leading-normal",children:e.map((l,u)=>{const c=new Date(l.timestamp).toLocaleTimeString(void 0,{hour12:!1}),d=l.payload&&Object.keys(l.payload).length>0,p=i===u,m=l.phase?lu[l.phase]??qi:qi;return a.jsxs("div",{children:[a.jsxs("div",{onClick:()=>{d&&s(p?null:u)},className:"flex items-center gap-2 px-3 py-1.5",style:{background:u%2===0?"var(--bg-primary)":"var(--bg-secondary)",cursor:d?"pointer":"default"},children:[a.jsx("span",{className:"shrink-0",style:{color:"var(--text-muted)"},children:c}),a.jsx("span",{className:"shrink-0",style:{color:m.color},children:"●"}),a.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:l.node_name}),m.label&&a.jsx("span",{className:"shrink-0 text-[10px]",style:{color:"var(--text-muted)"},children:m.label}),d&&a.jsx("span",{className:"shrink-0 text-[9px] transition-transform",style:{color:"var(--text-muted)",transform:p?"rotate(90deg)":"rotate(0deg)"},children:"▸"})]}),p&&d&&a.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:a.jsx(ot,{json:JSON.stringify(l.payload,null,2),className:"text-[11px] font-mono whitespace-pre-wrap break-words"})})]},u)})})}function _t({title:e,copyText:t,trailing:n,children:r}){const[i,s]=S.useState(!1),o=S.useCallback(()=>{t&&navigator.clipboard.writeText(t).then(()=>{s(!0),setTimeout(()=>s(!1),1500)})},[t]);return a.jsxs("div",{className:"overflow-hidden",style:{border:"1px solid var(--border)"},children:[a.jsxs("div",{className:"px-3 py-2 flex items-center gap-2",style:{background:"var(--bg-secondary)"},children:[a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:e}),n,t&&a.jsx("button",{onClick:o,className:`${n?"":"ml-auto "}text-[10px] cursor-pointer px-1.5 py-0.5 rounded transition-colors`,style:{color:i?"var(--success)":"var(--text-muted)",background:"var(--bg-tertiary)",border:"none"},onMouseEnter:l=>{i||(l.currentTarget.style.color="var(--text-primary)")},onMouseLeave:l=>{l.currentTarget.style.color=i?"var(--success)":"var(--text-muted)"},children:i?"Copied":"Copy"})]}),r]})}function Vi({runId:e,status:t,ws:n,breakpointNode:r}){const i=t==="suspended",s=o=>{const l=ke.getState().breakpoints[e]??{};n.setBreakpoints(e,Object.keys(l)),o==="step"?n.debugStep(e):o==="continue"?n.debugContinue(e):n.debugStop(e)};return a.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:[a.jsx("span",{className:"text-[11px] font-semibold mr-1",style:{color:"var(--text-muted)"},children:"Debug"}),a.jsx(dr,{label:"Step",onClick:()=>s("step"),disabled:!i,color:"var(--info)",active:i}),a.jsx(dr,{label:"Continue",onClick:()=>s("continue"),disabled:!i,color:"var(--success)",active:i}),a.jsx(dr,{label:"Stop",onClick:()=>s("stop"),disabled:!i,color:"var(--error)",active:i}),a.jsx("span",{className:"text-[11px] ml-auto truncate",style:{color:i?"var(--accent)":"var(--text-muted)"},children:i?r?`Paused at ${r}`:"Paused":t})]})}function dr({label:e,onClick:t,disabled:n,color:r,active:i}){return a.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:i?r:"var(--text-muted)",background:i?`color-mix(in srgb, ${r} 10%, transparent)`:"transparent"},onMouseEnter:s=>{n||(s.currentTarget.style.background=`color-mix(in srgb, ${r} 20%, transparent)`)},onMouseLeave:s=>{s.currentTarget.style.background=i?`color-mix(in srgb, ${r} 10%, transparent)`:"transparent"},children:e})}const Yi=S.lazy(()=>Ss(()=>import("./ChatPanel-C97Mws6P.js"),__vite__mapDeps([2,1,3,4]))),cu=[],uu=[],du=[],pu=[];function fu({run:e,ws:t,isMobile:n}){const r=e.mode==="chat",[i,s]=S.useState(280),[o,l]=S.useState(()=>{const D=localStorage.getItem("chatPanelWidth");return D?parseInt(D,10):380}),[u,c]=S.useState("primary"),[d,p]=S.useState(r?"primary":"traces"),m=S.useRef(null),f=S.useRef(null),g=S.useRef(!1),x=ke(D=>D.traces[e.id]||cu),y=ke(D=>D.logs[e.id]||uu),b=ke(D=>D.chatMessages[e.id]||du),k=ke(D=>D.stateEvents[e.id]||pu),C=ke(D=>D.breakpoints[e.id]);S.useEffect(()=>{t.setBreakpoints(e.id,C?Object.keys(C):[])},[e.id]);const j=S.useCallback(D=>{t.setBreakpoints(e.id,D)},[e.id,t]),L=S.useCallback(D=>{D.preventDefault(),g.current=!0;const N="touches"in D?D.touches[0].clientY:D.clientY,E=i,I=H=>{if(!g.current)return;const V=m.current;if(!V)return;const h="touches"in H?H.touches[0].clientY:H.clientY,F=V.clientHeight-100,$=Math.max(80,Math.min(F,E+(h-N)));s($)},G=()=>{g.current=!1,document.removeEventListener("mousemove",I),document.removeEventListener("mouseup",G),document.removeEventListener("touchmove",I),document.removeEventListener("touchend",G),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",I),document.addEventListener("mouseup",G),document.addEventListener("touchmove",I,{passive:!1}),document.addEventListener("touchend",G)},[i]),T=S.useCallback(D=>{D.preventDefault();const N="touches"in D?D.touches[0].clientX:D.clientX,E=o,I=H=>{const V=f.current;if(!V)return;const h="touches"in H?H.touches[0].clientX:H.clientX,F=V.clientWidth-300,$=Math.max(280,Math.min(F,E+(N-h)));l($)},G=()=>{document.removeEventListener("mousemove",I),document.removeEventListener("mouseup",G),document.removeEventListener("touchmove",I),document.removeEventListener("touchend",G),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("chatPanelWidth",String(o))};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",I),document.addEventListener("mouseup",G),document.addEventListener("touchmove",I,{passive:!1}),document.addEventListener("touchend",G)},[o]),B=r?"Chat":"Events",O=r?"var(--accent)":"var(--success)",w=D=>D==="primary"?O:D==="events"?"var(--success)":"var(--accent)",_=ke(D=>D.activeInterrupt[e.id]??null),M=e.status==="running"?a.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"&&_?a.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 D=[{id:"traces",label:"Traces",count:x.length},{id:"primary",label:B},...r?[{id:"events",label:"Events",count:k.length}]:[],{id:"io",label:"I/O"},{id:"logs",label:"Logs",count:y.length}];return a.jsxs("div",{className:"flex flex-col h-full",children:[(e.mode==="debug"||e.status==="suspended"&&!_||C&&Object.keys(C).length>0)&&a.jsx(Vi,{runId:e.id,status:e.status,ws:t,breakpointNode:e.breakpoint_node}),a.jsx("div",{className:"shrink-0",style:{height:"40vh"},children:a.jsx($n,{entrypoint:e.entrypoint,traces:x,runId:e.id,breakpointNode:e.breakpoint_node,breakpointNextNodes:e.breakpoint_next_nodes,onBreakpointChange:j})}),a.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:[D.map(N=>a.jsxs("button",{onClick:()=>p(N.id),className:"px-2.5 py-1 h-7 text-xs font-semibold rounded transition-colors cursor-pointer",style:{color:d===N.id?w(N.id):"var(--text-muted)",background:d===N.id?`color-mix(in srgb, ${w(N.id)} 10%, transparent)`:"transparent"},children:[N.label,N.count!==void 0&&N.count>0&&a.jsx("span",{className:"ml-1 font-normal",style:{color:"var(--text-muted)"},children:N.count})]},N.id)),M]}),a.jsxs("div",{className:"flex-1 overflow-hidden",children:[d==="traces"&&a.jsx(Lr,{traces:x}),d==="primary"&&(r?a.jsx(S.Suspense,{fallback:a.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:a.jsx("span",{className:"text-xs",children:"Loading chat..."})}),children:a.jsx(Yi,{messages:b,runId:e.id,runStatus:e.status,ws:t})}):a.jsx(An,{events:k,runStatus:e.status})),d==="events"&&a.jsx(An,{events:k,runStatus:e.status}),d==="io"&&a.jsx(Xi,{run:e}),d==="logs"&&a.jsx(Gi,{logs:y})]})]})}const R=[{id:"primary",label:B},...r?[{id:"events",label:"Events",count:k.length}]:[],{id:"io",label:"I/O"},{id:"logs",label:"Logs",count:y.length}];return a.jsxs("div",{ref:f,className:"flex h-full",children:[a.jsxs("div",{ref:m,className:"flex flex-col flex-1 min-w-0",children:[(e.mode==="debug"||e.status==="suspended"&&!_||C&&Object.keys(C).length>0)&&a.jsx(Vi,{runId:e.id,status:e.status,ws:t,breakpointNode:e.breakpoint_node}),a.jsx("div",{className:"shrink-0 overflow-hidden",style:{height:i},children:a.jsx($n,{entrypoint:e.entrypoint,traces:x,runId:e.id,breakpointNode:e.breakpoint_node,breakpointNextNodes:e.breakpoint_next_nodes,onBreakpointChange:j})}),a.jsx("div",{onMouseDown:L,onTouchStart:L,className:"shrink-0 drag-handle-row"}),a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(Lr,{traces:x})})]}),a.jsx("div",{onMouseDown:T,onTouchStart:T,className:"shrink-0 drag-handle-col"}),a.jsxs("div",{className:"shrink-0 flex flex-col",style:{width:o,background:"var(--bg-primary)"},children:[a.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:[R.map(D=>a.jsxs("button",{onClick:()=>c(D.id),className:"px-2.5 py-1 h-7 text-xs font-semibold rounded transition-colors cursor-pointer",style:{color:u===D.id?w(D.id):"var(--text-muted)",background:u===D.id?`color-mix(in srgb, ${w(D.id)} 10%, transparent)`:"transparent"},onMouseEnter:N=>{u!==D.id&&(N.currentTarget.style.color="var(--text-primary)")},onMouseLeave:N=>{u!==D.id&&(N.currentTarget.style.color="var(--text-muted)")},children:[D.label,D.count!==void 0&&D.count>0&&a.jsx("span",{className:"ml-1 font-normal",style:{color:"var(--text-muted)"},children:D.count})]},D.id)),M]}),a.jsxs("div",{className:"flex-1 overflow-hidden",children:[u==="primary"&&(r?a.jsx(S.Suspense,{fallback:a.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:a.jsx("span",{className:"text-xs",children:"Loading chat..."})}),children:a.jsx(Yi,{messages:b,runId:e.id,runStatus:e.status,ws:t})}):a.jsx(An,{events:k,runStatus:e.status})),u==="events"&&a.jsx(An,{events:k,runStatus:e.status}),u==="io"&&a.jsx(Xi,{run:e}),u==="logs"&&a.jsx(Gi,{logs:y})]})]})]})}function Xi({run:e}){return a.jsxs("div",{className:"p-2 overflow-y-auto h-full space-y-1.5",children:[a.jsx(_t,{title:"Input",copyText:JSON.stringify(e.input_data,null,2),children:a.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&&a.jsx(_t,{title:"Output",copyText:typeof e.output_data=="string"?e.output_data:JSON.stringify(e.output_data,null,2),children:a.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&&a.jsxs("div",{className:"overflow-hidden",style:{border:"1px solid color-mix(in srgb, var(--error) 40%, var(--border))"},children:[a.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:[a.jsx("span",{children:"Error"}),a.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}),a.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})]}),a.jsxs("div",{className:"px-3 py-2 text-xs leading-normal",children:[a.jsx("div",{className:"font-semibold mb-2",style:{color:"var(--text-primary)"},children:e.error.title}),a.jsx("pre",{className:"whitespace-pre-wrap font-mono text-[11px] max-w-prose",style:{color:"var(--text-secondary)"},children:e.error.detail})]})]})]})}function Zi(){const{reloadPending:e,setReloadPending:t,setEntrypoints:n}=ke(),[r,i]=S.useState(!1);if(!e)return null;const s=async()=>{i(!0);try{await ec();const o=await vs();n(o.map(l=>l.name)),t(!1)}catch(o){console.error("Reload failed:",o)}finally{i(!1)}};return a.jsxs("div",{className:"fixed top-4 left-1/2 -translate-x-1/2 z-50 flex items-center justify-between px-5 py-2.5 rounded-lg shadow-lg min-w-[400px]",style:{background:"var(--bg-secondary)",border:"1px solid var(--bg-tertiary)"},children:[a.jsx("span",{className:"text-sm",style:{color:"var(--text-secondary)"},children:"Files changed, reload to apply"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:s,disabled:r,className:"px-3 py-1 text-sm font-medium rounded cursor-pointer",style:{background:"var(--accent)",color:"#fff",opacity:r?.6:1},children:r?"Reloading...":"Reload"}),a.jsx("button",{onClick:()=>t(!1),className:"text-sm cursor-pointer px-1",style:{color:"var(--text-muted)",background:"none",border:"none"},children:"✕"})]})]})}let mu=0;const Ji=Ot(e=>({toasts:[],addToast:(t,n)=>{const r=String(++mu);e(s=>({toasts:[...s.toasts,{id:r,type:t,message:n}]})),setTimeout(()=>{e(s=>({toasts:s.toasts.filter(o=>o.id!==r)}))},t==="error"?8e3:5e3)},removeToast:t=>{e(n=>({toasts:n.toasts.filter(r=>r.id!==t)}))}})),Qi={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 eo(){const e=Ji(n=>n.toasts),t=Ji(n=>n.removeToast);return e.length===0?null:a.jsx("div",{className:"fixed bottom-8 right-4 z-[100] flex flex-col gap-2 pointer-events-none",children:e.map(n=>{const r=Qi[n.type]??Qi.info;return a.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:[a.jsx("span",{className:"flex-1",children:n.message}),a.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:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:[a.jsx("line",{x1:"1",y1:"1",x2:"9",y2:"9"}),a.jsx("line",{x1:"9",y1:"1",x2:"1",y2:"9"})]})})]},n.id)})})}function hu(e){return e===null?"-":`${Math.round(e*100)}%`}function gu(e){if(e===null)return"var(--text-muted)";const t=e*100;return t>=80?"var(--success)":t>=50?"var(--warning)":"var(--error)"}const to={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 no(){const e=Ae(l=>l.evalSets),t=Ae(l=>l.evalRuns),{evalSetId:n,evalRunId:r,navigate:i}=st(),s=Object.values(e),o=Object.values(t).sort((l,u)=>new Date(u.start_time??0).getTime()-new Date(l.start_time??0).getTime());return a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsx("button",{onClick:()=>i("#/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"}),a.jsx("div",{className:"px-3 pt-3 pb-1 text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"Eval Sets"}),s.map(l=>{const u=n===l.id;return a.jsxs("button",{onClick:()=>i(`#/evals/sets/${l.id}`),className:"w-full text-left px-3 py-1.5 text-xs cursor-pointer transition-colors",style:{background:u?"color-mix(in srgb, var(--accent) 15%, var(--bg-primary))":"transparent",color:u?"var(--text-primary)":"var(--text-secondary)",borderLeft:u?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:c=>{u||(c.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:c=>{u||(c.currentTarget.style.background="transparent")},children:[a.jsx("div",{className:"truncate font-medium",children:l.name}),a.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)}),s.length===0&&a.jsx("p",{className:"text-[11px] px-3 py-2",style:{color:"var(--text-muted)"},children:"No eval sets yet"}),a.jsx("div",{className:"px-3 pt-4 pb-1 text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"History"}),o.map(l=>{const u=r===l.id,c=to[l.status]??to.pending;return a.jsx("button",{onClick:()=>i(`#/evals/runs/${l.id}`),className:"w-full text-left px-3 py-1.5 text-xs cursor-pointer transition-colors",style:{background:u?"color-mix(in srgb, var(--accent) 15%, var(--bg-primary))":"transparent",color:u?"var(--text-primary)":"var(--text-secondary)",borderLeft:u?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:d=>{u||(d.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:d=>{u||(d.currentTarget.style.background="transparent")},children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:c.color}}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"truncate font-medium",children:l.eval_set_name}),a.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-muted)"},children:l.start_time?new Date(l.start_time).toLocaleString():c.label})]}),a.jsx("span",{className:"font-mono shrink-0",style:{color:gu(l.overall_score)},children:hu(l.overall_score)})]})},l.id)}),o.length===0&&a.jsx("p",{className:"text-[11px] px-3 py-2",style:{color:"var(--text-muted)"},children:"No eval runs yet"})]})}function ro(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 bu({evalSetId:e}){const[t,n]=S.useState(null),[r,i]=S.useState(!0),[s,o]=S.useState(null),[l,u]=S.useState(!1),[c,d]=S.useState("io"),p=Ae(h=>h.evaluators),m=Ae(h=>h.localEvaluators),f=Ae(h=>h.updateEvalSetEvaluators),g=Ae(h=>h.incrementEvalSetCount),x=Ae(h=>h.upsertEvalRun),{navigate:y}=st(),[b,k]=S.useState(!1),[C,j]=S.useState(new Set),[L,T]=S.useState(!1),B=S.useRef(null),[O,w]=S.useState(()=>{const h=localStorage.getItem("evalSetSidebarWidth");return h?parseInt(h,10):320}),[_,M]=S.useState(!1),R=S.useRef(null);S.useEffect(()=>{localStorage.setItem("evalSetSidebarWidth",String(O))},[O]),S.useEffect(()=>{i(!0),o(null),dc(e).then(h=>{n(h),h.items.length>0&&o(h.items[0].name)}).catch(console.error).finally(()=>i(!1))},[e]);const D=async()=>{u(!0);try{const h=await pc(e);x(h),y(`#/evals/runs/${h.id}`)}catch(h){console.error(h)}finally{u(!1)}},N=async h=>{if(t)try{await uc(e,h),n(F=>{if(!F)return F;const $=F.items.filter(v=>v.name!==h);return{...F,items:$,eval_count:$.length}}),g(e,-1),s===h&&o(null)}catch(F){console.error(F)}},E=S.useCallback(()=>{t&&j(new Set(t.evaluator_ids)),k(!0)},[t]),I=h=>{j(F=>{const $=new Set(F);return $.has(h)?$.delete(h):$.add(h),$})},G=async()=>{if(t){T(!0);try{const h=await hc(e,Array.from(C));n(h),f(e,h.evaluator_ids),k(!1)}catch(h){console.error(h)}finally{T(!1)}}};S.useEffect(()=>{if(!b)return;const h=F=>{B.current&&!B.current.contains(F.target)&&k(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[b]);const H=S.useCallback(h=>{h.preventDefault(),M(!0);const F="touches"in h?h.touches[0].clientX:h.clientX,$=O,v=W=>{const U=R.current;if(!U)return;const re="touches"in W?W.touches[0].clientX:W.clientX,de=U.clientWidth-300,be=Math.max(280,Math.min(de,$+(F-re)));w(be)},ie=()=>{M(!1),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",ie),document.removeEventListener("touchmove",v),document.removeEventListener("touchend",ie),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",v),document.addEventListener("mouseup",ie),document.addEventListener("touchmove",v,{passive:!1}),document.addEventListener("touchend",ie)},[O]);if(r)return a.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)] text-sm",children:"Loading..."});if(!t)return a.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)]",children:"Eval set not found"});const V=t.items.find(h=>h.name===s)??null;return a.jsxs("div",{ref:R,className:"flex h-full",children:[a.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[a.jsxs("div",{className:"px-4 h-10 border-b shrink-0 flex items-center gap-4",style:{borderColor:"var(--border)"},children:[a.jsx("h1",{className:"text-base font-semibold",style:{color:"var(--text-primary)"},children:t.name}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-muted)"},children:[t.eval_count," items"]}),a.jsxs("div",{className:"flex gap-1 items-center ml-auto relative",children:[a.jsx("button",{onClick:E,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:h=>{h.currentTarget.style.color="var(--text-primary)",h.currentTarget.style.background="var(--bg-secondary)"},onMouseLeave:h=>{h.currentTarget.style.color="var(--text-muted)",h.currentTarget.style.background="transparent"},title:"Edit evaluators","aria-label":"Edit evaluators",children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"}),a.jsx("path",{d:"m15 5 4 4"})]})}),t.evaluator_ids.map(h=>{const F=p.find($=>$.id===h);return a.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)??h},h)}),b&&a.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:[a.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"}),a.jsx("div",{className:"max-h-48 overflow-y-auto",children:m.length===0?a.jsx("div",{className:"px-3 py-3 text-xs",style:{color:"var(--text-muted)"},children:"No evaluators available"}):m.map(h=>a.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:[a.jsx("input",{type:"checkbox",checked:C.has(h.id),onChange:()=>I(h.id),className:"accent-[var(--accent)]"}),a.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:h.name})]},h.id))}),a.jsx("div",{className:"px-3 py-2 border-t flex justify-end",style:{borderColor:"var(--border)"},children:a.jsx("button",{onClick:G,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:h=>{h.currentTarget.style.background="var(--accent-hover)"},onMouseLeave:h=>{h.currentTarget.style.background="var(--accent)"},children:L?"Saving...":"Update"})})]})]}),a.jsxs("button",{onClick:D,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:h=>{l||(h.currentTarget.style.background="color-mix(in srgb, var(--success) 10%, transparent)")},onMouseLeave:h=>{h.currentTarget.style.background="transparent"},title:"Run eval set","aria-label":"Run eval set",children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",children:a.jsx("polygon",{points:"5,3 19,12 5,21"})}),l?"Running...":"Run"]})]}),a.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:[a.jsx("span",{className:"w-56 shrink-0",children:"Name"}),a.jsx("span",{className:"flex-1 min-w-0",children:"Input"}),a.jsx("span",{className:"w-32 shrink-0 pl-2",children:"Expected Behavior"}),a.jsx("span",{className:"w-32 shrink-0 pl-2",children:"Expected Output"}),a.jsx("span",{className:"w-32 shrink-0 pl-2",children:"Simulation Instr."}),a.jsx("span",{className:"w-8 shrink-0"})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[t.items.map(h=>{const F=h.name===s;return a.jsxs("button",{onClick:()=>o(F?null:h.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:$=>{F||($.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:$=>{F||($.currentTarget.style.background="")},children:[a.jsx("span",{className:"w-56 shrink-0 truncate",style:{color:"var(--text-primary)"},children:h.name}),a.jsx("span",{className:"flex-1 min-w-0 truncate font-mono text-[11px]",style:{color:"var(--text-muted)"},children:ro(h.inputs)}),a.jsx("span",{className:"w-32 shrink-0 truncate pl-2 text-[11px]",style:{color:"var(--text-muted)"},children:h.expected_behavior||"-"}),a.jsx("span",{className:"w-32 shrink-0 truncate pl-2 font-mono text-[11px]",style:{color:"var(--text-muted)"},children:ro(h.expected_output,40)}),a.jsx("span",{className:"w-32 shrink-0 truncate pl-2 text-[11px]",style:{color:"var(--text-muted)"},children:h.simulation_instructions||"-"}),a.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:$=>{$.stopPropagation(),N(h.name)},onKeyDown:$=>{$.key==="Enter"&&($.stopPropagation(),N(h.name))},style:{color:"var(--text-muted)"},onMouseEnter:$=>{$.currentTarget.style.color="var(--error)"},onMouseLeave:$=>{$.currentTarget.style.color="var(--text-muted)"},title:"Delete item",children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},h.name)}),t.items.length===0&&a.jsx("div",{className:"flex items-center justify-center py-8 text-[var(--text-muted)] text-xs",children:"No items in this eval set"})]})]}),a.jsx("div",{onMouseDown:H,onTouchStart:H,className:`shrink-0 drag-handle-col${_?"":" transition-all"}`,style:{width:V?3:0,opacity:V?1:0}}),a.jsxs("div",{className:`shrink-0 flex flex-col overflow-hidden${_?"":" transition-[width] duration-200 ease-in-out"}`,style:{width:V?O:0,background:"var(--bg-primary)"},children:[a.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:O},children:["io","evaluators"].map(h=>{const F=c===h,$=h==="io"?"I/O":"Evaluators";return a.jsx("button",{onClick:()=>d(h),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:$},h)})}),a.jsx("div",{className:"flex-1 overflow-hidden",style:{minWidth:O},children:V?c==="io"?a.jsx(xu,{item:V}):a.jsx(yu,{item:V,evaluators:p}):null})]})]})}function xu({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 a.jsxs("div",{className:"p-2 overflow-y-auto h-full space-y-1.5",children:[a.jsx(_t,{title:"Input",copyText:t,children:a.jsx(ot,{json:t,className:"px-3 py-2 text-xs font-mono whitespace-pre-wrap break-words"})}),e.expected_behavior&&a.jsx(_t,{title:"Expected Behavior",copyText:e.expected_behavior,children:a.jsx("div",{className:"px-3 py-2 text-xs leading-relaxed whitespace-pre-wrap",style:{color:"var(--text-secondary)"},children:e.expected_behavior})}),n&&a.jsx(_t,{title:"Expected Output",copyText:n,children:a.jsx(ot,{json:n,className:"px-3 py-2 text-xs font-mono whitespace-pre-wrap break-words"})}),e.simulation_instructions&&a.jsx(_t,{title:"Simulation Instructions",copyText:e.simulation_instructions,children:a.jsx("div",{className:"px-3 py-2 text-xs leading-relaxed whitespace-pre-wrap",style:{color:"var(--text-secondary)"},children:e.simulation_instructions})})]})}function yu({item:e,evaluators:t}){return a.jsx("div",{className:"p-2 overflow-y-auto h-full space-y-1.5",children:e.evaluator_ids.length>0?a.jsx(a.Fragment,{children:e.evaluator_ids.map(n=>{var s;const r=t.find(o=>o.id===n),i=(s=e.evaluation_criterias)==null?void 0:s[n];return a.jsxs("div",{className:"overflow-hidden",style:{border:"1px solid var(--border)"},children:[a.jsxs("div",{className:"px-3 py-2 flex items-center gap-2",style:{background:"var(--bg-secondary)"},children:[a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:(r==null?void 0:r.name)??n}),a.jsx("span",{className:"ml-auto text-[10px]",style:{color:"var(--text-muted)"},children:i?"Custom criteria":"Default criteria"})]}),i&&a.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(i,null,2)})]},n)})}):a.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)] text-xs",children:"No evaluators configured for this item"})})}function en(e){return e===null?"-":`${Math.round(e*100)}%`}function wt(e){if(e===null)return"var(--text-muted)";const t=e*100;return t>=80?"var(--success)":t>=50?"var(--warning)":"var(--error)"}function vu(e,t){if(!e)return"-";const n=new Date(e).getTime(),r=t?new Date(t).getTime():Date.now(),i=Math.round((r-n)/1e3);return i<60?`${i}s`:`${Math.floor(i/60)}m ${i%60}s`}function io(e){return e.replace(/\s*Evaluator$/i,"")}const oo={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]=S.useState(null),[i,s]=S.useState(!0),{navigate:o}=st(),l=t??null,[u,c]=S.useState(220),d=S.useRef(null),p=S.useRef(!1),[m,f]=S.useState(()=>{const M=localStorage.getItem("evalSidebarWidth");return M?parseInt(M,10):320}),[g,x]=S.useState(!1),y=S.useRef(null);S.useEffect(()=>{localStorage.setItem("evalSidebarWidth",String(m))},[m]);const b=Ae(M=>M.evalRuns[e]),k=Ae(M=>M.evaluators);S.useEffect(()=>{s(!0),Oi(e).then(M=>{if(r(M),!t){const R=M.results.find(D=>D.status==="completed")??M.results[0];R&&o(`#/evals/runs/${e}/${encodeURIComponent(R.name)}`)}}).catch(console.error).finally(()=>s(!1))},[e]),S.useEffect(()=>{((b==null?void 0:b.status)==="completed"||(b==null?void 0:b.status)==="failed")&&Oi(e).then(r).catch(console.error)},[b==null?void 0:b.status,e]),S.useEffect(()=>{if(t||!(n!=null&&n.results))return;const M=n.results.find(R=>R.status==="completed")??n.results[0];M&&o(`#/evals/runs/${e}/${encodeURIComponent(M.name)}`)},[n==null?void 0:n.results]);const C=S.useCallback(M=>{M.preventDefault(),p.current=!0;const R="touches"in M?M.touches[0].clientY:M.clientY,D=u,N=I=>{if(!p.current)return;const G=d.current;if(!G)return;const H="touches"in I?I.touches[0].clientY:I.clientY,V=G.clientHeight-100,h=Math.max(80,Math.min(V,D+(H-R)));c(h)},E=()=>{p.current=!1,document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",E),document.removeEventListener("touchmove",N),document.removeEventListener("touchend",E),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",N),document.addEventListener("mouseup",E),document.addEventListener("touchmove",N,{passive:!1}),document.addEventListener("touchend",E)},[u]),j=S.useCallback(M=>{M.preventDefault(),x(!0);const R="touches"in M?M.touches[0].clientX:M.clientX,D=m,N=I=>{const G=y.current;if(!G)return;const H="touches"in I?I.touches[0].clientX:I.clientX,V=G.clientWidth-300,h=Math.max(280,Math.min(V,D+(R-H)));f(h)},E=()=>{x(!1),document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",E),document.removeEventListener("touchmove",N),document.removeEventListener("touchend",E),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",N),document.addEventListener("mouseup",E),document.addEventListener("touchmove",N,{passive:!1}),document.addEventListener("touchend",E)},[m]);if(i)return a.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)] text-sm",children:"Loading..."});if(!n)return a.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)]",children:"Eval run not found"});const L=b??n,T=oo[L.status]??oo.pending,B=L.status==="running",O=Object.keys(L.evaluator_scores??{}),w=n.results.find(M=>M.name===l)??null,_=((w==null?void 0:w.traces)??[]).map(M=>({...M,run_id:""}));return a.jsxs("div",{ref:y,className:"flex h-full",children:[a.jsxs("div",{ref:d,className:"flex flex-col flex-1 min-w-0",children:[a.jsxs("div",{className:"px-4 h-10 border-b shrink-0 flex items-center gap-4",style:{borderColor:"var(--border)"},children:[a.jsx("h1",{className:"text-base font-semibold truncate min-w-0",style:{color:"var(--text-primary)"},children:L.eval_set_name}),a.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}),a.jsx("span",{className:"text-sm font-bold font-mono",style:{color:wt(L.overall_score)},children:en(L.overall_score)}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-muted)"},children:vu(L.start_time,L.end_time)}),B&&a.jsxs("div",{className:"flex items-center gap-2 max-w-[160px]",children:[a.jsx("div",{className:"flex-1 h-2 rounded-full overflow-hidden",style:{background:"var(--bg-tertiary)"},children:a.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)"}})}),a.jsxs("span",{className:"text-[11px] shrink-0",style:{color:"var(--text-muted)"},children:[L.progress_completed,"/",L.progress_total]})]}),O.length>0&&a.jsx("div",{className:"flex gap-3 ml-auto",children:O.map(M=>{const R=k.find(N=>N.id===M),D=L.evaluator_scores[M];return a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-muted)"},children:io((R==null?void 0:R.name)??M)}),a.jsx("div",{className:"w-12 h-2 rounded-full overflow-hidden",style:{background:"var(--bg-tertiary)"},children:a.jsx("div",{className:"h-full rounded-full",style:{width:`${D*100}%`,background:wt(D)}})}),a.jsx("span",{className:"text-[11px] font-mono",style:{color:wt(D)},children:en(D)})]},M)})})]}),a.jsxs("div",{className:"shrink-0 overflow-hidden flex flex-col",style:{height:u},children:[a.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:[a.jsx("span",{className:"w-5 shrink-0"}),a.jsx("span",{className:"flex-1 min-w-0",children:"Name"}),a.jsx("span",{className:"w-14 shrink-0 text-right",children:"Score"}),O.map(M=>{const R=k.find(D=>D.id===M);return a.jsx("span",{className:"w-36 shrink-0 text-right truncate pl-2",title:(R==null?void 0:R.name)??M,children:io((R==null?void 0:R.name)??M)},M)}),a.jsx("span",{className:"w-14 shrink-0 text-right",children:"Time"})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[n.results.map(M=>{const R=M.status==="pending",D=M.status==="failed",N=M.name===l;return a.jsxs("button",{onClick:()=>{o(N?`#/evals/runs/${e}`:`#/evals/runs/${e}/${encodeURIComponent(M.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:N?"color-mix(in srgb, var(--accent) 10%, var(--bg-primary))":void 0,borderLeft:N?"2px solid var(--accent)":"2px solid transparent",opacity:R?.5:1},onMouseEnter:E=>{N||(E.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:E=>{N||(E.currentTarget.style.background="")},children:[a.jsx("span",{className:"w-5 shrink-0 flex justify-center",children:a.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:R?"var(--text-muted)":D?"var(--error)":M.overall_score>=.8?"var(--success)":M.overall_score>=.5?"var(--warning)":"var(--error)"}})}),a.jsx("span",{className:"flex-1 min-w-0 truncate",style:{color:"var(--text-primary)"},children:M.name}),a.jsx("span",{className:"w-14 shrink-0 text-right font-mono font-semibold",style:{color:wt(R?null:M.overall_score)},children:R?"-":en(M.overall_score)}),O.map(E=>a.jsx("span",{className:"w-36 shrink-0 text-right font-mono pl-2",style:{color:wt(R?null:M.scores[E]??null)},children:R?"-":en(M.scores[E]??null)},E)),a.jsx("span",{className:"w-14 shrink-0 text-right",style:{color:"var(--text-muted)"},children:M.duration_ms!==null?`${(M.duration_ms/1e3).toFixed(1)}s`:"-"})]},M.name)}),n.results.length===0&&a.jsx("div",{className:"flex items-center justify-center py-8 text-[var(--text-muted)] text-xs",children:B?"Waiting for results...":"No results"})]})]}),a.jsx("div",{onMouseDown:C,onTouchStart:C,className:"shrink-0 drag-handle-row"}),a.jsx("div",{className:"flex-1 overflow-hidden",children:w&&_.length>0?a.jsx(Lr,{traces:_}):a.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)] text-xs",children:(w==null?void 0:w.status)==="pending"?"Pending...":"No traces available"})})]}),a.jsx("div",{onMouseDown:j,onTouchStart:j,className:`shrink-0 drag-handle-col${g?"":" transition-all"}`,style:{width:w?3:0,opacity:w?1:0}}),a.jsx(wu,{width:m,item:w,evaluators:k,isRunning:B,isDragging:g})]})}const Eu=[{id:"score",label:"Score"},{id:"io",label:"I/O"},{id:"logs",label:"Logs"}];function wu({width:e,item:t,evaluators:n,isRunning:r,isDragging:i}){const[s,o]=S.useState("score"),l=!!t;return a.jsxs("div",{className:`shrink-0 flex flex-col overflow-hidden${i?"":" transition-[width] duration-200 ease-in-out"}`,style:{width:l?e:0,background:"var(--bg-primary)"},children:[a.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:[Eu.map(u=>a.jsx("button",{onClick:()=>o(u.id),className:"px-2.5 py-1 h-7 text-xs font-semibold rounded transition-colors cursor-pointer",style:{color:s===u.id?"var(--accent)":"var(--text-muted)",background:s===u.id?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent",border:"none"},onMouseEnter:c=>{s!==u.id&&(c.currentTarget.style.color="var(--text-primary)")},onMouseLeave:c=>{s!==u.id&&(c.currentTarget.style.color="var(--text-muted)")},children:u.label},u.id)),r&&a.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..."})]}),a.jsx("div",{className:"flex-1 overflow-y-auto",style:{minWidth:e},children:t?t.status==="pending"?a.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)] text-xs",children:"Pending..."}):a.jsxs(a.Fragment,{children:[t.status==="failed"&&a.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:[a.jsxs("div",{className:"flex items-center gap-2 font-semibold",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[a.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),a.jsx("path",{d:"M8 4.5v4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),a.jsx("circle",{cx:"8",cy:"11",r:"0.75",fill:"currentColor"})]}),a.jsx("span",{children:"Evaluator error"})]}),t.error&&a.jsx("div",{className:"mt-1 pl-[22px] text-[11px] opacity-80 break-words",style:{color:"var(--text-secondary)"},children:t.error})]}),s==="score"?a.jsx(_u,{item:t,evaluators:n}):s==="io"?a.jsx(Nu,{item:t}):a.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)] text-xs",children:"Logs coming soon"})]}):null})]})}function _u({item:e,evaluators:t}){const n=Object.keys(e.scores);return a.jsxs("div",{className:"p-2 overflow-y-auto h-full space-y-1.5",children:[a.jsx("div",{className:"overflow-hidden",style:{border:"1px solid var(--border)"},children:a.jsxs("div",{className:"px-3 py-2 flex items-center gap-2",style:{background:"var(--bg-secondary)"},children:[a.jsx("span",{className:"truncate text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Overall"}),a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a.jsx("div",{className:"w-24 h-2.5 rounded-full overflow-hidden",style:{background:"var(--bg-tertiary)"},children:a.jsx("div",{className:"h-full rounded-full",style:{width:`${e.overall_score*100}%`,background:wt(e.overall_score)}})}),a.jsx("span",{className:"text-xs font-mono font-bold shrink-0 w-10 text-right",style:{color:wt(e.overall_score)},children:en(e.overall_score)})]})]})}),e.status==="failed"&&n.length===0&&a.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 i=t.find(l=>l.id===r),s=e.scores[r],o=e.justifications[r];return a.jsxs("div",{className:"overflow-hidden",style:{border:"1px solid var(--border)"},children:[a.jsxs("div",{className:"px-3 py-2 flex items-center gap-2",style:{background:"var(--bg-secondary)"},children:[a.jsx("span",{className:"truncate text-[11px] font-semibold",style:{color:"var(--text-primary)"},title:(i==null?void 0:i.name)??r,children:(i==null?void 0:i.name)??r}),a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a.jsx("div",{className:"w-24 h-2.5 rounded-full overflow-hidden",style:{background:"var(--bg-tertiary)"},children:a.jsx("div",{className:"h-full rounded-full",style:{width:`${s*100}%`,background:wt(s)}})}),a.jsx("span",{className:"text-xs font-mono font-bold shrink-0 w-10 text-right",style:{color:wt(s)},children:en(s)})]})]}),o&&a.jsx(Tu,{text:o})]},r)})]})}function Nu({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 a.jsxs("div",{className:"p-2 overflow-y-auto h-full space-y-1.5",children:[a.jsx(_t,{title:"Input",copyText:t,children:a.jsx(ot,{json:t,className:"px-3 py-2 text-xs font-mono whitespace-pre-wrap break-words"})}),r&&a.jsx(_t,{title:"Expected Output",copyText:r,children:a.jsx(ot,{json:r,className:"px-3 py-2 text-xs font-mono whitespace-pre-wrap break-words"})}),a.jsx(_t,{title:"Output",copyText:n,trailing:e.duration_ms!==null?a.jsxs("span",{className:"ml-auto text-[10px]",style:{color:"var(--text-muted)"},children:[(e.duration_ms/1e3).toFixed(2),"s"]}):void 0,children:a.jsx(ot,{json:n,className:"px-3 py-2 text-xs font-mono whitespace-pre-wrap break-words"})})]})}function Su(e){var i;const t=e.match(/expected="(.+?)"\s+actual="(.+?)"(.*)/s);if(!t)return null;const n={},r=((i=t[3])==null?void 0:i.trim())??"";if(r)for(const s of r.match(/(\w+)=([\S]+)/g)??[]){const o=s.indexOf("=");n[s.slice(0,o)]=s.slice(o+1)}return{expected:t[1],actual:t[2],meta:n}}function so(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 Tu({text:e}){const t=Su(e);if(!t)return a.jsx("div",{className:"px-3 py-2 border-t",style:{borderColor:"var(--border)"},children:a.jsx("div",{className:"text-xs leading-relaxed",style:{color:"var(--text-secondary)"},children:e})});const n=so(t.expected),r=so(t.actual),i=n===r;return a.jsxs("div",{className:"border-t",style:{borderColor:"var(--border)"},children:[a.jsxs("div",{className:"grid grid-cols-2 gap-0",children:[a.jsxs("div",{className:"px-3 py-2 border-r",style:{borderColor:"var(--border)"},children:[a.jsx("div",{className:"text-[10px] font-semibold mb-1",style:{color:"var(--text-muted)"},children:"Expected"}),a.jsx("pre",{className:"text-[11px] font-mono whitespace-pre-wrap break-words",style:{color:"var(--text-secondary)"},children:n})]}),a.jsxs("div",{className:"px-3 py-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[a.jsx("span",{className:"text-[10px] font-semibold",style:{color:"var(--text-muted)"},children:"Actual"}),a.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:i?"var(--success)":"var(--error)"}})]}),a.jsx("pre",{className:"text-[11px] font-mono whitespace-pre-wrap break-words",style:{color:i?"var(--success)":"var(--error)"},children:r})]})]}),Object.keys(t.meta).length>0&&a.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(([s,o])=>a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-muted)"},children:[a.jsx("span",{className:"font-medium",children:s.replace(/_/g," ")})," ",a.jsx("span",{className:"font-mono",children:o})]},s))})]})}const ao={deterministic:"var(--success)",llm:"#a78bfa",tool:"var(--info)"};function lo(){const e=Ae(f=>f.localEvaluators),t=Ae(f=>f.addEvalSet),{navigate:n}=st(),[r,i]=S.useState(""),[s,o]=S.useState(new Set),[l,u]=S.useState(null),[c,d]=S.useState(!1),p=f=>{o(g=>{const x=new Set(g);return x.has(f)?x.delete(f):x.add(f),x})},m=async()=>{if(r.trim()){u(null),d(!0);try{const f=await lc({name:r.trim(),evaluator_refs:Array.from(s)});t(f),n(`#/evals/sets/${f.id}`)}catch(f){u(f.detail||f.message||"Failed to create eval set")}finally{d(!1)}}};return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"w-full max-w-xl px-6",children:[a.jsxs("div",{className:"mb-8 text-center",children:[a.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:"var(--accent)"}}),a.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--text-muted)"},children:"New Eval Set"})]}),a.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:"Create an evaluation set with a name and evaluators"})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Name"}),a.jsx("input",{type:"text",value:r,onChange:f=>i(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()}})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Evaluators"}),e.length===0?a.jsxs("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:["No evaluators configured."," ",a.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"})]}):a.jsx("div",{className:"rounded-md border overflow-hidden",style:{borderColor:"var(--border)",background:"var(--bg-secondary)"},children:e.map(f=>a.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:g=>{g.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:[a.jsx("input",{type:"checkbox",checked:s.has(f.id),onChange:()=>p(f.id),className:"accent-[var(--accent)]"}),a.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:f.name}),a.jsx("span",{className:"text-[11px] font-medium px-1.5 py-0.5 rounded",style:{background:`color-mix(in srgb, ${ao[f.type]??"var(--text-muted)"} 15%, transparent)`,color:ao[f.type]??"var(--text-muted)"},children:f.type})]},f.id))})]}),l&&a.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}),a.jsx("button",{onClick:m,disabled:!r.trim()||c,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:c?"Creating...":"Create Eval Set"})]})})}const Cu=[{type:"deterministic",label:"Deterministic",badgeColor:"var(--success)"},{type:"llm",label:"LLM Judge",badgeColor:"#a78bfa"},{type:"tool",label:"Tool-Based",badgeColor:"var(--info)"}];function co(){const e=Ae(s=>s.localEvaluators),{evaluatorFilter:t,evaluatorCreateType:n,navigate:r}=st(),i=!t&&!n;return a.jsxs(a.Fragment,{children:[a.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:s=>{s.currentTarget.style.color="var(--text-primary)",s.currentTarget.style.borderColor="var(--text-muted)"},onMouseLeave:s=>{s.currentTarget.style.color="var(--text-secondary)",s.currentTarget.style.borderColor=""},children:"+ New Evaluator"}),a.jsx("div",{className:"px-3 pt-3 pb-1 text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"Categories"}),a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.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:i?"color-mix(in srgb, var(--accent) 15%, var(--bg-primary))":"transparent",color:i?"var(--text-primary)":"var(--text-secondary)",borderLeft:i?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:s=>{i||(s.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:s=>{i||(s.currentTarget.style.background="transparent")},children:[a.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:"var(--text-muted)"}}),a.jsx("span",{className:"flex-1 truncate",children:"All"}),e.length>0&&a.jsx("span",{className:"text-[10px] px-1.5 rounded-full",style:{background:"var(--bg-tertiary)",color:"var(--text-muted)"},children:e.length})]}),Cu.map(s=>{const o=e.filter(u=>u.type===s.type).length,l=t===s.type;return a.jsxs("button",{onClick:()=>r(l?"#/evaluators":`#/evaluators/category/${s.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:u=>{l||(u.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:u=>{l||(u.currentTarget.style.background="transparent")},children:[a.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:s.badgeColor}}),a.jsx("span",{className:"flex-1 truncate",children:s.label}),o>0&&a.jsx("span",{className:"text-[10px] px-1.5 rounded-full",style:{background:"var(--bg-tertiary)",color:"var(--text-muted)"},children:o})]},s.type)})]})]})}const uo={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)"}},jr={deterministic:"Deterministic",llm:"LLM Judge",tool:"Tool-Based"},pn={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 Os(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 pr={"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 Au(e){for(const[t,n]of Object.entries(pn))if(n.some(r=>r.id===e))return t;return"deterministic"}function Mu({evaluatorId:e,evaluatorFilter:t}){const n=Ae(k=>k.localEvaluators),r=Ae(k=>k.setLocalEvaluators),i=Ae(k=>k.upsertLocalEvaluator),s=Ae(k=>k.evaluators),{navigate:o}=st(),l=e?n.find(k=>k.id===e)??null:null,u=!!l,c=t?n.filter(k=>k.type===t):n,[d,p]=S.useState(()=>{const k=localStorage.getItem("evaluatorSidebarWidth");return k?parseInt(k,10):320}),[m,f]=S.useState(!1),g=S.useRef(null);S.useEffect(()=>{localStorage.setItem("evaluatorSidebarWidth",String(d))},[d]),S.useEffect(()=>{Jr().then(r).catch(console.error)},[r]);const x=S.useCallback(k=>{k.preventDefault(),f(!0);const C="touches"in k?k.touches[0].clientX:k.clientX,j=d,L=B=>{const O=g.current;if(!O)return;const w="touches"in B?B.touches[0].clientX:B.clientX,_=O.clientWidth-300,M=Math.max(280,Math.min(_,j+(C-w)));p(M)},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]),y=k=>{i(k)},b=()=>{o("#/evaluators")};return a.jsxs("div",{ref:g,className:"flex h-full",children:[a.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[a.jsxs("div",{className:"px-4 h-10 border-b shrink-0 flex items-center gap-4",style:{borderColor:"var(--border)"},children:[a.jsx("h1",{className:"text-base font-semibold",style:{color:"var(--text-primary)"},children:"Evaluators"}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-muted)"},children:[c.length,t?` / ${n.length}`:""," configured"]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:c.length===0?a.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."}):a.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(320px, 1fr))"},children:c.map(k=>a.jsx(Iu,{evaluator:k,evaluators:s,selected:k.id===e,onClick:()=>o(k.id===e?"#/evaluators":`#/evaluators/${encodeURIComponent(k.id)}`)},k.id))})})]}),a.jsx("div",{onMouseDown:x,onTouchStart:x,className:`shrink-0 drag-handle-col${m?"":" transition-all"}`,style:{width:u?3:0,opacity:u?1:0}}),a.jsxs("div",{className:`shrink-0 flex flex-col overflow-hidden${m?"":" transition-[width] duration-200 ease-in-out"}`,style:{width:u?d:0,background:"var(--bg-primary)"},children:[a.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:[a.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"}),a.jsx("button",{onClick:b,"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:k=>{k.currentTarget.style.color="var(--text-primary)"},onMouseLeave:k=>{k.currentTarget.style.color="var(--text-muted)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsx("div",{className:"flex-1 overflow-hidden",style:{minWidth:d},children:l&&a.jsx(Ru,{evaluator:l,onUpdated:y})})]})]})}function Iu({evaluator:e,evaluators:t,selected:n,onClick:r}){const i=uo[e.type]??uo.deterministic,s=t.find(l=>l.id===e.evaluator_type_id),o=e.evaluator_type_id.startsWith("file://");return a.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:[a.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--text-primary)"},children:e.name}),e.description&&a.jsx("div",{className:"text-xs leading-relaxed mt-2",style:{color:"var(--text-secondary)"},children:e.description}),a.jsxs("div",{className:"flex flex-wrap gap-1.5 mt-auto pt-3",children:[a.jsxs("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium",style:{color:i.color,background:i.bg},children:["Category: ",i.label]}),a.jsxs("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium",style:{background:"var(--bg-tertiary)",color:"var(--text-secondary)"},children:["Type: ",o?"Custom":(s==null?void 0:s.name)??e.evaluator_type_id]}),a.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 Ru({evaluator:e,onUpdated:t}){var L,T;const n=Au(e.evaluator_type_id),r=pn[n]??[],[i,s]=S.useState(e.description),[o,l]=S.useState(e.evaluator_type_id),[u,c]=S.useState(((L=e.config)==null?void 0:L.targetOutputKey)??"*"),[d,p]=S.useState(((T=e.config)==null?void 0:T.prompt)??""),[m,f]=S.useState(!1),[g,x]=S.useState(null),[y,b]=S.useState(!1);S.useEffect(()=>{var B,O;s(e.description),l(e.evaluator_type_id),c(((B=e.config)==null?void 0:B.targetOutputKey)??"*"),p(((O=e.config)==null?void 0:O.prompt)??""),x(null),b(!1)},[e.id]);const k=Os(o),C=async()=>{f(!0),x(null),b(!1);try{const B={};k.targetOutputKey&&(B.targetOutputKey=u),k.prompt&&d.trim()&&(B.prompt=d);const O=await gc(e.id,{description:i.trim(),evaluator_type_id:o,config:B});t(O),b(!0),setTimeout(()=>b(!1),2e3)}catch(B){const O=B==null?void 0:B.detail;x(O??"Failed to update evaluator")}finally{f(!1)}},j={background:"var(--bg-secondary)",color:"var(--text-primary)",border:"1px solid var(--border)"};return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"p-4 overflow-y-auto flex-1 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[11px] font-medium block mb-1",style:{color:"var(--text-muted)"},children:"Name"}),a.jsx("div",{className:"px-3 py-2 rounded-lg text-xs",style:{background:"var(--bg-tertiary)",color:"var(--text-secondary)"},children:e.name})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[11px] font-medium block mb-1",style:{color:"var(--text-muted)"},children:"Category"}),a.jsx("div",{className:"px-3 py-2 rounded-lg text-xs",style:{background:"var(--bg-tertiary)",color:"var(--text-secondary)"},children:jr[n]??n})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[11px] font-medium block mb-1",style:{color:"var(--text-muted)"},children:"Type"}),a.jsx("select",{value:o,onChange:B=>l(B.target.value),className:"w-full px-3 py-2 rounded-lg text-xs outline-none cursor-pointer",style:j,children:r.map(B=>a.jsx("option",{value:B.id,children:B.name},B.id))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[11px] font-medium block mb-1",style:{color:"var(--text-muted)"},children:"Description"}),a.jsx("textarea",{value:i,onChange:B=>s(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:j})]}),k.targetOutputKey&&a.jsxs("div",{children:[a.jsx("label",{className:"text-[11px] font-medium block mb-1",style:{color:"var(--text-muted)"},children:"Target Output Key"}),a.jsx("input",{type:"text",value:u,onChange:B=>c(B.target.value),placeholder:"*",className:"w-full px-3 py-2 rounded-lg text-xs outline-none",style:j}),a.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-muted)"},children:"Use * for entire output or a specific key name"})]}),k.prompt&&a.jsxs("div",{children:[a.jsx("label",{className:"text-[11px] font-medium block mb-1",style:{color:"var(--text-muted)"},children:"Prompt"}),a.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:j})]})]}),a.jsxs("div",{className:"shrink-0 p-4 space-y-2",children:[g&&a.jsx("div",{className:"text-xs px-3 py-2 rounded-lg",style:{background:"rgba(239,68,68,0.1)",color:"var(--error)"},children:g}),y&&a.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"}),a.jsx("button",{onClick:C,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 Ou=["deterministic","llm","tool"];function Lu({category:e}){var N;const t=Ae(E=>E.addLocalEvaluator),{navigate:n}=st(),r=e!=="any",[i,s]=S.useState(r?e:"deterministic"),o=pn[i]??[],[l,u]=S.useState(""),[c,d]=S.useState(""),[p,m]=S.useState(((N=o[0])==null?void 0:N.id)??""),[f,g]=S.useState("*"),[x,y]=S.useState(""),[b,k]=S.useState(!1),[C,j]=S.useState(null),[L,T]=S.useState(!1),[B,O]=S.useState(!1);S.useEffect(()=>{var V;const E=r?e:"deterministic";s(E);const G=((V=(pn[E]??[])[0])==null?void 0:V.id)??"",H=pr[G];u(""),d((H==null?void 0:H.description)??""),m(G),g("*"),y((H==null?void 0:H.prompt)??""),j(null),T(!1),O(!1)},[e,r]);const w=E=>{var V;s(E);const G=((V=(pn[E]??[])[0])==null?void 0:V.id)??"",H=pr[G];m(G),L||d((H==null?void 0:H.description)??""),B||y((H==null?void 0:H.prompt)??"")},_=E=>{m(E);const I=pr[E];I&&(L||d(I.description),B||y(I.prompt))},M=Os(p),R=async()=>{if(!l.trim()){j("Name is required");return}k(!0),j(null);try{const E={};M.targetOutputKey&&(E.targetOutputKey=f),M.prompt&&x.trim()&&(E.prompt=x);const I=await mc({name:l.trim(),description:c.trim(),evaluator_type_id:p,config:E});t(I),n("#/evaluators")}catch(E){const I=E==null?void 0:E.detail;j(I??"Failed to create evaluator")}finally{k(!1)}},D={background:"var(--bg-secondary)",border:"1px solid var(--border)",color:"var(--text-primary)"};return a.jsx("div",{className:"h-full overflow-y-auto",children:a.jsx("div",{className:"flex items-center justify-center min-h-full py-8",children:a.jsxs("div",{className:"w-full max-w-xl px-6",children:[a.jsxs("div",{className:"mb-8 text-center",children:[a.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:"var(--accent)"}}),a.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--text-muted)"},children:"New Evaluator"})]}),a.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:"Create an evaluator to score agent outputs"})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Name"}),a.jsx("input",{type:"text",value:l,onChange:E=>u(E.target.value),placeholder:"e.g. MyEvaluator",className:"w-full rounded-md px-3 py-2 text-xs",style:D,onKeyDown:E=>{E.key==="Enter"&&l.trim()&&R()}})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Category"}),r?a.jsx("div",{className:"px-3 py-2 rounded-md text-xs",style:{background:"var(--bg-tertiary)",color:"var(--text-secondary)"},children:jr[i]??i}):a.jsx("select",{value:i,onChange:E=>w(E.target.value),className:"w-full rounded-md px-3 py-2 text-xs cursor-pointer appearance-auto",style:D,children:Ou.map(E=>a.jsx("option",{value:E,children:jr[E]},E))})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Type"}),a.jsx("select",{value:p,onChange:E=>_(E.target.value),className:"w-full rounded-md px-3 py-2 text-xs cursor-pointer appearance-auto",style:D,children:o.map(E=>a.jsx("option",{value:E.id,children:E.name},E.id))})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Description"}),a.jsx("textarea",{value:c,onChange:E=>{d(E.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:D})]}),M.targetOutputKey&&a.jsxs("div",{className:"mb-6",children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Target Output Key"}),a.jsx("input",{type:"text",value:f,onChange:E=>g(E.target.value),placeholder:"*",className:"w-full rounded-md px-3 py-2 text-xs",style:D}),a.jsx("div",{className:"text-xs mt-1",style:{color:"var(--text-muted)"},children:"Use * for entire output or a specific key name"})]}),M.prompt&&a.jsxs("div",{className:"mb-6",children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Prompt"}),a.jsx("textarea",{value:x,onChange:E=>{y(E.target.value),O(!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:D})]}),C&&a.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:C}),a.jsx("button",{onClick:R,disabled:b||!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:b?"Creating...":"Create Evaluator"})]})})})}function Ls({path:e,name:t,type:n,depth:r}){const i=Me(b=>b.children[e]),s=Me(b=>!!b.expanded[e]),o=Me(b=>!!b.loadingDirs[e]),l=Me(b=>!!b.dirty[e]),u=Me(b=>b.selectedFile),{setChildren:c,toggleExpanded:d,setLoadingDir:p,openTab:m}=Me(),{navigate:f}=st(),g=n==="directory",x=!g&&u===e,y=S.useCallback(()=>{g?(!i&&!o&&(p(e,!0),Zr(e).then(b=>c(e,b)).catch(console.error).finally(()=>p(e,!1))),d(e)):(m(e),f(`#/explorer/file/${encodeURIComponent(e)}`))},[g,i,o,e,c,d,p,m,f]);return a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:y,className:"w-full text-left flex items-center gap-1 py-[3px] text-[13px] cursor-pointer transition-colors group",style:{paddingLeft:`${12+r*16}px`,paddingRight:"8px",background:x?"color-mix(in srgb, var(--accent) 15%, var(--bg-primary))":"transparent",color:x?"var(--text-primary)":"var(--text-secondary)",border:"none"},onMouseEnter:b=>{x||(b.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:b=>{x||(b.currentTarget.style.background="transparent")},children:[a.jsx("span",{className:"w-3 shrink-0 flex items-center justify-center",style:{color:"var(--text-muted)"},children:g&&a.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:a.jsx("path",{d:"M3 1.5L7 5L3 8.5z"})})}),a.jsx("span",{className:"shrink-0",style:{color:g?"var(--accent)":"var(--text-muted)"},children:g?a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.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"})}):a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),a.jsx("span",{className:"truncate flex-1",children:t}),l&&a.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:"var(--accent)"}}),o&&a.jsx("span",{className:"text-[10px] shrink-0",style:{color:"var(--text-muted)"},children:"..."})]}),g&&s&&i&&i.map(b=>a.jsx(Ls,{path:b.path,name:b.name,type:b.type,depth:r+1},b.path))]})}function po(){const e=Me(n=>n.children[""]),{setChildren:t}=Me();return S.useEffect(()=>{e||Zr("").then(n=>t("",n)).catch(console.error)},[e,t]),a.jsx("div",{className:"flex-1 overflow-y-auto py-1",children:e?e.map(n=>a.jsx(Ls,{path:n.path,name:n.name,type:n.type,depth:0},n.path)):a.jsx("p",{className:"text-[11px] px-3 py-2",style:{color:"var(--text-muted)"},children:"Loading..."})})}const ju=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 fo(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Du(e){const t=e.replace(/\\/g,"/").split("/");return t[t.length-1]||e}function Pu(){const e=Me(w=>w.openTabs),n=Me(w=>w.selectedFile),r=Me(w=>n?w.fileCache[n]:void 0),i=Me(w=>n?!!w.dirty[n]:!1),s=Me(w=>n?w.buffers[n]:void 0),o=Me(w=>w.loadingFile),l=Me(w=>w.dirty),{setFileContent:u,updateBuffer:c,markClean:d,setLoadingFile:p,openTab:m,closeTab:f}=Me(),{navigate:g}=st(),x=Ns(w=>w.theme),y=S.useRef(null),{explorerFile:b}=st();S.useEffect(()=>{b&&m(b)},[b,m]),S.useEffect(()=>{n&&(Me.getState().fileCache[n]||(p(!0),ys(n).then(w=>u(n,w)).catch(console.error).finally(()=>p(!1))))},[n,u,p]);const k=S.useCallback(()=>{if(!n)return;const w=Me.getState().fileCache[n],M=Me.getState().buffers[n]??(w==null?void 0:w.content);M!=null&&Vl(n,M).then(()=>{d(n),u(n,{...w,content:M})}).catch(console.error)},[n,d,u]);S.useEffect(()=>{const w=_=>{(_.ctrlKey||_.metaKey)&&_.key==="s"&&(_.preventDefault(),k())};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[k]);const C=w=>{y.current=w},j=S.useCallback(w=>{w!==void 0&&n&&c(n,w)},[n,c]),L=S.useCallback(w=>{m(w),g(`#/explorer/file/${encodeURIComponent(w)}`)},[m,g]),T=S.useCallback((w,_)=>{w.stopPropagation();const M=Me.getState(),R=M.openTabs.filter(D=>D!==_);if(f(_),M.selectedFile===_){const D=M.openTabs.indexOf(_),N=R[Math.min(D,R.length-1)];g(N?`#/explorer/file/${encodeURIComponent(N)}`:"#/explorer")}},[f,g]),B=S.useCallback((w,_)=>{w.button===1&&T(w,_)},[T]),O=e.length>0&&a.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(w=>{const _=w===n,M=!!l[w];return a.jsxs("button",{onClick:()=>L(w),onMouseDown:R=>B(R,w),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:[a.jsx("span",{className:"truncate",children:Du(w)}),M?a.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:"var(--accent)"},title:"Unsaved changes"}):a.jsx("span",{className:"w-4 h-4 flex items-center justify-center rounded shrink-0 transition-colors",style:{color:"var(--text-muted)"},onClick:R=>T(R,w),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:a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"currentColor",children:a.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"})})})]},w)})});return n?o&&!r?a.jsxs("div",{className:"flex flex-col h-full",children:[O,a.jsx("div",{className:"flex-1 flex items-center justify-center",style:{color:"var(--text-muted)"},children:a.jsx("div",{className:"text-sm",children:"Loading file..."})})]}):!r&&!o?a.jsxs("div",{className:"flex flex-col h-full",children:[O,a.jsx("div",{className:"flex-1 flex items-center justify-center",style:{color:"var(--text-muted)"},children:a.jsx("div",{className:"text-sm",children:"Failed to load file"})})]}):r?r.binary?a.jsxs("div",{className:"flex flex-col h-full",children:[O,a.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:a.jsx("span",{style:{color:"var(--text-muted)"},children:fo(r.size)})}),a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3",style:{color:"var(--text-muted)"},children:[a.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"}),a.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),a.jsx("span",{className:"text-sm",children:"Binary file — preview not available"})]})]}):a.jsxs("div",{className:"flex flex-col h-full",children:[O,a.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&&a.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"var(--bg-hover)",color:"var(--text-muted)"},children:r.language}),a.jsx("span",{style:{color:"var(--text-muted)"},children:fo(r.size)}),a.jsx("div",{className:"flex-1"}),i&&a.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--accent)"},children:"Modified"}),a.jsx("button",{onClick:k,className:"px-2 py-0.5 rounded text-[11px] font-medium cursor-pointer transition-colors",style:{background:i?"var(--accent)":"var(--bg-hover)",color:i?"white":"var(--text-muted)",border:"none"},children:"Save"})]}),a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(Tl,{language:r.language??"plaintext",theme:x==="dark"?"uipath-dark":"uipath-light",value:s??r.content??"",onChange:j,beforeMount:ju,onMount:C,options:{minimap:{enabled:!1},fontSize:13,lineNumbersMinChars:4,scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,tabSize:2,renderWhitespace:"selection"}},n)})]}):null:a.jsxs("div",{className:"flex flex-col h-full",children:[O,a.jsx("div",{className:"flex-1 flex items-center justify-center",style:{color:"var(--text-muted)"},children:"Select a file to view"})]})}const Xn="/api";async function Bu(){const e=await fetch(`${Xn}/agent/models`);if(!e.ok){if(e.status===401)return[];throw new Error(`HTTP ${e.status}`)}return e.json()}async function Fu(e){const t=await fetch(`${Xn}/agent/session/${e}/diagnostics`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}async function zu(e){const t=await fetch(`${Xn}/agent/session/${e}/state`);if(t.status===404)return null;if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}async function $u(){const e=await fetch(`${Xn}/agent/skills`);if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function Uu(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Hu=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Wu=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ku={};function mo(e,t){return(Ku.jsx?Wu:Hu).test(e)}const Gu=/[ \t\n\f\r]/g;function qu(e){return typeof e=="object"?e.type==="text"?ho(e.value):!1:ho(e)}function ho(e){return e.replace(Gu,"")===""}class xn{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}xn.prototype.normal={};xn.prototype.property={};xn.prototype.space=void 0;function js(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new xn(n,r,t)}function Dr(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 Vu=0;const pe=Kt(),Pe=Kt(),Pr=Kt(),q=Kt(),Ce=Kt(),tn=Kt(),Qe=Kt();function Kt(){return 2**++Vu}const Br=Object.freeze(Object.defineProperty({__proto__:null,boolean:pe,booleanish:Pe,commaOrSpaceSeparated:Qe,commaSeparated:tn,number:q,overloadedBoolean:Pr,spaceSeparated:Ce},Symbol.toStringTag,{value:"Module"})),fr=Object.keys(Br);class Qr extends Xe{constructor(t,n,r,i){let s=-1;if(super(t,n),go(this,"space",i),typeof r=="number")for(;++s4&&n.slice(0,4)==="data"&&Qu.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(bo,nd);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!bo.test(s)){let o=s.replace(Ju,td);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Qr}return new i(r,t)}function td(e){return"-"+e.toLowerCase()}function nd(e){return e.charAt(1).toUpperCase()}const rd=js([Ds,Yu,Fs,zs,$s],"html"),ei=js([Ds,Xu,Fs,zs,$s],"svg");function id(e){return e.join(" ").trim()}var Yt={},mr,xo;function od(){if(xo)return mr;xo=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g,u=` +`,c="/",d="*",p="",m="comment",f="declaration";function g(y,b){if(typeof y!="string")throw new TypeError("First argument must be a string");if(!y)return[];b=b||{};var k=1,C=1;function j(N){var E=N.match(t);E&&(k+=E.length);var I=N.lastIndexOf(u);C=~I?N.length-I:C+N.length}function L(){var N={line:k,column:C};return function(E){return E.position=new T(N),w(),E}}function T(N){this.start=N,this.end={line:k,column:C},this.source=b.source}T.prototype.content=y;function B(N){var E=new Error(b.source+":"+k+":"+C+": "+N);if(E.reason=N,E.filename=b.source,E.line=k,E.column=C,E.source=y,!b.silent)throw E}function O(N){var E=N.exec(y);if(E){var I=E[0];return j(I),y=y.slice(I.length),E}}function w(){O(n)}function _(N){var E;for(N=N||[];E=M();)E!==!1&&N.push(E);return N}function M(){var N=L();if(!(c!=y.charAt(0)||d!=y.charAt(1))){for(var E=2;p!=y.charAt(E)&&(d!=y.charAt(E)||c!=y.charAt(E+1));)++E;if(E+=2,p===y.charAt(E-1))return B("End of comment missing");var I=y.slice(2,E-2);return C+=2,j(I),y=y.slice(E),C+=2,N({type:m,comment:I})}}function R(){var N=L(),E=O(r);if(E){if(M(),!O(i))return B("property missing ':'");var I=O(s),G=N({type:f,property:x(E[0].replace(e,p)),value:I?x(I[0].replace(e,p)):p});return O(o),G}}function D(){var N=[];_(N);for(var E;E=R();)E!==!1&&(N.push(E),_(N));return N}return w(),D()}function x(y){return y?y.replace(l,p):p}return mr=g,mr}var yo;function sd(){if(yo)return Yt;yo=1;var e=Yt&&Yt.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.default=n;const t=e(od());function n(r,i){let s=null;if(!r||typeof r!="string")return s;const o=(0,t.default)(r),l=typeof i=="function";return o.forEach(u=>{if(u.type!=="declaration")return;const{property:c,value:d}=u;l?i(c,d,u):d&&(s=s||{},s[c]=d)}),s}return Yt}var an={},vo;function ad(){if(vo)return an;vo=1,Object.defineProperty(an,"__esModule",{value:!0}),an.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(c){return!c||n.test(c)||e.test(c)},o=function(c,d){return d.toUpperCase()},l=function(c,d){return"".concat(d,"-")},u=function(c,d){return d===void 0&&(d={}),s(c)?c:(c=c.toLowerCase(),d.reactCompat?c=c.replace(i,l):c=c.replace(r,l),c.replace(t,o))};return an.camelCase=u,an}var ln,ko;function ld(){if(ko)return ln;ko=1;var e=ln&&ln.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(sd()),n=ad();function r(i,s){var o={};return!i||typeof i!="string"||(0,t.default)(i,function(l,u){l&&u&&(o[(0,n.camelCase)(l,s)]=u)}),o}return r.default=r,ln=r,ln}var cd=ld();const ud=Vr(cd),Us=Hs("end"),ti=Hs("start");function Hs(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 dd(e){const t=ti(e),n=Us(e);if(t&&n)return{start:t,end:n}}function fn(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Eo(e.position):"start"in e||"end"in e?Eo(e):"line"in e||"column"in e?Fr(e):""}function Fr(e){return wo(e&&e.line)+":"+wo(e&&e.column)}function Eo(e){return Fr(e&&e.start)+"-"+Fr(e&&e.end)}function wo(e){return e&&typeof e=="number"?e:1}class We extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?s.ruleId=r:(s.source=r.slice(0,u),s.ruleId=r.slice(u+1))}if(!s.place&&s.ancestors&&s.ancestors){const u=s.ancestors[s.ancestors.length-1];u&&(s.place=u.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=fn(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}We.prototype.file="";We.prototype.name="";We.prototype.reason="";We.prototype.message="";We.prototype.stack="";We.prototype.column=void 0;We.prototype.line=void 0;We.prototype.ancestors=void 0;We.prototype.cause=void 0;We.prototype.fatal=void 0;We.prototype.place=void 0;We.prototype.ruleId=void 0;We.prototype.source=void 0;const ni={}.hasOwnProperty,pd=new Map,fd=/[A-Z]/g,md=new Set(["table","tbody","thead","tfoot","tr"]),hd=new Set(["td","th"]),Ws="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function gd(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=_d(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=wd(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?ei:rd,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=Ks(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function Ks(e,t,n){if(t.type==="element")return bd(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return xd(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return vd(e,t,n);if(t.type==="mdxjsEsm")return yd(e,t);if(t.type==="root")return kd(e,t,n);if(t.type==="text")return Ed(e,t)}function bd(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=ei,e.schema=i),e.ancestors.push(t);const s=qs(e,t.tagName,!1),o=Nd(e,t);let l=ii(e,t);return md.has(t.tagName)&&(l=l.filter(function(u){return typeof u=="string"?!qu(u):!0})),Gs(e,o,s,t),ri(o,l),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function xd(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)}gn(e,t.position)}function yd(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);gn(e,t.position)}function vd(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=ei,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:qs(e,t.name,!0),o=Sd(e,t),l=ii(e,t);return Gs(e,o,s,t),ri(o,l),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function kd(e,t,n){const r={};return ri(r,ii(e,t)),e.create(t,e.Fragment,r,n)}function Ed(e,t){return t.value}function Gs(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ri(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function wd(e,t,n){return r;function r(i,s,o,l){const c=Array.isArray(o.children)?n:t;return l?c(s,o,l):c(s,o)}}function _d(e,t){return n;function n(r,i,s,o){const l=Array.isArray(s.children),u=ti(r);return t(i,s,o,l,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function Nd(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&ni.call(t.properties,i)){const s=Td(e,i,t.properties[i]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&hd.has(t.tagName)?r=l:n[o]=l}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Sd(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else gn(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else gn(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function ii(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:pd;for(;++ri?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s0?(et(e,e.length,0,t),e):t}const So={}.hasOwnProperty;function Ys(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 dt(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ve=Dt(/[A-Za-z]/),He=Dt(/[\dA-Za-z]/),Dd=Dt(/[#-'*+\--9=?A-Z^-~]/);function Un(e){return e!==null&&(e<32||e===127)}const zr=Dt(/\d/),Pd=Dt(/[\dA-Fa-f]/),Bd=Dt(/[!-/:-@[-`{-~]/);function se(e){return e!==null&&e<-2}function Ne(e){return e!==null&&(e<0||e===32)}function ge(e){return e===-2||e===-1||e===32}const Zn=Dt(new RegExp("\\p{P}|\\p{S}","u")),Wt=Dt(/\s/);function Dt(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,i=0;for(;++n55295&&s<57344){const l=e.charCodeAt(n+1);s<56320&&l>56319&&l<57344?(o=String.fromCharCode(s,l),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function ve(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(u){return ge(u)?(e.enter(n),l(u)):t(u)}function l(u){return ge(u)&&s++o))return;const B=t.events.length;let O=B,w,_;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){if(w){_=t.events[O][1].end;break}w=!0}for(b(r),T=B;TC;){const L=n[j];t.containerState=L[1],L[0].exit.call(t,e)}n.length=C}function k(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Hd(e,t,n){return ve(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function nn(e){if(e===null||Ne(e)||Wt(e))return 1;if(Zn(e))return 2}function Jn(e,t,n){const r=[];let i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p={...e[r][1].end},m={...e[n][1].start};Co(p,-u),Co(m,u),o={type:u>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},l={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:m},s={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:u>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=it(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=it(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=it(c,Jn(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=it(c,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,c=it(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,et(e,r-1,n-r+3,c),n=r+c.length-d-2;break}}for(n=-1;++n0&&ge(T)?ve(e,k,"linePrefix",s+1)(T):k(T)}function k(T){return T===null||se(T)?e.check(Ao,x,j)(T):(e.enter("codeFlowValue"),C(T))}function C(T){return T===null||se(T)?(e.exit("codeFlowValue"),k(T)):(e.consume(T),C)}function j(T){return e.exit("codeFenced"),t(T)}function L(T,B,O){let w=0;return _;function _(E){return T.enter("lineEnding"),T.consume(E),T.exit("lineEnding"),M}function M(E){return T.enter("codeFencedFence"),ge(E)?ve(T,R,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):R(E)}function R(E){return E===l?(T.enter("codeFencedFenceSequence"),D(E)):O(E)}function D(E){return E===l?(w++,T.consume(E),D):w>=o?(T.exit("codeFencedFenceSequence"),ge(E)?ve(T,N,"whitespace")(E):N(E)):O(E)}function N(E){return E===null||se(E)?(T.exit("codeFencedFence"),B(E)):O(E)}}}function tp(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const gr={name:"codeIndented",tokenize:rp},np={partial:!0,tokenize:ip};function rp(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),ve(e,s,"linePrefix",5)(c)}function s(c){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?u(c):se(c)?e.attempt(np,o,u)(c):(e.enter("codeFlowValue"),l(c))}function l(c){return c===null||se(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),l)}function u(c){return e.exit("codeIndented"),t(c)}}function ip(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):se(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):ve(e,s,"linePrefix",5)(o)}function s(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):se(o)?i(o):n(o)}}const op={name:"codeText",previous:ap,resolve:sp,tokenize:lp};function sp(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&cn(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),cn(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),cn(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function ta(e,t,n,r,i,s,o,l,u){const c=u||Number.POSITIVE_INFINITY;let d=0;return p;function p(b){return b===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(b),e.exit(s),m):b===null||b===32||b===41||Un(b)?n(b):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),x(b))}function m(b){return b===62?(e.enter(s),e.consume(b),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),f(b))}function f(b){return b===62?(e.exit("chunkString"),e.exit(l),m(b)):b===null||b===60||se(b)?n(b):(e.consume(b),b===92?g:f)}function g(b){return b===60||b===62||b===92?(e.consume(b),f):f(b)}function x(b){return!d&&(b===null||b===41||Ne(b))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(b)):d999||f===null||f===91||f===93&&!u||f===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(f):f===93?(e.exit(s),e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):se(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||se(f)||l++>999?(e.exit("chunkString"),d(f)):(e.consume(f),u||(u=!ge(f)),f===92?m:p)}function m(f){return f===91||f===92||f===93?(e.consume(f),l++,p):p(f)}}function ra(e,t,n,r,i,s){let o;return l;function l(m){return m===34||m===39||m===40?(e.enter(r),e.enter(i),e.consume(m),e.exit(i),o=m===40?41:m,u):n(m)}function u(m){return m===o?(e.enter(i),e.consume(m),e.exit(i),e.exit(r),t):(e.enter(s),c(m))}function c(m){return m===o?(e.exit(s),u(o)):m===null?n(m):se(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),ve(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===o||m===null||se(m)?(e.exit("chunkString"),c(m)):(e.consume(m),m===92?p:d)}function p(m){return m===o||m===92?(e.consume(m),d):d(m)}}function mn(e,t){let n;return r;function r(i){return se(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):ge(i)?ve(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const gp={name:"definition",tokenize:xp},bp={partial:!0,tokenize:yp};function xp(e,t,n){const r=this;let i;return s;function s(f){return e.enter("definition"),o(f)}function o(f){return na.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function l(f){return i=dt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),u):n(f)}function u(f){return Ne(f)?mn(e,c)(f):c(f)}function c(f){return ta(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function d(f){return e.attempt(bp,p,p)(f)}function p(f){return ge(f)?ve(e,m,"whitespace")(f):m(f)}function m(f){return f===null||se(f)?(e.exit("definition"),r.parser.defined.push(i),t(f)):n(f)}}function yp(e,t,n){return r;function r(l){return Ne(l)?mn(e,i)(l):n(l)}function i(l){return ra(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return ge(l)?ve(e,o,"whitespace")(l):o(l)}function o(l){return l===null||se(l)?t(l):n(l)}}const vp={name:"hardBreakEscape",tokenize:kp};function kp(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return se(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const Ep={name:"headingAtx",resolve:wp,tokenize:_p};function wp(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},et(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function _p(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||Ne(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),u(d)):d===null||se(d)?(e.exit("atxHeading"),t(d)):ge(d)?ve(e,l,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function u(d){return d===35?(e.consume(d),u):(e.exit("atxHeadingSequence"),l(d))}function c(d){return d===null||d===35||Ne(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),c)}}const Np=["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"],Io=["pre","script","style","textarea"],Sp={concrete:!0,name:"htmlFlow",resolveTo:Ap,tokenize:Mp},Tp={partial:!0,tokenize:Rp},Cp={partial:!0,tokenize:Ip};function Ap(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 Mp(e,t,n){const r=this;let i,s,o,l,u;return c;function c(v){return d(v)}function d(v){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(v),p}function p(v){return v===33?(e.consume(v),m):v===47?(e.consume(v),s=!0,x):v===63?(e.consume(v),i=3,r.interrupt?t:h):Ve(v)?(e.consume(v),o=String.fromCharCode(v),y):n(v)}function m(v){return v===45?(e.consume(v),i=2,f):v===91?(e.consume(v),i=5,l=0,g):Ve(v)?(e.consume(v),i=4,r.interrupt?t:h):n(v)}function f(v){return v===45?(e.consume(v),r.interrupt?t:h):n(v)}function g(v){const ie="CDATA[";return v===ie.charCodeAt(l++)?(e.consume(v),l===ie.length?r.interrupt?t:R:g):n(v)}function x(v){return Ve(v)?(e.consume(v),o=String.fromCharCode(v),y):n(v)}function y(v){if(v===null||v===47||v===62||Ne(v)){const ie=v===47,W=o.toLowerCase();return!ie&&!s&&Io.includes(W)?(i=1,r.interrupt?t(v):R(v)):Np.includes(o.toLowerCase())?(i=6,ie?(e.consume(v),b):r.interrupt?t(v):R(v)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(v):s?k(v):C(v))}return v===45||He(v)?(e.consume(v),o+=String.fromCharCode(v),y):n(v)}function b(v){return v===62?(e.consume(v),r.interrupt?t:R):n(v)}function k(v){return ge(v)?(e.consume(v),k):_(v)}function C(v){return v===47?(e.consume(v),_):v===58||v===95||Ve(v)?(e.consume(v),j):ge(v)?(e.consume(v),C):_(v)}function j(v){return v===45||v===46||v===58||v===95||He(v)?(e.consume(v),j):L(v)}function L(v){return v===61?(e.consume(v),T):ge(v)?(e.consume(v),L):C(v)}function T(v){return v===null||v===60||v===61||v===62||v===96?n(v):v===34||v===39?(e.consume(v),u=v,B):ge(v)?(e.consume(v),T):O(v)}function B(v){return v===u?(e.consume(v),u=null,w):v===null||se(v)?n(v):(e.consume(v),B)}function O(v){return v===null||v===34||v===39||v===47||v===60||v===61||v===62||v===96||Ne(v)?L(v):(e.consume(v),O)}function w(v){return v===47||v===62||ge(v)?C(v):n(v)}function _(v){return v===62?(e.consume(v),M):n(v)}function M(v){return v===null||se(v)?R(v):ge(v)?(e.consume(v),M):n(v)}function R(v){return v===45&&i===2?(e.consume(v),I):v===60&&i===1?(e.consume(v),G):v===62&&i===4?(e.consume(v),F):v===63&&i===3?(e.consume(v),h):v===93&&i===5?(e.consume(v),V):se(v)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Tp,$,D)(v)):v===null||se(v)?(e.exit("htmlFlowData"),D(v)):(e.consume(v),R)}function D(v){return e.check(Cp,N,$)(v)}function N(v){return e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),E}function E(v){return v===null||se(v)?D(v):(e.enter("htmlFlowData"),R(v))}function I(v){return v===45?(e.consume(v),h):R(v)}function G(v){return v===47?(e.consume(v),o="",H):R(v)}function H(v){if(v===62){const ie=o.toLowerCase();return Io.includes(ie)?(e.consume(v),F):R(v)}return Ve(v)&&o.length<8?(e.consume(v),o+=String.fromCharCode(v),H):R(v)}function V(v){return v===93?(e.consume(v),h):R(v)}function h(v){return v===62?(e.consume(v),F):v===45&&i===2?(e.consume(v),h):R(v)}function F(v){return v===null||se(v)?(e.exit("htmlFlowData"),$(v)):(e.consume(v),F)}function $(v){return e.exit("htmlFlow"),t(v)}}function Ip(e,t,n){const r=this;return i;function i(o){return se(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function Rp(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(yn,t,n)}}const Op={name:"htmlText",tokenize:Lp};function Lp(e,t,n){const r=this;let i,s,o;return l;function l(h){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(h),u}function u(h){return h===33?(e.consume(h),c):h===47?(e.consume(h),L):h===63?(e.consume(h),C):Ve(h)?(e.consume(h),O):n(h)}function c(h){return h===45?(e.consume(h),d):h===91?(e.consume(h),s=0,g):Ve(h)?(e.consume(h),k):n(h)}function d(h){return h===45?(e.consume(h),f):n(h)}function p(h){return h===null?n(h):h===45?(e.consume(h),m):se(h)?(o=p,G(h)):(e.consume(h),p)}function m(h){return h===45?(e.consume(h),f):p(h)}function f(h){return h===62?I(h):h===45?m(h):p(h)}function g(h){const F="CDATA[";return h===F.charCodeAt(s++)?(e.consume(h),s===F.length?x:g):n(h)}function x(h){return h===null?n(h):h===93?(e.consume(h),y):se(h)?(o=x,G(h)):(e.consume(h),x)}function y(h){return h===93?(e.consume(h),b):x(h)}function b(h){return h===62?I(h):h===93?(e.consume(h),b):x(h)}function k(h){return h===null||h===62?I(h):se(h)?(o=k,G(h)):(e.consume(h),k)}function C(h){return h===null?n(h):h===63?(e.consume(h),j):se(h)?(o=C,G(h)):(e.consume(h),C)}function j(h){return h===62?I(h):C(h)}function L(h){return Ve(h)?(e.consume(h),T):n(h)}function T(h){return h===45||He(h)?(e.consume(h),T):B(h)}function B(h){return se(h)?(o=B,G(h)):ge(h)?(e.consume(h),B):I(h)}function O(h){return h===45||He(h)?(e.consume(h),O):h===47||h===62||Ne(h)?w(h):n(h)}function w(h){return h===47?(e.consume(h),I):h===58||h===95||Ve(h)?(e.consume(h),_):se(h)?(o=w,G(h)):ge(h)?(e.consume(h),w):I(h)}function _(h){return h===45||h===46||h===58||h===95||He(h)?(e.consume(h),_):M(h)}function M(h){return h===61?(e.consume(h),R):se(h)?(o=M,G(h)):ge(h)?(e.consume(h),M):w(h)}function R(h){return h===null||h===60||h===61||h===62||h===96?n(h):h===34||h===39?(e.consume(h),i=h,D):se(h)?(o=R,G(h)):ge(h)?(e.consume(h),R):(e.consume(h),N)}function D(h){return h===i?(e.consume(h),i=void 0,E):h===null?n(h):se(h)?(o=D,G(h)):(e.consume(h),D)}function N(h){return h===null||h===34||h===39||h===60||h===61||h===96?n(h):h===47||h===62||Ne(h)?w(h):(e.consume(h),N)}function E(h){return h===47||h===62||Ne(h)?w(h):n(h)}function I(h){return h===62?(e.consume(h),e.exit("htmlTextData"),e.exit("htmlText"),t):n(h)}function G(h){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),H}function H(h){return ge(h)?ve(e,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h):V(h)}function V(h){return e.enter("htmlTextData"),o(h)}}const ai={name:"labelEnd",resolveAll:Bp,resolveTo:Fp,tokenize:zp},jp={tokenize:$p},Dp={tokenize:Up},Pp={tokenize:Hp};function Bp(e){let t=-1;const n=[];for(;++t=3&&(c===null||se(c))?(e.exit("thematicBreak"),t(c)):n(c)}function u(c){return c===i?(e.consume(c),r++,u):(e.exit("thematicBreakSequence"),ge(c)?ve(e,l,"whitespace")(c):l(c))}}const Ye={continuation:{tokenize:Qp},exit:tf,name:"list",tokenize:Jp},Xp={partial:!0,tokenize:nf},Zp={partial:!0,tokenize:ef};function Jp(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return l;function l(f){const g=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:zr(f)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Fn,n,c)(f):c(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(f)}return n(f)}function u(f){return zr(f)&&++o<10?(e.consume(f),u):(!r.interrupt||o<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),c(f)):n(f)}function c(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(yn,r.interrupt?n:d,e.attempt(Xp,m,p))}function d(f){return r.containerState.initialBlankLine=!0,s++,m(f)}function p(f){return ge(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),m):n(f)}function m(f){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function Qp(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(yn,i,s);function i(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ve(e,t,"listItemIndent",r.containerState.size+1)(l)}function s(l){return r.containerState.furtherBlankLines||!ge(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Zp,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,ve(e,e.attempt(Ye,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function ef(e,t,n){const r=this;return ve(e,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(s):n(s)}}function tf(e){e.exit(this.containerState.type)}function nf(e,t,n){const r=this;return ve(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!ge(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const Ro={name:"setextUnderline",resolveTo:rf,tokenize:of};function rf(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function of(e,t,n){const r=this;let i;return s;function s(c){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"),i=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),l(c)}function l(c){return c===i?(e.consume(c),l):(e.exit("setextHeadingLineSequence"),ge(c)?ve(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||se(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const sf={tokenize:af};function af(e){const t=this,n=e.attempt(yn,r,e.attempt(this.parser.constructs.flowInitial,i,ve(e,e.attempt(this.parser.constructs.flow,i,e.attempt(dp,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const lf={resolveAll:oa()},cf=ia("string"),uf=ia("text");function ia(e){return{resolveAll:oa(e==="text"?df:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,l);return o;function o(d){return c(d)?s(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),u}function u(d){return c(d)?(n.exit("data"),s(d)):(n.consume(d),u)}function c(d){if(d===null)return!0;const p=i[d];let m=-1;if(p)for(;++m-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function _f(e,t){let n=-1;const r=[];let i;for(;++n0){const Ke=ee.tokenStack[ee.tokenStack.length-1];(Ke[1]||Lo).call(ee,void 0,Ke[0])}for(K.position={start:Rt(P.length>0?P[0][1].start:{line:1,column:1,offset:0}),end:Rt(P.length>0?P[P.length-2][1].end:{line:1,column:1,offset:0})},Ee=-1;++Ee0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function Bf(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ff(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function zf(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=on(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let o,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=s+1,l+=1,e.footnoteCounts.set(r,l);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,u);const c={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,c),e.applyData(t,c)}function $f(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 Uf(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function la(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function Hf(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return la(e,t);const i={src:on(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function Wf(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 Kf(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 Gf(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return la(e,t);const i={href:on(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function qf(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 Vf(e,t,n){const r=e.all(t),i=n?Yf(n):ca(t),s={},o=[];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:[]}),s.className=["task-list-item"]}let l=-1;for(;++l1}function Xf(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=ti(t.children[1]),u=Us(t.children[t.children.length-1]);l&&u&&(o.position={start:l,end:u}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function tm(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let u=-1;const c=[];for(;++u0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(Po(t.slice(i),i>0,!1)),s.join("")}function Po(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===jo||s===Do;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===jo||s===Do;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function im(e,t){const n={type:"text",value:rm(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function om(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const sm={blockquote:jf,break:Df,code:Pf,delete:Bf,emphasis:Ff,footnoteReference:zf,heading:$f,html:Uf,imageReference:Hf,image:Wf,inlineCode:Kf,linkReference:Gf,link:qf,listItem:Vf,list:Xf,paragraph:Zf,root:Jf,strong:Qf,table:em,tableCell:nm,tableRow:tm,text:im,thematicBreak:om,toml:Mn,yaml:Mn,definition:Mn,footnoteDefinition:Mn};function Mn(){}const ua=-1,Qn=0,hn=1,Hn=2,li=3,ci=4,ui=5,di=6,da=7,pa=8,Bo=typeof self=="object"?self:globalThis,am=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case Qn:case ua:return n(o,i);case hn:{const l=n([],i);for(const u of o)l.push(r(u));return l}case Hn:{const l=n({},i);for(const[u,c]of o)l[r(u)]=r(c);return l}case li:return n(new Date(o),i);case ci:{const{source:l,flags:u}=o;return n(new RegExp(l,u),i)}case ui:{const l=n(new Map,i);for(const[u,c]of o)l.set(r(u),r(c));return l}case di:{const l=n(new Set,i);for(const u of o)l.add(r(u));return l}case da:{const{name:l,message:u}=o;return n(new Bo[l](u),i)}case pa:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new Bo[s](o),i)};return r},Fo=e=>am(new Map,e)(0),Xt="",{toString:lm}={},{keys:cm}=Object,un=e=>{const t=typeof e;if(t!=="object"||!e)return[Qn,t];const n=lm.call(e).slice(8,-1);switch(n){case"Array":return[hn,Xt];case"Object":return[Hn,Xt];case"Date":return[li,Xt];case"RegExp":return[ci,Xt];case"Map":return[ui,Xt];case"Set":return[di,Xt];case"DataView":return[hn,n]}return n.includes("Array")?[hn,n]:n.includes("Error")?[da,n]:[Hn,n]},In=([e,t])=>e===Qn&&(t==="function"||t==="symbol"),um=(e,t,n,r)=>{const i=(o,l)=>{const u=r.push(o)-1;return n.set(l,u),u},s=o=>{if(n.has(o))return n.get(o);let[l,u]=un(o);switch(l){case Qn:{let d=o;switch(u){case"bigint":l=pa,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);d=null;break;case"undefined":return i([ua],o)}return i([l,d],o)}case hn:{if(u){let m=o;return u==="DataView"?m=new Uint8Array(o.buffer):u==="ArrayBuffer"&&(m=new Uint8Array(o)),i([u,[...m]],o)}const d=[],p=i([l,d],o);for(const m of o)d.push(s(m));return p}case Hn:{if(u)switch(u){case"BigInt":return i([u,o.toString()],o);case"Boolean":case"Number":case"String":return i([u,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const d=[],p=i([l,d],o);for(const m of cm(o))(e||!In(un(o[m])))&&d.push([s(m),s(o[m])]);return p}case li:return i([l,o.toISOString()],o);case ci:{const{source:d,flags:p}=o;return i([l,{source:d,flags:p}],o)}case ui:{const d=[],p=i([l,d],o);for(const[m,f]of o)(e||!(In(un(m))||In(un(f))))&&d.push([s(m),s(f)]);return p}case di:{const d=[],p=i([l,d],o);for(const m of o)(e||!In(un(m)))&&d.push(s(m));return p}}const{message:c}=o;return i([l,{name:u,message:c}],o)};return s},zo=(e,{json:t,lossy:n}={})=>{const r=[];return um(!(t||n),!!t,new Map,r)(e),r},Wn=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Fo(zo(e,t)):structuredClone(e):(e,t)=>Fo(zo(e,t));function dm(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 pm(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function fm(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||dm,r=e.options.footnoteBackLabel||pm,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let u=-1;for(;++u0&&g.push({type:"text",value:" "});let k=typeof n=="string"?n:n(u,f);typeof k=="string"&&(k={type:"text",value:k}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,f),className:["data-footnote-backref"]},children:Array.isArray(k)?k:[k]})}const y=d[d.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const k=y.children[y.children.length-1];k&&k.type==="text"?k.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...g)}else d.push(...g);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(d,!0)};e.patch(c,b),l.push(b)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Wn(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:` +`}]}}const vn=(function(e){if(e==null)return bm;if(typeof e=="function")return er(e);if(typeof e=="object")return Array.isArray(e)?mm(e):hm(e);if(typeof e=="string")return gm(e);throw new Error("Expected function, string, or object as test")});function mm(e){const t=[];let n=-1;for(;++n":""))+")"})}return m;function m(){let f=fa,g,x,y;if((!t||s(u,c,d[d.length-1]||void 0))&&(f=km(n(u,d)),f[0]===Ur))return f;if("children"in u&&u.children){const b=u;if(b.children&&f[0]!==vm)for(x=(r?b.children.length:-1)+o,y=d.concat(b);x>-1&&x0&&n.push({type:"text",value:` +`}),n}function $o(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Uo(e,t){const n=wm(e,t),r=n.one(e,void 0),i=fm(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:` +`},i),s}function Cm(e,t){return e&&"run"in e?async function(n,r){const i=Uo(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Uo(n,{file:r,...e||t})}}function Ho(e){if(e)throw e}var xr,Wo;function Am(){if(Wo)return xr;Wo=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(c){return typeof Array.isArray=="function"?Array.isArray(c):t.call(c)==="[object Array]"},s=function(c){if(!c||t.call(c)!=="[object Object]")return!1;var d=e.call(c,"constructor"),p=c.constructor&&c.constructor.prototype&&e.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!d&&!p)return!1;var m;for(m in c);return typeof m>"u"||e.call(c,m)},o=function(c,d){n&&d.name==="__proto__"?n(c,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):c[d.name]=d.newValue},l=function(c,d){if(d==="__proto__")if(e.call(c,d)){if(r)return r(c,d).value}else return;return c[d]};return xr=function u(){var c,d,p,m,f,g,x=arguments[0],y=1,b=arguments.length,k=!1;for(typeof x=="boolean"&&(k=x,x=arguments[1]||{},y=2),(x==null||typeof x!="object"&&typeof x!="function")&&(x={});yo.length;let u;l&&o.push(i);try{u=e.apply(this,o)}catch(c){const d=c;if(l&&n)throw d;return i(d)}l||(u&&u.then&&typeof u.then=="function"?u.then(s,i):u instanceof Error?i(u):s(u))}function i(o,...l){n||(n=!0,t(o,...l))}function s(o){i(null,o)}}const ht={basename:Om,dirname:Lm,extname:jm,join:Dm,sep:"/"};function Om(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');kn(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(r=i):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Lm(e){if(kn(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 jm(e){kn(e);let t=e.length,n=-1,r=0,i=-1,s=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function Dm(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Bm(e,t){let n="",r=0,i=-1,s=0,o=-1,l,u;for(;++o<=e.length;){if(o2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,s=0}else l===46&&s>-1?s++:s=-1}return n}function kn(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Fm={cwd:zm};function zm(){return"/"}function Kr(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function $m(e){if(typeof e=="string")e=new URL(e);else if(!Kr(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 Um(e)}function Um(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,...g]=d;const x=r[m][1];Wr(x)&&Wr(f)&&(f=yr(!0,x,f)),r[m]=[c,f,...g]}}}}const Gm=new pi().freeze();function wr(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function _r(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Nr(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 Go(e){if(!Wr(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function qo(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Rn(e){return qm(e)?e:new ha(e)}function qm(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Vm(e){return typeof e=="string"||Ym(e)}function Ym(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Xm="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Vo=[],Yo={allowDangerousHtml:!0},Zm=/^(https?|ircs?|mailto|xmpp)$/i,Jm=[{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 Qm(e){const t=eh(e),n=th(e);return nh(t.runSync(t.parse(n),n),e)}function eh(e){const t=e.rehypePlugins||Vo,n=e.remarkPlugins||Vo,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Yo}:Yo;return Gm().use(Lf).use(n).use(Cm,r).use(t)}function th(e){const t=e.children||"",n=new ha;return typeof t=="string"&&(n.value=t),n}function nh(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,u=t.urlTransform||rh;for(const d of Jm)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Xm+d.id,void 0);return tr(e,c),gd(e,{Fragment:a.Fragment,components:i,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function c(d,p,m){if(d.type==="raw"&&m&&typeof p=="number")return o?m.children.splice(p,1):m.children[p]={type:"text",value:d.value},p;if(d.type==="element"){let f;for(f in hr)if(Object.hasOwn(hr,f)&&Object.hasOwn(d.properties,f)){const g=d.properties[f],x=hr[f];(x===null||x.includes(d.tagName))&&(d.properties[f]=u(String(g||""),f,d))}}if(d.type==="element"){let f=n?!n.includes(d.tagName):s?s.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 rh(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||Zm.test(e.slice(0,t))?e:""}const Xo=(function(e,t,n){const r=vn(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(;++tc&&(c=d):d&&(c!==void 0&&c>-1&&u.push(` +`.repeat(c)||" "),c=-1,u.push(d))}return u.join("")}function ba(e,t,n){return e.type==="element"?dh(e,t,n):e.type==="text"?n.whitespace==="normal"?xa(e,n):ph(e):[]}function dh(e,t,n){const r=ya(e,n),i=e.children||[];let s=-1,o=[];if(ch(e))return o;let l,u;for(Gr(e)||es(e)&&Xo(t,e,es)?u=` +`:lh(e)?(l=2,u=2):ga(e)&&(l=1,u=1);++s]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={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(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},f=t.optional(i)+e.IDENT_RE+"\\s*\\(",g=["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"],x=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],y=["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"],b=["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"],j={type:x,keyword:g,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:y},L={className:"function.dispatch",relevance:0,keywords:{_hint:b},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,c],B={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:j,contains:T.concat([{begin:/\(/,end:/\)/,keywords:j,contains:T.concat(["self"]),relevance:0}]),relevance:0},O={className:"function",begin:"("+o+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:j,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:j,relevance:0},{begin:f,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:j,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,c,d,l,{begin:/\(/,end:/\)/,keywords:j,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,c,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,p]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:j,illegal:"",keywords:j,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:j},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function xh(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=bh(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 yh(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 i={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},s=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={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,i]};i.contains.push(l);const u={match:/\\"/},c={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}),g={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},x=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],y=["true","false"],b={match:/(\/[a-z._-]+)+/},k=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],C=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],j=["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:x,literal:y,built_in:[...k,...C,"set","shopt",...j,...L]},contains:[f,e.SHEBANG(),g,p,s,o,b,l,u,c,d,n]}}function vh(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},c={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(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},f=t.optional(i)+e.IDENT_RE+"\\s*\\(",y={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"},b=[p,l,n,e.C_BLOCK_COMMENT_MODE,d,c],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:y,contains:b.concat([{begin:/\(/,end:/\)/,keywords:y,contains:b.concat(["self"]),relevance:0}]),relevance:0},C={begin:"("+o+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:y,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:y,relevance:0},{begin:f,returnBegin:!0,contains:[e.inherit(m,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:y,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,c,d,l,{begin:/\(/,end:/\)/,keywords:y,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,c,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,p]};return{name:"C",aliases:["h"],keywords:y,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:p,strings:c,keywords:y}}}function kh(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={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(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},f=t.optional(i)+e.IDENT_RE+"\\s*\\(",g=["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"],x=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],y=["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"],b=["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"],j={type:x,keyword:g,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:y},L={className:"function.dispatch",relevance:0,keywords:{_hint:b},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,c],B={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:j,contains:T.concat([{begin:/\(/,end:/\)/,keywords:j,contains:T.concat(["self"]),relevance:0}]),relevance:0},O={className:"function",begin:"("+o+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:j,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:j,relevance:0},{begin:f,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:j,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,c,d,l,{begin:/\(/,end:/\)/,keywords:j,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,c,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,p]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:j,illegal:"",keywords:j,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:j},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Eh(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"],i=["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"],s=["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"],o={keyword:i.concat(s),built_in:t,literal:r},l=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),u={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},c={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:o},f=e.inherit(m,{illegal:/\n/}),g={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,f]},x={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},m]},y=e.inherit(x,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]});m.contains=[x,g,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,u,e.C_BLOCK_COMMENT_MODE],f.contains=[y,g,p,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,u,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const b={variants:[c,x,g,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},k={begin:"<",end:">",contains:[{beginKeywords:"in out"},l]},C=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",j={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:o,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),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"}},b,u,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},l,k,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,k,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:"("+C+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:o,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,k],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,relevance:0,contains:[b,u,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},j]}}const wh=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_-]*/}}),_h=["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"],Nh=["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"],Sh=[..._h,...Nh],Th=["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(),Ch=["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(),Ah=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Mh=["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 Ih(e){const t=e.regex,n=wh(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",s=/@-?\w[\w]*(-\w+)*/,o="[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:"\\."+o,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+Ch.join("|")+")"},{begin:":(:)?("+Ah.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Mh.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:s},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:Th.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+Sh.join("|")+")\\b"}]}}function Rh(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 Oh(e){const s={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:s,illegal:"va(e,t,n-1))}function Dh(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+va("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),u={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"]},c={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:u,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:u,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:u,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:u,relevance:0,contains:[c,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,ts,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},ts,c]}}const ns="[A-Za-z$_][0-9A-Za-z$_]*",Ph=["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"],Bh=["true","false","null","undefined","NaN","Infinity"],ka=["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"],Ea=["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"],Fh=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],zh=[].concat(wa,ka,Ea);function $h(e){const t=e.regex,n=(H,{after:V})=>{const h="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(H,V)=>{const h=H[0].length+H.index,F=H.input[h];if(F==="<"||F===","){V.ignoreMatch();return}F===">"&&(n(H,{after:h})||V.ignoreMatch());let $;const v=H.input.substring(h);if($=v.match(/^\s*=/)){V.ignoreMatch();return}if(($=v.match(/^\s+extends\s+/))&&$.index===0){V.ignoreMatch();return}}},l={$pattern:ns,keyword:Ph,literal:Bh,built_in:zh,"variable.language":Fh},u="[0-9](_?[0-9])*",c=`\\.(${u})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",p={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${u})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\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"}},g={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"css"}},x={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},y={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,m]},k={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]},C=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,g,x,y,{match:/\$\d+/},p];m.contains=C.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(C)});const j=[].concat(k,m.contains),L=j.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(j)}]),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"}}]},O={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:{_:[...ka,...Ea]}},w={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},_={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[T],illegal:/%/},M={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function R(H){return t.concat("(?!",H.join("|"),")")}const D={match:t.concat(/\b/,R([...wa,"super","import"].map(H=>`${H}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},N={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},E={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},T]},I="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",G={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(I)],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:O},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,g,x,y,k,{match:/\$\d+/},p,O,{scope:"attr",match:r+t.lookahead(":"),relevance:0},G,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,e.REGEXP_MODE,{className:"function",begin:I,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:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},_,{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},N,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[T]},D,M,B,E,{match:/\$[(.]/}]}}function Uh(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,i,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Jt="[0-9](_*[0-9])*",jn=`\\.(${Jt})`,Dn="[0-9a-fA-F](_*[0-9a-fA-F])*",Hh={className:"number",variants:[{begin:`(\\b(${Jt})((${jn})|\\.)?|(${jn}))[eE][+-]?(${Jt})[fFdD]?\\b`},{begin:`\\b(${Jt})((${jn})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${jn})[fFdD]?\\b`},{begin:`\\b(${Jt})[fFdD]\\b`},{begin:`\\b0[xX]((${Dn})\\.?|(${Dn})?\\.(${Dn}))[pP][+-]?(${Jt})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Dn})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Wh(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+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},s={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},o={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[s,i]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,s,i]}]};i.contains.push(o);const l={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},u={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(o,{className:"string"}),"self"]}]},c=Hh,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,u,{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://,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,u,o,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://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},l,u]},o,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` +`},c]}}const Kh=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_-]*/}}),Gh=["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"],qh=["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"],Vh=[...Gh,...qh],Yh=["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(),_a=["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(),Na=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Xh=["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(),Zh=_a.concat(Na).sort().reverse();function Jh(e){const t=Kh(e),n=Zh,r="and or not only",i="[\\w-]+",s="("+i+"|@\\{"+i+"\\})",o=[],l=[],u=function(C){return{className:"string",begin:"~?"+C+".*?"+C}},c=function(C,j,L){return{className:C,begin:j,relevance:L}},d={$pattern:/[a-z-]+/,keyword:r,attribute:Yh.join(" ")},p={begin:"\\(",end:"\\)",contains:l,keywords:d,relevance:0};l.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,u("'"),u('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,p,c("variable","@@?"+i,10),c("variable","@\\{"+i+"\\}"),c("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const m=l.concat({begin:/\{/,end:/\}/,contains:o}),f={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(l)},g={begin:s+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Xh.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},x={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}},y={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:m}},b={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:s,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,f,c("keyword","all\\b"),c("variable","@\\{"+i+"\\}"),{begin:"\\b("+Vh.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,c("selector-tag",s,0),c("selector-id","#"+s),c("selector-class","\\."+s,0),c("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+_a.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Na.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:m},{begin:"!important"},t.FUNCTION_DISPATCH]},k={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[b]};return o.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,x,y,k,g,b,f,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:o}}function Qh(e){const t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},i=[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:i.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:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function eg(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={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}]},s={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={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+.-]*/,u={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}]},c={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(c,{contains:[]}),m=e.inherit(d,{contains:[]});c.contains.push(m),d.contains.push(p);let f=[n,u];return[c,d,p,m].forEach(b=>{b.contains=b.contains.concat(f)}),f=f.concat(c,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,s,c,d,{className:"quote",begin:"^>\\s+",contains:f,end:"$"},i,r,u,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function ng(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"]},u={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:l,illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+u.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:u,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function rg(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}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},s={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},o={begin:/->\{/,end:/\}/},l={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},u={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]},c={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,s,u],p=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],m=(x,y,b="\\1")=>{const k=b==="\\1"?b:t.concat(b,y);return t.concat(t.concat("(?:",x,")"),y,/(?:\\.|[^\\\/])*?/,k,/(?:\\.|[^\\\/])*?/,b,r)},f=(x,y,b)=>t.concat(t.concat("(?:",x,")"),y,/(?:\\.|[^\\\/])*?/,b,r),g=[u,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{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}]},c,{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,c]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return s.contains=g,o.contains=g,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:g}}function ig(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),i=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),s=t.concat(/[A-Z]+/,n),o={scope:"variable",match:"\\$+"+r},l={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},u={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},c=e.inherit(e.APOS_STRING_MODE,{illegal:null}),d=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(u)}),p={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(u),"on:begin":(N,E)=>{E.data._beginMatch=N[1]||N[2]},"on:end":(N,E)=>{E.data._beginMatch!==N[1]&&E.ignoreMatch()}},m=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),f=`[ +]`,g={scope:"string",variants:[d,c,p,m]},x={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},y=["false","null","true"],b=["__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"],k=["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"],j={keyword:b,literal:(N=>{const E=[];return N.forEach(I=>{E.push(I),I.toLowerCase()===I?E.push(I.toUpperCase()):E.push(I.toLowerCase())}),E})(y),built_in:k},L=N=>N.map(E=>E.replace(/\|\d+$/,"")),T={variants:[{match:[/new/,t.concat(f,"+"),t.concat("(?!",L(k).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},B=t.concat(r,"\\b(?!\\()"),O={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),B],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),B],scope:{1:"title.class",3:"variable.constant"}},{match:[i,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},w={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},_={relevance:0,begin:/\(/,end:/\)/,keywords:j,contains:[w,o,O,e.C_BLOCK_COMMENT_MODE,g,x,T]},M={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",L(b).join("\\b|"),"|",L(k).join("\\b|"),"\\b)"),r,t.concat(f,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[_]};_.contains.push(M);const R=[w,O,e.C_BLOCK_COMMENT_MODE,g,x,T],D={begin:t.concat(/#\[\s*\\?/,t.either(i,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:y,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:y,keyword:["new","array"]},contains:["self",...R]},...R,{scope:"meta",variants:[{match:i},{match:s}]}]};return{case_insensitive:!1,keywords:j,contains:[D,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/},o,M,O,{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:j,contains:["self",D,o,O,e.C_BLOCK_COMMENT_MODE,g,x]}]},{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]},g,x]}}function og(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 sg(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function ag(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"]},u={className:"meta",begin:/^(>>>|\.\.\.) /},c={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,u],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,u],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,u,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,u,d,c]},{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,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,d,c]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},m="[0-9](_?[0-9])*",f=`(\\b(${m}))?\\.(${m})|\\b(${m})\\.`,g=`\\b|${r.join("|")}`,x={className:"number",relevance:0,variants:[{begin:`(\\b(${m})|(${f}))[eE][+-]?(${m})[jJ]?(?=${g})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${g})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${g})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${g})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${g})`},{begin:`\\b(${m})[jJ](?=${g})`}]},y={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},b={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",u,x,p,e.HASH_COMMENT_MODE]}]};return c.contains=[p,x,u],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[u,x,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},p,y,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[b]},{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:[x,b,p]}]}}function lg(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function cg(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]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=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:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[s,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function ug(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]+/),i=t.concat(r,/(::\w+)*/),o={"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]+"},u={begin:"#<",end:">"},c=[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:o},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]?/},{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])*",g={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"}]},x={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},T=[p,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:o},{relevance:0,match:[i,/\.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:[x]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[p,{begin:n}],relevance:0},g,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{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(u,c),relevance:0}].concat(u,c);d.contains=T,x.contains=T;const _=[{begin:/^\s*=>/,starts:{end:"$",contains:T}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:o,contains:T}}];return c.unshift(u),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(_).concat(c).concat(T)}}function dg(e){const t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),s={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},o="([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"],u=["true","false","Some","None","Ok","Err"],c=["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:u,built_in:c},illegal:""},s]}}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(),bg=["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(),xg=["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=pg(e),n=xg,r=bg,i="@[a-z-]+",s="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("+hg.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("+yg.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:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:gg.join(" ")},contains:[{begin:i,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 kg(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function Eg(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},s=["true","false","unknown"],o=["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"],u=["add","asc","collation","desc","final","first","last","view"],c=["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,g=[...c,...u].filter(L=>!d.includes(L)),x={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},y={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},b={match:t.concat(/\b/,t.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function k(L){return t.concat(/\b/,t.either(...L.map(T=>T.replace(/\s+/,"\\s+"))),/\b/)}const C={scope:"keyword",match:k(m),relevance:0};function j(L,{exceptions:T,when:B}={}){const O=B;return T=T||[],L.map(w=>w.match(/\|\d+$/)||T.includes(w)?w:O(w)?`${w}|0`:w)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:j(g,{when:L=>L.length<3}),literal:s,type:l,built_in:p},contains:[{scope:"type",match:k(o)},C,b,x,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,y]}}function Sa(e){return e?typeof e=="string"?e:e.source:null}function dn(e){return _e("(?=",e,")")}function _e(...e){return e.map(n=>Sa(n)).join("")}function wg(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function qe(...e){return"("+(wg(e).capture?"":"?:")+e.map(r=>Sa(r)).join("|")+")"}const mi=e=>_e(/\b/,e,/\w$/.test(e)?/\b/:/\B/),_g=["Protocol","Type"].map(mi),rs=["init","self"].map(mi),Ng=["Any","Self"],Sr=["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"],is=["false","nil","true"],Sg=["assignment","associativity","higherThan","left","lowerThan","none","right"],Tg=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],os=["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"],Ta=qe(/[/=\-+!*%<>&|^~?]/,/[\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]/),Ca=qe(Ta,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Tr=_e(Ta,Ca,"*"),Aa=qe(/[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]/),Kn=qe(Aa,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),mt=_e(Aa,Kn,"*"),Pn=_e(/[A-Z]/,Kn,"*"),Cg=["attached","autoclosure",_e(/convention\(/,qe("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",_e(/objc\(/,mt,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],Ag=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function Mg(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,qe(..._g,...rs)],className:{2:"keyword"}},s={match:_e(/\./,qe(...Sr)),relevance:0},o=Sr.filter(ye=>typeof ye=="string").concat(["_|0"]),l=Sr.filter(ye=>typeof ye!="string").concat(Ng).map(mi),u={variants:[{className:"keyword",match:qe(...l,...rs)}]},c={$pattern:qe(/\b\w+/,/#\w+/),keyword:o.concat(Tg),literal:is},d=[i,s,u],p={match:_e(/\./,qe(...os)),relevance:0},m={className:"built_in",match:_e(/\b/,qe(...os),/(?=\()/)},f=[p,m],g={match:/->/,relevance:0},x={className:"operator",relevance:0,variants:[{match:Tr},{match:`\\.(\\.|${Ca})+`}]},y=[g,x],b="([0-9]_*)+",k="([0-9a-fA-F]_*)+",C={className:"number",relevance:0,variants:[{match:`\\b(${b})(\\.(${b}))?([eE][+-]?(${b}))?\\b`},{match:`\\b0x(${k})(\\.(${k}))?([pP][+-]?(${b}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},j=(ye="")=>({className:"subst",variants:[{match:_e(/\\/,ye,/[0\\tnr"']/)},{match:_e(/\\/,ye,/u\{[0-9a-fA-F]{1,8}\}/)}]}),L=(ye="")=>({className:"subst",match:_e(/\\/,ye,/[\t ]*(?:[\r\n]|\r\n)/)}),T=(ye="")=>({className:"subst",label:"interpol",begin:_e(/\\/,ye,/\(/),end:/\)/}),B=(ye="")=>({begin:_e(ye,/"""/),end:_e(/"""/,ye),contains:[j(ye),L(ye),T(ye)]}),O=(ye="")=>({begin:_e(ye,/"/),end:_e(/"/,ye),contains:[j(ye),T(ye)]}),w={className:"string",variants:[B(),B("#"),B("##"),B("###"),O(),O("#"),O("##"),O("###")]},_=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],M={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:_},R=ye=>{const lt=_e(ye,/\//),rt=_e(/\//,ye);return{begin:lt,end:rt,contains:[..._,{scope:"comment",begin:`#(?!.*${rt})`,end:/$/}]}},D={scope:"regexp",variants:[R("###"),R("##"),R("#"),M]},N={match:_e(/`/,mt,/`/)},E={className:"variable",match:/\$\d+/},I={className:"variable",match:`\\$${Kn}+`},G=[N,E,I],H={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:Ag,contains:[...y,C,w]}]}},V={scope:"keyword",match:_e(/@/,qe(...Cg),dn(qe(/\(/,/\s+/)))},h={scope:"meta",match:_e(/@/,mt)},F=[H,V,h],$={match:dn(/\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)/,Kn,"+")},{className:"type",match:Pn,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:_e(/\s+&\s+/,dn(Pn)),relevance:0}]},v={begin://,keywords:c,contains:[...r,...d,...F,g,$]};$.contains.push(v);const ie={match:_e(mt,/\s*:/),keywords:"_|0",relevance:0},W={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",ie,...r,D,...d,...f,...y,C,w,...G,...F,$]},U={begin://,keywords:"repeat each",contains:[...r,$]},re={begin:qe(dn(_e(mt,/\s*:/)),dn(_e(mt,/\s+/,mt,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:mt}]},de={begin:/\(/,end:/\)/,keywords:c,contains:[re,...r,...d,...y,C,w,...F,$,W],endsParent:!0,illegal:/["']/},be={match:[/(func|macro)/,/\s+/,qe(N.match,mt,Tr)],className:{1:"keyword",3:"title.function"},contains:[U,de,t],illegal:[/\[/,/%/]},Oe={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[U,de,t],illegal:/\[|%/},Ie={match:[/operator/,/\s+/,Tr],className:{1:"keyword",3:"title"}},at={begin:[/precedencegroup/,/\s+/,Pn],className:{1:"keyword",3:"title"},contains:[$],keywords:[...Sg,...is],end:/}/},St={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Pt={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},yt={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,mt,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:c,contains:[U,...d,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:"title.class.inherited",match:Pn},...d],relevance:0}]};for(const ye of w.variants){const lt=ye.contains.find(vt=>vt.label==="interpol");lt.keywords=c;const rt=[...d,...f,...y,C,w,...G];lt.contains=[...rt,{begin:/\(/,end:/\)/,contains:["self",...rt]}]}return{name:"Swift",keywords:c,contains:[...r,be,Oe,St,Pt,yt,Ie,at,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},D,...d,...f,...y,C,w,...G,...F,$,W]}}const Gn="[A-Za-z$_][0-9A-Za-z$_]*",Ma=["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"],Ia=["true","false","null","undefined","NaN","Infinity"],Ra=["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"],Oa=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],La=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],ja=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Da=[].concat(La,Ra,Oa);function Ig(e){const t=e.regex,n=(H,{after:V})=>{const h="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(H,V)=>{const h=H[0].length+H.index,F=H.input[h];if(F==="<"||F===","){V.ignoreMatch();return}F===">"&&(n(H,{after:h})||V.ignoreMatch());let $;const v=H.input.substring(h);if($=v.match(/^\s*=/)){V.ignoreMatch();return}if(($=v.match(/^\s+extends\s+/))&&$.index===0){V.ignoreMatch();return}}},l={$pattern:Gn,keyword:Ma,literal:Ia,built_in:Da,"variable.language":ja},u="[0-9](_?[0-9])*",c=`\\.(${u})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",p={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${u})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\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"}},g={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"css"}},x={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},y={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,m]},k={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]},C=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,g,x,y,{match:/\$\d+/},p];m.contains=C.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(C)});const j=[].concat(k,m.contains),L=j.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(j)}]),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"}}]},O={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:{_:[...Ra,...Oa]}},w={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},_={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[T],illegal:/%/},M={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function R(H){return t.concat("(?!",H.join("|"),")")}const D={match:t.concat(/\b/,R([...La,"super","import"].map(H=>`${H}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},N={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},E={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},T]},I="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",G={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(I)],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:O},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,g,x,y,k,{match:/\$\d+/},p,O,{scope:"attr",match:r+t.lookahead(":"),relevance:0},G,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,e.REGEXP_MODE,{className:"function",begin:I,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:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},_,{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},N,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[T]},D,M,B,E,{match:/\$[(.]/}]}}function Rg(e){const t=e.regex,n=Ig(e),r=Gn,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},l={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},u=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:Gn,keyword:Ma.concat(u),literal:Ia,built_in:Da.concat(i),"variable.language":ja},d={className:"meta",begin:"@"+r},p=(x,y,b)=>{const k=x.contains.findIndex(C=>C.label===y);if(k===-1)throw new Error("can not find mode to replace");x.contains.splice(k,1,b)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(d);const m=n.contains.find(x=>x.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,s,o,f]),p(n,"shebang",e.SHEBANG()),p(n,"use_strict",l);const g=n.contains.find(x=>x.label==="func.def");return g.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function Og(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,s=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,l=/\d{1,2}(:\d{1,2}){1,2}/,u={className:"literal",variants:[{begin:t.concat(/# */,t.either(s,i),/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,t.either(s,i),/ +/,t.either(o,l),/ *#/)}]},c={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,u,c,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 Lg(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"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},s={className:"variable",begin:/\$[\w_]+/},o={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/},u={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},c={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"}},s,o,i,e.QUOTE_STRING_MODE,u,c,l]}}function jg(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,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(s,{begin:/\(/,end:/\)/}),l=e.inherit(e.APOS_STRING_MODE,{className:"string"}),u=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/`]+/}]}]}]};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:[s,u,l,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[s,o,u,l]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[u]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:c}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function Dg(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},l=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),m={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},f={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},g={begin:/\{/,end:/\}/,contains:[f],illegal:"\\n",relevance:0},x={begin:"\\[",end:"\\]",contains:[f],illegal:"\\n",relevance:0},y=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},m,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},g,x,s,o],b=[...y];return b.pop(),b.push(l),f.contains=b,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:y}}const Pg={arduino:xh,bash:yh,c:vh,cpp:kh,csharp:Eh,css:Ih,diff:Rh,go:Oh,graphql:Lh,ini:jh,java:Dh,javascript:$h,json:Uh,kotlin:Wh,less:Jh,lua:Qh,makefile:eg,markdown:tg,objectivec:ng,perl:rg,php:ig,"php-template":og,plaintext:sg,python:ag,"python-repl":lg,r:cg,ruby:ug,rust:dg,scss:vg,shell:kg,sql:Eg,swift:Mg,typescript:Rg,vbnet:Og,wasm:Lg,xml:jg,yaml:Dg};var Cr,ss;function Bg(){if(ss)return Cr;ss=1;function e(A){return A instanceof Map?A.clear=A.delete=A.set=function(){throw new Error("map is read-only")}:A instanceof Set&&(A.add=A.clear=A.delete=function(){throw new Error("set is read-only")}),Object.freeze(A),Object.getOwnPropertyNames(A).forEach(z=>{const X=A[z],ce=typeof X;(ce==="object"||ce==="function")&&!Object.isFrozen(X)&&e(X)}),A}class t{constructor(z){z.data===void 0&&(z.data={}),this.data=z.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(A){return A.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function r(A,...z){const X=Object.create(null);for(const ce in A)X[ce]=A[ce];return z.forEach(function(ce){for(const Le in ce)X[Le]=ce[Le]}),X}const i="",s=A=>!!A.scope,o=(A,{prefix:z})=>{if(A.startsWith("language:"))return A.replace("language:","language-");if(A.includes(".")){const X=A.split(".");return[`${z}${X.shift()}`,...X.map((ce,Le)=>`${ce}${"_".repeat(Le+1)}`)].join(" ")}return`${z}${A}`};class l{constructor(z,X){this.buffer="",this.classPrefix=X.classPrefix,z.walk(this)}addText(z){this.buffer+=n(z)}openNode(z){if(!s(z))return;const X=o(z.scope,{prefix:this.classPrefix});this.span(X)}closeNode(z){s(z)&&(this.buffer+=i)}value(){return this.buffer}span(z){this.buffer+=``}}const u=(A={})=>{const z={children:[]};return Object.assign(z,A),z};class c{constructor(){this.rootNode=u(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(z){this.top.children.push(z)}openNode(z){const X=u({scope:z});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(z){return this.constructor._walk(z,this.rootNode)}static _walk(z,X){return typeof X=="string"?z.addText(X):X.children&&(z.openNode(X),X.children.forEach(ce=>this._walk(z,ce)),z.closeNode(X)),z}static _collapse(z){typeof z!="string"&&z.children&&(z.children.every(X=>typeof X=="string")?z.children=[z.children.join("")]:z.children.forEach(X=>{c._collapse(X)}))}}class d extends c{constructor(z){super(),this.options=z}addText(z){z!==""&&this.add(z)}startScope(z){this.openNode(z)}endScope(){this.closeNode()}__addSublanguage(z,X){const ce=z.root;X&&(ce.scope=`language:${X}`),this.add(ce)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function p(A){return A?typeof A=="string"?A:A.source:null}function m(A){return x("(?=",A,")")}function f(A){return x("(?:",A,")*")}function g(A){return x("(?:",A,")?")}function x(...A){return A.map(X=>p(X)).join("")}function y(A){const z=A[A.length-1];return typeof z=="object"&&z.constructor===Object?(A.splice(A.length-1,1),z):{}}function b(...A){return"("+(y(A).capture?"":"?:")+A.map(ce=>p(ce)).join("|")+")"}function k(A){return new RegExp(A.toString()+"|").exec("").length-1}function C(A,z){const X=A&&A.exec(z);return X&&X.index===0}const j=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function L(A,{joinWith:z}){let X=0;return A.map(ce=>{X+=1;const Le=X;let je=p(ce),te="";for(;je.length>0;){const Q=j.exec(je);if(!Q){te+=je;break}te+=je.substring(0,Q.index),je=je.substring(Q.index+Q[0].length),Q[0][0]==="\\"&&Q[1]?te+="\\"+String(Number(Q[1])+Le):(te+=Q[0],Q[0]==="("&&X++)}return te}).map(ce=>`(${ce})`).join(z)}const T=/\b\B/,B="[a-zA-Z]\\w*",O="[a-zA-Z_]\\w*",w="\\b\\d+(\\.\\d+)?",_="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",M="\\b(0b[01]+)",R="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",D=(A={})=>{const z=/^#![ ]*\//;return A.binary&&(A.begin=x(z,/.*\b/,A.binary,/\b.*/)),r({scope:"meta",begin:z,end:/$/,relevance:0,"on:begin":(X,ce)=>{X.index!==0&&ce.ignoreMatch()}},A)},N={begin:"\\\\[\\s\\S]",relevance:0},E={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[N]},I={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[N]},G={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/},H=function(A,z,X={}){const ce=r({scope:"comment",begin:A,end:z,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 Le=b("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:x(/[ ]+/,"(",Le,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),ce},V=H("//","$"),h=H("/\\*","\\*/"),F=H("#","$"),$={scope:"number",begin:w,relevance:0},v={scope:"number",begin:_,relevance:0},ie={scope:"number",begin:M,relevance:0},W={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[N,{begin:/\[/,end:/\]/,relevance:0,contains:[N]}]},U={scope:"title",begin:B,relevance:0},re={scope:"title",begin:O,relevance:0},de={begin:"\\.\\s*"+O,relevance:0};var Oe=Object.freeze({__proto__:null,APOS_STRING_MODE:E,BACKSLASH_ESCAPE:N,BINARY_NUMBER_MODE:ie,BINARY_NUMBER_RE:M,COMMENT:H,C_BLOCK_COMMENT_MODE:h,C_LINE_COMMENT_MODE:V,C_NUMBER_MODE:v,C_NUMBER_RE:_,END_SAME_AS_BEGIN:function(A){return Object.assign(A,{"on:begin":(z,X)=>{X.data._beginMatch=z[1]},"on:end":(z,X)=>{X.data._beginMatch!==z[1]&&X.ignoreMatch()}})},HASH_COMMENT_MODE:F,IDENT_RE:B,MATCH_NOTHING_RE:T,METHOD_GUARD:de,NUMBER_MODE:$,NUMBER_RE:w,PHRASAL_WORDS_MODE:G,QUOTE_STRING_MODE:I,REGEXP_MODE:W,RE_STARTERS_RE:R,SHEBANG:D,TITLE_MODE:U,UNDERSCORE_IDENT_RE:O,UNDERSCORE_TITLE_MODE:re});function Ie(A,z){A.input[A.index-1]==="."&&z.ignoreMatch()}function at(A,z){A.className!==void 0&&(A.scope=A.className,delete A.className)}function St(A,z){z&&A.beginKeywords&&(A.begin="\\b("+A.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",A.__beforeBegin=Ie,A.keywords=A.keywords||A.beginKeywords,delete A.beginKeywords,A.relevance===void 0&&(A.relevance=0))}function Pt(A,z){Array.isArray(A.illegal)&&(A.illegal=b(...A.illegal))}function yt(A,z){if(A.match){if(A.begin||A.end)throw new Error("begin & end are not supported with match");A.begin=A.match,delete A.match}}function ye(A,z){A.relevance===void 0&&(A.relevance=1)}const lt=(A,z)=>{if(!A.beforeMatch)return;if(A.starts)throw new Error("beforeMatch cannot be used with starts");const X=Object.assign({},A);Object.keys(A).forEach(ce=>{delete A[ce]}),A.keywords=X.keywords,A.begin=x(X.beforeMatch,m(X.begin)),A.starts={relevance:0,contains:[Object.assign(X,{endsParent:!0})]},A.relevance=0,delete X.beforeMatch},rt=["of","and","for","in","not","or","if","then","parent","list","value"],vt="keyword";function Bt(A,z,X=vt){const ce=Object.create(null);return typeof A=="string"?Le(X,A.split(" ")):Array.isArray(A)?Le(X,A):Object.keys(A).forEach(function(je){Object.assign(ce,Bt(A[je],z,je))}),ce;function Le(je,te){z&&(te=te.map(Q=>Q.toLowerCase())),te.forEach(function(Q){const le=Q.split("|");ce[le[0]]=[je,qt(le[0],le[1])]})}}function qt(A,z){return z?Number(z):J(A)?0:1}function J(A){return rt.includes(A.toLowerCase())}const he={},Re=A=>{console.error(A)},fe=(A,...z)=>{console.log(`WARN: ${A}`,...z)},P=(A,z)=>{he[`${A}/${z}`]||(console.log(`Deprecated as of ${A}. ${z}`),he[`${A}/${z}`]=!0)},K=new Error;function ee(A,z,{key:X}){let ce=0;const Le=A[X],je={},te={};for(let Q=1;Q<=z.length;Q++)te[Q+ce]=Le[Q],je[Q+ce]=!0,ce+=k(z[Q-1]);A[X]=te,A[X]._emit=je,A[X]._multi=!0}function ae(A){if(Array.isArray(A.begin)){if(A.skip||A.excludeBegin||A.returnBegin)throw Re("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),K;if(typeof A.beginScope!="object"||A.beginScope===null)throw Re("beginScope must be object"),K;ee(A,A.begin,{key:"beginScope"}),A.begin=L(A.begin,{joinWith:""})}}function Ee(A){if(Array.isArray(A.end)){if(A.skip||A.excludeEnd||A.returnEnd)throw Re("skip, excludeEnd, returnEnd not compatible with endScope: {}"),K;if(typeof A.endScope!="object"||A.endScope===null)throw Re("endScope must be object"),K;ee(A,A.end,{key:"endScope"}),A.end=L(A.end,{joinWith:""})}}function Ke(A){A.scope&&typeof A.scope=="object"&&A.scope!==null&&(A.beginScope=A.scope,delete A.scope)}function kt(A){Ke(A),typeof A.beginScope=="string"&&(A.beginScope={_wrap:A.beginScope}),typeof A.endScope=="string"&&(A.endScope={_wrap:A.endScope}),ae(A),Ee(A)}function ct(A){function z(te,Q){return new RegExp(p(te),"m"+(A.case_insensitive?"i":"")+(A.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+=k(Q)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Q=this.regexes.map(le=>le[1]);this.matcherRe=z(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 Fe=le.findIndex((sn,nr)=>nr>0&&sn!==void 0),De=this.matchIndexes[Fe];return le.splice(0,Fe),Object.assign(le,De)}}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(([Fe,De])=>le.addRule(Fe,De)),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 Fe=le.exec(Q);if(this.resumingScanAtSamePosition()&&!(Fe&&Fe.index===this.lastIndex)){const De=this.getMatcher(0);De.lastIndex=this.lastIndex+1,Fe=De.exec(Q)}return Fe&&(this.regexIndex+=Fe.position+1,this.regexIndex===this.count&&this.considerAll()),Fe}}function Le(te){const Q=new ce;return te.contains.forEach(le=>Q.addRule(le.begin,{rule:le,type:"begin"})),te.terminatorEnd&&Q.addRule(te.terminatorEnd,{type:"end"}),te.illegal&&Q.addRule(te.illegal,{type:"illegal"}),Q}function je(te,Q){const le=te;if(te.isCompiled)return le;[at,yt,kt,lt].forEach(De=>De(te,Q)),A.compilerExtensions.forEach(De=>De(te,Q)),te.__beforeBegin=null,[St,Pt,ye].forEach(De=>De(te,Q)),te.isCompiled=!0;let Fe=null;return typeof te.keywords=="object"&&te.keywords.$pattern&&(te.keywords=Object.assign({},te.keywords),Fe=te.keywords.$pattern,delete te.keywords.$pattern),Fe=Fe||/\w+/,te.keywords&&(te.keywords=Bt(te.keywords,A.case_insensitive)),le.keywordPatternRe=z(Fe,!0),Q&&(te.begin||(te.begin=/\B|\b/),le.beginRe=z(le.begin),!te.end&&!te.endsWithParent&&(te.end=/\B|\b/),te.end&&(le.endRe=z(le.end)),le.terminatorEnd=p(le.end)||"",te.endsWithParent&&Q.terminatorEnd&&(le.terminatorEnd+=(te.end?"|":"")+Q.terminatorEnd)),te.illegal&&(le.illegalRe=z(te.illegal)),te.contains||(te.contains=[]),te.contains=[].concat(...te.contains.map(function(De){return Ft(De==="self"?te:De)})),te.contains.forEach(function(De){je(De,le)}),te.starts&&je(te.starts,Q),le.matcher=Le(le),le}if(A.compilerExtensions||(A.compilerExtensions=[]),A.contains&&A.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return A.classNameAliases=r(A.classNameAliases||{}),je(A)}function Tt(A){return A?A.endsWithParent||Tt(A.starts):!1}function Ft(A){return A.variants&&!A.cachedVariants&&(A.cachedVariants=A.variants.map(function(z){return r(A,{variants:null},z)})),A.cachedVariants?A.cachedVariants:Tt(A)?r(A,{starts:A.starts?r(A.starts):null}):Object.isFrozen(A)?r(A):A}var Ge="11.11.1";class Ct extends Error{constructor(z,X){super(z),this.name="HTMLInjectionError",this.html=X}}const Ze=n,xi=r,yi=Symbol("nomatch"),sl=7,vi=function(A){const z=Object.create(null),X=Object.create(null),ce=[];let Le=!0;const je="Could not find the language '{}', did you forget to load/include a language module?",te={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 Fe(Y){let oe=Y.className+" ";oe+=Y.parentNode?Y.parentNode.className:"";const xe=Q.languageDetectRe.exec(oe);if(xe){const Se=At(xe[1]);return Se||(fe(je.replace("{}",xe[1])),fe("Falling back to no-highlight mode for this block.",Y)),Se?xe[1]:"no-highlight"}return oe.split(/\s+/).find(Se=>le(Se)||At(Se))}function De(Y,oe,xe){let Se="",Be="";typeof oe=="object"?(Se=Y,xe=oe.ignoreIllegals,Be=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`),Be=Y,Se=oe),xe===void 0&&(xe=!0);const ut={code:Se,language:Be};wn("before:highlight",ut);const Mt=ut.result?ut.result:sn(ut.language,ut.code,xe);return Mt.code=ut.code,wn("after:highlight",Mt),Mt}function sn(Y,oe,xe,Se){const Be=Object.create(null);function ut(Z,ne){return Z.keywords[ne]}function Mt(){if(!ue.keywords){ze.addText(Te);return}let Z=0;ue.keywordPatternRe.lastIndex=0;let ne=ue.keywordPatternRe.exec(Te),me="";for(;ne;){me+=Te.substring(Z,ne.index);const we=ft.case_insensitive?ne[0].toLowerCase():ne[0],Ue=ut(ue,we);if(Ue){const[Et,wl]=Ue;if(ze.addText(me),me="",Be[we]=(Be[we]||0)+1,Be[we]<=sl&&(Sn+=wl),Et.startsWith("_"))me+=ne[0];else{const _l=ft.classNameAliases[Et]||Et;pt(ne[0],_l)}}else me+=ne[0];Z=ue.keywordPatternRe.lastIndex,ne=ue.keywordPatternRe.exec(Te)}me+=Te.substring(Z),ze.addText(me)}function _n(){if(Te==="")return;let Z=null;if(typeof ue.subLanguage=="string"){if(!z[ue.subLanguage]){ze.addText(Te);return}Z=sn(ue.subLanguage,Te,!0,Ci[ue.subLanguage]),Ci[ue.subLanguage]=Z._top}else Z=rr(Te,ue.subLanguage.length?ue.subLanguage:null);ue.relevance>0&&(Sn+=Z.relevance),ze.__addSublanguage(Z._emitter,Z.language)}function Je(){ue.subLanguage!=null?_n():Mt(),Te=""}function pt(Z,ne){Z!==""&&(ze.startScope(ne),ze.addText(Z),ze.endScope())}function _i(Z,ne){let me=1;const we=ne.length-1;for(;me<=we;){if(!Z._emit[me]){me++;continue}const Ue=ft.classNameAliases[Z[me]]||Z[me],Et=ne[me];Ue?pt(Et,Ue):(Te=Et,Mt(),Te=""),me++}}function Ni(Z,ne){return Z.scope&&typeof Z.scope=="string"&&ze.openNode(ft.classNameAliases[Z.scope]||Z.scope),Z.beginScope&&(Z.beginScope._wrap?(pt(Te,ft.classNameAliases[Z.beginScope._wrap]||Z.beginScope._wrap),Te=""):Z.beginScope._multi&&(_i(Z.beginScope,ne),Te="")),ue=Object.create(Z,{parent:{value:ue}}),ue}function Si(Z,ne,me){let we=C(Z.endRe,me);if(we){if(Z["on:end"]){const Ue=new t(Z);Z["on:end"](ne,Ue),Ue.isMatchIgnored&&(we=!1)}if(we){for(;Z.endsParent&&Z.parent;)Z=Z.parent;return Z}}if(Z.endsWithParent)return Si(Z.parent,ne,me)}function xl(Z){return ue.matcher.regexIndex===0?(Te+=Z[0],1):(ar=!0,0)}function yl(Z){const ne=Z[0],me=Z.rule,we=new t(me),Ue=[me.__beforeBegin,me["on:begin"]];for(const Et of Ue)if(Et&&(Et(Z,we),we.isMatchIgnored))return xl(ne);return me.skip?Te+=ne:(me.excludeBegin&&(Te+=ne),Je(),!me.returnBegin&&!me.excludeBegin&&(Te=ne)),Ni(me,Z),me.returnBegin?0:ne.length}function vl(Z){const ne=Z[0],me=oe.substring(Z.index),we=Si(ue,Z,me);if(!we)return yi;const Ue=ue;ue.endScope&&ue.endScope._wrap?(Je(),pt(ne,ue.endScope._wrap)):ue.endScope&&ue.endScope._multi?(Je(),_i(ue.endScope,Z)):Ue.skip?Te+=ne:(Ue.returnEnd||Ue.excludeEnd||(Te+=ne),Je(),Ue.excludeEnd&&(Te=ne));do ue.scope&&ze.closeNode(),!ue.skip&&!ue.subLanguage&&(Sn+=ue.relevance),ue=ue.parent;while(ue!==we.parent);return we.starts&&Ni(we.starts,Z),Ue.returnEnd?0:ne.length}function kl(){const Z=[];for(let ne=ue;ne!==ft;ne=ne.parent)ne.scope&&Z.unshift(ne.scope);Z.forEach(ne=>ze.openNode(ne))}let Nn={};function Ti(Z,ne){const me=ne&&ne[0];if(Te+=Z,me==null)return Je(),0;if(Nn.type==="begin"&&ne.type==="end"&&Nn.index===ne.index&&me===""){if(Te+=oe.slice(ne.index,ne.index+1),!Le){const we=new Error(`0 width match regex (${Y})`);throw we.languageName=Y,we.badRule=Nn.rule,we}return 1}if(Nn=ne,ne.type==="begin")return yl(ne);if(ne.type==="illegal"&&!xe){const we=new Error('Illegal lexeme "'+me+'" for mode "'+(ue.scope||"")+'"');throw we.mode=ue,we}else if(ne.type==="end"){const we=vl(ne);if(we!==yi)return we}if(ne.type==="illegal"&&me==="")return Te+=` +`,1;if(sr>1e5&&sr>ne.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Te+=me,me.length}const ft=At(Y);if(!ft)throw Re(je.replace("{}",Y)),new Error('Unknown language: "'+Y+'"');const El=ct(ft);let or="",ue=Se||El;const Ci={},ze=new Q.__emitter(Q);kl();let Te="",Sn=0,zt=0,sr=0,ar=!1;try{if(ft.__emitTokens)ft.__emitTokens(oe,ze);else{for(ue.matcher.considerAll();;){sr++,ar?ar=!1:ue.matcher.considerAll(),ue.matcher.lastIndex=zt;const Z=ue.matcher.exec(oe);if(!Z)break;const ne=oe.substring(zt,Z.index),me=Ti(ne,Z);zt=Z.index+me}Ti(oe.substring(zt))}return ze.finalize(),or=ze.toHTML(),{language:Y,value:or,relevance:Sn,illegal:!1,_emitter:ze,_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:zt,context:oe.slice(zt-100,zt+100),mode:Z.mode,resultSoFar:or},_emitter:ze};if(Le)return{language:Y,value:Ze(oe),illegal:!1,relevance:0,errorRaised:Z,_emitter:ze,_top:ue};throw Z}}function nr(Y){const oe={value:Ze(Y),illegal:!1,relevance:0,_top:te,_emitter:new Q.__emitter(Q)};return oe._emitter.addText(Y),oe}function rr(Y,oe){oe=oe||Q.languages||Object.keys(z);const xe=nr(Y),Se=oe.filter(At).filter(wi).map(Je=>sn(Je,Y,!1));Se.unshift(xe);const Be=Se.sort((Je,pt)=>{if(Je.relevance!==pt.relevance)return pt.relevance-Je.relevance;if(Je.language&&pt.language){if(At(Je.language).supersetOf===pt.language)return 1;if(At(pt.language).supersetOf===Je.language)return-1}return 0}),[ut,Mt]=Be,_n=ut;return _n.secondBest=Mt,_n}function al(Y,oe,xe){const Se=oe&&X[oe]||xe;Y.classList.add("hljs"),Y.classList.add(`language-${Se}`)}function ir(Y){let oe=null;const xe=Fe(Y);if(le(xe))return;if(wn("before:highlightElement",{el:Y,language:xe}),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 Ct("One of your code blocks includes unescaped HTML.",Y.innerHTML);oe=Y;const Se=oe.textContent,Be=xe?De(Se,{language:xe,ignoreIllegals:!0}):rr(Se);Y.innerHTML=Be.value,Y.dataset.highlighted="yes",al(Y,xe,Be.language),Y.result={language:Be.language,re:Be.relevance,relevance:Be.relevance},Be.secondBest&&(Y.secondBest={language:Be.secondBest.language,relevance:Be.secondBest.relevance}),wn("after:highlightElement",{el:Y,result:Be,text:Se})}function ll(Y){Q=xi(Q,Y)}const cl=()=>{En(),P("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function ul(){En(),P("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let ki=!1;function En(){function Y(){En()}if(document.readyState==="loading"){ki||window.addEventListener("DOMContentLoaded",Y,!1),ki=!0;return}document.querySelectorAll(Q.cssSelector).forEach(ir)}function dl(Y,oe){let xe=null;try{xe=oe(A)}catch(Se){if(Re("Language definition for '{}' could not be registered.".replace("{}",Y)),Le)Re(Se);else throw Se;xe=te}xe.name||(xe.name=Y),z[Y]=xe,xe.rawDefinition=oe.bind(null,A),xe.aliases&&Ei(xe.aliases,{languageName:Y})}function pl(Y){delete z[Y];for(const oe of Object.keys(X))X[oe]===Y&&delete X[oe]}function fl(){return Object.keys(z)}function At(Y){return Y=(Y||"").toLowerCase(),z[Y]||z[X[Y]]}function Ei(Y,{languageName:oe}){typeof Y=="string"&&(Y=[Y]),Y.forEach(xe=>{X[xe.toLowerCase()]=oe})}function wi(Y){const oe=At(Y);return oe&&!oe.disableAutodetect}function ml(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 hl(Y){ml(Y),ce.push(Y)}function gl(Y){const oe=ce.indexOf(Y);oe!==-1&&ce.splice(oe,1)}function wn(Y,oe){const xe=Y;ce.forEach(function(Se){Se[xe]&&Se[xe](oe)})}function bl(Y){return P("10.7.0","highlightBlock will be removed entirely in v12.0"),P("10.7.0","Please use highlightElement now."),ir(Y)}Object.assign(A,{highlight:De,highlightAuto:rr,highlightAll:En,highlightElement:ir,highlightBlock:bl,configure:ll,initHighlighting:cl,initHighlightingOnLoad:ul,registerLanguage:dl,unregisterLanguage:pl,listLanguages:fl,getLanguage:At,registerAliases:Ei,autoDetection:wi,inherit:xi,addPlugin:hl,removePlugin:gl}),A.debugMode=function(){Le=!1},A.safeMode=function(){Le=!0},A.versionString=Ge,A.regex={concat:x,lookahead:m,either:b,optional:g,anyNumberOfTimes:f};for(const Y in Oe)typeof Oe[Y]=="object"&&e(Oe[Y]);return Object.assign(A,Oe),A},Vt=vi({});return Vt.newInstance=()=>vi({}),Cr=Vt,Vt.HighlightJS=Vt,Vt.default=Vt,Cr}var Fg=Bg();const zg=Vr(Fg),as={},$g="hljs-";function Ug(e){const t=zg.newInstance();return e&&s(e),{highlight:n,highlightAuto:r,listLanguages:i,register:s,registerAlias:o,registered:l};function n(u,c,d){const p=d||as,m=typeof p.prefix=="string"?p.prefix:$g;if(!t.getLanguage(u))throw new Error("Unknown language: `"+u+"` is not registered");t.configure({__emitter:Hg,classPrefix:m});const f=t.highlight(c,{ignoreIllegals:!0,language:u});if(f.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:f.errorRaised});const g=f._emitter.root,x=g.data;return x.language=f.language,x.relevance=f.relevance,g}function r(u,c){const p=(c||as).subset||i();let m=-1,f=0,g;for(;++mf&&(f=y.data.relevance,g=y)}return g||{type:"root",children:[],data:{language:void 0,relevance:f}}}function i(){return t.listLanguages()}function s(u,c){if(typeof u=="string")t.registerLanguage(u,c);else{let d;for(d in u)Object.hasOwn(u,d)&&t.registerLanguage(d,u[d])}}function o(u,c){if(typeof u=="string")t.registerAliases(typeof c=="string"?c:[...c],{languageName:u});else{let d;for(d in u)if(Object.hasOwn(u,d)){const p=u[d];t.registerAliases(typeof p=="string"?p:[...p],{languageName:d})}}}function l(u){return!!t.getLanguage(u)}}class Hg{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const r=this.stack[this.stack.length-1],i=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(t){const n=this,r=t.split(".").map(function(o,l){return l?o+"_".repeat(l):n.options.classPrefix+o}),i=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const Wg={};function Kg(e){const t=e||Wg,n=t.aliases,r=t.detect||!1,i=t.languages||Pg,s=t.plainText,o=t.prefix,l=t.subset;let u="hljs";const c=Ug(i);if(n&&c.registerAlias(n),o){const d=o.indexOf("-");u=d===-1?o:o.slice(0,d)}return function(d,p){tr(d,"element",function(m,f,g){if(m.tagName!=="code"||!g||g.type!=="element"||g.tagName!=="pre")return;const x=Gg(m);if(x===!1||!x&&!r||x&&s&&s.includes(x))return;Array.isArray(m.properties.className)||(m.properties.className=[]),m.properties.className.includes(u)||m.properties.className.unshift(u);const y=uh(m,{whitespace:"pre"});let b;try{b=x?c.highlight(x,y,{prefix:o}):c.highlightAuto(y,{prefix:o,subset:l})}catch(k){const C=k;if(x&&/Unknown language/.test(C.message)){p.message("Cannot highlight as `"+x+"`, it’s not registered",{ancestors:[g,m],cause:C,place:m.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw C}!x&&b.data&&b.data.language&&m.properties.className.push("language-"+b.data.language),b.children.length>0&&(m.children=b.children)})}}function Gg(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let r;for(;++n0?{type:"text",value:T}:void 0),T===!1?m.lastIndex=j+1:(g!==j&&k.push({type:"text",value:c.value.slice(g,j)}),Array.isArray(T)?k.push(...T):T&&k.push(T),g=j+C[0].length,b=!0),!m.global)break;C=m.exec(c.value)}return b?(g?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=ls(e,"(");let s=ls(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function Pa(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Wt(n)||Zn(n))&&(!t||n!==47)}Ba.peek=xb;function ub(){this.buffer()}function db(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function pb(){this.buffer()}function fb(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function mb(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=dt(this.sliceSerialize(e)).toLowerCase(),n.label=t}function hb(e){this.exit(e)}function gb(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=dt(this.sliceSerialize(e)).toLowerCase(),n.label=t}function bb(e){this.exit(e)}function xb(){return"["}function Ba(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const o=n.enter("footnoteReference"),l=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),l(),o(),s+=i.move("]"),s}function yb(){return{enter:{gfmFootnoteCallString:ub,gfmFootnoteCall:db,gfmFootnoteDefinitionLabelString:pb,gfmFootnoteDefinition:fb},exit:{gfmFootnoteCallString:mb,gfmFootnoteCall:hb,gfmFootnoteDefinitionLabelString:gb,gfmFootnoteDefinition:bb}}}function vb(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Ba},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,o){const l=s.createTracker(o);let u=l.move("[^");const c=s.enter("footnoteDefinition"),d=s.enter("label");return u+=l.move(s.safe(s.associationId(r),{before:u,after:"]"})),d(),u+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),u+=l.move((t?` +`:" ")+s.indentLines(s.containerFlow(r,l.current()),t?Fa:kb))),c(),u}}function kb(e,t,n){return t===0?e:Fa(e,t,n)}function Fa(e,t,n){return(n?"":" ")+e}const Eb=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];za.peek=Tb;function wb(){return{canContainEols:["delete"],enter:{strikethrough:Nb},exit:{strikethrough:Sb}}}function _b(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Eb}],handlers:{delete:za}}}function Nb(e){this.enter({type:"delete",children:[]},e)}function Sb(e){this.exit(e)}function za(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function Tb(){return"~"}function Cb(e){return e.length}function Ab(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Cb,s=[],o=[],l=[],u=[];let c=0,d=-1;for(;++dc&&(c=e[d].length);++bu[b])&&(u[b]=C)}x.push(k)}o[d]=x,l[d]=y}let p=-1;if(typeof r=="object"&&"length"in r)for(;++pu[p]&&(u[p]=k),f[p]=k),m[p]=C}o.splice(1,0,m),l.splice(1,0,f),d=-1;const g=[];for(;++d "),s.shift(2);const o=n.indentLines(n.containerFlow(e,s.current()),Rb);return i(),o}function Rb(e,t,n){return">"+(n?"":" ")+e}function Ob(e,t){return us(e,t.inConstruct,!0)&&!us(e,t.notInConstruct,!1)}function us(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ro&&(o=s):s=1,i=r+t.length,r=n.indexOf(t,i);return o}function jb(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Db(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Pb(e,t,n,r){const i=Db(n),s=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(jb(e,n)){const p=n.enter("codeIndented"),m=n.indentLines(s,Bb);return p(),m}const l=n.createTracker(r),u=i.repeat(Math.max(Lb(s,i)+1,3)),c=n.enter("codeFenced");let d=l.move(u);if(e.lang){const p=n.enter(`codeFencedLang${o}`);d+=l.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),p()}if(e.lang&&e.meta){const p=n.enter(`codeFencedMeta${o}`);d+=l.move(" "),d+=l.move(n.safe(e.meta,{before:d,after:` +`,encode:["`"],...l.current()})),p()}return d+=l.move(` +`),s&&(d+=l.move(s+` +`)),d+=l.move(u),c(),d}function Bb(e,t,n){return(n?"":" ")+e}function hi(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Fb(e,t,n,r){const i=hi(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("definition");let l=n.enter("label");const u=n.createTracker(r);let c=u.move("[");return c+=u.move(n.safe(n.associationId(e),{before:c,after:"]",...u.current()})),c+=u.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=u.move("<"),c+=u.move(n.safe(e.url,{before:c,after:">",...u.current()})),c+=u.move(">")):(l=n.enter("destinationRaw"),c+=u.move(n.safe(e.url,{before:c,after:e.title?" ":` +`,...u.current()}))),l(),e.title&&(l=n.enter(`title${s}`),c+=u.move(" "+i),c+=u.move(n.safe(e.title,{before:c,after:i,...u.current()})),c+=u.move(i),l()),o(),c}function zb(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function bn(e){return"&#x"+e.toString(16).toUpperCase()+";"}function qn(e,t,n){const r=nn(e),i=nn(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}$a.peek=$b;function $a(e,t,n,r){const i=zb(n),s=n.enter("emphasis"),o=n.createTracker(r),l=o.move(i);let u=o.move(n.containerPhrasing(e,{after:i,before:l,...o.current()}));const c=u.charCodeAt(0),d=qn(r.before.charCodeAt(r.before.length-1),c,i);d.inside&&(u=bn(c)+u.slice(1));const p=u.charCodeAt(u.length-1),m=qn(r.after.charCodeAt(0),p,i);m.inside&&(u=u.slice(0,-1)+bn(p));const f=o.move(i);return s(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},l+u+f}function $b(e,t,n){return n.options.emphasis||"*"}function Ub(e,t){let n=!1;return tr(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Ur}),!!((!e.depth||e.depth<3)&&oi(e)&&(t.options.setext||n))}function Hb(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(Ub(e,n)){const d=n.enter("headingSetext"),p=n.enter("phrasing"),m=n.containerPhrasing(e,{...s.current(),before:` +`,after:` +`});return p(),d(),m+` +`+(i===1?"=":"-").repeat(m.length-(Math.max(m.lastIndexOf("\r"),m.lastIndexOf(` +`))+1))}const o="#".repeat(i),l=n.enter("headingAtx"),u=n.enter("phrasing");s.move(o+" ");let c=n.containerPhrasing(e,{before:"# ",after:` +`,...s.current()});return/^[\t ]/.test(c)&&(c=bn(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),u(),l(),c}Ua.peek=Wb;function Ua(e){return e.value||""}function Wb(){return"<"}Ha.peek=Kb;function Ha(e,t,n,r){const i=hi(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("image");let l=n.enter("label");const u=n.createTracker(r);let c=u.move("![");return c+=u.move(n.safe(e.alt,{before:c,after:"]",...u.current()})),c+=u.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=u.move("<"),c+=u.move(n.safe(e.url,{before:c,after:">",...u.current()})),c+=u.move(">")):(l=n.enter("destinationRaw"),c+=u.move(n.safe(e.url,{before:c,after:e.title?" ":")",...u.current()}))),l(),e.title&&(l=n.enter(`title${s}`),c+=u.move(" "+i),c+=u.move(n.safe(e.title,{before:c,after:i,...u.current()})),c+=u.move(i),l()),c+=u.move(")"),o(),c}function Kb(){return"!"}Wa.peek=Gb;function Wa(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let o=n.enter("label");const l=n.createTracker(r);let u=l.move("![");const c=n.safe(e.alt,{before:u,after:"]",...l.current()});u+=l.move(c+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const p=n.safe(n.associationId(e),{before:u,after:"]",...l.current()});return o(),n.stack=d,s(),i==="full"||!c||c!==p?u+=l.move(p+"]"):i==="shortcut"?u=u.slice(0,-1):u+=l.move("]"),u}function Gb(){return"!"}Ka.peek=qb;function Ka(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s\u007F]/.test(e.url))}qa.peek=Vb;function qa(e,t,n,r){const i=hi(n),s=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let l,u;if(Ga(e,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let p=o.move("<");return p+=o.move(n.containerPhrasing(e,{before:p,after:">",...o.current()})),p+=o.move(">"),l(),n.stack=d,p}l=n.enter("link"),u=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(e,{before:c,after:"](",...o.current()})),c+=o.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(e.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(u=n.enter("destinationRaw"),c+=o.move(n.safe(e.url,{before:c,after:e.title?" ":")",...o.current()}))),u(),e.title&&(u=n.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(n.safe(e.title,{before:c,after:i,...o.current()})),c+=o.move(i),u()),c+=o.move(")"),l(),c}function Vb(e,t,n){return Ga(e,n)?"<":"["}Va.peek=Yb;function Va(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let o=n.enter("label");const l=n.createTracker(r);let u=l.move("[");const c=n.containerPhrasing(e,{before:u,after:"]",...l.current()});u+=l.move(c+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const p=n.safe(n.associationId(e),{before:u,after:"]",...l.current()});return o(),n.stack=d,s(),i==="full"||!c||c!==p?u+=l.move(p+"]"):i==="shortcut"?u=u.slice(0,-1):u+=l.move("]"),u}function Yb(){return"["}function gi(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Xb(e){const t=gi(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Zb(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Ya(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Jb(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let o=e.ordered?Zb(n):gi(n);const l=e.ordered?o==="."?")":".":Xb(n);let u=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(u=!0),Ya(n)===o&&d){let p=-1;for(;++p-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=n.createTracker(r);l.move(s+" ".repeat(o-s.length)),l.shift(o);const u=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,l.current()),d);return u(),c;function d(p,m,f){return m?(f?"":" ".repeat(o))+p:(f?s:s+" ".repeat(o-s.length))+p}}function tx(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(e,r);return s(),i(),o}const nx=vn(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function rx(e,t,n,r){return(e.children.some(function(o){return nx(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function ix(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Xa.peek=ox;function Xa(e,t,n,r){const i=ix(n),s=n.enter("strong"),o=n.createTracker(r),l=o.move(i+i);let u=o.move(n.containerPhrasing(e,{after:i,before:l,...o.current()}));const c=u.charCodeAt(0),d=qn(r.before.charCodeAt(r.before.length-1),c,i);d.inside&&(u=bn(c)+u.slice(1));const p=u.charCodeAt(u.length-1),m=qn(r.after.charCodeAt(0),p,i);m.inside&&(u=u.slice(0,-1)+bn(p));const f=o.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},l+u+f}function ox(e,t,n){return n.options.strong||"*"}function sx(e,t,n,r){return n.safe(e.value,r)}function ax(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function lx(e,t,n){const r=(Ya(n)+(n.options.ruleSpaces?" ":"")).repeat(ax(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Za={blockquote:Ib,break:ds,code:Pb,definition:Fb,emphasis:$a,hardBreak:ds,heading:Hb,html:Ua,image:Ha,imageReference:Wa,inlineCode:Ka,link:qa,linkReference:Va,list:Jb,listItem:ex,paragraph:tx,root:rx,strong:Xa,text:sx,thematicBreak:lx};function cx(){return{enter:{table:ux,tableData:ps,tableHeader:ps,tableRow:px},exit:{codeText:fx,table:dx,tableData:Rr,tableHeader:Rr,tableRow:Rr}}}function ux(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function dx(e){this.exit(e),this.data.inTable=void 0}function px(e){this.enter({type:"tableRow",children:[]},e)}function Rr(e){this.exit(e)}function ps(e){this.enter({type:"tableCell",children:[]},e)}function fx(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,mx));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function mx(e,t){return t==="|"?t:e}function hx(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:o,tableCell:u,tableRow:l}};function o(f,g,x,y){return c(d(f,x,y),f.align)}function l(f,g,x,y){const b=p(f,x,y),k=c([b]);return k.slice(0,k.indexOf(` +`))}function u(f,g,x,y){const b=x.enter("tableCell"),k=x.enter("phrasing"),C=x.containerPhrasing(f,{...y,before:s,after:s});return k(),b(),C}function c(f,g){return Ab(f,{align:g,alignDelimiters:r,padding:n,stringLength:i})}function d(f,g,x){const y=f.children;let b=-1;const k=[],C=g.enter("table");for(;++b0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Ox={tokenize:$x,partial:!0};function Lx(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Bx,continuation:{tokenize:Fx},exit:zx}},text:{91:{name:"gfmFootnoteCall",tokenize:Px},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:jx,resolveTo:Dx}}}}function jx(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const u=r.events[i][1];if(u.type==="labelImage"){o=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return l;function l(u){if(!o||!o._balanced)return n(u);const c=dt(r.sliceSerialize({start:o.end,end:r.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?n(u):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),t(u))}}function Dx(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function Px(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,o;return l;function l(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),u}function u(p){return p!==94?n(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(p){if(s>999||p===93&&!o||p===null||p===91||Ne(p))return n(p);if(p===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return i.includes(dt(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return Ne(p)||(o=!0),s++,e.consume(p),p===92?d:c}function d(p){return p===91||p===92||p===93?(e.consume(p),s++,c):c(p)}}function Bx(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,l;return u;function u(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(g)}function d(g){if(o>999||g===93&&!l||g===null||g===91||Ne(g))return n(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteDefinitionLabelString");return s=dt(r.sliceSerialize(x)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return Ne(g)||(l=!0),o++,e.consume(g),g===92?p:d}function p(g){return g===91||g===92||g===93?(e.consume(g),o++,d):d(g)}function m(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),i.includes(s)||i.push(s),ve(e,f,"gfmFootnoteDefinitionWhitespace")):n(g)}function f(g){return t(g)}}function Fx(e,t,n){return e.check(yn,t,e.attempt(Ox,t,n))}function zx(e){e.exit("gfmFootnoteDefinition")}function $x(e,t,n){const r=this;return ve(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):n(s)}}function Ux(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,l){let u=-1;for(;++u1?u(g):(o.consume(g),p++,f);if(p<2&&!n)return u(g);const y=o.exit("strikethroughSequenceTemporary"),b=nn(g);return y._open=!b||b===2&&!!x,y._close=!x||x===2&&!!b,l(g)}}}class Hx{constructor(){this.map=[]}add(t,n,r){Wx(this,t,n,r)}consume(t){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function Wx(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i-1;){const N=r.events[M][1].type;if(N==="lineEnding"||N==="linePrefix")M--;else break}const R=M>-1?r.events[M][1].type:null,D=R==="tableHead"||R==="tableRow"?T:u;return D===T&&r.parser.lazy[r.now().line]?n(_):D(_)}function u(_){return e.enter("tableHead"),e.enter("tableRow"),c(_)}function c(_){return _===124||(o=!0,s+=1),d(_)}function d(_){return _===null?n(_):se(_)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),f):n(_):ge(_)?ve(e,d,"whitespace")(_):(s+=1,o&&(o=!1,i+=1),_===124?(e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),p(_)))}function p(_){return _===null||_===124||Ne(_)?(e.exit("data"),d(_)):(e.consume(_),_===92?m:p)}function m(_){return _===92||_===124?(e.consume(_),p):p(_)}function f(_){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(_):(e.enter("tableDelimiterRow"),o=!1,ge(_)?ve(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):g(_))}function g(_){return _===45||_===58?y(_):_===124?(o=!0,e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),x):L(_)}function x(_){return ge(_)?ve(e,y,"whitespace")(_):y(_)}function y(_){return _===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(_),e.exit("tableDelimiterMarker"),b):_===45?(s+=1,b(_)):_===null||se(_)?j(_):L(_)}function b(_){return _===45?(e.enter("tableDelimiterFiller"),k(_)):L(_)}function k(_){return _===45?(e.consume(_),k):_===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(_),e.exit("tableDelimiterMarker"),C):(e.exit("tableDelimiterFiller"),C(_))}function C(_){return ge(_)?ve(e,j,"whitespace")(_):j(_)}function j(_){return _===124?g(_):_===null||se(_)?!o||i!==s?L(_):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(_)):L(_)}function L(_){return n(_)}function T(_){return e.enter("tableRow"),B(_)}function B(_){return _===124?(e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),B):_===null||se(_)?(e.exit("tableRow"),t(_)):ge(_)?ve(e,B,"whitespace")(_):(e.enter("data"),O(_))}function O(_){return _===null||_===124||Ne(_)?(e.exit("data"),B(_)):(e.consume(_),_===92?w:O)}function w(_){return _===92||_===124?(e.consume(_),O):O(_)}}function Vx(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],l=!1,u=0,c,d,p;const m=new Hx;for(;++nn[2]+1){const g=n[2]+1,x=n[3]-n[2]-1;e.add(g,x,[])}}e.add(n[3]+1,0,[["exit",p,t]])}return i!==void 0&&(s.end=Object.assign({},Qt(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function ms(e,t,n,r,i){const s=[],o=Qt(t.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function Qt(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const Yx={name:"tasklistCheck",tokenize:Zx};function Xx(){return{text:{91:Yx}}}function Zx(e,t,n){const r=this;return i;function i(u){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(u):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),s)}function s(u){return Ne(u)?(e.enter("taskListCheckValueUnchecked"),e.consume(u),e.exit("taskListCheckValueUnchecked"),o):u===88||u===120?(e.enter("taskListCheckValueChecked"),e.consume(u),e.exit("taskListCheckValueChecked"),o):n(u)}function o(u){return u===93?(e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(u)}function l(u){return se(u)?t(u):ge(u)?e.check({tokenize:Jx},t,n)(u):n(u)}}function Jx(e,t,n){return ve(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function Qx(e){return Ys([_x(),Lx(),Ux(e),Gx(),Xx()])}const ey={};function ty(e){const t=this,n=e||ey,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Qx(n)),s.push(vx()),o.push(kx(n))}const ny={user:{label:"You",color:"var(--info)"},assistant:{label:"AI",color:"var(--success)"},tool:{label:"Tool",color:"var(--warning)"},plan:{label:"Plan",color:"var(--accent)"},thinking:{label:"Reasoning",color:"var(--text-muted)"}};function ry({message:e}){const[t,n]=S.useState(!1);return a.jsxs("div",{className:"py-1.5",children:[a.jsxs("button",{onClick:()=>n(!t),className:"flex items-center gap-1.5 mb-0.5 cursor-pointer",style:{background:"none",border:"none",padding:0},children:[a.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:"var(--text-muted)",opacity:.5}}),a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-muted)"},children:"Reasoning"}),a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-muted)",strokeWidth:"2",style:{transform:t?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.15s",marginLeft:2},children:a.jsx("path",{d:"M6 9l6 6 6-6"})})]}),t&&a.jsx("div",{className:"text-[12px] leading-relaxed pl-2.5 max-w-prose whitespace-pre-wrap",style:{color:"var(--text-muted)",fontStyle:"italic"},children:e.content})]})}function iy({message:e}){const t=e.planItems??[];return a.jsxs("div",{className:"py-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[a.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:"var(--accent)"}}),a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--accent)"},children:"Plan"})]}),a.jsx("div",{className:"pl-2.5 space-y-1 mt-1",children:t.map((n,r)=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[n.status==="completed"?a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--success)",strokeWidth:"2.5",strokeLinecap:"round",children:a.jsx("path",{d:"M20 6L9 17l-5-5"})}):n.status==="in_progress"?a.jsx("span",{className:"w-3.5 h-3.5 flex items-center justify-center",children:a.jsx("span",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"var(--accent)"}})}):a.jsx("span",{className:"w-3.5 h-3.5 flex items-center justify-center",children:a.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:"var(--text-muted)",opacity:.4}})}),a.jsx("span",{style:{color:n.status==="completed"?"var(--text-muted)":"var(--text-primary)",textDecoration:n.status==="completed"?"line-through":"none"},children:n.title})]},r))})]})}function oy({tc:e}){const t=n=>{if(!e.tool_call_id)return;const r=$e.getState().sessionId;r&&($e.getState().resolveToolApproval(e.tool_call_id,n),Yn().sendToolApproval(r,e.tool_call_id,n))};return a.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid color-mix(in srgb, var(--warning) 40%, var(--border))"},children:[a.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:[a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--warning)"},children:"Action Required"}),a.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:e.tool})]}),e.args!=null&&a.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:JSON.stringify(e.args,null,2)}),a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{background:"var(--bg-secondary)",borderTop:"1px solid var(--border)"},children:[a.jsx("button",{onClick:()=>t(!0),className:"text-xs font-semibold px-3 py-1.5 rounded cursor-pointer transition-colors",style:{background:"color-mix(in srgb, var(--success) 15%, var(--bg-secondary))",color:"var(--success)",border:"1px solid color-mix(in srgb, var(--success) 30%, var(--border))"},onMouseEnter:n=>{n.currentTarget.style.background="color-mix(in srgb, var(--success) 25%, var(--bg-secondary))"},onMouseLeave:n=>{n.currentTarget.style.background="color-mix(in srgb, var(--success) 15%, var(--bg-secondary))"},children:"Approve"}),a.jsx("button",{onClick:()=>t(!1),className:"text-xs font-semibold px-3 py-1.5 rounded cursor-pointer transition-colors",style:{background:"color-mix(in srgb, var(--error) 15%, var(--bg-secondary))",color:"var(--error)",border:"1px solid color-mix(in srgb, var(--error) 30%, var(--border))"},onMouseEnter:n=>{n.currentTarget.style.background="color-mix(in srgb, var(--error) 25%, var(--bg-secondary))"},onMouseLeave:n=>{n.currentTarget.style.background="color-mix(in srgb, var(--error) 15%, var(--bg-secondary))"},children:"Reject"})]})]})}function sy({tc:e,active:t,onClick:n}){const r=e.status==="denied",i=e.result!==void 0,s=r?"var(--error)":i?e.is_error?"var(--error)":"var(--success)":"var(--text-muted)",o=r?"✗":i?e.is_error?"✗":"✓":"•";return a.jsxs("button",{onClick:n,className:"inline-flex items-center gap-1 text-[11px] font-mono px-2 py-1 rounded cursor-pointer transition-all",style:{background:t?"var(--bg-secondary)":"var(--bg-primary)",border:t?"1px solid var(--text-muted)":"1px solid var(--border)",color:s},children:[o," ",e.tool,r&&a.jsx("span",{className:"ml-1 text-[10px] uppercase",children:"Denied"})]})}function ay({tc:e}){const t=e.result!==void 0,n=e.args!=null&&Object.keys(e.args).length>0;return a.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)"},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5",style:{borderBottom:"1px solid var(--border)"},children:[a.jsx("span",{className:"text-[11px] font-mono font-semibold",style:{color:"var(--text-primary)"},children:e.tool}),e.is_error&&a.jsx("span",{className:"text-[10px] font-semibold px-1.5 py-0.5 rounded",style:{background:"color-mix(in srgb, var(--error) 15%, transparent)",color:"var(--error)"},children:"Error"})]}),a.jsxs("div",{className:"flex flex-col gap-0",children:[n&&a.jsxs("div",{style:{borderBottom:t?"1px solid var(--border)":"none"},children:[a.jsx("div",{className:"px-3 pt-1.5 pb-0.5",children:a.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold",style:{color:"var(--text-muted)"},children:"Input"})}),a.jsx("pre",{className:"px-3 pb-2 text-[11px] font-mono whitespace-pre-wrap break-words overflow-y-auto leading-relaxed",style:{color:"var(--text-secondary)",maxHeight:160},children:JSON.stringify(e.args,null,2)})]}),t&&a.jsxs("div",{children:[a.jsx("div",{className:"px-3 pt-1.5 pb-0.5",children:a.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold",style:{color:e.is_error?"var(--error)":"var(--text-muted)"},children:"Output"})}),a.jsx("pre",{className:"px-3 pb-2 text-[11px] font-mono whitespace-pre-wrap break-words overflow-y-auto leading-relaxed",style:{color:e.is_error?"var(--error)":"var(--text-secondary)",maxHeight:240},children:e.result})]})]})]})}const hs=3;function ly({message:e}){const t=e.toolCalls??(e.toolCall?[e.toolCall]:[]),[n,r]=S.useState(!1),[i,s]=S.useState(null);if(t.length===0)return null;const o=t.find(p=>p.status==="pending");if(o)return a.jsx("div",{className:"py-1.5 pl-2.5",children:a.jsx(oy,{tc:o})});const l=t.length-hs,u=l>0&&!n,c=u?t.slice(-hs):t,d=u?l:0;return a.jsxs("div",{className:"py-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[a.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:"var(--warning)"}}),a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--warning)"},children:t.length===1?"Tool":`Tools (${t.length})`})]}),a.jsxs("div",{className:"pl-2.5 space-y-1.5",children:[a.jsxs("div",{className:"flex flex-wrap gap-1",children:[u&&a.jsxs("button",{onClick:()=>r(!0),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:"var(--text-muted)"},children:["+",l," more"]}),c.map((p,m)=>{const f=m+d;return a.jsx(sy,{tc:p,active:i===f,onClick:()=>s(i===f?null:f)},f)})]}),i!==null&&t[i]&&a.jsx(ay,{tc:t[i]})]})]})}function cy(e){const t=e.total_prompt_tokens+e.total_completion_tokens;let n=`## Agent Diagnostics +- Model: ${e.model} +- Turns: ${e.turn_count}/50 (max reached) +- Tokens: ${e.total_prompt_tokens} prompt + ${e.total_completion_tokens} completion = ${t} total +- Compactions: ${e.compaction_count}`;const r=e.tool_summary;if(r&&r.length>0){n+=` + +## Tool Usage`;for(const o of r)n+=` +- ${o.tool}: ${o.calls} call${o.calls!==1?"s":""}`,o.errors&&(n+=` (${o.errors} error${o.errors!==1?"s":""})`)}const i=e.tasks;if(i&&i.length>0){n+=` + +## Tasks`;for(const o of i)n+=` +- [${o.status}] ${o.title}`}const s=e.last_messages;return s&&s.length>0&&(n+=` + +## Last Messages`,s.forEach((o,l)=>{const u=o.tool?`${o.role}:${o.tool}`:o.role,c=o.content?o.content.replace(/\n/g," "):"";n+=` +${l+1}. [${u}] ${c}`})),n}function uy(){const[e,t]=S.useState("idle"),n=async()=>{const r=$e.getState().sessionId;if(r){t("loading");try{const i=await Fu(r),s=cy(i);await navigator.clipboard.writeText(s),t("copied"),setTimeout(()=>t("idle"),2e3)}catch{t("idle")}}};return a.jsx("button",{onClick:n,disabled:e==="loading",className:"inline-flex items-center gap-1 text-[11px] font-mono px-2 py-1 rounded cursor-pointer hover:brightness-125 mt-1",style:{background:"var(--bg-primary)",border:"1px solid var(--border)",color:e==="copied"?"var(--success)":"var(--text-muted)"},children:e==="copied"?"Copied!":e==="loading"?"Loading...":"Copy Diagnostics"})}function dy({message:e}){if(e.role==="thinking")return a.jsx(ry,{message:e});if(e.role==="plan")return a.jsx(iy,{message:e});if(e.role==="tool")return a.jsx(ly,{message:e});const t=e.role==="user"?"user":"assistant",n=ny[t];return a.jsxs("div",{className:"py-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[a.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:n.color}}),a.jsx("span",{className:"text-[11px] font-semibold",style:{color:n.color},children:n.label})]}),e.content&&(e.role==="user"?a.jsx("div",{className:"text-sm leading-relaxed pl-2.5 max-w-prose",style:{color:"var(--text-primary)"},children:e.content}):a.jsxs("div",{className:"text-sm leading-relaxed pl-2.5 max-w-prose chat-markdown",style:{color:"var(--text-secondary)"},children:[a.jsx(Qm,{remarkPlugins:[ty],rehypePlugins:[Kg],children:e.content}),e.content.includes("Reached maximum iterations")&&a.jsx(uy,{})]}))]})}function py(){const e=$e(l=>l.activeQuestion),t=$e(l=>l.sessionId),n=$e(l=>l.setActiveQuestion),[r,i]=S.useState("");if(!e)return null;const s=l=>{t&&(Yn().sendQuestionResponse(t,e.question_id,l),n(null),i(""))},o=e.options.length>0;return a.jsxs("div",{className:"mx-3 mb-2 rounded-lg overflow-hidden",style:{border:"1px solid color-mix(in srgb, var(--accent) 40%, var(--border))"},children:[a.jsx("div",{className:"px-3 py-2",style:{background:"color-mix(in srgb, var(--accent) 10%, var(--bg-secondary))"},children:a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--accent)"},children:"Question"})}),a.jsxs("div",{className:"px-3 py-2",style:{background:"var(--bg-secondary)"},children:[a.jsx("p",{className:"text-sm mb-2",style:{color:"var(--text-primary)"},children:e.question}),o&&a.jsx("div",{className:"flex flex-col gap-1 mb-2",children:e.options.map((l,u)=>a.jsxs("button",{onClick:()=>s(l),className:"w-full text-left text-[13px] py-2 px-3 rounded cursor-pointer transition-colors flex items-center gap-2",style:{background:"var(--bg-primary)",border:"1px solid var(--border)",borderLeft:"2px solid transparent",color:"var(--text-primary)",fontFamily:"var(--font-mono, ui-monospace, monospace)"},onMouseEnter:c=>{c.currentTarget.style.borderLeftColor="var(--accent)",c.currentTarget.style.background="color-mix(in srgb, var(--accent) 8%, var(--bg-primary))"},onMouseLeave:c=>{c.currentTarget.style.borderLeftColor="transparent",c.currentTarget.style.background="var(--bg-primary)"},children:[a.jsxs("span",{className:"text-[11px] font-semibold shrink-0",style:{color:"var(--text-muted)"},children:[u+1,"."]}),a.jsx("span",{className:"truncate",children:l})]},u))}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"text",value:r,onChange:l=>i(l.target.value),onKeyDown:l=>{l.key==="Enter"&&r.trim()&&s(r.trim())},placeholder:o?"Or type a custom answer...":"Type your answer...",className:"flex-1 text-sm px-2 py-1.5 rounded outline-none",style:{background:"var(--bg-primary)",border:"1px solid var(--border)",color:"var(--text-primary)"}}),a.jsx("button",{onClick:()=>{r.trim()&&s(r.trim())},disabled:!r.trim(),className:"text-xs font-semibold px-3 py-1.5 rounded cursor-pointer transition-colors disabled:opacity-30 disabled:cursor-not-allowed",style:{background:"color-mix(in srgb, var(--accent) 15%, var(--bg-secondary))",color:"var(--accent)",border:"1px solid color-mix(in srgb, var(--accent) 30%, var(--border))"},children:"Send"})]})]})]})}function fy(){const e=S.useRef(Yn()).current,[t,n]=S.useState(""),r=S.useRef(null),i=S.useRef(!0),s=zn(W=>W.enabled),o=zn(W=>W.status),l=!s||o==="authenticated",{sessionId:u,status:c,messages:d,plan:p,models:m,selectedModel:f,modelsLoading:g,skills:x,selectedSkillIds:y,skillsLoading:b,setModels:k,setSelectedModel:C,setModelsLoading:j,setSkills:L,setSelectedSkillIds:T,toggleSkill:B,setSkillsLoading:O,addUserMessage:w,hydrateSession:_,clearSession:M}=$e();S.useEffect(()=>{l&&(m.length>0||(j(!0),Bu().then(W=>{if(k(W),W.length>0&&!f){const U=W.find(re=>re.model_name.includes("claude"));C(U?U.model_name:W[0].model_name)}}).catch(console.error).finally(()=>j(!1))))},[l,m.length,f,k,C,j]),S.useEffect(()=>{x.length>0||(O(!0),$u().then(W=>{L(W),T(W.map(U=>U.id))}).catch(console.error).finally(()=>O(!1)))},[x.length,L,T,O]),S.useEffect(()=>{if(u)return;const W=sessionStorage.getItem("agent_session_id");W&&zu(W).then(U=>{U?_(U):sessionStorage.removeItem("agent_session_id")}).catch(()=>{sessionStorage.removeItem("agent_session_id")})},[]);const[R,D]=S.useState(!1),N=()=>{const W=r.current;if(!W)return;const U=W.scrollHeight-W.scrollTop-W.clientHeight<40;i.current=U,D(W.scrollTop>100)};S.useEffect(()=>{i.current&&r.current&&(r.current.scrollTop=r.current.scrollHeight)});const E=c==="thinking"||c==="executing"||c==="planning"||c==="awaiting_input",I=d[d.length-1],G=E&&(I==null?void 0:I.role)==="assistant"&&!I.done,H=E&&!G,V=S.useRef(null),h=()=>{const W=V.current;W&&(W.style.height="auto",W.style.height=Math.min(W.scrollHeight,200)+"px")},F=S.useCallback(()=>{const W=t.trim();!W||!f||E||(i.current=!0,w(W),e.sendAgentMessage(W,f,u,y),n(""),requestAnimationFrame(()=>{const U=V.current;U&&(U.style.height="auto")}))},[t,f,E,u,y,w,e]),$=S.useCallback(()=>{u&&e.sendAgentStop(u)},[u,e]),v=W=>{W.key==="Enter"&&!W.shiftKey&&(W.preventDefault(),F())},ie=!E&&!!f&&t.trim().length>0;return l?a.jsxs("div",{className:"flex flex-col h-full",style:{background:"var(--bg-primary)"},children:[a.jsx(gs,{selectedModel:f,models:m,modelsLoading:g,onModelChange:C,skills:x,selectedSkillIds:y,skillsLoading:b,onToggleSkill:B,onClear:M,onStop:$,hasMessages:d.length>0,isBusy:E}),a.jsx(hy,{plan:p}),a.jsxs("div",{className:"relative flex-1 overflow-hidden",children:[a.jsxs("div",{ref:r,onScroll:N,className:"h-full overflow-y-auto px-3 py-2 space-y-0.5",children:[d.length===0&&a.jsxs("div",{className:"flex flex-col items-center justify-center py-10 px-4 gap-3",style:{color:"var(--text-muted)"},children:[a.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.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"})}),a.jsxs("div",{className:"text-center space-y-1.5",children:[a.jsx("p",{className:"text-sm font-medium",style:{color:"var(--text-secondary)"},children:"Ask the agent to help you code"}),a.jsxs("p",{className:"text-xs leading-relaxed",children:["Create agents, functions, evaluations,",a.jsx("br",{}),"or ask questions about your project."]})]})]}),d.filter(W=>W.role!=="plan").map(W=>a.jsx(dy,{message:W},W.id)),H&&a.jsx("div",{className:"py-1.5",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"var(--success)"}}),a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--success)"},children:c==="thinking"?"Thinking...":c==="executing"?"Executing...":c==="awaiting_input"?"Waiting for answer...":"Planning..."})]})})]}),R&&a.jsx("button",{onClick:()=>{var W;i.current=!1,(W=r.current)==null||W.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:a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"18 15 12 9 6 15"})})})]}),a.jsx(py,{}),a.jsxs("div",{className:"flex items-end gap-2 px-3 py-2 border-t",style:{borderColor:"var(--border)"},children:[a.jsx("textarea",{ref:V,value:t,onChange:W=>{n(W.target.value),h()},onKeyDown:v,disabled:E||!f,placeholder:E?"Waiting for response...":"Message...",rows:2,className:"flex-1 bg-transparent text-sm py-1 disabled:opacity-40 placeholder:text-[var(--text-muted)] resize-none",style:{color:"var(--text-primary)",maxHeight:200,overflow:"auto"}}),a.jsx("button",{onClick:F,disabled:!ie,className:"text-xs font-semibold px-3 py-1.5 rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed shrink-0","aria-label":"Send message",style:{color:ie?"var(--accent)":"var(--text-muted)",background:"transparent"},onMouseEnter:W=>{ie&&(W.currentTarget.style.background="color-mix(in srgb, var(--accent) 10%, transparent)")},onMouseLeave:W=>{W.currentTarget.style.background="transparent"},children:"Send"})]})]}):a.jsxs("div",{className:"flex flex-col h-full",style:{background:"var(--bg-primary)"},children:[a.jsx(gs,{selectedModel:f,models:m,modelsLoading:g,onModelChange:C,skills:x,selectedSkillIds:y,skillsLoading:b,onToggleSkill:B,onClear:M,onStop:$,hasMessages:!1,isBusy:!1}),a.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:a.jsxs("div",{className:"text-center",style:{color:"var(--text-muted)"},children:[a.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"mx-auto mb-2",strokeLinecap:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),a.jsx("p",{className:"text-sm font-medium mb-1",children:"Sign in to use Agent"}),a.jsx("p",{className:"text-xs",children:"Authentication is required to access the coding agent."})]})})]})}function gs({selectedModel:e,models:t,modelsLoading:n,onModelChange:r,skills:i,selectedSkillIds:s,skillsLoading:o,onToggleSkill:l,onClear:u,onStop:c,hasMessages:d,isBusy:p}){const[m,f]=S.useState(!1),g=S.useRef(null);return S.useEffect(()=>{if(!m)return;const x=y=>{g.current&&!g.current.contains(y.target)&&f(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[m]),a.jsxs("div",{className:"shrink-0 flex items-center gap-2 px-3 h-10 border-b",style:{borderColor:"var(--border)",background:"var(--bg-primary)"},children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wider font-semibold shrink-0",style:{color:"var(--text-muted)"},children:"Agent"}),a.jsxs("select",{value:e??"",onChange:x=>r(x.target.value),className:"flex-1 text-[11px] rounded px-1.5 py-1 outline-none min-w-0 cursor-pointer",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)",color:"var(--text-primary)"},disabled:n,children:[n&&a.jsx("option",{value:"",children:"Loading models..."}),!n&&t.length===0&&a.jsx("option",{value:"",children:"No models"}),t.map(x=>a.jsx("option",{value:x.model_name,children:x.model_name},x.model_name))]}),!o&&i.length>0&&a.jsxs("div",{className:"relative shrink-0",ref:g,children:[a.jsxs("button",{onClick:()=>f(!m),className:"text-[11px] font-semibold px-2 py-1 rounded cursor-pointer flex items-center gap-1",style:{background:s.length>0?"color-mix(in srgb, var(--accent) 15%, transparent)":"transparent",border:`1px solid ${s.length>0?"var(--accent)":"var(--border)"}`,color:s.length>0?"var(--accent)":"var(--text-muted)"},title:"Skills",children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"}),a.jsx("path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"})]}),s.length>0&&a.jsx("span",{children:s.length})]}),m&&a.jsx("div",{className:"absolute top-full right-0 mt-1 rounded shadow-lg z-50 py-1 max-h-64 overflow-y-auto",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)",width:"190px"},children:i.map(x=>a.jsxs("button",{onClick:()=>l(x.id),className:"w-full text-left px-2 py-1 text-[11px] flex items-center gap-1.5 cursor-pointer",style:{color:"var(--text-primary)"},title:x.description,onMouseEnter:y=>{y.currentTarget.style.background="var(--bg-tertiary)"},onMouseLeave:y=>{y.currentTarget.style.background="transparent"},children:[a.jsx("span",{className:"w-3 h-3 rounded border flex items-center justify-center shrink-0",style:{borderColor:s.includes(x.id)?"var(--accent)":"var(--border)",background:s.includes(x.id)?"var(--accent)":"transparent"},children:s.includes(x.id)&&a.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})}),a.jsx("span",{className:"truncate",children:x.name})]},x.id))})]}),p&&a.jsx("button",{onClick:c,className:"shrink-0 text-[11px] font-semibold px-2 py-1 rounded cursor-pointer",style:{background:"transparent",border:"1px solid var(--error)",color:"var(--error)"},title:"Stop",onMouseEnter:x=>{x.currentTarget.style.background="color-mix(in srgb, var(--error) 10%, transparent)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent"},children:"Stop"}),d&&!p&&a.jsx("button",{onClick:u,className:"shrink-0 w-6 h-6 flex items-center justify-center rounded cursor-pointer",style:{background:"transparent",border:"none",color:"var(--text-muted)"},title:"New session",onMouseEnter:x=>{x.currentTarget.style.color="var(--text-primary)"},onMouseLeave:x=>{x.currentTarget.style.color="var(--text-muted)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"1 4 1 10 7 10"}),a.jsx("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]})})]})}const my=10;function hy({plan:e}){const t=e.filter(m=>m.status==="completed").length,n=e.filter(m=>m.status!=="completed"),r=e.length>0&&t===e.length,[i,s]=S.useState(!1),o=S.useRef(n.length);if(S.useEffect(()=>{r&&s(!0)},[r]),S.useEffect(()=>{n.length>o.current&&s(!1),o.current=n.length},[n.length]),e.length===0)return null;const l=e.filter(m=>m.status==="completed"),u=Math.max(0,my-n.length),d=[...l.slice(-u),...n],p=e.length-d.length;return a.jsxs("div",{className:"shrink-0 border-b",style:{borderColor:"var(--border)",background:"var(--bg-secondary)"},children:[a.jsxs("button",{onClick:()=>s(!i),className:"w-full flex items-center gap-2 px-3 py-1.5 cursor-pointer",style:{background:"none",border:"none"},children:[a.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:"var(--accent)"}}),a.jsxs("span",{className:"text-[11px] font-semibold",style:{color:"var(--accent)"},children:["Plan (",t,"/",e.length," completed)"]}),a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-muted)",strokeWidth:"2",className:"ml-auto",style:{transform:i?"rotate(0deg)":"rotate(180deg)",transition:"transform 0.15s"},children:a.jsx("path",{d:"M6 9l6 6 6-6"})})]}),!i&&a.jsxs("div",{className:"px-3 pb-2 space-y-1",children:[p>0&&a.jsxs("div",{className:"text-[11px]",style:{color:"var(--text-muted)"},children:[p," earlier completed task",p!==1?"s":""," hidden"]}),d.map((m,f)=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[m.status==="completed"?a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--success)",strokeWidth:"2.5",strokeLinecap:"round",children:a.jsx("path",{d:"M20 6L9 17l-5-5"})}):m.status==="in_progress"?a.jsx("span",{className:"w-3.5 h-3.5 flex items-center justify-center",children:a.jsx("span",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"var(--accent)"}})}):a.jsx("span",{className:"w-3.5 h-3.5 flex items-center justify-center",children:a.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:"var(--text-muted)",opacity:.4}})}),a.jsx("span",{style:{color:m.status==="completed"?"var(--text-muted)":"var(--text-primary)",textDecoration:m.status==="completed"?"line-through":"none"},children:m.title})]},f))]})]})}function gy(){const e=Yl(),t=ic(),[n,r]=S.useState(!1),[i,s]=S.useState(248),[o,l]=S.useState(!1),[u,c]=S.useState(380),[d,p]=S.useState(!1),{runs:m,selectedRunId:f,setRuns:g,upsertRun:x,selectRun:y,setTraces:b,setLogs:k,setChatMessages:C,setEntrypoints:j,setStateEvents:L,setGraphCache:T,setActiveNode:B,removeActiveNode:O}=ke(),{section:w,view:_,runId:M,setupEntrypoint:R,setupMode:D,evalCreating:N,evalSetId:E,evalRunId:I,evalRunItemName:G,evaluatorCreateType:H,evaluatorId:V,evaluatorFilter:h,explorerFile:F,navigate:$}=st(),{setEvalSets:v,setEvaluators:ie,setLocalEvaluators:W,setEvalRuns:U}=Ae();S.useEffect(()=>{w==="debug"&&_==="details"&&M&&M!==f&&y(M)},[w,_,M,f,y]);const re=zn(J=>J.init),de=xs(J=>J.init);S.useEffect(()=>{Ql().then(g).catch(console.error),vs().then(J=>j(J.map(he=>he.name))).catch(console.error),re(),de()},[g,j,re,de]),S.useEffect(()=>{w==="evals"&&(ks().then(J=>v(J)).catch(console.error),fc().then(J=>U(J)).catch(console.error)),(w==="evals"||w==="evaluators")&&(ac().then(J=>ie(J)).catch(console.error),Jr().then(J=>W(J)).catch(console.error))},[w,v,ie,W,U]);const be=Ae(J=>J.evalSets),Oe=Ae(J=>J.evalRuns);S.useEffect(()=>{if(w!=="evals"||N||E||I)return;const J=Object.values(Oe).sort((Re,fe)=>new Date(fe.start_time??0).getTime()-new Date(Re.start_time??0).getTime());if(J.length>0){$(`#/evals/runs/${J[0].id}`);return}const he=Object.values(be);he.length>0&&$(`#/evals/sets/${he[0].id}`)},[w,N,E,I,Oe,be,$]),S.useEffect(()=>{const J=he=>{he.key==="Escape"&&n&&r(!1)};return window.addEventListener("keydown",J),()=>window.removeEventListener("keydown",J)},[n]);const Ie=f?m[f]:null,at=S.useCallback((J,he)=>{x(he),b(J,he.traces),k(J,he.logs);const Re=he.messages.map(fe=>{const P=fe.contentParts??fe.content_parts??[],K=fe.toolCalls??fe.tool_calls??[];return{message_id:fe.messageId??fe.message_id,role:fe.role??"assistant",content:P.filter(ee=>{const ae=ee.mimeType??ee.mime_type??"";return ae.startsWith("text/")||ae==="application/json"}).map(ee=>{const ae=ee.data;return(ae==null?void 0:ae.inline)??""}).join(` +`).trim()??"",tool_calls:K.length>0?K.map(ee=>({name:ee.name??"",has_result:!!ee.result})):void 0}});if(C(J,Re),he.graph&&he.graph.nodes.length>0&&T(J,he.graph),he.states&&he.states.length>0&&(L(J,he.states.map(fe=>({node_name:fe.node_name,qualified_node_name:fe.qualified_node_name,phase:fe.phase,timestamp:new Date(fe.timestamp).getTime(),payload:fe.payload}))),he.status!=="completed"&&he.status!=="failed"))for(const fe of he.states)fe.phase==="started"?B(J,fe.node_name,fe.qualified_node_name):fe.phase==="completed"&&O(J,fe.node_name)},[x,b,k,C,L,T,B,O]);S.useEffect(()=>{if(!f)return;e.subscribe(f),cr(f).then(he=>at(f,he)).catch(console.error);const J=setTimeout(()=>{const he=ke.getState().runs[f];he&&(he.status==="pending"||he.status==="running")&&cr(f).then(Re=>at(f,Re)).catch(console.error)},2e3);return()=>{clearTimeout(J),e.unsubscribe(f)}},[f,e,at]);const St=S.useRef(null);S.useEffect(()=>{var Re,fe;if(!f)return;const J=Ie==null?void 0:Ie.status,he=St.current;if(St.current=J??null,J&&(J==="completed"||J==="failed")&&he!==J){const P=ke.getState(),K=((Re=P.traces[f])==null?void 0:Re.length)??0,ee=((fe=P.logs[f])==null?void 0:fe.length)??0,ae=(Ie==null?void 0:Ie.trace_count)??0,Ee=(Ie==null?void 0:Ie.log_count)??0;(Kat(f,Ke)).catch(console.error)}},[f,Ie==null?void 0:Ie.status,at]);const Pt=J=>{$(`#/debug/runs/${J}/traces`),y(J),r(!1)},yt=J=>{$(`#/debug/runs/${J}/traces`),y(J),r(!1)},ye=()=>{$("#/debug/new"),r(!1)},lt=J=>{J==="debug"?$("#/debug/new"):J==="evals"?$("#/evals"):J==="evaluators"?$("#/evaluators"):J==="explorer"&&$("#/explorer")},rt=S.useCallback(J=>{J.preventDefault(),l(!0);const he="touches"in J?J.touches[0].clientX:J.clientX,Re=i,fe=K=>{const ee="touches"in K?K.touches[0].clientX:K.clientX,ae=Math.max(200,Math.min(480,Re+(ee-he)));s(ae)},P=()=>{l(!1),document.removeEventListener("mousemove",fe),document.removeEventListener("mouseup",P),document.removeEventListener("touchmove",fe),document.removeEventListener("touchend",P),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",fe),document.addEventListener("mouseup",P),document.addEventListener("touchmove",fe,{passive:!1}),document.addEventListener("touchend",P)},[i]),vt=S.useCallback(J=>{J.preventDefault(),p(!0);const he="touches"in J?J.touches[0].clientX:J.clientX,Re=u,fe=K=>{const ee="touches"in K?K.touches[0].clientX:K.clientX,ae=Math.max(280,Math.min(700,Re-(ee-he)));c(ae)},P=()=>{p(!1),document.removeEventListener("mousemove",fe),document.removeEventListener("mouseup",P),document.removeEventListener("touchmove",fe),document.removeEventListener("touchend",P),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",fe),document.addEventListener("mouseup",P),document.addEventListener("touchmove",fe,{passive:!1}),document.addEventListener("touchend",P)},[u]),Bt=Me(J=>J.openTabs),qt=()=>w==="explorer"?Bt.length>0||F?a.jsx(Pu,{}):a.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)]",children:"Select a file to view"}):w==="evals"?N?a.jsx(lo,{}):I?a.jsx(ku,{evalRunId:I,itemName:G}):E?a.jsx(bu,{evalSetId:E}):a.jsx(lo,{}):w==="evaluators"?H?a.jsx(Lu,{category:H}):a.jsx(Mu,{evaluatorId:V,evaluatorFilter:h}):_==="new"?a.jsx(wc,{}):_==="setup"&&R&&D?a.jsx(Vc,{entrypoint:R,mode:D,ws:e,onRunCreated:Pt,isMobile:t}):Ie?a.jsx(fu,{run:Ie,ws:e,isMobile:t}):a.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)]",children:"Select a run or create a new one"});return t?a.jsxs("div",{className:"flex flex-col h-screen w-screen",children:[a.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[!n&&a.jsx("button",{onClick:()=>r(!0),className:"fixed top-2 left-2 z-40 w-9 h-9 flex items-center justify-center rounded-lg cursor-pointer",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)"},children:a.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[a.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),a.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),a.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),n&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-50",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>r(!1)}),a.jsxs("aside",{className:"fixed inset-y-0 left-0 z-50 w-64 bg-[var(--sidebar-bg)] border-r border-[var(--border)] flex flex-col",children:[a.jsxs("div",{className:"px-3 h-10 border-b border-[var(--border)] flex items-center justify-between",children:[a.jsxs("button",{onClick:()=>{$("#/debug/new"),r(!1)},className:"flex items-center gap-2 cursor-pointer",style:{background:"none",border:"none"},children:[a.jsx("img",{src:"/favicon.ico",width:"14",height:"14",alt:"UiPath"}),a.jsx("span",{className:"text-[10px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"Developer Console"})]}),a.jsx("button",{onClick:()=>r(!1),className:"w-6 h-6 flex items-center justify-center rounded cursor-pointer transition-colors",style:{color:"var(--text-muted)",background:"transparent",border:"none"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),w==="debug"&&a.jsx(Li,{runs:Object.values(m),selectedRunId:f,onSelectRun:yt,onNewRun:ye}),w==="evals"&&a.jsx(no,{}),w==="evaluators"&&a.jsx(co,{}),w==="explorer"&&a.jsx(po,{})]})]}),a.jsx("main",{className:"flex-1 overflow-hidden bg-[var(--bg-primary)]",children:qt()})]}),a.jsx(ji,{}),a.jsx(Zi,{}),a.jsx(eo,{})]}):a.jsxs("div",{className:"flex flex-col h-screen w-screen",children:[a.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[a.jsxs("aside",{className:"shrink-0 flex flex-col",style:{width:i,background:"var(--sidebar-bg)"},children:[a.jsxs("div",{className:"flex h-10 border-b shrink-0",style:{borderColor:"var(--border)"},children:[a.jsx("button",{onClick:()=>$("#/debug/new"),className:"w-12 shrink-0 flex items-center justify-center cursor-pointer transition-colors border-r",style:{background:"var(--activity-bar-bg)",border:"none",borderRight:"1px solid var(--border)"},onMouseEnter:J=>{J.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:J=>{J.currentTarget.style.background="var(--activity-bar-bg)"},children:a.jsx("img",{src:"/favicon.ico",width:"20",height:"20",alt:"UiPath"})}),a.jsx("div",{className:"flex-1 flex items-center px-3",style:{background:"var(--sidebar-bg)"},children:a.jsx("span",{className:"text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:w==="debug"?"Developer Console":w==="evals"?"Evaluations":w==="evaluators"?"Evaluators":"Explorer"})})]}),a.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[a.jsx(sc,{section:w,onSectionChange:lt}),a.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[w==="debug"&&a.jsx(Li,{runs:Object.values(m),selectedRunId:f,onSelectRun:yt,onNewRun:ye}),w==="evals"&&a.jsx(no,{}),w==="evaluators"&&a.jsx(co,{}),w==="explorer"&&a.jsx(po,{})]})]})]}),a.jsx("div",{onMouseDown:rt,onTouchStart:rt,className:"shrink-0 drag-handle-col",style:o?{background:"var(--accent)"}:void 0}),a.jsxs("main",{className:"flex-1 overflow-hidden bg-[var(--bg-primary)] flex",children:[a.jsx("div",{className:"flex-1 overflow-hidden",children:qt()}),w==="explorer"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{onMouseDown:vt,onTouchStart:vt,className:"shrink-0 drag-handle-col",style:d?{background:"var(--accent)"}:void 0}),a.jsx("div",{className:"shrink-0 overflow-hidden",style:{width:u,borderLeft:"1px solid var(--border)"},children:a.jsx(fy,{})})]})]})]}),a.jsx(ji,{}),a.jsx(Zi,{}),a.jsx(eo,{})]})}Cl.createRoot(document.getElementById("root")).render(a.jsx(S.StrictMode,{children:a.jsx(gy,{})}));export{Qm as M,ty as a,Kg as r,ke as u}; diff --git a/src/uipath/dev/server/static/assets/index-DKf_uUe0.css b/src/uipath/dev/server/static/assets/index-DKf_uUe0.css deleted file mode 100644 index 3c1c7ee..0000000 --- a/src/uipath/dev/server/static/assets/index-DKf_uUe0.css +++ /dev/null @@ -1 +0,0 @@ -/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-duration:initial;--tw-ease:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--spacing:.25rem;--container-xs:20rem;--container-xl:36rem;--container-2xl:42rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-normal:1.5;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:calc(var(--spacing)*0)}.inset-y-0{inset-block:calc(var(--spacing)*0)}.top-0{top:calc(var(--spacing)*0)}.top-1{top:calc(var(--spacing)*1)}.top-1\.5{top:calc(var(--spacing)*1.5)}.top-2{top:calc(var(--spacing)*2)}.top-4{top:calc(var(--spacing)*4)}.top-full{top:100%}.right-0{right:calc(var(--spacing)*0)}.right-1{right:calc(var(--spacing)*1)}.right-3{right:calc(var(--spacing)*3)}.right-4{right:calc(var(--spacing)*4)}.bottom-1\.5{bottom:calc(var(--spacing)*1.5)}.bottom-8{bottom:calc(var(--spacing)*8)}.bottom-full{bottom:100%}.left-0{left:calc(var(--spacing)*0)}.left-1\/2{left:50%}.left-2{left:calc(var(--spacing)*2)}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.m-0{margin:calc(var(--spacing)*0)}.mx-1{margin-inline:calc(var(--spacing)*1)}.mx-2{margin-inline:calc(var(--spacing)*2)}.mx-3{margin-inline:calc(var(--spacing)*3)}.mx-auto{margin-inline:auto}.my-2{margin-block:calc(var(--spacing)*2)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-2\.5{margin-top:calc(var(--spacing)*2.5)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-auto{margin-top:auto}.mr-0\.5{margin-right:calc(var(--spacing)*.5)}.mr-1{margin-right:calc(var(--spacing)*1)}.mb-0\.5{margin-bottom:calc(var(--spacing)*.5)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-2\.5{margin-left:calc(var(--spacing)*2.5)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-2\.5{height:calc(var(--spacing)*2.5)}.h-3{height:calc(var(--spacing)*3)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-\[14px\]{height:14px}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:calc(var(--spacing)*32)}.max-h-40{max-height:calc(var(--spacing)*40)}.max-h-48{max-height:calc(var(--spacing)*48)}.max-h-64{max-height:calc(var(--spacing)*64)}.max-h-\[85vh\]{max-height:85vh}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-full{min-height:100%}.w-0\.5{width:calc(var(--spacing)*.5)}.w-1\.5{width:calc(var(--spacing)*1.5)}.w-2{width:calc(var(--spacing)*2)}.w-3{width:calc(var(--spacing)*3)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-14{width:calc(var(--spacing)*14)}.w-24{width:calc(var(--spacing)*24)}.w-32{width:calc(var(--spacing)*32)}.w-36{width:calc(var(--spacing)*36)}.w-44{width:calc(var(--spacing)*44)}.w-56{width:calc(var(--spacing)*56)}.w-64{width:calc(var(--spacing)*64)}.w-\[200px\]{width:200px}.w-\[calc\(100\%-24px\)\]{width:calc(100% - 24px)}.w-full{width:100%}.w-screen{width:100vw}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\[160px\]{max-width:160px}.max-w-\[200px\]{max-width:200px}.max-w-prose{max-width:65ch}.max-w-xl{max-width:var(--container-xl)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-\[140px\]{min-width:140px}.min-w-\[180px\]{min-width:180px}.min-w-\[400px\]{min-width:400px}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-\[slideIn_0\.2s_ease-out\]{animation:.2s ease-out slideIn}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.appearance-auto{-webkit-appearance:auto;-moz-appearance:auto;appearance:auto}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing)*0)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-2\.5{gap:calc(var(--spacing)*2.5)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-\[var\(--border\)\]{border-color:var(--border)}.bg-\[var\(--bg-primary\)\]{background-color:var(--bg-primary)}.bg-\[var\(--sidebar-bg\)\]{background-color:var(--sidebar-bg)}.bg-transparent{background-color:#0000}.p-0\.5{padding:calc(var(--spacing)*.5)}.p-1{padding:calc(var(--spacing)*1)}.p-1\.5{padding:calc(var(--spacing)*1.5)}.p-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-10{padding-block:calc(var(--spacing)*10)}.py-\[3px\]{padding-block:3px}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-px{padding-top:1px}.pr-0{padding-right:calc(var(--spacing)*0)}.pr-1{padding-right:calc(var(--spacing)*1)}.pr-2{padding-right:calc(var(--spacing)*2)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-2\.5{padding-left:calc(var(--spacing)*2.5)}.pl-\[22px\]{padding-left:22px}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.leading-none{--tw-leading:1;line-height:1}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[var\(--text-muted\)\]{color:var(--text-muted)}.text-\[var\(--text-primary\)\]{color:var(--text-primary)}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.underline{text-decoration-line:underline}.accent-\[var\(--accent\)\]{accent-color:var(--accent)}.opacity-0{opacity:0}.opacity-40{opacity:.4}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[width\]{transition-property:width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.outline-none{--tw-outline-style:none;outline-style:none}@media(hover:hover){.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.placeholder\:text-\[var\(--text-muted\)\]::placeholder{color:var(--text-muted)}@media(hover:hover){.hover\:bg-\[var\(--bg-hover\)\]:hover{background-color:var(--bg-hover)}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-100:hover{opacity:1}.hover\:brightness-125:hover{--tw-brightness:brightness(125%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}}pre code.hljs{padding:1em;display:block;overflow-x:auto}code.hljs{padding:3px 5px}.hljs{color:#c9d1d9;background:#0d1117}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#ff7b72}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#d2a8ff}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-variable,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id{color:#79c0ff}.hljs-regexp,.hljs-string,.hljs-meta .hljs-string{color:#a5d6ff}.hljs-built_in,.hljs-symbol{color:#ffa657}.hljs-comment,.hljs-code,.hljs-formula{color:#8b949e}.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo{color:#7ee787}.hljs-subst{color:#c9d1d9}.hljs-section{color:#1f6feb;font-weight:700}.hljs-bullet{color:#f2cc60}.hljs-emphasis{color:#c9d1d9;font-style:italic}.hljs-strong{color:#c9d1d9;font-weight:700}.hljs-addition{color:#aff5b4;background-color:#033a16}.hljs-deletion{color:#ffdcd7;background-color:#67060c}:root,[data-theme=dark]{--bg-primary:#0f172a;--bg-secondary:#1e293b;--bg-tertiary:#334155;--bg-hover:#263348;--bg-elevated:#253041;--text-primary:#cbd5e1;--text-secondary:#94a3b8;--text-muted:#64748b;--border:#334155;--accent:#fa4616;--accent-hover:#e03d12;--accent-light:#ff6a3d;--success:#22c55e;--warning:#eab308;--error:#ef4444;--info:#3b82f6;--sidebar-bg:#0e1526;--activity-bar-bg:#0a1020;--card-bg:#1e293b;--input-bg:#0f172a;--code-bg:#0f172a;--tab-active:#fa4616;--tab-text:#94a3b8;--tab-text-active:#fa4616;--node-bg:#1e293b;--node-border:#475569;--scrollbar-thumb:#334155;color-scheme:dark}[data-theme=light]{--bg-primary:#f8fafc;--bg-secondary:#fff;--bg-tertiary:#cbd5e1;--bg-hover:#f1f5f9;--bg-elevated:#fff;--text-primary:#0f172a;--text-secondary:#475569;--text-muted:#94a3b8;--border:#e2e8f0;--accent:#fa4616;--accent-hover:#e03d12;--accent-light:#ff6a3d;--success:#22c55e;--warning:#ca8a04;--error:#ef4444;--info:#2563eb;--sidebar-bg:#fff;--activity-bar-bg:#f1f5f9;--card-bg:#fff;--input-bg:#f8fafc;--code-bg:#e8ecf1;--tab-active:#fa4616;--tab-text:#64748b;--tab-text-active:#fa4616;--node-bg:#fff;--node-border:#cbd5e1;--scrollbar-thumb:#d1d5db;color-scheme:light}body{background:var(--bg-primary);color:var(--text-primary);margin:0;font-family:Inter,system-ui,-apple-system,sans-serif;transition:background-color .2s,color .2s}#root{height:100dvh;display:flex}:focus-visible{outline:2px solid var(--accent);outline-offset:1px}button:focus-visible,[role=button]:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible{outline:2px solid var(--accent)}@supports (color:color-mix(in lab,red,red)){button:focus-visible,[role=button]:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible{outline:2px solid color-mix(in srgb,var(--accent)60%,transparent)}}button:focus-visible,[role=button]:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible{outline-offset:0px;border-radius:3px}.drag-handle-row{cursor:row-resize;background:var(--border);height:3px;transition:background .15s;position:relative}.drag-handle-row:before{content:"";position:absolute;top:-5px;right:0;bottom:-5px;left:0}.drag-handle-row:hover,.drag-handle-row:active{background:var(--accent)}.drag-handle-col{cursor:col-resize;background:var(--border);width:3px;transition:background .15s;position:relative}.drag-handle-col:before{content:"";position:absolute;top:0;right:-5px;bottom:0;left:-5px}.drag-handle-col:hover,.drag-handle-col:active{background:var(--accent)}@keyframes skeleton-pulse{0%,to{opacity:.4}50%{opacity:.7}}.skeleton{background:var(--bg-tertiary);border-radius:4px;animation:1.5s ease-in-out infinite skeleton-pulse}.react-flow__node{font-size:12px}.react-flow__node-default{background:var(--node-bg)!important;color:var(--text-primary)!important;border-color:var(--node-border)!important}.react-flow__background{background:var(--bg-primary)!important}.react-flow__controls button{background:var(--bg-secondary)!important;color:var(--text-primary)!important;border-color:var(--border)!important}.react-flow__controls button:hover{background:var(--bg-hover)!important}.react-flow__controls button svg{fill:var(--text-primary)!important}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:var(--bg-secondary)}::-webkit-scrollbar-thumb{background:var(--scrollbar-thumb);border-radius:3px}select{-webkit-appearance:auto;-moz-appearance:auto;appearance:auto}select option{background:var(--bg-secondary);color:var(--text-primary)}.chat-markdown p{margin:.25em 0}.chat-markdown p:first-child{margin-top:0}.chat-markdown p:last-child{margin-bottom:0}.chat-markdown code{background:var(--code-bg);border:1px solid var(--border);border-radius:3px;padding:.1em .35em;font-size:.85em}.chat-markdown pre{background:var(--code-bg);border:1px solid var(--border);border-radius:6px;margin:.5em 0;padding:.75em;overflow-x:auto}.chat-markdown pre code{background:0 0;border:none;padding:0;font-size:.85em}.chat-markdown ul,.chat-markdown ol{margin:.25em 0;padding-left:1.5em}.chat-markdown li{margin:.1em 0}.chat-markdown h1,.chat-markdown h2,.chat-markdown h3{margin:.5em 0 .25em;font-weight:600}.chat-markdown h1{font-size:1.2em}.chat-markdown h2{font-size:1.1em}.chat-markdown h3{font-size:1em}.chat-markdown blockquote{border-left:3px solid var(--border);color:var(--text-secondary);margin:.25em 0;padding-left:.75em}.chat-markdown strong{font-weight:600}.chat-markdown a{color:var(--accent);text-decoration:underline}.chat-markdown table{border-collapse:collapse;width:100%;margin:.5em 0}.chat-markdown th,.chat-markdown td{border:1px solid var(--border);text-align:left;padding:.3em .6em}.chat-markdown th{background:var(--code-bg);font-weight:600}.chat-markdown tr:nth-child(2n){background:var(--code-bg)}.chat-markdown .hljs{background:0 0}[data-theme=light] .chat-markdown .hljs{color:#24292e}[data-theme=light] .chat-markdown .hljs-doctag,[data-theme=light] .chat-markdown .hljs-keyword,[data-theme=light] .chat-markdown .hljs-meta .hljs-keyword,[data-theme=light] .chat-markdown .hljs-template-tag,[data-theme=light] .chat-markdown .hljs-template-variable,[data-theme=light] .chat-markdown .hljs-type,[data-theme=light] .chat-markdown .hljs-variable.language_{color:#d73a49}[data-theme=light] .chat-markdown .hljs-title,[data-theme=light] .chat-markdown .hljs-title.class_,[data-theme=light] .chat-markdown .hljs-title.class_.inherited__,[data-theme=light] .chat-markdown .hljs-title.function_{color:#6f42c1}[data-theme=light] .chat-markdown .hljs-attr,[data-theme=light] .chat-markdown .hljs-attribute,[data-theme=light] .chat-markdown .hljs-literal,[data-theme=light] .chat-markdown .hljs-meta,[data-theme=light] .chat-markdown .hljs-number,[data-theme=light] .chat-markdown .hljs-operator,[data-theme=light] .chat-markdown .hljs-variable,[data-theme=light] .chat-markdown .hljs-selector-attr,[data-theme=light] .chat-markdown .hljs-selector-class,[data-theme=light] .chat-markdown .hljs-selector-id{color:#005cc5}[data-theme=light] .chat-markdown .hljs-regexp,[data-theme=light] .chat-markdown .hljs-string,[data-theme=light] .chat-markdown .hljs-meta .hljs-string{color:#032f62}[data-theme=light] .chat-markdown .hljs-built_in,[data-theme=light] .chat-markdown .hljs-symbol{color:#e36209}[data-theme=light] .chat-markdown .hljs-comment,[data-theme=light] .chat-markdown .hljs-code,[data-theme=light] .chat-markdown .hljs-formula{color:#6a737d}[data-theme=light] .chat-markdown .hljs-name,[data-theme=light] .chat-markdown .hljs-quote,[data-theme=light] .chat-markdown .hljs-selector-tag,[data-theme=light] .chat-markdown .hljs-selector-pseudo{color:#22863a}[data-theme=light] .chat-markdown .hljs-subst{color:#24292e}[data-theme=light] .chat-markdown .hljs-section{color:#005cc5}[data-theme=light] .chat-markdown .hljs-bullet{color:#735c0f}[data-theme=light] .chat-markdown .hljs-addition{color:#22863a;background-color:#f0fff4}[data-theme=light] .chat-markdown .hljs-deletion{color:#b31d28;background-color:#ffeef0}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}} diff --git a/src/uipath/dev/server/static/assets/index-DYl0Xnov.js b/src/uipath/dev/server/static/assets/index-DYl0Xnov.js deleted file mode 100644 index 0f429f0..0000000 --- a/src/uipath/dev/server/static/assets/index-DYl0Xnov.js +++ /dev/null @@ -1,106 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-elk-CzxJ-xdZ.js","assets/vendor-react-BN_uQvcy.js","assets/ChatPanel-DAnMwTFj.js","assets/vendor-reactflow-BP_V7ttx.js","assets/vendor-reactflow-B5DZHykP.css"])))=>i.map(i=>d[i]); -var Nl=Object.defineProperty;var Sl=(e,t,n)=>t in e?Nl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Rt=(e,t,n)=>Sl(e,typeof t!="symbol"?t+"":t,n);import{W as Tn,a as S,j as a,F as Tl,g as Gr,b as Cl}from"./vendor-react-BN_uQvcy.js";import{H as gt,P as bt,B as Al,M as Ml,u as Rl,a as Il,R as Ol,b as Ll,C as jl,c as Dl,d as Pl}from"./vendor-reactflow-BP_V7ttx.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();const Ci=e=>{let t;const n=new Set,r=(c,d)=>{const p=typeof c=="function"?c(t):c;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))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>u,subscribe:c=>(n.add(c),()=>n.delete(c))},u=t=e(r,i,l);return l},Bl=(e=>e?Ci(e):Ci),Fl=e=>e;function zl(e,t=Fl){const n=Tn.useSyncExternalStore(e.subscribe,Tn.useCallback(()=>t(e.getState()),[e,t]),Tn.useCallback(()=>t(e.getInitialState()),[e,t]));return Tn.useDebugValue(n),n}const Ai=e=>{const t=Bl(e),n=r=>zl(t,r);return Object.assign(n,t),n},Ot=(e=>e?Ai(e):Ai),Ee=Ot(e=>({runs:{},selectedRunId:null,traces:{},logs:{},chatMessages:{},entrypoints:[],setRuns:t=>e(n=>{var s;let r=n.breakpoints;for(const o of t)(s=o.breakpoints)!=null&&s.length&&!r[o.id]&&(r={...r,[o.id]:Object.fromEntries(o.breakpoints.map(l=>[l,!0]))});const i={runs:Object.fromEntries(t.map(o=>[o.id,o]))};return r!==n.breakpoints&&(i.breakpoints=r),i}),upsertRun:t=>e(n=>{var i;const r={runs:{...n.runs,[t.id]:t}};if((i=t.breakpoints)!=null&&i.length&&!n.breakpoints[t.id]&&(r.breakpoints={...n.breakpoints,[t.id]:Object.fromEntries(t.breakpoints.map(s=>[s,!0]))}),(t.status==="completed"||t.status==="failed")&&n.activeNodes[t.id]){const{[t.id]:s,...o}=n.activeNodes;r.activeNodes=o}if(t.status!=="suspended"&&n.activeInterrupt[t.id]){const{[t.id]:s,...o}=n.activeInterrupt;r.activeInterrupt=o}return r}),selectRun:t=>e({selectedRunId:t}),addTrace:t=>e(n=>{const r=n.traces[t.run_id]??[],i=r.findIndex(o=>o.span_id===t.span_id),s=i>=0?r.map((o,l)=>l===i?t:o):[...r,t];return{traces:{...n.traces,[t.run_id]:s}}}),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 i=r.chatMessages[t]??[],s=n.message;if(!s)return r;const o=s.messageId??s.message_id,l=s.role??"assistant",d=(s.contentParts??s.content_parts??[]).filter(x=>{const v=x.mimeType??x.mime_type??"";return v.startsWith("text/")||v==="application/json"}).map(x=>{const v=x.data;return(v==null?void 0:v.inline)??""}).join(` -`).trim(),p=(s.toolCalls??s.tool_calls??[]).map(x=>({name:x.name??"",has_result:!!x.result})),m={message_id:o,role:l,content:d,tool_calls:p.length>0?p:void 0},f=i.findIndex(x=>x.message_id===o);if(f>=0)return{chatMessages:{...r.chatMessages,[t]:i.map((x,v)=>v===f?m:x)}};if(l==="user"){const x=i.findIndex(v=>v.message_id.startsWith("local-")&&v.role==="user"&&v.content===d);if(x>=0)return{chatMessages:{...r.chatMessages,[t]:i.map((v,b)=>b===x?m:v)}}}const h=[...i,m];return{chatMessages:{...r.chatMessages,[t]:h}}}),addLocalChatMessage:(t,n)=>e(r=>{const i=r.chatMessages[t]??[];return{chatMessages:{...r.chatMessages,[t]:[...i,n]}}}),setChatMessages:(t,n)=>e(r=>({chatMessages:{...r.chatMessages,[t]:n}})),setEntrypoints:t=>e({entrypoints:t}),breakpoints:{},toggleBreakpoint:(t,n)=>e(r=>{const i={...r.breakpoints[t]??{}};return i[n]?delete i[n]:i[n]=!0,{breakpoints:{...r.breakpoints,[t]:i}}}),clearBreakpoints:t=>e(n=>{const{[t]:r,...i}=n.breakpoints;return{breakpoints:i}}),activeNodes:{},setActiveNode:(t,n,r)=>e(i=>{const s=i.activeNodes[t]??{executing:{},prev:null};return{activeNodes:{...i.activeNodes,[t]:{executing:{...s.executing,[n]:r??null},prev:s.prev}}}}),removeActiveNode:(t,n)=>e(r=>{const i=r.activeNodes[t];if(!i)return r;const{[n]:s,...o}=i.executing;return{activeNodes:{...r.activeNodes,[t]:{executing:o,prev:n}}}}),resetRunGraphState:t=>e(n=>({stateEvents:{...n.stateEvents,[t]:[]},activeNodes:{...n.activeNodes,[t]:{executing:{},prev:null}}})),stateEvents:{},addStateEvent:(t,n,r,i,s)=>e(o=>{const l=o.stateEvents[t]??[];return{stateEvents:{...o.stateEvents,[t]:[...l,{node_name:n,qualified_node_name:i,phase:s,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}}))})),Vn="/api";async function Ul(e){const t=await fetch(`${Vn}/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 sr(){const e=await fetch(`${Vn}/auth/status`);if(!e.ok)throw new Error(`Status check failed: ${e.status}`);return e.json()}async function $l(e){const t=await fetch(`${Vn}/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 Hl(){await fetch(`${Vn}/auth/logout`,{method:"POST"})}const gs="uipath-env",Wl=["cloud","staging","alpha"];function Kl(){const e=localStorage.getItem(gs);return Wl.includes(e)?e:"cloud"}const zn=Ot((e,t)=>({enabled:!0,status:"unauthenticated",environment:Kl(),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 sr();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(gs,n),e({environment:n})},startLogin:async()=>{const{environment:n}=t();try{const r=await Ul(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 i=await sr();i.status!=="pending"&&(t().stopPolling(),e({status:i.status,tenants:i.tenants??[],uipathUrl:i.uipath_url??null}),i.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 sr()).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 $l(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 Hl()}catch{}e({status:"unauthenticated",tenants:[],uipathUrl:null})}})),bs=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 Gl{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(i=>{try{i(r)}catch(s){console.error("[ws] handler error",s)}})},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 i;const r=JSON.stringify({type:t,payload:n});((i=this.ws)==null?void 0:i.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,i){this.send("agent.message",{text:t,model:n,session_id:r??void 0,skill_ids:i&&i.length>0?i: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})}}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 i=r.evalSets[t];return i?{evalSets:{...r.evalSets,[t]:{...i,evaluator_ids:n}}}:r}),incrementEvalSetCount:(t,n=1)=>e(r=>{const i=r.evalSets[t];return i?{evalSets:{...r.evalSets,[t]:{...i,eval_count:i.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(i=>{const s=i.evalRuns[t];return s?{evalRuns:{...i.evalRuns,[t]:{...s,progress_completed:n,progress_total:r,status:"running"}}}:i}),completeEvalRun:(t,n,r)=>e(i=>{const s=i.evalRuns[t];return s?{evalRuns:{...i.evalRuns,[t]:{...s,status:"completed",overall_score:n,evaluator_scores:r,end_time:new Date().toISOString()}}}:i})}));let ql=0;function Ut(){return`agent-msg-${++ql}`}const rt=Ot(e=>({sessionId:null,status:"idle",messages:[],plan:[],models:[],selectedModel:null,modelsLoading:!1,skills:[],selectedSkillIds:[],skillsLoading:!1,setStatus:t=>e({status:t}),addUserMessage:t=>e(n=>({messages:[...n.messages,{id:Ut(),role:"user",content:t,timestamp:Date.now()}]})),appendAssistantText:(t,n)=>e(r=>{const i=[...r.messages],s=i[i.length-1];return s&&s.role==="assistant"&&!s.done?i[i.length-1]={...s,content:s.content+t,done:n}:i.push({id:Ut(),role:"assistant",content:t,timestamp:Date.now(),done:n}),{messages:i}}),setPlan:t=>e(n=>{const r=[...n.messages],i=r.findIndex(o=>o.role==="plan"),s={id:i>=0?r[i].id:Ut(),role:"plan",content:"",timestamp:Date.now(),planItems:t};return i>=0?r[i]=s:r.push(s),{messages:r,plan:t}}),addToolUse:(t,n)=>e(r=>{const i=[...r.messages],s=i[i.length-1],o={tool:t,args:n};return s&&s.role==="tool"&&s.toolCalls?i[i.length-1]={...s,toolCalls:[...s.toolCalls,o]}:i.push({id:Ut(),role:"tool",content:"",timestamp:Date.now(),toolCalls:[o]}),{messages:i}}),addToolResult:(t,n,r)=>e(i=>{const s=[...i.messages];for(let o=s.length-1;o>=0;o--){const l=s[o];if(l.role==="tool"&&l.toolCalls){const u=[...l.toolCalls];for(let c=u.length-1;c>=0;c--)if(u[c].tool===t&&u[c].result===void 0)return u[c]={...u[c],result:n,is_error:r},s[o]={...l,toolCalls:u},{messages:s}}}return{messages:s}}),addToolApprovalRequest:(t,n,r)=>e(i=>{const s=[...i.messages],o={tool:n,args:r,tool_call_id:t,status:"pending"},l=s[s.length-1];return l&&l.role==="tool"&&l.toolCalls?s[s.length-1]={...l,toolCalls:[...l.toolCalls,o]}:s.push({id:Ut(),role:"tool",content:"",timestamp:Date.now(),toolCalls:[o]}),{messages:s}}),resolveToolApproval:(t,n)=>e(r=>{const i=[...r.messages];for(let s=i.length-1;s>=0;s--){const o=i[s];if(o.role==="tool"&&o.toolCalls){const l=[...o.toolCalls];for(let u=l.length-1;u>=0;u--)if(l[u].tool_call_id===t)return l[u]={...l[u],status:n?"approved":"denied"},i[s]={...o,toolCalls:l},{messages:i}}}return{messages:i}}),appendThinking:t=>e(n=>{const r=[...n.messages],i=r[r.length-1];return i&&i.role==="thinking"?r[r.length-1]={...i,content:i.content+t}:r.push({id:Ut(),role:"thinking",content:t,timestamp:Date.now()}),{messages:r}}),addError:t=>e(n=>({status:"error",messages:[...n.messages,{id:Ut(),role:"assistant",content:`Error: ${t}`,timestamp:Date.now(),done:!0}]})),setSessionId: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(i=>i!==t):[...n.selectedSkillIds,t]})),setSkillsLoading:t=>e({skillsLoading:t}),clearSession:()=>e({sessionId:null,status:"idle",messages:[],plan:[]})})),Me=Ot(e=>({children:{},expanded:{},selectedFile:null,openTabs:[],fileCache:{},dirty:{},buffers:{},loadingDirs:{},loadingFile:!1,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(c=>c!==t);let i=n.selectedFile;if(i===t){const c=n.openTabs.indexOf(t);i=r[Math.min(c,r.length-1)]??null}const{[t]:s,...o}=n.dirty,{[t]:l,...u}=n.buffers;return{openTabs:r,selectedFile:i,dirty:o,buffers:u}}),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,...i}=n.dirty,{[t]:s,...o}=n.buffers;return{dirty:i,buffers:o}}),setLoadingDir:(t,n)=>e(r=>({loadingDirs:{...r.loadingDirs,[t]:n}})),setLoadingFile:t=>e({loadingFile:t})})),qr="/api";async function Vr(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 i=new Error(`HTTP ${n.status}`);throw i.detail=r,i.status=n.status,i}return n.json()}async function Yr(e){return Vr(`${qr}/files/tree?path=${encodeURIComponent(e)}`)}async function xs(e){return Vr(`${qr}/files/content?path=${encodeURIComponent(e)}`)}async function Vl(e,t){await Vr(`${qr}/files/content?path=${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t})})}let Cn=null;function Xr(){return Cn||(Cn=new Gl,Cn.connect()),Cn}function Yl(){const e=S.useRef(Xr()),{upsertRun:t,addTrace:n,addLog:r,addChatEvent:i,setActiveInterrupt:s,setActiveNode:o,removeActiveNode:l,resetRunGraphState:u,addStateEvent:c,setReloadPending:d}=Ee(),{upsertEvalRun:p,updateEvalRunProgress:m,completeEvalRun:f}=Ae();return S.useEffect(()=>e.current.onMessage(v=>{switch(v.type){case"run.updated":t(v.payload);break;case"trace":n(v.payload);break;case"log":r(v.payload);break;case"chat":{const b=v.payload.run_id;i(b,v.payload);break}case"chat.interrupt":{const b=v.payload.run_id;s(b,v.payload);break}case"state":{const b=v.payload.run_id,E=v.payload.node_name,A=v.payload.qualified_node_name??null,D=v.payload.phase??null,L=v.payload.payload;E==="__start__"&&D==="started"&&u(b),D==="started"?o(b,E,A):D==="completed"&&l(b,E),c(b,E,L,A,D);break}case"reload":d(!0);break;case"files.changed":{const b=v.payload.files,E=new Set(b),A=Me.getState();for(const L of A.openTabs)A.dirty[L]||!E.has(L)||xs(L).then(T=>{var O;const B=Me.getState();B.dirty[L]||((O=B.fileCache[L])==null?void 0:O.content)!==T.content&&B.setFileContent(L,T)}).catch(()=>{});const D=new Set;for(const L of b){const T=L.lastIndexOf("/"),B=T===-1?"":L.substring(0,T);B in A.children&&D.add(B)}for(const L of D)Yr(L).then(T=>Me.getState().setChildren(L,T)).catch(()=>{});break}case"eval_run.created":p(v.payload);break;case"eval_run.progress":{const{run_id:b,completed:E,total:A,item_result:D}=v.payload;m(b,E,A,D);break}case"eval_run.completed":{const{run_id:b,overall_score:E,evaluator_scores:A}=v.payload;f(b,E,A);break}case"agent.status":{const{session_id:b,status:E}=v.payload,A=rt.getState();A.sessionId||A.setSessionId(b),A.setStatus(E);break}case"agent.text":{const{session_id:b,content:E,done:A}=v.payload,D=rt.getState();D.sessionId||D.setSessionId(b),D.appendAssistantText(E,A);break}case"agent.plan":{const{session_id:b,items:E}=v.payload,A=rt.getState();A.sessionId||A.setSessionId(b),A.setPlan(E);break}case"agent.tool_use":{const{session_id:b,tool:E,args:A}=v.payload,D=rt.getState();D.sessionId||D.setSessionId(b),D.addToolUse(E,A);break}case"agent.tool_result":{const{tool:b,result:E,is_error:A}=v.payload;rt.getState().addToolResult(b,E,A);break}case"agent.tool_approval":{const{session_id:b,tool_call_id:E,tool:A,args:D}=v.payload,L=rt.getState();L.sessionId||L.setSessionId(b),L.addToolApprovalRequest(E,A,D);break}case"agent.thinking":{const{content:b}=v.payload;rt.getState().appendThinking(b);break}case"agent.text_delta":{const{session_id:b,delta:E}=v.payload,A=rt.getState();A.sessionId||A.setSessionId(b),A.appendAssistantText(E,!1);break}case"agent.token_usage":break;case"agent.error":{const{message:b}=v.payload;rt.getState().addError(b);break}}}),[t,n,r,i,s,o,l,u,c,d,p,m,f]),e.current}const Lt="/api";async function jt(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 i=new Error(`HTTP ${n.status}`);throw i.detail=r,i.status=n.status,i}return n.json()}async function ys(){return jt(`${Lt}/entrypoints`)}async function Xl(e){return jt(`${Lt}/entrypoints/${encodeURIComponent(e)}/schema`)}async function Zl(e){return jt(`${Lt}/entrypoints/${encodeURIComponent(e)}/mock-input`)}async function Jl(e){return jt(`${Lt}/entrypoints/${encodeURIComponent(e)}/graph`)}async function Mi(e,t,n="run",r=[]){return jt(`${Lt}/runs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entrypoint:e,input_data:t,mode:n,breakpoints:r})})}async function Ql(){return jt(`${Lt}/runs`)}async function ar(e){return jt(`${Lt}/runs/${e}`)}async function ec(){return jt(`${Lt}/reload`,{method:"POST"})}function tc(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};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 i=t.match(/^(?:debug\/)?runs\/([^/]+)(?:\/(traces|output))?$/);if(i)return{...n,view:"details",runId:i[1],tab:i[2]??"traces"};if(t==="evals/new")return{...n,section:"evals",evalCreating:!0};const s=t.match(/^evals\/runs\/([^/]+?)(?:\/([^/]+))?$/);if(s)return{...n,section:"evals",evalRunId:s[1],evalRunItemName:s[2]?decodeURIComponent(s[2]):null};const o=t.match(/^evals\/sets\/([^/]+)$/);if(o)return{...n,section:"evals",evalSetId:o[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 u=t.match(/^evaluators\/category\/(deterministic|llm|tool)$/);if(u)return{...n,section:"evaluators",evaluatorFilter:u[1]};const c=t.match(/^evaluators\/([^/]+)$/);if(c)return{...n,section:"evaluators",evaluatorId:c[1]};if(t==="evaluators")return{...n,section:"evaluators"};const d=t.match(/^explorer\/file\/(.+)$/);return d?{...n,section:"explorer",explorerFile:decodeURIComponent(d[1])}:t==="explorer"?{...n,section:"explorer"}:n}function nc(){return window.location.hash}function rc(e){return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)}function st(){const e=S.useSyncExternalStore(rc,nc),t=tc(e),n=S.useCallback(r=>{window.location.hash=r},[]);return{...t,navigate:n}}const Ri="(max-width: 767px)";function ic(){const[e,t]=S.useState(()=>window.matchMedia(Ri).matches);return S.useEffect(()=>{const n=window.matchMedia(Ri),r=i=>t(i.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const oc=[{section:"debug",label:"Developer Console",icon:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"8",y:"6",width:"8",height:"14",rx:"4"}),a.jsx("path",{d:"M6 10H4"}),a.jsx("path",{d:"M6 18H4"}),a.jsx("path",{d:"M18 10h2"}),a.jsx("path",{d:"M18 18h2"}),a.jsx("path",{d:"M8 14h8"}),a.jsx("path",{d:"M9 6l-1.5-2"}),a.jsx("path",{d:"M15 6l1.5-2"}),a.jsx("path",{d:"M6 14H4"}),a.jsx("path",{d:"M18 14h2"})]})},{section:"evals",label:"Evals",icon:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M9 3h6"}),a.jsx("path",{d:"M10 3v6.5L5 20a1 1 0 0 0 .9 1.4h12.2a1 1 0 0 0 .9-1.4L14 9.5V3"}),a.jsx("path",{d:"M8.5 14h7"})]})},{section:"evaluators",label:"Evaluators",icon:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2l7 4v5c0 5.25-3.5 9.74-7 11-3.5-1.26-7-5.75-7-11V6l7-4z"}),a.jsx("path",{d:"M9 12l2 2 4-4"})]})},{section:"explorer",label:"Explorer",icon:a.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:a.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 sc({section:e,onSectionChange:t}){return a.jsx("div",{className:"w-12 flex flex-col items-center shrink-0 border-r",style:{background:"var(--activity-bar-bg)",borderColor:"var(--border)"},children:a.jsx("div",{className:"flex flex-col items-center gap-1 pt-2",children:oc.map(n=>{const r=e===n.section;return a.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:i=>{r||(i.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:i=>{r||(i.currentTarget.style.color="var(--text-muted)")},children:[r&&a.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 et="/api";async function tt(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 i=new Error(`HTTP ${n.status}`);throw i.detail=r,i.status=n.status,i}return n.json()}async function ac(){return tt(`${et}/evaluators`)}async function vs(){return tt(`${et}/eval-sets`)}async function lc(e){return tt(`${et}/eval-sets`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function cc(e,t){return tt(`${et}/eval-sets/${encodeURIComponent(e)}/items`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function uc(e,t){await tt(`${et}/eval-sets/${encodeURIComponent(e)}/items/${encodeURIComponent(t)}`,{method:"DELETE"})}async function dc(e){return tt(`${et}/eval-sets/${encodeURIComponent(e)}`)}async function pc(e){return tt(`${et}/eval-sets/${encodeURIComponent(e)}/runs`,{method:"POST"})}async function fc(){return tt(`${et}/eval-runs`)}async function Ii(e){return tt(`${et}/eval-runs/${encodeURIComponent(e)}`)}async function Zr(){return tt(`${et}/local-evaluators`)}async function mc(e){return tt(`${et}/local-evaluators`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function hc(e,t){return tt(`${et}/eval-sets/${encodeURIComponent(e)}/evaluators`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({evaluator_refs:t})})}async function gc(e,t){return tt(`${et}/local-evaluators/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}const bc={"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 xc(e,t){if(!e)return{};const n=bc[e.evaluator_type_id];return n?n(t):e.type==="tool"?{}:e.evaluator_type_id.includes("trajectory")?{expectedAgentBehavior:""}:{expectedOutput:t}}function Es(e){return e?e.type==="tool"?!0:e.evaluator_type_id.includes("tool-call"):!1}function yc(e){return e?Es(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 vc({run:e,onClose:t}){const n=Ae(k=>k.evalSets),r=Ae(k=>k.setEvalSets),i=Ae(k=>k.incrementEvalSetCount),s=Ae(k=>k.localEvaluators),o=Ae(k=>k.setLocalEvaluators),[l,u]=S.useState(`run-${e.id.slice(0,8)}`),[c,d]=S.useState(new Set),[p,m]=S.useState({}),f=S.useRef(new Set),[h,x]=S.useState(!1),[v,b]=S.useState(null),[E,A]=S.useState(!1),D=Object.values(n),L=S.useMemo(()=>Object.fromEntries(s.map(k=>[k.id,k])),[s]),T=S.useMemo(()=>{const k=new Set;for(const w of c){const M=n[w];M&&M.evaluator_ids.forEach(I=>k.add(I))}return[...k]},[c,n]);S.useEffect(()=>{const k=e.output_data,w=f.current;m(M=>{const I={};for(const j of T)if(w.has(j)&&M[j]!==void 0)I[j]=M[j];else{const _=L[j],N=xc(_,k);I[j]=JSON.stringify(N,null,2)}return I})},[T,L,e.output_data]),S.useEffect(()=>{const k=w=>{w.key==="Escape"&&t()};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[t]),S.useEffect(()=>{D.length===0&&vs().then(r).catch(()=>{}),s.length===0&&Zr().then(o).catch(()=>{})},[]);const B=k=>{d(w=>{const M=new Set(w);return M.has(k)?M.delete(k):M.add(k),M})},O=async()=>{var w;if(!l.trim()||c.size===0)return;b(null),x(!0);const k={};for(const M of T){const I=p[M];if(I!==void 0)try{k[M]=JSON.parse(I)}catch{b(`Invalid JSON for evaluator "${((w=L[M])==null?void 0:w.name)??M}"`),x(!1);return}}try{for(const M of c){const I=n[M],j=new Set((I==null?void 0:I.evaluator_ids)??[]),_={};for(const[N,R]of Object.entries(k))j.has(N)&&(_[N]=R);await cc(M,{name:l.trim(),inputs:e.input_data,expected_output:null,evaluation_criterias:_}),i(M)}A(!0),setTimeout(t,3e3)}catch(M){b(M.detail||M.message||"Failed to add item")}finally{x(!1)}};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.5)"},onClick:k=>{k.target===k.currentTarget&&t()},children:a.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:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:"var(--accent)"}}),a.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--text-muted)"},children:"Add to Eval Set"})]}),a.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:k=>{k.currentTarget.style.color="var(--text-primary)"},onMouseLeave:k=>{k.currentTarget.style.color="var(--text-muted)"},"aria-label":"Close",children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 space-y-4 pr-1",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Item Name"}),a.jsx("input",{type:"text",value:l,onChange:k=>u(k.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)"}})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Inputs"}),a.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)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Eval Sets"}),D.length===0?a.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:"No eval sets found. Create one first."}):a.jsx("div",{className:"rounded-md border overflow-hidden max-h-40 overflow-y-auto",style:{borderColor:"var(--border)",background:"var(--bg-secondary)"},children:D.map(k=>a.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:w=>{w.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:w=>{w.currentTarget.style.background="transparent"},children:[a.jsx("input",{type:"checkbox",checked:c.has(k.id),onChange:()=>B(k.id),className:"accent-[var(--accent)]"}),a.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:k.name}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-muted)"},children:[k.eval_count," items"]})]},k.id))})]}),T.length>0&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Evaluation Criteria"}),a.jsx("div",{className:"space-y-2",children:T.map(k=>{const w=L[k],M=Es(w),I=yc(w);return a.jsxs("div",{className:"rounded-md",style:{border:"1px solid var(--border)",background:"var(--bg-primary)",opacity:M?.6:1},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{borderBottom:M?"none":"1px solid var(--border)"},children:[a.jsx("span",{className:"text-xs font-medium truncate flex-1",style:{color:"var(--text-primary)"},children:(w==null?void 0:w.name)??k}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium",style:{color:I.color,background:`color-mix(in srgb, ${I.color} 12%, transparent)`},children:I.label})]}),M?a.jsx("div",{className:"px-3 pb-2",children:a.jsx("span",{className:"text-[10px] italic",style:{color:"var(--text-muted)"},children:"Default criteria — uses evaluator config"})}):a.jsx("div",{className:"px-3 pb-2 pt-1",children:a.jsx("textarea",{value:p[k]??"{}",onChange:j=>{f.current.add(k),m(_=>({..._,[k]:j.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)"}})})]},k)})})]})]}),a.jsxs("div",{className:"mt-4 space-y-3",children:[v&&a.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}),E&&a.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 ",c.size," eval set",c.size!==1?"s":"","."]}),a.jsxs("div",{className:"flex gap-2",children:[a.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"}),a.jsx("button",{onClick:O,disabled:!l.trim()||c.size===0||h||E,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:h?"Adding...":E?"Added":"Add Item"})]})]})]})})}const Ec={pending:"var(--text-muted)",running:"var(--warning)",suspended:"var(--info)",completed:"var(--success)",failed:"var(--error)"};function kc({run:e,isSelected:t,onClick:n}){var p;const r=Ec[e.status]??"var(--text-muted)",i=((p=e.entrypoint.split("/").pop())==null?void 0:p.slice(0,16))??e.entrypoint,s=e.start_time?new Date(e.start_time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"",[o,l]=S.useState(!1),[u,c]=S.useState(!1),d=S.useRef(null);return S.useEffect(()=>{if(!o)return;const m=f=>{d.current&&!d.current.contains(f.target)&&l(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]),a.jsxs(a.Fragment,{children:[a.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:[a.jsx("span",{className:"shrink-0 w-2 h-2 rounded-full",style:{background:r}}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-xs truncate",style:{color:t?"var(--text-primary)":"var(--text-secondary)"},children:i}),a.jsxs("div",{className:"text-[11px] tabular-nums",style:{color:"var(--text-muted)"},children:[s,e.duration?` · ${e.duration}`:""]})]}),e.status==="completed"&&a.jsxs("div",{ref:d,className:"relative shrink-0",children:[a.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:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",children:[a.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),a.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),a.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}),o&&a.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:a.jsx("button",{onClick:m=>{m.stopPropagation(),l(!1),c(!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"})})]})]}),u&&a.jsx(vc,{run:e,onClose:()=>c(!1)})]})}function Oi({runs:e,selectedRunId:t,onSelectRun:n,onNewRun:r}){const i=[...e].sort((s,o)=>new Date(o.start_time??0).getTime()-new Date(s.start_time??0).getTime());return a.jsxs(a.Fragment,{children:[a.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:s=>{s.currentTarget.style.color="var(--text-primary)",s.currentTarget.style.borderColor="var(--text-muted)"},onMouseLeave:s=>{s.currentTarget.style.color="var(--text-secondary)",s.currentTarget.style.borderColor=""},children:"+ New Run"}),a.jsx("div",{className:"px-3 pt-3 pb-1 text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"History"}),a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[i.map(s=>a.jsx(kc,{run:s,isSelected:s.id===t,onClick:()=>n(s.id)},s.id)),i.length===0&&a.jsx("p",{className:"text-xs px-3 py-4 text-center",style:{color:"var(--text-muted)"},children:"No runs yet"})]})]})}function ks(){const e=localStorage.getItem("uipath-dev-theme");return e==="light"||e==="dark"?e:"dark"}function ws(e){document.documentElement.setAttribute("data-theme",e),localStorage.setItem("uipath-dev-theme",e)}ws(ks());const _s=Ot(e=>({theme:ks(),toggleTheme:()=>e(t=>{const n=t.theme==="dark"?"light":"dark";return ws(n),{theme:n}})}));function Li(){const{theme:e,toggleTheme:t}=_s(),{enabled:n,status:r,environment:i,tenants:s,uipathUrl:o,setEnvironment:l,startLogin:u,selectTenant:c,logout:d}=zn(),{projectName:p,projectVersion:m,projectAuthors:f}=bs(),[h,x]=S.useState(!1),[v,b]=S.useState(""),E=S.useRef(null),A=S.useRef(null);S.useEffect(()=>{if(!h)return;const _=N=>{E.current&&!E.current.contains(N.target)&&A.current&&!A.current.contains(N.target)&&x(!1)};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[h]);const D=r==="authenticated",L=r==="expired",T=r==="pending",B=r==="needs_tenant";let O="UiPath: Disconnected",k=null,w=!0;D?(O=`UiPath: ${o?o.replace(/^https?:\/\/[^/]+\//,""):""}`,k="var(--success)",w=!1):L?(O=`UiPath: ${o?o.replace(/^https?:\/\/[^/]+\//,""):""} (expired)`,k="var(--error)",w=!1):T?O="UiPath: Signing in…":B&&(O="UiPath: Select Tenant");const M=()=>{T||(L?u():x(_=>!_))},I="flex items-center gap-1 px-1.5 rounded transition-colors",j={onMouseEnter:_=>{_.currentTarget.style.background="var(--bg-hover)",_.currentTarget.style.color="var(--text-primary)"},onMouseLeave:_=>{_.currentTarget.style.background="",_.currentTarget.style.color="var(--text-muted)"}};return a.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&&a.jsxs("div",{className:"relative flex items-center",children:[a.jsxs("div",{ref:A,className:`${I} cursor-pointer`,onClick:M,...j,title:D?o??"":L?"Token expired — click to re-authenticate":T?"Signing in…":B?"Select a tenant":"Click to sign in",children:[T?a.jsxs("svg",{className:"animate-spin",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10",strokeOpacity:"0.25"}),a.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",strokeLinecap:"round"})]}):k?a.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:k}}):w?a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 9.9-1"})]}):null,a.jsx("span",{className:"truncate max-w-[200px]",children:O})]}),h&&a.jsx("div",{ref:E,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:D||L?a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>{o&&window.open(o,"_blank","noopener,noreferrer"),x(!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:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),a.jsx("polyline",{points:"15 3 21 3 21 9"}),a.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),"Go to Platform"]}),a.jsxs("button",{onClick:()=>{d(),x(!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:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),a.jsx("polyline",{points:"16 17 21 12 16 7"}),a.jsx("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]}),"Sign Out"]})]}):B?a.jsxs("div",{className:"p-1",children:[a.jsx("label",{className:"block text-[10px] font-medium mb-1",style:{color:"var(--text-muted)"},children:"Tenant"}),a.jsxs("select",{value:v,onChange:_=>b(_.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:[a.jsx("option",{value:"",children:"Select…"}),s.map(_=>a.jsx("option",{value:_,children:_},_))]}),a.jsx("button",{onClick:()=>{v&&(c(v),x(!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"})]}):a.jsxs("div",{className:"p-1",children:[a.jsx("label",{className:"block text-[10px] font-medium mb-1",style:{color:"var(--text-muted)"},children:"Environment"}),a.jsxs("select",{value:i,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:[a.jsx("option",{value:"cloud",children:"cloud"}),a.jsx("option",{value:"staging",children:"staging"}),a.jsx("option",{value:"alpha",children:"alpha"})]}),a.jsx("button",{onClick:()=>{u(),x(!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&&a.jsxs("span",{className:I,children:["Project: ",p]}),m&&a.jsxs("span",{className:I,children:["Version: v",m]}),f&&a.jsxs("span",{className:I,children:["Author: ",f]}),a.jsxs("a",{href:"https://github.com/UiPath/uipath-dev-python",target:"_blank",rel:"noopener noreferrer",className:`${I} cursor-pointer no-underline`,style:{color:"var(--text-muted)"},...j,title:"View on GitHub",children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:a.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"})}),a.jsx("span",{children:"uipath-dev-python"})]}),a.jsxs("div",{className:`${I} cursor-pointer`,onClick:t,...j,title:`Switch to ${e==="dark"?"light":"dark"} theme`,children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e==="dark"?a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"12",cy:"12",r:"5"}),a.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),a.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),a.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),a.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),a.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),a.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),a.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),a.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]}):a.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),a.jsx("span",{children:e==="dark"?"Dark":"Light"})]})]})}function wc(){const{navigate:e}=st(),t=Ee(c=>c.entrypoints),[n,r]=S.useState(""),[i,s]=S.useState(!0),[o,l]=S.useState(null);S.useEffect(()=>{!n&&t.length>0&&r(t[0])},[t,n]),S.useEffect(()=>{n&&(s(!0),l(null),Xl(n).then(c=>{var p;const d=(p=c.input)==null?void 0:p.properties;s(!!(d!=null&&d.messages))}).catch(c=>{const d=c.detail||{};l(d.error||d.message||`Failed to load entrypoint "${n}"`)}))},[n]);const u=c=>{n&&e(`#/setup/${encodeURIComponent(n)}/${c}`)};return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"w-full max-w-xl px-6",children:[a.jsxs("div",{className:"mb-8 text-center",children:[a.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:o?"var(--error)":"var(--accent)"}}),a.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--text-muted)"},children:"New Run"})]}),!o&&a.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&&a.jsxs("div",{className:"mb-8",children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Entrypoint"}),a.jsx("select",{id:"entrypoint-select",value:n,onChange:c=>r(c.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(c=>a.jsx("option",{value:c,children:c},c))})]}),o?a.jsxs("div",{className:"rounded-md border overflow-hidden",style:{borderColor:"color-mix(in srgb, var(--error) 25%, var(--border))",background:"var(--bg-secondary)"},children:[a.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:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:a.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)"})}),a.jsx("span",{className:"text-[11px] font-medium",style:{color:"var(--error)"},children:"Failed to load entrypoint"})]}),a.jsx("div",{className:"overflow-auto max-h-48 p-3",children:a.jsx("pre",{className:"text-[11px] font-mono whitespace-pre-wrap break-words leading-relaxed m-0",style:{color:"var(--text-muted)"},children:o})})]}):a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(ji,{title:"Autonomous",description:"Run the agent end-to-end. Set breakpoints to pause and inspect execution.",icon:a.jsx(_c,{}),color:"var(--success)",onClick:()=>u("run"),disabled:!n}),a.jsx(ji,{title:"Conversational",description:i?"Interactive chat session. Send messages and receive responses in real time.":'Requires a "messages" property in the input schema.',icon:a.jsx(Nc,{}),color:"var(--accent)",onClick:()=>u("chat"),disabled:!n||!i})]})]})})}function ji({title:e,description:t,icon:n,color:r,onClick:i,disabled:s}){return a.jsxs("button",{onClick:i,disabled:s,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:o=>{s||(o.currentTarget.style.borderColor=r,o.currentTarget.style.background=`color-mix(in srgb, ${r} 5%, var(--bg-secondary))`)},onMouseLeave:o=>{o.currentTarget.style.borderColor="var(--border)",o.currentTarget.style.background="var(--bg-secondary)"},children:[a.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}),a.jsx("h3",{className:"text-sm font-semibold mb-1.5",style:{color:"var(--text-primary)"},children:e}),a.jsx("p",{className:"text-xs leading-relaxed",style:{color:"var(--text-muted)"},children:t})]})}function _c(){return a.jsx("svg",{width:"28",height:"28",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.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 Nc(){return a.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.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"}),a.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"}),a.jsx("ellipse",{cx:"12.9987",cy:"4.33268",rx:"2.16667",ry:"2.16667",fill:"currentColor"}),a.jsx("rect",{x:"11.918",y:"5.41602",width:"2.16667",height:"2.16667",fill:"currentColor"}),a.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"}),a.jsx("rect",{x:"3.25",y:"15.166",width:"2.16667",height:"1.08333",fill:"currentColor"}),a.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"}),a.jsx("rect",{x:"20.582",y:"15.166",width:"2.16667",height:"1.08333",fill:"currentColor"})]})}const Sc="modulepreload",Tc=function(e){return"/"+e},Di={},Ns=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(c){return Promise.all(c.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]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=o(n.map(c=>{if(c=Tc(c),c in Di)return;Di[c]=!0;const d=c.endsWith(".css"),p=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${p}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":Sc,d||(m.as="script"),m.crossOrigin="",m.href=c,u&&m.setAttribute("nonce",u),document.head.appendChild(m),d)return new Promise((f,h)=>{m.addEventListener("load",f),m.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})},Cc={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Ac({data:e}){const t=e.status,n=e.nodeWidth,r=e.label??"Start",i=e.hasBreakpoint,s=e.isPausedHere,o=e.isActiveNode,l=e.isExecutingNode,u=s?"var(--error)":l?"var(--success)":o?"var(--accent)":t==="completed"?"var(--success)":t==="running"?"var(--warning)":"var(--node-border)",c=s?"var(--error)":l?"var(--success)":"var(--accent)";return a.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 ${u}`,boxShadow:s||o||l?`0 0 4px ${c}`:void 0,animation:s||o||l?`node-pulse-${s?"red":l?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:r,children:[i&&a.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,a.jsx(gt,{type:"source",position:bt.Bottom,style:Cc})]})}const Mc={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Rc({data:e}){const t=e.status,n=e.nodeWidth,r=e.label??"End",i=e.hasBreakpoint,s=e.isPausedHere,o=e.isActiveNode,l=e.isExecutingNode,u=s?"var(--error)":l?"var(--success)":o?"var(--accent)":t==="completed"?"var(--success)":t==="failed"?"var(--error)":"var(--node-border)",c=s?"var(--error)":l?"var(--success)":"var(--accent)";return a.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 ${u}`,boxShadow:s||o||l?`0 0 4px ${c}`:void 0,animation:s||o||l?`node-pulse-${s?"red":l?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:r,children:[i&&a.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)"}}),a.jsx(gt,{type:"target",position:bt.Top,style:Mc}),r]})}const Pi={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Ic({data:e}){const t=e.status,n=e.nodeWidth,r=e.model_name,i=e.label??"Model",s=e.hasBreakpoint,o=e.isPausedHere,l=e.isActiveNode,u=e.isExecutingNode,c=o?"var(--error)":u?"var(--success)":l?"var(--accent)":t==="completed"?"var(--success)":t==="running"?"var(--warning)":t==="failed"?"var(--error)":"var(--node-border)",d=o?"var(--error)":u?"var(--success)":"var(--accent)";return a.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:o||l||u?`0 0 4px ${d}`:void 0,animation:o||l||u?`node-pulse-${o?"red":u?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:r?`${i} -${r}`:i,children:[s&&a.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)"}}),a.jsx(gt,{type:"target",position:bt.Top,style:Pi}),a.jsx("div",{style:{color:"var(--info)",fontSize:9,marginBottom:1},children:"model"}),a.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:i}),r&&a.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",style:{color:"var(--text-muted)",fontSize:9,marginTop:1},title:r,children:r}),a.jsx(gt,{type:"source",position:bt.Bottom,style:Pi})]})}const Bi={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0},Oc=3;function Lc({data:e}){const t=e.status,n=e.nodeWidth,r=e.tool_names,i=e.tool_count,s=e.label??"Tool",o=e.hasBreakpoint,l=e.isPausedHere,u=e.isActiveNode,c=e.isExecutingNode,d=l?"var(--error)":c?"var(--success)":u?"var(--accent)":t==="completed"?"var(--success)":t==="running"?"var(--warning)":t==="failed"?"var(--error)":"var(--node-border)",p=l?"var(--error)":c?"var(--success)":"var(--accent)",m=(r==null?void 0:r.slice(0,Oc))??[],f=(i??(r==null?void 0:r.length)??0)-m.length;return a.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||u||c?`0 0 4px ${p}`:void 0,animation:l||u||c?`node-pulse-${l?"red":c?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:r!=null&&r.length?`${s} - -${r.join(` -`)}`:s,children:[o&&a.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)"}}),a.jsx(gt,{type:"target",position:bt.Top,style:Bi}),a.jsxs("div",{style:{color:"var(--warning)",fontSize:9,marginBottom:1},children:["tools",i?` (${i})`:""]}),a.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:s}),m.length>0&&a.jsxs("div",{style:{marginTop:3,fontSize:9,color:"var(--text-muted)",textAlign:"left"},children:[m.map(h=>a.jsx("div",{className:"truncate",children:h},h)),f>0&&a.jsxs("div",{style:{fontStyle:"italic"},children:["+",f," more"]})]}),a.jsx(gt,{type:"source",position:bt.Bottom,style:Bi})]})}const Fi={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function jc({data:e}){const t=e.label??"",n=e.status,r=e.hasBreakpoint,i=e.isPausedHere,s=e.isActiveNode,o=e.isExecutingNode,l=i?"var(--error)":o?"var(--success)":s?"var(--accent)":n==="completed"?"var(--success)":n==="running"?"var(--warning)":n==="failed"?"var(--error)":"var(--bg-tertiary)",u=i?"var(--error)":o?"var(--success)":"var(--accent)";return a.jsxs("div",{className:"relative cursor-pointer",style:{width:"100%",height:"100%",background:"var(--bg-secondary)",border:`1.5px ${i||s||o?"solid":"dashed"} ${l}`,borderRadius:8,boxShadow:i||s||o?`0 0 4px ${u}`:void 0,animation:i||s||o?`node-pulse-${i?"red":o?"green":"accent"} 1.5s ease-in-out infinite`:void 0},children:[r&&a.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}}),a.jsx(gt,{type:"target",position:bt.Top,style:Fi}),a.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}),a.jsx(gt,{type:"source",position:bt.Bottom,style:Fi})]})}function Dc({data:e}){const t=e.status,n=e.nodeWidth,r=e.label??"",i=e.hasBreakpoint,s=e.isPausedHere,o=e.isActiveNode,l=e.isExecutingNode,u=s?"var(--error)":l?"var(--success)":o?"var(--accent)":t==="completed"?"var(--success)":t==="running"?"var(--warning)":t==="failed"?"var(--error)":"var(--node-border)",c=s?"var(--error)":l?"var(--success)":"var(--accent)";return a.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:s||o||l?`0 0 4px ${c}`:void 0,animation:s||o||l?`node-pulse-${s?"red":l?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:r,children:[i&&a.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)"}}),a.jsx(gt,{type:"target",position:bt.Top}),a.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:r}),a.jsx(gt,{type:"source",position:bt.Bottom})]})}function Pc(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 i=1;i0&&(n+=Math.min(r.length,3)*12+(r.length>3?12:0)+4),e!=null&&e.model_name&&(n+=14),n}let lr=null;async function Wc(){if(!lr){const{default:e}=await Ns(async()=>{const{default:t}=await import("./vendor-elk-CzxJ-xdZ.js").then(n=>n.e);return{default:t}},__vite__mapDeps([0,1]));lr=new e}return lr}const $i={"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"},Kc="[top=35,left=15,bottom=15,right=15]";function Gc(e){const t=[],n=[];for(const r of e.nodes){const i=r.data,s={id:r.id,width:zi(i),height:Ui(i,r.type)};if(r.data.subgraph){const o=r.data.subgraph;delete s.width,delete s.height,s.layoutOptions={...$i,"elk.padding":Kc},s.children=o.nodes.map(l=>({id:`${r.id}/${l.id}`,width:zi(l.data),height:Ui(l.data,l.type)})),s.edges=o.edges.map(l=>({id:`${r.id}/${l.id}`,sources:[`${r.id}/${l.source}`],targets:[`${r.id}/${l.target}`]}))}t.push(s)}for(const r of e.edges)n.push({id:r.id,sources:[r.source],targets:[r.target]});return{id:"root",layoutOptions:$i,children:t,edges:n}}const Rr={type:Ml.ArrowClosed,width:12,height:12,color:"var(--node-border)"};function Ss(e){return{stroke:"var(--node-border)",strokeWidth:1.5,...e?{strokeDasharray:"6 3"}:{}}}function Hi(e,t,n,r,i){var c;const s=(c=e.sections)==null?void 0:c[0],o=(i==null?void 0:i.x)??0,l=(i==null?void 0:i.y)??0;let u;if(s)u={sourcePoint:{x:s.startPoint.x+o,y:s.startPoint.y+l},targetPoint:{x:s.endPoint.x+o,y:s.endPoint.y+l},bendPoints:(s.bendPoints??[]).map(d=>({x:d.x+o,y:d.y+l}))};else{const d=t.get(e.sources[0]),p=t.get(e.targets[0]);d&&p&&(u={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:u,style:Ss(r),markerEnd:Rr,...n?{label:n,labelStyle:{fill:"var(--text-muted)",fontSize:10},labelBgStyle:{fill:"var(--bg-primary)",fillOpacity:.8}}:{}}}async function qc(e){var u,c;const t=Gc(e),r=await(await Wc()).layout(t),i=new Map;for(const d of e.nodes)if(i.set(d.id,{type:d.type,data:d.data}),d.data.subgraph)for(const p of d.data.subgraph.nodes)i.set(`${d.id}/${p.id}`,{type:p.type,data:p.data});const s=[],o=[],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=i.get(d.id);if((((u=d.children)==null?void 0:u.length)??0)>0){s.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 x of d.children??[]){const v=i.get(x.id);s.push({id:x.id,type:(v==null?void 0:v.type)??"defaultNode",data:{...(v==null?void 0:v.data)??{},nodeWidth:x.width},position:{x:x.x??0,y:x.y??0},parentNode:d.id,extent:"parent"})}const f=d.x??0,h=d.y??0;for(const x of d.edges??[]){const v=e.nodes.find(E=>E.id===d.id),b=(c=v==null?void 0:v.data.subgraph)==null?void 0:c.edges.find(E=>`${d.id}/${E.id}`===x.id);o.push(Hi(x,l,b==null?void 0:b.label,b==null?void 0:b.conditional,{x:f,y:h}))}}else s.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);o.push(Hi(d,l,p==null?void 0:p.label,p==null?void 0:p.conditional))}return{nodes:s,edges:o}}function Un({entrypoint:e,runId:t,breakpointNode:n,breakpointNextNodes:r,onBreakpointChange:i}){const[s,o,l]=Rl([]),[u,c,d]=Il([]),[p,m]=S.useState(!0),[f,h]=S.useState(!1),[x,v]=S.useState(0),b=S.useRef(0),E=S.useRef(null),A=Ee(_=>_.breakpoints[t]),D=Ee(_=>_.toggleBreakpoint),L=Ee(_=>_.clearBreakpoints),T=Ee(_=>_.activeNodes[t]),B=Ee(_=>{var N;return(N=_.runs[t])==null?void 0:N.status}),O=S.useCallback((_,N)=>{if(N.type==="startNode"||N.type==="endNode")return;const R=N.type==="groupNode"?N.id:N.id.includes("/")?N.id.split("/").pop():N.id;D(t,R);const W=Ee.getState().breakpoints[t]??{};i==null||i(Object.keys(W))},[t,D,i]),k=A&&Object.keys(A).length>0,w=S.useCallback(()=>{if(k)L(t),i==null||i([]);else{const _=[];for(const R of s){if(R.type==="startNode"||R.type==="endNode"||R.parentNode)continue;const W=R.type==="groupNode"?R.id:R.id.includes("/")?R.id.split("/").pop():R.id;_.push(W)}for(const R of _)A!=null&&A[R]||D(t,R);const N=Ee.getState().breakpoints[t]??{};i==null||i(Object.keys(N))}},[t,k,A,s,L,D,i]);S.useEffect(()=>{o(_=>_.map(N=>{var $;if(N.type==="startNode"||N.type==="endNode")return N;const R=N.type==="groupNode"?N.id:N.id.includes("/")?N.id.split("/").pop():N.id,W=!!(A&&A[R]);return W!==!!(($=N.data)!=null&&$.hasBreakpoint)?{...N,data:{...N.data,hasBreakpoint:W}}:N}))},[A,o]),S.useEffect(()=>{const _=n?new Set(n.split(",").map(N=>N.trim()).filter(Boolean)):null;o(N=>N.map(R=>{var g,F;if(R.type==="startNode"||R.type==="endNode")return R;const W=R.type==="groupNode"?R.id:R.id.includes("/")?R.id.split("/").pop():R.id,$=(g=R.data)==null?void 0:g.label,V=_!=null&&(_.has(W)||$!=null&&_.has($));return V!==!!((F=R.data)!=null&&F.isPausedHere)?{...R,data:{...R.data,isPausedHere:V}}:R}))},[n,x,o]);const M=Ee(_=>_.stateEvents[t]);S.useEffect(()=>{const _=!!n;let N=new Set;const R=new Set,W=new Set,$=new Set,V=new Map,g=new Map;if(M)for(const F of M)F.phase==="started"?g.set(F.node_name,F.qualified_node_name??null):F.phase==="completed"&&g.delete(F.node_name);o(F=>{var y;for(const Q of F)Q.type&&V.set(Q.id,Q.type);const U=Q=>{var K;const se=[];for(const ie of F){const de=ie.type==="groupNode"?ie.id:ie.id.includes("/")?ie.id.split("/").pop():ie.id,be=(K=ie.data)==null?void 0:K.label;(de===Q||be!=null&&be===Q)&&se.push(ie.id)}return se};if(_&&n){const Q=n.split(",").map(se=>se.trim()).filter(Boolean);for(const se of Q)U(se).forEach(K=>N.add(K));if(r!=null&&r.length)for(const se of r)U(se).forEach(K=>W.add(K));T!=null&&T.prev&&U(T.prev).forEach(se=>R.add(se))}else if(g.size>0){const Q=new Map;for(const se of F){const K=(y=se.data)==null?void 0:y.label;if(!K)continue;const ie=se.id.includes("/")?se.id.split("/").pop():se.id;for(const de of[ie,K]){let be=Q.get(de);be||(be=new Set,Q.set(de,be)),be.add(se.id)}}for(const[se,K]of g){let ie=!1;if(K){const de=K.replace(/:/g,"/");for(const be of F)be.id===de&&(N.add(be.id),ie=!0)}if(!ie){const de=Q.get(se);de&&de.forEach(be=>N.add(be))}}}return F}),c(F=>{const U=R.size===0||F.some(y=>N.has(y.target)&&R.has(y.source));return F.map(y=>{var se,K;let Q;return _?Q=N.has(y.target)&&(R.size===0||!U||R.has(y.source))||N.has(y.source)&&W.has(y.target):(Q=N.has(y.source),!Q&&V.get(y.target)==="endNode"&&N.has(y.target)&&(Q=!0)),Q?(_||$.add(y.target),{...y,style:{stroke:"var(--accent)",strokeWidth:2.5},markerEnd:{...Rr,color:"var(--accent)"},data:{...y.data,highlighted:!0},animated:!0}):(se=y.data)!=null&&se.highlighted?{...y,style:Ss((K=y.data)==null?void 0:K.conditional),markerEnd:Rr,data:{...y.data,highlighted:!1},animated:!1}:y})}),o(F=>F.map(U=>{var se,K,ie,de;const y=!_&&N.has(U.id);if(U.type==="startNode"||U.type==="endNode"){const be=$.has(U.id)||!_&&N.has(U.id);return be!==!!((se=U.data)!=null&&se.isActiveNode)||y!==!!((K=U.data)!=null&&K.isExecutingNode)?{...U,data:{...U.data,isActiveNode:be,isExecutingNode:y}}:U}const Q=_?W.has(U.id):$.has(U.id);return Q!==!!((ie=U.data)!=null&&ie.isActiveNode)||y!==!!((de=U.data)!=null&&de.isExecutingNode)?{...U,data:{...U.data,isActiveNode:Q,isExecutingNode:y}}:U}))},[M,T,n,r,B,x,o,c]);const I=Ee(_=>_.graphCache[t]);S.useEffect(()=>{if(!I&&t!=="__setup__")return;const _=I?Promise.resolve(I):Jl(e),N=++b.current;m(!0),h(!1),_.then(async R=>{if(b.current!==N)return;if(!R.nodes.length){h(!0);return}const{nodes:W,edges:$}=await qc(R);if(b.current!==N)return;const V=Ee.getState().breakpoints[t],g=V?W.map(F=>{if(F.type==="startNode"||F.type==="endNode")return F;const U=F.type==="groupNode"?F.id:F.id.includes("/")?F.id.split("/").pop():F.id;return V[U]?{...F,data:{...F.data,hasBreakpoint:!0}}:F}):W;o(g),c($),v(F=>F+1),setTimeout(()=>{var F;(F=E.current)==null||F.fitView({padding:.1,duration:200})},100)}).catch(()=>{b.current===N&&h(!0)}).finally(()=>{b.current===N&&m(!1)})},[e,t,I,o,c]),S.useEffect(()=>{const _=setTimeout(()=>{var N;(N=E.current)==null||N.fitView({padding:.1,duration:200})},100);return()=>clearTimeout(_)},[t]);const j=S.useRef(null);return S.useEffect(()=>{const _=j.current;if(!_)return;const N=new ResizeObserver(()=>{var R;(R=E.current)==null||R.fitView({padding:.1,duration:200})});return N.observe(_),()=>N.disconnect()},[p,f]),S.useEffect(()=>{o(_=>{var y,Q,se;const N=!!(M!=null&&M.length),R=B==="completed"||B==="failed",W=new Set,$=new Set(_.map(K=>K.id)),V=new Map;for(const K of _){const ie=(y=K.data)==null?void 0:y.label;if(!ie)continue;const de=K.id.includes("/")?K.id.split("/").pop():K.id;for(const be of[de,ie]){let Oe=V.get(be);Oe||(Oe=new Set,V.set(be,Oe)),Oe.add(K.id)}}if(N)for(const K of M){let ie=!1;if(K.qualified_node_name){const de=K.qualified_node_name.replace(/:/g,"/");$.has(de)&&(W.add(de),ie=!0)}if(!ie){const de=V.get(K.node_name);de&&de.forEach(be=>W.add(be))}}const g=new Set;for(const K of _)K.parentNode&&W.has(K.id)&&g.add(K.parentNode);let F;B==="failed"&&W.size===0&&(F=(Q=_.find(K=>!K.parentNode&&K.type!=="startNode"&&K.type!=="endNode"&&K.type!=="groupNode"))==null?void 0:Q.id);let U;if(B==="completed"){const K=(se=_.find(ie=>!ie.parentNode&&ie.type!=="startNode"&&ie.type!=="endNode"&&ie.type!=="groupNode"))==null?void 0:se.id;K&&!W.has(K)&&(U=K)}return _.map(K=>{var de;let ie;return K.id===F?ie="failed":K.id===U||W.has(K.id)?ie="completed":K.type==="startNode"?(!K.parentNode&&N||K.parentNode&&g.has(K.parentNode))&&(ie="completed"):K.type==="endNode"?!K.parentNode&&R?ie=B==="failed"?"failed":"completed":K.parentNode&&g.has(K.parentNode)&&(ie="completed"):K.type==="groupNode"&&g.has(K.id)&&(ie="completed"),ie!==((de=K.data)==null?void 0:de.status)?{...K,data:{...K.data,status:ie}}:K})})},[M,B,x,o]),p?a.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:"Loading graph..."}):f?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",style:{color:"var(--text-muted)"},children:[a.jsxs("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("rect",{x:"38",y:"10",width:"44",height:"24",rx:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.4"}),a.jsx("line",{x1:"60",y1:"34",x2:"60",y2:"46",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),a.jsx("rect",{x:"12",y:"46",width:"44",height:"24",rx:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),a.jsx("rect",{x:"64",y:"46",width:"44",height:"24",rx:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),a.jsx("line",{x1:"60",y1:"46",x2:"34",y2:"46",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),a.jsx("line",{x1:"60",y1:"46",x2:"86",y2:"46",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),a.jsx("line",{x1:"34",y1:"70",x2:"34",y2:"82",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),a.jsx("line",{x1:"86",y1:"70",x2:"86",y2:"82",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),a.jsx("line",{x1:"34",y1:"82",x2:"60",y2:"82",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),a.jsx("line",{x1:"86",y1:"82",x2:"60",y2:"82",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),a.jsx("line",{x1:"60",y1:"82",x2:"60",y2:"86",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),a.jsx("rect",{x:"38",y:"86",width:"44",height:"24",rx:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.4"})]}),a.jsx("span",{className:"text-xs",children:"No graph schema available"})]}):a.jsxs("div",{ref:j,className:"h-full graph-panel",children:[a.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); } - } - `}),a.jsxs(Ol,{nodes:s,edges:u,onNodesChange:l,onEdgesChange:d,nodeTypes:Fc,edgeTypes:zc,onInit:_=>{E.current=_},onNodeClick:O,fitView:!0,proOptions:{hideAttribution:!0},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,children:[a.jsx(Ll,{color:"var(--bg-tertiary)",gap:16}),a.jsx(jl,{showInteractive:!1}),a.jsx(Dl,{position:"top-right",children:a.jsxs("button",{onClick:w,title:k?"Remove all breakpoints":"Set breakpoints on all nodes",style:{background:"var(--bg-secondary)",color:k?"var(--error)":"var(--text-muted)",border:`1px solid ${k?"var(--error)":"var(--node-border)"}`,borderRadius:6,padding:"4px 10px",fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",gap:4},children:[a.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:k?"var(--error)":"var(--node-border)"}}),k?"Clear all":"Break all"]})}),a.jsx(Pl,{nodeColor:_=>{var R;if(_.type==="groupNode")return"var(--bg-tertiary)";const N=(R=_.data)==null?void 0:R.status;return N==="completed"?"var(--success)":N==="running"?"var(--warning)":N==="failed"?"var(--error)":"var(--node-border)"},nodeStrokeWidth:0,style:{background:"var(--bg-secondary)",width:120,height:80}})]})]})}const $t="__setup__";function Vc({entrypoint:e,mode:t,ws:n,onRunCreated:r,isMobile:i}){const[s,o]=S.useState("{}"),[l,u]=S.useState({}),[c,d]=S.useState(!1),[p,m]=S.useState(!0),[f,h]=S.useState(null),[x,v]=S.useState(""),[b,E]=S.useState(!0),[A,D]=S.useState(()=>{const R=localStorage.getItem("setupTextareaHeight");return R?parseInt(R,10):140}),L=S.useRef(null),[T,B]=S.useState(()=>{const R=localStorage.getItem("setupPanelWidth");return R?parseInt(R,10):380}),O=t==="run";S.useEffect(()=>{m(!0),h(null),Zl(e).then(R=>{u(R.mock_input),o(JSON.stringify(R.mock_input,null,2))}).catch(R=>{console.error("Failed to load mock input:",R);const W=R.detail||{};h(W.message||`Failed to load schema for "${e}"`),o("{}")}).finally(()=>m(!1))},[e]),S.useEffect(()=>{Ee.getState().clearBreakpoints($t)},[]);const k=async()=>{let R;try{R=JSON.parse(s)}catch{alert("Invalid JSON input");return}d(!0);try{const W=Ee.getState().breakpoints[$t]??{},$=Object.keys(W),V=await Mi(e,R,t,$);Ee.getState().clearBreakpoints($t),Ee.getState().upsertRun(V),r(V.id)}catch(W){console.error("Failed to create run:",W)}finally{d(!1)}},w=async()=>{const R=x.trim();if(R){d(!0);try{const W=Ee.getState().breakpoints[$t]??{},$=Object.keys(W),V=await Mi(e,l,"chat",$);Ee.getState().clearBreakpoints($t),Ee.getState().upsertRun(V),Ee.getState().addLocalChatMessage(V.id,{message_id:`local-${Date.now()}`,role:"user",content:R}),n.sendChatMessage(V.id,R),r(V.id)}catch(W){console.error("Failed to create chat run:",W)}finally{d(!1)}}};S.useEffect(()=>{try{JSON.parse(s),E(!0)}catch{E(!1)}},[s]);const M=S.useCallback(R=>{R.preventDefault();const W="touches"in R?R.touches[0].clientY:R.clientY,$=A,V=F=>{const U="touches"in F?F.touches[0].clientY:F.clientY,y=Math.max(60,$+(W-U));D(y)},g=()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",g),document.removeEventListener("touchmove",V),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",V),document.addEventListener("mouseup",g),document.addEventListener("touchmove",V,{passive:!1}),document.addEventListener("touchend",g)},[A]),I=S.useCallback(R=>{R.preventDefault();const W="touches"in R?R.touches[0].clientX:R.clientX,$=T,V=F=>{const U=L.current;if(!U)return;const y="touches"in F?F.touches[0].clientX:F.clientX,Q=U.clientWidth-300,se=Math.max(280,Math.min(Q,$+(W-y)));B(se)},g=()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",g),document.removeEventListener("touchmove",V),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",V),document.addEventListener("mouseup",g),document.addEventListener("touchmove",V,{passive:!1}),document.addEventListener("touchend",g)},[T]),j=O?"Autonomous":"Conversational",_=O?"var(--success)":"var(--accent)",N=a.jsxs("div",{className:"shrink-0 flex flex-col",style:i?{background:"var(--bg-primary)"}:{width:T,background:"var(--bg-primary)"},children:[a.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:[a.jsx("span",{style:{color:_},children:"●"}),j]}),a.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col items-center justify-center gap-4 px-6",children:[a.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:O?a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("polyline",{points:"12 6 12 12 16 14"})]}):a.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"})}),a.jsxs("div",{className:"text-center space-y-1.5",children:[a.jsx("p",{className:"text-sm font-medium",style:{color:"var(--text-secondary)"},children:O?"Ready to execute":"Ready to chat"}),a.jsxs("p",{className:"text-xs leading-relaxed",style:{color:"var(--text-muted)"},children:["Click nodes to set breakpoints",O?a.jsxs(a.Fragment,{children:[",",a.jsx("br",{}),"configure input below, then run"]}):a.jsxs(a.Fragment,{children:[",",a.jsx("br",{}),"then send your first message"]})]})]})]}),O?a.jsxs("div",{className:"flex flex-col",style:{background:"var(--bg-primary)"},children:[!i&&a.jsx("div",{onMouseDown:M,onTouchStart:M,className:"shrink-0 drag-handle-row"}),a.jsxs("div",{className:"px-4 py-3",children:[f?a.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}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:["Input",p&&a.jsx("span",{className:"ml-2 font-normal",children:"Loading..."})]}),a.jsx("textarea",{value:s,onChange:R=>o(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:i?120:A,background:"var(--bg-secondary)",border:`1px solid ${b?"var(--border)":"#b91c1c"}`,color:"var(--text-primary)"}})]}),a.jsx("button",{onClick:k,disabled:c||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=>{c||(R.currentTarget.style.background=`color-mix(in srgb, ${_} 10%, transparent)`)},onMouseLeave:R=>{R.currentTarget.style.background="transparent"},children:c?"Starting...":a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",children:a.jsx("polygon",{points:"5,3 19,12 5,21"})}),"Execute"]})})]})]}):a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-t",style:{borderColor:"var(--border)"},children:[a.jsx("input",{value:x,onChange:R=>v(R.target.value),onKeyDown:R=>{R.key==="Enter"&&!R.shiftKey&&(R.preventDefault(),w())},disabled:c||p,placeholder:c?"Starting...":"Message...",className:"flex-1 bg-transparent text-sm py-1 disabled:opacity-40 placeholder:text-[var(--text-muted)]",style:{color:"var(--text-primary)"}}),a.jsx("button",{onClick:w,disabled:c||p||!x.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:!c&&x.trim()?"var(--accent)":"var(--text-muted)",background:"transparent"},onMouseEnter:R=>{!c&&x.trim()&&(R.currentTarget.style.background="color-mix(in srgb, var(--accent) 10%, transparent)")},onMouseLeave:R=>{R.currentTarget.style.background="transparent"},children:"Send"})]})]});return i?a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsx("div",{className:"shrink-0",style:{height:"40vh"},children:a.jsx(Un,{entrypoint:e,traces:[],runId:$t})}),a.jsx("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:N})]}):a.jsxs("div",{ref:L,className:"flex h-full",children:[a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx(Un,{entrypoint:e,traces:[],runId:$t})}),a.jsx("div",{onMouseDown:I,onTouchStart:I,className:"shrink-0 drag-handle-col"}),N]})}const Yc={key:"var(--info)",string:"var(--success)",number:"var(--warning)",boolean:"var(--accent)",null:"var(--accent)",punctuation:"var(--text-muted)"};function Xc(e){const t=[],n=/("(?:[^"\\]|\\.)*")\s*:|("(?:[^"\\]|\\.)*")|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)\b|(true|false)\b|(null)\b|([{}[\]:,])/g;let r=0,i;for(;(i=n.exec(e))!==null;){if(i.index>r&&t.push({type:"punctuation",text:e.slice(r,i.index)}),i[1]!==void 0){t.push({type:"key",text:i[1]});const s=e.indexOf(":",i.index+i[1].length);s!==-1&&(s>i.index+i[1].length&&t.push({type:"punctuation",text:e.slice(i.index+i[1].length,s)}),t.push({type:"punctuation",text:":"}),n.lastIndex=s+1)}else i[2]!==void 0?t.push({type:"string",text:i[2]}):i[3]!==void 0?t.push({type:"number",text:i[3]}):i[4]!==void 0?t.push({type:"boolean",text:i[4]}):i[5]!==void 0?t.push({type:"null",text:i[5]}):i[6]!==void 0&&t.push({type:"punctuation",text:i[6]});r=n.lastIndex}return rXc(e),[e]);return a.jsx("pre",{className:t,style:n,children:r.map((i,s)=>a.jsx("span",{style:{color:Yc[i.type]},children:i.text},s))})}const Zc={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"}},Jc={color:"var(--text-muted)",label:"Unknown"};function Qc(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 Wi=200;function eu(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 tu({value:e}){const[t,n]=S.useState(!1),r=eu(e),i=S.useMemo(()=>Qc(e),[e]),s=i!==null,o=i??r,l=o.length>Wi||o.includes(` -`),u=S.useCallback(()=>n(c=>!c),[]);return l?a.jsxs("div",{children:[t?s?a.jsx(ot,{json:o,className:"font-mono text-[11px] whitespace-pre-wrap break-all",style:{}}):a.jsx("pre",{className:"font-mono text-[11px] whitespace-pre-wrap break-all",style:{color:"var(--text-primary)"},children:o}):a.jsxs("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:[o.slice(0,Wi),"..."]}),a.jsx("button",{onClick:u,className:"text-[11px] cursor-pointer ml-1 px-1",style:{color:"var(--info)"},children:t?"[less]":"[more]"})]}):s?a.jsx(ot,{json:o,className:"font-mono text-[11px] break-all whitespace-pre-wrap",style:{}}):a.jsx("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:o})}function nu({span:e}){const[t,n]=S.useState(!0),[r,i]=S.useState(!1),[s,o]=S.useState("table"),[l,u]=S.useState(!1),c=Zc[e.status.toLowerCase()]??{...Jc,label:e.status},d=S.useMemo(()=>JSON.stringify(e,null,2),[e]),p=S.useCallback(()=>{navigator.clipboard.writeText(d).then(()=>{u(!0),setTimeout(()=>u(!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 a.jsxs("div",{className:"flex flex-col h-full text-xs leading-normal",children:[a.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:[a.jsx("button",{onClick:()=>o("table"),className:"px-2.5 h-6 text-[11px] font-semibold rounded transition-colors cursor-pointer inline-flex items-center",style:{color:s==="table"?"var(--accent)":"var(--text-muted)",background:s==="table"?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},onMouseEnter:h=>{s!=="table"&&(h.currentTarget.style.color="var(--text-primary)")},onMouseLeave:h=>{s!=="table"&&(h.currentTarget.style.color="var(--text-muted)")},children:"Table"}),a.jsx("button",{onClick:()=>o("json"),className:"px-2.5 h-6 text-[11px] font-semibold rounded transition-colors cursor-pointer inline-flex items-center",style:{color:s==="json"?"var(--accent)":"var(--text-muted)",background:s==="json"?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},onMouseEnter:h=>{s!=="json"&&(h.currentTarget.style.color="var(--text-primary)")},onMouseLeave:h=>{s!=="json"&&(h.currentTarget.style.color="var(--text-muted)")},children:"JSON"}),a.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, ${c.color} 15%, var(--bg-secondary))`,color:c.color},children:[a.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:c.color}}),c.label]})]}),a.jsx("div",{className:"overflow-y-auto flex-1 p-0.5 pr-0 pt-0 mr-0.5 mt-0.5",children:s==="table"?a.jsxs(a.Fragment,{children:[m.length>0&&a.jsxs(a.Fragment,{children:[a.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(h=>!h),children:[a.jsxs("span",{className:"flex-1",children:["Attributes (",m.length,")"]}),a.jsx("span",{style:{color:"var(--text-muted)",transform:t?"rotate(0deg)":"rotate(-90deg)"},children:"▾"})]}),t&&m.map(([h,x],v)=>a.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:[a.jsx("span",{className:"font-mono font-semibold shrink-0 pt-px truncate text-[11px]",style:{color:"var(--info)",width:"35%"},title:h,children:h}),a.jsx("span",{className:"flex-1 min-w-0",children:a.jsx(tu,{value:x})})]},h))]}),a.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:()=>i(h=>!h),children:[a.jsxs("span",{className:"flex-1",children:["Identifiers (",f.length,")"]}),a.jsx("span",{style:{color:"var(--text-muted)",transform:r?"rotate(0deg)":"rotate(-90deg)"},children:"▾"})]}),r&&f.map((h,x)=>a.jsxs("div",{className:"flex gap-2 px-2 py-1 items-start border-b",style:{borderColor:"var(--border)",background:x%2===0?"var(--bg-primary)":"var(--bg-secondary)"},children:[a.jsx("span",{className:"font-mono font-semibold shrink-0 pt-px truncate text-[11px]",style:{color:"var(--info)",width:"35%"},title:h.label,children:h.label}),a.jsx("span",{className:"flex-1 min-w-0",children:a.jsx("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:h.value})})]},h.label))]}):a.jsxs("div",{className:"relative",children:[a.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:h=>{l||(h.currentTarget.style.color="var(--text-primary)")},onMouseLeave:h=>{h.currentTarget.style.color=l?"var(--success)":"var(--text-muted)"},children:l?"Copied!":"Copy"}),a.jsx(ot,{json:d,className:"font-mono text-[11px] whitespace-pre-wrap p-2",style:{}})]})})]})}function ru(e){const t=[];function n(r,i){t.push({span:r.span,depth:i});for(const s of r.children)n(s,i+1)}for(const r of e)n(r,0);return t}function iu({tree:e,selectedSpan:t,onSelect:n}){const r=S.useMemo(()=>ru(e),[e]),{globalStart:i,totalDuration:s}=S.useMemo(()=>{if(r.length===0)return{globalStart:0,totalDuration:1};let o=1/0,l=-1/0;for(const{span:u}of r){const c=new Date(u.timestamp).getTime();o=Math.min(o,c),l=Math.max(l,c+(u.duration_ms??0))}return{globalStart:o,totalDuration:Math.max(l-o,1)}},[r]);return r.length===0?null:a.jsx(a.Fragment,{children:r.map(({span:o,depth:l})=>{var x;const u=new Date(o.timestamp).getTime()-i,c=o.duration_ms??0,d=u/s*100,p=Math.max(c/s*100,.3),m=Ts[o.status.toLowerCase()]??"var(--text-muted)",f=o.span_id===(t==null?void 0:t.span_id),h=(x=o.attributes)==null?void 0:x["openinference.span.kind"];return a.jsxs("button",{"data-span-id":o.span_id,onClick:()=>n(o),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:[a.jsxs("div",{className:"shrink-0 flex items-center gap-1 overflow-hidden",style:{width:"35%",minWidth:"80px",paddingLeft:`${l*12+4}px`},children:[a.jsx("span",{className:"shrink-0 flex items-center justify-center w-3.5 h-3.5",children:a.jsx(Cs,{kind:h,statusColor:m})}),a.jsx("span",{className:"text-[var(--text-primary)] truncate",children:o.span_name})]}),a.jsx("div",{className:"flex-1 relative h-[14px] mx-1 rounded-sm",style:{background:"var(--bg-secondary)"},children:a.jsx("div",{className:"absolute rounded-sm",style:{left:`${d}%`,width:`${p}%`,top:"2px",bottom:"2px",background:m,opacity:.8,minWidth:"2px"}})}),a.jsx("span",{className:"shrink-0 text-[10px] tabular-nums pr-2",style:{width:"52px",textAlign:"right",color:"var(--text-muted)"},children:As(o.duration_ms)})]},o.span_id)})})}const Ts={started:"var(--info)",running:"var(--warning)",completed:"var(--success)",failed:"var(--error)",error:"var(--error)"};function Cs({kind:e,statusColor:t}){const n=t,r=14,i={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 a.jsx("svg",{...i,children:a.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 a.jsx("svg",{...i,children:a.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 a.jsxs("svg",{...i,children:[a.jsx("rect",{x:"3",y:"5",width:"10",height:"8",rx:"2"}),a.jsx("circle",{cx:"6",cy:"9",r:"1",fill:n,stroke:"none"}),a.jsx("circle",{cx:"10",cy:"9",r:"1",fill:n,stroke:"none"}),a.jsx("path",{d:"M8 2v3"}),a.jsx("path",{d:"M6 2h4"})]});case"CHAIN":return a.jsxs("svg",{...i,children:[a.jsx("path",{d:"M6.5 9.5L9.5 6.5"}),a.jsx("path",{d:"M4.5 8.5l-1 1a2 2 0 0 0 2.83 2.83l1-1"}),a.jsx("path",{d:"M11.5 7.5l1-1a2 2 0 0 0-2.83-2.83l-1 1"})]});case"RETRIEVER":return a.jsxs("svg",{...i,children:[a.jsx("circle",{cx:"7",cy:"7",r:"4"}),a.jsx("path",{d:"M10 10l3.5 3.5"})]});case"EMBEDDING":return a.jsxs("svg",{...i,children:[a.jsx("rect",{x:"2",y:"2",width:"4",height:"4",rx:"0.5"}),a.jsx("rect",{x:"10",y:"2",width:"4",height:"4",rx:"0.5"}),a.jsx("rect",{x:"2",y:"10",width:"4",height:"4",rx:"0.5"}),a.jsx("rect",{x:"10",y:"10",width:"4",height:"4",rx:"0.5"})]});default:return a.jsx("span",{className:"shrink-0 w-2 h-2 rounded-full",style:{background:t}})}}function ou(e){const t=new Map(e.map(o=>[o.span_id,o])),n=new Map;for(const o of e)if(o.parent_span_id){const l=n.get(o.parent_span_id)??[];l.push(o),n.set(o.parent_span_id,l)}const r=e.filter(o=>o.parent_span_id===null||!t.has(o.parent_span_id));function i(o){const l=(n.get(o.span_id)??[]).sort((u,c)=>u.timestamp.localeCompare(c.timestamp));return{span:o,children:l.map(i)}}return r.sort((o,l)=>o.timestamp.localeCompare(l.timestamp)).map(i).flatMap(o=>o.span.span_name==="root"?o.children:[o])}function As(e){return e==null?"":e<1e3?`${e.toFixed(0)}ms`:`${(e/1e3).toFixed(2)}s`}function Ms(e){return e.map(t=>{const{span:n}=t;return t.children.length>0?{name:n.span_name,children:Ms(t.children)}:{name:n.span_name}})}function Ir({traces:e}){const[t,n]=S.useState(null),[r,i]=S.useState(new Set),[s,o]=S.useState(()=>{const O=localStorage.getItem("traceTreeSplitWidth");return O?parseFloat(O):50}),[l,u]=S.useState(!1),[c,d]=S.useState(!1),[p,m]=S.useState(()=>localStorage.getItem("traceViewMode")||"tree"),f=ou(e),h=S.useMemo(()=>JSON.stringify(Ms(f),null,2),[e]),x=S.useCallback(()=>{navigator.clipboard.writeText(h).then(()=>{d(!0),setTimeout(()=>d(!1),1500)})},[h]),v=Ee(O=>O.focusedSpan),b=Ee(O=>O.setFocusedSpan),[E,A]=S.useState(null),D=S.useRef(null),L=S.useCallback(O=>{i(k=>{const w=new Set(k);return w.has(O)?w.delete(O):w.add(O),w})},[]),T=S.useRef(null);S.useEffect(()=>{const O=f.length>0?f[0].span.span_id:null,k=T.current;if(T.current=O,O&&O!==k)n(f[0].span);else if(t===null)f.length>0&&n(f[0].span);else{const w=e.find(M=>M.span_id===t.span_id);w&&w!==t&&n(w)}},[e]),S.useEffect(()=>{if(!v)return;const k=e.filter(w=>w.span_name===v.name).sort((w,M)=>w.timestamp.localeCompare(M.timestamp))[v.index];if(k){n(k),A(k.span_id);const w=new Map(e.map(M=>[M.span_id,M.parent_span_id]));i(M=>{const I=new Set(M);let j=k.parent_span_id;for(;j;)I.delete(j),j=w.get(j)??null;return I})}b(null)},[v,e,b]),S.useEffect(()=>{if(!E)return;const O=E;A(null),requestAnimationFrame(()=>{const k=D.current,w=k==null?void 0:k.querySelector(`[data-span-id="${O}"]`);k&&w&&w.scrollIntoView({block:"center",behavior:"smooth"})})},[E]),S.useEffect(()=>{if(!l)return;const O=w=>{const M=document.querySelector(".trace-tree-container");if(!M)return;const I=M.getBoundingClientRect(),j=(w.clientX-I.left)/I.width*100,_=Math.max(20,Math.min(80,j));o(_),localStorage.setItem("traceTreeSplitWidth",String(_))},k=()=>{u(!1)};return window.addEventListener("mousemove",O),window.addEventListener("mouseup",k),()=>{window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",k)}},[l]);const B=O=>{O.preventDefault(),u(!0)};return a.jsxs("div",{className:"flex h-full trace-tree-container",style:{cursor:l?"col-resize":void 0},children:[a.jsxs("div",{className:"flex flex-col",style:{width:`${s}%`},children:[e.length>0&&a.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:[a.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:O=>{p!=="tree"&&(O.currentTarget.style.color="var(--text-primary)")},onMouseLeave:O=>{p!=="tree"&&(O.currentTarget.style.color="var(--text-muted)")},children:"Tree"}),a.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:O=>{p!=="timeline"&&(O.currentTarget.style.color="var(--text-primary)")},onMouseLeave:O=>{p!=="timeline"&&(O.currentTarget.style.color="var(--text-muted)")},children:"Timeline"}),a.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:O=>{p!=="json"&&(O.currentTarget.style.color="var(--text-primary)")},onMouseLeave:O=>{p!=="json"&&(O.currentTarget.style.color="var(--text-muted)")},children:"JSON"})]}),a.jsx("div",{ref:D,className:"overflow-y-auto flex-1 p-0.5 pr-0 pt-0 mr-0.5 mt-0.5",children:f.length===0?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"No traces yet"})}):p==="tree"?f.map((O,k)=>a.jsx(Rs,{node:O,depth:0,selectedId:(t==null?void 0:t.span_id)??null,onSelect:n,isLast:k===f.length-1,collapsedIds:r,toggleExpanded:L},O.span.span_id)):p==="timeline"?a.jsx(iu,{tree:f,selectedSpan:t,onSelect:n}):a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:x,className:"absolute top-1 right-1 z-10 text-[11px] cursor-pointer px-2 py-1 rounded transition-colors",style:{color:c?"var(--success)":"var(--text-muted)",background:"var(--bg-secondary)",border:"1px solid var(--border)"},onMouseEnter:O=>{c||(O.currentTarget.style.color="var(--text-primary)")},onMouseLeave:O=>{O.currentTarget.style.color=c?"var(--success)":"var(--text-muted)"},children:c?"Copied!":"Copy"}),a.jsx(ot,{json:h,className:"font-mono text-[11px] whitespace-pre-wrap p-2",style:{}})]})})]}),a.jsx("div",{onMouseDown:B,className:"shrink-0 drag-handle-col",style:l?{background:"var(--accent)"}:void 0}),a.jsx("div",{className:"flex-1 overflow-hidden",children:t?a.jsx(nu,{span:t}):a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"Select a span to view details"})})})]})}function Rs({node:e,depth:t,selectedId:n,onSelect:r,isLast:i,collapsedIds:s,toggleExpanded:o}){var x;const{span:l}=e,u=!s.has(l.span_id),c=Ts[l.status.toLowerCase()]??"var(--text-muted)",d=As(l.duration_ms),p=l.span_id===n,m=e.children.length>0,f=t*20,h=(x=l.attributes)==null?void 0:x["openinference.span.kind"];return a.jsxs("div",{className:"relative",children:[t>0&&a.jsx("div",{className:"absolute top-0 z-10 pointer-events-none",style:{left:`${f-10}px`,width:"1px",height:i?"16px":"100%",background:"var(--border)"}}),a.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&&a.jsx("div",{className:"absolute z-10 pointer-events-none",style:{left:`${f-10}px`,top:"50%",width:"10px",height:"1px",background:"var(--border)"}}),m?a.jsx("span",{onClick:v=>{v.stopPropagation(),o(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:a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",style:{transform:u?"rotate(90deg)":"rotate(0deg)"},children:a.jsx("path",{d:"M3 1.5L7 5L3 8.5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})}):a.jsx("span",{className:"shrink-0 w-4"}),a.jsx("span",{className:"shrink-0 flex items-center justify-center w-4 h-4",children:a.jsx(Cs,{kind:h,statusColor:c})}),a.jsx("span",{className:"text-[var(--text-primary)] truncate min-w-0 flex-1",children:l.span_name}),d&&a.jsx("span",{className:"text-[var(--text-muted)] shrink-0 ml-auto pl-2 tabular-nums",children:d})]}),u&&e.children.map((v,b)=>a.jsx(Rs,{node:v,depth:t+1,selectedId:n,onSelect:r,isLast:b===e.children.length-1,collapsedIds:s,toggleExpanded:o},v.span.span_id))]})}const su={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)"}},au={color:"var(--text-muted)",bg:"transparent"};function Ki({logs:e}){const t=S.useRef(null),n=S.useRef(null),[r,i]=S.useState(!1);S.useEffect(()=>{var o;(o=n.current)==null||o.scrollIntoView({behavior:"smooth"})},[e.length]);const s=()=>{const o=t.current;o&&i(o.scrollTop>100)};return e.length===0?a.jsx("div",{className:"h-full flex items-center justify-center",children:a.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"No logs yet"})}):a.jsxs("div",{className:"h-full relative",children:[a.jsxs("div",{ref:t,onScroll:s,className:"h-full overflow-y-auto font-mono text-xs leading-normal",children:[e.map((o,l)=>{const u=new Date(o.timestamp).toLocaleTimeString(void 0,{hour12:!1}),c=o.level.toUpperCase(),d=c.slice(0,4),p=su[c]??au,m=l%2===0;return a.jsxs("div",{className:"flex gap-3 px-3 py-1.5",style:{background:m?"var(--bg-primary)":"var(--bg-secondary)"},children:[a.jsx("span",{className:"text-[var(--text-muted)] shrink-0",children:u}),a.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}),a.jsx("span",{className:"text-[var(--text-primary)] whitespace-pre-wrap break-all",children:o.message})]},l)}),a.jsx("div",{ref:n})]}),r&&a.jsx("button",{onClick:()=>{var o;return(o=t.current)==null?void 0:o.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:a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"18 15 12 9 6 15"})})})]})}const lu={started:{color:"var(--accent)",label:"started"},updated:{color:"var(--info)",label:"updated"},completed:{color:"var(--success)",label:"completed"},faulted:{color:"var(--error)",label:"faulted"}},Gi={color:"var(--text-muted)",label:""};function An({events:e,runStatus:t}){const n=S.useRef(null),r=S.useRef(!0),[i,s]=S.useState(null),o=()=>{const l=n.current;l&&(r.current=l.scrollHeight-l.scrollTop-l.clientHeight<40)};return S.useEffect(()=>{r.current&&n.current&&(n.current.scrollTop=n.current.scrollHeight)}),e.length===0?a.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:a.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:t==="running"?"Waiting for events...":"No events yet"})}):a.jsx("div",{ref:n,onScroll:o,className:"h-full overflow-y-auto font-mono text-xs leading-normal",children:e.map((l,u)=>{const c=new Date(l.timestamp).toLocaleTimeString(void 0,{hour12:!1}),d=l.payload&&Object.keys(l.payload).length>0,p=i===u,m=l.phase?lu[l.phase]??Gi:Gi;return a.jsxs("div",{children:[a.jsxs("div",{onClick:()=>{d&&s(p?null:u)},className:"flex items-center gap-2 px-3 py-1.5",style:{background:u%2===0?"var(--bg-primary)":"var(--bg-secondary)",cursor:d?"pointer":"default"},children:[a.jsx("span",{className:"shrink-0",style:{color:"var(--text-muted)"},children:c}),a.jsx("span",{className:"shrink-0",style:{color:m.color},children:"●"}),a.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:l.node_name}),m.label&&a.jsx("span",{className:"shrink-0 text-[10px]",style:{color:"var(--text-muted)"},children:m.label}),d&&a.jsx("span",{className:"shrink-0 text-[9px] transition-transform",style:{color:"var(--text-muted)",transform:p?"rotate(90deg)":"rotate(0deg)"},children:"▸"})]}),p&&d&&a.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:a.jsx(ot,{json:JSON.stringify(l.payload,null,2),className:"text-[11px] font-mono whitespace-pre-wrap break-words"})})]},u)})})}function _t({title:e,copyText:t,trailing:n,children:r}){const[i,s]=S.useState(!1),o=S.useCallback(()=>{t&&navigator.clipboard.writeText(t).then(()=>{s(!0),setTimeout(()=>s(!1),1500)})},[t]);return a.jsxs("div",{className:"overflow-hidden",style:{border:"1px solid var(--border)"},children:[a.jsxs("div",{className:"px-3 py-2 flex items-center gap-2",style:{background:"var(--bg-secondary)"},children:[a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:e}),n,t&&a.jsx("button",{onClick:o,className:`${n?"":"ml-auto "}text-[10px] cursor-pointer px-1.5 py-0.5 rounded transition-colors`,style:{color:i?"var(--success)":"var(--text-muted)",background:"var(--bg-tertiary)",border:"none"},onMouseEnter:l=>{i||(l.currentTarget.style.color="var(--text-primary)")},onMouseLeave:l=>{l.currentTarget.style.color=i?"var(--success)":"var(--text-muted)"},children:i?"Copied":"Copy"})]}),r]})}function qi({runId:e,status:t,ws:n,breakpointNode:r}){const i=t==="suspended",s=o=>{const l=Ee.getState().breakpoints[e]??{};n.setBreakpoints(e,Object.keys(l)),o==="step"?n.debugStep(e):o==="continue"?n.debugContinue(e):n.debugStop(e)};return a.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:[a.jsx("span",{className:"text-[11px] font-semibold mr-1",style:{color:"var(--text-muted)"},children:"Debug"}),a.jsx(cr,{label:"Step",onClick:()=>s("step"),disabled:!i,color:"var(--info)",active:i}),a.jsx(cr,{label:"Continue",onClick:()=>s("continue"),disabled:!i,color:"var(--success)",active:i}),a.jsx(cr,{label:"Stop",onClick:()=>s("stop"),disabled:!i,color:"var(--error)",active:i}),a.jsx("span",{className:"text-[11px] ml-auto truncate",style:{color:i?"var(--accent)":"var(--text-muted)"},children:i?r?`Paused at ${r}`:"Paused":t})]})}function cr({label:e,onClick:t,disabled:n,color:r,active:i}){return a.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:i?r:"var(--text-muted)",background:i?`color-mix(in srgb, ${r} 10%, transparent)`:"transparent"},onMouseEnter:s=>{n||(s.currentTarget.style.background=`color-mix(in srgb, ${r} 20%, transparent)`)},onMouseLeave:s=>{s.currentTarget.style.background=i?`color-mix(in srgb, ${r} 10%, transparent)`:"transparent"},children:e})}const Vi=S.lazy(()=>Ns(()=>import("./ChatPanel-DAnMwTFj.js"),__vite__mapDeps([2,1,3,4]))),cu=[],uu=[],du=[],pu=[];function fu({run:e,ws:t,isMobile:n}){const r=e.mode==="chat",[i,s]=S.useState(280),[o,l]=S.useState(()=>{const j=localStorage.getItem("chatPanelWidth");return j?parseInt(j,10):380}),[u,c]=S.useState("primary"),[d,p]=S.useState(r?"primary":"traces"),m=S.useRef(null),f=S.useRef(null),h=S.useRef(!1),x=Ee(j=>j.traces[e.id]||cu),v=Ee(j=>j.logs[e.id]||uu),b=Ee(j=>j.chatMessages[e.id]||du),E=Ee(j=>j.stateEvents[e.id]||pu),A=Ee(j=>j.breakpoints[e.id]);S.useEffect(()=>{t.setBreakpoints(e.id,A?Object.keys(A):[])},[e.id]);const D=S.useCallback(j=>{t.setBreakpoints(e.id,j)},[e.id,t]),L=S.useCallback(j=>{j.preventDefault(),h.current=!0;const _="touches"in j?j.touches[0].clientY:j.clientY,N=i,R=$=>{if(!h.current)return;const V=m.current;if(!V)return;const g="touches"in $?$.touches[0].clientY:$.clientY,F=V.clientHeight-100,U=Math.max(80,Math.min(F,N+(g-_)));s(U)},W=()=>{h.current=!1,document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",W),document.removeEventListener("touchmove",R),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",R),document.addEventListener("mouseup",W),document.addEventListener("touchmove",R,{passive:!1}),document.addEventListener("touchend",W)},[i]),T=S.useCallback(j=>{j.preventDefault();const _="touches"in j?j.touches[0].clientX:j.clientX,N=o,R=$=>{const V=f.current;if(!V)return;const g="touches"in $?$.touches[0].clientX:$.clientX,F=V.clientWidth-300,U=Math.max(280,Math.min(F,N+(_-g)));l(U)},W=()=>{document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",W),document.removeEventListener("touchmove",R),document.removeEventListener("touchend",W),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("chatPanelWidth",String(o))};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",R),document.addEventListener("mouseup",W),document.addEventListener("touchmove",R,{passive:!1}),document.addEventListener("touchend",W)},[o]),B=r?"Chat":"Events",O=r?"var(--accent)":"var(--success)",k=j=>j==="primary"?O:j==="events"?"var(--success)":"var(--accent)",w=Ee(j=>j.activeInterrupt[e.id]??null),M=e.status==="running"?a.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"&&w?a.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 j=[{id:"traces",label:"Traces",count:x.length},{id:"primary",label:B},...r?[{id:"events",label:"Events",count:E.length}]:[],{id:"io",label:"I/O"},{id:"logs",label:"Logs",count:v.length}];return a.jsxs("div",{className:"flex flex-col h-full",children:[(e.mode==="debug"||e.status==="suspended"&&!w||A&&Object.keys(A).length>0)&&a.jsx(qi,{runId:e.id,status:e.status,ws:t,breakpointNode:e.breakpoint_node}),a.jsx("div",{className:"shrink-0",style:{height:"40vh"},children:a.jsx(Un,{entrypoint:e.entrypoint,traces:x,runId:e.id,breakpointNode:e.breakpoint_node,breakpointNextNodes:e.breakpoint_next_nodes,onBreakpointChange:D})}),a.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:[j.map(_=>a.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?k(_.id):"var(--text-muted)",background:d===_.id?`color-mix(in srgb, ${k(_.id)} 10%, transparent)`:"transparent"},children:[_.label,_.count!==void 0&&_.count>0&&a.jsx("span",{className:"ml-1 font-normal",style:{color:"var(--text-muted)"},children:_.count})]},_.id)),M]}),a.jsxs("div",{className:"flex-1 overflow-hidden",children:[d==="traces"&&a.jsx(Ir,{traces:x}),d==="primary"&&(r?a.jsx(S.Suspense,{fallback:a.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:a.jsx("span",{className:"text-xs",children:"Loading chat..."})}),children:a.jsx(Vi,{messages:b,runId:e.id,runStatus:e.status,ws:t})}):a.jsx(An,{events:E,runStatus:e.status})),d==="events"&&a.jsx(An,{events:E,runStatus:e.status}),d==="io"&&a.jsx(Yi,{run:e}),d==="logs"&&a.jsx(Ki,{logs:v})]})]})}const I=[{id:"primary",label:B},...r?[{id:"events",label:"Events",count:E.length}]:[],{id:"io",label:"I/O"},{id:"logs",label:"Logs",count:v.length}];return a.jsxs("div",{ref:f,className:"flex h-full",children:[a.jsxs("div",{ref:m,className:"flex flex-col flex-1 min-w-0",children:[(e.mode==="debug"||e.status==="suspended"&&!w||A&&Object.keys(A).length>0)&&a.jsx(qi,{runId:e.id,status:e.status,ws:t,breakpointNode:e.breakpoint_node}),a.jsx("div",{className:"shrink-0 overflow-hidden",style:{height:i},children:a.jsx(Un,{entrypoint:e.entrypoint,traces:x,runId:e.id,breakpointNode:e.breakpoint_node,breakpointNextNodes:e.breakpoint_next_nodes,onBreakpointChange:D})}),a.jsx("div",{onMouseDown:L,onTouchStart:L,className:"shrink-0 drag-handle-row"}),a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(Ir,{traces:x})})]}),a.jsx("div",{onMouseDown:T,onTouchStart:T,className:"shrink-0 drag-handle-col"}),a.jsxs("div",{className:"shrink-0 flex flex-col",style:{width:o,background:"var(--bg-primary)"},children:[a.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:[I.map(j=>a.jsxs("button",{onClick:()=>c(j.id),className:"px-2.5 py-1 h-7 text-xs font-semibold rounded transition-colors cursor-pointer",style:{color:u===j.id?k(j.id):"var(--text-muted)",background:u===j.id?`color-mix(in srgb, ${k(j.id)} 10%, transparent)`:"transparent"},onMouseEnter:_=>{u!==j.id&&(_.currentTarget.style.color="var(--text-primary)")},onMouseLeave:_=>{u!==j.id&&(_.currentTarget.style.color="var(--text-muted)")},children:[j.label,j.count!==void 0&&j.count>0&&a.jsx("span",{className:"ml-1 font-normal",style:{color:"var(--text-muted)"},children:j.count})]},j.id)),M]}),a.jsxs("div",{className:"flex-1 overflow-hidden",children:[u==="primary"&&(r?a.jsx(S.Suspense,{fallback:a.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:a.jsx("span",{className:"text-xs",children:"Loading chat..."})}),children:a.jsx(Vi,{messages:b,runId:e.id,runStatus:e.status,ws:t})}):a.jsx(An,{events:E,runStatus:e.status})),u==="events"&&a.jsx(An,{events:E,runStatus:e.status}),u==="io"&&a.jsx(Yi,{run:e}),u==="logs"&&a.jsx(Ki,{logs:v})]})]})]})}function Yi({run:e}){return a.jsxs("div",{className:"p-2 overflow-y-auto h-full space-y-1.5",children:[a.jsx(_t,{title:"Input",copyText:JSON.stringify(e.input_data,null,2),children:a.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&&a.jsx(_t,{title:"Output",copyText:typeof e.output_data=="string"?e.output_data:JSON.stringify(e.output_data,null,2),children:a.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&&a.jsxs("div",{className:"overflow-hidden",style:{border:"1px solid color-mix(in srgb, var(--error) 40%, var(--border))"},children:[a.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:[a.jsx("span",{children:"Error"}),a.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}),a.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})]}),a.jsxs("div",{className:"px-3 py-2 text-xs leading-normal",children:[a.jsx("div",{className:"font-semibold mb-2",style:{color:"var(--text-primary)"},children:e.error.title}),a.jsx("pre",{className:"whitespace-pre-wrap font-mono text-[11px] max-w-prose",style:{color:"var(--text-secondary)"},children:e.error.detail})]})]})]})}function Xi(){const{reloadPending:e,setReloadPending:t,setEntrypoints:n}=Ee(),[r,i]=S.useState(!1);if(!e)return null;const s=async()=>{i(!0);try{await ec();const o=await ys();n(o.map(l=>l.name)),t(!1)}catch(o){console.error("Reload failed:",o)}finally{i(!1)}};return a.jsxs("div",{className:"fixed top-4 left-1/2 -translate-x-1/2 z-50 flex items-center justify-between px-5 py-2.5 rounded-lg shadow-lg min-w-[400px]",style:{background:"var(--bg-secondary)",border:"1px solid var(--bg-tertiary)"},children:[a.jsx("span",{className:"text-sm",style:{color:"var(--text-secondary)"},children:"Files changed, reload to apply"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:s,disabled:r,className:"px-3 py-1 text-sm font-medium rounded cursor-pointer",style:{background:"var(--accent)",color:"#fff",opacity:r?.6:1},children:r?"Reloading...":"Reload"}),a.jsx("button",{onClick:()=>t(!1),className:"text-sm cursor-pointer px-1",style:{color:"var(--text-muted)",background:"none",border:"none"},children:"✕"})]})]})}let mu=0;const Zi=Ot(e=>({toasts:[],addToast:(t,n)=>{const r=String(++mu);e(s=>({toasts:[...s.toasts,{id:r,type:t,message:n}]})),setTimeout(()=>{e(s=>({toasts:s.toasts.filter(o=>o.id!==r)}))},t==="error"?8e3:5e3)},removeToast:t=>{e(n=>({toasts:n.toasts.filter(r=>r.id!==t)}))}})),Ji={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 Qi(){const e=Zi(n=>n.toasts),t=Zi(n=>n.removeToast);return e.length===0?null:a.jsx("div",{className:"fixed bottom-8 right-4 z-[100] flex flex-col gap-2 pointer-events-none",children:e.map(n=>{const r=Ji[n.type]??Ji.info;return a.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:[a.jsx("span",{className:"flex-1",children:n.message}),a.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:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:[a.jsx("line",{x1:"1",y1:"1",x2:"9",y2:"9"}),a.jsx("line",{x1:"9",y1:"1",x2:"1",y2:"9"})]})})]},n.id)})})}function hu(e){return e===null?"-":`${Math.round(e*100)}%`}function gu(e){if(e===null)return"var(--text-muted)";const t=e*100;return t>=80?"var(--success)":t>=50?"var(--warning)":"var(--error)"}const eo={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 to(){const e=Ae(l=>l.evalSets),t=Ae(l=>l.evalRuns),{evalSetId:n,evalRunId:r,navigate:i}=st(),s=Object.values(e),o=Object.values(t).sort((l,u)=>new Date(u.start_time??0).getTime()-new Date(l.start_time??0).getTime());return a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsx("button",{onClick:()=>i("#/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"}),a.jsx("div",{className:"px-3 pt-3 pb-1 text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"Eval Sets"}),s.map(l=>{const u=n===l.id;return a.jsxs("button",{onClick:()=>i(`#/evals/sets/${l.id}`),className:"w-full text-left px-3 py-1.5 text-xs cursor-pointer transition-colors",style:{background:u?"color-mix(in srgb, var(--accent) 15%, var(--bg-primary))":"transparent",color:u?"var(--text-primary)":"var(--text-secondary)",borderLeft:u?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:c=>{u||(c.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:c=>{u||(c.currentTarget.style.background="transparent")},children:[a.jsx("div",{className:"truncate font-medium",children:l.name}),a.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)}),s.length===0&&a.jsx("p",{className:"text-[11px] px-3 py-2",style:{color:"var(--text-muted)"},children:"No eval sets yet"}),a.jsx("div",{className:"px-3 pt-4 pb-1 text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"History"}),o.map(l=>{const u=r===l.id,c=eo[l.status]??eo.pending;return a.jsx("button",{onClick:()=>i(`#/evals/runs/${l.id}`),className:"w-full text-left px-3 py-1.5 text-xs cursor-pointer transition-colors",style:{background:u?"color-mix(in srgb, var(--accent) 15%, var(--bg-primary))":"transparent",color:u?"var(--text-primary)":"var(--text-secondary)",borderLeft:u?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:d=>{u||(d.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:d=>{u||(d.currentTarget.style.background="transparent")},children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:c.color}}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"truncate font-medium",children:l.eval_set_name}),a.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-muted)"},children:l.start_time?new Date(l.start_time).toLocaleString():c.label})]}),a.jsx("span",{className:"font-mono shrink-0",style:{color:gu(l.overall_score)},children:hu(l.overall_score)})]})},l.id)}),o.length===0&&a.jsx("p",{className:"text-[11px] px-3 py-2",style:{color:"var(--text-muted)"},children:"No eval runs yet"})]})}function no(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 bu({evalSetId:e}){const[t,n]=S.useState(null),[r,i]=S.useState(!0),[s,o]=S.useState(null),[l,u]=S.useState(!1),[c,d]=S.useState("io"),p=Ae(g=>g.evaluators),m=Ae(g=>g.localEvaluators),f=Ae(g=>g.updateEvalSetEvaluators),h=Ae(g=>g.incrementEvalSetCount),x=Ae(g=>g.upsertEvalRun),{navigate:v}=st(),[b,E]=S.useState(!1),[A,D]=S.useState(new Set),[L,T]=S.useState(!1),B=S.useRef(null),[O,k]=S.useState(()=>{const g=localStorage.getItem("evalSetSidebarWidth");return g?parseInt(g,10):320}),[w,M]=S.useState(!1),I=S.useRef(null);S.useEffect(()=>{localStorage.setItem("evalSetSidebarWidth",String(O))},[O]),S.useEffect(()=>{i(!0),o(null),dc(e).then(g=>{n(g),g.items.length>0&&o(g.items[0].name)}).catch(console.error).finally(()=>i(!1))},[e]);const j=async()=>{u(!0);try{const g=await pc(e);x(g),v(`#/evals/runs/${g.id}`)}catch(g){console.error(g)}finally{u(!1)}},_=async g=>{if(t)try{await uc(e,g),n(F=>{if(!F)return F;const U=F.items.filter(y=>y.name!==g);return{...F,items:U,eval_count:U.length}}),h(e,-1),s===g&&o(null)}catch(F){console.error(F)}},N=S.useCallback(()=>{t&&D(new Set(t.evaluator_ids)),E(!0)},[t]),R=g=>{D(F=>{const U=new Set(F);return U.has(g)?U.delete(g):U.add(g),U})},W=async()=>{if(t){T(!0);try{const g=await hc(e,Array.from(A));n(g),f(e,g.evaluator_ids),E(!1)}catch(g){console.error(g)}finally{T(!1)}}};S.useEffect(()=>{if(!b)return;const g=F=>{B.current&&!B.current.contains(F.target)&&E(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[b]);const $=S.useCallback(g=>{g.preventDefault(),M(!0);const F="touches"in g?g.touches[0].clientX:g.clientX,U=O,y=se=>{const K=I.current;if(!K)return;const ie="touches"in se?se.touches[0].clientX:se.clientX,de=K.clientWidth-300,be=Math.max(280,Math.min(de,U+(F-ie)));k(be)},Q=()=>{M(!1),document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",Q),document.removeEventListener("touchmove",y),document.removeEventListener("touchend",Q),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",y),document.addEventListener("mouseup",Q),document.addEventListener("touchmove",y,{passive:!1}),document.addEventListener("touchend",Q)},[O]);if(r)return a.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)] text-sm",children:"Loading..."});if(!t)return a.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)]",children:"Eval set not found"});const V=t.items.find(g=>g.name===s)??null;return a.jsxs("div",{ref:I,className:"flex h-full",children:[a.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[a.jsxs("div",{className:"px-4 h-10 border-b shrink-0 flex items-center gap-4",style:{borderColor:"var(--border)"},children:[a.jsx("h1",{className:"text-base font-semibold",style:{color:"var(--text-primary)"},children:t.name}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-muted)"},children:[t.eval_count," items"]}),a.jsxs("div",{className:"flex gap-1 items-center ml-auto relative",children:[a.jsx("button",{onClick:N,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:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"}),a.jsx("path",{d:"m15 5 4 4"})]})}),t.evaluator_ids.map(g=>{const F=p.find(U=>U.id===g);return a.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)}),b&&a.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:[a.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"}),a.jsx("div",{className:"max-h-48 overflow-y-auto",children:m.length===0?a.jsx("div",{className:"px-3 py-3 text-xs",style:{color:"var(--text-muted)"},children:"No evaluators available"}):m.map(g=>a.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:[a.jsx("input",{type:"checkbox",checked:A.has(g.id),onChange:()=>R(g.id),className:"accent-[var(--accent)]"}),a.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:g.name})]},g.id))}),a.jsx("div",{className:"px-3 py-2 border-t flex justify-end",style:{borderColor:"var(--border)"},children:a.jsx("button",{onClick:W,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"})})]})]}),a.jsxs("button",{onClick:j,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:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",children:a.jsx("polygon",{points:"5,3 19,12 5,21"})}),l?"Running...":"Run"]})]}),a.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:[a.jsx("span",{className:"w-56 shrink-0",children:"Name"}),a.jsx("span",{className:"flex-1 min-w-0",children:"Input"}),a.jsx("span",{className:"w-32 shrink-0 pl-2",children:"Expected Behavior"}),a.jsx("span",{className:"w-32 shrink-0 pl-2",children:"Expected Output"}),a.jsx("span",{className:"w-32 shrink-0 pl-2",children:"Simulation Instr."}),a.jsx("span",{className:"w-8 shrink-0"})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[t.items.map(g=>{const F=g.name===s;return a.jsxs("button",{onClick:()=>o(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:U=>{F||(U.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:U=>{F||(U.currentTarget.style.background="")},children:[a.jsx("span",{className:"w-56 shrink-0 truncate",style:{color:"var(--text-primary)"},children:g.name}),a.jsx("span",{className:"flex-1 min-w-0 truncate font-mono text-[11px]",style:{color:"var(--text-muted)"},children:no(g.inputs)}),a.jsx("span",{className:"w-32 shrink-0 truncate pl-2 text-[11px]",style:{color:"var(--text-muted)"},children:g.expected_behavior||"-"}),a.jsx("span",{className:"w-32 shrink-0 truncate pl-2 font-mono text-[11px]",style:{color:"var(--text-muted)"},children:no(g.expected_output,40)}),a.jsx("span",{className:"w-32 shrink-0 truncate pl-2 text-[11px]",style:{color:"var(--text-muted)"},children:g.simulation_instructions||"-"}),a.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:U=>{U.stopPropagation(),_(g.name)},onKeyDown:U=>{U.key==="Enter"&&(U.stopPropagation(),_(g.name))},style:{color:"var(--text-muted)"},onMouseEnter:U=>{U.currentTarget.style.color="var(--error)"},onMouseLeave:U=>{U.currentTarget.style.color="var(--text-muted)"},title:"Delete item",children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.name)}),t.items.length===0&&a.jsx("div",{className:"flex items-center justify-center py-8 text-[var(--text-muted)] text-xs",children:"No items in this eval set"})]})]}),a.jsx("div",{onMouseDown:$,onTouchStart:$,className:`shrink-0 drag-handle-col${w?"":" transition-all"}`,style:{width:V?3:0,opacity:V?1:0}}),a.jsxs("div",{className:`shrink-0 flex flex-col overflow-hidden${w?"":" transition-[width] duration-200 ease-in-out"}`,style:{width:V?O:0,background:"var(--bg-primary)"},children:[a.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:O},children:["io","evaluators"].map(g=>{const F=c===g,U=g==="io"?"I/O":"Evaluators";return a.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:U},g)})}),a.jsx("div",{className:"flex-1 overflow-hidden",style:{minWidth:O},children:V?c==="io"?a.jsx(xu,{item:V}):a.jsx(yu,{item:V,evaluators:p}):null})]})]})}function xu({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 a.jsxs("div",{className:"p-2 overflow-y-auto h-full space-y-1.5",children:[a.jsx(_t,{title:"Input",copyText:t,children:a.jsx(ot,{json:t,className:"px-3 py-2 text-xs font-mono whitespace-pre-wrap break-words"})}),e.expected_behavior&&a.jsx(_t,{title:"Expected Behavior",copyText:e.expected_behavior,children:a.jsx("div",{className:"px-3 py-2 text-xs leading-relaxed whitespace-pre-wrap",style:{color:"var(--text-secondary)"},children:e.expected_behavior})}),n&&a.jsx(_t,{title:"Expected Output",copyText:n,children:a.jsx(ot,{json:n,className:"px-3 py-2 text-xs font-mono whitespace-pre-wrap break-words"})}),e.simulation_instructions&&a.jsx(_t,{title:"Simulation Instructions",copyText:e.simulation_instructions,children:a.jsx("div",{className:"px-3 py-2 text-xs leading-relaxed whitespace-pre-wrap",style:{color:"var(--text-secondary)"},children:e.simulation_instructions})})]})}function yu({item:e,evaluators:t}){return a.jsx("div",{className:"p-2 overflow-y-auto h-full space-y-1.5",children:e.evaluator_ids.length>0?a.jsx(a.Fragment,{children:e.evaluator_ids.map(n=>{var s;const r=t.find(o=>o.id===n),i=(s=e.evaluation_criterias)==null?void 0:s[n];return a.jsxs("div",{className:"overflow-hidden",style:{border:"1px solid var(--border)"},children:[a.jsxs("div",{className:"px-3 py-2 flex items-center gap-2",style:{background:"var(--bg-secondary)"},children:[a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:(r==null?void 0:r.name)??n}),a.jsx("span",{className:"ml-auto text-[10px]",style:{color:"var(--text-muted)"},children:i?"Custom criteria":"Default criteria"})]}),i&&a.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(i,null,2)})]},n)})}):a.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)] text-xs",children:"No evaluators configured for this item"})})}function en(e){return e===null?"-":`${Math.round(e*100)}%`}function wt(e){if(e===null)return"var(--text-muted)";const t=e*100;return t>=80?"var(--success)":t>=50?"var(--warning)":"var(--error)"}function vu(e,t){if(!e)return"-";const n=new Date(e).getTime(),r=t?new Date(t).getTime():Date.now(),i=Math.round((r-n)/1e3);return i<60?`${i}s`:`${Math.floor(i/60)}m ${i%60}s`}function ro(e){return e.replace(/\s*Evaluator$/i,"")}const io={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 Eu({evalRunId:e,itemName:t}){const[n,r]=S.useState(null),[i,s]=S.useState(!0),{navigate:o}=st(),l=t??null,[u,c]=S.useState(220),d=S.useRef(null),p=S.useRef(!1),[m,f]=S.useState(()=>{const M=localStorage.getItem("evalSidebarWidth");return M?parseInt(M,10):320}),[h,x]=S.useState(!1),v=S.useRef(null);S.useEffect(()=>{localStorage.setItem("evalSidebarWidth",String(m))},[m]);const b=Ae(M=>M.evalRuns[e]),E=Ae(M=>M.evaluators);S.useEffect(()=>{s(!0),Ii(e).then(M=>{if(r(M),!t){const I=M.results.find(j=>j.status==="completed")??M.results[0];I&&o(`#/evals/runs/${e}/${encodeURIComponent(I.name)}`)}}).catch(console.error).finally(()=>s(!1))},[e]),S.useEffect(()=>{((b==null?void 0:b.status)==="completed"||(b==null?void 0:b.status)==="failed")&&Ii(e).then(r).catch(console.error)},[b==null?void 0:b.status,e]),S.useEffect(()=>{if(t||!(n!=null&&n.results))return;const M=n.results.find(I=>I.status==="completed")??n.results[0];M&&o(`#/evals/runs/${e}/${encodeURIComponent(M.name)}`)},[n==null?void 0:n.results]);const A=S.useCallback(M=>{M.preventDefault(),p.current=!0;const I="touches"in M?M.touches[0].clientY:M.clientY,j=u,_=R=>{if(!p.current)return;const W=d.current;if(!W)return;const $="touches"in R?R.touches[0].clientY:R.clientY,V=W.clientHeight-100,g=Math.max(80,Math.min(V,j+($-I)));c(g)},N=()=>{p.current=!1,document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",N),document.removeEventListener("touchmove",_),document.removeEventListener("touchend",N),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",N),document.addEventListener("touchmove",_,{passive:!1}),document.addEventListener("touchend",N)},[u]),D=S.useCallback(M=>{M.preventDefault(),x(!0);const I="touches"in M?M.touches[0].clientX:M.clientX,j=m,_=R=>{const W=v.current;if(!W)return;const $="touches"in R?R.touches[0].clientX:R.clientX,V=W.clientWidth-300,g=Math.max(280,Math.min(V,j+(I-$)));f(g)},N=()=>{x(!1),document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",N),document.removeEventListener("touchmove",_),document.removeEventListener("touchend",N),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",N),document.addEventListener("touchmove",_,{passive:!1}),document.addEventListener("touchend",N)},[m]);if(i)return a.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)] text-sm",children:"Loading..."});if(!n)return a.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)]",children:"Eval run not found"});const L=b??n,T=io[L.status]??io.pending,B=L.status==="running",O=Object.keys(L.evaluator_scores??{}),k=n.results.find(M=>M.name===l)??null,w=((k==null?void 0:k.traces)??[]).map(M=>({...M,run_id:""}));return a.jsxs("div",{ref:v,className:"flex h-full",children:[a.jsxs("div",{ref:d,className:"flex flex-col flex-1 min-w-0",children:[a.jsxs("div",{className:"px-4 h-10 border-b shrink-0 flex items-center gap-4",style:{borderColor:"var(--border)"},children:[a.jsx("h1",{className:"text-base font-semibold truncate min-w-0",style:{color:"var(--text-primary)"},children:L.eval_set_name}),a.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}),a.jsx("span",{className:"text-sm font-bold font-mono",style:{color:wt(L.overall_score)},children:en(L.overall_score)}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-muted)"},children:vu(L.start_time,L.end_time)}),B&&a.jsxs("div",{className:"flex items-center gap-2 max-w-[160px]",children:[a.jsx("div",{className:"flex-1 h-2 rounded-full overflow-hidden",style:{background:"var(--bg-tertiary)"},children:a.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)"}})}),a.jsxs("span",{className:"text-[11px] shrink-0",style:{color:"var(--text-muted)"},children:[L.progress_completed,"/",L.progress_total]})]}),O.length>0&&a.jsx("div",{className:"flex gap-3 ml-auto",children:O.map(M=>{const I=E.find(_=>_.id===M),j=L.evaluator_scores[M];return a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-muted)"},children:ro((I==null?void 0:I.name)??M)}),a.jsx("div",{className:"w-12 h-2 rounded-full overflow-hidden",style:{background:"var(--bg-tertiary)"},children:a.jsx("div",{className:"h-full rounded-full",style:{width:`${j*100}%`,background:wt(j)}})}),a.jsx("span",{className:"text-[11px] font-mono",style:{color:wt(j)},children:en(j)})]},M)})})]}),a.jsxs("div",{className:"shrink-0 overflow-hidden flex flex-col",style:{height:u},children:[a.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:[a.jsx("span",{className:"w-5 shrink-0"}),a.jsx("span",{className:"flex-1 min-w-0",children:"Name"}),a.jsx("span",{className:"w-14 shrink-0 text-right",children:"Score"}),O.map(M=>{const I=E.find(j=>j.id===M);return a.jsx("span",{className:"w-36 shrink-0 text-right truncate pl-2",title:(I==null?void 0:I.name)??M,children:ro((I==null?void 0:I.name)??M)},M)}),a.jsx("span",{className:"w-14 shrink-0 text-right",children:"Time"})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[n.results.map(M=>{const I=M.status==="pending",j=M.status==="failed",_=M.name===l;return a.jsxs("button",{onClick:()=>{o(_?`#/evals/runs/${e}`:`#/evals/runs/${e}/${encodeURIComponent(M.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:I?.5:1},onMouseEnter:N=>{_||(N.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:N=>{_||(N.currentTarget.style.background="")},children:[a.jsx("span",{className:"w-5 shrink-0 flex justify-center",children:a.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:I?"var(--text-muted)":j?"var(--error)":M.overall_score>=.8?"var(--success)":M.overall_score>=.5?"var(--warning)":"var(--error)"}})}),a.jsx("span",{className:"flex-1 min-w-0 truncate",style:{color:"var(--text-primary)"},children:M.name}),a.jsx("span",{className:"w-14 shrink-0 text-right font-mono font-semibold",style:{color:wt(I?null:M.overall_score)},children:I?"-":en(M.overall_score)}),O.map(N=>a.jsx("span",{className:"w-36 shrink-0 text-right font-mono pl-2",style:{color:wt(I?null:M.scores[N]??null)},children:I?"-":en(M.scores[N]??null)},N)),a.jsx("span",{className:"w-14 shrink-0 text-right",style:{color:"var(--text-muted)"},children:M.duration_ms!==null?`${(M.duration_ms/1e3).toFixed(1)}s`:"-"})]},M.name)}),n.results.length===0&&a.jsx("div",{className:"flex items-center justify-center py-8 text-[var(--text-muted)] text-xs",children:B?"Waiting for results...":"No results"})]})]}),a.jsx("div",{onMouseDown:A,onTouchStart:A,className:"shrink-0 drag-handle-row"}),a.jsx("div",{className:"flex-1 overflow-hidden",children:k&&w.length>0?a.jsx(Ir,{traces:w}):a.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)] text-xs",children:(k==null?void 0:k.status)==="pending"?"Pending...":"No traces available"})})]}),a.jsx("div",{onMouseDown:D,onTouchStart:D,className:`shrink-0 drag-handle-col${h?"":" transition-all"}`,style:{width:k?3:0,opacity:k?1:0}}),a.jsx(wu,{width:m,item:k,evaluators:E,isRunning:B,isDragging:h})]})}const ku=[{id:"score",label:"Score"},{id:"io",label:"I/O"},{id:"logs",label:"Logs"}];function wu({width:e,item:t,evaluators:n,isRunning:r,isDragging:i}){const[s,o]=S.useState("score"),l=!!t;return a.jsxs("div",{className:`shrink-0 flex flex-col overflow-hidden${i?"":" transition-[width] duration-200 ease-in-out"}`,style:{width:l?e:0,background:"var(--bg-primary)"},children:[a.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:[ku.map(u=>a.jsx("button",{onClick:()=>o(u.id),className:"px-2.5 py-1 h-7 text-xs font-semibold rounded transition-colors cursor-pointer",style:{color:s===u.id?"var(--accent)":"var(--text-muted)",background:s===u.id?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent",border:"none"},onMouseEnter:c=>{s!==u.id&&(c.currentTarget.style.color="var(--text-primary)")},onMouseLeave:c=>{s!==u.id&&(c.currentTarget.style.color="var(--text-muted)")},children:u.label},u.id)),r&&a.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..."})]}),a.jsx("div",{className:"flex-1 overflow-y-auto",style:{minWidth:e},children:t?t.status==="pending"?a.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)] text-xs",children:"Pending..."}):a.jsxs(a.Fragment,{children:[t.status==="failed"&&a.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:[a.jsxs("div",{className:"flex items-center gap-2 font-semibold",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[a.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),a.jsx("path",{d:"M8 4.5v4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),a.jsx("circle",{cx:"8",cy:"11",r:"0.75",fill:"currentColor"})]}),a.jsx("span",{children:"Evaluator error"})]}),t.error&&a.jsx("div",{className:"mt-1 pl-[22px] text-[11px] opacity-80 break-words",style:{color:"var(--text-secondary)"},children:t.error})]}),s==="score"?a.jsx(_u,{item:t,evaluators:n}):s==="io"?a.jsx(Nu,{item:t}):a.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)] text-xs",children:"Logs coming soon"})]}):null})]})}function _u({item:e,evaluators:t}){const n=Object.keys(e.scores);return a.jsxs("div",{className:"p-2 overflow-y-auto h-full space-y-1.5",children:[a.jsx("div",{className:"overflow-hidden",style:{border:"1px solid var(--border)"},children:a.jsxs("div",{className:"px-3 py-2 flex items-center gap-2",style:{background:"var(--bg-secondary)"},children:[a.jsx("span",{className:"truncate text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Overall"}),a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a.jsx("div",{className:"w-24 h-2.5 rounded-full overflow-hidden",style:{background:"var(--bg-tertiary)"},children:a.jsx("div",{className:"h-full rounded-full",style:{width:`${e.overall_score*100}%`,background:wt(e.overall_score)}})}),a.jsx("span",{className:"text-xs font-mono font-bold shrink-0 w-10 text-right",style:{color:wt(e.overall_score)},children:en(e.overall_score)})]})]})}),e.status==="failed"&&n.length===0&&a.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 i=t.find(l=>l.id===r),s=e.scores[r],o=e.justifications[r];return a.jsxs("div",{className:"overflow-hidden",style:{border:"1px solid var(--border)"},children:[a.jsxs("div",{className:"px-3 py-2 flex items-center gap-2",style:{background:"var(--bg-secondary)"},children:[a.jsx("span",{className:"truncate text-[11px] font-semibold",style:{color:"var(--text-primary)"},title:(i==null?void 0:i.name)??r,children:(i==null?void 0:i.name)??r}),a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a.jsx("div",{className:"w-24 h-2.5 rounded-full overflow-hidden",style:{background:"var(--bg-tertiary)"},children:a.jsx("div",{className:"h-full rounded-full",style:{width:`${s*100}%`,background:wt(s)}})}),a.jsx("span",{className:"text-xs font-mono font-bold shrink-0 w-10 text-right",style:{color:wt(s)},children:en(s)})]})]}),o&&a.jsx(Tu,{text:o})]},r)})]})}function Nu({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 a.jsxs("div",{className:"p-2 overflow-y-auto h-full space-y-1.5",children:[a.jsx(_t,{title:"Input",copyText:t,children:a.jsx(ot,{json:t,className:"px-3 py-2 text-xs font-mono whitespace-pre-wrap break-words"})}),r&&a.jsx(_t,{title:"Expected Output",copyText:r,children:a.jsx(ot,{json:r,className:"px-3 py-2 text-xs font-mono whitespace-pre-wrap break-words"})}),a.jsx(_t,{title:"Output",copyText:n,trailing:e.duration_ms!==null?a.jsxs("span",{className:"ml-auto text-[10px]",style:{color:"var(--text-muted)"},children:[(e.duration_ms/1e3).toFixed(2),"s"]}):void 0,children:a.jsx(ot,{json:n,className:"px-3 py-2 text-xs font-mono whitespace-pre-wrap break-words"})})]})}function Su(e){var i;const t=e.match(/expected="(.+?)"\s+actual="(.+?)"(.*)/s);if(!t)return null;const n={},r=((i=t[3])==null?void 0:i.trim())??"";if(r)for(const s of r.match(/(\w+)=([\S]+)/g)??[]){const o=s.indexOf("=");n[s.slice(0,o)]=s.slice(o+1)}return{expected:t[1],actual:t[2],meta:n}}function oo(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 Tu({text:e}){const t=Su(e);if(!t)return a.jsx("div",{className:"px-3 py-2 border-t",style:{borderColor:"var(--border)"},children:a.jsx("div",{className:"text-xs leading-relaxed",style:{color:"var(--text-secondary)"},children:e})});const n=oo(t.expected),r=oo(t.actual),i=n===r;return a.jsxs("div",{className:"border-t",style:{borderColor:"var(--border)"},children:[a.jsxs("div",{className:"grid grid-cols-2 gap-0",children:[a.jsxs("div",{className:"px-3 py-2 border-r",style:{borderColor:"var(--border)"},children:[a.jsx("div",{className:"text-[10px] font-semibold mb-1",style:{color:"var(--text-muted)"},children:"Expected"}),a.jsx("pre",{className:"text-[11px] font-mono whitespace-pre-wrap break-words",style:{color:"var(--text-secondary)"},children:n})]}),a.jsxs("div",{className:"px-3 py-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[a.jsx("span",{className:"text-[10px] font-semibold",style:{color:"var(--text-muted)"},children:"Actual"}),a.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:i?"var(--success)":"var(--error)"}})]}),a.jsx("pre",{className:"text-[11px] font-mono whitespace-pre-wrap break-words",style:{color:i?"var(--success)":"var(--error)"},children:r})]})]}),Object.keys(t.meta).length>0&&a.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(([s,o])=>a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-muted)"},children:[a.jsx("span",{className:"font-medium",children:s.replace(/_/g," ")})," ",a.jsx("span",{className:"font-mono",children:o})]},s))})]})}const so={deterministic:"var(--success)",llm:"#a78bfa",tool:"var(--info)"};function ao(){const e=Ae(f=>f.localEvaluators),t=Ae(f=>f.addEvalSet),{navigate:n}=st(),[r,i]=S.useState(""),[s,o]=S.useState(new Set),[l,u]=S.useState(null),[c,d]=S.useState(!1),p=f=>{o(h=>{const x=new Set(h);return x.has(f)?x.delete(f):x.add(f),x})},m=async()=>{if(r.trim()){u(null),d(!0);try{const f=await lc({name:r.trim(),evaluator_refs:Array.from(s)});t(f),n(`#/evals/sets/${f.id}`)}catch(f){u(f.detail||f.message||"Failed to create eval set")}finally{d(!1)}}};return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsxs("div",{className:"w-full max-w-xl px-6",children:[a.jsxs("div",{className:"mb-8 text-center",children:[a.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:"var(--accent)"}}),a.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--text-muted)"},children:"New Eval Set"})]}),a.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:"Create an evaluation set with a name and evaluators"})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Name"}),a.jsx("input",{type:"text",value:r,onChange:f=>i(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()}})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Evaluators"}),e.length===0?a.jsxs("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:["No evaluators configured."," ",a.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"})]}):a.jsx("div",{className:"rounded-md border overflow-hidden",style:{borderColor:"var(--border)",background:"var(--bg-secondary)"},children:e.map(f=>a.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:h=>{h.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:h=>{h.currentTarget.style.background="transparent"},children:[a.jsx("input",{type:"checkbox",checked:s.has(f.id),onChange:()=>p(f.id),className:"accent-[var(--accent)]"}),a.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:f.name}),a.jsx("span",{className:"text-[11px] font-medium px-1.5 py-0.5 rounded",style:{background:`color-mix(in srgb, ${so[f.type]??"var(--text-muted)"} 15%, transparent)`,color:so[f.type]??"var(--text-muted)"},children:f.type})]},f.id))})]}),l&&a.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}),a.jsx("button",{onClick:m,disabled:!r.trim()||c,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:c?"Creating...":"Create Eval Set"})]})})}const Cu=[{type:"deterministic",label:"Deterministic",badgeColor:"var(--success)"},{type:"llm",label:"LLM Judge",badgeColor:"#a78bfa"},{type:"tool",label:"Tool-Based",badgeColor:"var(--info)"}];function lo(){const e=Ae(s=>s.localEvaluators),{evaluatorFilter:t,evaluatorCreateType:n,navigate:r}=st(),i=!t&&!n;return a.jsxs(a.Fragment,{children:[a.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:s=>{s.currentTarget.style.color="var(--text-primary)",s.currentTarget.style.borderColor="var(--text-muted)"},onMouseLeave:s=>{s.currentTarget.style.color="var(--text-secondary)",s.currentTarget.style.borderColor=""},children:"+ New Evaluator"}),a.jsx("div",{className:"px-3 pt-3 pb-1 text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"Categories"}),a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.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:i?"color-mix(in srgb, var(--accent) 15%, var(--bg-primary))":"transparent",color:i?"var(--text-primary)":"var(--text-secondary)",borderLeft:i?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:s=>{i||(s.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:s=>{i||(s.currentTarget.style.background="transparent")},children:[a.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:"var(--text-muted)"}}),a.jsx("span",{className:"flex-1 truncate",children:"All"}),e.length>0&&a.jsx("span",{className:"text-[10px] px-1.5 rounded-full",style:{background:"var(--bg-tertiary)",color:"var(--text-muted)"},children:e.length})]}),Cu.map(s=>{const o=e.filter(u=>u.type===s.type).length,l=t===s.type;return a.jsxs("button",{onClick:()=>r(l?"#/evaluators":`#/evaluators/category/${s.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:u=>{l||(u.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:u=>{l||(u.currentTarget.style.background="transparent")},children:[a.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:s.badgeColor}}),a.jsx("span",{className:"flex-1 truncate",children:s.label}),o>0&&a.jsx("span",{className:"text-[10px] px-1.5 rounded-full",style:{background:"var(--bg-tertiary)",color:"var(--text-muted)"},children:o})]},s.type)})]})]})}const co={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)"}},Or={deterministic:"Deterministic",llm:"LLM Judge",tool:"Tool-Based"},pn={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 Is(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 ur={"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 Au(e){for(const[t,n]of Object.entries(pn))if(n.some(r=>r.id===e))return t;return"deterministic"}function Mu({evaluatorId:e,evaluatorFilter:t}){const n=Ae(E=>E.localEvaluators),r=Ae(E=>E.setLocalEvaluators),i=Ae(E=>E.upsertLocalEvaluator),s=Ae(E=>E.evaluators),{navigate:o}=st(),l=e?n.find(E=>E.id===e)??null:null,u=!!l,c=t?n.filter(E=>E.type===t):n,[d,p]=S.useState(()=>{const E=localStorage.getItem("evaluatorSidebarWidth");return E?parseInt(E,10):320}),[m,f]=S.useState(!1),h=S.useRef(null);S.useEffect(()=>{localStorage.setItem("evaluatorSidebarWidth",String(d))},[d]),S.useEffect(()=>{Zr().then(r).catch(console.error)},[r]);const x=S.useCallback(E=>{E.preventDefault(),f(!0);const A="touches"in E?E.touches[0].clientX:E.clientX,D=d,L=B=>{const O=h.current;if(!O)return;const k="touches"in B?B.touches[0].clientX:B.clientX,w=O.clientWidth-300,M=Math.max(280,Math.min(w,D+(A-k)));p(M)},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=E=>{i(E)},b=()=>{o("#/evaluators")};return a.jsxs("div",{ref:h,className:"flex h-full",children:[a.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[a.jsxs("div",{className:"px-4 h-10 border-b shrink-0 flex items-center gap-4",style:{borderColor:"var(--border)"},children:[a.jsx("h1",{className:"text-base font-semibold",style:{color:"var(--text-primary)"},children:"Evaluators"}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-muted)"},children:[c.length,t?` / ${n.length}`:""," configured"]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:c.length===0?a.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."}):a.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(320px, 1fr))"},children:c.map(E=>a.jsx(Ru,{evaluator:E,evaluators:s,selected:E.id===e,onClick:()=>o(E.id===e?"#/evaluators":`#/evaluators/${encodeURIComponent(E.id)}`)},E.id))})})]}),a.jsx("div",{onMouseDown:x,onTouchStart:x,className:`shrink-0 drag-handle-col${m?"":" transition-all"}`,style:{width:u?3:0,opacity:u?1:0}}),a.jsxs("div",{className:`shrink-0 flex flex-col overflow-hidden${m?"":" transition-[width] duration-200 ease-in-out"}`,style:{width:u?d:0,background:"var(--bg-primary)"},children:[a.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:[a.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"}),a.jsx("button",{onClick:b,"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:E=>{E.currentTarget.style.color="var(--text-primary)"},onMouseLeave:E=>{E.currentTarget.style.color="var(--text-muted)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsx("div",{className:"flex-1 overflow-hidden",style:{minWidth:d},children:l&&a.jsx(Iu,{evaluator:l,onUpdated:v})})]})]})}function Ru({evaluator:e,evaluators:t,selected:n,onClick:r}){const i=co[e.type]??co.deterministic,s=t.find(l=>l.id===e.evaluator_type_id),o=e.evaluator_type_id.startsWith("file://");return a.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:[a.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--text-primary)"},children:e.name}),e.description&&a.jsx("div",{className:"text-xs leading-relaxed mt-2",style:{color:"var(--text-secondary)"},children:e.description}),a.jsxs("div",{className:"flex flex-wrap gap-1.5 mt-auto pt-3",children:[a.jsxs("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium",style:{color:i.color,background:i.bg},children:["Category: ",i.label]}),a.jsxs("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium",style:{background:"var(--bg-tertiary)",color:"var(--text-secondary)"},children:["Type: ",o?"Custom":(s==null?void 0:s.name)??e.evaluator_type_id]}),a.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 Iu({evaluator:e,onUpdated:t}){var L,T;const n=Au(e.evaluator_type_id),r=pn[n]??[],[i,s]=S.useState(e.description),[o,l]=S.useState(e.evaluator_type_id),[u,c]=S.useState(((L=e.config)==null?void 0:L.targetOutputKey)??"*"),[d,p]=S.useState(((T=e.config)==null?void 0:T.prompt)??""),[m,f]=S.useState(!1),[h,x]=S.useState(null),[v,b]=S.useState(!1);S.useEffect(()=>{var B,O;s(e.description),l(e.evaluator_type_id),c(((B=e.config)==null?void 0:B.targetOutputKey)??"*"),p(((O=e.config)==null?void 0:O.prompt)??""),x(null),b(!1)},[e.id]);const E=Is(o),A=async()=>{f(!0),x(null),b(!1);try{const B={};E.targetOutputKey&&(B.targetOutputKey=u),E.prompt&&d.trim()&&(B.prompt=d);const O=await gc(e.id,{description:i.trim(),evaluator_type_id:o,config:B});t(O),b(!0),setTimeout(()=>b(!1),2e3)}catch(B){const O=B==null?void 0:B.detail;x(O??"Failed to update evaluator")}finally{f(!1)}},D={background:"var(--bg-secondary)",color:"var(--text-primary)",border:"1px solid var(--border)"};return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"p-4 overflow-y-auto flex-1 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[11px] font-medium block mb-1",style:{color:"var(--text-muted)"},children:"Name"}),a.jsx("div",{className:"px-3 py-2 rounded-lg text-xs",style:{background:"var(--bg-tertiary)",color:"var(--text-secondary)"},children:e.name})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[11px] font-medium block mb-1",style:{color:"var(--text-muted)"},children:"Category"}),a.jsx("div",{className:"px-3 py-2 rounded-lg text-xs",style:{background:"var(--bg-tertiary)",color:"var(--text-secondary)"},children:Or[n]??n})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[11px] font-medium block mb-1",style:{color:"var(--text-muted)"},children:"Type"}),a.jsx("select",{value:o,onChange:B=>l(B.target.value),className:"w-full px-3 py-2 rounded-lg text-xs outline-none cursor-pointer",style:D,children:r.map(B=>a.jsx("option",{value:B.id,children:B.name},B.id))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[11px] font-medium block mb-1",style:{color:"var(--text-muted)"},children:"Description"}),a.jsx("textarea",{value:i,onChange:B=>s(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:D})]}),E.targetOutputKey&&a.jsxs("div",{children:[a.jsx("label",{className:"text-[11px] font-medium block mb-1",style:{color:"var(--text-muted)"},children:"Target Output Key"}),a.jsx("input",{type:"text",value:u,onChange:B=>c(B.target.value),placeholder:"*",className:"w-full px-3 py-2 rounded-lg text-xs outline-none",style:D}),a.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-muted)"},children:"Use * for entire output or a specific key name"})]}),E.prompt&&a.jsxs("div",{children:[a.jsx("label",{className:"text-[11px] font-medium block mb-1",style:{color:"var(--text-muted)"},children:"Prompt"}),a.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:D})]})]}),a.jsxs("div",{className:"shrink-0 p-4 space-y-2",children:[h&&a.jsx("div",{className:"text-xs px-3 py-2 rounded-lg",style:{background:"rgba(239,68,68,0.1)",color:"var(--error)"},children:h}),v&&a.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"}),a.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 Ou=["deterministic","llm","tool"];function Lu({category:e}){var _;const t=Ae(N=>N.addLocalEvaluator),{navigate:n}=st(),r=e!=="any",[i,s]=S.useState(r?e:"deterministic"),o=pn[i]??[],[l,u]=S.useState(""),[c,d]=S.useState(""),[p,m]=S.useState(((_=o[0])==null?void 0:_.id)??""),[f,h]=S.useState("*"),[x,v]=S.useState(""),[b,E]=S.useState(!1),[A,D]=S.useState(null),[L,T]=S.useState(!1),[B,O]=S.useState(!1);S.useEffect(()=>{var V;const N=r?e:"deterministic";s(N);const W=((V=(pn[N]??[])[0])==null?void 0:V.id)??"",$=ur[W];u(""),d(($==null?void 0:$.description)??""),m(W),h("*"),v(($==null?void 0:$.prompt)??""),D(null),T(!1),O(!1)},[e,r]);const k=N=>{var V;s(N);const W=((V=(pn[N]??[])[0])==null?void 0:V.id)??"",$=ur[W];m(W),L||d(($==null?void 0:$.description)??""),B||v(($==null?void 0:$.prompt)??"")},w=N=>{m(N);const R=ur[N];R&&(L||d(R.description),B||v(R.prompt))},M=Is(p),I=async()=>{if(!l.trim()){D("Name is required");return}E(!0),D(null);try{const N={};M.targetOutputKey&&(N.targetOutputKey=f),M.prompt&&x.trim()&&(N.prompt=x);const R=await mc({name:l.trim(),description:c.trim(),evaluator_type_id:p,config:N});t(R),n("#/evaluators")}catch(N){const R=N==null?void 0:N.detail;D(R??"Failed to create evaluator")}finally{E(!1)}},j={background:"var(--bg-secondary)",border:"1px solid var(--border)",color:"var(--text-primary)"};return a.jsx("div",{className:"h-full overflow-y-auto",children:a.jsx("div",{className:"flex items-center justify-center min-h-full py-8",children:a.jsxs("div",{className:"w-full max-w-xl px-6",children:[a.jsxs("div",{className:"mb-8 text-center",children:[a.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[a.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:"var(--accent)"}}),a.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--text-muted)"},children:"New Evaluator"})]}),a.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:"Create an evaluator to score agent outputs"})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Name"}),a.jsx("input",{type:"text",value:l,onChange:N=>u(N.target.value),placeholder:"e.g. MyEvaluator",className:"w-full rounded-md px-3 py-2 text-xs",style:j,onKeyDown:N=>{N.key==="Enter"&&l.trim()&&I()}})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Category"}),r?a.jsx("div",{className:"px-3 py-2 rounded-md text-xs",style:{background:"var(--bg-tertiary)",color:"var(--text-secondary)"},children:Or[i]??i}):a.jsx("select",{value:i,onChange:N=>k(N.target.value),className:"w-full rounded-md px-3 py-2 text-xs cursor-pointer appearance-auto",style:j,children:Ou.map(N=>a.jsx("option",{value:N,children:Or[N]},N))})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Type"}),a.jsx("select",{value:p,onChange:N=>w(N.target.value),className:"w-full rounded-md px-3 py-2 text-xs cursor-pointer appearance-auto",style:j,children:o.map(N=>a.jsx("option",{value:N.id,children:N.name},N.id))})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Description"}),a.jsx("textarea",{value:c,onChange:N=>{d(N.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:j})]}),M.targetOutputKey&&a.jsxs("div",{className:"mb-6",children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Target Output Key"}),a.jsx("input",{type:"text",value:f,onChange:N=>h(N.target.value),placeholder:"*",className:"w-full rounded-md px-3 py-2 text-xs",style:j}),a.jsx("div",{className:"text-xs mt-1",style:{color:"var(--text-muted)"},children:"Use * for entire output or a specific key name"})]}),M.prompt&&a.jsxs("div",{className:"mb-6",children:[a.jsx("label",{className:"block text-[11px] font-medium mb-1.5",style:{color:"var(--text-muted)"},children:"Prompt"}),a.jsx("textarea",{value:x,onChange:N=>{v(N.target.value),O(!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:j})]}),A&&a.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}),a.jsx("button",{onClick:I,disabled:b||!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:b?"Creating...":"Create Evaluator"})]})})})}function Os({path:e,name:t,type:n,depth:r}){const i=Me(b=>b.children[e]),s=Me(b=>!!b.expanded[e]),o=Me(b=>!!b.loadingDirs[e]),l=Me(b=>!!b.dirty[e]),u=Me(b=>b.selectedFile),{setChildren:c,toggleExpanded:d,setLoadingDir:p,openTab:m}=Me(),{navigate:f}=st(),h=n==="directory",x=!h&&u===e,v=S.useCallback(()=>{h?(!i&&!o&&(p(e,!0),Yr(e).then(b=>c(e,b)).catch(console.error).finally(()=>p(e,!1))),d(e)):(m(e),f(`#/explorer/file/${encodeURIComponent(e)}`))},[h,i,o,e,c,d,p,m,f]);return a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:v,className:"w-full text-left flex items-center gap-1 py-[3px] text-[13px] cursor-pointer transition-colors group",style:{paddingLeft:`${12+r*16}px`,paddingRight:"8px",background:x?"color-mix(in srgb, var(--accent) 15%, var(--bg-primary))":"transparent",color:x?"var(--text-primary)":"var(--text-secondary)",border:"none"},onMouseEnter:b=>{x||(b.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:b=>{x||(b.currentTarget.style.background="transparent")},children:[a.jsx("span",{className:"w-3 shrink-0 flex items-center justify-center",style:{color:"var(--text-muted)"},children:h&&a.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:a.jsx("path",{d:"M3 1.5L7 5L3 8.5z"})})}),a.jsx("span",{className:"shrink-0",style:{color:h?"var(--accent)":"var(--text-muted)"},children:h?a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.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"})}):a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),a.jsx("span",{className:"truncate flex-1",children:t}),l&&a.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:"var(--accent)"}}),o&&a.jsx("span",{className:"text-[10px] shrink-0",style:{color:"var(--text-muted)"},children:"..."})]}),h&&s&&i&&i.map(b=>a.jsx(Os,{path:b.path,name:b.name,type:b.type,depth:r+1},b.path))]})}function uo(){const e=Me(n=>n.children[""]),{setChildren:t}=Me();return S.useEffect(()=>{e||Yr("").then(n=>t("",n)).catch(console.error)},[e,t]),a.jsx("div",{className:"flex-1 overflow-y-auto py-1",children:e?e.map(n=>a.jsx(Os,{path:n.path,name:n.name,type:n.type,depth:0},n.path)):a.jsx("p",{className:"text-[11px] px-3 py-2",style:{color:"var(--text-muted)"},children:"Loading..."})})}const ju=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 po(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Du(e){const t=e.replace(/\\/g,"/").split("/");return t[t.length-1]||e}function Pu(){const e=Me(k=>k.openTabs),n=Me(k=>k.selectedFile),r=Me(k=>n?k.fileCache[n]:void 0),i=Me(k=>n?!!k.dirty[n]:!1),s=Me(k=>n?k.buffers[n]:void 0),o=Me(k=>k.loadingFile),l=Me(k=>k.dirty),{setFileContent:u,updateBuffer:c,markClean:d,setLoadingFile:p,openTab:m,closeTab:f}=Me(),{navigate:h}=st(),x=_s(k=>k.theme),v=S.useRef(null),{explorerFile:b}=st();S.useEffect(()=>{b&&m(b)},[b,m]),S.useEffect(()=>{n&&(Me.getState().fileCache[n]||(p(!0),xs(n).then(k=>u(n,k)).catch(console.error).finally(()=>p(!1))))},[n,u,p]);const E=S.useCallback(()=>{if(!n)return;const k=Me.getState().fileCache[n],M=Me.getState().buffers[n]??(k==null?void 0:k.content);M!=null&&Vl(n,M).then(()=>{d(n),u(n,{...k,content:M})}).catch(console.error)},[n,d,u]);S.useEffect(()=>{const k=w=>{(w.ctrlKey||w.metaKey)&&w.key==="s"&&(w.preventDefault(),E())};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[E]);const A=k=>{v.current=k},D=S.useCallback(k=>{k!==void 0&&n&&c(n,k)},[n,c]),L=S.useCallback(k=>{m(k),h(`#/explorer/file/${encodeURIComponent(k)}`)},[m,h]),T=S.useCallback((k,w)=>{k.stopPropagation();const M=Me.getState(),I=M.openTabs.filter(j=>j!==w);if(f(w),M.selectedFile===w){const j=M.openTabs.indexOf(w),_=I[Math.min(j,I.length-1)];h(_?`#/explorer/file/${encodeURIComponent(_)}`:"#/explorer")}},[f,h]),B=S.useCallback((k,w)=>{k.button===1&&T(k,w)},[T]),O=e.length>0&&a.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(k=>{const w=k===n,M=!!l[k];return a.jsxs("button",{onClick:()=>L(k),onMouseDown:I=>B(I,k),className:"h-full flex items-center gap-1.5 px-3 text-[12px] shrink-0 cursor-pointer transition-colors relative",style:{background:w?"var(--bg-primary)":"transparent",color:w?"var(--text-primary)":"var(--text-secondary)",border:"none",borderBottom:w?"2px solid var(--accent)":"2px solid transparent",maxWidth:"180px"},onMouseEnter:I=>{w||(I.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:I=>{w||(I.currentTarget.style.background="transparent")},children:[a.jsx("span",{className:"truncate",children:Du(k)}),M?a.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:"var(--accent)"},title:"Unsaved changes"}):a.jsx("span",{className:"w-4 h-4 flex items-center justify-center rounded shrink-0 transition-colors",style:{color:"var(--text-muted)"},onClick:I=>T(I,k),onMouseEnter:I=>{I.currentTarget.style.background="var(--bg-hover)",I.currentTarget.style.color="var(--text-primary)"},onMouseLeave:I=>{I.currentTarget.style.background="transparent",I.currentTarget.style.color="var(--text-muted)"},children:a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"currentColor",children:a.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"})})})]},k)})});return n?o&&!r?a.jsxs("div",{className:"flex flex-col h-full",children:[O,a.jsx("div",{className:"flex-1 flex items-center justify-center",style:{color:"var(--text-muted)"},children:a.jsx("div",{className:"text-sm",children:"Loading file..."})})]}):!r&&!o?a.jsxs("div",{className:"flex flex-col h-full",children:[O,a.jsx("div",{className:"flex-1 flex items-center justify-center",style:{color:"var(--text-muted)"},children:a.jsx("div",{className:"text-sm",children:"Failed to load file"})})]}):r?r.binary?a.jsxs("div",{className:"flex flex-col h-full",children:[O,a.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:a.jsx("span",{style:{color:"var(--text-muted)"},children:po(r.size)})}),a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3",style:{color:"var(--text-muted)"},children:[a.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"}),a.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),a.jsx("span",{className:"text-sm",children:"Binary file — preview not available"})]})]}):a.jsxs("div",{className:"flex flex-col h-full",children:[O,a.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&&a.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"var(--bg-hover)",color:"var(--text-muted)"},children:r.language}),a.jsx("span",{style:{color:"var(--text-muted)"},children:po(r.size)}),a.jsx("div",{className:"flex-1"}),i&&a.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--accent)"},children:"Modified"}),a.jsx("button",{onClick:E,className:"px-2 py-0.5 rounded text-[11px] font-medium cursor-pointer transition-colors",style:{background:i?"var(--accent)":"var(--bg-hover)",color:i?"white":"var(--text-muted)",border:"none"},children:"Save"})]}),a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(Tl,{language:r.language??"plaintext",theme:x==="dark"?"uipath-dark":"uipath-light",value:s??r.content??"",onChange:D,beforeMount:ju,onMount:A,options:{minimap:{enabled:!1},fontSize:13,lineNumbersMinChars:4,scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,tabSize:2,renderWhitespace:"selection"}},n)})]}):null:a.jsxs("div",{className:"flex flex-col h-full",children:[O,a.jsx("div",{className:"flex-1 flex items-center justify-center",style:{color:"var(--text-muted)"},children:"Select a file to view"})]})}const Ls="/api";async function Bu(){const e=await fetch(`${Ls}/agent/models`);if(!e.ok){if(e.status===401)return[];throw new Error(`HTTP ${e.status}`)}return e.json()}async function Fu(){const e=await fetch(`${Ls}/agent/skills`);if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function zu(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Uu=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$u=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Hu={};function fo(e,t){return(Hu.jsx?$u:Uu).test(e)}const Wu=/[ \t\n\f\r]/g;function Ku(e){return typeof e=="object"?e.type==="text"?mo(e.value):!1:mo(e)}function mo(e){return e.replace(Wu,"")===""}class xn{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}xn.prototype.normal={};xn.prototype.property={};xn.prototype.space=void 0;function js(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new xn(n,r,t)}function Lr(e){return e.toLowerCase()}class Ye{constructor(t,n){this.attribute=n,this.property=t}}Ye.prototype.attribute="";Ye.prototype.booleanish=!1;Ye.prototype.boolean=!1;Ye.prototype.commaOrSpaceSeparated=!1;Ye.prototype.commaSeparated=!1;Ye.prototype.defined=!1;Ye.prototype.mustUseProperty=!1;Ye.prototype.number=!1;Ye.prototype.overloadedBoolean=!1;Ye.prototype.property="";Ye.prototype.spaceSeparated=!1;Ye.prototype.space=void 0;let Gu=0;const pe=Kt(),Pe=Kt(),jr=Kt(),G=Kt(),Ce=Kt(),tn=Kt(),Je=Kt();function Kt(){return 2**++Gu}const Dr=Object.freeze(Object.defineProperty({__proto__:null,boolean:pe,booleanish:Pe,commaOrSpaceSeparated:Je,commaSeparated:tn,number:G,overloadedBoolean:jr,spaceSeparated:Ce},Symbol.toStringTag,{value:"Module"})),dr=Object.keys(Dr);class Jr extends Ye{constructor(t,n,r,i){let s=-1;if(super(t,n),ho(this,"space",i),typeof r=="number")for(;++s4&&n.slice(0,4)==="data"&&Zu.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(go,ed);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!go.test(s)){let o=s.replace(Xu,Qu);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Jr}return new i(r,t)}function Qu(e){return"-"+e.toLowerCase()}function ed(e){return e.charAt(1).toUpperCase()}const td=js([Ds,qu,Fs,zs,Us],"html"),Qr=js([Ds,Vu,Fs,zs,Us],"svg");function nd(e){return e.join(" ").trim()}var Yt={},pr,bo;function rd(){if(bo)return pr;bo=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g,u=` -`,c="/",d="*",p="",m="comment",f="declaration";function h(v,b){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];b=b||{};var E=1,A=1;function D(_){var N=_.match(t);N&&(E+=N.length);var R=_.lastIndexOf(u);A=~R?_.length-R:A+_.length}function L(){var _={line:E,column:A};return function(N){return N.position=new T(_),k(),N}}function T(_){this.start=_,this.end={line:E,column:A},this.source=b.source}T.prototype.content=v;function B(_){var N=new Error(b.source+":"+E+":"+A+": "+_);if(N.reason=_,N.filename=b.source,N.line=E,N.column=A,N.source=v,!b.silent)throw N}function O(_){var N=_.exec(v);if(N){var R=N[0];return D(R),v=v.slice(R.length),N}}function k(){O(n)}function w(_){var N;for(_=_||[];N=M();)N!==!1&&_.push(N);return _}function M(){var _=L();if(!(c!=v.charAt(0)||d!=v.charAt(1))){for(var N=2;p!=v.charAt(N)&&(d!=v.charAt(N)||c!=v.charAt(N+1));)++N;if(N+=2,p===v.charAt(N-1))return B("End of comment missing");var R=v.slice(2,N-2);return A+=2,D(R),v=v.slice(N),A+=2,_({type:m,comment:R})}}function I(){var _=L(),N=O(r);if(N){if(M(),!O(i))return B("property missing ':'");var R=O(s),W=_({type:f,property:x(N[0].replace(e,p)),value:R?x(R[0].replace(e,p)):p});return O(o),W}}function j(){var _=[];w(_);for(var N;N=I();)N!==!1&&(_.push(N),w(_));return _}return k(),j()}function x(v){return v?v.replace(l,p):p}return pr=h,pr}var xo;function id(){if(xo)return Yt;xo=1;var e=Yt&&Yt.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.default=n;const t=e(rd());function n(r,i){let s=null;if(!r||typeof r!="string")return s;const o=(0,t.default)(r),l=typeof i=="function";return o.forEach(u=>{if(u.type!=="declaration")return;const{property:c,value:d}=u;l?i(c,d,u):d&&(s=s||{},s[c]=d)}),s}return Yt}var an={},yo;function od(){if(yo)return an;yo=1,Object.defineProperty(an,"__esModule",{value:!0}),an.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(c){return!c||n.test(c)||e.test(c)},o=function(c,d){return d.toUpperCase()},l=function(c,d){return"".concat(d,"-")},u=function(c,d){return d===void 0&&(d={}),s(c)?c:(c=c.toLowerCase(),d.reactCompat?c=c.replace(i,l):c=c.replace(r,l),c.replace(t,o))};return an.camelCase=u,an}var ln,vo;function sd(){if(vo)return ln;vo=1;var e=ln&&ln.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(id()),n=od();function r(i,s){var o={};return!i||typeof i!="string"||(0,t.default)(i,function(l,u){l&&u&&(o[(0,n.camelCase)(l,s)]=u)}),o}return r.default=r,ln=r,ln}var ad=sd();const ld=Gr(ad),$s=Hs("end"),ei=Hs("start");function Hs(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 cd(e){const t=ei(e),n=$s(e);if(t&&n)return{start:t,end:n}}function fn(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Eo(e.position):"start"in e||"end"in e?Eo(e):"line"in e||"column"in e?Pr(e):""}function Pr(e){return ko(e&&e.line)+":"+ko(e&&e.column)}function Eo(e){return Pr(e&&e.start)+"-"+Pr(e&&e.end)}function ko(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 i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?s.ruleId=r:(s.source=r.slice(0,u),s.ruleId=r.slice(u+1))}if(!s.place&&s.ancestors&&s.ancestors){const u=s.ancestors[s.ancestors.length-1];u&&(s.place=u.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=fn(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}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 ti={}.hasOwnProperty,ud=new Map,dd=/[A-Z]/g,pd=new Set(["table","tbody","thead","tfoot","tr"]),fd=new Set(["td","th"]),Ws="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function md(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=kd(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=Ed(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Qr:td,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=Ks(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function Ks(e,t,n){if(t.type==="element")return hd(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return gd(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return xd(e,t,n);if(t.type==="mdxjsEsm")return bd(e,t);if(t.type==="root")return yd(e,t,n);if(t.type==="text")return vd(e,t)}function hd(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Qr,e.schema=i),e.ancestors.push(t);const s=qs(e,t.tagName,!1),o=wd(e,t);let l=ri(e,t);return pd.has(t.tagName)&&(l=l.filter(function(u){return typeof u=="string"?!Ku(u):!0})),Gs(e,o,s,t),ni(o,l),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function gd(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)}gn(e,t.position)}function bd(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);gn(e,t.position)}function xd(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Qr,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:qs(e,t.name,!0),o=_d(e,t),l=ri(e,t);return Gs(e,o,s,t),ni(o,l),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function yd(e,t,n){const r={};return ni(r,ri(e,t)),e.create(t,e.Fragment,r,n)}function vd(e,t){return t.value}function Gs(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ni(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Ed(e,t,n){return r;function r(i,s,o,l){const c=Array.isArray(o.children)?n:t;return l?c(s,o,l):c(s,o)}}function kd(e,t){return n;function n(r,i,s,o){const l=Array.isArray(s.children),u=ei(r);return t(i,s,o,l,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function wd(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&ti.call(t.properties,i)){const s=Nd(e,i,t.properties[i]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&fd.has(t.tagName)?r=l:n[o]=l}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function _d(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else gn(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else gn(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function ri(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:ud;for(;++ri?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s0?(Qe(e,e.length,0,t),e):t}const No={}.hasOwnProperty;function Ys(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 dt(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const qe=Dt(/[A-Za-z]/),$e=Dt(/[\dA-Za-z]/),Ld=Dt(/[#-'*+\--9=?A-Z^-~]/);function $n(e){return e!==null&&(e<32||e===127)}const Br=Dt(/\d/),jd=Dt(/[\dA-Fa-f]/),Dd=Dt(/[!-/:-@[-`{-~]/);function oe(e){return e!==null&&e<-2}function Ne(e){return e!==null&&(e<0||e===32)}function ge(e){return e===-2||e===-1||e===32}const Yn=Dt(new RegExp("\\p{P}|\\p{S}","u")),Wt=Dt(/\s/);function Dt(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,i=0;for(;++n55295&&s<57344){const l=e.charCodeAt(n+1);s<56320&&l>56319&&l<57344?(o=String.fromCharCode(s,l),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function ve(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(u){return ge(u)?(e.enter(n),l(u)):t(u)}function l(u){return ge(u)&&s++o))return;const B=t.events.length;let O=B,k,w;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){if(k){w=t.events[O][1].end;break}k=!0}for(b(r),T=B;TA;){const L=n[D];t.containerState=L[1],L[0].exit.call(t,e)}n.length=A}function E(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Ud(e,t,n){return ve(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function nn(e){if(e===null||Ne(e)||Wt(e))return 1;if(Yn(e))return 2}function Xn(e,t,n){const r=[];let i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p={...e[r][1].end},m={...e[n][1].start};To(p,-u),To(m,u),o={type:u>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},l={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:m},s={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:u>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=it(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=it(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=it(c,Xn(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=it(c,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,c=it(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Qe(e,r-1,n-r+3,c),n=r+c.length-d-2;break}}for(n=-1;++n0&&ge(T)?ve(e,E,"linePrefix",s+1)(T):E(T)}function E(T){return T===null||oe(T)?e.check(Co,x,D)(T):(e.enter("codeFlowValue"),A(T))}function A(T){return T===null||oe(T)?(e.exit("codeFlowValue"),E(T)):(e.consume(T),A)}function D(T){return e.exit("codeFenced"),t(T)}function L(T,B,O){let k=0;return w;function w(N){return T.enter("lineEnding"),T.consume(N),T.exit("lineEnding"),M}function M(N){return T.enter("codeFencedFence"),ge(N)?ve(T,I,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):I(N)}function I(N){return N===l?(T.enter("codeFencedFenceSequence"),j(N)):O(N)}function j(N){return N===l?(k++,T.consume(N),j):k>=o?(T.exit("codeFencedFenceSequence"),ge(N)?ve(T,_,"whitespace")(N):_(N)):O(N)}function _(N){return N===null||oe(N)?(T.exit("codeFencedFence"),B(N)):O(N)}}}function Qd(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const mr={name:"codeIndented",tokenize:tp},ep={partial:!0,tokenize:np};function tp(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),ve(e,s,"linePrefix",5)(c)}function s(c){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?u(c):oe(c)?e.attempt(ep,o,u)(c):(e.enter("codeFlowValue"),l(c))}function l(c){return c===null||oe(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),l)}function u(c){return e.exit("codeIndented"),t(c)}}function np(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):oe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):ve(e,s,"linePrefix",5)(o)}function s(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):oe(o)?i(o):n(o)}}const rp={name:"codeText",previous:op,resolve:ip,tokenize:sp};function ip(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&cn(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),cn(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),cn(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function ta(e,t,n,r,i,s,o,l,u){const c=u||Number.POSITIVE_INFINITY;let d=0;return p;function p(b){return b===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(b),e.exit(s),m):b===null||b===32||b===41||$n(b)?n(b):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),x(b))}function m(b){return b===62?(e.enter(s),e.consume(b),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),f(b))}function f(b){return b===62?(e.exit("chunkString"),e.exit(l),m(b)):b===null||b===60||oe(b)?n(b):(e.consume(b),b===92?h:f)}function h(b){return b===60||b===62||b===92?(e.consume(b),f):f(b)}function x(b){return!d&&(b===null||b===41||Ne(b))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(b)):d999||f===null||f===91||f===93&&!u||f===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(f):f===93?(e.exit(s),e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):oe(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||oe(f)||l++>999?(e.exit("chunkString"),d(f)):(e.consume(f),u||(u=!ge(f)),f===92?m:p)}function m(f){return f===91||f===92||f===93?(e.consume(f),l++,p):p(f)}}function ra(e,t,n,r,i,s){let o;return l;function l(m){return m===34||m===39||m===40?(e.enter(r),e.enter(i),e.consume(m),e.exit(i),o=m===40?41:m,u):n(m)}function u(m){return m===o?(e.enter(i),e.consume(m),e.exit(i),e.exit(r),t):(e.enter(s),c(m))}function c(m){return m===o?(e.exit(s),u(o)):m===null?n(m):oe(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),ve(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===o||m===null||oe(m)?(e.exit("chunkString"),c(m)):(e.consume(m),m===92?p:d)}function p(m){return m===o||m===92?(e.consume(m),d):d(m)}}function mn(e,t){let n;return r;function r(i){return oe(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):ge(i)?ve(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const mp={name:"definition",tokenize:gp},hp={partial:!0,tokenize:bp};function gp(e,t,n){const r=this;let i;return s;function s(f){return e.enter("definition"),o(f)}function o(f){return na.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function l(f){return i=dt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),u):n(f)}function u(f){return Ne(f)?mn(e,c)(f):c(f)}function c(f){return ta(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function d(f){return e.attempt(hp,p,p)(f)}function p(f){return ge(f)?ve(e,m,"whitespace")(f):m(f)}function m(f){return f===null||oe(f)?(e.exit("definition"),r.parser.defined.push(i),t(f)):n(f)}}function bp(e,t,n){return r;function r(l){return Ne(l)?mn(e,i)(l):n(l)}function i(l){return ra(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return ge(l)?ve(e,o,"whitespace")(l):o(l)}function o(l){return l===null||oe(l)?t(l):n(l)}}const xp={name:"hardBreakEscape",tokenize:yp};function yp(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return oe(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const vp={name:"headingAtx",resolve:Ep,tokenize:kp};function Ep(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Qe(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function kp(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||Ne(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),u(d)):d===null||oe(d)?(e.exit("atxHeading"),t(d)):ge(d)?ve(e,l,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function u(d){return d===35?(e.consume(d),u):(e.exit("atxHeadingSequence"),l(d))}function c(d){return d===null||d===35||Ne(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),c)}}const wp=["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"],Mo=["pre","script","style","textarea"],_p={concrete:!0,name:"htmlFlow",resolveTo:Tp,tokenize:Cp},Np={partial:!0,tokenize:Mp},Sp={partial:!0,tokenize:Ap};function Tp(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 Cp(e,t,n){const r=this;let i,s,o,l,u;return c;function c(y){return d(y)}function d(y){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(y),p}function p(y){return y===33?(e.consume(y),m):y===47?(e.consume(y),s=!0,x):y===63?(e.consume(y),i=3,r.interrupt?t:g):qe(y)?(e.consume(y),o=String.fromCharCode(y),v):n(y)}function m(y){return y===45?(e.consume(y),i=2,f):y===91?(e.consume(y),i=5,l=0,h):qe(y)?(e.consume(y),i=4,r.interrupt?t:g):n(y)}function f(y){return y===45?(e.consume(y),r.interrupt?t:g):n(y)}function h(y){const Q="CDATA[";return y===Q.charCodeAt(l++)?(e.consume(y),l===Q.length?r.interrupt?t:I:h):n(y)}function x(y){return qe(y)?(e.consume(y),o=String.fromCharCode(y),v):n(y)}function v(y){if(y===null||y===47||y===62||Ne(y)){const Q=y===47,se=o.toLowerCase();return!Q&&!s&&Mo.includes(se)?(i=1,r.interrupt?t(y):I(y)):wp.includes(o.toLowerCase())?(i=6,Q?(e.consume(y),b):r.interrupt?t(y):I(y)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(y):s?E(y):A(y))}return y===45||$e(y)?(e.consume(y),o+=String.fromCharCode(y),v):n(y)}function b(y){return y===62?(e.consume(y),r.interrupt?t:I):n(y)}function E(y){return ge(y)?(e.consume(y),E):w(y)}function A(y){return y===47?(e.consume(y),w):y===58||y===95||qe(y)?(e.consume(y),D):ge(y)?(e.consume(y),A):w(y)}function D(y){return y===45||y===46||y===58||y===95||$e(y)?(e.consume(y),D):L(y)}function L(y){return y===61?(e.consume(y),T):ge(y)?(e.consume(y),L):A(y)}function T(y){return y===null||y===60||y===61||y===62||y===96?n(y):y===34||y===39?(e.consume(y),u=y,B):ge(y)?(e.consume(y),T):O(y)}function B(y){return y===u?(e.consume(y),u=null,k):y===null||oe(y)?n(y):(e.consume(y),B)}function O(y){return y===null||y===34||y===39||y===47||y===60||y===61||y===62||y===96||Ne(y)?L(y):(e.consume(y),O)}function k(y){return y===47||y===62||ge(y)?A(y):n(y)}function w(y){return y===62?(e.consume(y),M):n(y)}function M(y){return y===null||oe(y)?I(y):ge(y)?(e.consume(y),M):n(y)}function I(y){return y===45&&i===2?(e.consume(y),R):y===60&&i===1?(e.consume(y),W):y===62&&i===4?(e.consume(y),F):y===63&&i===3?(e.consume(y),g):y===93&&i===5?(e.consume(y),V):oe(y)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Np,U,j)(y)):y===null||oe(y)?(e.exit("htmlFlowData"),j(y)):(e.consume(y),I)}function j(y){return e.check(Sp,_,U)(y)}function _(y){return e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),N}function N(y){return y===null||oe(y)?j(y):(e.enter("htmlFlowData"),I(y))}function R(y){return y===45?(e.consume(y),g):I(y)}function W(y){return y===47?(e.consume(y),o="",$):I(y)}function $(y){if(y===62){const Q=o.toLowerCase();return Mo.includes(Q)?(e.consume(y),F):I(y)}return qe(y)&&o.length<8?(e.consume(y),o+=String.fromCharCode(y),$):I(y)}function V(y){return y===93?(e.consume(y),g):I(y)}function g(y){return y===62?(e.consume(y),F):y===45&&i===2?(e.consume(y),g):I(y)}function F(y){return y===null||oe(y)?(e.exit("htmlFlowData"),U(y)):(e.consume(y),F)}function U(y){return e.exit("htmlFlow"),t(y)}}function Ap(e,t,n){const r=this;return i;function i(o){return oe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function Mp(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(yn,t,n)}}const Rp={name:"htmlText",tokenize:Ip};function Ip(e,t,n){const r=this;let i,s,o;return l;function l(g){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(g),u}function u(g){return g===33?(e.consume(g),c):g===47?(e.consume(g),L):g===63?(e.consume(g),A):qe(g)?(e.consume(g),O):n(g)}function c(g){return g===45?(e.consume(g),d):g===91?(e.consume(g),s=0,h):qe(g)?(e.consume(g),E):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):oe(g)?(o=p,W(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 h(g){const F="CDATA[";return g===F.charCodeAt(s++)?(e.consume(g),s===F.length?x:h):n(g)}function x(g){return g===null?n(g):g===93?(e.consume(g),v):oe(g)?(o=x,W(g)):(e.consume(g),x)}function v(g){return g===93?(e.consume(g),b):x(g)}function b(g){return g===62?R(g):g===93?(e.consume(g),b):x(g)}function E(g){return g===null||g===62?R(g):oe(g)?(o=E,W(g)):(e.consume(g),E)}function A(g){return g===null?n(g):g===63?(e.consume(g),D):oe(g)?(o=A,W(g)):(e.consume(g),A)}function D(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||$e(g)?(e.consume(g),T):B(g)}function B(g){return oe(g)?(o=B,W(g)):ge(g)?(e.consume(g),B):R(g)}function O(g){return g===45||$e(g)?(e.consume(g),O):g===47||g===62||Ne(g)?k(g):n(g)}function k(g){return g===47?(e.consume(g),R):g===58||g===95||qe(g)?(e.consume(g),w):oe(g)?(o=k,W(g)):ge(g)?(e.consume(g),k):R(g)}function w(g){return g===45||g===46||g===58||g===95||$e(g)?(e.consume(g),w):M(g)}function M(g){return g===61?(e.consume(g),I):oe(g)?(o=M,W(g)):ge(g)?(e.consume(g),M):k(g)}function I(g){return g===null||g===60||g===61||g===62||g===96?n(g):g===34||g===39?(e.consume(g),i=g,j):oe(g)?(o=I,W(g)):ge(g)?(e.consume(g),I):(e.consume(g),_)}function j(g){return g===i?(e.consume(g),i=void 0,N):g===null?n(g):oe(g)?(o=j,W(g)):(e.consume(g),j)}function _(g){return g===null||g===34||g===39||g===60||g===61||g===96?n(g):g===47||g===62||Ne(g)?k(g):(e.consume(g),_)}function N(g){return g===47||g===62||Ne(g)?k(g):n(g)}function R(g){return g===62?(e.consume(g),e.exit("htmlTextData"),e.exit("htmlText"),t):n(g)}function W(g){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),$}function $(g){return ge(g)?ve(e,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(g):V(g)}function V(g){return e.enter("htmlTextData"),o(g)}}const si={name:"labelEnd",resolveAll:Dp,resolveTo:Pp,tokenize:Bp},Op={tokenize:Fp},Lp={tokenize:zp},jp={tokenize:Up};function Dp(e){let t=-1;const n=[];for(;++t=3&&(c===null||oe(c))?(e.exit("thematicBreak"),t(c)):n(c)}function u(c){return c===i?(e.consume(c),r++,u):(e.exit("thematicBreakSequence"),ge(c)?ve(e,l,"whitespace")(c):l(c))}}const Ve={continuation:{tokenize:Zp},exit:Qp,name:"list",tokenize:Xp},Vp={partial:!0,tokenize:ef},Yp={partial:!0,tokenize:Jp};function Xp(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return l;function l(f){const h=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(h==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:Br(f)){if(r.containerState.type||(r.containerState.type=h,e.enter(h,{_container:!0})),h==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Fn,n,c)(f):c(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(f)}return n(f)}function u(f){return Br(f)&&++o<10?(e.consume(f),u):(!r.interrupt||o<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),c(f)):n(f)}function c(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(yn,r.interrupt?n:d,e.attempt(Vp,m,p))}function d(f){return r.containerState.initialBlankLine=!0,s++,m(f)}function p(f){return ge(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),m):n(f)}function m(f){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function Zp(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(yn,i,s);function i(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ve(e,t,"listItemIndent",r.containerState.size+1)(l)}function s(l){return r.containerState.furtherBlankLines||!ge(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Yp,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,ve(e,e.attempt(Ve,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Jp(e,t,n){const r=this;return ve(e,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(s):n(s)}}function Qp(e){e.exit(this.containerState.type)}function ef(e,t,n){const r=this;return ve(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!ge(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const Ro={name:"setextUnderline",resolveTo:tf,tokenize:nf};function tf(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function nf(e,t,n){const r=this;let i;return s;function s(c){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"),i=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),l(c)}function l(c){return c===i?(e.consume(c),l):(e.exit("setextHeadingLineSequence"),ge(c)?ve(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||oe(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const rf={tokenize:of};function of(e){const t=this,n=e.attempt(yn,r,e.attempt(this.parser.constructs.flowInitial,i,ve(e,e.attempt(this.parser.constructs.flow,i,e.attempt(cp,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const sf={resolveAll:oa()},af=ia("string"),lf=ia("text");function ia(e){return{resolveAll:oa(e==="text"?cf:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,l);return o;function o(d){return c(d)?s(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),u}function u(d){return c(d)?(n.exit("data"),s(d)):(n.consume(d),u)}function c(d){if(d===null)return!0;const p=i[d];let m=-1;if(p)for(;++m-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function kf(e,t){let n=-1;const r=[];let i;for(;++n0){const We=ee.tokenStack[ee.tokenStack.length-1];(We[1]||Oo).call(ee,void 0,We[0])}for(H.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})},ke=-1;++ke0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function Df(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Pf(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Bf(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=on(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let o,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=s+1,l+=1,e.footnoteCounts.set(r,l);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,u);const c={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,c),e.applyData(t,c)}function Ff(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 zf(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function la(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function Uf(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return la(e,t);const i={src:on(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function $f(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 Hf(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 Wf(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return la(e,t);const i={href:on(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function Kf(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 Gf(e,t,n){const r=e.all(t),i=n?qf(n):ca(t),s={},o=[];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:[]}),s.className=["task-list-item"]}let l=-1;for(;++l1}function Vf(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=ei(t.children[1]),u=$s(t.children[t.children.length-1]);l&&u&&(o.position={start:l,end:u}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function Qf(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let u=-1;const c=[];for(;++u0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(Do(t.slice(i),i>0,!1)),s.join("")}function Do(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===Lo||s===jo;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===Lo||s===jo;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function nm(e,t){const n={type:"text",value:tm(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function rm(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const im={blockquote:Of,break:Lf,code:jf,delete:Df,emphasis:Pf,footnoteReference:Bf,heading:Ff,html:zf,imageReference:Uf,image:$f,inlineCode:Hf,linkReference:Wf,link:Kf,listItem:Gf,list:Vf,paragraph:Yf,root:Xf,strong:Zf,table:Jf,tableCell:em,tableRow:Qf,text:nm,thematicBreak:rm,toml:Mn,yaml:Mn,definition:Mn,footnoteDefinition:Mn};function Mn(){}const ua=-1,Zn=0,hn=1,Hn=2,ai=3,li=4,ci=5,ui=6,da=7,pa=8,Po=typeof self=="object"?self:globalThis,om=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case Zn:case ua:return n(o,i);case hn:{const l=n([],i);for(const u of o)l.push(r(u));return l}case Hn:{const l=n({},i);for(const[u,c]of o)l[r(u)]=r(c);return l}case ai:return n(new Date(o),i);case li:{const{source:l,flags:u}=o;return n(new RegExp(l,u),i)}case ci:{const l=n(new Map,i);for(const[u,c]of o)l.set(r(u),r(c));return l}case ui:{const l=n(new Set,i);for(const u of o)l.add(r(u));return l}case da:{const{name:l,message:u}=o;return n(new Po[l](u),i)}case pa:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new Po[s](o),i)};return r},Bo=e=>om(new Map,e)(0),Xt="",{toString:sm}={},{keys:am}=Object,un=e=>{const t=typeof e;if(t!=="object"||!e)return[Zn,t];const n=sm.call(e).slice(8,-1);switch(n){case"Array":return[hn,Xt];case"Object":return[Hn,Xt];case"Date":return[ai,Xt];case"RegExp":return[li,Xt];case"Map":return[ci,Xt];case"Set":return[ui,Xt];case"DataView":return[hn,n]}return n.includes("Array")?[hn,n]:n.includes("Error")?[da,n]:[Hn,n]},Rn=([e,t])=>e===Zn&&(t==="function"||t==="symbol"),lm=(e,t,n,r)=>{const i=(o,l)=>{const u=r.push(o)-1;return n.set(l,u),u},s=o=>{if(n.has(o))return n.get(o);let[l,u]=un(o);switch(l){case Zn:{let d=o;switch(u){case"bigint":l=pa,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);d=null;break;case"undefined":return i([ua],o)}return i([l,d],o)}case hn:{if(u){let m=o;return u==="DataView"?m=new Uint8Array(o.buffer):u==="ArrayBuffer"&&(m=new Uint8Array(o)),i([u,[...m]],o)}const d=[],p=i([l,d],o);for(const m of o)d.push(s(m));return p}case Hn:{if(u)switch(u){case"BigInt":return i([u,o.toString()],o);case"Boolean":case"Number":case"String":return i([u,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const d=[],p=i([l,d],o);for(const m of am(o))(e||!Rn(un(o[m])))&&d.push([s(m),s(o[m])]);return p}case ai:return i([l,o.toISOString()],o);case li:{const{source:d,flags:p}=o;return i([l,{source:d,flags:p}],o)}case ci:{const d=[],p=i([l,d],o);for(const[m,f]of o)(e||!(Rn(un(m))||Rn(un(f))))&&d.push([s(m),s(f)]);return p}case ui:{const d=[],p=i([l,d],o);for(const m of o)(e||!Rn(un(m)))&&d.push(s(m));return p}}const{message:c}=o;return i([l,{name:u,message:c}],o)};return s},Fo=(e,{json:t,lossy:n}={})=>{const r=[];return lm(!(t||n),!!t,new Map,r)(e),r},Wn=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Bo(Fo(e,t)):structuredClone(e):(e,t)=>Bo(Fo(e,t));function cm(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 um(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function dm(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||cm,r=e.options.footnoteBackLabel||um,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let u=-1;for(;++u0&&h.push({type:"text",value:" "});let E=typeof n=="string"?n:n(u,f);typeof E=="string"&&(E={type:"text",value:E}),h.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,f),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const v=d[d.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const E=v.children[v.children.length-1];E&&E.type==="text"?E.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...h)}else d.push(...h);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(d,!0)};e.patch(c,b),l.push(b)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Wn(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` -`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:` -`}]}}const vn=(function(e){if(e==null)return hm;if(typeof e=="function")return Jn(e);if(typeof e=="object")return Array.isArray(e)?pm(e):fm(e);if(typeof e=="string")return mm(e);throw new Error("Expected function, string, or object as test")});function pm(e){const t=[];let n=-1;for(;++n":""))+")"})}return m;function m(){let f=fa,h,x,v;if((!t||s(u,c,d[d.length-1]||void 0))&&(f=ym(n(u,d)),f[0]===zr))return f;if("children"in u&&u.children){const b=u;if(b.children&&f[0]!==xm)for(x=(r?b.children.length:-1)+o,v=d.concat(b);x>-1&&x0&&n.push({type:"text",value:` -`}),n}function zo(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Uo(e,t){const n=Em(e,t),r=n.one(e,void 0),i=dm(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:` -`},i),s}function Sm(e,t){return e&&"run"in e?async function(n,r){const i=Uo(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Uo(n,{file:r,...e||t})}}function $o(e){if(e)throw e}var gr,Ho;function Tm(){if(Ho)return gr;Ho=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(c){return typeof Array.isArray=="function"?Array.isArray(c):t.call(c)==="[object Array]"},s=function(c){if(!c||t.call(c)!=="[object Object]")return!1;var d=e.call(c,"constructor"),p=c.constructor&&c.constructor.prototype&&e.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!d&&!p)return!1;var m;for(m in c);return typeof m>"u"||e.call(c,m)},o=function(c,d){n&&d.name==="__proto__"?n(c,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):c[d.name]=d.newValue},l=function(c,d){if(d==="__proto__")if(e.call(c,d)){if(r)return r(c,d).value}else return;return c[d]};return gr=function u(){var c,d,p,m,f,h,x=arguments[0],v=1,b=arguments.length,E=!1;for(typeof x=="boolean"&&(E=x,x=arguments[1]||{},v=2),(x==null||typeof x!="object"&&typeof x!="function")&&(x={});vo.length;let u;l&&o.push(i);try{u=e.apply(this,o)}catch(c){const d=c;if(l&&n)throw d;return i(d)}l||(u&&u.then&&typeof u.then=="function"?u.then(s,i):u instanceof Error?i(u):s(u))}function i(o,...l){n||(n=!0,t(o,...l))}function s(o){i(null,o)}}const ht={basename:Rm,dirname:Im,extname:Om,join:Lm,sep:"/"};function Rm(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');En(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(r=i):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Im(e){if(En(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 Om(e){En(e);let t=e.length,n=-1,r=0,i=-1,s=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function Lm(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Dm(e,t){let n="",r=0,i=-1,s=0,o=-1,l,u;for(;++o<=e.length;){if(o2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,s=0}else l===46&&s>-1?s++:s=-1}return n}function En(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Pm={cwd:Bm};function Bm(){return"/"}function Hr(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Fm(e){if(typeof e=="string")e=new URL(e);else if(!Hr(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 zm(e)}function zm(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,...h]=d;const x=r[m][1];$r(x)&&$r(f)&&(f=br(!0,x,f)),r[m]=[c,f,...h]}}}}const Wm=new di().freeze();function Er(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function kr(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function wr(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 Ko(e){if(!$r(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Go(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function In(e){return Km(e)?e:new ha(e)}function Km(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Gm(e){return typeof e=="string"||qm(e)}function qm(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Vm="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",qo=[],Vo={allowDangerousHtml:!0},Ym=/^(https?|ircs?|mailto|xmpp)$/i,Xm=[{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 Zm(e){const t=Jm(e),n=Qm(e);return eh(t.runSync(t.parse(n),n),e)}function Jm(e){const t=e.rehypePlugins||qo,n=e.remarkPlugins||qo,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Vo}:Vo;return Wm().use(If).use(n).use(Sm,r).use(t)}function Qm(e){const t=e.children||"",n=new ha;return typeof t=="string"&&(n.value=t),n}function eh(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,u=t.urlTransform||th;for(const d of Xm)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Vm+d.id,void 0);return Qn(e,c),md(e,{Fragment:a.Fragment,components:i,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function c(d,p,m){if(d.type==="raw"&&m&&typeof p=="number")return o?m.children.splice(p,1):m.children[p]={type:"text",value:d.value},p;if(d.type==="element"){let f;for(f in fr)if(Object.hasOwn(fr,f)&&Object.hasOwn(d.properties,f)){const h=d.properties[f],x=fr[f];(x===null||x.includes(d.tagName))&&(d.properties[f]=u(String(h||""),f,d))}}if(d.type==="element"){let f=n?!n.includes(d.tagName):s?s.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 th(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||Ym.test(e.slice(0,t))?e:""}const Yo=(function(e,t,n){const r=vn(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(;++tc&&(c=d):d&&(c!==void 0&&c>-1&&u.push(` -`.repeat(c)||" "),c=-1,u.push(d))}return u.join("")}function ba(e,t,n){return e.type==="element"?ch(e,t,n):e.type==="text"?n.whitespace==="normal"?xa(e,n):uh(e):[]}function ch(e,t,n){const r=ya(e,n),i=e.children||[];let s=-1,o=[];if(ah(e))return o;let l,u;for(Wr(e)||Qo(e)&&Yo(t,e,Qo)?u=` -`:sh(e)?(l=2,u=2):ga(e)&&(l=1,u=1);++s]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={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(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},f=t.optional(i)+e.IDENT_RE+"\\s*\\(",h=["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"],x=["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"],b=["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"],D={type:x,keyword:h,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},L={className:"function.dispatch",relevance:0,keywords:{_hint:b},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,c],B={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:D,contains:T.concat([{begin:/\(/,end:/\)/,keywords:D,contains:T.concat(["self"]),relevance:0}]),relevance:0},O={className:"function",begin:"("+o+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:D,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:D,relevance:0},{begin:f,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:D,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,c,d,l,{begin:/\(/,end:/\)/,keywords:D,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,c,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,p]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:D,illegal:"",keywords:D,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:D},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function gh(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=hh(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 bh(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 i={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},s=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={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,i]};i.contains.push(l);const u={match:/\\"/},c={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}),h={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},x=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],v=["true","false"],b={match:/(\/[a-z._-]+)+/},E=["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"],D=["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:x,literal:v,built_in:[...E,...A,"set","shopt",...D,...L]},contains:[f,e.SHEBANG(),h,p,s,o,b,l,u,c,d,n]}}function xh(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},c={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(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},f=t.optional(i)+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"},b=[p,l,n,e.C_BLOCK_COMMENT_MODE,d,c],E={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:v,contains:b.concat([{begin:/\(/,end:/\)/,keywords:v,contains:b.concat(["self"]),relevance:0}]),relevance:0},A={begin:"("+o+"[\\*&\\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,c,d,l,{begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,c,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,p]};return{name:"C",aliases:["h"],keywords:v,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:p,strings:c,keywords:v}}}function yh(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={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(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},f=t.optional(i)+e.IDENT_RE+"\\s*\\(",h=["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"],x=["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"],b=["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"],D={type:x,keyword:h,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},L={className:"function.dispatch",relevance:0,keywords:{_hint:b},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,c],B={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:D,contains:T.concat([{begin:/\(/,end:/\)/,keywords:D,contains:T.concat(["self"]),relevance:0}]),relevance:0},O={className:"function",begin:"("+o+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:D,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:D,relevance:0},{begin:f,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:D,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,c,d,l,{begin:/\(/,end:/\)/,keywords:D,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,c,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,p]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:D,illegal:"",keywords:D,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:D},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function vh(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"],i=["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"],s=["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"],o={keyword:i.concat(s),built_in:t,literal:r},l=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),u={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},c={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:o},f=e.inherit(m,{illegal:/\n/}),h={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,f]},x={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},m]},v=e.inherit(x,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]});m.contains=[x,h,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,u,e.C_BLOCK_COMMENT_MODE],f.contains=[v,h,p,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,u,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const b={variants:[c,x,h,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},E={begin:"<",end:">",contains:[{beginKeywords:"in out"},l]},A=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",D={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:o,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),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"}},b,u,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},l,E,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,E,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:o,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,E],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,relevance:0,contains:[b,u,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},D]}}const Eh=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_-]*/}}),kh=["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"],wh=["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"],_h=[...kh,...wh],Nh=["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(),Sh=["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(),Th=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Ch=["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 Ah(e){const t=e.regex,n=Eh(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",s=/@-?\w[\w]*(-\w+)*/,o="[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:"\\."+o,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+Sh.join("|")+")"},{begin:":(:)?("+Th.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Ch.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:s},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:Nh.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+_h.join("|")+")\\b"}]}}function Mh(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 Rh(e){const s={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:s,illegal:"va(e,t,n-1))}function Lh(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+va("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),u={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"]},c={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:u,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:u,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:u,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:u,relevance:0,contains:[c,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,es,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},es,c]}}const ts="[A-Za-z$_][0-9A-Za-z$_]*",jh=["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"],Dh=["true","false","null","undefined","NaN","Infinity"],Ea=["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"],ka=["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"],Ph=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Bh=[].concat(wa,Ea,ka);function Fh(e){const t=e.regex,n=($,{after:V})=>{const g="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:($,V)=>{const g=$[0].length+$.index,F=$.input[g];if(F==="<"||F===","){V.ignoreMatch();return}F===">"&&(n($,{after:g})||V.ignoreMatch());let U;const y=$.input.substring(g);if(U=y.match(/^\s*=/)){V.ignoreMatch();return}if((U=y.match(/^\s+extends\s+/))&&U.index===0){V.ignoreMatch();return}}},l={$pattern:ts,keyword:jh,literal:Dh,built_in:Bh,"variable.language":Ph},u="[0-9](_?[0-9])*",c=`\\.(${u})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",p={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${u})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\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"}},h={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"css"}},x={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,m]},E={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,h,x,v,{match:/\$\d+/},p];m.contains=A.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(A)});const D=[].concat(E,m.contains),L=D.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(D)}]),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"}}]},O={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:{_:[...Ea,...ka]}},k={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},w={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[T],illegal:/%/},M={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function I($){return t.concat("(?!",$.join("|"),")")}const j={match:t.concat(/\b/,I([...wa,"super","import"].map($=>`${$}\\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},N={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},T]},R="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",W={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:O},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),k,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,h,x,v,E,{match:/\$\d+/},p,O,{scope:"attr",match:r+t.lookahead(":"),relevance:0},W,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[E,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:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},w,{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]},j,M,B,N,{match:/\$[(.]/}]}}function zh(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,i,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Jt="[0-9](_*[0-9])*",jn=`\\.(${Jt})`,Dn="[0-9a-fA-F](_*[0-9a-fA-F])*",Uh={className:"number",variants:[{begin:`(\\b(${Jt})((${jn})|\\.)?|(${jn}))[eE][+-]?(${Jt})[fFdD]?\\b`},{begin:`\\b(${Jt})((${jn})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${jn})[fFdD]?\\b`},{begin:`\\b(${Jt})[fFdD]\\b`},{begin:`\\b0[xX]((${Dn})\\.?|(${Dn})?\\.(${Dn}))[pP][+-]?(${Jt})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Dn})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function $h(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+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},s={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},o={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[s,i]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,s,i]}]};i.contains.push(o);const l={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},u={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(o,{className:"string"}),"self"]}]},c=Uh,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,u,{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://,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,u,o,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://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},l,u]},o,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` -`},c]}}const Hh=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_-]*/}}),Wh=["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"],Kh=["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"],Gh=[...Wh,...Kh],qh=["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(),_a=["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(),Na=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Vh=["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(),Yh=_a.concat(Na).sort().reverse();function Xh(e){const t=Hh(e),n=Yh,r="and or not only",i="[\\w-]+",s="("+i+"|@\\{"+i+"\\})",o=[],l=[],u=function(A){return{className:"string",begin:"~?"+A+".*?"+A}},c=function(A,D,L){return{className:A,begin:D,relevance:L}},d={$pattern:/[a-z-]+/,keyword:r,attribute:qh.join(" ")},p={begin:"\\(",end:"\\)",contains:l,keywords:d,relevance:0};l.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,u("'"),u('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,p,c("variable","@@?"+i,10),c("variable","@\\{"+i+"\\}"),c("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const m=l.concat({begin:/\{/,end:/\}/,contains:o}),f={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(l)},h={begin:s+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Vh.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},x={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:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:m}},b={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:s,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,f,c("keyword","all\\b"),c("variable","@\\{"+i+"\\}"),{begin:"\\b("+Gh.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,c("selector-tag",s,0),c("selector-id","#"+s),c("selector-class","\\."+s,0),c("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+_a.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Na.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:m},{begin:"!important"},t.FUNCTION_DISPATCH]},E={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[b]};return o.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,x,v,E,h,b,f,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:o}}function Zh(e){const t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},i=[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:i.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:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function Jh(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={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}]},s={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={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+.-]*/,u={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}]},c={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(c,{contains:[]}),m=e.inherit(d,{contains:[]});c.contains.push(m),d.contains.push(p);let f=[n,u];return[c,d,p,m].forEach(b=>{b.contains=b.contains.concat(f)}),f=f.concat(c,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,s,c,d,{className:"quote",begin:"^>\\s+",contains:f,end:"$"},i,r,u,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function eg(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"]},u={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:l,illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+u.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:u,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function tg(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}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},s={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},o={begin:/->\{/,end:/\}/},l={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},u={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]},c={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,s,u],p=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],m=(x,v,b="\\1")=>{const E=b==="\\1"?b:t.concat(b,v);return t.concat(t.concat("(?:",x,")"),v,/(?:\\.|[^\\\/])*?/,E,/(?:\\.|[^\\\/])*?/,b,r)},f=(x,v,b)=>t.concat(t.concat("(?:",x,")"),v,/(?:\\.|[^\\\/])*?/,b,r),h=[u,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{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}]},c,{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,c]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return s.contains=h,o.contains=h,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:h}}function ng(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),i=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),s=t.concat(/[A-Z]+/,n),o={scope:"variable",match:"\\$+"+r},l={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},u={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},c=e.inherit(e.APOS_STRING_MODE,{illegal:null}),d=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(u)}),p={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(u),"on:begin":(_,N)=>{N.data._beginMatch=_[1]||_[2]},"on:end":(_,N)=>{N.data._beginMatch!==_[1]&&N.ignoreMatch()}},m=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),f=`[ -]`,h={scope:"string",variants:[d,c,p,m]},x={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"],b=["__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"],E=["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"],D={keyword:b,literal:(_=>{const N=[];return _.forEach(R=>{N.push(R),R.toLowerCase()===R?N.push(R.toUpperCase()):N.push(R.toLowerCase())}),N})(v),built_in:E},L=_=>_.map(N=>N.replace(/\|\d+$/,"")),T={variants:[{match:[/new/,t.concat(f,"+"),t.concat("(?!",L(E).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},B=t.concat(r,"\\b(?!\\()"),O={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),B],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),B],scope:{1:"title.class",3:"variable.constant"}},{match:[i,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},k={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},w={relevance:0,begin:/\(/,end:/\)/,keywords:D,contains:[k,o,O,e.C_BLOCK_COMMENT_MODE,h,x,T]},M={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",L(b).join("\\b|"),"|",L(E).join("\\b|"),"\\b)"),r,t.concat(f,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[w]};w.contains.push(M);const I=[k,O,e.C_BLOCK_COMMENT_MODE,h,x,T],j={begin:t.concat(/#\[\s*\\?/,t.either(i,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:v,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:v,keyword:["new","array"]},contains:["self",...I]},...I,{scope:"meta",variants:[{match:i},{match:s}]}]};return{case_insensitive:!1,keywords:D,contains:[j,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/},o,M,O,{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:D,contains:["self",j,o,O,e.C_BLOCK_COMMENT_MODE,h,x]}]},{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]},h,x]}}function rg(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 ig(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function og(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"]},u={className:"meta",begin:/^(>>>|\.\.\.) /},c={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,u],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,u],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,u,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,u,d,c]},{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,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,d,c]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},m="[0-9](_?[0-9])*",f=`(\\b(${m}))?\\.(${m})|\\b(${m})\\.`,h=`\\b|${r.join("|")}`,x={className:"number",relevance:0,variants:[{begin:`(\\b(${m})|(${f}))[eE][+-]?(${m})[jJ]?(?=${h})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${h})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${h})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${h})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${h})`},{begin:`\\b(${m})[jJ](?=${h})`}]},v={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},b={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",u,x,p,e.HASH_COMMENT_MODE]}]};return c.contains=[p,x,u],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[u,x,{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:[b]},{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:[x,b,p]}]}}function sg(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function ag(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]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=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:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[s,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function lg(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]+/),i=t.concat(r,/(::\w+)*/),o={"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]+"},u={begin:"#<",end:">"},c=[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:o},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]?/},{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])*",h={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"}]},x={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},T=[p,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:o},{relevance:0,match:[i,/\.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:[x]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[p,{begin:n}],relevance:0},h,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{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(u,c),relevance:0}].concat(u,c);d.contains=T,x.contains=T;const w=[{begin:/^\s*=>/,starts:{end:"$",contains:T}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:o,contains:T}}];return c.unshift(u),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(w).concat(c).concat(T)}}function cg(e){const t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),s={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},o="([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"],u=["true","false","Some","None","Ok","Err"],c=["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:u,built_in:c},illegal:""},s]}}const ug=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_-]*/}}),dg=["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"],pg=["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"],fg=[...dg,...pg],mg=["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(),hg=["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(),gg=["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();function xg(e){const t=ug(e),n=gg,r=hg,i="@[a-z-]+",s="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("+fg.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("+bg.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:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:mg.join(" ")},contains:[{begin:i,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 yg(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function vg(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},s=["true","false","unknown"],o=["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"],u=["add","asc","collation","desc","final","first","last","view"],c=["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,h=[...c,...u].filter(L=>!d.includes(L)),x={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},v={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},b={match:t.concat(/\b/,t.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function E(L){return t.concat(/\b/,t.either(...L.map(T=>T.replace(/\s+/,"\\s+"))),/\b/)}const A={scope:"keyword",match:E(m),relevance:0};function D(L,{exceptions:T,when:B}={}){const O=B;return T=T||[],L.map(k=>k.match(/\|\d+$/)||T.includes(k)?k:O(k)?`${k}|0`:k)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:D(h,{when:L=>L.length<3}),literal:s,type:l,built_in:p},contains:[{scope:"type",match:E(o)},A,b,x,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,v]}}function Sa(e){return e?typeof e=="string"?e:e.source:null}function dn(e){return _e("(?=",e,")")}function _e(...e){return e.map(n=>Sa(n)).join("")}function Eg(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"("+(Eg(e).capture?"":"?:")+e.map(r=>Sa(r)).join("|")+")"}const fi=e=>_e(/\b/,e,/\w$/.test(e)?/\b/:/\B/),kg=["Protocol","Type"].map(fi),ns=["init","self"].map(fi),wg=["Any","Self"],_r=["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"],rs=["false","nil","true"],_g=["assignment","associativity","higherThan","left","lowerThan","none","right"],Ng=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],is=["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"],Ta=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]/),Ca=Ge(Ta,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Nr=_e(Ta,Ca,"*"),Aa=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]/),Kn=Ge(Aa,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),mt=_e(Aa,Kn,"*"),Pn=_e(/[A-Z]/,Kn,"*"),Sg=["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\(/,mt,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],Tg=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function Cg(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,Ge(...kg,...ns)],className:{2:"keyword"}},s={match:_e(/\./,Ge(..._r)),relevance:0},o=_r.filter(ye=>typeof ye=="string").concat(["_|0"]),l=_r.filter(ye=>typeof ye!="string").concat(wg).map(fi),u={variants:[{className:"keyword",match:Ge(...l,...ns)}]},c={$pattern:Ge(/\b\w+/,/#\w+/),keyword:o.concat(Ng),literal:rs},d=[i,s,u],p={match:_e(/\./,Ge(...is)),relevance:0},m={className:"built_in",match:_e(/\b/,Ge(...is),/(?=\()/)},f=[p,m],h={match:/->/,relevance:0},x={className:"operator",relevance:0,variants:[{match:Nr},{match:`\\.(\\.|${Ca})+`}]},v=[h,x],b="([0-9]_*)+",E="([0-9a-fA-F]_*)+",A={className:"number",relevance:0,variants:[{match:`\\b(${b})(\\.(${b}))?([eE][+-]?(${b}))?\\b`},{match:`\\b0x(${E})(\\.(${E}))?([pP][+-]?(${b}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},D=(ye="")=>({className:"subst",variants:[{match:_e(/\\/,ye,/[0\\tnr"']/)},{match:_e(/\\/,ye,/u\{[0-9a-fA-F]{1,8}\}/)}]}),L=(ye="")=>({className:"subst",match:_e(/\\/,ye,/[\t ]*(?:[\r\n]|\r\n)/)}),T=(ye="")=>({className:"subst",label:"interpol",begin:_e(/\\/,ye,/\(/),end:/\)/}),B=(ye="")=>({begin:_e(ye,/"""/),end:_e(/"""/,ye),contains:[D(ye),L(ye),T(ye)]}),O=(ye="")=>({begin:_e(ye,/"/),end:_e(/"/,ye),contains:[D(ye),T(ye)]}),k={className:"string",variants:[B(),B("#"),B("##"),B("###"),O(),O("#"),O("##"),O("###")]},w=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],M={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:w},I=ye=>{const lt=_e(ye,/\//),nt=_e(/\//,ye);return{begin:lt,end:nt,contains:[...w,{scope:"comment",begin:`#(?!.*${nt})`,end:/$/}]}},j={scope:"regexp",variants:[I("###"),I("##"),I("#"),M]},_={match:_e(/`/,mt,/`/)},N={className:"variable",match:/\$\d+/},R={className:"variable",match:`\\$${Kn}+`},W=[_,N,R],$={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:Tg,contains:[...v,A,k]}]}},V={scope:"keyword",match:_e(/@/,Ge(...Sg),dn(Ge(/\(/,/\s+/)))},g={scope:"meta",match:_e(/@/,mt)},F=[$,V,g],U={match:dn(/\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)/,Kn,"+")},{className:"type",match:Pn,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:_e(/\s+&\s+/,dn(Pn)),relevance:0}]},y={begin://,keywords:c,contains:[...r,...d,...F,h,U]};U.contains.push(y);const Q={match:_e(mt,/\s*:/),keywords:"_|0",relevance:0},se={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",Q,...r,j,...d,...f,...v,A,k,...W,...F,U]},K={begin://,keywords:"repeat each",contains:[...r,U]},ie={begin:Ge(dn(_e(mt,/\s*:/)),dn(_e(mt,/\s+/,mt,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:mt}]},de={begin:/\(/,end:/\)/,keywords:c,contains:[ie,...r,...d,...v,A,k,...F,U,se],endsParent:!0,illegal:/["']/},be={match:[/(func|macro)/,/\s+/,Ge(_.match,mt,Nr)],className:{1:"keyword",3:"title.function"},contains:[K,de,t],illegal:[/\[/,/%/]},Oe={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[K,de,t],illegal:/\[|%/},Re={match:[/operator/,/\s+/,Nr],className:{1:"keyword",3:"title"}},at={begin:[/precedencegroup/,/\s+/,Pn],className:{1:"keyword",3:"title"},contains:[U],keywords:[..._g,...rs],end:/}/},St={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Pt={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},yt={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,mt,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:c,contains:[K,...d,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:"title.class.inherited",match:Pn},...d],relevance:0}]};for(const ye of k.variants){const lt=ye.contains.find(vt=>vt.label==="interpol");lt.keywords=c;const nt=[...d,...f,...v,A,k,...W];lt.contains=[...nt,{begin:/\(/,end:/\)/,contains:["self",...nt]}]}return{name:"Swift",keywords:c,contains:[...r,be,Oe,St,Pt,yt,Re,at,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},j,...d,...f,...v,A,k,...W,...F,U,se]}}const Gn="[A-Za-z$_][0-9A-Za-z$_]*",Ma=["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"],Ra=["true","false","null","undefined","NaN","Infinity"],Ia=["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"],Oa=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],La=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],ja=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Da=[].concat(La,Ia,Oa);function Ag(e){const t=e.regex,n=($,{after:V})=>{const g="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:($,V)=>{const g=$[0].length+$.index,F=$.input[g];if(F==="<"||F===","){V.ignoreMatch();return}F===">"&&(n($,{after:g})||V.ignoreMatch());let U;const y=$.input.substring(g);if(U=y.match(/^\s*=/)){V.ignoreMatch();return}if((U=y.match(/^\s+extends\s+/))&&U.index===0){V.ignoreMatch();return}}},l={$pattern:Gn,keyword:Ma,literal:Ra,built_in:Da,"variable.language":ja},u="[0-9](_?[0-9])*",c=`\\.(${u})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",p={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${u})\\b`},{begin:`\\b(${d})\\b((${c})\\b|\\.)?|(${c})\\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"}},h={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"css"}},x={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,m]},E={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,h,x,v,{match:/\$\d+/},p];m.contains=A.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(A)});const D=[].concat(E,m.contains),L=D.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(D)}]),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"}}]},O={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:{_:[...Ia,...Oa]}},k={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},w={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[T],illegal:/%/},M={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function I($){return t.concat("(?!",$.join("|"),")")}const j={match:t.concat(/\b/,I([...La,"super","import"].map($=>`${$}\\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},N={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},T]},R="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",W={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:O},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),k,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,h,x,v,E,{match:/\$\d+/},p,O,{scope:"attr",match:r+t.lookahead(":"),relevance:0},W,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[E,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:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},w,{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]},j,M,B,N,{match:/\$[(.]/}]}}function Mg(e){const t=e.regex,n=Ag(e),r=Gn,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},l={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},u=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:Gn,keyword:Ma.concat(u),literal:Ra,built_in:Da.concat(i),"variable.language":ja},d={className:"meta",begin:"@"+r},p=(x,v,b)=>{const E=x.contains.findIndex(A=>A.label===v);if(E===-1)throw new Error("can not find mode to replace");x.contains.splice(E,1,b)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(d);const m=n.contains.find(x=>x.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,s,o,f]),p(n,"shebang",e.SHEBANG()),p(n,"use_strict",l);const h=n.contains.find(x=>x.label==="func.def");return h.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function Rg(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,s=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,l=/\d{1,2}(:\d{1,2}){1,2}/,u={className:"literal",variants:[{begin:t.concat(/# */,t.either(s,i),/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,t.either(s,i),/ +/,t.either(o,l),/ *#/)}]},c={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,u,c,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 Ig(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"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},s={className:"variable",begin:/\$[\w_]+/},o={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/},u={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},c={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"}},s,o,i,e.QUOTE_STRING_MODE,u,c,l]}}function Og(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,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(s,{begin:/\(/,end:/\)/}),l=e.inherit(e.APOS_STRING_MODE,{className:"string"}),u=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/`]+/}]}]}]};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:[s,u,l,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[s,o,u,l]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[u]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:c}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function Lg(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},l=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),m={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},f={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},h={begin:/\{/,end:/\}/,contains:[f],illegal:"\\n",relevance:0},x={begin:"\\[",end:"\\]",contains:[f],illegal:"\\n",relevance:0},v=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},m,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},h,x,s,o],b=[...v];return b.pop(),b.push(l),f.contains=b,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:v}}const jg={arduino:gh,bash:bh,c:xh,cpp:yh,csharp:vh,css:Ah,diff:Mh,go:Rh,graphql:Ih,ini:Oh,java:Lh,javascript:Fh,json:zh,kotlin:$h,less:Xh,lua:Zh,makefile:Jh,markdown:Qh,objectivec:eg,perl:tg,php:ng,"php-template":rg,plaintext:ig,python:og,"python-repl":sg,r:ag,ruby:lg,rust:cg,scss:xg,shell:yg,sql:vg,swift:Cg,typescript:Mg,vbnet:Rg,wasm:Ig,xml:Og,yaml:Lg};var Sr,os;function Dg(){if(os)return Sr;os=1;function e(C){return C instanceof Map?C.clear=C.delete=C.set=function(){throw new Error("map is read-only")}:C instanceof Set&&(C.add=C.clear=C.delete=function(){throw new Error("set is read-only")}),Object.freeze(C),Object.getOwnPropertyNames(C).forEach(z=>{const Y=C[z],ce=typeof Y;(ce==="object"||ce==="function")&&!Object.isFrozen(Y)&&e(Y)}),C}class t{constructor(z){z.data===void 0&&(z.data={}),this.data=z.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(C){return C.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function r(C,...z){const Y=Object.create(null);for(const ce in C)Y[ce]=C[ce];return z.forEach(function(ce){for(const Le in ce)Y[Le]=ce[Le]}),Y}const i="",s=C=>!!C.scope,o=(C,{prefix:z})=>{if(C.startsWith("language:"))return C.replace("language:","language-");if(C.includes(".")){const Y=C.split(".");return[`${z}${Y.shift()}`,...Y.map((ce,Le)=>`${ce}${"_".repeat(Le+1)}`)].join(" ")}return`${z}${C}`};class l{constructor(z,Y){this.buffer="",this.classPrefix=Y.classPrefix,z.walk(this)}addText(z){this.buffer+=n(z)}openNode(z){if(!s(z))return;const Y=o(z.scope,{prefix:this.classPrefix});this.span(Y)}closeNode(z){s(z)&&(this.buffer+=i)}value(){return this.buffer}span(z){this.buffer+=``}}const u=(C={})=>{const z={children:[]};return Object.assign(z,C),z};class c{constructor(){this.rootNode=u(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(z){this.top.children.push(z)}openNode(z){const Y=u({scope:z});this.add(Y),this.stack.push(Y)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(z){return this.constructor._walk(z,this.rootNode)}static _walk(z,Y){return typeof Y=="string"?z.addText(Y):Y.children&&(z.openNode(Y),Y.children.forEach(ce=>this._walk(z,ce)),z.closeNode(Y)),z}static _collapse(z){typeof z!="string"&&z.children&&(z.children.every(Y=>typeof Y=="string")?z.children=[z.children.join("")]:z.children.forEach(Y=>{c._collapse(Y)}))}}class d extends c{constructor(z){super(),this.options=z}addText(z){z!==""&&this.add(z)}startScope(z){this.openNode(z)}endScope(){this.closeNode()}__addSublanguage(z,Y){const ce=z.root;Y&&(ce.scope=`language:${Y}`),this.add(ce)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function p(C){return C?typeof C=="string"?C:C.source:null}function m(C){return x("(?=",C,")")}function f(C){return x("(?:",C,")*")}function h(C){return x("(?:",C,")?")}function x(...C){return C.map(Y=>p(Y)).join("")}function v(C){const z=C[C.length-1];return typeof z=="object"&&z.constructor===Object?(C.splice(C.length-1,1),z):{}}function b(...C){return"("+(v(C).capture?"":"?:")+C.map(ce=>p(ce)).join("|")+")"}function E(C){return new RegExp(C.toString()+"|").exec("").length-1}function A(C,z){const Y=C&&C.exec(z);return Y&&Y.index===0}const D=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function L(C,{joinWith:z}){let Y=0;return C.map(ce=>{Y+=1;const Le=Y;let je=p(ce),te="";for(;je.length>0;){const J=D.exec(je);if(!J){te+=je;break}te+=je.substring(0,J.index),je=je.substring(J.index+J[0].length),J[0][0]==="\\"&&J[1]?te+="\\"+String(Number(J[1])+Le):(te+=J[0],J[0]==="("&&Y++)}return te}).map(ce=>`(${ce})`).join(z)}const T=/\b\B/,B="[a-zA-Z]\\w*",O="[a-zA-Z_]\\w*",k="\\b\\d+(\\.\\d+)?",w="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",M="\\b(0b[01]+)",I="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",j=(C={})=>{const z=/^#![ ]*\//;return C.binary&&(C.begin=x(z,/.*\b/,C.binary,/\b.*/)),r({scope:"meta",begin:z,end:/$/,relevance:0,"on:begin":(Y,ce)=>{Y.index!==0&&ce.ignoreMatch()}},C)},_={begin:"\\\\[\\s\\S]",relevance:0},N={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[_]},R={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[_]},W={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/},$=function(C,z,Y={}){const ce=r({scope:"comment",begin:C,end:z,contains:[]},Y);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 Le=b("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:x(/[ ]+/,"(",Le,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),ce},V=$("//","$"),g=$("/\\*","\\*/"),F=$("#","$"),U={scope:"number",begin:k,relevance:0},y={scope:"number",begin:w,relevance:0},Q={scope:"number",begin:M,relevance:0},se={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[_,{begin:/\[/,end:/\]/,relevance:0,contains:[_]}]},K={scope:"title",begin:B,relevance:0},ie={scope:"title",begin:O,relevance:0},de={begin:"\\.\\s*"+O,relevance:0};var Oe=Object.freeze({__proto__:null,APOS_STRING_MODE:N,BACKSLASH_ESCAPE:_,BINARY_NUMBER_MODE:Q,BINARY_NUMBER_RE:M,COMMENT:$,C_BLOCK_COMMENT_MODE:g,C_LINE_COMMENT_MODE:V,C_NUMBER_MODE:y,C_NUMBER_RE:w,END_SAME_AS_BEGIN:function(C){return Object.assign(C,{"on:begin":(z,Y)=>{Y.data._beginMatch=z[1]},"on:end":(z,Y)=>{Y.data._beginMatch!==z[1]&&Y.ignoreMatch()}})},HASH_COMMENT_MODE:F,IDENT_RE:B,MATCH_NOTHING_RE:T,METHOD_GUARD:de,NUMBER_MODE:U,NUMBER_RE:k,PHRASAL_WORDS_MODE:W,QUOTE_STRING_MODE:R,REGEXP_MODE:se,RE_STARTERS_RE:I,SHEBANG:j,TITLE_MODE:K,UNDERSCORE_IDENT_RE:O,UNDERSCORE_TITLE_MODE:ie});function Re(C,z){C.input[C.index-1]==="."&&z.ignoreMatch()}function at(C,z){C.className!==void 0&&(C.scope=C.className,delete C.className)}function St(C,z){z&&C.beginKeywords&&(C.begin="\\b("+C.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",C.__beforeBegin=Re,C.keywords=C.keywords||C.beginKeywords,delete C.beginKeywords,C.relevance===void 0&&(C.relevance=0))}function Pt(C,z){Array.isArray(C.illegal)&&(C.illegal=b(...C.illegal))}function yt(C,z){if(C.match){if(C.begin||C.end)throw new Error("begin & end are not supported with match");C.begin=C.match,delete C.match}}function ye(C,z){C.relevance===void 0&&(C.relevance=1)}const lt=(C,z)=>{if(!C.beforeMatch)return;if(C.starts)throw new Error("beforeMatch cannot be used with starts");const Y=Object.assign({},C);Object.keys(C).forEach(ce=>{delete C[ce]}),C.keywords=Y.keywords,C.begin=x(Y.beforeMatch,m(Y.begin)),C.starts={relevance:0,contains:[Object.assign(Y,{endsParent:!0})]},C.relevance=0,delete Y.beforeMatch},nt=["of","and","for","in","not","or","if","then","parent","list","value"],vt="keyword";function Bt(C,z,Y=vt){const ce=Object.create(null);return typeof C=="string"?Le(Y,C.split(" ")):Array.isArray(C)?Le(Y,C):Object.keys(C).forEach(function(je){Object.assign(ce,Bt(C[je],z,je))}),ce;function Le(je,te){z&&(te=te.map(J=>J.toLowerCase())),te.forEach(function(J){const le=J.split("|");ce[le[0]]=[je,qt(le[0],le[1])]})}}function qt(C,z){return z?Number(z):Z(C)?0:1}function Z(C){return nt.includes(C.toLowerCase())}const he={},Ie=C=>{console.error(C)},fe=(C,...z)=>{console.log(`WARN: ${C}`,...z)},P=(C,z)=>{he[`${C}/${z}`]||(console.log(`Deprecated as of ${C}. ${z}`),he[`${C}/${z}`]=!0)},H=new Error;function ee(C,z,{key:Y}){let ce=0;const Le=C[Y],je={},te={};for(let J=1;J<=z.length;J++)te[J+ce]=Le[J],je[J+ce]=!0,ce+=E(z[J-1]);C[Y]=te,C[Y]._emit=je,C[Y]._multi=!0}function ae(C){if(Array.isArray(C.begin)){if(C.skip||C.excludeBegin||C.returnBegin)throw Ie("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),H;if(typeof C.beginScope!="object"||C.beginScope===null)throw Ie("beginScope must be object"),H;ee(C,C.begin,{key:"beginScope"}),C.begin=L(C.begin,{joinWith:""})}}function ke(C){if(Array.isArray(C.end)){if(C.skip||C.excludeEnd||C.returnEnd)throw Ie("skip, excludeEnd, returnEnd not compatible with endScope: {}"),H;if(typeof C.endScope!="object"||C.endScope===null)throw Ie("endScope must be object"),H;ee(C,C.end,{key:"endScope"}),C.end=L(C.end,{joinWith:""})}}function We(C){C.scope&&typeof C.scope=="object"&&C.scope!==null&&(C.beginScope=C.scope,delete C.scope)}function Et(C){We(C),typeof C.beginScope=="string"&&(C.beginScope={_wrap:C.beginScope}),typeof C.endScope=="string"&&(C.endScope={_wrap:C.endScope}),ae(C),ke(C)}function ct(C){function z(te,J){return new RegExp(p(te),"m"+(C.case_insensitive?"i":"")+(C.unicodeRegex?"u":"")+(J?"g":""))}class Y{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(J,le){le.position=this.position++,this.matchIndexes[this.matchAt]=le,this.regexes.push([le,J]),this.matchAt+=E(J)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const J=this.regexes.map(le=>le[1]);this.matcherRe=z(L(J,{joinWith:"|"}),!0),this.lastIndex=0}exec(J){this.matcherRe.lastIndex=this.lastIndex;const le=this.matcherRe.exec(J);if(!le)return null;const Fe=le.findIndex((sn,er)=>er>0&&sn!==void 0),De=this.matchIndexes[Fe];return le.splice(0,Fe),Object.assign(le,De)}}class ce{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(J){if(this.multiRegexes[J])return this.multiRegexes[J];const le=new Y;return this.rules.slice(J).forEach(([Fe,De])=>le.addRule(Fe,De)),le.compile(),this.multiRegexes[J]=le,le}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(J,le){this.rules.push([J,le]),le.type==="begin"&&this.count++}exec(J){const le=this.getMatcher(this.regexIndex);le.lastIndex=this.lastIndex;let Fe=le.exec(J);if(this.resumingScanAtSamePosition()&&!(Fe&&Fe.index===this.lastIndex)){const De=this.getMatcher(0);De.lastIndex=this.lastIndex+1,Fe=De.exec(J)}return Fe&&(this.regexIndex+=Fe.position+1,this.regexIndex===this.count&&this.considerAll()),Fe}}function Le(te){const J=new ce;return te.contains.forEach(le=>J.addRule(le.begin,{rule:le,type:"begin"})),te.terminatorEnd&&J.addRule(te.terminatorEnd,{type:"end"}),te.illegal&&J.addRule(te.illegal,{type:"illegal"}),J}function je(te,J){const le=te;if(te.isCompiled)return le;[at,yt,Et,lt].forEach(De=>De(te,J)),C.compilerExtensions.forEach(De=>De(te,J)),te.__beforeBegin=null,[St,Pt,ye].forEach(De=>De(te,J)),te.isCompiled=!0;let Fe=null;return typeof te.keywords=="object"&&te.keywords.$pattern&&(te.keywords=Object.assign({},te.keywords),Fe=te.keywords.$pattern,delete te.keywords.$pattern),Fe=Fe||/\w+/,te.keywords&&(te.keywords=Bt(te.keywords,C.case_insensitive)),le.keywordPatternRe=z(Fe,!0),J&&(te.begin||(te.begin=/\B|\b/),le.beginRe=z(le.begin),!te.end&&!te.endsWithParent&&(te.end=/\B|\b/),te.end&&(le.endRe=z(le.end)),le.terminatorEnd=p(le.end)||"",te.endsWithParent&&J.terminatorEnd&&(le.terminatorEnd+=(te.end?"|":"")+J.terminatorEnd)),te.illegal&&(le.illegalRe=z(te.illegal)),te.contains||(te.contains=[]),te.contains=[].concat(...te.contains.map(function(De){return Ft(De==="self"?te:De)})),te.contains.forEach(function(De){je(De,le)}),te.starts&&je(te.starts,J),le.matcher=Le(le),le}if(C.compilerExtensions||(C.compilerExtensions=[]),C.contains&&C.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return C.classNameAliases=r(C.classNameAliases||{}),je(C)}function Tt(C){return C?C.endsWithParent||Tt(C.starts):!1}function Ft(C){return C.variants&&!C.cachedVariants&&(C.cachedVariants=C.variants.map(function(z){return r(C,{variants:null},z)})),C.cachedVariants?C.cachedVariants:Tt(C)?r(C,{starts:C.starts?r(C.starts):null}):Object.isFrozen(C)?r(C):C}var Ke="11.11.1";class Ct extends Error{constructor(z,Y){super(z),this.name="HTMLInjectionError",this.html=Y}}const Xe=n,bi=r,xi=Symbol("nomatch"),sl=7,yi=function(C){const z=Object.create(null),Y=Object.create(null),ce=[];let Le=!0;const je="Could not find the language '{}', did you forget to load/include a language module?",te={disableAutodetect:!0,name:"Plain text",contains:[]};let J={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(q){return J.noHighlightRe.test(q)}function Fe(q){let re=q.className+" ";re+=q.parentNode?q.parentNode.className:"";const xe=J.languageDetectRe.exec(re);if(xe){const Se=At(xe[1]);return Se||(fe(je.replace("{}",xe[1])),fe("Falling back to no-highlight mode for this block.",q)),Se?xe[1]:"no-highlight"}return re.split(/\s+/).find(Se=>le(Se)||At(Se))}function De(q,re,xe){let Se="",Be="";typeof re=="object"?(Se=q,xe=re.ignoreIllegals,Be=re.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`),Be=q,Se=re),xe===void 0&&(xe=!0);const ut={code:Se,language:Be};wn("before:highlight",ut);const Mt=ut.result?ut.result:sn(ut.language,ut.code,xe);return Mt.code=ut.code,wn("after:highlight",Mt),Mt}function sn(q,re,xe,Se){const Be=Object.create(null);function ut(X,ne){return X.keywords[ne]}function Mt(){if(!ue.keywords){ze.addText(Te);return}let X=0;ue.keywordPatternRe.lastIndex=0;let ne=ue.keywordPatternRe.exec(Te),me="";for(;ne;){me+=Te.substring(X,ne.index);const we=ft.case_insensitive?ne[0].toLowerCase():ne[0],Ue=ut(ue,we);if(Ue){const[kt,wl]=Ue;if(ze.addText(me),me="",Be[we]=(Be[we]||0)+1,Be[we]<=sl&&(Sn+=wl),kt.startsWith("_"))me+=ne[0];else{const _l=ft.classNameAliases[kt]||kt;pt(ne[0],_l)}}else me+=ne[0];X=ue.keywordPatternRe.lastIndex,ne=ue.keywordPatternRe.exec(Te)}me+=Te.substring(X),ze.addText(me)}function _n(){if(Te==="")return;let X=null;if(typeof ue.subLanguage=="string"){if(!z[ue.subLanguage]){ze.addText(Te);return}X=sn(ue.subLanguage,Te,!0,Ti[ue.subLanguage]),Ti[ue.subLanguage]=X._top}else X=tr(Te,ue.subLanguage.length?ue.subLanguage:null);ue.relevance>0&&(Sn+=X.relevance),ze.__addSublanguage(X._emitter,X.language)}function Ze(){ue.subLanguage!=null?_n():Mt(),Te=""}function pt(X,ne){X!==""&&(ze.startScope(ne),ze.addText(X),ze.endScope())}function wi(X,ne){let me=1;const we=ne.length-1;for(;me<=we;){if(!X._emit[me]){me++;continue}const Ue=ft.classNameAliases[X[me]]||X[me],kt=ne[me];Ue?pt(kt,Ue):(Te=kt,Mt(),Te=""),me++}}function _i(X,ne){return X.scope&&typeof X.scope=="string"&&ze.openNode(ft.classNameAliases[X.scope]||X.scope),X.beginScope&&(X.beginScope._wrap?(pt(Te,ft.classNameAliases[X.beginScope._wrap]||X.beginScope._wrap),Te=""):X.beginScope._multi&&(wi(X.beginScope,ne),Te="")),ue=Object.create(X,{parent:{value:ue}}),ue}function Ni(X,ne,me){let we=A(X.endRe,me);if(we){if(X["on:end"]){const Ue=new t(X);X["on:end"](ne,Ue),Ue.isMatchIgnored&&(we=!1)}if(we){for(;X.endsParent&&X.parent;)X=X.parent;return X}}if(X.endsWithParent)return Ni(X.parent,ne,me)}function xl(X){return ue.matcher.regexIndex===0?(Te+=X[0],1):(or=!0,0)}function yl(X){const ne=X[0],me=X.rule,we=new t(me),Ue=[me.__beforeBegin,me["on:begin"]];for(const kt of Ue)if(kt&&(kt(X,we),we.isMatchIgnored))return xl(ne);return me.skip?Te+=ne:(me.excludeBegin&&(Te+=ne),Ze(),!me.returnBegin&&!me.excludeBegin&&(Te=ne)),_i(me,X),me.returnBegin?0:ne.length}function vl(X){const ne=X[0],me=re.substring(X.index),we=Ni(ue,X,me);if(!we)return xi;const Ue=ue;ue.endScope&&ue.endScope._wrap?(Ze(),pt(ne,ue.endScope._wrap)):ue.endScope&&ue.endScope._multi?(Ze(),wi(ue.endScope,X)):Ue.skip?Te+=ne:(Ue.returnEnd||Ue.excludeEnd||(Te+=ne),Ze(),Ue.excludeEnd&&(Te=ne));do ue.scope&&ze.closeNode(),!ue.skip&&!ue.subLanguage&&(Sn+=ue.relevance),ue=ue.parent;while(ue!==we.parent);return we.starts&&_i(we.starts,X),Ue.returnEnd?0:ne.length}function El(){const X=[];for(let ne=ue;ne!==ft;ne=ne.parent)ne.scope&&X.unshift(ne.scope);X.forEach(ne=>ze.openNode(ne))}let Nn={};function Si(X,ne){const me=ne&&ne[0];if(Te+=X,me==null)return Ze(),0;if(Nn.type==="begin"&&ne.type==="end"&&Nn.index===ne.index&&me===""){if(Te+=re.slice(ne.index,ne.index+1),!Le){const we=new Error(`0 width match regex (${q})`);throw we.languageName=q,we.badRule=Nn.rule,we}return 1}if(Nn=ne,ne.type==="begin")return yl(ne);if(ne.type==="illegal"&&!xe){const we=new Error('Illegal lexeme "'+me+'" for mode "'+(ue.scope||"")+'"');throw we.mode=ue,we}else if(ne.type==="end"){const we=vl(ne);if(we!==xi)return we}if(ne.type==="illegal"&&me==="")return Te+=` -`,1;if(ir>1e5&&ir>ne.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Te+=me,me.length}const ft=At(q);if(!ft)throw Ie(je.replace("{}",q)),new Error('Unknown language: "'+q+'"');const kl=ct(ft);let rr="",ue=Se||kl;const Ti={},ze=new J.__emitter(J);El();let Te="",Sn=0,zt=0,ir=0,or=!1;try{if(ft.__emitTokens)ft.__emitTokens(re,ze);else{for(ue.matcher.considerAll();;){ir++,or?or=!1:ue.matcher.considerAll(),ue.matcher.lastIndex=zt;const X=ue.matcher.exec(re);if(!X)break;const ne=re.substring(zt,X.index),me=Si(ne,X);zt=X.index+me}Si(re.substring(zt))}return ze.finalize(),rr=ze.toHTML(),{language:q,value:rr,relevance:Sn,illegal:!1,_emitter:ze,_top:ue}}catch(X){if(X.message&&X.message.includes("Illegal"))return{language:q,value:Xe(re),illegal:!0,relevance:0,_illegalBy:{message:X.message,index:zt,context:re.slice(zt-100,zt+100),mode:X.mode,resultSoFar:rr},_emitter:ze};if(Le)return{language:q,value:Xe(re),illegal:!1,relevance:0,errorRaised:X,_emitter:ze,_top:ue};throw X}}function er(q){const re={value:Xe(q),illegal:!1,relevance:0,_top:te,_emitter:new J.__emitter(J)};return re._emitter.addText(q),re}function tr(q,re){re=re||J.languages||Object.keys(z);const xe=er(q),Se=re.filter(At).filter(ki).map(Ze=>sn(Ze,q,!1));Se.unshift(xe);const Be=Se.sort((Ze,pt)=>{if(Ze.relevance!==pt.relevance)return pt.relevance-Ze.relevance;if(Ze.language&&pt.language){if(At(Ze.language).supersetOf===pt.language)return 1;if(At(pt.language).supersetOf===Ze.language)return-1}return 0}),[ut,Mt]=Be,_n=ut;return _n.secondBest=Mt,_n}function al(q,re,xe){const Se=re&&Y[re]||xe;q.classList.add("hljs"),q.classList.add(`language-${Se}`)}function nr(q){let re=null;const xe=Fe(q);if(le(xe))return;if(wn("before:highlightElement",{el:q,language:xe}),q.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",q);return}if(q.children.length>0&&(J.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(q)),J.throwUnescapedHTML))throw new Ct("One of your code blocks includes unescaped HTML.",q.innerHTML);re=q;const Se=re.textContent,Be=xe?De(Se,{language:xe,ignoreIllegals:!0}):tr(Se);q.innerHTML=Be.value,q.dataset.highlighted="yes",al(q,xe,Be.language),q.result={language:Be.language,re:Be.relevance,relevance:Be.relevance},Be.secondBest&&(q.secondBest={language:Be.secondBest.language,relevance:Be.secondBest.relevance}),wn("after:highlightElement",{el:q,result:Be,text:Se})}function ll(q){J=bi(J,q)}const cl=()=>{kn(),P("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function ul(){kn(),P("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let vi=!1;function kn(){function q(){kn()}if(document.readyState==="loading"){vi||window.addEventListener("DOMContentLoaded",q,!1),vi=!0;return}document.querySelectorAll(J.cssSelector).forEach(nr)}function dl(q,re){let xe=null;try{xe=re(C)}catch(Se){if(Ie("Language definition for '{}' could not be registered.".replace("{}",q)),Le)Ie(Se);else throw Se;xe=te}xe.name||(xe.name=q),z[q]=xe,xe.rawDefinition=re.bind(null,C),xe.aliases&&Ei(xe.aliases,{languageName:q})}function pl(q){delete z[q];for(const re of Object.keys(Y))Y[re]===q&&delete Y[re]}function fl(){return Object.keys(z)}function At(q){return q=(q||"").toLowerCase(),z[q]||z[Y[q]]}function Ei(q,{languageName:re}){typeof q=="string"&&(q=[q]),q.forEach(xe=>{Y[xe.toLowerCase()]=re})}function ki(q){const re=At(q);return re&&!re.disableAutodetect}function ml(q){q["before:highlightBlock"]&&!q["before:highlightElement"]&&(q["before:highlightElement"]=re=>{q["before:highlightBlock"](Object.assign({block:re.el},re))}),q["after:highlightBlock"]&&!q["after:highlightElement"]&&(q["after:highlightElement"]=re=>{q["after:highlightBlock"](Object.assign({block:re.el},re))})}function hl(q){ml(q),ce.push(q)}function gl(q){const re=ce.indexOf(q);re!==-1&&ce.splice(re,1)}function wn(q,re){const xe=q;ce.forEach(function(Se){Se[xe]&&Se[xe](re)})}function bl(q){return P("10.7.0","highlightBlock will be removed entirely in v12.0"),P("10.7.0","Please use highlightElement now."),nr(q)}Object.assign(C,{highlight:De,highlightAuto:tr,highlightAll:kn,highlightElement:nr,highlightBlock:bl,configure:ll,initHighlighting:cl,initHighlightingOnLoad:ul,registerLanguage:dl,unregisterLanguage:pl,listLanguages:fl,getLanguage:At,registerAliases:Ei,autoDetection:ki,inherit:bi,addPlugin:hl,removePlugin:gl}),C.debugMode=function(){Le=!1},C.safeMode=function(){Le=!0},C.versionString=Ke,C.regex={concat:x,lookahead:m,either:b,optional:h,anyNumberOfTimes:f};for(const q in Oe)typeof Oe[q]=="object"&&e(Oe[q]);return Object.assign(C,Oe),C},Vt=yi({});return Vt.newInstance=()=>yi({}),Sr=Vt,Vt.HighlightJS=Vt,Vt.default=Vt,Sr}var Pg=Dg();const Bg=Gr(Pg),ss={},Fg="hljs-";function zg(e){const t=Bg.newInstance();return e&&s(e),{highlight:n,highlightAuto:r,listLanguages:i,register:s,registerAlias:o,registered:l};function n(u,c,d){const p=d||ss,m=typeof p.prefix=="string"?p.prefix:Fg;if(!t.getLanguage(u))throw new Error("Unknown language: `"+u+"` is not registered");t.configure({__emitter:Ug,classPrefix:m});const f=t.highlight(c,{ignoreIllegals:!0,language:u});if(f.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:f.errorRaised});const h=f._emitter.root,x=h.data;return x.language=f.language,x.relevance=f.relevance,h}function r(u,c){const p=(c||ss).subset||i();let m=-1,f=0,h;for(;++mf&&(f=v.data.relevance,h=v)}return h||{type:"root",children:[],data:{language:void 0,relevance:f}}}function i(){return t.listLanguages()}function s(u,c){if(typeof u=="string")t.registerLanguage(u,c);else{let d;for(d in u)Object.hasOwn(u,d)&&t.registerLanguage(d,u[d])}}function o(u,c){if(typeof u=="string")t.registerAliases(typeof c=="string"?c:[...c],{languageName:u});else{let d;for(d in u)if(Object.hasOwn(u,d)){const p=u[d];t.registerAliases(typeof p=="string"?p:[...p],{languageName:d})}}}function l(u){return!!t.getLanguage(u)}}class Ug{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const r=this.stack[this.stack.length-1],i=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(t){const n=this,r=t.split(".").map(function(o,l){return l?o+"_".repeat(l):n.options.classPrefix+o}),i=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const $g={};function Hg(e){const t=e||$g,n=t.aliases,r=t.detect||!1,i=t.languages||jg,s=t.plainText,o=t.prefix,l=t.subset;let u="hljs";const c=zg(i);if(n&&c.registerAlias(n),o){const d=o.indexOf("-");u=d===-1?o:o.slice(0,d)}return function(d,p){Qn(d,"element",function(m,f,h){if(m.tagName!=="code"||!h||h.type!=="element"||h.tagName!=="pre")return;const x=Wg(m);if(x===!1||!x&&!r||x&&s&&s.includes(x))return;Array.isArray(m.properties.className)||(m.properties.className=[]),m.properties.className.includes(u)||m.properties.className.unshift(u);const v=lh(m,{whitespace:"pre"});let b;try{b=x?c.highlight(x,v,{prefix:o}):c.highlightAuto(v,{prefix:o,subset:l})}catch(E){const A=E;if(x&&/Unknown language/.test(A.message)){p.message("Cannot highlight as `"+x+"`, it’s not registered",{ancestors:[h,m],cause:A,place:m.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw A}!x&&b.data&&b.data.language&&m.properties.className.push("language-"+b.data.language),b.children.length>0&&(m.children=b.children)})}}function Wg(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let r;for(;++n0?{type:"text",value:T}:void 0),T===!1?m.lastIndex=D+1:(h!==D&&E.push({type:"text",value:c.value.slice(h,D)}),Array.isArray(T)?E.push(...T):T&&E.push(T),h=D+A[0].length,b=!0),!m.global)break;A=m.exec(c.value)}return b?(h?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=as(e,"(");let s=as(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function Pa(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Wt(n)||Yn(n))&&(!t||n!==47)}Ba.peek=gb;function lb(){this.buffer()}function cb(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function ub(){this.buffer()}function db(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function pb(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=dt(this.sliceSerialize(e)).toLowerCase(),n.label=t}function fb(e){this.exit(e)}function mb(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=dt(this.sliceSerialize(e)).toLowerCase(),n.label=t}function hb(e){this.exit(e)}function gb(){return"["}function Ba(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const o=n.enter("footnoteReference"),l=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),l(),o(),s+=i.move("]"),s}function bb(){return{enter:{gfmFootnoteCallString:lb,gfmFootnoteCall:cb,gfmFootnoteDefinitionLabelString:ub,gfmFootnoteDefinition:db},exit:{gfmFootnoteCallString:pb,gfmFootnoteCall:fb,gfmFootnoteDefinitionLabelString:mb,gfmFootnoteDefinition:hb}}}function xb(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Ba},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,o){const l=s.createTracker(o);let u=l.move("[^");const c=s.enter("footnoteDefinition"),d=s.enter("label");return u+=l.move(s.safe(s.associationId(r),{before:u,after:"]"})),d(),u+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),u+=l.move((t?` -`:" ")+s.indentLines(s.containerFlow(r,l.current()),t?Fa:yb))),c(),u}}function yb(e,t,n){return t===0?e:Fa(e,t,n)}function Fa(e,t,n){return(n?"":" ")+e}const vb=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];za.peek=Nb;function Eb(){return{canContainEols:["delete"],enter:{strikethrough:wb},exit:{strikethrough:_b}}}function kb(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:vb}],handlers:{delete:za}}}function wb(e){this.enter({type:"delete",children:[]},e)}function _b(e){this.exit(e)}function za(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function Nb(){return"~"}function Sb(e){return e.length}function Tb(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Sb,s=[],o=[],l=[],u=[];let c=0,d=-1;for(;++dc&&(c=e[d].length);++bu[b])&&(u[b]=A)}x.push(E)}o[d]=x,l[d]=v}let p=-1;if(typeof r=="object"&&"length"in r)for(;++pu[p]&&(u[p]=E),f[p]=E),m[p]=A}o.splice(1,0,m),l.splice(1,0,f),d=-1;const h=[];for(;++d "),s.shift(2);const o=n.indentLines(n.containerFlow(e,s.current()),Mb);return i(),o}function Mb(e,t,n){return">"+(n?"":" ")+e}function Rb(e,t){return cs(e,t.inConstruct,!0)&&!cs(e,t.notInConstruct,!1)}function cs(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ro&&(o=s):s=1,i=r+t.length,r=n.indexOf(t,i);return o}function Ob(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Lb(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function jb(e,t,n,r){const i=Lb(n),s=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(Ob(e,n)){const p=n.enter("codeIndented"),m=n.indentLines(s,Db);return p(),m}const l=n.createTracker(r),u=i.repeat(Math.max(Ib(s,i)+1,3)),c=n.enter("codeFenced");let d=l.move(u);if(e.lang){const p=n.enter(`codeFencedLang${o}`);d+=l.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),p()}if(e.lang&&e.meta){const p=n.enter(`codeFencedMeta${o}`);d+=l.move(" "),d+=l.move(n.safe(e.meta,{before:d,after:` -`,encode:["`"],...l.current()})),p()}return d+=l.move(` -`),s&&(d+=l.move(s+` -`)),d+=l.move(u),c(),d}function Db(e,t,n){return(n?"":" ")+e}function mi(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Pb(e,t,n,r){const i=mi(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("definition");let l=n.enter("label");const u=n.createTracker(r);let c=u.move("[");return c+=u.move(n.safe(n.associationId(e),{before:c,after:"]",...u.current()})),c+=u.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=u.move("<"),c+=u.move(n.safe(e.url,{before:c,after:">",...u.current()})),c+=u.move(">")):(l=n.enter("destinationRaw"),c+=u.move(n.safe(e.url,{before:c,after:e.title?" ":` -`,...u.current()}))),l(),e.title&&(l=n.enter(`title${s}`),c+=u.move(" "+i),c+=u.move(n.safe(e.title,{before:c,after:i,...u.current()})),c+=u.move(i),l()),o(),c}function Bb(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function bn(e){return"&#x"+e.toString(16).toUpperCase()+";"}function qn(e,t,n){const r=nn(e),i=nn(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Ua.peek=Fb;function Ua(e,t,n,r){const i=Bb(n),s=n.enter("emphasis"),o=n.createTracker(r),l=o.move(i);let u=o.move(n.containerPhrasing(e,{after:i,before:l,...o.current()}));const c=u.charCodeAt(0),d=qn(r.before.charCodeAt(r.before.length-1),c,i);d.inside&&(u=bn(c)+u.slice(1));const p=u.charCodeAt(u.length-1),m=qn(r.after.charCodeAt(0),p,i);m.inside&&(u=u.slice(0,-1)+bn(p));const f=o.move(i);return s(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},l+u+f}function Fb(e,t,n){return n.options.emphasis||"*"}function zb(e,t){let n=!1;return Qn(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,zr}),!!((!e.depth||e.depth<3)&&ii(e)&&(t.options.setext||n))}function Ub(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(zb(e,n)){const d=n.enter("headingSetext"),p=n.enter("phrasing"),m=n.containerPhrasing(e,{...s.current(),before:` -`,after:` -`});return p(),d(),m+` -`+(i===1?"=":"-").repeat(m.length-(Math.max(m.lastIndexOf("\r"),m.lastIndexOf(` -`))+1))}const o="#".repeat(i),l=n.enter("headingAtx"),u=n.enter("phrasing");s.move(o+" ");let c=n.containerPhrasing(e,{before:"# ",after:` -`,...s.current()});return/^[\t ]/.test(c)&&(c=bn(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),u(),l(),c}$a.peek=$b;function $a(e){return e.value||""}function $b(){return"<"}Ha.peek=Hb;function Ha(e,t,n,r){const i=mi(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("image");let l=n.enter("label");const u=n.createTracker(r);let c=u.move("![");return c+=u.move(n.safe(e.alt,{before:c,after:"]",...u.current()})),c+=u.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=u.move("<"),c+=u.move(n.safe(e.url,{before:c,after:">",...u.current()})),c+=u.move(">")):(l=n.enter("destinationRaw"),c+=u.move(n.safe(e.url,{before:c,after:e.title?" ":")",...u.current()}))),l(),e.title&&(l=n.enter(`title${s}`),c+=u.move(" "+i),c+=u.move(n.safe(e.title,{before:c,after:i,...u.current()})),c+=u.move(i),l()),c+=u.move(")"),o(),c}function Hb(){return"!"}Wa.peek=Wb;function Wa(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let o=n.enter("label");const l=n.createTracker(r);let u=l.move("![");const c=n.safe(e.alt,{before:u,after:"]",...l.current()});u+=l.move(c+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const p=n.safe(n.associationId(e),{before:u,after:"]",...l.current()});return o(),n.stack=d,s(),i==="full"||!c||c!==p?u+=l.move(p+"]"):i==="shortcut"?u=u.slice(0,-1):u+=l.move("]"),u}function Wb(){return"!"}Ka.peek=Kb;function Ka(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s\u007F]/.test(e.url))}qa.peek=Gb;function qa(e,t,n,r){const i=mi(n),s=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let l,u;if(Ga(e,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let p=o.move("<");return p+=o.move(n.containerPhrasing(e,{before:p,after:">",...o.current()})),p+=o.move(">"),l(),n.stack=d,p}l=n.enter("link"),u=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(e,{before:c,after:"](",...o.current()})),c+=o.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(e.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(u=n.enter("destinationRaw"),c+=o.move(n.safe(e.url,{before:c,after:e.title?" ":")",...o.current()}))),u(),e.title&&(u=n.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(n.safe(e.title,{before:c,after:i,...o.current()})),c+=o.move(i),u()),c+=o.move(")"),l(),c}function Gb(e,t,n){return Ga(e,n)?"<":"["}Va.peek=qb;function Va(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let o=n.enter("label");const l=n.createTracker(r);let u=l.move("[");const c=n.containerPhrasing(e,{before:u,after:"]",...l.current()});u+=l.move(c+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const p=n.safe(n.associationId(e),{before:u,after:"]",...l.current()});return o(),n.stack=d,s(),i==="full"||!c||c!==p?u+=l.move(p+"]"):i==="shortcut"?u=u.slice(0,-1):u+=l.move("]"),u}function qb(){return"["}function hi(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Vb(e){const t=hi(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Yb(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Ya(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Xb(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let o=e.ordered?Yb(n):hi(n);const l=e.ordered?o==="."?")":".":Vb(n);let u=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(u=!0),Ya(n)===o&&d){let p=-1;for(;++p-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=n.createTracker(r);l.move(s+" ".repeat(o-s.length)),l.shift(o);const u=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,l.current()),d);return u(),c;function d(p,m,f){return m?(f?"":" ".repeat(o))+p:(f?s:s+" ".repeat(o-s.length))+p}}function Qb(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(e,r);return s(),i(),o}const ex=vn(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function tx(e,t,n,r){return(e.children.some(function(o){return ex(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function nx(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Xa.peek=rx;function Xa(e,t,n,r){const i=nx(n),s=n.enter("strong"),o=n.createTracker(r),l=o.move(i+i);let u=o.move(n.containerPhrasing(e,{after:i,before:l,...o.current()}));const c=u.charCodeAt(0),d=qn(r.before.charCodeAt(r.before.length-1),c,i);d.inside&&(u=bn(c)+u.slice(1));const p=u.charCodeAt(u.length-1),m=qn(r.after.charCodeAt(0),p,i);m.inside&&(u=u.slice(0,-1)+bn(p));const f=o.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},l+u+f}function rx(e,t,n){return n.options.strong||"*"}function ix(e,t,n,r){return n.safe(e.value,r)}function ox(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function sx(e,t,n){const r=(Ya(n)+(n.options.ruleSpaces?" ":"")).repeat(ox(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Za={blockquote:Ab,break:us,code:jb,definition:Pb,emphasis:Ua,hardBreak:us,heading:Ub,html:$a,image:Ha,imageReference:Wa,inlineCode:Ka,link:qa,linkReference:Va,list:Xb,listItem:Jb,paragraph:Qb,root:tx,strong:Xa,text:ix,thematicBreak:sx};function ax(){return{enter:{table:lx,tableData:ds,tableHeader:ds,tableRow:ux},exit:{codeText:dx,table:cx,tableData:Mr,tableHeader:Mr,tableRow:Mr}}}function lx(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function cx(e){this.exit(e),this.data.inTable=void 0}function ux(e){this.enter({type:"tableRow",children:[]},e)}function Mr(e){this.exit(e)}function ds(e){this.enter({type:"tableCell",children:[]},e)}function dx(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,px));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function px(e,t){return t==="|"?t:e}function fx(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` -`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:o,tableCell:u,tableRow:l}};function o(f,h,x,v){return c(d(f,x,v),f.align)}function l(f,h,x,v){const b=p(f,x,v),E=c([b]);return E.slice(0,E.indexOf(` -`))}function u(f,h,x,v){const b=x.enter("tableCell"),E=x.enter("phrasing"),A=x.containerPhrasing(f,{...v,before:s,after:s});return E(),b(),A}function c(f,h){return Tb(f,{align:h,alignDelimiters:r,padding:n,stringLength:i})}function d(f,h,x){const v=f.children;let b=-1;const E=[],A=h.enter("table");for(;++b0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Rx={tokenize:Fx,partial:!0};function Ix(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Dx,continuation:{tokenize:Px},exit:Bx}},text:{91:{name:"gfmFootnoteCall",tokenize:jx},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Ox,resolveTo:Lx}}}}function Ox(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const u=r.events[i][1];if(u.type==="labelImage"){o=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return l;function l(u){if(!o||!o._balanced)return n(u);const c=dt(r.sliceSerialize({start:o.end,end:r.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?n(u):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),t(u))}}function Lx(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function jx(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,o;return l;function l(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),u}function u(p){return p!==94?n(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(p){if(s>999||p===93&&!o||p===null||p===91||Ne(p))return n(p);if(p===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return i.includes(dt(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return Ne(p)||(o=!0),s++,e.consume(p),p===92?d:c}function d(p){return p===91||p===92||p===93?(e.consume(p),s++,c):c(p)}}function Dx(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,l;return u;function u(h){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(h){return h===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(h)}function d(h){if(o>999||h===93&&!l||h===null||h===91||Ne(h))return n(h);if(h===93){e.exit("chunkString");const x=e.exit("gfmFootnoteDefinitionLabelString");return s=dt(r.sliceSerialize(x)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return Ne(h)||(l=!0),o++,e.consume(h),h===92?p:d}function p(h){return h===91||h===92||h===93?(e.consume(h),o++,d):d(h)}function m(h){return h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),i.includes(s)||i.push(s),ve(e,f,"gfmFootnoteDefinitionWhitespace")):n(h)}function f(h){return t(h)}}function Px(e,t,n){return e.check(yn,t,e.attempt(Rx,t,n))}function Bx(e){e.exit("gfmFootnoteDefinition")}function Fx(e,t,n){const r=this;return ve(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):n(s)}}function zx(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,l){let u=-1;for(;++u1?u(h):(o.consume(h),p++,f);if(p<2&&!n)return u(h);const v=o.exit("strikethroughSequenceTemporary"),b=nn(h);return v._open=!b||b===2&&!!x,v._close=!x||x===2&&!!b,l(h)}}}class Ux{constructor(){this.map=[]}add(t,n,r){$x(this,t,n,r)}consume(t){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function $x(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i-1;){const _=r.events[M][1].type;if(_==="lineEnding"||_==="linePrefix")M--;else break}const I=M>-1?r.events[M][1].type:null,j=I==="tableHead"||I==="tableRow"?T:u;return j===T&&r.parser.lazy[r.now().line]?n(w):j(w)}function u(w){return e.enter("tableHead"),e.enter("tableRow"),c(w)}function c(w){return w===124||(o=!0,s+=1),d(w)}function d(w){return w===null?n(w):oe(w)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),f):n(w):ge(w)?ve(e,d,"whitespace")(w):(s+=1,o&&(o=!1,i+=1),w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),p(w)))}function p(w){return w===null||w===124||Ne(w)?(e.exit("data"),d(w)):(e.consume(w),w===92?m:p)}function m(w){return w===92||w===124?(e.consume(w),p):p(w)}function f(w){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(w):(e.enter("tableDelimiterRow"),o=!1,ge(w)?ve(e,h,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):h(w))}function h(w){return w===45||w===58?v(w):w===124?(o=!0,e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),x):L(w)}function x(w){return ge(w)?ve(e,v,"whitespace")(w):v(w)}function v(w){return w===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),b):w===45?(s+=1,b(w)):w===null||oe(w)?D(w):L(w)}function b(w){return w===45?(e.enter("tableDelimiterFiller"),E(w)):L(w)}function E(w){return w===45?(e.consume(w),E):w===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(w),e.exit("tableDelimiterMarker"),A):(e.exit("tableDelimiterFiller"),A(w))}function A(w){return ge(w)?ve(e,D,"whitespace")(w):D(w)}function D(w){return w===124?h(w):w===null||oe(w)?!o||i!==s?L(w):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(w)):L(w)}function L(w){return n(w)}function T(w){return e.enter("tableRow"),B(w)}function B(w){return w===124?(e.enter("tableCellDivider"),e.consume(w),e.exit("tableCellDivider"),B):w===null||oe(w)?(e.exit("tableRow"),t(w)):ge(w)?ve(e,B,"whitespace")(w):(e.enter("data"),O(w))}function O(w){return w===null||w===124||Ne(w)?(e.exit("data"),B(w)):(e.consume(w),w===92?k:O)}function k(w){return w===92||w===124?(e.consume(w),O):O(w)}}function Gx(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],l=!1,u=0,c,d,p;const m=new Ux;for(;++nn[2]+1){const h=n[2]+1,x=n[3]-n[2]-1;e.add(h,x,[])}}e.add(n[3]+1,0,[["exit",p,t]])}return i!==void 0&&(s.end=Object.assign({},Qt(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function fs(e,t,n,r,i){const s=[],o=Qt(t.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function Qt(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const qx={name:"tasklistCheck",tokenize:Yx};function Vx(){return{text:{91:qx}}}function Yx(e,t,n){const r=this;return i;function i(u){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(u):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),s)}function s(u){return Ne(u)?(e.enter("taskListCheckValueUnchecked"),e.consume(u),e.exit("taskListCheckValueUnchecked"),o):u===88||u===120?(e.enter("taskListCheckValueChecked"),e.consume(u),e.exit("taskListCheckValueChecked"),o):n(u)}function o(u){return u===93?(e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(u)}function l(u){return oe(u)?t(u):ge(u)?e.check({tokenize:Xx},t,n)(u):n(u)}}function Xx(e,t,n){return ve(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function Zx(e){return Ys([kx(),Ix(),zx(e),Wx(),Vx()])}const Jx={};function Qx(e){const t=this,n=e||Jx,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Zx(n)),s.push(xx()),o.push(yx(n))}const ey={user:{label:"You",color:"var(--info)"},assistant:{label:"AI",color:"var(--success)"},tool:{label:"Tool",color:"var(--warning)"},plan:{label:"Plan",color:"var(--accent)"},thinking:{label:"Reasoning",color:"var(--text-muted)"}};function ty({message:e}){const[t,n]=S.useState(!1);return a.jsxs("div",{className:"py-1.5",children:[a.jsxs("button",{onClick:()=>n(!t),className:"flex items-center gap-1.5 mb-0.5 cursor-pointer",style:{background:"none",border:"none",padding:0},children:[a.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:"var(--text-muted)",opacity:.5}}),a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-muted)"},children:"Reasoning"}),a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-muted)",strokeWidth:"2",style:{transform:t?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.15s",marginLeft:2},children:a.jsx("path",{d:"M6 9l6 6 6-6"})})]}),t&&a.jsx("div",{className:"text-[12px] leading-relaxed pl-2.5 max-w-prose whitespace-pre-wrap",style:{color:"var(--text-muted)",fontStyle:"italic"},children:e.content})]})}function ny({message:e}){const t=e.planItems??[];return a.jsxs("div",{className:"py-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[a.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:"var(--accent)"}}),a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--accent)"},children:"Plan"})]}),a.jsx("div",{className:"pl-2.5 space-y-1 mt-1",children:t.map((n,r)=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[n.status==="completed"?a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--success)",strokeWidth:"2.5",strokeLinecap:"round",children:a.jsx("path",{d:"M20 6L9 17l-5-5"})}):n.status==="in_progress"?a.jsx("span",{className:"w-3.5 h-3.5 flex items-center justify-center",children:a.jsx("span",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"var(--accent)"}})}):a.jsx("span",{className:"w-3.5 h-3.5 flex items-center justify-center",children:a.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:"var(--text-muted)",opacity:.4}})}),a.jsx("span",{style:{color:n.status==="completed"?"var(--text-muted)":"var(--text-primary)",textDecoration:n.status==="completed"?"line-through":"none"},children:n.title})]},r))})]})}function ry({tc:e}){const t=e.status==="pending",n=e.status==="denied",[r,i]=S.useState(!1),s=e.result!==void 0,o=c=>{if(!e.tool_call_id)return;const d=rt.getState().sessionId;d&&(rt.getState().resolveToolApproval(e.tool_call_id,c),Xr().sendToolApproval(d,e.tool_call_id,c))};if(t)return a.jsxs("div",{className:"ml-2.5 rounded-lg overflow-hidden",style:{border:"1px solid color-mix(in srgb, var(--warning) 40%, var(--border))"},children:[a.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:[a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--warning)"},children:"Action Required"}),a.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:e.tool})]}),e.args!=null&&a.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:JSON.stringify(e.args,null,2)}),a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{background:"var(--bg-secondary)",borderTop:"1px solid var(--border)"},children:[a.jsx("button",{onClick:()=>o(!0),className:"text-xs font-semibold px-3 py-1.5 rounded cursor-pointer transition-colors",style:{background:"color-mix(in srgb, var(--success) 15%, var(--bg-secondary))",color:"var(--success)",border:"1px solid color-mix(in srgb, var(--success) 30%, var(--border))"},onMouseEnter:c=>{c.currentTarget.style.background="color-mix(in srgb, var(--success) 25%, var(--bg-secondary))"},onMouseLeave:c=>{c.currentTarget.style.background="color-mix(in srgb, var(--success) 15%, var(--bg-secondary))"},children:"Approve"}),a.jsx("button",{onClick:()=>o(!1),className:"text-xs font-semibold px-3 py-1.5 rounded cursor-pointer transition-colors",style:{background:"color-mix(in srgb, var(--error) 15%, var(--bg-secondary))",color:"var(--error)",border:"1px solid color-mix(in srgb, var(--error) 30%, var(--border))"},onMouseEnter:c=>{c.currentTarget.style.background="color-mix(in srgb, var(--error) 25%, var(--bg-secondary))"},onMouseLeave:c=>{c.currentTarget.style.background="color-mix(in srgb, var(--error) 15%, var(--bg-secondary))"},children:"Reject"})]})]});const l=n?"var(--error)":s?e.is_error?"var(--error)":"var(--success)":"var(--text-muted)",u=n?"✗":s?e.is_error?"✗":"✓":"•";return a.jsxs("div",{className:"pl-2.5",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsxs("button",{onClick:()=>i(!r),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:l},children:[u," ",e.tool,n&&a.jsx("span",{className:"ml-1 text-[10px] uppercase",children:"Denied"}),a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:r?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.15s",marginLeft:2},children:a.jsx("path",{d:"M6 9l6 6 6-6"})})]})}),r&&a.jsxs("div",{className:"mt-1.5 space-y-2",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-[10px] uppercase tracking-wider mb-1 font-semibold",style:{color:"var(--text-muted)"},children:"Arguments"}),a.jsx("pre",{className:"text-[11px] font-mono p-2 rounded overflow-x-auto whitespace-pre-wrap",style:{background:"var(--bg-primary)",color:"var(--text-secondary)"},children:JSON.stringify(e.args,null,2)})]}),s&&a.jsxs("div",{children:[a.jsx("div",{className:"text-[10px] uppercase tracking-wider mb-1 font-semibold",style:{color:e.is_error?"var(--error)":"var(--text-muted)"},children:e.is_error?"Error":"Result"}),a.jsx("pre",{className:"text-[11px] font-mono p-2 rounded overflow-x-auto whitespace-pre-wrap max-h-48 overflow-y-auto",style:{background:"var(--bg-primary)",color:e.is_error?"var(--error)":"var(--text-secondary)"},children:e.result})]})]})]})}const ms=3;function iy({message:e}){const t=e.toolCalls??(e.toolCall?[e.toolCall]:[]),[n,r]=S.useState(!1);if(t.length===0)return null;const i=t.length-ms,s=i>0&&!n,o=s?t.slice(-ms):t;return a.jsxs("div",{className:"py-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[a.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:"var(--warning)"}}),a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--warning)"},children:t.length===1?"Tool":`Tools (${t.length})`})]}),a.jsxs("div",{className:"space-y-1",children:[s&&a.jsxs("button",{onClick:()=>r(!0),className:"ml-2.5 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:"var(--text-muted)"},children:[i," more tool ",i===1?"call":"calls",a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:2},children:a.jsx("path",{d:"M6 9l6 6 6-6"})})]}),o.map((l,u)=>a.jsx(ry,{tc:l},s?u+i:u))]})]})}function oy({message:e}){if(e.role==="thinking")return a.jsx(ty,{message:e});if(e.role==="plan")return a.jsx(ny,{message:e});if(e.role==="tool")return a.jsx(iy,{message:e});const t=e.role==="user"?"user":"assistant",n=ey[t];return a.jsxs("div",{className:"py-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[a.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:n.color}}),a.jsx("span",{className:"text-[11px] font-semibold",style:{color:n.color},children:n.label})]}),e.content&&(e.role==="user"?a.jsx("div",{className:"text-sm leading-relaxed pl-2.5 max-w-prose",style:{color:"var(--text-primary)"},children:e.content}):a.jsx("div",{className:"text-sm leading-relaxed pl-2.5 max-w-prose chat-markdown",style:{color:"var(--text-secondary)"},children:a.jsx(Zm,{remarkPlugins:[Qx],rehypePlugins:[Hg],children:e.content})}))]})}function sy(){const e=S.useRef(Xr()).current,[t,n]=S.useState(""),r=S.useRef(null),i=S.useRef(!0),s=zn(y=>y.enabled),o=zn(y=>y.status),l=!s||o==="authenticated",{sessionId:u,status:c,messages:d,models:p,selectedModel:m,modelsLoading:f,skills:h,selectedSkillIds:x,skillsLoading:v,setModels:b,setSelectedModel:E,setModelsLoading:A,setSkills:D,setSelectedSkillIds:L,toggleSkill:T,setSkillsLoading:B,addUserMessage:O,clearSession:k}=rt();S.useEffect(()=>{l&&(p.length>0||(A(!0),Bu().then(y=>{if(b(y),y.length>0&&!m){const Q=y.find(se=>se.model_name.includes("claude"));E(Q?Q.model_name:y[0].model_name)}}).catch(console.error).finally(()=>A(!1))))},[l,p.length,m,b,E,A]),S.useEffect(()=>{h.length>0||(B(!0),Fu().then(y=>{D(y),L(y.map(Q=>Q.id))}).catch(console.error).finally(()=>B(!1)))},[h.length,D,L,B]);const[w,M]=S.useState(!1),I=()=>{const y=r.current;if(!y)return;const Q=y.scrollHeight-y.scrollTop-y.clientHeight<40;i.current=Q,M(y.scrollTop>100)};S.useEffect(()=>{i.current&&r.current&&(r.current.scrollTop=r.current.scrollHeight)});const j=c==="thinking"||c==="executing"||c==="planning",_=d[d.length-1],N=j&&(_==null?void 0:_.role)==="assistant"&&!_.done,R=j&&!N,W=S.useRef(null),$=()=>{const y=W.current;y&&(y.style.height="auto",y.style.height=Math.min(y.scrollHeight,200)+"px")},V=S.useCallback(()=>{const y=t.trim();!y||!m||j||(i.current=!0,O(y),e.sendAgentMessage(y,m,u,x),n(""),requestAnimationFrame(()=>{const Q=W.current;Q&&(Q.style.height="auto")}))},[t,m,j,u,x,O,e]),g=S.useCallback(()=>{u&&e.sendAgentStop(u)},[u,e]),F=y=>{y.key==="Enter"&&!y.shiftKey&&(y.preventDefault(),V())},U=!j&&!!m&&t.trim().length>0;return l?a.jsxs("div",{className:"flex flex-col h-full",style:{background:"var(--bg-primary)"},children:[a.jsx(hs,{selectedModel:m,models:p,modelsLoading:f,onModelChange:E,skills:h,selectedSkillIds:x,skillsLoading:v,onToggleSkill:T,onClear:k,onStop:g,hasMessages:d.length>0,isBusy:j}),a.jsxs("div",{className:"relative flex-1 overflow-hidden",children:[a.jsxs("div",{ref:r,onScroll:I,className:"h-full overflow-y-auto px-3 py-2 space-y-0.5",children:[d.length===0&&a.jsxs("div",{className:"flex flex-col items-center justify-center py-10 px-4 gap-3",style:{color:"var(--text-muted)"},children:[a.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.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"})}),a.jsxs("div",{className:"text-center space-y-1.5",children:[a.jsx("p",{className:"text-sm font-medium",style:{color:"var(--text-secondary)"},children:"Ask the agent to help you code"}),a.jsxs("p",{className:"text-xs leading-relaxed",children:["Create agents, functions, evaluations,",a.jsx("br",{}),"or ask questions about your project."]})]})]}),d.map(y=>a.jsx(oy,{message:y},y.id)),R&&a.jsx("div",{className:"py-1.5",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"var(--success)"}}),a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--success)"},children:c==="thinking"?"Thinking...":c==="executing"?"Executing...":"Planning..."})]})})]}),w&&a.jsx("button",{onClick:()=>{var y;i.current=!1,(y=r.current)==null||y.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:a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"18 15 12 9 6 15"})})})]}),a.jsxs("div",{className:"flex items-end gap-2 px-3 py-2 border-t",style:{borderColor:"var(--border)"},children:[a.jsx("textarea",{ref:W,value:t,onChange:y=>{n(y.target.value),$()},onKeyDown:F,disabled:j||!m,placeholder:j?"Waiting for response...":"Message...",rows:2,className:"flex-1 bg-transparent text-sm py-1 disabled:opacity-40 placeholder:text-[var(--text-muted)] resize-none",style:{color:"var(--text-primary)",maxHeight:200,overflow:"auto"}}),a.jsx("button",{onClick:V,disabled:!U,className:"text-xs font-semibold px-3 py-1.5 rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed shrink-0","aria-label":"Send message",style:{color:U?"var(--accent)":"var(--text-muted)",background:"transparent"},onMouseEnter:y=>{U&&(y.currentTarget.style.background="color-mix(in srgb, var(--accent) 10%, transparent)")},onMouseLeave:y=>{y.currentTarget.style.background="transparent"},children:"Send"})]})]}):a.jsxs("div",{className:"flex flex-col h-full",style:{background:"var(--bg-primary)"},children:[a.jsx(hs,{selectedModel:m,models:p,modelsLoading:f,onModelChange:E,skills:h,selectedSkillIds:x,skillsLoading:v,onToggleSkill:T,onClear:k,onStop:g,hasMessages:!1,isBusy:!1}),a.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:a.jsxs("div",{className:"text-center",style:{color:"var(--text-muted)"},children:[a.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"mx-auto mb-2",strokeLinecap:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),a.jsx("p",{className:"text-sm font-medium mb-1",children:"Sign in to use Agent"}),a.jsx("p",{className:"text-xs",children:"Authentication is required to access the coding agent."})]})})]})}function hs({selectedModel:e,models:t,modelsLoading:n,onModelChange:r,skills:i,selectedSkillIds:s,skillsLoading:o,onToggleSkill:l,onClear:u,onStop:c,hasMessages:d,isBusy:p}){const[m,f]=S.useState(!1),h=S.useRef(null);return S.useEffect(()=>{if(!m)return;const x=v=>{h.current&&!h.current.contains(v.target)&&f(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[m]),a.jsxs("div",{className:"shrink-0 flex items-center gap-2 px-3 h-10 border-b",style:{borderColor:"var(--border)",background:"var(--bg-primary)"},children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wider font-semibold shrink-0",style:{color:"var(--text-muted)"},children:"Agent"}),a.jsxs("select",{value:e??"",onChange:x=>r(x.target.value),className:"flex-1 text-[11px] rounded px-1.5 py-1 outline-none min-w-0 cursor-pointer",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)",color:"var(--text-primary)"},disabled:n,children:[n&&a.jsx("option",{value:"",children:"Loading models..."}),!n&&t.length===0&&a.jsx("option",{value:"",children:"No models"}),t.map(x=>a.jsx("option",{value:x.model_name,children:x.model_name},x.model_name))]}),!o&&i.length>0&&a.jsxs("div",{className:"relative shrink-0",ref:h,children:[a.jsxs("button",{onClick:()=>f(!m),className:"text-[11px] font-semibold px-2 py-1 rounded cursor-pointer flex items-center gap-1",style:{background:s.length>0?"color-mix(in srgb, var(--accent) 15%, transparent)":"transparent",border:`1px solid ${s.length>0?"var(--accent)":"var(--border)"}`,color:s.length>0?"var(--accent)":"var(--text-muted)"},title:"Skills",children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"}),a.jsx("path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"})]}),s.length>0&&a.jsx("span",{children:s.length})]}),m&&a.jsx("div",{className:"absolute top-full right-0 mt-1 rounded shadow-lg z-50 py-1 max-h-64 overflow-y-auto",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)",width:"190px"},children:i.map(x=>a.jsxs("button",{onClick:()=>l(x.id),className:"w-full text-left px-2 py-1 text-[11px] flex items-center gap-1.5 cursor-pointer",style:{color:"var(--text-primary)"},title:x.description,onMouseEnter:v=>{v.currentTarget.style.background="var(--bg-tertiary)"},onMouseLeave:v=>{v.currentTarget.style.background="transparent"},children:[a.jsx("span",{className:"w-3 h-3 rounded border flex items-center justify-center shrink-0",style:{borderColor:s.includes(x.id)?"var(--accent)":"var(--border)",background:s.includes(x.id)?"var(--accent)":"transparent"},children:s.includes(x.id)&&a.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})}),a.jsx("span",{className:"truncate",children:x.name})]},x.id))})]}),p&&a.jsx("button",{onClick:c,className:"shrink-0 text-[11px] font-semibold px-2 py-1 rounded cursor-pointer",style:{background:"transparent",border:"1px solid var(--error)",color:"var(--error)"},title:"Stop",onMouseEnter:x=>{x.currentTarget.style.background="color-mix(in srgb, var(--error) 10%, transparent)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent"},children:"Stop"}),d&&!p&&a.jsx("button",{onClick:u,className:"shrink-0 w-6 h-6 flex items-center justify-center rounded cursor-pointer",style:{background:"transparent",border:"none",color:"var(--text-muted)"},title:"New session",onMouseEnter:x=>{x.currentTarget.style.color="var(--text-primary)"},onMouseLeave:x=>{x.currentTarget.style.color="var(--text-muted)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"1 4 1 10 7 10"}),a.jsx("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]})})]})}function ay(){const e=Yl(),t=ic(),[n,r]=S.useState(!1),[i,s]=S.useState(248),[o,l]=S.useState(!1),[u,c]=S.useState(380),[d,p]=S.useState(!1),{runs:m,selectedRunId:f,setRuns:h,upsertRun:x,selectRun:v,setTraces:b,setLogs:E,setChatMessages:A,setEntrypoints:D,setStateEvents:L,setGraphCache:T,setActiveNode:B,removeActiveNode:O}=Ee(),{section:k,view:w,runId:M,setupEntrypoint:I,setupMode:j,evalCreating:_,evalSetId:N,evalRunId:R,evalRunItemName:W,evaluatorCreateType:$,evaluatorId:V,evaluatorFilter:g,explorerFile:F,navigate:U}=st(),{setEvalSets:y,setEvaluators:Q,setLocalEvaluators:se,setEvalRuns:K}=Ae();S.useEffect(()=>{k==="debug"&&w==="details"&&M&&M!==f&&v(M)},[k,w,M,f,v]);const ie=zn(Z=>Z.init),de=bs(Z=>Z.init);S.useEffect(()=>{Ql().then(h).catch(console.error),ys().then(Z=>D(Z.map(he=>he.name))).catch(console.error),ie(),de()},[h,D,ie,de]),S.useEffect(()=>{k==="evals"&&(vs().then(Z=>y(Z)).catch(console.error),fc().then(Z=>K(Z)).catch(console.error)),(k==="evals"||k==="evaluators")&&(ac().then(Z=>Q(Z)).catch(console.error),Zr().then(Z=>se(Z)).catch(console.error))},[k,y,Q,se,K]);const be=Ae(Z=>Z.evalSets),Oe=Ae(Z=>Z.evalRuns);S.useEffect(()=>{if(k!=="evals"||_||N||R)return;const Z=Object.values(Oe).sort((Ie,fe)=>new Date(fe.start_time??0).getTime()-new Date(Ie.start_time??0).getTime());if(Z.length>0){U(`#/evals/runs/${Z[0].id}`);return}const he=Object.values(be);he.length>0&&U(`#/evals/sets/${he[0].id}`)},[k,_,N,R,Oe,be,U]),S.useEffect(()=>{const Z=he=>{he.key==="Escape"&&n&&r(!1)};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[n]);const Re=f?m[f]:null,at=S.useCallback((Z,he)=>{x(he),b(Z,he.traces),E(Z,he.logs);const Ie=he.messages.map(fe=>{const P=fe.contentParts??fe.content_parts??[],H=fe.toolCalls??fe.tool_calls??[];return{message_id:fe.messageId??fe.message_id,role:fe.role??"assistant",content:P.filter(ee=>{const ae=ee.mimeType??ee.mime_type??"";return ae.startsWith("text/")||ae==="application/json"}).map(ee=>{const ae=ee.data;return(ae==null?void 0:ae.inline)??""}).join(` -`).trim()??"",tool_calls:H.length>0?H.map(ee=>({name:ee.name??"",has_result:!!ee.result})):void 0}});if(A(Z,Ie),he.graph&&he.graph.nodes.length>0&&T(Z,he.graph),he.states&&he.states.length>0&&(L(Z,he.states.map(fe=>({node_name:fe.node_name,qualified_node_name:fe.qualified_node_name,phase:fe.phase,timestamp:new Date(fe.timestamp).getTime(),payload:fe.payload}))),he.status!=="completed"&&he.status!=="failed"))for(const fe of he.states)fe.phase==="started"?B(Z,fe.node_name,fe.qualified_node_name):fe.phase==="completed"&&O(Z,fe.node_name)},[x,b,E,A,L,T,B,O]);S.useEffect(()=>{if(!f)return;e.subscribe(f),ar(f).then(he=>at(f,he)).catch(console.error);const Z=setTimeout(()=>{const he=Ee.getState().runs[f];he&&(he.status==="pending"||he.status==="running")&&ar(f).then(Ie=>at(f,Ie)).catch(console.error)},2e3);return()=>{clearTimeout(Z),e.unsubscribe(f)}},[f,e,at]);const St=S.useRef(null);S.useEffect(()=>{var Ie,fe;if(!f)return;const Z=Re==null?void 0:Re.status,he=St.current;if(St.current=Z??null,Z&&(Z==="completed"||Z==="failed")&&he!==Z){const P=Ee.getState(),H=((Ie=P.traces[f])==null?void 0:Ie.length)??0,ee=((fe=P.logs[f])==null?void 0:fe.length)??0,ae=(Re==null?void 0:Re.trace_count)??0,ke=(Re==null?void 0:Re.log_count)??0;(Hat(f,We)).catch(console.error)}},[f,Re==null?void 0:Re.status,at]);const Pt=Z=>{U(`#/debug/runs/${Z}/traces`),v(Z),r(!1)},yt=Z=>{U(`#/debug/runs/${Z}/traces`),v(Z),r(!1)},ye=()=>{U("#/debug/new"),r(!1)},lt=Z=>{Z==="debug"?U("#/debug/new"):Z==="evals"?U("#/evals"):Z==="evaluators"?U("#/evaluators"):Z==="explorer"&&U("#/explorer")},nt=S.useCallback(Z=>{Z.preventDefault(),l(!0);const he="touches"in Z?Z.touches[0].clientX:Z.clientX,Ie=i,fe=H=>{const ee="touches"in H?H.touches[0].clientX:H.clientX,ae=Math.max(200,Math.min(480,Ie+(ee-he)));s(ae)},P=()=>{l(!1),document.removeEventListener("mousemove",fe),document.removeEventListener("mouseup",P),document.removeEventListener("touchmove",fe),document.removeEventListener("touchend",P),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",fe),document.addEventListener("mouseup",P),document.addEventListener("touchmove",fe,{passive:!1}),document.addEventListener("touchend",P)},[i]),vt=S.useCallback(Z=>{Z.preventDefault(),p(!0);const he="touches"in Z?Z.touches[0].clientX:Z.clientX,Ie=u,fe=H=>{const ee="touches"in H?H.touches[0].clientX:H.clientX,ae=Math.max(280,Math.min(500,Ie-(ee-he)));c(ae)},P=()=>{p(!1),document.removeEventListener("mousemove",fe),document.removeEventListener("mouseup",P),document.removeEventListener("touchmove",fe),document.removeEventListener("touchend",P),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",fe),document.addEventListener("mouseup",P),document.addEventListener("touchmove",fe,{passive:!1}),document.addEventListener("touchend",P)},[u]),Bt=Me(Z=>Z.openTabs),qt=()=>k==="explorer"?Bt.length>0||F?a.jsx(Pu,{}):a.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)]",children:"Select a file to view"}):k==="evals"?_?a.jsx(ao,{}):R?a.jsx(Eu,{evalRunId:R,itemName:W}):N?a.jsx(bu,{evalSetId:N}):a.jsx(ao,{}):k==="evaluators"?$?a.jsx(Lu,{category:$}):a.jsx(Mu,{evaluatorId:V,evaluatorFilter:g}):w==="new"?a.jsx(wc,{}):w==="setup"&&I&&j?a.jsx(Vc,{entrypoint:I,mode:j,ws:e,onRunCreated:Pt,isMobile:t}):Re?a.jsx(fu,{run:Re,ws:e,isMobile:t}):a.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)]",children:"Select a run or create a new one"});return t?a.jsxs("div",{className:"flex flex-col h-screen w-screen",children:[a.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[!n&&a.jsx("button",{onClick:()=>r(!0),className:"fixed top-2 left-2 z-40 w-9 h-9 flex items-center justify-center rounded-lg cursor-pointer",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)"},children:a.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[a.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),a.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),a.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),n&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-50",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>r(!1)}),a.jsxs("aside",{className:"fixed inset-y-0 left-0 z-50 w-64 bg-[var(--sidebar-bg)] border-r border-[var(--border)] flex flex-col",children:[a.jsxs("div",{className:"px-3 h-10 border-b border-[var(--border)] flex items-center justify-between",children:[a.jsxs("button",{onClick:()=>{U("#/debug/new"),r(!1)},className:"flex items-center gap-2 cursor-pointer",style:{background:"none",border:"none"},children:[a.jsx("img",{src:"/favicon.ico",width:"14",height:"14",alt:"UiPath"}),a.jsx("span",{className:"text-[10px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"Developer Console"})]}),a.jsx("button",{onClick:()=>r(!1),className:"w-6 h-6 flex items-center justify-center rounded cursor-pointer transition-colors",style:{color:"var(--text-muted)",background:"transparent",border:"none"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),k==="debug"&&a.jsx(Oi,{runs:Object.values(m),selectedRunId:f,onSelectRun:yt,onNewRun:ye}),k==="evals"&&a.jsx(to,{}),k==="evaluators"&&a.jsx(lo,{}),k==="explorer"&&a.jsx(uo,{})]})]}),a.jsx("main",{className:"flex-1 overflow-hidden bg-[var(--bg-primary)]",children:qt()})]}),a.jsx(Li,{}),a.jsx(Xi,{}),a.jsx(Qi,{})]}):a.jsxs("div",{className:"flex flex-col h-screen w-screen",children:[a.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[a.jsxs("aside",{className:"shrink-0 flex flex-col",style:{width:i,background:"var(--sidebar-bg)"},children:[a.jsxs("div",{className:"flex h-10 border-b shrink-0",style:{borderColor:"var(--border)"},children:[a.jsx("button",{onClick:()=>U("#/debug/new"),className:"w-12 shrink-0 flex items-center justify-center cursor-pointer transition-colors border-r",style:{background:"var(--activity-bar-bg)",border:"none",borderRight:"1px solid var(--border)"},onMouseEnter:Z=>{Z.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:Z=>{Z.currentTarget.style.background="var(--activity-bar-bg)"},children:a.jsx("img",{src:"/favicon.ico",width:"20",height:"20",alt:"UiPath"})}),a.jsx("div",{className:"flex-1 flex items-center px-3",style:{background:"var(--sidebar-bg)"},children:a.jsx("span",{className:"text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:k==="debug"?"Developer Console":k==="evals"?"Evaluations":k==="evaluators"?"Evaluators":"Explorer"})})]}),a.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[a.jsx(sc,{section:k,onSectionChange:lt}),a.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[k==="debug"&&a.jsx(Oi,{runs:Object.values(m),selectedRunId:f,onSelectRun:yt,onNewRun:ye}),k==="evals"&&a.jsx(to,{}),k==="evaluators"&&a.jsx(lo,{}),k==="explorer"&&a.jsx(uo,{})]})]})]}),a.jsx("div",{onMouseDown:nt,onTouchStart:nt,className:"shrink-0 drag-handle-col",style:o?{background:"var(--accent)"}:void 0}),a.jsxs("main",{className:"flex-1 overflow-hidden bg-[var(--bg-primary)] flex",children:[a.jsx("div",{className:"flex-1 overflow-hidden",children:qt()}),k==="explorer"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{onMouseDown:vt,onTouchStart:vt,className:"shrink-0 drag-handle-col",style:d?{background:"var(--accent)"}:void 0}),a.jsx("div",{className:"shrink-0 overflow-hidden",style:{width:u,borderLeft:"1px solid var(--border)"},children:a.jsx(sy,{})})]})]})]}),a.jsx(Li,{}),a.jsx(Xi,{}),a.jsx(Qi,{})]})}Cl.createRoot(document.getElementById("root")).render(a.jsx(S.StrictMode,{children:a.jsx(ay,{})}));export{Zm as M,Qx as a,Hg as r,Ee as u}; diff --git a/src/uipath/dev/server/static/assets/index-DcgkONKP.css b/src/uipath/dev/server/static/assets/index-DcgkONKP.css new file mode 100644 index 0000000..0771ed1 --- /dev/null +++ b/src/uipath/dev/server/static/assets/index-DcgkONKP.css @@ -0,0 +1 @@ +/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-duration:initial;--tw-ease:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--spacing:.25rem;--container-xs:20rem;--container-xl:36rem;--container-2xl:42rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-normal:1.5;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:calc(var(--spacing)*0)}.inset-y-0{inset-block:calc(var(--spacing)*0)}.top-0{top:calc(var(--spacing)*0)}.top-1{top:calc(var(--spacing)*1)}.top-1\.5{top:calc(var(--spacing)*1.5)}.top-2{top:calc(var(--spacing)*2)}.top-4{top:calc(var(--spacing)*4)}.top-full{top:100%}.right-0{right:calc(var(--spacing)*0)}.right-1{right:calc(var(--spacing)*1)}.right-3{right:calc(var(--spacing)*3)}.right-4{right:calc(var(--spacing)*4)}.bottom-1\.5{bottom:calc(var(--spacing)*1.5)}.bottom-8{bottom:calc(var(--spacing)*8)}.bottom-full{bottom:100%}.left-0{left:calc(var(--spacing)*0)}.left-1\/2{left:50%}.left-2{left:calc(var(--spacing)*2)}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.m-0{margin:calc(var(--spacing)*0)}.mx-1{margin-inline:calc(var(--spacing)*1)}.mx-2{margin-inline:calc(var(--spacing)*2)}.mx-3{margin-inline:calc(var(--spacing)*3)}.mx-auto{margin-inline:auto}.my-2{margin-block:calc(var(--spacing)*2)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-2\.5{margin-top:calc(var(--spacing)*2.5)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-auto{margin-top:auto}.mr-0\.5{margin-right:calc(var(--spacing)*.5)}.mr-1{margin-right:calc(var(--spacing)*1)}.mb-0\.5{margin-bottom:calc(var(--spacing)*.5)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-2\.5{height:calc(var(--spacing)*2.5)}.h-3{height:calc(var(--spacing)*3)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-\[14px\]{height:14px}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:calc(var(--spacing)*32)}.max-h-40{max-height:calc(var(--spacing)*40)}.max-h-48{max-height:calc(var(--spacing)*48)}.max-h-64{max-height:calc(var(--spacing)*64)}.max-h-\[85vh\]{max-height:85vh}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-full{min-height:100%}.w-0\.5{width:calc(var(--spacing)*.5)}.w-1\.5{width:calc(var(--spacing)*1.5)}.w-2{width:calc(var(--spacing)*2)}.w-3{width:calc(var(--spacing)*3)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-14{width:calc(var(--spacing)*14)}.w-24{width:calc(var(--spacing)*24)}.w-32{width:calc(var(--spacing)*32)}.w-36{width:calc(var(--spacing)*36)}.w-44{width:calc(var(--spacing)*44)}.w-56{width:calc(var(--spacing)*56)}.w-64{width:calc(var(--spacing)*64)}.w-\[200px\]{width:200px}.w-\[calc\(100\%-24px\)\]{width:calc(100% - 24px)}.w-full{width:100%}.w-screen{width:100vw}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\[160px\]{max-width:160px}.max-w-\[200px\]{max-width:200px}.max-w-prose{max-width:65ch}.max-w-xl{max-width:var(--container-xl)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-\[140px\]{min-width:140px}.min-w-\[180px\]{min-width:180px}.min-w-\[400px\]{min-width:400px}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-\[slideIn_0\.2s_ease-out\]{animation:.2s ease-out slideIn}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.appearance-auto{-webkit-appearance:auto;-moz-appearance:auto;appearance:auto}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing)*0)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-2\.5{gap:calc(var(--spacing)*2.5)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-\[var\(--border\)\]{border-color:var(--border)}.bg-\[var\(--bg-primary\)\]{background-color:var(--bg-primary)}.bg-\[var\(--sidebar-bg\)\]{background-color:var(--sidebar-bg)}.bg-transparent{background-color:#0000}.p-0\.5{padding:calc(var(--spacing)*.5)}.p-1{padding:calc(var(--spacing)*1)}.p-1\.5{padding:calc(var(--spacing)*1.5)}.p-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-10{padding-block:calc(var(--spacing)*10)}.py-\[3px\]{padding-block:3px}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-1\.5{padding-top:calc(var(--spacing)*1.5)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-px{padding-top:1px}.pr-0{padding-right:calc(var(--spacing)*0)}.pr-1{padding-right:calc(var(--spacing)*1)}.pr-2{padding-right:calc(var(--spacing)*2)}.pb-0\.5{padding-bottom:calc(var(--spacing)*.5)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-2\.5{padding-left:calc(var(--spacing)*2.5)}.pl-\[22px\]{padding-left:22px}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.leading-none{--tw-leading:1;line-height:1}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[var\(--text-muted\)\]{color:var(--text-muted)}.text-\[var\(--text-primary\)\]{color:var(--text-primary)}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.underline{text-decoration-line:underline}.accent-\[var\(--accent\)\]{accent-color:var(--accent)}.opacity-0{opacity:0}.opacity-40{opacity:.4}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[width\]{transition-property:width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.outline-none{--tw-outline-style:none;outline-style:none}@media(hover:hover){.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.placeholder\:text-\[var\(--text-muted\)\]::placeholder{color:var(--text-muted)}@media(hover:hover){.hover\:bg-\[var\(--bg-hover\)\]:hover{background-color:var(--bg-hover)}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-100:hover{opacity:1}.hover\:brightness-125:hover{--tw-brightness:brightness(125%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}}pre code.hljs{padding:1em;display:block;overflow-x:auto}code.hljs{padding:3px 5px}.hljs{color:#c9d1d9;background:#0d1117}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#ff7b72}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#d2a8ff}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-variable,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id{color:#79c0ff}.hljs-regexp,.hljs-string,.hljs-meta .hljs-string{color:#a5d6ff}.hljs-built_in,.hljs-symbol{color:#ffa657}.hljs-comment,.hljs-code,.hljs-formula{color:#8b949e}.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo{color:#7ee787}.hljs-subst{color:#c9d1d9}.hljs-section{color:#1f6feb;font-weight:700}.hljs-bullet{color:#f2cc60}.hljs-emphasis{color:#c9d1d9;font-style:italic}.hljs-strong{color:#c9d1d9;font-weight:700}.hljs-addition{color:#aff5b4;background-color:#033a16}.hljs-deletion{color:#ffdcd7;background-color:#67060c}:root,[data-theme=dark]{--bg-primary:#0f172a;--bg-secondary:#1e293b;--bg-tertiary:#334155;--bg-hover:#263348;--bg-elevated:#253041;--text-primary:#cbd5e1;--text-secondary:#94a3b8;--text-muted:#64748b;--border:#334155;--accent:#fa4616;--accent-hover:#e03d12;--accent-light:#ff6a3d;--success:#22c55e;--warning:#eab308;--error:#ef4444;--info:#3b82f6;--sidebar-bg:#0e1526;--activity-bar-bg:#0a1020;--card-bg:#1e293b;--input-bg:#0f172a;--code-bg:#0f172a;--tab-active:#fa4616;--tab-text:#94a3b8;--tab-text-active:#fa4616;--node-bg:#1e293b;--node-border:#475569;--scrollbar-thumb:#334155;color-scheme:dark}[data-theme=light]{--bg-primary:#f8fafc;--bg-secondary:#fff;--bg-tertiary:#cbd5e1;--bg-hover:#f1f5f9;--bg-elevated:#fff;--text-primary:#0f172a;--text-secondary:#475569;--text-muted:#94a3b8;--border:#e2e8f0;--accent:#fa4616;--accent-hover:#e03d12;--accent-light:#ff6a3d;--success:#22c55e;--warning:#ca8a04;--error:#ef4444;--info:#2563eb;--sidebar-bg:#fff;--activity-bar-bg:#f1f5f9;--card-bg:#fff;--input-bg:#f8fafc;--code-bg:#e8ecf1;--tab-active:#fa4616;--tab-text:#64748b;--tab-text-active:#fa4616;--node-bg:#fff;--node-border:#cbd5e1;--scrollbar-thumb:#d1d5db;color-scheme:light}body{background:var(--bg-primary);color:var(--text-primary);margin:0;font-family:Inter,system-ui,-apple-system,sans-serif;transition:background-color .2s,color .2s}#root{height:100dvh;display:flex}:focus-visible{outline:2px solid var(--accent);outline-offset:1px}button:focus-visible,[role=button]:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible{outline:2px solid var(--accent)}@supports (color:color-mix(in lab,red,red)){button:focus-visible,[role=button]:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible{outline:2px solid color-mix(in srgb,var(--accent)60%,transparent)}}button:focus-visible,[role=button]:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible{outline-offset:0px;border-radius:3px}.drag-handle-row{cursor:row-resize;background:var(--border);height:3px;transition:background .15s;position:relative}.drag-handle-row:before{content:"";position:absolute;top:-5px;right:0;bottom:-5px;left:0}.drag-handle-row:hover,.drag-handle-row:active{background:var(--accent)}.drag-handle-col{cursor:col-resize;background:var(--border);width:3px;transition:background .15s;position:relative}.drag-handle-col:before{content:"";position:absolute;top:0;right:-5px;bottom:0;left:-5px}.drag-handle-col:hover,.drag-handle-col:active{background:var(--accent)}@keyframes skeleton-pulse{0%,to{opacity:.4}50%{opacity:.7}}.skeleton{background:var(--bg-tertiary);border-radius:4px;animation:1.5s ease-in-out infinite skeleton-pulse}.react-flow__node{font-size:12px}.react-flow__node-default{background:var(--node-bg)!important;color:var(--text-primary)!important;border-color:var(--node-border)!important}.react-flow__background{background:var(--bg-primary)!important}.react-flow__controls button{background:var(--bg-secondary)!important;color:var(--text-primary)!important;border-color:var(--border)!important}.react-flow__controls button:hover{background:var(--bg-hover)!important}.react-flow__controls button svg{fill:var(--text-primary)!important}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:var(--bg-secondary)}::-webkit-scrollbar-thumb{background:var(--scrollbar-thumb);border-radius:3px}select{-webkit-appearance:auto;-moz-appearance:auto;appearance:auto}select option{background:var(--bg-secondary);color:var(--text-primary)}.chat-markdown p{margin:.25em 0}.chat-markdown p:first-child{margin-top:0}.chat-markdown p:last-child{margin-bottom:0}.chat-markdown code{background:var(--code-bg);border:1px solid var(--border);border-radius:3px;padding:.1em .35em;font-size:.85em}.chat-markdown pre{background:var(--code-bg);border:1px solid var(--border);border-radius:6px;margin:.5em 0;padding:.75em;overflow-x:auto}.chat-markdown pre code{background:0 0;border:none;padding:0;font-size:.85em}.chat-markdown ul,.chat-markdown ol{margin:.25em 0;padding-left:1.5em}.chat-markdown li{margin:.1em 0}.chat-markdown h1,.chat-markdown h2,.chat-markdown h3{margin:.5em 0 .25em;font-weight:600}.chat-markdown h1{font-size:1.2em}.chat-markdown h2{font-size:1.1em}.chat-markdown h3{font-size:1em}.chat-markdown blockquote{border-left:3px solid var(--border);color:var(--text-secondary);margin:.25em 0;padding-left:.75em}.chat-markdown strong{font-weight:600}.chat-markdown a{color:var(--accent);text-decoration:underline}.chat-markdown table{border-collapse:collapse;width:100%;margin:.5em 0}.chat-markdown th,.chat-markdown td{border:1px solid var(--border);text-align:left;padding:.3em .6em}.chat-markdown th{background:var(--code-bg);font-weight:600}.chat-markdown tr:nth-child(2n){background:var(--code-bg)}.chat-markdown .hljs{background:0 0}[data-theme=light] .chat-markdown .hljs{color:#24292e}[data-theme=light] .chat-markdown .hljs-doctag,[data-theme=light] .chat-markdown .hljs-keyword,[data-theme=light] .chat-markdown .hljs-meta .hljs-keyword,[data-theme=light] .chat-markdown .hljs-template-tag,[data-theme=light] .chat-markdown .hljs-template-variable,[data-theme=light] .chat-markdown .hljs-type,[data-theme=light] .chat-markdown .hljs-variable.language_{color:#d73a49}[data-theme=light] .chat-markdown .hljs-title,[data-theme=light] .chat-markdown .hljs-title.class_,[data-theme=light] .chat-markdown .hljs-title.class_.inherited__,[data-theme=light] .chat-markdown .hljs-title.function_{color:#6f42c1}[data-theme=light] .chat-markdown .hljs-attr,[data-theme=light] .chat-markdown .hljs-attribute,[data-theme=light] .chat-markdown .hljs-literal,[data-theme=light] .chat-markdown .hljs-meta,[data-theme=light] .chat-markdown .hljs-number,[data-theme=light] .chat-markdown .hljs-operator,[data-theme=light] .chat-markdown .hljs-variable,[data-theme=light] .chat-markdown .hljs-selector-attr,[data-theme=light] .chat-markdown .hljs-selector-class,[data-theme=light] .chat-markdown .hljs-selector-id{color:#005cc5}[data-theme=light] .chat-markdown .hljs-regexp,[data-theme=light] .chat-markdown .hljs-string,[data-theme=light] .chat-markdown .hljs-meta .hljs-string{color:#032f62}[data-theme=light] .chat-markdown .hljs-built_in,[data-theme=light] .chat-markdown .hljs-symbol{color:#e36209}[data-theme=light] .chat-markdown .hljs-comment,[data-theme=light] .chat-markdown .hljs-code,[data-theme=light] .chat-markdown .hljs-formula{color:#6a737d}[data-theme=light] .chat-markdown .hljs-name,[data-theme=light] .chat-markdown .hljs-quote,[data-theme=light] .chat-markdown .hljs-selector-tag,[data-theme=light] .chat-markdown .hljs-selector-pseudo{color:#22863a}[data-theme=light] .chat-markdown .hljs-subst{color:#24292e}[data-theme=light] .chat-markdown .hljs-section{color:#005cc5}[data-theme=light] .chat-markdown .hljs-bullet{color:#735c0f}[data-theme=light] .chat-markdown .hljs-addition{color:#22863a;background-color:#f0fff4}[data-theme=light] .chat-markdown .hljs-deletion{color:#b31d28;background-color:#ffeef0}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}} diff --git a/src/uipath/dev/server/static/index.html b/src/uipath/dev/server/static/index.html index 924dd29..8f37f3b 100644 --- a/src/uipath/dev/server/static/index.html +++ b/src/uipath/dev/server/static/index.html @@ -5,11 +5,11 @@ UiPath Developer Console - + - +
diff --git a/src/uipath/dev/server/ws/handler.py b/src/uipath/dev/server/ws/handler.py index 4a7ef76..40a5492 100644 --- a/src/uipath/dev/server/ws/handler.py +++ b/src/uipath/dev/server/ws/handler.py @@ -116,6 +116,12 @@ async def websocket_endpoint(websocket: WebSocket) -> None: tool_call_id, bool(approved) ) + elif command == ClientCommand.AGENT_QUESTION_RESPONSE.value: + question_id = payload.get("question_id", "") + answer = payload.get("answer", "") + if question_id: + server.agent_service.resolve_question(question_id, str(answer)) + except WebSocketDisconnect: manager.disconnect(websocket) except Exception: diff --git a/src/uipath/dev/server/ws/manager.py b/src/uipath/dev/server/ws/manager.py index d27d16c..4fdf7c6 100644 --- a/src/uipath/dev/server/ws/manager.py +++ b/src/uipath/dev/server/ws/manager.py @@ -319,6 +319,26 @@ def broadcast_agent_text_delta(self, session_id: str, delta: str) -> None: for ws in self._connections: self._enqueue(ws, msg) + def broadcast_agent_question( + self, + session_id: str, + question_id: str, + question: str, + options: list[str], + ) -> None: + """Broadcast agent question to all connected clients.""" + msg = server_message( + ServerEvent.AGENT_QUESTION, + { + "session_id": session_id, + "question_id": question_id, + "question": question, + "options": options, + }, + ) + for ws in self._connections: + self._enqueue(ws, msg) + def broadcast_agent_token_usage( self, session_id: str, diff --git a/src/uipath/dev/server/ws/protocol.py b/src/uipath/dev/server/ws/protocol.py index aa822b9..7606b89 100644 --- a/src/uipath/dev/server/ws/protocol.py +++ b/src/uipath/dev/server/ws/protocol.py @@ -30,6 +30,7 @@ class ServerEvent(str, Enum): AGENT_THINKING = "agent.thinking" AGENT_TEXT_DELTA = "agent.text_delta" AGENT_TOKEN_USAGE = "agent.token_usage" + AGENT_QUESTION = "agent.question" class ClientCommand(str, Enum): @@ -46,6 +47,7 @@ class ClientCommand(str, Enum): AGENT_MESSAGE = "agent.message" AGENT_STOP = "agent.stop" AGENT_TOOL_RESPONSE = "agent.tool_response" + AGENT_QUESTION_RESPONSE = "agent.question_response" def server_message(event: ServerEvent, payload: dict[str, Any]) -> dict[str, Any]: diff --git a/src/uipath/dev/services/agent/__init__.py b/src/uipath/dev/services/agent/__init__.py index 9314ba8..9cc0120 100644 --- a/src/uipath/dev/services/agent/__init__.py +++ b/src/uipath/dev/services/agent/__init__.py @@ -12,6 +12,7 @@ ToolApprovalRequired, ToolCompleted, ToolStarted, + UserQuestionAsked, ) from uipath.dev.services.agent.service import AgentService from uipath.dev.services.agent.session import AgentSession @@ -30,4 +31,5 @@ "ToolApprovalRequired", "ToolCompleted", "ToolStarted", + "UserQuestionAsked", ] diff --git a/src/uipath/dev/services/agent/context.py b/src/uipath/dev/services/agent/context.py index 275450b..7922654 100644 --- a/src/uipath/dev/services/agent/context.py +++ b/src/uipath/dev/services/agent/context.py @@ -32,8 +32,8 @@ def get_context_window(model: str) -> int: return _DEFAULT_CONTEXT_WINDOW -MAX_TOOL_RESULTS_KEPT = 10 -MIN_RESULT_SIZE_TO_CLEAR = 500 +MAX_TOOL_RESULTS_KEPT = 6 +MIN_RESULT_SIZE_TO_CLEAR = 200 async def maybe_compact( @@ -49,6 +49,14 @@ async def maybe_compact( if session.total_prompt_tokens < window_size * COMPACTION_TRIGGER_RATIO: return False + # Build task state string for preservation + task_state = "" + if session.tasks: + task_lines = [] + for tid, task in session.tasks.items(): + task_lines.append(f" [{tid}] ({task['status']}) {task['title']}") + task_state = "\n## Current Task State\n" + "\n".join(task_lines) + summary_prompt = ( "Summarize the conversation so far. Preserve:\n" "- The user's original request and any clarifications\n" @@ -57,6 +65,7 @@ async def maybe_compact( "- File paths and code patterns that were discovered\n" "- Any errors encountered and how they were resolved\n" "Be concise but don't lose critical context." + + (f"\n\n{task_state}" if task_state else "") ) summary_response = await provider.complete( @@ -72,11 +81,12 @@ async def maybe_compact( recent = ( session.messages[-KEEP_RECENT:] if len(session.messages) > KEEP_RECENT else [] ) + summary_content = f"[Conversation Summary]\n{summary_response.content}" + if task_state: + summary_content += f"\n\n{task_state}" + session.messages = [ - { - "role": "assistant", - "content": f"[Conversation Summary]\n{summary_response.content}", - }, + {"role": "assistant", "content": summary_content}, *recent, ] session.compaction_count += 1 diff --git a/src/uipath/dev/services/agent/events.py b/src/uipath/dev/services/agent/events.py index e9655c1..3371b29 100644 --- a/src/uipath/dev/services/agent/events.py +++ b/src/uipath/dev/services/agent/events.py @@ -89,3 +89,12 @@ class TokenUsageUpdated(AgentEvent): prompt_tokens: int = 0 completion_tokens: int = 0 total_session_tokens: int = 0 + + +@dataclass +class UserQuestionAsked(AgentEvent): + """Agent is asking the user a question and waiting for an answer.""" + + question_id: str = "" + question: str = "" + options: list[str] = field(default_factory=list) diff --git a/src/uipath/dev/services/agent/loop.py b/src/uipath/dev/services/agent/loop.py index 7f4f5af..83dc906 100644 --- a/src/uipath/dev/services/agent/loop.py +++ b/src/uipath/dev/services/agent/loop.py @@ -21,6 +21,7 @@ ToolApprovalRequired, ToolCompleted, ToolStarted, + UserQuestionAsked, ) from uipath.dev.services.agent.provider import ModelProvider, StreamEvent, ToolCall from uipath.dev.services.agent.session import AgentSession @@ -70,16 +71,16 @@ ## Workflow -1. **Plan first**: Call `update_plan` with your steps before doing anything else. +1. **Plan first**: Use `create_task` to add individual steps before doing anything else. 2. **Explore**: Use `glob` and `grep` to find relevant files. Read them with `read_file`. 3. **Implement**: Use `edit_file` for targeted changes, `write_file` only for new files. 4. **Execute**: Use `bash` to run commands — installations, tests, linters, builds, `uv run` commands, etc. \ When the user asks you to run something, always use the `bash` tool to execute it. Never tell the user to run commands themselves — you have a shell, use it. 5. **Verify**: Read back edited files to confirm correctness. Run tests or linters via `bash`. -6. **Update progress**: After completing each step, call `update_plan` to mark it as "completed" BEFORE moving on. \ -When starting a step, mark it as "in_progress". Always send the full plan array with all steps. -7. **Before your final response**: Call `update_plan` one last time to mark all remaining steps as "completed". \ -NEVER give your final summary without first ensuring every plan step is marked completed. +6. **Update progress**: When starting a step, call `update_task` to set it to "in_progress". \ +After completing each step, call `update_task` to mark it "completed" BEFORE moving on. +7. **Before your final response**: Mark all remaining tasks as "completed". \ +NEVER give your final summary without first ensuring every task is marked completed. 8. **Summarize**: When done, briefly state what you changed and why. ## Full Build Cycle @@ -103,15 +104,18 @@ Default to publishing to personal workspace (`-w`) unless the user specifies a tenant folder. ## Tools -- `read_file` — Read file contents (always use before editing) +- `read_file` — Read file contents (always use before editing). Supports offset/limit for large files. - `write_file` — Create or overwrite a file - `edit_file` — Surgical string replacement (old_string must be unique) - `bash` — Execute a shell command (timeout: 30s). USE THIS to run commands for the user. - `glob` — Find files matching a pattern (e.g. `**/*.py`) - `grep` — Search file contents with regex -- `update_plan` — Create or update your task plan +- `create_task` — Add a new step to your task plan +- `update_task` — Update a task's status (pending → in_progress → completed) or title +- `list_tasks` — Show all tasks with their statuses - `read_reference` — Read a reference doc from the active skill (when skills are active) - `dispatch_agent` — Spawn a sub-agent to handle a subtask in its own context +- `ask_user` — Ask the user a question and wait for their answer """ @@ -131,9 +135,22 @@ async def _empty_async_iter() -> AsyncIterator[StreamEvent]: SUB_AGENT_PROMPT = """\ -You are a research sub-agent. You have access to read-only tools to explore the codebase. -Complete the task and provide a concise summary of your findings. -Be thorough but concise — your response will be returned to the parent agent. +You are a research sub-agent with read-only access to the codebase. + +## Your Task +Complete the research task described in the user message below. + +## Output Format +Return a structured summary with: +- **Findings**: Key facts, code locations, and patterns discovered +- **File paths**: List every relevant file path you found (with line numbers if applicable) +- **Answer**: A direct, concise answer to the question asked + +## Guidelines +- Be thorough: check multiple files, search for patterns, verify assumptions +- Be concise: your full response goes back to the parent agent's context window +- Keep your response under 2000 chars — focus on what matters +- If you can't find something, say so explicitly rather than guessing """ @@ -151,6 +168,9 @@ def __init__( # noqa: D107 # Approval support pending_approvals: dict[str, asyncio.Event] | None = None, approval_results: dict[str, bool] | None = None, + # Question support + pending_questions: dict[str, asyncio.Event] | None = None, + question_results: dict[str, str] | None = None, # Skill support skill_service: Any | None = None, ) -> None: @@ -165,6 +185,12 @@ def __init__( # noqa: D107 self._approval_results = ( approval_results if approval_results is not None else {} ) + self._pending_questions = ( + pending_questions if pending_questions is not None else {} + ) + self._question_results = ( + question_results if question_results is not None else {} + ) self._skill_service = skill_service async def run(self, session: AgentSession, system_prompt: str) -> None: @@ -178,10 +204,7 @@ async def run(self, session: AgentSession, system_prompt: str) -> None: tool_map = {t.name: t for t in self.tools} - for iteration in range(self.max_iterations): - logger.info( - "Loop iteration %d, messages=%d", iteration, len(session.messages) - ) + for _iteration in range(self.max_iterations): if session._cancel_event.is_set(): session.status = "done" self.emit(StatusChanged(session.id, status="done")) @@ -262,24 +285,20 @@ async def run(self, session: AgentSession, system_prompt: str) -> None: # If no tool calls, we're done if finish_reason == "stop" or not tool_calls: # Content already streamed via TextDelta — just mark done + self._complete_remaining_tasks(session) self.emit(TextGenerated(session.id, content="", done=True)) session.status = "done" self.emit(StatusChanged(session.id, status="done")) return # Execute tool calls (parallel where possible) - logger.info( - "Executing %d tool calls: %s", - len(tool_calls), - [tc.name for tc in tool_calls], - ) await self._execute_tools_parallel(tool_calls, session, tool_map) - logger.info("Tool execution complete, continuing loop") # After tools, set status back to thinking self.emit(StatusChanged(session.id, status="thinking")) # Max iterations reached + self._complete_remaining_tasks(session) self.emit( TextGenerated( session.id, @@ -291,6 +310,7 @@ async def run(self, session: AgentSession, system_prompt: str) -> None: self.emit(StatusChanged(session.id, status="done")) except asyncio.CancelledError: + self._complete_remaining_tasks(session) session.status = "done" self.emit(StatusChanged(session.id, status="done")) except Exception as e: @@ -374,9 +394,9 @@ async def _execute_tools_parallel( tool_def = tool_map.get(tool_name) - # Handle update_plan specially (no approval, immediate) - if tool_name == "update_plan": - result = self._handle_update_plan(session, tool_args) + # Handle task tools specially (no approval, immediate) + if tool_name in ("create_task", "update_task", "list_tasks"): + result = self._handle_task_tool(session, tool_name, tool_args) tasks.append((tc, result)) continue @@ -407,13 +427,16 @@ async def _execute_tools_parallel( tasks.append((tc, result)) continue + # Handle ask_user specially — blocks until user responds + if tool_name == "ask_user": + result = await self._handle_ask_user(session, tool_args) + tasks.append((tc, result)) + continue + self.emit(ToolStarted(session.id, tool=tool_name, args=tool_args)) # Approval gate for destructive tools (sequential for UX clarity) if tool_def and tool_def.requires_approval: - logger.info( - "Requesting approval for tool=%s tc.id=%s", tool_name, tc.id - ) approval_event = asyncio.Event() self._pending_approvals[tc.id] = approval_event self.emit( @@ -428,12 +451,6 @@ async def _execute_tools_parallel( await approval_event.wait() approved = self._approval_results.pop(tc.id, False) self._pending_approvals.pop(tc.id, None) - logger.info( - "Approval resolved for tool=%s tc.id=%s approved=%s", - tool_name, - tc.id, - approved, - ) if session._cancel_event.is_set(): session.status = "done" @@ -518,14 +535,70 @@ async def _execute_single_tool( None, tool_def.handler, args ) - def _handle_update_plan(self, session: AgentSession, args: dict[str, Any]) -> str: - items = args.get("plan", []) - if not isinstance(items, list): - return "Error: plan must be an array" - + def _handle_task_tool( + self, session: AgentSession, tool_name: str, args: dict[str, Any] + ) -> str: + """Handle create_task, update_task, and list_tasks.""" + if tool_name == "create_task": + return self._handle_create_task(session, args) + if tool_name == "update_task": + return self._handle_update_task(session, args) + return self._handle_list_tasks(session) + + def _handle_create_task(self, session: AgentSession, args: dict[str, Any]) -> str: + title = args.get("title", "").strip() + if not title: + return "Error: title is required" + task_id = str(session._next_task_id) + session._next_task_id += 1 + session.tasks[task_id] = { + "title": title, + "status": "pending", + "description": args.get("description", ""), + } + self._emit_plan_from_tasks(session) + return f"Task {task_id} created" + + def _handle_update_task(self, session: AgentSession, args: dict[str, Any]) -> str: + task_id = args.get("task_id", "") + if task_id not in session.tasks: + return f"Error: task {task_id} not found" + status = args.get("status", "") + if status: + if status not in ("pending", "in_progress", "completed"): + return f"Error: invalid status '{status}'" + session.tasks[task_id]["status"] = status + new_title = args.get("title") + if new_title: + session.tasks[task_id]["title"] = new_title + self._emit_plan_from_tasks(session) + return f"Task {task_id} updated" + + def _handle_list_tasks(self, session: AgentSession) -> str: + if not session.tasks: + return "No tasks yet." + lines: list[str] = [] + for tid, task in session.tasks.items(): + lines.append(f"[{tid}] ({task['status']}) {task['title']}") + return "\n".join(lines) + + def _complete_remaining_tasks(self, session: AgentSession) -> None: + """Mark any non-completed tasks as completed when the turn ends.""" + changed = False + for task in session.tasks.values(): + if task["status"] != "completed": + task["status"] = "completed" + changed = True + if changed: + self._emit_plan_from_tasks(session) + + def _emit_plan_from_tasks(self, session: AgentSession) -> None: + """Convert tasks dict to plan items list and emit PlanUpdated.""" + items = [ + {"title": t["title"], "status": t["status"]} for t in session.tasks.values() + ] session.plan = items self.emit(PlanUpdated(session.id, items=items)) - return "Plan updated" def _handle_read_reference( self, session: AgentSession, args: dict[str, Any] @@ -552,16 +625,41 @@ async def _handle_dispatch_agent( self, task: str, parent_session: AgentSession ) -> str: """Run a sub-agent with isolated context and return its result.""" + from uipath.dev.services.agent.tools import create_read_reference_tool + child_session = AgentSession(model=parent_session.model) child_session.messages.append({"role": "user", "content": task}) - # Read-only tools only, no dispatch_agent + # Read-only tools only, no dispatch_agent or ask_user child_tools = [ t for t in self.tools - if not t.requires_approval and t.name != "dispatch_agent" + if not t.requires_approval + and t.name + not in ( + "dispatch_agent", + "ask_user", + "create_task", + "update_task", + "list_tasks", + ) ] + # Give sub-agent read_reference when skills are active + has_read_ref = any(t.name == "read_reference" for t in child_tools) + if not has_read_ref and parent_session.skill_ids and self._skill_service: + child_tools.append(create_read_reference_tool()) + + # Build sub-agent system prompt with skill context + sub_prompt = SUB_AGENT_PROMPT + if parent_session.skill_ids and self._skill_service: + for sid in parent_session.skill_ids: + try: + summary = self._skill_service.get_skill_summary(sid) + sub_prompt += f"\n\n## Skill Context: {sid}\n{summary}" + except FileNotFoundError: + pass + child_loop = AgentLoop( provider=self.provider, tools=child_tools, @@ -570,10 +668,43 @@ async def _handle_dispatch_agent( allow_dispatch=False, skill_service=self._skill_service, ) - await child_loop.run(child_session, system_prompt=SUB_AGENT_PROMPT) + await child_loop.run(child_session, system_prompt=sub_prompt) # Extract final assistant message for msg in reversed(child_session.messages): if msg["role"] == "assistant" and msg.get("content"): return msg["content"] return "Sub-agent completed without producing a response." + + async def _handle_ask_user( + self, session: AgentSession, args: dict[str, Any] + ) -> str: + """Emit a question event and block until the user responds.""" + import uuid as _uuid + + question = args.get("question", "") + options = args.get("options", []) + if not question: + return "Error: question is required" + + question_id = str(_uuid.uuid4()) + wait_event = asyncio.Event() + self._pending_questions[question_id] = wait_event + + self.emit( + UserQuestionAsked( + session.id, + question_id=question_id, + question=question, + options=options if isinstance(options, list) else [], + ) + ) + self.emit(StatusChanged(session.id, status="awaiting_input")) + + await wait_event.wait() + + answer = self._question_results.pop(question_id, "") + self._pending_questions.pop(question_id, None) + + self.emit(StatusChanged(session.id, status="thinking")) + return answer diff --git a/src/uipath/dev/services/agent/provider.py b/src/uipath/dev/services/agent/provider.py index a19c71a..d0f1a94 100644 --- a/src/uipath/dev/services/agent/provider.py +++ b/src/uipath/dev/services/agent/provider.py @@ -2,15 +2,11 @@ from __future__ import annotations -import logging import os from collections.abc import AsyncIterator from dataclasses import dataclass, field from typing import Any, Protocol, runtime_checkable -logger = logging.getLogger(__name__) - - # --------------------------------------------------------------------------- # Data classes # --------------------------------------------------------------------------- @@ -119,10 +115,8 @@ def _make_rewrite_transport(gateway_completions_url: str) -> Any: class _RewriteTransport(httpx.AsyncHTTPTransport): async def handle_async_request(self, request: httpx.Request) -> httpx.Response: - original = str(request.url) params = request.url.params request.url = httpx.URL(gateway_completions_url, params=params) - logger.info("URL rewrite: %s -> %s", original, str(request.url)) return await super().handle_async_request(request) return _RewriteTransport() @@ -210,13 +204,30 @@ async def complete( temperature: float = 0, ) -> ModelResponse: """Non-streaming completion (used for compaction).""" + if _is_reasoning_model(model): + return await self._complete_responses( + messages, tools, model=model, max_tokens=max_tokens + ) + return await self._complete_chat( + messages, tools, model=model, max_tokens=max_tokens, temperature=temperature + ) + + async def _complete_chat( + self, + messages: list[dict[str, Any]], + tools: list[dict[str, Any]], + *, + model: str, + max_tokens: int = 4096, + temperature: float = 0, + ) -> ModelResponse: + """Non-streaming completion via Chat Completions API.""" kwargs: dict[str, Any] = { "model": model, "messages": messages, "max_completion_tokens": max_tokens, + "temperature": temperature, } - if not _is_reasoning_model(model): - kwargs["temperature"] = temperature if tools: kwargs["tools"] = tools kwargs["tool_choice"] = "auto" @@ -251,6 +262,60 @@ async def complete( usage=usage, ) + async def _complete_responses( + self, + messages: list[dict[str, Any]], + tools: list[dict[str, Any]], + *, + model: str, + max_tokens: int = 4096, + ) -> ModelResponse: + """Non-streaming completion via Responses API (reasoning models).""" + client = self._get_responses_client() + input_items = self._convert_messages_to_input(messages) + + kwargs: dict[str, Any] = { + "model": model, + "input": input_items, + "max_output_tokens": max_tokens, + } + if tools: + kwargs["tools"] = self._convert_tools_to_responses(tools) + + response = await client.responses.create(**kwargs) + + content = "" + tool_calls = [] + for item in response.output: + if item.type == "message": + for part in item.content: + if hasattr(part, "text"): + content += part.text + elif item.type == "function_call": + tool_calls.append( + ToolCall( + id=item.call_id, + name=item.name, + arguments=item.arguments, + ) + ) + + usage = None + if response.usage: + usage = Usage( + prompt_tokens=response.usage.input_tokens, + completion_tokens=response.usage.output_tokens, + ) + + finish = "tool_calls" if tool_calls else "stop" + return ModelResponse( + content=content, + tool_calls=tool_calls, + thinking=None, + finish_reason=finish, + usage=usage, + ) + async def stream( self, messages: list[dict[str, Any]], diff --git a/src/uipath/dev/services/agent/service.py b/src/uipath/dev/services/agent/service.py index 0202f74..f9639ba 100644 --- a/src/uipath/dev/services/agent/service.py +++ b/src/uipath/dev/services/agent/service.py @@ -3,26 +3,35 @@ from __future__ import annotations import asyncio -import logging +import json from collections.abc import Callable from pathlib import Path +from typing import Any from uipath.dev.services.agent.events import AgentEvent, StatusChanged from uipath.dev.services.agent.loop import SYSTEM_PROMPT, AgentLoop from uipath.dev.services.agent.provider import create_provider from uipath.dev.services.agent.session import AgentSession from uipath.dev.services.agent.tools import ( + create_ask_user_tool, create_default_tools, create_dispatch_agent_tool, create_read_reference_tool, + create_task_tools, ) from uipath.dev.services.skill_service import SkillService -logger = logging.getLogger(__name__) - _PROJECT_ROOT = Path.cwd().resolve() +def _safe_parse_json(s: str) -> dict[str, Any]: + """Parse JSON string, returning empty dict on failure.""" + try: + return json.loads(s) + except (json.JSONDecodeError, TypeError): + return {} + + class AgentService: """Manages agent sessions and runs the agent loop.""" @@ -37,6 +46,8 @@ def __init__( # noqa: D107 self._on_event = on_event self._pending_approvals: dict[str, asyncio.Event] = {} self._approval_results: dict[str, bool] = {} + self._pending_questions: dict[str, asyncio.Event] = {} + self._question_results: dict[str, str] = {} def _emit(self, event: AgentEvent) -> None: if self._on_event: @@ -67,7 +78,12 @@ async def send_message( session.skill_ids = skill_ids # If already running, ignore - if session.status in ("thinking", "executing", "awaiting_approval"): + if session.status in ( + "thinking", + "executing", + "awaiting_approval", + "awaiting_input", + ): return session.messages.append({"role": "user", "content": text}) @@ -88,40 +104,257 @@ def stop_session(self, session_id: str) -> None: def resolve_tool_approval(self, tool_call_id: str, approved: bool) -> None: """Resolve a pending tool approval request.""" - logger.info( - "resolve_tool_approval: tool_call_id=%s approved=%s pending_keys=%s", - tool_call_id, - approved, - list(self._pending_approvals.keys()), - ) self._approval_results[tool_call_id] = approved event = self._pending_approvals.get(tool_call_id) if event: - logger.info("resolve_tool_approval: signaling event for %s", tool_call_id) event.set() - else: - logger.info( - "resolve_tool_approval: no pending event for tool_call_id=%s", - tool_call_id, + + def resolve_question(self, question_id: str, answer: str) -> None: + """Resolve a pending agent question with the user's answer.""" + self._question_results[question_id] = answer + event = self._pending_questions.get(question_id) + if event: + event.set() + + def get_session_state(self, session_id: str) -> dict[str, Any] | None: + """Return the full session state converted to frontend message format.""" + session = self._sessions.get(session_id) + if session is None: + return None + + frontend_messages = self._convert_messages(session) + tasks = [ + {"title": t["title"], "status": t["status"]} for t in session.tasks.values() + ] + + return { + "session_id": session.id, + "status": "done" if session.status == "idle" else session.status, + "model": session.model, + "messages": frontend_messages, + "plan": tasks, + "total_prompt_tokens": session.total_prompt_tokens, + "total_completion_tokens": session.total_completion_tokens, + "turn_count": session.turn_count, + "compaction_count": session.compaction_count, + } + + @staticmethod + def _convert_messages(session: AgentSession) -> list[dict[str, Any]]: + """Convert OpenAI-format messages to frontend AgentMessage[] format.""" + result: list[dict[str, Any]] = [] + msg_counter = 0 + hidden_tool_call_ids: set[str] = set() + + def next_id() -> str: + nonlocal msg_counter + msg_counter += 1 + return f"restored-msg-{msg_counter}" + + # Task management tools are internal — don't show in restored chat + _HIDDEN_TOOLS = { + "create_task", + "update_task", + "list_tasks", + "dispatch_agent", + "ask_user", + "read_reference", + } + + # Walk messages sequentially, collecting tool groups + pending_tool_calls: list[dict[str, Any]] = [] + + for msg in session.messages: + role = msg.get("role") + + if role == "user": + # Flush any pending tool group + if pending_tool_calls: + result.append( + { + "id": next_id(), + "role": "tool", + "content": "", + "timestamp": 0, + "toolCalls": pending_tool_calls, + } + ) + pending_tool_calls = [] + + result.append( + { + "id": next_id(), + "role": "user", + "content": msg.get("content", ""), + "timestamp": 0, + } + ) + + elif role == "assistant": + content = msg.get("content", "") or "" + # Only flush pending tool group when the model actually + # spoke between tool rounds (text content present). + # Back-to-back tool rounds stay in one group. + if content and pending_tool_calls: + result.append( + { + "id": next_id(), + "role": "tool", + "content": "", + "timestamp": 0, + "toolCalls": pending_tool_calls, + } + ) + pending_tool_calls = [] + + if content: + result.append( + { + "id": next_id(), + "role": "assistant", + "content": content, + "timestamp": 0, + "done": True, + } + ) + + # Start collecting tool calls if present + tool_calls = msg.get("tool_calls", []) + for tc in tool_calls: + func = tc.get("function", {}) + name = func.get("name", "unknown") + tc_id = tc.get("id", "") + if name in _HIDDEN_TOOLS: + hidden_tool_call_ids.add(tc_id) + continue + pending_tool_calls.append( + { + "tool": name, + "args": _safe_parse_json(func.get("arguments", "{}")), + "_tool_call_id": tc_id, + } + ) + + elif role == "tool": + tool_call_id = msg.get("tool_call_id", "") + if tool_call_id in hidden_tool_call_ids: + continue + # Match to pending tool call by tool_call_id + content = msg.get("content", "") + is_error = content.startswith("Error:") + for tc in pending_tool_calls: + if tc.get("_tool_call_id") == tool_call_id: + tc["result"] = content + tc["is_error"] = is_error + break + + # Flush remaining tool group + if pending_tool_calls: + result.append( + { + "id": next_id(), + "role": "tool", + "content": "", + "timestamp": 0, + "toolCalls": pending_tool_calls, + } ) + # Clean up internal _tool_call_id from tool calls + for msg_item in result: + if msg_item.get("toolCalls"): + for tc in msg_item["toolCalls"]: + tc.pop("_tool_call_id", None) + + return result + + def get_session_diagnostics(self, session_id: str) -> dict[str, Any] | None: + """Return structured diagnostics for a session.""" + session = self._sessions.get(session_id) + if session is None: + return None + + # Tool call summary: count calls and errors per tool name + tool_counts: dict[str, int] = {} + tool_errors: dict[str, int] = {} + for msg in session.messages: + if msg.get("role") == "assistant" and msg.get("tool_calls"): + for tc in msg["tool_calls"]: + name = tc.get("function", {}).get("name", "unknown") + tool_counts[name] = tool_counts.get(name, 0) + 1 + if msg.get("role") == "tool": + content = msg.get("content", "") + # Find matching tool name from preceding assistant message + tool_call_id = msg.get("tool_call_id", "") + tool_name = self._resolve_tool_name(session, tool_call_id) + if content.startswith("Error:"): + tool_errors[tool_name] = tool_errors.get(tool_name, 0) + 1 + + tool_summary = [] + for name, count in sorted(tool_counts.items()): + entry: dict[str, Any] = {"tool": name, "calls": count} + if name in tool_errors: + entry["errors"] = tool_errors[name] + tool_summary.append(entry) + + # Last 10 messages condensed + last_messages = [] + for msg in session.messages[-10:]: + role = msg.get("role", "") + entry_msg: dict[str, Any] = {"role": role} + if role == "tool": + tool_call_id = msg.get("tool_call_id", "") + entry_msg["tool"] = self._resolve_tool_name(session, tool_call_id) + content = msg.get("content", "") + if content: + entry_msg["content"] = content[:200] + last_messages.append(entry_msg) + + # Tasks + tasks = [ + {"title": t["title"], "status": t["status"]} for t in session.tasks.values() + ] + + return { + "model": session.model, + "turn_count": session.turn_count, + "total_prompt_tokens": session.total_prompt_tokens, + "total_completion_tokens": session.total_completion_tokens, + "compaction_count": session.compaction_count, + "tasks": tasks, + "tool_summary": tool_summary, + "last_messages": last_messages, + } + + @staticmethod + def _resolve_tool_name(session: AgentSession, tool_call_id: str) -> str: + """Find the tool name for a given tool_call_id from assistant messages.""" + for msg in session.messages: + if msg.get("role") == "assistant" and msg.get("tool_calls"): + for tc in msg["tool_calls"]: + if tc.get("id") == tool_call_id: + return tc.get("function", {}).get("name", "unknown") + return "unknown" + async def _run_agent_loop(self, session: AgentSession) -> None: """Create provider, build tools, and run the loop.""" provider = create_provider(session.model) - # Build system prompt (inject skill content for active skills) + # Build system prompt (inject skill summaries for active skills) system_prompt = SYSTEM_PROMPT if session.skill_ids and self._skill_service: for sid in session.skill_ids: try: - skill_body = self._skill_service.get_skill_content(sid) - system_prompt += f"\n\n## Active Skill: {sid}\n\n{skill_body}" + summary = self._skill_service.get_skill_summary(sid) + system_prompt += f"\n\n## Active Skill: {sid}\n\n{summary}" except FileNotFoundError: pass # Build tools list tools = create_default_tools(_PROJECT_ROOT) + tools.extend(create_task_tools()) tools.append(create_dispatch_agent_tool()) + tools.append(create_ask_user_tool()) if session.skill_ids and self._skill_service: tools.append(create_read_reference_tool()) @@ -131,6 +364,8 @@ async def _run_agent_loop(self, session: AgentSession) -> None: emit=self._emit, pending_approvals=self._pending_approvals, approval_results=self._approval_results, + pending_questions=self._pending_questions, + question_results=self._question_results, skill_service=self._skill_service, ) diff --git a/src/uipath/dev/services/agent/session.py b/src/uipath/dev/services/agent/session.py index f764376..b893987 100644 --- a/src/uipath/dev/services/agent/session.py +++ b/src/uipath/dev/services/agent/session.py @@ -17,6 +17,8 @@ class AgentSession: skill_ids: list[str] = field(default_factory=list) messages: list[dict[str, Any]] = field(default_factory=list) plan: list[dict[str, str]] = field(default_factory=list) + tasks: dict[str, dict[str, str]] = field(default_factory=dict) + _next_task_id: int = field(default=1, repr=False) status: str = "idle" # Token tracking total_prompt_tokens: int = 0 diff --git a/src/uipath/dev/services/agent/tools.py b/src/uipath/dev/services/agent/tools.py index 777c81a..070423e 100644 --- a/src/uipath/dev/services/agent/tools.py +++ b/src/uipath/dev/services/agent/tools.py @@ -96,7 +96,22 @@ def handler(args: dict[str, Any]) -> str: if not path.is_file(): return f"Error: file not found: {args['path']}" content = path.read_text(encoding="utf-8", errors="replace") - if len(content) > MAX_FILE_CHARS: + + offset = args.get("offset") + limit = args.get("limit") + + if offset is not None or limit is not None: + lines = content.splitlines(keepends=True) + total = len(lines) + start = max(0, (int(offset) - 1)) if offset else 0 + end = start + int(limit) if limit else total + selected = lines[start:end] + content = "".join(selected) + if start > 0 or end < total: + content += ( + f"\n[showing lines {start + 1}-{min(end, total)} of {total} total]" + ) + elif len(content) > MAX_FILE_CHARS: content = ( content[:MAX_FILE_CHARS] + f"\n... [truncated at {MAX_FILE_CHARS} chars]" @@ -275,7 +290,15 @@ def handler(args: dict[str, Any]) -> str: _READ_FILE_PARAMS: dict[str, Any] = { "type": "object", "properties": { - "path": {"type": "string", "description": "Relative or absolute file path."} + "path": {"type": "string", "description": "Relative or absolute file path."}, + "offset": { + "type": "integer", + "description": "1-based line number to start reading from. Defaults to 1.", + }, + "limit": { + "type": "integer", + "description": "Maximum number of lines to return. Defaults to all lines.", + }, }, "required": ["path"], } @@ -348,27 +371,51 @@ def handler(args: dict[str, Any]) -> str: "required": ["pattern"], } -_UPDATE_PLAN_PARAMS: dict[str, Any] = { +_CREATE_TASK_PARAMS: dict[str, Any] = { + "type": "object", + "properties": { + "title": {"type": "string", "description": "Short title describing the task."}, + "description": { + "type": "string", + "description": "Optional longer description with details or acceptance criteria.", + }, + }, + "required": ["title"], +} + +_UPDATE_TASK_PARAMS: dict[str, Any] = { "type": "object", "properties": { - "plan": { + "task_id": {"type": "string", "description": "The ID of the task to update."}, + "status": { + "type": "string", + "enum": ["pending", "in_progress", "completed"], + "description": "New status for the task.", + }, + "title": { + "type": "string", + "description": "Optional new title for the task.", + }, + }, + "required": ["task_id", "status"], +} + +_LIST_TASKS_PARAMS: dict[str, Any] = { + "type": "object", + "properties": {}, +} + +_ASK_USER_PARAMS: dict[str, Any] = { + "type": "object", + "properties": { + "question": {"type": "string", "description": "The question to ask the user."}, + "options": { "type": "array", - "description": "The full plan with updated statuses. Always send the complete plan, not just changed items.", - "items": { - "type": "object", - "properties": { - "title": {"type": "string", "description": "Step title"}, - "status": { - "type": "string", - "enum": ["pending", "in_progress", "completed"], - "description": "Step status", - }, - }, - "required": ["title", "status"], - }, - } + "items": {"type": "string"}, + "description": "Optional list of choices for the user to pick from.", + }, }, - "required": ["plan"], + "required": ["question"], } _READ_REFERENCE_PARAMS: dict[str, Any] = { @@ -404,20 +451,34 @@ def create_default_tools(project_root: Path) -> list[ToolDefinition]: return [ ToolDefinition( name="read_file", - description="Read the contents of a file at the given path.", + description=( + "Read the contents of a file at the given path. Always use this before editing a file " + "to understand its current content, imports, and conventions. Supports optional offset " + "(1-based line number) and limit (max lines) for reading specific sections of large files. " + "Returns up to 100K chars; larger files are truncated. Accepts relative or absolute paths." + ), parameters=_READ_FILE_PARAMS, handler=_make_read_file(project_root), ), ToolDefinition( name="write_file", - description="Create or overwrite a file with the given content.", + description=( + "Create a new file or completely overwrite an existing file with the given content. " + "Use this only for new files — prefer edit_file for modifying existing files. " + "Parent directories are created automatically. Requires user approval." + ), parameters=_WRITE_FILE_PARAMS, handler=_make_write_file(project_root), requires_approval=True, ), ToolDefinition( name="edit_file", - description="Replace an exact string in a file with a new string. The old_string must appear exactly once.", + description=( + "Replace an exact string in a file with a new string. The old_string must appear " + "exactly once in the file (to prevent ambiguous edits). Use this for targeted, " + "surgical changes to existing files. Always read_file first to get the exact string " + "to match. Requires user approval." + ), parameters=_EDIT_FILE_PARAMS, handler=_make_edit_file(project_root), requires_approval=True, @@ -425,8 +486,10 @@ def create_default_tools(project_root: Path) -> list[ToolDefinition]: ToolDefinition( name="bash", description=( - "Execute a shell command and return stdout/stderr. Timeout: 30s. " - "For commands that prompt for input, provide the expected input via the stdin parameter." + "Execute a shell command and return stdout + stderr. Timeout: 30 seconds. " + "Use this for running CLI tools (uv run, uipath init, pytest, ruff, etc.), " + "installing dependencies, and any terminal operations. For commands that need " + "interactive input, provide it via the stdin parameter. Requires user approval." ), parameters=_BASH_PARAMS, handler=_make_bash(project_root), @@ -434,20 +497,59 @@ def create_default_tools(project_root: Path) -> list[ToolDefinition]: ), ToolDefinition( name="glob", - description="Find files matching a glob pattern. Returns up to 200 results.", + description=( + "Find files matching a glob pattern (e.g. '**/*.py', 'src/**/*.ts'). " + "Use this to discover files by name or extension before reading them. " + "Returns up to 200 file paths relative to the project root, sorted alphabetically. " + "For searching file *contents*, use grep instead." + ), parameters=_GLOB_PARAMS, handler=_make_glob(project_root), ), ToolDefinition( name="grep", - description="Search file contents with a regex pattern. Returns up to 100 matches.", + description=( + "Search file contents using a regex pattern. Returns matching lines with " + "file path, line number, and content (up to 100 matches). Skips hidden dirs, " + "node_modules, and __pycache__. Use the 'include' filter for specific file types " + "(e.g. '*.py'). For finding files by name, use glob instead." + ), parameters=_GREP_PARAMS, handler=_make_grep(project_root), ), + ] + + +def create_task_tools() -> list[ToolDefinition]: + """Create the task management tools (create_task, update_task, list_tasks).""" + return [ ToolDefinition( - name="update_plan", - description="Update the task plan. Call this first to outline steps, then update as you complete them.", - parameters=_UPDATE_PLAN_PARAMS, + name="create_task", + description=( + "Create a new task in your plan. Call this at the start to break your work into " + "trackable steps. Each task gets a unique ID. Returns the task ID. " + "Use this instead of sending the full plan — add tasks one at a time." + ), + parameters=_CREATE_TASK_PARAMS, + handler=lambda args: "", # Handled specially in the loop + ), + ToolDefinition( + name="update_task", + description=( + "Update a task's status or title. Set status to 'in_progress' when starting a step, " + "'completed' when done. You can also update the title if the scope changed. " + "Only sends the fields you want to change — no need to resend the full plan." + ), + parameters=_UPDATE_TASK_PARAMS, + handler=lambda args: "", # Handled specially in the loop + ), + ToolDefinition( + name="list_tasks", + description=( + "List all tasks with their IDs, titles, and statuses. Use this to review your " + "current plan progress or to find task IDs for updating." + ), + parameters=_LIST_TASKS_PARAMS, handler=lambda args: "", # Handled specially in the loop ), ] @@ -457,7 +559,12 @@ def create_read_reference_tool() -> ToolDefinition: """Create the read_reference tool (added when skills are active).""" return ToolDefinition( name="read_reference", - description="Read a reference document from the skill's references directory.", + description=( + "Read a reference document from the active skill's references directory. " + "Use this to get detailed information about a topic listed in the skill's table of " + "contents. Pass the relative path as shown in the skill summary (e.g. 'authentication.md'). " + "The skill summary gives you section headings — use read_reference to dive deeper." + ), parameters=_READ_REFERENCE_PARAMS, handler=lambda args: "", # Handled specially in the loop ) @@ -468,11 +575,27 @@ def create_dispatch_agent_tool() -> ToolDefinition: return ToolDefinition( name="dispatch_agent", description=( - "Spawn a sub-agent to handle a complex subtask in its own context. " - "The sub-agent has access to read_file, glob, grep, and bash (read-only). " - "Use this for research tasks, large file analysis, or multi-file searches " - "that would fill up the main context." + "Spawn a sub-agent to handle a research subtask in its own isolated context. " + "The sub-agent has read-only access (read_file, glob, grep, bash). Use this for " + "multi-file analysis, large codebase exploration, or any research that would " + "fill up the main context window. The sub-agent returns a concise summary of findings. " + "Don't use this for quick single-file lookups — use read_file or grep directly." ), parameters=_DISPATCH_AGENT_PARAMS, handler=lambda args: "", # Handled specially in the loop ) + + +def create_ask_user_tool() -> ToolDefinition: + """Create the ask_user tool for structured elicitation.""" + return ToolDefinition( + name="ask_user", + description=( + "Ask the user a question and wait for their answer. Use this when you need " + "clarification, a decision between options, or confirmation before proceeding. " + "Optionally provide a list of options for the user to choose from. " + "The loop will pause until the user responds. Returns the user's answer as text." + ), + parameters=_ASK_USER_PARAMS, + handler=lambda args: "", # Handled specially in the loop + ) diff --git a/src/uipath/dev/services/skill_service.py b/src/uipath/dev/services/skill_service.py index adf0728..95b31b2 100644 --- a/src/uipath/dev/services/skill_service.py +++ b/src/uipath/dev/services/skill_service.py @@ -62,6 +62,48 @@ def get_skill_content(self, skill_id: str) -> str: raise FileNotFoundError(f"Skill not found: {skill_id}") return path.read_text(encoding="utf-8") + def get_skill_summary(self, skill_id: str) -> str: + """Return a compact summary: title + section headings + reference files. + + This is injected into the system prompt instead of the full content, + so the model can use ``read_reference`` to drill into details. + """ + path = self._resolve_skill_file(skill_id) + if not path.is_file(): + raise FileNotFoundError(f"Skill not found: {skill_id}") + text = path.read_text(encoding="utf-8") + + title = "" + headings: list[str] = [] + for line in text.splitlines(): + stripped = line.strip() + if ( + stripped.startswith("# ") + and not stripped.startswith("##") + and not title + ): + title = stripped + elif stripped.startswith("## "): + headings.append(stripped) + + # List sibling reference files the model can read_reference into + refs_dir = path.parent + ref_files = sorted( + f.name for f in refs_dir.iterdir() if f.is_file() and f.suffix == ".md" + ) + + parts = [title or f"# {skill_id}"] + if headings: + parts.append("\nSections:") + parts.extend(f" - {h.lstrip('#').strip()}" for h in headings) + if ref_files: + parts.append("\nAvailable reference files (use read_reference to view):") + parts.extend(f" - {f}" for f in ref_files) + parts.append( + "\nUse read_reference with the filename above to get full details." + ) + return "\n".join(parts) + def get_reference(self, skill_id: str, ref_path: str) -> str: """Read a reference file relative to the skill's parent references dir.""" # Skill ID is like "uipath/authentication" — base dir is "uipath" diff --git a/uv.lock b/uv.lock index 8a6b4d5..643bd8e 100644 --- a/uv.lock +++ b/uv.lock @@ -2266,7 +2266,7 @@ wheels = [ [[package]] name = "uipath-dev" -version = "0.0.64" +version = "0.0.65" source = { editable = "." } dependencies = [ { name = "fastapi" },