diff --git a/pyproject.toml b/pyproject.toml index a9c8aaf..c1cbcb6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath-dev" -version = "0.0.58" +version = "0.0.59" description = "UiPath Developer Console" readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.11" diff --git a/src/uipath/dev/server/app.py b/src/uipath/dev/server/app.py index 7f5df68..d608338 100644 --- a/src/uipath/dev/server/app.py +++ b/src/uipath/dev/server/app.py @@ -8,7 +8,7 @@ from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware -from fastapi.responses import HTMLResponse, Response +from fastapi.responses import HTMLResponse from uipath.dev.server import UiPathDeveloperServer @@ -108,25 +108,6 @@ def create_app(server: UiPathDeveloperServer) -> FastAPI: allow_headers=["*"], ) - # Favicon — UiPath orange branded icon - _favicon_svg = ( - '' - '' - '' - 'U' - "" - ) - _favicon_bytes = _favicon_svg.encode("utf-8") - - @app.get("/favicon.ico", include_in_schema=False) - async def _favicon_ico(): - return Response(content=_favicon_bytes, media_type="image/svg+xml") - - @app.get("/favicon.svg", include_in_schema=False) - async def _favicon_svg_route(): - return Response(content=_favicon_bytes, media_type="image/svg+xml") - # Store server reference on app state for route access app.state.server = server @@ -136,10 +117,36 @@ async def _favicon_svg_route(): "no", ) + # Read user's pyproject.toml from CWD (once at startup) + _user_project: dict[str, str | None] = { + "project_name": None, + "project_version": None, + "project_authors": None, + } + _pyproject_path = Path.cwd() / "pyproject.toml" + if _pyproject_path.is_file(): + try: + import tomllib + + with open(_pyproject_path, "rb") as f: + _pydata = tomllib.load(f) + _proj = _pydata.get("project", {}) + _user_project["project_name"] = _proj.get("name") + _user_project["project_version"] = _proj.get("version") + _authors = _proj.get("authors") + if _authors and isinstance(_authors, list) and len(_authors) > 0: + _user_project["project_authors"] = ( + _authors[0].get("name") + if isinstance(_authors[0], dict) + else str(_authors[0]) + ) + except Exception: + pass + # Config endpoint — tells the frontend which features are available @app.get("/api/config", include_in_schema=False) async def _config(): - return {"auth_enabled": auth_enabled} + return {"auth_enabled": auth_enabled, **_user_project} # Register routes from uipath.dev.server.routes.entrypoints import router as entrypoints_router diff --git a/src/uipath/dev/server/frontend/index.html b/src/uipath/dev/server/frontend/index.html index e6cd9ab..9f09240 100644 --- a/src/uipath/dev/server/frontend/index.html +++ b/src/uipath/dev/server/frontend/index.html @@ -4,7 +4,7 @@ UiPath Developer Console - +
diff --git a/src/uipath/dev/server/frontend/public/favicon.ico b/src/uipath/dev/server/frontend/public/favicon.ico new file mode 100644 index 0000000..ff34f04 Binary files /dev/null and b/src/uipath/dev/server/frontend/public/favicon.ico differ diff --git a/src/uipath/dev/server/frontend/src/App.tsx b/src/uipath/dev/server/frontend/src/App.tsx index ef3d312..8249df3 100644 --- a/src/uipath/dev/server/frontend/src/App.tsx +++ b/src/uipath/dev/server/frontend/src/App.tsx @@ -1,12 +1,14 @@ import { useCallback, useEffect, useRef, useState } from "react"; import { useRunStore } from "./store/useRunStore"; import { useAuthStore } from "./store/useAuthStore"; +import { useConfigStore } from "./store/useConfigStore"; import { useWebSocket } from "./store/useWebSocket"; import { listRuns, listEntrypoints, getRun } from "./api/client"; import type { RunDetail } from "./types/run"; import { useHashRoute } from "./hooks/useHashRoute"; import { useIsMobile } from "./hooks/useIsMobile"; import Sidebar from "./components/layout/Sidebar"; +import StatusBar from "./components/layout/StatusBar"; import NewRunPanel from "./components/runs/NewRunPanel"; import SetupView from "./components/runs/SetupView"; import RunDetailsPanel from "./components/runs/RunDetailsPanel"; @@ -40,15 +42,17 @@ export default function App() { } }, [view, routeRunId, selectedRunId, selectRun]); - // Load existing runs, entrypoints, and auth status on mount + // Load existing runs, entrypoints, auth status, and config on mount const initAuth = useAuthStore((s) => s.init); + const initConfig = useConfigStore((s) => s.init); useEffect(() => { listRuns().then(setRuns).catch(console.error); listEntrypoints() .then((eps) => setEntrypoints(eps.map((e) => e.name))) .catch(console.error); initAuth(); - }, [setRuns, setEntrypoints, initAuth]); + initConfig(); + }, [setRuns, setEntrypoints, initAuth, initConfig]); const selectedRun = selectedRunId ? runs[selectedRunId] : null; @@ -182,49 +186,52 @@ export default function App() { }; return ( -
- {/* Mobile hamburger button */} - {isMobile && !sidebarOpen && ( - - )} - setSidebarOpen(false)} - /> -
- {view === "new" ? ( - - ) : view === "setup" && setupEntrypoint && setupMode ? ( - - ) : selectedRun ? ( - - ) : ( -
- Select a run or create a new one -
+
+
+ {/* Mobile hamburger button */} + {isMobile && !sidebarOpen && ( + )} -
+ setSidebarOpen(false)} + /> +
+ {view === "new" ? ( + + ) : view === "setup" && setupEntrypoint && setupMode ? ( + + ) : selectedRun ? ( + + ) : ( +
+ Select a run or create a new one +
+ )} +
+
+ ); 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 ab5f4ef..842c589 100644 --- a/src/uipath/dev/server/frontend/src/components/layout/Sidebar.tsx +++ b/src/uipath/dev/server/frontend/src/components/layout/Sidebar.tsx @@ -1,7 +1,4 @@ -import { useState } from "react"; import type { RunSummary } from "../../types/run"; -import { useTheme } from "../../store/useTheme"; -import { useAuthStore } from "../../store/useAuthStore"; import RunHistoryItem from "../runs/RunHistoryItem"; interface Props { @@ -15,8 +12,6 @@ interface Props { } export default function Sidebar({ runs, selectedRunId, onSelectRun, onNewRun, isMobile, isOpen, onClose }: Props) { - const { theme, toggleTheme } = useTheme(); - const sorted = [...runs].sort( (a, b) => new Date(b.start_time ?? 0).getTime() - @@ -42,33 +37,15 @@ export default function Sidebar({ runs, selectedRunId, onSelectRun, onNewRun, is onClick={onNewRun} className="flex items-center gap-1.5 cursor-pointer transition-opacity hover:opacity-80" > - - - U - + UiPath - Dev Console + Developer Console
- - {/* Close button */} -
{/* New Run */} @@ -203,160 +159,6 @@ export default function Sidebar({ runs, selectedRunId, onSelectRun, onNewRun, is )} - {/* Auth section */} - ); } - -function AuthFooter() { - const { enabled, status, environment, tenants, uipathUrl, setEnvironment, startLogin, selectTenant, logout } = useAuthStore(); - const [selectedTenant, setSelectedTenant] = useState(""); - - if (!enabled) return null; - - if (status === "authenticated" || status === "expired") { - // Truncate URL for display: show org/tenant part only - const shortUrl = uipathUrl - ? uipathUrl.replace(/^https?:\/\/[^/]+\//, "") - : ""; - const isExpired = status === "expired"; - return ( -
-
- {isExpired ? ( - - ) : ( - -
- - {shortUrl} - - - )} - -
-
- ); - } - - if (status === "pending") { - return ( -
- - - - - - Signing in… - -
- ); - } - - if (status === "needs_tenant") { - return ( -
- - - -
- ); - } - - // Unauthenticated - return ( -
- - -
- ); -} diff --git a/src/uipath/dev/server/frontend/src/components/layout/StatusBar.tsx b/src/uipath/dev/server/frontend/src/components/layout/StatusBar.tsx new file mode 100644 index 0000000..bb5b198 --- /dev/null +++ b/src/uipath/dev/server/frontend/src/components/layout/StatusBar.tsx @@ -0,0 +1,250 @@ +import { useState, useRef, useEffect } from "react"; +import { useAuthStore } from "../../store/useAuthStore"; +import { useConfigStore } from "../../store/useConfigStore"; +import { useTheme } from "../../store/useTheme"; + +export default function StatusBar() { + const { theme, toggleTheme } = useTheme(); + const { enabled, status, environment, tenants, uipathUrl, setEnvironment, startLogin, selectTenant, logout } = useAuthStore(); + const { projectName, projectVersion, projectAuthors } = useConfigStore(); + const [popoverOpen, setPopoverOpen] = useState(false); + const [selectedTenant, setSelectedTenant] = useState(""); + const popoverRef = useRef(null); + const triggerRef = useRef(null); + + // Close popover on outside click + useEffect(() => { + if (!popoverOpen) return; + const handleClick = (e: MouseEvent) => { + if ( + popoverRef.current && !popoverRef.current.contains(e.target as Node) && + triggerRef.current && !triggerRef.current.contains(e.target as Node) + ) { + setPopoverOpen(false); + } + }; + document.addEventListener("mousedown", handleClick); + return () => document.removeEventListener("mousedown", handleClick); + }, [popoverOpen]); + + const isAuthenticated = status === "authenticated"; + const isExpired = status === "expired"; + const isPending = status === "pending"; + const needsTenant = status === "needs_tenant"; + + // Build label + icon + let label = "UiPath: Disconnected"; + let dotColor: string | null = null; + let lockIcon = true; + + if (isAuthenticated) { + const shortUrl = uipathUrl ? uipathUrl.replace(/^https?:\/\/[^/]+\//, "") : ""; + label = `UiPath: ${shortUrl}`; + dotColor = "var(--success)"; + lockIcon = false; + } else if (isExpired) { + const shortUrl = uipathUrl ? uipathUrl.replace(/^https?:\/\/[^/]+\//, "") : ""; + label = `UiPath: ${shortUrl} (expired)`; + dotColor = "var(--error)"; + lockIcon = false; + } else if (isPending) { + label = "UiPath: Signing in\u2026"; + } else if (needsTenant) { + label = "UiPath: Select Tenant"; + } + + const handleClick = () => { + if (isPending) return; + if (isExpired) { + startLogin(); + } else { + setPopoverOpen((v) => !v); + } + }; + + const itemClass = "flex items-center gap-1 px-1.5 rounded transition-colors"; + const hoverHandlers = { + onMouseEnter: (e: React.MouseEvent) => { e.currentTarget.style.background = "var(--bg-hover)"; e.currentTarget.style.color = "var(--text-primary)"; }, + onMouseLeave: (e: React.MouseEvent) => { e.currentTarget.style.background = ""; e.currentTarget.style.color = "var(--text-muted)"; }, + }; + + return ( +
+ {/* Auth status */} + {enabled && ( +
+
+ {isPending ? ( + + + + + ) : dotColor ? ( +
+ ) : lockIcon ? ( + + + + + ) : null} + {label} +
+ + {/* Popover */} + {popoverOpen && ( +
+ {(isAuthenticated || isExpired) ? ( + <> + + + + ) : needsTenant ? ( +
+ + + +
+ ) : ( +
+ + + +
+ )} +
+ )} +
+ )} + + {/* Project name */} + {projectName && ( + Project: {projectName} + )} + + {/* Project version */} + {projectVersion && ( + Version: v{projectVersion} + )} + + {/* Project author */} + {projectAuthors && ( + Author: {projectAuthors} + )} + + {/* GitHub */} + + + + + uipath-dev-python + + + {/* Theme toggle */} +
+ + {theme === "dark" ? ( + <> + ) : ( + + )} + + {theme === "dark" ? "Dark" : "Light"} +
+
+ ); +} diff --git a/src/uipath/dev/server/frontend/src/components/runs/NewRunPanel.tsx b/src/uipath/dev/server/frontend/src/components/runs/NewRunPanel.tsx index d5bba3b..f497250 100644 --- a/src/uipath/dev/server/frontend/src/components/runs/NewRunPanel.tsx +++ b/src/uipath/dev/server/frontend/src/components/runs/NewRunPanel.tsx @@ -150,22 +150,6 @@ export default function NewRunPanel() { />
)} - - {/* GitHub link */} -
); diff --git a/src/uipath/dev/server/frontend/src/components/traces/SpanDetails.tsx b/src/uipath/dev/server/frontend/src/components/traces/SpanDetails.tsx index 11ca330..af71b9b 100644 --- a/src/uipath/dev/server/frontend/src/components/traces/SpanDetails.tsx +++ b/src/uipath/dev/server/frontend/src/components/traces/SpanDetails.tsx @@ -174,7 +174,7 @@ export default function SpanDetails({ span }: Props) { <>
setAttrsOpen((o) => !o)} > Attributes ({attrEntries.length}) @@ -209,7 +209,7 @@ export default function SpanDetails({ span }: Props) { {/* Identifiers — collapsible */}
setIdsOpen((o) => !o)} > Identifiers ({ids.length}) diff --git a/src/uipath/dev/server/frontend/src/store/useConfigStore.ts b/src/uipath/dev/server/frontend/src/store/useConfigStore.ts new file mode 100644 index 0000000..ca7e5af --- /dev/null +++ b/src/uipath/dev/server/frontend/src/store/useConfigStore.ts @@ -0,0 +1,30 @@ +import { create } from "zustand"; + +interface ConfigStore { + projectName: string | null; + projectVersion: string | null; + projectAuthors: string | null; + init: () => Promise; +} + +export const useConfigStore = create((set) => ({ + projectName: null, + projectVersion: null, + projectAuthors: null, + + init: async () => { + try { + const res = await fetch("/api/config"); + if (res.ok) { + const data = await res.json(); + set({ + projectName: data.project_name ?? null, + projectVersion: data.project_version ?? null, + projectAuthors: data.project_authors ?? null, + }); + } + } catch { + // ignore + } + }, +})); diff --git a/src/uipath/dev/server/frontend/tsconfig.tsbuildinfo b/src/uipath/dev/server/frontend/tsconfig.tsbuildinfo index e5b77c2..abd56bd 100644 --- a/src/uipath/dev/server/frontend/tsconfig.tsbuildinfo +++ b/src/uipath/dev/server/frontend/tsconfig.tsbuildinfo @@ -1 +1 @@ -{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/api/auth.ts","./src/api/client.ts","./src/api/websocket.ts","./src/components/chat/chatinput.tsx","./src/components/chat/chatinterrupt.tsx","./src/components/chat/chatmessage.tsx","./src/components/chat/chatpanel.tsx","./src/components/debug/debugcontrols.tsx","./src/components/graph/graphpanel.tsx","./src/components/graph/edges/elkedge.tsx","./src/components/graph/nodes/defaultnode.tsx","./src/components/graph/nodes/endnode.tsx","./src/components/graph/nodes/groupnode.tsx","./src/components/graph/nodes/modelnode.tsx","./src/components/graph/nodes/startnode.tsx","./src/components/graph/nodes/toolnode.tsx","./src/components/layout/sidebar.tsx","./src/components/logs/logpanel.tsx","./src/components/runs/newrunpanel.tsx","./src/components/runs/rundetailspanel.tsx","./src/components/runs/runeventspanel.tsx","./src/components/runs/runhistoryitem.tsx","./src/components/runs/setupview.tsx","./src/components/shared/jsonhighlight.tsx","./src/components/shared/reloadtoast.tsx","./src/components/traces/spandetails.tsx","./src/components/traces/tracetree.tsx","./src/components/traces/waterfallview.tsx","./src/hooks/usehashroute.ts","./src/hooks/useismobile.ts","./src/store/useauthstore.ts","./src/store/userunstore.ts","./src/store/usetheme.ts","./src/store/usewebsocket.ts","./src/types/graph.ts","./src/types/run.ts","./src/types/ws.ts"],"version":"5.7.3"} \ No newline at end of file +{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/api/auth.ts","./src/api/client.ts","./src/api/websocket.ts","./src/components/chat/chatinput.tsx","./src/components/chat/chatinterrupt.tsx","./src/components/chat/chatmessage.tsx","./src/components/chat/chatpanel.tsx","./src/components/debug/debugcontrols.tsx","./src/components/graph/graphpanel.tsx","./src/components/graph/edges/elkedge.tsx","./src/components/graph/nodes/defaultnode.tsx","./src/components/graph/nodes/endnode.tsx","./src/components/graph/nodes/groupnode.tsx","./src/components/graph/nodes/modelnode.tsx","./src/components/graph/nodes/startnode.tsx","./src/components/graph/nodes/toolnode.tsx","./src/components/layout/sidebar.tsx","./src/components/layout/statusbar.tsx","./src/components/logs/logpanel.tsx","./src/components/runs/newrunpanel.tsx","./src/components/runs/rundetailspanel.tsx","./src/components/runs/runeventspanel.tsx","./src/components/runs/runhistoryitem.tsx","./src/components/runs/setupview.tsx","./src/components/shared/jsonhighlight.tsx","./src/components/shared/reloadtoast.tsx","./src/components/traces/spandetails.tsx","./src/components/traces/tracetree.tsx","./src/components/traces/waterfallview.tsx","./src/hooks/usehashroute.ts","./src/hooks/useismobile.ts","./src/store/useauthstore.ts","./src/store/useconfigstore.ts","./src/store/userunstore.ts","./src/store/usetheme.ts","./src/store/usewebsocket.ts","./src/types/graph.ts","./src/types/run.ts","./src/types/ws.ts"],"version":"5.7.3"} \ No newline at end of file diff --git a/src/uipath/dev/server/static/assets/ChatPanel-DjL_r8HV.js b/src/uipath/dev/server/static/assets/ChatPanel-CeP3-CFA.js similarity index 99% rename from src/uipath/dev/server/static/assets/ChatPanel-DjL_r8HV.js rename to src/uipath/dev/server/static/assets/ChatPanel-CeP3-CFA.js index 8059504..aedb87b 100644 --- a/src/uipath/dev/server/static/assets/ChatPanel-DjL_r8HV.js +++ b/src/uipath/dev/server/static/assets/ChatPanel-CeP3-CFA.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-BoTXW6Wk.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-CQlfl4ed.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;++le: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-sm{border-radius:var(--radius-sm)}.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-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-6{padding-block:calc(var(--spacing)*6)}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-px{padding-top:1px}.pr-0{padding-right:calc(var(--spacing)*0)}.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,)}.no-underline{text-decoration-line:none}.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}@keyframes spin{to{transform:rotate(360deg)}} diff --git a/src/uipath/dev/server/static/assets/index-BoTXW6Wk.js b/src/uipath/dev/server/static/assets/index-BoTXW6Wk.js deleted file mode 100644 index 74b0a60..0000000 --- a/src/uipath/dev/server/static/assets/index-BoTXW6Wk.js +++ /dev/null @@ -1,42 +0,0 @@ -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-DjL_r8HV.js","assets/vendor-reactflow-mU21rT8r.js","assets/vendor-reactflow-B5DZHykP.css"])))=>i.map(i=>d[i]); -var Xe=Object.defineProperty;var Ke=(t,r,s)=>r in t?Xe(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s;var K=(t,r,s)=>Ke(t,typeof r!="symbol"?r+"":r,s);import{R as se,a as x,j as e,b as Ze}from"./vendor-react-BVoutfaX.js";import{H as Y,P as X,B as Qe,M as et,u as tt,a as rt,R as st,b as nt,C as ot,c as at,d as it}from"./vendor-reactflow-mU21rT8r.js";(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function s(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(o){if(o.ep)return;o.ep=!0;const i=s(o);fetch(o.href,i)}})();const he=t=>{let r;const s=new Set,n=(u,l)=>{const d=typeof u=="function"?u(r):u;if(!Object.is(d,r)){const j=r;r=l??(typeof d!="object"||d===null)?d:Object.assign({},r,d),s.forEach(f=>f(r,j))}},o=()=>r,c={setState:n,getState:o,getInitialState:()=>h,subscribe:u=>(s.add(u),()=>s.delete(u))},h=r=t(n,o,c);return c},ct=(t=>t?he(t):he),lt=t=>t;function dt(t,r=lt){const s=se.useSyncExternalStore(t.subscribe,se.useCallback(()=>r(t.getState()),[t,r]),se.useCallback(()=>r(t.getInitialState()),[t,r]));return se.useDebugValue(s),s}const me=t=>{const r=ct(t),s=n=>dt(r,n);return Object.assign(s,r),s},xe=(t=>t?me(t):me),O=xe(t=>({runs:{},selectedRunId:null,traces:{},logs:{},chatMessages:{},entrypoints:[],setRuns:r=>t(s=>{var i;let n=s.breakpoints;for(const a of r)(i=a.breakpoints)!=null&&i.length&&!n[a.id]&&(n={...n,[a.id]:Object.fromEntries(a.breakpoints.map(c=>[c,!0]))});const o={runs:Object.fromEntries(r.map(a=>[a.id,a]))};return n!==s.breakpoints&&(o.breakpoints=n),o}),upsertRun:r=>t(s=>{var o;const n={runs:{...s.runs,[r.id]:r}};if((o=r.breakpoints)!=null&&o.length&&!s.breakpoints[r.id]&&(n.breakpoints={...s.breakpoints,[r.id]:Object.fromEntries(r.breakpoints.map(i=>[i,!0]))}),(r.status==="completed"||r.status==="failed")&&s.activeNodes[r.id]){const{[r.id]:i,...a}=s.activeNodes;n.activeNodes=a}if(r.status!=="suspended"&&s.activeInterrupt[r.id]){const{[r.id]:i,...a}=s.activeInterrupt;n.activeInterrupt=a}return n}),selectRun:r=>t({selectedRunId:r}),addTrace:r=>t(s=>{const n=s.traces[r.run_id]??[],o=n.findIndex(a=>a.span_id===r.span_id),i=o>=0?n.map((a,c)=>c===o?r:a):[...n,r];return{traces:{...s.traces,[r.run_id]:i}}}),setTraces:(r,s)=>t(n=>({traces:{...n.traces,[r]:s}})),addLog:r=>t(s=>{const n=s.logs[r.run_id]??[];return{logs:{...s.logs,[r.run_id]:[...n,r]}}}),setLogs:(r,s)=>t(n=>({logs:{...n.logs,[r]:s}})),addChatEvent:(r,s)=>t(n=>{const o=n.chatMessages[r]??[],i=s.message;if(!i)return n;const a=i.messageId??i.message_id,c=i.role??"assistant",l=(i.contentParts??i.content_parts??[]).filter(S=>{const k=S.mimeType??S.mime_type??"";return k.startsWith("text/")||k==="application/json"}).map(S=>{const k=S.data;return(k==null?void 0:k.inline)??""}).join(` -`).trim(),d=(i.toolCalls??i.tool_calls??[]).map(S=>({name:S.name??"",has_result:!!S.result})),j={message_id:a,role:c,content:l,tool_calls:d.length>0?d:void 0},f=o.findIndex(S=>S.message_id===a);if(f>=0)return{chatMessages:{...n.chatMessages,[r]:o.map((S,k)=>k===f?j:S)}};if(c==="user"){const S=o.findIndex(k=>k.message_id.startsWith("local-")&&k.role==="user"&&k.content===l);if(S>=0)return{chatMessages:{...n.chatMessages,[r]:o.map((k,$)=>$===S?j:k)}}}const y=[...o,j];return{chatMessages:{...n.chatMessages,[r]:y}}}),addLocalChatMessage:(r,s)=>t(n=>{const o=n.chatMessages[r]??[];return{chatMessages:{...n.chatMessages,[r]:[...o,s]}}}),setChatMessages:(r,s)=>t(n=>({chatMessages:{...n.chatMessages,[r]:s}})),setEntrypoints:r=>t({entrypoints:r}),breakpoints:{},toggleBreakpoint:(r,s)=>t(n=>{const o={...n.breakpoints[r]??{}};return o[s]?delete o[s]:o[s]=!0,{breakpoints:{...n.breakpoints,[r]:o}}}),clearBreakpoints:r=>t(s=>{const{[r]:n,...o}=s.breakpoints;return{breakpoints:o}}),activeNodes:{},setActiveNode:(r,s,n)=>t(o=>{const i=o.activeNodes[r]??{executing:{},prev:null};return{activeNodes:{...o.activeNodes,[r]:{executing:{...i.executing,[s]:n??null},prev:i.prev}}}}),removeActiveNode:(r,s)=>t(n=>{const o=n.activeNodes[r];if(!o)return n;const{[s]:i,...a}=o.executing;return{activeNodes:{...n.activeNodes,[r]:{executing:a,prev:s}}}}),resetRunGraphState:r=>t(s=>({stateEvents:{...s.stateEvents,[r]:[]},activeNodes:{...s.activeNodes,[r]:{executing:{},prev:null}}})),stateEvents:{},addStateEvent:(r,s,n,o,i)=>t(a=>{const c=a.stateEvents[r]??[];return{stateEvents:{...a.stateEvents,[r]:[...c,{node_name:s,qualified_node_name:o,phase:i,timestamp:Date.now(),payload:n}]}}}),setStateEvents:(r,s)=>t(n=>({stateEvents:{...n.stateEvents,[r]:s}})),focusedSpan:null,setFocusedSpan:r=>t({focusedSpan:r}),activeInterrupt:{},setActiveInterrupt:(r,s)=>t(n=>({activeInterrupt:{...n.activeInterrupt,[r]:s}})),reloadPending:!1,setReloadPending:r=>t({reloadPending:r}),graphCache:{},setGraphCache:(r,s)=>t(n=>({graphCache:{...n.graphCache,[r]:s}}))})),ie="/api";async function ut(t){const r=await fetch(`${ie}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({environment:t})});if(!r.ok)throw new Error(`Login failed: ${r.status}`);return r.json()}async function ce(){const t=await fetch(`${ie}/auth/status`);if(!t.ok)throw new Error(`Status check failed: ${t.status}`);return t.json()}async function pt(t){const r=await fetch(`${ie}/auth/select-tenant`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tenant_name:t})});if(!r.ok)throw new Error(`Tenant selection failed: ${r.status}`);return r.json()}async function xt(){await fetch(`${ie}/auth/logout`,{method:"POST"})}const We="uipath-env",ht=["cloud","staging","alpha"];function mt(){const t=localStorage.getItem(We);return ht.includes(t)?t:"cloud"}const Ae=xe((t,r)=>({enabled:!0,status:"unauthenticated",environment:mt(),tenants:[],uipathUrl:null,pollTimer:null,expiryTimer:null,init:async()=>{try{const s=await fetch("/api/config");if(s.ok&&!(await s.json()).auth_enabled){t({enabled:!1});return}const n=await ce();t({status:n.status,tenants:n.tenants??[],uipathUrl:n.uipath_url??null}),n.status==="authenticated"&&r().startExpiryCheck()}catch(s){console.error("Auth init failed",s)}},setEnvironment:s=>{localStorage.setItem(We,s),t({environment:s})},startLogin:async()=>{const{environment:s}=r();try{const n=await ut(s);t({status:"pending"}),window.open(n.auth_url,"_blank"),r().pollStatus()}catch(n){console.error("Login failed",n)}},pollStatus:()=>{const{pollTimer:s}=r();if(s)return;const n=setInterval(async()=>{try{const o=await ce();o.status!=="pending"&&(r().stopPolling(),t({status:o.status,tenants:o.tenants??[],uipathUrl:o.uipath_url??null}),o.status==="authenticated"&&r().startExpiryCheck())}catch{}},2e3);t({pollTimer:n})},stopPolling:()=>{const{pollTimer:s}=r();s&&(clearInterval(s),t({pollTimer:null}))},startExpiryCheck:()=>{const{expiryTimer:s}=r();if(s)return;const n=setInterval(async()=>{try{(await ce()).status==="expired"&&(r().stopExpiryCheck(),t({status:"expired"}))}catch{}},3e4);t({expiryTimer:n})},stopExpiryCheck:()=>{const{expiryTimer:s}=r();s&&(clearInterval(s),t({expiryTimer:null}))},selectTenant:async s=>{try{const n=await pt(s);t({status:"authenticated",uipathUrl:n.uipath_url,tenants:[]}),r().startExpiryCheck()}catch(n){console.error("Tenant selection failed",n)}},logout:async()=>{r().stopPolling(),r().stopExpiryCheck();try{await xt()}catch{}t({status:"unauthenticated",tenants:[],uipathUrl:null})}}));class gt{constructor(r){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 s=window.location.protocol==="https:"?"wss:":"ws:";this.url=r??`${s}//${window.location.host}/ws`}connect(){var r;((r=this.ws)==null?void 0:r.readyState)!==WebSocket.OPEN&&(this.ws=new WebSocket(this.url),this.ws.onopen=()=>{console.log("[ws] connected");for(const s of this.activeSubscriptions)this.sendRaw(JSON.stringify({type:"subscribe",payload:{run_id:s}}));for(const s of this.pendingMessages)this.sendRaw(s);this.pendingMessages=[]},this.ws.onmessage=s=>{let n;try{n=JSON.parse(s.data)}catch{console.warn("[ws] failed to parse message",s.data);return}this.handlers.forEach(o=>{try{o(n)}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 s;(s=this.ws)==null||s.close()})}disconnect(){var r;this.shouldReconnect=!1,this.reconnectTimer&&clearTimeout(this.reconnectTimer),(r=this.ws)==null||r.close(),this.ws=null}onMessage(r){return this.handlers.add(r),()=>this.handlers.delete(r)}sendRaw(r){var s;((s=this.ws)==null?void 0:s.readyState)===WebSocket.OPEN&&this.ws.send(r)}send(r,s){var o;const n=JSON.stringify({type:r,payload:s});((o=this.ws)==null?void 0:o.readyState)===WebSocket.OPEN?this.ws.send(n):this.pendingMessages.push(n)}subscribe(r){this.activeSubscriptions.add(r),this.send("subscribe",{run_id:r})}unsubscribe(r){this.activeSubscriptions.delete(r),this.send("unsubscribe",{run_id:r})}sendChatMessage(r,s){this.send("chat.message",{run_id:r,text:s})}sendInterruptResponse(r,s){this.send("chat.interrupt_response",{run_id:r,data:s})}debugStep(r){this.send("debug.step",{run_id:r})}debugContinue(r){this.send("debug.continue",{run_id:r})}debugStop(r){this.send("debug.stop",{run_id:r})}setBreakpoints(r,s){this.send("debug.set_breakpoints",{run_id:r,breakpoints:s})}}let ne=null;function ft(){return ne||(ne=new gt,ne.connect()),ne}function vt(){const t=x.useRef(ft()),{upsertRun:r,addTrace:s,addLog:n,addChatEvent:o,setActiveInterrupt:i,setActiveNode:a,removeActiveNode:c,resetRunGraphState:h,addStateEvent:u,setReloadPending:l}=O();return x.useEffect(()=>t.current.onMessage(f=>{switch(f.type){case"run.updated":r(f.payload);break;case"trace":s(f.payload);break;case"log":n(f.payload);break;case"chat":{const y=f.payload.run_id;o(y,f.payload);break}case"chat.interrupt":{const y=f.payload.run_id;i(y,f.payload);break}case"state":{const y=f.payload.run_id,S=f.payload.node_name,k=f.payload.qualified_node_name??null,$=f.payload.phase??null,A=f.payload.payload;S==="__start__"&&$==="started"&&h(y),$==="started"?a(y,S,k):$==="completed"&&c(y,S),u(y,S,A,k,$);break}case"reload":l(!0);break}}),[r,s,n,o,i,a,c,h,u,l]),t.current}const Z="/api";async function Q(t,r){const s=await fetch(t,r);if(!s.ok){let n;try{n=(await s.json()).detail||s.statusText}catch{n=s.statusText}const o=new Error(`HTTP ${s.status}`);throw o.detail=n,o.status=s.status,o}return s.json()}async function He(){return Q(`${Z}/entrypoints`)}async function yt(t){return Q(`${Z}/entrypoints/${encodeURIComponent(t)}/schema`)}async function bt(t){return Q(`${Z}/entrypoints/${encodeURIComponent(t)}/mock-input`)}async function jt(t){return Q(`${Z}/entrypoints/${encodeURIComponent(t)}/graph`)}async function ge(t,r,s="run",n=[]){return Q(`${Z}/runs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entrypoint:t,input_data:r,mode:s,breakpoints:n})})}async function wt(){return Q(`${Z}/runs`)}async function le(t){return Q(`${Z}/runs/${t}`)}async function kt(){return Q(`${Z}/reload`,{method:"POST"})}function Nt(t){const r=t.replace(/^#\/?/,"");if(!r||r==="new")return{view:"new",runId:null,tab:"traces",setupEntrypoint:null,setupMode:null};const s=r.match(/^setup\/([^/]+)\/(run|chat)$/);if(s)return{view:"setup",runId:null,tab:"traces",setupEntrypoint:decodeURIComponent(s[1]),setupMode:s[2]};const n=r.match(/^runs\/([^/]+)(?:\/(traces|output))?$/);return n?{view:"details",runId:n[1],tab:n[2]??"traces",setupEntrypoint:null,setupMode:null}:{view:"new",runId:null,tab:"traces",setupEntrypoint:null,setupMode:null}}function St(){return window.location.hash}function Et(t){return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)}function Be(){const t=x.useSyncExternalStore(Et,St),r=Nt(t),s=x.useCallback(n=>{window.location.hash=n},[]);return{...r,navigate:s}}const fe="(max-width: 767px)";function Ct(){const[t,r]=x.useState(()=>window.matchMedia(fe).matches);return x.useEffect(()=>{const s=window.matchMedia(fe),n=o=>r(o.matches);return s.addEventListener("change",n),()=>s.removeEventListener("change",n)},[]),t}function De(){const t=localStorage.getItem("uipath-dev-theme");return t==="light"||t==="dark"?t:"dark"}function Ve(t){document.documentElement.setAttribute("data-theme",t),localStorage.setItem("uipath-dev-theme",t)}Ve(De());const Tt=xe(t=>({theme:De(),toggleTheme:()=>t(r=>{const s=r.theme==="dark"?"light":"dark";return Ve(s),{theme:s}})})),_t={pending:"var(--text-muted)",running:"var(--warning)",suspended:"var(--info)",completed:"var(--success)",failed:"var(--error)"};function ve({run:t,isSelected:r,onClick:s}){var a;const n=_t[t.status]??"var(--text-muted)",o=((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:s,className:"w-full text-left px-3 py-1.5 flex items-center gap-2 transition-colors cursor-pointer",style:{background:r?"color-mix(in srgb, var(--accent) 8%, var(--bg-primary))":void 0,borderLeft:r?"2px solid var(--accent)":"2px solid transparent"},onMouseEnter:c=>{r||(c.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:c=>{r||(c.currentTarget.style.background="")},children:[e.jsx("span",{className:"shrink-0 w-1.5 h-1.5 rounded-full",style:{background:n}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xs truncate",style:{color:r?"var(--text-primary)":"var(--text-secondary)"},children:o}),e.jsxs("div",{className:"text-[10px] tabular-nums",style:{color:"var(--text-muted)"},children:[i,t.duration?` · ${t.duration}`:""]})]})]})}function Lt({runs:t,selectedRunId:r,onSelectRun:s,onNewRun:n,isMobile:o,isOpen:i,onClose:a}){const{theme:c,toggleTheme:h}=Tt(),u=[...t].sort((l,d)=>new Date(d.start_time??0).getTime()-new Date(l.start_time??0).getTime());return o?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:n,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:h,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:n,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(ve,{run:l,isSelected:l.id===r,onClick:()=>s(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"})]}),e.jsx(ye,{})]})]}):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:n,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:h,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:n,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(ve,{run:l,isSelected:l.id===r,onClick:()=>s(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"})]}),e.jsx(ye,{})]})}function ye(){const{enabled:t,status:r,environment:s,tenants:n,uipathUrl:o,setEnvironment:i,startLogin:a,selectTenant:c,logout:h}=Ae(),[u,l]=x.useState("");if(!t)return null;if(r==="authenticated"||r==="expired"){const d=o?o.replace(/^https?:\/\/[^/]+\//,""):"",j=r==="expired";return e.jsx("div",{className:"px-2 py-2 border-t border-[var(--border)]",children:e.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[j?e.jsxs("button",{onClick:a,className:"flex items-center gap-1.5 min-w-0 cursor-pointer transition-opacity hover:opacity-80",style:{background:"none",border:"none",padding:0},title:"Token expired — click to re-authenticate",children:[e.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"var(--error)"}}),e.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-muted)"},children:d})]}):e.jsxs("a",{href:o??"#",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 min-w-0 transition-opacity hover:opacity-80",title:o??"",children:[e.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"var(--success)"}}),e.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-muted)"},children:d})]}),e.jsx("button",{onClick:h,className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded cursor-pointer transition-colors",style:{color:"var(--text-muted)"},onMouseEnter:f=>{f.currentTarget.style.color="var(--text-primary)"},onMouseLeave:f=>{f.currentTarget.style.color="var(--text-muted)"},title:"Sign out",children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),e.jsx("polyline",{points:"16 17 21 12 16 7"}),e.jsx("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]})})]})})}return r==="pending"?e.jsxs("div",{className:"px-2 py-2 border-t border-[var(--border)] flex items-center gap-2",children:[e.jsxs("svg",{className:"animate-spin",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",strokeOpacity:"0.25"}),e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",strokeLinecap:"round"})]}),e.jsx("span",{className:"text-[10px]",style:{color:"var(--text-muted)"},children:"Signing in…"})]}):r==="needs_tenant"?e.jsxs("div",{className:"px-2 py-2 border-t border-[var(--border)]",children:[e.jsx("label",{className:"block text-[10px] uppercase tracking-wider font-semibold mb-1",style:{color:"var(--text-muted)"},children:"Tenant"}),e.jsxs("select",{value:u,onChange:d=>l(d.target.value),className:"w-full rounded px-1.5 py-1 text-[10px] mb-1.5 appearance-auto",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)",color:"var(--text-primary)"},children:[e.jsx("option",{value:"",children:"Select…"}),n.map(d=>e.jsx("option",{value:d,children:d},d))]}),e.jsx("button",{onClick:()=>u&&c(u),disabled:!u,className:"w-full px-2 py-1 text-[10px] uppercase tracking-wider font-semibold rounded border border-[var(--border)] bg-transparent cursor-pointer transition-colors disabled:opacity-30 disabled:cursor-not-allowed",style:{color:"var(--text-muted)"},children:"Confirm"})]}):e.jsxs("div",{className:"px-2 py-2 border-t border-[var(--border)]",children:[e.jsxs("select",{value:s,onChange:d=>i(d.target.value),className:"w-full rounded px-1.5 py-0.5 text-[10px] mb-1.5 appearance-auto",style:{background:"var(--bg-secondary)",border:"1px solid var(--border)",color:"var(--text-muted)"},children:[e.jsx("option",{value:"cloud",children:"cloud"}),e.jsx("option",{value:"staging",children:"staging"}),e.jsx("option",{value:"alpha",children:"alpha"})]}),e.jsx("button",{onClick:a,className:"w-full px-2 py-1 text-[10px] uppercase tracking-wider font-semibold rounded border border-[var(--border)] bg-transparent cursor-pointer transition-colors",style:{color:"var(--text-muted)"},onMouseEnter:d=>{d.currentTarget.style.color="var(--text-primary)",d.currentTarget.style.borderColor="var(--text-muted)"},onMouseLeave:d=>{d.currentTarget.style.color="var(--text-muted)",d.currentTarget.style.borderColor="var(--border)"},children:"Sign In"})]})}function Mt(){const{navigate:t}=Be(),r=O(u=>u.entrypoints),[s,n]=x.useState(""),[o,i]=x.useState(!0),[a,c]=x.useState(null);x.useEffect(()=>{!s&&r.length>0&&n(r[0])},[r,s]),x.useEffect(()=>{s&&(i(!0),c(null),yt(s).then(u=>{var d;const l=(d=u.input)==null?void 0:d.properties;i(!!(l!=null&&l.messages))}).catch(u=>{const l=u.detail||{};c(l.error||l.message||`Failed to load entrypoint "${s}"`)}))},[s]);const h=u=>{s&&t(`#/setup/${encodeURIComponent(s)}/${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:r.length>1?"Select an entrypoint and choose a mode":"Choose a mode"})]}),r.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",{id:"entrypoint-select",value:s,onChange:u=>n(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:r.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(be,{title:"Autonomous",description:"Run the agent end-to-end. Set breakpoints to pause and inspect execution.",icon:e.jsx(Rt,{}),color:"var(--success)",onClick:()=>h("run"),disabled:!s}),e.jsx(be,{title:"Conversational",description:o?"Interactive chat session. Send messages and receive responses in real time.":'Requires a "messages" property in the input schema.',icon:e.jsx($t,{}),color:"var(--accent)",onClick:()=>h("chat"),disabled:!s||!o})]}),e.jsx("div",{className:"mt-8 text-center",children:e.jsxs("a",{href:"https://github.com/UiPath/uipath-dev-python",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-[12px] 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 be({title:t,description:r,icon:s,color:n,onClick:o,disabled:i}){return e.jsxs("button",{onClick:o,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=n,a.currentTarget.style.background=`color-mix(in srgb, ${n} 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, ${n} 10%, var(--bg-primary))`,color:n},children:s}),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:r})]})}function Rt(){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 $t(){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 It="modulepreload",Pt=function(t){return"/"+t},je={},ze=function(r,s,n){let o=Promise.resolve();if(s&&s.length>0){let a=function(u){return Promise.all(u.map(l=>Promise.resolve(l).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),h=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));o=a(s.map(u=>{if(u=Pt(u),u in je)return;je[u]=!0;const l=u.endsWith(".css"),d=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${d}`))return;const j=document.createElement("link");if(j.rel=l?"stylesheet":It,l||(j.as="script"),j.crossOrigin="",j.href=u,h&&j.setAttribute("nonce",h),document.head.appendChild(j),l)return new Promise((f,y)=>{j.addEventListener("load",f),j.addEventListener("error",()=>y(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 o.then(a=>{for(const c of a||[])c.status==="rejected"&&i(c.reason);return r().catch(i)})},Ot={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Wt({data:t}){const r=t.status,s=t.nodeWidth,n=t.label??"Start",o=t.hasBreakpoint,i=t.isPausedHere,a=t.isActiveNode,c=t.isExecutingNode,h=i?"var(--error)":c?"var(--success)":a?"var(--accent)":r==="completed"?"var(--success)":r==="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:s,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${h}`,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:n,children:[o&&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)"}}),n,e.jsx(Y,{type:"source",position:X.Bottom,style:Ot})]})}const At={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Ht({data:t}){const r=t.status,s=t.nodeWidth,n=t.label??"End",o=t.hasBreakpoint,i=t.isPausedHere,a=t.isActiveNode,c=t.isExecutingNode,h=i?"var(--error)":c?"var(--success)":a?"var(--accent)":r==="completed"?"var(--success)":r==="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:s,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${h}`,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:n,children:[o&&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:At}),n]})}const we={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Bt({data:t}){const r=t.status,s=t.nodeWidth,n=t.model_name,o=t.label??"Model",i=t.hasBreakpoint,a=t.isPausedHere,c=t.isActiveNode,h=t.isExecutingNode,u=a?"var(--error)":h?"var(--success)":c?"var(--accent)":r==="completed"?"var(--success)":r==="running"?"var(--warning)":r==="failed"?"var(--error)":"var(--node-border)",l=a?"var(--error)":h?"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:s,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${u}`,boxShadow:a||c||h?`0 0 4px ${l}`:void 0,animation:a||c||h?`node-pulse-${a?"red":h?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:n?`${o} -${n}`:o,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:we}),e.jsx("div",{style:{color:"var(--info)",fontSize:9,marginBottom:1},children:"model"}),e.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:o}),n&&e.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",style:{color:"var(--text-muted)",fontSize:9,marginTop:1},title:n,children:n}),e.jsx(Y,{type:"source",position:X.Bottom,style:we})]})}const ke={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0},Dt=3;function Vt({data:t}){const r=t.status,s=t.nodeWidth,n=t.tool_names,o=t.tool_count,i=t.label??"Tool",a=t.hasBreakpoint,c=t.isPausedHere,h=t.isActiveNode,u=t.isExecutingNode,l=c?"var(--error)":u?"var(--success)":h?"var(--accent)":r==="completed"?"var(--success)":r==="running"?"var(--warning)":r==="failed"?"var(--error)":"var(--node-border)",d=c?"var(--error)":u?"var(--success)":"var(--accent)",j=(n==null?void 0:n.slice(0,Dt))??[],f=(o??(n==null?void 0:n.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:s,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${l}`,boxShadow:c||h||u?`0 0 4px ${d}`:void 0,animation:c||h||u?`node-pulse-${c?"red":u?"green":"accent"} 1.5s ease-in-out infinite`:void 0},title:n!=null&&n.length?`${i} - -${n.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:ke}),e.jsxs("div",{style:{color:"var(--warning)",fontSize:9,marginBottom:1},children:["tools",o?` (${o})`:""]}),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(y=>e.jsx("div",{className:"truncate",children:y},y)),f>0&&e.jsxs("div",{style:{fontStyle:"italic"},children:["+",f," more"]})]}),e.jsx(Y,{type:"source",position:X.Bottom,style:ke})]})}const Ne={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function zt({data:t}){const r=t.label??"",s=t.status,n=t.hasBreakpoint,o=t.isPausedHere,i=t.isActiveNode,a=t.isExecutingNode,c=o?"var(--error)":a?"var(--success)":i?"var(--accent)":s==="completed"?"var(--success)":s==="running"?"var(--warning)":s==="failed"?"var(--error)":"var(--bg-tertiary)",h=o?"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 ${o||i||a?"solid":"dashed"} ${c}`,borderRadius:8,boxShadow:o||i||a?`0 0 4px ${h}`:void 0,animation:o||i||a?`node-pulse-${o?"red":a?"green":"accent"} 1.5s ease-in-out infinite`:void 0},children:[n&&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:Ne}),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:r}),e.jsx(Y,{type:"source",position:X.Bottom,style:Ne})]})}function Ft({data:t}){const r=t.status,s=t.nodeWidth,n=t.label??"",o=t.hasBreakpoint,i=t.isPausedHere,a=t.isActiveNode,c=t.isExecutingNode,h=i?"var(--error)":c?"var(--success)":a?"var(--accent)":r==="completed"?"var(--success)":r==="running"?"var(--warning)":r==="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:s,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${h}`,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:n,children:[o&&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:n}),e.jsx(Y,{type:"source",position:X.Bottom})]})}function Ut(t,r=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 s=`M ${t[0].x} ${t[0].y}`;for(let o=1;o0&&(s+=Math.min(n.length,3)*12+(n.length>3?12:0)+4),t!=null&&t.model_name&&(s+=14),s}let de=null;async function Zt(){if(!de){const{default:t}=await ze(async()=>{const{default:r}=await import("./vendor-elk-CTNP4r_q.js").then(s=>s.e);return{default:r}},__vite__mapDeps([0,1]));de=new t}return de}const Ce={"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"},Qt="[top=35,left=15,bottom=15,right=15]";function er(t){const r=[],s=[];for(const n of t.nodes){const o=n.data,i={id:n.id,width:Se(o),height:Ee(o,n.type)};if(n.data.subgraph){const a=n.data.subgraph;delete i.width,delete i.height,i.layoutOptions={...Ce,"elk.padding":Qt},i.children=a.nodes.map(c=>({id:`${n.id}/${c.id}`,width:Se(c.data),height:Ee(c.data,c.type)})),i.edges=a.edges.map(c=>({id:`${n.id}/${c.id}`,sources:[`${n.id}/${c.source}`],targets:[`${n.id}/${c.target}`]}))}r.push(i)}for(const n of t.edges)s.push({id:n.id,sources:[n.source],targets:[n.target]});return{id:"root",layoutOptions:Ce,children:r,edges:s}}const pe={type:et.ArrowClosed,width:12,height:12,color:"var(--node-border)"};function Fe(t){return{stroke:"var(--node-border)",strokeWidth:1.5,...t?{strokeDasharray:"6 3"}:{}}}function Te(t,r,s,n,o){var u;const i=(u=t.sections)==null?void 0:u[0],a=(o==null?void 0:o.x)??0,c=(o==null?void 0:o.y)??0;let h;if(i)h={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=r.get(t.sources[0]),d=r.get(t.targets[0]);l&&d&&(h={sourcePoint:{x:l.x+l.width/2,y:l.y+l.height},targetPoint:{x:d.x+d.width/2,y:d.y},bendPoints:[]})}return{id:t.id,source:t.sources[0],target:t.targets[0],type:"elk",data:h,style:Fe(n),markerEnd:pe,...s?{label:s,labelStyle:{fill:"var(--text-muted)",fontSize:10},labelBgStyle:{fill:"var(--bg-primary)",fillOpacity:.8}}:{}}}async function tr(t){var h,u;const r=er(t),n=await(await Zt()).layout(r),o=new Map;for(const l of t.nodes)if(o.set(l.id,{type:l.type,data:l.data}),l.data.subgraph)for(const d of l.data.subgraph.nodes)o.set(`${l.id}/${d.id}`,{type:d.type,data:d.data});const i=[],a=[],c=new Map;for(const l of n.children??[]){const d=l.x??0,j=l.y??0;c.set(l.id,{x:d,y:j,width:l.width??0,height:l.height??0});for(const f of l.children??[])c.set(f.id,{x:d+(f.x??0),y:j+(f.y??0),width:f.width??0,height:f.height??0})}for(const l of n.children??[]){const d=o.get(l.id);if((((h=l.children)==null?void 0:h.length)??0)>0){i.push({id:l.id,type:"groupNode",data:{...(d==null?void 0:d.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 S of l.children??[]){const k=o.get(S.id);i.push({id:S.id,type:(k==null?void 0:k.type)??"defaultNode",data:{...(k==null?void 0:k.data)??{},nodeWidth:S.width},position:{x:S.x??0,y:S.y??0},parentNode:l.id,extent:"parent"})}const f=l.x??0,y=l.y??0;for(const S of l.edges??[]){const k=t.nodes.find(A=>A.id===l.id),$=(u=k==null?void 0:k.data.subgraph)==null?void 0:u.edges.find(A=>`${l.id}/${A.id}`===S.id);a.push(Te(S,c,$==null?void 0:$.label,$==null?void 0:$.conditional,{x:f,y}))}}else i.push({id:l.id,type:(d==null?void 0:d.type)??"defaultNode",data:{...(d==null?void 0:d.data)??{},nodeWidth:l.width},position:{x:l.x??0,y:l.y??0}})}for(const l of n.edges??[]){const d=t.edges.find(j=>j.id===l.id);a.push(Te(l,c,d==null?void 0:d.label,d==null?void 0:d.conditional))}return{nodes:i,edges:a}}function ae({entrypoint:t,runId:r,breakpointNode:s,breakpointNextNodes:n,onBreakpointChange:o,fitViewTrigger:i}){const[a,c,h]=tt([]),[u,l,d]=rt([]),[j,f]=x.useState(!0),[y,S]=x.useState(!1),[k,$]=x.useState(0),A=x.useRef(0),G=x.useRef(null),B=O(g=>g.breakpoints[r]),F=O(g=>g.toggleBreakpoint),q=O(g=>g.clearBreakpoints),b=O(g=>g.activeNodes[r]),L=O(g=>{var p;return(p=g.runs[r])==null?void 0:p.status}),D=x.useCallback((g,p)=>{if(p.type==="startNode"||p.type==="endNode")return;const m=p.type==="groupNode"?p.id:p.id.includes("/")?p.id.split("/").pop():p.id;F(r,m);const I=O.getState().breakpoints[r]??{};o==null||o(Object.keys(I))},[r,F,o]),H=B&&Object.keys(B).length>0,J=x.useCallback(()=>{if(H)q(r),o==null||o([]);else{const g=[];for(const m of a){if(m.type==="startNode"||m.type==="endNode"||m.parentNode)continue;const I=m.type==="groupNode"?m.id:m.id.includes("/")?m.id.split("/").pop():m.id;g.push(I)}for(const m of g)B!=null&&B[m]||F(r,m);const p=O.getState().breakpoints[r]??{};o==null||o(Object.keys(p))}},[r,H,B,a,q,F,o]);x.useEffect(()=>{c(g=>g.map(p=>{var v;if(p.type==="startNode"||p.type==="endNode")return p;const m=p.type==="groupNode"?p.id:p.id.includes("/")?p.id.split("/").pop():p.id,I=!!(B&&B[m]);return I!==!!((v=p.data)!=null&&v.hasBreakpoint)?{...p,data:{...p.data,hasBreakpoint:I}}:p}))},[B,c]),x.useEffect(()=>{const g=s?new Set(s.split(",").map(p=>p.trim()).filter(Boolean)):null;c(p=>p.map(m=>{var T,w;if(m.type==="startNode"||m.type==="endNode")return m;const I=m.type==="groupNode"?m.id:m.id.includes("/")?m.id.split("/").pop():m.id,v=(T=m.data)==null?void 0:T.label,E=g!=null&&(g.has(I)||v!=null&&g.has(v));return E!==!!((w=m.data)!=null&&w.isPausedHere)?{...m,data:{...m.data,isPausedHere:E}}:m}))},[s,k,c]);const V=O(g=>g.stateEvents[r]);x.useEffect(()=>{const g=!!s;let p=new Set;const m=new Set,I=new Set,v=new Set,E=new Map,T=new Map;if(V)for(const w of V)w.phase==="started"?T.set(w.node_name,w.qualified_node_name??null):w.phase==="completed"&&T.delete(w.node_name);c(w=>{var _;for(const P of w)P.type&&E.set(P.id,P.type);const C=P=>{var N;const W=[];for(const M of w){const z=M.type==="groupNode"?M.id:M.id.includes("/")?M.id.split("/").pop():M.id,U=(N=M.data)==null?void 0:N.label;(z===P||U!=null&&U===P)&&W.push(M.id)}return W};if(g&&s){const P=s.split(",").map(W=>W.trim()).filter(Boolean);for(const W of P)C(W).forEach(N=>p.add(N));if(n!=null&&n.length)for(const W of n)C(W).forEach(N=>I.add(N));b!=null&&b.prev&&C(b.prev).forEach(W=>m.add(W))}else if(T.size>0){const P=new Map;for(const W of w){const N=(_=W.data)==null?void 0:_.label;if(!N)continue;const M=W.id.includes("/")?W.id.split("/").pop():W.id;for(const z of[M,N]){let U=P.get(z);U||(U=new Set,P.set(z,U)),U.add(W.id)}}for(const[W,N]of T){let M=!1;if(N){const z=N.replace(/:/g,"/");for(const U of w)U.id===z&&(p.add(U.id),M=!0)}if(!M){const z=P.get(W);z&&z.forEach(U=>p.add(U))}}}return w}),l(w=>{const C=m.size===0||w.some(_=>p.has(_.target)&&m.has(_.source));return w.map(_=>{var W,N;let P;return g?P=p.has(_.target)&&(m.size===0||!C||m.has(_.source))||p.has(_.source)&&I.has(_.target):(P=p.has(_.source),!P&&E.get(_.target)==="endNode"&&p.has(_.target)&&(P=!0)),P?(g||v.add(_.target),{..._,style:{stroke:"var(--accent)",strokeWidth:2.5},markerEnd:{...pe,color:"var(--accent)"},data:{..._.data,highlighted:!0},animated:!0}):(W=_.data)!=null&&W.highlighted?{..._,style:Fe((N=_.data)==null?void 0:N.conditional),markerEnd:pe,data:{..._.data,highlighted:!1},animated:!1}:_})}),c(w=>w.map(C=>{var W,N,M,z;const _=!g&&p.has(C.id);if(C.type==="startNode"||C.type==="endNode"){const U=v.has(C.id)||!g&&p.has(C.id);return U!==!!((W=C.data)!=null&&W.isActiveNode)||_!==!!((N=C.data)!=null&&N.isExecutingNode)?{...C,data:{...C.data,isActiveNode:U,isExecutingNode:_}}:C}const P=g?I.has(C.id):v.has(C.id);return P!==!!((M=C.data)!=null&&M.isActiveNode)||_!==!!((z=C.data)!=null&&z.isExecutingNode)?{...C,data:{...C.data,isActiveNode:P,isExecutingNode:_}}:C}))},[V,b,s,n,L,k,c,l]);const R=O(g=>g.graphCache[r]);return x.useEffect(()=>{if(!R&&r!=="__setup__")return;const g=R?Promise.resolve(R):jt(t),p=++A.current;f(!0),S(!1),g.then(async m=>{if(A.current!==p)return;if(!m.nodes.length){S(!0);return}const{nodes:I,edges:v}=await tr(m);if(A.current!==p)return;const E=O.getState().breakpoints[r],T=E?I.map(w=>{if(w.type==="startNode"||w.type==="endNode")return w;const C=w.type==="groupNode"?w.id:w.id.includes("/")?w.id.split("/").pop():w.id;return E[C]?{...w,data:{...w.data,hasBreakpoint:!0}}:w}):I;c(T),l(v),$(w=>w+1),setTimeout(()=>{var w;(w=G.current)==null||w.fitView({padding:.1,duration:200})},100)}).catch(()=>{A.current===p&&S(!0)}).finally(()=>{A.current===p&&f(!1)})},[t,r,R,c,l]),x.useEffect(()=>{const g=setTimeout(()=>{var p;(p=G.current)==null||p.fitView({padding:.1,duration:200})},100);return()=>clearTimeout(g)},[r]),x.useEffect(()=>{var g;i&&((g=G.current)==null||g.fitView({padding:.1,duration:200}))},[i]),x.useEffect(()=>{c(g=>{var _,P,W;const p=!!(V!=null&&V.length),m=L==="completed"||L==="failed",I=new Set,v=new Set(g.map(N=>N.id)),E=new Map;for(const N of g){const M=(_=N.data)==null?void 0:_.label;if(!M)continue;const z=N.id.includes("/")?N.id.split("/").pop():N.id;for(const U of[z,M]){let re=E.get(U);re||(re=new Set,E.set(U,re)),re.add(N.id)}}if(p)for(const N of V){let M=!1;if(N.qualified_node_name){const z=N.qualified_node_name.replace(/:/g,"/");v.has(z)&&(I.add(z),M=!0)}if(!M){const z=E.get(N.node_name);z&&z.forEach(U=>I.add(U))}}const T=new Set;for(const N of g)N.parentNode&&I.has(N.id)&&T.add(N.parentNode);let w;L==="failed"&&I.size===0&&(w=(P=g.find(N=>!N.parentNode&&N.type!=="startNode"&&N.type!=="endNode"&&N.type!=="groupNode"))==null?void 0:P.id);let C;if(L==="completed"){const N=(W=g.find(M=>!M.parentNode&&M.type!=="startNode"&&M.type!=="endNode"&&M.type!=="groupNode"))==null?void 0:W.id;N&&!I.has(N)&&(C=N)}return g.map(N=>{var z;let M;return N.id===w?M="failed":N.id===C||I.has(N.id)?M="completed":N.type==="startNode"?(!N.parentNode&&p||N.parentNode&&T.has(N.parentNode))&&(M="completed"):N.type==="endNode"?!N.parentNode&&m?M=L==="failed"?"failed":"completed":N.parentNode&&T.has(N.parentNode)&&(M="completed"):N.type==="groupNode"&&T.has(N.id)&&(M="completed"),M!==((z=N.data)==null?void 0:z.status)?{...N,data:{...N.data,status:M}}:N})})},[V,L,k,c]),j?e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:"Loading graph..."}):y?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(st,{nodes:a,edges:u,onNodesChange:h,onEdgesChange:d,nodeTypes:Gt,edgeTypes:qt,onInit:g=>{G.current=g},onNodeClick:D,fitView:!0,proOptions:{hideAttribution:!0},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,children:[e.jsx(nt,{color:"var(--bg-tertiary)",gap:16}),e.jsx(ot,{showInteractive:!1}),e.jsx(at,{position:"top-right",children:e.jsxs("button",{onClick:J,title:H?"Remove all breakpoints":"Set breakpoints on all nodes",style:{background:"var(--bg-secondary)",color:H?"var(--error)":"var(--text-muted)",border:`1px solid ${H?"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:H?"var(--error)":"var(--node-border)"}}),H?"Clear all":"Break all"]})}),e.jsx(it,{nodeColor:g=>{var m;if(g.type==="groupNode")return"var(--bg-tertiary)";const p=(m=g.data)==null?void 0:m.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 rr({entrypoint:t,mode:r,ws:s,onRunCreated:n,isMobile:o}){const[i,a]=x.useState("{}"),[c,h]=x.useState({}),[u,l]=x.useState(!1),[d,j]=x.useState(!0),[f,y]=x.useState(null),[S,k]=x.useState(""),[$,A]=x.useState(0),[G,B]=x.useState(!0),[F,q]=x.useState(()=>{const v=localStorage.getItem("setupTextareaHeight");return v?parseInt(v,10):140}),b=x.useRef(null),[L,D]=x.useState(()=>{const v=localStorage.getItem("setupPanelWidth");return v?parseInt(v,10):380}),H=r==="run";x.useEffect(()=>{j(!0),y(null),bt(t).then(v=>{h(v.mock_input),a(JSON.stringify(v.mock_input,null,2))}).catch(v=>{console.error("Failed to load mock input:",v);const E=v.detail||{};y(E.message||`Failed to load schema for "${t}"`),a("{}")}).finally(()=>j(!1))},[t]),x.useEffect(()=>{O.getState().clearBreakpoints(ee)},[]);const J=async()=>{let v;try{v=JSON.parse(i)}catch{alert("Invalid JSON input");return}l(!0);try{const E=O.getState().breakpoints[ee]??{},T=Object.keys(E),w=await ge(t,v,r,T);O.getState().clearBreakpoints(ee),O.getState().upsertRun(w),n(w.id)}catch(E){console.error("Failed to create run:",E)}finally{l(!1)}},V=async()=>{const v=S.trim();if(v){l(!0);try{const E=O.getState().breakpoints[ee]??{},T=Object.keys(E),w=await ge(t,c,"chat",T);O.getState().clearBreakpoints(ee),O.getState().upsertRun(w),O.getState().addLocalChatMessage(w.id,{message_id:`local-${Date.now()}`,role:"user",content:v}),s.sendChatMessage(w.id,v),n(w.id)}catch(E){console.error("Failed to create chat run:",E)}finally{l(!1)}}};x.useEffect(()=>{try{JSON.parse(i),B(!0)}catch{B(!1)}},[i]);const R=x.useCallback(v=>{v.preventDefault();const E="touches"in v?v.touches[0].clientY:v.clientY,T=F,w=_=>{const P="touches"in _?_.touches[0].clientY:_.clientY,W=Math.max(60,T+(E-P));q(W)},C=()=>{document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",C),document.removeEventListener("touchmove",w),document.removeEventListener("touchend",C),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("setupTextareaHeight",String(F))};document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",w),document.addEventListener("mouseup",C),document.addEventListener("touchmove",w,{passive:!1}),document.addEventListener("touchend",C)},[F]),g=x.useCallback(v=>{v.preventDefault();const E="touches"in v?v.touches[0].clientX:v.clientX,T=L,w=_=>{const P=b.current;if(!P)return;const W="touches"in _?_.touches[0].clientX:_.clientX,N=P.clientWidth-300,M=Math.max(280,Math.min(N,T+(E-W)));D(M)},C=()=>{document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",C),document.removeEventListener("touchmove",w),document.removeEventListener("touchend",C),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("setupPanelWidth",String(L)),A(_=>_+1)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",w),document.addEventListener("mouseup",C),document.addEventListener("touchmove",w,{passive:!1}),document.addEventListener("touchend",C)},[L]),p=H?"Autonomous":"Conversational",m=H?"var(--success)":"var(--accent)",I=e.jsxs("div",{className:"shrink-0 flex flex-col",style:o?{background:"var(--bg-primary)"}:{width:L,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:m},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:H?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:H?"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",H?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"]})]})]})]}),H?e.jsxs("div",{className:"flex flex-col",style:{background:"var(--bg-primary)"},children:[!o&&e.jsx("div",{onMouseDown:R,onTouchStart:R,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:[f?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:f}):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",d&&e.jsx("span",{className:"ml-2 font-normal",children:"Loading..."})]}),e.jsx("textarea",{value:i,onChange:v=>a(v.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:o?120:F,background:"var(--bg-secondary)",border:`1px solid ${G?"var(--border)":"#b91c1c"}`,color:"var(--text-primary)"}})]}),e.jsx("button",{onClick:J,disabled:u||d||!!f,className:"w-full py-2 text-sm font-semibold rounded-md border cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed transition-colors flex items-center justify-center gap-2",style:{background:"transparent",borderColor:m,color:m},onMouseEnter:v=>{u||(v.currentTarget.style.background=`color-mix(in srgb, ${m} 10%, transparent)`)},onMouseLeave:v=>{v.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:S,onChange:v=>k(v.target.value),onKeyDown:v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),V())},disabled:u||d,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:V,disabled:u||d||!S.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&&S.trim()?"var(--accent)":"var(--text-muted)",background:"transparent"},onMouseEnter:v=>{!u&&S.trim()&&(v.currentTarget.style.background="color-mix(in srgb, var(--accent) 10%, transparent)")},onMouseLeave:v=>{v.currentTarget.style.background="transparent"},children:"Send"})]})]});return o?e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"shrink-0",style:{height:"40vh"},children:e.jsx(ae,{entrypoint:t,traces:[],runId:ee,fitViewTrigger:$})}),e.jsx("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:I})]}):e.jsxs("div",{ref:b,className:"flex h-full",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(ae,{entrypoint:t,traces:[],runId:ee,fitViewTrigger:$})}),e.jsx("div",{onMouseDown:g,onTouchStart:g,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"})}),I]})}const sr={key:"var(--info)",string:"var(--success)",number:"var(--warning)",boolean:"var(--accent)",null:"var(--accent)",punctuation:"var(--text-muted)"};function nr(t){const r=[],s=/("(?:[^"\\]|\\.)*")\s*:|("(?:[^"\\]|\\.)*")|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)\b|(true|false)\b|(null)\b|([{}[\]:,])/g;let n=0,o;for(;(o=s.exec(t))!==null;){if(o.index>n&&r.push({type:"punctuation",text:t.slice(n,o.index)}),o[1]!==void 0){r.push({type:"key",text:o[1]});const i=t.indexOf(":",o.index+o[1].length);i!==-1&&(i>o.index+o[1].length&&r.push({type:"punctuation",text:t.slice(o.index+o[1].length,i)}),r.push({type:"punctuation",text:":"}),s.lastIndex=i+1)}else o[2]!==void 0?r.push({type:"string",text:o[2]}):o[3]!==void 0?r.push({type:"number",text:o[3]}):o[4]!==void 0?r.push({type:"boolean",text:o[4]}):o[5]!==void 0?r.push({type:"null",text:o[5]}):o[6]!==void 0&&r.push({type:"punctuation",text:o[6]});n=s.lastIndex}return nnr(t),[t]);return e.jsx("pre",{className:r,style:s,children:n.map((o,i)=>e.jsx("span",{style:{color:sr[o.type]},children:o.text},i))})}const or={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"}},ar={color:"var(--text-muted)",label:"Unknown"};function ir(t){if(typeof t!="string")return null;const r=t.trim();if(r.startsWith("{")&&r.endsWith("}")||r.startsWith("[")&&r.endsWith("]"))try{return JSON.stringify(JSON.parse(r),null,2)}catch{return null}return null}const _e=200;function cr(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 lr({value:t}){const[r,s]=x.useState(!1),n=cr(t),o=x.useMemo(()=>ir(t),[t]),i=o!==null,a=o??n,c=a.length>_e||a.includes(` -`),h=x.useCallback(()=>s(u=>!u),[]);return c?e.jsxs("div",{children:[r?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,_e),"..."]}),e.jsx("button",{onClick:h,className:"text-[10px] cursor-pointer ml-1",style:{color:"var(--info)"},children:r?"[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 dr({span:t}){const[r,s]=x.useState(!0),[n,o]=x.useState(!1),[i,a]=x.useState("table"),[c,h]=x.useState(!1),u=or[t.status.toLowerCase()]??{...ar,label:t.status},l=x.useMemo(()=>JSON.stringify(t,null,2),[t]),d=x.useCallback(()=>{navigator.clipboard.writeText(l).then(()=>{h(!0),setTimeout(()=>h(!1),1500)})},[l]),j=Object.entries(t.attributes),f=[{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:"flex flex-col h-full text-xs leading-normal",children:[e.jsxs("div",{className:"px-2 border-b flex items-center gap-1 shrink-0",style:{borderColor:"var(--border)",background:"var(--bg-secondary)",height:"28px"},children:[e.jsx("button",{onClick:()=>a("table"),className:"px-2 h-[18px] text-[10px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer inline-flex items-center",style:{color:i==="table"?"var(--accent)":"var(--text-muted)",background:i==="table"?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},onMouseEnter:y=>{i!=="table"&&(y.currentTarget.style.color="var(--text-primary)")},onMouseLeave:y=>{i!=="table"&&(y.currentTarget.style.color="var(--text-muted)")},children:"Table"}),e.jsx("button",{onClick:()=>a("json"),className:"px-2 h-[18px] text-[10px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer inline-flex items-center",style:{color:i==="json"?"var(--accent)":"var(--text-muted)",background:i==="json"?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},onMouseEnter:y=>{i!=="json"&&(y.currentTarget.style.color="var(--text-primary)")},onMouseLeave:y=>{i!=="json"&&(y.currentTarget.style.color="var(--text-muted)")},children:"JSON"}),e.jsxs("span",{className:"ml-auto 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, ${u.color} 15%, var(--bg-secondary))`,color:u.color},children:[e.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:u.color}}),u.label]})]}),e.jsx("div",{className:"overflow-y-auto flex-1 p-0.5 pr-0 pt-0 mr-0.5 mt-0.5",children:i==="table"?e.jsxs(e.Fragment,{children:[j.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:()=>s(y=>!y),children:[e.jsxs("span",{className:"flex-1",children:["Attributes (",j.length,")"]}),e.jsx("span",{style:{color:"var(--text-muted)",transform:r?"rotate(0deg)":"rotate(-90deg)"},children:"▾"})]}),r&&j.map(([y,S],k)=>e.jsxs("div",{className:"flex gap-2 px-2 py-1 items-start border-b",style:{borderColor:"var(--border)",background:k%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:y,children:y}),e.jsx("span",{className:"flex-1 min-w-0",children:e.jsx(lr,{value:S})})]},y))]}),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:()=>o(y=>!y),children:[e.jsxs("span",{className:"flex-1",children:["Identifiers (",f.length,")"]}),e.jsx("span",{style:{color:"var(--text-muted)",transform:n?"rotate(0deg)":"rotate(-90deg)"},children:"▾"})]}),n&&f.map((y,S)=>e.jsxs("div",{className:"flex gap-2 px-2 py-1 items-start border-b",style:{borderColor:"var(--border)",background:S%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:y.label,children:y.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:y.value})})]},y.label))]}):e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:d,className:"absolute top-1 right-1 z-10 text-[10px] cursor-pointer px-1.5 py-0.5 rounded transition-colors",style:{color:c?"var(--success)":"var(--text-muted)",background:"var(--bg-secondary)",border:"1px solid var(--border)"},onMouseEnter:y=>{c||(y.currentTarget.style.color="var(--text-primary)")},onMouseLeave:y=>{y.currentTarget.style.color=c?"var(--success)":"var(--text-muted)"},children:c?"Copied!":"Copy"}),e.jsx(te,{json:l,className:"font-mono text-[11px] whitespace-pre-wrap p-2",style:{}})]})})]})}function ur(t){const r=[];function s(n,o){r.push({span:n.span,depth:o});for(const i of n.children)s(i,o+1)}for(const n of t)s(n,0);return r}function pr({tree:t,selectedSpan:r,onSelect:s}){const n=x.useMemo(()=>ur(t),[t]),{globalStart:o,totalDuration:i}=x.useMemo(()=>{if(n.length===0)return{globalStart:0,totalDuration:1};let a=1/0,c=-1/0;for(const{span:h}of n){const u=new Date(h.timestamp).getTime();a=Math.min(a,u),c=Math.max(c,u+(h.duration_ms??0))}return{globalStart:a,totalDuration:Math.max(c-a,1)}},[n]);return n.length===0?null:e.jsx(e.Fragment,{children:n.map(({span:a,depth:c})=>{var S;const h=new Date(a.timestamp).getTime()-o,u=a.duration_ms??0,l=h/i*100,d=Math.max(u/i*100,.3),j=Ue[a.status.toLowerCase()]??"var(--text-muted)",f=a.span_id===(r==null?void 0:r.span_id),y=(S=a.attributes)==null?void 0:S["openinference.span.kind"];return e.jsxs("button",{"data-span-id":a.span_id,onClick:()=>s(a),className:"w-full text-left text-xs leading-normal py-1 flex items-center transition-colors",style:{background:f?"color-mix(in srgb, var(--accent) 10%, var(--bg-primary))":void 0,borderLeft:f?"2px solid var(--accent)":"2px solid transparent"},onMouseEnter:k=>{f||(k.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:k=>{f||(k.currentTarget.style.background="")},children:[e.jsxs("div",{className:"shrink-0 flex items-center gap-1 overflow-hidden",style:{width:"35%",minWidth:"80px",paddingLeft:`${c*12+4}px`},children:[e.jsx("span",{className:"shrink-0 flex items-center justify-center w-3.5 h-3.5",children:e.jsx(Je,{kind:y,statusColor:j})}),e.jsx("span",{className:"text-[var(--text-primary)] truncate",children:a.span_name})]}),e.jsx("div",{className:"flex-1 relative h-[14px] mx-1 rounded-sm",style:{background:"var(--bg-secondary)"},children:e.jsx("div",{className:"absolute rounded-sm",style:{left:`${l}%`,width:`${d}%`,top:"2px",bottom:"2px",background:j,opacity:.8,minWidth:"2px"}})}),e.jsx("span",{className:"shrink-0 text-[10px] tabular-nums pr-2",style:{width:"52px",textAlign:"right",color:"var(--text-muted)"},children:Ge(a.duration_ms)})]},a.span_id)})})}const Ue={started:"var(--info)",running:"var(--warning)",completed:"var(--success)",failed:"var(--error)",error:"var(--error)"};function Je({kind:t,statusColor:r}){const s=r,n=14,o={width:n,height:n,viewBox:"0 0 16 16",fill:"none",stroke:s,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"};switch(t){case"LLM":return e.jsx("svg",{...o,children:e.jsx("path",{d:"M8 2L9 5L12 4L10 7L14 8L10 9L12 12L9 11L8 14L7 11L4 12L6 9L2 8L6 7L4 4L7 5Z",fill:s,stroke:"none"})});case"TOOL":return e.jsx("svg",{...o,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",{...o,children:[e.jsx("rect",{x:"3",y:"5",width:"10",height:"8",rx:"2"}),e.jsx("circle",{cx:"6",cy:"9",r:"1",fill:s,stroke:"none"}),e.jsx("circle",{cx:"10",cy:"9",r:"1",fill:s,stroke:"none"}),e.jsx("path",{d:"M8 2v3"}),e.jsx("path",{d:"M6 2h4"})]});case"CHAIN":return e.jsxs("svg",{...o,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",{...o,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",{...o,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:r}})}}function xr(t){const r=new Map(t.map(a=>[a.span_id,a])),s=new Map;for(const a of t)if(a.parent_span_id){const c=s.get(a.parent_span_id)??[];c.push(a),s.set(a.parent_span_id,c)}const n=t.filter(a=>a.parent_span_id===null||!r.has(a.parent_span_id));function o(a){const c=(s.get(a.span_id)??[]).sort((h,u)=>h.timestamp.localeCompare(u.timestamp));return{span:a,children:c.map(o)}}return n.sort((a,c)=>a.timestamp.localeCompare(c.timestamp)).map(o).flatMap(a=>a.span.span_name==="root"?a.children:[a])}function Ge(t){return t==null?"":t<1e3?`${t.toFixed(0)}ms`:`${(t/1e3).toFixed(2)}s`}function qe(t){return t.map(r=>{const{span:s}=r;return r.children.length>0?{name:s.span_name,children:qe(r.children)}:{name:s.span_name}})}function Le({traces:t}){const[r,s]=x.useState(null),[n,o]=x.useState(new Set),[i,a]=x.useState(()=>{const b=localStorage.getItem("traceTreeSplitWidth");return b?parseFloat(b):50}),[c,h]=x.useState(!1),[u,l]=x.useState(!1),[d,j]=x.useState(()=>localStorage.getItem("traceViewMode")||"tree"),f=xr(t),y=x.useMemo(()=>JSON.stringify(qe(f),null,2),[t]),S=x.useCallback(()=>{navigator.clipboard.writeText(y).then(()=>{l(!0),setTimeout(()=>l(!1),1500)})},[y]),k=O(b=>b.focusedSpan),$=O(b=>b.setFocusedSpan),[A,G]=x.useState(null),B=x.useRef(null),F=x.useCallback(b=>{o(L=>{const D=new Set(L);return D.has(b)?D.delete(b):D.add(b),D})},[]);x.useEffect(()=>{if(r===null)f.length>0&&s(f[0].span);else{const b=t.find(L=>L.span_id===r.span_id);b&&b!==r&&s(b)}},[t]),x.useEffect(()=>{if(!k)return;const L=t.filter(D=>D.span_name===k.name).sort((D,H)=>D.timestamp.localeCompare(H.timestamp))[k.index];if(L){s(L),G(L.span_id);const D=new Map(t.map(H=>[H.span_id,H.parent_span_id]));o(H=>{const J=new Set(H);let V=L.parent_span_id;for(;V;)J.delete(V),V=D.get(V)??null;return J})}$(null)},[k,t,$]),x.useEffect(()=>{if(!A)return;const b=A;G(null),requestAnimationFrame(()=>{const L=B.current,D=L==null?void 0:L.querySelector(`[data-span-id="${b}"]`);L&&D&&D.scrollIntoView({block:"center",behavior:"smooth"})})},[A]),x.useEffect(()=>{if(!c)return;const b=D=>{const H=document.querySelector(".trace-tree-container");if(!H)return;const J=H.getBoundingClientRect(),V=(D.clientX-J.left)/J.width*100,R=Math.max(20,Math.min(80,V));a(R),localStorage.setItem("traceTreeSplitWidth",String(R))},L=()=>{h(!1)};return window.addEventListener("mousemove",b),window.addEventListener("mouseup",L),()=>{window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",L)}},[c]);const q=b=>{b.preventDefault(),h(!0)};return e.jsxs("div",{className:"flex h-full trace-tree-container",style:{cursor:c?"col-resize":void 0},children:[e.jsxs("div",{className:"flex flex-col",style:{width:`${i}%`},children:[t.length>0&&e.jsxs("div",{className:"flex items-center gap-1 px-2 border-b shrink-0",style:{borderColor:"var(--border)",background:"var(--bg-secondary)",height:"28px"},children:[e.jsx("button",{onClick:()=>{j("tree"),localStorage.setItem("traceViewMode","tree")},className:"px-2 h-[18px] text-[10px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer inline-flex items-center",style:{color:d==="tree"?"var(--accent)":"var(--text-muted)",background:d==="tree"?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},onMouseEnter:b=>{d!=="tree"&&(b.currentTarget.style.color="var(--text-primary)")},onMouseLeave:b=>{d!=="tree"&&(b.currentTarget.style.color="var(--text-muted)")},children:"Tree"}),e.jsx("button",{onClick:()=>{j("timeline"),localStorage.setItem("traceViewMode","timeline")},className:"px-2 h-[18px] text-[10px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer inline-flex items-center",style:{color:d==="timeline"?"var(--accent)":"var(--text-muted)",background:d==="timeline"?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},onMouseEnter:b=>{d!=="timeline"&&(b.currentTarget.style.color="var(--text-primary)")},onMouseLeave:b=>{d!=="timeline"&&(b.currentTarget.style.color="var(--text-muted)")},children:"Timeline"}),e.jsx("button",{onClick:()=>{j("json"),localStorage.setItem("traceViewMode","json")},className:"px-2 h-[18px] text-[10px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer inline-flex items-center",style:{color:d==="json"?"var(--accent)":"var(--text-muted)",background:d==="json"?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},onMouseEnter:b=>{d!=="json"&&(b.currentTarget.style.color="var(--text-primary)")},onMouseLeave:b=>{d!=="json"&&(b.currentTarget.style.color="var(--text-muted)")},children:"JSON"})]}),e.jsx("div",{ref:B,className:"overflow-y-auto flex-1 p-0.5 pr-0 pt-0 mr-0.5 mt-0.5",children:f.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"})}):d==="tree"?f.map((b,L)=>e.jsx(Ye,{node:b,depth:0,selectedId:(r==null?void 0:r.span_id)??null,onSelect:s,isLast:L===f.length-1,collapsedIds:n,toggleExpanded:F},b.span.span_id)):d==="timeline"?e.jsx(pr,{tree:f,selectedSpan:r,onSelect:s}):e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:S,className:"absolute top-1 right-1 z-10 text-[10px] cursor-pointer px-1.5 py-0.5 rounded transition-colors",style:{color:u?"var(--success)":"var(--text-muted)",background:"var(--bg-secondary)",border:"1px solid var(--border)"},onMouseEnter:b=>{u||(b.currentTarget.style.color="var(--text-primary)")},onMouseLeave:b=>{b.currentTarget.style.color=u?"var(--success)":"var(--text-muted)"},children:u?"Copied!":"Copy"}),e.jsx(te,{json:y,className:"font-mono text-[11px] whitespace-pre-wrap p-2",style:{}})]})})]}),e.jsx("div",{onMouseDown:q,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",children:r?e.jsx(dr,{span:r}):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 Ye({node:t,depth:r,selectedId:s,onSelect:n,isLast:o,collapsedIds:i,toggleExpanded:a}){var S;const{span:c}=t,h=!i.has(c.span_id),u=Ue[c.status.toLowerCase()]??"var(--text-muted)",l=Ge(c.duration_ms),d=c.span_id===s,j=t.children.length>0,f=r*20,y=(S=c.attributes)==null?void 0:S["openinference.span.kind"];return e.jsxs("div",{className:"relative",children:[r>0&&e.jsx("div",{className:"absolute top-0 z-10 pointer-events-none",style:{left:`${f-10}px`,width:"1px",height:o?"16px":"100%",background:"var(--border)"}}),e.jsxs("button",{"data-span-id":c.span_id,onClick:()=>n(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:`${f+4}px`,background:d?"color-mix(in srgb, var(--accent) 10%, var(--bg-primary))":void 0,borderLeft:d?"2px solid var(--accent)":"2px solid transparent"},onMouseEnter:k=>{d||(k.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:k=>{d||(k.currentTarget.style.background="")},children:[r>0&&e.jsx("div",{className:"absolute z-10 pointer-events-none",style:{left:`${f-10}px`,top:"50%",width:"10px",height:"1px",background:"var(--border)"}}),j?e.jsx("span",{onClick:k=>{k.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:h?"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(Je,{kind:y,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})]}),h&&t.children.map((k,$)=>e.jsx(Ye,{node:k,depth:r+1,selectedId:s,onSelect:n,isLast:$===t.children.length-1,collapsedIds:i,toggleExpanded:a},k.span.span_id))]})}const hr={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)"}},mr={color:"var(--text-muted)",bg:"transparent"};function Me({logs:t}){const r=x.useRef(null),s=x.useRef(null),[n,o]=x.useState(!1);x.useEffect(()=>{var a;(a=s.current)==null||a.scrollIntoView({behavior:"smooth"})},[t.length]);const i=()=>{const a=r.current;a&&o(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:r,onScroll:i,className:"h-full overflow-y-auto font-mono text-xs leading-normal",children:[t.map((a,c)=>{const h=new Date(a.timestamp).toLocaleTimeString(void 0,{hour12:!1}),u=a.level.toUpperCase(),l=u.slice(0,4),d=hr[u]??mr,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:h}),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:d.color,background:d.bg},children:l}),e.jsx("span",{className:"text-[var(--text-primary)] whitespace-pre-wrap break-all",children:a.message})]},c)}),e.jsx("div",{ref:s})]}),n&&e.jsx("button",{onClick:()=>{var a;return(a=r.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 gr={started:{color:"var(--accent)",label:"started"},updated:{color:"var(--info)",label:"updated"},completed:{color:"var(--success)",label:"completed"},faulted:{color:"var(--error)",label:"faulted"}},Re={color:"var(--text-muted)",label:""};function oe({events:t,runStatus:r}){const s=x.useRef(null),n=x.useRef(!0),[o,i]=x.useState(null),a=()=>{const c=s.current;c&&(n.current=c.scrollHeight-c.scrollTop-c.clientHeight<40)};return x.useEffect(()=>{n.current&&s.current&&(s.current.scrollTop=s.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:r==="running"?"Waiting for events...":"No events yet"})}):e.jsx("div",{ref:s,onScroll:a,className:"h-full overflow-y-auto font-mono text-xs leading-normal",children:t.map((c,h)=>{const u=new Date(c.timestamp).toLocaleTimeString(void 0,{hour12:!1}),l=c.payload&&Object.keys(c.payload).length>0,d=o===h,j=c.phase?gr[c.phase]??Re:Re;return e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>{l&&i(d?null:h)},className:"flex items-center gap-2 px-3 py-1.5",style:{background:h%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: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:d?"rotate(90deg)":"rotate(0deg)"},children:"▸"})]}),d&&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"})})]},h)})})}function $e({runId:t,status:r,ws:s,breakpointNode:n}){const o=r==="suspended",i=a=>{const c=O.getState().breakpoints[t]??{};s.setBreakpoints(t,Object.keys(c)),a==="step"?s.debugStep(t):a==="continue"?s.debugContinue(t):s.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(ue,{label:"Step",onClick:()=>i("step"),disabled:!o,color:"var(--info)",active:o}),e.jsx(ue,{label:"Continue",onClick:()=>i("continue"),disabled:!o,color:"var(--success)",active:o}),e.jsx(ue,{label:"Stop",onClick:()=>i("stop"),disabled:!o,color:"var(--error)",active:o}),e.jsx("span",{className:"text-[10px] ml-auto truncate",style:{color:o?"var(--accent)":"var(--text-muted)"},children:o?n?`Paused at ${n}`:"Paused":r})]})}function ue({label:t,onClick:r,disabled:s,color:n,active:o}){return e.jsx("button",{onClick:r,disabled:s,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:o?n:"var(--text-muted)",background:o?`color-mix(in srgb, ${n} 10%, transparent)`:"transparent"},onMouseEnter:i=>{s||(i.currentTarget.style.background=`color-mix(in srgb, ${n} 20%, transparent)`)},onMouseLeave:i=>{i.currentTarget.style.background=o?`color-mix(in srgb, ${n} 10%, transparent)`:"transparent"},children:t})}const Ie=x.lazy(()=>ze(()=>import("./ChatPanel-DjL_r8HV.js"),__vite__mapDeps([2,1,3,4]))),fr=[],vr=[],yr=[],br=[];function jr({run:t,ws:r,isMobile:s}){const n=t.mode==="chat",[o,i]=x.useState(280),[a,c]=x.useState(()=>{const p=localStorage.getItem("chatPanelWidth");return p?parseInt(p,10):380}),[h,u]=x.useState("primary"),[l,d]=x.useState(n?"primary":"traces"),[j,f]=x.useState(0),y=x.useRef(null),S=x.useRef(null),k=x.useRef(!1),$=O(p=>p.traces[t.id]||fr),A=O(p=>p.logs[t.id]||vr),G=O(p=>p.chatMessages[t.id]||yr),B=O(p=>p.stateEvents[t.id]||br),F=O(p=>p.breakpoints[t.id]);x.useEffect(()=>{r.setBreakpoints(t.id,F?Object.keys(F):[])},[t.id]);const q=x.useCallback(p=>{r.setBreakpoints(t.id,p)},[t.id,r]),b=x.useCallback(p=>{p.preventDefault(),k.current=!0;const m="touches"in p?p.touches[0].clientY:p.clientY,I=o,v=T=>{if(!k.current)return;const w=y.current;if(!w)return;const C="touches"in T?T.touches[0].clientY:T.clientY,_=w.clientHeight-100,P=Math.max(80,Math.min(_,I+(C-m)));i(P)},E=()=>{k.current=!1,document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",E),document.removeEventListener("touchmove",v),document.removeEventListener("touchend",E),document.body.style.cursor="",document.body.style.userSelect="",f(T=>T+1)};document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",v),document.addEventListener("mouseup",E),document.addEventListener("touchmove",v,{passive:!1}),document.addEventListener("touchend",E)},[o]),L=x.useCallback(p=>{p.preventDefault();const m="touches"in p?p.touches[0].clientX:p.clientX,I=a,v=T=>{const w=S.current;if(!w)return;const C="touches"in T?T.touches[0].clientX:T.clientX,_=w.clientWidth-300,P=Math.max(280,Math.min(_,I+(m-C)));c(P)},E=()=>{document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",E),document.removeEventListener("touchmove",v),document.removeEventListener("touchend",E),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("chatPanelWidth",String(a)),f(T=>T+1)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",v),document.addEventListener("mouseup",E),document.addEventListener("touchmove",v,{passive:!1}),document.addEventListener("touchend",E)},[a]),D=n?"Chat":"Events",H=n?"var(--accent)":"var(--success)",J=p=>p==="primary"?H:p==="events"?"var(--success)":"var(--accent)",V=O(p=>p.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:n?"Thinking...":"Running..."}):n&&t.status==="suspended"&&V?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(s){const p=[{id:"traces",label:"Traces",count:$.length},{id:"primary",label:D},...n?[{id:"events",label:"Events",count:B.length}]:[],{id:"io",label:"I/O"},{id:"logs",label:"Logs",count:A.length}];return e.jsxs("div",{className:"flex flex-col h-full",children:[(t.mode==="debug"||t.status==="suspended"&&!V||F&&Object.keys(F).length>0)&&e.jsx($e,{runId:t.id,status:t.status,ws:r,breakpointNode:t.breakpoint_node}),e.jsx("div",{className:"shrink-0",style:{height:"40vh"},children:e.jsx(ae,{entrypoint:t.entrypoint,traces:$,runId:t.id,breakpointNode:t.breakpoint_node,breakpointNextNodes:t.breakpoint_next_nodes,onBreakpointChange:q,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:[p.map(m=>e.jsxs("button",{onClick:()=>d(m.id),className:"px-2 py-0.5 h-5 text-[11px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer",style:{color:l===m.id?J(m.id):"var(--text-muted)",background:l===m.id?`color-mix(in srgb, ${J(m.id)} 10%, transparent)`:"transparent"},children:[m.label,m.count!==void 0&&m.count>0&&e.jsx("span",{className:"ml-1 font-normal",style:{color:"var(--text-muted)"},children:m.count})]},m.id)),R]}),e.jsxs("div",{className:"flex-1 overflow-hidden",children:[l==="traces"&&e.jsx(Le,{traces:$}),l==="primary"&&(n?e.jsx(x.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(Ie,{messages:G,runId:t.id,runStatus:t.status,ws:r})}):e.jsx(oe,{events:B,runStatus:t.status})),l==="events"&&e.jsx(oe,{events:B,runStatus:t.status}),l==="io"&&e.jsx(Pe,{run:t}),l==="logs"&&e.jsx(Me,{logs:A})]})]})}const g=[{id:"primary",label:D},...n?[{id:"events",label:"Events",count:B.length}]:[],{id:"io",label:"I/O"},{id:"logs",label:"Logs",count:A.length}];return e.jsxs("div",{ref:S,className:"flex h-full",children:[e.jsxs("div",{ref:y,className:"flex flex-col flex-1 min-w-0",children:[(t.mode==="debug"||t.status==="suspended"&&!V||F&&Object.keys(F).length>0)&&e.jsx($e,{runId:t.id,status:t.status,ws:r,breakpointNode:t.breakpoint_node}),e.jsx("div",{className:"shrink-0",style:{height:o},children:e.jsx(ae,{entrypoint:t.entrypoint,traces:$,runId:t.id,breakpointNode:t.breakpoint_node,breakpointNextNodes:t.breakpoint_next_nodes,onBreakpointChange:q,fitViewTrigger:j})}),e.jsx("div",{onMouseDown:b,onTouchStart:b,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(Le,{traces:$})})]}),e.jsx("div",{onMouseDown:L,onTouchStart:L,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:[g.map(p=>e.jsxs("button",{onClick:()=>u(p.id),className:"px-2 py-0.5 h-5 text-[11px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer",style:{color:h===p.id?J(p.id):"var(--text-muted)",background:h===p.id?`color-mix(in srgb, ${J(p.id)} 10%, transparent)`:"transparent"},onMouseEnter:m=>{h!==p.id&&(m.currentTarget.style.color="var(--text-primary)")},onMouseLeave:m=>{h!==p.id&&(m.currentTarget.style.color="var(--text-muted)")},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:[h==="primary"&&(n?e.jsx(x.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(Ie,{messages:G,runId:t.id,runStatus:t.status,ws:r})}):e.jsx(oe,{events:B,runStatus:t.status})),h==="events"&&e.jsx(oe,{events:B,runStatus:t.status}),h==="io"&&e.jsx(Pe,{run:t}),h==="logs"&&e.jsx(Me,{logs:A})]})]})]})}function Pe({run:t}){return e.jsxs("div",{className:"p-4 overflow-y-auto h-full space-y-4",children:[e.jsx(Oe,{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(Oe,{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 Oe({title:t,color:r,copyText:s,children:n}){const[o,i]=x.useState(!1),a=x.useCallback(()=>{s&&navigator.clipboard.writeText(s).then(()=>{i(!0),setTimeout(()=>i(!1),1500)})},[s]);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:r}}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:r},children:t}),s&&e.jsx("button",{onClick:a,className:"ml-auto text-[10px] cursor-pointer px-1.5 py-0.5 rounded transition-colors",style:{color:o?"var(--success)":"var(--text-muted)",background:"var(--bg-secondary)",border:"1px solid var(--border)"},onMouseEnter:c=>{o||(c.currentTarget.style.color="var(--text-primary)")},onMouseLeave:c=>{c.currentTarget.style.color=o?"var(--success)":"var(--text-muted)"},children:o?"Copied":"Copy"})]}),n]})}function wr(){const{reloadPending:t,setReloadPending:r,setEntrypoints:s}=O(),[n,o]=x.useState(!1);if(!t)return null;const i=async()=>{o(!0);try{await kt();const a=await He();s(a.map(c=>c.name)),r(!1)}catch(a){console.error("Reload failed:",a)}finally{o(!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:n,className:"px-3 py-1 text-sm font-medium rounded cursor-pointer",style:{background:"var(--accent)",color:"#fff",opacity:n?.6:1},children:n?"Reloading...":"Reload"}),e.jsx("button",{onClick:()=>r(!1),className:"text-sm cursor-pointer px-1",style:{color:"var(--text-muted)",background:"none",border:"none"},children:"✕"})]})]})}function kr(){const t=vt(),r=Ct(),[s,n]=x.useState(!1),{runs:o,selectedRunId:i,setRuns:a,upsertRun:c,selectRun:h,setTraces:u,setLogs:l,setChatMessages:d,setEntrypoints:j,setStateEvents:f,setGraphCache:y,setActiveNode:S,removeActiveNode:k}=O(),{view:$,runId:A,setupEntrypoint:G,setupMode:B,navigate:F}=Be();x.useEffect(()=>{$==="details"&&A&&A!==i&&h(A)},[$,A,i,h]);const q=Ae(R=>R.init);x.useEffect(()=>{wt().then(a).catch(console.error),He().then(R=>j(R.map(g=>g.name))).catch(console.error),q()},[a,j,q]);const b=i?o[i]:null,L=x.useCallback((R,g)=>{c(g),u(R,g.traces),l(R,g.logs);const p=g.messages.map(m=>{const I=m.contentParts??m.content_parts??[],v=m.toolCalls??m.tool_calls??[];return{message_id:m.messageId??m.message_id,role:m.role??"assistant",content:I.filter(E=>{const T=E.mimeType??E.mime_type??"";return T.startsWith("text/")||T==="application/json"}).map(E=>{const T=E.data;return(T==null?void 0:T.inline)??""}).join(` -`).trim()??"",tool_calls:v.length>0?v.map(E=>({name:E.name??"",has_result:!!E.result})):void 0}});if(d(R,p),g.graph&&g.graph.nodes.length>0&&y(R,g.graph),g.states&&g.states.length>0&&(f(R,g.states.map(m=>({node_name:m.node_name,qualified_node_name:m.qualified_node_name,phase:m.phase,timestamp:new Date(m.timestamp).getTime(),payload:m.payload}))),g.status!=="completed"&&g.status!=="failed"))for(const m of g.states)m.phase==="started"?S(R,m.node_name,m.qualified_node_name):m.phase==="completed"&&k(R,m.node_name)},[c,u,l,d,f,y,S,k]);x.useEffect(()=>{if(!i)return;t.subscribe(i),le(i).then(g=>L(i,g)).catch(console.error);const R=setTimeout(()=>{const g=O.getState().runs[i];g&&(g.status==="pending"||g.status==="running")&&le(i).then(p=>L(i,p)).catch(console.error)},2e3);return()=>{clearTimeout(R),t.unsubscribe(i)}},[i,t,L]);const D=x.useRef(null);x.useEffect(()=>{var p,m;if(!i)return;const R=b==null?void 0:b.status,g=D.current;if(D.current=R??null,R&&(R==="completed"||R==="failed")&&g!==R){const I=O.getState(),v=((p=I.traces[i])==null?void 0:p.length)??0,E=((m=I.logs[i])==null?void 0:m.length)??0,T=(b==null?void 0:b.trace_count)??0,w=(b==null?void 0:b.log_count)??0;(vL(i,C)).catch(console.error)}},[i,b==null?void 0:b.status,L]);const H=R=>{F(`#/runs/${R}/traces`),h(R),n(!1)},J=R=>{F(`#/runs/${R}/traces`),h(R),n(!1)},V=()=>{F("#/new"),n(!1)};return e.jsxs("div",{className:"flex h-screen w-screen relative",children:[r&&!s&&e.jsx("button",{onClick:()=>n(!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(Lt,{runs:Object.values(o),selectedRunId:i,onSelectRun:J,onNewRun:V,isMobile:r,isOpen:s,onClose:()=>n(!1)}),e.jsx("main",{className:"flex-1 overflow-hidden bg-[var(--bg-primary)]",children:$==="new"?e.jsx(Mt,{}):$==="setup"&&G&&B?e.jsx(rr,{entrypoint:G,mode:B,ws:t,onRunCreated:H,isMobile:r}):b?e.jsx(jr,{run:b,ws:t,isMobile:r}):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(wr,{})]})}Ze.createRoot(document.getElementById("root")).render(e.jsx(x.StrictMode,{children:e.jsx(kr,{})}));export{O as u}; diff --git a/src/uipath/dev/server/static/assets/index-CQlfl4ed.js b/src/uipath/dev/server/static/assets/index-CQlfl4ed.js new file mode 100644 index 0000000..f4211ba --- /dev/null +++ b/src/uipath/dev/server/static/assets/index-CQlfl4ed.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-CeP3-CFA.js","assets/vendor-reactflow-mU21rT8r.js","assets/vendor-reactflow-B5DZHykP.css"])))=>i.map(i=>d[i]); +var Xe=Object.defineProperty;var Ke=(t,r,s)=>r in t?Xe(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s;var K=(t,r,s)=>Ke(t,typeof r!="symbol"?r+"":r,s);import{R as se,a as h,j as e,b as Ze}from"./vendor-react-BVoutfaX.js";import{H as Y,P as X,B as Qe,M as et,u as tt,a as rt,R as st,b as ot,C as nt,c as at,d as it}from"./vendor-reactflow-mU21rT8r.js";(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.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 s(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=s(n);fetch(n.href,i)}})();const xe=t=>{let r;const s=new Set,o=(p,d)=>{const m=typeof p=="function"?p(r):p;if(!Object.is(m,r)){const w=r;r=d??(typeof m!="object"||m===null)?m:Object.assign({},r,m),s.forEach(g=>g(r,w))}},n=()=>r,c={setState:o,getState:n,getInitialState:()=>x,subscribe:p=>(s.add(p),()=>s.delete(p))},x=r=t(o,n,c);return c},ct=(t=>t?xe(t):xe),lt=t=>t;function dt(t,r=lt){const s=se.useSyncExternalStore(t.subscribe,se.useCallback(()=>r(t.getState()),[t,r]),se.useCallback(()=>r(t.getInitialState()),[t,r]));return se.useDebugValue(s),s}const me=t=>{const r=ct(t),s=o=>dt(r,o);return Object.assign(s,r),s},ie=(t=>t?me(t):me),A=ie(t=>({runs:{},selectedRunId:null,traces:{},logs:{},chatMessages:{},entrypoints:[],setRuns:r=>t(s=>{var i;let o=s.breakpoints;for(const a of r)(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(r.map(a=>[a.id,a]))};return o!==s.breakpoints&&(n.breakpoints=o),n}),upsertRun:r=>t(s=>{var n;const o={runs:{...s.runs,[r.id]:r}};if((n=r.breakpoints)!=null&&n.length&&!s.breakpoints[r.id]&&(o.breakpoints={...s.breakpoints,[r.id]:Object.fromEntries(r.breakpoints.map(i=>[i,!0]))}),(r.status==="completed"||r.status==="failed")&&s.activeNodes[r.id]){const{[r.id]:i,...a}=s.activeNodes;o.activeNodes=a}if(r.status!=="suspended"&&s.activeInterrupt[r.id]){const{[r.id]:i,...a}=s.activeInterrupt;o.activeInterrupt=a}return o}),selectRun:r=>t({selectedRunId:r}),addTrace:r=>t(s=>{const o=s.traces[r.run_id]??[],n=o.findIndex(a=>a.span_id===r.span_id),i=n>=0?o.map((a,c)=>c===n?r:a):[...o,r];return{traces:{...s.traces,[r.run_id]:i}}}),setTraces:(r,s)=>t(o=>({traces:{...o.traces,[r]:s}})),addLog:r=>t(s=>{const o=s.logs[r.run_id]??[];return{logs:{...s.logs,[r.run_id]:[...o,r]}}}),setLogs:(r,s)=>t(o=>({logs:{...o.logs,[r]:s}})),addChatEvent:(r,s)=>t(o=>{const n=o.chatMessages[r]??[],i=s.message;if(!i)return o;const a=i.messageId??i.message_id,c=i.role??"assistant",d=(i.contentParts??i.content_parts??[]).filter(k=>{const j=k.mimeType??k.mime_type??"";return j.startsWith("text/")||j==="application/json"}).map(k=>{const j=k.data;return(j==null?void 0:j.inline)??""}).join(` +`).trim(),m=(i.toolCalls??i.tool_calls??[]).map(k=>({name:k.name??"",has_result:!!k.result})),w={message_id:a,role:c,content:d,tool_calls:m.length>0?m:void 0},g=n.findIndex(k=>k.message_id===a);if(g>=0)return{chatMessages:{...o.chatMessages,[r]:n.map((k,j)=>j===g?w:k)}};if(c==="user"){const k=n.findIndex(j=>j.message_id.startsWith("local-")&&j.role==="user"&&j.content===d);if(k>=0)return{chatMessages:{...o.chatMessages,[r]:n.map((j,$)=>$===k?w:j)}}}const v=[...n,w];return{chatMessages:{...o.chatMessages,[r]:v}}}),addLocalChatMessage:(r,s)=>t(o=>{const n=o.chatMessages[r]??[];return{chatMessages:{...o.chatMessages,[r]:[...n,s]}}}),setChatMessages:(r,s)=>t(o=>({chatMessages:{...o.chatMessages,[r]:s}})),setEntrypoints:r=>t({entrypoints:r}),breakpoints:{},toggleBreakpoint:(r,s)=>t(o=>{const n={...o.breakpoints[r]??{}};return n[s]?delete n[s]:n[s]=!0,{breakpoints:{...o.breakpoints,[r]:n}}}),clearBreakpoints:r=>t(s=>{const{[r]:o,...n}=s.breakpoints;return{breakpoints:n}}),activeNodes:{},setActiveNode:(r,s,o)=>t(n=>{const i=n.activeNodes[r]??{executing:{},prev:null};return{activeNodes:{...n.activeNodes,[r]:{executing:{...i.executing,[s]:o??null},prev:i.prev}}}}),removeActiveNode:(r,s)=>t(o=>{const n=o.activeNodes[r];if(!n)return o;const{[s]:i,...a}=n.executing;return{activeNodes:{...o.activeNodes,[r]:{executing:a,prev:s}}}}),resetRunGraphState:r=>t(s=>({stateEvents:{...s.stateEvents,[r]:[]},activeNodes:{...s.activeNodes,[r]:{executing:{},prev:null}}})),stateEvents:{},addStateEvent:(r,s,o,n,i)=>t(a=>{const c=a.stateEvents[r]??[];return{stateEvents:{...a.stateEvents,[r]:[...c,{node_name:s,qualified_node_name:n,phase:i,timestamp:Date.now(),payload:o}]}}}),setStateEvents:(r,s)=>t(o=>({stateEvents:{...o.stateEvents,[r]:s}})),focusedSpan:null,setFocusedSpan:r=>t({focusedSpan:r}),activeInterrupt:{},setActiveInterrupt:(r,s)=>t(o=>({activeInterrupt:{...o.activeInterrupt,[r]:s}})),reloadPending:!1,setReloadPending:r=>t({reloadPending:r}),graphCache:{},setGraphCache:(r,s)=>t(o=>({graphCache:{...o.graphCache,[r]:s}}))})),ce="/api";async function ut(t){const r=await fetch(`${ce}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({environment:t})});if(!r.ok)throw new Error(`Login failed: ${r.status}`);return r.json()}async function le(){const t=await fetch(`${ce}/auth/status`);if(!t.ok)throw new Error(`Status check failed: ${t.status}`);return t.json()}async function pt(t){const r=await fetch(`${ce}/auth/select-tenant`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tenant_name:t})});if(!r.ok)throw new Error(`Tenant selection failed: ${r.status}`);return r.json()}async function ht(){await fetch(`${ce}/auth/logout`,{method:"POST"})}const Oe="uipath-env",xt=["cloud","staging","alpha"];function mt(){const t=localStorage.getItem(Oe);return xt.includes(t)?t:"cloud"}const We=ie((t,r)=>({enabled:!0,status:"unauthenticated",environment:mt(),tenants:[],uipathUrl:null,pollTimer:null,expiryTimer:null,init:async()=>{try{const s=await fetch("/api/config");if(s.ok&&!(await s.json()).auth_enabled){t({enabled:!1});return}const o=await le();t({status:o.status,tenants:o.tenants??[],uipathUrl:o.uipath_url??null}),o.status==="authenticated"&&r().startExpiryCheck()}catch(s){console.error("Auth init failed",s)}},setEnvironment:s=>{localStorage.setItem(Oe,s),t({environment:s})},startLogin:async()=>{const{environment:s}=r();try{const o=await ut(s);t({status:"pending"}),window.open(o.auth_url,"_blank"),r().pollStatus()}catch(o){console.error("Login failed",o)}},pollStatus:()=>{const{pollTimer:s}=r();if(s)return;const o=setInterval(async()=>{try{const n=await le();n.status!=="pending"&&(r().stopPolling(),t({status:n.status,tenants:n.tenants??[],uipathUrl:n.uipath_url??null}),n.status==="authenticated"&&r().startExpiryCheck())}catch{}},2e3);t({pollTimer:o})},stopPolling:()=>{const{pollTimer:s}=r();s&&(clearInterval(s),t({pollTimer:null}))},startExpiryCheck:()=>{const{expiryTimer:s}=r();if(s)return;const o=setInterval(async()=>{try{(await le()).status==="expired"&&(r().stopExpiryCheck(),t({status:"expired"}))}catch{}},3e4);t({expiryTimer:o})},stopExpiryCheck:()=>{const{expiryTimer:s}=r();s&&(clearInterval(s),t({expiryTimer:null}))},selectTenant:async s=>{try{const o=await pt(s);t({status:"authenticated",uipathUrl:o.uipath_url,tenants:[]}),r().startExpiryCheck()}catch(o){console.error("Tenant selection failed",o)}},logout:async()=>{r().stopPolling(),r().stopExpiryCheck();try{await ht()}catch{}t({status:"unauthenticated",tenants:[],uipathUrl:null})}})),Ae=ie(t=>({projectName:null,projectVersion:null,projectAuthors:null,init:async()=>{try{const r=await fetch("/api/config");if(r.ok){const s=await r.json();t({projectName:s.project_name??null,projectVersion:s.project_version??null,projectAuthors:s.project_authors??null})}}catch{}}}));class gt{constructor(r){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 s=window.location.protocol==="https:"?"wss:":"ws:";this.url=r??`${s}//${window.location.host}/ws`}connect(){var r;((r=this.ws)==null?void 0:r.readyState)!==WebSocket.OPEN&&(this.ws=new WebSocket(this.url),this.ws.onopen=()=>{console.log("[ws] connected");for(const s of this.activeSubscriptions)this.sendRaw(JSON.stringify({type:"subscribe",payload:{run_id:s}}));for(const s of this.pendingMessages)this.sendRaw(s);this.pendingMessages=[]},this.ws.onmessage=s=>{let o;try{o=JSON.parse(s.data)}catch{console.warn("[ws] failed to parse message",s.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 s;(s=this.ws)==null||s.close()})}disconnect(){var r;this.shouldReconnect=!1,this.reconnectTimer&&clearTimeout(this.reconnectTimer),(r=this.ws)==null||r.close(),this.ws=null}onMessage(r){return this.handlers.add(r),()=>this.handlers.delete(r)}sendRaw(r){var s;((s=this.ws)==null?void 0:s.readyState)===WebSocket.OPEN&&this.ws.send(r)}send(r,s){var n;const o=JSON.stringify({type:r,payload:s});((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN?this.ws.send(o):this.pendingMessages.push(o)}subscribe(r){this.activeSubscriptions.add(r),this.send("subscribe",{run_id:r})}unsubscribe(r){this.activeSubscriptions.delete(r),this.send("unsubscribe",{run_id:r})}sendChatMessage(r,s){this.send("chat.message",{run_id:r,text:s})}sendInterruptResponse(r,s){this.send("chat.interrupt_response",{run_id:r,data:s})}debugStep(r){this.send("debug.step",{run_id:r})}debugContinue(r){this.send("debug.continue",{run_id:r})}debugStop(r){this.send("debug.stop",{run_id:r})}setBreakpoints(r,s){this.send("debug.set_breakpoints",{run_id:r,breakpoints:s})}}let oe=null;function ft(){return oe||(oe=new gt,oe.connect()),oe}function vt(){const t=h.useRef(ft()),{upsertRun:r,addTrace:s,addLog:o,addChatEvent:n,setActiveInterrupt:i,setActiveNode:a,removeActiveNode:c,resetRunGraphState:x,addStateEvent:p,setReloadPending:d}=A();return h.useEffect(()=>t.current.onMessage(g=>{switch(g.type){case"run.updated":r(g.payload);break;case"trace":s(g.payload);break;case"log":o(g.payload);break;case"chat":{const v=g.payload.run_id;n(v,g.payload);break}case"chat.interrupt":{const v=g.payload.run_id;i(v,g.payload);break}case"state":{const v=g.payload.run_id,k=g.payload.node_name,j=g.payload.qualified_node_name??null,$=g.payload.phase??null,I=g.payload.payload;k==="__start__"&&$==="started"&&x(v),$==="started"?a(v,k,j):$==="completed"&&c(v,k),p(v,k,I,j,$);break}case"reload":d(!0);break}}),[r,s,o,n,i,a,c,x,p,d]),t.current}const Z="/api";async function Q(t,r){const s=await fetch(t,r);if(!s.ok){let o;try{o=(await s.json()).detail||s.statusText}catch{o=s.statusText}const n=new Error(`HTTP ${s.status}`);throw n.detail=o,n.status=s.status,n}return s.json()}async function He(){return Q(`${Z}/entrypoints`)}async function yt(t){return Q(`${Z}/entrypoints/${encodeURIComponent(t)}/schema`)}async function bt(t){return Q(`${Z}/entrypoints/${encodeURIComponent(t)}/mock-input`)}async function jt(t){return Q(`${Z}/entrypoints/${encodeURIComponent(t)}/graph`)}async function ge(t,r,s="run",o=[]){return Q(`${Z}/runs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entrypoint:t,input_data:r,mode:s,breakpoints:o})})}async function wt(){return Q(`${Z}/runs`)}async function de(t){return Q(`${Z}/runs/${t}`)}async function kt(){return Q(`${Z}/reload`,{method:"POST"})}function Nt(t){const r=t.replace(/^#\/?/,"");if(!r||r==="new")return{view:"new",runId:null,tab:"traces",setupEntrypoint:null,setupMode:null};const s=r.match(/^setup\/([^/]+)\/(run|chat)$/);if(s)return{view:"setup",runId:null,tab:"traces",setupEntrypoint:decodeURIComponent(s[1]),setupMode:s[2]};const o=r.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 St(){return window.location.hash}function Et(t){return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)}function Be(){const t=h.useSyncExternalStore(Et,St),r=Nt(t),s=h.useCallback(o=>{window.location.hash=o},[]);return{...r,navigate:s}}const fe="(max-width: 767px)";function Ct(){const[t,r]=h.useState(()=>window.matchMedia(fe).matches);return h.useEffect(()=>{const s=window.matchMedia(fe),o=n=>r(n.matches);return s.addEventListener("change",o),()=>s.removeEventListener("change",o)},[]),t}const Tt={pending:"var(--text-muted)",running:"var(--warning)",suspended:"var(--info)",completed:"var(--success)",failed:"var(--error)"};function ve({run:t,isSelected:r,onClick:s}){var a;const o=Tt[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:s,className:"w-full text-left px-3 py-1.5 flex items-center gap-2 transition-colors cursor-pointer",style:{background:r?"color-mix(in srgb, var(--accent) 8%, var(--bg-primary))":void 0,borderLeft:r?"2px solid var(--accent)":"2px solid transparent"},onMouseEnter:c=>{r||(c.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:c=>{r||(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:r?"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 _t({runs:t,selectedRunId:r,onSelectRun:s,onNewRun:o,isMobile:n,isOpen:i,onClose:a}){const c=[...t].sort((x,p)=>new Date(p.start_time??0).getTime()-new Date(x.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.jsx("img",{src:"/favicon.ico",width:"16",height:"16",alt:"UiPath"}),e.jsx("span",{className:"text-[10px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"Developer Console"})]}),e.jsx("div",{className:"flex items-center gap-1",children: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:[c.map(x=>e.jsx(ve,{run:x,isSelected:x.id===r,onClick:()=>s(x.id)},x.id)),c.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.jsx("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.jsx("img",{src:"/favicon.ico",width:"16",height:"16",alt:"UiPath"}),e.jsx("span",{className:"text-[10px] uppercase tracking-widest font-semibold",style:{color:"var(--text-muted)"},children:"Developer Console"})]})}),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:x=>{x.currentTarget.style.color="var(--text-primary)",x.currentTarget.style.borderColor="var(--text-muted)"},onMouseLeave:x=>{x.currentTarget.style.color="var(--text-muted)",x.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:[c.map(x=>e.jsx(ve,{run:x,isSelected:x.id===r,onClick:()=>s(x.id)},x.id)),c.length===0&&e.jsx("p",{className:"text-xs px-3 py-4 text-center",style:{color:"var(--text-muted)"},children:"No runs yet"})]})]})}function De(){const t=localStorage.getItem("uipath-dev-theme");return t==="light"||t==="dark"?t:"dark"}function Ve(t){document.documentElement.setAttribute("data-theme",t),localStorage.setItem("uipath-dev-theme",t)}Ve(De());const Lt=ie(t=>({theme:De(),toggleTheme:()=>t(r=>{const s=r.theme==="dark"?"light":"dark";return Ve(s),{theme:s}})}));function Mt(){const{theme:t,toggleTheme:r}=Lt(),{enabled:s,status:o,environment:n,tenants:i,uipathUrl:a,setEnvironment:c,startLogin:x,selectTenant:p,logout:d}=We(),{projectName:m,projectVersion:w,projectAuthors:g}=Ae(),[v,k]=h.useState(!1),[j,$]=h.useState(""),I=h.useRef(null),F=h.useRef(null);h.useEffect(()=>{if(!v)return;const u=l=>{I.current&&!I.current.contains(l.target)&&F.current&&!F.current.contains(l.target)&&k(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[v]);const D=o==="authenticated",V=o==="expired",q=o==="pending",S=o==="needs_tenant";let E="UiPath: Disconnected",P=null,O=!0;D?(E=`UiPath: ${a?a.replace(/^https?:\/\/[^/]+\//,""):""}`,P="var(--success)",O=!1):V?(E=`UiPath: ${a?a.replace(/^https?:\/\/[^/]+\//,""):""} (expired)`,P="var(--error)",O=!1):q?E="UiPath: Signing in…":S&&(E="UiPath: Select Tenant");const G=()=>{q||(V?x():k(u=>!u))},H="flex items-center gap-1 px-1.5 rounded transition-colors",J={onMouseEnter:u=>{u.currentTarget.style.background="var(--bg-hover)",u.currentTarget.style.color="var(--text-primary)"},onMouseLeave:u=>{u.currentTarget.style.background="",u.currentTarget.style.color="var(--text-muted)"}};return e.jsxs("div",{className:"h-6 flex items-center justify-end gap-3 px-2 text-xs border-t shrink-0",style:{background:"var(--bg-secondary)",color:"var(--text-muted)",borderColor:"var(--border)",fontSize:"11px"},children:[s&&e.jsxs("div",{className:"relative flex items-center",children:[e.jsxs("div",{ref:F,className:`${H} cursor-pointer`,onClick:G,...J,title:D?a??"":V?"Token expired — click to re-authenticate":q?"Signing in…":S?"Select a tenant":"Click to sign in",children:[q?e.jsxs("svg",{className:"animate-spin",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",strokeOpacity:"0.25"}),e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",strokeLinecap:"round"})]}):P?e.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:P}}):O?e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 9.9-1"})]}):null,e.jsx("span",{className:"truncate max-w-[200px]",children:E})]}),v&&e.jsx("div",{ref:I,className:"absolute bottom-full right-0 mb-1 rounded border shadow-lg p-1 min-w-[160px]",style:{background:"var(--bg-secondary)",borderColor:"var(--border)"},children:D||V?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{a&&window.open(a,"_blank","noopener,noreferrer"),k(!1)},className:"w-full flex items-center gap-2 px-2 py-1.5 text-[11px] rounded cursor-pointer transition-colors text-left",style:{color:"var(--text-muted)",background:"transparent",border:"none"},onMouseEnter:u=>{u.currentTarget.style.background="var(--bg-hover)",u.currentTarget.style.color="var(--text-primary)"},onMouseLeave:u=>{u.currentTarget.style.background="transparent",u.currentTarget.style.color="var(--text-muted)"},children:[e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),"Go to Platform"]}),e.jsxs("button",{onClick:()=>{d(),k(!1)},className:"w-full flex items-center gap-2 px-2 py-1.5 text-[11px] rounded cursor-pointer transition-colors text-left",style:{color:"var(--text-muted)",background:"transparent",border:"none"},onMouseEnter:u=>{u.currentTarget.style.background="var(--bg-hover)",u.currentTarget.style.color="var(--text-primary)"},onMouseLeave:u=>{u.currentTarget.style.background="transparent",u.currentTarget.style.color="var(--text-muted)"},children:[e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),e.jsx("polyline",{points:"16 17 21 12 16 7"}),e.jsx("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]}),"Sign Out"]})]}):S?e.jsxs("div",{className:"p-1",children:[e.jsx("label",{className:"block text-[10px] uppercase tracking-wider font-semibold mb-1",style:{color:"var(--text-muted)"},children:"Tenant"}),e.jsxs("select",{value:j,onChange:u=>$(u.target.value),className:"w-full rounded px-1.5 py-1 text-[10px] mb-1.5 appearance-auto",style:{background:"var(--bg-primary)",border:"1px solid var(--border)",color:"var(--text-primary)"},children:[e.jsx("option",{value:"",children:"Select…"}),i.map(u=>e.jsx("option",{value:u,children:u},u))]}),e.jsx("button",{onClick:()=>{j&&(p(j),k(!1))},disabled:!j,className:"w-full px-2 py-1 text-[10px] uppercase tracking-wider font-semibold rounded border border-[var(--border)] bg-transparent cursor-pointer transition-colors disabled:opacity-30 disabled:cursor-not-allowed",style:{color:"var(--text-muted)"},children:"Confirm"})]}):e.jsxs("div",{className:"p-1",children:[e.jsx("label",{className:"block text-[10px] uppercase tracking-wider font-semibold mb-1",style:{color:"var(--text-muted)"},children:"Environment"}),e.jsxs("select",{value:n,onChange:u=>c(u.target.value),className:"w-full rounded px-1.5 py-0.5 text-[10px] mb-1.5 appearance-auto",style:{background:"var(--bg-primary)",border:"1px solid var(--border)",color:"var(--text-muted)"},children:[e.jsx("option",{value:"cloud",children:"cloud"}),e.jsx("option",{value:"staging",children:"staging"}),e.jsx("option",{value:"alpha",children:"alpha"})]}),e.jsx("button",{onClick:()=>{x(),k(!1)},className:"w-full px-2 py-1 text-[10px] uppercase tracking-wider font-semibold rounded border border-[var(--border)] bg-transparent cursor-pointer transition-colors",style:{color:"var(--text-muted)"},onMouseEnter:u=>{u.currentTarget.style.color="var(--text-primary)",u.currentTarget.style.borderColor="var(--text-muted)"},onMouseLeave:u=>{u.currentTarget.style.color="var(--text-muted)",u.currentTarget.style.borderColor="var(--border)"},children:"Sign In"})]})})]}),m&&e.jsxs("span",{className:H,children:["Project: ",m]}),w&&e.jsxs("span",{className:H,children:["Version: v",w]}),g&&e.jsxs("span",{className:H,children:["Author: ",g]}),e.jsxs("a",{href:"https://github.com/UiPath/uipath-dev-python",target:"_blank",rel:"noopener noreferrer",className:`${H} cursor-pointer no-underline`,style:{color:"var(--text-muted)"},...J,title:"View on GitHub",children:[e.jsx("svg",{width:"12",height:"12",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"})}),e.jsx("span",{children:"uipath-dev-python"})]}),e.jsxs("div",{className:`${H} cursor-pointer`,onClick:r,...J,title:`Switch to ${t==="dark"?"light":"dark"} theme`,children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t==="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("span",{children:t==="dark"?"Dark":"Light"})]})]})}function Rt(){const{navigate:t}=Be(),r=A(p=>p.entrypoints),[s,o]=h.useState(""),[n,i]=h.useState(!0),[a,c]=h.useState(null);h.useEffect(()=>{!s&&r.length>0&&o(r[0])},[r,s]),h.useEffect(()=>{s&&(i(!0),c(null),yt(s).then(p=>{var m;const d=(m=p.input)==null?void 0:m.properties;i(!!(d!=null&&d.messages))}).catch(p=>{const d=p.detail||{};c(d.error||d.message||`Failed to load entrypoint "${s}"`)}))},[s]);const x=p=>{s&&t(`#/setup/${encodeURIComponent(s)}/${p}`)};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:r.length>1?"Select an entrypoint and choose a mode":"Choose a mode"})]}),r.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",{id:"entrypoint-select",value:s,onChange:p=>o(p.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:r.map(p=>e.jsx("option",{value:p,children:p},p))})]}),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(ye,{title:"Autonomous",description:"Run the agent end-to-end. Set breakpoints to pause and inspect execution.",icon:e.jsx($t,{}),color:"var(--success)",onClick:()=>x("run"),disabled:!s}),e.jsx(ye,{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(It,{}),color:"var(--accent)",onClick:()=>x("chat"),disabled:!s||!n})]})]})})}function ye({title:t,description:r,icon:s,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:s}),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:r})]})}function $t(){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 It(){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 Pt="modulepreload",Ot=function(t){return"/"+t},be={},ze=function(r,s,o){let n=Promise.resolve();if(s&&s.length>0){let a=function(p){return Promise.all(p.map(d=>Promise.resolve(d).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),x=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));n=a(s.map(p=>{if(p=Ot(p),p in be)return;be[p]=!0;const d=p.endsWith(".css"),m=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${m}`))return;const w=document.createElement("link");if(w.rel=d?"stylesheet":Pt,d||(w.as="script"),w.crossOrigin="",w.href=p,x&&w.setAttribute("nonce",x),document.head.appendChild(w),d)return new Promise((g,v)=>{w.addEventListener("load",g),w.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${p}`)))})}))}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 r().catch(i)})},Wt={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function At({data:t}){const r=t.status,s=t.nodeWidth,o=t.label??"Start",n=t.hasBreakpoint,i=t.isPausedHere,a=t.isActiveNode,c=t.isExecutingNode,x=i?"var(--error)":c?"var(--success)":a?"var(--accent)":r==="completed"?"var(--success)":r==="running"?"var(--warning)":"var(--node-border)",p=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:s,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${x}`,boxShadow:i||a||c?`0 0 4px ${p}`: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:Wt})]})}const Ht={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Bt({data:t}){const r=t.status,s=t.nodeWidth,o=t.label??"End",n=t.hasBreakpoint,i=t.isPausedHere,a=t.isActiveNode,c=t.isExecutingNode,x=i?"var(--error)":c?"var(--success)":a?"var(--accent)":r==="completed"?"var(--success)":r==="failed"?"var(--error)":"var(--node-border)",p=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:s,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${x}`,boxShadow:i||a||c?`0 0 4px ${p}`: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:Ht}),o]})}const je={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Dt({data:t}){const r=t.status,s=t.nodeWidth,o=t.model_name,n=t.label??"Model",i=t.hasBreakpoint,a=t.isPausedHere,c=t.isActiveNode,x=t.isExecutingNode,p=a?"var(--error)":x?"var(--success)":c?"var(--accent)":r==="completed"?"var(--success)":r==="running"?"var(--warning)":r==="failed"?"var(--error)":"var(--node-border)",d=a?"var(--error)":x?"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:s,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${p}`,boxShadow:a||c||x?`0 0 4px ${d}`:void 0,animation:a||c||x?`node-pulse-${a?"red":x?"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:je}),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:je})]})}const we={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0},Vt=3;function zt({data:t}){const r=t.status,s=t.nodeWidth,o=t.tool_names,n=t.tool_count,i=t.label??"Tool",a=t.hasBreakpoint,c=t.isPausedHere,x=t.isActiveNode,p=t.isExecutingNode,d=c?"var(--error)":p?"var(--success)":x?"var(--accent)":r==="completed"?"var(--success)":r==="running"?"var(--warning)":r==="failed"?"var(--error)":"var(--node-border)",m=c?"var(--error)":p?"var(--success)":"var(--accent)",w=(o==null?void 0:o.slice(0,Vt))??[],g=(n??(o==null?void 0:o.length)??0)-w.length;return e.jsxs("div",{className:"px-3 py-1.5 rounded-lg text-center text-xs overflow-hidden cursor-pointer relative",style:{width:s,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${d}`,boxShadow:c||x||p?`0 0 4px ${m}`:void 0,animation:c||x||p?`node-pulse-${c?"red":p?"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:we}),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}),w.length>0&&e.jsxs("div",{style:{marginTop:3,fontSize:9,color:"var(--text-muted)",textAlign:"left"},children:[w.map(v=>e.jsx("div",{className:"truncate",children:v},v)),g>0&&e.jsxs("div",{style:{fontStyle:"italic"},children:["+",g," more"]})]}),e.jsx(Y,{type:"source",position:X.Bottom,style:we})]})}const ke={opacity:0,width:1,height:1,minWidth:0,minHeight:0,border:"none",padding:0};function Ut({data:t}){const r=t.label??"",s=t.status,o=t.hasBreakpoint,n=t.isPausedHere,i=t.isActiveNode,a=t.isExecutingNode,c=n?"var(--error)":a?"var(--success)":i?"var(--accent)":s==="completed"?"var(--success)":s==="running"?"var(--warning)":s==="failed"?"var(--error)":"var(--bg-tertiary)",x=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 ${x}`: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:ke}),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:r}),e.jsx(Y,{type:"source",position:X.Bottom,style:ke})]})}function Ft({data:t}){const r=t.status,s=t.nodeWidth,o=t.label??"",n=t.hasBreakpoint,i=t.isPausedHere,a=t.isActiveNode,c=t.isExecutingNode,x=i?"var(--error)":c?"var(--success)":a?"var(--accent)":r==="completed"?"var(--success)":r==="running"?"var(--warning)":r==="failed"?"var(--error)":"var(--node-border)",p=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:s,background:"var(--node-bg)",color:"var(--text-primary)",border:`2px solid ${x}`,boxShadow:i||a||c?`0 0 4px ${p}`: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 Jt(t,r=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 s=`M ${t[0].x} ${t[0].y}`;for(let n=1;n0&&(s+=Math.min(o.length,3)*12+(o.length>3?12:0)+4),t!=null&&t.model_name&&(s+=14),s}let ue=null;async function Qt(){if(!ue){const{default:t}=await ze(async()=>{const{default:r}=await import("./vendor-elk-CTNP4r_q.js").then(s=>s.e);return{default:r}},__vite__mapDeps([0,1]));ue=new t}return ue}const Ee={"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"},er="[top=35,left=15,bottom=15,right=15]";function tr(t){const r=[],s=[];for(const o of t.nodes){const n=o.data,i={id:o.id,width:Ne(n),height:Se(n,o.type)};if(o.data.subgraph){const a=o.data.subgraph;delete i.width,delete i.height,i.layoutOptions={...Ee,"elk.padding":er},i.children=a.nodes.map(c=>({id:`${o.id}/${c.id}`,width:Ne(c.data),height:Se(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}`]}))}r.push(i)}for(const o of t.edges)s.push({id:o.id,sources:[o.source],targets:[o.target]});return{id:"root",layoutOptions:Ee,children:r,edges:s}}const he={type:et.ArrowClosed,width:12,height:12,color:"var(--node-border)"};function Ue(t){return{stroke:"var(--node-border)",strokeWidth:1.5,...t?{strokeDasharray:"6 3"}:{}}}function Ce(t,r,s,o,n){var p;const i=(p=t.sections)==null?void 0:p[0],a=(n==null?void 0:n.x)??0,c=(n==null?void 0:n.y)??0;let x;if(i)x={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(d=>({x:d.x+a,y:d.y+c}))};else{const d=r.get(t.sources[0]),m=r.get(t.targets[0]);d&&m&&(x={sourcePoint:{x:d.x+d.width/2,y:d.y+d.height},targetPoint:{x:m.x+m.width/2,y:m.y},bendPoints:[]})}return{id:t.id,source:t.sources[0],target:t.targets[0],type:"elk",data:x,style:Ue(o),markerEnd:he,...s?{label:s,labelStyle:{fill:"var(--text-muted)",fontSize:10},labelBgStyle:{fill:"var(--bg-primary)",fillOpacity:.8}}:{}}}async function rr(t){var x,p;const r=tr(t),o=await(await Qt()).layout(r),n=new Map;for(const d of t.nodes)if(n.set(d.id,{type:d.type,data:d.data}),d.data.subgraph)for(const m of d.data.subgraph.nodes)n.set(`${d.id}/${m.id}`,{type:m.type,data:m.data});const i=[],a=[],c=new Map;for(const d of o.children??[]){const m=d.x??0,w=d.y??0;c.set(d.id,{x:m,y:w,width:d.width??0,height:d.height??0});for(const g of d.children??[])c.set(g.id,{x:m+(g.x??0),y:w+(g.y??0),width:g.width??0,height:g.height??0})}for(const d of o.children??[]){const m=n.get(d.id);if((((x=d.children)==null?void 0:x.length)??0)>0){i.push({id:d.id,type:"groupNode",data:{...(m==null?void 0:m.data)??{},nodeWidth:d.width,nodeHeight:d.height},position:{x:d.x??0,y:d.y??0},style:{width:d.width,height:d.height}});for(const k of d.children??[]){const j=n.get(k.id);i.push({id:k.id,type:(j==null?void 0:j.type)??"defaultNode",data:{...(j==null?void 0:j.data)??{},nodeWidth:k.width},position:{x:k.x??0,y:k.y??0},parentNode:d.id,extent:"parent"})}const g=d.x??0,v=d.y??0;for(const k of d.edges??[]){const j=t.nodes.find(I=>I.id===d.id),$=(p=j==null?void 0:j.data.subgraph)==null?void 0:p.edges.find(I=>`${d.id}/${I.id}`===k.id);a.push(Ce(k,c,$==null?void 0:$.label,$==null?void 0:$.conditional,{x:g,y:v}))}}else i.push({id:d.id,type:(m==null?void 0:m.type)??"defaultNode",data:{...(m==null?void 0:m.data)??{},nodeWidth:d.width},position:{x:d.x??0,y:d.y??0}})}for(const d of o.edges??[]){const m=t.edges.find(w=>w.id===d.id);a.push(Ce(d,c,m==null?void 0:m.label,m==null?void 0:m.conditional))}return{nodes:i,edges:a}}function ae({entrypoint:t,runId:r,breakpointNode:s,breakpointNextNodes:o,onBreakpointChange:n,fitViewTrigger:i}){const[a,c,x]=tt([]),[p,d,m]=rt([]),[w,g]=h.useState(!0),[v,k]=h.useState(!1),[j,$]=h.useState(0),I=h.useRef(0),F=h.useRef(null),D=A(u=>u.breakpoints[r]),V=A(u=>u.toggleBreakpoint),q=A(u=>u.clearBreakpoints),S=A(u=>u.activeNodes[r]),E=A(u=>{var l;return(l=u.runs[r])==null?void 0:l.status}),P=h.useCallback((u,l)=>{if(l.type==="startNode"||l.type==="endNode")return;const f=l.type==="groupNode"?l.id:l.id.includes("/")?l.id.split("/").pop():l.id;V(r,f);const C=A.getState().breakpoints[r]??{};n==null||n(Object.keys(C))},[r,V,n]),O=D&&Object.keys(D).length>0,G=h.useCallback(()=>{if(O)q(r),n==null||n([]);else{const u=[];for(const f of a){if(f.type==="startNode"||f.type==="endNode"||f.parentNode)continue;const C=f.type==="groupNode"?f.id:f.id.includes("/")?f.id.split("/").pop():f.id;u.push(C)}for(const f of u)D!=null&&D[f]||V(r,f);const l=A.getState().breakpoints[r]??{};n==null||n(Object.keys(l))}},[r,O,D,a,q,V,n]);h.useEffect(()=>{c(u=>u.map(l=>{var y;if(l.type==="startNode"||l.type==="endNode")return l;const f=l.type==="groupNode"?l.id:l.id.includes("/")?l.id.split("/").pop():l.id,C=!!(D&&D[f]);return C!==!!((y=l.data)!=null&&y.hasBreakpoint)?{...l,data:{...l.data,hasBreakpoint:C}}:l}))},[D,c]),h.useEffect(()=>{const u=s?new Set(s.split(",").map(l=>l.trim()).filter(Boolean)):null;c(l=>l.map(f=>{var _,b;if(f.type==="startNode"||f.type==="endNode")return f;const C=f.type==="groupNode"?f.id:f.id.includes("/")?f.id.split("/").pop():f.id,y=(_=f.data)==null?void 0:_.label,M=u!=null&&(u.has(C)||y!=null&&u.has(y));return M!==!!((b=f.data)!=null&&b.isPausedHere)?{...f,data:{...f.data,isPausedHere:M}}:f}))},[s,j,c]);const H=A(u=>u.stateEvents[r]);h.useEffect(()=>{const u=!!s;let l=new Set;const f=new Set,C=new Set,y=new Set,M=new Map,_=new Map;if(H)for(const b of H)b.phase==="started"?_.set(b.node_name,b.qualified_node_name??null):b.phase==="completed"&&_.delete(b.node_name);c(b=>{var T;for(const W of b)W.type&&M.set(W.id,W.type);const L=W=>{var N;const B=[];for(const R of b){const z=R.type==="groupNode"?R.id:R.id.includes("/")?R.id.split("/").pop():R.id,U=(N=R.data)==null?void 0:N.label;(z===W||U!=null&&U===W)&&B.push(R.id)}return B};if(u&&s){const W=s.split(",").map(B=>B.trim()).filter(Boolean);for(const B of W)L(B).forEach(N=>l.add(N));if(o!=null&&o.length)for(const B of o)L(B).forEach(N=>C.add(N));S!=null&&S.prev&&L(S.prev).forEach(B=>f.add(B))}else if(_.size>0){const W=new Map;for(const B of b){const N=(T=B.data)==null?void 0:T.label;if(!N)continue;const R=B.id.includes("/")?B.id.split("/").pop():B.id;for(const z of[R,N]){let U=W.get(z);U||(U=new Set,W.set(z,U)),U.add(B.id)}}for(const[B,N]of _){let R=!1;if(N){const z=N.replace(/:/g,"/");for(const U of b)U.id===z&&(l.add(U.id),R=!0)}if(!R){const z=W.get(B);z&&z.forEach(U=>l.add(U))}}}return b}),d(b=>{const L=f.size===0||b.some(T=>l.has(T.target)&&f.has(T.source));return b.map(T=>{var B,N;let W;return u?W=l.has(T.target)&&(f.size===0||!L||f.has(T.source))||l.has(T.source)&&C.has(T.target):(W=l.has(T.source),!W&&M.get(T.target)==="endNode"&&l.has(T.target)&&(W=!0)),W?(u||y.add(T.target),{...T,style:{stroke:"var(--accent)",strokeWidth:2.5},markerEnd:{...he,color:"var(--accent)"},data:{...T.data,highlighted:!0},animated:!0}):(B=T.data)!=null&&B.highlighted?{...T,style:Ue((N=T.data)==null?void 0:N.conditional),markerEnd:he,data:{...T.data,highlighted:!1},animated:!1}:T})}),c(b=>b.map(L=>{var B,N,R,z;const T=!u&&l.has(L.id);if(L.type==="startNode"||L.type==="endNode"){const U=y.has(L.id)||!u&&l.has(L.id);return U!==!!((B=L.data)!=null&&B.isActiveNode)||T!==!!((N=L.data)!=null&&N.isExecutingNode)?{...L,data:{...L.data,isActiveNode:U,isExecutingNode:T}}:L}const W=u?C.has(L.id):y.has(L.id);return W!==!!((R=L.data)!=null&&R.isActiveNode)||T!==!!((z=L.data)!=null&&z.isExecutingNode)?{...L,data:{...L.data,isActiveNode:W,isExecutingNode:T}}:L}))},[H,S,s,o,E,j,c,d]);const J=A(u=>u.graphCache[r]);return h.useEffect(()=>{if(!J&&r!=="__setup__")return;const u=J?Promise.resolve(J):jt(t),l=++I.current;g(!0),k(!1),u.then(async f=>{if(I.current!==l)return;if(!f.nodes.length){k(!0);return}const{nodes:C,edges:y}=await rr(f);if(I.current!==l)return;const M=A.getState().breakpoints[r],_=M?C.map(b=>{if(b.type==="startNode"||b.type==="endNode")return b;const L=b.type==="groupNode"?b.id:b.id.includes("/")?b.id.split("/").pop():b.id;return M[L]?{...b,data:{...b.data,hasBreakpoint:!0}}:b}):C;c(_),d(y),$(b=>b+1),setTimeout(()=>{var b;(b=F.current)==null||b.fitView({padding:.1,duration:200})},100)}).catch(()=>{I.current===l&&k(!0)}).finally(()=>{I.current===l&&g(!1)})},[t,r,J,c,d]),h.useEffect(()=>{const u=setTimeout(()=>{var l;(l=F.current)==null||l.fitView({padding:.1,duration:200})},100);return()=>clearTimeout(u)},[r]),h.useEffect(()=>{var u;i&&((u=F.current)==null||u.fitView({padding:.1,duration:200}))},[i]),h.useEffect(()=>{c(u=>{var T,W,B;const l=!!(H!=null&&H.length),f=E==="completed"||E==="failed",C=new Set,y=new Set(u.map(N=>N.id)),M=new Map;for(const N of u){const R=(T=N.data)==null?void 0:T.label;if(!R)continue;const z=N.id.includes("/")?N.id.split("/").pop():N.id;for(const U of[z,R]){let re=M.get(U);re||(re=new Set,M.set(U,re)),re.add(N.id)}}if(l)for(const N of H){let R=!1;if(N.qualified_node_name){const z=N.qualified_node_name.replace(/:/g,"/");y.has(z)&&(C.add(z),R=!0)}if(!R){const z=M.get(N.node_name);z&&z.forEach(U=>C.add(U))}}const _=new Set;for(const N of u)N.parentNode&&C.has(N.id)&&_.add(N.parentNode);let b;E==="failed"&&C.size===0&&(b=(W=u.find(N=>!N.parentNode&&N.type!=="startNode"&&N.type!=="endNode"&&N.type!=="groupNode"))==null?void 0:W.id);let L;if(E==="completed"){const N=(B=u.find(R=>!R.parentNode&&R.type!=="startNode"&&R.type!=="endNode"&&R.type!=="groupNode"))==null?void 0:B.id;N&&!C.has(N)&&(L=N)}return u.map(N=>{var z;let R;return N.id===b?R="failed":N.id===L||C.has(N.id)?R="completed":N.type==="startNode"?(!N.parentNode&&l||N.parentNode&&_.has(N.parentNode))&&(R="completed"):N.type==="endNode"?!N.parentNode&&f?R=E==="failed"?"failed":"completed":N.parentNode&&_.has(N.parentNode)&&(R="completed"):N.type==="groupNode"&&_.has(N.id)&&(R="completed"),R!==((z=N.data)==null?void 0:z.status)?{...N,data:{...N.data,status:R}}:N})})},[H,E,j,c]),w?e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--text-muted)"},children:"Loading graph..."}):v?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(st,{nodes:a,edges:p,onNodesChange:x,onEdgesChange:m,nodeTypes:qt,edgeTypes:Yt,onInit:u=>{F.current=u},onNodeClick:P,fitView:!0,proOptions:{hideAttribution:!0},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,children:[e.jsx(ot,{color:"var(--bg-tertiary)",gap:16}),e.jsx(nt,{showInteractive:!1}),e.jsx(at,{position:"top-right",children:e.jsxs("button",{onClick:G,title:O?"Remove all breakpoints":"Set breakpoints on all nodes",style:{background:"var(--bg-secondary)",color:O?"var(--error)":"var(--text-muted)",border:`1px solid ${O?"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:O?"var(--error)":"var(--node-border)"}}),O?"Clear all":"Break all"]})}),e.jsx(it,{nodeColor:u=>{var f;if(u.type==="groupNode")return"var(--bg-tertiary)";const l=(f=u.data)==null?void 0:f.status;return l==="completed"?"var(--success)":l==="running"?"var(--warning)":l==="failed"?"var(--error)":"var(--node-border)"},nodeStrokeWidth:0,style:{background:"var(--bg-secondary)",width:120,height:80}})]})]})}const ee="__setup__";function sr({entrypoint:t,mode:r,ws:s,onRunCreated:o,isMobile:n}){const[i,a]=h.useState("{}"),[c,x]=h.useState({}),[p,d]=h.useState(!1),[m,w]=h.useState(!0),[g,v]=h.useState(null),[k,j]=h.useState(""),[$,I]=h.useState(0),[F,D]=h.useState(!0),[V,q]=h.useState(()=>{const y=localStorage.getItem("setupTextareaHeight");return y?parseInt(y,10):140}),S=h.useRef(null),[E,P]=h.useState(()=>{const y=localStorage.getItem("setupPanelWidth");return y?parseInt(y,10):380}),O=r==="run";h.useEffect(()=>{w(!0),v(null),bt(t).then(y=>{x(y.mock_input),a(JSON.stringify(y.mock_input,null,2))}).catch(y=>{console.error("Failed to load mock input:",y);const M=y.detail||{};v(M.message||`Failed to load schema for "${t}"`),a("{}")}).finally(()=>w(!1))},[t]),h.useEffect(()=>{A.getState().clearBreakpoints(ee)},[]);const G=async()=>{let y;try{y=JSON.parse(i)}catch{alert("Invalid JSON input");return}d(!0);try{const M=A.getState().breakpoints[ee]??{},_=Object.keys(M),b=await ge(t,y,r,_);A.getState().clearBreakpoints(ee),A.getState().upsertRun(b),o(b.id)}catch(M){console.error("Failed to create run:",M)}finally{d(!1)}},H=async()=>{const y=k.trim();if(y){d(!0);try{const M=A.getState().breakpoints[ee]??{},_=Object.keys(M),b=await ge(t,c,"chat",_);A.getState().clearBreakpoints(ee),A.getState().upsertRun(b),A.getState().addLocalChatMessage(b.id,{message_id:`local-${Date.now()}`,role:"user",content:y}),s.sendChatMessage(b.id,y),o(b.id)}catch(M){console.error("Failed to create chat run:",M)}finally{d(!1)}}};h.useEffect(()=>{try{JSON.parse(i),D(!0)}catch{D(!1)}},[i]);const J=h.useCallback(y=>{y.preventDefault();const M="touches"in y?y.touches[0].clientY:y.clientY,_=V,b=T=>{const W="touches"in T?T.touches[0].clientY:T.clientY,B=Math.max(60,_+(M-W));q(B)},L=()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",L),document.removeEventListener("touchmove",b),document.removeEventListener("touchend",L),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("setupTextareaHeight",String(V))};document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",b),document.addEventListener("mouseup",L),document.addEventListener("touchmove",b,{passive:!1}),document.addEventListener("touchend",L)},[V]),u=h.useCallback(y=>{y.preventDefault();const M="touches"in y?y.touches[0].clientX:y.clientX,_=E,b=T=>{const W=S.current;if(!W)return;const B="touches"in T?T.touches[0].clientX:T.clientX,N=W.clientWidth-300,R=Math.max(280,Math.min(N,_+(M-B)));P(R)},L=()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",L),document.removeEventListener("touchmove",b),document.removeEventListener("touchend",L),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("setupPanelWidth",String(E)),I(T=>T+1)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",b),document.addEventListener("mouseup",L),document.addEventListener("touchmove",b,{passive:!1}),document.addEventListener("touchend",L)},[E]),l=O?"Autonomous":"Conversational",f=O?"var(--success)":"var(--accent)",C=e.jsxs("div",{className:"shrink-0 flex flex-col",style:n?{background:"var(--bg-primary)"}:{width:E,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:f},children:"●"}),l]}),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:O?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:O?"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",O?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"]})]})]})]}),O?e.jsxs("div",{className:"flex flex-col",style:{background:"var(--bg-primary)"},children:[!n&&e.jsx("div",{onMouseDown:J,onTouchStart:J,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:[g?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:g}):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",m&&e.jsx("span",{className:"ml-2 font-normal",children:"Loading..."})]}),e.jsx("textarea",{value:i,onChange:y=>a(y.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:V,background:"var(--bg-secondary)",border:`1px solid ${F?"var(--border)":"#b91c1c"}`,color:"var(--text-primary)"}})]}),e.jsx("button",{onClick:G,disabled:p||m||!!g,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:f,color:f},onMouseEnter:y=>{p||(y.currentTarget.style.background=`color-mix(in srgb, ${f} 10%, transparent)`)},onMouseLeave:y=>{y.currentTarget.style.background="transparent"},children:p?"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:y=>j(y.target.value),onKeyDown:y=>{y.key==="Enter"&&!y.shiftKey&&(y.preventDefault(),H())},disabled:p||m,placeholder:p?"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:H,disabled:p||m||!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:!p&&k.trim()?"var(--accent)":"var(--text-muted)",background:"transparent"},onMouseEnter:y=>{!p&&k.trim()&&(y.currentTarget.style.background="color-mix(in srgb, var(--accent) 10%, transparent)")},onMouseLeave:y=>{y.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(ae,{entrypoint:t,traces:[],runId:ee,fitViewTrigger:$})}),e.jsx("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:C})]}):e.jsxs("div",{ref:S,className:"flex h-full",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(ae,{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"})}),C]})}const or={key:"var(--info)",string:"var(--success)",number:"var(--warning)",boolean:"var(--accent)",null:"var(--accent)",punctuation:"var(--text-muted)"};function nr(t){const r=[],s=/("(?:[^"\\]|\\.)*")\s*:|("(?:[^"\\]|\\.)*")|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)\b|(true|false)\b|(null)\b|([{}[\]:,])/g;let o=0,n;for(;(n=s.exec(t))!==null;){if(n.index>o&&r.push({type:"punctuation",text:t.slice(o,n.index)}),n[1]!==void 0){r.push({type:"key",text:n[1]});const i=t.indexOf(":",n.index+n[1].length);i!==-1&&(i>n.index+n[1].length&&r.push({type:"punctuation",text:t.slice(n.index+n[1].length,i)}),r.push({type:"punctuation",text:":"}),s.lastIndex=i+1)}else n[2]!==void 0?r.push({type:"string",text:n[2]}):n[3]!==void 0?r.push({type:"number",text:n[3]}):n[4]!==void 0?r.push({type:"boolean",text:n[4]}):n[5]!==void 0?r.push({type:"null",text:n[5]}):n[6]!==void 0&&r.push({type:"punctuation",text:n[6]});o=s.lastIndex}return onr(t),[t]);return e.jsx("pre",{className:r,style:s,children:o.map((n,i)=>e.jsx("span",{style:{color:or[n.type]},children:n.text},i))})}const ar={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"}},ir={color:"var(--text-muted)",label:"Unknown"};function cr(t){if(typeof t!="string")return null;const r=t.trim();if(r.startsWith("{")&&r.endsWith("}")||r.startsWith("[")&&r.endsWith("]"))try{return JSON.stringify(JSON.parse(r),null,2)}catch{return null}return null}const Te=200;function lr(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 dr({value:t}){const[r,s]=h.useState(!1),o=lr(t),n=h.useMemo(()=>cr(t),[t]),i=n!==null,a=n??o,c=a.length>Te||a.includes(` +`),x=h.useCallback(()=>s(p=>!p),[]);return c?e.jsxs("div",{children:[r?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,Te),"..."]}),e.jsx("button",{onClick:x,className:"text-[10px] cursor-pointer ml-1",style:{color:"var(--info)"},children:r?"[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 ur({span:t}){const[r,s]=h.useState(!0),[o,n]=h.useState(!1),[i,a]=h.useState("table"),[c,x]=h.useState(!1),p=ar[t.status.toLowerCase()]??{...ir,label:t.status},d=h.useMemo(()=>JSON.stringify(t,null,2),[t]),m=h.useCallback(()=>{navigator.clipboard.writeText(d).then(()=>{x(!0),setTimeout(()=>x(!1),1500)})},[d]),w=Object.entries(t.attributes),g=[{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:"flex flex-col h-full text-xs leading-normal",children:[e.jsxs("div",{className:"px-2 border-b flex items-center gap-1 shrink-0",style:{borderColor:"var(--border)",background:"var(--bg-secondary)",height:"28px"},children:[e.jsx("button",{onClick:()=>a("table"),className:"px-2 h-[18px] text-[10px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer inline-flex items-center",style:{color:i==="table"?"var(--accent)":"var(--text-muted)",background:i==="table"?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},onMouseEnter:v=>{i!=="table"&&(v.currentTarget.style.color="var(--text-primary)")},onMouseLeave:v=>{i!=="table"&&(v.currentTarget.style.color="var(--text-muted)")},children:"Table"}),e.jsx("button",{onClick:()=>a("json"),className:"px-2 h-[18px] text-[10px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer inline-flex items-center",style:{color:i==="json"?"var(--accent)":"var(--text-muted)",background:i==="json"?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},onMouseEnter:v=>{i!=="json"&&(v.currentTarget.style.color="var(--text-primary)")},onMouseLeave:v=>{i!=="json"&&(v.currentTarget.style.color="var(--text-muted)")},children:"JSON"}),e.jsxs("span",{className:"ml-auto 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, ${p.color} 15%, var(--bg-secondary))`,color:p.color},children:[e.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:p.color}}),p.label]})]}),e.jsx("div",{className:"overflow-y-auto flex-1 p-0.5 pr-0 pt-0 mr-0.5 mt-0.5",children:i==="table"?e.jsxs(e.Fragment,{children:[w.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(--success)",borderColor:"var(--border)",background:"var(--bg-secondary)"},onClick:()=>s(v=>!v),children:[e.jsxs("span",{className:"flex-1",children:["Attributes (",w.length,")"]}),e.jsx("span",{style:{color:"var(--text-muted)",transform:r?"rotate(0deg)":"rotate(-90deg)"},children:"▾"})]}),r&&w.map(([v,k],j)=>e.jsxs("div",{className:"flex gap-2 px-2 py-1 items-start border-b",style:{borderColor:"var(--border)",background:j%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:v,children:v}),e.jsx("span",{className:"flex-1 min-w-0",children:e.jsx(dr,{value:k})})]},v))]}),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(--success)",borderColor:"var(--border)",background:"var(--bg-secondary)"},onClick:()=>n(v=>!v),children:[e.jsxs("span",{className:"flex-1",children:["Identifiers (",g.length,")"]}),e.jsx("span",{style:{color:"var(--text-muted)",transform:o?"rotate(0deg)":"rotate(-90deg)"},children:"▾"})]}),o&&g.map((v,k)=>e.jsxs("div",{className:"flex gap-2 px-2 py-1 items-start border-b",style:{borderColor:"var(--border)",background:k%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:v.label,children:v.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:v.value})})]},v.label))]}):e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:m,className:"absolute top-1 right-1 z-10 text-[10px] cursor-pointer px-1.5 py-0.5 rounded transition-colors",style:{color:c?"var(--success)":"var(--text-muted)",background:"var(--bg-secondary)",border:"1px solid var(--border)"},onMouseEnter:v=>{c||(v.currentTarget.style.color="var(--text-primary)")},onMouseLeave:v=>{v.currentTarget.style.color=c?"var(--success)":"var(--text-muted)"},children:c?"Copied!":"Copy"}),e.jsx(te,{json:d,className:"font-mono text-[11px] whitespace-pre-wrap p-2",style:{}})]})})]})}function pr(t){const r=[];function s(o,n){r.push({span:o.span,depth:n});for(const i of o.children)s(i,n+1)}for(const o of t)s(o,0);return r}function hr({tree:t,selectedSpan:r,onSelect:s}){const o=h.useMemo(()=>pr(t),[t]),{globalStart:n,totalDuration:i}=h.useMemo(()=>{if(o.length===0)return{globalStart:0,totalDuration:1};let a=1/0,c=-1/0;for(const{span:x}of o){const p=new Date(x.timestamp).getTime();a=Math.min(a,p),c=Math.max(c,p+(x.duration_ms??0))}return{globalStart:a,totalDuration:Math.max(c-a,1)}},[o]);return o.length===0?null:e.jsx(e.Fragment,{children:o.map(({span:a,depth:c})=>{var k;const x=new Date(a.timestamp).getTime()-n,p=a.duration_ms??0,d=x/i*100,m=Math.max(p/i*100,.3),w=Fe[a.status.toLowerCase()]??"var(--text-muted)",g=a.span_id===(r==null?void 0:r.span_id),v=(k=a.attributes)==null?void 0:k["openinference.span.kind"];return e.jsxs("button",{"data-span-id":a.span_id,onClick:()=>s(a),className:"w-full text-left text-xs leading-normal py-1 flex items-center transition-colors",style:{background:g?"color-mix(in srgb, var(--accent) 10%, var(--bg-primary))":void 0,borderLeft:g?"2px solid var(--accent)":"2px solid transparent"},onMouseEnter:j=>{g||(j.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:j=>{g||(j.currentTarget.style.background="")},children:[e.jsxs("div",{className:"shrink-0 flex items-center gap-1 overflow-hidden",style:{width:"35%",minWidth:"80px",paddingLeft:`${c*12+4}px`},children:[e.jsx("span",{className:"shrink-0 flex items-center justify-center w-3.5 h-3.5",children:e.jsx(Je,{kind:v,statusColor:w})}),e.jsx("span",{className:"text-[var(--text-primary)] truncate",children:a.span_name})]}),e.jsx("div",{className:"flex-1 relative h-[14px] mx-1 rounded-sm",style:{background:"var(--bg-secondary)"},children:e.jsx("div",{className:"absolute rounded-sm",style:{left:`${d}%`,width:`${m}%`,top:"2px",bottom:"2px",background:w,opacity:.8,minWidth:"2px"}})}),e.jsx("span",{className:"shrink-0 text-[10px] tabular-nums pr-2",style:{width:"52px",textAlign:"right",color:"var(--text-muted)"},children:Ge(a.duration_ms)})]},a.span_id)})})}const Fe={started:"var(--info)",running:"var(--warning)",completed:"var(--success)",failed:"var(--error)",error:"var(--error)"};function Je({kind:t,statusColor:r}){const s=r,o=14,n={width:o,height:o,viewBox:"0 0 16 16",fill:"none",stroke:s,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:s,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:s,stroke:"none"}),e.jsx("circle",{cx:"10",cy:"9",r:"1",fill:s,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:r}})}}function xr(t){const r=new Map(t.map(a=>[a.span_id,a])),s=new Map;for(const a of t)if(a.parent_span_id){const c=s.get(a.parent_span_id)??[];c.push(a),s.set(a.parent_span_id,c)}const o=t.filter(a=>a.parent_span_id===null||!r.has(a.parent_span_id));function n(a){const c=(s.get(a.span_id)??[]).sort((x,p)=>x.timestamp.localeCompare(p.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 Ge(t){return t==null?"":t<1e3?`${t.toFixed(0)}ms`:`${(t/1e3).toFixed(2)}s`}function qe(t){return t.map(r=>{const{span:s}=r;return r.children.length>0?{name:s.span_name,children:qe(r.children)}:{name:s.span_name}})}function _e({traces:t}){const[r,s]=h.useState(null),[o,n]=h.useState(new Set),[i,a]=h.useState(()=>{const S=localStorage.getItem("traceTreeSplitWidth");return S?parseFloat(S):50}),[c,x]=h.useState(!1),[p,d]=h.useState(!1),[m,w]=h.useState(()=>localStorage.getItem("traceViewMode")||"tree"),g=xr(t),v=h.useMemo(()=>JSON.stringify(qe(g),null,2),[t]),k=h.useCallback(()=>{navigator.clipboard.writeText(v).then(()=>{d(!0),setTimeout(()=>d(!1),1500)})},[v]),j=A(S=>S.focusedSpan),$=A(S=>S.setFocusedSpan),[I,F]=h.useState(null),D=h.useRef(null),V=h.useCallback(S=>{n(E=>{const P=new Set(E);return P.has(S)?P.delete(S):P.add(S),P})},[]);h.useEffect(()=>{if(r===null)g.length>0&&s(g[0].span);else{const S=t.find(E=>E.span_id===r.span_id);S&&S!==r&&s(S)}},[t]),h.useEffect(()=>{if(!j)return;const E=t.filter(P=>P.span_name===j.name).sort((P,O)=>P.timestamp.localeCompare(O.timestamp))[j.index];if(E){s(E),F(E.span_id);const P=new Map(t.map(O=>[O.span_id,O.parent_span_id]));n(O=>{const G=new Set(O);let H=E.parent_span_id;for(;H;)G.delete(H),H=P.get(H)??null;return G})}$(null)},[j,t,$]),h.useEffect(()=>{if(!I)return;const S=I;F(null),requestAnimationFrame(()=>{const E=D.current,P=E==null?void 0:E.querySelector(`[data-span-id="${S}"]`);E&&P&&P.scrollIntoView({block:"center",behavior:"smooth"})})},[I]),h.useEffect(()=>{if(!c)return;const S=P=>{const O=document.querySelector(".trace-tree-container");if(!O)return;const G=O.getBoundingClientRect(),H=(P.clientX-G.left)/G.width*100,J=Math.max(20,Math.min(80,H));a(J),localStorage.setItem("traceTreeSplitWidth",String(J))},E=()=>{x(!1)};return window.addEventListener("mousemove",S),window.addEventListener("mouseup",E),()=>{window.removeEventListener("mousemove",S),window.removeEventListener("mouseup",E)}},[c]);const q=S=>{S.preventDefault(),x(!0)};return e.jsxs("div",{className:"flex h-full trace-tree-container",style:{cursor:c?"col-resize":void 0},children:[e.jsxs("div",{className:"flex flex-col",style:{width:`${i}%`},children:[t.length>0&&e.jsxs("div",{className:"flex items-center gap-1 px-2 border-b shrink-0",style:{borderColor:"var(--border)",background:"var(--bg-secondary)",height:"28px"},children:[e.jsx("button",{onClick:()=>{w("tree"),localStorage.setItem("traceViewMode","tree")},className:"px-2 h-[18px] text-[10px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer inline-flex items-center",style:{color:m==="tree"?"var(--accent)":"var(--text-muted)",background:m==="tree"?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},onMouseEnter:S=>{m!=="tree"&&(S.currentTarget.style.color="var(--text-primary)")},onMouseLeave:S=>{m!=="tree"&&(S.currentTarget.style.color="var(--text-muted)")},children:"Tree"}),e.jsx("button",{onClick:()=>{w("timeline"),localStorage.setItem("traceViewMode","timeline")},className:"px-2 h-[18px] text-[10px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer inline-flex items-center",style:{color:m==="timeline"?"var(--accent)":"var(--text-muted)",background:m==="timeline"?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},onMouseEnter:S=>{m!=="timeline"&&(S.currentTarget.style.color="var(--text-primary)")},onMouseLeave:S=>{m!=="timeline"&&(S.currentTarget.style.color="var(--text-muted)")},children:"Timeline"}),e.jsx("button",{onClick:()=>{w("json"),localStorage.setItem("traceViewMode","json")},className:"px-2 h-[18px] text-[10px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer inline-flex items-center",style:{color:m==="json"?"var(--accent)":"var(--text-muted)",background:m==="json"?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},onMouseEnter:S=>{m!=="json"&&(S.currentTarget.style.color="var(--text-primary)")},onMouseLeave:S=>{m!=="json"&&(S.currentTarget.style.color="var(--text-muted)")},children:"JSON"})]}),e.jsx("div",{ref:D,className:"overflow-y-auto flex-1 p-0.5 pr-0 pt-0 mr-0.5 mt-0.5",children:g.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"})}):m==="tree"?g.map((S,E)=>e.jsx(Ye,{node:S,depth:0,selectedId:(r==null?void 0:r.span_id)??null,onSelect:s,isLast:E===g.length-1,collapsedIds:o,toggleExpanded:V},S.span.span_id)):m==="timeline"?e.jsx(hr,{tree:g,selectedSpan:r,onSelect:s}):e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:k,className:"absolute top-1 right-1 z-10 text-[10px] cursor-pointer px-1.5 py-0.5 rounded transition-colors",style:{color:p?"var(--success)":"var(--text-muted)",background:"var(--bg-secondary)",border:"1px solid var(--border)"},onMouseEnter:S=>{p||(S.currentTarget.style.color="var(--text-primary)")},onMouseLeave:S=>{S.currentTarget.style.color=p?"var(--success)":"var(--text-muted)"},children:p?"Copied!":"Copy"}),e.jsx(te,{json:v,className:"font-mono text-[11px] whitespace-pre-wrap p-2",style:{}})]})})]}),e.jsx("div",{onMouseDown:q,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",children:r?e.jsx(ur,{span:r}):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 Ye({node:t,depth:r,selectedId:s,onSelect:o,isLast:n,collapsedIds:i,toggleExpanded:a}){var k;const{span:c}=t,x=!i.has(c.span_id),p=Fe[c.status.toLowerCase()]??"var(--text-muted)",d=Ge(c.duration_ms),m=c.span_id===s,w=t.children.length>0,g=r*20,v=(k=c.attributes)==null?void 0:k["openinference.span.kind"];return e.jsxs("div",{className:"relative",children:[r>0&&e.jsx("div",{className:"absolute top-0 z-10 pointer-events-none",style:{left:`${g-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:`${g+4}px`,background:m?"color-mix(in srgb, var(--accent) 10%, var(--bg-primary))":void 0,borderLeft:m?"2px solid var(--accent)":"2px solid transparent"},onMouseEnter:j=>{m||(j.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:j=>{m||(j.currentTarget.style.background="")},children:[r>0&&e.jsx("div",{className:"absolute z-10 pointer-events-none",style:{left:`${g-10}px`,top:"50%",width:"10px",height:"1px",background:"var(--border)"}}),w?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:x?"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(Je,{kind:v,statusColor:p})}),e.jsx("span",{className:"text-[var(--text-primary)] truncate min-w-0 flex-1",children:c.span_name}),d&&e.jsx("span",{className:"text-[var(--text-muted)] shrink-0 ml-auto pl-2 tabular-nums",children:d})]}),x&&t.children.map((j,$)=>e.jsx(Ye,{node:j,depth:r+1,selectedId:s,onSelect:o,isLast:$===t.children.length-1,collapsedIds:i,toggleExpanded:a},j.span.span_id))]})}const mr={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)"}},gr={color:"var(--text-muted)",bg:"transparent"};function Le({logs:t}){const r=h.useRef(null),s=h.useRef(null),[o,n]=h.useState(!1);h.useEffect(()=>{var a;(a=s.current)==null||a.scrollIntoView({behavior:"smooth"})},[t.length]);const i=()=>{const a=r.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:r,onScroll:i,className:"h-full overflow-y-auto font-mono text-xs leading-normal",children:[t.map((a,c)=>{const x=new Date(a.timestamp).toLocaleTimeString(void 0,{hour12:!1}),p=a.level.toUpperCase(),d=p.slice(0,4),m=mr[p]??gr,w=c%2===0;return e.jsxs("div",{className:"flex gap-3 px-3 py-1.5",style:{background:w?"var(--bg-primary)":"var(--bg-secondary)"},children:[e.jsx("span",{className:"text-[var(--text-muted)] shrink-0",children:x}),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:m.color,background:m.bg},children:d}),e.jsx("span",{className:"text-[var(--text-primary)] whitespace-pre-wrap break-all",children:a.message})]},c)}),e.jsx("div",{ref:s})]}),o&&e.jsx("button",{onClick:()=>{var a;return(a=r.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 fr={started:{color:"var(--accent)",label:"started"},updated:{color:"var(--info)",label:"updated"},completed:{color:"var(--success)",label:"completed"},faulted:{color:"var(--error)",label:"faulted"}},Me={color:"var(--text-muted)",label:""};function ne({events:t,runStatus:r}){const s=h.useRef(null),o=h.useRef(!0),[n,i]=h.useState(null),a=()=>{const c=s.current;c&&(o.current=c.scrollHeight-c.scrollTop-c.clientHeight<40)};return h.useEffect(()=>{o.current&&s.current&&(s.current.scrollTop=s.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:r==="running"?"Waiting for events...":"No events yet"})}):e.jsx("div",{ref:s,onScroll:a,className:"h-full overflow-y-auto font-mono text-xs leading-normal",children:t.map((c,x)=>{const p=new Date(c.timestamp).toLocaleTimeString(void 0,{hour12:!1}),d=c.payload&&Object.keys(c.payload).length>0,m=n===x,w=c.phase?fr[c.phase]??Me:Me;return e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>{d&&i(m?null:x)},className:"flex items-center gap-2 px-3 py-1.5",style:{background:x%2===0?"var(--bg-primary)":"var(--bg-secondary)",cursor:d?"pointer":"default"},children:[e.jsx("span",{className:"shrink-0",style:{color:"var(--text-muted)"},children:p}),e.jsx("span",{className:"shrink-0",style:{color:w.color},children:"●"}),e.jsx("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:c.node_name}),w.label&&e.jsx("span",{className:"shrink-0 text-[10px]",style:{color:"var(--text-muted)"},children:w.label}),d&&e.jsx("span",{className:"shrink-0 text-[9px] transition-transform",style:{color:"var(--text-muted)",transform:m?"rotate(90deg)":"rotate(0deg)"},children:"▸"})]}),m&&d&&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"})})]},x)})})}function Re({runId:t,status:r,ws:s,breakpointNode:o}){const n=r==="suspended",i=a=>{const c=A.getState().breakpoints[t]??{};s.setBreakpoints(t,Object.keys(c)),a==="step"?s.debugStep(t):a==="continue"?s.debugContinue(t):s.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(pe,{label:"Step",onClick:()=>i("step"),disabled:!n,color:"var(--info)",active:n}),e.jsx(pe,{label:"Continue",onClick:()=>i("continue"),disabled:!n,color:"var(--success)",active:n}),e.jsx(pe,{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":r})]})}function pe({label:t,onClick:r,disabled:s,color:o,active:n}){return e.jsx("button",{onClick:r,disabled:s,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=>{s||(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 $e=h.lazy(()=>ze(()=>import("./ChatPanel-CeP3-CFA.js"),__vite__mapDeps([2,1,3,4]))),vr=[],yr=[],br=[],jr=[];function wr({run:t,ws:r,isMobile:s}){const o=t.mode==="chat",[n,i]=h.useState(280),[a,c]=h.useState(()=>{const l=localStorage.getItem("chatPanelWidth");return l?parseInt(l,10):380}),[x,p]=h.useState("primary"),[d,m]=h.useState(o?"primary":"traces"),[w,g]=h.useState(0),v=h.useRef(null),k=h.useRef(null),j=h.useRef(!1),$=A(l=>l.traces[t.id]||vr),I=A(l=>l.logs[t.id]||yr),F=A(l=>l.chatMessages[t.id]||br),D=A(l=>l.stateEvents[t.id]||jr),V=A(l=>l.breakpoints[t.id]);h.useEffect(()=>{r.setBreakpoints(t.id,V?Object.keys(V):[])},[t.id]);const q=h.useCallback(l=>{r.setBreakpoints(t.id,l)},[t.id,r]),S=h.useCallback(l=>{l.preventDefault(),j.current=!0;const f="touches"in l?l.touches[0].clientY:l.clientY,C=n,y=_=>{if(!j.current)return;const b=v.current;if(!b)return;const L="touches"in _?_.touches[0].clientY:_.clientY,T=b.clientHeight-100,W=Math.max(80,Math.min(T,C+(L-f)));i(W)},M=()=>{j.current=!1,document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",M),document.removeEventListener("touchmove",y),document.removeEventListener("touchend",M),document.body.style.cursor="",document.body.style.userSelect="",g(_=>_+1)};document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",y),document.addEventListener("mouseup",M),document.addEventListener("touchmove",y,{passive:!1}),document.addEventListener("touchend",M)},[n]),E=h.useCallback(l=>{l.preventDefault();const f="touches"in l?l.touches[0].clientX:l.clientX,C=a,y=_=>{const b=k.current;if(!b)return;const L="touches"in _?_.touches[0].clientX:_.clientX,T=b.clientWidth-300,W=Math.max(280,Math.min(T,C+(f-L)));c(W)},M=()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",M),document.removeEventListener("touchmove",y),document.removeEventListener("touchend",M),document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem("chatPanelWidth",String(a)),g(_=>_+1)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",y),document.addEventListener("mouseup",M),document.addEventListener("touchmove",y,{passive:!1}),document.addEventListener("touchend",M)},[a]),P=o?"Chat":"Events",O=o?"var(--accent)":"var(--success)",G=l=>l==="primary"?O:l==="events"?"var(--success)":"var(--accent)",H=A(l=>l.activeInterrupt[t.id]??null),J=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"&&H?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(s){const l=[{id:"traces",label:"Traces",count:$.length},{id:"primary",label:P},...o?[{id:"events",label:"Events",count:D.length}]:[],{id:"io",label:"I/O"},{id:"logs",label:"Logs",count:I.length}];return e.jsxs("div",{className:"flex flex-col h-full",children:[(t.mode==="debug"||t.status==="suspended"&&!H||V&&Object.keys(V).length>0)&&e.jsx(Re,{runId:t.id,status:t.status,ws:r,breakpointNode:t.breakpoint_node}),e.jsx("div",{className:"shrink-0",style:{height:"40vh"},children:e.jsx(ae,{entrypoint:t.entrypoint,traces:$,runId:t.id,breakpointNode:t.breakpoint_node,breakpointNextNodes:t.breakpoint_next_nodes,onBreakpointChange:q,fitViewTrigger:w})}),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:[l.map(f=>e.jsxs("button",{onClick:()=>m(f.id),className:"px-2 py-0.5 h-5 text-[11px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer",style:{color:d===f.id?G(f.id):"var(--text-muted)",background:d===f.id?`color-mix(in srgb, ${G(f.id)} 10%, transparent)`:"transparent"},children:[f.label,f.count!==void 0&&f.count>0&&e.jsx("span",{className:"ml-1 font-normal",style:{color:"var(--text-muted)"},children:f.count})]},f.id)),J]}),e.jsxs("div",{className:"flex-1 overflow-hidden",children:[d==="traces"&&e.jsx(_e,{traces:$}),d==="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($e,{messages:F,runId:t.id,runStatus:t.status,ws:r})}):e.jsx(ne,{events:D,runStatus:t.status})),d==="events"&&e.jsx(ne,{events:D,runStatus:t.status}),d==="io"&&e.jsx(Ie,{run:t}),d==="logs"&&e.jsx(Le,{logs:I})]})]})}const u=[{id:"primary",label:P},...o?[{id:"events",label:"Events",count:D.length}]:[],{id:"io",label:"I/O"},{id:"logs",label:"Logs",count:I.length}];return e.jsxs("div",{ref:k,className:"flex h-full",children:[e.jsxs("div",{ref:v,className:"flex flex-col flex-1 min-w-0",children:[(t.mode==="debug"||t.status==="suspended"&&!H||V&&Object.keys(V).length>0)&&e.jsx(Re,{runId:t.id,status:t.status,ws:r,breakpointNode:t.breakpoint_node}),e.jsx("div",{className:"shrink-0",style:{height:n},children:e.jsx(ae,{entrypoint:t.entrypoint,traces:$,runId:t.id,breakpointNode:t.breakpoint_node,breakpointNextNodes:t.breakpoint_next_nodes,onBreakpointChange:q,fitViewTrigger:w})}),e.jsx("div",{onMouseDown:S,onTouchStart:S,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(_e,{traces:$})})]}),e.jsx("div",{onMouseDown:E,onTouchStart:E,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:[u.map(l=>e.jsxs("button",{onClick:()=>p(l.id),className:"px-2 py-0.5 h-5 text-[11px] uppercase tracking-wider font-semibold rounded transition-colors cursor-pointer",style:{color:x===l.id?G(l.id):"var(--text-muted)",background:x===l.id?`color-mix(in srgb, ${G(l.id)} 10%, transparent)`:"transparent"},onMouseEnter:f=>{x!==l.id&&(f.currentTarget.style.color="var(--text-primary)")},onMouseLeave:f=>{x!==l.id&&(f.currentTarget.style.color="var(--text-muted)")},children:[l.label,l.count!==void 0&&l.count>0&&e.jsx("span",{className:"ml-1 font-normal",style:{color:"var(--text-muted)"},children:l.count})]},l.id)),J]}),e.jsxs("div",{className:"flex-1 overflow-hidden",children:[x==="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($e,{messages:F,runId:t.id,runStatus:t.status,ws:r})}):e.jsx(ne,{events:D,runStatus:t.status})),x==="events"&&e.jsx(ne,{events:D,runStatus:t.status}),x==="io"&&e.jsx(Ie,{run:t}),x==="logs"&&e.jsx(Le,{logs:I})]})]})]})}function Ie({run:t}){return e.jsxs("div",{className:"p-4 overflow-y-auto h-full space-y-4",children:[e.jsx(Pe,{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(Pe,{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 Pe({title:t,color:r,copyText:s,children:o}){const[n,i]=h.useState(!1),a=h.useCallback(()=>{s&&navigator.clipboard.writeText(s).then(()=>{i(!0),setTimeout(()=>i(!1),1500)})},[s]);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:r}}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:r},children:t}),s&&e.jsx("button",{onClick:a,className:"ml-auto text-[10px] cursor-pointer px-1.5 py-0.5 rounded transition-colors",style:{color:n?"var(--success)":"var(--text-muted)",background:"var(--bg-secondary)",border:"1px solid var(--border)"},onMouseEnter:c=>{n||(c.currentTarget.style.color="var(--text-primary)")},onMouseLeave:c=>{c.currentTarget.style.color=n?"var(--success)":"var(--text-muted)"},children:n?"Copied":"Copy"})]}),o]})}function kr(){const{reloadPending:t,setReloadPending:r,setEntrypoints:s}=A(),[o,n]=h.useState(!1);if(!t)return null;const i=async()=>{n(!0);try{await kt();const a=await He();s(a.map(c=>c.name)),r(!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:()=>r(!1),className:"text-sm cursor-pointer px-1",style:{color:"var(--text-muted)",background:"none",border:"none"},children:"✕"})]})]})}function Nr(){const t=vt(),r=Ct(),[s,o]=h.useState(!1),{runs:n,selectedRunId:i,setRuns:a,upsertRun:c,selectRun:x,setTraces:p,setLogs:d,setChatMessages:m,setEntrypoints:w,setStateEvents:g,setGraphCache:v,setActiveNode:k,removeActiveNode:j}=A(),{view:$,runId:I,setupEntrypoint:F,setupMode:D,navigate:V}=Be();h.useEffect(()=>{$==="details"&&I&&I!==i&&x(I)},[$,I,i,x]);const q=We(u=>u.init),S=Ae(u=>u.init);h.useEffect(()=>{wt().then(a).catch(console.error),He().then(u=>w(u.map(l=>l.name))).catch(console.error),q(),S()},[a,w,q,S]);const E=i?n[i]:null,P=h.useCallback((u,l)=>{c(l),p(u,l.traces),d(u,l.logs);const f=l.messages.map(C=>{const y=C.contentParts??C.content_parts??[],M=C.toolCalls??C.tool_calls??[];return{message_id:C.messageId??C.message_id,role:C.role??"assistant",content:y.filter(_=>{const b=_.mimeType??_.mime_type??"";return b.startsWith("text/")||b==="application/json"}).map(_=>{const b=_.data;return(b==null?void 0:b.inline)??""}).join(` +`).trim()??"",tool_calls:M.length>0?M.map(_=>({name:_.name??"",has_result:!!_.result})):void 0}});if(m(u,f),l.graph&&l.graph.nodes.length>0&&v(u,l.graph),l.states&&l.states.length>0&&(g(u,l.states.map(C=>({node_name:C.node_name,qualified_node_name:C.qualified_node_name,phase:C.phase,timestamp:new Date(C.timestamp).getTime(),payload:C.payload}))),l.status!=="completed"&&l.status!=="failed"))for(const C of l.states)C.phase==="started"?k(u,C.node_name,C.qualified_node_name):C.phase==="completed"&&j(u,C.node_name)},[c,p,d,m,g,v,k,j]);h.useEffect(()=>{if(!i)return;t.subscribe(i),de(i).then(l=>P(i,l)).catch(console.error);const u=setTimeout(()=>{const l=A.getState().runs[i];l&&(l.status==="pending"||l.status==="running")&&de(i).then(f=>P(i,f)).catch(console.error)},2e3);return()=>{clearTimeout(u),t.unsubscribe(i)}},[i,t,P]);const O=h.useRef(null);h.useEffect(()=>{var f,C;if(!i)return;const u=E==null?void 0:E.status,l=O.current;if(O.current=u??null,u&&(u==="completed"||u==="failed")&&l!==u){const y=A.getState(),M=((f=y.traces[i])==null?void 0:f.length)??0,_=((C=y.logs[i])==null?void 0:C.length)??0,b=(E==null?void 0:E.trace_count)??0,L=(E==null?void 0:E.log_count)??0;(MP(i,T)).catch(console.error)}},[i,E==null?void 0:E.status,P]);const G=u=>{V(`#/runs/${u}/traces`),x(u),o(!1)},H=u=>{V(`#/runs/${u}/traces`),x(u),o(!1)},J=()=>{V("#/new"),o(!1)};return e.jsxs("div",{className:"flex flex-col h-screen w-screen",children:[e.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[r&&!s&&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(_t,{runs:Object.values(n),selectedRunId:i,onSelectRun:H,onNewRun:J,isMobile:r,isOpen:s,onClose:()=>o(!1)}),e.jsx("main",{className:"flex-1 overflow-hidden bg-[var(--bg-primary)]",children:$==="new"?e.jsx(Rt,{}):$==="setup"&&F&&D?e.jsx(sr,{entrypoint:F,mode:D,ws:t,onRunCreated:G,isMobile:r}):E?e.jsx(wr,{run:E,ws:t,isMobile:r}):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(Mt,{}),e.jsx(kr,{})]})}Ze.createRoot(document.getElementById("root")).render(e.jsx(h.StrictMode,{children:e.jsx(Nr,{})}));export{A as u}; diff --git a/src/uipath/dev/server/static/assets/index-Do_6Zw-m.css b/src/uipath/dev/server/static/assets/index-Do_6Zw-m.css deleted file mode 100644 index 3f73190..0000000 --- a/src/uipath/dev/server/static/assets/index-Do_6Zw-m.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-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--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-1{top:calc(var(--spacing)*1)}.top-2{top:calc(var(--spacing)*2)}.top-4{top:calc(var(--spacing)*4)}.-right-1{right:calc(var(--spacing)*-1)}.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-1{margin-inline:calc(var(--spacing)*1)}.mx-3{margin-inline:calc(var(--spacing)*3)}.my-2{margin-block:calc(var(--spacing)*2)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2\.5{margin-top:calc(var(--spacing)*2.5)}.mt-8{margin-top:calc(var(--spacing)*8)}.mr-0\.5{margin-right:calc(var(--spacing)*.5)}.mr-1{margin-right:calc(var(--spacing)*1)}.mb-0\.5{margin-bottom:calc(var(--spacing)*.5)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-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}.table{display:table}.h-1{height:calc(var(--spacing)*1)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-\[14px\]{height:14px}.h-\[18px\]{height:18px}.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-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-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}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.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-sm{border-radius:var(--radius-sm)}.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-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-6{padding-block:calc(var(--spacing)*6)}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-px{padding-top:1px}.pr-0{padding-right:calc(var(--spacing)*0)}.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}.text-\[12px\]{font-size:12px}.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}@keyframes spin{to{transform:rotate(360deg)}} diff --git a/src/uipath/dev/server/static/favicon.ico b/src/uipath/dev/server/static/favicon.ico new file mode 100644 index 0000000..ff34f04 Binary files /dev/null and b/src/uipath/dev/server/static/favicon.ico differ diff --git a/src/uipath/dev/server/static/index.html b/src/uipath/dev/server/static/index.html index e0d71ce..a81b0be 100644 --- a/src/uipath/dev/server/static/index.html +++ b/src/uipath/dev/server/static/index.html @@ -4,12 +4,12 @@ UiPath Developer Console - - + + - +
diff --git a/uv.lock b/uv.lock index 72331fd..5e959d6 100644 --- a/uv.lock +++ b/uv.lock @@ -1400,7 +1400,7 @@ wheels = [ [[package]] name = "uipath-dev" -version = "0.0.58" +version = "0.0.59" source = { editable = "." } dependencies = [ { name = "fastapi" },