From 9f360d51fbfeac25684ec3f79ace6f044d8ab24c Mon Sep 17 00:00:00 2001 From: Cristian Pufu Date: Sat, 21 Feb 2026 08:26:25 +0200 Subject: [PATCH 1/4] fix: use UTC datetimes and reset graph state between chat turns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backend: replace all naive datetime.now() with datetime.now(timezone.utc) and datetime.fromtimestamp(..., tz=timezone.utc) so serialized ISO strings include +00:00 suffix. Frontend toLocaleTimeString() handles UTC→local conversion automatically. Frontend: reset stateEvents and activeNodes when __start__ fires at the beginning of each chat turn, so the graph highlights start fresh instead of retaining completed status from prior turns. Co-Authored-By: Claude Opus 4.6 --- .../dev/infrastructure/logging_handlers.py | 4 +- .../dev/infrastructure/tracing_exporter.py | 8 +- src/uipath/dev/models/chat.py | 8 +- src/uipath/dev/models/data.py | 6 +- src/uipath/dev/models/execution.py | 6 +- src/uipath/dev/models/messages.py | 6 +- src/uipath/dev/server/frontend/src/App.tsx | 14 ++-- .../src/components/graph/GraphPanel.tsx | 73 ++++++++++++------- .../src/components/traces/TraceTree.tsx | 40 +++++++++- .../server/frontend/src/store/useRunStore.ts | 26 ++++++- .../server/frontend/src/store/useWebSocket.ts | 9 ++- ...anel-DPvzWlJ8.js => ChatPanel-CJFPD9T1.js} | 2 +- .../server/static/assets/index-C45hVnyT.js | 42 ----------- .../server/static/assets/index-C62Pn1l1.css | 1 - .../server/static/assets/index-CvCM6cm0.js | 42 +++++++++++ .../server/static/assets/index-Dp7Ms2kW.css | 1 + src/uipath/dev/server/static/index.html | 4 +- src/uipath/dev/services/run_service.py | 16 ++-- 18 files changed, 197 insertions(+), 111 deletions(-) rename src/uipath/dev/server/static/assets/{ChatPanel-DPvzWlJ8.js => ChatPanel-CJFPD9T1.js} (99%) delete mode 100644 src/uipath/dev/server/static/assets/index-C45hVnyT.js delete mode 100644 src/uipath/dev/server/static/assets/index-C62Pn1l1.css create mode 100644 src/uipath/dev/server/static/assets/index-CvCM6cm0.js create mode 100644 src/uipath/dev/server/static/assets/index-Dp7Ms2kW.css diff --git a/src/uipath/dev/infrastructure/logging_handlers.py b/src/uipath/dev/infrastructure/logging_handlers.py index 6224b23..3b11b19 100644 --- a/src/uipath/dev/infrastructure/logging_handlers.py +++ b/src/uipath/dev/infrastructure/logging_handlers.py @@ -6,7 +6,7 @@ import os import re import threading -from datetime import datetime +from datetime import datetime, timezone from typing import Callable, Pattern from uipath.runtime.logging import UiPathRuntimeExecutionLogHandler @@ -35,7 +35,7 @@ def emit(self, record: logging.LogRecord): run_id=self.run_id, level=record.levelname, message=self.format(record), - timestamp=datetime.fromtimestamp(record.created), + timestamp=datetime.fromtimestamp(record.created, tz=timezone.utc), ) self.callback(log_data) except Exception: diff --git a/src/uipath/dev/infrastructure/tracing_exporter.py b/src/uipath/dev/infrastructure/tracing_exporter.py index deb453b..eb26b6b 100644 --- a/src/uipath/dev/infrastructure/tracing_exporter.py +++ b/src/uipath/dev/infrastructure/tracing_exporter.py @@ -1,7 +1,7 @@ """Custom OpenTelemetry trace exporter for CLI UI integration.""" import logging -from datetime import datetime +from datetime import datetime, timezone from typing import Callable, Sequence from opentelemetry import trace @@ -82,7 +82,7 @@ def _export_span(self, span: ReadableSpan): trace_id=trace_id, status=status, duration_ms=duration_ms, - timestamp=datetime.fromtimestamp(start_time), + timestamp=datetime.fromtimestamp(start_time, tz=timezone.utc), attributes=dict(span.attributes) if span.attributes else {}, ) @@ -97,7 +97,9 @@ def _export_span(self, span: ReadableSpan): run_id=run_id_val, level=log_level, message=event.name, - timestamp=datetime.fromtimestamp(event.timestamp / 1_000_000_000), + timestamp=datetime.fromtimestamp( + event.timestamp / 1_000_000_000, tz=timezone.utc + ), ) self.on_log(log_data) diff --git a/src/uipath/dev/models/chat.py b/src/uipath/dev/models/chat.py index bb1bc56..ef14139 100644 --- a/src/uipath/dev/models/chat.py +++ b/src/uipath/dev/models/chat.py @@ -1,6 +1,6 @@ """Aggregates conversation messages from conversation events.""" -from datetime import datetime +from datetime import datetime, timezone from uuid import uuid4 from uipath.core.chat import ( @@ -178,7 +178,7 @@ def get_timestamp(self, ev: UiPathConversationMessageEvent) -> str: """Choose timestamp from event if available, else fallback.""" if ev.start and ev.start.timestamp: return ev.start.timestamp - return datetime.now().isoformat() + return datetime.now(timezone.utc).isoformat() def get_role(self, ev: UiPathConversationMessageEvent) -> str: """Infer the role of the message from the event.""" @@ -189,7 +189,7 @@ def get_role(self, ev: UiPathConversationMessageEvent) -> str: def get_user_message(user_text: str) -> UiPathConversationMessage: """Build a user message from text input.""" - timestamp = datetime.now().isoformat() + timestamp = datetime.now(timezone.utc).isoformat() return UiPathConversationMessage( message_id=str(uuid4()), created_at=timestamp, @@ -216,7 +216,7 @@ def get_user_message_event( """Build a conversation event representing a user message from text input.""" message_id = str(uuid4()) content_part_id = str(uuid4()) - timestamp = datetime.now().isoformat() + timestamp = datetime.now(timezone.utc).isoformat() msg_start = UiPathConversationMessageStartEvent( role=role, diff --git a/src/uipath/dev/models/data.py b/src/uipath/dev/models/data.py index 2796403..f20f22b 100644 --- a/src/uipath/dev/models/data.py +++ b/src/uipath/dev/models/data.py @@ -1,7 +1,7 @@ """Plain data classes for inter-component communication (no Textual dependency).""" from dataclasses import dataclass, field -from datetime import datetime +from datetime import datetime, timezone from typing import Any from uipath.core.chat import UiPathConversationMessage, UiPathConversationMessageEvent @@ -28,7 +28,7 @@ class TraceData: trace_id: str | None = None status: str = "running" duration_ms: float | None = None - timestamp: datetime = field(default_factory=datetime.now) + timestamp: datetime = field(default_factory=lambda: datetime.now(timezone.utc)) attributes: dict[str, Any] = field(default_factory=dict) @@ -41,7 +41,7 @@ class StateData: qualified_node_name: str | None = None phase: str | None = None payload: dict[str, Any] | None = None - timestamp: datetime = field(default_factory=datetime.now) + timestamp: datetime = field(default_factory=lambda: datetime.now(timezone.utc)) @dataclass diff --git a/src/uipath/dev/models/execution.py b/src/uipath/dev/models/execution.py index cadaa3e..3aae0b1 100644 --- a/src/uipath/dev/models/execution.py +++ b/src/uipath/dev/models/execution.py @@ -1,7 +1,7 @@ """Models for representing execution runs and their data.""" import os -from datetime import datetime +from datetime import datetime, timezone from enum import Enum from typing import Any, cast from uuid import uuid4 @@ -38,7 +38,7 @@ def __init__( self.mode = mode self.resume_data: Any | None = None self.output_data: dict[str, Any] | str | None = None - self.start_time = datetime.now() + self.start_time = datetime.now(timezone.utc) self.end_time: datetime | None = None self.status = "pending" # pending, running, completed, failed, suspended self.traces: list[TraceData] = [] @@ -58,7 +58,7 @@ def duration(self) -> str: delta = self.end_time - self.start_time return f"{delta.total_seconds():.1f}s" elif self.start_time: - delta = datetime.now() - self.start_time + delta = datetime.now(timezone.utc) - self.start_time return f"{delta.total_seconds():.1f}s" return "0.0s" diff --git a/src/uipath/dev/models/messages.py b/src/uipath/dev/models/messages.py index 36a1433..bd91de3 100644 --- a/src/uipath/dev/models/messages.py +++ b/src/uipath/dev/models/messages.py @@ -1,6 +1,6 @@ """Messages used for inter-component communication in the UiPath Developer Console.""" -from datetime import datetime +from datetime import datetime, timezone from typing import Any from rich.console import RenderableType @@ -24,7 +24,7 @@ def __init__( self.run_id = run_id self.level = level self.message = message - self.timestamp = timestamp or datetime.now() + self.timestamp = timestamp or datetime.now(timezone.utc) super().__init__() @classmethod @@ -61,7 +61,7 @@ def __init__( self.trace_id = trace_id self.status = status self.duration_ms = duration_ms - self.timestamp = timestamp or datetime.now() + self.timestamp = timestamp or datetime.now(timezone.utc) self.attributes = attributes or {} super().__init__() diff --git a/src/uipath/dev/server/frontend/src/App.tsx b/src/uipath/dev/server/frontend/src/App.tsx index 9fe9e31..183b76c 100644 --- a/src/uipath/dev/server/frontend/src/App.tsx +++ b/src/uipath/dev/server/frontend/src/App.tsx @@ -28,6 +28,7 @@ export default function App() { setStateEvents, setGraphCache, setActiveNode, + removeActiveNode, } = useRunStore(); const { view, runId: routeRunId, setupEntrypoint, setupMode, navigate } = useHashRoute(); @@ -97,15 +98,18 @@ export default function App() { payload: s.payload, })), ); - // Seed activeNodes from historical events so the next WS event has proper prev context + // Seed activeNodes from historical events (replay all to get correct prev + executing) if (detail.status !== "completed" && detail.status !== "failed") { - const lastStarted = [...detail.states].reverse().find((s) => s.phase === "started"); - if (lastStarted) { - setActiveNode(runId, lastStarted.node_name, lastStarted.qualified_node_name); + for (const s of detail.states) { + if (s.phase === "started") { + setActiveNode(runId, s.node_name, s.qualified_node_name); + } else if (s.phase === "completed") { + removeActiveNode(runId, s.node_name); + } } } } - }, [upsertRun, setTraces, setLogs, setChatMessages, setStateEvents, setGraphCache, setActiveNode]); + }, [upsertRun, setTraces, setLogs, setChatMessages, setStateEvents, setGraphCache, setActiveNode, removeActiveNode]); // Subscribe to selected run useEffect(() => { diff --git a/src/uipath/dev/server/frontend/src/components/graph/GraphPanel.tsx b/src/uipath/dev/server/frontend/src/components/graph/GraphPanel.tsx index 8137c65..ebbe08f 100644 --- a/src/uipath/dev/server/frontend/src/components/graph/GraphPanel.tsx +++ b/src/uipath/dev/server/frontend/src/components/graph/GraphPanel.tsx @@ -448,18 +448,32 @@ export default function GraphPanel({ entrypoint, runId, breakpointNode, breakpoi ); }, [breakpointNode, layoutSeq, setNodes]); + const stateEvents = useRunStore((s) => s.stateEvents[runId]); + // Highlight edges + nodes during execution // - Paused at breakpoint: edges INTO breakpoint node + edges to next_nodes - // - Running: edges OUT of completed node, target nodes of those edges + // - Running: edges OUT of executing nodes, target nodes of those edges // - __start__: highlighted on first state event; __end__: highlighted when run completes useEffect(() => { const isPaused = !!breakpointNode; - let matchIds = new Set(); // Full React Flow node IDs of the "current" node + let matchIds = new Set(); // Full React Flow node IDs of the "current" node(s) const prevNodeIds = new Set(); // Full RF IDs of the previous node (for edge filtering when paused) const nextNodeIds = new Set(); // Full RF IDs of breakpoint next_nodes const activeTargetIds = new Set(); // Full RF IDs for isActiveNode const nodeTypeById = new Map(); + // Derive currently-executing nodes from the full event log (always consistent) + const executingNodes = new Map(); // nodeName → qualifiedNodeName + if (stateEvents) { + for (const evt of stateEvents) { + if (evt.phase === "started") { + executingNodes.set(evt.node_name, evt.qualified_node_name ?? null); + } else if (evt.phase === "completed") { + executingNodes.delete(evt.node_name); + } + } + } + // 1) Build matchIds, nextNodeIds, node type map setNodes((nds) => { for (const n of nds) { @@ -494,33 +508,38 @@ export default function GraphPanel({ entrypoint, runId, breakpointNode, breakpoi if (activeNode?.prev) { findNodeIds(activeNode.prev).forEach((id) => prevNodeIds.add(id)); } - } else if (activeNode) { - // Try qualified name first (exact match via "subgraph:node" → "subgraph/node") - const qualifiedName = activeNode.qualifiedNodeName; - if (qualifiedName) { - const qualifiedId = qualifiedName.replace(/:/g, "/"); - for (const n of nds) { - if (n.id === qualifiedId) { - matchIds.add(n.id); - } + } else if (executingNodes.size > 0) { + // Build label → RF ID lookup once + const labelToIds = new Map>(); + for (const n of nds) { + const label = n.data?.label as string | undefined; + if (!label) continue; + const plainId = n.id.includes("/") ? n.id.split("/").pop()! : n.id; + for (const key of [plainId, label]) { + let s = labelToIds.get(key); + if (!s) { s = new Set(); labelToIds.set(key, s); } + s.add(n.id); } } - // Fallback: label/plainId matching - if (matchIds.size === 0) { - const labelToIds = new Map>(); - for (const n of nds) { - const label = n.data?.label as string | undefined; - if (!label) continue; - const plainId = n.id.includes("/") ? n.id.split("/").pop()! : n.id; - for (const key of [plainId, label]) { - let s = labelToIds.get(key); - if (!s) { s = new Set(); labelToIds.set(key, s); } - s.add(n.id); + + for (const [nodeName, qualifiedNodeName] of executingNodes) { + let found = false; + // Try qualified name first (exact match via "subgraph:node" → "subgraph/node") + if (qualifiedNodeName) { + const qualifiedId = qualifiedNodeName.replace(/:/g, "/"); + for (const n of nds) { + if (n.id === qualifiedId) { + matchIds.add(n.id); + found = true; + } } } - matchIds = labelToIds.get(activeNode.current) ?? new Set(); + // Fallback: label/plainId matching + if (!found) { + const ids = labelToIds.get(nodeName); + if (ids) ids.forEach((id) => matchIds.add(id)); + } } - } return nds; @@ -542,7 +561,7 @@ export default function GraphPanel({ entrypoint, runId, breakpointNode, breakpoi isActive = intoBreakpoint || (matchIds.has(e.source) && nextNodeIds.has(e.target)); } else { - // Running: edges OUT of completed node + // Running: edges OUT of executing nodes isActive = matchIds.has(e.source); // For __end__: also highlight edges INTO it if (!isActive && nodeTypeById.get(e.target) === "endNode" && matchIds.has(e.target)) { @@ -596,9 +615,7 @@ export default function GraphPanel({ entrypoint, runId, breakpointNode, breakpoi : n; }), ); - }, [activeNode, breakpointNode, breakpointNextNodes, runStatus, layoutSeq, setNodes, setEdges]); - - const stateEvents = useRunStore((s) => s.stateEvents[runId]); + }, [stateEvents, activeNode, breakpointNode, breakpointNextNodes, runStatus, layoutSeq, setNodes, setEdges]); // Subscribe to cached graph reactively (populated async from run detail) const cachedGraph = useRunStore((s) => s.graphCache[runId]); diff --git a/src/uipath/dev/server/frontend/src/components/traces/TraceTree.tsx b/src/uipath/dev/server/frontend/src/components/traces/TraceTree.tsx index 9bf7cbc..2c848dd 100644 --- a/src/uipath/dev/server/frontend/src/components/traces/TraceTree.tsx +++ b/src/uipath/dev/server/frontend/src/components/traces/TraceTree.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect, useCallback, useRef } from "react"; +import { useState, useEffect, useCallback, useRef, useMemo } from "react"; import type { TraceSpan } from "../../types/run"; import { useRunStore } from "../../store/useRunStore"; import SpanDetails from "./SpanDetails"; @@ -129,6 +129,16 @@ function formatDuration(ms: number | null | undefined): string { return `${(ms / 1000).toFixed(2)}s`; } +function treeToJson(nodes: TreeNode[]): unknown[] { + return nodes.map((node) => { + const { span } = node; + if (node.children.length > 0) { + return { name: span.span_name, children: treeToJson(node.children) }; + } + return { name: span.span_name }; + }); +} + export default function TraceTree({ traces }: Props) { const [selectedSpan, setSelectedSpan] = useState(null); const [collapsedIds, setCollapsedIds] = useState>(new Set()); @@ -137,8 +147,18 @@ export default function TraceTree({ traces }: Props) { return saved ? parseFloat(saved) : 50; }); const [isDragging, setIsDragging] = useState(false); + const [copied, setCopied] = useState(false); const tree = buildTree(traces); + const treeJson = useMemo(() => JSON.stringify(treeToJson(tree), null, 2), [traces]); + + const copyTree = useCallback(() => { + navigator.clipboard.writeText(treeJson).then(() => { + setCopied(true); + setTimeout(() => setCopied(false), 1500); + }); + }, [treeJson]); + const focusedSpan = useRunStore((s) => s.focusedSpan); const setFocusedSpan = useRunStore((s) => s.setFocusedSpan); const [scrollToSpanId, setScrollToSpanId] = useState(null); @@ -244,7 +264,23 @@ export default function TraceTree({ traces }: Props) { return (
{/* Left: tree view */} -
+
+ {traces.length > 0 && ( + + )}
{tree.length === 0 ? (
diff --git a/src/uipath/dev/server/frontend/src/store/useRunStore.ts b/src/uipath/dev/server/frontend/src/store/useRunStore.ts index 2e6e15a..98c0433 100644 --- a/src/uipath/dev/server/frontend/src/store/useRunStore.ts +++ b/src/uipath/dev/server/frontend/src/store/useRunStore.ts @@ -37,8 +37,10 @@ interface RunStore { toggleBreakpoint: (runId: string, nodeId: string) => void; clearBreakpoints: (runId: string) => void; - activeNodes: Record; + activeNodes: Record; prev: string | null }>; setActiveNode: (runId: string, nodeName: string, qualifiedNodeName?: string | null) => void; + removeActiveNode: (runId: string, nodeName: string) => void; + resetRunGraphState: (runId: string) => void; stateEvents: Record }[]>; addStateEvent: (runId: string, nodeName: string, payload?: Record, qualifiedNodeName?: string | null, phase?: string | null) => void; @@ -220,15 +222,35 @@ export const useRunStore = create((set) => ({ activeNodes: {}, setActiveNode: (runId, nodeName, qualifiedNodeName) => + set((state) => { + const existing = state.activeNodes[runId] ?? { executing: {}, prev: null }; + return { + activeNodes: { + ...state.activeNodes, + [runId]: { + executing: { ...existing.executing, [nodeName]: qualifiedNodeName ?? null }, + prev: existing.prev, + }, + }, + }; + }), + removeActiveNode: (runId, nodeName) => set((state) => { const existing = state.activeNodes[runId]; + if (!existing) return state; + const { [nodeName]: _, ...rest } = existing.executing; return { activeNodes: { ...state.activeNodes, - [runId]: { prev: existing?.current ?? null, current: nodeName, qualifiedNodeName }, + [runId]: { executing: rest, prev: nodeName }, }, }; }), + resetRunGraphState: (runId) => + set((state) => ({ + stateEvents: { ...state.stateEvents, [runId]: [] }, + activeNodes: { ...state.activeNodes, [runId]: { executing: {}, prev: null } }, + })), stateEvents: {}, addStateEvent: (runId, nodeName, payload, qualifiedNodeName, phase) => diff --git a/src/uipath/dev/server/frontend/src/store/useWebSocket.ts b/src/uipath/dev/server/frontend/src/store/useWebSocket.ts index f2d1478..bc9743c 100644 --- a/src/uipath/dev/server/frontend/src/store/useWebSocket.ts +++ b/src/uipath/dev/server/frontend/src/store/useWebSocket.ts @@ -15,7 +15,7 @@ function getWs(): WsClient { export function useWebSocket() { const ws = useRef(getWs()); - const { upsertRun, addTrace, addLog, addChatEvent, setActiveInterrupt, setActiveNode, addStateEvent, setReloadPending } = useRunStore(); + const { upsertRun, addTrace, addLog, addChatEvent, setActiveInterrupt, setActiveNode, removeActiveNode, resetRunGraphState, addStateEvent, setReloadPending } = useRunStore(); useEffect(() => { const client = ws.current; @@ -47,8 +47,13 @@ export function useWebSocket() { const qualifiedNodeName = (msg.payload.qualified_node_name as string | undefined) ?? null; const phase = (msg.payload.phase as string | undefined) ?? null; const payload = msg.payload.payload as Record | undefined; + if (nodeName === "__start__" && phase === "started") { + resetRunGraphState(runId); + } if (phase === "started") { setActiveNode(runId, nodeName, qualifiedNodeName); + } else if (phase === "completed") { + removeActiveNode(runId, nodeName); } addStateEvent(runId, nodeName, payload, qualifiedNodeName, phase); break; @@ -60,7 +65,7 @@ export function useWebSocket() { }); return unsub; - }, [upsertRun, addTrace, addLog, addChatEvent, setActiveInterrupt, setActiveNode, addStateEvent, setReloadPending]); + }, [upsertRun, addTrace, addLog, addChatEvent, setActiveInterrupt, setActiveNode, removeActiveNode, resetRunGraphState, addStateEvent, setReloadPending]); return ws.current; } diff --git a/src/uipath/dev/server/static/assets/ChatPanel-DPvzWlJ8.js b/src/uipath/dev/server/static/assets/ChatPanel-CJFPD9T1.js similarity index 99% rename from src/uipath/dev/server/static/assets/ChatPanel-DPvzWlJ8.js rename to src/uipath/dev/server/static/assets/ChatPanel-CJFPD9T1.js index 9f761d9..5cd3097 100644 --- a/src/uipath/dev/server/static/assets/ChatPanel-DPvzWlJ8.js +++ b/src/uipath/dev/server/static/assets/ChatPanel-CJFPD9T1.js @@ -1,4 +1,4 @@ -import{g as hr,j as P,a as $e}from"./vendor-react-BVoutfaX.js";import{u as sn}from"./index-C45hVnyT.js";import"./vendor-reactflow-mU21rT8r.js";function zo(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Uo=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$o=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ho={};function Vr(e,t){return(Ho.jsx?$o:Uo).test(e)}const Go=/[ \t\n\f\r]/g;function Ko(e){return typeof e=="object"?e.type==="text"?Yr(e.value):!1:Yr(e)}function Yr(e){return e.replace(Go,"")===""}class jt{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}jt.prototype.normal={};jt.prototype.property={};jt.prototype.space=void 0;function Yi(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new jt(n,r,t)}function ir(e){return e.toLowerCase()}class De{constructor(t,n){this.attribute=n,this.property=t}}De.prototype.attribute="";De.prototype.booleanish=!1;De.prototype.boolean=!1;De.prototype.commaOrSpaceSeparated=!1;De.prototype.commaSeparated=!1;De.prototype.defined=!1;De.prototype.mustUseProperty=!1;De.prototype.number=!1;De.prototype.overloadedBoolean=!1;De.prototype.property="";De.prototype.spaceSeparated=!1;De.prototype.space=void 0;let qo=0;const ee=Et(),ke=Et(),ar=Et(),C=Et(),be=Et(),Ct=Et(),Ue=Et();function Et(){return 2**++qo}const or=Object.freeze(Object.defineProperty({__proto__:null,boolean:ee,booleanish:ke,commaOrSpaceSeparated:Ue,commaSeparated:Ct,number:C,overloadedBoolean:ar,spaceSeparated:be},Symbol.toStringTag,{value:"Module"})),Fn=Object.keys(or);class br extends De{constructor(t,n,r,i){let o=-1;if(super(t,n),jr(this,"space",i),typeof r=="number")for(;++o4&&n.slice(0,4)==="data"&&Zo.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Zr,Jo);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Zr.test(o)){let a=o.replace(jo,Qo);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=br}return new i(r,t)}function Qo(e){return"-"+e.toLowerCase()}function Jo(e){return e.charAt(1).toUpperCase()}const es=Yi([ji,Wo,Qi,Ji,ea],"html"),Er=Yi([ji,Vo,Qi,Ji,ea],"svg");function ts(e){return e.join(" ").trim()}var wt={},zn,Xr;function ns(){if(Xr)return zn;Xr=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,s=/^\s+|\s+$/g,l=` +import{g as hr,j as P,a as $e}from"./vendor-react-BVoutfaX.js";import{u as sn}from"./index-CvCM6cm0.js";import"./vendor-reactflow-mU21rT8r.js";function zo(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Uo=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$o=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ho={};function Vr(e,t){return(Ho.jsx?$o:Uo).test(e)}const Go=/[ \t\n\f\r]/g;function Ko(e){return typeof e=="object"?e.type==="text"?Yr(e.value):!1:Yr(e)}function Yr(e){return e.replace(Go,"")===""}class jt{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}jt.prototype.normal={};jt.prototype.property={};jt.prototype.space=void 0;function Yi(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new jt(n,r,t)}function ir(e){return e.toLowerCase()}class De{constructor(t,n){this.attribute=n,this.property=t}}De.prototype.attribute="";De.prototype.booleanish=!1;De.prototype.boolean=!1;De.prototype.commaOrSpaceSeparated=!1;De.prototype.commaSeparated=!1;De.prototype.defined=!1;De.prototype.mustUseProperty=!1;De.prototype.number=!1;De.prototype.overloadedBoolean=!1;De.prototype.property="";De.prototype.spaceSeparated=!1;De.prototype.space=void 0;let qo=0;const ee=Et(),ke=Et(),ar=Et(),C=Et(),be=Et(),Ct=Et(),Ue=Et();function Et(){return 2**++qo}const or=Object.freeze(Object.defineProperty({__proto__:null,boolean:ee,booleanish:ke,commaOrSpaceSeparated:Ue,commaSeparated:Ct,number:C,overloadedBoolean:ar,spaceSeparated:be},Symbol.toStringTag,{value:"Module"})),Fn=Object.keys(or);class br extends De{constructor(t,n,r,i){let o=-1;if(super(t,n),jr(this,"space",i),typeof r=="number")for(;++o4&&n.slice(0,4)==="data"&&Zo.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Zr,Jo);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Zr.test(o)){let a=o.replace(jo,Qo);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=br}return new i(r,t)}function Qo(e){return"-"+e.toLowerCase()}function Jo(e){return e.charAt(1).toUpperCase()}const es=Yi([ji,Wo,Qi,Ji,ea],"html"),Er=Yi([ji,Vo,Qi,Ji,ea],"svg");function ts(e){return e.join(" ").trim()}var wt={},zn,Xr;function ns(){if(Xr)return zn;Xr=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,s=/^\s+|\s+$/g,l=` `,c="/",d="*",u="",f="comment",p="declaration";function g(x,m){if(typeof x!="string")throw new TypeError("First argument must be a string");if(!x)return[];m=m||{};var k=1,w=1;function T(D){var O=D.match(t);O&&(k+=O.length);var j=D.lastIndexOf(l);w=~j?D.length-j:w+D.length}function A(){var D={line:k,column:w};return function(O){return O.position=new _(D),G(),O}}function _(D){this.start=D,this.end={line:k,column:w},this.source=m.source}_.prototype.content=x;function $(D){var O=new Error(m.source+":"+k+":"+w+": "+D);if(O.reason=D,O.filename=m.source,O.line=k,O.column=w,O.source=x,!m.silent)throw O}function H(D){var O=D.exec(x);if(O){var j=O[0];return T(j),x=x.slice(j.length),O}}function G(){H(n)}function S(D){var O;for(D=D||[];O=B();)O!==!1&&D.push(O);return D}function B(){var D=A();if(!(c!=x.charAt(0)||d!=x.charAt(1))){for(var O=2;u!=x.charAt(O)&&(d!=x.charAt(O)||c!=x.charAt(O+1));)++O;if(O+=2,u===x.charAt(O-1))return $("End of comment missing");var j=x.slice(2,O-2);return w+=2,T(j),x=x.slice(O),w+=2,D({type:f,comment:j})}}function F(){var D=A(),O=H(r);if(O){if(B(),!H(i))return $("property missing ':'");var j=H(o),se=D({type:p,property:y(O[0].replace(e,u)),value:j?y(j[0].replace(e,u)):u});return H(a),se}}function J(){var D=[];S(D);for(var O;O=F();)O!==!1&&(D.push(O),S(D));return D}return G(),J()}function y(x){return x?x.replace(s,u):u}return zn=g,zn}var Qr;function rs(){if(Qr)return wt;Qr=1;var e=wt&&wt.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(wt,"__esModule",{value:!0}),wt.default=n;const t=e(ns());function n(r,i){let o=null;if(!r||typeof r!="string")return o;const a=(0,t.default)(r),s=typeof i=="function";return a.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:d}=l;s?i(c,d,l):d&&(o=o||{},o[c]=d)}),o}return wt}var Ft={},Jr;function is(){if(Jr)return Ft;Jr=1,Object.defineProperty(Ft,"__esModule",{value:!0}),Ft.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(c){return!c||n.test(c)||e.test(c)},a=function(c,d){return d.toUpperCase()},s=function(c,d){return"".concat(d,"-")},l=function(c,d){return d===void 0&&(d={}),o(c)?c:(c=c.toLowerCase(),d.reactCompat?c=c.replace(i,s):c=c.replace(r,s),c.replace(t,a))};return Ft.camelCase=l,Ft}var zt,ei;function as(){if(ei)return zt;ei=1;var e=zt&&zt.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(rs()),n=is();function r(i,o){var a={};return!i||typeof i!="string"||(0,t.default)(i,function(s,l){s&&l&&(a[(0,n.camelCase)(s,o)]=l)}),a}return r.default=r,zt=r,zt}var os=as();const ss=hr(os),ta=na("end"),yr=na("start");function na(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 ls(e){const t=yr(e),n=ta(e);if(t&&n)return{start:t,end:n}}function Kt(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ti(e.position):"start"in e||"end"in e?ti(e):"line"in e||"column"in e?sr(e):""}function sr(e){return ni(e&&e.line)+":"+ni(e&&e.column)}function ti(e){return sr(e&&e.start)+"-"+sr(e&&e.end)}function ni(e){return e&&typeof e=="number"?e:1}class Ae extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(a=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const s=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=s?s.line:void 0,this.name=Kt(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ae.prototype.file="";Ae.prototype.name="";Ae.prototype.reason="";Ae.prototype.message="";Ae.prototype.stack="";Ae.prototype.column=void 0;Ae.prototype.line=void 0;Ae.prototype.ancestors=void 0;Ae.prototype.cause=void 0;Ae.prototype.fatal=void 0;Ae.prototype.place=void 0;Ae.prototype.ruleId=void 0;Ae.prototype.source=void 0;const _r={}.hasOwnProperty,cs=new Map,us=/[A-Z]/g,ds=new Set(["table","tbody","thead","tfoot","tr"]),ps=new Set(["td","th"]),ra="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function fs(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=xs(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=_s(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"?Er:es,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=ia(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function ia(e,t,n){if(t.type==="element")return gs(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return ms(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return bs(e,t,n);if(t.type==="mdxjsEsm")return hs(e,t);if(t.type==="root")return Es(e,t,n);if(t.type==="text")return ys(e,t)}function gs(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Er,e.schema=i),e.ancestors.push(t);const o=oa(e,t.tagName,!1),a=ks(e,t);let s=kr(e,t);return ds.has(t.tagName)&&(s=s.filter(function(l){return typeof l=="string"?!Ko(l):!0})),aa(e,a,o,t),xr(a,s),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function ms(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)}Vt(e,t.position)}function hs(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Vt(e,t.position)}function bs(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Er,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:oa(e,t.name,!0),a=ws(e,t),s=kr(e,t);return aa(e,a,o,t),xr(a,s),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function Es(e,t,n){const r={};return xr(r,kr(e,t)),e.create(t,e.Fragment,r,n)}function ys(e,t){return t.value}function aa(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function xr(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function _s(e,t,n){return r;function r(i,o,a,s){const c=Array.isArray(a.children)?n:t;return s?c(o,a,s):c(o,a)}}function xs(e,t){return n;function n(r,i,o,a){const s=Array.isArray(o.children),l=yr(r);return t(i,o,a,s,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function ks(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&_r.call(t.properties,i)){const o=Ss(e,i,t.properties[i]);if(o){const[a,s]=o;e.tableCellAlignToStyle&&a==="align"&&typeof s=="string"&&ps.has(t.tagName)?r=s:n[a]=s}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function ws(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const a=o.expression;a.type;const s=a.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else Vt(e,t.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const s=r.value.data.estree.body[0];s.type,o=e.evaluater.evaluateExpression(s.expression)}else Vt(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function kr(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:cs;for(;++ri?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);o0?(He(e,e.length,0,t),e):t}const ai={}.hasOwnProperty;function la(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 Ve(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Re=ft(/[A-Za-z]/),Te=ft(/[\dA-Za-z]/),Ms=ft(/[#-'*+\--9=?A-Z^-~]/);function yn(e){return e!==null&&(e<32||e===127)}const lr=ft(/\d/),Ds=ft(/[\dA-Fa-f]/),Ls=ft(/[!-/:-@[-`{-~]/);function W(e){return e!==null&&e<-2}function ge(e){return e!==null&&(e<0||e===32)}function re(e){return e===-2||e===-1||e===32}const Nn=ft(new RegExp("\\p{P}|\\p{S}","u")),bt=ft(/\s/);function ft(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Rt(e){const t=[];let n=-1,r=0,i=0;for(;++n55295&&o<57344){const s=e.charCodeAt(n+1);o<56320&&s>56319&&s<57344?(a=String.fromCharCode(o,s),i=1):a="�"}else a=String.fromCharCode(o);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function ae(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(l){return re(l)?(e.enter(n),s(l)):t(l)}function s(l){return re(l)&&o++a))return;const $=t.events.length;let H=$,G,S;for(;H--;)if(t.events[H][0]==="exit"&&t.events[H][1].type==="chunkFlow"){if(G){S=t.events[H][1].end;break}G=!0}for(m(r),_=$;_w;){const A=n[T];t.containerState=A[1],A[0].exit.call(t,e)}n.length=w}function k(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Us(e,t,n){return ae(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ot(e){if(e===null||ge(e)||bt(e))return 1;if(Nn(e))return 2}function vn(e,t,n){const r=[];let i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const u={...e[r][1].end},f={...e[n][1].start};si(u,-l),si(f,l),a={type:l>1?"strongSequence":"emphasisSequence",start:u,end:{...e[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},o={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...a.start},end:{...s.end}},e[r][1].end={...a.start},e[n][1].start={...s.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=Ke(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Ke(c,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",o,t]]),c=Ke(c,vn(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Ke(c,[["exit",o,t],["enter",s,t],["exit",s,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,c=Ke(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,He(e,r-1,n-r+3,c),n=r+c.length-d-2;break}}for(n=-1;++n0&&re(_)?ae(e,k,"linePrefix",o+1)(_):k(_)}function k(_){return _===null||W(_)?e.check(li,y,T)(_):(e.enter("codeFlowValue"),w(_))}function w(_){return _===null||W(_)?(e.exit("codeFlowValue"),k(_)):(e.consume(_),w)}function T(_){return e.exit("codeFenced"),t(_)}function A(_,$,H){let G=0;return S;function S(O){return _.enter("lineEnding"),_.consume(O),_.exit("lineEnding"),B}function B(O){return _.enter("codeFencedFence"),re(O)?ae(_,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):F(O)}function F(O){return O===s?(_.enter("codeFencedFenceSequence"),J(O)):H(O)}function J(O){return O===s?(G++,_.consume(O),J):G>=a?(_.exit("codeFencedFenceSequence"),re(O)?ae(_,D,"whitespace")(O):D(O)):H(O)}function D(O){return O===null||W(O)?(_.exit("codeFencedFence"),$(O)):H(O)}}}function Qs(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const $n={name:"codeIndented",tokenize:el},Js={partial:!0,tokenize:tl};function el(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),ae(e,o,"linePrefix",5)(c)}function o(c){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(c):n(c)}function a(c){return c===null?l(c):W(c)?e.attempt(Js,a,l)(c):(e.enter("codeFlowValue"),s(c))}function s(c){return c===null||W(c)?(e.exit("codeFlowValue"),a(c)):(e.consume(c),s)}function l(c){return e.exit("codeIndented"),t(c)}}function tl(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):W(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):ae(e,o,"linePrefix",5)(a)}function o(a){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(a):W(a)?i(a):n(a)}}const nl={name:"codeText",previous:il,resolve:rl,tokenize:al};function rl(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 o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Ut(this.left,r),o.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),Ut(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ut(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(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function ga(e,t,n,r,i,o,a,s,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return u;function u(m){return m===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(m),e.exit(o),f):m===null||m===32||m===41||yn(m)?n(m):(e.enter(r),e.enter(a),e.enter(s),e.enter("chunkString",{contentType:"string"}),y(m))}function f(m){return m===62?(e.enter(o),e.consume(m),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(m))}function p(m){return m===62?(e.exit("chunkString"),e.exit(s),f(m)):m===null||m===60||W(m)?n(m):(e.consume(m),m===92?g:p)}function g(m){return m===60||m===62||m===92?(e.consume(m),p):p(m)}function y(m){return!d&&(m===null||m===41||ge(m))?(e.exit("chunkString"),e.exit(s),e.exit(a),e.exit(r),t(m)):d999||p===null||p===91||p===93&&!l||p===94&&!s&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(o),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):W(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),u(p))}function u(p){return p===null||p===91||p===93||W(p)||s++>999?(e.exit("chunkString"),d(p)):(e.consume(p),l||(l=!re(p)),p===92?f:u)}function f(p){return p===91||p===92||p===93?(e.consume(p),s++,u):u(p)}}function ha(e,t,n,r,i,o){let a;return s;function s(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),a=f===40?41:f,l):n(f)}function l(f){return f===a?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(o),c(f))}function c(f){return f===a?(e.exit(o),l(a)):f===null?n(f):W(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ae(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===a||f===null||W(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?u:d)}function u(f){return f===a||f===92?(e.consume(f),d):d(f)}}function qt(e,t){let n;return r;function r(i){return W(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):re(i)?ae(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const fl={name:"definition",tokenize:ml},gl={partial:!0,tokenize:hl};function ml(e,t,n){const r=this;let i;return o;function o(p){return e.enter("definition"),a(p)}function a(p){return ma.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return i=Ve(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return ge(p)?qt(e,c)(p):c(p)}function c(p){return ga(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(gl,u,u)(p)}function u(p){return re(p)?ae(e,f,"whitespace")(p):f(p)}function f(p){return p===null||W(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function hl(e,t,n){return r;function r(s){return ge(s)?qt(e,i)(s):n(s)}function i(s){return ha(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function o(s){return re(s)?ae(e,a,"whitespace")(s):a(s)}function a(s){return s===null||W(s)?t(s):n(s)}}const bl={name:"hardBreakEscape",tokenize:El};function El(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return W(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const yl={name:"headingAtx",resolve:_l,tokenize:xl};function _l(e,t){let n=e.length-2,r=3,i,o;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},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},He(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function xl(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),o(d)}function o(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(e.consume(d),a):d===null||ge(d)?(e.exit("atxHeadingSequence"),s(d)):n(d)}function s(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||W(d)?(e.exit("atxHeading"),t(d)):re(d)?ae(e,s,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),s(d))}function c(d){return d===null||d===35||ge(d)?(e.exit("atxHeadingText"),s(d)):(e.consume(d),c)}}const kl=["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"],ui=["pre","script","style","textarea"],wl={concrete:!0,name:"htmlFlow",resolveTo:vl,tokenize:Tl},Sl={partial:!0,tokenize:Cl},Nl={partial:!0,tokenize:Al};function vl(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 Tl(e,t,n){const r=this;let i,o,a,s,l;return c;function c(E){return d(E)}function d(E){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(E),u}function u(E){return E===33?(e.consume(E),f):E===47?(e.consume(E),o=!0,y):E===63?(e.consume(E),i=3,r.interrupt?t:h):Re(E)?(e.consume(E),a=String.fromCharCode(E),x):n(E)}function f(E){return E===45?(e.consume(E),i=2,p):E===91?(e.consume(E),i=5,s=0,g):Re(E)?(e.consume(E),i=4,r.interrupt?t:h):n(E)}function p(E){return E===45?(e.consume(E),r.interrupt?t:h):n(E)}function g(E){const Ce="CDATA[";return E===Ce.charCodeAt(s++)?(e.consume(E),s===Ce.length?r.interrupt?t:F:g):n(E)}function y(E){return Re(E)?(e.consume(E),a=String.fromCharCode(E),x):n(E)}function x(E){if(E===null||E===47||E===62||ge(E)){const Ce=E===47,Ge=a.toLowerCase();return!Ce&&!o&&ui.includes(Ge)?(i=1,r.interrupt?t(E):F(E)):kl.includes(a.toLowerCase())?(i=6,Ce?(e.consume(E),m):r.interrupt?t(E):F(E)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(E):o?k(E):w(E))}return E===45||Te(E)?(e.consume(E),a+=String.fromCharCode(E),x):n(E)}function m(E){return E===62?(e.consume(E),r.interrupt?t:F):n(E)}function k(E){return re(E)?(e.consume(E),k):S(E)}function w(E){return E===47?(e.consume(E),S):E===58||E===95||Re(E)?(e.consume(E),T):re(E)?(e.consume(E),w):S(E)}function T(E){return E===45||E===46||E===58||E===95||Te(E)?(e.consume(E),T):A(E)}function A(E){return E===61?(e.consume(E),_):re(E)?(e.consume(E),A):w(E)}function _(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),l=E,$):re(E)?(e.consume(E),_):H(E)}function $(E){return E===l?(e.consume(E),l=null,G):E===null||W(E)?n(E):(e.consume(E),$)}function H(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||ge(E)?A(E):(e.consume(E),H)}function G(E){return E===47||E===62||re(E)?w(E):n(E)}function S(E){return E===62?(e.consume(E),B):n(E)}function B(E){return E===null||W(E)?F(E):re(E)?(e.consume(E),B):n(E)}function F(E){return E===45&&i===2?(e.consume(E),j):E===60&&i===1?(e.consume(E),se):E===62&&i===4?(e.consume(E),ue):E===63&&i===3?(e.consume(E),h):E===93&&i===5?(e.consume(E),pe):W(E)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Sl,fe,J)(E)):E===null||W(E)?(e.exit("htmlFlowData"),J(E)):(e.consume(E),F)}function J(E){return e.check(Nl,D,fe)(E)}function D(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),O}function O(E){return E===null||W(E)?J(E):(e.enter("htmlFlowData"),F(E))}function j(E){return E===45?(e.consume(E),h):F(E)}function se(E){return E===47?(e.consume(E),a="",Z):F(E)}function Z(E){if(E===62){const Ce=a.toLowerCase();return ui.includes(Ce)?(e.consume(E),ue):F(E)}return Re(E)&&a.length<8?(e.consume(E),a+=String.fromCharCode(E),Z):F(E)}function pe(E){return E===93?(e.consume(E),h):F(E)}function h(E){return E===62?(e.consume(E),ue):E===45&&i===2?(e.consume(E),h):F(E)}function ue(E){return E===null||W(E)?(e.exit("htmlFlowData"),fe(E)):(e.consume(E),ue)}function fe(E){return e.exit("htmlFlow"),t(E)}}function Al(e,t,n){const r=this;return i;function i(a){return W(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):n(a)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function Cl(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Zt,t,n)}}const Ol={name:"htmlText",tokenize:Il};function Il(e,t,n){const r=this;let i,o,a;return s;function s(h){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(h),l}function l(h){return h===33?(e.consume(h),c):h===47?(e.consume(h),A):h===63?(e.consume(h),w):Re(h)?(e.consume(h),H):n(h)}function c(h){return h===45?(e.consume(h),d):h===91?(e.consume(h),o=0,g):Re(h)?(e.consume(h),k):n(h)}function d(h){return h===45?(e.consume(h),p):n(h)}function u(h){return h===null?n(h):h===45?(e.consume(h),f):W(h)?(a=u,se(h)):(e.consume(h),u)}function f(h){return h===45?(e.consume(h),p):u(h)}function p(h){return h===62?j(h):h===45?f(h):u(h)}function g(h){const ue="CDATA[";return h===ue.charCodeAt(o++)?(e.consume(h),o===ue.length?y:g):n(h)}function y(h){return h===null?n(h):h===93?(e.consume(h),x):W(h)?(a=y,se(h)):(e.consume(h),y)}function x(h){return h===93?(e.consume(h),m):y(h)}function m(h){return h===62?j(h):h===93?(e.consume(h),m):y(h)}function k(h){return h===null||h===62?j(h):W(h)?(a=k,se(h)):(e.consume(h),k)}function w(h){return h===null?n(h):h===63?(e.consume(h),T):W(h)?(a=w,se(h)):(e.consume(h),w)}function T(h){return h===62?j(h):w(h)}function A(h){return Re(h)?(e.consume(h),_):n(h)}function _(h){return h===45||Te(h)?(e.consume(h),_):$(h)}function $(h){return W(h)?(a=$,se(h)):re(h)?(e.consume(h),$):j(h)}function H(h){return h===45||Te(h)?(e.consume(h),H):h===47||h===62||ge(h)?G(h):n(h)}function G(h){return h===47?(e.consume(h),j):h===58||h===95||Re(h)?(e.consume(h),S):W(h)?(a=G,se(h)):re(h)?(e.consume(h),G):j(h)}function S(h){return h===45||h===46||h===58||h===95||Te(h)?(e.consume(h),S):B(h)}function B(h){return h===61?(e.consume(h),F):W(h)?(a=B,se(h)):re(h)?(e.consume(h),B):G(h)}function F(h){return h===null||h===60||h===61||h===62||h===96?n(h):h===34||h===39?(e.consume(h),i=h,J):W(h)?(a=F,se(h)):re(h)?(e.consume(h),F):(e.consume(h),D)}function J(h){return h===i?(e.consume(h),i=void 0,O):h===null?n(h):W(h)?(a=J,se(h)):(e.consume(h),J)}function D(h){return h===null||h===34||h===39||h===60||h===61||h===96?n(h):h===47||h===62||ge(h)?G(h):(e.consume(h),D)}function O(h){return h===47||h===62||ge(h)?G(h):n(h)}function j(h){return h===62?(e.consume(h),e.exit("htmlTextData"),e.exit("htmlText"),t):n(h)}function se(h){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Z}function Z(h){return re(h)?ae(e,pe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h):pe(h)}function pe(h){return e.enter("htmlTextData"),a(h)}}const Nr={name:"labelEnd",resolveAll:Ll,resolveTo:Pl,tokenize:Bl},Rl={tokenize:Fl},Ml={tokenize:zl},Dl={tokenize:Ul};function Ll(e){let t=-1;const n=[];for(;++t=3&&(c===null||W(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),re(c)?ae(e,s,"whitespace")(c):s(c))}}const Me={continuation:{tokenize:Zl},exit:Ql,name:"list",tokenize:jl},Vl={partial:!0,tokenize:Jl},Yl={partial:!0,tokenize:Xl};function jl(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return s;function s(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:lr(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(En,n,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return lr(p)&&++a<10?(e.consume(p),l):(!r.interrupt||a<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Zt,r.interrupt?n:d,e.attempt(Vl,f,u))}function d(p){return r.containerState.initialBlankLine=!0,o++,f(p)}function u(p){return re(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Zl(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Zt,i,o);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ae(e,t,"listItemIndent",r.containerState.size+1)(s)}function o(s){return r.containerState.furtherBlankLines||!re(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Yl,t,a)(s))}function a(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,ae(e,e.attempt(Me,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function Xl(e,t,n){const r=this;return ae(e,i,"listItemIndent",r.containerState.size+1);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(o):n(o)}}function Ql(e){e.exit(this.containerState.type)}function Jl(e,t,n){const r=this;return ae(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const a=r.events[r.events.length-1];return!re(o)&&a&&a[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const di={name:"setextUnderline",resolveTo:ec,tokenize:tc};function ec(e,t){let n=e.length,r,i,o;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),!o&&e[n][1].type==="definition"&&(o=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",a,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function tc(e,t,n){const r=this;let i;return o;function o(c){let d=r.events.length,u;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){u=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||u)?(e.enter("setextHeadingLine"),i=c,a(c)):n(c)}function a(c){return e.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===i?(e.consume(c),s):(e.exit("setextHeadingLineSequence"),re(c)?ae(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||W(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const nc={tokenize:rc};function rc(e){const t=this,n=e.attempt(Zt,r,e.attempt(this.parser.constructs.flowInitial,i,ae(e,e.attempt(this.parser.constructs.flow,i,e.attempt(ll,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const ic={resolveAll:Ea()},ac=ba("string"),oc=ba("text");function ba(e){return{resolveAll:Ea(e==="text"?sc:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,a,s);return a;function a(d){return c(d)?o(d):s(d)}function s(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return c(d)?(n.exit("data"),o(d)):(n.consume(d),l)}function c(d){if(d===null)return!0;const u=i[d];let f=-1;if(u)for(;++f-1){const s=a[0];typeof s=="string"?a[0]=s.slice(r):a.shift()}o>0&&a.push(e[i].slice(0,o))}return a}function _c(e,t){let n=-1;const r=[];let i;for(;++n0){const Be=V.tokenStack[V.tokenStack.length-1];(Be[1]||fi).call(V,void 0,Be[0])}for(R.position={start:pt(N.length>0?N[0][1].start:{line:1,column:1,offset:0}),end:pt(N.length>0?N[N.length-2][1].end:{line:1,column:1,offset:0})},le=-1;++lei.map(i=>d[i]); -var De=Object.defineProperty;var ze=(t,s,r)=>s in t?De(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r;var K=(t,s,r)=>ze(t,typeof s!="symbol"?s+"":s,r);import{R as re,a as h,j as e,b as Ve}from"./vendor-react-BVoutfaX.js";import{H as J,P as G,B as Fe,M as Ue,u as qe,a as Je,R as Ge,b as Ye,C as Xe,c as Ke,d as Ze}from"./vendor-reactflow-mU21rT8r.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))o(n);new MutationObserver(n=>{for(const i of n)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&o(a)}).observe(document,{childList:!0,subtree:!0});function r(n){const i={};return n.integrity&&(i.integrity=n.integrity),n.referrerPolicy&&(i.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?i.credentials="include":n.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(n){if(n.ep)return;n.ep=!0;const i=r(n);fetch(n.href,i)}})();const de=t=>{let s;const r=new Set,o=(u,l)=>{const p=typeof u=="function"?u(s):u;if(!Object.is(p,s)){const v=s;s=l??(typeof p!="object"||p===null)?p:Object.assign({},s,p),r.forEach(k=>k(s,v))}},n=()=>s,c={setState:o,getState:n,getInitialState:()=>m,subscribe:u=>(r.add(u),()=>r.delete(u))},m=s=t(o,n,c);return c},Qe=(t=>t?de(t):de),et=t=>t;function tt(t,s=et){const r=re.useSyncExternalStore(t.subscribe,re.useCallback(()=>s(t.getState()),[t,s]),re.useCallback(()=>s(t.getInitialState()),[t,s]));return re.useDebugValue(r),r}const ue=t=>{const s=Qe(t),r=o=>tt(s,o);return Object.assign(r,s),r},$e=(t=>t?ue(t):ue),I=$e(t=>({runs:{},selectedRunId:null,traces:{},logs:{},chatMessages:{},entrypoints:[],setRuns:s=>t(r=>{var i;let o=r.breakpoints;for(const a of s)(i=a.breakpoints)!=null&&i.length&&!o[a.id]&&(o={...o,[a.id]:Object.fromEntries(a.breakpoints.map(c=>[c,!0]))});const n={runs:Object.fromEntries(s.map(a=>[a.id,a]))};return o!==r.breakpoints&&(n.breakpoints=o),n}),upsertRun:s=>t(r=>{var n;const o={runs:{...r.runs,[s.id]:s}};if((n=s.breakpoints)!=null&&n.length&&!r.breakpoints[s.id]&&(o.breakpoints={...r.breakpoints,[s.id]:Object.fromEntries(s.breakpoints.map(i=>[i,!0]))}),(s.status==="completed"||s.status==="failed")&&r.activeNodes[s.id]){const{[s.id]:i,...a}=r.activeNodes;o.activeNodes=a}if(s.status!=="suspended"&&r.activeInterrupt[s.id]){const{[s.id]:i,...a}=r.activeInterrupt;o.activeInterrupt=a}return o}),selectRun:s=>t({selectedRunId:s}),addTrace:s=>t(r=>{const o=r.traces[s.run_id]??[],n=o.findIndex(a=>a.span_id===s.span_id),i=n>=0?o.map((a,c)=>c===n?s:a):[...o,s];return{traces:{...r.traces,[s.run_id]:i}}}),setTraces:(s,r)=>t(o=>({traces:{...o.traces,[s]:r}})),addLog:s=>t(r=>{const o=r.logs[s.run_id]??[];return{logs:{...r.logs,[s.run_id]:[...o,s]}}}),setLogs:(s,r)=>t(o=>({logs:{...o.logs,[s]:r}})),addChatEvent:(s,r)=>t(o=>{const n=o.chatMessages[s]??[],i=r.message;if(!i)return o;const a=i.messageId??i.message_id,c=i.role??"assistant",l=(i.contentParts??i.content_parts??[]).filter(N=>{const j=N.mimeType??N.mime_type??"";return j.startsWith("text/")||j==="application/json"}).map(N=>{const j=N.data;return(j==null?void 0:j.inline)??""}).join(` -`).trim(),p=(i.toolCalls??i.tool_calls??[]).map(N=>({name:N.name??"",has_result:!!N.result})),v={message_id:a,role:c,content:l,tool_calls:p.length>0?p:void 0},k=n.findIndex(N=>N.message_id===a);if(k>=0)return{chatMessages:{...o.chatMessages,[s]:n.map((N,j)=>j===k?v:N)}};if(c==="user"){const N=n.findIndex(j=>j.message_id.startsWith("local-")&&j.role==="user"&&j.content===l);if(N>=0)return{chatMessages:{...o.chatMessages,[s]:n.map((j,w)=>w===N?v:j)}}}const R=[...n,v];return{chatMessages:{...o.chatMessages,[s]:R}}}),addLocalChatMessage:(s,r)=>t(o=>{const n=o.chatMessages[s]??[];return{chatMessages:{...o.chatMessages,[s]:[...n,r]}}}),setChatMessages:(s,r)=>t(o=>({chatMessages:{...o.chatMessages,[s]:r}})),setEntrypoints:s=>t({entrypoints:s}),breakpoints:{},toggleBreakpoint:(s,r)=>t(o=>{const n={...o.breakpoints[s]??{}};return n[r]?delete n[r]:n[r]=!0,{breakpoints:{...o.breakpoints,[s]:n}}}),clearBreakpoints:s=>t(r=>{const{[s]:o,...n}=r.breakpoints;return{breakpoints:n}}),activeNodes:{},setActiveNode:(s,r,o)=>t(n=>{const i=n.activeNodes[s];return{activeNodes:{...n.activeNodes,[s]:{prev:(i==null?void 0:i.current)??null,current:r,qualifiedNodeName:o}}}}),stateEvents:{},addStateEvent:(s,r,o,n,i)=>t(a=>{const c=a.stateEvents[s]??[];return{stateEvents:{...a.stateEvents,[s]:[...c,{node_name:r,qualified_node_name:n,phase:i,timestamp:Date.now(),payload:o}]}}}),setStateEvents:(s,r)=>t(o=>({stateEvents:{...o.stateEvents,[s]:r}})),focusedSpan:null,setFocusedSpan:s=>t({focusedSpan:s}),activeInterrupt:{},setActiveInterrupt:(s,r)=>t(o=>({activeInterrupt:{...o.activeInterrupt,[s]:r}})),reloadPending:!1,setReloadPending:s=>t({reloadPending:s}),graphCache:{},setGraphCache:(s,r)=>t(o=>({graphCache:{...o.graphCache,[s]:r}}))}));class st{constructor(s){K(this,"ws",null);K(this,"url");K(this,"handlers",new Set);K(this,"reconnectTimer",null);K(this,"shouldReconnect",!0);K(this,"pendingMessages",[]);K(this,"activeSubscriptions",new Set);const r=window.location.protocol==="https:"?"wss:":"ws:";this.url=s??`${r}//${window.location.host}/ws`}connect(){var s;((s=this.ws)==null?void 0:s.readyState)!==WebSocket.OPEN&&(this.ws=new WebSocket(this.url),this.ws.onopen=()=>{console.log("[ws] connected");for(const r of this.activeSubscriptions)this.sendRaw(JSON.stringify({type:"subscribe",payload:{run_id:r}}));for(const r of this.pendingMessages)this.sendRaw(r);this.pendingMessages=[]},this.ws.onmessage=r=>{let o;try{o=JSON.parse(r.data)}catch{console.warn("[ws] failed to parse message",r.data);return}this.handlers.forEach(n=>{try{n(o)}catch(i){console.error("[ws] handler error",i)}})},this.ws.onclose=()=>{console.log("[ws] disconnected"),this.shouldReconnect&&(this.reconnectTimer=setTimeout(()=>this.connect(),2e3))},this.ws.onerror=()=>{var r;(r=this.ws)==null||r.close()})}disconnect(){var s;this.shouldReconnect=!1,this.reconnectTimer&&clearTimeout(this.reconnectTimer),(s=this.ws)==null||s.close(),this.ws=null}onMessage(s){return this.handlers.add(s),()=>this.handlers.delete(s)}sendRaw(s){var r;((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN&&this.ws.send(s)}send(s,r){var n;const o=JSON.stringify({type:s,payload:r});((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN?this.ws.send(o):this.pendingMessages.push(o)}subscribe(s){this.activeSubscriptions.add(s),this.send("subscribe",{run_id:s})}unsubscribe(s){this.activeSubscriptions.delete(s),this.send("unsubscribe",{run_id:s})}sendChatMessage(s,r){this.send("chat.message",{run_id:s,text:r})}sendInterruptResponse(s,r){this.send("chat.interrupt_response",{run_id:s,data:r})}debugStep(s){this.send("debug.step",{run_id:s})}debugContinue(s){this.send("debug.continue",{run_id:s})}debugStop(s){this.send("debug.stop",{run_id:s})}setBreakpoints(s,r){this.send("debug.set_breakpoints",{run_id:s,breakpoints:r})}}let oe=null;function rt(){return oe||(oe=new st,oe.connect()),oe}function ot(){const t=h.useRef(rt()),{upsertRun:s,addTrace:r,addLog:o,addChatEvent:n,setActiveInterrupt:i,setActiveNode:a,addStateEvent:c,setReloadPending:m}=I();return h.useEffect(()=>t.current.onMessage(p=>{switch(p.type){case"run.updated":s(p.payload);break;case"trace":r(p.payload);break;case"log":o(p.payload);break;case"chat":{const v=p.payload.run_id;n(v,p.payload);break}case"chat.interrupt":{const v=p.payload.run_id;i(v,p.payload);break}case"state":{const v=p.payload.run_id,k=p.payload.node_name,R=p.payload.qualified_node_name??null,N=p.payload.phase??null,j=p.payload.payload;N==="started"&&a(v,k,R),c(v,k,j,R,N);break}case"reload":m(!0);break}}),[s,r,o,n,i,a,c,m]),t.current}const Z="/api";async function Q(t,s){const r=await fetch(t,s);if(!r.ok){let o;try{o=(await r.json()).detail||r.statusText}catch{o=r.statusText}const n=new Error(`HTTP ${r.status}`);throw n.detail=o,n.status=r.status,n}return r.json()}async function Ie(){return Q(`${Z}/entrypoints`)}async function nt(t){return Q(`${Z}/entrypoints/${encodeURIComponent(t)}/schema`)}async function at(t){return Q(`${Z}/entrypoints/${encodeURIComponent(t)}/mock-input`)}async function it(t){return Q(`${Z}/entrypoints/${encodeURIComponent(t)}/graph`)}async function pe(t,s,r="run",o=[]){return Q(`${Z}/runs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entrypoint:t,input_data:s,mode:r,breakpoints:o})})}async function ct(){return Q(`${Z}/runs`)}async function ae(t){return Q(`${Z}/runs/${t}`)}async function lt(){return Q(`${Z}/reload`,{method:"POST"})}function dt(t){const s=t.replace(/^#\/?/,"");if(!s||s==="new")return{view:"new",runId:null,tab:"traces",setupEntrypoint:null,setupMode:null};const r=s.match(/^setup\/([^/]+)\/(run|chat)$/);if(r)return{view:"setup",runId:null,tab:"traces",setupEntrypoint:decodeURIComponent(r[1]),setupMode:r[2]};const o=s.match(/^runs\/([^/]+)(?:\/(traces|output))?$/);return o?{view:"details",runId:o[1],tab:o[2]??"traces",setupEntrypoint:null,setupMode:null}:{view:"new",runId:null,tab:"traces",setupEntrypoint:null,setupMode:null}}function ut(){return window.location.hash}function pt(t){return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)}function Pe(){const t=h.useSyncExternalStore(pt,ut),s=dt(t),r=h.useCallback(o=>{window.location.hash=o},[]);return{...s,navigate:r}}const he="(max-width: 767px)";function ht(){const[t,s]=h.useState(()=>window.matchMedia(he).matches);return h.useEffect(()=>{const r=window.matchMedia(he),o=n=>s(n.matches);return r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[]),t}function We(){const t=localStorage.getItem("uipath-dev-theme");return t==="light"||t==="dark"?t:"dark"}function Oe(t){document.documentElement.setAttribute("data-theme",t),localStorage.setItem("uipath-dev-theme",t)}Oe(We());const xt=$e(t=>({theme:We(),toggleTheme:()=>t(s=>{const r=s.theme==="dark"?"light":"dark";return Oe(r),{theme:r}})})),mt={pending:"var(--text-muted)",running:"var(--warning)",suspended:"var(--info)",completed:"var(--success)",failed:"var(--error)"};function xe({run:t,isSelected:s,onClick:r}){var a;const o=mt[t.status]??"var(--text-muted)",n=((a=t.entrypoint.split("/").pop())==null?void 0:a.slice(0,16))??t.entrypoint,i=t.start_time?new Date(t.start_time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"";return e.jsxs("button",{onClick:r,className:"w-full text-left px-3 py-1.5 flex items-center gap-2 transition-colors cursor-pointer",style:{background:s?"color-mix(in srgb, var(--accent) 8%, var(--bg-primary))":void 0,borderLeft:s?"2px solid var(--accent)":"2px solid transparent"},onMouseEnter:c=>{s||(c.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:c=>{s||(c.currentTarget.style.background="")},children:[e.jsx("span",{className:"shrink-0 w-1.5 h-1.5 rounded-full",style:{background:o}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xs truncate",style:{color:s?"var(--text-primary)":"var(--text-secondary)"},children:n}),e.jsxs("div",{className:"text-[10px] tabular-nums",style:{color:"var(--text-muted)"},children:[i,t.duration?` · ${t.duration}`:""]})]})]})}function gt({runs:t,selectedRunId:s,onSelectRun:r,onNewRun:o,isMobile:n,isOpen:i,onClose:a}){const{theme:c,toggleTheme:m}=xt(),u=[...t].sort((l,p)=>new Date(p.start_time??0).getTime()-new Date(l.start_time??0).getTime());return n?i?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-50",style:{background:"rgba(0,0,0,0.5)"},onClick:a}),e.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:[e.jsxs("div",{className:"px-3 h-10 border-b border-[var(--border)] flex items-center justify-between",children:[e.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 cursor-pointer transition-opacity hover:opacity-80",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("rect",{width:"24",height:"24",rx:"4",fill:"var(--accent)"}),e.jsx("text",{x:"12",y:"17",textAnchor:"middle",fill:"white",fontSize:"14",fontWeight:"700",fontFamily:"Arial, sans-serif",children:"U"})]}),e.jsx("span",{className:"text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"Dev Console"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:m,className:"w-6 h-6 flex items-center justify-center rounded cursor-pointer transition-colors",style:{color:"var(--text-muted)"},title:`Switch to ${c==="dark"?"light":"dark"} theme`,children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:c==="dark"?e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"5"}),e.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),e.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),e.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),e.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),e.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),e.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),e.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),e.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]}):e.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})}),e.jsx("button",{onClick:a,className:"w-6 h-6 flex items-center justify-center rounded cursor-pointer transition-colors",style:{color:"var(--text-muted)"},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsx("button",{onClick:o,className:"mx-3 mt-2.5 mb-1 px-2 py-1.5 text-[10px] uppercase tracking-wider font-semibold rounded border border-[var(--border)] bg-transparent transition-colors cursor-pointer",style:{color:"var(--text-muted)"},children:"+ New Run"}),e.jsx("div",{className:"px-3 pt-3 pb-1 text-[10px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"History"}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[u.map(l=>e.jsx(xe,{run:l,isSelected:l.id===s,onClick:()=>r(l.id)},l.id)),u.length===0&&e.jsx("p",{className:"text-xs px-3 py-4 text-center",style:{color:"var(--text-muted)"},children:"No runs yet"})]})]})]}):null:e.jsxs("aside",{className:"w-44 bg-[var(--sidebar-bg)] border-r border-[var(--border)] flex flex-col",children:[e.jsxs("div",{className:"px-3 h-10 border-b border-[var(--border)] flex items-center justify-between",children:[e.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 cursor-pointer transition-opacity hover:opacity-80",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("rect",{width:"24",height:"24",rx:"4",fill:"var(--accent)"}),e.jsx("text",{x:"12",y:"17",textAnchor:"middle",fill:"white",fontSize:"14",fontWeight:"700",fontFamily:"Arial, sans-serif",children:"U"})]}),e.jsx("span",{className:"text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"Dev Console"})]}),e.jsx("button",{onClick:m,className:"w-6 h-6 flex items-center justify-center rounded cursor-pointer transition-colors",style:{color:"var(--text-muted)"},onMouseEnter:l=>{l.currentTarget.style.color="var(--text-primary)"},onMouseLeave:l=>{l.currentTarget.style.color="var(--text-muted)"},title:`Switch to ${c==="dark"?"light":"dark"} theme`,children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:c==="dark"?e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"5"}),e.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),e.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),e.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),e.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),e.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),e.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),e.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),e.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]}):e.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})})]}),e.jsx("button",{onClick:o,className:"mx-3 mt-2.5 mb-1 px-2 py-1 text-[10px] uppercase tracking-wider font-semibold rounded border border-[var(--border)] bg-transparent transition-colors cursor-pointer",style:{color:"var(--text-muted)"},onMouseEnter:l=>{l.currentTarget.style.color="var(--text-primary)",l.currentTarget.style.borderColor="var(--text-muted)"},onMouseLeave:l=>{l.currentTarget.style.color="var(--text-muted)",l.currentTarget.style.borderColor="var(--border)"},children:"+ New Run"}),e.jsx("div",{className:"px-3 pt-3 pb-1 text-[10px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"History"}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[u.map(l=>e.jsx(xe,{run:l,isSelected:l.id===s,onClick:()=>r(l.id)},l.id)),u.length===0&&e.jsx("p",{className:"text-xs px-3 py-4 text-center",style:{color:"var(--text-muted)"},children:"No runs yet"})]})]})}function ft(){const{navigate:t}=Pe(),s=I(u=>u.entrypoints),[r,o]=h.useState(""),[n,i]=h.useState(!0),[a,c]=h.useState(null);h.useEffect(()=>{!r&&s.length>0&&o(s[0])},[s,r]),h.useEffect(()=>{r&&(i(!0),c(null),nt(r).then(u=>{var p;const l=(p=u.input)==null?void 0:p.properties;i(!!(l!=null&&l.messages))}).catch(u=>{const l=u.detail||{};c(l.error||l.message||`Failed to load entrypoint "${r}"`)}))},[r]);const m=u=>{r&&t(`#/setup/${encodeURIComponent(r)}/${u}`)};return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"w-full max-w-xl px-6",children:[e.jsxs("div",{className:"mb-8 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:a?"var(--error)":"var(--accent)"}}),e.jsx("span",{className:"text-xs uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"New Run"})]}),!a&&e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:s.length>1?"Select an entrypoint and choose a mode":"Choose a mode"})]}),s.length>1&&e.jsxs("div",{className:"mb-8",children:[e.jsx("label",{className:"block text-[10px] uppercase tracking-wider font-semibold mb-2",style:{color:"var(--text-muted)"},children:"Entrypoint"}),e.jsx("select",{value:r,onChange:u=>o(u.target.value),className:"w-full rounded-md px-3 py-1.5 text-xs font-mono cursor-pointer appearance-auto",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)",color:"var(--text-primary)"},children:s.map(u=>e.jsx("option",{value:u,children:u},u))})]}),a?e.jsxs("div",{className:"rounded-md border overflow-hidden",style:{borderColor:"color-mix(in srgb, var(--error) 25%, var(--border))",background:"var(--bg-secondary)"},children:[e.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:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:e.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)"})}),e.jsx("span",{className:"text-[11px] font-medium",style:{color:"var(--error)"},children:"Failed to load entrypoint"})]}),e.jsx("div",{className:"overflow-auto max-h-48 p-3",children:e.jsx("pre",{className:"text-[11px] font-mono whitespace-pre-wrap break-words leading-relaxed m-0",style:{color:"var(--text-muted)"},children:a})})]}):e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(me,{title:"Autonomous",description:"Run the agent end-to-end. Set breakpoints to pause and inspect execution.",icon:e.jsx(vt,{}),color:"var(--success)",onClick:()=>m("run"),disabled:!r}),e.jsx(me,{title:"Conversational",description:n?"Interactive chat session. Send messages and receive responses in real time.":'Requires a "messages" property in the input schema.',icon:e.jsx(yt,{}),color:"var(--accent)",onClick:()=>m("chat"),disabled:!r||!n})]})]})})}function me({title:t,description:s,icon:r,color:o,onClick:n,disabled:i}){return e.jsxs("button",{onClick:n,disabled:i,className:"group flex flex-col items-center text-center p-6 rounded-lg border transition-all cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed",style:{background:"var(--bg-secondary)",borderColor:"var(--border)"},onMouseEnter:a=>{i||(a.currentTarget.style.borderColor=o,a.currentTarget.style.background=`color-mix(in srgb, ${o} 5%, var(--bg-secondary))`)},onMouseLeave:a=>{a.currentTarget.style.borderColor="var(--border)",a.currentTarget.style.background="var(--bg-secondary)"},children:[e.jsx("div",{className:"mb-4 p-3 rounded-xl transition-colors",style:{background:`color-mix(in srgb, ${o} 10%, var(--bg-primary))`,color:o},children:r}),e.jsx("h3",{className:"text-sm font-semibold mb-1.5",style:{color:"var(--text-primary)"},children:t}),e.jsx("p",{className:"text-xs leading-relaxed",style:{color:"var(--text-muted)"},children:s})]})}function vt(){return e.jsx("svg",{width:"28",height:"28",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.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 yt(){return e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.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"}),e.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"}),e.jsx("ellipse",{cx:"12.9987",cy:"4.33268",rx:"2.16667",ry:"2.16667",fill:"currentColor"}),e.jsx("rect",{x:"11.918",y:"5.41602",width:"2.16667",height:"2.16667",fill:"currentColor"}),e.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"}),e.jsx("rect",{x:"3.25",y:"15.166",width:"2.16667",height:"1.08333",fill:"currentColor"}),e.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"}),e.jsx("rect",{x:"20.582",y:"15.166",width:"2.16667",height:"1.08333",fill:"currentColor"})]})}const bt="modulepreload",jt=function(t){return"/"+t},ge={},He=function(s,r,o){let n=Promise.resolve();if(r&&r.length>0){let a=function(u){return Promise.all(u.map(l=>Promise.resolve(l).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),m=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));n=a(r.map(u=>{if(u=jt(u),u in ge)return;ge[u]=!0;const l=u.endsWith(".css"),p=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${p}`))return;const v=document.createElement("link");if(v.rel=l?"stylesheet":bt,l||(v.as="script"),v.crossOrigin="",v.href=u,m&&v.setAttribute("nonce",m),document.head.appendChild(v),l)return new Promise((k,R)=>{v.addEventListener("load",k),v.addEventListener("error",()=>R(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(a){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=a,window.dispatchEvent(c),!c.defaultPrevented)throw a}return n.then(a=>{for(const c of a||[])c.status==="rejected"&&i(c.reason);return s().catch(i)})},wt={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function kt({data:t}){const s=t.status,r=t.nodeWidth,o=t.label??"Start",n=t.hasBreakpoint,i=t.isPausedHere,a=t.isActiveNode,c=t.isExecutingNode,m=i?"var(--error)":c?"var(--success)":a?"var(--accent)":s==="completed"?"var(--success)":s==="running"?"var(--warning)":"var(--node-border)",u=i?"var(--error)":c?"var(--success)":"var(--accent)";return e.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:r,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${m}`,boxShadow:i||a||c?`0 0 4px ${u}`:void 0,animation:i||a||c?`node-pulse-${i?"red":c?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:o,children:[n&&e.jsx("div",{className:"absolute",style:{top:2,left:2,width:12,height:12,borderRadius:"50%",background:"var(--error)",border:"2px solid var(--node-bg)",boxShadow:"0 0 4px var(--error)"}}),o,e.jsx(J,{type:"source",position:G.Bottom,style:wt})]})}const Nt={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function St({data:t}){const s=t.status,r=t.nodeWidth,o=t.label??"End",n=t.hasBreakpoint,i=t.isPausedHere,a=t.isActiveNode,c=t.isExecutingNode,m=i?"var(--error)":c?"var(--success)":a?"var(--accent)":s==="completed"?"var(--success)":s==="failed"?"var(--error)":"var(--node-border)",u=i?"var(--error)":c?"var(--success)":"var(--accent)";return e.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:r,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${m}`,boxShadow:i||a||c?`0 0 4px ${u}`:void 0,animation:i||a||c?`node-pulse-${i?"red":c?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:o,children:[n&&e.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)"}}),e.jsx(J,{type:"target",position:G.Top,style:Nt}),o]})}const fe={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Et({data:t}){const s=t.status,r=t.nodeWidth,o=t.model_name,n=t.label??"Model",i=t.hasBreakpoint,a=t.isPausedHere,c=t.isActiveNode,m=t.isExecutingNode,u=a?"var(--error)":m?"var(--success)":c?"var(--accent)":s==="completed"?"var(--success)":s==="running"?"var(--warning)":s==="failed"?"var(--error)":"var(--node-border)",l=a?"var(--error)":m?"var(--success)":"var(--accent)";return e.jsxs("div",{className:"px-3 py-1.5 rounded-lg text-center text-xs overflow-hidden cursor-pointer relative",style:{width:r,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${u}`,boxShadow:a||c||m?`0 0 4px ${l}`:void 0,animation:a||c||m?`node-pulse-${a?"red":m?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:o?`${n} -${o}`:n,children:[i&&e.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)"}}),e.jsx(J,{type:"target",position:G.Top,style:fe}),e.jsx("div",{style:{color:"var(--info)",fontSize:9,marginBottom:1},children:"model"}),e.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:n}),o&&e.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",style:{color:"var(--text-muted)",fontSize:9,marginTop:1},title:o,children:o}),e.jsx(J,{type:"source",position:G.Bottom,style:fe})]})}const ve={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0},Ct=3;function _t({data:t}){const s=t.status,r=t.nodeWidth,o=t.tool_names,n=t.tool_count,i=t.label??"Tool",a=t.hasBreakpoint,c=t.isPausedHere,m=t.isActiveNode,u=t.isExecutingNode,l=c?"var(--error)":u?"var(--success)":m?"var(--accent)":s==="completed"?"var(--success)":s==="running"?"var(--warning)":s==="failed"?"var(--error)":"var(--node-border)",p=c?"var(--error)":u?"var(--success)":"var(--accent)",v=(o==null?void 0:o.slice(0,Ct))??[],k=(n??(o==null?void 0:o.length)??0)-v.length;return e.jsxs("div",{className:"px-3 py-1.5 rounded-lg text-center text-xs overflow-hidden cursor-pointer relative",style:{width:r,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${l}`,boxShadow:c||m||u?`0 0 4px ${p}`:void 0,animation:c||m||u?`node-pulse-${c?"red":u?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:o!=null&&o.length?`${i} - -${o.join(` -`)}`:i,children:[a&&e.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)"}}),e.jsx(J,{type:"target",position:G.Top,style:ve}),e.jsxs("div",{style:{color:"var(--warning)",fontSize:9,marginBottom:1},children:["tools",n?` (${n})`:""]}),e.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:i}),v.length>0&&e.jsxs("div",{style:{marginTop:3,fontSize:9,color:"var(--text-muted)",textAlign:"left"},children:[v.map(R=>e.jsx("div",{className:"truncate",children:R},R)),k>0&&e.jsxs("div",{style:{fontStyle:"italic"},children:["+",k," more"]})]}),e.jsx(J,{type:"source",position:G.Bottom,style:ve})]})}const ye={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Lt({data:t}){const s=t.label??"",r=t.status,o=t.hasBreakpoint,n=t.isPausedHere,i=t.isActiveNode,a=t.isExecutingNode,c=n?"var(--error)":a?"var(--success)":i?"var(--accent)":r==="completed"?"var(--success)":r==="running"?"var(--warning)":r==="failed"?"var(--error)":"var(--bg-tertiary)",m=n?"var(--error)":a?"var(--success)":"var(--accent)";return e.jsxs("div",{className:"relative cursor-pointer",style:{width:"100%",height:"100%",background:"var(--bg-secondary)",border:`1.5px ${n||i||a?"solid":"dashed"} ${c}`,borderRadius:8,boxShadow:n||i||a?`0 0 4px ${m}`:void 0,animation:n||i||a?`node-pulse-${n?"red":a?"green":"accent"} 1.5s ease-in-out infinite`:void 0},children:[o&&e.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}}),e.jsx(J,{type:"target",position:G.Top,style:ye}),e.jsx("div",{style:{padding:"4px 10px",fontSize:10,color:"var(--text-muted)",fontWeight:600,textAlign:"center",borderBottom:`1px solid ${c}`,background:"var(--bg-tertiary)",borderRadius:"8px 8px 0 0"},children:s}),e.jsx(J,{type:"source",position:G.Bottom,style:ye})]})}function Tt({data:t}){const s=t.status,r=t.nodeWidth,o=t.label??"",n=t.hasBreakpoint,i=t.isPausedHere,a=t.isActiveNode,c=t.isExecutingNode,m=i?"var(--error)":c?"var(--success)":a?"var(--accent)":s==="completed"?"var(--success)":s==="running"?"var(--warning)":s==="failed"?"var(--error)":"var(--node-border)",u=i?"var(--error)":c?"var(--success)":"var(--accent)";return e.jsxs("div",{className:"px-3 py-1.5 rounded-lg text-center text-xs overflow-hidden cursor-pointer relative",style:{width:r,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${m}`,boxShadow:i||a||c?`0 0 4px ${u}`:void 0,animation:i||a||c?`node-pulse-${i?"red":c?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:o,children:[n&&e.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)"}}),e.jsx(J,{type:"target",position:G.Top}),e.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:o}),e.jsx(J,{type:"source",position:G.Bottom})]})}function Mt(t,s=8){if(t.length<2)return"";if(t.length===2)return`M ${t[0].x} ${t[0].y} L ${t[1].x} ${t[1].y}`;let r=`M ${t[0].x} ${t[0].y}`;for(let n=1;n0&&(r+=Math.min(o.length,3)*12+(o.length>3?12:0)+4),t!=null&&t.model_name&&(r+=14),r}let ie=null;async function Ht(){if(!ie){const{default:t}=await He(async()=>{const{default:s}=await import("./vendor-elk-CTNP4r_q.js").then(r=>r.e);return{default:s}},__vite__mapDeps([0,1]));ie=new t}return ie}const we={"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"},Bt="[top=35,left=15,bottom=15,right=15]";function At(t){const s=[],r=[];for(const o of t.nodes){const n=o.data,i={id:o.id,width:be(n),height:je(n,o.type)};if(o.data.subgraph){const a=o.data.subgraph;delete i.width,delete i.height,i.layoutOptions={...we,"elk.padding":Bt},i.children=a.nodes.map(c=>({id:`${o.id}/${c.id}`,width:be(c.data),height:je(c.data,c.type)})),i.edges=a.edges.map(c=>({id:`${o.id}/${c.id}`,sources:[`${o.id}/${c.source}`],targets:[`${o.id}/${c.target}`]}))}s.push(i)}for(const o of t.edges)r.push({id:o.id,sources:[o.source],targets:[o.target]});return{id:"root",layoutOptions:we,children:s,edges:r}}const le={type:Ue.ArrowClosed,width:12,height:12,color:"var(--node-border)"};function Be(t){return{stroke:"var(--node-border)",strokeWidth:1.5,...t?{strokeDasharray:"6 3"}:{}}}function ke(t,s,r,o,n){var u;const i=(u=t.sections)==null?void 0:u[0],a=(n==null?void 0:n.x)??0,c=(n==null?void 0:n.y)??0;let m;if(i)m={sourcePoint:{x:i.startPoint.x+a,y:i.startPoint.y+c},targetPoint:{x:i.endPoint.x+a,y:i.endPoint.y+c},bendPoints:(i.bendPoints??[]).map(l=>({x:l.x+a,y:l.y+c}))};else{const l=s.get(t.sources[0]),p=s.get(t.targets[0]);l&&p&&(m={sourcePoint:{x:l.x+l.width/2,y:l.y+l.height},targetPoint:{x:p.x+p.width/2,y:p.y},bendPoints:[]})}return{id:t.id,source:t.sources[0],target:t.targets[0],type:"elk",data:m,style:Be(o),markerEnd:le,...r?{label:r,labelStyle:{fill:"var(--text-muted)",fontSize:10},labelBgStyle:{fill:"var(--bg-primary)",fillOpacity:.8}}:{}}}async function Dt(t){var m,u;const s=At(t),o=await(await Ht()).layout(s),n=new Map;for(const l of t.nodes)if(n.set(l.id,{type:l.type,data:l.data}),l.data.subgraph)for(const p of l.data.subgraph.nodes)n.set(`${l.id}/${p.id}`,{type:p.type,data:p.data});const i=[],a=[],c=new Map;for(const l of o.children??[]){const p=l.x??0,v=l.y??0;c.set(l.id,{x:p,y:v,width:l.width??0,height:l.height??0});for(const k of l.children??[])c.set(k.id,{x:p+(k.x??0),y:v+(k.y??0),width:k.width??0,height:k.height??0})}for(const l of o.children??[]){const p=n.get(l.id);if((((m=l.children)==null?void 0:m.length)??0)>0){i.push({id:l.id,type:"groupNode",data:{...(p==null?void 0:p.data)??{},nodeWidth:l.width,nodeHeight:l.height},position:{x:l.x??0,y:l.y??0},style:{width:l.width,height:l.height}});for(const N of l.children??[]){const j=n.get(N.id);i.push({id:N.id,type:(j==null?void 0:j.type)??"defaultNode",data:{...(j==null?void 0:j.data)??{},nodeWidth:N.width},position:{x:N.x??0,y:N.y??0},parentNode:l.id,extent:"parent"})}const k=l.x??0,R=l.y??0;for(const N of l.edges??[]){const j=t.nodes.find(C=>C.id===l.id),w=(u=j==null?void 0:j.data.subgraph)==null?void 0:u.edges.find(C=>`${l.id}/${C.id}`===N.id);a.push(ke(N,c,w==null?void 0:w.label,w==null?void 0:w.conditional,{x:k,y:R}))}}else i.push({id:l.id,type:(p==null?void 0:p.type)??"defaultNode",data:{...(p==null?void 0:p.data)??{},nodeWidth:l.width},position:{x:l.x??0,y:l.y??0}})}for(const l of o.edges??[]){const p=t.edges.find(v=>v.id===l.id);a.push(ke(l,c,p==null?void 0:p.label,p==null?void 0:p.conditional))}return{nodes:i,edges:a}}function ne({entrypoint:t,runId:s,breakpointNode:r,breakpointNextNodes:o,onBreakpointChange:n,fitViewTrigger:i}){const[a,c,m]=qe([]),[u,l,p]=Je([]),[v,k]=h.useState(!0),[R,N]=h.useState(!1),[j,w]=h.useState(0),C=h.useRef(0),B=h.useRef(null),H=I(d=>d.breakpoints[s]),L=I(d=>d.toggleBreakpoint),z=I(d=>d.clearBreakpoints),V=I(d=>d.activeNodes[s]),U=I(d=>{var x;return(x=d.runs[s])==null?void 0:x.status}),X=h.useCallback((d,x)=>{if(x.type==="startNode"||x.type==="endNode")return;const b=x.type==="groupNode"?x.id:x.id.includes("/")?x.id.split("/").pop():x.id;L(s,b);const S=I.getState().breakpoints[s]??{};n==null||n(Object.keys(S))},[s,L,n]),D=H&&Object.keys(H).length>0,P=h.useCallback(()=>{if(D)z(s),n==null||n([]);else{const d=[];for(const b of a){if(b.type==="startNode"||b.type==="endNode"||b.parentNode)continue;const S=b.type==="groupNode"?b.id:b.id.includes("/")?b.id.split("/").pop():b.id;d.push(S)}for(const b of d)H!=null&&H[b]||L(s,b);const x=I.getState().breakpoints[s]??{};n==null||n(Object.keys(x))}},[s,D,H,a,z,L,n]);h.useEffect(()=>{c(d=>d.map(x=>{var g;if(x.type==="startNode"||x.type==="endNode")return x;const b=x.type==="groupNode"?x.id:x.id.includes("/")?x.id.split("/").pop():x.id,S=!!(H&&H[b]);return S!==!!((g=x.data)!=null&&g.hasBreakpoint)?{...x,data:{...x.data,hasBreakpoint:S}}:x}))},[H,c]),h.useEffect(()=>{const d=r?new Set(r.split(",").map(x=>x.trim()).filter(Boolean)):null;c(x=>x.map(b=>{var M,f;if(b.type==="startNode"||b.type==="endNode")return b;const S=b.type==="groupNode"?b.id:b.id.includes("/")?b.id.split("/").pop():b.id,g=(M=b.data)==null?void 0:M.label,_=d!=null&&(d.has(S)||g!=null&&d.has(g));return _!==!!((f=b.data)!=null&&f.isPausedHere)?{...b,data:{...b.data,isPausedHere:_}}:b}))},[r,j,c]),h.useEffect(()=>{const d=!!r;let x=new Set;const b=new Set,S=new Set,g=new Set,_=new Map;c(M=>{var E;for(const T of M)T.type&&_.set(T.id,T.type);const f=T=>{var A;const W=[];for(const y of M){const O=y.type==="groupNode"?y.id:y.id.includes("/")?y.id.split("/").pop():y.id,F=(A=y.data)==null?void 0:A.label;(O===T||F!=null&&F===T)&&W.push(y.id)}return W};if(d&&r){const T=r.split(",").map(W=>W.trim()).filter(Boolean);for(const W of T)f(W).forEach(A=>x.add(A));if(o!=null&&o.length)for(const W of o)f(W).forEach(A=>S.add(A));V!=null&&V.prev&&f(V.prev).forEach(W=>b.add(W))}else if(V){const T=V.qualifiedNodeName;if(T){const W=T.replace(/:/g,"/");for(const A of M)A.id===W&&x.add(A.id)}if(x.size===0){const W=new Map;for(const A of M){const y=(E=A.data)==null?void 0:E.label;if(!y)continue;const O=A.id.includes("/")?A.id.split("/").pop():A.id;for(const F of[O,y]){let Y=W.get(F);Y||(Y=new Set,W.set(F,Y)),Y.add(A.id)}}x=W.get(V.current)??new Set}}return M}),l(M=>{const f=b.size===0||M.some(E=>x.has(E.target)&&b.has(E.source));return M.map(E=>{var W,A;let T;return d?T=x.has(E.target)&&(b.size===0||!f||b.has(E.source))||x.has(E.source)&&S.has(E.target):(T=x.has(E.source),!T&&_.get(E.target)==="endNode"&&x.has(E.target)&&(T=!0)),T?(d||g.add(E.target),{...E,style:{stroke:"var(--accent)",strokeWidth:2.5},markerEnd:{...le,color:"var(--accent)"},data:{...E.data,highlighted:!0},animated:!0}):(W=E.data)!=null&&W.highlighted?{...E,style:Be((A=E.data)==null?void 0:A.conditional),markerEnd:le,data:{...E.data,highlighted:!1},animated:!1}:E})}),c(M=>M.map(f=>{var W,A,y,O;const E=!d&&x.has(f.id);if(f.type==="startNode"||f.type==="endNode"){const F=g.has(f.id)||!d&&x.has(f.id);return F!==!!((W=f.data)!=null&&W.isActiveNode)||E!==!!((A=f.data)!=null&&A.isExecutingNode)?{...f,data:{...f.data,isActiveNode:F,isExecutingNode:E}}:f}const T=d?S.has(f.id):g.has(f.id);return T!==!!((y=f.data)!=null&&y.isActiveNode)||E!==!!((O=f.data)!=null&&O.isExecutingNode)?{...f,data:{...f.data,isActiveNode:T,isExecutingNode:E}}:f}))},[V,r,o,U,j,c,l]);const $=I(d=>d.stateEvents[s]),q=I(d=>d.graphCache[s]);return h.useEffect(()=>{if(!q&&s!=="__setup__")return;const d=q?Promise.resolve(q):it(t),x=++C.current;k(!0),N(!1),d.then(async b=>{if(C.current!==x)return;if(!b.nodes.length){N(!0);return}const{nodes:S,edges:g}=await Dt(b);if(C.current!==x)return;const _=I.getState().breakpoints[s],M=_?S.map(f=>{if(f.type==="startNode"||f.type==="endNode")return f;const E=f.type==="groupNode"?f.id:f.id.includes("/")?f.id.split("/").pop():f.id;return _[E]?{...f,data:{...f.data,hasBreakpoint:!0}}:f}):S;c(M),l(g),w(f=>f+1),setTimeout(()=>{var f;(f=B.current)==null||f.fitView({padding:.1,duration:200})},100)}).catch(()=>{C.current===x&&N(!0)}).finally(()=>{C.current===x&&k(!1)})},[t,s,q,c,l]),h.useEffect(()=>{const d=setTimeout(()=>{var x;(x=B.current)==null||x.fitView({padding:.1,duration:200})},100);return()=>clearTimeout(d)},[s]),h.useEffect(()=>{var d;i&&((d=B.current)==null||d.fitView({padding:.1,duration:200}))},[i]),h.useEffect(()=>{c(d=>{var T,W,A;const x=!!($!=null&&$.length),b=U==="completed"||U==="failed",S=new Set,g=new Set(d.map(y=>y.id)),_=new Map;for(const y of d){const O=(T=y.data)==null?void 0:T.label;if(!O)continue;const F=y.id.includes("/")?y.id.split("/").pop():y.id;for(const Y of[F,O]){let se=_.get(Y);se||(se=new Set,_.set(Y,se)),se.add(y.id)}}if(x)for(const y of $){let O=!1;if(y.qualified_node_name){const F=y.qualified_node_name.replace(/:/g,"/");g.has(F)&&(S.add(F),O=!0)}if(!O){const F=_.get(y.node_name);F&&F.forEach(Y=>S.add(Y))}}const M=new Set;for(const y of d)y.parentNode&&S.has(y.id)&&M.add(y.parentNode);let f;U==="failed"&&S.size===0&&(f=(W=d.find(y=>!y.parentNode&&y.type!=="startNode"&&y.type!=="endNode"&&y.type!=="groupNode"))==null?void 0:W.id);let E;if(U==="completed"){const y=(A=d.find(O=>!O.parentNode&&O.type!=="startNode"&&O.type!=="endNode"&&O.type!=="groupNode"))==null?void 0:A.id;y&&!S.has(y)&&(E=y)}return d.map(y=>{var F;let O;return y.id===f?O="failed":y.id===E||S.has(y.id)?O="completed":y.type==="startNode"?(!y.parentNode&&x||y.parentNode&&M.has(y.parentNode))&&(O="completed"):y.type==="endNode"?!y.parentNode&&b?O=U==="failed"?"failed":"completed":y.parentNode&&M.has(y.parentNode)&&(O="completed"):y.type==="groupNode"&&M.has(y.id)&&(O="completed"),O!==((F=y.data)==null?void 0:F.status)?{...y,data:{...y.data,status:O}}:y})})},[$,U,j,c]),v?e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:"Loading graph..."}):R?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",style:{color:"var(--text-muted)"},children:[e.jsxs("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("rect",{x:"38",y:"10",width:"44",height:"24",rx:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.4"}),e.jsx("line",{x1:"60",y1:"34",x2:"60",y2:"46",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),e.jsx("rect",{x:"12",y:"46",width:"44",height:"24",rx:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),e.jsx("rect",{x:"64",y:"46",width:"44",height:"24",rx:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),e.jsx("line",{x1:"60",y1:"46",x2:"34",y2:"46",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),e.jsx("line",{x1:"60",y1:"46",x2:"86",y2:"46",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),e.jsx("line",{x1:"34",y1:"70",x2:"34",y2:"82",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),e.jsx("line",{x1:"86",y1:"70",x2:"86",y2:"82",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),e.jsx("line",{x1:"34",y1:"82",x2:"60",y2:"82",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),e.jsx("line",{x1:"86",y1:"82",x2:"60",y2:"82",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),e.jsx("line",{x1:"60",y1:"82",x2:"60",y2:"86",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),e.jsx("rect",{x:"38",y:"86",width:"44",height:"24",rx:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.4"})]}),e.jsx("span",{className:"text-xs",children:"No graph schema available"})]}):e.jsxs("div",{className:"h-full graph-panel",children:[e.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); } - } - `}),e.jsxs(Ge,{nodes:a,edges:u,onNodesChange:m,onEdgesChange:p,nodeTypes:$t,edgeTypes:It,onInit:d=>{B.current=d},onNodeClick:X,fitView:!0,proOptions:{hideAttribution:!0},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,children:[e.jsx(Ye,{color:"var(--bg-tertiary)",gap:16}),e.jsx(Xe,{showInteractive:!1}),e.jsx(Ke,{position:"top-right",children:e.jsxs("button",{onClick:P,title:D?"Remove all breakpoints":"Set breakpoints on all nodes",style:{background:"var(--bg-secondary)",color:D?"var(--error)":"var(--text-muted)",border:`1px solid ${D?"var(--error)":"var(--node-border)"}`,borderRadius:6,padding:"4px 10px",fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",gap:4},children:[e.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:D?"var(--error)":"var(--node-border)"}}),D?"Clear all":"Break all"]})}),e.jsx(Ze,{nodeColor:d=>{var b;if(d.type==="groupNode")return"var(--bg-tertiary)";const x=(b=d.data)==null?void 0:b.status;return x==="completed"?"var(--success)":x==="running"?"var(--warning)":x==="failed"?"var(--error)":"var(--node-border)"},nodeStrokeWidth:0,style:{background:"var(--bg-secondary)",width:120,height:80}})]})]})}const ee="__setup__";function zt({entrypoint:t,mode:s,ws:r,onRunCreated:o,isMobile:n}){const[i,a]=h.useState("{}"),[c,m]=h.useState({}),[u,l]=h.useState(!1),[p,v]=h.useState(!0),[k,R]=h.useState(null),[N,j]=h.useState(""),[w,C]=h.useState(0),[B,H]=h.useState(!0),[L,z]=h.useState(()=>{const g=localStorage.getItem("setupTextareaHeight");return g?parseInt(g,10):140}),V=h.useRef(null),[U,X]=h.useState(()=>{const g=localStorage.getItem("setupPanelWidth");return g?parseInt(g,10):380}),D=s==="run";h.useEffect(()=>{v(!0),R(null),at(t).then(g=>{m(g.mock_input),a(JSON.stringify(g.mock_input,null,2))}).catch(g=>{console.error("Failed to load mock input:",g);const _=g.detail||{};R(_.message||`Failed to load schema for "${t}"`),a("{}")}).finally(()=>v(!1))},[t]),h.useEffect(()=>{I.getState().clearBreakpoints(ee)},[]);const P=async()=>{let g;try{g=JSON.parse(i)}catch{alert("Invalid JSON input");return}l(!0);try{const _=I.getState().breakpoints[ee]??{},M=Object.keys(_),f=await pe(t,g,s,M);I.getState().clearBreakpoints(ee),I.getState().upsertRun(f),o(f.id)}catch(_){console.error("Failed to create run:",_)}finally{l(!1)}},$=async()=>{const g=N.trim();if(g){l(!0);try{const _=I.getState().breakpoints[ee]??{},M=Object.keys(_),f=await pe(t,c,"chat",M);I.getState().clearBreakpoints(ee),I.getState().upsertRun(f),I.getState().addLocalChatMessage(f.id,{message_id:`local-${Date.now()}`,role:"user",content:g}),r.sendChatMessage(f.id,g),o(f.id)}catch(_){console.error("Failed to create chat run:",_)}finally{l(!1)}}};h.useEffect(()=>{try{JSON.parse(i),H(!0)}catch{H(!1)}},[i]);const q=h.useCallback(g=>{g.preventDefault();const _="touches"in g?g.touches[0].clientY:g.clientY,M=L,f=T=>{const W="touches"in T?T.touches[0].clientY:T.clientY,A=Math.max(60,M+(_-W));z(A)},E=()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",E),document.removeEventListener("touchmove",f),document.removeEventListener("touchend",E),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("setupTextareaHeight",String(L))};document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",f),document.addEventListener("mouseup",E),document.addEventListener("touchmove",f,{passive:!1}),document.addEventListener("touchend",E)},[L]),d=h.useCallback(g=>{g.preventDefault();const _="touches"in g?g.touches[0].clientX:g.clientX,M=U,f=T=>{const W=V.current;if(!W)return;const A="touches"in T?T.touches[0].clientX:T.clientX,y=W.clientWidth-300,O=Math.max(280,Math.min(y,M+(_-A)));X(O)},E=()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",E),document.removeEventListener("touchmove",f),document.removeEventListener("touchend",E),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("setupPanelWidth",String(U)),C(T=>T+1)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",f),document.addEventListener("mouseup",E),document.addEventListener("touchmove",f,{passive:!1}),document.addEventListener("touchend",E)},[U]),x=D?"Autonomous":"Conversational",b=D?"var(--success)":"var(--accent)",S=e.jsxs("div",{className:"shrink-0 flex flex-col",style:n?{background:"var(--bg-primary)"}:{width:U,background:"var(--bg-primary)"},children:[e.jsxs("div",{className:"px-4 text-xs font-semibold uppercase tracking-wider border-b flex items-center gap-2 h-[33px]",style:{color:"var(--text-muted)",borderColor:"var(--border)",background:"var(--bg-secondary)"},children:[e.jsx("span",{style:{color:b},children:"●"}),x]}),e.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col items-center justify-center gap-4 px-6",children:[e.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--text-muted)",opacity:.5},children:D?e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}):e.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"})}),e.jsxs("div",{className:"text-center space-y-1.5",children:[e.jsx("p",{className:"text-sm font-medium",style:{color:"var(--text-secondary)"},children:D?"Ready to execute":"Ready to chat"}),e.jsxs("p",{className:"text-xs leading-relaxed",style:{color:"var(--text-muted)"},children:["Click nodes to set breakpoints",D?e.jsxs(e.Fragment,{children:[",",e.jsx("br",{}),"configure input below, then run"]}):e.jsxs(e.Fragment,{children:[",",e.jsx("br",{}),"then send your first message"]})]})]})]}),D?e.jsxs("div",{className:"flex flex-col",style:{background:"var(--bg-primary)"},children:[!n&&e.jsx("div",{onMouseDown:q,onTouchStart:q,className:"shrink-0 h-1.5 cursor-row-resize bg-[var(--border)] hover:bg-[var(--accent)] transition-colors"}),e.jsxs("div",{className:"px-4 py-3",children:[k?e.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:k}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"block text-[10px] uppercase tracking-wider font-semibold mb-2",style:{color:"var(--text-muted)"},children:["Input",p&&e.jsx("span",{className:"ml-2 font-normal",children:"Loading..."})]}),e.jsx("textarea",{value:i,onChange:g=>a(g.target.value),spellCheck:!1,className:"w-full rounded-md px-3 py-2 text-xs font-mono leading-relaxed resize-none focus:outline-none mb-3",style:{height:n?120:L,background:"var(--bg-secondary)",border:`1px solid ${B?"var(--border)":"#b91c1c"}`,color:"var(--text-primary)"}})]}),e.jsx("button",{onClick:P,disabled:u||p||!!k,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:b,color:b},onMouseEnter:g=>{u||(g.currentTarget.style.background=`color-mix(in srgb, ${b} 10%, transparent)`)},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:u?"Starting...":e.jsxs(e.Fragment,{children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",children:e.jsx("polygon",{points:"5,3 19,12 5,21"})}),"Execute"]})})]})]}):e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-t",style:{borderColor:"var(--border)"},children:[e.jsx("input",{value:N,onChange:g=>j(g.target.value),onKeyDown:g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),$())},disabled:u||p,placeholder:u?"Starting...":"Message...",className:"flex-1 bg-transparent text-sm py-1 focus:outline-none disabled:opacity-40 placeholder:text-[var(--text-muted)]",style:{color:"var(--text-primary)"}}),e.jsx("button",{onClick:$,disabled:u||p||!N.trim(),className:"text-[11px] uppercase tracking-wider font-semibold px-2 py-1 rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed",style:{color:!u&&N.trim()?"var(--accent)":"var(--text-muted)",background:"transparent"},onMouseEnter:g=>{!u&&N.trim()&&(g.currentTarget.style.background="color-mix(in srgb, var(--accent) 10%, transparent)")},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:"Send"})]})]});return n?e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"shrink-0",style:{height:"40vh"},children:e.jsx(ne,{entrypoint:t,traces:[],runId:ee,fitViewTrigger:w})}),e.jsx("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:S})]}):e.jsxs("div",{ref:V,className:"flex h-full",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(ne,{entrypoint:t,traces:[],runId:ee,fitViewTrigger:w})}),e.jsx("div",{onMouseDown:d,onTouchStart:d,className:"shrink-0 w-1.5 cursor-col-resize bg-[var(--border)] hover:bg-[var(--accent)] transition-colors relative",children:e.jsx("div",{className:"absolute inset-0 -left-1 -right-1"})}),S]})}const Vt={key:"var(--info)",string:"var(--success)",number:"var(--warning)",boolean:"var(--accent)",null:"var(--accent)",punctuation:"var(--text-muted)"};function Ft(t){const s=[],r=/("(?:[^"\\]|\\.)*")\s*:|("(?:[^"\\]|\\.)*")|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)\b|(true|false)\b|(null)\b|([{}[\]:,])/g;let o=0,n;for(;(n=r.exec(t))!==null;){if(n.index>o&&s.push({type:"punctuation",text:t.slice(o,n.index)}),n[1]!==void 0){s.push({type:"key",text:n[1]});const i=t.indexOf(":",n.index+n[1].length);i!==-1&&(i>n.index+n[1].length&&s.push({type:"punctuation",text:t.slice(n.index+n[1].length,i)}),s.push({type:"punctuation",text:":"}),r.lastIndex=i+1)}else n[2]!==void 0?s.push({type:"string",text:n[2]}):n[3]!==void 0?s.push({type:"number",text:n[3]}):n[4]!==void 0?s.push({type:"boolean",text:n[4]}):n[5]!==void 0?s.push({type:"null",text:n[5]}):n[6]!==void 0&&s.push({type:"punctuation",text:n[6]});o=r.lastIndex}return oFt(t),[t]);return e.jsx("pre",{className:s,style:r,children:o.map((n,i)=>e.jsx("span",{style:{color:Vt[n.type]},children:n.text},i))})}const Ut={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"}},qt={color:"var(--text-muted)",label:"Unknown"};function Jt(t){if(typeof t!="string")return null;const s=t.trim();if(s.startsWith("{")&&s.endsWith("}")||s.startsWith("[")&&s.endsWith("]"))try{return JSON.stringify(JSON.parse(s),null,2)}catch{return null}return null}function Gt(t){if(t<1)return`${(t*1e3).toFixed(0)}us`;if(t<1e3)return`${t.toFixed(2)}ms`;if(t<6e4)return`${(t/1e3).toFixed(2)}s`;const s=Math.floor(t/6e4),r=(t%6e4/1e3).toFixed(1);return`${s}m ${r}s`}const Ne=200;function Yt(t){if(typeof t=="string")return t;if(t==null)return String(t);try{return JSON.stringify(t,null,2)}catch{return String(t)}}function Xt({value:t}){const[s,r]=h.useState(!1),o=Yt(t),n=h.useMemo(()=>Jt(t),[t]),i=n!==null,a=n??o,c=a.length>Ne||a.includes(` -`),m=h.useCallback(()=>r(u=>!u),[]);return c?e.jsxs("div",{children:[s?i?e.jsx(te,{json:a,className:"font-mono text-[11px] whitespace-pre-wrap break-all",style:{}}):e.jsx("pre",{className:"font-mono text-[11px] whitespace-pre-wrap break-all",style:{color:"var(--text-primary)"},children:a}):e.jsxs("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:[a.slice(0,Ne),"..."]}),e.jsx("button",{onClick:m,className:"text-[10px] cursor-pointer ml-1",style:{color:"var(--info)"},children:s?"[less]":"[more]"})]}):i?e.jsx(te,{json:a,className:"font-mono text-[11px] break-all whitespace-pre-wrap",style:{}}):e.jsx("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:a})}function Kt({span:t}){const[s,r]=h.useState(!0),[o,n]=h.useState(!1),i=Ut[t.status.toLowerCase()]??{...qt,label:t.status},a=new Date(t.timestamp).toLocaleTimeString(void 0,{hour12:!1,fractionalSecondDigits:3}),c=Object.entries(t.attributes),m=[{label:"Span",value:t.span_id},...t.trace_id?[{label:"Trace",value:t.trace_id}]:[],{label:"Run",value:t.run_id},...t.parent_span_id?[{label:"Parent",value:t.parent_span_id}]:[]];return e.jsxs("div",{className:"overflow-y-auto h-full text-xs leading-normal",children:[e.jsxs("div",{className:"px-2 py-1.5 border-b flex items-center gap-2 flex-wrap",style:{borderColor:"var(--border)",background:"var(--bg-secondary)"},children:[e.jsx("span",{className:"text-xs font-semibold mr-auto",style:{color:"var(--text-primary)"},children:t.span_name}),e.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",style:{background:`color-mix(in srgb, ${i.color} 15%, var(--bg-secondary))`,color:i.color},children:[e.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:i.color}}),i.label]}),t.duration_ms!=null&&e.jsx("span",{className:"shrink-0 font-mono text-[11px] font-semibold",style:{color:"var(--warning)"},children:Gt(t.duration_ms)}),e.jsx("span",{className:"shrink-0 font-mono text-[11px]",style:{color:"var(--text-muted)"},children:a})]}),c.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-2 py-1 text-[10px] uppercase font-bold tracking-wider border-b cursor-pointer flex items-center",style:{color:"var(--accent)",borderColor:"var(--border)",background:"var(--bg-secondary)"},onClick:()=>r(u=>!u),children:[e.jsxs("span",{className:"flex-1",children:["Attributes (",c.length,")"]}),e.jsx("span",{style:{color:"var(--text-muted)",transform:s?"rotate(0deg)":"rotate(-90deg)"},children:"▾"})]}),s&&c.map(([u,l],p)=>e.jsxs("div",{className:"flex gap-2 px-2 py-1 items-start border-b",style:{borderColor:"var(--border)",background:p%2===0?"var(--bg-primary)":"var(--bg-secondary)"},children:[e.jsx("span",{className:"font-mono font-semibold shrink-0 pt-px truncate text-[11px]",style:{color:"var(--info)",width:"35%"},title:u,children:u}),e.jsx("span",{className:"flex-1 min-w-0",children:e.jsx(Xt,{value:l})})]},u))]}),e.jsxs("div",{className:"px-2 py-1 text-[10px] uppercase font-bold tracking-wider border-b cursor-pointer flex items-center",style:{color:"var(--accent)",borderColor:"var(--border)",background:"var(--bg-secondary)"},onClick:()=>n(u=>!u),children:[e.jsxs("span",{className:"flex-1",children:["Identifiers (",m.length,")"]}),e.jsx("span",{style:{color:"var(--text-muted)",transform:o?"rotate(0deg)":"rotate(-90deg)"},children:"▾"})]}),o&&m.map((u,l)=>e.jsxs("div",{className:"flex gap-2 px-2 py-1 items-start border-b",style:{borderColor:"var(--border)",background:l%2===0?"var(--bg-primary)":"var(--bg-secondary)"},children:[e.jsx("span",{className:"font-mono font-semibold shrink-0 pt-px truncate text-[11px]",style:{color:"var(--info)",width:"35%"},title:u.label,children:u.label}),e.jsx("span",{className:"flex-1 min-w-0",children:e.jsx("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:u.value})})]},u.label))]})}const Zt={started:"var(--info)",running:"var(--warning)",completed:"var(--success)",failed:"var(--error)",error:"var(--error)"};function Qt({kind:t,statusColor:s}){const r=s,o=14,n={width:o,height:o,viewBox:"0 0 16 16",fill:"none",stroke:r,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"};switch(t){case"LLM":return e.jsx("svg",{...n,children:e.jsx("path",{d:"M8 2L9 5L12 4L10 7L14 8L10 9L12 12L9 11L8 14L7 11L4 12L6 9L2 8L6 7L4 4L7 5Z",fill:r,stroke:"none"})});case"TOOL":return e.jsx("svg",{...n,children:e.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 e.jsxs("svg",{...n,children:[e.jsx("rect",{x:"3",y:"5",width:"10",height:"8",rx:"2"}),e.jsx("circle",{cx:"6",cy:"9",r:"1",fill:r,stroke:"none"}),e.jsx("circle",{cx:"10",cy:"9",r:"1",fill:r,stroke:"none"}),e.jsx("path",{d:"M8 2v3"}),e.jsx("path",{d:"M6 2h4"})]});case"CHAIN":return e.jsxs("svg",{...n,children:[e.jsx("path",{d:"M6.5 9.5L9.5 6.5"}),e.jsx("path",{d:"M4.5 8.5l-1 1a2 2 0 0 0 2.83 2.83l1-1"}),e.jsx("path",{d:"M11.5 7.5l1-1a2 2 0 0 0-2.83-2.83l-1 1"})]});case"RETRIEVER":return e.jsxs("svg",{...n,children:[e.jsx("circle",{cx:"7",cy:"7",r:"4"}),e.jsx("path",{d:"M10 10l3.5 3.5"})]});case"EMBEDDING":return e.jsxs("svg",{...n,children:[e.jsx("rect",{x:"2",y:"2",width:"4",height:"4",rx:"0.5"}),e.jsx("rect",{x:"10",y:"2",width:"4",height:"4",rx:"0.5"}),e.jsx("rect",{x:"2",y:"10",width:"4",height:"4",rx:"0.5"}),e.jsx("rect",{x:"10",y:"10",width:"4",height:"4",rx:"0.5"})]});default:return e.jsx("span",{className:"shrink-0 w-2 h-2 rounded-full",style:{background:s}})}}function es(t){const s=new Map(t.map(a=>[a.span_id,a])),r=new Map;for(const a of t)if(a.parent_span_id){const c=r.get(a.parent_span_id)??[];c.push(a),r.set(a.parent_span_id,c)}const o=t.filter(a=>a.parent_span_id===null||!s.has(a.parent_span_id));function n(a){const c=(r.get(a.span_id)??[]).sort((m,u)=>m.timestamp.localeCompare(u.timestamp));return{span:a,children:c.map(n)}}return o.sort((a,c)=>a.timestamp.localeCompare(c.timestamp)).map(n).flatMap(a=>a.span.span_name==="root"?a.children:[a])}function ts(t){return t==null?"":t<1e3?`${t.toFixed(0)}ms`:`${(t/1e3).toFixed(2)}s`}function Se({traces:t}){const[s,r]=h.useState(null),[o,n]=h.useState(new Set),[i,a]=h.useState(()=>{const w=localStorage.getItem("traceTreeSplitWidth");return w?parseFloat(w):50}),[c,m]=h.useState(!1),u=es(t),l=I(w=>w.focusedSpan),p=I(w=>w.setFocusedSpan),[v,k]=h.useState(null),R=h.useRef(null),N=h.useCallback(w=>{n(C=>{const B=new Set(C);return B.has(w)?B.delete(w):B.add(w),B})},[]);h.useEffect(()=>{if(s===null)u.length>0&&r(u[0].span);else{const w=t.find(C=>C.span_id===s.span_id);w&&w!==s&&r(w)}},[t]),h.useEffect(()=>{if(!l)return;const C=t.filter(B=>B.span_name===l.name).sort((B,H)=>B.timestamp.localeCompare(H.timestamp))[l.index];if(C){r(C),k(C.span_id);const B=new Map(t.map(H=>[H.span_id,H.parent_span_id]));n(H=>{const L=new Set(H);let z=C.parent_span_id;for(;z;)L.delete(z),z=B.get(z)??null;return L})}p(null)},[l,t,p]),h.useEffect(()=>{if(!v)return;const w=v;k(null),requestAnimationFrame(()=>{const C=R.current,B=C==null?void 0:C.querySelector(`[data-span-id="${w}"]`);C&&B&&B.scrollIntoView({block:"center",behavior:"smooth"})})},[v]),h.useEffect(()=>{if(!c)return;const w=B=>{const H=document.querySelector(".trace-tree-container");if(!H)return;const L=H.getBoundingClientRect(),z=(B.clientX-L.left)/L.width*100,V=Math.max(20,Math.min(80,z));a(V),localStorage.setItem("traceTreeSplitWidth",String(V))},C=()=>{m(!1)};return window.addEventListener("mousemove",w),window.addEventListener("mouseup",C),()=>{window.removeEventListener("mousemove",w),window.removeEventListener("mouseup",C)}},[c]);const j=w=>{w.preventDefault(),m(!0)};return e.jsxs("div",{className:"flex h-full trace-tree-container",style:{cursor:c?"col-resize":void 0},children:[e.jsx("div",{className:"pr-0.5 pt-0.5",style:{width:`${i}%`},children:e.jsx("div",{ref:R,className:"overflow-y-auto h-full p-0.5",children:u.length===0?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"No traces yet"})}):u.map((w,C)=>e.jsx(Ae,{node:w,depth:0,selectedId:(s==null?void 0:s.span_id)??null,onSelect:r,isLast:C===u.length-1,collapsedIds:o,toggleExpanded:N},w.span.span_id))})}),e.jsx("div",{onMouseDown:j,className:"shrink-0 w-1.5 cursor-col-resize bg-[var(--border)] hover:bg-[var(--accent)] transition-colors relative",style:c?{background:"var(--accent)"}:void 0,children:e.jsx("div",{className:"absolute inset-0 -left-1 -right-1"})}),e.jsx("div",{className:"flex-1 overflow-hidden p-0.5",children:s?e.jsx(Kt,{span:s}):e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"Select a span to view details"})})})]})}function Ae({node:t,depth:s,selectedId:r,onSelect:o,isLast:n,collapsedIds:i,toggleExpanded:a}){var N;const{span:c}=t,m=!i.has(c.span_id),u=Zt[c.status.toLowerCase()]??"var(--text-muted)",l=ts(c.duration_ms),p=c.span_id===r,v=t.children.length>0,k=s*20,R=(N=c.attributes)==null?void 0:N["openinference.span.kind"];return e.jsxs("div",{className:"relative",children:[s>0&&e.jsx("div",{className:"absolute top-0 z-10 pointer-events-none",style:{left:`${k-10}px`,width:"1px",height:n?"16px":"100%",background:"var(--border)"}}),e.jsxs("button",{"data-span-id":c.span_id,onClick:()=>o(c),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:`${k+4}px`,background:p?"color-mix(in srgb, var(--accent) 10%, var(--bg-primary))":void 0,borderLeft:p?"2px solid var(--accent)":"2px solid transparent"},onMouseEnter:j=>{p||(j.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:j=>{p||(j.currentTarget.style.background="")},children:[s>0&&e.jsx("div",{className:"absolute z-10 pointer-events-none",style:{left:`${k-10}px`,top:"50%",width:"10px",height:"1px",background:"var(--border)"}}),v?e.jsx("span",{onClick:j=>{j.stopPropagation(),a(c.span_id)},className:"shrink-0 w-4 h-4 flex items-center justify-center cursor-pointer rounded hover:bg-[var(--bg-hover)]",style:{color:"var(--text-muted)"},children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",style:{transform:m?"rotate(90deg)":"rotate(0deg)"},children:e.jsx("path",{d:"M3 1.5L7 5L3 8.5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})}):e.jsx("span",{className:"shrink-0 w-4"}),e.jsx("span",{className:"shrink-0 flex items-center justify-center w-4 h-4",children:e.jsx(Qt,{kind:R,statusColor:u})}),e.jsx("span",{className:"text-[var(--text-primary)] truncate min-w-0 flex-1",children:c.span_name}),l&&e.jsx("span",{className:"text-[var(--text-muted)] shrink-0 ml-auto pl-2 tabular-nums",children:l})]}),m&&t.children.map((j,w)=>e.jsx(Ae,{node:j,depth:s+1,selectedId:r,onSelect:o,isLast:w===t.children.length-1,collapsedIds:i,toggleExpanded:a},j.span.span_id))]})}const ss={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)"}},rs={color:"var(--text-muted)",bg:"transparent"};function Ee({logs:t}){const s=h.useRef(null),r=h.useRef(null),[o,n]=h.useState(!1);h.useEffect(()=>{var a;(a=r.current)==null||a.scrollIntoView({behavior:"smooth"})},[t.length]);const i=()=>{const a=s.current;a&&n(a.scrollTop>100)};return t.length===0?e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"No logs yet"})}):e.jsxs("div",{className:"h-full relative",children:[e.jsxs("div",{ref:s,onScroll:i,className:"h-full overflow-y-auto font-mono text-xs leading-normal",children:[t.map((a,c)=>{const m=new Date(a.timestamp).toLocaleTimeString(void 0,{hour12:!1}),u=a.level.toUpperCase(),l=u.slice(0,4),p=ss[u]??rs,v=c%2===0;return e.jsxs("div",{className:"flex gap-3 px-3 py-1.5",style:{background:v?"var(--bg-primary)":"var(--bg-secondary)"},children:[e.jsx("span",{className:"text-[var(--text-muted)] shrink-0",children:m}),e.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:l}),e.jsx("span",{className:"text-[var(--text-primary)] whitespace-pre-wrap break-all",children:a.message})]},c)}),e.jsx("div",{ref:r})]}),o&&e.jsx("button",{onClick:()=>{var a;return(a=s.current)==null?void 0:a.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"})})})]})}const os={started:{color:"var(--accent)",label:"started"},updated:{color:"var(--info)",label:"updated"},completed:{color:"var(--success)",label:"completed"},faulted:{color:"var(--error)",label:"faulted"}},Ce={color:"var(--text-muted)",label:""};function _e({events:t,runStatus:s}){const r=h.useRef(null),o=h.useRef(!0),[n,i]=h.useState(null),a=()=>{const c=r.current;c&&(o.current=c.scrollHeight-c.scrollTop-c.clientHeight<40)};return h.useEffect(()=>{o.current&&r.current&&(r.current.scrollTop=r.current.scrollHeight)}),t.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:e.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:s==="running"?"Waiting for events...":"No events yet"})}):e.jsx("div",{ref:r,onScroll:a,className:"h-full overflow-y-auto font-mono text-xs leading-normal",children:t.map((c,m)=>{const u=new Date(c.timestamp).toLocaleTimeString(void 0,{hour12:!1}),l=c.payload&&Object.keys(c.payload).length>0,p=n===m,v=c.phase?os[c.phase]??Ce:Ce;return e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>{l&&i(p?null:m)},className:"flex items-center gap-2 px-3 py-1.5",style:{background:m%2===0?"var(--bg-primary)":"var(--bg-secondary)",cursor:l?"pointer":"default"},children:[e.jsx("span",{className:"shrink-0",style:{color:"var(--text-muted)"},children:u}),e.jsx("span",{className:"shrink-0",style:{color:v.color},children:"●"}),e.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:c.node_name}),v.label&&e.jsx("span",{className:"shrink-0 text-[10px]",style:{color:"var(--text-muted)"},children:v.label}),l&&e.jsx("span",{className:"shrink-0 text-[9px] transition-transform",style:{color:"var(--text-muted)",transform:p?"rotate(90deg)":"rotate(0deg)"},children:"▸"})]}),p&&l&&e.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:e.jsx(te,{json:JSON.stringify(c.payload,null,2),className:"text-[11px] font-mono whitespace-pre-wrap break-words"})})]},m)})})}function Le({runId:t,status:s,ws:r,breakpointNode:o}){const n=s==="suspended",i=a=>{const c=I.getState().breakpoints[t]??{};r.setBreakpoints(t,Object.keys(c)),a==="step"?r.debugStep(t):a==="continue"?r.debugContinue(t):r.debugStop(t)};return e.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:[e.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold mr-1",style:{color:"var(--text-muted)"},children:"Debug"}),e.jsx(ce,{label:"Step",onClick:()=>i("step"),disabled:!n,color:"var(--info)",active:n}),e.jsx(ce,{label:"Continue",onClick:()=>i("continue"),disabled:!n,color:"var(--success)",active:n}),e.jsx(ce,{label:"Stop",onClick:()=>i("stop"),disabled:!n,color:"var(--error)",active:n}),e.jsx("span",{className:"text-[10px] ml-auto truncate",style:{color:n?"var(--accent)":"var(--text-muted)"},children:n?o?`Paused at ${o}`:"Paused":s})]})}function ce({label:t,onClick:s,disabled:r,color:o,active:n}){return e.jsx("button",{onClick:s,disabled:r,className:"px-2.5 py-0.5 h-5 text-[10px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed",style:{color:n?o:"var(--text-muted)",background:n?`color-mix(in srgb, ${o} 10%, transparent)`:"transparent"},onMouseEnter:i=>{r||(i.currentTarget.style.background=`color-mix(in srgb, ${o} 20%, transparent)`)},onMouseLeave:i=>{i.currentTarget.style.background=n?`color-mix(in srgb, ${o} 10%, transparent)`:"transparent"},children:t})}const Te=h.lazy(()=>He(()=>import("./ChatPanel-DPvzWlJ8.js"),__vite__mapDeps([2,1,3,4]))),ns=[],as=[],is=[],cs=[];function ls({run:t,ws:s,isMobile:r}){const o=t.mode==="chat",[n,i]=h.useState(280),[a,c]=h.useState(()=>{const d=localStorage.getItem("chatPanelWidth");return d?parseInt(d,10):380}),[m,u]=h.useState("primary"),[l,p]=h.useState(o?"primary":"traces"),[v,k]=h.useState(0),R=h.useRef(null),N=h.useRef(null),j=h.useRef(!1),w=I(d=>d.traces[t.id]||ns),C=I(d=>d.logs[t.id]||as),B=I(d=>d.chatMessages[t.id]||is),H=I(d=>d.stateEvents[t.id]||cs),L=I(d=>d.breakpoints[t.id]);h.useEffect(()=>{s.setBreakpoints(t.id,L?Object.keys(L):[])},[t.id]);const z=h.useCallback(d=>{s.setBreakpoints(t.id,d)},[t.id,s]),V=h.useCallback(d=>{d.preventDefault(),j.current=!0;const x="touches"in d?d.touches[0].clientY:d.clientY,b=n,S=_=>{if(!j.current)return;const M=R.current;if(!M)return;const f="touches"in _?_.touches[0].clientY:_.clientY,E=M.clientHeight-100,T=Math.max(80,Math.min(E,b+(f-x)));i(T)},g=()=>{j.current=!1,document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",g),document.removeEventListener("touchmove",S),document.removeEventListener("touchend",g),document.body.style.cursor="",document.body.style.userSelect="",k(_=>_+1)};document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",S),document.addEventListener("mouseup",g),document.addEventListener("touchmove",S,{passive:!1}),document.addEventListener("touchend",g)},[n]),U=h.useCallback(d=>{d.preventDefault();const x="touches"in d?d.touches[0].clientX:d.clientX,b=a,S=_=>{const M=N.current;if(!M)return;const f="touches"in _?_.touches[0].clientX:_.clientX,E=M.clientWidth-300,T=Math.max(280,Math.min(E,b+(x-f)));c(T)},g=()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",g),document.removeEventListener("touchmove",S),document.removeEventListener("touchend",g),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("chatPanelWidth",String(a)),k(_=>_+1)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",S),document.addEventListener("mouseup",g),document.addEventListener("touchmove",S,{passive:!1}),document.addEventListener("touchend",g)},[a]),X=o?"Chat":"Events",D=o?"var(--accent)":"var(--success)",P=I(d=>d.activeInterrupt[t.id]??null),$=t.status==="running"?e.jsx("span",{className:"ml-auto text-[10px] 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:o?"Thinking...":"Running..."}):o&&t.status==="suspended"&&P?e.jsx("span",{className:"ml-auto text-[10px] 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(r){const d=[{id:"traces",label:"Traces",count:w.length},{id:"primary",label:X},{id:"io",label:"I/O"},{id:"logs",label:"Logs",count:C.length}];return e.jsxs("div",{className:"flex flex-col h-full",children:[(t.mode==="debug"||t.status==="suspended"&&!P||L&&Object.keys(L).length>0)&&e.jsx(Le,{runId:t.id,status:t.status,ws:s,breakpointNode:t.breakpoint_node}),e.jsx("div",{className:"shrink-0",style:{height:"40vh"},children:e.jsx(ne,{entrypoint:t.entrypoint,traces:w,runId:t.id,breakpointNode:t.breakpoint_node,breakpointNextNodes:t.breakpoint_next_nodes,onBreakpointChange:z,fitViewTrigger:v})}),e.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(x=>e.jsxs("button",{onClick:()=>p(x.id),className:"px-2 py-0.5 h-5 text-[11px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer",style:{color:l===x.id?x.id==="primary"?D:"var(--accent)":"var(--text-muted)",background:l===x.id?`color-mix(in srgb, ${x.id==="primary"?D:"var(--accent)"} 10%, transparent)`:"transparent"},children:[x.label,x.count!==void 0&&x.count>0&&e.jsx("span",{className:"ml-1 font-normal",style:{color:"var(--text-muted)"},children:x.count})]},x.id)),$]}),e.jsxs("div",{className:"flex-1 overflow-hidden",children:[l==="traces"&&e.jsx(Se,{traces:w}),l==="primary"&&(o?e.jsx(h.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:e.jsx("span",{className:"text-xs",children:"Loading chat..."})}),children:e.jsx(Te,{messages:B,runId:t.id,runStatus:t.status,ws:s})}):e.jsx(_e,{events:H,runStatus:t.status})),l==="io"&&e.jsx(Me,{run:t}),l==="logs"&&e.jsx(Ee,{logs:C})]})]})}const q=[{id:"primary",label:X},{id:"io",label:"I/O"},{id:"logs",label:"Logs",count:C.length}];return e.jsxs("div",{ref:N,className:"flex h-full",children:[e.jsxs("div",{ref:R,className:"flex flex-col flex-1 min-w-0",children:[(t.mode==="debug"||t.status==="suspended"&&!P||L&&Object.keys(L).length>0)&&e.jsx(Le,{runId:t.id,status:t.status,ws:s,breakpointNode:t.breakpoint_node}),e.jsx("div",{className:"shrink-0",style:{height:n},children:e.jsx(ne,{entrypoint:t.entrypoint,traces:w,runId:t.id,breakpointNode:t.breakpoint_node,breakpointNextNodes:t.breakpoint_next_nodes,onBreakpointChange:z,fitViewTrigger:v})}),e.jsx("div",{onMouseDown:V,onTouchStart:V,className:"shrink-0 h-1.5 cursor-row-resize bg-[var(--border)] hover:bg-[var(--accent)] transition-colors relative",children:e.jsx("div",{className:"absolute inset-0 -top-1 -bottom-1"})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(Se,{traces:w})})]}),e.jsx("div",{onMouseDown:U,onTouchStart:U,className:"shrink-0 w-1.5 cursor-col-resize bg-[var(--border)] hover:bg-[var(--accent)] transition-colors relative",children:e.jsx("div",{className:"absolute inset-0 -left-1 -right-1"})}),e.jsxs("div",{className:"shrink-0 flex flex-col",style:{width:a,background:"var(--bg-primary)"},children:[e.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:[q.map(d=>e.jsxs("button",{onClick:()=>u(d.id),className:"px-2 py-0.5 h-5 text-[11px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer",style:{color:m===d.id?d.id==="primary"?D:"var(--accent)":"var(--text-muted)",background:m===d.id?`color-mix(in srgb, ${d.id==="primary"?D:"var(--accent)"} 10%, transparent)`:"transparent"},onMouseEnter:x=>{m!==d.id&&(x.currentTarget.style.color="var(--text-primary)")},onMouseLeave:x=>{m!==d.id&&(x.currentTarget.style.color="var(--text-muted)")},children:[d.label,d.count!==void 0&&d.count>0&&e.jsx("span",{className:"ml-1 font-normal",style:{color:"var(--text-muted)"},children:d.count})]},d.id)),$]}),e.jsxs("div",{className:"flex-1 overflow-hidden",children:[m==="primary"&&(o?e.jsx(h.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:e.jsx("span",{className:"text-xs",children:"Loading chat..."})}),children:e.jsx(Te,{messages:B,runId:t.id,runStatus:t.status,ws:s})}):e.jsx(_e,{events:H,runStatus:t.status})),m==="io"&&e.jsx(Me,{run:t}),m==="logs"&&e.jsx(Ee,{logs:C})]})]})]})}function Me({run:t}){return e.jsxs("div",{className:"p-4 overflow-y-auto h-full space-y-4",children:[e.jsx(Re,{title:"Input",color:"var(--success)",copyText:JSON.stringify(t.input_data,null,2),children:e.jsx(te,{json:JSON.stringify(t.input_data,null,2),className:"p-3 rounded-lg text-xs font-mono whitespace-pre-wrap break-words",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)"}})}),t.output_data&&e.jsx(Re,{title:"Output",color:"var(--accent)",copyText:typeof t.output_data=="string"?t.output_data:JSON.stringify(t.output_data,null,2),children:e.jsx(te,{json:typeof t.output_data=="string"?t.output_data:JSON.stringify(t.output_data,null,2),className:"p-3 rounded-lg text-xs font-mono whitespace-pre-wrap break-words",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)"}})}),t.error&&e.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid color-mix(in srgb, var(--error) 40%, var(--border))"},children:[e.jsxs("div",{className:"px-4 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:[e.jsx("span",{children:"Error"}),e.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:t.error.code}),e.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:t.error.category})]}),e.jsxs("div",{className:"p-4 text-xs leading-normal",style:{background:"var(--bg-secondary)"},children:[e.jsx("div",{className:"font-semibold mb-2",style:{color:"var(--text-primary)"},children:t.error.title}),e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-[11px] max-w-prose",style:{color:"var(--text-secondary)"},children:t.error.detail})]})]})]})}function Re({title:t,color:s,copyText:r,children:o}){const[n,i]=h.useState(!1),a=h.useCallback(()=>{r&&navigator.clipboard.writeText(r).then(()=>{i(!0),setTimeout(()=>i(!1),1500)})},[r]);return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"w-1 h-4 rounded-full",style:{background:s}}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:s},children:t}),r&&e.jsx("button",{onClick:a,className:"ml-auto text-[10px] cursor-pointer px-1.5 py-0.5 rounded",style:{color:n?"var(--success)":"var(--text-muted)",background:"var(--bg-secondary)",border:"1px solid var(--border)"},children:n?"Copied":"Copy"})]}),o]})}function ds(){const{reloadPending:t,setReloadPending:s,setEntrypoints:r}=I(),[o,n]=h.useState(!1);if(!t)return null;const i=async()=>{n(!0);try{await lt();const a=await Ie();r(a.map(c=>c.name)),s(!1)}catch(a){console.error("Reload failed:",a)}finally{n(!1)}};return e.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:[e.jsx("span",{className:"text-sm",style:{color:"var(--text-secondary)"},children:"Files changed — reload to apply"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:i,disabled:o,className:"px-3 py-1 text-sm font-medium rounded cursor-pointer",style:{background:"var(--accent)",color:"#fff",opacity:o?.6:1},children:o?"Reloading...":"Reload"}),e.jsx("button",{onClick:()=>s(!1),className:"text-sm cursor-pointer px-1",style:{color:"var(--text-muted)",background:"none",border:"none"},children:"✕"})]})]})}function us(){const t=ot(),s=ht(),[r,o]=h.useState(!1),{runs:n,selectedRunId:i,setRuns:a,upsertRun:c,selectRun:m,setTraces:u,setLogs:l,setChatMessages:p,setEntrypoints:v,setStateEvents:k,setGraphCache:R,setActiveNode:N}=I(),{view:j,runId:w,setupEntrypoint:C,setupMode:B,navigate:H}=Pe();h.useEffect(()=>{j==="details"&&w&&w!==i&&m(w)},[j,w,i,m]),h.useEffect(()=>{ct().then(a).catch(console.error),Ie().then(P=>v(P.map($=>$.name))).catch(console.error)},[a,v]);const L=i?n[i]:null,z=h.useCallback((P,$)=>{c($),u(P,$.traces),l(P,$.logs);const q=$.messages.map(d=>{const x=d.contentParts??d.content_parts??[],b=d.toolCalls??d.tool_calls??[];return{message_id:d.messageId??d.message_id,role:d.role??"assistant",content:x.filter(S=>{const g=S.mimeType??S.mime_type??"";return g.startsWith("text/")||g==="application/json"}).map(S=>{const g=S.data;return(g==null?void 0:g.inline)??""}).join(` -`).trim()??"",tool_calls:b.length>0?b.map(S=>({name:S.name??"",has_result:!!S.result})):void 0}});if(p(P,q),$.graph&&$.graph.nodes.length>0&&R(P,$.graph),$.states&&$.states.length>0&&(k(P,$.states.map(d=>({node_name:d.node_name,qualified_node_name:d.qualified_node_name,phase:d.phase,timestamp:new Date(d.timestamp).getTime(),payload:d.payload}))),$.status!=="completed"&&$.status!=="failed")){const d=[...$.states].reverse().find(x=>x.phase==="started");d&&N(P,d.node_name,d.qualified_node_name)}},[c,u,l,p,k,R,N]);h.useEffect(()=>{if(!i)return;t.subscribe(i),ae(i).then($=>z(i,$)).catch(console.error);const P=setTimeout(()=>{const $=I.getState().runs[i];$&&($.status==="pending"||$.status==="running")&&ae(i).then(q=>z(i,q)).catch(console.error)},2e3);return()=>{clearTimeout(P),t.unsubscribe(i)}},[i,t,z]);const V=h.useRef(null);h.useEffect(()=>{var q,d;if(!i)return;const P=L==null?void 0:L.status,$=V.current;if(V.current=P??null,P&&(P==="completed"||P==="failed")&&$!==P){const x=I.getState(),b=((q=x.traces[i])==null?void 0:q.length)??0,S=((d=x.logs[i])==null?void 0:d.length)??0,g=(L==null?void 0:L.trace_count)??0,_=(L==null?void 0:L.log_count)??0;(bz(i,M)).catch(console.error)}},[i,L==null?void 0:L.status,z]);const U=P=>{H(`#/runs/${P}/traces`),m(P),o(!1)},X=P=>{H(`#/runs/${P}/traces`),m(P),o(!1)},D=()=>{H("#/new"),o(!1)};return e.jsxs("div",{className:"flex h-screen w-screen relative",children:[s&&!r&&e.jsx("button",{onClick:()=>o(!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:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),e.jsx(gt,{runs:Object.values(n),selectedRunId:i,onSelectRun:X,onNewRun:D,isMobile:s,isOpen:r,onClose:()=>o(!1)}),e.jsx("main",{className:"flex-1 overflow-hidden bg-[var(--bg-primary)]",children:j==="new"?e.jsx(ft,{}):j==="setup"&&C&&B?e.jsx(zt,{entrypoint:C,mode:B,ws:t,onRunCreated:U,isMobile:s}):L?e.jsx(ls,{run:L,ws:t,isMobile:s}):e.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)]",children:"Select a run or create a new one"})}),e.jsx(ds,{})]})}Ve.createRoot(document.getElementById("root")).render(e.jsx(h.StrictMode,{children:e.jsx(us,{})}));export{I as u}; diff --git a/src/uipath/dev/server/static/assets/index-C62Pn1l1.css b/src/uipath/dev/server/static/assets/index-C62Pn1l1.css deleted file mode 100644 index 76dae72..0000000 --- a/src/uipath/dev/server/static/assets/index-C62Pn1l1.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-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-xl:36rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-normal:0em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-normal:1.5;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--ease-in-out:cubic-bezier(.4,0,.2,1);--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-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-1{top:calc(var(--spacing)*-1)}.top-0{top:calc(var(--spacing)*0)}.top-2{top:calc(var(--spacing)*2)}.top-4{top:calc(var(--spacing)*4)}.-right-1{right:calc(var(--spacing)*-1)}.right-3{right:calc(var(--spacing)*3)}.-bottom-1{bottom:calc(var(--spacing)*-1)}.-left-1{left:calc(var(--spacing)*-1)}.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}.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-3{margin-inline:calc(var(--spacing)*3)}.my-2{margin-block:calc(var(--spacing)*2)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2\.5{margin-top:calc(var(--spacing)*2.5)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-auto{margin-right:auto}.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-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}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.h-1{height:calc(var(--spacing)*1)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-\[33px\]{height:33px}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:calc(var(--spacing)*48)}.min-h-0{min-height:calc(var(--spacing)*0)}.w-1{width:calc(var(--spacing)*1)}.w-1\.5{width:calc(var(--spacing)*1.5)}.w-2{width:calc(var(--spacing)*2)}.w-4{width:calc(var(--spacing)*4)}.w-6{width:calc(var(--spacing)*6)}.w-9{width:calc(var(--spacing)*9)}.w-44{width:calc(var(--spacing)*44)}.w-64{width:calc(var(--spacing)*64)}.w-full{width:100%}.w-screen{width:100vw}.max-w-prose{max-width:65ch}.max-w-xl{max-width:var(--container-xl)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-\[400px\]{min-width:400px}.flex-1{flex:1}.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,)}.cursor-col-resize{cursor:col-resize}.cursor-pointer{cursor:pointer}.cursor-row-resize{cursor:row-resize}.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-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.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\.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-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-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-xl{border-radius:var(--radius-xl)}.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\(--border\)\]{background-color:var(--border)}.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-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)}.pt-0\.5{padding-top:calc(var(--spacing)*.5)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-px{padding-top:1px}.pr-0\.5{padding-right:calc(var(--spacing)*.5)}.pr-2{padding-right:calc(var(--spacing)*2)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-2\.5{padding-left:calc(var(--spacing)*2.5)}.text-center{text-align:center}.text-left{text-align:left}.font-mono{font-family:var(--font-mono)}.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}.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-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,)}.accent-\[var\(--accent\)\]{accent-color:var(--accent)}.opacity-70{opacity:.7}.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)}.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))}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.placeholder\:text-\[var\(--text-muted\)\]::placeholder{color:var(--text-muted)}@media(hover:hover){.hover\:bg-\[var\(--accent\)\]:hover{background-color:var(--accent)}.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\: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}}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:#1e293b;--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:#0c1222;--card-bg:#1e293b;--input-bg:#0f172a;--tab-active:#fa4616;--tab-text:#94a3b8;--tab-text-active:#fa4616;--node-bg:#1e293b;--node-border:#475569;color-scheme:dark}[data-theme=light]{--bg-primary:#f8fafc;--bg-secondary:#fff;--bg-tertiary:#cbd5e1;--bg-hover:#f1f5f9;--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;--card-bg:#fff;--input-bg:#f8fafc;--tab-active:#fa4616;--tab-text:#64748b;--tab-text-active:#fa4616;--node-bg:#fff;--node-border:#cbd5e1;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}.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(--bg-tertiary);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(--bg-primary);border:1px solid var(--border);border-radius:3px;padding:.1em .35em;font-size:.85em}.chat-markdown pre{background:var(--bg-primary);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(--bg-primary);font-weight:600}.chat-markdown tr:nth-child(2n){background:var(--bg-primary)}.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-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} diff --git a/src/uipath/dev/server/static/assets/index-CvCM6cm0.js b/src/uipath/dev/server/static/assets/index-CvCM6cm0.js new file mode 100644 index 0000000..545ad19 --- /dev/null +++ b/src/uipath/dev/server/static/assets/index-CvCM6cm0.js @@ -0,0 +1,42 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-elk-CTNP4r_q.js","assets/vendor-react-BVoutfaX.js","assets/ChatPanel-CJFPD9T1.js","assets/vendor-reactflow-mU21rT8r.js","assets/vendor-reactflow-B5DZHykP.css"])))=>i.map(i=>d[i]); +var ze=Object.defineProperty;var Ve=(t,s,r)=>s in t?ze(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r;var K=(t,s,r)=>Ve(t,typeof s!="symbol"?s+"":s,r);import{R as re,a as h,j as e,b as Fe}from"./vendor-react-BVoutfaX.js";import{H as Y,P as X,B as Ue,M as Je,u as Ge,a as qe,R as Ye,b as Xe,C as Ke,c as Ze,d as Qe}from"./vendor-reactflow-mU21rT8r.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))o(n);new MutationObserver(n=>{for(const i of n)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&o(a)}).observe(document,{childList:!0,subtree:!0});function r(n){const i={};return n.integrity&&(i.integrity=n.integrity),n.referrerPolicy&&(i.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?i.credentials="include":n.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(n){if(n.ep)return;n.ep=!0;const i=r(n);fetch(n.href,i)}})();const de=t=>{let s;const r=new Set,o=(d,l)=>{const x=typeof d=="function"?d(s):d;if(!Object.is(x,s)){const j=s;s=l??(typeof x!="object"||x===null)?x:Object.assign({},s,x),r.forEach(y=>y(s,j))}},n=()=>s,c={setState:o,getState:n,getInitialState:()=>m,subscribe:d=>(r.add(d),()=>r.delete(d))},m=s=t(o,n,c);return c},et=(t=>t?de(t):de),tt=t=>t;function st(t,s=tt){const r=re.useSyncExternalStore(t.subscribe,re.useCallback(()=>s(t.getState()),[t,s]),re.useCallback(()=>s(t.getInitialState()),[t,s]));return re.useDebugValue(r),r}const ue=t=>{const s=et(t),r=o=>st(s,o);return Object.assign(r,s),r},$e=(t=>t?ue(t):ue),W=$e(t=>({runs:{},selectedRunId:null,traces:{},logs:{},chatMessages:{},entrypoints:[],setRuns:s=>t(r=>{var i;let o=r.breakpoints;for(const a of s)(i=a.breakpoints)!=null&&i.length&&!o[a.id]&&(o={...o,[a.id]:Object.fromEntries(a.breakpoints.map(c=>[c,!0]))});const n={runs:Object.fromEntries(s.map(a=>[a.id,a]))};return o!==r.breakpoints&&(n.breakpoints=o),n}),upsertRun:s=>t(r=>{var n;const o={runs:{...r.runs,[s.id]:s}};if((n=s.breakpoints)!=null&&n.length&&!r.breakpoints[s.id]&&(o.breakpoints={...r.breakpoints,[s.id]:Object.fromEntries(s.breakpoints.map(i=>[i,!0]))}),(s.status==="completed"||s.status==="failed")&&r.activeNodes[s.id]){const{[s.id]:i,...a}=r.activeNodes;o.activeNodes=a}if(s.status!=="suspended"&&r.activeInterrupt[s.id]){const{[s.id]:i,...a}=r.activeInterrupt;o.activeInterrupt=a}return o}),selectRun:s=>t({selectedRunId:s}),addTrace:s=>t(r=>{const o=r.traces[s.run_id]??[],n=o.findIndex(a=>a.span_id===s.span_id),i=n>=0?o.map((a,c)=>c===n?s:a):[...o,s];return{traces:{...r.traces,[s.run_id]:i}}}),setTraces:(s,r)=>t(o=>({traces:{...o.traces,[s]:r}})),addLog:s=>t(r=>{const o=r.logs[s.run_id]??[];return{logs:{...r.logs,[s.run_id]:[...o,s]}}}),setLogs:(s,r)=>t(o=>({logs:{...o.logs,[s]:r}})),addChatEvent:(s,r)=>t(o=>{const n=o.chatMessages[s]??[],i=r.message;if(!i)return o;const a=i.messageId??i.message_id,c=i.role??"assistant",l=(i.contentParts??i.content_parts??[]).filter(k=>{const w=k.mimeType??k.mime_type??"";return w.startsWith("text/")||w==="application/json"}).map(k=>{const w=k.data;return(w==null?void 0:w.inline)??""}).join(` +`).trim(),x=(i.toolCalls??i.tool_calls??[]).map(k=>({name:k.name??"",has_result:!!k.result})),j={message_id:a,role:c,content:l,tool_calls:x.length>0?x:void 0},y=n.findIndex(k=>k.message_id===a);if(y>=0)return{chatMessages:{...o.chatMessages,[s]:n.map((k,w)=>w===y?j:k)}};if(c==="user"){const k=n.findIndex(w=>w.message_id.startsWith("local-")&&w.role==="user"&&w.content===l);if(k>=0)return{chatMessages:{...o.chatMessages,[s]:n.map((w,$)=>$===k?j:w)}}}const E=[...n,j];return{chatMessages:{...o.chatMessages,[s]:E}}}),addLocalChatMessage:(s,r)=>t(o=>{const n=o.chatMessages[s]??[];return{chatMessages:{...o.chatMessages,[s]:[...n,r]}}}),setChatMessages:(s,r)=>t(o=>({chatMessages:{...o.chatMessages,[s]:r}})),setEntrypoints:s=>t({entrypoints:s}),breakpoints:{},toggleBreakpoint:(s,r)=>t(o=>{const n={...o.breakpoints[s]??{}};return n[r]?delete n[r]:n[r]=!0,{breakpoints:{...o.breakpoints,[s]:n}}}),clearBreakpoints:s=>t(r=>{const{[s]:o,...n}=r.breakpoints;return{breakpoints:n}}),activeNodes:{},setActiveNode:(s,r,o)=>t(n=>{const i=n.activeNodes[s]??{executing:{},prev:null};return{activeNodes:{...n.activeNodes,[s]:{executing:{...i.executing,[r]:o??null},prev:i.prev}}}}),removeActiveNode:(s,r)=>t(o=>{const n=o.activeNodes[s];if(!n)return o;const{[r]:i,...a}=n.executing;return{activeNodes:{...o.activeNodes,[s]:{executing:a,prev:r}}}}),resetRunGraphState:s=>t(r=>({stateEvents:{...r.stateEvents,[s]:[]},activeNodes:{...r.activeNodes,[s]:{executing:{},prev:null}}})),stateEvents:{},addStateEvent:(s,r,o,n,i)=>t(a=>{const c=a.stateEvents[s]??[];return{stateEvents:{...a.stateEvents,[s]:[...c,{node_name:r,qualified_node_name:n,phase:i,timestamp:Date.now(),payload:o}]}}}),setStateEvents:(s,r)=>t(o=>({stateEvents:{...o.stateEvents,[s]:r}})),focusedSpan:null,setFocusedSpan:s=>t({focusedSpan:s}),activeInterrupt:{},setActiveInterrupt:(s,r)=>t(o=>({activeInterrupt:{...o.activeInterrupt,[s]:r}})),reloadPending:!1,setReloadPending:s=>t({reloadPending:s}),graphCache:{},setGraphCache:(s,r)=>t(o=>({graphCache:{...o.graphCache,[s]:r}}))}));class rt{constructor(s){K(this,"ws",null);K(this,"url");K(this,"handlers",new Set);K(this,"reconnectTimer",null);K(this,"shouldReconnect",!0);K(this,"pendingMessages",[]);K(this,"activeSubscriptions",new Set);const r=window.location.protocol==="https:"?"wss:":"ws:";this.url=s??`${r}//${window.location.host}/ws`}connect(){var s;((s=this.ws)==null?void 0:s.readyState)!==WebSocket.OPEN&&(this.ws=new WebSocket(this.url),this.ws.onopen=()=>{console.log("[ws] connected");for(const r of this.activeSubscriptions)this.sendRaw(JSON.stringify({type:"subscribe",payload:{run_id:r}}));for(const r of this.pendingMessages)this.sendRaw(r);this.pendingMessages=[]},this.ws.onmessage=r=>{let o;try{o=JSON.parse(r.data)}catch{console.warn("[ws] failed to parse message",r.data);return}this.handlers.forEach(n=>{try{n(o)}catch(i){console.error("[ws] handler error",i)}})},this.ws.onclose=()=>{console.log("[ws] disconnected"),this.shouldReconnect&&(this.reconnectTimer=setTimeout(()=>this.connect(),2e3))},this.ws.onerror=()=>{var r;(r=this.ws)==null||r.close()})}disconnect(){var s;this.shouldReconnect=!1,this.reconnectTimer&&clearTimeout(this.reconnectTimer),(s=this.ws)==null||s.close(),this.ws=null}onMessage(s){return this.handlers.add(s),()=>this.handlers.delete(s)}sendRaw(s){var r;((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN&&this.ws.send(s)}send(s,r){var n;const o=JSON.stringify({type:s,payload:r});((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN?this.ws.send(o):this.pendingMessages.push(o)}subscribe(s){this.activeSubscriptions.add(s),this.send("subscribe",{run_id:s})}unsubscribe(s){this.activeSubscriptions.delete(s),this.send("unsubscribe",{run_id:s})}sendChatMessage(s,r){this.send("chat.message",{run_id:s,text:r})}sendInterruptResponse(s,r){this.send("chat.interrupt_response",{run_id:s,data:r})}debugStep(s){this.send("debug.step",{run_id:s})}debugContinue(s){this.send("debug.continue",{run_id:s})}debugStop(s){this.send("debug.stop",{run_id:s})}setBreakpoints(s,r){this.send("debug.set_breakpoints",{run_id:s,breakpoints:r})}}let oe=null;function ot(){return oe||(oe=new rt,oe.connect()),oe}function nt(){const t=h.useRef(ot()),{upsertRun:s,addTrace:r,addLog:o,addChatEvent:n,setActiveInterrupt:i,setActiveNode:a,removeActiveNode:c,resetRunGraphState:m,addStateEvent:d,setReloadPending:l}=W();return h.useEffect(()=>t.current.onMessage(y=>{switch(y.type){case"run.updated":s(y.payload);break;case"trace":r(y.payload);break;case"log":o(y.payload);break;case"chat":{const E=y.payload.run_id;n(E,y.payload);break}case"chat.interrupt":{const E=y.payload.run_id;i(E,y.payload);break}case"state":{const E=y.payload.run_id,k=y.payload.node_name,w=y.payload.qualified_node_name??null,$=y.payload.phase??null,B=y.payload.payload;k==="__start__"&&$==="started"&&m(E),$==="started"?a(E,k,w):$==="completed"&&c(E,k),d(E,k,B,w,$);break}case"reload":l(!0);break}}),[s,r,o,n,i,a,c,m,d,l]),t.current}const Z="/api";async function Q(t,s){const r=await fetch(t,s);if(!r.ok){let o;try{o=(await r.json()).detail||r.statusText}catch{o=r.statusText}const n=new Error(`HTTP ${r.status}`);throw n.detail=o,n.status=r.status,n}return r.json()}async function Ie(){return Q(`${Z}/entrypoints`)}async function at(t){return Q(`${Z}/entrypoints/${encodeURIComponent(t)}/schema`)}async function it(t){return Q(`${Z}/entrypoints/${encodeURIComponent(t)}/mock-input`)}async function ct(t){return Q(`${Z}/entrypoints/${encodeURIComponent(t)}/graph`)}async function pe(t,s,r="run",o=[]){return Q(`${Z}/runs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entrypoint:t,input_data:s,mode:r,breakpoints:o})})}async function lt(){return Q(`${Z}/runs`)}async function ae(t){return Q(`${Z}/runs/${t}`)}async function dt(){return Q(`${Z}/reload`,{method:"POST"})}function ut(t){const s=t.replace(/^#\/?/,"");if(!s||s==="new")return{view:"new",runId:null,tab:"traces",setupEntrypoint:null,setupMode:null};const r=s.match(/^setup\/([^/]+)\/(run|chat)$/);if(r)return{view:"setup",runId:null,tab:"traces",setupEntrypoint:decodeURIComponent(r[1]),setupMode:r[2]};const o=s.match(/^runs\/([^/]+)(?:\/(traces|output))?$/);return o?{view:"details",runId:o[1],tab:o[2]??"traces",setupEntrypoint:null,setupMode:null}:{view:"new",runId:null,tab:"traces",setupEntrypoint:null,setupMode:null}}function pt(){return window.location.hash}function ht(t){return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)}function Pe(){const t=h.useSyncExternalStore(ht,pt),s=ut(t),r=h.useCallback(o=>{window.location.hash=o},[]);return{...s,navigate:r}}const he="(max-width: 767px)";function xt(){const[t,s]=h.useState(()=>window.matchMedia(he).matches);return h.useEffect(()=>{const r=window.matchMedia(he),o=n=>s(n.matches);return r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[]),t}function We(){const t=localStorage.getItem("uipath-dev-theme");return t==="light"||t==="dark"?t:"dark"}function Oe(t){document.documentElement.setAttribute("data-theme",t),localStorage.setItem("uipath-dev-theme",t)}Oe(We());const mt=$e(t=>({theme:We(),toggleTheme:()=>t(s=>{const r=s.theme==="dark"?"light":"dark";return Oe(r),{theme:r}})})),gt={pending:"var(--text-muted)",running:"var(--warning)",suspended:"var(--info)",completed:"var(--success)",failed:"var(--error)"};function xe({run:t,isSelected:s,onClick:r}){var a;const o=gt[t.status]??"var(--text-muted)",n=((a=t.entrypoint.split("/").pop())==null?void 0:a.slice(0,16))??t.entrypoint,i=t.start_time?new Date(t.start_time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"";return e.jsxs("button",{onClick:r,className:"w-full text-left px-3 py-1.5 flex items-center gap-2 transition-colors cursor-pointer",style:{background:s?"color-mix(in srgb, var(--accent) 8%, var(--bg-primary))":void 0,borderLeft:s?"2px solid var(--accent)":"2px solid transparent"},onMouseEnter:c=>{s||(c.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:c=>{s||(c.currentTarget.style.background="")},children:[e.jsx("span",{className:"shrink-0 w-1.5 h-1.5 rounded-full",style:{background:o}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xs truncate",style:{color:s?"var(--text-primary)":"var(--text-secondary)"},children:n}),e.jsxs("div",{className:"text-[10px] tabular-nums",style:{color:"var(--text-muted)"},children:[i,t.duration?` · ${t.duration}`:""]})]})]})}function ft({runs:t,selectedRunId:s,onSelectRun:r,onNewRun:o,isMobile:n,isOpen:i,onClose:a}){const{theme:c,toggleTheme:m}=mt(),d=[...t].sort((l,x)=>new Date(x.start_time??0).getTime()-new Date(l.start_time??0).getTime());return n?i?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-50",style:{background:"rgba(0,0,0,0.5)"},onClick:a}),e.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:[e.jsxs("div",{className:"px-3 h-10 border-b border-[var(--border)] flex items-center justify-between",children:[e.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 cursor-pointer transition-opacity hover:opacity-80",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("rect",{width:"24",height:"24",rx:"4",fill:"var(--accent)"}),e.jsx("text",{x:"12",y:"17",textAnchor:"middle",fill:"white",fontSize:"14",fontWeight:"700",fontFamily:"Arial, sans-serif",children:"U"})]}),e.jsx("span",{className:"text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"Dev Console"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:m,className:"w-6 h-6 flex items-center justify-center rounded cursor-pointer transition-colors",style:{color:"var(--text-muted)"},title:`Switch to ${c==="dark"?"light":"dark"} theme`,children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:c==="dark"?e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"5"}),e.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),e.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),e.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),e.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),e.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),e.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),e.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),e.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]}):e.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})}),e.jsx("button",{onClick:a,className:"w-6 h-6 flex items-center justify-center rounded cursor-pointer transition-colors",style:{color:"var(--text-muted)"},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsx("button",{onClick:o,className:"mx-3 mt-2.5 mb-1 px-2 py-1.5 text-[10px] uppercase tracking-wider font-semibold rounded border border-[var(--border)] bg-transparent transition-colors cursor-pointer",style:{color:"var(--text-muted)"},children:"+ New Run"}),e.jsx("div",{className:"px-3 pt-3 pb-1 text-[10px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"History"}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[d.map(l=>e.jsx(xe,{run:l,isSelected:l.id===s,onClick:()=>r(l.id)},l.id)),d.length===0&&e.jsx("p",{className:"text-xs px-3 py-4 text-center",style:{color:"var(--text-muted)"},children:"No runs yet"})]})]})]}):null:e.jsxs("aside",{className:"w-44 bg-[var(--sidebar-bg)] border-r border-[var(--border)] flex flex-col",children:[e.jsxs("div",{className:"px-3 h-10 border-b border-[var(--border)] flex items-center justify-between",children:[e.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 cursor-pointer transition-opacity hover:opacity-80",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("rect",{width:"24",height:"24",rx:"4",fill:"var(--accent)"}),e.jsx("text",{x:"12",y:"17",textAnchor:"middle",fill:"white",fontSize:"14",fontWeight:"700",fontFamily:"Arial, sans-serif",children:"U"})]}),e.jsx("span",{className:"text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"Dev Console"})]}),e.jsx("button",{onClick:m,className:"w-6 h-6 flex items-center justify-center rounded cursor-pointer transition-colors",style:{color:"var(--text-muted)"},onMouseEnter:l=>{l.currentTarget.style.color="var(--text-primary)"},onMouseLeave:l=>{l.currentTarget.style.color="var(--text-muted)"},title:`Switch to ${c==="dark"?"light":"dark"} theme`,children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:c==="dark"?e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"5"}),e.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),e.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),e.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),e.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),e.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),e.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),e.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),e.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]}):e.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})})]}),e.jsx("button",{onClick:o,className:"mx-3 mt-2.5 mb-1 px-2 py-1 text-[10px] uppercase tracking-wider font-semibold rounded border border-[var(--border)] bg-transparent transition-colors cursor-pointer",style:{color:"var(--text-muted)"},onMouseEnter:l=>{l.currentTarget.style.color="var(--text-primary)",l.currentTarget.style.borderColor="var(--text-muted)"},onMouseLeave:l=>{l.currentTarget.style.color="var(--text-muted)",l.currentTarget.style.borderColor="var(--border)"},children:"+ New Run"}),e.jsx("div",{className:"px-3 pt-3 pb-1 text-[10px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"History"}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[d.map(l=>e.jsx(xe,{run:l,isSelected:l.id===s,onClick:()=>r(l.id)},l.id)),d.length===0&&e.jsx("p",{className:"text-xs px-3 py-4 text-center",style:{color:"var(--text-muted)"},children:"No runs yet"})]})]})}function vt(){const{navigate:t}=Pe(),s=W(d=>d.entrypoints),[r,o]=h.useState(""),[n,i]=h.useState(!0),[a,c]=h.useState(null);h.useEffect(()=>{!r&&s.length>0&&o(s[0])},[s,r]),h.useEffect(()=>{r&&(i(!0),c(null),at(r).then(d=>{var x;const l=(x=d.input)==null?void 0:x.properties;i(!!(l!=null&&l.messages))}).catch(d=>{const l=d.detail||{};c(l.error||l.message||`Failed to load entrypoint "${r}"`)}))},[r]);const m=d=>{r&&t(`#/setup/${encodeURIComponent(r)}/${d}`)};return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"w-full max-w-xl px-6",children:[e.jsxs("div",{className:"mb-8 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:a?"var(--error)":"var(--accent)"}}),e.jsx("span",{className:"text-xs uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"New Run"})]}),!a&&e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:s.length>1?"Select an entrypoint and choose a mode":"Choose a mode"})]}),s.length>1&&e.jsxs("div",{className:"mb-8",children:[e.jsx("label",{className:"block text-[10px] uppercase tracking-wider font-semibold mb-2",style:{color:"var(--text-muted)"},children:"Entrypoint"}),e.jsx("select",{value:r,onChange:d=>o(d.target.value),className:"w-full rounded-md px-3 py-1.5 text-xs font-mono cursor-pointer appearance-auto",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)",color:"var(--text-primary)"},children:s.map(d=>e.jsx("option",{value:d,children:d},d))})]}),a?e.jsxs("div",{className:"rounded-md border overflow-hidden",style:{borderColor:"color-mix(in srgb, var(--error) 25%, var(--border))",background:"var(--bg-secondary)"},children:[e.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:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:e.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)"})}),e.jsx("span",{className:"text-[11px] font-medium",style:{color:"var(--error)"},children:"Failed to load entrypoint"})]}),e.jsx("div",{className:"overflow-auto max-h-48 p-3",children:e.jsx("pre",{className:"text-[11px] font-mono whitespace-pre-wrap break-words leading-relaxed m-0",style:{color:"var(--text-muted)"},children:a})})]}):e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(me,{title:"Autonomous",description:"Run the agent end-to-end. Set breakpoints to pause and inspect execution.",icon:e.jsx(yt,{}),color:"var(--success)",onClick:()=>m("run"),disabled:!r}),e.jsx(me,{title:"Conversational",description:n?"Interactive chat session. Send messages and receive responses in real time.":'Requires a "messages" property in the input schema.',icon:e.jsx(bt,{}),color:"var(--accent)",onClick:()=>m("chat"),disabled:!r||!n})]})]})})}function me({title:t,description:s,icon:r,color:o,onClick:n,disabled:i}){return e.jsxs("button",{onClick:n,disabled:i,className:"group flex flex-col items-center text-center p-6 rounded-lg border transition-all cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed",style:{background:"var(--bg-secondary)",borderColor:"var(--border)"},onMouseEnter:a=>{i||(a.currentTarget.style.borderColor=o,a.currentTarget.style.background=`color-mix(in srgb, ${o} 5%, var(--bg-secondary))`)},onMouseLeave:a=>{a.currentTarget.style.borderColor="var(--border)",a.currentTarget.style.background="var(--bg-secondary)"},children:[e.jsx("div",{className:"mb-4 p-3 rounded-xl transition-colors",style:{background:`color-mix(in srgb, ${o} 10%, var(--bg-primary))`,color:o},children:r}),e.jsx("h3",{className:"text-sm font-semibold mb-1.5",style:{color:"var(--text-primary)"},children:t}),e.jsx("p",{className:"text-xs leading-relaxed",style:{color:"var(--text-muted)"},children:s})]})}function yt(){return e.jsx("svg",{width:"28",height:"28",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.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 bt(){return e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.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"}),e.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"}),e.jsx("ellipse",{cx:"12.9987",cy:"4.33268",rx:"2.16667",ry:"2.16667",fill:"currentColor"}),e.jsx("rect",{x:"11.918",y:"5.41602",width:"2.16667",height:"2.16667",fill:"currentColor"}),e.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"}),e.jsx("rect",{x:"3.25",y:"15.166",width:"2.16667",height:"1.08333",fill:"currentColor"}),e.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"}),e.jsx("rect",{x:"20.582",y:"15.166",width:"2.16667",height:"1.08333",fill:"currentColor"})]})}const jt="modulepreload",wt=function(t){return"/"+t},ge={},He=function(s,r,o){let n=Promise.resolve();if(r&&r.length>0){let a=function(d){return Promise.all(d.map(l=>Promise.resolve(l).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),m=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));n=a(r.map(d=>{if(d=wt(d),d in ge)return;ge[d]=!0;const l=d.endsWith(".css"),x=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${x}`))return;const j=document.createElement("link");if(j.rel=l?"stylesheet":jt,l||(j.as="script"),j.crossOrigin="",j.href=d,m&&j.setAttribute("nonce",m),document.head.appendChild(j),l)return new Promise((y,E)=>{j.addEventListener("load",y),j.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${d}`)))})}))}function i(a){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=a,window.dispatchEvent(c),!c.defaultPrevented)throw a}return n.then(a=>{for(const c of a||[])c.status==="rejected"&&i(c.reason);return s().catch(i)})},kt={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Nt({data:t}){const s=t.status,r=t.nodeWidth,o=t.label??"Start",n=t.hasBreakpoint,i=t.isPausedHere,a=t.isActiveNode,c=t.isExecutingNode,m=i?"var(--error)":c?"var(--success)":a?"var(--accent)":s==="completed"?"var(--success)":s==="running"?"var(--warning)":"var(--node-border)",d=i?"var(--error)":c?"var(--success)":"var(--accent)";return e.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:r,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${m}`,boxShadow:i||a||c?`0 0 4px ${d}`:void 0,animation:i||a||c?`node-pulse-${i?"red":c?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:o,children:[n&&e.jsx("div",{className:"absolute",style:{top:2,left:2,width:12,height:12,borderRadius:"50%",background:"var(--error)",border:"2px solid var(--node-bg)",boxShadow:"0 0 4px var(--error)"}}),o,e.jsx(Y,{type:"source",position:X.Bottom,style:kt})]})}const St={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Et({data:t}){const s=t.status,r=t.nodeWidth,o=t.label??"End",n=t.hasBreakpoint,i=t.isPausedHere,a=t.isActiveNode,c=t.isExecutingNode,m=i?"var(--error)":c?"var(--success)":a?"var(--accent)":s==="completed"?"var(--success)":s==="failed"?"var(--error)":"var(--node-border)",d=i?"var(--error)":c?"var(--success)":"var(--accent)";return e.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:r,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${m}`,boxShadow:i||a||c?`0 0 4px ${d}`:void 0,animation:i||a||c?`node-pulse-${i?"red":c?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:o,children:[n&&e.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)"}}),e.jsx(Y,{type:"target",position:X.Top,style:St}),o]})}const fe={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Ct({data:t}){const s=t.status,r=t.nodeWidth,o=t.model_name,n=t.label??"Model",i=t.hasBreakpoint,a=t.isPausedHere,c=t.isActiveNode,m=t.isExecutingNode,d=a?"var(--error)":m?"var(--success)":c?"var(--accent)":s==="completed"?"var(--success)":s==="running"?"var(--warning)":s==="failed"?"var(--error)":"var(--node-border)",l=a?"var(--error)":m?"var(--success)":"var(--accent)";return e.jsxs("div",{className:"px-3 py-1.5 rounded-lg text-center text-xs overflow-hidden cursor-pointer relative",style:{width:r,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${d}`,boxShadow:a||c||m?`0 0 4px ${l}`:void 0,animation:a||c||m?`node-pulse-${a?"red":m?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:o?`${n} +${o}`:n,children:[i&&e.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)"}}),e.jsx(Y,{type:"target",position:X.Top,style:fe}),e.jsx("div",{style:{color:"var(--info)",fontSize:9,marginBottom:1},children:"model"}),e.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:n}),o&&e.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",style:{color:"var(--text-muted)",fontSize:9,marginTop:1},title:o,children:o}),e.jsx(Y,{type:"source",position:X.Bottom,style:fe})]})}const ve={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0},_t=3;function Lt({data:t}){const s=t.status,r=t.nodeWidth,o=t.tool_names,n=t.tool_count,i=t.label??"Tool",a=t.hasBreakpoint,c=t.isPausedHere,m=t.isActiveNode,d=t.isExecutingNode,l=c?"var(--error)":d?"var(--success)":m?"var(--accent)":s==="completed"?"var(--success)":s==="running"?"var(--warning)":s==="failed"?"var(--error)":"var(--node-border)",x=c?"var(--error)":d?"var(--success)":"var(--accent)",j=(o==null?void 0:o.slice(0,_t))??[],y=(n??(o==null?void 0:o.length)??0)-j.length;return e.jsxs("div",{className:"px-3 py-1.5 rounded-lg text-center text-xs overflow-hidden cursor-pointer relative",style:{width:r,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${l}`,boxShadow:c||m||d?`0 0 4px ${x}`:void 0,animation:c||m||d?`node-pulse-${c?"red":d?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:o!=null&&o.length?`${i} + +${o.join(` +`)}`:i,children:[a&&e.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)"}}),e.jsx(Y,{type:"target",position:X.Top,style:ve}),e.jsxs("div",{style:{color:"var(--warning)",fontSize:9,marginBottom:1},children:["tools",n?` (${n})`:""]}),e.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:i}),j.length>0&&e.jsxs("div",{style:{marginTop:3,fontSize:9,color:"var(--text-muted)",textAlign:"left"},children:[j.map(E=>e.jsx("div",{className:"truncate",children:E},E)),y>0&&e.jsxs("div",{style:{fontStyle:"italic"},children:["+",y," more"]})]}),e.jsx(Y,{type:"source",position:X.Bottom,style:ve})]})}const ye={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Tt({data:t}){const s=t.label??"",r=t.status,o=t.hasBreakpoint,n=t.isPausedHere,i=t.isActiveNode,a=t.isExecutingNode,c=n?"var(--error)":a?"var(--success)":i?"var(--accent)":r==="completed"?"var(--success)":r==="running"?"var(--warning)":r==="failed"?"var(--error)":"var(--bg-tertiary)",m=n?"var(--error)":a?"var(--success)":"var(--accent)";return e.jsxs("div",{className:"relative cursor-pointer",style:{width:"100%",height:"100%",background:"var(--bg-secondary)",border:`1.5px ${n||i||a?"solid":"dashed"} ${c}`,borderRadius:8,boxShadow:n||i||a?`0 0 4px ${m}`:void 0,animation:n||i||a?`node-pulse-${n?"red":a?"green":"accent"} 1.5s ease-in-out infinite`:void 0},children:[o&&e.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}}),e.jsx(Y,{type:"target",position:X.Top,style:ye}),e.jsx("div",{style:{padding:"4px 10px",fontSize:10,color:"var(--text-muted)",fontWeight:600,textAlign:"center",borderBottom:`1px solid ${c}`,background:"var(--bg-tertiary)",borderRadius:"8px 8px 0 0"},children:s}),e.jsx(Y,{type:"source",position:X.Bottom,style:ye})]})}function Mt({data:t}){const s=t.status,r=t.nodeWidth,o=t.label??"",n=t.hasBreakpoint,i=t.isPausedHere,a=t.isActiveNode,c=t.isExecutingNode,m=i?"var(--error)":c?"var(--success)":a?"var(--accent)":s==="completed"?"var(--success)":s==="running"?"var(--warning)":s==="failed"?"var(--error)":"var(--node-border)",d=i?"var(--error)":c?"var(--success)":"var(--accent)";return e.jsxs("div",{className:"px-3 py-1.5 rounded-lg text-center text-xs overflow-hidden cursor-pointer relative",style:{width:r,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${m}`,boxShadow:i||a||c?`0 0 4px ${d}`:void 0,animation:i||a||c?`node-pulse-${i?"red":c?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:o,children:[n&&e.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)"}}),e.jsx(Y,{type:"target",position:X.Top}),e.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:o}),e.jsx(Y,{type:"source",position:X.Bottom})]})}function Rt(t,s=8){if(t.length<2)return"";if(t.length===2)return`M ${t[0].x} ${t[0].y} L ${t[1].x} ${t[1].y}`;let r=`M ${t[0].x} ${t[0].y}`;for(let n=1;n0&&(r+=Math.min(o.length,3)*12+(o.length>3?12:0)+4),t!=null&&t.model_name&&(r+=14),r}let ie=null;async function At(){if(!ie){const{default:t}=await He(async()=>{const{default:s}=await import("./vendor-elk-CTNP4r_q.js").then(r=>r.e);return{default:s}},__vite__mapDeps([0,1]));ie=new t}return ie}const we={"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"},Bt="[top=35,left=15,bottom=15,right=15]";function Dt(t){const s=[],r=[];for(const o of t.nodes){const n=o.data,i={id:o.id,width:be(n),height:je(n,o.type)};if(o.data.subgraph){const a=o.data.subgraph;delete i.width,delete i.height,i.layoutOptions={...we,"elk.padding":Bt},i.children=a.nodes.map(c=>({id:`${o.id}/${c.id}`,width:be(c.data),height:je(c.data,c.type)})),i.edges=a.edges.map(c=>({id:`${o.id}/${c.id}`,sources:[`${o.id}/${c.source}`],targets:[`${o.id}/${c.target}`]}))}s.push(i)}for(const o of t.edges)r.push({id:o.id,sources:[o.source],targets:[o.target]});return{id:"root",layoutOptions:we,children:s,edges:r}}const le={type:Je.ArrowClosed,width:12,height:12,color:"var(--node-border)"};function Ae(t){return{stroke:"var(--node-border)",strokeWidth:1.5,...t?{strokeDasharray:"6 3"}:{}}}function ke(t,s,r,o,n){var d;const i=(d=t.sections)==null?void 0:d[0],a=(n==null?void 0:n.x)??0,c=(n==null?void 0:n.y)??0;let m;if(i)m={sourcePoint:{x:i.startPoint.x+a,y:i.startPoint.y+c},targetPoint:{x:i.endPoint.x+a,y:i.endPoint.y+c},bendPoints:(i.bendPoints??[]).map(l=>({x:l.x+a,y:l.y+c}))};else{const l=s.get(t.sources[0]),x=s.get(t.targets[0]);l&&x&&(m={sourcePoint:{x:l.x+l.width/2,y:l.y+l.height},targetPoint:{x:x.x+x.width/2,y:x.y},bendPoints:[]})}return{id:t.id,source:t.sources[0],target:t.targets[0],type:"elk",data:m,style:Ae(o),markerEnd:le,...r?{label:r,labelStyle:{fill:"var(--text-muted)",fontSize:10},labelBgStyle:{fill:"var(--bg-primary)",fillOpacity:.8}}:{}}}async function zt(t){var m,d;const s=Dt(t),o=await(await At()).layout(s),n=new Map;for(const l of t.nodes)if(n.set(l.id,{type:l.type,data:l.data}),l.data.subgraph)for(const x of l.data.subgraph.nodes)n.set(`${l.id}/${x.id}`,{type:x.type,data:x.data});const i=[],a=[],c=new Map;for(const l of o.children??[]){const x=l.x??0,j=l.y??0;c.set(l.id,{x,y:j,width:l.width??0,height:l.height??0});for(const y of l.children??[])c.set(y.id,{x:x+(y.x??0),y:j+(y.y??0),width:y.width??0,height:y.height??0})}for(const l of o.children??[]){const x=n.get(l.id);if((((m=l.children)==null?void 0:m.length)??0)>0){i.push({id:l.id,type:"groupNode",data:{...(x==null?void 0:x.data)??{},nodeWidth:l.width,nodeHeight:l.height},position:{x:l.x??0,y:l.y??0},style:{width:l.width,height:l.height}});for(const k of l.children??[]){const w=n.get(k.id);i.push({id:k.id,type:(w==null?void 0:w.type)??"defaultNode",data:{...(w==null?void 0:w.data)??{},nodeWidth:k.width},position:{x:k.x??0,y:k.y??0},parentNode:l.id,extent:"parent"})}const y=l.x??0,E=l.y??0;for(const k of l.edges??[]){const w=t.nodes.find(B=>B.id===l.id),$=(d=w==null?void 0:w.data.subgraph)==null?void 0:d.edges.find(B=>`${l.id}/${B.id}`===k.id);a.push(ke(k,c,$==null?void 0:$.label,$==null?void 0:$.conditional,{x:y,y:E}))}}else i.push({id:l.id,type:(x==null?void 0:x.type)??"defaultNode",data:{...(x==null?void 0:x.data)??{},nodeWidth:l.width},position:{x:l.x??0,y:l.y??0}})}for(const l of o.edges??[]){const x=t.edges.find(j=>j.id===l.id);a.push(ke(l,c,x==null?void 0:x.label,x==null?void 0:x.conditional))}return{nodes:i,edges:a}}function ne({entrypoint:t,runId:s,breakpointNode:r,breakpointNextNodes:o,onBreakpointChange:n,fitViewTrigger:i}){const[a,c,m]=Ge([]),[d,l,x]=qe([]),[j,y]=h.useState(!0),[E,k]=h.useState(!1),[w,$]=h.useState(0),B=h.useRef(0),J=h.useRef(null),F=W(u=>u.breakpoints[s]),N=W(u=>u.toggleBreakpoint),L=W(u=>u.clearBreakpoints),I=W(u=>u.activeNodes[s]),D=W(u=>{var p;return(p=u.runs[s])==null?void 0:p.status}),G=h.useCallback((u,p)=>{if(p.type==="startNode"||p.type==="endNode")return;const b=p.type==="groupNode"?p.id:p.id.includes("/")?p.id.split("/").pop():p.id;N(s,b);const T=W.getState().breakpoints[s]??{};n==null||n(Object.keys(T))},[s,N,n]),z=F&&Object.keys(F).length>0,q=h.useCallback(()=>{if(z)L(s),n==null||n([]);else{const u=[];for(const b of a){if(b.type==="startNode"||b.type==="endNode"||b.parentNode)continue;const T=b.type==="groupNode"?b.id:b.id.includes("/")?b.id.split("/").pop():b.id;u.push(T)}for(const b of u)F!=null&&F[b]||N(s,b);const p=W.getState().breakpoints[s]??{};n==null||n(Object.keys(p))}},[s,z,F,a,L,N,n]);h.useEffect(()=>{c(u=>u.map(p=>{var g;if(p.type==="startNode"||p.type==="endNode")return p;const b=p.type==="groupNode"?p.id:p.id.includes("/")?p.id.split("/").pop():p.id,T=!!(F&&F[b]);return T!==!!((g=p.data)!=null&&g.hasBreakpoint)?{...p,data:{...p.data,hasBreakpoint:T}}:p}))},[F,c]),h.useEffect(()=>{const u=r?new Set(r.split(",").map(p=>p.trim()).filter(Boolean)):null;c(p=>p.map(b=>{var H,f;if(b.type==="startNode"||b.type==="endNode")return b;const T=b.type==="groupNode"?b.id:b.id.includes("/")?b.id.split("/").pop():b.id,g=(H=b.data)==null?void 0:H.label,S=u!=null&&(u.has(T)||g!=null&&u.has(g));return S!==!!((f=b.data)!=null&&f.isPausedHere)?{...b,data:{...b.data,isPausedHere:S}}:b}))},[r,w,c]);const R=W(u=>u.stateEvents[s]);h.useEffect(()=>{const u=!!r;let p=new Set;const b=new Set,T=new Set,g=new Set,S=new Map,H=new Map;if(R)for(const f of R)f.phase==="started"?H.set(f.node_name,f.qualified_node_name??null):f.phase==="completed"&&H.delete(f.node_name);c(f=>{var C;for(const A of f)A.type&&S.set(A.id,A.type);const _=A=>{var v;const O=[];for(const M of f){const V=M.type==="groupNode"?M.id:M.id.includes("/")?M.id.split("/").pop():M.id,U=(v=M.data)==null?void 0:v.label;(V===A||U!=null&&U===A)&&O.push(M.id)}return O};if(u&&r){const A=r.split(",").map(O=>O.trim()).filter(Boolean);for(const O of A)_(O).forEach(v=>p.add(v));if(o!=null&&o.length)for(const O of o)_(O).forEach(v=>T.add(v));I!=null&&I.prev&&_(I.prev).forEach(O=>b.add(O))}else if(H.size>0){const A=new Map;for(const O of f){const v=(C=O.data)==null?void 0:C.label;if(!v)continue;const M=O.id.includes("/")?O.id.split("/").pop():O.id;for(const V of[M,v]){let U=A.get(V);U||(U=new Set,A.set(V,U)),U.add(O.id)}}for(const[O,v]of H){let M=!1;if(v){const V=v.replace(/:/g,"/");for(const U of f)U.id===V&&(p.add(U.id),M=!0)}if(!M){const V=A.get(O);V&&V.forEach(U=>p.add(U))}}}return f}),l(f=>{const _=b.size===0||f.some(C=>p.has(C.target)&&b.has(C.source));return f.map(C=>{var O,v;let A;return u?A=p.has(C.target)&&(b.size===0||!_||b.has(C.source))||p.has(C.source)&&T.has(C.target):(A=p.has(C.source),!A&&S.get(C.target)==="endNode"&&p.has(C.target)&&(A=!0)),A?(u||g.add(C.target),{...C,style:{stroke:"var(--accent)",strokeWidth:2.5},markerEnd:{...le,color:"var(--accent)"},data:{...C.data,highlighted:!0},animated:!0}):(O=C.data)!=null&&O.highlighted?{...C,style:Ae((v=C.data)==null?void 0:v.conditional),markerEnd:le,data:{...C.data,highlighted:!1},animated:!1}:C})}),c(f=>f.map(_=>{var O,v,M,V;const C=!u&&p.has(_.id);if(_.type==="startNode"||_.type==="endNode"){const U=g.has(_.id)||!u&&p.has(_.id);return U!==!!((O=_.data)!=null&&O.isActiveNode)||C!==!!((v=_.data)!=null&&v.isExecutingNode)?{..._,data:{..._.data,isActiveNode:U,isExecutingNode:C}}:_}const A=u?T.has(_.id):g.has(_.id);return A!==!!((M=_.data)!=null&&M.isActiveNode)||C!==!!((V=_.data)!=null&&V.isExecutingNode)?{..._,data:{..._.data,isActiveNode:A,isExecutingNode:C}}:_}))},[R,I,r,o,D,w,c,l]);const P=W(u=>u.graphCache[s]);return h.useEffect(()=>{if(!P&&s!=="__setup__")return;const u=P?Promise.resolve(P):ct(t),p=++B.current;y(!0),k(!1),u.then(async b=>{if(B.current!==p)return;if(!b.nodes.length){k(!0);return}const{nodes:T,edges:g}=await zt(b);if(B.current!==p)return;const S=W.getState().breakpoints[s],H=S?T.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 S[_]?{...f,data:{...f.data,hasBreakpoint:!0}}:f}):T;c(H),l(g),$(f=>f+1),setTimeout(()=>{var f;(f=J.current)==null||f.fitView({padding:.1,duration:200})},100)}).catch(()=>{B.current===p&&k(!0)}).finally(()=>{B.current===p&&y(!1)})},[t,s,P,c,l]),h.useEffect(()=>{const u=setTimeout(()=>{var p;(p=J.current)==null||p.fitView({padding:.1,duration:200})},100);return()=>clearTimeout(u)},[s]),h.useEffect(()=>{var u;i&&((u=J.current)==null||u.fitView({padding:.1,duration:200}))},[i]),h.useEffect(()=>{c(u=>{var C,A,O;const p=!!(R!=null&&R.length),b=D==="completed"||D==="failed",T=new Set,g=new Set(u.map(v=>v.id)),S=new Map;for(const v of u){const M=(C=v.data)==null?void 0:C.label;if(!M)continue;const V=v.id.includes("/")?v.id.split("/").pop():v.id;for(const U of[V,M]){let se=S.get(U);se||(se=new Set,S.set(U,se)),se.add(v.id)}}if(p)for(const v of R){let M=!1;if(v.qualified_node_name){const V=v.qualified_node_name.replace(/:/g,"/");g.has(V)&&(T.add(V),M=!0)}if(!M){const V=S.get(v.node_name);V&&V.forEach(U=>T.add(U))}}const H=new Set;for(const v of u)v.parentNode&&T.has(v.id)&&H.add(v.parentNode);let f;D==="failed"&&T.size===0&&(f=(A=u.find(v=>!v.parentNode&&v.type!=="startNode"&&v.type!=="endNode"&&v.type!=="groupNode"))==null?void 0:A.id);let _;if(D==="completed"){const v=(O=u.find(M=>!M.parentNode&&M.type!=="startNode"&&M.type!=="endNode"&&M.type!=="groupNode"))==null?void 0:O.id;v&&!T.has(v)&&(_=v)}return u.map(v=>{var V;let M;return v.id===f?M="failed":v.id===_||T.has(v.id)?M="completed":v.type==="startNode"?(!v.parentNode&&p||v.parentNode&&H.has(v.parentNode))&&(M="completed"):v.type==="endNode"?!v.parentNode&&b?M=D==="failed"?"failed":"completed":v.parentNode&&H.has(v.parentNode)&&(M="completed"):v.type==="groupNode"&&H.has(v.id)&&(M="completed"),M!==((V=v.data)==null?void 0:V.status)?{...v,data:{...v.data,status:M}}:v})})},[R,D,w,c]),j?e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:"Loading graph..."}):E?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",style:{color:"var(--text-muted)"},children:[e.jsxs("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("rect",{x:"38",y:"10",width:"44",height:"24",rx:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.4"}),e.jsx("line",{x1:"60",y1:"34",x2:"60",y2:"46",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),e.jsx("rect",{x:"12",y:"46",width:"44",height:"24",rx:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),e.jsx("rect",{x:"64",y:"46",width:"44",height:"24",rx:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),e.jsx("line",{x1:"60",y1:"46",x2:"34",y2:"46",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),e.jsx("line",{x1:"60",y1:"46",x2:"86",y2:"46",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),e.jsx("line",{x1:"34",y1:"70",x2:"34",y2:"82",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),e.jsx("line",{x1:"86",y1:"70",x2:"86",y2:"82",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),e.jsx("line",{x1:"34",y1:"82",x2:"60",y2:"82",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),e.jsx("line",{x1:"86",y1:"82",x2:"60",y2:"82",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),e.jsx("line",{x1:"60",y1:"82",x2:"60",y2:"86",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.3"}),e.jsx("rect",{x:"38",y:"86",width:"44",height:"24",rx:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"4 3",opacity:"0.4"})]}),e.jsx("span",{className:"text-xs",children:"No graph schema available"})]}):e.jsxs("div",{className:"h-full graph-panel",children:[e.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); } + } + `}),e.jsxs(Ye,{nodes:a,edges:d,onNodesChange:m,onEdgesChange:x,nodeTypes:It,edgeTypes:Pt,onInit:u=>{J.current=u},onNodeClick:G,fitView:!0,proOptions:{hideAttribution:!0},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,children:[e.jsx(Xe,{color:"var(--bg-tertiary)",gap:16}),e.jsx(Ke,{showInteractive:!1}),e.jsx(Ze,{position:"top-right",children:e.jsxs("button",{onClick:q,title:z?"Remove all breakpoints":"Set breakpoints on all nodes",style:{background:"var(--bg-secondary)",color:z?"var(--error)":"var(--text-muted)",border:`1px solid ${z?"var(--error)":"var(--node-border)"}`,borderRadius:6,padding:"4px 10px",fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",gap:4},children:[e.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:z?"var(--error)":"var(--node-border)"}}),z?"Clear all":"Break all"]})}),e.jsx(Qe,{nodeColor:u=>{var b;if(u.type==="groupNode")return"var(--bg-tertiary)";const p=(b=u.data)==null?void 0:b.status;return p==="completed"?"var(--success)":p==="running"?"var(--warning)":p==="failed"?"var(--error)":"var(--node-border)"},nodeStrokeWidth:0,style:{background:"var(--bg-secondary)",width:120,height:80}})]})]})}const ee="__setup__";function Vt({entrypoint:t,mode:s,ws:r,onRunCreated:o,isMobile:n}){const[i,a]=h.useState("{}"),[c,m]=h.useState({}),[d,l]=h.useState(!1),[x,j]=h.useState(!0),[y,E]=h.useState(null),[k,w]=h.useState(""),[$,B]=h.useState(0),[J,F]=h.useState(!0),[N,L]=h.useState(()=>{const g=localStorage.getItem("setupTextareaHeight");return g?parseInt(g,10):140}),I=h.useRef(null),[D,G]=h.useState(()=>{const g=localStorage.getItem("setupPanelWidth");return g?parseInt(g,10):380}),z=s==="run";h.useEffect(()=>{j(!0),E(null),it(t).then(g=>{m(g.mock_input),a(JSON.stringify(g.mock_input,null,2))}).catch(g=>{console.error("Failed to load mock input:",g);const S=g.detail||{};E(S.message||`Failed to load schema for "${t}"`),a("{}")}).finally(()=>j(!1))},[t]),h.useEffect(()=>{W.getState().clearBreakpoints(ee)},[]);const q=async()=>{let g;try{g=JSON.parse(i)}catch{alert("Invalid JSON input");return}l(!0);try{const S=W.getState().breakpoints[ee]??{},H=Object.keys(S),f=await pe(t,g,s,H);W.getState().clearBreakpoints(ee),W.getState().upsertRun(f),o(f.id)}catch(S){console.error("Failed to create run:",S)}finally{l(!1)}},R=async()=>{const g=k.trim();if(g){l(!0);try{const S=W.getState().breakpoints[ee]??{},H=Object.keys(S),f=await pe(t,c,"chat",H);W.getState().clearBreakpoints(ee),W.getState().upsertRun(f),W.getState().addLocalChatMessage(f.id,{message_id:`local-${Date.now()}`,role:"user",content:g}),r.sendChatMessage(f.id,g),o(f.id)}catch(S){console.error("Failed to create chat run:",S)}finally{l(!1)}}};h.useEffect(()=>{try{JSON.parse(i),F(!0)}catch{F(!1)}},[i]);const P=h.useCallback(g=>{g.preventDefault();const S="touches"in g?g.touches[0].clientY:g.clientY,H=N,f=C=>{const A="touches"in C?C.touches[0].clientY:C.clientY,O=Math.max(60,H+(S-A));L(O)},_=()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",_),document.removeEventListener("touchmove",f),document.removeEventListener("touchend",_),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("setupTextareaHeight",String(N))};document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",f),document.addEventListener("mouseup",_),document.addEventListener("touchmove",f,{passive:!1}),document.addEventListener("touchend",_)},[N]),u=h.useCallback(g=>{g.preventDefault();const S="touches"in g?g.touches[0].clientX:g.clientX,H=D,f=C=>{const A=I.current;if(!A)return;const O="touches"in C?C.touches[0].clientX:C.clientX,v=A.clientWidth-300,M=Math.max(280,Math.min(v,H+(S-O)));G(M)},_=()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",_),document.removeEventListener("touchmove",f),document.removeEventListener("touchend",_),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("setupPanelWidth",String(D)),B(C=>C+1)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",f),document.addEventListener("mouseup",_),document.addEventListener("touchmove",f,{passive:!1}),document.addEventListener("touchend",_)},[D]),p=z?"Autonomous":"Conversational",b=z?"var(--success)":"var(--accent)",T=e.jsxs("div",{className:"shrink-0 flex flex-col",style:n?{background:"var(--bg-primary)"}:{width:D,background:"var(--bg-primary)"},children:[e.jsxs("div",{className:"px-4 text-xs font-semibold uppercase tracking-wider border-b flex items-center gap-2 h-[33px]",style:{color:"var(--text-muted)",borderColor:"var(--border)",background:"var(--bg-secondary)"},children:[e.jsx("span",{style:{color:b},children:"●"}),p]}),e.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col items-center justify-center gap-4 px-6",children:[e.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:z?e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}):e.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"})}),e.jsxs("div",{className:"text-center space-y-1.5",children:[e.jsx("p",{className:"text-sm font-medium",style:{color:"var(--text-secondary)"},children:z?"Ready to execute":"Ready to chat"}),e.jsxs("p",{className:"text-xs leading-relaxed",style:{color:"var(--text-muted)"},children:["Click nodes to set breakpoints",z?e.jsxs(e.Fragment,{children:[",",e.jsx("br",{}),"configure input below, then run"]}):e.jsxs(e.Fragment,{children:[",",e.jsx("br",{}),"then send your first message"]})]})]})]}),z?e.jsxs("div",{className:"flex flex-col",style:{background:"var(--bg-primary)"},children:[!n&&e.jsx("div",{onMouseDown:P,onTouchStart:P,className:"shrink-0 h-1.5 cursor-row-resize bg-[var(--border)] hover:bg-[var(--accent)] transition-colors"}),e.jsxs("div",{className:"px-4 py-3",children:[y?e.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:y}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"block text-[10px] uppercase tracking-wider font-semibold mb-2",style:{color:"var(--text-muted)"},children:["Input",x&&e.jsx("span",{className:"ml-2 font-normal",children:"Loading..."})]}),e.jsx("textarea",{value:i,onChange:g=>a(g.target.value),spellCheck:!1,className:"w-full rounded-md px-3 py-2 text-xs font-mono leading-relaxed resize-none focus:outline-none mb-3",style:{height:n?120:N,background:"var(--bg-secondary)",border:`1px solid ${J?"var(--border)":"#b91c1c"}`,color:"var(--text-primary)"}})]}),e.jsx("button",{onClick:q,disabled:d||x||!!y,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:b,color:b},onMouseEnter:g=>{d||(g.currentTarget.style.background=`color-mix(in srgb, ${b} 10%, transparent)`)},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:d?"Starting...":e.jsxs(e.Fragment,{children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",children:e.jsx("polygon",{points:"5,3 19,12 5,21"})}),"Execute"]})})]})]}):e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-t",style:{borderColor:"var(--border)"},children:[e.jsx("input",{value:k,onChange:g=>w(g.target.value),onKeyDown:g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),R())},disabled:d||x,placeholder:d?"Starting...":"Message...",className:"flex-1 bg-transparent text-sm py-1 focus:outline-none disabled:opacity-40 placeholder:text-[var(--text-muted)]",style:{color:"var(--text-primary)"}}),e.jsx("button",{onClick:R,disabled:d||x||!k.trim(),className:"text-[11px] uppercase tracking-wider font-semibold px-2 py-1 rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed",style:{color:!d&&k.trim()?"var(--accent)":"var(--text-muted)",background:"transparent"},onMouseEnter:g=>{!d&&k.trim()&&(g.currentTarget.style.background="color-mix(in srgb, var(--accent) 10%, transparent)")},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:"Send"})]})]});return n?e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"shrink-0",style:{height:"40vh"},children:e.jsx(ne,{entrypoint:t,traces:[],runId:ee,fitViewTrigger:$})}),e.jsx("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:T})]}):e.jsxs("div",{ref:I,className:"flex h-full",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(ne,{entrypoint:t,traces:[],runId:ee,fitViewTrigger:$})}),e.jsx("div",{onMouseDown:u,onTouchStart:u,className:"shrink-0 w-1.5 cursor-col-resize bg-[var(--border)] hover:bg-[var(--accent)] transition-colors relative",children:e.jsx("div",{className:"absolute inset-0 -left-1 -right-1"})}),T]})}const Ft={key:"var(--info)",string:"var(--success)",number:"var(--warning)",boolean:"var(--accent)",null:"var(--accent)",punctuation:"var(--text-muted)"};function Ut(t){const s=[],r=/("(?:[^"\\]|\\.)*")\s*:|("(?:[^"\\]|\\.)*")|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)\b|(true|false)\b|(null)\b|([{}[\]:,])/g;let o=0,n;for(;(n=r.exec(t))!==null;){if(n.index>o&&s.push({type:"punctuation",text:t.slice(o,n.index)}),n[1]!==void 0){s.push({type:"key",text:n[1]});const i=t.indexOf(":",n.index+n[1].length);i!==-1&&(i>n.index+n[1].length&&s.push({type:"punctuation",text:t.slice(n.index+n[1].length,i)}),s.push({type:"punctuation",text:":"}),r.lastIndex=i+1)}else n[2]!==void 0?s.push({type:"string",text:n[2]}):n[3]!==void 0?s.push({type:"number",text:n[3]}):n[4]!==void 0?s.push({type:"boolean",text:n[4]}):n[5]!==void 0?s.push({type:"null",text:n[5]}):n[6]!==void 0&&s.push({type:"punctuation",text:n[6]});o=r.lastIndex}return oUt(t),[t]);return e.jsx("pre",{className:s,style:r,children:o.map((n,i)=>e.jsx("span",{style:{color:Ft[n.type]},children:n.text},i))})}const Jt={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"}},Gt={color:"var(--text-muted)",label:"Unknown"};function qt(t){if(typeof t!="string")return null;const s=t.trim();if(s.startsWith("{")&&s.endsWith("}")||s.startsWith("[")&&s.endsWith("]"))try{return JSON.stringify(JSON.parse(s),null,2)}catch{return null}return null}function Yt(t){if(t<1)return`${(t*1e3).toFixed(0)}us`;if(t<1e3)return`${t.toFixed(2)}ms`;if(t<6e4)return`${(t/1e3).toFixed(2)}s`;const s=Math.floor(t/6e4),r=(t%6e4/1e3).toFixed(1);return`${s}m ${r}s`}const Ne=200;function Xt(t){if(typeof t=="string")return t;if(t==null)return String(t);try{return JSON.stringify(t,null,2)}catch{return String(t)}}function Kt({value:t}){const[s,r]=h.useState(!1),o=Xt(t),n=h.useMemo(()=>qt(t),[t]),i=n!==null,a=n??o,c=a.length>Ne||a.includes(` +`),m=h.useCallback(()=>r(d=>!d),[]);return c?e.jsxs("div",{children:[s?i?e.jsx(te,{json:a,className:"font-mono text-[11px] whitespace-pre-wrap break-all",style:{}}):e.jsx("pre",{className:"font-mono text-[11px] whitespace-pre-wrap break-all",style:{color:"var(--text-primary)"},children:a}):e.jsxs("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:[a.slice(0,Ne),"..."]}),e.jsx("button",{onClick:m,className:"text-[10px] cursor-pointer ml-1",style:{color:"var(--info)"},children:s?"[less]":"[more]"})]}):i?e.jsx(te,{json:a,className:"font-mono text-[11px] break-all whitespace-pre-wrap",style:{}}):e.jsx("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:a})}function Zt({span:t}){const[s,r]=h.useState(!0),[o,n]=h.useState(!1),i=Jt[t.status.toLowerCase()]??{...Gt,label:t.status},a=new Date(t.timestamp).toLocaleTimeString(void 0,{hour12:!1,fractionalSecondDigits:3}),c=Object.entries(t.attributes),m=[{label:"Span",value:t.span_id},...t.trace_id?[{label:"Trace",value:t.trace_id}]:[],{label:"Run",value:t.run_id},...t.parent_span_id?[{label:"Parent",value:t.parent_span_id}]:[]];return e.jsxs("div",{className:"overflow-y-auto h-full text-xs leading-normal",children:[e.jsxs("div",{className:"px-2 py-1.5 border-b flex items-center gap-2 flex-wrap",style:{borderColor:"var(--border)",background:"var(--bg-secondary)"},children:[e.jsx("span",{className:"text-xs font-semibold mr-auto",style:{color:"var(--text-primary)"},children:t.span_name}),e.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",style:{background:`color-mix(in srgb, ${i.color} 15%, var(--bg-secondary))`,color:i.color},children:[e.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:i.color}}),i.label]}),t.duration_ms!=null&&e.jsx("span",{className:"shrink-0 font-mono text-[11px] font-semibold",style:{color:"var(--warning)"},children:Yt(t.duration_ms)}),e.jsx("span",{className:"shrink-0 font-mono text-[11px]",style:{color:"var(--text-muted)"},children:a})]}),c.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-2 py-1 text-[10px] uppercase font-bold tracking-wider border-b cursor-pointer flex items-center",style:{color:"var(--accent)",borderColor:"var(--border)",background:"var(--bg-secondary)"},onClick:()=>r(d=>!d),children:[e.jsxs("span",{className:"flex-1",children:["Attributes (",c.length,")"]}),e.jsx("span",{style:{color:"var(--text-muted)",transform:s?"rotate(0deg)":"rotate(-90deg)"},children:"▾"})]}),s&&c.map(([d,l],x)=>e.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:[e.jsx("span",{className:"font-mono font-semibold shrink-0 pt-px truncate text-[11px]",style:{color:"var(--info)",width:"35%"},title:d,children:d}),e.jsx("span",{className:"flex-1 min-w-0",children:e.jsx(Kt,{value:l})})]},d))]}),e.jsxs("div",{className:"px-2 py-1 text-[10px] uppercase font-bold tracking-wider border-b cursor-pointer flex items-center",style:{color:"var(--accent)",borderColor:"var(--border)",background:"var(--bg-secondary)"},onClick:()=>n(d=>!d),children:[e.jsxs("span",{className:"flex-1",children:["Identifiers (",m.length,")"]}),e.jsx("span",{style:{color:"var(--text-muted)",transform:o?"rotate(0deg)":"rotate(-90deg)"},children:"▾"})]}),o&&m.map((d,l)=>e.jsxs("div",{className:"flex gap-2 px-2 py-1 items-start border-b",style:{borderColor:"var(--border)",background:l%2===0?"var(--bg-primary)":"var(--bg-secondary)"},children:[e.jsx("span",{className:"font-mono font-semibold shrink-0 pt-px truncate text-[11px]",style:{color:"var(--info)",width:"35%"},title:d.label,children:d.label}),e.jsx("span",{className:"flex-1 min-w-0",children:e.jsx("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:d.value})})]},d.label))]})}const Qt={started:"var(--info)",running:"var(--warning)",completed:"var(--success)",failed:"var(--error)",error:"var(--error)"};function es({kind:t,statusColor:s}){const r=s,o=14,n={width:o,height:o,viewBox:"0 0 16 16",fill:"none",stroke:r,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"};switch(t){case"LLM":return e.jsx("svg",{...n,children:e.jsx("path",{d:"M8 2L9 5L12 4L10 7L14 8L10 9L12 12L9 11L8 14L7 11L4 12L6 9L2 8L6 7L4 4L7 5Z",fill:r,stroke:"none"})});case"TOOL":return e.jsx("svg",{...n,children:e.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 e.jsxs("svg",{...n,children:[e.jsx("rect",{x:"3",y:"5",width:"10",height:"8",rx:"2"}),e.jsx("circle",{cx:"6",cy:"9",r:"1",fill:r,stroke:"none"}),e.jsx("circle",{cx:"10",cy:"9",r:"1",fill:r,stroke:"none"}),e.jsx("path",{d:"M8 2v3"}),e.jsx("path",{d:"M6 2h4"})]});case"CHAIN":return e.jsxs("svg",{...n,children:[e.jsx("path",{d:"M6.5 9.5L9.5 6.5"}),e.jsx("path",{d:"M4.5 8.5l-1 1a2 2 0 0 0 2.83 2.83l1-1"}),e.jsx("path",{d:"M11.5 7.5l1-1a2 2 0 0 0-2.83-2.83l-1 1"})]});case"RETRIEVER":return e.jsxs("svg",{...n,children:[e.jsx("circle",{cx:"7",cy:"7",r:"4"}),e.jsx("path",{d:"M10 10l3.5 3.5"})]});case"EMBEDDING":return e.jsxs("svg",{...n,children:[e.jsx("rect",{x:"2",y:"2",width:"4",height:"4",rx:"0.5"}),e.jsx("rect",{x:"10",y:"2",width:"4",height:"4",rx:"0.5"}),e.jsx("rect",{x:"2",y:"10",width:"4",height:"4",rx:"0.5"}),e.jsx("rect",{x:"10",y:"10",width:"4",height:"4",rx:"0.5"})]});default:return e.jsx("span",{className:"shrink-0 w-2 h-2 rounded-full",style:{background:s}})}}function ts(t){const s=new Map(t.map(a=>[a.span_id,a])),r=new Map;for(const a of t)if(a.parent_span_id){const c=r.get(a.parent_span_id)??[];c.push(a),r.set(a.parent_span_id,c)}const o=t.filter(a=>a.parent_span_id===null||!s.has(a.parent_span_id));function n(a){const c=(r.get(a.span_id)??[]).sort((m,d)=>m.timestamp.localeCompare(d.timestamp));return{span:a,children:c.map(n)}}return o.sort((a,c)=>a.timestamp.localeCompare(c.timestamp)).map(n).flatMap(a=>a.span.span_name==="root"?a.children:[a])}function ss(t){return t==null?"":t<1e3?`${t.toFixed(0)}ms`:`${(t/1e3).toFixed(2)}s`}function Be(t){return t.map(s=>{const{span:r}=s;return s.children.length>0?{name:r.span_name,children:Be(s.children)}:{name:r.span_name}})}function Se({traces:t}){const[s,r]=h.useState(null),[o,n]=h.useState(new Set),[i,a]=h.useState(()=>{const N=localStorage.getItem("traceTreeSplitWidth");return N?parseFloat(N):50}),[c,m]=h.useState(!1),[d,l]=h.useState(!1),x=ts(t),j=h.useMemo(()=>JSON.stringify(Be(x),null,2),[t]),y=h.useCallback(()=>{navigator.clipboard.writeText(j).then(()=>{l(!0),setTimeout(()=>l(!1),1500)})},[j]),E=W(N=>N.focusedSpan),k=W(N=>N.setFocusedSpan),[w,$]=h.useState(null),B=h.useRef(null),J=h.useCallback(N=>{n(L=>{const I=new Set(L);return I.has(N)?I.delete(N):I.add(N),I})},[]);h.useEffect(()=>{if(s===null)x.length>0&&r(x[0].span);else{const N=t.find(L=>L.span_id===s.span_id);N&&N!==s&&r(N)}},[t]),h.useEffect(()=>{if(!E)return;const L=t.filter(I=>I.span_name===E.name).sort((I,D)=>I.timestamp.localeCompare(D.timestamp))[E.index];if(L){r(L),$(L.span_id);const I=new Map(t.map(D=>[D.span_id,D.parent_span_id]));n(D=>{const G=new Set(D);let z=L.parent_span_id;for(;z;)G.delete(z),z=I.get(z)??null;return G})}k(null)},[E,t,k]),h.useEffect(()=>{if(!w)return;const N=w;$(null),requestAnimationFrame(()=>{const L=B.current,I=L==null?void 0:L.querySelector(`[data-span-id="${N}"]`);L&&I&&I.scrollIntoView({block:"center",behavior:"smooth"})})},[w]),h.useEffect(()=>{if(!c)return;const N=I=>{const D=document.querySelector(".trace-tree-container");if(!D)return;const G=D.getBoundingClientRect(),z=(I.clientX-G.left)/G.width*100,q=Math.max(20,Math.min(80,z));a(q),localStorage.setItem("traceTreeSplitWidth",String(q))},L=()=>{m(!1)};return window.addEventListener("mousemove",N),window.addEventListener("mouseup",L),()=>{window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",L)}},[c]);const F=N=>{N.preventDefault(),m(!0)};return e.jsxs("div",{className:"flex h-full trace-tree-container",style:{cursor:c?"col-resize":void 0},children:[e.jsxs("div",{className:"pr-0.5 pt-0.5 relative",style:{width:`${i}%`},children:[t.length>0&&e.jsx("button",{onClick:y,className:"absolute top-2 left-2 z-20 text-[10px] cursor-pointer px-1.5 py-0.5 rounded transition-opacity",style:{opacity:d?1:.3,color:d?"var(--success)":"var(--text-muted)",background:"var(--bg-secondary)",border:"1px solid var(--border)"},onMouseEnter:N=>{N.currentTarget.style.opacity="1"},onMouseLeave:N=>{d||(N.currentTarget.style.opacity="0.3")},children:d?"Copied!":"Copy JSON"}),e.jsx("div",{ref:B,className:"overflow-y-auto h-full p-0.5",children:x.length===0?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"No traces yet"})}):x.map((N,L)=>e.jsx(De,{node:N,depth:0,selectedId:(s==null?void 0:s.span_id)??null,onSelect:r,isLast:L===x.length-1,collapsedIds:o,toggleExpanded:J},N.span.span_id))})]}),e.jsx("div",{onMouseDown:F,className:"shrink-0 w-1.5 cursor-col-resize bg-[var(--border)] hover:bg-[var(--accent)] transition-colors relative",style:c?{background:"var(--accent)"}:void 0,children:e.jsx("div",{className:"absolute inset-0 -left-1 -right-1"})}),e.jsx("div",{className:"flex-1 overflow-hidden p-0.5",children:s?e.jsx(Zt,{span:s}):e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"Select a span to view details"})})})]})}function De({node:t,depth:s,selectedId:r,onSelect:o,isLast:n,collapsedIds:i,toggleExpanded:a}){var k;const{span:c}=t,m=!i.has(c.span_id),d=Qt[c.status.toLowerCase()]??"var(--text-muted)",l=ss(c.duration_ms),x=c.span_id===r,j=t.children.length>0,y=s*20,E=(k=c.attributes)==null?void 0:k["openinference.span.kind"];return e.jsxs("div",{className:"relative",children:[s>0&&e.jsx("div",{className:"absolute top-0 z-10 pointer-events-none",style:{left:`${y-10}px`,width:"1px",height:n?"16px":"100%",background:"var(--border)"}}),e.jsxs("button",{"data-span-id":c.span_id,onClick:()=>o(c),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:`${y+4}px`,background:x?"color-mix(in srgb, var(--accent) 10%, var(--bg-primary))":void 0,borderLeft:x?"2px solid var(--accent)":"2px solid transparent"},onMouseEnter:w=>{x||(w.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:w=>{x||(w.currentTarget.style.background="")},children:[s>0&&e.jsx("div",{className:"absolute z-10 pointer-events-none",style:{left:`${y-10}px`,top:"50%",width:"10px",height:"1px",background:"var(--border)"}}),j?e.jsx("span",{onClick:w=>{w.stopPropagation(),a(c.span_id)},className:"shrink-0 w-4 h-4 flex items-center justify-center cursor-pointer rounded hover:bg-[var(--bg-hover)]",style:{color:"var(--text-muted)"},children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",style:{transform:m?"rotate(90deg)":"rotate(0deg)"},children:e.jsx("path",{d:"M3 1.5L7 5L3 8.5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})}):e.jsx("span",{className:"shrink-0 w-4"}),e.jsx("span",{className:"shrink-0 flex items-center justify-center w-4 h-4",children:e.jsx(es,{kind:E,statusColor:d})}),e.jsx("span",{className:"text-[var(--text-primary)] truncate min-w-0 flex-1",children:c.span_name}),l&&e.jsx("span",{className:"text-[var(--text-muted)] shrink-0 ml-auto pl-2 tabular-nums",children:l})]}),m&&t.children.map((w,$)=>e.jsx(De,{node:w,depth:s+1,selectedId:r,onSelect:o,isLast:$===t.children.length-1,collapsedIds:i,toggleExpanded:a},w.span.span_id))]})}const rs={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)"}},os={color:"var(--text-muted)",bg:"transparent"};function Ee({logs:t}){const s=h.useRef(null),r=h.useRef(null),[o,n]=h.useState(!1);h.useEffect(()=>{var a;(a=r.current)==null||a.scrollIntoView({behavior:"smooth"})},[t.length]);const i=()=>{const a=s.current;a&&n(a.scrollTop>100)};return t.length===0?e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"No logs yet"})}):e.jsxs("div",{className:"h-full relative",children:[e.jsxs("div",{ref:s,onScroll:i,className:"h-full overflow-y-auto font-mono text-xs leading-normal",children:[t.map((a,c)=>{const m=new Date(a.timestamp).toLocaleTimeString(void 0,{hour12:!1}),d=a.level.toUpperCase(),l=d.slice(0,4),x=rs[d]??os,j=c%2===0;return e.jsxs("div",{className:"flex gap-3 px-3 py-1.5",style:{background:j?"var(--bg-primary)":"var(--bg-secondary)"},children:[e.jsx("span",{className:"text-[var(--text-muted)] shrink-0",children:m}),e.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:x.color,background:x.bg},children:l}),e.jsx("span",{className:"text-[var(--text-primary)] whitespace-pre-wrap break-all",children:a.message})]},c)}),e.jsx("div",{ref:r})]}),o&&e.jsx("button",{onClick:()=>{var a;return(a=s.current)==null?void 0:a.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"})})})]})}const ns={started:{color:"var(--accent)",label:"started"},updated:{color:"var(--info)",label:"updated"},completed:{color:"var(--success)",label:"completed"},faulted:{color:"var(--error)",label:"faulted"}},Ce={color:"var(--text-muted)",label:""};function _e({events:t,runStatus:s}){const r=h.useRef(null),o=h.useRef(!0),[n,i]=h.useState(null),a=()=>{const c=r.current;c&&(o.current=c.scrollHeight-c.scrollTop-c.clientHeight<40)};return h.useEffect(()=>{o.current&&r.current&&(r.current.scrollTop=r.current.scrollHeight)}),t.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:e.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:s==="running"?"Waiting for events...":"No events yet"})}):e.jsx("div",{ref:r,onScroll:a,className:"h-full overflow-y-auto font-mono text-xs leading-normal",children:t.map((c,m)=>{const d=new Date(c.timestamp).toLocaleTimeString(void 0,{hour12:!1}),l=c.payload&&Object.keys(c.payload).length>0,x=n===m,j=c.phase?ns[c.phase]??Ce:Ce;return e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>{l&&i(x?null:m)},className:"flex items-center gap-2 px-3 py-1.5",style:{background:m%2===0?"var(--bg-primary)":"var(--bg-secondary)",cursor:l?"pointer":"default"},children:[e.jsx("span",{className:"shrink-0",style:{color:"var(--text-muted)"},children:d}),e.jsx("span",{className:"shrink-0",style:{color:j.color},children:"●"}),e.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:c.node_name}),j.label&&e.jsx("span",{className:"shrink-0 text-[10px]",style:{color:"var(--text-muted)"},children:j.label}),l&&e.jsx("span",{className:"shrink-0 text-[9px] transition-transform",style:{color:"var(--text-muted)",transform:x?"rotate(90deg)":"rotate(0deg)"},children:"▸"})]}),x&&l&&e.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:e.jsx(te,{json:JSON.stringify(c.payload,null,2),className:"text-[11px] font-mono whitespace-pre-wrap break-words"})})]},m)})})}function Le({runId:t,status:s,ws:r,breakpointNode:o}){const n=s==="suspended",i=a=>{const c=W.getState().breakpoints[t]??{};r.setBreakpoints(t,Object.keys(c)),a==="step"?r.debugStep(t):a==="continue"?r.debugContinue(t):r.debugStop(t)};return e.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:[e.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold mr-1",style:{color:"var(--text-muted)"},children:"Debug"}),e.jsx(ce,{label:"Step",onClick:()=>i("step"),disabled:!n,color:"var(--info)",active:n}),e.jsx(ce,{label:"Continue",onClick:()=>i("continue"),disabled:!n,color:"var(--success)",active:n}),e.jsx(ce,{label:"Stop",onClick:()=>i("stop"),disabled:!n,color:"var(--error)",active:n}),e.jsx("span",{className:"text-[10px] ml-auto truncate",style:{color:n?"var(--accent)":"var(--text-muted)"},children:n?o?`Paused at ${o}`:"Paused":s})]})}function ce({label:t,onClick:s,disabled:r,color:o,active:n}){return e.jsx("button",{onClick:s,disabled:r,className:"px-2.5 py-0.5 h-5 text-[10px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed",style:{color:n?o:"var(--text-muted)",background:n?`color-mix(in srgb, ${o} 10%, transparent)`:"transparent"},onMouseEnter:i=>{r||(i.currentTarget.style.background=`color-mix(in srgb, ${o} 20%, transparent)`)},onMouseLeave:i=>{i.currentTarget.style.background=n?`color-mix(in srgb, ${o} 10%, transparent)`:"transparent"},children:t})}const Te=h.lazy(()=>He(()=>import("./ChatPanel-CJFPD9T1.js"),__vite__mapDeps([2,1,3,4]))),as=[],is=[],cs=[],ls=[];function ds({run:t,ws:s,isMobile:r}){const o=t.mode==="chat",[n,i]=h.useState(280),[a,c]=h.useState(()=>{const u=localStorage.getItem("chatPanelWidth");return u?parseInt(u,10):380}),[m,d]=h.useState("primary"),[l,x]=h.useState(o?"primary":"traces"),[j,y]=h.useState(0),E=h.useRef(null),k=h.useRef(null),w=h.useRef(!1),$=W(u=>u.traces[t.id]||as),B=W(u=>u.logs[t.id]||is),J=W(u=>u.chatMessages[t.id]||cs),F=W(u=>u.stateEvents[t.id]||ls),N=W(u=>u.breakpoints[t.id]);h.useEffect(()=>{s.setBreakpoints(t.id,N?Object.keys(N):[])},[t.id]);const L=h.useCallback(u=>{s.setBreakpoints(t.id,u)},[t.id,s]),I=h.useCallback(u=>{u.preventDefault(),w.current=!0;const p="touches"in u?u.touches[0].clientY:u.clientY,b=n,T=S=>{if(!w.current)return;const H=E.current;if(!H)return;const f="touches"in S?S.touches[0].clientY:S.clientY,_=H.clientHeight-100,C=Math.max(80,Math.min(_,b+(f-p)));i(C)},g=()=>{w.current=!1,document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",g),document.removeEventListener("touchmove",T),document.removeEventListener("touchend",g),document.body.style.cursor="",document.body.style.userSelect="",y(S=>S+1)};document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",T),document.addEventListener("mouseup",g),document.addEventListener("touchmove",T,{passive:!1}),document.addEventListener("touchend",g)},[n]),D=h.useCallback(u=>{u.preventDefault();const p="touches"in u?u.touches[0].clientX:u.clientX,b=a,T=S=>{const H=k.current;if(!H)return;const f="touches"in S?S.touches[0].clientX:S.clientX,_=H.clientWidth-300,C=Math.max(280,Math.min(_,b+(p-f)));c(C)},g=()=>{document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",g),document.removeEventListener("touchmove",T),document.removeEventListener("touchend",g),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("chatPanelWidth",String(a)),y(S=>S+1)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",T),document.addEventListener("mouseup",g),document.addEventListener("touchmove",T,{passive:!1}),document.addEventListener("touchend",g)},[a]),G=o?"Chat":"Events",z=o?"var(--accent)":"var(--success)",q=W(u=>u.activeInterrupt[t.id]??null),R=t.status==="running"?e.jsx("span",{className:"ml-auto text-[10px] 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:o?"Thinking...":"Running..."}):o&&t.status==="suspended"&&q?e.jsx("span",{className:"ml-auto text-[10px] 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(r){const u=[{id:"traces",label:"Traces",count:$.length},{id:"primary",label:G},{id:"io",label:"I/O"},{id:"logs",label:"Logs",count:B.length}];return e.jsxs("div",{className:"flex flex-col h-full",children:[(t.mode==="debug"||t.status==="suspended"&&!q||N&&Object.keys(N).length>0)&&e.jsx(Le,{runId:t.id,status:t.status,ws:s,breakpointNode:t.breakpoint_node}),e.jsx("div",{className:"shrink-0",style:{height:"40vh"},children:e.jsx(ne,{entrypoint:t.entrypoint,traces:$,runId:t.id,breakpointNode:t.breakpoint_node,breakpointNextNodes:t.breakpoint_next_nodes,onBreakpointChange:L,fitViewTrigger:j})}),e.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:[u.map(p=>e.jsxs("button",{onClick:()=>x(p.id),className:"px-2 py-0.5 h-5 text-[11px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer",style:{color:l===p.id?p.id==="primary"?z:"var(--accent)":"var(--text-muted)",background:l===p.id?`color-mix(in srgb, ${p.id==="primary"?z:"var(--accent)"} 10%, transparent)`:"transparent"},children:[p.label,p.count!==void 0&&p.count>0&&e.jsx("span",{className:"ml-1 font-normal",style:{color:"var(--text-muted)"},children:p.count})]},p.id)),R]}),e.jsxs("div",{className:"flex-1 overflow-hidden",children:[l==="traces"&&e.jsx(Se,{traces:$}),l==="primary"&&(o?e.jsx(h.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:e.jsx("span",{className:"text-xs",children:"Loading chat..."})}),children:e.jsx(Te,{messages:J,runId:t.id,runStatus:t.status,ws:s})}):e.jsx(_e,{events:F,runStatus:t.status})),l==="io"&&e.jsx(Me,{run:t}),l==="logs"&&e.jsx(Ee,{logs:B})]})]})}const P=[{id:"primary",label:G},{id:"io",label:"I/O"},{id:"logs",label:"Logs",count:B.length}];return e.jsxs("div",{ref:k,className:"flex h-full",children:[e.jsxs("div",{ref:E,className:"flex flex-col flex-1 min-w-0",children:[(t.mode==="debug"||t.status==="suspended"&&!q||N&&Object.keys(N).length>0)&&e.jsx(Le,{runId:t.id,status:t.status,ws:s,breakpointNode:t.breakpoint_node}),e.jsx("div",{className:"shrink-0",style:{height:n},children:e.jsx(ne,{entrypoint:t.entrypoint,traces:$,runId:t.id,breakpointNode:t.breakpoint_node,breakpointNextNodes:t.breakpoint_next_nodes,onBreakpointChange:L,fitViewTrigger:j})}),e.jsx("div",{onMouseDown:I,onTouchStart:I,className:"shrink-0 h-1.5 cursor-row-resize bg-[var(--border)] hover:bg-[var(--accent)] transition-colors relative",children:e.jsx("div",{className:"absolute inset-0 -top-1 -bottom-1"})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(Se,{traces:$})})]}),e.jsx("div",{onMouseDown:D,onTouchStart:D,className:"shrink-0 w-1.5 cursor-col-resize bg-[var(--border)] hover:bg-[var(--accent)] transition-colors relative",children:e.jsx("div",{className:"absolute inset-0 -left-1 -right-1"})}),e.jsxs("div",{className:"shrink-0 flex flex-col",style:{width:a,background:"var(--bg-primary)"},children:[e.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:[P.map(u=>e.jsxs("button",{onClick:()=>d(u.id),className:"px-2 py-0.5 h-5 text-[11px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer",style:{color:m===u.id?u.id==="primary"?z:"var(--accent)":"var(--text-muted)",background:m===u.id?`color-mix(in srgb, ${u.id==="primary"?z:"var(--accent)"} 10%, transparent)`:"transparent"},onMouseEnter:p=>{m!==u.id&&(p.currentTarget.style.color="var(--text-primary)")},onMouseLeave:p=>{m!==u.id&&(p.currentTarget.style.color="var(--text-muted)")},children:[u.label,u.count!==void 0&&u.count>0&&e.jsx("span",{className:"ml-1 font-normal",style:{color:"var(--text-muted)"},children:u.count})]},u.id)),R]}),e.jsxs("div",{className:"flex-1 overflow-hidden",children:[m==="primary"&&(o?e.jsx(h.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:e.jsx("span",{className:"text-xs",children:"Loading chat..."})}),children:e.jsx(Te,{messages:J,runId:t.id,runStatus:t.status,ws:s})}):e.jsx(_e,{events:F,runStatus:t.status})),m==="io"&&e.jsx(Me,{run:t}),m==="logs"&&e.jsx(Ee,{logs:B})]})]})]})}function Me({run:t}){return e.jsxs("div",{className:"p-4 overflow-y-auto h-full space-y-4",children:[e.jsx(Re,{title:"Input",color:"var(--success)",copyText:JSON.stringify(t.input_data,null,2),children:e.jsx(te,{json:JSON.stringify(t.input_data,null,2),className:"p-3 rounded-lg text-xs font-mono whitespace-pre-wrap break-words",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)"}})}),t.output_data&&e.jsx(Re,{title:"Output",color:"var(--accent)",copyText:typeof t.output_data=="string"?t.output_data:JSON.stringify(t.output_data,null,2),children:e.jsx(te,{json:typeof t.output_data=="string"?t.output_data:JSON.stringify(t.output_data,null,2),className:"p-3 rounded-lg text-xs font-mono whitespace-pre-wrap break-words",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)"}})}),t.error&&e.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid color-mix(in srgb, var(--error) 40%, var(--border))"},children:[e.jsxs("div",{className:"px-4 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:[e.jsx("span",{children:"Error"}),e.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:t.error.code}),e.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:t.error.category})]}),e.jsxs("div",{className:"p-4 text-xs leading-normal",style:{background:"var(--bg-secondary)"},children:[e.jsx("div",{className:"font-semibold mb-2",style:{color:"var(--text-primary)"},children:t.error.title}),e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-[11px] max-w-prose",style:{color:"var(--text-secondary)"},children:t.error.detail})]})]})]})}function Re({title:t,color:s,copyText:r,children:o}){const[n,i]=h.useState(!1),a=h.useCallback(()=>{r&&navigator.clipboard.writeText(r).then(()=>{i(!0),setTimeout(()=>i(!1),1500)})},[r]);return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"w-1 h-4 rounded-full",style:{background:s}}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:s},children:t}),r&&e.jsx("button",{onClick:a,className:"ml-auto text-[10px] cursor-pointer px-1.5 py-0.5 rounded",style:{color:n?"var(--success)":"var(--text-muted)",background:"var(--bg-secondary)",border:"1px solid var(--border)"},children:n?"Copied":"Copy"})]}),o]})}function us(){const{reloadPending:t,setReloadPending:s,setEntrypoints:r}=W(),[o,n]=h.useState(!1);if(!t)return null;const i=async()=>{n(!0);try{await dt();const a=await Ie();r(a.map(c=>c.name)),s(!1)}catch(a){console.error("Reload failed:",a)}finally{n(!1)}};return e.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:[e.jsx("span",{className:"text-sm",style:{color:"var(--text-secondary)"},children:"Files changed — reload to apply"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:i,disabled:o,className:"px-3 py-1 text-sm font-medium rounded cursor-pointer",style:{background:"var(--accent)",color:"#fff",opacity:o?.6:1},children:o?"Reloading...":"Reload"}),e.jsx("button",{onClick:()=>s(!1),className:"text-sm cursor-pointer px-1",style:{color:"var(--text-muted)",background:"none",border:"none"},children:"✕"})]})]})}function ps(){const t=nt(),s=xt(),[r,o]=h.useState(!1),{runs:n,selectedRunId:i,setRuns:a,upsertRun:c,selectRun:m,setTraces:d,setLogs:l,setChatMessages:x,setEntrypoints:j,setStateEvents:y,setGraphCache:E,setActiveNode:k,removeActiveNode:w}=W(),{view:$,runId:B,setupEntrypoint:J,setupMode:F,navigate:N}=Pe();h.useEffect(()=>{$==="details"&&B&&B!==i&&m(B)},[$,B,i,m]),h.useEffect(()=>{lt().then(a).catch(console.error),Ie().then(R=>j(R.map(P=>P.name))).catch(console.error)},[a,j]);const L=i?n[i]:null,I=h.useCallback((R,P)=>{c(P),d(R,P.traces),l(R,P.logs);const u=P.messages.map(p=>{const b=p.contentParts??p.content_parts??[],T=p.toolCalls??p.tool_calls??[];return{message_id:p.messageId??p.message_id,role:p.role??"assistant",content:b.filter(g=>{const S=g.mimeType??g.mime_type??"";return S.startsWith("text/")||S==="application/json"}).map(g=>{const S=g.data;return(S==null?void 0:S.inline)??""}).join(` +`).trim()??"",tool_calls:T.length>0?T.map(g=>({name:g.name??"",has_result:!!g.result})):void 0}});if(x(R,u),P.graph&&P.graph.nodes.length>0&&E(R,P.graph),P.states&&P.states.length>0&&(y(R,P.states.map(p=>({node_name:p.node_name,qualified_node_name:p.qualified_node_name,phase:p.phase,timestamp:new Date(p.timestamp).getTime(),payload:p.payload}))),P.status!=="completed"&&P.status!=="failed"))for(const p of P.states)p.phase==="started"?k(R,p.node_name,p.qualified_node_name):p.phase==="completed"&&w(R,p.node_name)},[c,d,l,x,y,E,k,w]);h.useEffect(()=>{if(!i)return;t.subscribe(i),ae(i).then(P=>I(i,P)).catch(console.error);const R=setTimeout(()=>{const P=W.getState().runs[i];P&&(P.status==="pending"||P.status==="running")&&ae(i).then(u=>I(i,u)).catch(console.error)},2e3);return()=>{clearTimeout(R),t.unsubscribe(i)}},[i,t,I]);const D=h.useRef(null);h.useEffect(()=>{var u,p;if(!i)return;const R=L==null?void 0:L.status,P=D.current;if(D.current=R??null,R&&(R==="completed"||R==="failed")&&P!==R){const b=W.getState(),T=((u=b.traces[i])==null?void 0:u.length)??0,g=((p=b.logs[i])==null?void 0:p.length)??0,S=(L==null?void 0:L.trace_count)??0,H=(L==null?void 0:L.log_count)??0;(TI(i,f)).catch(console.error)}},[i,L==null?void 0:L.status,I]);const G=R=>{N(`#/runs/${R}/traces`),m(R),o(!1)},z=R=>{N(`#/runs/${R}/traces`),m(R),o(!1)},q=()=>{N("#/new"),o(!1)};return e.jsxs("div",{className:"flex h-screen w-screen relative",children:[s&&!r&&e.jsx("button",{onClick:()=>o(!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:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),e.jsx(ft,{runs:Object.values(n),selectedRunId:i,onSelectRun:z,onNewRun:q,isMobile:s,isOpen:r,onClose:()=>o(!1)}),e.jsx("main",{className:"flex-1 overflow-hidden bg-[var(--bg-primary)]",children:$==="new"?e.jsx(vt,{}):$==="setup"&&J&&F?e.jsx(Vt,{entrypoint:J,mode:F,ws:t,onRunCreated:G,isMobile:s}):L?e.jsx(ds,{run:L,ws:t,isMobile:s}):e.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)]",children:"Select a run or create a new one"})}),e.jsx(us,{})]})}Fe.createRoot(document.getElementById("root")).render(e.jsx(h.StrictMode,{children:e.jsx(ps,{})}));export{W as u}; diff --git a/src/uipath/dev/server/static/assets/index-Dp7Ms2kW.css b/src/uipath/dev/server/static/assets/index-Dp7Ms2kW.css new file mode 100644 index 0000000..871fa2f --- /dev/null +++ b/src/uipath/dev/server/static/assets/index-Dp7Ms2kW.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-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-xl:36rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-normal:0em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-normal:1.5;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--ease-in-out:cubic-bezier(.4,0,.2,1);--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-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-1{top:calc(var(--spacing)*-1)}.top-0{top:calc(var(--spacing)*0)}.top-2{top:calc(var(--spacing)*2)}.top-4{top:calc(var(--spacing)*4)}.-right-1{right:calc(var(--spacing)*-1)}.right-3{right:calc(var(--spacing)*3)}.-bottom-1{bottom:calc(var(--spacing)*-1)}.-left-1{left:calc(var(--spacing)*-1)}.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-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.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-3{margin-inline:calc(var(--spacing)*3)}.my-2{margin-block:calc(var(--spacing)*2)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2\.5{margin-top:calc(var(--spacing)*2.5)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-auto{margin-right:auto}.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-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}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.h-1{height:calc(var(--spacing)*1)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-\[33px\]{height:33px}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:calc(var(--spacing)*48)}.min-h-0{min-height:calc(var(--spacing)*0)}.w-1{width:calc(var(--spacing)*1)}.w-1\.5{width:calc(var(--spacing)*1.5)}.w-2{width:calc(var(--spacing)*2)}.w-4{width:calc(var(--spacing)*4)}.w-6{width:calc(var(--spacing)*6)}.w-9{width:calc(var(--spacing)*9)}.w-44{width:calc(var(--spacing)*44)}.w-64{width:calc(var(--spacing)*64)}.w-full{width:100%}.w-screen{width:100vw}.max-w-prose{max-width:65ch}.max-w-xl{max-width:var(--container-xl)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-\[400px\]{min-width:400px}.flex-1{flex:1}.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,)}.cursor-col-resize{cursor:col-resize}.cursor-pointer{cursor:pointer}.cursor-row-resize{cursor:row-resize}.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-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.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\.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-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-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-xl{border-radius:var(--radius-xl)}.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\(--border\)\]{background-color:var(--border)}.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-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)}.pt-0\.5{padding-top:calc(var(--spacing)*.5)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-px{padding-top:1px}.pr-0\.5{padding-right:calc(var(--spacing)*.5)}.pr-2{padding-right:calc(var(--spacing)*2)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-2\.5{padding-left:calc(var(--spacing)*2.5)}.text-center{text-align:center}.text-left{text-align:left}.font-mono{font-family:var(--font-mono)}.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}.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-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,)}.accent-\[var\(--accent\)\]{accent-color:var(--accent)}.opacity-70{opacity:.7}.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)}.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))}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.placeholder\:text-\[var\(--text-muted\)\]::placeholder{color:var(--text-muted)}@media(hover:hover){.hover\:bg-\[var\(--accent\)\]:hover{background-color:var(--accent)}.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\: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}}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:#1e293b;--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:#0c1222;--card-bg:#1e293b;--input-bg:#0f172a;--tab-active:#fa4616;--tab-text:#94a3b8;--tab-text-active:#fa4616;--node-bg:#1e293b;--node-border:#475569;color-scheme:dark}[data-theme=light]{--bg-primary:#f8fafc;--bg-secondary:#fff;--bg-tertiary:#cbd5e1;--bg-hover:#f1f5f9;--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;--card-bg:#fff;--input-bg:#f8fafc;--tab-active:#fa4616;--tab-text:#64748b;--tab-text-active:#fa4616;--node-bg:#fff;--node-border:#cbd5e1;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}.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(--bg-tertiary);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(--bg-primary);border:1px solid var(--border);border-radius:3px;padding:.1em .35em;font-size:.85em}.chat-markdown pre{background:var(--bg-primary);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(--bg-primary);font-weight:600}.chat-markdown tr:nth-child(2n){background:var(--bg-primary)}.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-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} diff --git a/src/uipath/dev/server/static/index.html b/src/uipath/dev/server/static/index.html index df93bc5..81937a3 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/services/run_service.py b/src/uipath/dev/services/run_service.py index ffab0ed..30b0a97 100644 --- a/src/uipath/dev/services/run_service.py +++ b/src/uipath/dev/services/run_service.py @@ -3,7 +3,7 @@ from __future__ import annotations import traceback -from datetime import datetime +from datetime import datetime, timezone from typing import Any, Callable, Literal, Protocol, cast from pydantic import BaseModel @@ -154,7 +154,7 @@ async def execute(self, run: ExecutionRun) -> None: self._add_info_log(run, f"Starting execution: {run.entrypoint}") run.status = "running" - run.start_time = datetime.now() + run.start_time = datetime.now(timezone.utc) self._emit_run_updated(run) log_handler = RunContextLogHandler( @@ -289,18 +289,18 @@ async def execute(self, run: ExecutionRun) -> None: self._add_error_log(run, detail) else: self._add_info_log(run, "✅ Execution completed successfully") - run.end_time = datetime.now() + run.end_time = datetime.now(timezone.utc) except UiPathBaseRuntimeError as e: self._add_error_log(run) run.status = "failed" - run.end_time = datetime.now() + run.end_time = datetime.now(timezone.utc) run.error = e.error_info except Exception as e: self._add_error_log(run) run.status = "failed" - run.end_time = datetime.now() + run.end_time = datetime.now(timezone.utc) run.error = UiPathErrorContract( code="Unknown", title=str(e), @@ -509,7 +509,7 @@ def _add_info_log(self, run: ExecutionRun, message: str) -> None: run_id=run.id, level="INFO", message=message, - timestamp=datetime.now(), + timestamp=datetime.now(timezone.utc), ) self.handle_log(log_data) @@ -531,13 +531,13 @@ def _add_error_log(self, run: ExecutionRun, error: str | None = None) -> None: run_id=run.id, level="ERROR", message=error_text, - timestamp=datetime.now(), + timestamp=datetime.now(timezone.utc), ) else: log_data = LogData( run_id=run.id, level="ERROR", message=error, - timestamp=datetime.now(), + timestamp=datetime.now(timezone.utc), ) self.handle_log(log_data) From 050e7f014c5937baeb0b7d0ac2feb0a6c927d34c Mon Sep 17 00:00:00 2001 From: Cristian Pufu Date: Sat, 21 Feb 2026 11:03:38 +0200 Subject: [PATCH 2/4] feat: add GitHub badge to sidebar bottom Co-Authored-By: Claude Opus 4.6 --- .../src/components/layout/Sidebar.tsx | 32 +++++++++++++++++++ ...anel-CJFPD9T1.js => ChatPanel-CllakF8w.js} | 2 +- .../{index-CvCM6cm0.js => index-DMrhDX0F.js} | 6 ++-- src/uipath/dev/server/static/index.html | 2 +- 4 files changed, 37 insertions(+), 5 deletions(-) rename src/uipath/dev/server/static/assets/{ChatPanel-CJFPD9T1.js => ChatPanel-CllakF8w.js} (99%) rename src/uipath/dev/server/static/assets/{index-CvCM6cm0.js => index-DMrhDX0F.js} (82%) diff --git a/src/uipath/dev/server/frontend/src/components/layout/Sidebar.tsx b/src/uipath/dev/server/frontend/src/components/layout/Sidebar.tsx index a293454..1265289 100644 --- a/src/uipath/dev/server/frontend/src/components/layout/Sidebar.tsx +++ b/src/uipath/dev/server/frontend/src/components/layout/Sidebar.tsx @@ -113,6 +113,22 @@ export default function Sidebar({ runs, selectedRunId, onSelectRun, onNewRun, is

)}
+ + {/* GitHub link */} + ); @@ -197,6 +213,22 @@ export default function Sidebar({ runs, selectedRunId, onSelectRun, onNewRun, is

)}
+ + {/* GitHub link */} + ); } diff --git a/src/uipath/dev/server/static/assets/ChatPanel-CJFPD9T1.js b/src/uipath/dev/server/static/assets/ChatPanel-CllakF8w.js similarity index 99% rename from src/uipath/dev/server/static/assets/ChatPanel-CJFPD9T1.js rename to src/uipath/dev/server/static/assets/ChatPanel-CllakF8w.js index 5cd3097..fda3c96 100644 --- a/src/uipath/dev/server/static/assets/ChatPanel-CJFPD9T1.js +++ b/src/uipath/dev/server/static/assets/ChatPanel-CllakF8w.js @@ -1,4 +1,4 @@ -import{g as hr,j as P,a as $e}from"./vendor-react-BVoutfaX.js";import{u as sn}from"./index-CvCM6cm0.js";import"./vendor-reactflow-mU21rT8r.js";function zo(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Uo=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$o=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ho={};function Vr(e,t){return(Ho.jsx?$o:Uo).test(e)}const Go=/[ \t\n\f\r]/g;function Ko(e){return typeof e=="object"?e.type==="text"?Yr(e.value):!1:Yr(e)}function Yr(e){return e.replace(Go,"")===""}class jt{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}jt.prototype.normal={};jt.prototype.property={};jt.prototype.space=void 0;function Yi(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new jt(n,r,t)}function ir(e){return e.toLowerCase()}class De{constructor(t,n){this.attribute=n,this.property=t}}De.prototype.attribute="";De.prototype.booleanish=!1;De.prototype.boolean=!1;De.prototype.commaOrSpaceSeparated=!1;De.prototype.commaSeparated=!1;De.prototype.defined=!1;De.prototype.mustUseProperty=!1;De.prototype.number=!1;De.prototype.overloadedBoolean=!1;De.prototype.property="";De.prototype.spaceSeparated=!1;De.prototype.space=void 0;let qo=0;const ee=Et(),ke=Et(),ar=Et(),C=Et(),be=Et(),Ct=Et(),Ue=Et();function Et(){return 2**++qo}const or=Object.freeze(Object.defineProperty({__proto__:null,boolean:ee,booleanish:ke,commaOrSpaceSeparated:Ue,commaSeparated:Ct,number:C,overloadedBoolean:ar,spaceSeparated:be},Symbol.toStringTag,{value:"Module"})),Fn=Object.keys(or);class br extends De{constructor(t,n,r,i){let o=-1;if(super(t,n),jr(this,"space",i),typeof r=="number")for(;++o4&&n.slice(0,4)==="data"&&Zo.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Zr,Jo);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Zr.test(o)){let a=o.replace(jo,Qo);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=br}return new i(r,t)}function Qo(e){return"-"+e.toLowerCase()}function Jo(e){return e.charAt(1).toUpperCase()}const es=Yi([ji,Wo,Qi,Ji,ea],"html"),Er=Yi([ji,Vo,Qi,Ji,ea],"svg");function ts(e){return e.join(" ").trim()}var wt={},zn,Xr;function ns(){if(Xr)return zn;Xr=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,s=/^\s+|\s+$/g,l=` +import{g as hr,j as P,a as $e}from"./vendor-react-BVoutfaX.js";import{u as sn}from"./index-DMrhDX0F.js";import"./vendor-reactflow-mU21rT8r.js";function zo(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Uo=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$o=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ho={};function Vr(e,t){return(Ho.jsx?$o:Uo).test(e)}const Go=/[ \t\n\f\r]/g;function Ko(e){return typeof e=="object"?e.type==="text"?Yr(e.value):!1:Yr(e)}function Yr(e){return e.replace(Go,"")===""}class jt{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}jt.prototype.normal={};jt.prototype.property={};jt.prototype.space=void 0;function Yi(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new jt(n,r,t)}function ir(e){return e.toLowerCase()}class De{constructor(t,n){this.attribute=n,this.property=t}}De.prototype.attribute="";De.prototype.booleanish=!1;De.prototype.boolean=!1;De.prototype.commaOrSpaceSeparated=!1;De.prototype.commaSeparated=!1;De.prototype.defined=!1;De.prototype.mustUseProperty=!1;De.prototype.number=!1;De.prototype.overloadedBoolean=!1;De.prototype.property="";De.prototype.spaceSeparated=!1;De.prototype.space=void 0;let qo=0;const ee=Et(),ke=Et(),ar=Et(),C=Et(),be=Et(),Ct=Et(),Ue=Et();function Et(){return 2**++qo}const or=Object.freeze(Object.defineProperty({__proto__:null,boolean:ee,booleanish:ke,commaOrSpaceSeparated:Ue,commaSeparated:Ct,number:C,overloadedBoolean:ar,spaceSeparated:be},Symbol.toStringTag,{value:"Module"})),Fn=Object.keys(or);class br extends De{constructor(t,n,r,i){let o=-1;if(super(t,n),jr(this,"space",i),typeof r=="number")for(;++o4&&n.slice(0,4)==="data"&&Zo.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Zr,Jo);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Zr.test(o)){let a=o.replace(jo,Qo);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=br}return new i(r,t)}function Qo(e){return"-"+e.toLowerCase()}function Jo(e){return e.charAt(1).toUpperCase()}const es=Yi([ji,Wo,Qi,Ji,ea],"html"),Er=Yi([ji,Vo,Qi,Ji,ea],"svg");function ts(e){return e.join(" ").trim()}var wt={},zn,Xr;function ns(){if(Xr)return zn;Xr=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,s=/^\s+|\s+$/g,l=` `,c="/",d="*",u="",f="comment",p="declaration";function g(x,m){if(typeof x!="string")throw new TypeError("First argument must be a string");if(!x)return[];m=m||{};var k=1,w=1;function T(D){var O=D.match(t);O&&(k+=O.length);var j=D.lastIndexOf(l);w=~j?D.length-j:w+D.length}function A(){var D={line:k,column:w};return function(O){return O.position=new _(D),G(),O}}function _(D){this.start=D,this.end={line:k,column:w},this.source=m.source}_.prototype.content=x;function $(D){var O=new Error(m.source+":"+k+":"+w+": "+D);if(O.reason=D,O.filename=m.source,O.line=k,O.column=w,O.source=x,!m.silent)throw O}function H(D){var O=D.exec(x);if(O){var j=O[0];return T(j),x=x.slice(j.length),O}}function G(){H(n)}function S(D){var O;for(D=D||[];O=B();)O!==!1&&D.push(O);return D}function B(){var D=A();if(!(c!=x.charAt(0)||d!=x.charAt(1))){for(var O=2;u!=x.charAt(O)&&(d!=x.charAt(O)||c!=x.charAt(O+1));)++O;if(O+=2,u===x.charAt(O-1))return $("End of comment missing");var j=x.slice(2,O-2);return w+=2,T(j),x=x.slice(O),w+=2,D({type:f,comment:j})}}function F(){var D=A(),O=H(r);if(O){if(B(),!H(i))return $("property missing ':'");var j=H(o),se=D({type:p,property:y(O[0].replace(e,u)),value:j?y(j[0].replace(e,u)):u});return H(a),se}}function J(){var D=[];S(D);for(var O;O=F();)O!==!1&&(D.push(O),S(D));return D}return G(),J()}function y(x){return x?x.replace(s,u):u}return zn=g,zn}var Qr;function rs(){if(Qr)return wt;Qr=1;var e=wt&&wt.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(wt,"__esModule",{value:!0}),wt.default=n;const t=e(ns());function n(r,i){let o=null;if(!r||typeof r!="string")return o;const a=(0,t.default)(r),s=typeof i=="function";return a.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:d}=l;s?i(c,d,l):d&&(o=o||{},o[c]=d)}),o}return wt}var Ft={},Jr;function is(){if(Jr)return Ft;Jr=1,Object.defineProperty(Ft,"__esModule",{value:!0}),Ft.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(c){return!c||n.test(c)||e.test(c)},a=function(c,d){return d.toUpperCase()},s=function(c,d){return"".concat(d,"-")},l=function(c,d){return d===void 0&&(d={}),o(c)?c:(c=c.toLowerCase(),d.reactCompat?c=c.replace(i,s):c=c.replace(r,s),c.replace(t,a))};return Ft.camelCase=l,Ft}var zt,ei;function as(){if(ei)return zt;ei=1;var e=zt&&zt.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(rs()),n=is();function r(i,o){var a={};return!i||typeof i!="string"||(0,t.default)(i,function(s,l){s&&l&&(a[(0,n.camelCase)(s,o)]=l)}),a}return r.default=r,zt=r,zt}var os=as();const ss=hr(os),ta=na("end"),yr=na("start");function na(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 ls(e){const t=yr(e),n=ta(e);if(t&&n)return{start:t,end:n}}function Kt(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ti(e.position):"start"in e||"end"in e?ti(e):"line"in e||"column"in e?sr(e):""}function sr(e){return ni(e&&e.line)+":"+ni(e&&e.column)}function ti(e){return sr(e&&e.start)+"-"+sr(e&&e.end)}function ni(e){return e&&typeof e=="number"?e:1}class Ae extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(a=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const s=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=s?s.line:void 0,this.name=Kt(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ae.prototype.file="";Ae.prototype.name="";Ae.prototype.reason="";Ae.prototype.message="";Ae.prototype.stack="";Ae.prototype.column=void 0;Ae.prototype.line=void 0;Ae.prototype.ancestors=void 0;Ae.prototype.cause=void 0;Ae.prototype.fatal=void 0;Ae.prototype.place=void 0;Ae.prototype.ruleId=void 0;Ae.prototype.source=void 0;const _r={}.hasOwnProperty,cs=new Map,us=/[A-Z]/g,ds=new Set(["table","tbody","thead","tfoot","tr"]),ps=new Set(["td","th"]),ra="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function fs(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=xs(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=_s(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"?Er:es,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=ia(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function ia(e,t,n){if(t.type==="element")return gs(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return ms(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return bs(e,t,n);if(t.type==="mdxjsEsm")return hs(e,t);if(t.type==="root")return Es(e,t,n);if(t.type==="text")return ys(e,t)}function gs(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Er,e.schema=i),e.ancestors.push(t);const o=oa(e,t.tagName,!1),a=ks(e,t);let s=kr(e,t);return ds.has(t.tagName)&&(s=s.filter(function(l){return typeof l=="string"?!Ko(l):!0})),aa(e,a,o,t),xr(a,s),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function ms(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)}Vt(e,t.position)}function hs(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Vt(e,t.position)}function bs(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Er,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:oa(e,t.name,!0),a=ws(e,t),s=kr(e,t);return aa(e,a,o,t),xr(a,s),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function Es(e,t,n){const r={};return xr(r,kr(e,t)),e.create(t,e.Fragment,r,n)}function ys(e,t){return t.value}function aa(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function xr(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function _s(e,t,n){return r;function r(i,o,a,s){const c=Array.isArray(a.children)?n:t;return s?c(o,a,s):c(o,a)}}function xs(e,t){return n;function n(r,i,o,a){const s=Array.isArray(o.children),l=yr(r);return t(i,o,a,s,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function ks(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&_r.call(t.properties,i)){const o=Ss(e,i,t.properties[i]);if(o){const[a,s]=o;e.tableCellAlignToStyle&&a==="align"&&typeof s=="string"&&ps.has(t.tagName)?r=s:n[a]=s}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function ws(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const a=o.expression;a.type;const s=a.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else Vt(e,t.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const s=r.value.data.estree.body[0];s.type,o=e.evaluater.evaluateExpression(s.expression)}else Vt(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function kr(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:cs;for(;++ri?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);o0?(He(e,e.length,0,t),e):t}const ai={}.hasOwnProperty;function la(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 Ve(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Re=ft(/[A-Za-z]/),Te=ft(/[\dA-Za-z]/),Ms=ft(/[#-'*+\--9=?A-Z^-~]/);function yn(e){return e!==null&&(e<32||e===127)}const lr=ft(/\d/),Ds=ft(/[\dA-Fa-f]/),Ls=ft(/[!-/:-@[-`{-~]/);function W(e){return e!==null&&e<-2}function ge(e){return e!==null&&(e<0||e===32)}function re(e){return e===-2||e===-1||e===32}const Nn=ft(new RegExp("\\p{P}|\\p{S}","u")),bt=ft(/\s/);function ft(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Rt(e){const t=[];let n=-1,r=0,i=0;for(;++n55295&&o<57344){const s=e.charCodeAt(n+1);o<56320&&s>56319&&s<57344?(a=String.fromCharCode(o,s),i=1):a="�"}else a=String.fromCharCode(o);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function ae(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(l){return re(l)?(e.enter(n),s(l)):t(l)}function s(l){return re(l)&&o++a))return;const $=t.events.length;let H=$,G,S;for(;H--;)if(t.events[H][0]==="exit"&&t.events[H][1].type==="chunkFlow"){if(G){S=t.events[H][1].end;break}G=!0}for(m(r),_=$;_w;){const A=n[T];t.containerState=A[1],A[0].exit.call(t,e)}n.length=w}function k(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Us(e,t,n){return ae(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ot(e){if(e===null||ge(e)||bt(e))return 1;if(Nn(e))return 2}function vn(e,t,n){const r=[];let i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const u={...e[r][1].end},f={...e[n][1].start};si(u,-l),si(f,l),a={type:l>1?"strongSequence":"emphasisSequence",start:u,end:{...e[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},o={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...a.start},end:{...s.end}},e[r][1].end={...a.start},e[n][1].start={...s.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=Ke(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Ke(c,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",o,t]]),c=Ke(c,vn(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Ke(c,[["exit",o,t],["enter",s,t],["exit",s,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,c=Ke(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,He(e,r-1,n-r+3,c),n=r+c.length-d-2;break}}for(n=-1;++n0&&re(_)?ae(e,k,"linePrefix",o+1)(_):k(_)}function k(_){return _===null||W(_)?e.check(li,y,T)(_):(e.enter("codeFlowValue"),w(_))}function w(_){return _===null||W(_)?(e.exit("codeFlowValue"),k(_)):(e.consume(_),w)}function T(_){return e.exit("codeFenced"),t(_)}function A(_,$,H){let G=0;return S;function S(O){return _.enter("lineEnding"),_.consume(O),_.exit("lineEnding"),B}function B(O){return _.enter("codeFencedFence"),re(O)?ae(_,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):F(O)}function F(O){return O===s?(_.enter("codeFencedFenceSequence"),J(O)):H(O)}function J(O){return O===s?(G++,_.consume(O),J):G>=a?(_.exit("codeFencedFenceSequence"),re(O)?ae(_,D,"whitespace")(O):D(O)):H(O)}function D(O){return O===null||W(O)?(_.exit("codeFencedFence"),$(O)):H(O)}}}function Qs(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const $n={name:"codeIndented",tokenize:el},Js={partial:!0,tokenize:tl};function el(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),ae(e,o,"linePrefix",5)(c)}function o(c){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(c):n(c)}function a(c){return c===null?l(c):W(c)?e.attempt(Js,a,l)(c):(e.enter("codeFlowValue"),s(c))}function s(c){return c===null||W(c)?(e.exit("codeFlowValue"),a(c)):(e.consume(c),s)}function l(c){return e.exit("codeIndented"),t(c)}}function tl(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):W(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):ae(e,o,"linePrefix",5)(a)}function o(a){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(a):W(a)?i(a):n(a)}}const nl={name:"codeText",previous:il,resolve:rl,tokenize:al};function rl(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 o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Ut(this.left,r),o.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),Ut(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ut(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(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function ga(e,t,n,r,i,o,a,s,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return u;function u(m){return m===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(m),e.exit(o),f):m===null||m===32||m===41||yn(m)?n(m):(e.enter(r),e.enter(a),e.enter(s),e.enter("chunkString",{contentType:"string"}),y(m))}function f(m){return m===62?(e.enter(o),e.consume(m),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(m))}function p(m){return m===62?(e.exit("chunkString"),e.exit(s),f(m)):m===null||m===60||W(m)?n(m):(e.consume(m),m===92?g:p)}function g(m){return m===60||m===62||m===92?(e.consume(m),p):p(m)}function y(m){return!d&&(m===null||m===41||ge(m))?(e.exit("chunkString"),e.exit(s),e.exit(a),e.exit(r),t(m)):d999||p===null||p===91||p===93&&!l||p===94&&!s&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(o),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):W(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),u(p))}function u(p){return p===null||p===91||p===93||W(p)||s++>999?(e.exit("chunkString"),d(p)):(e.consume(p),l||(l=!re(p)),p===92?f:u)}function f(p){return p===91||p===92||p===93?(e.consume(p),s++,u):u(p)}}function ha(e,t,n,r,i,o){let a;return s;function s(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),a=f===40?41:f,l):n(f)}function l(f){return f===a?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(o),c(f))}function c(f){return f===a?(e.exit(o),l(a)):f===null?n(f):W(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ae(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===a||f===null||W(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?u:d)}function u(f){return f===a||f===92?(e.consume(f),d):d(f)}}function qt(e,t){let n;return r;function r(i){return W(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):re(i)?ae(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const fl={name:"definition",tokenize:ml},gl={partial:!0,tokenize:hl};function ml(e,t,n){const r=this;let i;return o;function o(p){return e.enter("definition"),a(p)}function a(p){return ma.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return i=Ve(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return ge(p)?qt(e,c)(p):c(p)}function c(p){return ga(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(gl,u,u)(p)}function u(p){return re(p)?ae(e,f,"whitespace")(p):f(p)}function f(p){return p===null||W(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function hl(e,t,n){return r;function r(s){return ge(s)?qt(e,i)(s):n(s)}function i(s){return ha(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function o(s){return re(s)?ae(e,a,"whitespace")(s):a(s)}function a(s){return s===null||W(s)?t(s):n(s)}}const bl={name:"hardBreakEscape",tokenize:El};function El(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return W(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const yl={name:"headingAtx",resolve:_l,tokenize:xl};function _l(e,t){let n=e.length-2,r=3,i,o;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},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},He(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function xl(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),o(d)}function o(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(e.consume(d),a):d===null||ge(d)?(e.exit("atxHeadingSequence"),s(d)):n(d)}function s(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||W(d)?(e.exit("atxHeading"),t(d)):re(d)?ae(e,s,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),s(d))}function c(d){return d===null||d===35||ge(d)?(e.exit("atxHeadingText"),s(d)):(e.consume(d),c)}}const kl=["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"],ui=["pre","script","style","textarea"],wl={concrete:!0,name:"htmlFlow",resolveTo:vl,tokenize:Tl},Sl={partial:!0,tokenize:Cl},Nl={partial:!0,tokenize:Al};function vl(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 Tl(e,t,n){const r=this;let i,o,a,s,l;return c;function c(E){return d(E)}function d(E){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(E),u}function u(E){return E===33?(e.consume(E),f):E===47?(e.consume(E),o=!0,y):E===63?(e.consume(E),i=3,r.interrupt?t:h):Re(E)?(e.consume(E),a=String.fromCharCode(E),x):n(E)}function f(E){return E===45?(e.consume(E),i=2,p):E===91?(e.consume(E),i=5,s=0,g):Re(E)?(e.consume(E),i=4,r.interrupt?t:h):n(E)}function p(E){return E===45?(e.consume(E),r.interrupt?t:h):n(E)}function g(E){const Ce="CDATA[";return E===Ce.charCodeAt(s++)?(e.consume(E),s===Ce.length?r.interrupt?t:F:g):n(E)}function y(E){return Re(E)?(e.consume(E),a=String.fromCharCode(E),x):n(E)}function x(E){if(E===null||E===47||E===62||ge(E)){const Ce=E===47,Ge=a.toLowerCase();return!Ce&&!o&&ui.includes(Ge)?(i=1,r.interrupt?t(E):F(E)):kl.includes(a.toLowerCase())?(i=6,Ce?(e.consume(E),m):r.interrupt?t(E):F(E)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(E):o?k(E):w(E))}return E===45||Te(E)?(e.consume(E),a+=String.fromCharCode(E),x):n(E)}function m(E){return E===62?(e.consume(E),r.interrupt?t:F):n(E)}function k(E){return re(E)?(e.consume(E),k):S(E)}function w(E){return E===47?(e.consume(E),S):E===58||E===95||Re(E)?(e.consume(E),T):re(E)?(e.consume(E),w):S(E)}function T(E){return E===45||E===46||E===58||E===95||Te(E)?(e.consume(E),T):A(E)}function A(E){return E===61?(e.consume(E),_):re(E)?(e.consume(E),A):w(E)}function _(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),l=E,$):re(E)?(e.consume(E),_):H(E)}function $(E){return E===l?(e.consume(E),l=null,G):E===null||W(E)?n(E):(e.consume(E),$)}function H(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||ge(E)?A(E):(e.consume(E),H)}function G(E){return E===47||E===62||re(E)?w(E):n(E)}function S(E){return E===62?(e.consume(E),B):n(E)}function B(E){return E===null||W(E)?F(E):re(E)?(e.consume(E),B):n(E)}function F(E){return E===45&&i===2?(e.consume(E),j):E===60&&i===1?(e.consume(E),se):E===62&&i===4?(e.consume(E),ue):E===63&&i===3?(e.consume(E),h):E===93&&i===5?(e.consume(E),pe):W(E)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Sl,fe,J)(E)):E===null||W(E)?(e.exit("htmlFlowData"),J(E)):(e.consume(E),F)}function J(E){return e.check(Nl,D,fe)(E)}function D(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),O}function O(E){return E===null||W(E)?J(E):(e.enter("htmlFlowData"),F(E))}function j(E){return E===45?(e.consume(E),h):F(E)}function se(E){return E===47?(e.consume(E),a="",Z):F(E)}function Z(E){if(E===62){const Ce=a.toLowerCase();return ui.includes(Ce)?(e.consume(E),ue):F(E)}return Re(E)&&a.length<8?(e.consume(E),a+=String.fromCharCode(E),Z):F(E)}function pe(E){return E===93?(e.consume(E),h):F(E)}function h(E){return E===62?(e.consume(E),ue):E===45&&i===2?(e.consume(E),h):F(E)}function ue(E){return E===null||W(E)?(e.exit("htmlFlowData"),fe(E)):(e.consume(E),ue)}function fe(E){return e.exit("htmlFlow"),t(E)}}function Al(e,t,n){const r=this;return i;function i(a){return W(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):n(a)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function Cl(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Zt,t,n)}}const Ol={name:"htmlText",tokenize:Il};function Il(e,t,n){const r=this;let i,o,a;return s;function s(h){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(h),l}function l(h){return h===33?(e.consume(h),c):h===47?(e.consume(h),A):h===63?(e.consume(h),w):Re(h)?(e.consume(h),H):n(h)}function c(h){return h===45?(e.consume(h),d):h===91?(e.consume(h),o=0,g):Re(h)?(e.consume(h),k):n(h)}function d(h){return h===45?(e.consume(h),p):n(h)}function u(h){return h===null?n(h):h===45?(e.consume(h),f):W(h)?(a=u,se(h)):(e.consume(h),u)}function f(h){return h===45?(e.consume(h),p):u(h)}function p(h){return h===62?j(h):h===45?f(h):u(h)}function g(h){const ue="CDATA[";return h===ue.charCodeAt(o++)?(e.consume(h),o===ue.length?y:g):n(h)}function y(h){return h===null?n(h):h===93?(e.consume(h),x):W(h)?(a=y,se(h)):(e.consume(h),y)}function x(h){return h===93?(e.consume(h),m):y(h)}function m(h){return h===62?j(h):h===93?(e.consume(h),m):y(h)}function k(h){return h===null||h===62?j(h):W(h)?(a=k,se(h)):(e.consume(h),k)}function w(h){return h===null?n(h):h===63?(e.consume(h),T):W(h)?(a=w,se(h)):(e.consume(h),w)}function T(h){return h===62?j(h):w(h)}function A(h){return Re(h)?(e.consume(h),_):n(h)}function _(h){return h===45||Te(h)?(e.consume(h),_):$(h)}function $(h){return W(h)?(a=$,se(h)):re(h)?(e.consume(h),$):j(h)}function H(h){return h===45||Te(h)?(e.consume(h),H):h===47||h===62||ge(h)?G(h):n(h)}function G(h){return h===47?(e.consume(h),j):h===58||h===95||Re(h)?(e.consume(h),S):W(h)?(a=G,se(h)):re(h)?(e.consume(h),G):j(h)}function S(h){return h===45||h===46||h===58||h===95||Te(h)?(e.consume(h),S):B(h)}function B(h){return h===61?(e.consume(h),F):W(h)?(a=B,se(h)):re(h)?(e.consume(h),B):G(h)}function F(h){return h===null||h===60||h===61||h===62||h===96?n(h):h===34||h===39?(e.consume(h),i=h,J):W(h)?(a=F,se(h)):re(h)?(e.consume(h),F):(e.consume(h),D)}function J(h){return h===i?(e.consume(h),i=void 0,O):h===null?n(h):W(h)?(a=J,se(h)):(e.consume(h),J)}function D(h){return h===null||h===34||h===39||h===60||h===61||h===96?n(h):h===47||h===62||ge(h)?G(h):(e.consume(h),D)}function O(h){return h===47||h===62||ge(h)?G(h):n(h)}function j(h){return h===62?(e.consume(h),e.exit("htmlTextData"),e.exit("htmlText"),t):n(h)}function se(h){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Z}function Z(h){return re(h)?ae(e,pe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h):pe(h)}function pe(h){return e.enter("htmlTextData"),a(h)}}const Nr={name:"labelEnd",resolveAll:Ll,resolveTo:Pl,tokenize:Bl},Rl={tokenize:Fl},Ml={tokenize:zl},Dl={tokenize:Ul};function Ll(e){let t=-1;const n=[];for(;++t=3&&(c===null||W(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),re(c)?ae(e,s,"whitespace")(c):s(c))}}const Me={continuation:{tokenize:Zl},exit:Ql,name:"list",tokenize:jl},Vl={partial:!0,tokenize:Jl},Yl={partial:!0,tokenize:Xl};function jl(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return s;function s(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:lr(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(En,n,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return lr(p)&&++a<10?(e.consume(p),l):(!r.interrupt||a<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Zt,r.interrupt?n:d,e.attempt(Vl,f,u))}function d(p){return r.containerState.initialBlankLine=!0,o++,f(p)}function u(p){return re(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Zl(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Zt,i,o);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ae(e,t,"listItemIndent",r.containerState.size+1)(s)}function o(s){return r.containerState.furtherBlankLines||!re(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Yl,t,a)(s))}function a(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,ae(e,e.attempt(Me,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function Xl(e,t,n){const r=this;return ae(e,i,"listItemIndent",r.containerState.size+1);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(o):n(o)}}function Ql(e){e.exit(this.containerState.type)}function Jl(e,t,n){const r=this;return ae(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const a=r.events[r.events.length-1];return!re(o)&&a&&a[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const di={name:"setextUnderline",resolveTo:ec,tokenize:tc};function ec(e,t){let n=e.length,r,i,o;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),!o&&e[n][1].type==="definition"&&(o=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",a,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function tc(e,t,n){const r=this;let i;return o;function o(c){let d=r.events.length,u;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){u=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||u)?(e.enter("setextHeadingLine"),i=c,a(c)):n(c)}function a(c){return e.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===i?(e.consume(c),s):(e.exit("setextHeadingLineSequence"),re(c)?ae(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||W(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const nc={tokenize:rc};function rc(e){const t=this,n=e.attempt(Zt,r,e.attempt(this.parser.constructs.flowInitial,i,ae(e,e.attempt(this.parser.constructs.flow,i,e.attempt(ll,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const ic={resolveAll:Ea()},ac=ba("string"),oc=ba("text");function ba(e){return{resolveAll:Ea(e==="text"?sc:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,a,s);return a;function a(d){return c(d)?o(d):s(d)}function s(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return c(d)?(n.exit("data"),o(d)):(n.consume(d),l)}function c(d){if(d===null)return!0;const u=i[d];let f=-1;if(u)for(;++f-1){const s=a[0];typeof s=="string"?a[0]=s.slice(r):a.shift()}o>0&&a.push(e[i].slice(0,o))}return a}function _c(e,t){let n=-1;const r=[];let i;for(;++n0){const Be=V.tokenStack[V.tokenStack.length-1];(Be[1]||fi).call(V,void 0,Be[0])}for(R.position={start:pt(N.length>0?N[0][1].start:{line:1,column:1,offset:0}),end:pt(N.length>0?N[N.length-2][1].end:{line:1,column:1,offset:0})},le=-1;++lei.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-elk-CTNP4r_q.js","assets/vendor-react-BVoutfaX.js","assets/ChatPanel-CllakF8w.js","assets/vendor-reactflow-mU21rT8r.js","assets/vendor-reactflow-B5DZHykP.css"])))=>i.map(i=>d[i]); var ze=Object.defineProperty;var Ve=(t,s,r)=>s in t?ze(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r;var K=(t,s,r)=>Ve(t,typeof s!="symbol"?s+"":s,r);import{R as re,a as h,j as e,b as Fe}from"./vendor-react-BVoutfaX.js";import{H as Y,P as X,B as Ue,M as Je,u as Ge,a as qe,R as Ye,b as Xe,C as Ke,c as Ze,d as Qe}from"./vendor-reactflow-mU21rT8r.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))o(n);new MutationObserver(n=>{for(const i of n)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&o(a)}).observe(document,{childList:!0,subtree:!0});function r(n){const i={};return n.integrity&&(i.integrity=n.integrity),n.referrerPolicy&&(i.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?i.credentials="include":n.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(n){if(n.ep)return;n.ep=!0;const i=r(n);fetch(n.href,i)}})();const de=t=>{let s;const r=new Set,o=(d,l)=>{const x=typeof d=="function"?d(s):d;if(!Object.is(x,s)){const j=s;s=l??(typeof x!="object"||x===null)?x:Object.assign({},s,x),r.forEach(y=>y(s,j))}},n=()=>s,c={setState:o,getState:n,getInitialState:()=>m,subscribe:d=>(r.add(d),()=>r.delete(d))},m=s=t(o,n,c);return c},et=(t=>t?de(t):de),tt=t=>t;function st(t,s=tt){const r=re.useSyncExternalStore(t.subscribe,re.useCallback(()=>s(t.getState()),[t,s]),re.useCallback(()=>s(t.getInitialState()),[t,s]));return re.useDebugValue(r),r}const ue=t=>{const s=et(t),r=o=>st(s,o);return Object.assign(r,s),r},$e=(t=>t?ue(t):ue),W=$e(t=>({runs:{},selectedRunId:null,traces:{},logs:{},chatMessages:{},entrypoints:[],setRuns:s=>t(r=>{var i;let o=r.breakpoints;for(const a of s)(i=a.breakpoints)!=null&&i.length&&!o[a.id]&&(o={...o,[a.id]:Object.fromEntries(a.breakpoints.map(c=>[c,!0]))});const n={runs:Object.fromEntries(s.map(a=>[a.id,a]))};return o!==r.breakpoints&&(n.breakpoints=o),n}),upsertRun:s=>t(r=>{var n;const o={runs:{...r.runs,[s.id]:s}};if((n=s.breakpoints)!=null&&n.length&&!r.breakpoints[s.id]&&(o.breakpoints={...r.breakpoints,[s.id]:Object.fromEntries(s.breakpoints.map(i=>[i,!0]))}),(s.status==="completed"||s.status==="failed")&&r.activeNodes[s.id]){const{[s.id]:i,...a}=r.activeNodes;o.activeNodes=a}if(s.status!=="suspended"&&r.activeInterrupt[s.id]){const{[s.id]:i,...a}=r.activeInterrupt;o.activeInterrupt=a}return o}),selectRun:s=>t({selectedRunId:s}),addTrace:s=>t(r=>{const o=r.traces[s.run_id]??[],n=o.findIndex(a=>a.span_id===s.span_id),i=n>=0?o.map((a,c)=>c===n?s:a):[...o,s];return{traces:{...r.traces,[s.run_id]:i}}}),setTraces:(s,r)=>t(o=>({traces:{...o.traces,[s]:r}})),addLog:s=>t(r=>{const o=r.logs[s.run_id]??[];return{logs:{...r.logs,[s.run_id]:[...o,s]}}}),setLogs:(s,r)=>t(o=>({logs:{...o.logs,[s]:r}})),addChatEvent:(s,r)=>t(o=>{const n=o.chatMessages[s]??[],i=r.message;if(!i)return o;const a=i.messageId??i.message_id,c=i.role??"assistant",l=(i.contentParts??i.content_parts??[]).filter(k=>{const w=k.mimeType??k.mime_type??"";return w.startsWith("text/")||w==="application/json"}).map(k=>{const w=k.data;return(w==null?void 0:w.inline)??""}).join(` -`).trim(),x=(i.toolCalls??i.tool_calls??[]).map(k=>({name:k.name??"",has_result:!!k.result})),j={message_id:a,role:c,content:l,tool_calls:x.length>0?x:void 0},y=n.findIndex(k=>k.message_id===a);if(y>=0)return{chatMessages:{...o.chatMessages,[s]:n.map((k,w)=>w===y?j:k)}};if(c==="user"){const k=n.findIndex(w=>w.message_id.startsWith("local-")&&w.role==="user"&&w.content===l);if(k>=0)return{chatMessages:{...o.chatMessages,[s]:n.map((w,$)=>$===k?j:w)}}}const E=[...n,j];return{chatMessages:{...o.chatMessages,[s]:E}}}),addLocalChatMessage:(s,r)=>t(o=>{const n=o.chatMessages[s]??[];return{chatMessages:{...o.chatMessages,[s]:[...n,r]}}}),setChatMessages:(s,r)=>t(o=>({chatMessages:{...o.chatMessages,[s]:r}})),setEntrypoints:s=>t({entrypoints:s}),breakpoints:{},toggleBreakpoint:(s,r)=>t(o=>{const n={...o.breakpoints[s]??{}};return n[r]?delete n[r]:n[r]=!0,{breakpoints:{...o.breakpoints,[s]:n}}}),clearBreakpoints:s=>t(r=>{const{[s]:o,...n}=r.breakpoints;return{breakpoints:n}}),activeNodes:{},setActiveNode:(s,r,o)=>t(n=>{const i=n.activeNodes[s]??{executing:{},prev:null};return{activeNodes:{...n.activeNodes,[s]:{executing:{...i.executing,[r]:o??null},prev:i.prev}}}}),removeActiveNode:(s,r)=>t(o=>{const n=o.activeNodes[s];if(!n)return o;const{[r]:i,...a}=n.executing;return{activeNodes:{...o.activeNodes,[s]:{executing:a,prev:r}}}}),resetRunGraphState:s=>t(r=>({stateEvents:{...r.stateEvents,[s]:[]},activeNodes:{...r.activeNodes,[s]:{executing:{},prev:null}}})),stateEvents:{},addStateEvent:(s,r,o,n,i)=>t(a=>{const c=a.stateEvents[s]??[];return{stateEvents:{...a.stateEvents,[s]:[...c,{node_name:r,qualified_node_name:n,phase:i,timestamp:Date.now(),payload:o}]}}}),setStateEvents:(s,r)=>t(o=>({stateEvents:{...o.stateEvents,[s]:r}})),focusedSpan:null,setFocusedSpan:s=>t({focusedSpan:s}),activeInterrupt:{},setActiveInterrupt:(s,r)=>t(o=>({activeInterrupt:{...o.activeInterrupt,[s]:r}})),reloadPending:!1,setReloadPending:s=>t({reloadPending:s}),graphCache:{},setGraphCache:(s,r)=>t(o=>({graphCache:{...o.graphCache,[s]:r}}))}));class rt{constructor(s){K(this,"ws",null);K(this,"url");K(this,"handlers",new Set);K(this,"reconnectTimer",null);K(this,"shouldReconnect",!0);K(this,"pendingMessages",[]);K(this,"activeSubscriptions",new Set);const r=window.location.protocol==="https:"?"wss:":"ws:";this.url=s??`${r}//${window.location.host}/ws`}connect(){var s;((s=this.ws)==null?void 0:s.readyState)!==WebSocket.OPEN&&(this.ws=new WebSocket(this.url),this.ws.onopen=()=>{console.log("[ws] connected");for(const r of this.activeSubscriptions)this.sendRaw(JSON.stringify({type:"subscribe",payload:{run_id:r}}));for(const r of this.pendingMessages)this.sendRaw(r);this.pendingMessages=[]},this.ws.onmessage=r=>{let o;try{o=JSON.parse(r.data)}catch{console.warn("[ws] failed to parse message",r.data);return}this.handlers.forEach(n=>{try{n(o)}catch(i){console.error("[ws] handler error",i)}})},this.ws.onclose=()=>{console.log("[ws] disconnected"),this.shouldReconnect&&(this.reconnectTimer=setTimeout(()=>this.connect(),2e3))},this.ws.onerror=()=>{var r;(r=this.ws)==null||r.close()})}disconnect(){var s;this.shouldReconnect=!1,this.reconnectTimer&&clearTimeout(this.reconnectTimer),(s=this.ws)==null||s.close(),this.ws=null}onMessage(s){return this.handlers.add(s),()=>this.handlers.delete(s)}sendRaw(s){var r;((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN&&this.ws.send(s)}send(s,r){var n;const o=JSON.stringify({type:s,payload:r});((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN?this.ws.send(o):this.pendingMessages.push(o)}subscribe(s){this.activeSubscriptions.add(s),this.send("subscribe",{run_id:s})}unsubscribe(s){this.activeSubscriptions.delete(s),this.send("unsubscribe",{run_id:s})}sendChatMessage(s,r){this.send("chat.message",{run_id:s,text:r})}sendInterruptResponse(s,r){this.send("chat.interrupt_response",{run_id:s,data:r})}debugStep(s){this.send("debug.step",{run_id:s})}debugContinue(s){this.send("debug.continue",{run_id:s})}debugStop(s){this.send("debug.stop",{run_id:s})}setBreakpoints(s,r){this.send("debug.set_breakpoints",{run_id:s,breakpoints:r})}}let oe=null;function ot(){return oe||(oe=new rt,oe.connect()),oe}function nt(){const t=h.useRef(ot()),{upsertRun:s,addTrace:r,addLog:o,addChatEvent:n,setActiveInterrupt:i,setActiveNode:a,removeActiveNode:c,resetRunGraphState:m,addStateEvent:d,setReloadPending:l}=W();return h.useEffect(()=>t.current.onMessage(y=>{switch(y.type){case"run.updated":s(y.payload);break;case"trace":r(y.payload);break;case"log":o(y.payload);break;case"chat":{const E=y.payload.run_id;n(E,y.payload);break}case"chat.interrupt":{const E=y.payload.run_id;i(E,y.payload);break}case"state":{const E=y.payload.run_id,k=y.payload.node_name,w=y.payload.qualified_node_name??null,$=y.payload.phase??null,B=y.payload.payload;k==="__start__"&&$==="started"&&m(E),$==="started"?a(E,k,w):$==="completed"&&c(E,k),d(E,k,B,w,$);break}case"reload":l(!0);break}}),[s,r,o,n,i,a,c,m,d,l]),t.current}const Z="/api";async function Q(t,s){const r=await fetch(t,s);if(!r.ok){let o;try{o=(await r.json()).detail||r.statusText}catch{o=r.statusText}const n=new Error(`HTTP ${r.status}`);throw n.detail=o,n.status=r.status,n}return r.json()}async function Ie(){return Q(`${Z}/entrypoints`)}async function at(t){return Q(`${Z}/entrypoints/${encodeURIComponent(t)}/schema`)}async function it(t){return Q(`${Z}/entrypoints/${encodeURIComponent(t)}/mock-input`)}async function ct(t){return Q(`${Z}/entrypoints/${encodeURIComponent(t)}/graph`)}async function pe(t,s,r="run",o=[]){return Q(`${Z}/runs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entrypoint:t,input_data:s,mode:r,breakpoints:o})})}async function lt(){return Q(`${Z}/runs`)}async function ae(t){return Q(`${Z}/runs/${t}`)}async function dt(){return Q(`${Z}/reload`,{method:"POST"})}function ut(t){const s=t.replace(/^#\/?/,"");if(!s||s==="new")return{view:"new",runId:null,tab:"traces",setupEntrypoint:null,setupMode:null};const r=s.match(/^setup\/([^/]+)\/(run|chat)$/);if(r)return{view:"setup",runId:null,tab:"traces",setupEntrypoint:decodeURIComponent(r[1]),setupMode:r[2]};const o=s.match(/^runs\/([^/]+)(?:\/(traces|output))?$/);return o?{view:"details",runId:o[1],tab:o[2]??"traces",setupEntrypoint:null,setupMode:null}:{view:"new",runId:null,tab:"traces",setupEntrypoint:null,setupMode:null}}function pt(){return window.location.hash}function ht(t){return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)}function Pe(){const t=h.useSyncExternalStore(ht,pt),s=ut(t),r=h.useCallback(o=>{window.location.hash=o},[]);return{...s,navigate:r}}const he="(max-width: 767px)";function xt(){const[t,s]=h.useState(()=>window.matchMedia(he).matches);return h.useEffect(()=>{const r=window.matchMedia(he),o=n=>s(n.matches);return r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[]),t}function We(){const t=localStorage.getItem("uipath-dev-theme");return t==="light"||t==="dark"?t:"dark"}function Oe(t){document.documentElement.setAttribute("data-theme",t),localStorage.setItem("uipath-dev-theme",t)}Oe(We());const mt=$e(t=>({theme:We(),toggleTheme:()=>t(s=>{const r=s.theme==="dark"?"light":"dark";return Oe(r),{theme:r}})})),gt={pending:"var(--text-muted)",running:"var(--warning)",suspended:"var(--info)",completed:"var(--success)",failed:"var(--error)"};function xe({run:t,isSelected:s,onClick:r}){var a;const o=gt[t.status]??"var(--text-muted)",n=((a=t.entrypoint.split("/").pop())==null?void 0:a.slice(0,16))??t.entrypoint,i=t.start_time?new Date(t.start_time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"";return e.jsxs("button",{onClick:r,className:"w-full text-left px-3 py-1.5 flex items-center gap-2 transition-colors cursor-pointer",style:{background:s?"color-mix(in srgb, var(--accent) 8%, var(--bg-primary))":void 0,borderLeft:s?"2px solid var(--accent)":"2px solid transparent"},onMouseEnter:c=>{s||(c.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:c=>{s||(c.currentTarget.style.background="")},children:[e.jsx("span",{className:"shrink-0 w-1.5 h-1.5 rounded-full",style:{background:o}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xs truncate",style:{color:s?"var(--text-primary)":"var(--text-secondary)"},children:n}),e.jsxs("div",{className:"text-[10px] tabular-nums",style:{color:"var(--text-muted)"},children:[i,t.duration?` · ${t.duration}`:""]})]})]})}function ft({runs:t,selectedRunId:s,onSelectRun:r,onNewRun:o,isMobile:n,isOpen:i,onClose:a}){const{theme:c,toggleTheme:m}=mt(),d=[...t].sort((l,x)=>new Date(x.start_time??0).getTime()-new Date(l.start_time??0).getTime());return n?i?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-50",style:{background:"rgba(0,0,0,0.5)"},onClick:a}),e.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:[e.jsxs("div",{className:"px-3 h-10 border-b border-[var(--border)] flex items-center justify-between",children:[e.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 cursor-pointer transition-opacity hover:opacity-80",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("rect",{width:"24",height:"24",rx:"4",fill:"var(--accent)"}),e.jsx("text",{x:"12",y:"17",textAnchor:"middle",fill:"white",fontSize:"14",fontWeight:"700",fontFamily:"Arial, sans-serif",children:"U"})]}),e.jsx("span",{className:"text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"Dev Console"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:m,className:"w-6 h-6 flex items-center justify-center rounded cursor-pointer transition-colors",style:{color:"var(--text-muted)"},title:`Switch to ${c==="dark"?"light":"dark"} theme`,children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:c==="dark"?e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"5"}),e.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),e.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),e.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),e.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),e.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),e.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),e.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),e.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]}):e.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})}),e.jsx("button",{onClick:a,className:"w-6 h-6 flex items-center justify-center rounded cursor-pointer transition-colors",style:{color:"var(--text-muted)"},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsx("button",{onClick:o,className:"mx-3 mt-2.5 mb-1 px-2 py-1.5 text-[10px] uppercase tracking-wider font-semibold rounded border border-[var(--border)] bg-transparent transition-colors cursor-pointer",style:{color:"var(--text-muted)"},children:"+ New Run"}),e.jsx("div",{className:"px-3 pt-3 pb-1 text-[10px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"History"}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[d.map(l=>e.jsx(xe,{run:l,isSelected:l.id===s,onClick:()=>r(l.id)},l.id)),d.length===0&&e.jsx("p",{className:"text-xs px-3 py-4 text-center",style:{color:"var(--text-muted)"},children:"No runs yet"})]})]})]}):null:e.jsxs("aside",{className:"w-44 bg-[var(--sidebar-bg)] border-r border-[var(--border)] flex flex-col",children:[e.jsxs("div",{className:"px-3 h-10 border-b border-[var(--border)] flex items-center justify-between",children:[e.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 cursor-pointer transition-opacity hover:opacity-80",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("rect",{width:"24",height:"24",rx:"4",fill:"var(--accent)"}),e.jsx("text",{x:"12",y:"17",textAnchor:"middle",fill:"white",fontSize:"14",fontWeight:"700",fontFamily:"Arial, sans-serif",children:"U"})]}),e.jsx("span",{className:"text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"Dev Console"})]}),e.jsx("button",{onClick:m,className:"w-6 h-6 flex items-center justify-center rounded cursor-pointer transition-colors",style:{color:"var(--text-muted)"},onMouseEnter:l=>{l.currentTarget.style.color="var(--text-primary)"},onMouseLeave:l=>{l.currentTarget.style.color="var(--text-muted)"},title:`Switch to ${c==="dark"?"light":"dark"} theme`,children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:c==="dark"?e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"5"}),e.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),e.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),e.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),e.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),e.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),e.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),e.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),e.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]}):e.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})})]}),e.jsx("button",{onClick:o,className:"mx-3 mt-2.5 mb-1 px-2 py-1 text-[10px] uppercase tracking-wider font-semibold rounded border border-[var(--border)] bg-transparent transition-colors cursor-pointer",style:{color:"var(--text-muted)"},onMouseEnter:l=>{l.currentTarget.style.color="var(--text-primary)",l.currentTarget.style.borderColor="var(--text-muted)"},onMouseLeave:l=>{l.currentTarget.style.color="var(--text-muted)",l.currentTarget.style.borderColor="var(--border)"},children:"+ New Run"}),e.jsx("div",{className:"px-3 pt-3 pb-1 text-[10px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"History"}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[d.map(l=>e.jsx(xe,{run:l,isSelected:l.id===s,onClick:()=>r(l.id)},l.id)),d.length===0&&e.jsx("p",{className:"text-xs px-3 py-4 text-center",style:{color:"var(--text-muted)"},children:"No runs yet"})]})]})}function vt(){const{navigate:t}=Pe(),s=W(d=>d.entrypoints),[r,o]=h.useState(""),[n,i]=h.useState(!0),[a,c]=h.useState(null);h.useEffect(()=>{!r&&s.length>0&&o(s[0])},[s,r]),h.useEffect(()=>{r&&(i(!0),c(null),at(r).then(d=>{var x;const l=(x=d.input)==null?void 0:x.properties;i(!!(l!=null&&l.messages))}).catch(d=>{const l=d.detail||{};c(l.error||l.message||`Failed to load entrypoint "${r}"`)}))},[r]);const m=d=>{r&&t(`#/setup/${encodeURIComponent(r)}/${d}`)};return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"w-full max-w-xl px-6",children:[e.jsxs("div",{className:"mb-8 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:a?"var(--error)":"var(--accent)"}}),e.jsx("span",{className:"text-xs uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"New Run"})]}),!a&&e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:s.length>1?"Select an entrypoint and choose a mode":"Choose a mode"})]}),s.length>1&&e.jsxs("div",{className:"mb-8",children:[e.jsx("label",{className:"block text-[10px] uppercase tracking-wider font-semibold mb-2",style:{color:"var(--text-muted)"},children:"Entrypoint"}),e.jsx("select",{value:r,onChange:d=>o(d.target.value),className:"w-full rounded-md px-3 py-1.5 text-xs font-mono cursor-pointer appearance-auto",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)",color:"var(--text-primary)"},children:s.map(d=>e.jsx("option",{value:d,children:d},d))})]}),a?e.jsxs("div",{className:"rounded-md border overflow-hidden",style:{borderColor:"color-mix(in srgb, var(--error) 25%, var(--border))",background:"var(--bg-secondary)"},children:[e.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:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:e.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)"})}),e.jsx("span",{className:"text-[11px] font-medium",style:{color:"var(--error)"},children:"Failed to load entrypoint"})]}),e.jsx("div",{className:"overflow-auto max-h-48 p-3",children:e.jsx("pre",{className:"text-[11px] font-mono whitespace-pre-wrap break-words leading-relaxed m-0",style:{color:"var(--text-muted)"},children:a})})]}):e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(me,{title:"Autonomous",description:"Run the agent end-to-end. Set breakpoints to pause and inspect execution.",icon:e.jsx(yt,{}),color:"var(--success)",onClick:()=>m("run"),disabled:!r}),e.jsx(me,{title:"Conversational",description:n?"Interactive chat session. Send messages and receive responses in real time.":'Requires a "messages" property in the input schema.',icon:e.jsx(bt,{}),color:"var(--accent)",onClick:()=>m("chat"),disabled:!r||!n})]})]})})}function me({title:t,description:s,icon:r,color:o,onClick:n,disabled:i}){return e.jsxs("button",{onClick:n,disabled:i,className:"group flex flex-col items-center text-center p-6 rounded-lg border transition-all cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed",style:{background:"var(--bg-secondary)",borderColor:"var(--border)"},onMouseEnter:a=>{i||(a.currentTarget.style.borderColor=o,a.currentTarget.style.background=`color-mix(in srgb, ${o} 5%, var(--bg-secondary))`)},onMouseLeave:a=>{a.currentTarget.style.borderColor="var(--border)",a.currentTarget.style.background="var(--bg-secondary)"},children:[e.jsx("div",{className:"mb-4 p-3 rounded-xl transition-colors",style:{background:`color-mix(in srgb, ${o} 10%, var(--bg-primary))`,color:o},children:r}),e.jsx("h3",{className:"text-sm font-semibold mb-1.5",style:{color:"var(--text-primary)"},children:t}),e.jsx("p",{className:"text-xs leading-relaxed",style:{color:"var(--text-muted)"},children:s})]})}function yt(){return e.jsx("svg",{width:"28",height:"28",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.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 bt(){return e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.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"}),e.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"}),e.jsx("ellipse",{cx:"12.9987",cy:"4.33268",rx:"2.16667",ry:"2.16667",fill:"currentColor"}),e.jsx("rect",{x:"11.918",y:"5.41602",width:"2.16667",height:"2.16667",fill:"currentColor"}),e.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"}),e.jsx("rect",{x:"3.25",y:"15.166",width:"2.16667",height:"1.08333",fill:"currentColor"}),e.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"}),e.jsx("rect",{x:"20.582",y:"15.166",width:"2.16667",height:"1.08333",fill:"currentColor"})]})}const jt="modulepreload",wt=function(t){return"/"+t},ge={},He=function(s,r,o){let n=Promise.resolve();if(r&&r.length>0){let a=function(d){return Promise.all(d.map(l=>Promise.resolve(l).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),m=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));n=a(r.map(d=>{if(d=wt(d),d in ge)return;ge[d]=!0;const l=d.endsWith(".css"),x=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${x}`))return;const j=document.createElement("link");if(j.rel=l?"stylesheet":jt,l||(j.as="script"),j.crossOrigin="",j.href=d,m&&j.setAttribute("nonce",m),document.head.appendChild(j),l)return new Promise((y,E)=>{j.addEventListener("load",y),j.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${d}`)))})}))}function i(a){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=a,window.dispatchEvent(c),!c.defaultPrevented)throw a}return n.then(a=>{for(const c of a||[])c.status==="rejected"&&i(c.reason);return s().catch(i)})},kt={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Nt({data:t}){const s=t.status,r=t.nodeWidth,o=t.label??"Start",n=t.hasBreakpoint,i=t.isPausedHere,a=t.isActiveNode,c=t.isExecutingNode,m=i?"var(--error)":c?"var(--success)":a?"var(--accent)":s==="completed"?"var(--success)":s==="running"?"var(--warning)":"var(--node-border)",d=i?"var(--error)":c?"var(--success)":"var(--accent)";return e.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:r,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${m}`,boxShadow:i||a||c?`0 0 4px ${d}`:void 0,animation:i||a||c?`node-pulse-${i?"red":c?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:o,children:[n&&e.jsx("div",{className:"absolute",style:{top:2,left:2,width:12,height:12,borderRadius:"50%",background:"var(--error)",border:"2px solid var(--node-bg)",boxShadow:"0 0 4px var(--error)"}}),o,e.jsx(Y,{type:"source",position:X.Bottom,style:kt})]})}const St={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Et({data:t}){const s=t.status,r=t.nodeWidth,o=t.label??"End",n=t.hasBreakpoint,i=t.isPausedHere,a=t.isActiveNode,c=t.isExecutingNode,m=i?"var(--error)":c?"var(--success)":a?"var(--accent)":s==="completed"?"var(--success)":s==="failed"?"var(--error)":"var(--node-border)",d=i?"var(--error)":c?"var(--success)":"var(--accent)";return e.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:r,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${m}`,boxShadow:i||a||c?`0 0 4px ${d}`:void 0,animation:i||a||c?`node-pulse-${i?"red":c?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:o,children:[n&&e.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)"}}),e.jsx(Y,{type:"target",position:X.Top,style:St}),o]})}const fe={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Ct({data:t}){const s=t.status,r=t.nodeWidth,o=t.model_name,n=t.label??"Model",i=t.hasBreakpoint,a=t.isPausedHere,c=t.isActiveNode,m=t.isExecutingNode,d=a?"var(--error)":m?"var(--success)":c?"var(--accent)":s==="completed"?"var(--success)":s==="running"?"var(--warning)":s==="failed"?"var(--error)":"var(--node-border)",l=a?"var(--error)":m?"var(--success)":"var(--accent)";return e.jsxs("div",{className:"px-3 py-1.5 rounded-lg text-center text-xs overflow-hidden cursor-pointer relative",style:{width:r,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${d}`,boxShadow:a||c||m?`0 0 4px ${l}`:void 0,animation:a||c||m?`node-pulse-${a?"red":m?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:o?`${n} +`).trim(),x=(i.toolCalls??i.tool_calls??[]).map(k=>({name:k.name??"",has_result:!!k.result})),j={message_id:a,role:c,content:l,tool_calls:x.length>0?x:void 0},y=n.findIndex(k=>k.message_id===a);if(y>=0)return{chatMessages:{...o.chatMessages,[s]:n.map((k,w)=>w===y?j:k)}};if(c==="user"){const k=n.findIndex(w=>w.message_id.startsWith("local-")&&w.role==="user"&&w.content===l);if(k>=0)return{chatMessages:{...o.chatMessages,[s]:n.map((w,$)=>$===k?j:w)}}}const E=[...n,j];return{chatMessages:{...o.chatMessages,[s]:E}}}),addLocalChatMessage:(s,r)=>t(o=>{const n=o.chatMessages[s]??[];return{chatMessages:{...o.chatMessages,[s]:[...n,r]}}}),setChatMessages:(s,r)=>t(o=>({chatMessages:{...o.chatMessages,[s]:r}})),setEntrypoints:s=>t({entrypoints:s}),breakpoints:{},toggleBreakpoint:(s,r)=>t(o=>{const n={...o.breakpoints[s]??{}};return n[r]?delete n[r]:n[r]=!0,{breakpoints:{...o.breakpoints,[s]:n}}}),clearBreakpoints:s=>t(r=>{const{[s]:o,...n}=r.breakpoints;return{breakpoints:n}}),activeNodes:{},setActiveNode:(s,r,o)=>t(n=>{const i=n.activeNodes[s]??{executing:{},prev:null};return{activeNodes:{...n.activeNodes,[s]:{executing:{...i.executing,[r]:o??null},prev:i.prev}}}}),removeActiveNode:(s,r)=>t(o=>{const n=o.activeNodes[s];if(!n)return o;const{[r]:i,...a}=n.executing;return{activeNodes:{...o.activeNodes,[s]:{executing:a,prev:r}}}}),resetRunGraphState:s=>t(r=>({stateEvents:{...r.stateEvents,[s]:[]},activeNodes:{...r.activeNodes,[s]:{executing:{},prev:null}}})),stateEvents:{},addStateEvent:(s,r,o,n,i)=>t(a=>{const c=a.stateEvents[s]??[];return{stateEvents:{...a.stateEvents,[s]:[...c,{node_name:r,qualified_node_name:n,phase:i,timestamp:Date.now(),payload:o}]}}}),setStateEvents:(s,r)=>t(o=>({stateEvents:{...o.stateEvents,[s]:r}})),focusedSpan:null,setFocusedSpan:s=>t({focusedSpan:s}),activeInterrupt:{},setActiveInterrupt:(s,r)=>t(o=>({activeInterrupt:{...o.activeInterrupt,[s]:r}})),reloadPending:!1,setReloadPending:s=>t({reloadPending:s}),graphCache:{},setGraphCache:(s,r)=>t(o=>({graphCache:{...o.graphCache,[s]:r}}))}));class rt{constructor(s){K(this,"ws",null);K(this,"url");K(this,"handlers",new Set);K(this,"reconnectTimer",null);K(this,"shouldReconnect",!0);K(this,"pendingMessages",[]);K(this,"activeSubscriptions",new Set);const r=window.location.protocol==="https:"?"wss:":"ws:";this.url=s??`${r}//${window.location.host}/ws`}connect(){var s;((s=this.ws)==null?void 0:s.readyState)!==WebSocket.OPEN&&(this.ws=new WebSocket(this.url),this.ws.onopen=()=>{console.log("[ws] connected");for(const r of this.activeSubscriptions)this.sendRaw(JSON.stringify({type:"subscribe",payload:{run_id:r}}));for(const r of this.pendingMessages)this.sendRaw(r);this.pendingMessages=[]},this.ws.onmessage=r=>{let o;try{o=JSON.parse(r.data)}catch{console.warn("[ws] failed to parse message",r.data);return}this.handlers.forEach(n=>{try{n(o)}catch(i){console.error("[ws] handler error",i)}})},this.ws.onclose=()=>{console.log("[ws] disconnected"),this.shouldReconnect&&(this.reconnectTimer=setTimeout(()=>this.connect(),2e3))},this.ws.onerror=()=>{var r;(r=this.ws)==null||r.close()})}disconnect(){var s;this.shouldReconnect=!1,this.reconnectTimer&&clearTimeout(this.reconnectTimer),(s=this.ws)==null||s.close(),this.ws=null}onMessage(s){return this.handlers.add(s),()=>this.handlers.delete(s)}sendRaw(s){var r;((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN&&this.ws.send(s)}send(s,r){var n;const o=JSON.stringify({type:s,payload:r});((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN?this.ws.send(o):this.pendingMessages.push(o)}subscribe(s){this.activeSubscriptions.add(s),this.send("subscribe",{run_id:s})}unsubscribe(s){this.activeSubscriptions.delete(s),this.send("unsubscribe",{run_id:s})}sendChatMessage(s,r){this.send("chat.message",{run_id:s,text:r})}sendInterruptResponse(s,r){this.send("chat.interrupt_response",{run_id:s,data:r})}debugStep(s){this.send("debug.step",{run_id:s})}debugContinue(s){this.send("debug.continue",{run_id:s})}debugStop(s){this.send("debug.stop",{run_id:s})}setBreakpoints(s,r){this.send("debug.set_breakpoints",{run_id:s,breakpoints:r})}}let oe=null;function ot(){return oe||(oe=new rt,oe.connect()),oe}function nt(){const t=h.useRef(ot()),{upsertRun:s,addTrace:r,addLog:o,addChatEvent:n,setActiveInterrupt:i,setActiveNode:a,removeActiveNode:c,resetRunGraphState:m,addStateEvent:d,setReloadPending:l}=W();return h.useEffect(()=>t.current.onMessage(y=>{switch(y.type){case"run.updated":s(y.payload);break;case"trace":r(y.payload);break;case"log":o(y.payload);break;case"chat":{const E=y.payload.run_id;n(E,y.payload);break}case"chat.interrupt":{const E=y.payload.run_id;i(E,y.payload);break}case"state":{const E=y.payload.run_id,k=y.payload.node_name,w=y.payload.qualified_node_name??null,$=y.payload.phase??null,B=y.payload.payload;k==="__start__"&&$==="started"&&m(E),$==="started"?a(E,k,w):$==="completed"&&c(E,k),d(E,k,B,w,$);break}case"reload":l(!0);break}}),[s,r,o,n,i,a,c,m,d,l]),t.current}const Z="/api";async function Q(t,s){const r=await fetch(t,s);if(!r.ok){let o;try{o=(await r.json()).detail||r.statusText}catch{o=r.statusText}const n=new Error(`HTTP ${r.status}`);throw n.detail=o,n.status=r.status,n}return r.json()}async function Ie(){return Q(`${Z}/entrypoints`)}async function at(t){return Q(`${Z}/entrypoints/${encodeURIComponent(t)}/schema`)}async function it(t){return Q(`${Z}/entrypoints/${encodeURIComponent(t)}/mock-input`)}async function ct(t){return Q(`${Z}/entrypoints/${encodeURIComponent(t)}/graph`)}async function pe(t,s,r="run",o=[]){return Q(`${Z}/runs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entrypoint:t,input_data:s,mode:r,breakpoints:o})})}async function lt(){return Q(`${Z}/runs`)}async function ae(t){return Q(`${Z}/runs/${t}`)}async function dt(){return Q(`${Z}/reload`,{method:"POST"})}function ut(t){const s=t.replace(/^#\/?/,"");if(!s||s==="new")return{view:"new",runId:null,tab:"traces",setupEntrypoint:null,setupMode:null};const r=s.match(/^setup\/([^/]+)\/(run|chat)$/);if(r)return{view:"setup",runId:null,tab:"traces",setupEntrypoint:decodeURIComponent(r[1]),setupMode:r[2]};const o=s.match(/^runs\/([^/]+)(?:\/(traces|output))?$/);return o?{view:"details",runId:o[1],tab:o[2]??"traces",setupEntrypoint:null,setupMode:null}:{view:"new",runId:null,tab:"traces",setupEntrypoint:null,setupMode:null}}function pt(){return window.location.hash}function ht(t){return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)}function Pe(){const t=h.useSyncExternalStore(ht,pt),s=ut(t),r=h.useCallback(o=>{window.location.hash=o},[]);return{...s,navigate:r}}const he="(max-width: 767px)";function xt(){const[t,s]=h.useState(()=>window.matchMedia(he).matches);return h.useEffect(()=>{const r=window.matchMedia(he),o=n=>s(n.matches);return r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[]),t}function We(){const t=localStorage.getItem("uipath-dev-theme");return t==="light"||t==="dark"?t:"dark"}function Oe(t){document.documentElement.setAttribute("data-theme",t),localStorage.setItem("uipath-dev-theme",t)}Oe(We());const mt=$e(t=>({theme:We(),toggleTheme:()=>t(s=>{const r=s.theme==="dark"?"light":"dark";return Oe(r),{theme:r}})})),gt={pending:"var(--text-muted)",running:"var(--warning)",suspended:"var(--info)",completed:"var(--success)",failed:"var(--error)"};function xe({run:t,isSelected:s,onClick:r}){var a;const o=gt[t.status]??"var(--text-muted)",n=((a=t.entrypoint.split("/").pop())==null?void 0:a.slice(0,16))??t.entrypoint,i=t.start_time?new Date(t.start_time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"";return e.jsxs("button",{onClick:r,className:"w-full text-left px-3 py-1.5 flex items-center gap-2 transition-colors cursor-pointer",style:{background:s?"color-mix(in srgb, var(--accent) 8%, var(--bg-primary))":void 0,borderLeft:s?"2px solid var(--accent)":"2px solid transparent"},onMouseEnter:c=>{s||(c.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:c=>{s||(c.currentTarget.style.background="")},children:[e.jsx("span",{className:"shrink-0 w-1.5 h-1.5 rounded-full",style:{background:o}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xs truncate",style:{color:s?"var(--text-primary)":"var(--text-secondary)"},children:n}),e.jsxs("div",{className:"text-[10px] tabular-nums",style:{color:"var(--text-muted)"},children:[i,t.duration?` · ${t.duration}`:""]})]})]})}function ft({runs:t,selectedRunId:s,onSelectRun:r,onNewRun:o,isMobile:n,isOpen:i,onClose:a}){const{theme:c,toggleTheme:m}=mt(),d=[...t].sort((l,x)=>new Date(x.start_time??0).getTime()-new Date(l.start_time??0).getTime());return n?i?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-50",style:{background:"rgba(0,0,0,0.5)"},onClick:a}),e.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:[e.jsxs("div",{className:"px-3 h-10 border-b border-[var(--border)] flex items-center justify-between",children:[e.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 cursor-pointer transition-opacity hover:opacity-80",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("rect",{width:"24",height:"24",rx:"4",fill:"var(--accent)"}),e.jsx("text",{x:"12",y:"17",textAnchor:"middle",fill:"white",fontSize:"14",fontWeight:"700",fontFamily:"Arial, sans-serif",children:"U"})]}),e.jsx("span",{className:"text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"Dev Console"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:m,className:"w-6 h-6 flex items-center justify-center rounded cursor-pointer transition-colors",style:{color:"var(--text-muted)"},title:`Switch to ${c==="dark"?"light":"dark"} theme`,children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:c==="dark"?e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"5"}),e.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),e.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),e.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),e.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),e.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),e.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),e.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),e.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]}):e.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})}),e.jsx("button",{onClick:a,className:"w-6 h-6 flex items-center justify-center rounded cursor-pointer transition-colors",style:{color:"var(--text-muted)"},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsx("button",{onClick:o,className:"mx-3 mt-2.5 mb-1 px-2 py-1.5 text-[10px] uppercase tracking-wider font-semibold rounded border border-[var(--border)] bg-transparent transition-colors cursor-pointer",style:{color:"var(--text-muted)"},children:"+ New Run"}),e.jsx("div",{className:"px-3 pt-3 pb-1 text-[10px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"History"}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[d.map(l=>e.jsx(xe,{run:l,isSelected:l.id===s,onClick:()=>r(l.id)},l.id)),d.length===0&&e.jsx("p",{className:"text-xs px-3 py-4 text-center",style:{color:"var(--text-muted)"},children:"No runs yet"})]}),e.jsx("div",{className:"px-3 h-10 border-t border-[var(--border)] flex items-center justify-center",children:e.jsxs("a",{href:"https://github.com/UiPath/uipath-dev-python",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-[11px] uppercase tracking-widest font-semibold transition-opacity hover:opacity-80",style:{color:"var(--text-muted)"},children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:e.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"})}),"GitHub"]})})]})]}):null:e.jsxs("aside",{className:"w-44 bg-[var(--sidebar-bg)] border-r border-[var(--border)] flex flex-col",children:[e.jsxs("div",{className:"px-3 h-10 border-b border-[var(--border)] flex items-center justify-between",children:[e.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 cursor-pointer transition-opacity hover:opacity-80",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("rect",{width:"24",height:"24",rx:"4",fill:"var(--accent)"}),e.jsx("text",{x:"12",y:"17",textAnchor:"middle",fill:"white",fontSize:"14",fontWeight:"700",fontFamily:"Arial, sans-serif",children:"U"})]}),e.jsx("span",{className:"text-[11px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"Dev Console"})]}),e.jsx("button",{onClick:m,className:"w-6 h-6 flex items-center justify-center rounded cursor-pointer transition-colors",style:{color:"var(--text-muted)"},onMouseEnter:l=>{l.currentTarget.style.color="var(--text-primary)"},onMouseLeave:l=>{l.currentTarget.style.color="var(--text-muted)"},title:`Switch to ${c==="dark"?"light":"dark"} theme`,children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:c==="dark"?e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"5"}),e.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),e.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),e.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),e.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),e.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),e.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),e.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),e.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]}):e.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})})]}),e.jsx("button",{onClick:o,className:"mx-3 mt-2.5 mb-1 px-2 py-1 text-[10px] uppercase tracking-wider font-semibold rounded border border-[var(--border)] bg-transparent transition-colors cursor-pointer",style:{color:"var(--text-muted)"},onMouseEnter:l=>{l.currentTarget.style.color="var(--text-primary)",l.currentTarget.style.borderColor="var(--text-muted)"},onMouseLeave:l=>{l.currentTarget.style.color="var(--text-muted)",l.currentTarget.style.borderColor="var(--border)"},children:"+ New Run"}),e.jsx("div",{className:"px-3 pt-3 pb-1 text-[10px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"History"}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[d.map(l=>e.jsx(xe,{run:l,isSelected:l.id===s,onClick:()=>r(l.id)},l.id)),d.length===0&&e.jsx("p",{className:"text-xs px-3 py-4 text-center",style:{color:"var(--text-muted)"},children:"No runs yet"})]}),e.jsx("div",{className:"px-3 h-10 border-t border-[var(--border)] flex items-center justify-center",children:e.jsxs("a",{href:"https://github.com/UiPath/uipath-dev-python",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-[11px] uppercase tracking-widest font-semibold transition-opacity hover:opacity-80",style:{color:"var(--text-muted)"},children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:e.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"})}),"GitHub"]})})]})}function vt(){const{navigate:t}=Pe(),s=W(d=>d.entrypoints),[r,o]=h.useState(""),[n,i]=h.useState(!0),[a,c]=h.useState(null);h.useEffect(()=>{!r&&s.length>0&&o(s[0])},[s,r]),h.useEffect(()=>{r&&(i(!0),c(null),at(r).then(d=>{var x;const l=(x=d.input)==null?void 0:x.properties;i(!!(l!=null&&l.messages))}).catch(d=>{const l=d.detail||{};c(l.error||l.message||`Failed to load entrypoint "${r}"`)}))},[r]);const m=d=>{r&&t(`#/setup/${encodeURIComponent(r)}/${d}`)};return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"w-full max-w-xl px-6",children:[e.jsxs("div",{className:"mb-8 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:a?"var(--error)":"var(--accent)"}}),e.jsx("span",{className:"text-xs uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"New Run"})]}),!a&&e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:s.length>1?"Select an entrypoint and choose a mode":"Choose a mode"})]}),s.length>1&&e.jsxs("div",{className:"mb-8",children:[e.jsx("label",{className:"block text-[10px] uppercase tracking-wider font-semibold mb-2",style:{color:"var(--text-muted)"},children:"Entrypoint"}),e.jsx("select",{value:r,onChange:d=>o(d.target.value),className:"w-full rounded-md px-3 py-1.5 text-xs font-mono cursor-pointer appearance-auto",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)",color:"var(--text-primary)"},children:s.map(d=>e.jsx("option",{value:d,children:d},d))})]}),a?e.jsxs("div",{className:"rounded-md border overflow-hidden",style:{borderColor:"color-mix(in srgb, var(--error) 25%, var(--border))",background:"var(--bg-secondary)"},children:[e.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:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:e.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)"})}),e.jsx("span",{className:"text-[11px] font-medium",style:{color:"var(--error)"},children:"Failed to load entrypoint"})]}),e.jsx("div",{className:"overflow-auto max-h-48 p-3",children:e.jsx("pre",{className:"text-[11px] font-mono whitespace-pre-wrap break-words leading-relaxed m-0",style:{color:"var(--text-muted)"},children:a})})]}):e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(me,{title:"Autonomous",description:"Run the agent end-to-end. Set breakpoints to pause and inspect execution.",icon:e.jsx(yt,{}),color:"var(--success)",onClick:()=>m("run"),disabled:!r}),e.jsx(me,{title:"Conversational",description:n?"Interactive chat session. Send messages and receive responses in real time.":'Requires a "messages" property in the input schema.',icon:e.jsx(bt,{}),color:"var(--accent)",onClick:()=>m("chat"),disabled:!r||!n})]})]})})}function me({title:t,description:s,icon:r,color:o,onClick:n,disabled:i}){return e.jsxs("button",{onClick:n,disabled:i,className:"group flex flex-col items-center text-center p-6 rounded-lg border transition-all cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed",style:{background:"var(--bg-secondary)",borderColor:"var(--border)"},onMouseEnter:a=>{i||(a.currentTarget.style.borderColor=o,a.currentTarget.style.background=`color-mix(in srgb, ${o} 5%, var(--bg-secondary))`)},onMouseLeave:a=>{a.currentTarget.style.borderColor="var(--border)",a.currentTarget.style.background="var(--bg-secondary)"},children:[e.jsx("div",{className:"mb-4 p-3 rounded-xl transition-colors",style:{background:`color-mix(in srgb, ${o} 10%, var(--bg-primary))`,color:o},children:r}),e.jsx("h3",{className:"text-sm font-semibold mb-1.5",style:{color:"var(--text-primary)"},children:t}),e.jsx("p",{className:"text-xs leading-relaxed",style:{color:"var(--text-muted)"},children:s})]})}function yt(){return e.jsx("svg",{width:"28",height:"28",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.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 bt(){return e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.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"}),e.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"}),e.jsx("ellipse",{cx:"12.9987",cy:"4.33268",rx:"2.16667",ry:"2.16667",fill:"currentColor"}),e.jsx("rect",{x:"11.918",y:"5.41602",width:"2.16667",height:"2.16667",fill:"currentColor"}),e.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"}),e.jsx("rect",{x:"3.25",y:"15.166",width:"2.16667",height:"1.08333",fill:"currentColor"}),e.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"}),e.jsx("rect",{x:"20.582",y:"15.166",width:"2.16667",height:"1.08333",fill:"currentColor"})]})}const jt="modulepreload",wt=function(t){return"/"+t},ge={},He=function(s,r,o){let n=Promise.resolve();if(r&&r.length>0){let a=function(d){return Promise.all(d.map(l=>Promise.resolve(l).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),m=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));n=a(r.map(d=>{if(d=wt(d),d in ge)return;ge[d]=!0;const l=d.endsWith(".css"),x=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${x}`))return;const j=document.createElement("link");if(j.rel=l?"stylesheet":jt,l||(j.as="script"),j.crossOrigin="",j.href=d,m&&j.setAttribute("nonce",m),document.head.appendChild(j),l)return new Promise((y,E)=>{j.addEventListener("load",y),j.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${d}`)))})}))}function i(a){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=a,window.dispatchEvent(c),!c.defaultPrevented)throw a}return n.then(a=>{for(const c of a||[])c.status==="rejected"&&i(c.reason);return s().catch(i)})},kt={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Nt({data:t}){const s=t.status,r=t.nodeWidth,o=t.label??"Start",n=t.hasBreakpoint,i=t.isPausedHere,a=t.isActiveNode,c=t.isExecutingNode,m=i?"var(--error)":c?"var(--success)":a?"var(--accent)":s==="completed"?"var(--success)":s==="running"?"var(--warning)":"var(--node-border)",d=i?"var(--error)":c?"var(--success)":"var(--accent)";return e.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:r,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${m}`,boxShadow:i||a||c?`0 0 4px ${d}`:void 0,animation:i||a||c?`node-pulse-${i?"red":c?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:o,children:[n&&e.jsx("div",{className:"absolute",style:{top:2,left:2,width:12,height:12,borderRadius:"50%",background:"var(--error)",border:"2px solid var(--node-bg)",boxShadow:"0 0 4px var(--error)"}}),o,e.jsx(Y,{type:"source",position:X.Bottom,style:kt})]})}const St={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Et({data:t}){const s=t.status,r=t.nodeWidth,o=t.label??"End",n=t.hasBreakpoint,i=t.isPausedHere,a=t.isActiveNode,c=t.isExecutingNode,m=i?"var(--error)":c?"var(--success)":a?"var(--accent)":s==="completed"?"var(--success)":s==="failed"?"var(--error)":"var(--node-border)",d=i?"var(--error)":c?"var(--success)":"var(--accent)";return e.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:r,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${m}`,boxShadow:i||a||c?`0 0 4px ${d}`:void 0,animation:i||a||c?`node-pulse-${i?"red":c?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:o,children:[n&&e.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)"}}),e.jsx(Y,{type:"target",position:X.Top,style:St}),o]})}const fe={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Ct({data:t}){const s=t.status,r=t.nodeWidth,o=t.model_name,n=t.label??"Model",i=t.hasBreakpoint,a=t.isPausedHere,c=t.isActiveNode,m=t.isExecutingNode,d=a?"var(--error)":m?"var(--success)":c?"var(--accent)":s==="completed"?"var(--success)":s==="running"?"var(--warning)":s==="failed"?"var(--error)":"var(--node-border)",l=a?"var(--error)":m?"var(--success)":"var(--accent)";return e.jsxs("div",{className:"px-3 py-1.5 rounded-lg text-center text-xs overflow-hidden cursor-pointer relative",style:{width:r,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${d}`,boxShadow:a||c||m?`0 0 4px ${l}`:void 0,animation:a||c||m?`node-pulse-${a?"red":m?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:o?`${n} ${o}`:n,children:[i&&e.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)"}}),e.jsx(Y,{type:"target",position:X.Top,style:fe}),e.jsx("div",{style:{color:"var(--info)",fontSize:9,marginBottom:1},children:"model"}),e.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:n}),o&&e.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",style:{color:"var(--text-muted)",fontSize:9,marginTop:1},title:o,children:o}),e.jsx(Y,{type:"source",position:X.Bottom,style:fe})]})}const ve={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0},_t=3;function Lt({data:t}){const s=t.status,r=t.nodeWidth,o=t.tool_names,n=t.tool_count,i=t.label??"Tool",a=t.hasBreakpoint,c=t.isPausedHere,m=t.isActiveNode,d=t.isExecutingNode,l=c?"var(--error)":d?"var(--success)":m?"var(--accent)":s==="completed"?"var(--success)":s==="running"?"var(--warning)":s==="failed"?"var(--error)":"var(--node-border)",x=c?"var(--error)":d?"var(--success)":"var(--accent)",j=(o==null?void 0:o.slice(0,_t))??[],y=(n??(o==null?void 0:o.length)??0)-j.length;return e.jsxs("div",{className:"px-3 py-1.5 rounded-lg text-center text-xs overflow-hidden cursor-pointer relative",style:{width:r,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${l}`,boxShadow:c||m||d?`0 0 4px ${x}`:void 0,animation:c||m||d?`node-pulse-${c?"red":d?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:o!=null&&o.length?`${i} ${o.join(` @@ -38,5 +38,5 @@ ${o.join(` 50% { box-shadow: 0 0 10px var(--error); } } `}),e.jsxs(Ye,{nodes:a,edges:d,onNodesChange:m,onEdgesChange:x,nodeTypes:It,edgeTypes:Pt,onInit:u=>{J.current=u},onNodeClick:G,fitView:!0,proOptions:{hideAttribution:!0},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,children:[e.jsx(Xe,{color:"var(--bg-tertiary)",gap:16}),e.jsx(Ke,{showInteractive:!1}),e.jsx(Ze,{position:"top-right",children:e.jsxs("button",{onClick:q,title:z?"Remove all breakpoints":"Set breakpoints on all nodes",style:{background:"var(--bg-secondary)",color:z?"var(--error)":"var(--text-muted)",border:`1px solid ${z?"var(--error)":"var(--node-border)"}`,borderRadius:6,padding:"4px 10px",fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",gap:4},children:[e.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:z?"var(--error)":"var(--node-border)"}}),z?"Clear all":"Break all"]})}),e.jsx(Qe,{nodeColor:u=>{var b;if(u.type==="groupNode")return"var(--bg-tertiary)";const p=(b=u.data)==null?void 0:b.status;return p==="completed"?"var(--success)":p==="running"?"var(--warning)":p==="failed"?"var(--error)":"var(--node-border)"},nodeStrokeWidth:0,style:{background:"var(--bg-secondary)",width:120,height:80}})]})]})}const ee="__setup__";function Vt({entrypoint:t,mode:s,ws:r,onRunCreated:o,isMobile:n}){const[i,a]=h.useState("{}"),[c,m]=h.useState({}),[d,l]=h.useState(!1),[x,j]=h.useState(!0),[y,E]=h.useState(null),[k,w]=h.useState(""),[$,B]=h.useState(0),[J,F]=h.useState(!0),[N,L]=h.useState(()=>{const g=localStorage.getItem("setupTextareaHeight");return g?parseInt(g,10):140}),I=h.useRef(null),[D,G]=h.useState(()=>{const g=localStorage.getItem("setupPanelWidth");return g?parseInt(g,10):380}),z=s==="run";h.useEffect(()=>{j(!0),E(null),it(t).then(g=>{m(g.mock_input),a(JSON.stringify(g.mock_input,null,2))}).catch(g=>{console.error("Failed to load mock input:",g);const S=g.detail||{};E(S.message||`Failed to load schema for "${t}"`),a("{}")}).finally(()=>j(!1))},[t]),h.useEffect(()=>{W.getState().clearBreakpoints(ee)},[]);const q=async()=>{let g;try{g=JSON.parse(i)}catch{alert("Invalid JSON input");return}l(!0);try{const S=W.getState().breakpoints[ee]??{},H=Object.keys(S),f=await pe(t,g,s,H);W.getState().clearBreakpoints(ee),W.getState().upsertRun(f),o(f.id)}catch(S){console.error("Failed to create run:",S)}finally{l(!1)}},R=async()=>{const g=k.trim();if(g){l(!0);try{const S=W.getState().breakpoints[ee]??{},H=Object.keys(S),f=await pe(t,c,"chat",H);W.getState().clearBreakpoints(ee),W.getState().upsertRun(f),W.getState().addLocalChatMessage(f.id,{message_id:`local-${Date.now()}`,role:"user",content:g}),r.sendChatMessage(f.id,g),o(f.id)}catch(S){console.error("Failed to create chat run:",S)}finally{l(!1)}}};h.useEffect(()=>{try{JSON.parse(i),F(!0)}catch{F(!1)}},[i]);const P=h.useCallback(g=>{g.preventDefault();const S="touches"in g?g.touches[0].clientY:g.clientY,H=N,f=C=>{const A="touches"in C?C.touches[0].clientY:C.clientY,O=Math.max(60,H+(S-A));L(O)},_=()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",_),document.removeEventListener("touchmove",f),document.removeEventListener("touchend",_),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("setupTextareaHeight",String(N))};document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",f),document.addEventListener("mouseup",_),document.addEventListener("touchmove",f,{passive:!1}),document.addEventListener("touchend",_)},[N]),u=h.useCallback(g=>{g.preventDefault();const S="touches"in g?g.touches[0].clientX:g.clientX,H=D,f=C=>{const A=I.current;if(!A)return;const O="touches"in C?C.touches[0].clientX:C.clientX,v=A.clientWidth-300,M=Math.max(280,Math.min(v,H+(S-O)));G(M)},_=()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",_),document.removeEventListener("touchmove",f),document.removeEventListener("touchend",_),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("setupPanelWidth",String(D)),B(C=>C+1)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",f),document.addEventListener("mouseup",_),document.addEventListener("touchmove",f,{passive:!1}),document.addEventListener("touchend",_)},[D]),p=z?"Autonomous":"Conversational",b=z?"var(--success)":"var(--accent)",T=e.jsxs("div",{className:"shrink-0 flex flex-col",style:n?{background:"var(--bg-primary)"}:{width:D,background:"var(--bg-primary)"},children:[e.jsxs("div",{className:"px-4 text-xs font-semibold uppercase tracking-wider border-b flex items-center gap-2 h-[33px]",style:{color:"var(--text-muted)",borderColor:"var(--border)",background:"var(--bg-secondary)"},children:[e.jsx("span",{style:{color:b},children:"●"}),p]}),e.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col items-center justify-center gap-4 px-6",children:[e.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:z?e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}):e.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"})}),e.jsxs("div",{className:"text-center space-y-1.5",children:[e.jsx("p",{className:"text-sm font-medium",style:{color:"var(--text-secondary)"},children:z?"Ready to execute":"Ready to chat"}),e.jsxs("p",{className:"text-xs leading-relaxed",style:{color:"var(--text-muted)"},children:["Click nodes to set breakpoints",z?e.jsxs(e.Fragment,{children:[",",e.jsx("br",{}),"configure input below, then run"]}):e.jsxs(e.Fragment,{children:[",",e.jsx("br",{}),"then send your first message"]})]})]})]}),z?e.jsxs("div",{className:"flex flex-col",style:{background:"var(--bg-primary)"},children:[!n&&e.jsx("div",{onMouseDown:P,onTouchStart:P,className:"shrink-0 h-1.5 cursor-row-resize bg-[var(--border)] hover:bg-[var(--accent)] transition-colors"}),e.jsxs("div",{className:"px-4 py-3",children:[y?e.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:y}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"block text-[10px] uppercase tracking-wider font-semibold mb-2",style:{color:"var(--text-muted)"},children:["Input",x&&e.jsx("span",{className:"ml-2 font-normal",children:"Loading..."})]}),e.jsx("textarea",{value:i,onChange:g=>a(g.target.value),spellCheck:!1,className:"w-full rounded-md px-3 py-2 text-xs font-mono leading-relaxed resize-none focus:outline-none mb-3",style:{height:n?120:N,background:"var(--bg-secondary)",border:`1px solid ${J?"var(--border)":"#b91c1c"}`,color:"var(--text-primary)"}})]}),e.jsx("button",{onClick:q,disabled:d||x||!!y,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:b,color:b},onMouseEnter:g=>{d||(g.currentTarget.style.background=`color-mix(in srgb, ${b} 10%, transparent)`)},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:d?"Starting...":e.jsxs(e.Fragment,{children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",children:e.jsx("polygon",{points:"5,3 19,12 5,21"})}),"Execute"]})})]})]}):e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-t",style:{borderColor:"var(--border)"},children:[e.jsx("input",{value:k,onChange:g=>w(g.target.value),onKeyDown:g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),R())},disabled:d||x,placeholder:d?"Starting...":"Message...",className:"flex-1 bg-transparent text-sm py-1 focus:outline-none disabled:opacity-40 placeholder:text-[var(--text-muted)]",style:{color:"var(--text-primary)"}}),e.jsx("button",{onClick:R,disabled:d||x||!k.trim(),className:"text-[11px] uppercase tracking-wider font-semibold px-2 py-1 rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed",style:{color:!d&&k.trim()?"var(--accent)":"var(--text-muted)",background:"transparent"},onMouseEnter:g=>{!d&&k.trim()&&(g.currentTarget.style.background="color-mix(in srgb, var(--accent) 10%, transparent)")},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:"Send"})]})]});return n?e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"shrink-0",style:{height:"40vh"},children:e.jsx(ne,{entrypoint:t,traces:[],runId:ee,fitViewTrigger:$})}),e.jsx("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:T})]}):e.jsxs("div",{ref:I,className:"flex h-full",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(ne,{entrypoint:t,traces:[],runId:ee,fitViewTrigger:$})}),e.jsx("div",{onMouseDown:u,onTouchStart:u,className:"shrink-0 w-1.5 cursor-col-resize bg-[var(--border)] hover:bg-[var(--accent)] transition-colors relative",children:e.jsx("div",{className:"absolute inset-0 -left-1 -right-1"})}),T]})}const Ft={key:"var(--info)",string:"var(--success)",number:"var(--warning)",boolean:"var(--accent)",null:"var(--accent)",punctuation:"var(--text-muted)"};function Ut(t){const s=[],r=/("(?:[^"\\]|\\.)*")\s*:|("(?:[^"\\]|\\.)*")|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)\b|(true|false)\b|(null)\b|([{}[\]:,])/g;let o=0,n;for(;(n=r.exec(t))!==null;){if(n.index>o&&s.push({type:"punctuation",text:t.slice(o,n.index)}),n[1]!==void 0){s.push({type:"key",text:n[1]});const i=t.indexOf(":",n.index+n[1].length);i!==-1&&(i>n.index+n[1].length&&s.push({type:"punctuation",text:t.slice(n.index+n[1].length,i)}),s.push({type:"punctuation",text:":"}),r.lastIndex=i+1)}else n[2]!==void 0?s.push({type:"string",text:n[2]}):n[3]!==void 0?s.push({type:"number",text:n[3]}):n[4]!==void 0?s.push({type:"boolean",text:n[4]}):n[5]!==void 0?s.push({type:"null",text:n[5]}):n[6]!==void 0&&s.push({type:"punctuation",text:n[6]});o=r.lastIndex}return oUt(t),[t]);return e.jsx("pre",{className:s,style:r,children:o.map((n,i)=>e.jsx("span",{style:{color:Ft[n.type]},children:n.text},i))})}const Jt={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"}},Gt={color:"var(--text-muted)",label:"Unknown"};function qt(t){if(typeof t!="string")return null;const s=t.trim();if(s.startsWith("{")&&s.endsWith("}")||s.startsWith("[")&&s.endsWith("]"))try{return JSON.stringify(JSON.parse(s),null,2)}catch{return null}return null}function Yt(t){if(t<1)return`${(t*1e3).toFixed(0)}us`;if(t<1e3)return`${t.toFixed(2)}ms`;if(t<6e4)return`${(t/1e3).toFixed(2)}s`;const s=Math.floor(t/6e4),r=(t%6e4/1e3).toFixed(1);return`${s}m ${r}s`}const Ne=200;function Xt(t){if(typeof t=="string")return t;if(t==null)return String(t);try{return JSON.stringify(t,null,2)}catch{return String(t)}}function Kt({value:t}){const[s,r]=h.useState(!1),o=Xt(t),n=h.useMemo(()=>qt(t),[t]),i=n!==null,a=n??o,c=a.length>Ne||a.includes(` -`),m=h.useCallback(()=>r(d=>!d),[]);return c?e.jsxs("div",{children:[s?i?e.jsx(te,{json:a,className:"font-mono text-[11px] whitespace-pre-wrap break-all",style:{}}):e.jsx("pre",{className:"font-mono text-[11px] whitespace-pre-wrap break-all",style:{color:"var(--text-primary)"},children:a}):e.jsxs("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:[a.slice(0,Ne),"..."]}),e.jsx("button",{onClick:m,className:"text-[10px] cursor-pointer ml-1",style:{color:"var(--info)"},children:s?"[less]":"[more]"})]}):i?e.jsx(te,{json:a,className:"font-mono text-[11px] break-all whitespace-pre-wrap",style:{}}):e.jsx("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:a})}function Zt({span:t}){const[s,r]=h.useState(!0),[o,n]=h.useState(!1),i=Jt[t.status.toLowerCase()]??{...Gt,label:t.status},a=new Date(t.timestamp).toLocaleTimeString(void 0,{hour12:!1,fractionalSecondDigits:3}),c=Object.entries(t.attributes),m=[{label:"Span",value:t.span_id},...t.trace_id?[{label:"Trace",value:t.trace_id}]:[],{label:"Run",value:t.run_id},...t.parent_span_id?[{label:"Parent",value:t.parent_span_id}]:[]];return e.jsxs("div",{className:"overflow-y-auto h-full text-xs leading-normal",children:[e.jsxs("div",{className:"px-2 py-1.5 border-b flex items-center gap-2 flex-wrap",style:{borderColor:"var(--border)",background:"var(--bg-secondary)"},children:[e.jsx("span",{className:"text-xs font-semibold mr-auto",style:{color:"var(--text-primary)"},children:t.span_name}),e.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",style:{background:`color-mix(in srgb, ${i.color} 15%, var(--bg-secondary))`,color:i.color},children:[e.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:i.color}}),i.label]}),t.duration_ms!=null&&e.jsx("span",{className:"shrink-0 font-mono text-[11px] font-semibold",style:{color:"var(--warning)"},children:Yt(t.duration_ms)}),e.jsx("span",{className:"shrink-0 font-mono text-[11px]",style:{color:"var(--text-muted)"},children:a})]}),c.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-2 py-1 text-[10px] uppercase font-bold tracking-wider border-b cursor-pointer flex items-center",style:{color:"var(--accent)",borderColor:"var(--border)",background:"var(--bg-secondary)"},onClick:()=>r(d=>!d),children:[e.jsxs("span",{className:"flex-1",children:["Attributes (",c.length,")"]}),e.jsx("span",{style:{color:"var(--text-muted)",transform:s?"rotate(0deg)":"rotate(-90deg)"},children:"▾"})]}),s&&c.map(([d,l],x)=>e.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:[e.jsx("span",{className:"font-mono font-semibold shrink-0 pt-px truncate text-[11px]",style:{color:"var(--info)",width:"35%"},title:d,children:d}),e.jsx("span",{className:"flex-1 min-w-0",children:e.jsx(Kt,{value:l})})]},d))]}),e.jsxs("div",{className:"px-2 py-1 text-[10px] uppercase font-bold tracking-wider border-b cursor-pointer flex items-center",style:{color:"var(--accent)",borderColor:"var(--border)",background:"var(--bg-secondary)"},onClick:()=>n(d=>!d),children:[e.jsxs("span",{className:"flex-1",children:["Identifiers (",m.length,")"]}),e.jsx("span",{style:{color:"var(--text-muted)",transform:o?"rotate(0deg)":"rotate(-90deg)"},children:"▾"})]}),o&&m.map((d,l)=>e.jsxs("div",{className:"flex gap-2 px-2 py-1 items-start border-b",style:{borderColor:"var(--border)",background:l%2===0?"var(--bg-primary)":"var(--bg-secondary)"},children:[e.jsx("span",{className:"font-mono font-semibold shrink-0 pt-px truncate text-[11px]",style:{color:"var(--info)",width:"35%"},title:d.label,children:d.label}),e.jsx("span",{className:"flex-1 min-w-0",children:e.jsx("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:d.value})})]},d.label))]})}const Qt={started:"var(--info)",running:"var(--warning)",completed:"var(--success)",failed:"var(--error)",error:"var(--error)"};function es({kind:t,statusColor:s}){const r=s,o=14,n={width:o,height:o,viewBox:"0 0 16 16",fill:"none",stroke:r,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"};switch(t){case"LLM":return e.jsx("svg",{...n,children:e.jsx("path",{d:"M8 2L9 5L12 4L10 7L14 8L10 9L12 12L9 11L8 14L7 11L4 12L6 9L2 8L6 7L4 4L7 5Z",fill:r,stroke:"none"})});case"TOOL":return e.jsx("svg",{...n,children:e.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 e.jsxs("svg",{...n,children:[e.jsx("rect",{x:"3",y:"5",width:"10",height:"8",rx:"2"}),e.jsx("circle",{cx:"6",cy:"9",r:"1",fill:r,stroke:"none"}),e.jsx("circle",{cx:"10",cy:"9",r:"1",fill:r,stroke:"none"}),e.jsx("path",{d:"M8 2v3"}),e.jsx("path",{d:"M6 2h4"})]});case"CHAIN":return e.jsxs("svg",{...n,children:[e.jsx("path",{d:"M6.5 9.5L9.5 6.5"}),e.jsx("path",{d:"M4.5 8.5l-1 1a2 2 0 0 0 2.83 2.83l1-1"}),e.jsx("path",{d:"M11.5 7.5l1-1a2 2 0 0 0-2.83-2.83l-1 1"})]});case"RETRIEVER":return e.jsxs("svg",{...n,children:[e.jsx("circle",{cx:"7",cy:"7",r:"4"}),e.jsx("path",{d:"M10 10l3.5 3.5"})]});case"EMBEDDING":return e.jsxs("svg",{...n,children:[e.jsx("rect",{x:"2",y:"2",width:"4",height:"4",rx:"0.5"}),e.jsx("rect",{x:"10",y:"2",width:"4",height:"4",rx:"0.5"}),e.jsx("rect",{x:"2",y:"10",width:"4",height:"4",rx:"0.5"}),e.jsx("rect",{x:"10",y:"10",width:"4",height:"4",rx:"0.5"})]});default:return e.jsx("span",{className:"shrink-0 w-2 h-2 rounded-full",style:{background:s}})}}function ts(t){const s=new Map(t.map(a=>[a.span_id,a])),r=new Map;for(const a of t)if(a.parent_span_id){const c=r.get(a.parent_span_id)??[];c.push(a),r.set(a.parent_span_id,c)}const o=t.filter(a=>a.parent_span_id===null||!s.has(a.parent_span_id));function n(a){const c=(r.get(a.span_id)??[]).sort((m,d)=>m.timestamp.localeCompare(d.timestamp));return{span:a,children:c.map(n)}}return o.sort((a,c)=>a.timestamp.localeCompare(c.timestamp)).map(n).flatMap(a=>a.span.span_name==="root"?a.children:[a])}function ss(t){return t==null?"":t<1e3?`${t.toFixed(0)}ms`:`${(t/1e3).toFixed(2)}s`}function Be(t){return t.map(s=>{const{span:r}=s;return s.children.length>0?{name:r.span_name,children:Be(s.children)}:{name:r.span_name}})}function Se({traces:t}){const[s,r]=h.useState(null),[o,n]=h.useState(new Set),[i,a]=h.useState(()=>{const N=localStorage.getItem("traceTreeSplitWidth");return N?parseFloat(N):50}),[c,m]=h.useState(!1),[d,l]=h.useState(!1),x=ts(t),j=h.useMemo(()=>JSON.stringify(Be(x),null,2),[t]),y=h.useCallback(()=>{navigator.clipboard.writeText(j).then(()=>{l(!0),setTimeout(()=>l(!1),1500)})},[j]),E=W(N=>N.focusedSpan),k=W(N=>N.setFocusedSpan),[w,$]=h.useState(null),B=h.useRef(null),J=h.useCallback(N=>{n(L=>{const I=new Set(L);return I.has(N)?I.delete(N):I.add(N),I})},[]);h.useEffect(()=>{if(s===null)x.length>0&&r(x[0].span);else{const N=t.find(L=>L.span_id===s.span_id);N&&N!==s&&r(N)}},[t]),h.useEffect(()=>{if(!E)return;const L=t.filter(I=>I.span_name===E.name).sort((I,D)=>I.timestamp.localeCompare(D.timestamp))[E.index];if(L){r(L),$(L.span_id);const I=new Map(t.map(D=>[D.span_id,D.parent_span_id]));n(D=>{const G=new Set(D);let z=L.parent_span_id;for(;z;)G.delete(z),z=I.get(z)??null;return G})}k(null)},[E,t,k]),h.useEffect(()=>{if(!w)return;const N=w;$(null),requestAnimationFrame(()=>{const L=B.current,I=L==null?void 0:L.querySelector(`[data-span-id="${N}"]`);L&&I&&I.scrollIntoView({block:"center",behavior:"smooth"})})},[w]),h.useEffect(()=>{if(!c)return;const N=I=>{const D=document.querySelector(".trace-tree-container");if(!D)return;const G=D.getBoundingClientRect(),z=(I.clientX-G.left)/G.width*100,q=Math.max(20,Math.min(80,z));a(q),localStorage.setItem("traceTreeSplitWidth",String(q))},L=()=>{m(!1)};return window.addEventListener("mousemove",N),window.addEventListener("mouseup",L),()=>{window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",L)}},[c]);const F=N=>{N.preventDefault(),m(!0)};return e.jsxs("div",{className:"flex h-full trace-tree-container",style:{cursor:c?"col-resize":void 0},children:[e.jsxs("div",{className:"pr-0.5 pt-0.5 relative",style:{width:`${i}%`},children:[t.length>0&&e.jsx("button",{onClick:y,className:"absolute top-2 left-2 z-20 text-[10px] cursor-pointer px-1.5 py-0.5 rounded transition-opacity",style:{opacity:d?1:.3,color:d?"var(--success)":"var(--text-muted)",background:"var(--bg-secondary)",border:"1px solid var(--border)"},onMouseEnter:N=>{N.currentTarget.style.opacity="1"},onMouseLeave:N=>{d||(N.currentTarget.style.opacity="0.3")},children:d?"Copied!":"Copy JSON"}),e.jsx("div",{ref:B,className:"overflow-y-auto h-full p-0.5",children:x.length===0?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"No traces yet"})}):x.map((N,L)=>e.jsx(De,{node:N,depth:0,selectedId:(s==null?void 0:s.span_id)??null,onSelect:r,isLast:L===x.length-1,collapsedIds:o,toggleExpanded:J},N.span.span_id))})]}),e.jsx("div",{onMouseDown:F,className:"shrink-0 w-1.5 cursor-col-resize bg-[var(--border)] hover:bg-[var(--accent)] transition-colors relative",style:c?{background:"var(--accent)"}:void 0,children:e.jsx("div",{className:"absolute inset-0 -left-1 -right-1"})}),e.jsx("div",{className:"flex-1 overflow-hidden p-0.5",children:s?e.jsx(Zt,{span:s}):e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"Select a span to view details"})})})]})}function De({node:t,depth:s,selectedId:r,onSelect:o,isLast:n,collapsedIds:i,toggleExpanded:a}){var k;const{span:c}=t,m=!i.has(c.span_id),d=Qt[c.status.toLowerCase()]??"var(--text-muted)",l=ss(c.duration_ms),x=c.span_id===r,j=t.children.length>0,y=s*20,E=(k=c.attributes)==null?void 0:k["openinference.span.kind"];return e.jsxs("div",{className:"relative",children:[s>0&&e.jsx("div",{className:"absolute top-0 z-10 pointer-events-none",style:{left:`${y-10}px`,width:"1px",height:n?"16px":"100%",background:"var(--border)"}}),e.jsxs("button",{"data-span-id":c.span_id,onClick:()=>o(c),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:`${y+4}px`,background:x?"color-mix(in srgb, var(--accent) 10%, var(--bg-primary))":void 0,borderLeft:x?"2px solid var(--accent)":"2px solid transparent"},onMouseEnter:w=>{x||(w.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:w=>{x||(w.currentTarget.style.background="")},children:[s>0&&e.jsx("div",{className:"absolute z-10 pointer-events-none",style:{left:`${y-10}px`,top:"50%",width:"10px",height:"1px",background:"var(--border)"}}),j?e.jsx("span",{onClick:w=>{w.stopPropagation(),a(c.span_id)},className:"shrink-0 w-4 h-4 flex items-center justify-center cursor-pointer rounded hover:bg-[var(--bg-hover)]",style:{color:"var(--text-muted)"},children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",style:{transform:m?"rotate(90deg)":"rotate(0deg)"},children:e.jsx("path",{d:"M3 1.5L7 5L3 8.5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})}):e.jsx("span",{className:"shrink-0 w-4"}),e.jsx("span",{className:"shrink-0 flex items-center justify-center w-4 h-4",children:e.jsx(es,{kind:E,statusColor:d})}),e.jsx("span",{className:"text-[var(--text-primary)] truncate min-w-0 flex-1",children:c.span_name}),l&&e.jsx("span",{className:"text-[var(--text-muted)] shrink-0 ml-auto pl-2 tabular-nums",children:l})]}),m&&t.children.map((w,$)=>e.jsx(De,{node:w,depth:s+1,selectedId:r,onSelect:o,isLast:$===t.children.length-1,collapsedIds:i,toggleExpanded:a},w.span.span_id))]})}const rs={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)"}},os={color:"var(--text-muted)",bg:"transparent"};function Ee({logs:t}){const s=h.useRef(null),r=h.useRef(null),[o,n]=h.useState(!1);h.useEffect(()=>{var a;(a=r.current)==null||a.scrollIntoView({behavior:"smooth"})},[t.length]);const i=()=>{const a=s.current;a&&n(a.scrollTop>100)};return t.length===0?e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"No logs yet"})}):e.jsxs("div",{className:"h-full relative",children:[e.jsxs("div",{ref:s,onScroll:i,className:"h-full overflow-y-auto font-mono text-xs leading-normal",children:[t.map((a,c)=>{const m=new Date(a.timestamp).toLocaleTimeString(void 0,{hour12:!1}),d=a.level.toUpperCase(),l=d.slice(0,4),x=rs[d]??os,j=c%2===0;return e.jsxs("div",{className:"flex gap-3 px-3 py-1.5",style:{background:j?"var(--bg-primary)":"var(--bg-secondary)"},children:[e.jsx("span",{className:"text-[var(--text-muted)] shrink-0",children:m}),e.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:x.color,background:x.bg},children:l}),e.jsx("span",{className:"text-[var(--text-primary)] whitespace-pre-wrap break-all",children:a.message})]},c)}),e.jsx("div",{ref:r})]}),o&&e.jsx("button",{onClick:()=>{var a;return(a=s.current)==null?void 0:a.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"})})})]})}const ns={started:{color:"var(--accent)",label:"started"},updated:{color:"var(--info)",label:"updated"},completed:{color:"var(--success)",label:"completed"},faulted:{color:"var(--error)",label:"faulted"}},Ce={color:"var(--text-muted)",label:""};function _e({events:t,runStatus:s}){const r=h.useRef(null),o=h.useRef(!0),[n,i]=h.useState(null),a=()=>{const c=r.current;c&&(o.current=c.scrollHeight-c.scrollTop-c.clientHeight<40)};return h.useEffect(()=>{o.current&&r.current&&(r.current.scrollTop=r.current.scrollHeight)}),t.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:e.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:s==="running"?"Waiting for events...":"No events yet"})}):e.jsx("div",{ref:r,onScroll:a,className:"h-full overflow-y-auto font-mono text-xs leading-normal",children:t.map((c,m)=>{const d=new Date(c.timestamp).toLocaleTimeString(void 0,{hour12:!1}),l=c.payload&&Object.keys(c.payload).length>0,x=n===m,j=c.phase?ns[c.phase]??Ce:Ce;return e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>{l&&i(x?null:m)},className:"flex items-center gap-2 px-3 py-1.5",style:{background:m%2===0?"var(--bg-primary)":"var(--bg-secondary)",cursor:l?"pointer":"default"},children:[e.jsx("span",{className:"shrink-0",style:{color:"var(--text-muted)"},children:d}),e.jsx("span",{className:"shrink-0",style:{color:j.color},children:"●"}),e.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:c.node_name}),j.label&&e.jsx("span",{className:"shrink-0 text-[10px]",style:{color:"var(--text-muted)"},children:j.label}),l&&e.jsx("span",{className:"shrink-0 text-[9px] transition-transform",style:{color:"var(--text-muted)",transform:x?"rotate(90deg)":"rotate(0deg)"},children:"▸"})]}),x&&l&&e.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:e.jsx(te,{json:JSON.stringify(c.payload,null,2),className:"text-[11px] font-mono whitespace-pre-wrap break-words"})})]},m)})})}function Le({runId:t,status:s,ws:r,breakpointNode:o}){const n=s==="suspended",i=a=>{const c=W.getState().breakpoints[t]??{};r.setBreakpoints(t,Object.keys(c)),a==="step"?r.debugStep(t):a==="continue"?r.debugContinue(t):r.debugStop(t)};return e.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:[e.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold mr-1",style:{color:"var(--text-muted)"},children:"Debug"}),e.jsx(ce,{label:"Step",onClick:()=>i("step"),disabled:!n,color:"var(--info)",active:n}),e.jsx(ce,{label:"Continue",onClick:()=>i("continue"),disabled:!n,color:"var(--success)",active:n}),e.jsx(ce,{label:"Stop",onClick:()=>i("stop"),disabled:!n,color:"var(--error)",active:n}),e.jsx("span",{className:"text-[10px] ml-auto truncate",style:{color:n?"var(--accent)":"var(--text-muted)"},children:n?o?`Paused at ${o}`:"Paused":s})]})}function ce({label:t,onClick:s,disabled:r,color:o,active:n}){return e.jsx("button",{onClick:s,disabled:r,className:"px-2.5 py-0.5 h-5 text-[10px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed",style:{color:n?o:"var(--text-muted)",background:n?`color-mix(in srgb, ${o} 10%, transparent)`:"transparent"},onMouseEnter:i=>{r||(i.currentTarget.style.background=`color-mix(in srgb, ${o} 20%, transparent)`)},onMouseLeave:i=>{i.currentTarget.style.background=n?`color-mix(in srgb, ${o} 10%, transparent)`:"transparent"},children:t})}const Te=h.lazy(()=>He(()=>import("./ChatPanel-CJFPD9T1.js"),__vite__mapDeps([2,1,3,4]))),as=[],is=[],cs=[],ls=[];function ds({run:t,ws:s,isMobile:r}){const o=t.mode==="chat",[n,i]=h.useState(280),[a,c]=h.useState(()=>{const u=localStorage.getItem("chatPanelWidth");return u?parseInt(u,10):380}),[m,d]=h.useState("primary"),[l,x]=h.useState(o?"primary":"traces"),[j,y]=h.useState(0),E=h.useRef(null),k=h.useRef(null),w=h.useRef(!1),$=W(u=>u.traces[t.id]||as),B=W(u=>u.logs[t.id]||is),J=W(u=>u.chatMessages[t.id]||cs),F=W(u=>u.stateEvents[t.id]||ls),N=W(u=>u.breakpoints[t.id]);h.useEffect(()=>{s.setBreakpoints(t.id,N?Object.keys(N):[])},[t.id]);const L=h.useCallback(u=>{s.setBreakpoints(t.id,u)},[t.id,s]),I=h.useCallback(u=>{u.preventDefault(),w.current=!0;const p="touches"in u?u.touches[0].clientY:u.clientY,b=n,T=S=>{if(!w.current)return;const H=E.current;if(!H)return;const f="touches"in S?S.touches[0].clientY:S.clientY,_=H.clientHeight-100,C=Math.max(80,Math.min(_,b+(f-p)));i(C)},g=()=>{w.current=!1,document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",g),document.removeEventListener("touchmove",T),document.removeEventListener("touchend",g),document.body.style.cursor="",document.body.style.userSelect="",y(S=>S+1)};document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",T),document.addEventListener("mouseup",g),document.addEventListener("touchmove",T,{passive:!1}),document.addEventListener("touchend",g)},[n]),D=h.useCallback(u=>{u.preventDefault();const p="touches"in u?u.touches[0].clientX:u.clientX,b=a,T=S=>{const H=k.current;if(!H)return;const f="touches"in S?S.touches[0].clientX:S.clientX,_=H.clientWidth-300,C=Math.max(280,Math.min(_,b+(p-f)));c(C)},g=()=>{document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",g),document.removeEventListener("touchmove",T),document.removeEventListener("touchend",g),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("chatPanelWidth",String(a)),y(S=>S+1)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",T),document.addEventListener("mouseup",g),document.addEventListener("touchmove",T,{passive:!1}),document.addEventListener("touchend",g)},[a]),G=o?"Chat":"Events",z=o?"var(--accent)":"var(--success)",q=W(u=>u.activeInterrupt[t.id]??null),R=t.status==="running"?e.jsx("span",{className:"ml-auto text-[10px] 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:o?"Thinking...":"Running..."}):o&&t.status==="suspended"&&q?e.jsx("span",{className:"ml-auto text-[10px] 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(r){const u=[{id:"traces",label:"Traces",count:$.length},{id:"primary",label:G},{id:"io",label:"I/O"},{id:"logs",label:"Logs",count:B.length}];return e.jsxs("div",{className:"flex flex-col h-full",children:[(t.mode==="debug"||t.status==="suspended"&&!q||N&&Object.keys(N).length>0)&&e.jsx(Le,{runId:t.id,status:t.status,ws:s,breakpointNode:t.breakpoint_node}),e.jsx("div",{className:"shrink-0",style:{height:"40vh"},children:e.jsx(ne,{entrypoint:t.entrypoint,traces:$,runId:t.id,breakpointNode:t.breakpoint_node,breakpointNextNodes:t.breakpoint_next_nodes,onBreakpointChange:L,fitViewTrigger:j})}),e.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:[u.map(p=>e.jsxs("button",{onClick:()=>x(p.id),className:"px-2 py-0.5 h-5 text-[11px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer",style:{color:l===p.id?p.id==="primary"?z:"var(--accent)":"var(--text-muted)",background:l===p.id?`color-mix(in srgb, ${p.id==="primary"?z:"var(--accent)"} 10%, transparent)`:"transparent"},children:[p.label,p.count!==void 0&&p.count>0&&e.jsx("span",{className:"ml-1 font-normal",style:{color:"var(--text-muted)"},children:p.count})]},p.id)),R]}),e.jsxs("div",{className:"flex-1 overflow-hidden",children:[l==="traces"&&e.jsx(Se,{traces:$}),l==="primary"&&(o?e.jsx(h.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:e.jsx("span",{className:"text-xs",children:"Loading chat..."})}),children:e.jsx(Te,{messages:J,runId:t.id,runStatus:t.status,ws:s})}):e.jsx(_e,{events:F,runStatus:t.status})),l==="io"&&e.jsx(Me,{run:t}),l==="logs"&&e.jsx(Ee,{logs:B})]})]})}const P=[{id:"primary",label:G},{id:"io",label:"I/O"},{id:"logs",label:"Logs",count:B.length}];return e.jsxs("div",{ref:k,className:"flex h-full",children:[e.jsxs("div",{ref:E,className:"flex flex-col flex-1 min-w-0",children:[(t.mode==="debug"||t.status==="suspended"&&!q||N&&Object.keys(N).length>0)&&e.jsx(Le,{runId:t.id,status:t.status,ws:s,breakpointNode:t.breakpoint_node}),e.jsx("div",{className:"shrink-0",style:{height:n},children:e.jsx(ne,{entrypoint:t.entrypoint,traces:$,runId:t.id,breakpointNode:t.breakpoint_node,breakpointNextNodes:t.breakpoint_next_nodes,onBreakpointChange:L,fitViewTrigger:j})}),e.jsx("div",{onMouseDown:I,onTouchStart:I,className:"shrink-0 h-1.5 cursor-row-resize bg-[var(--border)] hover:bg-[var(--accent)] transition-colors relative",children:e.jsx("div",{className:"absolute inset-0 -top-1 -bottom-1"})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(Se,{traces:$})})]}),e.jsx("div",{onMouseDown:D,onTouchStart:D,className:"shrink-0 w-1.5 cursor-col-resize bg-[var(--border)] hover:bg-[var(--accent)] transition-colors relative",children:e.jsx("div",{className:"absolute inset-0 -left-1 -right-1"})}),e.jsxs("div",{className:"shrink-0 flex flex-col",style:{width:a,background:"var(--bg-primary)"},children:[e.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:[P.map(u=>e.jsxs("button",{onClick:()=>d(u.id),className:"px-2 py-0.5 h-5 text-[11px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer",style:{color:m===u.id?u.id==="primary"?z:"var(--accent)":"var(--text-muted)",background:m===u.id?`color-mix(in srgb, ${u.id==="primary"?z:"var(--accent)"} 10%, transparent)`:"transparent"},onMouseEnter:p=>{m!==u.id&&(p.currentTarget.style.color="var(--text-primary)")},onMouseLeave:p=>{m!==u.id&&(p.currentTarget.style.color="var(--text-muted)")},children:[u.label,u.count!==void 0&&u.count>0&&e.jsx("span",{className:"ml-1 font-normal",style:{color:"var(--text-muted)"},children:u.count})]},u.id)),R]}),e.jsxs("div",{className:"flex-1 overflow-hidden",children:[m==="primary"&&(o?e.jsx(h.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:e.jsx("span",{className:"text-xs",children:"Loading chat..."})}),children:e.jsx(Te,{messages:J,runId:t.id,runStatus:t.status,ws:s})}):e.jsx(_e,{events:F,runStatus:t.status})),m==="io"&&e.jsx(Me,{run:t}),m==="logs"&&e.jsx(Ee,{logs:B})]})]})]})}function Me({run:t}){return e.jsxs("div",{className:"p-4 overflow-y-auto h-full space-y-4",children:[e.jsx(Re,{title:"Input",color:"var(--success)",copyText:JSON.stringify(t.input_data,null,2),children:e.jsx(te,{json:JSON.stringify(t.input_data,null,2),className:"p-3 rounded-lg text-xs font-mono whitespace-pre-wrap break-words",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)"}})}),t.output_data&&e.jsx(Re,{title:"Output",color:"var(--accent)",copyText:typeof t.output_data=="string"?t.output_data:JSON.stringify(t.output_data,null,2),children:e.jsx(te,{json:typeof t.output_data=="string"?t.output_data:JSON.stringify(t.output_data,null,2),className:"p-3 rounded-lg text-xs font-mono whitespace-pre-wrap break-words",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)"}})}),t.error&&e.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid color-mix(in srgb, var(--error) 40%, var(--border))"},children:[e.jsxs("div",{className:"px-4 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:[e.jsx("span",{children:"Error"}),e.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:t.error.code}),e.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:t.error.category})]}),e.jsxs("div",{className:"p-4 text-xs leading-normal",style:{background:"var(--bg-secondary)"},children:[e.jsx("div",{className:"font-semibold mb-2",style:{color:"var(--text-primary)"},children:t.error.title}),e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-[11px] max-w-prose",style:{color:"var(--text-secondary)"},children:t.error.detail})]})]})]})}function Re({title:t,color:s,copyText:r,children:o}){const[n,i]=h.useState(!1),a=h.useCallback(()=>{r&&navigator.clipboard.writeText(r).then(()=>{i(!0),setTimeout(()=>i(!1),1500)})},[r]);return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"w-1 h-4 rounded-full",style:{background:s}}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:s},children:t}),r&&e.jsx("button",{onClick:a,className:"ml-auto text-[10px] cursor-pointer px-1.5 py-0.5 rounded",style:{color:n?"var(--success)":"var(--text-muted)",background:"var(--bg-secondary)",border:"1px solid var(--border)"},children:n?"Copied":"Copy"})]}),o]})}function us(){const{reloadPending:t,setReloadPending:s,setEntrypoints:r}=W(),[o,n]=h.useState(!1);if(!t)return null;const i=async()=>{n(!0);try{await dt();const a=await Ie();r(a.map(c=>c.name)),s(!1)}catch(a){console.error("Reload failed:",a)}finally{n(!1)}};return e.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:[e.jsx("span",{className:"text-sm",style:{color:"var(--text-secondary)"},children:"Files changed — reload to apply"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:i,disabled:o,className:"px-3 py-1 text-sm font-medium rounded cursor-pointer",style:{background:"var(--accent)",color:"#fff",opacity:o?.6:1},children:o?"Reloading...":"Reload"}),e.jsx("button",{onClick:()=>s(!1),className:"text-sm cursor-pointer px-1",style:{color:"var(--text-muted)",background:"none",border:"none"},children:"✕"})]})]})}function ps(){const t=nt(),s=xt(),[r,o]=h.useState(!1),{runs:n,selectedRunId:i,setRuns:a,upsertRun:c,selectRun:m,setTraces:d,setLogs:l,setChatMessages:x,setEntrypoints:j,setStateEvents:y,setGraphCache:E,setActiveNode:k,removeActiveNode:w}=W(),{view:$,runId:B,setupEntrypoint:J,setupMode:F,navigate:N}=Pe();h.useEffect(()=>{$==="details"&&B&&B!==i&&m(B)},[$,B,i,m]),h.useEffect(()=>{lt().then(a).catch(console.error),Ie().then(R=>j(R.map(P=>P.name))).catch(console.error)},[a,j]);const L=i?n[i]:null,I=h.useCallback((R,P)=>{c(P),d(R,P.traces),l(R,P.logs);const u=P.messages.map(p=>{const b=p.contentParts??p.content_parts??[],T=p.toolCalls??p.tool_calls??[];return{message_id:p.messageId??p.message_id,role:p.role??"assistant",content:b.filter(g=>{const S=g.mimeType??g.mime_type??"";return S.startsWith("text/")||S==="application/json"}).map(g=>{const S=g.data;return(S==null?void 0:S.inline)??""}).join(` +`),m=h.useCallback(()=>r(d=>!d),[]);return c?e.jsxs("div",{children:[s?i?e.jsx(te,{json:a,className:"font-mono text-[11px] whitespace-pre-wrap break-all",style:{}}):e.jsx("pre",{className:"font-mono text-[11px] whitespace-pre-wrap break-all",style:{color:"var(--text-primary)"},children:a}):e.jsxs("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:[a.slice(0,Ne),"..."]}),e.jsx("button",{onClick:m,className:"text-[10px] cursor-pointer ml-1",style:{color:"var(--info)"},children:s?"[less]":"[more]"})]}):i?e.jsx(te,{json:a,className:"font-mono text-[11px] break-all whitespace-pre-wrap",style:{}}):e.jsx("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:a})}function Zt({span:t}){const[s,r]=h.useState(!0),[o,n]=h.useState(!1),i=Jt[t.status.toLowerCase()]??{...Gt,label:t.status},a=new Date(t.timestamp).toLocaleTimeString(void 0,{hour12:!1,fractionalSecondDigits:3}),c=Object.entries(t.attributes),m=[{label:"Span",value:t.span_id},...t.trace_id?[{label:"Trace",value:t.trace_id}]:[],{label:"Run",value:t.run_id},...t.parent_span_id?[{label:"Parent",value:t.parent_span_id}]:[]];return e.jsxs("div",{className:"overflow-y-auto h-full text-xs leading-normal",children:[e.jsxs("div",{className:"px-2 py-1.5 border-b flex items-center gap-2 flex-wrap",style:{borderColor:"var(--border)",background:"var(--bg-secondary)"},children:[e.jsx("span",{className:"text-xs font-semibold mr-auto",style:{color:"var(--text-primary)"},children:t.span_name}),e.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",style:{background:`color-mix(in srgb, ${i.color} 15%, var(--bg-secondary))`,color:i.color},children:[e.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:i.color}}),i.label]}),t.duration_ms!=null&&e.jsx("span",{className:"shrink-0 font-mono text-[11px] font-semibold",style:{color:"var(--warning)"},children:Yt(t.duration_ms)}),e.jsx("span",{className:"shrink-0 font-mono text-[11px]",style:{color:"var(--text-muted)"},children:a})]}),c.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-2 py-1 text-[10px] uppercase font-bold tracking-wider border-b cursor-pointer flex items-center",style:{color:"var(--accent)",borderColor:"var(--border)",background:"var(--bg-secondary)"},onClick:()=>r(d=>!d),children:[e.jsxs("span",{className:"flex-1",children:["Attributes (",c.length,")"]}),e.jsx("span",{style:{color:"var(--text-muted)",transform:s?"rotate(0deg)":"rotate(-90deg)"},children:"▾"})]}),s&&c.map(([d,l],x)=>e.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:[e.jsx("span",{className:"font-mono font-semibold shrink-0 pt-px truncate text-[11px]",style:{color:"var(--info)",width:"35%"},title:d,children:d}),e.jsx("span",{className:"flex-1 min-w-0",children:e.jsx(Kt,{value:l})})]},d))]}),e.jsxs("div",{className:"px-2 py-1 text-[10px] uppercase font-bold tracking-wider border-b cursor-pointer flex items-center",style:{color:"var(--accent)",borderColor:"var(--border)",background:"var(--bg-secondary)"},onClick:()=>n(d=>!d),children:[e.jsxs("span",{className:"flex-1",children:["Identifiers (",m.length,")"]}),e.jsx("span",{style:{color:"var(--text-muted)",transform:o?"rotate(0deg)":"rotate(-90deg)"},children:"▾"})]}),o&&m.map((d,l)=>e.jsxs("div",{className:"flex gap-2 px-2 py-1 items-start border-b",style:{borderColor:"var(--border)",background:l%2===0?"var(--bg-primary)":"var(--bg-secondary)"},children:[e.jsx("span",{className:"font-mono font-semibold shrink-0 pt-px truncate text-[11px]",style:{color:"var(--info)",width:"35%"},title:d.label,children:d.label}),e.jsx("span",{className:"flex-1 min-w-0",children:e.jsx("span",{className:"font-mono text-[11px] break-all",style:{color:"var(--text-primary)"},children:d.value})})]},d.label))]})}const Qt={started:"var(--info)",running:"var(--warning)",completed:"var(--success)",failed:"var(--error)",error:"var(--error)"};function es({kind:t,statusColor:s}){const r=s,o=14,n={width:o,height:o,viewBox:"0 0 16 16",fill:"none",stroke:r,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"};switch(t){case"LLM":return e.jsx("svg",{...n,children:e.jsx("path",{d:"M8 2L9 5L12 4L10 7L14 8L10 9L12 12L9 11L8 14L7 11L4 12L6 9L2 8L6 7L4 4L7 5Z",fill:r,stroke:"none"})});case"TOOL":return e.jsx("svg",{...n,children:e.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 e.jsxs("svg",{...n,children:[e.jsx("rect",{x:"3",y:"5",width:"10",height:"8",rx:"2"}),e.jsx("circle",{cx:"6",cy:"9",r:"1",fill:r,stroke:"none"}),e.jsx("circle",{cx:"10",cy:"9",r:"1",fill:r,stroke:"none"}),e.jsx("path",{d:"M8 2v3"}),e.jsx("path",{d:"M6 2h4"})]});case"CHAIN":return e.jsxs("svg",{...n,children:[e.jsx("path",{d:"M6.5 9.5L9.5 6.5"}),e.jsx("path",{d:"M4.5 8.5l-1 1a2 2 0 0 0 2.83 2.83l1-1"}),e.jsx("path",{d:"M11.5 7.5l1-1a2 2 0 0 0-2.83-2.83l-1 1"})]});case"RETRIEVER":return e.jsxs("svg",{...n,children:[e.jsx("circle",{cx:"7",cy:"7",r:"4"}),e.jsx("path",{d:"M10 10l3.5 3.5"})]});case"EMBEDDING":return e.jsxs("svg",{...n,children:[e.jsx("rect",{x:"2",y:"2",width:"4",height:"4",rx:"0.5"}),e.jsx("rect",{x:"10",y:"2",width:"4",height:"4",rx:"0.5"}),e.jsx("rect",{x:"2",y:"10",width:"4",height:"4",rx:"0.5"}),e.jsx("rect",{x:"10",y:"10",width:"4",height:"4",rx:"0.5"})]});default:return e.jsx("span",{className:"shrink-0 w-2 h-2 rounded-full",style:{background:s}})}}function ts(t){const s=new Map(t.map(a=>[a.span_id,a])),r=new Map;for(const a of t)if(a.parent_span_id){const c=r.get(a.parent_span_id)??[];c.push(a),r.set(a.parent_span_id,c)}const o=t.filter(a=>a.parent_span_id===null||!s.has(a.parent_span_id));function n(a){const c=(r.get(a.span_id)??[]).sort((m,d)=>m.timestamp.localeCompare(d.timestamp));return{span:a,children:c.map(n)}}return o.sort((a,c)=>a.timestamp.localeCompare(c.timestamp)).map(n).flatMap(a=>a.span.span_name==="root"?a.children:[a])}function ss(t){return t==null?"":t<1e3?`${t.toFixed(0)}ms`:`${(t/1e3).toFixed(2)}s`}function Be(t){return t.map(s=>{const{span:r}=s;return s.children.length>0?{name:r.span_name,children:Be(s.children)}:{name:r.span_name}})}function Se({traces:t}){const[s,r]=h.useState(null),[o,n]=h.useState(new Set),[i,a]=h.useState(()=>{const N=localStorage.getItem("traceTreeSplitWidth");return N?parseFloat(N):50}),[c,m]=h.useState(!1),[d,l]=h.useState(!1),x=ts(t),j=h.useMemo(()=>JSON.stringify(Be(x),null,2),[t]),y=h.useCallback(()=>{navigator.clipboard.writeText(j).then(()=>{l(!0),setTimeout(()=>l(!1),1500)})},[j]),E=W(N=>N.focusedSpan),k=W(N=>N.setFocusedSpan),[w,$]=h.useState(null),B=h.useRef(null),J=h.useCallback(N=>{n(L=>{const I=new Set(L);return I.has(N)?I.delete(N):I.add(N),I})},[]);h.useEffect(()=>{if(s===null)x.length>0&&r(x[0].span);else{const N=t.find(L=>L.span_id===s.span_id);N&&N!==s&&r(N)}},[t]),h.useEffect(()=>{if(!E)return;const L=t.filter(I=>I.span_name===E.name).sort((I,D)=>I.timestamp.localeCompare(D.timestamp))[E.index];if(L){r(L),$(L.span_id);const I=new Map(t.map(D=>[D.span_id,D.parent_span_id]));n(D=>{const G=new Set(D);let z=L.parent_span_id;for(;z;)G.delete(z),z=I.get(z)??null;return G})}k(null)},[E,t,k]),h.useEffect(()=>{if(!w)return;const N=w;$(null),requestAnimationFrame(()=>{const L=B.current,I=L==null?void 0:L.querySelector(`[data-span-id="${N}"]`);L&&I&&I.scrollIntoView({block:"center",behavior:"smooth"})})},[w]),h.useEffect(()=>{if(!c)return;const N=I=>{const D=document.querySelector(".trace-tree-container");if(!D)return;const G=D.getBoundingClientRect(),z=(I.clientX-G.left)/G.width*100,q=Math.max(20,Math.min(80,z));a(q),localStorage.setItem("traceTreeSplitWidth",String(q))},L=()=>{m(!1)};return window.addEventListener("mousemove",N),window.addEventListener("mouseup",L),()=>{window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",L)}},[c]);const F=N=>{N.preventDefault(),m(!0)};return e.jsxs("div",{className:"flex h-full trace-tree-container",style:{cursor:c?"col-resize":void 0},children:[e.jsxs("div",{className:"pr-0.5 pt-0.5 relative",style:{width:`${i}%`},children:[t.length>0&&e.jsx("button",{onClick:y,className:"absolute top-2 left-2 z-20 text-[10px] cursor-pointer px-1.5 py-0.5 rounded transition-opacity",style:{opacity:d?1:.3,color:d?"var(--success)":"var(--text-muted)",background:"var(--bg-secondary)",border:"1px solid var(--border)"},onMouseEnter:N=>{N.currentTarget.style.opacity="1"},onMouseLeave:N=>{d||(N.currentTarget.style.opacity="0.3")},children:d?"Copied!":"Copy JSON"}),e.jsx("div",{ref:B,className:"overflow-y-auto h-full p-0.5",children:x.length===0?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"No traces yet"})}):x.map((N,L)=>e.jsx(De,{node:N,depth:0,selectedId:(s==null?void 0:s.span_id)??null,onSelect:r,isLast:L===x.length-1,collapsedIds:o,toggleExpanded:J},N.span.span_id))})]}),e.jsx("div",{onMouseDown:F,className:"shrink-0 w-1.5 cursor-col-resize bg-[var(--border)] hover:bg-[var(--accent)] transition-colors relative",style:c?{background:"var(--accent)"}:void 0,children:e.jsx("div",{className:"absolute inset-0 -left-1 -right-1"})}),e.jsx("div",{className:"flex-1 overflow-hidden p-0.5",children:s?e.jsx(Zt,{span:s}):e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"Select a span to view details"})})})]})}function De({node:t,depth:s,selectedId:r,onSelect:o,isLast:n,collapsedIds:i,toggleExpanded:a}){var k;const{span:c}=t,m=!i.has(c.span_id),d=Qt[c.status.toLowerCase()]??"var(--text-muted)",l=ss(c.duration_ms),x=c.span_id===r,j=t.children.length>0,y=s*20,E=(k=c.attributes)==null?void 0:k["openinference.span.kind"];return e.jsxs("div",{className:"relative",children:[s>0&&e.jsx("div",{className:"absolute top-0 z-10 pointer-events-none",style:{left:`${y-10}px`,width:"1px",height:n?"16px":"100%",background:"var(--border)"}}),e.jsxs("button",{"data-span-id":c.span_id,onClick:()=>o(c),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:`${y+4}px`,background:x?"color-mix(in srgb, var(--accent) 10%, var(--bg-primary))":void 0,borderLeft:x?"2px solid var(--accent)":"2px solid transparent"},onMouseEnter:w=>{x||(w.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:w=>{x||(w.currentTarget.style.background="")},children:[s>0&&e.jsx("div",{className:"absolute z-10 pointer-events-none",style:{left:`${y-10}px`,top:"50%",width:"10px",height:"1px",background:"var(--border)"}}),j?e.jsx("span",{onClick:w=>{w.stopPropagation(),a(c.span_id)},className:"shrink-0 w-4 h-4 flex items-center justify-center cursor-pointer rounded hover:bg-[var(--bg-hover)]",style:{color:"var(--text-muted)"},children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",style:{transform:m?"rotate(90deg)":"rotate(0deg)"},children:e.jsx("path",{d:"M3 1.5L7 5L3 8.5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})}):e.jsx("span",{className:"shrink-0 w-4"}),e.jsx("span",{className:"shrink-0 flex items-center justify-center w-4 h-4",children:e.jsx(es,{kind:E,statusColor:d})}),e.jsx("span",{className:"text-[var(--text-primary)] truncate min-w-0 flex-1",children:c.span_name}),l&&e.jsx("span",{className:"text-[var(--text-muted)] shrink-0 ml-auto pl-2 tabular-nums",children:l})]}),m&&t.children.map((w,$)=>e.jsx(De,{node:w,depth:s+1,selectedId:r,onSelect:o,isLast:$===t.children.length-1,collapsedIds:i,toggleExpanded:a},w.span.span_id))]})}const rs={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)"}},os={color:"var(--text-muted)",bg:"transparent"};function Ee({logs:t}){const s=h.useRef(null),r=h.useRef(null),[o,n]=h.useState(!1);h.useEffect(()=>{var a;(a=r.current)==null||a.scrollIntoView({behavior:"smooth"})},[t.length]);const i=()=>{const a=s.current;a&&n(a.scrollTop>100)};return t.length===0?e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsx("p",{className:"text-[var(--text-muted)] text-sm",children:"No logs yet"})}):e.jsxs("div",{className:"h-full relative",children:[e.jsxs("div",{ref:s,onScroll:i,className:"h-full overflow-y-auto font-mono text-xs leading-normal",children:[t.map((a,c)=>{const m=new Date(a.timestamp).toLocaleTimeString(void 0,{hour12:!1}),d=a.level.toUpperCase(),l=d.slice(0,4),x=rs[d]??os,j=c%2===0;return e.jsxs("div",{className:"flex gap-3 px-3 py-1.5",style:{background:j?"var(--bg-primary)":"var(--bg-secondary)"},children:[e.jsx("span",{className:"text-[var(--text-muted)] shrink-0",children:m}),e.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:x.color,background:x.bg},children:l}),e.jsx("span",{className:"text-[var(--text-primary)] whitespace-pre-wrap break-all",children:a.message})]},c)}),e.jsx("div",{ref:r})]}),o&&e.jsx("button",{onClick:()=>{var a;return(a=s.current)==null?void 0:a.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"})})})]})}const ns={started:{color:"var(--accent)",label:"started"},updated:{color:"var(--info)",label:"updated"},completed:{color:"var(--success)",label:"completed"},faulted:{color:"var(--error)",label:"faulted"}},Ce={color:"var(--text-muted)",label:""};function _e({events:t,runStatus:s}){const r=h.useRef(null),o=h.useRef(!0),[n,i]=h.useState(null),a=()=>{const c=r.current;c&&(o.current=c.scrollHeight-c.scrollTop-c.clientHeight<40)};return h.useEffect(()=>{o.current&&r.current&&(r.current.scrollTop=r.current.scrollHeight)}),t.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:e.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:s==="running"?"Waiting for events...":"No events yet"})}):e.jsx("div",{ref:r,onScroll:a,className:"h-full overflow-y-auto font-mono text-xs leading-normal",children:t.map((c,m)=>{const d=new Date(c.timestamp).toLocaleTimeString(void 0,{hour12:!1}),l=c.payload&&Object.keys(c.payload).length>0,x=n===m,j=c.phase?ns[c.phase]??Ce:Ce;return e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>{l&&i(x?null:m)},className:"flex items-center gap-2 px-3 py-1.5",style:{background:m%2===0?"var(--bg-primary)":"var(--bg-secondary)",cursor:l?"pointer":"default"},children:[e.jsx("span",{className:"shrink-0",style:{color:"var(--text-muted)"},children:d}),e.jsx("span",{className:"shrink-0",style:{color:j.color},children:"●"}),e.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:c.node_name}),j.label&&e.jsx("span",{className:"shrink-0 text-[10px]",style:{color:"var(--text-muted)"},children:j.label}),l&&e.jsx("span",{className:"shrink-0 text-[9px] transition-transform",style:{color:"var(--text-muted)",transform:x?"rotate(90deg)":"rotate(0deg)"},children:"▸"})]}),x&&l&&e.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:e.jsx(te,{json:JSON.stringify(c.payload,null,2),className:"text-[11px] font-mono whitespace-pre-wrap break-words"})})]},m)})})}function Le({runId:t,status:s,ws:r,breakpointNode:o}){const n=s==="suspended",i=a=>{const c=W.getState().breakpoints[t]??{};r.setBreakpoints(t,Object.keys(c)),a==="step"?r.debugStep(t):a==="continue"?r.debugContinue(t):r.debugStop(t)};return e.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:[e.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold mr-1",style:{color:"var(--text-muted)"},children:"Debug"}),e.jsx(ce,{label:"Step",onClick:()=>i("step"),disabled:!n,color:"var(--info)",active:n}),e.jsx(ce,{label:"Continue",onClick:()=>i("continue"),disabled:!n,color:"var(--success)",active:n}),e.jsx(ce,{label:"Stop",onClick:()=>i("stop"),disabled:!n,color:"var(--error)",active:n}),e.jsx("span",{className:"text-[10px] ml-auto truncate",style:{color:n?"var(--accent)":"var(--text-muted)"},children:n?o?`Paused at ${o}`:"Paused":s})]})}function ce({label:t,onClick:s,disabled:r,color:o,active:n}){return e.jsx("button",{onClick:s,disabled:r,className:"px-2.5 py-0.5 h-5 text-[10px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed",style:{color:n?o:"var(--text-muted)",background:n?`color-mix(in srgb, ${o} 10%, transparent)`:"transparent"},onMouseEnter:i=>{r||(i.currentTarget.style.background=`color-mix(in srgb, ${o} 20%, transparent)`)},onMouseLeave:i=>{i.currentTarget.style.background=n?`color-mix(in srgb, ${o} 10%, transparent)`:"transparent"},children:t})}const Te=h.lazy(()=>He(()=>import("./ChatPanel-CllakF8w.js"),__vite__mapDeps([2,1,3,4]))),as=[],is=[],cs=[],ls=[];function ds({run:t,ws:s,isMobile:r}){const o=t.mode==="chat",[n,i]=h.useState(280),[a,c]=h.useState(()=>{const u=localStorage.getItem("chatPanelWidth");return u?parseInt(u,10):380}),[m,d]=h.useState("primary"),[l,x]=h.useState(o?"primary":"traces"),[j,y]=h.useState(0),E=h.useRef(null),k=h.useRef(null),w=h.useRef(!1),$=W(u=>u.traces[t.id]||as),B=W(u=>u.logs[t.id]||is),J=W(u=>u.chatMessages[t.id]||cs),F=W(u=>u.stateEvents[t.id]||ls),N=W(u=>u.breakpoints[t.id]);h.useEffect(()=>{s.setBreakpoints(t.id,N?Object.keys(N):[])},[t.id]);const L=h.useCallback(u=>{s.setBreakpoints(t.id,u)},[t.id,s]),I=h.useCallback(u=>{u.preventDefault(),w.current=!0;const p="touches"in u?u.touches[0].clientY:u.clientY,b=n,T=S=>{if(!w.current)return;const H=E.current;if(!H)return;const f="touches"in S?S.touches[0].clientY:S.clientY,_=H.clientHeight-100,C=Math.max(80,Math.min(_,b+(f-p)));i(C)},g=()=>{w.current=!1,document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",g),document.removeEventListener("touchmove",T),document.removeEventListener("touchend",g),document.body.style.cursor="",document.body.style.userSelect="",y(S=>S+1)};document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",T),document.addEventListener("mouseup",g),document.addEventListener("touchmove",T,{passive:!1}),document.addEventListener("touchend",g)},[n]),D=h.useCallback(u=>{u.preventDefault();const p="touches"in u?u.touches[0].clientX:u.clientX,b=a,T=S=>{const H=k.current;if(!H)return;const f="touches"in S?S.touches[0].clientX:S.clientX,_=H.clientWidth-300,C=Math.max(280,Math.min(_,b+(p-f)));c(C)},g=()=>{document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",g),document.removeEventListener("touchmove",T),document.removeEventListener("touchend",g),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("chatPanelWidth",String(a)),y(S=>S+1)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",T),document.addEventListener("mouseup",g),document.addEventListener("touchmove",T,{passive:!1}),document.addEventListener("touchend",g)},[a]),G=o?"Chat":"Events",z=o?"var(--accent)":"var(--success)",q=W(u=>u.activeInterrupt[t.id]??null),R=t.status==="running"?e.jsx("span",{className:"ml-auto text-[10px] 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:o?"Thinking...":"Running..."}):o&&t.status==="suspended"&&q?e.jsx("span",{className:"ml-auto text-[10px] 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(r){const u=[{id:"traces",label:"Traces",count:$.length},{id:"primary",label:G},{id:"io",label:"I/O"},{id:"logs",label:"Logs",count:B.length}];return e.jsxs("div",{className:"flex flex-col h-full",children:[(t.mode==="debug"||t.status==="suspended"&&!q||N&&Object.keys(N).length>0)&&e.jsx(Le,{runId:t.id,status:t.status,ws:s,breakpointNode:t.breakpoint_node}),e.jsx("div",{className:"shrink-0",style:{height:"40vh"},children:e.jsx(ne,{entrypoint:t.entrypoint,traces:$,runId:t.id,breakpointNode:t.breakpoint_node,breakpointNextNodes:t.breakpoint_next_nodes,onBreakpointChange:L,fitViewTrigger:j})}),e.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:[u.map(p=>e.jsxs("button",{onClick:()=>x(p.id),className:"px-2 py-0.5 h-5 text-[11px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer",style:{color:l===p.id?p.id==="primary"?z:"var(--accent)":"var(--text-muted)",background:l===p.id?`color-mix(in srgb, ${p.id==="primary"?z:"var(--accent)"} 10%, transparent)`:"transparent"},children:[p.label,p.count!==void 0&&p.count>0&&e.jsx("span",{className:"ml-1 font-normal",style:{color:"var(--text-muted)"},children:p.count})]},p.id)),R]}),e.jsxs("div",{className:"flex-1 overflow-hidden",children:[l==="traces"&&e.jsx(Se,{traces:$}),l==="primary"&&(o?e.jsx(h.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:e.jsx("span",{className:"text-xs",children:"Loading chat..."})}),children:e.jsx(Te,{messages:J,runId:t.id,runStatus:t.status,ws:s})}):e.jsx(_e,{events:F,runStatus:t.status})),l==="io"&&e.jsx(Me,{run:t}),l==="logs"&&e.jsx(Ee,{logs:B})]})]})}const P=[{id:"primary",label:G},{id:"io",label:"I/O"},{id:"logs",label:"Logs",count:B.length}];return e.jsxs("div",{ref:k,className:"flex h-full",children:[e.jsxs("div",{ref:E,className:"flex flex-col flex-1 min-w-0",children:[(t.mode==="debug"||t.status==="suspended"&&!q||N&&Object.keys(N).length>0)&&e.jsx(Le,{runId:t.id,status:t.status,ws:s,breakpointNode:t.breakpoint_node}),e.jsx("div",{className:"shrink-0",style:{height:n},children:e.jsx(ne,{entrypoint:t.entrypoint,traces:$,runId:t.id,breakpointNode:t.breakpoint_node,breakpointNextNodes:t.breakpoint_next_nodes,onBreakpointChange:L,fitViewTrigger:j})}),e.jsx("div",{onMouseDown:I,onTouchStart:I,className:"shrink-0 h-1.5 cursor-row-resize bg-[var(--border)] hover:bg-[var(--accent)] transition-colors relative",children:e.jsx("div",{className:"absolute inset-0 -top-1 -bottom-1"})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(Se,{traces:$})})]}),e.jsx("div",{onMouseDown:D,onTouchStart:D,className:"shrink-0 w-1.5 cursor-col-resize bg-[var(--border)] hover:bg-[var(--accent)] transition-colors relative",children:e.jsx("div",{className:"absolute inset-0 -left-1 -right-1"})}),e.jsxs("div",{className:"shrink-0 flex flex-col",style:{width:a,background:"var(--bg-primary)"},children:[e.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:[P.map(u=>e.jsxs("button",{onClick:()=>d(u.id),className:"px-2 py-0.5 h-5 text-[11px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer",style:{color:m===u.id?u.id==="primary"?z:"var(--accent)":"var(--text-muted)",background:m===u.id?`color-mix(in srgb, ${u.id==="primary"?z:"var(--accent)"} 10%, transparent)`:"transparent"},onMouseEnter:p=>{m!==u.id&&(p.currentTarget.style.color="var(--text-primary)")},onMouseLeave:p=>{m!==u.id&&(p.currentTarget.style.color="var(--text-muted)")},children:[u.label,u.count!==void 0&&u.count>0&&e.jsx("span",{className:"ml-1 font-normal",style:{color:"var(--text-muted)"},children:u.count})]},u.id)),R]}),e.jsxs("div",{className:"flex-1 overflow-hidden",children:[m==="primary"&&(o?e.jsx(h.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:e.jsx("span",{className:"text-xs",children:"Loading chat..."})}),children:e.jsx(Te,{messages:J,runId:t.id,runStatus:t.status,ws:s})}):e.jsx(_e,{events:F,runStatus:t.status})),m==="io"&&e.jsx(Me,{run:t}),m==="logs"&&e.jsx(Ee,{logs:B})]})]})]})}function Me({run:t}){return e.jsxs("div",{className:"p-4 overflow-y-auto h-full space-y-4",children:[e.jsx(Re,{title:"Input",color:"var(--success)",copyText:JSON.stringify(t.input_data,null,2),children:e.jsx(te,{json:JSON.stringify(t.input_data,null,2),className:"p-3 rounded-lg text-xs font-mono whitespace-pre-wrap break-words",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)"}})}),t.output_data&&e.jsx(Re,{title:"Output",color:"var(--accent)",copyText:typeof t.output_data=="string"?t.output_data:JSON.stringify(t.output_data,null,2),children:e.jsx(te,{json:typeof t.output_data=="string"?t.output_data:JSON.stringify(t.output_data,null,2),className:"p-3 rounded-lg text-xs font-mono whitespace-pre-wrap break-words",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)"}})}),t.error&&e.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid color-mix(in srgb, var(--error) 40%, var(--border))"},children:[e.jsxs("div",{className:"px-4 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:[e.jsx("span",{children:"Error"}),e.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:t.error.code}),e.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:t.error.category})]}),e.jsxs("div",{className:"p-4 text-xs leading-normal",style:{background:"var(--bg-secondary)"},children:[e.jsx("div",{className:"font-semibold mb-2",style:{color:"var(--text-primary)"},children:t.error.title}),e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-[11px] max-w-prose",style:{color:"var(--text-secondary)"},children:t.error.detail})]})]})]})}function Re({title:t,color:s,copyText:r,children:o}){const[n,i]=h.useState(!1),a=h.useCallback(()=>{r&&navigator.clipboard.writeText(r).then(()=>{i(!0),setTimeout(()=>i(!1),1500)})},[r]);return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"w-1 h-4 rounded-full",style:{background:s}}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:s},children:t}),r&&e.jsx("button",{onClick:a,className:"ml-auto text-[10px] cursor-pointer px-1.5 py-0.5 rounded",style:{color:n?"var(--success)":"var(--text-muted)",background:"var(--bg-secondary)",border:"1px solid var(--border)"},children:n?"Copied":"Copy"})]}),o]})}function us(){const{reloadPending:t,setReloadPending:s,setEntrypoints:r}=W(),[o,n]=h.useState(!1);if(!t)return null;const i=async()=>{n(!0);try{await dt();const a=await Ie();r(a.map(c=>c.name)),s(!1)}catch(a){console.error("Reload failed:",a)}finally{n(!1)}};return e.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:[e.jsx("span",{className:"text-sm",style:{color:"var(--text-secondary)"},children:"Files changed — reload to apply"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:i,disabled:o,className:"px-3 py-1 text-sm font-medium rounded cursor-pointer",style:{background:"var(--accent)",color:"#fff",opacity:o?.6:1},children:o?"Reloading...":"Reload"}),e.jsx("button",{onClick:()=>s(!1),className:"text-sm cursor-pointer px-1",style:{color:"var(--text-muted)",background:"none",border:"none"},children:"✕"})]})]})}function ps(){const t=nt(),s=xt(),[r,o]=h.useState(!1),{runs:n,selectedRunId:i,setRuns:a,upsertRun:c,selectRun:m,setTraces:d,setLogs:l,setChatMessages:x,setEntrypoints:j,setStateEvents:y,setGraphCache:E,setActiveNode:k,removeActiveNode:w}=W(),{view:$,runId:B,setupEntrypoint:J,setupMode:F,navigate:N}=Pe();h.useEffect(()=>{$==="details"&&B&&B!==i&&m(B)},[$,B,i,m]),h.useEffect(()=>{lt().then(a).catch(console.error),Ie().then(R=>j(R.map(P=>P.name))).catch(console.error)},[a,j]);const L=i?n[i]:null,I=h.useCallback((R,P)=>{c(P),d(R,P.traces),l(R,P.logs);const u=P.messages.map(p=>{const b=p.contentParts??p.content_parts??[],T=p.toolCalls??p.tool_calls??[];return{message_id:p.messageId??p.message_id,role:p.role??"assistant",content:b.filter(g=>{const S=g.mimeType??g.mime_type??"";return S.startsWith("text/")||S==="application/json"}).map(g=>{const S=g.data;return(S==null?void 0:S.inline)??""}).join(` `).trim()??"",tool_calls:T.length>0?T.map(g=>({name:g.name??"",has_result:!!g.result})):void 0}});if(x(R,u),P.graph&&P.graph.nodes.length>0&&E(R,P.graph),P.states&&P.states.length>0&&(y(R,P.states.map(p=>({node_name:p.node_name,qualified_node_name:p.qualified_node_name,phase:p.phase,timestamp:new Date(p.timestamp).getTime(),payload:p.payload}))),P.status!=="completed"&&P.status!=="failed"))for(const p of P.states)p.phase==="started"?k(R,p.node_name,p.qualified_node_name):p.phase==="completed"&&w(R,p.node_name)},[c,d,l,x,y,E,k,w]);h.useEffect(()=>{if(!i)return;t.subscribe(i),ae(i).then(P=>I(i,P)).catch(console.error);const R=setTimeout(()=>{const P=W.getState().runs[i];P&&(P.status==="pending"||P.status==="running")&&ae(i).then(u=>I(i,u)).catch(console.error)},2e3);return()=>{clearTimeout(R),t.unsubscribe(i)}},[i,t,I]);const D=h.useRef(null);h.useEffect(()=>{var u,p;if(!i)return;const R=L==null?void 0:L.status,P=D.current;if(D.current=R??null,R&&(R==="completed"||R==="failed")&&P!==R){const b=W.getState(),T=((u=b.traces[i])==null?void 0:u.length)??0,g=((p=b.logs[i])==null?void 0:p.length)??0,S=(L==null?void 0:L.trace_count)??0,H=(L==null?void 0:L.log_count)??0;(TI(i,f)).catch(console.error)}},[i,L==null?void 0:L.status,I]);const G=R=>{N(`#/runs/${R}/traces`),m(R),o(!1)},z=R=>{N(`#/runs/${R}/traces`),m(R),o(!1)},q=()=>{N("#/new"),o(!1)};return e.jsxs("div",{className:"flex h-screen w-screen relative",children:[s&&!r&&e.jsx("button",{onClick:()=>o(!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:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),e.jsx(ft,{runs:Object.values(n),selectedRunId:i,onSelectRun:z,onNewRun:q,isMobile:s,isOpen:r,onClose:()=>o(!1)}),e.jsx("main",{className:"flex-1 overflow-hidden bg-[var(--bg-primary)]",children:$==="new"?e.jsx(vt,{}):$==="setup"&&J&&F?e.jsx(Vt,{entrypoint:J,mode:F,ws:t,onRunCreated:G,isMobile:s}):L?e.jsx(ds,{run:L,ws:t,isMobile:s}):e.jsx("div",{className:"flex items-center justify-center h-full text-[var(--text-muted)]",children:"Select a run or create a new one"})}),e.jsx(us,{})]})}Fe.createRoot(document.getElementById("root")).render(e.jsx(h.StrictMode,{children:e.jsx(ps,{})}));export{W as u}; diff --git a/src/uipath/dev/server/static/index.html b/src/uipath/dev/server/static/index.html index 81937a3..2b4d46b 100644 --- a/src/uipath/dev/server/static/index.html +++ b/src/uipath/dev/server/static/index.html @@ -5,7 +5,7 @@ UiPath Developer Console - + From 54cb9eca4986f1e87e25da768010aca64dabc727 Mon Sep 17 00:00:00 2001 From: Cristian Pufu Date: Sat, 21 Feb 2026 11:20:55 +0200 Subject: [PATCH 3/4] feat: evict old terminal runs to cap history at 50 RunService.runs grows indefinitely, leaking memory on long-running servers. Add eviction logic that removes oldest completed/failed runs when total exceeds MAX_RUNS (50), preserving active runs. Clean up WebSocket subscriptions for evicted runs via on_run_removed callback. Co-Authored-By: Claude Opus 4.6 --- src/uipath/dev/server/__init__.py | 1 + src/uipath/dev/server/ws/manager.py | 4 +++ src/uipath/dev/services/run_service.py | 34 ++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/src/uipath/dev/server/__init__.py b/src/uipath/dev/server/__init__.py index 09025fc..2e3ba31 100644 --- a/src/uipath/dev/server/__init__.py +++ b/src/uipath/dev/server/__init__.py @@ -83,6 +83,7 @@ def __init__( on_state=self._on_state, on_interrupt=self._on_interrupt, debug_bridge_factory=lambda mode: WebDebugBridge(mode=mode), + on_run_removed=self.connection_manager.remove_run_subscriptions, ) def create_app(self) -> Any: diff --git a/src/uipath/dev/server/ws/manager.py b/src/uipath/dev/server/ws/manager.py index 6eda73d..7751016 100644 --- a/src/uipath/dev/server/ws/manager.py +++ b/src/uipath/dev/server/ws/manager.py @@ -123,6 +123,10 @@ def unsubscribe(self, websocket: WebSocket, run_id: str) -> None: if not self._subscriptions[run_id]: del self._subscriptions[run_id] + def remove_run_subscriptions(self, run_id: str) -> None: + """Remove all subscriptions for a run.""" + self._subscriptions.pop(run_id, None) + def broadcast_run_updated(self, run: ExecutionRun) -> None: """Broadcast a run update to all subscribers (safe from sync context).""" msg = server_message(ServerEvent.RUN_UPDATED, serialize_run(run)) diff --git a/src/uipath/dev/services/run_service.py b/src/uipath/dev/services/run_service.py index 30b0a97..261ffb9 100644 --- a/src/uipath/dev/services/run_service.py +++ b/src/uipath/dev/services/run_service.py @@ -45,6 +45,8 @@ from uipath.dev.models.execution import ExecutionMode, ExecutionRun from uipath.dev.services.chat_bridge import WebChatBridge +MAX_RUNS = 50 + RunUpdatedCallback = Callable[[ExecutionRun], None] LogCallback = Callable[[LogData], None] TraceCallback = Callable[[TraceData], None] @@ -98,6 +100,7 @@ def __init__( on_state: StateCallback | None = None, on_interrupt: InterruptCallback | None = None, debug_bridge_factory: DebugBridgeFactory | None = None, + on_run_removed: Callable[[str], None] | None = None, ) -> None: """Initialize RunService with runtime factory and trace manager.""" self.runtime_factory = runtime_factory @@ -111,6 +114,7 @@ def __init__( self.on_state = on_state self.on_interrupt = on_interrupt self._debug_bridge_factory = debug_bridge_factory + self._on_run_removed = on_run_removed self._exporter = RunContextExporter( on_trace=self.handle_trace, @@ -125,6 +129,36 @@ def register_run(self, run: ExecutionRun) -> None: """Register a new run and emit an initial update.""" self.runs[run.id] = run self._emit_run_updated(run) + self._evict_old_runs() + + def _evict_old_runs(self) -> None: + """Remove oldest terminal runs when total exceeds MAX_RUNS.""" + if len(self.runs) <= MAX_RUNS: + return + + active = [] + terminal = [] + for run in self.runs.values(): + if run.status in ("pending", "running", "suspended"): + active.append(run) + else: + terminal.append(run) + + keep_terminal = MAX_RUNS - len(active) + if keep_terminal < 0: + keep_terminal = 0 + + if len(terminal) <= keep_terminal: + return + + terminal.sort( + key=lambda r: r.end_time or datetime.min.replace(tzinfo=timezone.utc), + reverse=True, + ) + for run in terminal[keep_terminal:]: + del self.runs[run.id] + if self._on_run_removed is not None: + self._on_run_removed(run.id) def get_run(self, run_id: str) -> ExecutionRun | None: """Get a registered run.""" From 9e0ce67a7c944930f2e5c8b9e0931a7475a9afa8 Mon Sep 17 00:00:00 2001 From: Cristian Pufu Date: Sat, 21 Feb 2026 11:32:30 +0200 Subject: [PATCH 4/4] chore: bump version to 0.0.55 Co-Authored-By: Claude Opus 4.6 --- pyproject.toml | 2 +- uv.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 985f62e..de376cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath-dev" -version = "0.0.54" +version = "0.0.55" description = "UiPath Developer Console" readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.11" diff --git a/uv.lock b/uv.lock index c465ec8..f69d626 100644 --- a/uv.lock +++ b/uv.lock @@ -1400,7 +1400,7 @@ wheels = [ [[package]] name = "uipath-dev" -version = "0.0.54" +version = "0.0.55" source = { editable = "." } dependencies = [ { name = "fastapi" },