From 33f7e2239e06e3b3f16c25e0338685e923977065 Mon Sep 17 00:00:00 2001 From: Daniel Green Date: Thu, 23 Apr 2026 16:54:16 -0700 Subject: [PATCH 1/8] 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 (79 total tests pass across both test suites) 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 +++++++- src/conductor/web/static/index.html | 28 +-- tests/test_gates/test_human.py | 65 +++++- tests/test_web/test_server.py | 126 +++++++++++- 8 files changed, 538 insertions(+), 39 deletions(-) create mode 100644 src/conductor/web/frontend/src/components/detail/FileViewer.tsx diff --git a/src/conductor/cli/run.py b/src/conductor/cli/run.py index 7e75ab8..a42ca33 100644 --- a/src/conductor/cli/run.py +++ b/src/conductor/cli/run.py @@ -1069,7 +1069,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 1531d1f..527f8b2 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]] = [] @@ -217,6 +227,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/index.html b/src/conductor/web/static/index.html index e2d4383..16ffed9 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 af0c06a316517501da33913954018d150a0a5a89 Mon Sep 17 00:00:00 2001 From: Daniel Green Date: Thu, 23 Apr 2026 23:29:36 -0700 Subject: [PATCH 2/8] feat(gates): auto-linkify bare file paths and URLs in gate prompts Add a markdown-aware post-processor that converts bare file paths and URLs in rendered gate prompts into clickable markdown links. This fixes the issue where Jinja2-rendered file paths appeared as plain grey text in the web dashboard instead of interactive file links. Processing: - Normalizes Jinja2 whitespace artifacts (collapses excessive blank lines) - Auto-detects bare http(s):// URLs and wraps in markdown link syntax - Auto-detects relative file paths (verified against workflow root), wraps in markdown links that the dashboard FileViewer can open - Markdown-aware: skips fenced code blocks, inline code, existing links - Reuses the server's extension allowlist for file detection - Security: path traversal outside workflow root is blocked Applied to both web dashboard (gate_presented event) and terminal (Rich markdown rendering in HumanGateHandler). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/conductor/engine/workflow.py | 22 ++- src/conductor/executor/linkify.py | 263 ++++++++++++++++++++++++++++ src/conductor/gates/human.py | 9 +- tests/test_executor/test_linkify.py | 213 ++++++++++++++++++++++ 4 files changed, 503 insertions(+), 4 deletions(-) create mode 100644 src/conductor/executor/linkify.py create mode 100644 tests/test_executor/test_linkify.py diff --git a/src/conductor/engine/workflow.py b/src/conductor/engine/workflow.py index 712df03..624f437 100644 --- a/src/conductor/engine/workflow.py +++ b/src/conductor/engine/workflow.py @@ -33,6 +33,7 @@ TimeoutError as ConductorTimeoutError, ) from conductor.executor.agent import AgentExecutor +from conductor.executor.linkify import linkify_markdown from conductor.executor.script import ScriptExecutor, ScriptOutput from conductor.executor.template import TemplateRenderer from conductor.gates.human import ( @@ -830,7 +831,10 @@ async def _handle_gate_with_web( """ # If no web dashboard at all, use CLI only. if self._web_dashboard is None: - return await self.gate_handler.handle_gate(agent, agent_context) + gate_base = ( + Path(self.workflow_path).resolve().parent if self.workflow_path else None + ) + return await self.gate_handler.handle_gate(agent, agent_context, base_dir=gate_base) # Race CLI vs web input. We start the web task unconditionally (not only # when a client is currently connected), because the human often opens @@ -838,8 +842,9 @@ async def _handle_gate_with_web( # If we bail early when ``has_connections()`` is False, a later click # in the dashboard pushes a message to ``_gate_response_queue`` that # nobody is awaiting, and the workflow hangs forever. + gate_base = Path(self.workflow_path).resolve().parent if self.workflow_path else None cli_task = asyncio.create_task( - self.gate_handler.handle_gate(agent, agent_context), + self.gate_handler.handle_gate(agent, agent_context, base_dir=gate_base), name="gate_cli", ) web_task = asyncio.create_task( @@ -1425,13 +1430,24 @@ async def _execute_loop(self, current_agent_name: str) -> dict[str, Any]: for o in (agent.options or []) ] + # Render prompt and auto-linkify paths/URLs for markdown display + rendered_prompt = self.renderer.render(agent.prompt, agent_context) + gate_base_dir = ( + Path(self.workflow_path).resolve().parent + if self.workflow_path + else None + ) + rendered_prompt = linkify_markdown( + rendered_prompt, base_dir=gate_base_dir + ) + self._emit( "gate_presented", { "agent_name": agent.name, "options": [o.value for o in (agent.options or [])], "option_details": gate_options_data, - "prompt": self.renderer.render(agent.prompt, agent_context), + "prompt": rendered_prompt, }, ) diff --git a/src/conductor/executor/linkify.py b/src/conductor/executor/linkify.py new file mode 100644 index 0000000..01fef83 --- /dev/null +++ b/src/conductor/executor/linkify.py @@ -0,0 +1,263 @@ +"""Auto-linkify bare file paths and URLs in rendered markdown text. + +This module provides post-processing for human-facing rendered text (gate +prompts, etc.) to automatically convert bare file paths and URLs into +markdown links. It is *not* used inside the generic ``TemplateRenderer`` — +only at call-sites that produce text destined for markdown rendering (web +dashboard, Rich terminal). + +The processing is markdown-aware: fenced code blocks, inline code spans, +and existing markdown links are left untouched. +""" + +from __future__ import annotations + +import re +from pathlib import Path + +# --------------------------------------------------------------------------- +# Shared extension allowlist — kept in sync with web/server.py +# --------------------------------------------------------------------------- +LINKABLE_EXTENSIONS = frozenset( + { + ".md", + ".txt", + ".yaml", + ".yml", + ".json", + ".log", + ".py", + ".ts", + ".js", + ".tsx", + ".jsx", + ".css", + ".html", + ".toml", + ".cfg", + ".ini", + ".csv", + ".xml", + ".sh", + ".bat", + ".ps1", + ".plan.md", + } +) + +# --------------------------------------------------------------------------- +# Regex patterns +# --------------------------------------------------------------------------- + +# Fenced code block (``` or ~~~, with optional language tag) +_FENCED_CODE_RE = re.compile(r"^(`{3,}|~{3,}).*?^\1", re.MULTILINE | re.DOTALL) + +# Inline code span (`...`) +_INLINE_CODE_RE = re.compile(r"`[^`\n]+`") + +# Existing markdown links: [text](url) or [text][ref] +_EXISTING_LINK_RE = re.compile(r"\[[^\]]*\]\([^)]*\)|\[[^\]]*\]\[[^\]]*\]") + +# Bare URL: http(s)://... terminated at whitespace or common punctuation +_URL_RE = re.compile( + r"(?\]\[\"'`]+" +) + +# Bare file path: contains at least one /, ends with a known extension. +# Must start at a word boundary or line start. Avoids matching inside +# URLs (already handled) by requiring no scheme prefix. +_FILE_PATH_RE = re.compile( + r"(? str: + """Post-process rendered text to add markdown links for paths and URLs. + + Processing steps: + 1. Normalize Jinja2 whitespace artifacts (3+ consecutive newlines → 2). + 2. Auto-linkify bare ``http(s)://`` URLs. + 3. Auto-linkify bare file paths (verified against *base_dir* when given). + + Fenced code blocks, inline code spans, and existing markdown links are + preserved unchanged. + + Args: + text: Rendered template text (may contain markdown). + base_dir: Optional directory for file existence checks. When + provided, only paths that resolve to an existing file within + *base_dir* are linkified. + + Returns: + Text with bare paths/URLs wrapped in markdown link syntax. + """ + # Step 1: normalize whitespace + text = _normalize_whitespace(text) + + # Step 2 & 3: linkify, skipping protected regions + text = _linkify_with_protection(text, base_dir) + + return text + + +# --------------------------------------------------------------------------- +# Internals +# --------------------------------------------------------------------------- + + +def _normalize_whitespace(text: str) -> str: + """Collapse 3+ consecutive newlines into exactly 2 (one blank line).""" + return re.sub(r"\n{3,}", "\n\n", text) + + +def _linkify_with_protection(text: str, base_dir: Path | None) -> str: + """Linkify URLs and file paths while protecting code/links. + + Strategy: identify protected spans (fenced code, inline code, existing + links), then process only the unprotected gaps. + """ + protected: list[tuple[int, int]] = [] + + for pattern in (_FENCED_CODE_RE, _INLINE_CODE_RE, _EXISTING_LINK_RE): + for m in pattern.finditer(text): + protected.append((m.start(), m.end())) + + # Sort and merge overlapping spans + protected.sort() + merged: list[tuple[int, int]] = [] + for start, end in protected: + if merged and start <= merged[-1][1]: + merged[-1] = (merged[-1][0], max(merged[-1][1], end)) + else: + merged.append((start, end)) + + # Build result by processing unprotected segments + result: list[str] = [] + prev_end = 0 + for pstart, pend in merged: + if prev_end < pstart: + # Unprotected gap — linkify it + result.append(_linkify_segment(text[prev_end:pstart], base_dir)) + # Protected span — copy verbatim + result.append(text[pstart:pend]) + prev_end = pend + # Final unprotected tail + if prev_end < len(text): + result.append(_linkify_segment(text[prev_end:], base_dir)) + + return "".join(result) + + +def _linkify_segment(segment: str, base_dir: Path | None) -> str: + """Linkify bare URLs and file paths in an unprotected text segment.""" + # First pass: linkify URLs + segment = _URL_RE.sub(_wrap_url, segment) + # Second pass: linkify file paths + segment = _linkify_file_paths(segment, base_dir) + return segment + + +def _wrap_url(m: re.Match[str]) -> str: + """Wrap a bare URL in markdown autolink syntax.""" + url = m.group(0) + # Strip trailing punctuation that's unlikely part of the URL + trailing = "" + while url and url[-1] in ".,;:!?)": + # Keep ) only if there's a matching ( in the URL (e.g. Wikipedia links) + if url[-1] == ")" and "(" in url: + break + trailing = url[-1] + trailing + url = url[:-1] + return f"[{url}]({url}){trailing}" + + +def _linkify_file_paths(segment: str, base_dir: Path | None) -> str: + """Find and linkify bare file paths in a text segment. + + A token is considered a file path if: + - It contains at least one ``/`` + - It ends with a known extension + - If *base_dir* is given, the file must exist + """ + # Split on whitespace boundaries to find path-like tokens + # We process word-by-word to avoid partial matches + tokens = re.split(r"(\s+)", segment) + result: list[str] = [] + + for token in tokens: + linked = _try_linkify_path(token, base_dir) + result.append(linked if linked else token) + + return "".join(result) + + +def _try_linkify_path(token: str, base_dir: Path | None) -> str | None: + """Try to linkify a single token as a file path. + + Returns the markdown link string, or None if the token is not a file path. + """ + # Strip leading/trailing punctuation that isn't part of the path + prefix = "" + suffix = "" + stripped = token + + # Strip common leading chars + while stripped and stripped[0] in "([\"'": + prefix += stripped[0] + stripped = stripped[1:] + + # Strip common trailing chars + while stripped and stripped[-1] in ")]\"'.,;:!?": + suffix = stripped[-1] + suffix + stripped = stripped[:-1] + + if not stripped: + return None + + # Must contain a path separator + if "/" not in stripped and "\\" not in stripped: + return None + + # Normalize to forward slashes for extension check + normalized = stripped.replace("\\", "/") + + # Must end with a known extension + if not _has_linkable_extension(normalized): + return None + + # Must not look like a URL (already handled) + if re.match(r"https?://", stripped): + return None + + # If base_dir is provided, verify file exists + if base_dir is not None: + try: + candidate = (base_dir / stripped).resolve() + # Security: must be within base_dir + if not str(candidate).startswith(str(base_dir.resolve())): + return None + if not candidate.is_file(): + return None + except (OSError, ValueError): + return None + + # Build markdown link with forward slashes (for dashboard API) + link_target = normalized + return f"{prefix}[{stripped}]({link_target}){suffix}" + + +def _has_linkable_extension(path: str) -> bool: + """Check if a path ends with a known linkable extension.""" + lower = path.lower() + return any(lower.endswith(ext) for ext in LINKABLE_EXTENSIONS) diff --git a/src/conductor/gates/human.py b/src/conductor/gates/human.py index 0afcf55..ed735b6 100644 --- a/src/conductor/gates/human.py +++ b/src/conductor/gates/human.py @@ -16,9 +16,12 @@ from rich.prompt import IntPrompt, Prompt from conductor.exceptions import HumanGateError +from conductor.executor.linkify import linkify_markdown from conductor.executor.template import TemplateRenderer if TYPE_CHECKING: + from pathlib import Path + from conductor.config.schema import AgentDef, GateOption @@ -73,6 +76,7 @@ async def handle_gate( self, agent: AgentDef, context: dict[str, Any], + base_dir: Path | None = None, ) -> GateResult: """Handle a human gate interaction. @@ -82,6 +86,8 @@ async def handle_gate( Args: agent: The human_gate agent definition. context: Current workflow context for template rendering. + base_dir: Optional directory for resolving relative file paths + in the rendered prompt into clickable markdown links. Returns: GateResult with selected option, route, and any additional input. @@ -95,8 +101,9 @@ async def handle_gate( suggestion="Add 'options' list to the human_gate agent", ) - # Render the prompt with context + # Render the prompt with context and auto-linkify paths/URLs prompt_text = self.renderer.render(agent.prompt, context) + prompt_text = linkify_markdown(prompt_text, base_dir=base_dir) # If skip_gates is enabled, auto-select first option if self.skip_gates: diff --git a/tests/test_executor/test_linkify.py b/tests/test_executor/test_linkify.py new file mode 100644 index 0000000..ad890c3 --- /dev/null +++ b/tests/test_executor/test_linkify.py @@ -0,0 +1,213 @@ +"""Tests for the linkify_markdown post-processor.""" + +from __future__ import annotations + +from pathlib import Path + +from conductor.executor.linkify import linkify_markdown + +# --------------------------------------------------------------------------- +# Whitespace normalisation +# --------------------------------------------------------------------------- + + +class TestWhitespaceNormalization: + """Tests for Jinja2 whitespace artifact cleanup.""" + + def test_collapses_triple_newlines(self) -> None: + text = "line1\n\n\nline2" + assert linkify_markdown(text) == "line1\n\nline2" + + def test_collapses_many_newlines(self) -> None: + text = "a\n\n\n\n\n\nb" + assert linkify_markdown(text) == "a\n\nb" + + def test_preserves_double_newlines(self) -> None: + text = "a\n\nb" + assert linkify_markdown(text) == "a\n\nb" + + def test_preserves_single_newlines(self) -> None: + text = "a\nb" + assert linkify_markdown(text) == "a\nb" + + def test_jinja_for_loop_artifact(self) -> None: + """Simulates the exact Jinja2 for-loop blank-line issue.""" + text = "Items found:\n\n- item1\n\n- item2\n\n- item3\n\n" + result = linkify_markdown(text) + assert "\n\n\n" not in result + assert "- item1" in result + assert "- item2" in result + + +# --------------------------------------------------------------------------- +# URL auto-linking +# --------------------------------------------------------------------------- + + +class TestUrlLinking: + """Tests for bare URL auto-detection and linking.""" + + def test_bare_http_url(self) -> None: + result = linkify_markdown("Visit https://example.com for info") + assert "[https://example.com](https://example.com)" in result + + def test_bare_http_url_with_path(self) -> None: + result = linkify_markdown("See https://example.com/docs/api") + assert "[https://example.com/docs/api](https://example.com/docs/api)" in result + + def test_strips_trailing_punctuation(self) -> None: + result = linkify_markdown("Check https://example.com.") + assert "[https://example.com](https://example.com)." in result + + def test_preserves_existing_markdown_link(self) -> None: + text = "See [docs](https://example.com/docs) for more" + assert linkify_markdown(text) == text + + def test_url_in_inline_code_untouched(self) -> None: + text = "Run `curl https://example.com/api` to test" + assert linkify_markdown(text) == text + + def test_url_in_fenced_code_untouched(self) -> None: + text = "```\nhttps://example.com/api\n```" + assert linkify_markdown(text) == text + + def test_multiple_urls(self) -> None: + text = "Visit https://a.com and https://b.com" + result = linkify_markdown(text) + assert "[https://a.com](https://a.com)" in result + assert "[https://b.com](https://b.com)" in result + + +# --------------------------------------------------------------------------- +# File path auto-linking +# --------------------------------------------------------------------------- + + +class TestFilePathLinking: + """Tests for bare file path auto-detection and linking.""" + + def test_relative_path_with_extension(self, tmp_path: Path) -> None: + (tmp_path / "docs").mkdir() + (tmp_path / "docs" / "readme.md").write_text("hello") + + result = linkify_markdown("See docs/readme.md for details", base_dir=tmp_path) + assert "[docs/readme.md](docs/readme.md)" in result + + def test_nested_path(self, tmp_path: Path) -> None: + (tmp_path / "docs" / "projects").mkdir(parents=True) + (tmp_path / "docs" / "projects" / "plan.md").write_text("plan") + + result = linkify_markdown("Plan at docs/projects/plan.md", base_dir=tmp_path) + assert "[docs/projects/plan.md](docs/projects/plan.md)" in result + + def test_nonexistent_file_not_linked(self, tmp_path: Path) -> None: + result = linkify_markdown("See docs/missing.md for details", base_dir=tmp_path) + assert "[docs/missing.md]" not in result + assert "docs/missing.md" in result # still present as plain text + + def test_no_base_dir_still_links(self) -> None: + """Without base_dir, file paths are linked without existence check.""" + result = linkify_markdown("See docs/readme.md for details") + assert "[docs/readme.md](docs/readme.md)" in result + + def test_unknown_extension_not_linked(self, tmp_path: Path) -> None: + (tmp_path / "data").mkdir() + (tmp_path / "data" / "file.xyz").write_text("data") + + result = linkify_markdown("See data/file.xyz", base_dir=tmp_path) + assert "[data/file.xyz]" not in result + + def test_path_in_markdown_list(self, tmp_path: Path) -> None: + (tmp_path / "docs").mkdir() + (tmp_path / "docs" / "a.md").write_text("a") + (tmp_path / "docs" / "b.md").write_text("b") + + text = "Plans:\n- docs/a.md\n- docs/b.md" + result = linkify_markdown(text, base_dir=tmp_path) + assert "[docs/a.md](docs/a.md)" in result + assert "[docs/b.md](docs/b.md)" in result + + def test_path_in_inline_code_untouched(self) -> None: + text = "Edit `src/config/schema.py` to fix" + assert linkify_markdown(text) == text + + def test_path_in_fenced_code_untouched(self) -> None: + text = "```\nsrc/config/schema.py\n```" + assert linkify_markdown(text) == text + + def test_existing_markdown_link_untouched(self) -> None: + text = "See [config](src/config/schema.py) for details" + assert linkify_markdown(text) == text + + def test_path_without_separator_not_linked(self) -> None: + result = linkify_markdown("See readme.md for details") + assert "[readme.md]" not in result + + def test_url_not_treated_as_path(self) -> None: + result = linkify_markdown("Visit https://example.com/docs/api.json") + # Should be a URL link, not a file path link + assert "[https://example.com/docs/api.json]" in result + + def test_plan_md_extension(self, tmp_path: Path) -> None: + """The .plan.md compound extension should be recognized.""" + (tmp_path / "docs").mkdir() + (tmp_path / "docs" / "sprint.plan.md").write_text("plan") + + result = linkify_markdown("See docs/sprint.plan.md", base_dir=tmp_path) + assert "[docs/sprint.plan.md](docs/sprint.plan.md)" in result + + +# --------------------------------------------------------------------------- +# Combined / edge cases +# --------------------------------------------------------------------------- + + +class TestCombined: + """Tests for combined scenarios and edge cases.""" + + def test_mixed_urls_and_paths(self, tmp_path: Path) -> None: + (tmp_path / "docs").mkdir() + (tmp_path / "docs" / "api.md").write_text("api") + + text = "See docs/api.md and https://example.com for info" + result = linkify_markdown(text, base_dir=tmp_path) + assert "[docs/api.md](docs/api.md)" in result + assert "[https://example.com](https://example.com)" in result + + def test_empty_string(self) -> None: + assert linkify_markdown("") == "" + + def test_no_links(self) -> None: + text = "Just some plain text with no links." + assert linkify_markdown(text) == text + + def test_realistic_gate_prompt(self, tmp_path: Path) -> None: + """Simulates the exact gate prompt from the bug report.""" + (tmp_path / "docs" / "projects").mkdir(parents=True) + for name in ["area-mode.plan.md", "init-help-updates.plan.md", "recent-mode.plan.md"]: + (tmp_path / "docs" / "projects" / name).write_text("plan") + + text = ( + "Epic with 3 child issue plans found:\n\n" + "- docs/projects/area-mode.plan.md\n\n" + "- docs/projects/init-help-updates.plan.md\n\n" + "- docs/projects/recent-mode.plan.md\n\n" + "What would you like to do?" + ) + result = linkify_markdown(text, base_dir=tmp_path) + + # Whitespace should be normalized + assert "\n\n\n" not in result + + # All paths should be linkified + assert "[docs/projects/area-mode.plan.md](docs/projects/area-mode.plan.md)" in result + assert ( + "[docs/projects/init-help-updates.plan.md](docs/projects/init-help-updates.plan.md)" + in result + ) + assert "[docs/projects/recent-mode.plan.md](docs/projects/recent-mode.plan.md)" in result + + def test_path_traversal_blocked(self, tmp_path: Path) -> None: + """Paths that escape base_dir should not be linked.""" + result = linkify_markdown("See ../../../etc/passwd.txt", base_dir=tmp_path) + assert "[../../../etc/passwd.txt]" not in result From abc52088c8f7965052b3e9fae20f94f5047f0fbe Mon Sep 17 00:00:00 2001 From: Daniel Green Date: Tue, 28 Apr 2026 14:37:56 -0700 Subject: [PATCH 3/8] fix(web): add markdown table rendering to gate detail panel GateDetail's PromptMarkdown component was missing table/th/td handlers, causing markdown tables to render as raw pipe-separated text. Added the same table component overrides already used in FileViewer. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../frontend/src/components/detail/GateDetail.tsx | 12 ++++++++++++ src/conductor/web/static/index.html | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/conductor/web/frontend/src/components/detail/GateDetail.tsx b/src/conductor/web/frontend/src/components/detail/GateDetail.tsx index f366c33..b5ec3dc 100644 --- a/src/conductor/web/frontend/src/components/detail/GateDetail.tsx +++ b/src/conductor/web/frontend/src/components/detail/GateDetail.tsx @@ -431,6 +431,18 @@ function PromptMarkdown({ ), // Horizontal rule hr: () =>
    , + // Tables + table: ({ children }) => ( +
    + {children}
    +
    + ), + th: ({ children }) => ( + {children} + ), + td: ({ children }) => ( + {children} + ), }} > {text} diff --git a/src/conductor/web/static/index.html b/src/conductor/web/static/index.html index 16ffed9..5661541 100644 --- a/src/conductor/web/static/index.html +++ b/src/conductor/web/static/index.html @@ -5,8 +5,8 @@ Conductor Dashboard - - + +
    From dfd32e1496c44d4ad64e047064e33549af994a7f Mon Sep 17 00:00:00 2001 From: Daniel Green Date: Wed, 29 Apr 2026 07:38:14 -0700 Subject: [PATCH 4/8] fix(web): enable GFM tables in gate and file markdown rendering ReactMarkdown requires the remark-gfm plugin to parse GitHub Flavored Markdown extensions like tables. Without it, pipe-delimited tables render as plain text inside paragraph elements. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .gitignore | 7 +- src/conductor/web/frontend/package-lock.json | 301 ++++++++++++++++ src/conductor/web/frontend/package.json | 1 + .../src/components/detail/FileViewer.tsx | 2 + .../src/components/detail/GateDetail.tsx | 2 + .../web/static/assets/index-B6uxNJC4.js | 331 ++++++++++++++++++ src/conductor/web/static/index.html | 2 +- 7 files changed, 643 insertions(+), 3 deletions(-) create mode 100644 src/conductor/web/static/assets/index-B6uxNJC4.js diff --git a/.gitignore b/.gitignore index 757d264..fbdbbf9 100644 --- a/.gitignore +++ b/.gitignore @@ -14,8 +14,8 @@ dist/ downloads/ eggs/ .eggs/ -lib/ -lib64/ +/lib/ +/lib64/ parts/ sdist/ var/ @@ -80,3 +80,6 @@ Thumbs.db # Frontend src/conductor/web/frontend/node_modules/ +src/conductor/designer/frontend/node_modules/ + +.playwright-mcp/ diff --git a/src/conductor/web/frontend/package-lock.json b/src/conductor/web/frontend/package-lock.json index 8c81781..448f64a 100644 --- a/src/conductor/web/frontend/package-lock.json +++ b/src/conductor/web/frontend/package-lock.json @@ -16,6 +16,7 @@ "react-dom": "^19.0.0", "react-markdown": "^10.1.0", "react-resizable-panels": "^2.1.7", + "remark-gfm": "^4.0.1", "tailwind-merge": "^2.6.0", "zustand": "^5.0.3" }, @@ -60,6 +61,7 @@ "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", @@ -1661,6 +1663,7 @@ "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz", "integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==", "license": "MIT", + "peer": true, "dependencies": { "csstype": "^3.2.2" } @@ -1811,6 +1814,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", @@ -1991,6 +1995,7 @@ "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz", "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==", "license": "ISC", + "peer": true, "engines": { "node": ">=12" } @@ -2174,6 +2179,18 @@ "node": ">=6" } }, + "node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/estree-util-is-identifier-name": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/estree-util-is-identifier-name/-/estree-util-is-identifier-name-3.0.0.tgz", @@ -2695,6 +2712,32 @@ "@jridgewell/sourcemap-codec": "^1.5.5" } }, + "node_modules/markdown-table": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.4.tgz", + "integrity": "sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/mdast-util-find-and-replace": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.2.tgz", + "integrity": "sha512-Tmd1Vg/m3Xz43afeNxDIhWRtFZgM2VLyaf4vSTYwudTyeuTneoL3qtWMA5jeLyz/O1vDJmmV4QuScFCA2tBPwg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "escape-string-regexp": "^5.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/mdast-util-from-markdown": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.3.tgz", @@ -2719,6 +2762,107 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/mdast-util-gfm": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-3.1.0.tgz", + "integrity": "sha512-0ulfdQOM3ysHhCJ1p06l0b0VKlhU0wuQs3thxZQagjcjPrlFRqY215uZGHHJan9GEAXd9MbfPjFJz+qMkVR6zQ==", + "license": "MIT", + "dependencies": { + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-gfm-autolink-literal": "^2.0.0", + "mdast-util-gfm-footnote": "^2.0.0", + "mdast-util-gfm-strikethrough": "^2.0.0", + "mdast-util-gfm-table": "^2.0.0", + "mdast-util-gfm-task-list-item": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-autolink-literal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-2.0.1.tgz", + "integrity": "sha512-5HVP2MKaP6L+G6YaxPNjuL0BPrq9orG3TsrZ9YXbA3vDw/ACI4MEsnoDpn6ZNm7GnZgtAcONJyPhOP8tNJQavQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "ccount": "^2.0.0", + "devlop": "^1.0.0", + "mdast-util-find-and-replace": "^3.0.0", + "micromark-util-character": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-footnote": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-2.1.0.tgz", + "integrity": "sha512-sqpDWlsHn7Ac9GNZQMeUzPQSMzR6Wv0WKRNvQRg0KqHh02fpTz69Qc1QSseNX29bhz1ROIyNyxExfawVKTm1GQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-strikethrough": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-2.0.0.tgz", + "integrity": "sha512-mKKb915TF+OC5ptj5bJ7WFRPdYtuHv0yTRxK2tJvi+BDqbkiG7h7u/9SI89nRAYcmap2xHQL9D+QG/6wSrTtXg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-table": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-2.0.0.tgz", + "integrity": "sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "markdown-table": "^3.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-task-list-item": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-2.0.0.tgz", + "integrity": "sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/mdast-util-mdx-expression": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.1.tgz", @@ -2917,6 +3061,127 @@ "micromark-util-types": "^2.0.0" } }, + "node_modules/micromark-extension-gfm": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-3.0.0.tgz", + "integrity": "sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w==", + "license": "MIT", + "dependencies": { + "micromark-extension-gfm-autolink-literal": "^2.0.0", + "micromark-extension-gfm-footnote": "^2.0.0", + "micromark-extension-gfm-strikethrough": "^2.0.0", + "micromark-extension-gfm-table": "^2.0.0", + "micromark-extension-gfm-tagfilter": "^2.0.0", + "micromark-extension-gfm-task-list-item": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-autolink-literal": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-2.1.0.tgz", + "integrity": "sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw==", + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-footnote": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-footnote/-/micromark-extension-gfm-footnote-2.1.0.tgz", + "integrity": "sha512-/yPhxI1ntnDNsiHtzLKYnE3vf9JZ6cAisqVDauhp4CEHxlb4uoOTxOCJ+9s51bIB8U1N1FJ1RXOKTIlD5B/gqw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-strikethrough": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-2.1.0.tgz", + "integrity": "sha512-ADVjpOOkjz1hhkZLlBiYA9cR2Anf8F4HqZUO6e5eDcPQd0Txw5fxLzzxnEkSkfnD0wziSGiv7sYhk/ktvbf1uw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-table": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-2.1.1.tgz", + "integrity": "sha512-t2OU/dXXioARrC6yWfJ4hqB7rct14e8f7m0cbI5hUmDyyIlwv5vEtooptH8INkbLzOatzKuVbQmAYcbWoyz6Dg==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-tagfilter": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-2.0.0.tgz", + "integrity": "sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg==", + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-task-list-item": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-2.1.0.tgz", + "integrity": "sha512-qIBZhqxqI6fjLDYFTBIa4eivDMnP+OZqsNwmQ3xNLE4Cxwc+zfQEfbs6tzAo2Hjq+bh6q5F+Z8/cksrLFYWQQw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/micromark-factory-destination": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz", @@ -3360,6 +3625,7 @@ "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -3420,6 +3686,7 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.4.tgz", "integrity": "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ==", "license": "MIT", + "peer": true, "dependencies": { "scheduler": "^0.27.0" }, @@ -3474,6 +3741,24 @@ "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" } }, + "node_modules/remark-gfm": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-4.0.1.tgz", + "integrity": "sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-gfm": "^3.0.0", + "micromark-extension-gfm": "^3.0.0", + "remark-parse": "^11.0.0", + "remark-stringify": "^11.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/remark-parse": { "version": "11.0.0", "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz", @@ -3507,6 +3792,21 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/remark-stringify": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-11.0.0.tgz", + "integrity": "sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-to-markdown": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/rollup": { "version": "4.59.0", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.59.0.tgz", @@ -3863,6 +4163,7 @@ "integrity": "sha512-2N/55r4JDJ4gdrCvGgINMy+HH3iRpNIz8K6SFwVsA+JbQScLiC+clmAxBgwiSPgcG9U15QmvqCGWzMbqda5zGQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", diff --git a/src/conductor/web/frontend/package.json b/src/conductor/web/frontend/package.json index c9ba64e..8c56cba 100644 --- a/src/conductor/web/frontend/package.json +++ b/src/conductor/web/frontend/package.json @@ -17,6 +17,7 @@ "react-dom": "^19.0.0", "react-markdown": "^10.1.0", "react-resizable-panels": "^2.1.7", + "remark-gfm": "^4.0.1", "tailwind-merge": "^2.6.0", "zustand": "^5.0.3" }, diff --git a/src/conductor/web/frontend/src/components/detail/FileViewer.tsx b/src/conductor/web/frontend/src/components/detail/FileViewer.tsx index 43c9996..1f2670b 100644 --- a/src/conductor/web/frontend/src/components/detail/FileViewer.tsx +++ b/src/conductor/web/frontend/src/components/detail/FileViewer.tsx @@ -1,5 +1,6 @@ import { useState, useEffect, useCallback } from 'react'; import ReactMarkdown from 'react-markdown'; +import remarkGfm from 'remark-gfm'; import { X, FileText, Loader2, AlertTriangle } from 'lucide-react'; interface FileViewerProps { @@ -119,6 +120,7 @@ export function FileViewer({ filePath, onClose }: FileViewerProps) { function MarkdownContent({ content }: { content: string }) { return (

    {children}

    , h2: ({ children }) =>

    {children}

    , diff --git a/src/conductor/web/frontend/src/components/detail/GateDetail.tsx b/src/conductor/web/frontend/src/components/detail/GateDetail.tsx index b5ec3dc..1818cd5 100644 --- a/src/conductor/web/frontend/src/components/detail/GateDetail.tsx +++ b/src/conductor/web/frontend/src/components/detail/GateDetail.tsx @@ -1,5 +1,6 @@ import { useState, useEffect } from 'react'; import ReactMarkdown from 'react-markdown'; +import remarkGfm from 'remark-gfm'; import { Check, Loader2, Send, FileText } from 'lucide-react'; import { MetadataGrid } from './MetadataGrid'; import { FileViewer } from './FileViewer'; @@ -350,6 +351,7 @@ function PromptMarkdown({ return (
    ( diff --git a/src/conductor/web/static/assets/index-B6uxNJC4.js b/src/conductor/web/static/assets/index-B6uxNJC4.js new file mode 100644 index 0000000..efc773e --- /dev/null +++ b/src/conductor/web/static/assets/index-B6uxNJC4.js @@ -0,0 +1,331 @@ +var j2=Object.defineProperty;var D2=(e,n,r)=>n in e?j2(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var Ct=(e,n,r)=>D2(e,typeof n!="symbol"?n+"":n,r);function R2(e,n){for(var r=0;rl[a]})}}}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 a of document.querySelectorAll('link[rel="modulepreload"]'))l(a);new MutationObserver(a=>{for(const s of a)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 r(a){const s={};return a.integrity&&(s.integrity=a.integrity),a.referrerPolicy&&(s.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?s.credentials="include":a.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function l(a){if(a.ep)return;a.ep=!0;const s=r(a);fetch(a.href,s)}})();function Fo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var th={exports:{}},fo={};/** + * @license React + * react-jsx-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Hy;function O2(){if(Hy)return fo;Hy=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(l,a,s){var u=null;if(s!==void 0&&(u=""+s),a.key!==void 0&&(u=""+a.key),"key"in a){s={};for(var c in a)c!=="key"&&(s[c]=a[c])}else s=a;return a=s.ref,{$$typeof:e,type:l,key:u,ref:a!==void 0?a:null,props:s}}return fo.Fragment=n,fo.jsx=r,fo.jsxs=r,fo}var By;function L2(){return By||(By=1,th.exports=O2()),th.exports}var b=L2(),nh={exports:{}},Ae={};/** + * @license React + * react.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Iy;function H2(){if(Iy)return Ae;Iy=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),u=Symbol.for("react.context"),c=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"),x=Symbol.iterator;function v(I){return I===null||typeof I!="object"?null:(I=x&&I[x]||I["@@iterator"],typeof I=="function"?I:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,_={};function S(I,F,N){this.props=I,this.context=F,this.refs=_,this.updater=N||w}S.prototype.isReactComponent={},S.prototype.setState=function(I,F){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,F,"setState")},S.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function T(){}T.prototype=S.prototype;function E(I,F,N){this.props=I,this.context=F,this.refs=_,this.updater=N||w}var A=E.prototype=new T;A.constructor=E,k(A,S.prototype),A.isPureReactComponent=!0;var U=Array.isArray;function z(){}var H={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function V(I,F,N){var G=N.ref;return{$$typeof:e,type:I,key:F,ref:G!==void 0?G:null,props:N}}function O(I,F){return V(I.type,F,I.props)}function L(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function q(I){var F={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(N){return F[N]})}var ee=/\/+/g;function B(I,F){return typeof I=="object"&&I!==null&&I.key!=null?q(""+I.key):F.toString(36)}function $(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(z,z):(I.status="pending",I.then(function(F){I.status==="pending"&&(I.status="fulfilled",I.value=F)},function(F){I.status==="pending"&&(I.status="rejected",I.reason=F)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function M(I,F,N,G,X){var J=typeof I;(J==="undefined"||J==="boolean")&&(I=null);var ne=!1;if(I===null)ne=!0;else switch(J){case"bigint":case"string":case"number":ne=!0;break;case"object":switch(I.$$typeof){case e:case n:ne=!0;break;case m:return ne=I._init,M(ne(I._payload),F,N,G,X)}}if(ne)return X=X(I),ne=G===""?"."+B(I,0):G,U(X)?(N="",ne!=null&&(N=ne.replace(ee,"$&/")+"/"),M(X,F,N,"",function(xe){return xe})):X!=null&&(L(X)&&(X=O(X,N+(X.key==null||I&&I.key===X.key?"":(""+X.key).replace(ee,"$&/")+"/")+ne)),F.push(X)),1;ne=0;var re=G===""?".":G+":";if(U(I))for(var se=0;se>>1,j=M[K];if(0>>1;Ka(N,Q))Ga(X,N)?(M[K]=X,M[G]=Q,K=G):(M[K]=N,M[F]=Q,K=F);else if(Ga(X,Q))M[K]=X,M[G]=Q,K=G;else break e}}return Y}function a(M,Y){var Q=M.sortIndex-Y.sortIndex;return Q!==0?Q:M.id-Y.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,c=u.now();e.unstable_now=function(){return u.now()-c}}var d=[],h=[],m=1,p=null,x=3,v=!1,w=!1,k=!1,_=!1,S=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function A(M){for(var Y=r(h);Y!==null;){if(Y.callback===null)l(h);else if(Y.startTime<=M)l(h),Y.sortIndex=Y.expirationTime,n(d,Y);else break;Y=r(h)}}function U(M){if(k=!1,A(M),!w)if(r(d)!==null)w=!0,z||(z=!0,q());else{var Y=r(h);Y!==null&&$(U,Y.startTime-M)}}var z=!1,H=-1,R=5,V=-1;function O(){return _?!0:!(e.unstable_now()-VM&&O());){var K=p.callback;if(typeof K=="function"){p.callback=null,x=p.priorityLevel;var j=K(p.expirationTime<=M);if(M=e.unstable_now(),typeof j=="function"){p.callback=j,A(M),Y=!0;break t}p===r(d)&&l(d),A(M)}else l(d);p=r(d)}if(p!==null)Y=!0;else{var I=r(h);I!==null&&$(U,I.startTime-M),Y=!1}}break e}finally{p=null,x=Q,v=!1}Y=void 0}}finally{Y?q():z=!1}}}var q;if(typeof E=="function")q=function(){E(L)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,B=ee.port2;ee.port1.onmessage=L,q=function(){B.postMessage(null)}}else q=function(){S(L,0)};function $(M,Y){H=S(function(){M(e.unstable_now())},Y)}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(M){M.callback=null},e.unstable_forceFrameRate=function(M){0>M||125K?(M.sortIndex=Q,n(h,M),r(d)===null&&M===r(h)&&(k?(T(H),H=-1):k=!0,$(U,Q-K))):(M.sortIndex=j,n(d,M),w||v||(w=!0,z||(z=!0,q()))),M},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(M){var Y=x;return function(){var Q=x;x=Y;try{return M.apply(this,arguments)}finally{x=Q}}}})(lh)),lh}var Vy;function q2(){return Vy||(Vy=1,ih.exports=I2()),ih.exports}var ah={exports:{}},Gt={};/** + * @license React + * react-dom.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Py;function U2(){if(Py)return Gt;Py=1;var e=Xo();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(),ah.exports=U2(),ah.exports}/** + * @license React + * react-dom-client.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Gy;function V2(){if(Gy)return ho;Gy=1;var e=q2(),n=Xo(),r=nw();function l(t){var i="https://react.dev/errors/"+t;if(1j||(t.current=K[j],K[j]=null,j--)}function N(t,i){j++,K[j]=t.current,t.current=i}var G=I(null),X=I(null),J=I(null),ne=I(null);function re(t,i){switch(N(J,i),N(X,t),N(G,null),i.nodeType){case 9:case 11:t=(t=i.documentElement)&&(t=t.namespaceURI)?ay(t):0;break;default:if(t=i.tagName,i=i.namespaceURI)i=ay(i),t=oy(i,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}F(G),N(G,t)}function se(){F(G),F(X),F(J)}function xe(t){t.memoizedState!==null&&N(ne,t);var i=G.current,o=oy(i,t.type);i!==o&&(N(X,t),N(G,o))}function ve(t){X.current===t&&(F(G),F(X)),ne.current===t&&(F(ne),oo._currentValue=Q)}var ye,pe;function _e(t){if(ye===void 0)try{throw Error()}catch(o){var i=o.stack.trim().match(/\n( *(at )?)/);ye=i&&i[1]||"",pe=-1)":-1g||Z[f]!==le[g]){var ce=` +`+Z[f].replace(" at new "," at ");return t.displayName&&ce.includes("")&&(ce=ce.replace("",t.displayName)),ce}while(1<=f&&0<=g);break}}}finally{Me=!1,Error.prepareStackTrace=o}return(o=t?t.displayName||t.name:"")?_e(o):""}function ct(t,i){switch(t.tag){case 26:case 27:case 5:return _e(t.type);case 16:return _e("Lazy");case 13:return t.child!==i&&i!==null?_e("Suspense Fallback"):_e("Suspense");case 19:return _e("SuspenseList");case 0:case 15:return Te(t.type,!1);case 11:return Te(t.type.render,!1);case 1:return Te(t.type,!0);case 31:return _e("Activity");default:return""}}function nt(t){try{var i="",o=null;do i+=ct(t,o),o=t,t=t.return;while(t);return i}catch(f){return` +Error generating stack: `+f.message+` +`+f.stack}}var Mt=Object.prototype.hasOwnProperty,Vt=e.unstable_scheduleCallback,Lt=e.unstable_cancelCallback,En=e.unstable_shouldYield,Rn=e.unstable_requestPaint,jt=e.unstable_now,Lr=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,ge=e.unstable_UserBlockingPriority,Ne=e.unstable_NormalPriority,Oe=e.unstable_LowPriority,Ge=e.unstable_IdlePriority,Qt=e.log,On=e.unstable_setDisableYieldValue,Ht=null,vt=null;function Pt(t){if(typeof Qt=="function"&&On(t),vt&&typeof vt.setStrictMode=="function")try{vt.setStrictMode(Ht,t)}catch{}}var We=Math.clz32?Math.clz32:Vc,Qn=Math.log,fn=Math.LN2;function Vc(t){return t>>>=0,t===0?32:31-(Qn(t)/fn|0)|0}var ol=256,sl=262144,ul=4194304;function or(t){var i=t&42;if(i!==0)return i;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 cl(t,i,o){var f=t.pendingLanes;if(f===0)return 0;var g=0,y=t.suspendedLanes,C=t.pingedLanes;t=t.warmLanes;var D=f&134217727;return D!==0?(f=D&~y,f!==0?g=or(f):(C&=D,C!==0?g=or(C):o||(o=D&~t,o!==0&&(g=or(o))))):(D=f&~y,D!==0?g=or(D):C!==0?g=or(C):o||(o=f&~t,o!==0&&(g=or(o)))),g===0?0:i!==0&&i!==g&&(i&y)===0&&(y=g&-g,o=i&-i,y>=o||y===32&&(o&4194048)!==0)?i:g}function bi(t,i){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&i)===0}function Pc(t,i){switch(t){case 1:case 2:case 4:case 8:case 64:return i+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 i+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 os(){var t=ul;return ul<<=1,(ul&62914560)===0&&(ul=4194304),t}function ya(t){for(var i=[],o=0;31>o;o++)i.push(t);return i}function wi(t,i){t.pendingLanes|=i,i!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function $c(t,i,o,f,g,y){var C=t.pendingLanes;t.pendingLanes=o,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=o,t.entangledLanes&=o,t.errorRecoveryDisabledLanes&=o,t.shellSuspendCounter=0;var D=t.entanglements,Z=t.expirationTimes,le=t.hiddenUpdates;for(o=C&~o;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Qc=/[\n"\\]/g;function en(t){return t.replace(Qc,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Ei(t,i,o,f,g,y,C,D){t.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?t.type=C:t.removeAttribute("type"),i!=null?C==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+Wt(i)):t.value!==""+Wt(i)&&(t.value=""+Wt(i)):C!=="submit"&&C!=="reset"||t.removeAttribute("value"),i!=null?_a(t,C,Wt(i)):o!=null?_a(t,C,Wt(o)):f!=null&&t.removeAttribute("value"),g==null&&y!=null&&(t.defaultChecked=!!y),g!=null&&(t.checked=g&&typeof g!="function"&&typeof g!="symbol"),D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?t.name=""+Wt(D):t.removeAttribute("name")}function bs(t,i,o,f,g,y,C,D){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(t.type=y),i!=null||o!=null){if(!(y!=="submit"&&y!=="reset"||i!=null)){Vr(t);return}o=o!=null?""+Wt(o):"",i=i!=null?""+Wt(i):o,D||i===t.value||(t.value=i),t.defaultValue=i}f=f??g,f=typeof f!="function"&&typeof f!="symbol"&&!!f,t.checked=D?t.checked:!!f,t.defaultChecked=!!f,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(t.name=C),Vr(t)}function _a(t,i,o){i==="number"&&_i(t.ownerDocument)===t||t.defaultValue===""+o||(t.defaultValue=""+o)}function cr(t,i,o,f){if(t=t.options,i){i={};for(var g=0;g"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ef=!1;if(dr)try{var ka={};Object.defineProperty(ka,"passive",{get:function(){ef=!0}}),window.addEventListener("test",ka,ka),window.removeEventListener("test",ka,ka)}catch{ef=!1}var Pr=null,tf=null,Ss=null;function og(){if(Ss)return Ss;var t,i=tf,o=i.length,f,g="value"in Pr?Pr.value:Pr.textContent,y=g.length;for(t=0;t=Ta),hg=" ",pg=!1;function mg(t,i){switch(t){case"keyup":return ek.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var xl=!1;function nk(t,i){switch(t){case"compositionend":return gg(i);case"keypress":return i.which!==32?null:(pg=!0,hg);case"textInput":return t=i.data,t===hg&&pg?null:t;default:return null}}function rk(t,i){if(xl)return t==="compositionend"||!of&&mg(t,i)?(t=og(),Ss=tf=Pr=null,xl=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1=i)return{node:o,offset:i-t};t=f}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Eg(o)}}function Ng(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?Ng(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function Cg(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var i=_i(t.document);i instanceof t.HTMLIFrameElement;){try{var o=typeof i.contentWindow.location.href=="string"}catch{o=!1}if(o)t=i.contentWindow;else break;i=_i(t.document)}return i}function cf(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i&&(i==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||i==="textarea"||t.contentEditable==="true")}var fk=dr&&"documentMode"in document&&11>=document.documentMode,yl=null,ff=null,ja=null,df=!1;function Tg(t,i,o){var f=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;df||yl==null||yl!==_i(f)||(f=yl,"selectionStart"in f&&cf(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),ja&&Ma(ja,f)||(ja=f,f=mu(ff,"onSelect"),0>=C,g-=C,Kn=1<<32-We(i)+g|o<je?(Ue=Se,Se=null):Ue=Se.sibling;var Ze=ae(te,Se,ie[je],fe);if(Ze===null){Se===null&&(Se=Ue);break}t&&Se&&Ze.alternate===null&&i(te,Se),W=y(Ze,W,je),Qe===null?Ee=Ze:Qe.sibling=Ze,Qe=Ze,Se=Ue}if(je===ie.length)return o(te,Se),Pe&&pr(te,je),Ee;if(Se===null){for(;jeje?(Ue=Se,Se=null):Ue=Se.sibling;var fi=ae(te,Se,Ze.value,fe);if(fi===null){Se===null&&(Se=Ue);break}t&&Se&&fi.alternate===null&&i(te,Se),W=y(fi,W,je),Qe===null?Ee=fi:Qe.sibling=fi,Qe=fi,Se=Ue}if(Ze.done)return o(te,Se),Pe&&pr(te,je),Ee;if(Se===null){for(;!Ze.done;je++,Ze=ie.next())Ze=de(te,Ze.value,fe),Ze!==null&&(W=y(Ze,W,je),Qe===null?Ee=Ze:Qe.sibling=Ze,Qe=Ze);return Pe&&pr(te,je),Ee}for(Se=f(Se);!Ze.done;je++,Ze=ie.next())Ze=oe(Se,te,je,Ze.value,fe),Ze!==null&&(t&&Ze.alternate!==null&&Se.delete(Ze.key===null?je:Ze.key),W=y(Ze,W,je),Qe===null?Ee=Ze:Qe.sibling=Ze,Qe=Ze);return t&&Se.forEach(function(M2){return i(te,M2)}),Pe&&pr(te,je),Ee}function lt(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){o(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===R&&Ri(Ee)===W.type){o(te,W.sibling),fe=g(W,ie.props),Ba(fe,ie),fe.return=te,te=fe;break e}o(te,W);break}else i(te,W);W=W.sibling}ie.type===k?(fe=Ai(ie.props.children,te.mode,fe,ie.key),fe.return=te,te=fe):(fe=js(ie.type,ie.key,ie.props,null,te.mode,fe),Ba(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){o(te,W.sibling),fe=g(W,ie.children||[]),fe.return=te,te=fe;break e}else{o(te,W);break}else i(te,W);W=W.sibling}fe=vf(ie,te.mode,fe),fe.return=te,te=fe}return C(te);case R:return ie=Ri(ie),lt(te,W,ie,fe)}if($(ie))return we(te,W,ie,fe);if(q(ie)){if(Ee=q(ie),typeof Ee!="function")throw Error(l(150));return ie=Ee.call(ie),Ce(te,W,ie,fe)}if(typeof ie.then=="function")return lt(te,W,Is(ie),fe);if(ie.$$typeof===E)return lt(te,W,Os(te,ie),fe);qs(te,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,W!==null&&W.tag===6?(o(te,W.sibling),fe=g(W,ie),fe.return=te,te=fe):(o(te,W),fe=yf(ie,te.mode,fe),fe.return=te,te=fe),C(te)):o(te,W)}return function(te,W,ie,fe){try{Ha=0;var Ee=lt(te,W,ie,fe);return Al=null,Ee}catch(Se){if(Se===Tl||Se===Hs)throw Se;var Qe=hn(29,Se,null,te.mode);return Qe.lanes=fe,Qe.return=te,Qe}finally{}}}var Li=Kg(!0),Jg=Kg(!1),Xr=!1;function Mf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function jf(t,i){t=t.updateQueue,i.updateQueue===t&&(i.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Qr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Zr(t,i,o){var f=t.updateQueue;if(f===null)return null;if(f=f.shared,(Je&2)!==0){var g=f.pending;return g===null?i.next=i:(i.next=g.next,g.next=i),f.pending=i,i=Ms(t),Og(t,null,o),i}return zs(t,f,i,o),Ms(t)}function Ia(t,i,o){if(i=i.updateQueue,i!==null&&(i=i.shared,(o&4194048)!==0)){var f=i.lanes;f&=t.pendingLanes,o|=f,i.lanes=o,us(t,o)}}function Df(t,i){var o=t.updateQueue,f=t.alternate;if(f!==null&&(f=f.updateQueue,o===f)){var g=null,y=null;if(o=o.firstBaseUpdate,o!==null){do{var C={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};y===null?g=y=C:y=y.next=C,o=o.next}while(o!==null);y===null?g=y=i:y=y.next=i}else g=y=i;o={baseState:f.baseState,firstBaseUpdate:g,lastBaseUpdate:y,shared:f.shared,callbacks:f.callbacks},t.updateQueue=o;return}t=o.lastBaseUpdate,t===null?o.firstBaseUpdate=i:t.next=i,o.lastBaseUpdate=i}var Rf=!1;function qa(){if(Rf){var t=Cl;if(t!==null)throw t}}function Ua(t,i,o,f){Rf=!1;var g=t.updateQueue;Xr=!1;var y=g.firstBaseUpdate,C=g.lastBaseUpdate,D=g.shared.pending;if(D!==null){g.shared.pending=null;var Z=D,le=Z.next;Z.next=null,C===null?y=le:C.next=le,C=Z;var ce=t.alternate;ce!==null&&(ce=ce.updateQueue,D=ce.lastBaseUpdate,D!==C&&(D===null?ce.firstBaseUpdate=le:D.next=le,ce.lastBaseUpdate=Z))}if(y!==null){var de=g.baseState;C=0,ce=le=Z=null,D=y;do{var ae=D.lane&-536870913,oe=ae!==D.lane;if(oe?(qe&ae)===ae:(f&ae)===ae){ae!==0&&ae===Nl&&(Rf=!0),ce!==null&&(ce=ce.next={lane:0,tag:D.tag,payload:D.payload,callback:null,next:null});e:{var we=t,Ce=D;ae=i;var lt=o;switch(Ce.tag){case 1:if(we=Ce.payload,typeof we=="function"){de=we.call(lt,de,ae);break e}de=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=Ce.payload,ae=typeof we=="function"?we.call(lt,de,ae):we,ae==null)break e;de=p({},de,ae);break e;case 2:Xr=!0}}ae=D.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:D.tag,payload:D.payload,callback:D.callback,next:null},ce===null?(le=ce=oe,Z=de):ce=ce.next=oe,C|=ae;if(D=D.next,D===null){if(D=g.shared.pending,D===null)break;oe=D,D=oe.next,oe.next=null,g.lastBaseUpdate=oe,g.shared.pending=null}}while(!0);ce===null&&(Z=de),g.baseState=Z,g.firstBaseUpdate=le,g.lastBaseUpdate=ce,y===null&&(g.shared.lanes=0),ti|=C,t.lanes=C,t.memoizedState=de}}function Wg(t,i){if(typeof t!="function")throw Error(l(191,t));t.call(i)}function e0(t,i){var o=t.callbacks;if(o!==null)for(t.callbacks=null,t=0;ty?y:8;var C=M.T,D={};M.T=D,Wf(t,!1,i,o);try{var Z=g(),le=M.S;if(le!==null&&le(D,Z),Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var ce=bk(Z,f);$a(t,i,ce,yn(t))}else $a(t,i,f,yn(t))}catch(de){$a(t,i,{then:function(){},status:"rejected",reason:de},yn())}finally{Y.p=y,C!==null&&D.types!==null&&(C.types=D.types),M.T=C}}function Nk(){}function Kf(t,i,o,f){if(t.tag!==5)throw Error(l(476));var g=j0(t).queue;M0(t,g,i,Q,o===null?Nk:function(){return D0(t),o(f)})}function j0(t){var i=t.memoizedState;if(i!==null)return i;i={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yr,lastRenderedState:Q},next:null};var o={};return i.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yr,lastRenderedState:o},next:null},t.memoizedState=i,t=t.alternate,t!==null&&(t.memoizedState=i),i}function D0(t){var i=j0(t);i.next===null&&(i=t.alternate.memoizedState),$a(t,i.next.queue,{},yn())}function Jf(){return It(oo)}function R0(){return wt().memoizedState}function O0(){return wt().memoizedState}function Ck(t){for(var i=t.return;i!==null;){switch(i.tag){case 24:case 3:var o=yn();t=Qr(o);var f=Zr(i,t,o);f!==null&&(on(f,i,o),Ia(f,i,o)),i={cache:Cf()},t.payload=i;return}i=i.return}}function Tk(t,i,o){var f=yn();o={lane:f,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Zs(t)?H0(i,o):(o=gf(t,i,o,f),o!==null&&(on(o,t,f),B0(o,i,f)))}function L0(t,i,o){var f=yn();$a(t,i,o,f)}function $a(t,i,o,f){var g={lane:f,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Zs(t))H0(i,g);else{var y=t.alternate;if(t.lanes===0&&(y===null||y.lanes===0)&&(y=i.lastRenderedReducer,y!==null))try{var C=i.lastRenderedState,D=y(C,o);if(g.hasEagerState=!0,g.eagerState=D,dn(D,C))return zs(t,i,g,0),at===null&&As(),!1}catch{}finally{}if(o=gf(t,i,g,f),o!==null)return on(o,t,f),B0(o,i,f),!0}return!1}function Wf(t,i,o,f){if(f={lane:2,revertLane:Md(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Zs(t)){if(i)throw Error(l(479))}else i=gf(t,o,f,2),i!==null&&on(i,t,2)}function Zs(t){var i=t.alternate;return t===ze||i!==null&&i===ze}function H0(t,i){Ml=Ps=!0;var o=t.pending;o===null?i.next=i:(i.next=o.next,o.next=i),t.pending=i}function B0(t,i,o){if((o&4194048)!==0){var f=i.lanes;f&=t.pendingLanes,o|=f,i.lanes=o,us(t,o)}}var Ga={readContext:It,use:Ys,useCallback:gt,useContext:gt,useEffect:gt,useImperativeHandle:gt,useLayoutEffect:gt,useInsertionEffect:gt,useMemo:gt,useReducer:gt,useRef:gt,useState:gt,useDebugValue:gt,useDeferredValue:gt,useTransition:gt,useSyncExternalStore:gt,useId:gt,useHostTransitionStatus:gt,useFormState:gt,useActionState:gt,useOptimistic:gt,useMemoCache:gt,useCacheRefresh:gt};Ga.useEffectEvent=gt;var I0={readContext:It,use:Ys,useCallback:function(t,i){return Zt().memoizedState=[t,i===void 0?null:i],t},useContext:It,useEffect:S0,useImperativeHandle:function(t,i,o){o=o!=null?o.concat([t]):null,Xs(4194308,4,N0.bind(null,i,t),o)},useLayoutEffect:function(t,i){return Xs(4194308,4,t,i)},useInsertionEffect:function(t,i){Xs(4,2,t,i)},useMemo:function(t,i){var o=Zt();i=i===void 0?null:i;var f=t();if(Hi){Pt(!0);try{t()}finally{Pt(!1)}}return o.memoizedState=[f,i],f},useReducer:function(t,i,o){var f=Zt();if(o!==void 0){var g=o(i);if(Hi){Pt(!0);try{o(i)}finally{Pt(!1)}}}else g=i;return f.memoizedState=f.baseState=g,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:g},f.queue=t,t=t.dispatch=Tk.bind(null,ze,t),[f.memoizedState,t]},useRef:function(t){var i=Zt();return t={current:t},i.memoizedState=t},useState:function(t){t=Yf(t);var i=t.queue,o=L0.bind(null,ze,i);return i.dispatch=o,[t.memoizedState,o]},useDebugValue:Qf,useDeferredValue:function(t,i){var o=Zt();return Zf(o,t,i)},useTransition:function(){var t=Yf(!1);return t=M0.bind(null,ze,t.queue,!0,!1),Zt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,i,o){var f=ze,g=Zt();if(Pe){if(o===void 0)throw Error(l(407));o=o()}else{if(o=i(),at===null)throw Error(l(349));(qe&127)!==0||a0(f,i,o)}g.memoizedState=o;var y={value:o,getSnapshot:i};return g.queue=y,S0(s0.bind(null,f,y,t),[t]),f.flags|=2048,Dl(9,{destroy:void 0},o0.bind(null,f,y,o,i),null),o},useId:function(){var t=Zt(),i=at.identifierPrefix;if(Pe){var o=Jn,f=Kn;o=(f&~(1<<32-We(f)-1)).toString(32)+o,i="_"+i+"R_"+o,o=$s++,0<\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof f.is=="string"?C.createElement("select",{is:f.is}):C.createElement("select"),f.multiple?y.multiple=!0:f.size&&(y.size=f.size);break;default:y=typeof f.is=="string"?C.createElement(g,{is:f.is}):C.createElement(g)}}y[Dt]=i,y[$t]=f;e:for(C=i.child;C!==null;){if(C.tag===5||C.tag===6)y.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===i)break e;for(;C.sibling===null;){if(C.return===null||C.return===i)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}i.stateNode=y;e:switch(Ut(y,g,f),g){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&br(i)}}return dt(i),hd(i,i.type,t===null?null:t.memoizedProps,i.pendingProps,o),null;case 6:if(t&&i.stateNode!=null)t.memoizedProps!==f&&br(i);else{if(typeof f!="string"&&i.stateNode===null)throw Error(l(166));if(t=J.current,El(i)){if(t=i.stateNode,o=i.memoizedProps,f=null,g=Bt,g!==null)switch(g.tag){case 27:case 5:f=g.memoizedProps}t[Dt]=i,t=!!(t.nodeValue===o||f!==null&&f.suppressHydrationWarning===!0||iy(t.nodeValue,o)),t||Yr(i,!0)}else t=gu(t).createTextNode(f),t[Dt]=i,i.stateNode=t}return dt(i),null;case 31:if(o=i.memoizedState,t===null||t.memoizedState!==null){if(f=El(i),o!==null){if(t===null){if(!f)throw Error(l(318));if(t=i.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(557));t[Dt]=i}else zi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;dt(i),t=!1}else o=_f(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=o),t=!0;if(!t)return i.flags&256?(mn(i),i):(mn(i),null);if((i.flags&128)!==0)throw Error(l(558))}return dt(i),null;case 13:if(f=i.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(g=El(i),f!==null&&f.dehydrated!==null){if(t===null){if(!g)throw Error(l(318));if(g=i.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(l(317));g[Dt]=i}else zi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;dt(i),g=!1}else g=_f(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=g),g=!0;if(!g)return i.flags&256?(mn(i),i):(mn(i),null)}return mn(i),(i.flags&128)!==0?(i.lanes=o,i):(o=f!==null,t=t!==null&&t.memoizedState!==null,o&&(f=i.child,g=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(g=f.alternate.memoizedState.cachePool.pool),y=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(y=f.memoizedState.cachePool.pool),y!==g&&(f.flags|=2048)),o!==t&&o&&(i.child.flags|=8192),tu(i,i.updateQueue),dt(i),null);case 4:return se(),t===null&&Od(i.stateNode.containerInfo),dt(i),null;case 10:return gr(i.type),dt(i),null;case 19:if(F(bt),f=i.memoizedState,f===null)return dt(i),null;if(g=(i.flags&128)!==0,y=f.rendering,y===null)if(g)Fa(f,!1);else{if(xt!==0||t!==null&&(t.flags&128)!==0)for(t=i.child;t!==null;){if(y=Vs(t),y!==null){for(i.flags|=128,Fa(f,!1),t=y.updateQueue,i.updateQueue=t,tu(i,t),i.subtreeFlags=0,t=o,o=i.child;o!==null;)Lg(o,t),o=o.sibling;return N(bt,bt.current&1|2),Pe&&pr(i,f.treeForkCount),i.child}t=t.sibling}f.tail!==null&&jt()>au&&(i.flags|=128,g=!0,Fa(f,!1),i.lanes=4194304)}else{if(!g)if(t=Vs(y),t!==null){if(i.flags|=128,g=!0,t=t.updateQueue,i.updateQueue=t,tu(i,t),Fa(f,!0),f.tail===null&&f.tailMode==="hidden"&&!y.alternate&&!Pe)return dt(i),null}else 2*jt()-f.renderingStartTime>au&&o!==536870912&&(i.flags|=128,g=!0,Fa(f,!1),i.lanes=4194304);f.isBackwards?(y.sibling=i.child,i.child=y):(t=f.last,t!==null?t.sibling=y:i.child=y,f.last=y)}return f.tail!==null?(t=f.tail,f.rendering=t,f.tail=t.sibling,f.renderingStartTime=jt(),t.sibling=null,o=bt.current,N(bt,g?o&1|2:o&1),Pe&&pr(i,f.treeForkCount),t):(dt(i),null);case 22:case 23:return mn(i),Lf(),f=i.memoizedState!==null,t!==null?t.memoizedState!==null!==f&&(i.flags|=8192):f&&(i.flags|=8192),f?(o&536870912)!==0&&(i.flags&128)===0&&(dt(i),i.subtreeFlags&6&&(i.flags|=8192)):dt(i),o=i.updateQueue,o!==null&&tu(i,o.retryQueue),o=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(o=t.memoizedState.cachePool.pool),f=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(f=i.memoizedState.cachePool.pool),f!==o&&(i.flags|=2048),t!==null&&F(Di),null;case 24:return o=null,t!==null&&(o=t.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),gr(_t),dt(i),null;case 25:return null;case 30:return null}throw Error(l(156,i.tag))}function Dk(t,i){switch(wf(i),i.tag){case 1:return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return gr(_t),se(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 26:case 27:case 5:return ve(i),null;case 31:if(i.memoizedState!==null){if(mn(i),i.alternate===null)throw Error(l(340));zi()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 13:if(mn(i),t=i.memoizedState,t!==null&&t.dehydrated!==null){if(i.alternate===null)throw Error(l(340));zi()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return F(bt),null;case 4:return se(),null;case 10:return gr(i.type),null;case 22:case 23:return mn(i),Lf(),t!==null&&F(Di),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 24:return gr(_t),null;case 25:return null;default:return null}}function ux(t,i){switch(wf(i),i.tag){case 3:gr(_t),se();break;case 26:case 27:case 5:ve(i);break;case 4:se();break;case 31:i.memoizedState!==null&&mn(i);break;case 13:mn(i);break;case 19:F(bt);break;case 10:gr(i.type);break;case 22:case 23:mn(i),Lf(),t!==null&&F(Di);break;case 24:gr(_t)}}function Xa(t,i){try{var o=i.updateQueue,f=o!==null?o.lastEffect:null;if(f!==null){var g=f.next;o=g;do{if((o.tag&t)===t){f=void 0;var y=o.create,C=o.inst;f=y(),C.destroy=f}o=o.next}while(o!==g)}}catch(D){tt(i,i.return,D)}}function Wr(t,i,o){try{var f=i.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var y=g.next;f=y;do{if((f.tag&t)===t){var C=f.inst,D=C.destroy;if(D!==void 0){C.destroy=void 0,g=i;var Z=o,le=D;try{le()}catch(ce){tt(g,Z,ce)}}}f=f.next}while(f!==y)}}catch(ce){tt(i,i.return,ce)}}function cx(t){var i=t.updateQueue;if(i!==null){var o=t.stateNode;try{e0(i,o)}catch(f){tt(t,t.return,f)}}}function fx(t,i,o){o.props=Bi(t.type,t.memoizedProps),o.state=t.memoizedState;try{o.componentWillUnmount()}catch(f){tt(t,i,f)}}function Qa(t,i){try{var o=t.ref;if(o!==null){switch(t.tag){case 26:case 27:case 5:var f=t.stateNode;break;case 30:f=t.stateNode;break;default:f=t.stateNode}typeof o=="function"?t.refCleanup=o(f):o.current=f}}catch(g){tt(t,i,g)}}function Wn(t,i){var o=t.ref,f=t.refCleanup;if(o!==null)if(typeof f=="function")try{f()}catch(g){tt(t,i,g)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(g){tt(t,i,g)}else o.current=null}function dx(t){var i=t.type,o=t.memoizedProps,f=t.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":o.autoFocus&&f.focus();break e;case"img":o.src?f.src=o.src:o.srcSet&&(f.srcset=o.srcSet)}}catch(g){tt(t,t.return,g)}}function pd(t,i,o){try{var f=t.stateNode;t2(f,t.type,o,i),f[$t]=i}catch(g){tt(t,t.return,g)}}function hx(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ai(t.type)||t.tag===4}function md(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||hx(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&&ai(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 gd(t,i,o){var f=t.tag;if(f===5||f===6)t=t.stateNode,i?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(t,i):(i=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,i.appendChild(t),o=o._reactRootContainer,o!=null||i.onclick!==null||(i.onclick=fr));else if(f!==4&&(f===27&&ai(t.type)&&(o=t.stateNode,i=null),t=t.child,t!==null))for(gd(t,i,o),t=t.sibling;t!==null;)gd(t,i,o),t=t.sibling}function nu(t,i,o){var f=t.tag;if(f===5||f===6)t=t.stateNode,i?o.insertBefore(t,i):o.appendChild(t);else if(f!==4&&(f===27&&ai(t.type)&&(o=t.stateNode),t=t.child,t!==null))for(nu(t,i,o),t=t.sibling;t!==null;)nu(t,i,o),t=t.sibling}function px(t){var i=t.stateNode,o=t.memoizedProps;try{for(var f=t.type,g=i.attributes;g.length;)i.removeAttributeNode(g[0]);Ut(i,f,o),i[Dt]=t,i[$t]=o}catch(y){tt(t,t.return,y)}}var wr=!1,Nt=!1,xd=!1,mx=typeof WeakSet=="function"?WeakSet:Set,Ot=null;function Rk(t,i){if(t=t.containerInfo,Bd=_u,t=Cg(t),cf(t)){if("selectionStart"in t)var o={start:t.selectionStart,end:t.selectionEnd};else e:{o=(o=t.ownerDocument)&&o.defaultView||window;var f=o.getSelection&&o.getSelection();if(f&&f.rangeCount!==0){o=f.anchorNode;var g=f.anchorOffset,y=f.focusNode;f=f.focusOffset;try{o.nodeType,y.nodeType}catch{o=null;break e}var C=0,D=-1,Z=-1,le=0,ce=0,de=t,ae=null;t:for(;;){for(var oe;de!==o||g!==0&&de.nodeType!==3||(D=C+g),de!==y||f!==0&&de.nodeType!==3||(Z=C+f),de.nodeType===3&&(C+=de.nodeValue.length),(oe=de.firstChild)!==null;)ae=de,de=oe;for(;;){if(de===t)break t;if(ae===o&&++le===g&&(D=C),ae===y&&++ce===f&&(Z=C),(oe=de.nextSibling)!==null)break;de=ae,ae=de.parentNode}de=oe}o=D===-1||Z===-1?null:{start:D,end:Z}}else o=null}o=o||{start:0,end:0}}else o=null;for(Id={focusedElem:t,selectionRange:o},_u=!1,Ot=i;Ot!==null;)if(i=Ot,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,Ot=t;else for(;Ot!==null;){switch(i=Ot,y=i.alternate,t=i.flags,i.tag){case 0:if((t&4)!==0&&(t=i.updateQueue,t=t!==null?t.events:null,t!==null))for(o=0;o title"))),Ut(y,f,o),y[Dt]=t,St(y),f=y;break e;case"link":var C=wy("link","href",g).get(f+(o.href||""));if(C){for(var D=0;Dlt&&(C=lt,lt=Ce,Ce=C);var te=kg(D,Ce),W=kg(D,lt);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(),Ce>lt?(oe.addRange(ie),oe.extend(W.node,W.offset)):(ie.setEnd(W.node,W.offset),oe.addRange(ie))}}}}for(de=[],oe=D;oe=oe.parentNode;)oe.nodeType===1&&de.push({element:oe,left:oe.scrollLeft,top:oe.scrollTop});for(typeof D.focus=="function"&&D.focus(),D=0;Do?32:o,M.T=null,o=Ed,Ed=null;var y=ri,C=Nr;if(Rt=0,Bl=ri=null,Nr=0,(Je&6)!==0)throw Error(l(331));var D=Je;if(Je|=4,Nx(y.current),_x(y,y.current,C,o),Je=D,to(0,!1),vt&&typeof vt.onPostCommitFiberRoot=="function")try{vt.onPostCommitFiberRoot(Ht,y)}catch{}return!0}finally{Y.p=g,M.T=f,$x(t,i)}}function Yx(t,i,o){i=Nn(o,i),i=rd(t.stateNode,i,2),t=Zr(t,i,2),t!==null&&(wi(t,2),er(t))}function tt(t,i,o){if(t.tag===3)Yx(t,t,o);else for(;i!==null;){if(i.tag===3){Yx(i,t,o);break}else if(i.tag===1){var f=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(ni===null||!ni.has(f))){t=Nn(o,t),o=F0(2),f=Zr(i,o,2),f!==null&&(X0(o,f,i,t),wi(f,2),er(f));break}}i=i.return}}function Td(t,i,o){var f=t.pingCache;if(f===null){f=t.pingCache=new Hk;var g=new Set;f.set(i,g)}else g=f.get(i),g===void 0&&(g=new Set,f.set(i,g));g.has(o)||(bd=!0,g.add(o),t=Vk.bind(null,t,i,o),i.then(t,t))}function Vk(t,i,o){var f=t.pingCache;f!==null&&f.delete(i),t.pingedLanes|=t.suspendedLanes&o,t.warmLanes&=~o,at===t&&(qe&o)===o&&(xt===4||xt===3&&(qe&62914560)===qe&&300>jt()-lu?(Je&2)===0&&Il(t,0):wd|=o,Hl===qe&&(Hl=0)),er(t)}function Fx(t,i){i===0&&(i=os()),t=Ti(t,i),t!==null&&(wi(t,i),er(t))}function Pk(t){var i=t.memoizedState,o=0;i!==null&&(o=i.retryLane),Fx(t,o)}function $k(t,i){var o=0;switch(t.tag){case 31:case 13:var f=t.stateNode,g=t.memoizedState;g!==null&&(o=g.retryLane);break;case 19:f=t.stateNode;break;case 22:f=t.stateNode._retryCache;break;default:throw Error(l(314))}f!==null&&f.delete(i),Fx(t,o)}function Gk(t,i){return Vt(t,i)}var du=null,Ul=null,Ad=!1,hu=!1,zd=!1,li=0;function er(t){t!==Ul&&t.next===null&&(Ul===null?du=Ul=t:Ul=Ul.next=t),hu=!0,Ad||(Ad=!0,Fk())}function to(t,i){if(!zd&&hu){zd=!0;do for(var o=!1,f=du;f!==null;){if(t!==0){var g=f.pendingLanes;if(g===0)var y=0;else{var C=f.suspendedLanes,D=f.pingedLanes;y=(1<<31-We(42|t)+1)-1,y&=g&~(C&~D),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(o=!0,Kx(f,y))}else y=qe,y=cl(f,f===at?y:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(y&3)===0||bi(f,y)||(o=!0,Kx(f,y));f=f.next}while(o);zd=!1}}function Yk(){Xx()}function Xx(){hu=Ad=!1;var t=0;li!==0&&r2()&&(t=li);for(var i=jt(),o=null,f=du;f!==null;){var g=f.next,y=Qx(f,i);y===0?(f.next=null,o===null?du=g:o.next=g,g===null&&(Ul=o)):(o=f,(t!==0||(y&3)!==0)&&(hu=!0)),f=g}Rt!==0&&Rt!==5||to(t),li!==0&&(li=0)}function Qx(t,i){for(var o=t.suspendedLanes,f=t.pingedLanes,g=t.expirationTimes,y=t.pendingLanes&-62914561;0D)break;var ce=Z.transferSize,de=Z.initiatorType;ce&&ly(de)&&(Z=Z.responseEnd,C+=ce*(Z"u"?null:document;function xy(t,i,o){var f=Vl;if(f&&typeof i=="string"&&i){var g=en(i);g='link[rel="'+t+'"][href="'+g+'"]',typeof o=="string"&&(g+='[crossorigin="'+o+'"]'),gy.has(g)||(gy.add(g),t={rel:t,crossOrigin:o,href:i},f.querySelector(g)===null&&(i=f.createElement("link"),Ut(i,"link",t),St(i),f.head.appendChild(i)))}}function d2(t){Cr.D(t),xy("dns-prefetch",t,null)}function h2(t,i){Cr.C(t,i),xy("preconnect",t,i)}function p2(t,i,o){Cr.L(t,i,o);var f=Vl;if(f&&t&&i){var g='link[rel="preload"][as="'+en(i)+'"]';i==="image"&&o&&o.imageSrcSet?(g+='[imagesrcset="'+en(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(g+='[imagesizes="'+en(o.imageSizes)+'"]')):g+='[href="'+en(t)+'"]';var y=g;switch(i){case"style":y=Pl(t);break;case"script":y=$l(t)}jn.has(y)||(t=p({rel:"preload",href:i==="image"&&o&&o.imageSrcSet?void 0:t,as:i},o),jn.set(y,t),f.querySelector(g)!==null||i==="style"&&f.querySelector(lo(y))||i==="script"&&f.querySelector(ao(y))||(i=f.createElement("link"),Ut(i,"link",t),St(i),f.head.appendChild(i)))}}function m2(t,i){Cr.m(t,i);var o=Vl;if(o&&t){var f=i&&typeof i.as=="string"?i.as:"script",g='link[rel="modulepreload"][as="'+en(f)+'"][href="'+en(t)+'"]',y=g;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=$l(t)}if(!jn.has(y)&&(t=p({rel:"modulepreload",href:t},i),jn.set(y,t),o.querySelector(g)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(ao(y)))return}f=o.createElement("link"),Ut(f,"link",t),St(f),o.head.appendChild(f)}}}function g2(t,i,o){Cr.S(t,i,o);var f=Vl;if(f&&t){var g=qr(f).hoistableStyles,y=Pl(t);i=i||"default";var C=g.get(y);if(!C){var D={loading:0,preload:null};if(C=f.querySelector(lo(y)))D.loading=5;else{t=p({rel:"stylesheet",href:t,"data-precedence":i},o),(o=jn.get(y))&&Yd(t,o);var Z=C=f.createElement("link");St(Z),Ut(Z,"link",t),Z._p=new Promise(function(le,ce){Z.onload=le,Z.onerror=ce}),Z.addEventListener("load",function(){D.loading|=1}),Z.addEventListener("error",function(){D.loading|=2}),D.loading|=4,yu(C,i,f)}C={type:"stylesheet",instance:C,count:1,state:D},g.set(y,C)}}}function x2(t,i){Cr.X(t,i);var o=Vl;if(o&&t){var f=qr(o).hoistableScripts,g=$l(t),y=f.get(g);y||(y=o.querySelector(ao(g)),y||(t=p({src:t,async:!0},i),(i=jn.get(g))&&Fd(t,i),y=o.createElement("script"),St(y),Ut(y,"link",t),o.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},f.set(g,y))}}function y2(t,i){Cr.M(t,i);var o=Vl;if(o&&t){var f=qr(o).hoistableScripts,g=$l(t),y=f.get(g);y||(y=o.querySelector(ao(g)),y||(t=p({src:t,async:!0,type:"module"},i),(i=jn.get(g))&&Fd(t,i),y=o.createElement("script"),St(y),Ut(y,"link",t),o.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},f.set(g,y))}}function yy(t,i,o,f){var g=(g=J.current)?xu(g):null;if(!g)throw Error(l(446));switch(t){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(i=Pl(o.href),o=qr(g).hoistableStyles,f=o.get(i),f||(f={type:"style",instance:null,count:0,state:null},o.set(i,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){t=Pl(o.href);var y=qr(g).hoistableStyles,C=y.get(t);if(C||(g=g.ownerDocument||g,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(t,C),(y=g.querySelector(lo(t)))&&!y._p&&(C.instance=y,C.state.loading=5),jn.has(t)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},jn.set(t,o),y||v2(g,t,o,C.state))),i&&f===null)throw Error(l(528,""));return C}if(i&&f!==null)throw Error(l(529,""));return null;case"script":return i=o.async,o=o.src,typeof o=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=$l(o),o=qr(g).hoistableScripts,f=o.get(i),f||(f={type:"script",instance:null,count:0,state:null},o.set(i,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,t))}}function Pl(t){return'href="'+en(t)+'"'}function lo(t){return'link[rel="stylesheet"]['+t+"]"}function vy(t){return p({},t,{"data-precedence":t.precedence,precedence:null})}function v2(t,i,o,f){t.querySelector('link[rel="preload"][as="style"]['+i+"]")?f.loading=1:(i=t.createElement("link"),f.preload=i,i.addEventListener("load",function(){return f.loading|=1}),i.addEventListener("error",function(){return f.loading|=2}),Ut(i,"link",o),St(i),t.head.appendChild(i))}function $l(t){return'[src="'+en(t)+'"]'}function ao(t){return"script[async]"+t}function by(t,i,o){if(i.count++,i.instance===null)switch(i.type){case"style":var f=t.querySelector('style[data-href~="'+en(o.href)+'"]');if(f)return i.instance=f,St(f),f;var g=p({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return f=(t.ownerDocument||t).createElement("style"),St(f),Ut(f,"style",g),yu(f,o.precedence,t),i.instance=f;case"stylesheet":g=Pl(o.href);var y=t.querySelector(lo(g));if(y)return i.state.loading|=4,i.instance=y,St(y),y;f=vy(o),(g=jn.get(g))&&Yd(f,g),y=(t.ownerDocument||t).createElement("link"),St(y);var C=y;return C._p=new Promise(function(D,Z){C.onload=D,C.onerror=Z}),Ut(y,"link",f),i.state.loading|=4,yu(y,o.precedence,t),i.instance=y;case"script":return y=$l(o.src),(g=t.querySelector(ao(y)))?(i.instance=g,St(g),g):(f=o,(g=jn.get(y))&&(f=p({},o),Fd(f,g)),t=t.ownerDocument||t,g=t.createElement("script"),St(g),Ut(g,"link",f),t.head.appendChild(g),i.instance=g);case"void":return null;default:throw Error(l(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(f=i.instance,i.state.loading|=4,yu(f,o.precedence,t));return i.instance}function yu(t,i,o){for(var f=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=f.length?f[f.length-1]:null,y=g,C=0;C title"):null)}function b2(t,i,o){if(o===1||i.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return t=i.disabled,typeof i.precedence=="string"&&t==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function _y(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function w2(t,i,o,f){if(o.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var g=Pl(f.href),y=i.querySelector(lo(g));if(y){i=y._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(t.count++,t=bu.bind(t),i.then(t,t)),o.state.loading|=4,o.instance=y,St(y);return}y=i.ownerDocument||i,f=vy(f),(g=jn.get(g))&&Yd(f,g),y=y.createElement("link"),St(y);var C=y;C._p=new Promise(function(D,Z){C.onload=D,C.onerror=Z}),Ut(y,"link",f),o.instance=y}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(o,i),(i=o.state.preload)&&(o.state.loading&3)===0&&(t.count++,o=bu.bind(t),i.addEventListener("load",o),i.addEventListener("error",o))}}var Xd=0;function S2(t,i){return t.stylesheets&&t.count===0&&Su(t,t.stylesheets),0Xd?50:800)+i);return t.unsuspend=o,function(){t.unsuspend=null,clearTimeout(f),clearTimeout(g)}}:null}function bu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Su(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var wu=null;function Su(t,i){t.stylesheets=null,t.unsuspend!==null&&(t.count++,wu=new Map,i.forEach(_2,t),wu=null,bu.call(t))}function _2(t,i){if(!(i.state.loading&4)){var o=wu.get(t);if(o)var f=o.get(null);else{o=new Map,wu.set(t,o);for(var g=t.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),rh.exports=V2(),rh.exports}var $2=P2();/** + * @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=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),rw=(...e)=>e.filter((n,r,l)=>!!n&&n.trim()!==""&&l.indexOf(n)===r).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 Y2={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 F2=P.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:l,className:a="",children:s,iconNode:u,...c},d)=>P.createElement("svg",{ref:d,...Y2,width:n,height:n,stroke:e,strokeWidth:l?Number(r)*24/Number(n):r,className:rw("lucide",a),...c},[...u.map(([h,m])=>P.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 Fe=(e,n)=>{const r=P.forwardRef(({className:l,...a},s)=>P.createElement(F2,{ref:s,iconNode:n,className:rw(`lucide-${G2(e)}`,l),...a}));return r.displayName=`${e}`,r};/** + * @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 iw=Fe("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 X2=Fe("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 Yi=Fe("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 rl=Fe("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 Dr=Fe("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 Q2=Fe("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 Z2=Fe("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 K2=Fe("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 lw=Fe("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 aw=Fe("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 J2=Fe("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 W2=Fe("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 eN=Fe("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 tN=Fe("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 nN=Fe("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 rN=Fe("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 ow=Fe("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 fm=Fe("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/** + * @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 Do=Fe("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 iN=Fe("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 lN=Fe("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 dm=Fe("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 aN=Fe("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 oN=Fe("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 sN=Fe("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 uN=Fe("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 Fy=Fe("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 sw=Fe("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 cN=Fe("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 fN=Fe("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 dN=Fe("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 hN=Fe("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 Qo=Fe("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 pN=Fe("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"}]]),Xy=e=>{let n;const r=new Set,l=(h,m)=>{const p=typeof h=="function"?h(n):h;if(!Object.is(p,n)){const x=n;n=m??(typeof p!="object"||p===null)?p:Object.assign({},n,p),r.forEach(v=>v(n,x))}},a=()=>n,c={setState:l,getState:a,getInitialState:()=>d,subscribe:h=>(r.add(h),()=>r.delete(h))},d=n=e(l,a,c);return c},mN=(e=>e?Xy(e):Xy),gN=e=>e;function xN(e,n=gN){const r=Jl.useSyncExternalStore(e.subscribe,Jl.useCallback(()=>n(e.getState()),[e,n]),Jl.useCallback(()=>n(e.getInitialState()),[e,n]));return Jl.useDebugValue(r),r}const Qy=e=>{const n=mN(e),r=l=>xN(n,l);return Object.assign(r,n),r},yN=(e=>e?Qy(e):Qy);function Ke(e,n,r="agent"){return e[n]||(e[n]={name:n,status:"pending",type:r,activity:[]}),e[n].activity||(e[n].activity=[]),e[n]}function zu(e,n,r){Ke(e,n).activity.push(r)}function Ve(e,n){e[n]&&(e[n]={...e[n]})}function po(e,n,r,l){const a=e[n];if(!(a!=null&&a.for_each_items))return;const s=a.for_each_items.find(u=>u.key===r);s&&s.activity.push(l)}function vN(e,n,r){return{parentAgent:e,iteration:n,workflowFile:r,workflowName:"",status:"pending",agents:[],routes:[],parallelGroups:[],forEachGroups:[],nodes:{},groupProgress:{},highlightedEdges:[],entryPoint:null,children:[],agentsCompleted:0,agentsTotal:0,totalCost:0,totalTokens:0,eventLog:[],activityLog:[],workflowOutput:null,workflowFailure:null}}function mi(e,n){if(n.length===0)return null;let r=e[n[0]];for(let l=1;l=0;l--){const a=e[l];if(a.parentAgent===n&&(r==null||a.iteration===r))return{ctx:a,index:l}}return null}const he=yN((e,n)=>({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,wfDepth:0,subworkflowContexts:[],activeContextPath:[],viewContextPath:[],replayMode:!1,replayEvents:[],replayPosition:0,replayTotalEvents:0,replayPlaying:!1,replaySpeed:1,_wsSend:null,setWsSend:r=>{e({_wsSend:r})},sendGateResponse:(r,l,a)=>{const s=he.getState()._wsSend;s&&s({type:"gate_response",agent_name:r,selected_value:l,additional_input:a||{}})},processEvent:r=>{const l=Mu[r.type];e(a=>{const s={...a,nodes:{...a.nodes},groupProgress:{...a.groupProgress},eventLog:[...a.eventLog],activityLog:[...a.activityLog],lastEventTime:r.timestamp};l&&l(s,r.data,r.timestamp);const u=ju(r);u&&s.eventLog.push(u);const c=Du(r);return c&&s.activityLog.push(c),s})},replayState:r=>{e(l=>{const a={...l,agentsCompleted:0,totalCost:0,totalTokens:0,nodes:{},groupProgress:{},highlightedEdges:[],eventLog:[],activityLog:[],workflowOutput:null,workflowFailedAgent:null,wfDepth:0,subworkflowContexts:[],activeContextPath:[]};for(const s of r){const u=Mu[s.type];u&&u(a,s.data,s.timestamp);const c=ju(s);c&&a.eventLog.push(c);const d=Du(s);d&&a.activityLog.push(d),a.lastEventTime=s.timestamp}return a})},selectNode:r=>{e({selectedNode:r})},setReplayMode:r=>{e(l=>{const a={...l,replayMode:!0,replayEvents:r,replayTotalEvents:r.length,replayPosition:r.length,replayPlaying:!1,replaySpeed:1,agentsCompleted:0,totalCost:0,totalTokens:0,nodes:{},groupProgress:{},highlightedEdges:[],eventLog:[],activityLog:[],workflowOutput:null,workflowFailedAgent:null,wfDepth:0,subworkflowContexts:[],activeContextPath:[],viewContextPath:[]};for(const s of r){const u=Mu[s.type];u&&u(a,s.data,s.timestamp);const c=ju(s);c&&a.eventLog.push(c);const d=Du(s);d&&a.activityLog.push(d),a.lastEventTime=s.timestamp}return a})},setReplayPosition:r=>{e(l=>{const a=l.replayEvents.slice(0,r),s={...l,replayPosition:r,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,wfDepth:0,subworkflowContexts:[],activeContextPath:[],viewContextPath:[]};for(const u of a){const c=Mu[u.type];c&&c(s,u.data,u.timestamp);const d=ju(u);d&&s.eventLog.push(d);const h=Du(u);h&&s.activityLog.push(h),s.lastEventTime=u.timestamp}return s})},setReplayPlaying:r=>{e({replayPlaying:r})},setReplaySpeed:r=>{e({replaySpeed:r})},setWsStatus:r=>{e({wsStatus:r})},setEdgeHighlight:(r,l,a)=>{e(s=>({highlightedEdges:[...s.highlightedEdges.filter(u=>!(u.from===r&&u.to===l)),{from:r,to:l,state:a}]}))},clearEdgeHighlight:(r,l)=>{e(a=>({highlightedEdges:a.highlightedEdges.filter(s=>!(s.from===r&&s.to===l))}))},navigateToContext:r=>{e({viewContextPath:r,selectedNode:null})},navigateUp:()=>{e(r=>({viewContextPath:r.viewContextPath.slice(0,-1),selectedNode:null}))},navigateIntoSubworkflow:(r,l)=>{const a=n(),s=a.viewContextPath;let u;if(s.length===0)u=a.subworkflowContexts;else{const d=mi(a.subworkflowContexts,s);if(!d)return;u=d.children}const c=bN(u,r,l);c&&e({viewContextPath:[...s,c.index],selectedNode:null})},getViewedContext:()=>{const r=n();if(r.viewContextPath.length===0)return{workflowName:r.workflowName,agents:r.agents,routes:r.routes,parallelGroups:r.parallelGroups,forEachGroups:r.forEachGroups,nodes:r.nodes,groupProgress:r.groupProgress,highlightedEdges:r.highlightedEdges,entryPoint:r.entryPoint,subworkflowContexts:r.subworkflowContexts};const l=mi(r.subworkflowContexts,r.viewContextPath);return l?{workflowName:l.workflowName,agents:l.agents,routes:l.routes,parallelGroups:l.parallelGroups,forEachGroups:l.forEachGroups,nodes:l.nodes,groupProgress:l.groupProgress,highlightedEdges:l.highlightedEdges,entryPoint:l.entryPoint,subworkflowContexts:l.children}:{workflowName:r.workflowName,agents:r.agents,routes:r.routes,parallelGroups:r.parallelGroups,forEachGroups:r.forEachGroups,nodes:r.nodes,groupProgress:r.groupProgress,highlightedEdges:r.highlightedEdges,entryPoint:r.entryPoint,subworkflowContexts:r.subworkflowContexts}},getBreadcrumbs:()=>{const r=n(),l=[{label:r.workflowName||"Root",path:[]}];let a=r.subworkflowContexts;for(let s=0;s0){const n=mi(e.subworkflowContexts,e.activeContextPath);if(n)return{nodes:n.nodes,groupProgress:n.groupProgress,routes:n.routes,highlightedEdges:n.highlightedEdges,addCost:r=>{n.totalCost+=r,e.totalCost+=r},addTokens:r=>{n.totalTokens+=r,e.totalTokens+=r},incrCompleted:()=>{n.agentsCompleted++,e.agentsCompleted++}}}return{nodes:e.nodes,groupProgress:e.groupProgress,routes:e.routes,highlightedEdges:e.highlightedEdges,addCost:n=>{e.totalCost+=n},addTokens:n=>{e.totalTokens+=n},incrCompleted:()=>{e.agentsCompleted++}}}const Mu={workflow_started:(e,n,r)=>{const l=n;if(e.wfDepth===0){e.workflowStatus="running",e.workflowStartTime=r??Date.now()/1e3,e.workflowName=l.name||"",e.workflowYaml=n.yaml_source??null,e.conductorVersion=n.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||[],Ke(e.nodes,"$start","start"),e.nodes.$start.status="running",Ve(e.nodes,"$start");const a=new Set,s=new Set;for(const u of e.parallelGroups){for(const c of u.agents)a.add(c);s.add(u.name),Ke(e.nodes,u.name,"parallel_group"),e.groupProgress[u.name]={total:u.agents.length,completed:0,failed:0};for(const c of u.agents)Ke(e.nodes,c,"agent")}for(const u of e.forEachGroups)s.add(u.name),Ke(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)&&!a.has(u.name)){const c=u.type||"agent";Ke(e.nodes,u.name,c),u.model&&(e.nodes[u.name].model=u.model),s.add(u.name)}e.agentsTotal=s.size}else{const a=mi(e.subworkflowContexts,e.activeContextPath);if(a){a.workflowName=l.name||"",a.status="running",a.entryPoint=l.entry_point||null,a.agents=l.agents||[],a.routes=l.routes||[],a.parallelGroups=l.parallel_groups||[],a.forEachGroups=l.for_each_groups||[],Ke(a.nodes,"$start","start"),a.nodes.$start.status="running";const s=new Set,u=new Set;for(const c of a.parallelGroups){for(const d of c.agents)s.add(d);u.add(c.name),Ke(a.nodes,c.name,"parallel_group"),a.groupProgress[c.name]={total:c.agents.length,completed:0,failed:0};for(const d of c.agents)Ke(a.nodes,d,"agent")}for(const c of a.forEachGroups)u.add(c.name),Ke(a.nodes,c.name,"for_each_group"),a.groupProgress[c.name]={total:0,completed:0,failed:0};for(const c of a.agents)if(!u.has(c.name)&&!s.has(c.name)){const d=c.type||"agent";Ke(a.nodes,c.name,d),c.model&&(a.nodes[c.name].model=c.model),u.add(c.name)}a.agentsTotal=u.size}}e.wfDepth++},agent_started:(e,n,r)=>{const l=n,a=st(e),s=Ke(a.nodes,l.agent_name);s.iteration!=null&&(s.output!=null||s.error_type!=null)&&(s.iterationHistory||(s.iterationHistory=[]),s.iterationHistory.push({iteration:s.iteration,prompt:s.prompt,output:s.output,elapsed:s.elapsed,model:s.model,tokens:s.tokens,input_tokens:s.input_tokens,output_tokens:s.output_tokens,cost_usd:s.cost_usd,activity:s.activity,error_type:s.error_type,error_message:s.error_message})),s.status="running",s.iteration=l.iteration,s.startedAt=r??Date.now()/1e3,s.activity=[],l.context_window_max!=null&&(s.context_window_max=l.context_window_max),s.prompt=void 0,s.output=void 0,s.error_type=void 0,s.error_message=void 0,Ve(a.nodes,l.agent_name)},agent_completed:(e,n)=>{const r=n,l=st(e),a=Ke(l.nodes,r.agent_name);a.status="completed",l.incrCompleted(),a.elapsed=r.elapsed,a.model=r.model,a.tokens=r.tokens,a.input_tokens=r.input_tokens,a.output_tokens=r.output_tokens,a.cost_usd=r.cost_usd,a.output=r.output,a.output_keys=r.output_keys,a.context_window_used=r.context_window_used,a.context_window_max=r.context_window_max,r.context_window_used!=null&&r.context_window_max!=null&&r.context_window_max>0&&(a.context_pct=Math.round(r.context_window_used/r.context_window_max*100)),r.cost_usd&&l.addCost(r.cost_usd),r.tokens&&l.addTokens(r.tokens),Ve(l.nodes,r.agent_name)},agent_failed:(e,n)=>{const r=n,l=st(e),a=Ke(l.nodes,r.agent_name);a.status="failed",a.elapsed=r.elapsed,a.error_type=r.error_type,a.error_message=r.message;for(const s of l.routes)s.to===r.agent_name&&l.highlightedEdges.push({from:s.from,to:s.to,state:"failed"});Ve(l.nodes,r.agent_name)},agent_prompt_rendered:(e,n)=>{var u;const r=n,l=n.item_key,a=st(e),s=Ke(a.nodes,r.agent_name);if(s.prompt=r.rendered_prompt,s.context_keys=r.context_keys,l){po(a.nodes,r.agent_name,l,{type:"prompt",icon:"📝",label:"prompt",text:"Prompt rendered",detail:((u=r.rendered_prompt)==null?void 0:u.slice(0,500))||null});const c=a.nodes[r.agent_name];if(c!=null&&c.for_each_items){const d=c.for_each_items.find(h=>h.key===l);d&&(d.prompt=r.rendered_prompt)}}Ve(a.nodes,r.agent_name)},agent_reasoning:(e,n)=>{const r=n,l=n.item_key,a=st(e),s={type:"reasoning",icon:"💭",label:"thinking",text:r.content};zu(a.nodes,r.agent_name,s),l&&po(a.nodes,r.agent_name,l,s),Ve(a.nodes,r.agent_name)},agent_tool_start:(e,n)=>{const r=n,l=n.item_key,a=st(e),s={type:"tool-start",icon:"🔧",label:"tool",text:r.tool_name,detail:r.arguments||null};zu(a.nodes,r.agent_name,s),l&&po(a.nodes,r.agent_name,l,s),Ve(a.nodes,r.agent_name)},agent_tool_complete:(e,n)=>{const r=n,l=n.item_key,a=st(e),s={type:"tool-complete",icon:"✓",label:"result",text:r.tool_name||"done",detail:r.result||null};zu(a.nodes,r.agent_name,s),l&&po(a.nodes,r.agent_name,l,s),Ve(a.nodes,r.agent_name)},agent_turn_start:(e,n)=>{const r=n,l=n.item_key,a=st(e),s={type:"turn",icon:"⏳",label:"turn",text:`Turn ${r.turn??"?"}`};zu(a.nodes,r.agent_name,s),l&&po(a.nodes,r.agent_name,l,s),Ve(a.nodes,r.agent_name)},agent_message:(e,n)=>{const r=n,l=st(e),a=Ke(l.nodes,r.agent_name);a.latest_message=r.content,Ve(l.nodes,r.agent_name)},script_started:(e,n,r)=>{const l=n,a=st(e),s=Ke(a.nodes,l.agent_name);s.status="running",s.startedAt=r??Date.now()/1e3,Ve(a.nodes,l.agent_name)},script_completed:(e,n)=>{const r=n,l=st(e),a=Ke(l.nodes,r.agent_name);a.status="completed",l.incrCompleted(),a.elapsed=r.elapsed,a.stdout=r.stdout,a.stderr=r.stderr,a.exit_code=r.exit_code,Ve(l.nodes,r.agent_name)},script_failed:(e,n)=>{const r=n,l=st(e),a=Ke(l.nodes,r.agent_name);a.status="failed",a.elapsed=r.elapsed,a.error_type=r.error_type,a.error_message=r.message,Ve(l.nodes,r.agent_name)},gate_presented:(e,n)=>{const r=n,l=st(e),a=Ke(l.nodes,r.agent_name);a.status="waiting",a.options=r.options,a.option_details=r.option_details,a.prompt=r.prompt,Ve(l.nodes,r.agent_name)},gate_resolved:(e,n)=>{const r=n,l=st(e),a=Ke(l.nodes,r.agent_name);a.status="completed",l.incrCompleted(),a.selected_option=r.selected_option,a.route=r.route,a.additional_input=r.additional_input,Ve(l.nodes,r.agent_name)},route_taken:(e,n)=>{const r=n;st(e).highlightedEdges.push({from:r.from_agent,to:r.to_agent,state:"taken"})},parallel_started:(e,n)=>{const r=n,l=st(e),a=Ke(l.nodes,r.group_name,"parallel_group");a.status="running",l.groupProgress[r.group_name]&&(l.groupProgress[r.group_name].total=r.agents.length,l.groupProgress[r.group_name].completed=0,l.groupProgress[r.group_name].failed=0),Ve(l.nodes,r.group_name)},parallel_agent_completed:(e,n)=>{const r=n,l=st(e);l.groupProgress[r.group_name]&&l.groupProgress[r.group_name].completed++;const a=Ke(l.nodes,r.agent_name);a.status="completed",a.elapsed=r.elapsed,a.model=r.model,a.tokens=r.tokens,a.cost_usd=r.cost_usd,a.context_window_used=r.context_window_used,a.context_window_max=r.context_window_max,r.context_window_used!=null&&r.context_window_max!=null&&r.context_window_max>0&&(a.context_pct=Math.round(r.context_window_used/r.context_window_max*100)),r.cost_usd&&l.addCost(r.cost_usd),r.tokens&&l.addTokens(r.tokens),Ve(l.nodes,r.agent_name),Ve(l.nodes,r.group_name)},parallel_agent_failed:(e,n)=>{const r=n,l=st(e);l.groupProgress[r.group_name]&&l.groupProgress[r.group_name].failed++;const a=Ke(l.nodes,r.agent_name);a.status="failed",a.elapsed=r.elapsed,a.error_type=r.error_type,a.error_message=r.message,Ve(l.nodes,r.agent_name),Ve(l.nodes,r.group_name)},parallel_completed:(e,n)=>{const r=n,l=st(e);l.incrCompleted();const a=Ke(l.nodes,r.group_name,"parallel_group");a.status=r.failure_count===0?"completed":"failed",Ve(l.nodes,r.group_name)},for_each_started:(e,n)=>{const r=n,l=st(e),a=Ke(l.nodes,r.group_name,"for_each_group");a.status="running",a.for_each_items=[],l.groupProgress[r.group_name]&&(l.groupProgress[r.group_name].total=r.item_count,l.groupProgress[r.group_name].completed=0,l.groupProgress[r.group_name].failed=0),Ve(l.nodes,r.group_name)},for_each_item_started:(e,n)=>{const r=n,l=st(e),a=Ke(l.nodes,r.group_name,"for_each_group");a.for_each_items||(a.for_each_items=[]),a.for_each_items.push({key:r.item_key??String(r.index),index:r.index,status:"running",activity:[]}),Ve(l.nodes,r.group_name)},for_each_item_completed:(e,n)=>{const r=n,l=st(e);l.groupProgress[r.group_name]&&l.groupProgress[r.group_name].completed++;const a=Ke(l.nodes,r.group_name,"for_each_group");if(a.for_each_items){const s=r.item_key??String(r.index),u=a.for_each_items.find(c=>c.key===s);u&&(u.status="completed",u.elapsed=r.elapsed,u.tokens=r.tokens,u.cost_usd=r.cost_usd,u.output=r.output)}Ve(l.nodes,r.group_name)},for_each_item_failed:(e,n)=>{const r=n,l=st(e);l.groupProgress[r.group_name]&&l.groupProgress[r.group_name].failed++;const a=Ke(l.nodes,r.group_name,"for_each_group");if(a.for_each_items){const s=r.item_key??String(r.index),u=a.for_each_items.find(c=>c.key===s);u&&(u.status="failed",u.elapsed=r.elapsed,u.error_type=r.error_type,u.error_message=r.message)}Ve(l.nodes,r.group_name)},for_each_completed:(e,n)=>{const r=n,l=st(e);l.incrCompleted();const a=Ke(l.nodes,r.group_name,"for_each_group");a.status=(r.failure_count??0)===0?"completed":"failed",a.elapsed=r.elapsed,a.success_count=r.success_count,a.failure_count=r.failure_count,Ve(l.nodes,r.group_name)},workflow_completed:(e,n)=>{if(e.wfDepth=Math.max(0,e.wfDepth-1),e.wfDepth===0){const r=n;e.workflowStatus="completed",e.isPaused=!1,e.workflowOutput=r.output??null,e.nodes.$end&&(e.nodes.$end.status="completed",Ve(e.nodes,"$end")),e.nodes.$start&&(e.nodes.$start.status="completed",Ve(e.nodes,"$start")),e.highlightedEdges=[]}else{const r=mi(e.subworkflowContexts,e.activeContextPath);if(r){const l=n;r.status="completed",r.workflowOutput=l.output??null,r.nodes.$end&&(r.nodes.$end.status="completed"),r.nodes.$start&&(r.nodes.$start.status="completed"),r.highlightedEdges=[]}e.activeContextPath=e.activeContextPath.slice(0,-1)}},workflow_failed:(e,n)=>{e.wfDepth=Math.max(0,e.wfDepth-1);const r=n;if(e.wfDepth===0){if(e.workflowStatus="failed",e.isPaused=!1,e.workflowFailedAgent=r.agent_name||null,r.agent_name&&e.nodes[r.agent_name]){e.nodes[r.agent_name].status="failed",Ve(e.nodes,r.agent_name);for(const l of e.routes)l.to===r.agent_name&&e.highlightedEdges.push({from:l.from,to:l.to,state:"failed"})}e.workflowFailure={error_type:r.error_type,message:r.message,elapsed_seconds:r.elapsed_seconds,timeout_seconds:r.timeout_seconds,current_agent:r.current_agent},e.nodes.$start&&(e.nodes.$start.status="completed",Ve(e.nodes,"$start"))}else{const l=mi(e.subworkflowContexts,e.activeContextPath);l&&(l.status="failed",l.workflowFailure={error_type:r.error_type,message:r.message}),e.activeContextPath=e.activeContextPath.slice(0,-1)}},subworkflow_started:(e,n)=>{const r=n,l=vN(r.agent_name,r.iteration??1,r.workflow);if(e.activeContextPath.length===0)e.subworkflowContexts.push(l),e.activeContextPath=[e.subworkflowContexts.length-1];else{const s=mi(e.subworkflowContexts,e.activeContextPath);s&&(s.children.push(l),e.activeContextPath=[...e.activeContextPath,s.children.length-1])}const a=e.activeContextPath.slice(0,-1);if(a.length===0){const s=e.nodes[r.agent_name];s&&(s.status="running",Ve(e.nodes,r.agent_name))}else{const s=mi(e.subworkflowContexts,a);if(s){const u=s.nodes[r.agent_name];u&&(u.status="running",Ve(s.nodes,r.agent_name))}}},subworkflow_completed:(e,n)=>{const r=n,l=st(e),a=l.nodes[r.agent_name];a&&(a.status="completed",a.elapsed=r.elapsed,l.incrCompleted(),Ve(l.nodes,r.agent_name))},subworkflow_failed:(e,n)=>{const r=n,l=st(e),a=l.nodes[r.agent_name];a&&(a.status="failed",a.elapsed=r.elapsed,a.error_type=r.error_type,a.error_message=r.message,Ve(l.nodes,r.agent_name))},checkpoint_saved:(e,n)=>{const r=n;r.path&&e.workflowFailure&&(e.workflowFailure={...e.workflowFailure,checkpoint_path:r.path})},agent_paused:(e,n)=>{const r=n,l=Ke(e.nodes,r.agent_name);l.status="waiting",l.activity.push({type:"agent_paused",icon:"⏸",label:"Paused",text:"Agent paused — click Resume to re-execute"}),Ve(e.nodes,r.agent_name),e.isPaused=!0},agent_resumed:(e,n)=>{const r=n,l=Ke(e.nodes,r.agent_name);l.status="running",l.activity.push({type:"agent_resumed",icon:"▶",label:"Resumed",text:"Agent resumed — re-executing"}),Ve(e.nodes,r.agent_name),e.isPaused=!1}};function ju(e){var l,a;const n=e.timestamp,r=e.data;switch(e.type){case"workflow_started":return{timestamp:n,level:"info",source:"workflow",message:`Workflow "${r.name||""}" started`};case"agent_started":return{timestamp:n,level:"info",source:String(r.agent_name),message:`Agent started${r.iteration!=null?` (iteration ${r.iteration})`:""}`};case"agent_completed":return{timestamp:n,level:"success",source:String(r.agent_name),message:`Agent completed${r.elapsed!=null?` in ${Xu(r.elapsed)}`:""}${r.tokens!=null?` · ${r.tokens.toLocaleString()} tokens`:""}${r.cost_usd!=null?` · $${r.cost_usd.toFixed(4)}`:""}`};case"agent_failed":return{timestamp:n,level:"error",source:String(r.agent_name),message:`Agent failed: ${r.message||r.error_type||"unknown error"}`};case"script_started":return{timestamp:n,level:"info",source:String(r.agent_name),message:"Script started"};case"script_completed":return{timestamp:n,level:"success",source:String(r.agent_name),message:`Script completed (exit ${r.exit_code??"?"})${r.elapsed!=null?` in ${Xu(r.elapsed)}`:""}`};case"script_failed":return{timestamp:n,level:"error",source:String(r.agent_name),message:`Script failed: ${r.message||r.error_type||"unknown error"}`};case"gate_presented":return{timestamp:n,level:"warning",source:String(r.agent_name),message:"Waiting for human input…"};case"gate_resolved":return{timestamp:n,level:"success",source:String(r.agent_name),message:`Gate resolved → ${r.selected_option||"continue"}`};case"route_taken":return{timestamp:n,level:"debug",source:"router",message:`${r.from_agent} → ${r.to_agent}`};case"parallel_started":return{timestamp:n,level:"info",source:String(r.group_name),message:`Parallel group started (${((l=r.agents)==null?void 0:l.length)||"?"} agents)`};case"parallel_completed":return{timestamp:n,level:r.failure_count===0?"success":"error",source:String(r.group_name),message:`Parallel group completed${r.failure_count>0?` with ${r.failure_count} failure(s)`:""}`};case"for_each_started":return{timestamp:n,level:"info",source:String(r.group_name),message:`For-each started (${r.item_count} items)`};case"for_each_completed":return{timestamp:n,level:(r.failure_count??0)===0?"success":"error",source:String(r.group_name),message:`For-each completed · ${r.success_count} succeeded${r.failure_count>0?` · ${r.failure_count} failed`:""}`};case"workflow_completed":return{timestamp:n,level:"success",source:"workflow",message:`Workflow completed${r.elapsed!=null?` in ${Xu(r.elapsed)}`:""}`};case"workflow_failed":return{timestamp:n,level:"error",source:"workflow",message:`Workflow failed: ${r.message||r.error_type||"unknown error"}`};case"checkpoint_saved":return{timestamp:n,level:"info",source:"workflow",message:`Checkpoint saved: ${((a=r.path)==null?void 0:a.split("/").pop())||"unknown"}`};case"agent_paused":return{timestamp:n,level:"warning",source:String(r.agent_name),message:"Agent paused — waiting for resume"};case"agent_resumed":return{timestamp:n,level:"info",source:String(r.agent_name),message:"Agent resumed — re-executing"};default:return null}}function Xu(e){if(e<1)return`${(e*1e3).toFixed(0)}ms`;if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e/60),r=(e%60).toFixed(0);return`${n}m ${r}s`}function Du(e){const n=e.timestamp,r=e.data;switch(e.type){case"agent_started":return{timestamp:n,source:String(r.agent_name),type:"turn",message:`Agent started${r.iteration!=null?` (iteration ${r.iteration})`:""}`};case"agent_prompt_rendered":return{timestamp:n,source:String(r.agent_name),type:"prompt",message:"Prompt rendered",detail:mo(String(r.rendered_prompt||""),500)};case"agent_reasoning":return{timestamp:n,source:String(r.agent_name),type:"reasoning",message:String(r.content||"")};case"agent_tool_start":return{timestamp:n,source:String(r.agent_name),type:"tool-start",message:`→ ${r.tool_name}`,detail:r.arguments?mo(String(r.arguments),300):null};case"agent_tool_complete":return{timestamp:n,source:String(r.agent_name),type:"tool-complete",message:`← ${r.tool_name||"done"}`,detail:r.result?mo(String(r.result),300):null};case"agent_turn_start":return{timestamp:n,source:String(r.agent_name),type:"turn",message:`Turn ${r.turn??"?"}`};case"agent_message":return{timestamp:n,source:String(r.agent_name),type:"message",message:mo(String(r.content||""),500)};case"agent_completed":return{timestamp:n,source:String(r.agent_name),type:"turn",message:`Completed${r.elapsed!=null?` in ${Xu(r.elapsed)}`:""}${r.tokens!=null?` · ${r.tokens.toLocaleString()} tokens`:""}`};case"agent_failed":return{timestamp:n,source:String(r.agent_name),type:"turn",message:`Failed: ${r.message||r.error_type||"unknown"}`};case"script_started":return{timestamp:n,source:String(r.agent_name),type:"turn",message:"Script started"};case"script_completed":return{timestamp:n,source:String(r.agent_name),type:"tool-complete",message:`Script completed (exit ${r.exit_code??"?"})`,detail:r.stdout?mo(String(r.stdout),300):null};case"script_failed":return{timestamp:n,source:String(r.agent_name),type:"turn",message:`Script failed: ${r.message||r.error_type||"unknown"}`};default:return null}}function mo(e,n){return e.length<=n?e:e.slice(0,n)+"…"}function Zy(e){const n=e.match(/^(\s*)/);return n?n[1].length:0}function wN(e){const n=new Map;for(let r=0;ra)s=u;else break}s>r&&n.set(r,s)}return n}function SN(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,a,s,u,c]=n;return b.jsxs("span",{children:[l,a??"",b.jsx("span",{className:"text-sky-400",children:s}),b.jsx("span",{className:"text-[var(--text-muted)]",children:u}),Ky(c)]})}const r=e.match(/^(\s*)(- )(.*)/);if(r){const[,l,a,s]=r;return b.jsxs("span",{children:[l,b.jsx("span",{className:"text-[var(--text-muted)]",children:a}),Ky(s)]})}return b.jsx("span",{children:e})}function Ky(e){if(!e)return"";const n=e.indexOf(" #"),r=n>=0?e.slice(0,n):e,l=n>=0?e.slice(n):"";let a=r;return/^(true|false|null|yes|no)$/i.test(r.trim())?a=b.jsx("span",{className:"text-amber-400",children:r}):/^\d+(\.\d+)?$/.test(r.trim())?a=b.jsx("span",{className:"text-amber-400",children:r}):/^["'].*["']$/.test(r.trim())?a=b.jsx("span",{className:"text-green-400",children:r}):(r.includes("|")||r.includes(">"))&&(a=b.jsx("span",{className:"text-[var(--text-secondary)]",children:r})),b.jsxs(b.Fragment,{children:[a,l&&b.jsx("span",{className:"text-emerald-500/70",children:l})]})}function _N({yaml:e,onClose:n}){const[r,l]=P.useState(new Set);P.useEffect(()=>{const d=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[n]);const a=P.useMemo(()=>e.split(` +`),[e]),s=P.useMemo(()=>wN(a),[a]),u=P.useCallback(d=>{l(h=>{const m=new Set(h);return m.has(d)?m.delete(d):m.add(d),m})},[]),c=P.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(Dr,{className:"w-3 h-3"}):b.jsx(rl,{className:"w-3 h-3"})}):null}),b.jsxs("span",{className:"flex-1",children:[SN(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 EN(){const e=he(S=>S.workflowName),n=he(S=>S.workflowStatus),r=he(S=>S.isPaused),l=he(S=>S.workflowYaml),a=he(S=>S.conductorVersion),[s,u]=P.useState(!1),[c,d]=P.useState(!1),[h,m]=P.useState(!1),[p,x]=P.useState(!1),v=n==="running"||n==="pending";P.useEffect(()=>{r||(u(!1),d(!1),m(!1))},[r]);const w=async()=>{u(!0);try{await fetch("/api/stop",{method:"POST"})}catch(S){console.error("Failed to stop agent:",S),u(!1)}},k=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(iw,{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:[r?b.jsxs(b.Fragment,{children:[b.jsxs("button",{onClick:k,disabled:c,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(dm,{className:"w-3 h-3"}),c?"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(Qo,{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(sw,{className:"w-3 h-3"}),s?"Stopping...":"Stop"]}):null,l&&b.jsxs("button",{onClick:()=>x(!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",a??"—"]})]}),p&&l&&b.jsx(_N,{yaml:l,onClose:()=>x(!1)})]})}function kN(){const e=he(s=>s.getBreadcrumbs),n=he(s=>s.navigateToContext),r=he(s=>s.viewContextPath);if(he(s=>s.subworkflowContexts).length===0&&r.length===0)return null;const a=e();return b.jsxs("div",{className:"flex items-center gap-1 px-4 py-1.5 bg-[var(--surface)] border-b border-[var(--border)] text-xs flex-shrink-0",children:[b.jsx(fm,{className:"w-3 h-3 text-[var(--text-muted)] mr-1"}),a.map((s,u)=>{const c=u===a.length-1,d=JSON.stringify(s.path)===JSON.stringify(r);return b.jsxs("span",{className:"flex items-center gap-1",children:[u>0&&b.jsx(Dr,{className:"w-3 h-3 text-[var(--text-muted)]"}),c?b.jsx("span",{className:"font-semibold text-[var(--text)]",children:s.label}):b.jsx("button",{onClick:()=>n(s.path),className:`hover:text-[var(--running)] transition-colors ${d?"text-[var(--text)] font-medium":"text-[var(--text-muted)]"}`,children:s.label})]},u)})]})}function Be(...e){return e.filter(Boolean).join(" ")}function Jt(e){if(e==null)return"";if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e/60),r=(e%60).toFixed(0);return`${n}m ${r}s`}function $n(e){return e==null?"":e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:`${e}`}function yi(e){return e==null?"":`$${e.toFixed(4)}`}function uw(e){return e==null?"":typeof e=="string"?e:JSON.stringify(e,null,2)}function NN(e,n){if(n<=0)return`${e.toLocaleString()} tokens (limit unknown)`;const r=a=>a.toLocaleString(),l=(e/n*100).toFixed(1);return`${r(e)} / ${r(n)} (${l}%)`}function cw(){const e=he(c=>c.workflowStatus),n=he(c=>c.workflowStartTime),r=he(c=>c.replayMode),l=he(c=>c.lastEventTime),[a,s]=P.useState("—"),u=P.useRef(null);return P.useEffect(()=>{if(n!=null){if(r){u.current&&(clearInterval(u.current),u.current=null),s(Jt((l??n)-n));return}if(e==="running"){const c=()=>{const d=Date.now()/1e3-n;s(Jt(d))};return c(),u.current=setInterval(c,500),()=>{u.current&&clearInterval(u.current)}}else(e==="completed"||e==="failed")&&u.current&&(clearInterval(u.current),u.current=null)}},[e,n,r,l]),a}function CN(){const e=he(k=>k.workflowStatus),n=he(k=>k.agentsCompleted),r=he(k=>k.agentsTotal),l=he(k=>k.totalCost),a=he(k=>k.totalTokens),s=he(k=>k.wsStatus),u=he(k=>k.workflowFailure),c=he(k=>k.lastEventTime),d=cw(),[h,m]=P.useState(null);P.useEffect(()=>{if(e!=="running"||c==null){m(null);return}const k=()=>{m(Math.floor(Date.now()/1e3-c))};k();const _=setInterval(k,1e3);return()=>clearInterval(_)},[e,c]);const p=e==="failed",x=(()=>{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(hN,{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(dN,{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(Do,{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(Do,{className:"w-3 h-3 animate-spin"}),b.jsx("span",{children:"Connecting\\u2026"})]})}})();return b.jsxs("footer",{className:Be("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:Be("w-2 h-2 rounded-full flex-shrink-0",v)}),b.jsx("span",{className:Be(p?"text-red-300":"text-[var(--text)]"),children:x}),r>0&&b.jsxs("span",{className:Be(p?"text-red-400/60":"text-[var(--text-muted)]"),children:[n,"/",r," agents"]}),e!=="pending"&&b.jsx("span",{className:Be("font-mono",p?"text-red-400/60":"text-[var(--text-muted)]"),children:d}),a>0&&b.jsxs("span",{className:Be("flex items-center gap-1",p?"text-red-400/60":"text-[var(--text-muted)]"),title:"Total tokens used",children:[b.jsx(ow,{className:"w-3 h-3"}),b.jsx("span",{className:"font-mono",children:a.toLocaleString()})]}),l>0&&b.jsxs("span",{className:Be("flex items-center gap-1",p?"text-red-400/60":"text-[var(--text-muted)]"),title:"Total cost",children:[b.jsx(lw,{className:"w-3 h-3"}),b.jsxs("span",{className:"font-mono",children:["$",l.toFixed(4)]})]}),h!=null&&h>=5&&b.jsxs("span",{className:Be("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(K2,{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 TN=[1,5,10,20,50];function AN(e,n){if(n===0||e.length===0)return"+0.0s";const r=e[0].timestamp,a=e[Math.min(n,e.length)-1].timestamp-r;if(a<60)return`+${a.toFixed(1)}s`;const s=Math.floor(a/60),u=a%60;return`+${s}m${u.toFixed(0)}s`}function zN(){const e=he(p=>p.replayPosition),n=he(p=>p.replayTotalEvents),r=he(p=>p.replayPlaying),l=he(p=>p.replaySpeed),a=he(p=>p.replayEvents),s=he(p=>p.setReplayPosition),u=he(p=>p.setReplayPlaying),c=he(p=>p.setReplaySpeed),d=p=>{const x=parseInt(p.target.value,10);s(x),r&&u(!1)},h=()=>{!r&&e>=n&&s(0),u(!r)},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:r?"Pause":"Play",children:r?b.jsx(lN,{className:"w-3.5 h-3.5"}):b.jsx(dm,{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; + height: 12px; + border-radius: 50%; + background: var(--accent); + border: 2px solid var(--surface); + cursor: pointer; + box-shadow: 0 0 4px rgba(99, 102, 241, 0.4); + } + footer input[type="range"]::-moz-range-thumb { + width: 12px; + height: 12px; + border-radius: 50%; + background: var(--accent); + border: 2px solid var(--surface); + 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:AN(a,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:TN.map(p=>b.jsxs("button",{onClick:()=>c(p),className:Be("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 wc=P.createContext(null);wc.displayName="PanelGroupContext";const yt={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"},hm=10,Fi=P.useLayoutEffect,Jy=B2.useId,MN=typeof Jy=="function"?Jy:()=>null;let jN=0;function pm(e=null){const n=MN(),r=P.useRef(e||n||null);return r.current===null&&(r.current=""+jN++),e??r.current}function fw({children:e,className:n="",collapsedSize:r,collapsible:l,defaultSize:a,forwardedRef:s,id:u,maxSize:c,minSize:d,onCollapse:h,onExpand:m,onResize:p,order:x,style:v,tagName:w="div",...k}){const _=P.useContext(wc);if(_===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:S,expandPanel:T,getPanelSize:E,getPanelStyle:A,groupId:U,isPanelCollapsed:z,reevaluatePanelConstraints:H,registerPanel:R,resizePanel:V,unregisterPanel:O}=_,L=pm(u),q=P.useRef({callbacks:{onCollapse:h,onExpand:m,onResize:p},constraints:{collapsedSize:r,collapsible:l,defaultSize:a,maxSize:c,minSize:d},id:L,idIsFromProps:u!==void 0,order:x});P.useRef({didLogMissingDefaultSizeWarning:!1}),Fi(()=>{const{callbacks:B,constraints:$}=q.current,M={...$};q.current.id=L,q.current.idIsFromProps=u!==void 0,q.current.order=x,B.onCollapse=h,B.onExpand=m,B.onResize=p,$.collapsedSize=r,$.collapsible=l,$.defaultSize=a,$.maxSize=c,$.minSize=d,(M.collapsedSize!==$.collapsedSize||M.collapsible!==$.collapsible||M.maxSize!==$.maxSize||M.minSize!==$.minSize)&&H(q.current,M)}),Fi(()=>{const B=q.current;return R(B),()=>{O(B)}},[x,L,R,O]),P.useImperativeHandle(s,()=>({collapse:()=>{S(q.current)},expand:B=>{T(q.current,B)},getId(){return L},getSize(){return E(q.current)},isCollapsed(){return z(q.current)},isExpanded(){return!z(q.current)},resize:B=>{V(q.current,B)}}),[S,T,E,z,L,V]);const ee=A(q.current,a);return P.createElement(w,{...k,children:e,className:n,id:L,style:{...ee,...v},[yt.groupId]:U,[yt.panel]:"",[yt.panelCollapsible]:l||void 0,[yt.panelId]:L,[yt.panelSize]:parseFloat(""+ee.flexGrow).toFixed(1)})}const So=P.forwardRef((e,n)=>P.createElement(fw,{...e,forwardedRef:n}));fw.displayName="Panel";So.displayName="forwardRef(Panel)";let Hp=null,Qu=-1,gi=null;function DN(e,n){if(n){const r=(n&gw)!==0,l=(n&xw)!==0,a=(n&yw)!==0,s=(n&vw)!==0;if(r)return a?"se-resize":s?"ne-resize":"e-resize";if(l)return a?"sw-resize":s?"nw-resize":"w-resize";if(a)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 RN(){gi!==null&&(document.head.removeChild(gi),Hp=null,gi=null,Qu=-1)}function oh(e,n){var r,l;const a=DN(e,n);if(Hp!==a){if(Hp=a,gi===null&&(gi=document.createElement("style"),document.head.appendChild(gi)),Qu>=0){var s;(s=gi.sheet)===null||s===void 0||s.removeRule(Qu)}Qu=(r=(l=gi.sheet)===null||l===void 0?void 0:l.insertRule(`*{cursor: ${a} !important;}`))!==null&&r!==void 0?r:-1}}function dw(e){return e.type==="keydown"}function hw(e){return e.type.startsWith("pointer")}function pw(e){return e.type.startsWith("mouse")}function Sc(e){if(hw(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(pw(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function ON(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function LN(e,n,r){return e.xn.x&&e.yn.y}function HN(e,n){if(e===n)throw new Error("Cannot compare node with itself");const r={a:tv(e),b:tv(n)};let l;for(;r.a.at(-1)===r.b.at(-1);)e=r.a.pop(),n=r.b.pop(),l=e;Re(l,"Stacking order can only be calculated for elements with a common ancestor");const a={a:ev(Wy(r.a)),b:ev(Wy(r.b))};if(a.a===a.b){const s=l.childNodes,u={a:r.a.at(-1),b:r.b.at(-1)};let c=s.length;for(;c--;){const d=s[c];if(d===u.a)return 1;if(d===u.b)return-1}}return Math.sign(a.a-a.b)}const BN=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function IN(e){var n;const r=getComputedStyle((n=mw(e))!==null&&n!==void 0?n:e).display;return r==="flex"||r==="inline-flex"}function qN(e){const n=getComputedStyle(e);return!!(n.position==="fixed"||n.zIndex!=="auto"&&(n.position!=="static"||IN(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"||BN.test(n.willChange)||n.webkitOverflowScrolling==="touch")}function Wy(e){let n=e.length;for(;n--;){const r=e[n];if(Re(r,"Missing node"),qN(r))return r}return null}function ev(e){return e&&Number(getComputedStyle(e).zIndex)||0}function tv(e){const n=[];for(;e;)n.push(e),e=mw(e);return n}function mw(e){const{parentNode:n}=e;return n&&n instanceof ShadowRoot?n.host:n}const gw=1,xw=2,yw=4,vw=8,UN=ON()==="coarse";let Gn=[],ra=!1,$i=new Map,_c=new Map;const Ro=new Set;function VN(e,n,r,l,a){var s;const{ownerDocument:u}=n,c={direction:r,element:n,hitAreaMargins:l,setResizeHandlerState:a},d=(s=$i.get(u))!==null&&s!==void 0?s:0;return $i.set(u,d+1),Ro.add(c),rc(),function(){var m;_c.delete(e),Ro.delete(c);const p=(m=$i.get(u))!==null&&m!==void 0?m:1;if($i.set(u,p-1),rc(),p===1&&$i.delete(u),Gn.includes(c)){const x=Gn.indexOf(c);x>=0&&Gn.splice(x,1),gm(),a("up",!0,null)}}}function PN(e){const{target:n}=e,{x:r,y:l}=Sc(e);ra=!0,mm({target:n,x:r,y:l}),rc(),Gn.length>0&&(ic("down",e),e.preventDefault(),bw(n)||e.stopImmediatePropagation())}function sh(e){const{x:n,y:r}=Sc(e);if(ra&&e.buttons===0&&(ra=!1,ic("up",e)),!ra){const{target:l}=e;mm({target:l,x:n,y:r})}ic("move",e),gm(),Gn.length>0&&e.preventDefault()}function uh(e){const{target:n}=e,{x:r,y:l}=Sc(e);_c.clear(),ra=!1,Gn.length>0&&(e.preventDefault(),bw(n)||e.stopImmediatePropagation()),ic("up",e),mm({target:n,x:r,y:l}),gm(),rc()}function bw(e){let n=e;for(;n;){if(n.hasAttribute(yt.resizeHandle))return!0;n=n.parentElement}return!1}function mm({target:e,x:n,y:r}){Gn.splice(0);let l=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(l=e),Ro.forEach(a=>{const{element:s,hitAreaMargins:u}=a,c=s.getBoundingClientRect(),{bottom:d,left:h,right:m,top:p}=c,x=UN?u.coarse:u.fine;if(n>=h-x&&n<=m+x&&r>=p-x&&r<=d+x){if(l!==null&&document.contains(l)&&s!==l&&!s.contains(l)&&!l.contains(s)&&HN(l,s)>0){let w=l,k=!1;for(;w&&!w.contains(s);){if(LN(w.getBoundingClientRect(),c)){k=!0;break}w=w.parentElement}if(k)return}Gn.push(a)}})}function ch(e,n){_c.set(e,n)}function gm(){let e=!1,n=!1;Gn.forEach(l=>{const{direction:a}=l;a==="horizontal"?e=!0:n=!0});let r=0;_c.forEach(l=>{r|=l}),e&&n?oh("intersection",r):e?oh("horizontal",r):n?oh("vertical",r):RN()}let fh=new AbortController;function rc(){fh.abort(),fh=new AbortController;const e={capture:!0,signal:fh.signal};Ro.size&&(ra?(Gn.length>0&&$i.forEach((n,r)=>{const{body:l}=r;n>0&&(l.addEventListener("contextmenu",uh,e),l.addEventListener("pointerleave",sh,e),l.addEventListener("pointermove",sh,e))}),window.addEventListener("pointerup",uh,e),window.addEventListener("pointercancel",uh,e)):$i.forEach((n,r)=>{const{body:l}=r;n>0&&(l.addEventListener("pointerdown",PN,e),l.addEventListener("pointermove",sh,e))}))}function ic(e,n){Ro.forEach(r=>{const{setResizeHandlerState:l}=r,a=Gn.includes(r);l(e,a,n)})}function $N(){const[e,n]=P.useState(0);return P.useCallback(()=>n(r=>r+1),[])}function Re(e,n){if(!e)throw console.error(n),Error(n)}function Zi(e,n,r=hm){return e.toFixed(r)===n.toFixed(r)?0:e>n?1:-1}function Ar(e,n,r=hm){return Zi(e,n,r)===0}function bn(e,n,r){return Zi(e,n,r)===0}function GN(e,n,r){if(e.length!==n.length)return!1;for(let l=0;l0&&(e=e<0?0-S:S)}}}{const p=e<0?c:d,x=r[p];Re(x,`No panel constraints found for index ${p}`);const{collapsedSize:v=0,collapsible:w,minSize:k=0}=x;if(w){const _=n[p];if(Re(_!=null,`Previous layout not found for panel index ${p}`),bn(_,k)){const S=_-v;Zi(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}}{const p=e<0?1:-1;let x=e<0?d:c,v=0;for(;;){const k=n[x];Re(k!=null,`Previous layout not found for panel index ${x}`);const S=Wl({panelConstraints:r,panelIndex:x,size:100})-k;if(v+=S,x+=p,x<0||x>=r.length)break}const w=Math.min(Math.abs(e),Math.abs(v));e=e<0?0-w:w}{let x=e<0?c:d;for(;x>=0&&x=0))break;e<0?x--:x++}}if(GN(a,u))return a;{const p=e<0?d:c,x=n[p];Re(x!=null,`Previous layout not found for panel index ${p}`);const v=x+h,w=Wl({panelConstraints:r,panelIndex:p,size:v});if(u[p]=w,!bn(w,v)){let k=v-w,S=e<0?d:c;for(;S>=0&&S0?S--:S++}}}const m=u.reduce((p,x)=>x+p,0);return bn(m,100)?u:a}function YN({layout:e,panelsArray:n,pivotIndices:r}){let l=0,a=100,s=0,u=0;const c=r[0];Re(c!=null,"No pivot index found"),n.forEach((p,x)=>{const{constraints:v}=p,{maxSize:w=100,minSize:k=0}=v;x===c?(l=k,a=w):(s+=k,u+=w)});const d=Math.min(a,100-s),h=Math.max(l,100-u),m=e[c];return{valueMax:d,valueMin:h,valueNow:m}}function Oo(e,n=document){return Array.from(n.querySelectorAll(`[${yt.resizeHandleId}][data-panel-group-id="${e}"]`))}function ww(e,n,r=document){const a=Oo(e,r).findIndex(s=>s.getAttribute(yt.resizeHandleId)===n);return a??null}function Sw(e,n,r){const l=ww(e,n,r);return l!=null?[l,l+1]:[-1,-1]}function _w(e,n=document){var r;if(n instanceof HTMLElement&&(n==null||(r=n.dataset)===null||r===void 0?void 0:r.panelGroupId)==e)return n;const l=n.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return l||null}function Ec(e,n=document){const r=n.querySelector(`[${yt.resizeHandleId}="${e}"]`);return r||null}function FN(e,n,r,l=document){var a,s,u,c;const d=Ec(n,l),h=Oo(e,l),m=d?h.indexOf(d):-1,p=(a=(s=r[m])===null||s===void 0?void 0:s.id)!==null&&a!==void 0?a:null,x=(u=(c=r[m+1])===null||c===void 0?void 0:c.id)!==null&&u!==void 0?u:null;return[p,x]}function XN({committedValuesRef:e,eagerValuesRef:n,groupId:r,layout:l,panelDataArray:a,panelGroupElement:s,setLayout:u}){P.useRef({didWarnAboutMissingResizeHandle:!1}),Fi(()=>{if(!s)return;const c=Oo(r,s);for(let d=0;d{c.forEach((d,h)=>{d.removeAttribute("aria-controls"),d.removeAttribute("aria-valuemax"),d.removeAttribute("aria-valuemin"),d.removeAttribute("aria-valuenow")})}},[r,l,a,s]),P.useEffect(()=>{if(!s)return;const c=n.current;Re(c,"Eager values not found");const{panelDataArray:d}=c,h=_w(r,s);Re(h!=null,`No group found for id "${r}"`);const m=Oo(r,s);Re(m,`No resize handles found for group id "${r}"`);const p=m.map(x=>{const v=x.getAttribute(yt.resizeHandleId);Re(v,"Resize handle element has no handle id attribute");const[w,k]=FN(r,v,d,s);if(w==null||k==null)return()=>{};const _=S=>{if(!S.defaultPrevented)switch(S.key){case"Enter":{S.preventDefault();const T=d.findIndex(E=>E.id===w);if(T>=0){const E=d[T];Re(E,`No panel data found for index ${T}`);const A=l[T],{collapsedSize:U=0,collapsible:z,minSize:H=0}=E.constraints;if(A!=null&&z){const R=_o({delta:bn(A,U)?H-U:U-A,initialLayout:l,panelConstraints:d.map(V=>V.constraints),pivotIndices:Sw(r,v,s),prevLayout:l,trigger:"keyboard"});l!==R&&u(R)}}break}}};return x.addEventListener("keydown",_),()=>{x.removeEventListener("keydown",_)}});return()=>{p.forEach(x=>x())}},[s,e,n,r,l,a,u])}function nv(e,n){if(e.length!==n.length)return!1;for(let r=0;rs.constraints);let l=0,a=100;for(let s=0;s{const s=e[a];Re(s,`Panel data not found for index ${a}`);const{callbacks:u,constraints:c,id:d}=s,{collapsedSize:h=0,collapsible:m}=c,p=r[d];if(p==null||l!==p){r[d]=l;const{onCollapse:x,onExpand:v,onResize:w}=u;w&&w(l,p),m&&(x||v)&&(v&&(p==null||Ar(p,h))&&!Ar(l,h)&&v(),x&&(p==null||!Ar(p,h))&&Ar(l,h)&&x())}})}function Ru(e,n){if(e.length!==n.length)return!1;for(let r=0;r{r!==null&&clearTimeout(r),r=setTimeout(()=>{e(...a)},n)}}function rv(e){try{if(typeof localStorage<"u")e.getItem=n=>localStorage.getItem(n),e.setItem=(n,r)=>{localStorage.setItem(n,r)};else throw new Error("localStorage not supported in this environment")}catch(n){console.error(n),e.getItem=()=>null,e.setItem=()=>{}}}function kw(e){return`react-resizable-panels:${e}`}function Nw(e){return e.map(n=>{const{constraints:r,id:l,idIsFromProps:a,order:s}=n;return a?l:s?`${s}:${JSON.stringify(r)}`:JSON.stringify(r)}).sort((n,r)=>n.localeCompare(r)).join(",")}function Cw(e,n){try{const r=kw(e),l=n.getItem(r);if(l){const a=JSON.parse(l);if(typeof a=="object"&&a!=null)return a}}catch{}return null}function eC(e,n,r){var l,a;const s=(l=Cw(e,r))!==null&&l!==void 0?l:{},u=Nw(n);return(a=s[u])!==null&&a!==void 0?a:null}function tC(e,n,r,l,a){var s;const u=kw(e),c=Nw(n),d=(s=Cw(e,a))!==null&&s!==void 0?s:{};d[c]={expandToSizes:Object.fromEntries(r.entries()),layout:l};try{a.setItem(u,JSON.stringify(d))}catch(h){console.error(h)}}function iv({layout:e,panelConstraints:n}){const r=[...e],l=r.reduce((s,u)=>s+u,0);if(r.length!==n.length)throw Error(`Invalid ${n.length} panel layout: ${r.map(s=>`${s}%`).join(", ")}`);if(!bn(l,100)&&r.length>0)for(let s=0;s(rv(Eo),Eo.getItem(e)),setItem:(e,n)=>{rv(Eo),Eo.setItem(e,n)}},lv={};function Tw({autoSaveId:e=null,children:n,className:r="",direction:l,forwardedRef:a,id:s=null,onLayout:u=null,keyboardResizeBy:c=null,storage:d=Eo,style:h,tagName:m="div",...p}){const x=pm(s),v=P.useRef(null),[w,k]=P.useState(null),[_,S]=P.useState([]),T=$N(),E=P.useRef({}),A=P.useRef(new Map),U=P.useRef(0),z=P.useRef({autoSaveId:e,direction:l,dragState:w,id:x,keyboardResizeBy:c,onLayout:u,storage:d}),H=P.useRef({layout:_,panelDataArray:[],panelDataArrayChanged:!1});P.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),P.useImperativeHandle(a,()=>({getId:()=>z.current.id,getLayout:()=>{const{layout:N}=H.current;return N},setLayout:N=>{const{onLayout:G}=z.current,{layout:X,panelDataArray:J}=H.current,ne=iv({layout:N,panelConstraints:J.map(re=>re.constraints)});nv(X,ne)||(S(ne),H.current.layout=ne,G&&G(ne),Yl(J,ne,E.current))}}),[]),Fi(()=>{z.current.autoSaveId=e,z.current.direction=l,z.current.dragState=w,z.current.id=x,z.current.onLayout=u,z.current.storage=d}),XN({committedValuesRef:z,eagerValuesRef:H,groupId:x,layout:_,panelDataArray:H.current.panelDataArray,setLayout:S,panelGroupElement:v.current}),P.useEffect(()=>{const{panelDataArray:N}=H.current;if(e){if(_.length===0||_.length!==N.length)return;let G=lv[e];G==null&&(G=WN(tC,nC),lv[e]=G);const X=[...N],J=new Map(A.current);G(e,X,J,_,d)}},[e,_,d]),P.useEffect(()=>{});const R=P.useCallback(N=>{const{onLayout:G}=z.current,{layout:X,panelDataArray:J}=H.current;if(N.constraints.collapsible){const ne=J.map(ve=>ve.constraints),{collapsedSize:re=0,panelSize:se,pivotIndices:xe}=Ui(J,N,X);if(Re(se!=null,`Panel size not found for panel "${N.id}"`),!Ar(se,re)){A.current.set(N.id,se);const ye=Zl(J,N)===J.length-1?se-re:re-se,pe=_o({delta:ye,initialLayout:X,panelConstraints:ne,pivotIndices:xe,prevLayout:X,trigger:"imperative-api"});Ru(X,pe)||(S(pe),H.current.layout=pe,G&&G(pe),Yl(J,pe,E.current))}}},[]),V=P.useCallback((N,G)=>{const{onLayout:X}=z.current,{layout:J,panelDataArray:ne}=H.current;if(N.constraints.collapsible){const re=ne.map(_e=>_e.constraints),{collapsedSize:se=0,panelSize:xe=0,minSize:ve=0,pivotIndices:ye}=Ui(ne,N,J),pe=G??ve;if(Ar(xe,se)){const _e=A.current.get(N.id),Me=_e!=null&&_e>=pe?_e:pe,ct=Zl(ne,N)===ne.length-1?xe-Me:Me-xe,nt=_o({delta:ct,initialLayout:J,panelConstraints:re,pivotIndices:ye,prevLayout:J,trigger:"imperative-api"});Ru(J,nt)||(S(nt),H.current.layout=nt,X&&X(nt),Yl(ne,nt,E.current))}}},[]),O=P.useCallback(N=>{const{layout:G,panelDataArray:X}=H.current,{panelSize:J}=Ui(X,N,G);return Re(J!=null,`Panel size not found for panel "${N.id}"`),J},[]),L=P.useCallback((N,G)=>{const{panelDataArray:X}=H.current,J=Zl(X,N);return JN({defaultSize:G,dragState:w,layout:_,panelData:X,panelIndex:J})},[w,_]),q=P.useCallback(N=>{const{layout:G,panelDataArray:X}=H.current,{collapsedSize:J=0,collapsible:ne,panelSize:re}=Ui(X,N,G);return Re(re!=null,`Panel size not found for panel "${N.id}"`),ne===!0&&Ar(re,J)},[]),ee=P.useCallback(N=>{const{layout:G,panelDataArray:X}=H.current,{collapsedSize:J=0,collapsible:ne,panelSize:re}=Ui(X,N,G);return Re(re!=null,`Panel size not found for panel "${N.id}"`),!ne||Zi(re,J)>0},[]),B=P.useCallback(N=>{const{panelDataArray:G}=H.current;G.push(N),G.sort((X,J)=>{const ne=X.order,re=J.order;return ne==null&&re==null?0:ne==null?-1:re==null?1:ne-re}),H.current.panelDataArrayChanged=!0,T()},[T]);Fi(()=>{if(H.current.panelDataArrayChanged){H.current.panelDataArrayChanged=!1;const{autoSaveId:N,onLayout:G,storage:X}=z.current,{layout:J,panelDataArray:ne}=H.current;let re=null;if(N){const xe=eC(N,ne,X);xe&&(A.current=new Map(Object.entries(xe.expandToSizes)),re=xe.layout)}re==null&&(re=KN({panelDataArray:ne}));const se=iv({layout:re,panelConstraints:ne.map(xe=>xe.constraints)});nv(J,se)||(S(se),H.current.layout=se,G&&G(se),Yl(ne,se,E.current))}}),Fi(()=>{const N=H.current;return()=>{N.layout=[]}},[]);const $=P.useCallback(N=>{let G=!1;const X=v.current;return X&&window.getComputedStyle(X,null).getPropertyValue("direction")==="rtl"&&(G=!0),function(ne){ne.preventDefault();const re=v.current;if(!re)return()=>null;const{direction:se,dragState:xe,id:ve,keyboardResizeBy:ye,onLayout:pe}=z.current,{layout:_e,panelDataArray:Me}=H.current,{initialLayout:Te}=xe??{},ct=Sw(ve,N,re);let nt=ZN(ne,N,se,xe,ye,re);const Mt=se==="horizontal";Mt&&G&&(nt=-nt);const Vt=Me.map(Rn=>Rn.constraints),Lt=_o({delta:nt,initialLayout:Te??_e,panelConstraints:Vt,pivotIndices:ct,prevLayout:_e,trigger:dw(ne)?"keyboard":"mouse-or-touch"}),En=!Ru(_e,Lt);(hw(ne)||pw(ne))&&U.current!=nt&&(U.current=nt,!En&&nt!==0?Mt?ch(N,nt<0?gw:xw):ch(N,nt<0?yw:vw):ch(N,0)),En&&(S(Lt),H.current.layout=Lt,pe&&pe(Lt),Yl(Me,Lt,E.current))}},[]),M=P.useCallback((N,G)=>{const{onLayout:X}=z.current,{layout:J,panelDataArray:ne}=H.current,re=ne.map(_e=>_e.constraints),{panelSize:se,pivotIndices:xe}=Ui(ne,N,J);Re(se!=null,`Panel size not found for panel "${N.id}"`);const ye=Zl(ne,N)===ne.length-1?se-G:G-se,pe=_o({delta:ye,initialLayout:J,panelConstraints:re,pivotIndices:xe,prevLayout:J,trigger:"imperative-api"});Ru(J,pe)||(S(pe),H.current.layout=pe,X&&X(pe),Yl(ne,pe,E.current))},[]),Y=P.useCallback((N,G)=>{const{layout:X,panelDataArray:J}=H.current,{collapsedSize:ne=0,collapsible:re}=G,{collapsedSize:se=0,collapsible:xe,maxSize:ve=100,minSize:ye=0}=N.constraints,{panelSize:pe}=Ui(J,N,X);pe!=null&&(re&&xe&&Ar(pe,ne)?Ar(ne,se)||M(N,se):peve&&M(N,ve))},[M]),Q=P.useCallback((N,G)=>{const{direction:X}=z.current,{layout:J}=H.current;if(!v.current)return;const ne=Ec(N,v.current);Re(ne,`Drag handle element not found for id "${N}"`);const re=Ew(X,G);k({dragHandleId:N,dragHandleRect:ne.getBoundingClientRect(),initialCursorPosition:re,initialLayout:J})},[]),K=P.useCallback(()=>{k(null)},[]),j=P.useCallback(N=>{const{panelDataArray:G}=H.current,X=Zl(G,N);X>=0&&(G.splice(X,1),delete E.current[N.id],H.current.panelDataArrayChanged=!0,T())},[T]),I=P.useMemo(()=>({collapsePanel:R,direction:l,dragState:w,expandPanel:V,getPanelSize:O,getPanelStyle:L,groupId:x,isPanelCollapsed:q,isPanelExpanded:ee,reevaluatePanelConstraints:Y,registerPanel:B,registerResizeHandle:$,resizePanel:M,startDragging:Q,stopDragging:K,unregisterPanel:j,panelGroupElement:v.current}),[R,w,l,V,O,L,x,q,ee,Y,B,$,M,Q,K,j]),F={display:"flex",flexDirection:l==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return P.createElement(wc.Provider,{value:I},P.createElement(m,{...p,children:n,className:r,id:s,ref:v,style:{...F,...h},[yt.group]:"",[yt.groupDirection]:l,[yt.groupId]:x}))}const Bp=P.forwardRef((e,n)=>P.createElement(Tw,{...e,forwardedRef:n}));Tw.displayName="PanelGroup";Bp.displayName="forwardRef(PanelGroup)";function Zl(e,n){return e.findIndex(r=>r===n||r.id===n.id)}function Ui(e,n,r){const l=Zl(e,n),s=l===e.length-1?[l-1,l]:[l,l+1],u=r[l];return{...n.constraints,panelSize:u,pivotIndices:s}}function rC({disabled:e,handleId:n,resizeHandler:r,panelGroupElement:l}){P.useEffect(()=>{if(e||r==null||l==null)return;const a=Ec(n,l);if(a==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(),r(u);break}case"F6":{u.preventDefault();const c=a.getAttribute(yt.groupId);Re(c,`No group element found for id "${c}"`);const d=Oo(c,l),h=ww(c,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{a.removeEventListener("keydown",s)}},[l,e,n,r])}function Ip({children:e=null,className:n="",disabled:r=!1,hitAreaMargins:l,id:a,onBlur:s,onClick:u,onDragging:c,onFocus:d,onPointerDown:h,onPointerUp:m,style:p={},tabIndex:x=0,tagName:v="div",...w}){var k,_;const S=P.useRef(null),T=P.useRef({onClick:u,onDragging:c,onPointerDown:h,onPointerUp:m});P.useEffect(()=>{T.current.onClick=u,T.current.onDragging=c,T.current.onPointerDown=h,T.current.onPointerUp=m});const E=P.useContext(wc);if(E===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:A,groupId:U,registerResizeHandle:z,startDragging:H,stopDragging:R,panelGroupElement:V}=E,O=pm(a),[L,q]=P.useState("inactive"),[ee,B]=P.useState(!1),[$,M]=P.useState(null),Y=P.useRef({state:L});Fi(()=>{Y.current.state=L}),P.useEffect(()=>{if(r)M(null);else{const I=z(O);M(()=>I)}},[r,O,z]);const Q=(k=l==null?void 0:l.coarse)!==null&&k!==void 0?k:15,K=(_=l==null?void 0:l.fine)!==null&&_!==void 0?_:5;P.useEffect(()=>{if(r||$==null)return;const I=S.current;Re(I,"Element ref not attached");let F=!1;return VN(O,I,A,{coarse:Q,fine:K},(G,X,J)=>{if(!X){q("inactive");return}switch(G){case"down":{q("drag"),F=!1,Re(J,'Expected event to be defined for "down" action'),H(O,J);const{onDragging:ne,onPointerDown:re}=T.current;ne==null||ne(!0),re==null||re();break}case"move":{const{state:ne}=Y.current;F=!0,ne!=="drag"&&q("hover"),Re(J,'Expected event to be defined for "move" action'),$(J);break}case"up":{q("hover"),R();const{onClick:ne,onDragging:re,onPointerUp:se}=T.current;re==null||re(!1),se==null||se(),F||ne==null||ne();break}}})},[Q,A,r,K,z,O,$,H,R]),rC({disabled:r,handleId:O,resizeHandler:$,panelGroupElement:V});const j={touchAction:"none",userSelect:"none"};return P.createElement(v,{...w,children:e,className:n,id:a,onBlur:()=>{B(!1),s==null||s()},onFocus:()=>{B(!0),d==null||d()},ref:S,role:"separator",style:{...j,...p},tabIndex:x,[yt.groupDirection]:A,[yt.groupId]:U,[yt.resizeHandle]:"",[yt.resizeHandleActive]:L==="drag"?"pointer":ee?"keyboard":void 0,[yt.resizeHandleEnabled]:!r,[yt.resizeHandleId]:O,[yt.resizeHandleState]:L})}Ip.displayName="PanelResizeHandle";function zt(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let r=0,l;r{}};function kc(){for(var e=0,n=arguments.length,r={},l;e=0&&(l=r.slice(a+1),r=r.slice(0,a)),r&&!n.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:l}})}Zu.prototype=kc.prototype={constructor:Zu,on:function(e,n){var r=this._,l=lC(e+"",r),a,s=-1,u=l.length;if(arguments.length<2){for(;++s0)for(var r=new Array(a),l=0,a,s;l=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),ov.hasOwnProperty(n)?{space:ov[n],local:e}:e}function oC(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===qp&&n.documentElement.namespaceURI===qp?n.createElement(e):n.createElementNS(r,e)}}function sC(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Aw(e){var n=Nc(e);return(n.local?sC:oC)(n)}function uC(){}function xm(e){return e==null?uC:function(){return this.querySelector(e)}}function cC(e){typeof e!="function"&&(e=xm(e));for(var n=this._groups,r=n.length,l=new Array(r),a=0;a=E&&(E=T+1);!(U=_[E])&&++E=0;)(u=l[a])&&(s&&u.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(u,s),s=u);return this}function OC(e){e||(e=LC);function n(p,x){return p&&x?e(p.__data__,x.__data__):!p-!x}for(var r=this._groups,l=r.length,a=new Array(l),s=0;sn?1:e>=n?0:NaN}function HC(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function BC(){return Array.from(this)}function IC(){for(var e=this._groups,n=0,r=e.length;n1?this.each((n==null?ZC:typeof n=="function"?JC:KC)(e,n,r??"")):oa(this.node(),e)}function oa(e,n){return e.style.getPropertyValue(n)||Rw(e).getComputedStyle(e,null).getPropertyValue(n)}function eT(e){return function(){delete this[e]}}function tT(e,n){return function(){this[e]=n}}function nT(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function rT(e,n){return arguments.length>1?this.each((n==null?eT:typeof n=="function"?nT:tT)(e,n)):this.node()[e]}function Ow(e){return e.trim().split(/^|\s+/)}function ym(e){return e.classList||new Lw(e)}function Lw(e){this._node=e,this._names=Ow(e.getAttribute("class")||"")}Lw.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 Hw(e,n){for(var r=ym(e),l=-1,a=n.length;++l=0&&(r=n.slice(l+1),n=n.slice(0,l)),{type:n,name:r}})}function MT(e){return function(){var n=this.__on;if(n){for(var r=0,l=-1,a=n.length,s;r()=>e;function Up(e,{sourceEvent:n,subject:r,target:l,identifier:a,active:s,x:u,y:c,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:r,enumerable:!0,configurable:!0},target:{value:l,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:m}})}Up.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function UT(e){return!e.ctrlKey&&!e.button}function VT(){return this.parentNode}function PT(e,n){return n??{x:e.x,y:e.y}}function $T(){return navigator.maxTouchPoints||"ontouchstart"in this}function Pw(){var e=UT,n=VT,r=PT,l=$T,a={},s=kc("start","drag","end"),u=0,c,d,h,m,p=0;function x(A){A.on("mousedown.drag",v).filter(l).on("touchstart.drag",_).on("touchmove.drag",S,qT).on("touchend.drag touchcancel.drag",T).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(A,U){if(!(m||!e.call(this,A,U))){var z=E(this,n.call(this,A,U),A,U,"mouse");z&&(wn(A.view).on("mousemove.drag",w,Lo).on("mouseup.drag",k,Lo),Uw(A.view),dh(A),h=!1,c=A.clientX,d=A.clientY,z("start",A))}}function w(A){if(ia(A),!h){var U=A.clientX-c,z=A.clientY-d;h=U*U+z*z>p}a.mouse("drag",A)}function k(A){wn(A.view).on("mousemove.drag mouseup.drag",null),Vw(A.view,h),ia(A),a.mouse("end",A)}function _(A,U){if(e.call(this,A,U)){var z=A.changedTouches,H=n.call(this,A,U),R=z.length,V,O;for(V=0;V>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):r===8?Lu(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):r===4?Lu(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=YT.exec(e))?new un(n[1],n[2],n[3],1):(n=FT.exec(e))?new un(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=XT.exec(e))?Lu(n[1],n[2],n[3],n[4]):(n=QT.exec(e))?Lu(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=ZT.exec(e))?pv(n[1],n[2]/100,n[3]/100,1):(n=KT.exec(e))?pv(n[1],n[2]/100,n[3]/100,n[4]):sv.hasOwnProperty(e)?fv(sv[e]):e==="transparent"?new un(NaN,NaN,NaN,0):null}function fv(e){return new un(e>>16&255,e>>8&255,e&255,1)}function Lu(e,n,r,l){return l<=0&&(e=n=r=NaN),new un(e,n,r,l)}function e3(e){return e instanceof Ko||(e=Ki(e)),e?(e=e.rgb(),new un(e.r,e.g,e.b,e.opacity)):new un}function Vp(e,n,r,l){return arguments.length===1?e3(e):new un(e,n,r,l??1)}function un(e,n,r,l){this.r=+e,this.g=+n,this.b=+r,this.opacity=+l}vm(un,Vp,$w(Ko,{brighter(e){return e=e==null?ac:Math.pow(ac,e),new un(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ho:Math.pow(Ho,e),new un(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new un(Xi(this.r),Xi(this.g),Xi(this.b),oc(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:dv,formatHex:dv,formatHex8:t3,formatRgb:hv,toString:hv}));function dv(){return`#${Gi(this.r)}${Gi(this.g)}${Gi(this.b)}`}function t3(){return`#${Gi(this.r)}${Gi(this.g)}${Gi(this.b)}${Gi((isNaN(this.opacity)?1:this.opacity)*255)}`}function hv(){const e=oc(this.opacity);return`${e===1?"rgb(":"rgba("}${Xi(this.r)}, ${Xi(this.g)}, ${Xi(this.b)}${e===1?")":`, ${e})`}`}function oc(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Xi(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Gi(e){return e=Xi(e),(e<16?"0":"")+e.toString(16)}function pv(e,n,r,l){return l<=0?e=n=r=NaN:r<=0||r>=1?e=n=NaN:n<=0&&(e=NaN),new Un(e,n,r,l)}function Gw(e){if(e instanceof Un)return new Un(e.h,e.s,e.l,e.opacity);if(e instanceof Ko||(e=Ki(e)),!e)return new Un;if(e instanceof Un)return e;e=e.rgb();var n=e.r/255,r=e.g/255,l=e.b/255,a=Math.min(n,r,l),s=Math.max(n,r,l),u=NaN,c=s-a,d=(s+a)/2;return c?(n===s?u=(r-l)/c+(r0&&d<1?0:u,new Un(u,c,d,e.opacity)}function n3(e,n,r,l){return arguments.length===1?Gw(e):new Un(e,n,r,l??1)}function Un(e,n,r,l){this.h=+e,this.s=+n,this.l=+r,this.opacity=+l}vm(Un,n3,$w(Ko,{brighter(e){return e=e==null?ac:Math.pow(ac,e),new Un(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ho:Math.pow(Ho,e),new Un(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,r=this.l,l=r+(r<.5?r:1-r)*n,a=2*r-l;return new un(hh(e>=240?e-240:e+120,a,l),hh(e,a,l),hh(e<120?e+240:e-120,a,l),this.opacity)},clamp(){return new Un(mv(this.h),Hu(this.s),Hu(this.l),oc(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=oc(this.opacity);return`${e===1?"hsl(":"hsla("}${mv(this.h)}, ${Hu(this.s)*100}%, ${Hu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function mv(e){return e=(e||0)%360,e<0?e+360:e}function Hu(e){return Math.max(0,Math.min(1,e||0))}function hh(e,n,r){return(e<60?n+(r-n)*e/60:e<180?r:e<240?n+(r-n)*(240-e)/60:n)*255}const bm=e=>()=>e;function r3(e,n){return function(r){return e+r*n}}function i3(e,n,r){return e=Math.pow(e,r),n=Math.pow(n,r)-e,r=1/r,function(l){return Math.pow(e+l*n,r)}}function l3(e){return(e=+e)==1?Yw:function(n,r){return r-n?i3(n,r,e):bm(isNaN(n)?r:n)}}function Yw(e,n){var r=n-e;return r?r3(e,r):bm(isNaN(e)?n:e)}const sc=(function e(n){var r=l3(n);function l(a,s){var u=r((a=Vp(a)).r,(s=Vp(s)).r),c=r(a.g,s.g),d=r(a.b,s.b),h=Yw(a.opacity,s.opacity);return function(m){return a.r=u(m),a.g=c(m),a.b=d(m),a.opacity=h(m),a+""}}return l.gamma=e,l})(1);function a3(e,n){n||(n=[]);var r=e?Math.min(n.length,e.length):0,l=n.slice(),a;return function(s){for(a=0;ar&&(s=n.slice(r,s),c[u]?c[u]+=s:c[++u]=s),(l=l[0])===(a=a[0])?c[u]?c[u]+=a:c[++u]=a:(c[++u]=null,d.push({i:u,x:nr(l,a)})),r=ph.lastIndex;return r180?m+=360:m-h>180&&(h+=360),x.push({i:p.push(a(p)+"rotate(",null,l)-2,x:nr(h,m)})):m&&p.push(a(p)+"rotate("+m+l)}function c(h,m,p,x){h!==m?x.push({i:p.push(a(p)+"skewX(",null,l)-2,x:nr(h,m)}):m&&p.push(a(p)+"skewX("+m+l)}function d(h,m,p,x,v,w){if(h!==p||m!==x){var k=v.push(a(v)+"scale(",null,",",null,")");w.push({i:k-4,x:nr(h,p)},{i:k-2,x:nr(m,x)})}else(p!==1||x!==1)&&v.push(a(v)+"scale("+p+","+x+")")}return function(h,m){var p=[],x=[];return h=e(h),m=e(m),s(h.translateX,h.translateY,m.translateX,m.translateY,p,x),u(h.rotate,m.rotate,p,x),c(h.skewX,m.skewX,p,x),d(h.scaleX,h.scaleY,m.scaleX,m.scaleY,p,x),h=m=null,function(v){for(var w=-1,k=x.length,_;++w=0&&e._call.call(void 0,n),e=e._next;--sa}function yv(){Ji=(cc=Io.now())+Cc,sa=ko=0;try{w3()}finally{sa=0,_3(),Ji=0}}function S3(){var e=Io.now(),n=e-cc;n>Zw&&(Cc-=n,cc=e)}function _3(){for(var e,n=uc,r,l=1/0;n;)n._call?(l>n._time&&(l=n._time),e=n,n=n._next):(r=n._next,n._next=null,n=e?e._next=r:uc=r);No=e,Gp(l)}function Gp(e){if(!sa){ko&&(ko=clearTimeout(ko));var n=e-Ji;n>24?(e<1/0&&(ko=setTimeout(yv,e-Io.now()-Cc)),go&&(go=clearInterval(go))):(go||(cc=Io.now(),go=setInterval(S3,Zw)),sa=1,Kw(yv))}}function vv(e,n,r){var l=new fc;return n=n==null?0:+n,l.restart(a=>{l.stop(),e(a+n)},n,r),l}var E3=kc("start","end","cancel","interrupt"),k3=[],Ww=0,bv=1,Yp=2,Ju=3,wv=4,Fp=5,Wu=6;function Tc(e,n,r,l,a,s){var u=e.__transition;if(!u)e.__transition={};else if(r in u)return;N3(e,r,{name:n,index:l,group:a,on:E3,tween:k3,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Ww})}function Sm(e,n){var r=Xn(e,n);if(r.state>Ww)throw new Error("too late; already scheduled");return r}function lr(e,n){var r=Xn(e,n);if(r.state>Ju)throw new Error("too late; already running");return r}function Xn(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function N3(e,n,r){var l=e.__transition,a;l[n]=r,r.timer=Jw(s,0,r.time);function s(h){r.state=bv,r.timer.restart(u,r.delay,r.time),r.delay<=h&&u(h-r.delay)}function u(h){var m,p,x,v;if(r.state!==bv)return d();for(m in l)if(v=l[m],v.name===r.name){if(v.state===Ju)return vv(u);v.state===wv?(v.state=Wu,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete l[m]):+mYp&&l.state=0&&(n=n.slice(0,r)),!n||n==="start"})}function nA(e,n,r){var l,a,s=tA(n)?Sm:lr;return function(){var u=s(this,e),c=u.on;c!==l&&(a=(l=c).copy()).on(n,r),u.on=a}}function rA(e,n){var r=this._id;return arguments.length<2?Xn(this.node(),r).on.on(e):this.each(nA(r,e,n))}function iA(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function lA(){return this.on("end.remove",iA(this._id))}function aA(e){var n=this._name,r=this._id;typeof e!="function"&&(e=xm(e));for(var l=this._groups,a=l.length,s=new Array(a),u=0;u()=>e;function MA(e,{sourceEvent:n,target:r,transform:l,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:l,enumerable:!0,configurable:!0},_:{value:a}})}function zr(e,n,r){this.k=e,this.x=n,this.y=r}zr.prototype={constructor:zr,scale:function(e){return e===1?this:new zr(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new zr(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 Ac=new zr(1,0,0);rS.prototype=zr.prototype;function rS(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ac;return e.__zoom}function mh(e){e.stopImmediatePropagation()}function xo(e){e.preventDefault(),e.stopImmediatePropagation()}function jA(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function DA(){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 Sv(){return this.__zoom||Ac}function RA(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function OA(){return navigator.maxTouchPoints||"ontouchstart"in this}function LA(e,n,r){var l=e.invertX(n[0][0])-r[0][0],a=e.invertX(n[1][0])-r[1][0],s=e.invertY(n[0][1])-r[0][1],u=e.invertY(n[1][1])-r[1][1];return e.translate(a>l?(l+a)/2:Math.min(0,l)||Math.max(0,a),u>s?(s+u)/2:Math.min(0,s)||Math.max(0,u))}function iS(){var e=jA,n=DA,r=LA,l=RA,a=OA,s=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],c=250,d=Ku,h=kc("start","zoom","end"),m,p,x,v=500,w=150,k=0,_=10;function S(B){B.property("__zoom",Sv).on("wheel.zoom",R,{passive:!1}).on("mousedown.zoom",V).on("dblclick.zoom",O).filter(a).on("touchstart.zoom",L).on("touchmove.zoom",q).on("touchend.zoom touchcancel.zoom",ee).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(B,$,M,Y){var Q=B.selection?B.selection():B;Q.property("__zoom",Sv),B!==Q?U(B,$,M,Y):Q.interrupt().each(function(){z(this,arguments).event(Y).start().zoom(null,typeof $=="function"?$.apply(this,arguments):$).end()})},S.scaleBy=function(B,$,M,Y){S.scaleTo(B,function(){var Q=this.__zoom.k,K=typeof $=="function"?$.apply(this,arguments):$;return Q*K},M,Y)},S.scaleTo=function(B,$,M,Y){S.transform(B,function(){var Q=n.apply(this,arguments),K=this.__zoom,j=M==null?A(Q):typeof M=="function"?M.apply(this,arguments):M,I=K.invert(j),F=typeof $=="function"?$.apply(this,arguments):$;return r(E(T(K,F),j,I),Q,u)},M,Y)},S.translateBy=function(B,$,M,Y){S.transform(B,function(){return r(this.__zoom.translate(typeof $=="function"?$.apply(this,arguments):$,typeof M=="function"?M.apply(this,arguments):M),n.apply(this,arguments),u)},null,Y)},S.translateTo=function(B,$,M,Y,Q){S.transform(B,function(){var K=n.apply(this,arguments),j=this.__zoom,I=Y==null?A(K):typeof Y=="function"?Y.apply(this,arguments):Y;return r(Ac.translate(I[0],I[1]).scale(j.k).translate(typeof $=="function"?-$.apply(this,arguments):-$,typeof M=="function"?-M.apply(this,arguments):-M),K,u)},Y,Q)};function T(B,$){return $=Math.max(s[0],Math.min(s[1],$)),$===B.k?B:new zr($,B.x,B.y)}function E(B,$,M){var Y=$[0]-M[0]*B.k,Q=$[1]-M[1]*B.k;return Y===B.x&&Q===B.y?B:new zr(B.k,Y,Q)}function A(B){return[(+B[0][0]+ +B[1][0])/2,(+B[0][1]+ +B[1][1])/2]}function U(B,$,M,Y){B.on("start.zoom",function(){z(this,arguments).event(Y).start()}).on("interrupt.zoom end.zoom",function(){z(this,arguments).event(Y).end()}).tween("zoom",function(){var Q=this,K=arguments,j=z(Q,K).event(Y),I=n.apply(Q,K),F=M==null?A(I):typeof M=="function"?M.apply(Q,K):M,N=Math.max(I[1][0]-I[0][0],I[1][1]-I[0][1]),G=Q.__zoom,X=typeof $=="function"?$.apply(Q,K):$,J=d(G.invert(F).concat(N/G.k),X.invert(F).concat(N/X.k));return function(ne){if(ne===1)ne=X;else{var re=J(ne),se=N/re[2];ne=new zr(se,F[0]-re[0]*se,F[1]-re[1]*se)}j.zoom(null,ne)}})}function z(B,$,M){return!M&&B.__zooming||new H(B,$)}function H(B,$){this.that=B,this.args=$,this.active=0,this.sourceEvent=null,this.extent=n.apply(B,$),this.taps=0}H.prototype={event:function(B){return B&&(this.sourceEvent=B),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(B,$){return this.mouse&&B!=="mouse"&&(this.mouse[1]=$.invert(this.mouse[0])),this.touch0&&B!=="touch"&&(this.touch0[1]=$.invert(this.touch0[0])),this.touch1&&B!=="touch"&&(this.touch1[1]=$.invert(this.touch1[0])),this.that.__zoom=$,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(B){var $=wn(this.that).datum();h.call(B,this.that,new MA(B,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:h}),$)}};function R(B,...$){if(!e.apply(this,arguments))return;var M=z(this,$).event(B),Y=this.__zoom,Q=Math.max(s[0],Math.min(s[1],Y.k*Math.pow(2,l.apply(this,arguments)))),K=qn(B);if(M.wheel)(M.mouse[0][0]!==K[0]||M.mouse[0][1]!==K[1])&&(M.mouse[1]=Y.invert(M.mouse[0]=K)),clearTimeout(M.wheel);else{if(Y.k===Q)return;M.mouse=[K,Y.invert(K)],ec(this),M.start()}xo(B),M.wheel=setTimeout(j,w),M.zoom("mouse",r(E(T(Y,Q),M.mouse[0],M.mouse[1]),M.extent,u));function j(){M.wheel=null,M.end()}}function V(B,...$){if(x||!e.apply(this,arguments))return;var M=B.currentTarget,Y=z(this,$,!0).event(B),Q=wn(B.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",N,!0),K=qn(B,M),j=B.clientX,I=B.clientY;Uw(B.view),mh(B),Y.mouse=[K,this.__zoom.invert(K)],ec(this),Y.start();function F(G){if(xo(G),!Y.moved){var X=G.clientX-j,J=G.clientY-I;Y.moved=X*X+J*J>k}Y.event(G).zoom("mouse",r(E(Y.that.__zoom,Y.mouse[0]=qn(G,M),Y.mouse[1]),Y.extent,u))}function N(G){Q.on("mousemove.zoom mouseup.zoom",null),Vw(G.view,Y.moved),xo(G),Y.event(G).end()}}function O(B,...$){if(e.apply(this,arguments)){var M=this.__zoom,Y=qn(B.changedTouches?B.changedTouches[0]:B,this),Q=M.invert(Y),K=M.k*(B.shiftKey?.5:2),j=r(E(T(M,K),Y,Q),n.apply(this,$),u);xo(B),c>0?wn(this).transition().duration(c).call(U,j,Y,B):wn(this).call(S.transform,j,Y,B)}}function L(B,...$){if(e.apply(this,arguments)){var M=B.touches,Y=M.length,Q=z(this,$,B.changedTouches.length===Y).event(B),K,j,I,F;for(mh(B),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:r,targetHandle:l})=>`Couldn't create edge for ${e} handle id: "${e==="source"?r: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."},qo=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],lS=["Enter"," ","Escape"],aS={"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:r})=>`Moved selected node ${e}. New position, x: ${n}, y: ${r}`,"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 ua;(function(e){e.Strict="strict",e.Loose="loose"})(ua||(ua={}));var Qi;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Qi||(Qi={}));var Uo;(function(e){e.Partial="partial",e.Full="full"})(Uo||(Uo={}));const oS={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var xi;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(xi||(xi={}));var dc;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(dc||(dc={}));var be;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(be||(be={}));const _v={[be.Left]:be.Right,[be.Right]:be.Left,[be.Top]:be.Bottom,[be.Bottom]:be.Top};function sS(e){return e===null?null:e?"valid":"invalid"}const uS=e=>"id"in e&&"source"in e&&"target"in e,HA=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),Jo=(e,n=[0,0])=>{const{width:r,height:l}=Rr(e),a=e.origin??n,s=r*a[0],u=l*a[1];return{x:e.position.x-s,y:e.position.y-u}},BA=(e,n={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((l,a)=>{const s=typeof a=="string";let u=!n.nodeLookup&&!s?a:void 0;n.nodeLookup&&(u=s?n.nodeLookup.get(a):Em(a)?a:n.nodeLookup.get(a.id));const c=u?hc(u,n.nodeOrigin):{x:0,y:0,x2:0,y2:0};return zc(l,c)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Mc(r)},Wo=(e,n={})=>{let r={x:1/0,y:1/0,x2:-1/0,y2:-1/0},l=!1;return e.forEach(a=>{(n.filter===void 0||n.filter(a))&&(r=zc(r,hc(a)),l=!0)}),l?Mc(r):{x:0,y:0,width:0,height:0}},km=(e,n,[r,l,a]=[0,0,1],s=!1,u=!1)=>{const c={...ts(n,[r,l,a]),width:n.width/a,height:n.height/a},d=[];for(const h of e.values()){const{measured:m,selectable:p=!0,hidden:x=!1}=h;if(u&&!p||x)continue;const v=m.width??h.width??h.initialWidth??null,w=m.height??h.height??h.initialHeight??null,k=Vo(c,fa(h)),_=(v??0)*(w??0),S=s&&k>0;(!h.internals.handleBounds||S||k>=_||h.dragging)&&d.push(h)}return d},IA=(e,n)=>{const r=new Set;return e.forEach(l=>{r.add(l.id)}),n.filter(l=>r.has(l.source)||r.has(l.target))};function qA(e,n){const r=new Map,l=n!=null&&n.nodes?new Set(n.nodes.map(a=>a.id)):null;return e.forEach(a=>{a.measured.width&&a.measured.height&&((n==null?void 0:n.includeHiddenNodes)||!a.hidden)&&(!l||l.has(a.id))&&r.set(a.id,a)}),r}async function UA({nodes:e,width:n,height:r,panZoom:l,minZoom:a,maxZoom:s},u){if(e.size===0)return Promise.resolve(!0);const c=qA(e,u),d=Wo(c),h=Nm(d,n,r,(u==null?void 0:u.minZoom)??a,(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 cS({nodeId:e,nextPosition:n,nodeLookup:r,nodeOrigin:l=[0,0],nodeExtent:a,onError:s}){const u=r.get(e),c=u.parentId?r.get(u.parentId):void 0,{x:d,y:h}=c?c.internals.positionAbsolute:{x:0,y:0},m=u.origin??l;let p=u.extent||a;if(u.extent==="parent"&&!u.expandParent)if(!c)s==null||s("005",ir.error005());else{const v=c.measured.width,w=c.measured.height;v&&w&&(p=[[d,h],[d+v,h+w]])}else c&&da(u.extent)&&(p=[[u.extent[0][0]+d,u.extent[0][1]+h],[u.extent[1][0]+d,u.extent[1][1]+h]]);const x=da(p)?Wi(n,p,u.measured):n;return(u.measured.width===void 0||u.measured.height===void 0)&&(s==null||s("015",ir.error015())),{position:{x:x.x-d+(u.measured.width??0)*m[0],y:x.y-h+(u.measured.height??0)*m[1]},positionAbsolute:x}}async function VA({nodesToRemove:e=[],edgesToRemove:n=[],nodes:r,edges:l,onBeforeDelete:a}){const s=new Set(e.map(x=>x.id)),u=[];for(const x of r){if(x.deletable===!1)continue;const v=s.has(x.id),w=!v&&x.parentId&&u.find(k=>k.id===x.parentId);(v||w)&&u.push(x)}const c=new Set(n.map(x=>x.id)),d=l.filter(x=>x.deletable!==!1),m=IA(u,d);for(const x of d)c.has(x.id)&&!m.find(w=>w.id===x.id)&&m.push(x);if(!a)return{edges:m,nodes:u};const p=await a({nodes:u,edges:m});return typeof p=="boolean"?p?{edges:m,nodes:u}:{edges:[],nodes:[]}:p}const ca=(e,n=0,r=1)=>Math.min(Math.max(e,n),r),Wi=(e={x:0,y:0},n,r)=>({x:ca(e.x,n[0][0],n[1][0]-((r==null?void 0:r.width)??0)),y:ca(e.y,n[0][1],n[1][1]-((r==null?void 0:r.height)??0))});function fS(e,n,r){const{width:l,height:a}=Rr(r),{x:s,y:u}=r.internals.positionAbsolute;return Wi(e,[[s,u],[s+l,u+a]],n)}const Ev=(e,n,r)=>er?-ca(Math.abs(e-r),1,n)/n:0,dS=(e,n,r=15,l=40)=>{const a=Ev(e.x,l,n.width-l)*r,s=Ev(e.y,l,n.height-l)*r;return[a,s]},zc=(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)}),Xp=({x:e,y:n,width:r,height:l})=>({x:e,y:n,x2:e+r,y2:n+l}),Mc=({x:e,y:n,x2:r,y2:l})=>({x:e,y:n,width:r-e,height:l-n}),fa=(e,n=[0,0])=>{var a,s;const{x:r,y:l}=Em(e)?e.internals.positionAbsolute:Jo(e,n);return{x:r,y:l,width:((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},hc=(e,n=[0,0])=>{var a,s;const{x:r,y:l}=Em(e)?e.internals.positionAbsolute:Jo(e,n);return{x:r,y:l,x2:r+(((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0),y2:l+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},hS=(e,n)=>Mc(zc(Xp(e),Xp(n))),Vo=(e,n)=>{const r=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(r*l)},kv=e=>Vn(e.width)&&Vn(e.height)&&Vn(e.x)&&Vn(e.y),Vn=e=>!isNaN(e)&&isFinite(e),PA=(e,n)=>{},es=(e,n=[1,1])=>({x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}),ts=({x:e,y:n},[r,l,a],s=!1,u=[1,1])=>{const c={x:(e-r)/a,y:(n-l)/a};return s?es(c,u):c},pc=({x:e,y:n},[r,l,a])=>({x:e*a+r,y:n*a+l});function Fl(e,n){if(typeof e=="number")return Math.floor((n-n/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(r)}if(typeof e=="string"&&e.endsWith("%")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(n*r*.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 $A(e,n,r){if(typeof e=="string"||typeof e=="number"){const l=Fl(e,r),a=Fl(e,n);return{top:l,right:a,bottom:l,left:a,x:a*2,y:l*2}}if(typeof e=="object"){const l=Fl(e.top??e.y??0,r),a=Fl(e.bottom??e.y??0,r),s=Fl(e.left??e.x??0,n),u=Fl(e.right??e.x??0,n);return{top:l,right:u,bottom:a,left:s,x:s+u,y:l+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function GA(e,n,r,l,a,s){const{x:u,y:c}=pc(e,[n,r,l]),{x:d,y:h}=pc({x:e.x+e.width,y:e.y+e.height},[n,r,l]),m=a-d,p=s-h;return{left:Math.floor(u),top:Math.floor(c),right:Math.floor(m),bottom:Math.floor(p)}}const Nm=(e,n,r,l,a,s)=>{const u=$A(s,n,r),c=(n-u.x)/e.width,d=(r-u.y)/e.height,h=Math.min(c,d),m=ca(h,l,a),p=e.x+e.width/2,x=e.y+e.height/2,v=n/2-p*m,w=r/2-x*m,k=GA(e,v,w,m,n,r),_={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-_.left+_.right,y:w-_.top+_.bottom,zoom:m}},Po=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function da(e){return e!=null&&e!=="parent"}function Rr(e){var n,r;return{width:((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth??0,height:((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0}}function pS(e){var n,r;return(((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth)!==void 0&&(((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight)!==void 0}function mS(e,n={width:0,height:0},r,l,a){const s={...e},u=l.get(r);if(u){const c=u.origin||a;s.x+=u.internals.positionAbsolute.x-(n.width??0)*c[0],s.y+=u.internals.positionAbsolute.y-(n.height??0)*c[1]}return s}function Nv(e,n){if(e.size!==n.size)return!1;for(const r of e)if(!n.has(r))return!1;return!0}function YA(){let e,n;return{promise:new Promise((l,a)=>{e=l,n=a}),resolve:e,reject:n}}function FA(e){return{...aS,...e||{}}}function Ao(e,{snapGrid:n=[0,0],snapToGrid:r=!1,transform:l,containerBounds:a}){const{x:s,y:u}=Pn(e),c=ts({x:s-((a==null?void 0:a.left)??0),y:u-((a==null?void 0:a.top)??0)},l),{x:d,y:h}=r?es(c,n):c;return{xSnapped:d,ySnapped:h,...c}}const Cm=e=>({width:e.offsetWidth,height:e.offsetHeight}),gS=e=>{var n;return((n=e==null?void 0:e.getRootNode)==null?void 0:n.call(e))||(window==null?void 0:window.document)},XA=["INPUT","SELECT","TEXTAREA"];function xS(e){var l,a;const n=((a=(l=e.composedPath)==null?void 0:l.call(e))==null?void 0:a[0])||e.target;return(n==null?void 0:n.nodeType)!==1?!1:XA.includes(n.nodeName)||n.hasAttribute("contenteditable")||!!n.closest(".nokey")}const yS=e=>"clientX"in e,Pn=(e,n)=>{var s,u;const r=yS(e),l=r?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,a=r?e.clientY:(u=e.touches)==null?void 0:u[0].clientY;return{x:l-((n==null?void 0:n.left)??0),y:a-((n==null?void 0:n.top)??0)}},Cv=(e,n,r,l,a)=>{const s=n.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(u=>{const c=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),type:e,nodeId:a,position:u.getAttribute("data-handlepos"),x:(c.left-r.left)/l,y:(c.top-r.top)/l,...Cm(u)}})};function vS({sourceX:e,sourceY:n,targetX:r,targetY:l,sourceControlX:a,sourceControlY:s,targetControlX:u,targetControlY:c}){const d=e*.125+a*.375+u*.375+r*.125,h=n*.125+s*.375+c*.375+l*.125,m=Math.abs(d-e),p=Math.abs(h-n);return[d,h,m,p]}function qu(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function Tv({pos:e,x1:n,y1:r,x2:l,y2:a,c:s}){switch(e){case be.Left:return[n-qu(n-l,s),r];case be.Right:return[n+qu(l-n,s),r];case be.Top:return[n,r-qu(r-a,s)];case be.Bottom:return[n,r+qu(a-r,s)]}}function Tm({sourceX:e,sourceY:n,sourcePosition:r=be.Bottom,targetX:l,targetY:a,targetPosition:s=be.Top,curvature:u=.25}){const[c,d]=Tv({pos:r,x1:e,y1:n,x2:l,y2:a,c:u}),[h,m]=Tv({pos:s,x1:l,y1:a,x2:e,y2:n,c:u}),[p,x,v,w]=vS({sourceX:e,sourceY:n,targetX:l,targetY:a,sourceControlX:c,sourceControlY:d,targetControlX:h,targetControlY:m});return[`M${e},${n} C${c},${d} ${h},${m} ${l},${a}`,p,x,v,w]}function bS({sourceX:e,sourceY:n,targetX:r,targetY:l}){const a=Math.abs(r-e)/2,s=r0}const KA=({source:e,sourceHandle:n,target:r,targetHandle:l})=>`xy-edge__${e}${n||""}-${r}${l||""}`,JA=(e,n)=>n.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),WA=(e,n,r={})=>{if(!e.source||!e.target)return n;const l=r.getEdgeId||KA;let a;return uS(e)?a={...e}:a={...e,id:l(e)},JA(a,n)?n:(a.sourceHandle===null&&delete a.sourceHandle,a.targetHandle===null&&delete a.targetHandle,n.concat(a))};function wS({sourceX:e,sourceY:n,targetX:r,targetY:l}){const[a,s,u,c]=bS({sourceX:e,sourceY:n,targetX:r,targetY:l});return[`M ${e},${n}L ${r},${l}`,a,s,u,c]}const Av={[be.Left]:{x:-1,y:0},[be.Right]:{x:1,y:0},[be.Top]:{x:0,y:-1},[be.Bottom]:{x:0,y:1}},ez=({source:e,sourcePosition:n=be.Bottom,target:r})=>n===be.Left||n===be.Right?e.xMath.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function tz({source:e,sourcePosition:n=be.Bottom,target:r,targetPosition:l=be.Top,center:a,offset:s,stepPosition:u}){const c=Av[n],d=Av[l],h={x:e.x+c.x*s,y:e.y+c.y*s},m={x:r.x+d.x*s,y:r.y+d.y*s},p=ez({source:h,sourcePosition:n,target:m}),x=p.x!==0?"x":"y",v=p[x];let w=[],k,_;const S={x:0,y:0},T={x:0,y:0},[,,E,A]=bS({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(c[x]*d[x]===-1){x==="x"?(k=a.x??h.x+(m.x-h.x)*u,_=a.y??(h.y+m.y)/2):(k=a.x??(h.x+m.x)/2,_=a.y??h.y+(m.y-h.y)*u);const z=[{x:k,y:h.y},{x:k,y:m.y}],H=[{x:h.x,y:_},{x:m.x,y:_}];c[x]===v?w=x==="x"?z:H:w=x==="x"?H:z}else{const z=[{x:h.x,y:m.y}],H=[{x:m.x,y:h.y}];if(x==="x"?w=c.x===v?H:z:w=c.y===v?z:H,n===l){const q=Math.abs(e[x]-r[x]);if(q<=s){const ee=Math.min(s-1,s-q);c[x]===v?S[x]=(h[x]>e[x]?-1:1)*ee:T[x]=(m[x]>r[x]?-1:1)*ee}}if(n!==l){const q=x==="x"?"y":"x",ee=c[x]===d[q],B=h[q]>m[q],$=h[q]=L?(k=(R.x+V.x)/2,_=w[0].y):(k=w[0].x,_=(R.y+V.y)/2)}return[[e,{x:h.x+S.x,y:h.y+S.y},...w,{x:m.x+T.x,y:m.y+T.y},r],k,_,E,A]}function nz(e,n,r,l){const a=Math.min(zv(e,n)/2,zv(n,r)/2,l),{x:s,y:u}=n;if(e.x===s&&s===r.x||e.y===u&&u===r.y)return`L${s} ${u}`;if(e.y===u){const h=e.x{let A="";return E>0&&Er.id===n):e[0])||null}function Zp(e,n){return e?typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(l=>`${l}=${e[l]}`).join("&")}`:""}function iz(e,{id:n,defaultColor:r,defaultMarkerStart:l,defaultMarkerEnd:a}){const s=new Set;return e.reduce((u,c)=>([c.markerStart||l,c.markerEnd||a].forEach(d=>{if(d&&typeof d=="object"){const h=Zp(d,n);s.has(h)||(u.push({id:h,color:d.color||r,...d}),s.add(h))}}),u),[]).sort((u,c)=>u.id.localeCompare(c.id))}const SS=1e3,lz=10,Am={nodeOrigin:[0,0],nodeExtent:qo,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},az={...Am,checkEquality:!0};function zm(e,n){const r={...e};for(const l in n)n[l]!==void 0&&(r[l]=n[l]);return r}function oz(e,n,r){const l=zm(Am,r);for(const a of e.values())if(a.parentId)jm(a,e,n,l);else{const s=Jo(a,l.nodeOrigin),u=da(a.extent)?a.extent:l.nodeExtent,c=Wi(s,u,Rr(a));a.internals.positionAbsolute=c}}function sz(e,n){if(!e.handles)return e.measured?n==null?void 0:n.internals.handleBounds:void 0;const r=[],l=[];for(const a of e.handles){const s={id:a.id,width:a.width??1,height:a.height??1,nodeId:e.id,x:a.x,y:a.y,position:a.position,type:a.type};a.type==="source"?r.push(s):a.type==="target"&&l.push(s)}return{source:r,target:l}}function Mm(e){return e==="manual"}function Kp(e,n,r,l={}){var h,m;const a=zm(az,l),s={i:0},u=new Map(n),c=a!=null&&a.elevateNodesOnSelect&&!Mm(a.zIndexMode)?SS:0;let d=e.length>0;n.clear(),r.clear();for(const p of e){let x=u.get(p.id);if(a.checkEquality&&p===(x==null?void 0:x.internals.userNode))n.set(p.id,x);else{const v=Jo(p,a.nodeOrigin),w=da(p.extent)?p.extent:a.nodeExtent,k=Wi(v,w,Rr(p));x={...a.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:sz(p,x),z:_S(p,c,a.zIndexMode),userNode:p}},n.set(p.id,x)}(x.measured===void 0||x.measured.width===void 0||x.measured.height===void 0)&&!x.hidden&&(d=!1),p.parentId&&jm(x,n,r,l,s)}return d}function uz(e,n){if(!e.parentId)return;const r=n.get(e.parentId);r?r.set(e.id,e):n.set(e.parentId,new Map([[e.id,e]]))}function jm(e,n,r,l,a){const{elevateNodesOnSelect:s,nodeOrigin:u,nodeExtent:c,zIndexMode:d}=zm(Am,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}uz(e,r),a&&!m.parentId&&m.internals.rootParentIndex===void 0&&d==="auto"&&(m.internals.rootParentIndex=++a.i,m.internals.z=m.internals.z+a.i*lz),a&&m.internals.rootParentIndex!==void 0&&(a.i=m.internals.rootParentIndex);const p=s&&!Mm(d)?SS:0,{x,y:v,z:w}=cz(e,m,u,c,p,d),{positionAbsolute:k}=e.internals,_=x!==k.x||v!==k.y;(_||w!==e.internals.z)&&n.set(e.id,{...e,internals:{...e.internals,positionAbsolute:_?{x,y:v}:k,z:w}})}function _S(e,n,r){const l=Vn(e.zIndex)?e.zIndex:0;return Mm(r)?l:l+(e.selected?n:0)}function cz(e,n,r,l,a,s){const{x:u,y:c}=n.internals.positionAbsolute,d=Rr(e),h=Jo(e,r),m=da(e.extent)?Wi(h,e.extent,d):h;let p=Wi({x:u+m.x,y:c+m.y},l,d);e.extent==="parent"&&(p=fS(p,d,n));const x=_S(e,a,s),v=n.internals.z??0;return{x:p.x,y:p.y,z:v>=x?v+1:x}}function Dm(e,n,r,l=[0,0]){var u;const a=[],s=new Map;for(const c of e){const d=n.get(c.parentId);if(!d)continue;const h=((u=s.get(c.parentId))==null?void 0:u.expandedRect)??fa(d),m=hS(h,c.rect);s.set(c.parentId,{expandedRect:m,parent:d})}return s.size>0&&s.forEach(({expandedRect:c,parent:d},h)=>{var E;const m=d.internals.positionAbsolute,p=Rr(d),x=d.origin??l,v=c.x0||w>0||S||T)&&(a.push({id:h,type:"position",position:{x:d.position.x-v+S,y:d.position.y-w+T}}),(E=r.get(h))==null||E.forEach(A=>{e.some(U=>U.id===A.id)||a.push({id:A.id,type:"position",position:{x:A.position.x+v,y:A.position.y+w}})})),(p.width0){const v=Dm(x,n,r,a);h.push(...v)}return{changes:h,updatedInternals:d}}async function dz({delta:e,panZoom:n,transform:r,translateExtent:l,width:a,height:s}){if(!n||!e.x&&!e.y)return Promise.resolve(!1);const u=await n.setViewportConstrained({x:r[0]+e.x,y:r[1]+e.y,zoom:r[2]},[[0,0],[a,s]],l),c=!!u&&(u.x!==r[0]||u.y!==r[1]||u.k!==r[2]);return Promise.resolve(c)}function Rv(e,n,r,l,a,s){let u=a;const c=l.get(u)||new Map;l.set(u,c.set(r,n)),u=`${a}-${e}`;const d=l.get(u)||new Map;if(l.set(u,d.set(r,n)),s){u=`${a}-${e}-${s}`;const h=l.get(u)||new Map;l.set(u,h.set(r,n))}}function ES(e,n,r){e.clear(),n.clear();for(const l of r){const{source:a,target:s,sourceHandle:u=null,targetHandle:c=null}=l,d={edgeId:l.id,source:a,target:s,sourceHandle:u,targetHandle:c},h=`${a}-${u}--${s}-${c}`,m=`${s}-${c}--${a}-${u}`;Rv("source",d,m,e,a,u),Rv("target",d,h,e,s,c),n.set(l.id,l)}}function kS(e,n){if(!e.parentId)return!1;const r=n.get(e.parentId);return r?r.selected?!0:kS(r,n):!1}function Ov(e,n,r){var a;let l=e;do{if((a=l==null?void 0:l.matches)!=null&&a.call(l,n))return!0;if(l===r)return!1;l=l==null?void 0:l.parentElement}while(l);return!1}function hz(e,n,r,l){const a=new Map;for(const[s,u]of e)if((u.selected||u.id===l)&&(!u.parentId||!kS(u,e))&&(u.draggable||n&&typeof u.draggable>"u")){const c=e.get(s);c&&a.set(s,{id:s,position:c.position||{x:0,y:0},distance:{x:r.x-c.internals.positionAbsolute.x,y:r.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return a}function gh({nodeId:e,dragItems:n,nodeLookup:r,dragging:l=!0}){var u,c,d;const a=[];for(const[h,m]of n){const p=(u=r.get(h))==null?void 0:u.internals.userNode;p&&a.push({...p,position:m.position,dragging:l})}if(!e)return[a[0],a];const s=(c=r.get(e))==null?void 0:c.internals.userNode;return[s?{...s,position:((d=n.get(e))==null?void 0:d.position)||s.position,dragging:l}:a[0],a]}function pz({dragItems:e,snapGrid:n,x:r,y:l}){const a=e.values().next().value;if(!a)return null;const s={x:r-a.distance.x,y:l-a.distance.y},u=es(s,n);return{x:u.x-s.x,y:u.y-s.y}}function mz({onNodeMouseDown:e,getStoreItems:n,onDragStart:r,onDrag:l,onDragStop:a}){let s={x:null,y:null},u=0,c=new Map,d=!1,h={x:0,y:0},m=null,p=!1,x=null,v=!1,w=!1,k=null;function _({noDragClassName:T,handleSelector:E,domNode:A,isSelectable:U,nodeId:z,nodeClickDistance:H=0}){x=wn(A);function R({x:q,y:ee}){const{nodeLookup:B,nodeExtent:$,snapGrid:M,snapToGrid:Y,nodeOrigin:Q,onNodeDrag:K,onSelectionDrag:j,onError:I,updateNodePositions:F}=n();s={x:q,y:ee};let N=!1;const G=c.size>1,X=G&&$?Xp(Wo(c)):null,J=G&&Y?pz({dragItems:c,snapGrid:M,x:q,y:ee}):null;for(const[ne,re]of c){if(!B.has(ne))continue;let se={x:q-re.distance.x,y:ee-re.distance.y};Y&&(se=J?{x:Math.round(se.x+J.x),y:Math.round(se.y+J.y)}:es(se,M));let xe=null;if(G&&$&&!re.extent&&X){const{positionAbsolute:pe}=re.internals,_e=pe.x-X.x+$[0][0],Me=pe.x+re.measured.width-X.x2+$[1][0],Te=pe.y-X.y+$[0][1],ct=pe.y+re.measured.height-X.y2+$[1][1];xe=[[_e,Te],[Me,ct]]}const{position:ve,positionAbsolute:ye}=cS({nodeId:ne,nextPosition:se,nodeLookup:B,nodeExtent:xe||$,nodeOrigin:Q,onError:I});N=N||re.position.x!==ve.x||re.position.y!==ve.y,re.position=ve,re.internals.positionAbsolute=ye}if(w=w||N,!!N&&(F(c,!0),k&&(l||K||!z&&j))){const[ne,re]=gh({nodeId:z,dragItems:c,nodeLookup:B});l==null||l(k,c,ne,re),K==null||K(k,ne,re),z||j==null||j(k,re)}}async function V(){if(!m)return;const{transform:q,panBy:ee,autoPanSpeed:B,autoPanOnNodeDrag:$}=n();if(!$){d=!1,cancelAnimationFrame(u);return}const[M,Y]=dS(h,m,B);(M!==0||Y!==0)&&(s.x=(s.x??0)-M/q[2],s.y=(s.y??0)-Y/q[2],await ee({x:M,y:Y})&&R(s)),u=requestAnimationFrame(V)}function O(q){var G;const{nodeLookup:ee,multiSelectionActive:B,nodesDraggable:$,transform:M,snapGrid:Y,snapToGrid:Q,selectNodesOnDrag:K,onNodeDragStart:j,onSelectionDragStart:I,unselectNodesAndEdges:F}=n();p=!0,(!K||!U)&&!B&&z&&((G=ee.get(z))!=null&&G.selected||F()),U&&K&&z&&(e==null||e(z));const N=Ao(q.sourceEvent,{transform:M,snapGrid:Y,snapToGrid:Q,containerBounds:m});if(s=N,c=hz(ee,$,N,z),c.size>0&&(r||j||!z&&I)){const[X,J]=gh({nodeId:z,dragItems:c,nodeLookup:ee});r==null||r(q.sourceEvent,c,X,J),j==null||j(q.sourceEvent,X,J),z||I==null||I(q.sourceEvent,J)}}const L=Pw().clickDistance(H).on("start",q=>{const{domNode:ee,nodeDragThreshold:B,transform:$,snapGrid:M,snapToGrid:Y}=n();m=(ee==null?void 0:ee.getBoundingClientRect())||null,v=!1,w=!1,k=q.sourceEvent,B===0&&O(q),s=Ao(q.sourceEvent,{transform:$,snapGrid:M,snapToGrid:Y,containerBounds:m}),h=Pn(q.sourceEvent,m)}).on("drag",q=>{const{autoPanOnNodeDrag:ee,transform:B,snapGrid:$,snapToGrid:M,nodeDragThreshold:Y,nodeLookup:Q}=n(),K=Ao(q.sourceEvent,{transform:B,snapGrid:$,snapToGrid:M,containerBounds:m});if(k=q.sourceEvent,(q.sourceEvent.type==="touchmove"&&q.sourceEvent.touches.length>1||z&&!Q.has(z))&&(v=!0),!v){if(!d&&ee&&p&&(d=!0,V()),!p){const j=Pn(q.sourceEvent,m),I=j.x-h.x,F=j.y-h.y;Math.sqrt(I*I+F*F)>Y&&O(q)}(s.x!==K.xSnapped||s.y!==K.ySnapped)&&c&&p&&(h=Pn(q.sourceEvent,m),R(K))}}).on("end",q=>{if(!(!p||v)&&(d=!1,p=!1,cancelAnimationFrame(u),c.size>0)){const{nodeLookup:ee,updateNodePositions:B,onNodeDragStop:$,onSelectionDragStop:M}=n();if(w&&(B(c,!1),w=!1),a||$||!z&&M){const[Y,Q]=gh({nodeId:z,dragItems:c,nodeLookup:ee,dragging:!1});a==null||a(q.sourceEvent,c,Y,Q),$==null||$(q.sourceEvent,Y,Q),z||M==null||M(q.sourceEvent,Q)}}}).filter(q=>{const ee=q.target;return!q.button&&(!T||!Ov(ee,`.${T}`,A))&&(!E||Ov(ee,E,A))});x.call(L)}function S(){x==null||x.on(".drag",null)}return{update:_,destroy:S}}function gz(e,n,r){const l=[],a={x:e.x-r,y:e.y-r,width:r*2,height:r*2};for(const s of n.values())Vo(a,fa(s))>0&&l.push(s);return l}const xz=250;function yz(e,n,r,l){var c,d;let a=[],s=1/0;const u=gz(e,r,n+xz);for(const h of u){const m=[...((c=h.internals.handleBounds)==null?void 0:c.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:v}=el(h,p,p.position,!0),w=Math.sqrt(Math.pow(x-e.x,2)+Math.pow(v-e.y,2));w>n||(w1){const h=l.type==="source"?"target":"source";return a.find(m=>m.type===h)??a[0]}return a[0]}function NS(e,n,r,l,a,s=!1){var h,m,p;const u=l.get(e);if(!u)return null;const c=a==="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=(r?c==null?void 0:c.find(x=>x.id===r):c==null?void 0:c[0])??null;return d&&s?{...d,...el(u,d,d.position,!0)}:d}function CS(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function vz(e,n){let r=null;return n?r=!0:e&&!n&&(r=!1),r}const TS=()=>!0;function bz(e,{connectionMode:n,connectionRadius:r,handleId:l,nodeId:a,edgeUpdaterType:s,isTarget:u,domNode:c,nodeLookup:d,lib:h,autoPanOnConnect:m,flowId:p,panBy:x,cancelConnection:v,onConnectStart:w,onConnect:k,onConnectEnd:_,isValidConnection:S=TS,onReconnectEnd:T,updateConnection:E,getTransform:A,getFromHandle:U,autoPanSpeed:z,dragThreshold:H=1,handleDomNode:R}){const V=gS(e.target);let O=0,L;const{x:q,y:ee}=Pn(e),B=CS(s,R),$=c==null?void 0:c.getBoundingClientRect();let M=!1;if(!$||!B)return;const Y=NS(a,B,l,d,n);if(!Y)return;let Q=Pn(e,$),K=!1,j=null,I=!1,F=null;function N(){if(!m||!$)return;const[ve,ye]=dS(Q,$,z);x({x:ve,y:ye}),O=requestAnimationFrame(N)}const G={...Y,nodeId:a,type:B,position:Y.position},X=d.get(a);let ne={inProgress:!0,isValid:null,from:el(X,G,be.Left,!0),fromHandle:G,fromPosition:G.position,fromNode:X,to:Q,toHandle:null,toPosition:_v[G.position],toNode:null,pointer:Q};function re(){M=!0,E(ne),w==null||w(e,{nodeId:a,handleId:l,handleType:B})}H===0&&re();function se(ve){if(!M){const{x:ct,y:nt}=Pn(ve),Mt=ct-q,Vt=nt-ee;if(!(Mt*Mt+Vt*Vt>H*H))return;re()}if(!U()||!G){xe(ve);return}const ye=A();Q=Pn(ve,$),L=yz(ts(Q,ye,!1,[1,1]),r,d,G),K||(N(),K=!0);const pe=AS(ve,{handle:L,connectionMode:n,fromNodeId:a,fromHandleId:l,fromType:u?"target":"source",isValidConnection:S,doc:V,lib:h,flowId:p,nodeLookup:d});F=pe.handleDomNode,j=pe.connection,I=vz(!!L,pe.isValid);const _e=d.get(a),Me=_e?el(_e,G,be.Left,!0):ne.from,Te={...ne,from:Me,isValid:I,to:pe.toHandle&&I?pc({x:pe.toHandle.x,y:pe.toHandle.y},ye):Q,toHandle:pe.toHandle,toPosition:I&&pe.toHandle?pe.toHandle.position:_v[G.position],toNode:pe.toHandle?d.get(pe.toHandle.nodeId):null,pointer:Q};E(Te),ne=Te}function xe(ve){if(!("touches"in ve&&ve.touches.length>0)){if(M){(L||F)&&j&&I&&(k==null||k(j));const{inProgress:ye,...pe}=ne,_e={...pe,toPosition:ne.toHandle?ne.toPosition:null};_==null||_(ve,_e),s&&(T==null||T(ve,_e))}v(),cancelAnimationFrame(O),K=!1,I=!1,j=null,F=null,V.removeEventListener("mousemove",se),V.removeEventListener("mouseup",xe),V.removeEventListener("touchmove",se),V.removeEventListener("touchend",xe)}}V.addEventListener("mousemove",se),V.addEventListener("mouseup",xe),V.addEventListener("touchmove",se),V.addEventListener("touchend",xe)}function AS(e,{handle:n,connectionMode:r,fromNodeId:l,fromHandleId:a,fromType:s,doc:u,lib:c,flowId:d,isValidConnection:h=TS,nodeLookup:m}){const p=s==="target",x=n?u.querySelector(`.${c}-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}=Pn(e),k=u.elementFromPoint(v,w),_=k!=null&&k.classList.contains(`${c}-flow__handle`)?k:x,S={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const T=CS(void 0,_),E=_.getAttribute("data-nodeid"),A=_.getAttribute("data-handleid"),U=_.classList.contains("connectable"),z=_.classList.contains("connectableend");if(!E||!T)return S;const H={source:p?E:l,sourceHandle:p?A:a,target:p?l:E,targetHandle:p?a:A};S.connection=H;const V=U&&z&&(r===ua.Strict?p&&T==="source"||!p&&T==="target":E!==l||A!==a);S.isValid=V&&h(H),S.toHandle=NS(E,T,A,m,r,!0)}return S}const Jp={onPointerDown:bz,isValid:AS};function wz({domNode:e,panZoom:n,getTransform:r,getViewScale:l}){const a=wn(e);function s({translateExtent:c,width:d,height:h,zoomStep:m=1,pannable:p=!0,zoomable:x=!0,inversePan:v=!1}){const w=E=>{if(E.sourceEvent.type!=="wheel"||!n)return;const A=r(),U=E.sourceEvent.ctrlKey&&Po()?10:1,z=-E.sourceEvent.deltaY*(E.sourceEvent.deltaMode===1?.05:E.sourceEvent.deltaMode?1:.002)*m,H=A[2]*Math.pow(2,z*U);n.scaleTo(H)};let k=[0,0];const _=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])},S=E=>{const A=r();if(E.sourceEvent.type!=="mousemove"&&E.sourceEvent.type!=="touchmove"||!n)return;const U=[E.sourceEvent.clientX??E.sourceEvent.touches[0].clientX,E.sourceEvent.clientY??E.sourceEvent.touches[0].clientY],z=[U[0]-k[0],U[1]-k[1]];k=U;const H=l()*Math.max(A[2],Math.log(A[2]))*(v?-1:1),R={x:A[0]-z[0]*H,y:A[1]-z[1]*H},V=[[0,0],[d,h]];n.setViewportConstrained({x:R.x,y:R.y,zoom:A[2]},V,c)},T=iS().on("start",_).on("zoom",p?S:null).on("zoom.wheel",x?w:null);a.call(T,{})}function u(){a.on("zoom",null)}return{update:s,destroy:u,pointer:qn}}const jc=e=>({x:e.x,y:e.y,zoom:e.k}),xh=({x:e,y:n,zoom:r})=>Ac.translate(e,n).scale(r),ea=(e,n)=>e.target.closest(`.${n}`),zS=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),Sz=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,yh=(e,n=0,r=Sz,l=()=>{})=>{const a=typeof n=="number"&&n>0;return a||l(),a?e.transition().duration(n).ease(r).on("end",l):e},MS=e=>{const n=e.ctrlKey&&Po()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n};function _z({zoomPanValues:e,noWheelClassName:n,d3Selection:r,d3Zoom:l,panOnScrollMode:a,panOnScrollSpeed:s,zoomOnPinch:u,onPanZoomStart:c,onPanZoom:d,onPanZoomEnd:h}){return m=>{if(ea(m,n))return m.ctrlKey&&m.preventDefault(),!1;m.preventDefault(),m.stopImmediatePropagation();const p=r.property("__zoom").k||1;if(m.ctrlKey&&u){const _=qn(m),S=MS(m),T=p*Math.pow(2,S);l.scaleTo(r,T,_,m);return}const x=m.deltaMode===1?20:1;let v=a===Qi.Vertical?0:m.deltaX*x,w=a===Qi.Horizontal?0:m.deltaY*x;!Po()&&m.shiftKey&&a!==Qi.Vertical&&(v=m.deltaY*x,w=0),l.translateBy(r,-(v/p)*s,-(w/p)*s,{internal:!0});const k=jc(r.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,c==null||c(m,k))}}function Ez({noWheelClassName:e,preventScrolling:n,d3ZoomHandler:r}){return function(l,a){const s=l.type==="wheel",u=!n&&s&&!l.ctrlKey,c=ea(l,e);if(l.ctrlKey&&s&&c&&l.preventDefault(),u||c)return null;l.preventDefault(),r.call(this,l,a)}}function kz({zoomPanValues:e,onDraggingChange:n,onPanZoomStart:r}){return l=>{var s,u,c;if((s=l.sourceEvent)!=null&&s.internal)return;const a=jc(l.transform);e.mouseButton=((u=l.sourceEvent)==null?void 0:u.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=a,((c=l.sourceEvent)==null?void 0:c.type)==="mousedown"&&n(!0),r&&(r==null||r(l.sourceEvent,a))}}function Nz({zoomPanValues:e,panOnDrag:n,onPaneContextMenu:r,onTransformChange:l,onPanZoom:a}){return s=>{var u,c;e.usedRightMouseButton=!!(r&&zS(n,e.mouseButton??0)),(u=s.sourceEvent)!=null&&u.sync||l([s.transform.x,s.transform.y,s.transform.k]),a&&!((c=s.sourceEvent)!=null&&c.internal)&&(a==null||a(s.sourceEvent,jc(s.transform)))}}function Cz({zoomPanValues:e,panOnDrag:n,panOnScroll:r,onDraggingChange:l,onPanZoomEnd:a,onPaneContextMenu:s}){return u=>{var c;if(!((c=u.sourceEvent)!=null&&c.internal)&&(e.isZoomingOrPanning=!1,s&&zS(n,e.mouseButton??0)&&!e.usedRightMouseButton&&u.sourceEvent&&s(u.sourceEvent),e.usedRightMouseButton=!1,l(!1),a)){const d=jc(u.transform);e.prevViewport=d,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{a==null||a(u.sourceEvent,d)},r?150:0)}}}function Tz({zoomActivationKeyPressed:e,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:l,panOnScroll:a,zoomOnDoubleClick:s,userSelectionActive:u,noWheelClassName:c,noPanClassName:d,lib:h,connectionInProgress:m}){return p=>{var _;const x=e||n,v=r&&p.ctrlKey,w=p.type==="wheel";if(p.button===1&&p.type==="mousedown"&&(ea(p,`${h}-flow__node`)||ea(p,`${h}-flow__edge`)))return!0;if(!l&&!x&&!a&&!s&&!r||u||m&&!w||ea(p,c)&&w||ea(p,d)&&(!w||a&&w&&!e)||!r&&p.ctrlKey&&w)return!1;if(!r&&p.type==="touchstart"&&((_=p.touches)==null?void 0:_.length)>1)return p.preventDefault(),!1;if(!x&&!a&&!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 Az({domNode:e,minZoom:n,maxZoom:r,translateExtent:l,viewport:a,onPanZoom:s,onPanZoomStart:u,onPanZoomEnd:c,onDraggingChange:d}){const h={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},m=e.getBoundingClientRect(),p=iS().scaleExtent([n,r]).translateExtent(l),x=wn(e).call(p);T({x:a.x,y:a.y,zoom:ca(a.zoom,n,r)},[[0,0],[m.width,m.height]],l);const v=x.on("wheel.zoom"),w=x.on("dblclick.zoom");p.wheelDelta(MS);function k(L,q){return x?new Promise(ee=>{p==null||p.interpolate((q==null?void 0:q.interpolate)==="linear"?To:Ku).transform(yh(x,q==null?void 0:q.duration,q==null?void 0:q.ease,()=>ee(!0)),L)}):Promise.resolve(!1)}function _({noWheelClassName:L,noPanClassName:q,onPaneContextMenu:ee,userSelectionActive:B,panOnScroll:$,panOnDrag:M,panOnScrollMode:Y,panOnScrollSpeed:Q,preventScrolling:K,zoomOnPinch:j,zoomOnScroll:I,zoomOnDoubleClick:F,zoomActivationKeyPressed:N,lib:G,onTransformChange:X,connectionInProgress:J,paneClickDistance:ne,selectionOnDrag:re}){B&&!h.isZoomingOrPanning&&S();const se=$&&!N&&!B;p.clickDistance(re?1/0:!Vn(ne)||ne<0?0:ne);const xe=se?_z({zoomPanValues:h,noWheelClassName:L,d3Selection:x,d3Zoom:p,panOnScrollMode:Y,panOnScrollSpeed:Q,zoomOnPinch:j,onPanZoomStart:u,onPanZoom:s,onPanZoomEnd:c}):Ez({noWheelClassName:L,preventScrolling:K,d3ZoomHandler:v});if(x.on("wheel.zoom",xe,{passive:!1}),!B){const ye=kz({zoomPanValues:h,onDraggingChange:d,onPanZoomStart:u});p.on("start",ye);const pe=Nz({zoomPanValues:h,panOnDrag:M,onPaneContextMenu:!!ee,onPanZoom:s,onTransformChange:X});p.on("zoom",pe);const _e=Cz({zoomPanValues:h,panOnDrag:M,panOnScroll:$,onPaneContextMenu:ee,onPanZoomEnd:c,onDraggingChange:d});p.on("end",_e)}const ve=Tz({zoomActivationKeyPressed:N,panOnDrag:M,zoomOnScroll:I,panOnScroll:$,zoomOnDoubleClick:F,zoomOnPinch:j,userSelectionActive:B,noPanClassName:q,noWheelClassName:L,lib:G,connectionInProgress:J});p.filter(ve),F?x.on("dblclick.zoom",w):x.on("dblclick.zoom",null)}function S(){p.on("zoom",null)}async function T(L,q,ee){const B=xh(L),$=p==null?void 0:p.constrain()(B,q,ee);return $&&await k($),new Promise(M=>M($))}async function E(L,q){const ee=xh(L);return await k(ee,q),new Promise(B=>B(ee))}function A(L){if(x){const q=xh(L),ee=x.property("__zoom");(ee.k!==L.zoom||ee.x!==L.x||ee.y!==L.y)&&(p==null||p.transform(x,q,null,{sync:!0}))}}function U(){const L=x?rS(x.node()):{x:0,y:0,k:1};return{x:L.x,y:L.y,zoom:L.k}}function z(L,q){return x?new Promise(ee=>{p==null||p.interpolate((q==null?void 0:q.interpolate)==="linear"?To:Ku).scaleTo(yh(x,q==null?void 0:q.duration,q==null?void 0:q.ease,()=>ee(!0)),L)}):Promise.resolve(!1)}function H(L,q){return x?new Promise(ee=>{p==null||p.interpolate((q==null?void 0:q.interpolate)==="linear"?To:Ku).scaleBy(yh(x,q==null?void 0:q.duration,q==null?void 0:q.ease,()=>ee(!0)),L)}):Promise.resolve(!1)}function R(L){p==null||p.scaleExtent(L)}function V(L){p==null||p.translateExtent(L)}function O(L){const q=!Vn(L)||L<0?0:L;p==null||p.clickDistance(q)}return{update:_,destroy:S,setViewport:E,setViewportConstrained:T,getViewport:U,scaleTo:z,scaleBy:H,setScaleExtent:R,setTranslateExtent:V,syncViewport:A,setClickDistance:O}}var ha;(function(e){e.Line="line",e.Handle="handle"})(ha||(ha={}));function zz({width:e,prevWidth:n,height:r,prevHeight:l,affectsX:a,affectsY:s}){const u=e-n,c=r-l,d=[u>0?1:u<0?-1:0,c>0?1:c<0?-1:0];return u&&a&&(d[0]=d[0]*-1),c&&s&&(d[1]=d[1]*-1),d}function Lv(e){const n=e.includes("right")||e.includes("left"),r=e.includes("bottom")||e.includes("top"),l=e.includes("left"),a=e.includes("top");return{isHorizontal:n,isVertical:r,affectsX:l,affectsY:a}}function di(e,n){return Math.max(0,n-e)}function hi(e,n){return Math.max(0,e-n)}function Uu(e,n,r){return Math.max(0,n-e,e-r)}function Hv(e,n){return e?!n:n}function Mz(e,n,r,l,a,s,u,c){let{affectsX:d,affectsY:h}=n;const{isHorizontal:m,isVertical:p}=n,x=m&&p,{xSnapped:v,ySnapped:w}=r,{minWidth:k,maxWidth:_,minHeight:S,maxHeight:T}=l,{x:E,y:A,width:U,height:z,aspectRatio:H}=e;let R=Math.floor(m?v-e.pointerX:0),V=Math.floor(p?w-e.pointerY:0);const O=U+(d?-R:R),L=z+(h?-V:V),q=-s[0]*U,ee=-s[1]*z;let B=Uu(O,k,_),$=Uu(L,S,T);if(u){let Q=0,K=0;d&&R<0?Q=di(E+R+q,u[0][0]):!d&&R>0&&(Q=hi(E+O+q,u[1][0])),h&&V<0?K=di(A+V+ee,u[0][1]):!h&&V>0&&(K=hi(A+L+ee,u[1][1])),B=Math.max(B,Q),$=Math.max($,K)}if(c){let Q=0,K=0;d&&R>0?Q=hi(E+R,c[0][0]):!d&&R<0&&(Q=di(E+O,c[1][0])),h&&V>0?K=hi(A+V,c[0][1]):!h&&V<0&&(K=di(A+L,c[1][1])),B=Math.max(B,Q),$=Math.max($,K)}if(a){if(m){const Q=Uu(O/H,S,T)*H;if(B=Math.max(B,Q),u){let K=0;!d&&!h||d&&!h&&x?K=hi(A+ee+O/H,u[1][1])*H:K=di(A+ee+(d?R:-R)/H,u[0][1])*H,B=Math.max(B,K)}if(c){let K=0;!d&&!h||d&&!h&&x?K=di(A+O/H,c[1][1])*H:K=hi(A+(d?R:-R)/H,c[0][1])*H,B=Math.max(B,K)}}if(p){const Q=Uu(L*H,k,_)/H;if($=Math.max($,Q),u){let K=0;!d&&!h||h&&!d&&x?K=hi(E+L*H+q,u[1][0])/H:K=di(E+(h?V:-V)*H+q,u[0][0])/H,$=Math.max($,K)}if(c){let K=0;!d&&!h||h&&!d&&x?K=di(E+L*H,c[1][0])/H:K=hi(E+(h?V:-V)*H,c[0][0])/H,$=Math.max($,K)}}}V=V+(V<0?$:-$),R=R+(R<0?B:-B),a&&(x?O>L*H?V=(Hv(d,h)?-R:R)/H:R=(Hv(d,h)?-V:V)*H:m?(V=R/H,h=d):(R=V*H,d=h));const M=d?E+R:E,Y=h?A+V:A;return{width:U+(d?-R:R),height:z+(h?-V:V),x:s[0]*R*(d?-1:1)+M,y:s[1]*V*(h?-1:1)+Y}}const jS={width:0,height:0,x:0,y:0},jz={...jS,pointerX:0,pointerY:0,aspectRatio:1};function Dz(e){return[[0,0],[e.measured.width,e.measured.height]]}function Rz(e,n,r){const l=n.position.x+e.position.x,a=n.position.y+e.position.y,s=e.measured.width??0,u=e.measured.height??0,c=r[0]*s,d=r[1]*u;return[[l-c,a-d],[l+s-c,a+u-d]]}function Oz({domNode:e,nodeId:n,getStoreItems:r,onChange:l,onEnd:a}){const s=wn(e);let u={controlDirection:Lv("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:h,boundaries:m,keepAspectRatio:p,resizeDirection:x,onResizeStart:v,onResize:w,onResizeEnd:k,shouldResize:_}){let S={...jS},T={...jz};u={boundaries:m,resizeDirection:x,keepAspectRatio:p,controlDirection:Lv(h)};let E,A=null,U=[],z,H,R,V=!1;const O=Pw().on("start",L=>{const{nodeLookup:q,transform:ee,snapGrid:B,snapToGrid:$,nodeOrigin:M,paneDomNode:Y}=r();if(E=q.get(n),!E)return;A=(Y==null?void 0:Y.getBoundingClientRect())??null;const{xSnapped:Q,ySnapped:K}=Ao(L.sourceEvent,{transform:ee,snapGrid:B,snapToGrid:$,containerBounds:A});S={width:E.measured.width??0,height:E.measured.height??0,x:E.position.x??0,y:E.position.y??0},T={...S,pointerX:Q,pointerY:K,aspectRatio:S.width/S.height},z=void 0,E.parentId&&(E.extent==="parent"||E.expandParent)&&(z=q.get(E.parentId),H=z&&E.extent==="parent"?Dz(z):void 0),U=[],R=void 0;for(const[j,I]of q)if(I.parentId===n&&(U.push({id:j,position:{...I.position},extent:I.extent}),I.extent==="parent"||I.expandParent)){const F=Rz(I,E,I.origin??M);R?R=[[Math.min(F[0][0],R[0][0]),Math.min(F[0][1],R[0][1])],[Math.max(F[1][0],R[1][0]),Math.max(F[1][1],R[1][1])]]:R=F}v==null||v(L,{...S})}).on("drag",L=>{const{transform:q,snapGrid:ee,snapToGrid:B,nodeOrigin:$}=r(),M=Ao(L.sourceEvent,{transform:q,snapGrid:ee,snapToGrid:B,containerBounds:A}),Y=[];if(!E)return;const{x:Q,y:K,width:j,height:I}=S,F={},N=E.origin??$,{width:G,height:X,x:J,y:ne}=Mz(T,u.controlDirection,M,u.boundaries,u.keepAspectRatio,N,H,R),re=G!==j,se=X!==I,xe=J!==Q&&re,ve=ne!==K&&se;if(!xe&&!ve&&!re&&!se)return;if((xe||ve||N[0]===1||N[1]===1)&&(F.x=xe?J:S.x,F.y=ve?ne:S.y,S.x=F.x,S.y=F.y,U.length>0)){const Me=J-Q,Te=ne-K;for(const ct of U)ct.position={x:ct.position.x-Me+N[0]*(G-j),y:ct.position.y-Te+N[1]*(X-I)},Y.push(ct)}if((re||se)&&(F.width=re&&(!u.resizeDirection||u.resizeDirection==="horizontal")?G:S.width,F.height=se&&(!u.resizeDirection||u.resizeDirection==="vertical")?X:S.height,S.width=F.width,S.height=F.height),z&&E.expandParent){const Me=N[0]*(F.width??0);F.x&&F.x{V&&(k==null||k(L,{...S}),a==null||a({...S}),V=!1)});s.call(O)}function d(){s.on(".drag",null)}return{update:c,destroy:d}}var vh={exports:{}},bh={},wh={exports:{}},Sh={};/** + * @license React + * use-sync-external-store-shim.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Bv;function Lz(){if(Bv)return Sh;Bv=1;var e=Xo();function n(p,x){return p===x&&(p!==0||1/p===1/x)||p!==p&&x!==x}var r=typeof Object.is=="function"?Object.is:n,l=e.useState,a=e.useEffect,s=e.useLayoutEffect,u=e.useDebugValue;function c(p,x){var v=x(),w=l({inst:{value:v,getSnapshot:x}}),k=w[0].inst,_=w[1];return s(function(){k.value=v,k.getSnapshot=x,d(k)&&_({inst:k})},[p,v,x]),a(function(){return d(k)&&_({inst:k}),p(function(){d(k)&&_({inst:k})})},[p]),u(v),v}function d(p){var x=p.getSnapshot;p=p.value;try{var v=x();return!r(p,v)}catch{return!0}}function h(p,x){return x()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return Sh.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,Sh}var Iv;function Hz(){return Iv||(Iv=1,wh.exports=Lz()),wh.exports}/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var qv;function Bz(){if(qv)return bh;qv=1;var e=Xo(),n=Hz();function r(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}var l=typeof Object.is=="function"?Object.is:r,a=n.useSyncExternalStore,s=e.useRef,u=e.useEffect,c=e.useMemo,d=e.useDebugValue;return bh.useSyncExternalStoreWithSelector=function(h,m,p,x,v){var w=s(null);if(w.current===null){var k={hasValue:!1,value:null};w.current=k}else k=w.current;w=c(function(){function S(z){if(!T){if(T=!0,E=z,z=x(z),v!==void 0&&k.hasValue){var H=k.value;if(v(H,z))return A=H}return A=z}if(H=A,l(E,z))return H;var R=x(z);return v!==void 0&&v(H,R)?(E=z,H):(E=z,A=R)}var T=!1,E,A,U=p===void 0?null:p;return[function(){return S(m())},U===null?void 0:function(){return S(U())}]},[m,p,x,v]);var _=a(h,w[0],w[1]);return u(function(){k.hasValue=!0,k.value=_},[_]),d(_),_},bh}var Uv;function Iz(){return Uv||(Uv=1,vh.exports=Bz()),vh.exports}var qz=Iz();const Uz=Fo(qz),Vz={},Vv=e=>{let n;const r=new Set,l=(m,p)=>{const x=typeof m=="function"?m(n):m;if(!Object.is(x,n)){const v=n;n=p??(typeof x!="object"||x===null)?x:Object.assign({},n,x),r.forEach(w=>w(n,v))}},a=()=>n,d={setState:l,getState:a,getInitialState:()=>h,subscribe:m=>(r.add(m),()=>r.delete(m)),destroy:()=>{(Vz?"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."),r.clear()}},h=n=e(l,a,d);return d},Pz=e=>e?Vv(e):Vv,{useDebugValue:$z}=Jl,{useSyncExternalStoreWithSelector:Gz}=Uz,Yz=e=>e;function DS(e,n=Yz,r){const l=Gz(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,r);return $z(l),l}const Pv=(e,n)=>{const r=Pz(e),l=(a,s=n)=>DS(r,a,s);return Object.assign(l,r),l},Fz=(e,n)=>e?Pv(e,n):Pv;function pt(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,a]of e)if(!Object.is(a,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 r=Object.keys(e);if(r.length!==Object.keys(n).length)return!1;for(const l of r)if(!Object.prototype.hasOwnProperty.call(n,l)||!Object.is(e[l],n[l]))return!1;return!0}var Xz=nw();const Dc=P.createContext(null),Qz=Dc.Provider,RS=ir.error001();function $e(e,n){const r=P.useContext(Dc);if(r===null)throw new Error(RS);return DS(r,e,n)}function mt(){const e=P.useContext(Dc);if(e===null)throw new Error(RS);return P.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const $v={display:"none"},Zz={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},OS="react-flow__node-desc",LS="react-flow__edge-desc",Kz="react-flow__aria-live",Jz=e=>e.ariaLiveMessage,Wz=e=>e.ariaLabelConfig;function eM({rfId:e}){const n=$e(Jz);return b.jsx("div",{id:`${Kz}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Zz,children:n})}function tM({rfId:e,disableKeyboardA11y:n}){const r=$e(Wz);return b.jsxs(b.Fragment,{children:[b.jsx("div",{id:`${OS}-${e}`,style:$v,children:n?r["node.a11yDescription.default"]:r["node.a11yDescription.keyboardDisabled"]}),b.jsx("div",{id:`${LS}-${e}`,style:$v,children:r["edge.a11yDescription.default"]}),!n&&b.jsx(eM,{rfId:e})]})}const Rc=P.forwardRef(({position:e="top-left",children:n,className:r,style:l,...a},s)=>{const u=`${e}`.split("-");return b.jsx("div",{className:zt(["react-flow__panel",r,...u]),style:l,ref:s,...a,children:n})});Rc.displayName="Panel";function nM({proOptions:e,position:n="bottom-right"}){return e!=null&&e.hideAttribution?null:b.jsx(Rc,{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 rM=e=>{const n=[],r=[];for(const[,l]of e.nodeLookup)l.selected&&n.push(l.internals.userNode);for(const[,l]of e.edgeLookup)l.selected&&r.push(l);return{selectedNodes:n,selectedEdges:r}},Vu=e=>e.id;function iM(e,n){return pt(e.selectedNodes.map(Vu),n.selectedNodes.map(Vu))&&pt(e.selectedEdges.map(Vu),n.selectedEdges.map(Vu))}function lM({onSelectionChange:e}){const n=mt(),{selectedNodes:r,selectedEdges:l}=$e(rM,iM);return P.useEffect(()=>{const a={nodes:r,edges:l};e==null||e(a),n.getState().onSelectionChangeHandlers.forEach(s=>s(a))},[r,l,e]),null}const aM=e=>!!e.onSelectionChangeHandlers;function oM({onSelectionChange:e}){const n=$e(aM);return e||n?b.jsx(lM,{onSelectionChange:e}):null}const HS=[0,0],sM={x:0,y:0,zoom:1},uM=["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"],Gv=[...uM,"rfId"],cM=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}),Yv={translateExtent:qo,nodeOrigin:HS,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function fM(e){const{setNodes:n,setEdges:r,setMinZoom:l,setMaxZoom:a,setTranslateExtent:s,setNodeExtent:u,reset:c,setDefaultNodesAndEdges:d}=$e(cM,pt),h=mt();P.useEffect(()=>(d(e.defaultNodes,e.defaultEdges),()=>{m.current=Yv,c()}),[]);const m=P.useRef(Yv);return P.useEffect(()=>{for(const p of Gv){const x=e[p],v=m.current[p];x!==v&&(typeof e[p]>"u"||(p==="nodes"?n(x):p==="edges"?r(x):p==="minZoom"?l(x):p==="maxZoom"?a(x):p==="translateExtent"?s(x):p==="nodeExtent"?u(x):p==="ariaLabelConfig"?h.setState({ariaLabelConfig:FA(x)}):p==="fitView"?h.setState({fitViewQueued:x}):p==="fitViewOptions"?h.setState({fitViewOptions:x}):h.setState({[p]:x})))}m.current=e},Gv.map(p=>e[p])),null}function Fv(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function dM(e){var l;const[n,r]=P.useState(e==="system"?null:e);return P.useEffect(()=>{if(e!=="system"){r(e);return}const a=Fv(),s=()=>r(a!=null&&a.matches?"dark":"light");return s(),a==null||a.addEventListener("change",s),()=>{a==null||a.removeEventListener("change",s)}},[e]),n!==null?n:(l=Fv())!=null&&l.matches?"dark":"light"}const Xv=typeof document<"u"?document:null;function $o(e=null,n={target:Xv,actInsideInputWithModifier:!0}){const[r,l]=P.useState(!1),a=P.useRef(!1),s=P.useRef(new Set([])),[u,c]=P.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,x)=>p.concat(...x),[]);return[h,m]}return[[],[]]},[e]);return P.useEffect(()=>{const d=(n==null?void 0:n.target)??Xv,h=(n==null?void 0:n.actInsideInputWithModifier)??!0;if(e!==null){const m=v=>{var _,S;if(a.current=v.ctrlKey||v.metaKey||v.shiftKey||v.altKey,(!a.current||a.current&&!h)&&xS(v))return!1;const k=Zv(v.code,c);if(s.current.add(v[k]),Qv(u,s.current,!1)){const T=((S=(_=v.composedPath)==null?void 0:_.call(v))==null?void 0:S[0])||v.target,E=(T==null?void 0:T.nodeName)==="BUTTON"||(T==null?void 0:T.nodeName)==="A";n.preventDefault!==!1&&(a.current||!E)&&v.preventDefault(),l(!0)}},p=v=>{const w=Zv(v.code,c);Qv(u,s.current,!0)?(l(!1),s.current.clear()):s.current.delete(v[w]),v.key==="Meta"&&s.current.clear(),a.current=!1},x=()=>{s.current.clear(),l(!1)};return d==null||d.addEventListener("keydown",m),d==null||d.addEventListener("keyup",p),window.addEventListener("blur",x),window.addEventListener("contextmenu",x),()=>{d==null||d.removeEventListener("keydown",m),d==null||d.removeEventListener("keyup",p),window.removeEventListener("blur",x),window.removeEventListener("contextmenu",x)}}},[e,l]),r}function Qv(e,n,r){return e.filter(l=>r||l.length===n.size).some(l=>l.every(a=>n.has(a)))}function Zv(e,n){return n.includes(e)?"code":"key"}const hM=()=>{const e=mt();return P.useMemo(()=>({zoomIn:n=>{const{panZoom:r}=e.getState();return r?r.scaleBy(1.2,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},zoomOut:n=>{const{panZoom:r}=e.getState();return r?r.scaleBy(1/1.2,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},zoomTo:(n,r)=>{const{panZoom:l}=e.getState();return l?l.scaleTo(n,{duration:r==null?void 0:r.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(n,r)=>{const{transform:[l,a,s],panZoom:u}=e.getState();return u?(await u.setViewport({x:n.x??l,y:n.y??a,zoom:n.zoom??s},r),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[n,r,l]=e.getState().transform;return{x:n,y:r,zoom:l}},setCenter:async(n,r,l)=>e.getState().setCenter(n,r,l),fitBounds:async(n,r)=>{const{width:l,height:a,minZoom:s,maxZoom:u,panZoom:c}=e.getState(),d=Nm(n,l,a,s,u,(r==null?void 0:r.padding)??.1);return c?(await c.setViewport(d,{duration:r==null?void 0:r.duration,ease:r==null?void 0:r.ease,interpolate:r==null?void 0:r.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(n,r={})=>{const{transform:l,snapGrid:a,snapToGrid:s,domNode:u}=e.getState();if(!u)return n;const{x:c,y:d}=u.getBoundingClientRect(),h={x:n.x-c,y:n.y-d},m=r.snapGrid??a,p=r.snapToGrid??s;return ts(h,l,p,m)},flowToScreenPosition:n=>{const{transform:r,domNode:l}=e.getState();if(!l)return n;const{x:a,y:s}=l.getBoundingClientRect(),u=pc(n,r);return{x:u.x+a,y:u.y+s}}}),[])};function BS(e,n){const r=[],l=new Map,a=[];for(const s of e)if(s.type==="add"){a.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){r.push(s);continue}if(u[0].type==="remove")continue;if(u[0].type==="replace"){r.push({...u[0].item});continue}const c={...s};for(const d of u)pM(d,c);r.push(c)}return a.length&&a.forEach(s=>{s.index!==void 0?r.splice(s.index,0,{...s.item}):r.push({...s.item})}),r}function pM(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 IS(e,n){return BS(e,n)}function qS(e,n){return BS(e,n)}function Pi(e,n){return{id:e,type:"select",selected:n}}function ta(e,n=new Set,r=!1){const l=[];for(const[a,s]of e){const u=n.has(a);!(s.selected===void 0&&!u)&&s.selected!==u&&(r&&(s.selected=u),l.push(Pi(s.id,u)))}return l}function Kv({items:e=[],lookup:n}){var a;const r=[],l=new Map(e.map(s=>[s.id,s]));for(const[s,u]of e.entries()){const c=n.get(u.id),d=((a=c==null?void 0:c.internals)==null?void 0:a.userNode)??c;d!==void 0&&d!==u&&r.push({id:u.id,item:u,type:"replace"}),d===void 0&&r.push({item:u,type:"add",index:s})}for(const[s]of n)l.get(s)===void 0&&r.push({id:s,type:"remove"});return r}function Jv(e){return{id:e.id,type:"remove"}}const Wv=e=>HA(e),mM=e=>uS(e);function US(e){return P.forwardRef(e)}const gM=typeof window<"u"?P.useLayoutEffect:P.useEffect;function e1(e){const[n,r]=P.useState(BigInt(0)),[l]=P.useState(()=>xM(()=>r(a=>a+BigInt(1))));return gM(()=>{const a=l.get();a.length&&(e(a),l.reset())},[n]),l}function xM(e){let n=[];return{get:()=>n,reset:()=>{n=[]},push:r=>{n.push(r),e()}}}const VS=P.createContext(null);function yM({children:e}){const n=mt(),r=P.useCallback(c=>{const{nodes:d=[],setNodes:h,hasDefaultNodes:m,onNodesChange:p,nodeLookup:x,fitViewQueued:v,onNodesChangeMiddlewareMap:w}=n.getState();let k=d;for(const S of c)k=typeof S=="function"?S(k):S;let _=Kv({items:k,lookup:x});for(const S of w.values())_=S(_);m&&h(k),_.length>0?p==null||p(_):v&&window.requestAnimationFrame(()=>{const{fitViewQueued:S,nodes:T,setNodes:E}=n.getState();S&&E(T)})},[]),l=e1(r),a=P.useCallback(c=>{const{edges:d=[],setEdges:h,hasDefaultEdges:m,onEdgesChange:p,edgeLookup:x}=n.getState();let v=d;for(const w of c)v=typeof w=="function"?w(v):w;m?h(v):p&&p(Kv({items:v,lookup:x}))},[]),s=e1(a),u=P.useMemo(()=>({nodeQueue:l,edgeQueue:s}),[]);return b.jsx(VS.Provider,{value:u,children:e})}function vM(){const e=P.useContext(VS);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const bM=e=>!!e.panZoom;function ma(){const e=hM(),n=mt(),r=vM(),l=$e(bM),a=P.useMemo(()=>{const s=p=>n.getState().nodeLookup.get(p),u=p=>{r.nodeQueue.push(p)},c=p=>{r.edgeQueue.push(p)},d=p=>{var S,T;const{nodeLookup:x,nodeOrigin:v}=n.getState(),w=Wv(p)?p:x.get(p.id),k=w.parentId?mS(w.position,w.measured,w.parentId,x,v):w.position,_={...w,position:k,width:((S=w.measured)==null?void 0:S.width)??w.width,height:((T=w.measured)==null?void 0:T.height)??w.height};return fa(_)},h=(p,x,v={replace:!1})=>{u(w=>w.map(k=>{if(k.id===p){const _=typeof x=="function"?x(k):x;return v.replace&&Wv(_)?_:{...k,..._}}return k}))},m=(p,x,v={replace:!1})=>{c(w=>w.map(k=>{if(k.id===p){const _=typeof x=="function"?x(k):x;return v.replace&&mM(_)?_:{...k,..._}}return k}))};return{getNodes:()=>n.getState().nodes.map(p=>({...p})),getNode:p=>{var x;return(x=s(p))==null?void 0:x.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:p=[]}=n.getState();return p.map(x=>({...x}))},getEdge:p=>n.getState().edgeLookup.get(p),setNodes:u,setEdges:c,addNodes:p=>{const x=Array.isArray(p)?p:[p];r.nodeQueue.push(v=>[...v,...x])},addEdges:p=>{const x=Array.isArray(p)?p:[p];r.edgeQueue.push(v=>[...v,...x])},toObject:()=>{const{nodes:p=[],edges:x=[],transform:v}=n.getState(),[w,k,_]=v;return{nodes:p.map(S=>({...S})),edges:x.map(S=>({...S})),viewport:{x:w,y:k,zoom:_}}},deleteElements:async({nodes:p=[],edges:x=[]})=>{const{nodes:v,edges:w,onNodesDelete:k,onEdgesDelete:_,triggerNodeChanges:S,triggerEdgeChanges:T,onDelete:E,onBeforeDelete:A}=n.getState(),{nodes:U,edges:z}=await VA({nodesToRemove:p,edgesToRemove:x,nodes:v,edges:w,onBeforeDelete:A}),H=z.length>0,R=U.length>0;if(H){const V=z.map(Jv);_==null||_(z),T(V)}if(R){const V=U.map(Jv);k==null||k(U),S(V)}return(R||H)&&(E==null||E({nodes:U,edges:z})),{deletedNodes:U,deletedEdges:z}},getIntersectingNodes:(p,x=!0,v)=>{const w=kv(p),k=w?p:d(p),_=v!==void 0;return k?(v||n.getState().nodes).filter(S=>{const T=n.getState().nodeLookup.get(S.id);if(T&&!w&&(S.id===p.id||!T.internals.positionAbsolute))return!1;const E=fa(_?S:T),A=Vo(E,k);return x&&A>0||A>=E.width*E.height||A>=k.width*k.height}):[]},isNodeIntersecting:(p,x,v=!0)=>{const k=kv(p)?p:d(p);if(!k)return!1;const _=Vo(k,x);return v&&_>0||_>=x.width*x.height||_>=k.width*k.height},updateNode:h,updateNodeData:(p,x,v={replace:!1})=>{h(p,w=>{const k=typeof x=="function"?x(w):x;return v.replace?{...w,data:k}:{...w,data:{...w.data,...k}}},v)},updateEdge:m,updateEdgeData:(p,x,v={replace:!1})=>{m(p,w=>{const k=typeof x=="function"?x(w):x;return v.replace?{...w,data:k}:{...w,data:{...w.data,...k}}},v)},getNodesBounds:p=>{const{nodeLookup:x,nodeOrigin:v}=n.getState();return BA(p,{nodeLookup:x,nodeOrigin:v})},getHandleConnections:({type:p,id:x,nodeId:v})=>{var w;return Array.from(((w=n.getState().connectionLookup.get(`${v}-${p}${x?`-${x}`:""}`))==null?void 0:w.values())??[])},getNodeConnections:({type:p,handleId:x,nodeId:v})=>{var w;return Array.from(((w=n.getState().connectionLookup.get(`${v}${p?x?`-${p}-${x}`:`-${p}`:""}`))==null?void 0:w.values())??[])},fitView:async p=>{const x=n.getState().fitViewResolver??YA();return n.setState({fitViewQueued:!0,fitViewOptions:p,fitViewResolver:x}),r.nodeQueue.push(v=>[...v]),x.promise}}},[]);return P.useMemo(()=>({...a,...e,viewportInitialized:l}),[l])}const t1=e=>e.selected,wM=typeof window<"u"?window:void 0;function SM({deleteKeyCode:e,multiSelectionKeyCode:n}){const r=mt(),{deleteElements:l}=ma(),a=$o(e,{actInsideInputWithModifier:!1}),s=$o(n,{target:wM});P.useEffect(()=>{if(a){const{edges:u,nodes:c}=r.getState();l({nodes:c.filter(t1),edges:u.filter(t1)}),r.setState({nodesSelectionActive:!1})}},[a]),P.useEffect(()=>{r.setState({multiSelectionActive:s})},[s])}function _M(e){const n=mt();P.useEffect(()=>{const r=()=>{var a,s,u,c;if(!e.current||!(((s=(a=e.current).checkVisibility)==null?void 0:s.call(a))??!0))return!1;const l=Cm(e.current);(l.height===0||l.width===0)&&((c=(u=n.getState()).onError)==null||c.call(u,"004",ir.error004())),n.setState({width:l.width||500,height:l.height||500})};if(e.current){r(),window.addEventListener("resize",r);const l=new ResizeObserver(()=>r());return l.observe(e.current),()=>{window.removeEventListener("resize",r),l&&e.current&&l.unobserve(e.current)}}},[])}const Oc={position:"absolute",width:"100%",height:"100%",top:0,left:0},EM=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function kM({onPaneContextMenu:e,zoomOnScroll:n=!0,zoomOnPinch:r=!0,panOnScroll:l=!1,panOnScrollSpeed:a=.5,panOnScrollMode:s=Qi.Free,zoomOnDoubleClick:u=!0,panOnDrag:c=!0,defaultViewport:d,translateExtent:h,minZoom:m,maxZoom:p,zoomActivationKeyCode:x,preventScrolling:v=!0,children:w,noWheelClassName:k,noPanClassName:_,onViewportChange:S,isControlledViewport:T,paneClickDistance:E,selectionOnDrag:A}){const U=mt(),z=P.useRef(null),{userSelectionActive:H,lib:R,connectionInProgress:V}=$e(EM,pt),O=$o(x),L=P.useRef();_M(z);const q=P.useCallback(ee=>{S==null||S({x:ee[0],y:ee[1],zoom:ee[2]}),T||U.setState({transform:ee})},[S,T]);return P.useEffect(()=>{if(z.current){L.current=Az({domNode:z.current,minZoom:m,maxZoom:p,translateExtent:h,viewport:d,onDraggingChange:M=>U.setState(Y=>Y.paneDragging===M?Y:{paneDragging:M}),onPanZoomStart:(M,Y)=>{const{onViewportChangeStart:Q,onMoveStart:K}=U.getState();K==null||K(M,Y),Q==null||Q(Y)},onPanZoom:(M,Y)=>{const{onViewportChange:Q,onMove:K}=U.getState();K==null||K(M,Y),Q==null||Q(Y)},onPanZoomEnd:(M,Y)=>{const{onViewportChangeEnd:Q,onMoveEnd:K}=U.getState();K==null||K(M,Y),Q==null||Q(Y)}});const{x:ee,y:B,zoom:$}=L.current.getViewport();return U.setState({panZoom:L.current,transform:[ee,B,$],domNode:z.current.closest(".react-flow")}),()=>{var M;(M=L.current)==null||M.destroy()}}},[]),P.useEffect(()=>{var ee;(ee=L.current)==null||ee.update({onPaneContextMenu:e,zoomOnScroll:n,zoomOnPinch:r,panOnScroll:l,panOnScrollSpeed:a,panOnScrollMode:s,zoomOnDoubleClick:u,panOnDrag:c,zoomActivationKeyPressed:O,preventScrolling:v,noPanClassName:_,userSelectionActive:H,noWheelClassName:k,lib:R,onTransformChange:q,connectionInProgress:V,selectionOnDrag:A,paneClickDistance:E})},[e,n,r,l,a,s,u,c,O,v,_,H,k,R,q,V,A,E]),b.jsx("div",{className:"react-flow__renderer",ref:z,style:Oc,children:w})}const NM=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function CM(){const{userSelectionActive:e,userSelectionRect:n}=$e(NM,pt);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 _h=(e,n)=>r=>{r.target===n.current&&(e==null||e(r))},TM=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function AM({isSelecting:e,selectionKeyPressed:n,selectionMode:r=Uo.Full,panOnDrag:l,paneClickDistance:a,selectionOnDrag:s,onSelectionStart:u,onSelectionEnd:c,onPaneClick:d,onPaneContextMenu:h,onPaneScroll:m,onPaneMouseEnter:p,onPaneMouseMove:x,onPaneMouseLeave:v,children:w}){const k=mt(),{userSelectionActive:_,elementsSelectable:S,dragging:T,connectionInProgress:E}=$e(TM,pt),A=S&&(e||_),U=P.useRef(null),z=P.useRef(),H=P.useRef(new Set),R=P.useRef(new Set),V=P.useRef(!1),O=Q=>{if(V.current||E){V.current=!1;return}d==null||d(Q),k.getState().resetSelectedElements(),k.setState({nodesSelectionActive:!1})},L=Q=>{if(Array.isArray(l)&&(l!=null&&l.includes(2))){Q.preventDefault();return}h==null||h(Q)},q=m?Q=>m(Q):void 0,ee=Q=>{V.current&&(Q.stopPropagation(),V.current=!1)},B=Q=>{var X,J;const{domNode:K}=k.getState();if(z.current=K==null?void 0:K.getBoundingClientRect(),!z.current)return;const j=Q.target===U.current;if(!j&&!!Q.target.closest(".nokey")||!e||!(s&&j||n)||Q.button!==0||!Q.isPrimary)return;(J=(X=Q.target)==null?void 0:X.setPointerCapture)==null||J.call(X,Q.pointerId),V.current=!1;const{x:N,y:G}=Pn(Q.nativeEvent,z.current);k.setState({userSelectionRect:{width:0,height:0,startX:N,startY:G,x:N,y:G}}),j||(Q.stopPropagation(),Q.preventDefault())},$=Q=>{const{userSelectionRect:K,transform:j,nodeLookup:I,edgeLookup:F,connectionLookup:N,triggerNodeChanges:G,triggerEdgeChanges:X,defaultEdgeOptions:J,resetSelectedElements:ne}=k.getState();if(!z.current||!K)return;const{x:re,y:se}=Pn(Q.nativeEvent,z.current),{startX:xe,startY:ve}=K;if(!V.current){const Te=n?0:a;if(Math.hypot(re-xe,se-ve)<=Te)return;ne(),u==null||u(Q)}V.current=!0;const ye={startX:xe,startY:ve,x:reTe.id)),R.current=new Set;const Me=(J==null?void 0:J.selectable)??!0;for(const Te of H.current){const ct=N.get(Te);if(ct)for(const{edgeId:nt}of ct.values()){const Mt=F.get(nt);Mt&&(Mt.selectable??Me)&&R.current.add(nt)}}if(!Nv(pe,H.current)){const Te=ta(I,H.current,!0);G(Te)}if(!Nv(_e,R.current)){const Te=ta(F,R.current);X(Te)}k.setState({userSelectionRect:ye,userSelectionActive:!0,nodesSelectionActive:!1})},M=Q=>{var K,j;Q.button===0&&((j=(K=Q.target)==null?void 0:K.releasePointerCapture)==null||j.call(K,Q.pointerId),!_&&Q.target===U.current&&k.getState().userSelectionRect&&(O==null||O(Q)),k.setState({userSelectionActive:!1,userSelectionRect:null}),V.current&&(c==null||c(Q),k.setState({nodesSelectionActive:H.current.size>0})))},Y=l===!0||Array.isArray(l)&&l.includes(0);return b.jsxs("div",{className:zt(["react-flow__pane",{draggable:Y,dragging:T,selection:e}]),onClick:A?void 0:_h(O,U),onContextMenu:_h(L,U),onWheel:_h(q,U),onPointerEnter:A?void 0:p,onPointerMove:A?$:x,onPointerUp:A?M:void 0,onPointerDownCapture:A?B:void 0,onClickCapture:A?ee:void 0,onPointerLeave:v,ref:U,style:Oc,children:[w,b.jsx(CM,{})]})}function Wp({id:e,store:n,unselect:r=!1,nodeRef:l}){const{addSelectedNodes:a,unselectNodesAndEdges:s,multiSelectionActive:u,nodeLookup:c,onError:d}=n.getState(),h=c.get(e);if(!h){d==null||d("012",ir.error012(e));return}n.setState({nodesSelectionActive:!1}),h.selected?(r||h.selected&&u)&&(s({nodes:[h],edges:[]}),requestAnimationFrame(()=>{var m;return(m=l==null?void 0:l.current)==null?void 0:m.blur()})):a([e])}function PS({nodeRef:e,disabled:n=!1,noDragClassName:r,handleSelector:l,nodeId:a,isSelectable:s,nodeClickDistance:u}){const c=mt(),[d,h]=P.useState(!1),m=P.useRef();return P.useEffect(()=>{m.current=mz({getStoreItems:()=>c.getState(),onNodeMouseDown:p=>{Wp({id:p,store:c,nodeRef:e})},onDragStart:()=>{h(!0)},onDragStop:()=>{h(!1)}})},[]),P.useEffect(()=>{if(!(n||!e.current||!m.current))return m.current.update({noDragClassName:r,handleSelector:l,domNode:e.current,isSelectable:s,nodeId:a,nodeClickDistance:u}),()=>{var p;(p=m.current)==null||p.destroy()}},[r,l,n,s,e,a,u]),d}const zM=e=>n=>n.selected&&(n.draggable||e&&typeof n.draggable>"u");function $S(){const e=mt();return P.useCallback(r=>{const{nodeExtent:l,snapToGrid:a,snapGrid:s,nodesDraggable:u,onError:c,updateNodePositions:d,nodeLookup:h,nodeOrigin:m}=e.getState(),p=new Map,x=zM(u),v=a?s[0]:5,w=a?s[1]:5,k=r.direction.x*v*r.factor,_=r.direction.y*w*r.factor;for(const[,S]of h){if(!x(S))continue;let T={x:S.internals.positionAbsolute.x+k,y:S.internals.positionAbsolute.y+_};a&&(T=es(T,s));const{position:E,positionAbsolute:A}=cS({nodeId:S.id,nextPosition:T,nodeLookup:h,nodeExtent:l,nodeOrigin:m,onError:c});S.position=E,S.internals.positionAbsolute=A,p.set(S.id,S)}d(p)},[])}const Rm=P.createContext(null),MM=Rm.Provider;Rm.Consumer;const GS=()=>P.useContext(Rm),jM=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),DM=(e,n,r)=>l=>{const{connectionClickStartHandle:a,connectionMode:s,connection:u}=l,{fromHandle:c,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)===r;return{connectingFrom:(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===n&&(c==null?void 0:c.type)===r,connectingTo:m,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===n&&(a==null?void 0:a.type)===r,isPossibleEndHandle:s===ua.Strict?(c==null?void 0:c.type)!==r:e!==(c==null?void 0:c.nodeId)||n!==(c==null?void 0:c.id),connectionInProcess:!!c,clickConnectionInProcess:!!a,valid:m&&h}};function RM({type:e="source",position:n=be.Top,isValidConnection:r,isConnectable:l=!0,isConnectableStart:a=!0,isConnectableEnd:s=!0,id:u,onConnect:c,children:d,className:h,onMouseDown:m,onTouchStart:p,...x},v){var $,M;const w=u||null,k=e==="target",_=mt(),S=GS(),{connectOnClick:T,noPanClassName:E,rfId:A}=$e(jM,pt),{connectingFrom:U,connectingTo:z,clickConnecting:H,isPossibleEndHandle:R,connectionInProcess:V,clickConnectionInProcess:O,valid:L}=$e(DM(S,w,e),pt);S||(M=($=_.getState()).onError)==null||M.call($,"010",ir.error010());const q=Y=>{const{defaultEdgeOptions:Q,onConnect:K,hasDefaultEdges:j}=_.getState(),I={...Q,...Y};if(j){const{edges:F,setEdges:N}=_.getState();N(WA(I,F))}K==null||K(I),c==null||c(I)},ee=Y=>{if(!S)return;const Q=yS(Y.nativeEvent);if(a&&(Q&&Y.button===0||!Q)){const K=_.getState();Jp.onPointerDown(Y.nativeEvent,{handleDomNode:Y.currentTarget,autoPanOnConnect:K.autoPanOnConnect,connectionMode:K.connectionMode,connectionRadius:K.connectionRadius,domNode:K.domNode,nodeLookup:K.nodeLookup,lib:K.lib,isTarget:k,handleId:w,nodeId:S,flowId:K.rfId,panBy:K.panBy,cancelConnection:K.cancelConnection,onConnectStart:K.onConnectStart,onConnectEnd:(...j)=>{var I,F;return(F=(I=_.getState()).onConnectEnd)==null?void 0:F.call(I,...j)},updateConnection:K.updateConnection,onConnect:q,isValidConnection:r||((...j)=>{var I,F;return((F=(I=_.getState()).isValidConnection)==null?void 0:F.call(I,...j))??!0}),getTransform:()=>_.getState().transform,getFromHandle:()=>_.getState().connection.fromHandle,autoPanSpeed:K.autoPanSpeed,dragThreshold:K.connectionDragThreshold})}Q?m==null||m(Y):p==null||p(Y)},B=Y=>{const{onClickConnectStart:Q,onClickConnectEnd:K,connectionClickStartHandle:j,connectionMode:I,isValidConnection:F,lib:N,rfId:G,nodeLookup:X,connection:J}=_.getState();if(!S||!j&&!a)return;if(!j){Q==null||Q(Y.nativeEvent,{nodeId:S,handleId:w,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:S,type:e,id:w}});return}const ne=gS(Y.target),re=r||F,{connection:se,isValid:xe}=Jp.isValid(Y.nativeEvent,{handle:{nodeId:S,id:w,type:e},connectionMode:I,fromNodeId:j.nodeId,fromHandleId:j.id||null,fromType:j.type,isValidConnection:re,flowId:G,doc:ne,lib:N,nodeLookup:X});xe&&se&&q(se);const ve=structuredClone(J);delete ve.inProgress,ve.toPosition=ve.toHandle?ve.toHandle.position:null,K==null||K(Y,ve),_.setState({connectionClickStartHandle:null})};return b.jsx("div",{"data-handleid":w,"data-nodeid":S,"data-handlepos":n,"data-id":`${A}-${S}-${w}-${e}`,className:zt(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",E,h,{source:!k,target:k,connectable:l,connectablestart:a,connectableend:s,clickconnecting:H,connectingfrom:U,connectingto:z,valid:L,connectionindicator:l&&(!V||R)&&(V||O?s:a)}]),onMouseDown:ee,onTouchStart:ee,onClick:T?B:void 0,ref:v,...x,children:d})}const Ft=P.memo(US(RM));function OM({data:e,isConnectable:n,sourcePosition:r=be.Bottom}){return b.jsxs(b.Fragment,{children:[e==null?void 0:e.label,b.jsx(Ft,{type:"source",position:r,isConnectable:n})]})}function LM({data:e,isConnectable:n,targetPosition:r=be.Top,sourcePosition:l=be.Bottom}){return b.jsxs(b.Fragment,{children:[b.jsx(Ft,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label,b.jsx(Ft,{type:"source",position:l,isConnectable:n})]})}function HM(){return null}function BM({data:e,isConnectable:n,targetPosition:r=be.Top}){return b.jsxs(b.Fragment,{children:[b.jsx(Ft,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label]})}const mc={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},n1={input:OM,default:LM,output:BM,group:HM};function IM(e){var n,r,l,a;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((n=e.style)==null?void 0:n.width),height:e.height??e.initialHeight??((r=e.style)==null?void 0:r.height)}:{width:e.width??((l=e.style)==null?void 0:l.width),height:e.height??((a=e.style)==null?void 0:a.height)}}const qM=e=>{const{width:n,height:r,x:l,y:a}=Wo(e.nodeLookup,{filter:s=>!!s.selected});return{width:Vn(n)?n:null,height:Vn(r)?r:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${l}px,${a}px)`}};function UM({onSelectionContextMenu:e,noPanClassName:n,disableKeyboardA11y:r}){const l=mt(),{width:a,height:s,transformString:u,userSelectionActive:c}=$e(qM,pt),d=$S(),h=P.useRef(null);P.useEffect(()=>{var v;r||(v=h.current)==null||v.focus({preventScroll:!0})},[r]);const m=!c&&a!==null&&s!==null;if(PS({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,x=v=>{Object.prototype.hasOwnProperty.call(mc,v.key)&&(v.preventDefault(),d({direction:mc[v.key],factor:v.shiftKey?4:1}))};return b.jsx("div",{className:zt(["react-flow__nodesselection","react-flow__container",n]),style:{transform:u},children:b.jsx("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:p,tabIndex:r?void 0:-1,onKeyDown:r?void 0:x,style:{width:a,height:s}})})}const r1=typeof window<"u"?window:void 0,VM=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function YS({children:e,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:l,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:u,paneClickDistance:c,deleteKeyCode:d,selectionKeyCode:h,selectionOnDrag:m,selectionMode:p,onSelectionStart:x,onSelectionEnd:v,multiSelectionKeyCode:w,panActivationKeyCode:k,zoomActivationKeyCode:_,elementsSelectable:S,zoomOnScroll:T,zoomOnPinch:E,panOnScroll:A,panOnScrollSpeed:U,panOnScrollMode:z,zoomOnDoubleClick:H,panOnDrag:R,defaultViewport:V,translateExtent:O,minZoom:L,maxZoom:q,preventScrolling:ee,onSelectionContextMenu:B,noWheelClassName:$,noPanClassName:M,disableKeyboardA11y:Y,onViewportChange:Q,isControlledViewport:K}){const{nodesSelectionActive:j,userSelectionActive:I}=$e(VM,pt),F=$o(h,{target:r1}),N=$o(k,{target:r1}),G=N||R,X=N||A,J=m&&G!==!0,ne=F||I||J;return SM({deleteKeyCode:d,multiSelectionKeyCode:w}),b.jsx(kM,{onPaneContextMenu:s,elementsSelectable:S,zoomOnScroll:T,zoomOnPinch:E,panOnScroll:X,panOnScrollSpeed:U,panOnScrollMode:z,zoomOnDoubleClick:H,panOnDrag:!F&&G,defaultViewport:V,translateExtent:O,minZoom:L,maxZoom:q,zoomActivationKeyCode:_,preventScrolling:ee,noWheelClassName:$,noPanClassName:M,onViewportChange:Q,isControlledViewport:K,paneClickDistance:c,selectionOnDrag:J,children:b.jsxs(AM,{onSelectionStart:x,onSelectionEnd:v,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:l,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:u,panOnDrag:G,isSelecting:!!ne,selectionMode:p,selectionKeyPressed:F,paneClickDistance:c,selectionOnDrag:J,children:[e,j&&b.jsx(UM,{onSelectionContextMenu:B,noPanClassName:M,disableKeyboardA11y:Y})]})})}YS.displayName="FlowRenderer";const PM=P.memo(YS),$M=e=>n=>e?km(n.nodeLookup,{x:0,y:0,width:n.width,height:n.height},n.transform,!0).map(r=>r.id):Array.from(n.nodeLookup.keys());function GM(e){return $e(P.useCallback($M(e),[e]),pt)}const YM=e=>e.updateNodeInternals;function FM(){const e=$e(YM),[n]=P.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(r=>{const l=new Map;r.forEach(a=>{const s=a.target.getAttribute("data-id");l.set(s,{id:s,nodeElement:a.target,force:!0})}),e(l)}));return P.useEffect(()=>()=>{n==null||n.disconnect()},[n]),n}function XM({node:e,nodeType:n,hasDimensions:r,resizeObserver:l}){const a=mt(),s=P.useRef(null),u=P.useRef(null),c=P.useRef(e.sourcePosition),d=P.useRef(e.targetPosition),h=P.useRef(n),m=r&&!!e.internals.handleBounds;return P.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]),P.useEffect(()=>()=>{u.current&&(l==null||l.unobserve(u.current),u.current=null)},[]),P.useEffect(()=>{if(s.current){const p=h.current!==n,x=c.current!==e.sourcePosition,v=d.current!==e.targetPosition;(p||x||v)&&(h.current=n,c.current=e.sourcePosition,d.current=e.targetPosition,a.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,n,e.sourcePosition,e.targetPosition]),s}function QM({id:e,onClick:n,onMouseEnter:r,onMouseMove:l,onMouseLeave:a,onContextMenu:s,onDoubleClick:u,nodesDraggable:c,elementsSelectable:d,nodesConnectable:h,nodesFocusable:m,resizeObserver:p,noDragClassName:x,noPanClassName:v,disableKeyboardA11y:w,rfId:k,nodeTypes:_,nodeClickDistance:S,onError:T}){const{node:E,internals:A,isParent:U}=$e(re=>{const se=re.nodeLookup.get(e),xe=re.parentLookup.has(e);return{node:se,internals:se.internals,isParent:xe}},pt);let z=E.type||"default",H=(_==null?void 0:_[z])||n1[z];H===void 0&&(T==null||T("003",ir.error003(z)),z="default",H=(_==null?void 0:_.default)||n1.default);const R=!!(E.draggable||c&&typeof E.draggable>"u"),V=!!(E.selectable||d&&typeof E.selectable>"u"),O=!!(E.connectable||h&&typeof E.connectable>"u"),L=!!(E.focusable||m&&typeof E.focusable>"u"),q=mt(),ee=pS(E),B=XM({node:E,nodeType:z,hasDimensions:ee,resizeObserver:p}),$=PS({nodeRef:B,disabled:E.hidden||!R,noDragClassName:x,handleSelector:E.dragHandle,nodeId:e,isSelectable:V,nodeClickDistance:S}),M=$S();if(E.hidden)return null;const Y=Rr(E),Q=IM(E),K=V||R||n||r||l||a,j=r?re=>r(re,{...A.userNode}):void 0,I=l?re=>l(re,{...A.userNode}):void 0,F=a?re=>a(re,{...A.userNode}):void 0,N=s?re=>s(re,{...A.userNode}):void 0,G=u?re=>u(re,{...A.userNode}):void 0,X=re=>{const{selectNodesOnDrag:se,nodeDragThreshold:xe}=q.getState();V&&(!se||!R||xe>0)&&Wp({id:e,store:q,nodeRef:B}),n&&n(re,{...A.userNode})},J=re=>{if(!(xS(re.nativeEvent)||w)){if(lS.includes(re.key)&&V){const se=re.key==="Escape";Wp({id:e,store:q,unselect:se,nodeRef:B})}else if(R&&E.selected&&Object.prototype.hasOwnProperty.call(mc,re.key)){re.preventDefault();const{ariaLabelConfig:se}=q.getState();q.setState({ariaLiveMessage:se["node.a11yDescription.ariaLiveMessage"]({direction:re.key.replace("Arrow","").toLowerCase(),x:~~A.positionAbsolute.x,y:~~A.positionAbsolute.y})}),M({direction:mc[re.key],factor:re.shiftKey?4:1})}}},ne=()=>{var _e;if(w||!((_e=B.current)!=null&&_e.matches(":focus-visible")))return;const{transform:re,width:se,height:xe,autoPanOnNodeFocus:ve,setCenter:ye}=q.getState();if(!ve)return;km(new Map([[e,E]]),{x:0,y:0,width:se,height:xe},re,!0).length>0||ye(E.position.x+Y.width/2,E.position.y+Y.height/2,{zoom:re[2]})};return b.jsx("div",{className:zt(["react-flow__node",`react-flow__node-${z}`,{[v]:R},E.className,{selected:E.selected,selectable:V,parent:U,draggable:R,dragging:$}]),ref:B,style:{zIndex:A.z,transform:`translate(${A.positionAbsolute.x}px,${A.positionAbsolute.y}px)`,pointerEvents:K?"all":"none",visibility:ee?"visible":"hidden",...E.style,...Q},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:j,onMouseMove:I,onMouseLeave:F,onContextMenu:N,onClick:X,onDoubleClick:G,onKeyDown:L?J:void 0,tabIndex:L?0:void 0,onFocus:L?ne:void 0,role:E.ariaRole??(L?"group":void 0),"aria-roledescription":"node","aria-describedby":w?void 0:`${OS}-${k}`,"aria-label":E.ariaLabel,...E.domAttributes,children:b.jsx(MM,{value:e,children:b.jsx(H,{id:e,data:E.data,type:z,positionAbsoluteX:A.positionAbsolute.x,positionAbsoluteY:A.positionAbsolute.y,selected:E.selected??!1,selectable:V,draggable:R,deletable:E.deletable??!0,isConnectable:O,sourcePosition:E.sourcePosition,targetPosition:E.targetPosition,dragging:$,dragHandle:E.dragHandle,zIndex:A.z,parentId:E.parentId,...Y})})})}var ZM=P.memo(QM);const KM=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function FS(e){const{nodesDraggable:n,nodesConnectable:r,nodesFocusable:l,elementsSelectable:a,onError:s}=$e(KM,pt),u=GM(e.onlyRenderVisibleElements),c=FM();return b.jsx("div",{className:"react-flow__nodes",style:Oc,children:u.map(d=>b.jsx(ZM,{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:c,nodesDraggable:n,nodesConnectable:r,nodesFocusable:l,elementsSelectable:a,nodeClickDistance:e.nodeClickDistance,onError:s},d))})}FS.displayName="NodeRenderer";const JM=P.memo(FS);function WM(e){return $e(P.useCallback(r=>{if(!e)return r.edges.map(a=>a.id);const l=[];if(r.width&&r.height)for(const a of r.edges){const s=r.nodeLookup.get(a.source),u=r.nodeLookup.get(a.target);s&&u&&ZA({sourceNode:s,targetNode:u,width:r.width,height:r.height,transform:r.transform})&&l.push(a.id)}return l},[e]),pt)}const ej=({color:e="none",strokeWidth:n=1})=>{const r={strokeWidth:n,...e&&{stroke:e}};return b.jsx("polyline",{className:"arrow",style:r,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},tj=({color:e="none",strokeWidth:n=1})=>{const r={strokeWidth:n,...e&&{stroke:e,fill:e}};return b.jsx("polyline",{className:"arrowclosed",style:r,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},i1={[dc.Arrow]:ej,[dc.ArrowClosed]:tj};function nj(e){const n=mt();return P.useMemo(()=>{var a,s;return Object.prototype.hasOwnProperty.call(i1,e)?i1[e]:((s=(a=n.getState()).onError)==null||s.call(a,"009",ir.error009(e)),null)},[e])}const rj=({id:e,type:n,color:r,width:l=12.5,height:a=12.5,markerUnits:s="strokeWidth",strokeWidth:u,orient:c="auto-start-reverse"})=>{const d=nj(n);return d?b.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${l}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:c,refX:"0",refY:"0",children:b.jsx(d,{color:r,strokeWidth:u})}):null},XS=({defaultColor:e,rfId:n})=>{const r=$e(s=>s.edges),l=$e(s=>s.defaultEdgeOptions),a=P.useMemo(()=>iz(r,{id:n,defaultColor:e,defaultMarkerStart:l==null?void 0:l.markerStart,defaultMarkerEnd:l==null?void 0:l.markerEnd}),[r,l,n,e]);return a.length?b.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:b.jsx("defs",{children:a.map(s=>b.jsx(rj,{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};XS.displayName="MarkerDefinitions";var ij=P.memo(XS);function QS({x:e,y:n,label:r,labelStyle:l,labelShowBg:a=!0,labelBgStyle:s,labelBgPadding:u=[2,4],labelBgBorderRadius:c=2,children:d,className:h,...m}){const[p,x]=P.useState({x:1,y:0,width:0,height:0}),v=zt(["react-flow__edge-textwrapper",h]),w=P.useRef(null);return P.useEffect(()=>{if(w.current){const k=w.current.getBBox();x({x:k.x,y:k.y,width:k.width,height:k.height})}},[r]),r?b.jsxs("g",{transform:`translate(${e-p.width/2} ${n-p.height/2})`,className:v,visibility:p.width?"visible":"hidden",...m,children:[a&&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:c,ry:c}),b.jsx("text",{className:"react-flow__edge-text",y:p.height/2,dy:"0.3em",ref:w,style:l,children:r}),d]}):null}QS.displayName="EdgeText";const lj=P.memo(QS);function ns({path:e,labelX:n,labelY:r,label:l,labelStyle:a,labelShowBg:s,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,interactionWidth:h=20,...m}){return b.jsxs(b.Fragment,{children:[b.jsx("path",{...m,d:e,fill:"none",className:zt(["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&&Vn(n)&&Vn(r)?b.jsx(lj,{x:n,y:r,label:l,labelStyle:a,labelShowBg:s,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d}):null]})}function l1({pos:e,x1:n,y1:r,x2:l,y2:a}){return e===be.Left||e===be.Right?[.5*(n+l),r]:[n,.5*(r+a)]}function ZS({sourceX:e,sourceY:n,sourcePosition:r=be.Bottom,targetX:l,targetY:a,targetPosition:s=be.Top}){const[u,c]=l1({pos:r,x1:e,y1:n,x2:l,y2:a}),[d,h]=l1({pos:s,x1:l,y1:a,x2:e,y2:n}),[m,p,x,v]=vS({sourceX:e,sourceY:n,targetX:l,targetY:a,sourceControlX:u,sourceControlY:c,targetControlX:d,targetControlY:h});return[`M${e},${n} C${u},${c} ${d},${h} ${l},${a}`,m,p,x,v]}function KS(e){return P.memo(({id:n,sourceX:r,sourceY:l,targetX:a,targetY:s,sourcePosition:u,targetPosition:c,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:x,labelBgBorderRadius:v,style:w,markerEnd:k,markerStart:_,interactionWidth:S})=>{const[T,E,A]=ZS({sourceX:r,sourceY:l,sourcePosition:u,targetX:a,targetY:s,targetPosition:c}),U=e.isInternal?void 0:n;return b.jsx(ns,{id:U,path:T,labelX:E,labelY:A,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:x,labelBgBorderRadius:v,style:w,markerEnd:k,markerStart:_,interactionWidth:S})})}const aj=KS({isInternal:!1}),JS=KS({isInternal:!0});aj.displayName="SimpleBezierEdge";JS.displayName="SimpleBezierEdgeInternal";function WS(e){return P.memo(({id:n,sourceX:r,sourceY:l,targetX:a,targetY:s,label:u,labelStyle:c,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:x,sourcePosition:v=be.Bottom,targetPosition:w=be.Top,markerEnd:k,markerStart:_,pathOptions:S,interactionWidth:T})=>{const[E,A,U]=Qp({sourceX:r,sourceY:l,sourcePosition:v,targetX:a,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}),z=e.isInternal?void 0:n;return b.jsx(ns,{id:z,path:E,labelX:A,labelY:U,label:u,labelStyle:c,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:x,markerEnd:k,markerStart:_,interactionWidth:T})})}const e_=WS({isInternal:!1}),t_=WS({isInternal:!0});e_.displayName="SmoothStepEdge";t_.displayName="SmoothStepEdgeInternal";function n_(e){return P.memo(({id:n,...r})=>{var a;const l=e.isInternal?void 0:n;return b.jsx(e_,{...r,id:l,pathOptions:P.useMemo(()=>{var s;return{borderRadius:0,offset:(s=r.pathOptions)==null?void 0:s.offset}},[(a=r.pathOptions)==null?void 0:a.offset])})})}const oj=n_({isInternal:!1}),r_=n_({isInternal:!0});oj.displayName="StepEdge";r_.displayName="StepEdgeInternal";function i_(e){return P.memo(({id:n,sourceX:r,sourceY:l,targetX:a,targetY:s,label:u,labelStyle:c,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:x,markerEnd:v,markerStart:w,interactionWidth:k})=>{const[_,S,T]=wS({sourceX:r,sourceY:l,targetX:a,targetY:s}),E=e.isInternal?void 0:n;return b.jsx(ns,{id:E,path:_,labelX:S,labelY:T,label:u,labelStyle:c,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:x,markerEnd:v,markerStart:w,interactionWidth:k})})}const sj=i_({isInternal:!1}),l_=i_({isInternal:!0});sj.displayName="StraightEdge";l_.displayName="StraightEdgeInternal";function a_(e){return P.memo(({id:n,sourceX:r,sourceY:l,targetX:a,targetY:s,sourcePosition:u=be.Bottom,targetPosition:c=be.Top,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:x,labelBgBorderRadius:v,style:w,markerEnd:k,markerStart:_,pathOptions:S,interactionWidth:T})=>{const[E,A,U]=Tm({sourceX:r,sourceY:l,sourcePosition:u,targetX:a,targetY:s,targetPosition:c,curvature:S==null?void 0:S.curvature}),z=e.isInternal?void 0:n;return b.jsx(ns,{id:z,path:E,labelX:A,labelY:U,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:x,labelBgBorderRadius:v,style:w,markerEnd:k,markerStart:_,interactionWidth:T})})}const uj=a_({isInternal:!1}),o_=a_({isInternal:!0});uj.displayName="BezierEdge";o_.displayName="BezierEdgeInternal";const a1={default:o_,straight:l_,step:r_,smoothstep:t_,simplebezier:JS},o1={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},cj=(e,n,r)=>r===be.Left?e-n:r===be.Right?e+n:e,fj=(e,n,r)=>r===be.Top?e-n:r===be.Bottom?e+n:e,s1="react-flow__edgeupdater";function u1({position:e,centerX:n,centerY:r,radius:l=10,onMouseDown:a,onMouseEnter:s,onMouseOut:u,type:c}){return b.jsx("circle",{onMouseDown:a,onMouseEnter:s,onMouseOut:u,className:zt([s1,`${s1}-${c}`]),cx:cj(n,l,e),cy:fj(r,l,e),r:l,stroke:"transparent",fill:"transparent"})}function dj({isReconnectable:e,reconnectRadius:n,edge:r,sourceX:l,sourceY:a,targetX:s,targetY:u,sourcePosition:c,targetPosition:d,onReconnect:h,onReconnectStart:m,onReconnectEnd:p,setReconnecting:x,setUpdateHover:v}){const w=mt(),k=(A,U)=>{if(A.button!==0)return;const{autoPanOnConnect:z,domNode:H,connectionMode:R,connectionRadius:V,lib:O,onConnectStart:L,cancelConnection:q,nodeLookup:ee,rfId:B,panBy:$,updateConnection:M}=w.getState(),Y=U.type==="target",Q=(I,F)=>{x(!1),p==null||p(I,r,U.type,F)},K=I=>h==null?void 0:h(r,I),j=(I,F)=>{x(!0),m==null||m(A,r,U.type),L==null||L(I,F)};Jp.onPointerDown(A.nativeEvent,{autoPanOnConnect:z,connectionMode:R,connectionRadius:V,domNode:H,handleId:U.id,nodeId:U.nodeId,nodeLookup:ee,isTarget:Y,edgeUpdaterType:U.type,lib:O,flowId:B,cancelConnection:q,panBy:$,isValidConnection:(...I)=>{var F,N;return((N=(F=w.getState()).isValidConnection)==null?void 0:N.call(F,...I))??!0},onConnect:K,onConnectStart:j,onConnectEnd:(...I)=>{var F,N;return(N=(F=w.getState()).onConnectEnd)==null?void 0:N.call(F,...I)},onReconnectEnd:Q,updateConnection:M,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,dragThreshold:w.getState().connectionDragThreshold,handleDomNode:A.currentTarget})},_=A=>k(A,{nodeId:r.target,id:r.targetHandle??null,type:"target"}),S=A=>k(A,{nodeId:r.source,id:r.sourceHandle??null,type:"source"}),T=()=>v(!0),E=()=>v(!1);return b.jsxs(b.Fragment,{children:[(e===!0||e==="source")&&b.jsx(u1,{position:c,centerX:l,centerY:a,radius:n,onMouseDown:_,onMouseEnter:T,onMouseOut:E,type:"source"}),(e===!0||e==="target")&&b.jsx(u1,{position:d,centerX:s,centerY:u,radius:n,onMouseDown:S,onMouseEnter:T,onMouseOut:E,type:"target"})]})}function hj({id:e,edgesFocusable:n,edgesReconnectable:r,elementsSelectable:l,onClick:a,onDoubleClick:s,onContextMenu:u,onMouseEnter:c,onMouseMove:d,onMouseLeave:h,reconnectRadius:m,onReconnect:p,onReconnectStart:x,onReconnectEnd:v,rfId:w,edgeTypes:k,noPanClassName:_,onError:S,disableKeyboardA11y:T}){let E=$e(ye=>ye.edgeLookup.get(e));const A=$e(ye=>ye.defaultEdgeOptions);E=A?{...A,...E}:E;let U=E.type||"default",z=(k==null?void 0:k[U])||a1[U];z===void 0&&(S==null||S("011",ir.error011(U)),U="default",z=(k==null?void 0:k.default)||a1.default);const H=!!(E.focusable||n&&typeof E.focusable>"u"),R=typeof p<"u"&&(E.reconnectable||r&&typeof E.reconnectable>"u"),V=!!(E.selectable||l&&typeof E.selectable>"u"),O=P.useRef(null),[L,q]=P.useState(!1),[ee,B]=P.useState(!1),$=mt(),{zIndex:M,sourceX:Y,sourceY:Q,targetX:K,targetY:j,sourcePosition:I,targetPosition:F}=$e(P.useCallback(ye=>{const pe=ye.nodeLookup.get(E.source),_e=ye.nodeLookup.get(E.target);if(!pe||!_e)return{zIndex:E.zIndex,...o1};const Me=rz({id:e,sourceNode:pe,targetNode:_e,sourceHandle:E.sourceHandle||null,targetHandle:E.targetHandle||null,connectionMode:ye.connectionMode,onError:S});return{zIndex:QA({selected:E.selected,zIndex:E.zIndex,sourceNode:pe,targetNode:_e,elevateOnSelect:ye.elevateEdgesOnSelect,zIndexMode:ye.zIndexMode}),...Me||o1}},[E.source,E.target,E.sourceHandle,E.targetHandle,E.selected,E.zIndex]),pt),N=P.useMemo(()=>E.markerStart?`url('#${Zp(E.markerStart,w)}')`:void 0,[E.markerStart,w]),G=P.useMemo(()=>E.markerEnd?`url('#${Zp(E.markerEnd,w)}')`:void 0,[E.markerEnd,w]);if(E.hidden||Y===null||Q===null||K===null||j===null)return null;const X=ye=>{var Te;const{addSelectedEdges:pe,unselectNodesAndEdges:_e,multiSelectionActive:Me}=$.getState();V&&($.setState({nodesSelectionActive:!1}),E.selected&&Me?(_e({nodes:[],edges:[E]}),(Te=O.current)==null||Te.blur()):pe([e])),a&&a(ye,E)},J=s?ye=>{s(ye,{...E})}:void 0,ne=u?ye=>{u(ye,{...E})}:void 0,re=c?ye=>{c(ye,{...E})}:void 0,se=d?ye=>{d(ye,{...E})}:void 0,xe=h?ye=>{h(ye,{...E})}:void 0,ve=ye=>{var pe;if(!T&&lS.includes(ye.key)&&V){const{unselectNodesAndEdges:_e,addSelectedEdges:Me}=$.getState();ye.key==="Escape"?((pe=O.current)==null||pe.blur(),_e({edges:[E]})):Me([e])}};return b.jsx("svg",{style:{zIndex:M},children:b.jsxs("g",{className:zt(["react-flow__edge",`react-flow__edge-${U}`,E.className,_,{selected:E.selected,animated:E.animated,inactive:!V&&!a,updating:L,selectable:V}]),onClick:X,onDoubleClick:J,onContextMenu:ne,onMouseEnter:re,onMouseMove:se,onMouseLeave:xe,onKeyDown:H?ve:void 0,tabIndex:H?0:void 0,role:E.ariaRole??(H?"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":H?`${LS}-${w}`:void 0,ref:O,...E.domAttributes,children:[!ee&&b.jsx(z,{id:e,source:E.source,target:E.target,type:E.type,selected:E.selected,animated:E.animated,selectable:V,deletable:E.deletable??!0,label:E.label,labelStyle:E.labelStyle,labelShowBg:E.labelShowBg,labelBgStyle:E.labelBgStyle,labelBgPadding:E.labelBgPadding,labelBgBorderRadius:E.labelBgBorderRadius,sourceX:Y,sourceY:Q,targetX:K,targetY:j,sourcePosition:I,targetPosition:F,data:E.data,style:E.style,sourceHandleId:E.sourceHandle,targetHandleId:E.targetHandle,markerStart:N,markerEnd:G,pathOptions:"pathOptions"in E?E.pathOptions:void 0,interactionWidth:E.interactionWidth}),R&&b.jsx(dj,{edge:E,isReconnectable:R,reconnectRadius:m,onReconnect:p,onReconnectStart:x,onReconnectEnd:v,sourceX:Y,sourceY:Q,targetX:K,targetY:j,sourcePosition:I,targetPosition:F,setUpdateHover:q,setReconnecting:B})]})})}var pj=P.memo(hj);const mj=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function s_({defaultMarkerColor:e,onlyRenderVisibleElements:n,rfId:r,edgeTypes:l,noPanClassName:a,onReconnect:s,onEdgeContextMenu:u,onEdgeMouseEnter:c,onEdgeMouseMove:d,onEdgeMouseLeave:h,onEdgeClick:m,reconnectRadius:p,onEdgeDoubleClick:x,onReconnectStart:v,onReconnectEnd:w,disableKeyboardA11y:k}){const{edgesFocusable:_,edgesReconnectable:S,elementsSelectable:T,onError:E}=$e(mj,pt),A=WM(n);return b.jsxs("div",{className:"react-flow__edges",children:[b.jsx(ij,{defaultColor:e,rfId:r}),A.map(U=>b.jsx(pj,{id:U,edgesFocusable:_,edgesReconnectable:S,elementsSelectable:T,noPanClassName:a,onReconnect:s,onContextMenu:u,onMouseEnter:c,onMouseMove:d,onMouseLeave:h,onClick:m,reconnectRadius:p,onDoubleClick:x,onReconnectStart:v,onReconnectEnd:w,rfId:r,onError:E,edgeTypes:l,disableKeyboardA11y:k},U))]})}s_.displayName="EdgeRenderer";const gj=P.memo(s_),xj=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function yj({children:e}){const n=$e(xj);return b.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:e})}function vj(e){const n=ma(),r=P.useRef(!1);P.useEffect(()=>{!r.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),r.current=!0)},[e,n.viewportInitialized])}const bj=e=>{var n;return(n=e.panZoom)==null?void 0:n.syncViewport};function wj(e){const n=$e(bj),r=mt();return P.useEffect(()=>{e&&(n==null||n(e),r.setState({transform:[e.x,e.y,e.zoom]}))},[e,n]),null}function Sj(e){return e.connection.inProgress?{...e.connection,to:ts(e.connection.to,e.transform)}:{...e.connection}}function _j(e){return Sj}function Ej(e){const n=_j();return $e(n,pt)}const kj=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Nj({containerStyle:e,style:n,type:r,component:l}){const{nodesConnectable:a,width:s,height:u,isValid:c,inProgress:d}=$e(kj,pt);return!(s&&a&&d)?null:b.jsx("svg",{style:e,width:s,height:u,className:"react-flow__connectionline react-flow__container",children:b.jsx("g",{className:zt(["react-flow__connection",sS(c)]),children:b.jsx(u_,{style:n,type:r,CustomComponent:l,isValid:c})})})}const u_=({style:e,type:n=xi.Bezier,CustomComponent:r,isValid:l})=>{const{inProgress:a,from:s,fromNode:u,fromHandle:c,fromPosition:d,to:h,toNode:m,toHandle:p,toPosition:x,pointer:v}=Ej();if(!a)return;if(r)return b.jsx(r,{connectionLineType:n,connectionLineStyle:e,fromNode:u,fromHandle:c,fromX:s.x,fromY:s.y,toX:h.x,toY:h.y,fromPosition:d,toPosition:x,connectionStatus:sS(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:x};switch(n){case xi.Bezier:[w]=Tm(k);break;case xi.SimpleBezier:[w]=ZS(k);break;case xi.Step:[w]=Qp({...k,borderRadius:0});break;case xi.SmoothStep:[w]=Qp(k);break;default:[w]=wS(k)}return b.jsx("path",{d:w,fill:"none",className:"react-flow__connection-path",style:e})};u_.displayName="ConnectionLine";const Cj={};function c1(e=Cj){P.useRef(e),mt(),P.useEffect(()=>{},[e])}function Tj(){mt(),P.useRef(!1),P.useEffect(()=>{},[])}function c_({nodeTypes:e,edgeTypes:n,onInit:r,onNodeClick:l,onEdgeClick:a,onNodeDoubleClick:s,onEdgeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:h,onNodeContextMenu:m,onSelectionContextMenu:p,onSelectionStart:x,onSelectionEnd:v,connectionLineType:w,connectionLineStyle:k,connectionLineComponent:_,connectionLineContainerStyle:S,selectionKeyCode:T,selectionOnDrag:E,selectionMode:A,multiSelectionKeyCode:U,panActivationKeyCode:z,zoomActivationKeyCode:H,deleteKeyCode:R,onlyRenderVisibleElements:V,elementsSelectable:O,defaultViewport:L,translateExtent:q,minZoom:ee,maxZoom:B,preventScrolling:$,defaultMarkerColor:M,zoomOnScroll:Y,zoomOnPinch:Q,panOnScroll:K,panOnScrollSpeed:j,panOnScrollMode:I,zoomOnDoubleClick:F,panOnDrag:N,onPaneClick:G,onPaneMouseEnter:X,onPaneMouseMove:J,onPaneMouseLeave:ne,onPaneScroll:re,onPaneContextMenu:se,paneClickDistance:xe,nodeClickDistance:ve,onEdgeContextMenu:ye,onEdgeMouseEnter:pe,onEdgeMouseMove:_e,onEdgeMouseLeave:Me,reconnectRadius:Te,onReconnect:ct,onReconnectStart:nt,onReconnectEnd:Mt,noDragClassName:Vt,noWheelClassName:Lt,noPanClassName:En,disableKeyboardA11y:Rn,nodeExtent:jt,rfId:Lr,viewport:ue,onViewportChange:ge}){return c1(e),c1(n),Tj(),vj(r),wj(ue),b.jsx(PM,{onPaneClick:G,onPaneMouseEnter:X,onPaneMouseMove:J,onPaneMouseLeave:ne,onPaneContextMenu:se,onPaneScroll:re,paneClickDistance:xe,deleteKeyCode:R,selectionKeyCode:T,selectionOnDrag:E,selectionMode:A,onSelectionStart:x,onSelectionEnd:v,multiSelectionKeyCode:U,panActivationKeyCode:z,zoomActivationKeyCode:H,elementsSelectable:O,zoomOnScroll:Y,zoomOnPinch:Q,zoomOnDoubleClick:F,panOnScroll:K,panOnScrollSpeed:j,panOnScrollMode:I,panOnDrag:N,defaultViewport:L,translateExtent:q,minZoom:ee,maxZoom:B,onSelectionContextMenu:p,preventScrolling:$,noDragClassName:Vt,noWheelClassName:Lt,noPanClassName:En,disableKeyboardA11y:Rn,onViewportChange:ge,isControlledViewport:!!ue,children:b.jsxs(yj,{children:[b.jsx(gj,{edgeTypes:n,onEdgeClick:a,onEdgeDoubleClick:u,onReconnect:ct,onReconnectStart:nt,onReconnectEnd:Mt,onlyRenderVisibleElements:V,onEdgeContextMenu:ye,onEdgeMouseEnter:pe,onEdgeMouseMove:_e,onEdgeMouseLeave:Me,reconnectRadius:Te,defaultMarkerColor:M,noPanClassName:En,disableKeyboardA11y:Rn,rfId:Lr}),b.jsx(Nj,{style:k,type:w,component:_,containerStyle:S}),b.jsx("div",{className:"react-flow__edgelabel-renderer"}),b.jsx(JM,{nodeTypes:e,onNodeClick:l,onNodeDoubleClick:s,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:h,onNodeContextMenu:m,nodeClickDistance:ve,onlyRenderVisibleElements:V,noPanClassName:En,noDragClassName:Vt,disableKeyboardA11y:Rn,nodeExtent:jt,rfId:Lr}),b.jsx("div",{className:"react-flow__viewport-portal"})]})})}c_.displayName="GraphView";const Aj=P.memo(c_),f1=({nodes:e,edges:n,defaultNodes:r,defaultEdges:l,width:a,height:s,fitView:u,fitViewOptions:c,minZoom:d=.5,maxZoom:h=2,nodeOrigin:m,nodeExtent:p,zIndexMode:x="basic"}={})=>{const v=new Map,w=new Map,k=new Map,_=new Map,S=l??n??[],T=r??e??[],E=m??[0,0],A=p??qo;ES(k,_,S);const U=Kp(T,v,w,{nodeOrigin:E,nodeExtent:A,zIndexMode:x});let z=[0,0,1];if(u&&a&&s){const H=Wo(v,{filter:L=>!!((L.width||L.initialWidth)&&(L.height||L.initialHeight))}),{x:R,y:V,zoom:O}=Nm(H,a,s,d,h,(c==null?void 0:c.padding)??.1);z=[R,V,O]}return{rfId:"1",width:a??0,height:s??0,transform:z,nodes:T,nodesInitialized:U,nodeLookup:v,parentLookup:w,edges:S,edgeLookup:_,connectionLookup:k,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:r!==void 0,hasDefaultEdges:l!==void 0,panZoom:null,minZoom:d,maxZoom:h,translateExtent:qo,nodeExtent:A,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:ua.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:c,fitViewResolver:null,connection:{...oS},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:PA,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:aS,zIndexMode:x,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},zj=({nodes:e,edges:n,defaultNodes:r,defaultEdges:l,width:a,height:s,fitView:u,fitViewOptions:c,minZoom:d,maxZoom:h,nodeOrigin:m,nodeExtent:p,zIndexMode:x})=>Fz((v,w)=>{async function k(){const{nodeLookup:_,panZoom:S,fitViewOptions:T,fitViewResolver:E,width:A,height:U,minZoom:z,maxZoom:H}=w();S&&(await UA({nodes:_,width:A,height:U,panZoom:S,minZoom:z,maxZoom:H},T),E==null||E.resolve(!0),v({fitViewResolver:null}))}return{...f1({nodes:e,edges:n,width:a,height:s,fitView:u,fitViewOptions:c,minZoom:d,maxZoom:h,nodeOrigin:m,nodeExtent:p,defaultNodes:r,defaultEdges:l,zIndexMode:x}),setNodes:_=>{const{nodeLookup:S,parentLookup:T,nodeOrigin:E,elevateNodesOnSelect:A,fitViewQueued:U,zIndexMode:z}=w(),H=Kp(_,S,T,{nodeOrigin:E,nodeExtent:p,elevateNodesOnSelect:A,checkEquality:!0,zIndexMode:z});U&&H?(k(),v({nodes:_,nodesInitialized:H,fitViewQueued:!1,fitViewOptions:void 0})):v({nodes:_,nodesInitialized:H})},setEdges:_=>{const{connectionLookup:S,edgeLookup:T}=w();ES(S,T,_),v({edges:_})},setDefaultNodesAndEdges:(_,S)=>{if(_){const{setNodes:T}=w();T(_),v({hasDefaultNodes:!0})}if(S){const{setEdges:T}=w();T(S),v({hasDefaultEdges:!0})}},updateNodeInternals:_=>{const{triggerNodeChanges:S,nodeLookup:T,parentLookup:E,domNode:A,nodeOrigin:U,nodeExtent:z,debug:H,fitViewQueued:R,zIndexMode:V}=w(),{changes:O,updatedInternals:L}=fz(_,T,E,A,U,z,V);L&&(oz(T,E,{nodeOrigin:U,nodeExtent:z,zIndexMode:V}),R?(k(),v({fitViewQueued:!1,fitViewOptions:void 0})):v({}),(O==null?void 0:O.length)>0&&(H&&console.log("React Flow: trigger node changes",O),S==null||S(O)))},updateNodePositions:(_,S=!1)=>{const T=[];let E=[];const{nodeLookup:A,triggerNodeChanges:U,connection:z,updateConnection:H,onNodesChangeMiddlewareMap:R}=w();for(const[V,O]of _){const L=A.get(V),q=!!(L!=null&&L.expandParent&&(L!=null&&L.parentId)&&(O!=null&&O.position)),ee={id:V,type:"position",position:q?{x:Math.max(0,O.position.x),y:Math.max(0,O.position.y)}:O.position,dragging:S};if(L&&z.inProgress&&z.fromNode.id===L.id){const B=el(L,z.fromHandle,be.Left,!0);H({...z,from:B})}q&&L.parentId&&T.push({id:V,parentId:L.parentId,rect:{...O.internals.positionAbsolute,width:O.measured.width??0,height:O.measured.height??0}}),E.push(ee)}if(T.length>0){const{parentLookup:V,nodeOrigin:O}=w(),L=Dm(T,A,V,O);E.push(...L)}for(const V of R.values())E=V(E);U(E)},triggerNodeChanges:_=>{const{onNodesChange:S,setNodes:T,nodes:E,hasDefaultNodes:A,debug:U}=w();if(_!=null&&_.length){if(A){const z=IS(_,E);T(z)}U&&console.log("React Flow: trigger node changes",_),S==null||S(_)}},triggerEdgeChanges:_=>{const{onEdgesChange:S,setEdges:T,edges:E,hasDefaultEdges:A,debug:U}=w();if(_!=null&&_.length){if(A){const z=qS(_,E);T(z)}U&&console.log("React Flow: trigger edge changes",_),S==null||S(_)}},addSelectedNodes:_=>{const{multiSelectionActive:S,edgeLookup:T,nodeLookup:E,triggerNodeChanges:A,triggerEdgeChanges:U}=w();if(S){const z=_.map(H=>Pi(H,!0));A(z);return}A(ta(E,new Set([..._]),!0)),U(ta(T))},addSelectedEdges:_=>{const{multiSelectionActive:S,edgeLookup:T,nodeLookup:E,triggerNodeChanges:A,triggerEdgeChanges:U}=w();if(S){const z=_.map(H=>Pi(H,!0));U(z);return}U(ta(T,new Set([..._]))),A(ta(E,new Set,!0))},unselectNodesAndEdges:({nodes:_,edges:S}={})=>{const{edges:T,nodes:E,nodeLookup:A,triggerNodeChanges:U,triggerEdgeChanges:z}=w(),H=_||E,R=S||T,V=[];for(const L of H){if(!L.selected)continue;const q=A.get(L.id);q&&(q.selected=!1),V.push(Pi(L.id,!1))}const O=[];for(const L of R)L.selected&&O.push(Pi(L.id,!1));U(V),z(O)},setMinZoom:_=>{const{panZoom:S,maxZoom:T}=w();S==null||S.setScaleExtent([_,T]),v({minZoom:_})},setMaxZoom:_=>{const{panZoom:S,minZoom:T}=w();S==null||S.setScaleExtent([T,_]),v({maxZoom:_})},setTranslateExtent:_=>{var S;(S=w().panZoom)==null||S.setTranslateExtent(_),v({translateExtent:_})},resetSelectedElements:()=>{const{edges:_,nodes:S,triggerNodeChanges:T,triggerEdgeChanges:E,elementsSelectable:A}=w();if(!A)return;const U=S.reduce((H,R)=>R.selected?[...H,Pi(R.id,!1)]:H,[]),z=_.reduce((H,R)=>R.selected?[...H,Pi(R.id,!1)]:H,[]);T(U),E(z)},setNodeExtent:_=>{const{nodes:S,nodeLookup:T,parentLookup:E,nodeOrigin:A,elevateNodesOnSelect:U,nodeExtent:z,zIndexMode:H}=w();_[0][0]===z[0][0]&&_[0][1]===z[0][1]&&_[1][0]===z[1][0]&&_[1][1]===z[1][1]||(Kp(S,T,E,{nodeOrigin:A,nodeExtent:_,elevateNodesOnSelect:U,checkEquality:!1,zIndexMode:H}),v({nodeExtent:_}))},panBy:_=>{const{transform:S,width:T,height:E,panZoom:A,translateExtent:U}=w();return dz({delta:_,panZoom:A,transform:S,translateExtent:U,width:T,height:E})},setCenter:async(_,S,T)=>{const{width:E,height:A,maxZoom:U,panZoom:z}=w();if(!z)return Promise.resolve(!1);const H=typeof(T==null?void 0:T.zoom)<"u"?T.zoom:U;return await z.setViewport({x:E/2-_*H,y:A/2-S*H,zoom:H},{duration:T==null?void 0:T.duration,ease:T==null?void 0:T.ease,interpolate:T==null?void 0:T.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{v({connection:{...oS}})},updateConnection:_=>{v({connection:_})},reset:()=>v({...f1()})}},Object.is);function Mj({initialNodes:e,initialEdges:n,defaultNodes:r,defaultEdges:l,initialWidth:a,initialHeight:s,initialMinZoom:u,initialMaxZoom:c,initialFitViewOptions:d,fitView:h,nodeOrigin:m,nodeExtent:p,zIndexMode:x,children:v}){const[w]=P.useState(()=>zj({nodes:e,edges:n,defaultNodes:r,defaultEdges:l,width:a,height:s,fitView:h,minZoom:u,maxZoom:c,fitViewOptions:d,nodeOrigin:m,nodeExtent:p,zIndexMode:x}));return b.jsx(Qz,{value:w,children:b.jsx(yM,{children:v})})}function jj({children:e,nodes:n,edges:r,defaultNodes:l,defaultEdges:a,width:s,height:u,fitView:c,fitViewOptions:d,minZoom:h,maxZoom:m,nodeOrigin:p,nodeExtent:x,zIndexMode:v}){return P.useContext(Dc)?b.jsx(b.Fragment,{children:e}):b.jsx(Mj,{initialNodes:n,initialEdges:r,defaultNodes:l,defaultEdges:a,initialWidth:s,initialHeight:u,fitView:c,initialFitViewOptions:d,initialMinZoom:h,initialMaxZoom:m,nodeOrigin:p,nodeExtent:x,zIndexMode:v,children:e})}const Dj={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Rj({nodes:e,edges:n,defaultNodes:r,defaultEdges:l,className:a,nodeTypes:s,edgeTypes:u,onNodeClick:c,onEdgeClick:d,onInit:h,onMove:m,onMoveStart:p,onMoveEnd:x,onConnect:v,onConnectStart:w,onConnectEnd:k,onClickConnectStart:_,onClickConnectEnd:S,onNodeMouseEnter:T,onNodeMouseMove:E,onNodeMouseLeave:A,onNodeContextMenu:U,onNodeDoubleClick:z,onNodeDragStart:H,onNodeDrag:R,onNodeDragStop:V,onNodesDelete:O,onEdgesDelete:L,onDelete:q,onSelectionChange:ee,onSelectionDragStart:B,onSelectionDrag:$,onSelectionDragStop:M,onSelectionContextMenu:Y,onSelectionStart:Q,onSelectionEnd:K,onBeforeDelete:j,connectionMode:I,connectionLineType:F=xi.Bezier,connectionLineStyle:N,connectionLineComponent:G,connectionLineContainerStyle:X,deleteKeyCode:J="Backspace",selectionKeyCode:ne="Shift",selectionOnDrag:re=!1,selectionMode:se=Uo.Full,panActivationKeyCode:xe="Space",multiSelectionKeyCode:ve=Po()?"Meta":"Control",zoomActivationKeyCode:ye=Po()?"Meta":"Control",snapToGrid:pe,snapGrid:_e,onlyRenderVisibleElements:Me=!1,selectNodesOnDrag:Te,nodesDraggable:ct,autoPanOnNodeFocus:nt,nodesConnectable:Mt,nodesFocusable:Vt,nodeOrigin:Lt=HS,edgesFocusable:En,edgesReconnectable:Rn,elementsSelectable:jt=!0,defaultViewport:Lr=sM,minZoom:ue=.5,maxZoom:ge=2,translateExtent:Ne=qo,preventScrolling:Oe=!0,nodeExtent:Ge,defaultMarkerColor:Qt="#b1b1b7",zoomOnScroll:On=!0,zoomOnPinch:Ht=!0,panOnScroll:vt=!1,panOnScrollSpeed:Pt=.5,panOnScrollMode:We=Qi.Free,zoomOnDoubleClick:Qn=!0,panOnDrag:fn=!0,onPaneClick:Vc,onPaneMouseEnter:ol,onPaneMouseMove:sl,onPaneMouseLeave:ul,onPaneScroll:or,onPaneContextMenu:cl,paneClickDistance:bi=1,nodeClickDistance:Pc=0,children:os,onReconnect:ya,onReconnectStart:wi,onReconnectEnd:$c,onEdgeContextMenu:ss,onEdgeDoubleClick:us,onEdgeMouseEnter:cs,onEdgeMouseMove:va,onEdgeMouseLeave:ba,reconnectRadius:fs=10,onNodesChange:ds,onEdgesChange:Zn,noDragClassName:Dt="nodrag",noWheelClassName:$t="nowheel",noPanClassName:sr="nopan",fitView:fl,fitViewOptions:hs,connectOnClick:Gc,attributionPosition:ps,proOptions:Si,defaultEdgeOptions:wa,elevateNodesOnSelect:Hr=!0,elevateEdgesOnSelect:Br=!1,disableKeyboardA11y:Ir=!1,autoPanOnConnect:qr,autoPanOnNodeDrag:St,autoPanSpeed:ms,connectionRadius:gs,isValidConnection:ur,onError:Ur,style:Yc,id:Sa,nodeDragThreshold:xs,connectionDragThreshold:Fc,viewport:dl,onViewportChange:hl,width:Ln,height:Wt,colorMode:ys="light",debug:Xc,onScroll:Vr,ariaLabelConfig:vs,zIndexMode:_i="basic",...Qc},en){const Ei=Sa||"1",bs=dM(ys),_a=P.useCallback(cr=>{cr.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Vr==null||Vr(cr)},[Vr]);return b.jsx("div",{"data-testid":"rf__wrapper",...Qc,onScroll:_a,style:{...Yc,...Dj},ref:en,className:zt(["react-flow",a,bs]),id:Sa,role:"application",children:b.jsxs(jj,{nodes:e,edges:n,width:Ln,height:Wt,fitView:fl,fitViewOptions:hs,minZoom:ue,maxZoom:ge,nodeOrigin:Lt,nodeExtent:Ge,zIndexMode:_i,children:[b.jsx(Aj,{onInit:h,onNodeClick:c,onEdgeClick:d,onNodeMouseEnter:T,onNodeMouseMove:E,onNodeMouseLeave:A,onNodeContextMenu:U,onNodeDoubleClick:z,nodeTypes:s,edgeTypes:u,connectionLineType:F,connectionLineStyle:N,connectionLineComponent:G,connectionLineContainerStyle:X,selectionKeyCode:ne,selectionOnDrag:re,selectionMode:se,deleteKeyCode:J,multiSelectionKeyCode:ve,panActivationKeyCode:xe,zoomActivationKeyCode:ye,onlyRenderVisibleElements:Me,defaultViewport:Lr,translateExtent:Ne,minZoom:ue,maxZoom:ge,preventScrolling:Oe,zoomOnScroll:On,zoomOnPinch:Ht,zoomOnDoubleClick:Qn,panOnScroll:vt,panOnScrollSpeed:Pt,panOnScrollMode:We,panOnDrag:fn,onPaneClick:Vc,onPaneMouseEnter:ol,onPaneMouseMove:sl,onPaneMouseLeave:ul,onPaneScroll:or,onPaneContextMenu:cl,paneClickDistance:bi,nodeClickDistance:Pc,onSelectionContextMenu:Y,onSelectionStart:Q,onSelectionEnd:K,onReconnect:ya,onReconnectStart:wi,onReconnectEnd:$c,onEdgeContextMenu:ss,onEdgeDoubleClick:us,onEdgeMouseEnter:cs,onEdgeMouseMove:va,onEdgeMouseLeave:ba,reconnectRadius:fs,defaultMarkerColor:Qt,noDragClassName:Dt,noWheelClassName:$t,noPanClassName:sr,rfId:Ei,disableKeyboardA11y:Ir,nodeExtent:Ge,viewport:dl,onViewportChange:hl}),b.jsx(fM,{nodes:e,edges:n,defaultNodes:r,defaultEdges:l,onConnect:v,onConnectStart:w,onConnectEnd:k,onClickConnectStart:_,onClickConnectEnd:S,nodesDraggable:ct,autoPanOnNodeFocus:nt,nodesConnectable:Mt,nodesFocusable:Vt,edgesFocusable:En,edgesReconnectable:Rn,elementsSelectable:jt,elevateNodesOnSelect:Hr,elevateEdgesOnSelect:Br,minZoom:ue,maxZoom:ge,nodeExtent:Ge,onNodesChange:ds,onEdgesChange:Zn,snapToGrid:pe,snapGrid:_e,connectionMode:I,translateExtent:Ne,connectOnClick:Gc,defaultEdgeOptions:wa,fitView:fl,fitViewOptions:hs,onNodesDelete:O,onEdgesDelete:L,onDelete:q,onNodeDragStart:H,onNodeDrag:R,onNodeDragStop:V,onSelectionDrag:$,onSelectionDragStart:B,onSelectionDragStop:M,onMove:m,onMoveStart:p,onMoveEnd:x,noPanClassName:sr,nodeOrigin:Lt,rfId:Ei,autoPanOnConnect:qr,autoPanOnNodeDrag:St,autoPanSpeed:ms,onError:Ur,connectionRadius:gs,isValidConnection:ur,selectNodesOnDrag:Te,nodeDragThreshold:xs,connectionDragThreshold:Fc,onBeforeDelete:j,debug:Xc,ariaLabelConfig:vs,zIndexMode:_i}),b.jsx(oM,{onSelectionChange:ee}),os,b.jsx(nM,{proOptions:Si,position:ps}),b.jsx(tM,{rfId:Ei,disableKeyboardA11y:Ir})]})})}var Oj=US(Rj);const Lj=e=>{var n;return(n=e.domNode)==null?void 0:n.querySelector(".react-flow__edgelabel-renderer")};function Hj({children:e}){const n=$e(Lj);return n?Xz.createPortal(e,n):null}function Bj(e){const[n,r]=P.useState(e),l=P.useCallback(a=>r(s=>IS(a,s)),[]);return[n,r,l]}function Ij(e){const[n,r]=P.useState(e),l=P.useCallback(a=>r(s=>qS(a,s)),[]);return[n,r,l]}function qj({dimensions:e,lineWidth:n,variant:r,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:zt(["react-flow__background-pattern",r,l])})}function Uj({radius:e,className:n}){return b.jsx("circle",{cx:e,cy:e,r:e,className:zt(["react-flow__background-pattern","dots",n])})}var Mr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Mr||(Mr={}));const Vj={[Mr.Dots]:1,[Mr.Lines]:1,[Mr.Cross]:6},Pj=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function f_({id:e,variant:n=Mr.Dots,gap:r=20,size:l,lineWidth:a=1,offset:s=0,color:u,bgColor:c,style:d,className:h,patternClassName:m}){const p=P.useRef(null),{transform:x,patternId:v}=$e(Pj,pt),w=l||Vj[n],k=n===Mr.Dots,_=n===Mr.Cross,S=Array.isArray(r)?r:[r,r],T=[S[0]*x[2]||1,S[1]*x[2]||1],E=w*x[2],A=Array.isArray(s)?s:[s,s],U=_?[E,E]:T,z=[A[0]*x[2]||1+U[0]/2,A[1]*x[2]||1+U[1]/2],H=`${v}${e||""}`;return b.jsxs("svg",{className:zt(["react-flow__background",h]),style:{...d,...Oc,"--xy-background-color-props":c,"--xy-background-pattern-color-props":u},ref:p,"data-testid":"rf__background",children:[b.jsx("pattern",{id:H,x:x[0]%T[0],y:x[1]%T[1],width:T[0],height:T[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${z[0]},-${z[1]})`,children:k?b.jsx(Uj,{radius:E/2,className:m}):b.jsx(qj,{dimensions:U,lineWidth:a,variant:n,className:m})}),b.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${H})`})]})}f_.displayName="Background";const $j=P.memo(f_);function Gj(){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 Yj(){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 Fj(){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 Xj(){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 Qj(){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 Pu({children:e,className:n,...r}){return b.jsx("button",{type:"button",className:zt(["react-flow__controls-button",n]),...r,children:e})}const Zj=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function d_({style:e,showZoom:n=!0,showFitView:r=!0,showInteractive:l=!0,fitViewOptions:a,onZoomIn:s,onZoomOut:u,onFitView:c,onInteractiveChange:d,className:h,children:m,position:p="bottom-left",orientation:x="vertical","aria-label":v}){const w=mt(),{isInteractive:k,minZoomReached:_,maxZoomReached:S,ariaLabelConfig:T}=$e(Zj,pt),{zoomIn:E,zoomOut:A,fitView:U}=ma(),z=()=>{E(),s==null||s()},H=()=>{A(),u==null||u()},R=()=>{U(a),c==null||c()},V=()=>{w.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),d==null||d(!k)},O=x==="horizontal"?"horizontal":"vertical";return b.jsxs(Rc,{className:zt(["react-flow__controls",O,h]),position:p,style:e,"data-testid":"rf__controls","aria-label":v??T["controls.ariaLabel"],children:[n&&b.jsxs(b.Fragment,{children:[b.jsx(Pu,{onClick:z,className:"react-flow__controls-zoomin",title:T["controls.zoomIn.ariaLabel"],"aria-label":T["controls.zoomIn.ariaLabel"],disabled:S,children:b.jsx(Gj,{})}),b.jsx(Pu,{onClick:H,className:"react-flow__controls-zoomout",title:T["controls.zoomOut.ariaLabel"],"aria-label":T["controls.zoomOut.ariaLabel"],disabled:_,children:b.jsx(Yj,{})})]}),r&&b.jsx(Pu,{className:"react-flow__controls-fitview",onClick:R,title:T["controls.fitView.ariaLabel"],"aria-label":T["controls.fitView.ariaLabel"],children:b.jsx(Fj,{})}),l&&b.jsx(Pu,{className:"react-flow__controls-interactive",onClick:V,title:T["controls.interactive.ariaLabel"],"aria-label":T["controls.interactive.ariaLabel"],children:k?b.jsx(Qj,{}):b.jsx(Xj,{})}),m]})}d_.displayName="Controls";const Kj=P.memo(d_);function Jj({id:e,x:n,y:r,width:l,height:a,style:s,color:u,strokeColor:c,strokeWidth:d,className:h,borderRadius:m,shapeRendering:p,selected:x,onClick:v}){const{background:w,backgroundColor:k}=s||{},_=u||w||k;return b.jsx("rect",{className:zt(["react-flow__minimap-node",{selected:x},h]),x:n,y:r,rx:m,ry:m,width:l,height:a,style:{fill:_,stroke:c,strokeWidth:d},shapeRendering:p,onClick:v?S=>v(S,e):void 0})}const Wj=P.memo(Jj),e4=e=>e.nodes.map(n=>n.id),Eh=e=>e instanceof Function?e:()=>e;function t4({nodeStrokeColor:e,nodeColor:n,nodeClassName:r="",nodeBorderRadius:l=5,nodeStrokeWidth:a,nodeComponent:s=Wj,onClick:u}){const c=$e(e4,pt),d=Eh(n),h=Eh(e),m=Eh(r),p=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return b.jsx(b.Fragment,{children:c.map(x=>b.jsx(r4,{id:x,nodeColorFunc:d,nodeStrokeColorFunc:h,nodeClassNameFunc:m,nodeBorderRadius:l,nodeStrokeWidth:a,NodeComponent:s,onClick:u,shapeRendering:p},x))})}function n4({id:e,nodeColorFunc:n,nodeStrokeColorFunc:r,nodeClassNameFunc:l,nodeBorderRadius:a,nodeStrokeWidth:s,shapeRendering:u,NodeComponent:c,onClick:d}){const{node:h,x:m,y:p,width:x,height:v}=$e(w=>{const k=w.nodeLookup.get(e);if(!k)return{node:void 0,x:0,y:0,width:0,height:0};const _=k.internals.userNode,{x:S,y:T}=k.internals.positionAbsolute,{width:E,height:A}=Rr(_);return{node:_,x:S,y:T,width:E,height:A}},pt);return!h||h.hidden||!pS(h)?null:b.jsx(c,{x:m,y:p,width:x,height:v,style:h.style,selected:!!h.selected,className:l(h),color:n(h),borderRadius:a,strokeColor:r(h),strokeWidth:s,shapeRendering:u,onClick:d,id:h.id})}const r4=P.memo(n4);var i4=P.memo(t4);const l4=200,a4=150,o4=e=>!e.hidden,s4=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?hS(Wo(e.nodeLookup,{filter:o4}),n):n,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},u4="react-flow__minimap-desc";function h_({style:e,className:n,nodeStrokeColor:r,nodeColor:l,nodeClassName:a="",nodeBorderRadius:s=5,nodeStrokeWidth:u,nodeComponent:c,bgColor:d,maskColor:h,maskStrokeColor:m,maskStrokeWidth:p,position:x="bottom-right",onClick:v,onNodeClick:w,pannable:k=!1,zoomable:_=!1,ariaLabel:S,inversePan:T,zoomStep:E=1,offsetScale:A=5}){const U=mt(),z=P.useRef(null),{boundingRect:H,viewBB:R,rfId:V,panZoom:O,translateExtent:L,flowWidth:q,flowHeight:ee,ariaLabelConfig:B}=$e(s4,pt),$=(e==null?void 0:e.width)??l4,M=(e==null?void 0:e.height)??a4,Y=H.width/$,Q=H.height/M,K=Math.max(Y,Q),j=K*$,I=K*M,F=A*K,N=H.x-(j-H.width)/2-F,G=H.y-(I-H.height)/2-F,X=j+F*2,J=I+F*2,ne=`${u4}-${V}`,re=P.useRef(0),se=P.useRef();re.current=K,P.useEffect(()=>{if(z.current&&O)return se.current=wz({domNode:z.current,panZoom:O,getTransform:()=>U.getState().transform,getViewScale:()=>re.current}),()=>{var pe;(pe=se.current)==null||pe.destroy()}},[O]),P.useEffect(()=>{var pe;(pe=se.current)==null||pe.update({translateExtent:L,width:q,height:ee,inversePan:T,pannable:k,zoomStep:E,zoomable:_})},[k,_,T,E,L,q,ee]);const xe=v?pe=>{var Te;const[_e,Me]=((Te=se.current)==null?void 0:Te.pointer(pe))||[0,0];v(pe,{x:_e,y:Me})}:void 0,ve=w?P.useCallback((pe,_e)=>{const Me=U.getState().nodeLookup.get(_e).internals.userNode;w(pe,Me)},[]):void 0,ye=S??B["minimap.ariaLabel"];return b.jsx(Rc,{position:x,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*K:void 0,"--xy-minimap-node-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-node-stroke-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-width-props":typeof u=="number"?u:void 0},className:zt(["react-flow__minimap",n]),"data-testid":"rf__minimap",children:b.jsxs("svg",{width:$,height:M,viewBox:`${N} ${G} ${X} ${J}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ne,ref:z,onClick:xe,children:[ye&&b.jsx("title",{id:ne,children:ye}),b.jsx(i4,{onClick:ve,nodeColor:l,nodeStrokeColor:r,nodeBorderRadius:s,nodeClassName:a,nodeStrokeWidth:u,nodeComponent:c}),b.jsx("path",{className:"react-flow__minimap-mask",d:`M${N-F},${G-F}h${X+F*2}v${J+F*2}h${-X-F*2}z + M${R.x},${R.y}h${R.width}v${R.height}h${-R.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}h_.displayName="MiniMap";const c4=P.memo(h_),f4=e=>n=>e?`${Math.max(1/n.transform[2],1)}`:void 0,d4={[ha.Line]:"right",[ha.Handle]:"bottom-right"};function h4({nodeId:e,position:n,variant:r=ha.Handle,className:l,style:a=void 0,children:s,color:u,minWidth:c=10,minHeight:d=10,maxWidth:h=Number.MAX_VALUE,maxHeight:m=Number.MAX_VALUE,keepAspectRatio:p=!1,resizeDirection:x,autoScale:v=!0,shouldResize:w,onResizeStart:k,onResize:_,onResizeEnd:S}){const T=GS(),E=typeof e=="string"?e:T,A=mt(),U=P.useRef(null),z=r===ha.Handle,H=$e(P.useCallback(f4(z&&v),[z,v]),pt),R=P.useRef(null),V=n??d4[r];P.useEffect(()=>{if(!(!U.current||!E))return R.current||(R.current=Oz({domNode:U.current,nodeId:E,getStoreItems:()=>{const{nodeLookup:L,transform:q,snapGrid:ee,snapToGrid:B,nodeOrigin:$,domNode:M}=A.getState();return{nodeLookup:L,transform:q,snapGrid:ee,snapToGrid:B,nodeOrigin:$,paneDomNode:M}},onChange:(L,q)=>{const{triggerNodeChanges:ee,nodeLookup:B,parentLookup:$,nodeOrigin:M}=A.getState(),Y=[],Q={x:L.x,y:L.y},K=B.get(E);if(K&&K.expandParent&&K.parentId){const j=K.origin??M,I=L.width??K.measured.width??0,F=L.height??K.measured.height??0,N={id:K.id,parentId:K.parentId,rect:{width:I,height:F,...mS({x:L.x??K.position.x,y:L.y??K.position.y},{width:I,height:F},K.parentId,B,j)}},G=Dm([N],B,$,M);Y.push(...G),Q.x=L.x?Math.max(j[0]*I,L.x):void 0,Q.y=L.y?Math.max(j[1]*F,L.y):void 0}if(Q.x!==void 0&&Q.y!==void 0){const j={id:E,type:"position",position:{...Q}};Y.push(j)}if(L.width!==void 0&&L.height!==void 0){const I={id:E,type:"dimensions",resizing:!0,setAttributes:x?x==="horizontal"?"width":"height":!0,dimensions:{width:L.width,height:L.height}};Y.push(I)}for(const j of q){const I={...j,type:"position"};Y.push(I)}ee(Y)},onEnd:({width:L,height:q})=>{const ee={id:E,type:"dimensions",resizing:!1,dimensions:{width:L,height:q}};A.getState().triggerNodeChanges([ee])}})),R.current.update({controlPosition:V,boundaries:{minWidth:c,minHeight:d,maxWidth:h,maxHeight:m},keepAspectRatio:p,resizeDirection:x,onResizeStart:k,onResize:_,onResizeEnd:S,shouldResize:w}),()=>{var L;(L=R.current)==null||L.destroy()}},[V,c,d,h,m,p,k,_,S,w]);const O=V.split("-");return b.jsx("div",{className:zt(["react-flow__resize-control","nodrag",...O,r,l]),ref:U,style:{...a,scale:H,...u&&{[z?"backgroundColor":"borderColor"]:u}},children:s})}P.memo(h4);function rs(e,n){if(n.length===0)return null;let r=e[n[0]];for(let l=1;ll.viewContextPath),n=he(l=>l.nodes),r=he(l=>l.subworkflowContexts);return P.useMemo(()=>{var l;return e.length===0?n:((l=rs(r,e))==null?void 0:l.nodes)??n},[e,n,r])}function p4(){const e=he(l=>l.viewContextPath),n=he(l=>l.groupProgress),r=he(l=>l.subworkflowContexts);return P.useMemo(()=>{var l;return e.length===0?n:((l=rs(r,e))==null?void 0:l.groupProgress)??n},[e,n,r])}function m4(){const e=he(l=>l.viewContextPath),n=he(l=>l.highlightedEdges),r=he(l=>l.subworkflowContexts);return P.useMemo(()=>{var l;return e.length===0?n:((l=rs(r,e))==null?void 0:l.highlightedEdges)??n},[e,n,r])}function p_(){const e=he(r=>r.viewContextPath),n=he(r=>r.subworkflowContexts);return P.useMemo(()=>{var r;return e.length===0?n:((r=rs(n,e))==null?void 0:r.children)??[]},[e,n])}function g4(){const e=he(h=>h.viewContextPath),n=he(h=>h.agents),r=he(h=>h.routes),l=he(h=>h.parallelGroups),a=he(h=>h.forEachGroups),s=he(h=>h.nodes),u=he(h=>h.groupProgress),c=he(h=>h.entryPoint),d=he(h=>h.subworkflowContexts);return P.useMemo(()=>{if(e.length===0)return{agents:n,routes:r,parallelGroups:l,forEachGroups:a,nodes:s,groupProgress:u,entryPoint:c,subworkflowContexts:d};const h=rs(d,e);return h?{agents:h.agents,routes:h.routes,parallelGroups:h.parallelGroups,forEachGroups:h.forEachGroups,nodes:h.nodes,groupProgress:h.groupProgress,entryPoint:h.entryPoint,subworkflowContexts:h.children}:{agents:n,routes:r,parallelGroups:l,forEachGroups:a,nodes:s,groupProgress:u,entryPoint:c,subworkflowContexts:d}},[e,n,r,l,a,s,u,c,d])}function x4(){const e=new URLSearchParams(window.location.search);return{subworkflowPath:e.get("subworkflow"),agent:e.get("agent")}}function y4(e,n){const r=[];let l=e;for(const a of n){const s=l.findIndex(u=>u.parentAgent===a);if(s===-1)return{path:r,failedSegment:a};r.push(s),l=l[s].children}return{path:r,failedSegment:null}}function v4(){const[e,n]=P.useState(null),r=P.useRef(!1),{fitView:l}=ma(),{subworkflowPath:a,agent:s}=x4(),u=!!(a||s);return P.useEffect(()=>{if(r.current||!u)return;const c=he.subscribe(h=>{if(!r.current&&h.agents.length!==0){if(r.current=!0,c(),a){const m=a.split("/").filter(Boolean),{path:p,failedSegment:x}=y4(h.subworkflowContexts,m);if(x){const v=m.slice(0,p.length).join("/");n({message:`Subworkflow "${x}" not found${v?` (resolved: ${v})`:""}. It may not have started yet.`});return}he.setState({viewContextPath:p,selectedNode:null})}if(s){const m=he.getState();let p;if(m.viewContextPath.length===0)p=m.agents;else{let v,w=m.subworkflowContexts;for(const k of m.viewContextPath){if(v=w[k],!v)break;w=v.children}p=(v==null?void 0:v.agents)??[]}if(!p.some(v=>v.name===s)){n({message:`Agent "${s}" not found in ${a||"root workflow"}.`});return}he.setState({selectedNode:s}),setTimeout(()=>{l({nodes:[{id:s}],padding:.5,duration:400})},200)}}});return he.getState().agents.length>0&&!r.current&&he.setState({}),c},[u,a,s,l]),e}var kh,d1;function Om(){if(d1)return kh;d1=1;var e="\0",n="\0",r="";class l{constructor(m){Ct(this,"_isDirected",!0);Ct(this,"_isMultigraph",!1);Ct(this,"_isCompound",!1);Ct(this,"_label");Ct(this,"_defaultNodeLabelFn",()=>{});Ct(this,"_defaultEdgeLabelFn",()=>{});Ct(this,"_nodes",{});Ct(this,"_in",{});Ct(this,"_preds",{});Ct(this,"_out",{});Ct(this,"_sucs",{});Ct(this,"_edgeObjs",{});Ct(this,"_edgeLabels",{});Ct(this,"_nodeCount",0);Ct(this,"_edgeCount",0);Ct(this,"_parent");Ct(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 x=arguments,v=this;return m.forEach(function(w){x.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 x=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(x),delete this._in[m],delete this._preds[m],Object.keys(this._out[m]).forEach(x),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 x=p;x!==void 0;x=this.parent(x))if(x===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 x of this.successors(m))v.add(x);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 x=this;Object.entries(this._nodes).forEach(function([k,_]){m(k)&&p.setNode(k,_)}),Object.values(this._edgeObjs).forEach(function(k){p.hasNode(k.v)&&p.hasNode(k.w)&&p.setEdge(k,x.edge(k))});var v={};function w(k){var _=x.parent(k);return _===void 0||p.hasNode(_)?(v[k]=_,_):_ in v?v[_]:w(_)}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 x=this,v=arguments;return m.reduce(function(w,k){return v.length>1?x.setEdge(w,k,p):x.setEdge(w,k),k}),this}setEdge(){var m,p,x,v,w=!1,k=arguments[0];typeof k=="object"&&k!==null&&"v"in k?(m=k.v,p=k.w,x=k.name,arguments.length===2&&(v=arguments[1],w=!0)):(m=k,p=arguments[1],x=arguments[3],arguments.length>2&&(v=arguments[2],w=!0)),m=""+m,p=""+p,x!==void 0&&(x=""+x);var _=u(this._isDirected,m,p,x);if(Object.hasOwn(this._edgeLabels,_))return w&&(this._edgeLabels[_]=v),this;if(x!==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,x);var S=c(this._isDirected,m,p,x);return m=S.v,p=S.w,Object.freeze(S),this._edgeObjs[_]=S,a(this._preds[p],m),a(this._sucs[m],p),this._in[p][_]=S,this._out[m][_]=S,this._edgeCount++,this}edge(m,p,x){var v=arguments.length===1?d(this._isDirected,arguments[0]):u(this._isDirected,m,p,x);return this._edgeLabels[v]}edgeAsObj(){const m=this.edge(...arguments);return typeof m!="object"?{label:m}:m}hasEdge(m,p,x){var v=arguments.length===1?d(this._isDirected,arguments[0]):u(this._isDirected,m,p,x);return Object.hasOwn(this._edgeLabels,v)}removeEdge(m,p,x){var v=arguments.length===1?d(this._isDirected,arguments[0]):u(this._isDirected,m,p,x),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 x=this._in[m];if(x){var v=Object.values(x);return p?v.filter(w=>w.v===p):v}}outEdges(m,p){var x=this._out[m];if(x){var v=Object.values(x);return p?v.filter(w=>w.w===p):v}}nodeEdges(m,p){var x=this.inEdges(m,p);if(x)return x.concat(this.outEdges(m,p))}}function a(h,m){h[m]?h[m]++:h[m]=1}function s(h,m){--h[m]||delete h[m]}function u(h,m,p,x){var v=""+m,w=""+p;if(!h&&v>w){var k=v;v=w,w=k}return v+r+w+r+(x===void 0?e:x)}function c(h,m,p,x){var v=""+m,w=""+p;if(!h&&v>w){var k=v;v=w,w=k}var _={v,w};return x&&(_.name=x),_}function d(h,m){return u(h,m.v,m.w,m.name)}return kh=l,kh}var Nh,h1;function b4(){return h1||(h1=1,Nh="2.2.4"),Nh}var Ch,p1;function w4(){return p1||(p1=1,Ch={Graph:Om(),version:b4()}),Ch}var Th,m1;function S4(){if(m1)return Th;m1=1;var e=Om();Th={write:n,read:a};function n(s){var u={options:{directed:s.isDirected(),multigraph:s.isMultigraph(),compound:s.isCompound()},nodes:r(s),edges:l(s)};return s.graph()!==void 0&&(u.value=structuredClone(s.graph())),u}function r(s){return s.nodes().map(function(u){var c=s.node(u),d=s.parent(u),h={v:u};return c!==void 0&&(h.value=c),d!==void 0&&(h.parent=d),h})}function l(s){return s.edges().map(function(u){var c=s.edge(u),d={v:u.v,w:u.w};return u.name!==void 0&&(d.name=u.name),c!==void 0&&(d.value=c),d})}function a(s){var u=new e(s.options).setGraph(s.value);return s.nodes.forEach(function(c){u.setNode(c.v,c.value),c.parent&&u.setParent(c.v,c.parent)}),s.edges.forEach(function(c){u.setEdge({v:c.v,w:c.w,name:c.name},c.value)}),u}return Th}var Ah,g1;function _4(){if(g1)return Ah;g1=1,Ah=e;function e(n){var r={},l=[],a;function s(u){Object.hasOwn(r,u)||(r[u]=!0,a.push(u),n.successors(u).forEach(s),n.predecessors(u).forEach(s))}return n.nodes().forEach(function(u){a=[],s(u),a.length&&l.push(a)}),l}return Ah}var zh,x1;function m_(){if(x1)return zh;x1=1;class e{constructor(){Ct(this,"_arr",[]);Ct(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(r){return r.key})}has(r){return Object.hasOwn(this._keyIndices,r)}priority(r){var l=this._keyIndices[r];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(r,l){var a=this._keyIndices;if(r=String(r),!Object.hasOwn(a,r)){var s=this._arr,u=s.length;return a[r]=u,s.push({key:r,priority:l}),this._decrease(u),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key}decrease(r,l){var a=this._keyIndices[r];if(l>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[a].priority+" New: "+l);this._arr[a].priority=l,this._decrease(a)}_heapify(r){var l=this._arr,a=2*r,s=a+1,u=r;a>1,!(l[s].priority1;function r(a,s,u,c){return l(a,String(s),u||n,c||function(d){return a.outEdges(d)})}function l(a,s,u,c){var d={},h=new e,m,p,x=function(v){var w=v.v!==m?v.v:v.w,k=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);)c(m).forEach(x);return d}return Mh}var jh,v1;function E4(){if(v1)return jh;v1=1;var e=g_();jh=n;function n(r,l,a){return r.nodes().reduce(function(s,u){return s[u]=e(r,u,l,a),s},{})}return jh}var Dh,b1;function x_(){if(b1)return Dh;b1=1,Dh=e;function e(n){var r=0,l=[],a={},s=[];function u(c){var d=a[c]={onStack:!0,lowlink:r,index:r++};if(l.push(c),n.successors(c).forEach(function(p){Object.hasOwn(a,p)?a[p].onStack&&(d.lowlink=Math.min(d.lowlink,a[p].index)):(u(p),d.lowlink=Math.min(d.lowlink,a[p].lowlink))}),d.lowlink===d.index){var h=[],m;do m=l.pop(),a[m].onStack=!1,h.push(m);while(c!==m);s.push(h)}}return n.nodes().forEach(function(c){Object.hasOwn(a,c)||u(c)}),s}return Dh}var Rh,w1;function k4(){if(w1)return Rh;w1=1;var e=x_();Rh=n;function n(r){return e(r).filter(function(l){return l.length>1||l.length===1&&r.hasEdge(l[0],l[0])})}return Rh}var Oh,S1;function N4(){if(S1)return Oh;S1=1,Oh=n;var e=()=>1;function n(l,a,s){return r(l,a||e,s||function(u){return l.outEdges(u)})}function r(l,a,s){var u={},c=l.nodes();return c.forEach(function(d){u[d]={},u[d][d]={distance:0},c.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=a(h);u[d][m]={distance:p,predecessor:d}})}),c.forEach(function(d){var h=u[d];c.forEach(function(m){var p=u[m];c.forEach(function(x){var v=p[d],w=h[x],k=p[x],_=v.distance+w.distance;_a.successors(p):p=>a.neighbors(p),d=u==="post"?n:r,h=[],m={};return s.forEach(p=>{if(!a.hasNode(p))throw new Error("Graph does not have node: "+p);d(p,c,m,h)}),h}function n(a,s,u,c){for(var d=[[a,!1]];d.length>0;){var h=d.pop();h[1]?c.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 r(a,s,u,c){for(var d=[a];d.length>0;){var h=d.pop();Object.hasOwn(u,h)||(u[h]=!0,c.push(h),l(s(h),m=>d.push(m)))}}function l(a,s){for(var u=a.length;u--;)s(a[u],u,a);return a}return Bh}var Ih,N1;function T4(){if(N1)return Ih;N1=1;var e=v_();Ih=n;function n(r,l){return e(r,l,"post")}return Ih}var qh,C1;function A4(){if(C1)return qh;C1=1;var e=v_();qh=n;function n(r,l){return e(r,l,"pre")}return qh}var Uh,T1;function z4(){if(T1)return Uh;T1=1;var e=Om(),n=m_();Uh=r;function r(l,a){var s=new e,u={},c=new n,d;function h(p){var x=p.v===d?p.w:p.v,v=c.priority(x);if(v!==void 0){var w=a(p);w0;){if(d=c.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 Uh}var Vh,A1;function M4(){return A1||(A1=1,Vh={components:_4(),dijkstra:g_(),dijkstraAll:E4(),findCycles:k4(),floydWarshall:N4(),isAcyclic:C4(),postorder:T4(),preorder:A4(),prim:z4(),tarjan:x_(),topsort:y_()}),Vh}var Ph,z1;function Fn(){if(z1)return Ph;z1=1;var e=w4();return Ph={Graph:e.Graph,json:S4(),alg:M4(),version:e.version},Ph}var $h,M1;function j4(){if(M1)return $h;M1=1;class e{constructor(){let a={};a._next=a._prev=a,this._sentinel=a}dequeue(){let a=this._sentinel,s=a._prev;if(s!==a)return n(s),s}enqueue(a){let s=this._sentinel;a._prev&&a._next&&n(a),a._next=s._next,s._next._prev=a,s._next=a,a._prev=s}toString(){let a=[],s=this._sentinel,u=s._prev;for(;u!==s;)a.push(JSON.stringify(u,r)),u=u._prev;return"["+a.join(", ")+"]"}}function n(l){l._prev._next=l._next,l._next._prev=l._prev,delete l._next,delete l._prev}function r(l,a){if(l!=="_next"&&l!=="_prev")return a}return $h=e,$h}var Gh,j1;function D4(){if(j1)return Gh;j1=1;let e=Fn().Graph,n=j4();Gh=l;let r=()=>1;function l(h,m){if(h.nodeCount()<=1)return[];let p=u(h,m||r);return a(p.graph,p.buckets,p.zeroIdx).flatMap(v=>h.outEdges(v.v,v.w))}function a(h,m,p){let x=[],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 _=m.length-2;_>0;--_)if(k=m[_].dequeue(),k){x=x.concat(s(h,m,p,k,!0));break}}}return x}function s(h,m,p,x,v){let w=v?[]:void 0;return h.inEdges(x.v).forEach(k=>{let _=h.edge(k),S=h.node(k.v);v&&w.push({v:k.v,w:k.w}),S.out-=_,c(m,p,S)}),h.outEdges(x.v).forEach(k=>{let _=h.edge(k),S=k.w,T=h.node(S);T.in-=_,c(m,p,T)}),h.removeNode(x.v),w}function u(h,m){let p=new e,x=0,v=0;h.nodes().forEach(_=>{p.setNode(_,{v:_,in:0,out:0})}),h.edges().forEach(_=>{let S=p.edge(_.v,_.w)||0,T=m(_),E=S+T;p.setEdge(_.v,_.w,E),v=Math.max(v,p.node(_.v).out+=T),x=Math.max(x,p.node(_.w).in+=T)});let w=d(v+x+3).map(()=>new n),k=x+1;return p.nodes().forEach(_=>{c(w,k,p.node(_))}),{graph:p,buckets:w,zeroIdx:k}}function c(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;pV.setNode(O,R.node(O))),R.edges().forEach(O=>{let L=V.edge(O.v,O.w)||{weight:0,minlen:1},q=R.edge(O);V.setEdge(O.v,O.w,{weight:L.weight+q.weight,minlen:Math.max(L.minlen,q.minlen)})}),V}function l(R){let V=new e({multigraph:R.isMultigraph()}).setGraph(R.graph());return R.nodes().forEach(O=>{R.children(O).length||V.setNode(O,R.node(O))}),R.edges().forEach(O=>{V.setEdge(O,R.edge(O))}),V}function a(R){let V=R.nodes().map(O=>{let L={};return R.outEdges(O).forEach(q=>{L[q.w]=(L[q.w]||0)+R.edge(q).weight}),L});return H(R.nodes(),V)}function s(R){let V=R.nodes().map(O=>{let L={};return R.inEdges(O).forEach(q=>{L[q.v]=(L[q.v]||0)+R.edge(q).weight}),L});return H(R.nodes(),V)}function u(R,V){let O=R.x,L=R.y,q=V.x-O,ee=V.y-L,B=R.width/2,$=R.height/2;if(!q&&!ee)throw new Error("Not possible to find intersection inside of the rectangle");let M,Y;return Math.abs(ee)*B>Math.abs(q)*$?(ee<0&&($=-$),M=$*q/ee,Y=$):(q<0&&(B=-B),M=B,Y=B*ee/q),{x:O+M,y:L+Y}}function c(R){let V=A(w(R)+1).map(()=>[]);return R.nodes().forEach(O=>{let L=R.node(O),q=L.rank;q!==void 0&&(V[q][L.order]=O)}),V}function d(R){let V=R.nodes().map(L=>{let q=R.node(L).rank;return q===void 0?Number.MAX_VALUE:q}),O=v(Math.min,V);R.nodes().forEach(L=>{let q=R.node(L);Object.hasOwn(q,"rank")&&(q.rank-=O)})}function h(R){let V=R.nodes().map(B=>R.node(B).rank),O=v(Math.min,V),L=[];R.nodes().forEach(B=>{let $=R.node(B).rank-O;L[$]||(L[$]=[]),L[$].push(B)});let q=0,ee=R.graph().nodeRankFactor;Array.from(L).forEach((B,$)=>{B===void 0&&$%ee!==0?--q:B!==void 0&&q&&B.forEach(M=>R.node(M).rank+=q)})}function m(R,V,O,L){let q={width:0,height:0};return arguments.length>=4&&(q.rank=O,q.order=L),n(R,"border",q,V)}function p(R,V=x){const O=[];for(let L=0;Lx){const O=p(V);return R.apply(null,O.map(L=>R.apply(null,L)))}else return R.apply(null,V)}function w(R){const O=R.nodes().map(L=>{let q=R.node(L).rank;return q===void 0?Number.MIN_VALUE:q});return v(Math.max,O)}function k(R,V){let O={lhs:[],rhs:[]};return R.forEach(L=>{V(L)?O.lhs.push(L):O.rhs.push(L)}),O}function _(R,V){let O=Date.now();try{return V()}finally{console.log(R+" time: "+(Date.now()-O)+"ms")}}function S(R,V){return V()}let T=0;function E(R){var V=++T;return R+(""+V)}function A(R,V,O=1){V==null&&(V=R,R=0);let L=ee=>eeVL[V]),Object.entries(R).reduce((L,[q,ee])=>(L[q]=O(ee,q),L),{})}function H(R,V){return R.reduce((O,L,q)=>(O[L]=V[q],O),{})}return Yh}var Fh,R1;function R4(){if(R1)return Fh;R1=1;let e=D4(),n=At().uniqueId;Fh={run:r,undo:a};function r(s){(s.graph().acyclicer==="greedy"?e(s,c(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 c(d){return h=>d.edge(h).weight}}function l(s){let u=[],c={},d={};function h(m){Object.hasOwn(d,m)||(d[m]=!0,c[m]=!0,s.outEdges(m).forEach(p=>{Object.hasOwn(c,p.w)?u.push(p):h(p.w)}),delete c[m])}return s.nodes().forEach(h),u}function a(s){s.edges().forEach(u=>{let c=s.edge(u);if(c.reversed){s.removeEdge(u);let d=c.forwardName;delete c.reversed,delete c.forwardName,s.setEdge(u.w,u.v,c,d)}})}return Fh}var Xh,O1;function O4(){if(O1)return Xh;O1=1;let e=At();Xh={run:n,undo:l};function n(a){a.graph().dummyChains=[],a.edges().forEach(s=>r(a,s))}function r(a,s){let u=s.v,c=a.node(u).rank,d=s.w,h=a.node(d).rank,m=s.name,p=a.edge(s),x=p.labelRank;if(h===c+1)return;a.removeEdge(s);let v,w,k;for(k=0,++c;c{let u=a.node(s),c=u.edgeLabel,d;for(a.setEdge(u.edgeObj,c);u.dummy;)d=a.successors(s)[0],a.removeNode(s),c.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(c.x=u.x,c.y=u.y,c.width=u.width,c.height=u.height),s=d,u=a.node(s)})}return Xh}var Qh,L1;function gc(){if(L1)return Qh;L1=1;const{applyWithChunking:e}=At();Qh={longestPath:n,slack:r};function n(l){var a={};function s(u){var c=l.node(u);if(Object.hasOwn(a,u))return c.rank;a[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),c.rank=h}l.sources().forEach(s)}function r(l,a){return l.node(a.w).rank-l.node(a.v).rank-l.edge(a).minlen}return Qh}var Zh,H1;function b_(){if(H1)return Zh;H1=1;var e=Fn().Graph,n=gc().slack;Zh=r;function r(u){var c=new e({directed:!1}),d=u.nodes()[0],h=u.nodeCount();c.setNode(d,{});for(var m,p;l(c,u){var p=m.v,x=h===p?m.w:p;!u.hasNode(x)&&!n(c,m)&&(u.setNode(x,{}),u.setEdge(h,x,{}),d(x))})}return u.nodes().forEach(d),u.nodeCount()}function a(u,c){return c.edges().reduce((h,m)=>{let p=Number.POSITIVE_INFINITY;return u.hasNode(m.v)!==u.hasNode(m.w)&&(p=n(c,m)),pc.node(h).rank+=d)}return Zh}var Kh,B1;function L4(){if(B1)return Kh;B1=1;var e=b_(),n=gc().slack,r=gc().longestPath,l=Fn().alg.preorder,a=Fn().alg.postorder,s=At().simplify;Kh=u,u.initLowLimValues=m,u.initCutValues=c,u.calcCutValue=h,u.leaveEdge=x,u.enterEdge=v,u.exchangeEdges=w;function u(T){T=s(T),r(T);var E=e(T);m(E),c(E,T);for(var A,U;A=x(E);)U=v(E,T,A),w(E,T,A,U)}function c(T,E){var A=a(T,T.nodes());A=A.slice(0,A.length-1),A.forEach(U=>d(T,E,U))}function d(T,E,A){var U=T.node(A),z=U.parent;T.edge(A,z).cutvalue=h(T,E,A)}function h(T,E,A){var U=T.node(A),z=U.parent,H=!0,R=E.edge(A,z),V=0;return R||(H=!1,R=E.edge(z,A)),V=R.weight,E.nodeEdges(A).forEach(O=>{var L=O.v===A,q=L?O.w:O.v;if(q!==z){var ee=L===H,B=E.edge(O).weight;if(V+=ee?B:-B,_(T,A,q)){var $=T.edge(A,q).cutvalue;V+=ee?-$:$}}}),V}function m(T,E){arguments.length<2&&(E=T.nodes()[0]),p(T,{},1,E)}function p(T,E,A,U,z){var H=A,R=T.node(U);return E[U]=!0,T.neighbors(U).forEach(V=>{Object.hasOwn(E,V)||(A=p(T,E,A,V,U))}),R.low=H,R.lim=A++,z?R.parent=z:delete R.parent,A}function x(T){return T.edges().find(E=>T.edge(E).cutvalue<0)}function v(T,E,A){var U=A.v,z=A.w;E.hasEdge(U,z)||(U=A.w,z=A.v);var H=T.node(U),R=T.node(z),V=H,O=!1;H.lim>R.lim&&(V=R,O=!0);var L=E.edges().filter(q=>O===S(T,T.node(q.v),V)&&O!==S(T,T.node(q.w),V));return L.reduce((q,ee)=>n(E,ee)!E.node(z).parent),U=l(T,A);U=U.slice(1),U.forEach(z=>{var H=T.node(z).parent,R=E.edge(z,H),V=!1;R||(R=E.edge(H,z),V=!0),E.node(z).rank=E.node(H).rank+(V?R.minlen:-R.minlen)})}function _(T,E,A){return T.hasEdge(E,A)}function S(T,E,A){return A.low<=E.lim&&E.lim<=A.lim}return Kh}var Jh,I1;function H4(){if(I1)return Jh;I1=1;var e=gc(),n=e.longestPath,r=b_(),l=L4();Jh=a;function a(d){var h=d.graph().ranker;if(h instanceof Function)return h(d);switch(d.graph().ranker){case"network-simplex":c(d);break;case"tight-tree":u(d);break;case"longest-path":s(d);break;case"none":break;default:c(d)}}var s=n;function u(d){n(d),r(d)}function c(d){l(d)}return Jh}var Wh,q1;function B4(){if(q1)return Wh;q1=1,Wh=e;function e(l){let a=r(l);l.graph().dummyChains.forEach(s=>{let u=l.node(s),c=u.edgeObj,d=n(l,a,c.v,c.w),h=d.path,m=d.lca,p=0,x=h[p],v=!0;for(;s!==c.w;){if(u=l.node(s),v){for(;(x=h[p])!==m&&l.node(x).maxRankh||m>a[p].lim));for(x=p,p=u;(p=l.parent(p))!==x;)d.push(p);return{path:c.concat(d.reverse()),lca:x}}function r(l){let a={},s=0;function u(c){let d=s;l.children(c).forEach(u),a[c]={low:d,lim:s++}}return l.children().forEach(u),a}return Wh}var ep,U1;function I4(){if(U1)return ep;U1=1;let e=At();ep={run:n,cleanup:s};function n(u){let c=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=c,u.edges().forEach(v=>u.edge(v).minlen*=p);let x=a(u)+1;u.children().forEach(v=>r(u,c,p,x,m,d,v)),u.graph().nodeRankFactor=p}function r(u,c,d,h,m,p,x){let v=u.children(x);if(!v.length){x!==c&&u.setEdge(c,x,{weight:0,minlen:d});return}let w=e.addBorderNode(u,"_bt"),k=e.addBorderNode(u,"_bb"),_=u.node(x);u.setParent(w,x),_.borderTop=w,u.setParent(k,x),_.borderBottom=k,v.forEach(S=>{r(u,c,d,h,m,p,S);let T=u.node(S),E=T.borderTop?T.borderTop:S,A=T.borderBottom?T.borderBottom:S,U=T.borderTop?h:2*h,z=E!==A?1:m-p[x]+1;u.setEdge(w,E,{weight:U,minlen:z,nestingEdge:!0}),u.setEdge(A,k,{weight:U,minlen:z,nestingEdge:!0})}),u.parent(x)||u.setEdge(c,w,{weight:0,minlen:m+p[x]})}function l(u){var c={};function d(h,m){var p=u.children(h);p&&p.length&&p.forEach(x=>d(x,m+1)),c[h]=m}return u.children().forEach(h=>d(h,1)),c}function a(u){return u.edges().reduce((c,d)=>c+u.edge(d).weight,0)}function s(u){var c=u.graph();u.removeNode(c.nestingRoot),delete c.nestingRoot,u.edges().forEach(d=>{var h=u.edge(d);h.nestingEdge&&u.removeEdge(d)})}return ep}var tp,V1;function q4(){if(V1)return tp;V1=1;let e=At();tp=n;function n(l){function a(s){let u=l.children(s),c=l.node(s);if(u.length&&u.forEach(a),Object.hasOwn(c,"minRank")){c.borderLeft=[],c.borderRight=[];for(let d=c.minRank,h=c.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 a(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=>c(d.node(h))),d.edges().forEach(h=>{let m=d.edge(h);m.points.forEach(c),Object.hasOwn(m,"x")&&c(m)})}function c(d){let h=d.x;d.x=d.y,d.y=h}return np}var rp,$1;function V4(){if($1)return rp;$1=1;let e=At();rp=n;function n(r){let l={},a=r.nodes().filter(m=>!r.children(m).length),s=a.map(m=>r.node(m).rank),u=e.applyWithChunking(Math.max,s),c=e.range(u+1).map(()=>[]);function d(m){if(l[m])return;l[m]=!0;let p=r.node(m);c[p.rank].push(m),r.successors(m).forEach(d)}return a.sort((m,p)=>r.node(m).rank-r.node(p).rank).forEach(d),c}return rp}var ip,G1;function P4(){if(G1)return ip;G1=1;let e=At().zipObject;ip=n;function n(l,a){let s=0;for(let u=1;uv)),c=a.flatMap(x=>l.outEdges(x).map(v=>({pos:u[v.w],weight:l.edge(v).weight})).sort((v,w)=>v.pos-w.pos)),d=1;for(;d{let v=x.pos+d;m[v]+=x.weight;let w=0;for(;v>0;)v%2&&(w+=m[v+1]),v=v-1>>1,m[v]+=x.weight;p+=x.weight*w}),p}return ip}var lp,Y1;function $4(){if(Y1)return lp;Y1=1,lp=e;function e(n,r=[]){return r.map(l=>{let a=n.inEdges(l);if(a.length){let s=a.reduce((u,c)=>{let d=n.edge(c),h=n.node(c.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 lp}var ap,F1;function G4(){if(F1)return ap;F1=1;let e=At();ap=n;function n(a,s){let u={};a.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 c=Object.values(u).filter(d=>!d.indegree);return r(c)}function r(a){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 c(d){return h=>{h.in.push(d),--h.indegree===0&&a.push(h)}}for(;a.length;){let d=a.pop();s.push(d),d.in.reverse().forEach(u(d)),d.out.forEach(c(d))}return s.filter(d=>!d.merged).map(d=>e.pick(d,["vs","i","barycenter","weight"]))}function l(a,s){let u=0,c=0;a.weight&&(u+=a.barycenter*a.weight,c+=a.weight),s.weight&&(u+=s.barycenter*s.weight,c+=s.weight),a.vs=s.vs.concat(a.vs),a.barycenter=u/c,a.weight=c,a.i=Math.min(s.i,a.i),s.merged=!0}return ap}var op,X1;function Y4(){if(X1)return op;X1=1;let e=At();op=n;function n(a,s){let u=e.partition(a,w=>Object.hasOwn(w,"barycenter")),c=u.lhs,d=u.rhs.sort((w,k)=>k.i-w.i),h=[],m=0,p=0,x=0;c.sort(l(!!s)),x=r(h,d,x),c.forEach(w=>{x+=w.vs.length,h.push(w.vs),m+=w.barycenter*w.weight,p+=w.weight,x=r(h,d,x)});let v={vs:h.flat(!0)};return p&&(v.barycenter=m/p,v.weight=p),v}function r(a,s,u){let c;for(;s.length&&(c=s[s.length-1]).i<=u;)s.pop(),a.push(c.vs),u++;return u}function l(a){return(s,u)=>s.barycenteru.barycenter?1:a?u.i-s.i:s.i-u.i}return op}var sp,Q1;function F4(){if(Q1)return sp;Q1=1;let e=$4(),n=G4(),r=Y4();sp=l;function l(u,c,d,h){let m=u.children(c),p=u.node(c),x=p?p.borderLeft:void 0,v=p?p.borderRight:void 0,w={};x&&(m=m.filter(T=>T!==x&&T!==v));let k=e(u,m);k.forEach(T=>{if(u.children(T.v).length){let E=l(u,T.v,d,h);w[T.v]=E,Object.hasOwn(E,"barycenter")&&s(T,E)}});let _=n(k,d);a(_,w);let S=r(_,h);if(x&&(S.vs=[x,S.vs,v].flat(!0),u.predecessors(x).length)){let T=u.node(u.predecessors(x)[0]),E=u.node(u.predecessors(v)[0]);Object.hasOwn(S,"barycenter")||(S.barycenter=0,S.weight=0),S.barycenter=(S.barycenter*S.weight+T.order+E.order)/(S.weight+2),S.weight+=2}return S}function a(u,c){u.forEach(d=>{d.vs=d.vs.flatMap(h=>c[h]?c[h].vs:h)})}function s(u,c){u.barycenter!==void 0?(u.barycenter=(u.barycenter*u.weight+c.barycenter*c.weight)/(u.weight+c.weight),u.weight+=c.weight):(u.barycenter=c.barycenter,u.weight=c.weight)}return sp}var up,Z1;function X4(){if(Z1)return up;Z1=1;let e=Fn().Graph,n=At();up=r;function r(a,s,u,c){c||(c=a.nodes());let d=l(a),h=new e({compound:!0}).setGraph({root:d}).setDefaultNodeLabel(m=>a.node(m));return c.forEach(m=>{let p=a.node(m),x=a.parent(m);(p.rank===s||p.minRank<=s&&s<=p.maxRank)&&(h.setNode(m),h.setParent(m,x||d),a[u](m).forEach(v=>{let w=v.v===m?v.w:v.v,k=h.edge(w,m),_=k!==void 0?k.weight:0;h.setEdge(w,m,{weight:a.edge(v).weight+_})}),Object.hasOwn(p,"minRank")&&h.setNode(m,{borderLeft:p.borderLeft[s],borderRight:p.borderRight[s]}))}),h}function l(a){for(var s;a.hasNode(s=n.uniqueId("_root")););return s}return up}var cp,K1;function Q4(){if(K1)return cp;K1=1,cp=e;function e(n,r,l){let a={},s;l.forEach(u=>{let c=n.parent(u),d,h;for(;c;){if(d=n.parent(c),d?(h=a[d],a[d]=c):(h=s,s=c),h&&h!==c){r.setEdge(h,c);return}c=d}})}return cp}var fp,J1;function Z4(){if(J1)return fp;J1=1;let e=V4(),n=P4(),r=F4(),l=X4(),a=Q4(),s=Fn().Graph,u=At();fp=c;function c(p,x){if(x&&typeof x.customOrder=="function"){x.customOrder(p,c);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"),_=e(p);if(m(p,_),x&&x.disableOptimalOrderHeuristic)return;let S=Number.POSITIVE_INFINITY,T;for(let E=0,A=0;A<4;++E,++A){h(E%2?w:k,E%4>=2),_=u.buildLayerMatrix(p);let U=n(p,_);U{w.has(_)||w.set(_,[]),w.get(_).push(S)};for(const _ of p.nodes()){const S=p.node(_);if(typeof S.rank=="number"&&k(S.rank,_),typeof S.minRank=="number"&&typeof S.maxRank=="number")for(let T=S.minRank;T<=S.maxRank;T++)T!==S.rank&&k(T,_)}return x.map(function(_){return l(p,_,v,w.get(_)||[])})}function h(p,x){let v=new s;p.forEach(function(w){let k=w.graph().root,_=r(w,k,v,x);_.vs.forEach((S,T)=>w.node(S).order=T),a(w,v,_.vs)})}function m(p,x){Object.values(x).forEach(v=>v.forEach((w,k)=>p.node(w).order=k))}return fp}var dp,W1;function K4(){if(W1)return dp;W1=1;let e=Fn().Graph,n=At();dp={positionX:v,findType1Conflicts:r,findType2Conflicts:l,addConflict:s,hasConflict:u,verticalAlignment:c,horizontalCompaction:d,alignCoordinates:p,findSmallestWidthAlignment:m,balance:x};function r(_,S){let T={};function E(A,U){let z=0,H=0,R=A.length,V=U[U.length-1];return U.forEach((O,L)=>{let q=a(_,O),ee=q?_.node(q).order:R;(q||O===V)&&(U.slice(H,L+1).forEach(B=>{_.predecessors(B).forEach($=>{let M=_.node($),Y=M.order;(Y{O=U[L],_.node(O).dummy&&_.predecessors(O).forEach(q=>{let ee=_.node(q);ee.dummy&&(ee.orderV)&&s(T,q,O)})})}function A(U,z){let H=-1,R,V=0;return z.forEach((O,L)=>{if(_.node(O).dummy==="border"){let q=_.predecessors(O);q.length&&(R=_.node(q[0]).order,E(z,V,L,H,R),V=L,H=R)}E(z,V,z.length,R,U.length)}),z}return S.length&&S.reduce(A),T}function a(_,S){if(_.node(S).dummy)return _.predecessors(S).find(T=>_.node(T).dummy)}function s(_,S,T){if(S>T){let A=S;S=T,T=A}let E=_[S];E||(_[S]=E={}),E[T]=!0}function u(_,S,T){if(S>T){let E=S;S=T,T=E}return!!_[S]&&Object.hasOwn(_[S],T)}function c(_,S,T,E){let A={},U={},z={};return S.forEach(H=>{H.forEach((R,V)=>{A[R]=R,U[R]=R,z[R]=V})}),S.forEach(H=>{let R=-1;H.forEach(V=>{let O=E(V);if(O.length){O=O.sort((q,ee)=>z[q]-z[ee]);let L=(O.length-1)/2;for(let q=Math.floor(L),ee=Math.ceil(L);q<=ee;++q){let B=O[q];U[V]===V&&RMath.max(q,U[ee.v]+z.edge(ee)),0)}function O(L){let q=z.outEdges(L).reduce((B,$)=>Math.min(B,U[$.w]-z.edge($)),Number.POSITIVE_INFINITY),ee=_.node(L);q!==Number.POSITIVE_INFINITY&&ee.borderType!==H&&(U[L]=Math.max(U[L],q))}return R(V,z.predecessors.bind(z)),R(O,z.successors.bind(z)),Object.keys(E).forEach(L=>U[L]=U[T[L]]),U}function h(_,S,T,E){let A=new e,U=_.graph(),z=w(U.nodesep,U.edgesep,E);return S.forEach(H=>{let R;H.forEach(V=>{let O=T[V];if(A.setNode(O),R){var L=T[R],q=A.edge(L,O);A.setEdge(L,O,Math.max(z(_,V,R),q||0))}R=V})}),A}function m(_,S){return Object.values(S).reduce((T,E)=>{let A=Number.NEGATIVE_INFINITY,U=Number.POSITIVE_INFINITY;Object.entries(E).forEach(([H,R])=>{let V=k(_,H)/2;A=Math.max(R+V,A),U=Math.min(R-V,U)});const z=A-U;return z{["l","r"].forEach(z=>{let H=U+z,R=_[H];if(R===S)return;let V=Object.values(R),O=E-n.applyWithChunking(Math.min,V);z!=="l"&&(O=A-n.applyWithChunking(Math.max,V)),O&&(_[H]=n.mapValues(R,L=>L+O))})})}function x(_,S){return n.mapValues(_.ul,(T,E)=>{if(S)return _[S.toLowerCase()][E];{let A=Object.values(_).map(U=>U[E]).sort((U,z)=>U-z);return(A[1]+A[2])/2}})}function v(_){let S=n.buildLayerMatrix(_),T=Object.assign(r(_,S),l(_,S)),E={},A;["u","d"].forEach(z=>{A=z==="u"?S:Object.values(S).reverse(),["l","r"].forEach(H=>{H==="r"&&(A=A.map(L=>Object.values(L).reverse()));let R=(z==="u"?_.predecessors:_.successors).bind(_),V=c(_,A,T,R),O=d(_,A,V.root,V.align,H==="r");H==="r"&&(O=n.mapValues(O,L=>-L)),E[z+H]=O})});let U=m(_,E);return p(E,U),x(E,_.graph().align)}function w(_,S,T){return(E,A,U)=>{let z=E.node(A),H=E.node(U),R=0,V;if(R+=z.width/2,Object.hasOwn(z,"labelpos"))switch(z.labelpos.toLowerCase()){case"l":V=-z.width/2;break;case"r":V=z.width/2;break}if(V&&(R+=T?V:-V),V=0,R+=(z.dummy?S:_)/2,R+=(H.dummy?S:_)/2,R+=H.width/2,Object.hasOwn(H,"labelpos"))switch(H.labelpos.toLowerCase()){case"l":V=H.width/2;break;case"r":V=-H.width/2;break}return V&&(R+=T?V:-V),V=0,R}}function k(_,S){return _.node(S).width}return dp}var hp,eb;function J4(){if(eb)return hp;eb=1;let e=At(),n=K4().positionX;hp=r;function r(a){a=e.asNonCompoundGraph(a),l(a),Object.entries(n(a)).forEach(([s,u])=>a.node(s).x=u)}function l(a){let s=e.buildLayerMatrix(a),u=a.graph().ranksep,c=0;s.forEach(d=>{const h=d.reduce((m,p)=>{const x=a.node(p).height;return m>x?m:x},0);d.forEach(m=>a.node(m).y=c+h/2),c+=h+u})}return hp}var pp,tb;function W4(){if(tb)return pp;tb=1;let e=R4(),n=O4(),r=H4(),l=At().normalizeRanks,a=B4(),s=At().removeEmptyRanks,u=I4(),c=q4(),d=U4(),h=Z4(),m=J4(),p=At(),x=Fn().Graph;pp=v;function v(N,G){let X=G&&G.debugTiming?p.time:p.notime;X("layout",()=>{let J=X(" buildLayoutGraph",()=>R(N));X(" runLayout",()=>w(J,X,G)),X(" updateInputGraph",()=>k(N,J))})}function w(N,G,X){G(" makeSpaceForEdgeLabels",()=>V(N)),G(" removeSelfEdges",()=>Q(N)),G(" acyclic",()=>e.run(N)),G(" nestingGraph.run",()=>u.run(N)),G(" rank",()=>r(p.asNonCompoundGraph(N))),G(" injectEdgeLabelProxies",()=>O(N)),G(" removeEmptyRanks",()=>s(N)),G(" nestingGraph.cleanup",()=>u.cleanup(N)),G(" normalizeRanks",()=>l(N)),G(" assignRankMinMax",()=>L(N)),G(" removeEdgeLabelProxies",()=>q(N)),G(" normalize.run",()=>n.run(N)),G(" parentDummyChains",()=>a(N)),G(" addBorderSegments",()=>c(N)),G(" order",()=>h(N,X)),G(" insertSelfEdges",()=>K(N)),G(" adjustCoordinateSystem",()=>d.adjust(N)),G(" position",()=>m(N)),G(" positionSelfEdges",()=>j(N)),G(" removeBorderNodes",()=>Y(N)),G(" normalize.undo",()=>n.undo(N)),G(" fixupEdgeLabelCoords",()=>$(N)),G(" undoCoordinateSystem",()=>d.undo(N)),G(" translateGraph",()=>ee(N)),G(" assignNodeIntersects",()=>B(N)),G(" reversePoints",()=>M(N)),G(" acyclic.undo",()=>e.undo(N))}function k(N,G){N.nodes().forEach(X=>{let J=N.node(X),ne=G.node(X);J&&(J.x=ne.x,J.y=ne.y,J.rank=ne.rank,G.children(X).length&&(J.width=ne.width,J.height=ne.height))}),N.edges().forEach(X=>{let J=N.edge(X),ne=G.edge(X);J.points=ne.points,Object.hasOwn(ne,"x")&&(J.x=ne.x,J.y=ne.y)}),N.graph().width=G.graph().width,N.graph().height=G.graph().height}let _=["nodesep","edgesep","ranksep","marginx","marginy"],S={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},T=["acyclicer","ranker","rankdir","align"],E=["width","height","rank"],A={width:0,height:0},U=["minlen","weight","width","height","labeloffset"],z={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},H=["labelpos"];function R(N){let G=new x({multigraph:!0,compound:!0}),X=F(N.graph());return G.setGraph(Object.assign({},S,I(X,_),p.pick(X,T))),N.nodes().forEach(J=>{let ne=F(N.node(J));const re=I(ne,E);Object.keys(A).forEach(se=>{re[se]===void 0&&(re[se]=A[se])}),G.setNode(J,re),G.setParent(J,N.parent(J))}),N.edges().forEach(J=>{let ne=F(N.edge(J));G.setEdge(J,Object.assign({},z,I(ne,U),p.pick(ne,H)))}),G}function V(N){let G=N.graph();G.ranksep/=2,N.edges().forEach(X=>{let J=N.edge(X);J.minlen*=2,J.labelpos.toLowerCase()!=="c"&&(G.rankdir==="TB"||G.rankdir==="BT"?J.width+=J.labeloffset:J.height+=J.labeloffset)})}function O(N){N.edges().forEach(G=>{let X=N.edge(G);if(X.width&&X.height){let J=N.node(G.v),re={rank:(N.node(G.w).rank-J.rank)/2+J.rank,e:G};p.addDummyNode(N,"edge-proxy",re,"_ep")}})}function L(N){let G=0;N.nodes().forEach(X=>{let J=N.node(X);J.borderTop&&(J.minRank=N.node(J.borderTop).rank,J.maxRank=N.node(J.borderBottom).rank,G=Math.max(G,J.maxRank))}),N.graph().maxRank=G}function q(N){N.nodes().forEach(G=>{let X=N.node(G);X.dummy==="edge-proxy"&&(N.edge(X.e).labelRank=X.rank,N.removeNode(G))})}function ee(N){let G=Number.POSITIVE_INFINITY,X=0,J=Number.POSITIVE_INFINITY,ne=0,re=N.graph(),se=re.marginx||0,xe=re.marginy||0;function ve(ye){let pe=ye.x,_e=ye.y,Me=ye.width,Te=ye.height;G=Math.min(G,pe-Me/2),X=Math.max(X,pe+Me/2),J=Math.min(J,_e-Te/2),ne=Math.max(ne,_e+Te/2)}N.nodes().forEach(ye=>ve(N.node(ye))),N.edges().forEach(ye=>{let pe=N.edge(ye);Object.hasOwn(pe,"x")&&ve(pe)}),G-=se,J-=xe,N.nodes().forEach(ye=>{let pe=N.node(ye);pe.x-=G,pe.y-=J}),N.edges().forEach(ye=>{let pe=N.edge(ye);pe.points.forEach(_e=>{_e.x-=G,_e.y-=J}),Object.hasOwn(pe,"x")&&(pe.x-=G),Object.hasOwn(pe,"y")&&(pe.y-=J)}),re.width=X-G+se,re.height=ne-J+xe}function B(N){N.edges().forEach(G=>{let X=N.edge(G),J=N.node(G.v),ne=N.node(G.w),re,se;X.points?(re=X.points[0],se=X.points[X.points.length-1]):(X.points=[],re=ne,se=J),X.points.unshift(p.intersectRect(J,re)),X.points.push(p.intersectRect(ne,se))})}function $(N){N.edges().forEach(G=>{let X=N.edge(G);if(Object.hasOwn(X,"x"))switch((X.labelpos==="l"||X.labelpos==="r")&&(X.width-=X.labeloffset),X.labelpos){case"l":X.x-=X.width/2+X.labeloffset;break;case"r":X.x+=X.width/2+X.labeloffset;break}})}function M(N){N.edges().forEach(G=>{let X=N.edge(G);X.reversed&&X.points.reverse()})}function Y(N){N.nodes().forEach(G=>{if(N.children(G).length){let X=N.node(G),J=N.node(X.borderTop),ne=N.node(X.borderBottom),re=N.node(X.borderLeft[X.borderLeft.length-1]),se=N.node(X.borderRight[X.borderRight.length-1]);X.width=Math.abs(se.x-re.x),X.height=Math.abs(ne.y-J.y),X.x=re.x+X.width/2,X.y=J.y+X.height/2}}),N.nodes().forEach(G=>{N.node(G).dummy==="border"&&N.removeNode(G)})}function Q(N){N.edges().forEach(G=>{if(G.v===G.w){var X=N.node(G.v);X.selfEdges||(X.selfEdges=[]),X.selfEdges.push({e:G,label:N.edge(G)}),N.removeEdge(G)}})}function K(N){var G=p.buildLayerMatrix(N);G.forEach(X=>{var J=0;X.forEach((ne,re)=>{var se=N.node(ne);se.order=re+J,(se.selfEdges||[]).forEach(xe=>{p.addDummyNode(N,"selfedge",{width:xe.label.width,height:xe.label.height,rank:se.rank,order:re+ ++J,e:xe.e,label:xe.label},"_se")}),delete se.selfEdges})})}function j(N){N.nodes().forEach(G=>{var X=N.node(G);if(X.dummy==="selfedge"){var J=N.node(X.e.v),ne=J.x+J.width/2,re=J.y,se=X.x-ne,xe=J.height/2;N.setEdge(X.e,X.label),N.removeNode(G),X.label.points=[{x:ne+2*se/3,y:re-xe},{x:ne+5*se/6,y:re-xe},{x:ne+se,y:re},{x:ne+5*se/6,y:re+xe},{x:ne+2*se/3,y:re+xe}],X.label.x=X.x,X.label.y=X.y}})}function I(N,G){return p.mapValues(p.pick(N,G),Number)}function F(N){var G={};return N&&Object.entries(N).forEach(([X,J])=>{typeof X=="string"&&(X=X.toLowerCase()),G[X]=J}),G}return pp}var mp,nb;function e5(){if(nb)return mp;nb=1;let e=At(),n=Fn().Graph;mp={debugOrdering:r};function r(l){let a=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)),a.forEach((u,c)=>{let d="layer"+c;s.setNode(d,{rank:"same"}),u.reduce((h,m)=>(s.setEdge(h,m,{style:"invis"}),m))}),s}return mp}var gp,rb;function t5(){return rb||(rb=1,gp="1.1.8"),gp}var xp,ib;function n5(){return ib||(ib=1,xp={graphlib:Fn(),layout:W4(),debug:e5(),util:{time:At().time,notime:At().notime},version:t5()}),xp}var r5=n5();const lb=Fo(r5),Co=200,na=56,ab=20,ob=40,i5=20,sb=12;function l5(e,n,r,l,a,s,u){const c=[],d=[],h=new Set,m=new Set,p=new Map;for(const w of r)for(const k of w.agents)m.add(k),p.set(k,w.name);for(const w of r){const k=a[w.name],_=w.agents.length,S=Co+ab*2,T=ob+_*na+(_-1)*sb+i5;c.push({id:w.name,type:"groupNode",position:{x:0,y:0},data:{label:w.name,type:"parallel_group",status:(k==null?void 0:k.status)||"pending",groupName:w.name,progress:s[w.name]},style:{width:S,height:T}});for(let E=0;E$entryPoint",source:"$start",target:u,type:"animatedEdge",data:{},animated:!1})}const v=new Set(c.map(w=>w.id));for(const w of n)!v.has(w.from)||!v.has(w.to)||d.push({id:`${w.from}->${w.to}`,source:w.from,target:w.to,type:"animatedEdge",data:{when:w.when},animated:!1});return a5(c,d),{nodes:c,edges:d}}function a5(e,n){var l,a,s,u;const r=new lb.graphlib.Graph;r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:"TB",nodesep:50,ranksep:70,marginx:30,marginy:30});for(const c of e){if(c.parentId)continue;const d=c.type==="groupNode",h=d&&((l=c.style)==null?void 0:l.width)||Co,m=d&&((a=c.style)==null?void 0:a.height)||na;r.setNode(c.id,{width:h,height:m})}for(const c of n)r.hasNode(c.source)&&r.hasNode(c.target)&&r.setEdge(c.source,c.target);lb.layout(r);for(const c of e){if(c.parentId)continue;const d=r.node(c.id);if(!d)continue;const h=c.type==="groupNode",m=h&&((s=c.style)==null?void 0:s.width)||Co,p=h&&((u=c.style)==null?void 0:u.height)||na;c.position={x:d.x-m/2,y:d.y-p/2}}}const Xe={pending:"#6b7280",running:"#3b82f6",completed:"#22c55e",failed:"#ef4444",paused:"#f59e0b",idle:"#6b7280",waiting:"#a855f7"},o5=70,ub=90;function Lc({data:e,children:n}){const[r,l]=P.useState(!1),a=P.useRef(null),s=P.useCallback(()=>{a.current=setTimeout(()=>l(!0),200)},[]),u=P.useCallback(()=>{a.current&&clearTimeout(a.current),l(!1)},[]),c=Xe[e.status]||Xe.pending;return b.jsxs("div",{className:"relative",onMouseEnter:s,onMouseLeave:u,children:[n,r&&b.jsxs("div",{className:Be("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:c}}),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:Jt(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:[$n(e.tokens),e.inputTokens!=null&&e.outputTokens!=null&&b.jsxs("span",{className:"text-[var(--text-muted)]",children:[" ","(",$n(e.inputTokens),"↑ ",$n(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:yi(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:Be("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 s5=P.memo(function({data:n,id:r,selected:l}){var H;const a=n,s=il(),c=((H=s[r])==null?void 0:H.status)||a.status||"pending",d=Xe[c]||Xe.pending,h=s[r],m=h==null?void 0:h.elapsed,p=h==null?void 0:h.model,x=h==null?void 0:h.tokens,v=h==null?void 0:h.input_tokens,w=h==null?void 0:h.output_tokens,k=h==null?void 0:h.cost_usd,_=h==null?void 0:h.iteration,S=h==null?void 0:h.error_type,T=h==null?void 0:h.error_message,E=h==null?void 0:h.context_pct,A=u5(r,c),U=c5(c),z=(()=>{if(c==="failed"&&T)return{text:T.length>40?T.slice(0,37)+"...":T,className:"text-red-400"};if(c==="running")return{text:A,className:"text-[var(--text-muted)]"};if(c==="completed"){const R=[];return m!=null&&R.push(Jt(m)),x!=null&&R.push(`${$n(x)} tok`),k!=null&&R.push(yi(k)),{text:R.join(" · ")||null,className:"text-[var(--text-muted)]"}}return{text:null,className:""}})();return b.jsxs(b.Fragment,{children:[b.jsx(Ft,{type:"target",position:be.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx(Lc,{data:{status:c,elapsed:m,model:p,tokens:x,inputTokens:v,outputTokens:w,costUsd:k,iteration:_,errorType:S,errorMessage:T},children:b.jsxs("div",{className:Be("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)]",c==="running"&&"shadow-[0_0_12px_var(--running-glow)]",U),style:{borderColor:d},children:[b.jsx("div",{className:Be("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",c==="running"&&"animate-pulse"),style:{backgroundColor:`${d}20`},children:b.jsx(X2,{className:"w-3.5 h-3.5",style:{color:d}})}),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:a.label}),_!=null&&_>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:`${d}25`,color:d},children:["x",_]})]}),z.text&&b.jsx("span",{className:Be("text-[10px] truncate leading-tight",z.className),children:z.text})]}),E!=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:Be("h-full transition-all duration-500",E>=ub?"animate-[context-pulse_2s_ease-in-out_infinite]":""),style:{width:`${Math.min(E,100)}%`,backgroundColor:E>=ub?"#ef4444":E>=o5?"#f59e0b":"#22c55e"}})})]})}),b.jsx(Ft,{type:"source",position:be.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function u5(e,n){var d;const r=(d=il()[e])==null?void 0:d.startedAt,l=he(h=>h.replayMode),a=he(h=>h.lastEventTime),[s,u]=P.useState("0.0s"),c=P.useRef(null);return P.useEffect(()=>{if(n==="running"){if(l){c.current&&clearInterval(c.current);const p=r??a??0;u(Jt((a??p)-p));return}const h=r!=null?r*1e3:Date.now(),m=()=>{const p=(Date.now()-h)/1e3;u(Jt(p))};return m(),c.current=setInterval(m,1e3),()=>{c.current&&clearInterval(c.current)}}else c.current&&clearInterval(c.current)},[n,r,l,a]),s}function c5(e){const n=P.useRef(e),[r,l]=P.useState("");return P.useEffect(()=>{const a=n.current;if(n.current=e,a===e)return;e==="running"?l("node-activate"):a==="running"&&(e==="completed"||e==="failed")&&l(e==="completed"?"node-complete":"node-fail");const s=setTimeout(()=>l(""),400);return()=>clearTimeout(s)},[e]),r}const f5=P.memo(function({data:n,id:r,selected:l}){var S;const a=n,s=il(),c=((S=s[r])==null?void 0:S.status)||a.status||"pending",d=Xe[c]||Xe.pending,h=s[r],m=h==null?void 0:h.elapsed,p=h==null?void 0:h.exit_code,x=h==null?void 0:h.error_type,v=h==null?void 0:h.error_message,w=d5(r,c),k=h5(c),_=(()=>{if(c==="failed"&&v)return{text:v.length>40?v.slice(0,37)+"...":v,className:"text-red-400"};if(c==="running")return{text:w,className:"text-[var(--text-muted)]"};if(c==="completed"){const T=[];return m!=null&&T.push(Jt(m)),p!=null&&T.push(`exit ${p}`),{text:T.join(" · ")||null,className:"text-[var(--text-muted)]"}}return{text:null,className:""}})();return b.jsxs(b.Fragment,{children:[b.jsx(Ft,{type:"target",position:be.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx(Lc,{data:{status:c,elapsed:m,exitCode:p,errorType:x,errorMessage:v},children:b.jsxs("div",{className:Be("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)]",c==="running"&&"shadow-[0_0_12px_var(--running-glow)]",k),style:{borderColor:d},children:[b.jsx("div",{className:Be("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",c==="running"&&"animate-pulse"),style:{backgroundColor:`${d}20`},children:b.jsx(cN,{className:"w-3.5 h-3.5",style:{color:d}})}),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:a.label}),_.text&&b.jsx("span",{className:Be("text-[10px] truncate leading-tight",_.className),children:_.text})]})]})}),b.jsx(Ft,{type:"source",position:be.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function d5(e,n){var d;const r=(d=il()[e])==null?void 0:d.startedAt,l=he(h=>h.replayMode),a=he(h=>h.lastEventTime),[s,u]=P.useState("0.0s"),c=P.useRef(null);return P.useEffect(()=>{if(n==="running"){if(l){c.current&&clearInterval(c.current);const p=r??a??0;u(Jt((a??p)-p));return}const h=r!=null?r*1e3:Date.now(),m=()=>{const p=(Date.now()-h)/1e3;u(Jt(p))};return m(),c.current=setInterval(m,1e3),()=>{c.current&&clearInterval(c.current)}}else c.current&&clearInterval(c.current)},[n,r,l,a]),s}function h5(e){const n=P.useRef(e),[r,l]=P.useState("");return P.useEffect(()=>{const a=n.current;if(n.current=e,a===e)return;e==="running"?l("node-activate"):a==="running"&&(e==="completed"||e==="failed")&&l(e==="completed"?"node-complete":"node-fail");const s=setTimeout(()=>l(""),400);return()=>clearTimeout(s)},[e]),r}const p5=P.memo(function({data:n,id:r,selected:l}){var p,x;const a=n,s=il(),c=((p=s[r])==null?void 0:p.status)||a.status||"pending",d=Xe[c]||Xe.pending,h=(x=s[r])==null?void 0:x.selected_option,m=m5(c);return b.jsxs(b.Fragment,{children:[b.jsx(Ft,{type:"target",position:be.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx(Lc,{data:{status:c,selectedOption:h},children:b.jsxs("div",{className:Be("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)]",c==="waiting"&&"shadow-[0_0_12px_var(--waiting-muted)]",c==="running"&&"shadow-[0_0_12px_var(--running-glow)]",m),style:{borderColor:d},children:[b.jsx("div",{className:Be("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",c==="waiting"&&"animate-pulse"),style:{backgroundColor:`${d}20`},children:b.jsx(uN,{className:"w-3.5 h-3.5",style:{color:d}})}),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:a.label}),c==="waiting"&&b.jsx("span",{className:"text-[10px] text-[var(--waiting)] truncate leading-tight",children:"Awaiting input..."}),c==="completed"&&h&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] truncate leading-tight",children:h})]})]})}),b.jsx(Ft,{type:"source",position:be.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function m5(e){const n=P.useRef(e),[r,l]=P.useState("");return P.useEffect(()=>{const a=n.current;if(n.current=e,a===e)return;e==="running"||e==="waiting"?l("node-activate"):(a==="running"||a==="waiting")&&e==="completed"&&l("node-complete");const s=setTimeout(()=>l(""),400);return()=>clearTimeout(s)},[e]),r}const g5=P.memo(function({data:n,id:r,selected:l}){var _;const a=n,u=a.type==="for_each_group"?aN:rN,c=a.progress,m=((_=il()[r])==null?void 0:_.status)||a.status||"pending",p=Xe[m]||Xe.pending,x=x5(m),v=c?`${c.completed+c.failed}/${c.total}${c.failed>0?` (${c.failed} failed)`:""}`:null,w=c&&c.total>0?(c.completed+c.failed)/c.total*100:0,k=c!=null&&c.failed>0;return b.jsxs(b.Fragment,{children:[b.jsx(Ft,{type:"target",position:be.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsxs("div",{className:Be("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)]",m==="running"&&"shadow-[0_0_16px_var(--running-glow)]",x),style:{borderColor:p,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:p}}),b.jsx("span",{className:"text-xs font-medium text-[var(--text-secondary)]",children:a.label})]}),v&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] font-mono",children:v}),c&&c.total>0&&m==="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:`${w}%`,backgroundColor:k?"var(--failed)":"var(--completed)"}})})]}),b.jsx(Ft,{type:"source",position:be.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function x5(e){const n=P.useRef(e),[r,l]=P.useState("");return P.useEffect(()=>{const a=n.current;if(n.current=e,a===e)return;e==="running"?l("node-activate"):a==="running"&&(e==="completed"||e==="failed")&&l(e==="completed"?"node-complete":"node-fail");const s=setTimeout(()=>l(""),400);return()=>clearTimeout(s)},[e]),r}const y5=P.memo(function({data:n,id:r,selected:l}){const a=n,u=he(_=>{var S;return(S=_.nodes[r])==null?void 0:S.status})||a.status||"pending",c=Xe[u]||Xe.pending,d=he(_=>{var S;return(S=_.nodes[r])==null?void 0:S.elapsed}),h=he(_=>{var S;return(S=_.nodes[r])==null?void 0:S.error_message}),m=he(_=>_.navigateIntoSubworkflow),p=p_(),x=p.some(_=>_.parentAgent===r),v=p.find(_=>_.parentAgent===r),w=v==null?void 0:v.workflowName,k=(()=>{if(u==="failed"&&h)return{text:h.length>35?h.slice(0,32)+"...":h,className:"text-red-400"};if(u==="running")return{text:w||"Running subworkflow…",className:"text-[var(--text-muted)]"};if(u==="completed"){const _=[];return w&&_.push(w),d!=null&&_.push(`${d.toFixed(1)}s`),{text:_.join(" · ")||"Done",className:"text-[var(--text-muted)]"}}return{text:w||null,className:"text-[var(--text-muted)]"}})();return b.jsxs(b.Fragment,{children:[b.jsx(Ft,{type:"target",position:be.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx(Lc,{data:{status:u,elapsed:d,errorType:void 0,errorMessage:h,iteration:void 0},children:b.jsxs("div",{className:Be("flex items-center gap-2 px-3 py-1.5 rounded-lg border-2 bg-[var(--node-bg)] min-w-[140px] max-w-[240px] transition-all duration-300 cursor-pointer",l&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]",u==="running"&&"shadow-[0_0_12px_var(--running-glow)]"),style:{borderColor:c,borderStyle:"dashed"},onDoubleClick:_=>{x&&(_.stopPropagation(),m(r))},children:[b.jsx("div",{className:Be("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",u==="running"&&"animate-pulse"),style:{backgroundColor:`${c}20`},children:b.jsx(fm,{className:"w-3.5 h-3.5",style:{color:c}})}),b.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[b.jsx("div",{className:"flex items-center gap-1",children:b.jsx("span",{className:"text-xs font-medium text-[var(--text)] truncate",children:a.label})}),k.text&&b.jsx("span",{className:Be("text-[10px] truncate leading-tight",k.className),children:k.text})]}),x&&b.jsx(Dr,{className:"w-3.5 h-3.5 flex-shrink-0 text-[var(--text-muted)]"})]})}),b.jsx(Ft,{type:"source",position:be.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})}),v5=P.memo(function({data:n,selected:r}){const a=n.status||"pending",s=a==="completed",u=a==="failed",c=!s&&!u,d=s?Xe.completed:u?Xe.failed:Xe.pending;return b.jsxs(b.Fragment,{children:[b.jsx(Ft,{type:"target",position:be.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx("div",{className:Be("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)]",r&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]"),style:{borderColor:d},children:s?b.jsx(Yi,{className:"w-5 h-5 text-white",strokeWidth:3}):u?b.jsx(sw,{className:"w-3.5 h-3.5 text-white",fill:"white"}):b.jsx(Yi,{className:"w-5 h-5",strokeWidth:2.5,style:{color:c?Xe.pending:d}})})]})}),b5=P.memo(function({data:n,selected:r}){const a=n.status||"pending",s=Xe[a]||Xe.pending,u=a==="running"||a==="completed";return b.jsxs(b.Fragment,{children:[b.jsx("div",{className:Be("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)]",r&&"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(dm,{className:"w-4 h-4 ml-0.5",style:{color:u?"white":s}})}),b.jsx(Ft,{type:"source",position:be.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})}),w5=P.memo(function({id:n,sourceX:r,sourceY:l,targetX:a,targetY:s,sourcePosition:u,targetPosition:c,source:d,target:h,data:m}){const p=m4(),x=P.useMemo(()=>p.find(V=>V.from===d&&V.to===h),[p,d,h]),[v,w,k]=Tm({sourceX:r,sourceY:l,targetX:a,targetY:s,sourcePosition:u,targetPosition:c}),_=m==null?void 0:m.when,S=!!_,T=(x==null?void 0:x.state)==="taken",E=(x==null?void 0:x.state)==="highlighted",A=(x==null?void 0:x.state)==="failed";let U="var(--edge-color)",z=2,H;A?(U="var(--failed)",z=3):T?(U="var(--edge-taken)",z=3):E&&(U="var(--edge-active)",z=3),S&&!T&&!E&&!A&&(H="6 3");const R=A?"failed":T?"taken":E?"active":"default";return b.jsxs(b.Fragment,{children:[b.jsx(ns,{id:n,path:v,style:{stroke:U,strokeWidth:z,strokeDasharray:H,transition:"stroke 0.3s ease, stroke-width 0.3s ease"},markerEnd:`url(#arrow-${R})`}),S&&b.jsx(Hj,{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)":T?"var(--edge-taken)":"var(--surface)",color:A||T?"var(--bg)":"var(--text-muted)",border:`1px solid ${A?"var(--failed)":T?"var(--edge-taken)":"var(--border)"}`},title:_,children:_})})}),T&&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 S5(){const e=he(u=>u.workflowStatus),n=he(u=>u.workflowFailure),r=he(u=>u.workflowFailedAgent),l=he(u=>u.selectNode);if(e!=="failed"||!n)return null;const a=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:Be("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(fN,{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:a}),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()]})]}),r&&b.jsxs("button",{onClick:()=>l(r),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 _5(){const[e,n]=P.useState(!1),r=he(d=>d.workflowStatus),l=he(d=>d.totalCost),a=he(d=>d.totalTokens),s=he(d=>d.agentsCompleted),u=he(d=>d.agentsTotal),c=cw();return r!=="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:Be("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(Z2,{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:c}),u>0&&b.jsxs("span",{children:[s,"/",u," agents"]}),a>0&&b.jsxs("span",{children:[$n(a)," tok"]}),l>0&&b.jsx("span",{children:yi(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(Qo,{className:"w-3.5 h-3.5"})})]})})}const E5={agentNode:s5,scriptNode:f5,gateNode:p5,groupNode:g5,workflowNode:y5,endNode:v5,startNode:b5},k5={animatedEdge:w5},N5={type:"animatedEdge"};function C5(){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 T5(){const e=g4(),n=he($=>$.viewContextPath),r=he($=>$.selectNode),l=he($=>$.selectedNode),a=he($=>$.workflowStatus),s=he($=>$.wsStatus),u=he($=>$.workflowFailedAgent),c=he($=>$.navigateIntoSubworkflow),{agents:d,routes:h,parallelGroups:m,forEachGroups:p,nodes:x,groupProgress:v,entryPoint:w,subworkflowContexts:k}=e,[_,S,T]=Bj([]),[E,A,U]=Ij([]),z=P.useRef(!1),H=P.useRef(""),R=JSON.stringify(n);P.useEffect(()=>{if(d.length===0){H.current!==R&&(z.current=!1,H.current=R,S([]),A([]));return}if(H.current!==R&&(z.current=!1,H.current=R),z.current)return;z.current=!0;const{nodes:$,edges:M}=l5(d,h,m,p,x,v,w);S($),A(M)},[d,h,m,p,x,v,w,S,A,R]),P.useEffect(()=>{z.current&&S($=>$.map(M=>{const Y=x[M.id];if(!Y)return M;const Q=Y.status||"pending",K=M.data.status;if(Q!==K){const j={...M.data,status:Q};return M.data.groupName&&v[M.data.groupName]&&(j.progress=v[M.data.groupName]),{...M,data:j}}if(M.data.groupName&&v[M.data.groupName]){const j=M.data.progress,I=v[M.data.groupName];if(I&&(!j||j.completed!==I.completed||j.failed!==I.failed))return{...M,data:{...M.data,progress:I}}}return M}))},[x,v,S]);const V=P.useCallback(($,M)=>{M.type==="groupNode"&&M.data.type!=="for_each_group"||r(M.id)},[r]),O=P.useCallback(($,M)=>{k.some(Q=>Q.parentAgent===M.id)&&c(M.id)},[k,c]),L=P.useCallback(()=>{r(null)},[r]),q=P.useCallback($=>{var Y;const M=((Y=$.data)==null?void 0:Y.status)||"pending";return Xe[M]||Xe.pending},[]);P.useEffect(()=>{S($=>$.map(M=>({...M,selected:M.id===l})))},[l,S]),P.useEffect(()=>{a==="failed"&&u&&r(u)},[a,u,r]);const ee=a==="pending"&&d.length===0,B=(()=>{switch(s){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(C5,{}),b.jsx(S5,{}),b.jsx(_5,{}),ee&&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(pN,{className:"w-8 h-8 text-[var(--accent)] opacity-20"}),b.jsx(Do,{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:B})]}),b.jsxs(Oj,{nodes:_,edges:E,onNodesChange:T,onEdgesChange:U,onNodeClick:V,onNodeDoubleClick:O,onPaneClick:L,nodeTypes:E5,edgeTypes:k5,defaultEdgeOptions:N5,fitView:!0,fitViewOptions:{padding:.2},minZoom:.2,maxZoom:2,proOptions:{hideAttribution:!0},nodesDraggable:!0,nodesConnectable:!1,elementsSelectable:!0,children:[b.jsx($j,{variant:Mr.Dots,gap:20,size:1,color:"var(--border-subtle)"}),b.jsx(c4,{nodeColor:q,maskColor:"var(--minimap-mask)",style:{background:"var(--minimap-bg)"},pannable:!0,zoomable:!0}),b.jsx(Kj,{showInteractive:!1,children:b.jsx(A5,{})}),b.jsx(z5,{}),b.jsx(M5,{})]})]})}function A5(){const{fitView:e}=ma(),n=P.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 z5(){const{fitView:e}=ma();return P.useEffect(()=>{const n=r=>{var a;const l=(a=r.target)==null?void 0:a.tagName;l==="INPUT"||l==="TEXTAREA"||l==="SELECT"||r.key==="f"&&!r.ctrlKey&&!r.metaKey&&!r.altKey&&e({padding:.2,duration:300})};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e]),null}function M5(){const e=v4();return e?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:"flex items-center gap-2 px-4 py-2 rounded-lg bg-amber-950/90 border border-amber-500/40 shadow-lg shadow-amber-500/10 backdrop-blur-sm max-w-[560px]",children:[b.jsx("span",{className:"text-xs text-amber-300",children:"⚠"}),b.jsx("span",{className:"text-[11px] text-amber-400/80",children:e.message}),b.jsx("a",{href:window.location.pathname,className:"px-2 py-0.5 rounded text-[10px] font-medium text-amber-300 bg-amber-500/20 hover:bg-amber-500/30 transition-colors flex-shrink-0 ml-1",children:"Root"})]})}):null}function ll({items:e}){const n=e.filter(r=>r.value!=null&&r.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:r,value:l})=>b.jsxs("div",{className:"contents",children:[b.jsx("dt",{className:"text-[var(--text-muted)] whitespace-nowrap",children:r}),b.jsx("dd",{className:"text-[var(--text)] break-words",children:typeof l=="object"?JSON.stringify(l):String(l)})]},r))})}function w_(e){const n=[];return e.elapsed!=null&&n.push({label:"Elapsed",value:Jt(e.elapsed)}),e.model&&n.push({label:"Model",value:e.model}),e.tokens!=null&&n.push({label:"Tokens",value:$n(e.tokens)}),e.input_tokens!=null&&e.output_tokens!=null&&n.push({label:"In / Out",value:`${$n(e.input_tokens)} / ${$n(e.output_tokens)}`}),e.cost_usd!=null&&n.push({label:"Cost",value:yi(e.cost_usd)}),e.context_window_used!=null&&e.context_window_max!=null&&n.push({label:"Context",value:NN(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 tl({output:e,title:n="Output",defaultExpanded:r=!0,maxHeight:l="300px"}){const[a,s]=P.useState(r),[u,c]=P.useState(!1),d=uw(e);if(!d)return null;const h=typeof e=="object"&&e!==null,m=async()=>{await navigator.clipboard.writeText(d),c(!0),setTimeout(()=>c(!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(!a),className:"flex items-center gap-1 text-[10px] uppercase tracking-wider text-[var(--text-muted)] hover:text-[var(--text)] transition-colors font-semibold",children:[a?b.jsx(rl,{className:"w-3 h-3"}):b.jsx(Dr,{className:"w-3 h-3"}),n]}),a&&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(Yi,{className:"w-3 h-3 text-[var(--completed)]"}):b.jsx(aw,{className:"w-3 h-3"})})]}),a&&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(j5,{text:d}):d})]})}function j5({text:e}){const n=e.split(/("(?:[^"\\]|\\.)*")/g);return b.jsx(b.Fragment,{children:n.map((r,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:r},l)}const a=r.replace(/\b(true|false|null)\b|(-?\d+\.?\d*(?:e[+-]?\d+)?)/gi,(s,u,c)=>u?`${s}`:c?`${s}`:s);return b.jsx("span",{dangerouslySetInnerHTML:{__html:a}},l)})})}function Lm({activity:e,defaultExpanded:n=!0}){const[r,l]=P.useState(n),a=P.useRef(null);return P.useEffect(()=>{a.current&&r&&(a.current.scrollTop=a.current.scrollHeight)},[e.length,r]),e.length===0?null:b.jsxs("div",{className:"space-y-1.5",children:[b.jsxs("button",{onClick:()=>l(!r),className:"flex items-center gap-1 text-[10px] uppercase tracking-wider text-[var(--text-muted)] hover:text-[var(--text)] transition-colors font-semibold",children:[r?b.jsx(rl,{className:"w-3 h-3"}):b.jsx(Dr,{className:"w-3 h-3"}),"Activity (",e.length,")"]}),r&&b.jsx("div",{ref:a,className:"max-h-[400px] overflow-y-auto space-y-0.5",children:e.map((s,u)=>b.jsx(D5,{entry:s},u))})]})}function D5({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:Be("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:Be("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 R5({node:e}){const n=e.status,r=Xe[n]||Xe.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:`${r}20`,color:r},children:n}),b.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Agent"})]}),l?b.jsx(cb,{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(ll,{items:w_(e)}),e.prompt&&b.jsx(tl,{output:e.prompt,title:"Input / Prompt",defaultExpanded:!0}),b.jsx(Lm,{activity:e.activity,defaultExpanded:n!=="completed"}),e.output!=null&&b.jsx(tl,{output:e.output,title:"Output"})]}),l&&[...e.iterationHistory].reverse().map(a=>b.jsx(cb,{label:`Iteration ${a.iteration}`,defaultExpanded:!1,status:n,snapshot:a},a.iteration))]})}function cb({label:e,defaultExpanded:n,snapshot:r,status:l}){const[a,s]=P.useState(n);return b.jsxs("div",{className:"border border-[var(--border)] rounded-lg overflow-hidden",children:[b.jsxs("button",{onClick:()=>s(!a),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:[a?b.jsx(rl,{className:"w-3.5 h-3.5 text-[var(--text-muted)] flex-shrink-0"}):b.jsx(Dr,{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}),r.elapsed!=null&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] ml-auto",children:O5(r.elapsed)})]}),a&&b.jsxs("div",{className:"px-3 py-3 space-y-3 border-t border-[var(--border)]",children:[b.jsx(ll,{items:w_(r)}),r.prompt&&b.jsx(tl,{output:r.prompt,title:"Input / Prompt",defaultExpanded:!1}),b.jsx(Lm,{activity:r.activity,defaultExpanded:n&&l!=="completed"}),r.output!=null&&b.jsx(tl,{output:r.output,title:"Output",defaultExpanded:!0}),r.error_type&&b.jsxs("div",{className:"text-xs text-red-400",children:[b.jsx("span",{className:"font-semibold",children:r.error_type}),r.error_message&&b.jsxs("span",{className:"ml-1",children:["— ",r.error_message]})]})]})]})}function O5(e){if(e<1)return`${(e*1e3).toFixed(0)}ms`;if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e/60),r=(e%60).toFixed(0);return`${n}m ${r}s`}function L5({node:e}){const n=e.status,r=Xe[n]||Xe.pending,l=[];e.elapsed!=null&&l.push({label:"Elapsed",value:Jt(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 a="";return e.stdout&&(a+=e.stdout),e.stderr&&(a+=(a?` + +--- 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:`${r}20`,color:r},children:n}),b.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Script"})]}),b.jsx(ll,{items:l}),a&&b.jsx(tl,{output:a,title:"Output"})]})}function H5(e,n){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const B5=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,I5=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,q5={};function fb(e,n){return(q5.jsx?I5:B5).test(e)}const U5=/[ \t\n\f\r]/g;function V5(e){return typeof e=="object"?e.type==="text"?db(e.value):!1:db(e)}function db(e){return e.replace(U5,"")===""}class is{constructor(n,r,l){this.normal=r,this.property=n,l&&(this.space=l)}}is.prototype.normal={};is.prototype.property={};is.prototype.space=void 0;function S_(e,n){const r={},l={};for(const a of e)Object.assign(r,a.property),Object.assign(l,a.normal);return new is(r,l,n)}function em(e){return e.toLowerCase()}class cn{constructor(n,r){this.attribute=r,this.property=n}}cn.prototype.attribute="";cn.prototype.booleanish=!1;cn.prototype.boolean=!1;cn.prototype.commaOrSpaceSeparated=!1;cn.prototype.commaSeparated=!1;cn.prototype.defined=!1;cn.prototype.mustUseProperty=!1;cn.prototype.number=!1;cn.prototype.overloadedBoolean=!1;cn.prototype.property="";cn.prototype.spaceSeparated=!1;cn.prototype.space=void 0;let P5=0;const De=al(),Tt=al(),tm=al(),me=al(),ut=al(),aa=al(),vn=al();function al(){return 2**++P5}const nm=Object.freeze(Object.defineProperty({__proto__:null,boolean:De,booleanish:Tt,commaOrSpaceSeparated:vn,commaSeparated:aa,number:me,overloadedBoolean:tm,spaceSeparated:ut},Symbol.toStringTag,{value:"Module"})),yp=Object.keys(nm);class Hm extends cn{constructor(n,r,l,a){let s=-1;if(super(n,r),hb(this,"space",a),typeof l=="number")for(;++s4&&r.slice(0,4)==="data"&&X5.test(n)){if(n.charAt(4)==="-"){const s=n.slice(5).replace(pb,K5);l="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=n.slice(4);if(!pb.test(s)){let u=s.replace(F5,Z5);u.charAt(0)!=="-"&&(u="-"+u),n="data"+u}}a=Hm}return new a(l,n)}function Z5(e){return"-"+e.toLowerCase()}function K5(e){return e.charAt(1).toUpperCase()}const J5=S_([__,$5,N_,C_,T_],"html"),Bm=S_([__,G5,N_,C_,T_],"svg");function W5(e){return e.join(" ").trim()}var Xl={},vp,mb;function eD(){if(mb)return vp;mb=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,c=/^\s+|\s+$/g,d=` +`,h="/",m="*",p="",x="comment",v="declaration";function w(_,S){if(typeof _!="string")throw new TypeError("First argument must be a string");if(!_)return[];S=S||{};var T=1,E=1;function A(B){var $=B.match(n);$&&(T+=$.length);var M=B.lastIndexOf(d);E=~M?B.length-M:E+B.length}function U(){var B={line:T,column:E};return function($){return $.position=new z(B),V(),$}}function z(B){this.start=B,this.end={line:T,column:E},this.source=S.source}z.prototype.content=_;function H(B){var $=new Error(S.source+":"+T+":"+E+": "+B);if($.reason=B,$.filename=S.source,$.line=T,$.column=E,$.source=_,!S.silent)throw $}function R(B){var $=B.exec(_);if($){var M=$[0];return A(M),_=_.slice(M.length),$}}function V(){R(r)}function O(B){var $;for(B=B||[];$=L();)$!==!1&&B.push($);return B}function L(){var B=U();if(!(h!=_.charAt(0)||m!=_.charAt(1))){for(var $=2;p!=_.charAt($)&&(m!=_.charAt($)||h!=_.charAt($+1));)++$;if($+=2,p===_.charAt($-1))return H("End of comment missing");var M=_.slice(2,$-2);return E+=2,A(M),_=_.slice($),E+=2,B({type:x,comment:M})}}function q(){var B=U(),$=R(l);if($){if(L(),!R(a))return H("property missing ':'");var M=R(s),Y=B({type:v,property:k($[0].replace(e,p)),value:M?k(M[0].replace(e,p)):p});return R(u),Y}}function ee(){var B=[];O(B);for(var $;$=q();)$!==!1&&(B.push($),O(B));return B}return V(),ee()}function k(_){return _?_.replace(c,p):p}return vp=w,vp}var gb;function tD(){if(gb)return Xl;gb=1;var e=Xl&&Xl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(Xl,"__esModule",{value:!0}),Xl.default=r;const n=e(eD());function r(l,a){let s=null;if(!l||typeof l!="string")return s;const u=(0,n.default)(l),c=typeof a=="function";return u.forEach(d=>{if(d.type!=="declaration")return;const{property:h,value:m}=d;c?a(h,m,d):m&&(s=s||{},s[h]=m)}),s}return Xl}var yo={},xb;function nD(){if(xb)return yo;xb=1,Object.defineProperty(yo,"__esModule",{value:!0}),yo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,s=function(h){return!h||r.test(h)||e.test(h)},u=function(h,m){return m.toUpperCase()},c=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(a,c):h=h.replace(l,c),h.replace(n,u))};return yo.camelCase=d,yo}var vo,yb;function rD(){if(yb)return vo;yb=1;var e=vo&&vo.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},n=e(tD()),r=nD();function l(a,s){var u={};return!a||typeof a!="string"||(0,n.default)(a,function(c,d){c&&d&&(u[(0,r.camelCase)(c,s)]=d)}),u}return l.default=l,vo=l,vo}var iD=rD();const lD=Fo(iD),A_=z_("end"),Im=z_("start");function z_(e){return n;function n(r){const l=r&&r.position&&r.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 aD(e){const n=Im(e),r=A_(e);if(n&&r)return{start:n,end:r}}function zo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?vb(e.position):"start"in e||"end"in e?vb(e):"line"in e||"column"in e?rm(e):""}function rm(e){return bb(e&&e.line)+":"+bb(e&&e.column)}function vb(e){return rm(e&&e.start)+"-"+rm(e&&e.end)}function bb(e){return e&&typeof e=="number"?e:1}class Xt extends Error{constructor(n,r,l){super(),typeof r=="string"&&(l=r,r=void 0);let a="",s={},u=!1;if(r&&("line"in r&&"column"in r?s={place:r}:"start"in r&&"end"in r?s={place:r}:"type"in r?s={ancestors:[r],place:r.position}:s={...r}),typeof n=="string"?a=n:!s.cause&&n&&(u=!0,a=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 c=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=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=c?c.line:void 0,this.name=zo(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}}Xt.prototype.file="";Xt.prototype.name="";Xt.prototype.reason="";Xt.prototype.message="";Xt.prototype.stack="";Xt.prototype.column=void 0;Xt.prototype.line=void 0;Xt.prototype.ancestors=void 0;Xt.prototype.cause=void 0;Xt.prototype.fatal=void 0;Xt.prototype.place=void 0;Xt.prototype.ruleId=void 0;Xt.prototype.source=void 0;const qm={}.hasOwnProperty,oD=new Map,sD=/[A-Z]/g,uD=new Set(["table","tbody","thead","tfoot","tr"]),cD=new Set(["td","th"]),M_="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function fD(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=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=vD(r,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=yD(r,n.jsx,n.jsxs)}const a={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:l,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?Bm:J5,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},s=j_(a,e,void 0);return s&&typeof s!="string"?s:a.create(e,a.Fragment,{children:s||void 0},void 0)}function j_(e,n,r){if(n.type==="element")return dD(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return hD(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return mD(e,n,r);if(n.type==="mdxjsEsm")return pD(e,n);if(n.type==="root")return gD(e,n,r);if(n.type==="text")return xD(e,n)}function dD(e,n,r){const l=e.schema;let a=l;n.tagName.toLowerCase()==="svg"&&l.space==="html"&&(a=Bm,e.schema=a),e.ancestors.push(n);const s=R_(e,n.tagName,!1),u=bD(e,n);let c=Vm(e,n);return uD.has(n.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!V5(d):!0})),D_(e,u,s,n),Um(u,c),e.ancestors.pop(),e.schema=l,e.create(n,s,u,r)}function hD(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)}Go(e,n.position)}function pD(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Go(e,n.position)}function mD(e,n,r){const l=e.schema;let a=l;n.name==="svg"&&l.space==="html"&&(a=Bm,e.schema=a),e.ancestors.push(n);const s=n.name===null?e.Fragment:R_(e,n.name,!0),u=wD(e,n),c=Vm(e,n);return D_(e,u,s,n),Um(u,c),e.ancestors.pop(),e.schema=l,e.create(n,s,u,r)}function gD(e,n,r){const l={};return Um(l,Vm(e,n)),e.create(n,e.Fragment,l,r)}function xD(e,n){return n.value}function D_(e,n,r,l){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=l)}function Um(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function yD(e,n,r){return l;function l(a,s,u,c){const h=Array.isArray(u.children)?r:n;return c?h(s,u,c):h(s,u)}}function vD(e,n){return r;function r(l,a,s,u){const c=Array.isArray(s.children),d=Im(l);return n(a,s,u,c,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function bD(e,n){const r={};let l,a;for(a in n.properties)if(a!=="children"&&qm.call(n.properties,a)){const s=SD(e,a,n.properties[a]);if(s){const[u,c]=s;e.tableCellAlignToStyle&&u==="align"&&typeof c=="string"&&cD.has(n.tagName)?l=c:r[u]=c}}if(l){const s=r.style||(r.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=l}return r}function wD(e,n){const r={};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 c=u.properties[0];c.type,Object.assign(r,e.evaluater.evaluateExpression(c.argument))}else Go(e,n.position);else{const a=l.name;let s;if(l.value&&typeof l.value=="object")if(l.value.data&&l.value.data.estree&&e.evaluater){const c=l.value.data.estree.body[0];c.type,s=e.evaluater.evaluateExpression(c.expression)}else Go(e,n.position);else s=l.value===null?!0:l.value;r[a]=s}return r}function Vm(e,n){const r=[];let l=-1;const a=e.passKeys?new Map:oD;for(;++la?0:a+n:n=n>a?a:n,r=r>0?r:0,l.length<1e4)u=Array.from(l),u.unshift(n,r),e.splice(...u);else for(r&&e.splice(n,r);s0?(Sn(e,e.length,0,n),e):n}const _b={}.hasOwnProperty;function L_(e){const n={};let r=-1;for(;++r13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Yn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Kt=vi(/[A-Za-z]/),Yt=vi(/[\dA-Za-z]/),MD=vi(/[#-'*+\--9=?A-Z^-~]/);function xc(e){return e!==null&&(e<32||e===127)}const im=vi(/\d/),jD=vi(/[\dA-Fa-f]/),DD=vi(/[!-/:-@[-`{-~]/);function ke(e){return e!==null&&e<-2}function ot(e){return e!==null&&(e<0||e===32)}function Ie(e){return e===-2||e===-1||e===32}const Hc=vi(new RegExp("\\p{P}|\\p{S}","u")),nl=vi(/\s/);function vi(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function xa(e){const n=[];let r=-1,l=0,a=0;for(;++r55295&&s<57344){const c=e.charCodeAt(r+1);s<56320&&c>56319&&c<57344?(u=String.fromCharCode(s,c),a=1):u="�"}else u=String.fromCharCode(s);u&&(n.push(e.slice(l,r),encodeURIComponent(u)),l=r+a+1,u=""),a&&(r+=a,a=0)}return n.join("")+e.slice(l)}function Ye(e,n,r,l){const a=l?l-1:Number.POSITIVE_INFINITY;let s=0;return u;function u(d){return Ie(d)?(e.enter(r),c(d)):n(d)}function c(d){return Ie(d)&&s++u))return;const H=n.events.length;let R=H,V,O;for(;R--;)if(n.events[R][0]==="exit"&&n.events[R][1].type==="chunkFlow"){if(V){O=n.events[R][1].end;break}V=!0}for(S(l),z=H;zE;){const U=r[A];n.containerState=U[1],U[0].exit.call(n,e)}r.length=E}function T(){a.write([null]),s=void 0,a=void 0,n.containerState._closeFlow=void 0}}function BD(e,n,r){return Ye(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function pa(e){if(e===null||ot(e)||nl(e))return 1;if(Hc(e))return 2}function Bc(e,n,r){const l=[];let a=-1;for(;++a1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const p={...e[l][1].end},x={...e[r][1].start};kb(p,-d),kb(x,d),u={type:d>1?"strongSequence":"emphasisSequence",start:p,end:{...e[l][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:x},s={type:d>1?"strongText":"emphasisText",start:{...e[l][1].end},end:{...e[r][1].start}},a={type:d>1?"strong":"emphasis",start:{...u.start},end:{...c.end}},e[l][1].end={...u.start},e[r][1].start={...c.end},h=[],e[l][1].end.offset-e[l][1].start.offset&&(h=Dn(h,[["enter",e[l][1],n],["exit",e[l][1],n]])),h=Dn(h,[["enter",a,n],["enter",u,n],["exit",u,n],["enter",s,n]]),h=Dn(h,Bc(n.parser.constructs.insideSpan.null,e.slice(l+1,r),n)),h=Dn(h,[["exit",s,n],["enter",c,n],["exit",c,n],["exit",a,n]]),e[r][1].end.offset-e[r][1].start.offset?(m=2,h=Dn(h,[["enter",e[r][1],n],["exit",e[r][1],n]])):m=0,Sn(e,l-1,r-l+3,h),r=l+h.length-m-2;break}}for(r=-1;++r0&&Ie(z)?Ye(e,T,"linePrefix",s+1)(z):T(z)}function T(z){return z===null||ke(z)?e.check(Nb,k,A)(z):(e.enter("codeFlowValue"),E(z))}function E(z){return z===null||ke(z)?(e.exit("codeFlowValue"),T(z)):(e.consume(z),E)}function A(z){return e.exit("codeFenced"),n(z)}function U(z,H,R){let V=0;return O;function O($){return z.enter("lineEnding"),z.consume($),z.exit("lineEnding"),L}function L($){return z.enter("codeFencedFence"),Ie($)?Ye(z,q,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):q($)}function q($){return $===c?(z.enter("codeFencedFenceSequence"),ee($)):R($)}function ee($){return $===c?(V++,z.consume($),ee):V>=u?(z.exit("codeFencedFenceSequence"),Ie($)?Ye(z,B,"whitespace")($):B($)):R($)}function B($){return $===null||ke($)?(z.exit("codeFencedFence"),H($)):R($)}}}function ZD(e,n,r){const l=this;return a;function a(u){return u===null?r(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),s)}function s(u){return l.parser.lazy[l.now().line]?r(u):n(u)}}const wp={name:"codeIndented",tokenize:JD},KD={partial:!0,tokenize:WD};function JD(e,n,r){const l=this;return a;function a(h){return e.enter("codeIndented"),Ye(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):r(h)}function u(h){return h===null?d(h):ke(h)?e.attempt(KD,u,d)(h):(e.enter("codeFlowValue"),c(h))}function c(h){return h===null||ke(h)?(e.exit("codeFlowValue"),u(h)):(e.consume(h),c)}function d(h){return e.exit("codeIndented"),n(h)}}function WD(e,n,r){const l=this;return a;function a(u){return l.parser.lazy[l.now().line]?r(u):ke(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):Ye(e,s,"linePrefix",5)(u)}function s(u){const c=l.events[l.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?n(u):ke(u)?a(u):r(u)}}const eR={name:"codeText",previous:nR,resolve:tR,tokenize:rR};function tR(e){let n=e.length-4,r=3,l,a;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(l=r;++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,r,l){const a=r||0;this.setCursor(Math.trunc(n));const s=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return l&&bo(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),bo(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),bo(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,r,n)(u)}}function V_(e,n,r,l,a,s,u,c,d){const h=d||Number.POSITIVE_INFINITY;let m=0;return p;function p(S){return S===60?(e.enter(l),e.enter(a),e.enter(s),e.consume(S),e.exit(s),x):S===null||S===32||S===41||xc(S)?r(S):(e.enter(l),e.enter(u),e.enter(c),e.enter("chunkString",{contentType:"string"}),k(S))}function x(S){return S===62?(e.enter(s),e.consume(S),e.exit(s),e.exit(a),e.exit(l),n):(e.enter(c),e.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===62?(e.exit("chunkString"),e.exit(c),x(S)):S===null||S===60||ke(S)?r(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 k(S){return!m&&(S===null||S===41||ot(S))?(e.exit("chunkString"),e.exit(c),e.exit(u),e.exit(l),n(S)):m999||v===null||v===91||v===93&&!d||v===94&&!c&&"_hiddenFootnoteSupport"in u.parser.constructs?r(v):v===93?(e.exit(s),e.enter(a),e.consume(v),e.exit(a),e.exit(l),n):ke(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||ke(v)||c++>999?(e.exit("chunkString"),m(v)):(e.consume(v),d||(d=!Ie(v)),v===92?x:p)}function x(v){return v===91||v===92||v===93?(e.consume(v),c++,p):p(v)}}function $_(e,n,r,l,a,s){let u;return c;function c(x){return x===34||x===39||x===40?(e.enter(l),e.enter(a),e.consume(x),e.exit(a),u=x===40?41:x,d):r(x)}function d(x){return x===u?(e.enter(a),e.consume(x),e.exit(a),e.exit(l),n):(e.enter(s),h(x))}function h(x){return x===u?(e.exit(s),d(u)):x===null?r(x):ke(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),Ye(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===u||x===null||ke(x)?(e.exit("chunkString"),h(x)):(e.consume(x),x===92?p:m)}function p(x){return x===u||x===92?(e.consume(x),m):m(x)}}function Mo(e,n){let r;return l;function l(a){return ke(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r=!0,l):Ie(a)?Ye(e,l,r?"linePrefix":"lineSuffix")(a):n(a)}}const fR={name:"definition",tokenize:hR},dR={partial:!0,tokenize:pR};function hR(e,n,r){const l=this;let a;return s;function s(v){return e.enter("definition"),u(v)}function u(v){return P_.call(l,e,c,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function c(v){return a=Yn(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),d):r(v)}function d(v){return ot(v)?Mo(e,h)(v):h(v)}function h(v){return V_(e,m,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function m(v){return e.attempt(dR,p,p)(v)}function p(v){return Ie(v)?Ye(e,x,"whitespace")(v):x(v)}function x(v){return v===null||ke(v)?(e.exit("definition"),l.parser.defined.push(a),n(v)):r(v)}}function pR(e,n,r){return l;function l(c){return ot(c)?Mo(e,a)(c):r(c)}function a(c){return $_(e,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function s(c){return Ie(c)?Ye(e,u,"whitespace")(c):u(c)}function u(c){return c===null||ke(c)?n(c):r(c)}}const mR={name:"hardBreakEscape",tokenize:gR};function gR(e,n,r){return l;function l(s){return e.enter("hardBreakEscape"),e.consume(s),a}function a(s){return ke(s)?(e.exit("hardBreakEscape"),n(s)):r(s)}}const xR={name:"headingAtx",resolve:yR,tokenize:vR};function yR(e,n){let r=e.length-2,l=3,a,s;return e[l][1].type==="whitespace"&&(l+=2),r-2>l&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(l===r-1||r-4>l&&e[r-2][1].type==="whitespace")&&(r-=l+1===r?2:4),r>l&&(a={type:"atxHeadingText",start:e[l][1].start,end:e[r][1].end},s={type:"chunkText",start:e[l][1].start,end:e[r][1].end,contentType:"text"},Sn(e,l,r-l+1,[["enter",a,n],["enter",s,n],["exit",s,n],["exit",a,n]])),e}function vR(e,n,r){let l=0;return a;function a(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||ot(m)?(e.exit("atxHeadingSequence"),c(m)):r(m)}function c(m){return m===35?(e.enter("atxHeadingSequence"),d(m)):m===null||ke(m)?(e.exit("atxHeading"),n(m)):Ie(m)?Ye(e,c,"whitespace")(m):(e.enter("atxHeadingText"),h(m))}function d(m){return m===35?(e.consume(m),d):(e.exit("atxHeadingSequence"),c(m))}function h(m){return m===null||m===35||ot(m)?(e.exit("atxHeadingText"),c(m)):(e.consume(m),h)}}const bR=["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"],Tb=["pre","script","style","textarea"],wR={concrete:!0,name:"htmlFlow",resolveTo:ER,tokenize:kR},SR={partial:!0,tokenize:CR},_R={partial:!0,tokenize:NR};function ER(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 kR(e,n,r){const l=this;let a,s,u,c,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),x):N===47?(e.consume(N),s=!0,k):N===63?(e.consume(N),a=3,l.interrupt?n:j):Kt(N)?(e.consume(N),u=String.fromCharCode(N),_):r(N)}function x(N){return N===45?(e.consume(N),a=2,v):N===91?(e.consume(N),a=5,c=0,w):Kt(N)?(e.consume(N),a=4,l.interrupt?n:j):r(N)}function v(N){return N===45?(e.consume(N),l.interrupt?n:j):r(N)}function w(N){const G="CDATA[";return N===G.charCodeAt(c++)?(e.consume(N),c===G.length?l.interrupt?n:q:w):r(N)}function k(N){return Kt(N)?(e.consume(N),u=String.fromCharCode(N),_):r(N)}function _(N){if(N===null||N===47||N===62||ot(N)){const G=N===47,X=u.toLowerCase();return!G&&!s&&Tb.includes(X)?(a=1,l.interrupt?n(N):q(N)):bR.includes(u.toLowerCase())?(a=6,G?(e.consume(N),S):l.interrupt?n(N):q(N)):(a=7,l.interrupt&&!l.parser.lazy[l.now().line]?r(N):s?T(N):E(N))}return N===45||Yt(N)?(e.consume(N),u+=String.fromCharCode(N),_):r(N)}function S(N){return N===62?(e.consume(N),l.interrupt?n:q):r(N)}function T(N){return Ie(N)?(e.consume(N),T):O(N)}function E(N){return N===47?(e.consume(N),O):N===58||N===95||Kt(N)?(e.consume(N),A):Ie(N)?(e.consume(N),E):O(N)}function A(N){return N===45||N===46||N===58||N===95||Yt(N)?(e.consume(N),A):U(N)}function U(N){return N===61?(e.consume(N),z):Ie(N)?(e.consume(N),U):E(N)}function z(N){return N===null||N===60||N===61||N===62||N===96?r(N):N===34||N===39?(e.consume(N),d=N,H):Ie(N)?(e.consume(N),z):R(N)}function H(N){return N===d?(e.consume(N),d=null,V):N===null||ke(N)?r(N):(e.consume(N),H)}function R(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||ot(N)?U(N):(e.consume(N),R)}function V(N){return N===47||N===62||Ie(N)?E(N):r(N)}function O(N){return N===62?(e.consume(N),L):r(N)}function L(N){return N===null||ke(N)?q(N):Ie(N)?(e.consume(N),L):r(N)}function q(N){return N===45&&a===2?(e.consume(N),M):N===60&&a===1?(e.consume(N),Y):N===62&&a===4?(e.consume(N),I):N===63&&a===3?(e.consume(N),j):N===93&&a===5?(e.consume(N),K):ke(N)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(SR,F,ee)(N)):N===null||ke(N)?(e.exit("htmlFlowData"),ee(N)):(e.consume(N),q)}function ee(N){return e.check(_R,B,F)(N)}function B(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),$}function $(N){return N===null||ke(N)?ee(N):(e.enter("htmlFlowData"),q(N))}function M(N){return N===45?(e.consume(N),j):q(N)}function Y(N){return N===47?(e.consume(N),u="",Q):q(N)}function Q(N){if(N===62){const G=u.toLowerCase();return Tb.includes(G)?(e.consume(N),I):q(N)}return Kt(N)&&u.length<8?(e.consume(N),u+=String.fromCharCode(N),Q):q(N)}function K(N){return N===93?(e.consume(N),j):q(N)}function j(N){return N===62?(e.consume(N),I):N===45&&a===2?(e.consume(N),j):q(N)}function I(N){return N===null||ke(N)?(e.exit("htmlFlowData"),F(N)):(e.consume(N),I)}function F(N){return e.exit("htmlFlow"),n(N)}}function NR(e,n,r){const l=this;return a;function a(u){return ke(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),s):r(u)}function s(u){return l.parser.lazy[l.now().line]?r(u):n(u)}}function CR(e,n,r){return l;function l(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(ls,n,r)}}const TR={name:"htmlText",tokenize:AR};function AR(e,n,r){const l=this;let a,s,u;return c;function c(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),U):j===63?(e.consume(j),E):Kt(j)?(e.consume(j),R):r(j)}function h(j){return j===45?(e.consume(j),m):j===91?(e.consume(j),s=0,w):Kt(j)?(e.consume(j),T):r(j)}function m(j){return j===45?(e.consume(j),v):r(j)}function p(j){return j===null?r(j):j===45?(e.consume(j),x):ke(j)?(u=p,Y(j)):(e.consume(j),p)}function x(j){return j===45?(e.consume(j),v):p(j)}function v(j){return j===62?M(j):j===45?x(j):p(j)}function w(j){const I="CDATA[";return j===I.charCodeAt(s++)?(e.consume(j),s===I.length?k:w):r(j)}function k(j){return j===null?r(j):j===93?(e.consume(j),_):ke(j)?(u=k,Y(j)):(e.consume(j),k)}function _(j){return j===93?(e.consume(j),S):k(j)}function S(j){return j===62?M(j):j===93?(e.consume(j),S):k(j)}function T(j){return j===null||j===62?M(j):ke(j)?(u=T,Y(j)):(e.consume(j),T)}function E(j){return j===null?r(j):j===63?(e.consume(j),A):ke(j)?(u=E,Y(j)):(e.consume(j),E)}function A(j){return j===62?M(j):E(j)}function U(j){return Kt(j)?(e.consume(j),z):r(j)}function z(j){return j===45||Yt(j)?(e.consume(j),z):H(j)}function H(j){return ke(j)?(u=H,Y(j)):Ie(j)?(e.consume(j),H):M(j)}function R(j){return j===45||Yt(j)?(e.consume(j),R):j===47||j===62||ot(j)?V(j):r(j)}function V(j){return j===47?(e.consume(j),M):j===58||j===95||Kt(j)?(e.consume(j),O):ke(j)?(u=V,Y(j)):Ie(j)?(e.consume(j),V):M(j)}function O(j){return j===45||j===46||j===58||j===95||Yt(j)?(e.consume(j),O):L(j)}function L(j){return j===61?(e.consume(j),q):ke(j)?(u=L,Y(j)):Ie(j)?(e.consume(j),L):V(j)}function q(j){return j===null||j===60||j===61||j===62||j===96?r(j):j===34||j===39?(e.consume(j),a=j,ee):ke(j)?(u=q,Y(j)):Ie(j)?(e.consume(j),q):(e.consume(j),B)}function ee(j){return j===a?(e.consume(j),a=void 0,$):j===null?r(j):ke(j)?(u=ee,Y(j)):(e.consume(j),ee)}function B(j){return j===null||j===34||j===39||j===60||j===61||j===96?r(j):j===47||j===62||ot(j)?V(j):(e.consume(j),B)}function $(j){return j===47||j===62||ot(j)?V(j):r(j)}function M(j){return j===62?(e.consume(j),e.exit("htmlTextData"),e.exit("htmlText"),n):r(j)}function Y(j){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),Q}function Q(j){return Ie(j)?Ye(e,K,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):K(j)}function K(j){return e.enter("htmlTextData"),u(j)}}const Gm={name:"labelEnd",resolveAll:DR,resolveTo:RR,tokenize:OR},zR={tokenize:LR},MR={tokenize:HR},jR={tokenize:BR};function DR(e){let n=-1;const r=[];for(;++n=3&&(h===null||ke(h))?(e.exit("thematicBreak"),n(h)):r(h)}function d(h){return h===a?(e.consume(h),l++,d):(e.exit("thematicBreakSequence"),Ie(h)?Ye(e,c,"whitespace")(h):c(h))}}const sn={continuation:{tokenize:XR},exit:ZR,name:"list",tokenize:FR},GR={partial:!0,tokenize:KR},YR={partial:!0,tokenize:QR};function FR(e,n,r){const l=this,a=l.events[l.events.length-1];let s=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return c;function c(v){const w=l.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!l.containerState.marker||v===l.containerState.marker:im(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(tc,r,h)(v):h(v);if(!l.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(v)}return r(v)}function d(v){return im(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)):r(v)}function h(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),l.containerState.marker=l.containerState.marker||v,e.check(ls,l.interrupt?r:m,e.attempt(GR,x,p))}function m(v){return l.containerState.initialBlankLine=!0,s++,x(v)}function p(v){return Ie(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),x):r(v)}function x(v){return l.containerState.size=s+l.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(v)}}function XR(e,n,r){const l=this;return l.containerState._closeFlow=void 0,e.check(ls,a,s);function a(c){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,Ye(e,n,"listItemIndent",l.containerState.size+1)(c)}function s(c){return l.containerState.furtherBlankLines||!Ie(c)?(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,u(c)):(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,e.attempt(YR,n,u)(c))}function u(c){return l.containerState._closeFlow=!0,l.interrupt=void 0,Ye(e,e.attempt(sn,n,r),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function QR(e,n,r){const l=this;return Ye(e,a,"listItemIndent",l.containerState.size+1);function a(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):r(s)}}function ZR(e){e.exit(this.containerState.type)}function KR(e,n,r){const l=this;return Ye(e,a,"listItemPrefixWhitespace",l.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(s){const u=l.events[l.events.length-1];return!Ie(s)&&u&&u[1].type==="listItemPrefixWhitespace"?n(s):r(s)}}const Ab={name:"setextUnderline",resolveTo:JR,tokenize:WR};function JR(e,n){let r=e.length,l,a,s;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){l=r;break}e[r][1].type==="paragraph"&&(a=r)}else e[r][1].type==="content"&&e.splice(r,1),!s&&e[r][1].type==="definition"&&(s=r);const u={type:"setextHeading",start:{...e[l][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",s?(e.splice(a,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 WR(e,n,r){const l=this;let a;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"),a=h,u(h)):r(h)}function u(h){return e.enter("setextHeadingLineSequence"),c(h)}function c(h){return h===a?(e.consume(h),c):(e.exit("setextHeadingLineSequence"),Ie(h)?Ye(e,d,"lineSuffix")(h):d(h))}function d(h){return h===null||ke(h)?(e.exit("setextHeadingLine"),n(h)):r(h)}}const eO={tokenize:tO};function tO(e){const n=this,r=e.attempt(ls,l,e.attempt(this.parser.constructs.flowInitial,a,Ye(e,e.attempt(this.parser.constructs.flow,a,e.attempt(aR,a)),"linePrefix")));return r;function l(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),n.currentConstruct=void 0,r}function a(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n.currentConstruct=void 0,r}}const nO={resolveAll:Y_()},rO=G_("string"),iO=G_("text");function G_(e){return{resolveAll:Y_(e==="text"?lO:void 0),tokenize:n};function n(r){const l=this,a=this.parser.constructs[e],s=r.attempt(a,u,c);return u;function u(m){return h(m)?s(m):c(m)}function c(m){if(m===null){r.consume(m);return}return r.enter("data"),r.consume(m),d}function d(m){return h(m)?(r.exit("data"),s(m)):(r.consume(m),d)}function h(m){if(m===null)return!0;const p=a[m];let x=-1;if(p)for(;++x-1){const c=u[0];typeof c=="string"?u[0]=c.slice(l):u.shift()}s>0&&u.push(e[a].slice(0,s))}return u}function yO(e,n){let r=-1;const l=[];let a;for(;++r0){const Qt=Ne.tokenStack[Ne.tokenStack.length-1];(Qt[1]||Mb).call(Ne,void 0,Qt[0])}for(ge.position={start:pi(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:pi(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},Ge=-1;++Ge0&&(l.className=["language-"+a[0]]);let s={type:"element",tagName:"code",properties:l,children:[{type:"text",value:r}]};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 jO(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function DO(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function RO(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",l=String(n.identifier).toUpperCase(),a=xa(l.toLowerCase()),s=e.footnoteOrder.indexOf(l);let u,c=e.footnoteCounts.get(l);c===void 0?(c=0,e.footnoteOrder.push(l),u=e.footnoteOrder.length):u=s+1,c+=1,e.footnoteCounts.set(l,c);const d={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+a,id:r+"fnref-"+a+(c>1?"-"+c:""),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 OO(e,n){const r={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function LO(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function Q_(e,n){const r=n.referenceType;let l="]";if(r==="collapsed"?l+="[]":r==="full"&&(l+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+l}];const a=e.all(n),s=a[0];s&&s.type==="text"?s.value="["+s.value:a.unshift({type:"text",value:"["});const u=a[a.length-1];return u&&u.type==="text"?u.value+=l:a.push({type:"text",value:l}),a}function HO(e,n){const r=String(n.identifier).toUpperCase(),l=e.definitionById.get(r);if(!l)return Q_(e,n);const a={src:xa(l.url||""),alt:n.alt};l.title!==null&&l.title!==void 0&&(a.title=l.title);const s={type:"element",tagName:"img",properties:a,children:[]};return e.patch(n,s),e.applyData(n,s)}function BO(e,n){const r={src:xa(n.url)};n.alt!==null&&n.alt!==void 0&&(r.alt=n.alt),n.title!==null&&n.title!==void 0&&(r.title=n.title);const l={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,l),e.applyData(n,l)}function IO(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const l={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,l),e.applyData(n,l)}function qO(e,n){const r=String(n.identifier).toUpperCase(),l=e.definitionById.get(r);if(!l)return Q_(e,n);const a={href:xa(l.url||"")};l.title!==null&&l.title!==void 0&&(a.title=l.title);const s={type:"element",tagName:"a",properties:a,children:e.all(n)};return e.patch(n,s),e.applyData(n,s)}function UO(e,n){const r={href:xa(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const l={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,l),e.applyData(n,l)}function VO(e,n,r){const l=e.all(n),a=r?PO(r):Z_(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 c=-1;for(;++c1}function $O(e,n){const r={},l=e.all(n);let a=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.start);++a0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},c=Im(n.children[1]),d=A_(n.children[n.children.length-1]);c&&d&&(u.position={start:c,end:d}),a.push(u)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(n,s),e.applyData(n,s)}function QO(e,n,r){const l=r?r.children:void 0,s=(l?l.indexOf(n):1)===0?"th":"td",u=r&&r.type==="table"?r.align:void 0,c=u?u.length:n.children.length;let d=-1;const h=[];for(;++d0,!0),l[0]),a=l.index+l[0].length,l=r.exec(n);return s.push(Rb(n.slice(a),a>0,!1)),s.join("")}function Rb(e,n,r){let l=0,a=e.length;if(n){let s=e.codePointAt(l);for(;s===jb||s===Db;)l++,s=e.codePointAt(l)}if(r){let s=e.codePointAt(a-1);for(;s===jb||s===Db;)a--,s=e.codePointAt(a-1)}return a>l?e.slice(l,a):""}function JO(e,n){const r={type:"text",value:KO(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function WO(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const e6={blockquote:AO,break:zO,code:MO,delete:jO,emphasis:DO,footnoteReference:RO,heading:OO,html:LO,imageReference:HO,image:BO,inlineCode:IO,linkReference:qO,link:UO,listItem:VO,list:$O,paragraph:GO,root:YO,strong:FO,table:XO,tableCell:ZO,tableRow:QO,text:JO,thematicBreak:WO,toml:$u,yaml:$u,definition:$u,footnoteDefinition:$u};function $u(){}const K_=-1,Ic=0,jo=1,yc=2,Ym=3,Fm=4,Xm=5,Qm=6,J_=7,W_=8,Ob=typeof self=="object"?self:globalThis,t6=(e,n)=>{const r=(a,s)=>(e.set(s,a),a),l=a=>{if(e.has(a))return e.get(a);const[s,u]=n[a];switch(s){case Ic:case K_:return r(u,a);case jo:{const c=r([],a);for(const d of u)c.push(l(d));return c}case yc:{const c=r({},a);for(const[d,h]of u)c[l(d)]=l(h);return c}case Ym:return r(new Date(u),a);case Fm:{const{source:c,flags:d}=u;return r(new RegExp(c,d),a)}case Xm:{const c=r(new Map,a);for(const[d,h]of u)c.set(l(d),l(h));return c}case Qm:{const c=r(new Set,a);for(const d of u)c.add(l(d));return c}case J_:{const{name:c,message:d}=u;return r(new Ob[c](d),a)}case W_:return r(BigInt(u),a);case"BigInt":return r(Object(BigInt(u)),a);case"ArrayBuffer":return r(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:c}=new Uint8Array(u);return r(new DataView(c),u)}}return r(new Ob[s](u),a)};return l},Lb=e=>t6(new Map,e)(0),Ql="",{toString:n6}={},{keys:r6}=Object,wo=e=>{const n=typeof e;if(n!=="object"||!e)return[Ic,n];const r=n6.call(e).slice(8,-1);switch(r){case"Array":return[jo,Ql];case"Object":return[yc,Ql];case"Date":return[Ym,Ql];case"RegExp":return[Fm,Ql];case"Map":return[Xm,Ql];case"Set":return[Qm,Ql];case"DataView":return[jo,r]}return r.includes("Array")?[jo,r]:r.includes("Error")?[J_,r]:[yc,r]},Gu=([e,n])=>e===Ic&&(n==="function"||n==="symbol"),i6=(e,n,r,l)=>{const a=(u,c)=>{const d=l.push(u)-1;return r.set(c,d),d},s=u=>{if(r.has(u))return r.get(u);let[c,d]=wo(u);switch(c){case Ic:{let m=u;switch(d){case"bigint":c=W_,m=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);m=null;break;case"undefined":return a([K_],u)}return a([c,m],u)}case jo:{if(d){let x=u;return d==="DataView"?x=new Uint8Array(u.buffer):d==="ArrayBuffer"&&(x=new Uint8Array(u)),a([d,[...x]],u)}const m=[],p=a([c,m],u);for(const x of u)m.push(s(x));return p}case yc:{if(d)switch(d){case"BigInt":return a([d,u.toString()],u);case"Boolean":case"Number":case"String":return a([d,u.valueOf()],u)}if(n&&"toJSON"in u)return s(u.toJSON());const m=[],p=a([c,m],u);for(const x of r6(u))(e||!Gu(wo(u[x])))&&m.push([s(x),s(u[x])]);return p}case Ym:return a([c,u.toISOString()],u);case Fm:{const{source:m,flags:p}=u;return a([c,{source:m,flags:p}],u)}case Xm:{const m=[],p=a([c,m],u);for(const[x,v]of u)(e||!(Gu(wo(x))||Gu(wo(v))))&&m.push([s(x),s(v)]);return p}case Qm:{const m=[],p=a([c,m],u);for(const x of u)(e||!Gu(wo(x)))&&m.push(s(x));return p}}const{message:h}=u;return a([c,{name:d,message:h}],u)};return s},Hb=(e,{json:n,lossy:r}={})=>{const l=[];return i6(!(n||r),!!n,new Map,l)(e),l},vc=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?Lb(Hb(e,n)):structuredClone(e):(e,n)=>Lb(Hb(e,n));function l6(e,n){const r=[{type:"text",value:"↩"}];return n>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),r}function a6(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function o6(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||l6,l=e.options.footnoteBackLabel||a6,a=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let d=-1;for(;++d0&&w.push({type:"text",value:" "});let T=typeof r=="string"?r:r(d,v);typeof T=="string"&&(T={type:"text",value:T}),w.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+x+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof l=="string"?l:l(d,v),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}const _=m[m.length-1];if(_&&_.type==="element"&&_.tagName==="p"){const T=_.children[_.children.length-1];T&&T.type==="text"?T.value+=" ":_.children.push({type:"text",value:" "}),_.children.push(...w)}else m.push(...w);const S={type:"element",tagName:"li",properties:{id:n+"fn-"+x},children:e.wrap(m,!0)};e.patch(h,S),c.push(S)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...vc(u),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:e.wrap(c,!0)},{type:"text",value:` +`}]}}const qc=(function(e){if(e==null)return f6;if(typeof e=="function")return Uc(e);if(typeof e=="object")return Array.isArray(e)?s6(e):u6(e);if(typeof e=="string")return c6(e);throw new Error("Expected function, string, or object as test")});function s6(e){const n=[];let r=-1;for(;++r":""))+")"})}return x;function x(){let v=eE,w,k,_;if((!n||s(d,h,m[m.length-1]||void 0))&&(v=m6(r(d,m)),v[0]===am))return v;if("children"in d&&d.children){const S=d;if(S.children&&v[0]!==p6)for(k=(l?S.children.length:-1)+u,_=m.concat(S);k>-1&&k0&&r.push({type:"text",value:` +`}),r}function Bb(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function Ib(e,n){const r=x6(e,n),l=r.one(e,void 0),a=o6(r),s=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return a&&s.children.push({type:"text",value:` +`},a),s}function S6(e,n){return e&&"run"in e?async function(r,l){const a=Ib(r,{file:l,...n});await e.run(a,l)}:function(r,l){return Ib(r,{file:l,...e||n})}}function qb(e){if(e)throw e}var _p,Ub;function _6(){if(Ub)return _p;Ub=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,l=Object.getOwnPropertyDescriptor,a=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 x;for(x in h);return typeof x>"u"||e.call(h,x)},u=function(h,m){r&&m.name==="__proto__"?r(h,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):h[m.name]=m.newValue},c=function(h,m){if(m==="__proto__")if(e.call(h,m)){if(l)return l(h,m).value}else return;return h[m]};return _p=function d(){var h,m,p,x,v,w,k=arguments[0],_=1,S=arguments.length,T=!1;for(typeof k=="boolean"&&(T=k,k=arguments[1]||{},_=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});_u.length;let d;c&&u.push(a);try{d=e.apply(this,u)}catch(h){const m=h;if(c&&r)throw m;return a(m)}c||(d&&d.then&&typeof d.then=="function"?d.then(s,a):d instanceof Error?a(d):s(d))}function a(u,...c){r||(r=!0,n(u,...c))}function s(u){a(null,u)}}const tr={basename:C6,dirname:T6,extname:A6,join:z6,sep:"/"};function C6(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');as(e);let r=0,l=-1,a=e.length,s;if(n===void 0||n.length===0||n.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(s){r=a+1;break}}else l<0&&(s=!0,l=a+1);return l<0?"":e.slice(r,l)}if(n===e)return"";let u=-1,c=n.length-1;for(;a--;)if(e.codePointAt(a)===47){if(s){r=a+1;break}}else u<0&&(s=!0,u=a+1),c>-1&&(e.codePointAt(a)===n.codePointAt(c--)?c<0&&(l=a):(c=-1,l=u));return r===l?l=u:l<0&&(l=e.length),e.slice(r,l)}function T6(e){if(as(e),e.length===0)return".";let n=-1,r=e.length,l;for(;--r;)if(e.codePointAt(r)===47){if(l){n=r;break}}else l||(l=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function A6(e){as(e);let n=e.length,r=-1,l=0,a=-1,s=0,u;for(;n--;){const c=e.codePointAt(n);if(c===47){if(u){l=n+1;break}continue}r<0&&(u=!0,r=n+1),c===46?a<0?a=n:s!==1&&(s=1):a>-1&&(s=-1)}return a<0||r<0||s===0||s===1&&a===r-1&&a===l+1?"":e.slice(a,r)}function z6(...e){let n=-1,r;for(;++n0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function j6(e,n){let r="",l=0,a=-1,s=0,u=-1,c,d;for(;++u<=e.length;){if(u2){if(d=r.lastIndexOf("/"),d!==r.length-1){d<0?(r="",l=0):(r=r.slice(0,d),l=r.length-1-r.lastIndexOf("/")),a=u,s=0;continue}}else if(r.length>0){r="",l=0,a=u,s=0;continue}}n&&(r=r.length>0?r+"/..":"..",l=2)}else r.length>0?r+="/"+e.slice(a+1,u):r=e.slice(a+1,u),l=u-a-1;a=u,s=0}else c===46&&s>-1?s++:s=-1}return r}function as(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const D6={cwd:R6};function R6(){return"/"}function um(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function O6(e){if(typeof e=="string")e=new URL(e);else if(!um(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 L6(e)}function L6(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 r=-1;for(;++r0){let[v,...w]=m;const k=l[x][1];sm(k)&&sm(v)&&(v=Ep(!0,k,v)),l[x]=[h,v,...w]}}}}const q6=new Km().freeze();function Tp(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ap(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function zp(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 Pb(e){if(!sm(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function $b(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function Yu(e){return U6(e)?e:new nE(e)}function U6(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function V6(e){return typeof e=="string"||P6(e)}function P6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const $6="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Gb=[],Yb={allowDangerousHtml:!0},G6=/^(https?|ircs?|mailto|xmpp)$/i,Y6=[{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 F6(e){const n=X6(e),r=Q6(e);return Z6(n.runSync(n.parse(r),r),e)}function X6(e){const n=e.rehypePlugins||Gb,r=e.remarkPlugins||Gb,l=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Yb}:Yb;return q6().use(TO).use(r).use(S6,l).use(n)}function Q6(e){const n=e.children||"",r=new nE;return typeof n=="string"&&(r.value=n),r}function Z6(e,n){const r=n.allowedElements,l=n.allowElement,a=n.components,s=n.disallowedElements,u=n.skipHtml,c=n.unwrapDisallowed,d=n.urlTransform||K6;for(const m of Y6)Object.hasOwn(n,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+$6+m.id,void 0);return Zm(e,h),fD(e,{Fragment:b.Fragment,components:a,ignoreInvalidStyle:!0,jsx:b.jsx,jsxs:b.jsxs,passKeys:!0,passNode:!0});function h(m,p,x){if(m.type==="raw"&&x&&typeof p=="number")return u?x.children.splice(p,1):x.children[p]={type:"text",value:m.value},p;if(m.type==="element"){let v;for(v in bp)if(Object.hasOwn(bp,v)&&Object.hasOwn(m.properties,v)){const w=m.properties[v],k=bp[v];(k===null||k.includes(m.tagName))&&(m.properties[v]=d(String(w||""),v,m))}}if(m.type==="element"){let v=r?!r.includes(m.tagName):s?s.includes(m.tagName):!1;if(!v&&l&&typeof p=="number"&&(v=!l(m,p,x)),v&&x&&typeof p=="number")return c&&m.children?x.children.splice(p,1,...m.children):x.children.splice(p,1),p}}}function K6(e){const n=e.indexOf(":"),r=e.indexOf("?"),l=e.indexOf("#"),a=e.indexOf("/");return n===-1||a!==-1&&n>a||r!==-1&&n>r||l!==-1&&n>l||G6.test(e.slice(0,n))?e:""}function Fb(e,n){const r=String(e);if(typeof n!="string")throw new TypeError("Expected character");let l=0,a=r.indexOf(n);for(;a!==-1;)l++,a=r.indexOf(n,a+n.length);return l}function J6(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function W6(e,n,r){const a=qc((r||{}).ignore||[]),s=eL(n);let u=-1;for(;++u0?{type:"text",value:z}:void 0),z===!1?x.lastIndex=A+1:(w!==A&&T.push({type:"text",value:h.value.slice(w,A)}),Array.isArray(z)?T.push(...z):z&&T.push(z),w=A+E[0].length,S=!0),!x.global)break;E=x.exec(h.value)}return S?(w?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],l=r.indexOf(")");const a=Fb(e,"(");let s=Fb(e,")");for(;l!==-1&&a>s;)e+=r.slice(0,l+1),r=r.slice(l+1),l=r.indexOf(")"),s++;return[e,r]}function rE(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||nl(r)||Hc(r))&&(!n||r!==47)}iE.peek=_L;function mL(){this.buffer()}function gL(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function xL(){this.buffer()}function yL(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function vL(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Yn(this.sliceSerialize(e)).toLowerCase(),r.label=n}function bL(e){this.exit(e)}function wL(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Yn(this.sliceSerialize(e)).toLowerCase(),r.label=n}function SL(e){this.exit(e)}function _L(){return"["}function iE(e,n,r,l){const a=r.createTracker(l);let s=a.move("[^");const u=r.enter("footnoteReference"),c=r.enter("reference");return s+=a.move(r.safe(r.associationId(e),{after:"]",before:s})),c(),u(),s+=a.move("]"),s}function EL(){return{enter:{gfmFootnoteCallString:mL,gfmFootnoteCall:gL,gfmFootnoteDefinitionLabelString:xL,gfmFootnoteDefinition:yL},exit:{gfmFootnoteCallString:vL,gfmFootnoteCall:bL,gfmFootnoteDefinitionLabelString:wL,gfmFootnoteDefinition:SL}}}function kL(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:iE},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(l,a,s,u){const c=s.createTracker(u);let d=c.move("[^");const h=s.enter("footnoteDefinition"),m=s.enter("label");return d+=c.move(s.safe(s.associationId(l),{before:d,after:"]"})),m(),d+=c.move("]:"),l.children&&l.children.length>0&&(c.shift(4),d+=c.move((n?` +`:" ")+s.indentLines(s.containerFlow(l,c.current()),n?lE:NL))),h(),d}}function NL(e,n,r){return n===0?e:lE(e,n,r)}function lE(e,n,r){return(r?"":" ")+e}const CL=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];aE.peek=jL;function TL(){return{canContainEols:["delete"],enter:{strikethrough:zL},exit:{strikethrough:ML}}}function AL(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:CL}],handlers:{delete:aE}}}function zL(e){this.enter({type:"delete",children:[]},e)}function ML(e){this.exit(e)}function aE(e,n,r,l){const a=r.createTracker(l),s=r.enter("strikethrough");let u=a.move("~~");return u+=r.containerPhrasing(e,{...a.current(),before:u,after:"~"}),u+=a.move("~~"),s(),u}function jL(){return"~"}function DL(e){return e.length}function RL(e,n){const r=n||{},l=(r.align||[]).concat(),a=r.stringLength||DL,s=[],u=[],c=[],d=[];let h=0,m=-1;for(;++mh&&(h=e[m].length);++Sd[S])&&(d[S]=E)}k.push(T)}u[m]=k,c[m]=_}let p=-1;if(typeof l=="object"&&"length"in l)for(;++pd[p]&&(d[p]=T),v[p]=T),x[p]=E}u.splice(1,0,x),c.splice(1,0,v),m=-1;const w=[];for(;++m "),s.shift(2);const u=r.indentLines(r.containerFlow(e,s.current()),HL);return a(),u}function HL(e,n,r){return">"+(r?"":" ")+e}function BL(e,n){return Qb(e,n.inConstruct,!0)&&!Qb(e,n.notInConstruct,!1)}function Qb(e,n,r){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return r;let l=-1;for(;++lu&&(u=s):s=1,a=l+n.length,l=r.indexOf(n,a);return u}function qL(e,n){return!!(n.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function UL(e){const n=e.options.fence||"`";if(n!=="`"&&n!=="~")throw new Error("Cannot serialize code with `"+n+"` for `options.fence`, expected `` ` `` or `~`");return n}function VL(e,n,r,l){const a=UL(r),s=e.value||"",u=a==="`"?"GraveAccent":"Tilde";if(qL(e,r)){const p=r.enter("codeIndented"),x=r.indentLines(s,PL);return p(),x}const c=r.createTracker(l),d=a.repeat(Math.max(IL(s,a)+1,3)),h=r.enter("codeFenced");let m=c.move(d);if(e.lang){const p=r.enter(`codeFencedLang${u}`);m+=c.move(r.safe(e.lang,{before:m,after:" ",encode:["`"],...c.current()})),p()}if(e.lang&&e.meta){const p=r.enter(`codeFencedMeta${u}`);m+=c.move(" "),m+=c.move(r.safe(e.meta,{before:m,after:` +`,encode:["`"],...c.current()})),p()}return m+=c.move(` +`),s&&(m+=c.move(s+` +`)),m+=c.move(d),h(),m}function PL(e,n,r){return(r?"":" ")+e}function Jm(e){const n=e.options.quote||'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize title with `"+n+"` for `options.quote`, expected `\"`, or `'`");return n}function $L(e,n,r,l){const a=Jm(r),s=a==='"'?"Quote":"Apostrophe",u=r.enter("definition");let c=r.enter("label");const d=r.createTracker(l);let h=d.move("[");return h+=d.move(r.safe(r.associationId(e),{before:h,after:"]",...d.current()})),h+=d.move("]: "),c(),!e.url||/[\0- \u007F]/.test(e.url)?(c=r.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(r.safe(e.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(c=r.enter("destinationRaw"),h+=d.move(r.safe(e.url,{before:h,after:e.title?" ":` +`,...d.current()}))),c(),e.title&&(c=r.enter(`title${s}`),h+=d.move(" "+a),h+=d.move(r.safe(e.title,{before:h,after:a,...d.current()})),h+=d.move(a),c()),u(),h}function GL(e){const n=e.options.emphasis||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize emphasis with `"+n+"` for `options.emphasis`, expected `*`, or `_`");return n}function Yo(e){return"&#x"+e.toString(16).toUpperCase()+";"}function bc(e,n,r){const l=pa(e),a=pa(n);return l===void 0?a===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:l===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}oE.peek=YL;function oE(e,n,r,l){const a=GL(r),s=r.enter("emphasis"),u=r.createTracker(l),c=u.move(a);let d=u.move(r.containerPhrasing(e,{after:a,before:c,...u.current()}));const h=d.charCodeAt(0),m=bc(l.before.charCodeAt(l.before.length-1),h,a);m.inside&&(d=Yo(h)+d.slice(1));const p=d.charCodeAt(d.length-1),x=bc(l.after.charCodeAt(0),p,a);x.inside&&(d=d.slice(0,-1)+Yo(p));const v=u.move(a);return s(),r.attentionEncodeSurroundingInfo={after:x.outside,before:m.outside},c+d+v}function YL(e,n,r){return r.options.emphasis||"*"}function FL(e,n){let r=!1;return Zm(e,function(l){if("value"in l&&/\r?\n|\r/.test(l.value)||l.type==="break")return r=!0,am}),!!((!e.depth||e.depth<3)&&Pm(e)&&(n.options.setext||r))}function XL(e,n,r,l){const a=Math.max(Math.min(6,e.depth||1),1),s=r.createTracker(l);if(FL(e,r)){const m=r.enter("headingSetext"),p=r.enter("phrasing"),x=r.containerPhrasing(e,{...s.current(),before:` +`,after:` +`});return p(),m(),x+` +`+(a===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(` +`))+1))}const u="#".repeat(a),c=r.enter("headingAtx"),d=r.enter("phrasing");s.move(u+" ");let h=r.containerPhrasing(e,{before:"# ",after:` +`,...s.current()});return/^[\t ]/.test(h)&&(h=Yo(h.charCodeAt(0))+h.slice(1)),h=h?u+" "+h:u,r.options.closeAtx&&(h+=" "+u),d(),c(),h}sE.peek=QL;function sE(e){return e.value||""}function QL(){return"<"}uE.peek=ZL;function uE(e,n,r,l){const a=Jm(r),s=a==='"'?"Quote":"Apostrophe",u=r.enter("image");let c=r.enter("label");const d=r.createTracker(l);let h=d.move("![");return h+=d.move(r.safe(e.alt,{before:h,after:"]",...d.current()})),h+=d.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=r.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(r.safe(e.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(c=r.enter("destinationRaw"),h+=d.move(r.safe(e.url,{before:h,after:e.title?" ":")",...d.current()}))),c(),e.title&&(c=r.enter(`title${s}`),h+=d.move(" "+a),h+=d.move(r.safe(e.title,{before:h,after:a,...d.current()})),h+=d.move(a),c()),h+=d.move(")"),u(),h}function ZL(){return"!"}cE.peek=KL;function cE(e,n,r,l){const a=e.referenceType,s=r.enter("imageReference");let u=r.enter("label");const c=r.createTracker(l);let d=c.move("![");const h=r.safe(e.alt,{before:d,after:"]",...c.current()});d+=c.move(h+"]["),u();const m=r.stack;r.stack=[],u=r.enter("reference");const p=r.safe(r.associationId(e),{before:d,after:"]",...c.current()});return u(),r.stack=m,s(),a==="full"||!h||h!==p?d+=c.move(p+"]"):a==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function KL(){return"!"}fE.peek=JL;function fE(e,n,r){let l=e.value||"",a="`",s=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(l);)a+="`";for(/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^`|`$/.test(l))&&(l=" "+l+" ");++s\u007F]/.test(e.url))}hE.peek=WL;function hE(e,n,r,l){const a=Jm(r),s=a==='"'?"Quote":"Apostrophe",u=r.createTracker(l);let c,d;if(dE(e,r)){const m=r.stack;r.stack=[],c=r.enter("autolink");let p=u.move("<");return p+=u.move(r.containerPhrasing(e,{before:p,after:">",...u.current()})),p+=u.move(">"),c(),r.stack=m,p}c=r.enter("link"),d=r.enter("label");let h=u.move("[");return h+=u.move(r.containerPhrasing(e,{before:h,after:"](",...u.current()})),h+=u.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=r.enter("destinationLiteral"),h+=u.move("<"),h+=u.move(r.safe(e.url,{before:h,after:">",...u.current()})),h+=u.move(">")):(d=r.enter("destinationRaw"),h+=u.move(r.safe(e.url,{before:h,after:e.title?" ":")",...u.current()}))),d(),e.title&&(d=r.enter(`title${s}`),h+=u.move(" "+a),h+=u.move(r.safe(e.title,{before:h,after:a,...u.current()})),h+=u.move(a),d()),h+=u.move(")"),c(),h}function WL(e,n,r){return dE(e,r)?"<":"["}pE.peek=e8;function pE(e,n,r,l){const a=e.referenceType,s=r.enter("linkReference");let u=r.enter("label");const c=r.createTracker(l);let d=c.move("[");const h=r.containerPhrasing(e,{before:d,after:"]",...c.current()});d+=c.move(h+"]["),u();const m=r.stack;r.stack=[],u=r.enter("reference");const p=r.safe(r.associationId(e),{before:d,after:"]",...c.current()});return u(),r.stack=m,s(),a==="full"||!h||h!==p?d+=c.move(p+"]"):a==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function e8(){return"["}function Wm(e){const n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function t8(e){const n=Wm(e),r=e.options.bulletOther;if(!r)return n==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+r+"`) to be different");return r}function n8(e){const n=e.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function mE(e){const n=e.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function r8(e,n,r,l){const a=r.enter("list"),s=r.bulletCurrent;let u=e.ordered?n8(r):Wm(r);const c=e.ordered?u==="."?")":".":t8(r);let d=n&&r.bulletLastUsed?u===r.bulletLastUsed:!1;if(!e.ordered){const m=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&m&&(!m.children||!m.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(d=!0),mE(r)===u&&m){let p=-1;for(;++p-1?n.start:1)+(r.options.incrementListMarker===!1?0:n.children.indexOf(e))+s);let u=s.length+1;(a==="tab"||a==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(u=Math.ceil(u/4)*4);const c=r.createTracker(l);c.move(s+" ".repeat(u-s.length)),c.shift(u);const d=r.enter("listItem"),h=r.indentLines(r.containerFlow(e,c.current()),m);return d(),h;function m(p,x,v){return x?(v?"":" ".repeat(u))+p:(v?s:s+" ".repeat(u-s.length))+p}}function a8(e,n,r,l){const a=r.enter("paragraph"),s=r.enter("phrasing"),u=r.containerPhrasing(e,l);return s(),a(),u}const o8=qc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function s8(e,n,r,l){return(e.children.some(function(u){return o8(u)})?r.containerPhrasing:r.containerFlow).call(r,e,l)}function u8(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}gE.peek=c8;function gE(e,n,r,l){const a=u8(r),s=r.enter("strong"),u=r.createTracker(l),c=u.move(a+a);let d=u.move(r.containerPhrasing(e,{after:a,before:c,...u.current()}));const h=d.charCodeAt(0),m=bc(l.before.charCodeAt(l.before.length-1),h,a);m.inside&&(d=Yo(h)+d.slice(1));const p=d.charCodeAt(d.length-1),x=bc(l.after.charCodeAt(0),p,a);x.inside&&(d=d.slice(0,-1)+Yo(p));const v=u.move(a+a);return s(),r.attentionEncodeSurroundingInfo={after:x.outside,before:m.outside},c+d+v}function c8(e,n,r){return r.options.strong||"*"}function f8(e,n,r,l){return r.safe(e.value,l)}function d8(e){const n=e.options.ruleRepetition||3;if(n<3)throw new Error("Cannot serialize rules with repetition `"+n+"` for `options.ruleRepetition`, expected `3` or more");return n}function h8(e,n,r){const l=(mE(r)+(r.options.ruleSpaces?" ":"")).repeat(d8(r));return r.options.ruleSpaces?l.slice(0,-1):l}const xE={blockquote:LL,break:Zb,code:VL,definition:$L,emphasis:oE,hardBreak:Zb,heading:XL,html:sE,image:uE,imageReference:cE,inlineCode:fE,link:hE,linkReference:pE,list:r8,listItem:l8,paragraph:a8,root:s8,strong:gE,text:f8,thematicBreak:h8};function p8(){return{enter:{table:m8,tableData:Kb,tableHeader:Kb,tableRow:x8},exit:{codeText:y8,table:g8,tableData:Rp,tableHeader:Rp,tableRow:Rp}}}function m8(e){const n=e._align;this.enter({type:"table",align:n.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function g8(e){this.exit(e),this.data.inTable=void 0}function x8(e){this.enter({type:"tableRow",children:[]},e)}function Rp(e){this.exit(e)}function Kb(e){this.enter({type:"tableCell",children:[]},e)}function y8(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,v8));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function v8(e,n){return n==="|"?n:e}function b8(e){const n=e||{},r=n.tableCellPadding,l=n.tablePipeAlign,a=n.stringLength,s=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:u,tableCell:d,tableRow:c}};function u(v,w,k,_){return h(m(v,k,_),v.align)}function c(v,w,k,_){const S=p(v,k,_),T=h([S]);return T.slice(0,T.indexOf(` +`))}function d(v,w,k,_){const S=k.enter("tableCell"),T=k.enter("phrasing"),E=k.containerPhrasing(v,{..._,before:s,after:s});return T(),S(),E}function h(v,w){return RL(v,{align:w,alignDelimiters:l,padding:r,stringLength:a})}function m(v,w,k){const _=v.children;let S=-1;const T=[],E=w.enter("table");for(;++S<_.length;)T[S]=p(_[S],w,k);return E(),T}function p(v,w,k){const _=v.children;let S=-1;const T=[],E=w.enter("tableRow");for(;++S<_.length;)T[S]=d(_[S],v,w,k);return E(),T}function x(v,w,k){let _=xE.inlineCode(v,w,k);return k.stack.includes("tableCell")&&(_=_.replace(/\|/g,"\\$&")),_}}function w8(){return{exit:{taskListCheckValueChecked:Jb,taskListCheckValueUnchecked:Jb,paragraph:_8}}}function S8(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:E8}}}function Jb(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function _8(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const l=r.children[0];if(l&&l.type==="text"){const a=n.children;let s=-1,u;for(;++s0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const B8={tokenize:Y8,partial:!0};function I8(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:P8,continuation:{tokenize:$8},exit:G8}},text:{91:{name:"gfmFootnoteCall",tokenize:V8},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:q8,resolveTo:U8}}}}function q8(e,n,r){const l=this;let a=l.events.length;const s=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let u;for(;a--;){const d=l.events[a][1];if(d.type==="labelImage"){u=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return c;function c(d){if(!u||!u._balanced)return r(d);const h=Yn(l.sliceSerialize({start:u.end,end:l.now()}));return h.codePointAt(0)!==94||!s.includes(h.slice(1))?r(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),n(d))}}function U8(e,n){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const l={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},c=[e[r+1],e[r+2],["enter",l,n],e[r+3],e[r+4],["enter",a,n],["exit",a,n],["enter",s,n],["enter",u,n],["exit",u,n],["exit",s,n],e[e.length-2],e[e.length-1],["exit",l,n]];return e.splice(r,e.length-r+1,...c),e}function V8(e,n,r){const l=this,a=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let s=0,u;return c;function c(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),d}function d(p){return p!==94?r(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(p){if(s>999||p===93&&!u||p===null||p===91||ot(p))return r(p);if(p===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return a.includes(Yn(l.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):r(p)}return ot(p)||(u=!0),s++,e.consume(p),p===92?m:h}function m(p){return p===91||p===92||p===93?(e.consume(p),s++,h):h(p)}}function P8(e,n,r){const l=this,a=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let s,u=0,c;return d;function d(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",m):r(w)}function m(w){if(u>999||w===93&&!c||w===null||w===91||ot(w))return r(w);if(w===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return s=Yn(l.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return ot(w)||(c=!0),u++,e.consume(w),w===92?p:m}function p(w){return w===91||w===92||w===93?(e.consume(w),u++,m):m(w)}function x(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),a.includes(s)||a.push(s),Ye(e,v,"gfmFootnoteDefinitionWhitespace")):r(w)}function v(w){return n(w)}}function $8(e,n,r){return e.check(ls,n,e.attempt(B8,n,r))}function G8(e){e.exit("gfmFootnoteDefinition")}function Y8(e,n,r){const l=this;return Ye(e,a,"gfmFootnoteDefinitionIndent",5);function a(s){const u=l.events[l.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?n(s):r(s)}}function F8(e){let r=(e||{}).singleTilde;const l={name:"strikethrough",tokenize:s,resolveAll:a};return r==null&&(r=!0),{text:{126:l},insideSpan:{null:[l]},attentionMarkers:{null:[126]}};function a(u,c){let d=-1;for(;++d1?d(w):(u.consume(w),p++,v);if(p<2&&!r)return d(w);const _=u.exit("strikethroughSequenceTemporary"),S=pa(w);return _._open=!S||S===2&&!!k,_._close=!k||k===2&&!!S,c(w)}}}class X8{constructor(){this.map=[]}add(n,r,l){Q8(this,n,r,l)}consume(n){if(this.map.sort(function(s,u){return s[0]-u[0]}),this.map.length===0)return;let r=this.map.length;const l=[];for(;r>0;)r-=1,l.push(n.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),n.length=this.map[r][0];l.push(n.slice()),n.length=0;let a=l.pop();for(;a;){for(const s of a)n.push(s);a=l.pop()}this.map.length=0}}function Q8(e,n,r,l){let a=0;if(!(r===0&&l.length===0)){for(;a-1;){const B=l.events[L][1].type;if(B==="lineEnding"||B==="linePrefix")L--;else break}const q=L>-1?l.events[L][1].type:null,ee=q==="tableHead"||q==="tableRow"?z:d;return ee===z&&l.parser.lazy[l.now().line]?r(O):ee(O)}function d(O){return e.enter("tableHead"),e.enter("tableRow"),h(O)}function h(O){return O===124||(u=!0,s+=1),m(O)}function m(O){return O===null?r(O):ke(O)?s>1?(s=0,l.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),v):r(O):Ie(O)?Ye(e,m,"whitespace")(O):(s+=1,u&&(u=!1,a+=1),O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),u=!0,m):(e.enter("data"),p(O)))}function p(O){return O===null||O===124||ot(O)?(e.exit("data"),m(O)):(e.consume(O),O===92?x:p)}function x(O){return O===92||O===124?(e.consume(O),p):p(O)}function v(O){return l.interrupt=!1,l.parser.lazy[l.now().line]?r(O):(e.enter("tableDelimiterRow"),u=!1,Ie(O)?Ye(e,w,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):w(O))}function w(O){return O===45||O===58?_(O):O===124?(u=!0,e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),k):U(O)}function k(O){return Ie(O)?Ye(e,_,"whitespace")(O):_(O)}function _(O){return O===58?(s+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),S):O===45?(s+=1,S(O)):O===null||ke(O)?A(O):U(O)}function S(O){return O===45?(e.enter("tableDelimiterFiller"),T(O)):U(O)}function T(O){return O===45?(e.consume(O),T):O===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(O))}function E(O){return Ie(O)?Ye(e,A,"whitespace")(O):A(O)}function A(O){return O===124?w(O):O===null||ke(O)?!u||a!==s?U(O):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(O)):U(O)}function U(O){return r(O)}function z(O){return e.enter("tableRow"),H(O)}function H(O){return O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),H):O===null||ke(O)?(e.exit("tableRow"),n(O)):Ie(O)?Ye(e,H,"whitespace")(O):(e.enter("data"),R(O))}function R(O){return O===null||O===124||ot(O)?(e.exit("data"),H(O)):(e.consume(O),O===92?V:R)}function V(O){return O===92||O===124?(e.consume(O),R):R(O)}}function W8(e,n){let r=-1,l=!0,a=0,s=[0,0,0,0],u=[0,0,0,0],c=!1,d=0,h,m,p;const x=new X8;for(;++rr[2]+1){const w=r[2]+1,k=r[3]-r[2]-1;e.add(w,k,[])}}e.add(r[3]+1,0,[["exit",p,n]])}return a!==void 0&&(s.end=Object.assign({},Kl(n.events,a)),e.add(a,0,[["exit",s,n]]),s=void 0),s}function Wb(e,n,r,l,a){const s=[],u=Kl(n.events,r);a&&(a.end=Object.assign({},u),s.push(["exit",a,n])),l.end=Object.assign({},u),s.push(["exit",l,n]),e.add(r+1,0,s)}function Kl(e,n){const r=e[n],l=r[0]==="enter"?"start":"end";return r[1][l]}const e9={name:"tasklistCheck",tokenize:n9};function t9(){return{text:{91:e9}}}function n9(e,n,r){const l=this;return a;function a(d){return l.previous!==null||!l._gfmTasklistFirstContentOfListItem?r(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),s)}function s(d){return ot(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),u):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),u):r(d)}function u(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),c):r(d)}function c(d){return ke(d)?n(d):Ie(d)?e.check({tokenize:r9},n,r)(d):r(d)}}function r9(e,n,r){return Ye(e,l,"whitespace");function l(a){return a===null?r(a):n(a)}}function i9(e){return L_([A8(),I8(),F8(e),K8(),t9()])}const l9={};function a9(e){const n=this,r=e||l9,l=n.data(),a=l.micromarkExtensions||(l.micromarkExtensions=[]),s=l.fromMarkdownExtensions||(l.fromMarkdownExtensions=[]),u=l.toMarkdownExtensions||(l.toMarkdownExtensions=[]);a.push(i9(r)),s.push(k8()),u.push(N8(r))}function o9({node:e}){const n=he(E=>E.sendGateResponse),r=he(E=>E.wsStatus),[l,a]=P.useState(null),[s,u]=P.useState(""),[c,d]=P.useState(null),[h,m]=P.useState(!1),p=e.status==="waiting",x=e.status==="completed";P.useEffect(()=>{p&&(a(null),u(""),d(null),m(!1))},[p]);const v=p&&r==="connected"&&l===null,w=(E,A)=>{if(v){if(A){a(E),d(A);return}a(E),m(!0),n(e.name,E)}},k=()=>{if(l===null||c===null)return;const E={[c]:s};m(!0),n(e.name,l,E),d(null)},_=e.option_details,S=_==null?void 0:_.find(E=>E.value===e.selected_option),T=(S==null?void 0:S.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(Op,{text:e.prompt,muted:!1})}),_&&_.length>0&&b.jsxs("div",{className:"space-y-2",children:[b.jsx("div",{className:"flex flex-col gap-1.5",children:_.map(E=>{const A=l===E.value,U=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":U?"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(Yi,{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 ${U?"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&&!c&&b.jsxs("div",{className:"flex items-center gap-2 px-1",children:[b.jsx(Do,{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"})]}),!_&&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))})]}),c&&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:c})}),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 ${c}...`,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(sN,{className:"w-3 h-3"}),"Submit"]})]})]})]})]}),x&&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(Yi,{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(Op,{text:e.prompt,muted:!0})}),T&&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(Yi,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),b.jsx("span",{className:"text-xs font-medium text-[var(--text)]",children:T}),e.route&&b.jsxs("span",{className:"ml-auto text-[10px] text-[var(--text-muted)]",children:["→ ",e.route]})]}),_&&_.length>1&&b.jsx("div",{className:"space-y-1",children:_.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))}),!_&&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(u9,{node:e})]}),!p&&!x&&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(Op,{text:e.prompt,muted:!0})})]})]})}function s9(e){return!(!e||/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//")||e.startsWith("#")||e.startsWith("/")||e.startsWith("\\"))}function Op({text:e,muted:n}){const r=n?"text-[var(--text-muted)]":"text-[var(--text)]";return b.jsx("div",{className:`gate-markdown text-xs leading-relaxed ${r}`,children:b.jsx(F6,{remarkPlugins:[a9],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:a})=>(a==null?void 0:a.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:a})=>{if(s9(l)){const s=`vscode://file/${l}`;return b.jsxs("a",{href:s,className:"inline-flex items-center gap-0.5 text-blue-400 hover:text-blue-300 underline underline-offset-2",title:`Open ${l} in VSCode`,children:[b.jsx(nN,{className:"w-3 h-3 inline flex-shrink-0"}),a]})}return b.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:text-blue-300 underline underline-offset-2",children:a})},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"}),table:({children:l})=>b.jsx("div",{className:"overflow-x-auto my-2",children:b.jsx("table",{className:"text-[11px] border-collapse w-full",children:l})}),th:({children:l})=>b.jsx("th",{className:"border border-[var(--border)] px-2 py-1 text-left bg-[var(--bg)] font-semibold",children:l}),td:({children:l})=>b.jsx("td",{className:"border border-[var(--border)] px-2 py-1",children:l})},children:e})})}function u9({node:e}){const n=[];if(e.route&&n.push({label:"Route",value:`→ ${e.route}`}),e.additional_input){const r=typeof e.additional_input=="object"?JSON.stringify(e.additional_input):e.additional_input;n.push({label:"Additional Input",value:r})}return n.length===0?null:b.jsx(ll,{items:n})}function c9({node:e}){const n=e.status,r=Xe[n]||Xe.pending,a=p4()[e.name],s=e.type==="for_each_group",[u,c]=P.useState(!0),d=[];e.elapsed!=null&&d.push({label:"Elapsed",value:Jt(e.elapsed)}),a&&(d.push({label:"Total",value:a.total}),d.push({label:"Completed",value:a.completed}),a.failed>0&&d.push({label:"Failed",value:a.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:`${r}20`,color:r},children:n}),b.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s?"For-Each Group":"Parallel Group"})]}),a&&a.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:[a.completed+a.failed,"/",a.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:`${(a.completed+a.failed)/a.total*100}%`,background:a.failed>0?`linear-gradient(90deg, var(--completed) ${a.completed/(a.completed+a.failed)*100}%, var(--failed) 0%)`:"var(--completed)"}})})]}),b.jsx(ll,{items:d}),s&&h&&h.length>0&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("button",{onClick:()=>c(!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(rl,{className:"w-3 h-3"}):b.jsx(Dr,{className:"w-3 h-3"}),"Items (",h.length,")"]}),u&&b.jsx("div",{className:"space-y-1",children:h.map(m=>b.jsx(d9,{item:m},`${m.key}-${m.index}`))})]})]})}const f9={running:Xe.running,completed:Xe.completed,failed:Xe.failed};function d9({item:e}){const[n,r]=P.useState(e.status==="running"),l=f9[e.status],a=!!(e.prompt||e.output!=null||e.activity&&e.activity.length>0||e.error_type),s=[];return e.elapsed!=null&&s.push({label:"Elapsed",value:Jt(e.elapsed)}),e.tokens!=null&&s.push({label:"Tokens",value:$n(e.tokens)}),e.cost_usd!=null&&s.push({label:"Cost",value:yi(e.cost_usd)}),b.jsxs("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--surface)] overflow-hidden",children:[b.jsxs("button",{onClick:()=>a&&r(!n),className:"flex items-center gap-2 w-full px-3 py-2 text-left hover:bg-[var(--node-bg)] transition-colors",disabled:!a,children:[a?n?b.jsx(rl,{className:"w-3 h-3 text-[var(--text-muted)] flex-shrink-0"}):b.jsx(Dr,{className:"w-3 h-3 text-[var(--text-muted)] flex-shrink-0"}):e.status==="running"?b.jsx(Do,{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:Jt(e.elapsed)}),e.tokens!=null&&b.jsx("span",{children:$n(e.tokens)}),e.cost_usd!=null&&b.jsx("span",{children:yi(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&&a&&b.jsxs("div",{className:"px-3 py-3 space-y-3 border-t border-[var(--border)]",children:[s.length>0&&b.jsx(ll,{items:s}),e.prompt&&b.jsx(tl,{output:e.prompt,title:"Input / Prompt",defaultExpanded:!1}),e.activity&&e.activity.length>0&&b.jsx(Lm,{activity:e.activity,defaultExpanded:e.status!=="completed"}),e.output!=null&&b.jsx(tl,{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 h9({node:e}){const n=e.status,r=Xe[n]||Xe.pending,l=he(c=>c.navigateIntoSubworkflow),s=p_().filter(c=>c.parentAgent===e.name),u=[];return e.elapsed!=null&&u.push({label:"Elapsed",value:Jt(e.elapsed)}),e.cost_usd!=null&&u.push({label:"Cost",value:yi(e.cost_usd)}),e.tokens!=null&&u.push({label:"Tokens",value:$n(e.tokens)}),e.iteration!=null&&e.iteration>1&&u.push({label:"Iteration",value:e.iteration}),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:`${r}20`,color:r},children:n}),b.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Subworkflow Agent"})]}),b.jsx(ll,{items:u}),s.length>0&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)] font-semibold",children:["Subworkflow Runs (",s.length,")"]}),b.jsx("div",{className:"space-y-1",children:s.map((c,d)=>b.jsx(p9,{ctx:c,onClick:()=>l(e.name,c.iteration)},`${c.parentAgent}-${c.iteration}-${d}`))})]}),n==="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]})]}),s.length===0&&n==="pending"&&b.jsx("div",{className:"text-xs text-[var(--text-muted)] italic",children:"Subworkflow has not started yet."})]})}function p9({ctx:e,onClick:n}){const r=Xe[e.status]||Xe.pending;return b.jsxs("button",{onClick:n,className:"flex items-center gap-2 w-full px-3 py-2 rounded-lg border border-[var(--border)] bg-[var(--surface)] hover:bg-[var(--node-bg)] transition-colors text-left",children:[b.jsx(fm,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r}}),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:e.workflowName||e.workflowFile||"Subworkflow"}),b.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-[var(--text-muted)]",children:[e.agentsTotal>0&&b.jsxs("span",{className:"flex items-center gap-0.5",children:[b.jsx(ow,{className:"w-2.5 h-2.5"}),e.agentsCompleted,"/",e.agentsTotal," agents"]}),e.totalCost>0&&b.jsxs("span",{className:"flex items-center gap-0.5",children:[b.jsx(lw,{className:"w-2.5 h-2.5"}),yi(e.totalCost)]})]})]}),b.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider flex-shrink-0 px-1.5 py-0.5 rounded",style:{backgroundColor:`${r}20`,color:r},children:e.status}),b.jsx(Dr,{className:"w-3.5 h-3.5 flex-shrink-0 text-[var(--text-muted)]"})]})}function m9(){const e=he(c=>c.selectedNode),n=il(),r=he(c=>c.selectNode),[l,a]=P.useState(!1);P.useEffect(()=>(requestAnimationFrame(()=>a(!0)),()=>a(!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 L5;case"human_gate":return o9;case"parallel_group":case"for_each_group":return c9;case"workflow":return h9;default:return R5}})();return b.jsxs("div",{className:Be("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:()=>r(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(Qo,{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 nc(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function g9(){const e=he(_=>_.eventLog),n=he(_=>_.activityLog),r=he(_=>_.workflowOutput),l=he(_=>_.workflowStatus),[a,s]=P.useState("log"),[u,c]=P.useState(!1),[d,h]=P.useState(0),[m,p]=P.useState(0),x=P.useCallback(_=>{s(_),_==="log"&&h(e.length),_==="activity"&&p(n.length)},[e.length,n.length]);P.useEffect(()=>{a==="log"&&h(e.length)},[a,e.length]),P.useEffect(()=>{a==="activity"&&p(n.length)},[a,n.length]),P.useEffect(()=>{l==="completed"&&r!=null&&s("output")},[l,r]);const v=r!=null,w=a!=="log"?Math.max(0,e.length-d):0,k=a!=="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:()=>c(!1),className:"flex items-center gap-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)] transition-colors",children:[b.jsx(Q2,{className:"w-3 h-3"}),b.jsx(Fy,{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(Lp,{active:a==="log",onClick:()=>x("log"),icon:b.jsx(Fy,{className:"w-3 h-3"}),label:"Log",count:e.length,unread:w}),b.jsx(Lp,{active:a==="activity",onClick:()=>x("activity"),icon:b.jsx(iw,{className:"w-3 h-3"}),label:"Activity",count:n.length,unread:k}),b.jsx(Lp,{active:a==="output",onClick:()=>x("output"),icon:b.jsx(tN,{className:"w-3 h-3"}),label:"Output",badge:v?l==="failed"?"error":"success":void 0})]}),b.jsx("button",{onClick:()=>c(!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(rl,{className:"w-3.5 h-3.5"})})]}),b.jsx("div",{className:"flex-1 overflow-hidden",children:a==="activity"?b.jsx(x9,{entries:n}):a==="log"?b.jsx(y9,{entries:e}):b.jsx(v9,{output:r,status:l})})]})}function Lp({active:e,onClick:n,icon:r,label:l,count:a,badge:s,unread:u}){return b.jsxs("button",{onClick:n,className:Be("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:[r,b.jsx("span",{children:l}),a!=null&&a>0&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] tabular-nums",children:a}),s&&b.jsx("span",{className:Be("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 ew={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 x9({entries:e}){const n=P.useRef(null),r=P.useRef(!0),l=he(d=>d.selectNode),[a,s]=P.useState(""),u=P.useCallback(()=>{const d=n.current;if(!d)return;const h=d.scrollHeight-d.scrollTop-d.clientHeight<30;r.current=h},[]),c=P.useMemo(()=>{if(!a)return e;const d=a.toLowerCase();return e.filter(h=>h.source.toLowerCase().includes(d)||nc(h.message).toLowerCase().includes(d))},[e,a]);return P.useEffect(()=>{n.current&&r.current&&(n.current.scrollTop=n.current.scrollHeight)},[c.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:a,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"}),a&&b.jsxs(b.Fragment,{children:[b.jsxs("span",{className:"text-[10px] text-[var(--text-muted)] tabular-nums flex-shrink-0",children:[c.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(Qo,{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:[c.map((d,h)=>{const m=ew[d.type]||ew.message,p=NE(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:Be("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:Be("break-words min-w-0",m.color,d.type==="reasoning"&&"italic"),children:nc(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:nc(d.detail)})]},h)}),a&&c.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 "',a,'"']})})]})]})}const tw={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 y9({entries:e}){const n=P.useRef(null),r=P.useRef(!0),l=he(s=>s.selectNode),a=P.useCallback(()=>{const s=n.current;if(!s)return;const u=s.scrollHeight-s.scrollTop-s.clientHeight<30;r.current=u},[]);return P.useEffect(()=>{n.current&&r.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:a,className:"h-full overflow-y-auto font-mono text-[11px] leading-[1.6] px-3 py-2",children:e.map((s,u)=>{const c=tw[s.level]||tw.info,d=NE(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:Be("flex-shrink-0 w-3 text-center select-none",c.color),children:c.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:Be("break-words",s.level==="error"?"text-red-400":s.level==="success"?"text-green-400":"text-[var(--text)]"),children:nc(s.message)})]},u)})})}function NE(e){const n=new Date(e*1e3),r=n.getHours().toString().padStart(2,"0"),l=n.getMinutes().toString().padStart(2,"0"),a=n.getSeconds().toString().padStart(2,"0");return`${r}:${l}:${a}`}function v9({output:e,status:n}){const[r,l]=P.useState(!1),a=uw(e),s=async()=>{a&&(await navigator.clipboard.writeText(a),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:r?b.jsxs(b.Fragment,{children:[b.jsx(Yi,{className:"w-3 h-3 text-[var(--completed)]"}),b.jsx("span",{className:"text-[var(--completed)]",children:"Copied"})]}):b.jsxs(b.Fragment,{children:[b.jsx(aw,{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(b9,{text:a}):a})})]})}function b9({text:e}){const n=e.split(/("(?:[^"\\]|\\.)*")/g);return b.jsx(b.Fragment,{children:n.map((r,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:r},l)}const a=r.replace(/\b(true|false|null)\b|(-?\d+\.?\d*(?:e[+-]?\d+)?)/gi,(s,u,c)=>u?`${s}`:c?`${s}`:s);return b.jsx("span",{dangerouslySetInnerHTML:{__html:a}},l)})})}function w9(){const e=he(n=>n.selectedNode);return b.jsxs(Bp,{direction:"vertical",className:"flex-1 overflow-hidden",children:[b.jsx(So,{defaultSize:70,minSize:30,children:b.jsxs(Bp,{direction:"horizontal",className:"h-full",children:[b.jsx(So,{defaultSize:e?65:100,minSize:40,children:b.jsx(T5,{})}),e&&b.jsxs(b.Fragment,{children:[b.jsx(Ip,{className:"w-[3px] bg-[var(--border)] hover:bg-[var(--text-muted)] transition-colors cursor-col-resize"}),b.jsx(So,{defaultSize:35,minSize:20,maxSize:60,children:b.jsx(m9,{})})]})]})}),b.jsx(Ip,{className:"h-[3px] bg-[var(--border)] hover:bg-[var(--text-muted)] transition-colors cursor-row-resize"}),b.jsx(So,{defaultSize:30,minSize:5,maxSize:70,collapsible:!0,children:b.jsx(g9,{})})]})}const S9=3e4;function _9(){const e=he(p=>p.processEvent),n=he(p=>p.replayState),r=he(p=>p.setWsStatus),l=he(p=>p.setWsSend),a=P.useRef(null),s=P.useRef(1e3),u=P.useRef(null),c=P.useRef(null),d=P.useRef(()=>{}),h=P.useCallback(()=>{r("reconnecting"),u.current=setTimeout(()=>{s.current=Math.min(s.current*2,S9),d.current()},s.current)},[r]),m=P.useCallback(()=>{r("connecting"),c.current&&c.current.abort();const p=new AbortController;c.current=p,fetch("/api/state",{signal:p.signal}).then(x=>x.json()).then(x=>{x&&x.length>0&&n(x);const w=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;try{const k=new WebSocket(w);a.current=k,k.onopen=()=>{s.current=1e3,r("connected"),l(_=>{k.readyState===WebSocket.OPEN&&k.send(JSON.stringify(_))})},k.onmessage=_=>{try{const S=JSON.parse(_.data);e(S)}catch(S){console.error("Failed to parse WebSocket message:",S)}},k.onclose=()=>{r("disconnected"),l(null),a.current=null,h()},k.onerror=()=>{}}catch{h()}}).catch(x=>{p.signal.aborted||(console.error("Failed to fetch state:",x),h())})},[e,n,r,l,h]);d.current=m,P.useEffect(()=>(m(),()=>{c.current&&c.current.abort(),u.current&&clearTimeout(u.current),a.current&&a.current.close(),l(null)}),[m,l])}function E9(){const e=he(h=>h.setReplayMode),n=he(h=>h.setWsStatus),r=he(h=>h.replayPlaying),l=he(h=>h.replayPosition),a=he(h=>h.replayTotalEvents),s=he(h=>h.replaySpeed),u=he(h=>h.replayEvents),c=he(h=>h.setReplayPosition);P.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=P.useRef(null);P.useEffect(()=>{if(!r||l>=a){d.current&&clearTimeout(d.current),r&&l>=a&&he.getState().setReplayPlaying(!1);return}const h=u[l-1],m=u[l];let p=100;if(h&&m){const x=(m.timestamp-h.timestamp)*1e3;p=Math.max(16,Math.min(x/s,2e3))}return d.current=setTimeout(()=>{c(l+1)},p),()=>{d.current&&clearTimeout(d.current)}},[r,l,a,s,u,c])}function k9(){return _9(),null}function N9(){return E9(),null}function C9(){const[e,n]=P.useState(null),r=he(s=>s.replayMode),l=he(s=>s.selectNode),a=he(s=>s.workflowName);return P.useEffect(()=>{fetch("/api/replay/info").then(s=>{s.ok?n(!0):n(!1)}).catch(()=>n(!1))},[]),P.useEffect(()=>{document.title=a?`Conductor — ${a}`:"Conductor Dashboard"},[a]),P.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(N9,{}):b.jsx(k9,{}),b.jsx(EN,{}),b.jsx(kN,{}),b.jsx(w9,{}),r?b.jsx(zN,{}):b.jsx(CN,{})]})}$2.createRoot(document.getElementById("root")).render(b.jsx(P.StrictMode,{children:b.jsx(C9,{})})); diff --git a/src/conductor/web/static/index.html b/src/conductor/web/static/index.html index 5661541..c25bcd6 100644 --- a/src/conductor/web/static/index.html +++ b/src/conductor/web/static/index.html @@ -5,7 +5,7 @@ Conductor Dashboard - + From 4236432cd14f5a16e36df3fb82ecb7628667db6f Mon Sep 17 00:00:00 2001 From: Daniel Green Date: Fri, 1 May 2026 15:32:42 -0700 Subject: [PATCH 5/8] build: rebuild frontend static assets with markdown support Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../web/static/assets/index-B6uxNJC4.js | 331 ------------------ .../web/static/assets/index-BEVW8bp2.css | 1 + .../web/static/assets/index-Cq5A-RoD.js | 306 ---------------- .../web/static/assets/index-DHEpYuxn.css | 1 - .../web/static/assets/index-DOzcs-W0.js | 326 +++++++++++++++++ src/conductor/web/static/index.html | 4 +- 6 files changed, 329 insertions(+), 640 deletions(-) delete mode 100644 src/conductor/web/static/assets/index-B6uxNJC4.js create mode 100644 src/conductor/web/static/assets/index-BEVW8bp2.css delete mode 100644 src/conductor/web/static/assets/index-Cq5A-RoD.js delete mode 100644 src/conductor/web/static/assets/index-DHEpYuxn.css create mode 100644 src/conductor/web/static/assets/index-DOzcs-W0.js diff --git a/src/conductor/web/static/assets/index-B6uxNJC4.js b/src/conductor/web/static/assets/index-B6uxNJC4.js deleted file mode 100644 index efc773e..0000000 --- a/src/conductor/web/static/assets/index-B6uxNJC4.js +++ /dev/null @@ -1,331 +0,0 @@ -var j2=Object.defineProperty;var D2=(e,n,r)=>n in e?j2(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var Ct=(e,n,r)=>D2(e,typeof n!="symbol"?n+"":n,r);function R2(e,n){for(var r=0;rl[a]})}}}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 a of document.querySelectorAll('link[rel="modulepreload"]'))l(a);new MutationObserver(a=>{for(const s of a)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 r(a){const s={};return a.integrity&&(s.integrity=a.integrity),a.referrerPolicy&&(s.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?s.credentials="include":a.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function l(a){if(a.ep)return;a.ep=!0;const s=r(a);fetch(a.href,s)}})();function Fo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var th={exports:{}},fo={};/** - * @license React - * react-jsx-runtime.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Hy;function O2(){if(Hy)return fo;Hy=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(l,a,s){var u=null;if(s!==void 0&&(u=""+s),a.key!==void 0&&(u=""+a.key),"key"in a){s={};for(var c in a)c!=="key"&&(s[c]=a[c])}else s=a;return a=s.ref,{$$typeof:e,type:l,key:u,ref:a!==void 0?a:null,props:s}}return fo.Fragment=n,fo.jsx=r,fo.jsxs=r,fo}var By;function L2(){return By||(By=1,th.exports=O2()),th.exports}var b=L2(),nh={exports:{}},Ae={};/** - * @license React - * react.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Iy;function H2(){if(Iy)return Ae;Iy=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),u=Symbol.for("react.context"),c=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"),x=Symbol.iterator;function v(I){return I===null||typeof I!="object"?null:(I=x&&I[x]||I["@@iterator"],typeof I=="function"?I:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,_={};function S(I,F,N){this.props=I,this.context=F,this.refs=_,this.updater=N||w}S.prototype.isReactComponent={},S.prototype.setState=function(I,F){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,F,"setState")},S.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function T(){}T.prototype=S.prototype;function E(I,F,N){this.props=I,this.context=F,this.refs=_,this.updater=N||w}var A=E.prototype=new T;A.constructor=E,k(A,S.prototype),A.isPureReactComponent=!0;var U=Array.isArray;function z(){}var H={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function V(I,F,N){var G=N.ref;return{$$typeof:e,type:I,key:F,ref:G!==void 0?G:null,props:N}}function O(I,F){return V(I.type,F,I.props)}function L(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function q(I){var F={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(N){return F[N]})}var ee=/\/+/g;function B(I,F){return typeof I=="object"&&I!==null&&I.key!=null?q(""+I.key):F.toString(36)}function $(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(z,z):(I.status="pending",I.then(function(F){I.status==="pending"&&(I.status="fulfilled",I.value=F)},function(F){I.status==="pending"&&(I.status="rejected",I.reason=F)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function M(I,F,N,G,X){var J=typeof I;(J==="undefined"||J==="boolean")&&(I=null);var ne=!1;if(I===null)ne=!0;else switch(J){case"bigint":case"string":case"number":ne=!0;break;case"object":switch(I.$$typeof){case e:case n:ne=!0;break;case m:return ne=I._init,M(ne(I._payload),F,N,G,X)}}if(ne)return X=X(I),ne=G===""?"."+B(I,0):G,U(X)?(N="",ne!=null&&(N=ne.replace(ee,"$&/")+"/"),M(X,F,N,"",function(xe){return xe})):X!=null&&(L(X)&&(X=O(X,N+(X.key==null||I&&I.key===X.key?"":(""+X.key).replace(ee,"$&/")+"/")+ne)),F.push(X)),1;ne=0;var re=G===""?".":G+":";if(U(I))for(var se=0;se>>1,j=M[K];if(0>>1;Ka(N,Q))Ga(X,N)?(M[K]=X,M[G]=Q,K=G):(M[K]=N,M[F]=Q,K=F);else if(Ga(X,Q))M[K]=X,M[G]=Q,K=G;else break e}}return Y}function a(M,Y){var Q=M.sortIndex-Y.sortIndex;return Q!==0?Q:M.id-Y.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,c=u.now();e.unstable_now=function(){return u.now()-c}}var d=[],h=[],m=1,p=null,x=3,v=!1,w=!1,k=!1,_=!1,S=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function A(M){for(var Y=r(h);Y!==null;){if(Y.callback===null)l(h);else if(Y.startTime<=M)l(h),Y.sortIndex=Y.expirationTime,n(d,Y);else break;Y=r(h)}}function U(M){if(k=!1,A(M),!w)if(r(d)!==null)w=!0,z||(z=!0,q());else{var Y=r(h);Y!==null&&$(U,Y.startTime-M)}}var z=!1,H=-1,R=5,V=-1;function O(){return _?!0:!(e.unstable_now()-VM&&O());){var K=p.callback;if(typeof K=="function"){p.callback=null,x=p.priorityLevel;var j=K(p.expirationTime<=M);if(M=e.unstable_now(),typeof j=="function"){p.callback=j,A(M),Y=!0;break t}p===r(d)&&l(d),A(M)}else l(d);p=r(d)}if(p!==null)Y=!0;else{var I=r(h);I!==null&&$(U,I.startTime-M),Y=!1}}break e}finally{p=null,x=Q,v=!1}Y=void 0}}finally{Y?q():z=!1}}}var q;if(typeof E=="function")q=function(){E(L)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,B=ee.port2;ee.port1.onmessage=L,q=function(){B.postMessage(null)}}else q=function(){S(L,0)};function $(M,Y){H=S(function(){M(e.unstable_now())},Y)}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(M){M.callback=null},e.unstable_forceFrameRate=function(M){0>M||125K?(M.sortIndex=Q,n(h,M),r(d)===null&&M===r(h)&&(k?(T(H),H=-1):k=!0,$(U,Q-K))):(M.sortIndex=j,n(d,M),w||v||(w=!0,z||(z=!0,q()))),M},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(M){var Y=x;return function(){var Q=x;x=Y;try{return M.apply(this,arguments)}finally{x=Q}}}})(lh)),lh}var Vy;function q2(){return Vy||(Vy=1,ih.exports=I2()),ih.exports}var ah={exports:{}},Gt={};/** - * @license React - * react-dom.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Py;function U2(){if(Py)return Gt;Py=1;var e=Xo();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(),ah.exports=U2(),ah.exports}/** - * @license React - * react-dom-client.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Gy;function V2(){if(Gy)return ho;Gy=1;var e=q2(),n=Xo(),r=nw();function l(t){var i="https://react.dev/errors/"+t;if(1j||(t.current=K[j],K[j]=null,j--)}function N(t,i){j++,K[j]=t.current,t.current=i}var G=I(null),X=I(null),J=I(null),ne=I(null);function re(t,i){switch(N(J,i),N(X,t),N(G,null),i.nodeType){case 9:case 11:t=(t=i.documentElement)&&(t=t.namespaceURI)?ay(t):0;break;default:if(t=i.tagName,i=i.namespaceURI)i=ay(i),t=oy(i,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}F(G),N(G,t)}function se(){F(G),F(X),F(J)}function xe(t){t.memoizedState!==null&&N(ne,t);var i=G.current,o=oy(i,t.type);i!==o&&(N(X,t),N(G,o))}function ve(t){X.current===t&&(F(G),F(X)),ne.current===t&&(F(ne),oo._currentValue=Q)}var ye,pe;function _e(t){if(ye===void 0)try{throw Error()}catch(o){var i=o.stack.trim().match(/\n( *(at )?)/);ye=i&&i[1]||"",pe=-1)":-1g||Z[f]!==le[g]){var ce=` -`+Z[f].replace(" at new "," at ");return t.displayName&&ce.includes("")&&(ce=ce.replace("",t.displayName)),ce}while(1<=f&&0<=g);break}}}finally{Me=!1,Error.prepareStackTrace=o}return(o=t?t.displayName||t.name:"")?_e(o):""}function ct(t,i){switch(t.tag){case 26:case 27:case 5:return _e(t.type);case 16:return _e("Lazy");case 13:return t.child!==i&&i!==null?_e("Suspense Fallback"):_e("Suspense");case 19:return _e("SuspenseList");case 0:case 15:return Te(t.type,!1);case 11:return Te(t.type.render,!1);case 1:return Te(t.type,!0);case 31:return _e("Activity");default:return""}}function nt(t){try{var i="",o=null;do i+=ct(t,o),o=t,t=t.return;while(t);return i}catch(f){return` -Error generating stack: `+f.message+` -`+f.stack}}var Mt=Object.prototype.hasOwnProperty,Vt=e.unstable_scheduleCallback,Lt=e.unstable_cancelCallback,En=e.unstable_shouldYield,Rn=e.unstable_requestPaint,jt=e.unstable_now,Lr=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,ge=e.unstable_UserBlockingPriority,Ne=e.unstable_NormalPriority,Oe=e.unstable_LowPriority,Ge=e.unstable_IdlePriority,Qt=e.log,On=e.unstable_setDisableYieldValue,Ht=null,vt=null;function Pt(t){if(typeof Qt=="function"&&On(t),vt&&typeof vt.setStrictMode=="function")try{vt.setStrictMode(Ht,t)}catch{}}var We=Math.clz32?Math.clz32:Vc,Qn=Math.log,fn=Math.LN2;function Vc(t){return t>>>=0,t===0?32:31-(Qn(t)/fn|0)|0}var ol=256,sl=262144,ul=4194304;function or(t){var i=t&42;if(i!==0)return i;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 cl(t,i,o){var f=t.pendingLanes;if(f===0)return 0;var g=0,y=t.suspendedLanes,C=t.pingedLanes;t=t.warmLanes;var D=f&134217727;return D!==0?(f=D&~y,f!==0?g=or(f):(C&=D,C!==0?g=or(C):o||(o=D&~t,o!==0&&(g=or(o))))):(D=f&~y,D!==0?g=or(D):C!==0?g=or(C):o||(o=f&~t,o!==0&&(g=or(o)))),g===0?0:i!==0&&i!==g&&(i&y)===0&&(y=g&-g,o=i&-i,y>=o||y===32&&(o&4194048)!==0)?i:g}function bi(t,i){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&i)===0}function Pc(t,i){switch(t){case 1:case 2:case 4:case 8:case 64:return i+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 i+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 os(){var t=ul;return ul<<=1,(ul&62914560)===0&&(ul=4194304),t}function ya(t){for(var i=[],o=0;31>o;o++)i.push(t);return i}function wi(t,i){t.pendingLanes|=i,i!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function $c(t,i,o,f,g,y){var C=t.pendingLanes;t.pendingLanes=o,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=o,t.entangledLanes&=o,t.errorRecoveryDisabledLanes&=o,t.shellSuspendCounter=0;var D=t.entanglements,Z=t.expirationTimes,le=t.hiddenUpdates;for(o=C&~o;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Qc=/[\n"\\]/g;function en(t){return t.replace(Qc,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Ei(t,i,o,f,g,y,C,D){t.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?t.type=C:t.removeAttribute("type"),i!=null?C==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+Wt(i)):t.value!==""+Wt(i)&&(t.value=""+Wt(i)):C!=="submit"&&C!=="reset"||t.removeAttribute("value"),i!=null?_a(t,C,Wt(i)):o!=null?_a(t,C,Wt(o)):f!=null&&t.removeAttribute("value"),g==null&&y!=null&&(t.defaultChecked=!!y),g!=null&&(t.checked=g&&typeof g!="function"&&typeof g!="symbol"),D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?t.name=""+Wt(D):t.removeAttribute("name")}function bs(t,i,o,f,g,y,C,D){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(t.type=y),i!=null||o!=null){if(!(y!=="submit"&&y!=="reset"||i!=null)){Vr(t);return}o=o!=null?""+Wt(o):"",i=i!=null?""+Wt(i):o,D||i===t.value||(t.value=i),t.defaultValue=i}f=f??g,f=typeof f!="function"&&typeof f!="symbol"&&!!f,t.checked=D?t.checked:!!f,t.defaultChecked=!!f,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(t.name=C),Vr(t)}function _a(t,i,o){i==="number"&&_i(t.ownerDocument)===t||t.defaultValue===""+o||(t.defaultValue=""+o)}function cr(t,i,o,f){if(t=t.options,i){i={};for(var g=0;g"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ef=!1;if(dr)try{var ka={};Object.defineProperty(ka,"passive",{get:function(){ef=!0}}),window.addEventListener("test",ka,ka),window.removeEventListener("test",ka,ka)}catch{ef=!1}var Pr=null,tf=null,Ss=null;function og(){if(Ss)return Ss;var t,i=tf,o=i.length,f,g="value"in Pr?Pr.value:Pr.textContent,y=g.length;for(t=0;t=Ta),hg=" ",pg=!1;function mg(t,i){switch(t){case"keyup":return ek.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var xl=!1;function nk(t,i){switch(t){case"compositionend":return gg(i);case"keypress":return i.which!==32?null:(pg=!0,hg);case"textInput":return t=i.data,t===hg&&pg?null:t;default:return null}}function rk(t,i){if(xl)return t==="compositionend"||!of&&mg(t,i)?(t=og(),Ss=tf=Pr=null,xl=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1=i)return{node:o,offset:i-t};t=f}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Eg(o)}}function Ng(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?Ng(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function Cg(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var i=_i(t.document);i instanceof t.HTMLIFrameElement;){try{var o=typeof i.contentWindow.location.href=="string"}catch{o=!1}if(o)t=i.contentWindow;else break;i=_i(t.document)}return i}function cf(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i&&(i==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||i==="textarea"||t.contentEditable==="true")}var fk=dr&&"documentMode"in document&&11>=document.documentMode,yl=null,ff=null,ja=null,df=!1;function Tg(t,i,o){var f=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;df||yl==null||yl!==_i(f)||(f=yl,"selectionStart"in f&&cf(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),ja&&Ma(ja,f)||(ja=f,f=mu(ff,"onSelect"),0>=C,g-=C,Kn=1<<32-We(i)+g|o<je?(Ue=Se,Se=null):Ue=Se.sibling;var Ze=ae(te,Se,ie[je],fe);if(Ze===null){Se===null&&(Se=Ue);break}t&&Se&&Ze.alternate===null&&i(te,Se),W=y(Ze,W,je),Qe===null?Ee=Ze:Qe.sibling=Ze,Qe=Ze,Se=Ue}if(je===ie.length)return o(te,Se),Pe&&pr(te,je),Ee;if(Se===null){for(;jeje?(Ue=Se,Se=null):Ue=Se.sibling;var fi=ae(te,Se,Ze.value,fe);if(fi===null){Se===null&&(Se=Ue);break}t&&Se&&fi.alternate===null&&i(te,Se),W=y(fi,W,je),Qe===null?Ee=fi:Qe.sibling=fi,Qe=fi,Se=Ue}if(Ze.done)return o(te,Se),Pe&&pr(te,je),Ee;if(Se===null){for(;!Ze.done;je++,Ze=ie.next())Ze=de(te,Ze.value,fe),Ze!==null&&(W=y(Ze,W,je),Qe===null?Ee=Ze:Qe.sibling=Ze,Qe=Ze);return Pe&&pr(te,je),Ee}for(Se=f(Se);!Ze.done;je++,Ze=ie.next())Ze=oe(Se,te,je,Ze.value,fe),Ze!==null&&(t&&Ze.alternate!==null&&Se.delete(Ze.key===null?je:Ze.key),W=y(Ze,W,je),Qe===null?Ee=Ze:Qe.sibling=Ze,Qe=Ze);return t&&Se.forEach(function(M2){return i(te,M2)}),Pe&&pr(te,je),Ee}function lt(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){o(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===R&&Ri(Ee)===W.type){o(te,W.sibling),fe=g(W,ie.props),Ba(fe,ie),fe.return=te,te=fe;break e}o(te,W);break}else i(te,W);W=W.sibling}ie.type===k?(fe=Ai(ie.props.children,te.mode,fe,ie.key),fe.return=te,te=fe):(fe=js(ie.type,ie.key,ie.props,null,te.mode,fe),Ba(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){o(te,W.sibling),fe=g(W,ie.children||[]),fe.return=te,te=fe;break e}else{o(te,W);break}else i(te,W);W=W.sibling}fe=vf(ie,te.mode,fe),fe.return=te,te=fe}return C(te);case R:return ie=Ri(ie),lt(te,W,ie,fe)}if($(ie))return we(te,W,ie,fe);if(q(ie)){if(Ee=q(ie),typeof Ee!="function")throw Error(l(150));return ie=Ee.call(ie),Ce(te,W,ie,fe)}if(typeof ie.then=="function")return lt(te,W,Is(ie),fe);if(ie.$$typeof===E)return lt(te,W,Os(te,ie),fe);qs(te,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,W!==null&&W.tag===6?(o(te,W.sibling),fe=g(W,ie),fe.return=te,te=fe):(o(te,W),fe=yf(ie,te.mode,fe),fe.return=te,te=fe),C(te)):o(te,W)}return function(te,W,ie,fe){try{Ha=0;var Ee=lt(te,W,ie,fe);return Al=null,Ee}catch(Se){if(Se===Tl||Se===Hs)throw Se;var Qe=hn(29,Se,null,te.mode);return Qe.lanes=fe,Qe.return=te,Qe}finally{}}}var Li=Kg(!0),Jg=Kg(!1),Xr=!1;function Mf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function jf(t,i){t=t.updateQueue,i.updateQueue===t&&(i.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Qr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Zr(t,i,o){var f=t.updateQueue;if(f===null)return null;if(f=f.shared,(Je&2)!==0){var g=f.pending;return g===null?i.next=i:(i.next=g.next,g.next=i),f.pending=i,i=Ms(t),Og(t,null,o),i}return zs(t,f,i,o),Ms(t)}function Ia(t,i,o){if(i=i.updateQueue,i!==null&&(i=i.shared,(o&4194048)!==0)){var f=i.lanes;f&=t.pendingLanes,o|=f,i.lanes=o,us(t,o)}}function Df(t,i){var o=t.updateQueue,f=t.alternate;if(f!==null&&(f=f.updateQueue,o===f)){var g=null,y=null;if(o=o.firstBaseUpdate,o!==null){do{var C={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};y===null?g=y=C:y=y.next=C,o=o.next}while(o!==null);y===null?g=y=i:y=y.next=i}else g=y=i;o={baseState:f.baseState,firstBaseUpdate:g,lastBaseUpdate:y,shared:f.shared,callbacks:f.callbacks},t.updateQueue=o;return}t=o.lastBaseUpdate,t===null?o.firstBaseUpdate=i:t.next=i,o.lastBaseUpdate=i}var Rf=!1;function qa(){if(Rf){var t=Cl;if(t!==null)throw t}}function Ua(t,i,o,f){Rf=!1;var g=t.updateQueue;Xr=!1;var y=g.firstBaseUpdate,C=g.lastBaseUpdate,D=g.shared.pending;if(D!==null){g.shared.pending=null;var Z=D,le=Z.next;Z.next=null,C===null?y=le:C.next=le,C=Z;var ce=t.alternate;ce!==null&&(ce=ce.updateQueue,D=ce.lastBaseUpdate,D!==C&&(D===null?ce.firstBaseUpdate=le:D.next=le,ce.lastBaseUpdate=Z))}if(y!==null){var de=g.baseState;C=0,ce=le=Z=null,D=y;do{var ae=D.lane&-536870913,oe=ae!==D.lane;if(oe?(qe&ae)===ae:(f&ae)===ae){ae!==0&&ae===Nl&&(Rf=!0),ce!==null&&(ce=ce.next={lane:0,tag:D.tag,payload:D.payload,callback:null,next:null});e:{var we=t,Ce=D;ae=i;var lt=o;switch(Ce.tag){case 1:if(we=Ce.payload,typeof we=="function"){de=we.call(lt,de,ae);break e}de=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=Ce.payload,ae=typeof we=="function"?we.call(lt,de,ae):we,ae==null)break e;de=p({},de,ae);break e;case 2:Xr=!0}}ae=D.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:D.tag,payload:D.payload,callback:D.callback,next:null},ce===null?(le=ce=oe,Z=de):ce=ce.next=oe,C|=ae;if(D=D.next,D===null){if(D=g.shared.pending,D===null)break;oe=D,D=oe.next,oe.next=null,g.lastBaseUpdate=oe,g.shared.pending=null}}while(!0);ce===null&&(Z=de),g.baseState=Z,g.firstBaseUpdate=le,g.lastBaseUpdate=ce,y===null&&(g.shared.lanes=0),ti|=C,t.lanes=C,t.memoizedState=de}}function Wg(t,i){if(typeof t!="function")throw Error(l(191,t));t.call(i)}function e0(t,i){var o=t.callbacks;if(o!==null)for(t.callbacks=null,t=0;ty?y:8;var C=M.T,D={};M.T=D,Wf(t,!1,i,o);try{var Z=g(),le=M.S;if(le!==null&&le(D,Z),Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var ce=bk(Z,f);$a(t,i,ce,yn(t))}else $a(t,i,f,yn(t))}catch(de){$a(t,i,{then:function(){},status:"rejected",reason:de},yn())}finally{Y.p=y,C!==null&&D.types!==null&&(C.types=D.types),M.T=C}}function Nk(){}function Kf(t,i,o,f){if(t.tag!==5)throw Error(l(476));var g=j0(t).queue;M0(t,g,i,Q,o===null?Nk:function(){return D0(t),o(f)})}function j0(t){var i=t.memoizedState;if(i!==null)return i;i={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yr,lastRenderedState:Q},next:null};var o={};return i.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yr,lastRenderedState:o},next:null},t.memoizedState=i,t=t.alternate,t!==null&&(t.memoizedState=i),i}function D0(t){var i=j0(t);i.next===null&&(i=t.alternate.memoizedState),$a(t,i.next.queue,{},yn())}function Jf(){return It(oo)}function R0(){return wt().memoizedState}function O0(){return wt().memoizedState}function Ck(t){for(var i=t.return;i!==null;){switch(i.tag){case 24:case 3:var o=yn();t=Qr(o);var f=Zr(i,t,o);f!==null&&(on(f,i,o),Ia(f,i,o)),i={cache:Cf()},t.payload=i;return}i=i.return}}function Tk(t,i,o){var f=yn();o={lane:f,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Zs(t)?H0(i,o):(o=gf(t,i,o,f),o!==null&&(on(o,t,f),B0(o,i,f)))}function L0(t,i,o){var f=yn();$a(t,i,o,f)}function $a(t,i,o,f){var g={lane:f,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Zs(t))H0(i,g);else{var y=t.alternate;if(t.lanes===0&&(y===null||y.lanes===0)&&(y=i.lastRenderedReducer,y!==null))try{var C=i.lastRenderedState,D=y(C,o);if(g.hasEagerState=!0,g.eagerState=D,dn(D,C))return zs(t,i,g,0),at===null&&As(),!1}catch{}finally{}if(o=gf(t,i,g,f),o!==null)return on(o,t,f),B0(o,i,f),!0}return!1}function Wf(t,i,o,f){if(f={lane:2,revertLane:Md(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Zs(t)){if(i)throw Error(l(479))}else i=gf(t,o,f,2),i!==null&&on(i,t,2)}function Zs(t){var i=t.alternate;return t===ze||i!==null&&i===ze}function H0(t,i){Ml=Ps=!0;var o=t.pending;o===null?i.next=i:(i.next=o.next,o.next=i),t.pending=i}function B0(t,i,o){if((o&4194048)!==0){var f=i.lanes;f&=t.pendingLanes,o|=f,i.lanes=o,us(t,o)}}var Ga={readContext:It,use:Ys,useCallback:gt,useContext:gt,useEffect:gt,useImperativeHandle:gt,useLayoutEffect:gt,useInsertionEffect:gt,useMemo:gt,useReducer:gt,useRef:gt,useState:gt,useDebugValue:gt,useDeferredValue:gt,useTransition:gt,useSyncExternalStore:gt,useId:gt,useHostTransitionStatus:gt,useFormState:gt,useActionState:gt,useOptimistic:gt,useMemoCache:gt,useCacheRefresh:gt};Ga.useEffectEvent=gt;var I0={readContext:It,use:Ys,useCallback:function(t,i){return Zt().memoizedState=[t,i===void 0?null:i],t},useContext:It,useEffect:S0,useImperativeHandle:function(t,i,o){o=o!=null?o.concat([t]):null,Xs(4194308,4,N0.bind(null,i,t),o)},useLayoutEffect:function(t,i){return Xs(4194308,4,t,i)},useInsertionEffect:function(t,i){Xs(4,2,t,i)},useMemo:function(t,i){var o=Zt();i=i===void 0?null:i;var f=t();if(Hi){Pt(!0);try{t()}finally{Pt(!1)}}return o.memoizedState=[f,i],f},useReducer:function(t,i,o){var f=Zt();if(o!==void 0){var g=o(i);if(Hi){Pt(!0);try{o(i)}finally{Pt(!1)}}}else g=i;return f.memoizedState=f.baseState=g,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:g},f.queue=t,t=t.dispatch=Tk.bind(null,ze,t),[f.memoizedState,t]},useRef:function(t){var i=Zt();return t={current:t},i.memoizedState=t},useState:function(t){t=Yf(t);var i=t.queue,o=L0.bind(null,ze,i);return i.dispatch=o,[t.memoizedState,o]},useDebugValue:Qf,useDeferredValue:function(t,i){var o=Zt();return Zf(o,t,i)},useTransition:function(){var t=Yf(!1);return t=M0.bind(null,ze,t.queue,!0,!1),Zt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,i,o){var f=ze,g=Zt();if(Pe){if(o===void 0)throw Error(l(407));o=o()}else{if(o=i(),at===null)throw Error(l(349));(qe&127)!==0||a0(f,i,o)}g.memoizedState=o;var y={value:o,getSnapshot:i};return g.queue=y,S0(s0.bind(null,f,y,t),[t]),f.flags|=2048,Dl(9,{destroy:void 0},o0.bind(null,f,y,o,i),null),o},useId:function(){var t=Zt(),i=at.identifierPrefix;if(Pe){var o=Jn,f=Kn;o=(f&~(1<<32-We(f)-1)).toString(32)+o,i="_"+i+"R_"+o,o=$s++,0<\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof f.is=="string"?C.createElement("select",{is:f.is}):C.createElement("select"),f.multiple?y.multiple=!0:f.size&&(y.size=f.size);break;default:y=typeof f.is=="string"?C.createElement(g,{is:f.is}):C.createElement(g)}}y[Dt]=i,y[$t]=f;e:for(C=i.child;C!==null;){if(C.tag===5||C.tag===6)y.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===i)break e;for(;C.sibling===null;){if(C.return===null||C.return===i)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}i.stateNode=y;e:switch(Ut(y,g,f),g){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&br(i)}}return dt(i),hd(i,i.type,t===null?null:t.memoizedProps,i.pendingProps,o),null;case 6:if(t&&i.stateNode!=null)t.memoizedProps!==f&&br(i);else{if(typeof f!="string"&&i.stateNode===null)throw Error(l(166));if(t=J.current,El(i)){if(t=i.stateNode,o=i.memoizedProps,f=null,g=Bt,g!==null)switch(g.tag){case 27:case 5:f=g.memoizedProps}t[Dt]=i,t=!!(t.nodeValue===o||f!==null&&f.suppressHydrationWarning===!0||iy(t.nodeValue,o)),t||Yr(i,!0)}else t=gu(t).createTextNode(f),t[Dt]=i,i.stateNode=t}return dt(i),null;case 31:if(o=i.memoizedState,t===null||t.memoizedState!==null){if(f=El(i),o!==null){if(t===null){if(!f)throw Error(l(318));if(t=i.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(557));t[Dt]=i}else zi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;dt(i),t=!1}else o=_f(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=o),t=!0;if(!t)return i.flags&256?(mn(i),i):(mn(i),null);if((i.flags&128)!==0)throw Error(l(558))}return dt(i),null;case 13:if(f=i.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(g=El(i),f!==null&&f.dehydrated!==null){if(t===null){if(!g)throw Error(l(318));if(g=i.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(l(317));g[Dt]=i}else zi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;dt(i),g=!1}else g=_f(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=g),g=!0;if(!g)return i.flags&256?(mn(i),i):(mn(i),null)}return mn(i),(i.flags&128)!==0?(i.lanes=o,i):(o=f!==null,t=t!==null&&t.memoizedState!==null,o&&(f=i.child,g=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(g=f.alternate.memoizedState.cachePool.pool),y=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(y=f.memoizedState.cachePool.pool),y!==g&&(f.flags|=2048)),o!==t&&o&&(i.child.flags|=8192),tu(i,i.updateQueue),dt(i),null);case 4:return se(),t===null&&Od(i.stateNode.containerInfo),dt(i),null;case 10:return gr(i.type),dt(i),null;case 19:if(F(bt),f=i.memoizedState,f===null)return dt(i),null;if(g=(i.flags&128)!==0,y=f.rendering,y===null)if(g)Fa(f,!1);else{if(xt!==0||t!==null&&(t.flags&128)!==0)for(t=i.child;t!==null;){if(y=Vs(t),y!==null){for(i.flags|=128,Fa(f,!1),t=y.updateQueue,i.updateQueue=t,tu(i,t),i.subtreeFlags=0,t=o,o=i.child;o!==null;)Lg(o,t),o=o.sibling;return N(bt,bt.current&1|2),Pe&&pr(i,f.treeForkCount),i.child}t=t.sibling}f.tail!==null&&jt()>au&&(i.flags|=128,g=!0,Fa(f,!1),i.lanes=4194304)}else{if(!g)if(t=Vs(y),t!==null){if(i.flags|=128,g=!0,t=t.updateQueue,i.updateQueue=t,tu(i,t),Fa(f,!0),f.tail===null&&f.tailMode==="hidden"&&!y.alternate&&!Pe)return dt(i),null}else 2*jt()-f.renderingStartTime>au&&o!==536870912&&(i.flags|=128,g=!0,Fa(f,!1),i.lanes=4194304);f.isBackwards?(y.sibling=i.child,i.child=y):(t=f.last,t!==null?t.sibling=y:i.child=y,f.last=y)}return f.tail!==null?(t=f.tail,f.rendering=t,f.tail=t.sibling,f.renderingStartTime=jt(),t.sibling=null,o=bt.current,N(bt,g?o&1|2:o&1),Pe&&pr(i,f.treeForkCount),t):(dt(i),null);case 22:case 23:return mn(i),Lf(),f=i.memoizedState!==null,t!==null?t.memoizedState!==null!==f&&(i.flags|=8192):f&&(i.flags|=8192),f?(o&536870912)!==0&&(i.flags&128)===0&&(dt(i),i.subtreeFlags&6&&(i.flags|=8192)):dt(i),o=i.updateQueue,o!==null&&tu(i,o.retryQueue),o=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(o=t.memoizedState.cachePool.pool),f=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(f=i.memoizedState.cachePool.pool),f!==o&&(i.flags|=2048),t!==null&&F(Di),null;case 24:return o=null,t!==null&&(o=t.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),gr(_t),dt(i),null;case 25:return null;case 30:return null}throw Error(l(156,i.tag))}function Dk(t,i){switch(wf(i),i.tag){case 1:return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return gr(_t),se(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 26:case 27:case 5:return ve(i),null;case 31:if(i.memoizedState!==null){if(mn(i),i.alternate===null)throw Error(l(340));zi()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 13:if(mn(i),t=i.memoizedState,t!==null&&t.dehydrated!==null){if(i.alternate===null)throw Error(l(340));zi()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return F(bt),null;case 4:return se(),null;case 10:return gr(i.type),null;case 22:case 23:return mn(i),Lf(),t!==null&&F(Di),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 24:return gr(_t),null;case 25:return null;default:return null}}function ux(t,i){switch(wf(i),i.tag){case 3:gr(_t),se();break;case 26:case 27:case 5:ve(i);break;case 4:se();break;case 31:i.memoizedState!==null&&mn(i);break;case 13:mn(i);break;case 19:F(bt);break;case 10:gr(i.type);break;case 22:case 23:mn(i),Lf(),t!==null&&F(Di);break;case 24:gr(_t)}}function Xa(t,i){try{var o=i.updateQueue,f=o!==null?o.lastEffect:null;if(f!==null){var g=f.next;o=g;do{if((o.tag&t)===t){f=void 0;var y=o.create,C=o.inst;f=y(),C.destroy=f}o=o.next}while(o!==g)}}catch(D){tt(i,i.return,D)}}function Wr(t,i,o){try{var f=i.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var y=g.next;f=y;do{if((f.tag&t)===t){var C=f.inst,D=C.destroy;if(D!==void 0){C.destroy=void 0,g=i;var Z=o,le=D;try{le()}catch(ce){tt(g,Z,ce)}}}f=f.next}while(f!==y)}}catch(ce){tt(i,i.return,ce)}}function cx(t){var i=t.updateQueue;if(i!==null){var o=t.stateNode;try{e0(i,o)}catch(f){tt(t,t.return,f)}}}function fx(t,i,o){o.props=Bi(t.type,t.memoizedProps),o.state=t.memoizedState;try{o.componentWillUnmount()}catch(f){tt(t,i,f)}}function Qa(t,i){try{var o=t.ref;if(o!==null){switch(t.tag){case 26:case 27:case 5:var f=t.stateNode;break;case 30:f=t.stateNode;break;default:f=t.stateNode}typeof o=="function"?t.refCleanup=o(f):o.current=f}}catch(g){tt(t,i,g)}}function Wn(t,i){var o=t.ref,f=t.refCleanup;if(o!==null)if(typeof f=="function")try{f()}catch(g){tt(t,i,g)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(g){tt(t,i,g)}else o.current=null}function dx(t){var i=t.type,o=t.memoizedProps,f=t.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":o.autoFocus&&f.focus();break e;case"img":o.src?f.src=o.src:o.srcSet&&(f.srcset=o.srcSet)}}catch(g){tt(t,t.return,g)}}function pd(t,i,o){try{var f=t.stateNode;t2(f,t.type,o,i),f[$t]=i}catch(g){tt(t,t.return,g)}}function hx(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ai(t.type)||t.tag===4}function md(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||hx(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&&ai(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 gd(t,i,o){var f=t.tag;if(f===5||f===6)t=t.stateNode,i?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(t,i):(i=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,i.appendChild(t),o=o._reactRootContainer,o!=null||i.onclick!==null||(i.onclick=fr));else if(f!==4&&(f===27&&ai(t.type)&&(o=t.stateNode,i=null),t=t.child,t!==null))for(gd(t,i,o),t=t.sibling;t!==null;)gd(t,i,o),t=t.sibling}function nu(t,i,o){var f=t.tag;if(f===5||f===6)t=t.stateNode,i?o.insertBefore(t,i):o.appendChild(t);else if(f!==4&&(f===27&&ai(t.type)&&(o=t.stateNode),t=t.child,t!==null))for(nu(t,i,o),t=t.sibling;t!==null;)nu(t,i,o),t=t.sibling}function px(t){var i=t.stateNode,o=t.memoizedProps;try{for(var f=t.type,g=i.attributes;g.length;)i.removeAttributeNode(g[0]);Ut(i,f,o),i[Dt]=t,i[$t]=o}catch(y){tt(t,t.return,y)}}var wr=!1,Nt=!1,xd=!1,mx=typeof WeakSet=="function"?WeakSet:Set,Ot=null;function Rk(t,i){if(t=t.containerInfo,Bd=_u,t=Cg(t),cf(t)){if("selectionStart"in t)var o={start:t.selectionStart,end:t.selectionEnd};else e:{o=(o=t.ownerDocument)&&o.defaultView||window;var f=o.getSelection&&o.getSelection();if(f&&f.rangeCount!==0){o=f.anchorNode;var g=f.anchorOffset,y=f.focusNode;f=f.focusOffset;try{o.nodeType,y.nodeType}catch{o=null;break e}var C=0,D=-1,Z=-1,le=0,ce=0,de=t,ae=null;t:for(;;){for(var oe;de!==o||g!==0&&de.nodeType!==3||(D=C+g),de!==y||f!==0&&de.nodeType!==3||(Z=C+f),de.nodeType===3&&(C+=de.nodeValue.length),(oe=de.firstChild)!==null;)ae=de,de=oe;for(;;){if(de===t)break t;if(ae===o&&++le===g&&(D=C),ae===y&&++ce===f&&(Z=C),(oe=de.nextSibling)!==null)break;de=ae,ae=de.parentNode}de=oe}o=D===-1||Z===-1?null:{start:D,end:Z}}else o=null}o=o||{start:0,end:0}}else o=null;for(Id={focusedElem:t,selectionRange:o},_u=!1,Ot=i;Ot!==null;)if(i=Ot,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,Ot=t;else for(;Ot!==null;){switch(i=Ot,y=i.alternate,t=i.flags,i.tag){case 0:if((t&4)!==0&&(t=i.updateQueue,t=t!==null?t.events:null,t!==null))for(o=0;o title"))),Ut(y,f,o),y[Dt]=t,St(y),f=y;break e;case"link":var C=wy("link","href",g).get(f+(o.href||""));if(C){for(var D=0;Dlt&&(C=lt,lt=Ce,Ce=C);var te=kg(D,Ce),W=kg(D,lt);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(),Ce>lt?(oe.addRange(ie),oe.extend(W.node,W.offset)):(ie.setEnd(W.node,W.offset),oe.addRange(ie))}}}}for(de=[],oe=D;oe=oe.parentNode;)oe.nodeType===1&&de.push({element:oe,left:oe.scrollLeft,top:oe.scrollTop});for(typeof D.focus=="function"&&D.focus(),D=0;Do?32:o,M.T=null,o=Ed,Ed=null;var y=ri,C=Nr;if(Rt=0,Bl=ri=null,Nr=0,(Je&6)!==0)throw Error(l(331));var D=Je;if(Je|=4,Nx(y.current),_x(y,y.current,C,o),Je=D,to(0,!1),vt&&typeof vt.onPostCommitFiberRoot=="function")try{vt.onPostCommitFiberRoot(Ht,y)}catch{}return!0}finally{Y.p=g,M.T=f,$x(t,i)}}function Yx(t,i,o){i=Nn(o,i),i=rd(t.stateNode,i,2),t=Zr(t,i,2),t!==null&&(wi(t,2),er(t))}function tt(t,i,o){if(t.tag===3)Yx(t,t,o);else for(;i!==null;){if(i.tag===3){Yx(i,t,o);break}else if(i.tag===1){var f=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(ni===null||!ni.has(f))){t=Nn(o,t),o=F0(2),f=Zr(i,o,2),f!==null&&(X0(o,f,i,t),wi(f,2),er(f));break}}i=i.return}}function Td(t,i,o){var f=t.pingCache;if(f===null){f=t.pingCache=new Hk;var g=new Set;f.set(i,g)}else g=f.get(i),g===void 0&&(g=new Set,f.set(i,g));g.has(o)||(bd=!0,g.add(o),t=Vk.bind(null,t,i,o),i.then(t,t))}function Vk(t,i,o){var f=t.pingCache;f!==null&&f.delete(i),t.pingedLanes|=t.suspendedLanes&o,t.warmLanes&=~o,at===t&&(qe&o)===o&&(xt===4||xt===3&&(qe&62914560)===qe&&300>jt()-lu?(Je&2)===0&&Il(t,0):wd|=o,Hl===qe&&(Hl=0)),er(t)}function Fx(t,i){i===0&&(i=os()),t=Ti(t,i),t!==null&&(wi(t,i),er(t))}function Pk(t){var i=t.memoizedState,o=0;i!==null&&(o=i.retryLane),Fx(t,o)}function $k(t,i){var o=0;switch(t.tag){case 31:case 13:var f=t.stateNode,g=t.memoizedState;g!==null&&(o=g.retryLane);break;case 19:f=t.stateNode;break;case 22:f=t.stateNode._retryCache;break;default:throw Error(l(314))}f!==null&&f.delete(i),Fx(t,o)}function Gk(t,i){return Vt(t,i)}var du=null,Ul=null,Ad=!1,hu=!1,zd=!1,li=0;function er(t){t!==Ul&&t.next===null&&(Ul===null?du=Ul=t:Ul=Ul.next=t),hu=!0,Ad||(Ad=!0,Fk())}function to(t,i){if(!zd&&hu){zd=!0;do for(var o=!1,f=du;f!==null;){if(t!==0){var g=f.pendingLanes;if(g===0)var y=0;else{var C=f.suspendedLanes,D=f.pingedLanes;y=(1<<31-We(42|t)+1)-1,y&=g&~(C&~D),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(o=!0,Kx(f,y))}else y=qe,y=cl(f,f===at?y:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(y&3)===0||bi(f,y)||(o=!0,Kx(f,y));f=f.next}while(o);zd=!1}}function Yk(){Xx()}function Xx(){hu=Ad=!1;var t=0;li!==0&&r2()&&(t=li);for(var i=jt(),o=null,f=du;f!==null;){var g=f.next,y=Qx(f,i);y===0?(f.next=null,o===null?du=g:o.next=g,g===null&&(Ul=o)):(o=f,(t!==0||(y&3)!==0)&&(hu=!0)),f=g}Rt!==0&&Rt!==5||to(t),li!==0&&(li=0)}function Qx(t,i){for(var o=t.suspendedLanes,f=t.pingedLanes,g=t.expirationTimes,y=t.pendingLanes&-62914561;0D)break;var ce=Z.transferSize,de=Z.initiatorType;ce&&ly(de)&&(Z=Z.responseEnd,C+=ce*(Z"u"?null:document;function xy(t,i,o){var f=Vl;if(f&&typeof i=="string"&&i){var g=en(i);g='link[rel="'+t+'"][href="'+g+'"]',typeof o=="string"&&(g+='[crossorigin="'+o+'"]'),gy.has(g)||(gy.add(g),t={rel:t,crossOrigin:o,href:i},f.querySelector(g)===null&&(i=f.createElement("link"),Ut(i,"link",t),St(i),f.head.appendChild(i)))}}function d2(t){Cr.D(t),xy("dns-prefetch",t,null)}function h2(t,i){Cr.C(t,i),xy("preconnect",t,i)}function p2(t,i,o){Cr.L(t,i,o);var f=Vl;if(f&&t&&i){var g='link[rel="preload"][as="'+en(i)+'"]';i==="image"&&o&&o.imageSrcSet?(g+='[imagesrcset="'+en(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(g+='[imagesizes="'+en(o.imageSizes)+'"]')):g+='[href="'+en(t)+'"]';var y=g;switch(i){case"style":y=Pl(t);break;case"script":y=$l(t)}jn.has(y)||(t=p({rel:"preload",href:i==="image"&&o&&o.imageSrcSet?void 0:t,as:i},o),jn.set(y,t),f.querySelector(g)!==null||i==="style"&&f.querySelector(lo(y))||i==="script"&&f.querySelector(ao(y))||(i=f.createElement("link"),Ut(i,"link",t),St(i),f.head.appendChild(i)))}}function m2(t,i){Cr.m(t,i);var o=Vl;if(o&&t){var f=i&&typeof i.as=="string"?i.as:"script",g='link[rel="modulepreload"][as="'+en(f)+'"][href="'+en(t)+'"]',y=g;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=$l(t)}if(!jn.has(y)&&(t=p({rel:"modulepreload",href:t},i),jn.set(y,t),o.querySelector(g)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(ao(y)))return}f=o.createElement("link"),Ut(f,"link",t),St(f),o.head.appendChild(f)}}}function g2(t,i,o){Cr.S(t,i,o);var f=Vl;if(f&&t){var g=qr(f).hoistableStyles,y=Pl(t);i=i||"default";var C=g.get(y);if(!C){var D={loading:0,preload:null};if(C=f.querySelector(lo(y)))D.loading=5;else{t=p({rel:"stylesheet",href:t,"data-precedence":i},o),(o=jn.get(y))&&Yd(t,o);var Z=C=f.createElement("link");St(Z),Ut(Z,"link",t),Z._p=new Promise(function(le,ce){Z.onload=le,Z.onerror=ce}),Z.addEventListener("load",function(){D.loading|=1}),Z.addEventListener("error",function(){D.loading|=2}),D.loading|=4,yu(C,i,f)}C={type:"stylesheet",instance:C,count:1,state:D},g.set(y,C)}}}function x2(t,i){Cr.X(t,i);var o=Vl;if(o&&t){var f=qr(o).hoistableScripts,g=$l(t),y=f.get(g);y||(y=o.querySelector(ao(g)),y||(t=p({src:t,async:!0},i),(i=jn.get(g))&&Fd(t,i),y=o.createElement("script"),St(y),Ut(y,"link",t),o.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},f.set(g,y))}}function y2(t,i){Cr.M(t,i);var o=Vl;if(o&&t){var f=qr(o).hoistableScripts,g=$l(t),y=f.get(g);y||(y=o.querySelector(ao(g)),y||(t=p({src:t,async:!0,type:"module"},i),(i=jn.get(g))&&Fd(t,i),y=o.createElement("script"),St(y),Ut(y,"link",t),o.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},f.set(g,y))}}function yy(t,i,o,f){var g=(g=J.current)?xu(g):null;if(!g)throw Error(l(446));switch(t){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(i=Pl(o.href),o=qr(g).hoistableStyles,f=o.get(i),f||(f={type:"style",instance:null,count:0,state:null},o.set(i,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){t=Pl(o.href);var y=qr(g).hoistableStyles,C=y.get(t);if(C||(g=g.ownerDocument||g,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(t,C),(y=g.querySelector(lo(t)))&&!y._p&&(C.instance=y,C.state.loading=5),jn.has(t)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},jn.set(t,o),y||v2(g,t,o,C.state))),i&&f===null)throw Error(l(528,""));return C}if(i&&f!==null)throw Error(l(529,""));return null;case"script":return i=o.async,o=o.src,typeof o=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=$l(o),o=qr(g).hoistableScripts,f=o.get(i),f||(f={type:"script",instance:null,count:0,state:null},o.set(i,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,t))}}function Pl(t){return'href="'+en(t)+'"'}function lo(t){return'link[rel="stylesheet"]['+t+"]"}function vy(t){return p({},t,{"data-precedence":t.precedence,precedence:null})}function v2(t,i,o,f){t.querySelector('link[rel="preload"][as="style"]['+i+"]")?f.loading=1:(i=t.createElement("link"),f.preload=i,i.addEventListener("load",function(){return f.loading|=1}),i.addEventListener("error",function(){return f.loading|=2}),Ut(i,"link",o),St(i),t.head.appendChild(i))}function $l(t){return'[src="'+en(t)+'"]'}function ao(t){return"script[async]"+t}function by(t,i,o){if(i.count++,i.instance===null)switch(i.type){case"style":var f=t.querySelector('style[data-href~="'+en(o.href)+'"]');if(f)return i.instance=f,St(f),f;var g=p({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return f=(t.ownerDocument||t).createElement("style"),St(f),Ut(f,"style",g),yu(f,o.precedence,t),i.instance=f;case"stylesheet":g=Pl(o.href);var y=t.querySelector(lo(g));if(y)return i.state.loading|=4,i.instance=y,St(y),y;f=vy(o),(g=jn.get(g))&&Yd(f,g),y=(t.ownerDocument||t).createElement("link"),St(y);var C=y;return C._p=new Promise(function(D,Z){C.onload=D,C.onerror=Z}),Ut(y,"link",f),i.state.loading|=4,yu(y,o.precedence,t),i.instance=y;case"script":return y=$l(o.src),(g=t.querySelector(ao(y)))?(i.instance=g,St(g),g):(f=o,(g=jn.get(y))&&(f=p({},o),Fd(f,g)),t=t.ownerDocument||t,g=t.createElement("script"),St(g),Ut(g,"link",f),t.head.appendChild(g),i.instance=g);case"void":return null;default:throw Error(l(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(f=i.instance,i.state.loading|=4,yu(f,o.precedence,t));return i.instance}function yu(t,i,o){for(var f=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=f.length?f[f.length-1]:null,y=g,C=0;C title"):null)}function b2(t,i,o){if(o===1||i.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return t=i.disabled,typeof i.precedence=="string"&&t==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function _y(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function w2(t,i,o,f){if(o.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var g=Pl(f.href),y=i.querySelector(lo(g));if(y){i=y._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(t.count++,t=bu.bind(t),i.then(t,t)),o.state.loading|=4,o.instance=y,St(y);return}y=i.ownerDocument||i,f=vy(f),(g=jn.get(g))&&Yd(f,g),y=y.createElement("link"),St(y);var C=y;C._p=new Promise(function(D,Z){C.onload=D,C.onerror=Z}),Ut(y,"link",f),o.instance=y}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(o,i),(i=o.state.preload)&&(o.state.loading&3)===0&&(t.count++,o=bu.bind(t),i.addEventListener("load",o),i.addEventListener("error",o))}}var Xd=0;function S2(t,i){return t.stylesheets&&t.count===0&&Su(t,t.stylesheets),0Xd?50:800)+i);return t.unsuspend=o,function(){t.unsuspend=null,clearTimeout(f),clearTimeout(g)}}:null}function bu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Su(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var wu=null;function Su(t,i){t.stylesheets=null,t.unsuspend!==null&&(t.count++,wu=new Map,i.forEach(_2,t),wu=null,bu.call(t))}function _2(t,i){if(!(i.state.loading&4)){var o=wu.get(t);if(o)var f=o.get(null);else{o=new Map,wu.set(t,o);for(var g=t.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),rh.exports=V2(),rh.exports}var $2=P2();/** - * @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=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),rw=(...e)=>e.filter((n,r,l)=>!!n&&n.trim()!==""&&l.indexOf(n)===r).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 Y2={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 F2=P.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:l,className:a="",children:s,iconNode:u,...c},d)=>P.createElement("svg",{ref:d,...Y2,width:n,height:n,stroke:e,strokeWidth:l?Number(r)*24/Number(n):r,className:rw("lucide",a),...c},[...u.map(([h,m])=>P.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 Fe=(e,n)=>{const r=P.forwardRef(({className:l,...a},s)=>P.createElement(F2,{ref:s,iconNode:n,className:rw(`lucide-${G2(e)}`,l),...a}));return r.displayName=`${e}`,r};/** - * @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 iw=Fe("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 X2=Fe("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 Yi=Fe("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 rl=Fe("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 Dr=Fe("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 Q2=Fe("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 Z2=Fe("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 K2=Fe("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 lw=Fe("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 aw=Fe("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 J2=Fe("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 W2=Fe("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 eN=Fe("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 tN=Fe("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 nN=Fe("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 rN=Fe("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 ow=Fe("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 fm=Fe("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/** - * @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 Do=Fe("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 iN=Fe("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 lN=Fe("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 dm=Fe("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 aN=Fe("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 oN=Fe("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 sN=Fe("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 uN=Fe("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 Fy=Fe("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 sw=Fe("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 cN=Fe("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 fN=Fe("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 dN=Fe("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 hN=Fe("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 Qo=Fe("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 pN=Fe("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"}]]),Xy=e=>{let n;const r=new Set,l=(h,m)=>{const p=typeof h=="function"?h(n):h;if(!Object.is(p,n)){const x=n;n=m??(typeof p!="object"||p===null)?p:Object.assign({},n,p),r.forEach(v=>v(n,x))}},a=()=>n,c={setState:l,getState:a,getInitialState:()=>d,subscribe:h=>(r.add(h),()=>r.delete(h))},d=n=e(l,a,c);return c},mN=(e=>e?Xy(e):Xy),gN=e=>e;function xN(e,n=gN){const r=Jl.useSyncExternalStore(e.subscribe,Jl.useCallback(()=>n(e.getState()),[e,n]),Jl.useCallback(()=>n(e.getInitialState()),[e,n]));return Jl.useDebugValue(r),r}const Qy=e=>{const n=mN(e),r=l=>xN(n,l);return Object.assign(r,n),r},yN=(e=>e?Qy(e):Qy);function Ke(e,n,r="agent"){return e[n]||(e[n]={name:n,status:"pending",type:r,activity:[]}),e[n].activity||(e[n].activity=[]),e[n]}function zu(e,n,r){Ke(e,n).activity.push(r)}function Ve(e,n){e[n]&&(e[n]={...e[n]})}function po(e,n,r,l){const a=e[n];if(!(a!=null&&a.for_each_items))return;const s=a.for_each_items.find(u=>u.key===r);s&&s.activity.push(l)}function vN(e,n,r){return{parentAgent:e,iteration:n,workflowFile:r,workflowName:"",status:"pending",agents:[],routes:[],parallelGroups:[],forEachGroups:[],nodes:{},groupProgress:{},highlightedEdges:[],entryPoint:null,children:[],agentsCompleted:0,agentsTotal:0,totalCost:0,totalTokens:0,eventLog:[],activityLog:[],workflowOutput:null,workflowFailure:null}}function mi(e,n){if(n.length===0)return null;let r=e[n[0]];for(let l=1;l=0;l--){const a=e[l];if(a.parentAgent===n&&(r==null||a.iteration===r))return{ctx:a,index:l}}return null}const he=yN((e,n)=>({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,wfDepth:0,subworkflowContexts:[],activeContextPath:[],viewContextPath:[],replayMode:!1,replayEvents:[],replayPosition:0,replayTotalEvents:0,replayPlaying:!1,replaySpeed:1,_wsSend:null,setWsSend:r=>{e({_wsSend:r})},sendGateResponse:(r,l,a)=>{const s=he.getState()._wsSend;s&&s({type:"gate_response",agent_name:r,selected_value:l,additional_input:a||{}})},processEvent:r=>{const l=Mu[r.type];e(a=>{const s={...a,nodes:{...a.nodes},groupProgress:{...a.groupProgress},eventLog:[...a.eventLog],activityLog:[...a.activityLog],lastEventTime:r.timestamp};l&&l(s,r.data,r.timestamp);const u=ju(r);u&&s.eventLog.push(u);const c=Du(r);return c&&s.activityLog.push(c),s})},replayState:r=>{e(l=>{const a={...l,agentsCompleted:0,totalCost:0,totalTokens:0,nodes:{},groupProgress:{},highlightedEdges:[],eventLog:[],activityLog:[],workflowOutput:null,workflowFailedAgent:null,wfDepth:0,subworkflowContexts:[],activeContextPath:[]};for(const s of r){const u=Mu[s.type];u&&u(a,s.data,s.timestamp);const c=ju(s);c&&a.eventLog.push(c);const d=Du(s);d&&a.activityLog.push(d),a.lastEventTime=s.timestamp}return a})},selectNode:r=>{e({selectedNode:r})},setReplayMode:r=>{e(l=>{const a={...l,replayMode:!0,replayEvents:r,replayTotalEvents:r.length,replayPosition:r.length,replayPlaying:!1,replaySpeed:1,agentsCompleted:0,totalCost:0,totalTokens:0,nodes:{},groupProgress:{},highlightedEdges:[],eventLog:[],activityLog:[],workflowOutput:null,workflowFailedAgent:null,wfDepth:0,subworkflowContexts:[],activeContextPath:[],viewContextPath:[]};for(const s of r){const u=Mu[s.type];u&&u(a,s.data,s.timestamp);const c=ju(s);c&&a.eventLog.push(c);const d=Du(s);d&&a.activityLog.push(d),a.lastEventTime=s.timestamp}return a})},setReplayPosition:r=>{e(l=>{const a=l.replayEvents.slice(0,r),s={...l,replayPosition:r,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,wfDepth:0,subworkflowContexts:[],activeContextPath:[],viewContextPath:[]};for(const u of a){const c=Mu[u.type];c&&c(s,u.data,u.timestamp);const d=ju(u);d&&s.eventLog.push(d);const h=Du(u);h&&s.activityLog.push(h),s.lastEventTime=u.timestamp}return s})},setReplayPlaying:r=>{e({replayPlaying:r})},setReplaySpeed:r=>{e({replaySpeed:r})},setWsStatus:r=>{e({wsStatus:r})},setEdgeHighlight:(r,l,a)=>{e(s=>({highlightedEdges:[...s.highlightedEdges.filter(u=>!(u.from===r&&u.to===l)),{from:r,to:l,state:a}]}))},clearEdgeHighlight:(r,l)=>{e(a=>({highlightedEdges:a.highlightedEdges.filter(s=>!(s.from===r&&s.to===l))}))},navigateToContext:r=>{e({viewContextPath:r,selectedNode:null})},navigateUp:()=>{e(r=>({viewContextPath:r.viewContextPath.slice(0,-1),selectedNode:null}))},navigateIntoSubworkflow:(r,l)=>{const a=n(),s=a.viewContextPath;let u;if(s.length===0)u=a.subworkflowContexts;else{const d=mi(a.subworkflowContexts,s);if(!d)return;u=d.children}const c=bN(u,r,l);c&&e({viewContextPath:[...s,c.index],selectedNode:null})},getViewedContext:()=>{const r=n();if(r.viewContextPath.length===0)return{workflowName:r.workflowName,agents:r.agents,routes:r.routes,parallelGroups:r.parallelGroups,forEachGroups:r.forEachGroups,nodes:r.nodes,groupProgress:r.groupProgress,highlightedEdges:r.highlightedEdges,entryPoint:r.entryPoint,subworkflowContexts:r.subworkflowContexts};const l=mi(r.subworkflowContexts,r.viewContextPath);return l?{workflowName:l.workflowName,agents:l.agents,routes:l.routes,parallelGroups:l.parallelGroups,forEachGroups:l.forEachGroups,nodes:l.nodes,groupProgress:l.groupProgress,highlightedEdges:l.highlightedEdges,entryPoint:l.entryPoint,subworkflowContexts:l.children}:{workflowName:r.workflowName,agents:r.agents,routes:r.routes,parallelGroups:r.parallelGroups,forEachGroups:r.forEachGroups,nodes:r.nodes,groupProgress:r.groupProgress,highlightedEdges:r.highlightedEdges,entryPoint:r.entryPoint,subworkflowContexts:r.subworkflowContexts}},getBreadcrumbs:()=>{const r=n(),l=[{label:r.workflowName||"Root",path:[]}];let a=r.subworkflowContexts;for(let s=0;s0){const n=mi(e.subworkflowContexts,e.activeContextPath);if(n)return{nodes:n.nodes,groupProgress:n.groupProgress,routes:n.routes,highlightedEdges:n.highlightedEdges,addCost:r=>{n.totalCost+=r,e.totalCost+=r},addTokens:r=>{n.totalTokens+=r,e.totalTokens+=r},incrCompleted:()=>{n.agentsCompleted++,e.agentsCompleted++}}}return{nodes:e.nodes,groupProgress:e.groupProgress,routes:e.routes,highlightedEdges:e.highlightedEdges,addCost:n=>{e.totalCost+=n},addTokens:n=>{e.totalTokens+=n},incrCompleted:()=>{e.agentsCompleted++}}}const Mu={workflow_started:(e,n,r)=>{const l=n;if(e.wfDepth===0){e.workflowStatus="running",e.workflowStartTime=r??Date.now()/1e3,e.workflowName=l.name||"",e.workflowYaml=n.yaml_source??null,e.conductorVersion=n.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||[],Ke(e.nodes,"$start","start"),e.nodes.$start.status="running",Ve(e.nodes,"$start");const a=new Set,s=new Set;for(const u of e.parallelGroups){for(const c of u.agents)a.add(c);s.add(u.name),Ke(e.nodes,u.name,"parallel_group"),e.groupProgress[u.name]={total:u.agents.length,completed:0,failed:0};for(const c of u.agents)Ke(e.nodes,c,"agent")}for(const u of e.forEachGroups)s.add(u.name),Ke(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)&&!a.has(u.name)){const c=u.type||"agent";Ke(e.nodes,u.name,c),u.model&&(e.nodes[u.name].model=u.model),s.add(u.name)}e.agentsTotal=s.size}else{const a=mi(e.subworkflowContexts,e.activeContextPath);if(a){a.workflowName=l.name||"",a.status="running",a.entryPoint=l.entry_point||null,a.agents=l.agents||[],a.routes=l.routes||[],a.parallelGroups=l.parallel_groups||[],a.forEachGroups=l.for_each_groups||[],Ke(a.nodes,"$start","start"),a.nodes.$start.status="running";const s=new Set,u=new Set;for(const c of a.parallelGroups){for(const d of c.agents)s.add(d);u.add(c.name),Ke(a.nodes,c.name,"parallel_group"),a.groupProgress[c.name]={total:c.agents.length,completed:0,failed:0};for(const d of c.agents)Ke(a.nodes,d,"agent")}for(const c of a.forEachGroups)u.add(c.name),Ke(a.nodes,c.name,"for_each_group"),a.groupProgress[c.name]={total:0,completed:0,failed:0};for(const c of a.agents)if(!u.has(c.name)&&!s.has(c.name)){const d=c.type||"agent";Ke(a.nodes,c.name,d),c.model&&(a.nodes[c.name].model=c.model),u.add(c.name)}a.agentsTotal=u.size}}e.wfDepth++},agent_started:(e,n,r)=>{const l=n,a=st(e),s=Ke(a.nodes,l.agent_name);s.iteration!=null&&(s.output!=null||s.error_type!=null)&&(s.iterationHistory||(s.iterationHistory=[]),s.iterationHistory.push({iteration:s.iteration,prompt:s.prompt,output:s.output,elapsed:s.elapsed,model:s.model,tokens:s.tokens,input_tokens:s.input_tokens,output_tokens:s.output_tokens,cost_usd:s.cost_usd,activity:s.activity,error_type:s.error_type,error_message:s.error_message})),s.status="running",s.iteration=l.iteration,s.startedAt=r??Date.now()/1e3,s.activity=[],l.context_window_max!=null&&(s.context_window_max=l.context_window_max),s.prompt=void 0,s.output=void 0,s.error_type=void 0,s.error_message=void 0,Ve(a.nodes,l.agent_name)},agent_completed:(e,n)=>{const r=n,l=st(e),a=Ke(l.nodes,r.agent_name);a.status="completed",l.incrCompleted(),a.elapsed=r.elapsed,a.model=r.model,a.tokens=r.tokens,a.input_tokens=r.input_tokens,a.output_tokens=r.output_tokens,a.cost_usd=r.cost_usd,a.output=r.output,a.output_keys=r.output_keys,a.context_window_used=r.context_window_used,a.context_window_max=r.context_window_max,r.context_window_used!=null&&r.context_window_max!=null&&r.context_window_max>0&&(a.context_pct=Math.round(r.context_window_used/r.context_window_max*100)),r.cost_usd&&l.addCost(r.cost_usd),r.tokens&&l.addTokens(r.tokens),Ve(l.nodes,r.agent_name)},agent_failed:(e,n)=>{const r=n,l=st(e),a=Ke(l.nodes,r.agent_name);a.status="failed",a.elapsed=r.elapsed,a.error_type=r.error_type,a.error_message=r.message;for(const s of l.routes)s.to===r.agent_name&&l.highlightedEdges.push({from:s.from,to:s.to,state:"failed"});Ve(l.nodes,r.agent_name)},agent_prompt_rendered:(e,n)=>{var u;const r=n,l=n.item_key,a=st(e),s=Ke(a.nodes,r.agent_name);if(s.prompt=r.rendered_prompt,s.context_keys=r.context_keys,l){po(a.nodes,r.agent_name,l,{type:"prompt",icon:"📝",label:"prompt",text:"Prompt rendered",detail:((u=r.rendered_prompt)==null?void 0:u.slice(0,500))||null});const c=a.nodes[r.agent_name];if(c!=null&&c.for_each_items){const d=c.for_each_items.find(h=>h.key===l);d&&(d.prompt=r.rendered_prompt)}}Ve(a.nodes,r.agent_name)},agent_reasoning:(e,n)=>{const r=n,l=n.item_key,a=st(e),s={type:"reasoning",icon:"💭",label:"thinking",text:r.content};zu(a.nodes,r.agent_name,s),l&&po(a.nodes,r.agent_name,l,s),Ve(a.nodes,r.agent_name)},agent_tool_start:(e,n)=>{const r=n,l=n.item_key,a=st(e),s={type:"tool-start",icon:"🔧",label:"tool",text:r.tool_name,detail:r.arguments||null};zu(a.nodes,r.agent_name,s),l&&po(a.nodes,r.agent_name,l,s),Ve(a.nodes,r.agent_name)},agent_tool_complete:(e,n)=>{const r=n,l=n.item_key,a=st(e),s={type:"tool-complete",icon:"✓",label:"result",text:r.tool_name||"done",detail:r.result||null};zu(a.nodes,r.agent_name,s),l&&po(a.nodes,r.agent_name,l,s),Ve(a.nodes,r.agent_name)},agent_turn_start:(e,n)=>{const r=n,l=n.item_key,a=st(e),s={type:"turn",icon:"⏳",label:"turn",text:`Turn ${r.turn??"?"}`};zu(a.nodes,r.agent_name,s),l&&po(a.nodes,r.agent_name,l,s),Ve(a.nodes,r.agent_name)},agent_message:(e,n)=>{const r=n,l=st(e),a=Ke(l.nodes,r.agent_name);a.latest_message=r.content,Ve(l.nodes,r.agent_name)},script_started:(e,n,r)=>{const l=n,a=st(e),s=Ke(a.nodes,l.agent_name);s.status="running",s.startedAt=r??Date.now()/1e3,Ve(a.nodes,l.agent_name)},script_completed:(e,n)=>{const r=n,l=st(e),a=Ke(l.nodes,r.agent_name);a.status="completed",l.incrCompleted(),a.elapsed=r.elapsed,a.stdout=r.stdout,a.stderr=r.stderr,a.exit_code=r.exit_code,Ve(l.nodes,r.agent_name)},script_failed:(e,n)=>{const r=n,l=st(e),a=Ke(l.nodes,r.agent_name);a.status="failed",a.elapsed=r.elapsed,a.error_type=r.error_type,a.error_message=r.message,Ve(l.nodes,r.agent_name)},gate_presented:(e,n)=>{const r=n,l=st(e),a=Ke(l.nodes,r.agent_name);a.status="waiting",a.options=r.options,a.option_details=r.option_details,a.prompt=r.prompt,Ve(l.nodes,r.agent_name)},gate_resolved:(e,n)=>{const r=n,l=st(e),a=Ke(l.nodes,r.agent_name);a.status="completed",l.incrCompleted(),a.selected_option=r.selected_option,a.route=r.route,a.additional_input=r.additional_input,Ve(l.nodes,r.agent_name)},route_taken:(e,n)=>{const r=n;st(e).highlightedEdges.push({from:r.from_agent,to:r.to_agent,state:"taken"})},parallel_started:(e,n)=>{const r=n,l=st(e),a=Ke(l.nodes,r.group_name,"parallel_group");a.status="running",l.groupProgress[r.group_name]&&(l.groupProgress[r.group_name].total=r.agents.length,l.groupProgress[r.group_name].completed=0,l.groupProgress[r.group_name].failed=0),Ve(l.nodes,r.group_name)},parallel_agent_completed:(e,n)=>{const r=n,l=st(e);l.groupProgress[r.group_name]&&l.groupProgress[r.group_name].completed++;const a=Ke(l.nodes,r.agent_name);a.status="completed",a.elapsed=r.elapsed,a.model=r.model,a.tokens=r.tokens,a.cost_usd=r.cost_usd,a.context_window_used=r.context_window_used,a.context_window_max=r.context_window_max,r.context_window_used!=null&&r.context_window_max!=null&&r.context_window_max>0&&(a.context_pct=Math.round(r.context_window_used/r.context_window_max*100)),r.cost_usd&&l.addCost(r.cost_usd),r.tokens&&l.addTokens(r.tokens),Ve(l.nodes,r.agent_name),Ve(l.nodes,r.group_name)},parallel_agent_failed:(e,n)=>{const r=n,l=st(e);l.groupProgress[r.group_name]&&l.groupProgress[r.group_name].failed++;const a=Ke(l.nodes,r.agent_name);a.status="failed",a.elapsed=r.elapsed,a.error_type=r.error_type,a.error_message=r.message,Ve(l.nodes,r.agent_name),Ve(l.nodes,r.group_name)},parallel_completed:(e,n)=>{const r=n,l=st(e);l.incrCompleted();const a=Ke(l.nodes,r.group_name,"parallel_group");a.status=r.failure_count===0?"completed":"failed",Ve(l.nodes,r.group_name)},for_each_started:(e,n)=>{const r=n,l=st(e),a=Ke(l.nodes,r.group_name,"for_each_group");a.status="running",a.for_each_items=[],l.groupProgress[r.group_name]&&(l.groupProgress[r.group_name].total=r.item_count,l.groupProgress[r.group_name].completed=0,l.groupProgress[r.group_name].failed=0),Ve(l.nodes,r.group_name)},for_each_item_started:(e,n)=>{const r=n,l=st(e),a=Ke(l.nodes,r.group_name,"for_each_group");a.for_each_items||(a.for_each_items=[]),a.for_each_items.push({key:r.item_key??String(r.index),index:r.index,status:"running",activity:[]}),Ve(l.nodes,r.group_name)},for_each_item_completed:(e,n)=>{const r=n,l=st(e);l.groupProgress[r.group_name]&&l.groupProgress[r.group_name].completed++;const a=Ke(l.nodes,r.group_name,"for_each_group");if(a.for_each_items){const s=r.item_key??String(r.index),u=a.for_each_items.find(c=>c.key===s);u&&(u.status="completed",u.elapsed=r.elapsed,u.tokens=r.tokens,u.cost_usd=r.cost_usd,u.output=r.output)}Ve(l.nodes,r.group_name)},for_each_item_failed:(e,n)=>{const r=n,l=st(e);l.groupProgress[r.group_name]&&l.groupProgress[r.group_name].failed++;const a=Ke(l.nodes,r.group_name,"for_each_group");if(a.for_each_items){const s=r.item_key??String(r.index),u=a.for_each_items.find(c=>c.key===s);u&&(u.status="failed",u.elapsed=r.elapsed,u.error_type=r.error_type,u.error_message=r.message)}Ve(l.nodes,r.group_name)},for_each_completed:(e,n)=>{const r=n,l=st(e);l.incrCompleted();const a=Ke(l.nodes,r.group_name,"for_each_group");a.status=(r.failure_count??0)===0?"completed":"failed",a.elapsed=r.elapsed,a.success_count=r.success_count,a.failure_count=r.failure_count,Ve(l.nodes,r.group_name)},workflow_completed:(e,n)=>{if(e.wfDepth=Math.max(0,e.wfDepth-1),e.wfDepth===0){const r=n;e.workflowStatus="completed",e.isPaused=!1,e.workflowOutput=r.output??null,e.nodes.$end&&(e.nodes.$end.status="completed",Ve(e.nodes,"$end")),e.nodes.$start&&(e.nodes.$start.status="completed",Ve(e.nodes,"$start")),e.highlightedEdges=[]}else{const r=mi(e.subworkflowContexts,e.activeContextPath);if(r){const l=n;r.status="completed",r.workflowOutput=l.output??null,r.nodes.$end&&(r.nodes.$end.status="completed"),r.nodes.$start&&(r.nodes.$start.status="completed"),r.highlightedEdges=[]}e.activeContextPath=e.activeContextPath.slice(0,-1)}},workflow_failed:(e,n)=>{e.wfDepth=Math.max(0,e.wfDepth-1);const r=n;if(e.wfDepth===0){if(e.workflowStatus="failed",e.isPaused=!1,e.workflowFailedAgent=r.agent_name||null,r.agent_name&&e.nodes[r.agent_name]){e.nodes[r.agent_name].status="failed",Ve(e.nodes,r.agent_name);for(const l of e.routes)l.to===r.agent_name&&e.highlightedEdges.push({from:l.from,to:l.to,state:"failed"})}e.workflowFailure={error_type:r.error_type,message:r.message,elapsed_seconds:r.elapsed_seconds,timeout_seconds:r.timeout_seconds,current_agent:r.current_agent},e.nodes.$start&&(e.nodes.$start.status="completed",Ve(e.nodes,"$start"))}else{const l=mi(e.subworkflowContexts,e.activeContextPath);l&&(l.status="failed",l.workflowFailure={error_type:r.error_type,message:r.message}),e.activeContextPath=e.activeContextPath.slice(0,-1)}},subworkflow_started:(e,n)=>{const r=n,l=vN(r.agent_name,r.iteration??1,r.workflow);if(e.activeContextPath.length===0)e.subworkflowContexts.push(l),e.activeContextPath=[e.subworkflowContexts.length-1];else{const s=mi(e.subworkflowContexts,e.activeContextPath);s&&(s.children.push(l),e.activeContextPath=[...e.activeContextPath,s.children.length-1])}const a=e.activeContextPath.slice(0,-1);if(a.length===0){const s=e.nodes[r.agent_name];s&&(s.status="running",Ve(e.nodes,r.agent_name))}else{const s=mi(e.subworkflowContexts,a);if(s){const u=s.nodes[r.agent_name];u&&(u.status="running",Ve(s.nodes,r.agent_name))}}},subworkflow_completed:(e,n)=>{const r=n,l=st(e),a=l.nodes[r.agent_name];a&&(a.status="completed",a.elapsed=r.elapsed,l.incrCompleted(),Ve(l.nodes,r.agent_name))},subworkflow_failed:(e,n)=>{const r=n,l=st(e),a=l.nodes[r.agent_name];a&&(a.status="failed",a.elapsed=r.elapsed,a.error_type=r.error_type,a.error_message=r.message,Ve(l.nodes,r.agent_name))},checkpoint_saved:(e,n)=>{const r=n;r.path&&e.workflowFailure&&(e.workflowFailure={...e.workflowFailure,checkpoint_path:r.path})},agent_paused:(e,n)=>{const r=n,l=Ke(e.nodes,r.agent_name);l.status="waiting",l.activity.push({type:"agent_paused",icon:"⏸",label:"Paused",text:"Agent paused — click Resume to re-execute"}),Ve(e.nodes,r.agent_name),e.isPaused=!0},agent_resumed:(e,n)=>{const r=n,l=Ke(e.nodes,r.agent_name);l.status="running",l.activity.push({type:"agent_resumed",icon:"▶",label:"Resumed",text:"Agent resumed — re-executing"}),Ve(e.nodes,r.agent_name),e.isPaused=!1}};function ju(e){var l,a;const n=e.timestamp,r=e.data;switch(e.type){case"workflow_started":return{timestamp:n,level:"info",source:"workflow",message:`Workflow "${r.name||""}" started`};case"agent_started":return{timestamp:n,level:"info",source:String(r.agent_name),message:`Agent started${r.iteration!=null?` (iteration ${r.iteration})`:""}`};case"agent_completed":return{timestamp:n,level:"success",source:String(r.agent_name),message:`Agent completed${r.elapsed!=null?` in ${Xu(r.elapsed)}`:""}${r.tokens!=null?` · ${r.tokens.toLocaleString()} tokens`:""}${r.cost_usd!=null?` · $${r.cost_usd.toFixed(4)}`:""}`};case"agent_failed":return{timestamp:n,level:"error",source:String(r.agent_name),message:`Agent failed: ${r.message||r.error_type||"unknown error"}`};case"script_started":return{timestamp:n,level:"info",source:String(r.agent_name),message:"Script started"};case"script_completed":return{timestamp:n,level:"success",source:String(r.agent_name),message:`Script completed (exit ${r.exit_code??"?"})${r.elapsed!=null?` in ${Xu(r.elapsed)}`:""}`};case"script_failed":return{timestamp:n,level:"error",source:String(r.agent_name),message:`Script failed: ${r.message||r.error_type||"unknown error"}`};case"gate_presented":return{timestamp:n,level:"warning",source:String(r.agent_name),message:"Waiting for human input…"};case"gate_resolved":return{timestamp:n,level:"success",source:String(r.agent_name),message:`Gate resolved → ${r.selected_option||"continue"}`};case"route_taken":return{timestamp:n,level:"debug",source:"router",message:`${r.from_agent} → ${r.to_agent}`};case"parallel_started":return{timestamp:n,level:"info",source:String(r.group_name),message:`Parallel group started (${((l=r.agents)==null?void 0:l.length)||"?"} agents)`};case"parallel_completed":return{timestamp:n,level:r.failure_count===0?"success":"error",source:String(r.group_name),message:`Parallel group completed${r.failure_count>0?` with ${r.failure_count} failure(s)`:""}`};case"for_each_started":return{timestamp:n,level:"info",source:String(r.group_name),message:`For-each started (${r.item_count} items)`};case"for_each_completed":return{timestamp:n,level:(r.failure_count??0)===0?"success":"error",source:String(r.group_name),message:`For-each completed · ${r.success_count} succeeded${r.failure_count>0?` · ${r.failure_count} failed`:""}`};case"workflow_completed":return{timestamp:n,level:"success",source:"workflow",message:`Workflow completed${r.elapsed!=null?` in ${Xu(r.elapsed)}`:""}`};case"workflow_failed":return{timestamp:n,level:"error",source:"workflow",message:`Workflow failed: ${r.message||r.error_type||"unknown error"}`};case"checkpoint_saved":return{timestamp:n,level:"info",source:"workflow",message:`Checkpoint saved: ${((a=r.path)==null?void 0:a.split("/").pop())||"unknown"}`};case"agent_paused":return{timestamp:n,level:"warning",source:String(r.agent_name),message:"Agent paused — waiting for resume"};case"agent_resumed":return{timestamp:n,level:"info",source:String(r.agent_name),message:"Agent resumed — re-executing"};default:return null}}function Xu(e){if(e<1)return`${(e*1e3).toFixed(0)}ms`;if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e/60),r=(e%60).toFixed(0);return`${n}m ${r}s`}function Du(e){const n=e.timestamp,r=e.data;switch(e.type){case"agent_started":return{timestamp:n,source:String(r.agent_name),type:"turn",message:`Agent started${r.iteration!=null?` (iteration ${r.iteration})`:""}`};case"agent_prompt_rendered":return{timestamp:n,source:String(r.agent_name),type:"prompt",message:"Prompt rendered",detail:mo(String(r.rendered_prompt||""),500)};case"agent_reasoning":return{timestamp:n,source:String(r.agent_name),type:"reasoning",message:String(r.content||"")};case"agent_tool_start":return{timestamp:n,source:String(r.agent_name),type:"tool-start",message:`→ ${r.tool_name}`,detail:r.arguments?mo(String(r.arguments),300):null};case"agent_tool_complete":return{timestamp:n,source:String(r.agent_name),type:"tool-complete",message:`← ${r.tool_name||"done"}`,detail:r.result?mo(String(r.result),300):null};case"agent_turn_start":return{timestamp:n,source:String(r.agent_name),type:"turn",message:`Turn ${r.turn??"?"}`};case"agent_message":return{timestamp:n,source:String(r.agent_name),type:"message",message:mo(String(r.content||""),500)};case"agent_completed":return{timestamp:n,source:String(r.agent_name),type:"turn",message:`Completed${r.elapsed!=null?` in ${Xu(r.elapsed)}`:""}${r.tokens!=null?` · ${r.tokens.toLocaleString()} tokens`:""}`};case"agent_failed":return{timestamp:n,source:String(r.agent_name),type:"turn",message:`Failed: ${r.message||r.error_type||"unknown"}`};case"script_started":return{timestamp:n,source:String(r.agent_name),type:"turn",message:"Script started"};case"script_completed":return{timestamp:n,source:String(r.agent_name),type:"tool-complete",message:`Script completed (exit ${r.exit_code??"?"})`,detail:r.stdout?mo(String(r.stdout),300):null};case"script_failed":return{timestamp:n,source:String(r.agent_name),type:"turn",message:`Script failed: ${r.message||r.error_type||"unknown"}`};default:return null}}function mo(e,n){return e.length<=n?e:e.slice(0,n)+"…"}function Zy(e){const n=e.match(/^(\s*)/);return n?n[1].length:0}function wN(e){const n=new Map;for(let r=0;ra)s=u;else break}s>r&&n.set(r,s)}return n}function SN(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,a,s,u,c]=n;return b.jsxs("span",{children:[l,a??"",b.jsx("span",{className:"text-sky-400",children:s}),b.jsx("span",{className:"text-[var(--text-muted)]",children:u}),Ky(c)]})}const r=e.match(/^(\s*)(- )(.*)/);if(r){const[,l,a,s]=r;return b.jsxs("span",{children:[l,b.jsx("span",{className:"text-[var(--text-muted)]",children:a}),Ky(s)]})}return b.jsx("span",{children:e})}function Ky(e){if(!e)return"";const n=e.indexOf(" #"),r=n>=0?e.slice(0,n):e,l=n>=0?e.slice(n):"";let a=r;return/^(true|false|null|yes|no)$/i.test(r.trim())?a=b.jsx("span",{className:"text-amber-400",children:r}):/^\d+(\.\d+)?$/.test(r.trim())?a=b.jsx("span",{className:"text-amber-400",children:r}):/^["'].*["']$/.test(r.trim())?a=b.jsx("span",{className:"text-green-400",children:r}):(r.includes("|")||r.includes(">"))&&(a=b.jsx("span",{className:"text-[var(--text-secondary)]",children:r})),b.jsxs(b.Fragment,{children:[a,l&&b.jsx("span",{className:"text-emerald-500/70",children:l})]})}function _N({yaml:e,onClose:n}){const[r,l]=P.useState(new Set);P.useEffect(()=>{const d=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[n]);const a=P.useMemo(()=>e.split(` -`),[e]),s=P.useMemo(()=>wN(a),[a]),u=P.useCallback(d=>{l(h=>{const m=new Set(h);return m.has(d)?m.delete(d):m.add(d),m})},[]),c=P.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(Dr,{className:"w-3 h-3"}):b.jsx(rl,{className:"w-3 h-3"})}):null}),b.jsxs("span",{className:"flex-1",children:[SN(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 EN(){const e=he(S=>S.workflowName),n=he(S=>S.workflowStatus),r=he(S=>S.isPaused),l=he(S=>S.workflowYaml),a=he(S=>S.conductorVersion),[s,u]=P.useState(!1),[c,d]=P.useState(!1),[h,m]=P.useState(!1),[p,x]=P.useState(!1),v=n==="running"||n==="pending";P.useEffect(()=>{r||(u(!1),d(!1),m(!1))},[r]);const w=async()=>{u(!0);try{await fetch("/api/stop",{method:"POST"})}catch(S){console.error("Failed to stop agent:",S),u(!1)}},k=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(iw,{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:[r?b.jsxs(b.Fragment,{children:[b.jsxs("button",{onClick:k,disabled:c,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(dm,{className:"w-3 h-3"}),c?"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(Qo,{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(sw,{className:"w-3 h-3"}),s?"Stopping...":"Stop"]}):null,l&&b.jsxs("button",{onClick:()=>x(!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",a??"—"]})]}),p&&l&&b.jsx(_N,{yaml:l,onClose:()=>x(!1)})]})}function kN(){const e=he(s=>s.getBreadcrumbs),n=he(s=>s.navigateToContext),r=he(s=>s.viewContextPath);if(he(s=>s.subworkflowContexts).length===0&&r.length===0)return null;const a=e();return b.jsxs("div",{className:"flex items-center gap-1 px-4 py-1.5 bg-[var(--surface)] border-b border-[var(--border)] text-xs flex-shrink-0",children:[b.jsx(fm,{className:"w-3 h-3 text-[var(--text-muted)] mr-1"}),a.map((s,u)=>{const c=u===a.length-1,d=JSON.stringify(s.path)===JSON.stringify(r);return b.jsxs("span",{className:"flex items-center gap-1",children:[u>0&&b.jsx(Dr,{className:"w-3 h-3 text-[var(--text-muted)]"}),c?b.jsx("span",{className:"font-semibold text-[var(--text)]",children:s.label}):b.jsx("button",{onClick:()=>n(s.path),className:`hover:text-[var(--running)] transition-colors ${d?"text-[var(--text)] font-medium":"text-[var(--text-muted)]"}`,children:s.label})]},u)})]})}function Be(...e){return e.filter(Boolean).join(" ")}function Jt(e){if(e==null)return"";if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e/60),r=(e%60).toFixed(0);return`${n}m ${r}s`}function $n(e){return e==null?"":e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:`${e}`}function yi(e){return e==null?"":`$${e.toFixed(4)}`}function uw(e){return e==null?"":typeof e=="string"?e:JSON.stringify(e,null,2)}function NN(e,n){if(n<=0)return`${e.toLocaleString()} tokens (limit unknown)`;const r=a=>a.toLocaleString(),l=(e/n*100).toFixed(1);return`${r(e)} / ${r(n)} (${l}%)`}function cw(){const e=he(c=>c.workflowStatus),n=he(c=>c.workflowStartTime),r=he(c=>c.replayMode),l=he(c=>c.lastEventTime),[a,s]=P.useState("—"),u=P.useRef(null);return P.useEffect(()=>{if(n!=null){if(r){u.current&&(clearInterval(u.current),u.current=null),s(Jt((l??n)-n));return}if(e==="running"){const c=()=>{const d=Date.now()/1e3-n;s(Jt(d))};return c(),u.current=setInterval(c,500),()=>{u.current&&clearInterval(u.current)}}else(e==="completed"||e==="failed")&&u.current&&(clearInterval(u.current),u.current=null)}},[e,n,r,l]),a}function CN(){const e=he(k=>k.workflowStatus),n=he(k=>k.agentsCompleted),r=he(k=>k.agentsTotal),l=he(k=>k.totalCost),a=he(k=>k.totalTokens),s=he(k=>k.wsStatus),u=he(k=>k.workflowFailure),c=he(k=>k.lastEventTime),d=cw(),[h,m]=P.useState(null);P.useEffect(()=>{if(e!=="running"||c==null){m(null);return}const k=()=>{m(Math.floor(Date.now()/1e3-c))};k();const _=setInterval(k,1e3);return()=>clearInterval(_)},[e,c]);const p=e==="failed",x=(()=>{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(hN,{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(dN,{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(Do,{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(Do,{className:"w-3 h-3 animate-spin"}),b.jsx("span",{children:"Connecting\\u2026"})]})}})();return b.jsxs("footer",{className:Be("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:Be("w-2 h-2 rounded-full flex-shrink-0",v)}),b.jsx("span",{className:Be(p?"text-red-300":"text-[var(--text)]"),children:x}),r>0&&b.jsxs("span",{className:Be(p?"text-red-400/60":"text-[var(--text-muted)]"),children:[n,"/",r," agents"]}),e!=="pending"&&b.jsx("span",{className:Be("font-mono",p?"text-red-400/60":"text-[var(--text-muted)]"),children:d}),a>0&&b.jsxs("span",{className:Be("flex items-center gap-1",p?"text-red-400/60":"text-[var(--text-muted)]"),title:"Total tokens used",children:[b.jsx(ow,{className:"w-3 h-3"}),b.jsx("span",{className:"font-mono",children:a.toLocaleString()})]}),l>0&&b.jsxs("span",{className:Be("flex items-center gap-1",p?"text-red-400/60":"text-[var(--text-muted)]"),title:"Total cost",children:[b.jsx(lw,{className:"w-3 h-3"}),b.jsxs("span",{className:"font-mono",children:["$",l.toFixed(4)]})]}),h!=null&&h>=5&&b.jsxs("span",{className:Be("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(K2,{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 TN=[1,5,10,20,50];function AN(e,n){if(n===0||e.length===0)return"+0.0s";const r=e[0].timestamp,a=e[Math.min(n,e.length)-1].timestamp-r;if(a<60)return`+${a.toFixed(1)}s`;const s=Math.floor(a/60),u=a%60;return`+${s}m${u.toFixed(0)}s`}function zN(){const e=he(p=>p.replayPosition),n=he(p=>p.replayTotalEvents),r=he(p=>p.replayPlaying),l=he(p=>p.replaySpeed),a=he(p=>p.replayEvents),s=he(p=>p.setReplayPosition),u=he(p=>p.setReplayPlaying),c=he(p=>p.setReplaySpeed),d=p=>{const x=parseInt(p.target.value,10);s(x),r&&u(!1)},h=()=>{!r&&e>=n&&s(0),u(!r)},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:r?"Pause":"Play",children:r?b.jsx(lN,{className:"w-3.5 h-3.5"}):b.jsx(dm,{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; - height: 12px; - border-radius: 50%; - background: var(--accent); - border: 2px solid var(--surface); - cursor: pointer; - box-shadow: 0 0 4px rgba(99, 102, 241, 0.4); - } - footer input[type="range"]::-moz-range-thumb { - width: 12px; - height: 12px; - border-radius: 50%; - background: var(--accent); - border: 2px solid var(--surface); - 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:AN(a,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:TN.map(p=>b.jsxs("button",{onClick:()=>c(p),className:Be("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 wc=P.createContext(null);wc.displayName="PanelGroupContext";const yt={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"},hm=10,Fi=P.useLayoutEffect,Jy=B2.useId,MN=typeof Jy=="function"?Jy:()=>null;let jN=0;function pm(e=null){const n=MN(),r=P.useRef(e||n||null);return r.current===null&&(r.current=""+jN++),e??r.current}function fw({children:e,className:n="",collapsedSize:r,collapsible:l,defaultSize:a,forwardedRef:s,id:u,maxSize:c,minSize:d,onCollapse:h,onExpand:m,onResize:p,order:x,style:v,tagName:w="div",...k}){const _=P.useContext(wc);if(_===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:S,expandPanel:T,getPanelSize:E,getPanelStyle:A,groupId:U,isPanelCollapsed:z,reevaluatePanelConstraints:H,registerPanel:R,resizePanel:V,unregisterPanel:O}=_,L=pm(u),q=P.useRef({callbacks:{onCollapse:h,onExpand:m,onResize:p},constraints:{collapsedSize:r,collapsible:l,defaultSize:a,maxSize:c,minSize:d},id:L,idIsFromProps:u!==void 0,order:x});P.useRef({didLogMissingDefaultSizeWarning:!1}),Fi(()=>{const{callbacks:B,constraints:$}=q.current,M={...$};q.current.id=L,q.current.idIsFromProps=u!==void 0,q.current.order=x,B.onCollapse=h,B.onExpand=m,B.onResize=p,$.collapsedSize=r,$.collapsible=l,$.defaultSize=a,$.maxSize=c,$.minSize=d,(M.collapsedSize!==$.collapsedSize||M.collapsible!==$.collapsible||M.maxSize!==$.maxSize||M.minSize!==$.minSize)&&H(q.current,M)}),Fi(()=>{const B=q.current;return R(B),()=>{O(B)}},[x,L,R,O]),P.useImperativeHandle(s,()=>({collapse:()=>{S(q.current)},expand:B=>{T(q.current,B)},getId(){return L},getSize(){return E(q.current)},isCollapsed(){return z(q.current)},isExpanded(){return!z(q.current)},resize:B=>{V(q.current,B)}}),[S,T,E,z,L,V]);const ee=A(q.current,a);return P.createElement(w,{...k,children:e,className:n,id:L,style:{...ee,...v},[yt.groupId]:U,[yt.panel]:"",[yt.panelCollapsible]:l||void 0,[yt.panelId]:L,[yt.panelSize]:parseFloat(""+ee.flexGrow).toFixed(1)})}const So=P.forwardRef((e,n)=>P.createElement(fw,{...e,forwardedRef:n}));fw.displayName="Panel";So.displayName="forwardRef(Panel)";let Hp=null,Qu=-1,gi=null;function DN(e,n){if(n){const r=(n&gw)!==0,l=(n&xw)!==0,a=(n&yw)!==0,s=(n&vw)!==0;if(r)return a?"se-resize":s?"ne-resize":"e-resize";if(l)return a?"sw-resize":s?"nw-resize":"w-resize";if(a)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 RN(){gi!==null&&(document.head.removeChild(gi),Hp=null,gi=null,Qu=-1)}function oh(e,n){var r,l;const a=DN(e,n);if(Hp!==a){if(Hp=a,gi===null&&(gi=document.createElement("style"),document.head.appendChild(gi)),Qu>=0){var s;(s=gi.sheet)===null||s===void 0||s.removeRule(Qu)}Qu=(r=(l=gi.sheet)===null||l===void 0?void 0:l.insertRule(`*{cursor: ${a} !important;}`))!==null&&r!==void 0?r:-1}}function dw(e){return e.type==="keydown"}function hw(e){return e.type.startsWith("pointer")}function pw(e){return e.type.startsWith("mouse")}function Sc(e){if(hw(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(pw(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function ON(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function LN(e,n,r){return e.xn.x&&e.yn.y}function HN(e,n){if(e===n)throw new Error("Cannot compare node with itself");const r={a:tv(e),b:tv(n)};let l;for(;r.a.at(-1)===r.b.at(-1);)e=r.a.pop(),n=r.b.pop(),l=e;Re(l,"Stacking order can only be calculated for elements with a common ancestor");const a={a:ev(Wy(r.a)),b:ev(Wy(r.b))};if(a.a===a.b){const s=l.childNodes,u={a:r.a.at(-1),b:r.b.at(-1)};let c=s.length;for(;c--;){const d=s[c];if(d===u.a)return 1;if(d===u.b)return-1}}return Math.sign(a.a-a.b)}const BN=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function IN(e){var n;const r=getComputedStyle((n=mw(e))!==null&&n!==void 0?n:e).display;return r==="flex"||r==="inline-flex"}function qN(e){const n=getComputedStyle(e);return!!(n.position==="fixed"||n.zIndex!=="auto"&&(n.position!=="static"||IN(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"||BN.test(n.willChange)||n.webkitOverflowScrolling==="touch")}function Wy(e){let n=e.length;for(;n--;){const r=e[n];if(Re(r,"Missing node"),qN(r))return r}return null}function ev(e){return e&&Number(getComputedStyle(e).zIndex)||0}function tv(e){const n=[];for(;e;)n.push(e),e=mw(e);return n}function mw(e){const{parentNode:n}=e;return n&&n instanceof ShadowRoot?n.host:n}const gw=1,xw=2,yw=4,vw=8,UN=ON()==="coarse";let Gn=[],ra=!1,$i=new Map,_c=new Map;const Ro=new Set;function VN(e,n,r,l,a){var s;const{ownerDocument:u}=n,c={direction:r,element:n,hitAreaMargins:l,setResizeHandlerState:a},d=(s=$i.get(u))!==null&&s!==void 0?s:0;return $i.set(u,d+1),Ro.add(c),rc(),function(){var m;_c.delete(e),Ro.delete(c);const p=(m=$i.get(u))!==null&&m!==void 0?m:1;if($i.set(u,p-1),rc(),p===1&&$i.delete(u),Gn.includes(c)){const x=Gn.indexOf(c);x>=0&&Gn.splice(x,1),gm(),a("up",!0,null)}}}function PN(e){const{target:n}=e,{x:r,y:l}=Sc(e);ra=!0,mm({target:n,x:r,y:l}),rc(),Gn.length>0&&(ic("down",e),e.preventDefault(),bw(n)||e.stopImmediatePropagation())}function sh(e){const{x:n,y:r}=Sc(e);if(ra&&e.buttons===0&&(ra=!1,ic("up",e)),!ra){const{target:l}=e;mm({target:l,x:n,y:r})}ic("move",e),gm(),Gn.length>0&&e.preventDefault()}function uh(e){const{target:n}=e,{x:r,y:l}=Sc(e);_c.clear(),ra=!1,Gn.length>0&&(e.preventDefault(),bw(n)||e.stopImmediatePropagation()),ic("up",e),mm({target:n,x:r,y:l}),gm(),rc()}function bw(e){let n=e;for(;n;){if(n.hasAttribute(yt.resizeHandle))return!0;n=n.parentElement}return!1}function mm({target:e,x:n,y:r}){Gn.splice(0);let l=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(l=e),Ro.forEach(a=>{const{element:s,hitAreaMargins:u}=a,c=s.getBoundingClientRect(),{bottom:d,left:h,right:m,top:p}=c,x=UN?u.coarse:u.fine;if(n>=h-x&&n<=m+x&&r>=p-x&&r<=d+x){if(l!==null&&document.contains(l)&&s!==l&&!s.contains(l)&&!l.contains(s)&&HN(l,s)>0){let w=l,k=!1;for(;w&&!w.contains(s);){if(LN(w.getBoundingClientRect(),c)){k=!0;break}w=w.parentElement}if(k)return}Gn.push(a)}})}function ch(e,n){_c.set(e,n)}function gm(){let e=!1,n=!1;Gn.forEach(l=>{const{direction:a}=l;a==="horizontal"?e=!0:n=!0});let r=0;_c.forEach(l=>{r|=l}),e&&n?oh("intersection",r):e?oh("horizontal",r):n?oh("vertical",r):RN()}let fh=new AbortController;function rc(){fh.abort(),fh=new AbortController;const e={capture:!0,signal:fh.signal};Ro.size&&(ra?(Gn.length>0&&$i.forEach((n,r)=>{const{body:l}=r;n>0&&(l.addEventListener("contextmenu",uh,e),l.addEventListener("pointerleave",sh,e),l.addEventListener("pointermove",sh,e))}),window.addEventListener("pointerup",uh,e),window.addEventListener("pointercancel",uh,e)):$i.forEach((n,r)=>{const{body:l}=r;n>0&&(l.addEventListener("pointerdown",PN,e),l.addEventListener("pointermove",sh,e))}))}function ic(e,n){Ro.forEach(r=>{const{setResizeHandlerState:l}=r,a=Gn.includes(r);l(e,a,n)})}function $N(){const[e,n]=P.useState(0);return P.useCallback(()=>n(r=>r+1),[])}function Re(e,n){if(!e)throw console.error(n),Error(n)}function Zi(e,n,r=hm){return e.toFixed(r)===n.toFixed(r)?0:e>n?1:-1}function Ar(e,n,r=hm){return Zi(e,n,r)===0}function bn(e,n,r){return Zi(e,n,r)===0}function GN(e,n,r){if(e.length!==n.length)return!1;for(let l=0;l0&&(e=e<0?0-S:S)}}}{const p=e<0?c:d,x=r[p];Re(x,`No panel constraints found for index ${p}`);const{collapsedSize:v=0,collapsible:w,minSize:k=0}=x;if(w){const _=n[p];if(Re(_!=null,`Previous layout not found for panel index ${p}`),bn(_,k)){const S=_-v;Zi(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}}{const p=e<0?1:-1;let x=e<0?d:c,v=0;for(;;){const k=n[x];Re(k!=null,`Previous layout not found for panel index ${x}`);const S=Wl({panelConstraints:r,panelIndex:x,size:100})-k;if(v+=S,x+=p,x<0||x>=r.length)break}const w=Math.min(Math.abs(e),Math.abs(v));e=e<0?0-w:w}{let x=e<0?c:d;for(;x>=0&&x=0))break;e<0?x--:x++}}if(GN(a,u))return a;{const p=e<0?d:c,x=n[p];Re(x!=null,`Previous layout not found for panel index ${p}`);const v=x+h,w=Wl({panelConstraints:r,panelIndex:p,size:v});if(u[p]=w,!bn(w,v)){let k=v-w,S=e<0?d:c;for(;S>=0&&S0?S--:S++}}}const m=u.reduce((p,x)=>x+p,0);return bn(m,100)?u:a}function YN({layout:e,panelsArray:n,pivotIndices:r}){let l=0,a=100,s=0,u=0;const c=r[0];Re(c!=null,"No pivot index found"),n.forEach((p,x)=>{const{constraints:v}=p,{maxSize:w=100,minSize:k=0}=v;x===c?(l=k,a=w):(s+=k,u+=w)});const d=Math.min(a,100-s),h=Math.max(l,100-u),m=e[c];return{valueMax:d,valueMin:h,valueNow:m}}function Oo(e,n=document){return Array.from(n.querySelectorAll(`[${yt.resizeHandleId}][data-panel-group-id="${e}"]`))}function ww(e,n,r=document){const a=Oo(e,r).findIndex(s=>s.getAttribute(yt.resizeHandleId)===n);return a??null}function Sw(e,n,r){const l=ww(e,n,r);return l!=null?[l,l+1]:[-1,-1]}function _w(e,n=document){var r;if(n instanceof HTMLElement&&(n==null||(r=n.dataset)===null||r===void 0?void 0:r.panelGroupId)==e)return n;const l=n.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return l||null}function Ec(e,n=document){const r=n.querySelector(`[${yt.resizeHandleId}="${e}"]`);return r||null}function FN(e,n,r,l=document){var a,s,u,c;const d=Ec(n,l),h=Oo(e,l),m=d?h.indexOf(d):-1,p=(a=(s=r[m])===null||s===void 0?void 0:s.id)!==null&&a!==void 0?a:null,x=(u=(c=r[m+1])===null||c===void 0?void 0:c.id)!==null&&u!==void 0?u:null;return[p,x]}function XN({committedValuesRef:e,eagerValuesRef:n,groupId:r,layout:l,panelDataArray:a,panelGroupElement:s,setLayout:u}){P.useRef({didWarnAboutMissingResizeHandle:!1}),Fi(()=>{if(!s)return;const c=Oo(r,s);for(let d=0;d{c.forEach((d,h)=>{d.removeAttribute("aria-controls"),d.removeAttribute("aria-valuemax"),d.removeAttribute("aria-valuemin"),d.removeAttribute("aria-valuenow")})}},[r,l,a,s]),P.useEffect(()=>{if(!s)return;const c=n.current;Re(c,"Eager values not found");const{panelDataArray:d}=c,h=_w(r,s);Re(h!=null,`No group found for id "${r}"`);const m=Oo(r,s);Re(m,`No resize handles found for group id "${r}"`);const p=m.map(x=>{const v=x.getAttribute(yt.resizeHandleId);Re(v,"Resize handle element has no handle id attribute");const[w,k]=FN(r,v,d,s);if(w==null||k==null)return()=>{};const _=S=>{if(!S.defaultPrevented)switch(S.key){case"Enter":{S.preventDefault();const T=d.findIndex(E=>E.id===w);if(T>=0){const E=d[T];Re(E,`No panel data found for index ${T}`);const A=l[T],{collapsedSize:U=0,collapsible:z,minSize:H=0}=E.constraints;if(A!=null&&z){const R=_o({delta:bn(A,U)?H-U:U-A,initialLayout:l,panelConstraints:d.map(V=>V.constraints),pivotIndices:Sw(r,v,s),prevLayout:l,trigger:"keyboard"});l!==R&&u(R)}}break}}};return x.addEventListener("keydown",_),()=>{x.removeEventListener("keydown",_)}});return()=>{p.forEach(x=>x())}},[s,e,n,r,l,a,u])}function nv(e,n){if(e.length!==n.length)return!1;for(let r=0;rs.constraints);let l=0,a=100;for(let s=0;s{const s=e[a];Re(s,`Panel data not found for index ${a}`);const{callbacks:u,constraints:c,id:d}=s,{collapsedSize:h=0,collapsible:m}=c,p=r[d];if(p==null||l!==p){r[d]=l;const{onCollapse:x,onExpand:v,onResize:w}=u;w&&w(l,p),m&&(x||v)&&(v&&(p==null||Ar(p,h))&&!Ar(l,h)&&v(),x&&(p==null||!Ar(p,h))&&Ar(l,h)&&x())}})}function Ru(e,n){if(e.length!==n.length)return!1;for(let r=0;r{r!==null&&clearTimeout(r),r=setTimeout(()=>{e(...a)},n)}}function rv(e){try{if(typeof localStorage<"u")e.getItem=n=>localStorage.getItem(n),e.setItem=(n,r)=>{localStorage.setItem(n,r)};else throw new Error("localStorage not supported in this environment")}catch(n){console.error(n),e.getItem=()=>null,e.setItem=()=>{}}}function kw(e){return`react-resizable-panels:${e}`}function Nw(e){return e.map(n=>{const{constraints:r,id:l,idIsFromProps:a,order:s}=n;return a?l:s?`${s}:${JSON.stringify(r)}`:JSON.stringify(r)}).sort((n,r)=>n.localeCompare(r)).join(",")}function Cw(e,n){try{const r=kw(e),l=n.getItem(r);if(l){const a=JSON.parse(l);if(typeof a=="object"&&a!=null)return a}}catch{}return null}function eC(e,n,r){var l,a;const s=(l=Cw(e,r))!==null&&l!==void 0?l:{},u=Nw(n);return(a=s[u])!==null&&a!==void 0?a:null}function tC(e,n,r,l,a){var s;const u=kw(e),c=Nw(n),d=(s=Cw(e,a))!==null&&s!==void 0?s:{};d[c]={expandToSizes:Object.fromEntries(r.entries()),layout:l};try{a.setItem(u,JSON.stringify(d))}catch(h){console.error(h)}}function iv({layout:e,panelConstraints:n}){const r=[...e],l=r.reduce((s,u)=>s+u,0);if(r.length!==n.length)throw Error(`Invalid ${n.length} panel layout: ${r.map(s=>`${s}%`).join(", ")}`);if(!bn(l,100)&&r.length>0)for(let s=0;s(rv(Eo),Eo.getItem(e)),setItem:(e,n)=>{rv(Eo),Eo.setItem(e,n)}},lv={};function Tw({autoSaveId:e=null,children:n,className:r="",direction:l,forwardedRef:a,id:s=null,onLayout:u=null,keyboardResizeBy:c=null,storage:d=Eo,style:h,tagName:m="div",...p}){const x=pm(s),v=P.useRef(null),[w,k]=P.useState(null),[_,S]=P.useState([]),T=$N(),E=P.useRef({}),A=P.useRef(new Map),U=P.useRef(0),z=P.useRef({autoSaveId:e,direction:l,dragState:w,id:x,keyboardResizeBy:c,onLayout:u,storage:d}),H=P.useRef({layout:_,panelDataArray:[],panelDataArrayChanged:!1});P.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),P.useImperativeHandle(a,()=>({getId:()=>z.current.id,getLayout:()=>{const{layout:N}=H.current;return N},setLayout:N=>{const{onLayout:G}=z.current,{layout:X,panelDataArray:J}=H.current,ne=iv({layout:N,panelConstraints:J.map(re=>re.constraints)});nv(X,ne)||(S(ne),H.current.layout=ne,G&&G(ne),Yl(J,ne,E.current))}}),[]),Fi(()=>{z.current.autoSaveId=e,z.current.direction=l,z.current.dragState=w,z.current.id=x,z.current.onLayout=u,z.current.storage=d}),XN({committedValuesRef:z,eagerValuesRef:H,groupId:x,layout:_,panelDataArray:H.current.panelDataArray,setLayout:S,panelGroupElement:v.current}),P.useEffect(()=>{const{panelDataArray:N}=H.current;if(e){if(_.length===0||_.length!==N.length)return;let G=lv[e];G==null&&(G=WN(tC,nC),lv[e]=G);const X=[...N],J=new Map(A.current);G(e,X,J,_,d)}},[e,_,d]),P.useEffect(()=>{});const R=P.useCallback(N=>{const{onLayout:G}=z.current,{layout:X,panelDataArray:J}=H.current;if(N.constraints.collapsible){const ne=J.map(ve=>ve.constraints),{collapsedSize:re=0,panelSize:se,pivotIndices:xe}=Ui(J,N,X);if(Re(se!=null,`Panel size not found for panel "${N.id}"`),!Ar(se,re)){A.current.set(N.id,se);const ye=Zl(J,N)===J.length-1?se-re:re-se,pe=_o({delta:ye,initialLayout:X,panelConstraints:ne,pivotIndices:xe,prevLayout:X,trigger:"imperative-api"});Ru(X,pe)||(S(pe),H.current.layout=pe,G&&G(pe),Yl(J,pe,E.current))}}},[]),V=P.useCallback((N,G)=>{const{onLayout:X}=z.current,{layout:J,panelDataArray:ne}=H.current;if(N.constraints.collapsible){const re=ne.map(_e=>_e.constraints),{collapsedSize:se=0,panelSize:xe=0,minSize:ve=0,pivotIndices:ye}=Ui(ne,N,J),pe=G??ve;if(Ar(xe,se)){const _e=A.current.get(N.id),Me=_e!=null&&_e>=pe?_e:pe,ct=Zl(ne,N)===ne.length-1?xe-Me:Me-xe,nt=_o({delta:ct,initialLayout:J,panelConstraints:re,pivotIndices:ye,prevLayout:J,trigger:"imperative-api"});Ru(J,nt)||(S(nt),H.current.layout=nt,X&&X(nt),Yl(ne,nt,E.current))}}},[]),O=P.useCallback(N=>{const{layout:G,panelDataArray:X}=H.current,{panelSize:J}=Ui(X,N,G);return Re(J!=null,`Panel size not found for panel "${N.id}"`),J},[]),L=P.useCallback((N,G)=>{const{panelDataArray:X}=H.current,J=Zl(X,N);return JN({defaultSize:G,dragState:w,layout:_,panelData:X,panelIndex:J})},[w,_]),q=P.useCallback(N=>{const{layout:G,panelDataArray:X}=H.current,{collapsedSize:J=0,collapsible:ne,panelSize:re}=Ui(X,N,G);return Re(re!=null,`Panel size not found for panel "${N.id}"`),ne===!0&&Ar(re,J)},[]),ee=P.useCallback(N=>{const{layout:G,panelDataArray:X}=H.current,{collapsedSize:J=0,collapsible:ne,panelSize:re}=Ui(X,N,G);return Re(re!=null,`Panel size not found for panel "${N.id}"`),!ne||Zi(re,J)>0},[]),B=P.useCallback(N=>{const{panelDataArray:G}=H.current;G.push(N),G.sort((X,J)=>{const ne=X.order,re=J.order;return ne==null&&re==null?0:ne==null?-1:re==null?1:ne-re}),H.current.panelDataArrayChanged=!0,T()},[T]);Fi(()=>{if(H.current.panelDataArrayChanged){H.current.panelDataArrayChanged=!1;const{autoSaveId:N,onLayout:G,storage:X}=z.current,{layout:J,panelDataArray:ne}=H.current;let re=null;if(N){const xe=eC(N,ne,X);xe&&(A.current=new Map(Object.entries(xe.expandToSizes)),re=xe.layout)}re==null&&(re=KN({panelDataArray:ne}));const se=iv({layout:re,panelConstraints:ne.map(xe=>xe.constraints)});nv(J,se)||(S(se),H.current.layout=se,G&&G(se),Yl(ne,se,E.current))}}),Fi(()=>{const N=H.current;return()=>{N.layout=[]}},[]);const $=P.useCallback(N=>{let G=!1;const X=v.current;return X&&window.getComputedStyle(X,null).getPropertyValue("direction")==="rtl"&&(G=!0),function(ne){ne.preventDefault();const re=v.current;if(!re)return()=>null;const{direction:se,dragState:xe,id:ve,keyboardResizeBy:ye,onLayout:pe}=z.current,{layout:_e,panelDataArray:Me}=H.current,{initialLayout:Te}=xe??{},ct=Sw(ve,N,re);let nt=ZN(ne,N,se,xe,ye,re);const Mt=se==="horizontal";Mt&&G&&(nt=-nt);const Vt=Me.map(Rn=>Rn.constraints),Lt=_o({delta:nt,initialLayout:Te??_e,panelConstraints:Vt,pivotIndices:ct,prevLayout:_e,trigger:dw(ne)?"keyboard":"mouse-or-touch"}),En=!Ru(_e,Lt);(hw(ne)||pw(ne))&&U.current!=nt&&(U.current=nt,!En&&nt!==0?Mt?ch(N,nt<0?gw:xw):ch(N,nt<0?yw:vw):ch(N,0)),En&&(S(Lt),H.current.layout=Lt,pe&&pe(Lt),Yl(Me,Lt,E.current))}},[]),M=P.useCallback((N,G)=>{const{onLayout:X}=z.current,{layout:J,panelDataArray:ne}=H.current,re=ne.map(_e=>_e.constraints),{panelSize:se,pivotIndices:xe}=Ui(ne,N,J);Re(se!=null,`Panel size not found for panel "${N.id}"`);const ye=Zl(ne,N)===ne.length-1?se-G:G-se,pe=_o({delta:ye,initialLayout:J,panelConstraints:re,pivotIndices:xe,prevLayout:J,trigger:"imperative-api"});Ru(J,pe)||(S(pe),H.current.layout=pe,X&&X(pe),Yl(ne,pe,E.current))},[]),Y=P.useCallback((N,G)=>{const{layout:X,panelDataArray:J}=H.current,{collapsedSize:ne=0,collapsible:re}=G,{collapsedSize:se=0,collapsible:xe,maxSize:ve=100,minSize:ye=0}=N.constraints,{panelSize:pe}=Ui(J,N,X);pe!=null&&(re&&xe&&Ar(pe,ne)?Ar(ne,se)||M(N,se):peve&&M(N,ve))},[M]),Q=P.useCallback((N,G)=>{const{direction:X}=z.current,{layout:J}=H.current;if(!v.current)return;const ne=Ec(N,v.current);Re(ne,`Drag handle element not found for id "${N}"`);const re=Ew(X,G);k({dragHandleId:N,dragHandleRect:ne.getBoundingClientRect(),initialCursorPosition:re,initialLayout:J})},[]),K=P.useCallback(()=>{k(null)},[]),j=P.useCallback(N=>{const{panelDataArray:G}=H.current,X=Zl(G,N);X>=0&&(G.splice(X,1),delete E.current[N.id],H.current.panelDataArrayChanged=!0,T())},[T]),I=P.useMemo(()=>({collapsePanel:R,direction:l,dragState:w,expandPanel:V,getPanelSize:O,getPanelStyle:L,groupId:x,isPanelCollapsed:q,isPanelExpanded:ee,reevaluatePanelConstraints:Y,registerPanel:B,registerResizeHandle:$,resizePanel:M,startDragging:Q,stopDragging:K,unregisterPanel:j,panelGroupElement:v.current}),[R,w,l,V,O,L,x,q,ee,Y,B,$,M,Q,K,j]),F={display:"flex",flexDirection:l==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return P.createElement(wc.Provider,{value:I},P.createElement(m,{...p,children:n,className:r,id:s,ref:v,style:{...F,...h},[yt.group]:"",[yt.groupDirection]:l,[yt.groupId]:x}))}const Bp=P.forwardRef((e,n)=>P.createElement(Tw,{...e,forwardedRef:n}));Tw.displayName="PanelGroup";Bp.displayName="forwardRef(PanelGroup)";function Zl(e,n){return e.findIndex(r=>r===n||r.id===n.id)}function Ui(e,n,r){const l=Zl(e,n),s=l===e.length-1?[l-1,l]:[l,l+1],u=r[l];return{...n.constraints,panelSize:u,pivotIndices:s}}function rC({disabled:e,handleId:n,resizeHandler:r,panelGroupElement:l}){P.useEffect(()=>{if(e||r==null||l==null)return;const a=Ec(n,l);if(a==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(),r(u);break}case"F6":{u.preventDefault();const c=a.getAttribute(yt.groupId);Re(c,`No group element found for id "${c}"`);const d=Oo(c,l),h=ww(c,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{a.removeEventListener("keydown",s)}},[l,e,n,r])}function Ip({children:e=null,className:n="",disabled:r=!1,hitAreaMargins:l,id:a,onBlur:s,onClick:u,onDragging:c,onFocus:d,onPointerDown:h,onPointerUp:m,style:p={},tabIndex:x=0,tagName:v="div",...w}){var k,_;const S=P.useRef(null),T=P.useRef({onClick:u,onDragging:c,onPointerDown:h,onPointerUp:m});P.useEffect(()=>{T.current.onClick=u,T.current.onDragging=c,T.current.onPointerDown=h,T.current.onPointerUp=m});const E=P.useContext(wc);if(E===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:A,groupId:U,registerResizeHandle:z,startDragging:H,stopDragging:R,panelGroupElement:V}=E,O=pm(a),[L,q]=P.useState("inactive"),[ee,B]=P.useState(!1),[$,M]=P.useState(null),Y=P.useRef({state:L});Fi(()=>{Y.current.state=L}),P.useEffect(()=>{if(r)M(null);else{const I=z(O);M(()=>I)}},[r,O,z]);const Q=(k=l==null?void 0:l.coarse)!==null&&k!==void 0?k:15,K=(_=l==null?void 0:l.fine)!==null&&_!==void 0?_:5;P.useEffect(()=>{if(r||$==null)return;const I=S.current;Re(I,"Element ref not attached");let F=!1;return VN(O,I,A,{coarse:Q,fine:K},(G,X,J)=>{if(!X){q("inactive");return}switch(G){case"down":{q("drag"),F=!1,Re(J,'Expected event to be defined for "down" action'),H(O,J);const{onDragging:ne,onPointerDown:re}=T.current;ne==null||ne(!0),re==null||re();break}case"move":{const{state:ne}=Y.current;F=!0,ne!=="drag"&&q("hover"),Re(J,'Expected event to be defined for "move" action'),$(J);break}case"up":{q("hover"),R();const{onClick:ne,onDragging:re,onPointerUp:se}=T.current;re==null||re(!1),se==null||se(),F||ne==null||ne();break}}})},[Q,A,r,K,z,O,$,H,R]),rC({disabled:r,handleId:O,resizeHandler:$,panelGroupElement:V});const j={touchAction:"none",userSelect:"none"};return P.createElement(v,{...w,children:e,className:n,id:a,onBlur:()=>{B(!1),s==null||s()},onFocus:()=>{B(!0),d==null||d()},ref:S,role:"separator",style:{...j,...p},tabIndex:x,[yt.groupDirection]:A,[yt.groupId]:U,[yt.resizeHandle]:"",[yt.resizeHandleActive]:L==="drag"?"pointer":ee?"keyboard":void 0,[yt.resizeHandleEnabled]:!r,[yt.resizeHandleId]:O,[yt.resizeHandleState]:L})}Ip.displayName="PanelResizeHandle";function zt(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let r=0,l;r{}};function kc(){for(var e=0,n=arguments.length,r={},l;e=0&&(l=r.slice(a+1),r=r.slice(0,a)),r&&!n.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:l}})}Zu.prototype=kc.prototype={constructor:Zu,on:function(e,n){var r=this._,l=lC(e+"",r),a,s=-1,u=l.length;if(arguments.length<2){for(;++s0)for(var r=new Array(a),l=0,a,s;l=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),ov.hasOwnProperty(n)?{space:ov[n],local:e}:e}function oC(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===qp&&n.documentElement.namespaceURI===qp?n.createElement(e):n.createElementNS(r,e)}}function sC(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Aw(e){var n=Nc(e);return(n.local?sC:oC)(n)}function uC(){}function xm(e){return e==null?uC:function(){return this.querySelector(e)}}function cC(e){typeof e!="function"&&(e=xm(e));for(var n=this._groups,r=n.length,l=new Array(r),a=0;a=E&&(E=T+1);!(U=_[E])&&++E=0;)(u=l[a])&&(s&&u.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(u,s),s=u);return this}function OC(e){e||(e=LC);function n(p,x){return p&&x?e(p.__data__,x.__data__):!p-!x}for(var r=this._groups,l=r.length,a=new Array(l),s=0;sn?1:e>=n?0:NaN}function HC(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function BC(){return Array.from(this)}function IC(){for(var e=this._groups,n=0,r=e.length;n1?this.each((n==null?ZC:typeof n=="function"?JC:KC)(e,n,r??"")):oa(this.node(),e)}function oa(e,n){return e.style.getPropertyValue(n)||Rw(e).getComputedStyle(e,null).getPropertyValue(n)}function eT(e){return function(){delete this[e]}}function tT(e,n){return function(){this[e]=n}}function nT(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function rT(e,n){return arguments.length>1?this.each((n==null?eT:typeof n=="function"?nT:tT)(e,n)):this.node()[e]}function Ow(e){return e.trim().split(/^|\s+/)}function ym(e){return e.classList||new Lw(e)}function Lw(e){this._node=e,this._names=Ow(e.getAttribute("class")||"")}Lw.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 Hw(e,n){for(var r=ym(e),l=-1,a=n.length;++l=0&&(r=n.slice(l+1),n=n.slice(0,l)),{type:n,name:r}})}function MT(e){return function(){var n=this.__on;if(n){for(var r=0,l=-1,a=n.length,s;r()=>e;function Up(e,{sourceEvent:n,subject:r,target:l,identifier:a,active:s,x:u,y:c,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:r,enumerable:!0,configurable:!0},target:{value:l,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:m}})}Up.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function UT(e){return!e.ctrlKey&&!e.button}function VT(){return this.parentNode}function PT(e,n){return n??{x:e.x,y:e.y}}function $T(){return navigator.maxTouchPoints||"ontouchstart"in this}function Pw(){var e=UT,n=VT,r=PT,l=$T,a={},s=kc("start","drag","end"),u=0,c,d,h,m,p=0;function x(A){A.on("mousedown.drag",v).filter(l).on("touchstart.drag",_).on("touchmove.drag",S,qT).on("touchend.drag touchcancel.drag",T).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(A,U){if(!(m||!e.call(this,A,U))){var z=E(this,n.call(this,A,U),A,U,"mouse");z&&(wn(A.view).on("mousemove.drag",w,Lo).on("mouseup.drag",k,Lo),Uw(A.view),dh(A),h=!1,c=A.clientX,d=A.clientY,z("start",A))}}function w(A){if(ia(A),!h){var U=A.clientX-c,z=A.clientY-d;h=U*U+z*z>p}a.mouse("drag",A)}function k(A){wn(A.view).on("mousemove.drag mouseup.drag",null),Vw(A.view,h),ia(A),a.mouse("end",A)}function _(A,U){if(e.call(this,A,U)){var z=A.changedTouches,H=n.call(this,A,U),R=z.length,V,O;for(V=0;V>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):r===8?Lu(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):r===4?Lu(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=YT.exec(e))?new un(n[1],n[2],n[3],1):(n=FT.exec(e))?new un(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=XT.exec(e))?Lu(n[1],n[2],n[3],n[4]):(n=QT.exec(e))?Lu(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=ZT.exec(e))?pv(n[1],n[2]/100,n[3]/100,1):(n=KT.exec(e))?pv(n[1],n[2]/100,n[3]/100,n[4]):sv.hasOwnProperty(e)?fv(sv[e]):e==="transparent"?new un(NaN,NaN,NaN,0):null}function fv(e){return new un(e>>16&255,e>>8&255,e&255,1)}function Lu(e,n,r,l){return l<=0&&(e=n=r=NaN),new un(e,n,r,l)}function e3(e){return e instanceof Ko||(e=Ki(e)),e?(e=e.rgb(),new un(e.r,e.g,e.b,e.opacity)):new un}function Vp(e,n,r,l){return arguments.length===1?e3(e):new un(e,n,r,l??1)}function un(e,n,r,l){this.r=+e,this.g=+n,this.b=+r,this.opacity=+l}vm(un,Vp,$w(Ko,{brighter(e){return e=e==null?ac:Math.pow(ac,e),new un(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ho:Math.pow(Ho,e),new un(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new un(Xi(this.r),Xi(this.g),Xi(this.b),oc(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:dv,formatHex:dv,formatHex8:t3,formatRgb:hv,toString:hv}));function dv(){return`#${Gi(this.r)}${Gi(this.g)}${Gi(this.b)}`}function t3(){return`#${Gi(this.r)}${Gi(this.g)}${Gi(this.b)}${Gi((isNaN(this.opacity)?1:this.opacity)*255)}`}function hv(){const e=oc(this.opacity);return`${e===1?"rgb(":"rgba("}${Xi(this.r)}, ${Xi(this.g)}, ${Xi(this.b)}${e===1?")":`, ${e})`}`}function oc(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Xi(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Gi(e){return e=Xi(e),(e<16?"0":"")+e.toString(16)}function pv(e,n,r,l){return l<=0?e=n=r=NaN:r<=0||r>=1?e=n=NaN:n<=0&&(e=NaN),new Un(e,n,r,l)}function Gw(e){if(e instanceof Un)return new Un(e.h,e.s,e.l,e.opacity);if(e instanceof Ko||(e=Ki(e)),!e)return new Un;if(e instanceof Un)return e;e=e.rgb();var n=e.r/255,r=e.g/255,l=e.b/255,a=Math.min(n,r,l),s=Math.max(n,r,l),u=NaN,c=s-a,d=(s+a)/2;return c?(n===s?u=(r-l)/c+(r0&&d<1?0:u,new Un(u,c,d,e.opacity)}function n3(e,n,r,l){return arguments.length===1?Gw(e):new Un(e,n,r,l??1)}function Un(e,n,r,l){this.h=+e,this.s=+n,this.l=+r,this.opacity=+l}vm(Un,n3,$w(Ko,{brighter(e){return e=e==null?ac:Math.pow(ac,e),new Un(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ho:Math.pow(Ho,e),new Un(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,r=this.l,l=r+(r<.5?r:1-r)*n,a=2*r-l;return new un(hh(e>=240?e-240:e+120,a,l),hh(e,a,l),hh(e<120?e+240:e-120,a,l),this.opacity)},clamp(){return new Un(mv(this.h),Hu(this.s),Hu(this.l),oc(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=oc(this.opacity);return`${e===1?"hsl(":"hsla("}${mv(this.h)}, ${Hu(this.s)*100}%, ${Hu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function mv(e){return e=(e||0)%360,e<0?e+360:e}function Hu(e){return Math.max(0,Math.min(1,e||0))}function hh(e,n,r){return(e<60?n+(r-n)*e/60:e<180?r:e<240?n+(r-n)*(240-e)/60:n)*255}const bm=e=>()=>e;function r3(e,n){return function(r){return e+r*n}}function i3(e,n,r){return e=Math.pow(e,r),n=Math.pow(n,r)-e,r=1/r,function(l){return Math.pow(e+l*n,r)}}function l3(e){return(e=+e)==1?Yw:function(n,r){return r-n?i3(n,r,e):bm(isNaN(n)?r:n)}}function Yw(e,n){var r=n-e;return r?r3(e,r):bm(isNaN(e)?n:e)}const sc=(function e(n){var r=l3(n);function l(a,s){var u=r((a=Vp(a)).r,(s=Vp(s)).r),c=r(a.g,s.g),d=r(a.b,s.b),h=Yw(a.opacity,s.opacity);return function(m){return a.r=u(m),a.g=c(m),a.b=d(m),a.opacity=h(m),a+""}}return l.gamma=e,l})(1);function a3(e,n){n||(n=[]);var r=e?Math.min(n.length,e.length):0,l=n.slice(),a;return function(s){for(a=0;ar&&(s=n.slice(r,s),c[u]?c[u]+=s:c[++u]=s),(l=l[0])===(a=a[0])?c[u]?c[u]+=a:c[++u]=a:(c[++u]=null,d.push({i:u,x:nr(l,a)})),r=ph.lastIndex;return r180?m+=360:m-h>180&&(h+=360),x.push({i:p.push(a(p)+"rotate(",null,l)-2,x:nr(h,m)})):m&&p.push(a(p)+"rotate("+m+l)}function c(h,m,p,x){h!==m?x.push({i:p.push(a(p)+"skewX(",null,l)-2,x:nr(h,m)}):m&&p.push(a(p)+"skewX("+m+l)}function d(h,m,p,x,v,w){if(h!==p||m!==x){var k=v.push(a(v)+"scale(",null,",",null,")");w.push({i:k-4,x:nr(h,p)},{i:k-2,x:nr(m,x)})}else(p!==1||x!==1)&&v.push(a(v)+"scale("+p+","+x+")")}return function(h,m){var p=[],x=[];return h=e(h),m=e(m),s(h.translateX,h.translateY,m.translateX,m.translateY,p,x),u(h.rotate,m.rotate,p,x),c(h.skewX,m.skewX,p,x),d(h.scaleX,h.scaleY,m.scaleX,m.scaleY,p,x),h=m=null,function(v){for(var w=-1,k=x.length,_;++w=0&&e._call.call(void 0,n),e=e._next;--sa}function yv(){Ji=(cc=Io.now())+Cc,sa=ko=0;try{w3()}finally{sa=0,_3(),Ji=0}}function S3(){var e=Io.now(),n=e-cc;n>Zw&&(Cc-=n,cc=e)}function _3(){for(var e,n=uc,r,l=1/0;n;)n._call?(l>n._time&&(l=n._time),e=n,n=n._next):(r=n._next,n._next=null,n=e?e._next=r:uc=r);No=e,Gp(l)}function Gp(e){if(!sa){ko&&(ko=clearTimeout(ko));var n=e-Ji;n>24?(e<1/0&&(ko=setTimeout(yv,e-Io.now()-Cc)),go&&(go=clearInterval(go))):(go||(cc=Io.now(),go=setInterval(S3,Zw)),sa=1,Kw(yv))}}function vv(e,n,r){var l=new fc;return n=n==null?0:+n,l.restart(a=>{l.stop(),e(a+n)},n,r),l}var E3=kc("start","end","cancel","interrupt"),k3=[],Ww=0,bv=1,Yp=2,Ju=3,wv=4,Fp=5,Wu=6;function Tc(e,n,r,l,a,s){var u=e.__transition;if(!u)e.__transition={};else if(r in u)return;N3(e,r,{name:n,index:l,group:a,on:E3,tween:k3,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Ww})}function Sm(e,n){var r=Xn(e,n);if(r.state>Ww)throw new Error("too late; already scheduled");return r}function lr(e,n){var r=Xn(e,n);if(r.state>Ju)throw new Error("too late; already running");return r}function Xn(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function N3(e,n,r){var l=e.__transition,a;l[n]=r,r.timer=Jw(s,0,r.time);function s(h){r.state=bv,r.timer.restart(u,r.delay,r.time),r.delay<=h&&u(h-r.delay)}function u(h){var m,p,x,v;if(r.state!==bv)return d();for(m in l)if(v=l[m],v.name===r.name){if(v.state===Ju)return vv(u);v.state===wv?(v.state=Wu,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete l[m]):+mYp&&l.state=0&&(n=n.slice(0,r)),!n||n==="start"})}function nA(e,n,r){var l,a,s=tA(n)?Sm:lr;return function(){var u=s(this,e),c=u.on;c!==l&&(a=(l=c).copy()).on(n,r),u.on=a}}function rA(e,n){var r=this._id;return arguments.length<2?Xn(this.node(),r).on.on(e):this.each(nA(r,e,n))}function iA(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function lA(){return this.on("end.remove",iA(this._id))}function aA(e){var n=this._name,r=this._id;typeof e!="function"&&(e=xm(e));for(var l=this._groups,a=l.length,s=new Array(a),u=0;u()=>e;function MA(e,{sourceEvent:n,target:r,transform:l,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:l,enumerable:!0,configurable:!0},_:{value:a}})}function zr(e,n,r){this.k=e,this.x=n,this.y=r}zr.prototype={constructor:zr,scale:function(e){return e===1?this:new zr(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new zr(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 Ac=new zr(1,0,0);rS.prototype=zr.prototype;function rS(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ac;return e.__zoom}function mh(e){e.stopImmediatePropagation()}function xo(e){e.preventDefault(),e.stopImmediatePropagation()}function jA(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function DA(){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 Sv(){return this.__zoom||Ac}function RA(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function OA(){return navigator.maxTouchPoints||"ontouchstart"in this}function LA(e,n,r){var l=e.invertX(n[0][0])-r[0][0],a=e.invertX(n[1][0])-r[1][0],s=e.invertY(n[0][1])-r[0][1],u=e.invertY(n[1][1])-r[1][1];return e.translate(a>l?(l+a)/2:Math.min(0,l)||Math.max(0,a),u>s?(s+u)/2:Math.min(0,s)||Math.max(0,u))}function iS(){var e=jA,n=DA,r=LA,l=RA,a=OA,s=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],c=250,d=Ku,h=kc("start","zoom","end"),m,p,x,v=500,w=150,k=0,_=10;function S(B){B.property("__zoom",Sv).on("wheel.zoom",R,{passive:!1}).on("mousedown.zoom",V).on("dblclick.zoom",O).filter(a).on("touchstart.zoom",L).on("touchmove.zoom",q).on("touchend.zoom touchcancel.zoom",ee).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(B,$,M,Y){var Q=B.selection?B.selection():B;Q.property("__zoom",Sv),B!==Q?U(B,$,M,Y):Q.interrupt().each(function(){z(this,arguments).event(Y).start().zoom(null,typeof $=="function"?$.apply(this,arguments):$).end()})},S.scaleBy=function(B,$,M,Y){S.scaleTo(B,function(){var Q=this.__zoom.k,K=typeof $=="function"?$.apply(this,arguments):$;return Q*K},M,Y)},S.scaleTo=function(B,$,M,Y){S.transform(B,function(){var Q=n.apply(this,arguments),K=this.__zoom,j=M==null?A(Q):typeof M=="function"?M.apply(this,arguments):M,I=K.invert(j),F=typeof $=="function"?$.apply(this,arguments):$;return r(E(T(K,F),j,I),Q,u)},M,Y)},S.translateBy=function(B,$,M,Y){S.transform(B,function(){return r(this.__zoom.translate(typeof $=="function"?$.apply(this,arguments):$,typeof M=="function"?M.apply(this,arguments):M),n.apply(this,arguments),u)},null,Y)},S.translateTo=function(B,$,M,Y,Q){S.transform(B,function(){var K=n.apply(this,arguments),j=this.__zoom,I=Y==null?A(K):typeof Y=="function"?Y.apply(this,arguments):Y;return r(Ac.translate(I[0],I[1]).scale(j.k).translate(typeof $=="function"?-$.apply(this,arguments):-$,typeof M=="function"?-M.apply(this,arguments):-M),K,u)},Y,Q)};function T(B,$){return $=Math.max(s[0],Math.min(s[1],$)),$===B.k?B:new zr($,B.x,B.y)}function E(B,$,M){var Y=$[0]-M[0]*B.k,Q=$[1]-M[1]*B.k;return Y===B.x&&Q===B.y?B:new zr(B.k,Y,Q)}function A(B){return[(+B[0][0]+ +B[1][0])/2,(+B[0][1]+ +B[1][1])/2]}function U(B,$,M,Y){B.on("start.zoom",function(){z(this,arguments).event(Y).start()}).on("interrupt.zoom end.zoom",function(){z(this,arguments).event(Y).end()}).tween("zoom",function(){var Q=this,K=arguments,j=z(Q,K).event(Y),I=n.apply(Q,K),F=M==null?A(I):typeof M=="function"?M.apply(Q,K):M,N=Math.max(I[1][0]-I[0][0],I[1][1]-I[0][1]),G=Q.__zoom,X=typeof $=="function"?$.apply(Q,K):$,J=d(G.invert(F).concat(N/G.k),X.invert(F).concat(N/X.k));return function(ne){if(ne===1)ne=X;else{var re=J(ne),se=N/re[2];ne=new zr(se,F[0]-re[0]*se,F[1]-re[1]*se)}j.zoom(null,ne)}})}function z(B,$,M){return!M&&B.__zooming||new H(B,$)}function H(B,$){this.that=B,this.args=$,this.active=0,this.sourceEvent=null,this.extent=n.apply(B,$),this.taps=0}H.prototype={event:function(B){return B&&(this.sourceEvent=B),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(B,$){return this.mouse&&B!=="mouse"&&(this.mouse[1]=$.invert(this.mouse[0])),this.touch0&&B!=="touch"&&(this.touch0[1]=$.invert(this.touch0[0])),this.touch1&&B!=="touch"&&(this.touch1[1]=$.invert(this.touch1[0])),this.that.__zoom=$,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(B){var $=wn(this.that).datum();h.call(B,this.that,new MA(B,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:h}),$)}};function R(B,...$){if(!e.apply(this,arguments))return;var M=z(this,$).event(B),Y=this.__zoom,Q=Math.max(s[0],Math.min(s[1],Y.k*Math.pow(2,l.apply(this,arguments)))),K=qn(B);if(M.wheel)(M.mouse[0][0]!==K[0]||M.mouse[0][1]!==K[1])&&(M.mouse[1]=Y.invert(M.mouse[0]=K)),clearTimeout(M.wheel);else{if(Y.k===Q)return;M.mouse=[K,Y.invert(K)],ec(this),M.start()}xo(B),M.wheel=setTimeout(j,w),M.zoom("mouse",r(E(T(Y,Q),M.mouse[0],M.mouse[1]),M.extent,u));function j(){M.wheel=null,M.end()}}function V(B,...$){if(x||!e.apply(this,arguments))return;var M=B.currentTarget,Y=z(this,$,!0).event(B),Q=wn(B.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",N,!0),K=qn(B,M),j=B.clientX,I=B.clientY;Uw(B.view),mh(B),Y.mouse=[K,this.__zoom.invert(K)],ec(this),Y.start();function F(G){if(xo(G),!Y.moved){var X=G.clientX-j,J=G.clientY-I;Y.moved=X*X+J*J>k}Y.event(G).zoom("mouse",r(E(Y.that.__zoom,Y.mouse[0]=qn(G,M),Y.mouse[1]),Y.extent,u))}function N(G){Q.on("mousemove.zoom mouseup.zoom",null),Vw(G.view,Y.moved),xo(G),Y.event(G).end()}}function O(B,...$){if(e.apply(this,arguments)){var M=this.__zoom,Y=qn(B.changedTouches?B.changedTouches[0]:B,this),Q=M.invert(Y),K=M.k*(B.shiftKey?.5:2),j=r(E(T(M,K),Y,Q),n.apply(this,$),u);xo(B),c>0?wn(this).transition().duration(c).call(U,j,Y,B):wn(this).call(S.transform,j,Y,B)}}function L(B,...$){if(e.apply(this,arguments)){var M=B.touches,Y=M.length,Q=z(this,$,B.changedTouches.length===Y).event(B),K,j,I,F;for(mh(B),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:r,targetHandle:l})=>`Couldn't create edge for ${e} handle id: "${e==="source"?r: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."},qo=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],lS=["Enter"," ","Escape"],aS={"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:r})=>`Moved selected node ${e}. New position, x: ${n}, y: ${r}`,"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 ua;(function(e){e.Strict="strict",e.Loose="loose"})(ua||(ua={}));var Qi;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Qi||(Qi={}));var Uo;(function(e){e.Partial="partial",e.Full="full"})(Uo||(Uo={}));const oS={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var xi;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(xi||(xi={}));var dc;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(dc||(dc={}));var be;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(be||(be={}));const _v={[be.Left]:be.Right,[be.Right]:be.Left,[be.Top]:be.Bottom,[be.Bottom]:be.Top};function sS(e){return e===null?null:e?"valid":"invalid"}const uS=e=>"id"in e&&"source"in e&&"target"in e,HA=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),Jo=(e,n=[0,0])=>{const{width:r,height:l}=Rr(e),a=e.origin??n,s=r*a[0],u=l*a[1];return{x:e.position.x-s,y:e.position.y-u}},BA=(e,n={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((l,a)=>{const s=typeof a=="string";let u=!n.nodeLookup&&!s?a:void 0;n.nodeLookup&&(u=s?n.nodeLookup.get(a):Em(a)?a:n.nodeLookup.get(a.id));const c=u?hc(u,n.nodeOrigin):{x:0,y:0,x2:0,y2:0};return zc(l,c)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Mc(r)},Wo=(e,n={})=>{let r={x:1/0,y:1/0,x2:-1/0,y2:-1/0},l=!1;return e.forEach(a=>{(n.filter===void 0||n.filter(a))&&(r=zc(r,hc(a)),l=!0)}),l?Mc(r):{x:0,y:0,width:0,height:0}},km=(e,n,[r,l,a]=[0,0,1],s=!1,u=!1)=>{const c={...ts(n,[r,l,a]),width:n.width/a,height:n.height/a},d=[];for(const h of e.values()){const{measured:m,selectable:p=!0,hidden:x=!1}=h;if(u&&!p||x)continue;const v=m.width??h.width??h.initialWidth??null,w=m.height??h.height??h.initialHeight??null,k=Vo(c,fa(h)),_=(v??0)*(w??0),S=s&&k>0;(!h.internals.handleBounds||S||k>=_||h.dragging)&&d.push(h)}return d},IA=(e,n)=>{const r=new Set;return e.forEach(l=>{r.add(l.id)}),n.filter(l=>r.has(l.source)||r.has(l.target))};function qA(e,n){const r=new Map,l=n!=null&&n.nodes?new Set(n.nodes.map(a=>a.id)):null;return e.forEach(a=>{a.measured.width&&a.measured.height&&((n==null?void 0:n.includeHiddenNodes)||!a.hidden)&&(!l||l.has(a.id))&&r.set(a.id,a)}),r}async function UA({nodes:e,width:n,height:r,panZoom:l,minZoom:a,maxZoom:s},u){if(e.size===0)return Promise.resolve(!0);const c=qA(e,u),d=Wo(c),h=Nm(d,n,r,(u==null?void 0:u.minZoom)??a,(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 cS({nodeId:e,nextPosition:n,nodeLookup:r,nodeOrigin:l=[0,0],nodeExtent:a,onError:s}){const u=r.get(e),c=u.parentId?r.get(u.parentId):void 0,{x:d,y:h}=c?c.internals.positionAbsolute:{x:0,y:0},m=u.origin??l;let p=u.extent||a;if(u.extent==="parent"&&!u.expandParent)if(!c)s==null||s("005",ir.error005());else{const v=c.measured.width,w=c.measured.height;v&&w&&(p=[[d,h],[d+v,h+w]])}else c&&da(u.extent)&&(p=[[u.extent[0][0]+d,u.extent[0][1]+h],[u.extent[1][0]+d,u.extent[1][1]+h]]);const x=da(p)?Wi(n,p,u.measured):n;return(u.measured.width===void 0||u.measured.height===void 0)&&(s==null||s("015",ir.error015())),{position:{x:x.x-d+(u.measured.width??0)*m[0],y:x.y-h+(u.measured.height??0)*m[1]},positionAbsolute:x}}async function VA({nodesToRemove:e=[],edgesToRemove:n=[],nodes:r,edges:l,onBeforeDelete:a}){const s=new Set(e.map(x=>x.id)),u=[];for(const x of r){if(x.deletable===!1)continue;const v=s.has(x.id),w=!v&&x.parentId&&u.find(k=>k.id===x.parentId);(v||w)&&u.push(x)}const c=new Set(n.map(x=>x.id)),d=l.filter(x=>x.deletable!==!1),m=IA(u,d);for(const x of d)c.has(x.id)&&!m.find(w=>w.id===x.id)&&m.push(x);if(!a)return{edges:m,nodes:u};const p=await a({nodes:u,edges:m});return typeof p=="boolean"?p?{edges:m,nodes:u}:{edges:[],nodes:[]}:p}const ca=(e,n=0,r=1)=>Math.min(Math.max(e,n),r),Wi=(e={x:0,y:0},n,r)=>({x:ca(e.x,n[0][0],n[1][0]-((r==null?void 0:r.width)??0)),y:ca(e.y,n[0][1],n[1][1]-((r==null?void 0:r.height)??0))});function fS(e,n,r){const{width:l,height:a}=Rr(r),{x:s,y:u}=r.internals.positionAbsolute;return Wi(e,[[s,u],[s+l,u+a]],n)}const Ev=(e,n,r)=>er?-ca(Math.abs(e-r),1,n)/n:0,dS=(e,n,r=15,l=40)=>{const a=Ev(e.x,l,n.width-l)*r,s=Ev(e.y,l,n.height-l)*r;return[a,s]},zc=(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)}),Xp=({x:e,y:n,width:r,height:l})=>({x:e,y:n,x2:e+r,y2:n+l}),Mc=({x:e,y:n,x2:r,y2:l})=>({x:e,y:n,width:r-e,height:l-n}),fa=(e,n=[0,0])=>{var a,s;const{x:r,y:l}=Em(e)?e.internals.positionAbsolute:Jo(e,n);return{x:r,y:l,width:((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},hc=(e,n=[0,0])=>{var a,s;const{x:r,y:l}=Em(e)?e.internals.positionAbsolute:Jo(e,n);return{x:r,y:l,x2:r+(((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0),y2:l+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},hS=(e,n)=>Mc(zc(Xp(e),Xp(n))),Vo=(e,n)=>{const r=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(r*l)},kv=e=>Vn(e.width)&&Vn(e.height)&&Vn(e.x)&&Vn(e.y),Vn=e=>!isNaN(e)&&isFinite(e),PA=(e,n)=>{},es=(e,n=[1,1])=>({x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}),ts=({x:e,y:n},[r,l,a],s=!1,u=[1,1])=>{const c={x:(e-r)/a,y:(n-l)/a};return s?es(c,u):c},pc=({x:e,y:n},[r,l,a])=>({x:e*a+r,y:n*a+l});function Fl(e,n){if(typeof e=="number")return Math.floor((n-n/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(r)}if(typeof e=="string"&&e.endsWith("%")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(n*r*.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 $A(e,n,r){if(typeof e=="string"||typeof e=="number"){const l=Fl(e,r),a=Fl(e,n);return{top:l,right:a,bottom:l,left:a,x:a*2,y:l*2}}if(typeof e=="object"){const l=Fl(e.top??e.y??0,r),a=Fl(e.bottom??e.y??0,r),s=Fl(e.left??e.x??0,n),u=Fl(e.right??e.x??0,n);return{top:l,right:u,bottom:a,left:s,x:s+u,y:l+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function GA(e,n,r,l,a,s){const{x:u,y:c}=pc(e,[n,r,l]),{x:d,y:h}=pc({x:e.x+e.width,y:e.y+e.height},[n,r,l]),m=a-d,p=s-h;return{left:Math.floor(u),top:Math.floor(c),right:Math.floor(m),bottom:Math.floor(p)}}const Nm=(e,n,r,l,a,s)=>{const u=$A(s,n,r),c=(n-u.x)/e.width,d=(r-u.y)/e.height,h=Math.min(c,d),m=ca(h,l,a),p=e.x+e.width/2,x=e.y+e.height/2,v=n/2-p*m,w=r/2-x*m,k=GA(e,v,w,m,n,r),_={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-_.left+_.right,y:w-_.top+_.bottom,zoom:m}},Po=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function da(e){return e!=null&&e!=="parent"}function Rr(e){var n,r;return{width:((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth??0,height:((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0}}function pS(e){var n,r;return(((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth)!==void 0&&(((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight)!==void 0}function mS(e,n={width:0,height:0},r,l,a){const s={...e},u=l.get(r);if(u){const c=u.origin||a;s.x+=u.internals.positionAbsolute.x-(n.width??0)*c[0],s.y+=u.internals.positionAbsolute.y-(n.height??0)*c[1]}return s}function Nv(e,n){if(e.size!==n.size)return!1;for(const r of e)if(!n.has(r))return!1;return!0}function YA(){let e,n;return{promise:new Promise((l,a)=>{e=l,n=a}),resolve:e,reject:n}}function FA(e){return{...aS,...e||{}}}function Ao(e,{snapGrid:n=[0,0],snapToGrid:r=!1,transform:l,containerBounds:a}){const{x:s,y:u}=Pn(e),c=ts({x:s-((a==null?void 0:a.left)??0),y:u-((a==null?void 0:a.top)??0)},l),{x:d,y:h}=r?es(c,n):c;return{xSnapped:d,ySnapped:h,...c}}const Cm=e=>({width:e.offsetWidth,height:e.offsetHeight}),gS=e=>{var n;return((n=e==null?void 0:e.getRootNode)==null?void 0:n.call(e))||(window==null?void 0:window.document)},XA=["INPUT","SELECT","TEXTAREA"];function xS(e){var l,a;const n=((a=(l=e.composedPath)==null?void 0:l.call(e))==null?void 0:a[0])||e.target;return(n==null?void 0:n.nodeType)!==1?!1:XA.includes(n.nodeName)||n.hasAttribute("contenteditable")||!!n.closest(".nokey")}const yS=e=>"clientX"in e,Pn=(e,n)=>{var s,u;const r=yS(e),l=r?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,a=r?e.clientY:(u=e.touches)==null?void 0:u[0].clientY;return{x:l-((n==null?void 0:n.left)??0),y:a-((n==null?void 0:n.top)??0)}},Cv=(e,n,r,l,a)=>{const s=n.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(u=>{const c=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),type:e,nodeId:a,position:u.getAttribute("data-handlepos"),x:(c.left-r.left)/l,y:(c.top-r.top)/l,...Cm(u)}})};function vS({sourceX:e,sourceY:n,targetX:r,targetY:l,sourceControlX:a,sourceControlY:s,targetControlX:u,targetControlY:c}){const d=e*.125+a*.375+u*.375+r*.125,h=n*.125+s*.375+c*.375+l*.125,m=Math.abs(d-e),p=Math.abs(h-n);return[d,h,m,p]}function qu(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function Tv({pos:e,x1:n,y1:r,x2:l,y2:a,c:s}){switch(e){case be.Left:return[n-qu(n-l,s),r];case be.Right:return[n+qu(l-n,s),r];case be.Top:return[n,r-qu(r-a,s)];case be.Bottom:return[n,r+qu(a-r,s)]}}function Tm({sourceX:e,sourceY:n,sourcePosition:r=be.Bottom,targetX:l,targetY:a,targetPosition:s=be.Top,curvature:u=.25}){const[c,d]=Tv({pos:r,x1:e,y1:n,x2:l,y2:a,c:u}),[h,m]=Tv({pos:s,x1:l,y1:a,x2:e,y2:n,c:u}),[p,x,v,w]=vS({sourceX:e,sourceY:n,targetX:l,targetY:a,sourceControlX:c,sourceControlY:d,targetControlX:h,targetControlY:m});return[`M${e},${n} C${c},${d} ${h},${m} ${l},${a}`,p,x,v,w]}function bS({sourceX:e,sourceY:n,targetX:r,targetY:l}){const a=Math.abs(r-e)/2,s=r0}const KA=({source:e,sourceHandle:n,target:r,targetHandle:l})=>`xy-edge__${e}${n||""}-${r}${l||""}`,JA=(e,n)=>n.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),WA=(e,n,r={})=>{if(!e.source||!e.target)return n;const l=r.getEdgeId||KA;let a;return uS(e)?a={...e}:a={...e,id:l(e)},JA(a,n)?n:(a.sourceHandle===null&&delete a.sourceHandle,a.targetHandle===null&&delete a.targetHandle,n.concat(a))};function wS({sourceX:e,sourceY:n,targetX:r,targetY:l}){const[a,s,u,c]=bS({sourceX:e,sourceY:n,targetX:r,targetY:l});return[`M ${e},${n}L ${r},${l}`,a,s,u,c]}const Av={[be.Left]:{x:-1,y:0},[be.Right]:{x:1,y:0},[be.Top]:{x:0,y:-1},[be.Bottom]:{x:0,y:1}},ez=({source:e,sourcePosition:n=be.Bottom,target:r})=>n===be.Left||n===be.Right?e.xMath.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function tz({source:e,sourcePosition:n=be.Bottom,target:r,targetPosition:l=be.Top,center:a,offset:s,stepPosition:u}){const c=Av[n],d=Av[l],h={x:e.x+c.x*s,y:e.y+c.y*s},m={x:r.x+d.x*s,y:r.y+d.y*s},p=ez({source:h,sourcePosition:n,target:m}),x=p.x!==0?"x":"y",v=p[x];let w=[],k,_;const S={x:0,y:0},T={x:0,y:0},[,,E,A]=bS({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(c[x]*d[x]===-1){x==="x"?(k=a.x??h.x+(m.x-h.x)*u,_=a.y??(h.y+m.y)/2):(k=a.x??(h.x+m.x)/2,_=a.y??h.y+(m.y-h.y)*u);const z=[{x:k,y:h.y},{x:k,y:m.y}],H=[{x:h.x,y:_},{x:m.x,y:_}];c[x]===v?w=x==="x"?z:H:w=x==="x"?H:z}else{const z=[{x:h.x,y:m.y}],H=[{x:m.x,y:h.y}];if(x==="x"?w=c.x===v?H:z:w=c.y===v?z:H,n===l){const q=Math.abs(e[x]-r[x]);if(q<=s){const ee=Math.min(s-1,s-q);c[x]===v?S[x]=(h[x]>e[x]?-1:1)*ee:T[x]=(m[x]>r[x]?-1:1)*ee}}if(n!==l){const q=x==="x"?"y":"x",ee=c[x]===d[q],B=h[q]>m[q],$=h[q]=L?(k=(R.x+V.x)/2,_=w[0].y):(k=w[0].x,_=(R.y+V.y)/2)}return[[e,{x:h.x+S.x,y:h.y+S.y},...w,{x:m.x+T.x,y:m.y+T.y},r],k,_,E,A]}function nz(e,n,r,l){const a=Math.min(zv(e,n)/2,zv(n,r)/2,l),{x:s,y:u}=n;if(e.x===s&&s===r.x||e.y===u&&u===r.y)return`L${s} ${u}`;if(e.y===u){const h=e.x{let A="";return E>0&&Er.id===n):e[0])||null}function Zp(e,n){return e?typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(l=>`${l}=${e[l]}`).join("&")}`:""}function iz(e,{id:n,defaultColor:r,defaultMarkerStart:l,defaultMarkerEnd:a}){const s=new Set;return e.reduce((u,c)=>([c.markerStart||l,c.markerEnd||a].forEach(d=>{if(d&&typeof d=="object"){const h=Zp(d,n);s.has(h)||(u.push({id:h,color:d.color||r,...d}),s.add(h))}}),u),[]).sort((u,c)=>u.id.localeCompare(c.id))}const SS=1e3,lz=10,Am={nodeOrigin:[0,0],nodeExtent:qo,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},az={...Am,checkEquality:!0};function zm(e,n){const r={...e};for(const l in n)n[l]!==void 0&&(r[l]=n[l]);return r}function oz(e,n,r){const l=zm(Am,r);for(const a of e.values())if(a.parentId)jm(a,e,n,l);else{const s=Jo(a,l.nodeOrigin),u=da(a.extent)?a.extent:l.nodeExtent,c=Wi(s,u,Rr(a));a.internals.positionAbsolute=c}}function sz(e,n){if(!e.handles)return e.measured?n==null?void 0:n.internals.handleBounds:void 0;const r=[],l=[];for(const a of e.handles){const s={id:a.id,width:a.width??1,height:a.height??1,nodeId:e.id,x:a.x,y:a.y,position:a.position,type:a.type};a.type==="source"?r.push(s):a.type==="target"&&l.push(s)}return{source:r,target:l}}function Mm(e){return e==="manual"}function Kp(e,n,r,l={}){var h,m;const a=zm(az,l),s={i:0},u=new Map(n),c=a!=null&&a.elevateNodesOnSelect&&!Mm(a.zIndexMode)?SS:0;let d=e.length>0;n.clear(),r.clear();for(const p of e){let x=u.get(p.id);if(a.checkEquality&&p===(x==null?void 0:x.internals.userNode))n.set(p.id,x);else{const v=Jo(p,a.nodeOrigin),w=da(p.extent)?p.extent:a.nodeExtent,k=Wi(v,w,Rr(p));x={...a.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:sz(p,x),z:_S(p,c,a.zIndexMode),userNode:p}},n.set(p.id,x)}(x.measured===void 0||x.measured.width===void 0||x.measured.height===void 0)&&!x.hidden&&(d=!1),p.parentId&&jm(x,n,r,l,s)}return d}function uz(e,n){if(!e.parentId)return;const r=n.get(e.parentId);r?r.set(e.id,e):n.set(e.parentId,new Map([[e.id,e]]))}function jm(e,n,r,l,a){const{elevateNodesOnSelect:s,nodeOrigin:u,nodeExtent:c,zIndexMode:d}=zm(Am,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}uz(e,r),a&&!m.parentId&&m.internals.rootParentIndex===void 0&&d==="auto"&&(m.internals.rootParentIndex=++a.i,m.internals.z=m.internals.z+a.i*lz),a&&m.internals.rootParentIndex!==void 0&&(a.i=m.internals.rootParentIndex);const p=s&&!Mm(d)?SS:0,{x,y:v,z:w}=cz(e,m,u,c,p,d),{positionAbsolute:k}=e.internals,_=x!==k.x||v!==k.y;(_||w!==e.internals.z)&&n.set(e.id,{...e,internals:{...e.internals,positionAbsolute:_?{x,y:v}:k,z:w}})}function _S(e,n,r){const l=Vn(e.zIndex)?e.zIndex:0;return Mm(r)?l:l+(e.selected?n:0)}function cz(e,n,r,l,a,s){const{x:u,y:c}=n.internals.positionAbsolute,d=Rr(e),h=Jo(e,r),m=da(e.extent)?Wi(h,e.extent,d):h;let p=Wi({x:u+m.x,y:c+m.y},l,d);e.extent==="parent"&&(p=fS(p,d,n));const x=_S(e,a,s),v=n.internals.z??0;return{x:p.x,y:p.y,z:v>=x?v+1:x}}function Dm(e,n,r,l=[0,0]){var u;const a=[],s=new Map;for(const c of e){const d=n.get(c.parentId);if(!d)continue;const h=((u=s.get(c.parentId))==null?void 0:u.expandedRect)??fa(d),m=hS(h,c.rect);s.set(c.parentId,{expandedRect:m,parent:d})}return s.size>0&&s.forEach(({expandedRect:c,parent:d},h)=>{var E;const m=d.internals.positionAbsolute,p=Rr(d),x=d.origin??l,v=c.x0||w>0||S||T)&&(a.push({id:h,type:"position",position:{x:d.position.x-v+S,y:d.position.y-w+T}}),(E=r.get(h))==null||E.forEach(A=>{e.some(U=>U.id===A.id)||a.push({id:A.id,type:"position",position:{x:A.position.x+v,y:A.position.y+w}})})),(p.width0){const v=Dm(x,n,r,a);h.push(...v)}return{changes:h,updatedInternals:d}}async function dz({delta:e,panZoom:n,transform:r,translateExtent:l,width:a,height:s}){if(!n||!e.x&&!e.y)return Promise.resolve(!1);const u=await n.setViewportConstrained({x:r[0]+e.x,y:r[1]+e.y,zoom:r[2]},[[0,0],[a,s]],l),c=!!u&&(u.x!==r[0]||u.y!==r[1]||u.k!==r[2]);return Promise.resolve(c)}function Rv(e,n,r,l,a,s){let u=a;const c=l.get(u)||new Map;l.set(u,c.set(r,n)),u=`${a}-${e}`;const d=l.get(u)||new Map;if(l.set(u,d.set(r,n)),s){u=`${a}-${e}-${s}`;const h=l.get(u)||new Map;l.set(u,h.set(r,n))}}function ES(e,n,r){e.clear(),n.clear();for(const l of r){const{source:a,target:s,sourceHandle:u=null,targetHandle:c=null}=l,d={edgeId:l.id,source:a,target:s,sourceHandle:u,targetHandle:c},h=`${a}-${u}--${s}-${c}`,m=`${s}-${c}--${a}-${u}`;Rv("source",d,m,e,a,u),Rv("target",d,h,e,s,c),n.set(l.id,l)}}function kS(e,n){if(!e.parentId)return!1;const r=n.get(e.parentId);return r?r.selected?!0:kS(r,n):!1}function Ov(e,n,r){var a;let l=e;do{if((a=l==null?void 0:l.matches)!=null&&a.call(l,n))return!0;if(l===r)return!1;l=l==null?void 0:l.parentElement}while(l);return!1}function hz(e,n,r,l){const a=new Map;for(const[s,u]of e)if((u.selected||u.id===l)&&(!u.parentId||!kS(u,e))&&(u.draggable||n&&typeof u.draggable>"u")){const c=e.get(s);c&&a.set(s,{id:s,position:c.position||{x:0,y:0},distance:{x:r.x-c.internals.positionAbsolute.x,y:r.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return a}function gh({nodeId:e,dragItems:n,nodeLookup:r,dragging:l=!0}){var u,c,d;const a=[];for(const[h,m]of n){const p=(u=r.get(h))==null?void 0:u.internals.userNode;p&&a.push({...p,position:m.position,dragging:l})}if(!e)return[a[0],a];const s=(c=r.get(e))==null?void 0:c.internals.userNode;return[s?{...s,position:((d=n.get(e))==null?void 0:d.position)||s.position,dragging:l}:a[0],a]}function pz({dragItems:e,snapGrid:n,x:r,y:l}){const a=e.values().next().value;if(!a)return null;const s={x:r-a.distance.x,y:l-a.distance.y},u=es(s,n);return{x:u.x-s.x,y:u.y-s.y}}function mz({onNodeMouseDown:e,getStoreItems:n,onDragStart:r,onDrag:l,onDragStop:a}){let s={x:null,y:null},u=0,c=new Map,d=!1,h={x:0,y:0},m=null,p=!1,x=null,v=!1,w=!1,k=null;function _({noDragClassName:T,handleSelector:E,domNode:A,isSelectable:U,nodeId:z,nodeClickDistance:H=0}){x=wn(A);function R({x:q,y:ee}){const{nodeLookup:B,nodeExtent:$,snapGrid:M,snapToGrid:Y,nodeOrigin:Q,onNodeDrag:K,onSelectionDrag:j,onError:I,updateNodePositions:F}=n();s={x:q,y:ee};let N=!1;const G=c.size>1,X=G&&$?Xp(Wo(c)):null,J=G&&Y?pz({dragItems:c,snapGrid:M,x:q,y:ee}):null;for(const[ne,re]of c){if(!B.has(ne))continue;let se={x:q-re.distance.x,y:ee-re.distance.y};Y&&(se=J?{x:Math.round(se.x+J.x),y:Math.round(se.y+J.y)}:es(se,M));let xe=null;if(G&&$&&!re.extent&&X){const{positionAbsolute:pe}=re.internals,_e=pe.x-X.x+$[0][0],Me=pe.x+re.measured.width-X.x2+$[1][0],Te=pe.y-X.y+$[0][1],ct=pe.y+re.measured.height-X.y2+$[1][1];xe=[[_e,Te],[Me,ct]]}const{position:ve,positionAbsolute:ye}=cS({nodeId:ne,nextPosition:se,nodeLookup:B,nodeExtent:xe||$,nodeOrigin:Q,onError:I});N=N||re.position.x!==ve.x||re.position.y!==ve.y,re.position=ve,re.internals.positionAbsolute=ye}if(w=w||N,!!N&&(F(c,!0),k&&(l||K||!z&&j))){const[ne,re]=gh({nodeId:z,dragItems:c,nodeLookup:B});l==null||l(k,c,ne,re),K==null||K(k,ne,re),z||j==null||j(k,re)}}async function V(){if(!m)return;const{transform:q,panBy:ee,autoPanSpeed:B,autoPanOnNodeDrag:$}=n();if(!$){d=!1,cancelAnimationFrame(u);return}const[M,Y]=dS(h,m,B);(M!==0||Y!==0)&&(s.x=(s.x??0)-M/q[2],s.y=(s.y??0)-Y/q[2],await ee({x:M,y:Y})&&R(s)),u=requestAnimationFrame(V)}function O(q){var G;const{nodeLookup:ee,multiSelectionActive:B,nodesDraggable:$,transform:M,snapGrid:Y,snapToGrid:Q,selectNodesOnDrag:K,onNodeDragStart:j,onSelectionDragStart:I,unselectNodesAndEdges:F}=n();p=!0,(!K||!U)&&!B&&z&&((G=ee.get(z))!=null&&G.selected||F()),U&&K&&z&&(e==null||e(z));const N=Ao(q.sourceEvent,{transform:M,snapGrid:Y,snapToGrid:Q,containerBounds:m});if(s=N,c=hz(ee,$,N,z),c.size>0&&(r||j||!z&&I)){const[X,J]=gh({nodeId:z,dragItems:c,nodeLookup:ee});r==null||r(q.sourceEvent,c,X,J),j==null||j(q.sourceEvent,X,J),z||I==null||I(q.sourceEvent,J)}}const L=Pw().clickDistance(H).on("start",q=>{const{domNode:ee,nodeDragThreshold:B,transform:$,snapGrid:M,snapToGrid:Y}=n();m=(ee==null?void 0:ee.getBoundingClientRect())||null,v=!1,w=!1,k=q.sourceEvent,B===0&&O(q),s=Ao(q.sourceEvent,{transform:$,snapGrid:M,snapToGrid:Y,containerBounds:m}),h=Pn(q.sourceEvent,m)}).on("drag",q=>{const{autoPanOnNodeDrag:ee,transform:B,snapGrid:$,snapToGrid:M,nodeDragThreshold:Y,nodeLookup:Q}=n(),K=Ao(q.sourceEvent,{transform:B,snapGrid:$,snapToGrid:M,containerBounds:m});if(k=q.sourceEvent,(q.sourceEvent.type==="touchmove"&&q.sourceEvent.touches.length>1||z&&!Q.has(z))&&(v=!0),!v){if(!d&&ee&&p&&(d=!0,V()),!p){const j=Pn(q.sourceEvent,m),I=j.x-h.x,F=j.y-h.y;Math.sqrt(I*I+F*F)>Y&&O(q)}(s.x!==K.xSnapped||s.y!==K.ySnapped)&&c&&p&&(h=Pn(q.sourceEvent,m),R(K))}}).on("end",q=>{if(!(!p||v)&&(d=!1,p=!1,cancelAnimationFrame(u),c.size>0)){const{nodeLookup:ee,updateNodePositions:B,onNodeDragStop:$,onSelectionDragStop:M}=n();if(w&&(B(c,!1),w=!1),a||$||!z&&M){const[Y,Q]=gh({nodeId:z,dragItems:c,nodeLookup:ee,dragging:!1});a==null||a(q.sourceEvent,c,Y,Q),$==null||$(q.sourceEvent,Y,Q),z||M==null||M(q.sourceEvent,Q)}}}).filter(q=>{const ee=q.target;return!q.button&&(!T||!Ov(ee,`.${T}`,A))&&(!E||Ov(ee,E,A))});x.call(L)}function S(){x==null||x.on(".drag",null)}return{update:_,destroy:S}}function gz(e,n,r){const l=[],a={x:e.x-r,y:e.y-r,width:r*2,height:r*2};for(const s of n.values())Vo(a,fa(s))>0&&l.push(s);return l}const xz=250;function yz(e,n,r,l){var c,d;let a=[],s=1/0;const u=gz(e,r,n+xz);for(const h of u){const m=[...((c=h.internals.handleBounds)==null?void 0:c.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:v}=el(h,p,p.position,!0),w=Math.sqrt(Math.pow(x-e.x,2)+Math.pow(v-e.y,2));w>n||(w1){const h=l.type==="source"?"target":"source";return a.find(m=>m.type===h)??a[0]}return a[0]}function NS(e,n,r,l,a,s=!1){var h,m,p;const u=l.get(e);if(!u)return null;const c=a==="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=(r?c==null?void 0:c.find(x=>x.id===r):c==null?void 0:c[0])??null;return d&&s?{...d,...el(u,d,d.position,!0)}:d}function CS(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function vz(e,n){let r=null;return n?r=!0:e&&!n&&(r=!1),r}const TS=()=>!0;function bz(e,{connectionMode:n,connectionRadius:r,handleId:l,nodeId:a,edgeUpdaterType:s,isTarget:u,domNode:c,nodeLookup:d,lib:h,autoPanOnConnect:m,flowId:p,panBy:x,cancelConnection:v,onConnectStart:w,onConnect:k,onConnectEnd:_,isValidConnection:S=TS,onReconnectEnd:T,updateConnection:E,getTransform:A,getFromHandle:U,autoPanSpeed:z,dragThreshold:H=1,handleDomNode:R}){const V=gS(e.target);let O=0,L;const{x:q,y:ee}=Pn(e),B=CS(s,R),$=c==null?void 0:c.getBoundingClientRect();let M=!1;if(!$||!B)return;const Y=NS(a,B,l,d,n);if(!Y)return;let Q=Pn(e,$),K=!1,j=null,I=!1,F=null;function N(){if(!m||!$)return;const[ve,ye]=dS(Q,$,z);x({x:ve,y:ye}),O=requestAnimationFrame(N)}const G={...Y,nodeId:a,type:B,position:Y.position},X=d.get(a);let ne={inProgress:!0,isValid:null,from:el(X,G,be.Left,!0),fromHandle:G,fromPosition:G.position,fromNode:X,to:Q,toHandle:null,toPosition:_v[G.position],toNode:null,pointer:Q};function re(){M=!0,E(ne),w==null||w(e,{nodeId:a,handleId:l,handleType:B})}H===0&&re();function se(ve){if(!M){const{x:ct,y:nt}=Pn(ve),Mt=ct-q,Vt=nt-ee;if(!(Mt*Mt+Vt*Vt>H*H))return;re()}if(!U()||!G){xe(ve);return}const ye=A();Q=Pn(ve,$),L=yz(ts(Q,ye,!1,[1,1]),r,d,G),K||(N(),K=!0);const pe=AS(ve,{handle:L,connectionMode:n,fromNodeId:a,fromHandleId:l,fromType:u?"target":"source",isValidConnection:S,doc:V,lib:h,flowId:p,nodeLookup:d});F=pe.handleDomNode,j=pe.connection,I=vz(!!L,pe.isValid);const _e=d.get(a),Me=_e?el(_e,G,be.Left,!0):ne.from,Te={...ne,from:Me,isValid:I,to:pe.toHandle&&I?pc({x:pe.toHandle.x,y:pe.toHandle.y},ye):Q,toHandle:pe.toHandle,toPosition:I&&pe.toHandle?pe.toHandle.position:_v[G.position],toNode:pe.toHandle?d.get(pe.toHandle.nodeId):null,pointer:Q};E(Te),ne=Te}function xe(ve){if(!("touches"in ve&&ve.touches.length>0)){if(M){(L||F)&&j&&I&&(k==null||k(j));const{inProgress:ye,...pe}=ne,_e={...pe,toPosition:ne.toHandle?ne.toPosition:null};_==null||_(ve,_e),s&&(T==null||T(ve,_e))}v(),cancelAnimationFrame(O),K=!1,I=!1,j=null,F=null,V.removeEventListener("mousemove",se),V.removeEventListener("mouseup",xe),V.removeEventListener("touchmove",se),V.removeEventListener("touchend",xe)}}V.addEventListener("mousemove",se),V.addEventListener("mouseup",xe),V.addEventListener("touchmove",se),V.addEventListener("touchend",xe)}function AS(e,{handle:n,connectionMode:r,fromNodeId:l,fromHandleId:a,fromType:s,doc:u,lib:c,flowId:d,isValidConnection:h=TS,nodeLookup:m}){const p=s==="target",x=n?u.querySelector(`.${c}-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}=Pn(e),k=u.elementFromPoint(v,w),_=k!=null&&k.classList.contains(`${c}-flow__handle`)?k:x,S={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const T=CS(void 0,_),E=_.getAttribute("data-nodeid"),A=_.getAttribute("data-handleid"),U=_.classList.contains("connectable"),z=_.classList.contains("connectableend");if(!E||!T)return S;const H={source:p?E:l,sourceHandle:p?A:a,target:p?l:E,targetHandle:p?a:A};S.connection=H;const V=U&&z&&(r===ua.Strict?p&&T==="source"||!p&&T==="target":E!==l||A!==a);S.isValid=V&&h(H),S.toHandle=NS(E,T,A,m,r,!0)}return S}const Jp={onPointerDown:bz,isValid:AS};function wz({domNode:e,panZoom:n,getTransform:r,getViewScale:l}){const a=wn(e);function s({translateExtent:c,width:d,height:h,zoomStep:m=1,pannable:p=!0,zoomable:x=!0,inversePan:v=!1}){const w=E=>{if(E.sourceEvent.type!=="wheel"||!n)return;const A=r(),U=E.sourceEvent.ctrlKey&&Po()?10:1,z=-E.sourceEvent.deltaY*(E.sourceEvent.deltaMode===1?.05:E.sourceEvent.deltaMode?1:.002)*m,H=A[2]*Math.pow(2,z*U);n.scaleTo(H)};let k=[0,0];const _=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])},S=E=>{const A=r();if(E.sourceEvent.type!=="mousemove"&&E.sourceEvent.type!=="touchmove"||!n)return;const U=[E.sourceEvent.clientX??E.sourceEvent.touches[0].clientX,E.sourceEvent.clientY??E.sourceEvent.touches[0].clientY],z=[U[0]-k[0],U[1]-k[1]];k=U;const H=l()*Math.max(A[2],Math.log(A[2]))*(v?-1:1),R={x:A[0]-z[0]*H,y:A[1]-z[1]*H},V=[[0,0],[d,h]];n.setViewportConstrained({x:R.x,y:R.y,zoom:A[2]},V,c)},T=iS().on("start",_).on("zoom",p?S:null).on("zoom.wheel",x?w:null);a.call(T,{})}function u(){a.on("zoom",null)}return{update:s,destroy:u,pointer:qn}}const jc=e=>({x:e.x,y:e.y,zoom:e.k}),xh=({x:e,y:n,zoom:r})=>Ac.translate(e,n).scale(r),ea=(e,n)=>e.target.closest(`.${n}`),zS=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),Sz=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,yh=(e,n=0,r=Sz,l=()=>{})=>{const a=typeof n=="number"&&n>0;return a||l(),a?e.transition().duration(n).ease(r).on("end",l):e},MS=e=>{const n=e.ctrlKey&&Po()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n};function _z({zoomPanValues:e,noWheelClassName:n,d3Selection:r,d3Zoom:l,panOnScrollMode:a,panOnScrollSpeed:s,zoomOnPinch:u,onPanZoomStart:c,onPanZoom:d,onPanZoomEnd:h}){return m=>{if(ea(m,n))return m.ctrlKey&&m.preventDefault(),!1;m.preventDefault(),m.stopImmediatePropagation();const p=r.property("__zoom").k||1;if(m.ctrlKey&&u){const _=qn(m),S=MS(m),T=p*Math.pow(2,S);l.scaleTo(r,T,_,m);return}const x=m.deltaMode===1?20:1;let v=a===Qi.Vertical?0:m.deltaX*x,w=a===Qi.Horizontal?0:m.deltaY*x;!Po()&&m.shiftKey&&a!==Qi.Vertical&&(v=m.deltaY*x,w=0),l.translateBy(r,-(v/p)*s,-(w/p)*s,{internal:!0});const k=jc(r.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,c==null||c(m,k))}}function Ez({noWheelClassName:e,preventScrolling:n,d3ZoomHandler:r}){return function(l,a){const s=l.type==="wheel",u=!n&&s&&!l.ctrlKey,c=ea(l,e);if(l.ctrlKey&&s&&c&&l.preventDefault(),u||c)return null;l.preventDefault(),r.call(this,l,a)}}function kz({zoomPanValues:e,onDraggingChange:n,onPanZoomStart:r}){return l=>{var s,u,c;if((s=l.sourceEvent)!=null&&s.internal)return;const a=jc(l.transform);e.mouseButton=((u=l.sourceEvent)==null?void 0:u.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=a,((c=l.sourceEvent)==null?void 0:c.type)==="mousedown"&&n(!0),r&&(r==null||r(l.sourceEvent,a))}}function Nz({zoomPanValues:e,panOnDrag:n,onPaneContextMenu:r,onTransformChange:l,onPanZoom:a}){return s=>{var u,c;e.usedRightMouseButton=!!(r&&zS(n,e.mouseButton??0)),(u=s.sourceEvent)!=null&&u.sync||l([s.transform.x,s.transform.y,s.transform.k]),a&&!((c=s.sourceEvent)!=null&&c.internal)&&(a==null||a(s.sourceEvent,jc(s.transform)))}}function Cz({zoomPanValues:e,panOnDrag:n,panOnScroll:r,onDraggingChange:l,onPanZoomEnd:a,onPaneContextMenu:s}){return u=>{var c;if(!((c=u.sourceEvent)!=null&&c.internal)&&(e.isZoomingOrPanning=!1,s&&zS(n,e.mouseButton??0)&&!e.usedRightMouseButton&&u.sourceEvent&&s(u.sourceEvent),e.usedRightMouseButton=!1,l(!1),a)){const d=jc(u.transform);e.prevViewport=d,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{a==null||a(u.sourceEvent,d)},r?150:0)}}}function Tz({zoomActivationKeyPressed:e,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:l,panOnScroll:a,zoomOnDoubleClick:s,userSelectionActive:u,noWheelClassName:c,noPanClassName:d,lib:h,connectionInProgress:m}){return p=>{var _;const x=e||n,v=r&&p.ctrlKey,w=p.type==="wheel";if(p.button===1&&p.type==="mousedown"&&(ea(p,`${h}-flow__node`)||ea(p,`${h}-flow__edge`)))return!0;if(!l&&!x&&!a&&!s&&!r||u||m&&!w||ea(p,c)&&w||ea(p,d)&&(!w||a&&w&&!e)||!r&&p.ctrlKey&&w)return!1;if(!r&&p.type==="touchstart"&&((_=p.touches)==null?void 0:_.length)>1)return p.preventDefault(),!1;if(!x&&!a&&!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 Az({domNode:e,minZoom:n,maxZoom:r,translateExtent:l,viewport:a,onPanZoom:s,onPanZoomStart:u,onPanZoomEnd:c,onDraggingChange:d}){const h={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},m=e.getBoundingClientRect(),p=iS().scaleExtent([n,r]).translateExtent(l),x=wn(e).call(p);T({x:a.x,y:a.y,zoom:ca(a.zoom,n,r)},[[0,0],[m.width,m.height]],l);const v=x.on("wheel.zoom"),w=x.on("dblclick.zoom");p.wheelDelta(MS);function k(L,q){return x?new Promise(ee=>{p==null||p.interpolate((q==null?void 0:q.interpolate)==="linear"?To:Ku).transform(yh(x,q==null?void 0:q.duration,q==null?void 0:q.ease,()=>ee(!0)),L)}):Promise.resolve(!1)}function _({noWheelClassName:L,noPanClassName:q,onPaneContextMenu:ee,userSelectionActive:B,panOnScroll:$,panOnDrag:M,panOnScrollMode:Y,panOnScrollSpeed:Q,preventScrolling:K,zoomOnPinch:j,zoomOnScroll:I,zoomOnDoubleClick:F,zoomActivationKeyPressed:N,lib:G,onTransformChange:X,connectionInProgress:J,paneClickDistance:ne,selectionOnDrag:re}){B&&!h.isZoomingOrPanning&&S();const se=$&&!N&&!B;p.clickDistance(re?1/0:!Vn(ne)||ne<0?0:ne);const xe=se?_z({zoomPanValues:h,noWheelClassName:L,d3Selection:x,d3Zoom:p,panOnScrollMode:Y,panOnScrollSpeed:Q,zoomOnPinch:j,onPanZoomStart:u,onPanZoom:s,onPanZoomEnd:c}):Ez({noWheelClassName:L,preventScrolling:K,d3ZoomHandler:v});if(x.on("wheel.zoom",xe,{passive:!1}),!B){const ye=kz({zoomPanValues:h,onDraggingChange:d,onPanZoomStart:u});p.on("start",ye);const pe=Nz({zoomPanValues:h,panOnDrag:M,onPaneContextMenu:!!ee,onPanZoom:s,onTransformChange:X});p.on("zoom",pe);const _e=Cz({zoomPanValues:h,panOnDrag:M,panOnScroll:$,onPaneContextMenu:ee,onPanZoomEnd:c,onDraggingChange:d});p.on("end",_e)}const ve=Tz({zoomActivationKeyPressed:N,panOnDrag:M,zoomOnScroll:I,panOnScroll:$,zoomOnDoubleClick:F,zoomOnPinch:j,userSelectionActive:B,noPanClassName:q,noWheelClassName:L,lib:G,connectionInProgress:J});p.filter(ve),F?x.on("dblclick.zoom",w):x.on("dblclick.zoom",null)}function S(){p.on("zoom",null)}async function T(L,q,ee){const B=xh(L),$=p==null?void 0:p.constrain()(B,q,ee);return $&&await k($),new Promise(M=>M($))}async function E(L,q){const ee=xh(L);return await k(ee,q),new Promise(B=>B(ee))}function A(L){if(x){const q=xh(L),ee=x.property("__zoom");(ee.k!==L.zoom||ee.x!==L.x||ee.y!==L.y)&&(p==null||p.transform(x,q,null,{sync:!0}))}}function U(){const L=x?rS(x.node()):{x:0,y:0,k:1};return{x:L.x,y:L.y,zoom:L.k}}function z(L,q){return x?new Promise(ee=>{p==null||p.interpolate((q==null?void 0:q.interpolate)==="linear"?To:Ku).scaleTo(yh(x,q==null?void 0:q.duration,q==null?void 0:q.ease,()=>ee(!0)),L)}):Promise.resolve(!1)}function H(L,q){return x?new Promise(ee=>{p==null||p.interpolate((q==null?void 0:q.interpolate)==="linear"?To:Ku).scaleBy(yh(x,q==null?void 0:q.duration,q==null?void 0:q.ease,()=>ee(!0)),L)}):Promise.resolve(!1)}function R(L){p==null||p.scaleExtent(L)}function V(L){p==null||p.translateExtent(L)}function O(L){const q=!Vn(L)||L<0?0:L;p==null||p.clickDistance(q)}return{update:_,destroy:S,setViewport:E,setViewportConstrained:T,getViewport:U,scaleTo:z,scaleBy:H,setScaleExtent:R,setTranslateExtent:V,syncViewport:A,setClickDistance:O}}var ha;(function(e){e.Line="line",e.Handle="handle"})(ha||(ha={}));function zz({width:e,prevWidth:n,height:r,prevHeight:l,affectsX:a,affectsY:s}){const u=e-n,c=r-l,d=[u>0?1:u<0?-1:0,c>0?1:c<0?-1:0];return u&&a&&(d[0]=d[0]*-1),c&&s&&(d[1]=d[1]*-1),d}function Lv(e){const n=e.includes("right")||e.includes("left"),r=e.includes("bottom")||e.includes("top"),l=e.includes("left"),a=e.includes("top");return{isHorizontal:n,isVertical:r,affectsX:l,affectsY:a}}function di(e,n){return Math.max(0,n-e)}function hi(e,n){return Math.max(0,e-n)}function Uu(e,n,r){return Math.max(0,n-e,e-r)}function Hv(e,n){return e?!n:n}function Mz(e,n,r,l,a,s,u,c){let{affectsX:d,affectsY:h}=n;const{isHorizontal:m,isVertical:p}=n,x=m&&p,{xSnapped:v,ySnapped:w}=r,{minWidth:k,maxWidth:_,minHeight:S,maxHeight:T}=l,{x:E,y:A,width:U,height:z,aspectRatio:H}=e;let R=Math.floor(m?v-e.pointerX:0),V=Math.floor(p?w-e.pointerY:0);const O=U+(d?-R:R),L=z+(h?-V:V),q=-s[0]*U,ee=-s[1]*z;let B=Uu(O,k,_),$=Uu(L,S,T);if(u){let Q=0,K=0;d&&R<0?Q=di(E+R+q,u[0][0]):!d&&R>0&&(Q=hi(E+O+q,u[1][0])),h&&V<0?K=di(A+V+ee,u[0][1]):!h&&V>0&&(K=hi(A+L+ee,u[1][1])),B=Math.max(B,Q),$=Math.max($,K)}if(c){let Q=0,K=0;d&&R>0?Q=hi(E+R,c[0][0]):!d&&R<0&&(Q=di(E+O,c[1][0])),h&&V>0?K=hi(A+V,c[0][1]):!h&&V<0&&(K=di(A+L,c[1][1])),B=Math.max(B,Q),$=Math.max($,K)}if(a){if(m){const Q=Uu(O/H,S,T)*H;if(B=Math.max(B,Q),u){let K=0;!d&&!h||d&&!h&&x?K=hi(A+ee+O/H,u[1][1])*H:K=di(A+ee+(d?R:-R)/H,u[0][1])*H,B=Math.max(B,K)}if(c){let K=0;!d&&!h||d&&!h&&x?K=di(A+O/H,c[1][1])*H:K=hi(A+(d?R:-R)/H,c[0][1])*H,B=Math.max(B,K)}}if(p){const Q=Uu(L*H,k,_)/H;if($=Math.max($,Q),u){let K=0;!d&&!h||h&&!d&&x?K=hi(E+L*H+q,u[1][0])/H:K=di(E+(h?V:-V)*H+q,u[0][0])/H,$=Math.max($,K)}if(c){let K=0;!d&&!h||h&&!d&&x?K=di(E+L*H,c[1][0])/H:K=hi(E+(h?V:-V)*H,c[0][0])/H,$=Math.max($,K)}}}V=V+(V<0?$:-$),R=R+(R<0?B:-B),a&&(x?O>L*H?V=(Hv(d,h)?-R:R)/H:R=(Hv(d,h)?-V:V)*H:m?(V=R/H,h=d):(R=V*H,d=h));const M=d?E+R:E,Y=h?A+V:A;return{width:U+(d?-R:R),height:z+(h?-V:V),x:s[0]*R*(d?-1:1)+M,y:s[1]*V*(h?-1:1)+Y}}const jS={width:0,height:0,x:0,y:0},jz={...jS,pointerX:0,pointerY:0,aspectRatio:1};function Dz(e){return[[0,0],[e.measured.width,e.measured.height]]}function Rz(e,n,r){const l=n.position.x+e.position.x,a=n.position.y+e.position.y,s=e.measured.width??0,u=e.measured.height??0,c=r[0]*s,d=r[1]*u;return[[l-c,a-d],[l+s-c,a+u-d]]}function Oz({domNode:e,nodeId:n,getStoreItems:r,onChange:l,onEnd:a}){const s=wn(e);let u={controlDirection:Lv("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:h,boundaries:m,keepAspectRatio:p,resizeDirection:x,onResizeStart:v,onResize:w,onResizeEnd:k,shouldResize:_}){let S={...jS},T={...jz};u={boundaries:m,resizeDirection:x,keepAspectRatio:p,controlDirection:Lv(h)};let E,A=null,U=[],z,H,R,V=!1;const O=Pw().on("start",L=>{const{nodeLookup:q,transform:ee,snapGrid:B,snapToGrid:$,nodeOrigin:M,paneDomNode:Y}=r();if(E=q.get(n),!E)return;A=(Y==null?void 0:Y.getBoundingClientRect())??null;const{xSnapped:Q,ySnapped:K}=Ao(L.sourceEvent,{transform:ee,snapGrid:B,snapToGrid:$,containerBounds:A});S={width:E.measured.width??0,height:E.measured.height??0,x:E.position.x??0,y:E.position.y??0},T={...S,pointerX:Q,pointerY:K,aspectRatio:S.width/S.height},z=void 0,E.parentId&&(E.extent==="parent"||E.expandParent)&&(z=q.get(E.parentId),H=z&&E.extent==="parent"?Dz(z):void 0),U=[],R=void 0;for(const[j,I]of q)if(I.parentId===n&&(U.push({id:j,position:{...I.position},extent:I.extent}),I.extent==="parent"||I.expandParent)){const F=Rz(I,E,I.origin??M);R?R=[[Math.min(F[0][0],R[0][0]),Math.min(F[0][1],R[0][1])],[Math.max(F[1][0],R[1][0]),Math.max(F[1][1],R[1][1])]]:R=F}v==null||v(L,{...S})}).on("drag",L=>{const{transform:q,snapGrid:ee,snapToGrid:B,nodeOrigin:$}=r(),M=Ao(L.sourceEvent,{transform:q,snapGrid:ee,snapToGrid:B,containerBounds:A}),Y=[];if(!E)return;const{x:Q,y:K,width:j,height:I}=S,F={},N=E.origin??$,{width:G,height:X,x:J,y:ne}=Mz(T,u.controlDirection,M,u.boundaries,u.keepAspectRatio,N,H,R),re=G!==j,se=X!==I,xe=J!==Q&&re,ve=ne!==K&&se;if(!xe&&!ve&&!re&&!se)return;if((xe||ve||N[0]===1||N[1]===1)&&(F.x=xe?J:S.x,F.y=ve?ne:S.y,S.x=F.x,S.y=F.y,U.length>0)){const Me=J-Q,Te=ne-K;for(const ct of U)ct.position={x:ct.position.x-Me+N[0]*(G-j),y:ct.position.y-Te+N[1]*(X-I)},Y.push(ct)}if((re||se)&&(F.width=re&&(!u.resizeDirection||u.resizeDirection==="horizontal")?G:S.width,F.height=se&&(!u.resizeDirection||u.resizeDirection==="vertical")?X:S.height,S.width=F.width,S.height=F.height),z&&E.expandParent){const Me=N[0]*(F.width??0);F.x&&F.x{V&&(k==null||k(L,{...S}),a==null||a({...S}),V=!1)});s.call(O)}function d(){s.on(".drag",null)}return{update:c,destroy:d}}var vh={exports:{}},bh={},wh={exports:{}},Sh={};/** - * @license React - * use-sync-external-store-shim.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Bv;function Lz(){if(Bv)return Sh;Bv=1;var e=Xo();function n(p,x){return p===x&&(p!==0||1/p===1/x)||p!==p&&x!==x}var r=typeof Object.is=="function"?Object.is:n,l=e.useState,a=e.useEffect,s=e.useLayoutEffect,u=e.useDebugValue;function c(p,x){var v=x(),w=l({inst:{value:v,getSnapshot:x}}),k=w[0].inst,_=w[1];return s(function(){k.value=v,k.getSnapshot=x,d(k)&&_({inst:k})},[p,v,x]),a(function(){return d(k)&&_({inst:k}),p(function(){d(k)&&_({inst:k})})},[p]),u(v),v}function d(p){var x=p.getSnapshot;p=p.value;try{var v=x();return!r(p,v)}catch{return!0}}function h(p,x){return x()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return Sh.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,Sh}var Iv;function Hz(){return Iv||(Iv=1,wh.exports=Lz()),wh.exports}/** - * @license React - * use-sync-external-store-shim/with-selector.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var qv;function Bz(){if(qv)return bh;qv=1;var e=Xo(),n=Hz();function r(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}var l=typeof Object.is=="function"?Object.is:r,a=n.useSyncExternalStore,s=e.useRef,u=e.useEffect,c=e.useMemo,d=e.useDebugValue;return bh.useSyncExternalStoreWithSelector=function(h,m,p,x,v){var w=s(null);if(w.current===null){var k={hasValue:!1,value:null};w.current=k}else k=w.current;w=c(function(){function S(z){if(!T){if(T=!0,E=z,z=x(z),v!==void 0&&k.hasValue){var H=k.value;if(v(H,z))return A=H}return A=z}if(H=A,l(E,z))return H;var R=x(z);return v!==void 0&&v(H,R)?(E=z,H):(E=z,A=R)}var T=!1,E,A,U=p===void 0?null:p;return[function(){return S(m())},U===null?void 0:function(){return S(U())}]},[m,p,x,v]);var _=a(h,w[0],w[1]);return u(function(){k.hasValue=!0,k.value=_},[_]),d(_),_},bh}var Uv;function Iz(){return Uv||(Uv=1,vh.exports=Bz()),vh.exports}var qz=Iz();const Uz=Fo(qz),Vz={},Vv=e=>{let n;const r=new Set,l=(m,p)=>{const x=typeof m=="function"?m(n):m;if(!Object.is(x,n)){const v=n;n=p??(typeof x!="object"||x===null)?x:Object.assign({},n,x),r.forEach(w=>w(n,v))}},a=()=>n,d={setState:l,getState:a,getInitialState:()=>h,subscribe:m=>(r.add(m),()=>r.delete(m)),destroy:()=>{(Vz?"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."),r.clear()}},h=n=e(l,a,d);return d},Pz=e=>e?Vv(e):Vv,{useDebugValue:$z}=Jl,{useSyncExternalStoreWithSelector:Gz}=Uz,Yz=e=>e;function DS(e,n=Yz,r){const l=Gz(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,r);return $z(l),l}const Pv=(e,n)=>{const r=Pz(e),l=(a,s=n)=>DS(r,a,s);return Object.assign(l,r),l},Fz=(e,n)=>e?Pv(e,n):Pv;function pt(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,a]of e)if(!Object.is(a,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 r=Object.keys(e);if(r.length!==Object.keys(n).length)return!1;for(const l of r)if(!Object.prototype.hasOwnProperty.call(n,l)||!Object.is(e[l],n[l]))return!1;return!0}var Xz=nw();const Dc=P.createContext(null),Qz=Dc.Provider,RS=ir.error001();function $e(e,n){const r=P.useContext(Dc);if(r===null)throw new Error(RS);return DS(r,e,n)}function mt(){const e=P.useContext(Dc);if(e===null)throw new Error(RS);return P.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const $v={display:"none"},Zz={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},OS="react-flow__node-desc",LS="react-flow__edge-desc",Kz="react-flow__aria-live",Jz=e=>e.ariaLiveMessage,Wz=e=>e.ariaLabelConfig;function eM({rfId:e}){const n=$e(Jz);return b.jsx("div",{id:`${Kz}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Zz,children:n})}function tM({rfId:e,disableKeyboardA11y:n}){const r=$e(Wz);return b.jsxs(b.Fragment,{children:[b.jsx("div",{id:`${OS}-${e}`,style:$v,children:n?r["node.a11yDescription.default"]:r["node.a11yDescription.keyboardDisabled"]}),b.jsx("div",{id:`${LS}-${e}`,style:$v,children:r["edge.a11yDescription.default"]}),!n&&b.jsx(eM,{rfId:e})]})}const Rc=P.forwardRef(({position:e="top-left",children:n,className:r,style:l,...a},s)=>{const u=`${e}`.split("-");return b.jsx("div",{className:zt(["react-flow__panel",r,...u]),style:l,ref:s,...a,children:n})});Rc.displayName="Panel";function nM({proOptions:e,position:n="bottom-right"}){return e!=null&&e.hideAttribution?null:b.jsx(Rc,{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 rM=e=>{const n=[],r=[];for(const[,l]of e.nodeLookup)l.selected&&n.push(l.internals.userNode);for(const[,l]of e.edgeLookup)l.selected&&r.push(l);return{selectedNodes:n,selectedEdges:r}},Vu=e=>e.id;function iM(e,n){return pt(e.selectedNodes.map(Vu),n.selectedNodes.map(Vu))&&pt(e.selectedEdges.map(Vu),n.selectedEdges.map(Vu))}function lM({onSelectionChange:e}){const n=mt(),{selectedNodes:r,selectedEdges:l}=$e(rM,iM);return P.useEffect(()=>{const a={nodes:r,edges:l};e==null||e(a),n.getState().onSelectionChangeHandlers.forEach(s=>s(a))},[r,l,e]),null}const aM=e=>!!e.onSelectionChangeHandlers;function oM({onSelectionChange:e}){const n=$e(aM);return e||n?b.jsx(lM,{onSelectionChange:e}):null}const HS=[0,0],sM={x:0,y:0,zoom:1},uM=["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"],Gv=[...uM,"rfId"],cM=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}),Yv={translateExtent:qo,nodeOrigin:HS,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function fM(e){const{setNodes:n,setEdges:r,setMinZoom:l,setMaxZoom:a,setTranslateExtent:s,setNodeExtent:u,reset:c,setDefaultNodesAndEdges:d}=$e(cM,pt),h=mt();P.useEffect(()=>(d(e.defaultNodes,e.defaultEdges),()=>{m.current=Yv,c()}),[]);const m=P.useRef(Yv);return P.useEffect(()=>{for(const p of Gv){const x=e[p],v=m.current[p];x!==v&&(typeof e[p]>"u"||(p==="nodes"?n(x):p==="edges"?r(x):p==="minZoom"?l(x):p==="maxZoom"?a(x):p==="translateExtent"?s(x):p==="nodeExtent"?u(x):p==="ariaLabelConfig"?h.setState({ariaLabelConfig:FA(x)}):p==="fitView"?h.setState({fitViewQueued:x}):p==="fitViewOptions"?h.setState({fitViewOptions:x}):h.setState({[p]:x})))}m.current=e},Gv.map(p=>e[p])),null}function Fv(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function dM(e){var l;const[n,r]=P.useState(e==="system"?null:e);return P.useEffect(()=>{if(e!=="system"){r(e);return}const a=Fv(),s=()=>r(a!=null&&a.matches?"dark":"light");return s(),a==null||a.addEventListener("change",s),()=>{a==null||a.removeEventListener("change",s)}},[e]),n!==null?n:(l=Fv())!=null&&l.matches?"dark":"light"}const Xv=typeof document<"u"?document:null;function $o(e=null,n={target:Xv,actInsideInputWithModifier:!0}){const[r,l]=P.useState(!1),a=P.useRef(!1),s=P.useRef(new Set([])),[u,c]=P.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,x)=>p.concat(...x),[]);return[h,m]}return[[],[]]},[e]);return P.useEffect(()=>{const d=(n==null?void 0:n.target)??Xv,h=(n==null?void 0:n.actInsideInputWithModifier)??!0;if(e!==null){const m=v=>{var _,S;if(a.current=v.ctrlKey||v.metaKey||v.shiftKey||v.altKey,(!a.current||a.current&&!h)&&xS(v))return!1;const k=Zv(v.code,c);if(s.current.add(v[k]),Qv(u,s.current,!1)){const T=((S=(_=v.composedPath)==null?void 0:_.call(v))==null?void 0:S[0])||v.target,E=(T==null?void 0:T.nodeName)==="BUTTON"||(T==null?void 0:T.nodeName)==="A";n.preventDefault!==!1&&(a.current||!E)&&v.preventDefault(),l(!0)}},p=v=>{const w=Zv(v.code,c);Qv(u,s.current,!0)?(l(!1),s.current.clear()):s.current.delete(v[w]),v.key==="Meta"&&s.current.clear(),a.current=!1},x=()=>{s.current.clear(),l(!1)};return d==null||d.addEventListener("keydown",m),d==null||d.addEventListener("keyup",p),window.addEventListener("blur",x),window.addEventListener("contextmenu",x),()=>{d==null||d.removeEventListener("keydown",m),d==null||d.removeEventListener("keyup",p),window.removeEventListener("blur",x),window.removeEventListener("contextmenu",x)}}},[e,l]),r}function Qv(e,n,r){return e.filter(l=>r||l.length===n.size).some(l=>l.every(a=>n.has(a)))}function Zv(e,n){return n.includes(e)?"code":"key"}const hM=()=>{const e=mt();return P.useMemo(()=>({zoomIn:n=>{const{panZoom:r}=e.getState();return r?r.scaleBy(1.2,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},zoomOut:n=>{const{panZoom:r}=e.getState();return r?r.scaleBy(1/1.2,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},zoomTo:(n,r)=>{const{panZoom:l}=e.getState();return l?l.scaleTo(n,{duration:r==null?void 0:r.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(n,r)=>{const{transform:[l,a,s],panZoom:u}=e.getState();return u?(await u.setViewport({x:n.x??l,y:n.y??a,zoom:n.zoom??s},r),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[n,r,l]=e.getState().transform;return{x:n,y:r,zoom:l}},setCenter:async(n,r,l)=>e.getState().setCenter(n,r,l),fitBounds:async(n,r)=>{const{width:l,height:a,minZoom:s,maxZoom:u,panZoom:c}=e.getState(),d=Nm(n,l,a,s,u,(r==null?void 0:r.padding)??.1);return c?(await c.setViewport(d,{duration:r==null?void 0:r.duration,ease:r==null?void 0:r.ease,interpolate:r==null?void 0:r.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(n,r={})=>{const{transform:l,snapGrid:a,snapToGrid:s,domNode:u}=e.getState();if(!u)return n;const{x:c,y:d}=u.getBoundingClientRect(),h={x:n.x-c,y:n.y-d},m=r.snapGrid??a,p=r.snapToGrid??s;return ts(h,l,p,m)},flowToScreenPosition:n=>{const{transform:r,domNode:l}=e.getState();if(!l)return n;const{x:a,y:s}=l.getBoundingClientRect(),u=pc(n,r);return{x:u.x+a,y:u.y+s}}}),[])};function BS(e,n){const r=[],l=new Map,a=[];for(const s of e)if(s.type==="add"){a.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){r.push(s);continue}if(u[0].type==="remove")continue;if(u[0].type==="replace"){r.push({...u[0].item});continue}const c={...s};for(const d of u)pM(d,c);r.push(c)}return a.length&&a.forEach(s=>{s.index!==void 0?r.splice(s.index,0,{...s.item}):r.push({...s.item})}),r}function pM(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 IS(e,n){return BS(e,n)}function qS(e,n){return BS(e,n)}function Pi(e,n){return{id:e,type:"select",selected:n}}function ta(e,n=new Set,r=!1){const l=[];for(const[a,s]of e){const u=n.has(a);!(s.selected===void 0&&!u)&&s.selected!==u&&(r&&(s.selected=u),l.push(Pi(s.id,u)))}return l}function Kv({items:e=[],lookup:n}){var a;const r=[],l=new Map(e.map(s=>[s.id,s]));for(const[s,u]of e.entries()){const c=n.get(u.id),d=((a=c==null?void 0:c.internals)==null?void 0:a.userNode)??c;d!==void 0&&d!==u&&r.push({id:u.id,item:u,type:"replace"}),d===void 0&&r.push({item:u,type:"add",index:s})}for(const[s]of n)l.get(s)===void 0&&r.push({id:s,type:"remove"});return r}function Jv(e){return{id:e.id,type:"remove"}}const Wv=e=>HA(e),mM=e=>uS(e);function US(e){return P.forwardRef(e)}const gM=typeof window<"u"?P.useLayoutEffect:P.useEffect;function e1(e){const[n,r]=P.useState(BigInt(0)),[l]=P.useState(()=>xM(()=>r(a=>a+BigInt(1))));return gM(()=>{const a=l.get();a.length&&(e(a),l.reset())},[n]),l}function xM(e){let n=[];return{get:()=>n,reset:()=>{n=[]},push:r=>{n.push(r),e()}}}const VS=P.createContext(null);function yM({children:e}){const n=mt(),r=P.useCallback(c=>{const{nodes:d=[],setNodes:h,hasDefaultNodes:m,onNodesChange:p,nodeLookup:x,fitViewQueued:v,onNodesChangeMiddlewareMap:w}=n.getState();let k=d;for(const S of c)k=typeof S=="function"?S(k):S;let _=Kv({items:k,lookup:x});for(const S of w.values())_=S(_);m&&h(k),_.length>0?p==null||p(_):v&&window.requestAnimationFrame(()=>{const{fitViewQueued:S,nodes:T,setNodes:E}=n.getState();S&&E(T)})},[]),l=e1(r),a=P.useCallback(c=>{const{edges:d=[],setEdges:h,hasDefaultEdges:m,onEdgesChange:p,edgeLookup:x}=n.getState();let v=d;for(const w of c)v=typeof w=="function"?w(v):w;m?h(v):p&&p(Kv({items:v,lookup:x}))},[]),s=e1(a),u=P.useMemo(()=>({nodeQueue:l,edgeQueue:s}),[]);return b.jsx(VS.Provider,{value:u,children:e})}function vM(){const e=P.useContext(VS);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const bM=e=>!!e.panZoom;function ma(){const e=hM(),n=mt(),r=vM(),l=$e(bM),a=P.useMemo(()=>{const s=p=>n.getState().nodeLookup.get(p),u=p=>{r.nodeQueue.push(p)},c=p=>{r.edgeQueue.push(p)},d=p=>{var S,T;const{nodeLookup:x,nodeOrigin:v}=n.getState(),w=Wv(p)?p:x.get(p.id),k=w.parentId?mS(w.position,w.measured,w.parentId,x,v):w.position,_={...w,position:k,width:((S=w.measured)==null?void 0:S.width)??w.width,height:((T=w.measured)==null?void 0:T.height)??w.height};return fa(_)},h=(p,x,v={replace:!1})=>{u(w=>w.map(k=>{if(k.id===p){const _=typeof x=="function"?x(k):x;return v.replace&&Wv(_)?_:{...k,..._}}return k}))},m=(p,x,v={replace:!1})=>{c(w=>w.map(k=>{if(k.id===p){const _=typeof x=="function"?x(k):x;return v.replace&&mM(_)?_:{...k,..._}}return k}))};return{getNodes:()=>n.getState().nodes.map(p=>({...p})),getNode:p=>{var x;return(x=s(p))==null?void 0:x.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:p=[]}=n.getState();return p.map(x=>({...x}))},getEdge:p=>n.getState().edgeLookup.get(p),setNodes:u,setEdges:c,addNodes:p=>{const x=Array.isArray(p)?p:[p];r.nodeQueue.push(v=>[...v,...x])},addEdges:p=>{const x=Array.isArray(p)?p:[p];r.edgeQueue.push(v=>[...v,...x])},toObject:()=>{const{nodes:p=[],edges:x=[],transform:v}=n.getState(),[w,k,_]=v;return{nodes:p.map(S=>({...S})),edges:x.map(S=>({...S})),viewport:{x:w,y:k,zoom:_}}},deleteElements:async({nodes:p=[],edges:x=[]})=>{const{nodes:v,edges:w,onNodesDelete:k,onEdgesDelete:_,triggerNodeChanges:S,triggerEdgeChanges:T,onDelete:E,onBeforeDelete:A}=n.getState(),{nodes:U,edges:z}=await VA({nodesToRemove:p,edgesToRemove:x,nodes:v,edges:w,onBeforeDelete:A}),H=z.length>0,R=U.length>0;if(H){const V=z.map(Jv);_==null||_(z),T(V)}if(R){const V=U.map(Jv);k==null||k(U),S(V)}return(R||H)&&(E==null||E({nodes:U,edges:z})),{deletedNodes:U,deletedEdges:z}},getIntersectingNodes:(p,x=!0,v)=>{const w=kv(p),k=w?p:d(p),_=v!==void 0;return k?(v||n.getState().nodes).filter(S=>{const T=n.getState().nodeLookup.get(S.id);if(T&&!w&&(S.id===p.id||!T.internals.positionAbsolute))return!1;const E=fa(_?S:T),A=Vo(E,k);return x&&A>0||A>=E.width*E.height||A>=k.width*k.height}):[]},isNodeIntersecting:(p,x,v=!0)=>{const k=kv(p)?p:d(p);if(!k)return!1;const _=Vo(k,x);return v&&_>0||_>=x.width*x.height||_>=k.width*k.height},updateNode:h,updateNodeData:(p,x,v={replace:!1})=>{h(p,w=>{const k=typeof x=="function"?x(w):x;return v.replace?{...w,data:k}:{...w,data:{...w.data,...k}}},v)},updateEdge:m,updateEdgeData:(p,x,v={replace:!1})=>{m(p,w=>{const k=typeof x=="function"?x(w):x;return v.replace?{...w,data:k}:{...w,data:{...w.data,...k}}},v)},getNodesBounds:p=>{const{nodeLookup:x,nodeOrigin:v}=n.getState();return BA(p,{nodeLookup:x,nodeOrigin:v})},getHandleConnections:({type:p,id:x,nodeId:v})=>{var w;return Array.from(((w=n.getState().connectionLookup.get(`${v}-${p}${x?`-${x}`:""}`))==null?void 0:w.values())??[])},getNodeConnections:({type:p,handleId:x,nodeId:v})=>{var w;return Array.from(((w=n.getState().connectionLookup.get(`${v}${p?x?`-${p}-${x}`:`-${p}`:""}`))==null?void 0:w.values())??[])},fitView:async p=>{const x=n.getState().fitViewResolver??YA();return n.setState({fitViewQueued:!0,fitViewOptions:p,fitViewResolver:x}),r.nodeQueue.push(v=>[...v]),x.promise}}},[]);return P.useMemo(()=>({...a,...e,viewportInitialized:l}),[l])}const t1=e=>e.selected,wM=typeof window<"u"?window:void 0;function SM({deleteKeyCode:e,multiSelectionKeyCode:n}){const r=mt(),{deleteElements:l}=ma(),a=$o(e,{actInsideInputWithModifier:!1}),s=$o(n,{target:wM});P.useEffect(()=>{if(a){const{edges:u,nodes:c}=r.getState();l({nodes:c.filter(t1),edges:u.filter(t1)}),r.setState({nodesSelectionActive:!1})}},[a]),P.useEffect(()=>{r.setState({multiSelectionActive:s})},[s])}function _M(e){const n=mt();P.useEffect(()=>{const r=()=>{var a,s,u,c;if(!e.current||!(((s=(a=e.current).checkVisibility)==null?void 0:s.call(a))??!0))return!1;const l=Cm(e.current);(l.height===0||l.width===0)&&((c=(u=n.getState()).onError)==null||c.call(u,"004",ir.error004())),n.setState({width:l.width||500,height:l.height||500})};if(e.current){r(),window.addEventListener("resize",r);const l=new ResizeObserver(()=>r());return l.observe(e.current),()=>{window.removeEventListener("resize",r),l&&e.current&&l.unobserve(e.current)}}},[])}const Oc={position:"absolute",width:"100%",height:"100%",top:0,left:0},EM=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function kM({onPaneContextMenu:e,zoomOnScroll:n=!0,zoomOnPinch:r=!0,panOnScroll:l=!1,panOnScrollSpeed:a=.5,panOnScrollMode:s=Qi.Free,zoomOnDoubleClick:u=!0,panOnDrag:c=!0,defaultViewport:d,translateExtent:h,minZoom:m,maxZoom:p,zoomActivationKeyCode:x,preventScrolling:v=!0,children:w,noWheelClassName:k,noPanClassName:_,onViewportChange:S,isControlledViewport:T,paneClickDistance:E,selectionOnDrag:A}){const U=mt(),z=P.useRef(null),{userSelectionActive:H,lib:R,connectionInProgress:V}=$e(EM,pt),O=$o(x),L=P.useRef();_M(z);const q=P.useCallback(ee=>{S==null||S({x:ee[0],y:ee[1],zoom:ee[2]}),T||U.setState({transform:ee})},[S,T]);return P.useEffect(()=>{if(z.current){L.current=Az({domNode:z.current,minZoom:m,maxZoom:p,translateExtent:h,viewport:d,onDraggingChange:M=>U.setState(Y=>Y.paneDragging===M?Y:{paneDragging:M}),onPanZoomStart:(M,Y)=>{const{onViewportChangeStart:Q,onMoveStart:K}=U.getState();K==null||K(M,Y),Q==null||Q(Y)},onPanZoom:(M,Y)=>{const{onViewportChange:Q,onMove:K}=U.getState();K==null||K(M,Y),Q==null||Q(Y)},onPanZoomEnd:(M,Y)=>{const{onViewportChangeEnd:Q,onMoveEnd:K}=U.getState();K==null||K(M,Y),Q==null||Q(Y)}});const{x:ee,y:B,zoom:$}=L.current.getViewport();return U.setState({panZoom:L.current,transform:[ee,B,$],domNode:z.current.closest(".react-flow")}),()=>{var M;(M=L.current)==null||M.destroy()}}},[]),P.useEffect(()=>{var ee;(ee=L.current)==null||ee.update({onPaneContextMenu:e,zoomOnScroll:n,zoomOnPinch:r,panOnScroll:l,panOnScrollSpeed:a,panOnScrollMode:s,zoomOnDoubleClick:u,panOnDrag:c,zoomActivationKeyPressed:O,preventScrolling:v,noPanClassName:_,userSelectionActive:H,noWheelClassName:k,lib:R,onTransformChange:q,connectionInProgress:V,selectionOnDrag:A,paneClickDistance:E})},[e,n,r,l,a,s,u,c,O,v,_,H,k,R,q,V,A,E]),b.jsx("div",{className:"react-flow__renderer",ref:z,style:Oc,children:w})}const NM=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function CM(){const{userSelectionActive:e,userSelectionRect:n}=$e(NM,pt);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 _h=(e,n)=>r=>{r.target===n.current&&(e==null||e(r))},TM=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function AM({isSelecting:e,selectionKeyPressed:n,selectionMode:r=Uo.Full,panOnDrag:l,paneClickDistance:a,selectionOnDrag:s,onSelectionStart:u,onSelectionEnd:c,onPaneClick:d,onPaneContextMenu:h,onPaneScroll:m,onPaneMouseEnter:p,onPaneMouseMove:x,onPaneMouseLeave:v,children:w}){const k=mt(),{userSelectionActive:_,elementsSelectable:S,dragging:T,connectionInProgress:E}=$e(TM,pt),A=S&&(e||_),U=P.useRef(null),z=P.useRef(),H=P.useRef(new Set),R=P.useRef(new Set),V=P.useRef(!1),O=Q=>{if(V.current||E){V.current=!1;return}d==null||d(Q),k.getState().resetSelectedElements(),k.setState({nodesSelectionActive:!1})},L=Q=>{if(Array.isArray(l)&&(l!=null&&l.includes(2))){Q.preventDefault();return}h==null||h(Q)},q=m?Q=>m(Q):void 0,ee=Q=>{V.current&&(Q.stopPropagation(),V.current=!1)},B=Q=>{var X,J;const{domNode:K}=k.getState();if(z.current=K==null?void 0:K.getBoundingClientRect(),!z.current)return;const j=Q.target===U.current;if(!j&&!!Q.target.closest(".nokey")||!e||!(s&&j||n)||Q.button!==0||!Q.isPrimary)return;(J=(X=Q.target)==null?void 0:X.setPointerCapture)==null||J.call(X,Q.pointerId),V.current=!1;const{x:N,y:G}=Pn(Q.nativeEvent,z.current);k.setState({userSelectionRect:{width:0,height:0,startX:N,startY:G,x:N,y:G}}),j||(Q.stopPropagation(),Q.preventDefault())},$=Q=>{const{userSelectionRect:K,transform:j,nodeLookup:I,edgeLookup:F,connectionLookup:N,triggerNodeChanges:G,triggerEdgeChanges:X,defaultEdgeOptions:J,resetSelectedElements:ne}=k.getState();if(!z.current||!K)return;const{x:re,y:se}=Pn(Q.nativeEvent,z.current),{startX:xe,startY:ve}=K;if(!V.current){const Te=n?0:a;if(Math.hypot(re-xe,se-ve)<=Te)return;ne(),u==null||u(Q)}V.current=!0;const ye={startX:xe,startY:ve,x:reTe.id)),R.current=new Set;const Me=(J==null?void 0:J.selectable)??!0;for(const Te of H.current){const ct=N.get(Te);if(ct)for(const{edgeId:nt}of ct.values()){const Mt=F.get(nt);Mt&&(Mt.selectable??Me)&&R.current.add(nt)}}if(!Nv(pe,H.current)){const Te=ta(I,H.current,!0);G(Te)}if(!Nv(_e,R.current)){const Te=ta(F,R.current);X(Te)}k.setState({userSelectionRect:ye,userSelectionActive:!0,nodesSelectionActive:!1})},M=Q=>{var K,j;Q.button===0&&((j=(K=Q.target)==null?void 0:K.releasePointerCapture)==null||j.call(K,Q.pointerId),!_&&Q.target===U.current&&k.getState().userSelectionRect&&(O==null||O(Q)),k.setState({userSelectionActive:!1,userSelectionRect:null}),V.current&&(c==null||c(Q),k.setState({nodesSelectionActive:H.current.size>0})))},Y=l===!0||Array.isArray(l)&&l.includes(0);return b.jsxs("div",{className:zt(["react-flow__pane",{draggable:Y,dragging:T,selection:e}]),onClick:A?void 0:_h(O,U),onContextMenu:_h(L,U),onWheel:_h(q,U),onPointerEnter:A?void 0:p,onPointerMove:A?$:x,onPointerUp:A?M:void 0,onPointerDownCapture:A?B:void 0,onClickCapture:A?ee:void 0,onPointerLeave:v,ref:U,style:Oc,children:[w,b.jsx(CM,{})]})}function Wp({id:e,store:n,unselect:r=!1,nodeRef:l}){const{addSelectedNodes:a,unselectNodesAndEdges:s,multiSelectionActive:u,nodeLookup:c,onError:d}=n.getState(),h=c.get(e);if(!h){d==null||d("012",ir.error012(e));return}n.setState({nodesSelectionActive:!1}),h.selected?(r||h.selected&&u)&&(s({nodes:[h],edges:[]}),requestAnimationFrame(()=>{var m;return(m=l==null?void 0:l.current)==null?void 0:m.blur()})):a([e])}function PS({nodeRef:e,disabled:n=!1,noDragClassName:r,handleSelector:l,nodeId:a,isSelectable:s,nodeClickDistance:u}){const c=mt(),[d,h]=P.useState(!1),m=P.useRef();return P.useEffect(()=>{m.current=mz({getStoreItems:()=>c.getState(),onNodeMouseDown:p=>{Wp({id:p,store:c,nodeRef:e})},onDragStart:()=>{h(!0)},onDragStop:()=>{h(!1)}})},[]),P.useEffect(()=>{if(!(n||!e.current||!m.current))return m.current.update({noDragClassName:r,handleSelector:l,domNode:e.current,isSelectable:s,nodeId:a,nodeClickDistance:u}),()=>{var p;(p=m.current)==null||p.destroy()}},[r,l,n,s,e,a,u]),d}const zM=e=>n=>n.selected&&(n.draggable||e&&typeof n.draggable>"u");function $S(){const e=mt();return P.useCallback(r=>{const{nodeExtent:l,snapToGrid:a,snapGrid:s,nodesDraggable:u,onError:c,updateNodePositions:d,nodeLookup:h,nodeOrigin:m}=e.getState(),p=new Map,x=zM(u),v=a?s[0]:5,w=a?s[1]:5,k=r.direction.x*v*r.factor,_=r.direction.y*w*r.factor;for(const[,S]of h){if(!x(S))continue;let T={x:S.internals.positionAbsolute.x+k,y:S.internals.positionAbsolute.y+_};a&&(T=es(T,s));const{position:E,positionAbsolute:A}=cS({nodeId:S.id,nextPosition:T,nodeLookup:h,nodeExtent:l,nodeOrigin:m,onError:c});S.position=E,S.internals.positionAbsolute=A,p.set(S.id,S)}d(p)},[])}const Rm=P.createContext(null),MM=Rm.Provider;Rm.Consumer;const GS=()=>P.useContext(Rm),jM=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),DM=(e,n,r)=>l=>{const{connectionClickStartHandle:a,connectionMode:s,connection:u}=l,{fromHandle:c,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)===r;return{connectingFrom:(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===n&&(c==null?void 0:c.type)===r,connectingTo:m,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===n&&(a==null?void 0:a.type)===r,isPossibleEndHandle:s===ua.Strict?(c==null?void 0:c.type)!==r:e!==(c==null?void 0:c.nodeId)||n!==(c==null?void 0:c.id),connectionInProcess:!!c,clickConnectionInProcess:!!a,valid:m&&h}};function RM({type:e="source",position:n=be.Top,isValidConnection:r,isConnectable:l=!0,isConnectableStart:a=!0,isConnectableEnd:s=!0,id:u,onConnect:c,children:d,className:h,onMouseDown:m,onTouchStart:p,...x},v){var $,M;const w=u||null,k=e==="target",_=mt(),S=GS(),{connectOnClick:T,noPanClassName:E,rfId:A}=$e(jM,pt),{connectingFrom:U,connectingTo:z,clickConnecting:H,isPossibleEndHandle:R,connectionInProcess:V,clickConnectionInProcess:O,valid:L}=$e(DM(S,w,e),pt);S||(M=($=_.getState()).onError)==null||M.call($,"010",ir.error010());const q=Y=>{const{defaultEdgeOptions:Q,onConnect:K,hasDefaultEdges:j}=_.getState(),I={...Q,...Y};if(j){const{edges:F,setEdges:N}=_.getState();N(WA(I,F))}K==null||K(I),c==null||c(I)},ee=Y=>{if(!S)return;const Q=yS(Y.nativeEvent);if(a&&(Q&&Y.button===0||!Q)){const K=_.getState();Jp.onPointerDown(Y.nativeEvent,{handleDomNode:Y.currentTarget,autoPanOnConnect:K.autoPanOnConnect,connectionMode:K.connectionMode,connectionRadius:K.connectionRadius,domNode:K.domNode,nodeLookup:K.nodeLookup,lib:K.lib,isTarget:k,handleId:w,nodeId:S,flowId:K.rfId,panBy:K.panBy,cancelConnection:K.cancelConnection,onConnectStart:K.onConnectStart,onConnectEnd:(...j)=>{var I,F;return(F=(I=_.getState()).onConnectEnd)==null?void 0:F.call(I,...j)},updateConnection:K.updateConnection,onConnect:q,isValidConnection:r||((...j)=>{var I,F;return((F=(I=_.getState()).isValidConnection)==null?void 0:F.call(I,...j))??!0}),getTransform:()=>_.getState().transform,getFromHandle:()=>_.getState().connection.fromHandle,autoPanSpeed:K.autoPanSpeed,dragThreshold:K.connectionDragThreshold})}Q?m==null||m(Y):p==null||p(Y)},B=Y=>{const{onClickConnectStart:Q,onClickConnectEnd:K,connectionClickStartHandle:j,connectionMode:I,isValidConnection:F,lib:N,rfId:G,nodeLookup:X,connection:J}=_.getState();if(!S||!j&&!a)return;if(!j){Q==null||Q(Y.nativeEvent,{nodeId:S,handleId:w,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:S,type:e,id:w}});return}const ne=gS(Y.target),re=r||F,{connection:se,isValid:xe}=Jp.isValid(Y.nativeEvent,{handle:{nodeId:S,id:w,type:e},connectionMode:I,fromNodeId:j.nodeId,fromHandleId:j.id||null,fromType:j.type,isValidConnection:re,flowId:G,doc:ne,lib:N,nodeLookup:X});xe&&se&&q(se);const ve=structuredClone(J);delete ve.inProgress,ve.toPosition=ve.toHandle?ve.toHandle.position:null,K==null||K(Y,ve),_.setState({connectionClickStartHandle:null})};return b.jsx("div",{"data-handleid":w,"data-nodeid":S,"data-handlepos":n,"data-id":`${A}-${S}-${w}-${e}`,className:zt(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",E,h,{source:!k,target:k,connectable:l,connectablestart:a,connectableend:s,clickconnecting:H,connectingfrom:U,connectingto:z,valid:L,connectionindicator:l&&(!V||R)&&(V||O?s:a)}]),onMouseDown:ee,onTouchStart:ee,onClick:T?B:void 0,ref:v,...x,children:d})}const Ft=P.memo(US(RM));function OM({data:e,isConnectable:n,sourcePosition:r=be.Bottom}){return b.jsxs(b.Fragment,{children:[e==null?void 0:e.label,b.jsx(Ft,{type:"source",position:r,isConnectable:n})]})}function LM({data:e,isConnectable:n,targetPosition:r=be.Top,sourcePosition:l=be.Bottom}){return b.jsxs(b.Fragment,{children:[b.jsx(Ft,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label,b.jsx(Ft,{type:"source",position:l,isConnectable:n})]})}function HM(){return null}function BM({data:e,isConnectable:n,targetPosition:r=be.Top}){return b.jsxs(b.Fragment,{children:[b.jsx(Ft,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label]})}const mc={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},n1={input:OM,default:LM,output:BM,group:HM};function IM(e){var n,r,l,a;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((n=e.style)==null?void 0:n.width),height:e.height??e.initialHeight??((r=e.style)==null?void 0:r.height)}:{width:e.width??((l=e.style)==null?void 0:l.width),height:e.height??((a=e.style)==null?void 0:a.height)}}const qM=e=>{const{width:n,height:r,x:l,y:a}=Wo(e.nodeLookup,{filter:s=>!!s.selected});return{width:Vn(n)?n:null,height:Vn(r)?r:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${l}px,${a}px)`}};function UM({onSelectionContextMenu:e,noPanClassName:n,disableKeyboardA11y:r}){const l=mt(),{width:a,height:s,transformString:u,userSelectionActive:c}=$e(qM,pt),d=$S(),h=P.useRef(null);P.useEffect(()=>{var v;r||(v=h.current)==null||v.focus({preventScroll:!0})},[r]);const m=!c&&a!==null&&s!==null;if(PS({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,x=v=>{Object.prototype.hasOwnProperty.call(mc,v.key)&&(v.preventDefault(),d({direction:mc[v.key],factor:v.shiftKey?4:1}))};return b.jsx("div",{className:zt(["react-flow__nodesselection","react-flow__container",n]),style:{transform:u},children:b.jsx("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:p,tabIndex:r?void 0:-1,onKeyDown:r?void 0:x,style:{width:a,height:s}})})}const r1=typeof window<"u"?window:void 0,VM=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function YS({children:e,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:l,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:u,paneClickDistance:c,deleteKeyCode:d,selectionKeyCode:h,selectionOnDrag:m,selectionMode:p,onSelectionStart:x,onSelectionEnd:v,multiSelectionKeyCode:w,panActivationKeyCode:k,zoomActivationKeyCode:_,elementsSelectable:S,zoomOnScroll:T,zoomOnPinch:E,panOnScroll:A,panOnScrollSpeed:U,panOnScrollMode:z,zoomOnDoubleClick:H,panOnDrag:R,defaultViewport:V,translateExtent:O,minZoom:L,maxZoom:q,preventScrolling:ee,onSelectionContextMenu:B,noWheelClassName:$,noPanClassName:M,disableKeyboardA11y:Y,onViewportChange:Q,isControlledViewport:K}){const{nodesSelectionActive:j,userSelectionActive:I}=$e(VM,pt),F=$o(h,{target:r1}),N=$o(k,{target:r1}),G=N||R,X=N||A,J=m&&G!==!0,ne=F||I||J;return SM({deleteKeyCode:d,multiSelectionKeyCode:w}),b.jsx(kM,{onPaneContextMenu:s,elementsSelectable:S,zoomOnScroll:T,zoomOnPinch:E,panOnScroll:X,panOnScrollSpeed:U,panOnScrollMode:z,zoomOnDoubleClick:H,panOnDrag:!F&&G,defaultViewport:V,translateExtent:O,minZoom:L,maxZoom:q,zoomActivationKeyCode:_,preventScrolling:ee,noWheelClassName:$,noPanClassName:M,onViewportChange:Q,isControlledViewport:K,paneClickDistance:c,selectionOnDrag:J,children:b.jsxs(AM,{onSelectionStart:x,onSelectionEnd:v,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:l,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:u,panOnDrag:G,isSelecting:!!ne,selectionMode:p,selectionKeyPressed:F,paneClickDistance:c,selectionOnDrag:J,children:[e,j&&b.jsx(UM,{onSelectionContextMenu:B,noPanClassName:M,disableKeyboardA11y:Y})]})})}YS.displayName="FlowRenderer";const PM=P.memo(YS),$M=e=>n=>e?km(n.nodeLookup,{x:0,y:0,width:n.width,height:n.height},n.transform,!0).map(r=>r.id):Array.from(n.nodeLookup.keys());function GM(e){return $e(P.useCallback($M(e),[e]),pt)}const YM=e=>e.updateNodeInternals;function FM(){const e=$e(YM),[n]=P.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(r=>{const l=new Map;r.forEach(a=>{const s=a.target.getAttribute("data-id");l.set(s,{id:s,nodeElement:a.target,force:!0})}),e(l)}));return P.useEffect(()=>()=>{n==null||n.disconnect()},[n]),n}function XM({node:e,nodeType:n,hasDimensions:r,resizeObserver:l}){const a=mt(),s=P.useRef(null),u=P.useRef(null),c=P.useRef(e.sourcePosition),d=P.useRef(e.targetPosition),h=P.useRef(n),m=r&&!!e.internals.handleBounds;return P.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]),P.useEffect(()=>()=>{u.current&&(l==null||l.unobserve(u.current),u.current=null)},[]),P.useEffect(()=>{if(s.current){const p=h.current!==n,x=c.current!==e.sourcePosition,v=d.current!==e.targetPosition;(p||x||v)&&(h.current=n,c.current=e.sourcePosition,d.current=e.targetPosition,a.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,n,e.sourcePosition,e.targetPosition]),s}function QM({id:e,onClick:n,onMouseEnter:r,onMouseMove:l,onMouseLeave:a,onContextMenu:s,onDoubleClick:u,nodesDraggable:c,elementsSelectable:d,nodesConnectable:h,nodesFocusable:m,resizeObserver:p,noDragClassName:x,noPanClassName:v,disableKeyboardA11y:w,rfId:k,nodeTypes:_,nodeClickDistance:S,onError:T}){const{node:E,internals:A,isParent:U}=$e(re=>{const se=re.nodeLookup.get(e),xe=re.parentLookup.has(e);return{node:se,internals:se.internals,isParent:xe}},pt);let z=E.type||"default",H=(_==null?void 0:_[z])||n1[z];H===void 0&&(T==null||T("003",ir.error003(z)),z="default",H=(_==null?void 0:_.default)||n1.default);const R=!!(E.draggable||c&&typeof E.draggable>"u"),V=!!(E.selectable||d&&typeof E.selectable>"u"),O=!!(E.connectable||h&&typeof E.connectable>"u"),L=!!(E.focusable||m&&typeof E.focusable>"u"),q=mt(),ee=pS(E),B=XM({node:E,nodeType:z,hasDimensions:ee,resizeObserver:p}),$=PS({nodeRef:B,disabled:E.hidden||!R,noDragClassName:x,handleSelector:E.dragHandle,nodeId:e,isSelectable:V,nodeClickDistance:S}),M=$S();if(E.hidden)return null;const Y=Rr(E),Q=IM(E),K=V||R||n||r||l||a,j=r?re=>r(re,{...A.userNode}):void 0,I=l?re=>l(re,{...A.userNode}):void 0,F=a?re=>a(re,{...A.userNode}):void 0,N=s?re=>s(re,{...A.userNode}):void 0,G=u?re=>u(re,{...A.userNode}):void 0,X=re=>{const{selectNodesOnDrag:se,nodeDragThreshold:xe}=q.getState();V&&(!se||!R||xe>0)&&Wp({id:e,store:q,nodeRef:B}),n&&n(re,{...A.userNode})},J=re=>{if(!(xS(re.nativeEvent)||w)){if(lS.includes(re.key)&&V){const se=re.key==="Escape";Wp({id:e,store:q,unselect:se,nodeRef:B})}else if(R&&E.selected&&Object.prototype.hasOwnProperty.call(mc,re.key)){re.preventDefault();const{ariaLabelConfig:se}=q.getState();q.setState({ariaLiveMessage:se["node.a11yDescription.ariaLiveMessage"]({direction:re.key.replace("Arrow","").toLowerCase(),x:~~A.positionAbsolute.x,y:~~A.positionAbsolute.y})}),M({direction:mc[re.key],factor:re.shiftKey?4:1})}}},ne=()=>{var _e;if(w||!((_e=B.current)!=null&&_e.matches(":focus-visible")))return;const{transform:re,width:se,height:xe,autoPanOnNodeFocus:ve,setCenter:ye}=q.getState();if(!ve)return;km(new Map([[e,E]]),{x:0,y:0,width:se,height:xe},re,!0).length>0||ye(E.position.x+Y.width/2,E.position.y+Y.height/2,{zoom:re[2]})};return b.jsx("div",{className:zt(["react-flow__node",`react-flow__node-${z}`,{[v]:R},E.className,{selected:E.selected,selectable:V,parent:U,draggable:R,dragging:$}]),ref:B,style:{zIndex:A.z,transform:`translate(${A.positionAbsolute.x}px,${A.positionAbsolute.y}px)`,pointerEvents:K?"all":"none",visibility:ee?"visible":"hidden",...E.style,...Q},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:j,onMouseMove:I,onMouseLeave:F,onContextMenu:N,onClick:X,onDoubleClick:G,onKeyDown:L?J:void 0,tabIndex:L?0:void 0,onFocus:L?ne:void 0,role:E.ariaRole??(L?"group":void 0),"aria-roledescription":"node","aria-describedby":w?void 0:`${OS}-${k}`,"aria-label":E.ariaLabel,...E.domAttributes,children:b.jsx(MM,{value:e,children:b.jsx(H,{id:e,data:E.data,type:z,positionAbsoluteX:A.positionAbsolute.x,positionAbsoluteY:A.positionAbsolute.y,selected:E.selected??!1,selectable:V,draggable:R,deletable:E.deletable??!0,isConnectable:O,sourcePosition:E.sourcePosition,targetPosition:E.targetPosition,dragging:$,dragHandle:E.dragHandle,zIndex:A.z,parentId:E.parentId,...Y})})})}var ZM=P.memo(QM);const KM=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function FS(e){const{nodesDraggable:n,nodesConnectable:r,nodesFocusable:l,elementsSelectable:a,onError:s}=$e(KM,pt),u=GM(e.onlyRenderVisibleElements),c=FM();return b.jsx("div",{className:"react-flow__nodes",style:Oc,children:u.map(d=>b.jsx(ZM,{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:c,nodesDraggable:n,nodesConnectable:r,nodesFocusable:l,elementsSelectable:a,nodeClickDistance:e.nodeClickDistance,onError:s},d))})}FS.displayName="NodeRenderer";const JM=P.memo(FS);function WM(e){return $e(P.useCallback(r=>{if(!e)return r.edges.map(a=>a.id);const l=[];if(r.width&&r.height)for(const a of r.edges){const s=r.nodeLookup.get(a.source),u=r.nodeLookup.get(a.target);s&&u&&ZA({sourceNode:s,targetNode:u,width:r.width,height:r.height,transform:r.transform})&&l.push(a.id)}return l},[e]),pt)}const ej=({color:e="none",strokeWidth:n=1})=>{const r={strokeWidth:n,...e&&{stroke:e}};return b.jsx("polyline",{className:"arrow",style:r,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},tj=({color:e="none",strokeWidth:n=1})=>{const r={strokeWidth:n,...e&&{stroke:e,fill:e}};return b.jsx("polyline",{className:"arrowclosed",style:r,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},i1={[dc.Arrow]:ej,[dc.ArrowClosed]:tj};function nj(e){const n=mt();return P.useMemo(()=>{var a,s;return Object.prototype.hasOwnProperty.call(i1,e)?i1[e]:((s=(a=n.getState()).onError)==null||s.call(a,"009",ir.error009(e)),null)},[e])}const rj=({id:e,type:n,color:r,width:l=12.5,height:a=12.5,markerUnits:s="strokeWidth",strokeWidth:u,orient:c="auto-start-reverse"})=>{const d=nj(n);return d?b.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${l}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:c,refX:"0",refY:"0",children:b.jsx(d,{color:r,strokeWidth:u})}):null},XS=({defaultColor:e,rfId:n})=>{const r=$e(s=>s.edges),l=$e(s=>s.defaultEdgeOptions),a=P.useMemo(()=>iz(r,{id:n,defaultColor:e,defaultMarkerStart:l==null?void 0:l.markerStart,defaultMarkerEnd:l==null?void 0:l.markerEnd}),[r,l,n,e]);return a.length?b.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:b.jsx("defs",{children:a.map(s=>b.jsx(rj,{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};XS.displayName="MarkerDefinitions";var ij=P.memo(XS);function QS({x:e,y:n,label:r,labelStyle:l,labelShowBg:a=!0,labelBgStyle:s,labelBgPadding:u=[2,4],labelBgBorderRadius:c=2,children:d,className:h,...m}){const[p,x]=P.useState({x:1,y:0,width:0,height:0}),v=zt(["react-flow__edge-textwrapper",h]),w=P.useRef(null);return P.useEffect(()=>{if(w.current){const k=w.current.getBBox();x({x:k.x,y:k.y,width:k.width,height:k.height})}},[r]),r?b.jsxs("g",{transform:`translate(${e-p.width/2} ${n-p.height/2})`,className:v,visibility:p.width?"visible":"hidden",...m,children:[a&&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:c,ry:c}),b.jsx("text",{className:"react-flow__edge-text",y:p.height/2,dy:"0.3em",ref:w,style:l,children:r}),d]}):null}QS.displayName="EdgeText";const lj=P.memo(QS);function ns({path:e,labelX:n,labelY:r,label:l,labelStyle:a,labelShowBg:s,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,interactionWidth:h=20,...m}){return b.jsxs(b.Fragment,{children:[b.jsx("path",{...m,d:e,fill:"none",className:zt(["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&&Vn(n)&&Vn(r)?b.jsx(lj,{x:n,y:r,label:l,labelStyle:a,labelShowBg:s,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d}):null]})}function l1({pos:e,x1:n,y1:r,x2:l,y2:a}){return e===be.Left||e===be.Right?[.5*(n+l),r]:[n,.5*(r+a)]}function ZS({sourceX:e,sourceY:n,sourcePosition:r=be.Bottom,targetX:l,targetY:a,targetPosition:s=be.Top}){const[u,c]=l1({pos:r,x1:e,y1:n,x2:l,y2:a}),[d,h]=l1({pos:s,x1:l,y1:a,x2:e,y2:n}),[m,p,x,v]=vS({sourceX:e,sourceY:n,targetX:l,targetY:a,sourceControlX:u,sourceControlY:c,targetControlX:d,targetControlY:h});return[`M${e},${n} C${u},${c} ${d},${h} ${l},${a}`,m,p,x,v]}function KS(e){return P.memo(({id:n,sourceX:r,sourceY:l,targetX:a,targetY:s,sourcePosition:u,targetPosition:c,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:x,labelBgBorderRadius:v,style:w,markerEnd:k,markerStart:_,interactionWidth:S})=>{const[T,E,A]=ZS({sourceX:r,sourceY:l,sourcePosition:u,targetX:a,targetY:s,targetPosition:c}),U=e.isInternal?void 0:n;return b.jsx(ns,{id:U,path:T,labelX:E,labelY:A,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:x,labelBgBorderRadius:v,style:w,markerEnd:k,markerStart:_,interactionWidth:S})})}const aj=KS({isInternal:!1}),JS=KS({isInternal:!0});aj.displayName="SimpleBezierEdge";JS.displayName="SimpleBezierEdgeInternal";function WS(e){return P.memo(({id:n,sourceX:r,sourceY:l,targetX:a,targetY:s,label:u,labelStyle:c,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:x,sourcePosition:v=be.Bottom,targetPosition:w=be.Top,markerEnd:k,markerStart:_,pathOptions:S,interactionWidth:T})=>{const[E,A,U]=Qp({sourceX:r,sourceY:l,sourcePosition:v,targetX:a,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}),z=e.isInternal?void 0:n;return b.jsx(ns,{id:z,path:E,labelX:A,labelY:U,label:u,labelStyle:c,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:x,markerEnd:k,markerStart:_,interactionWidth:T})})}const e_=WS({isInternal:!1}),t_=WS({isInternal:!0});e_.displayName="SmoothStepEdge";t_.displayName="SmoothStepEdgeInternal";function n_(e){return P.memo(({id:n,...r})=>{var a;const l=e.isInternal?void 0:n;return b.jsx(e_,{...r,id:l,pathOptions:P.useMemo(()=>{var s;return{borderRadius:0,offset:(s=r.pathOptions)==null?void 0:s.offset}},[(a=r.pathOptions)==null?void 0:a.offset])})})}const oj=n_({isInternal:!1}),r_=n_({isInternal:!0});oj.displayName="StepEdge";r_.displayName="StepEdgeInternal";function i_(e){return P.memo(({id:n,sourceX:r,sourceY:l,targetX:a,targetY:s,label:u,labelStyle:c,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:x,markerEnd:v,markerStart:w,interactionWidth:k})=>{const[_,S,T]=wS({sourceX:r,sourceY:l,targetX:a,targetY:s}),E=e.isInternal?void 0:n;return b.jsx(ns,{id:E,path:_,labelX:S,labelY:T,label:u,labelStyle:c,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:x,markerEnd:v,markerStart:w,interactionWidth:k})})}const sj=i_({isInternal:!1}),l_=i_({isInternal:!0});sj.displayName="StraightEdge";l_.displayName="StraightEdgeInternal";function a_(e){return P.memo(({id:n,sourceX:r,sourceY:l,targetX:a,targetY:s,sourcePosition:u=be.Bottom,targetPosition:c=be.Top,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:x,labelBgBorderRadius:v,style:w,markerEnd:k,markerStart:_,pathOptions:S,interactionWidth:T})=>{const[E,A,U]=Tm({sourceX:r,sourceY:l,sourcePosition:u,targetX:a,targetY:s,targetPosition:c,curvature:S==null?void 0:S.curvature}),z=e.isInternal?void 0:n;return b.jsx(ns,{id:z,path:E,labelX:A,labelY:U,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:x,labelBgBorderRadius:v,style:w,markerEnd:k,markerStart:_,interactionWidth:T})})}const uj=a_({isInternal:!1}),o_=a_({isInternal:!0});uj.displayName="BezierEdge";o_.displayName="BezierEdgeInternal";const a1={default:o_,straight:l_,step:r_,smoothstep:t_,simplebezier:JS},o1={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},cj=(e,n,r)=>r===be.Left?e-n:r===be.Right?e+n:e,fj=(e,n,r)=>r===be.Top?e-n:r===be.Bottom?e+n:e,s1="react-flow__edgeupdater";function u1({position:e,centerX:n,centerY:r,radius:l=10,onMouseDown:a,onMouseEnter:s,onMouseOut:u,type:c}){return b.jsx("circle",{onMouseDown:a,onMouseEnter:s,onMouseOut:u,className:zt([s1,`${s1}-${c}`]),cx:cj(n,l,e),cy:fj(r,l,e),r:l,stroke:"transparent",fill:"transparent"})}function dj({isReconnectable:e,reconnectRadius:n,edge:r,sourceX:l,sourceY:a,targetX:s,targetY:u,sourcePosition:c,targetPosition:d,onReconnect:h,onReconnectStart:m,onReconnectEnd:p,setReconnecting:x,setUpdateHover:v}){const w=mt(),k=(A,U)=>{if(A.button!==0)return;const{autoPanOnConnect:z,domNode:H,connectionMode:R,connectionRadius:V,lib:O,onConnectStart:L,cancelConnection:q,nodeLookup:ee,rfId:B,panBy:$,updateConnection:M}=w.getState(),Y=U.type==="target",Q=(I,F)=>{x(!1),p==null||p(I,r,U.type,F)},K=I=>h==null?void 0:h(r,I),j=(I,F)=>{x(!0),m==null||m(A,r,U.type),L==null||L(I,F)};Jp.onPointerDown(A.nativeEvent,{autoPanOnConnect:z,connectionMode:R,connectionRadius:V,domNode:H,handleId:U.id,nodeId:U.nodeId,nodeLookup:ee,isTarget:Y,edgeUpdaterType:U.type,lib:O,flowId:B,cancelConnection:q,panBy:$,isValidConnection:(...I)=>{var F,N;return((N=(F=w.getState()).isValidConnection)==null?void 0:N.call(F,...I))??!0},onConnect:K,onConnectStart:j,onConnectEnd:(...I)=>{var F,N;return(N=(F=w.getState()).onConnectEnd)==null?void 0:N.call(F,...I)},onReconnectEnd:Q,updateConnection:M,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,dragThreshold:w.getState().connectionDragThreshold,handleDomNode:A.currentTarget})},_=A=>k(A,{nodeId:r.target,id:r.targetHandle??null,type:"target"}),S=A=>k(A,{nodeId:r.source,id:r.sourceHandle??null,type:"source"}),T=()=>v(!0),E=()=>v(!1);return b.jsxs(b.Fragment,{children:[(e===!0||e==="source")&&b.jsx(u1,{position:c,centerX:l,centerY:a,radius:n,onMouseDown:_,onMouseEnter:T,onMouseOut:E,type:"source"}),(e===!0||e==="target")&&b.jsx(u1,{position:d,centerX:s,centerY:u,radius:n,onMouseDown:S,onMouseEnter:T,onMouseOut:E,type:"target"})]})}function hj({id:e,edgesFocusable:n,edgesReconnectable:r,elementsSelectable:l,onClick:a,onDoubleClick:s,onContextMenu:u,onMouseEnter:c,onMouseMove:d,onMouseLeave:h,reconnectRadius:m,onReconnect:p,onReconnectStart:x,onReconnectEnd:v,rfId:w,edgeTypes:k,noPanClassName:_,onError:S,disableKeyboardA11y:T}){let E=$e(ye=>ye.edgeLookup.get(e));const A=$e(ye=>ye.defaultEdgeOptions);E=A?{...A,...E}:E;let U=E.type||"default",z=(k==null?void 0:k[U])||a1[U];z===void 0&&(S==null||S("011",ir.error011(U)),U="default",z=(k==null?void 0:k.default)||a1.default);const H=!!(E.focusable||n&&typeof E.focusable>"u"),R=typeof p<"u"&&(E.reconnectable||r&&typeof E.reconnectable>"u"),V=!!(E.selectable||l&&typeof E.selectable>"u"),O=P.useRef(null),[L,q]=P.useState(!1),[ee,B]=P.useState(!1),$=mt(),{zIndex:M,sourceX:Y,sourceY:Q,targetX:K,targetY:j,sourcePosition:I,targetPosition:F}=$e(P.useCallback(ye=>{const pe=ye.nodeLookup.get(E.source),_e=ye.nodeLookup.get(E.target);if(!pe||!_e)return{zIndex:E.zIndex,...o1};const Me=rz({id:e,sourceNode:pe,targetNode:_e,sourceHandle:E.sourceHandle||null,targetHandle:E.targetHandle||null,connectionMode:ye.connectionMode,onError:S});return{zIndex:QA({selected:E.selected,zIndex:E.zIndex,sourceNode:pe,targetNode:_e,elevateOnSelect:ye.elevateEdgesOnSelect,zIndexMode:ye.zIndexMode}),...Me||o1}},[E.source,E.target,E.sourceHandle,E.targetHandle,E.selected,E.zIndex]),pt),N=P.useMemo(()=>E.markerStart?`url('#${Zp(E.markerStart,w)}')`:void 0,[E.markerStart,w]),G=P.useMemo(()=>E.markerEnd?`url('#${Zp(E.markerEnd,w)}')`:void 0,[E.markerEnd,w]);if(E.hidden||Y===null||Q===null||K===null||j===null)return null;const X=ye=>{var Te;const{addSelectedEdges:pe,unselectNodesAndEdges:_e,multiSelectionActive:Me}=$.getState();V&&($.setState({nodesSelectionActive:!1}),E.selected&&Me?(_e({nodes:[],edges:[E]}),(Te=O.current)==null||Te.blur()):pe([e])),a&&a(ye,E)},J=s?ye=>{s(ye,{...E})}:void 0,ne=u?ye=>{u(ye,{...E})}:void 0,re=c?ye=>{c(ye,{...E})}:void 0,se=d?ye=>{d(ye,{...E})}:void 0,xe=h?ye=>{h(ye,{...E})}:void 0,ve=ye=>{var pe;if(!T&&lS.includes(ye.key)&&V){const{unselectNodesAndEdges:_e,addSelectedEdges:Me}=$.getState();ye.key==="Escape"?((pe=O.current)==null||pe.blur(),_e({edges:[E]})):Me([e])}};return b.jsx("svg",{style:{zIndex:M},children:b.jsxs("g",{className:zt(["react-flow__edge",`react-flow__edge-${U}`,E.className,_,{selected:E.selected,animated:E.animated,inactive:!V&&!a,updating:L,selectable:V}]),onClick:X,onDoubleClick:J,onContextMenu:ne,onMouseEnter:re,onMouseMove:se,onMouseLeave:xe,onKeyDown:H?ve:void 0,tabIndex:H?0:void 0,role:E.ariaRole??(H?"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":H?`${LS}-${w}`:void 0,ref:O,...E.domAttributes,children:[!ee&&b.jsx(z,{id:e,source:E.source,target:E.target,type:E.type,selected:E.selected,animated:E.animated,selectable:V,deletable:E.deletable??!0,label:E.label,labelStyle:E.labelStyle,labelShowBg:E.labelShowBg,labelBgStyle:E.labelBgStyle,labelBgPadding:E.labelBgPadding,labelBgBorderRadius:E.labelBgBorderRadius,sourceX:Y,sourceY:Q,targetX:K,targetY:j,sourcePosition:I,targetPosition:F,data:E.data,style:E.style,sourceHandleId:E.sourceHandle,targetHandleId:E.targetHandle,markerStart:N,markerEnd:G,pathOptions:"pathOptions"in E?E.pathOptions:void 0,interactionWidth:E.interactionWidth}),R&&b.jsx(dj,{edge:E,isReconnectable:R,reconnectRadius:m,onReconnect:p,onReconnectStart:x,onReconnectEnd:v,sourceX:Y,sourceY:Q,targetX:K,targetY:j,sourcePosition:I,targetPosition:F,setUpdateHover:q,setReconnecting:B})]})})}var pj=P.memo(hj);const mj=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function s_({defaultMarkerColor:e,onlyRenderVisibleElements:n,rfId:r,edgeTypes:l,noPanClassName:a,onReconnect:s,onEdgeContextMenu:u,onEdgeMouseEnter:c,onEdgeMouseMove:d,onEdgeMouseLeave:h,onEdgeClick:m,reconnectRadius:p,onEdgeDoubleClick:x,onReconnectStart:v,onReconnectEnd:w,disableKeyboardA11y:k}){const{edgesFocusable:_,edgesReconnectable:S,elementsSelectable:T,onError:E}=$e(mj,pt),A=WM(n);return b.jsxs("div",{className:"react-flow__edges",children:[b.jsx(ij,{defaultColor:e,rfId:r}),A.map(U=>b.jsx(pj,{id:U,edgesFocusable:_,edgesReconnectable:S,elementsSelectable:T,noPanClassName:a,onReconnect:s,onContextMenu:u,onMouseEnter:c,onMouseMove:d,onMouseLeave:h,onClick:m,reconnectRadius:p,onDoubleClick:x,onReconnectStart:v,onReconnectEnd:w,rfId:r,onError:E,edgeTypes:l,disableKeyboardA11y:k},U))]})}s_.displayName="EdgeRenderer";const gj=P.memo(s_),xj=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function yj({children:e}){const n=$e(xj);return b.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:e})}function vj(e){const n=ma(),r=P.useRef(!1);P.useEffect(()=>{!r.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),r.current=!0)},[e,n.viewportInitialized])}const bj=e=>{var n;return(n=e.panZoom)==null?void 0:n.syncViewport};function wj(e){const n=$e(bj),r=mt();return P.useEffect(()=>{e&&(n==null||n(e),r.setState({transform:[e.x,e.y,e.zoom]}))},[e,n]),null}function Sj(e){return e.connection.inProgress?{...e.connection,to:ts(e.connection.to,e.transform)}:{...e.connection}}function _j(e){return Sj}function Ej(e){const n=_j();return $e(n,pt)}const kj=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Nj({containerStyle:e,style:n,type:r,component:l}){const{nodesConnectable:a,width:s,height:u,isValid:c,inProgress:d}=$e(kj,pt);return!(s&&a&&d)?null:b.jsx("svg",{style:e,width:s,height:u,className:"react-flow__connectionline react-flow__container",children:b.jsx("g",{className:zt(["react-flow__connection",sS(c)]),children:b.jsx(u_,{style:n,type:r,CustomComponent:l,isValid:c})})})}const u_=({style:e,type:n=xi.Bezier,CustomComponent:r,isValid:l})=>{const{inProgress:a,from:s,fromNode:u,fromHandle:c,fromPosition:d,to:h,toNode:m,toHandle:p,toPosition:x,pointer:v}=Ej();if(!a)return;if(r)return b.jsx(r,{connectionLineType:n,connectionLineStyle:e,fromNode:u,fromHandle:c,fromX:s.x,fromY:s.y,toX:h.x,toY:h.y,fromPosition:d,toPosition:x,connectionStatus:sS(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:x};switch(n){case xi.Bezier:[w]=Tm(k);break;case xi.SimpleBezier:[w]=ZS(k);break;case xi.Step:[w]=Qp({...k,borderRadius:0});break;case xi.SmoothStep:[w]=Qp(k);break;default:[w]=wS(k)}return b.jsx("path",{d:w,fill:"none",className:"react-flow__connection-path",style:e})};u_.displayName="ConnectionLine";const Cj={};function c1(e=Cj){P.useRef(e),mt(),P.useEffect(()=>{},[e])}function Tj(){mt(),P.useRef(!1),P.useEffect(()=>{},[])}function c_({nodeTypes:e,edgeTypes:n,onInit:r,onNodeClick:l,onEdgeClick:a,onNodeDoubleClick:s,onEdgeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:h,onNodeContextMenu:m,onSelectionContextMenu:p,onSelectionStart:x,onSelectionEnd:v,connectionLineType:w,connectionLineStyle:k,connectionLineComponent:_,connectionLineContainerStyle:S,selectionKeyCode:T,selectionOnDrag:E,selectionMode:A,multiSelectionKeyCode:U,panActivationKeyCode:z,zoomActivationKeyCode:H,deleteKeyCode:R,onlyRenderVisibleElements:V,elementsSelectable:O,defaultViewport:L,translateExtent:q,minZoom:ee,maxZoom:B,preventScrolling:$,defaultMarkerColor:M,zoomOnScroll:Y,zoomOnPinch:Q,panOnScroll:K,panOnScrollSpeed:j,panOnScrollMode:I,zoomOnDoubleClick:F,panOnDrag:N,onPaneClick:G,onPaneMouseEnter:X,onPaneMouseMove:J,onPaneMouseLeave:ne,onPaneScroll:re,onPaneContextMenu:se,paneClickDistance:xe,nodeClickDistance:ve,onEdgeContextMenu:ye,onEdgeMouseEnter:pe,onEdgeMouseMove:_e,onEdgeMouseLeave:Me,reconnectRadius:Te,onReconnect:ct,onReconnectStart:nt,onReconnectEnd:Mt,noDragClassName:Vt,noWheelClassName:Lt,noPanClassName:En,disableKeyboardA11y:Rn,nodeExtent:jt,rfId:Lr,viewport:ue,onViewportChange:ge}){return c1(e),c1(n),Tj(),vj(r),wj(ue),b.jsx(PM,{onPaneClick:G,onPaneMouseEnter:X,onPaneMouseMove:J,onPaneMouseLeave:ne,onPaneContextMenu:se,onPaneScroll:re,paneClickDistance:xe,deleteKeyCode:R,selectionKeyCode:T,selectionOnDrag:E,selectionMode:A,onSelectionStart:x,onSelectionEnd:v,multiSelectionKeyCode:U,panActivationKeyCode:z,zoomActivationKeyCode:H,elementsSelectable:O,zoomOnScroll:Y,zoomOnPinch:Q,zoomOnDoubleClick:F,panOnScroll:K,panOnScrollSpeed:j,panOnScrollMode:I,panOnDrag:N,defaultViewport:L,translateExtent:q,minZoom:ee,maxZoom:B,onSelectionContextMenu:p,preventScrolling:$,noDragClassName:Vt,noWheelClassName:Lt,noPanClassName:En,disableKeyboardA11y:Rn,onViewportChange:ge,isControlledViewport:!!ue,children:b.jsxs(yj,{children:[b.jsx(gj,{edgeTypes:n,onEdgeClick:a,onEdgeDoubleClick:u,onReconnect:ct,onReconnectStart:nt,onReconnectEnd:Mt,onlyRenderVisibleElements:V,onEdgeContextMenu:ye,onEdgeMouseEnter:pe,onEdgeMouseMove:_e,onEdgeMouseLeave:Me,reconnectRadius:Te,defaultMarkerColor:M,noPanClassName:En,disableKeyboardA11y:Rn,rfId:Lr}),b.jsx(Nj,{style:k,type:w,component:_,containerStyle:S}),b.jsx("div",{className:"react-flow__edgelabel-renderer"}),b.jsx(JM,{nodeTypes:e,onNodeClick:l,onNodeDoubleClick:s,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:h,onNodeContextMenu:m,nodeClickDistance:ve,onlyRenderVisibleElements:V,noPanClassName:En,noDragClassName:Vt,disableKeyboardA11y:Rn,nodeExtent:jt,rfId:Lr}),b.jsx("div",{className:"react-flow__viewport-portal"})]})})}c_.displayName="GraphView";const Aj=P.memo(c_),f1=({nodes:e,edges:n,defaultNodes:r,defaultEdges:l,width:a,height:s,fitView:u,fitViewOptions:c,minZoom:d=.5,maxZoom:h=2,nodeOrigin:m,nodeExtent:p,zIndexMode:x="basic"}={})=>{const v=new Map,w=new Map,k=new Map,_=new Map,S=l??n??[],T=r??e??[],E=m??[0,0],A=p??qo;ES(k,_,S);const U=Kp(T,v,w,{nodeOrigin:E,nodeExtent:A,zIndexMode:x});let z=[0,0,1];if(u&&a&&s){const H=Wo(v,{filter:L=>!!((L.width||L.initialWidth)&&(L.height||L.initialHeight))}),{x:R,y:V,zoom:O}=Nm(H,a,s,d,h,(c==null?void 0:c.padding)??.1);z=[R,V,O]}return{rfId:"1",width:a??0,height:s??0,transform:z,nodes:T,nodesInitialized:U,nodeLookup:v,parentLookup:w,edges:S,edgeLookup:_,connectionLookup:k,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:r!==void 0,hasDefaultEdges:l!==void 0,panZoom:null,minZoom:d,maxZoom:h,translateExtent:qo,nodeExtent:A,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:ua.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:c,fitViewResolver:null,connection:{...oS},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:PA,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:aS,zIndexMode:x,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},zj=({nodes:e,edges:n,defaultNodes:r,defaultEdges:l,width:a,height:s,fitView:u,fitViewOptions:c,minZoom:d,maxZoom:h,nodeOrigin:m,nodeExtent:p,zIndexMode:x})=>Fz((v,w)=>{async function k(){const{nodeLookup:_,panZoom:S,fitViewOptions:T,fitViewResolver:E,width:A,height:U,minZoom:z,maxZoom:H}=w();S&&(await UA({nodes:_,width:A,height:U,panZoom:S,minZoom:z,maxZoom:H},T),E==null||E.resolve(!0),v({fitViewResolver:null}))}return{...f1({nodes:e,edges:n,width:a,height:s,fitView:u,fitViewOptions:c,minZoom:d,maxZoom:h,nodeOrigin:m,nodeExtent:p,defaultNodes:r,defaultEdges:l,zIndexMode:x}),setNodes:_=>{const{nodeLookup:S,parentLookup:T,nodeOrigin:E,elevateNodesOnSelect:A,fitViewQueued:U,zIndexMode:z}=w(),H=Kp(_,S,T,{nodeOrigin:E,nodeExtent:p,elevateNodesOnSelect:A,checkEquality:!0,zIndexMode:z});U&&H?(k(),v({nodes:_,nodesInitialized:H,fitViewQueued:!1,fitViewOptions:void 0})):v({nodes:_,nodesInitialized:H})},setEdges:_=>{const{connectionLookup:S,edgeLookup:T}=w();ES(S,T,_),v({edges:_})},setDefaultNodesAndEdges:(_,S)=>{if(_){const{setNodes:T}=w();T(_),v({hasDefaultNodes:!0})}if(S){const{setEdges:T}=w();T(S),v({hasDefaultEdges:!0})}},updateNodeInternals:_=>{const{triggerNodeChanges:S,nodeLookup:T,parentLookup:E,domNode:A,nodeOrigin:U,nodeExtent:z,debug:H,fitViewQueued:R,zIndexMode:V}=w(),{changes:O,updatedInternals:L}=fz(_,T,E,A,U,z,V);L&&(oz(T,E,{nodeOrigin:U,nodeExtent:z,zIndexMode:V}),R?(k(),v({fitViewQueued:!1,fitViewOptions:void 0})):v({}),(O==null?void 0:O.length)>0&&(H&&console.log("React Flow: trigger node changes",O),S==null||S(O)))},updateNodePositions:(_,S=!1)=>{const T=[];let E=[];const{nodeLookup:A,triggerNodeChanges:U,connection:z,updateConnection:H,onNodesChangeMiddlewareMap:R}=w();for(const[V,O]of _){const L=A.get(V),q=!!(L!=null&&L.expandParent&&(L!=null&&L.parentId)&&(O!=null&&O.position)),ee={id:V,type:"position",position:q?{x:Math.max(0,O.position.x),y:Math.max(0,O.position.y)}:O.position,dragging:S};if(L&&z.inProgress&&z.fromNode.id===L.id){const B=el(L,z.fromHandle,be.Left,!0);H({...z,from:B})}q&&L.parentId&&T.push({id:V,parentId:L.parentId,rect:{...O.internals.positionAbsolute,width:O.measured.width??0,height:O.measured.height??0}}),E.push(ee)}if(T.length>0){const{parentLookup:V,nodeOrigin:O}=w(),L=Dm(T,A,V,O);E.push(...L)}for(const V of R.values())E=V(E);U(E)},triggerNodeChanges:_=>{const{onNodesChange:S,setNodes:T,nodes:E,hasDefaultNodes:A,debug:U}=w();if(_!=null&&_.length){if(A){const z=IS(_,E);T(z)}U&&console.log("React Flow: trigger node changes",_),S==null||S(_)}},triggerEdgeChanges:_=>{const{onEdgesChange:S,setEdges:T,edges:E,hasDefaultEdges:A,debug:U}=w();if(_!=null&&_.length){if(A){const z=qS(_,E);T(z)}U&&console.log("React Flow: trigger edge changes",_),S==null||S(_)}},addSelectedNodes:_=>{const{multiSelectionActive:S,edgeLookup:T,nodeLookup:E,triggerNodeChanges:A,triggerEdgeChanges:U}=w();if(S){const z=_.map(H=>Pi(H,!0));A(z);return}A(ta(E,new Set([..._]),!0)),U(ta(T))},addSelectedEdges:_=>{const{multiSelectionActive:S,edgeLookup:T,nodeLookup:E,triggerNodeChanges:A,triggerEdgeChanges:U}=w();if(S){const z=_.map(H=>Pi(H,!0));U(z);return}U(ta(T,new Set([..._]))),A(ta(E,new Set,!0))},unselectNodesAndEdges:({nodes:_,edges:S}={})=>{const{edges:T,nodes:E,nodeLookup:A,triggerNodeChanges:U,triggerEdgeChanges:z}=w(),H=_||E,R=S||T,V=[];for(const L of H){if(!L.selected)continue;const q=A.get(L.id);q&&(q.selected=!1),V.push(Pi(L.id,!1))}const O=[];for(const L of R)L.selected&&O.push(Pi(L.id,!1));U(V),z(O)},setMinZoom:_=>{const{panZoom:S,maxZoom:T}=w();S==null||S.setScaleExtent([_,T]),v({minZoom:_})},setMaxZoom:_=>{const{panZoom:S,minZoom:T}=w();S==null||S.setScaleExtent([T,_]),v({maxZoom:_})},setTranslateExtent:_=>{var S;(S=w().panZoom)==null||S.setTranslateExtent(_),v({translateExtent:_})},resetSelectedElements:()=>{const{edges:_,nodes:S,triggerNodeChanges:T,triggerEdgeChanges:E,elementsSelectable:A}=w();if(!A)return;const U=S.reduce((H,R)=>R.selected?[...H,Pi(R.id,!1)]:H,[]),z=_.reduce((H,R)=>R.selected?[...H,Pi(R.id,!1)]:H,[]);T(U),E(z)},setNodeExtent:_=>{const{nodes:S,nodeLookup:T,parentLookup:E,nodeOrigin:A,elevateNodesOnSelect:U,nodeExtent:z,zIndexMode:H}=w();_[0][0]===z[0][0]&&_[0][1]===z[0][1]&&_[1][0]===z[1][0]&&_[1][1]===z[1][1]||(Kp(S,T,E,{nodeOrigin:A,nodeExtent:_,elevateNodesOnSelect:U,checkEquality:!1,zIndexMode:H}),v({nodeExtent:_}))},panBy:_=>{const{transform:S,width:T,height:E,panZoom:A,translateExtent:U}=w();return dz({delta:_,panZoom:A,transform:S,translateExtent:U,width:T,height:E})},setCenter:async(_,S,T)=>{const{width:E,height:A,maxZoom:U,panZoom:z}=w();if(!z)return Promise.resolve(!1);const H=typeof(T==null?void 0:T.zoom)<"u"?T.zoom:U;return await z.setViewport({x:E/2-_*H,y:A/2-S*H,zoom:H},{duration:T==null?void 0:T.duration,ease:T==null?void 0:T.ease,interpolate:T==null?void 0:T.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{v({connection:{...oS}})},updateConnection:_=>{v({connection:_})},reset:()=>v({...f1()})}},Object.is);function Mj({initialNodes:e,initialEdges:n,defaultNodes:r,defaultEdges:l,initialWidth:a,initialHeight:s,initialMinZoom:u,initialMaxZoom:c,initialFitViewOptions:d,fitView:h,nodeOrigin:m,nodeExtent:p,zIndexMode:x,children:v}){const[w]=P.useState(()=>zj({nodes:e,edges:n,defaultNodes:r,defaultEdges:l,width:a,height:s,fitView:h,minZoom:u,maxZoom:c,fitViewOptions:d,nodeOrigin:m,nodeExtent:p,zIndexMode:x}));return b.jsx(Qz,{value:w,children:b.jsx(yM,{children:v})})}function jj({children:e,nodes:n,edges:r,defaultNodes:l,defaultEdges:a,width:s,height:u,fitView:c,fitViewOptions:d,minZoom:h,maxZoom:m,nodeOrigin:p,nodeExtent:x,zIndexMode:v}){return P.useContext(Dc)?b.jsx(b.Fragment,{children:e}):b.jsx(Mj,{initialNodes:n,initialEdges:r,defaultNodes:l,defaultEdges:a,initialWidth:s,initialHeight:u,fitView:c,initialFitViewOptions:d,initialMinZoom:h,initialMaxZoom:m,nodeOrigin:p,nodeExtent:x,zIndexMode:v,children:e})}const Dj={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Rj({nodes:e,edges:n,defaultNodes:r,defaultEdges:l,className:a,nodeTypes:s,edgeTypes:u,onNodeClick:c,onEdgeClick:d,onInit:h,onMove:m,onMoveStart:p,onMoveEnd:x,onConnect:v,onConnectStart:w,onConnectEnd:k,onClickConnectStart:_,onClickConnectEnd:S,onNodeMouseEnter:T,onNodeMouseMove:E,onNodeMouseLeave:A,onNodeContextMenu:U,onNodeDoubleClick:z,onNodeDragStart:H,onNodeDrag:R,onNodeDragStop:V,onNodesDelete:O,onEdgesDelete:L,onDelete:q,onSelectionChange:ee,onSelectionDragStart:B,onSelectionDrag:$,onSelectionDragStop:M,onSelectionContextMenu:Y,onSelectionStart:Q,onSelectionEnd:K,onBeforeDelete:j,connectionMode:I,connectionLineType:F=xi.Bezier,connectionLineStyle:N,connectionLineComponent:G,connectionLineContainerStyle:X,deleteKeyCode:J="Backspace",selectionKeyCode:ne="Shift",selectionOnDrag:re=!1,selectionMode:se=Uo.Full,panActivationKeyCode:xe="Space",multiSelectionKeyCode:ve=Po()?"Meta":"Control",zoomActivationKeyCode:ye=Po()?"Meta":"Control",snapToGrid:pe,snapGrid:_e,onlyRenderVisibleElements:Me=!1,selectNodesOnDrag:Te,nodesDraggable:ct,autoPanOnNodeFocus:nt,nodesConnectable:Mt,nodesFocusable:Vt,nodeOrigin:Lt=HS,edgesFocusable:En,edgesReconnectable:Rn,elementsSelectable:jt=!0,defaultViewport:Lr=sM,minZoom:ue=.5,maxZoom:ge=2,translateExtent:Ne=qo,preventScrolling:Oe=!0,nodeExtent:Ge,defaultMarkerColor:Qt="#b1b1b7",zoomOnScroll:On=!0,zoomOnPinch:Ht=!0,panOnScroll:vt=!1,panOnScrollSpeed:Pt=.5,panOnScrollMode:We=Qi.Free,zoomOnDoubleClick:Qn=!0,panOnDrag:fn=!0,onPaneClick:Vc,onPaneMouseEnter:ol,onPaneMouseMove:sl,onPaneMouseLeave:ul,onPaneScroll:or,onPaneContextMenu:cl,paneClickDistance:bi=1,nodeClickDistance:Pc=0,children:os,onReconnect:ya,onReconnectStart:wi,onReconnectEnd:$c,onEdgeContextMenu:ss,onEdgeDoubleClick:us,onEdgeMouseEnter:cs,onEdgeMouseMove:va,onEdgeMouseLeave:ba,reconnectRadius:fs=10,onNodesChange:ds,onEdgesChange:Zn,noDragClassName:Dt="nodrag",noWheelClassName:$t="nowheel",noPanClassName:sr="nopan",fitView:fl,fitViewOptions:hs,connectOnClick:Gc,attributionPosition:ps,proOptions:Si,defaultEdgeOptions:wa,elevateNodesOnSelect:Hr=!0,elevateEdgesOnSelect:Br=!1,disableKeyboardA11y:Ir=!1,autoPanOnConnect:qr,autoPanOnNodeDrag:St,autoPanSpeed:ms,connectionRadius:gs,isValidConnection:ur,onError:Ur,style:Yc,id:Sa,nodeDragThreshold:xs,connectionDragThreshold:Fc,viewport:dl,onViewportChange:hl,width:Ln,height:Wt,colorMode:ys="light",debug:Xc,onScroll:Vr,ariaLabelConfig:vs,zIndexMode:_i="basic",...Qc},en){const Ei=Sa||"1",bs=dM(ys),_a=P.useCallback(cr=>{cr.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Vr==null||Vr(cr)},[Vr]);return b.jsx("div",{"data-testid":"rf__wrapper",...Qc,onScroll:_a,style:{...Yc,...Dj},ref:en,className:zt(["react-flow",a,bs]),id:Sa,role:"application",children:b.jsxs(jj,{nodes:e,edges:n,width:Ln,height:Wt,fitView:fl,fitViewOptions:hs,minZoom:ue,maxZoom:ge,nodeOrigin:Lt,nodeExtent:Ge,zIndexMode:_i,children:[b.jsx(Aj,{onInit:h,onNodeClick:c,onEdgeClick:d,onNodeMouseEnter:T,onNodeMouseMove:E,onNodeMouseLeave:A,onNodeContextMenu:U,onNodeDoubleClick:z,nodeTypes:s,edgeTypes:u,connectionLineType:F,connectionLineStyle:N,connectionLineComponent:G,connectionLineContainerStyle:X,selectionKeyCode:ne,selectionOnDrag:re,selectionMode:se,deleteKeyCode:J,multiSelectionKeyCode:ve,panActivationKeyCode:xe,zoomActivationKeyCode:ye,onlyRenderVisibleElements:Me,defaultViewport:Lr,translateExtent:Ne,minZoom:ue,maxZoom:ge,preventScrolling:Oe,zoomOnScroll:On,zoomOnPinch:Ht,zoomOnDoubleClick:Qn,panOnScroll:vt,panOnScrollSpeed:Pt,panOnScrollMode:We,panOnDrag:fn,onPaneClick:Vc,onPaneMouseEnter:ol,onPaneMouseMove:sl,onPaneMouseLeave:ul,onPaneScroll:or,onPaneContextMenu:cl,paneClickDistance:bi,nodeClickDistance:Pc,onSelectionContextMenu:Y,onSelectionStart:Q,onSelectionEnd:K,onReconnect:ya,onReconnectStart:wi,onReconnectEnd:$c,onEdgeContextMenu:ss,onEdgeDoubleClick:us,onEdgeMouseEnter:cs,onEdgeMouseMove:va,onEdgeMouseLeave:ba,reconnectRadius:fs,defaultMarkerColor:Qt,noDragClassName:Dt,noWheelClassName:$t,noPanClassName:sr,rfId:Ei,disableKeyboardA11y:Ir,nodeExtent:Ge,viewport:dl,onViewportChange:hl}),b.jsx(fM,{nodes:e,edges:n,defaultNodes:r,defaultEdges:l,onConnect:v,onConnectStart:w,onConnectEnd:k,onClickConnectStart:_,onClickConnectEnd:S,nodesDraggable:ct,autoPanOnNodeFocus:nt,nodesConnectable:Mt,nodesFocusable:Vt,edgesFocusable:En,edgesReconnectable:Rn,elementsSelectable:jt,elevateNodesOnSelect:Hr,elevateEdgesOnSelect:Br,minZoom:ue,maxZoom:ge,nodeExtent:Ge,onNodesChange:ds,onEdgesChange:Zn,snapToGrid:pe,snapGrid:_e,connectionMode:I,translateExtent:Ne,connectOnClick:Gc,defaultEdgeOptions:wa,fitView:fl,fitViewOptions:hs,onNodesDelete:O,onEdgesDelete:L,onDelete:q,onNodeDragStart:H,onNodeDrag:R,onNodeDragStop:V,onSelectionDrag:$,onSelectionDragStart:B,onSelectionDragStop:M,onMove:m,onMoveStart:p,onMoveEnd:x,noPanClassName:sr,nodeOrigin:Lt,rfId:Ei,autoPanOnConnect:qr,autoPanOnNodeDrag:St,autoPanSpeed:ms,onError:Ur,connectionRadius:gs,isValidConnection:ur,selectNodesOnDrag:Te,nodeDragThreshold:xs,connectionDragThreshold:Fc,onBeforeDelete:j,debug:Xc,ariaLabelConfig:vs,zIndexMode:_i}),b.jsx(oM,{onSelectionChange:ee}),os,b.jsx(nM,{proOptions:Si,position:ps}),b.jsx(tM,{rfId:Ei,disableKeyboardA11y:Ir})]})})}var Oj=US(Rj);const Lj=e=>{var n;return(n=e.domNode)==null?void 0:n.querySelector(".react-flow__edgelabel-renderer")};function Hj({children:e}){const n=$e(Lj);return n?Xz.createPortal(e,n):null}function Bj(e){const[n,r]=P.useState(e),l=P.useCallback(a=>r(s=>IS(a,s)),[]);return[n,r,l]}function Ij(e){const[n,r]=P.useState(e),l=P.useCallback(a=>r(s=>qS(a,s)),[]);return[n,r,l]}function qj({dimensions:e,lineWidth:n,variant:r,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:zt(["react-flow__background-pattern",r,l])})}function Uj({radius:e,className:n}){return b.jsx("circle",{cx:e,cy:e,r:e,className:zt(["react-flow__background-pattern","dots",n])})}var Mr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Mr||(Mr={}));const Vj={[Mr.Dots]:1,[Mr.Lines]:1,[Mr.Cross]:6},Pj=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function f_({id:e,variant:n=Mr.Dots,gap:r=20,size:l,lineWidth:a=1,offset:s=0,color:u,bgColor:c,style:d,className:h,patternClassName:m}){const p=P.useRef(null),{transform:x,patternId:v}=$e(Pj,pt),w=l||Vj[n],k=n===Mr.Dots,_=n===Mr.Cross,S=Array.isArray(r)?r:[r,r],T=[S[0]*x[2]||1,S[1]*x[2]||1],E=w*x[2],A=Array.isArray(s)?s:[s,s],U=_?[E,E]:T,z=[A[0]*x[2]||1+U[0]/2,A[1]*x[2]||1+U[1]/2],H=`${v}${e||""}`;return b.jsxs("svg",{className:zt(["react-flow__background",h]),style:{...d,...Oc,"--xy-background-color-props":c,"--xy-background-pattern-color-props":u},ref:p,"data-testid":"rf__background",children:[b.jsx("pattern",{id:H,x:x[0]%T[0],y:x[1]%T[1],width:T[0],height:T[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${z[0]},-${z[1]})`,children:k?b.jsx(Uj,{radius:E/2,className:m}):b.jsx(qj,{dimensions:U,lineWidth:a,variant:n,className:m})}),b.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${H})`})]})}f_.displayName="Background";const $j=P.memo(f_);function Gj(){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 Yj(){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 Fj(){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 Xj(){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 Qj(){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 Pu({children:e,className:n,...r}){return b.jsx("button",{type:"button",className:zt(["react-flow__controls-button",n]),...r,children:e})}const Zj=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function d_({style:e,showZoom:n=!0,showFitView:r=!0,showInteractive:l=!0,fitViewOptions:a,onZoomIn:s,onZoomOut:u,onFitView:c,onInteractiveChange:d,className:h,children:m,position:p="bottom-left",orientation:x="vertical","aria-label":v}){const w=mt(),{isInteractive:k,minZoomReached:_,maxZoomReached:S,ariaLabelConfig:T}=$e(Zj,pt),{zoomIn:E,zoomOut:A,fitView:U}=ma(),z=()=>{E(),s==null||s()},H=()=>{A(),u==null||u()},R=()=>{U(a),c==null||c()},V=()=>{w.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),d==null||d(!k)},O=x==="horizontal"?"horizontal":"vertical";return b.jsxs(Rc,{className:zt(["react-flow__controls",O,h]),position:p,style:e,"data-testid":"rf__controls","aria-label":v??T["controls.ariaLabel"],children:[n&&b.jsxs(b.Fragment,{children:[b.jsx(Pu,{onClick:z,className:"react-flow__controls-zoomin",title:T["controls.zoomIn.ariaLabel"],"aria-label":T["controls.zoomIn.ariaLabel"],disabled:S,children:b.jsx(Gj,{})}),b.jsx(Pu,{onClick:H,className:"react-flow__controls-zoomout",title:T["controls.zoomOut.ariaLabel"],"aria-label":T["controls.zoomOut.ariaLabel"],disabled:_,children:b.jsx(Yj,{})})]}),r&&b.jsx(Pu,{className:"react-flow__controls-fitview",onClick:R,title:T["controls.fitView.ariaLabel"],"aria-label":T["controls.fitView.ariaLabel"],children:b.jsx(Fj,{})}),l&&b.jsx(Pu,{className:"react-flow__controls-interactive",onClick:V,title:T["controls.interactive.ariaLabel"],"aria-label":T["controls.interactive.ariaLabel"],children:k?b.jsx(Qj,{}):b.jsx(Xj,{})}),m]})}d_.displayName="Controls";const Kj=P.memo(d_);function Jj({id:e,x:n,y:r,width:l,height:a,style:s,color:u,strokeColor:c,strokeWidth:d,className:h,borderRadius:m,shapeRendering:p,selected:x,onClick:v}){const{background:w,backgroundColor:k}=s||{},_=u||w||k;return b.jsx("rect",{className:zt(["react-flow__minimap-node",{selected:x},h]),x:n,y:r,rx:m,ry:m,width:l,height:a,style:{fill:_,stroke:c,strokeWidth:d},shapeRendering:p,onClick:v?S=>v(S,e):void 0})}const Wj=P.memo(Jj),e4=e=>e.nodes.map(n=>n.id),Eh=e=>e instanceof Function?e:()=>e;function t4({nodeStrokeColor:e,nodeColor:n,nodeClassName:r="",nodeBorderRadius:l=5,nodeStrokeWidth:a,nodeComponent:s=Wj,onClick:u}){const c=$e(e4,pt),d=Eh(n),h=Eh(e),m=Eh(r),p=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return b.jsx(b.Fragment,{children:c.map(x=>b.jsx(r4,{id:x,nodeColorFunc:d,nodeStrokeColorFunc:h,nodeClassNameFunc:m,nodeBorderRadius:l,nodeStrokeWidth:a,NodeComponent:s,onClick:u,shapeRendering:p},x))})}function n4({id:e,nodeColorFunc:n,nodeStrokeColorFunc:r,nodeClassNameFunc:l,nodeBorderRadius:a,nodeStrokeWidth:s,shapeRendering:u,NodeComponent:c,onClick:d}){const{node:h,x:m,y:p,width:x,height:v}=$e(w=>{const k=w.nodeLookup.get(e);if(!k)return{node:void 0,x:0,y:0,width:0,height:0};const _=k.internals.userNode,{x:S,y:T}=k.internals.positionAbsolute,{width:E,height:A}=Rr(_);return{node:_,x:S,y:T,width:E,height:A}},pt);return!h||h.hidden||!pS(h)?null:b.jsx(c,{x:m,y:p,width:x,height:v,style:h.style,selected:!!h.selected,className:l(h),color:n(h),borderRadius:a,strokeColor:r(h),strokeWidth:s,shapeRendering:u,onClick:d,id:h.id})}const r4=P.memo(n4);var i4=P.memo(t4);const l4=200,a4=150,o4=e=>!e.hidden,s4=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?hS(Wo(e.nodeLookup,{filter:o4}),n):n,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},u4="react-flow__minimap-desc";function h_({style:e,className:n,nodeStrokeColor:r,nodeColor:l,nodeClassName:a="",nodeBorderRadius:s=5,nodeStrokeWidth:u,nodeComponent:c,bgColor:d,maskColor:h,maskStrokeColor:m,maskStrokeWidth:p,position:x="bottom-right",onClick:v,onNodeClick:w,pannable:k=!1,zoomable:_=!1,ariaLabel:S,inversePan:T,zoomStep:E=1,offsetScale:A=5}){const U=mt(),z=P.useRef(null),{boundingRect:H,viewBB:R,rfId:V,panZoom:O,translateExtent:L,flowWidth:q,flowHeight:ee,ariaLabelConfig:B}=$e(s4,pt),$=(e==null?void 0:e.width)??l4,M=(e==null?void 0:e.height)??a4,Y=H.width/$,Q=H.height/M,K=Math.max(Y,Q),j=K*$,I=K*M,F=A*K,N=H.x-(j-H.width)/2-F,G=H.y-(I-H.height)/2-F,X=j+F*2,J=I+F*2,ne=`${u4}-${V}`,re=P.useRef(0),se=P.useRef();re.current=K,P.useEffect(()=>{if(z.current&&O)return se.current=wz({domNode:z.current,panZoom:O,getTransform:()=>U.getState().transform,getViewScale:()=>re.current}),()=>{var pe;(pe=se.current)==null||pe.destroy()}},[O]),P.useEffect(()=>{var pe;(pe=se.current)==null||pe.update({translateExtent:L,width:q,height:ee,inversePan:T,pannable:k,zoomStep:E,zoomable:_})},[k,_,T,E,L,q,ee]);const xe=v?pe=>{var Te;const[_e,Me]=((Te=se.current)==null?void 0:Te.pointer(pe))||[0,0];v(pe,{x:_e,y:Me})}:void 0,ve=w?P.useCallback((pe,_e)=>{const Me=U.getState().nodeLookup.get(_e).internals.userNode;w(pe,Me)},[]):void 0,ye=S??B["minimap.ariaLabel"];return b.jsx(Rc,{position:x,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*K:void 0,"--xy-minimap-node-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-node-stroke-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-width-props":typeof u=="number"?u:void 0},className:zt(["react-flow__minimap",n]),"data-testid":"rf__minimap",children:b.jsxs("svg",{width:$,height:M,viewBox:`${N} ${G} ${X} ${J}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ne,ref:z,onClick:xe,children:[ye&&b.jsx("title",{id:ne,children:ye}),b.jsx(i4,{onClick:ve,nodeColor:l,nodeStrokeColor:r,nodeBorderRadius:s,nodeClassName:a,nodeStrokeWidth:u,nodeComponent:c}),b.jsx("path",{className:"react-flow__minimap-mask",d:`M${N-F},${G-F}h${X+F*2}v${J+F*2}h${-X-F*2}z - M${R.x},${R.y}h${R.width}v${R.height}h${-R.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}h_.displayName="MiniMap";const c4=P.memo(h_),f4=e=>n=>e?`${Math.max(1/n.transform[2],1)}`:void 0,d4={[ha.Line]:"right",[ha.Handle]:"bottom-right"};function h4({nodeId:e,position:n,variant:r=ha.Handle,className:l,style:a=void 0,children:s,color:u,minWidth:c=10,minHeight:d=10,maxWidth:h=Number.MAX_VALUE,maxHeight:m=Number.MAX_VALUE,keepAspectRatio:p=!1,resizeDirection:x,autoScale:v=!0,shouldResize:w,onResizeStart:k,onResize:_,onResizeEnd:S}){const T=GS(),E=typeof e=="string"?e:T,A=mt(),U=P.useRef(null),z=r===ha.Handle,H=$e(P.useCallback(f4(z&&v),[z,v]),pt),R=P.useRef(null),V=n??d4[r];P.useEffect(()=>{if(!(!U.current||!E))return R.current||(R.current=Oz({domNode:U.current,nodeId:E,getStoreItems:()=>{const{nodeLookup:L,transform:q,snapGrid:ee,snapToGrid:B,nodeOrigin:$,domNode:M}=A.getState();return{nodeLookup:L,transform:q,snapGrid:ee,snapToGrid:B,nodeOrigin:$,paneDomNode:M}},onChange:(L,q)=>{const{triggerNodeChanges:ee,nodeLookup:B,parentLookup:$,nodeOrigin:M}=A.getState(),Y=[],Q={x:L.x,y:L.y},K=B.get(E);if(K&&K.expandParent&&K.parentId){const j=K.origin??M,I=L.width??K.measured.width??0,F=L.height??K.measured.height??0,N={id:K.id,parentId:K.parentId,rect:{width:I,height:F,...mS({x:L.x??K.position.x,y:L.y??K.position.y},{width:I,height:F},K.parentId,B,j)}},G=Dm([N],B,$,M);Y.push(...G),Q.x=L.x?Math.max(j[0]*I,L.x):void 0,Q.y=L.y?Math.max(j[1]*F,L.y):void 0}if(Q.x!==void 0&&Q.y!==void 0){const j={id:E,type:"position",position:{...Q}};Y.push(j)}if(L.width!==void 0&&L.height!==void 0){const I={id:E,type:"dimensions",resizing:!0,setAttributes:x?x==="horizontal"?"width":"height":!0,dimensions:{width:L.width,height:L.height}};Y.push(I)}for(const j of q){const I={...j,type:"position"};Y.push(I)}ee(Y)},onEnd:({width:L,height:q})=>{const ee={id:E,type:"dimensions",resizing:!1,dimensions:{width:L,height:q}};A.getState().triggerNodeChanges([ee])}})),R.current.update({controlPosition:V,boundaries:{minWidth:c,minHeight:d,maxWidth:h,maxHeight:m},keepAspectRatio:p,resizeDirection:x,onResizeStart:k,onResize:_,onResizeEnd:S,shouldResize:w}),()=>{var L;(L=R.current)==null||L.destroy()}},[V,c,d,h,m,p,k,_,S,w]);const O=V.split("-");return b.jsx("div",{className:zt(["react-flow__resize-control","nodrag",...O,r,l]),ref:U,style:{...a,scale:H,...u&&{[z?"backgroundColor":"borderColor"]:u}},children:s})}P.memo(h4);function rs(e,n){if(n.length===0)return null;let r=e[n[0]];for(let l=1;ll.viewContextPath),n=he(l=>l.nodes),r=he(l=>l.subworkflowContexts);return P.useMemo(()=>{var l;return e.length===0?n:((l=rs(r,e))==null?void 0:l.nodes)??n},[e,n,r])}function p4(){const e=he(l=>l.viewContextPath),n=he(l=>l.groupProgress),r=he(l=>l.subworkflowContexts);return P.useMemo(()=>{var l;return e.length===0?n:((l=rs(r,e))==null?void 0:l.groupProgress)??n},[e,n,r])}function m4(){const e=he(l=>l.viewContextPath),n=he(l=>l.highlightedEdges),r=he(l=>l.subworkflowContexts);return P.useMemo(()=>{var l;return e.length===0?n:((l=rs(r,e))==null?void 0:l.highlightedEdges)??n},[e,n,r])}function p_(){const e=he(r=>r.viewContextPath),n=he(r=>r.subworkflowContexts);return P.useMemo(()=>{var r;return e.length===0?n:((r=rs(n,e))==null?void 0:r.children)??[]},[e,n])}function g4(){const e=he(h=>h.viewContextPath),n=he(h=>h.agents),r=he(h=>h.routes),l=he(h=>h.parallelGroups),a=he(h=>h.forEachGroups),s=he(h=>h.nodes),u=he(h=>h.groupProgress),c=he(h=>h.entryPoint),d=he(h=>h.subworkflowContexts);return P.useMemo(()=>{if(e.length===0)return{agents:n,routes:r,parallelGroups:l,forEachGroups:a,nodes:s,groupProgress:u,entryPoint:c,subworkflowContexts:d};const h=rs(d,e);return h?{agents:h.agents,routes:h.routes,parallelGroups:h.parallelGroups,forEachGroups:h.forEachGroups,nodes:h.nodes,groupProgress:h.groupProgress,entryPoint:h.entryPoint,subworkflowContexts:h.children}:{agents:n,routes:r,parallelGroups:l,forEachGroups:a,nodes:s,groupProgress:u,entryPoint:c,subworkflowContexts:d}},[e,n,r,l,a,s,u,c,d])}function x4(){const e=new URLSearchParams(window.location.search);return{subworkflowPath:e.get("subworkflow"),agent:e.get("agent")}}function y4(e,n){const r=[];let l=e;for(const a of n){const s=l.findIndex(u=>u.parentAgent===a);if(s===-1)return{path:r,failedSegment:a};r.push(s),l=l[s].children}return{path:r,failedSegment:null}}function v4(){const[e,n]=P.useState(null),r=P.useRef(!1),{fitView:l}=ma(),{subworkflowPath:a,agent:s}=x4(),u=!!(a||s);return P.useEffect(()=>{if(r.current||!u)return;const c=he.subscribe(h=>{if(!r.current&&h.agents.length!==0){if(r.current=!0,c(),a){const m=a.split("/").filter(Boolean),{path:p,failedSegment:x}=y4(h.subworkflowContexts,m);if(x){const v=m.slice(0,p.length).join("/");n({message:`Subworkflow "${x}" not found${v?` (resolved: ${v})`:""}. It may not have started yet.`});return}he.setState({viewContextPath:p,selectedNode:null})}if(s){const m=he.getState();let p;if(m.viewContextPath.length===0)p=m.agents;else{let v,w=m.subworkflowContexts;for(const k of m.viewContextPath){if(v=w[k],!v)break;w=v.children}p=(v==null?void 0:v.agents)??[]}if(!p.some(v=>v.name===s)){n({message:`Agent "${s}" not found in ${a||"root workflow"}.`});return}he.setState({selectedNode:s}),setTimeout(()=>{l({nodes:[{id:s}],padding:.5,duration:400})},200)}}});return he.getState().agents.length>0&&!r.current&&he.setState({}),c},[u,a,s,l]),e}var kh,d1;function Om(){if(d1)return kh;d1=1;var e="\0",n="\0",r="";class l{constructor(m){Ct(this,"_isDirected",!0);Ct(this,"_isMultigraph",!1);Ct(this,"_isCompound",!1);Ct(this,"_label");Ct(this,"_defaultNodeLabelFn",()=>{});Ct(this,"_defaultEdgeLabelFn",()=>{});Ct(this,"_nodes",{});Ct(this,"_in",{});Ct(this,"_preds",{});Ct(this,"_out",{});Ct(this,"_sucs",{});Ct(this,"_edgeObjs",{});Ct(this,"_edgeLabels",{});Ct(this,"_nodeCount",0);Ct(this,"_edgeCount",0);Ct(this,"_parent");Ct(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 x=arguments,v=this;return m.forEach(function(w){x.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 x=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(x),delete this._in[m],delete this._preds[m],Object.keys(this._out[m]).forEach(x),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 x=p;x!==void 0;x=this.parent(x))if(x===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 x of this.successors(m))v.add(x);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 x=this;Object.entries(this._nodes).forEach(function([k,_]){m(k)&&p.setNode(k,_)}),Object.values(this._edgeObjs).forEach(function(k){p.hasNode(k.v)&&p.hasNode(k.w)&&p.setEdge(k,x.edge(k))});var v={};function w(k){var _=x.parent(k);return _===void 0||p.hasNode(_)?(v[k]=_,_):_ in v?v[_]:w(_)}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 x=this,v=arguments;return m.reduce(function(w,k){return v.length>1?x.setEdge(w,k,p):x.setEdge(w,k),k}),this}setEdge(){var m,p,x,v,w=!1,k=arguments[0];typeof k=="object"&&k!==null&&"v"in k?(m=k.v,p=k.w,x=k.name,arguments.length===2&&(v=arguments[1],w=!0)):(m=k,p=arguments[1],x=arguments[3],arguments.length>2&&(v=arguments[2],w=!0)),m=""+m,p=""+p,x!==void 0&&(x=""+x);var _=u(this._isDirected,m,p,x);if(Object.hasOwn(this._edgeLabels,_))return w&&(this._edgeLabels[_]=v),this;if(x!==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,x);var S=c(this._isDirected,m,p,x);return m=S.v,p=S.w,Object.freeze(S),this._edgeObjs[_]=S,a(this._preds[p],m),a(this._sucs[m],p),this._in[p][_]=S,this._out[m][_]=S,this._edgeCount++,this}edge(m,p,x){var v=arguments.length===1?d(this._isDirected,arguments[0]):u(this._isDirected,m,p,x);return this._edgeLabels[v]}edgeAsObj(){const m=this.edge(...arguments);return typeof m!="object"?{label:m}:m}hasEdge(m,p,x){var v=arguments.length===1?d(this._isDirected,arguments[0]):u(this._isDirected,m,p,x);return Object.hasOwn(this._edgeLabels,v)}removeEdge(m,p,x){var v=arguments.length===1?d(this._isDirected,arguments[0]):u(this._isDirected,m,p,x),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 x=this._in[m];if(x){var v=Object.values(x);return p?v.filter(w=>w.v===p):v}}outEdges(m,p){var x=this._out[m];if(x){var v=Object.values(x);return p?v.filter(w=>w.w===p):v}}nodeEdges(m,p){var x=this.inEdges(m,p);if(x)return x.concat(this.outEdges(m,p))}}function a(h,m){h[m]?h[m]++:h[m]=1}function s(h,m){--h[m]||delete h[m]}function u(h,m,p,x){var v=""+m,w=""+p;if(!h&&v>w){var k=v;v=w,w=k}return v+r+w+r+(x===void 0?e:x)}function c(h,m,p,x){var v=""+m,w=""+p;if(!h&&v>w){var k=v;v=w,w=k}var _={v,w};return x&&(_.name=x),_}function d(h,m){return u(h,m.v,m.w,m.name)}return kh=l,kh}var Nh,h1;function b4(){return h1||(h1=1,Nh="2.2.4"),Nh}var Ch,p1;function w4(){return p1||(p1=1,Ch={Graph:Om(),version:b4()}),Ch}var Th,m1;function S4(){if(m1)return Th;m1=1;var e=Om();Th={write:n,read:a};function n(s){var u={options:{directed:s.isDirected(),multigraph:s.isMultigraph(),compound:s.isCompound()},nodes:r(s),edges:l(s)};return s.graph()!==void 0&&(u.value=structuredClone(s.graph())),u}function r(s){return s.nodes().map(function(u){var c=s.node(u),d=s.parent(u),h={v:u};return c!==void 0&&(h.value=c),d!==void 0&&(h.parent=d),h})}function l(s){return s.edges().map(function(u){var c=s.edge(u),d={v:u.v,w:u.w};return u.name!==void 0&&(d.name=u.name),c!==void 0&&(d.value=c),d})}function a(s){var u=new e(s.options).setGraph(s.value);return s.nodes.forEach(function(c){u.setNode(c.v,c.value),c.parent&&u.setParent(c.v,c.parent)}),s.edges.forEach(function(c){u.setEdge({v:c.v,w:c.w,name:c.name},c.value)}),u}return Th}var Ah,g1;function _4(){if(g1)return Ah;g1=1,Ah=e;function e(n){var r={},l=[],a;function s(u){Object.hasOwn(r,u)||(r[u]=!0,a.push(u),n.successors(u).forEach(s),n.predecessors(u).forEach(s))}return n.nodes().forEach(function(u){a=[],s(u),a.length&&l.push(a)}),l}return Ah}var zh,x1;function m_(){if(x1)return zh;x1=1;class e{constructor(){Ct(this,"_arr",[]);Ct(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(r){return r.key})}has(r){return Object.hasOwn(this._keyIndices,r)}priority(r){var l=this._keyIndices[r];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(r,l){var a=this._keyIndices;if(r=String(r),!Object.hasOwn(a,r)){var s=this._arr,u=s.length;return a[r]=u,s.push({key:r,priority:l}),this._decrease(u),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key}decrease(r,l){var a=this._keyIndices[r];if(l>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[a].priority+" New: "+l);this._arr[a].priority=l,this._decrease(a)}_heapify(r){var l=this._arr,a=2*r,s=a+1,u=r;a>1,!(l[s].priority1;function r(a,s,u,c){return l(a,String(s),u||n,c||function(d){return a.outEdges(d)})}function l(a,s,u,c){var d={},h=new e,m,p,x=function(v){var w=v.v!==m?v.v:v.w,k=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);)c(m).forEach(x);return d}return Mh}var jh,v1;function E4(){if(v1)return jh;v1=1;var e=g_();jh=n;function n(r,l,a){return r.nodes().reduce(function(s,u){return s[u]=e(r,u,l,a),s},{})}return jh}var Dh,b1;function x_(){if(b1)return Dh;b1=1,Dh=e;function e(n){var r=0,l=[],a={},s=[];function u(c){var d=a[c]={onStack:!0,lowlink:r,index:r++};if(l.push(c),n.successors(c).forEach(function(p){Object.hasOwn(a,p)?a[p].onStack&&(d.lowlink=Math.min(d.lowlink,a[p].index)):(u(p),d.lowlink=Math.min(d.lowlink,a[p].lowlink))}),d.lowlink===d.index){var h=[],m;do m=l.pop(),a[m].onStack=!1,h.push(m);while(c!==m);s.push(h)}}return n.nodes().forEach(function(c){Object.hasOwn(a,c)||u(c)}),s}return Dh}var Rh,w1;function k4(){if(w1)return Rh;w1=1;var e=x_();Rh=n;function n(r){return e(r).filter(function(l){return l.length>1||l.length===1&&r.hasEdge(l[0],l[0])})}return Rh}var Oh,S1;function N4(){if(S1)return Oh;S1=1,Oh=n;var e=()=>1;function n(l,a,s){return r(l,a||e,s||function(u){return l.outEdges(u)})}function r(l,a,s){var u={},c=l.nodes();return c.forEach(function(d){u[d]={},u[d][d]={distance:0},c.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=a(h);u[d][m]={distance:p,predecessor:d}})}),c.forEach(function(d){var h=u[d];c.forEach(function(m){var p=u[m];c.forEach(function(x){var v=p[d],w=h[x],k=p[x],_=v.distance+w.distance;_a.successors(p):p=>a.neighbors(p),d=u==="post"?n:r,h=[],m={};return s.forEach(p=>{if(!a.hasNode(p))throw new Error("Graph does not have node: "+p);d(p,c,m,h)}),h}function n(a,s,u,c){for(var d=[[a,!1]];d.length>0;){var h=d.pop();h[1]?c.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 r(a,s,u,c){for(var d=[a];d.length>0;){var h=d.pop();Object.hasOwn(u,h)||(u[h]=!0,c.push(h),l(s(h),m=>d.push(m)))}}function l(a,s){for(var u=a.length;u--;)s(a[u],u,a);return a}return Bh}var Ih,N1;function T4(){if(N1)return Ih;N1=1;var e=v_();Ih=n;function n(r,l){return e(r,l,"post")}return Ih}var qh,C1;function A4(){if(C1)return qh;C1=1;var e=v_();qh=n;function n(r,l){return e(r,l,"pre")}return qh}var Uh,T1;function z4(){if(T1)return Uh;T1=1;var e=Om(),n=m_();Uh=r;function r(l,a){var s=new e,u={},c=new n,d;function h(p){var x=p.v===d?p.w:p.v,v=c.priority(x);if(v!==void 0){var w=a(p);w0;){if(d=c.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 Uh}var Vh,A1;function M4(){return A1||(A1=1,Vh={components:_4(),dijkstra:g_(),dijkstraAll:E4(),findCycles:k4(),floydWarshall:N4(),isAcyclic:C4(),postorder:T4(),preorder:A4(),prim:z4(),tarjan:x_(),topsort:y_()}),Vh}var Ph,z1;function Fn(){if(z1)return Ph;z1=1;var e=w4();return Ph={Graph:e.Graph,json:S4(),alg:M4(),version:e.version},Ph}var $h,M1;function j4(){if(M1)return $h;M1=1;class e{constructor(){let a={};a._next=a._prev=a,this._sentinel=a}dequeue(){let a=this._sentinel,s=a._prev;if(s!==a)return n(s),s}enqueue(a){let s=this._sentinel;a._prev&&a._next&&n(a),a._next=s._next,s._next._prev=a,s._next=a,a._prev=s}toString(){let a=[],s=this._sentinel,u=s._prev;for(;u!==s;)a.push(JSON.stringify(u,r)),u=u._prev;return"["+a.join(", ")+"]"}}function n(l){l._prev._next=l._next,l._next._prev=l._prev,delete l._next,delete l._prev}function r(l,a){if(l!=="_next"&&l!=="_prev")return a}return $h=e,$h}var Gh,j1;function D4(){if(j1)return Gh;j1=1;let e=Fn().Graph,n=j4();Gh=l;let r=()=>1;function l(h,m){if(h.nodeCount()<=1)return[];let p=u(h,m||r);return a(p.graph,p.buckets,p.zeroIdx).flatMap(v=>h.outEdges(v.v,v.w))}function a(h,m,p){let x=[],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 _=m.length-2;_>0;--_)if(k=m[_].dequeue(),k){x=x.concat(s(h,m,p,k,!0));break}}}return x}function s(h,m,p,x,v){let w=v?[]:void 0;return h.inEdges(x.v).forEach(k=>{let _=h.edge(k),S=h.node(k.v);v&&w.push({v:k.v,w:k.w}),S.out-=_,c(m,p,S)}),h.outEdges(x.v).forEach(k=>{let _=h.edge(k),S=k.w,T=h.node(S);T.in-=_,c(m,p,T)}),h.removeNode(x.v),w}function u(h,m){let p=new e,x=0,v=0;h.nodes().forEach(_=>{p.setNode(_,{v:_,in:0,out:0})}),h.edges().forEach(_=>{let S=p.edge(_.v,_.w)||0,T=m(_),E=S+T;p.setEdge(_.v,_.w,E),v=Math.max(v,p.node(_.v).out+=T),x=Math.max(x,p.node(_.w).in+=T)});let w=d(v+x+3).map(()=>new n),k=x+1;return p.nodes().forEach(_=>{c(w,k,p.node(_))}),{graph:p,buckets:w,zeroIdx:k}}function c(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;pV.setNode(O,R.node(O))),R.edges().forEach(O=>{let L=V.edge(O.v,O.w)||{weight:0,minlen:1},q=R.edge(O);V.setEdge(O.v,O.w,{weight:L.weight+q.weight,minlen:Math.max(L.minlen,q.minlen)})}),V}function l(R){let V=new e({multigraph:R.isMultigraph()}).setGraph(R.graph());return R.nodes().forEach(O=>{R.children(O).length||V.setNode(O,R.node(O))}),R.edges().forEach(O=>{V.setEdge(O,R.edge(O))}),V}function a(R){let V=R.nodes().map(O=>{let L={};return R.outEdges(O).forEach(q=>{L[q.w]=(L[q.w]||0)+R.edge(q).weight}),L});return H(R.nodes(),V)}function s(R){let V=R.nodes().map(O=>{let L={};return R.inEdges(O).forEach(q=>{L[q.v]=(L[q.v]||0)+R.edge(q).weight}),L});return H(R.nodes(),V)}function u(R,V){let O=R.x,L=R.y,q=V.x-O,ee=V.y-L,B=R.width/2,$=R.height/2;if(!q&&!ee)throw new Error("Not possible to find intersection inside of the rectangle");let M,Y;return Math.abs(ee)*B>Math.abs(q)*$?(ee<0&&($=-$),M=$*q/ee,Y=$):(q<0&&(B=-B),M=B,Y=B*ee/q),{x:O+M,y:L+Y}}function c(R){let V=A(w(R)+1).map(()=>[]);return R.nodes().forEach(O=>{let L=R.node(O),q=L.rank;q!==void 0&&(V[q][L.order]=O)}),V}function d(R){let V=R.nodes().map(L=>{let q=R.node(L).rank;return q===void 0?Number.MAX_VALUE:q}),O=v(Math.min,V);R.nodes().forEach(L=>{let q=R.node(L);Object.hasOwn(q,"rank")&&(q.rank-=O)})}function h(R){let V=R.nodes().map(B=>R.node(B).rank),O=v(Math.min,V),L=[];R.nodes().forEach(B=>{let $=R.node(B).rank-O;L[$]||(L[$]=[]),L[$].push(B)});let q=0,ee=R.graph().nodeRankFactor;Array.from(L).forEach((B,$)=>{B===void 0&&$%ee!==0?--q:B!==void 0&&q&&B.forEach(M=>R.node(M).rank+=q)})}function m(R,V,O,L){let q={width:0,height:0};return arguments.length>=4&&(q.rank=O,q.order=L),n(R,"border",q,V)}function p(R,V=x){const O=[];for(let L=0;Lx){const O=p(V);return R.apply(null,O.map(L=>R.apply(null,L)))}else return R.apply(null,V)}function w(R){const O=R.nodes().map(L=>{let q=R.node(L).rank;return q===void 0?Number.MIN_VALUE:q});return v(Math.max,O)}function k(R,V){let O={lhs:[],rhs:[]};return R.forEach(L=>{V(L)?O.lhs.push(L):O.rhs.push(L)}),O}function _(R,V){let O=Date.now();try{return V()}finally{console.log(R+" time: "+(Date.now()-O)+"ms")}}function S(R,V){return V()}let T=0;function E(R){var V=++T;return R+(""+V)}function A(R,V,O=1){V==null&&(V=R,R=0);let L=ee=>eeVL[V]),Object.entries(R).reduce((L,[q,ee])=>(L[q]=O(ee,q),L),{})}function H(R,V){return R.reduce((O,L,q)=>(O[L]=V[q],O),{})}return Yh}var Fh,R1;function R4(){if(R1)return Fh;R1=1;let e=D4(),n=At().uniqueId;Fh={run:r,undo:a};function r(s){(s.graph().acyclicer==="greedy"?e(s,c(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 c(d){return h=>d.edge(h).weight}}function l(s){let u=[],c={},d={};function h(m){Object.hasOwn(d,m)||(d[m]=!0,c[m]=!0,s.outEdges(m).forEach(p=>{Object.hasOwn(c,p.w)?u.push(p):h(p.w)}),delete c[m])}return s.nodes().forEach(h),u}function a(s){s.edges().forEach(u=>{let c=s.edge(u);if(c.reversed){s.removeEdge(u);let d=c.forwardName;delete c.reversed,delete c.forwardName,s.setEdge(u.w,u.v,c,d)}})}return Fh}var Xh,O1;function O4(){if(O1)return Xh;O1=1;let e=At();Xh={run:n,undo:l};function n(a){a.graph().dummyChains=[],a.edges().forEach(s=>r(a,s))}function r(a,s){let u=s.v,c=a.node(u).rank,d=s.w,h=a.node(d).rank,m=s.name,p=a.edge(s),x=p.labelRank;if(h===c+1)return;a.removeEdge(s);let v,w,k;for(k=0,++c;c{let u=a.node(s),c=u.edgeLabel,d;for(a.setEdge(u.edgeObj,c);u.dummy;)d=a.successors(s)[0],a.removeNode(s),c.points.push({x:u.x,y:u.y}),u.dummy==="edge-label"&&(c.x=u.x,c.y=u.y,c.width=u.width,c.height=u.height),s=d,u=a.node(s)})}return Xh}var Qh,L1;function gc(){if(L1)return Qh;L1=1;const{applyWithChunking:e}=At();Qh={longestPath:n,slack:r};function n(l){var a={};function s(u){var c=l.node(u);if(Object.hasOwn(a,u))return c.rank;a[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),c.rank=h}l.sources().forEach(s)}function r(l,a){return l.node(a.w).rank-l.node(a.v).rank-l.edge(a).minlen}return Qh}var Zh,H1;function b_(){if(H1)return Zh;H1=1;var e=Fn().Graph,n=gc().slack;Zh=r;function r(u){var c=new e({directed:!1}),d=u.nodes()[0],h=u.nodeCount();c.setNode(d,{});for(var m,p;l(c,u){var p=m.v,x=h===p?m.w:p;!u.hasNode(x)&&!n(c,m)&&(u.setNode(x,{}),u.setEdge(h,x,{}),d(x))})}return u.nodes().forEach(d),u.nodeCount()}function a(u,c){return c.edges().reduce((h,m)=>{let p=Number.POSITIVE_INFINITY;return u.hasNode(m.v)!==u.hasNode(m.w)&&(p=n(c,m)),pc.node(h).rank+=d)}return Zh}var Kh,B1;function L4(){if(B1)return Kh;B1=1;var e=b_(),n=gc().slack,r=gc().longestPath,l=Fn().alg.preorder,a=Fn().alg.postorder,s=At().simplify;Kh=u,u.initLowLimValues=m,u.initCutValues=c,u.calcCutValue=h,u.leaveEdge=x,u.enterEdge=v,u.exchangeEdges=w;function u(T){T=s(T),r(T);var E=e(T);m(E),c(E,T);for(var A,U;A=x(E);)U=v(E,T,A),w(E,T,A,U)}function c(T,E){var A=a(T,T.nodes());A=A.slice(0,A.length-1),A.forEach(U=>d(T,E,U))}function d(T,E,A){var U=T.node(A),z=U.parent;T.edge(A,z).cutvalue=h(T,E,A)}function h(T,E,A){var U=T.node(A),z=U.parent,H=!0,R=E.edge(A,z),V=0;return R||(H=!1,R=E.edge(z,A)),V=R.weight,E.nodeEdges(A).forEach(O=>{var L=O.v===A,q=L?O.w:O.v;if(q!==z){var ee=L===H,B=E.edge(O).weight;if(V+=ee?B:-B,_(T,A,q)){var $=T.edge(A,q).cutvalue;V+=ee?-$:$}}}),V}function m(T,E){arguments.length<2&&(E=T.nodes()[0]),p(T,{},1,E)}function p(T,E,A,U,z){var H=A,R=T.node(U);return E[U]=!0,T.neighbors(U).forEach(V=>{Object.hasOwn(E,V)||(A=p(T,E,A,V,U))}),R.low=H,R.lim=A++,z?R.parent=z:delete R.parent,A}function x(T){return T.edges().find(E=>T.edge(E).cutvalue<0)}function v(T,E,A){var U=A.v,z=A.w;E.hasEdge(U,z)||(U=A.w,z=A.v);var H=T.node(U),R=T.node(z),V=H,O=!1;H.lim>R.lim&&(V=R,O=!0);var L=E.edges().filter(q=>O===S(T,T.node(q.v),V)&&O!==S(T,T.node(q.w),V));return L.reduce((q,ee)=>n(E,ee)!E.node(z).parent),U=l(T,A);U=U.slice(1),U.forEach(z=>{var H=T.node(z).parent,R=E.edge(z,H),V=!1;R||(R=E.edge(H,z),V=!0),E.node(z).rank=E.node(H).rank+(V?R.minlen:-R.minlen)})}function _(T,E,A){return T.hasEdge(E,A)}function S(T,E,A){return A.low<=E.lim&&E.lim<=A.lim}return Kh}var Jh,I1;function H4(){if(I1)return Jh;I1=1;var e=gc(),n=e.longestPath,r=b_(),l=L4();Jh=a;function a(d){var h=d.graph().ranker;if(h instanceof Function)return h(d);switch(d.graph().ranker){case"network-simplex":c(d);break;case"tight-tree":u(d);break;case"longest-path":s(d);break;case"none":break;default:c(d)}}var s=n;function u(d){n(d),r(d)}function c(d){l(d)}return Jh}var Wh,q1;function B4(){if(q1)return Wh;q1=1,Wh=e;function e(l){let a=r(l);l.graph().dummyChains.forEach(s=>{let u=l.node(s),c=u.edgeObj,d=n(l,a,c.v,c.w),h=d.path,m=d.lca,p=0,x=h[p],v=!0;for(;s!==c.w;){if(u=l.node(s),v){for(;(x=h[p])!==m&&l.node(x).maxRankh||m>a[p].lim));for(x=p,p=u;(p=l.parent(p))!==x;)d.push(p);return{path:c.concat(d.reverse()),lca:x}}function r(l){let a={},s=0;function u(c){let d=s;l.children(c).forEach(u),a[c]={low:d,lim:s++}}return l.children().forEach(u),a}return Wh}var ep,U1;function I4(){if(U1)return ep;U1=1;let e=At();ep={run:n,cleanup:s};function n(u){let c=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=c,u.edges().forEach(v=>u.edge(v).minlen*=p);let x=a(u)+1;u.children().forEach(v=>r(u,c,p,x,m,d,v)),u.graph().nodeRankFactor=p}function r(u,c,d,h,m,p,x){let v=u.children(x);if(!v.length){x!==c&&u.setEdge(c,x,{weight:0,minlen:d});return}let w=e.addBorderNode(u,"_bt"),k=e.addBorderNode(u,"_bb"),_=u.node(x);u.setParent(w,x),_.borderTop=w,u.setParent(k,x),_.borderBottom=k,v.forEach(S=>{r(u,c,d,h,m,p,S);let T=u.node(S),E=T.borderTop?T.borderTop:S,A=T.borderBottom?T.borderBottom:S,U=T.borderTop?h:2*h,z=E!==A?1:m-p[x]+1;u.setEdge(w,E,{weight:U,minlen:z,nestingEdge:!0}),u.setEdge(A,k,{weight:U,minlen:z,nestingEdge:!0})}),u.parent(x)||u.setEdge(c,w,{weight:0,minlen:m+p[x]})}function l(u){var c={};function d(h,m){var p=u.children(h);p&&p.length&&p.forEach(x=>d(x,m+1)),c[h]=m}return u.children().forEach(h=>d(h,1)),c}function a(u){return u.edges().reduce((c,d)=>c+u.edge(d).weight,0)}function s(u){var c=u.graph();u.removeNode(c.nestingRoot),delete c.nestingRoot,u.edges().forEach(d=>{var h=u.edge(d);h.nestingEdge&&u.removeEdge(d)})}return ep}var tp,V1;function q4(){if(V1)return tp;V1=1;let e=At();tp=n;function n(l){function a(s){let u=l.children(s),c=l.node(s);if(u.length&&u.forEach(a),Object.hasOwn(c,"minRank")){c.borderLeft=[],c.borderRight=[];for(let d=c.minRank,h=c.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 a(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=>c(d.node(h))),d.edges().forEach(h=>{let m=d.edge(h);m.points.forEach(c),Object.hasOwn(m,"x")&&c(m)})}function c(d){let h=d.x;d.x=d.y,d.y=h}return np}var rp,$1;function V4(){if($1)return rp;$1=1;let e=At();rp=n;function n(r){let l={},a=r.nodes().filter(m=>!r.children(m).length),s=a.map(m=>r.node(m).rank),u=e.applyWithChunking(Math.max,s),c=e.range(u+1).map(()=>[]);function d(m){if(l[m])return;l[m]=!0;let p=r.node(m);c[p.rank].push(m),r.successors(m).forEach(d)}return a.sort((m,p)=>r.node(m).rank-r.node(p).rank).forEach(d),c}return rp}var ip,G1;function P4(){if(G1)return ip;G1=1;let e=At().zipObject;ip=n;function n(l,a){let s=0;for(let u=1;uv)),c=a.flatMap(x=>l.outEdges(x).map(v=>({pos:u[v.w],weight:l.edge(v).weight})).sort((v,w)=>v.pos-w.pos)),d=1;for(;d{let v=x.pos+d;m[v]+=x.weight;let w=0;for(;v>0;)v%2&&(w+=m[v+1]),v=v-1>>1,m[v]+=x.weight;p+=x.weight*w}),p}return ip}var lp,Y1;function $4(){if(Y1)return lp;Y1=1,lp=e;function e(n,r=[]){return r.map(l=>{let a=n.inEdges(l);if(a.length){let s=a.reduce((u,c)=>{let d=n.edge(c),h=n.node(c.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 lp}var ap,F1;function G4(){if(F1)return ap;F1=1;let e=At();ap=n;function n(a,s){let u={};a.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 c=Object.values(u).filter(d=>!d.indegree);return r(c)}function r(a){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 c(d){return h=>{h.in.push(d),--h.indegree===0&&a.push(h)}}for(;a.length;){let d=a.pop();s.push(d),d.in.reverse().forEach(u(d)),d.out.forEach(c(d))}return s.filter(d=>!d.merged).map(d=>e.pick(d,["vs","i","barycenter","weight"]))}function l(a,s){let u=0,c=0;a.weight&&(u+=a.barycenter*a.weight,c+=a.weight),s.weight&&(u+=s.barycenter*s.weight,c+=s.weight),a.vs=s.vs.concat(a.vs),a.barycenter=u/c,a.weight=c,a.i=Math.min(s.i,a.i),s.merged=!0}return ap}var op,X1;function Y4(){if(X1)return op;X1=1;let e=At();op=n;function n(a,s){let u=e.partition(a,w=>Object.hasOwn(w,"barycenter")),c=u.lhs,d=u.rhs.sort((w,k)=>k.i-w.i),h=[],m=0,p=0,x=0;c.sort(l(!!s)),x=r(h,d,x),c.forEach(w=>{x+=w.vs.length,h.push(w.vs),m+=w.barycenter*w.weight,p+=w.weight,x=r(h,d,x)});let v={vs:h.flat(!0)};return p&&(v.barycenter=m/p,v.weight=p),v}function r(a,s,u){let c;for(;s.length&&(c=s[s.length-1]).i<=u;)s.pop(),a.push(c.vs),u++;return u}function l(a){return(s,u)=>s.barycenteru.barycenter?1:a?u.i-s.i:s.i-u.i}return op}var sp,Q1;function F4(){if(Q1)return sp;Q1=1;let e=$4(),n=G4(),r=Y4();sp=l;function l(u,c,d,h){let m=u.children(c),p=u.node(c),x=p?p.borderLeft:void 0,v=p?p.borderRight:void 0,w={};x&&(m=m.filter(T=>T!==x&&T!==v));let k=e(u,m);k.forEach(T=>{if(u.children(T.v).length){let E=l(u,T.v,d,h);w[T.v]=E,Object.hasOwn(E,"barycenter")&&s(T,E)}});let _=n(k,d);a(_,w);let S=r(_,h);if(x&&(S.vs=[x,S.vs,v].flat(!0),u.predecessors(x).length)){let T=u.node(u.predecessors(x)[0]),E=u.node(u.predecessors(v)[0]);Object.hasOwn(S,"barycenter")||(S.barycenter=0,S.weight=0),S.barycenter=(S.barycenter*S.weight+T.order+E.order)/(S.weight+2),S.weight+=2}return S}function a(u,c){u.forEach(d=>{d.vs=d.vs.flatMap(h=>c[h]?c[h].vs:h)})}function s(u,c){u.barycenter!==void 0?(u.barycenter=(u.barycenter*u.weight+c.barycenter*c.weight)/(u.weight+c.weight),u.weight+=c.weight):(u.barycenter=c.barycenter,u.weight=c.weight)}return sp}var up,Z1;function X4(){if(Z1)return up;Z1=1;let e=Fn().Graph,n=At();up=r;function r(a,s,u,c){c||(c=a.nodes());let d=l(a),h=new e({compound:!0}).setGraph({root:d}).setDefaultNodeLabel(m=>a.node(m));return c.forEach(m=>{let p=a.node(m),x=a.parent(m);(p.rank===s||p.minRank<=s&&s<=p.maxRank)&&(h.setNode(m),h.setParent(m,x||d),a[u](m).forEach(v=>{let w=v.v===m?v.w:v.v,k=h.edge(w,m),_=k!==void 0?k.weight:0;h.setEdge(w,m,{weight:a.edge(v).weight+_})}),Object.hasOwn(p,"minRank")&&h.setNode(m,{borderLeft:p.borderLeft[s],borderRight:p.borderRight[s]}))}),h}function l(a){for(var s;a.hasNode(s=n.uniqueId("_root")););return s}return up}var cp,K1;function Q4(){if(K1)return cp;K1=1,cp=e;function e(n,r,l){let a={},s;l.forEach(u=>{let c=n.parent(u),d,h;for(;c;){if(d=n.parent(c),d?(h=a[d],a[d]=c):(h=s,s=c),h&&h!==c){r.setEdge(h,c);return}c=d}})}return cp}var fp,J1;function Z4(){if(J1)return fp;J1=1;let e=V4(),n=P4(),r=F4(),l=X4(),a=Q4(),s=Fn().Graph,u=At();fp=c;function c(p,x){if(x&&typeof x.customOrder=="function"){x.customOrder(p,c);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"),_=e(p);if(m(p,_),x&&x.disableOptimalOrderHeuristic)return;let S=Number.POSITIVE_INFINITY,T;for(let E=0,A=0;A<4;++E,++A){h(E%2?w:k,E%4>=2),_=u.buildLayerMatrix(p);let U=n(p,_);U{w.has(_)||w.set(_,[]),w.get(_).push(S)};for(const _ of p.nodes()){const S=p.node(_);if(typeof S.rank=="number"&&k(S.rank,_),typeof S.minRank=="number"&&typeof S.maxRank=="number")for(let T=S.minRank;T<=S.maxRank;T++)T!==S.rank&&k(T,_)}return x.map(function(_){return l(p,_,v,w.get(_)||[])})}function h(p,x){let v=new s;p.forEach(function(w){let k=w.graph().root,_=r(w,k,v,x);_.vs.forEach((S,T)=>w.node(S).order=T),a(w,v,_.vs)})}function m(p,x){Object.values(x).forEach(v=>v.forEach((w,k)=>p.node(w).order=k))}return fp}var dp,W1;function K4(){if(W1)return dp;W1=1;let e=Fn().Graph,n=At();dp={positionX:v,findType1Conflicts:r,findType2Conflicts:l,addConflict:s,hasConflict:u,verticalAlignment:c,horizontalCompaction:d,alignCoordinates:p,findSmallestWidthAlignment:m,balance:x};function r(_,S){let T={};function E(A,U){let z=0,H=0,R=A.length,V=U[U.length-1];return U.forEach((O,L)=>{let q=a(_,O),ee=q?_.node(q).order:R;(q||O===V)&&(U.slice(H,L+1).forEach(B=>{_.predecessors(B).forEach($=>{let M=_.node($),Y=M.order;(Y{O=U[L],_.node(O).dummy&&_.predecessors(O).forEach(q=>{let ee=_.node(q);ee.dummy&&(ee.orderV)&&s(T,q,O)})})}function A(U,z){let H=-1,R,V=0;return z.forEach((O,L)=>{if(_.node(O).dummy==="border"){let q=_.predecessors(O);q.length&&(R=_.node(q[0]).order,E(z,V,L,H,R),V=L,H=R)}E(z,V,z.length,R,U.length)}),z}return S.length&&S.reduce(A),T}function a(_,S){if(_.node(S).dummy)return _.predecessors(S).find(T=>_.node(T).dummy)}function s(_,S,T){if(S>T){let A=S;S=T,T=A}let E=_[S];E||(_[S]=E={}),E[T]=!0}function u(_,S,T){if(S>T){let E=S;S=T,T=E}return!!_[S]&&Object.hasOwn(_[S],T)}function c(_,S,T,E){let A={},U={},z={};return S.forEach(H=>{H.forEach((R,V)=>{A[R]=R,U[R]=R,z[R]=V})}),S.forEach(H=>{let R=-1;H.forEach(V=>{let O=E(V);if(O.length){O=O.sort((q,ee)=>z[q]-z[ee]);let L=(O.length-1)/2;for(let q=Math.floor(L),ee=Math.ceil(L);q<=ee;++q){let B=O[q];U[V]===V&&RMath.max(q,U[ee.v]+z.edge(ee)),0)}function O(L){let q=z.outEdges(L).reduce((B,$)=>Math.min(B,U[$.w]-z.edge($)),Number.POSITIVE_INFINITY),ee=_.node(L);q!==Number.POSITIVE_INFINITY&&ee.borderType!==H&&(U[L]=Math.max(U[L],q))}return R(V,z.predecessors.bind(z)),R(O,z.successors.bind(z)),Object.keys(E).forEach(L=>U[L]=U[T[L]]),U}function h(_,S,T,E){let A=new e,U=_.graph(),z=w(U.nodesep,U.edgesep,E);return S.forEach(H=>{let R;H.forEach(V=>{let O=T[V];if(A.setNode(O),R){var L=T[R],q=A.edge(L,O);A.setEdge(L,O,Math.max(z(_,V,R),q||0))}R=V})}),A}function m(_,S){return Object.values(S).reduce((T,E)=>{let A=Number.NEGATIVE_INFINITY,U=Number.POSITIVE_INFINITY;Object.entries(E).forEach(([H,R])=>{let V=k(_,H)/2;A=Math.max(R+V,A),U=Math.min(R-V,U)});const z=A-U;return z{["l","r"].forEach(z=>{let H=U+z,R=_[H];if(R===S)return;let V=Object.values(R),O=E-n.applyWithChunking(Math.min,V);z!=="l"&&(O=A-n.applyWithChunking(Math.max,V)),O&&(_[H]=n.mapValues(R,L=>L+O))})})}function x(_,S){return n.mapValues(_.ul,(T,E)=>{if(S)return _[S.toLowerCase()][E];{let A=Object.values(_).map(U=>U[E]).sort((U,z)=>U-z);return(A[1]+A[2])/2}})}function v(_){let S=n.buildLayerMatrix(_),T=Object.assign(r(_,S),l(_,S)),E={},A;["u","d"].forEach(z=>{A=z==="u"?S:Object.values(S).reverse(),["l","r"].forEach(H=>{H==="r"&&(A=A.map(L=>Object.values(L).reverse()));let R=(z==="u"?_.predecessors:_.successors).bind(_),V=c(_,A,T,R),O=d(_,A,V.root,V.align,H==="r");H==="r"&&(O=n.mapValues(O,L=>-L)),E[z+H]=O})});let U=m(_,E);return p(E,U),x(E,_.graph().align)}function w(_,S,T){return(E,A,U)=>{let z=E.node(A),H=E.node(U),R=0,V;if(R+=z.width/2,Object.hasOwn(z,"labelpos"))switch(z.labelpos.toLowerCase()){case"l":V=-z.width/2;break;case"r":V=z.width/2;break}if(V&&(R+=T?V:-V),V=0,R+=(z.dummy?S:_)/2,R+=(H.dummy?S:_)/2,R+=H.width/2,Object.hasOwn(H,"labelpos"))switch(H.labelpos.toLowerCase()){case"l":V=H.width/2;break;case"r":V=-H.width/2;break}return V&&(R+=T?V:-V),V=0,R}}function k(_,S){return _.node(S).width}return dp}var hp,eb;function J4(){if(eb)return hp;eb=1;let e=At(),n=K4().positionX;hp=r;function r(a){a=e.asNonCompoundGraph(a),l(a),Object.entries(n(a)).forEach(([s,u])=>a.node(s).x=u)}function l(a){let s=e.buildLayerMatrix(a),u=a.graph().ranksep,c=0;s.forEach(d=>{const h=d.reduce((m,p)=>{const x=a.node(p).height;return m>x?m:x},0);d.forEach(m=>a.node(m).y=c+h/2),c+=h+u})}return hp}var pp,tb;function W4(){if(tb)return pp;tb=1;let e=R4(),n=O4(),r=H4(),l=At().normalizeRanks,a=B4(),s=At().removeEmptyRanks,u=I4(),c=q4(),d=U4(),h=Z4(),m=J4(),p=At(),x=Fn().Graph;pp=v;function v(N,G){let X=G&&G.debugTiming?p.time:p.notime;X("layout",()=>{let J=X(" buildLayoutGraph",()=>R(N));X(" runLayout",()=>w(J,X,G)),X(" updateInputGraph",()=>k(N,J))})}function w(N,G,X){G(" makeSpaceForEdgeLabels",()=>V(N)),G(" removeSelfEdges",()=>Q(N)),G(" acyclic",()=>e.run(N)),G(" nestingGraph.run",()=>u.run(N)),G(" rank",()=>r(p.asNonCompoundGraph(N))),G(" injectEdgeLabelProxies",()=>O(N)),G(" removeEmptyRanks",()=>s(N)),G(" nestingGraph.cleanup",()=>u.cleanup(N)),G(" normalizeRanks",()=>l(N)),G(" assignRankMinMax",()=>L(N)),G(" removeEdgeLabelProxies",()=>q(N)),G(" normalize.run",()=>n.run(N)),G(" parentDummyChains",()=>a(N)),G(" addBorderSegments",()=>c(N)),G(" order",()=>h(N,X)),G(" insertSelfEdges",()=>K(N)),G(" adjustCoordinateSystem",()=>d.adjust(N)),G(" position",()=>m(N)),G(" positionSelfEdges",()=>j(N)),G(" removeBorderNodes",()=>Y(N)),G(" normalize.undo",()=>n.undo(N)),G(" fixupEdgeLabelCoords",()=>$(N)),G(" undoCoordinateSystem",()=>d.undo(N)),G(" translateGraph",()=>ee(N)),G(" assignNodeIntersects",()=>B(N)),G(" reversePoints",()=>M(N)),G(" acyclic.undo",()=>e.undo(N))}function k(N,G){N.nodes().forEach(X=>{let J=N.node(X),ne=G.node(X);J&&(J.x=ne.x,J.y=ne.y,J.rank=ne.rank,G.children(X).length&&(J.width=ne.width,J.height=ne.height))}),N.edges().forEach(X=>{let J=N.edge(X),ne=G.edge(X);J.points=ne.points,Object.hasOwn(ne,"x")&&(J.x=ne.x,J.y=ne.y)}),N.graph().width=G.graph().width,N.graph().height=G.graph().height}let _=["nodesep","edgesep","ranksep","marginx","marginy"],S={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},T=["acyclicer","ranker","rankdir","align"],E=["width","height","rank"],A={width:0,height:0},U=["minlen","weight","width","height","labeloffset"],z={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},H=["labelpos"];function R(N){let G=new x({multigraph:!0,compound:!0}),X=F(N.graph());return G.setGraph(Object.assign({},S,I(X,_),p.pick(X,T))),N.nodes().forEach(J=>{let ne=F(N.node(J));const re=I(ne,E);Object.keys(A).forEach(se=>{re[se]===void 0&&(re[se]=A[se])}),G.setNode(J,re),G.setParent(J,N.parent(J))}),N.edges().forEach(J=>{let ne=F(N.edge(J));G.setEdge(J,Object.assign({},z,I(ne,U),p.pick(ne,H)))}),G}function V(N){let G=N.graph();G.ranksep/=2,N.edges().forEach(X=>{let J=N.edge(X);J.minlen*=2,J.labelpos.toLowerCase()!=="c"&&(G.rankdir==="TB"||G.rankdir==="BT"?J.width+=J.labeloffset:J.height+=J.labeloffset)})}function O(N){N.edges().forEach(G=>{let X=N.edge(G);if(X.width&&X.height){let J=N.node(G.v),re={rank:(N.node(G.w).rank-J.rank)/2+J.rank,e:G};p.addDummyNode(N,"edge-proxy",re,"_ep")}})}function L(N){let G=0;N.nodes().forEach(X=>{let J=N.node(X);J.borderTop&&(J.minRank=N.node(J.borderTop).rank,J.maxRank=N.node(J.borderBottom).rank,G=Math.max(G,J.maxRank))}),N.graph().maxRank=G}function q(N){N.nodes().forEach(G=>{let X=N.node(G);X.dummy==="edge-proxy"&&(N.edge(X.e).labelRank=X.rank,N.removeNode(G))})}function ee(N){let G=Number.POSITIVE_INFINITY,X=0,J=Number.POSITIVE_INFINITY,ne=0,re=N.graph(),se=re.marginx||0,xe=re.marginy||0;function ve(ye){let pe=ye.x,_e=ye.y,Me=ye.width,Te=ye.height;G=Math.min(G,pe-Me/2),X=Math.max(X,pe+Me/2),J=Math.min(J,_e-Te/2),ne=Math.max(ne,_e+Te/2)}N.nodes().forEach(ye=>ve(N.node(ye))),N.edges().forEach(ye=>{let pe=N.edge(ye);Object.hasOwn(pe,"x")&&ve(pe)}),G-=se,J-=xe,N.nodes().forEach(ye=>{let pe=N.node(ye);pe.x-=G,pe.y-=J}),N.edges().forEach(ye=>{let pe=N.edge(ye);pe.points.forEach(_e=>{_e.x-=G,_e.y-=J}),Object.hasOwn(pe,"x")&&(pe.x-=G),Object.hasOwn(pe,"y")&&(pe.y-=J)}),re.width=X-G+se,re.height=ne-J+xe}function B(N){N.edges().forEach(G=>{let X=N.edge(G),J=N.node(G.v),ne=N.node(G.w),re,se;X.points?(re=X.points[0],se=X.points[X.points.length-1]):(X.points=[],re=ne,se=J),X.points.unshift(p.intersectRect(J,re)),X.points.push(p.intersectRect(ne,se))})}function $(N){N.edges().forEach(G=>{let X=N.edge(G);if(Object.hasOwn(X,"x"))switch((X.labelpos==="l"||X.labelpos==="r")&&(X.width-=X.labeloffset),X.labelpos){case"l":X.x-=X.width/2+X.labeloffset;break;case"r":X.x+=X.width/2+X.labeloffset;break}})}function M(N){N.edges().forEach(G=>{let X=N.edge(G);X.reversed&&X.points.reverse()})}function Y(N){N.nodes().forEach(G=>{if(N.children(G).length){let X=N.node(G),J=N.node(X.borderTop),ne=N.node(X.borderBottom),re=N.node(X.borderLeft[X.borderLeft.length-1]),se=N.node(X.borderRight[X.borderRight.length-1]);X.width=Math.abs(se.x-re.x),X.height=Math.abs(ne.y-J.y),X.x=re.x+X.width/2,X.y=J.y+X.height/2}}),N.nodes().forEach(G=>{N.node(G).dummy==="border"&&N.removeNode(G)})}function Q(N){N.edges().forEach(G=>{if(G.v===G.w){var X=N.node(G.v);X.selfEdges||(X.selfEdges=[]),X.selfEdges.push({e:G,label:N.edge(G)}),N.removeEdge(G)}})}function K(N){var G=p.buildLayerMatrix(N);G.forEach(X=>{var J=0;X.forEach((ne,re)=>{var se=N.node(ne);se.order=re+J,(se.selfEdges||[]).forEach(xe=>{p.addDummyNode(N,"selfedge",{width:xe.label.width,height:xe.label.height,rank:se.rank,order:re+ ++J,e:xe.e,label:xe.label},"_se")}),delete se.selfEdges})})}function j(N){N.nodes().forEach(G=>{var X=N.node(G);if(X.dummy==="selfedge"){var J=N.node(X.e.v),ne=J.x+J.width/2,re=J.y,se=X.x-ne,xe=J.height/2;N.setEdge(X.e,X.label),N.removeNode(G),X.label.points=[{x:ne+2*se/3,y:re-xe},{x:ne+5*se/6,y:re-xe},{x:ne+se,y:re},{x:ne+5*se/6,y:re+xe},{x:ne+2*se/3,y:re+xe}],X.label.x=X.x,X.label.y=X.y}})}function I(N,G){return p.mapValues(p.pick(N,G),Number)}function F(N){var G={};return N&&Object.entries(N).forEach(([X,J])=>{typeof X=="string"&&(X=X.toLowerCase()),G[X]=J}),G}return pp}var mp,nb;function e5(){if(nb)return mp;nb=1;let e=At(),n=Fn().Graph;mp={debugOrdering:r};function r(l){let a=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)),a.forEach((u,c)=>{let d="layer"+c;s.setNode(d,{rank:"same"}),u.reduce((h,m)=>(s.setEdge(h,m,{style:"invis"}),m))}),s}return mp}var gp,rb;function t5(){return rb||(rb=1,gp="1.1.8"),gp}var xp,ib;function n5(){return ib||(ib=1,xp={graphlib:Fn(),layout:W4(),debug:e5(),util:{time:At().time,notime:At().notime},version:t5()}),xp}var r5=n5();const lb=Fo(r5),Co=200,na=56,ab=20,ob=40,i5=20,sb=12;function l5(e,n,r,l,a,s,u){const c=[],d=[],h=new Set,m=new Set,p=new Map;for(const w of r)for(const k of w.agents)m.add(k),p.set(k,w.name);for(const w of r){const k=a[w.name],_=w.agents.length,S=Co+ab*2,T=ob+_*na+(_-1)*sb+i5;c.push({id:w.name,type:"groupNode",position:{x:0,y:0},data:{label:w.name,type:"parallel_group",status:(k==null?void 0:k.status)||"pending",groupName:w.name,progress:s[w.name]},style:{width:S,height:T}});for(let E=0;E$entryPoint",source:"$start",target:u,type:"animatedEdge",data:{},animated:!1})}const v=new Set(c.map(w=>w.id));for(const w of n)!v.has(w.from)||!v.has(w.to)||d.push({id:`${w.from}->${w.to}`,source:w.from,target:w.to,type:"animatedEdge",data:{when:w.when},animated:!1});return a5(c,d),{nodes:c,edges:d}}function a5(e,n){var l,a,s,u;const r=new lb.graphlib.Graph;r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:"TB",nodesep:50,ranksep:70,marginx:30,marginy:30});for(const c of e){if(c.parentId)continue;const d=c.type==="groupNode",h=d&&((l=c.style)==null?void 0:l.width)||Co,m=d&&((a=c.style)==null?void 0:a.height)||na;r.setNode(c.id,{width:h,height:m})}for(const c of n)r.hasNode(c.source)&&r.hasNode(c.target)&&r.setEdge(c.source,c.target);lb.layout(r);for(const c of e){if(c.parentId)continue;const d=r.node(c.id);if(!d)continue;const h=c.type==="groupNode",m=h&&((s=c.style)==null?void 0:s.width)||Co,p=h&&((u=c.style)==null?void 0:u.height)||na;c.position={x:d.x-m/2,y:d.y-p/2}}}const Xe={pending:"#6b7280",running:"#3b82f6",completed:"#22c55e",failed:"#ef4444",paused:"#f59e0b",idle:"#6b7280",waiting:"#a855f7"},o5=70,ub=90;function Lc({data:e,children:n}){const[r,l]=P.useState(!1),a=P.useRef(null),s=P.useCallback(()=>{a.current=setTimeout(()=>l(!0),200)},[]),u=P.useCallback(()=>{a.current&&clearTimeout(a.current),l(!1)},[]),c=Xe[e.status]||Xe.pending;return b.jsxs("div",{className:"relative",onMouseEnter:s,onMouseLeave:u,children:[n,r&&b.jsxs("div",{className:Be("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:c}}),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:Jt(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:[$n(e.tokens),e.inputTokens!=null&&e.outputTokens!=null&&b.jsxs("span",{className:"text-[var(--text-muted)]",children:[" ","(",$n(e.inputTokens),"↑ ",$n(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:yi(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:Be("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 s5=P.memo(function({data:n,id:r,selected:l}){var H;const a=n,s=il(),c=((H=s[r])==null?void 0:H.status)||a.status||"pending",d=Xe[c]||Xe.pending,h=s[r],m=h==null?void 0:h.elapsed,p=h==null?void 0:h.model,x=h==null?void 0:h.tokens,v=h==null?void 0:h.input_tokens,w=h==null?void 0:h.output_tokens,k=h==null?void 0:h.cost_usd,_=h==null?void 0:h.iteration,S=h==null?void 0:h.error_type,T=h==null?void 0:h.error_message,E=h==null?void 0:h.context_pct,A=u5(r,c),U=c5(c),z=(()=>{if(c==="failed"&&T)return{text:T.length>40?T.slice(0,37)+"...":T,className:"text-red-400"};if(c==="running")return{text:A,className:"text-[var(--text-muted)]"};if(c==="completed"){const R=[];return m!=null&&R.push(Jt(m)),x!=null&&R.push(`${$n(x)} tok`),k!=null&&R.push(yi(k)),{text:R.join(" · ")||null,className:"text-[var(--text-muted)]"}}return{text:null,className:""}})();return b.jsxs(b.Fragment,{children:[b.jsx(Ft,{type:"target",position:be.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx(Lc,{data:{status:c,elapsed:m,model:p,tokens:x,inputTokens:v,outputTokens:w,costUsd:k,iteration:_,errorType:S,errorMessage:T},children:b.jsxs("div",{className:Be("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)]",c==="running"&&"shadow-[0_0_12px_var(--running-glow)]",U),style:{borderColor:d},children:[b.jsx("div",{className:Be("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",c==="running"&&"animate-pulse"),style:{backgroundColor:`${d}20`},children:b.jsx(X2,{className:"w-3.5 h-3.5",style:{color:d}})}),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:a.label}),_!=null&&_>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:`${d}25`,color:d},children:["x",_]})]}),z.text&&b.jsx("span",{className:Be("text-[10px] truncate leading-tight",z.className),children:z.text})]}),E!=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:Be("h-full transition-all duration-500",E>=ub?"animate-[context-pulse_2s_ease-in-out_infinite]":""),style:{width:`${Math.min(E,100)}%`,backgroundColor:E>=ub?"#ef4444":E>=o5?"#f59e0b":"#22c55e"}})})]})}),b.jsx(Ft,{type:"source",position:be.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function u5(e,n){var d;const r=(d=il()[e])==null?void 0:d.startedAt,l=he(h=>h.replayMode),a=he(h=>h.lastEventTime),[s,u]=P.useState("0.0s"),c=P.useRef(null);return P.useEffect(()=>{if(n==="running"){if(l){c.current&&clearInterval(c.current);const p=r??a??0;u(Jt((a??p)-p));return}const h=r!=null?r*1e3:Date.now(),m=()=>{const p=(Date.now()-h)/1e3;u(Jt(p))};return m(),c.current=setInterval(m,1e3),()=>{c.current&&clearInterval(c.current)}}else c.current&&clearInterval(c.current)},[n,r,l,a]),s}function c5(e){const n=P.useRef(e),[r,l]=P.useState("");return P.useEffect(()=>{const a=n.current;if(n.current=e,a===e)return;e==="running"?l("node-activate"):a==="running"&&(e==="completed"||e==="failed")&&l(e==="completed"?"node-complete":"node-fail");const s=setTimeout(()=>l(""),400);return()=>clearTimeout(s)},[e]),r}const f5=P.memo(function({data:n,id:r,selected:l}){var S;const a=n,s=il(),c=((S=s[r])==null?void 0:S.status)||a.status||"pending",d=Xe[c]||Xe.pending,h=s[r],m=h==null?void 0:h.elapsed,p=h==null?void 0:h.exit_code,x=h==null?void 0:h.error_type,v=h==null?void 0:h.error_message,w=d5(r,c),k=h5(c),_=(()=>{if(c==="failed"&&v)return{text:v.length>40?v.slice(0,37)+"...":v,className:"text-red-400"};if(c==="running")return{text:w,className:"text-[var(--text-muted)]"};if(c==="completed"){const T=[];return m!=null&&T.push(Jt(m)),p!=null&&T.push(`exit ${p}`),{text:T.join(" · ")||null,className:"text-[var(--text-muted)]"}}return{text:null,className:""}})();return b.jsxs(b.Fragment,{children:[b.jsx(Ft,{type:"target",position:be.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx(Lc,{data:{status:c,elapsed:m,exitCode:p,errorType:x,errorMessage:v},children:b.jsxs("div",{className:Be("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)]",c==="running"&&"shadow-[0_0_12px_var(--running-glow)]",k),style:{borderColor:d},children:[b.jsx("div",{className:Be("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",c==="running"&&"animate-pulse"),style:{backgroundColor:`${d}20`},children:b.jsx(cN,{className:"w-3.5 h-3.5",style:{color:d}})}),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:a.label}),_.text&&b.jsx("span",{className:Be("text-[10px] truncate leading-tight",_.className),children:_.text})]})]})}),b.jsx(Ft,{type:"source",position:be.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function d5(e,n){var d;const r=(d=il()[e])==null?void 0:d.startedAt,l=he(h=>h.replayMode),a=he(h=>h.lastEventTime),[s,u]=P.useState("0.0s"),c=P.useRef(null);return P.useEffect(()=>{if(n==="running"){if(l){c.current&&clearInterval(c.current);const p=r??a??0;u(Jt((a??p)-p));return}const h=r!=null?r*1e3:Date.now(),m=()=>{const p=(Date.now()-h)/1e3;u(Jt(p))};return m(),c.current=setInterval(m,1e3),()=>{c.current&&clearInterval(c.current)}}else c.current&&clearInterval(c.current)},[n,r,l,a]),s}function h5(e){const n=P.useRef(e),[r,l]=P.useState("");return P.useEffect(()=>{const a=n.current;if(n.current=e,a===e)return;e==="running"?l("node-activate"):a==="running"&&(e==="completed"||e==="failed")&&l(e==="completed"?"node-complete":"node-fail");const s=setTimeout(()=>l(""),400);return()=>clearTimeout(s)},[e]),r}const p5=P.memo(function({data:n,id:r,selected:l}){var p,x;const a=n,s=il(),c=((p=s[r])==null?void 0:p.status)||a.status||"pending",d=Xe[c]||Xe.pending,h=(x=s[r])==null?void 0:x.selected_option,m=m5(c);return b.jsxs(b.Fragment,{children:[b.jsx(Ft,{type:"target",position:be.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx(Lc,{data:{status:c,selectedOption:h},children:b.jsxs("div",{className:Be("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)]",c==="waiting"&&"shadow-[0_0_12px_var(--waiting-muted)]",c==="running"&&"shadow-[0_0_12px_var(--running-glow)]",m),style:{borderColor:d},children:[b.jsx("div",{className:Be("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",c==="waiting"&&"animate-pulse"),style:{backgroundColor:`${d}20`},children:b.jsx(uN,{className:"w-3.5 h-3.5",style:{color:d}})}),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:a.label}),c==="waiting"&&b.jsx("span",{className:"text-[10px] text-[var(--waiting)] truncate leading-tight",children:"Awaiting input..."}),c==="completed"&&h&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] truncate leading-tight",children:h})]})]})}),b.jsx(Ft,{type:"source",position:be.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function m5(e){const n=P.useRef(e),[r,l]=P.useState("");return P.useEffect(()=>{const a=n.current;if(n.current=e,a===e)return;e==="running"||e==="waiting"?l("node-activate"):(a==="running"||a==="waiting")&&e==="completed"&&l("node-complete");const s=setTimeout(()=>l(""),400);return()=>clearTimeout(s)},[e]),r}const g5=P.memo(function({data:n,id:r,selected:l}){var _;const a=n,u=a.type==="for_each_group"?aN:rN,c=a.progress,m=((_=il()[r])==null?void 0:_.status)||a.status||"pending",p=Xe[m]||Xe.pending,x=x5(m),v=c?`${c.completed+c.failed}/${c.total}${c.failed>0?` (${c.failed} failed)`:""}`:null,w=c&&c.total>0?(c.completed+c.failed)/c.total*100:0,k=c!=null&&c.failed>0;return b.jsxs(b.Fragment,{children:[b.jsx(Ft,{type:"target",position:be.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsxs("div",{className:Be("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)]",m==="running"&&"shadow-[0_0_16px_var(--running-glow)]",x),style:{borderColor:p,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:p}}),b.jsx("span",{className:"text-xs font-medium text-[var(--text-secondary)]",children:a.label})]}),v&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] font-mono",children:v}),c&&c.total>0&&m==="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:`${w}%`,backgroundColor:k?"var(--failed)":"var(--completed)"}})})]}),b.jsx(Ft,{type:"source",position:be.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function x5(e){const n=P.useRef(e),[r,l]=P.useState("");return P.useEffect(()=>{const a=n.current;if(n.current=e,a===e)return;e==="running"?l("node-activate"):a==="running"&&(e==="completed"||e==="failed")&&l(e==="completed"?"node-complete":"node-fail");const s=setTimeout(()=>l(""),400);return()=>clearTimeout(s)},[e]),r}const y5=P.memo(function({data:n,id:r,selected:l}){const a=n,u=he(_=>{var S;return(S=_.nodes[r])==null?void 0:S.status})||a.status||"pending",c=Xe[u]||Xe.pending,d=he(_=>{var S;return(S=_.nodes[r])==null?void 0:S.elapsed}),h=he(_=>{var S;return(S=_.nodes[r])==null?void 0:S.error_message}),m=he(_=>_.navigateIntoSubworkflow),p=p_(),x=p.some(_=>_.parentAgent===r),v=p.find(_=>_.parentAgent===r),w=v==null?void 0:v.workflowName,k=(()=>{if(u==="failed"&&h)return{text:h.length>35?h.slice(0,32)+"...":h,className:"text-red-400"};if(u==="running")return{text:w||"Running subworkflow…",className:"text-[var(--text-muted)]"};if(u==="completed"){const _=[];return w&&_.push(w),d!=null&&_.push(`${d.toFixed(1)}s`),{text:_.join(" · ")||"Done",className:"text-[var(--text-muted)]"}}return{text:w||null,className:"text-[var(--text-muted)]"}})();return b.jsxs(b.Fragment,{children:[b.jsx(Ft,{type:"target",position:be.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx(Lc,{data:{status:u,elapsed:d,errorType:void 0,errorMessage:h,iteration:void 0},children:b.jsxs("div",{className:Be("flex items-center gap-2 px-3 py-1.5 rounded-lg border-2 bg-[var(--node-bg)] min-w-[140px] max-w-[240px] transition-all duration-300 cursor-pointer",l&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]",u==="running"&&"shadow-[0_0_12px_var(--running-glow)]"),style:{borderColor:c,borderStyle:"dashed"},onDoubleClick:_=>{x&&(_.stopPropagation(),m(r))},children:[b.jsx("div",{className:Be("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",u==="running"&&"animate-pulse"),style:{backgroundColor:`${c}20`},children:b.jsx(fm,{className:"w-3.5 h-3.5",style:{color:c}})}),b.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[b.jsx("div",{className:"flex items-center gap-1",children:b.jsx("span",{className:"text-xs font-medium text-[var(--text)] truncate",children:a.label})}),k.text&&b.jsx("span",{className:Be("text-[10px] truncate leading-tight",k.className),children:k.text})]}),x&&b.jsx(Dr,{className:"w-3.5 h-3.5 flex-shrink-0 text-[var(--text-muted)]"})]})}),b.jsx(Ft,{type:"source",position:be.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})}),v5=P.memo(function({data:n,selected:r}){const a=n.status||"pending",s=a==="completed",u=a==="failed",c=!s&&!u,d=s?Xe.completed:u?Xe.failed:Xe.pending;return b.jsxs(b.Fragment,{children:[b.jsx(Ft,{type:"target",position:be.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx("div",{className:Be("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)]",r&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]"),style:{borderColor:d},children:s?b.jsx(Yi,{className:"w-5 h-5 text-white",strokeWidth:3}):u?b.jsx(sw,{className:"w-3.5 h-3.5 text-white",fill:"white"}):b.jsx(Yi,{className:"w-5 h-5",strokeWidth:2.5,style:{color:c?Xe.pending:d}})})]})}),b5=P.memo(function({data:n,selected:r}){const a=n.status||"pending",s=Xe[a]||Xe.pending,u=a==="running"||a==="completed";return b.jsxs(b.Fragment,{children:[b.jsx("div",{className:Be("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)]",r&&"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(dm,{className:"w-4 h-4 ml-0.5",style:{color:u?"white":s}})}),b.jsx(Ft,{type:"source",position:be.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})}),w5=P.memo(function({id:n,sourceX:r,sourceY:l,targetX:a,targetY:s,sourcePosition:u,targetPosition:c,source:d,target:h,data:m}){const p=m4(),x=P.useMemo(()=>p.find(V=>V.from===d&&V.to===h),[p,d,h]),[v,w,k]=Tm({sourceX:r,sourceY:l,targetX:a,targetY:s,sourcePosition:u,targetPosition:c}),_=m==null?void 0:m.when,S=!!_,T=(x==null?void 0:x.state)==="taken",E=(x==null?void 0:x.state)==="highlighted",A=(x==null?void 0:x.state)==="failed";let U="var(--edge-color)",z=2,H;A?(U="var(--failed)",z=3):T?(U="var(--edge-taken)",z=3):E&&(U="var(--edge-active)",z=3),S&&!T&&!E&&!A&&(H="6 3");const R=A?"failed":T?"taken":E?"active":"default";return b.jsxs(b.Fragment,{children:[b.jsx(ns,{id:n,path:v,style:{stroke:U,strokeWidth:z,strokeDasharray:H,transition:"stroke 0.3s ease, stroke-width 0.3s ease"},markerEnd:`url(#arrow-${R})`}),S&&b.jsx(Hj,{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)":T?"var(--edge-taken)":"var(--surface)",color:A||T?"var(--bg)":"var(--text-muted)",border:`1px solid ${A?"var(--failed)":T?"var(--edge-taken)":"var(--border)"}`},title:_,children:_})})}),T&&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 S5(){const e=he(u=>u.workflowStatus),n=he(u=>u.workflowFailure),r=he(u=>u.workflowFailedAgent),l=he(u=>u.selectNode);if(e!=="failed"||!n)return null;const a=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:Be("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(fN,{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:a}),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()]})]}),r&&b.jsxs("button",{onClick:()=>l(r),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 _5(){const[e,n]=P.useState(!1),r=he(d=>d.workflowStatus),l=he(d=>d.totalCost),a=he(d=>d.totalTokens),s=he(d=>d.agentsCompleted),u=he(d=>d.agentsTotal),c=cw();return r!=="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:Be("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(Z2,{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:c}),u>0&&b.jsxs("span",{children:[s,"/",u," agents"]}),a>0&&b.jsxs("span",{children:[$n(a)," tok"]}),l>0&&b.jsx("span",{children:yi(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(Qo,{className:"w-3.5 h-3.5"})})]})})}const E5={agentNode:s5,scriptNode:f5,gateNode:p5,groupNode:g5,workflowNode:y5,endNode:v5,startNode:b5},k5={animatedEdge:w5},N5={type:"animatedEdge"};function C5(){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 T5(){const e=g4(),n=he($=>$.viewContextPath),r=he($=>$.selectNode),l=he($=>$.selectedNode),a=he($=>$.workflowStatus),s=he($=>$.wsStatus),u=he($=>$.workflowFailedAgent),c=he($=>$.navigateIntoSubworkflow),{agents:d,routes:h,parallelGroups:m,forEachGroups:p,nodes:x,groupProgress:v,entryPoint:w,subworkflowContexts:k}=e,[_,S,T]=Bj([]),[E,A,U]=Ij([]),z=P.useRef(!1),H=P.useRef(""),R=JSON.stringify(n);P.useEffect(()=>{if(d.length===0){H.current!==R&&(z.current=!1,H.current=R,S([]),A([]));return}if(H.current!==R&&(z.current=!1,H.current=R),z.current)return;z.current=!0;const{nodes:$,edges:M}=l5(d,h,m,p,x,v,w);S($),A(M)},[d,h,m,p,x,v,w,S,A,R]),P.useEffect(()=>{z.current&&S($=>$.map(M=>{const Y=x[M.id];if(!Y)return M;const Q=Y.status||"pending",K=M.data.status;if(Q!==K){const j={...M.data,status:Q};return M.data.groupName&&v[M.data.groupName]&&(j.progress=v[M.data.groupName]),{...M,data:j}}if(M.data.groupName&&v[M.data.groupName]){const j=M.data.progress,I=v[M.data.groupName];if(I&&(!j||j.completed!==I.completed||j.failed!==I.failed))return{...M,data:{...M.data,progress:I}}}return M}))},[x,v,S]);const V=P.useCallback(($,M)=>{M.type==="groupNode"&&M.data.type!=="for_each_group"||r(M.id)},[r]),O=P.useCallback(($,M)=>{k.some(Q=>Q.parentAgent===M.id)&&c(M.id)},[k,c]),L=P.useCallback(()=>{r(null)},[r]),q=P.useCallback($=>{var Y;const M=((Y=$.data)==null?void 0:Y.status)||"pending";return Xe[M]||Xe.pending},[]);P.useEffect(()=>{S($=>$.map(M=>({...M,selected:M.id===l})))},[l,S]),P.useEffect(()=>{a==="failed"&&u&&r(u)},[a,u,r]);const ee=a==="pending"&&d.length===0,B=(()=>{switch(s){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(C5,{}),b.jsx(S5,{}),b.jsx(_5,{}),ee&&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(pN,{className:"w-8 h-8 text-[var(--accent)] opacity-20"}),b.jsx(Do,{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:B})]}),b.jsxs(Oj,{nodes:_,edges:E,onNodesChange:T,onEdgesChange:U,onNodeClick:V,onNodeDoubleClick:O,onPaneClick:L,nodeTypes:E5,edgeTypes:k5,defaultEdgeOptions:N5,fitView:!0,fitViewOptions:{padding:.2},minZoom:.2,maxZoom:2,proOptions:{hideAttribution:!0},nodesDraggable:!0,nodesConnectable:!1,elementsSelectable:!0,children:[b.jsx($j,{variant:Mr.Dots,gap:20,size:1,color:"var(--border-subtle)"}),b.jsx(c4,{nodeColor:q,maskColor:"var(--minimap-mask)",style:{background:"var(--minimap-bg)"},pannable:!0,zoomable:!0}),b.jsx(Kj,{showInteractive:!1,children:b.jsx(A5,{})}),b.jsx(z5,{}),b.jsx(M5,{})]})]})}function A5(){const{fitView:e}=ma(),n=P.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 z5(){const{fitView:e}=ma();return P.useEffect(()=>{const n=r=>{var a;const l=(a=r.target)==null?void 0:a.tagName;l==="INPUT"||l==="TEXTAREA"||l==="SELECT"||r.key==="f"&&!r.ctrlKey&&!r.metaKey&&!r.altKey&&e({padding:.2,duration:300})};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e]),null}function M5(){const e=v4();return e?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:"flex items-center gap-2 px-4 py-2 rounded-lg bg-amber-950/90 border border-amber-500/40 shadow-lg shadow-amber-500/10 backdrop-blur-sm max-w-[560px]",children:[b.jsx("span",{className:"text-xs text-amber-300",children:"⚠"}),b.jsx("span",{className:"text-[11px] text-amber-400/80",children:e.message}),b.jsx("a",{href:window.location.pathname,className:"px-2 py-0.5 rounded text-[10px] font-medium text-amber-300 bg-amber-500/20 hover:bg-amber-500/30 transition-colors flex-shrink-0 ml-1",children:"Root"})]})}):null}function ll({items:e}){const n=e.filter(r=>r.value!=null&&r.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:r,value:l})=>b.jsxs("div",{className:"contents",children:[b.jsx("dt",{className:"text-[var(--text-muted)] whitespace-nowrap",children:r}),b.jsx("dd",{className:"text-[var(--text)] break-words",children:typeof l=="object"?JSON.stringify(l):String(l)})]},r))})}function w_(e){const n=[];return e.elapsed!=null&&n.push({label:"Elapsed",value:Jt(e.elapsed)}),e.model&&n.push({label:"Model",value:e.model}),e.tokens!=null&&n.push({label:"Tokens",value:$n(e.tokens)}),e.input_tokens!=null&&e.output_tokens!=null&&n.push({label:"In / Out",value:`${$n(e.input_tokens)} / ${$n(e.output_tokens)}`}),e.cost_usd!=null&&n.push({label:"Cost",value:yi(e.cost_usd)}),e.context_window_used!=null&&e.context_window_max!=null&&n.push({label:"Context",value:NN(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 tl({output:e,title:n="Output",defaultExpanded:r=!0,maxHeight:l="300px"}){const[a,s]=P.useState(r),[u,c]=P.useState(!1),d=uw(e);if(!d)return null;const h=typeof e=="object"&&e!==null,m=async()=>{await navigator.clipboard.writeText(d),c(!0),setTimeout(()=>c(!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(!a),className:"flex items-center gap-1 text-[10px] uppercase tracking-wider text-[var(--text-muted)] hover:text-[var(--text)] transition-colors font-semibold",children:[a?b.jsx(rl,{className:"w-3 h-3"}):b.jsx(Dr,{className:"w-3 h-3"}),n]}),a&&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(Yi,{className:"w-3 h-3 text-[var(--completed)]"}):b.jsx(aw,{className:"w-3 h-3"})})]}),a&&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(j5,{text:d}):d})]})}function j5({text:e}){const n=e.split(/("(?:[^"\\]|\\.)*")/g);return b.jsx(b.Fragment,{children:n.map((r,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:r},l)}const a=r.replace(/\b(true|false|null)\b|(-?\d+\.?\d*(?:e[+-]?\d+)?)/gi,(s,u,c)=>u?`${s}`:c?`${s}`:s);return b.jsx("span",{dangerouslySetInnerHTML:{__html:a}},l)})})}function Lm({activity:e,defaultExpanded:n=!0}){const[r,l]=P.useState(n),a=P.useRef(null);return P.useEffect(()=>{a.current&&r&&(a.current.scrollTop=a.current.scrollHeight)},[e.length,r]),e.length===0?null:b.jsxs("div",{className:"space-y-1.5",children:[b.jsxs("button",{onClick:()=>l(!r),className:"flex items-center gap-1 text-[10px] uppercase tracking-wider text-[var(--text-muted)] hover:text-[var(--text)] transition-colors font-semibold",children:[r?b.jsx(rl,{className:"w-3 h-3"}):b.jsx(Dr,{className:"w-3 h-3"}),"Activity (",e.length,")"]}),r&&b.jsx("div",{ref:a,className:"max-h-[400px] overflow-y-auto space-y-0.5",children:e.map((s,u)=>b.jsx(D5,{entry:s},u))})]})}function D5({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:Be("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:Be("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 R5({node:e}){const n=e.status,r=Xe[n]||Xe.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:`${r}20`,color:r},children:n}),b.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Agent"})]}),l?b.jsx(cb,{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(ll,{items:w_(e)}),e.prompt&&b.jsx(tl,{output:e.prompt,title:"Input / Prompt",defaultExpanded:!0}),b.jsx(Lm,{activity:e.activity,defaultExpanded:n!=="completed"}),e.output!=null&&b.jsx(tl,{output:e.output,title:"Output"})]}),l&&[...e.iterationHistory].reverse().map(a=>b.jsx(cb,{label:`Iteration ${a.iteration}`,defaultExpanded:!1,status:n,snapshot:a},a.iteration))]})}function cb({label:e,defaultExpanded:n,snapshot:r,status:l}){const[a,s]=P.useState(n);return b.jsxs("div",{className:"border border-[var(--border)] rounded-lg overflow-hidden",children:[b.jsxs("button",{onClick:()=>s(!a),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:[a?b.jsx(rl,{className:"w-3.5 h-3.5 text-[var(--text-muted)] flex-shrink-0"}):b.jsx(Dr,{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}),r.elapsed!=null&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] ml-auto",children:O5(r.elapsed)})]}),a&&b.jsxs("div",{className:"px-3 py-3 space-y-3 border-t border-[var(--border)]",children:[b.jsx(ll,{items:w_(r)}),r.prompt&&b.jsx(tl,{output:r.prompt,title:"Input / Prompt",defaultExpanded:!1}),b.jsx(Lm,{activity:r.activity,defaultExpanded:n&&l!=="completed"}),r.output!=null&&b.jsx(tl,{output:r.output,title:"Output",defaultExpanded:!0}),r.error_type&&b.jsxs("div",{className:"text-xs text-red-400",children:[b.jsx("span",{className:"font-semibold",children:r.error_type}),r.error_message&&b.jsxs("span",{className:"ml-1",children:["— ",r.error_message]})]})]})]})}function O5(e){if(e<1)return`${(e*1e3).toFixed(0)}ms`;if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e/60),r=(e%60).toFixed(0);return`${n}m ${r}s`}function L5({node:e}){const n=e.status,r=Xe[n]||Xe.pending,l=[];e.elapsed!=null&&l.push({label:"Elapsed",value:Jt(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 a="";return e.stdout&&(a+=e.stdout),e.stderr&&(a+=(a?` - ---- 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:`${r}20`,color:r},children:n}),b.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Script"})]}),b.jsx(ll,{items:l}),a&&b.jsx(tl,{output:a,title:"Output"})]})}function H5(e,n){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const B5=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,I5=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,q5={};function fb(e,n){return(q5.jsx?I5:B5).test(e)}const U5=/[ \t\n\f\r]/g;function V5(e){return typeof e=="object"?e.type==="text"?db(e.value):!1:db(e)}function db(e){return e.replace(U5,"")===""}class is{constructor(n,r,l){this.normal=r,this.property=n,l&&(this.space=l)}}is.prototype.normal={};is.prototype.property={};is.prototype.space=void 0;function S_(e,n){const r={},l={};for(const a of e)Object.assign(r,a.property),Object.assign(l,a.normal);return new is(r,l,n)}function em(e){return e.toLowerCase()}class cn{constructor(n,r){this.attribute=r,this.property=n}}cn.prototype.attribute="";cn.prototype.booleanish=!1;cn.prototype.boolean=!1;cn.prototype.commaOrSpaceSeparated=!1;cn.prototype.commaSeparated=!1;cn.prototype.defined=!1;cn.prototype.mustUseProperty=!1;cn.prototype.number=!1;cn.prototype.overloadedBoolean=!1;cn.prototype.property="";cn.prototype.spaceSeparated=!1;cn.prototype.space=void 0;let P5=0;const De=al(),Tt=al(),tm=al(),me=al(),ut=al(),aa=al(),vn=al();function al(){return 2**++P5}const nm=Object.freeze(Object.defineProperty({__proto__:null,boolean:De,booleanish:Tt,commaOrSpaceSeparated:vn,commaSeparated:aa,number:me,overloadedBoolean:tm,spaceSeparated:ut},Symbol.toStringTag,{value:"Module"})),yp=Object.keys(nm);class Hm extends cn{constructor(n,r,l,a){let s=-1;if(super(n,r),hb(this,"space",a),typeof l=="number")for(;++s4&&r.slice(0,4)==="data"&&X5.test(n)){if(n.charAt(4)==="-"){const s=n.slice(5).replace(pb,K5);l="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=n.slice(4);if(!pb.test(s)){let u=s.replace(F5,Z5);u.charAt(0)!=="-"&&(u="-"+u),n="data"+u}}a=Hm}return new a(l,n)}function Z5(e){return"-"+e.toLowerCase()}function K5(e){return e.charAt(1).toUpperCase()}const J5=S_([__,$5,N_,C_,T_],"html"),Bm=S_([__,G5,N_,C_,T_],"svg");function W5(e){return e.join(" ").trim()}var Xl={},vp,mb;function eD(){if(mb)return vp;mb=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,c=/^\s+|\s+$/g,d=` -`,h="/",m="*",p="",x="comment",v="declaration";function w(_,S){if(typeof _!="string")throw new TypeError("First argument must be a string");if(!_)return[];S=S||{};var T=1,E=1;function A(B){var $=B.match(n);$&&(T+=$.length);var M=B.lastIndexOf(d);E=~M?B.length-M:E+B.length}function U(){var B={line:T,column:E};return function($){return $.position=new z(B),V(),$}}function z(B){this.start=B,this.end={line:T,column:E},this.source=S.source}z.prototype.content=_;function H(B){var $=new Error(S.source+":"+T+":"+E+": "+B);if($.reason=B,$.filename=S.source,$.line=T,$.column=E,$.source=_,!S.silent)throw $}function R(B){var $=B.exec(_);if($){var M=$[0];return A(M),_=_.slice(M.length),$}}function V(){R(r)}function O(B){var $;for(B=B||[];$=L();)$!==!1&&B.push($);return B}function L(){var B=U();if(!(h!=_.charAt(0)||m!=_.charAt(1))){for(var $=2;p!=_.charAt($)&&(m!=_.charAt($)||h!=_.charAt($+1));)++$;if($+=2,p===_.charAt($-1))return H("End of comment missing");var M=_.slice(2,$-2);return E+=2,A(M),_=_.slice($),E+=2,B({type:x,comment:M})}}function q(){var B=U(),$=R(l);if($){if(L(),!R(a))return H("property missing ':'");var M=R(s),Y=B({type:v,property:k($[0].replace(e,p)),value:M?k(M[0].replace(e,p)):p});return R(u),Y}}function ee(){var B=[];O(B);for(var $;$=q();)$!==!1&&(B.push($),O(B));return B}return V(),ee()}function k(_){return _?_.replace(c,p):p}return vp=w,vp}var gb;function tD(){if(gb)return Xl;gb=1;var e=Xl&&Xl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(Xl,"__esModule",{value:!0}),Xl.default=r;const n=e(eD());function r(l,a){let s=null;if(!l||typeof l!="string")return s;const u=(0,n.default)(l),c=typeof a=="function";return u.forEach(d=>{if(d.type!=="declaration")return;const{property:h,value:m}=d;c?a(h,m,d):m&&(s=s||{},s[h]=m)}),s}return Xl}var yo={},xb;function nD(){if(xb)return yo;xb=1,Object.defineProperty(yo,"__esModule",{value:!0}),yo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,s=function(h){return!h||r.test(h)||e.test(h)},u=function(h,m){return m.toUpperCase()},c=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(a,c):h=h.replace(l,c),h.replace(n,u))};return yo.camelCase=d,yo}var vo,yb;function rD(){if(yb)return vo;yb=1;var e=vo&&vo.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},n=e(tD()),r=nD();function l(a,s){var u={};return!a||typeof a!="string"||(0,n.default)(a,function(c,d){c&&d&&(u[(0,r.camelCase)(c,s)]=d)}),u}return l.default=l,vo=l,vo}var iD=rD();const lD=Fo(iD),A_=z_("end"),Im=z_("start");function z_(e){return n;function n(r){const l=r&&r.position&&r.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 aD(e){const n=Im(e),r=A_(e);if(n&&r)return{start:n,end:r}}function zo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?vb(e.position):"start"in e||"end"in e?vb(e):"line"in e||"column"in e?rm(e):""}function rm(e){return bb(e&&e.line)+":"+bb(e&&e.column)}function vb(e){return rm(e&&e.start)+"-"+rm(e&&e.end)}function bb(e){return e&&typeof e=="number"?e:1}class Xt extends Error{constructor(n,r,l){super(),typeof r=="string"&&(l=r,r=void 0);let a="",s={},u=!1;if(r&&("line"in r&&"column"in r?s={place:r}:"start"in r&&"end"in r?s={place:r}:"type"in r?s={ancestors:[r],place:r.position}:s={...r}),typeof n=="string"?a=n:!s.cause&&n&&(u=!0,a=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 c=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=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=c?c.line:void 0,this.name=zo(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}}Xt.prototype.file="";Xt.prototype.name="";Xt.prototype.reason="";Xt.prototype.message="";Xt.prototype.stack="";Xt.prototype.column=void 0;Xt.prototype.line=void 0;Xt.prototype.ancestors=void 0;Xt.prototype.cause=void 0;Xt.prototype.fatal=void 0;Xt.prototype.place=void 0;Xt.prototype.ruleId=void 0;Xt.prototype.source=void 0;const qm={}.hasOwnProperty,oD=new Map,sD=/[A-Z]/g,uD=new Set(["table","tbody","thead","tfoot","tr"]),cD=new Set(["td","th"]),M_="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function fD(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=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=vD(r,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=yD(r,n.jsx,n.jsxs)}const a={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:l,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?Bm:J5,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},s=j_(a,e,void 0);return s&&typeof s!="string"?s:a.create(e,a.Fragment,{children:s||void 0},void 0)}function j_(e,n,r){if(n.type==="element")return dD(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return hD(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return mD(e,n,r);if(n.type==="mdxjsEsm")return pD(e,n);if(n.type==="root")return gD(e,n,r);if(n.type==="text")return xD(e,n)}function dD(e,n,r){const l=e.schema;let a=l;n.tagName.toLowerCase()==="svg"&&l.space==="html"&&(a=Bm,e.schema=a),e.ancestors.push(n);const s=R_(e,n.tagName,!1),u=bD(e,n);let c=Vm(e,n);return uD.has(n.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!V5(d):!0})),D_(e,u,s,n),Um(u,c),e.ancestors.pop(),e.schema=l,e.create(n,s,u,r)}function hD(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)}Go(e,n.position)}function pD(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Go(e,n.position)}function mD(e,n,r){const l=e.schema;let a=l;n.name==="svg"&&l.space==="html"&&(a=Bm,e.schema=a),e.ancestors.push(n);const s=n.name===null?e.Fragment:R_(e,n.name,!0),u=wD(e,n),c=Vm(e,n);return D_(e,u,s,n),Um(u,c),e.ancestors.pop(),e.schema=l,e.create(n,s,u,r)}function gD(e,n,r){const l={};return Um(l,Vm(e,n)),e.create(n,e.Fragment,l,r)}function xD(e,n){return n.value}function D_(e,n,r,l){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=l)}function Um(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function yD(e,n,r){return l;function l(a,s,u,c){const h=Array.isArray(u.children)?r:n;return c?h(s,u,c):h(s,u)}}function vD(e,n){return r;function r(l,a,s,u){const c=Array.isArray(s.children),d=Im(l);return n(a,s,u,c,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function bD(e,n){const r={};let l,a;for(a in n.properties)if(a!=="children"&&qm.call(n.properties,a)){const s=SD(e,a,n.properties[a]);if(s){const[u,c]=s;e.tableCellAlignToStyle&&u==="align"&&typeof c=="string"&&cD.has(n.tagName)?l=c:r[u]=c}}if(l){const s=r.style||(r.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=l}return r}function wD(e,n){const r={};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 c=u.properties[0];c.type,Object.assign(r,e.evaluater.evaluateExpression(c.argument))}else Go(e,n.position);else{const a=l.name;let s;if(l.value&&typeof l.value=="object")if(l.value.data&&l.value.data.estree&&e.evaluater){const c=l.value.data.estree.body[0];c.type,s=e.evaluater.evaluateExpression(c.expression)}else Go(e,n.position);else s=l.value===null?!0:l.value;r[a]=s}return r}function Vm(e,n){const r=[];let l=-1;const a=e.passKeys?new Map:oD;for(;++la?0:a+n:n=n>a?a:n,r=r>0?r:0,l.length<1e4)u=Array.from(l),u.unshift(n,r),e.splice(...u);else for(r&&e.splice(n,r);s0?(Sn(e,e.length,0,n),e):n}const _b={}.hasOwnProperty;function L_(e){const n={};let r=-1;for(;++r13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Yn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Kt=vi(/[A-Za-z]/),Yt=vi(/[\dA-Za-z]/),MD=vi(/[#-'*+\--9=?A-Z^-~]/);function xc(e){return e!==null&&(e<32||e===127)}const im=vi(/\d/),jD=vi(/[\dA-Fa-f]/),DD=vi(/[!-/:-@[-`{-~]/);function ke(e){return e!==null&&e<-2}function ot(e){return e!==null&&(e<0||e===32)}function Ie(e){return e===-2||e===-1||e===32}const Hc=vi(new RegExp("\\p{P}|\\p{S}","u")),nl=vi(/\s/);function vi(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function xa(e){const n=[];let r=-1,l=0,a=0;for(;++r55295&&s<57344){const c=e.charCodeAt(r+1);s<56320&&c>56319&&c<57344?(u=String.fromCharCode(s,c),a=1):u="�"}else u=String.fromCharCode(s);u&&(n.push(e.slice(l,r),encodeURIComponent(u)),l=r+a+1,u=""),a&&(r+=a,a=0)}return n.join("")+e.slice(l)}function Ye(e,n,r,l){const a=l?l-1:Number.POSITIVE_INFINITY;let s=0;return u;function u(d){return Ie(d)?(e.enter(r),c(d)):n(d)}function c(d){return Ie(d)&&s++u))return;const H=n.events.length;let R=H,V,O;for(;R--;)if(n.events[R][0]==="exit"&&n.events[R][1].type==="chunkFlow"){if(V){O=n.events[R][1].end;break}V=!0}for(S(l),z=H;zE;){const U=r[A];n.containerState=U[1],U[0].exit.call(n,e)}r.length=E}function T(){a.write([null]),s=void 0,a=void 0,n.containerState._closeFlow=void 0}}function BD(e,n,r){return Ye(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function pa(e){if(e===null||ot(e)||nl(e))return 1;if(Hc(e))return 2}function Bc(e,n,r){const l=[];let a=-1;for(;++a1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const p={...e[l][1].end},x={...e[r][1].start};kb(p,-d),kb(x,d),u={type:d>1?"strongSequence":"emphasisSequence",start:p,end:{...e[l][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:x},s={type:d>1?"strongText":"emphasisText",start:{...e[l][1].end},end:{...e[r][1].start}},a={type:d>1?"strong":"emphasis",start:{...u.start},end:{...c.end}},e[l][1].end={...u.start},e[r][1].start={...c.end},h=[],e[l][1].end.offset-e[l][1].start.offset&&(h=Dn(h,[["enter",e[l][1],n],["exit",e[l][1],n]])),h=Dn(h,[["enter",a,n],["enter",u,n],["exit",u,n],["enter",s,n]]),h=Dn(h,Bc(n.parser.constructs.insideSpan.null,e.slice(l+1,r),n)),h=Dn(h,[["exit",s,n],["enter",c,n],["exit",c,n],["exit",a,n]]),e[r][1].end.offset-e[r][1].start.offset?(m=2,h=Dn(h,[["enter",e[r][1],n],["exit",e[r][1],n]])):m=0,Sn(e,l-1,r-l+3,h),r=l+h.length-m-2;break}}for(r=-1;++r0&&Ie(z)?Ye(e,T,"linePrefix",s+1)(z):T(z)}function T(z){return z===null||ke(z)?e.check(Nb,k,A)(z):(e.enter("codeFlowValue"),E(z))}function E(z){return z===null||ke(z)?(e.exit("codeFlowValue"),T(z)):(e.consume(z),E)}function A(z){return e.exit("codeFenced"),n(z)}function U(z,H,R){let V=0;return O;function O($){return z.enter("lineEnding"),z.consume($),z.exit("lineEnding"),L}function L($){return z.enter("codeFencedFence"),Ie($)?Ye(z,q,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):q($)}function q($){return $===c?(z.enter("codeFencedFenceSequence"),ee($)):R($)}function ee($){return $===c?(V++,z.consume($),ee):V>=u?(z.exit("codeFencedFenceSequence"),Ie($)?Ye(z,B,"whitespace")($):B($)):R($)}function B($){return $===null||ke($)?(z.exit("codeFencedFence"),H($)):R($)}}}function ZD(e,n,r){const l=this;return a;function a(u){return u===null?r(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),s)}function s(u){return l.parser.lazy[l.now().line]?r(u):n(u)}}const wp={name:"codeIndented",tokenize:JD},KD={partial:!0,tokenize:WD};function JD(e,n,r){const l=this;return a;function a(h){return e.enter("codeIndented"),Ye(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):r(h)}function u(h){return h===null?d(h):ke(h)?e.attempt(KD,u,d)(h):(e.enter("codeFlowValue"),c(h))}function c(h){return h===null||ke(h)?(e.exit("codeFlowValue"),u(h)):(e.consume(h),c)}function d(h){return e.exit("codeIndented"),n(h)}}function WD(e,n,r){const l=this;return a;function a(u){return l.parser.lazy[l.now().line]?r(u):ke(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):Ye(e,s,"linePrefix",5)(u)}function s(u){const c=l.events[l.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?n(u):ke(u)?a(u):r(u)}}const eR={name:"codeText",previous:nR,resolve:tR,tokenize:rR};function tR(e){let n=e.length-4,r=3,l,a;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(l=r;++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,r,l){const a=r||0;this.setCursor(Math.trunc(n));const s=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return l&&bo(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),bo(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),bo(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,r,n)(u)}}function V_(e,n,r,l,a,s,u,c,d){const h=d||Number.POSITIVE_INFINITY;let m=0;return p;function p(S){return S===60?(e.enter(l),e.enter(a),e.enter(s),e.consume(S),e.exit(s),x):S===null||S===32||S===41||xc(S)?r(S):(e.enter(l),e.enter(u),e.enter(c),e.enter("chunkString",{contentType:"string"}),k(S))}function x(S){return S===62?(e.enter(s),e.consume(S),e.exit(s),e.exit(a),e.exit(l),n):(e.enter(c),e.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===62?(e.exit("chunkString"),e.exit(c),x(S)):S===null||S===60||ke(S)?r(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 k(S){return!m&&(S===null||S===41||ot(S))?(e.exit("chunkString"),e.exit(c),e.exit(u),e.exit(l),n(S)):m999||v===null||v===91||v===93&&!d||v===94&&!c&&"_hiddenFootnoteSupport"in u.parser.constructs?r(v):v===93?(e.exit(s),e.enter(a),e.consume(v),e.exit(a),e.exit(l),n):ke(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||ke(v)||c++>999?(e.exit("chunkString"),m(v)):(e.consume(v),d||(d=!Ie(v)),v===92?x:p)}function x(v){return v===91||v===92||v===93?(e.consume(v),c++,p):p(v)}}function $_(e,n,r,l,a,s){let u;return c;function c(x){return x===34||x===39||x===40?(e.enter(l),e.enter(a),e.consume(x),e.exit(a),u=x===40?41:x,d):r(x)}function d(x){return x===u?(e.enter(a),e.consume(x),e.exit(a),e.exit(l),n):(e.enter(s),h(x))}function h(x){return x===u?(e.exit(s),d(u)):x===null?r(x):ke(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),Ye(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===u||x===null||ke(x)?(e.exit("chunkString"),h(x)):(e.consume(x),x===92?p:m)}function p(x){return x===u||x===92?(e.consume(x),m):m(x)}}function Mo(e,n){let r;return l;function l(a){return ke(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r=!0,l):Ie(a)?Ye(e,l,r?"linePrefix":"lineSuffix")(a):n(a)}}const fR={name:"definition",tokenize:hR},dR={partial:!0,tokenize:pR};function hR(e,n,r){const l=this;let a;return s;function s(v){return e.enter("definition"),u(v)}function u(v){return P_.call(l,e,c,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function c(v){return a=Yn(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),d):r(v)}function d(v){return ot(v)?Mo(e,h)(v):h(v)}function h(v){return V_(e,m,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function m(v){return e.attempt(dR,p,p)(v)}function p(v){return Ie(v)?Ye(e,x,"whitespace")(v):x(v)}function x(v){return v===null||ke(v)?(e.exit("definition"),l.parser.defined.push(a),n(v)):r(v)}}function pR(e,n,r){return l;function l(c){return ot(c)?Mo(e,a)(c):r(c)}function a(c){return $_(e,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function s(c){return Ie(c)?Ye(e,u,"whitespace")(c):u(c)}function u(c){return c===null||ke(c)?n(c):r(c)}}const mR={name:"hardBreakEscape",tokenize:gR};function gR(e,n,r){return l;function l(s){return e.enter("hardBreakEscape"),e.consume(s),a}function a(s){return ke(s)?(e.exit("hardBreakEscape"),n(s)):r(s)}}const xR={name:"headingAtx",resolve:yR,tokenize:vR};function yR(e,n){let r=e.length-2,l=3,a,s;return e[l][1].type==="whitespace"&&(l+=2),r-2>l&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(l===r-1||r-4>l&&e[r-2][1].type==="whitespace")&&(r-=l+1===r?2:4),r>l&&(a={type:"atxHeadingText",start:e[l][1].start,end:e[r][1].end},s={type:"chunkText",start:e[l][1].start,end:e[r][1].end,contentType:"text"},Sn(e,l,r-l+1,[["enter",a,n],["enter",s,n],["exit",s,n],["exit",a,n]])),e}function vR(e,n,r){let l=0;return a;function a(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||ot(m)?(e.exit("atxHeadingSequence"),c(m)):r(m)}function c(m){return m===35?(e.enter("atxHeadingSequence"),d(m)):m===null||ke(m)?(e.exit("atxHeading"),n(m)):Ie(m)?Ye(e,c,"whitespace")(m):(e.enter("atxHeadingText"),h(m))}function d(m){return m===35?(e.consume(m),d):(e.exit("atxHeadingSequence"),c(m))}function h(m){return m===null||m===35||ot(m)?(e.exit("atxHeadingText"),c(m)):(e.consume(m),h)}}const bR=["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"],Tb=["pre","script","style","textarea"],wR={concrete:!0,name:"htmlFlow",resolveTo:ER,tokenize:kR},SR={partial:!0,tokenize:CR},_R={partial:!0,tokenize:NR};function ER(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 kR(e,n,r){const l=this;let a,s,u,c,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),x):N===47?(e.consume(N),s=!0,k):N===63?(e.consume(N),a=3,l.interrupt?n:j):Kt(N)?(e.consume(N),u=String.fromCharCode(N),_):r(N)}function x(N){return N===45?(e.consume(N),a=2,v):N===91?(e.consume(N),a=5,c=0,w):Kt(N)?(e.consume(N),a=4,l.interrupt?n:j):r(N)}function v(N){return N===45?(e.consume(N),l.interrupt?n:j):r(N)}function w(N){const G="CDATA[";return N===G.charCodeAt(c++)?(e.consume(N),c===G.length?l.interrupt?n:q:w):r(N)}function k(N){return Kt(N)?(e.consume(N),u=String.fromCharCode(N),_):r(N)}function _(N){if(N===null||N===47||N===62||ot(N)){const G=N===47,X=u.toLowerCase();return!G&&!s&&Tb.includes(X)?(a=1,l.interrupt?n(N):q(N)):bR.includes(u.toLowerCase())?(a=6,G?(e.consume(N),S):l.interrupt?n(N):q(N)):(a=7,l.interrupt&&!l.parser.lazy[l.now().line]?r(N):s?T(N):E(N))}return N===45||Yt(N)?(e.consume(N),u+=String.fromCharCode(N),_):r(N)}function S(N){return N===62?(e.consume(N),l.interrupt?n:q):r(N)}function T(N){return Ie(N)?(e.consume(N),T):O(N)}function E(N){return N===47?(e.consume(N),O):N===58||N===95||Kt(N)?(e.consume(N),A):Ie(N)?(e.consume(N),E):O(N)}function A(N){return N===45||N===46||N===58||N===95||Yt(N)?(e.consume(N),A):U(N)}function U(N){return N===61?(e.consume(N),z):Ie(N)?(e.consume(N),U):E(N)}function z(N){return N===null||N===60||N===61||N===62||N===96?r(N):N===34||N===39?(e.consume(N),d=N,H):Ie(N)?(e.consume(N),z):R(N)}function H(N){return N===d?(e.consume(N),d=null,V):N===null||ke(N)?r(N):(e.consume(N),H)}function R(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||ot(N)?U(N):(e.consume(N),R)}function V(N){return N===47||N===62||Ie(N)?E(N):r(N)}function O(N){return N===62?(e.consume(N),L):r(N)}function L(N){return N===null||ke(N)?q(N):Ie(N)?(e.consume(N),L):r(N)}function q(N){return N===45&&a===2?(e.consume(N),M):N===60&&a===1?(e.consume(N),Y):N===62&&a===4?(e.consume(N),I):N===63&&a===3?(e.consume(N),j):N===93&&a===5?(e.consume(N),K):ke(N)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(SR,F,ee)(N)):N===null||ke(N)?(e.exit("htmlFlowData"),ee(N)):(e.consume(N),q)}function ee(N){return e.check(_R,B,F)(N)}function B(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),$}function $(N){return N===null||ke(N)?ee(N):(e.enter("htmlFlowData"),q(N))}function M(N){return N===45?(e.consume(N),j):q(N)}function Y(N){return N===47?(e.consume(N),u="",Q):q(N)}function Q(N){if(N===62){const G=u.toLowerCase();return Tb.includes(G)?(e.consume(N),I):q(N)}return Kt(N)&&u.length<8?(e.consume(N),u+=String.fromCharCode(N),Q):q(N)}function K(N){return N===93?(e.consume(N),j):q(N)}function j(N){return N===62?(e.consume(N),I):N===45&&a===2?(e.consume(N),j):q(N)}function I(N){return N===null||ke(N)?(e.exit("htmlFlowData"),F(N)):(e.consume(N),I)}function F(N){return e.exit("htmlFlow"),n(N)}}function NR(e,n,r){const l=this;return a;function a(u){return ke(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),s):r(u)}function s(u){return l.parser.lazy[l.now().line]?r(u):n(u)}}function CR(e,n,r){return l;function l(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(ls,n,r)}}const TR={name:"htmlText",tokenize:AR};function AR(e,n,r){const l=this;let a,s,u;return c;function c(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),U):j===63?(e.consume(j),E):Kt(j)?(e.consume(j),R):r(j)}function h(j){return j===45?(e.consume(j),m):j===91?(e.consume(j),s=0,w):Kt(j)?(e.consume(j),T):r(j)}function m(j){return j===45?(e.consume(j),v):r(j)}function p(j){return j===null?r(j):j===45?(e.consume(j),x):ke(j)?(u=p,Y(j)):(e.consume(j),p)}function x(j){return j===45?(e.consume(j),v):p(j)}function v(j){return j===62?M(j):j===45?x(j):p(j)}function w(j){const I="CDATA[";return j===I.charCodeAt(s++)?(e.consume(j),s===I.length?k:w):r(j)}function k(j){return j===null?r(j):j===93?(e.consume(j),_):ke(j)?(u=k,Y(j)):(e.consume(j),k)}function _(j){return j===93?(e.consume(j),S):k(j)}function S(j){return j===62?M(j):j===93?(e.consume(j),S):k(j)}function T(j){return j===null||j===62?M(j):ke(j)?(u=T,Y(j)):(e.consume(j),T)}function E(j){return j===null?r(j):j===63?(e.consume(j),A):ke(j)?(u=E,Y(j)):(e.consume(j),E)}function A(j){return j===62?M(j):E(j)}function U(j){return Kt(j)?(e.consume(j),z):r(j)}function z(j){return j===45||Yt(j)?(e.consume(j),z):H(j)}function H(j){return ke(j)?(u=H,Y(j)):Ie(j)?(e.consume(j),H):M(j)}function R(j){return j===45||Yt(j)?(e.consume(j),R):j===47||j===62||ot(j)?V(j):r(j)}function V(j){return j===47?(e.consume(j),M):j===58||j===95||Kt(j)?(e.consume(j),O):ke(j)?(u=V,Y(j)):Ie(j)?(e.consume(j),V):M(j)}function O(j){return j===45||j===46||j===58||j===95||Yt(j)?(e.consume(j),O):L(j)}function L(j){return j===61?(e.consume(j),q):ke(j)?(u=L,Y(j)):Ie(j)?(e.consume(j),L):V(j)}function q(j){return j===null||j===60||j===61||j===62||j===96?r(j):j===34||j===39?(e.consume(j),a=j,ee):ke(j)?(u=q,Y(j)):Ie(j)?(e.consume(j),q):(e.consume(j),B)}function ee(j){return j===a?(e.consume(j),a=void 0,$):j===null?r(j):ke(j)?(u=ee,Y(j)):(e.consume(j),ee)}function B(j){return j===null||j===34||j===39||j===60||j===61||j===96?r(j):j===47||j===62||ot(j)?V(j):(e.consume(j),B)}function $(j){return j===47||j===62||ot(j)?V(j):r(j)}function M(j){return j===62?(e.consume(j),e.exit("htmlTextData"),e.exit("htmlText"),n):r(j)}function Y(j){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),Q}function Q(j){return Ie(j)?Ye(e,K,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):K(j)}function K(j){return e.enter("htmlTextData"),u(j)}}const Gm={name:"labelEnd",resolveAll:DR,resolveTo:RR,tokenize:OR},zR={tokenize:LR},MR={tokenize:HR},jR={tokenize:BR};function DR(e){let n=-1;const r=[];for(;++n=3&&(h===null||ke(h))?(e.exit("thematicBreak"),n(h)):r(h)}function d(h){return h===a?(e.consume(h),l++,d):(e.exit("thematicBreakSequence"),Ie(h)?Ye(e,c,"whitespace")(h):c(h))}}const sn={continuation:{tokenize:XR},exit:ZR,name:"list",tokenize:FR},GR={partial:!0,tokenize:KR},YR={partial:!0,tokenize:QR};function FR(e,n,r){const l=this,a=l.events[l.events.length-1];let s=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return c;function c(v){const w=l.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!l.containerState.marker||v===l.containerState.marker:im(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(tc,r,h)(v):h(v);if(!l.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(v)}return r(v)}function d(v){return im(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)):r(v)}function h(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),l.containerState.marker=l.containerState.marker||v,e.check(ls,l.interrupt?r:m,e.attempt(GR,x,p))}function m(v){return l.containerState.initialBlankLine=!0,s++,x(v)}function p(v){return Ie(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),x):r(v)}function x(v){return l.containerState.size=s+l.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(v)}}function XR(e,n,r){const l=this;return l.containerState._closeFlow=void 0,e.check(ls,a,s);function a(c){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,Ye(e,n,"listItemIndent",l.containerState.size+1)(c)}function s(c){return l.containerState.furtherBlankLines||!Ie(c)?(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,u(c)):(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,e.attempt(YR,n,u)(c))}function u(c){return l.containerState._closeFlow=!0,l.interrupt=void 0,Ye(e,e.attempt(sn,n,r),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function QR(e,n,r){const l=this;return Ye(e,a,"listItemIndent",l.containerState.size+1);function a(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):r(s)}}function ZR(e){e.exit(this.containerState.type)}function KR(e,n,r){const l=this;return Ye(e,a,"listItemPrefixWhitespace",l.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(s){const u=l.events[l.events.length-1];return!Ie(s)&&u&&u[1].type==="listItemPrefixWhitespace"?n(s):r(s)}}const Ab={name:"setextUnderline",resolveTo:JR,tokenize:WR};function JR(e,n){let r=e.length,l,a,s;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){l=r;break}e[r][1].type==="paragraph"&&(a=r)}else e[r][1].type==="content"&&e.splice(r,1),!s&&e[r][1].type==="definition"&&(s=r);const u={type:"setextHeading",start:{...e[l][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",s?(e.splice(a,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 WR(e,n,r){const l=this;let a;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"),a=h,u(h)):r(h)}function u(h){return e.enter("setextHeadingLineSequence"),c(h)}function c(h){return h===a?(e.consume(h),c):(e.exit("setextHeadingLineSequence"),Ie(h)?Ye(e,d,"lineSuffix")(h):d(h))}function d(h){return h===null||ke(h)?(e.exit("setextHeadingLine"),n(h)):r(h)}}const eO={tokenize:tO};function tO(e){const n=this,r=e.attempt(ls,l,e.attempt(this.parser.constructs.flowInitial,a,Ye(e,e.attempt(this.parser.constructs.flow,a,e.attempt(aR,a)),"linePrefix")));return r;function l(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),n.currentConstruct=void 0,r}function a(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n.currentConstruct=void 0,r}}const nO={resolveAll:Y_()},rO=G_("string"),iO=G_("text");function G_(e){return{resolveAll:Y_(e==="text"?lO:void 0),tokenize:n};function n(r){const l=this,a=this.parser.constructs[e],s=r.attempt(a,u,c);return u;function u(m){return h(m)?s(m):c(m)}function c(m){if(m===null){r.consume(m);return}return r.enter("data"),r.consume(m),d}function d(m){return h(m)?(r.exit("data"),s(m)):(r.consume(m),d)}function h(m){if(m===null)return!0;const p=a[m];let x=-1;if(p)for(;++x-1){const c=u[0];typeof c=="string"?u[0]=c.slice(l):u.shift()}s>0&&u.push(e[a].slice(0,s))}return u}function yO(e,n){let r=-1;const l=[];let a;for(;++r0){const Qt=Ne.tokenStack[Ne.tokenStack.length-1];(Qt[1]||Mb).call(Ne,void 0,Qt[0])}for(ge.position={start:pi(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:pi(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},Ge=-1;++Ge0&&(l.className=["language-"+a[0]]);let s={type:"element",tagName:"code",properties:l,children:[{type:"text",value:r}]};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 jO(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function DO(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function RO(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",l=String(n.identifier).toUpperCase(),a=xa(l.toLowerCase()),s=e.footnoteOrder.indexOf(l);let u,c=e.footnoteCounts.get(l);c===void 0?(c=0,e.footnoteOrder.push(l),u=e.footnoteOrder.length):u=s+1,c+=1,e.footnoteCounts.set(l,c);const d={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+a,id:r+"fnref-"+a+(c>1?"-"+c:""),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 OO(e,n){const r={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function LO(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function Q_(e,n){const r=n.referenceType;let l="]";if(r==="collapsed"?l+="[]":r==="full"&&(l+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+l}];const a=e.all(n),s=a[0];s&&s.type==="text"?s.value="["+s.value:a.unshift({type:"text",value:"["});const u=a[a.length-1];return u&&u.type==="text"?u.value+=l:a.push({type:"text",value:l}),a}function HO(e,n){const r=String(n.identifier).toUpperCase(),l=e.definitionById.get(r);if(!l)return Q_(e,n);const a={src:xa(l.url||""),alt:n.alt};l.title!==null&&l.title!==void 0&&(a.title=l.title);const s={type:"element",tagName:"img",properties:a,children:[]};return e.patch(n,s),e.applyData(n,s)}function BO(e,n){const r={src:xa(n.url)};n.alt!==null&&n.alt!==void 0&&(r.alt=n.alt),n.title!==null&&n.title!==void 0&&(r.title=n.title);const l={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,l),e.applyData(n,l)}function IO(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const l={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,l),e.applyData(n,l)}function qO(e,n){const r=String(n.identifier).toUpperCase(),l=e.definitionById.get(r);if(!l)return Q_(e,n);const a={href:xa(l.url||"")};l.title!==null&&l.title!==void 0&&(a.title=l.title);const s={type:"element",tagName:"a",properties:a,children:e.all(n)};return e.patch(n,s),e.applyData(n,s)}function UO(e,n){const r={href:xa(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const l={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,l),e.applyData(n,l)}function VO(e,n,r){const l=e.all(n),a=r?PO(r):Z_(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 c=-1;for(;++c1}function $O(e,n){const r={},l=e.all(n);let a=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.start);++a0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},c=Im(n.children[1]),d=A_(n.children[n.children.length-1]);c&&d&&(u.position={start:c,end:d}),a.push(u)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(n,s),e.applyData(n,s)}function QO(e,n,r){const l=r?r.children:void 0,s=(l?l.indexOf(n):1)===0?"th":"td",u=r&&r.type==="table"?r.align:void 0,c=u?u.length:n.children.length;let d=-1;const h=[];for(;++d0,!0),l[0]),a=l.index+l[0].length,l=r.exec(n);return s.push(Rb(n.slice(a),a>0,!1)),s.join("")}function Rb(e,n,r){let l=0,a=e.length;if(n){let s=e.codePointAt(l);for(;s===jb||s===Db;)l++,s=e.codePointAt(l)}if(r){let s=e.codePointAt(a-1);for(;s===jb||s===Db;)a--,s=e.codePointAt(a-1)}return a>l?e.slice(l,a):""}function JO(e,n){const r={type:"text",value:KO(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function WO(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const e6={blockquote:AO,break:zO,code:MO,delete:jO,emphasis:DO,footnoteReference:RO,heading:OO,html:LO,imageReference:HO,image:BO,inlineCode:IO,linkReference:qO,link:UO,listItem:VO,list:$O,paragraph:GO,root:YO,strong:FO,table:XO,tableCell:ZO,tableRow:QO,text:JO,thematicBreak:WO,toml:$u,yaml:$u,definition:$u,footnoteDefinition:$u};function $u(){}const K_=-1,Ic=0,jo=1,yc=2,Ym=3,Fm=4,Xm=5,Qm=6,J_=7,W_=8,Ob=typeof self=="object"?self:globalThis,t6=(e,n)=>{const r=(a,s)=>(e.set(s,a),a),l=a=>{if(e.has(a))return e.get(a);const[s,u]=n[a];switch(s){case Ic:case K_:return r(u,a);case jo:{const c=r([],a);for(const d of u)c.push(l(d));return c}case yc:{const c=r({},a);for(const[d,h]of u)c[l(d)]=l(h);return c}case Ym:return r(new Date(u),a);case Fm:{const{source:c,flags:d}=u;return r(new RegExp(c,d),a)}case Xm:{const c=r(new Map,a);for(const[d,h]of u)c.set(l(d),l(h));return c}case Qm:{const c=r(new Set,a);for(const d of u)c.add(l(d));return c}case J_:{const{name:c,message:d}=u;return r(new Ob[c](d),a)}case W_:return r(BigInt(u),a);case"BigInt":return r(Object(BigInt(u)),a);case"ArrayBuffer":return r(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:c}=new Uint8Array(u);return r(new DataView(c),u)}}return r(new Ob[s](u),a)};return l},Lb=e=>t6(new Map,e)(0),Ql="",{toString:n6}={},{keys:r6}=Object,wo=e=>{const n=typeof e;if(n!=="object"||!e)return[Ic,n];const r=n6.call(e).slice(8,-1);switch(r){case"Array":return[jo,Ql];case"Object":return[yc,Ql];case"Date":return[Ym,Ql];case"RegExp":return[Fm,Ql];case"Map":return[Xm,Ql];case"Set":return[Qm,Ql];case"DataView":return[jo,r]}return r.includes("Array")?[jo,r]:r.includes("Error")?[J_,r]:[yc,r]},Gu=([e,n])=>e===Ic&&(n==="function"||n==="symbol"),i6=(e,n,r,l)=>{const a=(u,c)=>{const d=l.push(u)-1;return r.set(c,d),d},s=u=>{if(r.has(u))return r.get(u);let[c,d]=wo(u);switch(c){case Ic:{let m=u;switch(d){case"bigint":c=W_,m=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);m=null;break;case"undefined":return a([K_],u)}return a([c,m],u)}case jo:{if(d){let x=u;return d==="DataView"?x=new Uint8Array(u.buffer):d==="ArrayBuffer"&&(x=new Uint8Array(u)),a([d,[...x]],u)}const m=[],p=a([c,m],u);for(const x of u)m.push(s(x));return p}case yc:{if(d)switch(d){case"BigInt":return a([d,u.toString()],u);case"Boolean":case"Number":case"String":return a([d,u.valueOf()],u)}if(n&&"toJSON"in u)return s(u.toJSON());const m=[],p=a([c,m],u);for(const x of r6(u))(e||!Gu(wo(u[x])))&&m.push([s(x),s(u[x])]);return p}case Ym:return a([c,u.toISOString()],u);case Fm:{const{source:m,flags:p}=u;return a([c,{source:m,flags:p}],u)}case Xm:{const m=[],p=a([c,m],u);for(const[x,v]of u)(e||!(Gu(wo(x))||Gu(wo(v))))&&m.push([s(x),s(v)]);return p}case Qm:{const m=[],p=a([c,m],u);for(const x of u)(e||!Gu(wo(x)))&&m.push(s(x));return p}}const{message:h}=u;return a([c,{name:d,message:h}],u)};return s},Hb=(e,{json:n,lossy:r}={})=>{const l=[];return i6(!(n||r),!!n,new Map,l)(e),l},vc=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?Lb(Hb(e,n)):structuredClone(e):(e,n)=>Lb(Hb(e,n));function l6(e,n){const r=[{type:"text",value:"↩"}];return n>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),r}function a6(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function o6(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||l6,l=e.options.footnoteBackLabel||a6,a=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let d=-1;for(;++d0&&w.push({type:"text",value:" "});let T=typeof r=="string"?r:r(d,v);typeof T=="string"&&(T={type:"text",value:T}),w.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+x+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof l=="string"?l:l(d,v),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}const _=m[m.length-1];if(_&&_.type==="element"&&_.tagName==="p"){const T=_.children[_.children.length-1];T&&T.type==="text"?T.value+=" ":_.children.push({type:"text",value:" "}),_.children.push(...w)}else m.push(...w);const S={type:"element",tagName:"li",properties:{id:n+"fn-"+x},children:e.wrap(m,!0)};e.patch(h,S),c.push(S)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...vc(u),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:` -`},{type:"element",tagName:"ol",properties:{},children:e.wrap(c,!0)},{type:"text",value:` -`}]}}const qc=(function(e){if(e==null)return f6;if(typeof e=="function")return Uc(e);if(typeof e=="object")return Array.isArray(e)?s6(e):u6(e);if(typeof e=="string")return c6(e);throw new Error("Expected function, string, or object as test")});function s6(e){const n=[];let r=-1;for(;++r":""))+")"})}return x;function x(){let v=eE,w,k,_;if((!n||s(d,h,m[m.length-1]||void 0))&&(v=m6(r(d,m)),v[0]===am))return v;if("children"in d&&d.children){const S=d;if(S.children&&v[0]!==p6)for(k=(l?S.children.length:-1)+u,_=m.concat(S);k>-1&&k0&&r.push({type:"text",value:` -`}),r}function Bb(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function Ib(e,n){const r=x6(e,n),l=r.one(e,void 0),a=o6(r),s=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return a&&s.children.push({type:"text",value:` -`},a),s}function S6(e,n){return e&&"run"in e?async function(r,l){const a=Ib(r,{file:l,...n});await e.run(a,l)}:function(r,l){return Ib(r,{file:l,...e||n})}}function qb(e){if(e)throw e}var _p,Ub;function _6(){if(Ub)return _p;Ub=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,l=Object.getOwnPropertyDescriptor,a=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 x;for(x in h);return typeof x>"u"||e.call(h,x)},u=function(h,m){r&&m.name==="__proto__"?r(h,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):h[m.name]=m.newValue},c=function(h,m){if(m==="__proto__")if(e.call(h,m)){if(l)return l(h,m).value}else return;return h[m]};return _p=function d(){var h,m,p,x,v,w,k=arguments[0],_=1,S=arguments.length,T=!1;for(typeof k=="boolean"&&(T=k,k=arguments[1]||{},_=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});_u.length;let d;c&&u.push(a);try{d=e.apply(this,u)}catch(h){const m=h;if(c&&r)throw m;return a(m)}c||(d&&d.then&&typeof d.then=="function"?d.then(s,a):d instanceof Error?a(d):s(d))}function a(u,...c){r||(r=!0,n(u,...c))}function s(u){a(null,u)}}const tr={basename:C6,dirname:T6,extname:A6,join:z6,sep:"/"};function C6(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');as(e);let r=0,l=-1,a=e.length,s;if(n===void 0||n.length===0||n.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(s){r=a+1;break}}else l<0&&(s=!0,l=a+1);return l<0?"":e.slice(r,l)}if(n===e)return"";let u=-1,c=n.length-1;for(;a--;)if(e.codePointAt(a)===47){if(s){r=a+1;break}}else u<0&&(s=!0,u=a+1),c>-1&&(e.codePointAt(a)===n.codePointAt(c--)?c<0&&(l=a):(c=-1,l=u));return r===l?l=u:l<0&&(l=e.length),e.slice(r,l)}function T6(e){if(as(e),e.length===0)return".";let n=-1,r=e.length,l;for(;--r;)if(e.codePointAt(r)===47){if(l){n=r;break}}else l||(l=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function A6(e){as(e);let n=e.length,r=-1,l=0,a=-1,s=0,u;for(;n--;){const c=e.codePointAt(n);if(c===47){if(u){l=n+1;break}continue}r<0&&(u=!0,r=n+1),c===46?a<0?a=n:s!==1&&(s=1):a>-1&&(s=-1)}return a<0||r<0||s===0||s===1&&a===r-1&&a===l+1?"":e.slice(a,r)}function z6(...e){let n=-1,r;for(;++n0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function j6(e,n){let r="",l=0,a=-1,s=0,u=-1,c,d;for(;++u<=e.length;){if(u2){if(d=r.lastIndexOf("/"),d!==r.length-1){d<0?(r="",l=0):(r=r.slice(0,d),l=r.length-1-r.lastIndexOf("/")),a=u,s=0;continue}}else if(r.length>0){r="",l=0,a=u,s=0;continue}}n&&(r=r.length>0?r+"/..":"..",l=2)}else r.length>0?r+="/"+e.slice(a+1,u):r=e.slice(a+1,u),l=u-a-1;a=u,s=0}else c===46&&s>-1?s++:s=-1}return r}function as(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const D6={cwd:R6};function R6(){return"/"}function um(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function O6(e){if(typeof e=="string")e=new URL(e);else if(!um(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 L6(e)}function L6(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 r=-1;for(;++r0){let[v,...w]=m;const k=l[x][1];sm(k)&&sm(v)&&(v=Ep(!0,k,v)),l[x]=[h,v,...w]}}}}const q6=new Km().freeze();function Tp(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ap(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function zp(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 Pb(e){if(!sm(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function $b(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function Yu(e){return U6(e)?e:new nE(e)}function U6(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function V6(e){return typeof e=="string"||P6(e)}function P6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const $6="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Gb=[],Yb={allowDangerousHtml:!0},G6=/^(https?|ircs?|mailto|xmpp)$/i,Y6=[{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 F6(e){const n=X6(e),r=Q6(e);return Z6(n.runSync(n.parse(r),r),e)}function X6(e){const n=e.rehypePlugins||Gb,r=e.remarkPlugins||Gb,l=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Yb}:Yb;return q6().use(TO).use(r).use(S6,l).use(n)}function Q6(e){const n=e.children||"",r=new nE;return typeof n=="string"&&(r.value=n),r}function Z6(e,n){const r=n.allowedElements,l=n.allowElement,a=n.components,s=n.disallowedElements,u=n.skipHtml,c=n.unwrapDisallowed,d=n.urlTransform||K6;for(const m of Y6)Object.hasOwn(n,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+$6+m.id,void 0);return Zm(e,h),fD(e,{Fragment:b.Fragment,components:a,ignoreInvalidStyle:!0,jsx:b.jsx,jsxs:b.jsxs,passKeys:!0,passNode:!0});function h(m,p,x){if(m.type==="raw"&&x&&typeof p=="number")return u?x.children.splice(p,1):x.children[p]={type:"text",value:m.value},p;if(m.type==="element"){let v;for(v in bp)if(Object.hasOwn(bp,v)&&Object.hasOwn(m.properties,v)){const w=m.properties[v],k=bp[v];(k===null||k.includes(m.tagName))&&(m.properties[v]=d(String(w||""),v,m))}}if(m.type==="element"){let v=r?!r.includes(m.tagName):s?s.includes(m.tagName):!1;if(!v&&l&&typeof p=="number"&&(v=!l(m,p,x)),v&&x&&typeof p=="number")return c&&m.children?x.children.splice(p,1,...m.children):x.children.splice(p,1),p}}}function K6(e){const n=e.indexOf(":"),r=e.indexOf("?"),l=e.indexOf("#"),a=e.indexOf("/");return n===-1||a!==-1&&n>a||r!==-1&&n>r||l!==-1&&n>l||G6.test(e.slice(0,n))?e:""}function Fb(e,n){const r=String(e);if(typeof n!="string")throw new TypeError("Expected character");let l=0,a=r.indexOf(n);for(;a!==-1;)l++,a=r.indexOf(n,a+n.length);return l}function J6(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function W6(e,n,r){const a=qc((r||{}).ignore||[]),s=eL(n);let u=-1;for(;++u0?{type:"text",value:z}:void 0),z===!1?x.lastIndex=A+1:(w!==A&&T.push({type:"text",value:h.value.slice(w,A)}),Array.isArray(z)?T.push(...z):z&&T.push(z),w=A+E[0].length,S=!0),!x.global)break;E=x.exec(h.value)}return S?(w?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],l=r.indexOf(")");const a=Fb(e,"(");let s=Fb(e,")");for(;l!==-1&&a>s;)e+=r.slice(0,l+1),r=r.slice(l+1),l=r.indexOf(")"),s++;return[e,r]}function rE(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||nl(r)||Hc(r))&&(!n||r!==47)}iE.peek=_L;function mL(){this.buffer()}function gL(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function xL(){this.buffer()}function yL(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function vL(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Yn(this.sliceSerialize(e)).toLowerCase(),r.label=n}function bL(e){this.exit(e)}function wL(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Yn(this.sliceSerialize(e)).toLowerCase(),r.label=n}function SL(e){this.exit(e)}function _L(){return"["}function iE(e,n,r,l){const a=r.createTracker(l);let s=a.move("[^");const u=r.enter("footnoteReference"),c=r.enter("reference");return s+=a.move(r.safe(r.associationId(e),{after:"]",before:s})),c(),u(),s+=a.move("]"),s}function EL(){return{enter:{gfmFootnoteCallString:mL,gfmFootnoteCall:gL,gfmFootnoteDefinitionLabelString:xL,gfmFootnoteDefinition:yL},exit:{gfmFootnoteCallString:vL,gfmFootnoteCall:bL,gfmFootnoteDefinitionLabelString:wL,gfmFootnoteDefinition:SL}}}function kL(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:iE},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(l,a,s,u){const c=s.createTracker(u);let d=c.move("[^");const h=s.enter("footnoteDefinition"),m=s.enter("label");return d+=c.move(s.safe(s.associationId(l),{before:d,after:"]"})),m(),d+=c.move("]:"),l.children&&l.children.length>0&&(c.shift(4),d+=c.move((n?` -`:" ")+s.indentLines(s.containerFlow(l,c.current()),n?lE:NL))),h(),d}}function NL(e,n,r){return n===0?e:lE(e,n,r)}function lE(e,n,r){return(r?"":" ")+e}const CL=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];aE.peek=jL;function TL(){return{canContainEols:["delete"],enter:{strikethrough:zL},exit:{strikethrough:ML}}}function AL(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:CL}],handlers:{delete:aE}}}function zL(e){this.enter({type:"delete",children:[]},e)}function ML(e){this.exit(e)}function aE(e,n,r,l){const a=r.createTracker(l),s=r.enter("strikethrough");let u=a.move("~~");return u+=r.containerPhrasing(e,{...a.current(),before:u,after:"~"}),u+=a.move("~~"),s(),u}function jL(){return"~"}function DL(e){return e.length}function RL(e,n){const r=n||{},l=(r.align||[]).concat(),a=r.stringLength||DL,s=[],u=[],c=[],d=[];let h=0,m=-1;for(;++mh&&(h=e[m].length);++Sd[S])&&(d[S]=E)}k.push(T)}u[m]=k,c[m]=_}let p=-1;if(typeof l=="object"&&"length"in l)for(;++pd[p]&&(d[p]=T),v[p]=T),x[p]=E}u.splice(1,0,x),c.splice(1,0,v),m=-1;const w=[];for(;++m "),s.shift(2);const u=r.indentLines(r.containerFlow(e,s.current()),HL);return a(),u}function HL(e,n,r){return">"+(r?"":" ")+e}function BL(e,n){return Qb(e,n.inConstruct,!0)&&!Qb(e,n.notInConstruct,!1)}function Qb(e,n,r){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return r;let l=-1;for(;++lu&&(u=s):s=1,a=l+n.length,l=r.indexOf(n,a);return u}function qL(e,n){return!!(n.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function UL(e){const n=e.options.fence||"`";if(n!=="`"&&n!=="~")throw new Error("Cannot serialize code with `"+n+"` for `options.fence`, expected `` ` `` or `~`");return n}function VL(e,n,r,l){const a=UL(r),s=e.value||"",u=a==="`"?"GraveAccent":"Tilde";if(qL(e,r)){const p=r.enter("codeIndented"),x=r.indentLines(s,PL);return p(),x}const c=r.createTracker(l),d=a.repeat(Math.max(IL(s,a)+1,3)),h=r.enter("codeFenced");let m=c.move(d);if(e.lang){const p=r.enter(`codeFencedLang${u}`);m+=c.move(r.safe(e.lang,{before:m,after:" ",encode:["`"],...c.current()})),p()}if(e.lang&&e.meta){const p=r.enter(`codeFencedMeta${u}`);m+=c.move(" "),m+=c.move(r.safe(e.meta,{before:m,after:` -`,encode:["`"],...c.current()})),p()}return m+=c.move(` -`),s&&(m+=c.move(s+` -`)),m+=c.move(d),h(),m}function PL(e,n,r){return(r?"":" ")+e}function Jm(e){const n=e.options.quote||'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize title with `"+n+"` for `options.quote`, expected `\"`, or `'`");return n}function $L(e,n,r,l){const a=Jm(r),s=a==='"'?"Quote":"Apostrophe",u=r.enter("definition");let c=r.enter("label");const d=r.createTracker(l);let h=d.move("[");return h+=d.move(r.safe(r.associationId(e),{before:h,after:"]",...d.current()})),h+=d.move("]: "),c(),!e.url||/[\0- \u007F]/.test(e.url)?(c=r.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(r.safe(e.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(c=r.enter("destinationRaw"),h+=d.move(r.safe(e.url,{before:h,after:e.title?" ":` -`,...d.current()}))),c(),e.title&&(c=r.enter(`title${s}`),h+=d.move(" "+a),h+=d.move(r.safe(e.title,{before:h,after:a,...d.current()})),h+=d.move(a),c()),u(),h}function GL(e){const n=e.options.emphasis||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize emphasis with `"+n+"` for `options.emphasis`, expected `*`, or `_`");return n}function Yo(e){return"&#x"+e.toString(16).toUpperCase()+";"}function bc(e,n,r){const l=pa(e),a=pa(n);return l===void 0?a===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:l===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}oE.peek=YL;function oE(e,n,r,l){const a=GL(r),s=r.enter("emphasis"),u=r.createTracker(l),c=u.move(a);let d=u.move(r.containerPhrasing(e,{after:a,before:c,...u.current()}));const h=d.charCodeAt(0),m=bc(l.before.charCodeAt(l.before.length-1),h,a);m.inside&&(d=Yo(h)+d.slice(1));const p=d.charCodeAt(d.length-1),x=bc(l.after.charCodeAt(0),p,a);x.inside&&(d=d.slice(0,-1)+Yo(p));const v=u.move(a);return s(),r.attentionEncodeSurroundingInfo={after:x.outside,before:m.outside},c+d+v}function YL(e,n,r){return r.options.emphasis||"*"}function FL(e,n){let r=!1;return Zm(e,function(l){if("value"in l&&/\r?\n|\r/.test(l.value)||l.type==="break")return r=!0,am}),!!((!e.depth||e.depth<3)&&Pm(e)&&(n.options.setext||r))}function XL(e,n,r,l){const a=Math.max(Math.min(6,e.depth||1),1),s=r.createTracker(l);if(FL(e,r)){const m=r.enter("headingSetext"),p=r.enter("phrasing"),x=r.containerPhrasing(e,{...s.current(),before:` -`,after:` -`});return p(),m(),x+` -`+(a===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(` -`))+1))}const u="#".repeat(a),c=r.enter("headingAtx"),d=r.enter("phrasing");s.move(u+" ");let h=r.containerPhrasing(e,{before:"# ",after:` -`,...s.current()});return/^[\t ]/.test(h)&&(h=Yo(h.charCodeAt(0))+h.slice(1)),h=h?u+" "+h:u,r.options.closeAtx&&(h+=" "+u),d(),c(),h}sE.peek=QL;function sE(e){return e.value||""}function QL(){return"<"}uE.peek=ZL;function uE(e,n,r,l){const a=Jm(r),s=a==='"'?"Quote":"Apostrophe",u=r.enter("image");let c=r.enter("label");const d=r.createTracker(l);let h=d.move("![");return h+=d.move(r.safe(e.alt,{before:h,after:"]",...d.current()})),h+=d.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=r.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(r.safe(e.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(c=r.enter("destinationRaw"),h+=d.move(r.safe(e.url,{before:h,after:e.title?" ":")",...d.current()}))),c(),e.title&&(c=r.enter(`title${s}`),h+=d.move(" "+a),h+=d.move(r.safe(e.title,{before:h,after:a,...d.current()})),h+=d.move(a),c()),h+=d.move(")"),u(),h}function ZL(){return"!"}cE.peek=KL;function cE(e,n,r,l){const a=e.referenceType,s=r.enter("imageReference");let u=r.enter("label");const c=r.createTracker(l);let d=c.move("![");const h=r.safe(e.alt,{before:d,after:"]",...c.current()});d+=c.move(h+"]["),u();const m=r.stack;r.stack=[],u=r.enter("reference");const p=r.safe(r.associationId(e),{before:d,after:"]",...c.current()});return u(),r.stack=m,s(),a==="full"||!h||h!==p?d+=c.move(p+"]"):a==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function KL(){return"!"}fE.peek=JL;function fE(e,n,r){let l=e.value||"",a="`",s=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(l);)a+="`";for(/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^`|`$/.test(l))&&(l=" "+l+" ");++s\u007F]/.test(e.url))}hE.peek=WL;function hE(e,n,r,l){const a=Jm(r),s=a==='"'?"Quote":"Apostrophe",u=r.createTracker(l);let c,d;if(dE(e,r)){const m=r.stack;r.stack=[],c=r.enter("autolink");let p=u.move("<");return p+=u.move(r.containerPhrasing(e,{before:p,after:">",...u.current()})),p+=u.move(">"),c(),r.stack=m,p}c=r.enter("link"),d=r.enter("label");let h=u.move("[");return h+=u.move(r.containerPhrasing(e,{before:h,after:"](",...u.current()})),h+=u.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=r.enter("destinationLiteral"),h+=u.move("<"),h+=u.move(r.safe(e.url,{before:h,after:">",...u.current()})),h+=u.move(">")):(d=r.enter("destinationRaw"),h+=u.move(r.safe(e.url,{before:h,after:e.title?" ":")",...u.current()}))),d(),e.title&&(d=r.enter(`title${s}`),h+=u.move(" "+a),h+=u.move(r.safe(e.title,{before:h,after:a,...u.current()})),h+=u.move(a),d()),h+=u.move(")"),c(),h}function WL(e,n,r){return dE(e,r)?"<":"["}pE.peek=e8;function pE(e,n,r,l){const a=e.referenceType,s=r.enter("linkReference");let u=r.enter("label");const c=r.createTracker(l);let d=c.move("[");const h=r.containerPhrasing(e,{before:d,after:"]",...c.current()});d+=c.move(h+"]["),u();const m=r.stack;r.stack=[],u=r.enter("reference");const p=r.safe(r.associationId(e),{before:d,after:"]",...c.current()});return u(),r.stack=m,s(),a==="full"||!h||h!==p?d+=c.move(p+"]"):a==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function e8(){return"["}function Wm(e){const n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function t8(e){const n=Wm(e),r=e.options.bulletOther;if(!r)return n==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+r+"`) to be different");return r}function n8(e){const n=e.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function mE(e){const n=e.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function r8(e,n,r,l){const a=r.enter("list"),s=r.bulletCurrent;let u=e.ordered?n8(r):Wm(r);const c=e.ordered?u==="."?")":".":t8(r);let d=n&&r.bulletLastUsed?u===r.bulletLastUsed:!1;if(!e.ordered){const m=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&m&&(!m.children||!m.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(d=!0),mE(r)===u&&m){let p=-1;for(;++p-1?n.start:1)+(r.options.incrementListMarker===!1?0:n.children.indexOf(e))+s);let u=s.length+1;(a==="tab"||a==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(u=Math.ceil(u/4)*4);const c=r.createTracker(l);c.move(s+" ".repeat(u-s.length)),c.shift(u);const d=r.enter("listItem"),h=r.indentLines(r.containerFlow(e,c.current()),m);return d(),h;function m(p,x,v){return x?(v?"":" ".repeat(u))+p:(v?s:s+" ".repeat(u-s.length))+p}}function a8(e,n,r,l){const a=r.enter("paragraph"),s=r.enter("phrasing"),u=r.containerPhrasing(e,l);return s(),a(),u}const o8=qc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function s8(e,n,r,l){return(e.children.some(function(u){return o8(u)})?r.containerPhrasing:r.containerFlow).call(r,e,l)}function u8(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}gE.peek=c8;function gE(e,n,r,l){const a=u8(r),s=r.enter("strong"),u=r.createTracker(l),c=u.move(a+a);let d=u.move(r.containerPhrasing(e,{after:a,before:c,...u.current()}));const h=d.charCodeAt(0),m=bc(l.before.charCodeAt(l.before.length-1),h,a);m.inside&&(d=Yo(h)+d.slice(1));const p=d.charCodeAt(d.length-1),x=bc(l.after.charCodeAt(0),p,a);x.inside&&(d=d.slice(0,-1)+Yo(p));const v=u.move(a+a);return s(),r.attentionEncodeSurroundingInfo={after:x.outside,before:m.outside},c+d+v}function c8(e,n,r){return r.options.strong||"*"}function f8(e,n,r,l){return r.safe(e.value,l)}function d8(e){const n=e.options.ruleRepetition||3;if(n<3)throw new Error("Cannot serialize rules with repetition `"+n+"` for `options.ruleRepetition`, expected `3` or more");return n}function h8(e,n,r){const l=(mE(r)+(r.options.ruleSpaces?" ":"")).repeat(d8(r));return r.options.ruleSpaces?l.slice(0,-1):l}const xE={blockquote:LL,break:Zb,code:VL,definition:$L,emphasis:oE,hardBreak:Zb,heading:XL,html:sE,image:uE,imageReference:cE,inlineCode:fE,link:hE,linkReference:pE,list:r8,listItem:l8,paragraph:a8,root:s8,strong:gE,text:f8,thematicBreak:h8};function p8(){return{enter:{table:m8,tableData:Kb,tableHeader:Kb,tableRow:x8},exit:{codeText:y8,table:g8,tableData:Rp,tableHeader:Rp,tableRow:Rp}}}function m8(e){const n=e._align;this.enter({type:"table",align:n.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function g8(e){this.exit(e),this.data.inTable=void 0}function x8(e){this.enter({type:"tableRow",children:[]},e)}function Rp(e){this.exit(e)}function Kb(e){this.enter({type:"tableCell",children:[]},e)}function y8(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,v8));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function v8(e,n){return n==="|"?n:e}function b8(e){const n=e||{},r=n.tableCellPadding,l=n.tablePipeAlign,a=n.stringLength,s=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` -`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:u,tableCell:d,tableRow:c}};function u(v,w,k,_){return h(m(v,k,_),v.align)}function c(v,w,k,_){const S=p(v,k,_),T=h([S]);return T.slice(0,T.indexOf(` -`))}function d(v,w,k,_){const S=k.enter("tableCell"),T=k.enter("phrasing"),E=k.containerPhrasing(v,{..._,before:s,after:s});return T(),S(),E}function h(v,w){return RL(v,{align:w,alignDelimiters:l,padding:r,stringLength:a})}function m(v,w,k){const _=v.children;let S=-1;const T=[],E=w.enter("table");for(;++S<_.length;)T[S]=p(_[S],w,k);return E(),T}function p(v,w,k){const _=v.children;let S=-1;const T=[],E=w.enter("tableRow");for(;++S<_.length;)T[S]=d(_[S],v,w,k);return E(),T}function x(v,w,k){let _=xE.inlineCode(v,w,k);return k.stack.includes("tableCell")&&(_=_.replace(/\|/g,"\\$&")),_}}function w8(){return{exit:{taskListCheckValueChecked:Jb,taskListCheckValueUnchecked:Jb,paragraph:_8}}}function S8(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:E8}}}function Jb(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function _8(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const l=r.children[0];if(l&&l.type==="text"){const a=n.children;let s=-1,u;for(;++s0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const B8={tokenize:Y8,partial:!0};function I8(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:P8,continuation:{tokenize:$8},exit:G8}},text:{91:{name:"gfmFootnoteCall",tokenize:V8},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:q8,resolveTo:U8}}}}function q8(e,n,r){const l=this;let a=l.events.length;const s=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let u;for(;a--;){const d=l.events[a][1];if(d.type==="labelImage"){u=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return c;function c(d){if(!u||!u._balanced)return r(d);const h=Yn(l.sliceSerialize({start:u.end,end:l.now()}));return h.codePointAt(0)!==94||!s.includes(h.slice(1))?r(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),n(d))}}function U8(e,n){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const l={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},c=[e[r+1],e[r+2],["enter",l,n],e[r+3],e[r+4],["enter",a,n],["exit",a,n],["enter",s,n],["enter",u,n],["exit",u,n],["exit",s,n],e[e.length-2],e[e.length-1],["exit",l,n]];return e.splice(r,e.length-r+1,...c),e}function V8(e,n,r){const l=this,a=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let s=0,u;return c;function c(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),d}function d(p){return p!==94?r(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(p){if(s>999||p===93&&!u||p===null||p===91||ot(p))return r(p);if(p===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return a.includes(Yn(l.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):r(p)}return ot(p)||(u=!0),s++,e.consume(p),p===92?m:h}function m(p){return p===91||p===92||p===93?(e.consume(p),s++,h):h(p)}}function P8(e,n,r){const l=this,a=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let s,u=0,c;return d;function d(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",m):r(w)}function m(w){if(u>999||w===93&&!c||w===null||w===91||ot(w))return r(w);if(w===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return s=Yn(l.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return ot(w)||(c=!0),u++,e.consume(w),w===92?p:m}function p(w){return w===91||w===92||w===93?(e.consume(w),u++,m):m(w)}function x(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),a.includes(s)||a.push(s),Ye(e,v,"gfmFootnoteDefinitionWhitespace")):r(w)}function v(w){return n(w)}}function $8(e,n,r){return e.check(ls,n,e.attempt(B8,n,r))}function G8(e){e.exit("gfmFootnoteDefinition")}function Y8(e,n,r){const l=this;return Ye(e,a,"gfmFootnoteDefinitionIndent",5);function a(s){const u=l.events[l.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?n(s):r(s)}}function F8(e){let r=(e||{}).singleTilde;const l={name:"strikethrough",tokenize:s,resolveAll:a};return r==null&&(r=!0),{text:{126:l},insideSpan:{null:[l]},attentionMarkers:{null:[126]}};function a(u,c){let d=-1;for(;++d1?d(w):(u.consume(w),p++,v);if(p<2&&!r)return d(w);const _=u.exit("strikethroughSequenceTemporary"),S=pa(w);return _._open=!S||S===2&&!!k,_._close=!k||k===2&&!!S,c(w)}}}class X8{constructor(){this.map=[]}add(n,r,l){Q8(this,n,r,l)}consume(n){if(this.map.sort(function(s,u){return s[0]-u[0]}),this.map.length===0)return;let r=this.map.length;const l=[];for(;r>0;)r-=1,l.push(n.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),n.length=this.map[r][0];l.push(n.slice()),n.length=0;let a=l.pop();for(;a;){for(const s of a)n.push(s);a=l.pop()}this.map.length=0}}function Q8(e,n,r,l){let a=0;if(!(r===0&&l.length===0)){for(;a-1;){const B=l.events[L][1].type;if(B==="lineEnding"||B==="linePrefix")L--;else break}const q=L>-1?l.events[L][1].type:null,ee=q==="tableHead"||q==="tableRow"?z:d;return ee===z&&l.parser.lazy[l.now().line]?r(O):ee(O)}function d(O){return e.enter("tableHead"),e.enter("tableRow"),h(O)}function h(O){return O===124||(u=!0,s+=1),m(O)}function m(O){return O===null?r(O):ke(O)?s>1?(s=0,l.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),v):r(O):Ie(O)?Ye(e,m,"whitespace")(O):(s+=1,u&&(u=!1,a+=1),O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),u=!0,m):(e.enter("data"),p(O)))}function p(O){return O===null||O===124||ot(O)?(e.exit("data"),m(O)):(e.consume(O),O===92?x:p)}function x(O){return O===92||O===124?(e.consume(O),p):p(O)}function v(O){return l.interrupt=!1,l.parser.lazy[l.now().line]?r(O):(e.enter("tableDelimiterRow"),u=!1,Ie(O)?Ye(e,w,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):w(O))}function w(O){return O===45||O===58?_(O):O===124?(u=!0,e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),k):U(O)}function k(O){return Ie(O)?Ye(e,_,"whitespace")(O):_(O)}function _(O){return O===58?(s+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),S):O===45?(s+=1,S(O)):O===null||ke(O)?A(O):U(O)}function S(O){return O===45?(e.enter("tableDelimiterFiller"),T(O)):U(O)}function T(O){return O===45?(e.consume(O),T):O===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(O))}function E(O){return Ie(O)?Ye(e,A,"whitespace")(O):A(O)}function A(O){return O===124?w(O):O===null||ke(O)?!u||a!==s?U(O):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(O)):U(O)}function U(O){return r(O)}function z(O){return e.enter("tableRow"),H(O)}function H(O){return O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),H):O===null||ke(O)?(e.exit("tableRow"),n(O)):Ie(O)?Ye(e,H,"whitespace")(O):(e.enter("data"),R(O))}function R(O){return O===null||O===124||ot(O)?(e.exit("data"),H(O)):(e.consume(O),O===92?V:R)}function V(O){return O===92||O===124?(e.consume(O),R):R(O)}}function W8(e,n){let r=-1,l=!0,a=0,s=[0,0,0,0],u=[0,0,0,0],c=!1,d=0,h,m,p;const x=new X8;for(;++rr[2]+1){const w=r[2]+1,k=r[3]-r[2]-1;e.add(w,k,[])}}e.add(r[3]+1,0,[["exit",p,n]])}return a!==void 0&&(s.end=Object.assign({},Kl(n.events,a)),e.add(a,0,[["exit",s,n]]),s=void 0),s}function Wb(e,n,r,l,a){const s=[],u=Kl(n.events,r);a&&(a.end=Object.assign({},u),s.push(["exit",a,n])),l.end=Object.assign({},u),s.push(["exit",l,n]),e.add(r+1,0,s)}function Kl(e,n){const r=e[n],l=r[0]==="enter"?"start":"end";return r[1][l]}const e9={name:"tasklistCheck",tokenize:n9};function t9(){return{text:{91:e9}}}function n9(e,n,r){const l=this;return a;function a(d){return l.previous!==null||!l._gfmTasklistFirstContentOfListItem?r(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),s)}function s(d){return ot(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),u):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),u):r(d)}function u(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),c):r(d)}function c(d){return ke(d)?n(d):Ie(d)?e.check({tokenize:r9},n,r)(d):r(d)}}function r9(e,n,r){return Ye(e,l,"whitespace");function l(a){return a===null?r(a):n(a)}}function i9(e){return L_([A8(),I8(),F8(e),K8(),t9()])}const l9={};function a9(e){const n=this,r=e||l9,l=n.data(),a=l.micromarkExtensions||(l.micromarkExtensions=[]),s=l.fromMarkdownExtensions||(l.fromMarkdownExtensions=[]),u=l.toMarkdownExtensions||(l.toMarkdownExtensions=[]);a.push(i9(r)),s.push(k8()),u.push(N8(r))}function o9({node:e}){const n=he(E=>E.sendGateResponse),r=he(E=>E.wsStatus),[l,a]=P.useState(null),[s,u]=P.useState(""),[c,d]=P.useState(null),[h,m]=P.useState(!1),p=e.status==="waiting",x=e.status==="completed";P.useEffect(()=>{p&&(a(null),u(""),d(null),m(!1))},[p]);const v=p&&r==="connected"&&l===null,w=(E,A)=>{if(v){if(A){a(E),d(A);return}a(E),m(!0),n(e.name,E)}},k=()=>{if(l===null||c===null)return;const E={[c]:s};m(!0),n(e.name,l,E),d(null)},_=e.option_details,S=_==null?void 0:_.find(E=>E.value===e.selected_option),T=(S==null?void 0:S.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(Op,{text:e.prompt,muted:!1})}),_&&_.length>0&&b.jsxs("div",{className:"space-y-2",children:[b.jsx("div",{className:"flex flex-col gap-1.5",children:_.map(E=>{const A=l===E.value,U=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":U?"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(Yi,{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 ${U?"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&&!c&&b.jsxs("div",{className:"flex items-center gap-2 px-1",children:[b.jsx(Do,{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"})]}),!_&&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))})]}),c&&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:c})}),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 ${c}...`,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(sN,{className:"w-3 h-3"}),"Submit"]})]})]})]})]}),x&&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(Yi,{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(Op,{text:e.prompt,muted:!0})}),T&&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(Yi,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),b.jsx("span",{className:"text-xs font-medium text-[var(--text)]",children:T}),e.route&&b.jsxs("span",{className:"ml-auto text-[10px] text-[var(--text-muted)]",children:["→ ",e.route]})]}),_&&_.length>1&&b.jsx("div",{className:"space-y-1",children:_.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))}),!_&&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(u9,{node:e})]}),!p&&!x&&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(Op,{text:e.prompt,muted:!0})})]})]})}function s9(e){return!(!e||/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//")||e.startsWith("#")||e.startsWith("/")||e.startsWith("\\"))}function Op({text:e,muted:n}){const r=n?"text-[var(--text-muted)]":"text-[var(--text)]";return b.jsx("div",{className:`gate-markdown text-xs leading-relaxed ${r}`,children:b.jsx(F6,{remarkPlugins:[a9],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:a})=>(a==null?void 0:a.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:a})=>{if(s9(l)){const s=`vscode://file/${l}`;return b.jsxs("a",{href:s,className:"inline-flex items-center gap-0.5 text-blue-400 hover:text-blue-300 underline underline-offset-2",title:`Open ${l} in VSCode`,children:[b.jsx(nN,{className:"w-3 h-3 inline flex-shrink-0"}),a]})}return b.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:text-blue-300 underline underline-offset-2",children:a})},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"}),table:({children:l})=>b.jsx("div",{className:"overflow-x-auto my-2",children:b.jsx("table",{className:"text-[11px] border-collapse w-full",children:l})}),th:({children:l})=>b.jsx("th",{className:"border border-[var(--border)] px-2 py-1 text-left bg-[var(--bg)] font-semibold",children:l}),td:({children:l})=>b.jsx("td",{className:"border border-[var(--border)] px-2 py-1",children:l})},children:e})})}function u9({node:e}){const n=[];if(e.route&&n.push({label:"Route",value:`→ ${e.route}`}),e.additional_input){const r=typeof e.additional_input=="object"?JSON.stringify(e.additional_input):e.additional_input;n.push({label:"Additional Input",value:r})}return n.length===0?null:b.jsx(ll,{items:n})}function c9({node:e}){const n=e.status,r=Xe[n]||Xe.pending,a=p4()[e.name],s=e.type==="for_each_group",[u,c]=P.useState(!0),d=[];e.elapsed!=null&&d.push({label:"Elapsed",value:Jt(e.elapsed)}),a&&(d.push({label:"Total",value:a.total}),d.push({label:"Completed",value:a.completed}),a.failed>0&&d.push({label:"Failed",value:a.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:`${r}20`,color:r},children:n}),b.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s?"For-Each Group":"Parallel Group"})]}),a&&a.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:[a.completed+a.failed,"/",a.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:`${(a.completed+a.failed)/a.total*100}%`,background:a.failed>0?`linear-gradient(90deg, var(--completed) ${a.completed/(a.completed+a.failed)*100}%, var(--failed) 0%)`:"var(--completed)"}})})]}),b.jsx(ll,{items:d}),s&&h&&h.length>0&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("button",{onClick:()=>c(!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(rl,{className:"w-3 h-3"}):b.jsx(Dr,{className:"w-3 h-3"}),"Items (",h.length,")"]}),u&&b.jsx("div",{className:"space-y-1",children:h.map(m=>b.jsx(d9,{item:m},`${m.key}-${m.index}`))})]})]})}const f9={running:Xe.running,completed:Xe.completed,failed:Xe.failed};function d9({item:e}){const[n,r]=P.useState(e.status==="running"),l=f9[e.status],a=!!(e.prompt||e.output!=null||e.activity&&e.activity.length>0||e.error_type),s=[];return e.elapsed!=null&&s.push({label:"Elapsed",value:Jt(e.elapsed)}),e.tokens!=null&&s.push({label:"Tokens",value:$n(e.tokens)}),e.cost_usd!=null&&s.push({label:"Cost",value:yi(e.cost_usd)}),b.jsxs("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--surface)] overflow-hidden",children:[b.jsxs("button",{onClick:()=>a&&r(!n),className:"flex items-center gap-2 w-full px-3 py-2 text-left hover:bg-[var(--node-bg)] transition-colors",disabled:!a,children:[a?n?b.jsx(rl,{className:"w-3 h-3 text-[var(--text-muted)] flex-shrink-0"}):b.jsx(Dr,{className:"w-3 h-3 text-[var(--text-muted)] flex-shrink-0"}):e.status==="running"?b.jsx(Do,{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:Jt(e.elapsed)}),e.tokens!=null&&b.jsx("span",{children:$n(e.tokens)}),e.cost_usd!=null&&b.jsx("span",{children:yi(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&&a&&b.jsxs("div",{className:"px-3 py-3 space-y-3 border-t border-[var(--border)]",children:[s.length>0&&b.jsx(ll,{items:s}),e.prompt&&b.jsx(tl,{output:e.prompt,title:"Input / Prompt",defaultExpanded:!1}),e.activity&&e.activity.length>0&&b.jsx(Lm,{activity:e.activity,defaultExpanded:e.status!=="completed"}),e.output!=null&&b.jsx(tl,{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 h9({node:e}){const n=e.status,r=Xe[n]||Xe.pending,l=he(c=>c.navigateIntoSubworkflow),s=p_().filter(c=>c.parentAgent===e.name),u=[];return e.elapsed!=null&&u.push({label:"Elapsed",value:Jt(e.elapsed)}),e.cost_usd!=null&&u.push({label:"Cost",value:yi(e.cost_usd)}),e.tokens!=null&&u.push({label:"Tokens",value:$n(e.tokens)}),e.iteration!=null&&e.iteration>1&&u.push({label:"Iteration",value:e.iteration}),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:`${r}20`,color:r},children:n}),b.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Subworkflow Agent"})]}),b.jsx(ll,{items:u}),s.length>0&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)] font-semibold",children:["Subworkflow Runs (",s.length,")"]}),b.jsx("div",{className:"space-y-1",children:s.map((c,d)=>b.jsx(p9,{ctx:c,onClick:()=>l(e.name,c.iteration)},`${c.parentAgent}-${c.iteration}-${d}`))})]}),n==="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]})]}),s.length===0&&n==="pending"&&b.jsx("div",{className:"text-xs text-[var(--text-muted)] italic",children:"Subworkflow has not started yet."})]})}function p9({ctx:e,onClick:n}){const r=Xe[e.status]||Xe.pending;return b.jsxs("button",{onClick:n,className:"flex items-center gap-2 w-full px-3 py-2 rounded-lg border border-[var(--border)] bg-[var(--surface)] hover:bg-[var(--node-bg)] transition-colors text-left",children:[b.jsx(fm,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r}}),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:e.workflowName||e.workflowFile||"Subworkflow"}),b.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-[var(--text-muted)]",children:[e.agentsTotal>0&&b.jsxs("span",{className:"flex items-center gap-0.5",children:[b.jsx(ow,{className:"w-2.5 h-2.5"}),e.agentsCompleted,"/",e.agentsTotal," agents"]}),e.totalCost>0&&b.jsxs("span",{className:"flex items-center gap-0.5",children:[b.jsx(lw,{className:"w-2.5 h-2.5"}),yi(e.totalCost)]})]})]}),b.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider flex-shrink-0 px-1.5 py-0.5 rounded",style:{backgroundColor:`${r}20`,color:r},children:e.status}),b.jsx(Dr,{className:"w-3.5 h-3.5 flex-shrink-0 text-[var(--text-muted)]"})]})}function m9(){const e=he(c=>c.selectedNode),n=il(),r=he(c=>c.selectNode),[l,a]=P.useState(!1);P.useEffect(()=>(requestAnimationFrame(()=>a(!0)),()=>a(!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 L5;case"human_gate":return o9;case"parallel_group":case"for_each_group":return c9;case"workflow":return h9;default:return R5}})();return b.jsxs("div",{className:Be("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:()=>r(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(Qo,{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 nc(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function g9(){const e=he(_=>_.eventLog),n=he(_=>_.activityLog),r=he(_=>_.workflowOutput),l=he(_=>_.workflowStatus),[a,s]=P.useState("log"),[u,c]=P.useState(!1),[d,h]=P.useState(0),[m,p]=P.useState(0),x=P.useCallback(_=>{s(_),_==="log"&&h(e.length),_==="activity"&&p(n.length)},[e.length,n.length]);P.useEffect(()=>{a==="log"&&h(e.length)},[a,e.length]),P.useEffect(()=>{a==="activity"&&p(n.length)},[a,n.length]),P.useEffect(()=>{l==="completed"&&r!=null&&s("output")},[l,r]);const v=r!=null,w=a!=="log"?Math.max(0,e.length-d):0,k=a!=="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:()=>c(!1),className:"flex items-center gap-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)] transition-colors",children:[b.jsx(Q2,{className:"w-3 h-3"}),b.jsx(Fy,{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(Lp,{active:a==="log",onClick:()=>x("log"),icon:b.jsx(Fy,{className:"w-3 h-3"}),label:"Log",count:e.length,unread:w}),b.jsx(Lp,{active:a==="activity",onClick:()=>x("activity"),icon:b.jsx(iw,{className:"w-3 h-3"}),label:"Activity",count:n.length,unread:k}),b.jsx(Lp,{active:a==="output",onClick:()=>x("output"),icon:b.jsx(tN,{className:"w-3 h-3"}),label:"Output",badge:v?l==="failed"?"error":"success":void 0})]}),b.jsx("button",{onClick:()=>c(!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(rl,{className:"w-3.5 h-3.5"})})]}),b.jsx("div",{className:"flex-1 overflow-hidden",children:a==="activity"?b.jsx(x9,{entries:n}):a==="log"?b.jsx(y9,{entries:e}):b.jsx(v9,{output:r,status:l})})]})}function Lp({active:e,onClick:n,icon:r,label:l,count:a,badge:s,unread:u}){return b.jsxs("button",{onClick:n,className:Be("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:[r,b.jsx("span",{children:l}),a!=null&&a>0&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] tabular-nums",children:a}),s&&b.jsx("span",{className:Be("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 ew={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 x9({entries:e}){const n=P.useRef(null),r=P.useRef(!0),l=he(d=>d.selectNode),[a,s]=P.useState(""),u=P.useCallback(()=>{const d=n.current;if(!d)return;const h=d.scrollHeight-d.scrollTop-d.clientHeight<30;r.current=h},[]),c=P.useMemo(()=>{if(!a)return e;const d=a.toLowerCase();return e.filter(h=>h.source.toLowerCase().includes(d)||nc(h.message).toLowerCase().includes(d))},[e,a]);return P.useEffect(()=>{n.current&&r.current&&(n.current.scrollTop=n.current.scrollHeight)},[c.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:a,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"}),a&&b.jsxs(b.Fragment,{children:[b.jsxs("span",{className:"text-[10px] text-[var(--text-muted)] tabular-nums flex-shrink-0",children:[c.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(Qo,{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:[c.map((d,h)=>{const m=ew[d.type]||ew.message,p=NE(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:Be("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:Be("break-words min-w-0",m.color,d.type==="reasoning"&&"italic"),children:nc(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:nc(d.detail)})]},h)}),a&&c.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 "',a,'"']})})]})]})}const tw={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 y9({entries:e}){const n=P.useRef(null),r=P.useRef(!0),l=he(s=>s.selectNode),a=P.useCallback(()=>{const s=n.current;if(!s)return;const u=s.scrollHeight-s.scrollTop-s.clientHeight<30;r.current=u},[]);return P.useEffect(()=>{n.current&&r.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:a,className:"h-full overflow-y-auto font-mono text-[11px] leading-[1.6] px-3 py-2",children:e.map((s,u)=>{const c=tw[s.level]||tw.info,d=NE(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:Be("flex-shrink-0 w-3 text-center select-none",c.color),children:c.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:Be("break-words",s.level==="error"?"text-red-400":s.level==="success"?"text-green-400":"text-[var(--text)]"),children:nc(s.message)})]},u)})})}function NE(e){const n=new Date(e*1e3),r=n.getHours().toString().padStart(2,"0"),l=n.getMinutes().toString().padStart(2,"0"),a=n.getSeconds().toString().padStart(2,"0");return`${r}:${l}:${a}`}function v9({output:e,status:n}){const[r,l]=P.useState(!1),a=uw(e),s=async()=>{a&&(await navigator.clipboard.writeText(a),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:r?b.jsxs(b.Fragment,{children:[b.jsx(Yi,{className:"w-3 h-3 text-[var(--completed)]"}),b.jsx("span",{className:"text-[var(--completed)]",children:"Copied"})]}):b.jsxs(b.Fragment,{children:[b.jsx(aw,{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(b9,{text:a}):a})})]})}function b9({text:e}){const n=e.split(/("(?:[^"\\]|\\.)*")/g);return b.jsx(b.Fragment,{children:n.map((r,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:r},l)}const a=r.replace(/\b(true|false|null)\b|(-?\d+\.?\d*(?:e[+-]?\d+)?)/gi,(s,u,c)=>u?`${s}`:c?`${s}`:s);return b.jsx("span",{dangerouslySetInnerHTML:{__html:a}},l)})})}function w9(){const e=he(n=>n.selectedNode);return b.jsxs(Bp,{direction:"vertical",className:"flex-1 overflow-hidden",children:[b.jsx(So,{defaultSize:70,minSize:30,children:b.jsxs(Bp,{direction:"horizontal",className:"h-full",children:[b.jsx(So,{defaultSize:e?65:100,minSize:40,children:b.jsx(T5,{})}),e&&b.jsxs(b.Fragment,{children:[b.jsx(Ip,{className:"w-[3px] bg-[var(--border)] hover:bg-[var(--text-muted)] transition-colors cursor-col-resize"}),b.jsx(So,{defaultSize:35,minSize:20,maxSize:60,children:b.jsx(m9,{})})]})]})}),b.jsx(Ip,{className:"h-[3px] bg-[var(--border)] hover:bg-[var(--text-muted)] transition-colors cursor-row-resize"}),b.jsx(So,{defaultSize:30,minSize:5,maxSize:70,collapsible:!0,children:b.jsx(g9,{})})]})}const S9=3e4;function _9(){const e=he(p=>p.processEvent),n=he(p=>p.replayState),r=he(p=>p.setWsStatus),l=he(p=>p.setWsSend),a=P.useRef(null),s=P.useRef(1e3),u=P.useRef(null),c=P.useRef(null),d=P.useRef(()=>{}),h=P.useCallback(()=>{r("reconnecting"),u.current=setTimeout(()=>{s.current=Math.min(s.current*2,S9),d.current()},s.current)},[r]),m=P.useCallback(()=>{r("connecting"),c.current&&c.current.abort();const p=new AbortController;c.current=p,fetch("/api/state",{signal:p.signal}).then(x=>x.json()).then(x=>{x&&x.length>0&&n(x);const w=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;try{const k=new WebSocket(w);a.current=k,k.onopen=()=>{s.current=1e3,r("connected"),l(_=>{k.readyState===WebSocket.OPEN&&k.send(JSON.stringify(_))})},k.onmessage=_=>{try{const S=JSON.parse(_.data);e(S)}catch(S){console.error("Failed to parse WebSocket message:",S)}},k.onclose=()=>{r("disconnected"),l(null),a.current=null,h()},k.onerror=()=>{}}catch{h()}}).catch(x=>{p.signal.aborted||(console.error("Failed to fetch state:",x),h())})},[e,n,r,l,h]);d.current=m,P.useEffect(()=>(m(),()=>{c.current&&c.current.abort(),u.current&&clearTimeout(u.current),a.current&&a.current.close(),l(null)}),[m,l])}function E9(){const e=he(h=>h.setReplayMode),n=he(h=>h.setWsStatus),r=he(h=>h.replayPlaying),l=he(h=>h.replayPosition),a=he(h=>h.replayTotalEvents),s=he(h=>h.replaySpeed),u=he(h=>h.replayEvents),c=he(h=>h.setReplayPosition);P.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=P.useRef(null);P.useEffect(()=>{if(!r||l>=a){d.current&&clearTimeout(d.current),r&&l>=a&&he.getState().setReplayPlaying(!1);return}const h=u[l-1],m=u[l];let p=100;if(h&&m){const x=(m.timestamp-h.timestamp)*1e3;p=Math.max(16,Math.min(x/s,2e3))}return d.current=setTimeout(()=>{c(l+1)},p),()=>{d.current&&clearTimeout(d.current)}},[r,l,a,s,u,c])}function k9(){return _9(),null}function N9(){return E9(),null}function C9(){const[e,n]=P.useState(null),r=he(s=>s.replayMode),l=he(s=>s.selectNode),a=he(s=>s.workflowName);return P.useEffect(()=>{fetch("/api/replay/info").then(s=>{s.ok?n(!0):n(!1)}).catch(()=>n(!1))},[]),P.useEffect(()=>{document.title=a?`Conductor — ${a}`:"Conductor Dashboard"},[a]),P.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(N9,{}):b.jsx(k9,{}),b.jsx(EN,{}),b.jsx(kN,{}),b.jsx(w9,{}),r?b.jsx(zN,{}):b.jsx(CN,{})]})}$2.createRoot(document.getElementById("root")).render(b.jsx(P.StrictMode,{children:b.jsx(C9,{})})); 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-Cq5A-RoD.js b/src/conductor/web/static/assets/index-Cq5A-RoD.js deleted file mode 100644 index e332955..0000000 --- a/src/conductor/web/static/assets/index-Cq5A-RoD.js +++ /dev/null @@ -1,306 +0,0 @@ -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={};/** - * @license React - * react-jsx-runtime.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * 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={};/** - * @license React - * react.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * 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;se>>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={};/** - * @license React - * react-dom.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * 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}/** - * @license React - * react-dom-client.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * 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=-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();/** - * @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();/** - * @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"};/** - * @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]]));/** - * @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};/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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"}]]);/** - * @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:` - footer input[type="range"]::-webkit-slider-thumb { - -webkit-appearance: none; - width: 12px; - height: 12px; - border-radius: 50%; - background: var(--accent); - border: 2px solid var(--surface); - cursor: pointer; - box-shadow: 0 0 4px rgba(99, 102, 241, 0.4); - } - footer input[type="range"]::-moz-range-thumb { - width: 12px; - height: 12px; - border-radius: 50%; - background: var(--accent); - border: 2px solid var(--surface); - 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={};/** - * @license React - * use-sync-external-store-shim.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * 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}/** - * @license React - * use-sync-external-store-shim/with-selector.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * 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("+",` -`).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?` - ---- 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(;++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(;++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:` -`},{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(;++v0&&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,{})})); 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/assets/index-DOzcs-W0.js b/src/conductor/web/static/assets/index-DOzcs-W0.js new file mode 100644 index 0000000..a59869f --- /dev/null +++ b/src/conductor/web/static/assets/index-DOzcs-W0.js @@ -0,0 +1,326 @@ +var Tk=Object.defineProperty;var Ak=(e,n,r)=>n in e?Tk(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var Nt=(e,n,r)=>Ak(e,typeof n!="symbol"?n+"":n,r);function zk(e,n){for(var r=0;rl[a]})}}}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 a of document.querySelectorAll('link[rel="modulepreload"]'))l(a);new MutationObserver(a=>{for(const u of a)if(u.type==="childList")for(const s of u.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&l(s)}).observe(document,{childList:!0,subtree:!0});function r(a){const u={};return a.integrity&&(u.integrity=a.integrity),a.referrerPolicy&&(u.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?u.credentials="include":a.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function l(a){if(a.ep)return;a.ep=!0;const u=r(a);fetch(a.href,u)}})();function Yo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zd={exports:{}},uo={};/** + * @license React + * react-jsx-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var jx;function Mk(){if(jx)return uo;jx=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(l,a,u){var s=null;if(u!==void 0&&(s=""+u),a.key!==void 0&&(s=""+a.key),"key"in a){u={};for(var f in a)f!=="key"&&(u[f]=a[f])}else u=a;return a=u.ref,{$$typeof:e,type:l,key:s,ref:a!==void 0?a:null,props:u}}return uo.Fragment=n,uo.jsx=r,uo.jsxs=r,uo}var Dx;function jk(){return Dx||(Dx=1,Zd.exports=Mk()),Zd.exports}var b=jk(),Kd={exports:{}},Ae={};/** + * @license React + * react.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Rx;function Dk(){if(Rx)return Ae;Rx=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),s=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 x(V){return V===null||typeof V!="object"?null:(V=y&&V[y]||V["@@iterator"],typeof V=="function"?V:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,_={};function S(V,P,N){this.props=V,this.context=P,this.refs=_,this.updater=N||w}S.prototype.isReactComponent={},S.prototype.setState=function(V,P){if(typeof V!="object"&&typeof V!="function"&&V!=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,V,P,"setState")},S.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function T(){}T.prototype=S.prototype;function k(V,P,N){this.props=V,this.context=P,this.refs=_,this.updater=N||w}var z=k.prototype=new T;z.constructor=k,E(z,S.prototype),z.isPureReactComponent=!0;var M=Array.isArray;function A(){}var q={H:null,A:null,T:null,S:null},j=Object.prototype.hasOwnProperty;function H(V,P,N){var Y=N.ref;return{$$typeof:e,type:V,key:P,ref:Y!==void 0?Y:null,props:N}}function R(V,P){return H(V.type,P,V.props)}function B(V){return typeof V=="object"&&V!==null&&V.$$typeof===e}function U(V){var P={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(N){return P[N]})}var W=/\/+/g;function I(V,P){return typeof V=="object"&&V!==null&&V.key!=null?U(""+V.key):P.toString(36)}function F(V){switch(V.status){case"fulfilled":return V.value;case"rejected":throw V.reason;default:switch(typeof V.status=="string"?V.then(A,A):(V.status="pending",V.then(function(P){V.status==="pending"&&(V.status="fulfilled",V.value=P)},function(P){V.status==="pending"&&(V.status="rejected",V.reason=P)})),V.status){case"fulfilled":return V.value;case"rejected":throw V.reason}}throw V}function L(V,P,N,Y,X){var K=typeof V;(K==="undefined"||K==="boolean")&&(V=null);var ne=!1;if(V===null)ne=!0;else switch(K){case"bigint":case"string":case"number":ne=!0;break;case"object":switch(V.$$typeof){case e:case n:ne=!0;break;case m:return ne=V._init,L(ne(V._payload),P,N,Y,X)}}if(ne)return X=X(V),ne=Y===""?"."+I(V,0):Y,M(X)?(N="",ne!=null&&(N=ne.replace(W,"$&/")+"/"),L(X,P,N,"",function(ye){return ye})):X!=null&&(B(X)&&(X=R(X,N+(X.key==null||V&&V.key===X.key?"":(""+X.key).replace(W,"$&/")+"/")+ne)),P.push(X)),1;ne=0;var re=Y===""?".":Y+":";if(M(V))for(var se=0;se>>1,D=L[J];if(0>>1;Ja(N,Z))Ya(X,N)?(L[J]=X,L[Y]=Z,J=Y):(L[J]=N,L[P]=Z,J=P);else if(Ya(X,Z))L[J]=X,L[Y]=Z,J=Y;else break e}}return G}function a(L,G){var Z=L.sortIndex-G.sortIndex;return Z!==0?Z:L.id-G.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var s=Date,f=s.now();e.unstable_now=function(){return s.now()-f}}var d=[],h=[],m=1,p=null,y=3,x=!1,w=!1,E=!1,_=!1,S=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function z(L){for(var G=r(h);G!==null;){if(G.callback===null)l(h);else if(G.startTime<=L)l(h),G.sortIndex=G.expirationTime,n(d,G);else break;G=r(h)}}function M(L){if(E=!1,z(L),!w)if(r(d)!==null)w=!0,A||(A=!0,U());else{var G=r(h);G!==null&&F(M,G.startTime-L)}}var A=!1,q=-1,j=5,H=-1;function R(){return _?!0:!(e.unstable_now()-HL&&R());){var J=p.callback;if(typeof J=="function"){p.callback=null,y=p.priorityLevel;var D=J(p.expirationTime<=L);if(L=e.unstable_now(),typeof D=="function"){p.callback=D,z(L),G=!0;break t}p===r(d)&&l(d),z(L)}else l(d);p=r(d)}if(p!==null)G=!0;else{var V=r(h);V!==null&&F(M,V.startTime-L),G=!1}}break e}finally{p=null,y=Z,x=!1}G=void 0}}finally{G?U():A=!1}}}var U;if(typeof k=="function")U=function(){k(B)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,I=W.port2;W.port1.onmessage=B,U=function(){I.postMessage(null)}}else U=function(){S(B,0)};function F(L,G){q=S(function(){L(e.unstable_now())},G)}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(L){L.callback=null},e.unstable_forceFrameRate=function(L){0>L||125J?(L.sortIndex=Z,n(h,L),r(d)===null&&L===r(h)&&(E?(T(q),q=-1):E=!0,F(M,Z-J))):(L.sortIndex=D,n(d,L),w||x||(w=!0,A||(A=!0,U()))),L},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(L){var G=y;return function(){var Z=y;y=G;try{return L.apply(this,arguments)}finally{y=Z}}}})(eh)),eh}var Hx;function Lk(){return Hx||(Hx=1,Wd.exports=Ok()),Wd.exports}var th={exports:{}},Yt={};/** + * @license React + * react-dom.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Bx;function Hk(){if(Bx)return Yt;Bx=1;var e=Fo();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(),th.exports=Hk(),th.exports}/** + * @license React + * react-dom-client.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var qx;function Bk(){if(qx)return co;qx=1;var e=Lk(),n=Fo(),r=Kb();function l(t){var i="https://react.dev/errors/"+t;if(1D||(t.current=J[D],J[D]=null,D--)}function N(t,i){D++,J[D]=t.current,t.current=i}var Y=V(null),X=V(null),K=V(null),ne=V(null);function re(t,i){switch(N(K,i),N(X,t),N(Y,null),i.nodeType){case 9:case 11:t=(t=i.documentElement)&&(t=t.namespaceURI)?tx(t):0;break;default:if(t=i.tagName,i=i.namespaceURI)i=tx(i),t=nx(i,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(X),P(K)}function ye(t){t.memoizedState!==null&&N(ne,t);var i=Y.current,o=nx(i,t.type);i!==o&&(N(X,t),N(Y,o))}function ve(t){X.current===t&&(P(Y),P(X)),ne.current===t&&(P(ne),lo._currentValue=Z)}var xe,pe;function _e(t){if(xe===void 0)try{throw Error()}catch(o){var i=o.stack.trim().match(/\n( *(at )?)/);xe=i&&i[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=o}return(o=t?t.displayName||t.name:"")?_e(o):""}function ut(t,i){switch(t.tag){case 26:case 27:case 5:return _e(t.type);case 16:return _e("Lazy");case 13:return t.child!==i&&i!==null?_e("Suspense Fallback"):_e("Suspense");case 19:return _e("SuspenseList");case 0:case 15:return Te(t.type,!1);case 11:return Te(t.type.render,!1);case 1:return Te(t.type,!0);case 31:return _e("Activity");default:return""}}function et(t){try{var i="",o=null;do i+=ut(t,o),o=t,t=t.return;while(t);return i}catch(c){return` +Error generating stack: `+c.message+` +`+c.stack}}var zt=Object.prototype.hasOwnProperty,Ut=e.unstable_scheduleCallback,Ot=e.unstable_cancelCallback,_n=e.unstable_shouldYield,Dn=e.unstable_requestPaint,Mt=e.unstable_now,Rr=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,ge=e.unstable_UserBlockingPriority,Ne=e.unstable_NormalPriority,Oe=e.unstable_LowPriority,$e=e.unstable_IdlePriority,Pt=e.log,Rn=e.unstable_setDisableYieldValue,Lt=null,xt=null;function Vt(t){if(typeof Pt=="function"&&Rn(t),xt&&typeof xt.setStrictMode=="function")try{xt.setStrictMode(Lt,t)}catch{}}var Ke=Math.clz32?Math.clz32:Hc,Pn=Math.log,cn=Math.LN2;function Hc(t){return t>>>=0,t===0?32:31-(Pn(t)/cn|0)|0}var tl=256,nl=262144,rl=4194304;function ar(t){var i=t&42;if(i!==0)return i;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 il(t,i,o){var c=t.pendingLanes;if(c===0)return 0;var g=0,v=t.suspendedLanes,C=t.pingedLanes;t=t.warmLanes;var O=c&134217727;return O!==0?(c=O&~v,c!==0?g=ar(c):(C&=O,C!==0?g=ar(C):o||(o=O&~t,o!==0&&(g=ar(o))))):(O=c&~v,O!==0?g=ar(O):C!==0?g=ar(C):o||(o=c&~t,o!==0&&(g=ar(o)))),g===0?0:i!==0&&i!==g&&(i&v)===0&&(v=g&-g,o=i&-i,v>=o||v===32&&(o&4194048)!==0)?i:g}function gi(t,i){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&i)===0}function Bc(t,i){switch(t){case 1:case 2:case 4:case 8:case 64:return i+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 i+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 rs(){var t=rl;return rl<<=1,(rl&62914560)===0&&(rl=4194304),t}function ga(t){for(var i=[],o=0;31>o;o++)i.push(t);return i}function yi(t,i){t.pendingLanes|=i,i!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Ic(t,i,o,c,g,v){var C=t.pendingLanes;t.pendingLanes=o,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=o,t.entangledLanes&=o,t.errorRecoveryDisabledLanes&=o,t.shellSuspendCounter=0;var O=t.entanglements,Q=t.expirationTimes,le=t.hiddenUpdates;for(o=C&~o;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Yc=/[\n"\\]/g;function Kt(t){return t.replace(Yc,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function bi(t,i,o,c,g,v,C,O){t.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?t.type=C:t.removeAttribute("type"),i!=null?C==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+Zt(i)):t.value!==""+Zt(i)&&(t.value=""+Zt(i)):C!=="submit"&&C!=="reset"||t.removeAttribute("value"),i!=null?wa(t,C,Zt(i)):o!=null?wa(t,C,Zt(o)):c!=null&&t.removeAttribute("value"),g==null&&v!=null&&(t.defaultChecked=!!v),g!=null&&(t.checked=g&&typeof g!="function"&&typeof g!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?t.name=""+Zt(O):t.removeAttribute("name")}function gs(t,i,o,c,g,v,C,O){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(t.type=v),i!=null||o!=null){if(!(v!=="submit"&&v!=="reset"||i!=null)){qr(t);return}o=o!=null?""+Zt(o):"",i=i!=null?""+Zt(i):o,O||i===t.value||(t.value=i),t.defaultValue=i}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),qr(t)}function wa(t,i,o){i==="number"&&vi(t.ownerDocument)===t||t.defaultValue===""+o||(t.defaultValue=""+o)}function ur(t,i,o,c){if(t=t.options,i){i={};for(var g=0;g"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qc=!1;if(fr)try{var _a={};Object.defineProperty(_a,"passive",{get:function(){Qc=!0}}),window.addEventListener("test",_a,_a),window.removeEventListener("test",_a,_a)}catch{Qc=!1}var Ur=null,Zc=null,xs=null;function ng(){if(xs)return xs;var t,i=Zc,o=i.length,c,g="value"in Ur?Ur.value:Ur.textContent,v=g.length;for(t=0;t=Na),sg=" ",ug=!1;function cg(t,i){switch(t){case"keyup":return ZE.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function fg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var fl=!1;function JE(t,i){switch(t){case"compositionend":return fg(i);case"keypress":return i.which!==32?null:(ug=!0,sg);case"textInput":return t=i.data,t===sg&&ug?null:t;default:return null}}function WE(t,i){if(fl)return t==="compositionend"||!tf&&cg(t,i)?(t=ng(),xs=Zc=Ur=null,fl=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1=i)return{node:o,offset:i-t};t=c}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=vg(o)}}function wg(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?wg(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function Sg(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var i=vi(t.document);i instanceof t.HTMLIFrameElement;){try{var o=typeof i.contentWindow.location.href=="string"}catch{o=!1}if(o)t=i.contentWindow;else break;i=vi(t.document)}return i}function lf(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i&&(i==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||i==="textarea"||t.contentEditable==="true")}var o2=fr&&"documentMode"in document&&11>=document.documentMode,dl=null,af=null,za=null,of=!1;function _g(t,i,o){var c=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;of||dl==null||dl!==vi(c)||(c=dl,"selectionStart"in c&&lf(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}),za&&Aa(za,c)||(za=c,c=fu(af,"onSelect"),0>=C,g-=C,Qn=1<<32-Ke(i)+g|o<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&&i(te,Se),ee=v(Xe,ee,je),Pe===null?Ee=Xe:Pe.sibling=Xe,Pe=Xe,Se=qe}if(je===ie.length)return o(te,Se),Ue&&hr(te,je),Ee;if(Se===null){for(;jeje?(qe=Se,Se=null):qe=Se.sibling;var ui=ae(te,Se,Xe.value,fe);if(ui===null){Se===null&&(Se=qe);break}t&&Se&&ui.alternate===null&&i(te,Se),ee=v(ui,ee,je),Pe===null?Ee=ui:Pe.sibling=ui,Pe=ui,Se=qe}if(Xe.done)return o(te,Se),Ue&&hr(te,je),Ee;if(Se===null){for(;!Xe.done;je++,Xe=ie.next())Xe=de(te,Xe.value,fe),Xe!==null&&(ee=v(Xe,ee,je),Pe===null?Ee=Xe:Pe.sibling=Xe,Pe=Xe);return Ue&&hr(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),ee=v(Xe,ee,je),Pe===null?Ee=Xe:Pe.sibling=Xe,Pe=Xe);return t&&Se.forEach(function(Ck){return i(te,Ck)}),Ue&&hr(te,je),Ee}function rt(te,ee,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 x:e:{for(var Ee=ie.key;ee!==null;){if(ee.key===Ee){if(Ee=ie.type,Ee===E){if(ee.tag===7){o(te,ee.sibling),fe=g(ee,ie.props.children),fe.return=te,te=fe;break e}}else if(ee.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===j&&zi(Ee)===ee.type){o(te,ee.sibling),fe=g(ee,ie.props),La(fe,ie),fe.return=te,te=fe;break e}o(te,ee);break}else i(te,ee);ee=ee.sibling}ie.type===E?(fe=ki(ie.props.children,te.mode,fe,ie.key),fe.return=te,te=fe):(fe=Ts(ie.type,ie.key,ie.props,null,te.mode,fe),La(fe,ie),fe.return=te,te=fe)}return C(te);case w:e:{for(Ee=ie.key;ee!==null;){if(ee.key===Ee)if(ee.tag===4&&ee.stateNode.containerInfo===ie.containerInfo&&ee.stateNode.implementation===ie.implementation){o(te,ee.sibling),fe=g(ee,ie.children||[]),fe.return=te,te=fe;break e}else{o(te,ee);break}else i(te,ee);ee=ee.sibling}fe=pf(ie,te.mode,fe),fe.return=te,te=fe}return C(te);case j:return ie=zi(ie),rt(te,ee,ie,fe)}if(F(ie))return be(te,ee,ie,fe);if(U(ie)){if(Ee=U(ie),typeof Ee!="function")throw Error(l(150));return ie=Ee.call(ie),Ce(te,ee,ie,fe)}if(typeof ie.then=="function")return rt(te,ee,Os(ie),fe);if(ie.$$typeof===k)return rt(te,ee,Ms(te,ie),fe);Ls(te,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,ee!==null&&ee.tag===6?(o(te,ee.sibling),fe=g(ee,ie),fe.return=te,te=fe):(o(te,ee),fe=hf(ie,te.mode,fe),fe.return=te,te=fe),C(te)):o(te,ee)}return function(te,ee,ie,fe){try{Oa=0;var Ee=rt(te,ee,ie,fe);return _l=null,Ee}catch(Se){if(Se===Sl||Se===Ds)throw Se;var Pe=dn(29,Se,null,te.mode);return Pe.lanes=fe,Pe.return=te,Pe}finally{}}}var ji=Gg(!0),Pg=Gg(!1),Gr=!1;function Nf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Cf(t,i){t=t.updateQueue,i.updateQueue===t&&(i.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Pr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Xr(t,i,o){var c=t.updateQueue;if(c===null)return null;if(c=c.shared,(Ze&2)!==0){var g=c.pending;return g===null?i.next=i:(i.next=g.next,g.next=i),c.pending=i,i=Cs(t),zg(t,null,o),i}return Ns(t,c,i,o),Cs(t)}function Ha(t,i,o){if(i=i.updateQueue,i!==null&&(i=i.shared,(o&4194048)!==0)){var c=i.lanes;c&=t.pendingLanes,o|=c,i.lanes=o,ls(t,o)}}function Tf(t,i){var o=t.updateQueue,c=t.alternate;if(c!==null&&(c=c.updateQueue,o===c)){var g=null,v=null;if(o=o.firstBaseUpdate,o!==null){do{var C={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};v===null?g=v=C:v=v.next=C,o=o.next}while(o!==null);v===null?g=v=i:v=v.next=i}else g=v=i;o={baseState:c.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:c.shared,callbacks:c.callbacks},t.updateQueue=o;return}t=o.lastBaseUpdate,t===null?o.firstBaseUpdate=i:t.next=i,o.lastBaseUpdate=i}var Af=!1;function Ba(){if(Af){var t=wl;if(t!==null)throw t}}function Ia(t,i,o,c){Af=!1;var g=t.updateQueue;Gr=!1;var v=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?v=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(v!==null){var de=g.baseState;C=0,ce=le=Q=null,O=v;do{var ae=O.lane&-536870913,oe=ae!==O.lane;if(oe?(Ie&ae)===ae:(c&ae)===ae){ae!==0&&ae===bl&&(Af=!0),ce!==null&&(ce=ce.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var be=t,Ce=O;ae=i;var rt=o;switch(Ce.tag){case 1:if(be=Ce.payload,typeof be=="function"){de=be.call(rt,de,ae);break e}de=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Ce.payload,ae=typeof be=="function"?be.call(rt,de,ae):be,ae==null)break e;de=p({},de,ae);break e;case 2:Gr=!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,v===null&&(g.shared.lanes=0),Wr|=C,t.lanes=C,t.memoizedState=de}}function Xg(t,i){if(typeof t!="function")throw Error(l(191,t));t.call(i)}function Qg(t,i){var o=t.callbacks;if(o!==null)for(t.callbacks=null,t=0;tv?v:8;var C=L.T,O={};L.T=O,Xf(t,!1,i,o);try{var Q=g(),le=L.S;if(le!==null&&le(O,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var ce=g2(Q,c);Va(t,i,ce,yn(t))}else Va(t,i,c,yn(t))}catch(de){Va(t,i,{then:function(){},status:"rejected",reason:de},yn())}finally{G.p=v,C!==null&&O.types!==null&&(C.types=O.types),L.T=C}}function S2(){}function Gf(t,i,o,c){if(t.tag!==5)throw Error(l(476));var g=C0(t).queue;N0(t,g,i,Z,o===null?S2:function(){return T0(t),o(c)})}function C0(t){var i=t.memoizedState;if(i!==null)return i;i={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yr,lastRenderedState:Z},next:null};var o={};return i.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yr,lastRenderedState:o},next:null},t.memoizedState=i,t=t.alternate,t!==null&&(t.memoizedState=i),i}function T0(t){var i=C0(t);i.next===null&&(i=t.alternate.memoizedState),Va(t,i.next.queue,{},yn())}function Pf(){return Bt(lo)}function A0(){return bt().memoizedState}function z0(){return bt().memoizedState}function _2(t){for(var i=t.return;i!==null;){switch(i.tag){case 24:case 3:var o=yn();t=Pr(o);var c=Xr(i,t,o);c!==null&&(rn(c,i,o),Ha(c,i,o)),i={cache:Sf()},t.payload=i;return}i=i.return}}function E2(t,i,o){var c=yn();o={lane:c,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Gs(t)?j0(i,o):(o=ff(t,i,o,c),o!==null&&(rn(o,t,c),D0(o,i,c)))}function M0(t,i,o){var c=yn();Va(t,i,o,c)}function Va(t,i,o,c){var g={lane:c,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Gs(t))j0(i,g);else{var v=t.alternate;if(t.lanes===0&&(v===null||v.lanes===0)&&(v=i.lastRenderedReducer,v!==null))try{var C=i.lastRenderedState,O=v(C,o);if(g.hasEagerState=!0,g.eagerState=O,fn(O,C))return Ns(t,i,g,0),it===null&&ks(),!1}catch{}finally{}if(o=ff(t,i,g,c),o!==null)return rn(o,t,c),D0(o,i,c),!0}return!1}function Xf(t,i,o,c){if(c={lane:2,revertLane:Nd(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Gs(t)){if(i)throw Error(l(479))}else i=ff(t,o,c,2),i!==null&&rn(i,t,2)}function Gs(t){var i=t.alternate;return t===ze||i!==null&&i===ze}function j0(t,i){kl=Is=!0;var o=t.pending;o===null?i.next=i:(i.next=o.next,o.next=i),t.pending=i}function D0(t,i,o){if((o&4194048)!==0){var c=i.lanes;c&=t.pendingLanes,o|=c,i.lanes=o,ls(t,o)}}var $a={readContext:Bt,use:Vs,useCallback:mt,useContext:mt,useEffect:mt,useImperativeHandle:mt,useLayoutEffect:mt,useInsertionEffect:mt,useMemo:mt,useReducer:mt,useRef:mt,useState:mt,useDebugValue:mt,useDeferredValue:mt,useTransition:mt,useSyncExternalStore:mt,useId:mt,useHostTransitionStatus:mt,useFormState:mt,useActionState:mt,useOptimistic:mt,useMemoCache:mt,useCacheRefresh:mt};$a.useEffectEvent=mt;var R0={readContext:Bt,use:Vs,useCallback:function(t,i){return Xt().memoizedState=[t,i===void 0?null:i],t},useContext:Bt,useEffect:y0,useImperativeHandle:function(t,i,o){o=o!=null?o.concat([t]):null,Ys(4194308,4,w0.bind(null,i,t),o)},useLayoutEffect:function(t,i){return Ys(4194308,4,t,i)},useInsertionEffect:function(t,i){Ys(4,2,t,i)},useMemo:function(t,i){var o=Xt();i=i===void 0?null:i;var c=t();if(Di){Vt(!0);try{t()}finally{Vt(!1)}}return o.memoizedState=[c,i],c},useReducer:function(t,i,o){var c=Xt();if(o!==void 0){var g=o(i);if(Di){Vt(!0);try{o(i)}finally{Vt(!1)}}}else g=i;return c.memoizedState=c.baseState=g,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:g},c.queue=t,t=t.dispatch=E2.bind(null,ze,t),[c.memoizedState,t]},useRef:function(t){var i=Xt();return t={current:t},i.memoizedState=t},useState:function(t){t=Uf(t);var i=t.queue,o=M0.bind(null,ze,i);return i.dispatch=o,[t.memoizedState,o]},useDebugValue:Yf,useDeferredValue:function(t,i){var o=Xt();return Ff(o,t,i)},useTransition:function(){var t=Uf(!1);return t=N0.bind(null,ze,t.queue,!0,!1),Xt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,i,o){var c=ze,g=Xt();if(Ue){if(o===void 0)throw Error(l(407));o=o()}else{if(o=i(),it===null)throw Error(l(349));(Ie&127)!==0||t0(c,i,o)}g.memoizedState=o;var v={value:o,getSnapshot:i};return g.queue=v,y0(r0.bind(null,c,v,t),[t]),c.flags|=2048,Cl(9,{destroy:void 0},n0.bind(null,c,v,o,i),null),o},useId:function(){var t=Xt(),i=it.identifierPrefix;if(Ue){var o=Zn,c=Qn;o=(c&~(1<<32-Ke(c)-1)).toString(32)+o,i="_"+i+"R_"+o,o=qs++,0<\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof c.is=="string"?C.createElement("select",{is:c.is}):C.createElement("select"),c.multiple?v.multiple=!0:c.size&&(v.size=c.size);break;default:v=typeof c.is=="string"?C.createElement(g,{is:c.is}):C.createElement(g)}}v[jt]=i,v[$t]=c;e:for(C=i.child;C!==null;){if(C.tag===5||C.tag===6)v.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===i)break e;for(;C.sibling===null;){if(C.return===null||C.return===i)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}i.stateNode=v;e:switch(qt(v,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&&vr(i)}}return ft(i),sd(i,i.type,t===null?null:t.memoizedProps,i.pendingProps,o),null;case 6:if(t&&i.stateNode!=null)t.memoizedProps!==c&&vr(i);else{if(typeof c!="string"&&i.stateNode===null)throw Error(l(166));if(t=K.current,xl(i)){if(t=i.stateNode,o=i.memoizedProps,c=null,g=Ht,g!==null)switch(g.tag){case 27:case 5:c=g.memoizedProps}t[jt]=i,t=!!(t.nodeValue===o||c!==null&&c.suppressHydrationWarning===!0||Wy(t.nodeValue,o)),t||Yr(i,!0)}else t=du(t).createTextNode(c),t[jt]=i,i.stateNode=t}return ft(i),null;case 31:if(o=i.memoizedState,t===null||t.memoizedState!==null){if(c=xl(i),o!==null){if(t===null){if(!c)throw Error(l(318));if(t=i.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(557));t[jt]=i}else Ni(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;ft(i),t=!1}else o=xf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=o),t=!0;if(!t)return i.flags&256?(pn(i),i):(pn(i),null);if((i.flags&128)!==0)throw Error(l(558))}return ft(i),null;case 13:if(c=i.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(g=xl(i),c!==null&&c.dehydrated!==null){if(t===null){if(!g)throw Error(l(318));if(g=i.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(l(317));g[jt]=i}else Ni(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;ft(i),g=!1}else g=xf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=g),g=!0;if(!g)return i.flags&256?(pn(i),i):(pn(i),null)}return pn(i),(i.flags&128)!==0?(i.lanes=o,i):(o=c!==null,t=t!==null&&t.memoizedState!==null,o&&(c=i.child,g=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(g=c.alternate.memoizedState.cachePool.pool),v=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(v=c.memoizedState.cachePool.pool),v!==g&&(c.flags|=2048)),o!==t&&o&&(i.child.flags|=8192),Ks(i,i.updateQueue),ft(i),null);case 4:return se(),t===null&&zd(i.stateNode.containerInfo),ft(i),null;case 10:return mr(i.type),ft(i),null;case 19:if(P(vt),c=i.memoizedState,c===null)return ft(i),null;if(g=(i.flags&128)!==0,v=c.rendering,v===null)if(g)Fa(c,!1);else{if(gt!==0||t!==null&&(t.flags&128)!==0)for(t=i.child;t!==null;){if(v=Bs(t),v!==null){for(i.flags|=128,Fa(c,!1),t=v.updateQueue,i.updateQueue=t,Ks(i,t),i.subtreeFlags=0,t=o,o=i.child;o!==null;)Mg(o,t),o=o.sibling;return N(vt,vt.current&1|2),Ue&&hr(i,c.treeForkCount),i.child}t=t.sibling}c.tail!==null&&Mt()>nu&&(i.flags|=128,g=!0,Fa(c,!1),i.lanes=4194304)}else{if(!g)if(t=Bs(v),t!==null){if(i.flags|=128,g=!0,t=t.updateQueue,i.updateQueue=t,Ks(i,t),Fa(c,!0),c.tail===null&&c.tailMode==="hidden"&&!v.alternate&&!Ue)return ft(i),null}else 2*Mt()-c.renderingStartTime>nu&&o!==536870912&&(i.flags|=128,g=!0,Fa(c,!1),i.lanes=4194304);c.isBackwards?(v.sibling=i.child,i.child=v):(t=c.last,t!==null?t.sibling=v:i.child=v,c.last=v)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=Mt(),t.sibling=null,o=vt.current,N(vt,g?o&1|2:o&1),Ue&&hr(i,c.treeForkCount),t):(ft(i),null);case 22:case 23:return pn(i),Mf(),c=i.memoizedState!==null,t!==null?t.memoizedState!==null!==c&&(i.flags|=8192):c&&(i.flags|=8192),c?(o&536870912)!==0&&(i.flags&128)===0&&(ft(i),i.subtreeFlags&6&&(i.flags|=8192)):ft(i),o=i.updateQueue,o!==null&&Ks(i,o.retryQueue),o=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(o=t.memoizedState.cachePool.pool),c=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),c!==o&&(i.flags|=2048),t!==null&&P(Ai),null;case 24:return o=null,t!==null&&(o=t.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),mr(St),ft(i),null;case 25:return null;case 30:return null}throw Error(l(156,i.tag))}function A2(t,i){switch(gf(i),i.tag){case 1:return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return mr(St),se(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 26:case 27:case 5:return ve(i),null;case 31:if(i.memoizedState!==null){if(pn(i),i.alternate===null)throw Error(l(340));Ni()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 13:if(pn(i),t=i.memoizedState,t!==null&&t.dehydrated!==null){if(i.alternate===null)throw Error(l(340));Ni()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return P(vt),null;case 4:return se(),null;case 10:return mr(i.type),null;case 22:case 23:return pn(i),Mf(),t!==null&&P(Ai),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 24:return mr(St),null;case 25:return null;default:return null}}function iy(t,i){switch(gf(i),i.tag){case 3:mr(St),se();break;case 26:case 27:case 5:ve(i);break;case 4:se();break;case 31:i.memoizedState!==null&&pn(i);break;case 13:pn(i);break;case 19:P(vt);break;case 10:mr(i.type);break;case 22:case 23:pn(i),Mf(),t!==null&&P(Ai);break;case 24:mr(St)}}function Ga(t,i){try{var o=i.updateQueue,c=o!==null?o.lastEffect:null;if(c!==null){var g=c.next;o=g;do{if((o.tag&t)===t){c=void 0;var v=o.create,C=o.inst;c=v(),C.destroy=c}o=o.next}while(o!==g)}}catch(O){We(i,i.return,O)}}function Kr(t,i,o){try{var c=i.updateQueue,g=c!==null?c.lastEffect:null;if(g!==null){var v=g.next;c=v;do{if((c.tag&t)===t){var C=c.inst,O=C.destroy;if(O!==void 0){C.destroy=void 0,g=i;var Q=o,le=O;try{le()}catch(ce){We(g,Q,ce)}}}c=c.next}while(c!==v)}}catch(ce){We(i,i.return,ce)}}function ly(t){var i=t.updateQueue;if(i!==null){var o=t.stateNode;try{Qg(i,o)}catch(c){We(t,t.return,c)}}}function ay(t,i,o){o.props=Ri(t.type,t.memoizedProps),o.state=t.memoizedState;try{o.componentWillUnmount()}catch(c){We(t,i,c)}}function Pa(t,i){try{var o=t.ref;if(o!==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 o=="function"?t.refCleanup=o(c):o.current=c}}catch(g){We(t,i,g)}}function Kn(t,i){var o=t.ref,c=t.refCleanup;if(o!==null)if(typeof c=="function")try{c()}catch(g){We(t,i,g)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(g){We(t,i,g)}else o.current=null}function oy(t){var i=t.type,o=t.memoizedProps,c=t.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":o.autoFocus&&c.focus();break e;case"img":o.src?c.src=o.src:o.srcSet&&(c.srcset=o.srcSet)}}catch(g){We(t,t.return,g)}}function ud(t,i,o){try{var c=t.stateNode;K2(c,t.type,o,i),c[$t]=i}catch(g){We(t,t.return,g)}}function sy(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ii(t.type)||t.tag===4}function cd(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||sy(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&&ii(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 fd(t,i,o){var c=t.tag;if(c===5||c===6)t=t.stateNode,i?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(t,i):(i=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,i.appendChild(t),o=o._reactRootContainer,o!=null||i.onclick!==null||(i.onclick=cr));else if(c!==4&&(c===27&&ii(t.type)&&(o=t.stateNode,i=null),t=t.child,t!==null))for(fd(t,i,o),t=t.sibling;t!==null;)fd(t,i,o),t=t.sibling}function Js(t,i,o){var c=t.tag;if(c===5||c===6)t=t.stateNode,i?o.insertBefore(t,i):o.appendChild(t);else if(c!==4&&(c===27&&ii(t.type)&&(o=t.stateNode),t=t.child,t!==null))for(Js(t,i,o),t=t.sibling;t!==null;)Js(t,i,o),t=t.sibling}function uy(t){var i=t.stateNode,o=t.memoizedProps;try{for(var c=t.type,g=i.attributes;g.length;)i.removeAttributeNode(g[0]);qt(i,c,o),i[jt]=t,i[$t]=o}catch(v){We(t,t.return,v)}}var br=!1,kt=!1,dd=!1,cy=typeof WeakSet=="function"?WeakSet:Set,Rt=null;function z2(t,i){if(t=t.containerInfo,Dd=vu,t=Sg(t),lf(t)){if("selectionStart"in t)var o={start:t.selectionStart,end:t.selectionEnd};else e:{o=(o=t.ownerDocument)&&o.defaultView||window;var c=o.getSelection&&o.getSelection();if(c&&c.rangeCount!==0){o=c.anchorNode;var g=c.anchorOffset,v=c.focusNode;c=c.focusOffset;try{o.nodeType,v.nodeType}catch{o=null;break e}var C=0,O=-1,Q=-1,le=0,ce=0,de=t,ae=null;t:for(;;){for(var oe;de!==o||g!==0&&de.nodeType!==3||(O=C+g),de!==v||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===o&&++le===g&&(O=C),ae===v&&++ce===c&&(Q=C),(oe=de.nextSibling)!==null)break;de=ae,ae=de.parentNode}de=oe}o=O===-1||Q===-1?null:{start:O,end:Q}}else o=null}o=o||{start:0,end:0}}else o=null;for(Rd={focusedElem:t,selectionRange:o},vu=!1,Rt=i;Rt!==null;)if(i=Rt,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,Rt=t;else for(;Rt!==null;){switch(i=Rt,v=i.alternate,t=i.flags,i.tag){case 0:if((t&4)!==0&&(t=i.updateQueue,t=t!==null?t.events:null,t!==null))for(o=0;o title"))),qt(v,c,o),v[jt]=t,wt(v),c=v;break e;case"link":var C=gx("link","href",g).get(c+(o.href||""));if(C){for(var O=0;Ort&&(C=rt,rt=Ce,Ce=C);var te=bg(O,Ce),ee=bg(O,rt);if(te&&ee&&(oe.rangeCount!==1||oe.anchorNode!==te.node||oe.anchorOffset!==te.offset||oe.focusNode!==ee.node||oe.focusOffset!==ee.offset)){var ie=de.createRange();ie.setStart(te.node,te.offset),oe.removeAllRanges(),Ce>rt?(oe.addRange(ie),oe.extend(ee.node,ee.offset)):(ie.setEnd(ee.node,ee.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;Oo?32:o,L.T=null,o=vd,vd=null;var v=ti,C=kr;if(Dt=0,jl=ti=null,kr=0,(Ze&6)!==0)throw Error(l(331));var O=Ze;if(Ze|=4,wy(v.current),xy(v,v.current,C,o),Ze=O,Wa(0,!1),xt&&typeof xt.onPostCommitFiberRoot=="function")try{xt.onPostCommitFiberRoot(Lt,v)}catch{}return!0}finally{G.p=g,L.T=c,Iy(t,i)}}function Uy(t,i,o){i=kn(o,i),i=Jf(t.stateNode,i,2),t=Xr(t,i,2),t!==null&&(yi(t,2),Jn(t))}function We(t,i,o){if(t.tag===3)Uy(t,t,o);else for(;i!==null;){if(i.tag===3){Uy(i,t,o);break}else if(i.tag===1){var c=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(ei===null||!ei.has(c))){t=kn(o,t),o=V0(2),c=Xr(i,o,2),c!==null&&($0(o,c,i,t),yi(c,2),Jn(c));break}}i=i.return}}function _d(t,i,o){var c=t.pingCache;if(c===null){c=t.pingCache=new D2;var g=new Set;c.set(i,g)}else g=c.get(i),g===void 0&&(g=new Set,c.set(i,g));g.has(o)||(md=!0,g.add(o),t=B2.bind(null,t,i,o),i.then(t,t))}function B2(t,i,o){var c=t.pingCache;c!==null&&c.delete(i),t.pingedLanes|=t.suspendedLanes&o,t.warmLanes&=~o,it===t&&(Ie&o)===o&&(gt===4||gt===3&&(Ie&62914560)===Ie&&300>Mt()-tu?(Ze&2)===0&&Dl(t,0):gd|=o,Ml===Ie&&(Ml=0)),Jn(t)}function Vy(t,i){i===0&&(i=rs()),t=Ei(t,i),t!==null&&(yi(t,i),Jn(t))}function I2(t){var i=t.memoizedState,o=0;i!==null&&(o=i.retryLane),Vy(t,o)}function q2(t,i){var o=0;switch(t.tag){case 31:case 13:var c=t.stateNode,g=t.memoizedState;g!==null&&(o=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(i),Vy(t,o)}function U2(t,i){return Ut(t,i)}var su=null,Ol=null,Ed=!1,uu=!1,kd=!1,ri=0;function Jn(t){t!==Ol&&t.next===null&&(Ol===null?su=Ol=t:Ol=Ol.next=t),uu=!0,Ed||(Ed=!0,$2())}function Wa(t,i){if(!kd&&uu){kd=!0;do for(var o=!1,c=su;c!==null;){if(t!==0){var g=c.pendingLanes;if(g===0)var v=0;else{var C=c.suspendedLanes,O=c.pingedLanes;v=(1<<31-Ke(42|t)+1)-1,v&=g&~(C&~O),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(o=!0,Gy(c,v))}else v=Ie,v=il(c,c===it?v:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(v&3)===0||gi(c,v)||(o=!0,Gy(c,v));c=c.next}while(o);kd=!1}}function V2(){$y()}function $y(){uu=Ed=!1;var t=0;ri!==0&&W2()&&(t=ri);for(var i=Mt(),o=null,c=su;c!==null;){var g=c.next,v=Yy(c,i);v===0?(c.next=null,o===null?su=g:o.next=g,g===null&&(Ol=o)):(o=c,(t!==0||(v&3)!==0)&&(uu=!0)),c=g}Dt!==0&&Dt!==5||Wa(t),ri!==0&&(ri=0)}function Yy(t,i){for(var o=t.suspendedLanes,c=t.pingedLanes,g=t.expirationTimes,v=t.pendingLanes&-62914561;0O)break;var ce=Q.transferSize,de=Q.initiatorType;ce&&ex(de)&&(Q=Q.responseEnd,C+=ce*(Q"u"?null:document;function dx(t,i,o){var c=Ll;if(c&&typeof i=="string"&&i){var g=Kt(i);g='link[rel="'+t+'"][href="'+g+'"]',typeof o=="string"&&(g+='[crossorigin="'+o+'"]'),fx.has(g)||(fx.add(g),t={rel:t,crossOrigin:o,href:i},c.querySelector(g)===null&&(i=c.createElement("link"),qt(i,"link",t),wt(i),c.head.appendChild(i)))}}function sk(t){Nr.D(t),dx("dns-prefetch",t,null)}function uk(t,i){Nr.C(t,i),dx("preconnect",t,i)}function ck(t,i,o){Nr.L(t,i,o);var c=Ll;if(c&&t&&i){var g='link[rel="preload"][as="'+Kt(i)+'"]';i==="image"&&o&&o.imageSrcSet?(g+='[imagesrcset="'+Kt(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(g+='[imagesizes="'+Kt(o.imageSizes)+'"]')):g+='[href="'+Kt(t)+'"]';var v=g;switch(i){case"style":v=Hl(t);break;case"script":v=Bl(t)}Mn.has(v)||(t=p({rel:"preload",href:i==="image"&&o&&o.imageSrcSet?void 0:t,as:i},o),Mn.set(v,t),c.querySelector(g)!==null||i==="style"&&c.querySelector(ro(v))||i==="script"&&c.querySelector(io(v))||(i=c.createElement("link"),qt(i,"link",t),wt(i),c.head.appendChild(i)))}}function fk(t,i){Nr.m(t,i);var o=Ll;if(o&&t){var c=i&&typeof i.as=="string"?i.as:"script",g='link[rel="modulepreload"][as="'+Kt(c)+'"][href="'+Kt(t)+'"]',v=g;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=Bl(t)}if(!Mn.has(v)&&(t=p({rel:"modulepreload",href:t},i),Mn.set(v,t),o.querySelector(g)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(io(v)))return}c=o.createElement("link"),qt(c,"link",t),wt(c),o.head.appendChild(c)}}}function dk(t,i,o){Nr.S(t,i,o);var c=Ll;if(c&&t){var g=Br(c).hoistableStyles,v=Hl(t);i=i||"default";var C=g.get(v);if(!C){var O={loading:0,preload:null};if(C=c.querySelector(ro(v)))O.loading=5;else{t=p({rel:"stylesheet",href:t,"data-precedence":i},o),(o=Mn.get(v))&&Ud(t,o);var Q=C=c.createElement("link");wt(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,pu(C,i,c)}C={type:"stylesheet",instance:C,count:1,state:O},g.set(v,C)}}}function hk(t,i){Nr.X(t,i);var o=Ll;if(o&&t){var c=Br(o).hoistableScripts,g=Bl(t),v=c.get(g);v||(v=o.querySelector(io(g)),v||(t=p({src:t,async:!0},i),(i=Mn.get(g))&&Vd(t,i),v=o.createElement("script"),wt(v),qt(v,"link",t),o.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},c.set(g,v))}}function pk(t,i){Nr.M(t,i);var o=Ll;if(o&&t){var c=Br(o).hoistableScripts,g=Bl(t),v=c.get(g);v||(v=o.querySelector(io(g)),v||(t=p({src:t,async:!0,type:"module"},i),(i=Mn.get(g))&&Vd(t,i),v=o.createElement("script"),wt(v),qt(v,"link",t),o.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},c.set(g,v))}}function hx(t,i,o,c){var g=(g=K.current)?hu(g):null;if(!g)throw Error(l(446));switch(t){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(i=Hl(o.href),o=Br(g).hoistableStyles,c=o.get(i),c||(c={type:"style",instance:null,count:0,state:null},o.set(i,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){t=Hl(o.href);var v=Br(g).hoistableStyles,C=v.get(t);if(C||(g=g.ownerDocument||g,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(t,C),(v=g.querySelector(ro(t)))&&!v._p&&(C.instance=v,C.state.loading=5),Mn.has(t)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Mn.set(t,o),v||mk(g,t,o,C.state))),i&&c===null)throw Error(l(528,""));return C}if(i&&c!==null)throw Error(l(529,""));return null;case"script":return i=o.async,o=o.src,typeof o=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Bl(o),o=Br(g).hoistableScripts,c=o.get(i),c||(c={type:"script",instance:null,count:0,state:null},o.set(i,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,t))}}function Hl(t){return'href="'+Kt(t)+'"'}function ro(t){return'link[rel="stylesheet"]['+t+"]"}function px(t){return p({},t,{"data-precedence":t.precedence,precedence:null})}function mk(t,i,o,c){t.querySelector('link[rel="preload"][as="style"]['+i+"]")?c.loading=1:(i=t.createElement("link"),c.preload=i,i.addEventListener("load",function(){return c.loading|=1}),i.addEventListener("error",function(){return c.loading|=2}),qt(i,"link",o),wt(i),t.head.appendChild(i))}function Bl(t){return'[src="'+Kt(t)+'"]'}function io(t){return"script[async]"+t}function mx(t,i,o){if(i.count++,i.instance===null)switch(i.type){case"style":var c=t.querySelector('style[data-href~="'+Kt(o.href)+'"]');if(c)return i.instance=c,wt(c),c;var g=p({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return c=(t.ownerDocument||t).createElement("style"),wt(c),qt(c,"style",g),pu(c,o.precedence,t),i.instance=c;case"stylesheet":g=Hl(o.href);var v=t.querySelector(ro(g));if(v)return i.state.loading|=4,i.instance=v,wt(v),v;c=px(o),(g=Mn.get(g))&&Ud(c,g),v=(t.ownerDocument||t).createElement("link"),wt(v);var C=v;return C._p=new Promise(function(O,Q){C.onload=O,C.onerror=Q}),qt(v,"link",c),i.state.loading|=4,pu(v,o.precedence,t),i.instance=v;case"script":return v=Bl(o.src),(g=t.querySelector(io(v)))?(i.instance=g,wt(g),g):(c=o,(g=Mn.get(v))&&(c=p({},o),Vd(c,g)),t=t.ownerDocument||t,g=t.createElement("script"),wt(g),qt(g,"link",c),t.head.appendChild(g),i.instance=g);case"void":return null;default:throw Error(l(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(c=i.instance,i.state.loading|=4,pu(c,o.precedence,t));return i.instance}function pu(t,i,o){for(var c=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=c.length?c[c.length-1]:null,v=g,C=0;C title"):null)}function gk(t,i,o){if(o===1||i.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return t=i.disabled,typeof i.precedence=="string"&&t==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function xx(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function yk(t,i,o,c){if(o.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var g=Hl(c.href),v=i.querySelector(ro(g));if(v){i=v._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(t.count++,t=gu.bind(t),i.then(t,t)),o.state.loading|=4,o.instance=v,wt(v);return}v=i.ownerDocument||i,c=px(c),(g=Mn.get(g))&&Ud(c,g),v=v.createElement("link"),wt(v);var C=v;C._p=new Promise(function(O,Q){C.onload=O,C.onerror=Q}),qt(v,"link",c),o.instance=v}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(o,i),(i=o.state.preload)&&(o.state.loading&3)===0&&(t.count++,o=gu.bind(t),i.addEventListener("load",o),i.addEventListener("error",o))}}var $d=0;function xk(t,i){return t.stylesheets&&t.count===0&&xu(t,t.stylesheets),0$d?50:800)+i);return t.unsuspend=o,function(){t.unsuspend=null,clearTimeout(c),clearTimeout(g)}}:null}function gu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)xu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var yu=null;function xu(t,i){t.stylesheets=null,t.unsuspend!==null&&(t.count++,yu=new Map,i.forEach(vk,t),yu=null,gu.call(t))}function vk(t,i){if(!(i.state.loading&4)){var o=yu.get(t);if(o)var c=o.get(null);else{o=new Map,yu.set(t,o);for(var g=t.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Jd.exports=Bk(),Jd.exports}var qk=Ik();/** + * @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 Uk=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Jb=(...e)=>e.filter((n,r,l)=>!!n&&n.trim()!==""&&l.indexOf(n)===r).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 Vk={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 $k=$.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:l,className:a="",children:u,iconNode:s,...f},d)=>$.createElement("svg",{ref:d,...Vk,width:n,height:n,stroke:e,strokeWidth:l?Number(r)*24/Number(n):r,className:Jb("lucide",a),...f},[...s.map(([h,m])=>$.createElement(h,m)),...Array.isArray(u)?u:[u]]));/** + * @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 Ge=(e,n)=>{const r=$.forwardRef(({className:l,...a},u)=>$.createElement($k,{ref:u,iconNode:n,className:Jb(`lucide-${Uk(e)}`,l),...a}));return r.displayName=`${e}`,r};/** + * @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 Wb=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 Yk=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 Vi=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 Wi=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 fa=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 Fk=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 Gk=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 Pk=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 Xk=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 ew=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 Qk=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 Zk=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 Kk=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 Jk=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 tw=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 Wk=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 eN=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 ta=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 tN=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 nN=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 am=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 rN=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 iN=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 lN=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 aN=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 Vx=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 nw=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 oN=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 rw=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 sN=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 uN=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 da=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 cN=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"}]]),$x=e=>{let n;const r=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),r.forEach(x=>x(n,y))}},a=()=>n,f={setState:l,getState:a,getInitialState:()=>d,subscribe:h=>(r.add(h),()=>r.delete(h))},d=n=e(l,a,f);return f},fN=(e=>e?$x(e):$x),dN=e=>e;function hN(e,n=dN){const r=Gl.useSyncExternalStore(e.subscribe,Gl.useCallback(()=>n(e.getState()),[e,n]),Gl.useCallback(()=>n(e.getInitialState()),[e,n]));return Gl.useDebugValue(r),r}const Yx=e=>{const n=fN(e),r=l=>hN(n,l);return Object.assign(r,n),r},pN=(e=>e?Yx(e):Yx);function lt(e,n,r="agent"){return e[n]||(e[n]={name:n,status:"pending",type:r,activity:[]}),e[n].activity||(e[n].activity=[]),e[n]}function Nu(e,n,r){lt(e,n).activity.push(r)}function Qe(e,n){e[n]&&(e[n]={...e[n]})}function fo(e,n,r,l){const a=e[n];if(!(a!=null&&a.for_each_items))return;const u=a.for_each_items.find(s=>s.key===r);u&&u.activity.push(l)}const he=pN(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,r,l)=>{const a=he.getState()._wsSend;a&&a({type:"gate_response",agent_name:n,selected_value:r,additional_input:l||{}})},processEvent:n=>{const r=Cu[n.type];e(l=>{const a={...l,nodes:{...l.nodes},groupProgress:{...l.groupProgress},eventLog:[...l.eventLog],activityLog:[...l.activityLog],lastEventTime:n.timestamp};r&&r(a,n.data,n.timestamp);const u=Tu(n);u&&a.eventLog.push(u);const s=Au(n);return s&&a.activityLog.push(s),a})},replayState:n=>{e(r=>{const l={...r,agentsCompleted:0,totalCost:0,totalTokens:0,nodes:{},groupProgress:{},highlightedEdges:[],eventLog:[],activityLog:[],workflowOutput:null,workflowFailedAgent:null};for(const a of n){const u=Cu[a.type];u&&u(l,a.data,a.timestamp);const s=Tu(a);s&&l.eventLog.push(s);const f=Au(a);f&&l.activityLog.push(f),l.lastEventTime=a.timestamp}return l})},selectNode:n=>{e({selectedNode:n})},setReplayMode:n=>{e(r=>{const l={...r,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 a of n){const u=Cu[a.type];u&&u(l,a.data,a.timestamp);const s=Tu(a);s&&l.eventLog.push(s);const f=Au(a);f&&l.activityLog.push(f),l.lastEventTime=a.timestamp}return l})},setReplayPosition:n=>{e(r=>{const l=r.replayEvents.slice(0,n),a={...r,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 u of l){const s=Cu[u.type];s&&s(a,u.data,u.timestamp);const f=Tu(u);f&&a.eventLog.push(f);const d=Au(u);d&&a.activityLog.push(d),a.lastEventTime=u.timestamp}return a})},setReplayPlaying:n=>{e({replayPlaying:n})},setReplaySpeed:n=>{e({replaySpeed:n})},setWsStatus:n=>{e({wsStatus:n})},setEdgeHighlight:(n,r,l)=>{e(a=>({highlightedEdges:[...a.highlightedEdges.filter(u=>!(u.from===n&&u.to===r)),{from:n,to:r,state:l}]}))},clearEdgeHighlight:(n,r)=>{e(l=>({highlightedEdges:l.highlightedEdges.filter(a=>!(a.from===n&&a.to===r))}))}})),Cu={workflow_started:(e,n,r)=>{const l=n;e.workflowStatus="running",e.workflowStartTime=r??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||[],lt(e.nodes,"$start","start"),e.nodes.$start.status="running",Qe(e.nodes,"$start");const a=new Set,u=new Set;for(const s of e.parallelGroups){for(const f of s.agents)a.add(f);u.add(s.name),lt(e.nodes,s.name,"parallel_group"),e.groupProgress[s.name]={total:s.agents.length,completed:0,failed:0};for(const f of s.agents)lt(e.nodes,f,"agent")}for(const s of e.forEachGroups)u.add(s.name),lt(e.nodes,s.name,"for_each_group"),e.groupProgress[s.name]={total:0,completed:0,failed:0};for(const s of e.agents)if(!u.has(s.name)&&!a.has(s.name)){const f=s.type||"agent";lt(e.nodes,s.name,f),s.model&&(e.nodes[s.name].model=s.model),u.add(s.name)}e.agentsTotal=u.size},agent_started:(e,n,r)=>{const l=n,a=lt(e.nodes,l.agent_name);a.iteration!=null&&(a.output!=null||a.error_type!=null)&&(a.iterationHistory||(a.iterationHistory=[]),a.iterationHistory.push({iteration:a.iteration,prompt:a.prompt,output:a.output,elapsed:a.elapsed,model:a.model,tokens:a.tokens,input_tokens:a.input_tokens,output_tokens:a.output_tokens,cost_usd:a.cost_usd,activity:a.activity,error_type:a.error_type,error_message:a.error_message})),a.status="running",a.iteration=l.iteration,a.startedAt=r??Date.now()/1e3,a.activity=[],l.context_window_max!=null&&(a.context_window_max=l.context_window_max),a.prompt=void 0,a.output=void 0,a.error_type=void 0,a.error_message=void 0,Qe(e.nodes,l.agent_name)},agent_completed:(e,n)=>{const r=n,l=lt(e.nodes,r.agent_name);l.status="completed",e.agentsCompleted++,l.elapsed=r.elapsed,l.model=r.model,l.tokens=r.tokens,l.input_tokens=r.input_tokens,l.output_tokens=r.output_tokens,l.cost_usd=r.cost_usd,l.output=r.output,l.output_keys=r.output_keys,l.context_window_used=r.context_window_used,l.context_window_max=r.context_window_max,r.context_window_used!=null&&r.context_window_max!=null&&r.context_window_max>0&&(l.context_pct=Math.round(r.context_window_used/r.context_window_max*100)),r.cost_usd&&(e.totalCost+=r.cost_usd),r.tokens&&(e.totalTokens+=r.tokens),Qe(e.nodes,r.agent_name)},agent_failed:(e,n)=>{const r=n,l=lt(e.nodes,r.agent_name);l.status="failed",l.elapsed=r.elapsed,l.error_type=r.error_type,l.error_message=r.message;for(const a of e.routes)a.to===r.agent_name&&(e.highlightedEdges=[...e.highlightedEdges.filter(u=>!(u.from===a.from&&u.to===a.to)),{from:a.from,to:a.to,state:"failed"}]);Qe(e.nodes,r.agent_name)},agent_prompt_rendered:(e,n)=>{var u;const r=n,l=n.item_key,a=lt(e.nodes,r.agent_name);if(a.prompt=r.rendered_prompt,a.context_keys=r.context_keys,l){fo(e.nodes,r.agent_name,l,{type:"prompt",icon:"📝",label:"prompt",text:"Prompt rendered",detail:((u=r.rendered_prompt)==null?void 0:u.slice(0,500))||null});const s=e.nodes[r.agent_name];if(s!=null&&s.for_each_items){const f=s.for_each_items.find(d=>d.key===l);f&&(f.prompt=r.rendered_prompt)}}Qe(e.nodes,r.agent_name)},agent_reasoning:(e,n)=>{const r=n,l=n.item_key,a={type:"reasoning",icon:"💭",label:"thinking",text:r.content};Nu(e.nodes,r.agent_name,a),l&&fo(e.nodes,r.agent_name,l,a),Qe(e.nodes,r.agent_name)},agent_tool_start:(e,n)=>{const r=n,l=n.item_key,a={type:"tool-start",icon:"🔧",label:"tool",text:r.tool_name,detail:r.arguments||null};Nu(e.nodes,r.agent_name,a),l&&fo(e.nodes,r.agent_name,l,a),Qe(e.nodes,r.agent_name)},agent_tool_complete:(e,n)=>{const r=n,l=n.item_key,a={type:"tool-complete",icon:"✓",label:"result",text:r.tool_name||"done",detail:r.result||null};Nu(e.nodes,r.agent_name,a),l&&fo(e.nodes,r.agent_name,l,a),Qe(e.nodes,r.agent_name)},agent_turn_start:(e,n)=>{const r=n,l=n.item_key,a={type:"turn",icon:"⏳",label:"turn",text:`Turn ${r.turn??"?"}`};Nu(e.nodes,r.agent_name,a),l&&fo(e.nodes,r.agent_name,l,a),Qe(e.nodes,r.agent_name)},agent_message:(e,n)=>{const r=n,l=lt(e.nodes,r.agent_name);l.latest_message=r.content,Qe(e.nodes,r.agent_name)},script_started:(e,n,r)=>{const l=n,a=lt(e.nodes,l.agent_name);a.status="running",a.startedAt=r??Date.now()/1e3,Qe(e.nodes,l.agent_name)},script_completed:(e,n)=>{const r=n,l=lt(e.nodes,r.agent_name);l.status="completed",e.agentsCompleted++,l.elapsed=r.elapsed,l.stdout=r.stdout,l.stderr=r.stderr,l.exit_code=r.exit_code,Qe(e.nodes,r.agent_name)},script_failed:(e,n)=>{const r=n,l=lt(e.nodes,r.agent_name);l.status="failed",l.elapsed=r.elapsed,l.error_type=r.error_type,l.error_message=r.message,Qe(e.nodes,r.agent_name)},gate_presented:(e,n)=>{const r=n,l=lt(e.nodes,r.agent_name);l.status="waiting",l.options=r.options,l.option_details=r.option_details,l.prompt=r.prompt,Qe(e.nodes,r.agent_name)},gate_resolved:(e,n)=>{const r=n,l=lt(e.nodes,r.agent_name);l.status="completed",e.agentsCompleted++,l.selected_option=r.selected_option,l.route=r.route,l.additional_input=r.additional_input,Qe(e.nodes,r.agent_name)},route_taken:(e,n)=>{const r=n;e.highlightedEdges=[...e.highlightedEdges.filter(l=>!(l.from===r.from_agent&&l.to===r.to_agent)),{from:r.from_agent,to:r.to_agent,state:"taken"}]},parallel_started:(e,n)=>{const r=n,l=lt(e.nodes,r.group_name,"parallel_group");l.status="running",e.groupProgress[r.group_name]&&(e.groupProgress[r.group_name].total=r.agents.length,e.groupProgress[r.group_name].completed=0,e.groupProgress[r.group_name].failed=0),Qe(e.nodes,r.group_name)},parallel_agent_completed:(e,n)=>{const r=n;e.groupProgress[r.group_name]&&e.groupProgress[r.group_name].completed++;const l=lt(e.nodes,r.agent_name);l.status="completed",l.elapsed=r.elapsed,l.model=r.model,l.tokens=r.tokens,l.cost_usd=r.cost_usd,l.context_window_used=r.context_window_used,l.context_window_max=r.context_window_max,r.context_window_used!=null&&r.context_window_max!=null&&r.context_window_max>0&&(l.context_pct=Math.round(r.context_window_used/r.context_window_max*100)),r.cost_usd&&(e.totalCost+=r.cost_usd),r.tokens&&(e.totalTokens+=r.tokens),Qe(e.nodes,r.agent_name),Qe(e.nodes,r.group_name)},parallel_agent_failed:(e,n)=>{const r=n;e.groupProgress[r.group_name]&&e.groupProgress[r.group_name].failed++;const l=lt(e.nodes,r.agent_name);l.status="failed",l.elapsed=r.elapsed,l.error_type=r.error_type,l.error_message=r.message,Qe(e.nodes,r.agent_name),Qe(e.nodes,r.group_name)},parallel_completed:(e,n)=>{const r=n;e.agentsCompleted++;const l=lt(e.nodes,r.group_name,"parallel_group");l.status=r.failure_count===0?"completed":"failed",Qe(e.nodes,r.group_name)},for_each_started:(e,n)=>{const r=n,l=lt(e.nodes,r.group_name,"for_each_group");l.status="running",l.for_each_items=[],e.groupProgress[r.group_name]&&(e.groupProgress[r.group_name].total=r.item_count,e.groupProgress[r.group_name].completed=0,e.groupProgress[r.group_name].failed=0),Qe(e.nodes,r.group_name)},for_each_item_started:(e,n)=>{const r=n,l=lt(e.nodes,r.group_name,"for_each_group");l.for_each_items||(l.for_each_items=[]),l.for_each_items.push({key:r.item_key??String(r.index),index:r.index,status:"running",activity:[]}),Qe(e.nodes,r.group_name)},for_each_item_completed:(e,n)=>{const r=n;e.groupProgress[r.group_name]&&e.groupProgress[r.group_name].completed++;const l=lt(e.nodes,r.group_name,"for_each_group");if(l.for_each_items){const a=r.item_key??String(r.index),u=l.for_each_items.find(s=>s.key===a);u&&(u.status="completed",u.elapsed=r.elapsed,u.tokens=r.tokens,u.cost_usd=r.cost_usd,u.output=r.output)}Qe(e.nodes,r.group_name)},for_each_item_failed:(e,n)=>{const r=n;e.groupProgress[r.group_name]&&e.groupProgress[r.group_name].failed++;const l=lt(e.nodes,r.group_name,"for_each_group");if(l.for_each_items){const a=r.item_key??String(r.index),u=l.for_each_items.find(s=>s.key===a);u&&(u.status="failed",u.elapsed=r.elapsed,u.error_type=r.error_type,u.error_message=r.message)}Qe(e.nodes,r.group_name)},for_each_completed:(e,n)=>{const r=n;e.agentsCompleted++;const l=lt(e.nodes,r.group_name,"for_each_group");l.status=(r.failure_count??0)===0?"completed":"failed",l.elapsed=r.elapsed,l.success_count=r.success_count,l.failure_count=r.failure_count,Qe(e.nodes,r.group_name)},workflow_completed:(e,n)=>{const r=n;e.workflowStatus="completed",e.isPaused=!1,e.workflowOutput=r.output??null,e.nodes.$end&&(e.nodes.$end.status="completed",Qe(e.nodes,"$end")),e.nodes.$start&&(e.nodes.$start.status="completed",Qe(e.nodes,"$start")),e.highlightedEdges=[]},workflow_failed:(e,n)=>{const r=n;if(e.workflowStatus="failed",e.isPaused=!1,e.workflowFailedAgent=r.agent_name||null,r.agent_name&&e.nodes[r.agent_name]){e.nodes[r.agent_name].status="failed",Qe(e.nodes,r.agent_name);for(const l of e.routes)l.to===r.agent_name&&(e.highlightedEdges=[...e.highlightedEdges.filter(a=>!(a.from===l.from&&a.to===l.to)),{from:l.from,to:l.to,state:"failed"}])}e.workflowFailure={error_type:r.error_type,message:r.message,elapsed_seconds:r.elapsed_seconds,timeout_seconds:r.timeout_seconds,current_agent:r.current_agent},e.nodes.$start&&(e.nodes.$start.status="completed",Qe(e.nodes,"$start"))},checkpoint_saved:(e,n)=>{const r=n;r.path&&e.workflowFailure&&(e.workflowFailure={...e.workflowFailure,checkpoint_path:r.path})},agent_paused:(e,n)=>{const r=n,l=lt(e.nodes,r.agent_name);l.status="waiting",l.activity.push({type:"agent_paused",icon:"⏸",label:"Paused",text:"Agent paused — click Resume to re-execute"}),Qe(e.nodes,r.agent_name),e.isPaused=!0},agent_resumed:(e,n)=>{const r=n,l=lt(e.nodes,r.agent_name);l.status="running",l.activity.push({type:"agent_resumed",icon:"▶",label:"Resumed",text:"Agent resumed — re-executing"}),Qe(e.nodes,r.agent_name),e.isPaused=!1}};function Tu(e){var l,a;const n=e.timestamp,r=e.data;switch(e.type){case"workflow_started":return{timestamp:n,level:"info",source:"workflow",message:`Workflow "${r.name||""}" started`};case"agent_started":return{timestamp:n,level:"info",source:String(r.agent_name),message:`Agent started${r.iteration!=null?` (iteration ${r.iteration})`:""}`};case"agent_completed":return{timestamp:n,level:"success",source:String(r.agent_name),message:`Agent completed${r.elapsed!=null?` in ${Yu(r.elapsed)}`:""}${r.tokens!=null?` · ${r.tokens.toLocaleString()} tokens`:""}${r.cost_usd!=null?` · $${r.cost_usd.toFixed(4)}`:""}`};case"agent_failed":return{timestamp:n,level:"error",source:String(r.agent_name),message:`Agent failed: ${r.message||r.error_type||"unknown error"}`};case"script_started":return{timestamp:n,level:"info",source:String(r.agent_name),message:"Script started"};case"script_completed":return{timestamp:n,level:"success",source:String(r.agent_name),message:`Script completed (exit ${r.exit_code??"?"})${r.elapsed!=null?` in ${Yu(r.elapsed)}`:""}`};case"script_failed":return{timestamp:n,level:"error",source:String(r.agent_name),message:`Script failed: ${r.message||r.error_type||"unknown error"}`};case"gate_presented":return{timestamp:n,level:"warning",source:String(r.agent_name),message:"Waiting for human input…"};case"gate_resolved":return{timestamp:n,level:"success",source:String(r.agent_name),message:`Gate resolved → ${r.selected_option||"continue"}`};case"route_taken":return{timestamp:n,level:"debug",source:"router",message:`${r.from_agent} → ${r.to_agent}`};case"parallel_started":return{timestamp:n,level:"info",source:String(r.group_name),message:`Parallel group started (${((l=r.agents)==null?void 0:l.length)||"?"} agents)`};case"parallel_completed":return{timestamp:n,level:r.failure_count===0?"success":"error",source:String(r.group_name),message:`Parallel group completed${r.failure_count>0?` with ${r.failure_count} failure(s)`:""}`};case"for_each_started":return{timestamp:n,level:"info",source:String(r.group_name),message:`For-each started (${r.item_count} items)`};case"for_each_completed":return{timestamp:n,level:(r.failure_count??0)===0?"success":"error",source:String(r.group_name),message:`For-each completed · ${r.success_count} succeeded${r.failure_count>0?` · ${r.failure_count} failed`:""}`};case"workflow_completed":return{timestamp:n,level:"success",source:"workflow",message:`Workflow completed${r.elapsed!=null?` in ${Yu(r.elapsed)}`:""}`};case"workflow_failed":return{timestamp:n,level:"error",source:"workflow",message:`Workflow failed: ${r.message||r.error_type||"unknown error"}`};case"checkpoint_saved":return{timestamp:n,level:"info",source:"workflow",message:`Checkpoint saved: ${((a=r.path)==null?void 0:a.split("/").pop())||"unknown"}`};case"agent_paused":return{timestamp:n,level:"warning",source:String(r.agent_name),message:"Agent paused — waiting for resume"};case"agent_resumed":return{timestamp:n,level:"info",source:String(r.agent_name),message:"Agent resumed — re-executing"};default:return null}}function Yu(e){if(e<1)return`${(e*1e3).toFixed(0)}ms`;if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e/60),r=(e%60).toFixed(0);return`${n}m ${r}s`}function Au(e){const n=e.timestamp,r=e.data;switch(e.type){case"agent_started":return{timestamp:n,source:String(r.agent_name),type:"turn",message:`Agent started${r.iteration!=null?` (iteration ${r.iteration})`:""}`};case"agent_prompt_rendered":return{timestamp:n,source:String(r.agent_name),type:"prompt",message:"Prompt rendered",detail:ho(String(r.rendered_prompt||""),500)};case"agent_reasoning":return{timestamp:n,source:String(r.agent_name),type:"reasoning",message:String(r.content||"")};case"agent_tool_start":return{timestamp:n,source:String(r.agent_name),type:"tool-start",message:`→ ${r.tool_name}`,detail:r.arguments?ho(String(r.arguments),300):null};case"agent_tool_complete":return{timestamp:n,source:String(r.agent_name),type:"tool-complete",message:`← ${r.tool_name||"done"}`,detail:r.result?ho(String(r.result),300):null};case"agent_turn_start":return{timestamp:n,source:String(r.agent_name),type:"turn",message:`Turn ${r.turn??"?"}`};case"agent_message":return{timestamp:n,source:String(r.agent_name),type:"message",message:ho(String(r.content||""),500)};case"agent_completed":return{timestamp:n,source:String(r.agent_name),type:"turn",message:`Completed${r.elapsed!=null?` in ${Yu(r.elapsed)}`:""}${r.tokens!=null?` · ${r.tokens.toLocaleString()} tokens`:""}`};case"agent_failed":return{timestamp:n,source:String(r.agent_name),type:"turn",message:`Failed: ${r.message||r.error_type||"unknown"}`};case"script_started":return{timestamp:n,source:String(r.agent_name),type:"turn",message:"Script started"};case"script_completed":return{timestamp:n,source:String(r.agent_name),type:"tool-complete",message:`Script completed (exit ${r.exit_code??"?"})`,detail:r.stdout?ho(String(r.stdout),300):null};case"script_failed":return{timestamp:n,source:String(r.agent_name),type:"turn",message:`Script failed: ${r.message||r.error_type||"unknown"}`};default:return null}}function ho(e,n){return e.length<=n?e:e.slice(0,n)+"…"}function Fx(e){const n=e.match(/^(\s*)/);return n?n[1].length:0}function mN(e){const n=new Map;for(let r=0;ra)u=s;else break}u>r&&n.set(r,u)}return n}function gN(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,a,u,s,f]=n;return b.jsxs("span",{children:[l,a??"",b.jsx("span",{className:"text-sky-400",children:u}),b.jsx("span",{className:"text-[var(--text-muted)]",children:s}),Gx(f)]})}const r=e.match(/^(\s*)(- )(.*)/);if(r){const[,l,a,u]=r;return b.jsxs("span",{children:[l,b.jsx("span",{className:"text-[var(--text-muted)]",children:a}),Gx(u)]})}return b.jsx("span",{children:e})}function Gx(e){if(!e)return"";const n=e.indexOf(" #"),r=n>=0?e.slice(0,n):e,l=n>=0?e.slice(n):"";let a=r;return/^(true|false|null|yes|no)$/i.test(r.trim())?a=b.jsx("span",{className:"text-amber-400",children:r}):/^\d+(\.\d+)?$/.test(r.trim())?a=b.jsx("span",{className:"text-amber-400",children:r}):/^["'].*["']$/.test(r.trim())?a=b.jsx("span",{className:"text-green-400",children:r}):(r.includes("|")||r.includes(">"))&&(a=b.jsx("span",{className:"text-[var(--text-secondary)]",children:r})),b.jsxs(b.Fragment,{children:[a,l&&b.jsx("span",{className:"text-emerald-500/70",children:l})]})}function yN({yaml:e,onClose:n}){const[r,l]=$.useState(new Set);$.useEffect(()=>{const d=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[n]);const a=$.useMemo(()=>e.split(` +`),[e]),u=$.useMemo(()=>mN(a),[a]),s=$.useCallback(d=>{l(h=>{const m=new Set(h);return m.has(d)?m.delete(d):m.add(d),m})},[]),f=$.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:()=>s(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(fa,{className:"w-3 h-3"}):b.jsx(Wi,{className:"w-3 h-3"})}):null}),b.jsxs("span",{className:"flex-1",children:[gN(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:()=>s(d),children:"···"})]})]},d))})})]})]})}function xN(){const e=he(S=>S.workflowName),n=he(S=>S.workflowStatus),r=he(S=>S.isPaused),l=he(S=>S.workflowYaml),a=he(S=>S.conductorVersion),[u,s]=$.useState(!1),[f,d]=$.useState(!1),[h,m]=$.useState(!1),[p,y]=$.useState(!1),x=n==="running"||n==="pending";$.useEffect(()=>{r||(s(!1),d(!1),m(!1))},[r]);const w=async()=>{s(!0);try{await fetch("/api/stop",{method:"POST"})}catch(S){console.error("Failed to stop agent:",S),s(!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(Wb,{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:[r?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(am,{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(da,{className:"w-3 h-3"}),h?"Killing...":"Kill"]})]}):x?b.jsxs("button",{onClick:w,disabled:u,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(nw,{className:"w-3 h-3"}),u?"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(Kk,{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(Qk,{className:"w-3 h-3"}),"Logs"]}),b.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["v",a??"—"]})]}),p&&l&&b.jsx(yN,{yaml:l,onClose:()=>y(!1)})]})}function Ye(...e){return e.filter(Boolean).join(" ")}function on(e){if(e==null)return"";if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e/60),r=(e%60).toFixed(0);return`${n}m ${r}s`}function tr(e){return e==null?"":e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:`${e}`}function na(e){return e==null?"":`$${e.toFixed(4)}`}function iw(e){return e==null?"":typeof e=="string"?e:JSON.stringify(e,null,2)}function vN(e,n){if(n<=0)return`${e.toLocaleString()} tokens (limit unknown)`;const r=a=>a.toLocaleString(),l=(e/n*100).toFixed(1);return`${r(e)} / ${r(n)} (${l}%)`}function lw(){const e=he(f=>f.workflowStatus),n=he(f=>f.workflowStartTime),r=he(f=>f.replayMode),l=he(f=>f.lastEventTime),[a,u]=$.useState("—"),s=$.useRef(null);return $.useEffect(()=>{if(n!=null){if(r){s.current&&(clearInterval(s.current),s.current=null),u(on((l??n)-n));return}if(e==="running"){const f=()=>{const d=Date.now()/1e3-n;u(on(d))};return f(),s.current=setInterval(f,500),()=>{s.current&&clearInterval(s.current)}}else(e==="completed"||e==="failed")&&s.current&&(clearInterval(s.current),s.current=null)}},[e,n,r,l]),a}function bN(){const e=he(E=>E.workflowStatus),n=he(E=>E.agentsCompleted),r=he(E=>E.agentsTotal),l=he(E=>E.totalCost),a=he(E=>E.totalTokens),u=he(E=>E.wsStatus),s=he(E=>E.workflowFailure),f=he(E=>E.lastEventTime),d=lw(),[h,m]=$.useState(null);$.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(!s)return"Failed";const E=s.error_type||"";return E==="MaxIterationsError"?"Failed: exceeded maximum iterations":E==="TimeoutError"?"Failed: workflow timed out":s.message?`Failed: ${s.message.length>60?s.message.slice(0,57)+"...":s.message}`:`Failed: ${E}`}}})(),x={pending:"bg-[var(--pending)]",running:"bg-[var(--running)] animate-pulse",completed:"bg-[var(--completed)]",failed:"bg-[var(--failed)]"}[e],w=(()=>{switch(u){case"connected":return b.jsxs("span",{className:"flex items-center gap-1 text-[var(--completed)]",children:[b.jsx(uN,{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(sN,{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(ta,{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(ta,{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",x)}),b.jsx("span",{className:Ye(p?"text-red-300":"text-[var(--text)]"),children:y}),r>0&&b.jsxs("span",{className:Ye(p?"text-red-400/60":"text-[var(--text-muted)]"),children:[n,"/",r," agents"]}),e!=="pending"&&b.jsx("span",{className:Ye("font-mono",p?"text-red-400/60":"text-[var(--text-muted)]"),children:d}),a>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:a.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(Xk,{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(Pk,{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 wN=[1,5,10,20,50];function SN(e,n){if(n===0||e.length===0)return"+0.0s";const r=e[0].timestamp,a=e[Math.min(n,e.length)-1].timestamp-r;if(a<60)return`+${a.toFixed(1)}s`;const u=Math.floor(a/60),s=a%60;return`+${u}m${s.toFixed(0)}s`}function _N(){const e=he(p=>p.replayPosition),n=he(p=>p.replayTotalEvents),r=he(p=>p.replayPlaying),l=he(p=>p.replaySpeed),a=he(p=>p.replayEvents),u=he(p=>p.setReplayPosition),s=he(p=>p.setReplayPlaying),f=he(p=>p.setReplaySpeed),d=p=>{const y=parseInt(p.target.value,10);u(y),r&&s(!1)},h=()=>{!r&&e>=n&&u(0),s(!r)},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:r?"Pause":"Play",children:r?b.jsx(nN,{className:"w-3.5 h-3.5"}):b.jsx(am,{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; + height: 12px; + border-radius: 50%; + background: var(--accent); + border: 2px solid var(--surface); + cursor: pointer; + box-shadow: 0 0 4px rgba(99, 102, 241, 0.4); + } + footer input[type="range"]::-moz-range-thumb { + width: 12px; + height: 12px; + border-radius: 50%; + background: var(--accent); + border: 2px solid var(--surface); + 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:SN(a,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:wN.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 yc=$.createContext(null);yc.displayName="PanelGroupContext";const yt={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"},om=10,$i=$.useLayoutEffect,Px=Rk.useId,EN=typeof Px=="function"?Px:()=>null;let kN=0;function sm(e=null){const n=EN(),r=$.useRef(e||n||null);return r.current===null&&(r.current=""+kN++),e??r.current}function aw({children:e,className:n="",collapsedSize:r,collapsible:l,defaultSize:a,forwardedRef:u,id:s,maxSize:f,minSize:d,onCollapse:h,onExpand:m,onResize:p,order:y,style:x,tagName:w="div",...E}){const _=$.useContext(yc);if(_===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:S,expandPanel:T,getPanelSize:k,getPanelStyle:z,groupId:M,isPanelCollapsed:A,reevaluatePanelConstraints:q,registerPanel:j,resizePanel:H,unregisterPanel:R}=_,B=sm(s),U=$.useRef({callbacks:{onCollapse:h,onExpand:m,onResize:p},constraints:{collapsedSize:r,collapsible:l,defaultSize:a,maxSize:f,minSize:d},id:B,idIsFromProps:s!==void 0,order:y});$.useRef({didLogMissingDefaultSizeWarning:!1}),$i(()=>{const{callbacks:I,constraints:F}=U.current,L={...F};U.current.id=B,U.current.idIsFromProps=s!==void 0,U.current.order=y,I.onCollapse=h,I.onExpand=m,I.onResize=p,F.collapsedSize=r,F.collapsible=l,F.defaultSize=a,F.maxSize=f,F.minSize=d,(L.collapsedSize!==F.collapsedSize||L.collapsible!==F.collapsible||L.maxSize!==F.maxSize||L.minSize!==F.minSize)&&q(U.current,L)}),$i(()=>{const I=U.current;return j(I),()=>{R(I)}},[y,B,j,R]),$.useImperativeHandle(u,()=>({collapse:()=>{S(U.current)},expand:I=>{T(U.current,I)},getId(){return B},getSize(){return k(U.current)},isCollapsed(){return A(U.current)},isExpanded(){return!A(U.current)},resize:I=>{H(U.current,I)}}),[S,T,k,A,B,H]);const W=z(U.current,a);return $.createElement(w,{...E,children:e,className:n,id:B,style:{...W,...x},[yt.groupId]:M,[yt.panel]:"",[yt.panelCollapsible]:l||void 0,[yt.panelId]:B,[yt.panelSize]:parseFloat(""+W.flexGrow).toFixed(1)})}const bo=$.forwardRef((e,n)=>$.createElement(aw,{...e,forwardedRef:n}));aw.displayName="Panel";bo.displayName="forwardRef(Panel)";let jp=null,Fu=-1,hi=null;function NN(e,n){if(n){const r=(n&fw)!==0,l=(n&dw)!==0,a=(n&hw)!==0,u=(n&pw)!==0;if(r)return a?"se-resize":u?"ne-resize":"e-resize";if(l)return a?"sw-resize":u?"nw-resize":"w-resize";if(a)return"s-resize";if(u)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function CN(){hi!==null&&(document.head.removeChild(hi),jp=null,hi=null,Fu=-1)}function nh(e,n){var r,l;const a=NN(e,n);if(jp!==a){if(jp=a,hi===null&&(hi=document.createElement("style"),document.head.appendChild(hi)),Fu>=0){var u;(u=hi.sheet)===null||u===void 0||u.removeRule(Fu)}Fu=(r=(l=hi.sheet)===null||l===void 0?void 0:l.insertRule(`*{cursor: ${a} !important;}`))!==null&&r!==void 0?r:-1}}function ow(e){return e.type==="keydown"}function sw(e){return e.type.startsWith("pointer")}function uw(e){return e.type.startsWith("mouse")}function xc(e){if(sw(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(uw(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function TN(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function AN(e,n,r){return e.xn.x&&e.yn.y}function zN(e,n){if(e===n)throw new Error("Cannot compare node with itself");const r={a:Zx(e),b:Zx(n)};let l;for(;r.a.at(-1)===r.b.at(-1);)e=r.a.pop(),n=r.b.pop(),l=e;Re(l,"Stacking order can only be calculated for elements with a common ancestor");const a={a:Qx(Xx(r.a)),b:Qx(Xx(r.b))};if(a.a===a.b){const u=l.childNodes,s={a:r.a.at(-1),b:r.b.at(-1)};let f=u.length;for(;f--;){const d=u[f];if(d===s.a)return 1;if(d===s.b)return-1}}return Math.sign(a.a-a.b)}const MN=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function jN(e){var n;const r=getComputedStyle((n=cw(e))!==null&&n!==void 0?n:e).display;return r==="flex"||r==="inline-flex"}function DN(e){const n=getComputedStyle(e);return!!(n.position==="fixed"||n.zIndex!=="auto"&&(n.position!=="static"||jN(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"||MN.test(n.willChange)||n.webkitOverflowScrolling==="touch")}function Xx(e){let n=e.length;for(;n--;){const r=e[n];if(Re(r,"Missing node"),DN(r))return r}return null}function Qx(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Zx(e){const n=[];for(;e;)n.push(e),e=cw(e);return n}function cw(e){const{parentNode:n}=e;return n&&n instanceof ShadowRoot?n.host:n}const fw=1,dw=2,hw=4,pw=8,RN=TN()==="coarse";let $n=[],Kl=!1,qi=new Map,vc=new Map;const Mo=new Set;function ON(e,n,r,l,a){var u;const{ownerDocument:s}=n,f={direction:r,element:n,hitAreaMargins:l,setResizeHandlerState:a},d=(u=qi.get(s))!==null&&u!==void 0?u:0;return qi.set(s,d+1),Mo.add(f),Wu(),function(){var m;vc.delete(e),Mo.delete(f);const p=(m=qi.get(s))!==null&&m!==void 0?m:1;if(qi.set(s,p-1),Wu(),p===1&&qi.delete(s),$n.includes(f)){const y=$n.indexOf(f);y>=0&&$n.splice(y,1),cm(),a("up",!0,null)}}}function LN(e){const{target:n}=e,{x:r,y:l}=xc(e);Kl=!0,um({target:n,x:r,y:l}),Wu(),$n.length>0&&(ec("down",e),e.preventDefault(),mw(n)||e.stopImmediatePropagation())}function rh(e){const{x:n,y:r}=xc(e);if(Kl&&e.buttons===0&&(Kl=!1,ec("up",e)),!Kl){const{target:l}=e;um({target:l,x:n,y:r})}ec("move",e),cm(),$n.length>0&&e.preventDefault()}function ih(e){const{target:n}=e,{x:r,y:l}=xc(e);vc.clear(),Kl=!1,$n.length>0&&(e.preventDefault(),mw(n)||e.stopImmediatePropagation()),ec("up",e),um({target:n,x:r,y:l}),cm(),Wu()}function mw(e){let n=e;for(;n;){if(n.hasAttribute(yt.resizeHandle))return!0;n=n.parentElement}return!1}function um({target:e,x:n,y:r}){$n.splice(0);let l=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(l=e),Mo.forEach(a=>{const{element:u,hitAreaMargins:s}=a,f=u.getBoundingClientRect(),{bottom:d,left:h,right:m,top:p}=f,y=RN?s.coarse:s.fine;if(n>=h-y&&n<=m+y&&r>=p-y&&r<=d+y){if(l!==null&&document.contains(l)&&u!==l&&!u.contains(l)&&!l.contains(u)&&zN(l,u)>0){let w=l,E=!1;for(;w&&!w.contains(u);){if(AN(w.getBoundingClientRect(),f)){E=!0;break}w=w.parentElement}if(E)return}$n.push(a)}})}function lh(e,n){vc.set(e,n)}function cm(){let e=!1,n=!1;$n.forEach(l=>{const{direction:a}=l;a==="horizontal"?e=!0:n=!0});let r=0;vc.forEach(l=>{r|=l}),e&&n?nh("intersection",r):e?nh("horizontal",r):n?nh("vertical",r):CN()}let ah=new AbortController;function Wu(){ah.abort(),ah=new AbortController;const e={capture:!0,signal:ah.signal};Mo.size&&(Kl?($n.length>0&&qi.forEach((n,r)=>{const{body:l}=r;n>0&&(l.addEventListener("contextmenu",ih,e),l.addEventListener("pointerleave",rh,e),l.addEventListener("pointermove",rh,e))}),window.addEventListener("pointerup",ih,e),window.addEventListener("pointercancel",ih,e)):qi.forEach((n,r)=>{const{body:l}=r;n>0&&(l.addEventListener("pointerdown",LN,e),l.addEventListener("pointermove",rh,e))}))}function ec(e,n){Mo.forEach(r=>{const{setResizeHandlerState:l}=r,a=$n.includes(r);l(e,a,n)})}function HN(){const[e,n]=$.useState(0);return $.useCallback(()=>n(r=>r+1),[])}function Re(e,n){if(!e)throw console.error(n),Error(n)}function Gi(e,n,r=om){return e.toFixed(r)===n.toFixed(r)?0:e>n?1:-1}function Tr(e,n,r=om){return Gi(e,n,r)===0}function vn(e,n,r){return Gi(e,n,r)===0}function BN(e,n,r){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=r[p];Re(y,`No panel constraints found for index ${p}`);const{collapsedSize:x=0,collapsible:w,minSize:E=0}=y;if(w){const _=n[p];if(Re(_!=null,`Previous layout not found for panel index ${p}`),vn(_,E)){const S=_-x;Gi(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}}{const p=e<0?1:-1;let y=e<0?d:f,x=0;for(;;){const E=n[y];Re(E!=null,`Previous layout not found for panel index ${y}`);const S=Pl({panelConstraints:r,panelIndex:y,size:100})-E;if(x+=S,y+=p,y<0||y>=r.length)break}const w=Math.min(Math.abs(e),Math.abs(x));e=e<0?0-w:w}{let y=e<0?f:d;for(;y>=0&&y=0))break;e<0?y--:y++}}if(BN(a,s))return a;{const p=e<0?d:f,y=n[p];Re(y!=null,`Previous layout not found for panel index ${p}`);const x=y+h,w=Pl({panelConstraints:r,panelIndex:p,size:x});if(s[p]=w,!vn(w,x)){let E=x-w,S=e<0?d:f;for(;S>=0&&S0?S--:S++}}}const m=s.reduce((p,y)=>y+p,0);return vn(m,100)?s:a}function IN({layout:e,panelsArray:n,pivotIndices:r}){let l=0,a=100,u=0,s=0;const f=r[0];Re(f!=null,"No pivot index found"),n.forEach((p,y)=>{const{constraints:x}=p,{maxSize:w=100,minSize:E=0}=x;y===f?(l=E,a=w):(u+=E,s+=w)});const d=Math.min(a,100-u),h=Math.max(l,100-s),m=e[f];return{valueMax:d,valueMin:h,valueNow:m}}function jo(e,n=document){return Array.from(n.querySelectorAll(`[${yt.resizeHandleId}][data-panel-group-id="${e}"]`))}function gw(e,n,r=document){const a=jo(e,r).findIndex(u=>u.getAttribute(yt.resizeHandleId)===n);return a??null}function yw(e,n,r){const l=gw(e,n,r);return l!=null?[l,l+1]:[-1,-1]}function xw(e,n=document){var r;if(n instanceof HTMLElement&&(n==null||(r=n.dataset)===null||r===void 0?void 0:r.panelGroupId)==e)return n;const l=n.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return l||null}function bc(e,n=document){const r=n.querySelector(`[${yt.resizeHandleId}="${e}"]`);return r||null}function qN(e,n,r,l=document){var a,u,s,f;const d=bc(n,l),h=jo(e,l),m=d?h.indexOf(d):-1,p=(a=(u=r[m])===null||u===void 0?void 0:u.id)!==null&&a!==void 0?a:null,y=(s=(f=r[m+1])===null||f===void 0?void 0:f.id)!==null&&s!==void 0?s:null;return[p,y]}function UN({committedValuesRef:e,eagerValuesRef:n,groupId:r,layout:l,panelDataArray:a,panelGroupElement:u,setLayout:s}){$.useRef({didWarnAboutMissingResizeHandle:!1}),$i(()=>{if(!u)return;const f=jo(r,u);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")})}},[r,l,a,u]),$.useEffect(()=>{if(!u)return;const f=n.current;Re(f,"Eager values not found");const{panelDataArray:d}=f,h=xw(r,u);Re(h!=null,`No group found for id "${r}"`);const m=jo(r,u);Re(m,`No resize handles found for group id "${r}"`);const p=m.map(y=>{const x=y.getAttribute(yt.resizeHandleId);Re(x,"Resize handle element has no handle id attribute");const[w,E]=qN(r,x,d,u);if(w==null||E==null)return()=>{};const _=S=>{if(!S.defaultPrevented)switch(S.key){case"Enter":{S.preventDefault();const T=d.findIndex(k=>k.id===w);if(T>=0){const k=d[T];Re(k,`No panel data found for index ${T}`);const z=l[T],{collapsedSize:M=0,collapsible:A,minSize:q=0}=k.constraints;if(z!=null&&A){const j=wo({delta:vn(z,M)?q-M:M-z,initialLayout:l,panelConstraints:d.map(H=>H.constraints),pivotIndices:yw(r,x,u),prevLayout:l,trigger:"keyboard"});l!==j&&s(j)}}break}}};return y.addEventListener("keydown",_),()=>{y.removeEventListener("keydown",_)}});return()=>{p.forEach(y=>y())}},[u,e,n,r,l,a,s])}function Kx(e,n){if(e.length!==n.length)return!1;for(let r=0;ru.constraints);let l=0,a=100;for(let u=0;u{const u=e[a];Re(u,`Panel data not found for index ${a}`);const{callbacks:s,constraints:f,id:d}=u,{collapsedSize:h=0,collapsible:m}=f,p=r[d];if(p==null||l!==p){r[d]=l;const{onCollapse:y,onExpand:x,onResize:w}=s;w&&w(l,p),m&&(y||x)&&(x&&(p==null||Tr(p,h))&&!Tr(l,h)&&x(),y&&(p==null||!Tr(p,h))&&Tr(l,h)&&y())}})}function zu(e,n){if(e.length!==n.length)return!1;for(let r=0;r{r!==null&&clearTimeout(r),r=setTimeout(()=>{e(...a)},n)}}function Jx(e){try{if(typeof localStorage<"u")e.getItem=n=>localStorage.getItem(n),e.setItem=(n,r)=>{localStorage.setItem(n,r)};else throw new Error("localStorage not supported in this environment")}catch(n){console.error(n),e.getItem=()=>null,e.setItem=()=>{}}}function bw(e){return`react-resizable-panels:${e}`}function ww(e){return e.map(n=>{const{constraints:r,id:l,idIsFromProps:a,order:u}=n;return a?l:u?`${u}:${JSON.stringify(r)}`:JSON.stringify(r)}).sort((n,r)=>n.localeCompare(r)).join(",")}function Sw(e,n){try{const r=bw(e),l=n.getItem(r);if(l){const a=JSON.parse(l);if(typeof a=="object"&&a!=null)return a}}catch{}return null}function PN(e,n,r){var l,a;const u=(l=Sw(e,r))!==null&&l!==void 0?l:{},s=ww(n);return(a=u[s])!==null&&a!==void 0?a:null}function XN(e,n,r,l,a){var u;const s=bw(e),f=ww(n),d=(u=Sw(e,a))!==null&&u!==void 0?u:{};d[f]={expandToSizes:Object.fromEntries(r.entries()),layout:l};try{a.setItem(s,JSON.stringify(d))}catch(h){console.error(h)}}function Wx({layout:e,panelConstraints:n}){const r=[...e],l=r.reduce((u,s)=>u+s,0);if(r.length!==n.length)throw Error(`Invalid ${n.length} panel layout: ${r.map(u=>`${u}%`).join(", ")}`);if(!vn(l,100)&&r.length>0)for(let u=0;u(Jx(So),So.getItem(e)),setItem:(e,n)=>{Jx(So),So.setItem(e,n)}},ev={};function _w({autoSaveId:e=null,children:n,className:r="",direction:l,forwardedRef:a,id:u=null,onLayout:s=null,keyboardResizeBy:f=null,storage:d=So,style:h,tagName:m="div",...p}){const y=sm(u),x=$.useRef(null),[w,E]=$.useState(null),[_,S]=$.useState([]),T=HN(),k=$.useRef({}),z=$.useRef(new Map),M=$.useRef(0),A=$.useRef({autoSaveId:e,direction:l,dragState:w,id:y,keyboardResizeBy:f,onLayout:s,storage:d}),q=$.useRef({layout:_,panelDataArray:[],panelDataArrayChanged:!1});$.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),$.useImperativeHandle(a,()=>({getId:()=>A.current.id,getLayout:()=>{const{layout:N}=q.current;return N},setLayout:N=>{const{onLayout:Y}=A.current,{layout:X,panelDataArray:K}=q.current,ne=Wx({layout:N,panelConstraints:K.map(re=>re.constraints)});Kx(X,ne)||(S(ne),q.current.layout=ne,Y&&Y(ne),ql(K,ne,k.current))}}),[]),$i(()=>{A.current.autoSaveId=e,A.current.direction=l,A.current.dragState=w,A.current.id=y,A.current.onLayout=s,A.current.storage=d}),UN({committedValuesRef:A,eagerValuesRef:q,groupId:y,layout:_,panelDataArray:q.current.panelDataArray,setLayout:S,panelGroupElement:x.current}),$.useEffect(()=>{const{panelDataArray:N}=q.current;if(e){if(_.length===0||_.length!==N.length)return;let Y=ev[e];Y==null&&(Y=GN(XN,QN),ev[e]=Y);const X=[...N],K=new Map(z.current);Y(e,X,K,_,d)}},[e,_,d]),$.useEffect(()=>{});const j=$.useCallback(N=>{const{onLayout:Y}=A.current,{layout:X,panelDataArray:K}=q.current;if(N.constraints.collapsible){const ne=K.map(ve=>ve.constraints),{collapsedSize:re=0,panelSize:se,pivotIndices:ye}=Hi(K,N,X);if(Re(se!=null,`Panel size not found for panel "${N.id}"`),!Tr(se,re)){z.current.set(N.id,se);const xe=Yl(K,N)===K.length-1?se-re:re-se,pe=wo({delta:xe,initialLayout:X,panelConstraints:ne,pivotIndices:ye,prevLayout:X,trigger:"imperative-api"});zu(X,pe)||(S(pe),q.current.layout=pe,Y&&Y(pe),ql(K,pe,k.current))}}},[]),H=$.useCallback((N,Y)=>{const{onLayout:X}=A.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}=Hi(ne,N,K),pe=Y??ve;if(Tr(ye,se)){const _e=z.current.get(N.id),Me=_e!=null&&_e>=pe?_e:pe,ut=Yl(ne,N)===ne.length-1?ye-Me:Me-ye,et=wo({delta:ut,initialLayout:K,panelConstraints:re,pivotIndices:xe,prevLayout:K,trigger:"imperative-api"});zu(K,et)||(S(et),q.current.layout=et,X&&X(et),ql(ne,et,k.current))}}},[]),R=$.useCallback(N=>{const{layout:Y,panelDataArray:X}=q.current,{panelSize:K}=Hi(X,N,Y);return Re(K!=null,`Panel size not found for panel "${N.id}"`),K},[]),B=$.useCallback((N,Y)=>{const{panelDataArray:X}=q.current,K=Yl(X,N);return FN({defaultSize:Y,dragState:w,layout:_,panelData:X,panelIndex:K})},[w,_]),U=$.useCallback(N=>{const{layout:Y,panelDataArray:X}=q.current,{collapsedSize:K=0,collapsible:ne,panelSize:re}=Hi(X,N,Y);return Re(re!=null,`Panel size not found for panel "${N.id}"`),ne===!0&&Tr(re,K)},[]),W=$.useCallback(N=>{const{layout:Y,panelDataArray:X}=q.current,{collapsedSize:K=0,collapsible:ne,panelSize:re}=Hi(X,N,Y);return Re(re!=null,`Panel size not found for panel "${N.id}"`),!ne||Gi(re,K)>0},[]),I=$.useCallback(N=>{const{panelDataArray:Y}=q.current;Y.push(N),Y.sort((X,K)=>{const ne=X.order,re=K.order;return ne==null&&re==null?0:ne==null?-1:re==null?1:ne-re}),q.current.panelDataArrayChanged=!0,T()},[T]);$i(()=>{if(q.current.panelDataArrayChanged){q.current.panelDataArrayChanged=!1;const{autoSaveId:N,onLayout:Y,storage:X}=A.current,{layout:K,panelDataArray:ne}=q.current;let re=null;if(N){const ye=PN(N,ne,X);ye&&(z.current=new Map(Object.entries(ye.expandToSizes)),re=ye.layout)}re==null&&(re=YN({panelDataArray:ne}));const se=Wx({layout:re,panelConstraints:ne.map(ye=>ye.constraints)});Kx(K,se)||(S(se),q.current.layout=se,Y&&Y(se),ql(ne,se,k.current))}}),$i(()=>{const N=q.current;return()=>{N.layout=[]}},[]);const F=$.useCallback(N=>{let Y=!1;const X=x.current;return X&&window.getComputedStyle(X,null).getPropertyValue("direction")==="rtl"&&(Y=!0),function(ne){ne.preventDefault();const re=x.current;if(!re)return()=>null;const{direction:se,dragState:ye,id:ve,keyboardResizeBy:xe,onLayout:pe}=A.current,{layout:_e,panelDataArray:Me}=q.current,{initialLayout:Te}=ye??{},ut=yw(ve,N,re);let et=$N(ne,N,se,ye,xe,re);const zt=se==="horizontal";zt&&Y&&(et=-et);const Ut=Me.map(Dn=>Dn.constraints),Ot=wo({delta:et,initialLayout:Te??_e,panelConstraints:Ut,pivotIndices:ut,prevLayout:_e,trigger:ow(ne)?"keyboard":"mouse-or-touch"}),_n=!zu(_e,Ot);(sw(ne)||uw(ne))&&M.current!=et&&(M.current=et,!_n&&et!==0?zt?lh(N,et<0?fw:dw):lh(N,et<0?hw:pw):lh(N,0)),_n&&(S(Ot),q.current.layout=Ot,pe&&pe(Ot),ql(Me,Ot,k.current))}},[]),L=$.useCallback((N,Y)=>{const{onLayout:X}=A.current,{layout:K,panelDataArray:ne}=q.current,re=ne.map(_e=>_e.constraints),{panelSize:se,pivotIndices:ye}=Hi(ne,N,K);Re(se!=null,`Panel size not found for panel "${N.id}"`);const xe=Yl(ne,N)===ne.length-1?se-Y:Y-se,pe=wo({delta:xe,initialLayout:K,panelConstraints:re,pivotIndices:ye,prevLayout:K,trigger:"imperative-api"});zu(K,pe)||(S(pe),q.current.layout=pe,X&&X(pe),ql(ne,pe,k.current))},[]),G=$.useCallback((N,Y)=>{const{layout:X,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}=Hi(K,N,X);pe!=null&&(re&&ye&&Tr(pe,ne)?Tr(ne,se)||L(N,se):peve&&L(N,ve))},[L]),Z=$.useCallback((N,Y)=>{const{direction:X}=A.current,{layout:K}=q.current;if(!x.current)return;const ne=bc(N,x.current);Re(ne,`Drag handle element not found for id "${N}"`);const re=vw(X,Y);E({dragHandleId:N,dragHandleRect:ne.getBoundingClientRect(),initialCursorPosition:re,initialLayout:K})},[]),J=$.useCallback(()=>{E(null)},[]),D=$.useCallback(N=>{const{panelDataArray:Y}=q.current,X=Yl(Y,N);X>=0&&(Y.splice(X,1),delete k.current[N.id],q.current.panelDataArrayChanged=!0,T())},[T]),V=$.useMemo(()=>({collapsePanel:j,direction:l,dragState:w,expandPanel:H,getPanelSize:R,getPanelStyle:B,groupId:y,isPanelCollapsed:U,isPanelExpanded:W,reevaluatePanelConstraints:G,registerPanel:I,registerResizeHandle:F,resizePanel:L,startDragging:Z,stopDragging:J,unregisterPanel:D,panelGroupElement:x.current}),[j,w,l,H,R,B,y,U,W,G,I,F,L,Z,J,D]),P={display:"flex",flexDirection:l==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return $.createElement(yc.Provider,{value:V},$.createElement(m,{...p,children:n,className:r,id:u,ref:x,style:{...P,...h},[yt.group]:"",[yt.groupDirection]:l,[yt.groupId]:y}))}const Dp=$.forwardRef((e,n)=>$.createElement(_w,{...e,forwardedRef:n}));_w.displayName="PanelGroup";Dp.displayName="forwardRef(PanelGroup)";function Yl(e,n){return e.findIndex(r=>r===n||r.id===n.id)}function Hi(e,n,r){const l=Yl(e,n),u=l===e.length-1?[l-1,l]:[l,l+1],s=r[l];return{...n.constraints,panelSize:s,pivotIndices:u}}function ZN({disabled:e,handleId:n,resizeHandler:r,panelGroupElement:l}){$.useEffect(()=>{if(e||r==null||l==null)return;const a=bc(n,l);if(a==null)return;const u=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),r(s);break}case"F6":{s.preventDefault();const f=a.getAttribute(yt.groupId);Re(f,`No group element found for id "${f}"`);const d=jo(f,l),h=gw(f,n,l);Re(h!==null,`No resize element found for id "${n}"`);const m=s.shiftKey?h>0?h-1:d.length-1:h+1{a.removeEventListener("keydown",u)}},[l,e,n,r])}function Rp({children:e=null,className:n="",disabled:r=!1,hitAreaMargins:l,id:a,onBlur:u,onClick:s,onDragging:f,onFocus:d,onPointerDown:h,onPointerUp:m,style:p={},tabIndex:y=0,tagName:x="div",...w}){var E,_;const S=$.useRef(null),T=$.useRef({onClick:s,onDragging:f,onPointerDown:h,onPointerUp:m});$.useEffect(()=>{T.current.onClick=s,T.current.onDragging=f,T.current.onPointerDown=h,T.current.onPointerUp=m});const k=$.useContext(yc);if(k===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:z,groupId:M,registerResizeHandle:A,startDragging:q,stopDragging:j,panelGroupElement:H}=k,R=sm(a),[B,U]=$.useState("inactive"),[W,I]=$.useState(!1),[F,L]=$.useState(null),G=$.useRef({state:B});$i(()=>{G.current.state=B}),$.useEffect(()=>{if(r)L(null);else{const V=A(R);L(()=>V)}},[r,R,A]);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;$.useEffect(()=>{if(r||F==null)return;const V=S.current;Re(V,"Element ref not attached");let P=!1;return ON(R,V,z,{coarse:Z,fine:J},(Y,X,K)=>{if(!X){U("inactive");return}switch(Y){case"down":{U("drag"),P=!1,Re(K,'Expected event to be defined for "down" action'),q(R,K);const{onDragging:ne,onPointerDown:re}=T.current;ne==null||ne(!0),re==null||re();break}case"move":{const{state:ne}=G.current;P=!0,ne!=="drag"&&U("hover"),Re(K,'Expected event to be defined for "move" action'),F(K);break}case"up":{U("hover"),j();const{onClick:ne,onDragging:re,onPointerUp:se}=T.current;re==null||re(!1),se==null||se(),P||ne==null||ne();break}}})},[Z,z,r,J,A,R,F,q,j]),ZN({disabled:r,handleId:R,resizeHandler:F,panelGroupElement:H});const D={touchAction:"none",userSelect:"none"};return $.createElement(x,{...w,children:e,className:n,id:a,onBlur:()=>{I(!1),u==null||u()},onFocus:()=>{I(!0),d==null||d()},ref:S,role:"separator",style:{...D,...p},tabIndex:y,[yt.groupDirection]:z,[yt.groupId]:M,[yt.resizeHandle]:"",[yt.resizeHandleActive]:B==="drag"?"pointer":W?"keyboard":void 0,[yt.resizeHandleEnabled]:!r,[yt.resizeHandleId]:R,[yt.resizeHandleState]:B})}Rp.displayName="PanelResizeHandle";function At(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let r=0,l;r{}};function wc(){for(var e=0,n=arguments.length,r={},l;e=0&&(l=r.slice(a+1),r=r.slice(0,a)),r&&!n.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:l}})}Gu.prototype=wc.prototype={constructor:Gu,on:function(e,n){var r=this._,l=JN(e+"",r),a,u=-1,s=l.length;if(arguments.length<2){for(;++u0)for(var r=new Array(a),l=0,a,u;l=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),nv.hasOwnProperty(n)?{space:nv[n],local:e}:e}function eC(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===Op&&n.documentElement.namespaceURI===Op?n.createElement(e):n.createElementNS(r,e)}}function tC(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ew(e){var n=Sc(e);return(n.local?tC:eC)(n)}function nC(){}function fm(e){return e==null?nC:function(){return this.querySelector(e)}}function rC(e){typeof e!="function"&&(e=fm(e));for(var n=this._groups,r=n.length,l=new Array(r),a=0;a=k&&(k=T+1);!(M=_[k])&&++k=0;)(s=l[a])&&(u&&s.compareDocumentPosition(u)^4&&u.parentNode.insertBefore(s,u),u=s);return this}function TC(e){e||(e=AC);function n(p,y){return p&&y?e(p.__data__,y.__data__):!p-!y}for(var r=this._groups,l=r.length,a=new Array(l),u=0;un?1:e>=n?0:NaN}function zC(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function MC(){return Array.from(this)}function jC(){for(var e=this._groups,n=0,r=e.length;n1?this.each((n==null?$C:typeof n=="function"?FC:YC)(e,n,r??"")):ra(this.node(),e)}function ra(e,n){return e.style.getPropertyValue(n)||Aw(e).getComputedStyle(e,null).getPropertyValue(n)}function PC(e){return function(){delete this[e]}}function XC(e,n){return function(){this[e]=n}}function QC(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function ZC(e,n){return arguments.length>1?this.each((n==null?PC:typeof n=="function"?QC:XC)(e,n)):this.node()[e]}function zw(e){return e.trim().split(/^|\s+/)}function dm(e){return e.classList||new Mw(e)}function Mw(e){this._node=e,this._names=zw(e.getAttribute("class")||"")}Mw.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 jw(e,n){for(var r=dm(e),l=-1,a=n.length;++l=0&&(r=n.slice(l+1),n=n.slice(0,l)),{type:n,name:r}})}function ET(e){return function(){var n=this.__on;if(n){for(var r=0,l=-1,a=n.length,u;r()=>e;function Lp(e,{sourceEvent:n,subject:r,target:l,identifier:a,active:u,x:s,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:r,enumerable:!0,configurable:!0},target:{value:l,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:u,enumerable:!0,configurable:!0},x:{value:s,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}})}Lp.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function RT(e){return!e.ctrlKey&&!e.button}function OT(){return this.parentNode}function LT(e,n){return n??{x:e.x,y:e.y}}function HT(){return navigator.maxTouchPoints||"ontouchstart"in this}function Bw(){var e=RT,n=OT,r=LT,l=HT,a={},u=wc("start","drag","end"),s=0,f,d,h,m,p=0;function y(z){z.on("mousedown.drag",x).filter(l).on("touchstart.drag",_).on("touchmove.drag",S,DT).on("touchend.drag touchcancel.drag",T).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(z,M){if(!(m||!e.call(this,z,M))){var A=k(this,n.call(this,z,M),z,M,"mouse");A&&(bn(z.view).on("mousemove.drag",w,Do).on("mouseup.drag",E,Do),Lw(z.view),oh(z),h=!1,f=z.clientX,d=z.clientY,A("start",z))}}function w(z){if(Jl(z),!h){var M=z.clientX-f,A=z.clientY-d;h=M*M+A*A>p}a.mouse("drag",z)}function E(z){bn(z.view).on("mousemove.drag mouseup.drag",null),Hw(z.view,h),Jl(z),a.mouse("end",z)}function _(z,M){if(e.call(this,z,M)){var A=z.changedTouches,q=n.call(this,z,M),j=A.length,H,R;for(H=0;H>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):r===8?ju(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):r===4?ju(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=IT.exec(e))?new an(n[1],n[2],n[3],1):(n=qT.exec(e))?new an(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=UT.exec(e))?ju(n[1],n[2],n[3],n[4]):(n=VT.exec(e))?ju(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=$T.exec(e))?uv(n[1],n[2]/100,n[3]/100,1):(n=YT.exec(e))?uv(n[1],n[2]/100,n[3]/100,n[4]):rv.hasOwnProperty(e)?av(rv[e]):e==="transparent"?new an(NaN,NaN,NaN,0):null}function av(e){return new an(e>>16&255,e>>8&255,e&255,1)}function ju(e,n,r,l){return l<=0&&(e=n=r=NaN),new an(e,n,r,l)}function PT(e){return e instanceof Po||(e=Pi(e)),e?(e=e.rgb(),new an(e.r,e.g,e.b,e.opacity)):new an}function Hp(e,n,r,l){return arguments.length===1?PT(e):new an(e,n,r,l??1)}function an(e,n,r,l){this.r=+e,this.g=+n,this.b=+r,this.opacity=+l}hm(an,Hp,Iw(Po,{brighter(e){return e=e==null?nc:Math.pow(nc,e),new an(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ro:Math.pow(Ro,e),new an(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new an(Yi(this.r),Yi(this.g),Yi(this.b),rc(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:ov,formatHex:ov,formatHex8:XT,formatRgb:sv,toString:sv}));function ov(){return`#${Ui(this.r)}${Ui(this.g)}${Ui(this.b)}`}function XT(){return`#${Ui(this.r)}${Ui(this.g)}${Ui(this.b)}${Ui((isNaN(this.opacity)?1:this.opacity)*255)}`}function sv(){const e=rc(this.opacity);return`${e===1?"rgb(":"rgba("}${Yi(this.r)}, ${Yi(this.g)}, ${Yi(this.b)}${e===1?")":`, ${e})`}`}function rc(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Yi(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ui(e){return e=Yi(e),(e<16?"0":"")+e.toString(16)}function uv(e,n,r,l){return l<=0?e=n=r=NaN:r<=0||r>=1?e=n=NaN:n<=0&&(e=NaN),new qn(e,n,r,l)}function qw(e){if(e instanceof qn)return new qn(e.h,e.s,e.l,e.opacity);if(e instanceof Po||(e=Pi(e)),!e)return new qn;if(e instanceof qn)return e;e=e.rgb();var n=e.r/255,r=e.g/255,l=e.b/255,a=Math.min(n,r,l),u=Math.max(n,r,l),s=NaN,f=u-a,d=(u+a)/2;return f?(n===u?s=(r-l)/f+(r0&&d<1?0:s,new qn(s,f,d,e.opacity)}function QT(e,n,r,l){return arguments.length===1?qw(e):new qn(e,n,r,l??1)}function qn(e,n,r,l){this.h=+e,this.s=+n,this.l=+r,this.opacity=+l}hm(qn,QT,Iw(Po,{brighter(e){return e=e==null?nc:Math.pow(nc,e),new qn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ro:Math.pow(Ro,e),new qn(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,r=this.l,l=r+(r<.5?r:1-r)*n,a=2*r-l;return new an(sh(e>=240?e-240:e+120,a,l),sh(e,a,l),sh(e<120?e+240:e-120,a,l),this.opacity)},clamp(){return new qn(cv(this.h),Du(this.s),Du(this.l),rc(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=rc(this.opacity);return`${e===1?"hsl(":"hsla("}${cv(this.h)}, ${Du(this.s)*100}%, ${Du(this.l)*100}%${e===1?")":`, ${e})`}`}}));function cv(e){return e=(e||0)%360,e<0?e+360:e}function Du(e){return Math.max(0,Math.min(1,e||0))}function sh(e,n,r){return(e<60?n+(r-n)*e/60:e<180?r:e<240?n+(r-n)*(240-e)/60:n)*255}const pm=e=>()=>e;function ZT(e,n){return function(r){return e+r*n}}function KT(e,n,r){return e=Math.pow(e,r),n=Math.pow(n,r)-e,r=1/r,function(l){return Math.pow(e+l*n,r)}}function JT(e){return(e=+e)==1?Uw:function(n,r){return r-n?KT(n,r,e):pm(isNaN(n)?r:n)}}function Uw(e,n){var r=n-e;return r?ZT(e,r):pm(isNaN(e)?n:e)}const ic=(function e(n){var r=JT(n);function l(a,u){var s=r((a=Hp(a)).r,(u=Hp(u)).r),f=r(a.g,u.g),d=r(a.b,u.b),h=Uw(a.opacity,u.opacity);return function(m){return a.r=s(m),a.g=f(m),a.b=d(m),a.opacity=h(m),a+""}}return l.gamma=e,l})(1);function WT(e,n){n||(n=[]);var r=e?Math.min(n.length,e.length):0,l=n.slice(),a;return function(u){for(a=0;ar&&(u=n.slice(r,u),f[s]?f[s]+=u:f[++s]=u),(l=l[0])===(a=a[0])?f[s]?f[s]+=a:f[++s]=a:(f[++s]=null,d.push({i:s,x:er(l,a)})),r=uh.lastIndex;return r180?m+=360:m-h>180&&(h+=360),y.push({i:p.push(a(p)+"rotate(",null,l)-2,x:er(h,m)})):m&&p.push(a(p)+"rotate("+m+l)}function f(h,m,p,y){h!==m?y.push({i:p.push(a(p)+"skewX(",null,l)-2,x:er(h,m)}):m&&p.push(a(p)+"skewX("+m+l)}function d(h,m,p,y,x,w){if(h!==p||m!==y){var E=x.push(a(x)+"scale(",null,",",null,")");w.push({i:E-4,x:er(h,p)},{i:E-2,x:er(m,y)})}else(p!==1||y!==1)&&x.push(a(x)+"scale("+p+","+y+")")}return function(h,m){var p=[],y=[];return h=e(h),m=e(m),u(h.translateX,h.translateY,m.translateX,m.translateY,p,y),s(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(x){for(var w=-1,E=y.length,_;++w=0&&e._call.call(void 0,n),e=e._next;--ia}function hv(){Xi=(ac=Lo.now())+_c,ia=_o=0;try{p3()}finally{ia=0,g3(),Xi=0}}function m3(){var e=Lo.now(),n=e-ac;n>Fw&&(_c-=n,ac=e)}function g3(){for(var e,n=lc,r,l=1/0;n;)n._call?(l>n._time&&(l=n._time),e=n,n=n._next):(r=n._next,n._next=null,n=e?e._next=r:lc=r);Eo=e,qp(l)}function qp(e){if(!ia){_o&&(_o=clearTimeout(_o));var n=e-Xi;n>24?(e<1/0&&(_o=setTimeout(hv,e-Lo.now()-_c)),po&&(po=clearInterval(po))):(po||(ac=Lo.now(),po=setInterval(m3,Fw)),ia=1,Gw(hv))}}function pv(e,n,r){var l=new oc;return n=n==null?0:+n,l.restart(a=>{l.stop(),e(a+n)},n,r),l}var y3=wc("start","end","cancel","interrupt"),x3=[],Xw=0,mv=1,Up=2,Xu=3,gv=4,Vp=5,Qu=6;function Ec(e,n,r,l,a,u){var s=e.__transition;if(!s)e.__transition={};else if(r in s)return;v3(e,r,{name:n,index:l,group:a,on:y3,tween:x3,time:u.time,delay:u.delay,duration:u.duration,ease:u.ease,timer:null,state:Xw})}function gm(e,n){var r=Gn(e,n);if(r.state>Xw)throw new Error("too late; already scheduled");return r}function ir(e,n){var r=Gn(e,n);if(r.state>Xu)throw new Error("too late; already running");return r}function Gn(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function v3(e,n,r){var l=e.__transition,a;l[n]=r,r.timer=Pw(u,0,r.time);function u(h){r.state=mv,r.timer.restart(s,r.delay,r.time),r.delay<=h&&s(h-r.delay)}function s(h){var m,p,y,x;if(r.state!==mv)return d();for(m in l)if(x=l[m],x.name===r.name){if(x.state===Xu)return pv(s);x.state===gv?(x.state=Qu,x.timer.stop(),x.on.call("interrupt",e,e.__data__,x.index,x.group),delete l[m]):+mUp&&l.state=0&&(n=n.slice(0,r)),!n||n==="start"})}function Q3(e,n,r){var l,a,u=X3(n)?gm:ir;return function(){var s=u(this,e),f=s.on;f!==l&&(a=(l=f).copy()).on(n,r),s.on=a}}function Z3(e,n){var r=this._id;return arguments.length<2?Gn(this.node(),r).on.on(e):this.each(Q3(r,e,n))}function K3(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function J3(){return this.on("end.remove",K3(this._id))}function W3(e){var n=this._name,r=this._id;typeof e!="function"&&(e=fm(e));for(var l=this._groups,a=l.length,u=new Array(a),s=0;s()=>e;function EA(e,{sourceEvent:n,target:r,transform:l,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:l,enumerable:!0,configurable:!0},_:{value:a}})}function Ar(e,n,r){this.k=e,this.x=n,this.y=r}Ar.prototype={constructor:Ar,scale:function(e){return e===1?this:new Ar(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Ar(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 kc=new Ar(1,0,0);Jw.prototype=Ar.prototype;function Jw(e){for(;!e.__zoom;)if(!(e=e.parentNode))return kc;return e.__zoom}function ch(e){e.stopImmediatePropagation()}function mo(e){e.preventDefault(),e.stopImmediatePropagation()}function kA(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function NA(){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 yv(){return this.__zoom||kc}function CA(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function TA(){return navigator.maxTouchPoints||"ontouchstart"in this}function AA(e,n,r){var l=e.invertX(n[0][0])-r[0][0],a=e.invertX(n[1][0])-r[1][0],u=e.invertY(n[0][1])-r[0][1],s=e.invertY(n[1][1])-r[1][1];return e.translate(a>l?(l+a)/2:Math.min(0,l)||Math.max(0,a),s>u?(u+s)/2:Math.min(0,u)||Math.max(0,s))}function Ww(){var e=kA,n=NA,r=AA,l=CA,a=TA,u=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],f=250,d=Pu,h=wc("start","zoom","end"),m,p,y,x=500,w=150,E=0,_=10;function S(I){I.property("__zoom",yv).on("wheel.zoom",j,{passive:!1}).on("mousedown.zoom",H).on("dblclick.zoom",R).filter(a).on("touchstart.zoom",B).on("touchmove.zoom",U).on("touchend.zoom touchcancel.zoom",W).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(I,F,L,G){var Z=I.selection?I.selection():I;Z.property("__zoom",yv),I!==Z?M(I,F,L,G):Z.interrupt().each(function(){A(this,arguments).event(G).start().zoom(null,typeof F=="function"?F.apply(this,arguments):F).end()})},S.scaleBy=function(I,F,L,G){S.scaleTo(I,function(){var Z=this.__zoom.k,J=typeof F=="function"?F.apply(this,arguments):F;return Z*J},L,G)},S.scaleTo=function(I,F,L,G){S.transform(I,function(){var Z=n.apply(this,arguments),J=this.__zoom,D=L==null?z(Z):typeof L=="function"?L.apply(this,arguments):L,V=J.invert(D),P=typeof F=="function"?F.apply(this,arguments):F;return r(k(T(J,P),D,V),Z,s)},L,G)},S.translateBy=function(I,F,L,G){S.transform(I,function(){return r(this.__zoom.translate(typeof F=="function"?F.apply(this,arguments):F,typeof L=="function"?L.apply(this,arguments):L),n.apply(this,arguments),s)},null,G)},S.translateTo=function(I,F,L,G,Z){S.transform(I,function(){var J=n.apply(this,arguments),D=this.__zoom,V=G==null?z(J):typeof G=="function"?G.apply(this,arguments):G;return r(kc.translate(V[0],V[1]).scale(D.k).translate(typeof F=="function"?-F.apply(this,arguments):-F,typeof L=="function"?-L.apply(this,arguments):-L),J,s)},G,Z)};function T(I,F){return F=Math.max(u[0],Math.min(u[1],F)),F===I.k?I:new Ar(F,I.x,I.y)}function k(I,F,L){var G=F[0]-L[0]*I.k,Z=F[1]-L[1]*I.k;return G===I.x&&Z===I.y?I:new Ar(I.k,G,Z)}function z(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function M(I,F,L,G){I.on("start.zoom",function(){A(this,arguments).event(G).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(G).end()}).tween("zoom",function(){var Z=this,J=arguments,D=A(Z,J).event(G),V=n.apply(Z,J),P=L==null?z(V):typeof L=="function"?L.apply(Z,J):L,N=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),Y=Z.__zoom,X=typeof F=="function"?F.apply(Z,J):F,K=d(Y.invert(P).concat(N/Y.k),X.invert(P).concat(N/X.k));return function(ne){if(ne===1)ne=X;else{var re=K(ne),se=N/re[2];ne=new Ar(se,P[0]-re[0]*se,P[1]-re[1]*se)}D.zoom(null,ne)}})}function A(I,F,L){return!L&&I.__zooming||new q(I,F)}function q(I,F){this.that=I,this.args=F,this.active=0,this.sourceEvent=null,this.extent=n.apply(I,F),this.taps=0}q.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,F){return this.mouse&&I!=="mouse"&&(this.mouse[1]=F.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=F.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=F.invert(this.touch1[0])),this.that.__zoom=F,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var F=bn(this.that).datum();h.call(I,this.that,new EA(I,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:h}),F)}};function j(I,...F){if(!e.apply(this,arguments))return;var L=A(this,F).event(I),G=this.__zoom,Z=Math.max(u[0],Math.min(u[1],G.k*Math.pow(2,l.apply(this,arguments)))),J=In(I);if(L.wheel)(L.mouse[0][0]!==J[0]||L.mouse[0][1]!==J[1])&&(L.mouse[1]=G.invert(L.mouse[0]=J)),clearTimeout(L.wheel);else{if(G.k===Z)return;L.mouse=[J,G.invert(J)],Zu(this),L.start()}mo(I),L.wheel=setTimeout(D,w),L.zoom("mouse",r(k(T(G,Z),L.mouse[0],L.mouse[1]),L.extent,s));function D(){L.wheel=null,L.end()}}function H(I,...F){if(y||!e.apply(this,arguments))return;var L=I.currentTarget,G=A(this,F,!0).event(I),Z=bn(I.view).on("mousemove.zoom",P,!0).on("mouseup.zoom",N,!0),J=In(I,L),D=I.clientX,V=I.clientY;Lw(I.view),ch(I),G.mouse=[J,this.__zoom.invert(J)],Zu(this),G.start();function P(Y){if(mo(Y),!G.moved){var X=Y.clientX-D,K=Y.clientY-V;G.moved=X*X+K*K>E}G.event(Y).zoom("mouse",r(k(G.that.__zoom,G.mouse[0]=In(Y,L),G.mouse[1]),G.extent,s))}function N(Y){Z.on("mousemove.zoom mouseup.zoom",null),Hw(Y.view,G.moved),mo(Y),G.event(Y).end()}}function R(I,...F){if(e.apply(this,arguments)){var L=this.__zoom,G=In(I.changedTouches?I.changedTouches[0]:I,this),Z=L.invert(G),J=L.k*(I.shiftKey?.5:2),D=r(k(T(L,J),G,Z),n.apply(this,F),s);mo(I),f>0?bn(this).transition().duration(f).call(M,D,G,I):bn(this).call(S.transform,D,G,I)}}function B(I,...F){if(e.apply(this,arguments)){var L=I.touches,G=L.length,Z=A(this,F,I.changedTouches.length===G).event(I),J,D,V,P;for(ch(I),D=0;D"[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:r,targetHandle:l})=>`Couldn't create edge for ${e} handle id: "${e==="source"?r: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."},Ho=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],eS=["Enter"," ","Escape"],tS={"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:r})=>`Moved selected node ${e}. New position, x: ${n}, y: ${r}`,"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 la;(function(e){e.Strict="strict",e.Loose="loose"})(la||(la={}));var Fi;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Fi||(Fi={}));var Bo;(function(e){e.Partial="partial",e.Full="full"})(Bo||(Bo={}));const nS={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var pi;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(pi||(pi={}));var sc;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(sc||(sc={}));var we;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(we||(we={}));const xv={[we.Left]:we.Right,[we.Right]:we.Left,[we.Top]:we.Bottom,[we.Bottom]:we.Top};function rS(e){return e===null?null:e?"valid":"invalid"}const iS=e=>"id"in e&&"source"in e&&"target"in e,zA=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),xm=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Xo=(e,n=[0,0])=>{const{width:r,height:l}=jr(e),a=e.origin??n,u=r*a[0],s=l*a[1];return{x:e.position.x-u,y:e.position.y-s}},MA=(e,n={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((l,a)=>{const u=typeof a=="string";let s=!n.nodeLookup&&!u?a:void 0;n.nodeLookup&&(s=u?n.nodeLookup.get(a):xm(a)?a:n.nodeLookup.get(a.id));const f=s?uc(s,n.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Nc(l,f)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Cc(r)},Qo=(e,n={})=>{let r={x:1/0,y:1/0,x2:-1/0,y2:-1/0},l=!1;return e.forEach(a=>{(n.filter===void 0||n.filter(a))&&(r=Nc(r,uc(a)),l=!0)}),l?Cc(r):{x:0,y:0,width:0,height:0}},vm=(e,n,[r,l,a]=[0,0,1],u=!1,s=!1)=>{const f={...Ko(n,[r,l,a]),width:n.width/a,height:n.height/a},d=[];for(const h of e.values()){const{measured:m,selectable:p=!0,hidden:y=!1}=h;if(s&&!p||y)continue;const x=m.width??h.width??h.initialWidth??null,w=m.height??h.height??h.initialHeight??null,E=Io(f,oa(h)),_=(x??0)*(w??0),S=u&&E>0;(!h.internals.handleBounds||S||E>=_||h.dragging)&&d.push(h)}return d},jA=(e,n)=>{const r=new Set;return e.forEach(l=>{r.add(l.id)}),n.filter(l=>r.has(l.source)||r.has(l.target))};function DA(e,n){const r=new Map,l=n!=null&&n.nodes?new Set(n.nodes.map(a=>a.id)):null;return e.forEach(a=>{a.measured.width&&a.measured.height&&((n==null?void 0:n.includeHiddenNodes)||!a.hidden)&&(!l||l.has(a.id))&&r.set(a.id,a)}),r}async function RA({nodes:e,width:n,height:r,panZoom:l,minZoom:a,maxZoom:u},s){if(e.size===0)return Promise.resolve(!0);const f=DA(e,s),d=Qo(f),h=bm(d,n,r,(s==null?void 0:s.minZoom)??a,(s==null?void 0:s.maxZoom)??u,(s==null?void 0:s.padding)??.1);return await l.setViewport(h,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),Promise.resolve(!0)}function lS({nodeId:e,nextPosition:n,nodeLookup:r,nodeOrigin:l=[0,0],nodeExtent:a,onError:u}){const s=r.get(e),f=s.parentId?r.get(s.parentId):void 0,{x:d,y:h}=f?f.internals.positionAbsolute:{x:0,y:0},m=s.origin??l;let p=s.extent||a;if(s.extent==="parent"&&!s.expandParent)if(!f)u==null||u("005",rr.error005());else{const x=f.measured.width,w=f.measured.height;x&&w&&(p=[[d,h],[d+x,h+w]])}else f&&sa(s.extent)&&(p=[[s.extent[0][0]+d,s.extent[0][1]+h],[s.extent[1][0]+d,s.extent[1][1]+h]]);const y=sa(p)?Qi(n,p,s.measured):n;return(s.measured.width===void 0||s.measured.height===void 0)&&(u==null||u("015",rr.error015())),{position:{x:y.x-d+(s.measured.width??0)*m[0],y:y.y-h+(s.measured.height??0)*m[1]},positionAbsolute:y}}async function OA({nodesToRemove:e=[],edgesToRemove:n=[],nodes:r,edges:l,onBeforeDelete:a}){const u=new Set(e.map(y=>y.id)),s=[];for(const y of r){if(y.deletable===!1)continue;const x=u.has(y.id),w=!x&&y.parentId&&s.find(E=>E.id===y.parentId);(x||w)&&s.push(y)}const f=new Set(n.map(y=>y.id)),d=l.filter(y=>y.deletable!==!1),m=jA(s,d);for(const y of d)f.has(y.id)&&!m.find(w=>w.id===y.id)&&m.push(y);if(!a)return{edges:m,nodes:s};const p=await a({nodes:s,edges:m});return typeof p=="boolean"?p?{edges:m,nodes:s}:{edges:[],nodes:[]}:p}const aa=(e,n=0,r=1)=>Math.min(Math.max(e,n),r),Qi=(e={x:0,y:0},n,r)=>({x:aa(e.x,n[0][0],n[1][0]-((r==null?void 0:r.width)??0)),y:aa(e.y,n[0][1],n[1][1]-((r==null?void 0:r.height)??0))});function aS(e,n,r){const{width:l,height:a}=jr(r),{x:u,y:s}=r.internals.positionAbsolute;return Qi(e,[[u,s],[u+l,s+a]],n)}const vv=(e,n,r)=>er?-aa(Math.abs(e-r),1,n)/n:0,oS=(e,n,r=15,l=40)=>{const a=vv(e.x,l,n.width-l)*r,u=vv(e.y,l,n.height-l)*r;return[a,u]},Nc=(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)}),$p=({x:e,y:n,width:r,height:l})=>({x:e,y:n,x2:e+r,y2:n+l}),Cc=({x:e,y:n,x2:r,y2:l})=>({x:e,y:n,width:r-e,height:l-n}),oa=(e,n=[0,0])=>{var a,u;const{x:r,y:l}=xm(e)?e.internals.positionAbsolute:Xo(e,n);return{x:r,y:l,width:((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0,height:((u=e.measured)==null?void 0:u.height)??e.height??e.initialHeight??0}},uc=(e,n=[0,0])=>{var a,u;const{x:r,y:l}=xm(e)?e.internals.positionAbsolute:Xo(e,n);return{x:r,y:l,x2:r+(((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0),y2:l+(((u=e.measured)==null?void 0:u.height)??e.height??e.initialHeight??0)}},sS=(e,n)=>Cc(Nc($p(e),$p(n))),Io=(e,n)=>{const r=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(r*l)},bv=e=>Un(e.width)&&Un(e.height)&&Un(e.x)&&Un(e.y),Un=e=>!isNaN(e)&&isFinite(e),LA=(e,n)=>{},Zo=(e,n=[1,1])=>({x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}),Ko=({x:e,y:n},[r,l,a],u=!1,s=[1,1])=>{const f={x:(e-r)/a,y:(n-l)/a};return u?Zo(f,s):f},cc=({x:e,y:n},[r,l,a])=>({x:e*a+r,y:n*a+l});function Ul(e,n){if(typeof e=="number")return Math.floor((n-n/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(r)}if(typeof e=="string"&&e.endsWith("%")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(n*r*.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 HA(e,n,r){if(typeof e=="string"||typeof e=="number"){const l=Ul(e,r),a=Ul(e,n);return{top:l,right:a,bottom:l,left:a,x:a*2,y:l*2}}if(typeof e=="object"){const l=Ul(e.top??e.y??0,r),a=Ul(e.bottom??e.y??0,r),u=Ul(e.left??e.x??0,n),s=Ul(e.right??e.x??0,n);return{top:l,right:s,bottom:a,left:u,x:u+s,y:l+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function BA(e,n,r,l,a,u){const{x:s,y:f}=cc(e,[n,r,l]),{x:d,y:h}=cc({x:e.x+e.width,y:e.y+e.height},[n,r,l]),m=a-d,p=u-h;return{left:Math.floor(s),top:Math.floor(f),right:Math.floor(m),bottom:Math.floor(p)}}const bm=(e,n,r,l,a,u)=>{const s=HA(u,n,r),f=(n-s.x)/e.width,d=(r-s.y)/e.height,h=Math.min(f,d),m=aa(h,l,a),p=e.x+e.width/2,y=e.y+e.height/2,x=n/2-p*m,w=r/2-y*m,E=BA(e,x,w,m,n,r),_={left:Math.min(E.left-s.left,0),top:Math.min(E.top-s.top,0),right:Math.min(E.right-s.right,0),bottom:Math.min(E.bottom-s.bottom,0)};return{x:x-_.left+_.right,y:w-_.top+_.bottom,zoom:m}},qo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function sa(e){return e!=null&&e!=="parent"}function jr(e){var n,r;return{width:((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth??0,height:((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0}}function uS(e){var n,r;return(((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth)!==void 0&&(((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight)!==void 0}function cS(e,n={width:0,height:0},r,l,a){const u={...e},s=l.get(r);if(s){const f=s.origin||a;u.x+=s.internals.positionAbsolute.x-(n.width??0)*f[0],u.y+=s.internals.positionAbsolute.y-(n.height??0)*f[1]}return u}function wv(e,n){if(e.size!==n.size)return!1;for(const r of e)if(!n.has(r))return!1;return!0}function IA(){let e,n;return{promise:new Promise((l,a)=>{e=l,n=a}),resolve:e,reject:n}}function qA(e){return{...tS,...e||{}}}function Co(e,{snapGrid:n=[0,0],snapToGrid:r=!1,transform:l,containerBounds:a}){const{x:u,y:s}=Vn(e),f=Ko({x:u-((a==null?void 0:a.left)??0),y:s-((a==null?void 0:a.top)??0)},l),{x:d,y:h}=r?Zo(f,n):f;return{xSnapped:d,ySnapped:h,...f}}const wm=e=>({width:e.offsetWidth,height:e.offsetHeight}),fS=e=>{var n;return((n=e==null?void 0:e.getRootNode)==null?void 0:n.call(e))||(window==null?void 0:window.document)},UA=["INPUT","SELECT","TEXTAREA"];function dS(e){var l,a;const n=((a=(l=e.composedPath)==null?void 0:l.call(e))==null?void 0:a[0])||e.target;return(n==null?void 0:n.nodeType)!==1?!1:UA.includes(n.nodeName)||n.hasAttribute("contenteditable")||!!n.closest(".nokey")}const hS=e=>"clientX"in e,Vn=(e,n)=>{var u,s;const r=hS(e),l=r?e.clientX:(u=e.touches)==null?void 0:u[0].clientX,a=r?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:l-((n==null?void 0:n.left)??0),y:a-((n==null?void 0:n.top)??0)}},Sv=(e,n,r,l,a)=>{const u=n.querySelectorAll(`.${e}`);return!u||!u.length?null:Array.from(u).map(s=>{const f=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:a,position:s.getAttribute("data-handlepos"),x:(f.left-r.left)/l,y:(f.top-r.top)/l,...wm(s)}})};function pS({sourceX:e,sourceY:n,targetX:r,targetY:l,sourceControlX:a,sourceControlY:u,targetControlX:s,targetControlY:f}){const d=e*.125+a*.375+s*.375+r*.125,h=n*.125+u*.375+f*.375+l*.125,m=Math.abs(d-e),p=Math.abs(h-n);return[d,h,m,p]}function Lu(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function _v({pos:e,x1:n,y1:r,x2:l,y2:a,c:u}){switch(e){case we.Left:return[n-Lu(n-l,u),r];case we.Right:return[n+Lu(l-n,u),r];case we.Top:return[n,r-Lu(r-a,u)];case we.Bottom:return[n,r+Lu(a-r,u)]}}function Sm({sourceX:e,sourceY:n,sourcePosition:r=we.Bottom,targetX:l,targetY:a,targetPosition:u=we.Top,curvature:s=.25}){const[f,d]=_v({pos:r,x1:e,y1:n,x2:l,y2:a,c:s}),[h,m]=_v({pos:u,x1:l,y1:a,x2:e,y2:n,c:s}),[p,y,x,w]=pS({sourceX:e,sourceY:n,targetX:l,targetY:a,sourceControlX:f,sourceControlY:d,targetControlX:h,targetControlY:m});return[`M${e},${n} C${f},${d} ${h},${m} ${l},${a}`,p,y,x,w]}function mS({sourceX:e,sourceY:n,targetX:r,targetY:l}){const a=Math.abs(r-e)/2,u=r0}const YA=({source:e,sourceHandle:n,target:r,targetHandle:l})=>`xy-edge__${e}${n||""}-${r}${l||""}`,FA=(e,n)=>n.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),GA=(e,n,r={})=>{if(!e.source||!e.target)return n;const l=r.getEdgeId||YA;let a;return iS(e)?a={...e}:a={...e,id:l(e)},FA(a,n)?n:(a.sourceHandle===null&&delete a.sourceHandle,a.targetHandle===null&&delete a.targetHandle,n.concat(a))};function gS({sourceX:e,sourceY:n,targetX:r,targetY:l}){const[a,u,s,f]=mS({sourceX:e,sourceY:n,targetX:r,targetY:l});return[`M ${e},${n}L ${r},${l}`,a,u,s,f]}const Ev={[we.Left]:{x:-1,y:0},[we.Right]:{x:1,y:0},[we.Top]:{x:0,y:-1},[we.Bottom]:{x:0,y:1}},PA=({source:e,sourcePosition:n=we.Bottom,target:r})=>n===we.Left||n===we.Right?e.xMath.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function XA({source:e,sourcePosition:n=we.Bottom,target:r,targetPosition:l=we.Top,center:a,offset:u,stepPosition:s}){const f=Ev[n],d=Ev[l],h={x:e.x+f.x*u,y:e.y+f.y*u},m={x:r.x+d.x*u,y:r.y+d.y*u},p=PA({source:h,sourcePosition:n,target:m}),y=p.x!==0?"x":"y",x=p[y];let w=[],E,_;const S={x:0,y:0},T={x:0,y:0},[,,k,z]=mS({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(f[y]*d[y]===-1){y==="x"?(E=a.x??h.x+(m.x-h.x)*s,_=a.y??(h.y+m.y)/2):(E=a.x??(h.x+m.x)/2,_=a.y??h.y+(m.y-h.y)*s);const A=[{x:E,y:h.y},{x:E,y:m.y}],q=[{x:h.x,y:_},{x:m.x,y:_}];f[y]===x?w=y==="x"?A:q:w=y==="x"?q:A}else{const A=[{x:h.x,y:m.y}],q=[{x:m.x,y:h.y}];if(y==="x"?w=f.x===x?q:A:w=f.y===x?A:q,n===l){const U=Math.abs(e[y]-r[y]);if(U<=u){const W=Math.min(u-1,u-U);f[y]===x?S[y]=(h[y]>e[y]?-1:1)*W:T[y]=(m[y]>r[y]?-1:1)*W}}if(n!==l){const U=y==="x"?"y":"x",W=f[y]===d[U],I=h[U]>m[U],F=h[U]=B?(E=(j.x+H.x)/2,_=w[0].y):(E=w[0].x,_=(j.y+H.y)/2)}return[[e,{x:h.x+S.x,y:h.y+S.y},...w,{x:m.x+T.x,y:m.y+T.y},r],E,_,k,z]}function QA(e,n,r,l){const a=Math.min(kv(e,n)/2,kv(n,r)/2,l),{x:u,y:s}=n;if(e.x===u&&u===r.x||e.y===s&&s===r.y)return`L${u} ${s}`;if(e.y===s){const h=e.x{let z="";return k>0&&kr.id===n):e[0])||null}function Fp(e,n){return e?typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(l=>`${l}=${e[l]}`).join("&")}`:""}function KA(e,{id:n,defaultColor:r,defaultMarkerStart:l,defaultMarkerEnd:a}){const u=new Set;return e.reduce((s,f)=>([f.markerStart||l,f.markerEnd||a].forEach(d=>{if(d&&typeof d=="object"){const h=Fp(d,n);u.has(h)||(s.push({id:h,color:d.color||r,...d}),u.add(h))}}),s),[]).sort((s,f)=>s.id.localeCompare(f.id))}const yS=1e3,JA=10,_m={nodeOrigin:[0,0],nodeExtent:Ho,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},WA={..._m,checkEquality:!0};function Em(e,n){const r={...e};for(const l in n)n[l]!==void 0&&(r[l]=n[l]);return r}function ez(e,n,r){const l=Em(_m,r);for(const a of e.values())if(a.parentId)Nm(a,e,n,l);else{const u=Xo(a,l.nodeOrigin),s=sa(a.extent)?a.extent:l.nodeExtent,f=Qi(u,s,jr(a));a.internals.positionAbsolute=f}}function tz(e,n){if(!e.handles)return e.measured?n==null?void 0:n.internals.handleBounds:void 0;const r=[],l=[];for(const a of e.handles){const u={id:a.id,width:a.width??1,height:a.height??1,nodeId:e.id,x:a.x,y:a.y,position:a.position,type:a.type};a.type==="source"?r.push(u):a.type==="target"&&l.push(u)}return{source:r,target:l}}function km(e){return e==="manual"}function Gp(e,n,r,l={}){var h,m;const a=Em(WA,l),u={i:0},s=new Map(n),f=a!=null&&a.elevateNodesOnSelect&&!km(a.zIndexMode)?yS:0;let d=e.length>0;n.clear(),r.clear();for(const p of e){let y=s.get(p.id);if(a.checkEquality&&p===(y==null?void 0:y.internals.userNode))n.set(p.id,y);else{const x=Xo(p,a.nodeOrigin),w=sa(p.extent)?p.extent:a.nodeExtent,E=Qi(x,w,jr(p));y={...a.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:tz(p,y),z:xS(p,f,a.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&&Nm(y,n,r,l,u)}return d}function nz(e,n){if(!e.parentId)return;const r=n.get(e.parentId);r?r.set(e.id,e):n.set(e.parentId,new Map([[e.id,e]]))}function Nm(e,n,r,l,a){const{elevateNodesOnSelect:u,nodeOrigin:s,nodeExtent:f,zIndexMode:d}=Em(_m,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}nz(e,r),a&&!m.parentId&&m.internals.rootParentIndex===void 0&&d==="auto"&&(m.internals.rootParentIndex=++a.i,m.internals.z=m.internals.z+a.i*JA),a&&m.internals.rootParentIndex!==void 0&&(a.i=m.internals.rootParentIndex);const p=u&&!km(d)?yS:0,{x:y,y:x,z:w}=rz(e,m,s,f,p,d),{positionAbsolute:E}=e.internals,_=y!==E.x||x!==E.y;(_||w!==e.internals.z)&&n.set(e.id,{...e,internals:{...e.internals,positionAbsolute:_?{x:y,y:x}:E,z:w}})}function xS(e,n,r){const l=Un(e.zIndex)?e.zIndex:0;return km(r)?l:l+(e.selected?n:0)}function rz(e,n,r,l,a,u){const{x:s,y:f}=n.internals.positionAbsolute,d=jr(e),h=Xo(e,r),m=sa(e.extent)?Qi(h,e.extent,d):h;let p=Qi({x:s+m.x,y:f+m.y},l,d);e.extent==="parent"&&(p=aS(p,d,n));const y=xS(e,a,u),x=n.internals.z??0;return{x:p.x,y:p.y,z:x>=y?x+1:y}}function Cm(e,n,r,l=[0,0]){var s;const a=[],u=new Map;for(const f of e){const d=n.get(f.parentId);if(!d)continue;const h=((s=u.get(f.parentId))==null?void 0:s.expandedRect)??oa(d),m=sS(h,f.rect);u.set(f.parentId,{expandedRect:m,parent:d})}return u.size>0&&u.forEach(({expandedRect:f,parent:d},h)=>{var k;const m=d.internals.positionAbsolute,p=jr(d),y=d.origin??l,x=f.x0||w>0||S||T)&&(a.push({id:h,type:"position",position:{x:d.position.x-x+S,y:d.position.y-w+T}}),(k=r.get(h))==null||k.forEach(z=>{e.some(M=>M.id===z.id)||a.push({id:z.id,type:"position",position:{x:z.position.x+x,y:z.position.y+w}})})),(p.width0){const x=Cm(y,n,r,a);h.push(...x)}return{changes:h,updatedInternals:d}}async function lz({delta:e,panZoom:n,transform:r,translateExtent:l,width:a,height:u}){if(!n||!e.x&&!e.y)return Promise.resolve(!1);const s=await n.setViewportConstrained({x:r[0]+e.x,y:r[1]+e.y,zoom:r[2]},[[0,0],[a,u]],l),f=!!s&&(s.x!==r[0]||s.y!==r[1]||s.k!==r[2]);return Promise.resolve(f)}function Av(e,n,r,l,a,u){let s=a;const f=l.get(s)||new Map;l.set(s,f.set(r,n)),s=`${a}-${e}`;const d=l.get(s)||new Map;if(l.set(s,d.set(r,n)),u){s=`${a}-${e}-${u}`;const h=l.get(s)||new Map;l.set(s,h.set(r,n))}}function vS(e,n,r){e.clear(),n.clear();for(const l of r){const{source:a,target:u,sourceHandle:s=null,targetHandle:f=null}=l,d={edgeId:l.id,source:a,target:u,sourceHandle:s,targetHandle:f},h=`${a}-${s}--${u}-${f}`,m=`${u}-${f}--${a}-${s}`;Av("source",d,m,e,a,s),Av("target",d,h,e,u,f),n.set(l.id,l)}}function bS(e,n){if(!e.parentId)return!1;const r=n.get(e.parentId);return r?r.selected?!0:bS(r,n):!1}function zv(e,n,r){var a;let l=e;do{if((a=l==null?void 0:l.matches)!=null&&a.call(l,n))return!0;if(l===r)return!1;l=l==null?void 0:l.parentElement}while(l);return!1}function az(e,n,r,l){const a=new Map;for(const[u,s]of e)if((s.selected||s.id===l)&&(!s.parentId||!bS(s,e))&&(s.draggable||n&&typeof s.draggable>"u")){const f=e.get(u);f&&a.set(u,{id:u,position:f.position||{x:0,y:0},distance:{x:r.x-f.internals.positionAbsolute.x,y:r.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 a}function fh({nodeId:e,dragItems:n,nodeLookup:r,dragging:l=!0}){var s,f,d;const a=[];for(const[h,m]of n){const p=(s=r.get(h))==null?void 0:s.internals.userNode;p&&a.push({...p,position:m.position,dragging:l})}if(!e)return[a[0],a];const u=(f=r.get(e))==null?void 0:f.internals.userNode;return[u?{...u,position:((d=n.get(e))==null?void 0:d.position)||u.position,dragging:l}:a[0],a]}function oz({dragItems:e,snapGrid:n,x:r,y:l}){const a=e.values().next().value;if(!a)return null;const u={x:r-a.distance.x,y:l-a.distance.y},s=Zo(u,n);return{x:s.x-u.x,y:s.y-u.y}}function sz({onNodeMouseDown:e,getStoreItems:n,onDragStart:r,onDrag:l,onDragStop:a}){let u={x:null,y:null},s=0,f=new Map,d=!1,h={x:0,y:0},m=null,p=!1,y=null,x=!1,w=!1,E=null;function _({noDragClassName:T,handleSelector:k,domNode:z,isSelectable:M,nodeId:A,nodeClickDistance:q=0}){y=bn(z);function j({x:U,y:W}){const{nodeLookup:I,nodeExtent:F,snapGrid:L,snapToGrid:G,nodeOrigin:Z,onNodeDrag:J,onSelectionDrag:D,onError:V,updateNodePositions:P}=n();u={x:U,y:W};let N=!1;const Y=f.size>1,X=Y&&F?$p(Qo(f)):null,K=Y&&G?oz({dragItems:f,snapGrid:L,x:U,y:W}):null;for(const[ne,re]of f){if(!I.has(ne))continue;let se={x:U-re.distance.x,y:W-re.distance.y};G&&(se=K?{x:Math.round(se.x+K.x),y:Math.round(se.y+K.y)}:Zo(se,L));let ye=null;if(Y&&F&&!re.extent&&X){const{positionAbsolute:pe}=re.internals,_e=pe.x-X.x+F[0][0],Me=pe.x+re.measured.width-X.x2+F[1][0],Te=pe.y-X.y+F[0][1],ut=pe.y+re.measured.height-X.y2+F[1][1];ye=[[_e,Te],[Me,ut]]}const{position:ve,positionAbsolute:xe}=lS({nodeId:ne,nextPosition:se,nodeLookup:I,nodeExtent:ye||F,nodeOrigin:Z,onError:V});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),E&&(l||J||!A&&D))){const[ne,re]=fh({nodeId:A,dragItems:f,nodeLookup:I});l==null||l(E,f,ne,re),J==null||J(E,ne,re),A||D==null||D(E,re)}}async function H(){if(!m)return;const{transform:U,panBy:W,autoPanSpeed:I,autoPanOnNodeDrag:F}=n();if(!F){d=!1,cancelAnimationFrame(s);return}const[L,G]=oS(h,m,I);(L!==0||G!==0)&&(u.x=(u.x??0)-L/U[2],u.y=(u.y??0)-G/U[2],await W({x:L,y:G})&&j(u)),s=requestAnimationFrame(H)}function R(U){var Y;const{nodeLookup:W,multiSelectionActive:I,nodesDraggable:F,transform:L,snapGrid:G,snapToGrid:Z,selectNodesOnDrag:J,onNodeDragStart:D,onSelectionDragStart:V,unselectNodesAndEdges:P}=n();p=!0,(!J||!M)&&!I&&A&&((Y=W.get(A))!=null&&Y.selected||P()),M&&J&&A&&(e==null||e(A));const N=Co(U.sourceEvent,{transform:L,snapGrid:G,snapToGrid:Z,containerBounds:m});if(u=N,f=az(W,F,N,A),f.size>0&&(r||D||!A&&V)){const[X,K]=fh({nodeId:A,dragItems:f,nodeLookup:W});r==null||r(U.sourceEvent,f,X,K),D==null||D(U.sourceEvent,X,K),A||V==null||V(U.sourceEvent,K)}}const B=Bw().clickDistance(q).on("start",U=>{const{domNode:W,nodeDragThreshold:I,transform:F,snapGrid:L,snapToGrid:G}=n();m=(W==null?void 0:W.getBoundingClientRect())||null,x=!1,w=!1,E=U.sourceEvent,I===0&&R(U),u=Co(U.sourceEvent,{transform:F,snapGrid:L,snapToGrid:G,containerBounds:m}),h=Vn(U.sourceEvent,m)}).on("drag",U=>{const{autoPanOnNodeDrag:W,transform:I,snapGrid:F,snapToGrid:L,nodeDragThreshold:G,nodeLookup:Z}=n(),J=Co(U.sourceEvent,{transform:I,snapGrid:F,snapToGrid:L,containerBounds:m});if(E=U.sourceEvent,(U.sourceEvent.type==="touchmove"&&U.sourceEvent.touches.length>1||A&&!Z.has(A))&&(x=!0),!x){if(!d&&W&&p&&(d=!0,H()),!p){const D=Vn(U.sourceEvent,m),V=D.x-h.x,P=D.y-h.y;Math.sqrt(V*V+P*P)>G&&R(U)}(u.x!==J.xSnapped||u.y!==J.ySnapped)&&f&&p&&(h=Vn(U.sourceEvent,m),j(J))}}).on("end",U=>{if(!(!p||x)&&(d=!1,p=!1,cancelAnimationFrame(s),f.size>0)){const{nodeLookup:W,updateNodePositions:I,onNodeDragStop:F,onSelectionDragStop:L}=n();if(w&&(I(f,!1),w=!1),a||F||!A&&L){const[G,Z]=fh({nodeId:A,dragItems:f,nodeLookup:W,dragging:!1});a==null||a(U.sourceEvent,f,G,Z),F==null||F(U.sourceEvent,G,Z),A||L==null||L(U.sourceEvent,Z)}}}).filter(U=>{const W=U.target;return!U.button&&(!T||!zv(W,`.${T}`,z))&&(!k||zv(W,k,z))});y.call(B)}function S(){y==null||y.on(".drag",null)}return{update:_,destroy:S}}function uz(e,n,r){const l=[],a={x:e.x-r,y:e.y-r,width:r*2,height:r*2};for(const u of n.values())Io(a,oa(u))>0&&l.push(u);return l}const cz=250;function fz(e,n,r,l){var f,d;let a=[],u=1/0;const s=uz(e,r,n+cz);for(const h of s){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:x}=Zi(h,p,p.position,!0),w=Math.sqrt(Math.pow(y-e.x,2)+Math.pow(x-e.y,2));w>n||(w1){const h=l.type==="source"?"target":"source";return a.find(m=>m.type===h)??a[0]}return a[0]}function wS(e,n,r,l,a,u=!1){var h,m,p;const s=l.get(e);if(!s)return null;const f=a==="strict"?(h=s.internals.handleBounds)==null?void 0:h[n]:[...((m=s.internals.handleBounds)==null?void 0:m.source)??[],...((p=s.internals.handleBounds)==null?void 0:p.target)??[]],d=(r?f==null?void 0:f.find(y=>y.id===r):f==null?void 0:f[0])??null;return d&&u?{...d,...Zi(s,d,d.position,!0)}:d}function SS(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function dz(e,n){let r=null;return n?r=!0:e&&!n&&(r=!1),r}const _S=()=>!0;function hz(e,{connectionMode:n,connectionRadius:r,handleId:l,nodeId:a,edgeUpdaterType:u,isTarget:s,domNode:f,nodeLookup:d,lib:h,autoPanOnConnect:m,flowId:p,panBy:y,cancelConnection:x,onConnectStart:w,onConnect:E,onConnectEnd:_,isValidConnection:S=_S,onReconnectEnd:T,updateConnection:k,getTransform:z,getFromHandle:M,autoPanSpeed:A,dragThreshold:q=1,handleDomNode:j}){const H=fS(e.target);let R=0,B;const{x:U,y:W}=Vn(e),I=SS(u,j),F=f==null?void 0:f.getBoundingClientRect();let L=!1;if(!F||!I)return;const G=wS(a,I,l,d,n);if(!G)return;let Z=Vn(e,F),J=!1,D=null,V=!1,P=null;function N(){if(!m||!F)return;const[ve,xe]=oS(Z,F,A);y({x:ve,y:xe}),R=requestAnimationFrame(N)}const Y={...G,nodeId:a,type:I,position:G.position},X=d.get(a);let ne={inProgress:!0,isValid:null,from:Zi(X,Y,we.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:X,to:Z,toHandle:null,toPosition:xv[Y.position],toNode:null,pointer:Z};function re(){L=!0,k(ne),w==null||w(e,{nodeId:a,handleId:l,handleType:I})}q===0&&re();function se(ve){if(!L){const{x:ut,y:et}=Vn(ve),zt=ut-U,Ut=et-W;if(!(zt*zt+Ut*Ut>q*q))return;re()}if(!M()||!Y){ye(ve);return}const xe=z();Z=Vn(ve,F),B=fz(Ko(Z,xe,!1,[1,1]),r,d,Y),J||(N(),J=!0);const pe=ES(ve,{handle:B,connectionMode:n,fromNodeId:a,fromHandleId:l,fromType:s?"target":"source",isValidConnection:S,doc:H,lib:h,flowId:p,nodeLookup:d});P=pe.handleDomNode,D=pe.connection,V=dz(!!B,pe.isValid);const _e=d.get(a),Me=_e?Zi(_e,Y,we.Left,!0):ne.from,Te={...ne,from:Me,isValid:V,to:pe.toHandle&&V?cc({x:pe.toHandle.x,y:pe.toHandle.y},xe):Z,toHandle:pe.toHandle,toPosition:V&&pe.toHandle?pe.toHandle.position:xv[Y.position],toNode:pe.toHandle?d.get(pe.toHandle.nodeId):null,pointer:Z};k(Te),ne=Te}function ye(ve){if(!("touches"in ve&&ve.touches.length>0)){if(L){(B||P)&&D&&V&&(E==null||E(D));const{inProgress:xe,...pe}=ne,_e={...pe,toPosition:ne.toHandle?ne.toPosition:null};_==null||_(ve,_e),u&&(T==null||T(ve,_e))}x(),cancelAnimationFrame(R),J=!1,V=!1,D=null,P=null,H.removeEventListener("mousemove",se),H.removeEventListener("mouseup",ye),H.removeEventListener("touchmove",se),H.removeEventListener("touchend",ye)}}H.addEventListener("mousemove",se),H.addEventListener("mouseup",ye),H.addEventListener("touchmove",se),H.addEventListener("touchend",ye)}function ES(e,{handle:n,connectionMode:r,fromNodeId:l,fromHandleId:a,fromType:u,doc:s,lib:f,flowId:d,isValidConnection:h=_S,nodeLookup:m}){const p=u==="target",y=n?s.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,y:w}=Vn(e),E=s.elementFromPoint(x,w),_=E!=null&&E.classList.contains(`${f}-flow__handle`)?E:y,S={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const T=SS(void 0,_),k=_.getAttribute("data-nodeid"),z=_.getAttribute("data-handleid"),M=_.classList.contains("connectable"),A=_.classList.contains("connectableend");if(!k||!T)return S;const q={source:p?k:l,sourceHandle:p?z:a,target:p?l:k,targetHandle:p?a:z};S.connection=q;const H=M&&A&&(r===la.Strict?p&&T==="source"||!p&&T==="target":k!==l||z!==a);S.isValid=H&&h(q),S.toHandle=wS(k,T,z,m,r,!0)}return S}const Pp={onPointerDown:hz,isValid:ES};function pz({domNode:e,panZoom:n,getTransform:r,getViewScale:l}){const a=bn(e);function u({translateExtent:f,width:d,height:h,zoomStep:m=1,pannable:p=!0,zoomable:y=!0,inversePan:x=!1}){const w=k=>{if(k.sourceEvent.type!=="wheel"||!n)return;const z=r(),M=k.sourceEvent.ctrlKey&&qo()?10:1,A=-k.sourceEvent.deltaY*(k.sourceEvent.deltaMode===1?.05:k.sourceEvent.deltaMode?1:.002)*m,q=z[2]*Math.pow(2,A*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 z=r();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],A=[M[0]-E[0],M[1]-E[1]];E=M;const q=l()*Math.max(z[2],Math.log(z[2]))*(x?-1:1),j={x:z[0]-A[0]*q,y:z[1]-A[1]*q},H=[[0,0],[d,h]];n.setViewportConstrained({x:j.x,y:j.y,zoom:z[2]},H,f)},T=Ww().on("start",_).on("zoom",p?S:null).on("zoom.wheel",y?w:null);a.call(T,{})}function s(){a.on("zoom",null)}return{update:u,destroy:s,pointer:In}}const Tc=e=>({x:e.x,y:e.y,zoom:e.k}),dh=({x:e,y:n,zoom:r})=>kc.translate(e,n).scale(r),Xl=(e,n)=>e.target.closest(`.${n}`),kS=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),mz=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,hh=(e,n=0,r=mz,l=()=>{})=>{const a=typeof n=="number"&&n>0;return a||l(),a?e.transition().duration(n).ease(r).on("end",l):e},NS=e=>{const n=e.ctrlKey&&qo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n};function gz({zoomPanValues:e,noWheelClassName:n,d3Selection:r,d3Zoom:l,panOnScrollMode:a,panOnScrollSpeed:u,zoomOnPinch:s,onPanZoomStart:f,onPanZoom:d,onPanZoomEnd:h}){return m=>{if(Xl(m,n))return m.ctrlKey&&m.preventDefault(),!1;m.preventDefault(),m.stopImmediatePropagation();const p=r.property("__zoom").k||1;if(m.ctrlKey&&s){const _=In(m),S=NS(m),T=p*Math.pow(2,S);l.scaleTo(r,T,_,m);return}const y=m.deltaMode===1?20:1;let x=a===Fi.Vertical?0:m.deltaX*y,w=a===Fi.Horizontal?0:m.deltaY*y;!qo()&&m.shiftKey&&a!==Fi.Vertical&&(x=m.deltaY*y,w=0),l.translateBy(r,-(x/p)*u,-(w/p)*u,{internal:!0});const E=Tc(r.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 yz({noWheelClassName:e,preventScrolling:n,d3ZoomHandler:r}){return function(l,a){const u=l.type==="wheel",s=!n&&u&&!l.ctrlKey,f=Xl(l,e);if(l.ctrlKey&&u&&f&&l.preventDefault(),s||f)return null;l.preventDefault(),r.call(this,l,a)}}function xz({zoomPanValues:e,onDraggingChange:n,onPanZoomStart:r}){return l=>{var u,s,f;if((u=l.sourceEvent)!=null&&u.internal)return;const a=Tc(l.transform);e.mouseButton=((s=l.sourceEvent)==null?void 0:s.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=a,((f=l.sourceEvent)==null?void 0:f.type)==="mousedown"&&n(!0),r&&(r==null||r(l.sourceEvent,a))}}function vz({zoomPanValues:e,panOnDrag:n,onPaneContextMenu:r,onTransformChange:l,onPanZoom:a}){return u=>{var s,f;e.usedRightMouseButton=!!(r&&kS(n,e.mouseButton??0)),(s=u.sourceEvent)!=null&&s.sync||l([u.transform.x,u.transform.y,u.transform.k]),a&&!((f=u.sourceEvent)!=null&&f.internal)&&(a==null||a(u.sourceEvent,Tc(u.transform)))}}function bz({zoomPanValues:e,panOnDrag:n,panOnScroll:r,onDraggingChange:l,onPanZoomEnd:a,onPaneContextMenu:u}){return s=>{var f;if(!((f=s.sourceEvent)!=null&&f.internal)&&(e.isZoomingOrPanning=!1,u&&kS(n,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&u(s.sourceEvent),e.usedRightMouseButton=!1,l(!1),a)){const d=Tc(s.transform);e.prevViewport=d,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{a==null||a(s.sourceEvent,d)},r?150:0)}}}function wz({zoomActivationKeyPressed:e,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:l,panOnScroll:a,zoomOnDoubleClick:u,userSelectionActive:s,noWheelClassName:f,noPanClassName:d,lib:h,connectionInProgress:m}){return p=>{var _;const y=e||n,x=r&&p.ctrlKey,w=p.type==="wheel";if(p.button===1&&p.type==="mousedown"&&(Xl(p,`${h}-flow__node`)||Xl(p,`${h}-flow__edge`)))return!0;if(!l&&!y&&!a&&!u&&!r||s||m&&!w||Xl(p,f)&&w||Xl(p,d)&&(!w||a&&w&&!e)||!r&&p.ctrlKey&&w)return!1;if(!r&&p.type==="touchstart"&&((_=p.touches)==null?void 0:_.length)>1)return p.preventDefault(),!1;if(!y&&!a&&!x&&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 Sz({domNode:e,minZoom:n,maxZoom:r,translateExtent:l,viewport:a,onPanZoom:u,onPanZoomStart:s,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=Ww().scaleExtent([n,r]).translateExtent(l),y=bn(e).call(p);T({x:a.x,y:a.y,zoom:aa(a.zoom,n,r)},[[0,0],[m.width,m.height]],l);const x=y.on("wheel.zoom"),w=y.on("dblclick.zoom");p.wheelDelta(NS);function E(B,U){return y?new Promise(W=>{p==null||p.interpolate((U==null?void 0:U.interpolate)==="linear"?No:Pu).transform(hh(y,U==null?void 0:U.duration,U==null?void 0:U.ease,()=>W(!0)),B)}):Promise.resolve(!1)}function _({noWheelClassName:B,noPanClassName:U,onPaneContextMenu:W,userSelectionActive:I,panOnScroll:F,panOnDrag:L,panOnScrollMode:G,panOnScrollSpeed:Z,preventScrolling:J,zoomOnPinch:D,zoomOnScroll:V,zoomOnDoubleClick:P,zoomActivationKeyPressed:N,lib:Y,onTransformChange:X,connectionInProgress:K,paneClickDistance:ne,selectionOnDrag:re}){I&&!h.isZoomingOrPanning&&S();const se=F&&!N&&!I;p.clickDistance(re?1/0:!Un(ne)||ne<0?0:ne);const ye=se?gz({zoomPanValues:h,noWheelClassName:B,d3Selection:y,d3Zoom:p,panOnScrollMode:G,panOnScrollSpeed:Z,zoomOnPinch:D,onPanZoomStart:s,onPanZoom:u,onPanZoomEnd:f}):yz({noWheelClassName:B,preventScrolling:J,d3ZoomHandler:x});if(y.on("wheel.zoom",ye,{passive:!1}),!I){const xe=xz({zoomPanValues:h,onDraggingChange:d,onPanZoomStart:s});p.on("start",xe);const pe=vz({zoomPanValues:h,panOnDrag:L,onPaneContextMenu:!!W,onPanZoom:u,onTransformChange:X});p.on("zoom",pe);const _e=bz({zoomPanValues:h,panOnDrag:L,panOnScroll:F,onPaneContextMenu:W,onPanZoomEnd:f,onDraggingChange:d});p.on("end",_e)}const ve=wz({zoomActivationKeyPressed:N,panOnDrag:L,zoomOnScroll:V,panOnScroll:F,zoomOnDoubleClick:P,zoomOnPinch:D,userSelectionActive:I,noPanClassName:U,noWheelClassName:B,lib:Y,connectionInProgress:K});p.filter(ve),P?y.on("dblclick.zoom",w):y.on("dblclick.zoom",null)}function S(){p.on("zoom",null)}async function T(B,U,W){const I=dh(B),F=p==null?void 0:p.constrain()(I,U,W);return F&&await E(F),new Promise(L=>L(F))}async function k(B,U){const W=dh(B);return await E(W,U),new Promise(I=>I(W))}function z(B){if(y){const U=dh(B),W=y.property("__zoom");(W.k!==B.zoom||W.x!==B.x||W.y!==B.y)&&(p==null||p.transform(y,U,null,{sync:!0}))}}function M(){const B=y?Jw(y.node()):{x:0,y:0,k:1};return{x:B.x,y:B.y,zoom:B.k}}function A(B,U){return y?new Promise(W=>{p==null||p.interpolate((U==null?void 0:U.interpolate)==="linear"?No:Pu).scaleTo(hh(y,U==null?void 0:U.duration,U==null?void 0:U.ease,()=>W(!0)),B)}):Promise.resolve(!1)}function q(B,U){return y?new Promise(W=>{p==null||p.interpolate((U==null?void 0:U.interpolate)==="linear"?No:Pu).scaleBy(hh(y,U==null?void 0:U.duration,U==null?void 0:U.ease,()=>W(!0)),B)}):Promise.resolve(!1)}function j(B){p==null||p.scaleExtent(B)}function H(B){p==null||p.translateExtent(B)}function R(B){const U=!Un(B)||B<0?0:B;p==null||p.clickDistance(U)}return{update:_,destroy:S,setViewport:k,setViewportConstrained:T,getViewport:M,scaleTo:A,scaleBy:q,setScaleExtent:j,setTranslateExtent:H,syncViewport:z,setClickDistance:R}}var ua;(function(e){e.Line="line",e.Handle="handle"})(ua||(ua={}));function _z({width:e,prevWidth:n,height:r,prevHeight:l,affectsX:a,affectsY:u}){const s=e-n,f=r-l,d=[s>0?1:s<0?-1:0,f>0?1:f<0?-1:0];return s&&a&&(d[0]=d[0]*-1),f&&u&&(d[1]=d[1]*-1),d}function Mv(e){const n=e.includes("right")||e.includes("left"),r=e.includes("bottom")||e.includes("top"),l=e.includes("left"),a=e.includes("top");return{isHorizontal:n,isVertical:r,affectsX:l,affectsY:a}}function ci(e,n){return Math.max(0,n-e)}function fi(e,n){return Math.max(0,e-n)}function Hu(e,n,r){return Math.max(0,n-e,e-r)}function jv(e,n){return e?!n:n}function Ez(e,n,r,l,a,u,s,f){let{affectsX:d,affectsY:h}=n;const{isHorizontal:m,isVertical:p}=n,y=m&&p,{xSnapped:x,ySnapped:w}=r,{minWidth:E,maxWidth:_,minHeight:S,maxHeight:T}=l,{x:k,y:z,width:M,height:A,aspectRatio:q}=e;let j=Math.floor(m?x-e.pointerX:0),H=Math.floor(p?w-e.pointerY:0);const R=M+(d?-j:j),B=A+(h?-H:H),U=-u[0]*M,W=-u[1]*A;let I=Hu(R,E,_),F=Hu(B,S,T);if(s){let Z=0,J=0;d&&j<0?Z=ci(k+j+U,s[0][0]):!d&&j>0&&(Z=fi(k+R+U,s[1][0])),h&&H<0?J=ci(z+H+W,s[0][1]):!h&&H>0&&(J=fi(z+B+W,s[1][1])),I=Math.max(I,Z),F=Math.max(F,J)}if(f){let Z=0,J=0;d&&j>0?Z=fi(k+j,f[0][0]):!d&&j<0&&(Z=ci(k+R,f[1][0])),h&&H>0?J=fi(z+H,f[0][1]):!h&&H<0&&(J=ci(z+B,f[1][1])),I=Math.max(I,Z),F=Math.max(F,J)}if(a){if(m){const Z=Hu(R/q,S,T)*q;if(I=Math.max(I,Z),s){let J=0;!d&&!h||d&&!h&&y?J=fi(z+W+R/q,s[1][1])*q:J=ci(z+W+(d?j:-j)/q,s[0][1])*q,I=Math.max(I,J)}if(f){let J=0;!d&&!h||d&&!h&&y?J=ci(z+R/q,f[1][1])*q:J=fi(z+(d?j:-j)/q,f[0][1])*q,I=Math.max(I,J)}}if(p){const Z=Hu(B*q,E,_)/q;if(F=Math.max(F,Z),s){let J=0;!d&&!h||h&&!d&&y?J=fi(k+B*q+U,s[1][0])/q:J=ci(k+(h?H:-H)*q+U,s[0][0])/q,F=Math.max(F,J)}if(f){let J=0;!d&&!h||h&&!d&&y?J=ci(k+B*q,f[1][0])/q:J=fi(k+(h?H:-H)*q,f[0][0])/q,F=Math.max(F,J)}}}H=H+(H<0?F:-F),j=j+(j<0?I:-I),a&&(y?R>B*q?H=(jv(d,h)?-j:j)/q:j=(jv(d,h)?-H:H)*q:m?(H=j/q,h=d):(j=H*q,d=h));const L=d?k+j:k,G=h?z+H:z;return{width:M+(d?-j:j),height:A+(h?-H:H),x:u[0]*j*(d?-1:1)+L,y:u[1]*H*(h?-1:1)+G}}const CS={width:0,height:0,x:0,y:0},kz={...CS,pointerX:0,pointerY:0,aspectRatio:1};function Nz(e){return[[0,0],[e.measured.width,e.measured.height]]}function Cz(e,n,r){const l=n.position.x+e.position.x,a=n.position.y+e.position.y,u=e.measured.width??0,s=e.measured.height??0,f=r[0]*u,d=r[1]*s;return[[l-f,a-d],[l+u-f,a+s-d]]}function Tz({domNode:e,nodeId:n,getStoreItems:r,onChange:l,onEnd:a}){const u=bn(e);let s={controlDirection:Mv("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:x,onResize:w,onResizeEnd:E,shouldResize:_}){let S={...CS},T={...kz};s={boundaries:m,resizeDirection:y,keepAspectRatio:p,controlDirection:Mv(h)};let k,z=null,M=[],A,q,j,H=!1;const R=Bw().on("start",B=>{const{nodeLookup:U,transform:W,snapGrid:I,snapToGrid:F,nodeOrigin:L,paneDomNode:G}=r();if(k=U.get(n),!k)return;z=(G==null?void 0:G.getBoundingClientRect())??null;const{xSnapped:Z,ySnapped:J}=Co(B.sourceEvent,{transform:W,snapGrid:I,snapToGrid:F,containerBounds:z});S={width:k.measured.width??0,height:k.measured.height??0,x:k.position.x??0,y:k.position.y??0},T={...S,pointerX:Z,pointerY:J,aspectRatio:S.width/S.height},A=void 0,k.parentId&&(k.extent==="parent"||k.expandParent)&&(A=U.get(k.parentId),q=A&&k.extent==="parent"?Nz(A):void 0),M=[],j=void 0;for(const[D,V]of U)if(V.parentId===n&&(M.push({id:D,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const P=Cz(V,k,V.origin??L);j?j=[[Math.min(P[0][0],j[0][0]),Math.min(P[0][1],j[0][1])],[Math.max(P[1][0],j[1][0]),Math.max(P[1][1],j[1][1])]]:j=P}x==null||x(B,{...S})}).on("drag",B=>{const{transform:U,snapGrid:W,snapToGrid:I,nodeOrigin:F}=r(),L=Co(B.sourceEvent,{transform:U,snapGrid:W,snapToGrid:I,containerBounds:z}),G=[];if(!k)return;const{x:Z,y:J,width:D,height:V}=S,P={},N=k.origin??F,{width:Y,height:X,x:K,y:ne}=Ez(T,s.controlDirection,L,s.boundaries,s.keepAspectRatio,N,q,j),re=Y!==D,se=X!==V,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:S.x,P.y=ve?ne:S.y,S.x=P.x,S.y=P.y,M.length>0)){const Me=K-Z,Te=ne-J;for(const ut of M)ut.position={x:ut.position.x-Me+N[0]*(Y-D),y:ut.position.y-Te+N[1]*(X-V)},G.push(ut)}if((re||se)&&(P.width=re&&(!s.resizeDirection||s.resizeDirection==="horizontal")?Y:S.width,P.height=se&&(!s.resizeDirection||s.resizeDirection==="vertical")?X:S.height,S.width=P.width,S.height=P.height),A&&k.expandParent){const Me=N[0]*(P.width??0);P.x&&P.x{H&&(E==null||E(B,{...S}),a==null||a({...S}),H=!1)});u.call(R)}function d(){u.on(".drag",null)}return{update:f,destroy:d}}var ph={exports:{}},mh={},gh={exports:{}},yh={};/** + * @license React + * use-sync-external-store-shim.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Dv;function Az(){if(Dv)return yh;Dv=1;var e=Fo();function n(p,y){return p===y&&(p!==0||1/p===1/y)||p!==p&&y!==y}var r=typeof Object.is=="function"?Object.is:n,l=e.useState,a=e.useEffect,u=e.useLayoutEffect,s=e.useDebugValue;function f(p,y){var x=y(),w=l({inst:{value:x,getSnapshot:y}}),E=w[0].inst,_=w[1];return u(function(){E.value=x,E.getSnapshot=y,d(E)&&_({inst:E})},[p,x,y]),a(function(){return d(E)&&_({inst:E}),p(function(){d(E)&&_({inst:E})})},[p]),s(x),x}function d(p){var y=p.getSnapshot;p=p.value;try{var x=y();return!r(p,x)}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 yh.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,yh}var Rv;function zz(){return Rv||(Rv=1,gh.exports=Az()),gh.exports}/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Ov;function Mz(){if(Ov)return mh;Ov=1;var e=Fo(),n=zz();function r(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}var l=typeof Object.is=="function"?Object.is:r,a=n.useSyncExternalStore,u=e.useRef,s=e.useEffect,f=e.useMemo,d=e.useDebugValue;return mh.useSyncExternalStoreWithSelector=function(h,m,p,y,x){var w=u(null);if(w.current===null){var E={hasValue:!1,value:null};w.current=E}else E=w.current;w=f(function(){function S(A){if(!T){if(T=!0,k=A,A=y(A),x!==void 0&&E.hasValue){var q=E.value;if(x(q,A))return z=q}return z=A}if(q=z,l(k,A))return q;var j=y(A);return x!==void 0&&x(q,j)?(k=A,q):(k=A,z=j)}var T=!1,k,z,M=p===void 0?null:p;return[function(){return S(m())},M===null?void 0:function(){return S(M())}]},[m,p,y,x]);var _=a(h,w[0],w[1]);return s(function(){E.hasValue=!0,E.value=_},[_]),d(_),_},mh}var Lv;function jz(){return Lv||(Lv=1,ph.exports=Mz()),ph.exports}var Dz=jz();const Rz=Yo(Dz),Oz={},Hv=e=>{let n;const r=new Set,l=(m,p)=>{const y=typeof m=="function"?m(n):m;if(!Object.is(y,n)){const x=n;n=p??(typeof y!="object"||y===null)?y:Object.assign({},n,y),r.forEach(w=>w(n,x))}},a=()=>n,d={setState:l,getState:a,getInitialState:()=>h,subscribe:m=>(r.add(m),()=>r.delete(m)),destroy:()=>{(Oz?"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."),r.clear()}},h=n=e(l,a,d);return d},Lz=e=>e?Hv(e):Hv,{useDebugValue:Hz}=Gl,{useSyncExternalStoreWithSelector:Bz}=Rz,Iz=e=>e;function TS(e,n=Iz,r){const l=Bz(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,r);return Hz(l),l}const Bv=(e,n)=>{const r=Lz(e),l=(a,u=n)=>TS(r,a,u);return Object.assign(l,r),l},qz=(e,n)=>e?Bv(e,n):Bv;function ht(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,a]of e)if(!Object.is(a,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 r=Object.keys(e);if(r.length!==Object.keys(n).length)return!1;for(const l of r)if(!Object.prototype.hasOwnProperty.call(n,l)||!Object.is(e[l],n[l]))return!1;return!0}var Uz=Kb();const Ac=$.createContext(null),Vz=Ac.Provider,AS=rr.error001();function Ve(e,n){const r=$.useContext(Ac);if(r===null)throw new Error(AS);return TS(r,e,n)}function pt(){const e=$.useContext(Ac);if(e===null)throw new Error(AS);return $.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Iv={display:"none"},$z={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},zS="react-flow__node-desc",MS="react-flow__edge-desc",Yz="react-flow__aria-live",Fz=e=>e.ariaLiveMessage,Gz=e=>e.ariaLabelConfig;function Pz({rfId:e}){const n=Ve(Fz);return b.jsx("div",{id:`${Yz}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:$z,children:n})}function Xz({rfId:e,disableKeyboardA11y:n}){const r=Ve(Gz);return b.jsxs(b.Fragment,{children:[b.jsx("div",{id:`${zS}-${e}`,style:Iv,children:n?r["node.a11yDescription.default"]:r["node.a11yDescription.keyboardDisabled"]}),b.jsx("div",{id:`${MS}-${e}`,style:Iv,children:r["edge.a11yDescription.default"]}),!n&&b.jsx(Pz,{rfId:e})]})}const zc=$.forwardRef(({position:e="top-left",children:n,className:r,style:l,...a},u)=>{const s=`${e}`.split("-");return b.jsx("div",{className:At(["react-flow__panel",r,...s]),style:l,ref:u,...a,children:n})});zc.displayName="Panel";function Qz({proOptions:e,position:n="bottom-right"}){return e!=null&&e.hideAttribution?null:b.jsx(zc,{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 Zz=e=>{const n=[],r=[];for(const[,l]of e.nodeLookup)l.selected&&n.push(l.internals.userNode);for(const[,l]of e.edgeLookup)l.selected&&r.push(l);return{selectedNodes:n,selectedEdges:r}},Bu=e=>e.id;function Kz(e,n){return ht(e.selectedNodes.map(Bu),n.selectedNodes.map(Bu))&&ht(e.selectedEdges.map(Bu),n.selectedEdges.map(Bu))}function Jz({onSelectionChange:e}){const n=pt(),{selectedNodes:r,selectedEdges:l}=Ve(Zz,Kz);return $.useEffect(()=>{const a={nodes:r,edges:l};e==null||e(a),n.getState().onSelectionChangeHandlers.forEach(u=>u(a))},[r,l,e]),null}const Wz=e=>!!e.onSelectionChangeHandlers;function eM({onSelectionChange:e}){const n=Ve(Wz);return e||n?b.jsx(Jz,{onSelectionChange:e}):null}const jS=[0,0],tM={x:0,y:0,zoom:1},nM=["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"],qv=[...nM,"rfId"],rM=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}),Uv={translateExtent:Ho,nodeOrigin:jS,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function iM(e){const{setNodes:n,setEdges:r,setMinZoom:l,setMaxZoom:a,setTranslateExtent:u,setNodeExtent:s,reset:f,setDefaultNodesAndEdges:d}=Ve(rM,ht),h=pt();$.useEffect(()=>(d(e.defaultNodes,e.defaultEdges),()=>{m.current=Uv,f()}),[]);const m=$.useRef(Uv);return $.useEffect(()=>{for(const p of qv){const y=e[p],x=m.current[p];y!==x&&(typeof e[p]>"u"||(p==="nodes"?n(y):p==="edges"?r(y):p==="minZoom"?l(y):p==="maxZoom"?a(y):p==="translateExtent"?u(y):p==="nodeExtent"?s(y):p==="ariaLabelConfig"?h.setState({ariaLabelConfig:qA(y)}):p==="fitView"?h.setState({fitViewQueued:y}):p==="fitViewOptions"?h.setState({fitViewOptions:y}):h.setState({[p]:y})))}m.current=e},qv.map(p=>e[p])),null}function Vv(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function lM(e){var l;const[n,r]=$.useState(e==="system"?null:e);return $.useEffect(()=>{if(e!=="system"){r(e);return}const a=Vv(),u=()=>r(a!=null&&a.matches?"dark":"light");return u(),a==null||a.addEventListener("change",u),()=>{a==null||a.removeEventListener("change",u)}},[e]),n!==null?n:(l=Vv())!=null&&l.matches?"dark":"light"}const $v=typeof document<"u"?document:null;function Uo(e=null,n={target:$v,actInsideInputWithModifier:!0}){const[r,l]=$.useState(!1),a=$.useRef(!1),u=$.useRef(new Set([])),[s,f]=$.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 $.useEffect(()=>{const d=(n==null?void 0:n.target)??$v,h=(n==null?void 0:n.actInsideInputWithModifier)??!0;if(e!==null){const m=x=>{var _,S;if(a.current=x.ctrlKey||x.metaKey||x.shiftKey||x.altKey,(!a.current||a.current&&!h)&&dS(x))return!1;const E=Fv(x.code,f);if(u.current.add(x[E]),Yv(s,u.current,!1)){const T=((S=(_=x.composedPath)==null?void 0:_.call(x))==null?void 0:S[0])||x.target,k=(T==null?void 0:T.nodeName)==="BUTTON"||(T==null?void 0:T.nodeName)==="A";n.preventDefault!==!1&&(a.current||!k)&&x.preventDefault(),l(!0)}},p=x=>{const w=Fv(x.code,f);Yv(s,u.current,!0)?(l(!1),u.current.clear()):u.current.delete(x[w]),x.key==="Meta"&&u.current.clear(),a.current=!1},y=()=>{u.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]),r}function Yv(e,n,r){return e.filter(l=>r||l.length===n.size).some(l=>l.every(a=>n.has(a)))}function Fv(e,n){return n.includes(e)?"code":"key"}const aM=()=>{const e=pt();return $.useMemo(()=>({zoomIn:n=>{const{panZoom:r}=e.getState();return r?r.scaleBy(1.2,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},zoomOut:n=>{const{panZoom:r}=e.getState();return r?r.scaleBy(1/1.2,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},zoomTo:(n,r)=>{const{panZoom:l}=e.getState();return l?l.scaleTo(n,{duration:r==null?void 0:r.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(n,r)=>{const{transform:[l,a,u],panZoom:s}=e.getState();return s?(await s.setViewport({x:n.x??l,y:n.y??a,zoom:n.zoom??u},r),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[n,r,l]=e.getState().transform;return{x:n,y:r,zoom:l}},setCenter:async(n,r,l)=>e.getState().setCenter(n,r,l),fitBounds:async(n,r)=>{const{width:l,height:a,minZoom:u,maxZoom:s,panZoom:f}=e.getState(),d=bm(n,l,a,u,s,(r==null?void 0:r.padding)??.1);return f?(await f.setViewport(d,{duration:r==null?void 0:r.duration,ease:r==null?void 0:r.ease,interpolate:r==null?void 0:r.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(n,r={})=>{const{transform:l,snapGrid:a,snapToGrid:u,domNode:s}=e.getState();if(!s)return n;const{x:f,y:d}=s.getBoundingClientRect(),h={x:n.x-f,y:n.y-d},m=r.snapGrid??a,p=r.snapToGrid??u;return Ko(h,l,p,m)},flowToScreenPosition:n=>{const{transform:r,domNode:l}=e.getState();if(!l)return n;const{x:a,y:u}=l.getBoundingClientRect(),s=cc(n,r);return{x:s.x+a,y:s.y+u}}}),[])};function DS(e,n){const r=[],l=new Map,a=[];for(const u of e)if(u.type==="add"){a.push(u);continue}else if(u.type==="remove"||u.type==="replace")l.set(u.id,[u]);else{const s=l.get(u.id);s?s.push(u):l.set(u.id,[u])}for(const u of n){const s=l.get(u.id);if(!s){r.push(u);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){r.push({...s[0].item});continue}const f={...u};for(const d of s)oM(d,f);r.push(f)}return a.length&&a.forEach(u=>{u.index!==void 0?r.splice(u.index,0,{...u.item}):r.push({...u.item})}),r}function oM(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 RS(e,n){return DS(e,n)}function OS(e,n){return DS(e,n)}function Ii(e,n){return{id:e,type:"select",selected:n}}function Ql(e,n=new Set,r=!1){const l=[];for(const[a,u]of e){const s=n.has(a);!(u.selected===void 0&&!s)&&u.selected!==s&&(r&&(u.selected=s),l.push(Ii(u.id,s)))}return l}function Gv({items:e=[],lookup:n}){var a;const r=[],l=new Map(e.map(u=>[u.id,u]));for(const[u,s]of e.entries()){const f=n.get(s.id),d=((a=f==null?void 0:f.internals)==null?void 0:a.userNode)??f;d!==void 0&&d!==s&&r.push({id:s.id,item:s,type:"replace"}),d===void 0&&r.push({item:s,type:"add",index:u})}for(const[u]of n)l.get(u)===void 0&&r.push({id:u,type:"remove"});return r}function Pv(e){return{id:e.id,type:"remove"}}const Xv=e=>zA(e),sM=e=>iS(e);function LS(e){return $.forwardRef(e)}const uM=typeof window<"u"?$.useLayoutEffect:$.useEffect;function Qv(e){const[n,r]=$.useState(BigInt(0)),[l]=$.useState(()=>cM(()=>r(a=>a+BigInt(1))));return uM(()=>{const a=l.get();a.length&&(e(a),l.reset())},[n]),l}function cM(e){let n=[];return{get:()=>n,reset:()=>{n=[]},push:r=>{n.push(r),e()}}}const HS=$.createContext(null);function fM({children:e}){const n=pt(),r=$.useCallback(f=>{const{nodes:d=[],setNodes:h,hasDefaultNodes:m,onNodesChange:p,nodeLookup:y,fitViewQueued:x,onNodesChangeMiddlewareMap:w}=n.getState();let E=d;for(const S of f)E=typeof S=="function"?S(E):S;let _=Gv({items:E,lookup:y});for(const S of w.values())_=S(_);m&&h(E),_.length>0?p==null||p(_):x&&window.requestAnimationFrame(()=>{const{fitViewQueued:S,nodes:T,setNodes:k}=n.getState();S&&k(T)})},[]),l=Qv(r),a=$.useCallback(f=>{const{edges:d=[],setEdges:h,hasDefaultEdges:m,onEdgesChange:p,edgeLookup:y}=n.getState();let x=d;for(const w of f)x=typeof w=="function"?w(x):w;m?h(x):p&&p(Gv({items:x,lookup:y}))},[]),u=Qv(a),s=$.useMemo(()=>({nodeQueue:l,edgeQueue:u}),[]);return b.jsx(HS.Provider,{value:s,children:e})}function dM(){const e=$.useContext(HS);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const hM=e=>!!e.panZoom;function Jo(){const e=aM(),n=pt(),r=dM(),l=Ve(hM),a=$.useMemo(()=>{const u=p=>n.getState().nodeLookup.get(p),s=p=>{r.nodeQueue.push(p)},f=p=>{r.edgeQueue.push(p)},d=p=>{var S,T;const{nodeLookup:y,nodeOrigin:x}=n.getState(),w=Xv(p)?p:y.get(p.id),E=w.parentId?cS(w.position,w.measured,w.parentId,y,x):w.position,_={...w,position:E,width:((S=w.measured)==null?void 0:S.width)??w.width,height:((T=w.measured)==null?void 0:T.height)??w.height};return oa(_)},h=(p,y,x={replace:!1})=>{s(w=>w.map(E=>{if(E.id===p){const _=typeof y=="function"?y(E):y;return x.replace&&Xv(_)?_:{...E,..._}}return E}))},m=(p,y,x={replace:!1})=>{f(w=>w.map(E=>{if(E.id===p){const _=typeof y=="function"?y(E):y;return x.replace&&sM(_)?_:{...E,..._}}return E}))};return{getNodes:()=>n.getState().nodes.map(p=>({...p})),getNode:p=>{var y;return(y=u(p))==null?void 0:y.internals.userNode},getInternalNode:u,getEdges:()=>{const{edges:p=[]}=n.getState();return p.map(y=>({...y}))},getEdge:p=>n.getState().edgeLookup.get(p),setNodes:s,setEdges:f,addNodes:p=>{const y=Array.isArray(p)?p:[p];r.nodeQueue.push(x=>[...x,...y])},addEdges:p=>{const y=Array.isArray(p)?p:[p];r.edgeQueue.push(x=>[...x,...y])},toObject:()=>{const{nodes:p=[],edges:y=[],transform:x}=n.getState(),[w,E,_]=x;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:x,edges:w,onNodesDelete:E,onEdgesDelete:_,triggerNodeChanges:S,triggerEdgeChanges:T,onDelete:k,onBeforeDelete:z}=n.getState(),{nodes:M,edges:A}=await OA({nodesToRemove:p,edgesToRemove:y,nodes:x,edges:w,onBeforeDelete:z}),q=A.length>0,j=M.length>0;if(q){const H=A.map(Pv);_==null||_(A),T(H)}if(j){const H=M.map(Pv);E==null||E(M),S(H)}return(j||q)&&(k==null||k({nodes:M,edges:A})),{deletedNodes:M,deletedEdges:A}},getIntersectingNodes:(p,y=!0,x)=>{const w=bv(p),E=w?p:d(p),_=x!==void 0;return E?(x||n.getState().nodes).filter(S=>{const T=n.getState().nodeLookup.get(S.id);if(T&&!w&&(S.id===p.id||!T.internals.positionAbsolute))return!1;const k=oa(_?S:T),z=Io(k,E);return y&&z>0||z>=k.width*k.height||z>=E.width*E.height}):[]},isNodeIntersecting:(p,y,x=!0)=>{const E=bv(p)?p:d(p);if(!E)return!1;const _=Io(E,y);return x&&_>0||_>=y.width*y.height||_>=E.width*E.height},updateNode:h,updateNodeData:(p,y,x={replace:!1})=>{h(p,w=>{const E=typeof y=="function"?y(w):y;return x.replace?{...w,data:E}:{...w,data:{...w.data,...E}}},x)},updateEdge:m,updateEdgeData:(p,y,x={replace:!1})=>{m(p,w=>{const E=typeof y=="function"?y(w):y;return x.replace?{...w,data:E}:{...w,data:{...w.data,...E}}},x)},getNodesBounds:p=>{const{nodeLookup:y,nodeOrigin:x}=n.getState();return MA(p,{nodeLookup:y,nodeOrigin:x})},getHandleConnections:({type:p,id:y,nodeId:x})=>{var w;return Array.from(((w=n.getState().connectionLookup.get(`${x}-${p}${y?`-${y}`:""}`))==null?void 0:w.values())??[])},getNodeConnections:({type:p,handleId:y,nodeId:x})=>{var w;return Array.from(((w=n.getState().connectionLookup.get(`${x}${p?y?`-${p}-${y}`:`-${p}`:""}`))==null?void 0:w.values())??[])},fitView:async p=>{const y=n.getState().fitViewResolver??IA();return n.setState({fitViewQueued:!0,fitViewOptions:p,fitViewResolver:y}),r.nodeQueue.push(x=>[...x]),y.promise}}},[]);return $.useMemo(()=>({...a,...e,viewportInitialized:l}),[l])}const Zv=e=>e.selected,pM=typeof window<"u"?window:void 0;function mM({deleteKeyCode:e,multiSelectionKeyCode:n}){const r=pt(),{deleteElements:l}=Jo(),a=Uo(e,{actInsideInputWithModifier:!1}),u=Uo(n,{target:pM});$.useEffect(()=>{if(a){const{edges:s,nodes:f}=r.getState();l({nodes:f.filter(Zv),edges:s.filter(Zv)}),r.setState({nodesSelectionActive:!1})}},[a]),$.useEffect(()=>{r.setState({multiSelectionActive:u})},[u])}function gM(e){const n=pt();$.useEffect(()=>{const r=()=>{var a,u,s,f;if(!e.current||!(((u=(a=e.current).checkVisibility)==null?void 0:u.call(a))??!0))return!1;const l=wm(e.current);(l.height===0||l.width===0)&&((f=(s=n.getState()).onError)==null||f.call(s,"004",rr.error004())),n.setState({width:l.width||500,height:l.height||500})};if(e.current){r(),window.addEventListener("resize",r);const l=new ResizeObserver(()=>r());return l.observe(e.current),()=>{window.removeEventListener("resize",r),l&&e.current&&l.unobserve(e.current)}}},[])}const Mc={position:"absolute",width:"100%",height:"100%",top:0,left:0},yM=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function xM({onPaneContextMenu:e,zoomOnScroll:n=!0,zoomOnPinch:r=!0,panOnScroll:l=!1,panOnScrollSpeed:a=.5,panOnScrollMode:u=Fi.Free,zoomOnDoubleClick:s=!0,panOnDrag:f=!0,defaultViewport:d,translateExtent:h,minZoom:m,maxZoom:p,zoomActivationKeyCode:y,preventScrolling:x=!0,children:w,noWheelClassName:E,noPanClassName:_,onViewportChange:S,isControlledViewport:T,paneClickDistance:k,selectionOnDrag:z}){const M=pt(),A=$.useRef(null),{userSelectionActive:q,lib:j,connectionInProgress:H}=Ve(yM,ht),R=Uo(y),B=$.useRef();gM(A);const U=$.useCallback(W=>{S==null||S({x:W[0],y:W[1],zoom:W[2]}),T||M.setState({transform:W})},[S,T]);return $.useEffect(()=>{if(A.current){B.current=Sz({domNode:A.current,minZoom:m,maxZoom:p,translateExtent:h,viewport:d,onDraggingChange:L=>M.setState(G=>G.paneDragging===L?G:{paneDragging:L}),onPanZoomStart:(L,G)=>{const{onViewportChangeStart:Z,onMoveStart:J}=M.getState();J==null||J(L,G),Z==null||Z(G)},onPanZoom:(L,G)=>{const{onViewportChange:Z,onMove:J}=M.getState();J==null||J(L,G),Z==null||Z(G)},onPanZoomEnd:(L,G)=>{const{onViewportChangeEnd:Z,onMoveEnd:J}=M.getState();J==null||J(L,G),Z==null||Z(G)}});const{x:W,y:I,zoom:F}=B.current.getViewport();return M.setState({panZoom:B.current,transform:[W,I,F],domNode:A.current.closest(".react-flow")}),()=>{var L;(L=B.current)==null||L.destroy()}}},[]),$.useEffect(()=>{var W;(W=B.current)==null||W.update({onPaneContextMenu:e,zoomOnScroll:n,zoomOnPinch:r,panOnScroll:l,panOnScrollSpeed:a,panOnScrollMode:u,zoomOnDoubleClick:s,panOnDrag:f,zoomActivationKeyPressed:R,preventScrolling:x,noPanClassName:_,userSelectionActive:q,noWheelClassName:E,lib:j,onTransformChange:U,connectionInProgress:H,selectionOnDrag:z,paneClickDistance:k})},[e,n,r,l,a,u,s,f,R,x,_,q,E,j,U,H,z,k]),b.jsx("div",{className:"react-flow__renderer",ref:A,style:Mc,children:w})}const vM=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function bM(){const{userSelectionActive:e,userSelectionRect:n}=Ve(vM,ht);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 xh=(e,n)=>r=>{r.target===n.current&&(e==null||e(r))},wM=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function SM({isSelecting:e,selectionKeyPressed:n,selectionMode:r=Bo.Full,panOnDrag:l,paneClickDistance:a,selectionOnDrag:u,onSelectionStart:s,onSelectionEnd:f,onPaneClick:d,onPaneContextMenu:h,onPaneScroll:m,onPaneMouseEnter:p,onPaneMouseMove:y,onPaneMouseLeave:x,children:w}){const E=pt(),{userSelectionActive:_,elementsSelectable:S,dragging:T,connectionInProgress:k}=Ve(wM,ht),z=S&&(e||_),M=$.useRef(null),A=$.useRef(),q=$.useRef(new Set),j=$.useRef(new Set),H=$.useRef(!1),R=Z=>{if(H.current||k){H.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)},U=m?Z=>m(Z):void 0,W=Z=>{H.current&&(Z.stopPropagation(),H.current=!1)},I=Z=>{var X,K;const{domNode:J}=E.getState();if(A.current=J==null?void 0:J.getBoundingClientRect(),!A.current)return;const D=Z.target===M.current;if(!D&&!!Z.target.closest(".nokey")||!e||!(u&&D||n)||Z.button!==0||!Z.isPrimary)return;(K=(X=Z.target)==null?void 0:X.setPointerCapture)==null||K.call(X,Z.pointerId),H.current=!1;const{x:N,y:Y}=Vn(Z.nativeEvent,A.current);E.setState({userSelectionRect:{width:0,height:0,startX:N,startY:Y,x:N,y:Y}}),D||(Z.stopPropagation(),Z.preventDefault())},F=Z=>{const{userSelectionRect:J,transform:D,nodeLookup:V,edgeLookup:P,connectionLookup:N,triggerNodeChanges:Y,triggerEdgeChanges:X,defaultEdgeOptions:K,resetSelectedElements:ne}=E.getState();if(!A.current||!J)return;const{x:re,y:se}=Vn(Z.nativeEvent,A.current),{startX:ye,startY:ve}=J;if(!H.current){const Te=n?0:a;if(Math.hypot(re-ye,se-ve)<=Te)return;ne(),s==null||s(Z)}H.current=!0;const xe={startX:ye,startY:ve,x:reTe.id)),j.current=new Set;const Me=(K==null?void 0:K.selectable)??!0;for(const Te of q.current){const ut=N.get(Te);if(ut)for(const{edgeId:et}of ut.values()){const zt=P.get(et);zt&&(zt.selectable??Me)&&j.current.add(et)}}if(!wv(pe,q.current)){const Te=Ql(V,q.current,!0);Y(Te)}if(!wv(_e,j.current)){const Te=Ql(P,j.current);X(Te)}E.setState({userSelectionRect:xe,userSelectionActive:!0,nodesSelectionActive:!1})},L=Z=>{var J,D;Z.button===0&&((D=(J=Z.target)==null?void 0:J.releasePointerCapture)==null||D.call(J,Z.pointerId),!_&&Z.target===M.current&&E.getState().userSelectionRect&&(R==null||R(Z)),E.setState({userSelectionActive:!1,userSelectionRect:null}),H.current&&(f==null||f(Z),E.setState({nodesSelectionActive:q.current.size>0})))},G=l===!0||Array.isArray(l)&&l.includes(0);return b.jsxs("div",{className:At(["react-flow__pane",{draggable:G,dragging:T,selection:e}]),onClick:z?void 0:xh(R,M),onContextMenu:xh(B,M),onWheel:xh(U,M),onPointerEnter:z?void 0:p,onPointerMove:z?F:y,onPointerUp:z?L:void 0,onPointerDownCapture:z?I:void 0,onClickCapture:z?W:void 0,onPointerLeave:x,ref:M,style:Mc,children:[w,b.jsx(bM,{})]})}function Xp({id:e,store:n,unselect:r=!1,nodeRef:l}){const{addSelectedNodes:a,unselectNodesAndEdges:u,multiSelectionActive:s,nodeLookup:f,onError:d}=n.getState(),h=f.get(e);if(!h){d==null||d("012",rr.error012(e));return}n.setState({nodesSelectionActive:!1}),h.selected?(r||h.selected&&s)&&(u({nodes:[h],edges:[]}),requestAnimationFrame(()=>{var m;return(m=l==null?void 0:l.current)==null?void 0:m.blur()})):a([e])}function BS({nodeRef:e,disabled:n=!1,noDragClassName:r,handleSelector:l,nodeId:a,isSelectable:u,nodeClickDistance:s}){const f=pt(),[d,h]=$.useState(!1),m=$.useRef();return $.useEffect(()=>{m.current=sz({getStoreItems:()=>f.getState(),onNodeMouseDown:p=>{Xp({id:p,store:f,nodeRef:e})},onDragStart:()=>{h(!0)},onDragStop:()=>{h(!1)}})},[]),$.useEffect(()=>{if(!(n||!e.current||!m.current))return m.current.update({noDragClassName:r,handleSelector:l,domNode:e.current,isSelectable:u,nodeId:a,nodeClickDistance:s}),()=>{var p;(p=m.current)==null||p.destroy()}},[r,l,n,u,e,a,s]),d}const _M=e=>n=>n.selected&&(n.draggable||e&&typeof n.draggable>"u");function IS(){const e=pt();return $.useCallback(r=>{const{nodeExtent:l,snapToGrid:a,snapGrid:u,nodesDraggable:s,onError:f,updateNodePositions:d,nodeLookup:h,nodeOrigin:m}=e.getState(),p=new Map,y=_M(s),x=a?u[0]:5,w=a?u[1]:5,E=r.direction.x*x*r.factor,_=r.direction.y*w*r.factor;for(const[,S]of h){if(!y(S))continue;let T={x:S.internals.positionAbsolute.x+E,y:S.internals.positionAbsolute.y+_};a&&(T=Zo(T,u));const{position:k,positionAbsolute:z}=lS({nodeId:S.id,nextPosition:T,nodeLookup:h,nodeExtent:l,nodeOrigin:m,onError:f});S.position=k,S.internals.positionAbsolute=z,p.set(S.id,S)}d(p)},[])}const Tm=$.createContext(null),EM=Tm.Provider;Tm.Consumer;const qS=()=>$.useContext(Tm),kM=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),NM=(e,n,r)=>l=>{const{connectionClickStartHandle:a,connectionMode:u,connection:s}=l,{fromHandle:f,toHandle:d,isValid:h}=s,m=(d==null?void 0:d.nodeId)===e&&(d==null?void 0:d.id)===n&&(d==null?void 0:d.type)===r;return{connectingFrom:(f==null?void 0:f.nodeId)===e&&(f==null?void 0:f.id)===n&&(f==null?void 0:f.type)===r,connectingTo:m,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===n&&(a==null?void 0:a.type)===r,isPossibleEndHandle:u===la.Strict?(f==null?void 0:f.type)!==r:e!==(f==null?void 0:f.nodeId)||n!==(f==null?void 0:f.id),connectionInProcess:!!f,clickConnectionInProcess:!!a,valid:m&&h}};function CM({type:e="source",position:n=we.Top,isValidConnection:r,isConnectable:l=!0,isConnectableStart:a=!0,isConnectableEnd:u=!0,id:s,onConnect:f,children:d,className:h,onMouseDown:m,onTouchStart:p,...y},x){var F,L;const w=s||null,E=e==="target",_=pt(),S=qS(),{connectOnClick:T,noPanClassName:k,rfId:z}=Ve(kM,ht),{connectingFrom:M,connectingTo:A,clickConnecting:q,isPossibleEndHandle:j,connectionInProcess:H,clickConnectionInProcess:R,valid:B}=Ve(NM(S,w,e),ht);S||(L=(F=_.getState()).onError)==null||L.call(F,"010",rr.error010());const U=G=>{const{defaultEdgeOptions:Z,onConnect:J,hasDefaultEdges:D}=_.getState(),V={...Z,...G};if(D){const{edges:P,setEdges:N}=_.getState();N(GA(V,P))}J==null||J(V),f==null||f(V)},W=G=>{if(!S)return;const Z=hS(G.nativeEvent);if(a&&(Z&&G.button===0||!Z)){const J=_.getState();Pp.onPointerDown(G.nativeEvent,{handleDomNode:G.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:(...D)=>{var V,P;return(P=(V=_.getState()).onConnectEnd)==null?void 0:P.call(V,...D)},updateConnection:J.updateConnection,onConnect:U,isValidConnection:r||((...D)=>{var V,P;return((P=(V=_.getState()).isValidConnection)==null?void 0:P.call(V,...D))??!0}),getTransform:()=>_.getState().transform,getFromHandle:()=>_.getState().connection.fromHandle,autoPanSpeed:J.autoPanSpeed,dragThreshold:J.connectionDragThreshold})}Z?m==null||m(G):p==null||p(G)},I=G=>{const{onClickConnectStart:Z,onClickConnectEnd:J,connectionClickStartHandle:D,connectionMode:V,isValidConnection:P,lib:N,rfId:Y,nodeLookup:X,connection:K}=_.getState();if(!S||!D&&!a)return;if(!D){Z==null||Z(G.nativeEvent,{nodeId:S,handleId:w,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:S,type:e,id:w}});return}const ne=fS(G.target),re=r||P,{connection:se,isValid:ye}=Pp.isValid(G.nativeEvent,{handle:{nodeId:S,id:w,type:e},connectionMode:V,fromNodeId:D.nodeId,fromHandleId:D.id||null,fromType:D.type,isValidConnection:re,flowId:Y,doc:ne,lib:N,nodeLookup:X});ye&&se&&U(se);const ve=structuredClone(K);delete ve.inProgress,ve.toPosition=ve.toHandle?ve.toHandle.position:null,J==null||J(G,ve),_.setState({connectionClickStartHandle:null})};return b.jsx("div",{"data-handleid":w,"data-nodeid":S,"data-handlepos":n,"data-id":`${z}-${S}-${w}-${e}`,className:At(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",k,h,{source:!E,target:E,connectable:l,connectablestart:a,connectableend:u,clickconnecting:q,connectingfrom:M,connectingto:A,valid:B,connectionindicator:l&&(!H||j)&&(H||R?u:a)}]),onMouseDown:W,onTouchStart:W,onClick:T?I:void 0,ref:x,...y,children:d})}const sn=$.memo(LS(CM));function TM({data:e,isConnectable:n,sourcePosition:r=we.Bottom}){return b.jsxs(b.Fragment,{children:[e==null?void 0:e.label,b.jsx(sn,{type:"source",position:r,isConnectable:n})]})}function AM({data:e,isConnectable:n,targetPosition:r=we.Top,sourcePosition:l=we.Bottom}){return b.jsxs(b.Fragment,{children:[b.jsx(sn,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label,b.jsx(sn,{type:"source",position:l,isConnectable:n})]})}function zM(){return null}function MM({data:e,isConnectable:n,targetPosition:r=we.Top}){return b.jsxs(b.Fragment,{children:[b.jsx(sn,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label]})}const fc={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Kv={input:TM,default:AM,output:MM,group:zM};function jM(e){var n,r,l,a;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((n=e.style)==null?void 0:n.width),height:e.height??e.initialHeight??((r=e.style)==null?void 0:r.height)}:{width:e.width??((l=e.style)==null?void 0:l.width),height:e.height??((a=e.style)==null?void 0:a.height)}}const DM=e=>{const{width:n,height:r,x:l,y:a}=Qo(e.nodeLookup,{filter:u=>!!u.selected});return{width:Un(n)?n:null,height:Un(r)?r:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${l}px,${a}px)`}};function RM({onSelectionContextMenu:e,noPanClassName:n,disableKeyboardA11y:r}){const l=pt(),{width:a,height:u,transformString:s,userSelectionActive:f}=Ve(DM,ht),d=IS(),h=$.useRef(null);$.useEffect(()=>{var x;r||(x=h.current)==null||x.focus({preventScroll:!0})},[r]);const m=!f&&a!==null&&u!==null;if(BS({nodeRef:h,disabled:!m}),!m)return null;const p=e?x=>{const w=l.getState().nodes.filter(E=>E.selected);e(x,w)}:void 0,y=x=>{Object.prototype.hasOwnProperty.call(fc,x.key)&&(x.preventDefault(),d({direction:fc[x.key],factor:x.shiftKey?4:1}))};return b.jsx("div",{className:At(["react-flow__nodesselection","react-flow__container",n]),style:{transform:s},children:b.jsx("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:p,tabIndex:r?void 0:-1,onKeyDown:r?void 0:y,style:{width:a,height:u}})})}const Jv=typeof window<"u"?window:void 0,OM=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function US({children:e,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:l,onPaneMouseLeave:a,onPaneContextMenu:u,onPaneScroll:s,paneClickDistance:f,deleteKeyCode:d,selectionKeyCode:h,selectionOnDrag:m,selectionMode:p,onSelectionStart:y,onSelectionEnd:x,multiSelectionKeyCode:w,panActivationKeyCode:E,zoomActivationKeyCode:_,elementsSelectable:S,zoomOnScroll:T,zoomOnPinch:k,panOnScroll:z,panOnScrollSpeed:M,panOnScrollMode:A,zoomOnDoubleClick:q,panOnDrag:j,defaultViewport:H,translateExtent:R,minZoom:B,maxZoom:U,preventScrolling:W,onSelectionContextMenu:I,noWheelClassName:F,noPanClassName:L,disableKeyboardA11y:G,onViewportChange:Z,isControlledViewport:J}){const{nodesSelectionActive:D,userSelectionActive:V}=Ve(OM,ht),P=Uo(h,{target:Jv}),N=Uo(E,{target:Jv}),Y=N||j,X=N||z,K=m&&Y!==!0,ne=P||V||K;return mM({deleteKeyCode:d,multiSelectionKeyCode:w}),b.jsx(xM,{onPaneContextMenu:u,elementsSelectable:S,zoomOnScroll:T,zoomOnPinch:k,panOnScroll:X,panOnScrollSpeed:M,panOnScrollMode:A,zoomOnDoubleClick:q,panOnDrag:!P&&Y,defaultViewport:H,translateExtent:R,minZoom:B,maxZoom:U,zoomActivationKeyCode:_,preventScrolling:W,noWheelClassName:F,noPanClassName:L,onViewportChange:Z,isControlledViewport:J,paneClickDistance:f,selectionOnDrag:K,children:b.jsxs(SM,{onSelectionStart:y,onSelectionEnd:x,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:l,onPaneMouseLeave:a,onPaneContextMenu:u,onPaneScroll:s,panOnDrag:Y,isSelecting:!!ne,selectionMode:p,selectionKeyPressed:P,paneClickDistance:f,selectionOnDrag:K,children:[e,D&&b.jsx(RM,{onSelectionContextMenu:I,noPanClassName:L,disableKeyboardA11y:G})]})})}US.displayName="FlowRenderer";const LM=$.memo(US),HM=e=>n=>e?vm(n.nodeLookup,{x:0,y:0,width:n.width,height:n.height},n.transform,!0).map(r=>r.id):Array.from(n.nodeLookup.keys());function BM(e){return Ve($.useCallback(HM(e),[e]),ht)}const IM=e=>e.updateNodeInternals;function qM(){const e=Ve(IM),[n]=$.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(r=>{const l=new Map;r.forEach(a=>{const u=a.target.getAttribute("data-id");l.set(u,{id:u,nodeElement:a.target,force:!0})}),e(l)}));return $.useEffect(()=>()=>{n==null||n.disconnect()},[n]),n}function UM({node:e,nodeType:n,hasDimensions:r,resizeObserver:l}){const a=pt(),u=$.useRef(null),s=$.useRef(null),f=$.useRef(e.sourcePosition),d=$.useRef(e.targetPosition),h=$.useRef(n),m=r&&!!e.internals.handleBounds;return $.useEffect(()=>{u.current&&!e.hidden&&(!m||s.current!==u.current)&&(s.current&&(l==null||l.unobserve(s.current)),l==null||l.observe(u.current),s.current=u.current)},[m,e.hidden]),$.useEffect(()=>()=>{s.current&&(l==null||l.unobserve(s.current),s.current=null)},[]),$.useEffect(()=>{if(u.current){const p=h.current!==n,y=f.current!==e.sourcePosition,x=d.current!==e.targetPosition;(p||y||x)&&(h.current=n,f.current=e.sourcePosition,d.current=e.targetPosition,a.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:u.current,force:!0}]])))}},[e.id,n,e.sourcePosition,e.targetPosition]),u}function VM({id:e,onClick:n,onMouseEnter:r,onMouseMove:l,onMouseLeave:a,onContextMenu:u,onDoubleClick:s,nodesDraggable:f,elementsSelectable:d,nodesConnectable:h,nodesFocusable:m,resizeObserver:p,noDragClassName:y,noPanClassName:x,disableKeyboardA11y:w,rfId:E,nodeTypes:_,nodeClickDistance:S,onError:T}){const{node:k,internals:z,isParent:M}=Ve(re=>{const se=re.nodeLookup.get(e),ye=re.parentLookup.has(e);return{node:se,internals:se.internals,isParent:ye}},ht);let A=k.type||"default",q=(_==null?void 0:_[A])||Kv[A];q===void 0&&(T==null||T("003",rr.error003(A)),A="default",q=(_==null?void 0:_.default)||Kv.default);const j=!!(k.draggable||f&&typeof k.draggable>"u"),H=!!(k.selectable||d&&typeof k.selectable>"u"),R=!!(k.connectable||h&&typeof k.connectable>"u"),B=!!(k.focusable||m&&typeof k.focusable>"u"),U=pt(),W=uS(k),I=UM({node:k,nodeType:A,hasDimensions:W,resizeObserver:p}),F=BS({nodeRef:I,disabled:k.hidden||!j,noDragClassName:y,handleSelector:k.dragHandle,nodeId:e,isSelectable:H,nodeClickDistance:S}),L=IS();if(k.hidden)return null;const G=jr(k),Z=jM(k),J=H||j||n||r||l||a,D=r?re=>r(re,{...z.userNode}):void 0,V=l?re=>l(re,{...z.userNode}):void 0,P=a?re=>a(re,{...z.userNode}):void 0,N=u?re=>u(re,{...z.userNode}):void 0,Y=s?re=>s(re,{...z.userNode}):void 0,X=re=>{const{selectNodesOnDrag:se,nodeDragThreshold:ye}=U.getState();H&&(!se||!j||ye>0)&&Xp({id:e,store:U,nodeRef:I}),n&&n(re,{...z.userNode})},K=re=>{if(!(dS(re.nativeEvent)||w)){if(eS.includes(re.key)&&H){const se=re.key==="Escape";Xp({id:e,store:U,unselect:se,nodeRef:I})}else if(j&&k.selected&&Object.prototype.hasOwnProperty.call(fc,re.key)){re.preventDefault();const{ariaLabelConfig:se}=U.getState();U.setState({ariaLiveMessage:se["node.a11yDescription.ariaLiveMessage"]({direction:re.key.replace("Arrow","").toLowerCase(),x:~~z.positionAbsolute.x,y:~~z.positionAbsolute.y})}),L({direction:fc[re.key],factor:re.shiftKey?4:1})}}},ne=()=>{var _e;if(w||!((_e=I.current)!=null&&_e.matches(":focus-visible")))return;const{transform:re,width:se,height:ye,autoPanOnNodeFocus:ve,setCenter:xe}=U.getState();if(!ve)return;vm(new Map([[e,k]]),{x:0,y:0,width:se,height:ye},re,!0).length>0||xe(k.position.x+G.width/2,k.position.y+G.height/2,{zoom:re[2]})};return b.jsx("div",{className:At(["react-flow__node",`react-flow__node-${A}`,{[x]:j},k.className,{selected:k.selected,selectable:H,parent:M,draggable:j,dragging:F}]),ref:I,style:{zIndex:z.z,transform:`translate(${z.positionAbsolute.x}px,${z.positionAbsolute.y}px)`,pointerEvents:J?"all":"none",visibility:W?"visible":"hidden",...k.style,...Z},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:D,onMouseMove:V,onMouseLeave:P,onContextMenu:N,onClick:X,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:`${zS}-${E}`,"aria-label":k.ariaLabel,...k.domAttributes,children:b.jsx(EM,{value:e,children:b.jsx(q,{id:e,data:k.data,type:A,positionAbsoluteX:z.positionAbsolute.x,positionAbsoluteY:z.positionAbsolute.y,selected:k.selected??!1,selectable:H,draggable:j,deletable:k.deletable??!0,isConnectable:R,sourcePosition:k.sourcePosition,targetPosition:k.targetPosition,dragging:F,dragHandle:k.dragHandle,zIndex:z.z,parentId:k.parentId,...G})})})}var $M=$.memo(VM);const YM=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function VS(e){const{nodesDraggable:n,nodesConnectable:r,nodesFocusable:l,elementsSelectable:a,onError:u}=Ve(YM,ht),s=BM(e.onlyRenderVisibleElements),f=qM();return b.jsx("div",{className:"react-flow__nodes",style:Mc,children:s.map(d=>b.jsx($M,{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:r,nodesFocusable:l,elementsSelectable:a,nodeClickDistance:e.nodeClickDistance,onError:u},d))})}VS.displayName="NodeRenderer";const FM=$.memo(VS);function GM(e){return Ve($.useCallback(r=>{if(!e)return r.edges.map(a=>a.id);const l=[];if(r.width&&r.height)for(const a of r.edges){const u=r.nodeLookup.get(a.source),s=r.nodeLookup.get(a.target);u&&s&&$A({sourceNode:u,targetNode:s,width:r.width,height:r.height,transform:r.transform})&&l.push(a.id)}return l},[e]),ht)}const PM=({color:e="none",strokeWidth:n=1})=>{const r={strokeWidth:n,...e&&{stroke:e}};return b.jsx("polyline",{className:"arrow",style:r,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},XM=({color:e="none",strokeWidth:n=1})=>{const r={strokeWidth:n,...e&&{stroke:e,fill:e}};return b.jsx("polyline",{className:"arrowclosed",style:r,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Wv={[sc.Arrow]:PM,[sc.ArrowClosed]:XM};function QM(e){const n=pt();return $.useMemo(()=>{var a,u;return Object.prototype.hasOwnProperty.call(Wv,e)?Wv[e]:((u=(a=n.getState()).onError)==null||u.call(a,"009",rr.error009(e)),null)},[e])}const ZM=({id:e,type:n,color:r,width:l=12.5,height:a=12.5,markerUnits:u="strokeWidth",strokeWidth:s,orient:f="auto-start-reverse"})=>{const d=QM(n);return d?b.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${l}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:u,orient:f,refX:"0",refY:"0",children:b.jsx(d,{color:r,strokeWidth:s})}):null},$S=({defaultColor:e,rfId:n})=>{const r=Ve(u=>u.edges),l=Ve(u=>u.defaultEdgeOptions),a=$.useMemo(()=>KA(r,{id:n,defaultColor:e,defaultMarkerStart:l==null?void 0:l.markerStart,defaultMarkerEnd:l==null?void 0:l.markerEnd}),[r,l,n,e]);return a.length?b.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:b.jsx("defs",{children:a.map(u=>b.jsx(ZM,{id:u.id,type:u.type,color:u.color,width:u.width,height:u.height,markerUnits:u.markerUnits,strokeWidth:u.strokeWidth,orient:u.orient},u.id))})}):null};$S.displayName="MarkerDefinitions";var KM=$.memo($S);function YS({x:e,y:n,label:r,labelStyle:l,labelShowBg:a=!0,labelBgStyle:u,labelBgPadding:s=[2,4],labelBgBorderRadius:f=2,children:d,className:h,...m}){const[p,y]=$.useState({x:1,y:0,width:0,height:0}),x=At(["react-flow__edge-textwrapper",h]),w=$.useRef(null);return $.useEffect(()=>{if(w.current){const E=w.current.getBBox();y({x:E.x,y:E.y,width:E.width,height:E.height})}},[r]),r?b.jsxs("g",{transform:`translate(${e-p.width/2} ${n-p.height/2})`,className:x,visibility:p.width?"visible":"hidden",...m,children:[a&&b.jsx("rect",{width:p.width+2*s[0],x:-s[0],y:-s[1],height:p.height+2*s[1],className:"react-flow__edge-textbg",style:u,rx:f,ry:f}),b.jsx("text",{className:"react-flow__edge-text",y:p.height/2,dy:"0.3em",ref:w,style:l,children:r}),d]}):null}YS.displayName="EdgeText";const JM=$.memo(YS);function Wo({path:e,labelX:n,labelY:r,label:l,labelStyle:a,labelShowBg:u,labelBgStyle:s,labelBgPadding:f,labelBgBorderRadius:d,interactionWidth:h=20,...m}){return b.jsxs(b.Fragment,{children:[b.jsx("path",{...m,d:e,fill:"none",className:At(["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&&Un(n)&&Un(r)?b.jsx(JM,{x:n,y:r,label:l,labelStyle:a,labelShowBg:u,labelBgStyle:s,labelBgPadding:f,labelBgBorderRadius:d}):null]})}function e1({pos:e,x1:n,y1:r,x2:l,y2:a}){return e===we.Left||e===we.Right?[.5*(n+l),r]:[n,.5*(r+a)]}function FS({sourceX:e,sourceY:n,sourcePosition:r=we.Bottom,targetX:l,targetY:a,targetPosition:u=we.Top}){const[s,f]=e1({pos:r,x1:e,y1:n,x2:l,y2:a}),[d,h]=e1({pos:u,x1:l,y1:a,x2:e,y2:n}),[m,p,y,x]=pS({sourceX:e,sourceY:n,targetX:l,targetY:a,sourceControlX:s,sourceControlY:f,targetControlX:d,targetControlY:h});return[`M${e},${n} C${s},${f} ${d},${h} ${l},${a}`,m,p,y,x]}function GS(e){return $.memo(({id:n,sourceX:r,sourceY:l,targetX:a,targetY:u,sourcePosition:s,targetPosition:f,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:y,labelBgBorderRadius:x,style:w,markerEnd:E,markerStart:_,interactionWidth:S})=>{const[T,k,z]=FS({sourceX:r,sourceY:l,sourcePosition:s,targetX:a,targetY:u,targetPosition:f}),M=e.isInternal?void 0:n;return b.jsx(Wo,{id:M,path:T,labelX:k,labelY:z,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:y,labelBgBorderRadius:x,style:w,markerEnd:E,markerStart:_,interactionWidth:S})})}const WM=GS({isInternal:!1}),PS=GS({isInternal:!0});WM.displayName="SimpleBezierEdge";PS.displayName="SimpleBezierEdgeInternal";function XS(e){return $.memo(({id:n,sourceX:r,sourceY:l,targetX:a,targetY:u,label:s,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:y,sourcePosition:x=we.Bottom,targetPosition:w=we.Top,markerEnd:E,markerStart:_,pathOptions:S,interactionWidth:T})=>{const[k,z,M]=Yp({sourceX:r,sourceY:l,sourcePosition:x,targetX:a,targetY:u,targetPosition:w,borderRadius:S==null?void 0:S.borderRadius,offset:S==null?void 0:S.offset,stepPosition:S==null?void 0:S.stepPosition}),A=e.isInternal?void 0:n;return b.jsx(Wo,{id:A,path:k,labelX:z,labelY:M,label:s,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:y,markerEnd:E,markerStart:_,interactionWidth:T})})}const QS=XS({isInternal:!1}),ZS=XS({isInternal:!0});QS.displayName="SmoothStepEdge";ZS.displayName="SmoothStepEdgeInternal";function KS(e){return $.memo(({id:n,...r})=>{var a;const l=e.isInternal?void 0:n;return b.jsx(QS,{...r,id:l,pathOptions:$.useMemo(()=>{var u;return{borderRadius:0,offset:(u=r.pathOptions)==null?void 0:u.offset}},[(a=r.pathOptions)==null?void 0:a.offset])})})}const ej=KS({isInternal:!1}),JS=KS({isInternal:!0});ej.displayName="StepEdge";JS.displayName="StepEdgeInternal";function WS(e){return $.memo(({id:n,sourceX:r,sourceY:l,targetX:a,targetY:u,label:s,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:y,markerEnd:x,markerStart:w,interactionWidth:E})=>{const[_,S,T]=gS({sourceX:r,sourceY:l,targetX:a,targetY:u}),k=e.isInternal?void 0:n;return b.jsx(Wo,{id:k,path:_,labelX:S,labelY:T,label:s,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:y,markerEnd:x,markerStart:w,interactionWidth:E})})}const tj=WS({isInternal:!1}),e_=WS({isInternal:!0});tj.displayName="StraightEdge";e_.displayName="StraightEdgeInternal";function t_(e){return $.memo(({id:n,sourceX:r,sourceY:l,targetX:a,targetY:u,sourcePosition:s=we.Bottom,targetPosition:f=we.Top,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:y,labelBgBorderRadius:x,style:w,markerEnd:E,markerStart:_,pathOptions:S,interactionWidth:T})=>{const[k,z,M]=Sm({sourceX:r,sourceY:l,sourcePosition:s,targetX:a,targetY:u,targetPosition:f,curvature:S==null?void 0:S.curvature}),A=e.isInternal?void 0:n;return b.jsx(Wo,{id:A,path:k,labelX:z,labelY:M,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:y,labelBgBorderRadius:x,style:w,markerEnd:E,markerStart:_,interactionWidth:T})})}const nj=t_({isInternal:!1}),n_=t_({isInternal:!0});nj.displayName="BezierEdge";n_.displayName="BezierEdgeInternal";const t1={default:n_,straight:e_,step:JS,smoothstep:ZS,simplebezier:PS},n1={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},rj=(e,n,r)=>r===we.Left?e-n:r===we.Right?e+n:e,ij=(e,n,r)=>r===we.Top?e-n:r===we.Bottom?e+n:e,r1="react-flow__edgeupdater";function i1({position:e,centerX:n,centerY:r,radius:l=10,onMouseDown:a,onMouseEnter:u,onMouseOut:s,type:f}){return b.jsx("circle",{onMouseDown:a,onMouseEnter:u,onMouseOut:s,className:At([r1,`${r1}-${f}`]),cx:rj(n,l,e),cy:ij(r,l,e),r:l,stroke:"transparent",fill:"transparent"})}function lj({isReconnectable:e,reconnectRadius:n,edge:r,sourceX:l,sourceY:a,targetX:u,targetY:s,sourcePosition:f,targetPosition:d,onReconnect:h,onReconnectStart:m,onReconnectEnd:p,setReconnecting:y,setUpdateHover:x}){const w=pt(),E=(z,M)=>{if(z.button!==0)return;const{autoPanOnConnect:A,domNode:q,connectionMode:j,connectionRadius:H,lib:R,onConnectStart:B,cancelConnection:U,nodeLookup:W,rfId:I,panBy:F,updateConnection:L}=w.getState(),G=M.type==="target",Z=(V,P)=>{y(!1),p==null||p(V,r,M.type,P)},J=V=>h==null?void 0:h(r,V),D=(V,P)=>{y(!0),m==null||m(z,r,M.type),B==null||B(V,P)};Pp.onPointerDown(z.nativeEvent,{autoPanOnConnect:A,connectionMode:j,connectionRadius:H,domNode:q,handleId:M.id,nodeId:M.nodeId,nodeLookup:W,isTarget:G,edgeUpdaterType:M.type,lib:R,flowId:I,cancelConnection:U,panBy:F,isValidConnection:(...V)=>{var P,N;return((N=(P=w.getState()).isValidConnection)==null?void 0:N.call(P,...V))??!0},onConnect:J,onConnectStart:D,onConnectEnd:(...V)=>{var P,N;return(N=(P=w.getState()).onConnectEnd)==null?void 0:N.call(P,...V)},onReconnectEnd:Z,updateConnection:L,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,dragThreshold:w.getState().connectionDragThreshold,handleDomNode:z.currentTarget})},_=z=>E(z,{nodeId:r.target,id:r.targetHandle??null,type:"target"}),S=z=>E(z,{nodeId:r.source,id:r.sourceHandle??null,type:"source"}),T=()=>x(!0),k=()=>x(!1);return b.jsxs(b.Fragment,{children:[(e===!0||e==="source")&&b.jsx(i1,{position:f,centerX:l,centerY:a,radius:n,onMouseDown:_,onMouseEnter:T,onMouseOut:k,type:"source"}),(e===!0||e==="target")&&b.jsx(i1,{position:d,centerX:u,centerY:s,radius:n,onMouseDown:S,onMouseEnter:T,onMouseOut:k,type:"target"})]})}function aj({id:e,edgesFocusable:n,edgesReconnectable:r,elementsSelectable:l,onClick:a,onDoubleClick:u,onContextMenu:s,onMouseEnter:f,onMouseMove:d,onMouseLeave:h,reconnectRadius:m,onReconnect:p,onReconnectStart:y,onReconnectEnd:x,rfId:w,edgeTypes:E,noPanClassName:_,onError:S,disableKeyboardA11y:T}){let k=Ve(xe=>xe.edgeLookup.get(e));const z=Ve(xe=>xe.defaultEdgeOptions);k=z?{...z,...k}:k;let M=k.type||"default",A=(E==null?void 0:E[M])||t1[M];A===void 0&&(S==null||S("011",rr.error011(M)),M="default",A=(E==null?void 0:E.default)||t1.default);const q=!!(k.focusable||n&&typeof k.focusable>"u"),j=typeof p<"u"&&(k.reconnectable||r&&typeof k.reconnectable>"u"),H=!!(k.selectable||l&&typeof k.selectable>"u"),R=$.useRef(null),[B,U]=$.useState(!1),[W,I]=$.useState(!1),F=pt(),{zIndex:L,sourceX:G,sourceY:Z,targetX:J,targetY:D,sourcePosition:V,targetPosition:P}=Ve($.useCallback(xe=>{const pe=xe.nodeLookup.get(k.source),_e=xe.nodeLookup.get(k.target);if(!pe||!_e)return{zIndex:k.zIndex,...n1};const Me=ZA({id:e,sourceNode:pe,targetNode:_e,sourceHandle:k.sourceHandle||null,targetHandle:k.targetHandle||null,connectionMode:xe.connectionMode,onError:S});return{zIndex:VA({selected:k.selected,zIndex:k.zIndex,sourceNode:pe,targetNode:_e,elevateOnSelect:xe.elevateEdgesOnSelect,zIndexMode:xe.zIndexMode}),...Me||n1}},[k.source,k.target,k.sourceHandle,k.targetHandle,k.selected,k.zIndex]),ht),N=$.useMemo(()=>k.markerStart?`url('#${Fp(k.markerStart,w)}')`:void 0,[k.markerStart,w]),Y=$.useMemo(()=>k.markerEnd?`url('#${Fp(k.markerEnd,w)}')`:void 0,[k.markerEnd,w]);if(k.hidden||G===null||Z===null||J===null||D===null)return null;const X=xe=>{var Te;const{addSelectedEdges:pe,unselectNodesAndEdges:_e,multiSelectionActive:Me}=F.getState();H&&(F.setState({nodesSelectionActive:!1}),k.selected&&Me?(_e({nodes:[],edges:[k]}),(Te=R.current)==null||Te.blur()):pe([e])),a&&a(xe,k)},K=u?xe=>{u(xe,{...k})}:void 0,ne=s?xe=>{s(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(!T&&eS.includes(xe.key)&&H){const{unselectNodesAndEdges:_e,addSelectedEdges:Me}=F.getState();xe.key==="Escape"?((pe=R.current)==null||pe.blur(),_e({edges:[k]})):Me([e])}};return b.jsx("svg",{style:{zIndex:L},children:b.jsxs("g",{className:At(["react-flow__edge",`react-flow__edge-${M}`,k.className,_,{selected:k.selected,animated:k.animated,inactive:!H&&!a,updating:B,selectable:H}]),onClick:X,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?`${MS}-${w}`:void 0,ref:R,...k.domAttributes,children:[!W&&b.jsx(A,{id:e,source:k.source,target:k.target,type:k.type,selected:k.selected,animated:k.animated,selectable:H,deletable:k.deletable??!0,label:k.label,labelStyle:k.labelStyle,labelShowBg:k.labelShowBg,labelBgStyle:k.labelBgStyle,labelBgPadding:k.labelBgPadding,labelBgBorderRadius:k.labelBgBorderRadius,sourceX:G,sourceY:Z,targetX:J,targetY:D,sourcePosition:V,targetPosition:P,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(lj,{edge:k,isReconnectable:j,reconnectRadius:m,onReconnect:p,onReconnectStart:y,onReconnectEnd:x,sourceX:G,sourceY:Z,targetX:J,targetY:D,sourcePosition:V,targetPosition:P,setUpdateHover:U,setReconnecting:I})]})})}var oj=$.memo(aj);const sj=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function r_({defaultMarkerColor:e,onlyRenderVisibleElements:n,rfId:r,edgeTypes:l,noPanClassName:a,onReconnect:u,onEdgeContextMenu:s,onEdgeMouseEnter:f,onEdgeMouseMove:d,onEdgeMouseLeave:h,onEdgeClick:m,reconnectRadius:p,onEdgeDoubleClick:y,onReconnectStart:x,onReconnectEnd:w,disableKeyboardA11y:E}){const{edgesFocusable:_,edgesReconnectable:S,elementsSelectable:T,onError:k}=Ve(sj,ht),z=GM(n);return b.jsxs("div",{className:"react-flow__edges",children:[b.jsx(KM,{defaultColor:e,rfId:r}),z.map(M=>b.jsx(oj,{id:M,edgesFocusable:_,edgesReconnectable:S,elementsSelectable:T,noPanClassName:a,onReconnect:u,onContextMenu:s,onMouseEnter:f,onMouseMove:d,onMouseLeave:h,onClick:m,reconnectRadius:p,onDoubleClick:y,onReconnectStart:x,onReconnectEnd:w,rfId:r,onError:k,edgeTypes:l,disableKeyboardA11y:E},M))]})}r_.displayName="EdgeRenderer";const uj=$.memo(r_),cj=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function fj({children:e}){const n=Ve(cj);return b.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:e})}function dj(e){const n=Jo(),r=$.useRef(!1);$.useEffect(()=>{!r.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),r.current=!0)},[e,n.viewportInitialized])}const hj=e=>{var n;return(n=e.panZoom)==null?void 0:n.syncViewport};function pj(e){const n=Ve(hj),r=pt();return $.useEffect(()=>{e&&(n==null||n(e),r.setState({transform:[e.x,e.y,e.zoom]}))},[e,n]),null}function mj(e){return e.connection.inProgress?{...e.connection,to:Ko(e.connection.to,e.transform)}:{...e.connection}}function gj(e){return mj}function yj(e){const n=gj();return Ve(n,ht)}const xj=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function vj({containerStyle:e,style:n,type:r,component:l}){const{nodesConnectable:a,width:u,height:s,isValid:f,inProgress:d}=Ve(xj,ht);return!(u&&a&&d)?null:b.jsx("svg",{style:e,width:u,height:s,className:"react-flow__connectionline react-flow__container",children:b.jsx("g",{className:At(["react-flow__connection",rS(f)]),children:b.jsx(i_,{style:n,type:r,CustomComponent:l,isValid:f})})})}const i_=({style:e,type:n=pi.Bezier,CustomComponent:r,isValid:l})=>{const{inProgress:a,from:u,fromNode:s,fromHandle:f,fromPosition:d,to:h,toNode:m,toHandle:p,toPosition:y,pointer:x}=yj();if(!a)return;if(r)return b.jsx(r,{connectionLineType:n,connectionLineStyle:e,fromNode:s,fromHandle:f,fromX:u.x,fromY:u.y,toX:h.x,toY:h.y,fromPosition:d,toPosition:y,connectionStatus:rS(l),toNode:m,toHandle:p,pointer:x});let w="";const E={sourceX:u.x,sourceY:u.y,sourcePosition:d,targetX:h.x,targetY:h.y,targetPosition:y};switch(n){case pi.Bezier:[w]=Sm(E);break;case pi.SimpleBezier:[w]=FS(E);break;case pi.Step:[w]=Yp({...E,borderRadius:0});break;case pi.SmoothStep:[w]=Yp(E);break;default:[w]=gS(E)}return b.jsx("path",{d:w,fill:"none",className:"react-flow__connection-path",style:e})};i_.displayName="ConnectionLine";const bj={};function l1(e=bj){$.useRef(e),pt(),$.useEffect(()=>{},[e])}function wj(){pt(),$.useRef(!1),$.useEffect(()=>{},[])}function l_({nodeTypes:e,edgeTypes:n,onInit:r,onNodeClick:l,onEdgeClick:a,onNodeDoubleClick:u,onEdgeDoubleClick:s,onNodeMouseEnter:f,onNodeMouseMove:d,onNodeMouseLeave:h,onNodeContextMenu:m,onSelectionContextMenu:p,onSelectionStart:y,onSelectionEnd:x,connectionLineType:w,connectionLineStyle:E,connectionLineComponent:_,connectionLineContainerStyle:S,selectionKeyCode:T,selectionOnDrag:k,selectionMode:z,multiSelectionKeyCode:M,panActivationKeyCode:A,zoomActivationKeyCode:q,deleteKeyCode:j,onlyRenderVisibleElements:H,elementsSelectable:R,defaultViewport:B,translateExtent:U,minZoom:W,maxZoom:I,preventScrolling:F,defaultMarkerColor:L,zoomOnScroll:G,zoomOnPinch:Z,panOnScroll:J,panOnScrollSpeed:D,panOnScrollMode:V,zoomOnDoubleClick:P,panOnDrag:N,onPaneClick:Y,onPaneMouseEnter:X,onPaneMouseMove:K,onPaneMouseLeave:ne,onPaneScroll:re,onPaneContextMenu:se,paneClickDistance:ye,nodeClickDistance:ve,onEdgeContextMenu:xe,onEdgeMouseEnter:pe,onEdgeMouseMove:_e,onEdgeMouseLeave:Me,reconnectRadius:Te,onReconnect:ut,onReconnectStart:et,onReconnectEnd:zt,noDragClassName:Ut,noWheelClassName:Ot,noPanClassName:_n,disableKeyboardA11y:Dn,nodeExtent:Mt,rfId:Rr,viewport:ue,onViewportChange:ge}){return l1(e),l1(n),wj(),dj(r),pj(ue),b.jsx(LM,{onPaneClick:Y,onPaneMouseEnter:X,onPaneMouseMove:K,onPaneMouseLeave:ne,onPaneContextMenu:se,onPaneScroll:re,paneClickDistance:ye,deleteKeyCode:j,selectionKeyCode:T,selectionOnDrag:k,selectionMode:z,onSelectionStart:y,onSelectionEnd:x,multiSelectionKeyCode:M,panActivationKeyCode:A,zoomActivationKeyCode:q,elementsSelectable:R,zoomOnScroll:G,zoomOnPinch:Z,zoomOnDoubleClick:P,panOnScroll:J,panOnScrollSpeed:D,panOnScrollMode:V,panOnDrag:N,defaultViewport:B,translateExtent:U,minZoom:W,maxZoom:I,onSelectionContextMenu:p,preventScrolling:F,noDragClassName:Ut,noWheelClassName:Ot,noPanClassName:_n,disableKeyboardA11y:Dn,onViewportChange:ge,isControlledViewport:!!ue,children:b.jsxs(fj,{children:[b.jsx(uj,{edgeTypes:n,onEdgeClick:a,onEdgeDoubleClick:s,onReconnect:ut,onReconnectStart:et,onReconnectEnd:zt,onlyRenderVisibleElements:H,onEdgeContextMenu:xe,onEdgeMouseEnter:pe,onEdgeMouseMove:_e,onEdgeMouseLeave:Me,reconnectRadius:Te,defaultMarkerColor:L,noPanClassName:_n,disableKeyboardA11y:Dn,rfId:Rr}),b.jsx(vj,{style:E,type:w,component:_,containerStyle:S}),b.jsx("div",{className:"react-flow__edgelabel-renderer"}),b.jsx(FM,{nodeTypes:e,onNodeClick:l,onNodeDoubleClick:u,onNodeMouseEnter:f,onNodeMouseMove:d,onNodeMouseLeave:h,onNodeContextMenu:m,nodeClickDistance:ve,onlyRenderVisibleElements:H,noPanClassName:_n,noDragClassName:Ut,disableKeyboardA11y:Dn,nodeExtent:Mt,rfId:Rr}),b.jsx("div",{className:"react-flow__viewport-portal"})]})})}l_.displayName="GraphView";const Sj=$.memo(l_),a1=({nodes:e,edges:n,defaultNodes:r,defaultEdges:l,width:a,height:u,fitView:s,fitViewOptions:f,minZoom:d=.5,maxZoom:h=2,nodeOrigin:m,nodeExtent:p,zIndexMode:y="basic"}={})=>{const x=new Map,w=new Map,E=new Map,_=new Map,S=l??n??[],T=r??e??[],k=m??[0,0],z=p??Ho;vS(E,_,S);const M=Gp(T,x,w,{nodeOrigin:k,nodeExtent:z,zIndexMode:y});let A=[0,0,1];if(s&&a&&u){const q=Qo(x,{filter:B=>!!((B.width||B.initialWidth)&&(B.height||B.initialHeight))}),{x:j,y:H,zoom:R}=bm(q,a,u,d,h,(f==null?void 0:f.padding)??.1);A=[j,H,R]}return{rfId:"1",width:a??0,height:u??0,transform:A,nodes:T,nodesInitialized:M,nodeLookup:x,parentLookup:w,edges:S,edgeLookup:_,connectionLookup:E,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:r!==void 0,hasDefaultEdges:l!==void 0,panZoom:null,minZoom:d,maxZoom:h,translateExtent:Ho,nodeExtent:z,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:la.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:s??!1,fitViewOptions:f,fitViewResolver:null,connection:{...nS},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:LA,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:tS,zIndexMode:y,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},_j=({nodes:e,edges:n,defaultNodes:r,defaultEdges:l,width:a,height:u,fitView:s,fitViewOptions:f,minZoom:d,maxZoom:h,nodeOrigin:m,nodeExtent:p,zIndexMode:y})=>qz((x,w)=>{async function E(){const{nodeLookup:_,panZoom:S,fitViewOptions:T,fitViewResolver:k,width:z,height:M,minZoom:A,maxZoom:q}=w();S&&(await RA({nodes:_,width:z,height:M,panZoom:S,minZoom:A,maxZoom:q},T),k==null||k.resolve(!0),x({fitViewResolver:null}))}return{...a1({nodes:e,edges:n,width:a,height:u,fitView:s,fitViewOptions:f,minZoom:d,maxZoom:h,nodeOrigin:m,nodeExtent:p,defaultNodes:r,defaultEdges:l,zIndexMode:y}),setNodes:_=>{const{nodeLookup:S,parentLookup:T,nodeOrigin:k,elevateNodesOnSelect:z,fitViewQueued:M,zIndexMode:A}=w(),q=Gp(_,S,T,{nodeOrigin:k,nodeExtent:p,elevateNodesOnSelect:z,checkEquality:!0,zIndexMode:A});M&&q?(E(),x({nodes:_,nodesInitialized:q,fitViewQueued:!1,fitViewOptions:void 0})):x({nodes:_,nodesInitialized:q})},setEdges:_=>{const{connectionLookup:S,edgeLookup:T}=w();vS(S,T,_),x({edges:_})},setDefaultNodesAndEdges:(_,S)=>{if(_){const{setNodes:T}=w();T(_),x({hasDefaultNodes:!0})}if(S){const{setEdges:T}=w();T(S),x({hasDefaultEdges:!0})}},updateNodeInternals:_=>{const{triggerNodeChanges:S,nodeLookup:T,parentLookup:k,domNode:z,nodeOrigin:M,nodeExtent:A,debug:q,fitViewQueued:j,zIndexMode:H}=w(),{changes:R,updatedInternals:B}=iz(_,T,k,z,M,A,H);B&&(ez(T,k,{nodeOrigin:M,nodeExtent:A,zIndexMode:H}),j?(E(),x({fitViewQueued:!1,fitViewOptions:void 0})):x({}),(R==null?void 0:R.length)>0&&(q&&console.log("React Flow: trigger node changes",R),S==null||S(R)))},updateNodePositions:(_,S=!1)=>{const T=[];let k=[];const{nodeLookup:z,triggerNodeChanges:M,connection:A,updateConnection:q,onNodesChangeMiddlewareMap:j}=w();for(const[H,R]of _){const B=z.get(H),U=!!(B!=null&&B.expandParent&&(B!=null&&B.parentId)&&(R!=null&&R.position)),W={id:H,type:"position",position:U?{x:Math.max(0,R.position.x),y:Math.max(0,R.position.y)}:R.position,dragging:S};if(B&&A.inProgress&&A.fromNode.id===B.id){const I=Zi(B,A.fromHandle,we.Left,!0);q({...A,from:I})}U&&B.parentId&&T.push({id:H,parentId:B.parentId,rect:{...R.internals.positionAbsolute,width:R.measured.width??0,height:R.measured.height??0}}),k.push(W)}if(T.length>0){const{parentLookup:H,nodeOrigin:R}=w(),B=Cm(T,z,H,R);k.push(...B)}for(const H of j.values())k=H(k);M(k)},triggerNodeChanges:_=>{const{onNodesChange:S,setNodes:T,nodes:k,hasDefaultNodes:z,debug:M}=w();if(_!=null&&_.length){if(z){const A=RS(_,k);T(A)}M&&console.log("React Flow: trigger node changes",_),S==null||S(_)}},triggerEdgeChanges:_=>{const{onEdgesChange:S,setEdges:T,edges:k,hasDefaultEdges:z,debug:M}=w();if(_!=null&&_.length){if(z){const A=OS(_,k);T(A)}M&&console.log("React Flow: trigger edge changes",_),S==null||S(_)}},addSelectedNodes:_=>{const{multiSelectionActive:S,edgeLookup:T,nodeLookup:k,triggerNodeChanges:z,triggerEdgeChanges:M}=w();if(S){const A=_.map(q=>Ii(q,!0));z(A);return}z(Ql(k,new Set([..._]),!0)),M(Ql(T))},addSelectedEdges:_=>{const{multiSelectionActive:S,edgeLookup:T,nodeLookup:k,triggerNodeChanges:z,triggerEdgeChanges:M}=w();if(S){const A=_.map(q=>Ii(q,!0));M(A);return}M(Ql(T,new Set([..._]))),z(Ql(k,new Set,!0))},unselectNodesAndEdges:({nodes:_,edges:S}={})=>{const{edges:T,nodes:k,nodeLookup:z,triggerNodeChanges:M,triggerEdgeChanges:A}=w(),q=_||k,j=S||T,H=[];for(const B of q){if(!B.selected)continue;const U=z.get(B.id);U&&(U.selected=!1),H.push(Ii(B.id,!1))}const R=[];for(const B of j)B.selected&&R.push(Ii(B.id,!1));M(H),A(R)},setMinZoom:_=>{const{panZoom:S,maxZoom:T}=w();S==null||S.setScaleExtent([_,T]),x({minZoom:_})},setMaxZoom:_=>{const{panZoom:S,minZoom:T}=w();S==null||S.setScaleExtent([T,_]),x({maxZoom:_})},setTranslateExtent:_=>{var S;(S=w().panZoom)==null||S.setTranslateExtent(_),x({translateExtent:_})},resetSelectedElements:()=>{const{edges:_,nodes:S,triggerNodeChanges:T,triggerEdgeChanges:k,elementsSelectable:z}=w();if(!z)return;const M=S.reduce((q,j)=>j.selected?[...q,Ii(j.id,!1)]:q,[]),A=_.reduce((q,j)=>j.selected?[...q,Ii(j.id,!1)]:q,[]);T(M),k(A)},setNodeExtent:_=>{const{nodes:S,nodeLookup:T,parentLookup:k,nodeOrigin:z,elevateNodesOnSelect:M,nodeExtent:A,zIndexMode:q}=w();_[0][0]===A[0][0]&&_[0][1]===A[0][1]&&_[1][0]===A[1][0]&&_[1][1]===A[1][1]||(Gp(S,T,k,{nodeOrigin:z,nodeExtent:_,elevateNodesOnSelect:M,checkEquality:!1,zIndexMode:q}),x({nodeExtent:_}))},panBy:_=>{const{transform:S,width:T,height:k,panZoom:z,translateExtent:M}=w();return lz({delta:_,panZoom:z,transform:S,translateExtent:M,width:T,height:k})},setCenter:async(_,S,T)=>{const{width:k,height:z,maxZoom:M,panZoom:A}=w();if(!A)return Promise.resolve(!1);const q=typeof(T==null?void 0:T.zoom)<"u"?T.zoom:M;return await A.setViewport({x:k/2-_*q,y:z/2-S*q,zoom:q},{duration:T==null?void 0:T.duration,ease:T==null?void 0:T.ease,interpolate:T==null?void 0:T.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{x({connection:{...nS}})},updateConnection:_=>{x({connection:_})},reset:()=>x({...a1()})}},Object.is);function Ej({initialNodes:e,initialEdges:n,defaultNodes:r,defaultEdges:l,initialWidth:a,initialHeight:u,initialMinZoom:s,initialMaxZoom:f,initialFitViewOptions:d,fitView:h,nodeOrigin:m,nodeExtent:p,zIndexMode:y,children:x}){const[w]=$.useState(()=>_j({nodes:e,edges:n,defaultNodes:r,defaultEdges:l,width:a,height:u,fitView:h,minZoom:s,maxZoom:f,fitViewOptions:d,nodeOrigin:m,nodeExtent:p,zIndexMode:y}));return b.jsx(Vz,{value:w,children:b.jsx(fM,{children:x})})}function kj({children:e,nodes:n,edges:r,defaultNodes:l,defaultEdges:a,width:u,height:s,fitView:f,fitViewOptions:d,minZoom:h,maxZoom:m,nodeOrigin:p,nodeExtent:y,zIndexMode:x}){return $.useContext(Ac)?b.jsx(b.Fragment,{children:e}):b.jsx(Ej,{initialNodes:n,initialEdges:r,defaultNodes:l,defaultEdges:a,initialWidth:u,initialHeight:s,fitView:f,initialFitViewOptions:d,initialMinZoom:h,initialMaxZoom:m,nodeOrigin:p,nodeExtent:y,zIndexMode:x,children:e})}const Nj={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Cj({nodes:e,edges:n,defaultNodes:r,defaultEdges:l,className:a,nodeTypes:u,edgeTypes:s,onNodeClick:f,onEdgeClick:d,onInit:h,onMove:m,onMoveStart:p,onMoveEnd:y,onConnect:x,onConnectStart:w,onConnectEnd:E,onClickConnectStart:_,onClickConnectEnd:S,onNodeMouseEnter:T,onNodeMouseMove:k,onNodeMouseLeave:z,onNodeContextMenu:M,onNodeDoubleClick:A,onNodeDragStart:q,onNodeDrag:j,onNodeDragStop:H,onNodesDelete:R,onEdgesDelete:B,onDelete:U,onSelectionChange:W,onSelectionDragStart:I,onSelectionDrag:F,onSelectionDragStop:L,onSelectionContextMenu:G,onSelectionStart:Z,onSelectionEnd:J,onBeforeDelete:D,connectionMode:V,connectionLineType:P=pi.Bezier,connectionLineStyle:N,connectionLineComponent:Y,connectionLineContainerStyle:X,deleteKeyCode:K="Backspace",selectionKeyCode:ne="Shift",selectionOnDrag:re=!1,selectionMode:se=Bo.Full,panActivationKeyCode:ye="Space",multiSelectionKeyCode:ve=qo()?"Meta":"Control",zoomActivationKeyCode:xe=qo()?"Meta":"Control",snapToGrid:pe,snapGrid:_e,onlyRenderVisibleElements:Me=!1,selectNodesOnDrag:Te,nodesDraggable:ut,autoPanOnNodeFocus:et,nodesConnectable:zt,nodesFocusable:Ut,nodeOrigin:Ot=jS,edgesFocusable:_n,edgesReconnectable:Dn,elementsSelectable:Mt=!0,defaultViewport:Rr=tM,minZoom:ue=.5,maxZoom:ge=2,translateExtent:Ne=Ho,preventScrolling:Oe=!0,nodeExtent:$e,defaultMarkerColor:Pt="#b1b1b7",zoomOnScroll:Rn=!0,zoomOnPinch:Lt=!0,panOnScroll:xt=!1,panOnScrollSpeed:Vt=.5,panOnScrollMode:Ke=Fi.Free,zoomOnDoubleClick:Pn=!0,panOnDrag:cn=!0,onPaneClick:Hc,onPaneMouseEnter:tl,onPaneMouseMove:nl,onPaneMouseLeave:rl,onPaneScroll:ar,onPaneContextMenu:il,paneClickDistance:gi=1,nodeClickDistance:Bc=0,children:rs,onReconnect:ga,onReconnectStart:yi,onReconnectEnd:Ic,onEdgeContextMenu:is,onEdgeDoubleClick:ls,onEdgeMouseEnter:as,onEdgeMouseMove:ya,onEdgeMouseLeave:xa,reconnectRadius:os=10,onNodesChange:ss,onEdgesChange:Xn,noDragClassName:jt="nodrag",noWheelClassName:$t="nowheel",noPanClassName:or="nopan",fitView:ll,fitViewOptions:us,connectOnClick:qc,attributionPosition:cs,proOptions:xi,defaultEdgeOptions:va,elevateNodesOnSelect:Or=!0,elevateEdgesOnSelect:Lr=!1,disableKeyboardA11y:Hr=!1,autoPanOnConnect:Br,autoPanOnNodeDrag:wt,autoPanSpeed:fs,connectionRadius:ds,isValidConnection:sr,onError:Ir,style:Uc,id:ba,nodeDragThreshold:hs,connectionDragThreshold:Vc,viewport:al,onViewportChange:ol,width:On,height:Zt,colorMode:ps="light",debug:$c,onScroll:qr,ariaLabelConfig:ms,zIndexMode:vi="basic",...Yc},Kt){const bi=ba||"1",gs=lM(ps),wa=$.useCallback(ur=>{ur.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),qr==null||qr(ur)},[qr]);return b.jsx("div",{"data-testid":"rf__wrapper",...Yc,onScroll:wa,style:{...Uc,...Nj},ref:Kt,className:At(["react-flow",a,gs]),id:ba,role:"application",children:b.jsxs(kj,{nodes:e,edges:n,width:On,height:Zt,fitView:ll,fitViewOptions:us,minZoom:ue,maxZoom:ge,nodeOrigin:Ot,nodeExtent:$e,zIndexMode:vi,children:[b.jsx(Sj,{onInit:h,onNodeClick:f,onEdgeClick:d,onNodeMouseEnter:T,onNodeMouseMove:k,onNodeMouseLeave:z,onNodeContextMenu:M,onNodeDoubleClick:A,nodeTypes:u,edgeTypes:s,connectionLineType:P,connectionLineStyle:N,connectionLineComponent:Y,connectionLineContainerStyle:X,selectionKeyCode:ne,selectionOnDrag:re,selectionMode:se,deleteKeyCode:K,multiSelectionKeyCode:ve,panActivationKeyCode:ye,zoomActivationKeyCode:xe,onlyRenderVisibleElements:Me,defaultViewport:Rr,translateExtent:Ne,minZoom:ue,maxZoom:ge,preventScrolling:Oe,zoomOnScroll:Rn,zoomOnPinch:Lt,zoomOnDoubleClick:Pn,panOnScroll:xt,panOnScrollSpeed:Vt,panOnScrollMode:Ke,panOnDrag:cn,onPaneClick:Hc,onPaneMouseEnter:tl,onPaneMouseMove:nl,onPaneMouseLeave:rl,onPaneScroll:ar,onPaneContextMenu:il,paneClickDistance:gi,nodeClickDistance:Bc,onSelectionContextMenu:G,onSelectionStart:Z,onSelectionEnd:J,onReconnect:ga,onReconnectStart:yi,onReconnectEnd:Ic,onEdgeContextMenu:is,onEdgeDoubleClick:ls,onEdgeMouseEnter:as,onEdgeMouseMove:ya,onEdgeMouseLeave:xa,reconnectRadius:os,defaultMarkerColor:Pt,noDragClassName:jt,noWheelClassName:$t,noPanClassName:or,rfId:bi,disableKeyboardA11y:Hr,nodeExtent:$e,viewport:al,onViewportChange:ol}),b.jsx(iM,{nodes:e,edges:n,defaultNodes:r,defaultEdges:l,onConnect:x,onConnectStart:w,onConnectEnd:E,onClickConnectStart:_,onClickConnectEnd:S,nodesDraggable:ut,autoPanOnNodeFocus:et,nodesConnectable:zt,nodesFocusable:Ut,edgesFocusable:_n,edgesReconnectable:Dn,elementsSelectable:Mt,elevateNodesOnSelect:Or,elevateEdgesOnSelect:Lr,minZoom:ue,maxZoom:ge,nodeExtent:$e,onNodesChange:ss,onEdgesChange:Xn,snapToGrid:pe,snapGrid:_e,connectionMode:V,translateExtent:Ne,connectOnClick:qc,defaultEdgeOptions:va,fitView:ll,fitViewOptions:us,onNodesDelete:R,onEdgesDelete:B,onDelete:U,onNodeDragStart:q,onNodeDrag:j,onNodeDragStop:H,onSelectionDrag:F,onSelectionDragStart:I,onSelectionDragStop:L,onMove:m,onMoveStart:p,onMoveEnd:y,noPanClassName:or,nodeOrigin:Ot,rfId:bi,autoPanOnConnect:Br,autoPanOnNodeDrag:wt,autoPanSpeed:fs,onError:Ir,connectionRadius:ds,isValidConnection:sr,selectNodesOnDrag:Te,nodeDragThreshold:hs,connectionDragThreshold:Vc,onBeforeDelete:D,debug:$c,ariaLabelConfig:ms,zIndexMode:vi}),b.jsx(eM,{onSelectionChange:W}),rs,b.jsx(Qz,{proOptions:xi,position:cs}),b.jsx(Xz,{rfId:bi,disableKeyboardA11y:Hr})]})})}var Tj=LS(Cj);const Aj=e=>{var n;return(n=e.domNode)==null?void 0:n.querySelector(".react-flow__edgelabel-renderer")};function zj({children:e}){const n=Ve(Aj);return n?Uz.createPortal(e,n):null}function Mj(e){const[n,r]=$.useState(e),l=$.useCallback(a=>r(u=>RS(a,u)),[]);return[n,r,l]}function jj(e){const[n,r]=$.useState(e),l=$.useCallback(a=>r(u=>OS(a,u)),[]);return[n,r,l]}function Dj({dimensions:e,lineWidth:n,variant:r,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:At(["react-flow__background-pattern",r,l])})}function Rj({radius:e,className:n}){return b.jsx("circle",{cx:e,cy:e,r:e,className:At(["react-flow__background-pattern","dots",n])})}var zr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(zr||(zr={}));const Oj={[zr.Dots]:1,[zr.Lines]:1,[zr.Cross]:6},Lj=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function a_({id:e,variant:n=zr.Dots,gap:r=20,size:l,lineWidth:a=1,offset:u=0,color:s,bgColor:f,style:d,className:h,patternClassName:m}){const p=$.useRef(null),{transform:y,patternId:x}=Ve(Lj,ht),w=l||Oj[n],E=n===zr.Dots,_=n===zr.Cross,S=Array.isArray(r)?r:[r,r],T=[S[0]*y[2]||1,S[1]*y[2]||1],k=w*y[2],z=Array.isArray(u)?u:[u,u],M=_?[k,k]:T,A=[z[0]*y[2]||1+M[0]/2,z[1]*y[2]||1+M[1]/2],q=`${x}${e||""}`;return b.jsxs("svg",{className:At(["react-flow__background",h]),style:{...d,...Mc,"--xy-background-color-props":f,"--xy-background-pattern-color-props":s},ref:p,"data-testid":"rf__background",children:[b.jsx("pattern",{id:q,x:y[0]%T[0],y:y[1]%T[1],width:T[0],height:T[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${A[0]},-${A[1]})`,children:E?b.jsx(Rj,{radius:k/2,className:m}):b.jsx(Dj,{dimensions:M,lineWidth:a,variant:n,className:m})}),b.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${q})`})]})}a_.displayName="Background";const Hj=$.memo(a_);function Bj(){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 Ij(){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 qj(){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 Uj(){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 Vj(){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 Iu({children:e,className:n,...r}){return b.jsx("button",{type:"button",className:At(["react-flow__controls-button",n]),...r,children:e})}const $j=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function o_({style:e,showZoom:n=!0,showFitView:r=!0,showInteractive:l=!0,fitViewOptions:a,onZoomIn:u,onZoomOut:s,onFitView:f,onInteractiveChange:d,className:h,children:m,position:p="bottom-left",orientation:y="vertical","aria-label":x}){const w=pt(),{isInteractive:E,minZoomReached:_,maxZoomReached:S,ariaLabelConfig:T}=Ve($j,ht),{zoomIn:k,zoomOut:z,fitView:M}=Jo(),A=()=>{k(),u==null||u()},q=()=>{z(),s==null||s()},j=()=>{M(a),f==null||f()},H=()=>{w.setState({nodesDraggable:!E,nodesConnectable:!E,elementsSelectable:!E}),d==null||d(!E)},R=y==="horizontal"?"horizontal":"vertical";return b.jsxs(zc,{className:At(["react-flow__controls",R,h]),position:p,style:e,"data-testid":"rf__controls","aria-label":x??T["controls.ariaLabel"],children:[n&&b.jsxs(b.Fragment,{children:[b.jsx(Iu,{onClick:A,className:"react-flow__controls-zoomin",title:T["controls.zoomIn.ariaLabel"],"aria-label":T["controls.zoomIn.ariaLabel"],disabled:S,children:b.jsx(Bj,{})}),b.jsx(Iu,{onClick:q,className:"react-flow__controls-zoomout",title:T["controls.zoomOut.ariaLabel"],"aria-label":T["controls.zoomOut.ariaLabel"],disabled:_,children:b.jsx(Ij,{})})]}),r&&b.jsx(Iu,{className:"react-flow__controls-fitview",onClick:j,title:T["controls.fitView.ariaLabel"],"aria-label":T["controls.fitView.ariaLabel"],children:b.jsx(qj,{})}),l&&b.jsx(Iu,{className:"react-flow__controls-interactive",onClick:H,title:T["controls.interactive.ariaLabel"],"aria-label":T["controls.interactive.ariaLabel"],children:E?b.jsx(Vj,{}):b.jsx(Uj,{})}),m]})}o_.displayName="Controls";const Yj=$.memo(o_);function Fj({id:e,x:n,y:r,width:l,height:a,style:u,color:s,strokeColor:f,strokeWidth:d,className:h,borderRadius:m,shapeRendering:p,selected:y,onClick:x}){const{background:w,backgroundColor:E}=u||{},_=s||w||E;return b.jsx("rect",{className:At(["react-flow__minimap-node",{selected:y},h]),x:n,y:r,rx:m,ry:m,width:l,height:a,style:{fill:_,stroke:f,strokeWidth:d},shapeRendering:p,onClick:x?S=>x(S,e):void 0})}const Gj=$.memo(Fj),Pj=e=>e.nodes.map(n=>n.id),vh=e=>e instanceof Function?e:()=>e;function Xj({nodeStrokeColor:e,nodeColor:n,nodeClassName:r="",nodeBorderRadius:l=5,nodeStrokeWidth:a,nodeComponent:u=Gj,onClick:s}){const f=Ve(Pj,ht),d=vh(n),h=vh(e),m=vh(r),p=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return b.jsx(b.Fragment,{children:f.map(y=>b.jsx(Zj,{id:y,nodeColorFunc:d,nodeStrokeColorFunc:h,nodeClassNameFunc:m,nodeBorderRadius:l,nodeStrokeWidth:a,NodeComponent:u,onClick:s,shapeRendering:p},y))})}function Qj({id:e,nodeColorFunc:n,nodeStrokeColorFunc:r,nodeClassNameFunc:l,nodeBorderRadius:a,nodeStrokeWidth:u,shapeRendering:s,NodeComponent:f,onClick:d}){const{node:h,x:m,y:p,width:y,height:x}=Ve(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:T}=E.internals.positionAbsolute,{width:k,height:z}=jr(_);return{node:_,x:S,y:T,width:k,height:z}},ht);return!h||h.hidden||!uS(h)?null:b.jsx(f,{x:m,y:p,width:y,height:x,style:h.style,selected:!!h.selected,className:l(h),color:n(h),borderRadius:a,strokeColor:r(h),strokeWidth:u,shapeRendering:s,onClick:d,id:h.id})}const Zj=$.memo(Qj);var Kj=$.memo(Xj);const Jj=200,Wj=150,e4=e=>!e.hidden,t4=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?sS(Qo(e.nodeLookup,{filter:e4}),n):n,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},n4="react-flow__minimap-desc";function s_({style:e,className:n,nodeStrokeColor:r,nodeColor:l,nodeClassName:a="",nodeBorderRadius:u=5,nodeStrokeWidth:s,nodeComponent:f,bgColor:d,maskColor:h,maskStrokeColor:m,maskStrokeWidth:p,position:y="bottom-right",onClick:x,onNodeClick:w,pannable:E=!1,zoomable:_=!1,ariaLabel:S,inversePan:T,zoomStep:k=1,offsetScale:z=5}){const M=pt(),A=$.useRef(null),{boundingRect:q,viewBB:j,rfId:H,panZoom:R,translateExtent:B,flowWidth:U,flowHeight:W,ariaLabelConfig:I}=Ve(t4,ht),F=(e==null?void 0:e.width)??Jj,L=(e==null?void 0:e.height)??Wj,G=q.width/F,Z=q.height/L,J=Math.max(G,Z),D=J*F,V=J*L,P=z*J,N=q.x-(D-q.width)/2-P,Y=q.y-(V-q.height)/2-P,X=D+P*2,K=V+P*2,ne=`${n4}-${H}`,re=$.useRef(0),se=$.useRef();re.current=J,$.useEffect(()=>{if(A.current&&R)return se.current=pz({domNode:A.current,panZoom:R,getTransform:()=>M.getState().transform,getViewScale:()=>re.current}),()=>{var pe;(pe=se.current)==null||pe.destroy()}},[R]),$.useEffect(()=>{var pe;(pe=se.current)==null||pe.update({translateExtent:B,width:U,height:W,inversePan:T,pannable:E,zoomStep:k,zoomable:_})},[E,_,T,k,B,U,W]);const ye=x?pe=>{var Te;const[_e,Me]=((Te=se.current)==null?void 0:Te.pointer(pe))||[0,0];x(pe,{x:_e,y:Me})}:void 0,ve=w?$.useCallback((pe,_e)=>{const Me=M.getState().nodeLookup.get(_e).internals.userNode;w(pe,Me)},[]):void 0,xe=S??I["minimap.ariaLabel"];return b.jsx(zc,{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 r=="string"?r:void 0,"--xy-minimap-node-stroke-width-props":typeof s=="number"?s:void 0},className:At(["react-flow__minimap",n]),"data-testid":"rf__minimap",children:b.jsxs("svg",{width:F,height:L,viewBox:`${N} ${Y} ${X} ${K}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ne,ref:A,onClick:ye,children:[xe&&b.jsx("title",{id:ne,children:xe}),b.jsx(Kj,{onClick:ve,nodeColor:l,nodeStrokeColor:r,nodeBorderRadius:u,nodeClassName:a,nodeStrokeWidth:s,nodeComponent:f}),b.jsx("path",{className:"react-flow__minimap-mask",d:`M${N-P},${Y-P}h${X+P*2}v${K+P*2}h${-X-P*2}z + M${j.x},${j.y}h${j.width}v${j.height}h${-j.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}s_.displayName="MiniMap";const r4=$.memo(s_),i4=e=>n=>e?`${Math.max(1/n.transform[2],1)}`:void 0,l4={[ua.Line]:"right",[ua.Handle]:"bottom-right"};function a4({nodeId:e,position:n,variant:r=ua.Handle,className:l,style:a=void 0,children:u,color:s,minWidth:f=10,minHeight:d=10,maxWidth:h=Number.MAX_VALUE,maxHeight:m=Number.MAX_VALUE,keepAspectRatio:p=!1,resizeDirection:y,autoScale:x=!0,shouldResize:w,onResizeStart:E,onResize:_,onResizeEnd:S}){const T=qS(),k=typeof e=="string"?e:T,z=pt(),M=$.useRef(null),A=r===ua.Handle,q=Ve($.useCallback(i4(A&&x),[A,x]),ht),j=$.useRef(null),H=n??l4[r];$.useEffect(()=>{if(!(!M.current||!k))return j.current||(j.current=Tz({domNode:M.current,nodeId:k,getStoreItems:()=>{const{nodeLookup:B,transform:U,snapGrid:W,snapToGrid:I,nodeOrigin:F,domNode:L}=z.getState();return{nodeLookup:B,transform:U,snapGrid:W,snapToGrid:I,nodeOrigin:F,paneDomNode:L}},onChange:(B,U)=>{const{triggerNodeChanges:W,nodeLookup:I,parentLookup:F,nodeOrigin:L}=z.getState(),G=[],Z={x:B.x,y:B.y},J=I.get(k);if(J&&J.expandParent&&J.parentId){const D=J.origin??L,V=B.width??J.measured.width??0,P=B.height??J.measured.height??0,N={id:J.id,parentId:J.parentId,rect:{width:V,height:P,...cS({x:B.x??J.position.x,y:B.y??J.position.y},{width:V,height:P},J.parentId,I,D)}},Y=Cm([N],I,F,L);G.push(...Y),Z.x=B.x?Math.max(D[0]*V,B.x):void 0,Z.y=B.y?Math.max(D[1]*P,B.y):void 0}if(Z.x!==void 0&&Z.y!==void 0){const D={id:k,type:"position",position:{...Z}};G.push(D)}if(B.width!==void 0&&B.height!==void 0){const V={id:k,type:"dimensions",resizing:!0,setAttributes:y?y==="horizontal"?"width":"height":!0,dimensions:{width:B.width,height:B.height}};G.push(V)}for(const D of U){const V={...D,type:"position"};G.push(V)}W(G)},onEnd:({width:B,height:U})=>{const W={id:k,type:"dimensions",resizing:!1,dimensions:{width:B,height:U}};z.getState().triggerNodeChanges([W])}})),j.current.update({controlPosition:H,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()}},[H,f,d,h,m,p,E,_,S,w]);const R=H.split("-");return b.jsx("div",{className:At(["react-flow__resize-control","nodrag",...R,r,l]),ref:M,style:{...a,scale:q,...s&&{[A?"backgroundColor":"borderColor"]:s}},children:u})}$.memo(a4);var bh,o1;function Am(){if(o1)return bh;o1=1;var e="\0",n="\0",r="";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,x=this;return m.forEach(function(w){y.length>1?x.setNode(w,p):x.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=x=>p.removeEdge(p._edgeObjs[x]);delete this._nodes[m],this._isCompound&&(this._removeFromParentsChildList(m),delete this._parent[m],this.children(m).forEach(function(x){p.setParent(x)}),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 x=new Set(p);for(var y of this.successors(m))x.add(y);return Array.from(x.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 x={};function w(E){var _=y.parent(E);return _===void 0||p.hasNode(_)?(x[E]=_,_):_ in x?x[_]: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,x=arguments;return m.reduce(function(w,E){return x.length>1?y.setEdge(w,E,p):y.setEdge(w,E),E}),this}setEdge(){var m,p,y,x,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&&(x=arguments[1],w=!0)):(m=E,p=arguments[1],y=arguments[3],arguments.length>2&&(x=arguments[2],w=!0)),m=""+m,p=""+p,y!==void 0&&(y=""+y);var _=s(this._isDirected,m,p,y);if(Object.hasOwn(this._edgeLabels,_))return w&&(this._edgeLabels[_]=x),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?x: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,a(this._preds[p],m),a(this._sucs[m],p),this._in[p][_]=S,this._out[m][_]=S,this._edgeCount++,this}edge(m,p,y){var x=arguments.length===1?d(this._isDirected,arguments[0]):s(this._isDirected,m,p,y);return this._edgeLabels[x]}edgeAsObj(){const m=this.edge(...arguments);return typeof m!="object"?{label:m}:m}hasEdge(m,p,y){var x=arguments.length===1?d(this._isDirected,arguments[0]):s(this._isDirected,m,p,y);return Object.hasOwn(this._edgeLabels,x)}removeEdge(m,p,y){var x=arguments.length===1?d(this._isDirected,arguments[0]):s(this._isDirected,m,p,y),w=this._edgeObjs[x];return w&&(m=w.v,p=w.w,delete this._edgeLabels[x],delete this._edgeObjs[x],u(this._preds[p],m),u(this._sucs[m],p),delete this._in[p][x],delete this._out[m][x],this._edgeCount--),this}inEdges(m,p){var y=this._in[m];if(y){var x=Object.values(y);return p?x.filter(w=>w.v===p):x}}outEdges(m,p){var y=this._out[m];if(y){var x=Object.values(y);return p?x.filter(w=>w.w===p):x}}nodeEdges(m,p){var y=this.inEdges(m,p);if(y)return y.concat(this.outEdges(m,p))}}function a(h,m){h[m]?h[m]++:h[m]=1}function u(h,m){--h[m]||delete h[m]}function s(h,m,p,y){var x=""+m,w=""+p;if(!h&&x>w){var E=x;x=w,w=E}return x+r+w+r+(y===void 0?e:y)}function f(h,m,p,y){var x=""+m,w=""+p;if(!h&&x>w){var E=x;x=w,w=E}var _={v:x,w};return y&&(_.name=y),_}function d(h,m){return s(h,m.v,m.w,m.name)}return bh=l,bh}var wh,s1;function o4(){return s1||(s1=1,wh="2.2.4"),wh}var Sh,u1;function s4(){return u1||(u1=1,Sh={Graph:Am(),version:o4()}),Sh}var _h,c1;function u4(){if(c1)return _h;c1=1;var e=Am();_h={write:n,read:a};function n(u){var s={options:{directed:u.isDirected(),multigraph:u.isMultigraph(),compound:u.isCompound()},nodes:r(u),edges:l(u)};return u.graph()!==void 0&&(s.value=structuredClone(u.graph())),s}function r(u){return u.nodes().map(function(s){var f=u.node(s),d=u.parent(s),h={v:s};return f!==void 0&&(h.value=f),d!==void 0&&(h.parent=d),h})}function l(u){return u.edges().map(function(s){var f=u.edge(s),d={v:s.v,w:s.w};return s.name!==void 0&&(d.name=s.name),f!==void 0&&(d.value=f),d})}function a(u){var s=new e(u.options).setGraph(u.value);return u.nodes.forEach(function(f){s.setNode(f.v,f.value),f.parent&&s.setParent(f.v,f.parent)}),u.edges.forEach(function(f){s.setEdge({v:f.v,w:f.w,name:f.name},f.value)}),s}return _h}var Eh,f1;function c4(){if(f1)return Eh;f1=1,Eh=e;function e(n){var r={},l=[],a;function u(s){Object.hasOwn(r,s)||(r[s]=!0,a.push(s),n.successors(s).forEach(u),n.predecessors(s).forEach(u))}return n.nodes().forEach(function(s){a=[],u(s),a.length&&l.push(a)}),l}return Eh}var kh,d1;function u_(){if(d1)return kh;d1=1;class e{constructor(){Nt(this,"_arr",[]);Nt(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(r){return r.key})}has(r){return Object.hasOwn(this._keyIndices,r)}priority(r){var l=this._keyIndices[r];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(r,l){var a=this._keyIndices;if(r=String(r),!Object.hasOwn(a,r)){var u=this._arr,s=u.length;return a[r]=s,u.push({key:r,priority:l}),this._decrease(s),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key}decrease(r,l){var a=this._keyIndices[r];if(l>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[a].priority+" New: "+l);this._arr[a].priority=l,this._decrease(a)}_heapify(r){var l=this._arr,a=2*r,u=a+1,s=r;a>1,!(l[u].priority1;function r(a,u,s,f){return l(a,String(u),s||n,f||function(d){return a.outEdges(d)})}function l(a,u,s,f){var d={},h=new e,m,p,y=function(x){var w=x.v!==m?x.v:x.w,E=d[w],_=s(x),S=p.distance+_;if(_<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+x+" Weight: "+_);S0&&(m=h.removeMin(),p=d[m],p.distance!==Number.POSITIVE_INFINITY);)f(m).forEach(y);return d}return Nh}var Ch,p1;function f4(){if(p1)return Ch;p1=1;var e=c_();Ch=n;function n(r,l,a){return r.nodes().reduce(function(u,s){return u[s]=e(r,s,l,a),u},{})}return Ch}var Th,m1;function f_(){if(m1)return Th;m1=1,Th=e;function e(n){var r=0,l=[],a={},u=[];function s(f){var d=a[f]={onStack:!0,lowlink:r,index:r++};if(l.push(f),n.successors(f).forEach(function(p){Object.hasOwn(a,p)?a[p].onStack&&(d.lowlink=Math.min(d.lowlink,a[p].index)):(s(p),d.lowlink=Math.min(d.lowlink,a[p].lowlink))}),d.lowlink===d.index){var h=[],m;do m=l.pop(),a[m].onStack=!1,h.push(m);while(f!==m);u.push(h)}}return n.nodes().forEach(function(f){Object.hasOwn(a,f)||s(f)}),u}return Th}var Ah,g1;function d4(){if(g1)return Ah;g1=1;var e=f_();Ah=n;function n(r){return e(r).filter(function(l){return l.length>1||l.length===1&&r.hasEdge(l[0],l[0])})}return Ah}var zh,y1;function h4(){if(y1)return zh;y1=1,zh=n;var e=()=>1;function n(l,a,u){return r(l,a||e,u||function(s){return l.outEdges(s)})}function r(l,a,u){var s={},f=l.nodes();return f.forEach(function(d){s[d]={},s[d][d]={distance:0},f.forEach(function(h){d!==h&&(s[d][h]={distance:Number.POSITIVE_INFINITY})}),u(d).forEach(function(h){var m=h.v===d?h.w:h.v,p=a(h);s[d][m]={distance:p,predecessor:d}})}),f.forEach(function(d){var h=s[d];f.forEach(function(m){var p=s[m];f.forEach(function(y){var x=p[d],w=h[y],E=p[y],_=x.distance+w.distance;_a.successors(p):p=>a.neighbors(p),d=s==="post"?n:r,h=[],m={};return u.forEach(p=>{if(!a.hasNode(p))throw new Error("Graph does not have node: "+p);d(p,f,m,h)}),h}function n(a,u,s,f){for(var d=[[a,!1]];d.length>0;){var h=d.pop();h[1]?f.push(h[0]):Object.hasOwn(s,h[0])||(s[h[0]]=!0,d.push([h[0],!0]),l(u(h[0]),m=>d.push([m,!1])))}}function r(a,u,s,f){for(var d=[a];d.length>0;){var h=d.pop();Object.hasOwn(s,h)||(s[h]=!0,f.push(h),l(u(h),m=>d.push(m)))}}function l(a,u){for(var s=a.length;s--;)u(a[s],s,a);return a}return Dh}var Rh,w1;function m4(){if(w1)return Rh;w1=1;var e=h_();Rh=n;function n(r,l){return e(r,l,"post")}return Rh}var Oh,S1;function g4(){if(S1)return Oh;S1=1;var e=h_();Oh=n;function n(r,l){return e(r,l,"pre")}return Oh}var Lh,_1;function y4(){if(_1)return Lh;_1=1;var e=Am(),n=u_();Lh=r;function r(l,a){var u=new e,s={},f=new n,d;function h(p){var y=p.v===d?p.w:p.v,x=f.priority(y);if(x!==void 0){var w=a(p);w0;){if(d=f.removeMin(),Object.hasOwn(s,d))u.setEdge(d,s[d]);else{if(m)throw new Error("Input graph is not connected: "+l);m=!0}l.nodeEdges(d).forEach(h)}return u}return Lh}var Hh,E1;function x4(){return E1||(E1=1,Hh={components:c4(),dijkstra:c_(),dijkstraAll:f4(),findCycles:d4(),floydWarshall:h4(),isAcyclic:p4(),postorder:m4(),preorder:g4(),prim:y4(),tarjan:f_(),topsort:d_()}),Hh}var Bh,k1;function Fn(){if(k1)return Bh;k1=1;var e=s4();return Bh={Graph:e.Graph,json:u4(),alg:x4(),version:e.version},Bh}var Ih,N1;function v4(){if(N1)return Ih;N1=1;class e{constructor(){let a={};a._next=a._prev=a,this._sentinel=a}dequeue(){let a=this._sentinel,u=a._prev;if(u!==a)return n(u),u}enqueue(a){let u=this._sentinel;a._prev&&a._next&&n(a),a._next=u._next,u._next._prev=a,u._next=a,a._prev=u}toString(){let a=[],u=this._sentinel,s=u._prev;for(;s!==u;)a.push(JSON.stringify(s,r)),s=s._prev;return"["+a.join(", ")+"]"}}function n(l){l._prev._next=l._next,l._next._prev=l._prev,delete l._next,delete l._prev}function r(l,a){if(l!=="_next"&&l!=="_prev")return a}return Ih=e,Ih}var qh,C1;function b4(){if(C1)return qh;C1=1;let e=Fn().Graph,n=v4();qh=l;let r=()=>1;function l(h,m){if(h.nodeCount()<=1)return[];let p=s(h,m||r);return a(p.graph,p.buckets,p.zeroIdx).flatMap(x=>h.outEdges(x.v,x.w))}function a(h,m,p){let y=[],x=m[m.length-1],w=m[0],E;for(;h.nodeCount();){for(;E=w.dequeue();)u(h,m,p,E);for(;E=x.dequeue();)u(h,m,p,E);if(h.nodeCount()){for(let _=m.length-2;_>0;--_)if(E=m[_].dequeue(),E){y=y.concat(u(h,m,p,E,!0));break}}}return y}function u(h,m,p,y,x){let w=x?[]:void 0;return h.inEdges(y.v).forEach(E=>{let _=h.edge(E),S=h.node(E.v);x&&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,T=h.node(S);T.in-=_,f(m,p,T)}),h.removeNode(y.v),w}function s(h,m){let p=new e,y=0,x=0;h.nodes().forEach(_=>{p.setNode(_,{v:_,in:0,out:0})}),h.edges().forEach(_=>{let S=p.edge(_.v,_.w)||0,T=m(_),k=S+T;p.setEdge(_.v,_.w,k),x=Math.max(x,p.node(_.v).out+=T),y=Math.max(y,p.node(_.w).in+=T)});let w=d(x+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;pH.setNode(R,j.node(R))),j.edges().forEach(R=>{let B=H.edge(R.v,R.w)||{weight:0,minlen:1},U=j.edge(R);H.setEdge(R.v,R.w,{weight:B.weight+U.weight,minlen:Math.max(B.minlen,U.minlen)})}),H}function l(j){let H=new e({multigraph:j.isMultigraph()}).setGraph(j.graph());return j.nodes().forEach(R=>{j.children(R).length||H.setNode(R,j.node(R))}),j.edges().forEach(R=>{H.setEdge(R,j.edge(R))}),H}function a(j){let H=j.nodes().map(R=>{let B={};return j.outEdges(R).forEach(U=>{B[U.w]=(B[U.w]||0)+j.edge(U).weight}),B});return q(j.nodes(),H)}function u(j){let H=j.nodes().map(R=>{let B={};return j.inEdges(R).forEach(U=>{B[U.v]=(B[U.v]||0)+j.edge(U).weight}),B});return q(j.nodes(),H)}function s(j,H){let R=j.x,B=j.y,U=H.x-R,W=H.y-B,I=j.width/2,F=j.height/2;if(!U&&!W)throw new Error("Not possible to find intersection inside of the rectangle");let L,G;return Math.abs(W)*I>Math.abs(U)*F?(W<0&&(F=-F),L=F*U/W,G=F):(U<0&&(I=-I),L=I,G=I*W/U),{x:R+L,y:B+G}}function f(j){let H=z(w(j)+1).map(()=>[]);return j.nodes().forEach(R=>{let B=j.node(R),U=B.rank;U!==void 0&&(H[U][B.order]=R)}),H}function d(j){let H=j.nodes().map(B=>{let U=j.node(B).rank;return U===void 0?Number.MAX_VALUE:U}),R=x(Math.min,H);j.nodes().forEach(B=>{let U=j.node(B);Object.hasOwn(U,"rank")&&(U.rank-=R)})}function h(j){let H=j.nodes().map(I=>j.node(I).rank),R=x(Math.min,H),B=[];j.nodes().forEach(I=>{let F=j.node(I).rank-R;B[F]||(B[F]=[]),B[F].push(I)});let U=0,W=j.graph().nodeRankFactor;Array.from(B).forEach((I,F)=>{I===void 0&&F%W!==0?--U:I!==void 0&&U&&I.forEach(L=>j.node(L).rank+=U)})}function m(j,H,R,B){let U={width:0,height:0};return arguments.length>=4&&(U.rank=R,U.order=B),n(j,"border",U,H)}function p(j,H=y){const R=[];for(let B=0;By){const R=p(H);return j.apply(null,R.map(B=>j.apply(null,B)))}else return j.apply(null,H)}function w(j){const R=j.nodes().map(B=>{let U=j.node(B).rank;return U===void 0?Number.MIN_VALUE:U});return x(Math.max,R)}function E(j,H){let R={lhs:[],rhs:[]};return j.forEach(B=>{H(B)?R.lhs.push(B):R.rhs.push(B)}),R}function _(j,H){let R=Date.now();try{return H()}finally{console.log(j+" time: "+(Date.now()-R)+"ms")}}function S(j,H){return H()}let T=0;function k(j){var H=++T;return j+(""+H)}function z(j,H,R=1){H==null&&(H=j,j=0);let B=W=>WHB[H]),Object.entries(j).reduce((B,[U,W])=>(B[U]=R(W,U),B),{})}function q(j,H){return j.reduce((R,B,U)=>(R[B]=H[U],R),{})}return Uh}var Vh,A1;function w4(){if(A1)return Vh;A1=1;let e=b4(),n=Tt().uniqueId;Vh={run:r,undo:a};function r(u){(u.graph().acyclicer==="greedy"?e(u,f(u)):l(u)).forEach(d=>{let h=u.edge(d);u.removeEdge(d),h.forwardName=d.name,h.reversed=!0,u.setEdge(d.w,d.v,h,n("rev"))});function f(d){return h=>d.edge(h).weight}}function l(u){let s=[],f={},d={};function h(m){Object.hasOwn(d,m)||(d[m]=!0,f[m]=!0,u.outEdges(m).forEach(p=>{Object.hasOwn(f,p.w)?s.push(p):h(p.w)}),delete f[m])}return u.nodes().forEach(h),s}function a(u){u.edges().forEach(s=>{let f=u.edge(s);if(f.reversed){u.removeEdge(s);let d=f.forwardName;delete f.reversed,delete f.forwardName,u.setEdge(s.w,s.v,f,d)}})}return Vh}var $h,z1;function S4(){if(z1)return $h;z1=1;let e=Tt();$h={run:n,undo:l};function n(a){a.graph().dummyChains=[],a.edges().forEach(u=>r(a,u))}function r(a,u){let s=u.v,f=a.node(s).rank,d=u.w,h=a.node(d).rank,m=u.name,p=a.edge(u),y=p.labelRank;if(h===f+1)return;a.removeEdge(u);let x,w,E;for(E=0,++f;f{let s=a.node(u),f=s.edgeLabel,d;for(a.setEdge(s.edgeObj,f);s.dummy;)d=a.successors(u)[0],a.removeNode(u),f.points.push({x:s.x,y:s.y}),s.dummy==="edge-label"&&(f.x=s.x,f.y=s.y,f.width=s.width,f.height=s.height),u=d,s=a.node(u)})}return $h}var Yh,M1;function dc(){if(M1)return Yh;M1=1;const{applyWithChunking:e}=Tt();Yh={longestPath:n,slack:r};function n(l){var a={};function u(s){var f=l.node(s);if(Object.hasOwn(a,s))return f.rank;a[s]=!0;let d=l.outEdges(s).map(m=>m==null?Number.POSITIVE_INFINITY:u(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(u)}function r(l,a){return l.node(a.w).rank-l.node(a.v).rank-l.edge(a).minlen}return Yh}var Fh,j1;function p_(){if(j1)return Fh;j1=1;var e=Fn().Graph,n=dc().slack;Fh=r;function r(s){var f=new e({directed:!1}),d=s.nodes()[0],h=s.nodeCount();f.setNode(d,{});for(var m,p;l(f,s){var p=m.v,y=h===p?m.w:p;!s.hasNode(y)&&!n(f,m)&&(s.setNode(y,{}),s.setEdge(h,y,{}),d(y))})}return s.nodes().forEach(d),s.nodeCount()}function a(s,f){return f.edges().reduce((h,m)=>{let p=Number.POSITIVE_INFINITY;return s.hasNode(m.v)!==s.hasNode(m.w)&&(p=n(f,m)),pf.node(h).rank+=d)}return Fh}var Gh,D1;function _4(){if(D1)return Gh;D1=1;var e=p_(),n=dc().slack,r=dc().longestPath,l=Fn().alg.preorder,a=Fn().alg.postorder,u=Tt().simplify;Gh=s,s.initLowLimValues=m,s.initCutValues=f,s.calcCutValue=h,s.leaveEdge=y,s.enterEdge=x,s.exchangeEdges=w;function s(T){T=u(T),r(T);var k=e(T);m(k),f(k,T);for(var z,M;z=y(k);)M=x(k,T,z),w(k,T,z,M)}function f(T,k){var z=a(T,T.nodes());z=z.slice(0,z.length-1),z.forEach(M=>d(T,k,M))}function d(T,k,z){var M=T.node(z),A=M.parent;T.edge(z,A).cutvalue=h(T,k,z)}function h(T,k,z){var M=T.node(z),A=M.parent,q=!0,j=k.edge(z,A),H=0;return j||(q=!1,j=k.edge(A,z)),H=j.weight,k.nodeEdges(z).forEach(R=>{var B=R.v===z,U=B?R.w:R.v;if(U!==A){var W=B===q,I=k.edge(R).weight;if(H+=W?I:-I,_(T,z,U)){var F=T.edge(z,U).cutvalue;H+=W?-F:F}}}),H}function m(T,k){arguments.length<2&&(k=T.nodes()[0]),p(T,{},1,k)}function p(T,k,z,M,A){var q=z,j=T.node(M);return k[M]=!0,T.neighbors(M).forEach(H=>{Object.hasOwn(k,H)||(z=p(T,k,z,H,M))}),j.low=q,j.lim=z++,A?j.parent=A:delete j.parent,z}function y(T){return T.edges().find(k=>T.edge(k).cutvalue<0)}function x(T,k,z){var M=z.v,A=z.w;k.hasEdge(M,A)||(M=z.w,A=z.v);var q=T.node(M),j=T.node(A),H=q,R=!1;q.lim>j.lim&&(H=j,R=!0);var B=k.edges().filter(U=>R===S(T,T.node(U.v),H)&&R!==S(T,T.node(U.w),H));return B.reduce((U,W)=>n(k,W)!k.node(A).parent),M=l(T,z);M=M.slice(1),M.forEach(A=>{var q=T.node(A).parent,j=k.edge(A,q),H=!1;j||(j=k.edge(q,A),H=!0),k.node(A).rank=k.node(q).rank+(H?j.minlen:-j.minlen)})}function _(T,k,z){return T.hasEdge(k,z)}function S(T,k,z){return z.low<=k.lim&&k.lim<=z.lim}return Gh}var Ph,R1;function E4(){if(R1)return Ph;R1=1;var e=dc(),n=e.longestPath,r=p_(),l=_4();Ph=a;function a(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":s(d);break;case"longest-path":u(d);break;case"none":break;default:f(d)}}var u=n;function s(d){n(d),r(d)}function f(d){l(d)}return Ph}var Xh,O1;function k4(){if(O1)return Xh;O1=1,Xh=e;function e(l){let a=r(l);l.graph().dummyChains.forEach(u=>{let s=l.node(u),f=s.edgeObj,d=n(l,a,f.v,f.w),h=d.path,m=d.lca,p=0,y=h[p],x=!0;for(;u!==f.w;){if(s=l.node(u),x){for(;(y=h[p])!==m&&l.node(y).maxRankh||m>a[p].lim));for(y=p,p=s;(p=l.parent(p))!==y;)d.push(p);return{path:f.concat(d.reverse()),lca:y}}function r(l){let a={},u=0;function s(f){let d=u;l.children(f).forEach(s),a[f]={low:d,lim:u++}}return l.children().forEach(s),a}return Xh}var Qh,L1;function N4(){if(L1)return Qh;L1=1;let e=Tt();Qh={run:n,cleanup:u};function n(s){let f=e.addDummyNode(s,"root",{},"_root"),d=l(s),h=Object.values(d),m=e.applyWithChunking(Math.max,h)-1,p=2*m+1;s.graph().nestingRoot=f,s.edges().forEach(x=>s.edge(x).minlen*=p);let y=a(s)+1;s.children().forEach(x=>r(s,f,p,y,m,d,x)),s.graph().nodeRankFactor=p}function r(s,f,d,h,m,p,y){let x=s.children(y);if(!x.length){y!==f&&s.setEdge(f,y,{weight:0,minlen:d});return}let w=e.addBorderNode(s,"_bt"),E=e.addBorderNode(s,"_bb"),_=s.node(y);s.setParent(w,y),_.borderTop=w,s.setParent(E,y),_.borderBottom=E,x.forEach(S=>{r(s,f,d,h,m,p,S);let T=s.node(S),k=T.borderTop?T.borderTop:S,z=T.borderBottom?T.borderBottom:S,M=T.borderTop?h:2*h,A=k!==z?1:m-p[y]+1;s.setEdge(w,k,{weight:M,minlen:A,nestingEdge:!0}),s.setEdge(z,E,{weight:M,minlen:A,nestingEdge:!0})}),s.parent(y)||s.setEdge(f,w,{weight:0,minlen:m+p[y]})}function l(s){var f={};function d(h,m){var p=s.children(h);p&&p.length&&p.forEach(y=>d(y,m+1)),f[h]=m}return s.children().forEach(h=>d(h,1)),f}function a(s){return s.edges().reduce((f,d)=>f+s.edge(d).weight,0)}function u(s){var f=s.graph();s.removeNode(f.nestingRoot),delete f.nestingRoot,s.edges().forEach(d=>{var h=s.edge(d);h.nestingEdge&&s.removeEdge(d)})}return Qh}var Zh,H1;function C4(){if(H1)return Zh;H1=1;let e=Tt();Zh=n;function n(l){function a(u){let s=l.children(u),f=l.node(u);if(s.length&&s.forEach(a),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 a(d){d.nodes().forEach(h=>u(d.node(h))),d.edges().forEach(h=>{let m=d.edge(h);m.points.forEach(u),Object.hasOwn(m,"y")&&u(m)})}function u(d){d.y=-d.y}function s(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 Kh}var Jh,I1;function A4(){if(I1)return Jh;I1=1;let e=Tt();Jh=n;function n(r){let l={},a=r.nodes().filter(m=>!r.children(m).length),u=a.map(m=>r.node(m).rank),s=e.applyWithChunking(Math.max,u),f=e.range(s+1).map(()=>[]);function d(m){if(l[m])return;l[m]=!0;let p=r.node(m);f[p.rank].push(m),r.successors(m).forEach(d)}return a.sort((m,p)=>r.node(m).rank-r.node(p).rank).forEach(d),f}return Jh}var Wh,q1;function z4(){if(q1)return Wh;q1=1;let e=Tt().zipObject;Wh=n;function n(l,a){let u=0;for(let s=1;sx)),f=a.flatMap(y=>l.outEdges(y).map(x=>({pos:s[x.w],weight:l.edge(x).weight})).sort((x,w)=>x.pos-w.pos)),d=1;for(;d{let x=y.pos+d;m[x]+=y.weight;let w=0;for(;x>0;)x%2&&(w+=m[x+1]),x=x-1>>1,m[x]+=y.weight;p+=y.weight*w}),p}return Wh}var ep,U1;function M4(){if(U1)return ep;U1=1,ep=e;function e(n,r=[]){return r.map(l=>{let a=n.inEdges(l);if(a.length){let u=a.reduce((s,f)=>{let d=n.edge(f),h=n.node(f.v);return{sum:s.sum+d.weight*h.order,weight:s.weight+d.weight}},{sum:0,weight:0});return{v:l,barycenter:u.sum/u.weight,weight:u.weight}}else return{v:l}})}return ep}var tp,V1;function j4(){if(V1)return tp;V1=1;let e=Tt();tp=n;function n(a,u){let s={};a.forEach((d,h)=>{let m=s[d.v]={indegree:0,in:[],out:[],vs:[d.v],i:h};d.barycenter!==void 0&&(m.barycenter=d.barycenter,m.weight=d.weight)}),u.edges().forEach(d=>{let h=s[d.v],m=s[d.w];h!==void 0&&m!==void 0&&(m.indegree++,h.out.push(s[d.w]))});let f=Object.values(s).filter(d=>!d.indegree);return r(f)}function r(a){let u=[];function s(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&&a.push(h)}}for(;a.length;){let d=a.pop();u.push(d),d.in.reverse().forEach(s(d)),d.out.forEach(f(d))}return u.filter(d=>!d.merged).map(d=>e.pick(d,["vs","i","barycenter","weight"]))}function l(a,u){let s=0,f=0;a.weight&&(s+=a.barycenter*a.weight,f+=a.weight),u.weight&&(s+=u.barycenter*u.weight,f+=u.weight),a.vs=u.vs.concat(a.vs),a.barycenter=s/f,a.weight=f,a.i=Math.min(u.i,a.i),u.merged=!0}return tp}var np,$1;function D4(){if($1)return np;$1=1;let e=Tt();np=n;function n(a,u){let s=e.partition(a,w=>Object.hasOwn(w,"barycenter")),f=s.lhs,d=s.rhs.sort((w,E)=>E.i-w.i),h=[],m=0,p=0,y=0;f.sort(l(!!u)),y=r(h,d,y),f.forEach(w=>{y+=w.vs.length,h.push(w.vs),m+=w.barycenter*w.weight,p+=w.weight,y=r(h,d,y)});let x={vs:h.flat(!0)};return p&&(x.barycenter=m/p,x.weight=p),x}function r(a,u,s){let f;for(;u.length&&(f=u[u.length-1]).i<=s;)u.pop(),a.push(f.vs),s++;return s}function l(a){return(u,s)=>u.barycenters.barycenter?1:a?s.i-u.i:u.i-s.i}return np}var rp,Y1;function R4(){if(Y1)return rp;Y1=1;let e=M4(),n=j4(),r=D4();rp=l;function l(s,f,d,h){let m=s.children(f),p=s.node(f),y=p?p.borderLeft:void 0,x=p?p.borderRight:void 0,w={};y&&(m=m.filter(T=>T!==y&&T!==x));let E=e(s,m);E.forEach(T=>{if(s.children(T.v).length){let k=l(s,T.v,d,h);w[T.v]=k,Object.hasOwn(k,"barycenter")&&u(T,k)}});let _=n(E,d);a(_,w);let S=r(_,h);if(y&&(S.vs=[y,S.vs,x].flat(!0),s.predecessors(y).length)){let T=s.node(s.predecessors(y)[0]),k=s.node(s.predecessors(x)[0]);Object.hasOwn(S,"barycenter")||(S.barycenter=0,S.weight=0),S.barycenter=(S.barycenter*S.weight+T.order+k.order)/(S.weight+2),S.weight+=2}return S}function a(s,f){s.forEach(d=>{d.vs=d.vs.flatMap(h=>f[h]?f[h].vs:h)})}function u(s,f){s.barycenter!==void 0?(s.barycenter=(s.barycenter*s.weight+f.barycenter*f.weight)/(s.weight+f.weight),s.weight+=f.weight):(s.barycenter=f.barycenter,s.weight=f.weight)}return rp}var ip,F1;function O4(){if(F1)return ip;F1=1;let e=Fn().Graph,n=Tt();ip=r;function r(a,u,s,f){f||(f=a.nodes());let d=l(a),h=new e({compound:!0}).setGraph({root:d}).setDefaultNodeLabel(m=>a.node(m));return f.forEach(m=>{let p=a.node(m),y=a.parent(m);(p.rank===u||p.minRank<=u&&u<=p.maxRank)&&(h.setNode(m),h.setParent(m,y||d),a[s](m).forEach(x=>{let w=x.v===m?x.w:x.v,E=h.edge(w,m),_=E!==void 0?E.weight:0;h.setEdge(w,m,{weight:a.edge(x).weight+_})}),Object.hasOwn(p,"minRank")&&h.setNode(m,{borderLeft:p.borderLeft[u],borderRight:p.borderRight[u]}))}),h}function l(a){for(var u;a.hasNode(u=n.uniqueId("_root")););return u}return ip}var lp,G1;function L4(){if(G1)return lp;G1=1,lp=e;function e(n,r,l){let a={},u;l.forEach(s=>{let f=n.parent(s),d,h;for(;f;){if(d=n.parent(f),d?(h=a[d],a[d]=f):(h=u,u=f),h&&h!==f){r.setEdge(h,f);return}f=d}})}return lp}var ap,P1;function H4(){if(P1)return ap;P1=1;let e=A4(),n=z4(),r=R4(),l=O4(),a=L4(),u=Fn().Graph,s=Tt();ap=f;function f(p,y){if(y&&typeof y.customOrder=="function"){y.customOrder(p,f);return}let x=s.maxRank(p),w=d(p,s.range(1,x+1),"inEdges"),E=d(p,s.range(x-1,-1,-1),"outEdges"),_=e(p);if(m(p,_),y&&y.disableOptimalOrderHeuristic)return;let S=Number.POSITIVE_INFINITY,T;for(let k=0,z=0;z<4;++k,++z){h(k%2?w:E,k%4>=2),_=s.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 T=S.minRank;T<=S.maxRank;T++)T!==S.rank&&E(T,_)}return y.map(function(_){return l(p,_,x,w.get(_)||[])})}function h(p,y){let x=new u;p.forEach(function(w){let E=w.graph().root,_=r(w,E,x,y);_.vs.forEach((S,T)=>w.node(S).order=T),a(w,x,_.vs)})}function m(p,y){Object.values(y).forEach(x=>x.forEach((w,E)=>p.node(w).order=E))}return ap}var op,X1;function B4(){if(X1)return op;X1=1;let e=Fn().Graph,n=Tt();op={positionX:x,findType1Conflicts:r,findType2Conflicts:l,addConflict:u,hasConflict:s,verticalAlignment:f,horizontalCompaction:d,alignCoordinates:p,findSmallestWidthAlignment:m,balance:y};function r(_,S){let T={};function k(z,M){let A=0,q=0,j=z.length,H=M[M.length-1];return M.forEach((R,B)=>{let U=a(_,R),W=U?_.node(U).order:j;(U||R===H)&&(M.slice(q,B+1).forEach(I=>{_.predecessors(I).forEach(F=>{let L=_.node(F),G=L.order;(G{R=M[B],_.node(R).dummy&&_.predecessors(R).forEach(U=>{let W=_.node(U);W.dummy&&(W.orderH)&&u(T,U,R)})})}function z(M,A){let q=-1,j,H=0;return A.forEach((R,B)=>{if(_.node(R).dummy==="border"){let U=_.predecessors(R);U.length&&(j=_.node(U[0]).order,k(A,H,B,q,j),H=B,q=j)}k(A,H,A.length,j,M.length)}),A}return S.length&&S.reduce(z),T}function a(_,S){if(_.node(S).dummy)return _.predecessors(S).find(T=>_.node(T).dummy)}function u(_,S,T){if(S>T){let z=S;S=T,T=z}let k=_[S];k||(_[S]=k={}),k[T]=!0}function s(_,S,T){if(S>T){let k=S;S=T,T=k}return!!_[S]&&Object.hasOwn(_[S],T)}function f(_,S,T,k){let z={},M={},A={};return S.forEach(q=>{q.forEach((j,H)=>{z[j]=j,M[j]=j,A[j]=H})}),S.forEach(q=>{let j=-1;q.forEach(H=>{let R=k(H);if(R.length){R=R.sort((U,W)=>A[U]-A[W]);let B=(R.length-1)/2;for(let U=Math.floor(B),W=Math.ceil(B);U<=W;++U){let I=R[U];M[H]===H&&jMath.max(U,M[W.v]+A.edge(W)),0)}function R(B){let U=A.outEdges(B).reduce((I,F)=>Math.min(I,M[F.w]-A.edge(F)),Number.POSITIVE_INFINITY),W=_.node(B);U!==Number.POSITIVE_INFINITY&&W.borderType!==q&&(M[B]=Math.max(M[B],U))}return j(H,A.predecessors.bind(A)),j(R,A.successors.bind(A)),Object.keys(k).forEach(B=>M[B]=M[T[B]]),M}function h(_,S,T,k){let z=new e,M=_.graph(),A=w(M.nodesep,M.edgesep,k);return S.forEach(q=>{let j;q.forEach(H=>{let R=T[H];if(z.setNode(R),j){var B=T[j],U=z.edge(B,R);z.setEdge(B,R,Math.max(A(_,H,j),U||0))}j=H})}),z}function m(_,S){return Object.values(S).reduce((T,k)=>{let z=Number.NEGATIVE_INFINITY,M=Number.POSITIVE_INFINITY;Object.entries(k).forEach(([q,j])=>{let H=E(_,q)/2;z=Math.max(j+H,z),M=Math.min(j-H,M)});const A=z-M;return A{["l","r"].forEach(A=>{let q=M+A,j=_[q];if(j===S)return;let H=Object.values(j),R=k-n.applyWithChunking(Math.min,H);A!=="l"&&(R=z-n.applyWithChunking(Math.max,H)),R&&(_[q]=n.mapValues(j,B=>B+R))})})}function y(_,S){return n.mapValues(_.ul,(T,k)=>{if(S)return _[S.toLowerCase()][k];{let z=Object.values(_).map(M=>M[k]).sort((M,A)=>M-A);return(z[1]+z[2])/2}})}function x(_){let S=n.buildLayerMatrix(_),T=Object.assign(r(_,S),l(_,S)),k={},z;["u","d"].forEach(A=>{z=A==="u"?S:Object.values(S).reverse(),["l","r"].forEach(q=>{q==="r"&&(z=z.map(B=>Object.values(B).reverse()));let j=(A==="u"?_.predecessors:_.successors).bind(_),H=f(_,z,T,j),R=d(_,z,H.root,H.align,q==="r");q==="r"&&(R=n.mapValues(R,B=>-B)),k[A+q]=R})});let M=m(_,k);return p(k,M),y(k,_.graph().align)}function w(_,S,T){return(k,z,M)=>{let A=k.node(z),q=k.node(M),j=0,H;if(j+=A.width/2,Object.hasOwn(A,"labelpos"))switch(A.labelpos.toLowerCase()){case"l":H=-A.width/2;break;case"r":H=A.width/2;break}if(H&&(j+=T?H:-H),H=0,j+=(A.dummy?S:_)/2,j+=(q.dummy?S:_)/2,j+=q.width/2,Object.hasOwn(q,"labelpos"))switch(q.labelpos.toLowerCase()){case"l":H=q.width/2;break;case"r":H=-q.width/2;break}return H&&(j+=T?H:-H),H=0,j}}function E(_,S){return _.node(S).width}return op}var sp,Q1;function I4(){if(Q1)return sp;Q1=1;let e=Tt(),n=B4().positionX;sp=r;function r(a){a=e.asNonCompoundGraph(a),l(a),Object.entries(n(a)).forEach(([u,s])=>a.node(u).x=s)}function l(a){let u=e.buildLayerMatrix(a),s=a.graph().ranksep,f=0;u.forEach(d=>{const h=d.reduce((m,p)=>{const y=a.node(p).height;return m>y?m:y},0);d.forEach(m=>a.node(m).y=f+h/2),f+=h+s})}return sp}var up,Z1;function q4(){if(Z1)return up;Z1=1;let e=w4(),n=S4(),r=E4(),l=Tt().normalizeRanks,a=k4(),u=Tt().removeEmptyRanks,s=N4(),f=C4(),d=T4(),h=H4(),m=I4(),p=Tt(),y=Fn().Graph;up=x;function x(N,Y){let X=Y&&Y.debugTiming?p.time:p.notime;X("layout",()=>{let K=X(" buildLayoutGraph",()=>j(N));X(" runLayout",()=>w(K,X,Y)),X(" updateInputGraph",()=>E(N,K))})}function w(N,Y,X){Y(" makeSpaceForEdgeLabels",()=>H(N)),Y(" removeSelfEdges",()=>Z(N)),Y(" acyclic",()=>e.run(N)),Y(" nestingGraph.run",()=>s.run(N)),Y(" rank",()=>r(p.asNonCompoundGraph(N))),Y(" injectEdgeLabelProxies",()=>R(N)),Y(" removeEmptyRanks",()=>u(N)),Y(" nestingGraph.cleanup",()=>s.cleanup(N)),Y(" normalizeRanks",()=>l(N)),Y(" assignRankMinMax",()=>B(N)),Y(" removeEdgeLabelProxies",()=>U(N)),Y(" normalize.run",()=>n.run(N)),Y(" parentDummyChains",()=>a(N)),Y(" addBorderSegments",()=>f(N)),Y(" order",()=>h(N,X)),Y(" insertSelfEdges",()=>J(N)),Y(" adjustCoordinateSystem",()=>d.adjust(N)),Y(" position",()=>m(N)),Y(" positionSelfEdges",()=>D(N)),Y(" removeBorderNodes",()=>G(N)),Y(" normalize.undo",()=>n.undo(N)),Y(" fixupEdgeLabelCoords",()=>F(N)),Y(" undoCoordinateSystem",()=>d.undo(N)),Y(" translateGraph",()=>W(N)),Y(" assignNodeIntersects",()=>I(N)),Y(" reversePoints",()=>L(N)),Y(" acyclic.undo",()=>e.undo(N))}function E(N,Y){N.nodes().forEach(X=>{let K=N.node(X),ne=Y.node(X);K&&(K.x=ne.x,K.y=ne.y,K.rank=ne.rank,Y.children(X).length&&(K.width=ne.width,K.height=ne.height))}),N.edges().forEach(X=>{let K=N.edge(X),ne=Y.edge(X);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"},T=["acyclicer","ranker","rankdir","align"],k=["width","height","rank"],z={width:0,height:0},M=["minlen","weight","width","height","labeloffset"],A={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}),X=P(N.graph());return Y.setGraph(Object.assign({},S,V(X,_),p.pick(X,T))),N.nodes().forEach(K=>{let ne=P(N.node(K));const re=V(ne,k);Object.keys(z).forEach(se=>{re[se]===void 0&&(re[se]=z[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({},A,V(ne,M),p.pick(ne,q)))}),Y}function H(N){let Y=N.graph();Y.ranksep/=2,N.edges().forEach(X=>{let K=N.edge(X);K.minlen*=2,K.labelpos.toLowerCase()!=="c"&&(Y.rankdir==="TB"||Y.rankdir==="BT"?K.width+=K.labeloffset:K.height+=K.labeloffset)})}function R(N){N.edges().forEach(Y=>{let X=N.edge(Y);if(X.width&&X.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(X=>{let K=N.node(X);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 U(N){N.nodes().forEach(Y=>{let X=N.node(Y);X.dummy==="edge-proxy"&&(N.edge(X.e).labelRank=X.rank,N.removeNode(Y))})}function W(N){let Y=Number.POSITIVE_INFINITY,X=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,Te=xe.height;Y=Math.min(Y,pe-Me/2),X=Math.max(X,pe+Me/2),K=Math.min(K,_e-Te/2),ne=Math.max(ne,_e+Te/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=X-Y+se,re.height=ne-K+ye}function I(N){N.edges().forEach(Y=>{let X=N.edge(Y),K=N.node(Y.v),ne=N.node(Y.w),re,se;X.points?(re=X.points[0],se=X.points[X.points.length-1]):(X.points=[],re=ne,se=K),X.points.unshift(p.intersectRect(K,re)),X.points.push(p.intersectRect(ne,se))})}function F(N){N.edges().forEach(Y=>{let X=N.edge(Y);if(Object.hasOwn(X,"x"))switch((X.labelpos==="l"||X.labelpos==="r")&&(X.width-=X.labeloffset),X.labelpos){case"l":X.x-=X.width/2+X.labeloffset;break;case"r":X.x+=X.width/2+X.labeloffset;break}})}function L(N){N.edges().forEach(Y=>{let X=N.edge(Y);X.reversed&&X.points.reverse()})}function G(N){N.nodes().forEach(Y=>{if(N.children(Y).length){let X=N.node(Y),K=N.node(X.borderTop),ne=N.node(X.borderBottom),re=N.node(X.borderLeft[X.borderLeft.length-1]),se=N.node(X.borderRight[X.borderRight.length-1]);X.width=Math.abs(se.x-re.x),X.height=Math.abs(ne.y-K.y),X.x=re.x+X.width/2,X.y=K.y+X.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 X=N.node(Y.v);X.selfEdges||(X.selfEdges=[]),X.selfEdges.push({e:Y,label:N.edge(Y)}),N.removeEdge(Y)}})}function J(N){var Y=p.buildLayerMatrix(N);Y.forEach(X=>{var K=0;X.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 D(N){N.nodes().forEach(Y=>{var X=N.node(Y);if(X.dummy==="selfedge"){var K=N.node(X.e.v),ne=K.x+K.width/2,re=K.y,se=X.x-ne,ye=K.height/2;N.setEdge(X.e,X.label),N.removeNode(Y),X.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}],X.label.x=X.x,X.label.y=X.y}})}function V(N,Y){return p.mapValues(p.pick(N,Y),Number)}function P(N){var Y={};return N&&Object.entries(N).forEach(([X,K])=>{typeof X=="string"&&(X=X.toLowerCase()),Y[X]=K}),Y}return up}var cp,K1;function U4(){if(K1)return cp;K1=1;let e=Tt(),n=Fn().Graph;cp={debugOrdering:r};function r(l){let a=e.buildLayerMatrix(l),u=new n({compound:!0,multigraph:!0}).setGraph({});return l.nodes().forEach(s=>{u.setNode(s,{label:s}),u.setParent(s,"layer"+l.node(s).rank)}),l.edges().forEach(s=>u.setEdge(s.v,s.w,{},s.name)),a.forEach((s,f)=>{let d="layer"+f;u.setNode(d,{rank:"same"}),s.reduce((h,m)=>(u.setEdge(h,m,{style:"invis"}),m))}),u}return cp}var fp,J1;function V4(){return J1||(J1=1,fp="1.1.8"),fp}var dp,W1;function $4(){return W1||(W1=1,dp={graphlib:Fn(),layout:q4(),debug:U4(),util:{time:Tt().time,notime:Tt().notime},version:V4()}),dp}var Y4=$4();const eb=Yo(Y4),ko=200,Zl=56,tb=20,nb=40,F4=20,rb=12;function G4(e,n,r,l,a,u,s){const f=[],d=[],h=new Set,m=new Set,p=new Map;for(const x of r)for(const w of x.agents)m.add(w),p.set(w,x.name);for(const x of r){const w=a[x.name],E=x.agents.length,_=ko+tb*2,S=nb+E*Zl+(E-1)*rb+F4;f.push({id:x.name,type:"groupNode",position:{x:0,y:0},data:{label:x.name,type:"parallel_group",status:(w==null?void 0:w.status)||"pending",groupName:x.name,progress:u[x.name]},style:{width:_,height:S}});for(let T=0;T$entryPoint",source:"$start",target:s,type:"animatedEdge",data:{},animated:!1})}for(const x of n)d.push({id:`${x.from}->${x.to}`,source:x.from,target:x.to,type:"animatedEdge",data:{when:x.when},animated:!1});return P4(f,d),{nodes:f,edges:d}}function P4(e,n){var l,a,u,s;const r=new eb.graphlib.Graph;r.setDefaultEdgeLabel(()=>({})),r.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)||ko,m=d&&((a=f.style)==null?void 0:a.height)||Zl;r.setNode(f.id,{width:h,height:m})}for(const f of n)r.hasNode(f.source)&&r.hasNode(f.target)&&r.setEdge(f.source,f.target);eb.layout(r);for(const f of e){if(f.parentId)continue;const d=r.node(f.id);if(!d)continue;const h=f.type==="groupNode",m=h&&((u=f.style)==null?void 0:u.width)||ko,p=h&&((s=f.style)==null?void 0:s.height)||Zl;f.position={x:d.x-m/2,y:d.y-p/2}}}const at={pending:"#6b7280",running:"#3b82f6",completed:"#22c55e",failed:"#ef4444",paused:"#f59e0b",idle:"#6b7280",waiting:"#a855f7"},X4=70,ib=90;function zm({data:e,children:n}){const[r,l]=$.useState(!1),a=$.useRef(null),u=$.useCallback(()=>{a.current=setTimeout(()=>l(!0),200)},[]),s=$.useCallback(()=>{a.current&&clearTimeout(a.current),l(!1)},[]),f=at[e.status]||at.pending;return b.jsxs("div",{className:"relative",onMouseEnter:u,onMouseLeave:s,children:[n,r&&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:on(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:[tr(e.tokens),e.inputTokens!=null&&e.outputTokens!=null&&b.jsxs("span",{className:"text-[var(--text-muted)]",children:[" ","(",tr(e.inputTokens),"↑ ",tr(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:na(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 Q4=$.memo(function({data:n,id:r,selected:l}){const a=n,s=he(M=>{var A;return(A=M.nodes[r])==null?void 0:A.status})||a.status||"pending",f=at[s]||at.pending,d=he(M=>{var A;return(A=M.nodes[r])==null?void 0:A.elapsed}),h=he(M=>{var A;return(A=M.nodes[r])==null?void 0:A.model}),m=he(M=>{var A;return(A=M.nodes[r])==null?void 0:A.tokens}),p=he(M=>{var A;return(A=M.nodes[r])==null?void 0:A.input_tokens}),y=he(M=>{var A;return(A=M.nodes[r])==null?void 0:A.output_tokens}),x=he(M=>{var A;return(A=M.nodes[r])==null?void 0:A.cost_usd}),w=he(M=>{var A;return(A=M.nodes[r])==null?void 0:A.iteration}),E=he(M=>{var A;return(A=M.nodes[r])==null?void 0:A.error_type}),_=he(M=>{var A;return(A=M.nodes[r])==null?void 0:A.error_message}),S=he(M=>{var A;return(A=M.nodes[r])==null?void 0:A.context_pct}),T=Z4(r,s),k=K4(s),z=(()=>{if(s==="failed"&&_)return{text:_.length>40?_.slice(0,37)+"...":_,className:"text-red-400"};if(s==="running")return{text:T,className:"text-[var(--text-muted)]"};if(s==="completed"){const M=[];return d!=null&&M.push(on(d)),m!=null&&M.push(`${tr(m)} tok`),x!=null&&M.push(na(x)),{text:M.join(" · ")||null,className:"text-[var(--text-muted)]"}}return{text:null,className:""}})();return b.jsxs(b.Fragment,{children:[b.jsx(sn,{type:"target",position:we.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx(zm,{data:{status:s,elapsed:d,model:h,tokens:m,inputTokens:p,outputTokens:y,costUsd:x,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)]",s==="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",s==="running"&&"animate-pulse"),style:{backgroundColor:`${f}20`},children:b.jsx(Yk,{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:a.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]})]}),z.text&&b.jsx("span",{className:Ye("text-[10px] truncate leading-tight",z.className),children:z.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>=ib?"animate-[context-pulse_2s_ease-in-out_infinite]":""),style:{width:`${Math.min(S,100)}%`,backgroundColor:S>=ib?"#ef4444":S>=X4?"#f59e0b":"#22c55e"}})})]})}),b.jsx(sn,{type:"source",position:we.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function Z4(e,n){const r=he(d=>{var h;return(h=d.nodes[e])==null?void 0:h.startedAt}),l=he(d=>d.replayMode),a=he(d=>d.lastEventTime),[u,s]=$.useState("0.0s"),f=$.useRef(null);return $.useEffect(()=>{if(n==="running"){if(l){f.current&&clearInterval(f.current);const m=r??a??0;s(on((a??m)-m));return}const d=r!=null?r*1e3:Date.now(),h=()=>{const m=(Date.now()-d)/1e3;s(on(m))};return h(),f.current=setInterval(h,1e3),()=>{f.current&&clearInterval(f.current)}}else f.current&&clearInterval(f.current)},[n,r,l,a]),u}function K4(e){const n=$.useRef(e),[r,l]=$.useState("");return $.useEffect(()=>{const a=n.current;if(n.current=e,a===e)return;e==="running"?l("node-activate"):a==="running"&&(e==="completed"||e==="failed")&&l(e==="completed"?"node-complete":"node-fail");const u=setTimeout(()=>l(""),400);return()=>clearTimeout(u)},[e]),r}const J4=$.memo(function({data:n,id:r,selected:l}){const a=n,s=he(E=>{var _;return(_=E.nodes[r])==null?void 0:_.status})||a.status||"pending",f=at[s]||at.pending,d=he(E=>{var _;return(_=E.nodes[r])==null?void 0:_.elapsed}),h=he(E=>{var _;return(_=E.nodes[r])==null?void 0:_.exit_code}),m=he(E=>{var _;return(_=E.nodes[r])==null?void 0:_.error_type}),p=he(E=>{var _;return(_=E.nodes[r])==null?void 0:_.error_message}),y=W4(r,s),x=e5(s),w=(()=>{if(s==="failed"&&p)return{text:p.length>40?p.slice(0,37)+"...":p,className:"text-red-400"};if(s==="running")return{text:y,className:"text-[var(--text-muted)]"};if(s==="completed"){const E=[];return d!=null&&E.push(on(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(sn,{type:"target",position:we.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx(zm,{data:{status:s,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)]",s==="running"&&"shadow-[0_0_12px_var(--running-glow)]",x),style:{borderColor:f},children:[b.jsx("div",{className:Ye("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",s==="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:a.label}),w.text&&b.jsx("span",{className:Ye("text-[10px] truncate leading-tight",w.className),children:w.text})]})]})}),b.jsx(sn,{type:"source",position:we.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function W4(e,n){const r=he(d=>{var h;return(h=d.nodes[e])==null?void 0:h.startedAt}),l=he(d=>d.replayMode),a=he(d=>d.lastEventTime),[u,s]=$.useState("0.0s"),f=$.useRef(null);return $.useEffect(()=>{if(n==="running"){if(l){f.current&&clearInterval(f.current);const m=r??a??0;s(on((a??m)-m));return}const d=r!=null?r*1e3:Date.now(),h=()=>{const m=(Date.now()-d)/1e3;s(on(m))};return h(),f.current=setInterval(h,1e3),()=>{f.current&&clearInterval(f.current)}}else f.current&&clearInterval(f.current)},[n,r,l,a]),u}function e5(e){const n=$.useRef(e),[r,l]=$.useState("");return $.useEffect(()=>{const a=n.current;if(n.current=e,a===e)return;e==="running"?l("node-activate"):a==="running"&&(e==="completed"||e==="failed")&&l(e==="completed"?"node-complete":"node-fail");const u=setTimeout(()=>l(""),400);return()=>clearTimeout(u)},[e]),r}const t5=$.memo(function({data:n,id:r,selected:l}){const a=n,s=he(m=>{var p;return(p=m.nodes[r])==null?void 0:p.status})||a.status||"pending",f=at[s]||at.pending,d=he(m=>{var p;return(p=m.nodes[r])==null?void 0:p.selected_option}),h=n5(s);return b.jsxs(b.Fragment,{children:[b.jsx(sn,{type:"target",position:we.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),b.jsx(zm,{data:{status:s,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)]",s==="waiting"&&"shadow-[0_0_12px_var(--waiting-muted)]",s==="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",s==="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:a.label}),s==="waiting"&&b.jsx("span",{className:"text-[10px] text-[var(--waiting)] truncate leading-tight",children:"Awaiting input..."}),s==="completed"&&d&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] truncate leading-tight",children:d})]})]})}),b.jsx(sn,{type:"source",position:we.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function n5(e){const n=$.useRef(e),[r,l]=$.useState("");return $.useEffect(()=>{const a=n.current;if(n.current=e,a===e)return;e==="running"||e==="waiting"?l("node-activate"):(a==="running"||a==="waiting")&&e==="completed"&&l("node-complete");const u=setTimeout(()=>l(""),400);return()=>clearTimeout(u)},[e]),r}const r5=$.memo(function({data:n,id:r,selected:l}){const a=n,s=a.type==="for_each_group"?rN:Wk,f=a.progress,h=he(E=>{var _;return(_=E.nodes[r])==null?void 0:_.status})||a.status||"pending",m=at[h]||at.pending,p=i5(h),y=f?`${f.completed+f.failed}/${f.total}${f.failed>0?` (${f.failed} failed)`:""}`:null,x=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(sn,{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(s,{className:"w-3.5 h-3.5",style:{color:m}}),b.jsx("span",{className:"text-xs font-medium text-[var(--text-secondary)]",children:a.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:`${x}%`,backgroundColor:w?"var(--failed)":"var(--completed)"}})})]}),b.jsx(sn,{type:"source",position:we.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function i5(e){const n=$.useRef(e),[r,l]=$.useState("");return $.useEffect(()=>{const a=n.current;if(n.current=e,a===e)return;e==="running"?l("node-activate"):a==="running"&&(e==="completed"||e==="failed")&&l(e==="completed"?"node-complete":"node-fail");const u=setTimeout(()=>l(""),400);return()=>clearTimeout(u)},[e]),r}const l5=$.memo(function({data:n,selected:r}){const a=n.status||"pending",u=a==="completed",s=a==="failed",f=!u&&!s,d=u?at.completed:s?at.failed:at.pending;return b.jsxs(b.Fragment,{children:[b.jsx(sn,{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",u?"bg-[var(--completed)] shadow-[0_0_16px_var(--completed-muted)]":s?"bg-[var(--failed)] shadow-[0_0_16px_var(--failed-muted)]":"bg-[var(--node-bg)]",r&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]"),style:{borderColor:d},children:u?b.jsx(Vi,{className:"w-5 h-5 text-white",strokeWidth:3}):s?b.jsx(nw,{className:"w-3.5 h-3.5 text-white",fill:"white"}):b.jsx(Vi,{className:"w-5 h-5",strokeWidth:2.5,style:{color:f?at.pending:d}})})]})}),a5=$.memo(function({data:n,selected:r}){const a=n.status||"pending",u=at[a]||at.pending,s=a==="running"||a==="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",s?"bg-[var(--completed)]":"bg-[var(--node-bg)]",r&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]",s&&"shadow-[0_0_12px_var(--completed-muted)]"),style:{borderColor:u},children:b.jsx(am,{className:"w-4 h-4 ml-0.5",style:{color:s?"white":u}})}),b.jsx(sn,{type:"source",position:we.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})}),o5=$.memo(function({id:n,sourceX:r,sourceY:l,targetX:a,targetY:u,sourcePosition:s,targetPosition:f,source:d,target:h,data:m}){const p=he(H=>H.highlightedEdges),y=$.useMemo(()=>p.find(H=>H.from===d&&H.to===h),[p,d,h]),[x,w,E]=Sm({sourceX:r,sourceY:l,targetX:a,targetY:u,sourcePosition:s,targetPosition:f}),_=m==null?void 0:m.when,S=!!_,T=(y==null?void 0:y.state)==="taken",k=(y==null?void 0:y.state)==="highlighted",z=(y==null?void 0:y.state)==="failed";let M="var(--edge-color)",A=2,q;z?(M="var(--failed)",A=3):T?(M="var(--edge-taken)",A=3):k&&(M="var(--edge-active)",A=3),S&&!T&&!k&&!z&&(q="6 3");const j=z?"failed":T?"taken":k?"active":"default";return b.jsxs(b.Fragment,{children:[b.jsx(Wo,{id:n,path:x,style:{stroke:M,strokeWidth:A,strokeDasharray:q,transition:"stroke 0.3s ease, stroke-width 0.3s ease"},markerEnd:`url(#arrow-${j})`}),S&&b.jsx(zj,{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:z?"var(--failed)":T?"var(--edge-taken)":"var(--surface)",color:z||T?"var(--bg)":"var(--text-muted)",border:`1px solid ${z?"var(--failed)":T?"var(--edge-taken)":"var(--border)"}`},title:_,children:_})})}),T&&b.jsx("circle",{r:"3",fill:"var(--edge-taken)",children:b.jsx("animateMotion",{dur:"1s",repeatCount:"indefinite",path:x})}),z&&b.jsx("circle",{r:"3",fill:"var(--failed)",opacity:"0.8",children:b.jsx("animateMotion",{dur:"1.5s",repeatCount:"indefinite",path:x})})]})});function s5(){const e=he(s=>s.workflowStatus),n=he(s=>s.workflowFailure),r=he(s=>s.workflowFailedAgent),l=he(s=>s.selectNode);if(e!=="failed"||!n)return null;const a=n.message||n.error_type||"Unknown error",u=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(rw,{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:a}),u&&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()]})]}),r&&b.jsxs("button",{onClick:()=>l(r),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(Zk,{className:"w-3 h-3"}),"View"]})]})})}function u5(){const[e,n]=$.useState(!1),r=he(d=>d.workflowStatus),l=he(d=>d.totalCost),a=he(d=>d.totalTokens),u=he(d=>d.agentsCompleted),s=he(d=>d.agentsTotal),f=lw();return r!=="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(Gk,{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}),s>0&&b.jsxs("span",{children:[u,"/",s," agents"]}),a>0&&b.jsxs("span",{children:[tr(a)," tok"]}),l>0&&b.jsx("span",{children:na(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(da,{className:"w-3.5 h-3.5"})})]})})}const c5={agentNode:Q4,scriptNode:J4,gateNode:t5,groupNode:r5,endNode:l5,startNode:a5},f5={animatedEdge:o5},d5={type:"animatedEdge"};function h5(){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 p5(){const e=he(j=>j.agents),n=he(j=>j.routes),r=he(j=>j.parallelGroups),l=he(j=>j.forEachGroups),a=he(j=>j.nodes),u=he(j=>j.groupProgress),s=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,x,w]=Mj([]),[E,_,S]=jj([]),T=$.useRef(!1);$.useEffect(()=>{if(e.length===0||T.current)return;T.current=!0;const{nodes:j,edges:H}=G4(e,n,r,l,a,u,h);x(j),_(H)},[e,n,r,l,a,u,h,x,_]),$.useEffect(()=>{T.current&&x(j=>j.map(H=>{const R=a[H.id];if(!R)return H;const B=R.status||"pending",U=H.data.status;if(B!==U){const W={...H.data,status:B};return H.data.groupName&&u[H.data.groupName]&&(W.progress=u[H.data.groupName]),{...H,data:W}}if(H.data.groupName&&u[H.data.groupName]){const W=H.data.progress,I=u[H.data.groupName];if(I&&(!W||W.completed!==I.completed||W.failed!==I.failed))return{...H,data:{...H.data,progress:I}}}return H}))},[a,u,x]);const k=$.useCallback((j,H)=>{H.type==="groupNode"&&H.data.type!=="for_each_group"||s(H.id)},[s]),z=$.useCallback(()=>{s(null)},[s]),M=$.useCallback(j=>{var R;const H=((R=j.data)==null?void 0:R.status)||"pending";return at[H]||at.pending},[]);$.useEffect(()=>{x(j=>j.map(H=>({...H,selected:H.id===f})))},[f,x]),$.useEffect(()=>{d==="failed"&&p&&s(p)},[d,p,s]);const A=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(h5,{}),b.jsx(s5,{}),b.jsx(u5,{}),A&&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(cN,{className:"w-8 h-8 text-[var(--accent)] opacity-20"}),b.jsx(ta,{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(Tj,{nodes:y,edges:E,onNodesChange:w,onEdgesChange:S,onNodeClick:k,onPaneClick:z,nodeTypes:c5,edgeTypes:f5,defaultEdgeOptions:d5,fitView:!0,fitViewOptions:{padding:.2},minZoom:.2,maxZoom:2,proOptions:{hideAttribution:!0},nodesDraggable:!0,nodesConnectable:!1,elementsSelectable:!0,children:[b.jsx(Hj,{variant:zr.Dots,gap:20,size:1,color:"var(--border-subtle)"}),b.jsx(r4,{nodeColor:M,maskColor:"var(--minimap-mask)",style:{background:"var(--minimap-bg)"},pannable:!0,zoomable:!0}),b.jsx(Yj,{showInteractive:!1,children:b.jsx(m5,{})}),b.jsx(g5,{})]})]})}function m5(){const{fitView:e}=Jo(),n=$.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 g5(){const{fitView:e}=Jo();return $.useEffect(()=>{const n=r=>{var a;const l=(a=r.target)==null?void 0:a.tagName;l==="INPUT"||l==="TEXTAREA"||l==="SELECT"||r.key==="f"&&!r.ctrlKey&&!r.metaKey&&!r.altKey&&e({padding:.2,duration:300})};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e]),null}function ha({items:e}){const n=e.filter(r=>r.value!=null&&r.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:r,value:l})=>b.jsxs("div",{className:"contents",children:[b.jsx("dt",{className:"text-[var(--text-muted)] whitespace-nowrap",children:r}),b.jsx("dd",{className:"text-[var(--text)] break-words",children:typeof l=="object"?JSON.stringify(l):String(l)})]},r))})}function m_(e){const n=[];return e.elapsed!=null&&n.push({label:"Elapsed",value:on(e.elapsed)}),e.model&&n.push({label:"Model",value:e.model}),e.tokens!=null&&n.push({label:"Tokens",value:tr(e.tokens)}),e.input_tokens!=null&&e.output_tokens!=null&&n.push({label:"In / Out",value:`${tr(e.input_tokens)} / ${tr(e.output_tokens)}`}),e.cost_usd!=null&&n.push({label:"Cost",value:na(e.cost_usd)}),e.context_window_used!=null&&e.context_window_max!=null&&n.push({label:"Context",value:vN(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 Ki({output:e,title:n="Output",defaultExpanded:r=!0,maxHeight:l="300px"}){const[a,u]=$.useState(r),[s,f]=$.useState(!1),d=iw(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:()=>u(!a),className:"flex items-center gap-1 text-[10px] uppercase tracking-wider text-[var(--text-muted)] hover:text-[var(--text)] transition-colors font-semibold",children:[a?b.jsx(Wi,{className:"w-3 h-3"}):b.jsx(fa,{className:"w-3 h-3"}),n]}),a&&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:s?b.jsx(Vi,{className:"w-3 h-3 text-[var(--completed)]"}):b.jsx(ew,{className:"w-3 h-3"})})]}),a&&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(y5,{text:d}):d})]})}function y5({text:e}){const n=e.split(/("(?:[^"\\]|\\.)*")/g);return b.jsx(b.Fragment,{children:n.map((r,l)=>{if(l%2===1){const u=n.slice(l+1).join(""),s=/^\s*:/.test(u);return b.jsx("span",{className:s?"text-blue-400":"text-green-400",children:r},l)}const a=r.replace(/\b(true|false|null)\b|(-?\d+\.?\d*(?:e[+-]?\d+)?)/gi,(u,s,f)=>s?`${u}`:f?`${u}`:u);return b.jsx("span",{dangerouslySetInnerHTML:{__html:a}},l)})})}function Mm({activity:e,defaultExpanded:n=!0}){const[r,l]=$.useState(n),a=$.useRef(null);return $.useEffect(()=>{a.current&&r&&(a.current.scrollTop=a.current.scrollHeight)},[e.length,r]),e.length===0?null:b.jsxs("div",{className:"space-y-1.5",children:[b.jsxs("button",{onClick:()=>l(!r),className:"flex items-center gap-1 text-[10px] uppercase tracking-wider text-[var(--text-muted)] hover:text-[var(--text)] transition-colors font-semibold",children:[r?b.jsx(Wi,{className:"w-3 h-3"}):b.jsx(fa,{className:"w-3 h-3"}),"Activity (",e.length,")"]}),r&&b.jsx("div",{ref:a,className:"max-h-[400px] overflow-y-auto space-y-0.5",children:e.map((u,s)=>b.jsx(x5,{entry:u},s))})]})}function x5({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 v5({node:e}){const n=e.status,r=at[n]||at.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:`${r}20`,color:r},children:n}),b.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Agent"})]}),l?b.jsx(lb,{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(ha,{items:m_(e)}),e.prompt&&b.jsx(Ki,{output:e.prompt,title:"Input / Prompt",defaultExpanded:!0}),b.jsx(Mm,{activity:e.activity,defaultExpanded:n!=="completed"}),e.output!=null&&b.jsx(Ki,{output:e.output,title:"Output"})]}),l&&[...e.iterationHistory].reverse().map(a=>b.jsx(lb,{label:`Iteration ${a.iteration}`,defaultExpanded:!1,status:n,snapshot:a},a.iteration))]})}function lb({label:e,defaultExpanded:n,snapshot:r,status:l}){const[a,u]=$.useState(n);return b.jsxs("div",{className:"border border-[var(--border)] rounded-lg overflow-hidden",children:[b.jsxs("button",{onClick:()=>u(!a),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:[a?b.jsx(Wi,{className:"w-3.5 h-3.5 text-[var(--text-muted)] flex-shrink-0"}):b.jsx(fa,{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}),r.elapsed!=null&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] ml-auto",children:b5(r.elapsed)})]}),a&&b.jsxs("div",{className:"px-3 py-3 space-y-3 border-t border-[var(--border)]",children:[b.jsx(ha,{items:m_(r)}),r.prompt&&b.jsx(Ki,{output:r.prompt,title:"Input / Prompt",defaultExpanded:!1}),b.jsx(Mm,{activity:r.activity,defaultExpanded:n&&l!=="completed"}),r.output!=null&&b.jsx(Ki,{output:r.output,title:"Output",defaultExpanded:!0}),r.error_type&&b.jsxs("div",{className:"text-xs text-red-400",children:[b.jsx("span",{className:"font-semibold",children:r.error_type}),r.error_message&&b.jsxs("span",{className:"ml-1",children:["— ",r.error_message]})]})]})]})}function b5(e){if(e<1)return`${(e*1e3).toFixed(0)}ms`;if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e/60),r=(e%60).toFixed(0);return`${n}m ${r}s`}function w5({node:e}){const n=e.status,r=at[n]||at.pending,l=[];e.elapsed!=null&&l.push({label:"Elapsed",value:on(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 a="";return e.stdout&&(a+=e.stdout),e.stderr&&(a+=(a?` + +--- 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:`${r}20`,color:r},children:n}),b.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Script"})]}),b.jsx(ha,{items:l}),a&&b.jsx(Ki,{output:a,title:"Output"})]})}function S5(e,n){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const _5=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,E5=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,k5={};function ab(e,n){return(k5.jsx?E5:_5).test(e)}const N5=/[ \t\n\f\r]/g;function C5(e){return typeof e=="object"?e.type==="text"?ob(e.value):!1:ob(e)}function ob(e){return e.replace(N5,"")===""}class es{constructor(n,r,l){this.normal=r,this.property=n,l&&(this.space=l)}}es.prototype.normal={};es.prototype.property={};es.prototype.space=void 0;function g_(e,n){const r={},l={};for(const a of e)Object.assign(r,a.property),Object.assign(l,a.normal);return new es(r,l,n)}function Qp(e){return e.toLowerCase()}class un{constructor(n,r){this.attribute=r,this.property=n}}un.prototype.attribute="";un.prototype.booleanish=!1;un.prototype.boolean=!1;un.prototype.commaOrSpaceSeparated=!1;un.prototype.commaSeparated=!1;un.prototype.defined=!1;un.prototype.mustUseProperty=!1;un.prototype.number=!1;un.prototype.overloadedBoolean=!1;un.prototype.property="";un.prototype.spaceSeparated=!1;un.prototype.space=void 0;let T5=0;const De=el(),Ct=el(),Zp=el(),me=el(),st=el(),ea=el(),xn=el();function el(){return 2**++T5}const Kp=Object.freeze(Object.defineProperty({__proto__:null,boolean:De,booleanish:Ct,commaOrSpaceSeparated:xn,commaSeparated:ea,number:me,overloadedBoolean:Zp,spaceSeparated:st},Symbol.toStringTag,{value:"Module"})),hp=Object.keys(Kp);class jm extends un{constructor(n,r,l,a){let u=-1;if(super(n,r),sb(this,"space",a),typeof l=="number")for(;++u4&&r.slice(0,4)==="data"&&D5.test(n)){if(n.charAt(4)==="-"){const u=n.slice(5).replace(ub,L5);l="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=n.slice(4);if(!ub.test(u)){let s=u.replace(j5,O5);s.charAt(0)!=="-"&&(s="-"+s),n="data"+s}}a=jm}return new a(l,n)}function O5(e){return"-"+e.toLowerCase()}function L5(e){return e.charAt(1).toUpperCase()}const H5=g_([y_,A5,b_,w_,S_],"html"),Dm=g_([y_,z5,b_,w_,S_],"svg");function B5(e){return e.join(" ").trim()}var Vl={},pp,cb;function I5(){if(cb)return pp;cb=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,f=/^\s+|\s+$/g,d=` +`,h="/",m="*",p="",y="comment",x="declaration";function w(_,S){if(typeof _!="string")throw new TypeError("First argument must be a string");if(!_)return[];S=S||{};var T=1,k=1;function z(I){var F=I.match(n);F&&(T+=F.length);var L=I.lastIndexOf(d);k=~L?I.length-L:k+I.length}function M(){var I={line:T,column:k};return function(F){return F.position=new A(I),H(),F}}function A(I){this.start=I,this.end={line:T,column:k},this.source=S.source}A.prototype.content=_;function q(I){var F=new Error(S.source+":"+T+":"+k+": "+I);if(F.reason=I,F.filename=S.source,F.line=T,F.column=k,F.source=_,!S.silent)throw F}function j(I){var F=I.exec(_);if(F){var L=F[0];return z(L),_=_.slice(L.length),F}}function H(){j(r)}function R(I){var F;for(I=I||[];F=B();)F!==!1&&I.push(F);return I}function B(){var I=M();if(!(h!=_.charAt(0)||m!=_.charAt(1))){for(var F=2;p!=_.charAt(F)&&(m!=_.charAt(F)||h!=_.charAt(F+1));)++F;if(F+=2,p===_.charAt(F-1))return q("End of comment missing");var L=_.slice(2,F-2);return k+=2,z(L),_=_.slice(F),k+=2,I({type:y,comment:L})}}function U(){var I=M(),F=j(l);if(F){if(B(),!j(a))return q("property missing ':'");var L=j(u),G=I({type:x,property:E(F[0].replace(e,p)),value:L?E(L[0].replace(e,p)):p});return j(s),G}}function W(){var I=[];R(I);for(var F;F=U();)F!==!1&&(I.push(F),R(I));return I}return H(),W()}function E(_){return _?_.replace(f,p):p}return pp=w,pp}var fb;function q5(){if(fb)return Vl;fb=1;var e=Vl&&Vl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(Vl,"__esModule",{value:!0}),Vl.default=r;const n=e(I5());function r(l,a){let u=null;if(!l||typeof l!="string")return u;const s=(0,n.default)(l),f=typeof a=="function";return s.forEach(d=>{if(d.type!=="declaration")return;const{property:h,value:m}=d;f?a(h,m,d):m&&(u=u||{},u[h]=m)}),u}return Vl}var go={},db;function U5(){if(db)return go;db=1,Object.defineProperty(go,"__esModule",{value:!0}),go.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,u=function(h){return!h||r.test(h)||e.test(h)},s=function(h,m){return m.toUpperCase()},f=function(h,m){return"".concat(m,"-")},d=function(h,m){return m===void 0&&(m={}),u(h)?h:(h=h.toLowerCase(),m.reactCompat?h=h.replace(a,f):h=h.replace(l,f),h.replace(n,s))};return go.camelCase=d,go}var yo,hb;function V5(){if(hb)return yo;hb=1;var e=yo&&yo.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},n=e(q5()),r=U5();function l(a,u){var s={};return!a||typeof a!="string"||(0,n.default)(a,function(f,d){f&&d&&(s[(0,r.camelCase)(f,u)]=d)}),s}return l.default=l,yo=l,yo}var $5=V5();const Y5=Yo($5),__=E_("end"),Rm=E_("start");function E_(e){return n;function n(r){const l=r&&r.position&&r.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 F5(e){const n=Rm(e),r=__(e);if(n&&r)return{start:n,end:r}}function To(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?pb(e.position):"start"in e||"end"in e?pb(e):"line"in e||"column"in e?Jp(e):""}function Jp(e){return mb(e&&e.line)+":"+mb(e&&e.column)}function pb(e){return Jp(e&&e.start)+"-"+Jp(e&&e.end)}function mb(e){return e&&typeof e=="number"?e:1}class Gt extends Error{constructor(n,r,l){super(),typeof r=="string"&&(l=r,r=void 0);let a="",u={},s=!1;if(r&&("line"in r&&"column"in r?u={place:r}:"start"in r&&"end"in r?u={place:r}:"type"in r?u={ancestors:[r],place:r.position}:u={...r}),typeof n=="string"?a=n:!u.cause&&n&&(s=!0,a=n.message,u.cause=n),!u.ruleId&&!u.source&&typeof l=="string"){const d=l.indexOf(":");d===-1?u.ruleId=l:(u.source=l.slice(0,d),u.ruleId=l.slice(d+1))}if(!u.place&&u.ancestors&&u.ancestors){const d=u.ancestors[u.ancestors.length-1];d&&(u.place=d.position)}const f=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=f?f.line:void 0,this.name=To(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=s&&u.cause&&typeof u.cause.stack=="string"?u.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 Om={}.hasOwnProperty,G5=new Map,P5=/[A-Z]/g,X5=new Set(["table","tbody","thead","tfoot","tr"]),Q5=new Set(["td","th"]),k_="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Z5(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=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=iD(r,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=rD(r,n.jsx,n.jsxs)}const a={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:l,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?Dm:H5,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},u=N_(a,e,void 0);return u&&typeof u!="string"?u:a.create(e,a.Fragment,{children:u||void 0},void 0)}function N_(e,n,r){if(n.type==="element")return K5(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return J5(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return eD(e,n,r);if(n.type==="mdxjsEsm")return W5(e,n);if(n.type==="root")return tD(e,n,r);if(n.type==="text")return nD(e,n)}function K5(e,n,r){const l=e.schema;let a=l;n.tagName.toLowerCase()==="svg"&&l.space==="html"&&(a=Dm,e.schema=a),e.ancestors.push(n);const u=T_(e,n.tagName,!1),s=lD(e,n);let f=Hm(e,n);return X5.has(n.tagName)&&(f=f.filter(function(d){return typeof d=="string"?!C5(d):!0})),C_(e,s,u,n),Lm(s,f),e.ancestors.pop(),e.schema=l,e.create(n,u,s,r)}function J5(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)}Vo(e,n.position)}function W5(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Vo(e,n.position)}function eD(e,n,r){const l=e.schema;let a=l;n.name==="svg"&&l.space==="html"&&(a=Dm,e.schema=a),e.ancestors.push(n);const u=n.name===null?e.Fragment:T_(e,n.name,!0),s=aD(e,n),f=Hm(e,n);return C_(e,s,u,n),Lm(s,f),e.ancestors.pop(),e.schema=l,e.create(n,u,s,r)}function tD(e,n,r){const l={};return Lm(l,Hm(e,n)),e.create(n,e.Fragment,l,r)}function nD(e,n){return n.value}function C_(e,n,r,l){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=l)}function Lm(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function rD(e,n,r){return l;function l(a,u,s,f){const h=Array.isArray(s.children)?r:n;return f?h(u,s,f):h(u,s)}}function iD(e,n){return r;function r(l,a,u,s){const f=Array.isArray(u.children),d=Rm(l);return n(a,u,s,f,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function lD(e,n){const r={};let l,a;for(a in n.properties)if(a!=="children"&&Om.call(n.properties,a)){const u=oD(e,a,n.properties[a]);if(u){const[s,f]=u;e.tableCellAlignToStyle&&s==="align"&&typeof f=="string"&&Q5.has(n.tagName)?l=f:r[s]=f}}if(l){const u=r.style||(r.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=l}return r}function aD(e,n){const r={};for(const l of n.attributes)if(l.type==="mdxJsxExpressionAttribute")if(l.data&&l.data.estree&&e.evaluater){const u=l.data.estree.body[0];u.type;const s=u.expression;s.type;const f=s.properties[0];f.type,Object.assign(r,e.evaluater.evaluateExpression(f.argument))}else Vo(e,n.position);else{const a=l.name;let u;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,u=e.evaluater.evaluateExpression(f.expression)}else Vo(e,n.position);else u=l.value===null?!0:l.value;r[a]=u}return r}function Hm(e,n){const r=[];let l=-1;const a=e.passKeys?new Map:G5;for(;++la?0:a+n:n=n>a?a:n,r=r>0?r:0,l.length<1e4)s=Array.from(l),s.unshift(n,r),e.splice(...s);else for(r&&e.splice(n,r);u0?(wn(e,e.length,0,n),e):n}const xb={}.hasOwnProperty;function z_(e){const n={};let r=-1;for(;++r13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Yn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Qt=mi(/[A-Za-z]/),Ft=mi(/[\dA-Za-z]/),gD=mi(/[#-'*+\--9=?A-Z^-~]/);function hc(e){return e!==null&&(e<32||e===127)}const Wp=mi(/\d/),yD=mi(/[\dA-Fa-f]/),xD=mi(/[!-/:-@[-`{-~]/);function ke(e){return e!==null&&e<-2}function ot(e){return e!==null&&(e<0||e===32)}function Be(e){return e===-2||e===-1||e===32}const jc=mi(new RegExp("\\p{P}|\\p{S}","u")),Ji=mi(/\s/);function mi(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function ma(e){const n=[];let r=-1,l=0,a=0;for(;++r55295&&u<57344){const f=e.charCodeAt(r+1);u<56320&&f>56319&&f<57344?(s=String.fromCharCode(u,f),a=1):s="�"}else s=String.fromCharCode(u);s&&(n.push(e.slice(l,r),encodeURIComponent(s)),l=r+a+1,s=""),a&&(r+=a,a=0)}return n.join("")+e.slice(l)}function Fe(e,n,r,l){const a=l?l-1:Number.POSITIVE_INFINITY;let u=0;return s;function s(d){return Be(d)?(e.enter(r),f(d)):n(d)}function f(d){return Be(d)&&u++s))return;const q=n.events.length;let j=q,H,R;for(;j--;)if(n.events[j][0]==="exit"&&n.events[j][1].type==="chunkFlow"){if(H){R=n.events[j][1].end;break}H=!0}for(S(l),A=q;Ak;){const M=r[z];n.containerState=M[1],M[0].exit.call(n,e)}r.length=k}function T(){a.write([null]),u=void 0,a=void 0,n.containerState._closeFlow=void 0}}function _D(e,n,r){return Fe(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ca(e){if(e===null||ot(e)||Ji(e))return 1;if(jc(e))return 2}function Dc(e,n,r){const l=[];let a=-1;for(;++a1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const p={...e[l][1].end},y={...e[r][1].start};bb(p,-d),bb(y,d),s={type:d>1?"strongSequence":"emphasisSequence",start:p,end:{...e[l][1].end}},f={type:d>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:y},u={type:d>1?"strongText":"emphasisText",start:{...e[l][1].end},end:{...e[r][1].start}},a={type:d>1?"strong":"emphasis",start:{...s.start},end:{...f.end}},e[l][1].end={...s.start},e[r][1].start={...f.end},h=[],e[l][1].end.offset-e[l][1].start.offset&&(h=jn(h,[["enter",e[l][1],n],["exit",e[l][1],n]])),h=jn(h,[["enter",a,n],["enter",s,n],["exit",s,n],["enter",u,n]]),h=jn(h,Dc(n.parser.constructs.insideSpan.null,e.slice(l+1,r),n)),h=jn(h,[["exit",u,n],["enter",f,n],["exit",f,n],["exit",a,n]]),e[r][1].end.offset-e[r][1].start.offset?(m=2,h=jn(h,[["enter",e[r][1],n],["exit",e[r][1],n]])):m=0,wn(e,l-1,r-l+3,h),r=l+h.length-m-2;break}}for(r=-1;++r0&&Be(A)?Fe(e,T,"linePrefix",u+1)(A):T(A)}function T(A){return A===null||ke(A)?e.check(wb,E,z)(A):(e.enter("codeFlowValue"),k(A))}function k(A){return A===null||ke(A)?(e.exit("codeFlowValue"),T(A)):(e.consume(A),k)}function z(A){return e.exit("codeFenced"),n(A)}function M(A,q,j){let H=0;return R;function R(F){return A.enter("lineEnding"),A.consume(F),A.exit("lineEnding"),B}function B(F){return A.enter("codeFencedFence"),Be(F)?Fe(A,U,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):U(F)}function U(F){return F===f?(A.enter("codeFencedFenceSequence"),W(F)):j(F)}function W(F){return F===f?(H++,A.consume(F),W):H>=s?(A.exit("codeFencedFenceSequence"),Be(F)?Fe(A,I,"whitespace")(F):I(F)):j(F)}function I(F){return F===null||ke(F)?(A.exit("codeFencedFence"),q(F)):j(F)}}}function OD(e,n,r){const l=this;return a;function a(s){return s===null?r(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),u)}function u(s){return l.parser.lazy[l.now().line]?r(s):n(s)}}const gp={name:"codeIndented",tokenize:HD},LD={partial:!0,tokenize:BD};function HD(e,n,r){const l=this;return a;function a(h){return e.enter("codeIndented"),Fe(e,u,"linePrefix",5)(h)}function u(h){const m=l.events[l.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?s(h):r(h)}function s(h){return h===null?d(h):ke(h)?e.attempt(LD,s,d)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||ke(h)?(e.exit("codeFlowValue"),s(h)):(e.consume(h),f)}function d(h){return e.exit("codeIndented"),n(h)}}function BD(e,n,r){const l=this;return a;function a(s){return l.parser.lazy[l.now().line]?r(s):ke(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):Fe(e,u,"linePrefix",5)(s)}function u(s){const f=l.events[l.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(s):ke(s)?a(s):r(s)}}const ID={name:"codeText",previous:UD,resolve:qD,tokenize:VD};function qD(e){let n=e.length-4,r=3,l,a;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(l=r;++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,r,l){const a=r||0;this.setCursor(Math.trunc(n));const u=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return l&&xo(this.left,l),u.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),xo(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),xo(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(s):e.interrupt(l.parser.constructs.flow,r,n)(s)}}function L_(e,n,r,l,a,u,s,f,d){const h=d||Number.POSITIVE_INFINITY;let m=0;return p;function p(S){return S===60?(e.enter(l),e.enter(a),e.enter(u),e.consume(S),e.exit(u),y):S===null||S===32||S===41||hc(S)?r(S):(e.enter(l),e.enter(s),e.enter(f),e.enter("chunkString",{contentType:"string"}),E(S))}function y(S){return S===62?(e.enter(u),e.consume(S),e.exit(u),e.exit(a),e.exit(l),n):(e.enter(f),e.enter("chunkString",{contentType:"string"}),x(S))}function x(S){return S===62?(e.exit("chunkString"),e.exit(f),y(S)):S===null||S===60||ke(S)?r(S):(e.consume(S),S===92?w:x)}function w(S){return S===60||S===62||S===92?(e.consume(S),x):x(S)}function E(S){return!m&&(S===null||S===41||ot(S))?(e.exit("chunkString"),e.exit(f),e.exit(s),e.exit(l),n(S)):m999||x===null||x===91||x===93&&!d||x===94&&!f&&"_hiddenFootnoteSupport"in s.parser.constructs?r(x):x===93?(e.exit(u),e.enter(a),e.consume(x),e.exit(a),e.exit(l),n):ke(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),m):(e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===null||x===91||x===93||ke(x)||f++>999?(e.exit("chunkString"),m(x)):(e.consume(x),d||(d=!Be(x)),x===92?y:p)}function y(x){return x===91||x===92||x===93?(e.consume(x),f++,p):p(x)}}function B_(e,n,r,l,a,u){let s;return f;function f(y){return y===34||y===39||y===40?(e.enter(l),e.enter(a),e.consume(y),e.exit(a),s=y===40?41:y,d):r(y)}function d(y){return y===s?(e.enter(a),e.consume(y),e.exit(a),e.exit(l),n):(e.enter(u),h(y))}function h(y){return y===s?(e.exit(u),d(s)):y===null?r(y):ke(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),Fe(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===s||y===null||ke(y)?(e.exit("chunkString"),h(y)):(e.consume(y),y===92?p:m)}function p(y){return y===s||y===92?(e.consume(y),m):m(y)}}function Ao(e,n){let r;return l;function l(a){return ke(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r=!0,l):Be(a)?Fe(e,l,r?"linePrefix":"lineSuffix")(a):n(a)}}const ZD={name:"definition",tokenize:JD},KD={partial:!0,tokenize:WD};function JD(e,n,r){const l=this;let a;return u;function u(x){return e.enter("definition"),s(x)}function s(x){return H_.call(l,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function f(x){return a=Yn(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)),x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),d):r(x)}function d(x){return ot(x)?Ao(e,h)(x):h(x)}function h(x){return L_(e,m,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function m(x){return e.attempt(KD,p,p)(x)}function p(x){return Be(x)?Fe(e,y,"whitespace")(x):y(x)}function y(x){return x===null||ke(x)?(e.exit("definition"),l.parser.defined.push(a),n(x)):r(x)}}function WD(e,n,r){return l;function l(f){return ot(f)?Ao(e,a)(f):r(f)}function a(f){return B_(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return Be(f)?Fe(e,s,"whitespace")(f):s(f)}function s(f){return f===null||ke(f)?n(f):r(f)}}const eR={name:"hardBreakEscape",tokenize:tR};function tR(e,n,r){return l;function l(u){return e.enter("hardBreakEscape"),e.consume(u),a}function a(u){return ke(u)?(e.exit("hardBreakEscape"),n(u)):r(u)}}const nR={name:"headingAtx",resolve:rR,tokenize:iR};function rR(e,n){let r=e.length-2,l=3,a,u;return e[l][1].type==="whitespace"&&(l+=2),r-2>l&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(l===r-1||r-4>l&&e[r-2][1].type==="whitespace")&&(r-=l+1===r?2:4),r>l&&(a={type:"atxHeadingText",start:e[l][1].start,end:e[r][1].end},u={type:"chunkText",start:e[l][1].start,end:e[r][1].end,contentType:"text"},wn(e,l,r-l+1,[["enter",a,n],["enter",u,n],["exit",u,n],["exit",a,n]])),e}function iR(e,n,r){let l=0;return a;function a(m){return e.enter("atxHeading"),u(m)}function u(m){return e.enter("atxHeadingSequence"),s(m)}function s(m){return m===35&&l++<6?(e.consume(m),s):m===null||ot(m)?(e.exit("atxHeadingSequence"),f(m)):r(m)}function f(m){return m===35?(e.enter("atxHeadingSequence"),d(m)):m===null||ke(m)?(e.exit("atxHeading"),n(m)):Be(m)?Fe(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||ot(m)?(e.exit("atxHeadingText"),f(m)):(e.consume(m),h)}}const lR=["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"],_b=["pre","script","style","textarea"],aR={concrete:!0,name:"htmlFlow",resolveTo:uR,tokenize:cR},oR={partial:!0,tokenize:dR},sR={partial:!0,tokenize:fR};function uR(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 cR(e,n,r){const l=this;let a,u,s,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),u=!0,E):N===63?(e.consume(N),a=3,l.interrupt?n:D):Qt(N)?(e.consume(N),s=String.fromCharCode(N),_):r(N)}function y(N){return N===45?(e.consume(N),a=2,x):N===91?(e.consume(N),a=5,f=0,w):Qt(N)?(e.consume(N),a=4,l.interrupt?n:D):r(N)}function x(N){return N===45?(e.consume(N),l.interrupt?n:D):r(N)}function w(N){const Y="CDATA[";return N===Y.charCodeAt(f++)?(e.consume(N),f===Y.length?l.interrupt?n:U:w):r(N)}function E(N){return Qt(N)?(e.consume(N),s=String.fromCharCode(N),_):r(N)}function _(N){if(N===null||N===47||N===62||ot(N)){const Y=N===47,X=s.toLowerCase();return!Y&&!u&&_b.includes(X)?(a=1,l.interrupt?n(N):U(N)):lR.includes(s.toLowerCase())?(a=6,Y?(e.consume(N),S):l.interrupt?n(N):U(N)):(a=7,l.interrupt&&!l.parser.lazy[l.now().line]?r(N):u?T(N):k(N))}return N===45||Ft(N)?(e.consume(N),s+=String.fromCharCode(N),_):r(N)}function S(N){return N===62?(e.consume(N),l.interrupt?n:U):r(N)}function T(N){return Be(N)?(e.consume(N),T):R(N)}function k(N){return N===47?(e.consume(N),R):N===58||N===95||Qt(N)?(e.consume(N),z):Be(N)?(e.consume(N),k):R(N)}function z(N){return N===45||N===46||N===58||N===95||Ft(N)?(e.consume(N),z):M(N)}function M(N){return N===61?(e.consume(N),A):Be(N)?(e.consume(N),M):k(N)}function A(N){return N===null||N===60||N===61||N===62||N===96?r(N):N===34||N===39?(e.consume(N),d=N,q):Be(N)?(e.consume(N),A):j(N)}function q(N){return N===d?(e.consume(N),d=null,H):N===null||ke(N)?r(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||ot(N)?M(N):(e.consume(N),j)}function H(N){return N===47||N===62||Be(N)?k(N):r(N)}function R(N){return N===62?(e.consume(N),B):r(N)}function B(N){return N===null||ke(N)?U(N):Be(N)?(e.consume(N),B):r(N)}function U(N){return N===45&&a===2?(e.consume(N),L):N===60&&a===1?(e.consume(N),G):N===62&&a===4?(e.consume(N),V):N===63&&a===3?(e.consume(N),D):N===93&&a===5?(e.consume(N),J):ke(N)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(oR,P,W)(N)):N===null||ke(N)?(e.exit("htmlFlowData"),W(N)):(e.consume(N),U)}function W(N){return e.check(sR,I,P)(N)}function I(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),F}function F(N){return N===null||ke(N)?W(N):(e.enter("htmlFlowData"),U(N))}function L(N){return N===45?(e.consume(N),D):U(N)}function G(N){return N===47?(e.consume(N),s="",Z):U(N)}function Z(N){if(N===62){const Y=s.toLowerCase();return _b.includes(Y)?(e.consume(N),V):U(N)}return Qt(N)&&s.length<8?(e.consume(N),s+=String.fromCharCode(N),Z):U(N)}function J(N){return N===93?(e.consume(N),D):U(N)}function D(N){return N===62?(e.consume(N),V):N===45&&a===2?(e.consume(N),D):U(N)}function V(N){return N===null||ke(N)?(e.exit("htmlFlowData"),P(N)):(e.consume(N),V)}function P(N){return e.exit("htmlFlow"),n(N)}}function fR(e,n,r){const l=this;return a;function a(s){return ke(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),u):r(s)}function u(s){return l.parser.lazy[l.now().line]?r(s):n(s)}}function dR(e,n,r){return l;function l(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(ts,n,r)}}const hR={name:"htmlText",tokenize:pR};function pR(e,n,r){const l=this;let a,u,s;return f;function f(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),d}function d(D){return D===33?(e.consume(D),h):D===47?(e.consume(D),M):D===63?(e.consume(D),k):Qt(D)?(e.consume(D),j):r(D)}function h(D){return D===45?(e.consume(D),m):D===91?(e.consume(D),u=0,w):Qt(D)?(e.consume(D),T):r(D)}function m(D){return D===45?(e.consume(D),x):r(D)}function p(D){return D===null?r(D):D===45?(e.consume(D),y):ke(D)?(s=p,G(D)):(e.consume(D),p)}function y(D){return D===45?(e.consume(D),x):p(D)}function x(D){return D===62?L(D):D===45?y(D):p(D)}function w(D){const V="CDATA[";return D===V.charCodeAt(u++)?(e.consume(D),u===V.length?E:w):r(D)}function E(D){return D===null?r(D):D===93?(e.consume(D),_):ke(D)?(s=E,G(D)):(e.consume(D),E)}function _(D){return D===93?(e.consume(D),S):E(D)}function S(D){return D===62?L(D):D===93?(e.consume(D),S):E(D)}function T(D){return D===null||D===62?L(D):ke(D)?(s=T,G(D)):(e.consume(D),T)}function k(D){return D===null?r(D):D===63?(e.consume(D),z):ke(D)?(s=k,G(D)):(e.consume(D),k)}function z(D){return D===62?L(D):k(D)}function M(D){return Qt(D)?(e.consume(D),A):r(D)}function A(D){return D===45||Ft(D)?(e.consume(D),A):q(D)}function q(D){return ke(D)?(s=q,G(D)):Be(D)?(e.consume(D),q):L(D)}function j(D){return D===45||Ft(D)?(e.consume(D),j):D===47||D===62||ot(D)?H(D):r(D)}function H(D){return D===47?(e.consume(D),L):D===58||D===95||Qt(D)?(e.consume(D),R):ke(D)?(s=H,G(D)):Be(D)?(e.consume(D),H):L(D)}function R(D){return D===45||D===46||D===58||D===95||Ft(D)?(e.consume(D),R):B(D)}function B(D){return D===61?(e.consume(D),U):ke(D)?(s=B,G(D)):Be(D)?(e.consume(D),B):H(D)}function U(D){return D===null||D===60||D===61||D===62||D===96?r(D):D===34||D===39?(e.consume(D),a=D,W):ke(D)?(s=U,G(D)):Be(D)?(e.consume(D),U):(e.consume(D),I)}function W(D){return D===a?(e.consume(D),a=void 0,F):D===null?r(D):ke(D)?(s=W,G(D)):(e.consume(D),W)}function I(D){return D===null||D===34||D===39||D===60||D===61||D===96?r(D):D===47||D===62||ot(D)?H(D):(e.consume(D),I)}function F(D){return D===47||D===62||ot(D)?H(D):r(D)}function L(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),n):r(D)}function G(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),Z}function Z(D){return Be(D)?Fe(e,J,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):J(D)}function J(D){return e.enter("htmlTextData"),s(D)}}const qm={name:"labelEnd",resolveAll:xR,resolveTo:vR,tokenize:bR},mR={tokenize:wR},gR={tokenize:SR},yR={tokenize:_R};function xR(e){let n=-1;const r=[];for(;++n=3&&(h===null||ke(h))?(e.exit("thematicBreak"),n(h)):r(h)}function d(h){return h===a?(e.consume(h),l++,d):(e.exit("thematicBreakSequence"),Be(h)?Fe(e,f,"whitespace")(h):f(h))}}const ln={continuation:{tokenize:DR},exit:OR,name:"list",tokenize:jR},zR={partial:!0,tokenize:LR},MR={partial:!0,tokenize:RR};function jR(e,n,r){const l=this,a=l.events[l.events.length-1];let u=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return f;function f(x){const w=l.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!l.containerState.marker||x===l.containerState.marker:Wp(x)){if(l.containerState.type||(l.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),x===42||x===45?e.check(Ku,r,h)(x):h(x);if(!l.interrupt||x===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(x)}return r(x)}function d(x){return Wp(x)&&++s<10?(e.consume(x),d):(!l.interrupt||s<2)&&(l.containerState.marker?x===l.containerState.marker:x===41||x===46)?(e.exit("listItemValue"),h(x)):r(x)}function h(x){return e.enter("listItemMarker"),e.consume(x),e.exit("listItemMarker"),l.containerState.marker=l.containerState.marker||x,e.check(ts,l.interrupt?r:m,e.attempt(zR,y,p))}function m(x){return l.containerState.initialBlankLine=!0,u++,y(x)}function p(x){return Be(x)?(e.enter("listItemPrefixWhitespace"),e.consume(x),e.exit("listItemPrefixWhitespace"),y):r(x)}function y(x){return l.containerState.size=u+l.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(x)}}function DR(e,n,r){const l=this;return l.containerState._closeFlow=void 0,e.check(ts,a,u);function a(f){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,Fe(e,n,"listItemIndent",l.containerState.size+1)(f)}function u(f){return l.containerState.furtherBlankLines||!Be(f)?(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,s(f)):(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,e.attempt(MR,n,s)(f))}function s(f){return l.containerState._closeFlow=!0,l.interrupt=void 0,Fe(e,e.attempt(ln,n,r),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function RR(e,n,r){const l=this;return Fe(e,a,"listItemIndent",l.containerState.size+1);function a(u){const s=l.events[l.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===l.containerState.size?n(u):r(u)}}function OR(e){e.exit(this.containerState.type)}function LR(e,n,r){const l=this;return Fe(e,a,"listItemPrefixWhitespace",l.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(u){const s=l.events[l.events.length-1];return!Be(u)&&s&&s[1].type==="listItemPrefixWhitespace"?n(u):r(u)}}const Eb={name:"setextUnderline",resolveTo:HR,tokenize:BR};function HR(e,n){let r=e.length,l,a,u;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){l=r;break}e[r][1].type==="paragraph"&&(a=r)}else e[r][1].type==="content"&&e.splice(r,1),!u&&e[r][1].type==="definition"&&(u=r);const s={type:"setextHeading",start:{...e[l][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",u?(e.splice(a,0,["enter",s,n]),e.splice(u+1,0,["exit",e[l][1],n]),e[l][1].end={...e[u][1].end}):e[l][1]=s,e.push(["exit",s,n]),e}function BR(e,n,r){const l=this;let a;return u;function u(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"),a=h,s(h)):r(h)}function s(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===a?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),Be(h)?Fe(e,d,"lineSuffix")(h):d(h))}function d(h){return h===null||ke(h)?(e.exit("setextHeadingLine"),n(h)):r(h)}}const IR={tokenize:qR};function qR(e){const n=this,r=e.attempt(ts,l,e.attempt(this.parser.constructs.flowInitial,a,Fe(e,e.attempt(this.parser.constructs.flow,a,e.attempt(FD,a)),"linePrefix")));return r;function l(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),n.currentConstruct=void 0,r}function a(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),n.currentConstruct=void 0,r}}const UR={resolveAll:q_()},VR=I_("string"),$R=I_("text");function I_(e){return{resolveAll:q_(e==="text"?YR:void 0),tokenize:n};function n(r){const l=this,a=this.parser.constructs[e],u=r.attempt(a,s,f);return s;function s(m){return h(m)?u(m):f(m)}function f(m){if(m===null){r.consume(m);return}return r.enter("data"),r.consume(m),d}function d(m){return h(m)?(r.exit("data"),u(m)):(r.consume(m),d)}function h(m){if(m===null)return!0;const p=a[m];let y=-1;if(p)for(;++y-1){const f=s[0];typeof f=="string"?s[0]=f.slice(l):s.shift()}u>0&&s.push(e[a].slice(0,u))}return s}function rO(e,n){let r=-1;const l=[];let a;for(;++r0){const Pt=Ne.tokenStack[Ne.tokenStack.length-1];(Pt[1]||Nb).call(Ne,void 0,Pt[0])}for(ge.position={start:di(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:di(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},$e=-1;++$e0&&(l.className=["language-"+a[0]]);let u={type:"element",tagName:"code",properties:l,children:[{type:"text",value:r}]};return n.meta&&(u.data={meta:n.meta}),e.patch(n,u),u=e.applyData(n,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(n,u),u}function yO(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function xO(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function vO(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",l=String(n.identifier).toUpperCase(),a=ma(l.toLowerCase()),u=e.footnoteOrder.indexOf(l);let s,f=e.footnoteCounts.get(l);f===void 0?(f=0,e.footnoteOrder.push(l),s=e.footnoteOrder.length):s=u+1,f+=1,e.footnoteCounts.set(l,f);const d={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+a,id:r+"fnref-"+a+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};e.patch(n,d);const h={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(n,h),e.applyData(n,h)}function bO(e,n){const r={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function wO(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function $_(e,n){const r=n.referenceType;let l="]";if(r==="collapsed"?l+="[]":r==="full"&&(l+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+l}];const a=e.all(n),u=a[0];u&&u.type==="text"?u.value="["+u.value:a.unshift({type:"text",value:"["});const s=a[a.length-1];return s&&s.type==="text"?s.value+=l:a.push({type:"text",value:l}),a}function SO(e,n){const r=String(n.identifier).toUpperCase(),l=e.definitionById.get(r);if(!l)return $_(e,n);const a={src:ma(l.url||""),alt:n.alt};l.title!==null&&l.title!==void 0&&(a.title=l.title);const u={type:"element",tagName:"img",properties:a,children:[]};return e.patch(n,u),e.applyData(n,u)}function _O(e,n){const r={src:ma(n.url)};n.alt!==null&&n.alt!==void 0&&(r.alt=n.alt),n.title!==null&&n.title!==void 0&&(r.title=n.title);const l={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,l),e.applyData(n,l)}function EO(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const l={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,l),e.applyData(n,l)}function kO(e,n){const r=String(n.identifier).toUpperCase(),l=e.definitionById.get(r);if(!l)return $_(e,n);const a={href:ma(l.url||"")};l.title!==null&&l.title!==void 0&&(a.title=l.title);const u={type:"element",tagName:"a",properties:a,children:e.all(n)};return e.patch(n,u),e.applyData(n,u)}function NO(e,n){const r={href:ma(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const l={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,l),e.applyData(n,l)}function CO(e,n,r){const l=e.all(n),a=r?TO(r):Y_(n),u={},s=[];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:[]}),u.className=["task-list-item"]}let f=-1;for(;++f1}function AO(e,n){const r={},l=e.all(n);let a=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.start);++a0){const s={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},f=Rm(n.children[1]),d=__(n.children[n.children.length-1]);f&&d&&(s.position={start:f,end:d}),a.push(s)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(n,u),e.applyData(n,u)}function RO(e,n,r){const l=r?r.children:void 0,u=(l?l.indexOf(n):1)===0?"th":"td",s=r&&r.type==="table"?r.align:void 0,f=s?s.length:n.children.length;let d=-1;const h=[];for(;++d0,!0),l[0]),a=l.index+l[0].length,l=r.exec(n);return u.push(Ab(n.slice(a),a>0,!1)),u.join("")}function Ab(e,n,r){let l=0,a=e.length;if(n){let u=e.codePointAt(l);for(;u===Cb||u===Tb;)l++,u=e.codePointAt(l)}if(r){let u=e.codePointAt(a-1);for(;u===Cb||u===Tb;)a--,u=e.codePointAt(a-1)}return a>l?e.slice(l,a):""}function HO(e,n){const r={type:"text",value:LO(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function BO(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const IO={blockquote:pO,break:mO,code:gO,delete:yO,emphasis:xO,footnoteReference:vO,heading:bO,html:wO,imageReference:SO,image:_O,inlineCode:EO,linkReference:kO,link:NO,listItem:CO,list:AO,paragraph:zO,root:MO,strong:jO,table:DO,tableCell:OO,tableRow:RO,text:HO,thematicBreak:BO,toml:qu,yaml:qu,definition:qu,footnoteDefinition:qu};function qu(){}const F_=-1,Rc=0,zo=1,pc=2,Um=3,Vm=4,$m=5,Ym=6,G_=7,P_=8,zb=typeof self=="object"?self:globalThis,qO=(e,n)=>{const r=(a,u)=>(e.set(u,a),a),l=a=>{if(e.has(a))return e.get(a);const[u,s]=n[a];switch(u){case Rc:case F_:return r(s,a);case zo:{const f=r([],a);for(const d of s)f.push(l(d));return f}case pc:{const f=r({},a);for(const[d,h]of s)f[l(d)]=l(h);return f}case Um:return r(new Date(s),a);case Vm:{const{source:f,flags:d}=s;return r(new RegExp(f,d),a)}case $m:{const f=r(new Map,a);for(const[d,h]of s)f.set(l(d),l(h));return f}case Ym:{const f=r(new Set,a);for(const d of s)f.add(l(d));return f}case G_:{const{name:f,message:d}=s;return r(new zb[f](d),a)}case P_:return r(BigInt(s),a);case"BigInt":return r(Object(BigInt(s)),a);case"ArrayBuffer":return r(new Uint8Array(s).buffer,s);case"DataView":{const{buffer:f}=new Uint8Array(s);return r(new DataView(f),s)}}return r(new zb[u](s),a)};return l},Mb=e=>qO(new Map,e)(0),$l="",{toString:UO}={},{keys:VO}=Object,vo=e=>{const n=typeof e;if(n!=="object"||!e)return[Rc,n];const r=UO.call(e).slice(8,-1);switch(r){case"Array":return[zo,$l];case"Object":return[pc,$l];case"Date":return[Um,$l];case"RegExp":return[Vm,$l];case"Map":return[$m,$l];case"Set":return[Ym,$l];case"DataView":return[zo,r]}return r.includes("Array")?[zo,r]:r.includes("Error")?[G_,r]:[pc,r]},Uu=([e,n])=>e===Rc&&(n==="function"||n==="symbol"),$O=(e,n,r,l)=>{const a=(s,f)=>{const d=l.push(s)-1;return r.set(f,d),d},u=s=>{if(r.has(s))return r.get(s);let[f,d]=vo(s);switch(f){case Rc:{let m=s;switch(d){case"bigint":f=P_,m=s.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);m=null;break;case"undefined":return a([F_],s)}return a([f,m],s)}case zo:{if(d){let y=s;return d==="DataView"?y=new Uint8Array(s.buffer):d==="ArrayBuffer"&&(y=new Uint8Array(s)),a([d,[...y]],s)}const m=[],p=a([f,m],s);for(const y of s)m.push(u(y));return p}case pc:{if(d)switch(d){case"BigInt":return a([d,s.toString()],s);case"Boolean":case"Number":case"String":return a([d,s.valueOf()],s)}if(n&&"toJSON"in s)return u(s.toJSON());const m=[],p=a([f,m],s);for(const y of VO(s))(e||!Uu(vo(s[y])))&&m.push([u(y),u(s[y])]);return p}case Um:return a([f,s.toISOString()],s);case Vm:{const{source:m,flags:p}=s;return a([f,{source:m,flags:p}],s)}case $m:{const m=[],p=a([f,m],s);for(const[y,x]of s)(e||!(Uu(vo(y))||Uu(vo(x))))&&m.push([u(y),u(x)]);return p}case Ym:{const m=[],p=a([f,m],s);for(const y of s)(e||!Uu(vo(y)))&&m.push(u(y));return p}}const{message:h}=s;return a([f,{name:d,message:h}],s)};return u},jb=(e,{json:n,lossy:r}={})=>{const l=[];return $O(!(n||r),!!n,new Map,l)(e),l},mc=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?Mb(jb(e,n)):structuredClone(e):(e,n)=>Mb(jb(e,n));function YO(e,n){const r=[{type:"text",value:"↩"}];return n>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),r}function FO(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function GO(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||YO,l=e.options.footnoteBackLabel||FO,a=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",s=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let d=-1;for(;++d0&&w.push({type:"text",value:" "});let T=typeof r=="string"?r:r(d,x);typeof T=="string"&&(T={type:"text",value:T}),w.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+y+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof l=="string"?l:l(d,x),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}const _=m[m.length-1];if(_&&_.type==="element"&&_.tagName==="p"){const T=_.children[_.children.length-1];T&&T.type==="text"?T.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:u,properties:{...mc(s),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:` +`}]}}const Oc=(function(e){if(e==null)return ZO;if(typeof e=="function")return Lc(e);if(typeof e=="object")return Array.isArray(e)?PO(e):XO(e);if(typeof e=="string")return QO(e);throw new Error("Expected function, string, or object as test")});function PO(e){const n=[];let r=-1;for(;++r":""))+")"})}return y;function y(){let x=X_,w,E,_;if((!n||u(d,h,m[m.length-1]||void 0))&&(x=e6(r(d,m)),x[0]===tm))return x;if("children"in d&&d.children){const S=d;if(S.children&&x[0]!==WO)for(E=(l?S.children.length:-1)+s,_=m.concat(S);E>-1&&E0&&r.push({type:"text",value:` +`}),r}function Db(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function Rb(e,n){const r=n6(e,n),l=r.one(e,void 0),a=GO(r),u=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return a&&u.children.push({type:"text",value:` +`},a),u}function o6(e,n){return e&&"run"in e?async function(r,l){const a=Rb(r,{file:l,...n});await e.run(a,l)}:function(r,l){return Rb(r,{file:l,...e||n})}}function Ob(e){if(e)throw e}var xp,Lb;function s6(){if(Lb)return xp;Lb=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,l=Object.getOwnPropertyDescriptor,a=function(h){return typeof Array.isArray=="function"?Array.isArray(h):n.call(h)==="[object Array]"},u=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)},s=function(h,m){r&&m.name==="__proto__"?r(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 xp=function d(){var h,m,p,y,x,w,E=arguments[0],_=1,S=arguments.length,T=!1;for(typeof E=="boolean"&&(T=E,E=arguments[1]||{},_=2),(E==null||typeof E!="object"&&typeof E!="function")&&(E={});_s.length;let d;f&&s.push(a);try{d=e.apply(this,s)}catch(h){const m=h;if(f&&r)throw m;return a(m)}f||(d&&d.then&&typeof d.then=="function"?d.then(u,a):d instanceof Error?a(d):u(d))}function a(s,...f){r||(r=!0,n(s,...f))}function u(s){a(null,s)}}const Wn={basename:d6,dirname:h6,extname:p6,join:m6,sep:"/"};function d6(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');ns(e);let r=0,l=-1,a=e.length,u;if(n===void 0||n.length===0||n.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(u){r=a+1;break}}else l<0&&(u=!0,l=a+1);return l<0?"":e.slice(r,l)}if(n===e)return"";let s=-1,f=n.length-1;for(;a--;)if(e.codePointAt(a)===47){if(u){r=a+1;break}}else s<0&&(u=!0,s=a+1),f>-1&&(e.codePointAt(a)===n.codePointAt(f--)?f<0&&(l=a):(f=-1,l=s));return r===l?l=s:l<0&&(l=e.length),e.slice(r,l)}function h6(e){if(ns(e),e.length===0)return".";let n=-1,r=e.length,l;for(;--r;)if(e.codePointAt(r)===47){if(l){n=r;break}}else l||(l=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function p6(e){ns(e);let n=e.length,r=-1,l=0,a=-1,u=0,s;for(;n--;){const f=e.codePointAt(n);if(f===47){if(s){l=n+1;break}continue}r<0&&(s=!0,r=n+1),f===46?a<0?a=n:u!==1&&(u=1):a>-1&&(u=-1)}return a<0||r<0||u===0||u===1&&a===r-1&&a===l+1?"":e.slice(a,r)}function m6(...e){let n=-1,r;for(;++n0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function y6(e,n){let r="",l=0,a=-1,u=0,s=-1,f,d;for(;++s<=e.length;){if(s2){if(d=r.lastIndexOf("/"),d!==r.length-1){d<0?(r="",l=0):(r=r.slice(0,d),l=r.length-1-r.lastIndexOf("/")),a=s,u=0;continue}}else if(r.length>0){r="",l=0,a=s,u=0;continue}}n&&(r=r.length>0?r+"/..":"..",l=2)}else r.length>0?r+="/"+e.slice(a+1,s):r=e.slice(a+1,s),l=s-a-1;a=s,u=0}else f===46&&u>-1?u++:u=-1}return r}function ns(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const x6={cwd:v6};function v6(){return"/"}function im(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function b6(e){if(typeof e=="string")e=new URL(e);else if(!im(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 w6(e)}function w6(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 r=-1;for(;++r0){let[x,...w]=m;const E=l[y][1];rm(E)&&rm(x)&&(x=vp(!0,E,x)),l[y]=[h,x,...w]}}}}const k6=new Gm().freeze();function _p(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ep(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function kp(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 Bb(e){if(!rm(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ib(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function Vu(e){return N6(e)?e:new Z_(e)}function N6(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function C6(e){return typeof e=="string"||T6(e)}function T6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const A6="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",qb=[],Ub={allowDangerousHtml:!0},z6=/^(https?|ircs?|mailto|xmpp)$/i,M6=[{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 K_(e){const n=j6(e),r=D6(e);return R6(n.runSync(n.parse(r),r),e)}function j6(e){const n=e.rehypePlugins||qb,r=e.remarkPlugins||qb,l=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ub}:Ub;return k6().use(hO).use(r).use(o6,l).use(n)}function D6(e){const n=e.children||"",r=new Z_;return typeof n=="string"&&(r.value=n),r}function R6(e,n){const r=n.allowedElements,l=n.allowElement,a=n.components,u=n.disallowedElements,s=n.skipHtml,f=n.unwrapDisallowed,d=n.urlTransform||O6;for(const m of M6)Object.hasOwn(n,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+A6+m.id,void 0);return Fm(e,h),Z5(e,{Fragment:b.Fragment,components:a,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 s?y.children.splice(p,1):y.children[p]={type:"text",value:m.value},p;if(m.type==="element"){let x;for(x in mp)if(Object.hasOwn(mp,x)&&Object.hasOwn(m.properties,x)){const w=m.properties[x],E=mp[x];(E===null||E.includes(m.tagName))&&(m.properties[x]=d(String(w||""),x,m))}}if(m.type==="element"){let x=r?!r.includes(m.tagName):u?u.includes(m.tagName):!1;if(!x&&l&&typeof p=="number"&&(x=!l(m,p,y)),x&&y&&typeof p=="number")return f&&m.children?y.children.splice(p,1,...m.children):y.children.splice(p,1),p}}}function O6(e){const n=e.indexOf(":"),r=e.indexOf("?"),l=e.indexOf("#"),a=e.indexOf("/");return n===-1||a!==-1&&n>a||r!==-1&&n>r||l!==-1&&n>l||z6.test(e.slice(0,n))?e:""}function Vb(e,n){const r=String(e);if(typeof n!="string")throw new TypeError("Expected character");let l=0,a=r.indexOf(n);for(;a!==-1;)l++,a=r.indexOf(n,a+n.length);return l}function L6(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function H6(e,n,r){const a=Oc((r||{}).ignore||[]),u=B6(n);let s=-1;for(;++s0?{type:"text",value:A}:void 0),A===!1?y.lastIndex=z+1:(w!==z&&T.push({type:"text",value:h.value.slice(w,z)}),Array.isArray(A)?T.push(...A):A&&T.push(A),w=z+k[0].length,S=!0),!y.global)break;k=y.exec(h.value)}return S?(w?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],l=r.indexOf(")");const a=Vb(e,"(");let u=Vb(e,")");for(;l!==-1&&a>u;)e+=r.slice(0,l+1),r=r.slice(l+1),l=r.indexOf(")"),u++;return[e,r]}function J_(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||Ji(r)||jc(r))&&(!n||r!==47)}W_.peek=oL;function W6(){this.buffer()}function eL(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function tL(){this.buffer()}function nL(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function rL(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Yn(this.sliceSerialize(e)).toLowerCase(),r.label=n}function iL(e){this.exit(e)}function lL(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Yn(this.sliceSerialize(e)).toLowerCase(),r.label=n}function aL(e){this.exit(e)}function oL(){return"["}function W_(e,n,r,l){const a=r.createTracker(l);let u=a.move("[^");const s=r.enter("footnoteReference"),f=r.enter("reference");return u+=a.move(r.safe(r.associationId(e),{after:"]",before:u})),f(),s(),u+=a.move("]"),u}function sL(){return{enter:{gfmFootnoteCallString:W6,gfmFootnoteCall:eL,gfmFootnoteDefinitionLabelString:tL,gfmFootnoteDefinition:nL},exit:{gfmFootnoteCallString:rL,gfmFootnoteCall:iL,gfmFootnoteDefinitionLabelString:lL,gfmFootnoteDefinition:aL}}}function uL(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:W_},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(l,a,u,s){const f=u.createTracker(s);let d=f.move("[^");const h=u.enter("footnoteDefinition"),m=u.enter("label");return d+=f.move(u.safe(u.associationId(l),{before:d,after:"]"})),m(),d+=f.move("]:"),l.children&&l.children.length>0&&(f.shift(4),d+=f.move((n?` +`:" ")+u.indentLines(u.containerFlow(l,f.current()),n?eE:cL))),h(),d}}function cL(e,n,r){return n===0?e:eE(e,n,r)}function eE(e,n,r){return(r?"":" ")+e}const fL=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];tE.peek=gL;function dL(){return{canContainEols:["delete"],enter:{strikethrough:pL},exit:{strikethrough:mL}}}function hL(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:fL}],handlers:{delete:tE}}}function pL(e){this.enter({type:"delete",children:[]},e)}function mL(e){this.exit(e)}function tE(e,n,r,l){const a=r.createTracker(l),u=r.enter("strikethrough");let s=a.move("~~");return s+=r.containerPhrasing(e,{...a.current(),before:s,after:"~"}),s+=a.move("~~"),u(),s}function gL(){return"~"}function yL(e){return e.length}function xL(e,n){const r=n||{},l=(r.align||[]).concat(),a=r.stringLength||yL,u=[],s=[],f=[],d=[];let h=0,m=-1;for(;++mh&&(h=e[m].length);++Sd[S])&&(d[S]=k)}E.push(T)}s[m]=E,f[m]=_}let p=-1;if(typeof l=="object"&&"length"in l)for(;++pd[p]&&(d[p]=T),x[p]=T),y[p]=k}s.splice(1,0,y),f.splice(1,0,x),m=-1;const w=[];for(;++m "),u.shift(2);const s=r.indentLines(r.containerFlow(e,u.current()),wL);return a(),s}function wL(e,n,r){return">"+(r?"":" ")+e}function SL(e,n){return Yb(e,n.inConstruct,!0)&&!Yb(e,n.notInConstruct,!1)}function Yb(e,n,r){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return r;let l=-1;for(;++ls&&(s=u):u=1,a=l+n.length,l=r.indexOf(n,a);return s}function EL(e,n){return!!(n.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function kL(e){const n=e.options.fence||"`";if(n!=="`"&&n!=="~")throw new Error("Cannot serialize code with `"+n+"` for `options.fence`, expected `` ` `` or `~`");return n}function NL(e,n,r,l){const a=kL(r),u=e.value||"",s=a==="`"?"GraveAccent":"Tilde";if(EL(e,r)){const p=r.enter("codeIndented"),y=r.indentLines(u,CL);return p(),y}const f=r.createTracker(l),d=a.repeat(Math.max(_L(u,a)+1,3)),h=r.enter("codeFenced");let m=f.move(d);if(e.lang){const p=r.enter(`codeFencedLang${s}`);m+=f.move(r.safe(e.lang,{before:m,after:" ",encode:["`"],...f.current()})),p()}if(e.lang&&e.meta){const p=r.enter(`codeFencedMeta${s}`);m+=f.move(" "),m+=f.move(r.safe(e.meta,{before:m,after:` +`,encode:["`"],...f.current()})),p()}return m+=f.move(` +`),u&&(m+=f.move(u+` +`)),m+=f.move(d),h(),m}function CL(e,n,r){return(r?"":" ")+e}function Pm(e){const n=e.options.quote||'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize title with `"+n+"` for `options.quote`, expected `\"`, or `'`");return n}function TL(e,n,r,l){const a=Pm(r),u=a==='"'?"Quote":"Apostrophe",s=r.enter("definition");let f=r.enter("label");const d=r.createTracker(l);let h=d.move("[");return h+=d.move(r.safe(r.associationId(e),{before:h,after:"]",...d.current()})),h+=d.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(r.safe(e.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(f=r.enter("destinationRaw"),h+=d.move(r.safe(e.url,{before:h,after:e.title?" ":` +`,...d.current()}))),f(),e.title&&(f=r.enter(`title${u}`),h+=d.move(" "+a),h+=d.move(r.safe(e.title,{before:h,after:a,...d.current()})),h+=d.move(a),f()),s(),h}function AL(e){const n=e.options.emphasis||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize emphasis with `"+n+"` for `options.emphasis`, expected `*`, or `_`");return n}function $o(e){return"&#x"+e.toString(16).toUpperCase()+";"}function gc(e,n,r){const l=ca(e),a=ca(n);return l===void 0?a===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:l===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}nE.peek=zL;function nE(e,n,r,l){const a=AL(r),u=r.enter("emphasis"),s=r.createTracker(l),f=s.move(a);let d=s.move(r.containerPhrasing(e,{after:a,before:f,...s.current()}));const h=d.charCodeAt(0),m=gc(l.before.charCodeAt(l.before.length-1),h,a);m.inside&&(d=$o(h)+d.slice(1));const p=d.charCodeAt(d.length-1),y=gc(l.after.charCodeAt(0),p,a);y.inside&&(d=d.slice(0,-1)+$o(p));const x=s.move(a);return u(),r.attentionEncodeSurroundingInfo={after:y.outside,before:m.outside},f+d+x}function zL(e,n,r){return r.options.emphasis||"*"}function ML(e,n){let r=!1;return Fm(e,function(l){if("value"in l&&/\r?\n|\r/.test(l.value)||l.type==="break")return r=!0,tm}),!!((!e.depth||e.depth<3)&&Bm(e)&&(n.options.setext||r))}function jL(e,n,r,l){const a=Math.max(Math.min(6,e.depth||1),1),u=r.createTracker(l);if(ML(e,r)){const m=r.enter("headingSetext"),p=r.enter("phrasing"),y=r.containerPhrasing(e,{...u.current(),before:` +`,after:` +`});return p(),m(),y+` +`+(a===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(` +`))+1))}const s="#".repeat(a),f=r.enter("headingAtx"),d=r.enter("phrasing");u.move(s+" ");let h=r.containerPhrasing(e,{before:"# ",after:` +`,...u.current()});return/^[\t ]/.test(h)&&(h=$o(h.charCodeAt(0))+h.slice(1)),h=h?s+" "+h:s,r.options.closeAtx&&(h+=" "+s),d(),f(),h}rE.peek=DL;function rE(e){return e.value||""}function DL(){return"<"}iE.peek=RL;function iE(e,n,r,l){const a=Pm(r),u=a==='"'?"Quote":"Apostrophe",s=r.enter("image");let f=r.enter("label");const d=r.createTracker(l);let h=d.move("![");return h+=d.move(r.safe(e.alt,{before:h,after:"]",...d.current()})),h+=d.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(r.safe(e.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(f=r.enter("destinationRaw"),h+=d.move(r.safe(e.url,{before:h,after:e.title?" ":")",...d.current()}))),f(),e.title&&(f=r.enter(`title${u}`),h+=d.move(" "+a),h+=d.move(r.safe(e.title,{before:h,after:a,...d.current()})),h+=d.move(a),f()),h+=d.move(")"),s(),h}function RL(){return"!"}lE.peek=OL;function lE(e,n,r,l){const a=e.referenceType,u=r.enter("imageReference");let s=r.enter("label");const f=r.createTracker(l);let d=f.move("![");const h=r.safe(e.alt,{before:d,after:"]",...f.current()});d+=f.move(h+"]["),s();const m=r.stack;r.stack=[],s=r.enter("reference");const p=r.safe(r.associationId(e),{before:d,after:"]",...f.current()});return s(),r.stack=m,u(),a==="full"||!h||h!==p?d+=f.move(p+"]"):a==="shortcut"?d=d.slice(0,-1):d+=f.move("]"),d}function OL(){return"!"}aE.peek=LL;function aE(e,n,r){let l=e.value||"",a="`",u=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(l);)a+="`";for(/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^`|`$/.test(l))&&(l=" "+l+" ");++u\u007F]/.test(e.url))}sE.peek=HL;function sE(e,n,r,l){const a=Pm(r),u=a==='"'?"Quote":"Apostrophe",s=r.createTracker(l);let f,d;if(oE(e,r)){const m=r.stack;r.stack=[],f=r.enter("autolink");let p=s.move("<");return p+=s.move(r.containerPhrasing(e,{before:p,after:">",...s.current()})),p+=s.move(">"),f(),r.stack=m,p}f=r.enter("link"),d=r.enter("label");let h=s.move("[");return h+=s.move(r.containerPhrasing(e,{before:h,after:"](",...s.current()})),h+=s.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=r.enter("destinationLiteral"),h+=s.move("<"),h+=s.move(r.safe(e.url,{before:h,after:">",...s.current()})),h+=s.move(">")):(d=r.enter("destinationRaw"),h+=s.move(r.safe(e.url,{before:h,after:e.title?" ":")",...s.current()}))),d(),e.title&&(d=r.enter(`title${u}`),h+=s.move(" "+a),h+=s.move(r.safe(e.title,{before:h,after:a,...s.current()})),h+=s.move(a),d()),h+=s.move(")"),f(),h}function HL(e,n,r){return oE(e,r)?"<":"["}uE.peek=BL;function uE(e,n,r,l){const a=e.referenceType,u=r.enter("linkReference");let s=r.enter("label");const f=r.createTracker(l);let d=f.move("[");const h=r.containerPhrasing(e,{before:d,after:"]",...f.current()});d+=f.move(h+"]["),s();const m=r.stack;r.stack=[],s=r.enter("reference");const p=r.safe(r.associationId(e),{before:d,after:"]",...f.current()});return s(),r.stack=m,u(),a==="full"||!h||h!==p?d+=f.move(p+"]"):a==="shortcut"?d=d.slice(0,-1):d+=f.move("]"),d}function BL(){return"["}function Xm(e){const n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function IL(e){const n=Xm(e),r=e.options.bulletOther;if(!r)return n==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+r+"`) to be different");return r}function qL(e){const n=e.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function cE(e){const n=e.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function UL(e,n,r,l){const a=r.enter("list"),u=r.bulletCurrent;let s=e.ordered?qL(r):Xm(r);const f=e.ordered?s==="."?")":".":IL(r);let d=n&&r.bulletLastUsed?s===r.bulletLastUsed:!1;if(!e.ordered){const m=e.children?e.children[0]:void 0;if((s==="*"||s==="-")&&m&&(!m.children||!m.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(d=!0),cE(r)===s&&m){let p=-1;for(;++p-1?n.start:1)+(r.options.incrementListMarker===!1?0:n.children.indexOf(e))+u);let s=u.length+1;(a==="tab"||a==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(s=Math.ceil(s/4)*4);const f=r.createTracker(l);f.move(u+" ".repeat(s-u.length)),f.shift(s);const d=r.enter("listItem"),h=r.indentLines(r.containerFlow(e,f.current()),m);return d(),h;function m(p,y,x){return y?(x?"":" ".repeat(s))+p:(x?u:u+" ".repeat(s-u.length))+p}}function YL(e,n,r,l){const a=r.enter("paragraph"),u=r.enter("phrasing"),s=r.containerPhrasing(e,l);return u(),a(),s}const FL=Oc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function GL(e,n,r,l){return(e.children.some(function(s){return FL(s)})?r.containerPhrasing:r.containerFlow).call(r,e,l)}function PL(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}fE.peek=XL;function fE(e,n,r,l){const a=PL(r),u=r.enter("strong"),s=r.createTracker(l),f=s.move(a+a);let d=s.move(r.containerPhrasing(e,{after:a,before:f,...s.current()}));const h=d.charCodeAt(0),m=gc(l.before.charCodeAt(l.before.length-1),h,a);m.inside&&(d=$o(h)+d.slice(1));const p=d.charCodeAt(d.length-1),y=gc(l.after.charCodeAt(0),p,a);y.inside&&(d=d.slice(0,-1)+$o(p));const x=s.move(a+a);return u(),r.attentionEncodeSurroundingInfo={after:y.outside,before:m.outside},f+d+x}function XL(e,n,r){return r.options.strong||"*"}function QL(e,n,r,l){return r.safe(e.value,l)}function ZL(e){const n=e.options.ruleRepetition||3;if(n<3)throw new Error("Cannot serialize rules with repetition `"+n+"` for `options.ruleRepetition`, expected `3` or more");return n}function KL(e,n,r){const l=(cE(r)+(r.options.ruleSpaces?" ":"")).repeat(ZL(r));return r.options.ruleSpaces?l.slice(0,-1):l}const dE={blockquote:bL,break:Fb,code:NL,definition:TL,emphasis:nE,hardBreak:Fb,heading:jL,html:rE,image:iE,imageReference:lE,inlineCode:aE,link:sE,linkReference:uE,list:UL,listItem:$L,paragraph:YL,root:GL,strong:fE,text:QL,thematicBreak:KL};function JL(){return{enter:{table:WL,tableData:Gb,tableHeader:Gb,tableRow:t8},exit:{codeText:n8,table:e8,tableData:Ap,tableHeader:Ap,tableRow:Ap}}}function WL(e){const n=e._align;this.enter({type:"table",align:n.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function e8(e){this.exit(e),this.data.inTable=void 0}function t8(e){this.enter({type:"tableRow",children:[]},e)}function Ap(e){this.exit(e)}function Gb(e){this.enter({type:"tableCell",children:[]},e)}function n8(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,r8));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function r8(e,n){return n==="|"?n:e}function i8(e){const n=e||{},r=n.tableCellPadding,l=n.tablePipeAlign,a=n.stringLength,u=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:s,tableCell:d,tableRow:f}};function s(x,w,E,_){return h(m(x,E,_),x.align)}function f(x,w,E,_){const S=p(x,E,_),T=h([S]);return T.slice(0,T.indexOf(` +`))}function d(x,w,E,_){const S=E.enter("tableCell"),T=E.enter("phrasing"),k=E.containerPhrasing(x,{..._,before:u,after:u});return T(),S(),k}function h(x,w){return xL(x,{align:w,alignDelimiters:l,padding:r,stringLength:a})}function m(x,w,E){const _=x.children;let S=-1;const T=[],k=w.enter("table");for(;++S<_.length;)T[S]=p(_[S],w,E);return k(),T}function p(x,w,E){const _=x.children;let S=-1;const T=[],k=w.enter("tableRow");for(;++S<_.length;)T[S]=d(_[S],x,w,E);return k(),T}function y(x,w,E){let _=dE.inlineCode(x,w,E);return E.stack.includes("tableCell")&&(_=_.replace(/\|/g,"\\$&")),_}}function l8(){return{exit:{taskListCheckValueChecked:Pb,taskListCheckValueUnchecked:Pb,paragraph:o8}}}function a8(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:s8}}}function Pb(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function o8(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const l=r.children[0];if(l&&l.type==="text"){const a=n.children;let u=-1,s;for(;++u0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const S8={tokenize:z8,partial:!0};function _8(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:C8,continuation:{tokenize:T8},exit:A8}},text:{91:{name:"gfmFootnoteCall",tokenize:N8},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:E8,resolveTo:k8}}}}function E8(e,n,r){const l=this;let a=l.events.length;const u=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let s;for(;a--;){const d=l.events[a][1];if(d.type==="labelImage"){s=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return f;function f(d){if(!s||!s._balanced)return r(d);const h=Yn(l.sliceSerialize({start:s.end,end:l.now()}));return h.codePointAt(0)!==94||!u.includes(h.slice(1))?r(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),n(d))}}function k8(e,n){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const l={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},f=[e[r+1],e[r+2],["enter",l,n],e[r+3],e[r+4],["enter",a,n],["exit",a,n],["enter",u,n],["enter",s,n],["exit",s,n],["exit",u,n],e[e.length-2],e[e.length-1],["exit",l,n]];return e.splice(r,e.length-r+1,...f),e}function N8(e,n,r){const l=this,a=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let u=0,s;return f;function f(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),d}function d(p){return p!==94?r(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(p){if(u>999||p===93&&!s||p===null||p===91||ot(p))return r(p);if(p===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return a.includes(Yn(l.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):r(p)}return ot(p)||(s=!0),u++,e.consume(p),p===92?m:h}function m(p){return p===91||p===92||p===93?(e.consume(p),u++,h):h(p)}}function C8(e,n,r){const l=this,a=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let u,s=0,f;return d;function d(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",m):r(w)}function m(w){if(s>999||w===93&&!f||w===null||w===91||ot(w))return r(w);if(w===93){e.exit("chunkString");const E=e.exit("gfmFootnoteDefinitionLabelString");return u=Yn(l.sliceSerialize(E)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return ot(w)||(f=!0),s++,e.consume(w),w===92?p:m}function p(w){return w===91||w===92||w===93?(e.consume(w),s++,m):m(w)}function y(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),a.includes(u)||a.push(u),Fe(e,x,"gfmFootnoteDefinitionWhitespace")):r(w)}function x(w){return n(w)}}function T8(e,n,r){return e.check(ts,n,e.attempt(S8,n,r))}function A8(e){e.exit("gfmFootnoteDefinition")}function z8(e,n,r){const l=this;return Fe(e,a,"gfmFootnoteDefinitionIndent",5);function a(u){const s=l.events[l.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?n(u):r(u)}}function M8(e){let r=(e||{}).singleTilde;const l={name:"strikethrough",tokenize:u,resolveAll:a};return r==null&&(r=!0),{text:{126:l},insideSpan:{null:[l]},attentionMarkers:{null:[126]}};function a(s,f){let d=-1;for(;++d1?d(w):(s.consume(w),p++,x);if(p<2&&!r)return d(w);const _=s.exit("strikethroughSequenceTemporary"),S=ca(w);return _._open=!S||S===2&&!!E,_._close=!E||E===2&&!!S,f(w)}}}class j8{constructor(){this.map=[]}add(n,r,l){D8(this,n,r,l)}consume(n){if(this.map.sort(function(u,s){return u[0]-s[0]}),this.map.length===0)return;let r=this.map.length;const l=[];for(;r>0;)r-=1,l.push(n.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),n.length=this.map[r][0];l.push(n.slice()),n.length=0;let a=l.pop();for(;a;){for(const u of a)n.push(u);a=l.pop()}this.map.length=0}}function D8(e,n,r,l){let a=0;if(!(r===0&&l.length===0)){for(;a-1;){const I=l.events[B][1].type;if(I==="lineEnding"||I==="linePrefix")B--;else break}const U=B>-1?l.events[B][1].type:null,W=U==="tableHead"||U==="tableRow"?A:d;return W===A&&l.parser.lazy[l.now().line]?r(R):W(R)}function d(R){return e.enter("tableHead"),e.enter("tableRow"),h(R)}function h(R){return R===124||(s=!0,u+=1),m(R)}function m(R){return R===null?r(R):ke(R)?u>1?(u=0,l.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),x):r(R):Be(R)?Fe(e,m,"whitespace")(R):(u+=1,s&&(s=!1,a+=1),R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),s=!0,m):(e.enter("data"),p(R)))}function p(R){return R===null||R===124||ot(R)?(e.exit("data"),m(R)):(e.consume(R),R===92?y:p)}function y(R){return R===92||R===124?(e.consume(R),p):p(R)}function x(R){return l.interrupt=!1,l.parser.lazy[l.now().line]?r(R):(e.enter("tableDelimiterRow"),s=!1,Be(R)?Fe(e,w,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):w(R))}function w(R){return R===45||R===58?_(R):R===124?(s=!0,e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),E):M(R)}function E(R){return Be(R)?Fe(e,_,"whitespace")(R):_(R)}function _(R){return R===58?(u+=1,s=!0,e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),S):R===45?(u+=1,S(R)):R===null||ke(R)?z(R):M(R)}function S(R){return R===45?(e.enter("tableDelimiterFiller"),T(R)):M(R)}function T(R){return R===45?(e.consume(R),T):R===58?(s=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),k):(e.exit("tableDelimiterFiller"),k(R))}function k(R){return Be(R)?Fe(e,z,"whitespace")(R):z(R)}function z(R){return R===124?w(R):R===null||ke(R)?!s||a!==u?M(R):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(R)):M(R)}function M(R){return r(R)}function A(R){return e.enter("tableRow"),q(R)}function q(R){return R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),q):R===null||ke(R)?(e.exit("tableRow"),n(R)):Be(R)?Fe(e,q,"whitespace")(R):(e.enter("data"),j(R))}function j(R){return R===null||R===124||ot(R)?(e.exit("data"),q(R)):(e.consume(R),R===92?H:j)}function H(R){return R===92||R===124?(e.consume(R),j):j(R)}}function H8(e,n){let r=-1,l=!0,a=0,u=[0,0,0,0],s=[0,0,0,0],f=!1,d=0,h,m,p;const y=new j8;for(;++rr[2]+1){const w=r[2]+1,E=r[3]-r[2]-1;e.add(w,E,[])}}e.add(r[3]+1,0,[["exit",p,n]])}return a!==void 0&&(u.end=Object.assign({},Fl(n.events,a)),e.add(a,0,[["exit",u,n]]),u=void 0),u}function Xb(e,n,r,l,a){const u=[],s=Fl(n.events,r);a&&(a.end=Object.assign({},s),u.push(["exit",a,n])),l.end=Object.assign({},s),u.push(["exit",l,n]),e.add(r+1,0,u)}function Fl(e,n){const r=e[n],l=r[0]==="enter"?"start":"end";return r[1][l]}const B8={name:"tasklistCheck",tokenize:q8};function I8(){return{text:{91:B8}}}function q8(e,n,r){const l=this;return a;function a(d){return l.previous!==null||!l._gfmTasklistFirstContentOfListItem?r(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),u)}function u(d){return ot(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),s):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),s):r(d)}function s(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):r(d)}function f(d){return ke(d)?n(d):Be(d)?e.check({tokenize:U8},n,r)(d):r(d)}}function U8(e,n,r){return Fe(e,l,"whitespace");function l(a){return a===null?r(a):n(a)}}function V8(e){return z_([h8(),_8(),M8(e),O8(),I8()])}const $8={};function wE(e){const n=this,r=e||$8,l=n.data(),a=l.micromarkExtensions||(l.micromarkExtensions=[]),u=l.fromMarkdownExtensions||(l.fromMarkdownExtensions=[]),s=l.toMarkdownExtensions||(l.toMarkdownExtensions=[]);a.push(V8(r)),u.push(u8()),s.push(c8(r))}const Y8=new Set([".md",".markdown",".mdx"]);function F8({filePath:e,onClose:n}){const[r,l]=$.useState(null),[a,u]=$.useState(null),[s,f]=$.useState(!0),d=$.useCallback(async()=>{f(!0),u(null);try{const m=e.split("/").map(x=>encodeURIComponent(x)).join("/"),p=await fetch(`/api/files/${m}`);if(!p.ok){const x=await p.json().catch(()=>({}));u(x.error||`HTTP ${p.status}`);return}const y=await p.json();l(y)}catch(m){u(m instanceof Error?m.message:"Failed to load file")}finally{f(!1)}},[e]);$.useEffect(()=>{d()},[d]),$.useEffect(()=>{const m=p=>{p.key==="Escape"&&n()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[n]);const h=r?Y8.has(r.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(tw,{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}),r&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] flex-shrink-0 tabular-nums",children:P8(r.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(da,{className:"w-4 h-4"})})]}),b.jsxs("div",{className:"flex-1 overflow-auto px-5 py-4 min-h-0",children:[s&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(ta,{className:"w-5 h-5 text-[var(--text-muted)] animate-spin"})}),a&&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(rw,{className:"w-4 h-4 text-red-400 flex-shrink-0"}),b.jsx("span",{className:"text-xs text-red-300",children:a})]}),r&&!a&&(h?b.jsx("div",{className:"file-viewer-markdown text-xs leading-relaxed text-[var(--text)]",children:b.jsx(G8,{content:r.content})}):b.jsx("pre",{className:"font-mono text-[11px] leading-[1.6] text-[var(--text)] whitespace-pre-wrap break-words",children:r.content}))]})]})})}function G8({content:e}){return b.jsx(K_,{remarkPlugins:[wE],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:r})=>(r==null?void 0:r.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:r})=>b.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:text-blue-300 underline underline-offset-2",children:r}),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 P8(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function X8({node:e}){const n=he(M=>M.sendGateResponse),r=he(M=>M.wsStatus),[l,a]=$.useState(null),[u,s]=$.useState(""),[f,d]=$.useState(null),[h,m]=$.useState(!1),[p,y]=$.useState(null),x=e.status==="waiting",w=e.status==="completed";$.useEffect(()=>{x&&(a(null),s(""),d(null),m(!1))},[x]);const E=x&&r==="connected"&&l===null,_=(M,A)=>{if(E){if(A){a(M),d(A);return}a(M),m(!0),n(e.name,M)}},S=()=>{if(l===null||f===null)return;const M={[f]:u};m(!0),n(e.name,l,M),d(null)},T=e.option_details,k=T==null?void 0:T.find(M=>M.value===e.selected_option),z=(k==null?void 0:k.label)||e.selected_option;return b.jsxs("div",{className:"space-y-3",children:[x&&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(zp,{text:e.prompt,muted:!1,onFileClick:y})}),T&&T.length>0&&b.jsxs("div",{className:"space-y-2",children:[b.jsx("div",{className:"flex flex-col gap-1.5",children:T.map(M=>{const A=l===M.value,q=l!==null&&!A;return b.jsx("button",{disabled:!E&&!A,onClick:()=>_(M.value,M.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":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:A?b.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500 flex items-center justify-center",children:b.jsx(Vi,{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 ${A?"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(ta,{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"})]}),!T&&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:u,onChange:M=>s(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(lN,{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(Vi,{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(zp,{text:e.prompt,muted:!0,onFileClick:y})}),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(Vi,{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]})]}),T&&T.length>1&&b.jsx("div",{className:"space-y-1",children:T.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))}),!T&&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(Z8,{node:e})]}),!x&&!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(zp,{text:e.prompt,muted:!0,onFileClick:y})})]}),p&&b.jsx(F8,{filePath:p,onClose:()=>y(null)})]})}function Q8(e){return!(!e||/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//")||e.startsWith("#")||e.startsWith("/")||e.startsWith("\\"))}function zp({text:e,muted:n,onFileClick:r}){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(K_,{remarkPlugins:[wE],components:{h1:({children:a})=>b.jsx("h1",{className:"text-sm font-bold mb-2 mt-1",children:a}),h2:({children:a})=>b.jsx("h2",{className:"text-xs font-bold mb-1.5 mt-1",children:a}),h3:({children:a})=>b.jsx("h3",{className:"text-xs font-semibold mb-1 mt-1",children:a}),p:({children:a})=>b.jsx("p",{className:"mb-1.5 last:mb-0",children:a}),ul:({children:a})=>b.jsx("ul",{className:"list-disc list-inside mb-1.5 space-y-0.5",children:a}),ol:({children:a})=>b.jsx("ol",{className:"list-decimal list-inside mb-1.5 space-y-0.5",children:a}),li:({children:a})=>b.jsx("li",{children:a}),code:({children:a,className:u})=>(u==null?void 0:u.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:a}):b.jsx("code",{className:"bg-[var(--bg)] border border-[var(--border)] rounded px-1 py-0.5 font-mono text-[11px]",children:a}),pre:({children:a})=>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:a}),strong:({children:a})=>b.jsx("strong",{className:"font-semibold",children:a}),em:({children:a})=>b.jsx("em",{className:"italic",children:a}),a:({href:a,children:u})=>r&&Q8(a)?b.jsxs("button",{onClick:s=>{s.preventDefault(),r(a)},className:"inline-flex items-center gap-0.5 text-blue-400 hover:text-blue-300 underline underline-offset-2 cursor-pointer",title:`Open ${a}`,children:[b.jsx(tw,{className:"w-3 h-3 inline flex-shrink-0"}),u]}):b.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:text-blue-300 underline underline-offset-2",children:u}),blockquote:({children:a})=>b.jsx("blockquote",{className:"border-l-2 border-[var(--border)] pl-2.5 my-1.5 opacity-80",children:a}),hr:()=>b.jsx("hr",{className:"border-[var(--border)] my-2"}),table:({children:a})=>b.jsx("div",{className:"overflow-x-auto my-2",children:b.jsx("table",{className:"text-[11px] border-collapse w-full",children:a})}),th:({children:a})=>b.jsx("th",{className:"border border-[var(--border)] px-2 py-1 text-left bg-[var(--bg)] font-semibold",children:a}),td:({children:a})=>b.jsx("td",{className:"border border-[var(--border)] px-2 py-1",children:a})},children:e})})}function Z8({node:e}){const n=[];if(e.route&&n.push({label:"Route",value:`→ ${e.route}`}),e.additional_input){const r=typeof e.additional_input=="object"?JSON.stringify(e.additional_input):e.additional_input;n.push({label:"Additional Input",value:r})}return n.length===0?null:b.jsx(ha,{items:n})}function K8({node:e}){const n=e.status,r=at[n]||at.pending,a=he(m=>m.groupProgress)[e.name],u=e.type==="for_each_group",[s,f]=$.useState(!0),d=[];e.elapsed!=null&&d.push({label:"Elapsed",value:on(e.elapsed)}),a&&(d.push({label:"Total",value:a.total}),d.push({label:"Completed",value:a.completed}),a.failed>0&&d.push({label:"Failed",value:a.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:`${r}20`,color:r},children:n}),b.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:u?"For-Each Group":"Parallel Group"})]}),a&&a.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:[a.completed+a.failed,"/",a.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:`${(a.completed+a.failed)/a.total*100}%`,background:a.failed>0?`linear-gradient(90deg, var(--completed) ${a.completed/(a.completed+a.failed)*100}%, var(--failed) 0%)`:"var(--completed)"}})})]}),b.jsx(ha,{items:d}),u&&h&&h.length>0&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("button",{onClick:()=>f(!s),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:[s?b.jsx(Wi,{className:"w-3 h-3"}):b.jsx(fa,{className:"w-3 h-3"}),"Items (",h.length,")"]}),s&&b.jsx("div",{className:"space-y-1",children:h.map(m=>b.jsx(W8,{item:m},`${m.key}-${m.index}`))})]})]})}const J8={running:at.running,completed:at.completed,failed:at.failed};function W8({item:e}){const[n,r]=$.useState(e.status==="running"),l=J8[e.status],a=!!(e.prompt||e.output!=null||e.activity&&e.activity.length>0||e.error_type),u=[];return e.elapsed!=null&&u.push({label:"Elapsed",value:on(e.elapsed)}),e.tokens!=null&&u.push({label:"Tokens",value:tr(e.tokens)}),e.cost_usd!=null&&u.push({label:"Cost",value:na(e.cost_usd)}),b.jsxs("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--surface)] overflow-hidden",children:[b.jsxs("button",{onClick:()=>a&&r(!n),className:"flex items-center gap-2 w-full px-3 py-2 text-left hover:bg-[var(--node-bg)] transition-colors",disabled:!a,children:[a?n?b.jsx(Wi,{className:"w-3 h-3 text-[var(--text-muted)] flex-shrink-0"}):b.jsx(fa,{className:"w-3 h-3 text-[var(--text-muted)] flex-shrink-0"}):e.status==="running"?b.jsx(ta,{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:on(e.elapsed)}),e.tokens!=null&&b.jsx("span",{children:tr(e.tokens)}),e.cost_usd!=null&&b.jsx("span",{children:na(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&&a&&b.jsxs("div",{className:"px-3 py-3 space-y-3 border-t border-[var(--border)]",children:[u.length>0&&b.jsx(ha,{items:u}),e.prompt&&b.jsx(Ki,{output:e.prompt,title:"Input / Prompt",defaultExpanded:!1}),e.activity&&e.activity.length>0&&b.jsx(Mm,{activity:e.activity,defaultExpanded:e.status!=="completed"}),e.output!=null&&b.jsx(Ki,{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 e9(){const e=he(f=>f.selectedNode),n=he(f=>f.nodes),r=he(f=>f.selectNode),[l,a]=$.useState(!1);$.useEffect(()=>(requestAnimationFrame(()=>a(!0)),()=>a(!1)),[e]);const u=e?n[e]:null;if(!e||!u)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 s=(()=>{switch(u.type){case"script":return w5;case"human_gate":return X8;case"parallel_group":case"for_each_group":return K8;default:return v5}})();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:()=>r(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(da,{className:"w-4 h-4"})})]}),b.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3",children:b.jsx(s,{node:u})})]})}function Ju(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function t9(){const e=he(_=>_.eventLog),n=he(_=>_.activityLog),r=he(_=>_.workflowOutput),l=he(_=>_.workflowStatus),[a,u]=$.useState("log"),[s,f]=$.useState(!1),[d,h]=$.useState(0),[m,p]=$.useState(0),y=$.useCallback(_=>{u(_),_==="log"&&h(e.length),_==="activity"&&p(n.length)},[e.length,n.length]);$.useEffect(()=>{a==="log"&&h(e.length)},[a,e.length]),$.useEffect(()=>{a==="activity"&&p(n.length)},[a,n.length]),$.useEffect(()=>{l==="completed"&&r!=null&&u("output")},[l,r]);const x=r!=null,w=a!=="log"?Math.max(0,e.length-d):0,E=a!=="activity"?Math.max(0,n.length-m):0;return s?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(Fk,{className:"w-3 h-3"}),b.jsx(Vx,{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(Mp,{active:a==="log",onClick:()=>y("log"),icon:b.jsx(Vx,{className:"w-3 h-3"}),label:"Log",count:e.length,unread:w}),b.jsx(Mp,{active:a==="activity",onClick:()=>y("activity"),icon:b.jsx(Wb,{className:"w-3 h-3"}),label:"Activity",count:n.length,unread:E}),b.jsx(Mp,{active:a==="output",onClick:()=>y("output"),icon:b.jsx(Jk,{className:"w-3 h-3"}),label:"Output",badge:x?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(Wi,{className:"w-3.5 h-3.5"})})]}),b.jsx("div",{className:"flex-1 overflow-hidden",children:a==="activity"?b.jsx(n9,{entries:n}):a==="log"?b.jsx(r9,{entries:e}):b.jsx(i9,{output:r,status:l})})]})}function Mp({active:e,onClick:n,icon:r,label:l,count:a,badge:u,unread:s}){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:[r,b.jsx("span",{children:l}),a!=null&&a>0&&b.jsx("span",{className:"text-[10px] text-[var(--text-muted)] tabular-nums",children:a}),u&&b.jsx("span",{className:Ye("w-1.5 h-1.5 rounded-full",u==="success"?"bg-[var(--completed)]":"bg-[var(--failed)]")}),!e&&s!=null&&s>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:s>99?"99+":s})})]})}const Qb={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 n9({entries:e}){const n=$.useRef(null),r=$.useRef(!0),l=he(d=>d.selectNode),[a,u]=$.useState(""),s=$.useCallback(()=>{const d=n.current;if(!d)return;const h=d.scrollHeight-d.scrollTop-d.clientHeight<30;r.current=h},[]),f=$.useMemo(()=>{if(!a)return e;const d=a.toLowerCase();return e.filter(h=>h.source.toLowerCase().includes(d)||Ju(h.message).toLowerCase().includes(d))},[e,a]);return $.useEffect(()=>{n.current&&r.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:a,onChange:d=>u(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"}),a&&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:()=>u(""),className:"text-[var(--text-muted)] hover:text-[var(--text)] transition-colors flex-shrink-0",title:"Clear filter",children:b.jsx(da,{className:"w-3 h-3"})})]})]}),b.jsxs("div",{ref:n,onScroll:s,className:"flex-1 overflow-y-auto font-mono text-[11px] leading-[1.6] px-3 py-2",children:[f.map((d,h)=>{const m=Qb[d.type]||Qb.message,p=SE(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:Ju(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:Ju(d.detail)})]},h)}),a&&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 "',a,'"']})})]})]})}const Zb={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 r9({entries:e}){const n=$.useRef(null),r=$.useRef(!0),l=he(u=>u.selectNode),a=$.useCallback(()=>{const u=n.current;if(!u)return;const s=u.scrollHeight-u.scrollTop-u.clientHeight<30;r.current=s},[]);return $.useEffect(()=>{n.current&&r.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:a,className:"h-full overflow-y-auto font-mono text-[11px] leading-[1.6] px-3 py-2",children:e.map((u,s)=>{const f=Zb[u.level]||Zb.info,d=SE(u.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(u.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 ${u.source}`,children:u.source}),b.jsx("span",{className:Ye("break-words",u.level==="error"?"text-red-400":u.level==="success"?"text-green-400":"text-[var(--text)]"),children:Ju(u.message)})]},s)})})}function SE(e){const n=new Date(e*1e3),r=n.getHours().toString().padStart(2,"0"),l=n.getMinutes().toString().padStart(2,"0"),a=n.getSeconds().toString().padStart(2,"0");return`${r}:${l}:${a}`}function i9({output:e,status:n}){const[r,l]=$.useState(!1),a=iw(e),u=async()=>{a&&(await navigator.clipboard.writeText(a),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:u,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:r?b.jsxs(b.Fragment,{children:[b.jsx(Vi,{className:"w-3 h-3 text-[var(--completed)]"}),b.jsx("span",{className:"text-[var(--completed)]",children:"Copied"})]}):b.jsxs(b.Fragment,{children:[b.jsx(ew,{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(l9,{text:a}):a})})]})}function l9({text:e}){const n=e.split(/("(?:[^"\\]|\\.)*")/g);return b.jsx(b.Fragment,{children:n.map((r,l)=>{if(l%2===1){const u=n.slice(l+1).join(""),s=/^\s*:/.test(u);return b.jsx("span",{className:s?"text-blue-400":"text-green-400",children:r},l)}const a=r.replace(/\b(true|false|null)\b|(-?\d+\.?\d*(?:e[+-]?\d+)?)/gi,(u,s,f)=>s?`${u}`:f?`${u}`:u);return b.jsx("span",{dangerouslySetInnerHTML:{__html:a}},l)})})}function a9(){const e=he(n=>n.selectedNode);return b.jsxs(Dp,{direction:"vertical",className:"flex-1 overflow-hidden",children:[b.jsx(bo,{defaultSize:70,minSize:30,children:b.jsxs(Dp,{direction:"horizontal",className:"h-full",children:[b.jsx(bo,{defaultSize:e?65:100,minSize:40,children:b.jsx(p5,{})}),e&&b.jsxs(b.Fragment,{children:[b.jsx(Rp,{className:"w-[3px] bg-[var(--border)] hover:bg-[var(--text-muted)] transition-colors cursor-col-resize"}),b.jsx(bo,{defaultSize:35,minSize:20,maxSize:60,children:b.jsx(e9,{})})]})]})}),b.jsx(Rp,{className:"h-[3px] bg-[var(--border)] hover:bg-[var(--text-muted)] transition-colors cursor-row-resize"}),b.jsx(bo,{defaultSize:30,minSize:5,maxSize:70,collapsible:!0,children:b.jsx(t9,{})})]})}const o9=3e4;function s9(){const e=he(p=>p.processEvent),n=he(p=>p.replayState),r=he(p=>p.setWsStatus),l=he(p=>p.setWsSend),a=$.useRef(null),u=$.useRef(1e3),s=$.useRef(null),f=$.useRef(null),d=$.useRef(()=>{}),h=$.useCallback(()=>{r("reconnecting"),s.current=setTimeout(()=>{u.current=Math.min(u.current*2,o9),d.current()},u.current)},[r]),m=$.useCallback(()=>{r("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);a.current=E,E.onopen=()=>{u.current=1e3,r("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=()=>{r("disconnected"),l(null),a.current=null,h()},E.onerror=()=>{}}catch{h()}}).catch(y=>{p.signal.aborted||(console.error("Failed to fetch state:",y),h())})},[e,n,r,l,h]);d.current=m,$.useEffect(()=>(m(),()=>{f.current&&f.current.abort(),s.current&&clearTimeout(s.current),a.current&&a.current.close(),l(null)}),[m,l])}function u9(){const e=he(h=>h.setReplayMode),n=he(h=>h.setWsStatus),r=he(h=>h.replayPlaying),l=he(h=>h.replayPosition),a=he(h=>h.replayTotalEvents),u=he(h=>h.replaySpeed),s=he(h=>h.replayEvents),f=he(h=>h.setReplayPosition);$.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=$.useRef(null);$.useEffect(()=>{if(!r||l>=a){d.current&&clearTimeout(d.current),r&&l>=a&&he.getState().setReplayPlaying(!1);return}const h=s[l-1],m=s[l];let p=100;if(h&&m){const y=(m.timestamp-h.timestamp)*1e3;p=Math.max(16,Math.min(y/u,2e3))}return d.current=setTimeout(()=>{f(l+1)},p),()=>{d.current&&clearTimeout(d.current)}},[r,l,a,u,s,f])}function c9(){return s9(),null}function f9(){return u9(),null}function d9(){const[e,n]=$.useState(null),r=he(u=>u.replayMode),l=he(u=>u.selectNode),a=he(u=>u.workflowName);return $.useEffect(()=>{fetch("/api/replay/info").then(u=>{u.ok?n(!0):n(!1)}).catch(()=>n(!1))},[]),$.useEffect(()=>{document.title=a?`Conductor — ${a}`:"Conductor Dashboard"},[a]),$.useEffect(()=>{const u=s=>{s.key==="Escape"&&l(null)};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[l]),e===null?null:b.jsxs("div",{className:"h-full flex flex-col bg-[var(--bg)]",children:[e?b.jsx(f9,{}):b.jsx(c9,{}),b.jsx(xN,{}),b.jsx(a9,{}),r?b.jsx(_N,{}):b.jsx(bN,{})]})}qk.createRoot(document.getElementById("root")).render(b.jsx($.StrictMode,{children:b.jsx(d9,{})})); diff --git a/src/conductor/web/static/index.html b/src/conductor/web/static/index.html index c25bcd6..5eaa43e 100644 --- a/src/conductor/web/static/index.html +++ b/src/conductor/web/static/index.html @@ -5,8 +5,8 @@ Conductor Dashboard - - + +
    From bc74fd72a1483c74a3695776b27c1118272b48d8 Mon Sep 17 00:00:00 2001 From: Daniel Green Date: Fri, 1 May 2026 15:33:22 -0700 Subject: [PATCH 6/8] docs: add markdown rendering section to human gates documentation Documents the markdown formatting support in gate prompts including Rich terminal rendering, GFM table support, auto-linkification of file paths and URLs, and the web dashboard interactive features. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- docs/workflow-syntax.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/docs/workflow-syntax.md b/docs/workflow-syntax.md index 7893740..84b99cd 100644 --- a/docs/workflow-syntax.md +++ b/docs/workflow-syntax.md @@ -104,6 +104,42 @@ agents: when: "{{ approval_gate.choice == 'reject' }}" ``` +#### Markdown in Gate Prompts + +Gate prompts support full **Markdown formatting**. In the terminal, prompts are rendered with Rich Markdown (headings, bold, lists, code blocks). In the web dashboard, prompts render as styled HTML with interactive features: + +- **Headings, bold, lists, code blocks** — all standard Markdown syntax is rendered +- **Tables** — GitHub Flavored Markdown (GFM) pipe tables are supported +- **File links** — relative file paths in the prompt (e.g., `./src/plan.md`) are auto-detected and rendered as clickable links that open in VS Code +- **URLs** — bare `http://` and `https://` URLs are auto-linked + +```yaml +agents: + - name: review_gate + type: human_gate + description: "Review the generated plan" + prompt: | + ## Review Required + + The planner produced the following artifacts: + + | File | Purpose | + |------|---------| + | ./output/plan.md | Implementation plan | + | ./output/timeline.md | Delivery timeline | + + Please review the files above and choose how to proceed. + See also: https://wiki.example.com/review-guidelines + + options: + - name: approve + description: "Looks good — proceed" + - name: revise + description: "Needs changes" +``` + +The auto-linkify processor is Markdown-aware: it skips fenced code blocks, inline code spans, and existing markdown links. File paths are validated against the workflow root directory (path traversal is blocked). + ### Script Steps Script steps run shell commands as workflow steps, capturing stdout, stderr, and exit code. Use them to integrate shell scripts, run tests, or invoke external tools without an AI agent. From 16aa9292ffa8e9e05c713926b0653d83d6eed9a4 Mon Sep 17 00:00:00 2001 From: Daniel Green Date: Fri, 1 May 2026 15:50:55 -0700 Subject: [PATCH 7/8] 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 527f8b2..849cd63 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 913e9545131e9063bbbde6db56f46cf445b0bd0d Mon Sep 17 00:00:00 2001 From: Daniel Green Date: Fri, 1 May 2026 15:53:39 -0700 Subject: [PATCH 8/8] style: ruff format workflow.py, server.py, test_server.py Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/conductor/engine/workflow.py | 4 +-- src/conductor/web/server.py | 44 ++++++++++++++++++++++++-------- tests/test_web/test_server.py | 4 +-- 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/conductor/engine/workflow.py b/src/conductor/engine/workflow.py index 624f437..13bb1e7 100644 --- a/src/conductor/engine/workflow.py +++ b/src/conductor/engine/workflow.py @@ -831,9 +831,7 @@ async def _handle_gate_with_web( """ # If no web dashboard at all, use CLI only. if self._web_dashboard is None: - gate_base = ( - Path(self.workflow_path).resolve().parent if self.workflow_path else None - ) + gate_base = Path(self.workflow_path).resolve().parent if self.workflow_path else None return await self.gate_handler.handle_gate(agent, agent_context, base_dir=gate_base) # Race CLI vs web input. We start the web task unconditionally (not only diff --git a/src/conductor/web/server.py b/src/conductor/web/server.py index 849cd63..a1ad3be 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 @@ -293,12 +313,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