From adacca59c75e7d6150f047a290b17590965b8e3e Mon Sep 17 00:00:00 2001 From: Daniel Green Date: Thu, 23 Apr 2026 17:05:57 -0700 Subject: [PATCH 1/3] feat: enrich human gates with Markdown rendering and file links - Terminal gates: wrap prompt text in Rich Markdown for proper heading, bold, list, and link rendering in the CLI - Web dashboard: add GET /api/files/{path} endpoint to serve local files relative to the workflow root with security guards (path traversal protection, extension allowlist, 1MB size limit) - Web dashboard: add FileViewer modal component for viewing linked files with Markdown rendering support - Web dashboard: intercept relative links in gate prompts to open the FileViewer instead of navigating away; external URLs still open in new tabs - Tests: 13 file API security tests + 3 gate Markdown rendering tests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/conductor/cli/run.py | 8 +- src/conductor/gates/human.py | 5 +- .../src/components/detail/FileViewer.tsx | 188 ++++++++++++++++++ .../src/components/detail/GateDetail.tsx | 72 +++++-- src/conductor/web/server.py | 85 +++++++- .../{index-Cq5A-RoD.js => index-B5_dpnSs.js} | 163 +++++++-------- .../web/static/assets/index-BEVW8bp2.css | 1 + .../web/static/assets/index-DHEpYuxn.css | 1 - src/conductor/web/static/index.html | 28 +-- tests/test_gates/test_human.py | 65 +++++- tests/test_web/test_server.py | 126 +++++++++++- 11 files changed, 623 insertions(+), 119 deletions(-) create mode 100644 src/conductor/web/frontend/src/components/detail/FileViewer.tsx rename src/conductor/web/static/assets/{index-Cq5A-RoD.js => index-B5_dpnSs.js} (60%) create mode 100644 src/conductor/web/static/assets/index-BEVW8bp2.css delete mode 100644 src/conductor/web/static/assets/index-DHEpYuxn.css diff --git a/src/conductor/cli/run.py b/src/conductor/cli/run.py index 32ac61e..8a1ac7b 100644 --- a/src/conductor/cli/run.py +++ b/src/conductor/cli/run.py @@ -1032,7 +1032,13 @@ async def run_workflow_async( from conductor.web.server import WebDashboard bg_mode = web_bg or os.environ.get("CONDUCTOR_WEB_BG") == "1" - dashboard = WebDashboard(emitter, host="127.0.0.1", port=web_port, bg=bg_mode) + dashboard = WebDashboard( + emitter, + host="127.0.0.1", + port=web_port, + bg=bg_mode, + workflow_root=Path(workflow_path).resolve().parent, + ) try: await dashboard.start() diff --git a/src/conductor/gates/human.py b/src/conductor/gates/human.py index 01e920a..0afcf55 100644 --- a/src/conductor/gates/human.py +++ b/src/conductor/gates/human.py @@ -11,6 +11,7 @@ from typing import TYPE_CHECKING, Any from rich.console import Console +from rich.markdown import Markdown as RichMarkdown from rich.panel import Panel from rich.prompt import IntPrompt, Prompt @@ -131,11 +132,11 @@ async def _display_and_select( Returns: The selected GateOption. """ - # Display the prompt in a styled panel + # Display the prompt in a styled panel (render as Markdown for rich formatting) self.console.print() self.console.print( Panel( - prompt_text, + RichMarkdown(prompt_text), title="[bold cyan]Decision Required[/bold cyan]", border_style="cyan", ) diff --git a/src/conductor/web/frontend/src/components/detail/FileViewer.tsx b/src/conductor/web/frontend/src/components/detail/FileViewer.tsx new file mode 100644 index 0000000..43c9996 --- /dev/null +++ b/src/conductor/web/frontend/src/components/detail/FileViewer.tsx @@ -0,0 +1,188 @@ +import { useState, useEffect, useCallback } from 'react'; +import ReactMarkdown from 'react-markdown'; +import { X, FileText, Loader2, AlertTriangle } from 'lucide-react'; + +interface FileViewerProps { + /** Relative file path to fetch from the workflow root */ + filePath: string; + /** Called when the viewer should be closed */ + onClose: () => void; +} + +interface FileData { + path: string; + content: string; + size: number; + extension: string; +} + +const MARKDOWN_EXTENSIONS = new Set(['.md', '.markdown', '.mdx']); + +export function FileViewer({ filePath, onClose }: FileViewerProps) { + const [data, setData] = useState(null); + const [error, setError] = useState(null); + const [loading, setLoading] = useState(true); + + const fetchFile = useCallback(async () => { + setLoading(true); + setError(null); + try { + const encoded = filePath + .split('/') + .map((seg) => encodeURIComponent(seg)) + .join('/'); + const res = await fetch(`/api/files/${encoded}`); + if (!res.ok) { + const body = await res.json().catch(() => ({})); + setError(body.error || `HTTP ${res.status}`); + return; + } + const json: FileData = await res.json(); + setData(json); + } catch (e) { + setError(e instanceof Error ? e.message : 'Failed to load file'); + } finally { + setLoading(false); + } + }, [filePath]); + + useEffect(() => { + fetchFile(); + }, [fetchFile]); + + // Close on Escape + useEffect(() => { + const handleKey = (e: KeyboardEvent) => { + if (e.key === 'Escape') onClose(); + }; + window.addEventListener('keydown', handleKey); + return () => window.removeEventListener('keydown', handleKey); + }, [onClose]); + + const isMarkdown = data ? MARKDOWN_EXTENSIONS.has(data.extension) : false; + + return ( +
+
+ {/* Header */} +
+ + + {filePath} + + {data && ( + + {formatSize(data.size)} + + )} + +
+ + {/* Body */} +
+ {loading && ( +
+ +
+ )} + + {error && ( +
+ + {error} +
+ )} + + {data && !error && ( + isMarkdown ? ( +
+ +
+ ) : ( +
+                {data.content}
+              
+ ) + )} +
+
+
+ ); +} + +function MarkdownContent({ content }: { content: string }) { + return ( +

{children}

, + h2: ({ children }) =>

{children}

, + h3: ({ children }) =>

{children}

, + p: ({ children }) =>

{children}

, + ul: ({ children }) =>
    {children}
, + ol: ({ children }) =>
    {children}
, + li: ({ children }) =>
  • {children}
  • , + code: ({ children, className }) => { + const isBlock = className?.includes('language-'); + if (isBlock) { + return ( + + {children} + + ); + } + return ( + + {children} + + ); + }, + pre: ({ children }) => ( +
    +            {children}
    +          
    + ), + strong: ({ children }) => {children}, + em: ({ children }) => {children}, + a: ({ href, children }) => ( + + {children} + + ), + blockquote: ({ children }) => ( +
    {children}
    + ), + hr: () =>
    , + table: ({ children }) => ( +
    + {children}
    +
    + ), + th: ({ children }) => ( + {children} + ), + td: ({ children }) => ( + {children} + ), + }} + > + {content} +
    + ); +} + +function formatSize(bytes: number): string { + if (bytes < 1024) return `${bytes} B`; + if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`; + return `${(bytes / (1024 * 1024)).toFixed(1)} MB`; +} diff --git a/src/conductor/web/frontend/src/components/detail/GateDetail.tsx b/src/conductor/web/frontend/src/components/detail/GateDetail.tsx index 7544a09..f366c33 100644 --- a/src/conductor/web/frontend/src/components/detail/GateDetail.tsx +++ b/src/conductor/web/frontend/src/components/detail/GateDetail.tsx @@ -1,7 +1,8 @@ import { useState, useEffect } from 'react'; import ReactMarkdown from 'react-markdown'; -import { Check, Loader2, Send } from 'lucide-react'; +import { Check, Loader2, Send, FileText } from 'lucide-react'; import { MetadataGrid } from './MetadataGrid'; +import { FileViewer } from './FileViewer'; import type { NodeData } from '@/stores/workflow-store'; import { useWorkflowStore } from '@/stores/workflow-store'; @@ -17,6 +18,7 @@ export function GateDetail({ node }: GateDetailProps) { const [promptForValue, setPromptForValue] = useState(''); const [pendingPromptFor, setPendingPromptFor] = useState(null); const [isSending, setIsSending] = useState(false); + const [viewingFile, setViewingFile] = useState(null); const isWaiting = node.status === 'waiting'; const isCompleted = node.status === 'completed'; @@ -83,7 +85,7 @@ export function GateDetail({ node }: GateDetailProps) { {/* Prompt callout */} {node.prompt && (
    - +
    )} @@ -233,7 +235,7 @@ export function GateDetail({ node }: GateDetailProps) { {/* Prompt (dimmed, for context) */} {node.prompt && (
    - +
    )} @@ -308,17 +310,41 @@ export function GateDetail({ node }: GateDetailProps) { {node.prompt && (
    - +
    )} )} + + {/* File viewer modal */} + {viewingFile && ( + setViewingFile(null)} /> + )} ); } +/** Returns true if the href looks like a relative file path (not a URL, anchor, or scheme). */ +function isRelativeFileLink(href: string | undefined): href is string { + if (!href) return false; + // Reject URLs with schemes, protocol-relative, anchor-only, absolute paths + if (/^[a-z][a-z0-9+.-]*:/i.test(href)) return false; // http:, mailto:, javascript:, file:, etc. + if (href.startsWith('//')) return false; // protocol-relative + if (href.startsWith('#')) return false; // anchor-only + if (href.startsWith('/') || href.startsWith('\\')) return false; // absolute + return true; +} + /** Renders prompt text as markdown with dashboard-consistent styling. */ -function PromptMarkdown({ text, muted }: { text: string; muted: boolean }) { +function PromptMarkdown({ + text, + muted, + onFileClick, +}: { + text: string; + muted: boolean; + onFileClick?: (path: string) => void; +}) { const textColor = muted ? 'text-[var(--text-muted)]' : 'text-[var(--text)]'; return ( @@ -372,17 +398,31 @@ function PromptMarkdown({ text, muted }: { text: string; muted: boolean }) { {children} ), em: ({ children }) => {children}, - // Links - a: ({ href, children }) => ( - - {children} - - ), + // Links — intercept relative file links + a: ({ href, children }) => { + if (onFileClick && isRelativeFileLink(href)) { + return ( + + ); + } + return ( + + {children} + + ); + }, // Blockquote blockquote: ({ children }) => (
    diff --git a/src/conductor/web/server.py b/src/conductor/web/server.py index 892166a..8a18816 100644 --- a/src/conductor/web/server.py +++ b/src/conductor/web/server.py @@ -27,7 +27,7 @@ from pathlib import Path from typing import Any -from fastapi import FastAPI, WebSocket, WebSocketDisconnect +from fastapi import FastAPI, Request, WebSocket, WebSocketDisconnect from fastapi.responses import FileResponse, JSONResponse from fastapi.staticfiles import StaticFiles @@ -40,6 +40,14 @@ # Grace period (seconds) before auto-shutdown in --web-bg mode _BG_GRACE_SECONDS = 30 +# File API: allowed text extensions and max file size +_FILE_ALLOWED_EXTENSIONS = frozenset({ + ".md", ".txt", ".yaml", ".yml", ".json", ".log", + ".py", ".ts", ".js", ".tsx", ".jsx", ".css", ".html", + ".toml", ".cfg", ".ini", ".csv", ".xml", ".sh", ".bat", ".ps1", +}) +_FILE_MAX_SIZE = 1 * 1024 * 1024 # 1 MB + class WebDashboard: """Real-time web dashboard for workflow visualization. @@ -63,11 +71,13 @@ def __init__( host: str = "127.0.0.1", port: int = 0, bg: bool = False, + workflow_root: Path | None = None, ) -> None: self._emitter = emitter self._host = host self._port = port self._bg = bg + self._workflow_root = workflow_root.resolve() if workflow_root else None # State self._event_history: list[dict[str, Any]] = [] @@ -194,6 +204,79 @@ async def resume_agent() -> JSONResponse: self._resume_event.set() return JSONResponse({"status": "resuming"}) + @app.get("/api/files/{file_path:path}") + async def get_file(file_path: str) -> JSONResponse: + """Serve a local file relative to the workflow root directory. + + Used by the web dashboard to render files linked in human gate + Markdown prompts (e.g. ``[plan](./plans/design.md)``). + + Security: rejects absolute paths, path traversal, disallowed + extensions, and files larger than 1 MB. + """ + if self._workflow_root is None: + return JSONResponse( + {"error": "No workflow root configured"}, + status_code=404, + ) + + # Reject absolute, drive-qualified, UNC, and scheme-prefixed paths + if ( + file_path.startswith(("/", "\\")) + or "://" in file_path + or (len(file_path) >= 2 and file_path[1] == ":") + ): + return JSONResponse( + {"error": "Absolute paths are not allowed"}, + status_code=403, + ) + + try: + target = (self._workflow_root / file_path).resolve(strict=True) + except (OSError, ValueError): + return JSONResponse({"error": "File not found"}, status_code=404) + + # Containment check — target must be inside workflow root + try: + target.relative_to(self._workflow_root) + except ValueError: + return JSONResponse( + {"error": "Access denied — path outside workflow directory"}, + status_code=403, + ) + + # Extension allowlist + if target.suffix.lower() not in _FILE_ALLOWED_EXTENSIONS: + return JSONResponse( + {"error": f"File type '{target.suffix}' is not supported"}, + status_code=403, + ) + + # Size check + file_size = target.stat().st_size + if file_size > _FILE_MAX_SIZE: + return JSONResponse( + {"error": f"File too large ({file_size:,} bytes, max {_FILE_MAX_SIZE:,})"}, + status_code=413, + ) + + # Read as text + try: + content = target.read_text(encoding="utf-8") + except (UnicodeDecodeError, OSError) as e: + return JSONResponse( + {"error": f"Cannot read file: {e}"}, + status_code=422, + ) + + rel_path = str(target.relative_to(self._workflow_root)).replace("\\", "/") + return JSONResponse({ + "path": rel_path, + "content": content, + "size": file_size, + "extension": target.suffix.lower(), + }) + @app.websocket("/ws") async def websocket_endpoint(ws: WebSocket) -> None: await ws.accept() diff --git a/src/conductor/web/static/assets/index-Cq5A-RoD.js b/src/conductor/web/static/assets/index-B5_dpnSs.js similarity index 60% rename from src/conductor/web/static/assets/index-Cq5A-RoD.js rename to src/conductor/web/static/assets/index-B5_dpnSs.js index e332955..7175278 100644 --- a/src/conductor/web/static/assets/index-Cq5A-RoD.js +++ b/src/conductor/web/static/assets/index-B5_dpnSs.js @@ -1,4 +1,4 @@ -var T2=Object.defineProperty;var z2=(e,n,i)=>n in e?T2(e,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[n]=i;var Nt=(e,n,i)=>z2(e,typeof n!="symbol"?n+"":n,i);function A2(e,n){for(var i=0;il[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))l(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const u of s.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&l(u)}).observe(document,{childList:!0,subtree:!0});function i(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function l(o){if(o.ep)return;o.ep=!0;const s=i(o);fetch(o.href,s)}})();function Lo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Hd={exports:{}},to={};/** +var M2=Object.defineProperty;var j2=(e,n,i)=>n in e?M2(e,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[n]=i;var Nt=(e,n,i)=>j2(e,typeof n!="symbol"?n+"":n,i);function O2(e,n){for(var i=0;il[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))l(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const u of s.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&l(u)}).observe(document,{childList:!0,subtree:!0});function i(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function l(o){if(o.ep)return;o.ep=!0;const s=i(o);fetch(o.href,s)}})();function Ho(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Hd={exports:{}},ro={};/** * @license React * react-jsx-runtime.production.js * @@ -6,7 +6,7 @@ var T2=Object.defineProperty;var z2=(e,n,i)=>n in e?T2(e,n,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var cx;function M2(){if(cx)return to;cx=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function i(l,o,s){var u=null;if(s!==void 0&&(u=""+s),o.key!==void 0&&(u=""+o.key),"key"in o){s={};for(var f in o)f!=="key"&&(s[f]=o[f])}else s=o;return o=s.ref,{$$typeof:e,type:l,key:u,ref:o!==void 0?o:null,props:s}}return to.Fragment=n,to.jsx=i,to.jsxs=i,to}var fx;function j2(){return fx||(fx=1,Hd.exports=M2()),Hd.exports}var b=j2(),Bd={exports:{}},ze={};/** + */var cx;function R2(){if(cx)return ro;cx=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function i(l,o,s){var u=null;if(s!==void 0&&(u=""+s),o.key!==void 0&&(u=""+o.key),"key"in o){s={};for(var f in o)f!=="key"&&(s[f]=o[f])}else s=o;return o=s.ref,{$$typeof:e,type:l,key:u,ref:o!==void 0?o:null,props:s}}return ro.Fragment=n,ro.jsx=i,ro.jsxs=i,ro}var fx;function D2(){return fx||(fx=1,Hd.exports=R2()),Hd.exports}var b=D2(),Bd={exports:{}},ze={};/** * @license React * react.production.js * @@ -14,7 +14,7 @@ var T2=Object.defineProperty;var z2=(e,n,i)=>n in e?T2(e,n,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var dx;function O2(){if(dx)return ze;dx=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),y=Symbol.iterator;function v(U){return U===null||typeof U!="object"?null:(U=y&&U[y]||U["@@iterator"],typeof U=="function"?U:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,S={};function _(U,P,N){this.props=U,this.context=P,this.refs=S,this.updater=N||w}_.prototype.isReactComponent={},_.prototype.setState=function(U,P){if(typeof U!="object"&&typeof U!="function"&&U!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,U,P,"setState")},_.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function z(){}z.prototype=_.prototype;function E(U,P,N){this.props=U,this.context=P,this.refs=S,this.updater=N||w}var A=E.prototype=new z;A.constructor=E,k(A,_.prototype),A.isPureReactComponent=!0;var B=Array.isArray;function T(){}var q={H:null,A:null,T:null,S:null},M=Object.prototype.hasOwnProperty;function D(U,P,N){var Y=N.ref;return{$$typeof:e,type:U,key:P,ref:Y!==void 0?Y:null,props:N}}function X(U,P){return D(U.type,P,U.props)}function H(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function I(U){var P={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(N){return P[N]})}var ee=/\/+/g;function L(U,P){return typeof U=="object"&&U!==null&&U.key!=null?I(""+U.key):P.toString(36)}function G(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(T,T):(U.status="pending",U.then(function(P){U.status==="pending"&&(U.status="fulfilled",U.value=P)},function(P){U.status==="pending"&&(U.status="rejected",U.reason=P)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function R(U,P,N,Y,F){var K=typeof U;(K==="undefined"||K==="boolean")&&(U=null);var ne=!1;if(U===null)ne=!0;else switch(K){case"bigint":case"string":case"number":ne=!0;break;case"object":switch(U.$$typeof){case e:case n:ne=!0;break;case m:return ne=U._init,R(ne(U._payload),P,N,Y,F)}}if(ne)return F=F(U),ne=Y===""?"."+L(U,0):Y,B(F)?(N="",ne!=null&&(N=ne.replace(ee,"$&/")+"/"),R(F,P,N,"",function(ye){return ye})):F!=null&&(H(F)&&(F=X(F,N+(F.key==null||U&&U.key===F.key?"":(""+F.key).replace(ee,"$&/")+"/")+ne)),P.push(F)),1;ne=0;var re=Y===""?".":Y+":";if(B(U))for(var se=0;sen in e?T2(e,n,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var px;function D2(){return px||(px=1,(function(e){function n(R,$){var Z=R.length;R.push($);e:for(;0>>1,j=R[J];if(0>>1;Jo(N,Z))Yo(F,N)?(R[J]=F,R[Y]=Z,J=Y):(R[J]=N,R[P]=Z,J=P);else if(Yo(F,Z))R[J]=F,R[Y]=Z,J=Y;else break e}}return $}function o(R,$){var Z=R.sortIndex-$.sortIndex;return Z!==0?Z:R.id-$.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var d=[],h=[],m=1,p=null,y=3,v=!1,w=!1,k=!1,S=!1,_=typeof setTimeout=="function"?setTimeout:null,z=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function A(R){for(var $=i(h);$!==null;){if($.callback===null)l(h);else if($.startTime<=R)l(h),$.sortIndex=$.expirationTime,n(d,$);else break;$=i(h)}}function B(R){if(k=!1,A(R),!w)if(i(d)!==null)w=!0,T||(T=!0,I());else{var $=i(h);$!==null&&G(B,$.startTime-R)}}var T=!1,q=-1,M=5,D=-1;function X(){return S?!0:!(e.unstable_now()-DR&&X());){var J=p.callback;if(typeof J=="function"){p.callback=null,y=p.priorityLevel;var j=J(p.expirationTime<=R);if(R=e.unstable_now(),typeof j=="function"){p.callback=j,A(R),$=!0;break t}p===i(d)&&l(d),A(R)}else l(d);p=i(d)}if(p!==null)$=!0;else{var U=i(h);U!==null&&G(B,U.startTime-R),$=!1}}break e}finally{p=null,y=Z,v=!1}$=void 0}}finally{$?I():T=!1}}}var I;if(typeof E=="function")I=function(){E(H)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,L=ee.port2;ee.port1.onmessage=H,I=function(){L.postMessage(null)}}else I=function(){_(H,0)};function G(R,$){q=_(function(){R(e.unstable_now())},$)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(R){R.callback=null},e.unstable_forceFrameRate=function(R){0>R||125J?(R.sortIndex=Z,n(h,R),i(d)===null&&R===i(h)&&(k?(z(q),q=-1):k=!0,G(B,Z-J))):(R.sortIndex=j,n(d,R),w||v||(w=!0,T||(T=!0,I()))),R},e.unstable_shouldYield=X,e.unstable_wrapCallback=function(R){var $=y;return function(){var Z=y;y=$;try{return R.apply(this,arguments)}finally{y=Z}}}})(Id)),Id}var mx;function L2(){return mx||(mx=1,Ud.exports=D2()),Ud.exports}var Vd={exports:{}},Yt={};/** + */var px;function B2(){return px||(px=1,(function(e){function n(D,$){var Z=D.length;D.push($);e:for(;0>>1,O=D[J];if(0>>1;Jo(N,Z))Yo(P,N)?(D[J]=P,D[Y]=Z,J=Y):(D[J]=N,D[F]=Z,J=F);else if(Yo(P,Z))D[J]=P,D[Y]=Z,J=Y;else break e}}return $}function o(D,$){var Z=D.sortIndex-$.sortIndex;return Z!==0?Z:D.id-$.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var d=[],h=[],m=1,p=null,y=3,v=!1,w=!1,E=!1,_=!1,S=typeof setTimeout=="function"?setTimeout:null,z=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function A(D){for(var $=i(h);$!==null;){if($.callback===null)l(h);else if($.startTime<=D)l(h),$.sortIndex=$.expirationTime,n(d,$);else break;$=i(h)}}function M(D){if(E=!1,A(D),!w)if(i(d)!==null)w=!0,T||(T=!0,I());else{var $=i(h);$!==null&&G(M,$.startTime-D)}}var T=!1,q=-1,j=5,L=-1;function X(){return _?!0:!(e.unstable_now()-LD&&X());){var J=p.callback;if(typeof J=="function"){p.callback=null,y=p.priorityLevel;var O=J(p.expirationTime<=D);if(D=e.unstable_now(),typeof O=="function"){p.callback=O,A(D),$=!0;break t}p===i(d)&&l(d),A(D)}else l(d);p=i(d)}if(p!==null)$=!0;else{var U=i(h);U!==null&&G(M,U.startTime-D),$=!1}}break e}finally{p=null,y=Z,v=!1}$=void 0}}finally{$?I():T=!1}}}var I;if(typeof k=="function")I=function(){k(B)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,H=ee.port2;ee.port1.onmessage=B,I=function(){H.postMessage(null)}}else I=function(){S(B,0)};function G(D,$){q=S(function(){D(e.unstable_now())},$)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(D){D.callback=null},e.unstable_forceFrameRate=function(D){0>D||125J?(D.sortIndex=Z,n(h,D),i(d)===null&&D===i(h)&&(E?(z(q),q=-1):E=!0,G(M,Z-J))):(D.sortIndex=O,n(d,D),w||v||(w=!0,T||(T=!0,I()))),D},e.unstable_shouldYield=X,e.unstable_wrapCallback=function(D){var $=y;return function(){var Z=y;y=$;try{return D.apply(this,arguments)}finally{y=Z}}}})(Id)),Id}var mx;function q2(){return mx||(mx=1,Ud.exports=B2()),Ud.exports}var Vd={exports:{}},Yt={};/** * @license React * react-dom.production.js * @@ -30,7 +30,7 @@ var T2=Object.defineProperty;var z2=(e,n,i)=>n in e?T2(e,n,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var gx;function H2(){if(gx)return Yt;gx=1;var e=Ho();function n(d){var h="https://react.dev/errors/"+d;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Vd.exports=H2(),Vd.exports}/** + */var gx;function U2(){if(gx)return Yt;gx=1;var e=Bo();function n(d){var h="https://react.dev/errors/"+d;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Vd.exports=U2(),Vd.exports}/** * @license React * react-dom-client.production.js * @@ -38,214 +38,219 @@ var T2=Object.defineProperty;var z2=(e,n,i)=>n in e?T2(e,n,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var xx;function B2(){if(xx)return no;xx=1;var e=L2(),n=Ho(),i=Eb();function l(t){var r="https://react.dev/errors/"+t;if(1j||(t.current=J[j],J[j]=null,j--)}function N(t,r){j++,J[j]=t.current,t.current=r}var Y=U(null),F=U(null),K=U(null),ne=U(null);function re(t,r){switch(N(K,r),N(F,t),N(Y,null),r.nodeType){case 9:case 11:t=(t=r.documentElement)&&(t=t.namespaceURI)?Oy(t):0;break;default:if(t=r.tagName,r=r.namespaceURI)r=Oy(r),t=Ry(r,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}P(Y),N(Y,t)}function se(){P(Y),P(F),P(K)}function ye(t){t.memoizedState!==null&&N(ne,t);var r=Y.current,a=Ry(r,t.type);r!==a&&(N(F,t),N(Y,a))}function ve(t){F.current===t&&(P(Y),P(F)),ne.current===t&&(P(ne),Ka._currentValue=Z)}var xe,pe;function _e(t){if(xe===void 0)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);xe=r&&r[1]||"",pe=-1O||(t.current=J[O],J[O]=null,O--)}function N(t,r){O++,J[O]=t.current,t.current=r}var Y=U(null),P=U(null),K=U(null),ne=U(null);function re(t,r){switch(N(K,r),N(P,t),N(Y,null),r.nodeType){case 9:case 11:t=(t=r.documentElement)&&(t=t.namespaceURI)?Oy(t):0;break;default:if(t=r.tagName,r=r.namespaceURI)r=Oy(r),t=Ry(r,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}F(Y),N(Y,t)}function se(){F(Y),F(P),F(K)}function ye(t){t.memoizedState!==null&&N(ne,t);var r=Y.current,a=Ry(r,t.type);r!==a&&(N(P,t),N(Y,a))}function ve(t){P.current===t&&(F(Y),F(P)),ne.current===t&&(F(ne),Wa._currentValue=Z)}var xe,pe;function _e(t){if(xe===void 0)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);xe=r&&r[1]||"",pe=-1)":-1g||Q[c]!==le[g]){var ce=` `+Q[c].replace(" at new "," at ");return t.displayName&&ce.includes("")&&(ce=ce.replace("",t.displayName)),ce}while(1<=c&&0<=g);break}}}finally{Me=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?_e(a):""}function st(t,r){switch(t.tag){case 26:case 27:case 5:return _e(t.type);case 16:return _e("Lazy");case 13:return t.child!==r&&r!==null?_e("Suspense Fallback"):_e("Suspense");case 19:return _e("SuspenseList");case 0:case 15:return Ce(t.type,!1);case 11:return Ce(t.type.render,!1);case 1:return Ce(t.type,!0);case 31:return _e("Activity");default:return""}}function We(t){try{var r="",a=null;do r+=st(t,a),a=t,t=t.return;while(t);return r}catch(c){return` Error generating stack: `+c.message+` -`+c.stack}}var zt=Object.prototype.hasOwnProperty,Ut=e.unstable_scheduleCallback,Rt=e.unstable_cancelCallback,wn=e.unstable_shouldYield,Mn=e.unstable_requestPaint,At=e.unstable_now,Mr=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,ge=e.unstable_UserBlockingPriority,Ne=e.unstable_NormalPriority,De=e.unstable_LowPriority,Ve=e.unstable_IdlePriority,$t=e.log,jn=e.unstable_setDisableYieldValue,Dt=null,yt=null;function It(t){if(typeof $t=="function"&&jn(t),yt&&typeof yt.setStrictMode=="function")try{yt.setStrictMode(Dt,t)}catch{}}var Ze=Math.clz32?Math.clz32:Ec,Gn=Math.log,sn=Math.LN2;function Ec(t){return t>>>=0,t===0?32:31-(Gn(t)/sn|0)|0}var Zi=256,Ki=262144,Ji=4194304;function ir(t){var r=t&42;if(r!==0)return r;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Wi(t,r,a){var c=t.pendingLanes;if(c===0)return 0;var g=0,x=t.suspendedLanes,C=t.pingedLanes;t=t.warmLanes;var O=c&134217727;return O!==0?(c=O&~x,c!==0?g=ir(c):(C&=O,C!==0?g=ir(C):a||(a=O&~t,a!==0&&(g=ir(a))))):(O=c&~x,O!==0?g=ir(O):C!==0?g=ir(C):a||(a=c&~t,a!==0&&(g=ir(a)))),g===0?0:r!==0&&r!==g&&(r&x)===0&&(x=g&-g,a=r&-r,x>=a||x===32&&(a&4194048)!==0)?r:g}function hi(t,r){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&r)===0}function Nc(t,r){switch(t){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Qo(){var t=Ji;return Ji<<=1,(Ji&62914560)===0&&(Ji=4194304),t}function sa(t){for(var r=[],a=0;31>a;a++)r.push(t);return r}function pi(t,r){t.pendingLanes|=r,r!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function kc(t,r,a,c,g,x){var C=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var O=t.entanglements,Q=t.expirationTimes,le=t.hiddenUpdates;for(a=C&~a;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Mc=/[\n"\\]/g;function Ft(t){return t.replace(Mc,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function yi(t,r,a,c,g,x,C,O){t.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?t.type=C:t.removeAttribute("type"),r!=null?C==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+Pt(r)):t.value!==""+Pt(r)&&(t.value=""+Pt(r)):C!=="submit"&&C!=="reset"||t.removeAttribute("value"),r!=null?ha(t,C,Pt(r)):a!=null?ha(t,C,Pt(a)):c!=null&&t.removeAttribute("value"),g==null&&x!=null&&(t.defaultChecked=!!x),g!=null&&(t.checked=g&&typeof g!="function"&&typeof g!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?t.name=""+Pt(O):t.removeAttribute("name")}function ss(t,r,a,c,g,x,C,O){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(t.type=x),r!=null||a!=null){if(!(x!=="submit"&&x!=="reset"||r!=null)){Hr(t);return}a=a!=null?""+Pt(a):"",r=r!=null?""+Pt(r):a,O||r===t.value||(t.value=r),t.defaultValue=r}c=c??g,c=typeof c!="function"&&typeof c!="symbol"&&!!c,t.checked=O?t.checked:!!c,t.defaultChecked=!!c,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(t.name=C),Hr(t)}function ha(t,r,a){r==="number"&&gi(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function or(t,r,a,c){if(t=t.options,r){r={};for(var g=0;g"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Lc=!1;if(ur)try{var ma={};Object.defineProperty(ma,"passive",{get:function(){Lc=!0}}),window.addEventListener("test",ma,ma),window.removeEventListener("test",ma,ma)}catch{Lc=!1}var Br=null,Hc=null,cs=null;function Rm(){if(cs)return cs;var t,r=Hc,a=r.length,c,g="value"in Br?Br.value:Br.textContent,x=g.length;for(t=0;t=xa),Um=" ",Im=!1;function Vm(t,r){switch(t){case"keyup":return Z_.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ym(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var al=!1;function J_(t,r){switch(t){case"compositionend":return Ym(r);case"keypress":return r.which!==32?null:(Im=!0,Um);case"textInput":return t=r.data,t===Um&&Im?null:t;default:return null}}function W_(t,r){if(al)return t==="compositionend"||!Vc&&Vm(t,r)?(t=Rm(),cs=Hc=Br=null,al=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1=r)return{node:a,offset:r-t};t=c}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Km(a)}}function Wm(t,r){return t&&r?t===r?!0:t&&t.nodeType===3?!1:r&&r.nodeType===3?Wm(t,r.parentNode):"contains"in t?t.contains(r):t.compareDocumentPosition?!!(t.compareDocumentPosition(r)&16):!1:!1}function eg(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var r=gi(t.document);r instanceof t.HTMLIFrameElement;){try{var a=typeof r.contentWindow.location.href=="string"}catch{a=!1}if(a)t=r.contentWindow;else break;r=gi(t.document)}return r}function $c(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r&&(r==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||r==="textarea"||t.contentEditable==="true")}var oE=ur&&"documentMode"in document&&11>=document.documentMode,ol=null,Xc=null,Sa=null,Pc=!1;function tg(t,r,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Pc||ol==null||ol!==gi(c)||(c=ol,"selectionStart"in c&&$c(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Sa&&wa(Sa,c)||(Sa=c,c=ru(Xc,"onSelect"),0>=C,g-=C,Xn=1<<32-Ze(r)+g|a<je?(qe=Se,Se=null):qe=Se.sibling;var $e=ae(te,Se,ie[je],fe);if($e===null){Se===null&&(Se=qe);break}t&&Se&&$e.alternate===null&&r(te,Se),W=x($e,W,je),Ge===null?Ee=$e:Ge.sibling=$e,Ge=$e,Se=qe}if(je===ie.length)return a(te,Se),Ue&&fr(te,je),Ee;if(Se===null){for(;jeje?(qe=Se,Se=null):qe=Se.sibling;var ai=ae(te,Se,$e.value,fe);if(ai===null){Se===null&&(Se=qe);break}t&&Se&&ai.alternate===null&&r(te,Se),W=x(ai,W,je),Ge===null?Ee=ai:Ge.sibling=ai,Ge=ai,Se=qe}if($e.done)return a(te,Se),Ue&&fr(te,je),Ee;if(Se===null){for(;!$e.done;je++,$e=ie.next())$e=de(te,$e.value,fe),$e!==null&&(W=x($e,W,je),Ge===null?Ee=$e:Ge.sibling=$e,Ge=$e);return Ue&&fr(te,je),Ee}for(Se=c(Se);!$e.done;je++,$e=ie.next())$e=oe(Se,te,je,$e.value,fe),$e!==null&&(t&&$e.alternate!==null&&Se.delete($e.key===null?je:$e.key),W=x($e,W,je),Ge===null?Ee=$e:Ge.sibling=$e,Ge=$e);return t&&Se.forEach(function(C2){return r(te,C2)}),Ue&&fr(te,je),Ee}function nt(te,W,ie,fe){if(typeof ie=="object"&&ie!==null&&ie.type===k&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case v:e:{for(var Ee=ie.key;W!==null;){if(W.key===Ee){if(Ee=ie.type,Ee===k){if(W.tag===7){a(te,W.sibling),fe=g(W,ie.props.children),fe.return=te,te=fe;break e}}else if(W.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===M&&Ci(Ee)===W.type){a(te,W.sibling),fe=g(W,ie.props),Ta(fe,ie),fe.return=te,te=fe;break e}a(te,W);break}else r(te,W);W=W.sibling}ie.type===k?(fe=Si(ie.props.children,te.mode,fe,ie.key),fe.return=te,te=fe):(fe=bs(ie.type,ie.key,ie.props,null,te.mode,fe),Ta(fe,ie),fe.return=te,te=fe)}return C(te);case w:e:{for(Ee=ie.key;W!==null;){if(W.key===Ee)if(W.tag===4&&W.stateNode.containerInfo===ie.containerInfo&&W.stateNode.implementation===ie.implementation){a(te,W.sibling),fe=g(W,ie.children||[]),fe.return=te,te=fe;break e}else{a(te,W);break}else r(te,W);W=W.sibling}fe=ef(ie,te.mode,fe),fe.return=te,te=fe}return C(te);case M:return ie=Ci(ie),nt(te,W,ie,fe)}if(G(ie))return be(te,W,ie,fe);if(I(ie)){if(Ee=I(ie),typeof Ee!="function")throw Error(l(150));return ie=Ee.call(ie),ke(te,W,ie,fe)}if(typeof ie.then=="function")return nt(te,W,Cs(ie),fe);if(ie.$$typeof===E)return nt(te,W,_s(te,ie),fe);Ts(te,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,W!==null&&W.tag===6?(a(te,W.sibling),fe=g(W,ie),fe.return=te,te=fe):(a(te,W),fe=Wc(ie,te.mode,fe),fe.return=te,te=fe),C(te)):a(te,W)}return function(te,W,ie,fe){try{Ca=0;var Ee=nt(te,W,ie,fe);return xl=null,Ee}catch(Se){if(Se===yl||Se===Ns)throw Se;var Ge=cn(29,Se,null,te.mode);return Ge.lanes=fe,Ge.return=te,Ge}finally{}}}var zi=Eg(!0),Ng=Eg(!1),Yr=!1;function hf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function pf(t,r){t=t.updateQueue,r.updateQueue===t&&(r.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Gr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function $r(t,r,a){var c=t.updateQueue;if(c===null)return null;if(c=c.shared,(Fe&2)!==0){var g=c.pending;return g===null?r.next=r:(r.next=g.next,g.next=r),c.pending=r,r=vs(t),sg(t,null,a),r}return xs(t,c,r,a),vs(t)}function za(t,r,a){if(r=r.updateQueue,r!==null&&(r=r.shared,(a&4194048)!==0)){var c=r.lanes;c&=t.pendingLanes,a|=c,r.lanes=a,Ko(t,a)}}function mf(t,r){var a=t.updateQueue,c=t.alternate;if(c!==null&&(c=c.updateQueue,a===c)){var g=null,x=null;if(a=a.firstBaseUpdate,a!==null){do{var C={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};x===null?g=x=C:x=x.next=C,a=a.next}while(a!==null);x===null?g=x=r:x=x.next=r}else g=x=r;a={baseState:c.baseState,firstBaseUpdate:g,lastBaseUpdate:x,shared:c.shared,callbacks:c.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=r:t.next=r,a.lastBaseUpdate=r}var gf=!1;function Aa(){if(gf){var t=gl;if(t!==null)throw t}}function Ma(t,r,a,c){gf=!1;var g=t.updateQueue;Yr=!1;var x=g.firstBaseUpdate,C=g.lastBaseUpdate,O=g.shared.pending;if(O!==null){g.shared.pending=null;var Q=O,le=Q.next;Q.next=null,C===null?x=le:C.next=le,C=Q;var ce=t.alternate;ce!==null&&(ce=ce.updateQueue,O=ce.lastBaseUpdate,O!==C&&(O===null?ce.firstBaseUpdate=le:O.next=le,ce.lastBaseUpdate=Q))}if(x!==null){var de=g.baseState;C=0,ce=le=Q=null,O=x;do{var ae=O.lane&-536870913,oe=ae!==O.lane;if(oe?(Be&ae)===ae:(c&ae)===ae){ae!==0&&ae===ml&&(gf=!0),ce!==null&&(ce=ce.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var be=t,ke=O;ae=r;var nt=a;switch(ke.tag){case 1:if(be=ke.payload,typeof be=="function"){de=be.call(nt,de,ae);break e}de=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=ke.payload,ae=typeof be=="function"?be.call(nt,de,ae):be,ae==null)break e;de=p({},de,ae);break e;case 2:Yr=!0}}ae=O.callback,ae!==null&&(t.flags|=64,oe&&(t.flags|=8192),oe=g.callbacks,oe===null?g.callbacks=[ae]:oe.push(ae))}else oe={lane:ae,tag:O.tag,payload:O.payload,callback:O.callback,next:null},ce===null?(le=ce=oe,Q=de):ce=ce.next=oe,C|=ae;if(O=O.next,O===null){if(O=g.shared.pending,O===null)break;oe=O,O=oe.next,oe.next=null,g.lastBaseUpdate=oe,g.shared.pending=null}}while(!0);ce===null&&(Q=de),g.baseState=Q,g.firstBaseUpdate=le,g.lastBaseUpdate=ce,x===null&&(g.shared.lanes=0),Zr|=C,t.lanes=C,t.memoizedState=de}}function kg(t,r){if(typeof t!="function")throw Error(l(191,t));t.call(r)}function Cg(t,r){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;tx?x:8;var C=R.T,O={};R.T=O,Df(t,!1,r,a);try{var Q=g(),le=R.S;if(le!==null&&le(O,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var ce=gE(Q,c);Ra(t,r,ce,mn(t))}else Ra(t,r,c,mn(t))}catch(de){Ra(t,r,{then:function(){},status:"rejected",reason:de},mn())}finally{$.p=x,C!==null&&O.types!==null&&(C.types=O.types),R.T=C}}function SE(){}function Of(t,r,a,c){if(t.tag!==5)throw Error(l(476));var g=l0(t).queue;i0(t,g,r,Z,a===null?SE:function(){return a0(t),a(c)})}function l0(t){var r=t.memoizedState;if(r!==null)return r;r={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:Z},next:null};var a={};return r.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:a},next:null},t.memoizedState=r,t=t.alternate,t!==null&&(t.memoizedState=r),r}function a0(t){var r=l0(t);r.next===null&&(r=t.alternate.memoizedState),Ra(t,r.next.queue,{},mn())}function Rf(){return Ht(Ka)}function o0(){return vt().memoizedState}function s0(){return vt().memoizedState}function _E(t){for(var r=t.return;r!==null;){switch(r.tag){case 24:case 3:var a=mn();t=Gr(a);var c=$r(r,t,a);c!==null&&(en(c,r,a),za(c,r,a)),r={cache:uf()},t.payload=r;return}r=r.return}}function EE(t,r,a){var c=mn();a={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Bs(t)?c0(r,a):(a=Kc(t,r,a,c),a!==null&&(en(a,t,c),f0(a,r,c)))}function u0(t,r,a){var c=mn();Ra(t,r,a,c)}function Ra(t,r,a,c){var g={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Bs(t))c0(r,g);else{var x=t.alternate;if(t.lanes===0&&(x===null||x.lanes===0)&&(x=r.lastRenderedReducer,x!==null))try{var C=r.lastRenderedState,O=x(C,a);if(g.hasEagerState=!0,g.eagerState=O,un(O,C))return xs(t,r,g,0),rt===null&&ys(),!1}catch{}finally{}if(a=Kc(t,r,g,c),a!==null)return en(a,t,c),f0(a,r,c),!0}return!1}function Df(t,r,a,c){if(c={lane:2,revertLane:hd(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Bs(t)){if(r)throw Error(l(479))}else r=Kc(t,a,c,2),r!==null&&en(r,t,2)}function Bs(t){var r=t.alternate;return t===Ae||r!==null&&r===Ae}function c0(t,r){bl=Ms=!0;var a=t.pending;a===null?r.next=r:(r.next=a.next,a.next=r),t.pending=r}function f0(t,r,a){if((a&4194048)!==0){var c=r.lanes;c&=t.pendingLanes,a|=c,r.lanes=a,Ko(t,a)}}var Da={readContext:Ht,use:Rs,useCallback:pt,useContext:pt,useEffect:pt,useImperativeHandle:pt,useLayoutEffect:pt,useInsertionEffect:pt,useMemo:pt,useReducer:pt,useRef:pt,useState:pt,useDebugValue:pt,useDeferredValue:pt,useTransition:pt,useSyncExternalStore:pt,useId:pt,useHostTransitionStatus:pt,useFormState:pt,useActionState:pt,useOptimistic:pt,useMemoCache:pt,useCacheRefresh:pt};Da.useEffectEvent=pt;var d0={readContext:Ht,use:Rs,useCallback:function(t,r){return Xt().memoizedState=[t,r===void 0?null:r],t},useContext:Ht,useEffect:Qg,useImperativeHandle:function(t,r,a){a=a!=null?a.concat([t]):null,Ls(4194308,4,Wg.bind(null,r,t),a)},useLayoutEffect:function(t,r){return Ls(4194308,4,t,r)},useInsertionEffect:function(t,r){Ls(4,2,t,r)},useMemo:function(t,r){var a=Xt();r=r===void 0?null:r;var c=t();if(Ai){It(!0);try{t()}finally{It(!1)}}return a.memoizedState=[c,r],c},useReducer:function(t,r,a){var c=Xt();if(a!==void 0){var g=a(r);if(Ai){It(!0);try{a(r)}finally{It(!1)}}}else g=r;return c.memoizedState=c.baseState=g,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:g},c.queue=t,t=t.dispatch=EE.bind(null,Ae,t),[c.memoizedState,t]},useRef:function(t){var r=Xt();return t={current:t},r.memoizedState=t},useState:function(t){t=Tf(t);var r=t.queue,a=u0.bind(null,Ae,r);return r.dispatch=a,[t.memoizedState,a]},useDebugValue:Mf,useDeferredValue:function(t,r){var a=Xt();return jf(a,t,r)},useTransition:function(){var t=Tf(!1);return t=i0.bind(null,Ae,t.queue,!0,!1),Xt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,r,a){var c=Ae,g=Xt();if(Ue){if(a===void 0)throw Error(l(407));a=a()}else{if(a=r(),rt===null)throw Error(l(349));(Be&127)!==0||Og(c,r,a)}g.memoizedState=a;var x={value:a,getSnapshot:r};return g.queue=x,Qg(Dg.bind(null,c,x,t),[t]),c.flags|=2048,Sl(9,{destroy:void 0},Rg.bind(null,c,x,a,r),null),a},useId:function(){var t=Xt(),r=rt.identifierPrefix;if(Ue){var a=Pn,c=Xn;a=(c&~(1<<32-Ze(c)-1)).toString(32)+a,r="_"+r+"R_"+a,a=js++,0<\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof c.is=="string"?C.createElement("select",{is:c.is}):C.createElement("select"),c.multiple?x.multiple=!0:c.size&&(x.size=c.size);break;default:x=typeof c.is=="string"?C.createElement(g,{is:c.is}):C.createElement(g)}}x[Mt]=r,x[Vt]=c;e:for(C=r.child;C!==null;){if(C.tag===5||C.tag===6)x.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===r)break e;for(;C.sibling===null;){if(C.return===null||C.return===r)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}r.stateNode=x;e:switch(qt(x,g,c),g){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&yr(r)}}return ct(r),Qf(r,r.type,t===null?null:t.memoizedProps,r.pendingProps,a),null;case 6:if(t&&r.stateNode!=null)t.memoizedProps!==c&&yr(r);else{if(typeof c!="string"&&r.stateNode===null)throw Error(l(166));if(t=K.current,hl(r)){if(t=r.stateNode,a=r.memoizedProps,c=null,g=Lt,g!==null)switch(g.tag){case 27:case 5:c=g.memoizedProps}t[Mt]=r,t=!!(t.nodeValue===a||c!==null&&c.suppressHydrationWarning===!0||My(t.nodeValue,a)),t||Ir(r,!0)}else t=iu(t).createTextNode(c),t[Mt]=r,r.stateNode=t}return ct(r),null;case 31:if(a=r.memoizedState,t===null||t.memoizedState!==null){if(c=hl(r),a!==null){if(t===null){if(!c)throw Error(l(318));if(t=r.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(557));t[Mt]=r}else _i(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ct(r),t=!1}else a=lf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return r.flags&256?(dn(r),r):(dn(r),null);if((r.flags&128)!==0)throw Error(l(558))}return ct(r),null;case 13:if(c=r.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(g=hl(r),c!==null&&c.dehydrated!==null){if(t===null){if(!g)throw Error(l(318));if(g=r.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(l(317));g[Mt]=r}else _i(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ct(r),g=!1}else g=lf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=g),g=!0;if(!g)return r.flags&256?(dn(r),r):(dn(r),null)}return dn(r),(r.flags&128)!==0?(r.lanes=a,r):(a=c!==null,t=t!==null&&t.memoizedState!==null,a&&(c=r.child,g=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(g=c.alternate.memoizedState.cachePool.pool),x=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(x=c.memoizedState.cachePool.pool),x!==g&&(c.flags|=2048)),a!==t&&a&&(r.child.flags|=8192),Ys(r,r.updateQueue),ct(r),null);case 4:return se(),t===null&&yd(r.stateNode.containerInfo),ct(r),null;case 10:return hr(r.type),ct(r),null;case 19:if(P(xt),c=r.memoizedState,c===null)return ct(r),null;if(g=(r.flags&128)!==0,x=c.rendering,x===null)if(g)Ha(c,!1);else{if(mt!==0||t!==null&&(t.flags&128)!==0)for(t=r.child;t!==null;){if(x=As(t),x!==null){for(r.flags|=128,Ha(c,!1),t=x.updateQueue,r.updateQueue=t,Ys(r,t),r.subtreeFlags=0,t=a,a=r.child;a!==null;)ug(a,t),a=a.sibling;return N(xt,xt.current&1|2),Ue&&fr(r,c.treeForkCount),r.child}t=t.sibling}c.tail!==null&&At()>Fs&&(r.flags|=128,g=!0,Ha(c,!1),r.lanes=4194304)}else{if(!g)if(t=As(x),t!==null){if(r.flags|=128,g=!0,t=t.updateQueue,r.updateQueue=t,Ys(r,t),Ha(c,!0),c.tail===null&&c.tailMode==="hidden"&&!x.alternate&&!Ue)return ct(r),null}else 2*At()-c.renderingStartTime>Fs&&a!==536870912&&(r.flags|=128,g=!0,Ha(c,!1),r.lanes=4194304);c.isBackwards?(x.sibling=r.child,r.child=x):(t=c.last,t!==null?t.sibling=x:r.child=x,c.last=x)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=At(),t.sibling=null,a=xt.current,N(xt,g?a&1|2:a&1),Ue&&fr(r,c.treeForkCount),t):(ct(r),null);case 22:case 23:return dn(r),xf(),c=r.memoizedState!==null,t!==null?t.memoizedState!==null!==c&&(r.flags|=8192):c&&(r.flags|=8192),c?(a&536870912)!==0&&(r.flags&128)===0&&(ct(r),r.subtreeFlags&6&&(r.flags|=8192)):ct(r),a=r.updateQueue,a!==null&&Ys(r,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),c=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),c!==a&&(r.flags|=2048),t!==null&&P(ki),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),r.memoizedState.cache!==a&&(r.flags|=2048),hr(wt),ct(r),null;case 25:return null;case 30:return null}throw Error(l(156,r.tag))}function zE(t,r){switch(nf(r),r.tag){case 1:return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 3:return hr(wt),se(),t=r.flags,(t&65536)!==0&&(t&128)===0?(r.flags=t&-65537|128,r):null;case 26:case 27:case 5:return ve(r),null;case 31:if(r.memoizedState!==null){if(dn(r),r.alternate===null)throw Error(l(340));_i()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 13:if(dn(r),t=r.memoizedState,t!==null&&t.dehydrated!==null){if(r.alternate===null)throw Error(l(340));_i()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 19:return P(xt),null;case 4:return se(),null;case 10:return hr(r.type),null;case 22:case 23:return dn(r),xf(),t!==null&&P(ki),t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 24:return hr(wt),null;case 25:return null;default:return null}}function L0(t,r){switch(nf(r),r.tag){case 3:hr(wt),se();break;case 26:case 27:case 5:ve(r);break;case 4:se();break;case 31:r.memoizedState!==null&&dn(r);break;case 13:dn(r);break;case 19:P(xt);break;case 10:hr(r.type);break;case 22:case 23:dn(r),xf(),t!==null&&P(ki);break;case 24:hr(wt)}}function Ba(t,r){try{var a=r.updateQueue,c=a!==null?a.lastEffect:null;if(c!==null){var g=c.next;a=g;do{if((a.tag&t)===t){c=void 0;var x=a.create,C=a.inst;c=x(),C.destroy=c}a=a.next}while(a!==g)}}catch(O){Je(r,r.return,O)}}function Fr(t,r,a){try{var c=r.updateQueue,g=c!==null?c.lastEffect:null;if(g!==null){var x=g.next;c=x;do{if((c.tag&t)===t){var C=c.inst,O=C.destroy;if(O!==void 0){C.destroy=void 0,g=r;var Q=a,le=O;try{le()}catch(ce){Je(g,Q,ce)}}}c=c.next}while(c!==x)}}catch(ce){Je(r,r.return,ce)}}function H0(t){var r=t.updateQueue;if(r!==null){var a=t.stateNode;try{Cg(r,a)}catch(c){Je(t,t.return,c)}}}function B0(t,r,a){a.props=Mi(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(c){Je(t,r,c)}}function qa(t,r){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var c=t.stateNode;break;case 30:c=t.stateNode;break;default:c=t.stateNode}typeof a=="function"?t.refCleanup=a(c):a.current=c}}catch(g){Je(t,r,g)}}function Fn(t,r){var a=t.ref,c=t.refCleanup;if(a!==null)if(typeof c=="function")try{c()}catch(g){Je(t,r,g)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(g){Je(t,r,g)}else a.current=null}function q0(t){var r=t.type,a=t.memoizedProps,c=t.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":a.autoFocus&&c.focus();break e;case"img":a.src?c.src=a.src:a.srcSet&&(c.srcset=a.srcSet)}}catch(g){Je(t,t.return,g)}}function Zf(t,r,a){try{var c=t.stateNode;KE(c,t.type,a,r),c[Vt]=r}catch(g){Je(t,t.return,g)}}function U0(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ti(t.type)||t.tag===4}function Kf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||U0(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ti(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Jf(t,r,a){var c=t.tag;if(c===5||c===6)t=t.stateNode,r?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,r):(r=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,r.appendChild(t),a=a._reactRootContainer,a!=null||r.onclick!==null||(r.onclick=sr));else if(c!==4&&(c===27&&ti(t.type)&&(a=t.stateNode,r=null),t=t.child,t!==null))for(Jf(t,r,a),t=t.sibling;t!==null;)Jf(t,r,a),t=t.sibling}function Gs(t,r,a){var c=t.tag;if(c===5||c===6)t=t.stateNode,r?a.insertBefore(t,r):a.appendChild(t);else if(c!==4&&(c===27&&ti(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Gs(t,r,a),t=t.sibling;t!==null;)Gs(t,r,a),t=t.sibling}function I0(t){var r=t.stateNode,a=t.memoizedProps;try{for(var c=t.type,g=r.attributes;g.length;)r.removeAttributeNode(g[0]);qt(r,c,a),r[Mt]=t,r[Vt]=a}catch(x){Je(t,t.return,x)}}var xr=!1,Et=!1,Wf=!1,V0=typeof WeakSet=="function"?WeakSet:Set,Ot=null;function AE(t,r){if(t=t.containerInfo,bd=fu,t=eg(t),$c(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var c=a.getSelection&&a.getSelection();if(c&&c.rangeCount!==0){a=c.anchorNode;var g=c.anchorOffset,x=c.focusNode;c=c.focusOffset;try{a.nodeType,x.nodeType}catch{a=null;break e}var C=0,O=-1,Q=-1,le=0,ce=0,de=t,ae=null;t:for(;;){for(var oe;de!==a||g!==0&&de.nodeType!==3||(O=C+g),de!==x||c!==0&&de.nodeType!==3||(Q=C+c),de.nodeType===3&&(C+=de.nodeValue.length),(oe=de.firstChild)!==null;)ae=de,de=oe;for(;;){if(de===t)break t;if(ae===a&&++le===g&&(O=C),ae===x&&++ce===c&&(Q=C),(oe=de.nextSibling)!==null)break;de=ae,ae=de.parentNode}de=oe}a=O===-1||Q===-1?null:{start:O,end:Q}}else a=null}a=a||{start:0,end:0}}else a=null;for(wd={focusedElem:t,selectionRange:a},fu=!1,Ot=r;Ot!==null;)if(r=Ot,t=r.child,(r.subtreeFlags&1028)!==0&&t!==null)t.return=r,Ot=t;else for(;Ot!==null;){switch(r=Ot,x=r.alternate,t=r.flags,r.tag){case 0:if((t&4)!==0&&(t=r.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a title"))),qt(x,c,a),x[Mt]=t,bt(x),c=x;break e;case"link":var C=Fy("link","href",g).get(c+(a.href||""));if(C){for(var O=0;Ont&&(C=nt,nt=ke,ke=C);var te=Jm(O,ke),W=Jm(O,nt);if(te&&W&&(oe.rangeCount!==1||oe.anchorNode!==te.node||oe.anchorOffset!==te.offset||oe.focusNode!==W.node||oe.focusOffset!==W.offset)){var ie=de.createRange();ie.setStart(te.node,te.offset),oe.removeAllRanges(),ke>nt?(oe.addRange(ie),oe.extend(W.node,W.offset)):(ie.setEnd(W.node,W.offset),oe.addRange(ie))}}}}for(de=[],oe=O;oe=oe.parentNode;)oe.nodeType===1&&de.push({element:oe,left:oe.scrollLeft,top:oe.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;Oa?32:a,R.T=null,a=ad,ad=null;var x=Jr,C=_r;if(jt=0,Cl=Jr=null,_r=0,(Fe&6)!==0)throw Error(l(331));var O=Fe;if(Fe|=4,W0(x.current),Z0(x,x.current,C,a),Fe=O,$a(0,!1),yt&&typeof yt.onPostCommitFiberRoot=="function")try{yt.onPostCommitFiberRoot(Dt,x)}catch{}return!0}finally{$.p=g,R.T=c,yy(t,r)}}function vy(t,r,a){r=_n(a,r),r=qf(t.stateNode,r,2),t=$r(t,r,2),t!==null&&(pi(t,2),Qn(t))}function Je(t,r,a){if(t.tag===3)vy(t,t,a);else for(;r!==null;){if(r.tag===3){vy(r,t,a);break}else if(r.tag===1){var c=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Kr===null||!Kr.has(c))){t=_n(a,t),a=b0(2),c=$r(r,a,2),c!==null&&(w0(a,c,r,t),pi(c,2),Qn(c));break}}r=r.return}}function cd(t,r,a){var c=t.pingCache;if(c===null){c=t.pingCache=new OE;var g=new Set;c.set(r,g)}else g=c.get(r),g===void 0&&(g=new Set,c.set(r,g));g.has(a)||(nd=!0,g.add(a),t=BE.bind(null,t,r,a),r.then(t,t))}function BE(t,r,a){var c=t.pingCache;c!==null&&c.delete(r),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,rt===t&&(Be&a)===a&&(mt===4||mt===3&&(Be&62914560)===Be&&300>At()-Ps?(Fe&2)===0&&Tl(t,0):rd|=a,kl===Be&&(kl=0)),Qn(t)}function by(t,r){r===0&&(r=Qo()),t=wi(t,r),t!==null&&(pi(t,r),Qn(t))}function qE(t){var r=t.memoizedState,a=0;r!==null&&(a=r.retryLane),by(t,a)}function UE(t,r){var a=0;switch(t.tag){case 31:case 13:var c=t.stateNode,g=t.memoizedState;g!==null&&(a=g.retryLane);break;case 19:c=t.stateNode;break;case 22:c=t.stateNode._retryCache;break;default:throw Error(l(314))}c!==null&&c.delete(r),by(t,a)}function IE(t,r){return Ut(t,r)}var eu=null,Al=null,fd=!1,tu=!1,dd=!1,ei=0;function Qn(t){t!==Al&&t.next===null&&(Al===null?eu=Al=t:Al=Al.next=t),tu=!0,fd||(fd=!0,YE())}function $a(t,r){if(!dd&&tu){dd=!0;do for(var a=!1,c=eu;c!==null;){if(t!==0){var g=c.pendingLanes;if(g===0)var x=0;else{var C=c.suspendedLanes,O=c.pingedLanes;x=(1<<31-Ze(42|t)+1)-1,x&=g&~(C&~O),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(a=!0,Ey(c,x))}else x=Be,x=Wi(c,c===rt?x:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(x&3)===0||hi(c,x)||(a=!0,Ey(c,x));c=c.next}while(a);dd=!1}}function VE(){wy()}function wy(){tu=fd=!1;var t=0;ei!==0&&WE()&&(t=ei);for(var r=At(),a=null,c=eu;c!==null;){var g=c.next,x=Sy(c,r);x===0?(c.next=null,a===null?eu=g:a.next=g,g===null&&(Al=a)):(a=c,(t!==0||(x&3)!==0)&&(tu=!0)),c=g}jt!==0&&jt!==5||$a(t),ei!==0&&(ei=0)}function Sy(t,r){for(var a=t.suspendedLanes,c=t.pingedLanes,g=t.expirationTimes,x=t.pendingLanes&-62914561;0O)break;var ce=Q.transferSize,de=Q.initiatorType;ce&&jy(de)&&(Q=Q.responseEnd,C+=ce*(Q"u"?null:document;function Gy(t,r,a){var c=Ml;if(c&&typeof r=="string"&&r){var g=Ft(r);g='link[rel="'+t+'"][href="'+g+'"]',typeof a=="string"&&(g+='[crossorigin="'+a+'"]'),Yy.has(g)||(Yy.add(g),t={rel:t,crossOrigin:a,href:r},c.querySelector(g)===null&&(r=c.createElement("link"),qt(r,"link",t),bt(r),c.head.appendChild(r)))}}function s2(t){Er.D(t),Gy("dns-prefetch",t,null)}function u2(t,r){Er.C(t,r),Gy("preconnect",t,r)}function c2(t,r,a){Er.L(t,r,a);var c=Ml;if(c&&t&&r){var g='link[rel="preload"][as="'+Ft(r)+'"]';r==="image"&&a&&a.imageSrcSet?(g+='[imagesrcset="'+Ft(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(g+='[imagesizes="'+Ft(a.imageSizes)+'"]')):g+='[href="'+Ft(t)+'"]';var x=g;switch(r){case"style":x=jl(t);break;case"script":x=Ol(t)}zn.has(x)||(t=p({rel:"preload",href:r==="image"&&a&&a.imageSrcSet?void 0:t,as:r},a),zn.set(x,t),c.querySelector(g)!==null||r==="style"&&c.querySelector(Qa(x))||r==="script"&&c.querySelector(Za(x))||(r=c.createElement("link"),qt(r,"link",t),bt(r),c.head.appendChild(r)))}}function f2(t,r){Er.m(t,r);var a=Ml;if(a&&t){var c=r&&typeof r.as=="string"?r.as:"script",g='link[rel="modulepreload"][as="'+Ft(c)+'"][href="'+Ft(t)+'"]',x=g;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Ol(t)}if(!zn.has(x)&&(t=p({rel:"modulepreload",href:t},r),zn.set(x,t),a.querySelector(g)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Za(x)))return}c=a.createElement("link"),qt(c,"link",t),bt(c),a.head.appendChild(c)}}}function d2(t,r,a){Er.S(t,r,a);var c=Ml;if(c&&t){var g=Dr(c).hoistableStyles,x=jl(t);r=r||"default";var C=g.get(x);if(!C){var O={loading:0,preload:null};if(C=c.querySelector(Qa(x)))O.loading=5;else{t=p({rel:"stylesheet",href:t,"data-precedence":r},a),(a=zn.get(x))&&Td(t,a);var Q=C=c.createElement("link");bt(Q),qt(Q,"link",t),Q._p=new Promise(function(le,ce){Q.onload=le,Q.onerror=ce}),Q.addEventListener("load",function(){O.loading|=1}),Q.addEventListener("error",function(){O.loading|=2}),O.loading|=4,au(C,r,c)}C={type:"stylesheet",instance:C,count:1,state:O},g.set(x,C)}}}function h2(t,r){Er.X(t,r);var a=Ml;if(a&&t){var c=Dr(a).hoistableScripts,g=Ol(t),x=c.get(g);x||(x=a.querySelector(Za(g)),x||(t=p({src:t,async:!0},r),(r=zn.get(g))&&zd(t,r),x=a.createElement("script"),bt(x),qt(x,"link",t),a.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},c.set(g,x))}}function p2(t,r){Er.M(t,r);var a=Ml;if(a&&t){var c=Dr(a).hoistableScripts,g=Ol(t),x=c.get(g);x||(x=a.querySelector(Za(g)),x||(t=p({src:t,async:!0,type:"module"},r),(r=zn.get(g))&&zd(t,r),x=a.createElement("script"),bt(x),qt(x,"link",t),a.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},c.set(g,x))}}function $y(t,r,a,c){var g=(g=K.current)?lu(g):null;if(!g)throw Error(l(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(r=jl(a.href),a=Dr(g).hoistableStyles,c=a.get(r),c||(c={type:"style",instance:null,count:0,state:null},a.set(r,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=jl(a.href);var x=Dr(g).hoistableStyles,C=x.get(t);if(C||(g=g.ownerDocument||g,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(t,C),(x=g.querySelector(Qa(t)))&&!x._p&&(C.instance=x,C.state.loading=5),zn.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},zn.set(t,a),x||m2(g,t,a,C.state))),r&&c===null)throw Error(l(528,""));return C}if(r&&c!==null)throw Error(l(529,""));return null;case"script":return r=a.async,a=a.src,typeof a=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Ol(a),a=Dr(g).hoistableScripts,c=a.get(r),c||(c={type:"script",instance:null,count:0,state:null},a.set(r,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,t))}}function jl(t){return'href="'+Ft(t)+'"'}function Qa(t){return'link[rel="stylesheet"]['+t+"]"}function Xy(t){return p({},t,{"data-precedence":t.precedence,precedence:null})}function m2(t,r,a,c){t.querySelector('link[rel="preload"][as="style"]['+r+"]")?c.loading=1:(r=t.createElement("link"),c.preload=r,r.addEventListener("load",function(){return c.loading|=1}),r.addEventListener("error",function(){return c.loading|=2}),qt(r,"link",a),bt(r),t.head.appendChild(r))}function Ol(t){return'[src="'+Ft(t)+'"]'}function Za(t){return"script[async]"+t}function Py(t,r,a){if(r.count++,r.instance===null)switch(r.type){case"style":var c=t.querySelector('style[data-href~="'+Ft(a.href)+'"]');if(c)return r.instance=c,bt(c),c;var g=p({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return c=(t.ownerDocument||t).createElement("style"),bt(c),qt(c,"style",g),au(c,a.precedence,t),r.instance=c;case"stylesheet":g=jl(a.href);var x=t.querySelector(Qa(g));if(x)return r.state.loading|=4,r.instance=x,bt(x),x;c=Xy(a),(g=zn.get(g))&&Td(c,g),x=(t.ownerDocument||t).createElement("link"),bt(x);var C=x;return C._p=new Promise(function(O,Q){C.onload=O,C.onerror=Q}),qt(x,"link",c),r.state.loading|=4,au(x,a.precedence,t),r.instance=x;case"script":return x=Ol(a.src),(g=t.querySelector(Za(x)))?(r.instance=g,bt(g),g):(c=a,(g=zn.get(x))&&(c=p({},a),zd(c,g)),t=t.ownerDocument||t,g=t.createElement("script"),bt(g),qt(g,"link",c),t.head.appendChild(g),r.instance=g);case"void":return null;default:throw Error(l(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(c=r.instance,r.state.loading|=4,au(c,a.precedence,t));return r.instance}function au(t,r,a){for(var c=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=c.length?c[c.length-1]:null,x=g,C=0;C title"):null)}function g2(t,r,a){if(a===1||r.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return t=r.disabled,typeof r.precedence=="string"&&t==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function Zy(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function y2(t,r,a,c){if(a.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var g=jl(c.href),x=r.querySelector(Qa(g));if(x){r=x._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(t.count++,t=su.bind(t),r.then(t,t)),a.state.loading|=4,a.instance=x,bt(x);return}x=r.ownerDocument||r,c=Xy(c),(g=zn.get(g))&&Td(c,g),x=x.createElement("link"),bt(x);var C=x;C._p=new Promise(function(O,Q){C.onload=O,C.onerror=Q}),qt(x,"link",c),a.instance=x}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,r),(r=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=su.bind(t),r.addEventListener("load",a),r.addEventListener("error",a))}}var Ad=0;function x2(t,r){return t.stylesheets&&t.count===0&&cu(t,t.stylesheets),0Ad?50:800)+r);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(c),clearTimeout(g)}}:null}function su(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)cu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var uu=null;function cu(t,r){t.stylesheets=null,t.unsuspend!==null&&(t.count++,uu=new Map,r.forEach(v2,t),uu=null,su.call(t))}function v2(t,r){if(!(r.state.loading&4)){var a=uu.get(t);if(a)var c=a.get(null);else{a=new Map,uu.set(t,a);for(var g=t.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),qd.exports=B2(),qd.exports}var U2=q2();/** +`+c.stack}}var zt=Object.prototype.hasOwnProperty,Ut=e.unstable_scheduleCallback,Rt=e.unstable_cancelCallback,wn=e.unstable_shouldYield,Mn=e.unstable_requestPaint,At=e.unstable_now,Mr=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,ge=e.unstable_UserBlockingPriority,Ne=e.unstable_NormalPriority,De=e.unstable_LowPriority,Ve=e.unstable_IdlePriority,$t=e.log,jn=e.unstable_setDisableYieldValue,Dt=null,yt=null;function It(t){if(typeof $t=="function"&&jn(t),yt&&typeof yt.setStrictMode=="function")try{yt.setStrictMode(Dt,t)}catch{}}var Ze=Math.clz32?Math.clz32:Ec,Gn=Math.log,sn=Math.LN2;function Ec(t){return t>>>=0,t===0?32:31-(Gn(t)/sn|0)|0}var Zi=256,Ki=262144,Ji=4194304;function ir(t){var r=t&42;if(r!==0)return r;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Wi(t,r,a){var c=t.pendingLanes;if(c===0)return 0;var g=0,x=t.suspendedLanes,C=t.pingedLanes;t=t.warmLanes;var R=c&134217727;return R!==0?(c=R&~x,c!==0?g=ir(c):(C&=R,C!==0?g=ir(C):a||(a=R&~t,a!==0&&(g=ir(a))))):(R=c&~x,R!==0?g=ir(R):C!==0?g=ir(C):a||(a=c&~t,a!==0&&(g=ir(a)))),g===0?0:r!==0&&r!==g&&(r&x)===0&&(x=g&-g,a=r&-r,x>=a||x===32&&(a&4194048)!==0)?r:g}function hi(t,r){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&r)===0}function Nc(t,r){switch(t){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Qo(){var t=Ji;return Ji<<=1,(Ji&62914560)===0&&(Ji=4194304),t}function ca(t){for(var r=[],a=0;31>a;a++)r.push(t);return r}function pi(t,r){t.pendingLanes|=r,r!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function kc(t,r,a,c,g,x){var C=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var R=t.entanglements,Q=t.expirationTimes,le=t.hiddenUpdates;for(a=C&~a;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Mc=/[\n"\\]/g;function Pt(t){return t.replace(Mc,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function yi(t,r,a,c,g,x,C,R){t.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?t.type=C:t.removeAttribute("type"),r!=null?C==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+Ft(r)):t.value!==""+Ft(r)&&(t.value=""+Ft(r)):C!=="submit"&&C!=="reset"||t.removeAttribute("value"),r!=null?ma(t,C,Ft(r)):a!=null?ma(t,C,Ft(a)):c!=null&&t.removeAttribute("value"),g==null&&x!=null&&(t.defaultChecked=!!x),g!=null&&(t.checked=g&&typeof g!="function"&&typeof g!="symbol"),R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?t.name=""+Ft(R):t.removeAttribute("name")}function ss(t,r,a,c,g,x,C,R){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(t.type=x),r!=null||a!=null){if(!(x!=="submit"&&x!=="reset"||r!=null)){Hr(t);return}a=a!=null?""+Ft(a):"",r=r!=null?""+Ft(r):a,R||r===t.value||(t.value=r),t.defaultValue=r}c=c??g,c=typeof c!="function"&&typeof c!="symbol"&&!!c,t.checked=R?t.checked:!!c,t.defaultChecked=!!c,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(t.name=C),Hr(t)}function ma(t,r,a){r==="number"&&gi(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function or(t,r,a,c){if(t=t.options,r){r={};for(var g=0;g"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Lc=!1;if(ur)try{var ya={};Object.defineProperty(ya,"passive",{get:function(){Lc=!0}}),window.addEventListener("test",ya,ya),window.removeEventListener("test",ya,ya)}catch{Lc=!1}var Br=null,Hc=null,cs=null;function Rm(){if(cs)return cs;var t,r=Hc,a=r.length,c,g="value"in Br?Br.value:Br.textContent,x=g.length;for(t=0;t=ba),Um=" ",Im=!1;function Vm(t,r){switch(t){case"keyup":return W_.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ym(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var al=!1;function tE(t,r){switch(t){case"compositionend":return Ym(r);case"keypress":return r.which!==32?null:(Im=!0,Um);case"textInput":return t=r.data,t===Um&&Im?null:t;default:return null}}function nE(t,r){if(al)return t==="compositionend"||!Vc&&Vm(t,r)?(t=Rm(),cs=Hc=Br=null,al=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1=r)return{node:a,offset:r-t};t=c}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Km(a)}}function Wm(t,r){return t&&r?t===r?!0:t&&t.nodeType===3?!1:r&&r.nodeType===3?Wm(t,r.parentNode):"contains"in t?t.contains(r):t.compareDocumentPosition?!!(t.compareDocumentPosition(r)&16):!1:!1}function eg(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var r=gi(t.document);r instanceof t.HTMLIFrameElement;){try{var a=typeof r.contentWindow.location.href=="string"}catch{a=!1}if(a)t=r.contentWindow;else break;r=gi(t.document)}return r}function $c(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r&&(r==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||r==="textarea"||t.contentEditable==="true")}var cE=ur&&"documentMode"in document&&11>=document.documentMode,ol=null,Xc=null,Ea=null,Fc=!1;function tg(t,r,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Fc||ol==null||ol!==gi(c)||(c=ol,"selectionStart"in c&&$c(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Ea&&_a(Ea,c)||(Ea=c,c=ru(Xc,"onSelect"),0>=C,g-=C,Xn=1<<32-Ze(r)+g|a<je?(qe=Se,Se=null):qe=Se.sibling;var Xe=ae(te,Se,ie[je],fe);if(Xe===null){Se===null&&(Se=qe);break}t&&Se&&Xe.alternate===null&&r(te,Se),W=x(Xe,W,je),$e===null?Ee=Xe:$e.sibling=Xe,$e=Xe,Se=qe}if(je===ie.length)return a(te,Se),Ue&&fr(te,je),Ee;if(Se===null){for(;jeje?(qe=Se,Se=null):qe=Se.sibling;var ai=ae(te,Se,Xe.value,fe);if(ai===null){Se===null&&(Se=qe);break}t&&Se&&ai.alternate===null&&r(te,Se),W=x(ai,W,je),$e===null?Ee=ai:$e.sibling=ai,$e=ai,Se=qe}if(Xe.done)return a(te,Se),Ue&&fr(te,je),Ee;if(Se===null){for(;!Xe.done;je++,Xe=ie.next())Xe=de(te,Xe.value,fe),Xe!==null&&(W=x(Xe,W,je),$e===null?Ee=Xe:$e.sibling=Xe,$e=Xe);return Ue&&fr(te,je),Ee}for(Se=c(Se);!Xe.done;je++,Xe=ie.next())Xe=oe(Se,te,je,Xe.value,fe),Xe!==null&&(t&&Xe.alternate!==null&&Se.delete(Xe.key===null?je:Xe.key),W=x(Xe,W,je),$e===null?Ee=Xe:$e.sibling=Xe,$e=Xe);return t&&Se.forEach(function(A2){return r(te,A2)}),Ue&&fr(te,je),Ee}function nt(te,W,ie,fe){if(typeof ie=="object"&&ie!==null&&ie.type===E&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case v:e:{for(var Ee=ie.key;W!==null;){if(W.key===Ee){if(Ee=ie.type,Ee===E){if(W.tag===7){a(te,W.sibling),fe=g(W,ie.props.children),fe.return=te,te=fe;break e}}else if(W.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===j&&Ci(Ee)===W.type){a(te,W.sibling),fe=g(W,ie.props),Aa(fe,ie),fe.return=te,te=fe;break e}a(te,W);break}else r(te,W);W=W.sibling}ie.type===E?(fe=Si(ie.props.children,te.mode,fe,ie.key),fe.return=te,te=fe):(fe=bs(ie.type,ie.key,ie.props,null,te.mode,fe),Aa(fe,ie),fe.return=te,te=fe)}return C(te);case w:e:{for(Ee=ie.key;W!==null;){if(W.key===Ee)if(W.tag===4&&W.stateNode.containerInfo===ie.containerInfo&&W.stateNode.implementation===ie.implementation){a(te,W.sibling),fe=g(W,ie.children||[]),fe.return=te,te=fe;break e}else{a(te,W);break}else r(te,W);W=W.sibling}fe=ef(ie,te.mode,fe),fe.return=te,te=fe}return C(te);case j:return ie=Ci(ie),nt(te,W,ie,fe)}if(G(ie))return be(te,W,ie,fe);if(I(ie)){if(Ee=I(ie),typeof Ee!="function")throw Error(l(150));return ie=Ee.call(ie),ke(te,W,ie,fe)}if(typeof ie.then=="function")return nt(te,W,Cs(ie),fe);if(ie.$$typeof===k)return nt(te,W,_s(te,ie),fe);Ts(te,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,W!==null&&W.tag===6?(a(te,W.sibling),fe=g(W,ie),fe.return=te,te=fe):(a(te,W),fe=Wc(ie,te.mode,fe),fe.return=te,te=fe),C(te)):a(te,W)}return function(te,W,ie,fe){try{za=0;var Ee=nt(te,W,ie,fe);return xl=null,Ee}catch(Se){if(Se===yl||Se===Ns)throw Se;var $e=cn(29,Se,null,te.mode);return $e.lanes=fe,$e.return=te,$e}finally{}}}var zi=Eg(!0),Ng=Eg(!1),Yr=!1;function hf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function pf(t,r){t=t.updateQueue,r.updateQueue===t&&(r.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Gr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function $r(t,r,a){var c=t.updateQueue;if(c===null)return null;if(c=c.shared,(Pe&2)!==0){var g=c.pending;return g===null?r.next=r:(r.next=g.next,g.next=r),c.pending=r,r=vs(t),sg(t,null,a),r}return xs(t,c,r,a),vs(t)}function Ma(t,r,a){if(r=r.updateQueue,r!==null&&(r=r.shared,(a&4194048)!==0)){var c=r.lanes;c&=t.pendingLanes,a|=c,r.lanes=a,Ko(t,a)}}function mf(t,r){var a=t.updateQueue,c=t.alternate;if(c!==null&&(c=c.updateQueue,a===c)){var g=null,x=null;if(a=a.firstBaseUpdate,a!==null){do{var C={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};x===null?g=x=C:x=x.next=C,a=a.next}while(a!==null);x===null?g=x=r:x=x.next=r}else g=x=r;a={baseState:c.baseState,firstBaseUpdate:g,lastBaseUpdate:x,shared:c.shared,callbacks:c.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=r:t.next=r,a.lastBaseUpdate=r}var gf=!1;function ja(){if(gf){var t=gl;if(t!==null)throw t}}function Oa(t,r,a,c){gf=!1;var g=t.updateQueue;Yr=!1;var x=g.firstBaseUpdate,C=g.lastBaseUpdate,R=g.shared.pending;if(R!==null){g.shared.pending=null;var Q=R,le=Q.next;Q.next=null,C===null?x=le:C.next=le,C=Q;var ce=t.alternate;ce!==null&&(ce=ce.updateQueue,R=ce.lastBaseUpdate,R!==C&&(R===null?ce.firstBaseUpdate=le:R.next=le,ce.lastBaseUpdate=Q))}if(x!==null){var de=g.baseState;C=0,ce=le=Q=null,R=x;do{var ae=R.lane&-536870913,oe=ae!==R.lane;if(oe?(Be&ae)===ae:(c&ae)===ae){ae!==0&&ae===ml&&(gf=!0),ce!==null&&(ce=ce.next={lane:0,tag:R.tag,payload:R.payload,callback:null,next:null});e:{var be=t,ke=R;ae=r;var nt=a;switch(ke.tag){case 1:if(be=ke.payload,typeof be=="function"){de=be.call(nt,de,ae);break e}de=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=ke.payload,ae=typeof be=="function"?be.call(nt,de,ae):be,ae==null)break e;de=p({},de,ae);break e;case 2:Yr=!0}}ae=R.callback,ae!==null&&(t.flags|=64,oe&&(t.flags|=8192),oe=g.callbacks,oe===null?g.callbacks=[ae]:oe.push(ae))}else oe={lane:ae,tag:R.tag,payload:R.payload,callback:R.callback,next:null},ce===null?(le=ce=oe,Q=de):ce=ce.next=oe,C|=ae;if(R=R.next,R===null){if(R=g.shared.pending,R===null)break;oe=R,R=oe.next,oe.next=null,g.lastBaseUpdate=oe,g.shared.pending=null}}while(!0);ce===null&&(Q=de),g.baseState=Q,g.firstBaseUpdate=le,g.lastBaseUpdate=ce,x===null&&(g.shared.lanes=0),Zr|=C,t.lanes=C,t.memoizedState=de}}function kg(t,r){if(typeof t!="function")throw Error(l(191,t));t.call(r)}function Cg(t,r){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;tx?x:8;var C=D.T,R={};D.T=R,Df(t,!1,r,a);try{var Q=g(),le=D.S;if(le!==null&&le(R,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var ce=vE(Q,c);La(t,r,ce,mn(t))}else La(t,r,c,mn(t))}catch(de){La(t,r,{then:function(){},status:"rejected",reason:de},mn())}finally{$.p=x,C!==null&&R.types!==null&&(C.types=R.types),D.T=C}}function NE(){}function Of(t,r,a,c){if(t.tag!==5)throw Error(l(476));var g=l0(t).queue;i0(t,g,r,Z,a===null?NE:function(){return a0(t),a(c)})}function l0(t){var r=t.memoizedState;if(r!==null)return r;r={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:Z},next:null};var a={};return r.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:a},next:null},t.memoizedState=r,t=t.alternate,t!==null&&(t.memoizedState=r),r}function a0(t){var r=l0(t);r.next===null&&(r=t.alternate.memoizedState),La(t,r.next.queue,{},mn())}function Rf(){return Ht(Wa)}function o0(){return vt().memoizedState}function s0(){return vt().memoizedState}function kE(t){for(var r=t.return;r!==null;){switch(r.tag){case 24:case 3:var a=mn();t=Gr(a);var c=$r(r,t,a);c!==null&&(en(c,r,a),Ma(c,r,a)),r={cache:uf()},t.payload=r;return}r=r.return}}function CE(t,r,a){var c=mn();a={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Bs(t)?c0(r,a):(a=Kc(t,r,a,c),a!==null&&(en(a,t,c),f0(a,r,c)))}function u0(t,r,a){var c=mn();La(t,r,a,c)}function La(t,r,a,c){var g={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Bs(t))c0(r,g);else{var x=t.alternate;if(t.lanes===0&&(x===null||x.lanes===0)&&(x=r.lastRenderedReducer,x!==null))try{var C=r.lastRenderedState,R=x(C,a);if(g.hasEagerState=!0,g.eagerState=R,un(R,C))return xs(t,r,g,0),rt===null&&ys(),!1}catch{}finally{}if(a=Kc(t,r,g,c),a!==null)return en(a,t,c),f0(a,r,c),!0}return!1}function Df(t,r,a,c){if(c={lane:2,revertLane:hd(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Bs(t)){if(r)throw Error(l(479))}else r=Kc(t,a,c,2),r!==null&&en(r,t,2)}function Bs(t){var r=t.alternate;return t===Ae||r!==null&&r===Ae}function c0(t,r){bl=Ms=!0;var a=t.pending;a===null?r.next=r:(r.next=a.next,a.next=r),t.pending=r}function f0(t,r,a){if((a&4194048)!==0){var c=r.lanes;c&=t.pendingLanes,a|=c,r.lanes=a,Ko(t,a)}}var Ha={readContext:Ht,use:Rs,useCallback:pt,useContext:pt,useEffect:pt,useImperativeHandle:pt,useLayoutEffect:pt,useInsertionEffect:pt,useMemo:pt,useReducer:pt,useRef:pt,useState:pt,useDebugValue:pt,useDeferredValue:pt,useTransition:pt,useSyncExternalStore:pt,useId:pt,useHostTransitionStatus:pt,useFormState:pt,useActionState:pt,useOptimistic:pt,useMemoCache:pt,useCacheRefresh:pt};Ha.useEffectEvent=pt;var d0={readContext:Ht,use:Rs,useCallback:function(t,r){return Xt().memoizedState=[t,r===void 0?null:r],t},useContext:Ht,useEffect:Qg,useImperativeHandle:function(t,r,a){a=a!=null?a.concat([t]):null,Ls(4194308,4,Wg.bind(null,r,t),a)},useLayoutEffect:function(t,r){return Ls(4194308,4,t,r)},useInsertionEffect:function(t,r){Ls(4,2,t,r)},useMemo:function(t,r){var a=Xt();r=r===void 0?null:r;var c=t();if(Ai){It(!0);try{t()}finally{It(!1)}}return a.memoizedState=[c,r],c},useReducer:function(t,r,a){var c=Xt();if(a!==void 0){var g=a(r);if(Ai){It(!0);try{a(r)}finally{It(!1)}}}else g=r;return c.memoizedState=c.baseState=g,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:g},c.queue=t,t=t.dispatch=CE.bind(null,Ae,t),[c.memoizedState,t]},useRef:function(t){var r=Xt();return t={current:t},r.memoizedState=t},useState:function(t){t=Tf(t);var r=t.queue,a=u0.bind(null,Ae,r);return r.dispatch=a,[t.memoizedState,a]},useDebugValue:Mf,useDeferredValue:function(t,r){var a=Xt();return jf(a,t,r)},useTransition:function(){var t=Tf(!1);return t=i0.bind(null,Ae,t.queue,!0,!1),Xt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,r,a){var c=Ae,g=Xt();if(Ue){if(a===void 0)throw Error(l(407));a=a()}else{if(a=r(),rt===null)throw Error(l(349));(Be&127)!==0||Og(c,r,a)}g.memoizedState=a;var x={value:a,getSnapshot:r};return g.queue=x,Qg(Dg.bind(null,c,x,t),[t]),c.flags|=2048,Sl(9,{destroy:void 0},Rg.bind(null,c,x,a,r),null),a},useId:function(){var t=Xt(),r=rt.identifierPrefix;if(Ue){var a=Fn,c=Xn;a=(c&~(1<<32-Ze(c)-1)).toString(32)+a,r="_"+r+"R_"+a,a=js++,0<\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof c.is=="string"?C.createElement("select",{is:c.is}):C.createElement("select"),c.multiple?x.multiple=!0:c.size&&(x.size=c.size);break;default:x=typeof c.is=="string"?C.createElement(g,{is:c.is}):C.createElement(g)}}x[Mt]=r,x[Vt]=c;e:for(C=r.child;C!==null;){if(C.tag===5||C.tag===6)x.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===r)break e;for(;C.sibling===null;){if(C.return===null||C.return===r)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}r.stateNode=x;e:switch(qt(x,g,c),g){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&yr(r)}}return ct(r),Qf(r,r.type,t===null?null:t.memoizedProps,r.pendingProps,a),null;case 6:if(t&&r.stateNode!=null)t.memoizedProps!==c&&yr(r);else{if(typeof c!="string"&&r.stateNode===null)throw Error(l(166));if(t=K.current,hl(r)){if(t=r.stateNode,a=r.memoizedProps,c=null,g=Lt,g!==null)switch(g.tag){case 27:case 5:c=g.memoizedProps}t[Mt]=r,t=!!(t.nodeValue===a||c!==null&&c.suppressHydrationWarning===!0||My(t.nodeValue,a)),t||Ir(r,!0)}else t=iu(t).createTextNode(c),t[Mt]=r,r.stateNode=t}return ct(r),null;case 31:if(a=r.memoizedState,t===null||t.memoizedState!==null){if(c=hl(r),a!==null){if(t===null){if(!c)throw Error(l(318));if(t=r.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(557));t[Mt]=r}else _i(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ct(r),t=!1}else a=lf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return r.flags&256?(dn(r),r):(dn(r),null);if((r.flags&128)!==0)throw Error(l(558))}return ct(r),null;case 13:if(c=r.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(g=hl(r),c!==null&&c.dehydrated!==null){if(t===null){if(!g)throw Error(l(318));if(g=r.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(l(317));g[Mt]=r}else _i(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ct(r),g=!1}else g=lf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=g),g=!0;if(!g)return r.flags&256?(dn(r),r):(dn(r),null)}return dn(r),(r.flags&128)!==0?(r.lanes=a,r):(a=c!==null,t=t!==null&&t.memoizedState!==null,a&&(c=r.child,g=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(g=c.alternate.memoizedState.cachePool.pool),x=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(x=c.memoizedState.cachePool.pool),x!==g&&(c.flags|=2048)),a!==t&&a&&(r.child.flags|=8192),Ys(r,r.updateQueue),ct(r),null);case 4:return se(),t===null&&yd(r.stateNode.containerInfo),ct(r),null;case 10:return hr(r.type),ct(r),null;case 19:if(F(xt),c=r.memoizedState,c===null)return ct(r),null;if(g=(r.flags&128)!==0,x=c.rendering,x===null)if(g)qa(c,!1);else{if(mt!==0||t!==null&&(t.flags&128)!==0)for(t=r.child;t!==null;){if(x=As(t),x!==null){for(r.flags|=128,qa(c,!1),t=x.updateQueue,r.updateQueue=t,Ys(r,t),r.subtreeFlags=0,t=a,a=r.child;a!==null;)ug(a,t),a=a.sibling;return N(xt,xt.current&1|2),Ue&&fr(r,c.treeForkCount),r.child}t=t.sibling}c.tail!==null&&At()>Ps&&(r.flags|=128,g=!0,qa(c,!1),r.lanes=4194304)}else{if(!g)if(t=As(x),t!==null){if(r.flags|=128,g=!0,t=t.updateQueue,r.updateQueue=t,Ys(r,t),qa(c,!0),c.tail===null&&c.tailMode==="hidden"&&!x.alternate&&!Ue)return ct(r),null}else 2*At()-c.renderingStartTime>Ps&&a!==536870912&&(r.flags|=128,g=!0,qa(c,!1),r.lanes=4194304);c.isBackwards?(x.sibling=r.child,r.child=x):(t=c.last,t!==null?t.sibling=x:r.child=x,c.last=x)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=At(),t.sibling=null,a=xt.current,N(xt,g?a&1|2:a&1),Ue&&fr(r,c.treeForkCount),t):(ct(r),null);case 22:case 23:return dn(r),xf(),c=r.memoizedState!==null,t!==null?t.memoizedState!==null!==c&&(r.flags|=8192):c&&(r.flags|=8192),c?(a&536870912)!==0&&(r.flags&128)===0&&(ct(r),r.subtreeFlags&6&&(r.flags|=8192)):ct(r),a=r.updateQueue,a!==null&&Ys(r,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),c=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),c!==a&&(r.flags|=2048),t!==null&&F(ki),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),r.memoizedState.cache!==a&&(r.flags|=2048),hr(wt),ct(r),null;case 25:return null;case 30:return null}throw Error(l(156,r.tag))}function jE(t,r){switch(nf(r),r.tag){case 1:return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 3:return hr(wt),se(),t=r.flags,(t&65536)!==0&&(t&128)===0?(r.flags=t&-65537|128,r):null;case 26:case 27:case 5:return ve(r),null;case 31:if(r.memoizedState!==null){if(dn(r),r.alternate===null)throw Error(l(340));_i()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 13:if(dn(r),t=r.memoizedState,t!==null&&t.dehydrated!==null){if(r.alternate===null)throw Error(l(340));_i()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 19:return F(xt),null;case 4:return se(),null;case 10:return hr(r.type),null;case 22:case 23:return dn(r),xf(),t!==null&&F(ki),t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 24:return hr(wt),null;case 25:return null;default:return null}}function L0(t,r){switch(nf(r),r.tag){case 3:hr(wt),se();break;case 26:case 27:case 5:ve(r);break;case 4:se();break;case 31:r.memoizedState!==null&&dn(r);break;case 13:dn(r);break;case 19:F(xt);break;case 10:hr(r.type);break;case 22:case 23:dn(r),xf(),t!==null&&F(ki);break;case 24:hr(wt)}}function Ua(t,r){try{var a=r.updateQueue,c=a!==null?a.lastEffect:null;if(c!==null){var g=c.next;a=g;do{if((a.tag&t)===t){c=void 0;var x=a.create,C=a.inst;c=x(),C.destroy=c}a=a.next}while(a!==g)}}catch(R){Je(r,r.return,R)}}function Pr(t,r,a){try{var c=r.updateQueue,g=c!==null?c.lastEffect:null;if(g!==null){var x=g.next;c=x;do{if((c.tag&t)===t){var C=c.inst,R=C.destroy;if(R!==void 0){C.destroy=void 0,g=r;var Q=a,le=R;try{le()}catch(ce){Je(g,Q,ce)}}}c=c.next}while(c!==x)}}catch(ce){Je(r,r.return,ce)}}function H0(t){var r=t.updateQueue;if(r!==null){var a=t.stateNode;try{Cg(r,a)}catch(c){Je(t,t.return,c)}}}function B0(t,r,a){a.props=Mi(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(c){Je(t,r,c)}}function Ia(t,r){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var c=t.stateNode;break;case 30:c=t.stateNode;break;default:c=t.stateNode}typeof a=="function"?t.refCleanup=a(c):a.current=c}}catch(g){Je(t,r,g)}}function Pn(t,r){var a=t.ref,c=t.refCleanup;if(a!==null)if(typeof c=="function")try{c()}catch(g){Je(t,r,g)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(g){Je(t,r,g)}else a.current=null}function q0(t){var r=t.type,a=t.memoizedProps,c=t.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":a.autoFocus&&c.focus();break e;case"img":a.src?c.src=a.src:a.srcSet&&(c.srcset=a.srcSet)}}catch(g){Je(t,t.return,g)}}function Zf(t,r,a){try{var c=t.stateNode;e2(c,t.type,a,r),c[Vt]=r}catch(g){Je(t,t.return,g)}}function U0(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ti(t.type)||t.tag===4}function Kf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||U0(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ti(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Jf(t,r,a){var c=t.tag;if(c===5||c===6)t=t.stateNode,r?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,r):(r=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,r.appendChild(t),a=a._reactRootContainer,a!=null||r.onclick!==null||(r.onclick=sr));else if(c!==4&&(c===27&&ti(t.type)&&(a=t.stateNode,r=null),t=t.child,t!==null))for(Jf(t,r,a),t=t.sibling;t!==null;)Jf(t,r,a),t=t.sibling}function Gs(t,r,a){var c=t.tag;if(c===5||c===6)t=t.stateNode,r?a.insertBefore(t,r):a.appendChild(t);else if(c!==4&&(c===27&&ti(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Gs(t,r,a),t=t.sibling;t!==null;)Gs(t,r,a),t=t.sibling}function I0(t){var r=t.stateNode,a=t.memoizedProps;try{for(var c=t.type,g=r.attributes;g.length;)r.removeAttributeNode(g[0]);qt(r,c,a),r[Mt]=t,r[Vt]=a}catch(x){Je(t,t.return,x)}}var xr=!1,Et=!1,Wf=!1,V0=typeof WeakSet=="function"?WeakSet:Set,Ot=null;function OE(t,r){if(t=t.containerInfo,bd=fu,t=eg(t),$c(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var c=a.getSelection&&a.getSelection();if(c&&c.rangeCount!==0){a=c.anchorNode;var g=c.anchorOffset,x=c.focusNode;c=c.focusOffset;try{a.nodeType,x.nodeType}catch{a=null;break e}var C=0,R=-1,Q=-1,le=0,ce=0,de=t,ae=null;t:for(;;){for(var oe;de!==a||g!==0&&de.nodeType!==3||(R=C+g),de!==x||c!==0&&de.nodeType!==3||(Q=C+c),de.nodeType===3&&(C+=de.nodeValue.length),(oe=de.firstChild)!==null;)ae=de,de=oe;for(;;){if(de===t)break t;if(ae===a&&++le===g&&(R=C),ae===x&&++ce===c&&(Q=C),(oe=de.nextSibling)!==null)break;de=ae,ae=de.parentNode}de=oe}a=R===-1||Q===-1?null:{start:R,end:Q}}else a=null}a=a||{start:0,end:0}}else a=null;for(wd={focusedElem:t,selectionRange:a},fu=!1,Ot=r;Ot!==null;)if(r=Ot,t=r.child,(r.subtreeFlags&1028)!==0&&t!==null)t.return=r,Ot=t;else for(;Ot!==null;){switch(r=Ot,x=r.alternate,t=r.flags,r.tag){case 0:if((t&4)!==0&&(t=r.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a title"))),qt(x,c,a),x[Mt]=t,bt(x),c=x;break e;case"link":var C=Py("link","href",g).get(c+(a.href||""));if(C){for(var R=0;Rnt&&(C=nt,nt=ke,ke=C);var te=Jm(R,ke),W=Jm(R,nt);if(te&&W&&(oe.rangeCount!==1||oe.anchorNode!==te.node||oe.anchorOffset!==te.offset||oe.focusNode!==W.node||oe.focusOffset!==W.offset)){var ie=de.createRange();ie.setStart(te.node,te.offset),oe.removeAllRanges(),ke>nt?(oe.addRange(ie),oe.extend(W.node,W.offset)):(ie.setEnd(W.node,W.offset),oe.addRange(ie))}}}}for(de=[],oe=R;oe=oe.parentNode;)oe.nodeType===1&&de.push({element:oe,left:oe.scrollLeft,top:oe.scrollTop});for(typeof R.focus=="function"&&R.focus(),R=0;Ra?32:a,D.T=null,a=ad,ad=null;var x=Jr,C=_r;if(jt=0,Cl=Jr=null,_r=0,(Pe&6)!==0)throw Error(l(331));var R=Pe;if(Pe|=4,W0(x.current),Z0(x,x.current,C,a),Pe=R,Fa(0,!1),yt&&typeof yt.onPostCommitFiberRoot=="function")try{yt.onPostCommitFiberRoot(Dt,x)}catch{}return!0}finally{$.p=g,D.T=c,yy(t,r)}}function vy(t,r,a){r=_n(a,r),r=qf(t.stateNode,r,2),t=$r(t,r,2),t!==null&&(pi(t,2),Qn(t))}function Je(t,r,a){if(t.tag===3)vy(t,t,a);else for(;r!==null;){if(r.tag===3){vy(r,t,a);break}else if(r.tag===1){var c=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Kr===null||!Kr.has(c))){t=_n(a,t),a=b0(2),c=$r(r,a,2),c!==null&&(w0(a,c,r,t),pi(c,2),Qn(c));break}}r=r.return}}function cd(t,r,a){var c=t.pingCache;if(c===null){c=t.pingCache=new LE;var g=new Set;c.set(r,g)}else g=c.get(r),g===void 0&&(g=new Set,c.set(r,g));g.has(a)||(nd=!0,g.add(a),t=IE.bind(null,t,r,a),r.then(t,t))}function IE(t,r,a){var c=t.pingCache;c!==null&&c.delete(r),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,rt===t&&(Be&a)===a&&(mt===4||mt===3&&(Be&62914560)===Be&&300>At()-Fs?(Pe&2)===0&&Tl(t,0):rd|=a,kl===Be&&(kl=0)),Qn(t)}function by(t,r){r===0&&(r=Qo()),t=wi(t,r),t!==null&&(pi(t,r),Qn(t))}function VE(t){var r=t.memoizedState,a=0;r!==null&&(a=r.retryLane),by(t,a)}function YE(t,r){var a=0;switch(t.tag){case 31:case 13:var c=t.stateNode,g=t.memoizedState;g!==null&&(a=g.retryLane);break;case 19:c=t.stateNode;break;case 22:c=t.stateNode._retryCache;break;default:throw Error(l(314))}c!==null&&c.delete(r),by(t,a)}function GE(t,r){return Ut(t,r)}var eu=null,Al=null,fd=!1,tu=!1,dd=!1,ei=0;function Qn(t){t!==Al&&t.next===null&&(Al===null?eu=Al=t:Al=Al.next=t),tu=!0,fd||(fd=!0,XE())}function Fa(t,r){if(!dd&&tu){dd=!0;do for(var a=!1,c=eu;c!==null;){if(t!==0){var g=c.pendingLanes;if(g===0)var x=0;else{var C=c.suspendedLanes,R=c.pingedLanes;x=(1<<31-Ze(42|t)+1)-1,x&=g&~(C&~R),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(a=!0,Ey(c,x))}else x=Be,x=Wi(c,c===rt?x:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(x&3)===0||hi(c,x)||(a=!0,Ey(c,x));c=c.next}while(a);dd=!1}}function $E(){wy()}function wy(){tu=fd=!1;var t=0;ei!==0&&n2()&&(t=ei);for(var r=At(),a=null,c=eu;c!==null;){var g=c.next,x=Sy(c,r);x===0?(c.next=null,a===null?eu=g:a.next=g,g===null&&(Al=a)):(a=c,(t!==0||(x&3)!==0)&&(tu=!0)),c=g}jt!==0&&jt!==5||Fa(t),ei!==0&&(ei=0)}function Sy(t,r){for(var a=t.suspendedLanes,c=t.pingedLanes,g=t.expirationTimes,x=t.pendingLanes&-62914561;0R)break;var ce=Q.transferSize,de=Q.initiatorType;ce&&jy(de)&&(Q=Q.responseEnd,C+=ce*(Q"u"?null:document;function Gy(t,r,a){var c=Ml;if(c&&typeof r=="string"&&r){var g=Pt(r);g='link[rel="'+t+'"][href="'+g+'"]',typeof a=="string"&&(g+='[crossorigin="'+a+'"]'),Yy.has(g)||(Yy.add(g),t={rel:t,crossOrigin:a,href:r},c.querySelector(g)===null&&(r=c.createElement("link"),qt(r,"link",t),bt(r),c.head.appendChild(r)))}}function f2(t){Er.D(t),Gy("dns-prefetch",t,null)}function d2(t,r){Er.C(t,r),Gy("preconnect",t,r)}function h2(t,r,a){Er.L(t,r,a);var c=Ml;if(c&&t&&r){var g='link[rel="preload"][as="'+Pt(r)+'"]';r==="image"&&a&&a.imageSrcSet?(g+='[imagesrcset="'+Pt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(g+='[imagesizes="'+Pt(a.imageSizes)+'"]')):g+='[href="'+Pt(t)+'"]';var x=g;switch(r){case"style":x=jl(t);break;case"script":x=Ol(t)}zn.has(x)||(t=p({rel:"preload",href:r==="image"&&a&&a.imageSrcSet?void 0:t,as:r},a),zn.set(x,t),c.querySelector(g)!==null||r==="style"&&c.querySelector(Ka(x))||r==="script"&&c.querySelector(Ja(x))||(r=c.createElement("link"),qt(r,"link",t),bt(r),c.head.appendChild(r)))}}function p2(t,r){Er.m(t,r);var a=Ml;if(a&&t){var c=r&&typeof r.as=="string"?r.as:"script",g='link[rel="modulepreload"][as="'+Pt(c)+'"][href="'+Pt(t)+'"]',x=g;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Ol(t)}if(!zn.has(x)&&(t=p({rel:"modulepreload",href:t},r),zn.set(x,t),a.querySelector(g)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ja(x)))return}c=a.createElement("link"),qt(c,"link",t),bt(c),a.head.appendChild(c)}}}function m2(t,r,a){Er.S(t,r,a);var c=Ml;if(c&&t){var g=Dr(c).hoistableStyles,x=jl(t);r=r||"default";var C=g.get(x);if(!C){var R={loading:0,preload:null};if(C=c.querySelector(Ka(x)))R.loading=5;else{t=p({rel:"stylesheet",href:t,"data-precedence":r},a),(a=zn.get(x))&&Td(t,a);var Q=C=c.createElement("link");bt(Q),qt(Q,"link",t),Q._p=new Promise(function(le,ce){Q.onload=le,Q.onerror=ce}),Q.addEventListener("load",function(){R.loading|=1}),Q.addEventListener("error",function(){R.loading|=2}),R.loading|=4,au(C,r,c)}C={type:"stylesheet",instance:C,count:1,state:R},g.set(x,C)}}}function g2(t,r){Er.X(t,r);var a=Ml;if(a&&t){var c=Dr(a).hoistableScripts,g=Ol(t),x=c.get(g);x||(x=a.querySelector(Ja(g)),x||(t=p({src:t,async:!0},r),(r=zn.get(g))&&zd(t,r),x=a.createElement("script"),bt(x),qt(x,"link",t),a.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},c.set(g,x))}}function y2(t,r){Er.M(t,r);var a=Ml;if(a&&t){var c=Dr(a).hoistableScripts,g=Ol(t),x=c.get(g);x||(x=a.querySelector(Ja(g)),x||(t=p({src:t,async:!0,type:"module"},r),(r=zn.get(g))&&zd(t,r),x=a.createElement("script"),bt(x),qt(x,"link",t),a.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},c.set(g,x))}}function $y(t,r,a,c){var g=(g=K.current)?lu(g):null;if(!g)throw Error(l(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(r=jl(a.href),a=Dr(g).hoistableStyles,c=a.get(r),c||(c={type:"style",instance:null,count:0,state:null},a.set(r,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=jl(a.href);var x=Dr(g).hoistableStyles,C=x.get(t);if(C||(g=g.ownerDocument||g,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(t,C),(x=g.querySelector(Ka(t)))&&!x._p&&(C.instance=x,C.state.loading=5),zn.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},zn.set(t,a),x||x2(g,t,a,C.state))),r&&c===null)throw Error(l(528,""));return C}if(r&&c!==null)throw Error(l(529,""));return null;case"script":return r=a.async,a=a.src,typeof a=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Ol(a),a=Dr(g).hoistableScripts,c=a.get(r),c||(c={type:"script",instance:null,count:0,state:null},a.set(r,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,t))}}function jl(t){return'href="'+Pt(t)+'"'}function Ka(t){return'link[rel="stylesheet"]['+t+"]"}function Xy(t){return p({},t,{"data-precedence":t.precedence,precedence:null})}function x2(t,r,a,c){t.querySelector('link[rel="preload"][as="style"]['+r+"]")?c.loading=1:(r=t.createElement("link"),c.preload=r,r.addEventListener("load",function(){return c.loading|=1}),r.addEventListener("error",function(){return c.loading|=2}),qt(r,"link",a),bt(r),t.head.appendChild(r))}function Ol(t){return'[src="'+Pt(t)+'"]'}function Ja(t){return"script[async]"+t}function Fy(t,r,a){if(r.count++,r.instance===null)switch(r.type){case"style":var c=t.querySelector('style[data-href~="'+Pt(a.href)+'"]');if(c)return r.instance=c,bt(c),c;var g=p({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return c=(t.ownerDocument||t).createElement("style"),bt(c),qt(c,"style",g),au(c,a.precedence,t),r.instance=c;case"stylesheet":g=jl(a.href);var x=t.querySelector(Ka(g));if(x)return r.state.loading|=4,r.instance=x,bt(x),x;c=Xy(a),(g=zn.get(g))&&Td(c,g),x=(t.ownerDocument||t).createElement("link"),bt(x);var C=x;return C._p=new Promise(function(R,Q){C.onload=R,C.onerror=Q}),qt(x,"link",c),r.state.loading|=4,au(x,a.precedence,t),r.instance=x;case"script":return x=Ol(a.src),(g=t.querySelector(Ja(x)))?(r.instance=g,bt(g),g):(c=a,(g=zn.get(x))&&(c=p({},a),zd(c,g)),t=t.ownerDocument||t,g=t.createElement("script"),bt(g),qt(g,"link",c),t.head.appendChild(g),r.instance=g);case"void":return null;default:throw Error(l(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(c=r.instance,r.state.loading|=4,au(c,a.precedence,t));return r.instance}function au(t,r,a){for(var c=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=c.length?c[c.length-1]:null,x=g,C=0;C title"):null)}function v2(t,r,a){if(a===1||r.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return t=r.disabled,typeof r.precedence=="string"&&t==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function Zy(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function b2(t,r,a,c){if(a.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var g=jl(c.href),x=r.querySelector(Ka(g));if(x){r=x._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(t.count++,t=su.bind(t),r.then(t,t)),a.state.loading|=4,a.instance=x,bt(x);return}x=r.ownerDocument||r,c=Xy(c),(g=zn.get(g))&&Td(c,g),x=x.createElement("link"),bt(x);var C=x;C._p=new Promise(function(R,Q){C.onload=R,C.onerror=Q}),qt(x,"link",c),a.instance=x}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,r),(r=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=su.bind(t),r.addEventListener("load",a),r.addEventListener("error",a))}}var Ad=0;function w2(t,r){return t.stylesheets&&t.count===0&&cu(t,t.stylesheets),0Ad?50:800)+r);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(c),clearTimeout(g)}}:null}function su(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)cu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var uu=null;function cu(t,r){t.stylesheets=null,t.unsuspend!==null&&(t.count++,uu=new Map,r.forEach(S2,t),uu=null,su.call(t))}function S2(t,r){if(!(r.state.loading&4)){var a=uu.get(t);if(a)var c=a.get(null);else{a=new Map,uu.set(t,a);for(var g=t.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),qd.exports=I2(),qd.exports}var Y2=V2();/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const I2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Nb=(...e)=>e.filter((n,i,l)=>!!n&&n.trim()!==""&&l.indexOf(n)===i).join(" ").trim();/** + */const G2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Nb=(...e)=>e.filter((n,i,l)=>!!n&&n.trim()!==""&&l.indexOf(n)===i).join(" ").trim();/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */var V2={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + */var $2={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Y2=V.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:i=2,absoluteStrokeWidth:l,className:o="",children:s,iconNode:u,...f},d)=>V.createElement("svg",{ref:d,...V2,width:n,height:n,stroke:e,strokeWidth:l?Number(i)*24/Number(n):i,className:Nb("lucide",o),...f},[...u.map(([h,m])=>V.createElement(h,m)),...Array.isArray(s)?s:[s]]));/** + */const X2=V.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:i=2,absoluteStrokeWidth:l,className:o="",children:s,iconNode:u,...f},d)=>V.createElement("svg",{ref:d,...$2,width:n,height:n,stroke:e,strokeWidth:l?Number(i)*24/Number(n):i,className:Nb("lucide",o),...f},[...u.map(([h,m])=>V.createElement(h,m)),...Array.isArray(s)?s:[s]]));/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Pe=(e,n)=>{const i=V.forwardRef(({className:l,...o},s)=>V.createElement(Y2,{ref:s,iconNode:n,className:Nb(`lucide-${I2(e)}`,l),...o}));return i.displayName=`${e}`,i};/** + */const Ge=(e,n)=>{const i=V.forwardRef(({className:l,...o},s)=>V.createElement(X2,{ref:s,iconNode:n,className:Nb(`lucide-${G2(e)}`,l),...o}));return i.displayName=`${e}`,i};/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kb=Pe("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** + */const kb=Ge("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const G2=Pe("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** + */const F2=Ge("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Bi=Pe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + */const Bi=Ge("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Fi=Pe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + */const Pi=Ge("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ia=Pe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const la=Ge("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $2=Pe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + */const P2=Ge("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const X2=Pe("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const Q2=Ge("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const P2=Pe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + */const Z2=Ge("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const F2=Pe("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/** + */const K2=Ge("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Cb=Pe("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + */const Cb=Ge("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Q2=Pe("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + */const J2=Ge("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Z2=Pe("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + */const W2=Ge("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const K2=Pe("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/** + */const eN=Ge("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const J2=Pe("FileOutput",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 7V4a2 2 0 0 1 2-2 2 2 0 0 0-2 2",key:"1vk7w2"}],["path",{d:"M4.063 20.999a2 2 0 0 0 2 1L18 22a2 2 0 0 0 2-2V7l-5-5H6",key:"1jink5"}],["path",{d:"m5 11-3 3",key:"1dgrs4"}],["path",{d:"m5 17-3-3h10",key:"1mvvaf"}]]);/** + */const tN=Ge("FileOutput",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 7V4a2 2 0 0 1 2-2 2 2 0 0 0-2 2",key:"1vk7w2"}],["path",{d:"M4.063 20.999a2 2 0 0 0 2 1L18 22a2 2 0 0 0 2-2V7l-5-5H6",key:"1jink5"}],["path",{d:"m5 11-3 3",key:"1dgrs4"}],["path",{d:"m5 17-3-3h10",key:"1mvvaf"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const W2=Pe("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** + */const Tb=Ge("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const eN=Pe("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/** + */const nN=Ge("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _o=Pe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + */const rN=Ge("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const tN=Pe("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/** + */const Zl=Ge("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nN=Pe("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/** + */const iN=Ge("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Vp=Pe("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** + */const lN=Ge("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const rN=Pe("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/** + */const Vp=Ge("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const iN=Pe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + */const aN=Ge("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lN=Pe("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** + */const oN=Ge("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const aN=Pe("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const sN=Ge("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bx=Pe("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/** + */const uN=Ge("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Tb=Pe("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** + */const bx=Ge("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const oN=Pe("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** + */const zb=Ge("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const sN=Pe("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + */const cN=Ge("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const uN=Pe("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** + */const Ab=Ge("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cN=Pe("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** + */const fN=Ge("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Bo=Pe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + */const dN=Ge("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fN=Pe("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),wx=e=>{let n;const i=new Set,l=(h,m)=>{const p=typeof h=="function"?h(n):h;if(!Object.is(p,n)){const y=n;n=m??(typeof p!="object"||p===null)?p:Object.assign({},n,p),i.forEach(v=>v(n,y))}},o=()=>n,f={setState:l,getState:o,getInitialState:()=>d,subscribe:h=>(i.add(h),()=>i.delete(h))},d=n=e(l,o,f);return f},dN=(e=>e?wx(e):wx),hN=e=>e;function pN(e,n=hN){const i=Ul.useSyncExternalStore(e.subscribe,Ul.useCallback(()=>n(e.getState()),[e,n]),Ul.useCallback(()=>n(e.getInitialState()),[e,n]));return Ul.useDebugValue(i),i}const Sx=e=>{const n=dN(e),i=l=>pN(n,l);return Object.assign(i,n),i},mN=(e=>e?Sx(e):Sx);function it(e,n,i="agent"){return e[n]||(e[n]={name:n,status:"pending",type:i,activity:[]}),e[n].activity||(e[n].activity=[]),e[n]}function xu(e,n,i){it(e,n).activity.push(i)}function Xe(e,n){e[n]&&(e[n]={...e[n]})}function ro(e,n,i,l){const o=e[n];if(!(o!=null&&o.for_each_items))return;const s=o.for_each_items.find(u=>u.key===i);s&&s.activity.push(l)}const he=mN(e=>({workflowName:"",workflowStatus:"pending",workflowStartTime:null,workflowFailure:null,workflowFailedAgent:null,workflowYaml:null,conductorVersion:null,entryPoint:null,agents:[],routes:[],parallelGroups:[],forEachGroups:[],nodes:{},groupProgress:{},highlightedEdges:[],agentsCompleted:0,agentsTotal:0,totalCost:0,totalTokens:0,selectedNode:null,wsStatus:"connecting",eventLog:[],activityLog:[],workflowOutput:null,lastEventTime:null,isPaused:!1,replayMode:!1,replayEvents:[],replayPosition:0,replayTotalEvents:0,replayPlaying:!1,replaySpeed:1,_wsSend:null,setWsSend:n=>{e({_wsSend:n})},sendGateResponse:(n,i,l)=>{const o=he.getState()._wsSend;o&&o({type:"gate_response",agent_name:n,selected_value:i,additional_input:l||{}})},processEvent:n=>{const i=vu[n.type];e(l=>{const o={...l,nodes:{...l.nodes},groupProgress:{...l.groupProgress},eventLog:[...l.eventLog],activityLog:[...l.activityLog],lastEventTime:n.timestamp};i&&i(o,n.data,n.timestamp);const s=bu(n);s&&o.eventLog.push(s);const u=wu(n);return u&&o.activityLog.push(u),o})},replayState:n=>{e(i=>{const l={...i,agentsCompleted:0,totalCost:0,totalTokens:0,nodes:{},groupProgress:{},highlightedEdges:[],eventLog:[],activityLog:[],workflowOutput:null,workflowFailedAgent:null};for(const o of n){const s=vu[o.type];s&&s(l,o.data,o.timestamp);const u=bu(o);u&&l.eventLog.push(u);const f=wu(o);f&&l.activityLog.push(f),l.lastEventTime=o.timestamp}return l})},selectNode:n=>{e({selectedNode:n})},setReplayMode:n=>{e(i=>{const l={...i,replayMode:!0,replayEvents:n,replayTotalEvents:n.length,replayPosition:n.length,replayPlaying:!1,replaySpeed:1,agentsCompleted:0,totalCost:0,totalTokens:0,nodes:{},groupProgress:{},highlightedEdges:[],eventLog:[],activityLog:[],workflowOutput:null,workflowFailedAgent:null};for(const o of n){const s=vu[o.type];s&&s(l,o.data,o.timestamp);const u=bu(o);u&&l.eventLog.push(u);const f=wu(o);f&&l.activityLog.push(f),l.lastEventTime=o.timestamp}return l})},setReplayPosition:n=>{e(i=>{const l=i.replayEvents.slice(0,n),o={...i,replayPosition:n,agentsCompleted:0,totalCost:0,totalTokens:0,nodes:{},groupProgress:{},highlightedEdges:[],eventLog:[],activityLog:[],workflowOutput:null,workflowFailedAgent:null,workflowStatus:"pending",workflowStartTime:null,workflowName:"",workflowFailure:null,entryPoint:null,agents:[],routes:[],parallelGroups:[],forEachGroups:[],isPaused:!1,lastEventTime:null};for(const s of l){const u=vu[s.type];u&&u(o,s.data,s.timestamp);const f=bu(s);f&&o.eventLog.push(f);const d=wu(s);d&&o.activityLog.push(d),o.lastEventTime=s.timestamp}return o})},setReplayPlaying:n=>{e({replayPlaying:n})},setReplaySpeed:n=>{e({replaySpeed:n})},setWsStatus:n=>{e({wsStatus:n})},setEdgeHighlight:(n,i,l)=>{e(o=>({highlightedEdges:[...o.highlightedEdges.filter(s=>!(s.from===n&&s.to===i)),{from:n,to:i,state:l}]}))},clearEdgeHighlight:(n,i)=>{e(l=>({highlightedEdges:l.highlightedEdges.filter(o=>!(o.from===n&&o.to===i))}))}})),vu={workflow_started:(e,n,i)=>{const l=n;e.workflowStatus="running",e.workflowStartTime=i??Date.now()/1e3,e.workflowName=l.name||"",e.workflowYaml=l.yaml_source??null,e.conductorVersion=l.version??null,e.entryPoint=l.entry_point||null,e.agents=l.agents||[],e.routes=l.routes||[],e.parallelGroups=l.parallel_groups||[],e.forEachGroups=l.for_each_groups||[],it(e.nodes,"$start","start"),e.nodes.$start.status="running",Xe(e.nodes,"$start");const o=new Set,s=new Set;for(const u of e.parallelGroups){for(const f of u.agents)o.add(f);s.add(u.name),it(e.nodes,u.name,"parallel_group"),e.groupProgress[u.name]={total:u.agents.length,completed:0,failed:0};for(const f of u.agents)it(e.nodes,f,"agent")}for(const u of e.forEachGroups)s.add(u.name),it(e.nodes,u.name,"for_each_group"),e.groupProgress[u.name]={total:0,completed:0,failed:0};for(const u of e.agents)if(!s.has(u.name)&&!o.has(u.name)){const f=u.type||"agent";it(e.nodes,u.name,f),u.model&&(e.nodes[u.name].model=u.model),s.add(u.name)}e.agentsTotal=s.size},agent_started:(e,n,i)=>{const l=n,o=it(e.nodes,l.agent_name);o.iteration!=null&&(o.output!=null||o.error_type!=null)&&(o.iterationHistory||(o.iterationHistory=[]),o.iterationHistory.push({iteration:o.iteration,prompt:o.prompt,output:o.output,elapsed:o.elapsed,model:o.model,tokens:o.tokens,input_tokens:o.input_tokens,output_tokens:o.output_tokens,cost_usd:o.cost_usd,activity:o.activity,error_type:o.error_type,error_message:o.error_message})),o.status="running",o.iteration=l.iteration,o.startedAt=i??Date.now()/1e3,o.activity=[],l.context_window_max!=null&&(o.context_window_max=l.context_window_max),o.prompt=void 0,o.output=void 0,o.error_type=void 0,o.error_message=void 0,Xe(e.nodes,l.agent_name)},agent_completed:(e,n)=>{const i=n,l=it(e.nodes,i.agent_name);l.status="completed",e.agentsCompleted++,l.elapsed=i.elapsed,l.model=i.model,l.tokens=i.tokens,l.input_tokens=i.input_tokens,l.output_tokens=i.output_tokens,l.cost_usd=i.cost_usd,l.output=i.output,l.output_keys=i.output_keys,l.context_window_used=i.context_window_used,l.context_window_max=i.context_window_max,i.context_window_used!=null&&i.context_window_max!=null&&i.context_window_max>0&&(l.context_pct=Math.round(i.context_window_used/i.context_window_max*100)),i.cost_usd&&(e.totalCost+=i.cost_usd),i.tokens&&(e.totalTokens+=i.tokens),Xe(e.nodes,i.agent_name)},agent_failed:(e,n)=>{const i=n,l=it(e.nodes,i.agent_name);l.status="failed",l.elapsed=i.elapsed,l.error_type=i.error_type,l.error_message=i.message;for(const o of e.routes)o.to===i.agent_name&&(e.highlightedEdges=[...e.highlightedEdges.filter(s=>!(s.from===o.from&&s.to===o.to)),{from:o.from,to:o.to,state:"failed"}]);Xe(e.nodes,i.agent_name)},agent_prompt_rendered:(e,n)=>{var s;const i=n,l=n.item_key,o=it(e.nodes,i.agent_name);if(o.prompt=i.rendered_prompt,o.context_keys=i.context_keys,l){ro(e.nodes,i.agent_name,l,{type:"prompt",icon:"📝",label:"prompt",text:"Prompt rendered",detail:((s=i.rendered_prompt)==null?void 0:s.slice(0,500))||null});const u=e.nodes[i.agent_name];if(u!=null&&u.for_each_items){const f=u.for_each_items.find(d=>d.key===l);f&&(f.prompt=i.rendered_prompt)}}Xe(e.nodes,i.agent_name)},agent_reasoning:(e,n)=>{const i=n,l=n.item_key,o={type:"reasoning",icon:"💭",label:"thinking",text:i.content};xu(e.nodes,i.agent_name,o),l&&ro(e.nodes,i.agent_name,l,o),Xe(e.nodes,i.agent_name)},agent_tool_start:(e,n)=>{const i=n,l=n.item_key,o={type:"tool-start",icon:"🔧",label:"tool",text:i.tool_name,detail:i.arguments||null};xu(e.nodes,i.agent_name,o),l&&ro(e.nodes,i.agent_name,l,o),Xe(e.nodes,i.agent_name)},agent_tool_complete:(e,n)=>{const i=n,l=n.item_key,o={type:"tool-complete",icon:"✓",label:"result",text:i.tool_name||"done",detail:i.result||null};xu(e.nodes,i.agent_name,o),l&&ro(e.nodes,i.agent_name,l,o),Xe(e.nodes,i.agent_name)},agent_turn_start:(e,n)=>{const i=n,l=n.item_key,o={type:"turn",icon:"⏳",label:"turn",text:`Turn ${i.turn??"?"}`};xu(e.nodes,i.agent_name,o),l&&ro(e.nodes,i.agent_name,l,o),Xe(e.nodes,i.agent_name)},agent_message:(e,n)=>{const i=n,l=it(e.nodes,i.agent_name);l.latest_message=i.content,Xe(e.nodes,i.agent_name)},script_started:(e,n,i)=>{const l=n,o=it(e.nodes,l.agent_name);o.status="running",o.startedAt=i??Date.now()/1e3,Xe(e.nodes,l.agent_name)},script_completed:(e,n)=>{const i=n,l=it(e.nodes,i.agent_name);l.status="completed",e.agentsCompleted++,l.elapsed=i.elapsed,l.stdout=i.stdout,l.stderr=i.stderr,l.exit_code=i.exit_code,Xe(e.nodes,i.agent_name)},script_failed:(e,n)=>{const i=n,l=it(e.nodes,i.agent_name);l.status="failed",l.elapsed=i.elapsed,l.error_type=i.error_type,l.error_message=i.message,Xe(e.nodes,i.agent_name)},gate_presented:(e,n)=>{const i=n,l=it(e.nodes,i.agent_name);l.status="waiting",l.options=i.options,l.option_details=i.option_details,l.prompt=i.prompt,Xe(e.nodes,i.agent_name)},gate_resolved:(e,n)=>{const i=n,l=it(e.nodes,i.agent_name);l.status="completed",e.agentsCompleted++,l.selected_option=i.selected_option,l.route=i.route,l.additional_input=i.additional_input,Xe(e.nodes,i.agent_name)},route_taken:(e,n)=>{const i=n;e.highlightedEdges=[...e.highlightedEdges.filter(l=>!(l.from===i.from_agent&&l.to===i.to_agent)),{from:i.from_agent,to:i.to_agent,state:"taken"}]},parallel_started:(e,n)=>{const i=n,l=it(e.nodes,i.group_name,"parallel_group");l.status="running",e.groupProgress[i.group_name]&&(e.groupProgress[i.group_name].total=i.agents.length,e.groupProgress[i.group_name].completed=0,e.groupProgress[i.group_name].failed=0),Xe(e.nodes,i.group_name)},parallel_agent_completed:(e,n)=>{const i=n;e.groupProgress[i.group_name]&&e.groupProgress[i.group_name].completed++;const l=it(e.nodes,i.agent_name);l.status="completed",l.elapsed=i.elapsed,l.model=i.model,l.tokens=i.tokens,l.cost_usd=i.cost_usd,l.context_window_used=i.context_window_used,l.context_window_max=i.context_window_max,i.context_window_used!=null&&i.context_window_max!=null&&i.context_window_max>0&&(l.context_pct=Math.round(i.context_window_used/i.context_window_max*100)),i.cost_usd&&(e.totalCost+=i.cost_usd),i.tokens&&(e.totalTokens+=i.tokens),Xe(e.nodes,i.agent_name),Xe(e.nodes,i.group_name)},parallel_agent_failed:(e,n)=>{const i=n;e.groupProgress[i.group_name]&&e.groupProgress[i.group_name].failed++;const l=it(e.nodes,i.agent_name);l.status="failed",l.elapsed=i.elapsed,l.error_type=i.error_type,l.error_message=i.message,Xe(e.nodes,i.agent_name),Xe(e.nodes,i.group_name)},parallel_completed:(e,n)=>{const i=n;e.agentsCompleted++;const l=it(e.nodes,i.group_name,"parallel_group");l.status=i.failure_count===0?"completed":"failed",Xe(e.nodes,i.group_name)},for_each_started:(e,n)=>{const i=n,l=it(e.nodes,i.group_name,"for_each_group");l.status="running",l.for_each_items=[],e.groupProgress[i.group_name]&&(e.groupProgress[i.group_name].total=i.item_count,e.groupProgress[i.group_name].completed=0,e.groupProgress[i.group_name].failed=0),Xe(e.nodes,i.group_name)},for_each_item_started:(e,n)=>{const i=n,l=it(e.nodes,i.group_name,"for_each_group");l.for_each_items||(l.for_each_items=[]),l.for_each_items.push({key:i.item_key??String(i.index),index:i.index,status:"running",activity:[]}),Xe(e.nodes,i.group_name)},for_each_item_completed:(e,n)=>{const i=n;e.groupProgress[i.group_name]&&e.groupProgress[i.group_name].completed++;const l=it(e.nodes,i.group_name,"for_each_group");if(l.for_each_items){const o=i.item_key??String(i.index),s=l.for_each_items.find(u=>u.key===o);s&&(s.status="completed",s.elapsed=i.elapsed,s.tokens=i.tokens,s.cost_usd=i.cost_usd,s.output=i.output)}Xe(e.nodes,i.group_name)},for_each_item_failed:(e,n)=>{const i=n;e.groupProgress[i.group_name]&&e.groupProgress[i.group_name].failed++;const l=it(e.nodes,i.group_name,"for_each_group");if(l.for_each_items){const o=i.item_key??String(i.index),s=l.for_each_items.find(u=>u.key===o);s&&(s.status="failed",s.elapsed=i.elapsed,s.error_type=i.error_type,s.error_message=i.message)}Xe(e.nodes,i.group_name)},for_each_completed:(e,n)=>{const i=n;e.agentsCompleted++;const l=it(e.nodes,i.group_name,"for_each_group");l.status=(i.failure_count??0)===0?"completed":"failed",l.elapsed=i.elapsed,l.success_count=i.success_count,l.failure_count=i.failure_count,Xe(e.nodes,i.group_name)},workflow_completed:(e,n)=>{const i=n;e.workflowStatus="completed",e.isPaused=!1,e.workflowOutput=i.output??null,e.nodes.$end&&(e.nodes.$end.status="completed",Xe(e.nodes,"$end")),e.nodes.$start&&(e.nodes.$start.status="completed",Xe(e.nodes,"$start")),e.highlightedEdges=[]},workflow_failed:(e,n)=>{const i=n;if(e.workflowStatus="failed",e.isPaused=!1,e.workflowFailedAgent=i.agent_name||null,i.agent_name&&e.nodes[i.agent_name]){e.nodes[i.agent_name].status="failed",Xe(e.nodes,i.agent_name);for(const l of e.routes)l.to===i.agent_name&&(e.highlightedEdges=[...e.highlightedEdges.filter(o=>!(o.from===l.from&&o.to===l.to)),{from:l.from,to:l.to,state:"failed"}])}e.workflowFailure={error_type:i.error_type,message:i.message,elapsed_seconds:i.elapsed_seconds,timeout_seconds:i.timeout_seconds,current_agent:i.current_agent},e.nodes.$start&&(e.nodes.$start.status="completed",Xe(e.nodes,"$start"))},checkpoint_saved:(e,n)=>{const i=n;i.path&&e.workflowFailure&&(e.workflowFailure={...e.workflowFailure,checkpoint_path:i.path})},agent_paused:(e,n)=>{const i=n,l=it(e.nodes,i.agent_name);l.status="waiting",l.activity.push({type:"agent_paused",icon:"⏸",label:"Paused",text:"Agent paused — click Resume to re-execute"}),Xe(e.nodes,i.agent_name),e.isPaused=!0},agent_resumed:(e,n)=>{const i=n,l=it(e.nodes,i.agent_name);l.status="running",l.activity.push({type:"agent_resumed",icon:"▶",label:"Resumed",text:"Agent resumed — re-executing"}),Xe(e.nodes,i.agent_name),e.isPaused=!1}};function bu(e){var l,o;const n=e.timestamp,i=e.data;switch(e.type){case"workflow_started":return{timestamp:n,level:"info",source:"workflow",message:`Workflow "${i.name||""}" started`};case"agent_started":return{timestamp:n,level:"info",source:String(i.agent_name),message:`Agent started${i.iteration!=null?` (iteration ${i.iteration})`:""}`};case"agent_completed":return{timestamp:n,level:"success",source:String(i.agent_name),message:`Agent completed${i.elapsed!=null?` in ${Du(i.elapsed)}`:""}${i.tokens!=null?` · ${i.tokens.toLocaleString()} tokens`:""}${i.cost_usd!=null?` · $${i.cost_usd.toFixed(4)}`:""}`};case"agent_failed":return{timestamp:n,level:"error",source:String(i.agent_name),message:`Agent failed: ${i.message||i.error_type||"unknown error"}`};case"script_started":return{timestamp:n,level:"info",source:String(i.agent_name),message:"Script started"};case"script_completed":return{timestamp:n,level:"success",source:String(i.agent_name),message:`Script completed (exit ${i.exit_code??"?"})${i.elapsed!=null?` in ${Du(i.elapsed)}`:""}`};case"script_failed":return{timestamp:n,level:"error",source:String(i.agent_name),message:`Script failed: ${i.message||i.error_type||"unknown error"}`};case"gate_presented":return{timestamp:n,level:"warning",source:String(i.agent_name),message:"Waiting for human input…"};case"gate_resolved":return{timestamp:n,level:"success",source:String(i.agent_name),message:`Gate resolved → ${i.selected_option||"continue"}`};case"route_taken":return{timestamp:n,level:"debug",source:"router",message:`${i.from_agent} → ${i.to_agent}`};case"parallel_started":return{timestamp:n,level:"info",source:String(i.group_name),message:`Parallel group started (${((l=i.agents)==null?void 0:l.length)||"?"} agents)`};case"parallel_completed":return{timestamp:n,level:i.failure_count===0?"success":"error",source:String(i.group_name),message:`Parallel group completed${i.failure_count>0?` with ${i.failure_count} failure(s)`:""}`};case"for_each_started":return{timestamp:n,level:"info",source:String(i.group_name),message:`For-each started (${i.item_count} items)`};case"for_each_completed":return{timestamp:n,level:(i.failure_count??0)===0?"success":"error",source:String(i.group_name),message:`For-each completed · ${i.success_count} succeeded${i.failure_count>0?` · ${i.failure_count} failed`:""}`};case"workflow_completed":return{timestamp:n,level:"success",source:"workflow",message:`Workflow completed${i.elapsed!=null?` in ${Du(i.elapsed)}`:""}`};case"workflow_failed":return{timestamp:n,level:"error",source:"workflow",message:`Workflow failed: ${i.message||i.error_type||"unknown error"}`};case"checkpoint_saved":return{timestamp:n,level:"info",source:"workflow",message:`Checkpoint saved: ${((o=i.path)==null?void 0:o.split("/").pop())||"unknown"}`};case"agent_paused":return{timestamp:n,level:"warning",source:String(i.agent_name),message:"Agent paused — waiting for resume"};case"agent_resumed":return{timestamp:n,level:"info",source:String(i.agent_name),message:"Agent resumed — re-executing"};default:return null}}function Du(e){if(e<1)return`${(e*1e3).toFixed(0)}ms`;if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e/60),i=(e%60).toFixed(0);return`${n}m ${i}s`}function wu(e){const n=e.timestamp,i=e.data;switch(e.type){case"agent_started":return{timestamp:n,source:String(i.agent_name),type:"turn",message:`Agent started${i.iteration!=null?` (iteration ${i.iteration})`:""}`};case"agent_prompt_rendered":return{timestamp:n,source:String(i.agent_name),type:"prompt",message:"Prompt rendered",detail:io(String(i.rendered_prompt||""),500)};case"agent_reasoning":return{timestamp:n,source:String(i.agent_name),type:"reasoning",message:String(i.content||"")};case"agent_tool_start":return{timestamp:n,source:String(i.agent_name),type:"tool-start",message:`→ ${i.tool_name}`,detail:i.arguments?io(String(i.arguments),300):null};case"agent_tool_complete":return{timestamp:n,source:String(i.agent_name),type:"tool-complete",message:`← ${i.tool_name||"done"}`,detail:i.result?io(String(i.result),300):null};case"agent_turn_start":return{timestamp:n,source:String(i.agent_name),type:"turn",message:`Turn ${i.turn??"?"}`};case"agent_message":return{timestamp:n,source:String(i.agent_name),type:"message",message:io(String(i.content||""),500)};case"agent_completed":return{timestamp:n,source:String(i.agent_name),type:"turn",message:`Completed${i.elapsed!=null?` in ${Du(i.elapsed)}`:""}${i.tokens!=null?` · ${i.tokens.toLocaleString()} tokens`:""}`};case"agent_failed":return{timestamp:n,source:String(i.agent_name),type:"turn",message:`Failed: ${i.message||i.error_type||"unknown"}`};case"script_started":return{timestamp:n,source:String(i.agent_name),type:"turn",message:"Script started"};case"script_completed":return{timestamp:n,source:String(i.agent_name),type:"tool-complete",message:`Script completed (exit ${i.exit_code??"?"})`,detail:i.stdout?io(String(i.stdout),300):null};case"script_failed":return{timestamp:n,source:String(i.agent_name),type:"turn",message:`Script failed: ${i.message||i.error_type||"unknown"}`};default:return null}}function io(e,n){return e.length<=n?e:e.slice(0,n)+"…"}function _x(e){const n=e.match(/^(\s*)/);return n?n[1].length:0}function gN(e){const n=new Map;for(let i=0;io)s=u;else break}s>i&&n.set(i,s)}return n}function yN(e){if(/^\s*#/.test(e))return b.jsx("span",{className:"text-emerald-500/70",children:e});const n=e.match(/^(\s*)(- )?([a-zA-Z_][\w.-]*)(:\s*)(.*)/);if(n){const[,l,o,s,u,f]=n;return b.jsxs("span",{children:[l,o??"",b.jsx("span",{className:"text-sky-400",children:s}),b.jsx("span",{className:"text-[var(--text-muted)]",children:u}),Ex(f)]})}const i=e.match(/^(\s*)(- )(.*)/);if(i){const[,l,o,s]=i;return b.jsxs("span",{children:[l,b.jsx("span",{className:"text-[var(--text-muted)]",children:o}),Ex(s)]})}return b.jsx("span",{children:e})}function Ex(e){if(!e)return"";const n=e.indexOf(" #"),i=n>=0?e.slice(0,n):e,l=n>=0?e.slice(n):"";let o=i;return/^(true|false|null|yes|no)$/i.test(i.trim())?o=b.jsx("span",{className:"text-amber-400",children:i}):/^\d+(\.\d+)?$/.test(i.trim())?o=b.jsx("span",{className:"text-amber-400",children:i}):/^["'].*["']$/.test(i.trim())?o=b.jsx("span",{className:"text-green-400",children:i}):(i.includes("|")||i.includes(">"))&&(o=b.jsx("span",{className:"text-[var(--text-secondary)]",children:i})),b.jsxs(b.Fragment,{children:[o,l&&b.jsx("span",{className:"text-emerald-500/70",children:l})]})}function xN({yaml:e,onClose:n}){const[i,l]=V.useState(new Set);V.useEffect(()=>{const d=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[n]);const o=V.useMemo(()=>e.split(` -`),[e]),s=V.useMemo(()=>gN(o),[o]),u=V.useCallback(d=>{l(h=>{const m=new Set(h);return m.has(d)?m.delete(d):m.add(d),m})},[]),f=V.useMemo(()=>{const d=[];let h=-1;for(let m=0;mb.jsxs("div",{className:"flex",children:[b.jsx("span",{className:"inline-flex items-center justify-center flex-shrink-0",style:{width:"1.25rem"},children:m?b.jsx("button",{onClick:()=>u(d),className:"text-[var(--text-muted)] hover:text-[var(--text)] p-0 leading-none",style:{background:"none",border:"none",cursor:"pointer"},children:p?b.jsx(ia,{className:"w-3 h-3"}):b.jsx(Fi,{className:"w-3 h-3"})}):null}),b.jsxs("span",{className:"flex-1",children:[yN(h),p&&b.jsx("span",{className:"text-[var(--text-muted)] text-[11px] ml-2 px-1.5 py-0.5 rounded bg-[var(--surface-hover)] cursor-pointer",onClick:()=>u(d),children:"···"})]})]},d))})})]})]})}function vN(){const e=he(_=>_.workflowName),n=he(_=>_.workflowStatus),i=he(_=>_.isPaused),l=he(_=>_.workflowYaml),o=he(_=>_.conductorVersion),[s,u]=V.useState(!1),[f,d]=V.useState(!1),[h,m]=V.useState(!1),[p,y]=V.useState(!1),v=n==="running"||n==="pending";V.useEffect(()=>{i||(u(!1),d(!1),m(!1))},[i]);const w=async()=>{u(!0);try{await fetch("/api/stop",{method:"POST"})}catch(_){console.error("Failed to stop agent:",_),u(!1)}},k=async()=>{d(!0);try{await fetch("/api/resume",{method:"POST"})}catch(_){console.error("Failed to resume agent:",_),d(!1)}},S=async()=>{m(!0);try{await fetch("/api/kill",{method:"POST"})}catch(_){console.error("Failed to kill workflow:",_),m(!1)}};return b.jsxs("header",{className:"flex items-center justify-between px-4 py-2 bg-[var(--surface)] border-b border-[var(--border)] flex-shrink-0",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(kb,{className:"w-4 h-4 text-[var(--running)]"}),b.jsx("h1",{className:"text-sm font-semibold text-[var(--text)]",children:"Conductor"}),e&&b.jsxs("span",{className:"text-sm text-[var(--text-muted)] font-normal",children:["— ",e]})]}),b.jsxs("div",{className:"flex items-center gap-3",children:[i?b.jsxs(b.Fragment,{children:[b.jsxs("button",{onClick:k,disabled:f,className:`flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded - bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 - hover:bg-emerald-500/20 hover:border-emerald-500/30 - disabled:opacity-50 disabled:cursor-not-allowed - transition-colors`,title:"Re-execute the paused agent",children:[b.jsx(Vp,{className:"w-3 h-3"}),f?"Resuming...":"Resume"]}),b.jsxs("button",{onClick:S,disabled:h,className:`flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded - bg-red-500/10 text-red-400 border border-red-500/20 - hover:bg-red-500/20 hover:border-red-500/30 - disabled:opacity-50 disabled:cursor-not-allowed - transition-colors`,title:"Stop workflow entirely (checkpoint saved for CLI resume)",children:[b.jsx(Bo,{className:"w-3 h-3"}),h?"Killing...":"Kill"]})]}):v?b.jsxs("button",{onClick:w,disabled:s,className:`flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded - bg-red-500/10 text-red-400 border border-red-500/20 - hover:bg-red-500/20 hover:border-red-500/30 - disabled:opacity-50 disabled:cursor-not-allowed - transition-colors`,children:[b.jsx(Tb,{className:"w-3 h-3"}),s?"Stopping...":"Stop"]}):null,l&&b.jsxs("button",{onClick:()=>y(!0),className:`flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded - bg-[var(--surface-hover)] text-[var(--text-secondary)] border border-[var(--border)] - hover:text-[var(--text)] hover:bg-[var(--surface)] - transition-colors`,title:"View workflow YAML configuration",children:[b.jsx(K2,{className:"w-3 h-3"}),"YAML"]}),b.jsxs("a",{href:"/api/logs",download:"conductor-logs.json",className:`flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded - bg-[var(--surface-hover)] text-[var(--text-secondary)] border border-[var(--border)] - hover:text-[var(--text)] hover:bg-[var(--surface)] - transition-colors`,title:"Download full event log as JSON",children:[b.jsx(Q2,{className:"w-3 h-3"}),"Logs"]}),b.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["v",o??"—"]})]}),p&&l&&b.jsx(xN,{yaml:l,onClose:()=>y(!1)})]})}function Ye(...e){return e.filter(Boolean).join(" ")}function ln(e){if(e==null)return"";if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e/60),i=(e%60).toFixed(0);return`${n}m ${i}s`}function Wn(e){return e==null?"":e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:`${e}`}function Zl(e){return e==null?"":`$${e.toFixed(4)}`}function zb(e){return e==null?"":typeof e=="string"?e:JSON.stringify(e,null,2)}function bN(e,n){if(n<=0)return`${e.toLocaleString()} tokens (limit unknown)`;const i=o=>o.toLocaleString(),l=(e/n*100).toFixed(1);return`${i(e)} / ${i(n)} (${l}%)`}function Ab(){const e=he(f=>f.workflowStatus),n=he(f=>f.workflowStartTime),i=he(f=>f.replayMode),l=he(f=>f.lastEventTime),[o,s]=V.useState("—"),u=V.useRef(null);return V.useEffect(()=>{if(n!=null){if(i){u.current&&(clearInterval(u.current),u.current=null),s(ln((l??n)-n));return}if(e==="running"){const f=()=>{const d=Date.now()/1e3-n;s(ln(d))};return f(),u.current=setInterval(f,500),()=>{u.current&&clearInterval(u.current)}}else(e==="completed"||e==="failed")&&u.current&&(clearInterval(u.current),u.current=null)}},[e,n,i,l]),o}function wN(){const e=he(k=>k.workflowStatus),n=he(k=>k.agentsCompleted),i=he(k=>k.agentsTotal),l=he(k=>k.totalCost),o=he(k=>k.totalTokens),s=he(k=>k.wsStatus),u=he(k=>k.workflowFailure),f=he(k=>k.lastEventTime),d=Ab(),[h,m]=V.useState(null);V.useEffect(()=>{if(e!=="running"||f==null){m(null);return}const k=()=>{m(Math.floor(Date.now()/1e3-f))};k();const S=setInterval(k,1e3);return()=>clearInterval(S)},[e,f]);const p=e==="failed",y=(()=>{switch(e){case"pending":return"Waiting for workflow…";case"running":return"Running";case"completed":return"Completed";case"failed":{if(!u)return"Failed";const k=u.error_type||"";return k==="MaxIterationsError"?"Failed: exceeded maximum iterations":k==="TimeoutError"?"Failed: workflow timed out":u.message?`Failed: ${u.message.length>60?u.message.slice(0,57)+"...":u.message}`:`Failed: ${k}`}}})(),v={pending:"bg-[var(--pending)]",running:"bg-[var(--running)] animate-pulse",completed:"bg-[var(--completed)]",failed:"bg-[var(--failed)]"}[e],w=(()=>{switch(s){case"connected":return b.jsxs("span",{className:"flex items-center gap-1 text-[var(--completed)]",children:[b.jsx(cN,{className:"w-3 h-3"}),b.jsx("span",{children:"Connected"})]});case"disconnected":return b.jsxs("span",{className:"flex items-center gap-1 text-[var(--failed)]",children:[b.jsx(uN,{className:"w-3 h-3"}),b.jsx("span",{children:"Disconnected"})]});case"reconnecting":return b.jsxs("span",{className:"flex items-center gap-1 text-[var(--waiting)]",children:[b.jsx(_o,{className:"w-3 h-3 animate-spin"}),b.jsx("span",{children:"Reconnecting\\u2026"})]});case"connecting":return b.jsxs("span",{className:"flex items-center gap-1 text-[var(--text-muted)]",children:[b.jsx(_o,{className:"w-3 h-3 animate-spin"}),b.jsx("span",{children:"Connecting\\u2026"})]})}})();return b.jsxs("footer",{className:Ye("flex items-center gap-4 px-4 py-1.5 border-t text-xs flex-shrink-0 transition-colors duration-300",p?"bg-red-950/50 border-red-500/30":"bg-[var(--surface)] border-[var(--border)]"),children:[b.jsx("span",{className:Ye("w-2 h-2 rounded-full flex-shrink-0",v)}),b.jsx("span",{className:Ye(p?"text-red-300":"text-[var(--text)]"),children:y}),i>0&&b.jsxs("span",{className:Ye(p?"text-red-400/60":"text-[var(--text-muted)]"),children:[n,"/",i," agents"]}),e!=="pending"&&b.jsx("span",{className:Ye("font-mono",p?"text-red-400/60":"text-[var(--text-muted)]"),children:d}),o>0&&b.jsxs("span",{className:Ye("flex items-center gap-1",p?"text-red-400/60":"text-[var(--text-muted)]"),title:"Total tokens used",children:[b.jsx(eN,{className:"w-3 h-3"}),b.jsx("span",{className:"font-mono",children:o.toLocaleString()})]}),l>0&&b.jsxs("span",{className:Ye("flex items-center gap-1",p?"text-red-400/60":"text-[var(--text-muted)]"),title:"Total cost",children:[b.jsx(F2,{className:"w-3 h-3"}),b.jsxs("span",{className:"font-mono",children:["$",l.toFixed(4)]})]}),h!=null&&h>=5&&b.jsxs("span",{className:Ye("flex items-center gap-1 font-mono",h>=60?"text-amber-400":"text-[var(--text-muted)]"),title:"Time since last event from the provider",children:[b.jsx(P2,{className:"w-3 h-3"}),b.jsx("span",{children:h>=60?`${Math.floor(h/60)}m ${h%60}s idle`:`${h}s idle`})]}),b.jsx("span",{className:"flex-1"}),w]})}const SN=[1,5,10,20,50];function _N(e,n){if(n===0||e.length===0)return"+0.0s";const i=e[0].timestamp,o=e[Math.min(n,e.length)-1].timestamp-i;if(o<60)return`+${o.toFixed(1)}s`;const s=Math.floor(o/60),u=o%60;return`+${s}m${u.toFixed(0)}s`}function EN(){const e=he(p=>p.replayPosition),n=he(p=>p.replayTotalEvents),i=he(p=>p.replayPlaying),l=he(p=>p.replaySpeed),o=he(p=>p.replayEvents),s=he(p=>p.setReplayPosition),u=he(p=>p.setReplayPlaying),f=he(p=>p.setReplaySpeed),d=p=>{const y=parseInt(p.target.value,10);s(y),i&&u(!1)},h=()=>{!i&&e>=n&&s(0),u(!i)},m=n>0?e/n*100:0;return b.jsxs("footer",{className:"flex items-center gap-3 px-4 py-1.5 border-t bg-[var(--surface)] border-[var(--border)] text-xs flex-shrink-0",children:[b.jsx("button",{onClick:h,className:"flex items-center justify-center w-6 h-6 rounded hover:bg-[var(--surface-hover)] text-[var(--text-secondary)] hover:text-[var(--text)] transition-colors",title:i?"Pause":"Play",children:i?b.jsx(nN,{className:"w-3.5 h-3.5"}):b.jsx(Vp,{className:"w-3.5 h-3.5"})}),b.jsxs("div",{className:"flex-1 relative flex items-center",children:[b.jsx("input",{type:"range",min:0,max:n,value:e,onChange:d,className:"w-full h-1 appearance-none rounded-full cursor-pointer",style:{background:`linear-gradient(to right, var(--accent) 0%, var(--accent) ${m}%, var(--border) ${m}%, var(--border) 100%)`,WebkitAppearance:"none"}}),b.jsx("style",{children:` + */const aa=Ge("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + * @license lucide-react v0.469.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hN=Ge("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),wx=e=>{let n;const i=new Set,l=(h,m)=>{const p=typeof h=="function"?h(n):h;if(!Object.is(p,n)){const y=n;n=m??(typeof p!="object"||p===null)?p:Object.assign({},n,p),i.forEach(v=>v(n,y))}},o=()=>n,f={setState:l,getState:o,getInitialState:()=>d,subscribe:h=>(i.add(h),()=>i.delete(h))},d=n=e(l,o,f);return f},pN=(e=>e?wx(e):wx),mN=e=>e;function gN(e,n=mN){const i=Ul.useSyncExternalStore(e.subscribe,Ul.useCallback(()=>n(e.getState()),[e,n]),Ul.useCallback(()=>n(e.getInitialState()),[e,n]));return Ul.useDebugValue(i),i}const Sx=e=>{const n=pN(e),i=l=>gN(n,l);return Object.assign(i,n),i},yN=(e=>e?Sx(e):Sx);function it(e,n,i="agent"){return e[n]||(e[n]={name:n,status:"pending",type:i,activity:[]}),e[n].activity||(e[n].activity=[]),e[n]}function xu(e,n,i){it(e,n).activity.push(i)}function Fe(e,n){e[n]&&(e[n]={...e[n]})}function lo(e,n,i,l){const o=e[n];if(!(o!=null&&o.for_each_items))return;const s=o.for_each_items.find(u=>u.key===i);s&&s.activity.push(l)}const he=yN(e=>({workflowName:"",workflowStatus:"pending",workflowStartTime:null,workflowFailure:null,workflowFailedAgent:null,workflowYaml:null,conductorVersion:null,entryPoint:null,agents:[],routes:[],parallelGroups:[],forEachGroups:[],nodes:{},groupProgress:{},highlightedEdges:[],agentsCompleted:0,agentsTotal:0,totalCost:0,totalTokens:0,selectedNode:null,wsStatus:"connecting",eventLog:[],activityLog:[],workflowOutput:null,lastEventTime:null,isPaused:!1,replayMode:!1,replayEvents:[],replayPosition:0,replayTotalEvents:0,replayPlaying:!1,replaySpeed:1,_wsSend:null,setWsSend:n=>{e({_wsSend:n})},sendGateResponse:(n,i,l)=>{const o=he.getState()._wsSend;o&&o({type:"gate_response",agent_name:n,selected_value:i,additional_input:l||{}})},processEvent:n=>{const i=vu[n.type];e(l=>{const o={...l,nodes:{...l.nodes},groupProgress:{...l.groupProgress},eventLog:[...l.eventLog],activityLog:[...l.activityLog],lastEventTime:n.timestamp};i&&i(o,n.data,n.timestamp);const s=bu(n);s&&o.eventLog.push(s);const u=wu(n);return u&&o.activityLog.push(u),o})},replayState:n=>{e(i=>{const l={...i,agentsCompleted:0,totalCost:0,totalTokens:0,nodes:{},groupProgress:{},highlightedEdges:[],eventLog:[],activityLog:[],workflowOutput:null,workflowFailedAgent:null};for(const o of n){const s=vu[o.type];s&&s(l,o.data,o.timestamp);const u=bu(o);u&&l.eventLog.push(u);const f=wu(o);f&&l.activityLog.push(f),l.lastEventTime=o.timestamp}return l})},selectNode:n=>{e({selectedNode:n})},setReplayMode:n=>{e(i=>{const l={...i,replayMode:!0,replayEvents:n,replayTotalEvents:n.length,replayPosition:n.length,replayPlaying:!1,replaySpeed:1,agentsCompleted:0,totalCost:0,totalTokens:0,nodes:{},groupProgress:{},highlightedEdges:[],eventLog:[],activityLog:[],workflowOutput:null,workflowFailedAgent:null};for(const o of n){const s=vu[o.type];s&&s(l,o.data,o.timestamp);const u=bu(o);u&&l.eventLog.push(u);const f=wu(o);f&&l.activityLog.push(f),l.lastEventTime=o.timestamp}return l})},setReplayPosition:n=>{e(i=>{const l=i.replayEvents.slice(0,n),o={...i,replayPosition:n,agentsCompleted:0,totalCost:0,totalTokens:0,nodes:{},groupProgress:{},highlightedEdges:[],eventLog:[],activityLog:[],workflowOutput:null,workflowFailedAgent:null,workflowStatus:"pending",workflowStartTime:null,workflowName:"",workflowFailure:null,entryPoint:null,agents:[],routes:[],parallelGroups:[],forEachGroups:[],isPaused:!1,lastEventTime:null};for(const s of l){const u=vu[s.type];u&&u(o,s.data,s.timestamp);const f=bu(s);f&&o.eventLog.push(f);const d=wu(s);d&&o.activityLog.push(d),o.lastEventTime=s.timestamp}return o})},setReplayPlaying:n=>{e({replayPlaying:n})},setReplaySpeed:n=>{e({replaySpeed:n})},setWsStatus:n=>{e({wsStatus:n})},setEdgeHighlight:(n,i,l)=>{e(o=>({highlightedEdges:[...o.highlightedEdges.filter(s=>!(s.from===n&&s.to===i)),{from:n,to:i,state:l}]}))},clearEdgeHighlight:(n,i)=>{e(l=>({highlightedEdges:l.highlightedEdges.filter(o=>!(o.from===n&&o.to===i))}))}})),vu={workflow_started:(e,n,i)=>{const l=n;e.workflowStatus="running",e.workflowStartTime=i??Date.now()/1e3,e.workflowName=l.name||"",e.workflowYaml=l.yaml_source??null,e.conductorVersion=l.version??null,e.entryPoint=l.entry_point||null,e.agents=l.agents||[],e.routes=l.routes||[],e.parallelGroups=l.parallel_groups||[],e.forEachGroups=l.for_each_groups||[],it(e.nodes,"$start","start"),e.nodes.$start.status="running",Fe(e.nodes,"$start");const o=new Set,s=new Set;for(const u of e.parallelGroups){for(const f of u.agents)o.add(f);s.add(u.name),it(e.nodes,u.name,"parallel_group"),e.groupProgress[u.name]={total:u.agents.length,completed:0,failed:0};for(const f of u.agents)it(e.nodes,f,"agent")}for(const u of e.forEachGroups)s.add(u.name),it(e.nodes,u.name,"for_each_group"),e.groupProgress[u.name]={total:0,completed:0,failed:0};for(const u of e.agents)if(!s.has(u.name)&&!o.has(u.name)){const f=u.type||"agent";it(e.nodes,u.name,f),u.model&&(e.nodes[u.name].model=u.model),s.add(u.name)}e.agentsTotal=s.size},agent_started:(e,n,i)=>{const l=n,o=it(e.nodes,l.agent_name);o.iteration!=null&&(o.output!=null||o.error_type!=null)&&(o.iterationHistory||(o.iterationHistory=[]),o.iterationHistory.push({iteration:o.iteration,prompt:o.prompt,output:o.output,elapsed:o.elapsed,model:o.model,tokens:o.tokens,input_tokens:o.input_tokens,output_tokens:o.output_tokens,cost_usd:o.cost_usd,activity:o.activity,error_type:o.error_type,error_message:o.error_message})),o.status="running",o.iteration=l.iteration,o.startedAt=i??Date.now()/1e3,o.activity=[],l.context_window_max!=null&&(o.context_window_max=l.context_window_max),o.prompt=void 0,o.output=void 0,o.error_type=void 0,o.error_message=void 0,Fe(e.nodes,l.agent_name)},agent_completed:(e,n)=>{const i=n,l=it(e.nodes,i.agent_name);l.status="completed",e.agentsCompleted++,l.elapsed=i.elapsed,l.model=i.model,l.tokens=i.tokens,l.input_tokens=i.input_tokens,l.output_tokens=i.output_tokens,l.cost_usd=i.cost_usd,l.output=i.output,l.output_keys=i.output_keys,l.context_window_used=i.context_window_used,l.context_window_max=i.context_window_max,i.context_window_used!=null&&i.context_window_max!=null&&i.context_window_max>0&&(l.context_pct=Math.round(i.context_window_used/i.context_window_max*100)),i.cost_usd&&(e.totalCost+=i.cost_usd),i.tokens&&(e.totalTokens+=i.tokens),Fe(e.nodes,i.agent_name)},agent_failed:(e,n)=>{const i=n,l=it(e.nodes,i.agent_name);l.status="failed",l.elapsed=i.elapsed,l.error_type=i.error_type,l.error_message=i.message;for(const o of e.routes)o.to===i.agent_name&&(e.highlightedEdges=[...e.highlightedEdges.filter(s=>!(s.from===o.from&&s.to===o.to)),{from:o.from,to:o.to,state:"failed"}]);Fe(e.nodes,i.agent_name)},agent_prompt_rendered:(e,n)=>{var s;const i=n,l=n.item_key,o=it(e.nodes,i.agent_name);if(o.prompt=i.rendered_prompt,o.context_keys=i.context_keys,l){lo(e.nodes,i.agent_name,l,{type:"prompt",icon:"📝",label:"prompt",text:"Prompt rendered",detail:((s=i.rendered_prompt)==null?void 0:s.slice(0,500))||null});const u=e.nodes[i.agent_name];if(u!=null&&u.for_each_items){const f=u.for_each_items.find(d=>d.key===l);f&&(f.prompt=i.rendered_prompt)}}Fe(e.nodes,i.agent_name)},agent_reasoning:(e,n)=>{const i=n,l=n.item_key,o={type:"reasoning",icon:"💭",label:"thinking",text:i.content};xu(e.nodes,i.agent_name,o),l&&lo(e.nodes,i.agent_name,l,o),Fe(e.nodes,i.agent_name)},agent_tool_start:(e,n)=>{const i=n,l=n.item_key,o={type:"tool-start",icon:"🔧",label:"tool",text:i.tool_name,detail:i.arguments||null};xu(e.nodes,i.agent_name,o),l&&lo(e.nodes,i.agent_name,l,o),Fe(e.nodes,i.agent_name)},agent_tool_complete:(e,n)=>{const i=n,l=n.item_key,o={type:"tool-complete",icon:"✓",label:"result",text:i.tool_name||"done",detail:i.result||null};xu(e.nodes,i.agent_name,o),l&&lo(e.nodes,i.agent_name,l,o),Fe(e.nodes,i.agent_name)},agent_turn_start:(e,n)=>{const i=n,l=n.item_key,o={type:"turn",icon:"⏳",label:"turn",text:`Turn ${i.turn??"?"}`};xu(e.nodes,i.agent_name,o),l&&lo(e.nodes,i.agent_name,l,o),Fe(e.nodes,i.agent_name)},agent_message:(e,n)=>{const i=n,l=it(e.nodes,i.agent_name);l.latest_message=i.content,Fe(e.nodes,i.agent_name)},script_started:(e,n,i)=>{const l=n,o=it(e.nodes,l.agent_name);o.status="running",o.startedAt=i??Date.now()/1e3,Fe(e.nodes,l.agent_name)},script_completed:(e,n)=>{const i=n,l=it(e.nodes,i.agent_name);l.status="completed",e.agentsCompleted++,l.elapsed=i.elapsed,l.stdout=i.stdout,l.stderr=i.stderr,l.exit_code=i.exit_code,Fe(e.nodes,i.agent_name)},script_failed:(e,n)=>{const i=n,l=it(e.nodes,i.agent_name);l.status="failed",l.elapsed=i.elapsed,l.error_type=i.error_type,l.error_message=i.message,Fe(e.nodes,i.agent_name)},gate_presented:(e,n)=>{const i=n,l=it(e.nodes,i.agent_name);l.status="waiting",l.options=i.options,l.option_details=i.option_details,l.prompt=i.prompt,Fe(e.nodes,i.agent_name)},gate_resolved:(e,n)=>{const i=n,l=it(e.nodes,i.agent_name);l.status="completed",e.agentsCompleted++,l.selected_option=i.selected_option,l.route=i.route,l.additional_input=i.additional_input,Fe(e.nodes,i.agent_name)},route_taken:(e,n)=>{const i=n;e.highlightedEdges=[...e.highlightedEdges.filter(l=>!(l.from===i.from_agent&&l.to===i.to_agent)),{from:i.from_agent,to:i.to_agent,state:"taken"}]},parallel_started:(e,n)=>{const i=n,l=it(e.nodes,i.group_name,"parallel_group");l.status="running",e.groupProgress[i.group_name]&&(e.groupProgress[i.group_name].total=i.agents.length,e.groupProgress[i.group_name].completed=0,e.groupProgress[i.group_name].failed=0),Fe(e.nodes,i.group_name)},parallel_agent_completed:(e,n)=>{const i=n;e.groupProgress[i.group_name]&&e.groupProgress[i.group_name].completed++;const l=it(e.nodes,i.agent_name);l.status="completed",l.elapsed=i.elapsed,l.model=i.model,l.tokens=i.tokens,l.cost_usd=i.cost_usd,l.context_window_used=i.context_window_used,l.context_window_max=i.context_window_max,i.context_window_used!=null&&i.context_window_max!=null&&i.context_window_max>0&&(l.context_pct=Math.round(i.context_window_used/i.context_window_max*100)),i.cost_usd&&(e.totalCost+=i.cost_usd),i.tokens&&(e.totalTokens+=i.tokens),Fe(e.nodes,i.agent_name),Fe(e.nodes,i.group_name)},parallel_agent_failed:(e,n)=>{const i=n;e.groupProgress[i.group_name]&&e.groupProgress[i.group_name].failed++;const l=it(e.nodes,i.agent_name);l.status="failed",l.elapsed=i.elapsed,l.error_type=i.error_type,l.error_message=i.message,Fe(e.nodes,i.agent_name),Fe(e.nodes,i.group_name)},parallel_completed:(e,n)=>{const i=n;e.agentsCompleted++;const l=it(e.nodes,i.group_name,"parallel_group");l.status=i.failure_count===0?"completed":"failed",Fe(e.nodes,i.group_name)},for_each_started:(e,n)=>{const i=n,l=it(e.nodes,i.group_name,"for_each_group");l.status="running",l.for_each_items=[],e.groupProgress[i.group_name]&&(e.groupProgress[i.group_name].total=i.item_count,e.groupProgress[i.group_name].completed=0,e.groupProgress[i.group_name].failed=0),Fe(e.nodes,i.group_name)},for_each_item_started:(e,n)=>{const i=n,l=it(e.nodes,i.group_name,"for_each_group");l.for_each_items||(l.for_each_items=[]),l.for_each_items.push({key:i.item_key??String(i.index),index:i.index,status:"running",activity:[]}),Fe(e.nodes,i.group_name)},for_each_item_completed:(e,n)=>{const i=n;e.groupProgress[i.group_name]&&e.groupProgress[i.group_name].completed++;const l=it(e.nodes,i.group_name,"for_each_group");if(l.for_each_items){const o=i.item_key??String(i.index),s=l.for_each_items.find(u=>u.key===o);s&&(s.status="completed",s.elapsed=i.elapsed,s.tokens=i.tokens,s.cost_usd=i.cost_usd,s.output=i.output)}Fe(e.nodes,i.group_name)},for_each_item_failed:(e,n)=>{const i=n;e.groupProgress[i.group_name]&&e.groupProgress[i.group_name].failed++;const l=it(e.nodes,i.group_name,"for_each_group");if(l.for_each_items){const o=i.item_key??String(i.index),s=l.for_each_items.find(u=>u.key===o);s&&(s.status="failed",s.elapsed=i.elapsed,s.error_type=i.error_type,s.error_message=i.message)}Fe(e.nodes,i.group_name)},for_each_completed:(e,n)=>{const i=n;e.agentsCompleted++;const l=it(e.nodes,i.group_name,"for_each_group");l.status=(i.failure_count??0)===0?"completed":"failed",l.elapsed=i.elapsed,l.success_count=i.success_count,l.failure_count=i.failure_count,Fe(e.nodes,i.group_name)},workflow_completed:(e,n)=>{const i=n;e.workflowStatus="completed",e.isPaused=!1,e.workflowOutput=i.output??null,e.nodes.$end&&(e.nodes.$end.status="completed",Fe(e.nodes,"$end")),e.nodes.$start&&(e.nodes.$start.status="completed",Fe(e.nodes,"$start")),e.highlightedEdges=[]},workflow_failed:(e,n)=>{const i=n;if(e.workflowStatus="failed",e.isPaused=!1,e.workflowFailedAgent=i.agent_name||null,i.agent_name&&e.nodes[i.agent_name]){e.nodes[i.agent_name].status="failed",Fe(e.nodes,i.agent_name);for(const l of e.routes)l.to===i.agent_name&&(e.highlightedEdges=[...e.highlightedEdges.filter(o=>!(o.from===l.from&&o.to===l.to)),{from:l.from,to:l.to,state:"failed"}])}e.workflowFailure={error_type:i.error_type,message:i.message,elapsed_seconds:i.elapsed_seconds,timeout_seconds:i.timeout_seconds,current_agent:i.current_agent},e.nodes.$start&&(e.nodes.$start.status="completed",Fe(e.nodes,"$start"))},checkpoint_saved:(e,n)=>{const i=n;i.path&&e.workflowFailure&&(e.workflowFailure={...e.workflowFailure,checkpoint_path:i.path})},agent_paused:(e,n)=>{const i=n,l=it(e.nodes,i.agent_name);l.status="waiting",l.activity.push({type:"agent_paused",icon:"⏸",label:"Paused",text:"Agent paused — click Resume to re-execute"}),Fe(e.nodes,i.agent_name),e.isPaused=!0},agent_resumed:(e,n)=>{const i=n,l=it(e.nodes,i.agent_name);l.status="running",l.activity.push({type:"agent_resumed",icon:"▶",label:"Resumed",text:"Agent resumed — re-executing"}),Fe(e.nodes,i.agent_name),e.isPaused=!1}};function bu(e){var l,o;const n=e.timestamp,i=e.data;switch(e.type){case"workflow_started":return{timestamp:n,level:"info",source:"workflow",message:`Workflow "${i.name||""}" started`};case"agent_started":return{timestamp:n,level:"info",source:String(i.agent_name),message:`Agent started${i.iteration!=null?` (iteration ${i.iteration})`:""}`};case"agent_completed":return{timestamp:n,level:"success",source:String(i.agent_name),message:`Agent completed${i.elapsed!=null?` in ${Du(i.elapsed)}`:""}${i.tokens!=null?` · ${i.tokens.toLocaleString()} tokens`:""}${i.cost_usd!=null?` · $${i.cost_usd.toFixed(4)}`:""}`};case"agent_failed":return{timestamp:n,level:"error",source:String(i.agent_name),message:`Agent failed: ${i.message||i.error_type||"unknown error"}`};case"script_started":return{timestamp:n,level:"info",source:String(i.agent_name),message:"Script started"};case"script_completed":return{timestamp:n,level:"success",source:String(i.agent_name),message:`Script completed (exit ${i.exit_code??"?"})${i.elapsed!=null?` in ${Du(i.elapsed)}`:""}`};case"script_failed":return{timestamp:n,level:"error",source:String(i.agent_name),message:`Script failed: ${i.message||i.error_type||"unknown error"}`};case"gate_presented":return{timestamp:n,level:"warning",source:String(i.agent_name),message:"Waiting for human input…"};case"gate_resolved":return{timestamp:n,level:"success",source:String(i.agent_name),message:`Gate resolved → ${i.selected_option||"continue"}`};case"route_taken":return{timestamp:n,level:"debug",source:"router",message:`${i.from_agent} → ${i.to_agent}`};case"parallel_started":return{timestamp:n,level:"info",source:String(i.group_name),message:`Parallel group started (${((l=i.agents)==null?void 0:l.length)||"?"} agents)`};case"parallel_completed":return{timestamp:n,level:i.failure_count===0?"success":"error",source:String(i.group_name),message:`Parallel group completed${i.failure_count>0?` with ${i.failure_count} failure(s)`:""}`};case"for_each_started":return{timestamp:n,level:"info",source:String(i.group_name),message:`For-each started (${i.item_count} items)`};case"for_each_completed":return{timestamp:n,level:(i.failure_count??0)===0?"success":"error",source:String(i.group_name),message:`For-each completed · ${i.success_count} succeeded${i.failure_count>0?` · ${i.failure_count} failed`:""}`};case"workflow_completed":return{timestamp:n,level:"success",source:"workflow",message:`Workflow completed${i.elapsed!=null?` in ${Du(i.elapsed)}`:""}`};case"workflow_failed":return{timestamp:n,level:"error",source:"workflow",message:`Workflow failed: ${i.message||i.error_type||"unknown error"}`};case"checkpoint_saved":return{timestamp:n,level:"info",source:"workflow",message:`Checkpoint saved: ${((o=i.path)==null?void 0:o.split("/").pop())||"unknown"}`};case"agent_paused":return{timestamp:n,level:"warning",source:String(i.agent_name),message:"Agent paused — waiting for resume"};case"agent_resumed":return{timestamp:n,level:"info",source:String(i.agent_name),message:"Agent resumed — re-executing"};default:return null}}function Du(e){if(e<1)return`${(e*1e3).toFixed(0)}ms`;if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e/60),i=(e%60).toFixed(0);return`${n}m ${i}s`}function wu(e){const n=e.timestamp,i=e.data;switch(e.type){case"agent_started":return{timestamp:n,source:String(i.agent_name),type:"turn",message:`Agent started${i.iteration!=null?` (iteration ${i.iteration})`:""}`};case"agent_prompt_rendered":return{timestamp:n,source:String(i.agent_name),type:"prompt",message:"Prompt rendered",detail:ao(String(i.rendered_prompt||""),500)};case"agent_reasoning":return{timestamp:n,source:String(i.agent_name),type:"reasoning",message:String(i.content||"")};case"agent_tool_start":return{timestamp:n,source:String(i.agent_name),type:"tool-start",message:`→ ${i.tool_name}`,detail:i.arguments?ao(String(i.arguments),300):null};case"agent_tool_complete":return{timestamp:n,source:String(i.agent_name),type:"tool-complete",message:`← ${i.tool_name||"done"}`,detail:i.result?ao(String(i.result),300):null};case"agent_turn_start":return{timestamp:n,source:String(i.agent_name),type:"turn",message:`Turn ${i.turn??"?"}`};case"agent_message":return{timestamp:n,source:String(i.agent_name),type:"message",message:ao(String(i.content||""),500)};case"agent_completed":return{timestamp:n,source:String(i.agent_name),type:"turn",message:`Completed${i.elapsed!=null?` in ${Du(i.elapsed)}`:""}${i.tokens!=null?` · ${i.tokens.toLocaleString()} tokens`:""}`};case"agent_failed":return{timestamp:n,source:String(i.agent_name),type:"turn",message:`Failed: ${i.message||i.error_type||"unknown"}`};case"script_started":return{timestamp:n,source:String(i.agent_name),type:"turn",message:"Script started"};case"script_completed":return{timestamp:n,source:String(i.agent_name),type:"tool-complete",message:`Script completed (exit ${i.exit_code??"?"})`,detail:i.stdout?ao(String(i.stdout),300):null};case"script_failed":return{timestamp:n,source:String(i.agent_name),type:"turn",message:`Script failed: ${i.message||i.error_type||"unknown"}`};default:return null}}function ao(e,n){return e.length<=n?e:e.slice(0,n)+"…"}function _x(e){const n=e.match(/^(\s*)/);return n?n[1].length:0}function xN(e){const n=new Map;for(let i=0;io)s=u;else break}s>i&&n.set(i,s)}return n}function vN(e){if(/^\s*#/.test(e))return b.jsx("span",{className:"text-emerald-500/70",children:e});const n=e.match(/^(\s*)(- )?([a-zA-Z_][\w.-]*)(:\s*)(.*)/);if(n){const[,l,o,s,u,f]=n;return b.jsxs("span",{children:[l,o??"",b.jsx("span",{className:"text-sky-400",children:s}),b.jsx("span",{className:"text-[var(--text-muted)]",children:u}),Ex(f)]})}const i=e.match(/^(\s*)(- )(.*)/);if(i){const[,l,o,s]=i;return b.jsxs("span",{children:[l,b.jsx("span",{className:"text-[var(--text-muted)]",children:o}),Ex(s)]})}return b.jsx("span",{children:e})}function Ex(e){if(!e)return"";const n=e.indexOf(" #"),i=n>=0?e.slice(0,n):e,l=n>=0?e.slice(n):"";let o=i;return/^(true|false|null|yes|no)$/i.test(i.trim())?o=b.jsx("span",{className:"text-amber-400",children:i}):/^\d+(\.\d+)?$/.test(i.trim())?o=b.jsx("span",{className:"text-amber-400",children:i}):/^["'].*["']$/.test(i.trim())?o=b.jsx("span",{className:"text-green-400",children:i}):(i.includes("|")||i.includes(">"))&&(o=b.jsx("span",{className:"text-[var(--text-secondary)]",children:i})),b.jsxs(b.Fragment,{children:[o,l&&b.jsx("span",{className:"text-emerald-500/70",children:l})]})}function bN({yaml:e,onClose:n}){const[i,l]=V.useState(new Set);V.useEffect(()=>{const d=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[n]);const o=V.useMemo(()=>e.split(` +`),[e]),s=V.useMemo(()=>xN(o),[o]),u=V.useCallback(d=>{l(h=>{const m=new Set(h);return m.has(d)?m.delete(d):m.add(d),m})},[]),f=V.useMemo(()=>{const d=[];let h=-1;for(let m=0;mb.jsxs("div",{className:"flex",children:[b.jsx("span",{className:"inline-flex items-center justify-center flex-shrink-0",style:{width:"1.25rem"},children:m?b.jsx("button",{onClick:()=>u(d),className:"text-[var(--text-muted)] hover:text-[var(--text)] p-0 leading-none",style:{background:"none",border:"none",cursor:"pointer"},children:p?b.jsx(la,{className:"w-3 h-3"}):b.jsx(Pi,{className:"w-3 h-3"})}):null}),b.jsxs("span",{className:"flex-1",children:[vN(h),p&&b.jsx("span",{className:"text-[var(--text-muted)] text-[11px] ml-2 px-1.5 py-0.5 rounded bg-[var(--surface-hover)] cursor-pointer",onClick:()=>u(d),children:"···"})]})]},d))})})]})]})}function wN(){const e=he(S=>S.workflowName),n=he(S=>S.workflowStatus),i=he(S=>S.isPaused),l=he(S=>S.workflowYaml),o=he(S=>S.conductorVersion),[s,u]=V.useState(!1),[f,d]=V.useState(!1),[h,m]=V.useState(!1),[p,y]=V.useState(!1),v=n==="running"||n==="pending";V.useEffect(()=>{i||(u(!1),d(!1),m(!1))},[i]);const w=async()=>{u(!0);try{await fetch("/api/stop",{method:"POST"})}catch(S){console.error("Failed to stop agent:",S),u(!1)}},E=async()=>{d(!0);try{await fetch("/api/resume",{method:"POST"})}catch(S){console.error("Failed to resume agent:",S),d(!1)}},_=async()=>{m(!0);try{await fetch("/api/kill",{method:"POST"})}catch(S){console.error("Failed to kill workflow:",S),m(!1)}};return b.jsxs("header",{className:"flex items-center justify-between px-4 py-2 bg-[var(--surface)] border-b border-[var(--border)] flex-shrink-0",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(kb,{className:"w-4 h-4 text-[var(--running)]"}),b.jsx("h1",{className:"text-sm font-semibold text-[var(--text)]",children:"Conductor"}),e&&b.jsxs("span",{className:"text-sm text-[var(--text-muted)] font-normal",children:["— ",e]})]}),b.jsxs("div",{className:"flex items-center gap-3",children:[i?b.jsxs(b.Fragment,{children:[b.jsxs("button",{onClick:E,disabled:f,className:`flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded\r + bg-emerald-500/10 text-emerald-400 border border-emerald-500/20\r + hover:bg-emerald-500/20 hover:border-emerald-500/30\r + disabled:opacity-50 disabled:cursor-not-allowed\r + transition-colors`,title:"Re-execute the paused agent",children:[b.jsx(Vp,{className:"w-3 h-3"}),f?"Resuming...":"Resume"]}),b.jsxs("button",{onClick:_,disabled:h,className:`flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded\r + bg-red-500/10 text-red-400 border border-red-500/20\r + hover:bg-red-500/20 hover:border-red-500/30\r + disabled:opacity-50 disabled:cursor-not-allowed\r + transition-colors`,title:"Stop workflow entirely (checkpoint saved for CLI resume)",children:[b.jsx(aa,{className:"w-3 h-3"}),h?"Killing...":"Kill"]})]}):v?b.jsxs("button",{onClick:w,disabled:s,className:`flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded\r + bg-red-500/10 text-red-400 border border-red-500/20\r + hover:bg-red-500/20 hover:border-red-500/30\r + disabled:opacity-50 disabled:cursor-not-allowed\r + transition-colors`,children:[b.jsx(zb,{className:"w-3 h-3"}),s?"Stopping...":"Stop"]}):null,l&&b.jsxs("button",{onClick:()=>y(!0),className:`flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded\r + bg-[var(--surface-hover)] text-[var(--text-secondary)] border border-[var(--border)]\r + hover:text-[var(--text)] hover:bg-[var(--surface)]\r + transition-colors`,title:"View workflow YAML configuration",children:[b.jsx(eN,{className:"w-3 h-3"}),"YAML"]}),b.jsxs("a",{href:"/api/logs",download:"conductor-logs.json",className:`flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded\r + bg-[var(--surface-hover)] text-[var(--text-secondary)] border border-[var(--border)]\r + hover:text-[var(--text)] hover:bg-[var(--surface)]\r + transition-colors`,title:"Download full event log as JSON",children:[b.jsx(J2,{className:"w-3 h-3"}),"Logs"]}),b.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["v",o??"—"]})]}),p&&l&&b.jsx(bN,{yaml:l,onClose:()=>y(!1)})]})}function Ye(...e){return e.filter(Boolean).join(" ")}function ln(e){if(e==null)return"";if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e/60),i=(e%60).toFixed(0);return`${n}m ${i}s`}function Wn(e){return e==null?"":e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:`${e}`}function Kl(e){return e==null?"":`$${e.toFixed(4)}`}function Mb(e){return e==null?"":typeof e=="string"?e:JSON.stringify(e,null,2)}function SN(e,n){if(n<=0)return`${e.toLocaleString()} tokens (limit unknown)`;const i=o=>o.toLocaleString(),l=(e/n*100).toFixed(1);return`${i(e)} / ${i(n)} (${l}%)`}function jb(){const e=he(f=>f.workflowStatus),n=he(f=>f.workflowStartTime),i=he(f=>f.replayMode),l=he(f=>f.lastEventTime),[o,s]=V.useState("—"),u=V.useRef(null);return V.useEffect(()=>{if(n!=null){if(i){u.current&&(clearInterval(u.current),u.current=null),s(ln((l??n)-n));return}if(e==="running"){const f=()=>{const d=Date.now()/1e3-n;s(ln(d))};return f(),u.current=setInterval(f,500),()=>{u.current&&clearInterval(u.current)}}else(e==="completed"||e==="failed")&&u.current&&(clearInterval(u.current),u.current=null)}},[e,n,i,l]),o}function _N(){const e=he(E=>E.workflowStatus),n=he(E=>E.agentsCompleted),i=he(E=>E.agentsTotal),l=he(E=>E.totalCost),o=he(E=>E.totalTokens),s=he(E=>E.wsStatus),u=he(E=>E.workflowFailure),f=he(E=>E.lastEventTime),d=jb(),[h,m]=V.useState(null);V.useEffect(()=>{if(e!=="running"||f==null){m(null);return}const E=()=>{m(Math.floor(Date.now()/1e3-f))};E();const _=setInterval(E,1e3);return()=>clearInterval(_)},[e,f]);const p=e==="failed",y=(()=>{switch(e){case"pending":return"Waiting for workflow…";case"running":return"Running";case"completed":return"Completed";case"failed":{if(!u)return"Failed";const E=u.error_type||"";return E==="MaxIterationsError"?"Failed: exceeded maximum iterations":E==="TimeoutError"?"Failed: workflow timed out":u.message?`Failed: ${u.message.length>60?u.message.slice(0,57)+"...":u.message}`:`Failed: ${E}`}}})(),v={pending:"bg-[var(--pending)]",running:"bg-[var(--running)] animate-pulse",completed:"bg-[var(--completed)]",failed:"bg-[var(--failed)]"}[e],w=(()=>{switch(s){case"connected":return b.jsxs("span",{className:"flex items-center gap-1 text-[var(--completed)]",children:[b.jsx(dN,{className:"w-3 h-3"}),b.jsx("span",{children:"Connected"})]});case"disconnected":return b.jsxs("span",{className:"flex items-center gap-1 text-[var(--failed)]",children:[b.jsx(fN,{className:"w-3 h-3"}),b.jsx("span",{children:"Disconnected"})]});case"reconnecting":return b.jsxs("span",{className:"flex items-center gap-1 text-[var(--waiting)]",children:[b.jsx(Zl,{className:"w-3 h-3 animate-spin"}),b.jsx("span",{children:"Reconnecting\\u2026"})]});case"connecting":return b.jsxs("span",{className:"flex items-center gap-1 text-[var(--text-muted)]",children:[b.jsx(Zl,{className:"w-3 h-3 animate-spin"}),b.jsx("span",{children:"Connecting\\u2026"})]})}})();return b.jsxs("footer",{className:Ye("flex items-center gap-4 px-4 py-1.5 border-t text-xs flex-shrink-0 transition-colors duration-300",p?"bg-red-950/50 border-red-500/30":"bg-[var(--surface)] border-[var(--border)]"),children:[b.jsx("span",{className:Ye("w-2 h-2 rounded-full flex-shrink-0",v)}),b.jsx("span",{className:Ye(p?"text-red-300":"text-[var(--text)]"),children:y}),i>0&&b.jsxs("span",{className:Ye(p?"text-red-400/60":"text-[var(--text-muted)]"),children:[n,"/",i," agents"]}),e!=="pending"&&b.jsx("span",{className:Ye("font-mono",p?"text-red-400/60":"text-[var(--text-muted)]"),children:d}),o>0&&b.jsxs("span",{className:Ye("flex items-center gap-1",p?"text-red-400/60":"text-[var(--text-muted)]"),title:"Total tokens used",children:[b.jsx(rN,{className:"w-3 h-3"}),b.jsx("span",{className:"font-mono",children:o.toLocaleString()})]}),l>0&&b.jsxs("span",{className:Ye("flex items-center gap-1",p?"text-red-400/60":"text-[var(--text-muted)]"),title:"Total cost",children:[b.jsx(K2,{className:"w-3 h-3"}),b.jsxs("span",{className:"font-mono",children:["$",l.toFixed(4)]})]}),h!=null&&h>=5&&b.jsxs("span",{className:Ye("flex items-center gap-1 font-mono",h>=60?"text-amber-400":"text-[var(--text-muted)]"),title:"Time since last event from the provider",children:[b.jsx(Z2,{className:"w-3 h-3"}),b.jsx("span",{children:h>=60?`${Math.floor(h/60)}m ${h%60}s idle`:`${h}s idle`})]}),b.jsx("span",{className:"flex-1"}),w]})}const EN=[1,5,10,20,50];function NN(e,n){if(n===0||e.length===0)return"+0.0s";const i=e[0].timestamp,o=e[Math.min(n,e.length)-1].timestamp-i;if(o<60)return`+${o.toFixed(1)}s`;const s=Math.floor(o/60),u=o%60;return`+${s}m${u.toFixed(0)}s`}function kN(){const e=he(p=>p.replayPosition),n=he(p=>p.replayTotalEvents),i=he(p=>p.replayPlaying),l=he(p=>p.replaySpeed),o=he(p=>p.replayEvents),s=he(p=>p.setReplayPosition),u=he(p=>p.setReplayPlaying),f=he(p=>p.setReplaySpeed),d=p=>{const y=parseInt(p.target.value,10);s(y),i&&u(!1)},h=()=>{!i&&e>=n&&s(0),u(!i)},m=n>0?e/n*100:0;return b.jsxs("footer",{className:"flex items-center gap-3 px-4 py-1.5 border-t bg-[var(--surface)] border-[var(--border)] text-xs flex-shrink-0",children:[b.jsx("button",{onClick:h,className:"flex items-center justify-center w-6 h-6 rounded hover:bg-[var(--surface-hover)] text-[var(--text-secondary)] hover:text-[var(--text)] transition-colors",title:i?"Pause":"Play",children:i?b.jsx(lN,{className:"w-3.5 h-3.5"}):b.jsx(Vp,{className:"w-3.5 h-3.5"})}),b.jsxs("div",{className:"flex-1 relative flex items-center",children:[b.jsx("input",{type:"range",min:0,max:n,value:e,onChange:d,className:"w-full h-1 appearance-none rounded-full cursor-pointer",style:{background:`linear-gradient(to right, var(--accent) 0%, var(--accent) ${m}%, var(--border) ${m}%, var(--border) 100%)`,WebkitAppearance:"none"}}),b.jsx("style",{children:` footer input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; @@ -265,7 +270,7 @@ Error generating stack: `+c.message+` cursor: pointer; box-shadow: 0 0 4px rgba(99, 102, 241, 0.4); } - `})]}),b.jsx("span",{className:"text-[var(--text-muted)] font-mono whitespace-nowrap",children:_N(o,e)}),b.jsxs("span",{className:"text-[var(--text-muted)] font-mono whitespace-nowrap",children:["Event ",e,"/",n]}),b.jsx("div",{className:"flex items-center gap-0.5",children:SN.map(p=>b.jsxs("button",{onClick:()=>f(p),className:Ye("px-1.5 py-0.5 rounded text-xs font-mono transition-colors",l===p?"bg-[var(--accent)] text-white":"text-[var(--text-muted)] hover:text-[var(--text-secondary)] hover:bg-[var(--surface-hover)]"),children:[p,"×"]},p))})]})}const ac=V.createContext(null);ac.displayName="PanelGroupContext";const gt={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},Yp=10,qi=V.useLayoutEffect,Nx=R2.useId,NN=typeof Nx=="function"?Nx:()=>null;let kN=0;function Gp(e=null){const n=NN(),i=V.useRef(e||n||null);return i.current===null&&(i.current=""+kN++),e??i.current}function Mb({children:e,className:n="",collapsedSize:i,collapsible:l,defaultSize:o,forwardedRef:s,id:u,maxSize:f,minSize:d,onCollapse:h,onExpand:m,onResize:p,order:y,style:v,tagName:w="div",...k}){const S=V.useContext(ac);if(S===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:_,expandPanel:z,getPanelSize:E,getPanelStyle:A,groupId:B,isPanelCollapsed:T,reevaluatePanelConstraints:q,registerPanel:M,resizePanel:D,unregisterPanel:X}=S,H=Gp(u),I=V.useRef({callbacks:{onCollapse:h,onExpand:m,onResize:p},constraints:{collapsedSize:i,collapsible:l,defaultSize:o,maxSize:f,minSize:d},id:H,idIsFromProps:u!==void 0,order:y});V.useRef({didLogMissingDefaultSizeWarning:!1}),qi(()=>{const{callbacks:L,constraints:G}=I.current,R={...G};I.current.id=H,I.current.idIsFromProps=u!==void 0,I.current.order=y,L.onCollapse=h,L.onExpand=m,L.onResize=p,G.collapsedSize=i,G.collapsible=l,G.defaultSize=o,G.maxSize=f,G.minSize=d,(R.collapsedSize!==G.collapsedSize||R.collapsible!==G.collapsible||R.maxSize!==G.maxSize||R.minSize!==G.minSize)&&q(I.current,R)}),qi(()=>{const L=I.current;return M(L),()=>{X(L)}},[y,H,M,X]),V.useImperativeHandle(s,()=>({collapse:()=>{_(I.current)},expand:L=>{z(I.current,L)},getId(){return H},getSize(){return E(I.current)},isCollapsed(){return T(I.current)},isExpanded(){return!T(I.current)},resize:L=>{D(I.current,L)}}),[_,z,E,T,H,D]);const ee=A(I.current,o);return V.createElement(w,{...k,children:e,className:n,id:H,style:{...ee,...v},[gt.groupId]:B,[gt.panel]:"",[gt.panelCollapsible]:l||void 0,[gt.panelId]:H,[gt.panelSize]:parseFloat(""+ee.flexGrow).toFixed(1)})}const fo=V.forwardRef((e,n)=>V.createElement(Mb,{...e,forwardedRef:n}));Mb.displayName="Panel";fo.displayName="forwardRef(Panel)";let mp=null,Lu=-1,ci=null;function CN(e,n){if(n){const i=(n&Lb)!==0,l=(n&Hb)!==0,o=(n&Bb)!==0,s=(n&qb)!==0;if(i)return o?"se-resize":s?"ne-resize":"e-resize";if(l)return o?"sw-resize":s?"nw-resize":"w-resize";if(o)return"s-resize";if(s)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function TN(){ci!==null&&(document.head.removeChild(ci),mp=null,ci=null,Lu=-1)}function Yd(e,n){var i,l;const o=CN(e,n);if(mp!==o){if(mp=o,ci===null&&(ci=document.createElement("style"),document.head.appendChild(ci)),Lu>=0){var s;(s=ci.sheet)===null||s===void 0||s.removeRule(Lu)}Lu=(i=(l=ci.sheet)===null||l===void 0?void 0:l.insertRule(`*{cursor: ${o} !important;}`))!==null&&i!==void 0?i:-1}}function jb(e){return e.type==="keydown"}function Ob(e){return e.type.startsWith("pointer")}function Rb(e){return e.type.startsWith("mouse")}function oc(e){if(Ob(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(Rb(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function zN(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function AN(e,n,i){return e.xn.x&&e.yn.y}function MN(e,n){if(e===n)throw new Error("Cannot compare node with itself");const i={a:Tx(e),b:Tx(n)};let l;for(;i.a.at(-1)===i.b.at(-1);)e=i.a.pop(),n=i.b.pop(),l=e;Re(l,"Stacking order can only be calculated for elements with a common ancestor");const o={a:Cx(kx(i.a)),b:Cx(kx(i.b))};if(o.a===o.b){const s=l.childNodes,u={a:i.a.at(-1),b:i.b.at(-1)};let f=s.length;for(;f--;){const d=s[f];if(d===u.a)return 1;if(d===u.b)return-1}}return Math.sign(o.a-o.b)}const jN=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function ON(e){var n;const i=getComputedStyle((n=Db(e))!==null&&n!==void 0?n:e).display;return i==="flex"||i==="inline-flex"}function RN(e){const n=getComputedStyle(e);return!!(n.position==="fixed"||n.zIndex!=="auto"&&(n.position!=="static"||ON(e))||+n.opacity<1||"transform"in n&&n.transform!=="none"||"webkitTransform"in n&&n.webkitTransform!=="none"||"mixBlendMode"in n&&n.mixBlendMode!=="normal"||"filter"in n&&n.filter!=="none"||"webkitFilter"in n&&n.webkitFilter!=="none"||"isolation"in n&&n.isolation==="isolate"||jN.test(n.willChange)||n.webkitOverflowScrolling==="touch")}function kx(e){let n=e.length;for(;n--;){const i=e[n];if(Re(i,"Missing node"),RN(i))return i}return null}function Cx(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Tx(e){const n=[];for(;e;)n.push(e),e=Db(e);return n}function Db(e){const{parentNode:n}=e;return n&&n instanceof ShadowRoot?n.host:n}const Lb=1,Hb=2,Bb=4,qb=8,DN=zN()==="coarse";let In=[],$l=!1,Li=new Map,sc=new Map;const Eo=new Set;function LN(e,n,i,l,o){var s;const{ownerDocument:u}=n,f={direction:i,element:n,hitAreaMargins:l,setResizeHandlerState:o},d=(s=Li.get(u))!==null&&s!==void 0?s:0;return Li.set(u,d+1),Eo.add(f),Gu(),function(){var m;sc.delete(e),Eo.delete(f);const p=(m=Li.get(u))!==null&&m!==void 0?m:1;if(Li.set(u,p-1),Gu(),p===1&&Li.delete(u),In.includes(f)){const y=In.indexOf(f);y>=0&&In.splice(y,1),Xp(),o("up",!0,null)}}}function HN(e){const{target:n}=e,{x:i,y:l}=oc(e);$l=!0,$p({target:n,x:i,y:l}),Gu(),In.length>0&&($u("down",e),e.preventDefault(),Ub(n)||e.stopImmediatePropagation())}function Gd(e){const{x:n,y:i}=oc(e);if($l&&e.buttons===0&&($l=!1,$u("up",e)),!$l){const{target:l}=e;$p({target:l,x:n,y:i})}$u("move",e),Xp(),In.length>0&&e.preventDefault()}function $d(e){const{target:n}=e,{x:i,y:l}=oc(e);sc.clear(),$l=!1,In.length>0&&(e.preventDefault(),Ub(n)||e.stopImmediatePropagation()),$u("up",e),$p({target:n,x:i,y:l}),Xp(),Gu()}function Ub(e){let n=e;for(;n;){if(n.hasAttribute(gt.resizeHandle))return!0;n=n.parentElement}return!1}function $p({target:e,x:n,y:i}){In.splice(0);let l=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(l=e),Eo.forEach(o=>{const{element:s,hitAreaMargins:u}=o,f=s.getBoundingClientRect(),{bottom:d,left:h,right:m,top:p}=f,y=DN?u.coarse:u.fine;if(n>=h-y&&n<=m+y&&i>=p-y&&i<=d+y){if(l!==null&&document.contains(l)&&s!==l&&!s.contains(l)&&!l.contains(s)&&MN(l,s)>0){let w=l,k=!1;for(;w&&!w.contains(s);){if(AN(w.getBoundingClientRect(),f)){k=!0;break}w=w.parentElement}if(k)return}In.push(o)}})}function Xd(e,n){sc.set(e,n)}function Xp(){let e=!1,n=!1;In.forEach(l=>{const{direction:o}=l;o==="horizontal"?e=!0:n=!0});let i=0;sc.forEach(l=>{i|=l}),e&&n?Yd("intersection",i):e?Yd("horizontal",i):n?Yd("vertical",i):TN()}let Pd=new AbortController;function Gu(){Pd.abort(),Pd=new AbortController;const e={capture:!0,signal:Pd.signal};Eo.size&&($l?(In.length>0&&Li.forEach((n,i)=>{const{body:l}=i;n>0&&(l.addEventListener("contextmenu",$d,e),l.addEventListener("pointerleave",Gd,e),l.addEventListener("pointermove",Gd,e))}),window.addEventListener("pointerup",$d,e),window.addEventListener("pointercancel",$d,e)):Li.forEach((n,i)=>{const{body:l}=i;n>0&&(l.addEventListener("pointerdown",HN,e),l.addEventListener("pointermove",Gd,e))}))}function $u(e,n){Eo.forEach(i=>{const{setResizeHandlerState:l}=i,o=In.includes(i);l(e,o,n)})}function BN(){const[e,n]=V.useState(0);return V.useCallback(()=>n(i=>i+1),[])}function Re(e,n){if(!e)throw console.error(n),Error(n)}function Vi(e,n,i=Yp){return e.toFixed(i)===n.toFixed(i)?0:e>n?1:-1}function kr(e,n,i=Yp){return Vi(e,n,i)===0}function yn(e,n,i){return Vi(e,n,i)===0}function qN(e,n,i){if(e.length!==n.length)return!1;for(let l=0;l0&&(e=e<0?0-_:_)}}}{const p=e<0?f:d,y=i[p];Re(y,`No panel constraints found for index ${p}`);const{collapsedSize:v=0,collapsible:w,minSize:k=0}=y;if(w){const S=n[p];if(Re(S!=null,`Previous layout not found for panel index ${p}`),yn(S,k)){const _=S-v;Vi(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}}{const p=e<0?1:-1;let y=e<0?d:f,v=0;for(;;){const k=n[y];Re(k!=null,`Previous layout not found for panel index ${y}`);const _=Il({panelConstraints:i,panelIndex:y,size:100})-k;if(v+=_,y+=p,y<0||y>=i.length)break}const w=Math.min(Math.abs(e),Math.abs(v));e=e<0?0-w:w}{let y=e<0?f:d;for(;y>=0&&y=0))break;e<0?y--:y++}}if(qN(o,u))return o;{const p=e<0?d:f,y=n[p];Re(y!=null,`Previous layout not found for panel index ${p}`);const v=y+h,w=Il({panelConstraints:i,panelIndex:p,size:v});if(u[p]=w,!yn(w,v)){let k=v-w,_=e<0?d:f;for(;_>=0&&_0?_--:_++}}}const m=u.reduce((p,y)=>y+p,0);return yn(m,100)?u:o}function UN({layout:e,panelsArray:n,pivotIndices:i}){let l=0,o=100,s=0,u=0;const f=i[0];Re(f!=null,"No pivot index found"),n.forEach((p,y)=>{const{constraints:v}=p,{maxSize:w=100,minSize:k=0}=v;y===f?(l=k,o=w):(s+=k,u+=w)});const d=Math.min(o,100-s),h=Math.max(l,100-u),m=e[f];return{valueMax:d,valueMin:h,valueNow:m}}function No(e,n=document){return Array.from(n.querySelectorAll(`[${gt.resizeHandleId}][data-panel-group-id="${e}"]`))}function Ib(e,n,i=document){const o=No(e,i).findIndex(s=>s.getAttribute(gt.resizeHandleId)===n);return o??null}function Vb(e,n,i){const l=Ib(e,n,i);return l!=null?[l,l+1]:[-1,-1]}function Yb(e,n=document){var i;if(n instanceof HTMLElement&&(n==null||(i=n.dataset)===null||i===void 0?void 0:i.panelGroupId)==e)return n;const l=n.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return l||null}function uc(e,n=document){const i=n.querySelector(`[${gt.resizeHandleId}="${e}"]`);return i||null}function IN(e,n,i,l=document){var o,s,u,f;const d=uc(n,l),h=No(e,l),m=d?h.indexOf(d):-1,p=(o=(s=i[m])===null||s===void 0?void 0:s.id)!==null&&o!==void 0?o:null,y=(u=(f=i[m+1])===null||f===void 0?void 0:f.id)!==null&&u!==void 0?u:null;return[p,y]}function VN({committedValuesRef:e,eagerValuesRef:n,groupId:i,layout:l,panelDataArray:o,panelGroupElement:s,setLayout:u}){V.useRef({didWarnAboutMissingResizeHandle:!1}),qi(()=>{if(!s)return;const f=No(i,s);for(let d=0;d{f.forEach((d,h)=>{d.removeAttribute("aria-controls"),d.removeAttribute("aria-valuemax"),d.removeAttribute("aria-valuemin"),d.removeAttribute("aria-valuenow")})}},[i,l,o,s]),V.useEffect(()=>{if(!s)return;const f=n.current;Re(f,"Eager values not found");const{panelDataArray:d}=f,h=Yb(i,s);Re(h!=null,`No group found for id "${i}"`);const m=No(i,s);Re(m,`No resize handles found for group id "${i}"`);const p=m.map(y=>{const v=y.getAttribute(gt.resizeHandleId);Re(v,"Resize handle element has no handle id attribute");const[w,k]=IN(i,v,d,s);if(w==null||k==null)return()=>{};const S=_=>{if(!_.defaultPrevented)switch(_.key){case"Enter":{_.preventDefault();const z=d.findIndex(E=>E.id===w);if(z>=0){const E=d[z];Re(E,`No panel data found for index ${z}`);const A=l[z],{collapsedSize:B=0,collapsible:T,minSize:q=0}=E.constraints;if(A!=null&&T){const M=ho({delta:yn(A,B)?q-B:B-A,initialLayout:l,panelConstraints:d.map(D=>D.constraints),pivotIndices:Vb(i,v,s),prevLayout:l,trigger:"keyboard"});l!==M&&u(M)}}break}}};return y.addEventListener("keydown",S),()=>{y.removeEventListener("keydown",S)}});return()=>{p.forEach(y=>y())}},[s,e,n,i,l,o,u])}function zx(e,n){if(e.length!==n.length)return!1;for(let i=0;is.constraints);let l=0,o=100;for(let s=0;s{const s=e[o];Re(s,`Panel data not found for index ${o}`);const{callbacks:u,constraints:f,id:d}=s,{collapsedSize:h=0,collapsible:m}=f,p=i[d];if(p==null||l!==p){i[d]=l;const{onCollapse:y,onExpand:v,onResize:w}=u;w&&w(l,p),m&&(y||v)&&(v&&(p==null||kr(p,h))&&!kr(l,h)&&v(),y&&(p==null||!kr(p,h))&&kr(l,h)&&y())}})}function Su(e,n){if(e.length!==n.length)return!1;for(let i=0;i{i!==null&&clearTimeout(i),i=setTimeout(()=>{e(...o)},n)}}function Ax(e){try{if(typeof localStorage<"u")e.getItem=n=>localStorage.getItem(n),e.setItem=(n,i)=>{localStorage.setItem(n,i)};else throw new Error("localStorage not supported in this environment")}catch(n){console.error(n),e.getItem=()=>null,e.setItem=()=>{}}}function $b(e){return`react-resizable-panels:${e}`}function Xb(e){return e.map(n=>{const{constraints:i,id:l,idIsFromProps:o,order:s}=n;return o?l:s?`${s}:${JSON.stringify(i)}`:JSON.stringify(i)}).sort((n,i)=>n.localeCompare(i)).join(",")}function Pb(e,n){try{const i=$b(e),l=n.getItem(i);if(l){const o=JSON.parse(l);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function FN(e,n,i){var l,o;const s=(l=Pb(e,i))!==null&&l!==void 0?l:{},u=Xb(n);return(o=s[u])!==null&&o!==void 0?o:null}function QN(e,n,i,l,o){var s;const u=$b(e),f=Xb(n),d=(s=Pb(e,o))!==null&&s!==void 0?s:{};d[f]={expandToSizes:Object.fromEntries(i.entries()),layout:l};try{o.setItem(u,JSON.stringify(d))}catch(h){console.error(h)}}function Mx({layout:e,panelConstraints:n}){const i=[...e],l=i.reduce((s,u)=>s+u,0);if(i.length!==n.length)throw Error(`Invalid ${n.length} panel layout: ${i.map(s=>`${s}%`).join(", ")}`);if(!yn(l,100)&&i.length>0)for(let s=0;s(Ax(po),po.getItem(e)),setItem:(e,n)=>{Ax(po),po.setItem(e,n)}},jx={};function Fb({autoSaveId:e=null,children:n,className:i="",direction:l,forwardedRef:o,id:s=null,onLayout:u=null,keyboardResizeBy:f=null,storage:d=po,style:h,tagName:m="div",...p}){const y=Gp(s),v=V.useRef(null),[w,k]=V.useState(null),[S,_]=V.useState([]),z=BN(),E=V.useRef({}),A=V.useRef(new Map),B=V.useRef(0),T=V.useRef({autoSaveId:e,direction:l,dragState:w,id:y,keyboardResizeBy:f,onLayout:u,storage:d}),q=V.useRef({layout:S,panelDataArray:[],panelDataArrayChanged:!1});V.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),V.useImperativeHandle(o,()=>({getId:()=>T.current.id,getLayout:()=>{const{layout:N}=q.current;return N},setLayout:N=>{const{onLayout:Y}=T.current,{layout:F,panelDataArray:K}=q.current,ne=Mx({layout:N,panelConstraints:K.map(re=>re.constraints)});zx(F,ne)||(_(ne),q.current.layout=ne,Y&&Y(ne),Dl(K,ne,E.current))}}),[]),qi(()=>{T.current.autoSaveId=e,T.current.direction=l,T.current.dragState=w,T.current.id=y,T.current.onLayout=u,T.current.storage=d}),VN({committedValuesRef:T,eagerValuesRef:q,groupId:y,layout:S,panelDataArray:q.current.panelDataArray,setLayout:_,panelGroupElement:v.current}),V.useEffect(()=>{const{panelDataArray:N}=q.current;if(e){if(S.length===0||S.length!==N.length)return;let Y=jx[e];Y==null&&(Y=PN(QN,ZN),jx[e]=Y);const F=[...N],K=new Map(A.current);Y(e,F,K,S,d)}},[e,S,d]),V.useEffect(()=>{});const M=V.useCallback(N=>{const{onLayout:Y}=T.current,{layout:F,panelDataArray:K}=q.current;if(N.constraints.collapsible){const ne=K.map(ve=>ve.constraints),{collapsedSize:re=0,panelSize:se,pivotIndices:ye}=Ri(K,N,F);if(Re(se!=null,`Panel size not found for panel "${N.id}"`),!kr(se,re)){A.current.set(N.id,se);const xe=ql(K,N)===K.length-1?se-re:re-se,pe=ho({delta:xe,initialLayout:F,panelConstraints:ne,pivotIndices:ye,prevLayout:F,trigger:"imperative-api"});Su(F,pe)||(_(pe),q.current.layout=pe,Y&&Y(pe),Dl(K,pe,E.current))}}},[]),D=V.useCallback((N,Y)=>{const{onLayout:F}=T.current,{layout:K,panelDataArray:ne}=q.current;if(N.constraints.collapsible){const re=ne.map(_e=>_e.constraints),{collapsedSize:se=0,panelSize:ye=0,minSize:ve=0,pivotIndices:xe}=Ri(ne,N,K),pe=Y??ve;if(kr(ye,se)){const _e=A.current.get(N.id),Me=_e!=null&&_e>=pe?_e:pe,st=ql(ne,N)===ne.length-1?ye-Me:Me-ye,We=ho({delta:st,initialLayout:K,panelConstraints:re,pivotIndices:xe,prevLayout:K,trigger:"imperative-api"});Su(K,We)||(_(We),q.current.layout=We,F&&F(We),Dl(ne,We,E.current))}}},[]),X=V.useCallback(N=>{const{layout:Y,panelDataArray:F}=q.current,{panelSize:K}=Ri(F,N,Y);return Re(K!=null,`Panel size not found for panel "${N.id}"`),K},[]),H=V.useCallback((N,Y)=>{const{panelDataArray:F}=q.current,K=ql(F,N);return XN({defaultSize:Y,dragState:w,layout:S,panelData:F,panelIndex:K})},[w,S]),I=V.useCallback(N=>{const{layout:Y,panelDataArray:F}=q.current,{collapsedSize:K=0,collapsible:ne,panelSize:re}=Ri(F,N,Y);return Re(re!=null,`Panel size not found for panel "${N.id}"`),ne===!0&&kr(re,K)},[]),ee=V.useCallback(N=>{const{layout:Y,panelDataArray:F}=q.current,{collapsedSize:K=0,collapsible:ne,panelSize:re}=Ri(F,N,Y);return Re(re!=null,`Panel size not found for panel "${N.id}"`),!ne||Vi(re,K)>0},[]),L=V.useCallback(N=>{const{panelDataArray:Y}=q.current;Y.push(N),Y.sort((F,K)=>{const ne=F.order,re=K.order;return ne==null&&re==null?0:ne==null?-1:re==null?1:ne-re}),q.current.panelDataArrayChanged=!0,z()},[z]);qi(()=>{if(q.current.panelDataArrayChanged){q.current.panelDataArrayChanged=!1;const{autoSaveId:N,onLayout:Y,storage:F}=T.current,{layout:K,panelDataArray:ne}=q.current;let re=null;if(N){const ye=FN(N,ne,F);ye&&(A.current=new Map(Object.entries(ye.expandToSizes)),re=ye.layout)}re==null&&(re=$N({panelDataArray:ne}));const se=Mx({layout:re,panelConstraints:ne.map(ye=>ye.constraints)});zx(K,se)||(_(se),q.current.layout=se,Y&&Y(se),Dl(ne,se,E.current))}}),qi(()=>{const N=q.current;return()=>{N.layout=[]}},[]);const G=V.useCallback(N=>{let Y=!1;const F=v.current;return F&&window.getComputedStyle(F,null).getPropertyValue("direction")==="rtl"&&(Y=!0),function(ne){ne.preventDefault();const re=v.current;if(!re)return()=>null;const{direction:se,dragState:ye,id:ve,keyboardResizeBy:xe,onLayout:pe}=T.current,{layout:_e,panelDataArray:Me}=q.current,{initialLayout:Ce}=ye??{},st=Vb(ve,N,re);let We=GN(ne,N,se,ye,xe,re);const zt=se==="horizontal";zt&&Y&&(We=-We);const Ut=Me.map(Mn=>Mn.constraints),Rt=ho({delta:We,initialLayout:Ce??_e,panelConstraints:Ut,pivotIndices:st,prevLayout:_e,trigger:jb(ne)?"keyboard":"mouse-or-touch"}),wn=!Su(_e,Rt);(Ob(ne)||Rb(ne))&&B.current!=We&&(B.current=We,!wn&&We!==0?zt?Xd(N,We<0?Lb:Hb):Xd(N,We<0?Bb:qb):Xd(N,0)),wn&&(_(Rt),q.current.layout=Rt,pe&&pe(Rt),Dl(Me,Rt,E.current))}},[]),R=V.useCallback((N,Y)=>{const{onLayout:F}=T.current,{layout:K,panelDataArray:ne}=q.current,re=ne.map(_e=>_e.constraints),{panelSize:se,pivotIndices:ye}=Ri(ne,N,K);Re(se!=null,`Panel size not found for panel "${N.id}"`);const xe=ql(ne,N)===ne.length-1?se-Y:Y-se,pe=ho({delta:xe,initialLayout:K,panelConstraints:re,pivotIndices:ye,prevLayout:K,trigger:"imperative-api"});Su(K,pe)||(_(pe),q.current.layout=pe,F&&F(pe),Dl(ne,pe,E.current))},[]),$=V.useCallback((N,Y)=>{const{layout:F,panelDataArray:K}=q.current,{collapsedSize:ne=0,collapsible:re}=Y,{collapsedSize:se=0,collapsible:ye,maxSize:ve=100,minSize:xe=0}=N.constraints,{panelSize:pe}=Ri(K,N,F);pe!=null&&(re&&ye&&kr(pe,ne)?kr(ne,se)||R(N,se):peve&&R(N,ve))},[R]),Z=V.useCallback((N,Y)=>{const{direction:F}=T.current,{layout:K}=q.current;if(!v.current)return;const ne=uc(N,v.current);Re(ne,`Drag handle element not found for id "${N}"`);const re=Gb(F,Y);k({dragHandleId:N,dragHandleRect:ne.getBoundingClientRect(),initialCursorPosition:re,initialLayout:K})},[]),J=V.useCallback(()=>{k(null)},[]),j=V.useCallback(N=>{const{panelDataArray:Y}=q.current,F=ql(Y,N);F>=0&&(Y.splice(F,1),delete E.current[N.id],q.current.panelDataArrayChanged=!0,z())},[z]),U=V.useMemo(()=>({collapsePanel:M,direction:l,dragState:w,expandPanel:D,getPanelSize:X,getPanelStyle:H,groupId:y,isPanelCollapsed:I,isPanelExpanded:ee,reevaluatePanelConstraints:$,registerPanel:L,registerResizeHandle:G,resizePanel:R,startDragging:Z,stopDragging:J,unregisterPanel:j,panelGroupElement:v.current}),[M,w,l,D,X,H,y,I,ee,$,L,G,R,Z,J,j]),P={display:"flex",flexDirection:l==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return V.createElement(ac.Provider,{value:U},V.createElement(m,{...p,children:n,className:i,id:s,ref:v,style:{...P,...h},[gt.group]:"",[gt.groupDirection]:l,[gt.groupId]:y}))}const gp=V.forwardRef((e,n)=>V.createElement(Fb,{...e,forwardedRef:n}));Fb.displayName="PanelGroup";gp.displayName="forwardRef(PanelGroup)";function ql(e,n){return e.findIndex(i=>i===n||i.id===n.id)}function Ri(e,n,i){const l=ql(e,n),s=l===e.length-1?[l-1,l]:[l,l+1],u=i[l];return{...n.constraints,panelSize:u,pivotIndices:s}}function KN({disabled:e,handleId:n,resizeHandler:i,panelGroupElement:l}){V.useEffect(()=>{if(e||i==null||l==null)return;const o=uc(n,l);if(o==null)return;const s=u=>{if(!u.defaultPrevented)switch(u.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{u.preventDefault(),i(u);break}case"F6":{u.preventDefault();const f=o.getAttribute(gt.groupId);Re(f,`No group element found for id "${f}"`);const d=No(f,l),h=Ib(f,n,l);Re(h!==null,`No resize element found for id "${n}"`);const m=u.shiftKey?h>0?h-1:d.length-1:h+1{o.removeEventListener("keydown",s)}},[l,e,n,i])}function yp({children:e=null,className:n="",disabled:i=!1,hitAreaMargins:l,id:o,onBlur:s,onClick:u,onDragging:f,onFocus:d,onPointerDown:h,onPointerUp:m,style:p={},tabIndex:y=0,tagName:v="div",...w}){var k,S;const _=V.useRef(null),z=V.useRef({onClick:u,onDragging:f,onPointerDown:h,onPointerUp:m});V.useEffect(()=>{z.current.onClick=u,z.current.onDragging=f,z.current.onPointerDown=h,z.current.onPointerUp=m});const E=V.useContext(ac);if(E===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:A,groupId:B,registerResizeHandle:T,startDragging:q,stopDragging:M,panelGroupElement:D}=E,X=Gp(o),[H,I]=V.useState("inactive"),[ee,L]=V.useState(!1),[G,R]=V.useState(null),$=V.useRef({state:H});qi(()=>{$.current.state=H}),V.useEffect(()=>{if(i)R(null);else{const U=T(X);R(()=>U)}},[i,X,T]);const Z=(k=l==null?void 0:l.coarse)!==null&&k!==void 0?k:15,J=(S=l==null?void 0:l.fine)!==null&&S!==void 0?S:5;V.useEffect(()=>{if(i||G==null)return;const U=_.current;Re(U,"Element ref not attached");let P=!1;return LN(X,U,A,{coarse:Z,fine:J},(Y,F,K)=>{if(!F){I("inactive");return}switch(Y){case"down":{I("drag"),P=!1,Re(K,'Expected event to be defined for "down" action'),q(X,K);const{onDragging:ne,onPointerDown:re}=z.current;ne==null||ne(!0),re==null||re();break}case"move":{const{state:ne}=$.current;P=!0,ne!=="drag"&&I("hover"),Re(K,'Expected event to be defined for "move" action'),G(K);break}case"up":{I("hover"),M();const{onClick:ne,onDragging:re,onPointerUp:se}=z.current;re==null||re(!1),se==null||se(),P||ne==null||ne();break}}})},[Z,A,i,J,T,X,G,q,M]),KN({disabled:i,handleId:X,resizeHandler:G,panelGroupElement:D});const j={touchAction:"none",userSelect:"none"};return V.createElement(v,{...w,children:e,className:n,id:o,onBlur:()=>{L(!1),s==null||s()},onFocus:()=>{L(!0),d==null||d()},ref:_,role:"separator",style:{...j,...p},tabIndex:y,[gt.groupDirection]:A,[gt.groupId]:B,[gt.resizeHandle]:"",[gt.resizeHandleActive]:H==="drag"?"pointer":ee?"keyboard":void 0,[gt.resizeHandleEnabled]:!i,[gt.resizeHandleId]:X,[gt.resizeHandleState]:H})}yp.displayName="PanelResizeHandle";function Tt(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let i=0,l;i{}};function cc(){for(var e=0,n=arguments.length,i={},l;e=0&&(l=i.slice(o+1),i=i.slice(0,o)),i&&!n.hasOwnProperty(i))throw new Error("unknown type: "+i);return{type:i,name:l}})}Hu.prototype=cc.prototype={constructor:Hu,on:function(e,n){var i=this._,l=WN(e+"",i),o,s=-1,u=l.length;if(arguments.length<2){for(;++s0)for(var i=new Array(o),l=0,o,s;l=0&&(n=e.slice(0,i))!=="xmlns"&&(e=e.slice(i+1)),Rx.hasOwnProperty(n)?{space:Rx[n],local:e}:e}function tk(e){return function(){var n=this.ownerDocument,i=this.namespaceURI;return i===xp&&n.documentElement.namespaceURI===xp?n.createElement(e):n.createElementNS(i,e)}}function nk(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Qb(e){var n=fc(e);return(n.local?nk:tk)(n)}function rk(){}function Pp(e){return e==null?rk:function(){return this.querySelector(e)}}function ik(e){typeof e!="function"&&(e=Pp(e));for(var n=this._groups,i=n.length,l=new Array(i),o=0;o=E&&(E=z+1);!(B=S[E])&&++E=0;)(u=l[o])&&(s&&u.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(u,s),s=u);return this}function zk(e){e||(e=Ak);function n(p,y){return p&&y?e(p.__data__,y.__data__):!p-!y}for(var i=this._groups,l=i.length,o=new Array(l),s=0;sn?1:e>=n?0:NaN}function Mk(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function jk(){return Array.from(this)}function Ok(){for(var e=this._groups,n=0,i=e.length;n1?this.each((n==null?Gk:typeof n=="function"?Xk:$k)(e,n,i??"")):Kl(this.node(),e)}function Kl(e,n){return e.style.getPropertyValue(n)||ew(e).getComputedStyle(e,null).getPropertyValue(n)}function Fk(e){return function(){delete this[e]}}function Qk(e,n){return function(){this[e]=n}}function Zk(e,n){return function(){var i=n.apply(this,arguments);i==null?delete this[e]:this[e]=i}}function Kk(e,n){return arguments.length>1?this.each((n==null?Fk:typeof n=="function"?Zk:Qk)(e,n)):this.node()[e]}function tw(e){return e.trim().split(/^|\s+/)}function Fp(e){return e.classList||new nw(e)}function nw(e){this._node=e,this._names=tw(e.getAttribute("class")||"")}nw.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function rw(e,n){for(var i=Fp(e),l=-1,o=n.length;++l=0&&(i=n.slice(l+1),n=n.slice(0,l)),{type:n,name:i}})}function NC(e){return function(){var n=this.__on;if(n){for(var i=0,l=-1,o=n.length,s;i()=>e;function vp(e,{sourceEvent:n,subject:i,target:l,identifier:o,active:s,x:u,y:f,dx:d,dy:h,dispatch:m}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:i,enumerable:!0,configurable:!0},target:{value:l,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:f,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:m}})}vp.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function DC(e){return!e.ctrlKey&&!e.button}function LC(){return this.parentNode}function HC(e,n){return n??{x:e.x,y:e.y}}function BC(){return navigator.maxTouchPoints||"ontouchstart"in this}function uw(){var e=DC,n=LC,i=HC,l=BC,o={},s=cc("start","drag","end"),u=0,f,d,h,m,p=0;function y(A){A.on("mousedown.drag",v).filter(l).on("touchstart.drag",S).on("touchmove.drag",_,RC).on("touchend.drag touchcancel.drag",z).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(A,B){if(!(m||!e.call(this,A,B))){var T=E(this,n.call(this,A,B),A,B,"mouse");T&&(xn(A.view).on("mousemove.drag",w,ko).on("mouseup.drag",k,ko),ow(A.view),Fd(A),h=!1,f=A.clientX,d=A.clientY,T("start",A))}}function w(A){if(Xl(A),!h){var B=A.clientX-f,T=A.clientY-d;h=B*B+T*T>p}o.mouse("drag",A)}function k(A){xn(A.view).on("mousemove.drag mouseup.drag",null),sw(A.view,h),Xl(A),o.mouse("end",A)}function S(A,B){if(e.call(this,A,B)){var T=A.changedTouches,q=n.call(this,A,B),M=T.length,D,X;for(D=0;D>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):i===8?Eu(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):i===4?Eu(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=UC.exec(e))?new nn(n[1],n[2],n[3],1):(n=IC.exec(e))?new nn(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=VC.exec(e))?Eu(n[1],n[2],n[3],n[4]):(n=YC.exec(e))?Eu(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=GC.exec(e))?Ix(n[1],n[2]/100,n[3]/100,1):(n=$C.exec(e))?Ix(n[1],n[2]/100,n[3]/100,n[4]):Dx.hasOwnProperty(e)?Bx(Dx[e]):e==="transparent"?new nn(NaN,NaN,NaN,0):null}function Bx(e){return new nn(e>>16&255,e>>8&255,e&255,1)}function Eu(e,n,i,l){return l<=0&&(e=n=i=NaN),new nn(e,n,i,l)}function FC(e){return e instanceof Uo||(e=Yi(e)),e?(e=e.rgb(),new nn(e.r,e.g,e.b,e.opacity)):new nn}function bp(e,n,i,l){return arguments.length===1?FC(e):new nn(e,n,i,l??1)}function nn(e,n,i,l){this.r=+e,this.g=+n,this.b=+i,this.opacity=+l}Qp(nn,bp,cw(Uo,{brighter(e){return e=e==null?Pu:Math.pow(Pu,e),new nn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Co:Math.pow(Co,e),new nn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new nn(Ui(this.r),Ui(this.g),Ui(this.b),Fu(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:qx,formatHex:qx,formatHex8:QC,formatRgb:Ux,toString:Ux}));function qx(){return`#${Hi(this.r)}${Hi(this.g)}${Hi(this.b)}`}function QC(){return`#${Hi(this.r)}${Hi(this.g)}${Hi(this.b)}${Hi((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ux(){const e=Fu(this.opacity);return`${e===1?"rgb(":"rgba("}${Ui(this.r)}, ${Ui(this.g)}, ${Ui(this.b)}${e===1?")":`, ${e})`}`}function Fu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ui(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Hi(e){return e=Ui(e),(e<16?"0":"")+e.toString(16)}function Ix(e,n,i,l){return l<=0?e=n=i=NaN:i<=0||i>=1?e=n=NaN:n<=0&&(e=NaN),new Bn(e,n,i,l)}function fw(e){if(e instanceof Bn)return new Bn(e.h,e.s,e.l,e.opacity);if(e instanceof Uo||(e=Yi(e)),!e)return new Bn;if(e instanceof Bn)return e;e=e.rgb();var n=e.r/255,i=e.g/255,l=e.b/255,o=Math.min(n,i,l),s=Math.max(n,i,l),u=NaN,f=s-o,d=(s+o)/2;return f?(n===s?u=(i-l)/f+(i0&&d<1?0:u,new Bn(u,f,d,e.opacity)}function ZC(e,n,i,l){return arguments.length===1?fw(e):new Bn(e,n,i,l??1)}function Bn(e,n,i,l){this.h=+e,this.s=+n,this.l=+i,this.opacity=+l}Qp(Bn,ZC,cw(Uo,{brighter(e){return e=e==null?Pu:Math.pow(Pu,e),new Bn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Co:Math.pow(Co,e),new Bn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,i=this.l,l=i+(i<.5?i:1-i)*n,o=2*i-l;return new nn(Qd(e>=240?e-240:e+120,o,l),Qd(e,o,l),Qd(e<120?e+240:e-120,o,l),this.opacity)},clamp(){return new Bn(Vx(this.h),Nu(this.s),Nu(this.l),Fu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Fu(this.opacity);return`${e===1?"hsl(":"hsla("}${Vx(this.h)}, ${Nu(this.s)*100}%, ${Nu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Vx(e){return e=(e||0)%360,e<0?e+360:e}function Nu(e){return Math.max(0,Math.min(1,e||0))}function Qd(e,n,i){return(e<60?n+(i-n)*e/60:e<180?i:e<240?n+(i-n)*(240-e)/60:n)*255}const Zp=e=>()=>e;function KC(e,n){return function(i){return e+i*n}}function JC(e,n,i){return e=Math.pow(e,i),n=Math.pow(n,i)-e,i=1/i,function(l){return Math.pow(e+l*n,i)}}function WC(e){return(e=+e)==1?dw:function(n,i){return i-n?JC(n,i,e):Zp(isNaN(n)?i:n)}}function dw(e,n){var i=n-e;return i?KC(e,i):Zp(isNaN(e)?n:e)}const Qu=(function e(n){var i=WC(n);function l(o,s){var u=i((o=bp(o)).r,(s=bp(s)).r),f=i(o.g,s.g),d=i(o.b,s.b),h=dw(o.opacity,s.opacity);return function(m){return o.r=u(m),o.g=f(m),o.b=d(m),o.opacity=h(m),o+""}}return l.gamma=e,l})(1);function e3(e,n){n||(n=[]);var i=e?Math.min(n.length,e.length):0,l=n.slice(),o;return function(s){for(o=0;oi&&(s=n.slice(i,s),f[u]?f[u]+=s:f[++u]=s),(l=l[0])===(o=o[0])?f[u]?f[u]+=o:f[++u]=o:(f[++u]=null,d.push({i:u,x:Kn(l,o)})),i=Zd.lastIndex;return i180?m+=360:m-h>180&&(h+=360),y.push({i:p.push(o(p)+"rotate(",null,l)-2,x:Kn(h,m)})):m&&p.push(o(p)+"rotate("+m+l)}function f(h,m,p,y){h!==m?y.push({i:p.push(o(p)+"skewX(",null,l)-2,x:Kn(h,m)}):m&&p.push(o(p)+"skewX("+m+l)}function d(h,m,p,y,v,w){if(h!==p||m!==y){var k=v.push(o(v)+"scale(",null,",",null,")");w.push({i:k-4,x:Kn(h,p)},{i:k-2,x:Kn(m,y)})}else(p!==1||y!==1)&&v.push(o(v)+"scale("+p+","+y+")")}return function(h,m){var p=[],y=[];return h=e(h),m=e(m),s(h.translateX,h.translateY,m.translateX,m.translateY,p,y),u(h.rotate,m.rotate,p,y),f(h.skewX,m.skewX,p,y),d(h.scaleX,h.scaleY,m.scaleX,m.scaleY,p,y),h=m=null,function(v){for(var w=-1,k=y.length,S;++w=0&&e._call.call(void 0,n),e=e._next;--Jl}function $x(){Gi=(Ku=zo.now())+dc,Jl=mo=0;try{m3()}finally{Jl=0,y3(),Gi=0}}function g3(){var e=zo.now(),n=e-Ku;n>gw&&(dc-=n,Ku=e)}function y3(){for(var e,n=Zu,i,l=1/0;n;)n._call?(l>n._time&&(l=n._time),e=n,n=n._next):(i=n._next,n._next=null,n=e?e._next=i:Zu=i);go=e,_p(l)}function _p(e){if(!Jl){mo&&(mo=clearTimeout(mo));var n=e-Gi;n>24?(e<1/0&&(mo=setTimeout($x,e-zo.now()-dc)),lo&&(lo=clearInterval(lo))):(lo||(Ku=zo.now(),lo=setInterval(g3,gw)),Jl=1,yw($x))}}function Xx(e,n,i){var l=new Ju;return n=n==null?0:+n,l.restart(o=>{l.stop(),e(o+n)},n,i),l}var x3=cc("start","end","cancel","interrupt"),v3=[],vw=0,Px=1,Ep=2,qu=3,Fx=4,Np=5,Uu=6;function hc(e,n,i,l,o,s){var u=e.__transition;if(!u)e.__transition={};else if(i in u)return;b3(e,i,{name:n,index:l,group:o,on:x3,tween:v3,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:vw})}function Jp(e,n){var i=Yn(e,n);if(i.state>vw)throw new Error("too late; already scheduled");return i}function rr(e,n){var i=Yn(e,n);if(i.state>qu)throw new Error("too late; already running");return i}function Yn(e,n){var i=e.__transition;if(!i||!(i=i[n]))throw new Error("transition not found");return i}function b3(e,n,i){var l=e.__transition,o;l[n]=i,i.timer=xw(s,0,i.time);function s(h){i.state=Px,i.timer.restart(u,i.delay,i.time),i.delay<=h&&u(h-i.delay)}function u(h){var m,p,y,v;if(i.state!==Px)return d();for(m in l)if(v=l[m],v.name===i.name){if(v.state===qu)return Xx(u);v.state===Fx?(v.state=Uu,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete l[m]):+mEp&&l.state=0&&(n=n.slice(0,i)),!n||n==="start"})}function Z3(e,n,i){var l,o,s=Q3(n)?Jp:rr;return function(){var u=s(this,e),f=u.on;f!==l&&(o=(l=f).copy()).on(n,i),u.on=o}}function K3(e,n){var i=this._id;return arguments.length<2?Yn(this.node(),i).on.on(e):this.each(Z3(i,e,n))}function J3(e){return function(){var n=this.parentNode;for(var i in this.__transition)if(+i!==e)return;n&&n.removeChild(this)}}function W3(){return this.on("end.remove",J3(this._id))}function eT(e){var n=this._name,i=this._id;typeof e!="function"&&(e=Pp(e));for(var l=this._groups,o=l.length,s=new Array(o),u=0;u()=>e;function NT(e,{sourceEvent:n,target:i,transform:l,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},transform:{value:l,enumerable:!0,configurable:!0},_:{value:o}})}function Cr(e,n,i){this.k=e,this.x=n,this.y=i}Cr.prototype={constructor:Cr,scale:function(e){return e===1?this:new Cr(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Cr(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var pc=new Cr(1,0,0);_w.prototype=Cr.prototype;function _w(e){for(;!e.__zoom;)if(!(e=e.parentNode))return pc;return e.__zoom}function Kd(e){e.stopImmediatePropagation()}function ao(e){e.preventDefault(),e.stopImmediatePropagation()}function kT(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function CT(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Qx(){return this.__zoom||pc}function TT(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function zT(){return navigator.maxTouchPoints||"ontouchstart"in this}function AT(e,n,i){var l=e.invertX(n[0][0])-i[0][0],o=e.invertX(n[1][0])-i[1][0],s=e.invertY(n[0][1])-i[0][1],u=e.invertY(n[1][1])-i[1][1];return e.translate(o>l?(l+o)/2:Math.min(0,l)||Math.max(0,o),u>s?(s+u)/2:Math.min(0,s)||Math.max(0,u))}function Ew(){var e=kT,n=CT,i=AT,l=TT,o=zT,s=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],f=250,d=Bu,h=cc("start","zoom","end"),m,p,y,v=500,w=150,k=0,S=10;function _(L){L.property("__zoom",Qx).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",X).filter(o).on("touchstart.zoom",H).on("touchmove.zoom",I).on("touchend.zoom touchcancel.zoom",ee).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(L,G,R,$){var Z=L.selection?L.selection():L;Z.property("__zoom",Qx),L!==Z?B(L,G,R,$):Z.interrupt().each(function(){T(this,arguments).event($).start().zoom(null,typeof G=="function"?G.apply(this,arguments):G).end()})},_.scaleBy=function(L,G,R,$){_.scaleTo(L,function(){var Z=this.__zoom.k,J=typeof G=="function"?G.apply(this,arguments):G;return Z*J},R,$)},_.scaleTo=function(L,G,R,$){_.transform(L,function(){var Z=n.apply(this,arguments),J=this.__zoom,j=R==null?A(Z):typeof R=="function"?R.apply(this,arguments):R,U=J.invert(j),P=typeof G=="function"?G.apply(this,arguments):G;return i(E(z(J,P),j,U),Z,u)},R,$)},_.translateBy=function(L,G,R,$){_.transform(L,function(){return i(this.__zoom.translate(typeof G=="function"?G.apply(this,arguments):G,typeof R=="function"?R.apply(this,arguments):R),n.apply(this,arguments),u)},null,$)},_.translateTo=function(L,G,R,$,Z){_.transform(L,function(){var J=n.apply(this,arguments),j=this.__zoom,U=$==null?A(J):typeof $=="function"?$.apply(this,arguments):$;return i(pc.translate(U[0],U[1]).scale(j.k).translate(typeof G=="function"?-G.apply(this,arguments):-G,typeof R=="function"?-R.apply(this,arguments):-R),J,u)},$,Z)};function z(L,G){return G=Math.max(s[0],Math.min(s[1],G)),G===L.k?L:new Cr(G,L.x,L.y)}function E(L,G,R){var $=G[0]-R[0]*L.k,Z=G[1]-R[1]*L.k;return $===L.x&&Z===L.y?L:new Cr(L.k,$,Z)}function A(L){return[(+L[0][0]+ +L[1][0])/2,(+L[0][1]+ +L[1][1])/2]}function B(L,G,R,$){L.on("start.zoom",function(){T(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event($).end()}).tween("zoom",function(){var Z=this,J=arguments,j=T(Z,J).event($),U=n.apply(Z,J),P=R==null?A(U):typeof R=="function"?R.apply(Z,J):R,N=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),Y=Z.__zoom,F=typeof G=="function"?G.apply(Z,J):G,K=d(Y.invert(P).concat(N/Y.k),F.invert(P).concat(N/F.k));return function(ne){if(ne===1)ne=F;else{var re=K(ne),se=N/re[2];ne=new Cr(se,P[0]-re[0]*se,P[1]-re[1]*se)}j.zoom(null,ne)}})}function T(L,G,R){return!R&&L.__zooming||new q(L,G)}function q(L,G){this.that=L,this.args=G,this.active=0,this.sourceEvent=null,this.extent=n.apply(L,G),this.taps=0}q.prototype={event:function(L){return L&&(this.sourceEvent=L),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(L,G){return this.mouse&&L!=="mouse"&&(this.mouse[1]=G.invert(this.mouse[0])),this.touch0&&L!=="touch"&&(this.touch0[1]=G.invert(this.touch0[0])),this.touch1&&L!=="touch"&&(this.touch1[1]=G.invert(this.touch1[0])),this.that.__zoom=G,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(L){var G=xn(this.that).datum();h.call(L,this.that,new NT(L,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:h}),G)}};function M(L,...G){if(!e.apply(this,arguments))return;var R=T(this,G).event(L),$=this.__zoom,Z=Math.max(s[0],Math.min(s[1],$.k*Math.pow(2,l.apply(this,arguments)))),J=Hn(L);if(R.wheel)(R.mouse[0][0]!==J[0]||R.mouse[0][1]!==J[1])&&(R.mouse[1]=$.invert(R.mouse[0]=J)),clearTimeout(R.wheel);else{if($.k===Z)return;R.mouse=[J,$.invert(J)],Iu(this),R.start()}ao(L),R.wheel=setTimeout(j,w),R.zoom("mouse",i(E(z($,Z),R.mouse[0],R.mouse[1]),R.extent,u));function j(){R.wheel=null,R.end()}}function D(L,...G){if(y||!e.apply(this,arguments))return;var R=L.currentTarget,$=T(this,G,!0).event(L),Z=xn(L.view).on("mousemove.zoom",P,!0).on("mouseup.zoom",N,!0),J=Hn(L,R),j=L.clientX,U=L.clientY;ow(L.view),Kd(L),$.mouse=[J,this.__zoom.invert(J)],Iu(this),$.start();function P(Y){if(ao(Y),!$.moved){var F=Y.clientX-j,K=Y.clientY-U;$.moved=F*F+K*K>k}$.event(Y).zoom("mouse",i(E($.that.__zoom,$.mouse[0]=Hn(Y,R),$.mouse[1]),$.extent,u))}function N(Y){Z.on("mousemove.zoom mouseup.zoom",null),sw(Y.view,$.moved),ao(Y),$.event(Y).end()}}function X(L,...G){if(e.apply(this,arguments)){var R=this.__zoom,$=Hn(L.changedTouches?L.changedTouches[0]:L,this),Z=R.invert($),J=R.k*(L.shiftKey?.5:2),j=i(E(z(R,J),$,Z),n.apply(this,G),u);ao(L),f>0?xn(this).transition().duration(f).call(B,j,$,L):xn(this).call(_.transform,j,$,L)}}function H(L,...G){if(e.apply(this,arguments)){var R=L.touches,$=R.length,Z=T(this,G,L.changedTouches.length===$).event(L),J,j,U,P;for(Kd(L),j=0;j<$;++j)U=R[j],P=Hn(U,this),P=[P,this.__zoom.invert(P),U.identifier],Z.touch0?!Z.touch1&&Z.touch0[2]!==P[2]&&(Z.touch1=P,Z.taps=0):(Z.touch0=P,J=!0,Z.taps=1+!!m);m&&(m=clearTimeout(m)),J&&(Z.taps<2&&(p=P[0],m=setTimeout(function(){m=null},v)),Iu(this),Z.start())}}function I(L,...G){if(this.__zooming){var R=T(this,G).event(L),$=L.changedTouches,Z=$.length,J,j,U,P;for(ao(L),J=0;J"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:n,sourceHandle:i,targetHandle:l})=>`Couldn't create edge for ${e} handle id: "${e==="source"?i:l}", edge id: ${n}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Ao=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Nw=["Enter"," ","Escape"],kw={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:n,y:i})=>`Moved selected node ${e}. New position, x: ${n}, y: ${i}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Wl;(function(e){e.Strict="strict",e.Loose="loose"})(Wl||(Wl={}));var Ii;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ii||(Ii={}));var Mo;(function(e){e.Partial="partial",e.Full="full"})(Mo||(Mo={}));const Cw={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var fi;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(fi||(fi={}));var Wu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Wu||(Wu={}));var we;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(we||(we={}));const Zx={[we.Left]:we.Right,[we.Right]:we.Left,[we.Top]:we.Bottom,[we.Bottom]:we.Top};function Tw(e){return e===null?null:e?"valid":"invalid"}const zw=e=>"id"in e&&"source"in e&&"target"in e,MT=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),em=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Io=(e,n=[0,0])=>{const{width:i,height:l}=Ar(e),o=e.origin??n,s=i*o[0],u=l*o[1];return{x:e.position.x-s,y:e.position.y-u}},jT=(e,n={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const i=e.reduce((l,o)=>{const s=typeof o=="string";let u=!n.nodeLookup&&!s?o:void 0;n.nodeLookup&&(u=s?n.nodeLookup.get(o):em(o)?o:n.nodeLookup.get(o.id));const f=u?ec(u,n.nodeOrigin):{x:0,y:0,x2:0,y2:0};return mc(l,f)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return gc(i)},Vo=(e,n={})=>{let i={x:1/0,y:1/0,x2:-1/0,y2:-1/0},l=!1;return e.forEach(o=>{(n.filter===void 0||n.filter(o))&&(i=mc(i,ec(o)),l=!0)}),l?gc(i):{x:0,y:0,width:0,height:0}},tm=(e,n,[i,l,o]=[0,0,1],s=!1,u=!1)=>{const f={...Go(n,[i,l,o]),width:n.width/o,height:n.height/o},d=[];for(const h of e.values()){const{measured:m,selectable:p=!0,hidden:y=!1}=h;if(u&&!p||y)continue;const v=m.width??h.width??h.initialWidth??null,w=m.height??h.height??h.initialHeight??null,k=jo(f,ta(h)),S=(v??0)*(w??0),_=s&&k>0;(!h.internals.handleBounds||_||k>=S||h.dragging)&&d.push(h)}return d},OT=(e,n)=>{const i=new Set;return e.forEach(l=>{i.add(l.id)}),n.filter(l=>i.has(l.source)||i.has(l.target))};function RT(e,n){const i=new Map,l=n!=null&&n.nodes?new Set(n.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((n==null?void 0:n.includeHiddenNodes)||!o.hidden)&&(!l||l.has(o.id))&&i.set(o.id,o)}),i}async function DT({nodes:e,width:n,height:i,panZoom:l,minZoom:o,maxZoom:s},u){if(e.size===0)return Promise.resolve(!0);const f=RT(e,u),d=Vo(f),h=nm(d,n,i,(u==null?void 0:u.minZoom)??o,(u==null?void 0:u.maxZoom)??s,(u==null?void 0:u.padding)??.1);return await l.setViewport(h,{duration:u==null?void 0:u.duration,ease:u==null?void 0:u.ease,interpolate:u==null?void 0:u.interpolate}),Promise.resolve(!0)}function Aw({nodeId:e,nextPosition:n,nodeLookup:i,nodeOrigin:l=[0,0],nodeExtent:o,onError:s}){const u=i.get(e),f=u.parentId?i.get(u.parentId):void 0,{x:d,y:h}=f?f.internals.positionAbsolute:{x:0,y:0},m=u.origin??l;let p=u.extent||o;if(u.extent==="parent"&&!u.expandParent)if(!f)s==null||s("005",tr.error005());else{const v=f.measured.width,w=f.measured.height;v&&w&&(p=[[d,h],[d+v,h+w]])}else f&&na(u.extent)&&(p=[[u.extent[0][0]+d,u.extent[0][1]+h],[u.extent[1][0]+d,u.extent[1][1]+h]]);const y=na(p)?$i(n,p,u.measured):n;return(u.measured.width===void 0||u.measured.height===void 0)&&(s==null||s("015",tr.error015())),{position:{x:y.x-d+(u.measured.width??0)*m[0],y:y.y-h+(u.measured.height??0)*m[1]},positionAbsolute:y}}async function LT({nodesToRemove:e=[],edgesToRemove:n=[],nodes:i,edges:l,onBeforeDelete:o}){const s=new Set(e.map(y=>y.id)),u=[];for(const y of i){if(y.deletable===!1)continue;const v=s.has(y.id),w=!v&&y.parentId&&u.find(k=>k.id===y.parentId);(v||w)&&u.push(y)}const f=new Set(n.map(y=>y.id)),d=l.filter(y=>y.deletable!==!1),m=OT(u,d);for(const y of d)f.has(y.id)&&!m.find(w=>w.id===y.id)&&m.push(y);if(!o)return{edges:m,nodes:u};const p=await o({nodes:u,edges:m});return typeof p=="boolean"?p?{edges:m,nodes:u}:{edges:[],nodes:[]}:p}const ea=(e,n=0,i=1)=>Math.min(Math.max(e,n),i),$i=(e={x:0,y:0},n,i)=>({x:ea(e.x,n[0][0],n[1][0]-((i==null?void 0:i.width)??0)),y:ea(e.y,n[0][1],n[1][1]-((i==null?void 0:i.height)??0))});function Mw(e,n,i){const{width:l,height:o}=Ar(i),{x:s,y:u}=i.internals.positionAbsolute;return $i(e,[[s,u],[s+l,u+o]],n)}const Kx=(e,n,i)=>ei?-ea(Math.abs(e-i),1,n)/n:0,jw=(e,n,i=15,l=40)=>{const o=Kx(e.x,l,n.width-l)*i,s=Kx(e.y,l,n.height-l)*i;return[o,s]},mc=(e,n)=>({x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}),kp=({x:e,y:n,width:i,height:l})=>({x:e,y:n,x2:e+i,y2:n+l}),gc=({x:e,y:n,x2:i,y2:l})=>({x:e,y:n,width:i-e,height:l-n}),ta=(e,n=[0,0])=>{var o,s;const{x:i,y:l}=em(e)?e.internals.positionAbsolute:Io(e,n);return{x:i,y:l,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},ec=(e,n=[0,0])=>{var o,s;const{x:i,y:l}=em(e)?e.internals.positionAbsolute:Io(e,n);return{x:i,y:l,x2:i+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:l+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},Ow=(e,n)=>gc(mc(kp(e),kp(n))),jo=(e,n)=>{const i=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),l=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(i*l)},Jx=e=>qn(e.width)&&qn(e.height)&&qn(e.x)&&qn(e.y),qn=e=>!isNaN(e)&&isFinite(e),HT=(e,n)=>{},Yo=(e,n=[1,1])=>({x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}),Go=({x:e,y:n},[i,l,o],s=!1,u=[1,1])=>{const f={x:(e-i)/o,y:(n-l)/o};return s?Yo(f,u):f},tc=({x:e,y:n},[i,l,o])=>({x:e*o+i,y:n*o+l});function Ll(e,n){if(typeof e=="number")return Math.floor((n-n/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const i=parseFloat(e);if(!Number.isNaN(i))return Math.floor(i)}if(typeof e=="string"&&e.endsWith("%")){const i=parseFloat(e);if(!Number.isNaN(i))return Math.floor(n*i*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function BT(e,n,i){if(typeof e=="string"||typeof e=="number"){const l=Ll(e,i),o=Ll(e,n);return{top:l,right:o,bottom:l,left:o,x:o*2,y:l*2}}if(typeof e=="object"){const l=Ll(e.top??e.y??0,i),o=Ll(e.bottom??e.y??0,i),s=Ll(e.left??e.x??0,n),u=Ll(e.right??e.x??0,n);return{top:l,right:u,bottom:o,left:s,x:s+u,y:l+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function qT(e,n,i,l,o,s){const{x:u,y:f}=tc(e,[n,i,l]),{x:d,y:h}=tc({x:e.x+e.width,y:e.y+e.height},[n,i,l]),m=o-d,p=s-h;return{left:Math.floor(u),top:Math.floor(f),right:Math.floor(m),bottom:Math.floor(p)}}const nm=(e,n,i,l,o,s)=>{const u=BT(s,n,i),f=(n-u.x)/e.width,d=(i-u.y)/e.height,h=Math.min(f,d),m=ea(h,l,o),p=e.x+e.width/2,y=e.y+e.height/2,v=n/2-p*m,w=i/2-y*m,k=qT(e,v,w,m,n,i),S={left:Math.min(k.left-u.left,0),top:Math.min(k.top-u.top,0),right:Math.min(k.right-u.right,0),bottom:Math.min(k.bottom-u.bottom,0)};return{x:v-S.left+S.right,y:w-S.top+S.bottom,zoom:m}},Oo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function na(e){return e!=null&&e!=="parent"}function Ar(e){var n,i;return{width:((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}}function Rw(e){var n,i;return(((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth)!==void 0&&(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight)!==void 0}function Dw(e,n={width:0,height:0},i,l,o){const s={...e},u=l.get(i);if(u){const f=u.origin||o;s.x+=u.internals.positionAbsolute.x-(n.width??0)*f[0],s.y+=u.internals.positionAbsolute.y-(n.height??0)*f[1]}return s}function Wx(e,n){if(e.size!==n.size)return!1;for(const i of e)if(!n.has(i))return!1;return!0}function UT(){let e,n;return{promise:new Promise((l,o)=>{e=l,n=o}),resolve:e,reject:n}}function IT(e){return{...kw,...e||{}}}function vo(e,{snapGrid:n=[0,0],snapToGrid:i=!1,transform:l,containerBounds:o}){const{x:s,y:u}=Un(e),f=Go({x:s-((o==null?void 0:o.left)??0),y:u-((o==null?void 0:o.top)??0)},l),{x:d,y:h}=i?Yo(f,n):f;return{xSnapped:d,ySnapped:h,...f}}const rm=e=>({width:e.offsetWidth,height:e.offsetHeight}),Lw=e=>{var n;return((n=e==null?void 0:e.getRootNode)==null?void 0:n.call(e))||(window==null?void 0:window.document)},VT=["INPUT","SELECT","TEXTAREA"];function Hw(e){var l,o;const n=((o=(l=e.composedPath)==null?void 0:l.call(e))==null?void 0:o[0])||e.target;return(n==null?void 0:n.nodeType)!==1?!1:VT.includes(n.nodeName)||n.hasAttribute("contenteditable")||!!n.closest(".nokey")}const Bw=e=>"clientX"in e,Un=(e,n)=>{var s,u;const i=Bw(e),l=i?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,o=i?e.clientY:(u=e.touches)==null?void 0:u[0].clientY;return{x:l-((n==null?void 0:n.left)??0),y:o-((n==null?void 0:n.top)??0)}},ev=(e,n,i,l,o)=>{const s=n.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(u=>{const f=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),type:e,nodeId:o,position:u.getAttribute("data-handlepos"),x:(f.left-i.left)/l,y:(f.top-i.top)/l,...rm(u)}})};function qw({sourceX:e,sourceY:n,targetX:i,targetY:l,sourceControlX:o,sourceControlY:s,targetControlX:u,targetControlY:f}){const d=e*.125+o*.375+u*.375+i*.125,h=n*.125+s*.375+f*.375+l*.125,m=Math.abs(d-e),p=Math.abs(h-n);return[d,h,m,p]}function Tu(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function tv({pos:e,x1:n,y1:i,x2:l,y2:o,c:s}){switch(e){case we.Left:return[n-Tu(n-l,s),i];case we.Right:return[n+Tu(l-n,s),i];case we.Top:return[n,i-Tu(i-o,s)];case we.Bottom:return[n,i+Tu(o-i,s)]}}function im({sourceX:e,sourceY:n,sourcePosition:i=we.Bottom,targetX:l,targetY:o,targetPosition:s=we.Top,curvature:u=.25}){const[f,d]=tv({pos:i,x1:e,y1:n,x2:l,y2:o,c:u}),[h,m]=tv({pos:s,x1:l,y1:o,x2:e,y2:n,c:u}),[p,y,v,w]=qw({sourceX:e,sourceY:n,targetX:l,targetY:o,sourceControlX:f,sourceControlY:d,targetControlX:h,targetControlY:m});return[`M${e},${n} C${f},${d} ${h},${m} ${l},${o}`,p,y,v,w]}function Uw({sourceX:e,sourceY:n,targetX:i,targetY:l}){const o=Math.abs(i-e)/2,s=i0}const $T=({source:e,sourceHandle:n,target:i,targetHandle:l})=>`xy-edge__${e}${n||""}-${i}${l||""}`,XT=(e,n)=>n.some(i=>i.source===e.source&&i.target===e.target&&(i.sourceHandle===e.sourceHandle||!i.sourceHandle&&!e.sourceHandle)&&(i.targetHandle===e.targetHandle||!i.targetHandle&&!e.targetHandle)),PT=(e,n,i={})=>{if(!e.source||!e.target)return n;const l=i.getEdgeId||$T;let o;return zw(e)?o={...e}:o={...e,id:l(e)},XT(o,n)?n:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,n.concat(o))};function Iw({sourceX:e,sourceY:n,targetX:i,targetY:l}){const[o,s,u,f]=Uw({sourceX:e,sourceY:n,targetX:i,targetY:l});return[`M ${e},${n}L ${i},${l}`,o,s,u,f]}const nv={[we.Left]:{x:-1,y:0},[we.Right]:{x:1,y:0},[we.Top]:{x:0,y:-1},[we.Bottom]:{x:0,y:1}},FT=({source:e,sourcePosition:n=we.Bottom,target:i})=>n===we.Left||n===we.Right?e.xMath.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function QT({source:e,sourcePosition:n=we.Bottom,target:i,targetPosition:l=we.Top,center:o,offset:s,stepPosition:u}){const f=nv[n],d=nv[l],h={x:e.x+f.x*s,y:e.y+f.y*s},m={x:i.x+d.x*s,y:i.y+d.y*s},p=FT({source:h,sourcePosition:n,target:m}),y=p.x!==0?"x":"y",v=p[y];let w=[],k,S;const _={x:0,y:0},z={x:0,y:0},[,,E,A]=Uw({sourceX:e.x,sourceY:e.y,targetX:i.x,targetY:i.y});if(f[y]*d[y]===-1){y==="x"?(k=o.x??h.x+(m.x-h.x)*u,S=o.y??(h.y+m.y)/2):(k=o.x??(h.x+m.x)/2,S=o.y??h.y+(m.y-h.y)*u);const T=[{x:k,y:h.y},{x:k,y:m.y}],q=[{x:h.x,y:S},{x:m.x,y:S}];f[y]===v?w=y==="x"?T:q:w=y==="x"?q:T}else{const T=[{x:h.x,y:m.y}],q=[{x:m.x,y:h.y}];if(y==="x"?w=f.x===v?q:T:w=f.y===v?T:q,n===l){const I=Math.abs(e[y]-i[y]);if(I<=s){const ee=Math.min(s-1,s-I);f[y]===v?_[y]=(h[y]>e[y]?-1:1)*ee:z[y]=(m[y]>i[y]?-1:1)*ee}}if(n!==l){const I=y==="x"?"y":"x",ee=f[y]===d[I],L=h[I]>m[I],G=h[I]=H?(k=(M.x+D.x)/2,S=w[0].y):(k=w[0].x,S=(M.y+D.y)/2)}return[[e,{x:h.x+_.x,y:h.y+_.y},...w,{x:m.x+z.x,y:m.y+z.y},i],k,S,E,A]}function ZT(e,n,i,l){const o=Math.min(rv(e,n)/2,rv(n,i)/2,l),{x:s,y:u}=n;if(e.x===s&&s===i.x||e.y===u&&u===i.y)return`L${s} ${u}`;if(e.y===u){const h=e.x{let A="";return E>0&&Ei.id===n):e[0])||null}function Tp(e,n){return e?typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(l=>`${l}=${e[l]}`).join("&")}`:""}function JT(e,{id:n,defaultColor:i,defaultMarkerStart:l,defaultMarkerEnd:o}){const s=new Set;return e.reduce((u,f)=>([f.markerStart||l,f.markerEnd||o].forEach(d=>{if(d&&typeof d=="object"){const h=Tp(d,n);s.has(h)||(u.push({id:h,color:d.color||i,...d}),s.add(h))}}),u),[]).sort((u,f)=>u.id.localeCompare(f.id))}const Vw=1e3,WT=10,lm={nodeOrigin:[0,0],nodeExtent:Ao,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ez={...lm,checkEquality:!0};function am(e,n){const i={...e};for(const l in n)n[l]!==void 0&&(i[l]=n[l]);return i}function tz(e,n,i){const l=am(lm,i);for(const o of e.values())if(o.parentId)sm(o,e,n,l);else{const s=Io(o,l.nodeOrigin),u=na(o.extent)?o.extent:l.nodeExtent,f=$i(s,u,Ar(o));o.internals.positionAbsolute=f}}function nz(e,n){if(!e.handles)return e.measured?n==null?void 0:n.internals.handleBounds:void 0;const i=[],l=[];for(const o of e.handles){const s={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?i.push(s):o.type==="target"&&l.push(s)}return{source:i,target:l}}function om(e){return e==="manual"}function zp(e,n,i,l={}){var h,m;const o=am(ez,l),s={i:0},u=new Map(n),f=o!=null&&o.elevateNodesOnSelect&&!om(o.zIndexMode)?Vw:0;let d=e.length>0;n.clear(),i.clear();for(const p of e){let y=u.get(p.id);if(o.checkEquality&&p===(y==null?void 0:y.internals.userNode))n.set(p.id,y);else{const v=Io(p,o.nodeOrigin),w=na(p.extent)?p.extent:o.nodeExtent,k=$i(v,w,Ar(p));y={...o.defaults,...p,measured:{width:(h=p.measured)==null?void 0:h.width,height:(m=p.measured)==null?void 0:m.height},internals:{positionAbsolute:k,handleBounds:nz(p,y),z:Yw(p,f,o.zIndexMode),userNode:p}},n.set(p.id,y)}(y.measured===void 0||y.measured.width===void 0||y.measured.height===void 0)&&!y.hidden&&(d=!1),p.parentId&&sm(y,n,i,l,s)}return d}function rz(e,n){if(!e.parentId)return;const i=n.get(e.parentId);i?i.set(e.id,e):n.set(e.parentId,new Map([[e.id,e]]))}function sm(e,n,i,l,o){const{elevateNodesOnSelect:s,nodeOrigin:u,nodeExtent:f,zIndexMode:d}=am(lm,l),h=e.parentId,m=n.get(h);if(!m){console.warn(`Parent node ${h} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}rz(e,i),o&&!m.parentId&&m.internals.rootParentIndex===void 0&&d==="auto"&&(m.internals.rootParentIndex=++o.i,m.internals.z=m.internals.z+o.i*WT),o&&m.internals.rootParentIndex!==void 0&&(o.i=m.internals.rootParentIndex);const p=s&&!om(d)?Vw:0,{x:y,y:v,z:w}=iz(e,m,u,f,p,d),{positionAbsolute:k}=e.internals,S=y!==k.x||v!==k.y;(S||w!==e.internals.z)&&n.set(e.id,{...e,internals:{...e.internals,positionAbsolute:S?{x:y,y:v}:k,z:w}})}function Yw(e,n,i){const l=qn(e.zIndex)?e.zIndex:0;return om(i)?l:l+(e.selected?n:0)}function iz(e,n,i,l,o,s){const{x:u,y:f}=n.internals.positionAbsolute,d=Ar(e),h=Io(e,i),m=na(e.extent)?$i(h,e.extent,d):h;let p=$i({x:u+m.x,y:f+m.y},l,d);e.extent==="parent"&&(p=Mw(p,d,n));const y=Yw(e,o,s),v=n.internals.z??0;return{x:p.x,y:p.y,z:v>=y?v+1:y}}function um(e,n,i,l=[0,0]){var u;const o=[],s=new Map;for(const f of e){const d=n.get(f.parentId);if(!d)continue;const h=((u=s.get(f.parentId))==null?void 0:u.expandedRect)??ta(d),m=Ow(h,f.rect);s.set(f.parentId,{expandedRect:m,parent:d})}return s.size>0&&s.forEach(({expandedRect:f,parent:d},h)=>{var E;const m=d.internals.positionAbsolute,p=Ar(d),y=d.origin??l,v=f.x0||w>0||_||z)&&(o.push({id:h,type:"position",position:{x:d.position.x-v+_,y:d.position.y-w+z}}),(E=i.get(h))==null||E.forEach(A=>{e.some(B=>B.id===A.id)||o.push({id:A.id,type:"position",position:{x:A.position.x+v,y:A.position.y+w}})})),(p.width0){const v=um(y,n,i,o);h.push(...v)}return{changes:h,updatedInternals:d}}async function az({delta:e,panZoom:n,transform:i,translateExtent:l,width:o,height:s}){if(!n||!e.x&&!e.y)return Promise.resolve(!1);const u=await n.setViewportConstrained({x:i[0]+e.x,y:i[1]+e.y,zoom:i[2]},[[0,0],[o,s]],l),f=!!u&&(u.x!==i[0]||u.y!==i[1]||u.k!==i[2]);return Promise.resolve(f)}function ov(e,n,i,l,o,s){let u=o;const f=l.get(u)||new Map;l.set(u,f.set(i,n)),u=`${o}-${e}`;const d=l.get(u)||new Map;if(l.set(u,d.set(i,n)),s){u=`${o}-${e}-${s}`;const h=l.get(u)||new Map;l.set(u,h.set(i,n))}}function Gw(e,n,i){e.clear(),n.clear();for(const l of i){const{source:o,target:s,sourceHandle:u=null,targetHandle:f=null}=l,d={edgeId:l.id,source:o,target:s,sourceHandle:u,targetHandle:f},h=`${o}-${u}--${s}-${f}`,m=`${s}-${f}--${o}-${u}`;ov("source",d,m,e,o,u),ov("target",d,h,e,s,f),n.set(l.id,l)}}function $w(e,n){if(!e.parentId)return!1;const i=n.get(e.parentId);return i?i.selected?!0:$w(i,n):!1}function sv(e,n,i){var o;let l=e;do{if((o=l==null?void 0:l.matches)!=null&&o.call(l,n))return!0;if(l===i)return!1;l=l==null?void 0:l.parentElement}while(l);return!1}function oz(e,n,i,l){const o=new Map;for(const[s,u]of e)if((u.selected||u.id===l)&&(!u.parentId||!$w(u,e))&&(u.draggable||n&&typeof u.draggable>"u")){const f=e.get(s);f&&o.set(s,{id:s,position:f.position||{x:0,y:0},distance:{x:i.x-f.internals.positionAbsolute.x,y:i.y-f.internals.positionAbsolute.y},extent:f.extent,parentId:f.parentId,origin:f.origin,expandParent:f.expandParent,internals:{positionAbsolute:f.internals.positionAbsolute||{x:0,y:0}},measured:{width:f.measured.width??0,height:f.measured.height??0}})}return o}function Jd({nodeId:e,dragItems:n,nodeLookup:i,dragging:l=!0}){var u,f,d;const o=[];for(const[h,m]of n){const p=(u=i.get(h))==null?void 0:u.internals.userNode;p&&o.push({...p,position:m.position,dragging:l})}if(!e)return[o[0],o];const s=(f=i.get(e))==null?void 0:f.internals.userNode;return[s?{...s,position:((d=n.get(e))==null?void 0:d.position)||s.position,dragging:l}:o[0],o]}function sz({dragItems:e,snapGrid:n,x:i,y:l}){const o=e.values().next().value;if(!o)return null;const s={x:i-o.distance.x,y:l-o.distance.y},u=Yo(s,n);return{x:u.x-s.x,y:u.y-s.y}}function uz({onNodeMouseDown:e,getStoreItems:n,onDragStart:i,onDrag:l,onDragStop:o}){let s={x:null,y:null},u=0,f=new Map,d=!1,h={x:0,y:0},m=null,p=!1,y=null,v=!1,w=!1,k=null;function S({noDragClassName:z,handleSelector:E,domNode:A,isSelectable:B,nodeId:T,nodeClickDistance:q=0}){y=xn(A);function M({x:I,y:ee}){const{nodeLookup:L,nodeExtent:G,snapGrid:R,snapToGrid:$,nodeOrigin:Z,onNodeDrag:J,onSelectionDrag:j,onError:U,updateNodePositions:P}=n();s={x:I,y:ee};let N=!1;const Y=f.size>1,F=Y&&G?kp(Vo(f)):null,K=Y&&$?sz({dragItems:f,snapGrid:R,x:I,y:ee}):null;for(const[ne,re]of f){if(!L.has(ne))continue;let se={x:I-re.distance.x,y:ee-re.distance.y};$&&(se=K?{x:Math.round(se.x+K.x),y:Math.round(se.y+K.y)}:Yo(se,R));let ye=null;if(Y&&G&&!re.extent&&F){const{positionAbsolute:pe}=re.internals,_e=pe.x-F.x+G[0][0],Me=pe.x+re.measured.width-F.x2+G[1][0],Ce=pe.y-F.y+G[0][1],st=pe.y+re.measured.height-F.y2+G[1][1];ye=[[_e,Ce],[Me,st]]}const{position:ve,positionAbsolute:xe}=Aw({nodeId:ne,nextPosition:se,nodeLookup:L,nodeExtent:ye||G,nodeOrigin:Z,onError:U});N=N||re.position.x!==ve.x||re.position.y!==ve.y,re.position=ve,re.internals.positionAbsolute=xe}if(w=w||N,!!N&&(P(f,!0),k&&(l||J||!T&&j))){const[ne,re]=Jd({nodeId:T,dragItems:f,nodeLookup:L});l==null||l(k,f,ne,re),J==null||J(k,ne,re),T||j==null||j(k,re)}}async function D(){if(!m)return;const{transform:I,panBy:ee,autoPanSpeed:L,autoPanOnNodeDrag:G}=n();if(!G){d=!1,cancelAnimationFrame(u);return}const[R,$]=jw(h,m,L);(R!==0||$!==0)&&(s.x=(s.x??0)-R/I[2],s.y=(s.y??0)-$/I[2],await ee({x:R,y:$})&&M(s)),u=requestAnimationFrame(D)}function X(I){var Y;const{nodeLookup:ee,multiSelectionActive:L,nodesDraggable:G,transform:R,snapGrid:$,snapToGrid:Z,selectNodesOnDrag:J,onNodeDragStart:j,onSelectionDragStart:U,unselectNodesAndEdges:P}=n();p=!0,(!J||!B)&&!L&&T&&((Y=ee.get(T))!=null&&Y.selected||P()),B&&J&&T&&(e==null||e(T));const N=vo(I.sourceEvent,{transform:R,snapGrid:$,snapToGrid:Z,containerBounds:m});if(s=N,f=oz(ee,G,N,T),f.size>0&&(i||j||!T&&U)){const[F,K]=Jd({nodeId:T,dragItems:f,nodeLookup:ee});i==null||i(I.sourceEvent,f,F,K),j==null||j(I.sourceEvent,F,K),T||U==null||U(I.sourceEvent,K)}}const H=uw().clickDistance(q).on("start",I=>{const{domNode:ee,nodeDragThreshold:L,transform:G,snapGrid:R,snapToGrid:$}=n();m=(ee==null?void 0:ee.getBoundingClientRect())||null,v=!1,w=!1,k=I.sourceEvent,L===0&&X(I),s=vo(I.sourceEvent,{transform:G,snapGrid:R,snapToGrid:$,containerBounds:m}),h=Un(I.sourceEvent,m)}).on("drag",I=>{const{autoPanOnNodeDrag:ee,transform:L,snapGrid:G,snapToGrid:R,nodeDragThreshold:$,nodeLookup:Z}=n(),J=vo(I.sourceEvent,{transform:L,snapGrid:G,snapToGrid:R,containerBounds:m});if(k=I.sourceEvent,(I.sourceEvent.type==="touchmove"&&I.sourceEvent.touches.length>1||T&&!Z.has(T))&&(v=!0),!v){if(!d&&ee&&p&&(d=!0,D()),!p){const j=Un(I.sourceEvent,m),U=j.x-h.x,P=j.y-h.y;Math.sqrt(U*U+P*P)>$&&X(I)}(s.x!==J.xSnapped||s.y!==J.ySnapped)&&f&&p&&(h=Un(I.sourceEvent,m),M(J))}}).on("end",I=>{if(!(!p||v)&&(d=!1,p=!1,cancelAnimationFrame(u),f.size>0)){const{nodeLookup:ee,updateNodePositions:L,onNodeDragStop:G,onSelectionDragStop:R}=n();if(w&&(L(f,!1),w=!1),o||G||!T&&R){const[$,Z]=Jd({nodeId:T,dragItems:f,nodeLookup:ee,dragging:!1});o==null||o(I.sourceEvent,f,$,Z),G==null||G(I.sourceEvent,$,Z),T||R==null||R(I.sourceEvent,Z)}}}).filter(I=>{const ee=I.target;return!I.button&&(!z||!sv(ee,`.${z}`,A))&&(!E||sv(ee,E,A))});y.call(H)}function _(){y==null||y.on(".drag",null)}return{update:S,destroy:_}}function cz(e,n,i){const l=[],o={x:e.x-i,y:e.y-i,width:i*2,height:i*2};for(const s of n.values())jo(o,ta(s))>0&&l.push(s);return l}const fz=250;function dz(e,n,i,l){var f,d;let o=[],s=1/0;const u=cz(e,i,n+fz);for(const h of u){const m=[...((f=h.internals.handleBounds)==null?void 0:f.source)??[],...((d=h.internals.handleBounds)==null?void 0:d.target)??[]];for(const p of m){if(l.nodeId===p.nodeId&&l.type===p.type&&l.id===p.id)continue;const{x:y,y:v}=Xi(h,p,p.position,!0),w=Math.sqrt(Math.pow(y-e.x,2)+Math.pow(v-e.y,2));w>n||(w1){const h=l.type==="source"?"target":"source";return o.find(m=>m.type===h)??o[0]}return o[0]}function Xw(e,n,i,l,o,s=!1){var h,m,p;const u=l.get(e);if(!u)return null;const f=o==="strict"?(h=u.internals.handleBounds)==null?void 0:h[n]:[...((m=u.internals.handleBounds)==null?void 0:m.source)??[],...((p=u.internals.handleBounds)==null?void 0:p.target)??[]],d=(i?f==null?void 0:f.find(y=>y.id===i):f==null?void 0:f[0])??null;return d&&s?{...d,...Xi(u,d,d.position,!0)}:d}function Pw(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function hz(e,n){let i=null;return n?i=!0:e&&!n&&(i=!1),i}const Fw=()=>!0;function pz(e,{connectionMode:n,connectionRadius:i,handleId:l,nodeId:o,edgeUpdaterType:s,isTarget:u,domNode:f,nodeLookup:d,lib:h,autoPanOnConnect:m,flowId:p,panBy:y,cancelConnection:v,onConnectStart:w,onConnect:k,onConnectEnd:S,isValidConnection:_=Fw,onReconnectEnd:z,updateConnection:E,getTransform:A,getFromHandle:B,autoPanSpeed:T,dragThreshold:q=1,handleDomNode:M}){const D=Lw(e.target);let X=0,H;const{x:I,y:ee}=Un(e),L=Pw(s,M),G=f==null?void 0:f.getBoundingClientRect();let R=!1;if(!G||!L)return;const $=Xw(o,L,l,d,n);if(!$)return;let Z=Un(e,G),J=!1,j=null,U=!1,P=null;function N(){if(!m||!G)return;const[ve,xe]=jw(Z,G,T);y({x:ve,y:xe}),X=requestAnimationFrame(N)}const Y={...$,nodeId:o,type:L,position:$.position},F=d.get(o);let ne={inProgress:!0,isValid:null,from:Xi(F,Y,we.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:F,to:Z,toHandle:null,toPosition:Zx[Y.position],toNode:null,pointer:Z};function re(){R=!0,E(ne),w==null||w(e,{nodeId:o,handleId:l,handleType:L})}q===0&&re();function se(ve){if(!R){const{x:st,y:We}=Un(ve),zt=st-I,Ut=We-ee;if(!(zt*zt+Ut*Ut>q*q))return;re()}if(!B()||!Y){ye(ve);return}const xe=A();Z=Un(ve,G),H=dz(Go(Z,xe,!1,[1,1]),i,d,Y),J||(N(),J=!0);const pe=Qw(ve,{handle:H,connectionMode:n,fromNodeId:o,fromHandleId:l,fromType:u?"target":"source",isValidConnection:_,doc:D,lib:h,flowId:p,nodeLookup:d});P=pe.handleDomNode,j=pe.connection,U=hz(!!H,pe.isValid);const _e=d.get(o),Me=_e?Xi(_e,Y,we.Left,!0):ne.from,Ce={...ne,from:Me,isValid:U,to:pe.toHandle&&U?tc({x:pe.toHandle.x,y:pe.toHandle.y},xe):Z,toHandle:pe.toHandle,toPosition:U&&pe.toHandle?pe.toHandle.position:Zx[Y.position],toNode:pe.toHandle?d.get(pe.toHandle.nodeId):null,pointer:Z};E(Ce),ne=Ce}function ye(ve){if(!("touches"in ve&&ve.touches.length>0)){if(R){(H||P)&&j&&U&&(k==null||k(j));const{inProgress:xe,...pe}=ne,_e={...pe,toPosition:ne.toHandle?ne.toPosition:null};S==null||S(ve,_e),s&&(z==null||z(ve,_e))}v(),cancelAnimationFrame(X),J=!1,U=!1,j=null,P=null,D.removeEventListener("mousemove",se),D.removeEventListener("mouseup",ye),D.removeEventListener("touchmove",se),D.removeEventListener("touchend",ye)}}D.addEventListener("mousemove",se),D.addEventListener("mouseup",ye),D.addEventListener("touchmove",se),D.addEventListener("touchend",ye)}function Qw(e,{handle:n,connectionMode:i,fromNodeId:l,fromHandleId:o,fromType:s,doc:u,lib:f,flowId:d,isValidConnection:h=Fw,nodeLookup:m}){const p=s==="target",y=n?u.querySelector(`.${f}-flow__handle[data-id="${d}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:v,y:w}=Un(e),k=u.elementFromPoint(v,w),S=k!=null&&k.classList.contains(`${f}-flow__handle`)?k:y,_={handleDomNode:S,isValid:!1,connection:null,toHandle:null};if(S){const z=Pw(void 0,S),E=S.getAttribute("data-nodeid"),A=S.getAttribute("data-handleid"),B=S.classList.contains("connectable"),T=S.classList.contains("connectableend");if(!E||!z)return _;const q={source:p?E:l,sourceHandle:p?A:o,target:p?l:E,targetHandle:p?o:A};_.connection=q;const D=B&&T&&(i===Wl.Strict?p&&z==="source"||!p&&z==="target":E!==l||A!==o);_.isValid=D&&h(q),_.toHandle=Xw(E,z,A,m,i,!0)}return _}const Ap={onPointerDown:pz,isValid:Qw};function mz({domNode:e,panZoom:n,getTransform:i,getViewScale:l}){const o=xn(e);function s({translateExtent:f,width:d,height:h,zoomStep:m=1,pannable:p=!0,zoomable:y=!0,inversePan:v=!1}){const w=E=>{if(E.sourceEvent.type!=="wheel"||!n)return;const A=i(),B=E.sourceEvent.ctrlKey&&Oo()?10:1,T=-E.sourceEvent.deltaY*(E.sourceEvent.deltaMode===1?.05:E.sourceEvent.deltaMode?1:.002)*m,q=A[2]*Math.pow(2,T*B);n.scaleTo(q)};let k=[0,0];const S=E=>{(E.sourceEvent.type==="mousedown"||E.sourceEvent.type==="touchstart")&&(k=[E.sourceEvent.clientX??E.sourceEvent.touches[0].clientX,E.sourceEvent.clientY??E.sourceEvent.touches[0].clientY])},_=E=>{const A=i();if(E.sourceEvent.type!=="mousemove"&&E.sourceEvent.type!=="touchmove"||!n)return;const B=[E.sourceEvent.clientX??E.sourceEvent.touches[0].clientX,E.sourceEvent.clientY??E.sourceEvent.touches[0].clientY],T=[B[0]-k[0],B[1]-k[1]];k=B;const q=l()*Math.max(A[2],Math.log(A[2]))*(v?-1:1),M={x:A[0]-T[0]*q,y:A[1]-T[1]*q},D=[[0,0],[d,h]];n.setViewportConstrained({x:M.x,y:M.y,zoom:A[2]},D,f)},z=Ew().on("start",S).on("zoom",p?_:null).on("zoom.wheel",y?w:null);o.call(z,{})}function u(){o.on("zoom",null)}return{update:s,destroy:u,pointer:Hn}}const yc=e=>({x:e.x,y:e.y,zoom:e.k}),Wd=({x:e,y:n,zoom:i})=>pc.translate(e,n).scale(i),Vl=(e,n)=>e.target.closest(`.${n}`),Zw=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),gz=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,eh=(e,n=0,i=gz,l=()=>{})=>{const o=typeof n=="number"&&n>0;return o||l(),o?e.transition().duration(n).ease(i).on("end",l):e},Kw=e=>{const n=e.ctrlKey&&Oo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n};function yz({zoomPanValues:e,noWheelClassName:n,d3Selection:i,d3Zoom:l,panOnScrollMode:o,panOnScrollSpeed:s,zoomOnPinch:u,onPanZoomStart:f,onPanZoom:d,onPanZoomEnd:h}){return m=>{if(Vl(m,n))return m.ctrlKey&&m.preventDefault(),!1;m.preventDefault(),m.stopImmediatePropagation();const p=i.property("__zoom").k||1;if(m.ctrlKey&&u){const S=Hn(m),_=Kw(m),z=p*Math.pow(2,_);l.scaleTo(i,z,S,m);return}const y=m.deltaMode===1?20:1;let v=o===Ii.Vertical?0:m.deltaX*y,w=o===Ii.Horizontal?0:m.deltaY*y;!Oo()&&m.shiftKey&&o!==Ii.Vertical&&(v=m.deltaY*y,w=0),l.translateBy(i,-(v/p)*s,-(w/p)*s,{internal:!0});const k=yc(i.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(d==null||d(m,k),e.panScrollTimeout=setTimeout(()=>{h==null||h(m,k),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,f==null||f(m,k))}}function xz({noWheelClassName:e,preventScrolling:n,d3ZoomHandler:i}){return function(l,o){const s=l.type==="wheel",u=!n&&s&&!l.ctrlKey,f=Vl(l,e);if(l.ctrlKey&&s&&f&&l.preventDefault(),u||f)return null;l.preventDefault(),i.call(this,l,o)}}function vz({zoomPanValues:e,onDraggingChange:n,onPanZoomStart:i}){return l=>{var s,u,f;if((s=l.sourceEvent)!=null&&s.internal)return;const o=yc(l.transform);e.mouseButton=((u=l.sourceEvent)==null?void 0:u.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((f=l.sourceEvent)==null?void 0:f.type)==="mousedown"&&n(!0),i&&(i==null||i(l.sourceEvent,o))}}function bz({zoomPanValues:e,panOnDrag:n,onPaneContextMenu:i,onTransformChange:l,onPanZoom:o}){return s=>{var u,f;e.usedRightMouseButton=!!(i&&Zw(n,e.mouseButton??0)),(u=s.sourceEvent)!=null&&u.sync||l([s.transform.x,s.transform.y,s.transform.k]),o&&!((f=s.sourceEvent)!=null&&f.internal)&&(o==null||o(s.sourceEvent,yc(s.transform)))}}function wz({zoomPanValues:e,panOnDrag:n,panOnScroll:i,onDraggingChange:l,onPanZoomEnd:o,onPaneContextMenu:s}){return u=>{var f;if(!((f=u.sourceEvent)!=null&&f.internal)&&(e.isZoomingOrPanning=!1,s&&Zw(n,e.mouseButton??0)&&!e.usedRightMouseButton&&u.sourceEvent&&s(u.sourceEvent),e.usedRightMouseButton=!1,l(!1),o)){const d=yc(u.transform);e.prevViewport=d,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(u.sourceEvent,d)},i?150:0)}}}function Sz({zoomActivationKeyPressed:e,zoomOnScroll:n,zoomOnPinch:i,panOnDrag:l,panOnScroll:o,zoomOnDoubleClick:s,userSelectionActive:u,noWheelClassName:f,noPanClassName:d,lib:h,connectionInProgress:m}){return p=>{var S;const y=e||n,v=i&&p.ctrlKey,w=p.type==="wheel";if(p.button===1&&p.type==="mousedown"&&(Vl(p,`${h}-flow__node`)||Vl(p,`${h}-flow__edge`)))return!0;if(!l&&!y&&!o&&!s&&!i||u||m&&!w||Vl(p,f)&&w||Vl(p,d)&&(!w||o&&w&&!e)||!i&&p.ctrlKey&&w)return!1;if(!i&&p.type==="touchstart"&&((S=p.touches)==null?void 0:S.length)>1)return p.preventDefault(),!1;if(!y&&!o&&!v&&w||!l&&(p.type==="mousedown"||p.type==="touchstart")||Array.isArray(l)&&!l.includes(p.button)&&p.type==="mousedown")return!1;const k=Array.isArray(l)&&l.includes(p.button)||!p.button||p.button<=1;return(!p.ctrlKey||w)&&k}}function _z({domNode:e,minZoom:n,maxZoom:i,translateExtent:l,viewport:o,onPanZoom:s,onPanZoomStart:u,onPanZoomEnd:f,onDraggingChange:d}){const h={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},m=e.getBoundingClientRect(),p=Ew().scaleExtent([n,i]).translateExtent(l),y=xn(e).call(p);z({x:o.x,y:o.y,zoom:ea(o.zoom,n,i)},[[0,0],[m.width,m.height]],l);const v=y.on("wheel.zoom"),w=y.on("dblclick.zoom");p.wheelDelta(Kw);function k(H,I){return y?new Promise(ee=>{p==null||p.interpolate((I==null?void 0:I.interpolate)==="linear"?xo:Bu).transform(eh(y,I==null?void 0:I.duration,I==null?void 0:I.ease,()=>ee(!0)),H)}):Promise.resolve(!1)}function S({noWheelClassName:H,noPanClassName:I,onPaneContextMenu:ee,userSelectionActive:L,panOnScroll:G,panOnDrag:R,panOnScrollMode:$,panOnScrollSpeed:Z,preventScrolling:J,zoomOnPinch:j,zoomOnScroll:U,zoomOnDoubleClick:P,zoomActivationKeyPressed:N,lib:Y,onTransformChange:F,connectionInProgress:K,paneClickDistance:ne,selectionOnDrag:re}){L&&!h.isZoomingOrPanning&&_();const se=G&&!N&&!L;p.clickDistance(re?1/0:!qn(ne)||ne<0?0:ne);const ye=se?yz({zoomPanValues:h,noWheelClassName:H,d3Selection:y,d3Zoom:p,panOnScrollMode:$,panOnScrollSpeed:Z,zoomOnPinch:j,onPanZoomStart:u,onPanZoom:s,onPanZoomEnd:f}):xz({noWheelClassName:H,preventScrolling:J,d3ZoomHandler:v});if(y.on("wheel.zoom",ye,{passive:!1}),!L){const xe=vz({zoomPanValues:h,onDraggingChange:d,onPanZoomStart:u});p.on("start",xe);const pe=bz({zoomPanValues:h,panOnDrag:R,onPaneContextMenu:!!ee,onPanZoom:s,onTransformChange:F});p.on("zoom",pe);const _e=wz({zoomPanValues:h,panOnDrag:R,panOnScroll:G,onPaneContextMenu:ee,onPanZoomEnd:f,onDraggingChange:d});p.on("end",_e)}const ve=Sz({zoomActivationKeyPressed:N,panOnDrag:R,zoomOnScroll:U,panOnScroll:G,zoomOnDoubleClick:P,zoomOnPinch:j,userSelectionActive:L,noPanClassName:I,noWheelClassName:H,lib:Y,connectionInProgress:K});p.filter(ve),P?y.on("dblclick.zoom",w):y.on("dblclick.zoom",null)}function _(){p.on("zoom",null)}async function z(H,I,ee){const L=Wd(H),G=p==null?void 0:p.constrain()(L,I,ee);return G&&await k(G),new Promise(R=>R(G))}async function E(H,I){const ee=Wd(H);return await k(ee,I),new Promise(L=>L(ee))}function A(H){if(y){const I=Wd(H),ee=y.property("__zoom");(ee.k!==H.zoom||ee.x!==H.x||ee.y!==H.y)&&(p==null||p.transform(y,I,null,{sync:!0}))}}function B(){const H=y?_w(y.node()):{x:0,y:0,k:1};return{x:H.x,y:H.y,zoom:H.k}}function T(H,I){return y?new Promise(ee=>{p==null||p.interpolate((I==null?void 0:I.interpolate)==="linear"?xo:Bu).scaleTo(eh(y,I==null?void 0:I.duration,I==null?void 0:I.ease,()=>ee(!0)),H)}):Promise.resolve(!1)}function q(H,I){return y?new Promise(ee=>{p==null||p.interpolate((I==null?void 0:I.interpolate)==="linear"?xo:Bu).scaleBy(eh(y,I==null?void 0:I.duration,I==null?void 0:I.ease,()=>ee(!0)),H)}):Promise.resolve(!1)}function M(H){p==null||p.scaleExtent(H)}function D(H){p==null||p.translateExtent(H)}function X(H){const I=!qn(H)||H<0?0:H;p==null||p.clickDistance(I)}return{update:S,destroy:_,setViewport:E,setViewportConstrained:z,getViewport:B,scaleTo:T,scaleBy:q,setScaleExtent:M,setTranslateExtent:D,syncViewport:A,setClickDistance:X}}var ra;(function(e){e.Line="line",e.Handle="handle"})(ra||(ra={}));function Ez({width:e,prevWidth:n,height:i,prevHeight:l,affectsX:o,affectsY:s}){const u=e-n,f=i-l,d=[u>0?1:u<0?-1:0,f>0?1:f<0?-1:0];return u&&o&&(d[0]=d[0]*-1),f&&s&&(d[1]=d[1]*-1),d}function uv(e){const n=e.includes("right")||e.includes("left"),i=e.includes("bottom")||e.includes("top"),l=e.includes("left"),o=e.includes("top");return{isHorizontal:n,isVertical:i,affectsX:l,affectsY:o}}function oi(e,n){return Math.max(0,n-e)}function si(e,n){return Math.max(0,e-n)}function zu(e,n,i){return Math.max(0,n-e,e-i)}function cv(e,n){return e?!n:n}function Nz(e,n,i,l,o,s,u,f){let{affectsX:d,affectsY:h}=n;const{isHorizontal:m,isVertical:p}=n,y=m&&p,{xSnapped:v,ySnapped:w}=i,{minWidth:k,maxWidth:S,minHeight:_,maxHeight:z}=l,{x:E,y:A,width:B,height:T,aspectRatio:q}=e;let M=Math.floor(m?v-e.pointerX:0),D=Math.floor(p?w-e.pointerY:0);const X=B+(d?-M:M),H=T+(h?-D:D),I=-s[0]*B,ee=-s[1]*T;let L=zu(X,k,S),G=zu(H,_,z);if(u){let Z=0,J=0;d&&M<0?Z=oi(E+M+I,u[0][0]):!d&&M>0&&(Z=si(E+X+I,u[1][0])),h&&D<0?J=oi(A+D+ee,u[0][1]):!h&&D>0&&(J=si(A+H+ee,u[1][1])),L=Math.max(L,Z),G=Math.max(G,J)}if(f){let Z=0,J=0;d&&M>0?Z=si(E+M,f[0][0]):!d&&M<0&&(Z=oi(E+X,f[1][0])),h&&D>0?J=si(A+D,f[0][1]):!h&&D<0&&(J=oi(A+H,f[1][1])),L=Math.max(L,Z),G=Math.max(G,J)}if(o){if(m){const Z=zu(X/q,_,z)*q;if(L=Math.max(L,Z),u){let J=0;!d&&!h||d&&!h&&y?J=si(A+ee+X/q,u[1][1])*q:J=oi(A+ee+(d?M:-M)/q,u[0][1])*q,L=Math.max(L,J)}if(f){let J=0;!d&&!h||d&&!h&&y?J=oi(A+X/q,f[1][1])*q:J=si(A+(d?M:-M)/q,f[0][1])*q,L=Math.max(L,J)}}if(p){const Z=zu(H*q,k,S)/q;if(G=Math.max(G,Z),u){let J=0;!d&&!h||h&&!d&&y?J=si(E+H*q+I,u[1][0])/q:J=oi(E+(h?D:-D)*q+I,u[0][0])/q,G=Math.max(G,J)}if(f){let J=0;!d&&!h||h&&!d&&y?J=oi(E+H*q,f[1][0])/q:J=si(E+(h?D:-D)*q,f[0][0])/q,G=Math.max(G,J)}}}D=D+(D<0?G:-G),M=M+(M<0?L:-L),o&&(y?X>H*q?D=(cv(d,h)?-M:M)/q:M=(cv(d,h)?-D:D)*q:m?(D=M/q,h=d):(M=D*q,d=h));const R=d?E+M:E,$=h?A+D:A;return{width:B+(d?-M:M),height:T+(h?-D:D),x:s[0]*M*(d?-1:1)+R,y:s[1]*D*(h?-1:1)+$}}const Jw={width:0,height:0,x:0,y:0},kz={...Jw,pointerX:0,pointerY:0,aspectRatio:1};function Cz(e){return[[0,0],[e.measured.width,e.measured.height]]}function Tz(e,n,i){const l=n.position.x+e.position.x,o=n.position.y+e.position.y,s=e.measured.width??0,u=e.measured.height??0,f=i[0]*s,d=i[1]*u;return[[l-f,o-d],[l+s-f,o+u-d]]}function zz({domNode:e,nodeId:n,getStoreItems:i,onChange:l,onEnd:o}){const s=xn(e);let u={controlDirection:uv("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function f({controlPosition:h,boundaries:m,keepAspectRatio:p,resizeDirection:y,onResizeStart:v,onResize:w,onResizeEnd:k,shouldResize:S}){let _={...Jw},z={...kz};u={boundaries:m,resizeDirection:y,keepAspectRatio:p,controlDirection:uv(h)};let E,A=null,B=[],T,q,M,D=!1;const X=uw().on("start",H=>{const{nodeLookup:I,transform:ee,snapGrid:L,snapToGrid:G,nodeOrigin:R,paneDomNode:$}=i();if(E=I.get(n),!E)return;A=($==null?void 0:$.getBoundingClientRect())??null;const{xSnapped:Z,ySnapped:J}=vo(H.sourceEvent,{transform:ee,snapGrid:L,snapToGrid:G,containerBounds:A});_={width:E.measured.width??0,height:E.measured.height??0,x:E.position.x??0,y:E.position.y??0},z={..._,pointerX:Z,pointerY:J,aspectRatio:_.width/_.height},T=void 0,E.parentId&&(E.extent==="parent"||E.expandParent)&&(T=I.get(E.parentId),q=T&&E.extent==="parent"?Cz(T):void 0),B=[],M=void 0;for(const[j,U]of I)if(U.parentId===n&&(B.push({id:j,position:{...U.position},extent:U.extent}),U.extent==="parent"||U.expandParent)){const P=Tz(U,E,U.origin??R);M?M=[[Math.min(P[0][0],M[0][0]),Math.min(P[0][1],M[0][1])],[Math.max(P[1][0],M[1][0]),Math.max(P[1][1],M[1][1])]]:M=P}v==null||v(H,{..._})}).on("drag",H=>{const{transform:I,snapGrid:ee,snapToGrid:L,nodeOrigin:G}=i(),R=vo(H.sourceEvent,{transform:I,snapGrid:ee,snapToGrid:L,containerBounds:A}),$=[];if(!E)return;const{x:Z,y:J,width:j,height:U}=_,P={},N=E.origin??G,{width:Y,height:F,x:K,y:ne}=Nz(z,u.controlDirection,R,u.boundaries,u.keepAspectRatio,N,q,M),re=Y!==j,se=F!==U,ye=K!==Z&&re,ve=ne!==J&&se;if(!ye&&!ve&&!re&&!se)return;if((ye||ve||N[0]===1||N[1]===1)&&(P.x=ye?K:_.x,P.y=ve?ne:_.y,_.x=P.x,_.y=P.y,B.length>0)){const Me=K-Z,Ce=ne-J;for(const st of B)st.position={x:st.position.x-Me+N[0]*(Y-j),y:st.position.y-Ce+N[1]*(F-U)},$.push(st)}if((re||se)&&(P.width=re&&(!u.resizeDirection||u.resizeDirection==="horizontal")?Y:_.width,P.height=se&&(!u.resizeDirection||u.resizeDirection==="vertical")?F:_.height,_.width=P.width,_.height=P.height),T&&E.expandParent){const Me=N[0]*(P.width??0);P.x&&P.x{D&&(k==null||k(H,{..._}),o==null||o({..._}),D=!1)});s.call(X)}function d(){s.on(".drag",null)}return{update:f,destroy:d}}var th={exports:{}},nh={},rh={exports:{}},ih={};/** + `})]}),b.jsx("span",{className:"text-[var(--text-muted)] font-mono whitespace-nowrap",children:NN(o,e)}),b.jsxs("span",{className:"text-[var(--text-muted)] font-mono whitespace-nowrap",children:["Event ",e,"/",n]}),b.jsx("div",{className:"flex items-center gap-0.5",children:EN.map(p=>b.jsxs("button",{onClick:()=>f(p),className:Ye("px-1.5 py-0.5 rounded text-xs font-mono transition-colors",l===p?"bg-[var(--accent)] text-white":"text-[var(--text-muted)] hover:text-[var(--text-secondary)] hover:bg-[var(--surface-hover)]"),children:[p,"×"]},p))})]})}const ac=V.createContext(null);ac.displayName="PanelGroupContext";const gt={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},Yp=10,qi=V.useLayoutEffect,Nx=H2.useId,CN=typeof Nx=="function"?Nx:()=>null;let TN=0;function Gp(e=null){const n=CN(),i=V.useRef(e||n||null);return i.current===null&&(i.current=""+TN++),e??i.current}function Ob({children:e,className:n="",collapsedSize:i,collapsible:l,defaultSize:o,forwardedRef:s,id:u,maxSize:f,minSize:d,onCollapse:h,onExpand:m,onResize:p,order:y,style:v,tagName:w="div",...E}){const _=V.useContext(ac);if(_===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:S,expandPanel:z,getPanelSize:k,getPanelStyle:A,groupId:M,isPanelCollapsed:T,reevaluatePanelConstraints:q,registerPanel:j,resizePanel:L,unregisterPanel:X}=_,B=Gp(u),I=V.useRef({callbacks:{onCollapse:h,onExpand:m,onResize:p},constraints:{collapsedSize:i,collapsible:l,defaultSize:o,maxSize:f,minSize:d},id:B,idIsFromProps:u!==void 0,order:y});V.useRef({didLogMissingDefaultSizeWarning:!1}),qi(()=>{const{callbacks:H,constraints:G}=I.current,D={...G};I.current.id=B,I.current.idIsFromProps=u!==void 0,I.current.order=y,H.onCollapse=h,H.onExpand=m,H.onResize=p,G.collapsedSize=i,G.collapsible=l,G.defaultSize=o,G.maxSize=f,G.minSize=d,(D.collapsedSize!==G.collapsedSize||D.collapsible!==G.collapsible||D.maxSize!==G.maxSize||D.minSize!==G.minSize)&&q(I.current,D)}),qi(()=>{const H=I.current;return j(H),()=>{X(H)}},[y,B,j,X]),V.useImperativeHandle(s,()=>({collapse:()=>{S(I.current)},expand:H=>{z(I.current,H)},getId(){return B},getSize(){return k(I.current)},isCollapsed(){return T(I.current)},isExpanded(){return!T(I.current)},resize:H=>{L(I.current,H)}}),[S,z,k,T,B,L]);const ee=A(I.current,o);return V.createElement(w,{...E,children:e,className:n,id:B,style:{...ee,...v},[gt.groupId]:M,[gt.panel]:"",[gt.panelCollapsible]:l||void 0,[gt.panelId]:B,[gt.panelSize]:parseFloat(""+ee.flexGrow).toFixed(1)})}const po=V.forwardRef((e,n)=>V.createElement(Ob,{...e,forwardedRef:n}));Ob.displayName="Panel";po.displayName="forwardRef(Panel)";let mp=null,Lu=-1,ci=null;function zN(e,n){if(n){const i=(n&Bb)!==0,l=(n&qb)!==0,o=(n&Ub)!==0,s=(n&Ib)!==0;if(i)return o?"se-resize":s?"ne-resize":"e-resize";if(l)return o?"sw-resize":s?"nw-resize":"w-resize";if(o)return"s-resize";if(s)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function AN(){ci!==null&&(document.head.removeChild(ci),mp=null,ci=null,Lu=-1)}function Yd(e,n){var i,l;const o=zN(e,n);if(mp!==o){if(mp=o,ci===null&&(ci=document.createElement("style"),document.head.appendChild(ci)),Lu>=0){var s;(s=ci.sheet)===null||s===void 0||s.removeRule(Lu)}Lu=(i=(l=ci.sheet)===null||l===void 0?void 0:l.insertRule(`*{cursor: ${o} !important;}`))!==null&&i!==void 0?i:-1}}function Rb(e){return e.type==="keydown"}function Db(e){return e.type.startsWith("pointer")}function Lb(e){return e.type.startsWith("mouse")}function oc(e){if(Db(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(Lb(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function MN(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function jN(e,n,i){return e.xn.x&&e.yn.y}function ON(e,n){if(e===n)throw new Error("Cannot compare node with itself");const i={a:Tx(e),b:Tx(n)};let l;for(;i.a.at(-1)===i.b.at(-1);)e=i.a.pop(),n=i.b.pop(),l=e;Re(l,"Stacking order can only be calculated for elements with a common ancestor");const o={a:Cx(kx(i.a)),b:Cx(kx(i.b))};if(o.a===o.b){const s=l.childNodes,u={a:i.a.at(-1),b:i.b.at(-1)};let f=s.length;for(;f--;){const d=s[f];if(d===u.a)return 1;if(d===u.b)return-1}}return Math.sign(o.a-o.b)}const RN=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function DN(e){var n;const i=getComputedStyle((n=Hb(e))!==null&&n!==void 0?n:e).display;return i==="flex"||i==="inline-flex"}function LN(e){const n=getComputedStyle(e);return!!(n.position==="fixed"||n.zIndex!=="auto"&&(n.position!=="static"||DN(e))||+n.opacity<1||"transform"in n&&n.transform!=="none"||"webkitTransform"in n&&n.webkitTransform!=="none"||"mixBlendMode"in n&&n.mixBlendMode!=="normal"||"filter"in n&&n.filter!=="none"||"webkitFilter"in n&&n.webkitFilter!=="none"||"isolation"in n&&n.isolation==="isolate"||RN.test(n.willChange)||n.webkitOverflowScrolling==="touch")}function kx(e){let n=e.length;for(;n--;){const i=e[n];if(Re(i,"Missing node"),LN(i))return i}return null}function Cx(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Tx(e){const n=[];for(;e;)n.push(e),e=Hb(e);return n}function Hb(e){const{parentNode:n}=e;return n&&n instanceof ShadowRoot?n.host:n}const Bb=1,qb=2,Ub=4,Ib=8,HN=MN()==="coarse";let In=[],$l=!1,Li=new Map,sc=new Map;const No=new Set;function BN(e,n,i,l,o){var s;const{ownerDocument:u}=n,f={direction:i,element:n,hitAreaMargins:l,setResizeHandlerState:o},d=(s=Li.get(u))!==null&&s!==void 0?s:0;return Li.set(u,d+1),No.add(f),Gu(),function(){var m;sc.delete(e),No.delete(f);const p=(m=Li.get(u))!==null&&m!==void 0?m:1;if(Li.set(u,p-1),Gu(),p===1&&Li.delete(u),In.includes(f)){const y=In.indexOf(f);y>=0&&In.splice(y,1),Xp(),o("up",!0,null)}}}function qN(e){const{target:n}=e,{x:i,y:l}=oc(e);$l=!0,$p({target:n,x:i,y:l}),Gu(),In.length>0&&($u("down",e),e.preventDefault(),Vb(n)||e.stopImmediatePropagation())}function Gd(e){const{x:n,y:i}=oc(e);if($l&&e.buttons===0&&($l=!1,$u("up",e)),!$l){const{target:l}=e;$p({target:l,x:n,y:i})}$u("move",e),Xp(),In.length>0&&e.preventDefault()}function $d(e){const{target:n}=e,{x:i,y:l}=oc(e);sc.clear(),$l=!1,In.length>0&&(e.preventDefault(),Vb(n)||e.stopImmediatePropagation()),$u("up",e),$p({target:n,x:i,y:l}),Xp(),Gu()}function Vb(e){let n=e;for(;n;){if(n.hasAttribute(gt.resizeHandle))return!0;n=n.parentElement}return!1}function $p({target:e,x:n,y:i}){In.splice(0);let l=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(l=e),No.forEach(o=>{const{element:s,hitAreaMargins:u}=o,f=s.getBoundingClientRect(),{bottom:d,left:h,right:m,top:p}=f,y=HN?u.coarse:u.fine;if(n>=h-y&&n<=m+y&&i>=p-y&&i<=d+y){if(l!==null&&document.contains(l)&&s!==l&&!s.contains(l)&&!l.contains(s)&&ON(l,s)>0){let w=l,E=!1;for(;w&&!w.contains(s);){if(jN(w.getBoundingClientRect(),f)){E=!0;break}w=w.parentElement}if(E)return}In.push(o)}})}function Xd(e,n){sc.set(e,n)}function Xp(){let e=!1,n=!1;In.forEach(l=>{const{direction:o}=l;o==="horizontal"?e=!0:n=!0});let i=0;sc.forEach(l=>{i|=l}),e&&n?Yd("intersection",i):e?Yd("horizontal",i):n?Yd("vertical",i):AN()}let Fd=new AbortController;function Gu(){Fd.abort(),Fd=new AbortController;const e={capture:!0,signal:Fd.signal};No.size&&($l?(In.length>0&&Li.forEach((n,i)=>{const{body:l}=i;n>0&&(l.addEventListener("contextmenu",$d,e),l.addEventListener("pointerleave",Gd,e),l.addEventListener("pointermove",Gd,e))}),window.addEventListener("pointerup",$d,e),window.addEventListener("pointercancel",$d,e)):Li.forEach((n,i)=>{const{body:l}=i;n>0&&(l.addEventListener("pointerdown",qN,e),l.addEventListener("pointermove",Gd,e))}))}function $u(e,n){No.forEach(i=>{const{setResizeHandlerState:l}=i,o=In.includes(i);l(e,o,n)})}function UN(){const[e,n]=V.useState(0);return V.useCallback(()=>n(i=>i+1),[])}function Re(e,n){if(!e)throw console.error(n),Error(n)}function Vi(e,n,i=Yp){return e.toFixed(i)===n.toFixed(i)?0:e>n?1:-1}function kr(e,n,i=Yp){return Vi(e,n,i)===0}function yn(e,n,i){return Vi(e,n,i)===0}function IN(e,n,i){if(e.length!==n.length)return!1;for(let l=0;l0&&(e=e<0?0-S:S)}}}{const p=e<0?f:d,y=i[p];Re(y,`No panel constraints found for index ${p}`);const{collapsedSize:v=0,collapsible:w,minSize:E=0}=y;if(w){const _=n[p];if(Re(_!=null,`Previous layout not found for panel index ${p}`),yn(_,E)){const S=_-v;Vi(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}}{const p=e<0?1:-1;let y=e<0?d:f,v=0;for(;;){const E=n[y];Re(E!=null,`Previous layout not found for panel index ${y}`);const S=Il({panelConstraints:i,panelIndex:y,size:100})-E;if(v+=S,y+=p,y<0||y>=i.length)break}const w=Math.min(Math.abs(e),Math.abs(v));e=e<0?0-w:w}{let y=e<0?f:d;for(;y>=0&&y=0))break;e<0?y--:y++}}if(IN(o,u))return o;{const p=e<0?d:f,y=n[p];Re(y!=null,`Previous layout not found for panel index ${p}`);const v=y+h,w=Il({panelConstraints:i,panelIndex:p,size:v});if(u[p]=w,!yn(w,v)){let E=v-w,S=e<0?d:f;for(;S>=0&&S0?S--:S++}}}const m=u.reduce((p,y)=>y+p,0);return yn(m,100)?u:o}function VN({layout:e,panelsArray:n,pivotIndices:i}){let l=0,o=100,s=0,u=0;const f=i[0];Re(f!=null,"No pivot index found"),n.forEach((p,y)=>{const{constraints:v}=p,{maxSize:w=100,minSize:E=0}=v;y===f?(l=E,o=w):(s+=E,u+=w)});const d=Math.min(o,100-s),h=Math.max(l,100-u),m=e[f];return{valueMax:d,valueMin:h,valueNow:m}}function ko(e,n=document){return Array.from(n.querySelectorAll(`[${gt.resizeHandleId}][data-panel-group-id="${e}"]`))}function Yb(e,n,i=document){const o=ko(e,i).findIndex(s=>s.getAttribute(gt.resizeHandleId)===n);return o??null}function Gb(e,n,i){const l=Yb(e,n,i);return l!=null?[l,l+1]:[-1,-1]}function $b(e,n=document){var i;if(n instanceof HTMLElement&&(n==null||(i=n.dataset)===null||i===void 0?void 0:i.panelGroupId)==e)return n;const l=n.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return l||null}function uc(e,n=document){const i=n.querySelector(`[${gt.resizeHandleId}="${e}"]`);return i||null}function YN(e,n,i,l=document){var o,s,u,f;const d=uc(n,l),h=ko(e,l),m=d?h.indexOf(d):-1,p=(o=(s=i[m])===null||s===void 0?void 0:s.id)!==null&&o!==void 0?o:null,y=(u=(f=i[m+1])===null||f===void 0?void 0:f.id)!==null&&u!==void 0?u:null;return[p,y]}function GN({committedValuesRef:e,eagerValuesRef:n,groupId:i,layout:l,panelDataArray:o,panelGroupElement:s,setLayout:u}){V.useRef({didWarnAboutMissingResizeHandle:!1}),qi(()=>{if(!s)return;const f=ko(i,s);for(let d=0;d{f.forEach((d,h)=>{d.removeAttribute("aria-controls"),d.removeAttribute("aria-valuemax"),d.removeAttribute("aria-valuemin"),d.removeAttribute("aria-valuenow")})}},[i,l,o,s]),V.useEffect(()=>{if(!s)return;const f=n.current;Re(f,"Eager values not found");const{panelDataArray:d}=f,h=$b(i,s);Re(h!=null,`No group found for id "${i}"`);const m=ko(i,s);Re(m,`No resize handles found for group id "${i}"`);const p=m.map(y=>{const v=y.getAttribute(gt.resizeHandleId);Re(v,"Resize handle element has no handle id attribute");const[w,E]=YN(i,v,d,s);if(w==null||E==null)return()=>{};const _=S=>{if(!S.defaultPrevented)switch(S.key){case"Enter":{S.preventDefault();const z=d.findIndex(k=>k.id===w);if(z>=0){const k=d[z];Re(k,`No panel data found for index ${z}`);const A=l[z],{collapsedSize:M=0,collapsible:T,minSize:q=0}=k.constraints;if(A!=null&&T){const j=mo({delta:yn(A,M)?q-M:M-A,initialLayout:l,panelConstraints:d.map(L=>L.constraints),pivotIndices:Gb(i,v,s),prevLayout:l,trigger:"keyboard"});l!==j&&u(j)}}break}}};return y.addEventListener("keydown",_),()=>{y.removeEventListener("keydown",_)}});return()=>{p.forEach(y=>y())}},[s,e,n,i,l,o,u])}function zx(e,n){if(e.length!==n.length)return!1;for(let i=0;is.constraints);let l=0,o=100;for(let s=0;s{const s=e[o];Re(s,`Panel data not found for index ${o}`);const{callbacks:u,constraints:f,id:d}=s,{collapsedSize:h=0,collapsible:m}=f,p=i[d];if(p==null||l!==p){i[d]=l;const{onCollapse:y,onExpand:v,onResize:w}=u;w&&w(l,p),m&&(y||v)&&(v&&(p==null||kr(p,h))&&!kr(l,h)&&v(),y&&(p==null||!kr(p,h))&&kr(l,h)&&y())}})}function Su(e,n){if(e.length!==n.length)return!1;for(let i=0;i{i!==null&&clearTimeout(i),i=setTimeout(()=>{e(...o)},n)}}function Ax(e){try{if(typeof localStorage<"u")e.getItem=n=>localStorage.getItem(n),e.setItem=(n,i)=>{localStorage.setItem(n,i)};else throw new Error("localStorage not supported in this environment")}catch(n){console.error(n),e.getItem=()=>null,e.setItem=()=>{}}}function Fb(e){return`react-resizable-panels:${e}`}function Pb(e){return e.map(n=>{const{constraints:i,id:l,idIsFromProps:o,order:s}=n;return o?l:s?`${s}:${JSON.stringify(i)}`:JSON.stringify(i)}).sort((n,i)=>n.localeCompare(i)).join(",")}function Qb(e,n){try{const i=Fb(e),l=n.getItem(i);if(l){const o=JSON.parse(l);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function ZN(e,n,i){var l,o;const s=(l=Qb(e,i))!==null&&l!==void 0?l:{},u=Pb(n);return(o=s[u])!==null&&o!==void 0?o:null}function KN(e,n,i,l,o){var s;const u=Fb(e),f=Pb(n),d=(s=Qb(e,o))!==null&&s!==void 0?s:{};d[f]={expandToSizes:Object.fromEntries(i.entries()),layout:l};try{o.setItem(u,JSON.stringify(d))}catch(h){console.error(h)}}function Mx({layout:e,panelConstraints:n}){const i=[...e],l=i.reduce((s,u)=>s+u,0);if(i.length!==n.length)throw Error(`Invalid ${n.length} panel layout: ${i.map(s=>`${s}%`).join(", ")}`);if(!yn(l,100)&&i.length>0)for(let s=0;s(Ax(go),go.getItem(e)),setItem:(e,n)=>{Ax(go),go.setItem(e,n)}},jx={};function Zb({autoSaveId:e=null,children:n,className:i="",direction:l,forwardedRef:o,id:s=null,onLayout:u=null,keyboardResizeBy:f=null,storage:d=go,style:h,tagName:m="div",...p}){const y=Gp(s),v=V.useRef(null),[w,E]=V.useState(null),[_,S]=V.useState([]),z=UN(),k=V.useRef({}),A=V.useRef(new Map),M=V.useRef(0),T=V.useRef({autoSaveId:e,direction:l,dragState:w,id:y,keyboardResizeBy:f,onLayout:u,storage:d}),q=V.useRef({layout:_,panelDataArray:[],panelDataArrayChanged:!1});V.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),V.useImperativeHandle(o,()=>({getId:()=>T.current.id,getLayout:()=>{const{layout:N}=q.current;return N},setLayout:N=>{const{onLayout:Y}=T.current,{layout:P,panelDataArray:K}=q.current,ne=Mx({layout:N,panelConstraints:K.map(re=>re.constraints)});zx(P,ne)||(S(ne),q.current.layout=ne,Y&&Y(ne),Dl(K,ne,k.current))}}),[]),qi(()=>{T.current.autoSaveId=e,T.current.direction=l,T.current.dragState=w,T.current.id=y,T.current.onLayout=u,T.current.storage=d}),GN({committedValuesRef:T,eagerValuesRef:q,groupId:y,layout:_,panelDataArray:q.current.panelDataArray,setLayout:S,panelGroupElement:v.current}),V.useEffect(()=>{const{panelDataArray:N}=q.current;if(e){if(_.length===0||_.length!==N.length)return;let Y=jx[e];Y==null&&(Y=QN(KN,JN),jx[e]=Y);const P=[...N],K=new Map(A.current);Y(e,P,K,_,d)}},[e,_,d]),V.useEffect(()=>{});const j=V.useCallback(N=>{const{onLayout:Y}=T.current,{layout:P,panelDataArray:K}=q.current;if(N.constraints.collapsible){const ne=K.map(ve=>ve.constraints),{collapsedSize:re=0,panelSize:se,pivotIndices:ye}=Ri(K,N,P);if(Re(se!=null,`Panel size not found for panel "${N.id}"`),!kr(se,re)){A.current.set(N.id,se);const xe=ql(K,N)===K.length-1?se-re:re-se,pe=mo({delta:xe,initialLayout:P,panelConstraints:ne,pivotIndices:ye,prevLayout:P,trigger:"imperative-api"});Su(P,pe)||(S(pe),q.current.layout=pe,Y&&Y(pe),Dl(K,pe,k.current))}}},[]),L=V.useCallback((N,Y)=>{const{onLayout:P}=T.current,{layout:K,panelDataArray:ne}=q.current;if(N.constraints.collapsible){const re=ne.map(_e=>_e.constraints),{collapsedSize:se=0,panelSize:ye=0,minSize:ve=0,pivotIndices:xe}=Ri(ne,N,K),pe=Y??ve;if(kr(ye,se)){const _e=A.current.get(N.id),Me=_e!=null&&_e>=pe?_e:pe,st=ql(ne,N)===ne.length-1?ye-Me:Me-ye,We=mo({delta:st,initialLayout:K,panelConstraints:re,pivotIndices:xe,prevLayout:K,trigger:"imperative-api"});Su(K,We)||(S(We),q.current.layout=We,P&&P(We),Dl(ne,We,k.current))}}},[]),X=V.useCallback(N=>{const{layout:Y,panelDataArray:P}=q.current,{panelSize:K}=Ri(P,N,Y);return Re(K!=null,`Panel size not found for panel "${N.id}"`),K},[]),B=V.useCallback((N,Y)=>{const{panelDataArray:P}=q.current,K=ql(P,N);return PN({defaultSize:Y,dragState:w,layout:_,panelData:P,panelIndex:K})},[w,_]),I=V.useCallback(N=>{const{layout:Y,panelDataArray:P}=q.current,{collapsedSize:K=0,collapsible:ne,panelSize:re}=Ri(P,N,Y);return Re(re!=null,`Panel size not found for panel "${N.id}"`),ne===!0&&kr(re,K)},[]),ee=V.useCallback(N=>{const{layout:Y,panelDataArray:P}=q.current,{collapsedSize:K=0,collapsible:ne,panelSize:re}=Ri(P,N,Y);return Re(re!=null,`Panel size not found for panel "${N.id}"`),!ne||Vi(re,K)>0},[]),H=V.useCallback(N=>{const{panelDataArray:Y}=q.current;Y.push(N),Y.sort((P,K)=>{const ne=P.order,re=K.order;return ne==null&&re==null?0:ne==null?-1:re==null?1:ne-re}),q.current.panelDataArrayChanged=!0,z()},[z]);qi(()=>{if(q.current.panelDataArrayChanged){q.current.panelDataArrayChanged=!1;const{autoSaveId:N,onLayout:Y,storage:P}=T.current,{layout:K,panelDataArray:ne}=q.current;let re=null;if(N){const ye=ZN(N,ne,P);ye&&(A.current=new Map(Object.entries(ye.expandToSizes)),re=ye.layout)}re==null&&(re=FN({panelDataArray:ne}));const se=Mx({layout:re,panelConstraints:ne.map(ye=>ye.constraints)});zx(K,se)||(S(se),q.current.layout=se,Y&&Y(se),Dl(ne,se,k.current))}}),qi(()=>{const N=q.current;return()=>{N.layout=[]}},[]);const G=V.useCallback(N=>{let Y=!1;const P=v.current;return P&&window.getComputedStyle(P,null).getPropertyValue("direction")==="rtl"&&(Y=!0),function(ne){ne.preventDefault();const re=v.current;if(!re)return()=>null;const{direction:se,dragState:ye,id:ve,keyboardResizeBy:xe,onLayout:pe}=T.current,{layout:_e,panelDataArray:Me}=q.current,{initialLayout:Ce}=ye??{},st=Gb(ve,N,re);let We=XN(ne,N,se,ye,xe,re);const zt=se==="horizontal";zt&&Y&&(We=-We);const Ut=Me.map(Mn=>Mn.constraints),Rt=mo({delta:We,initialLayout:Ce??_e,panelConstraints:Ut,pivotIndices:st,prevLayout:_e,trigger:Rb(ne)?"keyboard":"mouse-or-touch"}),wn=!Su(_e,Rt);(Db(ne)||Lb(ne))&&M.current!=We&&(M.current=We,!wn&&We!==0?zt?Xd(N,We<0?Bb:qb):Xd(N,We<0?Ub:Ib):Xd(N,0)),wn&&(S(Rt),q.current.layout=Rt,pe&&pe(Rt),Dl(Me,Rt,k.current))}},[]),D=V.useCallback((N,Y)=>{const{onLayout:P}=T.current,{layout:K,panelDataArray:ne}=q.current,re=ne.map(_e=>_e.constraints),{panelSize:se,pivotIndices:ye}=Ri(ne,N,K);Re(se!=null,`Panel size not found for panel "${N.id}"`);const xe=ql(ne,N)===ne.length-1?se-Y:Y-se,pe=mo({delta:xe,initialLayout:K,panelConstraints:re,pivotIndices:ye,prevLayout:K,trigger:"imperative-api"});Su(K,pe)||(S(pe),q.current.layout=pe,P&&P(pe),Dl(ne,pe,k.current))},[]),$=V.useCallback((N,Y)=>{const{layout:P,panelDataArray:K}=q.current,{collapsedSize:ne=0,collapsible:re}=Y,{collapsedSize:se=0,collapsible:ye,maxSize:ve=100,minSize:xe=0}=N.constraints,{panelSize:pe}=Ri(K,N,P);pe!=null&&(re&&ye&&kr(pe,ne)?kr(ne,se)||D(N,se):peve&&D(N,ve))},[D]),Z=V.useCallback((N,Y)=>{const{direction:P}=T.current,{layout:K}=q.current;if(!v.current)return;const ne=uc(N,v.current);Re(ne,`Drag handle element not found for id "${N}"`);const re=Xb(P,Y);E({dragHandleId:N,dragHandleRect:ne.getBoundingClientRect(),initialCursorPosition:re,initialLayout:K})},[]),J=V.useCallback(()=>{E(null)},[]),O=V.useCallback(N=>{const{panelDataArray:Y}=q.current,P=ql(Y,N);P>=0&&(Y.splice(P,1),delete k.current[N.id],q.current.panelDataArrayChanged=!0,z())},[z]),U=V.useMemo(()=>({collapsePanel:j,direction:l,dragState:w,expandPanel:L,getPanelSize:X,getPanelStyle:B,groupId:y,isPanelCollapsed:I,isPanelExpanded:ee,reevaluatePanelConstraints:$,registerPanel:H,registerResizeHandle:G,resizePanel:D,startDragging:Z,stopDragging:J,unregisterPanel:O,panelGroupElement:v.current}),[j,w,l,L,X,B,y,I,ee,$,H,G,D,Z,J,O]),F={display:"flex",flexDirection:l==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return V.createElement(ac.Provider,{value:U},V.createElement(m,{...p,children:n,className:i,id:s,ref:v,style:{...F,...h},[gt.group]:"",[gt.groupDirection]:l,[gt.groupId]:y}))}const gp=V.forwardRef((e,n)=>V.createElement(Zb,{...e,forwardedRef:n}));Zb.displayName="PanelGroup";gp.displayName="forwardRef(PanelGroup)";function ql(e,n){return e.findIndex(i=>i===n||i.id===n.id)}function Ri(e,n,i){const l=ql(e,n),s=l===e.length-1?[l-1,l]:[l,l+1],u=i[l];return{...n.constraints,panelSize:u,pivotIndices:s}}function WN({disabled:e,handleId:n,resizeHandler:i,panelGroupElement:l}){V.useEffect(()=>{if(e||i==null||l==null)return;const o=uc(n,l);if(o==null)return;const s=u=>{if(!u.defaultPrevented)switch(u.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{u.preventDefault(),i(u);break}case"F6":{u.preventDefault();const f=o.getAttribute(gt.groupId);Re(f,`No group element found for id "${f}"`);const d=ko(f,l),h=Yb(f,n,l);Re(h!==null,`No resize element found for id "${n}"`);const m=u.shiftKey?h>0?h-1:d.length-1:h+1{o.removeEventListener("keydown",s)}},[l,e,n,i])}function yp({children:e=null,className:n="",disabled:i=!1,hitAreaMargins:l,id:o,onBlur:s,onClick:u,onDragging:f,onFocus:d,onPointerDown:h,onPointerUp:m,style:p={},tabIndex:y=0,tagName:v="div",...w}){var E,_;const S=V.useRef(null),z=V.useRef({onClick:u,onDragging:f,onPointerDown:h,onPointerUp:m});V.useEffect(()=>{z.current.onClick=u,z.current.onDragging=f,z.current.onPointerDown=h,z.current.onPointerUp=m});const k=V.useContext(ac);if(k===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:A,groupId:M,registerResizeHandle:T,startDragging:q,stopDragging:j,panelGroupElement:L}=k,X=Gp(o),[B,I]=V.useState("inactive"),[ee,H]=V.useState(!1),[G,D]=V.useState(null),$=V.useRef({state:B});qi(()=>{$.current.state=B}),V.useEffect(()=>{if(i)D(null);else{const U=T(X);D(()=>U)}},[i,X,T]);const Z=(E=l==null?void 0:l.coarse)!==null&&E!==void 0?E:15,J=(_=l==null?void 0:l.fine)!==null&&_!==void 0?_:5;V.useEffect(()=>{if(i||G==null)return;const U=S.current;Re(U,"Element ref not attached");let F=!1;return BN(X,U,A,{coarse:Z,fine:J},(Y,P,K)=>{if(!P){I("inactive");return}switch(Y){case"down":{I("drag"),F=!1,Re(K,'Expected event to be defined for "down" action'),q(X,K);const{onDragging:ne,onPointerDown:re}=z.current;ne==null||ne(!0),re==null||re();break}case"move":{const{state:ne}=$.current;F=!0,ne!=="drag"&&I("hover"),Re(K,'Expected event to be defined for "move" action'),G(K);break}case"up":{I("hover"),j();const{onClick:ne,onDragging:re,onPointerUp:se}=z.current;re==null||re(!1),se==null||se(),F||ne==null||ne();break}}})},[Z,A,i,J,T,X,G,q,j]),WN({disabled:i,handleId:X,resizeHandler:G,panelGroupElement:L});const O={touchAction:"none",userSelect:"none"};return V.createElement(v,{...w,children:e,className:n,id:o,onBlur:()=>{H(!1),s==null||s()},onFocus:()=>{H(!0),d==null||d()},ref:S,role:"separator",style:{...O,...p},tabIndex:y,[gt.groupDirection]:A,[gt.groupId]:M,[gt.resizeHandle]:"",[gt.resizeHandleActive]:B==="drag"?"pointer":ee?"keyboard":void 0,[gt.resizeHandleEnabled]:!i,[gt.resizeHandleId]:X,[gt.resizeHandleState]:B})}yp.displayName="PanelResizeHandle";function Tt(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let i=0,l;i{}};function cc(){for(var e=0,n=arguments.length,i={},l;e=0&&(l=i.slice(o+1),i=i.slice(0,o)),i&&!n.hasOwnProperty(i))throw new Error("unknown type: "+i);return{type:i,name:l}})}Hu.prototype=cc.prototype={constructor:Hu,on:function(e,n){var i=this._,l=tk(e+"",i),o,s=-1,u=l.length;if(arguments.length<2){for(;++s0)for(var i=new Array(o),l=0,o,s;l=0&&(n=e.slice(0,i))!=="xmlns"&&(e=e.slice(i+1)),Rx.hasOwnProperty(n)?{space:Rx[n],local:e}:e}function rk(e){return function(){var n=this.ownerDocument,i=this.namespaceURI;return i===xp&&n.documentElement.namespaceURI===xp?n.createElement(e):n.createElementNS(i,e)}}function ik(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Kb(e){var n=fc(e);return(n.local?ik:rk)(n)}function lk(){}function Fp(e){return e==null?lk:function(){return this.querySelector(e)}}function ak(e){typeof e!="function"&&(e=Fp(e));for(var n=this._groups,i=n.length,l=new Array(i),o=0;o=k&&(k=z+1);!(M=_[k])&&++k=0;)(u=l[o])&&(s&&u.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(u,s),s=u);return this}function Mk(e){e||(e=jk);function n(p,y){return p&&y?e(p.__data__,y.__data__):!p-!y}for(var i=this._groups,l=i.length,o=new Array(l),s=0;sn?1:e>=n?0:NaN}function Ok(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Rk(){return Array.from(this)}function Dk(){for(var e=this._groups,n=0,i=e.length;n1?this.each((n==null?Xk:typeof n=="function"?Pk:Fk)(e,n,i??"")):Jl(this.node(),e)}function Jl(e,n){return e.style.getPropertyValue(n)||nw(e).getComputedStyle(e,null).getPropertyValue(n)}function Zk(e){return function(){delete this[e]}}function Kk(e,n){return function(){this[e]=n}}function Jk(e,n){return function(){var i=n.apply(this,arguments);i==null?delete this[e]:this[e]=i}}function Wk(e,n){return arguments.length>1?this.each((n==null?Zk:typeof n=="function"?Jk:Kk)(e,n)):this.node()[e]}function rw(e){return e.trim().split(/^|\s+/)}function Pp(e){return e.classList||new iw(e)}function iw(e){this._node=e,this._names=rw(e.getAttribute("class")||"")}iw.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function lw(e,n){for(var i=Pp(e),l=-1,o=n.length;++l=0&&(i=n.slice(l+1),n=n.slice(0,l)),{type:n,name:i}})}function CC(e){return function(){var n=this.__on;if(n){for(var i=0,l=-1,o=n.length,s;i()=>e;function vp(e,{sourceEvent:n,subject:i,target:l,identifier:o,active:s,x:u,y:f,dx:d,dy:h,dispatch:m}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:i,enumerable:!0,configurable:!0},target:{value:l,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:f,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:m}})}vp.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function HC(e){return!e.ctrlKey&&!e.button}function BC(){return this.parentNode}function qC(e,n){return n??{x:e.x,y:e.y}}function UC(){return navigator.maxTouchPoints||"ontouchstart"in this}function fw(){var e=HC,n=BC,i=qC,l=UC,o={},s=cc("start","drag","end"),u=0,f,d,h,m,p=0;function y(A){A.on("mousedown.drag",v).filter(l).on("touchstart.drag",_).on("touchmove.drag",S,LC).on("touchend.drag touchcancel.drag",z).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(A,M){if(!(m||!e.call(this,A,M))){var T=k(this,n.call(this,A,M),A,M,"mouse");T&&(xn(A.view).on("mousemove.drag",w,Co).on("mouseup.drag",E,Co),uw(A.view),Pd(A),h=!1,f=A.clientX,d=A.clientY,T("start",A))}}function w(A){if(Xl(A),!h){var M=A.clientX-f,T=A.clientY-d;h=M*M+T*T>p}o.mouse("drag",A)}function E(A){xn(A.view).on("mousemove.drag mouseup.drag",null),cw(A.view,h),Xl(A),o.mouse("end",A)}function _(A,M){if(e.call(this,A,M)){var T=A.changedTouches,q=n.call(this,A,M),j=T.length,L,X;for(L=0;L>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):i===8?Eu(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):i===4?Eu(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=VC.exec(e))?new nn(n[1],n[2],n[3],1):(n=YC.exec(e))?new nn(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=GC.exec(e))?Eu(n[1],n[2],n[3],n[4]):(n=$C.exec(e))?Eu(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=XC.exec(e))?Ix(n[1],n[2]/100,n[3]/100,1):(n=FC.exec(e))?Ix(n[1],n[2]/100,n[3]/100,n[4]):Dx.hasOwnProperty(e)?Bx(Dx[e]):e==="transparent"?new nn(NaN,NaN,NaN,0):null}function Bx(e){return new nn(e>>16&255,e>>8&255,e&255,1)}function Eu(e,n,i,l){return l<=0&&(e=n=i=NaN),new nn(e,n,i,l)}function ZC(e){return e instanceof Uo||(e=Yi(e)),e?(e=e.rgb(),new nn(e.r,e.g,e.b,e.opacity)):new nn}function bp(e,n,i,l){return arguments.length===1?ZC(e):new nn(e,n,i,l??1)}function nn(e,n,i,l){this.r=+e,this.g=+n,this.b=+i,this.opacity=+l}Qp(nn,bp,dw(Uo,{brighter(e){return e=e==null?Fu:Math.pow(Fu,e),new nn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?To:Math.pow(To,e),new nn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new nn(Ui(this.r),Ui(this.g),Ui(this.b),Pu(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:qx,formatHex:qx,formatHex8:KC,formatRgb:Ux,toString:Ux}));function qx(){return`#${Hi(this.r)}${Hi(this.g)}${Hi(this.b)}`}function KC(){return`#${Hi(this.r)}${Hi(this.g)}${Hi(this.b)}${Hi((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ux(){const e=Pu(this.opacity);return`${e===1?"rgb(":"rgba("}${Ui(this.r)}, ${Ui(this.g)}, ${Ui(this.b)}${e===1?")":`, ${e})`}`}function Pu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ui(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Hi(e){return e=Ui(e),(e<16?"0":"")+e.toString(16)}function Ix(e,n,i,l){return l<=0?e=n=i=NaN:i<=0||i>=1?e=n=NaN:n<=0&&(e=NaN),new Bn(e,n,i,l)}function hw(e){if(e instanceof Bn)return new Bn(e.h,e.s,e.l,e.opacity);if(e instanceof Uo||(e=Yi(e)),!e)return new Bn;if(e instanceof Bn)return e;e=e.rgb();var n=e.r/255,i=e.g/255,l=e.b/255,o=Math.min(n,i,l),s=Math.max(n,i,l),u=NaN,f=s-o,d=(s+o)/2;return f?(n===s?u=(i-l)/f+(i0&&d<1?0:u,new Bn(u,f,d,e.opacity)}function JC(e,n,i,l){return arguments.length===1?hw(e):new Bn(e,n,i,l??1)}function Bn(e,n,i,l){this.h=+e,this.s=+n,this.l=+i,this.opacity=+l}Qp(Bn,JC,dw(Uo,{brighter(e){return e=e==null?Fu:Math.pow(Fu,e),new Bn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?To:Math.pow(To,e),new Bn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,i=this.l,l=i+(i<.5?i:1-i)*n,o=2*i-l;return new nn(Qd(e>=240?e-240:e+120,o,l),Qd(e,o,l),Qd(e<120?e+240:e-120,o,l),this.opacity)},clamp(){return new Bn(Vx(this.h),Nu(this.s),Nu(this.l),Pu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Pu(this.opacity);return`${e===1?"hsl(":"hsla("}${Vx(this.h)}, ${Nu(this.s)*100}%, ${Nu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Vx(e){return e=(e||0)%360,e<0?e+360:e}function Nu(e){return Math.max(0,Math.min(1,e||0))}function Qd(e,n,i){return(e<60?n+(i-n)*e/60:e<180?i:e<240?n+(i-n)*(240-e)/60:n)*255}const Zp=e=>()=>e;function WC(e,n){return function(i){return e+i*n}}function e3(e,n,i){return e=Math.pow(e,i),n=Math.pow(n,i)-e,i=1/i,function(l){return Math.pow(e+l*n,i)}}function t3(e){return(e=+e)==1?pw:function(n,i){return i-n?e3(n,i,e):Zp(isNaN(n)?i:n)}}function pw(e,n){var i=n-e;return i?WC(e,i):Zp(isNaN(e)?n:e)}const Qu=(function e(n){var i=t3(n);function l(o,s){var u=i((o=bp(o)).r,(s=bp(s)).r),f=i(o.g,s.g),d=i(o.b,s.b),h=pw(o.opacity,s.opacity);return function(m){return o.r=u(m),o.g=f(m),o.b=d(m),o.opacity=h(m),o+""}}return l.gamma=e,l})(1);function n3(e,n){n||(n=[]);var i=e?Math.min(n.length,e.length):0,l=n.slice(),o;return function(s){for(o=0;oi&&(s=n.slice(i,s),f[u]?f[u]+=s:f[++u]=s),(l=l[0])===(o=o[0])?f[u]?f[u]+=o:f[++u]=o:(f[++u]=null,d.push({i:u,x:Kn(l,o)})),i=Zd.lastIndex;return i180?m+=360:m-h>180&&(h+=360),y.push({i:p.push(o(p)+"rotate(",null,l)-2,x:Kn(h,m)})):m&&p.push(o(p)+"rotate("+m+l)}function f(h,m,p,y){h!==m?y.push({i:p.push(o(p)+"skewX(",null,l)-2,x:Kn(h,m)}):m&&p.push(o(p)+"skewX("+m+l)}function d(h,m,p,y,v,w){if(h!==p||m!==y){var E=v.push(o(v)+"scale(",null,",",null,")");w.push({i:E-4,x:Kn(h,p)},{i:E-2,x:Kn(m,y)})}else(p!==1||y!==1)&&v.push(o(v)+"scale("+p+","+y+")")}return function(h,m){var p=[],y=[];return h=e(h),m=e(m),s(h.translateX,h.translateY,m.translateX,m.translateY,p,y),u(h.rotate,m.rotate,p,y),f(h.skewX,m.skewX,p,y),d(h.scaleX,h.scaleY,m.scaleX,m.scaleY,p,y),h=m=null,function(v){for(var w=-1,E=y.length,_;++w=0&&e._call.call(void 0,n),e=e._next;--Wl}function $x(){Gi=(Ku=Ao.now())+dc,Wl=yo=0;try{y3()}finally{Wl=0,v3(),Gi=0}}function x3(){var e=Ao.now(),n=e-Ku;n>xw&&(dc-=n,Ku=e)}function v3(){for(var e,n=Zu,i,l=1/0;n;)n._call?(l>n._time&&(l=n._time),e=n,n=n._next):(i=n._next,n._next=null,n=e?e._next=i:Zu=i);xo=e,_p(l)}function _p(e){if(!Wl){yo&&(yo=clearTimeout(yo));var n=e-Gi;n>24?(e<1/0&&(yo=setTimeout($x,e-Ao.now()-dc)),oo&&(oo=clearInterval(oo))):(oo||(Ku=Ao.now(),oo=setInterval(x3,xw)),Wl=1,vw($x))}}function Xx(e,n,i){var l=new Ju;return n=n==null?0:+n,l.restart(o=>{l.stop(),e(o+n)},n,i),l}var b3=cc("start","end","cancel","interrupt"),w3=[],ww=0,Fx=1,Ep=2,qu=3,Px=4,Np=5,Uu=6;function hc(e,n,i,l,o,s){var u=e.__transition;if(!u)e.__transition={};else if(i in u)return;S3(e,i,{name:n,index:l,group:o,on:b3,tween:w3,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:ww})}function Jp(e,n){var i=Yn(e,n);if(i.state>ww)throw new Error("too late; already scheduled");return i}function rr(e,n){var i=Yn(e,n);if(i.state>qu)throw new Error("too late; already running");return i}function Yn(e,n){var i=e.__transition;if(!i||!(i=i[n]))throw new Error("transition not found");return i}function S3(e,n,i){var l=e.__transition,o;l[n]=i,i.timer=bw(s,0,i.time);function s(h){i.state=Fx,i.timer.restart(u,i.delay,i.time),i.delay<=h&&u(h-i.delay)}function u(h){var m,p,y,v;if(i.state!==Fx)return d();for(m in l)if(v=l[m],v.name===i.name){if(v.state===qu)return Xx(u);v.state===Px?(v.state=Uu,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete l[m]):+mEp&&l.state=0&&(n=n.slice(0,i)),!n||n==="start"})}function J3(e,n,i){var l,o,s=K3(n)?Jp:rr;return function(){var u=s(this,e),f=u.on;f!==l&&(o=(l=f).copy()).on(n,i),u.on=o}}function W3(e,n){var i=this._id;return arguments.length<2?Yn(this.node(),i).on.on(e):this.each(J3(i,e,n))}function eT(e){return function(){var n=this.parentNode;for(var i in this.__transition)if(+i!==e)return;n&&n.removeChild(this)}}function tT(){return this.on("end.remove",eT(this._id))}function nT(e){var n=this._name,i=this._id;typeof e!="function"&&(e=Fp(e));for(var l=this._groups,o=l.length,s=new Array(o),u=0;u()=>e;function CT(e,{sourceEvent:n,target:i,transform:l,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},transform:{value:l,enumerable:!0,configurable:!0},_:{value:o}})}function Cr(e,n,i){this.k=e,this.x=n,this.y=i}Cr.prototype={constructor:Cr,scale:function(e){return e===1?this:new Cr(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Cr(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var pc=new Cr(1,0,0);Nw.prototype=Cr.prototype;function Nw(e){for(;!e.__zoom;)if(!(e=e.parentNode))return pc;return e.__zoom}function Kd(e){e.stopImmediatePropagation()}function so(e){e.preventDefault(),e.stopImmediatePropagation()}function TT(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function zT(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Qx(){return this.__zoom||pc}function AT(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function MT(){return navigator.maxTouchPoints||"ontouchstart"in this}function jT(e,n,i){var l=e.invertX(n[0][0])-i[0][0],o=e.invertX(n[1][0])-i[1][0],s=e.invertY(n[0][1])-i[0][1],u=e.invertY(n[1][1])-i[1][1];return e.translate(o>l?(l+o)/2:Math.min(0,l)||Math.max(0,o),u>s?(s+u)/2:Math.min(0,s)||Math.max(0,u))}function kw(){var e=TT,n=zT,i=jT,l=AT,o=MT,s=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],f=250,d=Bu,h=cc("start","zoom","end"),m,p,y,v=500,w=150,E=0,_=10;function S(H){H.property("__zoom",Qx).on("wheel.zoom",j,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",X).filter(o).on("touchstart.zoom",B).on("touchmove.zoom",I).on("touchend.zoom touchcancel.zoom",ee).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(H,G,D,$){var Z=H.selection?H.selection():H;Z.property("__zoom",Qx),H!==Z?M(H,G,D,$):Z.interrupt().each(function(){T(this,arguments).event($).start().zoom(null,typeof G=="function"?G.apply(this,arguments):G).end()})},S.scaleBy=function(H,G,D,$){S.scaleTo(H,function(){var Z=this.__zoom.k,J=typeof G=="function"?G.apply(this,arguments):G;return Z*J},D,$)},S.scaleTo=function(H,G,D,$){S.transform(H,function(){var Z=n.apply(this,arguments),J=this.__zoom,O=D==null?A(Z):typeof D=="function"?D.apply(this,arguments):D,U=J.invert(O),F=typeof G=="function"?G.apply(this,arguments):G;return i(k(z(J,F),O,U),Z,u)},D,$)},S.translateBy=function(H,G,D,$){S.transform(H,function(){return i(this.__zoom.translate(typeof G=="function"?G.apply(this,arguments):G,typeof D=="function"?D.apply(this,arguments):D),n.apply(this,arguments),u)},null,$)},S.translateTo=function(H,G,D,$,Z){S.transform(H,function(){var J=n.apply(this,arguments),O=this.__zoom,U=$==null?A(J):typeof $=="function"?$.apply(this,arguments):$;return i(pc.translate(U[0],U[1]).scale(O.k).translate(typeof G=="function"?-G.apply(this,arguments):-G,typeof D=="function"?-D.apply(this,arguments):-D),J,u)},$,Z)};function z(H,G){return G=Math.max(s[0],Math.min(s[1],G)),G===H.k?H:new Cr(G,H.x,H.y)}function k(H,G,D){var $=G[0]-D[0]*H.k,Z=G[1]-D[1]*H.k;return $===H.x&&Z===H.y?H:new Cr(H.k,$,Z)}function A(H){return[(+H[0][0]+ +H[1][0])/2,(+H[0][1]+ +H[1][1])/2]}function M(H,G,D,$){H.on("start.zoom",function(){T(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event($).end()}).tween("zoom",function(){var Z=this,J=arguments,O=T(Z,J).event($),U=n.apply(Z,J),F=D==null?A(U):typeof D=="function"?D.apply(Z,J):D,N=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),Y=Z.__zoom,P=typeof G=="function"?G.apply(Z,J):G,K=d(Y.invert(F).concat(N/Y.k),P.invert(F).concat(N/P.k));return function(ne){if(ne===1)ne=P;else{var re=K(ne),se=N/re[2];ne=new Cr(se,F[0]-re[0]*se,F[1]-re[1]*se)}O.zoom(null,ne)}})}function T(H,G,D){return!D&&H.__zooming||new q(H,G)}function q(H,G){this.that=H,this.args=G,this.active=0,this.sourceEvent=null,this.extent=n.apply(H,G),this.taps=0}q.prototype={event:function(H){return H&&(this.sourceEvent=H),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(H,G){return this.mouse&&H!=="mouse"&&(this.mouse[1]=G.invert(this.mouse[0])),this.touch0&&H!=="touch"&&(this.touch0[1]=G.invert(this.touch0[0])),this.touch1&&H!=="touch"&&(this.touch1[1]=G.invert(this.touch1[0])),this.that.__zoom=G,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(H){var G=xn(this.that).datum();h.call(H,this.that,new CT(H,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:h}),G)}};function j(H,...G){if(!e.apply(this,arguments))return;var D=T(this,G).event(H),$=this.__zoom,Z=Math.max(s[0],Math.min(s[1],$.k*Math.pow(2,l.apply(this,arguments)))),J=Hn(H);if(D.wheel)(D.mouse[0][0]!==J[0]||D.mouse[0][1]!==J[1])&&(D.mouse[1]=$.invert(D.mouse[0]=J)),clearTimeout(D.wheel);else{if($.k===Z)return;D.mouse=[J,$.invert(J)],Iu(this),D.start()}so(H),D.wheel=setTimeout(O,w),D.zoom("mouse",i(k(z($,Z),D.mouse[0],D.mouse[1]),D.extent,u));function O(){D.wheel=null,D.end()}}function L(H,...G){if(y||!e.apply(this,arguments))return;var D=H.currentTarget,$=T(this,G,!0).event(H),Z=xn(H.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",N,!0),J=Hn(H,D),O=H.clientX,U=H.clientY;uw(H.view),Kd(H),$.mouse=[J,this.__zoom.invert(J)],Iu(this),$.start();function F(Y){if(so(Y),!$.moved){var P=Y.clientX-O,K=Y.clientY-U;$.moved=P*P+K*K>E}$.event(Y).zoom("mouse",i(k($.that.__zoom,$.mouse[0]=Hn(Y,D),$.mouse[1]),$.extent,u))}function N(Y){Z.on("mousemove.zoom mouseup.zoom",null),cw(Y.view,$.moved),so(Y),$.event(Y).end()}}function X(H,...G){if(e.apply(this,arguments)){var D=this.__zoom,$=Hn(H.changedTouches?H.changedTouches[0]:H,this),Z=D.invert($),J=D.k*(H.shiftKey?.5:2),O=i(k(z(D,J),$,Z),n.apply(this,G),u);so(H),f>0?xn(this).transition().duration(f).call(M,O,$,H):xn(this).call(S.transform,O,$,H)}}function B(H,...G){if(e.apply(this,arguments)){var D=H.touches,$=D.length,Z=T(this,G,H.changedTouches.length===$).event(H),J,O,U,F;for(Kd(H),O=0;O<$;++O)U=D[O],F=Hn(U,this),F=[F,this.__zoom.invert(F),U.identifier],Z.touch0?!Z.touch1&&Z.touch0[2]!==F[2]&&(Z.touch1=F,Z.taps=0):(Z.touch0=F,J=!0,Z.taps=1+!!m);m&&(m=clearTimeout(m)),J&&(Z.taps<2&&(p=F[0],m=setTimeout(function(){m=null},v)),Iu(this),Z.start())}}function I(H,...G){if(this.__zooming){var D=T(this,G).event(H),$=H.changedTouches,Z=$.length,J,O,U,F;for(so(H),J=0;J"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:n,sourceHandle:i,targetHandle:l})=>`Couldn't create edge for ${e} handle id: "${e==="source"?i:l}", edge id: ${n}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Mo=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Cw=["Enter"," ","Escape"],Tw={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:n,y:i})=>`Moved selected node ${e}. New position, x: ${n}, y: ${i}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var ea;(function(e){e.Strict="strict",e.Loose="loose"})(ea||(ea={}));var Ii;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ii||(Ii={}));var jo;(function(e){e.Partial="partial",e.Full="full"})(jo||(jo={}));const zw={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var fi;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(fi||(fi={}));var Wu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Wu||(Wu={}));var we;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(we||(we={}));const Zx={[we.Left]:we.Right,[we.Right]:we.Left,[we.Top]:we.Bottom,[we.Bottom]:we.Top};function Aw(e){return e===null?null:e?"valid":"invalid"}const Mw=e=>"id"in e&&"source"in e&&"target"in e,OT=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),em=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Io=(e,n=[0,0])=>{const{width:i,height:l}=Ar(e),o=e.origin??n,s=i*o[0],u=l*o[1];return{x:e.position.x-s,y:e.position.y-u}},RT=(e,n={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const i=e.reduce((l,o)=>{const s=typeof o=="string";let u=!n.nodeLookup&&!s?o:void 0;n.nodeLookup&&(u=s?n.nodeLookup.get(o):em(o)?o:n.nodeLookup.get(o.id));const f=u?ec(u,n.nodeOrigin):{x:0,y:0,x2:0,y2:0};return mc(l,f)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return gc(i)},Vo=(e,n={})=>{let i={x:1/0,y:1/0,x2:-1/0,y2:-1/0},l=!1;return e.forEach(o=>{(n.filter===void 0||n.filter(o))&&(i=mc(i,ec(o)),l=!0)}),l?gc(i):{x:0,y:0,width:0,height:0}},tm=(e,n,[i,l,o]=[0,0,1],s=!1,u=!1)=>{const f={...Go(n,[i,l,o]),width:n.width/o,height:n.height/o},d=[];for(const h of e.values()){const{measured:m,selectable:p=!0,hidden:y=!1}=h;if(u&&!p||y)continue;const v=m.width??h.width??h.initialWidth??null,w=m.height??h.height??h.initialHeight??null,E=Oo(f,na(h)),_=(v??0)*(w??0),S=s&&E>0;(!h.internals.handleBounds||S||E>=_||h.dragging)&&d.push(h)}return d},DT=(e,n)=>{const i=new Set;return e.forEach(l=>{i.add(l.id)}),n.filter(l=>i.has(l.source)||i.has(l.target))};function LT(e,n){const i=new Map,l=n!=null&&n.nodes?new Set(n.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((n==null?void 0:n.includeHiddenNodes)||!o.hidden)&&(!l||l.has(o.id))&&i.set(o.id,o)}),i}async function HT({nodes:e,width:n,height:i,panZoom:l,minZoom:o,maxZoom:s},u){if(e.size===0)return Promise.resolve(!0);const f=LT(e,u),d=Vo(f),h=nm(d,n,i,(u==null?void 0:u.minZoom)??o,(u==null?void 0:u.maxZoom)??s,(u==null?void 0:u.padding)??.1);return await l.setViewport(h,{duration:u==null?void 0:u.duration,ease:u==null?void 0:u.ease,interpolate:u==null?void 0:u.interpolate}),Promise.resolve(!0)}function jw({nodeId:e,nextPosition:n,nodeLookup:i,nodeOrigin:l=[0,0],nodeExtent:o,onError:s}){const u=i.get(e),f=u.parentId?i.get(u.parentId):void 0,{x:d,y:h}=f?f.internals.positionAbsolute:{x:0,y:0},m=u.origin??l;let p=u.extent||o;if(u.extent==="parent"&&!u.expandParent)if(!f)s==null||s("005",tr.error005());else{const v=f.measured.width,w=f.measured.height;v&&w&&(p=[[d,h],[d+v,h+w]])}else f&&ra(u.extent)&&(p=[[u.extent[0][0]+d,u.extent[0][1]+h],[u.extent[1][0]+d,u.extent[1][1]+h]]);const y=ra(p)?$i(n,p,u.measured):n;return(u.measured.width===void 0||u.measured.height===void 0)&&(s==null||s("015",tr.error015())),{position:{x:y.x-d+(u.measured.width??0)*m[0],y:y.y-h+(u.measured.height??0)*m[1]},positionAbsolute:y}}async function BT({nodesToRemove:e=[],edgesToRemove:n=[],nodes:i,edges:l,onBeforeDelete:o}){const s=new Set(e.map(y=>y.id)),u=[];for(const y of i){if(y.deletable===!1)continue;const v=s.has(y.id),w=!v&&y.parentId&&u.find(E=>E.id===y.parentId);(v||w)&&u.push(y)}const f=new Set(n.map(y=>y.id)),d=l.filter(y=>y.deletable!==!1),m=DT(u,d);for(const y of d)f.has(y.id)&&!m.find(w=>w.id===y.id)&&m.push(y);if(!o)return{edges:m,nodes:u};const p=await o({nodes:u,edges:m});return typeof p=="boolean"?p?{edges:m,nodes:u}:{edges:[],nodes:[]}:p}const ta=(e,n=0,i=1)=>Math.min(Math.max(e,n),i),$i=(e={x:0,y:0},n,i)=>({x:ta(e.x,n[0][0],n[1][0]-((i==null?void 0:i.width)??0)),y:ta(e.y,n[0][1],n[1][1]-((i==null?void 0:i.height)??0))});function Ow(e,n,i){const{width:l,height:o}=Ar(i),{x:s,y:u}=i.internals.positionAbsolute;return $i(e,[[s,u],[s+l,u+o]],n)}const Kx=(e,n,i)=>ei?-ta(Math.abs(e-i),1,n)/n:0,Rw=(e,n,i=15,l=40)=>{const o=Kx(e.x,l,n.width-l)*i,s=Kx(e.y,l,n.height-l)*i;return[o,s]},mc=(e,n)=>({x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}),kp=({x:e,y:n,width:i,height:l})=>({x:e,y:n,x2:e+i,y2:n+l}),gc=({x:e,y:n,x2:i,y2:l})=>({x:e,y:n,width:i-e,height:l-n}),na=(e,n=[0,0])=>{var o,s;const{x:i,y:l}=em(e)?e.internals.positionAbsolute:Io(e,n);return{x:i,y:l,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},ec=(e,n=[0,0])=>{var o,s;const{x:i,y:l}=em(e)?e.internals.positionAbsolute:Io(e,n);return{x:i,y:l,x2:i+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:l+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},Dw=(e,n)=>gc(mc(kp(e),kp(n))),Oo=(e,n)=>{const i=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),l=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(i*l)},Jx=e=>qn(e.width)&&qn(e.height)&&qn(e.x)&&qn(e.y),qn=e=>!isNaN(e)&&isFinite(e),qT=(e,n)=>{},Yo=(e,n=[1,1])=>({x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}),Go=({x:e,y:n},[i,l,o],s=!1,u=[1,1])=>{const f={x:(e-i)/o,y:(n-l)/o};return s?Yo(f,u):f},tc=({x:e,y:n},[i,l,o])=>({x:e*o+i,y:n*o+l});function Ll(e,n){if(typeof e=="number")return Math.floor((n-n/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const i=parseFloat(e);if(!Number.isNaN(i))return Math.floor(i)}if(typeof e=="string"&&e.endsWith("%")){const i=parseFloat(e);if(!Number.isNaN(i))return Math.floor(n*i*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function UT(e,n,i){if(typeof e=="string"||typeof e=="number"){const l=Ll(e,i),o=Ll(e,n);return{top:l,right:o,bottom:l,left:o,x:o*2,y:l*2}}if(typeof e=="object"){const l=Ll(e.top??e.y??0,i),o=Ll(e.bottom??e.y??0,i),s=Ll(e.left??e.x??0,n),u=Ll(e.right??e.x??0,n);return{top:l,right:u,bottom:o,left:s,x:s+u,y:l+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function IT(e,n,i,l,o,s){const{x:u,y:f}=tc(e,[n,i,l]),{x:d,y:h}=tc({x:e.x+e.width,y:e.y+e.height},[n,i,l]),m=o-d,p=s-h;return{left:Math.floor(u),top:Math.floor(f),right:Math.floor(m),bottom:Math.floor(p)}}const nm=(e,n,i,l,o,s)=>{const u=UT(s,n,i),f=(n-u.x)/e.width,d=(i-u.y)/e.height,h=Math.min(f,d),m=ta(h,l,o),p=e.x+e.width/2,y=e.y+e.height/2,v=n/2-p*m,w=i/2-y*m,E=IT(e,v,w,m,n,i),_={left:Math.min(E.left-u.left,0),top:Math.min(E.top-u.top,0),right:Math.min(E.right-u.right,0),bottom:Math.min(E.bottom-u.bottom,0)};return{x:v-_.left+_.right,y:w-_.top+_.bottom,zoom:m}},Ro=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function ra(e){return e!=null&&e!=="parent"}function Ar(e){var n,i;return{width:((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}}function Lw(e){var n,i;return(((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth)!==void 0&&(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight)!==void 0}function Hw(e,n={width:0,height:0},i,l,o){const s={...e},u=l.get(i);if(u){const f=u.origin||o;s.x+=u.internals.positionAbsolute.x-(n.width??0)*f[0],s.y+=u.internals.positionAbsolute.y-(n.height??0)*f[1]}return s}function Wx(e,n){if(e.size!==n.size)return!1;for(const i of e)if(!n.has(i))return!1;return!0}function VT(){let e,n;return{promise:new Promise((l,o)=>{e=l,n=o}),resolve:e,reject:n}}function YT(e){return{...Tw,...e||{}}}function wo(e,{snapGrid:n=[0,0],snapToGrid:i=!1,transform:l,containerBounds:o}){const{x:s,y:u}=Un(e),f=Go({x:s-((o==null?void 0:o.left)??0),y:u-((o==null?void 0:o.top)??0)},l),{x:d,y:h}=i?Yo(f,n):f;return{xSnapped:d,ySnapped:h,...f}}const rm=e=>({width:e.offsetWidth,height:e.offsetHeight}),Bw=e=>{var n;return((n=e==null?void 0:e.getRootNode)==null?void 0:n.call(e))||(window==null?void 0:window.document)},GT=["INPUT","SELECT","TEXTAREA"];function qw(e){var l,o;const n=((o=(l=e.composedPath)==null?void 0:l.call(e))==null?void 0:o[0])||e.target;return(n==null?void 0:n.nodeType)!==1?!1:GT.includes(n.nodeName)||n.hasAttribute("contenteditable")||!!n.closest(".nokey")}const Uw=e=>"clientX"in e,Un=(e,n)=>{var s,u;const i=Uw(e),l=i?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,o=i?e.clientY:(u=e.touches)==null?void 0:u[0].clientY;return{x:l-((n==null?void 0:n.left)??0),y:o-((n==null?void 0:n.top)??0)}},ev=(e,n,i,l,o)=>{const s=n.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(u=>{const f=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),type:e,nodeId:o,position:u.getAttribute("data-handlepos"),x:(f.left-i.left)/l,y:(f.top-i.top)/l,...rm(u)}})};function Iw({sourceX:e,sourceY:n,targetX:i,targetY:l,sourceControlX:o,sourceControlY:s,targetControlX:u,targetControlY:f}){const d=e*.125+o*.375+u*.375+i*.125,h=n*.125+s*.375+f*.375+l*.125,m=Math.abs(d-e),p=Math.abs(h-n);return[d,h,m,p]}function Tu(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function tv({pos:e,x1:n,y1:i,x2:l,y2:o,c:s}){switch(e){case we.Left:return[n-Tu(n-l,s),i];case we.Right:return[n+Tu(l-n,s),i];case we.Top:return[n,i-Tu(i-o,s)];case we.Bottom:return[n,i+Tu(o-i,s)]}}function im({sourceX:e,sourceY:n,sourcePosition:i=we.Bottom,targetX:l,targetY:o,targetPosition:s=we.Top,curvature:u=.25}){const[f,d]=tv({pos:i,x1:e,y1:n,x2:l,y2:o,c:u}),[h,m]=tv({pos:s,x1:l,y1:o,x2:e,y2:n,c:u}),[p,y,v,w]=Iw({sourceX:e,sourceY:n,targetX:l,targetY:o,sourceControlX:f,sourceControlY:d,targetControlX:h,targetControlY:m});return[`M${e},${n} C${f},${d} ${h},${m} ${l},${o}`,p,y,v,w]}function Vw({sourceX:e,sourceY:n,targetX:i,targetY:l}){const o=Math.abs(i-e)/2,s=i0}const FT=({source:e,sourceHandle:n,target:i,targetHandle:l})=>`xy-edge__${e}${n||""}-${i}${l||""}`,PT=(e,n)=>n.some(i=>i.source===e.source&&i.target===e.target&&(i.sourceHandle===e.sourceHandle||!i.sourceHandle&&!e.sourceHandle)&&(i.targetHandle===e.targetHandle||!i.targetHandle&&!e.targetHandle)),QT=(e,n,i={})=>{if(!e.source||!e.target)return n;const l=i.getEdgeId||FT;let o;return Mw(e)?o={...e}:o={...e,id:l(e)},PT(o,n)?n:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,n.concat(o))};function Yw({sourceX:e,sourceY:n,targetX:i,targetY:l}){const[o,s,u,f]=Vw({sourceX:e,sourceY:n,targetX:i,targetY:l});return[`M ${e},${n}L ${i},${l}`,o,s,u,f]}const nv={[we.Left]:{x:-1,y:0},[we.Right]:{x:1,y:0},[we.Top]:{x:0,y:-1},[we.Bottom]:{x:0,y:1}},ZT=({source:e,sourcePosition:n=we.Bottom,target:i})=>n===we.Left||n===we.Right?e.xMath.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function KT({source:e,sourcePosition:n=we.Bottom,target:i,targetPosition:l=we.Top,center:o,offset:s,stepPosition:u}){const f=nv[n],d=nv[l],h={x:e.x+f.x*s,y:e.y+f.y*s},m={x:i.x+d.x*s,y:i.y+d.y*s},p=ZT({source:h,sourcePosition:n,target:m}),y=p.x!==0?"x":"y",v=p[y];let w=[],E,_;const S={x:0,y:0},z={x:0,y:0},[,,k,A]=Vw({sourceX:e.x,sourceY:e.y,targetX:i.x,targetY:i.y});if(f[y]*d[y]===-1){y==="x"?(E=o.x??h.x+(m.x-h.x)*u,_=o.y??(h.y+m.y)/2):(E=o.x??(h.x+m.x)/2,_=o.y??h.y+(m.y-h.y)*u);const T=[{x:E,y:h.y},{x:E,y:m.y}],q=[{x:h.x,y:_},{x:m.x,y:_}];f[y]===v?w=y==="x"?T:q:w=y==="x"?q:T}else{const T=[{x:h.x,y:m.y}],q=[{x:m.x,y:h.y}];if(y==="x"?w=f.x===v?q:T:w=f.y===v?T:q,n===l){const I=Math.abs(e[y]-i[y]);if(I<=s){const ee=Math.min(s-1,s-I);f[y]===v?S[y]=(h[y]>e[y]?-1:1)*ee:z[y]=(m[y]>i[y]?-1:1)*ee}}if(n!==l){const I=y==="x"?"y":"x",ee=f[y]===d[I],H=h[I]>m[I],G=h[I]=B?(E=(j.x+L.x)/2,_=w[0].y):(E=w[0].x,_=(j.y+L.y)/2)}return[[e,{x:h.x+S.x,y:h.y+S.y},...w,{x:m.x+z.x,y:m.y+z.y},i],E,_,k,A]}function JT(e,n,i,l){const o=Math.min(rv(e,n)/2,rv(n,i)/2,l),{x:s,y:u}=n;if(e.x===s&&s===i.x||e.y===u&&u===i.y)return`L${s} ${u}`;if(e.y===u){const h=e.x{let A="";return k>0&&ki.id===n):e[0])||null}function Tp(e,n){return e?typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(l=>`${l}=${e[l]}`).join("&")}`:""}function ez(e,{id:n,defaultColor:i,defaultMarkerStart:l,defaultMarkerEnd:o}){const s=new Set;return e.reduce((u,f)=>([f.markerStart||l,f.markerEnd||o].forEach(d=>{if(d&&typeof d=="object"){const h=Tp(d,n);s.has(h)||(u.push({id:h,color:d.color||i,...d}),s.add(h))}}),u),[]).sort((u,f)=>u.id.localeCompare(f.id))}const Gw=1e3,tz=10,lm={nodeOrigin:[0,0],nodeExtent:Mo,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},nz={...lm,checkEquality:!0};function am(e,n){const i={...e};for(const l in n)n[l]!==void 0&&(i[l]=n[l]);return i}function rz(e,n,i){const l=am(lm,i);for(const o of e.values())if(o.parentId)sm(o,e,n,l);else{const s=Io(o,l.nodeOrigin),u=ra(o.extent)?o.extent:l.nodeExtent,f=$i(s,u,Ar(o));o.internals.positionAbsolute=f}}function iz(e,n){if(!e.handles)return e.measured?n==null?void 0:n.internals.handleBounds:void 0;const i=[],l=[];for(const o of e.handles){const s={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?i.push(s):o.type==="target"&&l.push(s)}return{source:i,target:l}}function om(e){return e==="manual"}function zp(e,n,i,l={}){var h,m;const o=am(nz,l),s={i:0},u=new Map(n),f=o!=null&&o.elevateNodesOnSelect&&!om(o.zIndexMode)?Gw:0;let d=e.length>0;n.clear(),i.clear();for(const p of e){let y=u.get(p.id);if(o.checkEquality&&p===(y==null?void 0:y.internals.userNode))n.set(p.id,y);else{const v=Io(p,o.nodeOrigin),w=ra(p.extent)?p.extent:o.nodeExtent,E=$i(v,w,Ar(p));y={...o.defaults,...p,measured:{width:(h=p.measured)==null?void 0:h.width,height:(m=p.measured)==null?void 0:m.height},internals:{positionAbsolute:E,handleBounds:iz(p,y),z:$w(p,f,o.zIndexMode),userNode:p}},n.set(p.id,y)}(y.measured===void 0||y.measured.width===void 0||y.measured.height===void 0)&&!y.hidden&&(d=!1),p.parentId&&sm(y,n,i,l,s)}return d}function lz(e,n){if(!e.parentId)return;const i=n.get(e.parentId);i?i.set(e.id,e):n.set(e.parentId,new Map([[e.id,e]]))}function sm(e,n,i,l,o){const{elevateNodesOnSelect:s,nodeOrigin:u,nodeExtent:f,zIndexMode:d}=am(lm,l),h=e.parentId,m=n.get(h);if(!m){console.warn(`Parent node ${h} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}lz(e,i),o&&!m.parentId&&m.internals.rootParentIndex===void 0&&d==="auto"&&(m.internals.rootParentIndex=++o.i,m.internals.z=m.internals.z+o.i*tz),o&&m.internals.rootParentIndex!==void 0&&(o.i=m.internals.rootParentIndex);const p=s&&!om(d)?Gw:0,{x:y,y:v,z:w}=az(e,m,u,f,p,d),{positionAbsolute:E}=e.internals,_=y!==E.x||v!==E.y;(_||w!==e.internals.z)&&n.set(e.id,{...e,internals:{...e.internals,positionAbsolute:_?{x:y,y:v}:E,z:w}})}function $w(e,n,i){const l=qn(e.zIndex)?e.zIndex:0;return om(i)?l:l+(e.selected?n:0)}function az(e,n,i,l,o,s){const{x:u,y:f}=n.internals.positionAbsolute,d=Ar(e),h=Io(e,i),m=ra(e.extent)?$i(h,e.extent,d):h;let p=$i({x:u+m.x,y:f+m.y},l,d);e.extent==="parent"&&(p=Ow(p,d,n));const y=$w(e,o,s),v=n.internals.z??0;return{x:p.x,y:p.y,z:v>=y?v+1:y}}function um(e,n,i,l=[0,0]){var u;const o=[],s=new Map;for(const f of e){const d=n.get(f.parentId);if(!d)continue;const h=((u=s.get(f.parentId))==null?void 0:u.expandedRect)??na(d),m=Dw(h,f.rect);s.set(f.parentId,{expandedRect:m,parent:d})}return s.size>0&&s.forEach(({expandedRect:f,parent:d},h)=>{var k;const m=d.internals.positionAbsolute,p=Ar(d),y=d.origin??l,v=f.x0||w>0||S||z)&&(o.push({id:h,type:"position",position:{x:d.position.x-v+S,y:d.position.y-w+z}}),(k=i.get(h))==null||k.forEach(A=>{e.some(M=>M.id===A.id)||o.push({id:A.id,type:"position",position:{x:A.position.x+v,y:A.position.y+w}})})),(p.width0){const v=um(y,n,i,o);h.push(...v)}return{changes:h,updatedInternals:d}}async function sz({delta:e,panZoom:n,transform:i,translateExtent:l,width:o,height:s}){if(!n||!e.x&&!e.y)return Promise.resolve(!1);const u=await n.setViewportConstrained({x:i[0]+e.x,y:i[1]+e.y,zoom:i[2]},[[0,0],[o,s]],l),f=!!u&&(u.x!==i[0]||u.y!==i[1]||u.k!==i[2]);return Promise.resolve(f)}function ov(e,n,i,l,o,s){let u=o;const f=l.get(u)||new Map;l.set(u,f.set(i,n)),u=`${o}-${e}`;const d=l.get(u)||new Map;if(l.set(u,d.set(i,n)),s){u=`${o}-${e}-${s}`;const h=l.get(u)||new Map;l.set(u,h.set(i,n))}}function Xw(e,n,i){e.clear(),n.clear();for(const l of i){const{source:o,target:s,sourceHandle:u=null,targetHandle:f=null}=l,d={edgeId:l.id,source:o,target:s,sourceHandle:u,targetHandle:f},h=`${o}-${u}--${s}-${f}`,m=`${s}-${f}--${o}-${u}`;ov("source",d,m,e,o,u),ov("target",d,h,e,s,f),n.set(l.id,l)}}function Fw(e,n){if(!e.parentId)return!1;const i=n.get(e.parentId);return i?i.selected?!0:Fw(i,n):!1}function sv(e,n,i){var o;let l=e;do{if((o=l==null?void 0:l.matches)!=null&&o.call(l,n))return!0;if(l===i)return!1;l=l==null?void 0:l.parentElement}while(l);return!1}function uz(e,n,i,l){const o=new Map;for(const[s,u]of e)if((u.selected||u.id===l)&&(!u.parentId||!Fw(u,e))&&(u.draggable||n&&typeof u.draggable>"u")){const f=e.get(s);f&&o.set(s,{id:s,position:f.position||{x:0,y:0},distance:{x:i.x-f.internals.positionAbsolute.x,y:i.y-f.internals.positionAbsolute.y},extent:f.extent,parentId:f.parentId,origin:f.origin,expandParent:f.expandParent,internals:{positionAbsolute:f.internals.positionAbsolute||{x:0,y:0}},measured:{width:f.measured.width??0,height:f.measured.height??0}})}return o}function Jd({nodeId:e,dragItems:n,nodeLookup:i,dragging:l=!0}){var u,f,d;const o=[];for(const[h,m]of n){const p=(u=i.get(h))==null?void 0:u.internals.userNode;p&&o.push({...p,position:m.position,dragging:l})}if(!e)return[o[0],o];const s=(f=i.get(e))==null?void 0:f.internals.userNode;return[s?{...s,position:((d=n.get(e))==null?void 0:d.position)||s.position,dragging:l}:o[0],o]}function cz({dragItems:e,snapGrid:n,x:i,y:l}){const o=e.values().next().value;if(!o)return null;const s={x:i-o.distance.x,y:l-o.distance.y},u=Yo(s,n);return{x:u.x-s.x,y:u.y-s.y}}function fz({onNodeMouseDown:e,getStoreItems:n,onDragStart:i,onDrag:l,onDragStop:o}){let s={x:null,y:null},u=0,f=new Map,d=!1,h={x:0,y:0},m=null,p=!1,y=null,v=!1,w=!1,E=null;function _({noDragClassName:z,handleSelector:k,domNode:A,isSelectable:M,nodeId:T,nodeClickDistance:q=0}){y=xn(A);function j({x:I,y:ee}){const{nodeLookup:H,nodeExtent:G,snapGrid:D,snapToGrid:$,nodeOrigin:Z,onNodeDrag:J,onSelectionDrag:O,onError:U,updateNodePositions:F}=n();s={x:I,y:ee};let N=!1;const Y=f.size>1,P=Y&&G?kp(Vo(f)):null,K=Y&&$?cz({dragItems:f,snapGrid:D,x:I,y:ee}):null;for(const[ne,re]of f){if(!H.has(ne))continue;let se={x:I-re.distance.x,y:ee-re.distance.y};$&&(se=K?{x:Math.round(se.x+K.x),y:Math.round(se.y+K.y)}:Yo(se,D));let ye=null;if(Y&&G&&!re.extent&&P){const{positionAbsolute:pe}=re.internals,_e=pe.x-P.x+G[0][0],Me=pe.x+re.measured.width-P.x2+G[1][0],Ce=pe.y-P.y+G[0][1],st=pe.y+re.measured.height-P.y2+G[1][1];ye=[[_e,Ce],[Me,st]]}const{position:ve,positionAbsolute:xe}=jw({nodeId:ne,nextPosition:se,nodeLookup:H,nodeExtent:ye||G,nodeOrigin:Z,onError:U});N=N||re.position.x!==ve.x||re.position.y!==ve.y,re.position=ve,re.internals.positionAbsolute=xe}if(w=w||N,!!N&&(F(f,!0),E&&(l||J||!T&&O))){const[ne,re]=Jd({nodeId:T,dragItems:f,nodeLookup:H});l==null||l(E,f,ne,re),J==null||J(E,ne,re),T||O==null||O(E,re)}}async function L(){if(!m)return;const{transform:I,panBy:ee,autoPanSpeed:H,autoPanOnNodeDrag:G}=n();if(!G){d=!1,cancelAnimationFrame(u);return}const[D,$]=Rw(h,m,H);(D!==0||$!==0)&&(s.x=(s.x??0)-D/I[2],s.y=(s.y??0)-$/I[2],await ee({x:D,y:$})&&j(s)),u=requestAnimationFrame(L)}function X(I){var Y;const{nodeLookup:ee,multiSelectionActive:H,nodesDraggable:G,transform:D,snapGrid:$,snapToGrid:Z,selectNodesOnDrag:J,onNodeDragStart:O,onSelectionDragStart:U,unselectNodesAndEdges:F}=n();p=!0,(!J||!M)&&!H&&T&&((Y=ee.get(T))!=null&&Y.selected||F()),M&&J&&T&&(e==null||e(T));const N=wo(I.sourceEvent,{transform:D,snapGrid:$,snapToGrid:Z,containerBounds:m});if(s=N,f=uz(ee,G,N,T),f.size>0&&(i||O||!T&&U)){const[P,K]=Jd({nodeId:T,dragItems:f,nodeLookup:ee});i==null||i(I.sourceEvent,f,P,K),O==null||O(I.sourceEvent,P,K),T||U==null||U(I.sourceEvent,K)}}const B=fw().clickDistance(q).on("start",I=>{const{domNode:ee,nodeDragThreshold:H,transform:G,snapGrid:D,snapToGrid:$}=n();m=(ee==null?void 0:ee.getBoundingClientRect())||null,v=!1,w=!1,E=I.sourceEvent,H===0&&X(I),s=wo(I.sourceEvent,{transform:G,snapGrid:D,snapToGrid:$,containerBounds:m}),h=Un(I.sourceEvent,m)}).on("drag",I=>{const{autoPanOnNodeDrag:ee,transform:H,snapGrid:G,snapToGrid:D,nodeDragThreshold:$,nodeLookup:Z}=n(),J=wo(I.sourceEvent,{transform:H,snapGrid:G,snapToGrid:D,containerBounds:m});if(E=I.sourceEvent,(I.sourceEvent.type==="touchmove"&&I.sourceEvent.touches.length>1||T&&!Z.has(T))&&(v=!0),!v){if(!d&&ee&&p&&(d=!0,L()),!p){const O=Un(I.sourceEvent,m),U=O.x-h.x,F=O.y-h.y;Math.sqrt(U*U+F*F)>$&&X(I)}(s.x!==J.xSnapped||s.y!==J.ySnapped)&&f&&p&&(h=Un(I.sourceEvent,m),j(J))}}).on("end",I=>{if(!(!p||v)&&(d=!1,p=!1,cancelAnimationFrame(u),f.size>0)){const{nodeLookup:ee,updateNodePositions:H,onNodeDragStop:G,onSelectionDragStop:D}=n();if(w&&(H(f,!1),w=!1),o||G||!T&&D){const[$,Z]=Jd({nodeId:T,dragItems:f,nodeLookup:ee,dragging:!1});o==null||o(I.sourceEvent,f,$,Z),G==null||G(I.sourceEvent,$,Z),T||D==null||D(I.sourceEvent,Z)}}}).filter(I=>{const ee=I.target;return!I.button&&(!z||!sv(ee,`.${z}`,A))&&(!k||sv(ee,k,A))});y.call(B)}function S(){y==null||y.on(".drag",null)}return{update:_,destroy:S}}function dz(e,n,i){const l=[],o={x:e.x-i,y:e.y-i,width:i*2,height:i*2};for(const s of n.values())Oo(o,na(s))>0&&l.push(s);return l}const hz=250;function pz(e,n,i,l){var f,d;let o=[],s=1/0;const u=dz(e,i,n+hz);for(const h of u){const m=[...((f=h.internals.handleBounds)==null?void 0:f.source)??[],...((d=h.internals.handleBounds)==null?void 0:d.target)??[]];for(const p of m){if(l.nodeId===p.nodeId&&l.type===p.type&&l.id===p.id)continue;const{x:y,y:v}=Xi(h,p,p.position,!0),w=Math.sqrt(Math.pow(y-e.x,2)+Math.pow(v-e.y,2));w>n||(w1){const h=l.type==="source"?"target":"source";return o.find(m=>m.type===h)??o[0]}return o[0]}function Pw(e,n,i,l,o,s=!1){var h,m,p;const u=l.get(e);if(!u)return null;const f=o==="strict"?(h=u.internals.handleBounds)==null?void 0:h[n]:[...((m=u.internals.handleBounds)==null?void 0:m.source)??[],...((p=u.internals.handleBounds)==null?void 0:p.target)??[]],d=(i?f==null?void 0:f.find(y=>y.id===i):f==null?void 0:f[0])??null;return d&&s?{...d,...Xi(u,d,d.position,!0)}:d}function Qw(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function mz(e,n){let i=null;return n?i=!0:e&&!n&&(i=!1),i}const Zw=()=>!0;function gz(e,{connectionMode:n,connectionRadius:i,handleId:l,nodeId:o,edgeUpdaterType:s,isTarget:u,domNode:f,nodeLookup:d,lib:h,autoPanOnConnect:m,flowId:p,panBy:y,cancelConnection:v,onConnectStart:w,onConnect:E,onConnectEnd:_,isValidConnection:S=Zw,onReconnectEnd:z,updateConnection:k,getTransform:A,getFromHandle:M,autoPanSpeed:T,dragThreshold:q=1,handleDomNode:j}){const L=Bw(e.target);let X=0,B;const{x:I,y:ee}=Un(e),H=Qw(s,j),G=f==null?void 0:f.getBoundingClientRect();let D=!1;if(!G||!H)return;const $=Pw(o,H,l,d,n);if(!$)return;let Z=Un(e,G),J=!1,O=null,U=!1,F=null;function N(){if(!m||!G)return;const[ve,xe]=Rw(Z,G,T);y({x:ve,y:xe}),X=requestAnimationFrame(N)}const Y={...$,nodeId:o,type:H,position:$.position},P=d.get(o);let ne={inProgress:!0,isValid:null,from:Xi(P,Y,we.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:P,to:Z,toHandle:null,toPosition:Zx[Y.position],toNode:null,pointer:Z};function re(){D=!0,k(ne),w==null||w(e,{nodeId:o,handleId:l,handleType:H})}q===0&&re();function se(ve){if(!D){const{x:st,y:We}=Un(ve),zt=st-I,Ut=We-ee;if(!(zt*zt+Ut*Ut>q*q))return;re()}if(!M()||!Y){ye(ve);return}const xe=A();Z=Un(ve,G),B=pz(Go(Z,xe,!1,[1,1]),i,d,Y),J||(N(),J=!0);const pe=Kw(ve,{handle:B,connectionMode:n,fromNodeId:o,fromHandleId:l,fromType:u?"target":"source",isValidConnection:S,doc:L,lib:h,flowId:p,nodeLookup:d});F=pe.handleDomNode,O=pe.connection,U=mz(!!B,pe.isValid);const _e=d.get(o),Me=_e?Xi(_e,Y,we.Left,!0):ne.from,Ce={...ne,from:Me,isValid:U,to:pe.toHandle&&U?tc({x:pe.toHandle.x,y:pe.toHandle.y},xe):Z,toHandle:pe.toHandle,toPosition:U&&pe.toHandle?pe.toHandle.position:Zx[Y.position],toNode:pe.toHandle?d.get(pe.toHandle.nodeId):null,pointer:Z};k(Ce),ne=Ce}function ye(ve){if(!("touches"in ve&&ve.touches.length>0)){if(D){(B||F)&&O&&U&&(E==null||E(O));const{inProgress:xe,...pe}=ne,_e={...pe,toPosition:ne.toHandle?ne.toPosition:null};_==null||_(ve,_e),s&&(z==null||z(ve,_e))}v(),cancelAnimationFrame(X),J=!1,U=!1,O=null,F=null,L.removeEventListener("mousemove",se),L.removeEventListener("mouseup",ye),L.removeEventListener("touchmove",se),L.removeEventListener("touchend",ye)}}L.addEventListener("mousemove",se),L.addEventListener("mouseup",ye),L.addEventListener("touchmove",se),L.addEventListener("touchend",ye)}function Kw(e,{handle:n,connectionMode:i,fromNodeId:l,fromHandleId:o,fromType:s,doc:u,lib:f,flowId:d,isValidConnection:h=Zw,nodeLookup:m}){const p=s==="target",y=n?u.querySelector(`.${f}-flow__handle[data-id="${d}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:v,y:w}=Un(e),E=u.elementFromPoint(v,w),_=E!=null&&E.classList.contains(`${f}-flow__handle`)?E:y,S={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const z=Qw(void 0,_),k=_.getAttribute("data-nodeid"),A=_.getAttribute("data-handleid"),M=_.classList.contains("connectable"),T=_.classList.contains("connectableend");if(!k||!z)return S;const q={source:p?k:l,sourceHandle:p?A:o,target:p?l:k,targetHandle:p?o:A};S.connection=q;const L=M&&T&&(i===ea.Strict?p&&z==="source"||!p&&z==="target":k!==l||A!==o);S.isValid=L&&h(q),S.toHandle=Pw(k,z,A,m,i,!0)}return S}const Ap={onPointerDown:gz,isValid:Kw};function yz({domNode:e,panZoom:n,getTransform:i,getViewScale:l}){const o=xn(e);function s({translateExtent:f,width:d,height:h,zoomStep:m=1,pannable:p=!0,zoomable:y=!0,inversePan:v=!1}){const w=k=>{if(k.sourceEvent.type!=="wheel"||!n)return;const A=i(),M=k.sourceEvent.ctrlKey&&Ro()?10:1,T=-k.sourceEvent.deltaY*(k.sourceEvent.deltaMode===1?.05:k.sourceEvent.deltaMode?1:.002)*m,q=A[2]*Math.pow(2,T*M);n.scaleTo(q)};let E=[0,0];const _=k=>{(k.sourceEvent.type==="mousedown"||k.sourceEvent.type==="touchstart")&&(E=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY])},S=k=>{const A=i();if(k.sourceEvent.type!=="mousemove"&&k.sourceEvent.type!=="touchmove"||!n)return;const M=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY],T=[M[0]-E[0],M[1]-E[1]];E=M;const q=l()*Math.max(A[2],Math.log(A[2]))*(v?-1:1),j={x:A[0]-T[0]*q,y:A[1]-T[1]*q},L=[[0,0],[d,h]];n.setViewportConstrained({x:j.x,y:j.y,zoom:A[2]},L,f)},z=kw().on("start",_).on("zoom",p?S:null).on("zoom.wheel",y?w:null);o.call(z,{})}function u(){o.on("zoom",null)}return{update:s,destroy:u,pointer:Hn}}const yc=e=>({x:e.x,y:e.y,zoom:e.k}),Wd=({x:e,y:n,zoom:i})=>pc.translate(e,n).scale(i),Vl=(e,n)=>e.target.closest(`.${n}`),Jw=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),xz=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,eh=(e,n=0,i=xz,l=()=>{})=>{const o=typeof n=="number"&&n>0;return o||l(),o?e.transition().duration(n).ease(i).on("end",l):e},Ww=e=>{const n=e.ctrlKey&&Ro()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n};function vz({zoomPanValues:e,noWheelClassName:n,d3Selection:i,d3Zoom:l,panOnScrollMode:o,panOnScrollSpeed:s,zoomOnPinch:u,onPanZoomStart:f,onPanZoom:d,onPanZoomEnd:h}){return m=>{if(Vl(m,n))return m.ctrlKey&&m.preventDefault(),!1;m.preventDefault(),m.stopImmediatePropagation();const p=i.property("__zoom").k||1;if(m.ctrlKey&&u){const _=Hn(m),S=Ww(m),z=p*Math.pow(2,S);l.scaleTo(i,z,_,m);return}const y=m.deltaMode===1?20:1;let v=o===Ii.Vertical?0:m.deltaX*y,w=o===Ii.Horizontal?0:m.deltaY*y;!Ro()&&m.shiftKey&&o!==Ii.Vertical&&(v=m.deltaY*y,w=0),l.translateBy(i,-(v/p)*s,-(w/p)*s,{internal:!0});const E=yc(i.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(d==null||d(m,E),e.panScrollTimeout=setTimeout(()=>{h==null||h(m,E),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,f==null||f(m,E))}}function bz({noWheelClassName:e,preventScrolling:n,d3ZoomHandler:i}){return function(l,o){const s=l.type==="wheel",u=!n&&s&&!l.ctrlKey,f=Vl(l,e);if(l.ctrlKey&&s&&f&&l.preventDefault(),u||f)return null;l.preventDefault(),i.call(this,l,o)}}function wz({zoomPanValues:e,onDraggingChange:n,onPanZoomStart:i}){return l=>{var s,u,f;if((s=l.sourceEvent)!=null&&s.internal)return;const o=yc(l.transform);e.mouseButton=((u=l.sourceEvent)==null?void 0:u.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((f=l.sourceEvent)==null?void 0:f.type)==="mousedown"&&n(!0),i&&(i==null||i(l.sourceEvent,o))}}function Sz({zoomPanValues:e,panOnDrag:n,onPaneContextMenu:i,onTransformChange:l,onPanZoom:o}){return s=>{var u,f;e.usedRightMouseButton=!!(i&&Jw(n,e.mouseButton??0)),(u=s.sourceEvent)!=null&&u.sync||l([s.transform.x,s.transform.y,s.transform.k]),o&&!((f=s.sourceEvent)!=null&&f.internal)&&(o==null||o(s.sourceEvent,yc(s.transform)))}}function _z({zoomPanValues:e,panOnDrag:n,panOnScroll:i,onDraggingChange:l,onPanZoomEnd:o,onPaneContextMenu:s}){return u=>{var f;if(!((f=u.sourceEvent)!=null&&f.internal)&&(e.isZoomingOrPanning=!1,s&&Jw(n,e.mouseButton??0)&&!e.usedRightMouseButton&&u.sourceEvent&&s(u.sourceEvent),e.usedRightMouseButton=!1,l(!1),o)){const d=yc(u.transform);e.prevViewport=d,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(u.sourceEvent,d)},i?150:0)}}}function Ez({zoomActivationKeyPressed:e,zoomOnScroll:n,zoomOnPinch:i,panOnDrag:l,panOnScroll:o,zoomOnDoubleClick:s,userSelectionActive:u,noWheelClassName:f,noPanClassName:d,lib:h,connectionInProgress:m}){return p=>{var _;const y=e||n,v=i&&p.ctrlKey,w=p.type==="wheel";if(p.button===1&&p.type==="mousedown"&&(Vl(p,`${h}-flow__node`)||Vl(p,`${h}-flow__edge`)))return!0;if(!l&&!y&&!o&&!s&&!i||u||m&&!w||Vl(p,f)&&w||Vl(p,d)&&(!w||o&&w&&!e)||!i&&p.ctrlKey&&w)return!1;if(!i&&p.type==="touchstart"&&((_=p.touches)==null?void 0:_.length)>1)return p.preventDefault(),!1;if(!y&&!o&&!v&&w||!l&&(p.type==="mousedown"||p.type==="touchstart")||Array.isArray(l)&&!l.includes(p.button)&&p.type==="mousedown")return!1;const E=Array.isArray(l)&&l.includes(p.button)||!p.button||p.button<=1;return(!p.ctrlKey||w)&&E}}function Nz({domNode:e,minZoom:n,maxZoom:i,translateExtent:l,viewport:o,onPanZoom:s,onPanZoomStart:u,onPanZoomEnd:f,onDraggingChange:d}){const h={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},m=e.getBoundingClientRect(),p=kw().scaleExtent([n,i]).translateExtent(l),y=xn(e).call(p);z({x:o.x,y:o.y,zoom:ta(o.zoom,n,i)},[[0,0],[m.width,m.height]],l);const v=y.on("wheel.zoom"),w=y.on("dblclick.zoom");p.wheelDelta(Ww);function E(B,I){return y?new Promise(ee=>{p==null||p.interpolate((I==null?void 0:I.interpolate)==="linear"?bo:Bu).transform(eh(y,I==null?void 0:I.duration,I==null?void 0:I.ease,()=>ee(!0)),B)}):Promise.resolve(!1)}function _({noWheelClassName:B,noPanClassName:I,onPaneContextMenu:ee,userSelectionActive:H,panOnScroll:G,panOnDrag:D,panOnScrollMode:$,panOnScrollSpeed:Z,preventScrolling:J,zoomOnPinch:O,zoomOnScroll:U,zoomOnDoubleClick:F,zoomActivationKeyPressed:N,lib:Y,onTransformChange:P,connectionInProgress:K,paneClickDistance:ne,selectionOnDrag:re}){H&&!h.isZoomingOrPanning&&S();const se=G&&!N&&!H;p.clickDistance(re?1/0:!qn(ne)||ne<0?0:ne);const ye=se?vz({zoomPanValues:h,noWheelClassName:B,d3Selection:y,d3Zoom:p,panOnScrollMode:$,panOnScrollSpeed:Z,zoomOnPinch:O,onPanZoomStart:u,onPanZoom:s,onPanZoomEnd:f}):bz({noWheelClassName:B,preventScrolling:J,d3ZoomHandler:v});if(y.on("wheel.zoom",ye,{passive:!1}),!H){const xe=wz({zoomPanValues:h,onDraggingChange:d,onPanZoomStart:u});p.on("start",xe);const pe=Sz({zoomPanValues:h,panOnDrag:D,onPaneContextMenu:!!ee,onPanZoom:s,onTransformChange:P});p.on("zoom",pe);const _e=_z({zoomPanValues:h,panOnDrag:D,panOnScroll:G,onPaneContextMenu:ee,onPanZoomEnd:f,onDraggingChange:d});p.on("end",_e)}const ve=Ez({zoomActivationKeyPressed:N,panOnDrag:D,zoomOnScroll:U,panOnScroll:G,zoomOnDoubleClick:F,zoomOnPinch:O,userSelectionActive:H,noPanClassName:I,noWheelClassName:B,lib:Y,connectionInProgress:K});p.filter(ve),F?y.on("dblclick.zoom",w):y.on("dblclick.zoom",null)}function S(){p.on("zoom",null)}async function z(B,I,ee){const H=Wd(B),G=p==null?void 0:p.constrain()(H,I,ee);return G&&await E(G),new Promise(D=>D(G))}async function k(B,I){const ee=Wd(B);return await E(ee,I),new Promise(H=>H(ee))}function A(B){if(y){const I=Wd(B),ee=y.property("__zoom");(ee.k!==B.zoom||ee.x!==B.x||ee.y!==B.y)&&(p==null||p.transform(y,I,null,{sync:!0}))}}function M(){const B=y?Nw(y.node()):{x:0,y:0,k:1};return{x:B.x,y:B.y,zoom:B.k}}function T(B,I){return y?new Promise(ee=>{p==null||p.interpolate((I==null?void 0:I.interpolate)==="linear"?bo:Bu).scaleTo(eh(y,I==null?void 0:I.duration,I==null?void 0:I.ease,()=>ee(!0)),B)}):Promise.resolve(!1)}function q(B,I){return y?new Promise(ee=>{p==null||p.interpolate((I==null?void 0:I.interpolate)==="linear"?bo:Bu).scaleBy(eh(y,I==null?void 0:I.duration,I==null?void 0:I.ease,()=>ee(!0)),B)}):Promise.resolve(!1)}function j(B){p==null||p.scaleExtent(B)}function L(B){p==null||p.translateExtent(B)}function X(B){const I=!qn(B)||B<0?0:B;p==null||p.clickDistance(I)}return{update:_,destroy:S,setViewport:k,setViewportConstrained:z,getViewport:M,scaleTo:T,scaleBy:q,setScaleExtent:j,setTranslateExtent:L,syncViewport:A,setClickDistance:X}}var ia;(function(e){e.Line="line",e.Handle="handle"})(ia||(ia={}));function kz({width:e,prevWidth:n,height:i,prevHeight:l,affectsX:o,affectsY:s}){const u=e-n,f=i-l,d=[u>0?1:u<0?-1:0,f>0?1:f<0?-1:0];return u&&o&&(d[0]=d[0]*-1),f&&s&&(d[1]=d[1]*-1),d}function uv(e){const n=e.includes("right")||e.includes("left"),i=e.includes("bottom")||e.includes("top"),l=e.includes("left"),o=e.includes("top");return{isHorizontal:n,isVertical:i,affectsX:l,affectsY:o}}function oi(e,n){return Math.max(0,n-e)}function si(e,n){return Math.max(0,e-n)}function zu(e,n,i){return Math.max(0,n-e,e-i)}function cv(e,n){return e?!n:n}function Cz(e,n,i,l,o,s,u,f){let{affectsX:d,affectsY:h}=n;const{isHorizontal:m,isVertical:p}=n,y=m&&p,{xSnapped:v,ySnapped:w}=i,{minWidth:E,maxWidth:_,minHeight:S,maxHeight:z}=l,{x:k,y:A,width:M,height:T,aspectRatio:q}=e;let j=Math.floor(m?v-e.pointerX:0),L=Math.floor(p?w-e.pointerY:0);const X=M+(d?-j:j),B=T+(h?-L:L),I=-s[0]*M,ee=-s[1]*T;let H=zu(X,E,_),G=zu(B,S,z);if(u){let Z=0,J=0;d&&j<0?Z=oi(k+j+I,u[0][0]):!d&&j>0&&(Z=si(k+X+I,u[1][0])),h&&L<0?J=oi(A+L+ee,u[0][1]):!h&&L>0&&(J=si(A+B+ee,u[1][1])),H=Math.max(H,Z),G=Math.max(G,J)}if(f){let Z=0,J=0;d&&j>0?Z=si(k+j,f[0][0]):!d&&j<0&&(Z=oi(k+X,f[1][0])),h&&L>0?J=si(A+L,f[0][1]):!h&&L<0&&(J=oi(A+B,f[1][1])),H=Math.max(H,Z),G=Math.max(G,J)}if(o){if(m){const Z=zu(X/q,S,z)*q;if(H=Math.max(H,Z),u){let J=0;!d&&!h||d&&!h&&y?J=si(A+ee+X/q,u[1][1])*q:J=oi(A+ee+(d?j:-j)/q,u[0][1])*q,H=Math.max(H,J)}if(f){let J=0;!d&&!h||d&&!h&&y?J=oi(A+X/q,f[1][1])*q:J=si(A+(d?j:-j)/q,f[0][1])*q,H=Math.max(H,J)}}if(p){const Z=zu(B*q,E,_)/q;if(G=Math.max(G,Z),u){let J=0;!d&&!h||h&&!d&&y?J=si(k+B*q+I,u[1][0])/q:J=oi(k+(h?L:-L)*q+I,u[0][0])/q,G=Math.max(G,J)}if(f){let J=0;!d&&!h||h&&!d&&y?J=oi(k+B*q,f[1][0])/q:J=si(k+(h?L:-L)*q,f[0][0])/q,G=Math.max(G,J)}}}L=L+(L<0?G:-G),j=j+(j<0?H:-H),o&&(y?X>B*q?L=(cv(d,h)?-j:j)/q:j=(cv(d,h)?-L:L)*q:m?(L=j/q,h=d):(j=L*q,d=h));const D=d?k+j:k,$=h?A+L:A;return{width:M+(d?-j:j),height:T+(h?-L:L),x:s[0]*j*(d?-1:1)+D,y:s[1]*L*(h?-1:1)+$}}const eS={width:0,height:0,x:0,y:0},Tz={...eS,pointerX:0,pointerY:0,aspectRatio:1};function zz(e){return[[0,0],[e.measured.width,e.measured.height]]}function Az(e,n,i){const l=n.position.x+e.position.x,o=n.position.y+e.position.y,s=e.measured.width??0,u=e.measured.height??0,f=i[0]*s,d=i[1]*u;return[[l-f,o-d],[l+s-f,o+u-d]]}function Mz({domNode:e,nodeId:n,getStoreItems:i,onChange:l,onEnd:o}){const s=xn(e);let u={controlDirection:uv("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function f({controlPosition:h,boundaries:m,keepAspectRatio:p,resizeDirection:y,onResizeStart:v,onResize:w,onResizeEnd:E,shouldResize:_}){let S={...eS},z={...Tz};u={boundaries:m,resizeDirection:y,keepAspectRatio:p,controlDirection:uv(h)};let k,A=null,M=[],T,q,j,L=!1;const X=fw().on("start",B=>{const{nodeLookup:I,transform:ee,snapGrid:H,snapToGrid:G,nodeOrigin:D,paneDomNode:$}=i();if(k=I.get(n),!k)return;A=($==null?void 0:$.getBoundingClientRect())??null;const{xSnapped:Z,ySnapped:J}=wo(B.sourceEvent,{transform:ee,snapGrid:H,snapToGrid:G,containerBounds:A});S={width:k.measured.width??0,height:k.measured.height??0,x:k.position.x??0,y:k.position.y??0},z={...S,pointerX:Z,pointerY:J,aspectRatio:S.width/S.height},T=void 0,k.parentId&&(k.extent==="parent"||k.expandParent)&&(T=I.get(k.parentId),q=T&&k.extent==="parent"?zz(T):void 0),M=[],j=void 0;for(const[O,U]of I)if(U.parentId===n&&(M.push({id:O,position:{...U.position},extent:U.extent}),U.extent==="parent"||U.expandParent)){const F=Az(U,k,U.origin??D);j?j=[[Math.min(F[0][0],j[0][0]),Math.min(F[0][1],j[0][1])],[Math.max(F[1][0],j[1][0]),Math.max(F[1][1],j[1][1])]]:j=F}v==null||v(B,{...S})}).on("drag",B=>{const{transform:I,snapGrid:ee,snapToGrid:H,nodeOrigin:G}=i(),D=wo(B.sourceEvent,{transform:I,snapGrid:ee,snapToGrid:H,containerBounds:A}),$=[];if(!k)return;const{x:Z,y:J,width:O,height:U}=S,F={},N=k.origin??G,{width:Y,height:P,x:K,y:ne}=Cz(z,u.controlDirection,D,u.boundaries,u.keepAspectRatio,N,q,j),re=Y!==O,se=P!==U,ye=K!==Z&&re,ve=ne!==J&&se;if(!ye&&!ve&&!re&&!se)return;if((ye||ve||N[0]===1||N[1]===1)&&(F.x=ye?K:S.x,F.y=ve?ne:S.y,S.x=F.x,S.y=F.y,M.length>0)){const Me=K-Z,Ce=ne-J;for(const st of M)st.position={x:st.position.x-Me+N[0]*(Y-O),y:st.position.y-Ce+N[1]*(P-U)},$.push(st)}if((re||se)&&(F.width=re&&(!u.resizeDirection||u.resizeDirection==="horizontal")?Y:S.width,F.height=se&&(!u.resizeDirection||u.resizeDirection==="vertical")?P:S.height,S.width=F.width,S.height=F.height),T&&k.expandParent){const Me=N[0]*(F.width??0);F.x&&F.x{L&&(E==null||E(B,{...S}),o==null||o({...S}),L=!1)});s.call(X)}function d(){s.on(".drag",null)}return{update:f,destroy:d}}var th={exports:{}},nh={},rh={exports:{}},ih={};/** * @license React * use-sync-external-store-shim.production.js * @@ -273,7 +278,7 @@ Error generating stack: `+c.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var fv;function Az(){if(fv)return ih;fv=1;var e=Ho();function n(p,y){return p===y&&(p!==0||1/p===1/y)||p!==p&&y!==y}var i=typeof Object.is=="function"?Object.is:n,l=e.useState,o=e.useEffect,s=e.useLayoutEffect,u=e.useDebugValue;function f(p,y){var v=y(),w=l({inst:{value:v,getSnapshot:y}}),k=w[0].inst,S=w[1];return s(function(){k.value=v,k.getSnapshot=y,d(k)&&S({inst:k})},[p,v,y]),o(function(){return d(k)&&S({inst:k}),p(function(){d(k)&&S({inst:k})})},[p]),u(v),v}function d(p){var y=p.getSnapshot;p=p.value;try{var v=y();return!i(p,v)}catch{return!0}}function h(p,y){return y()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:f;return ih.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,ih}var dv;function Mz(){return dv||(dv=1,rh.exports=Az()),rh.exports}/** + */var fv;function jz(){if(fv)return ih;fv=1;var e=Bo();function n(p,y){return p===y&&(p!==0||1/p===1/y)||p!==p&&y!==y}var i=typeof Object.is=="function"?Object.is:n,l=e.useState,o=e.useEffect,s=e.useLayoutEffect,u=e.useDebugValue;function f(p,y){var v=y(),w=l({inst:{value:v,getSnapshot:y}}),E=w[0].inst,_=w[1];return s(function(){E.value=v,E.getSnapshot=y,d(E)&&_({inst:E})},[p,v,y]),o(function(){return d(E)&&_({inst:E}),p(function(){d(E)&&_({inst:E})})},[p]),u(v),v}function d(p){var y=p.getSnapshot;p=p.value;try{var v=y();return!i(p,v)}catch{return!0}}function h(p,y){return y()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:f;return ih.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,ih}var dv;function Oz(){return dv||(dv=1,rh.exports=jz()),rh.exports}/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -281,26 +286,26 @@ Error generating stack: `+c.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var hv;function jz(){if(hv)return nh;hv=1;var e=Ho(),n=Mz();function i(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}var l=typeof Object.is=="function"?Object.is:i,o=n.useSyncExternalStore,s=e.useRef,u=e.useEffect,f=e.useMemo,d=e.useDebugValue;return nh.useSyncExternalStoreWithSelector=function(h,m,p,y,v){var w=s(null);if(w.current===null){var k={hasValue:!1,value:null};w.current=k}else k=w.current;w=f(function(){function _(T){if(!z){if(z=!0,E=T,T=y(T),v!==void 0&&k.hasValue){var q=k.value;if(v(q,T))return A=q}return A=T}if(q=A,l(E,T))return q;var M=y(T);return v!==void 0&&v(q,M)?(E=T,q):(E=T,A=M)}var z=!1,E,A,B=p===void 0?null:p;return[function(){return _(m())},B===null?void 0:function(){return _(B())}]},[m,p,y,v]);var S=o(h,w[0],w[1]);return u(function(){k.hasValue=!0,k.value=S},[S]),d(S),S},nh}var pv;function Oz(){return pv||(pv=1,th.exports=jz()),th.exports}var Rz=Oz();const Dz=Lo(Rz),Lz={},mv=e=>{let n;const i=new Set,l=(m,p)=>{const y=typeof m=="function"?m(n):m;if(!Object.is(y,n)){const v=n;n=p??(typeof y!="object"||y===null)?y:Object.assign({},n,y),i.forEach(w=>w(n,v))}},o=()=>n,d={setState:l,getState:o,getInitialState:()=>h,subscribe:m=>(i.add(m),()=>i.delete(m)),destroy:()=>{(Lz?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),i.clear()}},h=n=e(l,o,d);return d},Hz=e=>e?mv(e):mv,{useDebugValue:Bz}=Ul,{useSyncExternalStoreWithSelector:qz}=Dz,Uz=e=>e;function Ww(e,n=Uz,i){const l=qz(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,i);return Bz(l),l}const gv=(e,n)=>{const i=Hz(e),l=(o,s=n)=>Ww(i,o,s);return Object.assign(l,i),l},Iz=(e,n)=>e?gv(e,n):gv;function dt(e,n){if(Object.is(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[l,o]of e)if(!Object.is(o,n.get(l)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const l of e)if(!n.has(l))return!1;return!0}const i=Object.keys(e);if(i.length!==Object.keys(n).length)return!1;for(const l of i)if(!Object.prototype.hasOwnProperty.call(n,l)||!Object.is(e[l],n[l]))return!1;return!0}var Vz=Eb();const xc=V.createContext(null),Yz=xc.Provider,eS=tr.error001();function Ie(e,n){const i=V.useContext(xc);if(i===null)throw new Error(eS);return Ww(i,e,n)}function ht(){const e=V.useContext(xc);if(e===null)throw new Error(eS);return V.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const yv={display:"none"},Gz={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},tS="react-flow__node-desc",nS="react-flow__edge-desc",$z="react-flow__aria-live",Xz=e=>e.ariaLiveMessage,Pz=e=>e.ariaLabelConfig;function Fz({rfId:e}){const n=Ie(Xz);return b.jsx("div",{id:`${$z}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Gz,children:n})}function Qz({rfId:e,disableKeyboardA11y:n}){const i=Ie(Pz);return b.jsxs(b.Fragment,{children:[b.jsx("div",{id:`${tS}-${e}`,style:yv,children:n?i["node.a11yDescription.default"]:i["node.a11yDescription.keyboardDisabled"]}),b.jsx("div",{id:`${nS}-${e}`,style:yv,children:i["edge.a11yDescription.default"]}),!n&&b.jsx(Fz,{rfId:e})]})}const vc=V.forwardRef(({position:e="top-left",children:n,className:i,style:l,...o},s)=>{const u=`${e}`.split("-");return b.jsx("div",{className:Tt(["react-flow__panel",i,...u]),style:l,ref:s,...o,children:n})});vc.displayName="Panel";function Zz({proOptions:e,position:n="bottom-right"}){return e!=null&&e.hideAttribution?null:b.jsx(vc,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:b.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Kz=e=>{const n=[],i=[];for(const[,l]of e.nodeLookup)l.selected&&n.push(l.internals.userNode);for(const[,l]of e.edgeLookup)l.selected&&i.push(l);return{selectedNodes:n,selectedEdges:i}},Au=e=>e.id;function Jz(e,n){return dt(e.selectedNodes.map(Au),n.selectedNodes.map(Au))&&dt(e.selectedEdges.map(Au),n.selectedEdges.map(Au))}function Wz({onSelectionChange:e}){const n=ht(),{selectedNodes:i,selectedEdges:l}=Ie(Kz,Jz);return V.useEffect(()=>{const o={nodes:i,edges:l};e==null||e(o),n.getState().onSelectionChangeHandlers.forEach(s=>s(o))},[i,l,e]),null}const eA=e=>!!e.onSelectionChangeHandlers;function tA({onSelectionChange:e}){const n=Ie(eA);return e||n?b.jsx(Wz,{onSelectionChange:e}):null}const rS=[0,0],nA={x:0,y:0,zoom:1},rA=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],xv=[...rA,"rfId"],iA=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),vv={translateExtent:Ao,nodeOrigin:rS,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function lA(e){const{setNodes:n,setEdges:i,setMinZoom:l,setMaxZoom:o,setTranslateExtent:s,setNodeExtent:u,reset:f,setDefaultNodesAndEdges:d}=Ie(iA,dt),h=ht();V.useEffect(()=>(d(e.defaultNodes,e.defaultEdges),()=>{m.current=vv,f()}),[]);const m=V.useRef(vv);return V.useEffect(()=>{for(const p of xv){const y=e[p],v=m.current[p];y!==v&&(typeof e[p]>"u"||(p==="nodes"?n(y):p==="edges"?i(y):p==="minZoom"?l(y):p==="maxZoom"?o(y):p==="translateExtent"?s(y):p==="nodeExtent"?u(y):p==="ariaLabelConfig"?h.setState({ariaLabelConfig:IT(y)}):p==="fitView"?h.setState({fitViewQueued:y}):p==="fitViewOptions"?h.setState({fitViewOptions:y}):h.setState({[p]:y})))}m.current=e},xv.map(p=>e[p])),null}function bv(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function aA(e){var l;const[n,i]=V.useState(e==="system"?null:e);return V.useEffect(()=>{if(e!=="system"){i(e);return}const o=bv(),s=()=>i(o!=null&&o.matches?"dark":"light");return s(),o==null||o.addEventListener("change",s),()=>{o==null||o.removeEventListener("change",s)}},[e]),n!==null?n:(l=bv())!=null&&l.matches?"dark":"light"}const wv=typeof document<"u"?document:null;function Ro(e=null,n={target:wv,actInsideInputWithModifier:!0}){const[i,l]=V.useState(!1),o=V.useRef(!1),s=V.useRef(new Set([])),[u,f]=V.useMemo(()=>{if(e!==null){const h=(Array.isArray(e)?e:[e]).filter(p=>typeof p=="string").map(p=>p.replace("+",` + */var hv;function Rz(){if(hv)return nh;hv=1;var e=Bo(),n=Oz();function i(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}var l=typeof Object.is=="function"?Object.is:i,o=n.useSyncExternalStore,s=e.useRef,u=e.useEffect,f=e.useMemo,d=e.useDebugValue;return nh.useSyncExternalStoreWithSelector=function(h,m,p,y,v){var w=s(null);if(w.current===null){var E={hasValue:!1,value:null};w.current=E}else E=w.current;w=f(function(){function S(T){if(!z){if(z=!0,k=T,T=y(T),v!==void 0&&E.hasValue){var q=E.value;if(v(q,T))return A=q}return A=T}if(q=A,l(k,T))return q;var j=y(T);return v!==void 0&&v(q,j)?(k=T,q):(k=T,A=j)}var z=!1,k,A,M=p===void 0?null:p;return[function(){return S(m())},M===null?void 0:function(){return S(M())}]},[m,p,y,v]);var _=o(h,w[0],w[1]);return u(function(){E.hasValue=!0,E.value=_},[_]),d(_),_},nh}var pv;function Dz(){return pv||(pv=1,th.exports=Rz()),th.exports}var Lz=Dz();const Hz=Ho(Lz),Bz={},mv=e=>{let n;const i=new Set,l=(m,p)=>{const y=typeof m=="function"?m(n):m;if(!Object.is(y,n)){const v=n;n=p??(typeof y!="object"||y===null)?y:Object.assign({},n,y),i.forEach(w=>w(n,v))}},o=()=>n,d={setState:l,getState:o,getInitialState:()=>h,subscribe:m=>(i.add(m),()=>i.delete(m)),destroy:()=>{(Bz?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),i.clear()}},h=n=e(l,o,d);return d},qz=e=>e?mv(e):mv,{useDebugValue:Uz}=Ul,{useSyncExternalStoreWithSelector:Iz}=Hz,Vz=e=>e;function tS(e,n=Vz,i){const l=Iz(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,i);return Uz(l),l}const gv=(e,n)=>{const i=qz(e),l=(o,s=n)=>tS(i,o,s);return Object.assign(l,i),l},Yz=(e,n)=>e?gv(e,n):gv;function dt(e,n){if(Object.is(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[l,o]of e)if(!Object.is(o,n.get(l)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const l of e)if(!n.has(l))return!1;return!0}const i=Object.keys(e);if(i.length!==Object.keys(n).length)return!1;for(const l of i)if(!Object.prototype.hasOwnProperty.call(n,l)||!Object.is(e[l],n[l]))return!1;return!0}var Gz=Eb();const xc=V.createContext(null),$z=xc.Provider,nS=tr.error001();function Ie(e,n){const i=V.useContext(xc);if(i===null)throw new Error(nS);return tS(i,e,n)}function ht(){const e=V.useContext(xc);if(e===null)throw new Error(nS);return V.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const yv={display:"none"},Xz={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},rS="react-flow__node-desc",iS="react-flow__edge-desc",Fz="react-flow__aria-live",Pz=e=>e.ariaLiveMessage,Qz=e=>e.ariaLabelConfig;function Zz({rfId:e}){const n=Ie(Pz);return b.jsx("div",{id:`${Fz}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Xz,children:n})}function Kz({rfId:e,disableKeyboardA11y:n}){const i=Ie(Qz);return b.jsxs(b.Fragment,{children:[b.jsx("div",{id:`${rS}-${e}`,style:yv,children:n?i["node.a11yDescription.default"]:i["node.a11yDescription.keyboardDisabled"]}),b.jsx("div",{id:`${iS}-${e}`,style:yv,children:i["edge.a11yDescription.default"]}),!n&&b.jsx(Zz,{rfId:e})]})}const vc=V.forwardRef(({position:e="top-left",children:n,className:i,style:l,...o},s)=>{const u=`${e}`.split("-");return b.jsx("div",{className:Tt(["react-flow__panel",i,...u]),style:l,ref:s,...o,children:n})});vc.displayName="Panel";function Jz({proOptions:e,position:n="bottom-right"}){return e!=null&&e.hideAttribution?null:b.jsx(vc,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:b.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Wz=e=>{const n=[],i=[];for(const[,l]of e.nodeLookup)l.selected&&n.push(l.internals.userNode);for(const[,l]of e.edgeLookup)l.selected&&i.push(l);return{selectedNodes:n,selectedEdges:i}},Au=e=>e.id;function eA(e,n){return dt(e.selectedNodes.map(Au),n.selectedNodes.map(Au))&&dt(e.selectedEdges.map(Au),n.selectedEdges.map(Au))}function tA({onSelectionChange:e}){const n=ht(),{selectedNodes:i,selectedEdges:l}=Ie(Wz,eA);return V.useEffect(()=>{const o={nodes:i,edges:l};e==null||e(o),n.getState().onSelectionChangeHandlers.forEach(s=>s(o))},[i,l,e]),null}const nA=e=>!!e.onSelectionChangeHandlers;function rA({onSelectionChange:e}){const n=Ie(nA);return e||n?b.jsx(tA,{onSelectionChange:e}):null}const lS=[0,0],iA={x:0,y:0,zoom:1},lA=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],xv=[...lA,"rfId"],aA=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),vv={translateExtent:Mo,nodeOrigin:lS,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function oA(e){const{setNodes:n,setEdges:i,setMinZoom:l,setMaxZoom:o,setTranslateExtent:s,setNodeExtent:u,reset:f,setDefaultNodesAndEdges:d}=Ie(aA,dt),h=ht();V.useEffect(()=>(d(e.defaultNodes,e.defaultEdges),()=>{m.current=vv,f()}),[]);const m=V.useRef(vv);return V.useEffect(()=>{for(const p of xv){const y=e[p],v=m.current[p];y!==v&&(typeof e[p]>"u"||(p==="nodes"?n(y):p==="edges"?i(y):p==="minZoom"?l(y):p==="maxZoom"?o(y):p==="translateExtent"?s(y):p==="nodeExtent"?u(y):p==="ariaLabelConfig"?h.setState({ariaLabelConfig:YT(y)}):p==="fitView"?h.setState({fitViewQueued:y}):p==="fitViewOptions"?h.setState({fitViewOptions:y}):h.setState({[p]:y})))}m.current=e},xv.map(p=>e[p])),null}function bv(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function sA(e){var l;const[n,i]=V.useState(e==="system"?null:e);return V.useEffect(()=>{if(e!=="system"){i(e);return}const o=bv(),s=()=>i(o!=null&&o.matches?"dark":"light");return s(),o==null||o.addEventListener("change",s),()=>{o==null||o.removeEventListener("change",s)}},[e]),n!==null?n:(l=bv())!=null&&l.matches?"dark":"light"}const wv=typeof document<"u"?document:null;function Do(e=null,n={target:wv,actInsideInputWithModifier:!0}){const[i,l]=V.useState(!1),o=V.useRef(!1),s=V.useRef(new Set([])),[u,f]=V.useMemo(()=>{if(e!==null){const h=(Array.isArray(e)?e:[e]).filter(p=>typeof p=="string").map(p=>p.replace("+",` `).replace(` `,` +`).split(` -`)),m=h.reduce((p,y)=>p.concat(...y),[]);return[h,m]}return[[],[]]},[e]);return V.useEffect(()=>{const d=(n==null?void 0:n.target)??wv,h=(n==null?void 0:n.actInsideInputWithModifier)??!0;if(e!==null){const m=v=>{var S,_;if(o.current=v.ctrlKey||v.metaKey||v.shiftKey||v.altKey,(!o.current||o.current&&!h)&&Hw(v))return!1;const k=_v(v.code,f);if(s.current.add(v[k]),Sv(u,s.current,!1)){const z=((_=(S=v.composedPath)==null?void 0:S.call(v))==null?void 0:_[0])||v.target,E=(z==null?void 0:z.nodeName)==="BUTTON"||(z==null?void 0:z.nodeName)==="A";n.preventDefault!==!1&&(o.current||!E)&&v.preventDefault(),l(!0)}},p=v=>{const w=_v(v.code,f);Sv(u,s.current,!0)?(l(!1),s.current.clear()):s.current.delete(v[w]),v.key==="Meta"&&s.current.clear(),o.current=!1},y=()=>{s.current.clear(),l(!1)};return d==null||d.addEventListener("keydown",m),d==null||d.addEventListener("keyup",p),window.addEventListener("blur",y),window.addEventListener("contextmenu",y),()=>{d==null||d.removeEventListener("keydown",m),d==null||d.removeEventListener("keyup",p),window.removeEventListener("blur",y),window.removeEventListener("contextmenu",y)}}},[e,l]),i}function Sv(e,n,i){return e.filter(l=>i||l.length===n.size).some(l=>l.every(o=>n.has(o)))}function _v(e,n){return n.includes(e)?"code":"key"}const oA=()=>{const e=ht();return V.useMemo(()=>({zoomIn:n=>{const{panZoom:i}=e.getState();return i?i.scaleBy(1.2,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},zoomOut:n=>{const{panZoom:i}=e.getState();return i?i.scaleBy(1/1.2,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},zoomTo:(n,i)=>{const{panZoom:l}=e.getState();return l?l.scaleTo(n,{duration:i==null?void 0:i.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(n,i)=>{const{transform:[l,o,s],panZoom:u}=e.getState();return u?(await u.setViewport({x:n.x??l,y:n.y??o,zoom:n.zoom??s},i),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[n,i,l]=e.getState().transform;return{x:n,y:i,zoom:l}},setCenter:async(n,i,l)=>e.getState().setCenter(n,i,l),fitBounds:async(n,i)=>{const{width:l,height:o,minZoom:s,maxZoom:u,panZoom:f}=e.getState(),d=nm(n,l,o,s,u,(i==null?void 0:i.padding)??.1);return f?(await f.setViewport(d,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(n,i={})=>{const{transform:l,snapGrid:o,snapToGrid:s,domNode:u}=e.getState();if(!u)return n;const{x:f,y:d}=u.getBoundingClientRect(),h={x:n.x-f,y:n.y-d},m=i.snapGrid??o,p=i.snapToGrid??s;return Go(h,l,p,m)},flowToScreenPosition:n=>{const{transform:i,domNode:l}=e.getState();if(!l)return n;const{x:o,y:s}=l.getBoundingClientRect(),u=tc(n,i);return{x:u.x+o,y:u.y+s}}}),[])};function iS(e,n){const i=[],l=new Map,o=[];for(const s of e)if(s.type==="add"){o.push(s);continue}else if(s.type==="remove"||s.type==="replace")l.set(s.id,[s]);else{const u=l.get(s.id);u?u.push(s):l.set(s.id,[s])}for(const s of n){const u=l.get(s.id);if(!u){i.push(s);continue}if(u[0].type==="remove")continue;if(u[0].type==="replace"){i.push({...u[0].item});continue}const f={...s};for(const d of u)sA(d,f);i.push(f)}return o.length&&o.forEach(s=>{s.index!==void 0?i.splice(s.index,0,{...s.item}):i.push({...s.item})}),i}function sA(e,n){switch(e.type){case"select":{n.selected=e.selected;break}case"position":{typeof e.position<"u"&&(n.position=e.position),typeof e.dragging<"u"&&(n.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(n.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(n.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(n.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(n.resizing=e.resizing);break}}}function lS(e,n){return iS(e,n)}function aS(e,n){return iS(e,n)}function Di(e,n){return{id:e,type:"select",selected:n}}function Yl(e,n=new Set,i=!1){const l=[];for(const[o,s]of e){const u=n.has(o);!(s.selected===void 0&&!u)&&s.selected!==u&&(i&&(s.selected=u),l.push(Di(s.id,u)))}return l}function Ev({items:e=[],lookup:n}){var o;const i=[],l=new Map(e.map(s=>[s.id,s]));for(const[s,u]of e.entries()){const f=n.get(u.id),d=((o=f==null?void 0:f.internals)==null?void 0:o.userNode)??f;d!==void 0&&d!==u&&i.push({id:u.id,item:u,type:"replace"}),d===void 0&&i.push({item:u,type:"add",index:s})}for(const[s]of n)l.get(s)===void 0&&i.push({id:s,type:"remove"});return i}function Nv(e){return{id:e.id,type:"remove"}}const kv=e=>MT(e),uA=e=>zw(e);function oS(e){return V.forwardRef(e)}const cA=typeof window<"u"?V.useLayoutEffect:V.useEffect;function Cv(e){const[n,i]=V.useState(BigInt(0)),[l]=V.useState(()=>fA(()=>i(o=>o+BigInt(1))));return cA(()=>{const o=l.get();o.length&&(e(o),l.reset())},[n]),l}function fA(e){let n=[];return{get:()=>n,reset:()=>{n=[]},push:i=>{n.push(i),e()}}}const sS=V.createContext(null);function dA({children:e}){const n=ht(),i=V.useCallback(f=>{const{nodes:d=[],setNodes:h,hasDefaultNodes:m,onNodesChange:p,nodeLookup:y,fitViewQueued:v,onNodesChangeMiddlewareMap:w}=n.getState();let k=d;for(const _ of f)k=typeof _=="function"?_(k):_;let S=Ev({items:k,lookup:y});for(const _ of w.values())S=_(S);m&&h(k),S.length>0?p==null||p(S):v&&window.requestAnimationFrame(()=>{const{fitViewQueued:_,nodes:z,setNodes:E}=n.getState();_&&E(z)})},[]),l=Cv(i),o=V.useCallback(f=>{const{edges:d=[],setEdges:h,hasDefaultEdges:m,onEdgesChange:p,edgeLookup:y}=n.getState();let v=d;for(const w of f)v=typeof w=="function"?w(v):w;m?h(v):p&&p(Ev({items:v,lookup:y}))},[]),s=Cv(o),u=V.useMemo(()=>({nodeQueue:l,edgeQueue:s}),[]);return b.jsx(sS.Provider,{value:u,children:e})}function hA(){const e=V.useContext(sS);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const pA=e=>!!e.panZoom;function $o(){const e=oA(),n=ht(),i=hA(),l=Ie(pA),o=V.useMemo(()=>{const s=p=>n.getState().nodeLookup.get(p),u=p=>{i.nodeQueue.push(p)},f=p=>{i.edgeQueue.push(p)},d=p=>{var _,z;const{nodeLookup:y,nodeOrigin:v}=n.getState(),w=kv(p)?p:y.get(p.id),k=w.parentId?Dw(w.position,w.measured,w.parentId,y,v):w.position,S={...w,position:k,width:((_=w.measured)==null?void 0:_.width)??w.width,height:((z=w.measured)==null?void 0:z.height)??w.height};return ta(S)},h=(p,y,v={replace:!1})=>{u(w=>w.map(k=>{if(k.id===p){const S=typeof y=="function"?y(k):y;return v.replace&&kv(S)?S:{...k,...S}}return k}))},m=(p,y,v={replace:!1})=>{f(w=>w.map(k=>{if(k.id===p){const S=typeof y=="function"?y(k):y;return v.replace&&uA(S)?S:{...k,...S}}return k}))};return{getNodes:()=>n.getState().nodes.map(p=>({...p})),getNode:p=>{var y;return(y=s(p))==null?void 0:y.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:p=[]}=n.getState();return p.map(y=>({...y}))},getEdge:p=>n.getState().edgeLookup.get(p),setNodes:u,setEdges:f,addNodes:p=>{const y=Array.isArray(p)?p:[p];i.nodeQueue.push(v=>[...v,...y])},addEdges:p=>{const y=Array.isArray(p)?p:[p];i.edgeQueue.push(v=>[...v,...y])},toObject:()=>{const{nodes:p=[],edges:y=[],transform:v}=n.getState(),[w,k,S]=v;return{nodes:p.map(_=>({..._})),edges:y.map(_=>({..._})),viewport:{x:w,y:k,zoom:S}}},deleteElements:async({nodes:p=[],edges:y=[]})=>{const{nodes:v,edges:w,onNodesDelete:k,onEdgesDelete:S,triggerNodeChanges:_,triggerEdgeChanges:z,onDelete:E,onBeforeDelete:A}=n.getState(),{nodes:B,edges:T}=await LT({nodesToRemove:p,edgesToRemove:y,nodes:v,edges:w,onBeforeDelete:A}),q=T.length>0,M=B.length>0;if(q){const D=T.map(Nv);S==null||S(T),z(D)}if(M){const D=B.map(Nv);k==null||k(B),_(D)}return(M||q)&&(E==null||E({nodes:B,edges:T})),{deletedNodes:B,deletedEdges:T}},getIntersectingNodes:(p,y=!0,v)=>{const w=Jx(p),k=w?p:d(p),S=v!==void 0;return k?(v||n.getState().nodes).filter(_=>{const z=n.getState().nodeLookup.get(_.id);if(z&&!w&&(_.id===p.id||!z.internals.positionAbsolute))return!1;const E=ta(S?_:z),A=jo(E,k);return y&&A>0||A>=E.width*E.height||A>=k.width*k.height}):[]},isNodeIntersecting:(p,y,v=!0)=>{const k=Jx(p)?p:d(p);if(!k)return!1;const S=jo(k,y);return v&&S>0||S>=y.width*y.height||S>=k.width*k.height},updateNode:h,updateNodeData:(p,y,v={replace:!1})=>{h(p,w=>{const k=typeof y=="function"?y(w):y;return v.replace?{...w,data:k}:{...w,data:{...w.data,...k}}},v)},updateEdge:m,updateEdgeData:(p,y,v={replace:!1})=>{m(p,w=>{const k=typeof y=="function"?y(w):y;return v.replace?{...w,data:k}:{...w,data:{...w.data,...k}}},v)},getNodesBounds:p=>{const{nodeLookup:y,nodeOrigin:v}=n.getState();return jT(p,{nodeLookup:y,nodeOrigin:v})},getHandleConnections:({type:p,id:y,nodeId:v})=>{var w;return Array.from(((w=n.getState().connectionLookup.get(`${v}-${p}${y?`-${y}`:""}`))==null?void 0:w.values())??[])},getNodeConnections:({type:p,handleId:y,nodeId:v})=>{var w;return Array.from(((w=n.getState().connectionLookup.get(`${v}${p?y?`-${p}-${y}`:`-${p}`:""}`))==null?void 0:w.values())??[])},fitView:async p=>{const y=n.getState().fitViewResolver??UT();return n.setState({fitViewQueued:!0,fitViewOptions:p,fitViewResolver:y}),i.nodeQueue.push(v=>[...v]),y.promise}}},[]);return V.useMemo(()=>({...o,...e,viewportInitialized:l}),[l])}const Tv=e=>e.selected,mA=typeof window<"u"?window:void 0;function gA({deleteKeyCode:e,multiSelectionKeyCode:n}){const i=ht(),{deleteElements:l}=$o(),o=Ro(e,{actInsideInputWithModifier:!1}),s=Ro(n,{target:mA});V.useEffect(()=>{if(o){const{edges:u,nodes:f}=i.getState();l({nodes:f.filter(Tv),edges:u.filter(Tv)}),i.setState({nodesSelectionActive:!1})}},[o]),V.useEffect(()=>{i.setState({multiSelectionActive:s})},[s])}function yA(e){const n=ht();V.useEffect(()=>{const i=()=>{var o,s,u,f;if(!e.current||!(((s=(o=e.current).checkVisibility)==null?void 0:s.call(o))??!0))return!1;const l=rm(e.current);(l.height===0||l.width===0)&&((f=(u=n.getState()).onError)==null||f.call(u,"004",tr.error004())),n.setState({width:l.width||500,height:l.height||500})};if(e.current){i(),window.addEventListener("resize",i);const l=new ResizeObserver(()=>i());return l.observe(e.current),()=>{window.removeEventListener("resize",i),l&&e.current&&l.unobserve(e.current)}}},[])}const bc={position:"absolute",width:"100%",height:"100%",top:0,left:0},xA=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function vA({onPaneContextMenu:e,zoomOnScroll:n=!0,zoomOnPinch:i=!0,panOnScroll:l=!1,panOnScrollSpeed:o=.5,panOnScrollMode:s=Ii.Free,zoomOnDoubleClick:u=!0,panOnDrag:f=!0,defaultViewport:d,translateExtent:h,minZoom:m,maxZoom:p,zoomActivationKeyCode:y,preventScrolling:v=!0,children:w,noWheelClassName:k,noPanClassName:S,onViewportChange:_,isControlledViewport:z,paneClickDistance:E,selectionOnDrag:A}){const B=ht(),T=V.useRef(null),{userSelectionActive:q,lib:M,connectionInProgress:D}=Ie(xA,dt),X=Ro(y),H=V.useRef();yA(T);const I=V.useCallback(ee=>{_==null||_({x:ee[0],y:ee[1],zoom:ee[2]}),z||B.setState({transform:ee})},[_,z]);return V.useEffect(()=>{if(T.current){H.current=_z({domNode:T.current,minZoom:m,maxZoom:p,translateExtent:h,viewport:d,onDraggingChange:R=>B.setState($=>$.paneDragging===R?$:{paneDragging:R}),onPanZoomStart:(R,$)=>{const{onViewportChangeStart:Z,onMoveStart:J}=B.getState();J==null||J(R,$),Z==null||Z($)},onPanZoom:(R,$)=>{const{onViewportChange:Z,onMove:J}=B.getState();J==null||J(R,$),Z==null||Z($)},onPanZoomEnd:(R,$)=>{const{onViewportChangeEnd:Z,onMoveEnd:J}=B.getState();J==null||J(R,$),Z==null||Z($)}});const{x:ee,y:L,zoom:G}=H.current.getViewport();return B.setState({panZoom:H.current,transform:[ee,L,G],domNode:T.current.closest(".react-flow")}),()=>{var R;(R=H.current)==null||R.destroy()}}},[]),V.useEffect(()=>{var ee;(ee=H.current)==null||ee.update({onPaneContextMenu:e,zoomOnScroll:n,zoomOnPinch:i,panOnScroll:l,panOnScrollSpeed:o,panOnScrollMode:s,zoomOnDoubleClick:u,panOnDrag:f,zoomActivationKeyPressed:X,preventScrolling:v,noPanClassName:S,userSelectionActive:q,noWheelClassName:k,lib:M,onTransformChange:I,connectionInProgress:D,selectionOnDrag:A,paneClickDistance:E})},[e,n,i,l,o,s,u,f,X,v,S,q,k,M,I,D,A,E]),b.jsx("div",{className:"react-flow__renderer",ref:T,style:bc,children:w})}const bA=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function wA(){const{userSelectionActive:e,userSelectionRect:n}=Ie(bA,dt);return e&&n?b.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}const lh=(e,n)=>i=>{i.target===n.current&&(e==null||e(i))},SA=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function _A({isSelecting:e,selectionKeyPressed:n,selectionMode:i=Mo.Full,panOnDrag:l,paneClickDistance:o,selectionOnDrag:s,onSelectionStart:u,onSelectionEnd:f,onPaneClick:d,onPaneContextMenu:h,onPaneScroll:m,onPaneMouseEnter:p,onPaneMouseMove:y,onPaneMouseLeave:v,children:w}){const k=ht(),{userSelectionActive:S,elementsSelectable:_,dragging:z,connectionInProgress:E}=Ie(SA,dt),A=_&&(e||S),B=V.useRef(null),T=V.useRef(),q=V.useRef(new Set),M=V.useRef(new Set),D=V.useRef(!1),X=Z=>{if(D.current||E){D.current=!1;return}d==null||d(Z),k.getState().resetSelectedElements(),k.setState({nodesSelectionActive:!1})},H=Z=>{if(Array.isArray(l)&&(l!=null&&l.includes(2))){Z.preventDefault();return}h==null||h(Z)},I=m?Z=>m(Z):void 0,ee=Z=>{D.current&&(Z.stopPropagation(),D.current=!1)},L=Z=>{var F,K;const{domNode:J}=k.getState();if(T.current=J==null?void 0:J.getBoundingClientRect(),!T.current)return;const j=Z.target===B.current;if(!j&&!!Z.target.closest(".nokey")||!e||!(s&&j||n)||Z.button!==0||!Z.isPrimary)return;(K=(F=Z.target)==null?void 0:F.setPointerCapture)==null||K.call(F,Z.pointerId),D.current=!1;const{x:N,y:Y}=Un(Z.nativeEvent,T.current);k.setState({userSelectionRect:{width:0,height:0,startX:N,startY:Y,x:N,y:Y}}),j||(Z.stopPropagation(),Z.preventDefault())},G=Z=>{const{userSelectionRect:J,transform:j,nodeLookup:U,edgeLookup:P,connectionLookup:N,triggerNodeChanges:Y,triggerEdgeChanges:F,defaultEdgeOptions:K,resetSelectedElements:ne}=k.getState();if(!T.current||!J)return;const{x:re,y:se}=Un(Z.nativeEvent,T.current),{startX:ye,startY:ve}=J;if(!D.current){const Ce=n?0:o;if(Math.hypot(re-ye,se-ve)<=Ce)return;ne(),u==null||u(Z)}D.current=!0;const xe={startX:ye,startY:ve,x:reCe.id)),M.current=new Set;const Me=(K==null?void 0:K.selectable)??!0;for(const Ce of q.current){const st=N.get(Ce);if(st)for(const{edgeId:We}of st.values()){const zt=P.get(We);zt&&(zt.selectable??Me)&&M.current.add(We)}}if(!Wx(pe,q.current)){const Ce=Yl(U,q.current,!0);Y(Ce)}if(!Wx(_e,M.current)){const Ce=Yl(P,M.current);F(Ce)}k.setState({userSelectionRect:xe,userSelectionActive:!0,nodesSelectionActive:!1})},R=Z=>{var J,j;Z.button===0&&((j=(J=Z.target)==null?void 0:J.releasePointerCapture)==null||j.call(J,Z.pointerId),!S&&Z.target===B.current&&k.getState().userSelectionRect&&(X==null||X(Z)),k.setState({userSelectionActive:!1,userSelectionRect:null}),D.current&&(f==null||f(Z),k.setState({nodesSelectionActive:q.current.size>0})))},$=l===!0||Array.isArray(l)&&l.includes(0);return b.jsxs("div",{className:Tt(["react-flow__pane",{draggable:$,dragging:z,selection:e}]),onClick:A?void 0:lh(X,B),onContextMenu:lh(H,B),onWheel:lh(I,B),onPointerEnter:A?void 0:p,onPointerMove:A?G:y,onPointerUp:A?R:void 0,onPointerDownCapture:A?L:void 0,onClickCapture:A?ee:void 0,onPointerLeave:v,ref:B,style:bc,children:[w,b.jsx(wA,{})]})}function Mp({id:e,store:n,unselect:i=!1,nodeRef:l}){const{addSelectedNodes:o,unselectNodesAndEdges:s,multiSelectionActive:u,nodeLookup:f,onError:d}=n.getState(),h=f.get(e);if(!h){d==null||d("012",tr.error012(e));return}n.setState({nodesSelectionActive:!1}),h.selected?(i||h.selected&&u)&&(s({nodes:[h],edges:[]}),requestAnimationFrame(()=>{var m;return(m=l==null?void 0:l.current)==null?void 0:m.blur()})):o([e])}function uS({nodeRef:e,disabled:n=!1,noDragClassName:i,handleSelector:l,nodeId:o,isSelectable:s,nodeClickDistance:u}){const f=ht(),[d,h]=V.useState(!1),m=V.useRef();return V.useEffect(()=>{m.current=uz({getStoreItems:()=>f.getState(),onNodeMouseDown:p=>{Mp({id:p,store:f,nodeRef:e})},onDragStart:()=>{h(!0)},onDragStop:()=>{h(!1)}})},[]),V.useEffect(()=>{if(!(n||!e.current||!m.current))return m.current.update({noDragClassName:i,handleSelector:l,domNode:e.current,isSelectable:s,nodeId:o,nodeClickDistance:u}),()=>{var p;(p=m.current)==null||p.destroy()}},[i,l,n,s,e,o,u]),d}const EA=e=>n=>n.selected&&(n.draggable||e&&typeof n.draggable>"u");function cS(){const e=ht();return V.useCallback(i=>{const{nodeExtent:l,snapToGrid:o,snapGrid:s,nodesDraggable:u,onError:f,updateNodePositions:d,nodeLookup:h,nodeOrigin:m}=e.getState(),p=new Map,y=EA(u),v=o?s[0]:5,w=o?s[1]:5,k=i.direction.x*v*i.factor,S=i.direction.y*w*i.factor;for(const[,_]of h){if(!y(_))continue;let z={x:_.internals.positionAbsolute.x+k,y:_.internals.positionAbsolute.y+S};o&&(z=Yo(z,s));const{position:E,positionAbsolute:A}=Aw({nodeId:_.id,nextPosition:z,nodeLookup:h,nodeExtent:l,nodeOrigin:m,onError:f});_.position=E,_.internals.positionAbsolute=A,p.set(_.id,_)}d(p)},[])}const cm=V.createContext(null),NA=cm.Provider;cm.Consumer;const fS=()=>V.useContext(cm),kA=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),CA=(e,n,i)=>l=>{const{connectionClickStartHandle:o,connectionMode:s,connection:u}=l,{fromHandle:f,toHandle:d,isValid:h}=u,m=(d==null?void 0:d.nodeId)===e&&(d==null?void 0:d.id)===n&&(d==null?void 0:d.type)===i;return{connectingFrom:(f==null?void 0:f.nodeId)===e&&(f==null?void 0:f.id)===n&&(f==null?void 0:f.type)===i,connectingTo:m,clickConnecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===n&&(o==null?void 0:o.type)===i,isPossibleEndHandle:s===Wl.Strict?(f==null?void 0:f.type)!==i:e!==(f==null?void 0:f.nodeId)||n!==(f==null?void 0:f.id),connectionInProcess:!!f,clickConnectionInProcess:!!o,valid:m&&h}};function TA({type:e="source",position:n=we.Top,isValidConnection:i,isConnectable:l=!0,isConnectableStart:o=!0,isConnectableEnd:s=!0,id:u,onConnect:f,children:d,className:h,onMouseDown:m,onTouchStart:p,...y},v){var G,R;const w=u||null,k=e==="target",S=ht(),_=fS(),{connectOnClick:z,noPanClassName:E,rfId:A}=Ie(kA,dt),{connectingFrom:B,connectingTo:T,clickConnecting:q,isPossibleEndHandle:M,connectionInProcess:D,clickConnectionInProcess:X,valid:H}=Ie(CA(_,w,e),dt);_||(R=(G=S.getState()).onError)==null||R.call(G,"010",tr.error010());const I=$=>{const{defaultEdgeOptions:Z,onConnect:J,hasDefaultEdges:j}=S.getState(),U={...Z,...$};if(j){const{edges:P,setEdges:N}=S.getState();N(PT(U,P))}J==null||J(U),f==null||f(U)},ee=$=>{if(!_)return;const Z=Bw($.nativeEvent);if(o&&(Z&&$.button===0||!Z)){const J=S.getState();Ap.onPointerDown($.nativeEvent,{handleDomNode:$.currentTarget,autoPanOnConnect:J.autoPanOnConnect,connectionMode:J.connectionMode,connectionRadius:J.connectionRadius,domNode:J.domNode,nodeLookup:J.nodeLookup,lib:J.lib,isTarget:k,handleId:w,nodeId:_,flowId:J.rfId,panBy:J.panBy,cancelConnection:J.cancelConnection,onConnectStart:J.onConnectStart,onConnectEnd:(...j)=>{var U,P;return(P=(U=S.getState()).onConnectEnd)==null?void 0:P.call(U,...j)},updateConnection:J.updateConnection,onConnect:I,isValidConnection:i||((...j)=>{var U,P;return((P=(U=S.getState()).isValidConnection)==null?void 0:P.call(U,...j))??!0}),getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,autoPanSpeed:J.autoPanSpeed,dragThreshold:J.connectionDragThreshold})}Z?m==null||m($):p==null||p($)},L=$=>{const{onClickConnectStart:Z,onClickConnectEnd:J,connectionClickStartHandle:j,connectionMode:U,isValidConnection:P,lib:N,rfId:Y,nodeLookup:F,connection:K}=S.getState();if(!_||!j&&!o)return;if(!j){Z==null||Z($.nativeEvent,{nodeId:_,handleId:w,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:_,type:e,id:w}});return}const ne=Lw($.target),re=i||P,{connection:se,isValid:ye}=Ap.isValid($.nativeEvent,{handle:{nodeId:_,id:w,type:e},connectionMode:U,fromNodeId:j.nodeId,fromHandleId:j.id||null,fromType:j.type,isValidConnection:re,flowId:Y,doc:ne,lib:N,nodeLookup:F});ye&&se&&I(se);const ve=structuredClone(K);delete ve.inProgress,ve.toPosition=ve.toHandle?ve.toHandle.position:null,J==null||J($,ve),S.setState({connectionClickStartHandle:null})};return b.jsx("div",{"data-handleid":w,"data-nodeid":_,"data-handlepos":n,"data-id":`${A}-${_}-${w}-${e}`,className:Tt(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",E,h,{source:!k,target:k,connectable:l,connectablestart:o,connectableend:s,clickconnecting:q,connectingfrom:B,connectingto:T,valid:H,connectionindicator:l&&(!D||M)&&(D||X?s:o)}]),onMouseDown:ee,onTouchStart:ee,onClick:z?L:void 0,ref:v,...y,children:d})}const an=V.memo(oS(TA));function zA({data:e,isConnectable:n,sourcePosition:i=we.Bottom}){return b.jsxs(b.Fragment,{children:[e==null?void 0:e.label,b.jsx(an,{type:"source",position:i,isConnectable:n})]})}function AA({data:e,isConnectable:n,targetPosition:i=we.Top,sourcePosition:l=we.Bottom}){return b.jsxs(b.Fragment,{children:[b.jsx(an,{type:"target",position:i,isConnectable:n}),e==null?void 0:e.label,b.jsx(an,{type:"source",position:l,isConnectable:n})]})}function MA(){return null}function jA({data:e,isConnectable:n,targetPosition:i=we.Top}){return b.jsxs(b.Fragment,{children:[b.jsx(an,{type:"target",position:i,isConnectable:n}),e==null?void 0:e.label]})}const nc={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},zv={input:zA,default:AA,output:jA,group:MA};function OA(e){var n,i,l,o;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((n=e.style)==null?void 0:n.width),height:e.height??e.initialHeight??((i=e.style)==null?void 0:i.height)}:{width:e.width??((l=e.style)==null?void 0:l.width),height:e.height??((o=e.style)==null?void 0:o.height)}}const RA=e=>{const{width:n,height:i,x:l,y:o}=Vo(e.nodeLookup,{filter:s=>!!s.selected});return{width:qn(n)?n:null,height:qn(i)?i:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${l}px,${o}px)`}};function DA({onSelectionContextMenu:e,noPanClassName:n,disableKeyboardA11y:i}){const l=ht(),{width:o,height:s,transformString:u,userSelectionActive:f}=Ie(RA,dt),d=cS(),h=V.useRef(null);V.useEffect(()=>{var v;i||(v=h.current)==null||v.focus({preventScroll:!0})},[i]);const m=!f&&o!==null&&s!==null;if(uS({nodeRef:h,disabled:!m}),!m)return null;const p=e?v=>{const w=l.getState().nodes.filter(k=>k.selected);e(v,w)}:void 0,y=v=>{Object.prototype.hasOwnProperty.call(nc,v.key)&&(v.preventDefault(),d({direction:nc[v.key],factor:v.shiftKey?4:1}))};return b.jsx("div",{className:Tt(["react-flow__nodesselection","react-flow__container",n]),style:{transform:u},children:b.jsx("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:p,tabIndex:i?void 0:-1,onKeyDown:i?void 0:y,style:{width:o,height:s}})})}const Av=typeof window<"u"?window:void 0,LA=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function dS({children:e,onPaneClick:n,onPaneMouseEnter:i,onPaneMouseMove:l,onPaneMouseLeave:o,onPaneContextMenu:s,onPaneScroll:u,paneClickDistance:f,deleteKeyCode:d,selectionKeyCode:h,selectionOnDrag:m,selectionMode:p,onSelectionStart:y,onSelectionEnd:v,multiSelectionKeyCode:w,panActivationKeyCode:k,zoomActivationKeyCode:S,elementsSelectable:_,zoomOnScroll:z,zoomOnPinch:E,panOnScroll:A,panOnScrollSpeed:B,panOnScrollMode:T,zoomOnDoubleClick:q,panOnDrag:M,defaultViewport:D,translateExtent:X,minZoom:H,maxZoom:I,preventScrolling:ee,onSelectionContextMenu:L,noWheelClassName:G,noPanClassName:R,disableKeyboardA11y:$,onViewportChange:Z,isControlledViewport:J}){const{nodesSelectionActive:j,userSelectionActive:U}=Ie(LA,dt),P=Ro(h,{target:Av}),N=Ro(k,{target:Av}),Y=N||M,F=N||A,K=m&&Y!==!0,ne=P||U||K;return gA({deleteKeyCode:d,multiSelectionKeyCode:w}),b.jsx(vA,{onPaneContextMenu:s,elementsSelectable:_,zoomOnScroll:z,zoomOnPinch:E,panOnScroll:F,panOnScrollSpeed:B,panOnScrollMode:T,zoomOnDoubleClick:q,panOnDrag:!P&&Y,defaultViewport:D,translateExtent:X,minZoom:H,maxZoom:I,zoomActivationKeyCode:S,preventScrolling:ee,noWheelClassName:G,noPanClassName:R,onViewportChange:Z,isControlledViewport:J,paneClickDistance:f,selectionOnDrag:K,children:b.jsxs(_A,{onSelectionStart:y,onSelectionEnd:v,onPaneClick:n,onPaneMouseEnter:i,onPaneMouseMove:l,onPaneMouseLeave:o,onPaneContextMenu:s,onPaneScroll:u,panOnDrag:Y,isSelecting:!!ne,selectionMode:p,selectionKeyPressed:P,paneClickDistance:f,selectionOnDrag:K,children:[e,j&&b.jsx(DA,{onSelectionContextMenu:L,noPanClassName:R,disableKeyboardA11y:$})]})})}dS.displayName="FlowRenderer";const HA=V.memo(dS),BA=e=>n=>e?tm(n.nodeLookup,{x:0,y:0,width:n.width,height:n.height},n.transform,!0).map(i=>i.id):Array.from(n.nodeLookup.keys());function qA(e){return Ie(V.useCallback(BA(e),[e]),dt)}const UA=e=>e.updateNodeInternals;function IA(){const e=Ie(UA),[n]=V.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(i=>{const l=new Map;i.forEach(o=>{const s=o.target.getAttribute("data-id");l.set(s,{id:s,nodeElement:o.target,force:!0})}),e(l)}));return V.useEffect(()=>()=>{n==null||n.disconnect()},[n]),n}function VA({node:e,nodeType:n,hasDimensions:i,resizeObserver:l}){const o=ht(),s=V.useRef(null),u=V.useRef(null),f=V.useRef(e.sourcePosition),d=V.useRef(e.targetPosition),h=V.useRef(n),m=i&&!!e.internals.handleBounds;return V.useEffect(()=>{s.current&&!e.hidden&&(!m||u.current!==s.current)&&(u.current&&(l==null||l.unobserve(u.current)),l==null||l.observe(s.current),u.current=s.current)},[m,e.hidden]),V.useEffect(()=>()=>{u.current&&(l==null||l.unobserve(u.current),u.current=null)},[]),V.useEffect(()=>{if(s.current){const p=h.current!==n,y=f.current!==e.sourcePosition,v=d.current!==e.targetPosition;(p||y||v)&&(h.current=n,f.current=e.sourcePosition,d.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,n,e.sourcePosition,e.targetPosition]),s}function YA({id:e,onClick:n,onMouseEnter:i,onMouseMove:l,onMouseLeave:o,onContextMenu:s,onDoubleClick:u,nodesDraggable:f,elementsSelectable:d,nodesConnectable:h,nodesFocusable:m,resizeObserver:p,noDragClassName:y,noPanClassName:v,disableKeyboardA11y:w,rfId:k,nodeTypes:S,nodeClickDistance:_,onError:z}){const{node:E,internals:A,isParent:B}=Ie(re=>{const se=re.nodeLookup.get(e),ye=re.parentLookup.has(e);return{node:se,internals:se.internals,isParent:ye}},dt);let T=E.type||"default",q=(S==null?void 0:S[T])||zv[T];q===void 0&&(z==null||z("003",tr.error003(T)),T="default",q=(S==null?void 0:S.default)||zv.default);const M=!!(E.draggable||f&&typeof E.draggable>"u"),D=!!(E.selectable||d&&typeof E.selectable>"u"),X=!!(E.connectable||h&&typeof E.connectable>"u"),H=!!(E.focusable||m&&typeof E.focusable>"u"),I=ht(),ee=Rw(E),L=VA({node:E,nodeType:T,hasDimensions:ee,resizeObserver:p}),G=uS({nodeRef:L,disabled:E.hidden||!M,noDragClassName:y,handleSelector:E.dragHandle,nodeId:e,isSelectable:D,nodeClickDistance:_}),R=cS();if(E.hidden)return null;const $=Ar(E),Z=OA(E),J=D||M||n||i||l||o,j=i?re=>i(re,{...A.userNode}):void 0,U=l?re=>l(re,{...A.userNode}):void 0,P=o?re=>o(re,{...A.userNode}):void 0,N=s?re=>s(re,{...A.userNode}):void 0,Y=u?re=>u(re,{...A.userNode}):void 0,F=re=>{const{selectNodesOnDrag:se,nodeDragThreshold:ye}=I.getState();D&&(!se||!M||ye>0)&&Mp({id:e,store:I,nodeRef:L}),n&&n(re,{...A.userNode})},K=re=>{if(!(Hw(re.nativeEvent)||w)){if(Nw.includes(re.key)&&D){const se=re.key==="Escape";Mp({id:e,store:I,unselect:se,nodeRef:L})}else if(M&&E.selected&&Object.prototype.hasOwnProperty.call(nc,re.key)){re.preventDefault();const{ariaLabelConfig:se}=I.getState();I.setState({ariaLiveMessage:se["node.a11yDescription.ariaLiveMessage"]({direction:re.key.replace("Arrow","").toLowerCase(),x:~~A.positionAbsolute.x,y:~~A.positionAbsolute.y})}),R({direction:nc[re.key],factor:re.shiftKey?4:1})}}},ne=()=>{var _e;if(w||!((_e=L.current)!=null&&_e.matches(":focus-visible")))return;const{transform:re,width:se,height:ye,autoPanOnNodeFocus:ve,setCenter:xe}=I.getState();if(!ve)return;tm(new Map([[e,E]]),{x:0,y:0,width:se,height:ye},re,!0).length>0||xe(E.position.x+$.width/2,E.position.y+$.height/2,{zoom:re[2]})};return b.jsx("div",{className:Tt(["react-flow__node",`react-flow__node-${T}`,{[v]:M},E.className,{selected:E.selected,selectable:D,parent:B,draggable:M,dragging:G}]),ref:L,style:{zIndex:A.z,transform:`translate(${A.positionAbsolute.x}px,${A.positionAbsolute.y}px)`,pointerEvents:J?"all":"none",visibility:ee?"visible":"hidden",...E.style,...Z},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:j,onMouseMove:U,onMouseLeave:P,onContextMenu:N,onClick:F,onDoubleClick:Y,onKeyDown:H?K:void 0,tabIndex:H?0:void 0,onFocus:H?ne:void 0,role:E.ariaRole??(H?"group":void 0),"aria-roledescription":"node","aria-describedby":w?void 0:`${tS}-${k}`,"aria-label":E.ariaLabel,...E.domAttributes,children:b.jsx(NA,{value:e,children:b.jsx(q,{id:e,data:E.data,type:T,positionAbsoluteX:A.positionAbsolute.x,positionAbsoluteY:A.positionAbsolute.y,selected:E.selected??!1,selectable:D,draggable:M,deletable:E.deletable??!0,isConnectable:X,sourcePosition:E.sourcePosition,targetPosition:E.targetPosition,dragging:G,dragHandle:E.dragHandle,zIndex:A.z,parentId:E.parentId,...$})})})}var GA=V.memo(YA);const $A=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function hS(e){const{nodesDraggable:n,nodesConnectable:i,nodesFocusable:l,elementsSelectable:o,onError:s}=Ie($A,dt),u=qA(e.onlyRenderVisibleElements),f=IA();return b.jsx("div",{className:"react-flow__nodes",style:bc,children:u.map(d=>b.jsx(GA,{id:d,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:f,nodesDraggable:n,nodesConnectable:i,nodesFocusable:l,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:s},d))})}hS.displayName="NodeRenderer";const XA=V.memo(hS);function PA(e){return Ie(V.useCallback(i=>{if(!e)return i.edges.map(o=>o.id);const l=[];if(i.width&&i.height)for(const o of i.edges){const s=i.nodeLookup.get(o.source),u=i.nodeLookup.get(o.target);s&&u&>({sourceNode:s,targetNode:u,width:i.width,height:i.height,transform:i.transform})&&l.push(o.id)}return l},[e]),dt)}const FA=({color:e="none",strokeWidth:n=1})=>{const i={strokeWidth:n,...e&&{stroke:e}};return b.jsx("polyline",{className:"arrow",style:i,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},QA=({color:e="none",strokeWidth:n=1})=>{const i={strokeWidth:n,...e&&{stroke:e,fill:e}};return b.jsx("polyline",{className:"arrowclosed",style:i,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Mv={[Wu.Arrow]:FA,[Wu.ArrowClosed]:QA};function ZA(e){const n=ht();return V.useMemo(()=>{var o,s;return Object.prototype.hasOwnProperty.call(Mv,e)?Mv[e]:((s=(o=n.getState()).onError)==null||s.call(o,"009",tr.error009(e)),null)},[e])}const KA=({id:e,type:n,color:i,width:l=12.5,height:o=12.5,markerUnits:s="strokeWidth",strokeWidth:u,orient:f="auto-start-reverse"})=>{const d=ZA(n);return d?b.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${l}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:f,refX:"0",refY:"0",children:b.jsx(d,{color:i,strokeWidth:u})}):null},pS=({defaultColor:e,rfId:n})=>{const i=Ie(s=>s.edges),l=Ie(s=>s.defaultEdgeOptions),o=V.useMemo(()=>JT(i,{id:n,defaultColor:e,defaultMarkerStart:l==null?void 0:l.markerStart,defaultMarkerEnd:l==null?void 0:l.markerEnd}),[i,l,n,e]);return o.length?b.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:b.jsx("defs",{children:o.map(s=>b.jsx(KA,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};pS.displayName="MarkerDefinitions";var JA=V.memo(pS);function mS({x:e,y:n,label:i,labelStyle:l,labelShowBg:o=!0,labelBgStyle:s,labelBgPadding:u=[2,4],labelBgBorderRadius:f=2,children:d,className:h,...m}){const[p,y]=V.useState({x:1,y:0,width:0,height:0}),v=Tt(["react-flow__edge-textwrapper",h]),w=V.useRef(null);return V.useEffect(()=>{if(w.current){const k=w.current.getBBox();y({x:k.x,y:k.y,width:k.width,height:k.height})}},[i]),i?b.jsxs("g",{transform:`translate(${e-p.width/2} ${n-p.height/2})`,className:v,visibility:p.width?"visible":"hidden",...m,children:[o&&b.jsx("rect",{width:p.width+2*u[0],x:-u[0],y:-u[1],height:p.height+2*u[1],className:"react-flow__edge-textbg",style:s,rx:f,ry:f}),b.jsx("text",{className:"react-flow__edge-text",y:p.height/2,dy:"0.3em",ref:w,style:l,children:i}),d]}):null}mS.displayName="EdgeText";const WA=V.memo(mS);function Xo({path:e,labelX:n,labelY:i,label:l,labelStyle:o,labelShowBg:s,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d,interactionWidth:h=20,...m}){return b.jsxs(b.Fragment,{children:[b.jsx("path",{...m,d:e,fill:"none",className:Tt(["react-flow__edge-path",m.className])}),h?b.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}):null,l&&qn(n)&&qn(i)?b.jsx(WA,{x:n,y:i,label:l,labelStyle:o,labelShowBg:s,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d}):null]})}function jv({pos:e,x1:n,y1:i,x2:l,y2:o}){return e===we.Left||e===we.Right?[.5*(n+l),i]:[n,.5*(i+o)]}function gS({sourceX:e,sourceY:n,sourcePosition:i=we.Bottom,targetX:l,targetY:o,targetPosition:s=we.Top}){const[u,f]=jv({pos:i,x1:e,y1:n,x2:l,y2:o}),[d,h]=jv({pos:s,x1:l,y1:o,x2:e,y2:n}),[m,p,y,v]=qw({sourceX:e,sourceY:n,targetX:l,targetY:o,sourceControlX:u,sourceControlY:f,targetControlX:d,targetControlY:h});return[`M${e},${n} C${u},${f} ${d},${h} ${l},${o}`,m,p,y,v]}function yS(e){return V.memo(({id:n,sourceX:i,sourceY:l,targetX:o,targetY:s,sourcePosition:u,targetPosition:f,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:y,labelBgBorderRadius:v,style:w,markerEnd:k,markerStart:S,interactionWidth:_})=>{const[z,E,A]=gS({sourceX:i,sourceY:l,sourcePosition:u,targetX:o,targetY:s,targetPosition:f}),B=e.isInternal?void 0:n;return b.jsx(Xo,{id:B,path:z,labelX:E,labelY:A,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:y,labelBgBorderRadius:v,style:w,markerEnd:k,markerStart:S,interactionWidth:_})})}const eM=yS({isInternal:!1}),xS=yS({isInternal:!0});eM.displayName="SimpleBezierEdge";xS.displayName="SimpleBezierEdgeInternal";function vS(e){return V.memo(({id:n,sourceX:i,sourceY:l,targetX:o,targetY:s,label:u,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:y,sourcePosition:v=we.Bottom,targetPosition:w=we.Top,markerEnd:k,markerStart:S,pathOptions:_,interactionWidth:z})=>{const[E,A,B]=Cp({sourceX:i,sourceY:l,sourcePosition:v,targetX:o,targetY:s,targetPosition:w,borderRadius:_==null?void 0:_.borderRadius,offset:_==null?void 0:_.offset,stepPosition:_==null?void 0:_.stepPosition}),T=e.isInternal?void 0:n;return b.jsx(Xo,{id:T,path:E,labelX:A,labelY:B,label:u,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:y,markerEnd:k,markerStart:S,interactionWidth:z})})}const bS=vS({isInternal:!1}),wS=vS({isInternal:!0});bS.displayName="SmoothStepEdge";wS.displayName="SmoothStepEdgeInternal";function SS(e){return V.memo(({id:n,...i})=>{var o;const l=e.isInternal?void 0:n;return b.jsx(bS,{...i,id:l,pathOptions:V.useMemo(()=>{var s;return{borderRadius:0,offset:(s=i.pathOptions)==null?void 0:s.offset}},[(o=i.pathOptions)==null?void 0:o.offset])})})}const tM=SS({isInternal:!1}),_S=SS({isInternal:!0});tM.displayName="StepEdge";_S.displayName="StepEdgeInternal";function ES(e){return V.memo(({id:n,sourceX:i,sourceY:l,targetX:o,targetY:s,label:u,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:y,markerEnd:v,markerStart:w,interactionWidth:k})=>{const[S,_,z]=Iw({sourceX:i,sourceY:l,targetX:o,targetY:s}),E=e.isInternal?void 0:n;return b.jsx(Xo,{id:E,path:S,labelX:_,labelY:z,label:u,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:y,markerEnd:v,markerStart:w,interactionWidth:k})})}const nM=ES({isInternal:!1}),NS=ES({isInternal:!0});nM.displayName="StraightEdge";NS.displayName="StraightEdgeInternal";function kS(e){return V.memo(({id:n,sourceX:i,sourceY:l,targetX:o,targetY:s,sourcePosition:u=we.Bottom,targetPosition:f=we.Top,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:y,labelBgBorderRadius:v,style:w,markerEnd:k,markerStart:S,pathOptions:_,interactionWidth:z})=>{const[E,A,B]=im({sourceX:i,sourceY:l,sourcePosition:u,targetX:o,targetY:s,targetPosition:f,curvature:_==null?void 0:_.curvature}),T=e.isInternal?void 0:n;return b.jsx(Xo,{id:T,path:E,labelX:A,labelY:B,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:y,labelBgBorderRadius:v,style:w,markerEnd:k,markerStart:S,interactionWidth:z})})}const rM=kS({isInternal:!1}),CS=kS({isInternal:!0});rM.displayName="BezierEdge";CS.displayName="BezierEdgeInternal";const Ov={default:CS,straight:NS,step:_S,smoothstep:wS,simplebezier:xS},Rv={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},iM=(e,n,i)=>i===we.Left?e-n:i===we.Right?e+n:e,lM=(e,n,i)=>i===we.Top?e-n:i===we.Bottom?e+n:e,Dv="react-flow__edgeupdater";function Lv({position:e,centerX:n,centerY:i,radius:l=10,onMouseDown:o,onMouseEnter:s,onMouseOut:u,type:f}){return b.jsx("circle",{onMouseDown:o,onMouseEnter:s,onMouseOut:u,className:Tt([Dv,`${Dv}-${f}`]),cx:iM(n,l,e),cy:lM(i,l,e),r:l,stroke:"transparent",fill:"transparent"})}function aM({isReconnectable:e,reconnectRadius:n,edge:i,sourceX:l,sourceY:o,targetX:s,targetY:u,sourcePosition:f,targetPosition:d,onReconnect:h,onReconnectStart:m,onReconnectEnd:p,setReconnecting:y,setUpdateHover:v}){const w=ht(),k=(A,B)=>{if(A.button!==0)return;const{autoPanOnConnect:T,domNode:q,connectionMode:M,connectionRadius:D,lib:X,onConnectStart:H,cancelConnection:I,nodeLookup:ee,rfId:L,panBy:G,updateConnection:R}=w.getState(),$=B.type==="target",Z=(U,P)=>{y(!1),p==null||p(U,i,B.type,P)},J=U=>h==null?void 0:h(i,U),j=(U,P)=>{y(!0),m==null||m(A,i,B.type),H==null||H(U,P)};Ap.onPointerDown(A.nativeEvent,{autoPanOnConnect:T,connectionMode:M,connectionRadius:D,domNode:q,handleId:B.id,nodeId:B.nodeId,nodeLookup:ee,isTarget:$,edgeUpdaterType:B.type,lib:X,flowId:L,cancelConnection:I,panBy:G,isValidConnection:(...U)=>{var P,N;return((N=(P=w.getState()).isValidConnection)==null?void 0:N.call(P,...U))??!0},onConnect:J,onConnectStart:j,onConnectEnd:(...U)=>{var P,N;return(N=(P=w.getState()).onConnectEnd)==null?void 0:N.call(P,...U)},onReconnectEnd:Z,updateConnection:R,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,dragThreshold:w.getState().connectionDragThreshold,handleDomNode:A.currentTarget})},S=A=>k(A,{nodeId:i.target,id:i.targetHandle??null,type:"target"}),_=A=>k(A,{nodeId:i.source,id:i.sourceHandle??null,type:"source"}),z=()=>v(!0),E=()=>v(!1);return b.jsxs(b.Fragment,{children:[(e===!0||e==="source")&&b.jsx(Lv,{position:f,centerX:l,centerY:o,radius:n,onMouseDown:S,onMouseEnter:z,onMouseOut:E,type:"source"}),(e===!0||e==="target")&&b.jsx(Lv,{position:d,centerX:s,centerY:u,radius:n,onMouseDown:_,onMouseEnter:z,onMouseOut:E,type:"target"})]})}function oM({id:e,edgesFocusable:n,edgesReconnectable:i,elementsSelectable:l,onClick:o,onDoubleClick:s,onContextMenu:u,onMouseEnter:f,onMouseMove:d,onMouseLeave:h,reconnectRadius:m,onReconnect:p,onReconnectStart:y,onReconnectEnd:v,rfId:w,edgeTypes:k,noPanClassName:S,onError:_,disableKeyboardA11y:z}){let E=Ie(xe=>xe.edgeLookup.get(e));const A=Ie(xe=>xe.defaultEdgeOptions);E=A?{...A,...E}:E;let B=E.type||"default",T=(k==null?void 0:k[B])||Ov[B];T===void 0&&(_==null||_("011",tr.error011(B)),B="default",T=(k==null?void 0:k.default)||Ov.default);const q=!!(E.focusable||n&&typeof E.focusable>"u"),M=typeof p<"u"&&(E.reconnectable||i&&typeof E.reconnectable>"u"),D=!!(E.selectable||l&&typeof E.selectable>"u"),X=V.useRef(null),[H,I]=V.useState(!1),[ee,L]=V.useState(!1),G=ht(),{zIndex:R,sourceX:$,sourceY:Z,targetX:J,targetY:j,sourcePosition:U,targetPosition:P}=Ie(V.useCallback(xe=>{const pe=xe.nodeLookup.get(E.source),_e=xe.nodeLookup.get(E.target);if(!pe||!_e)return{zIndex:E.zIndex,...Rv};const Me=KT({id:e,sourceNode:pe,targetNode:_e,sourceHandle:E.sourceHandle||null,targetHandle:E.targetHandle||null,connectionMode:xe.connectionMode,onError:_});return{zIndex:YT({selected:E.selected,zIndex:E.zIndex,sourceNode:pe,targetNode:_e,elevateOnSelect:xe.elevateEdgesOnSelect,zIndexMode:xe.zIndexMode}),...Me||Rv}},[E.source,E.target,E.sourceHandle,E.targetHandle,E.selected,E.zIndex]),dt),N=V.useMemo(()=>E.markerStart?`url('#${Tp(E.markerStart,w)}')`:void 0,[E.markerStart,w]),Y=V.useMemo(()=>E.markerEnd?`url('#${Tp(E.markerEnd,w)}')`:void 0,[E.markerEnd,w]);if(E.hidden||$===null||Z===null||J===null||j===null)return null;const F=xe=>{var Ce;const{addSelectedEdges:pe,unselectNodesAndEdges:_e,multiSelectionActive:Me}=G.getState();D&&(G.setState({nodesSelectionActive:!1}),E.selected&&Me?(_e({nodes:[],edges:[E]}),(Ce=X.current)==null||Ce.blur()):pe([e])),o&&o(xe,E)},K=s?xe=>{s(xe,{...E})}:void 0,ne=u?xe=>{u(xe,{...E})}:void 0,re=f?xe=>{f(xe,{...E})}:void 0,se=d?xe=>{d(xe,{...E})}:void 0,ye=h?xe=>{h(xe,{...E})}:void 0,ve=xe=>{var pe;if(!z&&Nw.includes(xe.key)&&D){const{unselectNodesAndEdges:_e,addSelectedEdges:Me}=G.getState();xe.key==="Escape"?((pe=X.current)==null||pe.blur(),_e({edges:[E]})):Me([e])}};return b.jsx("svg",{style:{zIndex:R},children:b.jsxs("g",{className:Tt(["react-flow__edge",`react-flow__edge-${B}`,E.className,S,{selected:E.selected,animated:E.animated,inactive:!D&&!o,updating:H,selectable:D}]),onClick:F,onDoubleClick:K,onContextMenu:ne,onMouseEnter:re,onMouseMove:se,onMouseLeave:ye,onKeyDown:q?ve:void 0,tabIndex:q?0:void 0,role:E.ariaRole??(q?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":E.ariaLabel===null?void 0:E.ariaLabel||`Edge from ${E.source} to ${E.target}`,"aria-describedby":q?`${nS}-${w}`:void 0,ref:X,...E.domAttributes,children:[!ee&&b.jsx(T,{id:e,source:E.source,target:E.target,type:E.type,selected:E.selected,animated:E.animated,selectable:D,deletable:E.deletable??!0,label:E.label,labelStyle:E.labelStyle,labelShowBg:E.labelShowBg,labelBgStyle:E.labelBgStyle,labelBgPadding:E.labelBgPadding,labelBgBorderRadius:E.labelBgBorderRadius,sourceX:$,sourceY:Z,targetX:J,targetY:j,sourcePosition:U,targetPosition:P,data:E.data,style:E.style,sourceHandleId:E.sourceHandle,targetHandleId:E.targetHandle,markerStart:N,markerEnd:Y,pathOptions:"pathOptions"in E?E.pathOptions:void 0,interactionWidth:E.interactionWidth}),M&&b.jsx(aM,{edge:E,isReconnectable:M,reconnectRadius:m,onReconnect:p,onReconnectStart:y,onReconnectEnd:v,sourceX:$,sourceY:Z,targetX:J,targetY:j,sourcePosition:U,targetPosition:P,setUpdateHover:I,setReconnecting:L})]})})}var sM=V.memo(oM);const uM=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function TS({defaultMarkerColor:e,onlyRenderVisibleElements:n,rfId:i,edgeTypes:l,noPanClassName:o,onReconnect:s,onEdgeContextMenu:u,onEdgeMouseEnter:f,onEdgeMouseMove:d,onEdgeMouseLeave:h,onEdgeClick:m,reconnectRadius:p,onEdgeDoubleClick:y,onReconnectStart:v,onReconnectEnd:w,disableKeyboardA11y:k}){const{edgesFocusable:S,edgesReconnectable:_,elementsSelectable:z,onError:E}=Ie(uM,dt),A=PA(n);return b.jsxs("div",{className:"react-flow__edges",children:[b.jsx(JA,{defaultColor:e,rfId:i}),A.map(B=>b.jsx(sM,{id:B,edgesFocusable:S,edgesReconnectable:_,elementsSelectable:z,noPanClassName:o,onReconnect:s,onContextMenu:u,onMouseEnter:f,onMouseMove:d,onMouseLeave:h,onClick:m,reconnectRadius:p,onDoubleClick:y,onReconnectStart:v,onReconnectEnd:w,rfId:i,onError:E,edgeTypes:l,disableKeyboardA11y:k},B))]})}TS.displayName="EdgeRenderer";const cM=V.memo(TS),fM=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function dM({children:e}){const n=Ie(fM);return b.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:e})}function hM(e){const n=$o(),i=V.useRef(!1);V.useEffect(()=>{!i.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),i.current=!0)},[e,n.viewportInitialized])}const pM=e=>{var n;return(n=e.panZoom)==null?void 0:n.syncViewport};function mM(e){const n=Ie(pM),i=ht();return V.useEffect(()=>{e&&(n==null||n(e),i.setState({transform:[e.x,e.y,e.zoom]}))},[e,n]),null}function gM(e){return e.connection.inProgress?{...e.connection,to:Go(e.connection.to,e.transform)}:{...e.connection}}function yM(e){return gM}function xM(e){const n=yM();return Ie(n,dt)}const vM=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function bM({containerStyle:e,style:n,type:i,component:l}){const{nodesConnectable:o,width:s,height:u,isValid:f,inProgress:d}=Ie(vM,dt);return!(s&&o&&d)?null:b.jsx("svg",{style:e,width:s,height:u,className:"react-flow__connectionline react-flow__container",children:b.jsx("g",{className:Tt(["react-flow__connection",Tw(f)]),children:b.jsx(zS,{style:n,type:i,CustomComponent:l,isValid:f})})})}const zS=({style:e,type:n=fi.Bezier,CustomComponent:i,isValid:l})=>{const{inProgress:o,from:s,fromNode:u,fromHandle:f,fromPosition:d,to:h,toNode:m,toHandle:p,toPosition:y,pointer:v}=xM();if(!o)return;if(i)return b.jsx(i,{connectionLineType:n,connectionLineStyle:e,fromNode:u,fromHandle:f,fromX:s.x,fromY:s.y,toX:h.x,toY:h.y,fromPosition:d,toPosition:y,connectionStatus:Tw(l),toNode:m,toHandle:p,pointer:v});let w="";const k={sourceX:s.x,sourceY:s.y,sourcePosition:d,targetX:h.x,targetY:h.y,targetPosition:y};switch(n){case fi.Bezier:[w]=im(k);break;case fi.SimpleBezier:[w]=gS(k);break;case fi.Step:[w]=Cp({...k,borderRadius:0});break;case fi.SmoothStep:[w]=Cp(k);break;default:[w]=Iw(k)}return b.jsx("path",{d:w,fill:"none",className:"react-flow__connection-path",style:e})};zS.displayName="ConnectionLine";const wM={};function Hv(e=wM){V.useRef(e),ht(),V.useEffect(()=>{},[e])}function SM(){ht(),V.useRef(!1),V.useEffect(()=>{},[])}function AS({nodeTypes:e,edgeTypes:n,onInit:i,onNodeClick:l,onEdgeClick:o,onNodeDoubleClick:s,onEdgeDoubleClick:u,onNodeMouseEnter:f,onNodeMouseMove:d,onNodeMouseLeave:h,onNodeContextMenu:m,onSelectionContextMenu:p,onSelectionStart:y,onSelectionEnd:v,connectionLineType:w,connectionLineStyle:k,connectionLineComponent:S,connectionLineContainerStyle:_,selectionKeyCode:z,selectionOnDrag:E,selectionMode:A,multiSelectionKeyCode:B,panActivationKeyCode:T,zoomActivationKeyCode:q,deleteKeyCode:M,onlyRenderVisibleElements:D,elementsSelectable:X,defaultViewport:H,translateExtent:I,minZoom:ee,maxZoom:L,preventScrolling:G,defaultMarkerColor:R,zoomOnScroll:$,zoomOnPinch:Z,panOnScroll:J,panOnScrollSpeed:j,panOnScrollMode:U,zoomOnDoubleClick:P,panOnDrag:N,onPaneClick:Y,onPaneMouseEnter:F,onPaneMouseMove:K,onPaneMouseLeave:ne,onPaneScroll:re,onPaneContextMenu:se,paneClickDistance:ye,nodeClickDistance:ve,onEdgeContextMenu:xe,onEdgeMouseEnter:pe,onEdgeMouseMove:_e,onEdgeMouseLeave:Me,reconnectRadius:Ce,onReconnect:st,onReconnectStart:We,onReconnectEnd:zt,noDragClassName:Ut,noWheelClassName:Rt,noPanClassName:wn,disableKeyboardA11y:Mn,nodeExtent:At,rfId:Mr,viewport:ue,onViewportChange:ge}){return Hv(e),Hv(n),SM(),hM(i),mM(ue),b.jsx(HA,{onPaneClick:Y,onPaneMouseEnter:F,onPaneMouseMove:K,onPaneMouseLeave:ne,onPaneContextMenu:se,onPaneScroll:re,paneClickDistance:ye,deleteKeyCode:M,selectionKeyCode:z,selectionOnDrag:E,selectionMode:A,onSelectionStart:y,onSelectionEnd:v,multiSelectionKeyCode:B,panActivationKeyCode:T,zoomActivationKeyCode:q,elementsSelectable:X,zoomOnScroll:$,zoomOnPinch:Z,zoomOnDoubleClick:P,panOnScroll:J,panOnScrollSpeed:j,panOnScrollMode:U,panOnDrag:N,defaultViewport:H,translateExtent:I,minZoom:ee,maxZoom:L,onSelectionContextMenu:p,preventScrolling:G,noDragClassName:Ut,noWheelClassName:Rt,noPanClassName:wn,disableKeyboardA11y:Mn,onViewportChange:ge,isControlledViewport:!!ue,children:b.jsxs(dM,{children:[b.jsx(cM,{edgeTypes:n,onEdgeClick:o,onEdgeDoubleClick:u,onReconnect:st,onReconnectStart:We,onReconnectEnd:zt,onlyRenderVisibleElements:D,onEdgeContextMenu:xe,onEdgeMouseEnter:pe,onEdgeMouseMove:_e,onEdgeMouseLeave:Me,reconnectRadius:Ce,defaultMarkerColor:R,noPanClassName:wn,disableKeyboardA11y:Mn,rfId:Mr}),b.jsx(bM,{style:k,type:w,component:S,containerStyle:_}),b.jsx("div",{className:"react-flow__edgelabel-renderer"}),b.jsx(XA,{nodeTypes:e,onNodeClick:l,onNodeDoubleClick:s,onNodeMouseEnter:f,onNodeMouseMove:d,onNodeMouseLeave:h,onNodeContextMenu:m,nodeClickDistance:ve,onlyRenderVisibleElements:D,noPanClassName:wn,noDragClassName:Ut,disableKeyboardA11y:Mn,nodeExtent:At,rfId:Mr}),b.jsx("div",{className:"react-flow__viewport-portal"})]})})}AS.displayName="GraphView";const _M=V.memo(AS),Bv=({nodes:e,edges:n,defaultNodes:i,defaultEdges:l,width:o,height:s,fitView:u,fitViewOptions:f,minZoom:d=.5,maxZoom:h=2,nodeOrigin:m,nodeExtent:p,zIndexMode:y="basic"}={})=>{const v=new Map,w=new Map,k=new Map,S=new Map,_=l??n??[],z=i??e??[],E=m??[0,0],A=p??Ao;Gw(k,S,_);const B=zp(z,v,w,{nodeOrigin:E,nodeExtent:A,zIndexMode:y});let T=[0,0,1];if(u&&o&&s){const q=Vo(v,{filter:H=>!!((H.width||H.initialWidth)&&(H.height||H.initialHeight))}),{x:M,y:D,zoom:X}=nm(q,o,s,d,h,(f==null?void 0:f.padding)??.1);T=[M,D,X]}return{rfId:"1",width:o??0,height:s??0,transform:T,nodes:z,nodesInitialized:B,nodeLookup:v,parentLookup:w,edges:_,edgeLookup:S,connectionLookup:k,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:i!==void 0,hasDefaultEdges:l!==void 0,panZoom:null,minZoom:d,maxZoom:h,translateExtent:Ao,nodeExtent:A,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Wl.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:E,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:u??!1,fitViewOptions:f,fitViewResolver:null,connection:{...Cw},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:HT,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:kw,zIndexMode:y,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},EM=({nodes:e,edges:n,defaultNodes:i,defaultEdges:l,width:o,height:s,fitView:u,fitViewOptions:f,minZoom:d,maxZoom:h,nodeOrigin:m,nodeExtent:p,zIndexMode:y})=>Iz((v,w)=>{async function k(){const{nodeLookup:S,panZoom:_,fitViewOptions:z,fitViewResolver:E,width:A,height:B,minZoom:T,maxZoom:q}=w();_&&(await DT({nodes:S,width:A,height:B,panZoom:_,minZoom:T,maxZoom:q},z),E==null||E.resolve(!0),v({fitViewResolver:null}))}return{...Bv({nodes:e,edges:n,width:o,height:s,fitView:u,fitViewOptions:f,minZoom:d,maxZoom:h,nodeOrigin:m,nodeExtent:p,defaultNodes:i,defaultEdges:l,zIndexMode:y}),setNodes:S=>{const{nodeLookup:_,parentLookup:z,nodeOrigin:E,elevateNodesOnSelect:A,fitViewQueued:B,zIndexMode:T}=w(),q=zp(S,_,z,{nodeOrigin:E,nodeExtent:p,elevateNodesOnSelect:A,checkEquality:!0,zIndexMode:T});B&&q?(k(),v({nodes:S,nodesInitialized:q,fitViewQueued:!1,fitViewOptions:void 0})):v({nodes:S,nodesInitialized:q})},setEdges:S=>{const{connectionLookup:_,edgeLookup:z}=w();Gw(_,z,S),v({edges:S})},setDefaultNodesAndEdges:(S,_)=>{if(S){const{setNodes:z}=w();z(S),v({hasDefaultNodes:!0})}if(_){const{setEdges:z}=w();z(_),v({hasDefaultEdges:!0})}},updateNodeInternals:S=>{const{triggerNodeChanges:_,nodeLookup:z,parentLookup:E,domNode:A,nodeOrigin:B,nodeExtent:T,debug:q,fitViewQueued:M,zIndexMode:D}=w(),{changes:X,updatedInternals:H}=lz(S,z,E,A,B,T,D);H&&(tz(z,E,{nodeOrigin:B,nodeExtent:T,zIndexMode:D}),M?(k(),v({fitViewQueued:!1,fitViewOptions:void 0})):v({}),(X==null?void 0:X.length)>0&&(q&&console.log("React Flow: trigger node changes",X),_==null||_(X)))},updateNodePositions:(S,_=!1)=>{const z=[];let E=[];const{nodeLookup:A,triggerNodeChanges:B,connection:T,updateConnection:q,onNodesChangeMiddlewareMap:M}=w();for(const[D,X]of S){const H=A.get(D),I=!!(H!=null&&H.expandParent&&(H!=null&&H.parentId)&&(X!=null&&X.position)),ee={id:D,type:"position",position:I?{x:Math.max(0,X.position.x),y:Math.max(0,X.position.y)}:X.position,dragging:_};if(H&&T.inProgress&&T.fromNode.id===H.id){const L=Xi(H,T.fromHandle,we.Left,!0);q({...T,from:L})}I&&H.parentId&&z.push({id:D,parentId:H.parentId,rect:{...X.internals.positionAbsolute,width:X.measured.width??0,height:X.measured.height??0}}),E.push(ee)}if(z.length>0){const{parentLookup:D,nodeOrigin:X}=w(),H=um(z,A,D,X);E.push(...H)}for(const D of M.values())E=D(E);B(E)},triggerNodeChanges:S=>{const{onNodesChange:_,setNodes:z,nodes:E,hasDefaultNodes:A,debug:B}=w();if(S!=null&&S.length){if(A){const T=lS(S,E);z(T)}B&&console.log("React Flow: trigger node changes",S),_==null||_(S)}},triggerEdgeChanges:S=>{const{onEdgesChange:_,setEdges:z,edges:E,hasDefaultEdges:A,debug:B}=w();if(S!=null&&S.length){if(A){const T=aS(S,E);z(T)}B&&console.log("React Flow: trigger edge changes",S),_==null||_(S)}},addSelectedNodes:S=>{const{multiSelectionActive:_,edgeLookup:z,nodeLookup:E,triggerNodeChanges:A,triggerEdgeChanges:B}=w();if(_){const T=S.map(q=>Di(q,!0));A(T);return}A(Yl(E,new Set([...S]),!0)),B(Yl(z))},addSelectedEdges:S=>{const{multiSelectionActive:_,edgeLookup:z,nodeLookup:E,triggerNodeChanges:A,triggerEdgeChanges:B}=w();if(_){const T=S.map(q=>Di(q,!0));B(T);return}B(Yl(z,new Set([...S]))),A(Yl(E,new Set,!0))},unselectNodesAndEdges:({nodes:S,edges:_}={})=>{const{edges:z,nodes:E,nodeLookup:A,triggerNodeChanges:B,triggerEdgeChanges:T}=w(),q=S||E,M=_||z,D=[];for(const H of q){if(!H.selected)continue;const I=A.get(H.id);I&&(I.selected=!1),D.push(Di(H.id,!1))}const X=[];for(const H of M)H.selected&&X.push(Di(H.id,!1));B(D),T(X)},setMinZoom:S=>{const{panZoom:_,maxZoom:z}=w();_==null||_.setScaleExtent([S,z]),v({minZoom:S})},setMaxZoom:S=>{const{panZoom:_,minZoom:z}=w();_==null||_.setScaleExtent([z,S]),v({maxZoom:S})},setTranslateExtent:S=>{var _;(_=w().panZoom)==null||_.setTranslateExtent(S),v({translateExtent:S})},resetSelectedElements:()=>{const{edges:S,nodes:_,triggerNodeChanges:z,triggerEdgeChanges:E,elementsSelectable:A}=w();if(!A)return;const B=_.reduce((q,M)=>M.selected?[...q,Di(M.id,!1)]:q,[]),T=S.reduce((q,M)=>M.selected?[...q,Di(M.id,!1)]:q,[]);z(B),E(T)},setNodeExtent:S=>{const{nodes:_,nodeLookup:z,parentLookup:E,nodeOrigin:A,elevateNodesOnSelect:B,nodeExtent:T,zIndexMode:q}=w();S[0][0]===T[0][0]&&S[0][1]===T[0][1]&&S[1][0]===T[1][0]&&S[1][1]===T[1][1]||(zp(_,z,E,{nodeOrigin:A,nodeExtent:S,elevateNodesOnSelect:B,checkEquality:!1,zIndexMode:q}),v({nodeExtent:S}))},panBy:S=>{const{transform:_,width:z,height:E,panZoom:A,translateExtent:B}=w();return az({delta:S,panZoom:A,transform:_,translateExtent:B,width:z,height:E})},setCenter:async(S,_,z)=>{const{width:E,height:A,maxZoom:B,panZoom:T}=w();if(!T)return Promise.resolve(!1);const q=typeof(z==null?void 0:z.zoom)<"u"?z.zoom:B;return await T.setViewport({x:E/2-S*q,y:A/2-_*q,zoom:q},{duration:z==null?void 0:z.duration,ease:z==null?void 0:z.ease,interpolate:z==null?void 0:z.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{v({connection:{...Cw}})},updateConnection:S=>{v({connection:S})},reset:()=>v({...Bv()})}},Object.is);function NM({initialNodes:e,initialEdges:n,defaultNodes:i,defaultEdges:l,initialWidth:o,initialHeight:s,initialMinZoom:u,initialMaxZoom:f,initialFitViewOptions:d,fitView:h,nodeOrigin:m,nodeExtent:p,zIndexMode:y,children:v}){const[w]=V.useState(()=>EM({nodes:e,edges:n,defaultNodes:i,defaultEdges:l,width:o,height:s,fitView:h,minZoom:u,maxZoom:f,fitViewOptions:d,nodeOrigin:m,nodeExtent:p,zIndexMode:y}));return b.jsx(Yz,{value:w,children:b.jsx(dA,{children:v})})}function kM({children:e,nodes:n,edges:i,defaultNodes:l,defaultEdges:o,width:s,height:u,fitView:f,fitViewOptions:d,minZoom:h,maxZoom:m,nodeOrigin:p,nodeExtent:y,zIndexMode:v}){return V.useContext(xc)?b.jsx(b.Fragment,{children:e}):b.jsx(NM,{initialNodes:n,initialEdges:i,defaultNodes:l,defaultEdges:o,initialWidth:s,initialHeight:u,fitView:f,initialFitViewOptions:d,initialMinZoom:h,initialMaxZoom:m,nodeOrigin:p,nodeExtent:y,zIndexMode:v,children:e})}const CM={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function TM({nodes:e,edges:n,defaultNodes:i,defaultEdges:l,className:o,nodeTypes:s,edgeTypes:u,onNodeClick:f,onEdgeClick:d,onInit:h,onMove:m,onMoveStart:p,onMoveEnd:y,onConnect:v,onConnectStart:w,onConnectEnd:k,onClickConnectStart:S,onClickConnectEnd:_,onNodeMouseEnter:z,onNodeMouseMove:E,onNodeMouseLeave:A,onNodeContextMenu:B,onNodeDoubleClick:T,onNodeDragStart:q,onNodeDrag:M,onNodeDragStop:D,onNodesDelete:X,onEdgesDelete:H,onDelete:I,onSelectionChange:ee,onSelectionDragStart:L,onSelectionDrag:G,onSelectionDragStop:R,onSelectionContextMenu:$,onSelectionStart:Z,onSelectionEnd:J,onBeforeDelete:j,connectionMode:U,connectionLineType:P=fi.Bezier,connectionLineStyle:N,connectionLineComponent:Y,connectionLineContainerStyle:F,deleteKeyCode:K="Backspace",selectionKeyCode:ne="Shift",selectionOnDrag:re=!1,selectionMode:se=Mo.Full,panActivationKeyCode:ye="Space",multiSelectionKeyCode:ve=Oo()?"Meta":"Control",zoomActivationKeyCode:xe=Oo()?"Meta":"Control",snapToGrid:pe,snapGrid:_e,onlyRenderVisibleElements:Me=!1,selectNodesOnDrag:Ce,nodesDraggable:st,autoPanOnNodeFocus:We,nodesConnectable:zt,nodesFocusable:Ut,nodeOrigin:Rt=rS,edgesFocusable:wn,edgesReconnectable:Mn,elementsSelectable:At=!0,defaultViewport:Mr=nA,minZoom:ue=.5,maxZoom:ge=2,translateExtent:Ne=Ao,preventScrolling:De=!0,nodeExtent:Ve,defaultMarkerColor:$t="#b1b1b7",zoomOnScroll:jn=!0,zoomOnPinch:Dt=!0,panOnScroll:yt=!1,panOnScrollSpeed:It=.5,panOnScrollMode:Ze=Ii.Free,zoomOnDoubleClick:Gn=!0,panOnDrag:sn=!0,onPaneClick:Ec,onPaneMouseEnter:Zi,onPaneMouseMove:Ki,onPaneMouseLeave:Ji,onPaneScroll:ir,onPaneContextMenu:Wi,paneClickDistance:hi=1,nodeClickDistance:Nc=0,children:Qo,onReconnect:sa,onReconnectStart:pi,onReconnectEnd:kc,onEdgeContextMenu:Zo,onEdgeDoubleClick:Ko,onEdgeMouseEnter:Jo,onEdgeMouseMove:ua,onEdgeMouseLeave:ca,reconnectRadius:Wo=10,onNodesChange:es,onEdgesChange:$n,noDragClassName:Mt="nodrag",noWheelClassName:Vt="nowheel",noPanClassName:lr="nopan",fitView:el,fitViewOptions:ts,connectOnClick:Cc,attributionPosition:ns,proOptions:mi,defaultEdgeOptions:fa,elevateNodesOnSelect:jr=!0,elevateEdgesOnSelect:Or=!1,disableKeyboardA11y:Rr=!1,autoPanOnConnect:Dr,autoPanOnNodeDrag:bt,autoPanSpeed:rs,connectionRadius:is,isValidConnection:ar,onError:Lr,style:Tc,id:da,nodeDragThreshold:ls,connectionDragThreshold:zc,viewport:tl,onViewportChange:nl,width:On,height:Pt,colorMode:as="light",debug:Ac,onScroll:Hr,ariaLabelConfig:os,zIndexMode:gi="basic",...Mc},Ft){const yi=da||"1",ss=aA(as),ha=V.useCallback(or=>{or.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Hr==null||Hr(or)},[Hr]);return b.jsx("div",{"data-testid":"rf__wrapper",...Mc,onScroll:ha,style:{...Tc,...CM},ref:Ft,className:Tt(["react-flow",o,ss]),id:da,role:"application",children:b.jsxs(kM,{nodes:e,edges:n,width:On,height:Pt,fitView:el,fitViewOptions:ts,minZoom:ue,maxZoom:ge,nodeOrigin:Rt,nodeExtent:Ve,zIndexMode:gi,children:[b.jsx(_M,{onInit:h,onNodeClick:f,onEdgeClick:d,onNodeMouseEnter:z,onNodeMouseMove:E,onNodeMouseLeave:A,onNodeContextMenu:B,onNodeDoubleClick:T,nodeTypes:s,edgeTypes:u,connectionLineType:P,connectionLineStyle:N,connectionLineComponent:Y,connectionLineContainerStyle:F,selectionKeyCode:ne,selectionOnDrag:re,selectionMode:se,deleteKeyCode:K,multiSelectionKeyCode:ve,panActivationKeyCode:ye,zoomActivationKeyCode:xe,onlyRenderVisibleElements:Me,defaultViewport:Mr,translateExtent:Ne,minZoom:ue,maxZoom:ge,preventScrolling:De,zoomOnScroll:jn,zoomOnPinch:Dt,zoomOnDoubleClick:Gn,panOnScroll:yt,panOnScrollSpeed:It,panOnScrollMode:Ze,panOnDrag:sn,onPaneClick:Ec,onPaneMouseEnter:Zi,onPaneMouseMove:Ki,onPaneMouseLeave:Ji,onPaneScroll:ir,onPaneContextMenu:Wi,paneClickDistance:hi,nodeClickDistance:Nc,onSelectionContextMenu:$,onSelectionStart:Z,onSelectionEnd:J,onReconnect:sa,onReconnectStart:pi,onReconnectEnd:kc,onEdgeContextMenu:Zo,onEdgeDoubleClick:Ko,onEdgeMouseEnter:Jo,onEdgeMouseMove:ua,onEdgeMouseLeave:ca,reconnectRadius:Wo,defaultMarkerColor:$t,noDragClassName:Mt,noWheelClassName:Vt,noPanClassName:lr,rfId:yi,disableKeyboardA11y:Rr,nodeExtent:Ve,viewport:tl,onViewportChange:nl}),b.jsx(lA,{nodes:e,edges:n,defaultNodes:i,defaultEdges:l,onConnect:v,onConnectStart:w,onConnectEnd:k,onClickConnectStart:S,onClickConnectEnd:_,nodesDraggable:st,autoPanOnNodeFocus:We,nodesConnectable:zt,nodesFocusable:Ut,edgesFocusable:wn,edgesReconnectable:Mn,elementsSelectable:At,elevateNodesOnSelect:jr,elevateEdgesOnSelect:Or,minZoom:ue,maxZoom:ge,nodeExtent:Ve,onNodesChange:es,onEdgesChange:$n,snapToGrid:pe,snapGrid:_e,connectionMode:U,translateExtent:Ne,connectOnClick:Cc,defaultEdgeOptions:fa,fitView:el,fitViewOptions:ts,onNodesDelete:X,onEdgesDelete:H,onDelete:I,onNodeDragStart:q,onNodeDrag:M,onNodeDragStop:D,onSelectionDrag:G,onSelectionDragStart:L,onSelectionDragStop:R,onMove:m,onMoveStart:p,onMoveEnd:y,noPanClassName:lr,nodeOrigin:Rt,rfId:yi,autoPanOnConnect:Dr,autoPanOnNodeDrag:bt,autoPanSpeed:rs,onError:Lr,connectionRadius:is,isValidConnection:ar,selectNodesOnDrag:Ce,nodeDragThreshold:ls,connectionDragThreshold:zc,onBeforeDelete:j,debug:Ac,ariaLabelConfig:os,zIndexMode:gi}),b.jsx(tA,{onSelectionChange:ee}),Qo,b.jsx(Zz,{proOptions:mi,position:ns}),b.jsx(Qz,{rfId:yi,disableKeyboardA11y:Rr})]})})}var zM=oS(TM);const AM=e=>{var n;return(n=e.domNode)==null?void 0:n.querySelector(".react-flow__edgelabel-renderer")};function MM({children:e}){const n=Ie(AM);return n?Vz.createPortal(e,n):null}function jM(e){const[n,i]=V.useState(e),l=V.useCallback(o=>i(s=>lS(o,s)),[]);return[n,i,l]}function OM(e){const[n,i]=V.useState(e),l=V.useCallback(o=>i(s=>aS(o,s)),[]);return[n,i,l]}function RM({dimensions:e,lineWidth:n,variant:i,className:l}){return b.jsx("path",{strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Tt(["react-flow__background-pattern",i,l])})}function DM({radius:e,className:n}){return b.jsx("circle",{cx:e,cy:e,r:e,className:Tt(["react-flow__background-pattern","dots",n])})}var Tr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Tr||(Tr={}));const LM={[Tr.Dots]:1,[Tr.Lines]:1,[Tr.Cross]:6},HM=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function MS({id:e,variant:n=Tr.Dots,gap:i=20,size:l,lineWidth:o=1,offset:s=0,color:u,bgColor:f,style:d,className:h,patternClassName:m}){const p=V.useRef(null),{transform:y,patternId:v}=Ie(HM,dt),w=l||LM[n],k=n===Tr.Dots,S=n===Tr.Cross,_=Array.isArray(i)?i:[i,i],z=[_[0]*y[2]||1,_[1]*y[2]||1],E=w*y[2],A=Array.isArray(s)?s:[s,s],B=S?[E,E]:z,T=[A[0]*y[2]||1+B[0]/2,A[1]*y[2]||1+B[1]/2],q=`${v}${e||""}`;return b.jsxs("svg",{className:Tt(["react-flow__background",h]),style:{...d,...bc,"--xy-background-color-props":f,"--xy-background-pattern-color-props":u},ref:p,"data-testid":"rf__background",children:[b.jsx("pattern",{id:q,x:y[0]%z[0],y:y[1]%z[1],width:z[0],height:z[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`,children:k?b.jsx(DM,{radius:E/2,className:m}):b.jsx(RM,{dimensions:B,lineWidth:o,variant:n,className:m})}),b.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${q})`})]})}MS.displayName="Background";const BM=V.memo(MS);function qM(){return b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:b.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function UM(){return b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:b.jsx("path",{d:"M0 0h32v4.2H0z"})})}function IM(){return b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:b.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function VM(){return b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:b.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function YM(){return b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:b.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Mu({children:e,className:n,...i}){return b.jsx("button",{type:"button",className:Tt(["react-flow__controls-button",n]),...i,children:e})}const GM=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function jS({style:e,showZoom:n=!0,showFitView:i=!0,showInteractive:l=!0,fitViewOptions:o,onZoomIn:s,onZoomOut:u,onFitView:f,onInteractiveChange:d,className:h,children:m,position:p="bottom-left",orientation:y="vertical","aria-label":v}){const w=ht(),{isInteractive:k,minZoomReached:S,maxZoomReached:_,ariaLabelConfig:z}=Ie(GM,dt),{zoomIn:E,zoomOut:A,fitView:B}=$o(),T=()=>{E(),s==null||s()},q=()=>{A(),u==null||u()},M=()=>{B(o),f==null||f()},D=()=>{w.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),d==null||d(!k)},X=y==="horizontal"?"horizontal":"vertical";return b.jsxs(vc,{className:Tt(["react-flow__controls",X,h]),position:p,style:e,"data-testid":"rf__controls","aria-label":v??z["controls.ariaLabel"],children:[n&&b.jsxs(b.Fragment,{children:[b.jsx(Mu,{onClick:T,className:"react-flow__controls-zoomin",title:z["controls.zoomIn.ariaLabel"],"aria-label":z["controls.zoomIn.ariaLabel"],disabled:_,children:b.jsx(qM,{})}),b.jsx(Mu,{onClick:q,className:"react-flow__controls-zoomout",title:z["controls.zoomOut.ariaLabel"],"aria-label":z["controls.zoomOut.ariaLabel"],disabled:S,children:b.jsx(UM,{})})]}),i&&b.jsx(Mu,{className:"react-flow__controls-fitview",onClick:M,title:z["controls.fitView.ariaLabel"],"aria-label":z["controls.fitView.ariaLabel"],children:b.jsx(IM,{})}),l&&b.jsx(Mu,{className:"react-flow__controls-interactive",onClick:D,title:z["controls.interactive.ariaLabel"],"aria-label":z["controls.interactive.ariaLabel"],children:k?b.jsx(YM,{}):b.jsx(VM,{})}),m]})}jS.displayName="Controls";const $M=V.memo(jS);function XM({id:e,x:n,y:i,width:l,height:o,style:s,color:u,strokeColor:f,strokeWidth:d,className:h,borderRadius:m,shapeRendering:p,selected:y,onClick:v}){const{background:w,backgroundColor:k}=s||{},S=u||w||k;return b.jsx("rect",{className:Tt(["react-flow__minimap-node",{selected:y},h]),x:n,y:i,rx:m,ry:m,width:l,height:o,style:{fill:S,stroke:f,strokeWidth:d},shapeRendering:p,onClick:v?_=>v(_,e):void 0})}const PM=V.memo(XM),FM=e=>e.nodes.map(n=>n.id),ah=e=>e instanceof Function?e:()=>e;function QM({nodeStrokeColor:e,nodeColor:n,nodeClassName:i="",nodeBorderRadius:l=5,nodeStrokeWidth:o,nodeComponent:s=PM,onClick:u}){const f=Ie(FM,dt),d=ah(n),h=ah(e),m=ah(i),p=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return b.jsx(b.Fragment,{children:f.map(y=>b.jsx(KM,{id:y,nodeColorFunc:d,nodeStrokeColorFunc:h,nodeClassNameFunc:m,nodeBorderRadius:l,nodeStrokeWidth:o,NodeComponent:s,onClick:u,shapeRendering:p},y))})}function ZM({id:e,nodeColorFunc:n,nodeStrokeColorFunc:i,nodeClassNameFunc:l,nodeBorderRadius:o,nodeStrokeWidth:s,shapeRendering:u,NodeComponent:f,onClick:d}){const{node:h,x:m,y:p,width:y,height:v}=Ie(w=>{const k=w.nodeLookup.get(e);if(!k)return{node:void 0,x:0,y:0,width:0,height:0};const S=k.internals.userNode,{x:_,y:z}=k.internals.positionAbsolute,{width:E,height:A}=Ar(S);return{node:S,x:_,y:z,width:E,height:A}},dt);return!h||h.hidden||!Rw(h)?null:b.jsx(f,{x:m,y:p,width:y,height:v,style:h.style,selected:!!h.selected,className:l(h),color:n(h),borderRadius:o,strokeColor:i(h),strokeWidth:s,shapeRendering:u,onClick:d,id:h.id})}const KM=V.memo(ZM);var JM=V.memo(QM);const WM=200,ej=150,tj=e=>!e.hidden,nj=e=>{const n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:e.nodeLookup.size>0?Ow(Vo(e.nodeLookup,{filter:tj}),n):n,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},rj="react-flow__minimap-desc";function OS({style:e,className:n,nodeStrokeColor:i,nodeColor:l,nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:u,nodeComponent:f,bgColor:d,maskColor:h,maskStrokeColor:m,maskStrokeWidth:p,position:y="bottom-right",onClick:v,onNodeClick:w,pannable:k=!1,zoomable:S=!1,ariaLabel:_,inversePan:z,zoomStep:E=1,offsetScale:A=5}){const B=ht(),T=V.useRef(null),{boundingRect:q,viewBB:M,rfId:D,panZoom:X,translateExtent:H,flowWidth:I,flowHeight:ee,ariaLabelConfig:L}=Ie(nj,dt),G=(e==null?void 0:e.width)??WM,R=(e==null?void 0:e.height)??ej,$=q.width/G,Z=q.height/R,J=Math.max($,Z),j=J*G,U=J*R,P=A*J,N=q.x-(j-q.width)/2-P,Y=q.y-(U-q.height)/2-P,F=j+P*2,K=U+P*2,ne=`${rj}-${D}`,re=V.useRef(0),se=V.useRef();re.current=J,V.useEffect(()=>{if(T.current&&X)return se.current=mz({domNode:T.current,panZoom:X,getTransform:()=>B.getState().transform,getViewScale:()=>re.current}),()=>{var pe;(pe=se.current)==null||pe.destroy()}},[X]),V.useEffect(()=>{var pe;(pe=se.current)==null||pe.update({translateExtent:H,width:I,height:ee,inversePan:z,pannable:k,zoomStep:E,zoomable:S})},[k,S,z,E,H,I,ee]);const ye=v?pe=>{var Ce;const[_e,Me]=((Ce=se.current)==null?void 0:Ce.pointer(pe))||[0,0];v(pe,{x:_e,y:Me})}:void 0,ve=w?V.useCallback((pe,_e)=>{const Me=B.getState().nodeLookup.get(_e).internals.userNode;w(pe,Me)},[]):void 0,xe=_??L["minimap.ariaLabel"];return b.jsx(vc,{position:y,style:{...e,"--xy-minimap-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-background-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-stroke-color-props":typeof m=="string"?m:void 0,"--xy-minimap-mask-stroke-width-props":typeof p=="number"?p*J:void 0,"--xy-minimap-node-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-node-stroke-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-width-props":typeof u=="number"?u:void 0},className:Tt(["react-flow__minimap",n]),"data-testid":"rf__minimap",children:b.jsxs("svg",{width:G,height:R,viewBox:`${N} ${Y} ${F} ${K}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ne,ref:T,onClick:ye,children:[xe&&b.jsx("title",{id:ne,children:xe}),b.jsx(JM,{onClick:ve,nodeColor:l,nodeStrokeColor:i,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:u,nodeComponent:f}),b.jsx("path",{className:"react-flow__minimap-mask",d:`M${N-P},${Y-P}h${F+P*2}v${K+P*2}h${-F-P*2}z - M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}OS.displayName="MiniMap";const ij=V.memo(OS),lj=e=>n=>e?`${Math.max(1/n.transform[2],1)}`:void 0,aj={[ra.Line]:"right",[ra.Handle]:"bottom-right"};function oj({nodeId:e,position:n,variant:i=ra.Handle,className:l,style:o=void 0,children:s,color:u,minWidth:f=10,minHeight:d=10,maxWidth:h=Number.MAX_VALUE,maxHeight:m=Number.MAX_VALUE,keepAspectRatio:p=!1,resizeDirection:y,autoScale:v=!0,shouldResize:w,onResizeStart:k,onResize:S,onResizeEnd:_}){const z=fS(),E=typeof e=="string"?e:z,A=ht(),B=V.useRef(null),T=i===ra.Handle,q=Ie(V.useCallback(lj(T&&v),[T,v]),dt),M=V.useRef(null),D=n??aj[i];V.useEffect(()=>{if(!(!B.current||!E))return M.current||(M.current=zz({domNode:B.current,nodeId:E,getStoreItems:()=>{const{nodeLookup:H,transform:I,snapGrid:ee,snapToGrid:L,nodeOrigin:G,domNode:R}=A.getState();return{nodeLookup:H,transform:I,snapGrid:ee,snapToGrid:L,nodeOrigin:G,paneDomNode:R}},onChange:(H,I)=>{const{triggerNodeChanges:ee,nodeLookup:L,parentLookup:G,nodeOrigin:R}=A.getState(),$=[],Z={x:H.x,y:H.y},J=L.get(E);if(J&&J.expandParent&&J.parentId){const j=J.origin??R,U=H.width??J.measured.width??0,P=H.height??J.measured.height??0,N={id:J.id,parentId:J.parentId,rect:{width:U,height:P,...Dw({x:H.x??J.position.x,y:H.y??J.position.y},{width:U,height:P},J.parentId,L,j)}},Y=um([N],L,G,R);$.push(...Y),Z.x=H.x?Math.max(j[0]*U,H.x):void 0,Z.y=H.y?Math.max(j[1]*P,H.y):void 0}if(Z.x!==void 0&&Z.y!==void 0){const j={id:E,type:"position",position:{...Z}};$.push(j)}if(H.width!==void 0&&H.height!==void 0){const U={id:E,type:"dimensions",resizing:!0,setAttributes:y?y==="horizontal"?"width":"height":!0,dimensions:{width:H.width,height:H.height}};$.push(U)}for(const j of I){const U={...j,type:"position"};$.push(U)}ee($)},onEnd:({width:H,height:I})=>{const ee={id:E,type:"dimensions",resizing:!1,dimensions:{width:H,height:I}};A.getState().triggerNodeChanges([ee])}})),M.current.update({controlPosition:D,boundaries:{minWidth:f,minHeight:d,maxWidth:h,maxHeight:m},keepAspectRatio:p,resizeDirection:y,onResizeStart:k,onResize:S,onResizeEnd:_,shouldResize:w}),()=>{var H;(H=M.current)==null||H.destroy()}},[D,f,d,h,m,p,k,S,_,w]);const X=D.split("-");return b.jsx("div",{className:Tt(["react-flow__resize-control","nodrag",...X,i,l]),ref:B,style:{...o,scale:q,...u&&{[T?"backgroundColor":"borderColor"]:u}},children:s})}V.memo(oj);var oh,qv;function fm(){if(qv)return oh;qv=1;var e="\0",n="\0",i="";class l{constructor(m){Nt(this,"_isDirected",!0);Nt(this,"_isMultigraph",!1);Nt(this,"_isCompound",!1);Nt(this,"_label");Nt(this,"_defaultNodeLabelFn",()=>{});Nt(this,"_defaultEdgeLabelFn",()=>{});Nt(this,"_nodes",{});Nt(this,"_in",{});Nt(this,"_preds",{});Nt(this,"_out",{});Nt(this,"_sucs",{});Nt(this,"_edgeObjs",{});Nt(this,"_edgeLabels",{});Nt(this,"_nodeCount",0);Nt(this,"_edgeCount",0);Nt(this,"_parent");Nt(this,"_children");m&&(this._isDirected=Object.hasOwn(m,"directed")?m.directed:!0,this._isMultigraph=Object.hasOwn(m,"multigraph")?m.multigraph:!1,this._isCompound=Object.hasOwn(m,"compound")?m.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[n]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(m){return this._label=m,this}graph(){return this._label}setDefaultNodeLabel(m){return this._defaultNodeLabelFn=m,typeof m!="function"&&(this._defaultNodeLabelFn=()=>m),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var m=this;return this.nodes().filter(p=>Object.keys(m._in[p]).length===0)}sinks(){var m=this;return this.nodes().filter(p=>Object.keys(m._out[p]).length===0)}setNodes(m,p){var y=arguments,v=this;return m.forEach(function(w){y.length>1?v.setNode(w,p):v.setNode(w)}),this}setNode(m,p){return Object.hasOwn(this._nodes,m)?(arguments.length>1&&(this._nodes[m]=p),this):(this._nodes[m]=arguments.length>1?p:this._defaultNodeLabelFn(m),this._isCompound&&(this._parent[m]=n,this._children[m]={},this._children[n][m]=!0),this._in[m]={},this._preds[m]={},this._out[m]={},this._sucs[m]={},++this._nodeCount,this)}node(m){return this._nodes[m]}hasNode(m){return Object.hasOwn(this._nodes,m)}removeNode(m){var p=this;if(Object.hasOwn(this._nodes,m)){var y=v=>p.removeEdge(p._edgeObjs[v]);delete this._nodes[m],this._isCompound&&(this._removeFromParentsChildList(m),delete this._parent[m],this.children(m).forEach(function(v){p.setParent(v)}),delete this._children[m]),Object.keys(this._in[m]).forEach(y),delete this._in[m],delete this._preds[m],Object.keys(this._out[m]).forEach(y),delete this._out[m],delete this._sucs[m],--this._nodeCount}return this}setParent(m,p){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(p===void 0)p=n;else{p+="";for(var y=p;y!==void 0;y=this.parent(y))if(y===m)throw new Error("Setting "+p+" as parent of "+m+" would create a cycle");this.setNode(p)}return this.setNode(m),this._removeFromParentsChildList(m),this._parent[m]=p,this._children[p][m]=!0,this}_removeFromParentsChildList(m){delete this._children[this._parent[m]][m]}parent(m){if(this._isCompound){var p=this._parent[m];if(p!==n)return p}}children(m=n){if(this._isCompound){var p=this._children[m];if(p)return Object.keys(p)}else{if(m===n)return this.nodes();if(this.hasNode(m))return[]}}predecessors(m){var p=this._preds[m];if(p)return Object.keys(p)}successors(m){var p=this._sucs[m];if(p)return Object.keys(p)}neighbors(m){var p=this.predecessors(m);if(p){const v=new Set(p);for(var y of this.successors(m))v.add(y);return Array.from(v.values())}}isLeaf(m){var p;return this.isDirected()?p=this.successors(m):p=this.neighbors(m),p.length===0}filterNodes(m){var p=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});p.setGraph(this.graph());var y=this;Object.entries(this._nodes).forEach(function([k,S]){m(k)&&p.setNode(k,S)}),Object.values(this._edgeObjs).forEach(function(k){p.hasNode(k.v)&&p.hasNode(k.w)&&p.setEdge(k,y.edge(k))});var v={};function w(k){var S=y.parent(k);return S===void 0||p.hasNode(S)?(v[k]=S,S):S in v?v[S]:w(S)}return this._isCompound&&p.nodes().forEach(k=>p.setParent(k,w(k))),p}setDefaultEdgeLabel(m){return this._defaultEdgeLabelFn=m,typeof m!="function"&&(this._defaultEdgeLabelFn=()=>m),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(m,p){var y=this,v=arguments;return m.reduce(function(w,k){return v.length>1?y.setEdge(w,k,p):y.setEdge(w,k),k}),this}setEdge(){var m,p,y,v,w=!1,k=arguments[0];typeof k=="object"&&k!==null&&"v"in k?(m=k.v,p=k.w,y=k.name,arguments.length===2&&(v=arguments[1],w=!0)):(m=k,p=arguments[1],y=arguments[3],arguments.length>2&&(v=arguments[2],w=!0)),m=""+m,p=""+p,y!==void 0&&(y=""+y);var S=u(this._isDirected,m,p,y);if(Object.hasOwn(this._edgeLabels,S))return w&&(this._edgeLabels[S]=v),this;if(y!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(m),this.setNode(p),this._edgeLabels[S]=w?v:this._defaultEdgeLabelFn(m,p,y);var _=f(this._isDirected,m,p,y);return m=_.v,p=_.w,Object.freeze(_),this._edgeObjs[S]=_,o(this._preds[p],m),o(this._sucs[m],p),this._in[p][S]=_,this._out[m][S]=_,this._edgeCount++,this}edge(m,p,y){var v=arguments.length===1?d(this._isDirected,arguments[0]):u(this._isDirected,m,p,y);return this._edgeLabels[v]}edgeAsObj(){const m=this.edge(...arguments);return typeof m!="object"?{label:m}:m}hasEdge(m,p,y){var v=arguments.length===1?d(this._isDirected,arguments[0]):u(this._isDirected,m,p,y);return Object.hasOwn(this._edgeLabels,v)}removeEdge(m,p,y){var v=arguments.length===1?d(this._isDirected,arguments[0]):u(this._isDirected,m,p,y),w=this._edgeObjs[v];return w&&(m=w.v,p=w.w,delete this._edgeLabels[v],delete this._edgeObjs[v],s(this._preds[p],m),s(this._sucs[m],p),delete this._in[p][v],delete this._out[m][v],this._edgeCount--),this}inEdges(m,p){var y=this._in[m];if(y){var v=Object.values(y);return p?v.filter(w=>w.v===p):v}}outEdges(m,p){var y=this._out[m];if(y){var v=Object.values(y);return p?v.filter(w=>w.w===p):v}}nodeEdges(m,p){var y=this.inEdges(m,p);if(y)return y.concat(this.outEdges(m,p))}}function o(h,m){h[m]?h[m]++:h[m]=1}function s(h,m){--h[m]||delete h[m]}function u(h,m,p,y){var v=""+m,w=""+p;if(!h&&v>w){var k=v;v=w,w=k}return v+i+w+i+(y===void 0?e:y)}function f(h,m,p,y){var v=""+m,w=""+p;if(!h&&v>w){var k=v;v=w,w=k}var S={v,w};return y&&(S.name=y),S}function d(h,m){return u(h,m.v,m.w,m.name)}return oh=l,oh}var sh,Uv;function sj(){return Uv||(Uv=1,sh="2.2.4"),sh}var uh,Iv;function uj(){return Iv||(Iv=1,uh={Graph:fm(),version:sj()}),uh}var ch,Vv;function cj(){if(Vv)return ch;Vv=1;var e=fm();ch={write:n,read:o};function n(s){var u={options:{directed:s.isDirected(),multigraph:s.isMultigraph(),compound:s.isCompound()},nodes:i(s),edges:l(s)};return s.graph()!==void 0&&(u.value=structuredClone(s.graph())),u}function i(s){return s.nodes().map(function(u){var f=s.node(u),d=s.parent(u),h={v:u};return f!==void 0&&(h.value=f),d!==void 0&&(h.parent=d),h})}function l(s){return s.edges().map(function(u){var f=s.edge(u),d={v:u.v,w:u.w};return u.name!==void 0&&(d.name=u.name),f!==void 0&&(d.value=f),d})}function o(s){var u=new e(s.options).setGraph(s.value);return s.nodes.forEach(function(f){u.setNode(f.v,f.value),f.parent&&u.setParent(f.v,f.parent)}),s.edges.forEach(function(f){u.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),u}return ch}var fh,Yv;function fj(){if(Yv)return fh;Yv=1,fh=e;function e(n){var i={},l=[],o;function s(u){Object.hasOwn(i,u)||(i[u]=!0,o.push(u),n.successors(u).forEach(s),n.predecessors(u).forEach(s))}return n.nodes().forEach(function(u){o=[],s(u),o.length&&l.push(o)}),l}return fh}var dh,Gv;function RS(){if(Gv)return dh;Gv=1;class e{constructor(){Nt(this,"_arr",[]);Nt(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(i){return i.key})}has(i){return Object.hasOwn(this._keyIndices,i)}priority(i){var l=this._keyIndices[i];if(l!==void 0)return this._arr[l].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(i,l){var o=this._keyIndices;if(i=String(i),!Object.hasOwn(o,i)){var s=this._arr,u=s.length;return o[i]=u,s.push({key:i,priority:l}),this._decrease(u),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var i=this._arr.pop();return delete this._keyIndices[i.key],this._heapify(0),i.key}decrease(i,l){var o=this._keyIndices[i];if(l>this._arr[o].priority)throw new Error("New priority is greater than current priority. Key: "+i+" Old: "+this._arr[o].priority+" New: "+l);this._arr[o].priority=l,this._decrease(o)}_heapify(i){var l=this._arr,o=2*i,s=o+1,u=i;o>1,!(l[s].priority1;function i(o,s,u,f){return l(o,String(s),u||n,f||function(d){return o.outEdges(d)})}function l(o,s,u,f){var d={},h=new e,m,p,y=function(v){var w=v.v!==m?v.v:v.w,k=d[w],S=u(v),_=p.distance+S;if(S<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+v+" Weight: "+S);_0&&(m=h.removeMin(),p=d[m],p.distance!==Number.POSITIVE_INFINITY);)f(m).forEach(y);return d}return hh}var ph,Xv;function dj(){if(Xv)return ph;Xv=1;var e=DS();ph=n;function n(i,l,o){return i.nodes().reduce(function(s,u){return s[u]=e(i,u,l,o),s},{})}return ph}var mh,Pv;function LS(){if(Pv)return mh;Pv=1,mh=e;function e(n){var i=0,l=[],o={},s=[];function u(f){var d=o[f]={onStack:!0,lowlink:i,index:i++};if(l.push(f),n.successors(f).forEach(function(p){Object.hasOwn(o,p)?o[p].onStack&&(d.lowlink=Math.min(d.lowlink,o[p].index)):(u(p),d.lowlink=Math.min(d.lowlink,o[p].lowlink))}),d.lowlink===d.index){var h=[],m;do m=l.pop(),o[m].onStack=!1,h.push(m);while(f!==m);s.push(h)}}return n.nodes().forEach(function(f){Object.hasOwn(o,f)||u(f)}),s}return mh}var gh,Fv;function hj(){if(Fv)return gh;Fv=1;var e=LS();gh=n;function n(i){return e(i).filter(function(l){return l.length>1||l.length===1&&i.hasEdge(l[0],l[0])})}return gh}var yh,Qv;function pj(){if(Qv)return yh;Qv=1,yh=n;var e=()=>1;function n(l,o,s){return i(l,o||e,s||function(u){return l.outEdges(u)})}function i(l,o,s){var u={},f=l.nodes();return f.forEach(function(d){u[d]={},u[d][d]={distance:0},f.forEach(function(h){d!==h&&(u[d][h]={distance:Number.POSITIVE_INFINITY})}),s(d).forEach(function(h){var m=h.v===d?h.w:h.v,p=o(h);u[d][m]={distance:p,predecessor:d}})}),f.forEach(function(d){var h=u[d];f.forEach(function(m){var p=u[m];f.forEach(function(y){var v=p[d],w=h[y],k=p[y],S=v.distance+w.distance;So.successors(p):p=>o.neighbors(p),d=u==="post"?n:i,h=[],m={};return s.forEach(p=>{if(!o.hasNode(p))throw new Error("Graph does not have node: "+p);d(p,f,m,h)}),h}function n(o,s,u,f){for(var d=[[o,!1]];d.length>0;){var h=d.pop();h[1]?f.push(h[0]):Object.hasOwn(u,h[0])||(u[h[0]]=!0,d.push([h[0],!0]),l(s(h[0]),m=>d.push([m,!1])))}}function i(o,s,u,f){for(var d=[o];d.length>0;){var h=d.pop();Object.hasOwn(u,h)||(u[h]=!0,f.push(h),l(s(h),m=>d.push(m)))}}function l(o,s){for(var u=o.length;u--;)s(o[u],u,o);return o}return bh}var wh,Wv;function gj(){if(Wv)return wh;Wv=1;var e=BS();wh=n;function n(i,l){return e(i,l,"post")}return wh}var Sh,e1;function yj(){if(e1)return Sh;e1=1;var e=BS();Sh=n;function n(i,l){return e(i,l,"pre")}return Sh}var _h,t1;function xj(){if(t1)return _h;t1=1;var e=fm(),n=RS();_h=i;function i(l,o){var s=new e,u={},f=new n,d;function h(p){var y=p.v===d?p.w:p.v,v=f.priority(y);if(v!==void 0){var w=o(p);w0;){if(d=f.removeMin(),Object.hasOwn(u,d))s.setEdge(d,u[d]);else{if(m)throw new Error("Input graph is not connected: "+l);m=!0}l.nodeEdges(d).forEach(h)}return s}return _h}var Eh,n1;function vj(){return n1||(n1=1,Eh={components:fj(),dijkstra:DS(),dijkstraAll:dj(),findCycles:hj(),floydWarshall:pj(),isAcyclic:mj(),postorder:gj(),preorder:yj(),prim:xj(),tarjan:LS(),topsort:HS()}),Eh}var Nh,r1;function Vn(){if(r1)return Nh;r1=1;var e=uj();return Nh={Graph:e.Graph,json:cj(),alg:vj(),version:e.version},Nh}var kh,i1;function bj(){if(i1)return kh;i1=1;class e{constructor(){let o={};o._next=o._prev=o,this._sentinel=o}dequeue(){let o=this._sentinel,s=o._prev;if(s!==o)return n(s),s}enqueue(o){let s=this._sentinel;o._prev&&o._next&&n(o),o._next=s._next,s._next._prev=o,s._next=o,o._prev=s}toString(){let o=[],s=this._sentinel,u=s._prev;for(;u!==s;)o.push(JSON.stringify(u,i)),u=u._prev;return"["+o.join(", ")+"]"}}function n(l){l._prev._next=l._next,l._next._prev=l._prev,delete l._next,delete l._prev}function i(l,o){if(l!=="_next"&&l!=="_prev")return o}return kh=e,kh}var Ch,l1;function wj(){if(l1)return Ch;l1=1;let e=Vn().Graph,n=bj();Ch=l;let i=()=>1;function l(h,m){if(h.nodeCount()<=1)return[];let p=u(h,m||i);return o(p.graph,p.buckets,p.zeroIdx).flatMap(v=>h.outEdges(v.v,v.w))}function o(h,m,p){let y=[],v=m[m.length-1],w=m[0],k;for(;h.nodeCount();){for(;k=w.dequeue();)s(h,m,p,k);for(;k=v.dequeue();)s(h,m,p,k);if(h.nodeCount()){for(let S=m.length-2;S>0;--S)if(k=m[S].dequeue(),k){y=y.concat(s(h,m,p,k,!0));break}}}return y}function s(h,m,p,y,v){let w=v?[]:void 0;return h.inEdges(y.v).forEach(k=>{let S=h.edge(k),_=h.node(k.v);v&&w.push({v:k.v,w:k.w}),_.out-=S,f(m,p,_)}),h.outEdges(y.v).forEach(k=>{let S=h.edge(k),_=k.w,z=h.node(_);z.in-=S,f(m,p,z)}),h.removeNode(y.v),w}function u(h,m){let p=new e,y=0,v=0;h.nodes().forEach(S=>{p.setNode(S,{v:S,in:0,out:0})}),h.edges().forEach(S=>{let _=p.edge(S.v,S.w)||0,z=m(S),E=_+z;p.setEdge(S.v,S.w,E),v=Math.max(v,p.node(S.v).out+=z),y=Math.max(y,p.node(S.w).in+=z)});let w=d(v+y+3).map(()=>new n),k=y+1;return p.nodes().forEach(S=>{f(w,k,p.node(S))}),{graph:p,buckets:w,zeroIdx:k}}function f(h,m,p){p.out?p.in?h[p.out-p.in+m].enqueue(p):h[h.length-1].enqueue(p):h[0].enqueue(p)}function d(h){const m=[];for(let p=0;pD.setNode(X,M.node(X))),M.edges().forEach(X=>{let H=D.edge(X.v,X.w)||{weight:0,minlen:1},I=M.edge(X);D.setEdge(X.v,X.w,{weight:H.weight+I.weight,minlen:Math.max(H.minlen,I.minlen)})}),D}function l(M){let D=new e({multigraph:M.isMultigraph()}).setGraph(M.graph());return M.nodes().forEach(X=>{M.children(X).length||D.setNode(X,M.node(X))}),M.edges().forEach(X=>{D.setEdge(X,M.edge(X))}),D}function o(M){let D=M.nodes().map(X=>{let H={};return M.outEdges(X).forEach(I=>{H[I.w]=(H[I.w]||0)+M.edge(I).weight}),H});return q(M.nodes(),D)}function s(M){let D=M.nodes().map(X=>{let H={};return M.inEdges(X).forEach(I=>{H[I.v]=(H[I.v]||0)+M.edge(I).weight}),H});return q(M.nodes(),D)}function u(M,D){let X=M.x,H=M.y,I=D.x-X,ee=D.y-H,L=M.width/2,G=M.height/2;if(!I&&!ee)throw new Error("Not possible to find intersection inside of the rectangle");let R,$;return Math.abs(ee)*L>Math.abs(I)*G?(ee<0&&(G=-G),R=G*I/ee,$=G):(I<0&&(L=-L),R=L,$=L*ee/I),{x:X+R,y:H+$}}function f(M){let D=A(w(M)+1).map(()=>[]);return M.nodes().forEach(X=>{let H=M.node(X),I=H.rank;I!==void 0&&(D[I][H.order]=X)}),D}function d(M){let D=M.nodes().map(H=>{let I=M.node(H).rank;return I===void 0?Number.MAX_VALUE:I}),X=v(Math.min,D);M.nodes().forEach(H=>{let I=M.node(H);Object.hasOwn(I,"rank")&&(I.rank-=X)})}function h(M){let D=M.nodes().map(L=>M.node(L).rank),X=v(Math.min,D),H=[];M.nodes().forEach(L=>{let G=M.node(L).rank-X;H[G]||(H[G]=[]),H[G].push(L)});let I=0,ee=M.graph().nodeRankFactor;Array.from(H).forEach((L,G)=>{L===void 0&&G%ee!==0?--I:L!==void 0&&I&&L.forEach(R=>M.node(R).rank+=I)})}function m(M,D,X,H){let I={width:0,height:0};return arguments.length>=4&&(I.rank=X,I.order=H),n(M,"border",I,D)}function p(M,D=y){const X=[];for(let H=0;Hy){const X=p(D);return M.apply(null,X.map(H=>M.apply(null,H)))}else return M.apply(null,D)}function w(M){const X=M.nodes().map(H=>{let I=M.node(H).rank;return I===void 0?Number.MIN_VALUE:I});return v(Math.max,X)}function k(M,D){let X={lhs:[],rhs:[]};return M.forEach(H=>{D(H)?X.lhs.push(H):X.rhs.push(H)}),X}function S(M,D){let X=Date.now();try{return D()}finally{console.log(M+" time: "+(Date.now()-X)+"ms")}}function _(M,D){return D()}let z=0;function E(M){var D=++z;return M+(""+D)}function A(M,D,X=1){D==null&&(D=M,M=0);let H=ee=>eeDH[D]),Object.entries(M).reduce((H,[I,ee])=>(H[I]=X(ee,I),H),{})}function q(M,D){return M.reduce((X,H,I)=>(X[H]=D[I],X),{})}return Th}var zh,o1;function Sj(){if(o1)return zh;o1=1;let e=wj(),n=Ct().uniqueId;zh={run:i,undo:o};function i(s){(s.graph().acyclicer==="greedy"?e(s,f(s)):l(s)).forEach(d=>{let h=s.edge(d);s.removeEdge(d),h.forwardName=d.name,h.reversed=!0,s.setEdge(d.w,d.v,h,n("rev"))});function f(d){return h=>d.edge(h).weight}}function l(s){let u=[],f={},d={};function h(m){Object.hasOwn(d,m)||(d[m]=!0,f[m]=!0,s.outEdges(m).forEach(p=>{Object.hasOwn(f,p.w)?u.push(p):h(p.w)}),delete f[m])}return s.nodes().forEach(h),u}function o(s){s.edges().forEach(u=>{let f=s.edge(u);if(f.reversed){s.removeEdge(u);let d=f.forwardName;delete f.reversed,delete f.forwardName,s.setEdge(u.w,u.v,f,d)}})}return zh}var Ah,s1;function _j(){if(s1)return Ah;s1=1;let e=Ct();Ah={run:n,undo:l};function n(o){o.graph().dummyChains=[],o.edges().forEach(s=>i(o,s))}function i(o,s){let u=s.v,f=o.node(u).rank,d=s.w,h=o.node(d).rank,m=s.name,p=o.edge(s),y=p.labelRank;if(h===f+1)return;o.removeEdge(s);let v,w,k;for(k=0,++f;f{let u=o.node(s),f=u.edgeLabel,d;for(o.setEdge(u.edgeObj,f);u.dummy;)d=o.successors(s)[0],o.removeNode(s),f.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(f.x=u.x,f.y=u.y,f.width=u.width,f.height=u.height),s=d,u=o.node(s)})}return Ah}var Mh,u1;function rc(){if(u1)return Mh;u1=1;const{applyWithChunking:e}=Ct();Mh={longestPath:n,slack:i};function n(l){var o={};function s(u){var f=l.node(u);if(Object.hasOwn(o,u))return f.rank;o[u]=!0;let d=l.outEdges(u).map(m=>m==null?Number.POSITIVE_INFINITY:s(m.w)-l.edge(m).minlen);var h=e(Math.min,d);return h===Number.POSITIVE_INFINITY&&(h=0),f.rank=h}l.sources().forEach(s)}function i(l,o){return l.node(o.w).rank-l.node(o.v).rank-l.edge(o).minlen}return Mh}var jh,c1;function qS(){if(c1)return jh;c1=1;var e=Vn().Graph,n=rc().slack;jh=i;function i(u){var f=new e({directed:!1}),d=u.nodes()[0],h=u.nodeCount();f.setNode(d,{});for(var m,p;l(f,u){var p=m.v,y=h===p?m.w:p;!u.hasNode(y)&&!n(f,m)&&(u.setNode(y,{}),u.setEdge(h,y,{}),d(y))})}return u.nodes().forEach(d),u.nodeCount()}function o(u,f){return f.edges().reduce((h,m)=>{let p=Number.POSITIVE_INFINITY;return u.hasNode(m.v)!==u.hasNode(m.w)&&(p=n(f,m)),pf.node(h).rank+=d)}return jh}var Oh,f1;function Ej(){if(f1)return Oh;f1=1;var e=qS(),n=rc().slack,i=rc().longestPath,l=Vn().alg.preorder,o=Vn().alg.postorder,s=Ct().simplify;Oh=u,u.initLowLimValues=m,u.initCutValues=f,u.calcCutValue=h,u.leaveEdge=y,u.enterEdge=v,u.exchangeEdges=w;function u(z){z=s(z),i(z);var E=e(z);m(E),f(E,z);for(var A,B;A=y(E);)B=v(E,z,A),w(E,z,A,B)}function f(z,E){var A=o(z,z.nodes());A=A.slice(0,A.length-1),A.forEach(B=>d(z,E,B))}function d(z,E,A){var B=z.node(A),T=B.parent;z.edge(A,T).cutvalue=h(z,E,A)}function h(z,E,A){var B=z.node(A),T=B.parent,q=!0,M=E.edge(A,T),D=0;return M||(q=!1,M=E.edge(T,A)),D=M.weight,E.nodeEdges(A).forEach(X=>{var H=X.v===A,I=H?X.w:X.v;if(I!==T){var ee=H===q,L=E.edge(X).weight;if(D+=ee?L:-L,S(z,A,I)){var G=z.edge(A,I).cutvalue;D+=ee?-G:G}}}),D}function m(z,E){arguments.length<2&&(E=z.nodes()[0]),p(z,{},1,E)}function p(z,E,A,B,T){var q=A,M=z.node(B);return E[B]=!0,z.neighbors(B).forEach(D=>{Object.hasOwn(E,D)||(A=p(z,E,A,D,B))}),M.low=q,M.lim=A++,T?M.parent=T:delete M.parent,A}function y(z){return z.edges().find(E=>z.edge(E).cutvalue<0)}function v(z,E,A){var B=A.v,T=A.w;E.hasEdge(B,T)||(B=A.w,T=A.v);var q=z.node(B),M=z.node(T),D=q,X=!1;q.lim>M.lim&&(D=M,X=!0);var H=E.edges().filter(I=>X===_(z,z.node(I.v),D)&&X!==_(z,z.node(I.w),D));return H.reduce((I,ee)=>n(E,ee)!E.node(T).parent),B=l(z,A);B=B.slice(1),B.forEach(T=>{var q=z.node(T).parent,M=E.edge(T,q),D=!1;M||(M=E.edge(q,T),D=!0),E.node(T).rank=E.node(q).rank+(D?M.minlen:-M.minlen)})}function S(z,E,A){return z.hasEdge(E,A)}function _(z,E,A){return A.low<=E.lim&&E.lim<=A.lim}return Oh}var Rh,d1;function Nj(){if(d1)return Rh;d1=1;var e=rc(),n=e.longestPath,i=qS(),l=Ej();Rh=o;function o(d){var h=d.graph().ranker;if(h instanceof Function)return h(d);switch(d.graph().ranker){case"network-simplex":f(d);break;case"tight-tree":u(d);break;case"longest-path":s(d);break;case"none":break;default:f(d)}}var s=n;function u(d){n(d),i(d)}function f(d){l(d)}return Rh}var Dh,h1;function kj(){if(h1)return Dh;h1=1,Dh=e;function e(l){let o=i(l);l.graph().dummyChains.forEach(s=>{let u=l.node(s),f=u.edgeObj,d=n(l,o,f.v,f.w),h=d.path,m=d.lca,p=0,y=h[p],v=!0;for(;s!==f.w;){if(u=l.node(s),v){for(;(y=h[p])!==m&&l.node(y).maxRankh||m>o[p].lim));for(y=p,p=u;(p=l.parent(p))!==y;)d.push(p);return{path:f.concat(d.reverse()),lca:y}}function i(l){let o={},s=0;function u(f){let d=s;l.children(f).forEach(u),o[f]={low:d,lim:s++}}return l.children().forEach(u),o}return Dh}var Lh,p1;function Cj(){if(p1)return Lh;p1=1;let e=Ct();Lh={run:n,cleanup:s};function n(u){let f=e.addDummyNode(u,"root",{},"_root"),d=l(u),h=Object.values(d),m=e.applyWithChunking(Math.max,h)-1,p=2*m+1;u.graph().nestingRoot=f,u.edges().forEach(v=>u.edge(v).minlen*=p);let y=o(u)+1;u.children().forEach(v=>i(u,f,p,y,m,d,v)),u.graph().nodeRankFactor=p}function i(u,f,d,h,m,p,y){let v=u.children(y);if(!v.length){y!==f&&u.setEdge(f,y,{weight:0,minlen:d});return}let w=e.addBorderNode(u,"_bt"),k=e.addBorderNode(u,"_bb"),S=u.node(y);u.setParent(w,y),S.borderTop=w,u.setParent(k,y),S.borderBottom=k,v.forEach(_=>{i(u,f,d,h,m,p,_);let z=u.node(_),E=z.borderTop?z.borderTop:_,A=z.borderBottom?z.borderBottom:_,B=z.borderTop?h:2*h,T=E!==A?1:m-p[y]+1;u.setEdge(w,E,{weight:B,minlen:T,nestingEdge:!0}),u.setEdge(A,k,{weight:B,minlen:T,nestingEdge:!0})}),u.parent(y)||u.setEdge(f,w,{weight:0,minlen:m+p[y]})}function l(u){var f={};function d(h,m){var p=u.children(h);p&&p.length&&p.forEach(y=>d(y,m+1)),f[h]=m}return u.children().forEach(h=>d(h,1)),f}function o(u){return u.edges().reduce((f,d)=>f+u.edge(d).weight,0)}function s(u){var f=u.graph();u.removeNode(f.nestingRoot),delete f.nestingRoot,u.edges().forEach(d=>{var h=u.edge(d);h.nestingEdge&&u.removeEdge(d)})}return Lh}var Hh,m1;function Tj(){if(m1)return Hh;m1=1;let e=Ct();Hh=n;function n(l){function o(s){let u=l.children(s),f=l.node(s);if(u.length&&u.forEach(o),Object.hasOwn(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(let d=f.minRank,h=f.maxRank+1;dl(d.node(h))),d.edges().forEach(h=>l(d.edge(h)))}function l(d){let h=d.width;d.width=d.height,d.height=h}function o(d){d.nodes().forEach(h=>s(d.node(h))),d.edges().forEach(h=>{let m=d.edge(h);m.points.forEach(s),Object.hasOwn(m,"y")&&s(m)})}function s(d){d.y=-d.y}function u(d){d.nodes().forEach(h=>f(d.node(h))),d.edges().forEach(h=>{let m=d.edge(h);m.points.forEach(f),Object.hasOwn(m,"x")&&f(m)})}function f(d){let h=d.x;d.x=d.y,d.y=h}return Bh}var qh,y1;function Aj(){if(y1)return qh;y1=1;let e=Ct();qh=n;function n(i){let l={},o=i.nodes().filter(m=>!i.children(m).length),s=o.map(m=>i.node(m).rank),u=e.applyWithChunking(Math.max,s),f=e.range(u+1).map(()=>[]);function d(m){if(l[m])return;l[m]=!0;let p=i.node(m);f[p.rank].push(m),i.successors(m).forEach(d)}return o.sort((m,p)=>i.node(m).rank-i.node(p).rank).forEach(d),f}return qh}var Uh,x1;function Mj(){if(x1)return Uh;x1=1;let e=Ct().zipObject;Uh=n;function n(l,o){let s=0;for(let u=1;uv)),f=o.flatMap(y=>l.outEdges(y).map(v=>({pos:u[v.w],weight:l.edge(v).weight})).sort((v,w)=>v.pos-w.pos)),d=1;for(;d{let v=y.pos+d;m[v]+=y.weight;let w=0;for(;v>0;)v%2&&(w+=m[v+1]),v=v-1>>1,m[v]+=y.weight;p+=y.weight*w}),p}return Uh}var Ih,v1;function jj(){if(v1)return Ih;v1=1,Ih=e;function e(n,i=[]){return i.map(l=>{let o=n.inEdges(l);if(o.length){let s=o.reduce((u,f)=>{let d=n.edge(f),h=n.node(f.v);return{sum:u.sum+d.weight*h.order,weight:u.weight+d.weight}},{sum:0,weight:0});return{v:l,barycenter:s.sum/s.weight,weight:s.weight}}else return{v:l}})}return Ih}var Vh,b1;function Oj(){if(b1)return Vh;b1=1;let e=Ct();Vh=n;function n(o,s){let u={};o.forEach((d,h)=>{let m=u[d.v]={indegree:0,in:[],out:[],vs:[d.v],i:h};d.barycenter!==void 0&&(m.barycenter=d.barycenter,m.weight=d.weight)}),s.edges().forEach(d=>{let h=u[d.v],m=u[d.w];h!==void 0&&m!==void 0&&(m.indegree++,h.out.push(u[d.w]))});let f=Object.values(u).filter(d=>!d.indegree);return i(f)}function i(o){let s=[];function u(d){return h=>{h.merged||(h.barycenter===void 0||d.barycenter===void 0||h.barycenter>=d.barycenter)&&l(d,h)}}function f(d){return h=>{h.in.push(d),--h.indegree===0&&o.push(h)}}for(;o.length;){let d=o.pop();s.push(d),d.in.reverse().forEach(u(d)),d.out.forEach(f(d))}return s.filter(d=>!d.merged).map(d=>e.pick(d,["vs","i","barycenter","weight"]))}function l(o,s){let u=0,f=0;o.weight&&(u+=o.barycenter*o.weight,f+=o.weight),s.weight&&(u+=s.barycenter*s.weight,f+=s.weight),o.vs=s.vs.concat(o.vs),o.barycenter=u/f,o.weight=f,o.i=Math.min(s.i,o.i),s.merged=!0}return Vh}var Yh,w1;function Rj(){if(w1)return Yh;w1=1;let e=Ct();Yh=n;function n(o,s){let u=e.partition(o,w=>Object.hasOwn(w,"barycenter")),f=u.lhs,d=u.rhs.sort((w,k)=>k.i-w.i),h=[],m=0,p=0,y=0;f.sort(l(!!s)),y=i(h,d,y),f.forEach(w=>{y+=w.vs.length,h.push(w.vs),m+=w.barycenter*w.weight,p+=w.weight,y=i(h,d,y)});let v={vs:h.flat(!0)};return p&&(v.barycenter=m/p,v.weight=p),v}function i(o,s,u){let f;for(;s.length&&(f=s[s.length-1]).i<=u;)s.pop(),o.push(f.vs),u++;return u}function l(o){return(s,u)=>s.barycenteru.barycenter?1:o?u.i-s.i:s.i-u.i}return Yh}var Gh,S1;function Dj(){if(S1)return Gh;S1=1;let e=jj(),n=Oj(),i=Rj();Gh=l;function l(u,f,d,h){let m=u.children(f),p=u.node(f),y=p?p.borderLeft:void 0,v=p?p.borderRight:void 0,w={};y&&(m=m.filter(z=>z!==y&&z!==v));let k=e(u,m);k.forEach(z=>{if(u.children(z.v).length){let E=l(u,z.v,d,h);w[z.v]=E,Object.hasOwn(E,"barycenter")&&s(z,E)}});let S=n(k,d);o(S,w);let _=i(S,h);if(y&&(_.vs=[y,_.vs,v].flat(!0),u.predecessors(y).length)){let z=u.node(u.predecessors(y)[0]),E=u.node(u.predecessors(v)[0]);Object.hasOwn(_,"barycenter")||(_.barycenter=0,_.weight=0),_.barycenter=(_.barycenter*_.weight+z.order+E.order)/(_.weight+2),_.weight+=2}return _}function o(u,f){u.forEach(d=>{d.vs=d.vs.flatMap(h=>f[h]?f[h].vs:h)})}function s(u,f){u.barycenter!==void 0?(u.barycenter=(u.barycenter*u.weight+f.barycenter*f.weight)/(u.weight+f.weight),u.weight+=f.weight):(u.barycenter=f.barycenter,u.weight=f.weight)}return Gh}var $h,_1;function Lj(){if(_1)return $h;_1=1;let e=Vn().Graph,n=Ct();$h=i;function i(o,s,u,f){f||(f=o.nodes());let d=l(o),h=new e({compound:!0}).setGraph({root:d}).setDefaultNodeLabel(m=>o.node(m));return f.forEach(m=>{let p=o.node(m),y=o.parent(m);(p.rank===s||p.minRank<=s&&s<=p.maxRank)&&(h.setNode(m),h.setParent(m,y||d),o[u](m).forEach(v=>{let w=v.v===m?v.w:v.v,k=h.edge(w,m),S=k!==void 0?k.weight:0;h.setEdge(w,m,{weight:o.edge(v).weight+S})}),Object.hasOwn(p,"minRank")&&h.setNode(m,{borderLeft:p.borderLeft[s],borderRight:p.borderRight[s]}))}),h}function l(o){for(var s;o.hasNode(s=n.uniqueId("_root")););return s}return $h}var Xh,E1;function Hj(){if(E1)return Xh;E1=1,Xh=e;function e(n,i,l){let o={},s;l.forEach(u=>{let f=n.parent(u),d,h;for(;f;){if(d=n.parent(f),d?(h=o[d],o[d]=f):(h=s,s=f),h&&h!==f){i.setEdge(h,f);return}f=d}})}return Xh}var Ph,N1;function Bj(){if(N1)return Ph;N1=1;let e=Aj(),n=Mj(),i=Dj(),l=Lj(),o=Hj(),s=Vn().Graph,u=Ct();Ph=f;function f(p,y){if(y&&typeof y.customOrder=="function"){y.customOrder(p,f);return}let v=u.maxRank(p),w=d(p,u.range(1,v+1),"inEdges"),k=d(p,u.range(v-1,-1,-1),"outEdges"),S=e(p);if(m(p,S),y&&y.disableOptimalOrderHeuristic)return;let _=Number.POSITIVE_INFINITY,z;for(let E=0,A=0;A<4;++E,++A){h(E%2?w:k,E%4>=2),S=u.buildLayerMatrix(p);let B=n(p,S);B<_&&(A=0,z=Object.assign({},S),_=B)}m(p,z)}function d(p,y,v){const w=new Map,k=(S,_)=>{w.has(S)||w.set(S,[]),w.get(S).push(_)};for(const S of p.nodes()){const _=p.node(S);if(typeof _.rank=="number"&&k(_.rank,S),typeof _.minRank=="number"&&typeof _.maxRank=="number")for(let z=_.minRank;z<=_.maxRank;z++)z!==_.rank&&k(z,S)}return y.map(function(S){return l(p,S,v,w.get(S)||[])})}function h(p,y){let v=new s;p.forEach(function(w){let k=w.graph().root,S=i(w,k,v,y);S.vs.forEach((_,z)=>w.node(_).order=z),o(w,v,S.vs)})}function m(p,y){Object.values(y).forEach(v=>v.forEach((w,k)=>p.node(w).order=k))}return Ph}var Fh,k1;function qj(){if(k1)return Fh;k1=1;let e=Vn().Graph,n=Ct();Fh={positionX:v,findType1Conflicts:i,findType2Conflicts:l,addConflict:s,hasConflict:u,verticalAlignment:f,horizontalCompaction:d,alignCoordinates:p,findSmallestWidthAlignment:m,balance:y};function i(S,_){let z={};function E(A,B){let T=0,q=0,M=A.length,D=B[B.length-1];return B.forEach((X,H)=>{let I=o(S,X),ee=I?S.node(I).order:M;(I||X===D)&&(B.slice(q,H+1).forEach(L=>{S.predecessors(L).forEach(G=>{let R=S.node(G),$=R.order;(${X=B[H],S.node(X).dummy&&S.predecessors(X).forEach(I=>{let ee=S.node(I);ee.dummy&&(ee.orderD)&&s(z,I,X)})})}function A(B,T){let q=-1,M,D=0;return T.forEach((X,H)=>{if(S.node(X).dummy==="border"){let I=S.predecessors(X);I.length&&(M=S.node(I[0]).order,E(T,D,H,q,M),D=H,q=M)}E(T,D,T.length,M,B.length)}),T}return _.length&&_.reduce(A),z}function o(S,_){if(S.node(_).dummy)return S.predecessors(_).find(z=>S.node(z).dummy)}function s(S,_,z){if(_>z){let A=_;_=z,z=A}let E=S[_];E||(S[_]=E={}),E[z]=!0}function u(S,_,z){if(_>z){let E=_;_=z,z=E}return!!S[_]&&Object.hasOwn(S[_],z)}function f(S,_,z,E){let A={},B={},T={};return _.forEach(q=>{q.forEach((M,D)=>{A[M]=M,B[M]=M,T[M]=D})}),_.forEach(q=>{let M=-1;q.forEach(D=>{let X=E(D);if(X.length){X=X.sort((I,ee)=>T[I]-T[ee]);let H=(X.length-1)/2;for(let I=Math.floor(H),ee=Math.ceil(H);I<=ee;++I){let L=X[I];B[D]===D&&MMath.max(I,B[ee.v]+T.edge(ee)),0)}function X(H){let I=T.outEdges(H).reduce((L,G)=>Math.min(L,B[G.w]-T.edge(G)),Number.POSITIVE_INFINITY),ee=S.node(H);I!==Number.POSITIVE_INFINITY&&ee.borderType!==q&&(B[H]=Math.max(B[H],I))}return M(D,T.predecessors.bind(T)),M(X,T.successors.bind(T)),Object.keys(E).forEach(H=>B[H]=B[z[H]]),B}function h(S,_,z,E){let A=new e,B=S.graph(),T=w(B.nodesep,B.edgesep,E);return _.forEach(q=>{let M;q.forEach(D=>{let X=z[D];if(A.setNode(X),M){var H=z[M],I=A.edge(H,X);A.setEdge(H,X,Math.max(T(S,D,M),I||0))}M=D})}),A}function m(S,_){return Object.values(_).reduce((z,E)=>{let A=Number.NEGATIVE_INFINITY,B=Number.POSITIVE_INFINITY;Object.entries(E).forEach(([q,M])=>{let D=k(S,q)/2;A=Math.max(M+D,A),B=Math.min(M-D,B)});const T=A-B;return T{["l","r"].forEach(T=>{let q=B+T,M=S[q];if(M===_)return;let D=Object.values(M),X=E-n.applyWithChunking(Math.min,D);T!=="l"&&(X=A-n.applyWithChunking(Math.max,D)),X&&(S[q]=n.mapValues(M,H=>H+X))})})}function y(S,_){return n.mapValues(S.ul,(z,E)=>{if(_)return S[_.toLowerCase()][E];{let A=Object.values(S).map(B=>B[E]).sort((B,T)=>B-T);return(A[1]+A[2])/2}})}function v(S){let _=n.buildLayerMatrix(S),z=Object.assign(i(S,_),l(S,_)),E={},A;["u","d"].forEach(T=>{A=T==="u"?_:Object.values(_).reverse(),["l","r"].forEach(q=>{q==="r"&&(A=A.map(H=>Object.values(H).reverse()));let M=(T==="u"?S.predecessors:S.successors).bind(S),D=f(S,A,z,M),X=d(S,A,D.root,D.align,q==="r");q==="r"&&(X=n.mapValues(X,H=>-H)),E[T+q]=X})});let B=m(S,E);return p(E,B),y(E,S.graph().align)}function w(S,_,z){return(E,A,B)=>{let T=E.node(A),q=E.node(B),M=0,D;if(M+=T.width/2,Object.hasOwn(T,"labelpos"))switch(T.labelpos.toLowerCase()){case"l":D=-T.width/2;break;case"r":D=T.width/2;break}if(D&&(M+=z?D:-D),D=0,M+=(T.dummy?_:S)/2,M+=(q.dummy?_:S)/2,M+=q.width/2,Object.hasOwn(q,"labelpos"))switch(q.labelpos.toLowerCase()){case"l":D=q.width/2;break;case"r":D=-q.width/2;break}return D&&(M+=z?D:-D),D=0,M}}function k(S,_){return S.node(_).width}return Fh}var Qh,C1;function Uj(){if(C1)return Qh;C1=1;let e=Ct(),n=qj().positionX;Qh=i;function i(o){o=e.asNonCompoundGraph(o),l(o),Object.entries(n(o)).forEach(([s,u])=>o.node(s).x=u)}function l(o){let s=e.buildLayerMatrix(o),u=o.graph().ranksep,f=0;s.forEach(d=>{const h=d.reduce((m,p)=>{const y=o.node(p).height;return m>y?m:y},0);d.forEach(m=>o.node(m).y=f+h/2),f+=h+u})}return Qh}var Zh,T1;function Ij(){if(T1)return Zh;T1=1;let e=Sj(),n=_j(),i=Nj(),l=Ct().normalizeRanks,o=kj(),s=Ct().removeEmptyRanks,u=Cj(),f=Tj(),d=zj(),h=Bj(),m=Uj(),p=Ct(),y=Vn().Graph;Zh=v;function v(N,Y){let F=Y&&Y.debugTiming?p.time:p.notime;F("layout",()=>{let K=F(" buildLayoutGraph",()=>M(N));F(" runLayout",()=>w(K,F,Y)),F(" updateInputGraph",()=>k(N,K))})}function w(N,Y,F){Y(" makeSpaceForEdgeLabels",()=>D(N)),Y(" removeSelfEdges",()=>Z(N)),Y(" acyclic",()=>e.run(N)),Y(" nestingGraph.run",()=>u.run(N)),Y(" rank",()=>i(p.asNonCompoundGraph(N))),Y(" injectEdgeLabelProxies",()=>X(N)),Y(" removeEmptyRanks",()=>s(N)),Y(" nestingGraph.cleanup",()=>u.cleanup(N)),Y(" normalizeRanks",()=>l(N)),Y(" assignRankMinMax",()=>H(N)),Y(" removeEdgeLabelProxies",()=>I(N)),Y(" normalize.run",()=>n.run(N)),Y(" parentDummyChains",()=>o(N)),Y(" addBorderSegments",()=>f(N)),Y(" order",()=>h(N,F)),Y(" insertSelfEdges",()=>J(N)),Y(" adjustCoordinateSystem",()=>d.adjust(N)),Y(" position",()=>m(N)),Y(" positionSelfEdges",()=>j(N)),Y(" removeBorderNodes",()=>$(N)),Y(" normalize.undo",()=>n.undo(N)),Y(" fixupEdgeLabelCoords",()=>G(N)),Y(" undoCoordinateSystem",()=>d.undo(N)),Y(" translateGraph",()=>ee(N)),Y(" assignNodeIntersects",()=>L(N)),Y(" reversePoints",()=>R(N)),Y(" acyclic.undo",()=>e.undo(N))}function k(N,Y){N.nodes().forEach(F=>{let K=N.node(F),ne=Y.node(F);K&&(K.x=ne.x,K.y=ne.y,K.rank=ne.rank,Y.children(F).length&&(K.width=ne.width,K.height=ne.height))}),N.edges().forEach(F=>{let K=N.edge(F),ne=Y.edge(F);K.points=ne.points,Object.hasOwn(ne,"x")&&(K.x=ne.x,K.y=ne.y)}),N.graph().width=Y.graph().width,N.graph().height=Y.graph().height}let S=["nodesep","edgesep","ranksep","marginx","marginy"],_={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},z=["acyclicer","ranker","rankdir","align"],E=["width","height","rank"],A={width:0,height:0},B=["minlen","weight","width","height","labeloffset"],T={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},q=["labelpos"];function M(N){let Y=new y({multigraph:!0,compound:!0}),F=P(N.graph());return Y.setGraph(Object.assign({},_,U(F,S),p.pick(F,z))),N.nodes().forEach(K=>{let ne=P(N.node(K));const re=U(ne,E);Object.keys(A).forEach(se=>{re[se]===void 0&&(re[se]=A[se])}),Y.setNode(K,re),Y.setParent(K,N.parent(K))}),N.edges().forEach(K=>{let ne=P(N.edge(K));Y.setEdge(K,Object.assign({},T,U(ne,B),p.pick(ne,q)))}),Y}function D(N){let Y=N.graph();Y.ranksep/=2,N.edges().forEach(F=>{let K=N.edge(F);K.minlen*=2,K.labelpos.toLowerCase()!=="c"&&(Y.rankdir==="TB"||Y.rankdir==="BT"?K.width+=K.labeloffset:K.height+=K.labeloffset)})}function X(N){N.edges().forEach(Y=>{let F=N.edge(Y);if(F.width&&F.height){let K=N.node(Y.v),re={rank:(N.node(Y.w).rank-K.rank)/2+K.rank,e:Y};p.addDummyNode(N,"edge-proxy",re,"_ep")}})}function H(N){let Y=0;N.nodes().forEach(F=>{let K=N.node(F);K.borderTop&&(K.minRank=N.node(K.borderTop).rank,K.maxRank=N.node(K.borderBottom).rank,Y=Math.max(Y,K.maxRank))}),N.graph().maxRank=Y}function I(N){N.nodes().forEach(Y=>{let F=N.node(Y);F.dummy==="edge-proxy"&&(N.edge(F.e).labelRank=F.rank,N.removeNode(Y))})}function ee(N){let Y=Number.POSITIVE_INFINITY,F=0,K=Number.POSITIVE_INFINITY,ne=0,re=N.graph(),se=re.marginx||0,ye=re.marginy||0;function ve(xe){let pe=xe.x,_e=xe.y,Me=xe.width,Ce=xe.height;Y=Math.min(Y,pe-Me/2),F=Math.max(F,pe+Me/2),K=Math.min(K,_e-Ce/2),ne=Math.max(ne,_e+Ce/2)}N.nodes().forEach(xe=>ve(N.node(xe))),N.edges().forEach(xe=>{let pe=N.edge(xe);Object.hasOwn(pe,"x")&&ve(pe)}),Y-=se,K-=ye,N.nodes().forEach(xe=>{let pe=N.node(xe);pe.x-=Y,pe.y-=K}),N.edges().forEach(xe=>{let pe=N.edge(xe);pe.points.forEach(_e=>{_e.x-=Y,_e.y-=K}),Object.hasOwn(pe,"x")&&(pe.x-=Y),Object.hasOwn(pe,"y")&&(pe.y-=K)}),re.width=F-Y+se,re.height=ne-K+ye}function L(N){N.edges().forEach(Y=>{let F=N.edge(Y),K=N.node(Y.v),ne=N.node(Y.w),re,se;F.points?(re=F.points[0],se=F.points[F.points.length-1]):(F.points=[],re=ne,se=K),F.points.unshift(p.intersectRect(K,re)),F.points.push(p.intersectRect(ne,se))})}function G(N){N.edges().forEach(Y=>{let F=N.edge(Y);if(Object.hasOwn(F,"x"))switch((F.labelpos==="l"||F.labelpos==="r")&&(F.width-=F.labeloffset),F.labelpos){case"l":F.x-=F.width/2+F.labeloffset;break;case"r":F.x+=F.width/2+F.labeloffset;break}})}function R(N){N.edges().forEach(Y=>{let F=N.edge(Y);F.reversed&&F.points.reverse()})}function $(N){N.nodes().forEach(Y=>{if(N.children(Y).length){let F=N.node(Y),K=N.node(F.borderTop),ne=N.node(F.borderBottom),re=N.node(F.borderLeft[F.borderLeft.length-1]),se=N.node(F.borderRight[F.borderRight.length-1]);F.width=Math.abs(se.x-re.x),F.height=Math.abs(ne.y-K.y),F.x=re.x+F.width/2,F.y=K.y+F.height/2}}),N.nodes().forEach(Y=>{N.node(Y).dummy==="border"&&N.removeNode(Y)})}function Z(N){N.edges().forEach(Y=>{if(Y.v===Y.w){var F=N.node(Y.v);F.selfEdges||(F.selfEdges=[]),F.selfEdges.push({e:Y,label:N.edge(Y)}),N.removeEdge(Y)}})}function J(N){var Y=p.buildLayerMatrix(N);Y.forEach(F=>{var K=0;F.forEach((ne,re)=>{var se=N.node(ne);se.order=re+K,(se.selfEdges||[]).forEach(ye=>{p.addDummyNode(N,"selfedge",{width:ye.label.width,height:ye.label.height,rank:se.rank,order:re+ ++K,e:ye.e,label:ye.label},"_se")}),delete se.selfEdges})})}function j(N){N.nodes().forEach(Y=>{var F=N.node(Y);if(F.dummy==="selfedge"){var K=N.node(F.e.v),ne=K.x+K.width/2,re=K.y,se=F.x-ne,ye=K.height/2;N.setEdge(F.e,F.label),N.removeNode(Y),F.label.points=[{x:ne+2*se/3,y:re-ye},{x:ne+5*se/6,y:re-ye},{x:ne+se,y:re},{x:ne+5*se/6,y:re+ye},{x:ne+2*se/3,y:re+ye}],F.label.x=F.x,F.label.y=F.y}})}function U(N,Y){return p.mapValues(p.pick(N,Y),Number)}function P(N){var Y={};return N&&Object.entries(N).forEach(([F,K])=>{typeof F=="string"&&(F=F.toLowerCase()),Y[F]=K}),Y}return Zh}var Kh,z1;function Vj(){if(z1)return Kh;z1=1;let e=Ct(),n=Vn().Graph;Kh={debugOrdering:i};function i(l){let o=e.buildLayerMatrix(l),s=new n({compound:!0,multigraph:!0}).setGraph({});return l.nodes().forEach(u=>{s.setNode(u,{label:u}),s.setParent(u,"layer"+l.node(u).rank)}),l.edges().forEach(u=>s.setEdge(u.v,u.w,{},u.name)),o.forEach((u,f)=>{let d="layer"+f;s.setNode(d,{rank:"same"}),u.reduce((h,m)=>(s.setEdge(h,m,{style:"invis"}),m))}),s}return Kh}var Jh,A1;function Yj(){return A1||(A1=1,Jh="1.1.8"),Jh}var Wh,M1;function Gj(){return M1||(M1=1,Wh={graphlib:Vn(),layout:Ij(),debug:Vj(),util:{time:Ct().time,notime:Ct().notime},version:Yj()}),Wh}var $j=Gj();const j1=Lo($j),yo=200,Gl=56,O1=20,R1=40,Xj=20,D1=12;function Pj(e,n,i,l,o,s,u){const f=[],d=[],h=new Set,m=new Set,p=new Map;for(const v of i)for(const w of v.agents)m.add(w),p.set(w,v.name);for(const v of i){const w=o[v.name],k=v.agents.length,S=yo+O1*2,_=R1+k*Gl+(k-1)*D1+Xj;f.push({id:v.name,type:"groupNode",position:{x:0,y:0},data:{label:v.name,type:"parallel_group",status:(w==null?void 0:w.status)||"pending",groupName:v.name,progress:s[v.name]},style:{width:S,height:_}});for(let z=0;z$entryPoint",source:"$start",target:u,type:"animatedEdge",data:{},animated:!1})}for(const v of n)d.push({id:`${v.from}->${v.to}`,source:v.from,target:v.to,type:"animatedEdge",data:{when:v.when},animated:!1});return Fj(f,d),{nodes:f,edges:d}}function Fj(e,n){var l,o,s,u;const i=new j1.graphlib.Graph;i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:"TB",nodesep:50,ranksep:70,marginx:30,marginy:30});for(const f of e){if(f.parentId)continue;const d=f.type==="groupNode",h=d&&((l=f.style)==null?void 0:l.width)||yo,m=d&&((o=f.style)==null?void 0:o.height)||Gl;i.setNode(f.id,{width:h,height:m})}for(const f of n)i.hasNode(f.source)&&i.hasNode(f.target)&&i.setEdge(f.source,f.target);j1.layout(i);for(const f of e){if(f.parentId)continue;const d=i.node(f.id);if(!d)continue;const h=f.type==="groupNode",m=h&&((s=f.style)==null?void 0:s.width)||yo,p=h&&((u=f.style)==null?void 0:u.height)||Gl;f.position={x:d.x-m/2,y:d.y-p/2}}}const lt={pending:"#6b7280",running:"#3b82f6",completed:"#22c55e",failed:"#ef4444",paused:"#f59e0b",idle:"#6b7280",waiting:"#a855f7"},Qj=70,L1=90;function dm({data:e,children:n}){const[i,l]=V.useState(!1),o=V.useRef(null),s=V.useCallback(()=>{o.current=setTimeout(()=>l(!0),200)},[]),u=V.useCallback(()=>{o.current&&clearTimeout(o.current),l(!1)},[]),f=lt[e.status]||lt.pending;return b.jsxs("div",{className:"relative",onMouseEnter:s,onMouseLeave:u,children:[n,i&&b.jsxs("div",{className:Ye("absolute z-50 bottom-full left-1/2 -translate-x-1/2 mb-2","bg-[var(--surface-raised)] border border-[var(--border)] shadow-lg","rounded-lg px-3 py-2 max-w-[260px] pointer-events-none","animate-[tooltip-in_150ms_ease-out]"),children:[b.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 w-0 h-0 border-x-[6px] border-x-transparent border-t-[6px] border-t-[var(--border)]"}),b.jsxs("div",{className:"flex flex-col gap-1.5 text-[11px]",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:f}}),b.jsx("span",{className:"font-medium text-[var(--text)] capitalize",children:e.status}),e.iteration!=null&&e.iteration>1&&b.jsxs("span",{className:"text-[var(--text-muted)] ml-auto",children:["iter ",e.iteration]})]}),b.jsx("div",{className:"h-px bg-[var(--border)]"}),b.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[e.elapsed!=null&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-[var(--text-muted)]",children:"Elapsed"}),b.jsx("span",{className:"text-[var(--text)] font-mono",children:ln(e.elapsed)})]}),e.model&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-[var(--text-muted)]",children:"Model"}),b.jsx("span",{className:"text-[var(--text)] truncate",children:e.model})]}),e.tokens!=null&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-[var(--text-muted)]",children:"Tokens"}),b.jsxs("span",{className:"text-[var(--text)] font-mono",children:[Wn(e.tokens),e.inputTokens!=null&&e.outputTokens!=null&&b.jsxs("span",{className:"text-[var(--text-muted)]",children:[" ","(",Wn(e.inputTokens),"↑ ",Wn(e.outputTokens),"↓)"]})]})]}),e.costUsd!=null&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-[var(--text-muted)]",children:"Cost"}),b.jsx("span",{className:"text-[var(--text)] font-mono",children:Zl(e.costUsd)})]}),e.exitCode!=null&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-[var(--text-muted)]",children:"Exit code"}),b.jsx("span",{className:Ye("font-mono",e.exitCode===0?"text-[var(--completed)]":"text-[var(--failed)]"),children:e.exitCode})]}),e.selectedOption&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-[var(--text-muted)]",children:"Selected"}),b.jsx("span",{className:"text-[var(--text)] truncate",children:e.selectedOption})]})]}),e.errorMessage&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"h-px bg-[var(--border)]"}),b.jsxs("div",{className:"text-red-400 leading-tight",children:[e.errorType&&b.jsxs("span",{className:"font-medium",children:[e.errorType,": "]}),b.jsxs("span",{className:"break-words",children:[e.errorMessage.slice(0,120),e.errorMessage.length>120?"...":""]})]})]})]})]})]})}const Zj=V.memo(function({data:n,id:i,selected:l}){const o=n,u=he(B=>{var T;return(T=B.nodes[i])==null?void 0:T.status})||o.status||"pending",f=lt[u]||lt.pending,d=he(B=>{var T;return(T=B.nodes[i])==null?void 0:T.elapsed}),h=he(B=>{var T;return(T=B.nodes[i])==null?void 0:T.model}),m=he(B=>{var T;return(T=B.nodes[i])==null?void 0:T.tokens}),p=he(B=>{var T;return(T=B.nodes[i])==null?void 0:T.input_tokens}),y=he(B=>{var T;return(T=B.nodes[i])==null?void 0:T.output_tokens}),v=he(B=>{var T;return(T=B.nodes[i])==null?void 0:T.cost_usd}),w=he(B=>{var T;return(T=B.nodes[i])==null?void 0:T.iteration}),k=he(B=>{var T;return(T=B.nodes[i])==null?void 0:T.error_type}),S=he(B=>{var T;return(T=B.nodes[i])==null?void 0:T.error_message}),_=he(B=>{var T;return(T=B.nodes[i])==null?void 0:T.context_pct}),z=Kj(i,u),E=Jj(u),A=(()=>{if(u==="failed"&&S)return{text:S.length>40?S.slice(0,37)+"...":S,className:"text-red-400"};if(u==="running")return{text:z,className:"text-[var(--text-muted)]"};if(u==="completed"){const B=[];return d!=null&&B.push(ln(d)),m!=null&&B.push(`${Wn(m)} tok`),v!=null&&B.push(Zl(v)),{text:B.join(" · ")||null,className:"text-[var(--text-muted)]"}}return{text:null,className:""}})();return b.jsxs(b.Fragment,{children:[b.jsx(an,{type:"target",position:we.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx(dm,{data:{status:u,elapsed:d,model:h,tokens:m,inputTokens:p,outputTokens:y,costUsd:v,iteration:w,errorType:k,errorMessage:S},children:b.jsxs("div",{className:Ye("flex items-center gap-2 px-3 py-1.5 rounded-lg border-2 bg-[var(--node-bg)] min-w-[140px] max-w-[220px] transition-all duration-300",l&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]",u==="running"&&"shadow-[0_0_12px_var(--running-glow)]",E),style:{borderColor:f},children:[b.jsx("div",{className:Ye("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",u==="running"&&"animate-pulse"),style:{backgroundColor:`${f}20`},children:b.jsx(G2,{className:"w-3.5 h-3.5",style:{color:f}})}),b.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[b.jsxs("div",{className:"flex items-center gap-1",children:[b.jsx("span",{className:"text-xs font-medium text-[var(--text)] truncate",children:o.label}),w!=null&&w>1&&b.jsxs("span",{className:"flex-shrink-0 inline-flex items-center justify-center px-1.5 py-0.5 rounded-full text-[9px] font-bold leading-none",style:{backgroundColor:`${f}25`,color:f},children:["x",w]})]}),A.text&&b.jsx("span",{className:Ye("text-[10px] truncate leading-tight",A.className),children:A.text})]}),_!=null&&b.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-[2px] rounded-b-lg overflow-hidden",style:{backgroundColor:"rgba(255,255,255,0.06)"},children:b.jsx("div",{className:Ye("h-full transition-all duration-500",_>=L1?"animate-[context-pulse_2s_ease-in-out_infinite]":""),style:{width:`${Math.min(_,100)}%`,backgroundColor:_>=L1?"#ef4444":_>=Qj?"#f59e0b":"#22c55e"}})})]})}),b.jsx(an,{type:"source",position:we.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function Kj(e,n){const i=he(d=>{var h;return(h=d.nodes[e])==null?void 0:h.startedAt}),l=he(d=>d.replayMode),o=he(d=>d.lastEventTime),[s,u]=V.useState("0.0s"),f=V.useRef(null);return V.useEffect(()=>{if(n==="running"){if(l){f.current&&clearInterval(f.current);const m=i??o??0;u(ln((o??m)-m));return}const d=i!=null?i*1e3:Date.now(),h=()=>{const m=(Date.now()-d)/1e3;u(ln(m))};return h(),f.current=setInterval(h,1e3),()=>{f.current&&clearInterval(f.current)}}else f.current&&clearInterval(f.current)},[n,i,l,o]),s}function Jj(e){const n=V.useRef(e),[i,l]=V.useState("");return V.useEffect(()=>{const o=n.current;if(n.current=e,o===e)return;e==="running"?l("node-activate"):o==="running"&&(e==="completed"||e==="failed")&&l(e==="completed"?"node-complete":"node-fail");const s=setTimeout(()=>l(""),400);return()=>clearTimeout(s)},[e]),i}const Wj=V.memo(function({data:n,id:i,selected:l}){const o=n,u=he(k=>{var S;return(S=k.nodes[i])==null?void 0:S.status})||o.status||"pending",f=lt[u]||lt.pending,d=he(k=>{var S;return(S=k.nodes[i])==null?void 0:S.elapsed}),h=he(k=>{var S;return(S=k.nodes[i])==null?void 0:S.exit_code}),m=he(k=>{var S;return(S=k.nodes[i])==null?void 0:S.error_type}),p=he(k=>{var S;return(S=k.nodes[i])==null?void 0:S.error_message}),y=e4(i,u),v=t4(u),w=(()=>{if(u==="failed"&&p)return{text:p.length>40?p.slice(0,37)+"...":p,className:"text-red-400"};if(u==="running")return{text:y,className:"text-[var(--text-muted)]"};if(u==="completed"){const k=[];return d!=null&&k.push(ln(d)),h!=null&&k.push(`exit ${h}`),{text:k.join(" · ")||null,className:"text-[var(--text-muted)]"}}return{text:null,className:""}})();return b.jsxs(b.Fragment,{children:[b.jsx(an,{type:"target",position:we.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx(dm,{data:{status:u,elapsed:d,exitCode:h,errorType:m,errorMessage:p},children:b.jsxs("div",{className:Ye("flex items-center gap-2 px-3 py-1.5 rounded-lg border-2 bg-[var(--node-bg)] min-w-[140px] max-w-[220px] transition-all duration-300",l&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]",u==="running"&&"shadow-[0_0_12px_var(--running-glow)]",v),style:{borderColor:f},children:[b.jsx("div",{className:Ye("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",u==="running"&&"animate-pulse"),style:{backgroundColor:`${f}20`},children:b.jsx(oN,{className:"w-3.5 h-3.5",style:{color:f}})}),b.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[b.jsx("span",{className:"text-xs font-medium text-[var(--text)] truncate",children:o.label}),w.text&&b.jsx("span",{className:Ye("text-[10px] truncate leading-tight",w.className),children:w.text})]})]})}),b.jsx(an,{type:"source",position:we.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function e4(e,n){const i=he(d=>{var h;return(h=d.nodes[e])==null?void 0:h.startedAt}),l=he(d=>d.replayMode),o=he(d=>d.lastEventTime),[s,u]=V.useState("0.0s"),f=V.useRef(null);return V.useEffect(()=>{if(n==="running"){if(l){f.current&&clearInterval(f.current);const m=i??o??0;u(ln((o??m)-m));return}const d=i!=null?i*1e3:Date.now(),h=()=>{const m=(Date.now()-d)/1e3;u(ln(m))};return h(),f.current=setInterval(h,1e3),()=>{f.current&&clearInterval(f.current)}}else f.current&&clearInterval(f.current)},[n,i,l,o]),s}function t4(e){const n=V.useRef(e),[i,l]=V.useState("");return V.useEffect(()=>{const o=n.current;if(n.current=e,o===e)return;e==="running"?l("node-activate"):o==="running"&&(e==="completed"||e==="failed")&&l(e==="completed"?"node-complete":"node-fail");const s=setTimeout(()=>l(""),400);return()=>clearTimeout(s)},[e]),i}const n4=V.memo(function({data:n,id:i,selected:l}){const o=n,u=he(m=>{var p;return(p=m.nodes[i])==null?void 0:p.status})||o.status||"pending",f=lt[u]||lt.pending,d=he(m=>{var p;return(p=m.nodes[i])==null?void 0:p.selected_option}),h=r4(u);return b.jsxs(b.Fragment,{children:[b.jsx(an,{type:"target",position:we.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx(dm,{data:{status:u,selectedOption:d},children:b.jsxs("div",{className:Ye("flex items-center gap-2 px-3 py-1.5 rounded-lg border-2 border-dashed bg-[var(--node-bg)] min-w-[140px] max-w-[220px] transition-all duration-300",l&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]",u==="waiting"&&"shadow-[0_0_12px_var(--waiting-muted)]",u==="running"&&"shadow-[0_0_12px_var(--running-glow)]",h),style:{borderColor:f},children:[b.jsx("div",{className:Ye("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",u==="waiting"&&"animate-pulse"),style:{backgroundColor:`${f}20`},children:b.jsx(aN,{className:"w-3.5 h-3.5",style:{color:f}})}),b.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[b.jsx("span",{className:"text-xs font-medium text-[var(--text)] truncate",children:o.label}),u==="waiting"&&b.jsx("span",{className:"text-[10px] text-[var(--waiting)] truncate leading-tight",children:"Awaiting input..."}),u==="completed"&&d&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] truncate leading-tight",children:d})]})]})}),b.jsx(an,{type:"source",position:we.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function r4(e){const n=V.useRef(e),[i,l]=V.useState("");return V.useEffect(()=>{const o=n.current;if(n.current=e,o===e)return;e==="running"||e==="waiting"?l("node-activate"):(o==="running"||o==="waiting")&&e==="completed"&&l("node-complete");const s=setTimeout(()=>l(""),400);return()=>clearTimeout(s)},[e]),i}const i4=V.memo(function({data:n,id:i,selected:l}){const o=n,u=o.type==="for_each_group"?rN:W2,f=o.progress,h=he(k=>{var S;return(S=k.nodes[i])==null?void 0:S.status})||o.status||"pending",m=lt[h]||lt.pending,p=l4(h),y=f?`${f.completed+f.failed}/${f.total}${f.failed>0?` (${f.failed} failed)`:""}`:null,v=f&&f.total>0?(f.completed+f.failed)/f.total*100:0,w=f!=null&&f.failed>0;return b.jsxs(b.Fragment,{children:[b.jsx(an,{type:"target",position:we.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsxs("div",{className:Ye("flex flex-col gap-1 px-4 py-3 rounded-xl border-2 border-dashed bg-[var(--surface)]/80 min-w-[180px] transition-all duration-300",l&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]",h==="running"&&"shadow-[0_0_16px_var(--running-glow)]",p),style:{borderColor:m,minHeight:"100%"},children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(u,{className:"w-3.5 h-3.5",style:{color:m}}),b.jsx("span",{className:"text-xs font-medium text-[var(--text-secondary)]",children:o.label})]}),y&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] font-mono",children:y}),f&&f.total>0&&h==="running"&&b.jsx("div",{className:"w-full h-1 rounded-full bg-[var(--border)] overflow-hidden mt-0.5",children:b.jsx("div",{className:"h-full rounded-full transition-all duration-500 ease-out",style:{width:`${v}%`,backgroundColor:w?"var(--failed)":"var(--completed)"}})})]}),b.jsx(an,{type:"source",position:we.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function l4(e){const n=V.useRef(e),[i,l]=V.useState("");return V.useEffect(()=>{const o=n.current;if(n.current=e,o===e)return;e==="running"?l("node-activate"):o==="running"&&(e==="completed"||e==="failed")&&l(e==="completed"?"node-complete":"node-fail");const s=setTimeout(()=>l(""),400);return()=>clearTimeout(s)},[e]),i}const a4=V.memo(function({data:n,selected:i}){const o=n.status||"pending",s=o==="completed",u=o==="failed",f=!s&&!u,d=s?lt.completed:u?lt.failed:lt.pending;return b.jsxs(b.Fragment,{children:[b.jsx(an,{type:"target",position:we.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx("div",{className:Ye("flex items-center justify-center w-11 h-11 rounded-full border-2 transition-all duration-300",s?"bg-[var(--completed)] shadow-[0_0_16px_var(--completed-muted)]":u?"bg-[var(--failed)] shadow-[0_0_16px_var(--failed-muted)]":"bg-[var(--node-bg)]",i&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]"),style:{borderColor:d},children:s?b.jsx(Bi,{className:"w-5 h-5 text-white",strokeWidth:3}):u?b.jsx(Tb,{className:"w-3.5 h-3.5 text-white",fill:"white"}):b.jsx(Bi,{className:"w-5 h-5",strokeWidth:2.5,style:{color:f?lt.pending:d}})})]})}),o4=V.memo(function({data:n,selected:i}){const o=n.status||"pending",s=lt[o]||lt.pending,u=o==="running"||o==="completed";return b.jsxs(b.Fragment,{children:[b.jsx("div",{className:Ye("flex items-center justify-center w-11 h-11 rounded-full border-2 transition-all duration-300",u?"bg-[var(--completed)]":"bg-[var(--node-bg)]",i&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]",u&&"shadow-[0_0_12px_var(--completed-muted)]"),style:{borderColor:s},children:b.jsx(Vp,{className:"w-4 h-4 ml-0.5",style:{color:u?"white":s}})}),b.jsx(an,{type:"source",position:we.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})}),s4=V.memo(function({id:n,sourceX:i,sourceY:l,targetX:o,targetY:s,sourcePosition:u,targetPosition:f,source:d,target:h,data:m}){const p=he(D=>D.highlightedEdges),y=V.useMemo(()=>p.find(D=>D.from===d&&D.to===h),[p,d,h]),[v,w,k]=im({sourceX:i,sourceY:l,targetX:o,targetY:s,sourcePosition:u,targetPosition:f}),S=m==null?void 0:m.when,_=!!S,z=(y==null?void 0:y.state)==="taken",E=(y==null?void 0:y.state)==="highlighted",A=(y==null?void 0:y.state)==="failed";let B="var(--edge-color)",T=2,q;A?(B="var(--failed)",T=3):z?(B="var(--edge-taken)",T=3):E&&(B="var(--edge-active)",T=3),_&&!z&&!E&&!A&&(q="6 3");const M=A?"failed":z?"taken":E?"active":"default";return b.jsxs(b.Fragment,{children:[b.jsx(Xo,{id:n,path:v,style:{stroke:B,strokeWidth:T,strokeDasharray:q,transition:"stroke 0.3s ease, stroke-width 0.3s ease"},markerEnd:`url(#arrow-${M})`}),_&&b.jsx(MM,{children:b.jsx("div",{className:"nodrag nopan",style:{position:"absolute",transform:`translate(-50%, -50%) translate(${w}px,${k}px)`,pointerEvents:"all"},children:b.jsx("span",{className:"inline-block px-1.5 py-0.5 rounded-full text-[9px] font-mono leading-tight max-w-[140px] truncate",style:{backgroundColor:A?"var(--failed)":z?"var(--edge-taken)":"var(--surface)",color:A||z?"var(--bg)":"var(--text-muted)",border:`1px solid ${A?"var(--failed)":z?"var(--edge-taken)":"var(--border)"}`},title:S,children:S})})}),z&&b.jsx("circle",{r:"3",fill:"var(--edge-taken)",children:b.jsx("animateMotion",{dur:"1s",repeatCount:"indefinite",path:v})}),A&&b.jsx("circle",{r:"3",fill:"var(--failed)",opacity:"0.8",children:b.jsx("animateMotion",{dur:"1.5s",repeatCount:"indefinite",path:v})})]})});function u4(){const e=he(u=>u.workflowStatus),n=he(u=>u.workflowFailure),i=he(u=>u.workflowFailedAgent),l=he(u=>u.selectNode);if(e!=="failed"||!n)return null;const o=n.message||n.error_type||"Unknown error",s=n.error_type==="TimeoutError";return b.jsx("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 z-20 animate-[banner-in_200ms_ease-out]",children:b.jsxs("div",{className:Ye("flex items-center gap-2 px-4 py-2 rounded-lg","bg-red-950/90 border border-red-500/40 shadow-lg shadow-red-500/10","backdrop-blur-sm max-w-[560px]"),children:[b.jsx(sN,{className:"w-4 h-4 text-red-400 flex-shrink-0"}),b.jsxs("div",{className:"flex flex-col min-w-0",children:[b.jsx("span",{className:"text-xs font-medium text-red-300",children:"Workflow Failed"}),b.jsx("span",{className:"text-[11px] text-red-400/80 truncate",children:o}),s&&n.current_agent&&b.jsxs("span",{className:"text-[10px] text-red-400/60 truncate",children:["Timed out on agent: ",n.current_agent]}),n.checkpoint_path&&b.jsxs("span",{className:"text-[10px] text-red-400/50 truncate",title:n.checkpoint_path,children:["Checkpoint: ",n.checkpoint_path.split("/").pop()]})]}),i&&b.jsxs("button",{onClick:()=>l(i),className:"flex items-center gap-1 px-2 py-1 rounded text-[10px] font-medium text-red-300 bg-red-500/20 hover:bg-red-500/30 transition-colors flex-shrink-0 ml-1",children:[b.jsx(Z2,{className:"w-3 h-3"}),"View"]})]})})}function c4(){const[e,n]=V.useState(!1),i=he(d=>d.workflowStatus),l=he(d=>d.totalCost),o=he(d=>d.totalTokens),s=he(d=>d.agentsCompleted),u=he(d=>d.agentsTotal),f=Ab();return i!=="completed"||e?null:b.jsx("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 z-20 animate-[banner-in_200ms_ease-out]",children:b.jsxs("div",{className:Ye("flex items-center gap-3 px-4 py-2 rounded-lg","bg-green-950/90 border border-green-500/40 shadow-lg shadow-green-500/10","backdrop-blur-sm"),children:[b.jsx(X2,{className:"w-4 h-4 text-green-400 flex-shrink-0"}),b.jsx("span",{className:"text-xs font-medium text-green-300",children:"Completed"}),b.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-green-400/80 font-mono",children:[b.jsx("span",{children:f}),u>0&&b.jsxs("span",{children:[s,"/",u," agents"]}),o>0&&b.jsxs("span",{children:[Wn(o)," tok"]}),l>0&&b.jsx("span",{children:Zl(l)})]}),b.jsx("button",{onClick:()=>n(!0),className:"p-0.5 rounded text-green-500/60 hover:text-green-300 transition-colors flex-shrink-0 ml-1",children:b.jsx(Bo,{className:"w-3.5 h-3.5"})})]})})}const f4={agentNode:Zj,scriptNode:Wj,gateNode:n4,groupNode:i4,endNode:a4,startNode:o4},d4={animatedEdge:s4},h4={type:"animatedEdge"};function p4(){return b.jsx("svg",{style:{position:"absolute",width:0,height:0},children:b.jsxs("defs",{children:[b.jsx("marker",{id:"arrow-default",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:b.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"var(--edge-color)"})}),b.jsx("marker",{id:"arrow-active",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:b.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"var(--edge-active)"})}),b.jsx("marker",{id:"arrow-taken",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:b.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"var(--edge-taken)"})}),b.jsx("marker",{id:"arrow-failed",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:b.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"var(--failed)"})})]})})}function m4(){const e=he(M=>M.agents),n=he(M=>M.routes),i=he(M=>M.parallelGroups),l=he(M=>M.forEachGroups),o=he(M=>M.nodes),s=he(M=>M.groupProgress),u=he(M=>M.selectNode),f=he(M=>M.selectedNode),d=he(M=>M.workflowStatus),h=he(M=>M.entryPoint),m=he(M=>M.wsStatus),p=he(M=>M.workflowFailedAgent),[y,v,w]=jM([]),[k,S,_]=OM([]),z=V.useRef(!1);V.useEffect(()=>{if(e.length===0||z.current)return;z.current=!0;const{nodes:M,edges:D}=Pj(e,n,i,l,o,s,h);v(M),S(D)},[e,n,i,l,o,s,h,v,S]),V.useEffect(()=>{z.current&&v(M=>M.map(D=>{const X=o[D.id];if(!X)return D;const H=X.status||"pending",I=D.data.status;if(H!==I){const ee={...D.data,status:H};return D.data.groupName&&s[D.data.groupName]&&(ee.progress=s[D.data.groupName]),{...D,data:ee}}if(D.data.groupName&&s[D.data.groupName]){const ee=D.data.progress,L=s[D.data.groupName];if(L&&(!ee||ee.completed!==L.completed||ee.failed!==L.failed))return{...D,data:{...D.data,progress:L}}}return D}))},[o,s,v]);const E=V.useCallback((M,D)=>{D.type==="groupNode"&&D.data.type!=="for_each_group"||u(D.id)},[u]),A=V.useCallback(()=>{u(null)},[u]),B=V.useCallback(M=>{var X;const D=((X=M.data)==null?void 0:X.status)||"pending";return lt[D]||lt.pending},[]);V.useEffect(()=>{v(M=>M.map(D=>({...D,selected:D.id===f})))},[f,v]),V.useEffect(()=>{d==="failed"&&p&&u(p)},[d,p,u]);const T=d==="pending"&&e.length===0,q=(()=>{switch(m){case"connecting":return"Connecting to workflow…";case"reconnecting":return"Reconnecting…";case"disconnected":return"Connection lost. Retrying…";default:return"Waiting for workflow…"}})();return b.jsxs("div",{className:"w-full h-full relative",children:[b.jsx(p4,{}),b.jsx(u4,{}),b.jsx(c4,{}),T&&b.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center pointer-events-none",children:[b.jsxs("div",{className:"relative mb-3",children:[b.jsx(fN,{className:"w-8 h-8 text-[var(--accent)] opacity-20"}),b.jsx(_o,{className:"w-8 h-8 text-[var(--text-muted)] animate-spin absolute inset-0 opacity-40"})]}),b.jsx("p",{className:"text-sm text-[var(--text-muted)] animate-pulse",children:q})]}),b.jsxs(zM,{nodes:y,edges:k,onNodesChange:w,onEdgesChange:_,onNodeClick:E,onPaneClick:A,nodeTypes:f4,edgeTypes:d4,defaultEdgeOptions:h4,fitView:!0,fitViewOptions:{padding:.2},minZoom:.2,maxZoom:2,proOptions:{hideAttribution:!0},nodesDraggable:!0,nodesConnectable:!1,elementsSelectable:!0,children:[b.jsx(BM,{variant:Tr.Dots,gap:20,size:1,color:"var(--border-subtle)"}),b.jsx(ij,{nodeColor:B,maskColor:"var(--minimap-mask)",style:{background:"var(--minimap-bg)"},pannable:!0,zoomable:!0}),b.jsx($M,{showInteractive:!1,children:b.jsx(g4,{})}),b.jsx(y4,{})]})]})}function g4(){const{fitView:e}=$o(),n=V.useCallback(()=>{e({padding:.2,duration:300})},[e]);return b.jsx("button",{onClick:n,className:"react-flow__controls-button",title:"Fit view (F)",style:{display:"flex",alignItems:"center",justifyContent:"center"},children:b.jsx(tN,{className:"w-3.5 h-3.5"})})}function y4(){const{fitView:e}=$o();return V.useEffect(()=>{const n=i=>{var o;const l=(o=i.target)==null?void 0:o.tagName;l==="INPUT"||l==="TEXTAREA"||l==="SELECT"||i.key==="f"&&!i.ctrlKey&&!i.metaKey&&!i.altKey&&e({padding:.2,duration:300})};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e]),null}function la({items:e}){const n=e.filter(i=>i.value!=null&&i.value!=="");return n.length===0?null:b.jsx("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1.5 text-xs",children:n.map(({label:i,value:l})=>b.jsxs("div",{className:"contents",children:[b.jsx("dt",{className:"text-[var(--text-muted)] whitespace-nowrap",children:i}),b.jsx("dd",{className:"text-[var(--text)] break-words",children:typeof l=="object"?JSON.stringify(l):String(l)})]},i))})}function US(e){const n=[];return e.elapsed!=null&&n.push({label:"Elapsed",value:ln(e.elapsed)}),e.model&&n.push({label:"Model",value:e.model}),e.tokens!=null&&n.push({label:"Tokens",value:Wn(e.tokens)}),e.input_tokens!=null&&e.output_tokens!=null&&n.push({label:"In / Out",value:`${Wn(e.input_tokens)} / ${Wn(e.output_tokens)}`}),e.cost_usd!=null&&n.push({label:"Cost",value:Zl(e.cost_usd)}),e.context_window_used!=null&&e.context_window_max!=null&&n.push({label:"Context",value:bN(e.context_window_used,e.context_window_max)}),e.iteration!=null&&n.push({label:"Iteration",value:e.iteration}),e.error_type&&n.push({label:"Error",value:e.error_type}),e.error_message&&n.push({label:"Message",value:e.error_message}),n}function Pi({output:e,title:n="Output",defaultExpanded:i=!0,maxHeight:l="300px"}){const[o,s]=V.useState(i),[u,f]=V.useState(!1),d=zb(e);if(!d)return null;const h=typeof e=="object"&&e!==null,m=async()=>{await navigator.clipboard.writeText(d),f(!0),setTimeout(()=>f(!1),2e3)};return b.jsxs("div",{className:"space-y-1.5",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("button",{onClick:()=>s(!o),className:"flex items-center gap-1 text-[10px] uppercase tracking-wider text-[var(--text-muted)] hover:text-[var(--text)] transition-colors font-semibold",children:[o?b.jsx(Fi,{className:"w-3 h-3"}):b.jsx(ia,{className:"w-3 h-3"}),n]}),o&&b.jsx("button",{onClick:m,className:"flex items-center gap-1 text-[10px] text-[var(--text-muted)] hover:text-[var(--text)] transition-colors",title:"Copy to clipboard",children:u?b.jsx(Bi,{className:"w-3 h-3 text-[var(--completed)]"}):b.jsx(Cb,{className:"w-3 h-3"})})]}),o&&b.jsx("pre",{className:"bg-[var(--bg)] border border-[var(--border)] rounded-md p-3 font-mono text-[11px] leading-relaxed text-[var(--text)] overflow-auto whitespace-pre-wrap break-words",style:{maxHeight:l},children:h?b.jsx(x4,{text:d}):d})]})}function x4({text:e}){const n=e.split(/("(?:[^"\\]|\\.)*")/g);return b.jsx(b.Fragment,{children:n.map((i,l)=>{if(l%2===1){const s=n.slice(l+1).join(""),u=/^\s*:/.test(s);return b.jsx("span",{className:u?"text-blue-400":"text-green-400",children:i},l)}const o=i.replace(/\b(true|false|null)\b|(-?\d+\.?\d*(?:e[+-]?\d+)?)/gi,(s,u,f)=>u?`${s}`:f?`${s}`:s);return b.jsx("span",{dangerouslySetInnerHTML:{__html:o}},l)})})}function hm({activity:e,defaultExpanded:n=!0}){const[i,l]=V.useState(n),o=V.useRef(null);return V.useEffect(()=>{o.current&&i&&(o.current.scrollTop=o.current.scrollHeight)},[e.length,i]),e.length===0?null:b.jsxs("div",{className:"space-y-1.5",children:[b.jsxs("button",{onClick:()=>l(!i),className:"flex items-center gap-1 text-[10px] uppercase tracking-wider text-[var(--text-muted)] hover:text-[var(--text)] transition-colors font-semibold",children:[i?b.jsx(Fi,{className:"w-3 h-3"}):b.jsx(ia,{className:"w-3 h-3"}),"Activity (",e.length,")"]}),i&&b.jsx("div",{ref:o,className:"max-h-[400px] overflow-y-auto space-y-0.5",children:e.map((s,u)=>b.jsx(v4,{entry:s},u))})]})}function v4({entry:e}){const n={reasoning:"text-indigo-400/70","tool-start":"text-blue-400","tool-complete":"text-green-400",turn:"text-amber-400",message:"text-[var(--text)]"};return b.jsxs("div",{className:Ye("py-1.5 px-2 rounded text-[11px] leading-relaxed border-b border-[var(--border-subtle)] last:border-b-0"),children:[b.jsxs("div",{className:"flex items-start gap-1.5",children:[b.jsx("span",{className:"w-4 text-center flex-shrink-0",children:e.icon}),b.jsx("span",{className:"text-[var(--text-muted)] uppercase text-[9px] font-semibold tracking-wider w-12 flex-shrink-0 pt-px",children:e.label}),b.jsx("span",{className:Ye("break-words",n[e.type]||"text-[var(--text)]"),children:typeof e.text=="object"?JSON.stringify(e.text):e.text})]}),e.detail&&b.jsx("div",{className:"mt-1 ml-[4.25rem] px-2 py-1 bg-[var(--bg)] rounded text-[10px] font-mono text-[var(--text-muted)] whitespace-pre-wrap break-words max-h-24 overflow-y-auto",children:typeof e.detail=="object"?JSON.stringify(e.detail,null,2):e.detail})]})}function b4({node:e}){const n=e.status,i=lt[n]||lt.pending,l=e.iterationHistory&&e.iterationHistory.length>0;return b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-[10px] font-bold uppercase tracking-wider",style:{backgroundColor:`${i}20`,color:i},children:n}),b.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Agent"})]}),l?b.jsx(H1,{label:`Iteration ${e.iteration??"?"} (current)`,defaultExpanded:!0,status:n,snapshot:{iteration:e.iteration??0,prompt:e.prompt,output:e.output,elapsed:e.elapsed,model:e.model,tokens:e.tokens,input_tokens:e.input_tokens,output_tokens:e.output_tokens,cost_usd:e.cost_usd,activity:e.activity,error_type:e.error_type,error_message:e.error_message}}):b.jsxs(b.Fragment,{children:[b.jsx(la,{items:US(e)}),e.prompt&&b.jsx(Pi,{output:e.prompt,title:"Input / Prompt",defaultExpanded:!0}),b.jsx(hm,{activity:e.activity,defaultExpanded:n!=="completed"}),e.output!=null&&b.jsx(Pi,{output:e.output,title:"Output"})]}),l&&[...e.iterationHistory].reverse().map(o=>b.jsx(H1,{label:`Iteration ${o.iteration}`,defaultExpanded:!1,status:n,snapshot:o},o.iteration))]})}function H1({label:e,defaultExpanded:n,snapshot:i,status:l}){const[o,s]=V.useState(n);return b.jsxs("div",{className:"border border-[var(--border)] rounded-lg overflow-hidden",children:[b.jsxs("button",{onClick:()=>s(!o),className:"flex items-center gap-2 w-full px-3 py-2 bg-[var(--bg)] hover:bg-[var(--node-bg)] transition-colors text-left",children:[o?b.jsx(Fi,{className:"w-3.5 h-3.5 text-[var(--text-muted)] flex-shrink-0"}):b.jsx(ia,{className:"w-3.5 h-3.5 text-[var(--text-muted)] flex-shrink-0"}),b.jsx("span",{className:"text-xs font-semibold text-[var(--text)]",children:e}),i.elapsed!=null&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] ml-auto",children:w4(i.elapsed)})]}),o&&b.jsxs("div",{className:"px-3 py-3 space-y-3 border-t border-[var(--border)]",children:[b.jsx(la,{items:US(i)}),i.prompt&&b.jsx(Pi,{output:i.prompt,title:"Input / Prompt",defaultExpanded:!1}),b.jsx(hm,{activity:i.activity,defaultExpanded:n&&l!=="completed"}),i.output!=null&&b.jsx(Pi,{output:i.output,title:"Output",defaultExpanded:!0}),i.error_type&&b.jsxs("div",{className:"text-xs text-red-400",children:[b.jsx("span",{className:"font-semibold",children:i.error_type}),i.error_message&&b.jsxs("span",{className:"ml-1",children:["— ",i.error_message]})]})]})]})}function w4(e){if(e<1)return`${(e*1e3).toFixed(0)}ms`;if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e/60),i=(e%60).toFixed(0);return`${n}m ${i}s`}function S4({node:e}){const n=e.status,i=lt[n]||lt.pending,l=[];e.elapsed!=null&&l.push({label:"Elapsed",value:ln(e.elapsed)}),e.exit_code!=null&&l.push({label:"Exit Code",value:e.exit_code}),e.error_type&&l.push({label:"Error",value:e.error_type}),e.error_message&&l.push({label:"Message",value:e.error_message});let o="";return e.stdout&&(o+=e.stdout),e.stderr&&(o+=(o?` +`)),m=h.reduce((p,y)=>p.concat(...y),[]);return[h,m]}return[[],[]]},[e]);return V.useEffect(()=>{const d=(n==null?void 0:n.target)??wv,h=(n==null?void 0:n.actInsideInputWithModifier)??!0;if(e!==null){const m=v=>{var _,S;if(o.current=v.ctrlKey||v.metaKey||v.shiftKey||v.altKey,(!o.current||o.current&&!h)&&qw(v))return!1;const E=_v(v.code,f);if(s.current.add(v[E]),Sv(u,s.current,!1)){const z=((S=(_=v.composedPath)==null?void 0:_.call(v))==null?void 0:S[0])||v.target,k=(z==null?void 0:z.nodeName)==="BUTTON"||(z==null?void 0:z.nodeName)==="A";n.preventDefault!==!1&&(o.current||!k)&&v.preventDefault(),l(!0)}},p=v=>{const w=_v(v.code,f);Sv(u,s.current,!0)?(l(!1),s.current.clear()):s.current.delete(v[w]),v.key==="Meta"&&s.current.clear(),o.current=!1},y=()=>{s.current.clear(),l(!1)};return d==null||d.addEventListener("keydown",m),d==null||d.addEventListener("keyup",p),window.addEventListener("blur",y),window.addEventListener("contextmenu",y),()=>{d==null||d.removeEventListener("keydown",m),d==null||d.removeEventListener("keyup",p),window.removeEventListener("blur",y),window.removeEventListener("contextmenu",y)}}},[e,l]),i}function Sv(e,n,i){return e.filter(l=>i||l.length===n.size).some(l=>l.every(o=>n.has(o)))}function _v(e,n){return n.includes(e)?"code":"key"}const uA=()=>{const e=ht();return V.useMemo(()=>({zoomIn:n=>{const{panZoom:i}=e.getState();return i?i.scaleBy(1.2,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},zoomOut:n=>{const{panZoom:i}=e.getState();return i?i.scaleBy(1/1.2,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},zoomTo:(n,i)=>{const{panZoom:l}=e.getState();return l?l.scaleTo(n,{duration:i==null?void 0:i.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(n,i)=>{const{transform:[l,o,s],panZoom:u}=e.getState();return u?(await u.setViewport({x:n.x??l,y:n.y??o,zoom:n.zoom??s},i),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[n,i,l]=e.getState().transform;return{x:n,y:i,zoom:l}},setCenter:async(n,i,l)=>e.getState().setCenter(n,i,l),fitBounds:async(n,i)=>{const{width:l,height:o,minZoom:s,maxZoom:u,panZoom:f}=e.getState(),d=nm(n,l,o,s,u,(i==null?void 0:i.padding)??.1);return f?(await f.setViewport(d,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(n,i={})=>{const{transform:l,snapGrid:o,snapToGrid:s,domNode:u}=e.getState();if(!u)return n;const{x:f,y:d}=u.getBoundingClientRect(),h={x:n.x-f,y:n.y-d},m=i.snapGrid??o,p=i.snapToGrid??s;return Go(h,l,p,m)},flowToScreenPosition:n=>{const{transform:i,domNode:l}=e.getState();if(!l)return n;const{x:o,y:s}=l.getBoundingClientRect(),u=tc(n,i);return{x:u.x+o,y:u.y+s}}}),[])};function aS(e,n){const i=[],l=new Map,o=[];for(const s of e)if(s.type==="add"){o.push(s);continue}else if(s.type==="remove"||s.type==="replace")l.set(s.id,[s]);else{const u=l.get(s.id);u?u.push(s):l.set(s.id,[s])}for(const s of n){const u=l.get(s.id);if(!u){i.push(s);continue}if(u[0].type==="remove")continue;if(u[0].type==="replace"){i.push({...u[0].item});continue}const f={...s};for(const d of u)cA(d,f);i.push(f)}return o.length&&o.forEach(s=>{s.index!==void 0?i.splice(s.index,0,{...s.item}):i.push({...s.item})}),i}function cA(e,n){switch(e.type){case"select":{n.selected=e.selected;break}case"position":{typeof e.position<"u"&&(n.position=e.position),typeof e.dragging<"u"&&(n.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(n.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(n.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(n.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(n.resizing=e.resizing);break}}}function oS(e,n){return aS(e,n)}function sS(e,n){return aS(e,n)}function Di(e,n){return{id:e,type:"select",selected:n}}function Yl(e,n=new Set,i=!1){const l=[];for(const[o,s]of e){const u=n.has(o);!(s.selected===void 0&&!u)&&s.selected!==u&&(i&&(s.selected=u),l.push(Di(s.id,u)))}return l}function Ev({items:e=[],lookup:n}){var o;const i=[],l=new Map(e.map(s=>[s.id,s]));for(const[s,u]of e.entries()){const f=n.get(u.id),d=((o=f==null?void 0:f.internals)==null?void 0:o.userNode)??f;d!==void 0&&d!==u&&i.push({id:u.id,item:u,type:"replace"}),d===void 0&&i.push({item:u,type:"add",index:s})}for(const[s]of n)l.get(s)===void 0&&i.push({id:s,type:"remove"});return i}function Nv(e){return{id:e.id,type:"remove"}}const kv=e=>OT(e),fA=e=>Mw(e);function uS(e){return V.forwardRef(e)}const dA=typeof window<"u"?V.useLayoutEffect:V.useEffect;function Cv(e){const[n,i]=V.useState(BigInt(0)),[l]=V.useState(()=>hA(()=>i(o=>o+BigInt(1))));return dA(()=>{const o=l.get();o.length&&(e(o),l.reset())},[n]),l}function hA(e){let n=[];return{get:()=>n,reset:()=>{n=[]},push:i=>{n.push(i),e()}}}const cS=V.createContext(null);function pA({children:e}){const n=ht(),i=V.useCallback(f=>{const{nodes:d=[],setNodes:h,hasDefaultNodes:m,onNodesChange:p,nodeLookup:y,fitViewQueued:v,onNodesChangeMiddlewareMap:w}=n.getState();let E=d;for(const S of f)E=typeof S=="function"?S(E):S;let _=Ev({items:E,lookup:y});for(const S of w.values())_=S(_);m&&h(E),_.length>0?p==null||p(_):v&&window.requestAnimationFrame(()=>{const{fitViewQueued:S,nodes:z,setNodes:k}=n.getState();S&&k(z)})},[]),l=Cv(i),o=V.useCallback(f=>{const{edges:d=[],setEdges:h,hasDefaultEdges:m,onEdgesChange:p,edgeLookup:y}=n.getState();let v=d;for(const w of f)v=typeof w=="function"?w(v):w;m?h(v):p&&p(Ev({items:v,lookup:y}))},[]),s=Cv(o),u=V.useMemo(()=>({nodeQueue:l,edgeQueue:s}),[]);return b.jsx(cS.Provider,{value:u,children:e})}function mA(){const e=V.useContext(cS);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const gA=e=>!!e.panZoom;function $o(){const e=uA(),n=ht(),i=mA(),l=Ie(gA),o=V.useMemo(()=>{const s=p=>n.getState().nodeLookup.get(p),u=p=>{i.nodeQueue.push(p)},f=p=>{i.edgeQueue.push(p)},d=p=>{var S,z;const{nodeLookup:y,nodeOrigin:v}=n.getState(),w=kv(p)?p:y.get(p.id),E=w.parentId?Hw(w.position,w.measured,w.parentId,y,v):w.position,_={...w,position:E,width:((S=w.measured)==null?void 0:S.width)??w.width,height:((z=w.measured)==null?void 0:z.height)??w.height};return na(_)},h=(p,y,v={replace:!1})=>{u(w=>w.map(E=>{if(E.id===p){const _=typeof y=="function"?y(E):y;return v.replace&&kv(_)?_:{...E,..._}}return E}))},m=(p,y,v={replace:!1})=>{f(w=>w.map(E=>{if(E.id===p){const _=typeof y=="function"?y(E):y;return v.replace&&fA(_)?_:{...E,..._}}return E}))};return{getNodes:()=>n.getState().nodes.map(p=>({...p})),getNode:p=>{var y;return(y=s(p))==null?void 0:y.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:p=[]}=n.getState();return p.map(y=>({...y}))},getEdge:p=>n.getState().edgeLookup.get(p),setNodes:u,setEdges:f,addNodes:p=>{const y=Array.isArray(p)?p:[p];i.nodeQueue.push(v=>[...v,...y])},addEdges:p=>{const y=Array.isArray(p)?p:[p];i.edgeQueue.push(v=>[...v,...y])},toObject:()=>{const{nodes:p=[],edges:y=[],transform:v}=n.getState(),[w,E,_]=v;return{nodes:p.map(S=>({...S})),edges:y.map(S=>({...S})),viewport:{x:w,y:E,zoom:_}}},deleteElements:async({nodes:p=[],edges:y=[]})=>{const{nodes:v,edges:w,onNodesDelete:E,onEdgesDelete:_,triggerNodeChanges:S,triggerEdgeChanges:z,onDelete:k,onBeforeDelete:A}=n.getState(),{nodes:M,edges:T}=await BT({nodesToRemove:p,edgesToRemove:y,nodes:v,edges:w,onBeforeDelete:A}),q=T.length>0,j=M.length>0;if(q){const L=T.map(Nv);_==null||_(T),z(L)}if(j){const L=M.map(Nv);E==null||E(M),S(L)}return(j||q)&&(k==null||k({nodes:M,edges:T})),{deletedNodes:M,deletedEdges:T}},getIntersectingNodes:(p,y=!0,v)=>{const w=Jx(p),E=w?p:d(p),_=v!==void 0;return E?(v||n.getState().nodes).filter(S=>{const z=n.getState().nodeLookup.get(S.id);if(z&&!w&&(S.id===p.id||!z.internals.positionAbsolute))return!1;const k=na(_?S:z),A=Oo(k,E);return y&&A>0||A>=k.width*k.height||A>=E.width*E.height}):[]},isNodeIntersecting:(p,y,v=!0)=>{const E=Jx(p)?p:d(p);if(!E)return!1;const _=Oo(E,y);return v&&_>0||_>=y.width*y.height||_>=E.width*E.height},updateNode:h,updateNodeData:(p,y,v={replace:!1})=>{h(p,w=>{const E=typeof y=="function"?y(w):y;return v.replace?{...w,data:E}:{...w,data:{...w.data,...E}}},v)},updateEdge:m,updateEdgeData:(p,y,v={replace:!1})=>{m(p,w=>{const E=typeof y=="function"?y(w):y;return v.replace?{...w,data:E}:{...w,data:{...w.data,...E}}},v)},getNodesBounds:p=>{const{nodeLookup:y,nodeOrigin:v}=n.getState();return RT(p,{nodeLookup:y,nodeOrigin:v})},getHandleConnections:({type:p,id:y,nodeId:v})=>{var w;return Array.from(((w=n.getState().connectionLookup.get(`${v}-${p}${y?`-${y}`:""}`))==null?void 0:w.values())??[])},getNodeConnections:({type:p,handleId:y,nodeId:v})=>{var w;return Array.from(((w=n.getState().connectionLookup.get(`${v}${p?y?`-${p}-${y}`:`-${p}`:""}`))==null?void 0:w.values())??[])},fitView:async p=>{const y=n.getState().fitViewResolver??VT();return n.setState({fitViewQueued:!0,fitViewOptions:p,fitViewResolver:y}),i.nodeQueue.push(v=>[...v]),y.promise}}},[]);return V.useMemo(()=>({...o,...e,viewportInitialized:l}),[l])}const Tv=e=>e.selected,yA=typeof window<"u"?window:void 0;function xA({deleteKeyCode:e,multiSelectionKeyCode:n}){const i=ht(),{deleteElements:l}=$o(),o=Do(e,{actInsideInputWithModifier:!1}),s=Do(n,{target:yA});V.useEffect(()=>{if(o){const{edges:u,nodes:f}=i.getState();l({nodes:f.filter(Tv),edges:u.filter(Tv)}),i.setState({nodesSelectionActive:!1})}},[o]),V.useEffect(()=>{i.setState({multiSelectionActive:s})},[s])}function vA(e){const n=ht();V.useEffect(()=>{const i=()=>{var o,s,u,f;if(!e.current||!(((s=(o=e.current).checkVisibility)==null?void 0:s.call(o))??!0))return!1;const l=rm(e.current);(l.height===0||l.width===0)&&((f=(u=n.getState()).onError)==null||f.call(u,"004",tr.error004())),n.setState({width:l.width||500,height:l.height||500})};if(e.current){i(),window.addEventListener("resize",i);const l=new ResizeObserver(()=>i());return l.observe(e.current),()=>{window.removeEventListener("resize",i),l&&e.current&&l.unobserve(e.current)}}},[])}const bc={position:"absolute",width:"100%",height:"100%",top:0,left:0},bA=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function wA({onPaneContextMenu:e,zoomOnScroll:n=!0,zoomOnPinch:i=!0,panOnScroll:l=!1,panOnScrollSpeed:o=.5,panOnScrollMode:s=Ii.Free,zoomOnDoubleClick:u=!0,panOnDrag:f=!0,defaultViewport:d,translateExtent:h,minZoom:m,maxZoom:p,zoomActivationKeyCode:y,preventScrolling:v=!0,children:w,noWheelClassName:E,noPanClassName:_,onViewportChange:S,isControlledViewport:z,paneClickDistance:k,selectionOnDrag:A}){const M=ht(),T=V.useRef(null),{userSelectionActive:q,lib:j,connectionInProgress:L}=Ie(bA,dt),X=Do(y),B=V.useRef();vA(T);const I=V.useCallback(ee=>{S==null||S({x:ee[0],y:ee[1],zoom:ee[2]}),z||M.setState({transform:ee})},[S,z]);return V.useEffect(()=>{if(T.current){B.current=Nz({domNode:T.current,minZoom:m,maxZoom:p,translateExtent:h,viewport:d,onDraggingChange:D=>M.setState($=>$.paneDragging===D?$:{paneDragging:D}),onPanZoomStart:(D,$)=>{const{onViewportChangeStart:Z,onMoveStart:J}=M.getState();J==null||J(D,$),Z==null||Z($)},onPanZoom:(D,$)=>{const{onViewportChange:Z,onMove:J}=M.getState();J==null||J(D,$),Z==null||Z($)},onPanZoomEnd:(D,$)=>{const{onViewportChangeEnd:Z,onMoveEnd:J}=M.getState();J==null||J(D,$),Z==null||Z($)}});const{x:ee,y:H,zoom:G}=B.current.getViewport();return M.setState({panZoom:B.current,transform:[ee,H,G],domNode:T.current.closest(".react-flow")}),()=>{var D;(D=B.current)==null||D.destroy()}}},[]),V.useEffect(()=>{var ee;(ee=B.current)==null||ee.update({onPaneContextMenu:e,zoomOnScroll:n,zoomOnPinch:i,panOnScroll:l,panOnScrollSpeed:o,panOnScrollMode:s,zoomOnDoubleClick:u,panOnDrag:f,zoomActivationKeyPressed:X,preventScrolling:v,noPanClassName:_,userSelectionActive:q,noWheelClassName:E,lib:j,onTransformChange:I,connectionInProgress:L,selectionOnDrag:A,paneClickDistance:k})},[e,n,i,l,o,s,u,f,X,v,_,q,E,j,I,L,A,k]),b.jsx("div",{className:"react-flow__renderer",ref:T,style:bc,children:w})}const SA=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function _A(){const{userSelectionActive:e,userSelectionRect:n}=Ie(SA,dt);return e&&n?b.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}const lh=(e,n)=>i=>{i.target===n.current&&(e==null||e(i))},EA=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function NA({isSelecting:e,selectionKeyPressed:n,selectionMode:i=jo.Full,panOnDrag:l,paneClickDistance:o,selectionOnDrag:s,onSelectionStart:u,onSelectionEnd:f,onPaneClick:d,onPaneContextMenu:h,onPaneScroll:m,onPaneMouseEnter:p,onPaneMouseMove:y,onPaneMouseLeave:v,children:w}){const E=ht(),{userSelectionActive:_,elementsSelectable:S,dragging:z,connectionInProgress:k}=Ie(EA,dt),A=S&&(e||_),M=V.useRef(null),T=V.useRef(),q=V.useRef(new Set),j=V.useRef(new Set),L=V.useRef(!1),X=Z=>{if(L.current||k){L.current=!1;return}d==null||d(Z),E.getState().resetSelectedElements(),E.setState({nodesSelectionActive:!1})},B=Z=>{if(Array.isArray(l)&&(l!=null&&l.includes(2))){Z.preventDefault();return}h==null||h(Z)},I=m?Z=>m(Z):void 0,ee=Z=>{L.current&&(Z.stopPropagation(),L.current=!1)},H=Z=>{var P,K;const{domNode:J}=E.getState();if(T.current=J==null?void 0:J.getBoundingClientRect(),!T.current)return;const O=Z.target===M.current;if(!O&&!!Z.target.closest(".nokey")||!e||!(s&&O||n)||Z.button!==0||!Z.isPrimary)return;(K=(P=Z.target)==null?void 0:P.setPointerCapture)==null||K.call(P,Z.pointerId),L.current=!1;const{x:N,y:Y}=Un(Z.nativeEvent,T.current);E.setState({userSelectionRect:{width:0,height:0,startX:N,startY:Y,x:N,y:Y}}),O||(Z.stopPropagation(),Z.preventDefault())},G=Z=>{const{userSelectionRect:J,transform:O,nodeLookup:U,edgeLookup:F,connectionLookup:N,triggerNodeChanges:Y,triggerEdgeChanges:P,defaultEdgeOptions:K,resetSelectedElements:ne}=E.getState();if(!T.current||!J)return;const{x:re,y:se}=Un(Z.nativeEvent,T.current),{startX:ye,startY:ve}=J;if(!L.current){const Ce=n?0:o;if(Math.hypot(re-ye,se-ve)<=Ce)return;ne(),u==null||u(Z)}L.current=!0;const xe={startX:ye,startY:ve,x:reCe.id)),j.current=new Set;const Me=(K==null?void 0:K.selectable)??!0;for(const Ce of q.current){const st=N.get(Ce);if(st)for(const{edgeId:We}of st.values()){const zt=F.get(We);zt&&(zt.selectable??Me)&&j.current.add(We)}}if(!Wx(pe,q.current)){const Ce=Yl(U,q.current,!0);Y(Ce)}if(!Wx(_e,j.current)){const Ce=Yl(F,j.current);P(Ce)}E.setState({userSelectionRect:xe,userSelectionActive:!0,nodesSelectionActive:!1})},D=Z=>{var J,O;Z.button===0&&((O=(J=Z.target)==null?void 0:J.releasePointerCapture)==null||O.call(J,Z.pointerId),!_&&Z.target===M.current&&E.getState().userSelectionRect&&(X==null||X(Z)),E.setState({userSelectionActive:!1,userSelectionRect:null}),L.current&&(f==null||f(Z),E.setState({nodesSelectionActive:q.current.size>0})))},$=l===!0||Array.isArray(l)&&l.includes(0);return b.jsxs("div",{className:Tt(["react-flow__pane",{draggable:$,dragging:z,selection:e}]),onClick:A?void 0:lh(X,M),onContextMenu:lh(B,M),onWheel:lh(I,M),onPointerEnter:A?void 0:p,onPointerMove:A?G:y,onPointerUp:A?D:void 0,onPointerDownCapture:A?H:void 0,onClickCapture:A?ee:void 0,onPointerLeave:v,ref:M,style:bc,children:[w,b.jsx(_A,{})]})}function Mp({id:e,store:n,unselect:i=!1,nodeRef:l}){const{addSelectedNodes:o,unselectNodesAndEdges:s,multiSelectionActive:u,nodeLookup:f,onError:d}=n.getState(),h=f.get(e);if(!h){d==null||d("012",tr.error012(e));return}n.setState({nodesSelectionActive:!1}),h.selected?(i||h.selected&&u)&&(s({nodes:[h],edges:[]}),requestAnimationFrame(()=>{var m;return(m=l==null?void 0:l.current)==null?void 0:m.blur()})):o([e])}function fS({nodeRef:e,disabled:n=!1,noDragClassName:i,handleSelector:l,nodeId:o,isSelectable:s,nodeClickDistance:u}){const f=ht(),[d,h]=V.useState(!1),m=V.useRef();return V.useEffect(()=>{m.current=fz({getStoreItems:()=>f.getState(),onNodeMouseDown:p=>{Mp({id:p,store:f,nodeRef:e})},onDragStart:()=>{h(!0)},onDragStop:()=>{h(!1)}})},[]),V.useEffect(()=>{if(!(n||!e.current||!m.current))return m.current.update({noDragClassName:i,handleSelector:l,domNode:e.current,isSelectable:s,nodeId:o,nodeClickDistance:u}),()=>{var p;(p=m.current)==null||p.destroy()}},[i,l,n,s,e,o,u]),d}const kA=e=>n=>n.selected&&(n.draggable||e&&typeof n.draggable>"u");function dS(){const e=ht();return V.useCallback(i=>{const{nodeExtent:l,snapToGrid:o,snapGrid:s,nodesDraggable:u,onError:f,updateNodePositions:d,nodeLookup:h,nodeOrigin:m}=e.getState(),p=new Map,y=kA(u),v=o?s[0]:5,w=o?s[1]:5,E=i.direction.x*v*i.factor,_=i.direction.y*w*i.factor;for(const[,S]of h){if(!y(S))continue;let z={x:S.internals.positionAbsolute.x+E,y:S.internals.positionAbsolute.y+_};o&&(z=Yo(z,s));const{position:k,positionAbsolute:A}=jw({nodeId:S.id,nextPosition:z,nodeLookup:h,nodeExtent:l,nodeOrigin:m,onError:f});S.position=k,S.internals.positionAbsolute=A,p.set(S.id,S)}d(p)},[])}const cm=V.createContext(null),CA=cm.Provider;cm.Consumer;const hS=()=>V.useContext(cm),TA=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),zA=(e,n,i)=>l=>{const{connectionClickStartHandle:o,connectionMode:s,connection:u}=l,{fromHandle:f,toHandle:d,isValid:h}=u,m=(d==null?void 0:d.nodeId)===e&&(d==null?void 0:d.id)===n&&(d==null?void 0:d.type)===i;return{connectingFrom:(f==null?void 0:f.nodeId)===e&&(f==null?void 0:f.id)===n&&(f==null?void 0:f.type)===i,connectingTo:m,clickConnecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===n&&(o==null?void 0:o.type)===i,isPossibleEndHandle:s===ea.Strict?(f==null?void 0:f.type)!==i:e!==(f==null?void 0:f.nodeId)||n!==(f==null?void 0:f.id),connectionInProcess:!!f,clickConnectionInProcess:!!o,valid:m&&h}};function AA({type:e="source",position:n=we.Top,isValidConnection:i,isConnectable:l=!0,isConnectableStart:o=!0,isConnectableEnd:s=!0,id:u,onConnect:f,children:d,className:h,onMouseDown:m,onTouchStart:p,...y},v){var G,D;const w=u||null,E=e==="target",_=ht(),S=hS(),{connectOnClick:z,noPanClassName:k,rfId:A}=Ie(TA,dt),{connectingFrom:M,connectingTo:T,clickConnecting:q,isPossibleEndHandle:j,connectionInProcess:L,clickConnectionInProcess:X,valid:B}=Ie(zA(S,w,e),dt);S||(D=(G=_.getState()).onError)==null||D.call(G,"010",tr.error010());const I=$=>{const{defaultEdgeOptions:Z,onConnect:J,hasDefaultEdges:O}=_.getState(),U={...Z,...$};if(O){const{edges:F,setEdges:N}=_.getState();N(QT(U,F))}J==null||J(U),f==null||f(U)},ee=$=>{if(!S)return;const Z=Uw($.nativeEvent);if(o&&(Z&&$.button===0||!Z)){const J=_.getState();Ap.onPointerDown($.nativeEvent,{handleDomNode:$.currentTarget,autoPanOnConnect:J.autoPanOnConnect,connectionMode:J.connectionMode,connectionRadius:J.connectionRadius,domNode:J.domNode,nodeLookup:J.nodeLookup,lib:J.lib,isTarget:E,handleId:w,nodeId:S,flowId:J.rfId,panBy:J.panBy,cancelConnection:J.cancelConnection,onConnectStart:J.onConnectStart,onConnectEnd:(...O)=>{var U,F;return(F=(U=_.getState()).onConnectEnd)==null?void 0:F.call(U,...O)},updateConnection:J.updateConnection,onConnect:I,isValidConnection:i||((...O)=>{var U,F;return((F=(U=_.getState()).isValidConnection)==null?void 0:F.call(U,...O))??!0}),getTransform:()=>_.getState().transform,getFromHandle:()=>_.getState().connection.fromHandle,autoPanSpeed:J.autoPanSpeed,dragThreshold:J.connectionDragThreshold})}Z?m==null||m($):p==null||p($)},H=$=>{const{onClickConnectStart:Z,onClickConnectEnd:J,connectionClickStartHandle:O,connectionMode:U,isValidConnection:F,lib:N,rfId:Y,nodeLookup:P,connection:K}=_.getState();if(!S||!O&&!o)return;if(!O){Z==null||Z($.nativeEvent,{nodeId:S,handleId:w,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:S,type:e,id:w}});return}const ne=Bw($.target),re=i||F,{connection:se,isValid:ye}=Ap.isValid($.nativeEvent,{handle:{nodeId:S,id:w,type:e},connectionMode:U,fromNodeId:O.nodeId,fromHandleId:O.id||null,fromType:O.type,isValidConnection:re,flowId:Y,doc:ne,lib:N,nodeLookup:P});ye&&se&&I(se);const ve=structuredClone(K);delete ve.inProgress,ve.toPosition=ve.toHandle?ve.toHandle.position:null,J==null||J($,ve),_.setState({connectionClickStartHandle:null})};return b.jsx("div",{"data-handleid":w,"data-nodeid":S,"data-handlepos":n,"data-id":`${A}-${S}-${w}-${e}`,className:Tt(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",k,h,{source:!E,target:E,connectable:l,connectablestart:o,connectableend:s,clickconnecting:q,connectingfrom:M,connectingto:T,valid:B,connectionindicator:l&&(!L||j)&&(L||X?s:o)}]),onMouseDown:ee,onTouchStart:ee,onClick:z?H:void 0,ref:v,...y,children:d})}const an=V.memo(uS(AA));function MA({data:e,isConnectable:n,sourcePosition:i=we.Bottom}){return b.jsxs(b.Fragment,{children:[e==null?void 0:e.label,b.jsx(an,{type:"source",position:i,isConnectable:n})]})}function jA({data:e,isConnectable:n,targetPosition:i=we.Top,sourcePosition:l=we.Bottom}){return b.jsxs(b.Fragment,{children:[b.jsx(an,{type:"target",position:i,isConnectable:n}),e==null?void 0:e.label,b.jsx(an,{type:"source",position:l,isConnectable:n})]})}function OA(){return null}function RA({data:e,isConnectable:n,targetPosition:i=we.Top}){return b.jsxs(b.Fragment,{children:[b.jsx(an,{type:"target",position:i,isConnectable:n}),e==null?void 0:e.label]})}const nc={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},zv={input:MA,default:jA,output:RA,group:OA};function DA(e){var n,i,l,o;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((n=e.style)==null?void 0:n.width),height:e.height??e.initialHeight??((i=e.style)==null?void 0:i.height)}:{width:e.width??((l=e.style)==null?void 0:l.width),height:e.height??((o=e.style)==null?void 0:o.height)}}const LA=e=>{const{width:n,height:i,x:l,y:o}=Vo(e.nodeLookup,{filter:s=>!!s.selected});return{width:qn(n)?n:null,height:qn(i)?i:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${l}px,${o}px)`}};function HA({onSelectionContextMenu:e,noPanClassName:n,disableKeyboardA11y:i}){const l=ht(),{width:o,height:s,transformString:u,userSelectionActive:f}=Ie(LA,dt),d=dS(),h=V.useRef(null);V.useEffect(()=>{var v;i||(v=h.current)==null||v.focus({preventScroll:!0})},[i]);const m=!f&&o!==null&&s!==null;if(fS({nodeRef:h,disabled:!m}),!m)return null;const p=e?v=>{const w=l.getState().nodes.filter(E=>E.selected);e(v,w)}:void 0,y=v=>{Object.prototype.hasOwnProperty.call(nc,v.key)&&(v.preventDefault(),d({direction:nc[v.key],factor:v.shiftKey?4:1}))};return b.jsx("div",{className:Tt(["react-flow__nodesselection","react-flow__container",n]),style:{transform:u},children:b.jsx("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:p,tabIndex:i?void 0:-1,onKeyDown:i?void 0:y,style:{width:o,height:s}})})}const Av=typeof window<"u"?window:void 0,BA=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function pS({children:e,onPaneClick:n,onPaneMouseEnter:i,onPaneMouseMove:l,onPaneMouseLeave:o,onPaneContextMenu:s,onPaneScroll:u,paneClickDistance:f,deleteKeyCode:d,selectionKeyCode:h,selectionOnDrag:m,selectionMode:p,onSelectionStart:y,onSelectionEnd:v,multiSelectionKeyCode:w,panActivationKeyCode:E,zoomActivationKeyCode:_,elementsSelectable:S,zoomOnScroll:z,zoomOnPinch:k,panOnScroll:A,panOnScrollSpeed:M,panOnScrollMode:T,zoomOnDoubleClick:q,panOnDrag:j,defaultViewport:L,translateExtent:X,minZoom:B,maxZoom:I,preventScrolling:ee,onSelectionContextMenu:H,noWheelClassName:G,noPanClassName:D,disableKeyboardA11y:$,onViewportChange:Z,isControlledViewport:J}){const{nodesSelectionActive:O,userSelectionActive:U}=Ie(BA,dt),F=Do(h,{target:Av}),N=Do(E,{target:Av}),Y=N||j,P=N||A,K=m&&Y!==!0,ne=F||U||K;return xA({deleteKeyCode:d,multiSelectionKeyCode:w}),b.jsx(wA,{onPaneContextMenu:s,elementsSelectable:S,zoomOnScroll:z,zoomOnPinch:k,panOnScroll:P,panOnScrollSpeed:M,panOnScrollMode:T,zoomOnDoubleClick:q,panOnDrag:!F&&Y,defaultViewport:L,translateExtent:X,minZoom:B,maxZoom:I,zoomActivationKeyCode:_,preventScrolling:ee,noWheelClassName:G,noPanClassName:D,onViewportChange:Z,isControlledViewport:J,paneClickDistance:f,selectionOnDrag:K,children:b.jsxs(NA,{onSelectionStart:y,onSelectionEnd:v,onPaneClick:n,onPaneMouseEnter:i,onPaneMouseMove:l,onPaneMouseLeave:o,onPaneContextMenu:s,onPaneScroll:u,panOnDrag:Y,isSelecting:!!ne,selectionMode:p,selectionKeyPressed:F,paneClickDistance:f,selectionOnDrag:K,children:[e,O&&b.jsx(HA,{onSelectionContextMenu:H,noPanClassName:D,disableKeyboardA11y:$})]})})}pS.displayName="FlowRenderer";const qA=V.memo(pS),UA=e=>n=>e?tm(n.nodeLookup,{x:0,y:0,width:n.width,height:n.height},n.transform,!0).map(i=>i.id):Array.from(n.nodeLookup.keys());function IA(e){return Ie(V.useCallback(UA(e),[e]),dt)}const VA=e=>e.updateNodeInternals;function YA(){const e=Ie(VA),[n]=V.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(i=>{const l=new Map;i.forEach(o=>{const s=o.target.getAttribute("data-id");l.set(s,{id:s,nodeElement:o.target,force:!0})}),e(l)}));return V.useEffect(()=>()=>{n==null||n.disconnect()},[n]),n}function GA({node:e,nodeType:n,hasDimensions:i,resizeObserver:l}){const o=ht(),s=V.useRef(null),u=V.useRef(null),f=V.useRef(e.sourcePosition),d=V.useRef(e.targetPosition),h=V.useRef(n),m=i&&!!e.internals.handleBounds;return V.useEffect(()=>{s.current&&!e.hidden&&(!m||u.current!==s.current)&&(u.current&&(l==null||l.unobserve(u.current)),l==null||l.observe(s.current),u.current=s.current)},[m,e.hidden]),V.useEffect(()=>()=>{u.current&&(l==null||l.unobserve(u.current),u.current=null)},[]),V.useEffect(()=>{if(s.current){const p=h.current!==n,y=f.current!==e.sourcePosition,v=d.current!==e.targetPosition;(p||y||v)&&(h.current=n,f.current=e.sourcePosition,d.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,n,e.sourcePosition,e.targetPosition]),s}function $A({id:e,onClick:n,onMouseEnter:i,onMouseMove:l,onMouseLeave:o,onContextMenu:s,onDoubleClick:u,nodesDraggable:f,elementsSelectable:d,nodesConnectable:h,nodesFocusable:m,resizeObserver:p,noDragClassName:y,noPanClassName:v,disableKeyboardA11y:w,rfId:E,nodeTypes:_,nodeClickDistance:S,onError:z}){const{node:k,internals:A,isParent:M}=Ie(re=>{const se=re.nodeLookup.get(e),ye=re.parentLookup.has(e);return{node:se,internals:se.internals,isParent:ye}},dt);let T=k.type||"default",q=(_==null?void 0:_[T])||zv[T];q===void 0&&(z==null||z("003",tr.error003(T)),T="default",q=(_==null?void 0:_.default)||zv.default);const j=!!(k.draggable||f&&typeof k.draggable>"u"),L=!!(k.selectable||d&&typeof k.selectable>"u"),X=!!(k.connectable||h&&typeof k.connectable>"u"),B=!!(k.focusable||m&&typeof k.focusable>"u"),I=ht(),ee=Lw(k),H=GA({node:k,nodeType:T,hasDimensions:ee,resizeObserver:p}),G=fS({nodeRef:H,disabled:k.hidden||!j,noDragClassName:y,handleSelector:k.dragHandle,nodeId:e,isSelectable:L,nodeClickDistance:S}),D=dS();if(k.hidden)return null;const $=Ar(k),Z=DA(k),J=L||j||n||i||l||o,O=i?re=>i(re,{...A.userNode}):void 0,U=l?re=>l(re,{...A.userNode}):void 0,F=o?re=>o(re,{...A.userNode}):void 0,N=s?re=>s(re,{...A.userNode}):void 0,Y=u?re=>u(re,{...A.userNode}):void 0,P=re=>{const{selectNodesOnDrag:se,nodeDragThreshold:ye}=I.getState();L&&(!se||!j||ye>0)&&Mp({id:e,store:I,nodeRef:H}),n&&n(re,{...A.userNode})},K=re=>{if(!(qw(re.nativeEvent)||w)){if(Cw.includes(re.key)&&L){const se=re.key==="Escape";Mp({id:e,store:I,unselect:se,nodeRef:H})}else if(j&&k.selected&&Object.prototype.hasOwnProperty.call(nc,re.key)){re.preventDefault();const{ariaLabelConfig:se}=I.getState();I.setState({ariaLiveMessage:se["node.a11yDescription.ariaLiveMessage"]({direction:re.key.replace("Arrow","").toLowerCase(),x:~~A.positionAbsolute.x,y:~~A.positionAbsolute.y})}),D({direction:nc[re.key],factor:re.shiftKey?4:1})}}},ne=()=>{var _e;if(w||!((_e=H.current)!=null&&_e.matches(":focus-visible")))return;const{transform:re,width:se,height:ye,autoPanOnNodeFocus:ve,setCenter:xe}=I.getState();if(!ve)return;tm(new Map([[e,k]]),{x:0,y:0,width:se,height:ye},re,!0).length>0||xe(k.position.x+$.width/2,k.position.y+$.height/2,{zoom:re[2]})};return b.jsx("div",{className:Tt(["react-flow__node",`react-flow__node-${T}`,{[v]:j},k.className,{selected:k.selected,selectable:L,parent:M,draggable:j,dragging:G}]),ref:H,style:{zIndex:A.z,transform:`translate(${A.positionAbsolute.x}px,${A.positionAbsolute.y}px)`,pointerEvents:J?"all":"none",visibility:ee?"visible":"hidden",...k.style,...Z},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:O,onMouseMove:U,onMouseLeave:F,onContextMenu:N,onClick:P,onDoubleClick:Y,onKeyDown:B?K:void 0,tabIndex:B?0:void 0,onFocus:B?ne:void 0,role:k.ariaRole??(B?"group":void 0),"aria-roledescription":"node","aria-describedby":w?void 0:`${rS}-${E}`,"aria-label":k.ariaLabel,...k.domAttributes,children:b.jsx(CA,{value:e,children:b.jsx(q,{id:e,data:k.data,type:T,positionAbsoluteX:A.positionAbsolute.x,positionAbsoluteY:A.positionAbsolute.y,selected:k.selected??!1,selectable:L,draggable:j,deletable:k.deletable??!0,isConnectable:X,sourcePosition:k.sourcePosition,targetPosition:k.targetPosition,dragging:G,dragHandle:k.dragHandle,zIndex:A.z,parentId:k.parentId,...$})})})}var XA=V.memo($A);const FA=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function mS(e){const{nodesDraggable:n,nodesConnectable:i,nodesFocusable:l,elementsSelectable:o,onError:s}=Ie(FA,dt),u=IA(e.onlyRenderVisibleElements),f=YA();return b.jsx("div",{className:"react-flow__nodes",style:bc,children:u.map(d=>b.jsx(XA,{id:d,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:f,nodesDraggable:n,nodesConnectable:i,nodesFocusable:l,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:s},d))})}mS.displayName="NodeRenderer";const PA=V.memo(mS);function QA(e){return Ie(V.useCallback(i=>{if(!e)return i.edges.map(o=>o.id);const l=[];if(i.width&&i.height)for(const o of i.edges){const s=i.nodeLookup.get(o.source),u=i.nodeLookup.get(o.target);s&&u&&XT({sourceNode:s,targetNode:u,width:i.width,height:i.height,transform:i.transform})&&l.push(o.id)}return l},[e]),dt)}const ZA=({color:e="none",strokeWidth:n=1})=>{const i={strokeWidth:n,...e&&{stroke:e}};return b.jsx("polyline",{className:"arrow",style:i,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},KA=({color:e="none",strokeWidth:n=1})=>{const i={strokeWidth:n,...e&&{stroke:e,fill:e}};return b.jsx("polyline",{className:"arrowclosed",style:i,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Mv={[Wu.Arrow]:ZA,[Wu.ArrowClosed]:KA};function JA(e){const n=ht();return V.useMemo(()=>{var o,s;return Object.prototype.hasOwnProperty.call(Mv,e)?Mv[e]:((s=(o=n.getState()).onError)==null||s.call(o,"009",tr.error009(e)),null)},[e])}const WA=({id:e,type:n,color:i,width:l=12.5,height:o=12.5,markerUnits:s="strokeWidth",strokeWidth:u,orient:f="auto-start-reverse"})=>{const d=JA(n);return d?b.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${l}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:f,refX:"0",refY:"0",children:b.jsx(d,{color:i,strokeWidth:u})}):null},gS=({defaultColor:e,rfId:n})=>{const i=Ie(s=>s.edges),l=Ie(s=>s.defaultEdgeOptions),o=V.useMemo(()=>ez(i,{id:n,defaultColor:e,defaultMarkerStart:l==null?void 0:l.markerStart,defaultMarkerEnd:l==null?void 0:l.markerEnd}),[i,l,n,e]);return o.length?b.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:b.jsx("defs",{children:o.map(s=>b.jsx(WA,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};gS.displayName="MarkerDefinitions";var eM=V.memo(gS);function yS({x:e,y:n,label:i,labelStyle:l,labelShowBg:o=!0,labelBgStyle:s,labelBgPadding:u=[2,4],labelBgBorderRadius:f=2,children:d,className:h,...m}){const[p,y]=V.useState({x:1,y:0,width:0,height:0}),v=Tt(["react-flow__edge-textwrapper",h]),w=V.useRef(null);return V.useEffect(()=>{if(w.current){const E=w.current.getBBox();y({x:E.x,y:E.y,width:E.width,height:E.height})}},[i]),i?b.jsxs("g",{transform:`translate(${e-p.width/2} ${n-p.height/2})`,className:v,visibility:p.width?"visible":"hidden",...m,children:[o&&b.jsx("rect",{width:p.width+2*u[0],x:-u[0],y:-u[1],height:p.height+2*u[1],className:"react-flow__edge-textbg",style:s,rx:f,ry:f}),b.jsx("text",{className:"react-flow__edge-text",y:p.height/2,dy:"0.3em",ref:w,style:l,children:i}),d]}):null}yS.displayName="EdgeText";const tM=V.memo(yS);function Xo({path:e,labelX:n,labelY:i,label:l,labelStyle:o,labelShowBg:s,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d,interactionWidth:h=20,...m}){return b.jsxs(b.Fragment,{children:[b.jsx("path",{...m,d:e,fill:"none",className:Tt(["react-flow__edge-path",m.className])}),h?b.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}):null,l&&qn(n)&&qn(i)?b.jsx(tM,{x:n,y:i,label:l,labelStyle:o,labelShowBg:s,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d}):null]})}function jv({pos:e,x1:n,y1:i,x2:l,y2:o}){return e===we.Left||e===we.Right?[.5*(n+l),i]:[n,.5*(i+o)]}function xS({sourceX:e,sourceY:n,sourcePosition:i=we.Bottom,targetX:l,targetY:o,targetPosition:s=we.Top}){const[u,f]=jv({pos:i,x1:e,y1:n,x2:l,y2:o}),[d,h]=jv({pos:s,x1:l,y1:o,x2:e,y2:n}),[m,p,y,v]=Iw({sourceX:e,sourceY:n,targetX:l,targetY:o,sourceControlX:u,sourceControlY:f,targetControlX:d,targetControlY:h});return[`M${e},${n} C${u},${f} ${d},${h} ${l},${o}`,m,p,y,v]}function vS(e){return V.memo(({id:n,sourceX:i,sourceY:l,targetX:o,targetY:s,sourcePosition:u,targetPosition:f,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:y,labelBgBorderRadius:v,style:w,markerEnd:E,markerStart:_,interactionWidth:S})=>{const[z,k,A]=xS({sourceX:i,sourceY:l,sourcePosition:u,targetX:o,targetY:s,targetPosition:f}),M=e.isInternal?void 0:n;return b.jsx(Xo,{id:M,path:z,labelX:k,labelY:A,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:y,labelBgBorderRadius:v,style:w,markerEnd:E,markerStart:_,interactionWidth:S})})}const nM=vS({isInternal:!1}),bS=vS({isInternal:!0});nM.displayName="SimpleBezierEdge";bS.displayName="SimpleBezierEdgeInternal";function wS(e){return V.memo(({id:n,sourceX:i,sourceY:l,targetX:o,targetY:s,label:u,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:y,sourcePosition:v=we.Bottom,targetPosition:w=we.Top,markerEnd:E,markerStart:_,pathOptions:S,interactionWidth:z})=>{const[k,A,M]=Cp({sourceX:i,sourceY:l,sourcePosition:v,targetX:o,targetY:s,targetPosition:w,borderRadius:S==null?void 0:S.borderRadius,offset:S==null?void 0:S.offset,stepPosition:S==null?void 0:S.stepPosition}),T=e.isInternal?void 0:n;return b.jsx(Xo,{id:T,path:k,labelX:A,labelY:M,label:u,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:y,markerEnd:E,markerStart:_,interactionWidth:z})})}const SS=wS({isInternal:!1}),_S=wS({isInternal:!0});SS.displayName="SmoothStepEdge";_S.displayName="SmoothStepEdgeInternal";function ES(e){return V.memo(({id:n,...i})=>{var o;const l=e.isInternal?void 0:n;return b.jsx(SS,{...i,id:l,pathOptions:V.useMemo(()=>{var s;return{borderRadius:0,offset:(s=i.pathOptions)==null?void 0:s.offset}},[(o=i.pathOptions)==null?void 0:o.offset])})})}const rM=ES({isInternal:!1}),NS=ES({isInternal:!0});rM.displayName="StepEdge";NS.displayName="StepEdgeInternal";function kS(e){return V.memo(({id:n,sourceX:i,sourceY:l,targetX:o,targetY:s,label:u,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:y,markerEnd:v,markerStart:w,interactionWidth:E})=>{const[_,S,z]=Yw({sourceX:i,sourceY:l,targetX:o,targetY:s}),k=e.isInternal?void 0:n;return b.jsx(Xo,{id:k,path:_,labelX:S,labelY:z,label:u,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:y,markerEnd:v,markerStart:w,interactionWidth:E})})}const iM=kS({isInternal:!1}),CS=kS({isInternal:!0});iM.displayName="StraightEdge";CS.displayName="StraightEdgeInternal";function TS(e){return V.memo(({id:n,sourceX:i,sourceY:l,targetX:o,targetY:s,sourcePosition:u=we.Bottom,targetPosition:f=we.Top,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:y,labelBgBorderRadius:v,style:w,markerEnd:E,markerStart:_,pathOptions:S,interactionWidth:z})=>{const[k,A,M]=im({sourceX:i,sourceY:l,sourcePosition:u,targetX:o,targetY:s,targetPosition:f,curvature:S==null?void 0:S.curvature}),T=e.isInternal?void 0:n;return b.jsx(Xo,{id:T,path:k,labelX:A,labelY:M,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:y,labelBgBorderRadius:v,style:w,markerEnd:E,markerStart:_,interactionWidth:z})})}const lM=TS({isInternal:!1}),zS=TS({isInternal:!0});lM.displayName="BezierEdge";zS.displayName="BezierEdgeInternal";const Ov={default:zS,straight:CS,step:NS,smoothstep:_S,simplebezier:bS},Rv={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},aM=(e,n,i)=>i===we.Left?e-n:i===we.Right?e+n:e,oM=(e,n,i)=>i===we.Top?e-n:i===we.Bottom?e+n:e,Dv="react-flow__edgeupdater";function Lv({position:e,centerX:n,centerY:i,radius:l=10,onMouseDown:o,onMouseEnter:s,onMouseOut:u,type:f}){return b.jsx("circle",{onMouseDown:o,onMouseEnter:s,onMouseOut:u,className:Tt([Dv,`${Dv}-${f}`]),cx:aM(n,l,e),cy:oM(i,l,e),r:l,stroke:"transparent",fill:"transparent"})}function sM({isReconnectable:e,reconnectRadius:n,edge:i,sourceX:l,sourceY:o,targetX:s,targetY:u,sourcePosition:f,targetPosition:d,onReconnect:h,onReconnectStart:m,onReconnectEnd:p,setReconnecting:y,setUpdateHover:v}){const w=ht(),E=(A,M)=>{if(A.button!==0)return;const{autoPanOnConnect:T,domNode:q,connectionMode:j,connectionRadius:L,lib:X,onConnectStart:B,cancelConnection:I,nodeLookup:ee,rfId:H,panBy:G,updateConnection:D}=w.getState(),$=M.type==="target",Z=(U,F)=>{y(!1),p==null||p(U,i,M.type,F)},J=U=>h==null?void 0:h(i,U),O=(U,F)=>{y(!0),m==null||m(A,i,M.type),B==null||B(U,F)};Ap.onPointerDown(A.nativeEvent,{autoPanOnConnect:T,connectionMode:j,connectionRadius:L,domNode:q,handleId:M.id,nodeId:M.nodeId,nodeLookup:ee,isTarget:$,edgeUpdaterType:M.type,lib:X,flowId:H,cancelConnection:I,panBy:G,isValidConnection:(...U)=>{var F,N;return((N=(F=w.getState()).isValidConnection)==null?void 0:N.call(F,...U))??!0},onConnect:J,onConnectStart:O,onConnectEnd:(...U)=>{var F,N;return(N=(F=w.getState()).onConnectEnd)==null?void 0:N.call(F,...U)},onReconnectEnd:Z,updateConnection:D,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,dragThreshold:w.getState().connectionDragThreshold,handleDomNode:A.currentTarget})},_=A=>E(A,{nodeId:i.target,id:i.targetHandle??null,type:"target"}),S=A=>E(A,{nodeId:i.source,id:i.sourceHandle??null,type:"source"}),z=()=>v(!0),k=()=>v(!1);return b.jsxs(b.Fragment,{children:[(e===!0||e==="source")&&b.jsx(Lv,{position:f,centerX:l,centerY:o,radius:n,onMouseDown:_,onMouseEnter:z,onMouseOut:k,type:"source"}),(e===!0||e==="target")&&b.jsx(Lv,{position:d,centerX:s,centerY:u,radius:n,onMouseDown:S,onMouseEnter:z,onMouseOut:k,type:"target"})]})}function uM({id:e,edgesFocusable:n,edgesReconnectable:i,elementsSelectable:l,onClick:o,onDoubleClick:s,onContextMenu:u,onMouseEnter:f,onMouseMove:d,onMouseLeave:h,reconnectRadius:m,onReconnect:p,onReconnectStart:y,onReconnectEnd:v,rfId:w,edgeTypes:E,noPanClassName:_,onError:S,disableKeyboardA11y:z}){let k=Ie(xe=>xe.edgeLookup.get(e));const A=Ie(xe=>xe.defaultEdgeOptions);k=A?{...A,...k}:k;let M=k.type||"default",T=(E==null?void 0:E[M])||Ov[M];T===void 0&&(S==null||S("011",tr.error011(M)),M="default",T=(E==null?void 0:E.default)||Ov.default);const q=!!(k.focusable||n&&typeof k.focusable>"u"),j=typeof p<"u"&&(k.reconnectable||i&&typeof k.reconnectable>"u"),L=!!(k.selectable||l&&typeof k.selectable>"u"),X=V.useRef(null),[B,I]=V.useState(!1),[ee,H]=V.useState(!1),G=ht(),{zIndex:D,sourceX:$,sourceY:Z,targetX:J,targetY:O,sourcePosition:U,targetPosition:F}=Ie(V.useCallback(xe=>{const pe=xe.nodeLookup.get(k.source),_e=xe.nodeLookup.get(k.target);if(!pe||!_e)return{zIndex:k.zIndex,...Rv};const Me=WT({id:e,sourceNode:pe,targetNode:_e,sourceHandle:k.sourceHandle||null,targetHandle:k.targetHandle||null,connectionMode:xe.connectionMode,onError:S});return{zIndex:$T({selected:k.selected,zIndex:k.zIndex,sourceNode:pe,targetNode:_e,elevateOnSelect:xe.elevateEdgesOnSelect,zIndexMode:xe.zIndexMode}),...Me||Rv}},[k.source,k.target,k.sourceHandle,k.targetHandle,k.selected,k.zIndex]),dt),N=V.useMemo(()=>k.markerStart?`url('#${Tp(k.markerStart,w)}')`:void 0,[k.markerStart,w]),Y=V.useMemo(()=>k.markerEnd?`url('#${Tp(k.markerEnd,w)}')`:void 0,[k.markerEnd,w]);if(k.hidden||$===null||Z===null||J===null||O===null)return null;const P=xe=>{var Ce;const{addSelectedEdges:pe,unselectNodesAndEdges:_e,multiSelectionActive:Me}=G.getState();L&&(G.setState({nodesSelectionActive:!1}),k.selected&&Me?(_e({nodes:[],edges:[k]}),(Ce=X.current)==null||Ce.blur()):pe([e])),o&&o(xe,k)},K=s?xe=>{s(xe,{...k})}:void 0,ne=u?xe=>{u(xe,{...k})}:void 0,re=f?xe=>{f(xe,{...k})}:void 0,se=d?xe=>{d(xe,{...k})}:void 0,ye=h?xe=>{h(xe,{...k})}:void 0,ve=xe=>{var pe;if(!z&&Cw.includes(xe.key)&&L){const{unselectNodesAndEdges:_e,addSelectedEdges:Me}=G.getState();xe.key==="Escape"?((pe=X.current)==null||pe.blur(),_e({edges:[k]})):Me([e])}};return b.jsx("svg",{style:{zIndex:D},children:b.jsxs("g",{className:Tt(["react-flow__edge",`react-flow__edge-${M}`,k.className,_,{selected:k.selected,animated:k.animated,inactive:!L&&!o,updating:B,selectable:L}]),onClick:P,onDoubleClick:K,onContextMenu:ne,onMouseEnter:re,onMouseMove:se,onMouseLeave:ye,onKeyDown:q?ve:void 0,tabIndex:q?0:void 0,role:k.ariaRole??(q?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":k.ariaLabel===null?void 0:k.ariaLabel||`Edge from ${k.source} to ${k.target}`,"aria-describedby":q?`${iS}-${w}`:void 0,ref:X,...k.domAttributes,children:[!ee&&b.jsx(T,{id:e,source:k.source,target:k.target,type:k.type,selected:k.selected,animated:k.animated,selectable:L,deletable:k.deletable??!0,label:k.label,labelStyle:k.labelStyle,labelShowBg:k.labelShowBg,labelBgStyle:k.labelBgStyle,labelBgPadding:k.labelBgPadding,labelBgBorderRadius:k.labelBgBorderRadius,sourceX:$,sourceY:Z,targetX:J,targetY:O,sourcePosition:U,targetPosition:F,data:k.data,style:k.style,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle,markerStart:N,markerEnd:Y,pathOptions:"pathOptions"in k?k.pathOptions:void 0,interactionWidth:k.interactionWidth}),j&&b.jsx(sM,{edge:k,isReconnectable:j,reconnectRadius:m,onReconnect:p,onReconnectStart:y,onReconnectEnd:v,sourceX:$,sourceY:Z,targetX:J,targetY:O,sourcePosition:U,targetPosition:F,setUpdateHover:I,setReconnecting:H})]})})}var cM=V.memo(uM);const fM=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function AS({defaultMarkerColor:e,onlyRenderVisibleElements:n,rfId:i,edgeTypes:l,noPanClassName:o,onReconnect:s,onEdgeContextMenu:u,onEdgeMouseEnter:f,onEdgeMouseMove:d,onEdgeMouseLeave:h,onEdgeClick:m,reconnectRadius:p,onEdgeDoubleClick:y,onReconnectStart:v,onReconnectEnd:w,disableKeyboardA11y:E}){const{edgesFocusable:_,edgesReconnectable:S,elementsSelectable:z,onError:k}=Ie(fM,dt),A=QA(n);return b.jsxs("div",{className:"react-flow__edges",children:[b.jsx(eM,{defaultColor:e,rfId:i}),A.map(M=>b.jsx(cM,{id:M,edgesFocusable:_,edgesReconnectable:S,elementsSelectable:z,noPanClassName:o,onReconnect:s,onContextMenu:u,onMouseEnter:f,onMouseMove:d,onMouseLeave:h,onClick:m,reconnectRadius:p,onDoubleClick:y,onReconnectStart:v,onReconnectEnd:w,rfId:i,onError:k,edgeTypes:l,disableKeyboardA11y:E},M))]})}AS.displayName="EdgeRenderer";const dM=V.memo(AS),hM=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function pM({children:e}){const n=Ie(hM);return b.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:e})}function mM(e){const n=$o(),i=V.useRef(!1);V.useEffect(()=>{!i.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),i.current=!0)},[e,n.viewportInitialized])}const gM=e=>{var n;return(n=e.panZoom)==null?void 0:n.syncViewport};function yM(e){const n=Ie(gM),i=ht();return V.useEffect(()=>{e&&(n==null||n(e),i.setState({transform:[e.x,e.y,e.zoom]}))},[e,n]),null}function xM(e){return e.connection.inProgress?{...e.connection,to:Go(e.connection.to,e.transform)}:{...e.connection}}function vM(e){return xM}function bM(e){const n=vM();return Ie(n,dt)}const wM=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function SM({containerStyle:e,style:n,type:i,component:l}){const{nodesConnectable:o,width:s,height:u,isValid:f,inProgress:d}=Ie(wM,dt);return!(s&&o&&d)?null:b.jsx("svg",{style:e,width:s,height:u,className:"react-flow__connectionline react-flow__container",children:b.jsx("g",{className:Tt(["react-flow__connection",Aw(f)]),children:b.jsx(MS,{style:n,type:i,CustomComponent:l,isValid:f})})})}const MS=({style:e,type:n=fi.Bezier,CustomComponent:i,isValid:l})=>{const{inProgress:o,from:s,fromNode:u,fromHandle:f,fromPosition:d,to:h,toNode:m,toHandle:p,toPosition:y,pointer:v}=bM();if(!o)return;if(i)return b.jsx(i,{connectionLineType:n,connectionLineStyle:e,fromNode:u,fromHandle:f,fromX:s.x,fromY:s.y,toX:h.x,toY:h.y,fromPosition:d,toPosition:y,connectionStatus:Aw(l),toNode:m,toHandle:p,pointer:v});let w="";const E={sourceX:s.x,sourceY:s.y,sourcePosition:d,targetX:h.x,targetY:h.y,targetPosition:y};switch(n){case fi.Bezier:[w]=im(E);break;case fi.SimpleBezier:[w]=xS(E);break;case fi.Step:[w]=Cp({...E,borderRadius:0});break;case fi.SmoothStep:[w]=Cp(E);break;default:[w]=Yw(E)}return b.jsx("path",{d:w,fill:"none",className:"react-flow__connection-path",style:e})};MS.displayName="ConnectionLine";const _M={};function Hv(e=_M){V.useRef(e),ht(),V.useEffect(()=>{},[e])}function EM(){ht(),V.useRef(!1),V.useEffect(()=>{},[])}function jS({nodeTypes:e,edgeTypes:n,onInit:i,onNodeClick:l,onEdgeClick:o,onNodeDoubleClick:s,onEdgeDoubleClick:u,onNodeMouseEnter:f,onNodeMouseMove:d,onNodeMouseLeave:h,onNodeContextMenu:m,onSelectionContextMenu:p,onSelectionStart:y,onSelectionEnd:v,connectionLineType:w,connectionLineStyle:E,connectionLineComponent:_,connectionLineContainerStyle:S,selectionKeyCode:z,selectionOnDrag:k,selectionMode:A,multiSelectionKeyCode:M,panActivationKeyCode:T,zoomActivationKeyCode:q,deleteKeyCode:j,onlyRenderVisibleElements:L,elementsSelectable:X,defaultViewport:B,translateExtent:I,minZoom:ee,maxZoom:H,preventScrolling:G,defaultMarkerColor:D,zoomOnScroll:$,zoomOnPinch:Z,panOnScroll:J,panOnScrollSpeed:O,panOnScrollMode:U,zoomOnDoubleClick:F,panOnDrag:N,onPaneClick:Y,onPaneMouseEnter:P,onPaneMouseMove:K,onPaneMouseLeave:ne,onPaneScroll:re,onPaneContextMenu:se,paneClickDistance:ye,nodeClickDistance:ve,onEdgeContextMenu:xe,onEdgeMouseEnter:pe,onEdgeMouseMove:_e,onEdgeMouseLeave:Me,reconnectRadius:Ce,onReconnect:st,onReconnectStart:We,onReconnectEnd:zt,noDragClassName:Ut,noWheelClassName:Rt,noPanClassName:wn,disableKeyboardA11y:Mn,nodeExtent:At,rfId:Mr,viewport:ue,onViewportChange:ge}){return Hv(e),Hv(n),EM(),mM(i),yM(ue),b.jsx(qA,{onPaneClick:Y,onPaneMouseEnter:P,onPaneMouseMove:K,onPaneMouseLeave:ne,onPaneContextMenu:se,onPaneScroll:re,paneClickDistance:ye,deleteKeyCode:j,selectionKeyCode:z,selectionOnDrag:k,selectionMode:A,onSelectionStart:y,onSelectionEnd:v,multiSelectionKeyCode:M,panActivationKeyCode:T,zoomActivationKeyCode:q,elementsSelectable:X,zoomOnScroll:$,zoomOnPinch:Z,zoomOnDoubleClick:F,panOnScroll:J,panOnScrollSpeed:O,panOnScrollMode:U,panOnDrag:N,defaultViewport:B,translateExtent:I,minZoom:ee,maxZoom:H,onSelectionContextMenu:p,preventScrolling:G,noDragClassName:Ut,noWheelClassName:Rt,noPanClassName:wn,disableKeyboardA11y:Mn,onViewportChange:ge,isControlledViewport:!!ue,children:b.jsxs(pM,{children:[b.jsx(dM,{edgeTypes:n,onEdgeClick:o,onEdgeDoubleClick:u,onReconnect:st,onReconnectStart:We,onReconnectEnd:zt,onlyRenderVisibleElements:L,onEdgeContextMenu:xe,onEdgeMouseEnter:pe,onEdgeMouseMove:_e,onEdgeMouseLeave:Me,reconnectRadius:Ce,defaultMarkerColor:D,noPanClassName:wn,disableKeyboardA11y:Mn,rfId:Mr}),b.jsx(SM,{style:E,type:w,component:_,containerStyle:S}),b.jsx("div",{className:"react-flow__edgelabel-renderer"}),b.jsx(PA,{nodeTypes:e,onNodeClick:l,onNodeDoubleClick:s,onNodeMouseEnter:f,onNodeMouseMove:d,onNodeMouseLeave:h,onNodeContextMenu:m,nodeClickDistance:ve,onlyRenderVisibleElements:L,noPanClassName:wn,noDragClassName:Ut,disableKeyboardA11y:Mn,nodeExtent:At,rfId:Mr}),b.jsx("div",{className:"react-flow__viewport-portal"})]})})}jS.displayName="GraphView";const NM=V.memo(jS),Bv=({nodes:e,edges:n,defaultNodes:i,defaultEdges:l,width:o,height:s,fitView:u,fitViewOptions:f,minZoom:d=.5,maxZoom:h=2,nodeOrigin:m,nodeExtent:p,zIndexMode:y="basic"}={})=>{const v=new Map,w=new Map,E=new Map,_=new Map,S=l??n??[],z=i??e??[],k=m??[0,0],A=p??Mo;Xw(E,_,S);const M=zp(z,v,w,{nodeOrigin:k,nodeExtent:A,zIndexMode:y});let T=[0,0,1];if(u&&o&&s){const q=Vo(v,{filter:B=>!!((B.width||B.initialWidth)&&(B.height||B.initialHeight))}),{x:j,y:L,zoom:X}=nm(q,o,s,d,h,(f==null?void 0:f.padding)??.1);T=[j,L,X]}return{rfId:"1",width:o??0,height:s??0,transform:T,nodes:z,nodesInitialized:M,nodeLookup:v,parentLookup:w,edges:S,edgeLookup:_,connectionLookup:E,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:i!==void 0,hasDefaultEdges:l!==void 0,panZoom:null,minZoom:d,maxZoom:h,translateExtent:Mo,nodeExtent:A,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:ea.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:k,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:u??!1,fitViewOptions:f,fitViewResolver:null,connection:{...zw},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:qT,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Tw,zIndexMode:y,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},kM=({nodes:e,edges:n,defaultNodes:i,defaultEdges:l,width:o,height:s,fitView:u,fitViewOptions:f,minZoom:d,maxZoom:h,nodeOrigin:m,nodeExtent:p,zIndexMode:y})=>Yz((v,w)=>{async function E(){const{nodeLookup:_,panZoom:S,fitViewOptions:z,fitViewResolver:k,width:A,height:M,minZoom:T,maxZoom:q}=w();S&&(await HT({nodes:_,width:A,height:M,panZoom:S,minZoom:T,maxZoom:q},z),k==null||k.resolve(!0),v({fitViewResolver:null}))}return{...Bv({nodes:e,edges:n,width:o,height:s,fitView:u,fitViewOptions:f,minZoom:d,maxZoom:h,nodeOrigin:m,nodeExtent:p,defaultNodes:i,defaultEdges:l,zIndexMode:y}),setNodes:_=>{const{nodeLookup:S,parentLookup:z,nodeOrigin:k,elevateNodesOnSelect:A,fitViewQueued:M,zIndexMode:T}=w(),q=zp(_,S,z,{nodeOrigin:k,nodeExtent:p,elevateNodesOnSelect:A,checkEquality:!0,zIndexMode:T});M&&q?(E(),v({nodes:_,nodesInitialized:q,fitViewQueued:!1,fitViewOptions:void 0})):v({nodes:_,nodesInitialized:q})},setEdges:_=>{const{connectionLookup:S,edgeLookup:z}=w();Xw(S,z,_),v({edges:_})},setDefaultNodesAndEdges:(_,S)=>{if(_){const{setNodes:z}=w();z(_),v({hasDefaultNodes:!0})}if(S){const{setEdges:z}=w();z(S),v({hasDefaultEdges:!0})}},updateNodeInternals:_=>{const{triggerNodeChanges:S,nodeLookup:z,parentLookup:k,domNode:A,nodeOrigin:M,nodeExtent:T,debug:q,fitViewQueued:j,zIndexMode:L}=w(),{changes:X,updatedInternals:B}=oz(_,z,k,A,M,T,L);B&&(rz(z,k,{nodeOrigin:M,nodeExtent:T,zIndexMode:L}),j?(E(),v({fitViewQueued:!1,fitViewOptions:void 0})):v({}),(X==null?void 0:X.length)>0&&(q&&console.log("React Flow: trigger node changes",X),S==null||S(X)))},updateNodePositions:(_,S=!1)=>{const z=[];let k=[];const{nodeLookup:A,triggerNodeChanges:M,connection:T,updateConnection:q,onNodesChangeMiddlewareMap:j}=w();for(const[L,X]of _){const B=A.get(L),I=!!(B!=null&&B.expandParent&&(B!=null&&B.parentId)&&(X!=null&&X.position)),ee={id:L,type:"position",position:I?{x:Math.max(0,X.position.x),y:Math.max(0,X.position.y)}:X.position,dragging:S};if(B&&T.inProgress&&T.fromNode.id===B.id){const H=Xi(B,T.fromHandle,we.Left,!0);q({...T,from:H})}I&&B.parentId&&z.push({id:L,parentId:B.parentId,rect:{...X.internals.positionAbsolute,width:X.measured.width??0,height:X.measured.height??0}}),k.push(ee)}if(z.length>0){const{parentLookup:L,nodeOrigin:X}=w(),B=um(z,A,L,X);k.push(...B)}for(const L of j.values())k=L(k);M(k)},triggerNodeChanges:_=>{const{onNodesChange:S,setNodes:z,nodes:k,hasDefaultNodes:A,debug:M}=w();if(_!=null&&_.length){if(A){const T=oS(_,k);z(T)}M&&console.log("React Flow: trigger node changes",_),S==null||S(_)}},triggerEdgeChanges:_=>{const{onEdgesChange:S,setEdges:z,edges:k,hasDefaultEdges:A,debug:M}=w();if(_!=null&&_.length){if(A){const T=sS(_,k);z(T)}M&&console.log("React Flow: trigger edge changes",_),S==null||S(_)}},addSelectedNodes:_=>{const{multiSelectionActive:S,edgeLookup:z,nodeLookup:k,triggerNodeChanges:A,triggerEdgeChanges:M}=w();if(S){const T=_.map(q=>Di(q,!0));A(T);return}A(Yl(k,new Set([..._]),!0)),M(Yl(z))},addSelectedEdges:_=>{const{multiSelectionActive:S,edgeLookup:z,nodeLookup:k,triggerNodeChanges:A,triggerEdgeChanges:M}=w();if(S){const T=_.map(q=>Di(q,!0));M(T);return}M(Yl(z,new Set([..._]))),A(Yl(k,new Set,!0))},unselectNodesAndEdges:({nodes:_,edges:S}={})=>{const{edges:z,nodes:k,nodeLookup:A,triggerNodeChanges:M,triggerEdgeChanges:T}=w(),q=_||k,j=S||z,L=[];for(const B of q){if(!B.selected)continue;const I=A.get(B.id);I&&(I.selected=!1),L.push(Di(B.id,!1))}const X=[];for(const B of j)B.selected&&X.push(Di(B.id,!1));M(L),T(X)},setMinZoom:_=>{const{panZoom:S,maxZoom:z}=w();S==null||S.setScaleExtent([_,z]),v({minZoom:_})},setMaxZoom:_=>{const{panZoom:S,minZoom:z}=w();S==null||S.setScaleExtent([z,_]),v({maxZoom:_})},setTranslateExtent:_=>{var S;(S=w().panZoom)==null||S.setTranslateExtent(_),v({translateExtent:_})},resetSelectedElements:()=>{const{edges:_,nodes:S,triggerNodeChanges:z,triggerEdgeChanges:k,elementsSelectable:A}=w();if(!A)return;const M=S.reduce((q,j)=>j.selected?[...q,Di(j.id,!1)]:q,[]),T=_.reduce((q,j)=>j.selected?[...q,Di(j.id,!1)]:q,[]);z(M),k(T)},setNodeExtent:_=>{const{nodes:S,nodeLookup:z,parentLookup:k,nodeOrigin:A,elevateNodesOnSelect:M,nodeExtent:T,zIndexMode:q}=w();_[0][0]===T[0][0]&&_[0][1]===T[0][1]&&_[1][0]===T[1][0]&&_[1][1]===T[1][1]||(zp(S,z,k,{nodeOrigin:A,nodeExtent:_,elevateNodesOnSelect:M,checkEquality:!1,zIndexMode:q}),v({nodeExtent:_}))},panBy:_=>{const{transform:S,width:z,height:k,panZoom:A,translateExtent:M}=w();return sz({delta:_,panZoom:A,transform:S,translateExtent:M,width:z,height:k})},setCenter:async(_,S,z)=>{const{width:k,height:A,maxZoom:M,panZoom:T}=w();if(!T)return Promise.resolve(!1);const q=typeof(z==null?void 0:z.zoom)<"u"?z.zoom:M;return await T.setViewport({x:k/2-_*q,y:A/2-S*q,zoom:q},{duration:z==null?void 0:z.duration,ease:z==null?void 0:z.ease,interpolate:z==null?void 0:z.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{v({connection:{...zw}})},updateConnection:_=>{v({connection:_})},reset:()=>v({...Bv()})}},Object.is);function CM({initialNodes:e,initialEdges:n,defaultNodes:i,defaultEdges:l,initialWidth:o,initialHeight:s,initialMinZoom:u,initialMaxZoom:f,initialFitViewOptions:d,fitView:h,nodeOrigin:m,nodeExtent:p,zIndexMode:y,children:v}){const[w]=V.useState(()=>kM({nodes:e,edges:n,defaultNodes:i,defaultEdges:l,width:o,height:s,fitView:h,minZoom:u,maxZoom:f,fitViewOptions:d,nodeOrigin:m,nodeExtent:p,zIndexMode:y}));return b.jsx($z,{value:w,children:b.jsx(pA,{children:v})})}function TM({children:e,nodes:n,edges:i,defaultNodes:l,defaultEdges:o,width:s,height:u,fitView:f,fitViewOptions:d,minZoom:h,maxZoom:m,nodeOrigin:p,nodeExtent:y,zIndexMode:v}){return V.useContext(xc)?b.jsx(b.Fragment,{children:e}):b.jsx(CM,{initialNodes:n,initialEdges:i,defaultNodes:l,defaultEdges:o,initialWidth:s,initialHeight:u,fitView:f,initialFitViewOptions:d,initialMinZoom:h,initialMaxZoom:m,nodeOrigin:p,nodeExtent:y,zIndexMode:v,children:e})}const zM={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function AM({nodes:e,edges:n,defaultNodes:i,defaultEdges:l,className:o,nodeTypes:s,edgeTypes:u,onNodeClick:f,onEdgeClick:d,onInit:h,onMove:m,onMoveStart:p,onMoveEnd:y,onConnect:v,onConnectStart:w,onConnectEnd:E,onClickConnectStart:_,onClickConnectEnd:S,onNodeMouseEnter:z,onNodeMouseMove:k,onNodeMouseLeave:A,onNodeContextMenu:M,onNodeDoubleClick:T,onNodeDragStart:q,onNodeDrag:j,onNodeDragStop:L,onNodesDelete:X,onEdgesDelete:B,onDelete:I,onSelectionChange:ee,onSelectionDragStart:H,onSelectionDrag:G,onSelectionDragStop:D,onSelectionContextMenu:$,onSelectionStart:Z,onSelectionEnd:J,onBeforeDelete:O,connectionMode:U,connectionLineType:F=fi.Bezier,connectionLineStyle:N,connectionLineComponent:Y,connectionLineContainerStyle:P,deleteKeyCode:K="Backspace",selectionKeyCode:ne="Shift",selectionOnDrag:re=!1,selectionMode:se=jo.Full,panActivationKeyCode:ye="Space",multiSelectionKeyCode:ve=Ro()?"Meta":"Control",zoomActivationKeyCode:xe=Ro()?"Meta":"Control",snapToGrid:pe,snapGrid:_e,onlyRenderVisibleElements:Me=!1,selectNodesOnDrag:Ce,nodesDraggable:st,autoPanOnNodeFocus:We,nodesConnectable:zt,nodesFocusable:Ut,nodeOrigin:Rt=lS,edgesFocusable:wn,edgesReconnectable:Mn,elementsSelectable:At=!0,defaultViewport:Mr=iA,minZoom:ue=.5,maxZoom:ge=2,translateExtent:Ne=Mo,preventScrolling:De=!0,nodeExtent:Ve,defaultMarkerColor:$t="#b1b1b7",zoomOnScroll:jn=!0,zoomOnPinch:Dt=!0,panOnScroll:yt=!1,panOnScrollSpeed:It=.5,panOnScrollMode:Ze=Ii.Free,zoomOnDoubleClick:Gn=!0,panOnDrag:sn=!0,onPaneClick:Ec,onPaneMouseEnter:Zi,onPaneMouseMove:Ki,onPaneMouseLeave:Ji,onPaneScroll:ir,onPaneContextMenu:Wi,paneClickDistance:hi=1,nodeClickDistance:Nc=0,children:Qo,onReconnect:ca,onReconnectStart:pi,onReconnectEnd:kc,onEdgeContextMenu:Zo,onEdgeDoubleClick:Ko,onEdgeMouseEnter:Jo,onEdgeMouseMove:fa,onEdgeMouseLeave:da,reconnectRadius:Wo=10,onNodesChange:es,onEdgesChange:$n,noDragClassName:Mt="nodrag",noWheelClassName:Vt="nowheel",noPanClassName:lr="nopan",fitView:el,fitViewOptions:ts,connectOnClick:Cc,attributionPosition:ns,proOptions:mi,defaultEdgeOptions:ha,elevateNodesOnSelect:jr=!0,elevateEdgesOnSelect:Or=!1,disableKeyboardA11y:Rr=!1,autoPanOnConnect:Dr,autoPanOnNodeDrag:bt,autoPanSpeed:rs,connectionRadius:is,isValidConnection:ar,onError:Lr,style:Tc,id:pa,nodeDragThreshold:ls,connectionDragThreshold:zc,viewport:tl,onViewportChange:nl,width:On,height:Ft,colorMode:as="light",debug:Ac,onScroll:Hr,ariaLabelConfig:os,zIndexMode:gi="basic",...Mc},Pt){const yi=pa||"1",ss=sA(as),ma=V.useCallback(or=>{or.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Hr==null||Hr(or)},[Hr]);return b.jsx("div",{"data-testid":"rf__wrapper",...Mc,onScroll:ma,style:{...Tc,...zM},ref:Pt,className:Tt(["react-flow",o,ss]),id:pa,role:"application",children:b.jsxs(TM,{nodes:e,edges:n,width:On,height:Ft,fitView:el,fitViewOptions:ts,minZoom:ue,maxZoom:ge,nodeOrigin:Rt,nodeExtent:Ve,zIndexMode:gi,children:[b.jsx(NM,{onInit:h,onNodeClick:f,onEdgeClick:d,onNodeMouseEnter:z,onNodeMouseMove:k,onNodeMouseLeave:A,onNodeContextMenu:M,onNodeDoubleClick:T,nodeTypes:s,edgeTypes:u,connectionLineType:F,connectionLineStyle:N,connectionLineComponent:Y,connectionLineContainerStyle:P,selectionKeyCode:ne,selectionOnDrag:re,selectionMode:se,deleteKeyCode:K,multiSelectionKeyCode:ve,panActivationKeyCode:ye,zoomActivationKeyCode:xe,onlyRenderVisibleElements:Me,defaultViewport:Mr,translateExtent:Ne,minZoom:ue,maxZoom:ge,preventScrolling:De,zoomOnScroll:jn,zoomOnPinch:Dt,zoomOnDoubleClick:Gn,panOnScroll:yt,panOnScrollSpeed:It,panOnScrollMode:Ze,panOnDrag:sn,onPaneClick:Ec,onPaneMouseEnter:Zi,onPaneMouseMove:Ki,onPaneMouseLeave:Ji,onPaneScroll:ir,onPaneContextMenu:Wi,paneClickDistance:hi,nodeClickDistance:Nc,onSelectionContextMenu:$,onSelectionStart:Z,onSelectionEnd:J,onReconnect:ca,onReconnectStart:pi,onReconnectEnd:kc,onEdgeContextMenu:Zo,onEdgeDoubleClick:Ko,onEdgeMouseEnter:Jo,onEdgeMouseMove:fa,onEdgeMouseLeave:da,reconnectRadius:Wo,defaultMarkerColor:$t,noDragClassName:Mt,noWheelClassName:Vt,noPanClassName:lr,rfId:yi,disableKeyboardA11y:Rr,nodeExtent:Ve,viewport:tl,onViewportChange:nl}),b.jsx(oA,{nodes:e,edges:n,defaultNodes:i,defaultEdges:l,onConnect:v,onConnectStart:w,onConnectEnd:E,onClickConnectStart:_,onClickConnectEnd:S,nodesDraggable:st,autoPanOnNodeFocus:We,nodesConnectable:zt,nodesFocusable:Ut,edgesFocusable:wn,edgesReconnectable:Mn,elementsSelectable:At,elevateNodesOnSelect:jr,elevateEdgesOnSelect:Or,minZoom:ue,maxZoom:ge,nodeExtent:Ve,onNodesChange:es,onEdgesChange:$n,snapToGrid:pe,snapGrid:_e,connectionMode:U,translateExtent:Ne,connectOnClick:Cc,defaultEdgeOptions:ha,fitView:el,fitViewOptions:ts,onNodesDelete:X,onEdgesDelete:B,onDelete:I,onNodeDragStart:q,onNodeDrag:j,onNodeDragStop:L,onSelectionDrag:G,onSelectionDragStart:H,onSelectionDragStop:D,onMove:m,onMoveStart:p,onMoveEnd:y,noPanClassName:lr,nodeOrigin:Rt,rfId:yi,autoPanOnConnect:Dr,autoPanOnNodeDrag:bt,autoPanSpeed:rs,onError:Lr,connectionRadius:is,isValidConnection:ar,selectNodesOnDrag:Ce,nodeDragThreshold:ls,connectionDragThreshold:zc,onBeforeDelete:O,debug:Ac,ariaLabelConfig:os,zIndexMode:gi}),b.jsx(rA,{onSelectionChange:ee}),Qo,b.jsx(Jz,{proOptions:mi,position:ns}),b.jsx(Kz,{rfId:yi,disableKeyboardA11y:Rr})]})})}var MM=uS(AM);const jM=e=>{var n;return(n=e.domNode)==null?void 0:n.querySelector(".react-flow__edgelabel-renderer")};function OM({children:e}){const n=Ie(jM);return n?Gz.createPortal(e,n):null}function RM(e){const[n,i]=V.useState(e),l=V.useCallback(o=>i(s=>oS(o,s)),[]);return[n,i,l]}function DM(e){const[n,i]=V.useState(e),l=V.useCallback(o=>i(s=>sS(o,s)),[]);return[n,i,l]}function LM({dimensions:e,lineWidth:n,variant:i,className:l}){return b.jsx("path",{strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Tt(["react-flow__background-pattern",i,l])})}function HM({radius:e,className:n}){return b.jsx("circle",{cx:e,cy:e,r:e,className:Tt(["react-flow__background-pattern","dots",n])})}var Tr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Tr||(Tr={}));const BM={[Tr.Dots]:1,[Tr.Lines]:1,[Tr.Cross]:6},qM=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function OS({id:e,variant:n=Tr.Dots,gap:i=20,size:l,lineWidth:o=1,offset:s=0,color:u,bgColor:f,style:d,className:h,patternClassName:m}){const p=V.useRef(null),{transform:y,patternId:v}=Ie(qM,dt),w=l||BM[n],E=n===Tr.Dots,_=n===Tr.Cross,S=Array.isArray(i)?i:[i,i],z=[S[0]*y[2]||1,S[1]*y[2]||1],k=w*y[2],A=Array.isArray(s)?s:[s,s],M=_?[k,k]:z,T=[A[0]*y[2]||1+M[0]/2,A[1]*y[2]||1+M[1]/2],q=`${v}${e||""}`;return b.jsxs("svg",{className:Tt(["react-flow__background",h]),style:{...d,...bc,"--xy-background-color-props":f,"--xy-background-pattern-color-props":u},ref:p,"data-testid":"rf__background",children:[b.jsx("pattern",{id:q,x:y[0]%z[0],y:y[1]%z[1],width:z[0],height:z[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`,children:E?b.jsx(HM,{radius:k/2,className:m}):b.jsx(LM,{dimensions:M,lineWidth:o,variant:n,className:m})}),b.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${q})`})]})}OS.displayName="Background";const UM=V.memo(OS);function IM(){return b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:b.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function VM(){return b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:b.jsx("path",{d:"M0 0h32v4.2H0z"})})}function YM(){return b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:b.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function GM(){return b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:b.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function $M(){return b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:b.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Mu({children:e,className:n,...i}){return b.jsx("button",{type:"button",className:Tt(["react-flow__controls-button",n]),...i,children:e})}const XM=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function RS({style:e,showZoom:n=!0,showFitView:i=!0,showInteractive:l=!0,fitViewOptions:o,onZoomIn:s,onZoomOut:u,onFitView:f,onInteractiveChange:d,className:h,children:m,position:p="bottom-left",orientation:y="vertical","aria-label":v}){const w=ht(),{isInteractive:E,minZoomReached:_,maxZoomReached:S,ariaLabelConfig:z}=Ie(XM,dt),{zoomIn:k,zoomOut:A,fitView:M}=$o(),T=()=>{k(),s==null||s()},q=()=>{A(),u==null||u()},j=()=>{M(o),f==null||f()},L=()=>{w.setState({nodesDraggable:!E,nodesConnectable:!E,elementsSelectable:!E}),d==null||d(!E)},X=y==="horizontal"?"horizontal":"vertical";return b.jsxs(vc,{className:Tt(["react-flow__controls",X,h]),position:p,style:e,"data-testid":"rf__controls","aria-label":v??z["controls.ariaLabel"],children:[n&&b.jsxs(b.Fragment,{children:[b.jsx(Mu,{onClick:T,className:"react-flow__controls-zoomin",title:z["controls.zoomIn.ariaLabel"],"aria-label":z["controls.zoomIn.ariaLabel"],disabled:S,children:b.jsx(IM,{})}),b.jsx(Mu,{onClick:q,className:"react-flow__controls-zoomout",title:z["controls.zoomOut.ariaLabel"],"aria-label":z["controls.zoomOut.ariaLabel"],disabled:_,children:b.jsx(VM,{})})]}),i&&b.jsx(Mu,{className:"react-flow__controls-fitview",onClick:j,title:z["controls.fitView.ariaLabel"],"aria-label":z["controls.fitView.ariaLabel"],children:b.jsx(YM,{})}),l&&b.jsx(Mu,{className:"react-flow__controls-interactive",onClick:L,title:z["controls.interactive.ariaLabel"],"aria-label":z["controls.interactive.ariaLabel"],children:E?b.jsx($M,{}):b.jsx(GM,{})}),m]})}RS.displayName="Controls";const FM=V.memo(RS);function PM({id:e,x:n,y:i,width:l,height:o,style:s,color:u,strokeColor:f,strokeWidth:d,className:h,borderRadius:m,shapeRendering:p,selected:y,onClick:v}){const{background:w,backgroundColor:E}=s||{},_=u||w||E;return b.jsx("rect",{className:Tt(["react-flow__minimap-node",{selected:y},h]),x:n,y:i,rx:m,ry:m,width:l,height:o,style:{fill:_,stroke:f,strokeWidth:d},shapeRendering:p,onClick:v?S=>v(S,e):void 0})}const QM=V.memo(PM),ZM=e=>e.nodes.map(n=>n.id),ah=e=>e instanceof Function?e:()=>e;function KM({nodeStrokeColor:e,nodeColor:n,nodeClassName:i="",nodeBorderRadius:l=5,nodeStrokeWidth:o,nodeComponent:s=QM,onClick:u}){const f=Ie(ZM,dt),d=ah(n),h=ah(e),m=ah(i),p=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return b.jsx(b.Fragment,{children:f.map(y=>b.jsx(WM,{id:y,nodeColorFunc:d,nodeStrokeColorFunc:h,nodeClassNameFunc:m,nodeBorderRadius:l,nodeStrokeWidth:o,NodeComponent:s,onClick:u,shapeRendering:p},y))})}function JM({id:e,nodeColorFunc:n,nodeStrokeColorFunc:i,nodeClassNameFunc:l,nodeBorderRadius:o,nodeStrokeWidth:s,shapeRendering:u,NodeComponent:f,onClick:d}){const{node:h,x:m,y:p,width:y,height:v}=Ie(w=>{const E=w.nodeLookup.get(e);if(!E)return{node:void 0,x:0,y:0,width:0,height:0};const _=E.internals.userNode,{x:S,y:z}=E.internals.positionAbsolute,{width:k,height:A}=Ar(_);return{node:_,x:S,y:z,width:k,height:A}},dt);return!h||h.hidden||!Lw(h)?null:b.jsx(f,{x:m,y:p,width:y,height:v,style:h.style,selected:!!h.selected,className:l(h),color:n(h),borderRadius:o,strokeColor:i(h),strokeWidth:s,shapeRendering:u,onClick:d,id:h.id})}const WM=V.memo(JM);var ej=V.memo(KM);const tj=200,nj=150,rj=e=>!e.hidden,ij=e=>{const n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:e.nodeLookup.size>0?Dw(Vo(e.nodeLookup,{filter:rj}),n):n,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},lj="react-flow__minimap-desc";function DS({style:e,className:n,nodeStrokeColor:i,nodeColor:l,nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:u,nodeComponent:f,bgColor:d,maskColor:h,maskStrokeColor:m,maskStrokeWidth:p,position:y="bottom-right",onClick:v,onNodeClick:w,pannable:E=!1,zoomable:_=!1,ariaLabel:S,inversePan:z,zoomStep:k=1,offsetScale:A=5}){const M=ht(),T=V.useRef(null),{boundingRect:q,viewBB:j,rfId:L,panZoom:X,translateExtent:B,flowWidth:I,flowHeight:ee,ariaLabelConfig:H}=Ie(ij,dt),G=(e==null?void 0:e.width)??tj,D=(e==null?void 0:e.height)??nj,$=q.width/G,Z=q.height/D,J=Math.max($,Z),O=J*G,U=J*D,F=A*J,N=q.x-(O-q.width)/2-F,Y=q.y-(U-q.height)/2-F,P=O+F*2,K=U+F*2,ne=`${lj}-${L}`,re=V.useRef(0),se=V.useRef();re.current=J,V.useEffect(()=>{if(T.current&&X)return se.current=yz({domNode:T.current,panZoom:X,getTransform:()=>M.getState().transform,getViewScale:()=>re.current}),()=>{var pe;(pe=se.current)==null||pe.destroy()}},[X]),V.useEffect(()=>{var pe;(pe=se.current)==null||pe.update({translateExtent:B,width:I,height:ee,inversePan:z,pannable:E,zoomStep:k,zoomable:_})},[E,_,z,k,B,I,ee]);const ye=v?pe=>{var Ce;const[_e,Me]=((Ce=se.current)==null?void 0:Ce.pointer(pe))||[0,0];v(pe,{x:_e,y:Me})}:void 0,ve=w?V.useCallback((pe,_e)=>{const Me=M.getState().nodeLookup.get(_e).internals.userNode;w(pe,Me)},[]):void 0,xe=S??H["minimap.ariaLabel"];return b.jsx(vc,{position:y,style:{...e,"--xy-minimap-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-background-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-stroke-color-props":typeof m=="string"?m:void 0,"--xy-minimap-mask-stroke-width-props":typeof p=="number"?p*J:void 0,"--xy-minimap-node-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-node-stroke-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-width-props":typeof u=="number"?u:void 0},className:Tt(["react-flow__minimap",n]),"data-testid":"rf__minimap",children:b.jsxs("svg",{width:G,height:D,viewBox:`${N} ${Y} ${P} ${K}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ne,ref:T,onClick:ye,children:[xe&&b.jsx("title",{id:ne,children:xe}),b.jsx(ej,{onClick:ve,nodeColor:l,nodeStrokeColor:i,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:u,nodeComponent:f}),b.jsx("path",{className:"react-flow__minimap-mask",d:`M${N-F},${Y-F}h${P+F*2}v${K+F*2}h${-P-F*2}z + M${j.x},${j.y}h${j.width}v${j.height}h${-j.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}DS.displayName="MiniMap";const aj=V.memo(DS),oj=e=>n=>e?`${Math.max(1/n.transform[2],1)}`:void 0,sj={[ia.Line]:"right",[ia.Handle]:"bottom-right"};function uj({nodeId:e,position:n,variant:i=ia.Handle,className:l,style:o=void 0,children:s,color:u,minWidth:f=10,minHeight:d=10,maxWidth:h=Number.MAX_VALUE,maxHeight:m=Number.MAX_VALUE,keepAspectRatio:p=!1,resizeDirection:y,autoScale:v=!0,shouldResize:w,onResizeStart:E,onResize:_,onResizeEnd:S}){const z=hS(),k=typeof e=="string"?e:z,A=ht(),M=V.useRef(null),T=i===ia.Handle,q=Ie(V.useCallback(oj(T&&v),[T,v]),dt),j=V.useRef(null),L=n??sj[i];V.useEffect(()=>{if(!(!M.current||!k))return j.current||(j.current=Mz({domNode:M.current,nodeId:k,getStoreItems:()=>{const{nodeLookup:B,transform:I,snapGrid:ee,snapToGrid:H,nodeOrigin:G,domNode:D}=A.getState();return{nodeLookup:B,transform:I,snapGrid:ee,snapToGrid:H,nodeOrigin:G,paneDomNode:D}},onChange:(B,I)=>{const{triggerNodeChanges:ee,nodeLookup:H,parentLookup:G,nodeOrigin:D}=A.getState(),$=[],Z={x:B.x,y:B.y},J=H.get(k);if(J&&J.expandParent&&J.parentId){const O=J.origin??D,U=B.width??J.measured.width??0,F=B.height??J.measured.height??0,N={id:J.id,parentId:J.parentId,rect:{width:U,height:F,...Hw({x:B.x??J.position.x,y:B.y??J.position.y},{width:U,height:F},J.parentId,H,O)}},Y=um([N],H,G,D);$.push(...Y),Z.x=B.x?Math.max(O[0]*U,B.x):void 0,Z.y=B.y?Math.max(O[1]*F,B.y):void 0}if(Z.x!==void 0&&Z.y!==void 0){const O={id:k,type:"position",position:{...Z}};$.push(O)}if(B.width!==void 0&&B.height!==void 0){const U={id:k,type:"dimensions",resizing:!0,setAttributes:y?y==="horizontal"?"width":"height":!0,dimensions:{width:B.width,height:B.height}};$.push(U)}for(const O of I){const U={...O,type:"position"};$.push(U)}ee($)},onEnd:({width:B,height:I})=>{const ee={id:k,type:"dimensions",resizing:!1,dimensions:{width:B,height:I}};A.getState().triggerNodeChanges([ee])}})),j.current.update({controlPosition:L,boundaries:{minWidth:f,minHeight:d,maxWidth:h,maxHeight:m},keepAspectRatio:p,resizeDirection:y,onResizeStart:E,onResize:_,onResizeEnd:S,shouldResize:w}),()=>{var B;(B=j.current)==null||B.destroy()}},[L,f,d,h,m,p,E,_,S,w]);const X=L.split("-");return b.jsx("div",{className:Tt(["react-flow__resize-control","nodrag",...X,i,l]),ref:M,style:{...o,scale:q,...u&&{[T?"backgroundColor":"borderColor"]:u}},children:s})}V.memo(uj);var oh,qv;function fm(){if(qv)return oh;qv=1;var e="\0",n="\0",i="";class l{constructor(m){Nt(this,"_isDirected",!0);Nt(this,"_isMultigraph",!1);Nt(this,"_isCompound",!1);Nt(this,"_label");Nt(this,"_defaultNodeLabelFn",()=>{});Nt(this,"_defaultEdgeLabelFn",()=>{});Nt(this,"_nodes",{});Nt(this,"_in",{});Nt(this,"_preds",{});Nt(this,"_out",{});Nt(this,"_sucs",{});Nt(this,"_edgeObjs",{});Nt(this,"_edgeLabels",{});Nt(this,"_nodeCount",0);Nt(this,"_edgeCount",0);Nt(this,"_parent");Nt(this,"_children");m&&(this._isDirected=Object.hasOwn(m,"directed")?m.directed:!0,this._isMultigraph=Object.hasOwn(m,"multigraph")?m.multigraph:!1,this._isCompound=Object.hasOwn(m,"compound")?m.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[n]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(m){return this._label=m,this}graph(){return this._label}setDefaultNodeLabel(m){return this._defaultNodeLabelFn=m,typeof m!="function"&&(this._defaultNodeLabelFn=()=>m),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var m=this;return this.nodes().filter(p=>Object.keys(m._in[p]).length===0)}sinks(){var m=this;return this.nodes().filter(p=>Object.keys(m._out[p]).length===0)}setNodes(m,p){var y=arguments,v=this;return m.forEach(function(w){y.length>1?v.setNode(w,p):v.setNode(w)}),this}setNode(m,p){return Object.hasOwn(this._nodes,m)?(arguments.length>1&&(this._nodes[m]=p),this):(this._nodes[m]=arguments.length>1?p:this._defaultNodeLabelFn(m),this._isCompound&&(this._parent[m]=n,this._children[m]={},this._children[n][m]=!0),this._in[m]={},this._preds[m]={},this._out[m]={},this._sucs[m]={},++this._nodeCount,this)}node(m){return this._nodes[m]}hasNode(m){return Object.hasOwn(this._nodes,m)}removeNode(m){var p=this;if(Object.hasOwn(this._nodes,m)){var y=v=>p.removeEdge(p._edgeObjs[v]);delete this._nodes[m],this._isCompound&&(this._removeFromParentsChildList(m),delete this._parent[m],this.children(m).forEach(function(v){p.setParent(v)}),delete this._children[m]),Object.keys(this._in[m]).forEach(y),delete this._in[m],delete this._preds[m],Object.keys(this._out[m]).forEach(y),delete this._out[m],delete this._sucs[m],--this._nodeCount}return this}setParent(m,p){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(p===void 0)p=n;else{p+="";for(var y=p;y!==void 0;y=this.parent(y))if(y===m)throw new Error("Setting "+p+" as parent of "+m+" would create a cycle");this.setNode(p)}return this.setNode(m),this._removeFromParentsChildList(m),this._parent[m]=p,this._children[p][m]=!0,this}_removeFromParentsChildList(m){delete this._children[this._parent[m]][m]}parent(m){if(this._isCompound){var p=this._parent[m];if(p!==n)return p}}children(m=n){if(this._isCompound){var p=this._children[m];if(p)return Object.keys(p)}else{if(m===n)return this.nodes();if(this.hasNode(m))return[]}}predecessors(m){var p=this._preds[m];if(p)return Object.keys(p)}successors(m){var p=this._sucs[m];if(p)return Object.keys(p)}neighbors(m){var p=this.predecessors(m);if(p){const v=new Set(p);for(var y of this.successors(m))v.add(y);return Array.from(v.values())}}isLeaf(m){var p;return this.isDirected()?p=this.successors(m):p=this.neighbors(m),p.length===0}filterNodes(m){var p=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});p.setGraph(this.graph());var y=this;Object.entries(this._nodes).forEach(function([E,_]){m(E)&&p.setNode(E,_)}),Object.values(this._edgeObjs).forEach(function(E){p.hasNode(E.v)&&p.hasNode(E.w)&&p.setEdge(E,y.edge(E))});var v={};function w(E){var _=y.parent(E);return _===void 0||p.hasNode(_)?(v[E]=_,_):_ in v?v[_]:w(_)}return this._isCompound&&p.nodes().forEach(E=>p.setParent(E,w(E))),p}setDefaultEdgeLabel(m){return this._defaultEdgeLabelFn=m,typeof m!="function"&&(this._defaultEdgeLabelFn=()=>m),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(m,p){var y=this,v=arguments;return m.reduce(function(w,E){return v.length>1?y.setEdge(w,E,p):y.setEdge(w,E),E}),this}setEdge(){var m,p,y,v,w=!1,E=arguments[0];typeof E=="object"&&E!==null&&"v"in E?(m=E.v,p=E.w,y=E.name,arguments.length===2&&(v=arguments[1],w=!0)):(m=E,p=arguments[1],y=arguments[3],arguments.length>2&&(v=arguments[2],w=!0)),m=""+m,p=""+p,y!==void 0&&(y=""+y);var _=u(this._isDirected,m,p,y);if(Object.hasOwn(this._edgeLabels,_))return w&&(this._edgeLabels[_]=v),this;if(y!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(m),this.setNode(p),this._edgeLabels[_]=w?v:this._defaultEdgeLabelFn(m,p,y);var S=f(this._isDirected,m,p,y);return m=S.v,p=S.w,Object.freeze(S),this._edgeObjs[_]=S,o(this._preds[p],m),o(this._sucs[m],p),this._in[p][_]=S,this._out[m][_]=S,this._edgeCount++,this}edge(m,p,y){var v=arguments.length===1?d(this._isDirected,arguments[0]):u(this._isDirected,m,p,y);return this._edgeLabels[v]}edgeAsObj(){const m=this.edge(...arguments);return typeof m!="object"?{label:m}:m}hasEdge(m,p,y){var v=arguments.length===1?d(this._isDirected,arguments[0]):u(this._isDirected,m,p,y);return Object.hasOwn(this._edgeLabels,v)}removeEdge(m,p,y){var v=arguments.length===1?d(this._isDirected,arguments[0]):u(this._isDirected,m,p,y),w=this._edgeObjs[v];return w&&(m=w.v,p=w.w,delete this._edgeLabels[v],delete this._edgeObjs[v],s(this._preds[p],m),s(this._sucs[m],p),delete this._in[p][v],delete this._out[m][v],this._edgeCount--),this}inEdges(m,p){var y=this._in[m];if(y){var v=Object.values(y);return p?v.filter(w=>w.v===p):v}}outEdges(m,p){var y=this._out[m];if(y){var v=Object.values(y);return p?v.filter(w=>w.w===p):v}}nodeEdges(m,p){var y=this.inEdges(m,p);if(y)return y.concat(this.outEdges(m,p))}}function o(h,m){h[m]?h[m]++:h[m]=1}function s(h,m){--h[m]||delete h[m]}function u(h,m,p,y){var v=""+m,w=""+p;if(!h&&v>w){var E=v;v=w,w=E}return v+i+w+i+(y===void 0?e:y)}function f(h,m,p,y){var v=""+m,w=""+p;if(!h&&v>w){var E=v;v=w,w=E}var _={v,w};return y&&(_.name=y),_}function d(h,m){return u(h,m.v,m.w,m.name)}return oh=l,oh}var sh,Uv;function cj(){return Uv||(Uv=1,sh="2.2.4"),sh}var uh,Iv;function fj(){return Iv||(Iv=1,uh={Graph:fm(),version:cj()}),uh}var ch,Vv;function dj(){if(Vv)return ch;Vv=1;var e=fm();ch={write:n,read:o};function n(s){var u={options:{directed:s.isDirected(),multigraph:s.isMultigraph(),compound:s.isCompound()},nodes:i(s),edges:l(s)};return s.graph()!==void 0&&(u.value=structuredClone(s.graph())),u}function i(s){return s.nodes().map(function(u){var f=s.node(u),d=s.parent(u),h={v:u};return f!==void 0&&(h.value=f),d!==void 0&&(h.parent=d),h})}function l(s){return s.edges().map(function(u){var f=s.edge(u),d={v:u.v,w:u.w};return u.name!==void 0&&(d.name=u.name),f!==void 0&&(d.value=f),d})}function o(s){var u=new e(s.options).setGraph(s.value);return s.nodes.forEach(function(f){u.setNode(f.v,f.value),f.parent&&u.setParent(f.v,f.parent)}),s.edges.forEach(function(f){u.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),u}return ch}var fh,Yv;function hj(){if(Yv)return fh;Yv=1,fh=e;function e(n){var i={},l=[],o;function s(u){Object.hasOwn(i,u)||(i[u]=!0,o.push(u),n.successors(u).forEach(s),n.predecessors(u).forEach(s))}return n.nodes().forEach(function(u){o=[],s(u),o.length&&l.push(o)}),l}return fh}var dh,Gv;function LS(){if(Gv)return dh;Gv=1;class e{constructor(){Nt(this,"_arr",[]);Nt(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(i){return i.key})}has(i){return Object.hasOwn(this._keyIndices,i)}priority(i){var l=this._keyIndices[i];if(l!==void 0)return this._arr[l].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(i,l){var o=this._keyIndices;if(i=String(i),!Object.hasOwn(o,i)){var s=this._arr,u=s.length;return o[i]=u,s.push({key:i,priority:l}),this._decrease(u),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var i=this._arr.pop();return delete this._keyIndices[i.key],this._heapify(0),i.key}decrease(i,l){var o=this._keyIndices[i];if(l>this._arr[o].priority)throw new Error("New priority is greater than current priority. Key: "+i+" Old: "+this._arr[o].priority+" New: "+l);this._arr[o].priority=l,this._decrease(o)}_heapify(i){var l=this._arr,o=2*i,s=o+1,u=i;o>1,!(l[s].priority1;function i(o,s,u,f){return l(o,String(s),u||n,f||function(d){return o.outEdges(d)})}function l(o,s,u,f){var d={},h=new e,m,p,y=function(v){var w=v.v!==m?v.v:v.w,E=d[w],_=u(v),S=p.distance+_;if(_<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+v+" Weight: "+_);S0&&(m=h.removeMin(),p=d[m],p.distance!==Number.POSITIVE_INFINITY);)f(m).forEach(y);return d}return hh}var ph,Xv;function pj(){if(Xv)return ph;Xv=1;var e=HS();ph=n;function n(i,l,o){return i.nodes().reduce(function(s,u){return s[u]=e(i,u,l,o),s},{})}return ph}var mh,Fv;function BS(){if(Fv)return mh;Fv=1,mh=e;function e(n){var i=0,l=[],o={},s=[];function u(f){var d=o[f]={onStack:!0,lowlink:i,index:i++};if(l.push(f),n.successors(f).forEach(function(p){Object.hasOwn(o,p)?o[p].onStack&&(d.lowlink=Math.min(d.lowlink,o[p].index)):(u(p),d.lowlink=Math.min(d.lowlink,o[p].lowlink))}),d.lowlink===d.index){var h=[],m;do m=l.pop(),o[m].onStack=!1,h.push(m);while(f!==m);s.push(h)}}return n.nodes().forEach(function(f){Object.hasOwn(o,f)||u(f)}),s}return mh}var gh,Pv;function mj(){if(Pv)return gh;Pv=1;var e=BS();gh=n;function n(i){return e(i).filter(function(l){return l.length>1||l.length===1&&i.hasEdge(l[0],l[0])})}return gh}var yh,Qv;function gj(){if(Qv)return yh;Qv=1,yh=n;var e=()=>1;function n(l,o,s){return i(l,o||e,s||function(u){return l.outEdges(u)})}function i(l,o,s){var u={},f=l.nodes();return f.forEach(function(d){u[d]={},u[d][d]={distance:0},f.forEach(function(h){d!==h&&(u[d][h]={distance:Number.POSITIVE_INFINITY})}),s(d).forEach(function(h){var m=h.v===d?h.w:h.v,p=o(h);u[d][m]={distance:p,predecessor:d}})}),f.forEach(function(d){var h=u[d];f.forEach(function(m){var p=u[m];f.forEach(function(y){var v=p[d],w=h[y],E=p[y],_=v.distance+w.distance;_o.successors(p):p=>o.neighbors(p),d=u==="post"?n:i,h=[],m={};return s.forEach(p=>{if(!o.hasNode(p))throw new Error("Graph does not have node: "+p);d(p,f,m,h)}),h}function n(o,s,u,f){for(var d=[[o,!1]];d.length>0;){var h=d.pop();h[1]?f.push(h[0]):Object.hasOwn(u,h[0])||(u[h[0]]=!0,d.push([h[0],!0]),l(s(h[0]),m=>d.push([m,!1])))}}function i(o,s,u,f){for(var d=[o];d.length>0;){var h=d.pop();Object.hasOwn(u,h)||(u[h]=!0,f.push(h),l(s(h),m=>d.push(m)))}}function l(o,s){for(var u=o.length;u--;)s(o[u],u,o);return o}return bh}var wh,Wv;function xj(){if(Wv)return wh;Wv=1;var e=US();wh=n;function n(i,l){return e(i,l,"post")}return wh}var Sh,e1;function vj(){if(e1)return Sh;e1=1;var e=US();Sh=n;function n(i,l){return e(i,l,"pre")}return Sh}var _h,t1;function bj(){if(t1)return _h;t1=1;var e=fm(),n=LS();_h=i;function i(l,o){var s=new e,u={},f=new n,d;function h(p){var y=p.v===d?p.w:p.v,v=f.priority(y);if(v!==void 0){var w=o(p);w0;){if(d=f.removeMin(),Object.hasOwn(u,d))s.setEdge(d,u[d]);else{if(m)throw new Error("Input graph is not connected: "+l);m=!0}l.nodeEdges(d).forEach(h)}return s}return _h}var Eh,n1;function wj(){return n1||(n1=1,Eh={components:hj(),dijkstra:HS(),dijkstraAll:pj(),findCycles:mj(),floydWarshall:gj(),isAcyclic:yj(),postorder:xj(),preorder:vj(),prim:bj(),tarjan:BS(),topsort:qS()}),Eh}var Nh,r1;function Vn(){if(r1)return Nh;r1=1;var e=fj();return Nh={Graph:e.Graph,json:dj(),alg:wj(),version:e.version},Nh}var kh,i1;function Sj(){if(i1)return kh;i1=1;class e{constructor(){let o={};o._next=o._prev=o,this._sentinel=o}dequeue(){let o=this._sentinel,s=o._prev;if(s!==o)return n(s),s}enqueue(o){let s=this._sentinel;o._prev&&o._next&&n(o),o._next=s._next,s._next._prev=o,s._next=o,o._prev=s}toString(){let o=[],s=this._sentinel,u=s._prev;for(;u!==s;)o.push(JSON.stringify(u,i)),u=u._prev;return"["+o.join(", ")+"]"}}function n(l){l._prev._next=l._next,l._next._prev=l._prev,delete l._next,delete l._prev}function i(l,o){if(l!=="_next"&&l!=="_prev")return o}return kh=e,kh}var Ch,l1;function _j(){if(l1)return Ch;l1=1;let e=Vn().Graph,n=Sj();Ch=l;let i=()=>1;function l(h,m){if(h.nodeCount()<=1)return[];let p=u(h,m||i);return o(p.graph,p.buckets,p.zeroIdx).flatMap(v=>h.outEdges(v.v,v.w))}function o(h,m,p){let y=[],v=m[m.length-1],w=m[0],E;for(;h.nodeCount();){for(;E=w.dequeue();)s(h,m,p,E);for(;E=v.dequeue();)s(h,m,p,E);if(h.nodeCount()){for(let _=m.length-2;_>0;--_)if(E=m[_].dequeue(),E){y=y.concat(s(h,m,p,E,!0));break}}}return y}function s(h,m,p,y,v){let w=v?[]:void 0;return h.inEdges(y.v).forEach(E=>{let _=h.edge(E),S=h.node(E.v);v&&w.push({v:E.v,w:E.w}),S.out-=_,f(m,p,S)}),h.outEdges(y.v).forEach(E=>{let _=h.edge(E),S=E.w,z=h.node(S);z.in-=_,f(m,p,z)}),h.removeNode(y.v),w}function u(h,m){let p=new e,y=0,v=0;h.nodes().forEach(_=>{p.setNode(_,{v:_,in:0,out:0})}),h.edges().forEach(_=>{let S=p.edge(_.v,_.w)||0,z=m(_),k=S+z;p.setEdge(_.v,_.w,k),v=Math.max(v,p.node(_.v).out+=z),y=Math.max(y,p.node(_.w).in+=z)});let w=d(v+y+3).map(()=>new n),E=y+1;return p.nodes().forEach(_=>{f(w,E,p.node(_))}),{graph:p,buckets:w,zeroIdx:E}}function f(h,m,p){p.out?p.in?h[p.out-p.in+m].enqueue(p):h[h.length-1].enqueue(p):h[0].enqueue(p)}function d(h){const m=[];for(let p=0;pL.setNode(X,j.node(X))),j.edges().forEach(X=>{let B=L.edge(X.v,X.w)||{weight:0,minlen:1},I=j.edge(X);L.setEdge(X.v,X.w,{weight:B.weight+I.weight,minlen:Math.max(B.minlen,I.minlen)})}),L}function l(j){let L=new e({multigraph:j.isMultigraph()}).setGraph(j.graph());return j.nodes().forEach(X=>{j.children(X).length||L.setNode(X,j.node(X))}),j.edges().forEach(X=>{L.setEdge(X,j.edge(X))}),L}function o(j){let L=j.nodes().map(X=>{let B={};return j.outEdges(X).forEach(I=>{B[I.w]=(B[I.w]||0)+j.edge(I).weight}),B});return q(j.nodes(),L)}function s(j){let L=j.nodes().map(X=>{let B={};return j.inEdges(X).forEach(I=>{B[I.v]=(B[I.v]||0)+j.edge(I).weight}),B});return q(j.nodes(),L)}function u(j,L){let X=j.x,B=j.y,I=L.x-X,ee=L.y-B,H=j.width/2,G=j.height/2;if(!I&&!ee)throw new Error("Not possible to find intersection inside of the rectangle");let D,$;return Math.abs(ee)*H>Math.abs(I)*G?(ee<0&&(G=-G),D=G*I/ee,$=G):(I<0&&(H=-H),D=H,$=H*ee/I),{x:X+D,y:B+$}}function f(j){let L=A(w(j)+1).map(()=>[]);return j.nodes().forEach(X=>{let B=j.node(X),I=B.rank;I!==void 0&&(L[I][B.order]=X)}),L}function d(j){let L=j.nodes().map(B=>{let I=j.node(B).rank;return I===void 0?Number.MAX_VALUE:I}),X=v(Math.min,L);j.nodes().forEach(B=>{let I=j.node(B);Object.hasOwn(I,"rank")&&(I.rank-=X)})}function h(j){let L=j.nodes().map(H=>j.node(H).rank),X=v(Math.min,L),B=[];j.nodes().forEach(H=>{let G=j.node(H).rank-X;B[G]||(B[G]=[]),B[G].push(H)});let I=0,ee=j.graph().nodeRankFactor;Array.from(B).forEach((H,G)=>{H===void 0&&G%ee!==0?--I:H!==void 0&&I&&H.forEach(D=>j.node(D).rank+=I)})}function m(j,L,X,B){let I={width:0,height:0};return arguments.length>=4&&(I.rank=X,I.order=B),n(j,"border",I,L)}function p(j,L=y){const X=[];for(let B=0;By){const X=p(L);return j.apply(null,X.map(B=>j.apply(null,B)))}else return j.apply(null,L)}function w(j){const X=j.nodes().map(B=>{let I=j.node(B).rank;return I===void 0?Number.MIN_VALUE:I});return v(Math.max,X)}function E(j,L){let X={lhs:[],rhs:[]};return j.forEach(B=>{L(B)?X.lhs.push(B):X.rhs.push(B)}),X}function _(j,L){let X=Date.now();try{return L()}finally{console.log(j+" time: "+(Date.now()-X)+"ms")}}function S(j,L){return L()}let z=0;function k(j){var L=++z;return j+(""+L)}function A(j,L,X=1){L==null&&(L=j,j=0);let B=ee=>eeLB[L]),Object.entries(j).reduce((B,[I,ee])=>(B[I]=X(ee,I),B),{})}function q(j,L){return j.reduce((X,B,I)=>(X[B]=L[I],X),{})}return Th}var zh,o1;function Ej(){if(o1)return zh;o1=1;let e=_j(),n=Ct().uniqueId;zh={run:i,undo:o};function i(s){(s.graph().acyclicer==="greedy"?e(s,f(s)):l(s)).forEach(d=>{let h=s.edge(d);s.removeEdge(d),h.forwardName=d.name,h.reversed=!0,s.setEdge(d.w,d.v,h,n("rev"))});function f(d){return h=>d.edge(h).weight}}function l(s){let u=[],f={},d={};function h(m){Object.hasOwn(d,m)||(d[m]=!0,f[m]=!0,s.outEdges(m).forEach(p=>{Object.hasOwn(f,p.w)?u.push(p):h(p.w)}),delete f[m])}return s.nodes().forEach(h),u}function o(s){s.edges().forEach(u=>{let f=s.edge(u);if(f.reversed){s.removeEdge(u);let d=f.forwardName;delete f.reversed,delete f.forwardName,s.setEdge(u.w,u.v,f,d)}})}return zh}var Ah,s1;function Nj(){if(s1)return Ah;s1=1;let e=Ct();Ah={run:n,undo:l};function n(o){o.graph().dummyChains=[],o.edges().forEach(s=>i(o,s))}function i(o,s){let u=s.v,f=o.node(u).rank,d=s.w,h=o.node(d).rank,m=s.name,p=o.edge(s),y=p.labelRank;if(h===f+1)return;o.removeEdge(s);let v,w,E;for(E=0,++f;f{let u=o.node(s),f=u.edgeLabel,d;for(o.setEdge(u.edgeObj,f);u.dummy;)d=o.successors(s)[0],o.removeNode(s),f.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(f.x=u.x,f.y=u.y,f.width=u.width,f.height=u.height),s=d,u=o.node(s)})}return Ah}var Mh,u1;function rc(){if(u1)return Mh;u1=1;const{applyWithChunking:e}=Ct();Mh={longestPath:n,slack:i};function n(l){var o={};function s(u){var f=l.node(u);if(Object.hasOwn(o,u))return f.rank;o[u]=!0;let d=l.outEdges(u).map(m=>m==null?Number.POSITIVE_INFINITY:s(m.w)-l.edge(m).minlen);var h=e(Math.min,d);return h===Number.POSITIVE_INFINITY&&(h=0),f.rank=h}l.sources().forEach(s)}function i(l,o){return l.node(o.w).rank-l.node(o.v).rank-l.edge(o).minlen}return Mh}var jh,c1;function IS(){if(c1)return jh;c1=1;var e=Vn().Graph,n=rc().slack;jh=i;function i(u){var f=new e({directed:!1}),d=u.nodes()[0],h=u.nodeCount();f.setNode(d,{});for(var m,p;l(f,u){var p=m.v,y=h===p?m.w:p;!u.hasNode(y)&&!n(f,m)&&(u.setNode(y,{}),u.setEdge(h,y,{}),d(y))})}return u.nodes().forEach(d),u.nodeCount()}function o(u,f){return f.edges().reduce((h,m)=>{let p=Number.POSITIVE_INFINITY;return u.hasNode(m.v)!==u.hasNode(m.w)&&(p=n(f,m)),pf.node(h).rank+=d)}return jh}var Oh,f1;function kj(){if(f1)return Oh;f1=1;var e=IS(),n=rc().slack,i=rc().longestPath,l=Vn().alg.preorder,o=Vn().alg.postorder,s=Ct().simplify;Oh=u,u.initLowLimValues=m,u.initCutValues=f,u.calcCutValue=h,u.leaveEdge=y,u.enterEdge=v,u.exchangeEdges=w;function u(z){z=s(z),i(z);var k=e(z);m(k),f(k,z);for(var A,M;A=y(k);)M=v(k,z,A),w(k,z,A,M)}function f(z,k){var A=o(z,z.nodes());A=A.slice(0,A.length-1),A.forEach(M=>d(z,k,M))}function d(z,k,A){var M=z.node(A),T=M.parent;z.edge(A,T).cutvalue=h(z,k,A)}function h(z,k,A){var M=z.node(A),T=M.parent,q=!0,j=k.edge(A,T),L=0;return j||(q=!1,j=k.edge(T,A)),L=j.weight,k.nodeEdges(A).forEach(X=>{var B=X.v===A,I=B?X.w:X.v;if(I!==T){var ee=B===q,H=k.edge(X).weight;if(L+=ee?H:-H,_(z,A,I)){var G=z.edge(A,I).cutvalue;L+=ee?-G:G}}}),L}function m(z,k){arguments.length<2&&(k=z.nodes()[0]),p(z,{},1,k)}function p(z,k,A,M,T){var q=A,j=z.node(M);return k[M]=!0,z.neighbors(M).forEach(L=>{Object.hasOwn(k,L)||(A=p(z,k,A,L,M))}),j.low=q,j.lim=A++,T?j.parent=T:delete j.parent,A}function y(z){return z.edges().find(k=>z.edge(k).cutvalue<0)}function v(z,k,A){var M=A.v,T=A.w;k.hasEdge(M,T)||(M=A.w,T=A.v);var q=z.node(M),j=z.node(T),L=q,X=!1;q.lim>j.lim&&(L=j,X=!0);var B=k.edges().filter(I=>X===S(z,z.node(I.v),L)&&X!==S(z,z.node(I.w),L));return B.reduce((I,ee)=>n(k,ee)!k.node(T).parent),M=l(z,A);M=M.slice(1),M.forEach(T=>{var q=z.node(T).parent,j=k.edge(T,q),L=!1;j||(j=k.edge(q,T),L=!0),k.node(T).rank=k.node(q).rank+(L?j.minlen:-j.minlen)})}function _(z,k,A){return z.hasEdge(k,A)}function S(z,k,A){return A.low<=k.lim&&k.lim<=A.lim}return Oh}var Rh,d1;function Cj(){if(d1)return Rh;d1=1;var e=rc(),n=e.longestPath,i=IS(),l=kj();Rh=o;function o(d){var h=d.graph().ranker;if(h instanceof Function)return h(d);switch(d.graph().ranker){case"network-simplex":f(d);break;case"tight-tree":u(d);break;case"longest-path":s(d);break;case"none":break;default:f(d)}}var s=n;function u(d){n(d),i(d)}function f(d){l(d)}return Rh}var Dh,h1;function Tj(){if(h1)return Dh;h1=1,Dh=e;function e(l){let o=i(l);l.graph().dummyChains.forEach(s=>{let u=l.node(s),f=u.edgeObj,d=n(l,o,f.v,f.w),h=d.path,m=d.lca,p=0,y=h[p],v=!0;for(;s!==f.w;){if(u=l.node(s),v){for(;(y=h[p])!==m&&l.node(y).maxRankh||m>o[p].lim));for(y=p,p=u;(p=l.parent(p))!==y;)d.push(p);return{path:f.concat(d.reverse()),lca:y}}function i(l){let o={},s=0;function u(f){let d=s;l.children(f).forEach(u),o[f]={low:d,lim:s++}}return l.children().forEach(u),o}return Dh}var Lh,p1;function zj(){if(p1)return Lh;p1=1;let e=Ct();Lh={run:n,cleanup:s};function n(u){let f=e.addDummyNode(u,"root",{},"_root"),d=l(u),h=Object.values(d),m=e.applyWithChunking(Math.max,h)-1,p=2*m+1;u.graph().nestingRoot=f,u.edges().forEach(v=>u.edge(v).minlen*=p);let y=o(u)+1;u.children().forEach(v=>i(u,f,p,y,m,d,v)),u.graph().nodeRankFactor=p}function i(u,f,d,h,m,p,y){let v=u.children(y);if(!v.length){y!==f&&u.setEdge(f,y,{weight:0,minlen:d});return}let w=e.addBorderNode(u,"_bt"),E=e.addBorderNode(u,"_bb"),_=u.node(y);u.setParent(w,y),_.borderTop=w,u.setParent(E,y),_.borderBottom=E,v.forEach(S=>{i(u,f,d,h,m,p,S);let z=u.node(S),k=z.borderTop?z.borderTop:S,A=z.borderBottom?z.borderBottom:S,M=z.borderTop?h:2*h,T=k!==A?1:m-p[y]+1;u.setEdge(w,k,{weight:M,minlen:T,nestingEdge:!0}),u.setEdge(A,E,{weight:M,minlen:T,nestingEdge:!0})}),u.parent(y)||u.setEdge(f,w,{weight:0,minlen:m+p[y]})}function l(u){var f={};function d(h,m){var p=u.children(h);p&&p.length&&p.forEach(y=>d(y,m+1)),f[h]=m}return u.children().forEach(h=>d(h,1)),f}function o(u){return u.edges().reduce((f,d)=>f+u.edge(d).weight,0)}function s(u){var f=u.graph();u.removeNode(f.nestingRoot),delete f.nestingRoot,u.edges().forEach(d=>{var h=u.edge(d);h.nestingEdge&&u.removeEdge(d)})}return Lh}var Hh,m1;function Aj(){if(m1)return Hh;m1=1;let e=Ct();Hh=n;function n(l){function o(s){let u=l.children(s),f=l.node(s);if(u.length&&u.forEach(o),Object.hasOwn(f,"minRank")){f.borderLeft=[],f.borderRight=[];for(let d=f.minRank,h=f.maxRank+1;dl(d.node(h))),d.edges().forEach(h=>l(d.edge(h)))}function l(d){let h=d.width;d.width=d.height,d.height=h}function o(d){d.nodes().forEach(h=>s(d.node(h))),d.edges().forEach(h=>{let m=d.edge(h);m.points.forEach(s),Object.hasOwn(m,"y")&&s(m)})}function s(d){d.y=-d.y}function u(d){d.nodes().forEach(h=>f(d.node(h))),d.edges().forEach(h=>{let m=d.edge(h);m.points.forEach(f),Object.hasOwn(m,"x")&&f(m)})}function f(d){let h=d.x;d.x=d.y,d.y=h}return Bh}var qh,y1;function jj(){if(y1)return qh;y1=1;let e=Ct();qh=n;function n(i){let l={},o=i.nodes().filter(m=>!i.children(m).length),s=o.map(m=>i.node(m).rank),u=e.applyWithChunking(Math.max,s),f=e.range(u+1).map(()=>[]);function d(m){if(l[m])return;l[m]=!0;let p=i.node(m);f[p.rank].push(m),i.successors(m).forEach(d)}return o.sort((m,p)=>i.node(m).rank-i.node(p).rank).forEach(d),f}return qh}var Uh,x1;function Oj(){if(x1)return Uh;x1=1;let e=Ct().zipObject;Uh=n;function n(l,o){let s=0;for(let u=1;uv)),f=o.flatMap(y=>l.outEdges(y).map(v=>({pos:u[v.w],weight:l.edge(v).weight})).sort((v,w)=>v.pos-w.pos)),d=1;for(;d{let v=y.pos+d;m[v]+=y.weight;let w=0;for(;v>0;)v%2&&(w+=m[v+1]),v=v-1>>1,m[v]+=y.weight;p+=y.weight*w}),p}return Uh}var Ih,v1;function Rj(){if(v1)return Ih;v1=1,Ih=e;function e(n,i=[]){return i.map(l=>{let o=n.inEdges(l);if(o.length){let s=o.reduce((u,f)=>{let d=n.edge(f),h=n.node(f.v);return{sum:u.sum+d.weight*h.order,weight:u.weight+d.weight}},{sum:0,weight:0});return{v:l,barycenter:s.sum/s.weight,weight:s.weight}}else return{v:l}})}return Ih}var Vh,b1;function Dj(){if(b1)return Vh;b1=1;let e=Ct();Vh=n;function n(o,s){let u={};o.forEach((d,h)=>{let m=u[d.v]={indegree:0,in:[],out:[],vs:[d.v],i:h};d.barycenter!==void 0&&(m.barycenter=d.barycenter,m.weight=d.weight)}),s.edges().forEach(d=>{let h=u[d.v],m=u[d.w];h!==void 0&&m!==void 0&&(m.indegree++,h.out.push(u[d.w]))});let f=Object.values(u).filter(d=>!d.indegree);return i(f)}function i(o){let s=[];function u(d){return h=>{h.merged||(h.barycenter===void 0||d.barycenter===void 0||h.barycenter>=d.barycenter)&&l(d,h)}}function f(d){return h=>{h.in.push(d),--h.indegree===0&&o.push(h)}}for(;o.length;){let d=o.pop();s.push(d),d.in.reverse().forEach(u(d)),d.out.forEach(f(d))}return s.filter(d=>!d.merged).map(d=>e.pick(d,["vs","i","barycenter","weight"]))}function l(o,s){let u=0,f=0;o.weight&&(u+=o.barycenter*o.weight,f+=o.weight),s.weight&&(u+=s.barycenter*s.weight,f+=s.weight),o.vs=s.vs.concat(o.vs),o.barycenter=u/f,o.weight=f,o.i=Math.min(s.i,o.i),s.merged=!0}return Vh}var Yh,w1;function Lj(){if(w1)return Yh;w1=1;let e=Ct();Yh=n;function n(o,s){let u=e.partition(o,w=>Object.hasOwn(w,"barycenter")),f=u.lhs,d=u.rhs.sort((w,E)=>E.i-w.i),h=[],m=0,p=0,y=0;f.sort(l(!!s)),y=i(h,d,y),f.forEach(w=>{y+=w.vs.length,h.push(w.vs),m+=w.barycenter*w.weight,p+=w.weight,y=i(h,d,y)});let v={vs:h.flat(!0)};return p&&(v.barycenter=m/p,v.weight=p),v}function i(o,s,u){let f;for(;s.length&&(f=s[s.length-1]).i<=u;)s.pop(),o.push(f.vs),u++;return u}function l(o){return(s,u)=>s.barycenteru.barycenter?1:o?u.i-s.i:s.i-u.i}return Yh}var Gh,S1;function Hj(){if(S1)return Gh;S1=1;let e=Rj(),n=Dj(),i=Lj();Gh=l;function l(u,f,d,h){let m=u.children(f),p=u.node(f),y=p?p.borderLeft:void 0,v=p?p.borderRight:void 0,w={};y&&(m=m.filter(z=>z!==y&&z!==v));let E=e(u,m);E.forEach(z=>{if(u.children(z.v).length){let k=l(u,z.v,d,h);w[z.v]=k,Object.hasOwn(k,"barycenter")&&s(z,k)}});let _=n(E,d);o(_,w);let S=i(_,h);if(y&&(S.vs=[y,S.vs,v].flat(!0),u.predecessors(y).length)){let z=u.node(u.predecessors(y)[0]),k=u.node(u.predecessors(v)[0]);Object.hasOwn(S,"barycenter")||(S.barycenter=0,S.weight=0),S.barycenter=(S.barycenter*S.weight+z.order+k.order)/(S.weight+2),S.weight+=2}return S}function o(u,f){u.forEach(d=>{d.vs=d.vs.flatMap(h=>f[h]?f[h].vs:h)})}function s(u,f){u.barycenter!==void 0?(u.barycenter=(u.barycenter*u.weight+f.barycenter*f.weight)/(u.weight+f.weight),u.weight+=f.weight):(u.barycenter=f.barycenter,u.weight=f.weight)}return Gh}var $h,_1;function Bj(){if(_1)return $h;_1=1;let e=Vn().Graph,n=Ct();$h=i;function i(o,s,u,f){f||(f=o.nodes());let d=l(o),h=new e({compound:!0}).setGraph({root:d}).setDefaultNodeLabel(m=>o.node(m));return f.forEach(m=>{let p=o.node(m),y=o.parent(m);(p.rank===s||p.minRank<=s&&s<=p.maxRank)&&(h.setNode(m),h.setParent(m,y||d),o[u](m).forEach(v=>{let w=v.v===m?v.w:v.v,E=h.edge(w,m),_=E!==void 0?E.weight:0;h.setEdge(w,m,{weight:o.edge(v).weight+_})}),Object.hasOwn(p,"minRank")&&h.setNode(m,{borderLeft:p.borderLeft[s],borderRight:p.borderRight[s]}))}),h}function l(o){for(var s;o.hasNode(s=n.uniqueId("_root")););return s}return $h}var Xh,E1;function qj(){if(E1)return Xh;E1=1,Xh=e;function e(n,i,l){let o={},s;l.forEach(u=>{let f=n.parent(u),d,h;for(;f;){if(d=n.parent(f),d?(h=o[d],o[d]=f):(h=s,s=f),h&&h!==f){i.setEdge(h,f);return}f=d}})}return Xh}var Fh,N1;function Uj(){if(N1)return Fh;N1=1;let e=jj(),n=Oj(),i=Hj(),l=Bj(),o=qj(),s=Vn().Graph,u=Ct();Fh=f;function f(p,y){if(y&&typeof y.customOrder=="function"){y.customOrder(p,f);return}let v=u.maxRank(p),w=d(p,u.range(1,v+1),"inEdges"),E=d(p,u.range(v-1,-1,-1),"outEdges"),_=e(p);if(m(p,_),y&&y.disableOptimalOrderHeuristic)return;let S=Number.POSITIVE_INFINITY,z;for(let k=0,A=0;A<4;++k,++A){h(k%2?w:E,k%4>=2),_=u.buildLayerMatrix(p);let M=n(p,_);M{w.has(_)||w.set(_,[]),w.get(_).push(S)};for(const _ of p.nodes()){const S=p.node(_);if(typeof S.rank=="number"&&E(S.rank,_),typeof S.minRank=="number"&&typeof S.maxRank=="number")for(let z=S.minRank;z<=S.maxRank;z++)z!==S.rank&&E(z,_)}return y.map(function(_){return l(p,_,v,w.get(_)||[])})}function h(p,y){let v=new s;p.forEach(function(w){let E=w.graph().root,_=i(w,E,v,y);_.vs.forEach((S,z)=>w.node(S).order=z),o(w,v,_.vs)})}function m(p,y){Object.values(y).forEach(v=>v.forEach((w,E)=>p.node(w).order=E))}return Fh}var Ph,k1;function Ij(){if(k1)return Ph;k1=1;let e=Vn().Graph,n=Ct();Ph={positionX:v,findType1Conflicts:i,findType2Conflicts:l,addConflict:s,hasConflict:u,verticalAlignment:f,horizontalCompaction:d,alignCoordinates:p,findSmallestWidthAlignment:m,balance:y};function i(_,S){let z={};function k(A,M){let T=0,q=0,j=A.length,L=M[M.length-1];return M.forEach((X,B)=>{let I=o(_,X),ee=I?_.node(I).order:j;(I||X===L)&&(M.slice(q,B+1).forEach(H=>{_.predecessors(H).forEach(G=>{let D=_.node(G),$=D.order;(${X=M[B],_.node(X).dummy&&_.predecessors(X).forEach(I=>{let ee=_.node(I);ee.dummy&&(ee.orderL)&&s(z,I,X)})})}function A(M,T){let q=-1,j,L=0;return T.forEach((X,B)=>{if(_.node(X).dummy==="border"){let I=_.predecessors(X);I.length&&(j=_.node(I[0]).order,k(T,L,B,q,j),L=B,q=j)}k(T,L,T.length,j,M.length)}),T}return S.length&&S.reduce(A),z}function o(_,S){if(_.node(S).dummy)return _.predecessors(S).find(z=>_.node(z).dummy)}function s(_,S,z){if(S>z){let A=S;S=z,z=A}let k=_[S];k||(_[S]=k={}),k[z]=!0}function u(_,S,z){if(S>z){let k=S;S=z,z=k}return!!_[S]&&Object.hasOwn(_[S],z)}function f(_,S,z,k){let A={},M={},T={};return S.forEach(q=>{q.forEach((j,L)=>{A[j]=j,M[j]=j,T[j]=L})}),S.forEach(q=>{let j=-1;q.forEach(L=>{let X=k(L);if(X.length){X=X.sort((I,ee)=>T[I]-T[ee]);let B=(X.length-1)/2;for(let I=Math.floor(B),ee=Math.ceil(B);I<=ee;++I){let H=X[I];M[L]===L&&jMath.max(I,M[ee.v]+T.edge(ee)),0)}function X(B){let I=T.outEdges(B).reduce((H,G)=>Math.min(H,M[G.w]-T.edge(G)),Number.POSITIVE_INFINITY),ee=_.node(B);I!==Number.POSITIVE_INFINITY&&ee.borderType!==q&&(M[B]=Math.max(M[B],I))}return j(L,T.predecessors.bind(T)),j(X,T.successors.bind(T)),Object.keys(k).forEach(B=>M[B]=M[z[B]]),M}function h(_,S,z,k){let A=new e,M=_.graph(),T=w(M.nodesep,M.edgesep,k);return S.forEach(q=>{let j;q.forEach(L=>{let X=z[L];if(A.setNode(X),j){var B=z[j],I=A.edge(B,X);A.setEdge(B,X,Math.max(T(_,L,j),I||0))}j=L})}),A}function m(_,S){return Object.values(S).reduce((z,k)=>{let A=Number.NEGATIVE_INFINITY,M=Number.POSITIVE_INFINITY;Object.entries(k).forEach(([q,j])=>{let L=E(_,q)/2;A=Math.max(j+L,A),M=Math.min(j-L,M)});const T=A-M;return T{["l","r"].forEach(T=>{let q=M+T,j=_[q];if(j===S)return;let L=Object.values(j),X=k-n.applyWithChunking(Math.min,L);T!=="l"&&(X=A-n.applyWithChunking(Math.max,L)),X&&(_[q]=n.mapValues(j,B=>B+X))})})}function y(_,S){return n.mapValues(_.ul,(z,k)=>{if(S)return _[S.toLowerCase()][k];{let A=Object.values(_).map(M=>M[k]).sort((M,T)=>M-T);return(A[1]+A[2])/2}})}function v(_){let S=n.buildLayerMatrix(_),z=Object.assign(i(_,S),l(_,S)),k={},A;["u","d"].forEach(T=>{A=T==="u"?S:Object.values(S).reverse(),["l","r"].forEach(q=>{q==="r"&&(A=A.map(B=>Object.values(B).reverse()));let j=(T==="u"?_.predecessors:_.successors).bind(_),L=f(_,A,z,j),X=d(_,A,L.root,L.align,q==="r");q==="r"&&(X=n.mapValues(X,B=>-B)),k[T+q]=X})});let M=m(_,k);return p(k,M),y(k,_.graph().align)}function w(_,S,z){return(k,A,M)=>{let T=k.node(A),q=k.node(M),j=0,L;if(j+=T.width/2,Object.hasOwn(T,"labelpos"))switch(T.labelpos.toLowerCase()){case"l":L=-T.width/2;break;case"r":L=T.width/2;break}if(L&&(j+=z?L:-L),L=0,j+=(T.dummy?S:_)/2,j+=(q.dummy?S:_)/2,j+=q.width/2,Object.hasOwn(q,"labelpos"))switch(q.labelpos.toLowerCase()){case"l":L=q.width/2;break;case"r":L=-q.width/2;break}return L&&(j+=z?L:-L),L=0,j}}function E(_,S){return _.node(S).width}return Ph}var Qh,C1;function Vj(){if(C1)return Qh;C1=1;let e=Ct(),n=Ij().positionX;Qh=i;function i(o){o=e.asNonCompoundGraph(o),l(o),Object.entries(n(o)).forEach(([s,u])=>o.node(s).x=u)}function l(o){let s=e.buildLayerMatrix(o),u=o.graph().ranksep,f=0;s.forEach(d=>{const h=d.reduce((m,p)=>{const y=o.node(p).height;return m>y?m:y},0);d.forEach(m=>o.node(m).y=f+h/2),f+=h+u})}return Qh}var Zh,T1;function Yj(){if(T1)return Zh;T1=1;let e=Ej(),n=Nj(),i=Cj(),l=Ct().normalizeRanks,o=Tj(),s=Ct().removeEmptyRanks,u=zj(),f=Aj(),d=Mj(),h=Uj(),m=Vj(),p=Ct(),y=Vn().Graph;Zh=v;function v(N,Y){let P=Y&&Y.debugTiming?p.time:p.notime;P("layout",()=>{let K=P(" buildLayoutGraph",()=>j(N));P(" runLayout",()=>w(K,P,Y)),P(" updateInputGraph",()=>E(N,K))})}function w(N,Y,P){Y(" makeSpaceForEdgeLabels",()=>L(N)),Y(" removeSelfEdges",()=>Z(N)),Y(" acyclic",()=>e.run(N)),Y(" nestingGraph.run",()=>u.run(N)),Y(" rank",()=>i(p.asNonCompoundGraph(N))),Y(" injectEdgeLabelProxies",()=>X(N)),Y(" removeEmptyRanks",()=>s(N)),Y(" nestingGraph.cleanup",()=>u.cleanup(N)),Y(" normalizeRanks",()=>l(N)),Y(" assignRankMinMax",()=>B(N)),Y(" removeEdgeLabelProxies",()=>I(N)),Y(" normalize.run",()=>n.run(N)),Y(" parentDummyChains",()=>o(N)),Y(" addBorderSegments",()=>f(N)),Y(" order",()=>h(N,P)),Y(" insertSelfEdges",()=>J(N)),Y(" adjustCoordinateSystem",()=>d.adjust(N)),Y(" position",()=>m(N)),Y(" positionSelfEdges",()=>O(N)),Y(" removeBorderNodes",()=>$(N)),Y(" normalize.undo",()=>n.undo(N)),Y(" fixupEdgeLabelCoords",()=>G(N)),Y(" undoCoordinateSystem",()=>d.undo(N)),Y(" translateGraph",()=>ee(N)),Y(" assignNodeIntersects",()=>H(N)),Y(" reversePoints",()=>D(N)),Y(" acyclic.undo",()=>e.undo(N))}function E(N,Y){N.nodes().forEach(P=>{let K=N.node(P),ne=Y.node(P);K&&(K.x=ne.x,K.y=ne.y,K.rank=ne.rank,Y.children(P).length&&(K.width=ne.width,K.height=ne.height))}),N.edges().forEach(P=>{let K=N.edge(P),ne=Y.edge(P);K.points=ne.points,Object.hasOwn(ne,"x")&&(K.x=ne.x,K.y=ne.y)}),N.graph().width=Y.graph().width,N.graph().height=Y.graph().height}let _=["nodesep","edgesep","ranksep","marginx","marginy"],S={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},z=["acyclicer","ranker","rankdir","align"],k=["width","height","rank"],A={width:0,height:0},M=["minlen","weight","width","height","labeloffset"],T={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},q=["labelpos"];function j(N){let Y=new y({multigraph:!0,compound:!0}),P=F(N.graph());return Y.setGraph(Object.assign({},S,U(P,_),p.pick(P,z))),N.nodes().forEach(K=>{let ne=F(N.node(K));const re=U(ne,k);Object.keys(A).forEach(se=>{re[se]===void 0&&(re[se]=A[se])}),Y.setNode(K,re),Y.setParent(K,N.parent(K))}),N.edges().forEach(K=>{let ne=F(N.edge(K));Y.setEdge(K,Object.assign({},T,U(ne,M),p.pick(ne,q)))}),Y}function L(N){let Y=N.graph();Y.ranksep/=2,N.edges().forEach(P=>{let K=N.edge(P);K.minlen*=2,K.labelpos.toLowerCase()!=="c"&&(Y.rankdir==="TB"||Y.rankdir==="BT"?K.width+=K.labeloffset:K.height+=K.labeloffset)})}function X(N){N.edges().forEach(Y=>{let P=N.edge(Y);if(P.width&&P.height){let K=N.node(Y.v),re={rank:(N.node(Y.w).rank-K.rank)/2+K.rank,e:Y};p.addDummyNode(N,"edge-proxy",re,"_ep")}})}function B(N){let Y=0;N.nodes().forEach(P=>{let K=N.node(P);K.borderTop&&(K.minRank=N.node(K.borderTop).rank,K.maxRank=N.node(K.borderBottom).rank,Y=Math.max(Y,K.maxRank))}),N.graph().maxRank=Y}function I(N){N.nodes().forEach(Y=>{let P=N.node(Y);P.dummy==="edge-proxy"&&(N.edge(P.e).labelRank=P.rank,N.removeNode(Y))})}function ee(N){let Y=Number.POSITIVE_INFINITY,P=0,K=Number.POSITIVE_INFINITY,ne=0,re=N.graph(),se=re.marginx||0,ye=re.marginy||0;function ve(xe){let pe=xe.x,_e=xe.y,Me=xe.width,Ce=xe.height;Y=Math.min(Y,pe-Me/2),P=Math.max(P,pe+Me/2),K=Math.min(K,_e-Ce/2),ne=Math.max(ne,_e+Ce/2)}N.nodes().forEach(xe=>ve(N.node(xe))),N.edges().forEach(xe=>{let pe=N.edge(xe);Object.hasOwn(pe,"x")&&ve(pe)}),Y-=se,K-=ye,N.nodes().forEach(xe=>{let pe=N.node(xe);pe.x-=Y,pe.y-=K}),N.edges().forEach(xe=>{let pe=N.edge(xe);pe.points.forEach(_e=>{_e.x-=Y,_e.y-=K}),Object.hasOwn(pe,"x")&&(pe.x-=Y),Object.hasOwn(pe,"y")&&(pe.y-=K)}),re.width=P-Y+se,re.height=ne-K+ye}function H(N){N.edges().forEach(Y=>{let P=N.edge(Y),K=N.node(Y.v),ne=N.node(Y.w),re,se;P.points?(re=P.points[0],se=P.points[P.points.length-1]):(P.points=[],re=ne,se=K),P.points.unshift(p.intersectRect(K,re)),P.points.push(p.intersectRect(ne,se))})}function G(N){N.edges().forEach(Y=>{let P=N.edge(Y);if(Object.hasOwn(P,"x"))switch((P.labelpos==="l"||P.labelpos==="r")&&(P.width-=P.labeloffset),P.labelpos){case"l":P.x-=P.width/2+P.labeloffset;break;case"r":P.x+=P.width/2+P.labeloffset;break}})}function D(N){N.edges().forEach(Y=>{let P=N.edge(Y);P.reversed&&P.points.reverse()})}function $(N){N.nodes().forEach(Y=>{if(N.children(Y).length){let P=N.node(Y),K=N.node(P.borderTop),ne=N.node(P.borderBottom),re=N.node(P.borderLeft[P.borderLeft.length-1]),se=N.node(P.borderRight[P.borderRight.length-1]);P.width=Math.abs(se.x-re.x),P.height=Math.abs(ne.y-K.y),P.x=re.x+P.width/2,P.y=K.y+P.height/2}}),N.nodes().forEach(Y=>{N.node(Y).dummy==="border"&&N.removeNode(Y)})}function Z(N){N.edges().forEach(Y=>{if(Y.v===Y.w){var P=N.node(Y.v);P.selfEdges||(P.selfEdges=[]),P.selfEdges.push({e:Y,label:N.edge(Y)}),N.removeEdge(Y)}})}function J(N){var Y=p.buildLayerMatrix(N);Y.forEach(P=>{var K=0;P.forEach((ne,re)=>{var se=N.node(ne);se.order=re+K,(se.selfEdges||[]).forEach(ye=>{p.addDummyNode(N,"selfedge",{width:ye.label.width,height:ye.label.height,rank:se.rank,order:re+ ++K,e:ye.e,label:ye.label},"_se")}),delete se.selfEdges})})}function O(N){N.nodes().forEach(Y=>{var P=N.node(Y);if(P.dummy==="selfedge"){var K=N.node(P.e.v),ne=K.x+K.width/2,re=K.y,se=P.x-ne,ye=K.height/2;N.setEdge(P.e,P.label),N.removeNode(Y),P.label.points=[{x:ne+2*se/3,y:re-ye},{x:ne+5*se/6,y:re-ye},{x:ne+se,y:re},{x:ne+5*se/6,y:re+ye},{x:ne+2*se/3,y:re+ye}],P.label.x=P.x,P.label.y=P.y}})}function U(N,Y){return p.mapValues(p.pick(N,Y),Number)}function F(N){var Y={};return N&&Object.entries(N).forEach(([P,K])=>{typeof P=="string"&&(P=P.toLowerCase()),Y[P]=K}),Y}return Zh}var Kh,z1;function Gj(){if(z1)return Kh;z1=1;let e=Ct(),n=Vn().Graph;Kh={debugOrdering:i};function i(l){let o=e.buildLayerMatrix(l),s=new n({compound:!0,multigraph:!0}).setGraph({});return l.nodes().forEach(u=>{s.setNode(u,{label:u}),s.setParent(u,"layer"+l.node(u).rank)}),l.edges().forEach(u=>s.setEdge(u.v,u.w,{},u.name)),o.forEach((u,f)=>{let d="layer"+f;s.setNode(d,{rank:"same"}),u.reduce((h,m)=>(s.setEdge(h,m,{style:"invis"}),m))}),s}return Kh}var Jh,A1;function $j(){return A1||(A1=1,Jh="1.1.8"),Jh}var Wh,M1;function Xj(){return M1||(M1=1,Wh={graphlib:Vn(),layout:Yj(),debug:Gj(),util:{time:Ct().time,notime:Ct().notime},version:$j()}),Wh}var Fj=Xj();const j1=Ho(Fj),vo=200,Gl=56,O1=20,R1=40,Pj=20,D1=12;function Qj(e,n,i,l,o,s,u){const f=[],d=[],h=new Set,m=new Set,p=new Map;for(const v of i)for(const w of v.agents)m.add(w),p.set(w,v.name);for(const v of i){const w=o[v.name],E=v.agents.length,_=vo+O1*2,S=R1+E*Gl+(E-1)*D1+Pj;f.push({id:v.name,type:"groupNode",position:{x:0,y:0},data:{label:v.name,type:"parallel_group",status:(w==null?void 0:w.status)||"pending",groupName:v.name,progress:s[v.name]},style:{width:_,height:S}});for(let z=0;z$entryPoint",source:"$start",target:u,type:"animatedEdge",data:{},animated:!1})}for(const v of n)d.push({id:`${v.from}->${v.to}`,source:v.from,target:v.to,type:"animatedEdge",data:{when:v.when},animated:!1});return Zj(f,d),{nodes:f,edges:d}}function Zj(e,n){var l,o,s,u;const i=new j1.graphlib.Graph;i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:"TB",nodesep:50,ranksep:70,marginx:30,marginy:30});for(const f of e){if(f.parentId)continue;const d=f.type==="groupNode",h=d&&((l=f.style)==null?void 0:l.width)||vo,m=d&&((o=f.style)==null?void 0:o.height)||Gl;i.setNode(f.id,{width:h,height:m})}for(const f of n)i.hasNode(f.source)&&i.hasNode(f.target)&&i.setEdge(f.source,f.target);j1.layout(i);for(const f of e){if(f.parentId)continue;const d=i.node(f.id);if(!d)continue;const h=f.type==="groupNode",m=h&&((s=f.style)==null?void 0:s.width)||vo,p=h&&((u=f.style)==null?void 0:u.height)||Gl;f.position={x:d.x-m/2,y:d.y-p/2}}}const lt={pending:"#6b7280",running:"#3b82f6",completed:"#22c55e",failed:"#ef4444",paused:"#f59e0b",idle:"#6b7280",waiting:"#a855f7"},Kj=70,L1=90;function dm({data:e,children:n}){const[i,l]=V.useState(!1),o=V.useRef(null),s=V.useCallback(()=>{o.current=setTimeout(()=>l(!0),200)},[]),u=V.useCallback(()=>{o.current&&clearTimeout(o.current),l(!1)},[]),f=lt[e.status]||lt.pending;return b.jsxs("div",{className:"relative",onMouseEnter:s,onMouseLeave:u,children:[n,i&&b.jsxs("div",{className:Ye("absolute z-50 bottom-full left-1/2 -translate-x-1/2 mb-2","bg-[var(--surface-raised)] border border-[var(--border)] shadow-lg","rounded-lg px-3 py-2 max-w-[260px] pointer-events-none","animate-[tooltip-in_150ms_ease-out]"),children:[b.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 w-0 h-0 border-x-[6px] border-x-transparent border-t-[6px] border-t-[var(--border)]"}),b.jsxs("div",{className:"flex flex-col gap-1.5 text-[11px]",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:f}}),b.jsx("span",{className:"font-medium text-[var(--text)] capitalize",children:e.status}),e.iteration!=null&&e.iteration>1&&b.jsxs("span",{className:"text-[var(--text-muted)] ml-auto",children:["iter ",e.iteration]})]}),b.jsx("div",{className:"h-px bg-[var(--border)]"}),b.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[e.elapsed!=null&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-[var(--text-muted)]",children:"Elapsed"}),b.jsx("span",{className:"text-[var(--text)] font-mono",children:ln(e.elapsed)})]}),e.model&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-[var(--text-muted)]",children:"Model"}),b.jsx("span",{className:"text-[var(--text)] truncate",children:e.model})]}),e.tokens!=null&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-[var(--text-muted)]",children:"Tokens"}),b.jsxs("span",{className:"text-[var(--text)] font-mono",children:[Wn(e.tokens),e.inputTokens!=null&&e.outputTokens!=null&&b.jsxs("span",{className:"text-[var(--text-muted)]",children:[" ","(",Wn(e.inputTokens),"↑ ",Wn(e.outputTokens),"↓)"]})]})]}),e.costUsd!=null&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-[var(--text-muted)]",children:"Cost"}),b.jsx("span",{className:"text-[var(--text)] font-mono",children:Kl(e.costUsd)})]}),e.exitCode!=null&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-[var(--text-muted)]",children:"Exit code"}),b.jsx("span",{className:Ye("font-mono",e.exitCode===0?"text-[var(--completed)]":"text-[var(--failed)]"),children:e.exitCode})]}),e.selectedOption&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-[var(--text-muted)]",children:"Selected"}),b.jsx("span",{className:"text-[var(--text)] truncate",children:e.selectedOption})]})]}),e.errorMessage&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"h-px bg-[var(--border)]"}),b.jsxs("div",{className:"text-red-400 leading-tight",children:[e.errorType&&b.jsxs("span",{className:"font-medium",children:[e.errorType,": "]}),b.jsxs("span",{className:"break-words",children:[e.errorMessage.slice(0,120),e.errorMessage.length>120?"...":""]})]})]})]})]})]})}const Jj=V.memo(function({data:n,id:i,selected:l}){const o=n,u=he(M=>{var T;return(T=M.nodes[i])==null?void 0:T.status})||o.status||"pending",f=lt[u]||lt.pending,d=he(M=>{var T;return(T=M.nodes[i])==null?void 0:T.elapsed}),h=he(M=>{var T;return(T=M.nodes[i])==null?void 0:T.model}),m=he(M=>{var T;return(T=M.nodes[i])==null?void 0:T.tokens}),p=he(M=>{var T;return(T=M.nodes[i])==null?void 0:T.input_tokens}),y=he(M=>{var T;return(T=M.nodes[i])==null?void 0:T.output_tokens}),v=he(M=>{var T;return(T=M.nodes[i])==null?void 0:T.cost_usd}),w=he(M=>{var T;return(T=M.nodes[i])==null?void 0:T.iteration}),E=he(M=>{var T;return(T=M.nodes[i])==null?void 0:T.error_type}),_=he(M=>{var T;return(T=M.nodes[i])==null?void 0:T.error_message}),S=he(M=>{var T;return(T=M.nodes[i])==null?void 0:T.context_pct}),z=Wj(i,u),k=e4(u),A=(()=>{if(u==="failed"&&_)return{text:_.length>40?_.slice(0,37)+"...":_,className:"text-red-400"};if(u==="running")return{text:z,className:"text-[var(--text-muted)]"};if(u==="completed"){const M=[];return d!=null&&M.push(ln(d)),m!=null&&M.push(`${Wn(m)} tok`),v!=null&&M.push(Kl(v)),{text:M.join(" · ")||null,className:"text-[var(--text-muted)]"}}return{text:null,className:""}})();return b.jsxs(b.Fragment,{children:[b.jsx(an,{type:"target",position:we.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx(dm,{data:{status:u,elapsed:d,model:h,tokens:m,inputTokens:p,outputTokens:y,costUsd:v,iteration:w,errorType:E,errorMessage:_},children:b.jsxs("div",{className:Ye("flex items-center gap-2 px-3 py-1.5 rounded-lg border-2 bg-[var(--node-bg)] min-w-[140px] max-w-[220px] transition-all duration-300",l&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]",u==="running"&&"shadow-[0_0_12px_var(--running-glow)]",k),style:{borderColor:f},children:[b.jsx("div",{className:Ye("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",u==="running"&&"animate-pulse"),style:{backgroundColor:`${f}20`},children:b.jsx(F2,{className:"w-3.5 h-3.5",style:{color:f}})}),b.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[b.jsxs("div",{className:"flex items-center gap-1",children:[b.jsx("span",{className:"text-xs font-medium text-[var(--text)] truncate",children:o.label}),w!=null&&w>1&&b.jsxs("span",{className:"flex-shrink-0 inline-flex items-center justify-center px-1.5 py-0.5 rounded-full text-[9px] font-bold leading-none",style:{backgroundColor:`${f}25`,color:f},children:["x",w]})]}),A.text&&b.jsx("span",{className:Ye("text-[10px] truncate leading-tight",A.className),children:A.text})]}),S!=null&&b.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-[2px] rounded-b-lg overflow-hidden",style:{backgroundColor:"rgba(255,255,255,0.06)"},children:b.jsx("div",{className:Ye("h-full transition-all duration-500",S>=L1?"animate-[context-pulse_2s_ease-in-out_infinite]":""),style:{width:`${Math.min(S,100)}%`,backgroundColor:S>=L1?"#ef4444":S>=Kj?"#f59e0b":"#22c55e"}})})]})}),b.jsx(an,{type:"source",position:we.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function Wj(e,n){const i=he(d=>{var h;return(h=d.nodes[e])==null?void 0:h.startedAt}),l=he(d=>d.replayMode),o=he(d=>d.lastEventTime),[s,u]=V.useState("0.0s"),f=V.useRef(null);return V.useEffect(()=>{if(n==="running"){if(l){f.current&&clearInterval(f.current);const m=i??o??0;u(ln((o??m)-m));return}const d=i!=null?i*1e3:Date.now(),h=()=>{const m=(Date.now()-d)/1e3;u(ln(m))};return h(),f.current=setInterval(h,1e3),()=>{f.current&&clearInterval(f.current)}}else f.current&&clearInterval(f.current)},[n,i,l,o]),s}function e4(e){const n=V.useRef(e),[i,l]=V.useState("");return V.useEffect(()=>{const o=n.current;if(n.current=e,o===e)return;e==="running"?l("node-activate"):o==="running"&&(e==="completed"||e==="failed")&&l(e==="completed"?"node-complete":"node-fail");const s=setTimeout(()=>l(""),400);return()=>clearTimeout(s)},[e]),i}const t4=V.memo(function({data:n,id:i,selected:l}){const o=n,u=he(E=>{var _;return(_=E.nodes[i])==null?void 0:_.status})||o.status||"pending",f=lt[u]||lt.pending,d=he(E=>{var _;return(_=E.nodes[i])==null?void 0:_.elapsed}),h=he(E=>{var _;return(_=E.nodes[i])==null?void 0:_.exit_code}),m=he(E=>{var _;return(_=E.nodes[i])==null?void 0:_.error_type}),p=he(E=>{var _;return(_=E.nodes[i])==null?void 0:_.error_message}),y=n4(i,u),v=r4(u),w=(()=>{if(u==="failed"&&p)return{text:p.length>40?p.slice(0,37)+"...":p,className:"text-red-400"};if(u==="running")return{text:y,className:"text-[var(--text-muted)]"};if(u==="completed"){const E=[];return d!=null&&E.push(ln(d)),h!=null&&E.push(`exit ${h}`),{text:E.join(" · ")||null,className:"text-[var(--text-muted)]"}}return{text:null,className:""}})();return b.jsxs(b.Fragment,{children:[b.jsx(an,{type:"target",position:we.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx(dm,{data:{status:u,elapsed:d,exitCode:h,errorType:m,errorMessage:p},children:b.jsxs("div",{className:Ye("flex items-center gap-2 px-3 py-1.5 rounded-lg border-2 bg-[var(--node-bg)] min-w-[140px] max-w-[220px] transition-all duration-300",l&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]",u==="running"&&"shadow-[0_0_12px_var(--running-glow)]",v),style:{borderColor:f},children:[b.jsx("div",{className:Ye("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",u==="running"&&"animate-pulse"),style:{backgroundColor:`${f}20`},children:b.jsx(cN,{className:"w-3.5 h-3.5",style:{color:f}})}),b.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[b.jsx("span",{className:"text-xs font-medium text-[var(--text)] truncate",children:o.label}),w.text&&b.jsx("span",{className:Ye("text-[10px] truncate leading-tight",w.className),children:w.text})]})]})}),b.jsx(an,{type:"source",position:we.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function n4(e,n){const i=he(d=>{var h;return(h=d.nodes[e])==null?void 0:h.startedAt}),l=he(d=>d.replayMode),o=he(d=>d.lastEventTime),[s,u]=V.useState("0.0s"),f=V.useRef(null);return V.useEffect(()=>{if(n==="running"){if(l){f.current&&clearInterval(f.current);const m=i??o??0;u(ln((o??m)-m));return}const d=i!=null?i*1e3:Date.now(),h=()=>{const m=(Date.now()-d)/1e3;u(ln(m))};return h(),f.current=setInterval(h,1e3),()=>{f.current&&clearInterval(f.current)}}else f.current&&clearInterval(f.current)},[n,i,l,o]),s}function r4(e){const n=V.useRef(e),[i,l]=V.useState("");return V.useEffect(()=>{const o=n.current;if(n.current=e,o===e)return;e==="running"?l("node-activate"):o==="running"&&(e==="completed"||e==="failed")&&l(e==="completed"?"node-complete":"node-fail");const s=setTimeout(()=>l(""),400);return()=>clearTimeout(s)},[e]),i}const i4=V.memo(function({data:n,id:i,selected:l}){const o=n,u=he(m=>{var p;return(p=m.nodes[i])==null?void 0:p.status})||o.status||"pending",f=lt[u]||lt.pending,d=he(m=>{var p;return(p=m.nodes[i])==null?void 0:p.selected_option}),h=l4(u);return b.jsxs(b.Fragment,{children:[b.jsx(an,{type:"target",position:we.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx(dm,{data:{status:u,selectedOption:d},children:b.jsxs("div",{className:Ye("flex items-center gap-2 px-3 py-1.5 rounded-lg border-2 border-dashed bg-[var(--node-bg)] min-w-[140px] max-w-[220px] transition-all duration-300",l&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]",u==="waiting"&&"shadow-[0_0_12px_var(--waiting-muted)]",u==="running"&&"shadow-[0_0_12px_var(--running-glow)]",h),style:{borderColor:f},children:[b.jsx("div",{className:Ye("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",u==="waiting"&&"animate-pulse"),style:{backgroundColor:`${f}20`},children:b.jsx(uN,{className:"w-3.5 h-3.5",style:{color:f}})}),b.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[b.jsx("span",{className:"text-xs font-medium text-[var(--text)] truncate",children:o.label}),u==="waiting"&&b.jsx("span",{className:"text-[10px] text-[var(--waiting)] truncate leading-tight",children:"Awaiting input..."}),u==="completed"&&d&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] truncate leading-tight",children:d})]})]})}),b.jsx(an,{type:"source",position:we.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function l4(e){const n=V.useRef(e),[i,l]=V.useState("");return V.useEffect(()=>{const o=n.current;if(n.current=e,o===e)return;e==="running"||e==="waiting"?l("node-activate"):(o==="running"||o==="waiting")&&e==="completed"&&l("node-complete");const s=setTimeout(()=>l(""),400);return()=>clearTimeout(s)},[e]),i}const a4=V.memo(function({data:n,id:i,selected:l}){const o=n,u=o.type==="for_each_group"?aN:nN,f=o.progress,h=he(E=>{var _;return(_=E.nodes[i])==null?void 0:_.status})||o.status||"pending",m=lt[h]||lt.pending,p=o4(h),y=f?`${f.completed+f.failed}/${f.total}${f.failed>0?` (${f.failed} failed)`:""}`:null,v=f&&f.total>0?(f.completed+f.failed)/f.total*100:0,w=f!=null&&f.failed>0;return b.jsxs(b.Fragment,{children:[b.jsx(an,{type:"target",position:we.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsxs("div",{className:Ye("flex flex-col gap-1 px-4 py-3 rounded-xl border-2 border-dashed bg-[var(--surface)]/80 min-w-[180px] transition-all duration-300",l&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]",h==="running"&&"shadow-[0_0_16px_var(--running-glow)]",p),style:{borderColor:m,minHeight:"100%"},children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(u,{className:"w-3.5 h-3.5",style:{color:m}}),b.jsx("span",{className:"text-xs font-medium text-[var(--text-secondary)]",children:o.label})]}),y&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] font-mono",children:y}),f&&f.total>0&&h==="running"&&b.jsx("div",{className:"w-full h-1 rounded-full bg-[var(--border)] overflow-hidden mt-0.5",children:b.jsx("div",{className:"h-full rounded-full transition-all duration-500 ease-out",style:{width:`${v}%`,backgroundColor:w?"var(--failed)":"var(--completed)"}})})]}),b.jsx(an,{type:"source",position:we.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function o4(e){const n=V.useRef(e),[i,l]=V.useState("");return V.useEffect(()=>{const o=n.current;if(n.current=e,o===e)return;e==="running"?l("node-activate"):o==="running"&&(e==="completed"||e==="failed")&&l(e==="completed"?"node-complete":"node-fail");const s=setTimeout(()=>l(""),400);return()=>clearTimeout(s)},[e]),i}const s4=V.memo(function({data:n,selected:i}){const o=n.status||"pending",s=o==="completed",u=o==="failed",f=!s&&!u,d=s?lt.completed:u?lt.failed:lt.pending;return b.jsxs(b.Fragment,{children:[b.jsx(an,{type:"target",position:we.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx("div",{className:Ye("flex items-center justify-center w-11 h-11 rounded-full border-2 transition-all duration-300",s?"bg-[var(--completed)] shadow-[0_0_16px_var(--completed-muted)]":u?"bg-[var(--failed)] shadow-[0_0_16px_var(--failed-muted)]":"bg-[var(--node-bg)]",i&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]"),style:{borderColor:d},children:s?b.jsx(Bi,{className:"w-5 h-5 text-white",strokeWidth:3}):u?b.jsx(zb,{className:"w-3.5 h-3.5 text-white",fill:"white"}):b.jsx(Bi,{className:"w-5 h-5",strokeWidth:2.5,style:{color:f?lt.pending:d}})})]})}),u4=V.memo(function({data:n,selected:i}){const o=n.status||"pending",s=lt[o]||lt.pending,u=o==="running"||o==="completed";return b.jsxs(b.Fragment,{children:[b.jsx("div",{className:Ye("flex items-center justify-center w-11 h-11 rounded-full border-2 transition-all duration-300",u?"bg-[var(--completed)]":"bg-[var(--node-bg)]",i&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]",u&&"shadow-[0_0_12px_var(--completed-muted)]"),style:{borderColor:s},children:b.jsx(Vp,{className:"w-4 h-4 ml-0.5",style:{color:u?"white":s}})}),b.jsx(an,{type:"source",position:we.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})}),c4=V.memo(function({id:n,sourceX:i,sourceY:l,targetX:o,targetY:s,sourcePosition:u,targetPosition:f,source:d,target:h,data:m}){const p=he(L=>L.highlightedEdges),y=V.useMemo(()=>p.find(L=>L.from===d&&L.to===h),[p,d,h]),[v,w,E]=im({sourceX:i,sourceY:l,targetX:o,targetY:s,sourcePosition:u,targetPosition:f}),_=m==null?void 0:m.when,S=!!_,z=(y==null?void 0:y.state)==="taken",k=(y==null?void 0:y.state)==="highlighted",A=(y==null?void 0:y.state)==="failed";let M="var(--edge-color)",T=2,q;A?(M="var(--failed)",T=3):z?(M="var(--edge-taken)",T=3):k&&(M="var(--edge-active)",T=3),S&&!z&&!k&&!A&&(q="6 3");const j=A?"failed":z?"taken":k?"active":"default";return b.jsxs(b.Fragment,{children:[b.jsx(Xo,{id:n,path:v,style:{stroke:M,strokeWidth:T,strokeDasharray:q,transition:"stroke 0.3s ease, stroke-width 0.3s ease"},markerEnd:`url(#arrow-${j})`}),S&&b.jsx(OM,{children:b.jsx("div",{className:"nodrag nopan",style:{position:"absolute",transform:`translate(-50%, -50%) translate(${w}px,${E}px)`,pointerEvents:"all"},children:b.jsx("span",{className:"inline-block px-1.5 py-0.5 rounded-full text-[9px] font-mono leading-tight max-w-[140px] truncate",style:{backgroundColor:A?"var(--failed)":z?"var(--edge-taken)":"var(--surface)",color:A||z?"var(--bg)":"var(--text-muted)",border:`1px solid ${A?"var(--failed)":z?"var(--edge-taken)":"var(--border)"}`},title:_,children:_})})}),z&&b.jsx("circle",{r:"3",fill:"var(--edge-taken)",children:b.jsx("animateMotion",{dur:"1s",repeatCount:"indefinite",path:v})}),A&&b.jsx("circle",{r:"3",fill:"var(--failed)",opacity:"0.8",children:b.jsx("animateMotion",{dur:"1.5s",repeatCount:"indefinite",path:v})})]})});function f4(){const e=he(u=>u.workflowStatus),n=he(u=>u.workflowFailure),i=he(u=>u.workflowFailedAgent),l=he(u=>u.selectNode);if(e!=="failed"||!n)return null;const o=n.message||n.error_type||"Unknown error",s=n.error_type==="TimeoutError";return b.jsx("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 z-20 animate-[banner-in_200ms_ease-out]",children:b.jsxs("div",{className:Ye("flex items-center gap-2 px-4 py-2 rounded-lg","bg-red-950/90 border border-red-500/40 shadow-lg shadow-red-500/10","backdrop-blur-sm max-w-[560px]"),children:[b.jsx(Ab,{className:"w-4 h-4 text-red-400 flex-shrink-0"}),b.jsxs("div",{className:"flex flex-col min-w-0",children:[b.jsx("span",{className:"text-xs font-medium text-red-300",children:"Workflow Failed"}),b.jsx("span",{className:"text-[11px] text-red-400/80 truncate",children:o}),s&&n.current_agent&&b.jsxs("span",{className:"text-[10px] text-red-400/60 truncate",children:["Timed out on agent: ",n.current_agent]}),n.checkpoint_path&&b.jsxs("span",{className:"text-[10px] text-red-400/50 truncate",title:n.checkpoint_path,children:["Checkpoint: ",n.checkpoint_path.split("/").pop()]})]}),i&&b.jsxs("button",{onClick:()=>l(i),className:"flex items-center gap-1 px-2 py-1 rounded text-[10px] font-medium text-red-300 bg-red-500/20 hover:bg-red-500/30 transition-colors flex-shrink-0 ml-1",children:[b.jsx(W2,{className:"w-3 h-3"}),"View"]})]})})}function d4(){const[e,n]=V.useState(!1),i=he(d=>d.workflowStatus),l=he(d=>d.totalCost),o=he(d=>d.totalTokens),s=he(d=>d.agentsCompleted),u=he(d=>d.agentsTotal),f=jb();return i!=="completed"||e?null:b.jsx("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 z-20 animate-[banner-in_200ms_ease-out]",children:b.jsxs("div",{className:Ye("flex items-center gap-3 px-4 py-2 rounded-lg","bg-green-950/90 border border-green-500/40 shadow-lg shadow-green-500/10","backdrop-blur-sm"),children:[b.jsx(Q2,{className:"w-4 h-4 text-green-400 flex-shrink-0"}),b.jsx("span",{className:"text-xs font-medium text-green-300",children:"Completed"}),b.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-green-400/80 font-mono",children:[b.jsx("span",{children:f}),u>0&&b.jsxs("span",{children:[s,"/",u," agents"]}),o>0&&b.jsxs("span",{children:[Wn(o)," tok"]}),l>0&&b.jsx("span",{children:Kl(l)})]}),b.jsx("button",{onClick:()=>n(!0),className:"p-0.5 rounded text-green-500/60 hover:text-green-300 transition-colors flex-shrink-0 ml-1",children:b.jsx(aa,{className:"w-3.5 h-3.5"})})]})})}const h4={agentNode:Jj,scriptNode:t4,gateNode:i4,groupNode:a4,endNode:s4,startNode:u4},p4={animatedEdge:c4},m4={type:"animatedEdge"};function g4(){return b.jsx("svg",{style:{position:"absolute",width:0,height:0},children:b.jsxs("defs",{children:[b.jsx("marker",{id:"arrow-default",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:b.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"var(--edge-color)"})}),b.jsx("marker",{id:"arrow-active",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:b.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"var(--edge-active)"})}),b.jsx("marker",{id:"arrow-taken",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:b.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"var(--edge-taken)"})}),b.jsx("marker",{id:"arrow-failed",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:b.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"var(--failed)"})})]})})}function y4(){const e=he(j=>j.agents),n=he(j=>j.routes),i=he(j=>j.parallelGroups),l=he(j=>j.forEachGroups),o=he(j=>j.nodes),s=he(j=>j.groupProgress),u=he(j=>j.selectNode),f=he(j=>j.selectedNode),d=he(j=>j.workflowStatus),h=he(j=>j.entryPoint),m=he(j=>j.wsStatus),p=he(j=>j.workflowFailedAgent),[y,v,w]=RM([]),[E,_,S]=DM([]),z=V.useRef(!1);V.useEffect(()=>{if(e.length===0||z.current)return;z.current=!0;const{nodes:j,edges:L}=Qj(e,n,i,l,o,s,h);v(j),_(L)},[e,n,i,l,o,s,h,v,_]),V.useEffect(()=>{z.current&&v(j=>j.map(L=>{const X=o[L.id];if(!X)return L;const B=X.status||"pending",I=L.data.status;if(B!==I){const ee={...L.data,status:B};return L.data.groupName&&s[L.data.groupName]&&(ee.progress=s[L.data.groupName]),{...L,data:ee}}if(L.data.groupName&&s[L.data.groupName]){const ee=L.data.progress,H=s[L.data.groupName];if(H&&(!ee||ee.completed!==H.completed||ee.failed!==H.failed))return{...L,data:{...L.data,progress:H}}}return L}))},[o,s,v]);const k=V.useCallback((j,L)=>{L.type==="groupNode"&&L.data.type!=="for_each_group"||u(L.id)},[u]),A=V.useCallback(()=>{u(null)},[u]),M=V.useCallback(j=>{var X;const L=((X=j.data)==null?void 0:X.status)||"pending";return lt[L]||lt.pending},[]);V.useEffect(()=>{v(j=>j.map(L=>({...L,selected:L.id===f})))},[f,v]),V.useEffect(()=>{d==="failed"&&p&&u(p)},[d,p,u]);const T=d==="pending"&&e.length===0,q=(()=>{switch(m){case"connecting":return"Connecting to workflow…";case"reconnecting":return"Reconnecting…";case"disconnected":return"Connection lost. Retrying…";default:return"Waiting for workflow…"}})();return b.jsxs("div",{className:"w-full h-full relative",children:[b.jsx(g4,{}),b.jsx(f4,{}),b.jsx(d4,{}),T&&b.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center pointer-events-none",children:[b.jsxs("div",{className:"relative mb-3",children:[b.jsx(hN,{className:"w-8 h-8 text-[var(--accent)] opacity-20"}),b.jsx(Zl,{className:"w-8 h-8 text-[var(--text-muted)] animate-spin absolute inset-0 opacity-40"})]}),b.jsx("p",{className:"text-sm text-[var(--text-muted)] animate-pulse",children:q})]}),b.jsxs(MM,{nodes:y,edges:E,onNodesChange:w,onEdgesChange:S,onNodeClick:k,onPaneClick:A,nodeTypes:h4,edgeTypes:p4,defaultEdgeOptions:m4,fitView:!0,fitViewOptions:{padding:.2},minZoom:.2,maxZoom:2,proOptions:{hideAttribution:!0},nodesDraggable:!0,nodesConnectable:!1,elementsSelectable:!0,children:[b.jsx(UM,{variant:Tr.Dots,gap:20,size:1,color:"var(--border-subtle)"}),b.jsx(aj,{nodeColor:M,maskColor:"var(--minimap-mask)",style:{background:"var(--minimap-bg)"},pannable:!0,zoomable:!0}),b.jsx(FM,{showInteractive:!1,children:b.jsx(x4,{})}),b.jsx(v4,{})]})]})}function x4(){const{fitView:e}=$o(),n=V.useCallback(()=>{e({padding:.2,duration:300})},[e]);return b.jsx("button",{onClick:n,className:"react-flow__controls-button",title:"Fit view (F)",style:{display:"flex",alignItems:"center",justifyContent:"center"},children:b.jsx(iN,{className:"w-3.5 h-3.5"})})}function v4(){const{fitView:e}=$o();return V.useEffect(()=>{const n=i=>{var o;const l=(o=i.target)==null?void 0:o.tagName;l==="INPUT"||l==="TEXTAREA"||l==="SELECT"||i.key==="f"&&!i.ctrlKey&&!i.metaKey&&!i.altKey&&e({padding:.2,duration:300})};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e]),null}function oa({items:e}){const n=e.filter(i=>i.value!=null&&i.value!=="");return n.length===0?null:b.jsx("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1.5 text-xs",children:n.map(({label:i,value:l})=>b.jsxs("div",{className:"contents",children:[b.jsx("dt",{className:"text-[var(--text-muted)] whitespace-nowrap",children:i}),b.jsx("dd",{className:"text-[var(--text)] break-words",children:typeof l=="object"?JSON.stringify(l):String(l)})]},i))})}function VS(e){const n=[];return e.elapsed!=null&&n.push({label:"Elapsed",value:ln(e.elapsed)}),e.model&&n.push({label:"Model",value:e.model}),e.tokens!=null&&n.push({label:"Tokens",value:Wn(e.tokens)}),e.input_tokens!=null&&e.output_tokens!=null&&n.push({label:"In / Out",value:`${Wn(e.input_tokens)} / ${Wn(e.output_tokens)}`}),e.cost_usd!=null&&n.push({label:"Cost",value:Kl(e.cost_usd)}),e.context_window_used!=null&&e.context_window_max!=null&&n.push({label:"Context",value:SN(e.context_window_used,e.context_window_max)}),e.iteration!=null&&n.push({label:"Iteration",value:e.iteration}),e.error_type&&n.push({label:"Error",value:e.error_type}),e.error_message&&n.push({label:"Message",value:e.error_message}),n}function Fi({output:e,title:n="Output",defaultExpanded:i=!0,maxHeight:l="300px"}){const[o,s]=V.useState(i),[u,f]=V.useState(!1),d=Mb(e);if(!d)return null;const h=typeof e=="object"&&e!==null,m=async()=>{await navigator.clipboard.writeText(d),f(!0),setTimeout(()=>f(!1),2e3)};return b.jsxs("div",{className:"space-y-1.5",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("button",{onClick:()=>s(!o),className:"flex items-center gap-1 text-[10px] uppercase tracking-wider text-[var(--text-muted)] hover:text-[var(--text)] transition-colors font-semibold",children:[o?b.jsx(Pi,{className:"w-3 h-3"}):b.jsx(la,{className:"w-3 h-3"}),n]}),o&&b.jsx("button",{onClick:m,className:"flex items-center gap-1 text-[10px] text-[var(--text-muted)] hover:text-[var(--text)] transition-colors",title:"Copy to clipboard",children:u?b.jsx(Bi,{className:"w-3 h-3 text-[var(--completed)]"}):b.jsx(Cb,{className:"w-3 h-3"})})]}),o&&b.jsx("pre",{className:"bg-[var(--bg)] border border-[var(--border)] rounded-md p-3 font-mono text-[11px] leading-relaxed text-[var(--text)] overflow-auto whitespace-pre-wrap break-words",style:{maxHeight:l},children:h?b.jsx(b4,{text:d}):d})]})}function b4({text:e}){const n=e.split(/("(?:[^"\\]|\\.)*")/g);return b.jsx(b.Fragment,{children:n.map((i,l)=>{if(l%2===1){const s=n.slice(l+1).join(""),u=/^\s*:/.test(s);return b.jsx("span",{className:u?"text-blue-400":"text-green-400",children:i},l)}const o=i.replace(/\b(true|false|null)\b|(-?\d+\.?\d*(?:e[+-]?\d+)?)/gi,(s,u,f)=>u?`${s}`:f?`${s}`:s);return b.jsx("span",{dangerouslySetInnerHTML:{__html:o}},l)})})}function hm({activity:e,defaultExpanded:n=!0}){const[i,l]=V.useState(n),o=V.useRef(null);return V.useEffect(()=>{o.current&&i&&(o.current.scrollTop=o.current.scrollHeight)},[e.length,i]),e.length===0?null:b.jsxs("div",{className:"space-y-1.5",children:[b.jsxs("button",{onClick:()=>l(!i),className:"flex items-center gap-1 text-[10px] uppercase tracking-wider text-[var(--text-muted)] hover:text-[var(--text)] transition-colors font-semibold",children:[i?b.jsx(Pi,{className:"w-3 h-3"}):b.jsx(la,{className:"w-3 h-3"}),"Activity (",e.length,")"]}),i&&b.jsx("div",{ref:o,className:"max-h-[400px] overflow-y-auto space-y-0.5",children:e.map((s,u)=>b.jsx(w4,{entry:s},u))})]})}function w4({entry:e}){const n={reasoning:"text-indigo-400/70","tool-start":"text-blue-400","tool-complete":"text-green-400",turn:"text-amber-400",message:"text-[var(--text)]"};return b.jsxs("div",{className:Ye("py-1.5 px-2 rounded text-[11px] leading-relaxed border-b border-[var(--border-subtle)] last:border-b-0"),children:[b.jsxs("div",{className:"flex items-start gap-1.5",children:[b.jsx("span",{className:"w-4 text-center flex-shrink-0",children:e.icon}),b.jsx("span",{className:"text-[var(--text-muted)] uppercase text-[9px] font-semibold tracking-wider w-12 flex-shrink-0 pt-px",children:e.label}),b.jsx("span",{className:Ye("break-words",n[e.type]||"text-[var(--text)]"),children:typeof e.text=="object"?JSON.stringify(e.text):e.text})]}),e.detail&&b.jsx("div",{className:"mt-1 ml-[4.25rem] px-2 py-1 bg-[var(--bg)] rounded text-[10px] font-mono text-[var(--text-muted)] whitespace-pre-wrap break-words max-h-24 overflow-y-auto",children:typeof e.detail=="object"?JSON.stringify(e.detail,null,2):e.detail})]})}function S4({node:e}){const n=e.status,i=lt[n]||lt.pending,l=e.iterationHistory&&e.iterationHistory.length>0;return b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-[10px] font-bold uppercase tracking-wider",style:{backgroundColor:`${i}20`,color:i},children:n}),b.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Agent"})]}),l?b.jsx(H1,{label:`Iteration ${e.iteration??"?"} (current)`,defaultExpanded:!0,status:n,snapshot:{iteration:e.iteration??0,prompt:e.prompt,output:e.output,elapsed:e.elapsed,model:e.model,tokens:e.tokens,input_tokens:e.input_tokens,output_tokens:e.output_tokens,cost_usd:e.cost_usd,activity:e.activity,error_type:e.error_type,error_message:e.error_message}}):b.jsxs(b.Fragment,{children:[b.jsx(oa,{items:VS(e)}),e.prompt&&b.jsx(Fi,{output:e.prompt,title:"Input / Prompt",defaultExpanded:!0}),b.jsx(hm,{activity:e.activity,defaultExpanded:n!=="completed"}),e.output!=null&&b.jsx(Fi,{output:e.output,title:"Output"})]}),l&&[...e.iterationHistory].reverse().map(o=>b.jsx(H1,{label:`Iteration ${o.iteration}`,defaultExpanded:!1,status:n,snapshot:o},o.iteration))]})}function H1({label:e,defaultExpanded:n,snapshot:i,status:l}){const[o,s]=V.useState(n);return b.jsxs("div",{className:"border border-[var(--border)] rounded-lg overflow-hidden",children:[b.jsxs("button",{onClick:()=>s(!o),className:"flex items-center gap-2 w-full px-3 py-2 bg-[var(--bg)] hover:bg-[var(--node-bg)] transition-colors text-left",children:[o?b.jsx(Pi,{className:"w-3.5 h-3.5 text-[var(--text-muted)] flex-shrink-0"}):b.jsx(la,{className:"w-3.5 h-3.5 text-[var(--text-muted)] flex-shrink-0"}),b.jsx("span",{className:"text-xs font-semibold text-[var(--text)]",children:e}),i.elapsed!=null&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] ml-auto",children:_4(i.elapsed)})]}),o&&b.jsxs("div",{className:"px-3 py-3 space-y-3 border-t border-[var(--border)]",children:[b.jsx(oa,{items:VS(i)}),i.prompt&&b.jsx(Fi,{output:i.prompt,title:"Input / Prompt",defaultExpanded:!1}),b.jsx(hm,{activity:i.activity,defaultExpanded:n&&l!=="completed"}),i.output!=null&&b.jsx(Fi,{output:i.output,title:"Output",defaultExpanded:!0}),i.error_type&&b.jsxs("div",{className:"text-xs text-red-400",children:[b.jsx("span",{className:"font-semibold",children:i.error_type}),i.error_message&&b.jsxs("span",{className:"ml-1",children:["— ",i.error_message]})]})]})]})}function _4(e){if(e<1)return`${(e*1e3).toFixed(0)}ms`;if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e/60),i=(e%60).toFixed(0);return`${n}m ${i}s`}function E4({node:e}){const n=e.status,i=lt[n]||lt.pending,l=[];e.elapsed!=null&&l.push({label:"Elapsed",value:ln(e.elapsed)}),e.exit_code!=null&&l.push({label:"Exit Code",value:e.exit_code}),e.error_type&&l.push({label:"Error",value:e.error_type}),e.error_message&&l.push({label:"Message",value:e.error_message});let o="";return e.stdout&&(o+=e.stdout),e.stderr&&(o+=(o?` --- stderr --- -`:"")+e.stderr),b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-[10px] font-bold uppercase tracking-wider",style:{backgroundColor:`${i}20`,color:i},children:n}),b.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Script"})]}),b.jsx(la,{items:l}),o&&b.jsx(Pi,{output:o,title:"Output"})]})}function _4(e,n){const i={};return(e[e.length-1]===""?[...e,""]:e).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const E4=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,N4=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,k4={};function B1(e,n){return(k4.jsx?N4:E4).test(e)}const C4=/[ \t\n\f\r]/g;function T4(e){return typeof e=="object"?e.type==="text"?q1(e.value):!1:q1(e)}function q1(e){return e.replace(C4,"")===""}class Po{constructor(n,i,l){this.normal=i,this.property=n,l&&(this.space=l)}}Po.prototype.normal={};Po.prototype.property={};Po.prototype.space=void 0;function IS(e,n){const i={},l={};for(const o of e)Object.assign(i,o.property),Object.assign(l,o.normal);return new Po(i,l,n)}function jp(e){return e.toLowerCase()}class on{constructor(n,i){this.attribute=i,this.property=n}}on.prototype.attribute="";on.prototype.booleanish=!1;on.prototype.boolean=!1;on.prototype.commaOrSpaceSeparated=!1;on.prototype.commaSeparated=!1;on.prototype.defined=!1;on.prototype.mustUseProperty=!1;on.prototype.number=!1;on.prototype.overloadedBoolean=!1;on.prototype.property="";on.prototype.spaceSeparated=!1;on.prototype.space=void 0;let z4=0;const Oe=Qi(),kt=Qi(),Op=Qi(),me=Qi(),at=Qi(),Fl=Qi(),gn=Qi();function Qi(){return 2**++z4}const Rp=Object.freeze(Object.defineProperty({__proto__:null,boolean:Oe,booleanish:kt,commaOrSpaceSeparated:gn,commaSeparated:Fl,number:me,overloadedBoolean:Op,spaceSeparated:at},Symbol.toStringTag,{value:"Module"})),ep=Object.keys(Rp);class pm extends on{constructor(n,i,l,o){let s=-1;if(super(n,i),U1(this,"space",o),typeof l=="number")for(;++s4&&i.slice(0,4)==="data"&&R4.test(n)){if(n.charAt(4)==="-"){const s=n.slice(5).replace(I1,H4);l="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=n.slice(4);if(!I1.test(s)){let u=s.replace(O4,L4);u.charAt(0)!=="-"&&(u="-"+u),n="data"+u}}o=pm}return new o(l,n)}function L4(e){return"-"+e.toLowerCase()}function H4(e){return e.charAt(1).toUpperCase()}const B4=IS([VS,A4,$S,XS,PS],"html"),mm=IS([VS,M4,$S,XS,PS],"svg");function q4(e){return e.join(" ").trim()}var Hl={},tp,V1;function U4(){if(V1)return tp;V1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,i=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,f=/^\s+|\s+$/g,d=` -`,h="/",m="*",p="",y="comment",v="declaration";function w(S,_){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];_=_||{};var z=1,E=1;function A(L){var G=L.match(n);G&&(z+=G.length);var R=L.lastIndexOf(d);E=~R?L.length-R:E+L.length}function B(){var L={line:z,column:E};return function(G){return G.position=new T(L),D(),G}}function T(L){this.start=L,this.end={line:z,column:E},this.source=_.source}T.prototype.content=S;function q(L){var G=new Error(_.source+":"+z+":"+E+": "+L);if(G.reason=L,G.filename=_.source,G.line=z,G.column=E,G.source=S,!_.silent)throw G}function M(L){var G=L.exec(S);if(G){var R=G[0];return A(R),S=S.slice(R.length),G}}function D(){M(i)}function X(L){var G;for(L=L||[];G=H();)G!==!1&&L.push(G);return L}function H(){var L=B();if(!(h!=S.charAt(0)||m!=S.charAt(1))){for(var G=2;p!=S.charAt(G)&&(m!=S.charAt(G)||h!=S.charAt(G+1));)++G;if(G+=2,p===S.charAt(G-1))return q("End of comment missing");var R=S.slice(2,G-2);return E+=2,A(R),S=S.slice(G),E+=2,L({type:y,comment:R})}}function I(){var L=B(),G=M(l);if(G){if(H(),!M(o))return q("property missing ':'");var R=M(s),$=L({type:v,property:k(G[0].replace(e,p)),value:R?k(R[0].replace(e,p)):p});return M(u),$}}function ee(){var L=[];X(L);for(var G;G=I();)G!==!1&&(L.push(G),X(L));return L}return D(),ee()}function k(S){return S?S.replace(f,p):p}return tp=w,tp}var Y1;function I4(){if(Y1)return Hl;Y1=1;var e=Hl&&Hl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(Hl,"__esModule",{value:!0}),Hl.default=i;const n=e(U4());function i(l,o){let s=null;if(!l||typeof l!="string")return s;const u=(0,n.default)(l),f=typeof o=="function";return u.forEach(d=>{if(d.type!=="declaration")return;const{property:h,value:m}=d;f?o(h,m,d):m&&(s=s||{},s[h]=m)}),s}return Hl}var oo={},G1;function V4(){if(G1)return oo;G1=1,Object.defineProperty(oo,"__esModule",{value:!0}),oo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,i=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,s=function(h){return!h||i.test(h)||e.test(h)},u=function(h,m){return m.toUpperCase()},f=function(h,m){return"".concat(m,"-")},d=function(h,m){return m===void 0&&(m={}),s(h)?h:(h=h.toLowerCase(),m.reactCompat?h=h.replace(o,f):h=h.replace(l,f),h.replace(n,u))};return oo.camelCase=d,oo}var so,$1;function Y4(){if($1)return so;$1=1;var e=so&&so.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},n=e(I4()),i=V4();function l(o,s){var u={};return!o||typeof o!="string"||(0,n.default)(o,function(f,d){f&&d&&(u[(0,i.camelCase)(f,s)]=d)}),u}return l.default=l,so=l,so}var G4=Y4();const $4=Lo(G4),FS=QS("end"),gm=QS("start");function QS(e){return n;function n(i){const l=i&&i.position&&i.position[e]||{};if(typeof l.line=="number"&&l.line>0&&typeof l.column=="number"&&l.column>0)return{line:l.line,column:l.column,offset:typeof l.offset=="number"&&l.offset>-1?l.offset:void 0}}}function X4(e){const n=gm(e),i=FS(e);if(n&&i)return{start:n,end:i}}function bo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?X1(e.position):"start"in e||"end"in e?X1(e):"line"in e||"column"in e?Dp(e):""}function Dp(e){return P1(e&&e.line)+":"+P1(e&&e.column)}function X1(e){return Dp(e&&e.start)+"-"+Dp(e&&e.end)}function P1(e){return e&&typeof e=="number"?e:1}class Gt extends Error{constructor(n,i,l){super(),typeof i=="string"&&(l=i,i=void 0);let o="",s={},u=!1;if(i&&("line"in i&&"column"in i?s={place:i}:"start"in i&&"end"in i?s={place:i}:"type"in i?s={ancestors:[i],place:i.position}:s={...i}),typeof n=="string"?o=n:!s.cause&&n&&(u=!0,o=n.message,s.cause=n),!s.ruleId&&!s.source&&typeof l=="string"){const d=l.indexOf(":");d===-1?s.ruleId=l:(s.source=l.slice(0,d),s.ruleId=l.slice(d+1))}if(!s.place&&s.ancestors&&s.ancestors){const d=s.ancestors[s.ancestors.length-1];d&&(s.place=d.position)}const f=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=f?f.line:void 0,this.name=bo(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=u&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Gt.prototype.file="";Gt.prototype.name="";Gt.prototype.reason="";Gt.prototype.message="";Gt.prototype.stack="";Gt.prototype.column=void 0;Gt.prototype.line=void 0;Gt.prototype.ancestors=void 0;Gt.prototype.cause=void 0;Gt.prototype.fatal=void 0;Gt.prototype.place=void 0;Gt.prototype.ruleId=void 0;Gt.prototype.source=void 0;const ym={}.hasOwnProperty,P4=new Map,F4=/[A-Z]/g,Q4=new Set(["table","tbody","thead","tfoot","tr"]),Z4=new Set(["td","th"]),ZS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function K4(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const i=n.filePath||void 0;let l;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");l=l5(i,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");l=i5(i,n.jsx,n.jsxs)}const o={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:l,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:i,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?mm:B4,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},s=KS(o,e,void 0);return s&&typeof s!="string"?s:o.create(e,o.Fragment,{children:s||void 0},void 0)}function KS(e,n,i){if(n.type==="element")return J4(e,n,i);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return W4(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return t5(e,n,i);if(n.type==="mdxjsEsm")return e5(e,n);if(n.type==="root")return n5(e,n,i);if(n.type==="text")return r5(e,n)}function J4(e,n,i){const l=e.schema;let o=l;n.tagName.toLowerCase()==="svg"&&l.space==="html"&&(o=mm,e.schema=o),e.ancestors.push(n);const s=WS(e,n.tagName,!1),u=a5(e,n);let f=vm(e,n);return Q4.has(n.tagName)&&(f=f.filter(function(d){return typeof d=="string"?!T4(d):!0})),JS(e,u,s,n),xm(u,f),e.ancestors.pop(),e.schema=l,e.create(n,s,u,i)}function W4(e,n){if(n.data&&n.data.estree&&e.evaluater){const l=n.data.estree.body[0];return l.type,e.evaluater.evaluateExpression(l.expression)}Do(e,n.position)}function e5(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Do(e,n.position)}function t5(e,n,i){const l=e.schema;let o=l;n.name==="svg"&&l.space==="html"&&(o=mm,e.schema=o),e.ancestors.push(n);const s=n.name===null?e.Fragment:WS(e,n.name,!0),u=o5(e,n),f=vm(e,n);return JS(e,u,s,n),xm(u,f),e.ancestors.pop(),e.schema=l,e.create(n,s,u,i)}function n5(e,n,i){const l={};return xm(l,vm(e,n)),e.create(n,e.Fragment,l,i)}function r5(e,n){return n.value}function JS(e,n,i,l){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(n.node=l)}function xm(e,n){if(n.length>0){const i=n.length>1?n:n[0];i&&(e.children=i)}}function i5(e,n,i){return l;function l(o,s,u,f){const h=Array.isArray(u.children)?i:n;return f?h(s,u,f):h(s,u)}}function l5(e,n){return i;function i(l,o,s,u){const f=Array.isArray(s.children),d=gm(l);return n(o,s,u,f,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function a5(e,n){const i={};let l,o;for(o in n.properties)if(o!=="children"&&ym.call(n.properties,o)){const s=s5(e,o,n.properties[o]);if(s){const[u,f]=s;e.tableCellAlignToStyle&&u==="align"&&typeof f=="string"&&Z4.has(n.tagName)?l=f:i[u]=f}}if(l){const s=i.style||(i.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=l}return i}function o5(e,n){const i={};for(const l of n.attributes)if(l.type==="mdxJsxExpressionAttribute")if(l.data&&l.data.estree&&e.evaluater){const s=l.data.estree.body[0];s.type;const u=s.expression;u.type;const f=u.properties[0];f.type,Object.assign(i,e.evaluater.evaluateExpression(f.argument))}else Do(e,n.position);else{const o=l.name;let s;if(l.value&&typeof l.value=="object")if(l.value.data&&l.value.data.estree&&e.evaluater){const f=l.value.data.estree.body[0];f.type,s=e.evaluater.evaluateExpression(f.expression)}else Do(e,n.position);else s=l.value===null?!0:l.value;i[o]=s}return i}function vm(e,n){const i=[];let l=-1;const o=e.passKeys?new Map:P4;for(;++lo?0:o+n:n=n>o?o:n,i=i>0?i:0,l.length<1e4)u=Array.from(l),u.unshift(n,i),e.splice(...u);else for(i&&e.splice(n,i);s0?(nr(e,e.length,0,n),e):n}const Z1={}.hasOwnProperty;function g5(e){const n={};let i=-1;for(;++i13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"�":String.fromCodePoint(i)}function Ql(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Jn=di(/[A-Za-z]/),vn=di(/[\dA-Za-z]/),v5=di(/[#-'*+\--9=?A-Z^-~]/);function Lp(e){return e!==null&&(e<32||e===127)}const Hp=di(/\d/),b5=di(/[\dA-Fa-f]/),w5=di(/[!-/:-@[-`{-~]/);function Te(e){return e!==null&&e<-2}function rn(e){return e!==null&&(e<0||e===32)}function Qe(e){return e===-2||e===-1||e===32}const S5=di(new RegExp("\\p{P}|\\p{S}","u")),_5=di(/\s/);function di(e){return n;function n(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function oa(e){const n=[];let i=-1,l=0,o=0;for(;++i55295&&s<57344){const f=e.charCodeAt(i+1);s<56320&&f>56319&&f<57344?(u=String.fromCharCode(s,f),o=1):u="�"}else u=String.fromCharCode(s);u&&(n.push(e.slice(l,i),encodeURIComponent(u)),l=i+o+1,u=""),o&&(i+=o,o=0)}return n.join("")+e.slice(l)}function ot(e,n,i,l){const o=l?l-1:Number.POSITIVE_INFINITY;let s=0;return u;function u(d){return Qe(d)?(e.enter(i),f(d)):n(d)}function f(d){return Qe(d)&&s++u))return;const q=n.events.length;let M=q,D,X;for(;M--;)if(n.events[M][0]==="exit"&&n.events[M][1].type==="chunkFlow"){if(D){X=n.events[M][1].end;break}D=!0}for(_(l),T=q;TE;){const B=i[A];n.containerState=B[1],B[0].exit.call(n,e)}i.length=E}function z(){o.write([null]),s=void 0,o=void 0,n.containerState._closeFlow=void 0}}function T5(e,n,i){return ot(e,e.attempt(this.parser.constructs.document,n,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function J1(e){if(e===null||rn(e)||_5(e))return 1;if(S5(e))return 2}function wm(e,n,i){const l=[];let o=-1;for(;++o1&&e[i][1].end.offset-e[i][1].start.offset>1?2:1;const p={...e[l][1].end},y={...e[i][1].start};W1(p,-d),W1(y,d),u={type:d>1?"strongSequence":"emphasisSequence",start:p,end:{...e[l][1].end}},f={type:d>1?"strongSequence":"emphasisSequence",start:{...e[i][1].start},end:y},s={type:d>1?"strongText":"emphasisText",start:{...e[l][1].end},end:{...e[i][1].start}},o={type:d>1?"strong":"emphasis",start:{...u.start},end:{...f.end}},e[l][1].end={...u.start},e[i][1].start={...f.end},h=[],e[l][1].end.offset-e[l][1].start.offset&&(h=An(h,[["enter",e[l][1],n],["exit",e[l][1],n]])),h=An(h,[["enter",o,n],["enter",u,n],["exit",u,n],["enter",s,n]]),h=An(h,wm(n.parser.constructs.insideSpan.null,e.slice(l+1,i),n)),h=An(h,[["exit",s,n],["enter",f,n],["exit",f,n],["exit",o,n]]),e[i][1].end.offset-e[i][1].start.offset?(m=2,h=An(h,[["enter",e[i][1],n],["exit",e[i][1],n]])):m=0,nr(e,l-1,i-l+3,h),i=l+h.length-m-2;break}}for(i=-1;++i0&&Qe(T)?ot(e,z,"linePrefix",s+1)(T):z(T)}function z(T){return T===null||Te(T)?e.check(eb,k,A)(T):(e.enter("codeFlowValue"),E(T))}function E(T){return T===null||Te(T)?(e.exit("codeFlowValue"),z(T)):(e.consume(T),E)}function A(T){return e.exit("codeFenced"),n(T)}function B(T,q,M){let D=0;return X;function X(G){return T.enter("lineEnding"),T.consume(G),T.exit("lineEnding"),H}function H(G){return T.enter("codeFencedFence"),Qe(G)?ot(T,I,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):I(G)}function I(G){return G===f?(T.enter("codeFencedFenceSequence"),ee(G)):M(G)}function ee(G){return G===f?(D++,T.consume(G),ee):D>=u?(T.exit("codeFencedFenceSequence"),Qe(G)?ot(T,L,"whitespace")(G):L(G)):M(G)}function L(G){return G===null||Te(G)?(T.exit("codeFencedFence"),q(G)):M(G)}}}function U5(e,n,i){const l=this;return o;function o(u){return u===null?i(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),s)}function s(u){return l.parser.lazy[l.now().line]?i(u):n(u)}}const rp={name:"codeIndented",tokenize:V5},I5={partial:!0,tokenize:Y5};function V5(e,n,i){const l=this;return o;function o(h){return e.enter("codeIndented"),ot(e,s,"linePrefix",5)(h)}function s(h){const m=l.events[l.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?u(h):i(h)}function u(h){return h===null?d(h):Te(h)?e.attempt(I5,u,d)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Te(h)?(e.exit("codeFlowValue"),u(h)):(e.consume(h),f)}function d(h){return e.exit("codeIndented"),n(h)}}function Y5(e,n,i){const l=this;return o;function o(u){return l.parser.lazy[l.now().line]?i(u):Te(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o):ot(e,s,"linePrefix",5)(u)}function s(u){const f=l.events[l.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(u):Te(u)?o(u):i(u)}}const G5={name:"codeText",previous:X5,resolve:$5,tokenize:P5};function $5(e){let n=e.length-4,i=3,l,o;if((e[i][1].type==="lineEnding"||e[i][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(l=i;++l=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return nthis.left.length?this.right.slice(this.right.length-l+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-l+this.left.length).reverse())}splice(n,i,l){const o=i||0;this.setCursor(Math.trunc(n));const s=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return l&&uo(this.left,l),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),uo(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),uo(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n=4?n(u):e.interrupt(l.parser.constructs.flow,i,n)(u)}}function a_(e,n,i,l,o,s,u,f,d){const h=d||Number.POSITIVE_INFINITY;let m=0;return p;function p(_){return _===60?(e.enter(l),e.enter(o),e.enter(s),e.consume(_),e.exit(s),y):_===null||_===32||_===41||Lp(_)?i(_):(e.enter(l),e.enter(u),e.enter(f),e.enter("chunkString",{contentType:"string"}),k(_))}function y(_){return _===62?(e.enter(s),e.consume(_),e.exit(s),e.exit(o),e.exit(l),n):(e.enter(f),e.enter("chunkString",{contentType:"string"}),v(_))}function v(_){return _===62?(e.exit("chunkString"),e.exit(f),y(_)):_===null||_===60||Te(_)?i(_):(e.consume(_),_===92?w:v)}function w(_){return _===60||_===62||_===92?(e.consume(_),v):v(_)}function k(_){return!m&&(_===null||_===41||rn(_))?(e.exit("chunkString"),e.exit(f),e.exit(u),e.exit(l),n(_)):m999||v===null||v===91||v===93&&!d||v===94&&!f&&"_hiddenFootnoteSupport"in u.parser.constructs?i(v):v===93?(e.exit(s),e.enter(o),e.consume(v),e.exit(o),e.exit(l),n):Te(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),m):(e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===null||v===91||v===93||Te(v)||f++>999?(e.exit("chunkString"),m(v)):(e.consume(v),d||(d=!Qe(v)),v===92?y:p)}function y(v){return v===91||v===92||v===93?(e.consume(v),f++,p):p(v)}}function s_(e,n,i,l,o,s){let u;return f;function f(y){return y===34||y===39||y===40?(e.enter(l),e.enter(o),e.consume(y),e.exit(o),u=y===40?41:y,d):i(y)}function d(y){return y===u?(e.enter(o),e.consume(y),e.exit(o),e.exit(l),n):(e.enter(s),h(y))}function h(y){return y===u?(e.exit(s),d(u)):y===null?i(y):Te(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),ot(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===u||y===null||Te(y)?(e.exit("chunkString"),h(y)):(e.consume(y),y===92?p:m)}function p(y){return y===u||y===92?(e.consume(y),m):m(y)}}function wo(e,n){let i;return l;function l(o){return Te(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i=!0,l):Qe(o)?ot(e,l,i?"linePrefix":"lineSuffix")(o):n(o)}}const tO={name:"definition",tokenize:rO},nO={partial:!0,tokenize:iO};function rO(e,n,i){const l=this;let o;return s;function s(v){return e.enter("definition"),u(v)}function u(v){return o_.call(l,e,f,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function f(v){return o=Ql(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),d):i(v)}function d(v){return rn(v)?wo(e,h)(v):h(v)}function h(v){return a_(e,m,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function m(v){return e.attempt(nO,p,p)(v)}function p(v){return Qe(v)?ot(e,y,"whitespace")(v):y(v)}function y(v){return v===null||Te(v)?(e.exit("definition"),l.parser.defined.push(o),n(v)):i(v)}}function iO(e,n,i){return l;function l(f){return rn(f)?wo(e,o)(f):i(f)}function o(f){return s_(e,s,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function s(f){return Qe(f)?ot(e,u,"whitespace")(f):u(f)}function u(f){return f===null||Te(f)?n(f):i(f)}}const lO={name:"hardBreakEscape",tokenize:aO};function aO(e,n,i){return l;function l(s){return e.enter("hardBreakEscape"),e.consume(s),o}function o(s){return Te(s)?(e.exit("hardBreakEscape"),n(s)):i(s)}}const oO={name:"headingAtx",resolve:sO,tokenize:uO};function sO(e,n){let i=e.length-2,l=3,o,s;return e[l][1].type==="whitespace"&&(l+=2),i-2>l&&e[i][1].type==="whitespace"&&(i-=2),e[i][1].type==="atxHeadingSequence"&&(l===i-1||i-4>l&&e[i-2][1].type==="whitespace")&&(i-=l+1===i?2:4),i>l&&(o={type:"atxHeadingText",start:e[l][1].start,end:e[i][1].end},s={type:"chunkText",start:e[l][1].start,end:e[i][1].end,contentType:"text"},nr(e,l,i-l+1,[["enter",o,n],["enter",s,n],["exit",s,n],["exit",o,n]])),e}function uO(e,n,i){let l=0;return o;function o(m){return e.enter("atxHeading"),s(m)}function s(m){return e.enter("atxHeadingSequence"),u(m)}function u(m){return m===35&&l++<6?(e.consume(m),u):m===null||rn(m)?(e.exit("atxHeadingSequence"),f(m)):i(m)}function f(m){return m===35?(e.enter("atxHeadingSequence"),d(m)):m===null||Te(m)?(e.exit("atxHeading"),n(m)):Qe(m)?ot(e,f,"whitespace")(m):(e.enter("atxHeadingText"),h(m))}function d(m){return m===35?(e.consume(m),d):(e.exit("atxHeadingSequence"),f(m))}function h(m){return m===null||m===35||rn(m)?(e.exit("atxHeadingText"),f(m)):(e.consume(m),h)}}const cO=["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"],nb=["pre","script","style","textarea"],fO={concrete:!0,name:"htmlFlow",resolveTo:pO,tokenize:mO},dO={partial:!0,tokenize:yO},hO={partial:!0,tokenize:gO};function pO(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function mO(e,n,i){const l=this;let o,s,u,f,d;return h;function h(N){return m(N)}function m(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),p}function p(N){return N===33?(e.consume(N),y):N===47?(e.consume(N),s=!0,k):N===63?(e.consume(N),o=3,l.interrupt?n:j):Jn(N)?(e.consume(N),u=String.fromCharCode(N),S):i(N)}function y(N){return N===45?(e.consume(N),o=2,v):N===91?(e.consume(N),o=5,f=0,w):Jn(N)?(e.consume(N),o=4,l.interrupt?n:j):i(N)}function v(N){return N===45?(e.consume(N),l.interrupt?n:j):i(N)}function w(N){const Y="CDATA[";return N===Y.charCodeAt(f++)?(e.consume(N),f===Y.length?l.interrupt?n:I:w):i(N)}function k(N){return Jn(N)?(e.consume(N),u=String.fromCharCode(N),S):i(N)}function S(N){if(N===null||N===47||N===62||rn(N)){const Y=N===47,F=u.toLowerCase();return!Y&&!s&&nb.includes(F)?(o=1,l.interrupt?n(N):I(N)):cO.includes(u.toLowerCase())?(o=6,Y?(e.consume(N),_):l.interrupt?n(N):I(N)):(o=7,l.interrupt&&!l.parser.lazy[l.now().line]?i(N):s?z(N):E(N))}return N===45||vn(N)?(e.consume(N),u+=String.fromCharCode(N),S):i(N)}function _(N){return N===62?(e.consume(N),l.interrupt?n:I):i(N)}function z(N){return Qe(N)?(e.consume(N),z):X(N)}function E(N){return N===47?(e.consume(N),X):N===58||N===95||Jn(N)?(e.consume(N),A):Qe(N)?(e.consume(N),E):X(N)}function A(N){return N===45||N===46||N===58||N===95||vn(N)?(e.consume(N),A):B(N)}function B(N){return N===61?(e.consume(N),T):Qe(N)?(e.consume(N),B):E(N)}function T(N){return N===null||N===60||N===61||N===62||N===96?i(N):N===34||N===39?(e.consume(N),d=N,q):Qe(N)?(e.consume(N),T):M(N)}function q(N){return N===d?(e.consume(N),d=null,D):N===null||Te(N)?i(N):(e.consume(N),q)}function M(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||rn(N)?B(N):(e.consume(N),M)}function D(N){return N===47||N===62||Qe(N)?E(N):i(N)}function X(N){return N===62?(e.consume(N),H):i(N)}function H(N){return N===null||Te(N)?I(N):Qe(N)?(e.consume(N),H):i(N)}function I(N){return N===45&&o===2?(e.consume(N),R):N===60&&o===1?(e.consume(N),$):N===62&&o===4?(e.consume(N),U):N===63&&o===3?(e.consume(N),j):N===93&&o===5?(e.consume(N),J):Te(N)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(dO,P,ee)(N)):N===null||Te(N)?(e.exit("htmlFlowData"),ee(N)):(e.consume(N),I)}function ee(N){return e.check(hO,L,P)(N)}function L(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),G}function G(N){return N===null||Te(N)?ee(N):(e.enter("htmlFlowData"),I(N))}function R(N){return N===45?(e.consume(N),j):I(N)}function $(N){return N===47?(e.consume(N),u="",Z):I(N)}function Z(N){if(N===62){const Y=u.toLowerCase();return nb.includes(Y)?(e.consume(N),U):I(N)}return Jn(N)&&u.length<8?(e.consume(N),u+=String.fromCharCode(N),Z):I(N)}function J(N){return N===93?(e.consume(N),j):I(N)}function j(N){return N===62?(e.consume(N),U):N===45&&o===2?(e.consume(N),j):I(N)}function U(N){return N===null||Te(N)?(e.exit("htmlFlowData"),P(N)):(e.consume(N),U)}function P(N){return e.exit("htmlFlow"),n(N)}}function gO(e,n,i){const l=this;return o;function o(u){return Te(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),s):i(u)}function s(u){return l.parser.lazy[l.now().line]?i(u):n(u)}}function yO(e,n,i){return l;function l(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(wc,n,i)}}const xO={name:"htmlText",tokenize:vO};function vO(e,n,i){const l=this;let o,s,u;return f;function f(j){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(j),d}function d(j){return j===33?(e.consume(j),h):j===47?(e.consume(j),B):j===63?(e.consume(j),E):Jn(j)?(e.consume(j),M):i(j)}function h(j){return j===45?(e.consume(j),m):j===91?(e.consume(j),s=0,w):Jn(j)?(e.consume(j),z):i(j)}function m(j){return j===45?(e.consume(j),v):i(j)}function p(j){return j===null?i(j):j===45?(e.consume(j),y):Te(j)?(u=p,$(j)):(e.consume(j),p)}function y(j){return j===45?(e.consume(j),v):p(j)}function v(j){return j===62?R(j):j===45?y(j):p(j)}function w(j){const U="CDATA[";return j===U.charCodeAt(s++)?(e.consume(j),s===U.length?k:w):i(j)}function k(j){return j===null?i(j):j===93?(e.consume(j),S):Te(j)?(u=k,$(j)):(e.consume(j),k)}function S(j){return j===93?(e.consume(j),_):k(j)}function _(j){return j===62?R(j):j===93?(e.consume(j),_):k(j)}function z(j){return j===null||j===62?R(j):Te(j)?(u=z,$(j)):(e.consume(j),z)}function E(j){return j===null?i(j):j===63?(e.consume(j),A):Te(j)?(u=E,$(j)):(e.consume(j),E)}function A(j){return j===62?R(j):E(j)}function B(j){return Jn(j)?(e.consume(j),T):i(j)}function T(j){return j===45||vn(j)?(e.consume(j),T):q(j)}function q(j){return Te(j)?(u=q,$(j)):Qe(j)?(e.consume(j),q):R(j)}function M(j){return j===45||vn(j)?(e.consume(j),M):j===47||j===62||rn(j)?D(j):i(j)}function D(j){return j===47?(e.consume(j),R):j===58||j===95||Jn(j)?(e.consume(j),X):Te(j)?(u=D,$(j)):Qe(j)?(e.consume(j),D):R(j)}function X(j){return j===45||j===46||j===58||j===95||vn(j)?(e.consume(j),X):H(j)}function H(j){return j===61?(e.consume(j),I):Te(j)?(u=H,$(j)):Qe(j)?(e.consume(j),H):D(j)}function I(j){return j===null||j===60||j===61||j===62||j===96?i(j):j===34||j===39?(e.consume(j),o=j,ee):Te(j)?(u=I,$(j)):Qe(j)?(e.consume(j),I):(e.consume(j),L)}function ee(j){return j===o?(e.consume(j),o=void 0,G):j===null?i(j):Te(j)?(u=ee,$(j)):(e.consume(j),ee)}function L(j){return j===null||j===34||j===39||j===60||j===61||j===96?i(j):j===47||j===62||rn(j)?D(j):(e.consume(j),L)}function G(j){return j===47||j===62||rn(j)?D(j):i(j)}function R(j){return j===62?(e.consume(j),e.exit("htmlTextData"),e.exit("htmlText"),n):i(j)}function $(j){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),Z}function Z(j){return Qe(j)?ot(e,J,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):J(j)}function J(j){return e.enter("htmlTextData"),u(j)}}const Sm={name:"labelEnd",resolveAll:_O,resolveTo:EO,tokenize:NO},bO={tokenize:kO},wO={tokenize:CO},SO={tokenize:TO};function _O(e){let n=-1;const i=[];for(;++n=3&&(h===null||Te(h))?(e.exit("thematicBreak"),n(h)):i(h)}function d(h){return h===o?(e.consume(h),l++,d):(e.exit("thematicBreakSequence"),Qe(h)?ot(e,f,"whitespace")(h):f(h))}}const tn={continuation:{tokenize:BO},exit:UO,name:"list",tokenize:HO},DO={partial:!0,tokenize:IO},LO={partial:!0,tokenize:qO};function HO(e,n,i){const l=this,o=l.events[l.events.length-1];let s=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,u=0;return f;function f(v){const w=l.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!l.containerState.marker||v===l.containerState.marker:Hp(v)){if(l.containerState.type||(l.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(Vu,i,h)(v):h(v);if(!l.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(v)}return i(v)}function d(v){return Hp(v)&&++u<10?(e.consume(v),d):(!l.interrupt||u<2)&&(l.containerState.marker?v===l.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),h(v)):i(v)}function h(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),l.containerState.marker=l.containerState.marker||v,e.check(wc,l.interrupt?i:m,e.attempt(DO,y,p))}function m(v){return l.containerState.initialBlankLine=!0,s++,y(v)}function p(v){return Qe(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),y):i(v)}function y(v){return l.containerState.size=s+l.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(v)}}function BO(e,n,i){const l=this;return l.containerState._closeFlow=void 0,e.check(wc,o,s);function o(f){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,ot(e,n,"listItemIndent",l.containerState.size+1)(f)}function s(f){return l.containerState.furtherBlankLines||!Qe(f)?(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,u(f)):(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,e.attempt(LO,n,u)(f))}function u(f){return l.containerState._closeFlow=!0,l.interrupt=void 0,ot(e,e.attempt(tn,n,i),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function qO(e,n,i){const l=this;return ot(e,o,"listItemIndent",l.containerState.size+1);function o(s){const u=l.events[l.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===l.containerState.size?n(s):i(s)}}function UO(e){e.exit(this.containerState.type)}function IO(e,n,i){const l=this;return ot(e,o,"listItemPrefixWhitespace",l.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(s){const u=l.events[l.events.length-1];return!Qe(s)&&u&&u[1].type==="listItemPrefixWhitespace"?n(s):i(s)}}const rb={name:"setextUnderline",resolveTo:VO,tokenize:YO};function VO(e,n){let i=e.length,l,o,s;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){l=i;break}e[i][1].type==="paragraph"&&(o=i)}else e[i][1].type==="content"&&e.splice(i,1),!s&&e[i][1].type==="definition"&&(s=i);const u={type:"setextHeading",start:{...e[l][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",s?(e.splice(o,0,["enter",u,n]),e.splice(s+1,0,["exit",e[l][1],n]),e[l][1].end={...e[s][1].end}):e[l][1]=u,e.push(["exit",u,n]),e}function YO(e,n,i){const l=this;let o;return s;function s(h){let m=l.events.length,p;for(;m--;)if(l.events[m][1].type!=="lineEnding"&&l.events[m][1].type!=="linePrefix"&&l.events[m][1].type!=="content"){p=l.events[m][1].type==="paragraph";break}return!l.parser.lazy[l.now().line]&&(l.interrupt||p)?(e.enter("setextHeadingLine"),o=h,u(h)):i(h)}function u(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===o?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),Qe(h)?ot(e,d,"lineSuffix")(h):d(h))}function d(h){return h===null||Te(h)?(e.exit("setextHeadingLine"),n(h)):i(h)}}const GO={tokenize:$O};function $O(e){const n=this,i=e.attempt(wc,l,e.attempt(this.parser.constructs.flowInitial,o,ot(e,e.attempt(this.parser.constructs.flow,o,e.attempt(Z5,o)),"linePrefix")));return i;function l(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),n.currentConstruct=void 0,i}function o(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n.currentConstruct=void 0,i}}const XO={resolveAll:c_()},PO=u_("string"),FO=u_("text");function u_(e){return{resolveAll:c_(e==="text"?QO:void 0),tokenize:n};function n(i){const l=this,o=this.parser.constructs[e],s=i.attempt(o,u,f);return u;function u(m){return h(m)?s(m):f(m)}function f(m){if(m===null){i.consume(m);return}return i.enter("data"),i.consume(m),d}function d(m){return h(m)?(i.exit("data"),s(m)):(i.consume(m),d)}function h(m){if(m===null)return!0;const p=o[m];let y=-1;if(p)for(;++y-1){const f=u[0];typeof f=="string"?u[0]=f.slice(l):u.shift()}s>0&&u.push(e[o].slice(0,s))}return u}function sR(e,n){let i=-1;const l=[];let o;for(;++i4&&i.slice(0,4)==="data"&&L4.test(n)){if(n.charAt(4)==="-"){const s=n.slice(5).replace(I1,q4);l="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=n.slice(4);if(!I1.test(s)){let u=s.replace(D4,B4);u.charAt(0)!=="-"&&(u="-"+u),n="data"+u}}o=pm}return new o(l,n)}function B4(e){return"-"+e.toLowerCase()}function q4(e){return e.charAt(1).toUpperCase()}const U4=YS([GS,j4,FS,PS,QS],"html"),mm=YS([GS,O4,FS,PS,QS],"svg");function I4(e){return e.join(" ").trim()}var Hl={},tp,V1;function V4(){if(V1)return tp;V1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,i=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,f=/^\s+|\s+$/g,d=` +`,h="/",m="*",p="",y="comment",v="declaration";function w(_,S){if(typeof _!="string")throw new TypeError("First argument must be a string");if(!_)return[];S=S||{};var z=1,k=1;function A(H){var G=H.match(n);G&&(z+=G.length);var D=H.lastIndexOf(d);k=~D?H.length-D:k+H.length}function M(){var H={line:z,column:k};return function(G){return G.position=new T(H),L(),G}}function T(H){this.start=H,this.end={line:z,column:k},this.source=S.source}T.prototype.content=_;function q(H){var G=new Error(S.source+":"+z+":"+k+": "+H);if(G.reason=H,G.filename=S.source,G.line=z,G.column=k,G.source=_,!S.silent)throw G}function j(H){var G=H.exec(_);if(G){var D=G[0];return A(D),_=_.slice(D.length),G}}function L(){j(i)}function X(H){var G;for(H=H||[];G=B();)G!==!1&&H.push(G);return H}function B(){var H=M();if(!(h!=_.charAt(0)||m!=_.charAt(1))){for(var G=2;p!=_.charAt(G)&&(m!=_.charAt(G)||h!=_.charAt(G+1));)++G;if(G+=2,p===_.charAt(G-1))return q("End of comment missing");var D=_.slice(2,G-2);return k+=2,A(D),_=_.slice(G),k+=2,H({type:y,comment:D})}}function I(){var H=M(),G=j(l);if(G){if(B(),!j(o))return q("property missing ':'");var D=j(s),$=H({type:v,property:E(G[0].replace(e,p)),value:D?E(D[0].replace(e,p)):p});return j(u),$}}function ee(){var H=[];X(H);for(var G;G=I();)G!==!1&&(H.push(G),X(H));return H}return L(),ee()}function E(_){return _?_.replace(f,p):p}return tp=w,tp}var Y1;function Y4(){if(Y1)return Hl;Y1=1;var e=Hl&&Hl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(Hl,"__esModule",{value:!0}),Hl.default=i;const n=e(V4());function i(l,o){let s=null;if(!l||typeof l!="string")return s;const u=(0,n.default)(l),f=typeof o=="function";return u.forEach(d=>{if(d.type!=="declaration")return;const{property:h,value:m}=d;f?o(h,m,d):m&&(s=s||{},s[h]=m)}),s}return Hl}var uo={},G1;function G4(){if(G1)return uo;G1=1,Object.defineProperty(uo,"__esModule",{value:!0}),uo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,i=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,s=function(h){return!h||i.test(h)||e.test(h)},u=function(h,m){return m.toUpperCase()},f=function(h,m){return"".concat(m,"-")},d=function(h,m){return m===void 0&&(m={}),s(h)?h:(h=h.toLowerCase(),m.reactCompat?h=h.replace(o,f):h=h.replace(l,f),h.replace(n,u))};return uo.camelCase=d,uo}var co,$1;function $4(){if($1)return co;$1=1;var e=co&&co.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},n=e(Y4()),i=G4();function l(o,s){var u={};return!o||typeof o!="string"||(0,n.default)(o,function(f,d){f&&d&&(u[(0,i.camelCase)(f,s)]=d)}),u}return l.default=l,co=l,co}var X4=$4();const F4=Ho(X4),ZS=KS("end"),gm=KS("start");function KS(e){return n;function n(i){const l=i&&i.position&&i.position[e]||{};if(typeof l.line=="number"&&l.line>0&&typeof l.column=="number"&&l.column>0)return{line:l.line,column:l.column,offset:typeof l.offset=="number"&&l.offset>-1?l.offset:void 0}}}function P4(e){const n=gm(e),i=ZS(e);if(n&&i)return{start:n,end:i}}function So(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?X1(e.position):"start"in e||"end"in e?X1(e):"line"in e||"column"in e?Dp(e):""}function Dp(e){return F1(e&&e.line)+":"+F1(e&&e.column)}function X1(e){return Dp(e&&e.start)+"-"+Dp(e&&e.end)}function F1(e){return e&&typeof e=="number"?e:1}class Gt extends Error{constructor(n,i,l){super(),typeof i=="string"&&(l=i,i=void 0);let o="",s={},u=!1;if(i&&("line"in i&&"column"in i?s={place:i}:"start"in i&&"end"in i?s={place:i}:"type"in i?s={ancestors:[i],place:i.position}:s={...i}),typeof n=="string"?o=n:!s.cause&&n&&(u=!0,o=n.message,s.cause=n),!s.ruleId&&!s.source&&typeof l=="string"){const d=l.indexOf(":");d===-1?s.ruleId=l:(s.source=l.slice(0,d),s.ruleId=l.slice(d+1))}if(!s.place&&s.ancestors&&s.ancestors){const d=s.ancestors[s.ancestors.length-1];d&&(s.place=d.position)}const f=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=f?f.line:void 0,this.name=So(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=u&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Gt.prototype.file="";Gt.prototype.name="";Gt.prototype.reason="";Gt.prototype.message="";Gt.prototype.stack="";Gt.prototype.column=void 0;Gt.prototype.line=void 0;Gt.prototype.ancestors=void 0;Gt.prototype.cause=void 0;Gt.prototype.fatal=void 0;Gt.prototype.place=void 0;Gt.prototype.ruleId=void 0;Gt.prototype.source=void 0;const ym={}.hasOwnProperty,Q4=new Map,Z4=/[A-Z]/g,K4=new Set(["table","tbody","thead","tfoot","tr"]),J4=new Set(["td","th"]),JS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function W4(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const i=n.filePath||void 0;let l;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");l=o5(i,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");l=a5(i,n.jsx,n.jsxs)}const o={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:l,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:i,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?mm:U4,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},s=WS(o,e,void 0);return s&&typeof s!="string"?s:o.create(e,o.Fragment,{children:s||void 0},void 0)}function WS(e,n,i){if(n.type==="element")return e5(e,n,i);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return t5(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return r5(e,n,i);if(n.type==="mdxjsEsm")return n5(e,n);if(n.type==="root")return i5(e,n,i);if(n.type==="text")return l5(e,n)}function e5(e,n,i){const l=e.schema;let o=l;n.tagName.toLowerCase()==="svg"&&l.space==="html"&&(o=mm,e.schema=o),e.ancestors.push(n);const s=t_(e,n.tagName,!1),u=s5(e,n);let f=vm(e,n);return K4.has(n.tagName)&&(f=f.filter(function(d){return typeof d=="string"?!A4(d):!0})),e_(e,u,s,n),xm(u,f),e.ancestors.pop(),e.schema=l,e.create(n,s,u,i)}function t5(e,n){if(n.data&&n.data.estree&&e.evaluater){const l=n.data.estree.body[0];return l.type,e.evaluater.evaluateExpression(l.expression)}Lo(e,n.position)}function n5(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Lo(e,n.position)}function r5(e,n,i){const l=e.schema;let o=l;n.name==="svg"&&l.space==="html"&&(o=mm,e.schema=o),e.ancestors.push(n);const s=n.name===null?e.Fragment:t_(e,n.name,!0),u=u5(e,n),f=vm(e,n);return e_(e,u,s,n),xm(u,f),e.ancestors.pop(),e.schema=l,e.create(n,s,u,i)}function i5(e,n,i){const l={};return xm(l,vm(e,n)),e.create(n,e.Fragment,l,i)}function l5(e,n){return n.value}function e_(e,n,i,l){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(n.node=l)}function xm(e,n){if(n.length>0){const i=n.length>1?n:n[0];i&&(e.children=i)}}function a5(e,n,i){return l;function l(o,s,u,f){const h=Array.isArray(u.children)?i:n;return f?h(s,u,f):h(s,u)}}function o5(e,n){return i;function i(l,o,s,u){const f=Array.isArray(s.children),d=gm(l);return n(o,s,u,f,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function s5(e,n){const i={};let l,o;for(o in n.properties)if(o!=="children"&&ym.call(n.properties,o)){const s=c5(e,o,n.properties[o]);if(s){const[u,f]=s;e.tableCellAlignToStyle&&u==="align"&&typeof f=="string"&&J4.has(n.tagName)?l=f:i[u]=f}}if(l){const s=i.style||(i.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=l}return i}function u5(e,n){const i={};for(const l of n.attributes)if(l.type==="mdxJsxExpressionAttribute")if(l.data&&l.data.estree&&e.evaluater){const s=l.data.estree.body[0];s.type;const u=s.expression;u.type;const f=u.properties[0];f.type,Object.assign(i,e.evaluater.evaluateExpression(f.argument))}else Lo(e,n.position);else{const o=l.name;let s;if(l.value&&typeof l.value=="object")if(l.value.data&&l.value.data.estree&&e.evaluater){const f=l.value.data.estree.body[0];f.type,s=e.evaluater.evaluateExpression(f.expression)}else Lo(e,n.position);else s=l.value===null?!0:l.value;i[o]=s}return i}function vm(e,n){const i=[];let l=-1;const o=e.passKeys?new Map:Q4;for(;++lo?0:o+n:n=n>o?o:n,i=i>0?i:0,l.length<1e4)u=Array.from(l),u.unshift(n,i),e.splice(...u);else for(i&&e.splice(n,i);s0?(nr(e,e.length,0,n),e):n}const Z1={}.hasOwnProperty;function x5(e){const n={};let i=-1;for(;++i13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"�":String.fromCodePoint(i)}function Ql(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Jn=di(/[A-Za-z]/),vn=di(/[\dA-Za-z]/),w5=di(/[#-'*+\--9=?A-Z^-~]/);function Lp(e){return e!==null&&(e<32||e===127)}const Hp=di(/\d/),S5=di(/[\dA-Fa-f]/),_5=di(/[!-/:-@[-`{-~]/);function Te(e){return e!==null&&e<-2}function rn(e){return e!==null&&(e<0||e===32)}function Qe(e){return e===-2||e===-1||e===32}const E5=di(new RegExp("\\p{P}|\\p{S}","u")),N5=di(/\s/);function di(e){return n;function n(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function ua(e){const n=[];let i=-1,l=0,o=0;for(;++i55295&&s<57344){const f=e.charCodeAt(i+1);s<56320&&f>56319&&f<57344?(u=String.fromCharCode(s,f),o=1):u="�"}else u=String.fromCharCode(s);u&&(n.push(e.slice(l,i),encodeURIComponent(u)),l=i+o+1,u=""),o&&(i+=o,o=0)}return n.join("")+e.slice(l)}function ot(e,n,i,l){const o=l?l-1:Number.POSITIVE_INFINITY;let s=0;return u;function u(d){return Qe(d)?(e.enter(i),f(d)):n(d)}function f(d){return Qe(d)&&s++u))return;const q=n.events.length;let j=q,L,X;for(;j--;)if(n.events[j][0]==="exit"&&n.events[j][1].type==="chunkFlow"){if(L){X=n.events[j][1].end;break}L=!0}for(S(l),T=q;Tk;){const M=i[A];n.containerState=M[1],M[0].exit.call(n,e)}i.length=k}function z(){o.write([null]),s=void 0,o=void 0,n.containerState._closeFlow=void 0}}function A5(e,n,i){return ot(e,e.attempt(this.parser.constructs.document,n,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function J1(e){if(e===null||rn(e)||N5(e))return 1;if(E5(e))return 2}function wm(e,n,i){const l=[];let o=-1;for(;++o1&&e[i][1].end.offset-e[i][1].start.offset>1?2:1;const p={...e[l][1].end},y={...e[i][1].start};W1(p,-d),W1(y,d),u={type:d>1?"strongSequence":"emphasisSequence",start:p,end:{...e[l][1].end}},f={type:d>1?"strongSequence":"emphasisSequence",start:{...e[i][1].start},end:y},s={type:d>1?"strongText":"emphasisText",start:{...e[l][1].end},end:{...e[i][1].start}},o={type:d>1?"strong":"emphasis",start:{...u.start},end:{...f.end}},e[l][1].end={...u.start},e[i][1].start={...f.end},h=[],e[l][1].end.offset-e[l][1].start.offset&&(h=An(h,[["enter",e[l][1],n],["exit",e[l][1],n]])),h=An(h,[["enter",o,n],["enter",u,n],["exit",u,n],["enter",s,n]]),h=An(h,wm(n.parser.constructs.insideSpan.null,e.slice(l+1,i),n)),h=An(h,[["exit",s,n],["enter",f,n],["exit",f,n],["exit",o,n]]),e[i][1].end.offset-e[i][1].start.offset?(m=2,h=An(h,[["enter",e[i][1],n],["exit",e[i][1],n]])):m=0,nr(e,l-1,i-l+3,h),i=l+h.length-m-2;break}}for(i=-1;++i0&&Qe(T)?ot(e,z,"linePrefix",s+1)(T):z(T)}function z(T){return T===null||Te(T)?e.check(eb,E,A)(T):(e.enter("codeFlowValue"),k(T))}function k(T){return T===null||Te(T)?(e.exit("codeFlowValue"),z(T)):(e.consume(T),k)}function A(T){return e.exit("codeFenced"),n(T)}function M(T,q,j){let L=0;return X;function X(G){return T.enter("lineEnding"),T.consume(G),T.exit("lineEnding"),B}function B(G){return T.enter("codeFencedFence"),Qe(G)?ot(T,I,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):I(G)}function I(G){return G===f?(T.enter("codeFencedFenceSequence"),ee(G)):j(G)}function ee(G){return G===f?(L++,T.consume(G),ee):L>=u?(T.exit("codeFencedFenceSequence"),Qe(G)?ot(T,H,"whitespace")(G):H(G)):j(G)}function H(G){return G===null||Te(G)?(T.exit("codeFencedFence"),q(G)):j(G)}}}function V5(e,n,i){const l=this;return o;function o(u){return u===null?i(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),s)}function s(u){return l.parser.lazy[l.now().line]?i(u):n(u)}}const rp={name:"codeIndented",tokenize:G5},Y5={partial:!0,tokenize:$5};function G5(e,n,i){const l=this;return o;function o(h){return e.enter("codeIndented"),ot(e,s,"linePrefix",5)(h)}function s(h){const m=l.events[l.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?u(h):i(h)}function u(h){return h===null?d(h):Te(h)?e.attempt(Y5,u,d)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Te(h)?(e.exit("codeFlowValue"),u(h)):(e.consume(h),f)}function d(h){return e.exit("codeIndented"),n(h)}}function $5(e,n,i){const l=this;return o;function o(u){return l.parser.lazy[l.now().line]?i(u):Te(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o):ot(e,s,"linePrefix",5)(u)}function s(u){const f=l.events[l.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(u):Te(u)?o(u):i(u)}}const X5={name:"codeText",previous:P5,resolve:F5,tokenize:Q5};function F5(e){let n=e.length-4,i=3,l,o;if((e[i][1].type==="lineEnding"||e[i][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(l=i;++l=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return nthis.left.length?this.right.slice(this.right.length-l+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-l+this.left.length).reverse())}splice(n,i,l){const o=i||0;this.setCursor(Math.trunc(n));const s=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return l&&fo(this.left,l),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),fo(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),fo(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n=4?n(u):e.interrupt(l.parser.constructs.flow,i,n)(u)}}function s_(e,n,i,l,o,s,u,f,d){const h=d||Number.POSITIVE_INFINITY;let m=0;return p;function p(S){return S===60?(e.enter(l),e.enter(o),e.enter(s),e.consume(S),e.exit(s),y):S===null||S===32||S===41||Lp(S)?i(S):(e.enter(l),e.enter(u),e.enter(f),e.enter("chunkString",{contentType:"string"}),E(S))}function y(S){return S===62?(e.enter(s),e.consume(S),e.exit(s),e.exit(o),e.exit(l),n):(e.enter(f),e.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===62?(e.exit("chunkString"),e.exit(f),y(S)):S===null||S===60||Te(S)?i(S):(e.consume(S),S===92?w:v)}function w(S){return S===60||S===62||S===92?(e.consume(S),v):v(S)}function E(S){return!m&&(S===null||S===41||rn(S))?(e.exit("chunkString"),e.exit(f),e.exit(u),e.exit(l),n(S)):m999||v===null||v===91||v===93&&!d||v===94&&!f&&"_hiddenFootnoteSupport"in u.parser.constructs?i(v):v===93?(e.exit(s),e.enter(o),e.consume(v),e.exit(o),e.exit(l),n):Te(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),m):(e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===null||v===91||v===93||Te(v)||f++>999?(e.exit("chunkString"),m(v)):(e.consume(v),d||(d=!Qe(v)),v===92?y:p)}function y(v){return v===91||v===92||v===93?(e.consume(v),f++,p):p(v)}}function c_(e,n,i,l,o,s){let u;return f;function f(y){return y===34||y===39||y===40?(e.enter(l),e.enter(o),e.consume(y),e.exit(o),u=y===40?41:y,d):i(y)}function d(y){return y===u?(e.enter(o),e.consume(y),e.exit(o),e.exit(l),n):(e.enter(s),h(y))}function h(y){return y===u?(e.exit(s),d(u)):y===null?i(y):Te(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),ot(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===u||y===null||Te(y)?(e.exit("chunkString"),h(y)):(e.consume(y),y===92?p:m)}function p(y){return y===u||y===92?(e.consume(y),m):m(y)}}function _o(e,n){let i;return l;function l(o){return Te(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i=!0,l):Qe(o)?ot(e,l,i?"linePrefix":"lineSuffix")(o):n(o)}}const rO={name:"definition",tokenize:lO},iO={partial:!0,tokenize:aO};function lO(e,n,i){const l=this;let o;return s;function s(v){return e.enter("definition"),u(v)}function u(v){return u_.call(l,e,f,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function f(v){return o=Ql(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),d):i(v)}function d(v){return rn(v)?_o(e,h)(v):h(v)}function h(v){return s_(e,m,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function m(v){return e.attempt(iO,p,p)(v)}function p(v){return Qe(v)?ot(e,y,"whitespace")(v):y(v)}function y(v){return v===null||Te(v)?(e.exit("definition"),l.parser.defined.push(o),n(v)):i(v)}}function aO(e,n,i){return l;function l(f){return rn(f)?_o(e,o)(f):i(f)}function o(f){return c_(e,s,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function s(f){return Qe(f)?ot(e,u,"whitespace")(f):u(f)}function u(f){return f===null||Te(f)?n(f):i(f)}}const oO={name:"hardBreakEscape",tokenize:sO};function sO(e,n,i){return l;function l(s){return e.enter("hardBreakEscape"),e.consume(s),o}function o(s){return Te(s)?(e.exit("hardBreakEscape"),n(s)):i(s)}}const uO={name:"headingAtx",resolve:cO,tokenize:fO};function cO(e,n){let i=e.length-2,l=3,o,s;return e[l][1].type==="whitespace"&&(l+=2),i-2>l&&e[i][1].type==="whitespace"&&(i-=2),e[i][1].type==="atxHeadingSequence"&&(l===i-1||i-4>l&&e[i-2][1].type==="whitespace")&&(i-=l+1===i?2:4),i>l&&(o={type:"atxHeadingText",start:e[l][1].start,end:e[i][1].end},s={type:"chunkText",start:e[l][1].start,end:e[i][1].end,contentType:"text"},nr(e,l,i-l+1,[["enter",o,n],["enter",s,n],["exit",s,n],["exit",o,n]])),e}function fO(e,n,i){let l=0;return o;function o(m){return e.enter("atxHeading"),s(m)}function s(m){return e.enter("atxHeadingSequence"),u(m)}function u(m){return m===35&&l++<6?(e.consume(m),u):m===null||rn(m)?(e.exit("atxHeadingSequence"),f(m)):i(m)}function f(m){return m===35?(e.enter("atxHeadingSequence"),d(m)):m===null||Te(m)?(e.exit("atxHeading"),n(m)):Qe(m)?ot(e,f,"whitespace")(m):(e.enter("atxHeadingText"),h(m))}function d(m){return m===35?(e.consume(m),d):(e.exit("atxHeadingSequence"),f(m))}function h(m){return m===null||m===35||rn(m)?(e.exit("atxHeadingText"),f(m)):(e.consume(m),h)}}const dO=["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"],nb=["pre","script","style","textarea"],hO={concrete:!0,name:"htmlFlow",resolveTo:gO,tokenize:yO},pO={partial:!0,tokenize:vO},mO={partial:!0,tokenize:xO};function gO(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function yO(e,n,i){const l=this;let o,s,u,f,d;return h;function h(N){return m(N)}function m(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),p}function p(N){return N===33?(e.consume(N),y):N===47?(e.consume(N),s=!0,E):N===63?(e.consume(N),o=3,l.interrupt?n:O):Jn(N)?(e.consume(N),u=String.fromCharCode(N),_):i(N)}function y(N){return N===45?(e.consume(N),o=2,v):N===91?(e.consume(N),o=5,f=0,w):Jn(N)?(e.consume(N),o=4,l.interrupt?n:O):i(N)}function v(N){return N===45?(e.consume(N),l.interrupt?n:O):i(N)}function w(N){const Y="CDATA[";return N===Y.charCodeAt(f++)?(e.consume(N),f===Y.length?l.interrupt?n:I:w):i(N)}function E(N){return Jn(N)?(e.consume(N),u=String.fromCharCode(N),_):i(N)}function _(N){if(N===null||N===47||N===62||rn(N)){const Y=N===47,P=u.toLowerCase();return!Y&&!s&&nb.includes(P)?(o=1,l.interrupt?n(N):I(N)):dO.includes(u.toLowerCase())?(o=6,Y?(e.consume(N),S):l.interrupt?n(N):I(N)):(o=7,l.interrupt&&!l.parser.lazy[l.now().line]?i(N):s?z(N):k(N))}return N===45||vn(N)?(e.consume(N),u+=String.fromCharCode(N),_):i(N)}function S(N){return N===62?(e.consume(N),l.interrupt?n:I):i(N)}function z(N){return Qe(N)?(e.consume(N),z):X(N)}function k(N){return N===47?(e.consume(N),X):N===58||N===95||Jn(N)?(e.consume(N),A):Qe(N)?(e.consume(N),k):X(N)}function A(N){return N===45||N===46||N===58||N===95||vn(N)?(e.consume(N),A):M(N)}function M(N){return N===61?(e.consume(N),T):Qe(N)?(e.consume(N),M):k(N)}function T(N){return N===null||N===60||N===61||N===62||N===96?i(N):N===34||N===39?(e.consume(N),d=N,q):Qe(N)?(e.consume(N),T):j(N)}function q(N){return N===d?(e.consume(N),d=null,L):N===null||Te(N)?i(N):(e.consume(N),q)}function j(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||rn(N)?M(N):(e.consume(N),j)}function L(N){return N===47||N===62||Qe(N)?k(N):i(N)}function X(N){return N===62?(e.consume(N),B):i(N)}function B(N){return N===null||Te(N)?I(N):Qe(N)?(e.consume(N),B):i(N)}function I(N){return N===45&&o===2?(e.consume(N),D):N===60&&o===1?(e.consume(N),$):N===62&&o===4?(e.consume(N),U):N===63&&o===3?(e.consume(N),O):N===93&&o===5?(e.consume(N),J):Te(N)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(pO,F,ee)(N)):N===null||Te(N)?(e.exit("htmlFlowData"),ee(N)):(e.consume(N),I)}function ee(N){return e.check(mO,H,F)(N)}function H(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),G}function G(N){return N===null||Te(N)?ee(N):(e.enter("htmlFlowData"),I(N))}function D(N){return N===45?(e.consume(N),O):I(N)}function $(N){return N===47?(e.consume(N),u="",Z):I(N)}function Z(N){if(N===62){const Y=u.toLowerCase();return nb.includes(Y)?(e.consume(N),U):I(N)}return Jn(N)&&u.length<8?(e.consume(N),u+=String.fromCharCode(N),Z):I(N)}function J(N){return N===93?(e.consume(N),O):I(N)}function O(N){return N===62?(e.consume(N),U):N===45&&o===2?(e.consume(N),O):I(N)}function U(N){return N===null||Te(N)?(e.exit("htmlFlowData"),F(N)):(e.consume(N),U)}function F(N){return e.exit("htmlFlow"),n(N)}}function xO(e,n,i){const l=this;return o;function o(u){return Te(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),s):i(u)}function s(u){return l.parser.lazy[l.now().line]?i(u):n(u)}}function vO(e,n,i){return l;function l(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(wc,n,i)}}const bO={name:"htmlText",tokenize:wO};function wO(e,n,i){const l=this;let o,s,u;return f;function f(O){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(O),d}function d(O){return O===33?(e.consume(O),h):O===47?(e.consume(O),M):O===63?(e.consume(O),k):Jn(O)?(e.consume(O),j):i(O)}function h(O){return O===45?(e.consume(O),m):O===91?(e.consume(O),s=0,w):Jn(O)?(e.consume(O),z):i(O)}function m(O){return O===45?(e.consume(O),v):i(O)}function p(O){return O===null?i(O):O===45?(e.consume(O),y):Te(O)?(u=p,$(O)):(e.consume(O),p)}function y(O){return O===45?(e.consume(O),v):p(O)}function v(O){return O===62?D(O):O===45?y(O):p(O)}function w(O){const U="CDATA[";return O===U.charCodeAt(s++)?(e.consume(O),s===U.length?E:w):i(O)}function E(O){return O===null?i(O):O===93?(e.consume(O),_):Te(O)?(u=E,$(O)):(e.consume(O),E)}function _(O){return O===93?(e.consume(O),S):E(O)}function S(O){return O===62?D(O):O===93?(e.consume(O),S):E(O)}function z(O){return O===null||O===62?D(O):Te(O)?(u=z,$(O)):(e.consume(O),z)}function k(O){return O===null?i(O):O===63?(e.consume(O),A):Te(O)?(u=k,$(O)):(e.consume(O),k)}function A(O){return O===62?D(O):k(O)}function M(O){return Jn(O)?(e.consume(O),T):i(O)}function T(O){return O===45||vn(O)?(e.consume(O),T):q(O)}function q(O){return Te(O)?(u=q,$(O)):Qe(O)?(e.consume(O),q):D(O)}function j(O){return O===45||vn(O)?(e.consume(O),j):O===47||O===62||rn(O)?L(O):i(O)}function L(O){return O===47?(e.consume(O),D):O===58||O===95||Jn(O)?(e.consume(O),X):Te(O)?(u=L,$(O)):Qe(O)?(e.consume(O),L):D(O)}function X(O){return O===45||O===46||O===58||O===95||vn(O)?(e.consume(O),X):B(O)}function B(O){return O===61?(e.consume(O),I):Te(O)?(u=B,$(O)):Qe(O)?(e.consume(O),B):L(O)}function I(O){return O===null||O===60||O===61||O===62||O===96?i(O):O===34||O===39?(e.consume(O),o=O,ee):Te(O)?(u=I,$(O)):Qe(O)?(e.consume(O),I):(e.consume(O),H)}function ee(O){return O===o?(e.consume(O),o=void 0,G):O===null?i(O):Te(O)?(u=ee,$(O)):(e.consume(O),ee)}function H(O){return O===null||O===34||O===39||O===60||O===61||O===96?i(O):O===47||O===62||rn(O)?L(O):(e.consume(O),H)}function G(O){return O===47||O===62||rn(O)?L(O):i(O)}function D(O){return O===62?(e.consume(O),e.exit("htmlTextData"),e.exit("htmlText"),n):i(O)}function $(O){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),Z}function Z(O){return Qe(O)?ot(e,J,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):J(O)}function J(O){return e.enter("htmlTextData"),u(O)}}const Sm={name:"labelEnd",resolveAll:NO,resolveTo:kO,tokenize:CO},SO={tokenize:TO},_O={tokenize:zO},EO={tokenize:AO};function NO(e){let n=-1;const i=[];for(;++n=3&&(h===null||Te(h))?(e.exit("thematicBreak"),n(h)):i(h)}function d(h){return h===o?(e.consume(h),l++,d):(e.exit("thematicBreakSequence"),Qe(h)?ot(e,f,"whitespace")(h):f(h))}}const tn={continuation:{tokenize:UO},exit:VO,name:"list",tokenize:qO},HO={partial:!0,tokenize:YO},BO={partial:!0,tokenize:IO};function qO(e,n,i){const l=this,o=l.events[l.events.length-1];let s=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,u=0;return f;function f(v){const w=l.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!l.containerState.marker||v===l.containerState.marker:Hp(v)){if(l.containerState.type||(l.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(Vu,i,h)(v):h(v);if(!l.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(v)}return i(v)}function d(v){return Hp(v)&&++u<10?(e.consume(v),d):(!l.interrupt||u<2)&&(l.containerState.marker?v===l.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),h(v)):i(v)}function h(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),l.containerState.marker=l.containerState.marker||v,e.check(wc,l.interrupt?i:m,e.attempt(HO,y,p))}function m(v){return l.containerState.initialBlankLine=!0,s++,y(v)}function p(v){return Qe(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),y):i(v)}function y(v){return l.containerState.size=s+l.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(v)}}function UO(e,n,i){const l=this;return l.containerState._closeFlow=void 0,e.check(wc,o,s);function o(f){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,ot(e,n,"listItemIndent",l.containerState.size+1)(f)}function s(f){return l.containerState.furtherBlankLines||!Qe(f)?(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,u(f)):(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,e.attempt(BO,n,u)(f))}function u(f){return l.containerState._closeFlow=!0,l.interrupt=void 0,ot(e,e.attempt(tn,n,i),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function IO(e,n,i){const l=this;return ot(e,o,"listItemIndent",l.containerState.size+1);function o(s){const u=l.events[l.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===l.containerState.size?n(s):i(s)}}function VO(e){e.exit(this.containerState.type)}function YO(e,n,i){const l=this;return ot(e,o,"listItemPrefixWhitespace",l.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(s){const u=l.events[l.events.length-1];return!Qe(s)&&u&&u[1].type==="listItemPrefixWhitespace"?n(s):i(s)}}const rb={name:"setextUnderline",resolveTo:GO,tokenize:$O};function GO(e,n){let i=e.length,l,o,s;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){l=i;break}e[i][1].type==="paragraph"&&(o=i)}else e[i][1].type==="content"&&e.splice(i,1),!s&&e[i][1].type==="definition"&&(s=i);const u={type:"setextHeading",start:{...e[l][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",s?(e.splice(o,0,["enter",u,n]),e.splice(s+1,0,["exit",e[l][1],n]),e[l][1].end={...e[s][1].end}):e[l][1]=u,e.push(["exit",u,n]),e}function $O(e,n,i){const l=this;let o;return s;function s(h){let m=l.events.length,p;for(;m--;)if(l.events[m][1].type!=="lineEnding"&&l.events[m][1].type!=="linePrefix"&&l.events[m][1].type!=="content"){p=l.events[m][1].type==="paragraph";break}return!l.parser.lazy[l.now().line]&&(l.interrupt||p)?(e.enter("setextHeadingLine"),o=h,u(h)):i(h)}function u(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===o?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),Qe(h)?ot(e,d,"lineSuffix")(h):d(h))}function d(h){return h===null||Te(h)?(e.exit("setextHeadingLine"),n(h)):i(h)}}const XO={tokenize:FO};function FO(e){const n=this,i=e.attempt(wc,l,e.attempt(this.parser.constructs.flowInitial,o,ot(e,e.attempt(this.parser.constructs.flow,o,e.attempt(J5,o)),"linePrefix")));return i;function l(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),n.currentConstruct=void 0,i}function o(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n.currentConstruct=void 0,i}}const PO={resolveAll:d_()},QO=f_("string"),ZO=f_("text");function f_(e){return{resolveAll:d_(e==="text"?KO:void 0),tokenize:n};function n(i){const l=this,o=this.parser.constructs[e],s=i.attempt(o,u,f);return u;function u(m){return h(m)?s(m):f(m)}function f(m){if(m===null){i.consume(m);return}return i.enter("data"),i.consume(m),d}function d(m){return h(m)?(i.exit("data"),s(m)):(i.consume(m),d)}function h(m){if(m===null)return!0;const p=o[m];let y=-1;if(p)for(;++y-1){const f=u[0];typeof f=="string"?u[0]=f.slice(l):u.shift()}s>0&&u.push(e[o].slice(0,s))}return u}function cR(e,n){let i=-1;const l=[];let o;for(;++i0){const $t=Ne.tokenStack[Ne.tokenStack.length-1];($t[1]||lb).call(Ne,void 0,$t[0])}for(ge.position={start:ui(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:ui(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},Ve=-1;++Ve0&&(l.className=["language-"+o[0]]);let s={type:"element",tagName:"code",properties:l,children:[{type:"text",value:i}]};return n.meta&&(s.data={meta:n.meta}),e.patch(n,s),s=e.applyData(n,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(n,s),s}function SR(e,n){const i={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function _R(e,n){const i={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function ER(e,n){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",l=String(n.identifier).toUpperCase(),o=oa(l.toLowerCase()),s=e.footnoteOrder.indexOf(l);let u,f=e.footnoteCounts.get(l);f===void 0?(f=0,e.footnoteOrder.push(l),u=e.footnoteOrder.length):u=s+1,f+=1,e.footnoteCounts.set(l,f);const d={type:"element",tagName:"a",properties:{href:"#"+i+"fn-"+o,id:i+"fnref-"+o+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(n,d);const h={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(n,h),e.applyData(n,h)}function NR(e,n){const i={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function kR(e,n){if(e.options.allowDangerousHtml){const i={type:"raw",value:n.value};return e.patch(n,i),e.applyData(n,i)}}function h_(e,n){const i=n.referenceType;let l="]";if(i==="collapsed"?l+="[]":i==="full"&&(l+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+l}];const o=e.all(n),s=o[0];s&&s.type==="text"?s.value="["+s.value:o.unshift({type:"text",value:"["});const u=o[o.length-1];return u&&u.type==="text"?u.value+=l:o.push({type:"text",value:l}),o}function CR(e,n){const i=String(n.identifier).toUpperCase(),l=e.definitionById.get(i);if(!l)return h_(e,n);const o={src:oa(l.url||""),alt:n.alt};l.title!==null&&l.title!==void 0&&(o.title=l.title);const s={type:"element",tagName:"img",properties:o,children:[]};return e.patch(n,s),e.applyData(n,s)}function TR(e,n){const i={src:oa(n.url)};n.alt!==null&&n.alt!==void 0&&(i.alt=n.alt),n.title!==null&&n.title!==void 0&&(i.title=n.title);const l={type:"element",tagName:"img",properties:i,children:[]};return e.patch(n,l),e.applyData(n,l)}function zR(e,n){const i={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,i);const l={type:"element",tagName:"code",properties:{},children:[i]};return e.patch(n,l),e.applyData(n,l)}function AR(e,n){const i=String(n.identifier).toUpperCase(),l=e.definitionById.get(i);if(!l)return h_(e,n);const o={href:oa(l.url||"")};l.title!==null&&l.title!==void 0&&(o.title=l.title);const s={type:"element",tagName:"a",properties:o,children:e.all(n)};return e.patch(n,s),e.applyData(n,s)}function MR(e,n){const i={href:oa(n.url)};n.title!==null&&n.title!==void 0&&(i.title=n.title);const l={type:"element",tagName:"a",properties:i,children:e.all(n)};return e.patch(n,l),e.applyData(n,l)}function jR(e,n,i){const l=e.all(n),o=i?OR(i):p_(n),s={},u=[];if(typeof n.checked=="boolean"){const m=l[0];let p;m&&m.type==="element"&&m.tagName==="p"?p=m:(p={type:"element",tagName:"p",properties:{},children:[]},l.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let f=-1;for(;++f0){const $t=Ne.tokenStack[Ne.tokenStack.length-1];($t[1]||lb).call(Ne,void 0,$t[0])}for(ge.position={start:ui(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:ui(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},Ve=-1;++Ve0&&(l.className=["language-"+o[0]]);let s={type:"element",tagName:"code",properties:l,children:[{type:"text",value:i}]};return n.meta&&(s.data={meta:n.meta}),e.patch(n,s),s=e.applyData(n,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(n,s),s}function ER(e,n){const i={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function NR(e,n){const i={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function kR(e,n){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",l=String(n.identifier).toUpperCase(),o=ua(l.toLowerCase()),s=e.footnoteOrder.indexOf(l);let u,f=e.footnoteCounts.get(l);f===void 0?(f=0,e.footnoteOrder.push(l),u=e.footnoteOrder.length):u=s+1,f+=1,e.footnoteCounts.set(l,f);const d={type:"element",tagName:"a",properties:{href:"#"+i+"fn-"+o,id:i+"fnref-"+o+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(n,d);const h={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(n,h),e.applyData(n,h)}function CR(e,n){const i={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function TR(e,n){if(e.options.allowDangerousHtml){const i={type:"raw",value:n.value};return e.patch(n,i),e.applyData(n,i)}}function m_(e,n){const i=n.referenceType;let l="]";if(i==="collapsed"?l+="[]":i==="full"&&(l+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+l}];const o=e.all(n),s=o[0];s&&s.type==="text"?s.value="["+s.value:o.unshift({type:"text",value:"["});const u=o[o.length-1];return u&&u.type==="text"?u.value+=l:o.push({type:"text",value:l}),o}function zR(e,n){const i=String(n.identifier).toUpperCase(),l=e.definitionById.get(i);if(!l)return m_(e,n);const o={src:ua(l.url||""),alt:n.alt};l.title!==null&&l.title!==void 0&&(o.title=l.title);const s={type:"element",tagName:"img",properties:o,children:[]};return e.patch(n,s),e.applyData(n,s)}function AR(e,n){const i={src:ua(n.url)};n.alt!==null&&n.alt!==void 0&&(i.alt=n.alt),n.title!==null&&n.title!==void 0&&(i.title=n.title);const l={type:"element",tagName:"img",properties:i,children:[]};return e.patch(n,l),e.applyData(n,l)}function MR(e,n){const i={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,i);const l={type:"element",tagName:"code",properties:{},children:[i]};return e.patch(n,l),e.applyData(n,l)}function jR(e,n){const i=String(n.identifier).toUpperCase(),l=e.definitionById.get(i);if(!l)return m_(e,n);const o={href:ua(l.url||"")};l.title!==null&&l.title!==void 0&&(o.title=l.title);const s={type:"element",tagName:"a",properties:o,children:e.all(n)};return e.patch(n,s),e.applyData(n,s)}function OR(e,n){const i={href:ua(n.url)};n.title!==null&&n.title!==void 0&&(i.title=n.title);const l={type:"element",tagName:"a",properties:i,children:e.all(n)};return e.patch(n,l),e.applyData(n,l)}function RR(e,n,i){const l=e.all(n),o=i?DR(i):g_(n),s={},u=[];if(typeof n.checked=="boolean"){const m=l[0];let p;m&&m.type==="element"&&m.tagName==="p"?p=m:(p={type:"element",tagName:"p",properties:{},children:[]},l.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let f=-1;for(;++f1}function RR(e,n){const i={},l=e.all(n);let o=-1;for(typeof n.start=="number"&&n.start!==1&&(i.start=n.start);++o0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(i,!0)},f=gm(n.children[1]),d=FS(n.children[n.children.length-1]);f&&d&&(u.position={start:f,end:d}),o.push(u)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(n,s),e.applyData(n,s)}function qR(e,n,i){const l=i?i.children:void 0,s=(l?l.indexOf(n):1)===0?"th":"td",u=i&&i.type==="table"?i.align:void 0,f=u?u.length:n.children.length;let d=-1;const h=[];for(;++d0,!0),l[0]),o=l.index+l[0].length,l=i.exec(n);return s.push(sb(n.slice(o),o>0,!1)),s.join("")}function sb(e,n,i){let l=0,o=e.length;if(n){let s=e.codePointAt(l);for(;s===ab||s===ob;)l++,s=e.codePointAt(l)}if(i){let s=e.codePointAt(o-1);for(;s===ab||s===ob;)o--,s=e.codePointAt(o-1)}return o>l?e.slice(l,o):""}function VR(e,n){const i={type:"text",value:IR(String(n.value))};return e.patch(n,i),e.applyData(n,i)}function YR(e,n){const i={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,i),e.applyData(n,i)}const GR={blockquote:vR,break:bR,code:wR,delete:SR,emphasis:_R,footnoteReference:ER,heading:NR,html:kR,imageReference:CR,image:TR,inlineCode:zR,linkReference:AR,link:MR,listItem:jR,list:RR,paragraph:DR,root:LR,strong:HR,table:BR,tableCell:UR,tableRow:qR,text:VR,thematicBreak:YR,toml:ju,yaml:ju,definition:ju,footnoteDefinition:ju};function ju(){}const m_=-1,Sc=0,So=1,ic=2,_m=3,Em=4,Nm=5,km=6,g_=7,y_=8,ub=typeof self=="object"?self:globalThis,$R=(e,n)=>{const i=(o,s)=>(e.set(s,o),o),l=o=>{if(e.has(o))return e.get(o);const[s,u]=n[o];switch(s){case Sc:case m_:return i(u,o);case So:{const f=i([],o);for(const d of u)f.push(l(d));return f}case ic:{const f=i({},o);for(const[d,h]of u)f[l(d)]=l(h);return f}case _m:return i(new Date(u),o);case Em:{const{source:f,flags:d}=u;return i(new RegExp(f,d),o)}case Nm:{const f=i(new Map,o);for(const[d,h]of u)f.set(l(d),l(h));return f}case km:{const f=i(new Set,o);for(const d of u)f.add(l(d));return f}case g_:{const{name:f,message:d}=u;return i(new ub[f](d),o)}case y_:return i(BigInt(u),o);case"BigInt":return i(Object(BigInt(u)),o);case"ArrayBuffer":return i(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:f}=new Uint8Array(u);return i(new DataView(f),u)}}return i(new ub[s](u),o)};return l},cb=e=>$R(new Map,e)(0),Bl="",{toString:XR}={},{keys:PR}=Object,co=e=>{const n=typeof e;if(n!=="object"||!e)return[Sc,n];const i=XR.call(e).slice(8,-1);switch(i){case"Array":return[So,Bl];case"Object":return[ic,Bl];case"Date":return[_m,Bl];case"RegExp":return[Em,Bl];case"Map":return[Nm,Bl];case"Set":return[km,Bl];case"DataView":return[So,i]}return i.includes("Array")?[So,i]:i.includes("Error")?[g_,i]:[ic,i]},Ou=([e,n])=>e===Sc&&(n==="function"||n==="symbol"),FR=(e,n,i,l)=>{const o=(u,f)=>{const d=l.push(u)-1;return i.set(f,d),d},s=u=>{if(i.has(u))return i.get(u);let[f,d]=co(u);switch(f){case Sc:{let m=u;switch(d){case"bigint":f=y_,m=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);m=null;break;case"undefined":return o([m_],u)}return o([f,m],u)}case So:{if(d){let y=u;return d==="DataView"?y=new Uint8Array(u.buffer):d==="ArrayBuffer"&&(y=new Uint8Array(u)),o([d,[...y]],u)}const m=[],p=o([f,m],u);for(const y of u)m.push(s(y));return p}case ic:{if(d)switch(d){case"BigInt":return o([d,u.toString()],u);case"Boolean":case"Number":case"String":return o([d,u.valueOf()],u)}if(n&&"toJSON"in u)return s(u.toJSON());const m=[],p=o([f,m],u);for(const y of PR(u))(e||!Ou(co(u[y])))&&m.push([s(y),s(u[y])]);return p}case _m:return o([f,u.toISOString()],u);case Em:{const{source:m,flags:p}=u;return o([f,{source:m,flags:p}],u)}case Nm:{const m=[],p=o([f,m],u);for(const[y,v]of u)(e||!(Ou(co(y))||Ou(co(v))))&&m.push([s(y),s(v)]);return p}case km:{const m=[],p=o([f,m],u);for(const y of u)(e||!Ou(co(y)))&&m.push(s(y));return p}}const{message:h}=u;return o([f,{name:d,message:h}],u)};return s},fb=(e,{json:n,lossy:i}={})=>{const l=[];return FR(!(n||i),!!n,new Map,l)(e),l},lc=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?cb(fb(e,n)):structuredClone(e):(e,n)=>cb(fb(e,n));function QR(e,n){const i=[{type:"text",value:"↩"}];return n>1&&i.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),i}function ZR(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function KR(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=e.options.footnoteBackContent||QR,l=e.options.footnoteBackLabel||ZR,o=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let d=-1;for(;++d0&&w.push({type:"text",value:" "});let z=typeof i=="string"?i:i(d,v);typeof z=="string"&&(z={type:"text",value:z}),w.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+y+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof l=="string"?l:l(d,v),className:["data-footnote-backref"]},children:Array.isArray(z)?z:[z]})}const S=m[m.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const z=S.children[S.children.length-1];z&&z.type==="text"?z.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...w)}else m.push(...w);const _={type:"element",tagName:"li",properties:{id:n+"fn-"+y},children:e.wrap(m,!0)};e.patch(h,_),f.push(_)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...lc(u),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:` +`});const h={type:"element",tagName:"li",properties:s,children:u};return e.patch(n,h),e.applyData(n,h)}function DR(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const i=e.children;let l=-1;for(;!n&&++l1}function LR(e,n){const i={},l=e.all(n);let o=-1;for(typeof n.start=="number"&&n.start!==1&&(i.start=n.start);++o0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(i,!0)},f=gm(n.children[1]),d=ZS(n.children[n.children.length-1]);f&&d&&(u.position={start:f,end:d}),o.push(u)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(n,s),e.applyData(n,s)}function IR(e,n,i){const l=i?i.children:void 0,s=(l?l.indexOf(n):1)===0?"th":"td",u=i&&i.type==="table"?i.align:void 0,f=u?u.length:n.children.length;let d=-1;const h=[];for(;++d0,!0),l[0]),o=l.index+l[0].length,l=i.exec(n);return s.push(sb(n.slice(o),o>0,!1)),s.join("")}function sb(e,n,i){let l=0,o=e.length;if(n){let s=e.codePointAt(l);for(;s===ab||s===ob;)l++,s=e.codePointAt(l)}if(i){let s=e.codePointAt(o-1);for(;s===ab||s===ob;)o--,s=e.codePointAt(o-1)}return o>l?e.slice(l,o):""}function GR(e,n){const i={type:"text",value:YR(String(n.value))};return e.patch(n,i),e.applyData(n,i)}function $R(e,n){const i={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,i),e.applyData(n,i)}const XR={blockquote:wR,break:SR,code:_R,delete:ER,emphasis:NR,footnoteReference:kR,heading:CR,html:TR,imageReference:zR,image:AR,inlineCode:MR,linkReference:jR,link:OR,listItem:RR,list:LR,paragraph:HR,root:BR,strong:qR,table:UR,tableCell:VR,tableRow:IR,text:GR,thematicBreak:$R,toml:ju,yaml:ju,definition:ju,footnoteDefinition:ju};function ju(){}const y_=-1,Sc=0,Eo=1,ic=2,_m=3,Em=4,Nm=5,km=6,x_=7,v_=8,ub=typeof self=="object"?self:globalThis,FR=(e,n)=>{const i=(o,s)=>(e.set(s,o),o),l=o=>{if(e.has(o))return e.get(o);const[s,u]=n[o];switch(s){case Sc:case y_:return i(u,o);case Eo:{const f=i([],o);for(const d of u)f.push(l(d));return f}case ic:{const f=i({},o);for(const[d,h]of u)f[l(d)]=l(h);return f}case _m:return i(new Date(u),o);case Em:{const{source:f,flags:d}=u;return i(new RegExp(f,d),o)}case Nm:{const f=i(new Map,o);for(const[d,h]of u)f.set(l(d),l(h));return f}case km:{const f=i(new Set,o);for(const d of u)f.add(l(d));return f}case x_:{const{name:f,message:d}=u;return i(new ub[f](d),o)}case v_:return i(BigInt(u),o);case"BigInt":return i(Object(BigInt(u)),o);case"ArrayBuffer":return i(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:f}=new Uint8Array(u);return i(new DataView(f),u)}}return i(new ub[s](u),o)};return l},cb=e=>FR(new Map,e)(0),Bl="",{toString:PR}={},{keys:QR}=Object,ho=e=>{const n=typeof e;if(n!=="object"||!e)return[Sc,n];const i=PR.call(e).slice(8,-1);switch(i){case"Array":return[Eo,Bl];case"Object":return[ic,Bl];case"Date":return[_m,Bl];case"RegExp":return[Em,Bl];case"Map":return[Nm,Bl];case"Set":return[km,Bl];case"DataView":return[Eo,i]}return i.includes("Array")?[Eo,i]:i.includes("Error")?[x_,i]:[ic,i]},Ou=([e,n])=>e===Sc&&(n==="function"||n==="symbol"),ZR=(e,n,i,l)=>{const o=(u,f)=>{const d=l.push(u)-1;return i.set(f,d),d},s=u=>{if(i.has(u))return i.get(u);let[f,d]=ho(u);switch(f){case Sc:{let m=u;switch(d){case"bigint":f=v_,m=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);m=null;break;case"undefined":return o([y_],u)}return o([f,m],u)}case Eo:{if(d){let y=u;return d==="DataView"?y=new Uint8Array(u.buffer):d==="ArrayBuffer"&&(y=new Uint8Array(u)),o([d,[...y]],u)}const m=[],p=o([f,m],u);for(const y of u)m.push(s(y));return p}case ic:{if(d)switch(d){case"BigInt":return o([d,u.toString()],u);case"Boolean":case"Number":case"String":return o([d,u.valueOf()],u)}if(n&&"toJSON"in u)return s(u.toJSON());const m=[],p=o([f,m],u);for(const y of QR(u))(e||!Ou(ho(u[y])))&&m.push([s(y),s(u[y])]);return p}case _m:return o([f,u.toISOString()],u);case Em:{const{source:m,flags:p}=u;return o([f,{source:m,flags:p}],u)}case Nm:{const m=[],p=o([f,m],u);for(const[y,v]of u)(e||!(Ou(ho(y))||Ou(ho(v))))&&m.push([s(y),s(v)]);return p}case km:{const m=[],p=o([f,m],u);for(const y of u)(e||!Ou(ho(y)))&&m.push(s(y));return p}}const{message:h}=u;return o([f,{name:d,message:h}],u)};return s},fb=(e,{json:n,lossy:i}={})=>{const l=[];return ZR(!(n||i),!!n,new Map,l)(e),l},lc=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?cb(fb(e,n)):structuredClone(e):(e,n)=>cb(fb(e,n));function KR(e,n){const i=[{type:"text",value:"↩"}];return n>1&&i.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),i}function JR(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function WR(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=e.options.footnoteBackContent||KR,l=e.options.footnoteBackLabel||JR,o=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let d=-1;for(;++d0&&w.push({type:"text",value:" "});let z=typeof i=="string"?i:i(d,v);typeof z=="string"&&(z={type:"text",value:z}),w.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+y+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof l=="string"?l:l(d,v),className:["data-footnote-backref"]},children:Array.isArray(z)?z:[z]})}const _=m[m.length-1];if(_&&_.type==="element"&&_.tagName==="p"){const z=_.children[_.children.length-1];z&&z.type==="text"?z.value+=" ":_.children.push({type:"text",value:" "}),_.children.push(...w)}else m.push(...w);const S={type:"element",tagName:"li",properties:{id:n+"fn-"+y},children:e.wrap(m,!0)};e.patch(h,S),f.push(S)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...lc(u),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:` -`}]}}const x_=(function(e){if(e==null)return tD;if(typeof e=="function")return _c(e);if(typeof e=="object")return Array.isArray(e)?JR(e):WR(e);if(typeof e=="string")return eD(e);throw new Error("Expected function, string, or object as test")});function JR(e){const n=[];let i=-1;for(;++i":""))+")"})}return y;function y(){let v=v_,w,k,S;if((!n||s(d,h,m[m.length-1]||void 0))&&(v=aD(i(d,m)),v[0]===db))return v;if("children"in d&&d.children){const _=d;if(_.children&&v[0]!==iD)for(k=(l?_.children.length:-1)+u,S=m.concat(_);k>-1&&k<_.children.length;){const z=_.children[k];if(w=f(z,k,S)(),w[0]===db)return w;k=typeof w[1]=="number"?w[1]:k+u}}return v}}}function aD(e){return Array.isArray(e)?e:typeof e=="number"?[rD,e]:e==null?v_:[e]}function b_(e,n,i,l){let o,s,u;typeof n=="function"&&typeof i!="function"?(s=void 0,u=n,o=i):(s=n,u=i,o=l),lD(e,s,f,o);function f(d,h){const m=h[h.length-1],p=m?m.children.indexOf(d):void 0;return u(d,p,m)}}const qp={}.hasOwnProperty,oD={};function sD(e,n){const i=n||oD,l=new Map,o=new Map,s=new Map,u={...GR,...i.handlers},f={all:h,applyData:cD,definitionById:l,footnoteById:o,footnoteCounts:s,footnoteOrder:[],handlers:u,one:d,options:i,patch:uD,wrap:dD};return b_(e,function(m){if(m.type==="definition"||m.type==="footnoteDefinition"){const p=m.type==="definition"?l:o,y=String(m.identifier).toUpperCase();p.has(y)||p.set(y,m)}}),f;function d(m,p){const y=m.type,v=f.handlers[y];if(qp.call(f.handlers,y)&&v)return v(f,m,p);if(f.options.passThrough&&f.options.passThrough.includes(y)){if("children"in m){const{children:k,...S}=m,_=lc(S);return _.children=f.all(m),_}return lc(m)}return(f.options.unknownHandler||fD)(f,m,p)}function h(m){const p=[];if("children"in m){const y=m.children;let v=-1;for(;++v":""))+")"})}return y;function y(){let v=w_,w,E,_;if((!n||s(d,h,m[m.length-1]||void 0))&&(v=sD(i(d,m)),v[0]===db))return v;if("children"in d&&d.children){const S=d;if(S.children&&v[0]!==aD)for(E=(l?S.children.length:-1)+u,_=m.concat(S);E>-1&&E0&&i.push({type:"text",value:` -`}),i}function hb(e){let n=0,i=e.charCodeAt(n);for(;i===9||i===32;)n++,i=e.charCodeAt(n);return e.slice(n)}function pb(e,n){const i=sD(e,n),l=i.one(e,void 0),o=KR(i),s=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return o&&s.children.push({type:"text",value:` -`},o),s}function hD(e,n){return e&&"run"in e?async function(i,l){const o=pb(i,{file:l,...n});await e.run(o,l)}:function(i,l){return pb(i,{file:l,...e||n})}}function mb(e){if(e)throw e}var lp,gb;function pD(){if(gb)return lp;gb=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,i=Object.defineProperty,l=Object.getOwnPropertyDescriptor,o=function(h){return typeof Array.isArray=="function"?Array.isArray(h):n.call(h)==="[object Array]"},s=function(h){if(!h||n.call(h)!=="[object Object]")return!1;var m=e.call(h,"constructor"),p=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!m&&!p)return!1;var y;for(y in h);return typeof y>"u"||e.call(h,y)},u=function(h,m){i&&m.name==="__proto__"?i(h,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):h[m.name]=m.newValue},f=function(h,m){if(m==="__proto__")if(e.call(h,m)){if(l)return l(h,m).value}else return;return h[m]};return lp=function d(){var h,m,p,y,v,w,k=arguments[0],S=1,_=arguments.length,z=!1;for(typeof k=="boolean"&&(z=k,k=arguments[1]||{},S=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});S<_;++S)if(h=arguments[S],h!=null)for(m in h)p=f(k,m),y=f(h,m),k!==y&&(z&&y&&(s(y)||(v=o(y)))?(v?(v=!1,w=p&&o(p)?p:[]):w=p&&s(p)?p:{},u(k,{name:m,newValue:d(z,w,y)})):typeof y<"u"&&u(k,{name:m,newValue:y}));return k},lp}var mD=pD();const ap=Lo(mD);function Up(e){if(typeof e!="object"||e===null)return!1;const n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function gD(){const e=[],n={run:i,use:l};return n;function i(...o){let s=-1;const u=o.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);f(null,...o);function f(d,...h){const m=e[++s];let p=-1;if(d){u(d);return}for(;++pu.length;let d;f&&u.push(o);try{d=e.apply(this,u)}catch(h){const m=h;if(f&&i)throw m;return o(m)}f||(d&&d.then&&typeof d.then=="function"?d.then(s,o):d instanceof Error?o(d):s(d))}function o(u,...f){i||(i=!0,n(u,...f))}function s(u){o(null,u)}}const Zn={basename:xD,dirname:vD,extname:bD,join:wD,sep:"/"};function xD(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Fo(e);let i=0,l=-1,o=e.length,s;if(n===void 0||n.length===0||n.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(s){i=o+1;break}}else l<0&&(s=!0,l=o+1);return l<0?"":e.slice(i,l)}if(n===e)return"";let u=-1,f=n.length-1;for(;o--;)if(e.codePointAt(o)===47){if(s){i=o+1;break}}else u<0&&(s=!0,u=o+1),f>-1&&(e.codePointAt(o)===n.codePointAt(f--)?f<0&&(l=o):(f=-1,l=u));return i===l?l=u:l<0&&(l=e.length),e.slice(i,l)}function vD(e){if(Fo(e),e.length===0)return".";let n=-1,i=e.length,l;for(;--i;)if(e.codePointAt(i)===47){if(l){n=i;break}}else l||(l=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function bD(e){Fo(e);let n=e.length,i=-1,l=0,o=-1,s=0,u;for(;n--;){const f=e.codePointAt(n);if(f===47){if(u){l=n+1;break}continue}i<0&&(u=!0,i=n+1),f===46?o<0?o=n:s!==1&&(s=1):o>-1&&(s=-1)}return o<0||i<0||s===0||s===1&&o===i-1&&o===l+1?"":e.slice(o,i)}function wD(...e){let n=-1,i;for(;++n0&&e.codePointAt(e.length-1)===47&&(i+="/"),n?"/"+i:i}function _D(e,n){let i="",l=0,o=-1,s=0,u=-1,f,d;for(;++u<=e.length;){if(u2){if(d=i.lastIndexOf("/"),d!==i.length-1){d<0?(i="",l=0):(i=i.slice(0,d),l=i.length-1-i.lastIndexOf("/")),o=u,s=0;continue}}else if(i.length>0){i="",l=0,o=u,s=0;continue}}n&&(i=i.length>0?i+"/..":"..",l=2)}else i.length>0?i+="/"+e.slice(o+1,u):i=e.slice(o+1,u),l=u-o-1;o=u,s=0}else f===46&&s>-1?s++:s=-1}return i}function Fo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const ED={cwd:ND};function ND(){return"/"}function Ip(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function kD(e){if(typeof e=="string")e=new URL(e);else if(!Ip(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return CD(e)}function CD(e){if(e.hostname!==""){const l=new TypeError('File URL host must be "localhost" or empty on darwin');throw l.code="ERR_INVALID_FILE_URL_HOST",l}const n=e.pathname;let i=-1;for(;++i0){let[v,...w]=m;const k=l[y][1];Up(k)&&Up(v)&&(v=ap(!0,k,v)),l[y]=[h,v,...w]}}}}const MD=new Cm().freeze();function cp(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function fp(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function dp(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function xb(e){if(!Up(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function vb(e,n,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function Ru(e){return jD(e)?e:new w_(e)}function jD(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function OD(e){return typeof e=="string"||RD(e)}function RD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const DD="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",bb=[],wb={allowDangerousHtml:!0},LD=/^(https?|ircs?|mailto|xmpp)$/i,HD=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function BD(e){const n=qD(e),i=UD(e);return ID(n.runSync(n.parse(i),i),e)}function qD(e){const n=e.rehypePlugins||bb,i=e.remarkPlugins||bb,l=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...wb}:wb;return MD().use(xR).use(i).use(hD,l).use(n)}function UD(e){const n=e.children||"",i=new w_;return typeof n=="string"&&(i.value=n),i}function ID(e,n){const i=n.allowedElements,l=n.allowElement,o=n.components,s=n.disallowedElements,u=n.skipHtml,f=n.unwrapDisallowed,d=n.urlTransform||VD;for(const m of HD)Object.hasOwn(n,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+DD+m.id,void 0);return b_(e,h),K4(e,{Fragment:b.Fragment,components:o,ignoreInvalidStyle:!0,jsx:b.jsx,jsxs:b.jsxs,passKeys:!0,passNode:!0});function h(m,p,y){if(m.type==="raw"&&y&&typeof p=="number")return u?y.children.splice(p,1):y.children[p]={type:"text",value:m.value},p;if(m.type==="element"){let v;for(v in np)if(Object.hasOwn(np,v)&&Object.hasOwn(m.properties,v)){const w=m.properties[v],k=np[v];(k===null||k.includes(m.tagName))&&(m.properties[v]=d(String(w||""),v,m))}}if(m.type==="element"){let v=i?!i.includes(m.tagName):s?s.includes(m.tagName):!1;if(!v&&l&&typeof p=="number"&&(v=!l(m,p,y)),v&&y&&typeof p=="number")return f&&m.children?y.children.splice(p,1,...m.children):y.children.splice(p,1),p}}}function VD(e){const n=e.indexOf(":"),i=e.indexOf("?"),l=e.indexOf("#"),o=e.indexOf("/");return n===-1||o!==-1&&n>o||i!==-1&&n>i||l!==-1&&n>l||LD.test(e.slice(0,n))?e:""}function YD({node:e}){const n=he(E=>E.sendGateResponse),i=he(E=>E.wsStatus),[l,o]=V.useState(null),[s,u]=V.useState(""),[f,d]=V.useState(null),[h,m]=V.useState(!1),p=e.status==="waiting",y=e.status==="completed";V.useEffect(()=>{p&&(o(null),u(""),d(null),m(!1))},[p]);const v=p&&i==="connected"&&l===null,w=(E,A)=>{if(v){if(A){o(E),d(A);return}o(E),m(!0),n(e.name,E)}},k=()=>{if(l===null||f===null)return;const E={[f]:s};m(!0),n(e.name,l,E),d(null)},S=e.option_details,_=S==null?void 0:S.find(E=>E.value===e.selected_option),z=(_==null?void 0:_.label)||e.selected_option;return b.jsxs("div",{className:"space-y-3",children:[p&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 rounded-lg bg-amber-500/10 border border-amber-500/30",children:[b.jsxs("span",{className:"relative flex h-2.5 w-2.5 flex-shrink-0",children:[b.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-amber-400 opacity-75"}),b.jsx("span",{className:"relative inline-flex rounded-full h-2.5 w-2.5 bg-amber-500"})]}),b.jsx("span",{className:"text-xs font-semibold text-amber-400 tracking-wide",children:"Decision Required"})]}),e.prompt&&b.jsx("div",{className:"border-l-2 border-amber-500/50 pl-3 py-0.5",children:b.jsx(hp,{text:e.prompt,muted:!1})}),S&&S.length>0&&b.jsxs("div",{className:"space-y-2",children:[b.jsx("div",{className:"flex flex-col gap-1.5",children:S.map(E=>{const A=l===E.value,B=l!==null&&!A;return b.jsx("button",{disabled:!v&&!A,onClick:()=>w(E.value,E.prompt_for),className:`w-full text-left px-3 py-2.5 rounded-lg border transition-all duration-150 ${A?"border-green-500/60 bg-green-500/10":B?"border-[var(--border)] opacity-40 cursor-default":"border-[var(--border)] bg-[var(--surface)] hover:border-amber-400/60 hover:bg-amber-500/5 cursor-pointer group"}`,children:b.jsxs("div",{className:"flex items-center gap-2.5",children:[b.jsx("div",{className:"flex-shrink-0",children:A?b.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500 flex items-center justify-center",children:b.jsx(Bi,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}):b.jsx("div",{className:`w-4 h-4 rounded-full border-2 transition-colors ${B?"border-[var(--border)]":"border-[var(--border)] group-hover:border-amber-400"}`})}),b.jsx("div",{className:"flex-1 min-w-0",children:b.jsx("span",{className:`text-xs font-medium ${A?"text-green-400":"text-[var(--text)]"}`,children:E.label})}),E.route&&b.jsxs("span",{className:"text-[10px] text-[var(--text-muted)] flex-shrink-0",children:["→ ",E.route]})]})},E.value)})}),h&&!f&&b.jsxs("div",{className:"flex items-center gap-2 px-1",children:[b.jsx(_o,{className:"w-3 h-3 text-green-400 animate-spin"}),b.jsx("span",{className:"text-[10px] text-green-400",children:"Sending..."})]}),v&&b.jsx("p",{className:"text-[10px] text-[var(--text-muted)] px-1",children:"Select an option to continue the workflow"})]}),!S&&e.options&&e.options.length>0&&b.jsxs("div",{className:"space-y-1.5",children:[b.jsx("h4",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)] font-semibold",children:"Options"}),b.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.options.map(E=>b.jsx("span",{className:"text-[11px] px-2 py-0.5 rounded border border-[var(--border)] text-[var(--text-muted)]",children:E},E))})]}),f&&b.jsxs("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--bg)] overflow-hidden",children:[b.jsx("div",{className:"px-3 py-2 border-b border-[var(--border)] bg-[var(--surface)]",children:b.jsx("h4",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)] font-semibold",children:f})}),b.jsxs("div",{className:"p-3 space-y-2",children:[b.jsx("input",{type:"text",value:s,onChange:E=>u(E.target.value),onKeyDown:E=>E.key==="Enter"&&k(),placeholder:`Enter ${f}...`,className:"w-full text-xs px-3 py-2 rounded-lg border border-[var(--border)] bg-[var(--bg)] text-[var(--text)] outline-none focus:border-amber-400 transition-colors",autoFocus:!0}),b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:"Press Enter or click Submit"}),b.jsxs("button",{onClick:k,className:"flex items-center gap-1.5 text-xs px-3 py-1.5 rounded-lg bg-amber-500 text-white hover:bg-amber-600 transition-colors font-medium",children:[b.jsx(lN,{className:"w-3 h-3"}),"Submit"]})]})]})]})]}),y&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 rounded-lg bg-green-500/10 border border-green-500/30",children:[b.jsx(Bi,{className:"w-3.5 h-3.5 text-green-400 flex-shrink-0"}),b.jsx("span",{className:"text-xs font-semibold text-green-400 tracking-wide",children:"Decision Completed"})]}),e.prompt&&b.jsx("div",{className:"border-l-2 border-[var(--border)] pl-3 py-0.5",children:b.jsx(hp,{text:e.prompt,muted:!0})}),z&&b.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-green-500/30 bg-green-500/5",children:[b.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500 flex items-center justify-center flex-shrink-0",children:b.jsx(Bi,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),b.jsx("span",{className:"text-xs font-medium text-[var(--text)]",children:z}),e.route&&b.jsxs("span",{className:"ml-auto text-[10px] text-[var(--text-muted)]",children:["→ ",e.route]})]}),S&&S.length>1&&b.jsx("div",{className:"space-y-1",children:S.filter(E=>E.value!==e.selected_option).map(E=>b.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 rounded-lg opacity-35",children:[b.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[var(--border)] flex-shrink-0"}),b.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:E.label}),E.route&&b.jsxs("span",{className:"ml-auto text-[10px] text-[var(--text-muted)]",children:["→ ",E.route]})]},E.value))}),!S&&e.options&&e.options.length>0&&b.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.options.map(E=>b.jsxs("span",{className:`text-[11px] px-2.5 py-1 rounded-lg border ${E===e.selected_option?"border-green-500/30 text-green-400 bg-green-500/5":"border-[var(--border)] text-[var(--text-muted)] opacity-40"}`,children:[E===e.selected_option&&"✓ ",E]},E))}),b.jsx(GD,{node:e})]}),!p&&!y&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Human Gate"}),b.jsxs("span",{className:"text-[10px] text-[var(--text-muted)] capitalize",children:["(",e.status,")"]})]}),e.prompt&&b.jsx("div",{className:"border-l-2 border-[var(--border)] pl-3 py-0.5",children:b.jsx(hp,{text:e.prompt,muted:!0})})]})]})}function hp({text:e,muted:n}){const i=n?"text-[var(--text-muted)]":"text-[var(--text)]";return b.jsx("div",{className:`gate-markdown text-xs leading-relaxed ${i}`,children:b.jsx(BD,{components:{h1:({children:l})=>b.jsx("h1",{className:"text-sm font-bold mb-2 mt-1",children:l}),h2:({children:l})=>b.jsx("h2",{className:"text-xs font-bold mb-1.5 mt-1",children:l}),h3:({children:l})=>b.jsx("h3",{className:"text-xs font-semibold mb-1 mt-1",children:l}),p:({children:l})=>b.jsx("p",{className:"mb-1.5 last:mb-0",children:l}),ul:({children:l})=>b.jsx("ul",{className:"list-disc list-inside mb-1.5 space-y-0.5",children:l}),ol:({children:l})=>b.jsx("ol",{className:"list-decimal list-inside mb-1.5 space-y-0.5",children:l}),li:({children:l})=>b.jsx("li",{children:l}),code:({children:l,className:o})=>(o==null?void 0:o.includes("language-"))?b.jsx("code",{className:"block bg-[var(--bg)] border border-[var(--border)] rounded px-2 py-1.5 font-mono text-[11px] my-1 overflow-x-auto whitespace-pre",children:l}):b.jsx("code",{className:"bg-[var(--bg)] border border-[var(--border)] rounded px-1 py-0.5 font-mono text-[11px]",children:l}),pre:({children:l})=>b.jsx("pre",{className:"bg-[var(--bg)] border border-[var(--border)] rounded-md px-2.5 py-2 font-mono text-[11px] my-1.5 overflow-x-auto",children:l}),strong:({children:l})=>b.jsx("strong",{className:"font-semibold",children:l}),em:({children:l})=>b.jsx("em",{className:"italic",children:l}),a:({href:l,children:o})=>b.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:text-blue-300 underline underline-offset-2",children:o}),blockquote:({children:l})=>b.jsx("blockquote",{className:"border-l-2 border-[var(--border)] pl-2.5 my-1.5 opacity-80",children:l}),hr:()=>b.jsx("hr",{className:"border-[var(--border)] my-2"})},children:e})})}function GD({node:e}){const n=[];if(e.route&&n.push({label:"Route",value:`→ ${e.route}`}),e.additional_input){const i=typeof e.additional_input=="object"?JSON.stringify(e.additional_input):e.additional_input;n.push({label:"Additional Input",value:i})}return n.length===0?null:b.jsx(la,{items:n})}function $D({node:e}){const n=e.status,i=lt[n]||lt.pending,o=he(m=>m.groupProgress)[e.name],s=e.type==="for_each_group",[u,f]=V.useState(!0),d=[];e.elapsed!=null&&d.push({label:"Elapsed",value:ln(e.elapsed)}),o&&(d.push({label:"Total",value:o.total}),d.push({label:"Completed",value:o.completed}),o.failed>0&&d.push({label:"Failed",value:o.failed})),e.success_count!=null&&d.push({label:"Success",value:e.success_count}),e.failure_count!=null&&d.push({label:"Failures",value:e.failure_count});const h=e.for_each_items;return b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-[10px] font-bold uppercase tracking-wider",style:{backgroundColor:`${i}20`,color:i},children:n}),b.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s?"For-Each Group":"Parallel Group"})]}),o&&o.total>0&&b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex justify-between text-[10px] text-[var(--text-muted)]",children:[b.jsx("span",{children:"Progress"}),b.jsxs("span",{children:[o.completed+o.failed,"/",o.total]})]}),b.jsx("div",{className:"h-1.5 bg-[var(--bg)] rounded-full overflow-hidden",children:b.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${(o.completed+o.failed)/o.total*100}%`,background:o.failed>0?`linear-gradient(90deg, var(--completed) ${o.completed/(o.completed+o.failed)*100}%, var(--failed) 0%)`:"var(--completed)"}})})]}),b.jsx(la,{items:d}),s&&h&&h.length>0&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("button",{onClick:()=>f(!u),className:"flex items-center gap-1.5 text-[10px] uppercase tracking-wider text-[var(--text-muted)] font-semibold hover:text-[var(--text)] transition-colors",children:[u?b.jsx(Fi,{className:"w-3 h-3"}):b.jsx(ia,{className:"w-3 h-3"}),"Items (",h.length,")"]}),u&&b.jsx("div",{className:"space-y-1",children:h.map(m=>b.jsx(PD,{item:m},`${m.key}-${m.index}`))})]})]})}const XD={running:lt.running,completed:lt.completed,failed:lt.failed};function PD({item:e}){const[n,i]=V.useState(e.status==="running"),l=XD[e.status],o=!!(e.prompt||e.output!=null||e.activity&&e.activity.length>0||e.error_type),s=[];return e.elapsed!=null&&s.push({label:"Elapsed",value:ln(e.elapsed)}),e.tokens!=null&&s.push({label:"Tokens",value:Wn(e.tokens)}),e.cost_usd!=null&&s.push({label:"Cost",value:Zl(e.cost_usd)}),b.jsxs("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--surface)] overflow-hidden",children:[b.jsxs("button",{onClick:()=>o&&i(!n),className:"flex items-center gap-2 w-full px-3 py-2 text-left hover:bg-[var(--node-bg)] transition-colors",disabled:!o,children:[o?n?b.jsx(Fi,{className:"w-3 h-3 text-[var(--text-muted)] flex-shrink-0"}):b.jsx(ia,{className:"w-3 h-3 text-[var(--text-muted)] flex-shrink-0"}):e.status==="running"?b.jsx(_o,{className:"w-3 h-3 animate-spin flex-shrink-0",style:{color:l}}):b.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0 ml-0.5 mr-0.5",style:{backgroundColor:l}}),b.jsx("span",{className:"text-xs font-medium text-[var(--text)] truncate flex-1 min-w-0",children:e.key}),!n&&(e.elapsed!=null||e.tokens!=null||e.cost_usd!=null)&&b.jsxs("span",{className:"flex items-center gap-2 text-[10px] text-[var(--text-muted)] flex-shrink-0",children:[e.elapsed!=null&&b.jsx("span",{children:ln(e.elapsed)}),e.tokens!=null&&b.jsx("span",{children:Wn(e.tokens)}),e.cost_usd!=null&&b.jsx("span",{children:Zl(e.cost_usd)})]}),b.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider flex-shrink-0 px-1.5 py-0.5 rounded",style:{backgroundColor:`${l}20`,color:l},children:e.status})]}),n&&o&&b.jsxs("div",{className:"px-3 py-3 space-y-3 border-t border-[var(--border)]",children:[s.length>0&&b.jsx(la,{items:s}),e.prompt&&b.jsx(Pi,{output:e.prompt,title:"Input / Prompt",defaultExpanded:!1}),e.activity&&e.activity.length>0&&b.jsx(hm,{activity:e.activity,defaultExpanded:e.status!=="completed"}),e.output!=null&&b.jsx(Pi,{output:e.output,title:"Output",defaultExpanded:!0}),e.status==="failed"&&(e.error_type||e.error_message)&&b.jsxs("div",{className:"text-xs text-red-400",children:[e.error_type&&b.jsx("span",{className:"font-semibold",children:e.error_type}),e.error_message&&b.jsxs("span",{className:"ml-1",children:["— ",e.error_message]})]})]})]})}function FD(){const e=he(f=>f.selectedNode),n=he(f=>f.nodes),i=he(f=>f.selectNode),[l,o]=V.useState(!1);V.useEffect(()=>(requestAnimationFrame(()=>o(!0)),()=>o(!1)),[e]);const s=e?n[e]:null;if(!e||!s)return b.jsxs("div",{className:"h-full flex flex-col bg-[var(--surface)]",children:[b.jsx("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:b.jsx("h2",{className:"text-sm font-semibold text-[var(--text)]",children:"Detail"})}),b.jsx("div",{className:"flex-1 flex items-center justify-center",children:b.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Click a node to view details"})})]});const u=(()=>{switch(s.type){case"script":return S4;case"human_gate":return YD;case"parallel_group":case"for_each_group":return $D;default:return b4}})();return b.jsxs("div",{className:Ye("h-full flex flex-col bg-[var(--surface)] transition-all duration-150 ease-out",l?"translate-x-0 opacity-100":"translate-x-4 opacity-0"),children:[b.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)] flex-shrink-0",children:[b.jsx("h2",{className:"text-sm font-semibold text-[var(--text)] truncate",children:e}),b.jsx("button",{onClick:()=>i(null),className:"p-1 rounded hover:bg-[var(--surface-hover)] text-[var(--text-muted)] hover:text-[var(--text)] transition-colors",title:"Close panel",children:b.jsx(Bo,{className:"w-4 h-4"})})]}),b.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3",children:b.jsx(u,{node:s})})]})}function Yu(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function QD(){const e=he(S=>S.eventLog),n=he(S=>S.activityLog),i=he(S=>S.workflowOutput),l=he(S=>S.workflowStatus),[o,s]=V.useState("log"),[u,f]=V.useState(!1),[d,h]=V.useState(0),[m,p]=V.useState(0),y=V.useCallback(S=>{s(S),S==="log"&&h(e.length),S==="activity"&&p(n.length)},[e.length,n.length]);V.useEffect(()=>{o==="log"&&h(e.length)},[o,e.length]),V.useEffect(()=>{o==="activity"&&p(n.length)},[o,n.length]),V.useEffect(()=>{l==="completed"&&i!=null&&s("output")},[l,i]);const v=i!=null,w=o!=="log"?Math.max(0,e.length-d):0,k=o!=="activity"?Math.max(0,n.length-m):0;return u?b.jsx("div",{className:"flex items-center bg-[var(--surface)] border-t border-[var(--border)] px-3 py-1",children:b.jsxs("button",{onClick:()=>f(!1),className:"flex items-center gap-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)] transition-colors",children:[b.jsx($2,{className:"w-3 h-3"}),b.jsx(bx,{className:"w-3 h-3"}),b.jsx("span",{children:"Output"}),n.length>0&&b.jsxs("span",{className:"text-[10px] text-[var(--text-muted)]",children:["(",n.length,")"]})]})}):b.jsxs("div",{className:"flex flex-col h-full bg-[var(--surface)] border-t border-[var(--border)]",children:[b.jsxs("div",{className:"flex items-center justify-between px-2 flex-shrink-0 border-b border-[var(--border)]",children:[b.jsxs("div",{className:"flex items-center gap-0.5",children:[b.jsx(pp,{active:o==="log",onClick:()=>y("log"),icon:b.jsx(bx,{className:"w-3 h-3"}),label:"Log",count:e.length,unread:w}),b.jsx(pp,{active:o==="activity",onClick:()=>y("activity"),icon:b.jsx(kb,{className:"w-3 h-3"}),label:"Activity",count:n.length,unread:k}),b.jsx(pp,{active:o==="output",onClick:()=>y("output"),icon:b.jsx(J2,{className:"w-3 h-3"}),label:"Output",badge:v?l==="failed"?"error":"success":void 0})]}),b.jsx("button",{onClick:()=>f(!0),className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--surface-hover)] transition-colors",title:"Collapse panel",children:b.jsx(Fi,{className:"w-3.5 h-3.5"})})]}),b.jsx("div",{className:"flex-1 overflow-hidden",children:o==="activity"?b.jsx(ZD,{entries:n}):o==="log"?b.jsx(KD,{entries:e}):b.jsx(JD,{output:i,status:l})})]})}function pp({active:e,onClick:n,icon:i,label:l,count:o,badge:s,unread:u}){return b.jsxs("button",{onClick:n,className:Ye("relative flex items-center gap-1.5 px-3 py-1.5 text-xs transition-colors border-b-2 -mb-px",e?"text-[var(--text)] border-[var(--accent)]":"text-[var(--text-muted)] border-transparent hover:text-[var(--text-secondary)]"),children:[i,b.jsx("span",{children:l}),o!=null&&o>0&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] tabular-nums",children:o}),s&&b.jsx("span",{className:Ye("w-1.5 h-1.5 rounded-full",s==="success"?"bg-[var(--completed)]":"bg-[var(--failed)]")}),!e&&u!=null&&u>0&&b.jsx("span",{className:"absolute -top-0.5 -right-0.5 flex h-3.5 min-w-[14px] items-center justify-center rounded-full bg-[var(--accent)] px-1",children:b.jsx("span",{className:"text-[8px] font-bold text-white leading-none tabular-nums",children:u>99?"99+":u})})]})}const Sb={reasoning:{color:"text-indigo-400/70",label:"THINK",labelColor:"text-indigo-500"},"tool-start":{color:"text-blue-400",label:"TOOL →",labelColor:"text-blue-500"},"tool-complete":{color:"text-green-400",label:"TOOL ←",labelColor:"text-green-600"},turn:{color:"text-amber-400",label:"STEP",labelColor:"text-amber-500"},message:{color:"text-[var(--text)]",label:"MSG",labelColor:"text-[var(--text-muted)]"},prompt:{color:"text-cyan-400/70",label:"PROMPT",labelColor:"text-cyan-600"}};function ZD({entries:e}){const n=V.useRef(null),i=V.useRef(!0),l=he(d=>d.selectNode),[o,s]=V.useState(""),u=V.useCallback(()=>{const d=n.current;if(!d)return;const h=d.scrollHeight-d.scrollTop-d.clientHeight<30;i.current=h},[]),f=V.useMemo(()=>{if(!o)return e;const d=o.toLowerCase();return e.filter(h=>h.source.toLowerCase().includes(d)||Yu(h.message).toLowerCase().includes(d))},[e,o]);return V.useEffect(()=>{n.current&&i.current&&(n.current.scrollTop=n.current.scrollHeight)},[f.length]),e.length===0?b.jsx("div",{className:"h-full flex items-center justify-center",children:b.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Waiting for agent activity…"})}):b.jsxs("div",{className:"h-full flex flex-col",children:[b.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-[var(--border-subtle)] flex-shrink-0",children:[b.jsx(iN,{className:"w-3 h-3 text-[var(--text-muted)] flex-shrink-0"}),b.jsx("input",{type:"text",value:o,onChange:d=>s(d.target.value),placeholder:"Filter by agent or message…",className:"flex-1 bg-transparent text-[11px] text-[var(--text)] placeholder:text-[var(--text-muted)] outline-none min-w-0"}),o&&b.jsxs(b.Fragment,{children:[b.jsxs("span",{className:"text-[10px] text-[var(--text-muted)] tabular-nums flex-shrink-0",children:[f.length," of ",e.length]}),b.jsx("button",{onClick:()=>s(""),className:"text-[var(--text-muted)] hover:text-[var(--text)] transition-colors flex-shrink-0",title:"Clear filter",children:b.jsx(Bo,{className:"w-3 h-3"})})]})]}),b.jsxs("div",{ref:n,onScroll:u,className:"flex-1 overflow-y-auto font-mono text-[11px] leading-[1.6] px-3 py-2",children:[f.map((d,h)=>{const m=Sb[d.type]||Sb.message,p=S_(d.timestamp);return b.jsxs("div",{className:"group",children:[b.jsxs("div",{className:"flex gap-1.5 hover:bg-[var(--surface-hover)] rounded px-1 -mx-1",children:[b.jsx("span",{className:"text-[var(--text-muted)] flex-shrink-0 select-none tabular-nums",children:p}),b.jsx("span",{className:Ye("flex-shrink-0 w-[5ch] text-[10px] font-semibold tabular-nums select-none",m.labelColor),children:m.label}),b.jsx("button",{onClick:()=>l(d.source),className:"text-[var(--text-secondary)] flex-shrink-0 min-w-[8ch] max-w-[16ch] truncate hover:text-[var(--accent)] hover:underline transition-colors text-left",title:`Select ${d.source}`,children:d.source}),b.jsx("span",{className:Ye("break-words min-w-0",m.color,d.type==="reasoning"&&"italic"),children:Yu(d.message)})]}),d.detail&&b.jsx("div",{className:"ml-[calc(7ch+5ch+8ch+1rem)] px-2 py-1 my-0.5 bg-[var(--bg)] rounded text-[10px] text-[var(--text-muted)] whitespace-pre-wrap break-words max-h-24 overflow-y-auto border-l-2 border-[var(--border)]",children:Yu(d.detail)})]},h)}),o&&f.length===0&&b.jsx("div",{className:"flex items-center justify-center py-4",children:b.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:['No matches for "',o,'"']})})]})]})}const _b={info:{color:"text-blue-400",icon:"›"},success:{color:"text-green-400",icon:"✓"},error:{color:"text-red-400",icon:"✗"},warning:{color:"text-amber-400",icon:"⚠"},debug:{color:"text-[var(--text-muted)]",icon:"·"}};function KD({entries:e}){const n=V.useRef(null),i=V.useRef(!0),l=he(s=>s.selectNode),o=V.useCallback(()=>{const s=n.current;if(!s)return;const u=s.scrollHeight-s.scrollTop-s.clientHeight<30;i.current=u},[]);return V.useEffect(()=>{n.current&&i.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.length]),e.length===0?b.jsx("div",{className:"h-full flex items-center justify-center",children:b.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Waiting for events…"})}):b.jsx("div",{ref:n,onScroll:o,className:"h-full overflow-y-auto font-mono text-[11px] leading-[1.6] px-3 py-2",children:e.map((s,u)=>{const f=_b[s.level]||_b.info,d=S_(s.timestamp);return b.jsxs("div",{className:"flex gap-2 hover:bg-[var(--surface-hover)] rounded px-1 -mx-1",children:[b.jsx("span",{className:"text-[var(--text-muted)] flex-shrink-0 select-none tabular-nums",children:d}),b.jsx("span",{className:Ye("flex-shrink-0 w-3 text-center select-none",f.color),children:f.icon}),b.jsx("button",{onClick:()=>l(s.source),className:"text-[var(--text-secondary)] flex-shrink-0 min-w-[8ch] max-w-[16ch] truncate hover:text-[var(--accent)] hover:underline transition-colors text-left",title:`Select ${s.source}`,children:s.source}),b.jsx("span",{className:Ye("break-words",s.level==="error"?"text-red-400":s.level==="success"?"text-green-400":"text-[var(--text)]"),children:Yu(s.message)})]},u)})})}function S_(e){const n=new Date(e*1e3),i=n.getHours().toString().padStart(2,"0"),l=n.getMinutes().toString().padStart(2,"0"),o=n.getSeconds().toString().padStart(2,"0");return`${i}:${l}:${o}`}function JD({output:e,status:n}){const[i,l]=V.useState(!1),o=zb(e),s=async()=>{o&&(await navigator.clipboard.writeText(o),l(!0),setTimeout(()=>l(!1),2e3))};return e==null?b.jsx("div",{className:"h-full flex items-center justify-center",children:b.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:n==="running"?"Workflow running — output will appear when complete…":n==="failed"?"Workflow failed — no output produced":"No output yet"})}):b.jsxs("div",{className:"h-full flex flex-col",children:[b.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-b border-[var(--border-subtle)] flex-shrink-0",children:[b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] uppercase tracking-wider font-semibold",children:"Workflow Result"}),b.jsx("button",{onClick:s,className:"flex items-center gap-1 text-[10px] text-[var(--text-muted)] hover:text-[var(--text)] transition-colors px-1.5 py-0.5 rounded hover:bg-[var(--surface-hover)]",title:"Copy to clipboard",children:i?b.jsxs(b.Fragment,{children:[b.jsx(Bi,{className:"w-3 h-3 text-[var(--completed)]"}),b.jsx("span",{className:"text-[var(--completed)]",children:"Copied"})]}):b.jsxs(b.Fragment,{children:[b.jsx(Cb,{className:"w-3 h-3"}),b.jsx("span",{children:"Copy"})]})})]}),b.jsx("div",{className:"flex-1 overflow-auto px-3 py-2",children:b.jsx("pre",{className:"font-mono text-[11px] leading-relaxed text-[var(--text)] whitespace-pre-wrap break-words",children:typeof e=="object"?b.jsx(WD,{text:o}):o})})]})}function WD({text:e}){const n=e.split(/("(?:[^"\\]|\\.)*")/g);return b.jsx(b.Fragment,{children:n.map((i,l)=>{if(l%2===1){const s=n.slice(l+1).join(""),u=/^\s*:/.test(s);return b.jsx("span",{className:u?"text-blue-400":"text-green-400",children:i},l)}const o=i.replace(/\b(true|false|null)\b|(-?\d+\.?\d*(?:e[+-]?\d+)?)/gi,(s,u,f)=>u?`${s}`:f?`${s}`:s);return b.jsx("span",{dangerouslySetInnerHTML:{__html:o}},l)})})}function e6(){const e=he(n=>n.selectedNode);return b.jsxs(gp,{direction:"vertical",className:"flex-1 overflow-hidden",children:[b.jsx(fo,{defaultSize:70,minSize:30,children:b.jsxs(gp,{direction:"horizontal",className:"h-full",children:[b.jsx(fo,{defaultSize:e?65:100,minSize:40,children:b.jsx(m4,{})}),e&&b.jsxs(b.Fragment,{children:[b.jsx(yp,{className:"w-[3px] bg-[var(--border)] hover:bg-[var(--text-muted)] transition-colors cursor-col-resize"}),b.jsx(fo,{defaultSize:35,minSize:20,maxSize:60,children:b.jsx(FD,{})})]})]})}),b.jsx(yp,{className:"h-[3px] bg-[var(--border)] hover:bg-[var(--text-muted)] transition-colors cursor-row-resize"}),b.jsx(fo,{defaultSize:30,minSize:5,maxSize:70,collapsible:!0,children:b.jsx(QD,{})})]})}const t6=3e4;function n6(){const e=he(p=>p.processEvent),n=he(p=>p.replayState),i=he(p=>p.setWsStatus),l=he(p=>p.setWsSend),o=V.useRef(null),s=V.useRef(1e3),u=V.useRef(null),f=V.useRef(null),d=V.useRef(()=>{}),h=V.useCallback(()=>{i("reconnecting"),u.current=setTimeout(()=>{s.current=Math.min(s.current*2,t6),d.current()},s.current)},[i]),m=V.useCallback(()=>{i("connecting"),f.current&&f.current.abort();const p=new AbortController;f.current=p,fetch("/api/state",{signal:p.signal}).then(y=>y.json()).then(y=>{y&&y.length>0&&n(y);const w=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;try{const k=new WebSocket(w);o.current=k,k.onopen=()=>{s.current=1e3,i("connected"),l(S=>{k.readyState===WebSocket.OPEN&&k.send(JSON.stringify(S))})},k.onmessage=S=>{try{const _=JSON.parse(S.data);e(_)}catch(_){console.error("Failed to parse WebSocket message:",_)}},k.onclose=()=>{i("disconnected"),l(null),o.current=null,h()},k.onerror=()=>{}}catch{h()}}).catch(y=>{p.signal.aborted||(console.error("Failed to fetch state:",y),h())})},[e,n,i,l,h]);d.current=m,V.useEffect(()=>(m(),()=>{f.current&&f.current.abort(),u.current&&clearTimeout(u.current),o.current&&o.current.close(),l(null)}),[m,l])}function r6(){const e=he(h=>h.setReplayMode),n=he(h=>h.setWsStatus),i=he(h=>h.replayPlaying),l=he(h=>h.replayPosition),o=he(h=>h.replayTotalEvents),s=he(h=>h.replaySpeed),u=he(h=>h.replayEvents),f=he(h=>h.setReplayPosition);V.useEffect(()=>{n("connecting"),fetch("/api/state").then(h=>h.json()).then(h=>{e(h),n("connected")}).catch(h=>{console.error("Failed to load replay events:",h),n("disconnected")})},[e,n]);const d=V.useRef(null);V.useEffect(()=>{if(!i||l>=o){d.current&&clearTimeout(d.current),i&&l>=o&&he.getState().setReplayPlaying(!1);return}const h=u[l-1],m=u[l];let p=100;if(h&&m){const y=(m.timestamp-h.timestamp)*1e3;p=Math.max(16,Math.min(y/s,2e3))}return d.current=setTimeout(()=>{f(l+1)},p),()=>{d.current&&clearTimeout(d.current)}},[i,l,o,s,u,f])}function i6(){return n6(),null}function l6(){return r6(),null}function a6(){const[e,n]=V.useState(null),i=he(s=>s.replayMode),l=he(s=>s.selectNode),o=he(s=>s.workflowName);return V.useEffect(()=>{fetch("/api/replay/info").then(s=>{s.ok?n(!0):n(!1)}).catch(()=>n(!1))},[]),V.useEffect(()=>{document.title=o?`Conductor — ${o}`:"Conductor Dashboard"},[o]),V.useEffect(()=>{const s=u=>{u.key==="Escape"&&l(null)};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[l]),e===null?null:b.jsxs("div",{className:"h-full flex flex-col bg-[var(--bg)]",children:[e?b.jsx(l6,{}):b.jsx(i6,{}),b.jsx(vN,{}),b.jsx(e6,{}),i?b.jsx(EN,{}):b.jsx(wN,{})]})}U2.createRoot(document.getElementById("root")).render(b.jsx(V.StrictMode,{children:b.jsx(a6,{})})); +`}),i}function hb(e){let n=0,i=e.charCodeAt(n);for(;i===9||i===32;)n++,i=e.charCodeAt(n);return e.slice(n)}function pb(e,n){const i=cD(e,n),l=i.one(e,void 0),o=WR(i),s=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return o&&s.children.push({type:"text",value:` +`},o),s}function mD(e,n){return e&&"run"in e?async function(i,l){const o=pb(i,{file:l,...n});await e.run(o,l)}:function(i,l){return pb(i,{file:l,...e||n})}}function mb(e){if(e)throw e}var lp,gb;function gD(){if(gb)return lp;gb=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,i=Object.defineProperty,l=Object.getOwnPropertyDescriptor,o=function(h){return typeof Array.isArray=="function"?Array.isArray(h):n.call(h)==="[object Array]"},s=function(h){if(!h||n.call(h)!=="[object Object]")return!1;var m=e.call(h,"constructor"),p=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!m&&!p)return!1;var y;for(y in h);return typeof y>"u"||e.call(h,y)},u=function(h,m){i&&m.name==="__proto__"?i(h,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):h[m.name]=m.newValue},f=function(h,m){if(m==="__proto__")if(e.call(h,m)){if(l)return l(h,m).value}else return;return h[m]};return lp=function d(){var h,m,p,y,v,w,E=arguments[0],_=1,S=arguments.length,z=!1;for(typeof E=="boolean"&&(z=E,E=arguments[1]||{},_=2),(E==null||typeof E!="object"&&typeof E!="function")&&(E={});_u.length;let d;f&&u.push(o);try{d=e.apply(this,u)}catch(h){const m=h;if(f&&i)throw m;return o(m)}f||(d&&d.then&&typeof d.then=="function"?d.then(s,o):d instanceof Error?o(d):s(d))}function o(u,...f){i||(i=!0,n(u,...f))}function s(u){o(null,u)}}const Zn={basename:bD,dirname:wD,extname:SD,join:_D,sep:"/"};function bD(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Po(e);let i=0,l=-1,o=e.length,s;if(n===void 0||n.length===0||n.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(s){i=o+1;break}}else l<0&&(s=!0,l=o+1);return l<0?"":e.slice(i,l)}if(n===e)return"";let u=-1,f=n.length-1;for(;o--;)if(e.codePointAt(o)===47){if(s){i=o+1;break}}else u<0&&(s=!0,u=o+1),f>-1&&(e.codePointAt(o)===n.codePointAt(f--)?f<0&&(l=o):(f=-1,l=u));return i===l?l=u:l<0&&(l=e.length),e.slice(i,l)}function wD(e){if(Po(e),e.length===0)return".";let n=-1,i=e.length,l;for(;--i;)if(e.codePointAt(i)===47){if(l){n=i;break}}else l||(l=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function SD(e){Po(e);let n=e.length,i=-1,l=0,o=-1,s=0,u;for(;n--;){const f=e.codePointAt(n);if(f===47){if(u){l=n+1;break}continue}i<0&&(u=!0,i=n+1),f===46?o<0?o=n:s!==1&&(s=1):o>-1&&(s=-1)}return o<0||i<0||s===0||s===1&&o===i-1&&o===l+1?"":e.slice(o,i)}function _D(...e){let n=-1,i;for(;++n0&&e.codePointAt(e.length-1)===47&&(i+="/"),n?"/"+i:i}function ND(e,n){let i="",l=0,o=-1,s=0,u=-1,f,d;for(;++u<=e.length;){if(u2){if(d=i.lastIndexOf("/"),d!==i.length-1){d<0?(i="",l=0):(i=i.slice(0,d),l=i.length-1-i.lastIndexOf("/")),o=u,s=0;continue}}else if(i.length>0){i="",l=0,o=u,s=0;continue}}n&&(i=i.length>0?i+"/..":"..",l=2)}else i.length>0?i+="/"+e.slice(o+1,u):i=e.slice(o+1,u),l=u-o-1;o=u,s=0}else f===46&&s>-1?s++:s=-1}return i}function Po(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const kD={cwd:CD};function CD(){return"/"}function Ip(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function TD(e){if(typeof e=="string")e=new URL(e);else if(!Ip(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return zD(e)}function zD(e){if(e.hostname!==""){const l=new TypeError('File URL host must be "localhost" or empty on darwin');throw l.code="ERR_INVALID_FILE_URL_HOST",l}const n=e.pathname;let i=-1;for(;++i0){let[v,...w]=m;const E=l[y][1];Up(E)&&Up(v)&&(v=ap(!0,E,v)),l[y]=[h,v,...w]}}}}const OD=new Cm().freeze();function cp(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function fp(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function dp(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function xb(e){if(!Up(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function vb(e,n,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function Ru(e){return RD(e)?e:new __(e)}function RD(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function DD(e){return typeof e=="string"||LD(e)}function LD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const HD="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",bb=[],wb={allowDangerousHtml:!0},BD=/^(https?|ircs?|mailto|xmpp)$/i,qD=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function E_(e){const n=UD(e),i=ID(e);return VD(n.runSync(n.parse(i),i),e)}function UD(e){const n=e.rehypePlugins||bb,i=e.remarkPlugins||bb,l=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...wb}:wb;return OD().use(bR).use(i).use(mD,l).use(n)}function ID(e){const n=e.children||"",i=new __;return typeof n=="string"&&(i.value=n),i}function VD(e,n){const i=n.allowedElements,l=n.allowElement,o=n.components,s=n.disallowedElements,u=n.skipHtml,f=n.unwrapDisallowed,d=n.urlTransform||YD;for(const m of qD)Object.hasOwn(n,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+HD+m.id,void 0);return S_(e,h),W4(e,{Fragment:b.Fragment,components:o,ignoreInvalidStyle:!0,jsx:b.jsx,jsxs:b.jsxs,passKeys:!0,passNode:!0});function h(m,p,y){if(m.type==="raw"&&y&&typeof p=="number")return u?y.children.splice(p,1):y.children[p]={type:"text",value:m.value},p;if(m.type==="element"){let v;for(v in np)if(Object.hasOwn(np,v)&&Object.hasOwn(m.properties,v)){const w=m.properties[v],E=np[v];(E===null||E.includes(m.tagName))&&(m.properties[v]=d(String(w||""),v,m))}}if(m.type==="element"){let v=i?!i.includes(m.tagName):s?s.includes(m.tagName):!1;if(!v&&l&&typeof p=="number"&&(v=!l(m,p,y)),v&&y&&typeof p=="number")return f&&m.children?y.children.splice(p,1,...m.children):y.children.splice(p,1),p}}}function YD(e){const n=e.indexOf(":"),i=e.indexOf("?"),l=e.indexOf("#"),o=e.indexOf("/");return n===-1||o!==-1&&n>o||i!==-1&&n>i||l!==-1&&n>l||BD.test(e.slice(0,n))?e:""}const GD=new Set([".md",".markdown",".mdx"]);function $D({filePath:e,onClose:n}){const[i,l]=V.useState(null),[o,s]=V.useState(null),[u,f]=V.useState(!0),d=V.useCallback(async()=>{f(!0),s(null);try{const m=e.split("/").map(v=>encodeURIComponent(v)).join("/"),p=await fetch(`/api/files/${m}`);if(!p.ok){const v=await p.json().catch(()=>({}));s(v.error||`HTTP ${p.status}`);return}const y=await p.json();l(y)}catch(m){s(m instanceof Error?m.message:"Failed to load file")}finally{f(!1)}},[e]);V.useEffect(()=>{d()},[d]),V.useEffect(()=>{const m=p=>{p.key==="Escape"&&n()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[n]);const h=i?GD.has(i.extension):!1;return b.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:b.jsxs("div",{className:"relative flex flex-col w-[90vw] max-w-3xl max-h-[80vh] rounded-xl border border-[var(--border)] bg-[var(--surface)] shadow-2xl overflow-hidden",children:[b.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b border-[var(--border)] bg-[var(--surface-raised)] flex-shrink-0",children:[b.jsx(Tb,{className:"w-4 h-4 text-[var(--text-muted)] flex-shrink-0"}),b.jsx("span",{className:"text-xs font-medium text-[var(--text)] truncate flex-1",title:e,children:e}),i&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] flex-shrink-0 tabular-nums",children:FD(i.size)}),b.jsx("button",{onClick:n,className:"p-1 rounded-md text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--surface-hover)] transition-colors flex-shrink-0",title:"Close (Esc)",children:b.jsx(aa,{className:"w-4 h-4"})})]}),b.jsxs("div",{className:"flex-1 overflow-auto px-5 py-4 min-h-0",children:[u&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(Zl,{className:"w-5 h-5 text-[var(--text-muted)] animate-spin"})}),o&&b.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-red-500/10 border border-red-500/30",children:[b.jsx(Ab,{className:"w-4 h-4 text-red-400 flex-shrink-0"}),b.jsx("span",{className:"text-xs text-red-300",children:o})]}),i&&!o&&(h?b.jsx("div",{className:"file-viewer-markdown text-xs leading-relaxed text-[var(--text)]",children:b.jsx(XD,{content:i.content})}):b.jsx("pre",{className:"font-mono text-[11px] leading-[1.6] text-[var(--text)] whitespace-pre-wrap break-words",children:i.content}))]})]})})}function XD({content:e}){return b.jsx(E_,{components:{h1:({children:n})=>b.jsx("h1",{className:"text-base font-bold mb-3 mt-2 text-[var(--text)]",children:n}),h2:({children:n})=>b.jsx("h2",{className:"text-sm font-bold mb-2 mt-3 text-[var(--text)]",children:n}),h3:({children:n})=>b.jsx("h3",{className:"text-xs font-bold mb-1.5 mt-2 text-[var(--text)]",children:n}),p:({children:n})=>b.jsx("p",{className:"mb-2 last:mb-0",children:n}),ul:({children:n})=>b.jsx("ul",{className:"list-disc list-inside mb-2 space-y-1 ml-2",children:n}),ol:({children:n})=>b.jsx("ol",{className:"list-decimal list-inside mb-2 space-y-1 ml-2",children:n}),li:({children:n})=>b.jsx("li",{children:n}),code:({children:n,className:i})=>(i==null?void 0:i.includes("language-"))?b.jsx("code",{className:"block bg-[var(--bg)] border border-[var(--border)] rounded px-3 py-2 font-mono text-[11px] my-2 overflow-x-auto whitespace-pre",children:n}):b.jsx("code",{className:"bg-[var(--bg)] border border-[var(--border)] rounded px-1 py-0.5 font-mono text-[11px]",children:n}),pre:({children:n})=>b.jsx("pre",{className:"bg-[var(--bg)] border border-[var(--border)] rounded-md px-3 py-2.5 font-mono text-[11px] my-2 overflow-x-auto",children:n}),strong:({children:n})=>b.jsx("strong",{className:"font-semibold",children:n}),em:({children:n})=>b.jsx("em",{className:"italic",children:n}),a:({href:n,children:i})=>b.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:text-blue-300 underline underline-offset-2",children:i}),blockquote:({children:n})=>b.jsx("blockquote",{className:"border-l-2 border-[var(--border)] pl-3 my-2 opacity-80",children:n}),hr:()=>b.jsx("hr",{className:"border-[var(--border)] my-3"}),table:({children:n})=>b.jsx("div",{className:"overflow-x-auto my-2",children:b.jsx("table",{className:"text-[11px] border-collapse w-full",children:n})}),th:({children:n})=>b.jsx("th",{className:"border border-[var(--border)] px-2 py-1 text-left bg-[var(--bg)] font-semibold",children:n}),td:({children:n})=>b.jsx("td",{className:"border border-[var(--border)] px-2 py-1",children:n})},children:e})}function FD(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function PD({node:e}){const n=he(M=>M.sendGateResponse),i=he(M=>M.wsStatus),[l,o]=V.useState(null),[s,u]=V.useState(""),[f,d]=V.useState(null),[h,m]=V.useState(!1),[p,y]=V.useState(null),v=e.status==="waiting",w=e.status==="completed";V.useEffect(()=>{v&&(o(null),u(""),d(null),m(!1))},[v]);const E=v&&i==="connected"&&l===null,_=(M,T)=>{if(E){if(T){o(M),d(T);return}o(M),m(!0),n(e.name,M)}},S=()=>{if(l===null||f===null)return;const M={[f]:s};m(!0),n(e.name,l,M),d(null)},z=e.option_details,k=z==null?void 0:z.find(M=>M.value===e.selected_option),A=(k==null?void 0:k.label)||e.selected_option;return b.jsxs("div",{className:"space-y-3",children:[v&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 rounded-lg bg-amber-500/10 border border-amber-500/30",children:[b.jsxs("span",{className:"relative flex h-2.5 w-2.5 flex-shrink-0",children:[b.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-amber-400 opacity-75"}),b.jsx("span",{className:"relative inline-flex rounded-full h-2.5 w-2.5 bg-amber-500"})]}),b.jsx("span",{className:"text-xs font-semibold text-amber-400 tracking-wide",children:"Decision Required"})]}),e.prompt&&b.jsx("div",{className:"border-l-2 border-amber-500/50 pl-3 py-0.5",children:b.jsx(hp,{text:e.prompt,muted:!1,onFileClick:y})}),z&&z.length>0&&b.jsxs("div",{className:"space-y-2",children:[b.jsx("div",{className:"flex flex-col gap-1.5",children:z.map(M=>{const T=l===M.value,q=l!==null&&!T;return b.jsx("button",{disabled:!E&&!T,onClick:()=>_(M.value,M.prompt_for),className:`w-full text-left px-3 py-2.5 rounded-lg border transition-all duration-150 ${T?"border-green-500/60 bg-green-500/10":q?"border-[var(--border)] opacity-40 cursor-default":"border-[var(--border)] bg-[var(--surface)] hover:border-amber-400/60 hover:bg-amber-500/5 cursor-pointer group"}`,children:b.jsxs("div",{className:"flex items-center gap-2.5",children:[b.jsx("div",{className:"flex-shrink-0",children:T?b.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500 flex items-center justify-center",children:b.jsx(Bi,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}):b.jsx("div",{className:`w-4 h-4 rounded-full border-2 transition-colors ${q?"border-[var(--border)]":"border-[var(--border)] group-hover:border-amber-400"}`})}),b.jsx("div",{className:"flex-1 min-w-0",children:b.jsx("span",{className:`text-xs font-medium ${T?"text-green-400":"text-[var(--text)]"}`,children:M.label})}),M.route&&b.jsxs("span",{className:"text-[10px] text-[var(--text-muted)] flex-shrink-0",children:["→ ",M.route]})]})},M.value)})}),h&&!f&&b.jsxs("div",{className:"flex items-center gap-2 px-1",children:[b.jsx(Zl,{className:"w-3 h-3 text-green-400 animate-spin"}),b.jsx("span",{className:"text-[10px] text-green-400",children:"Sending..."})]}),E&&b.jsx("p",{className:"text-[10px] text-[var(--text-muted)] px-1",children:"Select an option to continue the workflow"})]}),!z&&e.options&&e.options.length>0&&b.jsxs("div",{className:"space-y-1.5",children:[b.jsx("h4",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)] font-semibold",children:"Options"}),b.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.options.map(M=>b.jsx("span",{className:"text-[11px] px-2 py-0.5 rounded border border-[var(--border)] text-[var(--text-muted)]",children:M},M))})]}),f&&b.jsxs("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--bg)] overflow-hidden",children:[b.jsx("div",{className:"px-3 py-2 border-b border-[var(--border)] bg-[var(--surface)]",children:b.jsx("h4",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)] font-semibold",children:f})}),b.jsxs("div",{className:"p-3 space-y-2",children:[b.jsx("input",{type:"text",value:s,onChange:M=>u(M.target.value),onKeyDown:M=>M.key==="Enter"&&S(),placeholder:`Enter ${f}...`,className:"w-full text-xs px-3 py-2 rounded-lg border border-[var(--border)] bg-[var(--bg)] text-[var(--text)] outline-none focus:border-amber-400 transition-colors",autoFocus:!0}),b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:"Press Enter or click Submit"}),b.jsxs("button",{onClick:S,className:"flex items-center gap-1.5 text-xs px-3 py-1.5 rounded-lg bg-amber-500 text-white hover:bg-amber-600 transition-colors font-medium",children:[b.jsx(sN,{className:"w-3 h-3"}),"Submit"]})]})]})]})]}),w&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 rounded-lg bg-green-500/10 border border-green-500/30",children:[b.jsx(Bi,{className:"w-3.5 h-3.5 text-green-400 flex-shrink-0"}),b.jsx("span",{className:"text-xs font-semibold text-green-400 tracking-wide",children:"Decision Completed"})]}),e.prompt&&b.jsx("div",{className:"border-l-2 border-[var(--border)] pl-3 py-0.5",children:b.jsx(hp,{text:e.prompt,muted:!0,onFileClick:y})}),A&&b.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-green-500/30 bg-green-500/5",children:[b.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500 flex items-center justify-center flex-shrink-0",children:b.jsx(Bi,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),b.jsx("span",{className:"text-xs font-medium text-[var(--text)]",children:A}),e.route&&b.jsxs("span",{className:"ml-auto text-[10px] text-[var(--text-muted)]",children:["→ ",e.route]})]}),z&&z.length>1&&b.jsx("div",{className:"space-y-1",children:z.filter(M=>M.value!==e.selected_option).map(M=>b.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 rounded-lg opacity-35",children:[b.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[var(--border)] flex-shrink-0"}),b.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:M.label}),M.route&&b.jsxs("span",{className:"ml-auto text-[10px] text-[var(--text-muted)]",children:["→ ",M.route]})]},M.value))}),!z&&e.options&&e.options.length>0&&b.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.options.map(M=>b.jsxs("span",{className:`text-[11px] px-2.5 py-1 rounded-lg border ${M===e.selected_option?"border-green-500/30 text-green-400 bg-green-500/5":"border-[var(--border)] text-[var(--text-muted)] opacity-40"}`,children:[M===e.selected_option&&"✓ ",M]},M))}),b.jsx(ZD,{node:e})]}),!v&&!w&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Human Gate"}),b.jsxs("span",{className:"text-[10px] text-[var(--text-muted)] capitalize",children:["(",e.status,")"]})]}),e.prompt&&b.jsx("div",{className:"border-l-2 border-[var(--border)] pl-3 py-0.5",children:b.jsx(hp,{text:e.prompt,muted:!0,onFileClick:y})})]}),p&&b.jsx($D,{filePath:p,onClose:()=>y(null)})]})}function QD(e){return!(!e||/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//")||e.startsWith("#")||e.startsWith("/")||e.startsWith("\\"))}function hp({text:e,muted:n,onFileClick:i}){const l=n?"text-[var(--text-muted)]":"text-[var(--text)]";return b.jsx("div",{className:`gate-markdown text-xs leading-relaxed ${l}`,children:b.jsx(E_,{components:{h1:({children:o})=>b.jsx("h1",{className:"text-sm font-bold mb-2 mt-1",children:o}),h2:({children:o})=>b.jsx("h2",{className:"text-xs font-bold mb-1.5 mt-1",children:o}),h3:({children:o})=>b.jsx("h3",{className:"text-xs font-semibold mb-1 mt-1",children:o}),p:({children:o})=>b.jsx("p",{className:"mb-1.5 last:mb-0",children:o}),ul:({children:o})=>b.jsx("ul",{className:"list-disc list-inside mb-1.5 space-y-0.5",children:o}),ol:({children:o})=>b.jsx("ol",{className:"list-decimal list-inside mb-1.5 space-y-0.5",children:o}),li:({children:o})=>b.jsx("li",{children:o}),code:({children:o,className:s})=>(s==null?void 0:s.includes("language-"))?b.jsx("code",{className:"block bg-[var(--bg)] border border-[var(--border)] rounded px-2 py-1.5 font-mono text-[11px] my-1 overflow-x-auto whitespace-pre",children:o}):b.jsx("code",{className:"bg-[var(--bg)] border border-[var(--border)] rounded px-1 py-0.5 font-mono text-[11px]",children:o}),pre:({children:o})=>b.jsx("pre",{className:"bg-[var(--bg)] border border-[var(--border)] rounded-md px-2.5 py-2 font-mono text-[11px] my-1.5 overflow-x-auto",children:o}),strong:({children:o})=>b.jsx("strong",{className:"font-semibold",children:o}),em:({children:o})=>b.jsx("em",{className:"italic",children:o}),a:({href:o,children:s})=>i&&QD(o)?b.jsxs("button",{onClick:u=>{u.preventDefault(),i(o)},className:"inline-flex items-center gap-0.5 text-blue-400 hover:text-blue-300 underline underline-offset-2 cursor-pointer",title:`Open ${o}`,children:[b.jsx(Tb,{className:"w-3 h-3 inline flex-shrink-0"}),s]}):b.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:text-blue-300 underline underline-offset-2",children:s}),blockquote:({children:o})=>b.jsx("blockquote",{className:"border-l-2 border-[var(--border)] pl-2.5 my-1.5 opacity-80",children:o}),hr:()=>b.jsx("hr",{className:"border-[var(--border)] my-2"})},children:e})})}function ZD({node:e}){const n=[];if(e.route&&n.push({label:"Route",value:`→ ${e.route}`}),e.additional_input){const i=typeof e.additional_input=="object"?JSON.stringify(e.additional_input):e.additional_input;n.push({label:"Additional Input",value:i})}return n.length===0?null:b.jsx(oa,{items:n})}function KD({node:e}){const n=e.status,i=lt[n]||lt.pending,o=he(m=>m.groupProgress)[e.name],s=e.type==="for_each_group",[u,f]=V.useState(!0),d=[];e.elapsed!=null&&d.push({label:"Elapsed",value:ln(e.elapsed)}),o&&(d.push({label:"Total",value:o.total}),d.push({label:"Completed",value:o.completed}),o.failed>0&&d.push({label:"Failed",value:o.failed})),e.success_count!=null&&d.push({label:"Success",value:e.success_count}),e.failure_count!=null&&d.push({label:"Failures",value:e.failure_count});const h=e.for_each_items;return b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-[10px] font-bold uppercase tracking-wider",style:{backgroundColor:`${i}20`,color:i},children:n}),b.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s?"For-Each Group":"Parallel Group"})]}),o&&o.total>0&&b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex justify-between text-[10px] text-[var(--text-muted)]",children:[b.jsx("span",{children:"Progress"}),b.jsxs("span",{children:[o.completed+o.failed,"/",o.total]})]}),b.jsx("div",{className:"h-1.5 bg-[var(--bg)] rounded-full overflow-hidden",children:b.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${(o.completed+o.failed)/o.total*100}%`,background:o.failed>0?`linear-gradient(90deg, var(--completed) ${o.completed/(o.completed+o.failed)*100}%, var(--failed) 0%)`:"var(--completed)"}})})]}),b.jsx(oa,{items:d}),s&&h&&h.length>0&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("button",{onClick:()=>f(!u),className:"flex items-center gap-1.5 text-[10px] uppercase tracking-wider text-[var(--text-muted)] font-semibold hover:text-[var(--text)] transition-colors",children:[u?b.jsx(Pi,{className:"w-3 h-3"}):b.jsx(la,{className:"w-3 h-3"}),"Items (",h.length,")"]}),u&&b.jsx("div",{className:"space-y-1",children:h.map(m=>b.jsx(WD,{item:m},`${m.key}-${m.index}`))})]})]})}const JD={running:lt.running,completed:lt.completed,failed:lt.failed};function WD({item:e}){const[n,i]=V.useState(e.status==="running"),l=JD[e.status],o=!!(e.prompt||e.output!=null||e.activity&&e.activity.length>0||e.error_type),s=[];return e.elapsed!=null&&s.push({label:"Elapsed",value:ln(e.elapsed)}),e.tokens!=null&&s.push({label:"Tokens",value:Wn(e.tokens)}),e.cost_usd!=null&&s.push({label:"Cost",value:Kl(e.cost_usd)}),b.jsxs("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--surface)] overflow-hidden",children:[b.jsxs("button",{onClick:()=>o&&i(!n),className:"flex items-center gap-2 w-full px-3 py-2 text-left hover:bg-[var(--node-bg)] transition-colors",disabled:!o,children:[o?n?b.jsx(Pi,{className:"w-3 h-3 text-[var(--text-muted)] flex-shrink-0"}):b.jsx(la,{className:"w-3 h-3 text-[var(--text-muted)] flex-shrink-0"}):e.status==="running"?b.jsx(Zl,{className:"w-3 h-3 animate-spin flex-shrink-0",style:{color:l}}):b.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0 ml-0.5 mr-0.5",style:{backgroundColor:l}}),b.jsx("span",{className:"text-xs font-medium text-[var(--text)] truncate flex-1 min-w-0",children:e.key}),!n&&(e.elapsed!=null||e.tokens!=null||e.cost_usd!=null)&&b.jsxs("span",{className:"flex items-center gap-2 text-[10px] text-[var(--text-muted)] flex-shrink-0",children:[e.elapsed!=null&&b.jsx("span",{children:ln(e.elapsed)}),e.tokens!=null&&b.jsx("span",{children:Wn(e.tokens)}),e.cost_usd!=null&&b.jsx("span",{children:Kl(e.cost_usd)})]}),b.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider flex-shrink-0 px-1.5 py-0.5 rounded",style:{backgroundColor:`${l}20`,color:l},children:e.status})]}),n&&o&&b.jsxs("div",{className:"px-3 py-3 space-y-3 border-t border-[var(--border)]",children:[s.length>0&&b.jsx(oa,{items:s}),e.prompt&&b.jsx(Fi,{output:e.prompt,title:"Input / Prompt",defaultExpanded:!1}),e.activity&&e.activity.length>0&&b.jsx(hm,{activity:e.activity,defaultExpanded:e.status!=="completed"}),e.output!=null&&b.jsx(Fi,{output:e.output,title:"Output",defaultExpanded:!0}),e.status==="failed"&&(e.error_type||e.error_message)&&b.jsxs("div",{className:"text-xs text-red-400",children:[e.error_type&&b.jsx("span",{className:"font-semibold",children:e.error_type}),e.error_message&&b.jsxs("span",{className:"ml-1",children:["— ",e.error_message]})]})]})]})}function e6(){const e=he(f=>f.selectedNode),n=he(f=>f.nodes),i=he(f=>f.selectNode),[l,o]=V.useState(!1);V.useEffect(()=>(requestAnimationFrame(()=>o(!0)),()=>o(!1)),[e]);const s=e?n[e]:null;if(!e||!s)return b.jsxs("div",{className:"h-full flex flex-col bg-[var(--surface)]",children:[b.jsx("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:b.jsx("h2",{className:"text-sm font-semibold text-[var(--text)]",children:"Detail"})}),b.jsx("div",{className:"flex-1 flex items-center justify-center",children:b.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Click a node to view details"})})]});const u=(()=>{switch(s.type){case"script":return E4;case"human_gate":return PD;case"parallel_group":case"for_each_group":return KD;default:return S4}})();return b.jsxs("div",{className:Ye("h-full flex flex-col bg-[var(--surface)] transition-all duration-150 ease-out",l?"translate-x-0 opacity-100":"translate-x-4 opacity-0"),children:[b.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)] flex-shrink-0",children:[b.jsx("h2",{className:"text-sm font-semibold text-[var(--text)] truncate",children:e}),b.jsx("button",{onClick:()=>i(null),className:"p-1 rounded hover:bg-[var(--surface-hover)] text-[var(--text-muted)] hover:text-[var(--text)] transition-colors",title:"Close panel",children:b.jsx(aa,{className:"w-4 h-4"})})]}),b.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3",children:b.jsx(u,{node:s})})]})}function Yu(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function t6(){const e=he(_=>_.eventLog),n=he(_=>_.activityLog),i=he(_=>_.workflowOutput),l=he(_=>_.workflowStatus),[o,s]=V.useState("log"),[u,f]=V.useState(!1),[d,h]=V.useState(0),[m,p]=V.useState(0),y=V.useCallback(_=>{s(_),_==="log"&&h(e.length),_==="activity"&&p(n.length)},[e.length,n.length]);V.useEffect(()=>{o==="log"&&h(e.length)},[o,e.length]),V.useEffect(()=>{o==="activity"&&p(n.length)},[o,n.length]),V.useEffect(()=>{l==="completed"&&i!=null&&s("output")},[l,i]);const v=i!=null,w=o!=="log"?Math.max(0,e.length-d):0,E=o!=="activity"?Math.max(0,n.length-m):0;return u?b.jsx("div",{className:"flex items-center bg-[var(--surface)] border-t border-[var(--border)] px-3 py-1",children:b.jsxs("button",{onClick:()=>f(!1),className:"flex items-center gap-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)] transition-colors",children:[b.jsx(P2,{className:"w-3 h-3"}),b.jsx(bx,{className:"w-3 h-3"}),b.jsx("span",{children:"Output"}),n.length>0&&b.jsxs("span",{className:"text-[10px] text-[var(--text-muted)]",children:["(",n.length,")"]})]})}):b.jsxs("div",{className:"flex flex-col h-full bg-[var(--surface)] border-t border-[var(--border)]",children:[b.jsxs("div",{className:"flex items-center justify-between px-2 flex-shrink-0 border-b border-[var(--border)]",children:[b.jsxs("div",{className:"flex items-center gap-0.5",children:[b.jsx(pp,{active:o==="log",onClick:()=>y("log"),icon:b.jsx(bx,{className:"w-3 h-3"}),label:"Log",count:e.length,unread:w}),b.jsx(pp,{active:o==="activity",onClick:()=>y("activity"),icon:b.jsx(kb,{className:"w-3 h-3"}),label:"Activity",count:n.length,unread:E}),b.jsx(pp,{active:o==="output",onClick:()=>y("output"),icon:b.jsx(tN,{className:"w-3 h-3"}),label:"Output",badge:v?l==="failed"?"error":"success":void 0})]}),b.jsx("button",{onClick:()=>f(!0),className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--surface-hover)] transition-colors",title:"Collapse panel",children:b.jsx(Pi,{className:"w-3.5 h-3.5"})})]}),b.jsx("div",{className:"flex-1 overflow-hidden",children:o==="activity"?b.jsx(n6,{entries:n}):o==="log"?b.jsx(r6,{entries:e}):b.jsx(i6,{output:i,status:l})})]})}function pp({active:e,onClick:n,icon:i,label:l,count:o,badge:s,unread:u}){return b.jsxs("button",{onClick:n,className:Ye("relative flex items-center gap-1.5 px-3 py-1.5 text-xs transition-colors border-b-2 -mb-px",e?"text-[var(--text)] border-[var(--accent)]":"text-[var(--text-muted)] border-transparent hover:text-[var(--text-secondary)]"),children:[i,b.jsx("span",{children:l}),o!=null&&o>0&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] tabular-nums",children:o}),s&&b.jsx("span",{className:Ye("w-1.5 h-1.5 rounded-full",s==="success"?"bg-[var(--completed)]":"bg-[var(--failed)]")}),!e&&u!=null&&u>0&&b.jsx("span",{className:"absolute -top-0.5 -right-0.5 flex h-3.5 min-w-[14px] items-center justify-center rounded-full bg-[var(--accent)] px-1",children:b.jsx("span",{className:"text-[8px] font-bold text-white leading-none tabular-nums",children:u>99?"99+":u})})]})}const Sb={reasoning:{color:"text-indigo-400/70",label:"THINK",labelColor:"text-indigo-500"},"tool-start":{color:"text-blue-400",label:"TOOL →",labelColor:"text-blue-500"},"tool-complete":{color:"text-green-400",label:"TOOL ←",labelColor:"text-green-600"},turn:{color:"text-amber-400",label:"STEP",labelColor:"text-amber-500"},message:{color:"text-[var(--text)]",label:"MSG",labelColor:"text-[var(--text-muted)]"},prompt:{color:"text-cyan-400/70",label:"PROMPT",labelColor:"text-cyan-600"}};function n6({entries:e}){const n=V.useRef(null),i=V.useRef(!0),l=he(d=>d.selectNode),[o,s]=V.useState(""),u=V.useCallback(()=>{const d=n.current;if(!d)return;const h=d.scrollHeight-d.scrollTop-d.clientHeight<30;i.current=h},[]),f=V.useMemo(()=>{if(!o)return e;const d=o.toLowerCase();return e.filter(h=>h.source.toLowerCase().includes(d)||Yu(h.message).toLowerCase().includes(d))},[e,o]);return V.useEffect(()=>{n.current&&i.current&&(n.current.scrollTop=n.current.scrollHeight)},[f.length]),e.length===0?b.jsx("div",{className:"h-full flex items-center justify-center",children:b.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Waiting for agent activity…"})}):b.jsxs("div",{className:"h-full flex flex-col",children:[b.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-[var(--border-subtle)] flex-shrink-0",children:[b.jsx(oN,{className:"w-3 h-3 text-[var(--text-muted)] flex-shrink-0"}),b.jsx("input",{type:"text",value:o,onChange:d=>s(d.target.value),placeholder:"Filter by agent or message…",className:"flex-1 bg-transparent text-[11px] text-[var(--text)] placeholder:text-[var(--text-muted)] outline-none min-w-0"}),o&&b.jsxs(b.Fragment,{children:[b.jsxs("span",{className:"text-[10px] text-[var(--text-muted)] tabular-nums flex-shrink-0",children:[f.length," of ",e.length]}),b.jsx("button",{onClick:()=>s(""),className:"text-[var(--text-muted)] hover:text-[var(--text)] transition-colors flex-shrink-0",title:"Clear filter",children:b.jsx(aa,{className:"w-3 h-3"})})]})]}),b.jsxs("div",{ref:n,onScroll:u,className:"flex-1 overflow-y-auto font-mono text-[11px] leading-[1.6] px-3 py-2",children:[f.map((d,h)=>{const m=Sb[d.type]||Sb.message,p=N_(d.timestamp);return b.jsxs("div",{className:"group",children:[b.jsxs("div",{className:"flex gap-1.5 hover:bg-[var(--surface-hover)] rounded px-1 -mx-1",children:[b.jsx("span",{className:"text-[var(--text-muted)] flex-shrink-0 select-none tabular-nums",children:p}),b.jsx("span",{className:Ye("flex-shrink-0 w-[5ch] text-[10px] font-semibold tabular-nums select-none",m.labelColor),children:m.label}),b.jsx("button",{onClick:()=>l(d.source),className:"text-[var(--text-secondary)] flex-shrink-0 min-w-[8ch] max-w-[16ch] truncate hover:text-[var(--accent)] hover:underline transition-colors text-left",title:`Select ${d.source}`,children:d.source}),b.jsx("span",{className:Ye("break-words min-w-0",m.color,d.type==="reasoning"&&"italic"),children:Yu(d.message)})]}),d.detail&&b.jsx("div",{className:"ml-[calc(7ch+5ch+8ch+1rem)] px-2 py-1 my-0.5 bg-[var(--bg)] rounded text-[10px] text-[var(--text-muted)] whitespace-pre-wrap break-words max-h-24 overflow-y-auto border-l-2 border-[var(--border)]",children:Yu(d.detail)})]},h)}),o&&f.length===0&&b.jsx("div",{className:"flex items-center justify-center py-4",children:b.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:['No matches for "',o,'"']})})]})]})}const _b={info:{color:"text-blue-400",icon:"›"},success:{color:"text-green-400",icon:"✓"},error:{color:"text-red-400",icon:"✗"},warning:{color:"text-amber-400",icon:"⚠"},debug:{color:"text-[var(--text-muted)]",icon:"·"}};function r6({entries:e}){const n=V.useRef(null),i=V.useRef(!0),l=he(s=>s.selectNode),o=V.useCallback(()=>{const s=n.current;if(!s)return;const u=s.scrollHeight-s.scrollTop-s.clientHeight<30;i.current=u},[]);return V.useEffect(()=>{n.current&&i.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.length]),e.length===0?b.jsx("div",{className:"h-full flex items-center justify-center",children:b.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Waiting for events…"})}):b.jsx("div",{ref:n,onScroll:o,className:"h-full overflow-y-auto font-mono text-[11px] leading-[1.6] px-3 py-2",children:e.map((s,u)=>{const f=_b[s.level]||_b.info,d=N_(s.timestamp);return b.jsxs("div",{className:"flex gap-2 hover:bg-[var(--surface-hover)] rounded px-1 -mx-1",children:[b.jsx("span",{className:"text-[var(--text-muted)] flex-shrink-0 select-none tabular-nums",children:d}),b.jsx("span",{className:Ye("flex-shrink-0 w-3 text-center select-none",f.color),children:f.icon}),b.jsx("button",{onClick:()=>l(s.source),className:"text-[var(--text-secondary)] flex-shrink-0 min-w-[8ch] max-w-[16ch] truncate hover:text-[var(--accent)] hover:underline transition-colors text-left",title:`Select ${s.source}`,children:s.source}),b.jsx("span",{className:Ye("break-words",s.level==="error"?"text-red-400":s.level==="success"?"text-green-400":"text-[var(--text)]"),children:Yu(s.message)})]},u)})})}function N_(e){const n=new Date(e*1e3),i=n.getHours().toString().padStart(2,"0"),l=n.getMinutes().toString().padStart(2,"0"),o=n.getSeconds().toString().padStart(2,"0");return`${i}:${l}:${o}`}function i6({output:e,status:n}){const[i,l]=V.useState(!1),o=Mb(e),s=async()=>{o&&(await navigator.clipboard.writeText(o),l(!0),setTimeout(()=>l(!1),2e3))};return e==null?b.jsx("div",{className:"h-full flex items-center justify-center",children:b.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:n==="running"?"Workflow running — output will appear when complete…":n==="failed"?"Workflow failed — no output produced":"No output yet"})}):b.jsxs("div",{className:"h-full flex flex-col",children:[b.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-b border-[var(--border-subtle)] flex-shrink-0",children:[b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] uppercase tracking-wider font-semibold",children:"Workflow Result"}),b.jsx("button",{onClick:s,className:"flex items-center gap-1 text-[10px] text-[var(--text-muted)] hover:text-[var(--text)] transition-colors px-1.5 py-0.5 rounded hover:bg-[var(--surface-hover)]",title:"Copy to clipboard",children:i?b.jsxs(b.Fragment,{children:[b.jsx(Bi,{className:"w-3 h-3 text-[var(--completed)]"}),b.jsx("span",{className:"text-[var(--completed)]",children:"Copied"})]}):b.jsxs(b.Fragment,{children:[b.jsx(Cb,{className:"w-3 h-3"}),b.jsx("span",{children:"Copy"})]})})]}),b.jsx("div",{className:"flex-1 overflow-auto px-3 py-2",children:b.jsx("pre",{className:"font-mono text-[11px] leading-relaxed text-[var(--text)] whitespace-pre-wrap break-words",children:typeof e=="object"?b.jsx(l6,{text:o}):o})})]})}function l6({text:e}){const n=e.split(/("(?:[^"\\]|\\.)*")/g);return b.jsx(b.Fragment,{children:n.map((i,l)=>{if(l%2===1){const s=n.slice(l+1).join(""),u=/^\s*:/.test(s);return b.jsx("span",{className:u?"text-blue-400":"text-green-400",children:i},l)}const o=i.replace(/\b(true|false|null)\b|(-?\d+\.?\d*(?:e[+-]?\d+)?)/gi,(s,u,f)=>u?`${s}`:f?`${s}`:s);return b.jsx("span",{dangerouslySetInnerHTML:{__html:o}},l)})})}function a6(){const e=he(n=>n.selectedNode);return b.jsxs(gp,{direction:"vertical",className:"flex-1 overflow-hidden",children:[b.jsx(po,{defaultSize:70,minSize:30,children:b.jsxs(gp,{direction:"horizontal",className:"h-full",children:[b.jsx(po,{defaultSize:e?65:100,minSize:40,children:b.jsx(y4,{})}),e&&b.jsxs(b.Fragment,{children:[b.jsx(yp,{className:"w-[3px] bg-[var(--border)] hover:bg-[var(--text-muted)] transition-colors cursor-col-resize"}),b.jsx(po,{defaultSize:35,minSize:20,maxSize:60,children:b.jsx(e6,{})})]})]})}),b.jsx(yp,{className:"h-[3px] bg-[var(--border)] hover:bg-[var(--text-muted)] transition-colors cursor-row-resize"}),b.jsx(po,{defaultSize:30,minSize:5,maxSize:70,collapsible:!0,children:b.jsx(t6,{})})]})}const o6=3e4;function s6(){const e=he(p=>p.processEvent),n=he(p=>p.replayState),i=he(p=>p.setWsStatus),l=he(p=>p.setWsSend),o=V.useRef(null),s=V.useRef(1e3),u=V.useRef(null),f=V.useRef(null),d=V.useRef(()=>{}),h=V.useCallback(()=>{i("reconnecting"),u.current=setTimeout(()=>{s.current=Math.min(s.current*2,o6),d.current()},s.current)},[i]),m=V.useCallback(()=>{i("connecting"),f.current&&f.current.abort();const p=new AbortController;f.current=p,fetch("/api/state",{signal:p.signal}).then(y=>y.json()).then(y=>{y&&y.length>0&&n(y);const w=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;try{const E=new WebSocket(w);o.current=E,E.onopen=()=>{s.current=1e3,i("connected"),l(_=>{E.readyState===WebSocket.OPEN&&E.send(JSON.stringify(_))})},E.onmessage=_=>{try{const S=JSON.parse(_.data);e(S)}catch(S){console.error("Failed to parse WebSocket message:",S)}},E.onclose=()=>{i("disconnected"),l(null),o.current=null,h()},E.onerror=()=>{}}catch{h()}}).catch(y=>{p.signal.aborted||(console.error("Failed to fetch state:",y),h())})},[e,n,i,l,h]);d.current=m,V.useEffect(()=>(m(),()=>{f.current&&f.current.abort(),u.current&&clearTimeout(u.current),o.current&&o.current.close(),l(null)}),[m,l])}function u6(){const e=he(h=>h.setReplayMode),n=he(h=>h.setWsStatus),i=he(h=>h.replayPlaying),l=he(h=>h.replayPosition),o=he(h=>h.replayTotalEvents),s=he(h=>h.replaySpeed),u=he(h=>h.replayEvents),f=he(h=>h.setReplayPosition);V.useEffect(()=>{n("connecting"),fetch("/api/state").then(h=>h.json()).then(h=>{e(h),n("connected")}).catch(h=>{console.error("Failed to load replay events:",h),n("disconnected")})},[e,n]);const d=V.useRef(null);V.useEffect(()=>{if(!i||l>=o){d.current&&clearTimeout(d.current),i&&l>=o&&he.getState().setReplayPlaying(!1);return}const h=u[l-1],m=u[l];let p=100;if(h&&m){const y=(m.timestamp-h.timestamp)*1e3;p=Math.max(16,Math.min(y/s,2e3))}return d.current=setTimeout(()=>{f(l+1)},p),()=>{d.current&&clearTimeout(d.current)}},[i,l,o,s,u,f])}function c6(){return s6(),null}function f6(){return u6(),null}function d6(){const[e,n]=V.useState(null),i=he(s=>s.replayMode),l=he(s=>s.selectNode),o=he(s=>s.workflowName);return V.useEffect(()=>{fetch("/api/replay/info").then(s=>{s.ok?n(!0):n(!1)}).catch(()=>n(!1))},[]),V.useEffect(()=>{document.title=o?`Conductor — ${o}`:"Conductor Dashboard"},[o]),V.useEffect(()=>{const s=u=>{u.key==="Escape"&&l(null)};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[l]),e===null?null:b.jsxs("div",{className:"h-full flex flex-col bg-[var(--bg)]",children:[e?b.jsx(f6,{}):b.jsx(c6,{}),b.jsx(wN,{}),b.jsx(a6,{}),i?b.jsx(kN,{}):b.jsx(_N,{})]})}Y2.createRoot(document.getElementById("root")).render(b.jsx(V.StrictMode,{children:b.jsx(d6,{})})); diff --git a/src/conductor/web/static/assets/index-BEVW8bp2.css b/src/conductor/web/static/assets/index-BEVW8bp2.css new file mode 100644 index 0000000..2d88f75 --- /dev/null +++ b/src/conductor/web/static/assets/index-BEVW8bp2.css @@ -0,0 +1 @@ +/*! tailwindcss v4.2.1 | 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-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;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease: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;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-950:oklch(25.8% .092 26.042);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-950:oklch(26.6% .065 152.934);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-600:oklch(60.9% .126 221.723);--color-sky-400:oklch(74.6% .16 232.661);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-purple-400:oklch(71.4% .203 305.504);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--ease-out:cubic-bezier(0, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0, 0, .2, 1) infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--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)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.-top-0\.5{top:calc(var(--spacing) * -.5)}.top-3{top:calc(var(--spacing) * 3)}.top-full{top:100%}.-right-0\.5{right:calc(var(--spacing) * -.5)}.right-0{right:calc(var(--spacing) * 0)}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-full{bottom:100%}.left-0{left:calc(var(--spacing) * 0)}.left-1\/2{left:50%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.-mx-1{margin-inline:calc(var(--spacing) * -1)}.my-0\.5{margin-block:calc(var(--spacing) * .5)}.my-1{margin-block:calc(var(--spacing) * 1)}.my-1\.5{margin-block:calc(var(--spacing) * 1.5)}.my-2{margin-block:calc(var(--spacing) * 2)}.my-3{margin-block:calc(var(--spacing) * 3)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mr-0\.5{margin-right:calc(var(--spacing) * .5)}.-mb-px{margin-bottom:-1px}.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)}.ml-0\.5{margin-left:calc(var(--spacing) * .5)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-\[4\.25rem\]{margin-left:4.25rem}.ml-\[calc\(7ch\+5ch\+8ch\+1rem\)\]{margin-left:calc(20ch + 1rem)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.\!h-2{height:calc(var(--spacing) * 2)!important}.h-0{height:calc(var(--spacing) * 0)}.h-1{height:calc(var(--spacing) * 1)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-11{height:calc(var(--spacing) * 11)}.h-\[2px\]{height:2px}.h-\[3px\]{height:3px}.h-\[90\%\]{height:90%}.h-full{height:100%}.h-px{height:1px}.max-h-24{max-height:calc(var(--spacing) * 24)}.max-h-\[80vh\]{max-height:80vh}.max-h-\[400px\]{max-height:400px}.min-h-0{min-height:calc(var(--spacing) * 0)}.\!w-2{width:calc(var(--spacing) * 2)!important}.w-0{width:calc(var(--spacing) * 0)}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-8{width:calc(var(--spacing) * 8)}.w-11{width:calc(var(--spacing) * 11)}.w-12{width:calc(var(--spacing) * 12)}.w-\[3px\]{width:3px}.w-\[5ch\]{width:5ch}.w-\[80\%\]{width:80%}.w-\[90vw\]{width:90vw}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[16ch\]{max-width:16ch}.max-w-\[140px\]{max-width:140px}.max-w-\[220px\]{max-width:220px}.max-w-\[260px\]{max-width:260px}.max-w-\[560px\]{max-width:560px}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-\[8ch\]{min-width:8ch}.min-w-\[14px\]{min-width:14px}.min-w-\[140px\]{min-width:140px}.min-w-\[180px\]{min-width:180px}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-0{--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-4{--tw-translate-x:calc(var(--spacing) * 4);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-\[banner-in_200ms_ease-out\]{animation:.2s ease-out banner-in}.animate-\[context-pulse_2s_ease-in-out_infinite\]{animation:2s ease-in-out infinite context-pulse}.animate-\[tooltip-in_150ms_ease-out\]{animation:.15s ease-out tooltip-in}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-col-resize{cursor:col-resize}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.cursor-row-resize{cursor:row-resize}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-\[auto_1fr\]{grid-template-columns:auto 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-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-y-0\.5{row-gap:calc(var(--spacing) * .5)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t-lg{border-top-left-radius:var(--radius-lg);border-top-right-radius:var(--radius-lg)}.rounded-b-lg{border-bottom-right-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-x-\[6px\]{border-inline-style:var(--tw-border-style);border-inline-width:6px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-\[6px\]{border-top-style:var(--tw-border-style);border-top-width:6px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.\!border-none{--tw-border-style:none!important;border-style:none!important}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-\[var\(--accent\)\]{border-color:var(--accent)}.border-\[var\(--border\)\]{border-color:var(--border)}.border-\[var\(--border-subtle\)\]{border-color:var(--border-subtle)}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500) 30%,transparent)}}.border-amber-500\/50{border-color:#f99c0080}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/50{border-color:color-mix(in oklab,var(--color-amber-500) 50%,transparent)}}.border-emerald-500\/20{border-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/20{border-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab,red,red)){.border-green-500\/30{border-color:color-mix(in oklab,var(--color-green-500) 30%,transparent)}}.border-green-500\/40{border-color:#00c75866}@supports (color:color-mix(in lab,red,red)){.border-green-500\/40{border-color:color-mix(in oklab,var(--color-green-500) 40%,transparent)}}.border-green-500\/60{border-color:#00c75899}@supports (color:color-mix(in lab,red,red)){.border-green-500\/60{border-color:color-mix(in oklab,var(--color-green-500) 60%,transparent)}}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500) 30%,transparent)}}.border-red-500\/40{border-color:#fb2c3666}@supports (color:color-mix(in lab,red,red)){.border-red-500\/40{border-color:color-mix(in oklab,var(--color-red-500) 40%,transparent)}}.border-transparent{border-color:#0000}.border-x-transparent{border-inline-color:#0000}.border-t-\[var\(--border\)\]{border-top-color:var(--border)}.\!bg-\[var\(--border\)\]{background-color:var(--border)!important}.bg-\[var\(--accent\)\]{background-color:var(--accent)}.bg-\[var\(--bg\)\]{background-color:var(--bg)}.bg-\[var\(--border\)\]{background-color:var(--border)}.bg-\[var\(--completed\)\]{background-color:var(--completed)}.bg-\[var\(--failed\)\]{background-color:var(--failed)}.bg-\[var\(--node-bg\)\]{background-color:var(--node-bg)}.bg-\[var\(--pending\)\]{background-color:var(--pending)}.bg-\[var\(--running\)\]{background-color:var(--running)}.bg-\[var\(--surface\)\],.bg-\[var\(--surface\)\]\/80{background-color:var(--surface)}@supports (color:color-mix(in lab,red,red)){.bg-\[var\(--surface\)\]\/80{background-color:color-mix(in oklab,var(--surface) 80%,transparent)}}.bg-\[var\(--surface-hover\)\]{background-color:var(--surface-hover)}.bg-\[var\(--surface-raised\)\]{background-color:var(--surface-raised)}.bg-amber-400{background-color:var(--color-amber-400)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500) 10%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/5{background-color:#00c7580d}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/5{background-color:color-mix(in oklab,var(--color-green-500) 5%,transparent)}}.bg-green-500\/10{background-color:#00c7581a}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/10{background-color:color-mix(in oklab,var(--color-green-500) 10%,transparent)}}.bg-green-950\/90{background-color:#032e15e6}@supports (color:color-mix(in lab,red,red)){.bg-green-950\/90{background-color:color-mix(in oklab,var(--color-green-950) 90%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.bg-red-950\/50{background-color:#46080980}@supports (color:color-mix(in lab,red,red)){.bg-red-950\/50{background-color:color-mix(in oklab,var(--color-red-950) 50%,transparent)}}.bg-red-950\/90{background-color:#460809e6}@supports (color:color-mix(in lab,red,red)){.bg-red-950\/90{background-color:color-mix(in oklab,var(--color-red-950) 90%,transparent)}}.bg-transparent{background-color:#0000}.p-0{padding:calc(var(--spacing) * 0)}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:calc(var(--spacing) * 1)}.p-3{padding:calc(var(--spacing) * 3)}.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)}.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-12{padding-block:calc(var(--spacing) * 12)}.pt-px{padding-top:1px}.pl-2\.5{padding-left:calc(var(--spacing) * 2.5)}.pl-3{padding-left:calc(var(--spacing) * 3)}.text-center{text-align:center}.text-left{text-align:left}.font-mono{font-family:var(--font-mono)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[13px\]{font-size:13px}.leading-6{--tw-leading:calc(var(--spacing) * 6);line-height:calc(var(--spacing) * 6)}.leading-\[1\.6\]{--tw-leading:1.6;line-height:1.6}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.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-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.break-words{overflow-wrap:break-word}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[var\(--accent\)\]{color:var(--accent)}.text-\[var\(--completed\)\]{color:var(--completed)}.text-\[var\(--failed\)\]{color:var(--failed)}.text-\[var\(--running\)\]{color:var(--running)}.text-\[var\(--text\)\]{color:var(--text)}.text-\[var\(--text-muted\)\]{color:var(--text-muted)}.text-\[var\(--text-secondary\)\]{color:var(--text-secondary)}.text-\[var\(--waiting\)\]{color:var(--waiting)}.text-amber-400{color:var(--color-amber-400)}.text-amber-500{color:var(--color-amber-500)}.text-blue-400{color:var(--color-blue-400)}.text-blue-500{color:var(--color-blue-500)}.text-cyan-400\/70{color:#00d2efb3}@supports (color:color-mix(in lab,red,red)){.text-cyan-400\/70{color:color-mix(in oklab,var(--color-cyan-400) 70%,transparent)}}.text-cyan-600{color:var(--color-cyan-600)}.text-emerald-400{color:var(--color-emerald-400)}.text-emerald-500\/70{color:#00bb7fb3}@supports (color:color-mix(in lab,red,red)){.text-emerald-500\/70{color:color-mix(in oklab,var(--color-emerald-500) 70%,transparent)}}.text-green-300{color:var(--color-green-300)}.text-green-400{color:var(--color-green-400)}.text-green-400\/80{color:#05df72cc}@supports (color:color-mix(in lab,red,red)){.text-green-400\/80{color:color-mix(in oklab,var(--color-green-400) 80%,transparent)}}.text-green-500\/60{color:#00c75899}@supports (color:color-mix(in lab,red,red)){.text-green-500\/60{color:color-mix(in oklab,var(--color-green-500) 60%,transparent)}}.text-green-600{color:var(--color-green-600)}.text-indigo-400\/70{color:#7d87ffb3}@supports (color:color-mix(in lab,red,red)){.text-indigo-400\/70{color:color-mix(in oklab,var(--color-indigo-400) 70%,transparent)}}.text-indigo-500{color:var(--color-indigo-500)}.text-purple-400{color:var(--color-purple-400)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-red-400\/50{color:#ff656880}@supports (color:color-mix(in lab,red,red)){.text-red-400\/50{color:color-mix(in oklab,var(--color-red-400) 50%,transparent)}}.text-red-400\/60{color:#ff656899}@supports (color:color-mix(in lab,red,red)){.text-red-400\/60{color:color-mix(in oklab,var(--color-red-400) 60%,transparent)}}.text-red-400\/80{color:#ff6568cc}@supports (color:color-mix(in lab,red,red)){.text-red-400\/80{color:color-mix(in oklab,var(--color-red-400) 80%,transparent)}}.text-sky-400{color:var(--color-sky-400)}.text-white{color:var(--color-white)}.capitalize{text-transform:capitalize}.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,)}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.opacity-0{opacity:0}.opacity-20{opacity:.2}.opacity-35{opacity:.35}.opacity-40{opacity:.4}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-100{opacity:1}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_12px_var\(--completed-muted\)\]{--tw-shadow:0 0 12px var(--tw-shadow-color,var(--completed-muted));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_12px_var\(--running-glow\)\]{--tw-shadow:0 0 12px var(--tw-shadow-color,var(--running-glow));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_12px_var\(--waiting-muted\)\]{--tw-shadow:0 0 12px var(--tw-shadow-color,var(--waiting-muted));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_16px_var\(--completed-muted\)\]{--tw-shadow:0 0 16px var(--tw-shadow-color,var(--completed-muted));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_16px_var\(--failed-muted\)\]{--tw-shadow:0 0 16px var(--tw-shadow-color,var(--failed-muted));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_16px_var\(--running-glow\)\]{--tw-shadow:0 0 16px var(--tw-shadow-color,var(--running-glow));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.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)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-green-500\/10{--tw-shadow-color:#00c7581a}@supports (color:color-mix(in lab,red,red)){.shadow-green-500\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-green-500) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-red-500\/10{--tw-shadow-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.shadow-red-500\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-red-500) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.ring-\[var\(--accent\)\]{--tw-ring-color:var(--accent)}.ring-offset-1{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.ring-offset-\[var\(--bg\)\]{--tw-ring-offset-color:var(--bg)}.filter{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,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-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))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}@media(hover:hover){.group-hover\:border-amber-400:is(:where(.group):hover *){border-color:var(--color-amber-400)}}.placeholder\:text-\[var\(--text-muted\)\]::placeholder{color:var(--text-muted)}.last\:mb-0:last-child{margin-bottom:calc(var(--spacing) * 0)}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media(hover:hover){.hover\:border-amber-400\/60:hover{border-color:#fcbb0099}@supports (color:color-mix(in lab,red,red)){.hover\:border-amber-400\/60:hover{border-color:color-mix(in oklab,var(--color-amber-400) 60%,transparent)}}.hover\:border-emerald-500\/30:hover{border-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.hover\:border-emerald-500\/30:hover{border-color:color-mix(in oklab,var(--color-emerald-500) 30%,transparent)}}.hover\:border-red-500\/30:hover{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.hover\:border-red-500\/30:hover{border-color:color-mix(in oklab,var(--color-red-500) 30%,transparent)}}.hover\:bg-\[var\(--node-bg\)\]:hover{background-color:var(--node-bg)}.hover\:bg-\[var\(--surface\)\]:hover{background-color:var(--surface)}.hover\:bg-\[var\(--surface-hover\)\]:hover{background-color:var(--surface-hover)}.hover\:bg-\[var\(--text-muted\)\]:hover{background-color:var(--text-muted)}.hover\:bg-amber-500\/5:hover{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/5:hover{background-color:color-mix(in oklab,var(--color-amber-500) 5%,transparent)}}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-emerald-500\/20:hover{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/20:hover{background-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.hover\:bg-red-500\/30:hover{background-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/30:hover{background-color:color-mix(in oklab,var(--color-red-500) 30%,transparent)}}.hover\:text-\[var\(--accent\)\]:hover{color:var(--accent)}.hover\:text-\[var\(--text\)\]:hover{color:var(--text)}.hover\:text-\[var\(--text-secondary\)\]:hover{color:var(--text-secondary)}.hover\:text-blue-300:hover{color:var(--color-blue-300)}.hover\:text-green-300:hover{color:var(--color-green-300)}.hover\:underline:hover{text-decoration-line:underline}}.focus\:border-amber-400:focus{border-color:var(--color-amber-400)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}}:root{--bg:#0a0a0f;--bg-subtle:#111118;--surface:#16161e;--surface-hover:#1c1c26;--surface-raised:#1e1e28;--border:#2a2a3a;--border-subtle:#223;--text:#e4e4ef;--text-secondary:#a0a0b8;--text-muted:#6b6b80;--pending:#52525b;--running:#3b82f6;--running-glow:#3b82f680;--completed:#22c55e;--completed-muted:#22c55e40;--failed:#ef4444;--failed-muted:#ef444440;--waiting:#f59e0b;--waiting-muted:#f59e0b40;--skipped:#6b7280;--accent:#6366f1;--accent-muted:#6366f140;--node-bg:#1e1e2a;--node-border:#2e2e42;--edge-color:#2e2e42;--edge-active:#3b82f6;--edge-taken:#22c55e;--minimap-bg:#0d0d14;--minimap-mask:#ffffff10;--minimap-node:#3b82f680;--font-sans:ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--font-mono:ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace}*{box-sizing:border-box;margin:0;padding:0}html,body,#root{width:100%;height:100%;overflow:hidden}body{font-family:var(--font-sans);background:var(--bg);color:var(--text);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.react-flow__background{background:var(--bg)!important}.react-flow__minimap{background:var(--minimap-bg)!important;border:1px solid var(--border)!important;border-radius:8px!important}.react-flow__controls{overflow:hidden;border:1px solid var(--border)!important;border-radius:8px!important;box-shadow:0 4px 12px #0006!important}.react-flow__controls-button{background:var(--surface)!important;border:none!important;border-bottom:1px solid var(--border)!important;color:var(--text-secondary)!important;fill:var(--text-secondary)!important;width:32px!important;height:32px!important}.react-flow__controls-button:hover{background:var(--surface-hover)!important;color:var(--text)!important;fill:var(--text)!important}.react-flow__controls-button:last-child{border-bottom:none!important}@keyframes pulse-ring{0%{box-shadow:0 0 0 0 var(--running-glow)}70%{box-shadow:0 0 0 6px #0000}to{box-shadow:0 0 #0000}}@keyframes subtle-pulse{0%,to{opacity:1}50%{opacity:.7}}@keyframes context-pulse{0%,to{opacity:1}50%{opacity:.4}}@keyframes dash-flow{to{stroke-dashoffset:-20px}}@keyframes node-activate{0%{transform:scale(1)}50%{transform:scale(1.03)}to{transform:scale(1)}}@keyframes node-complete-glow{0%{box-shadow:0 0 0 0 var(--completed-muted)}50%{box-shadow:0 0 16px 4px var(--completed-muted)}to{box-shadow:0 0 #0000}}@keyframes node-fail-glow{0%{box-shadow:0 0 0 0 var(--failed-muted)}50%{box-shadow:0 0 16px 4px var(--failed-muted)}to{box-shadow:0 0 #0000}}.node-activate{animation:.3s ease-out node-activate}.node-complete{animation:.4s ease-out node-complete-glow}.node-fail{animation:.4s ease-out node-fail-glow}@keyframes tooltip-in{0%{opacity:0;transform:translate(-50%,4px)}to{opacity:1;transform:translate(-50%)}}@keyframes banner-in{0%{opacity:0;transform:translate(-50%,-8px)}to{opacity:1;transform:translate(-50%)}}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}::-webkit-scrollbar-thumb:hover{background:var(--text-muted)}[data-panel-group-direction=horizontal]>[data-resize-handle-active],[data-panel-group-direction=vertical]>[data-resize-handle-active]{background-color:var(--accent)!important}[data-resize-handle]{transition:background-color .15s;background-color:var(--border)!important}[data-resize-handle]:hover{background-color:var(--text-muted)!important}@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-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}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}.react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #777;--xy-background-pattern-lines-color-default: #777;--xy-background-pattern-cross-color-default: #777;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{z-index:1001;overflow:visible;position:absolute}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background-color:var(--xy-handle-background-color, var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));border-radius:100%}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:0;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px) translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px) translateY(-50%)}.react-flow__attribution{font-size:10px;background:var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;left:0;top:0}.react-flow__viewport-portal{position:absolute;width:100%;height:100%;left:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__minimap{background:var( --xy-minimap-background-color-props, var(--xy-minimap-background-color, var(--xy-minimap-background-color-default)) )}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var( --xy-minimap-mask-background-color-props, var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default)) );stroke:var( --xy-minimap-mask-stroke-color-props, var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default)) );stroke-width:var( --xy-minimap-mask-stroke-width-props, var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default)) )}.react-flow__minimap-node{fill:var( --xy-minimap-node-background-color-props, var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default)) );stroke:var( --xy-minimap-node-stroke-color-props, var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default)) );stroke-width:var( --xy-minimap-node-stroke-width-props, var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default)) )}.react-flow__background-pattern.dots{fill:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default)) )}.react-flow__background-pattern.lines{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default)) )}.react-flow__background-pattern.cross{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default)) )}.react-flow__controls{display:flex;flex-direction:column;box-shadow:var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default))}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{display:flex;justify-content:center;align-items:center;height:26px;width:26px;padding:4px;border:none;background:var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));border-bottom:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) );color:var( --xy-controls-button-color-props, var(--xy-controls-button-color, var(--xy-controls-button-color-default)) );cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px;fill:currentColor}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:var(--xy-node-border-radius, var(--xy-node-border-radius-default));width:150px;font-size:12px;color:var(--xy-node-color, var(--xy-node-color-default));text-align:center;border:var(--xy-node-border, var(--xy-node-border-default));background-color:var(--xy-node-background-color, var(--xy-node-background-color-default))}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color, var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color, var(--xy-selection-background-color-default));border:var(--xy-selection-border, var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var( --xy-controls-button-background-color-hover-props, var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default)) );color:var( --xy-controls-button-color-hover-props, var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default)) )}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) )}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:5px;height:5px;border:1px solid #fff;border-radius:1px;background-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));translate:-50% -50%}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color, var(--xy-edge-label-color-default))} diff --git a/src/conductor/web/static/assets/index-DHEpYuxn.css b/src/conductor/web/static/assets/index-DHEpYuxn.css deleted file mode 100644 index 9961ba5..0000000 --- a/src/conductor/web/static/assets/index-DHEpYuxn.css +++ /dev/null @@ -1 +0,0 @@ -/*! tailwindcss v4.2.1 | 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-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;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease: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;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-950:oklch(25.8% .092 26.042);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-950:oklch(26.6% .065 152.934);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-600:oklch(60.9% .126 221.723);--color-sky-400:oklch(74.6% .16 232.661);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-purple-400:oklch(71.4% .203 305.504);--color-black:#000;--color-white:#fff;--spacing:.25rem;--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-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--ease-out:cubic-bezier(0, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0, 0, .2, 1) infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--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)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.-top-0\.5{top:calc(var(--spacing) * -.5)}.top-3{top:calc(var(--spacing) * 3)}.top-full{top:100%}.-right-0\.5{right:calc(var(--spacing) * -.5)}.right-0{right:calc(var(--spacing) * 0)}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-full{bottom:100%}.left-0{left:calc(var(--spacing) * 0)}.left-1\/2{left:50%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.-mx-1{margin-inline:calc(var(--spacing) * -1)}.my-0\.5{margin-block:calc(var(--spacing) * .5)}.my-1{margin-block:calc(var(--spacing) * 1)}.my-1\.5{margin-block:calc(var(--spacing) * 1.5)}.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)}.mr-0\.5{margin-right:calc(var(--spacing) * .5)}.-mb-px{margin-bottom:-1px}.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)}.ml-0\.5{margin-left:calc(var(--spacing) * .5)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-\[4\.25rem\]{margin-left:4.25rem}.ml-\[calc\(7ch\+5ch\+8ch\+1rem\)\]{margin-left:calc(20ch + 1rem)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.\!h-2{height:calc(var(--spacing) * 2)!important}.h-0{height:calc(var(--spacing) * 0)}.h-1{height:calc(var(--spacing) * 1)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-11{height:calc(var(--spacing) * 11)}.h-\[2px\]{height:2px}.h-\[3px\]{height:3px}.h-\[90\%\]{height:90%}.h-full{height:100%}.h-px{height:1px}.max-h-24{max-height:calc(var(--spacing) * 24)}.max-h-\[400px\]{max-height:400px}.\!w-2{width:calc(var(--spacing) * 2)!important}.w-0{width:calc(var(--spacing) * 0)}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-8{width:calc(var(--spacing) * 8)}.w-11{width:calc(var(--spacing) * 11)}.w-12{width:calc(var(--spacing) * 12)}.w-\[3px\]{width:3px}.w-\[5ch\]{width:5ch}.w-\[80\%\]{width:80%}.w-full{width:100%}.max-w-\[16ch\]{max-width:16ch}.max-w-\[140px\]{max-width:140px}.max-w-\[220px\]{max-width:220px}.max-w-\[260px\]{max-width:260px}.max-w-\[560px\]{max-width:560px}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-\[8ch\]{min-width:8ch}.min-w-\[14px\]{min-width:14px}.min-w-\[140px\]{min-width:140px}.min-w-\[180px\]{min-width:180px}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-0{--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-4{--tw-translate-x:calc(var(--spacing) * 4);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-\[banner-in_200ms_ease-out\]{animation:.2s ease-out banner-in}.animate-\[context-pulse_2s_ease-in-out_infinite\]{animation:2s ease-in-out infinite context-pulse}.animate-\[tooltip-in_150ms_ease-out\]{animation:.15s ease-out tooltip-in}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-col-resize{cursor:col-resize}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.cursor-row-resize{cursor:row-resize}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-\[auto_1fr\]{grid-template-columns:auto 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-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-y-0\.5{row-gap:calc(var(--spacing) * .5)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t-lg{border-top-left-radius:var(--radius-lg);border-top-right-radius:var(--radius-lg)}.rounded-b-lg{border-bottom-right-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-x-\[6px\]{border-inline-style:var(--tw-border-style);border-inline-width:6px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-\[6px\]{border-top-style:var(--tw-border-style);border-top-width:6px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.\!border-none{--tw-border-style:none!important;border-style:none!important}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-\[var\(--accent\)\]{border-color:var(--accent)}.border-\[var\(--border\)\]{border-color:var(--border)}.border-\[var\(--border-subtle\)\]{border-color:var(--border-subtle)}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500) 30%,transparent)}}.border-amber-500\/50{border-color:#f99c0080}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/50{border-color:color-mix(in oklab,var(--color-amber-500) 50%,transparent)}}.border-emerald-500\/20{border-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/20{border-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab,red,red)){.border-green-500\/30{border-color:color-mix(in oklab,var(--color-green-500) 30%,transparent)}}.border-green-500\/40{border-color:#00c75866}@supports (color:color-mix(in lab,red,red)){.border-green-500\/40{border-color:color-mix(in oklab,var(--color-green-500) 40%,transparent)}}.border-green-500\/60{border-color:#00c75899}@supports (color:color-mix(in lab,red,red)){.border-green-500\/60{border-color:color-mix(in oklab,var(--color-green-500) 60%,transparent)}}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500) 30%,transparent)}}.border-red-500\/40{border-color:#fb2c3666}@supports (color:color-mix(in lab,red,red)){.border-red-500\/40{border-color:color-mix(in oklab,var(--color-red-500) 40%,transparent)}}.border-transparent{border-color:#0000}.border-x-transparent{border-inline-color:#0000}.border-t-\[var\(--border\)\]{border-top-color:var(--border)}.\!bg-\[var\(--border\)\]{background-color:var(--border)!important}.bg-\[var\(--accent\)\]{background-color:var(--accent)}.bg-\[var\(--bg\)\]{background-color:var(--bg)}.bg-\[var\(--border\)\]{background-color:var(--border)}.bg-\[var\(--completed\)\]{background-color:var(--completed)}.bg-\[var\(--failed\)\]{background-color:var(--failed)}.bg-\[var\(--node-bg\)\]{background-color:var(--node-bg)}.bg-\[var\(--pending\)\]{background-color:var(--pending)}.bg-\[var\(--running\)\]{background-color:var(--running)}.bg-\[var\(--surface\)\],.bg-\[var\(--surface\)\]\/80{background-color:var(--surface)}@supports (color:color-mix(in lab,red,red)){.bg-\[var\(--surface\)\]\/80{background-color:color-mix(in oklab,var(--surface) 80%,transparent)}}.bg-\[var\(--surface-hover\)\]{background-color:var(--surface-hover)}.bg-\[var\(--surface-raised\)\]{background-color:var(--surface-raised)}.bg-amber-400{background-color:var(--color-amber-400)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500) 10%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/5{background-color:#00c7580d}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/5{background-color:color-mix(in oklab,var(--color-green-500) 5%,transparent)}}.bg-green-500\/10{background-color:#00c7581a}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/10{background-color:color-mix(in oklab,var(--color-green-500) 10%,transparent)}}.bg-green-950\/90{background-color:#032e15e6}@supports (color:color-mix(in lab,red,red)){.bg-green-950\/90{background-color:color-mix(in oklab,var(--color-green-950) 90%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.bg-red-950\/50{background-color:#46080980}@supports (color:color-mix(in lab,red,red)){.bg-red-950\/50{background-color:color-mix(in oklab,var(--color-red-950) 50%,transparent)}}.bg-red-950\/90{background-color:#460809e6}@supports (color:color-mix(in lab,red,red)){.bg-red-950\/90{background-color:color-mix(in oklab,var(--color-red-950) 90%,transparent)}}.bg-transparent{background-color:#0000}.p-0{padding:calc(var(--spacing) * 0)}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:calc(var(--spacing) * 1)}.p-3{padding:calc(var(--spacing) * 3)}.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)}.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)}.pt-px{padding-top:1px}.pl-2\.5{padding-left:calc(var(--spacing) * 2.5)}.pl-3{padding-left:calc(var(--spacing) * 3)}.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-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[13px\]{font-size:13px}.leading-6{--tw-leading:calc(var(--spacing) * 6);line-height:calc(var(--spacing) * 6)}.leading-\[1\.6\]{--tw-leading:1.6;line-height:1.6}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.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-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.break-words{overflow-wrap:break-word}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[var\(--accent\)\]{color:var(--accent)}.text-\[var\(--completed\)\]{color:var(--completed)}.text-\[var\(--failed\)\]{color:var(--failed)}.text-\[var\(--running\)\]{color:var(--running)}.text-\[var\(--text\)\]{color:var(--text)}.text-\[var\(--text-muted\)\]{color:var(--text-muted)}.text-\[var\(--text-secondary\)\]{color:var(--text-secondary)}.text-\[var\(--waiting\)\]{color:var(--waiting)}.text-amber-400{color:var(--color-amber-400)}.text-amber-500{color:var(--color-amber-500)}.text-blue-400{color:var(--color-blue-400)}.text-blue-500{color:var(--color-blue-500)}.text-cyan-400\/70{color:#00d2efb3}@supports (color:color-mix(in lab,red,red)){.text-cyan-400\/70{color:color-mix(in oklab,var(--color-cyan-400) 70%,transparent)}}.text-cyan-600{color:var(--color-cyan-600)}.text-emerald-400{color:var(--color-emerald-400)}.text-emerald-500\/70{color:#00bb7fb3}@supports (color:color-mix(in lab,red,red)){.text-emerald-500\/70{color:color-mix(in oklab,var(--color-emerald-500) 70%,transparent)}}.text-green-300{color:var(--color-green-300)}.text-green-400{color:var(--color-green-400)}.text-green-400\/80{color:#05df72cc}@supports (color:color-mix(in lab,red,red)){.text-green-400\/80{color:color-mix(in oklab,var(--color-green-400) 80%,transparent)}}.text-green-500\/60{color:#00c75899}@supports (color:color-mix(in lab,red,red)){.text-green-500\/60{color:color-mix(in oklab,var(--color-green-500) 60%,transparent)}}.text-green-600{color:var(--color-green-600)}.text-indigo-400\/70{color:#7d87ffb3}@supports (color:color-mix(in lab,red,red)){.text-indigo-400\/70{color:color-mix(in oklab,var(--color-indigo-400) 70%,transparent)}}.text-indigo-500{color:var(--color-indigo-500)}.text-purple-400{color:var(--color-purple-400)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-red-400\/50{color:#ff656880}@supports (color:color-mix(in lab,red,red)){.text-red-400\/50{color:color-mix(in oklab,var(--color-red-400) 50%,transparent)}}.text-red-400\/60{color:#ff656899}@supports (color:color-mix(in lab,red,red)){.text-red-400\/60{color:color-mix(in oklab,var(--color-red-400) 60%,transparent)}}.text-red-400\/80{color:#ff6568cc}@supports (color:color-mix(in lab,red,red)){.text-red-400\/80{color:color-mix(in oklab,var(--color-red-400) 80%,transparent)}}.text-sky-400{color:var(--color-sky-400)}.text-white{color:var(--color-white)}.capitalize{text-transform:capitalize}.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,)}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.opacity-0{opacity:0}.opacity-20{opacity:.2}.opacity-35{opacity:.35}.opacity-40{opacity:.4}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-100{opacity:1}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_12px_var\(--completed-muted\)\]{--tw-shadow:0 0 12px var(--tw-shadow-color,var(--completed-muted));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_12px_var\(--running-glow\)\]{--tw-shadow:0 0 12px var(--tw-shadow-color,var(--running-glow));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_12px_var\(--waiting-muted\)\]{--tw-shadow:0 0 12px var(--tw-shadow-color,var(--waiting-muted));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_16px_var\(--completed-muted\)\]{--tw-shadow:0 0 16px var(--tw-shadow-color,var(--completed-muted));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_16px_var\(--failed-muted\)\]{--tw-shadow:0 0 16px var(--tw-shadow-color,var(--failed-muted));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_16px_var\(--running-glow\)\]{--tw-shadow:0 0 16px var(--tw-shadow-color,var(--running-glow));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.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)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-green-500\/10{--tw-shadow-color:#00c7581a}@supports (color:color-mix(in lab,red,red)){.shadow-green-500\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-green-500) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-red-500\/10{--tw-shadow-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.shadow-red-500\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-red-500) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.ring-\[var\(--accent\)\]{--tw-ring-color:var(--accent)}.ring-offset-1{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.ring-offset-\[var\(--bg\)\]{--tw-ring-offset-color:var(--bg)}.filter{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,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-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))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}@media(hover:hover){.group-hover\:border-amber-400:is(:where(.group):hover *){border-color:var(--color-amber-400)}}.placeholder\:text-\[var\(--text-muted\)\]::placeholder{color:var(--text-muted)}.last\:mb-0:last-child{margin-bottom:calc(var(--spacing) * 0)}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media(hover:hover){.hover\:border-amber-400\/60:hover{border-color:#fcbb0099}@supports (color:color-mix(in lab,red,red)){.hover\:border-amber-400\/60:hover{border-color:color-mix(in oklab,var(--color-amber-400) 60%,transparent)}}.hover\:border-emerald-500\/30:hover{border-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.hover\:border-emerald-500\/30:hover{border-color:color-mix(in oklab,var(--color-emerald-500) 30%,transparent)}}.hover\:border-red-500\/30:hover{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.hover\:border-red-500\/30:hover{border-color:color-mix(in oklab,var(--color-red-500) 30%,transparent)}}.hover\:bg-\[var\(--node-bg\)\]:hover{background-color:var(--node-bg)}.hover\:bg-\[var\(--surface\)\]:hover{background-color:var(--surface)}.hover\:bg-\[var\(--surface-hover\)\]:hover{background-color:var(--surface-hover)}.hover\:bg-\[var\(--text-muted\)\]:hover{background-color:var(--text-muted)}.hover\:bg-amber-500\/5:hover{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/5:hover{background-color:color-mix(in oklab,var(--color-amber-500) 5%,transparent)}}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-emerald-500\/20:hover{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/20:hover{background-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.hover\:bg-red-500\/30:hover{background-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/30:hover{background-color:color-mix(in oklab,var(--color-red-500) 30%,transparent)}}.hover\:text-\[var\(--accent\)\]:hover{color:var(--accent)}.hover\:text-\[var\(--text\)\]:hover{color:var(--text)}.hover\:text-\[var\(--text-secondary\)\]:hover{color:var(--text-secondary)}.hover\:text-blue-300:hover{color:var(--color-blue-300)}.hover\:text-green-300:hover{color:var(--color-green-300)}.hover\:underline:hover{text-decoration-line:underline}}.focus\:border-amber-400:focus{border-color:var(--color-amber-400)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}}:root{--bg:#0a0a0f;--bg-subtle:#111118;--surface:#16161e;--surface-hover:#1c1c26;--surface-raised:#1e1e28;--border:#2a2a3a;--border-subtle:#223;--text:#e4e4ef;--text-secondary:#a0a0b8;--text-muted:#6b6b80;--pending:#52525b;--running:#3b82f6;--running-glow:#3b82f680;--completed:#22c55e;--completed-muted:#22c55e40;--failed:#ef4444;--failed-muted:#ef444440;--waiting:#f59e0b;--waiting-muted:#f59e0b40;--skipped:#6b7280;--accent:#6366f1;--accent-muted:#6366f140;--node-bg:#1e1e2a;--node-border:#2e2e42;--edge-color:#2e2e42;--edge-active:#3b82f6;--edge-taken:#22c55e;--minimap-bg:#0d0d14;--minimap-mask:#ffffff10;--minimap-node:#3b82f680;--font-sans:ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--font-mono:ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace}*{box-sizing:border-box;margin:0;padding:0}html,body,#root{width:100%;height:100%;overflow:hidden}body{font-family:var(--font-sans);background:var(--bg);color:var(--text);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.react-flow__background{background:var(--bg)!important}.react-flow__minimap{background:var(--minimap-bg)!important;border:1px solid var(--border)!important;border-radius:8px!important}.react-flow__controls{overflow:hidden;border:1px solid var(--border)!important;border-radius:8px!important;box-shadow:0 4px 12px #0006!important}.react-flow__controls-button{background:var(--surface)!important;border:none!important;border-bottom:1px solid var(--border)!important;color:var(--text-secondary)!important;fill:var(--text-secondary)!important;width:32px!important;height:32px!important}.react-flow__controls-button:hover{background:var(--surface-hover)!important;color:var(--text)!important;fill:var(--text)!important}.react-flow__controls-button:last-child{border-bottom:none!important}@keyframes pulse-ring{0%{box-shadow:0 0 0 0 var(--running-glow)}70%{box-shadow:0 0 0 6px #0000}to{box-shadow:0 0 #0000}}@keyframes subtle-pulse{0%,to{opacity:1}50%{opacity:.7}}@keyframes context-pulse{0%,to{opacity:1}50%{opacity:.4}}@keyframes dash-flow{to{stroke-dashoffset:-20px}}@keyframes node-activate{0%{transform:scale(1)}50%{transform:scale(1.03)}to{transform:scale(1)}}@keyframes node-complete-glow{0%{box-shadow:0 0 0 0 var(--completed-muted)}50%{box-shadow:0 0 16px 4px var(--completed-muted)}to{box-shadow:0 0 #0000}}@keyframes node-fail-glow{0%{box-shadow:0 0 0 0 var(--failed-muted)}50%{box-shadow:0 0 16px 4px var(--failed-muted)}to{box-shadow:0 0 #0000}}.node-activate{animation:.3s ease-out node-activate}.node-complete{animation:.4s ease-out node-complete-glow}.node-fail{animation:.4s ease-out node-fail-glow}@keyframes tooltip-in{0%{opacity:0;transform:translate(-50%,4px)}to{opacity:1;transform:translate(-50%)}}@keyframes banner-in{0%{opacity:0;transform:translate(-50%,-8px)}to{opacity:1;transform:translate(-50%)}}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}::-webkit-scrollbar-thumb:hover{background:var(--text-muted)}[data-panel-group-direction=horizontal]>[data-resize-handle-active],[data-panel-group-direction=vertical]>[data-resize-handle-active]{background-color:var(--accent)!important}[data-resize-handle]{transition:background-color .15s;background-color:var(--border)!important}[data-resize-handle]:hover{background-color:var(--text-muted)!important}@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-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}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}.react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #777;--xy-background-pattern-lines-color-default: #777;--xy-background-pattern-cross-color-default: #777;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{z-index:1001;overflow:visible;position:absolute}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background-color:var(--xy-handle-background-color, var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));border-radius:100%}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:0;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px) translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px) translateY(-50%)}.react-flow__attribution{font-size:10px;background:var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;left:0;top:0}.react-flow__viewport-portal{position:absolute;width:100%;height:100%;left:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__minimap{background:var( --xy-minimap-background-color-props, var(--xy-minimap-background-color, var(--xy-minimap-background-color-default)) )}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var( --xy-minimap-mask-background-color-props, var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default)) );stroke:var( --xy-minimap-mask-stroke-color-props, var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default)) );stroke-width:var( --xy-minimap-mask-stroke-width-props, var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default)) )}.react-flow__minimap-node{fill:var( --xy-minimap-node-background-color-props, var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default)) );stroke:var( --xy-minimap-node-stroke-color-props, var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default)) );stroke-width:var( --xy-minimap-node-stroke-width-props, var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default)) )}.react-flow__background-pattern.dots{fill:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default)) )}.react-flow__background-pattern.lines{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default)) )}.react-flow__background-pattern.cross{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default)) )}.react-flow__controls{display:flex;flex-direction:column;box-shadow:var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default))}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{display:flex;justify-content:center;align-items:center;height:26px;width:26px;padding:4px;border:none;background:var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));border-bottom:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) );color:var( --xy-controls-button-color-props, var(--xy-controls-button-color, var(--xy-controls-button-color-default)) );cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px;fill:currentColor}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:var(--xy-node-border-radius, var(--xy-node-border-radius-default));width:150px;font-size:12px;color:var(--xy-node-color, var(--xy-node-color-default));text-align:center;border:var(--xy-node-border, var(--xy-node-border-default));background-color:var(--xy-node-background-color, var(--xy-node-background-color-default))}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color, var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color, var(--xy-selection-background-color-default));border:var(--xy-selection-border, var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var( --xy-controls-button-background-color-hover-props, var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default)) );color:var( --xy-controls-button-color-hover-props, var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default)) )}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) )}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:5px;height:5px;border:1px solid #fff;border-radius:1px;background-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));translate:-50% -50%}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color, var(--xy-edge-label-color-default))} diff --git a/src/conductor/web/static/index.html b/src/conductor/web/static/index.html index e2d4383..66e4e7e 100644 --- a/src/conductor/web/static/index.html +++ b/src/conductor/web/static/index.html @@ -1,14 +1,14 @@ - - - - - - - Conductor Dashboard - - - - -
    - - + + + + + + + Conductor Dashboard + + + + +
    + + diff --git a/tests/test_gates/test_human.py b/tests/test_gates/test_human.py index 343e5a5..70afb17 100644 --- a/tests/test_gates/test_human.py +++ b/tests/test_gates/test_human.py @@ -287,12 +287,15 @@ async def test_prompt_rendered_with_context( ): await handler.handle_gate(human_gate_agent, context) - # Verify Panel was called with rendered content + # Verify Panel was called with rendered content wrapped in RichMarkdown mock_panel.assert_called() panel_args = mock_panel.call_args - # First positional arg should be the rendered prompt + # First positional arg should be a RichMarkdown instance rendered_prompt = panel_args[0][0] - assert "Generated content here" in rendered_prompt + from rich.markdown import Markdown as RichMarkdown + + assert isinstance(rendered_prompt, RichMarkdown) + assert "Generated content here" in rendered_prompt.markup class TestHumanGateHandlerAutoSelect: @@ -544,3 +547,59 @@ async def test_detects_potential_loop(self, mock_console: MagicMock) -> None: panel_args = mock_panel.call_args panel_content = panel_args[0][0] assert "loop" in panel_content.lower() + + +class TestGatePromptMarkdownRendering: + """Tests that gate prompts are rendered as Rich Markdown in the terminal.""" + + @pytest.mark.asyncio + async def test_prompt_wrapped_in_rich_markdown( + self, + mock_console: MagicMock, + sample_options: list[GateOption], + ) -> None: + """Verify Panel receives a RichMarkdown object, not a bare string.""" + from rich.markdown import Markdown as RichMarkdown + + agent = AgentDef( + name="md_gate", + type="human_gate", + prompt="## Review\n\n- [plan](./plan.md)\n- **bold** text", + options=sample_options, + ) + handler = HumanGateHandler(console=mock_console, skip_gates=False) + + with ( + patch("conductor.gates.human.Prompt.ask", return_value="1"), + patch("conductor.gates.human.Panel") as mock_panel, + ): + await handler.handle_gate(agent, {}) + + mock_panel.assert_called() + rendered = mock_panel.call_args[0][0] + assert isinstance(rendered, RichMarkdown) + # Verify the original markdown text is preserved in the markup + assert "## Review" in rendered.markup + assert "[plan](./plan.md)" in rendered.markup + assert "**bold**" in rendered.markup + + @pytest.mark.asyncio + async def test_skip_gates_auto_selects_without_panel( + self, + mock_console: MagicMock, + sample_options: list[GateOption], + ) -> None: + """Verify that skip_gates mode auto-selects without displaying the Panel.""" + agent = AgentDef( + name="skip_md_gate", + type="human_gate", + prompt="# Auto-review\nPlain text here.", + options=sample_options, + ) + handler = HumanGateHandler(console=mock_console, skip_gates=True) + + result = await handler.handle_gate(agent, {}) + + # skip_gates auto-selects the first option + assert result.selected_option == sample_options[0] + assert result.route == "next_agent" diff --git a/tests/test_web/test_server.py b/tests/test_web/test_server.py index 31db239..bd4027b 100644 --- a/tests/test_web/test_server.py +++ b/tests/test_web/test_server.py @@ -12,6 +12,7 @@ import asyncio import time +from pathlib import Path from unittest.mock import AsyncMock, MagicMock import pytest @@ -21,10 +22,14 @@ from conductor.web.server import WebDashboard -def _make_dashboard(*, bg: bool = False) -> tuple[WorkflowEventEmitter, WebDashboard]: +def _make_dashboard( + *, bg: bool = False, workflow_root: Path | None = None +) -> tuple[WorkflowEventEmitter, WebDashboard]: """Create an emitter and dashboard pair for testing.""" emitter = WorkflowEventEmitter() - dashboard = WebDashboard(emitter, host="127.0.0.1", port=0, bg=bg) + dashboard = WebDashboard( + emitter, host="127.0.0.1", port=0, bg=bg, workflow_root=workflow_root + ) return emitter, dashboard @@ -543,3 +548,120 @@ async def _short_grace(event: asyncio.Event, delay: float) -> None: """Helper for testing: short grace period.""" await asyncio.sleep(delay) event.set() + + +class TestFileApi: + """Tests for GET /api/files/{file_path} endpoint. + + Covers security checks (path traversal, extension filtering, size limits, + absolute path rejection) and the happy-path for reading files. + """ + + @pytest.fixture + def workflow_dir(self, tmp_path: Path) -> Path: + """Create a temporary workflow directory with sample files.""" + (tmp_path / "plan.md").write_text("# My Plan\nSome content", encoding="utf-8") + (tmp_path / "data.json").write_text('{"key": "value"}', encoding="utf-8") + (tmp_path / "sub").mkdir() + (tmp_path / "sub" / "nested.yaml").write_text("key: value", encoding="utf-8") + (tmp_path / "secret.exe").write_bytes(b"\x00binary") + (tmp_path / "image.png").write_bytes(b"\x89PNG") + return tmp_path + + def _client(self, workflow_dir: Path) -> TestClient: + _, dashboard = _make_dashboard(workflow_root=workflow_dir) + return TestClient(dashboard.app) + + def test_read_markdown_file(self, workflow_dir: Path) -> None: + """Happy path: read a .md file.""" + with self._client(workflow_dir) as client: + resp = client.get("/api/files/plan.md") + assert resp.status_code == 200 + body = resp.json() + assert body["path"] == "plan.md" + assert "# My Plan" in body["content"] + assert body["extension"] == ".md" + assert body["size"] > 0 + + def test_read_nested_file(self, workflow_dir: Path) -> None: + """Read a file in a subdirectory.""" + with self._client(workflow_dir) as client: + resp = client.get("/api/files/sub/nested.yaml") + assert resp.status_code == 200 + assert resp.json()["path"] == "sub/nested.yaml" + + def test_read_json_file(self, workflow_dir: Path) -> None: + """Read a JSON file.""" + with self._client(workflow_dir) as client: + resp = client.get("/api/files/data.json") + assert resp.status_code == 200 + assert '"key"' in resp.json()["content"] + + def test_file_not_found(self, workflow_dir: Path) -> None: + """Non-existent file returns 404.""" + with self._client(workflow_dir) as client: + resp = client.get("/api/files/nonexistent.md") + assert resp.status_code == 404 + + def test_path_traversal_dotdot(self, workflow_dir: Path) -> None: + """Path traversal with .. is blocked (403 containment check).""" + # Create a file outside workflow_dir to prove it can't be reached + outside = workflow_dir.parent / "secret.txt" + outside.write_text("top secret", encoding="utf-8") + with self._client(workflow_dir) as client: + resp = client.get("/api/files/../secret.txt") + assert resp.status_code in (403, 404) + + def test_absolute_path_rejected(self, workflow_dir: Path) -> None: + """Absolute path is rejected with 403.""" + with self._client(workflow_dir) as client: + resp = client.get("/api/files//etc/passwd") + assert resp.status_code == 403 + + def test_drive_path_rejected(self, workflow_dir: Path) -> None: + """Windows drive-qualified path is rejected.""" + with self._client(workflow_dir) as client: + resp = client.get("/api/files/C:/Windows/system32/cmd.exe") + assert resp.status_code == 403 + + def test_scheme_rejected(self, workflow_dir: Path) -> None: + """URL scheme in path is rejected.""" + with self._client(workflow_dir) as client: + resp = client.get("/api/files/file:///etc/passwd") + assert resp.status_code == 403 + + def test_disallowed_extension(self, workflow_dir: Path) -> None: + """Binary/disallowed extension returns 403.""" + with self._client(workflow_dir) as client: + resp = client.get("/api/files/secret.exe") + assert resp.status_code == 403 + assert "not supported" in resp.json()["error"] + + def test_disallowed_image_extension(self, workflow_dir: Path) -> None: + """Image extension is not in the allowlist.""" + with self._client(workflow_dir) as client: + resp = client.get("/api/files/image.png") + assert resp.status_code == 403 + + def test_large_file_rejected(self, workflow_dir: Path) -> None: + """File larger than 1MB is rejected with 413.""" + big = workflow_dir / "huge.txt" + big.write_text("x" * (1024 * 1024 + 1), encoding="utf-8") + with self._client(workflow_dir) as client: + resp = client.get("/api/files/huge.txt") + assert resp.status_code == 413 + assert "too large" in resp.json()["error"].lower() + + def test_no_workflow_root_returns_404(self) -> None: + """When workflow_root is None, endpoint returns 404.""" + _, dashboard = _make_dashboard(workflow_root=None) + with TestClient(dashboard.app) as client: + resp = client.get("/api/files/plan.md") + assert resp.status_code == 404 + assert "No workflow root" in resp.json()["error"] + + def test_unc_path_rejected(self, workflow_dir: Path) -> None: + """UNC path (\\\\server\\share) is rejected.""" + with self._client(workflow_dir) as client: + resp = client.get("/api/files/\\\\server\\share\\file.txt") + assert resp.status_code in (403, 404) From 749d48ffce4399a807b771a839f84821ca9fa166 Mon Sep 17 00:00:00 2001 From: Daniel Green Date: Thu, 23 Apr 2026 17:19:32 -0700 Subject: [PATCH 2/3] fix: remove unused Request import to pass ruff lint Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/conductor/web/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conductor/web/server.py b/src/conductor/web/server.py index 8a18816..95c2940 100644 --- a/src/conductor/web/server.py +++ b/src/conductor/web/server.py @@ -27,7 +27,7 @@ from pathlib import Path from typing import Any -from fastapi import FastAPI, Request, WebSocket, WebSocketDisconnect +from fastapi import FastAPI, WebSocket, WebSocketDisconnect from fastapi.responses import FileResponse, JSONResponse from fastapi.staticfiles import StaticFiles From b8c59a3a0502005656778f3bcefcea42f22a11e0 Mon Sep 17 00:00:00 2001 From: Daniel Green Date: Fri, 24 Apr 2026 08:12:32 -0700 Subject: [PATCH 3/3] style: format server.py and test_server.py to pass ruff format check Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/conductor/web/server.py | 44 ++++++++++++++++++++++++++--------- tests/test_web/test_server.py | 4 +--- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/src/conductor/web/server.py b/src/conductor/web/server.py index 95c2940..8a564bf 100644 --- a/src/conductor/web/server.py +++ b/src/conductor/web/server.py @@ -41,11 +41,31 @@ _BG_GRACE_SECONDS = 30 # File API: allowed text extensions and max file size -_FILE_ALLOWED_EXTENSIONS = frozenset({ - ".md", ".txt", ".yaml", ".yml", ".json", ".log", - ".py", ".ts", ".js", ".tsx", ".jsx", ".css", ".html", - ".toml", ".cfg", ".ini", ".csv", ".xml", ".sh", ".bat", ".ps1", -}) +_FILE_ALLOWED_EXTENSIONS = frozenset( + { + ".md", + ".txt", + ".yaml", + ".yml", + ".json", + ".log", + ".py", + ".ts", + ".js", + ".tsx", + ".jsx", + ".css", + ".html", + ".toml", + ".cfg", + ".ini", + ".csv", + ".xml", + ".sh", + ".bat", + ".ps1", + } +) _FILE_MAX_SIZE = 1 * 1024 * 1024 # 1 MB @@ -270,12 +290,14 @@ async def get_file(file_path: str) -> JSONResponse: ) rel_path = str(target.relative_to(self._workflow_root)).replace("\\", "/") - return JSONResponse({ - "path": rel_path, - "content": content, - "size": file_size, - "extension": target.suffix.lower(), - }) + return JSONResponse( + { + "path": rel_path, + "content": content, + "size": file_size, + "extension": target.suffix.lower(), + } + ) @app.websocket("/ws") async def websocket_endpoint(ws: WebSocket) -> None: diff --git a/tests/test_web/test_server.py b/tests/test_web/test_server.py index bd4027b..6ab69a2 100644 --- a/tests/test_web/test_server.py +++ b/tests/test_web/test_server.py @@ -27,9 +27,7 @@ def _make_dashboard( ) -> tuple[WorkflowEventEmitter, WebDashboard]: """Create an emitter and dashboard pair for testing.""" emitter = WorkflowEventEmitter() - dashboard = WebDashboard( - emitter, host="127.0.0.1", port=0, bg=bg, workflow_root=workflow_root - ) + dashboard = WebDashboard(emitter, host="127.0.0.1", port=0, bg=bg, workflow_root=workflow_root) return emitter, dashboard