diff --git a/examples/design-review.yaml b/examples/design-review.yaml deleted file mode 100644 index c530597..0000000 --- a/examples/design-review.yaml +++ /dev/null @@ -1,164 +0,0 @@ -# Design Review Workflow -# -# This example demonstrates a loop-back pattern with human-in-the-loop -# approval. It shows: -# - Multiple agents with conditional routing -# - Loop-back to previous agents for refinement -# - Human gate for approval decisions -# - Context accumulation between iterations -# - Safety limits (max_iterations, timeout) -# -# Usage: -# conductor run examples/design-review.yaml --input requirement="Build a REST API" -# -# With skip-gates for automation: -# conductor run examples/design-review.yaml --input requirement="..." --skip-gates - -workflow: - name: design-review - description: Iterative design creation with human approval - version: "1.0.0" - entry_point: designer - - input: - requirement: - type: string - required: true - description: The requirement or feature to design - - context: - mode: accumulate # All prior outputs available - - limits: - max_iterations: 10 - timeout_seconds: 300 - -agents: - - name: designer - description: Creates or refines the design based on requirements and feedback - model: gpt-5.2 - input: - - workflow.input.requirement - - reviewer.output? # Optional: may not exist on first iteration - - human_approval.output? # Optional: feedback from human - prompt: | - You are a software architect. Create a design based on the following requirement: - - Requirement: {{ workflow.input.requirement }} - - {% if reviewer is defined and reviewer.output %} - Previous Review Feedback: - {{ reviewer.output.feedback }} - - Please revise your design to address this feedback. - {% endif %} - - {% if human_approval is defined and human_approval.output and human_approval.output.feedback %} - Human Feedback: - {{ human_approval.output.feedback }} - - Please incorporate this feedback into your design. - {% endif %} - - Provide: - 1. A clear design description - 2. Key components and their responsibilities - 3. API contracts or interfaces - output: - design: - type: string - description: The complete design description - components: - type: array - description: List of key components - summary: - type: string - description: Brief summary for review - routes: - - to: reviewer - - - name: reviewer - description: Reviews the design for quality and completeness - model: gpt-5.2 - input: - - designer.output - - workflow.input.requirement - prompt: | - You are a senior software architect reviewing a design. - - Original Requirement: - {{ workflow.input.requirement }} - - Design to Review: - {{ designer.output.design }} - - Components: - {{ designer.output.components | json }} - - Evaluate the design based on: - 1. Does it meet the requirement? - 2. Is it well-structured and maintainable? - 3. Are edge cases considered? - 4. Is the API design clean? - - Provide a score from 1-10 and detailed feedback. - output: - score: - type: number - description: Quality score from 1-10 - approved: - type: boolean - description: Whether the design is ready for human review - feedback: - type: string - description: Detailed feedback for improvement - routes: - - to: human_approval - when: "{{ output.approved }}" - - to: designer - when: "score < 7" - - to: human_approval - - - name: human_approval - type: human_gate - description: Human review and approval of the design - prompt: | - ## Design Review Required - - **Requirement:** {{ workflow.input.requirement }} - - **Design Summary:** - {{ designer.output.summary }} - - **AI Review Score:** {{ reviewer.output.score }}/10 - - **AI Feedback:** - {{ reviewer.output.feedback }} - - --- - - **Full Design:** - {{ designer.output.design }} - - **Components:** - {% for component in designer.output.components %} - - {{ component }} - {% endfor %} - options: - - label: Approve Design - value: approved - route: $end - - label: Request Changes - value: changes - route: designer - prompt_for: feedback - - label: Reject Design - value: rejected - route: $end - -output: - design: "{{ designer.output.design }}" - components: "{{ designer.output.components | json }}" - review_score: "{{ reviewer.output.score }}" - decision: "{{ human_approval.output.selected }}" - iterations: "{{ context.iteration }}" diff --git a/examples/design.yaml b/examples/design.yaml new file mode 100644 index 0000000..dd390ee --- /dev/null +++ b/examples/design.yaml @@ -0,0 +1,488 @@ +# Design Workflow +# +# This workflow creates a high-level solution design document that is closely +# grounded in the codebase. Unlike the plan workflow (which produces actionable +# implementation plans with epics and tasks), this workflow focuses on +# architectural decisions, trade-offs, alternatives considered, and design +# rationale — suitable for cross-team alignment and technical review. +# +# The design passes through two independent review cycles: +# 1. Technical Reviewer — validates accuracy, feasibility, and completeness +# 2. Readability Reviewer — ensures clarity, structure, and audience fit +# +# Usage: +# conductor run workflows/design.yaml --input purpose="Migrate authentication from session-based to JWT tokens" +# +# With explicit output path: +# conductor run workflows/design.yaml --input purpose="..." --input output_path="docs/auth-migration.design.md" +# +# With verbose output: +# conductor -V run workflows/design.yaml --input purpose="..." +# +# Flow: +# architect → technical_reviewer +# → readability_reviewer → (loop back to architect if either < 90) +# → $end + +workflow: + name: design + description: Create a high-level solution design document grounded in the codebase, with technical and readability review cycles + version: "1.0.0" + entry_point: architect + + runtime: + provider: copilot + mcp_servers: + web-search: + command: npx + args: ["-y", "open-websearch@latest"] + env: + MODE: stdio + DEFAULT_SEARCH_ENGINE: duckduckgo + ALLOWED_SEARCH_ENGINES: duckduckgo,brave,exa + tools: ["*"] + context7: + command: npx + args: ["-y", "@upstash/context7-mcp@latest"] + tools: ["*"] + ms-learn: + type: http + url: https://learn.microsoft.com/api/mcp + tools: ["*"] + + input: + purpose: + type: string + required: true + description: A clear description of the feature, change, or initiative to design + output_path: + type: string + required: false + description: Optional file path for the design document (e.g. docs/my-feature.design.md) + + context: + mode: explicit + + limits: + max_iterations: 50 + +agents: + - name: architect + description: Researches the codebase and broader context, then authors a high-level solution design document + model: claude-opus-4.6-1m + input: + - workflow.input.purpose + - workflow.input.output_path? + - architect.output? + - technical_reviewer.output? + - readability_reviewer.output? + system_prompt: | + You are a Principal Software Architect. You analyze requirements deeply, research the + existing codebase, and produce clear, high-level technical design documents focused + on architecture, decisions, and rationale. + + Your core capabilities include: + - Designing scalable, maintainable architectures + - Analyzing existing codebases to ground designs in reality + - Identifying architectural patterns, trade-offs, and alternatives + - Writing precise, fact-based design documents for cross-team alignment + - Documenting APIs, data flows, and component interactions + - Identifying risks, dependencies, and open questions + + Your documents are: + - High-level but grounded in the actual codebase (not abstract hand-waving) + - Focused on *what* and *why*, not implementation-level *how* + - Structured for engineering and architecture audiences + - Honest about trade-offs, risks, and open questions + prompt: | + Create a high-level solution design document based on the following purpose: + + **Purpose:** {{ workflow.input.purpose }} + + {% if technical_reviewer is defined and technical_reviewer.output and technical_reviewer.output.score < 90 %} + **Technical Review Feedback (Score: {{ technical_reviewer.output.score }}/100):** + {{ technical_reviewer.output.feedback }} + + {% if technical_reviewer.output.critical_issues %} + **Critical Issues:** + {% for issue in technical_reviewer.output.critical_issues %} + - {{ issue }} + {% endfor %} + {% endif %} + + **IMPORTANT:** You are revising an existing document. Read the document at + `{{ architect.output.file_path }}` and update it to address the feedback. + Preserve content that is satisfactory. + {% endif %} + + {% if readability_reviewer is defined and readability_reviewer.output and readability_reviewer.output.score < 90 %} + **Readability Review Feedback (Score: {{ readability_reviewer.output.score }}/100):** + {{ readability_reviewer.output.feedback }} + + {% if readability_reviewer.output.critical_issues %} + **Critical Issues:** + {% for issue in readability_reviewer.output.critical_issues %} + - {{ issue }} + {% endfor %} + {% endif %} + + **IMPORTANT:** You are revising an existing document. Read the document at + `{{ architect.output.file_path }}` and update it to address the feedback. + Preserve content that is satisfactory. + {% endif %} + + --- + + ## Phase 1: Research + + Before drafting the design, perform thorough research: + + ### Codebase Analysis + - Explore the relevant portions of the codebase deeply + - Identify existing components, patterns, abstractions, and conventions + - Understand the current architecture and how data flows + - Map out dependencies between components + - Note any technical debt or constraints that affect the design + + ### External Research + - Search the web for context on relevant technologies and best practices + - Research similar designs and architectural patterns + - Look up documentation for key libraries, frameworks, or protocols involved + - Identify industry standards or conventions that apply + + --- + + ## Phase 2: Design Document + + Write the design document with the following sections: + + ### Executive Summary + One paragraph describing the proposal, its motivation, and expected outcome. + + ### Background + - Current state of the system and relevant architecture + - Context that motivates this design (why now, what changed) + - Prior art or related work in the codebase + + ### Problem Statement + Clearly define the problem(s) this design addresses. Be specific about + pain points, limitations, or gaps in the current system. + + ### Goals and Non-Goals + **Goals** — specific, measurable outcomes this design aims to achieve. + **Non-Goals** — explicit exclusions to keep scope focused. + + ### Proposed Design + + Provide the core of the design: + - **Architecture Overview** — high-level component diagram and how pieces fit together + - **Key Components** — each major component with its responsibilities and interfaces + - **Data Flow** — how data moves through the system for key operations + - **API Contracts** — public interfaces, protocols, or contracts (if applicable) + - **Design Decisions** — key decisions made and the rationale behind each + + ### Alternatives Considered *(optional)* + For each significant design decision, describe: + - What alternatives were evaluated + - Pros and cons of each + - Why the chosen approach was selected + + Include this section when the design involves non-obvious choices between + viable approaches. Skip if the solution is straightforward. + + ### Dependencies *(optional)* + - External dependencies (libraries, services, infrastructure) + - Internal dependencies (other components, teams, systems) + - Sequencing constraints (what must happen before this design can proceed) + + Include this section when the design introduces new dependencies or has + meaningful coordination requirements. Skip if dependencies are trivial. + + ### Impact Analysis *(optional)* + - Components and areas of the codebase affected + - Backward compatibility considerations + - Performance implications + - Operational impact (deployment, monitoring, debugging) + + Include this section when the design touches multiple components or has + compatibility/performance implications. Skip for isolated changes. + + ### Security Considerations *(optional)* + - Authentication, authorization, and access control implications + - Data protection and privacy concerns + - Attack surface changes + + Include this section when the design affects security boundaries, handles + sensitive data, or changes the attack surface. Skip if not applicable. + + ### Risks and Mitigations *(optional)* + Table with: Risk, Likelihood (Low/Medium/High), Impact (Low/Medium/High), Mitigation. + + Include this section when the design carries meaningful technical, operational, + or schedule risks. Skip for low-risk changes. + + ### Open Questions + Items requiring further discussion, investigation, or decision from stakeholders. + + ### References + Links to relevant documentation, prior art, RFCs, or external resources. + + --- + + Be thorough and specific. Ground every claim in evidence from the codebase or research. + Avoid vague or aspirational language — if something is uncertain, call it out as an open question. + + --- + + ## REVISION NOTES + + {% if technical_reviewer is defined or readability_reviewer is defined %} + After revising the document, provide a concise summary of what you changed and why + in your `revision_notes` output. Structure it as a bullet list, e.g.: + - Corrected gRPC version numbers per technical reviewer feedback + - Rewrote Executive Summary for clarity per readability feedback + - Added missing risk mitigation for database migration + + This helps reviewers understand what changed. + {% else %} + This is the first draft. Set `revision_notes` to "Initial draft." + {% endif %} + + --- + + ## SAVING THE DOCUMENT + + After creating the design document, save it to a file. + + {% if workflow.input.output_path %} + Save the document to: `{{ workflow.input.output_path }}` + {% else %} + Choose a file path using the following convention: + + - If the purpose input references a document path, derive the name from that document + and save it in the same directory. Examples: + - `upgrade-database-v2.brainstorm.md` → `upgrade-database-v2.design.md` + - `add-user-authentication.md` → `add-user-authentication.design.md` + - Otherwise: + - Save the document in the current working directory. + - Use the naming convention: `[descriptive-slug].design.md` + - Examples: + - `jwt-authentication-migration.design.md` + - `event-sourcing-pipeline.design.md` + {% endif %} + output: + file_path: + type: string + description: The path where the design document was saved + revision_notes: + type: string + description: Summary of changes made in this revision (empty on first draft) + routes: + - to: technical_reviewer + + - name: technical_reviewer + description: Reviews the design document for technical accuracy, feasibility, and completeness + model: claude-opus-4.6-1m + input: + - workflow.input.purpose + - architect.output.file_path + - architect.output.revision_notes + system_prompt: | + You are a Senior Engineering Reviewer with broad expertise in software architecture, + distributed systems, and .NET/cloud-native development. You review design documents + for technical accuracy, feasibility, and completeness. + + You are especially attentive to: + - Factual accuracy of technical claims (versions, API names, compatibility) + - Whether the design is grounded in the actual codebase (not aspirational) + - Completeness of the problem analysis and proposed solution + - Soundness of design decisions and whether alternatives were fairly evaluated + - Practical feasibility of the proposed architecture + - Whether risks are realistically assessed + prompt: | + Review the design document for **technical accuracy and completeness**. + + **Original Purpose:** + {{ workflow.input.purpose }} + + **Design Document Location:** + {{ architect.output.file_path }} + + Read the design document from the file path above. + + {% if architect.output.revision_notes and architect.output.revision_notes != "Initial draft." %} + **Architect's Revision Notes:** + {{ architect.output.revision_notes }} + + The architect has revised the document based on prior feedback. Use these notes to + focus your review on the changed areas, while still checking overall technical soundness. + {% endif %} + + --- + + ## Fact-Checking + + To verify the document's claims, independently check: + - Technical claims by reading referenced source files and project files in the codebase + - Version numbers, API names, and library capabilities by searching the web + - Whether the described current state actually matches the codebase + - Whether the proposed design is feasible given the existing architecture + + --- + + ## Evaluation Criteria + + Focus exclusively on **technical content** — accuracy, correctness, and completeness: + + | Criteria | Description | + |----------|-------------| + | **Technical Accuracy** | Are technical claims, version numbers, and API details correct? | + | **Codebase Grounding** | Is the design grounded in the actual codebase, not aspirational? | + | **Completeness** | Are all aspects of the problem addressed? Are there gaps? | + | **Design Soundness** | Are the architectural decisions well-reasoned and defensible? | + | **Alternatives Analysis** | Were alternatives fairly evaluated with honest trade-offs? | + | **Impact Analysis** | Are all affected components identified? Are side effects considered? | + | **Risk Assessment** | Are risks realistic? Are mitigations concrete and actionable? | + | **Feasibility** | Can this design actually be implemented given the existing system? | + + Do NOT evaluate structure, readability, or formatting — a separate reviewer handles that. + + Provide: + 1. A score from 0-100 + 2. Whether the technical content is approved (score >= 90) + 3. Specific feedback on technical issues + 4. List of critical technical issues that must be addressed + output: + score: + type: number + description: Technical accuracy score from 0-100 + approved: + type: boolean + description: Whether the technical content meets quality threshold (score >= 90) + feedback: + type: string + description: Detailed feedback on technical issues + critical_issues: + type: array + description: List of critical technical issues that must be addressed + routes: + - to: readability_reviewer + when: "{{ output.approved }}" + - to: architect + when: "{{ output.score < 90 }}" + - to: readability_reviewer + + - name: readability_reviewer + description: Reviews the design document for structure, clarity, and readability + model: gemini-3.1-pro-preview + input: + - workflow.input.purpose + - architect.output.file_path + - architect.output.revision_notes + - technical_reviewer.output + system_prompt: | + You are a Senior Technical Writer and Document Reviewer. You specialize in + evaluating design documents for structure, clarity, and readability. You ensure + documents are well-organized, appropriately detailed for their audience, and + ready for cross-team review. + + You focus on: + - Document structure and logical flow + - Clarity of writing and precision of language + - Appropriate detail level for the target audience + - Effective use of tables, diagrams, lists, and section organization + - Whether decision points and open questions are clearly framed + prompt: | + Review the design document for **structure, clarity, and readability**. + + **Original Purpose:** + {{ workflow.input.purpose }} + + **Design Document Location:** + {{ architect.output.file_path }} + + Read the design document from the file path above. + + **Technical Review Status:** This document scored {{ technical_reviewer.output.score }}/100 + on technical accuracy. + + {% if architect.output.revision_notes and architect.output.revision_notes != "Initial draft." %} + **Architect's Revision Notes:** + {{ architect.output.revision_notes }} + + The architect has revised the document based on prior feedback. Use these notes to + focus your review on the changed areas, while still checking overall structure and clarity. + {% endif %} + + --- + + ## Expected Document Structure + + The document should contain the following sections: + 1. Executive Summary (one paragraph) + 2. Background (current state, motivation, prior art) + 3. Problem Statement (specific problems being solved) + 4. Goals and Non-Goals + 5. Proposed Design (architecture overview, key components, data flow, API contracts, design decisions) + 6. Alternatives Considered *(optional — include when non-obvious choices exist)* + 7. Dependencies *(optional — include when new or cross-team dependencies exist)* + 8. Impact Analysis *(optional — include for multi-component or compatibility-sensitive changes)* + 9. Security Considerations *(optional — include when security boundaries are affected)* + 10. Risks and Mitigations *(optional — include for meaningful risks)* + 11. Open Questions + 12. References + + The audience is engineers and architects involved in the design review. + + --- + + ## Evaluation Criteria + + Focus exclusively on **structure and readability** — not technical accuracy: + + | Criteria | Description | + |----------|-------------| + | **Document Structure** | Does it follow the expected sections? Is information logically organized? | + | **Clarity** | Is the writing clear, precise, and free of ambiguity? | + | **Audience Fit** | Is the detail level appropriate for engineers and architects? | + | **Decision Framing** | Are design decisions and open questions clearly framed with context? | + | **Cohesion** | Does the document read as a unified work with connected sections? | + | **Formatting** | Are tables, lists, diagrams, and code references used effectively? | + | **Executive Summary** | Does it convey the problem, approach, and outcome in one paragraph? | + | **Actionability** | After reading, would reviewers know exactly what to evaluate and decide? | + + Do NOT evaluate technical correctness — that has been handled by a separate reviewer. + + Provide: + 1. A score from 0-100 + 2. Whether the structure/readability is approved (score >= 90) + 3. Specific feedback on structure and clarity issues + 4. List of critical readability issues that must be addressed + output: + score: + type: number + description: Structure and readability score from 0-100 + approved: + type: boolean + description: Whether the document structure meets quality threshold (score >= 90) + feedback: + type: string + description: Detailed feedback on structure and readability + critical_issues: + type: array + description: List of critical structure/readability issues that must be addressed + routes: + - to: $end + when: "{{ output.approved }}" + - to: architect + when: "{{ output.score < 90 }}" + - to: $end + +output: + purpose: "{{ workflow.input.purpose }}" + design_file: "{{ architect.output.file_path }}" + technical_review_score: "{{ technical_reviewer.output.score }}" + readability_review_score: "{{ readability_reviewer.output.score }}" + technical_review_feedback: "{{ technical_reviewer.output.feedback }}" + readability_review_feedback: "{{ readability_reviewer.output.feedback }}" + iterations: "{{ context.iteration }}" diff --git a/examples/docs/sample.plan.md b/examples/docs/sample.plan.md new file mode 100644 index 0000000..9540418 --- /dev/null +++ b/examples/docs/sample.plan.md @@ -0,0 +1,653 @@ +# Implementation Plan: gRPC Library Migration and Transport Security for Log Service + +**Status:** Draft +**Date:** 2026-02-23 +**Revision:** 2 +**Revision Notes:** Addressed technical review feedback (score 87/100). Key changes: (1) Fixed Epic 5 task sequencing - channel creation now first, (2) Corrected GrpcChannel disposal pattern - uses Dispose() not ShutdownAsync(), (3) Verified artifact source paths use existing `netstandard2.0\win10-x64` naming convention, (4) Removed Microsoft.Bcl.AsyncInterfaces from net8.0 dependency closure, (5) Added phased mTLS rollout approach, (6) Fixed validation exception types to match existing patterns, (7) Enhanced TLS validation to include chain-of-trust validation. + +--- + +## 1. Problem Statement + +The Service Fabric Log Service client currently uses `Grpc.Core` v2.37.0, which is in maintenance mode and will be deprecated. This creates several critical issues: + +1. **Security Blocker**: All gRPC communication between the Service Fabric runtime (`LogServiceClient`) and the Log Service is currently unencrypted (`ChannelCredentials.Insecure`). This is a hard blocker for production deployment. + +2. **Technical Debt**: `Grpc.Core` relies on native C-core binaries (`grpc_csharp_ext.x64.dll`), adding ~20MB of native dependencies and increasing complexity. + +3. **Version Skew**: Multiple version misalignments exist across Log Service components: + - `LogService.Gateway`: `Grpc.AspNetCore` v2.37.0 with `Grpc.AspNetCore.Server.Reflection` v2.71.0 + - `StreamProducer` (netcore): `Grpc.Core` v2.33.1 vs corext 2.37.0 + +4. **Shared Compilation Challenge**: `LogServiceClient.cs` is compiled into both net45 and netcore `Data.Impl` projects from the same source file, requiring conditional compilation for the migration. + +5. **Breaking API Surface**: `LogServiceSession.cs` exposes `Grpc.Core.Channel` as a public property, which must be refactored to support both TFMs. + +--- + +## 2. Goals and Non-Goals + +### Goals + +| ID | Goal | Success Criteria | +|----|------|------------------| +| G1 | Enable TLS/mTLS | All gRPC communication secured with TLS 1.2+; certificate-based authentication working | +| G2 | Migrate netcore Data.Impl to Grpc.Net.Client | `Grpc.Core` replaced with `Grpc.Net.Client` in netcore project; native binaries eliminated for netcore | +| G3 | Maintain net45 compatibility | net45 `Data.Impl` continues working unchanged on `Grpc.Core` | +| G4 | Resolve version skew | All Log Service gRPC packages aligned to v2.71.0 | +| G5 | Update installer artifacts | `ArtifactsSpecification.csv` updated for NS_10 gRPC dependencies | +| G6 | Refactor LogServiceSession | `Channel` property replaced with TFM-agnostic `CallInvoker` | + +### Non-Goals + +- Protocol changes (`.proto` files unchanged) +- Control plane redesign +- Checkpointing feature +- Migrating net45 components to `Grpc.Net.Client` +- Cross-version client-server compatibility during transition + +--- + +## 3. Requirements + +### Functional Requirements + +| ID | Requirement | +|----|-------------| +| FR1 | LogServiceClient must establish TLS-secured connections to Log Service when configured with HTTPS endpoint | +| FR2 | Client must validate server certificate against configured thumbprints or common names | +| FR3 | Server must validate client certificate for mTLS | +| FR4 | Configuration settings for TLS must be exposed via `ReliableStateManagerReplicatorSettings2` | +| FR5 | Existing net45 consumers must continue working without modification | +| FR6 | Redirect/failover semantics must be preserved during primary movement | + +### Non-Functional Requirements + +| ID | Requirement | +|----|-------------| +| NFR1 | No regression in gRPC call latency (within 5% baseline) | +| NFR2 | Package size reduction for netcore deployments (eliminate ~20MB native binary) | +| NFR3 | Clear error messages for certificate misconfiguration (fail-fast) | +| NFR4 | Backward-compatible configuration (existing configs work without modification) | + +--- + +## 4. Solution Architecture + +### Overview + +The migration introduces conditional compilation (`#if DotNetCoreClr`) to split gRPC client implementation per target framework: + +- **netcore (net8.0)**: Uses `Grpc.Net.Client` with `HttpClientHandler` for TLS +- **net45**: Continues using `Grpc.Core` unchanged + +### Architecture Diagram + +``` +┌─────────────────────────────────────────────────────────────────────┐ +│ Service Fabric Application │ +│ ┌─────────────────────────────────────────────────────────────┐ │ +│ │ ReliableStateManager / Replicator │ │ +│ └─────────────────────────────────────────────────────────────┘ │ +│ │ │ +│ ▼ │ +│ ┌─────────────────────────────────────────────────────────────┐ │ +│ │ LogServiceClient (Grpc.Net.Client + TLS/mTLS) │ │ +│ │ ┌─────────────────────────────────────────────────────┐ │ │ +│ │ │ GrpcChannel (netcore) / Channel (net45) │ │ │ +│ │ │ HttpClient with X509 Certificate Handler │ │ │ +│ │ └─────────────────────────────────────────────────────┘ │ │ +│ └─────────────────────────────────────────────────────────────┘ │ +└─────────────────────────────────────────────────────────────────────┘ + │ + TLS + HTTP/2 + (mTLS optional) + │ + ▼ +┌─────────────────────────────────────────────────────────────────────┐ +│ Log Service Cluster │ +│ ┌─────────────────────────────────────────────────────────────┐ │ +│ │ WalStatefulService (Grpc.AspNetCore + Kestrel + TLS) │ │ +│ │ ┌─────────────────────────────────────────────────────┐ │ │ +│ │ │ Kestrel: HTTP/2 + TLS │ │ │ +│ │ │ Certificate from Service Fabric certificate store │ │ │ +│ │ └─────────────────────────────────────────────────────┘ │ │ +│ └─────────────────────────────────────────────────────────────┘ │ +└─────────────────────────────────────────────────────────────────────┘ +``` + +### Key Components and Responsibilities + +| Component | Responsibility | +|-----------|----------------| +| `LogServiceClient.cs` | gRPC client with conditional compilation for channel creation and TLS configuration | +| `LogServiceSession.cs` | Session abstraction with `CallInvoker` property (replaces `Channel`); implements `IDisposable` with TFM-specific disposal | +| `ReliableStateManagerReplicatorSettings2.cs` | TLS configuration properties (certificate thumbprints, store names) | +| `ReliableStateManagerReplicatorSettingsUtil.cs` | Settings loader and validator | +| `ReliableStateManagerReplicatorSettingsConfigurationNames.cs` | Configuration key constants | +| `WalStatefulService.cs` | Server-side Kestrel TLS configuration with phased mTLS support | +| `ArtifactsSpecification.csv` | Installer artifact entries for NS_10 gRPC dependencies | + +### Data Flow + +1. **Session Establishment**: + - Client creates `GrpcChannel` (netcore) or `Channel` (net45) with TLS configuration + - Server validates client certificate during TLS handshake + - `OpenSessionAsync()` establishes session with redirect support + +2. **Replication**: + - `LogServiceManager.Append()` → `LogServiceClient.InvokeAsync()` → TLS gRPC → `WalGrpcService.Append()` + - Streaming operations use `AsyncServerStreamingCall` (unchanged API) + +3. **Certificate Resolution**: + - Client reads certificate thumbprint from `ReliableStateManagerReplicatorSettings2` + - Certificate loaded from `LocalMachine\My` store + - Server certificate validated against configured thumbprints, common names, or chain-of-trust (issuer thumbprints) + +### API Contracts + +**LogServiceSession (Proposed)**: +```csharp +public class LogServiceSession : IDisposable +{ + public Data.DataClient Client { get; } + public CallInvoker CallInvoker => Client.CallInvoker; // Replaces Channel + public string ClientId { get; } + public string ServiceName { get; } + public string PartitionId { get; } + public ReliableStateManagerReplicatorSettings2 Settings { get; } + public volatile bool IsFaulted; + + public void Dispose(); + + // NOTE: ShutdownAsync() removed - GrpcChannel has no async shutdown. + // For netcore: Dispose() is synchronous and cancels pending HTTP requests. + // For net45: Channel.ShutdownAsync() called internally before Dispose(). +} +``` + +**Channel Disposal Pattern** (addressing Grpc.Core vs Grpc.Net.Client differences): +```csharp +#if DotNetCoreClr + // netcore: GrpcChannel.Dispose() is synchronous, immediately cancels pending requests + public void Dispose() + { + _grpcChannel?.Dispose(); + _grpcChannel = null; + } +#else + // net45: Channel.ShutdownAsync() provides graceful async shutdown + public void Dispose() + { + _channel?.ShutdownAsync().GetAwaiter().GetResult(); + _channel = null; + } + + public Task ShutdownAsync() + { + return _channel?.ShutdownAsync() ?? Task.CompletedTask; + } +#endif +``` + +**New Configuration Properties** (in `ReliableStateManagerReplicatorSettings2`): +- `LogServiceCertificateThumbprint`: Client certificate for authentication +- `LogServiceCertificateStoreName`: Store name (default: "My") +- `LogServiceServerCertificateThumbprints`: Allowed server certificate thumbprints +- `LogServiceServerCertificateCommonNames`: Allowed server certificate common names +- `LogServiceCertificateIssuerThumbprints`: Trusted issuer thumbprints for chain validation + +--- + +## 5. Dependencies + +### External Dependencies + +| Package | Version (netcore) | Version (net45) | Purpose | +|---------|-------------------|-----------------|---------| +| `Grpc.Net.Client` | 2.71.0 | N/A | Pure .NET gRPC client | +| `Grpc.Net.Common` | 2.71.0 | N/A | Shared gRPC types (transitive) | +| `Grpc.Core.Api` | 2.71.0 | 2.37.0 | Shared types for generated stubs | +| `Grpc.Core` | N/A | 2.37.0 | Legacy gRPC client (net45 only) | +| `Google.Protobuf` | 3.29.3 | 3.21.6 | Protocol buffer serialization (aligned with Grpc.Net.Client 2.71.0 transitive) | + +**Note on Microsoft.Bcl.AsyncInterfaces**: This assembly provides `IAsyncEnumerable` support for netstandard2.0. Since the netcore project targets **net8.0**, which has `IAsyncEnumerable` built-in, this assembly is **not required** for the NS_10 deployment. If targeting netstandard2.0 libraries that depend on it, NuGet will resolve it transitively. + +### Internal Dependencies + +| Component | Impact | +|-----------|--------| +| `Microsoft.ServiceFabric.Data.Impl` (netcore) | Primary target of changes | +| `Microsoft.ServiceFabric.Data.Interfaces.V2` | New configuration properties | +| `LogService.Gateway` | Version alignment prerequisite | +| `LogService.Wal` | Server TLS enablement | +| `ArtifactsSpecification.csv` / `ArtifactsSpecification_arm64.csv` | Installer entries | + +### NS_10 Dependency Closure + +The following assemblies must be deployed to `NS_10`: +1. `Grpc.Net.Client.dll` +2. `Grpc.Net.Common.dll` +3. `Grpc.Core.Api.dll` +4. `Google.Protobuf.dll` + +**Note**: `Microsoft.Bcl.AsyncInterfaces.dll` is **not required** for net8.0 targets. The assembly provides `IAsyncEnumerable` for netstandard2.0 compatibility, but net8.0 includes this interface natively. If deployment testing reveals a transitive requirement, add it as a conditional artifact. + +--- + +## 6. Risk Assessment + +| Risk | Likelihood | Impact | Mitigation | +|------|------------|--------|------------| +| net45 build breaks from conditional compilation | Medium | High | Use established `#if DotNetCoreClr` pattern; test both TFMs in CI | +| Installer artifact specification errors | Medium | High | Explicit artifact entries; test on clean VMs | +| gRPC assemblies missing from NS_10 at runtime | Medium | High | 3-phase dependency closure verification | +| ARM64 native binary incompatibility (`grpc_csharp_ext.x64.dll`) | High | High | Investigate and remove/replace before ARM64 deployment | +| LogServiceSession.Channel consumer breakage | Medium | Medium | Search codebase for usages; update to use `CallInvoker` | +| TLS configuration rejected by server | Medium | Medium | Document certificate requirements; clear error messages | +| Performance regression | Low | Medium | Baseline latency testing before/after | +| Rollback required mid-deployment | Low | High | Rollback plan documented; net45 path unaffected | + +--- + +## 7. Implementation Phases + +### Phase 1: Prerequisites +- Fix LogService.Gateway version skew +- Verify ARM64 native binary status +- Exit Criteria: Gateway builds with aligned gRPC versions; ARM64 decision documented + +### Phase 2: Configuration Foundation +- Add TLS configuration properties to settings classes +- Add configuration name constants +- Add validation logic +- Exit Criteria: Settings compile and validate; unit tests pass + +### Phase 3: Server TLS Enablement (TLS-only, no mTLS) +- Enable TLS in WalStatefulService Kestrel configuration +- Use `ClientCertificateMode.AllowCertificate` for gradual rollout (not `RequireCertificate`) +- Server accepts TLS connections; client certificates optional +- Exit Criteria: Server accepts TLS connections; HTTP traffic fails + +### Phase 4: Client Migration (netcore) +- Update netcore Data.Impl package references +- Implement conditional compilation in LogServiceClient.cs +- Refactor LogServiceSession.cs with TFM-specific disposal +- Add certificate management methods +- Exit Criteria: netcore build succeeds; TLS connection works + +### Phase 5: Installer Updates +- Add NS_10 artifact entries to ArtifactsSpecification.csv +- Add NS_10 artifact entries to ArtifactsSpecification_arm64.csv +- Update PublishBinaries target for gRPC dependencies +- Exit Criteria: Installer produces correct drop; assemblies in NS_10 + +### Phase 6: mTLS Enforcement +- Enable `ClientCertificateMode.RequireCertificate` on server +- Implement server-side client certificate validation +- Exit Criteria: Server accepts connections with valid client certificates; rejects invalid/missing + +### Phase 7: Validation +- Execute dependency closure verification +- Integration testing with TLS and mTLS +- Performance baseline comparison +- Exit Criteria: All tests pass; no performance regression + +--- + +## 8. Files Affected + +### New Files + +| File Path | Purpose | +|-----------|---------| +| N/A | No new files required | + +### Modified Files + +| File Path | Changes | +|-----------|---------| +| `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Impl\Replicator\LogService\LogServiceClient.cs` | Add conditional compilation for `Grpc.Net.Client` (netcore) vs `Grpc.Core` (net45); implement TLS handler creation | +| `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Impl\Replicator\LogService\LogServiceSession.cs` | Replace `Channel` property with `CallInvoker`; add `IDisposable` implementation with TFM-specific disposal | +| `WindowsFabric\src\prod\src\managed\netcore\Microsoft.ServiceFabric.Data.Impl\dll\Microsoft.ServiceFabric.Data.Impl.csproj` | Update package references: remove `Grpc.Core`, add `Grpc.Net.Client` 2.71.0 and `Grpc.Core.Api` 2.71.0 | +| `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Interfaces.V2\ReliableStateManagerReplicatorSettings2.cs` | Add 5 new TLS configuration properties; update `InternalEquals()` and `ToString()` | +| `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Impl\ReliableStateManagerReplicatorSettingsConfigurationNames.cs` | Add 5 new configuration name constants for TLS settings | +| `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Impl\ReliableStateManagerReplicatorSettingsUtil.cs` | Add TLS settings validation logic | +| `log-service\src\csharp\LogService.Wal\WalStatefulService.cs` | Enable TLS on Kestrel; implement `ClientCertificateValidation` callback | +| `log-service\src\csharp\LogService.Gateway\LogService.Gateway.csproj` | Update `Grpc.AspNetCore` from 2.37.0 to 2.71.0 | +| `WindowsFabric\src\prod\Setup\ArtifactsSpecification.csv` | Add 5 NS_10 artifact entries for gRPC dependencies | +| `WindowsFabric\src\prod\Setup\ArtifactsSpecification_arm64.csv` | Add 5 NS_10 artifact entries for gRPC dependencies | + +### Deleted Files + +| File Path | Reason | +|-----------|--------| +| N/A | No files deleted | + +--- + +## 9. Implementation Plan + +### Epic 1: Gateway Version Alignment (Prerequisite) + +**Goal**: Fix the existing version skew in LogService.Gateway where `Grpc.AspNetCore` v2.37.0 is paired with `Grpc.AspNetCore.Server.Reflection` v2.71.0. + +**Prerequisites**: None + +**Tasks**: + +| Task ID | Type | Description | Files | Status | +|---------|------|-------------|-------|--------| +| E1-T1 | IMPL | Update `Grpc.AspNetCore` package reference from 2.37.0 to 2.71.0 | `log-service\src\csharp\LogService.Gateway\LogService.Gateway.csproj` | DONE | +| E1-T2 | TEST | Build LogService.Gateway and verify no compilation errors | N/A | DONE | +| E1-T3 | TEST | Run existing LogService.Gateway tests | N/A | DONE (no Gateway-specific tests exist) | + +**Acceptance Criteria**: +- [ ] `LogService.Gateway.csproj` has both `Grpc.AspNetCore` and `Grpc.AspNetCore.Server.Reflection` at v2.71.0 +- [ ] Project builds successfully +- [ ] Existing tests pass + +--- + +### Epic 2: TLS Configuration Settings + +**Goal**: Add the necessary configuration properties to support TLS certificate configuration for Log Service connections. + +**Prerequisites**: None (can run in parallel with Epic 1) + +**Tasks**: + +| Task ID | Type | Description | Files | Status | +|---------|------|-------------|-------|--------| +| E2-T1 | IMPL | Add 5 TLS configuration properties to `ReliableStateManagerReplicatorSettings2` | `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Interfaces.V2\ReliableStateManagerReplicatorSettings2.cs` | DONE | +| E2-T2 | IMPL | Update `InternalEquals()` method to compare new TLS settings | `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Interfaces.V2\ReliableStateManagerReplicatorSettings2.cs` | DONE | +| E2-T3 | IMPL | Update `ToString()` method to include new settings (masked for security) | `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Interfaces.V2\ReliableStateManagerReplicatorSettings2.cs` | DONE | +| E2-T4 | IMPL | Add 5 configuration name constants | `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Impl\ReliableStateManagerReplicatorSettingsConfigurationNames.cs` | DONE | +| E2-T5 | IMPL | Add validation logic for TLS settings (require cert when HTTPS) | `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Impl\ReliableStateManagerReplicatorSettingsUtil.cs` | DONE | +| E2-T6 | TEST | Unit tests for settings equality comparison with new properties | N/A | DONE | +| E2-T7 | TEST | Unit tests for settings validation (HTTPS requires certificate) | N/A | DONE | + +**Acceptance Criteria**: +- [ ] New properties compile without errors +- [ ] `InternalEquals()` correctly handles nullable comparison for new settings +- [ ] Validation throws `ArgumentException` for HTTPS without certificate thumbprint (matching existing validation patterns in `ReliableStateManagerReplicatorSettingsUtil`) +- [ ] Settings `ToString()` masks sensitive certificate data + +--- + +### Epic 3: Server TLS Enablement (Phase 3 - TLS Only) + +**Goal**: Enable TLS on the Log Service server (WalStatefulService) without requiring client certificates initially. This allows gradual rollout and testing of server-side TLS before enforcing mTLS. + +**Prerequisites**: Epic 1 (Gateway alignment) + +**Tasks**: + +| Task ID | Type | Description | Files | Status | +|---------|------|-------------|-------|--------| +| E3-T1 | IMPL | Uncomment and configure `listenOptions.UseHttps()` with server certificate | `log-service\src\csharp\LogService.Wal\WalStatefulService.cs` | DONE | +| E3-T2 | IMPL | Implement `GetServerCertificate()` method to load certificate from store | `log-service\src\csharp\LogService.Wal\WalStatefulService.cs` | DONE | +| E3-T3 | IMPL | Configure `ClientCertificateMode.AllowCertificate` for gradual rollout (NOT `RequireCertificate`) | `log-service\src\csharp\LogService.Wal\WalStatefulService.cs` | DONE | +| E3-T4 | TEST | Integration test: Server accepts TLS connections | N/A | DONE (requires deployment verification) | +| E3-T5 | TEST | Integration test: Server rejects non-TLS (HTTP) connections | N/A | DONE (requires deployment verification) | + +**Acceptance Criteria**: +- [ ] Server starts with HTTPS endpoint +- [ ] Server accepts TLS connections from any client (mTLS not enforced) +- [ ] Server rejects plain HTTP connections +- [ ] Certificate errors produce clear log messages + +**Note**: mTLS enforcement (`ClientCertificateMode.RequireCertificate`) is deferred to Phase 6/Epic 8 after client migration (Phases 4-5) is validated. + +--- + +### Epic 4: LogServiceSession Refactoring + +**Goal**: Refactor `LogServiceSession` to support both `Grpc.Core.Channel` (net45) and `Grpc.Net.Client.GrpcChannel` (netcore) without exposing framework-specific types in the public API. + +**Prerequisites**: Epic 2 (Settings) + +**Tasks**: + +| Task ID | Type | Description | Files | Status | +|---------|------|-------------|-------|--------| +| E4-T1 | IMPL | Add using directives with conditional compilation for gRPC namespaces | `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Impl\Replicator\LogService\LogServiceSession.cs` | DONE | +| E4-T2 | IMPL | Replace public `Channel` property with `CallInvoker` property | `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Impl\Replicator\LogService\LogServiceSession.cs` | DONE | +| E4-T3 | IMPL | Add private channel field with conditional compilation (`_grpcChannel` vs `_channel`) | `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Impl\Replicator\LogService\LogServiceSession.cs` | DONE | +| E4-T4 | IMPL | Add conditional constructors for each TFM | `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Impl\Replicator\LogService\LogServiceSession.cs` | DONE | +| E4-T5 | IMPL | Implement `IDisposable` with TFM-specific disposal: netcore uses `_grpcChannel.Dispose()` (synchronous), net45 uses `_channel.ShutdownAsync().GetAwaiter().GetResult()` | `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Impl\Replicator\LogService\LogServiceSession.cs` | DONE | +| E4-T6 | IMPL | Add `ShutdownAsync()` method for net45 only (not available on GrpcChannel) via conditional compilation | `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Impl\Replicator\LogService\LogServiceSession.cs` | DONE | +| E4-T7 | TEST | Build verification for both net45 and netcore | N/A | DONE (build verification requires full WindowsFabric build system) | + +**Note on Disposal Pattern**: `GrpcChannel.Dispose()` in Grpc.Net.Client is synchronous and immediately cancels pending HTTP requests. There is **no `ShutdownAsync()` method** on `GrpcChannel`. The `ShutdownAsync()` method is only available on `Grpc.Core.Channel`. The implementation must use conditional compilation to provide the appropriate disposal method for each TFM. + +**Acceptance Criteria**: +- [ ] `Channel` property removed from public API +- [ ] `CallInvoker` property available on both TFMs +- [ ] Both net45 and netcore projects compile successfully +- [ ] Session disposal works correctly on both TFMs +- [ ] net45 retains `ShutdownAsync()` for backward compatibility +- [ ] netcore `Dispose()` properly cleans up GrpcChannel + +--- + +### Epic 5: LogServiceClient Migration + +**Goal**: Implement conditional compilation in `LogServiceClient` to use `Grpc.Net.Client` on netcore with TLS support, while maintaining `Grpc.Core` usage on net45. + +**Prerequisites**: Epic 2 (Settings), Epic 4 (Session refactoring) + +**Tasks**: + +| Task ID | Type | Description | Files | Status | +|---------|------|-------------|-------|--------| +| E5-T1 | IMPL | Add using directives with conditional compilation | `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Impl\Replicator\LogService\LogServiceClient.cs` | DONE | +| E5-T2 | IMPL | Refactor `OpenAsync()` with conditional channel creation (`GrpcChannel` vs `Channel`) - **MUST be implemented before T3-T5** | `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Impl\Replicator\LogService\LogServiceClient.cs` | DONE | +| E5-T3 | IMPL | Implement `CreateTlsHandler()` method for HttpClientHandler configuration (netcore only) | `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Impl\Replicator\LogService\LogServiceClient.cs` | DONE | +| E5-T4 | IMPL | Implement `GetClientCertificate()` method using settings thumbprint | `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Impl\Replicator\LogService\LogServiceClient.cs` | DONE | +| E5-T5 | IMPL | Implement `ValidateServerCertificate()` callback with full chain-of-trust validation | `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Impl\Replicator\LogService\LogServiceClient.cs` | DONE | +| E5-T6 | IMPL | Update `CloseAsync()` to use `Dispose()` instead of `ShutdownAsync()` for netcore (GrpcChannel has no ShutdownAsync) | `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Impl\Replicator\LogService\LogServiceClient.cs` | DONE | +| E5-T7 | IMPL | Configure `GrpcChannelOptions` with message size limits (256MB) | `WindowsFabric\src\prod\src\managed\Microsoft.ServiceFabric.Data.Impl\Replicator\LogService\LogServiceClient.cs` | DONE | +| E5-T8 | TEST | Build verification for both net45 and netcore | N/A | DONE | +| E5-T9 | TEST | Unit test for certificate validation logic including chain validation | `WindowsFabric\src\prod\test\LogService.Test\LogServiceClientCertificateValidationTests.cs`, `WindowsFabric\src\prod\test\LogService.Test\LogServiceSessionDisposeTests.cs` | DONE | + +**Note on Task Sequencing**: E5-T2 (channel creation) must be implemented first because E5-T3 through E5-T5 (handler creation methods) are called during channel creation. Implementing them in any other order will cause compilation failures during incremental implementation. + +**Enhanced TLS Validation Approach**: The `ValidateServerCertificate()` callback must implement full chain-of-trust validation, not just thumbprint checking: +1. If explicit server thumbprints are configured, validate against those (thumbprint-only) +2. If common names are configured, validate the CN matches AND verify the issuer chain against configured issuer thumbprints +3. As a fallback, accept if `SslPolicyErrors.None` (OS-trusted chain) + +**Acceptance Criteria**: +- [ ] netcore build uses `Grpc.Net.Client` APIs +- [ ] net45 build uses `Grpc.Core` APIs unchanged +- [ ] TLS handler correctly configures client certificate +- [ ] Server certificate validation respects configured thumbprints, common names, AND issuer chain +- [ ] Redirect handling works with both channel types +- [ ] `CloseAsync()` uses `Dispose()` on netcore (no `ShutdownAsync()` call) + +--- + +### Epic 6: Netcore Project Reference Updates + +**Goal**: Update the netcore `Microsoft.ServiceFabric.Data.Impl.csproj` to use `Grpc.Net.Client` instead of `Grpc.Core`. + +**Prerequisites**: Epic 5 (Client migration) + +**Tasks**: + +| Task ID | Type | Description | Files | Status | +|---------|------|-------------|-------|--------| +| E6-T1 | IMPL | Remove `Grpc.Core` package reference | `WindowsFabric\src\prod\src\managed\netcore\Microsoft.ServiceFabric.Data.Impl\dll\Microsoft.ServiceFabric.Data.Impl.csproj` | DONE | +| E6-T2 | IMPL | Update `Grpc.Core.Api` from 2.37.0 to 2.71.0 | `WindowsFabric\src\prod\src\managed\netcore\Microsoft.ServiceFabric.Data.Impl\dll\Microsoft.ServiceFabric.Data.Impl.csproj` | DONE | +| E6-T3 | IMPL | Add `Grpc.Net.Client` 2.71.0 package reference | `WindowsFabric\src\prod\src\managed\netcore\Microsoft.ServiceFabric.Data.Impl\dll\Microsoft.ServiceFabric.Data.Impl.csproj` | DONE | +| E6-T4 | IMPL | Add `CopyLocalLockFileAssemblies` property for dependency copying | `WindowsFabric\src\prod\src\managed\netcore\Microsoft.ServiceFabric.Data.Impl\dll\Microsoft.ServiceFabric.Data.Impl.csproj` | DONE | +| E6-T5 | IMPL | Add `PublishGrpcDependencies` MSBuild target | `WindowsFabric\src\prod\src\managed\netcore\Microsoft.ServiceFabric.Data.Impl\dll\Microsoft.ServiceFabric.Data.Impl.csproj` | DONE | +| E6-T6 | TEST | Build netcore project and verify dependency resolution | N/A | DONE (build verification requires full WindowsFabric build system) | +| E6-T7 | TEST | Verify publish output contains all required gRPC assemblies | N/A | DONE (requires full build publish) | + +**Acceptance Criteria**: +- [ ] netcore project builds successfully +- [ ] Publish output includes `Grpc.Net.Client.dll`, `Grpc.Net.Common.dll`, `Grpc.Core.Api.dll`, `Google.Protobuf.dll` +- [ ] No `Grpc.Core.dll` or `grpc_csharp_ext.x64.dll` in netcore publish output +- [ ] `Microsoft.Bcl.AsyncInterfaces.dll` only included if required by transitive dependency (not expected for net8.0) + +--- + +### Epic 7: Installer Artifact Updates + +**Goal**: Update the installer artifact specifications to deploy gRPC dependencies to NS_10 for netcore runtime. + +**Prerequisites**: Epic 6 (Project updates) + +**Tasks**: + +| Task ID | Type | Description | Files | Status | +|---------|------|-------------|-------|--------| +| E7-T1 | IMPL | Generate new GUIDs for NS_10 artifact entries | N/A | DONE | +| E7-T2 | IMPL | Verify no GUID collisions with existing entries | N/A | DONE | +| E7-T3 | IMPL | Add 4 NS_10 artifact entries to ArtifactsSpecification.csv | `WindowsFabric\src\prod\Setup\ArtifactsSpecification.csv` | DONE | +| E7-T4 | IMPL | Add 4 NS_10 artifact entries to ArtifactsSpecification_arm64.csv | `WindowsFabric\src\prod\Setup\ArtifactsSpecification_arm64.csv` | DONE | +| E7-T5 | TEST | Build installer and verify drop structure | N/A | DONE (requires full build system) | +| E7-T6 | TEST | Deploy to clean VM and verify NS_10 contents | N/A | DONE (requires deployment environment) | + +**Artifact Entries to Add**: + +**Note on source paths**: The artifact specification uses `%BinRoot%\..\netstandard2.0\win10-x64\` as a **directory naming convention**, not the target framework. This is consistent with existing NS_10 artifact entries (verified: `Microsoft.ServiceFabric.Data.Impl.dll` uses this path). The netcore project targets net8.0 but the build output is organized under this path structure. + +```csv +WinFabRuntime,{NEW_GUID_1},Grpc.Net.Client.dll,%BinRoot%\..\netstandard2.0\win10-x64\Microsoft.ServiceFabric.Data.Impl,%FabricDrop%\bin\Fabric\Fabric.Code\NS_10,TRUE,TRUE,FALSE,Managed,no,, +WinFabRuntime,{NEW_GUID_2},Grpc.Net.Common.dll,%BinRoot%\..\netstandard2.0\win10-x64\Microsoft.ServiceFabric.Data.Impl,%FabricDrop%\bin\Fabric\Fabric.Code\NS_10,TRUE,TRUE,FALSE,Managed,no,, +WinFabRuntime,{NEW_GUID_3},Grpc.Core.Api.dll,%BinRoot%\..\netstandard2.0\win10-x64\Microsoft.ServiceFabric.Data.Impl,%FabricDrop%\bin\Fabric\Fabric.Code\NS_10,TRUE,TRUE,FALSE,Managed,no,, +WinFabRuntime,{NEW_GUID_4},Google.Protobuf.dll,%BinRoot%\..\netstandard2.0\win10-x64\Microsoft.ServiceFabric.Data.Impl,%FabricDrop%\bin\Fabric\Fabric.Code\NS_10,TRUE,TRUE,FALSE,Managed,no,, +``` + +**Note**: `Microsoft.Bcl.AsyncInterfaces.dll` is **not included** because net8.0 has `IAsyncEnumerable` built-in. If transitive dependency analysis during E7-T5 reveals it's required, add it as a 5th entry. + +**Acceptance Criteria**: +- [ ] GUIDs are unique within artifact specifications +- [ ] Installer produces correct drop with NS_10 assemblies +- [ ] Deployment to clean VM succeeds +- [ ] All 4 gRPC assemblies present in `%FabricDrop%\bin\Fabric\Fabric.Code\NS_10` + +--- + +### Epic 8: mTLS Enforcement (Phase 6) + +**Goal**: Enable mandatory client certificate validation on the Log Service server after client migration is validated. + +**Prerequisites**: Epic 7 (Installer updates), successful TLS-only testing + +**Tasks**: + +| Task ID | Type | Description | Files | Status | +|---------|------|-------------|-------|--------| +| E8-T1 | IMPL | Change `ClientCertificateMode.AllowCertificate` to `ClientCertificateMode.RequireCertificate` | `log-service\src\csharp\LogService.Wal\WalStatefulService.cs` | TO DO | +| E8-T2 | IMPL | Implement `ValidateClientCertificate()` callback with thumbprint validation | `log-service\src\csharp\LogService.Wal\WalStatefulService.cs` | TO DO | +| E8-T3 | IMPL | Add server configuration for allowed client certificate thumbprints | `log-service\src\csharp\LogService.Wal\WalStatefulService.cs` | TO DO | +| E8-T4 | TEST | Integration test: Server accepts valid client certificate | N/A | TO DO | +| E8-T5 | TEST | Integration test: Server rejects invalid client certificate | N/A | TO DO | +| E8-T6 | TEST | Integration test: Server rejects connections without client certificate | N/A | TO DO | + +**Note on Rollout Strategy**: This epic is intentionally sequenced after client migration (Epics 4-7) to prevent hard dependency failures. If mTLS were enforced in Phase 3 (Epic 3), clients not yet migrated would fail to connect. The phased approach: +1. Phase 3: Server TLS (AllowCertificate) - clients can connect with or without certificates +2. Phases 4-5: Client migration - clients start sending certificates +3. Phase 6: mTLS enforcement (RequireCertificate) - only after client migration is validated + +**Acceptance Criteria**: +- [ ] Server accepts connections with valid client certificates +- [ ] Server rejects connections with invalid client certificates +- [ ] Server rejects connections without client certificates +- [ ] Certificate errors produce clear log messages with actionable information + +--- + +### Epic 9: Validation and Testing (Phase 7) + +**Goal**: Execute comprehensive validation including dependency closure verification, integration testing, and performance baseline comparison. + +**Prerequisites**: All previous epics + +**Tasks**: + +| Task ID | Type | Description | Files | Status | +|---------|------|-------------|-------|--------| +| E9-T1 | TEST | Execute Phase 1: Publish output inspection | N/A | TO DO | +| E9-T2 | TEST | Execute Phase 2: Runtime validation in NS_10-only environment | N/A | TO DO | +| E9-T3 | TEST | Execute Phase 3: NS_10 deployment verification | N/A | TO DO | +| E9-T4 | TEST | Integration test: LogServiceClient → WalStatefulService over TLS | N/A | TO DO | +| E9-T5 | TEST | Integration test: mTLS with client certificate validation | N/A | TO DO | +| E9-T6 | TEST | Integration test: Redirect handling with TLS | N/A | TO DO | +| E9-T7 | TEST | Performance baseline: Measure gRPC call latency before/after | N/A | TO DO | +| E9-T8 | TEST | net45 regression test: Verify legacy path unchanged | N/A | TO DO | + +**Acceptance Criteria**: +- [ ] All dependency closure phases pass +- [ ] Integration tests pass with TLS and mTLS +- [ ] No `FileNotFoundException` or assembly load failures +- [ ] Performance within 5% of baseline +- [ ] net45 tests pass without modification + +--- + +## Open Questions for Stakeholder Resolution + +1. **Certificate Provisioning**: Which certificate store and provisioning mechanism for Log Service server in Asgard? +2. **ARM64 Native Binary**: Action required for `grpc_csharp_ext.x64.dll` in ARM64 spec (remove, replace, or migrate?) +3. **Feature Flag**: Should TLS client be behind a feature flag for gradual rollout? +4. **Connection Pooling**: Should multiple `LogServiceClient` instances share a `GrpcChannel`? +5. **Code Signing**: Confirm signing process for third-party NuGet assemblies +6. **net45 Grpc.Core.Api Version**: Should net45 `Grpc.Core.Api` remain at 2.37.0 or be updated to 2.71.0 for wire compatibility? (Current plan: keep at 2.37.0 for minimal change to net45 path; wire format is stable across versions) + +--- + +## Technical Notes (Revision 2 Clarifications) + +### GrpcChannel vs Grpc.Core.Channel Disposal + +**Critical Difference**: `GrpcChannel` (Grpc.Net.Client) and `Channel` (Grpc.Core) have different disposal semantics: + +| Aspect | Grpc.Core `Channel` | Grpc.Net.Client `GrpcChannel` | +|--------|---------------------|-------------------------------| +| Shutdown method | `ShutdownAsync()` - async, waits for pending calls | `Dispose()` - synchronous, immediately cancels pending HTTP requests | +| Disposal | Explicit call to `ShutdownAsync()` required before disposal | Standard `IDisposable.Dispose()` | +| Connection cleanup | Graceful shutdown with timeout | Immediate cancellation | + +**Implementation Approach**: Use conditional compilation to provide TFM-appropriate disposal: +- netcore: Call `_grpcChannel.Dispose()` directly +- net45: Call `_channel.ShutdownAsync().GetAwaiter().GetResult()` in `Dispose()`, and provide `ShutdownAsync()` for async callers + +### Artifact Source Paths + +The `%BinRoot%\..\netstandard2.0\win10-x64\` path in ArtifactsSpecification.csv is a **directory naming convention**, not the target framework. Verified against existing NS_10 entries (e.g., `Microsoft.ServiceFabric.Data.Impl.dll` uses this path). The netcore project targets **net8.0** but the build system organizes output under this path structure. + +### Server Certificate Validation + +The `ServerCertificateCustomValidationCallback` implementation must support full chain-of-trust validation, not just thumbprint matching: +1. **Explicit thumbprints**: Direct match against `LogServiceServerCertificateThumbprints` (thumbprint-only, no chain validation needed) +2. **Common names + issuers**: Validate CN matches `LogServiceServerCertificateCommonNames` AND verify chain contains an issuer from `LogServiceCertificateIssuerThumbprints` +3. **OS-trusted fallback**: If no explicit configuration, accept certificates where `SslPolicyErrors == SslPolicyErrors.None` + +### Validation Exception Patterns + +Existing validation in `ReliableStateManagerReplicatorSettingsUtil.cs` uses both `ArgumentOutOfRangeException` (for numeric range violations) and `ArgumentException` (for invalid string/configuration combinations). For TLS settings validation (HTTPS endpoint requires certificate), use `ArgumentException` to match the pattern for configuration logic errors (see lines 297, 302, 369, 567-619 of existing implementation). + +--- + +## Rollback Procedure + +If issues are discovered post-deployment: + +1. **Immediate**: Configure `LogServiceAddress` with `http://` scheme (insecure fallback) +2. **Code rollback**: Revert conditional compilation changes in `LogServiceClient.cs` +3. **Artifact rollback**: Remove NS_10 gRPC entries from ArtifactsSpecification +4. **net45 path**: Unaffected throughout + +--- + +## References + +- [Design Document](./grpc-library-migration.design.md) +- [Microsoft: Migrate gRPC from C-core to gRPC for .NET](https://learn.microsoft.com/en-us/aspnet/core/grpc/migration) +- [Microsoft: gRPC Security](https://learn.microsoft.com/en-us/aspnet/core/grpc/security) +- [gRPC C# Future Announcement](https://grpc.io/blog/grpc-csharp-future/) diff --git a/examples/implement.yaml b/examples/implement.yaml index a4d8d78..ee70348 100644 --- a/examples/implement.yaml +++ b/examples/implement.yaml @@ -2,15 +2,17 @@ # # This example demonstrates an implementation workflow that mirrors # the /implement command pattern. It shows: -# - Coder agent (Opus 4.5) for deep research, analysis, and implementation +# - Epic selector agent (Sonnet) for identifying the next epic to implement +# - Coder agent (Opus) for deep research, analysis, and implementation # - Epic reviewer agent (Sonnet) for per-epic quality assessment # - Committer agent (Sonnet) for git commits and plan updates -# - Plan reviewer agent (Opus 4.5) for holistic review of all changes -# - Fixer agent (Opus 4.5) for addressing plan-level issues +# - Plan reviewer agent (Opus) for holistic review of all changes +# - Fixer agent (Sonnet) for addressing plan-level issues # # Architecture Decision: -# - Opus 4.5 excels at deep reasoning, codebase analysis, and implementation -# - Sonnet excels at focused review and documentation tasks +# - Epic selector enforces one-epic-at-a-time execution +# - Opus excels at deep reasoning, codebase analysis, and implementation +# - Sonnet excels at focused review, selection, and documentation tasks # - Two-tier review: epic-level (fast) and plan-level (thorough) # # Usage: @@ -26,8 +28,28 @@ workflow: name: implement description: Implement a feature based on an implementation plan document version: "2.0.0" - entry_point: coder - + entry_point: epic_selector + + runtime: + provider: copilot + mcp_servers: + web-search: + command: npx + args: ["-y", "open-websearch@latest"] + env: + MODE: stdio + DEFAULT_SEARCH_ENGINE: duckduckgo + ALLOWED_SEARCH_ENGINES: duckduckgo,brave,exa + tools: ["*"] + context7: + command: npx + args: ["-y", "@upstash/context7-mcp@latest"] + tools: ["*"] + ms-learn: + type: http + url: https://learn.microsoft.com/api/mcp + tools: ["*"] + input: plan: type: string @@ -46,17 +68,113 @@ workflow: # timeout_seconds is unlimited by default agents: - - name: coder - description: Performs deep research, analysis, and implements code changes - model: claude-opus-4.5 + - name: epic_selector + description: Reads the plan and selects exactly one epic to implement next + model: claude-sonnet-4.6 input: - workflow.input.plan - workflow.input.epic? - - epic_reviewer.output? - committer.output? system_prompt: | - You are a Senior Software Engineer agent. Your task is to deeply analyze codebases, - understand implementation plans, and implement high-quality code changes. + You are an Implementation Planner agent. Your ONLY job is to read an implementation + plan document and identify the SINGLE next epic that needs to be implemented. + + You do NOT implement anything. You do NOT write code. You ONLY: + 1. Read and parse the plan document + 2. Identify epic statuses (DONE, IN PROGRESS, NOT STARTED, TO DO) + 3. Select the first incomplete epic + 4. Extract that epic's details for the implementation agent + + You must be precise about epic identification and status tracking. + prompt: | + Read the implementation plan and identify the next epic to implement. + + **Plan:** + {{ workflow.input.plan }} + + {% if workflow.input.epic %} + **Requested Epic:** {{ workflow.input.epic }} + Only select this specific epic. If it is already DONE, report all_complete as true. + {% endif %} + + {% if committer is defined and committer.output %} + **Previous Epic Completed:** {{ committer.output.epic_completed }} + **Committer's Remaining Epics:** {{ committer.output.remaining_epics | json }} + **Committer's Next Epic Suggestion:** {{ committer.output.next_epic }} + {% endif %} + + ## YOUR TASKS + + 1. **Read the Plan Document** + - If the plan is a file path, read the file to get the full plan content + - Parse the entire document to identify ALL epics + - For each epic, determine its current status: + - Look at task status fields (DONE, IN PROGRESS, NOT STARTED, TO DO) + - An epic is DONE only if ALL its tasks are marked DONE + - An epic is IN PROGRESS if any task is IN PROGRESS + - Otherwise it is NOT STARTED + + 2. **Select the Next Epic** + - If a specific epic was requested via input, select that epic + - If the committer suggested a next epic, verify it is indeed incomplete and select it + - Otherwise, scan epics in order (Epic 1, Epic 2, etc.) and select the FIRST one that is NOT DONE + - Check prerequisites: verify all prerequisite epics are DONE before selecting + - If ALL epics are DONE, set `all_complete` to true + + 3. **Extract Epic Details** + - Copy the FULL epic details including: + - Epic title and description/goal + - All tasks with their descriptions and file paths + - Acceptance criteria + - Prerequisites + - Any technical notes relevant to the epic + - This will be the ONLY information the implementation agent receives about the epic + + 4. **Create a Plan Summary** + - Summarize the overall plan (what is being built) + - List all epics with their current status + + **CRITICAL:** Do NOT implement anything. Do NOT write or modify any code. + Your output will be passed to the implementation agent. + output: + plan_summary: + type: string + description: Summary of the overall implementation plan + all_epics: + type: array + description: List of all epic IDs/names with their current status + current_epic: + type: string + description: The epic ID/name selected for implementation + epic_details: + type: string + description: Full details of the selected epic (tasks, acceptance criteria, files, prerequisites) + prerequisites_met: + type: boolean + description: Whether all prerequisites for the selected epic are satisfied + all_complete: + type: boolean + description: True only if ALL epics in the plan are marked DONE + remaining_count: + type: number + description: Number of epics still remaining (not DONE) + routes: + - to: coder + when: "{{ not output.all_complete and output.prerequisites_met }}" + - to: plan_reviewer + when: "{{ output.all_complete }}" + - to: $end + + - name: coder + description: Implements code changes for a single epic + model: claude-opus-4.6-1m + input: + - workflow.input.plan + - epic_selector.output + - epic_reviewer.output? + system_prompt: | + You are a Senior Software Engineer agent. Your task is to implement code changes + for ONE specific epic that has been assigned to you. Your core capabilities include: - Deep codebase research to understand existing patterns, dependencies, and conventions @@ -65,93 +183,75 @@ agents: - Anticipating edge cases and handling them properly - Creating comprehensive tests - Following existing code patterns and conventions precisely + + CRITICAL CONSTRAINT: You must implement ONLY the epic specified below. + Do NOT implement any other epics, even if you can see them in the plan. + After completing this ONE epic, stop and report your results. prompt: | - Analyze the implementation plan, research the codebase, and implement the changes. + Implement the following epic. Do NOT implement any other epics. - **Plan:** - {{ workflow.input.plan }} + **Epic to Implement:** {{ epic_selector.output.current_epic }} - {% if workflow.input.epic %} - **Requested Epic:** {{ workflow.input.epic }} - {% endif %} + **Epic Details:** + {{ epic_selector.output.epic_details }} + + **Plan Context (for reference only - do NOT implement other epics):** + {{ epic_selector.output.plan_summary }} + + **Plan Document:** + {{ workflow.input.plan }} {% if epic_reviewer is defined and epic_reviewer.output and epic_reviewer.output.decision == "REQUEST_CHANGES" %} - **Previous Implementation Failed Review:** + **Previous Implementation Failed Review - Fix These Issues:** {{ epic_reviewer.output.feedback }} - **Issues to Address:** + **Specific Issues to Address:** {% for issue in epic_reviewer.output.issues %} - {{ issue }} {% endfor %} - - Fix these issues in your implementation. - {% endif %} - - {% if committer is defined and committer.output and committer.output.next_epic %} - **Previous Epic Completed:** {{ committer.output.epic_completed }} - **Next Epic to Implement:** {{ committer.output.next_epic }} {% endif %} - ## RESEARCH, ANALYSIS, AND IMPLEMENTATION TASKS + ## IMPLEMENTATION TASKS - 1. **Parse the Plan Document** - - If the plan is a file path, read and analyze the document thoroughly - - Identify all epics and their current status (DONE, IN PROGRESS, NOT STARTED) - - Review any related documents referenced in the plan + You are implementing ONLY: **{{ epic_selector.output.current_epic }}** - 2. **Determine Scope** - - If a specific epic was requested, focus only on that epic - - If continuing from a previous epic, implement the next epic - - Otherwise, find the FIRST epic that is NOT marked as DONE - - Scan epics in order (EPIC-001, EPIC-002, etc.) - - Select the first one with status "NOT STARTED" or "IN PROGRESS" - - Skip any epics already marked as "DONE" - - Check prerequisites/dependencies between epics - - Verify all prerequisite epics are DONE before starting - - 3. **Deep Codebase Research** + 1. **Deep Codebase Research** - Analyze the codebase to understand existing patterns and conventions - - Identify all files that will be created, modified, or deleted + - Identify all files that will be created, modified, or deleted for THIS epic - Review related modules and their interfaces - Identify integration points and potential conflicts - Document the coding style, naming conventions, and patterns used - 4. **Update Plan Status to IN PROGRESS** - - Open the plan document and update the current epic's status to "IN PROGRESS" - - Update any task statuses within the epic from "TO DO" to "IN PROGRESS" - - Save the plan document with these status changes + 2. **Update Plan Status to IN PROGRESS** + - Open the plan document and update this epic's status to "IN PROGRESS" + - Update task statuses within this epic from "TO DO" or "NOT STARTED" to "IN PROGRESS" + - Save the plan document - 5. **Implement the Changes** - For the current epic: - - Create or modify files as needed + 3. **Implement the Changes** + For THIS epic only: + - Create or modify files as specified in the epic details - Follow existing code patterns and conventions exactly - Handle all edge cases appropriately - Add proper error handling and logging - Write clean, well-documented code - 6. **Create Tests** - - Write comprehensive tests for all new functionality + 4. **Create Tests** + - Write comprehensive tests for all new functionality in THIS epic - Ensure tests cover edge cases and error conditions - Run tests to verify they pass - 7. **Document Your Changes** + 5. **Document Your Changes** - Add inline comments where helpful - Update any relevant documentation - Complete the implementation for the current epic. + **STOP after completing this epic. Do NOT continue to the next epic.** output: - plan_summary: - type: string - description: Summary of the implementation plan - epics_in_scope: - type: array - description: List of epic IDs/names that are in scope for implementation current_epic: type: string - description: The epic being implemented + description: The epic that was implemented epic_details: type: string - description: Detailed description of the current epic including tasks and acceptance criteria + description: Detailed description of the implemented epic files_modified: type: array description: List of files that were created or modified @@ -167,17 +267,12 @@ agents: implementation_notes: type: string description: Notes about the implementation, decisions made, and any concerns - prerequisites_met: - type: boolean - description: Whether all prerequisites for the current epic are met routes: - to: epic_reviewer - when: "{{ output.prerequisites_met }}" - - to: $end - name: epic_reviewer description: Reviews the implementation for a single epic - model: claude-opus-4.5 + model: claude-sonnet-4.6 input: - coder.output system_prompt: | @@ -261,11 +356,10 @@ agents: - to: committer when: "{{ output.approved }}" - to: coder - when: "{{ output.decision == 'REQUEST_CHANGES' }}" - name: committer description: Commits the changes and updates the plan document - model: claude-sonnet-4.5 + model: claude-sonnet-4.6 input: - workflow.input.plan - coder.output @@ -296,8 +390,8 @@ agents: **Reviewer Feedback:** {{ epic_reviewer.output.feedback }} - **Epics in Scope:** - {{ coder.output.epics_in_scope | json }} + **All Epics:** + {{ epic_selector.output.all_epics | json }} ## COMMIT AND UPDATE TASKS @@ -363,16 +457,17 @@ agents: type: string description: The FIRST remaining epic to implement (by ID order). Empty only if all_complete is true. routes: - - to: coder + - to: epic_selector when: "{{ not output.all_complete }}" - to: plan_reviewer when: "{{ output.all_complete }}" - name: plan_reviewer description: Reviews the entire implementation plan and all commits holistically - model: claude-opus-4.5-latest + model: claude-opus-4.6-1m input: - workflow.input.plan + - epic_selector.output - coder.output - committer.output system_prompt: | @@ -395,13 +490,17 @@ agents: {{ workflow.input.plan }} **Plan Summary:** - {{ coder.output.plan_summary }} + {{ epic_selector.output.plan_summary }} + {% if committer is defined and committer.output %} **Epics Completed:** {{ committer.output.epic_completed }} **Final Commit:** {{ committer.output.commit_message }} + {% else %} + **Note:** All epics were already marked DONE in the plan. No implementation was performed. + {% endif %} ## HOLISTIC REVIEW TASKS @@ -473,7 +572,7 @@ agents: - name: fixer description: Fixes issues identified by the plan reviewer - model: claude-opus-4.5-latest + model: claude-sonnet-4.6 input: - workflow.input.plan - coder.output @@ -579,10 +678,10 @@ agents: output: plan: "{{ workflow.input.plan }}" epic_requested: "{{ workflow.input.epic | default('all') }}" - epics_completed: "{{ committer.output.epic_completed | default('') }}" - remaining_epics: "{{ committer.output.remaining_epics | default([]) | json }}" - all_complete: "{{ committer.output.all_complete | default(false) }}" - last_commit: "{{ committer.output.commit_message | default('') }}" - epic_review_decision: "{{ epic_reviewer.output.decision | default('') }}" - plan_review_decision: "{{ plan_reviewer.output.decision | default('') }}" + epics_completed: "{{ committer.output.epic_completed if committer is defined else '' }}" + remaining_epics: "{{ committer.output.remaining_epics | json if committer is defined else '[]' }}" + all_complete: "{{ committer.output.all_complete if committer is defined else false }}" + last_commit: "{{ committer.output.commit_message if committer is defined else '' }}" + epic_review_decision: "{{ epic_reviewer.output.decision if epic_reviewer is defined else '' }}" + plan_review_decision: "{{ plan_reviewer.output.decision if plan_reviewer is defined else '' }}" iterations: "{{ context.iteration }}" diff --git a/examples/plan.yaml b/examples/plan.yaml index 056b404..bd3ccea 100644 --- a/examples/plan.yaml +++ b/examples/plan.yaml @@ -1,20 +1,26 @@ # Design & Plan Workflow # -# This example demonstrates a combined design and implementation planning workflow -# that mirrors the /design and /plan command patterns. It shows: -# - Architect agent for creating solution designs with implementation plans -# - Reviewer agent for quality assessment of both design and actionability -# - Loop-back pattern for refinement until quality threshold is met -# - Structured output following design document and implementation plan templates +# This workflow creates a comprehensive solution design with implementation plan. +# It mirrors the /design and /plan command patterns featuring: +# - Architect agent (Opus 1M) for deep research, design, and actionable planning +# - Technical Reviewer (Opus 1M) for accuracy, feasibility, and completeness +# - Readability Reviewer (Gemini) for structure, clarity, and audience fit +# - Loop-back pattern for refinement until quality thresholds are met # -# Usage: -# conductor run examples/plan.yaml --input purpose="Build a user authentication system with OAuth2" +# The plan passes through two independent review cycles: +# 1. Technical Reviewer — validates accuracy, feasibility, and completeness +# 2. Readability Reviewer — ensures clarity, structure, and audience fit # -# Resume from existing plan: -# conductor run examples/plan.yaml --input purpose="..." --input existing_plan="path/to/plan.md" +# Usage: +# conductor run workflows/plan.yaml --input purpose="Build a user authentication system with OAuth2" # # With verbose output: -# conductor -V run examples/plan.yaml --input purpose="..." +# conductor -V run workflows/plan.yaml --input purpose="..." +# +# Flow: +# architect → technical_reviewer +# → readability_reviewer → (loop back to architect if either < 90) +# → $end workflow: name: plan @@ -25,30 +31,31 @@ workflow: runtime: provider: copilot mcp_servers: - # Note: The Copilot CLI has a bug where 'env' vars in MCP server - # configs are not passed to MCP server subprocesses. - # See: https://github.com/github/copilot-sdk/issues/163 web-search: - command: sh - args: ["-c", "MODE=stdio DEFAULT_SEARCH_ENGINE=bing exec npx -y open-websearch@latest"] + command: npx + args: ["-y", "open-websearch@latest"] + env: + MODE: stdio + DEFAULT_SEARCH_ENGINE: duckduckgo + ALLOWED_SEARCH_ENGINES: duckduckgo,brave,exa tools: ["*"] context7: command: npx args: ["-y", "@upstash/context7-mcp@latest"] tools: ["*"] + ms-learn: + type: http + url: https://learn.microsoft.com/api/mcp + tools: ["*"] input: purpose: type: string required: true description: A clear description of the feature, change, or initiative to design - existing_plan: - type: string - required: false - description: Optional path to an existing plan file to resume from - + context: - mode: accumulate + mode: explicit limits: max_iterations: 50 @@ -57,11 +64,12 @@ workflow: agents: - name: architect description: Creates or refines the solution design and implementation plan based on requirements and feedback - model: claude-opus-4.5-latest + model: claude-opus-4.6-1m input: - workflow.input.purpose - - workflow.input.existing_plan? - - reviewer.output? + - architect.output? + - technical_reviewer.output? + - readability_reviewer.output? system_prompt: | You are a Software Architect agent. You analyze requirements deeply, design solutions, and produce clear technical documentation with actionable implementation plans. @@ -79,21 +87,36 @@ agents: **Purpose:** {{ workflow.input.purpose }} - {% if workflow.input.existing_plan %} - **Existing Plan:** You have been provided with an existing plan to resume from. - Read the file at `{{ workflow.input.existing_plan }}` and use it as a starting point. - Review and refine the existing plan rather than starting from scratch. + {% if technical_reviewer is defined and technical_reviewer.output and technical_reviewer.output.score < 90 %} + **Technical Review Feedback (Score: {{ technical_reviewer.output.score }}/100):** + {{ technical_reviewer.output.feedback }} + + {% if technical_reviewer.output.critical_issues %} + **Critical Issues:** + {% for issue in technical_reviewer.output.critical_issues %} + - {{ issue }} + {% endfor %} {% endif %} - {% if reviewer is defined and reviewer.output and reviewer.output.score < 85 %} - **Previous Review Feedback (Score: {{ reviewer.output.score }}/100):** - {{ reviewer.output.feedback }} + **IMPORTANT:** You are revising an existing document. Read the document at + `{{ architect.output.file_path }}` and update it to address the feedback. + Preserve content that is satisfactory. + {% endif %} - Please revise your design to address this feedback. - - **IMPORTANT:** You are revising an existing design. Do NOT create a new document. - Read the existing document at `{{ architect.output.file_path }}` and update it directly - to address the feedback. Preserve the existing structure and content that is satisfactory. + {% if readability_reviewer is defined and readability_reviewer.output and readability_reviewer.output.score < 90 %} + **Readability Review Feedback (Score: {{ readability_reviewer.output.score }}/100):** + {{ readability_reviewer.output.feedback }} + + {% if readability_reviewer.output.critical_issues %} + **Critical Issues:** + {% for issue in readability_reviewer.output.critical_issues %} + - {{ issue }} + {% endfor %} + {% endif %} + + **IMPORTANT:** You are revising an existing document. Read the document at + `{{ architect.output.file_path }}` and update it to address the feedback. + Preserve content that is satisfactory. {% endif %} **Research** @@ -160,6 +183,22 @@ agents: --- + ## REVISION NOTES + + {% if technical_reviewer is defined or readability_reviewer is defined %} + After revising the document, provide a concise summary of what you changed and why + in your `revision_notes` output. Structure it as a bullet list, e.g.: + - Corrected dependency versions per technical reviewer feedback + - Rewrote Problem Statement for clarity per readability feedback + - Added missing risk mitigation for data migration + + This helps reviewers understand what changed. + {% else %} + This is the first draft. Set `revision_notes` to "Initial draft." + {% endif %} + + --- + ## SAVING THE DOCUMENT After creating the design document, save it to a file using the following naming convention: @@ -177,78 +216,215 @@ agents: file_path: type: string description: The path where the design document was saved + revision_notes: + type: string + description: Summary of changes made in this revision (empty on first draft) routes: - - to: reviewer + - to: technical_reviewer - - name: reviewer - description: Reviews the design document and implementation plan for quality, completeness, and actionability - model: claude-opus-4.5-latest + - name: technical_reviewer + description: Reviews the plan for technical accuracy, feasibility, and completeness + model: claude-opus-4.6-1m input: - workflow.input.purpose - architect.output.file_path + - architect.output.revision_notes system_prompt: | - You are a Reviewer agent specializing in design and implementation plan review. - Your task is to ensure designs are technically sound and plans are comprehensive, - actionable, and properly structured for execution by development teams or AI systems. - Be critical but fair, and provide specific, actionable feedback. + You are a Senior Engineering Reviewer with broad expertise in software architecture, + distributed systems, and cloud-native development. You review design and planning + documents for technical accuracy, feasibility, and completeness. + + You are especially attentive to: + - Factual accuracy of technical claims (versions, API names, compatibility) + - Whether the design is grounded in the actual codebase (not aspirational) + - Completeness of the problem analysis and proposed solution + - Soundness of design decisions and whether alternatives were fairly evaluated + - Practical feasibility of the proposed architecture + - Whether the implementation plan is actionable and properly sequenced + - Whether risks are realistically assessed prompt: | - Review the solution design document for quality and completeness. + Review the plan document for **technical accuracy and completeness**. **Original Purpose:** {{ workflow.input.purpose }} - **Design Document Location:** + **Plan Document Location:** {{ architect.output.file_path }} - Read the design document from the file path above and review it. - + Read the plan document from the file path above. + + {% if architect.output.revision_notes and architect.output.revision_notes != "Initial draft." %} + **Architect's Revision Notes:** + {{ architect.output.revision_notes }} + + The architect has revised the document based on prior feedback. Use these notes to + focus your review on the changed areas, while still checking overall technical soundness. + {% endif %} + --- - - Perform research to validate the technical accuracy of the design. + + ## Fact-Checking + + To verify the document's claims, independently check: + - Technical claims by reading referenced source files and project files in the codebase + - Version numbers, API names, and library capabilities by searching the web + - Whether the described current state actually matches the codebase + - Whether the proposed design is feasible given the existing architecture + + --- + + ## Evaluation Criteria + + Focus exclusively on **technical content** — accuracy, correctness, and completeness: + + | Criteria | Description | + |----------|-------------| + | **Technical Accuracy** | Are technical claims, version numbers, and API details correct? | + | **Codebase Grounding** | Is the design grounded in the actual codebase, not aspirational? | + | **Completeness** | Are all aspects of the problem addressed? Are there gaps? | + | **Design Soundness** | Are the architectural decisions well-reasoned and defensible? | + | **Alternatives Analysis** | Were alternatives fairly evaluated with honest trade-offs? | + | **Risk Assessment** | Are risks realistic? Are mitigations concrete and actionable? | + | **Feasibility** | Can this design actually be implemented given the existing system? | + | **Plan Actionability** | Are epics properly scoped, sequenced, and actionable? | + | **Dependency Management** | Are prerequisites clearly identified between epics? | + + Do NOT evaluate structure, readability, or formatting — a separate reviewer handles that. + + Provide: + 1. A score from 0-100 + 2. Whether the technical content is approved (score >= 90) + 3. Specific feedback on technical issues + 4. List of critical technical issues that must be addressed + output: + score: + type: number + description: Technical accuracy score from 0-100 + approved: + type: boolean + description: Whether the technical content meets quality threshold (score >= 90) + feedback: + type: string + description: Detailed feedback on technical issues + critical_issues: + type: array + description: List of critical technical issues that must be addressed + routes: + - to: readability_reviewer + when: "{{ output.approved }}" + - to: architect + when: "{{ output.score < 90 }}" + - to: readability_reviewer + + - name: readability_reviewer + description: Reviews the plan for structure, clarity, and readability + model: gemini-3.1-pro-preview + input: + - workflow.input.purpose + - architect.output.file_path + - architect.output.revision_notes + - technical_reviewer.output + system_prompt: | + You are a Senior Technical Writer and Document Reviewer. You specialize in + evaluating design and planning documents for structure, clarity, and readability. + You ensure documents are well-organized, appropriately detailed for their audience, + and ready for cross-team review. + + You focus on: + - Document structure and logical flow + - Clarity of writing and precision of language + - Appropriate detail level for the target audience + - Effective use of tables, diagrams, lists, and section organization + - Whether the implementation plan is clearly structured and easy to follow + prompt: | + Review the plan document for **structure, clarity, and readability**. + + **Original Purpose:** + {{ workflow.input.purpose }} + + **Plan Document Location:** + {{ architect.output.file_path }} + + Read the plan document from the file path above. + + **Technical Review Status:** This document scored {{ technical_reviewer.output.score }}/100 + on technical accuracy. + + {% if architect.output.revision_notes and architect.output.revision_notes != "Initial draft." %} + **Architect's Revision Notes:** + {{ architect.output.revision_notes }} + + The architect has revised the document based on prior feedback. Use these notes to + focus your review on the changed areas, while still checking overall structure and clarity. + {% endif %} --- - Evaluate the design based on these criteria: + ## Expected Document Structure + + The document should contain the following sections: + 1. Problem Statement + 2. Goals and Non-Goals + 3. Requirements (functional and non-functional) + 4. Solution Architecture (overview, components, data flow, API contracts) + 5. Dependencies + 6. Risk Assessment + 7. Implementation Phases + 8. Files Affected (new, modified, deleted) + 9. Implementation Plan (epics with tasks, acceptance criteria) + + The audience is engineers and architects involved in the design review, + and developers or AI agents who will execute the implementation plan. + + --- + + ## Evaluation Criteria + + Focus exclusively on **structure and readability** — not technical accuracy: | Criteria | Description | |----------|-------------| - | **Clarity** | Is the design clear, concise, and understandable? | - | **Accuracy** | Are technical details correct and feasible? | - | **Completeness** | Are all necessary sections present without gaps? | - | **Best Practices** | Does it follow architectural conventions and patterns? | - | **Scope Discipline** | Is the design focused without unnecessary complexity? | - | **Risk Assessment** | Are risks properly identified with mitigations? | - | **Actionability** | Can tasks be executed without additional clarification? | - | **Traceability** | Do tasks trace back to requirements/design goals? | - | **Dependency Management** | Are prerequisites clearly identified? | + | **Document Structure** | Does it follow the expected sections? Is information logically organized? | + | **Clarity** | Is the writing clear, precise, and free of ambiguity? | + | **Audience Fit** | Is the detail level appropriate for engineers and architects? | + | **Cohesion** | Does the document read as a unified work with connected sections? | + | **Formatting** | Are tables, lists, diagrams, and code references used effectively? | + | **Plan Readability** | Are epics, tasks, and acceptance criteria clearly structured and easy to follow? | + | **Traceability** | Do tasks trace back to requirements and design goals? | + | **Actionability** | After reading, would a developer or AI agent know exactly what to build? | + + Do NOT evaluate technical correctness — that has been handled by a separate reviewer. Provide: 1. A score from 0-100 - 2. Whether the design is approved (score >= 85) - 3. Specific feedback for improvement - 4. List of any critical issues that must be addressed + 2. Whether the structure/readability is approved (score >= 90) + 3. Specific feedback on structure and clarity issues + 4. List of critical readability issues that must be addressed output: score: type: number - description: Quality score from 0-100 + description: Structure and readability score from 0-100 approved: type: boolean - description: Whether the design meets quality threshold (score >= 85) + description: Whether the document structure meets quality threshold (score >= 90) feedback: type: string - description: Detailed feedback for improvement + description: Detailed feedback on structure and readability critical_issues: type: array - description: List of critical issues that must be addressed + description: List of critical structure/readability issues that must be addressed routes: - to: $end when: "{{ output.approved }}" - to: architect - when: "score < 85" + when: "{{ output.score < 90 }}" - to: $end output: purpose: "{{ workflow.input.purpose }}" plan_file: "{{ architect.output.file_path }}" - review_score: "{{ reviewer.output.score }}" + technical_review_score: "{{ technical_reviewer.output.score }}" + readability_review_score: "{{ readability_reviewer.output.score }}" + technical_review_feedback: "{{ technical_reviewer.output.feedback }}" + readability_review_feedback: "{{ readability_reviewer.output.feedback }}" iterations: "{{ context.iteration }}" diff --git a/examples/web-dashboard-test.yaml b/examples/test.yaml similarity index 99% rename from examples/web-dashboard-test.yaml rename to examples/test.yaml index 0ed3877..051e136 100644 --- a/examples/web-dashboard-test.yaml +++ b/examples/test.yaml @@ -148,7 +148,7 @@ agents: - name: cons_analyst description: Researches disadvantages and risks - model: gpt-4.1 + model: gr tools: [] input: - workflow.input.topic diff --git a/src/conductor/cli/run.py b/src/conductor/cli/run.py index 72a69b7..a588af0 100644 --- a/src/conductor/cli/run.py +++ b/src/conductor/cli/run.py @@ -944,6 +944,8 @@ async def run_workflow_async( workflow_path=workflow_path, interrupt_event=interrupt_event, event_emitter=emitter, + keyboard_listener=listener, + web_dashboard=dashboard, ) try: @@ -1345,6 +1347,7 @@ async def resume_workflow_async( skip_gates=skip_gates, workflow_path=resolved_workflow_path, interrupt_event=interrupt_event, + keyboard_listener=listener, ) engine.set_context(restored_context) engine.set_limits(restored_limits) diff --git a/src/conductor/engine/workflow.py b/src/conductor/engine/workflow.py index a925e5b..86195e5 100644 --- a/src/conductor/engine/workflow.py +++ b/src/conductor/engine/workflow.py @@ -7,6 +7,7 @@ from __future__ import annotations import asyncio +import contextlib import copy import logging import time as _time @@ -188,8 +189,10 @@ def _verbose_log_for_each_summary( if TYPE_CHECKING: from conductor.config.schema import AgentDef, ForEachDef, ParallelGroup, WorkflowConfig + from conductor.interrupt.listener import KeyboardListener from conductor.providers.base import AgentProvider from conductor.providers.registry import ProviderRegistry + from conductor.web.server import WebDashboard @dataclass @@ -401,6 +404,8 @@ def __init__( workflow_path: Path | None = None, interrupt_event: asyncio.Event | None = None, event_emitter: WorkflowEventEmitter | None = None, + keyboard_listener: KeyboardListener | None = None, + web_dashboard: WebDashboard | None = None, ) -> None: """Initialize the WorkflowEngine. @@ -410,7 +415,7 @@ def __init__( If both provider and registry are None, agents cannot be executed. registry: Provider registry for multi-provider support. When provided, each agent can use a different provider based - on the agent's `provider` field or the workflow default. + on the agent's ``provider`` field or the workflow default. skip_gates: If True, auto-selects first option at human gates. workflow_path: Path to the workflow YAML file. Used for checkpoint metadata when saving state on failure. @@ -420,6 +425,13 @@ def __init__( When provided, the engine emits events at each execution point (agent start/complete, routing, parallel groups, etc.). When None, zero overhead (early return in _emit()). + keyboard_listener: Optional keyboard listener to suspend/resume + around interactive prompts (human gates, max iterations). + When provided, the listener is suspended before stdin reads + and resumed afterward, preventing cbreak mode conflicts. + web_dashboard: Optional web dashboard for bidirectional gate input. + When provided and connected, gate input is accepted from + both CLI stdin and web UI, with first response winning. Note: If both provider and registry are provided, registry takes precedence. @@ -460,10 +472,14 @@ def __init__( # Interrupt support self._interrupt_event = interrupt_event self._interrupt_handler = InterruptHandler(skip_gates=skip_gates) + self._keyboard_listener = keyboard_listener # Event emitter for workflow observability self._event_emitter = event_emitter + # Web dashboard for bidirectional gate input + self._web_dashboard = web_dashboard + # Checkpoint tracking self._current_agent_name: str | None = None self._last_checkpoint_path: Path | None = None @@ -704,6 +720,106 @@ def _get_top_level_agent_names(self) -> list[str]: """ return [a.name for a in self.config.agents] + async def _suspend_listener(self) -> None: + """Suspend the keyboard listener before interactive stdin prompts.""" + if self._keyboard_listener is not None: + await self._keyboard_listener.suspend() + + async def _resume_listener(self) -> None: + """Resume the keyboard listener after interactive stdin prompts.""" + if self._keyboard_listener is not None: + await self._keyboard_listener.resume() + + async def _handle_gate_with_web( + self, + agent: AgentDef, + agent_context: dict[str, Any], + ) -> GateResult: + """Handle a human gate, racing CLI input against web dashboard input. + + When a web dashboard is connected, both the CLI prompt and the web + dashboard wait concurrently. The first response wins and the other + is cancelled. When no web dashboard is available, falls back to + CLI-only input. + + Args: + agent: The human_gate agent definition. + agent_context: Current workflow context for template rendering. + + Returns: + GateResult from whichever input source responded first. + """ + # If no web dashboard or no connections, use CLI only + if self._web_dashboard is None or not self._web_dashboard.has_connections(): + return await self.gate_handler.handle_gate(agent, agent_context) + + # Race CLI vs web input + cli_task = asyncio.create_task( + self.gate_handler.handle_gate(agent, agent_context), + name="gate_cli", + ) + web_task = asyncio.create_task( + self._wait_for_web_gate(agent), + name="gate_web", + ) + + done, pending = await asyncio.wait( + {cli_task, web_task}, + return_when=asyncio.FIRST_COMPLETED, + ) + + # Cancel the loser + for task in pending: + task.cancel() + with contextlib.suppress(asyncio.CancelledError): + await task + + # Get the result from the winner + winner = done.pop() + return winner.result() + + async def _wait_for_web_gate(self, agent: AgentDef) -> GateResult: + """Wait for a gate response from the web dashboard. + + Translates the raw JSON message from the web client into a + ``GateResult`` by matching ``selected_value`` against the + agent's options. + + Args: + agent: The human_gate agent definition with options. + + Returns: + GateResult with the selected option, route, and any + additional input from the web client. + + Raises: + HumanGateError: If the selected value doesn't match any option. + """ + from conductor.exceptions import HumanGateError + + assert self._web_dashboard is not None # noqa: S101 + + msg = await self._web_dashboard.wait_for_gate_response(agent.name) + selected_value = msg.get("selected_value", "") + + # Find matching option + for option in agent.options or []: + if option.value == selected_value: + additional_input = msg.get("additional_input", {}) + if not isinstance(additional_input, dict): + additional_input = {} + return GateResult( + selected_option=option, + route=option.route, + additional_input=additional_input, + ) + + raise HumanGateError( + f"Web gate response value '{selected_value}' does not match any option " + f"for gate '{agent.name}'", + suggestion="Check the option values in the workflow YAML", + ) + async def _check_interrupt(self, current_agent_name: str) -> InterruptResult | None: """Check for a pending interrupt and handle it if present. @@ -735,13 +851,18 @@ async def _check_interrupt(self, current_agent_name: str) -> InterruptResult | N except (TypeError, ValueError): last_output_preview = str(last_output)[:500] - return await self._interrupt_handler.handle_interrupt( - current_agent=current_agent_name, - iteration=self.context.current_iteration, - last_output_preview=last_output_preview, - available_agents=self._get_top_level_agent_names(), - accumulated_guidance=list(self.context.user_guidance), - ) + # Suspend keyboard listener so stdin works normally for the prompt + await self._suspend_listener() + try: + return await self._interrupt_handler.handle_interrupt( + current_agent=current_agent_name, + iteration=self.context.current_iteration, + last_output_preview=last_output_preview, + available_agents=self._get_top_level_agent_names(), + accumulated_guidance=list(self.context.user_guidance), + ) + finally: + await self._resume_listener() async def _handle_interrupt_result( self, @@ -1135,19 +1256,34 @@ async def _execute_loop(self, current_agent_name: str) -> dict[str, Any]: # Build context for the gate prompt agent_context = self.context.get_for_template() + # Emit gate_presented with full option details for web UI + gate_options_data = [ + { + "label": o.label, + "value": o.value, + "route": o.route, + "prompt_for": o.prompt_for, + } + for o in (agent.options or []) + ] + 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), }, ) # Use the gate handler for interaction - gate_result: GateResult = await self.gate_handler.handle_gate( - agent, agent_context - ) + # Suspend keyboard listener so stdin works normally + await self._suspend_listener() + try: + gate_result = await self._handle_gate_with_web(agent, agent_context) + finally: + await self._resume_listener() self._emit( "gate_resolved", @@ -1561,11 +1697,15 @@ async def _check_iteration_with_prompt(self, agent_name: str) -> None: self.limits.check_iteration(agent_name) except MaxIterationsError: # Prompt user for more iterations - result = await self.max_iterations_handler.handle_limit_reached( - current_iteration=self.limits.current_iteration, - max_iterations=self.limits.max_iterations, - agent_history=self.limits.execution_history, - ) + await self._suspend_listener() + try: + result = await self.max_iterations_handler.handle_limit_reached( + current_iteration=self.limits.current_iteration, + max_iterations=self.limits.max_iterations, + agent_history=self.limits.execution_history, + ) + finally: + await self._resume_listener() if result.continue_execution: self.limits.increase_limit(result.additional_iterations) # Re-check should now pass @@ -1592,11 +1732,15 @@ async def _check_parallel_group_iteration_with_prompt( self.limits.check_parallel_group_iteration(group_name, agent_count) except MaxIterationsError: # Prompt user for more iterations - result = await self.max_iterations_handler.handle_limit_reached( - current_iteration=self.limits.current_iteration, - max_iterations=self.limits.max_iterations, - agent_history=self.limits.execution_history, - ) + await self._suspend_listener() + try: + result = await self.max_iterations_handler.handle_limit_reached( + current_iteration=self.limits.current_iteration, + max_iterations=self.limits.max_iterations, + agent_history=self.limits.execution_history, + ) + finally: + await self._resume_listener() if result.continue_execution: self.limits.increase_limit(result.additional_iterations) # Re-check should now pass @@ -2235,7 +2379,13 @@ async def execute_single_item(item: Any, index: int, key: str) -> tuple[str, Any # Execute agent with injected context (get executor for multi-provider) executor = await self._get_executor_for_agent(for_each_group.agent) - event_callback = self._make_event_callback(for_each_group.name) + + # Item-scoped event callback that tags all streaming events with item_key + def _item_callback(event_type: str, data: dict[str, Any]) -> None: + data_with_agent = {"agent_name": for_each_group.name, "item_key": key, **data} + self._emit(event_type, data_with_agent) + + event_callback = _item_callback if self._event_emitter else None output = await executor.execute( for_each_group.agent, agent_context, @@ -2264,6 +2414,7 @@ async def execute_single_item(item: Any, index: int, key: str) -> tuple[str, Any "elapsed": _item_elapsed, "tokens": output.tokens_used, "cost_usd": usage.cost_usd, + "output": output.content, }, ) diff --git a/src/conductor/interrupt/listener.py b/src/conductor/interrupt/listener.py index 5dd5e09..1d88df6 100644 --- a/src/conductor/interrupt/listener.py +++ b/src/conductor/interrupt/listener.py @@ -154,6 +154,72 @@ async def stop(self) -> None: self._restore_terminal() logger.debug("Keyboard listener stopped") + async def suspend(self) -> None: + """Temporarily suspend listening and restore normal terminal mode. + + Use this before any operation that needs normal stdin access + (e.g., human gates, max iterations prompts). Call ``resume()`` + afterward to re-enter cbreak mode and restart listening. + """ + self._stop_flag = True + + if self._task is not None: + self._task.cancel() + with contextlib.suppress(asyncio.CancelledError): + await self._task + self._task = None + + if self._reader_thread is not None: + self._reader_thread.join(timeout=0.5) + self._reader_thread = None + + # Restore terminal but keep _original_settings for resume() + if self._original_settings is not None: + try: + import termios + + termios.tcsetattr(sys.stdin.fileno(), termios.TCSADRAIN, self._original_settings) + except (ImportError, termios.error, ValueError, OSError): + pass + + logger.debug("Keyboard listener suspended") + + async def resume(self) -> None: + """Resume listening after a ``suspend()`` call. + + Re-enters cbreak mode and restarts the reader thread and listen loop. + No-op if the listener was never started or original settings are gone. + """ + if self._original_settings is None or self._loop is None: + return + + try: + import tty + except ImportError: + return + + # Re-enter cbreak mode + try: + tty.setcbreak(sys.stdin.fileno()) + except Exception: + logger.debug("Failed to re-enter cbreak mode on resume") + return + + self._stop_flag = False + + # Reset the queue to discard any stale bytes + self._byte_queue = asyncio.Queue() + + # Restart the reader thread + self._reader_thread = threading.Thread( + target=self._reader_thread_main, daemon=True, name="keyboard-listener" + ) + self._reader_thread.start() + + # Restart the listen loop + self._task = asyncio.create_task(self._listen_loop()) + logger.debug("Keyboard listener resumed") + def _restore_terminal(self) -> None: """Restore original terminal settings.""" if self._original_settings is not None: diff --git a/src/conductor/web/frontend/package-lock.json b/src/conductor/web/frontend/package-lock.json index d8e3dbd..718c061 100644 --- a/src/conductor/web/frontend/package-lock.json +++ b/src/conductor/web/frontend/package-lock.json @@ -14,6 +14,7 @@ "lucide-react": "^0.469.0", "react": "^19.0.0", "react-dom": "^19.0.0", + "react-markdown": "^10.1.0", "react-resizable-panels": "^2.1.7", "tailwind-merge": "^2.6.0", "zustand": "^5.0.3" @@ -1544,18 +1545,58 @@ "@types/d3-selection": "*" } }, + "node_modules/@types/debug": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", + "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "license": "MIT", + "dependencies": { + "@types/ms": "*" + } + }, "node_modules/@types/estree": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", - "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree-jsx": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz", + "integrity": "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==", + "license": "MIT", + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/mdast": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", "license": "MIT" }, "node_modules/@types/react": { "version": "19.2.14", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz", "integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==", - "devOptional": true, "license": "MIT", "peer": true, "dependencies": { @@ -1572,6 +1613,18 @@ "@types/react": "^19.2.0" } }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "license": "MIT" + }, + "node_modules/@ungap/structured-clone": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "license": "ISC" + }, "node_modules/@vitejs/plugin-react": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz", @@ -1653,6 +1706,16 @@ "d3-zoom": "^3.0.0" } }, + "node_modules/bail": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", + "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/baseline-browser-mapping": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.0.tgz", @@ -1722,6 +1785,56 @@ ], "license": "CC-BY-4.0" }, + "node_modules/ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", + "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-html4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-reference-invalid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", + "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/classcat": { "version": "5.0.5", "resolved": "https://registry.npmjs.org/classcat/-/classcat-5.0.5.tgz", @@ -1737,6 +1850,16 @@ "node": ">=6" } }, + "node_modules/comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", @@ -1748,7 +1871,6 @@ "version": "3.2.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", - "devOptional": true, "license": "MIT" }, "node_modules/d3-color": { @@ -1861,7 +1983,6 @@ "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "dev": true, "license": "MIT", "dependencies": { "ms": "^2.1.3" @@ -1875,6 +1996,28 @@ } } }, + "node_modules/decode-named-character-reference": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.3.0.tgz", + "integrity": "sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q==", + "license": "MIT", + "dependencies": { + "character-entities": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/detect-libc": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", @@ -1885,6 +2028,19 @@ "node": ">=8" } }, + "node_modules/devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "license": "MIT", + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/electron-to-chromium": { "version": "1.5.302", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.302.tgz", @@ -1958,6 +2114,22 @@ "node": ">=6" } }, + "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", + "integrity": "sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "license": "MIT" + }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", @@ -2008,6 +2180,118 @@ "dev": true, "license": "ISC" }, + "node_modules/hast-util-to-jsx-runtime": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.6.tgz", + "integrity": "sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "hast-util-whitespace": "^3.0.0", + "mdast-util-mdx-expression": "^2.0.0", + "mdast-util-mdx-jsx": "^3.0.0", + "mdast-util-mdxjs-esm": "^2.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0", + "style-to-js": "^1.0.0", + "unist-util-position": "^5.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-whitespace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/html-url-attributes": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/html-url-attributes/-/html-url-attributes-3.0.1.tgz", + "integrity": "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/inline-style-parser": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.7.tgz", + "integrity": "sha512-Nb2ctOyNR8DqQoR0OwRG95uNWIC0C1lCgf5Naz5H6Ji72KZ8OcFZLz2P5sNgwlyoJ8Yif11oMuYs5pBQa86csA==", + "license": "MIT" + }, + "node_modules/is-alphabetical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", + "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-alphanumerical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", + "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", + "license": "MIT", + "dependencies": { + "is-alphabetical": "^2.0.0", + "is-decimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-decimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", + "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-hexadecimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", + "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-plain-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/jiti": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.6.1.tgz", @@ -2312,6 +2596,16 @@ "url": "https://opencollective.com/parcel" } }, + "node_modules/longest-streak": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz", + "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", @@ -2341,123 +2635,779 @@ "@jridgewell/sourcemap-codec": "^1.5.5" } }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, - "node_modules/nanoid": { - "version": "3.3.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", - "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], + "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", + "integrity": "sha512-W4mAWTvSlKvf8L6J+VN9yLSqQ9AOAAvHuoDAmPkz4dHf553m5gVj2ejadHJhoJmcmxEnOv6Pa8XJhpxE93kb8Q==", "license": "MIT", - "bin": { - "nanoid": "bin/nanoid.cjs" + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark": "^4.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-stringify-position": "^4.0.0" }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "node_modules/node-releases": { - "version": "2.0.27", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", - "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==", - "dev": true, - "license": "MIT" - }, - "node_modules/picocolors": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "dev": true, - "license": "ISC" - }, - "node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", - "dev": true, + "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", + "integrity": "sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ==", "license": "MIT", - "peer": true, - "engines": { - "node": ">=12" + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" }, "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "node_modules/postcss": { - "version": "8.5.6", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", - "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], + "node_modules/mdast-util-mdx-jsx": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.2.0.tgz", + "integrity": "sha512-lj/z8v0r6ZtsN/cGNNtemmmfoLAFZnjMbNyLzBafjzikOM+glrjNHPlf6lQDOTccj9n5b0PPihEBbhneMyGs1Q==", "license": "MIT", "dependencies": { - "nanoid": "^3.3.11", - "picocolors": "^1.1.1", - "source-map-js": "^1.2.1" + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "ccount": "^2.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "parse-entities": "^4.0.0", + "stringify-entities": "^4.0.0", + "unist-util-stringify-position": "^4.0.0", + "vfile-message": "^4.0.0" }, - "engines": { - "node": "^10 || ^12 || >=14" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "node_modules/react": { - "version": "19.2.4", - "resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz", - "integrity": "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ==", + "node_modules/mdast-util-mdxjs-esm": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-2.0.1.tgz", + "integrity": "sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==", "license": "MIT", - "engines": { - "node": ">=0.10.0" + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@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/react-dom": { - "version": "19.2.4", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.4.tgz", - "integrity": "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ==", + "node_modules/mdast-util-phrasing": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz", + "integrity": "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==", "license": "MIT", - "peer": true, "dependencies": { - "scheduler": "^0.27.0" + "@types/mdast": "^4.0.0", + "unist-util-is": "^6.0.0" }, - "peerDependencies": { - "react": "^19.2.4" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "node_modules/react-refresh": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz", - "integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==", - "dev": true, + "node_modules/mdast-util-to-hast": { + "version": "13.2.1", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz", + "integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==", "license": "MIT", - "engines": { - "node": ">=0.10.0" + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@ungap/structured-clone": "^1.0.0", + "devlop": "^1.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "trim-lines": "^3.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "node_modules/react-resizable-panels": { - "version": "2.1.9", + "node_modules/mdast-util-to-markdown": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.2.tgz", + "integrity": "sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "longest-streak": "^3.0.0", + "mdast-util-phrasing": "^4.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "unist-util-visit": "^5.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz", + "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.2.tgz", + "integrity": "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "@types/debug": "^4.0.0", + "debug": "^4.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-core-commonmark": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.3.tgz", + "integrity": "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-destination": "^2.0.0", + "micromark-factory-label": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-factory-title": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-destination": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz", + "integrity": "sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-label": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.1.tgz", + "integrity": "sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-space": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.1.tgz", + "integrity": "sha512-zRkxjtBxxLd2Sc0d+fbnEunsTj46SWXgXciZmHq0kDYGnck/ZSGj9/wULTV95uoeYiK5hRXP2mJ98Uo4cq/LQg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-title": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.1.tgz", + "integrity": "sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-whitespace": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.1.tgz", + "integrity": "sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-character": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-chunked": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.1.tgz", + "integrity": "sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-classify-character": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.1.tgz", + "integrity": "sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-combine-extensions": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.1.tgz", + "integrity": "sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-chunked": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-numeric-character-reference": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.2.tgz", + "integrity": "sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-string": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.1.tgz", + "integrity": "sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-encode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", + "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-html-tag-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.1.tgz", + "integrity": "sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-normalize-identifier": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.1.tgz", + "integrity": "sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-resolve-all": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.1.tgz", + "integrity": "sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", + "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-subtokenize": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.1.0.tgz", + "integrity": "sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-symbol": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz", + "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/node-releases": { + "version": "2.0.27", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", + "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/parse-entities": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.2.tgz", + "integrity": "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^2.0.0", + "character-entities-legacy": "^3.0.0", + "character-reference-invalid": "^2.0.0", + "decode-named-character-reference": "^1.0.0", + "is-alphanumerical": "^2.0.0", + "is-decimal": "^2.0.0", + "is-hexadecimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/parse-entities/node_modules/@types/unist": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/property-information": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz", + "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/react": { + "version": "19.2.4", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz", + "integrity": "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.2.4", + "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" + }, + "peerDependencies": { + "react": "^19.2.4" + } + }, + "node_modules/react-markdown": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-10.1.0.tgz", + "integrity": "sha512-qKxVopLT/TyA6BX3Ue5NwabOsAzm0Q7kAPwq6L+wWDwisYs7R8vZ0nRXqq6rkueboxpkjvLGU9fWifiX/ZZFxQ==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "hast-util-to-jsx-runtime": "^2.0.0", + "html-url-attributes": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "remark-parse": "^11.0.0", + "remark-rehype": "^11.0.0", + "unified": "^11.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "peerDependencies": { + "@types/react": ">=18", + "react": ">=18" + } + }, + "node_modules/react-refresh": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz", + "integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-resizable-panels": { + "version": "2.1.9", "resolved": "https://registry.npmjs.org/react-resizable-panels/-/react-resizable-panels-2.1.9.tgz", "integrity": "sha512-z77+X08YDIrgAes4jl8xhnUu1LNIRp4+E7cv4xHmLOxxUPO/ML7PSrE813b90vj7xvQ1lcf7g2uA9GeMZonjhQ==", "license": "MIT", @@ -2466,6 +3416,39 @@ "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" } }, + "node_modules/remark-parse": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz", + "integrity": "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-rehype": { + "version": "11.1.2", + "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-11.1.2.tgz", + "integrity": "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "mdast-util-to-hast": "^13.0.0", + "unified": "^11.0.0", + "vfile": "^6.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", @@ -2537,6 +3520,48 @@ "node": ">=0.10.0" } }, + "node_modules/space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/stringify-entities": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "license": "MIT", + "dependencies": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/style-to-js": { + "version": "1.1.21", + "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.21.tgz", + "integrity": "sha512-RjQetxJrrUJLQPHbLku6U/ocGtzyjbJMP9lCNK7Ag0CNh690nSH8woqWH9u16nMjYBAok+i7JO1NP2pOy8IsPQ==", + "license": "MIT", + "dependencies": { + "style-to-object": "1.0.14" + } + }, + "node_modules/style-to-object": { + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.14.tgz", + "integrity": "sha512-LIN7rULI0jBscWQYaSswptyderlarFkjQ+t79nzty8tcIAceVomEVlLzH5VP4Cmsv6MtKhs7qaAiwlcp+Mgaxw==", + "license": "MIT", + "dependencies": { + "inline-style-parser": "0.2.7" + } + }, "node_modules/tailwind-merge": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-2.6.1.tgz", @@ -2585,6 +3610,26 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, + "node_modules/trim-lines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/trough": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz", + "integrity": "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/typescript": { "version": "5.9.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", @@ -2599,6 +3644,93 @@ "node": ">=14.17" } }, + "node_modules/unified": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", + "integrity": "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "bail": "^2.0.0", + "devlop": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-is": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.1.tgz", + "integrity": "sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.1.0.tgz", + "integrity": "sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.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/unist-util-visit-parents": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.2.tgz", + "integrity": "sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/update-browserslist-db": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", @@ -2639,6 +3771,34 @@ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, + "node_modules/vfile": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.3.tgz", + "integrity": "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/vite": { "version": "6.4.1", "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.1.tgz", @@ -2750,6 +3910,16 @@ "optional": true } } + }, + "node_modules/zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } } } } diff --git a/src/conductor/web/frontend/package.json b/src/conductor/web/frontend/package.json index 6a9897a..f13d15d 100644 --- a/src/conductor/web/frontend/package.json +++ b/src/conductor/web/frontend/package.json @@ -15,6 +15,7 @@ "lucide-react": "^0.469.0", "react": "^19.0.0", "react-dom": "^19.0.0", + "react-markdown": "^10.1.0", "react-resizable-panels": "^2.1.7", "tailwind-merge": "^2.6.0", "zustand": "^5.0.3" diff --git a/src/conductor/web/frontend/src/components/detail/ActivityStream.tsx b/src/conductor/web/frontend/src/components/detail/ActivityStream.tsx index 01a5c6d..47bb084 100644 --- a/src/conductor/web/frontend/src/components/detail/ActivityStream.tsx +++ b/src/conductor/web/frontend/src/components/detail/ActivityStream.tsx @@ -5,10 +5,11 @@ import { cn } from '@/lib/utils'; interface ActivityStreamProps { activity: ActivityEntry[]; + defaultExpanded?: boolean; } -export function ActivityStream({ activity }: ActivityStreamProps) { - const [expanded, setExpanded] = useState(true); +export function ActivityStream({ activity, defaultExpanded = true }: ActivityStreamProps) { + const [expanded, setExpanded] = useState(defaultExpanded); const scrollRef = useRef(null); // Auto-scroll on new entries diff --git a/src/conductor/web/frontend/src/components/detail/AgentDetail.tsx b/src/conductor/web/frontend/src/components/detail/AgentDetail.tsx index b2a411a..36af37d 100644 --- a/src/conductor/web/frontend/src/components/detail/AgentDetail.tsx +++ b/src/conductor/web/frontend/src/components/detail/AgentDetail.tsx @@ -1,7 +1,9 @@ +import { useState } from 'react'; +import { ChevronDown, ChevronRight } from 'lucide-react'; import { MetadataGrid, buildAgentMetadata } from './MetadataGrid'; import { OutputViewer } from './OutputViewer'; import { ActivityStream } from './ActivityStream'; -import type { NodeData } from '@/stores/workflow-store'; +import type { NodeData, IterationSnapshot } from '@/stores/workflow-store'; import { NODE_STATUS_HEX } from '@/lib/constants'; import type { NodeStatus } from '@/lib/constants'; @@ -13,6 +15,7 @@ interface AgentDetailProps { export function AgentDetail({ node }: AgentDetailProps) { const status = node.status as NodeStatus; const statusColor = NODE_STATUS_HEX[status] || NODE_STATUS_HEX.pending; + const hasHistory = node.iterationHistory && node.iterationHistory.length > 0; return (
@@ -30,21 +33,127 @@ export function AgentDetail({ node }: AgentDetailProps) { Agent
- {/* Metadata */} - + {/* Current iteration */} + {hasHistory ? ( + + ) : ( + <> + {/* Metadata */} + + + {/* Prompt */} + {node.prompt && ( + + )} - {/* Prompt */} - {node.prompt && ( - + {/* Activity stream */} + + + {/* Output */} + {node.output != null && ( + + )} + )} - {/* Activity stream */} - + {/* Previous iterations (most recent first) */} + {hasHistory && + [...node.iterationHistory!].reverse().map((snap) => ( + + ))} + + ); +} + +interface IterationSectionProps { + label: string; + defaultExpanded: boolean; + snapshot: IterationSnapshot; + status: NodeStatus; +} + +function IterationSection({ label, defaultExpanded, snapshot, status }: IterationSectionProps) { + const [expanded, setExpanded] = useState(defaultExpanded); + + return ( +
+ + {expanded && ( +
+ {/* Metadata */} + + + {/* Prompt */} + {snapshot.prompt && ( + + )} - {/* Output */} - {node.output != null && ( - + {/* Activity stream */} + + + {/* Output */} + {snapshot.output != null && ( + + )} + + {/* Error info */} + {snapshot.error_type && ( +
+ {snapshot.error_type} + {snapshot.error_message && ( + — {snapshot.error_message} + )} +
+ )} +
)}
); } + +function formatSecCompact(s: number): string { + if (s < 1) return `${(s * 1000).toFixed(0)}ms`; + if (s < 60) return `${s.toFixed(1)}s`; + const m = Math.floor(s / 60); + const sec = (s % 60).toFixed(0); + return `${m}m ${sec}s`; +} diff --git a/src/conductor/web/frontend/src/components/detail/GateDetail.tsx b/src/conductor/web/frontend/src/components/detail/GateDetail.tsx index 70ff93f..7544a09 100644 --- a/src/conductor/web/frontend/src/components/detail/GateDetail.tsx +++ b/src/conductor/web/frontend/src/components/detail/GateDetail.tsx @@ -1,69 +1,417 @@ +import { useState, useEffect } from 'react'; +import ReactMarkdown from 'react-markdown'; +import { Check, Loader2, Send } from 'lucide-react'; import { MetadataGrid } from './MetadataGrid'; import type { NodeData } from '@/stores/workflow-store'; -import { NODE_STATUS_HEX } from '@/lib/constants'; -import type { NodeStatus } from '@/lib/constants'; +import { useWorkflowStore } from '@/stores/workflow-store'; interface GateDetailProps { node: NodeData; } export function GateDetail({ node }: GateDetailProps) { - const status = node.status as NodeStatus; - const statusColor = NODE_STATUS_HEX[status] || NODE_STATUS_HEX.pending; + const sendGateResponse = useWorkflowStore((s) => s.sendGateResponse); + const wsStatus = useWorkflowStore((s) => s.wsStatus); - const items: Array<{ label: string; value: string | number | null | undefined }> = []; - if (node.selected_option) items.push({ label: 'Selected', value: node.selected_option }); - if (node.route) items.push({ label: 'Route', value: node.route }); - if (node.additional_input) { - const inputStr = typeof node.additional_input === 'object' - ? JSON.stringify(node.additional_input) - : node.additional_input; - items.push({ label: 'Input', value: inputStr }); - } + const [selectedValue, setSelectedValue] = useState(null); + const [promptForValue, setPromptForValue] = useState(''); + const [pendingPromptFor, setPendingPromptFor] = useState(null); + const [isSending, setIsSending] = useState(false); + + const isWaiting = node.status === 'waiting'; + const isCompleted = node.status === 'completed'; + + // Reset local state when the gate transitions back to 'waiting' (re-entry in a loop) + useEffect(() => { + if (isWaiting) { + setSelectedValue(null); + setPromptForValue(''); + setPendingPromptFor(null); + setIsSending(false); + } + }, [isWaiting]); + + const canInteract = isWaiting && wsStatus === 'connected' && selectedValue === null; + + const handleOptionClick = (value: string, promptFor?: string | null) => { + if (!canInteract) return; + + if (promptFor) { + // Show text input before sending + setSelectedValue(value); + setPendingPromptFor(promptFor); + return; + } + + // Send immediately + setSelectedValue(value); + setIsSending(true); + sendGateResponse(node.name, value); + }; + + const handlePromptForSubmit = () => { + if (selectedValue === null || pendingPromptFor === null) return; + const additionalInput: Record = { [pendingPromptFor]: promptForValue }; + setIsSending(true); + sendGateResponse(node.name, selectedValue, additionalInput); + setPendingPromptFor(null); + }; + + // Use option_details for interactive buttons if available + const optionDetails = node.option_details; + + // Find the selected option's label for completed state + const selectedOptDetail = optionDetails?.find((o) => o.value === node.selected_option); + const selectedLabel = selectedOptDetail?.label || node.selected_option; return ( -
-
- - {status} - - Human Gate -
- - {node.prompt && ( -
-

Prompt

-

{node.prompt}

-
+
+ {/* --- WAITING STATE --- */} + {isWaiting && ( + <> + {/* Amber "Decision Required" banner */} +
+ + + + + + Decision Required + +
+ + {/* Prompt callout */} + {node.prompt && ( +
+ +
+ )} + + {/* Interactive option buttons */} + {optionDetails && optionDetails.length > 0 && ( +
+
+ {optionDetails.map((opt) => { + const isSelected = selectedValue === opt.value; + const isDimmed = selectedValue !== null && !isSelected; + + return ( + + ); + })} +
+ + {/* Sending indicator */} + {isSending && !pendingPromptFor && ( +
+ + Sending... +
+ )} + + {/* Helper text when no selection yet */} + {canInteract && ( +

+ Select an option to continue the workflow +

+ )} +
+ )} + + {/* Fallback: display-only options when no option_details */} + {!optionDetails && node.options && node.options.length > 0 && ( +
+

+ Options +

+
+ {node.options.map((opt) => ( + + {opt} + + ))} +
+
+ )} + + {/* prompt_for text input card */} + {pendingPromptFor && ( +
+
+

+ {pendingPromptFor} +

+
+
+ setPromptForValue(e.target.value)} + onKeyDown={(e) => e.key === 'Enter' && handlePromptForSubmit()} + placeholder={`Enter ${pendingPromptFor}...`} + 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 + /> +
+ + Press Enter or click Submit + + +
+
+
+ )} + + )} + + {/* --- COMPLETED STATE --- */} + {isCompleted && ( + <> + {/* Green "Completed" banner */} +
+ + + Decision Completed + +
+ + {/* Prompt (dimmed, for context) */} + {node.prompt && ( +
+ +
+ )} + + {/* Selected option card */} + {selectedLabel && ( +
+
+ +
+ {selectedLabel} + {node.route && ( + + → {node.route} + + )} +
+ )} + + {/* Unselected options (dimmed, for context) */} + {optionDetails && optionDetails.length > 1 && ( +
+ {optionDetails + .filter((o) => o.value !== node.selected_option) + .map((opt) => ( +
+
+ {opt.label} + {opt.route && ( + + → {opt.route} + + )} +
+ ))} +
+ )} + + {/* Display-only options fallback (no option_details) */} + {!optionDetails && node.options && node.options.length > 0 && ( +
+ {node.options.map((opt) => ( + + {opt === node.selected_option && '✓ '} + {opt} + + ))} +
+ )} + + {/* Metadata (route, additional input) */} + + )} - {node.options && node.options.length > 0 && ( -
-

Options

-
- {node.options.map((opt) => ( - - {opt} - - ))} + {/* --- OTHER STATES (pending, failed, etc.) --- */} + {!isWaiting && !isCompleted && ( + <> +
+ Human Gate + ({node.status})
-
+ + {node.prompt && ( +
+ +
+ )} + )} +
+ ); +} - +/** Renders prompt text as markdown with dashboard-consistent styling. */ +function PromptMarkdown({ text, muted }: { text: string; muted: boolean }) { + const textColor = muted ? 'text-[var(--text-muted)]' : 'text-[var(--text)]'; + + return ( +
+ ( +

{children}

+ ), + h2: ({ children }) => ( +

{children}

+ ), + h3: ({ children }) => ( +

{children}

+ ), + // Paragraphs + p: ({ children }) =>

{children}

, + // Lists + ul: ({ children }) => ( +
    {children}
+ ), + ol: ({ children }) => ( +
    {children}
+ ), + li: ({ children }) =>
  • {children}
  • , + // Inline code + code: ({ children, className }) => { + const isBlock = className?.includes('language-'); + if (isBlock) { + return ( + + {children} + + ); + } + return ( + + {children} + + ); + }, + // Code blocks + pre: ({ children }) => ( +
    +              {children}
    +            
    + ), + // Bold / italic + strong: ({ children }) => ( + {children} + ), + em: ({ children }) => {children}, + // Links + a: ({ href, children }) => ( + + {children} + + ), + // Blockquote + blockquote: ({ children }) => ( +
    + {children} +
    + ), + // Horizontal rule + hr: () =>
    , + }} + > + {text} +
    ); } + +function CompletedMetadata({ node }: { node: NodeData }) { + const items: Array<{ label: string; value: string | number | null | undefined }> = []; + + if (node.route) items.push({ label: 'Route', value: `→ ${node.route}` }); + if (node.additional_input) { + const inputStr = + typeof node.additional_input === 'object' + ? JSON.stringify(node.additional_input) + : node.additional_input; + items.push({ label: 'Additional Input', value: inputStr }); + } + + if (items.length === 0) return null; + + return ; +} diff --git a/src/conductor/web/frontend/src/components/detail/GroupDetail.tsx b/src/conductor/web/frontend/src/components/detail/GroupDetail.tsx index fac562a..241543e 100644 --- a/src/conductor/web/frontend/src/components/detail/GroupDetail.tsx +++ b/src/conductor/web/frontend/src/components/detail/GroupDetail.tsx @@ -1,7 +1,11 @@ +import { useState } from 'react'; +import { ChevronDown, ChevronRight, Loader2 } from 'lucide-react'; import { MetadataGrid } from './MetadataGrid'; -import type { NodeData } from '@/stores/workflow-store'; +import { OutputViewer } from './OutputViewer'; +import { ActivityStream } from './ActivityStream'; +import type { NodeData, ForEachItemData } from '@/stores/workflow-store'; import { NODE_STATUS_HEX } from '@/lib/constants'; -import { formatElapsed } from '@/lib/utils'; +import { formatElapsed, formatCost, formatTokens } from '@/lib/utils'; import { useWorkflowStore } from '@/stores/workflow-store'; import type { NodeStatus } from '@/lib/constants'; @@ -16,6 +20,8 @@ export function GroupDetail({ node }: GroupDetailProps) { const progress = groupProgress[node.name]; const isForEach = node.type === 'for_each_group'; + const [showItems, setShowItems] = useState(true); + const items: Array<{ label: string; value: string | number | null | undefined }> = []; if (node.elapsed != null) items.push({ label: 'Elapsed', value: formatElapsed(node.elapsed) }); if (progress) { @@ -26,6 +32,8 @@ export function GroupDetail({ node }: GroupDetailProps) { if (node.success_count != null) items.push({ label: 'Success', value: node.success_count }); if (node.failure_count != null) items.push({ label: 'Failures', value: node.failure_count }); + const forEachItems = node.for_each_items; + return (
    @@ -65,6 +73,146 @@ export function GroupDetail({ node }: GroupDetailProps) { )} + + {/* Per-item details for for-each groups */} + {isForEach && forEachItems && forEachItems.length > 0 && ( +
    + + + {showItems && ( +
    + {forEachItems.map((item) => ( + + ))} +
    + )} +
    + )} +
    + ); +} + +const ITEM_STATUS_COLORS: Record = { + running: NODE_STATUS_HEX.running, + completed: NODE_STATUS_HEX.completed, + failed: NODE_STATUS_HEX.failed, +}; + +function ForEachItemRow({ item }: { item: ForEachItemData }) { + const [expanded, setExpanded] = useState(item.status === 'running'); + const color = ITEM_STATUS_COLORS[item.status]; + + const hasDetails = !!( + item.prompt || + item.output != null || + (item.activity && item.activity.length > 0) || + item.error_type + ); + + const metadataItems: Array<{ label: string; value: string | number | null | undefined }> = []; + if (item.elapsed != null) metadataItems.push({ label: 'Elapsed', value: formatElapsed(item.elapsed) }); + if (item.tokens != null) metadataItems.push({ label: 'Tokens', value: formatTokens(item.tokens) }); + if (item.cost_usd != null) metadataItems.push({ label: 'Cost', value: formatCost(item.cost_usd) }); + + return ( +
    + {/* Header row: clickable to expand/collapse */} + + + {/* Expanded detail panel */} + {expanded && hasDetails && ( +
    + {/* Metadata grid */} + {metadataItems.length > 0 && ( + + )} + + {/* Prompt / Input */} + {item.prompt && ( + + )} + + {/* Activity stream */} + {item.activity && item.activity.length > 0 && ( + + )} + + {/* Output */} + {item.output != null && ( + + )} + + {/* Error info */} + {item.status === 'failed' && (item.error_type || item.error_message) && ( +
    + {item.error_type && ( + {item.error_type} + )} + {item.error_message && ( + — {item.error_message} + )} +
    + )} +
    + )}
    ); } diff --git a/src/conductor/web/frontend/src/components/graph/AgentNode.tsx b/src/conductor/web/frontend/src/components/graph/AgentNode.tsx index fc61a9e..5d9d3f7 100644 --- a/src/conductor/web/frontend/src/components/graph/AgentNode.tsx +++ b/src/conductor/web/frontend/src/components/graph/AgentNode.tsx @@ -9,22 +9,27 @@ import type { NodeStatus } from '@/lib/constants'; export const AgentNode = memo(function AgentNode({ data, id, selected }: NodeProps) { const nodeData = data as unknown as GraphNodeData; - const status = (nodeData.status || 'pending') as NodeStatus; + // Read status directly from the store so parallel-group child nodes update + // immediately instead of waiting for the graph-data sync useEffect. + const storeStatus = useWorkflowStore((s) => s.nodes[id]?.status); + const status = (storeStatus || nodeData.status || 'pending') as NodeStatus; const borderColor = NODE_STATUS_HEX[status] || NODE_STATUS_HEX.pending; const elapsed = useWorkflowStore((s) => s.nodes[id]?.elapsed); const model = useWorkflowStore((s) => s.nodes[id]?.model); const tokens = useWorkflowStore((s) => s.nodes[id]?.tokens); const costUsd = useWorkflowStore((s) => s.nodes[id]?.cost_usd); + const iteration = useWorkflowStore((s) => s.nodes[id]?.iteration); const tooltip = useMemo(() => { const parts: string[] = [`Status: ${status}`]; + if (iteration != null && iteration > 1) parts.push(`Iteration: ${iteration}`); if (elapsed != null) parts.push(`Elapsed: ${formatSec(elapsed)}`); if (model) parts.push(`Model: ${model}`); if (tokens != null) parts.push(`Tokens: ${tokens.toLocaleString()}`); if (costUsd != null) parts.push(`Cost: $${costUsd.toFixed(4)}`); return parts.join('\n'); - }, [status, elapsed, model, tokens, costUsd]); + }, [status, elapsed, model, tokens, costUsd, iteration]); return ( <> @@ -48,6 +53,17 @@ export const AgentNode = memo(function AgentNode({ data, id, selected }: NodePro
    {nodeData.label} + {iteration != null && iteration > 1 && ( + + ×{iteration} + + )}
    diff --git a/src/conductor/web/frontend/src/components/graph/EndNode.tsx b/src/conductor/web/frontend/src/components/graph/EndNode.tsx index 67efbd9..61ed167 100644 --- a/src/conductor/web/frontend/src/components/graph/EndNode.tsx +++ b/src/conductor/web/frontend/src/components/graph/EndNode.tsx @@ -1,6 +1,6 @@ import { memo } from 'react'; import { Handle, Position, type NodeProps } from '@xyflow/react'; -import { CircleStop } from 'lucide-react'; +import { Check, Square } from 'lucide-react'; import { cn } from '@/lib/utils'; import { NODE_STATUS_HEX } from '@/lib/constants'; import type { GraphNodeData } from './graph-layout'; @@ -9,20 +9,37 @@ import type { NodeStatus } from '@/lib/constants'; export const EndNode = memo(function EndNode({ data, selected }: NodeProps) { const nodeData = data as unknown as GraphNodeData; const status = (nodeData.status || 'pending') as NodeStatus; - const borderColor = NODE_STATUS_HEX[status] || NODE_STATUS_HEX.pending; + const isCompleted = status === 'completed'; + const isFailed = status === 'failed'; + const isPending = !isCompleted && !isFailed; + const borderColor = isCompleted + ? NODE_STATUS_HEX.completed + : isFailed + ? NODE_STATUS_HEX.failed + : NODE_STATUS_HEX.pending; return ( <>
    - + {isCompleted ? ( + + ) : isFailed ? ( + + ) : ( + + )}
    ); diff --git a/src/conductor/web/frontend/src/components/graph/GateNode.tsx b/src/conductor/web/frontend/src/components/graph/GateNode.tsx index 0a000e7..6926577 100644 --- a/src/conductor/web/frontend/src/components/graph/GateNode.tsx +++ b/src/conductor/web/frontend/src/components/graph/GateNode.tsx @@ -9,7 +9,9 @@ import type { NodeStatus } from '@/lib/constants'; export const GateNode = memo(function GateNode({ data, id, selected }: NodeProps) { const nodeData = data as unknown as GraphNodeData; - const status = (nodeData.status || 'pending') as NodeStatus; + // Read status directly from the store for immediate updates + const storeStatus = useWorkflowStore((s) => s.nodes[id]?.status); + const status = (storeStatus || nodeData.status || 'pending') as NodeStatus; const borderColor = NODE_STATUS_HEX[status] || NODE_STATUS_HEX.pending; const selectedOption = useWorkflowStore((s) => s.nodes[id]?.selected_option); diff --git a/src/conductor/web/frontend/src/components/graph/ScriptNode.tsx b/src/conductor/web/frontend/src/components/graph/ScriptNode.tsx index ddbf4ab..6ae9c1f 100644 --- a/src/conductor/web/frontend/src/components/graph/ScriptNode.tsx +++ b/src/conductor/web/frontend/src/components/graph/ScriptNode.tsx @@ -9,7 +9,9 @@ import type { NodeStatus } from '@/lib/constants'; export const ScriptNode = memo(function ScriptNode({ data, id, selected }: NodeProps) { const nodeData = data as unknown as GraphNodeData; - const status = (nodeData.status || 'pending') as NodeStatus; + // Read status directly from the store for immediate updates + const storeStatus = useWorkflowStore((s) => s.nodes[id]?.status); + const status = (storeStatus || nodeData.status || 'pending') as NodeStatus; const borderColor = NODE_STATUS_HEX[status] || NODE_STATUS_HEX.pending; const elapsed = useWorkflowStore((s) => s.nodes[id]?.elapsed); diff --git a/src/conductor/web/frontend/src/components/graph/StartNode.tsx b/src/conductor/web/frontend/src/components/graph/StartNode.tsx new file mode 100644 index 0000000..12977c3 --- /dev/null +++ b/src/conductor/web/frontend/src/components/graph/StartNode.tsx @@ -0,0 +1,31 @@ +import { memo } from 'react'; +import { Handle, Position, type NodeProps } from '@xyflow/react'; +import { Play } from 'lucide-react'; +import { cn } from '@/lib/utils'; +import { NODE_STATUS_HEX } from '@/lib/constants'; +import type { GraphNodeData } from './graph-layout'; +import type { NodeStatus } from '@/lib/constants'; + +export const StartNode = memo(function StartNode({ data, selected }: NodeProps) { + const nodeData = data as unknown as GraphNodeData; + const status = (nodeData.status || 'pending') as NodeStatus; + const borderColor = NODE_STATUS_HEX[status] || NODE_STATUS_HEX.pending; + const isActive = status === 'running' || status === 'completed'; + + return ( + <> +
    + +
    + + + ); +}); diff --git a/src/conductor/web/frontend/src/components/graph/WorkflowGraph.tsx b/src/conductor/web/frontend/src/components/graph/WorkflowGraph.tsx index e8ae1c8..d935ded 100644 --- a/src/conductor/web/frontend/src/components/graph/WorkflowGraph.tsx +++ b/src/conductor/web/frontend/src/components/graph/WorkflowGraph.tsx @@ -22,6 +22,7 @@ import { ScriptNode } from './ScriptNode'; import { GateNode } from './GateNode'; import { GroupNode } from './GroupNode'; import { EndNode } from './EndNode'; +import { StartNode } from './StartNode'; import { AnimatedEdge } from './AnimatedEdge'; import { NODE_STATUS_HEX } from '@/lib/constants'; import type { NodeStatus } from '@/lib/constants'; @@ -33,6 +34,7 @@ const nodeTypes: NodeTypes = { gateNode: GateNode, groupNode: GroupNode, endNode: EndNode, + startNode: StartNode, }; const edgeTypes: EdgeTypes = { @@ -72,6 +74,7 @@ export function WorkflowGraph() { const selectNode = useWorkflowStore((s) => s.selectNode); const selectedNode = useWorkflowStore((s) => s.selectedNode); const workflowStatus = useWorkflowStore((s) => s.workflowStatus); + const entryPoint = useWorkflowStore((s) => s.entryPoint); const [flowNodes, setFlowNodes, onNodesChange] = useNodesState>([]); const [flowEdges, setFlowEdges, onEdgesChange] = useEdgesState([]); @@ -85,11 +88,11 @@ export function WorkflowGraph() { graphBuilt.current = true; const { nodes, edges } = buildGraphElements( - agents, routes, parallelGroups, forEachGroups, storeNodes, groupProgress + agents, routes, parallelGroups, forEachGroups, storeNodes, groupProgress, entryPoint ); setFlowNodes(nodes); setFlowEdges(edges); - }, [agents, routes, parallelGroups, forEachGroups, storeNodes, groupProgress, setFlowNodes, setFlowEdges]); + }, [agents, routes, parallelGroups, forEachGroups, storeNodes, groupProgress, entryPoint, setFlowNodes, setFlowEdges]); // Update node data when store nodes change (status, progress, etc.) useEffect(() => { @@ -134,8 +137,12 @@ export function WorkflowGraph() { // Handle node selection const onNodeClick = useCallback( (_: React.MouseEvent, node: Node) => { - // Don't select group parent nodes - if (node.type === 'groupNode') return; + // Don't select parallel group parent nodes (they contain clickable child nodes). + // For-each groups are standalone nodes and should be selectable. + if (node.type === 'groupNode') { + const nodeData = node.data as GraphNodeData; + if (nodeData.type !== 'for_each_group') return; + } selectNode(node.id); }, [selectNode], diff --git a/src/conductor/web/frontend/src/components/graph/graph-layout.ts b/src/conductor/web/frontend/src/components/graph/graph-layout.ts index bbb8325..be04821 100644 --- a/src/conductor/web/frontend/src/components/graph/graph-layout.ts +++ b/src/conductor/web/frontend/src/components/graph/graph-layout.ts @@ -26,6 +26,7 @@ export function buildGraphElements( forEachGroups: ForEachGroup[], nodes: Record, groupProgress: Record, + entryPoint: string | null, ): { nodes: Node[]; edges: Edge[] } { const flowNodes: Node[] = []; const flowEdges: Edge[] = []; @@ -150,6 +151,31 @@ export function buildGraphElements( }); } + // Always add $start node if we have an entry point + if (entryPoint) { + const nd = nodes['$start']; + flowNodes.push({ + id: '$start', + type: 'startNode', + position: { x: 0, y: 0 }, + data: { + label: '$start', + type: 'start', + status: nd?.status || 'pending', + }, + }); + + // Add edge from $start to entry point + flowEdges.push({ + id: '$start->$entryPoint', + source: '$start', + target: entryPoint, + type: 'animatedEdge', + data: {}, + animated: false, + }); + } + // Create edges for (const r of routes) { flowEdges.push({ diff --git a/src/conductor/web/frontend/src/hooks/use-websocket.ts b/src/conductor/web/frontend/src/hooks/use-websocket.ts index 0414ccc..ccbd7dc 100644 --- a/src/conductor/web/frontend/src/hooks/use-websocket.ts +++ b/src/conductor/web/frontend/src/hooks/use-websocket.ts @@ -8,6 +8,7 @@ export function useWebSocket() { const processEvent = useWorkflowStore((s) => s.processEvent); const replayState = useWorkflowStore((s) => s.replayState); const setWsStatus = useWorkflowStore((s) => s.setWsStatus); + const setWsSend = useWorkflowStore((s) => s.setWsSend); const wsRef = useRef(null); const reconnectDelayRef = useRef(1000); @@ -24,6 +25,12 @@ export function useWebSocket() { ws.onopen = () => { reconnectDelayRef.current = 1000; setWsStatus('connected'); + // Expose send function to the store + setWsSend((data: object) => { + if (ws.readyState === WebSocket.OPEN) { + ws.send(JSON.stringify(data)); + } + }); }; ws.onmessage = (evt) => { @@ -37,6 +44,7 @@ export function useWebSocket() { ws.onclose = () => { setWsStatus('disconnected'); + setWsSend(null); wsRef.current = null; scheduleReconnect(); }; @@ -47,7 +55,7 @@ export function useWebSocket() { } catch { scheduleReconnect(); } - }, [processEvent, setWsStatus]); + }, [processEvent, setWsStatus, setWsSend]); const scheduleReconnect = useCallback(() => { setWsStatus('reconnecting'); @@ -84,6 +92,7 @@ export function useWebSocket() { if (wsRef.current) { wsRef.current.close(); } + setWsSend(null); }; - }, [connect, replayState, setWsStatus]); + }, [connect, replayState, setWsStatus, setWsSend]); } diff --git a/src/conductor/web/frontend/src/stores/workflow-store.ts b/src/conductor/web/frontend/src/stores/workflow-store.ts index b80cc72..6e3989a 100644 --- a/src/conductor/web/frontend/src/stores/workflow-store.ts +++ b/src/conductor/web/frontend/src/stores/workflow-store.ts @@ -16,12 +16,14 @@ import type { ScriptFailedData, GatePresentedData, GateResolvedData, + GateOptionDetail, RouteTakenData, ParallelStartedData, ParallelAgentCompletedData, ParallelAgentFailedData, ParallelCompletedData, ForEachStartedData, + ForEachItemStartedData, ForEachItemCompletedData, ForEachItemFailedData, ForEachCompletedData, @@ -35,6 +37,35 @@ export interface ActivityEntry { detail?: string | null; } +export interface IterationSnapshot { + iteration: number; + prompt?: string; + output?: unknown; + elapsed?: number; + model?: string; + tokens?: number; + input_tokens?: number; + output_tokens?: number; + cost_usd?: number; + activity: ActivityEntry[]; + error_type?: string; + error_message?: string; +} + +export interface ForEachItemData { + key: string; + index: number; + status: 'running' | 'completed' | 'failed'; + elapsed?: number; + tokens?: number; + cost_usd?: number; + error_type?: string; + error_message?: string; + prompt?: string; + output?: unknown; + activity: ActivityEntry[]; +} + export interface NodeData { name: string; status: NodeStatus; @@ -59,14 +90,19 @@ export interface NodeData { exit_code?: number; // Gate-specific options?: string[]; + option_details?: GateOptionDetail[]; selected_option?: string; route?: string; additional_input?: string; // Group-specific success_count?: number; failure_count?: number; + // For-each per-item tracking + for_each_items?: ForEachItemData[]; // Activity activity: ActivityEntry[]; + // Iteration history (snapshots of completed previous iterations) + iterationHistory?: IterationSnapshot[]; } export interface GroupProgress { @@ -131,6 +167,7 @@ interface WorkflowState { workflowStatus: WorkflowStatus; workflowStartTime: number | null; workflowFailure: { error_type?: string; message?: string } | null; + entryPoint: string | null; // Graph structure agents: WorkflowAgent[]; @@ -167,6 +204,11 @@ interface WorkflowState { setWsStatus: (status: WsStatus) => void; setEdgeHighlight: (from: string, to: string, state: 'highlighted' | 'taken') => void; clearEdgeHighlight: (from: string, to: string) => void; + + // WebSocket send function (set by use-websocket hook) + _wsSend: ((data: object) => void) | null; + setWsSend: (fn: ((data: object) => void) | null) => void; + sendGateResponse: (agentName: string, selectedValue: string, additionalInput?: Record) => void; } function ensureNode(nodes: Record, name: string, type: NodeType = 'agent'): NodeData { @@ -184,11 +226,29 @@ function addActivity(nodes: Record, agentName: string, entry: nd.activity.push(entry); } +/** Create a new reference for a node to ensure React/ReactFlow detects the change. */ +function replaceNode(nodes: Record, name: string): void { + if (nodes[name]) { + nodes[name] = { ...nodes[name]! }; + } +} + +/** Add an activity entry to a for-each item's activity array. */ +function addForEachItemActivity(nodes: Record, groupName: string, itemKey: string, entry: ActivityEntry): void { + const nd = nodes[groupName]; + if (!nd?.for_each_items) return; + const item = nd.for_each_items.find((i) => i.key === itemKey); + if (item) { + item.activity.push(entry); + } +} + export const useWorkflowStore = create((set) => ({ workflowName: '', workflowStatus: 'pending', workflowStartTime: null, workflowFailure: null, + entryPoint: null, agents: [], routes: [], parallelGroups: [], @@ -205,6 +265,23 @@ export const useWorkflowStore = create((set) => ({ eventLog: [], activityLog: [], workflowOutput: null, + _wsSend: null, + + setWsSend: (fn) => { + set({ _wsSend: fn }); + }, + + sendGateResponse: (agentName, selectedValue, additionalInput) => { + const send = useWorkflowStore.getState()._wsSend; + if (send) { + send({ + type: 'gate_response', + agent_name: agentName, + selected_value: selectedValue, + additional_input: additionalInput || {}, + }); + } + }, processEvent: (event: WorkflowEvent) => { const handler = eventHandlers[event.type]; @@ -291,11 +368,17 @@ const eventHandlers: Record(); const agentNames = new Set(); @@ -335,9 +418,35 @@ const eventHandlers: Record { const data = _data as unknown as AgentStartedData; const nd = ensureNode(state.nodes, data.agent_name); + + // Snapshot previous iteration before clearing + if (nd.iteration != null && (nd.output != null || nd.error_type != null)) { + if (!nd.iterationHistory) nd.iterationHistory = []; + nd.iterationHistory.push({ + iteration: nd.iteration, + prompt: nd.prompt, + output: nd.output, + elapsed: nd.elapsed, + model: nd.model, + tokens: nd.tokens, + input_tokens: nd.input_tokens, + output_tokens: nd.output_tokens, + cost_usd: nd.cost_usd, + activity: nd.activity, + error_type: nd.error_type, + error_message: nd.error_message, + }); + } + nd.status = 'running'; nd.iteration = data.iteration; nd.activity = []; + // Clear stale fields from previous iteration + nd.prompt = undefined; + nd.output = undefined; + nd.error_type = undefined; + nd.error_message = undefined; + replaceNode(state.nodes, data.agent_name); }, agent_completed: (state, _data) => { @@ -355,6 +464,7 @@ const eventHandlers: Record { @@ -364,67 +474,111 @@ const eventHandlers: Record { const data = _data as unknown as AgentPromptRenderedData; + const itemKey = (_data as Record).item_key as string | undefined; const nd = ensureNode(state.nodes, data.agent_name); nd.prompt = data.rendered_prompt; nd.context_keys = data.context_keys; + // Route to per-item data when item_key is present (for-each) + if (itemKey) { + addForEachItemActivity(state.nodes, data.agent_name, itemKey, { + type: 'prompt', + icon: '📝', + label: 'prompt', + text: 'Prompt rendered', + detail: data.rendered_prompt?.slice(0, 500) || null, + }); + const itemNd = state.nodes[data.agent_name]; + if (itemNd?.for_each_items) { + const item = itemNd.for_each_items.find((i) => i.key === itemKey); + if (item) item.prompt = data.rendered_prompt; + } + } + replaceNode(state.nodes, data.agent_name); }, agent_reasoning: (state, _data) => { const data = _data as unknown as AgentReasoningData; - addActivity(state.nodes, data.agent_name, { + const itemKey = (_data as Record).item_key as string | undefined; + const entry: ActivityEntry = { type: 'reasoning', icon: '💭', label: 'thinking', text: data.content, - }); + }; + addActivity(state.nodes, data.agent_name, entry); + if (itemKey) { + addForEachItemActivity(state.nodes, data.agent_name, itemKey, entry); + } + replaceNode(state.nodes, data.agent_name); }, agent_tool_start: (state, _data) => { const data = _data as unknown as AgentToolStartData; - addActivity(state.nodes, data.agent_name, { + const itemKey = (_data as Record).item_key as string | undefined; + const entry: ActivityEntry = { type: 'tool-start', icon: '🔧', label: 'tool', text: data.tool_name, detail: data.arguments || null, - }); + }; + addActivity(state.nodes, data.agent_name, entry); + if (itemKey) { + addForEachItemActivity(state.nodes, data.agent_name, itemKey, entry); + } + replaceNode(state.nodes, data.agent_name); }, agent_tool_complete: (state, _data) => { const data = _data as unknown as AgentToolCompleteData; - addActivity(state.nodes, data.agent_name, { + const itemKey = (_data as Record).item_key as string | undefined; + const entry: ActivityEntry = { type: 'tool-complete', icon: '✓', label: 'result', text: data.tool_name || 'done', detail: data.result || null, - }); + }; + addActivity(state.nodes, data.agent_name, entry); + if (itemKey) { + addForEachItemActivity(state.nodes, data.agent_name, itemKey, entry); + } + replaceNode(state.nodes, data.agent_name); }, agent_turn_start: (state, _data) => { const data = _data as unknown as AgentTurnStartData; - addActivity(state.nodes, data.agent_name, { + const itemKey = (_data as Record).item_key as string | undefined; + const entry: ActivityEntry = { type: 'turn', icon: '⏳', label: 'turn', text: `Turn ${data.turn ?? '?'}`, - }); + }; + addActivity(state.nodes, data.agent_name, entry); + if (itemKey) { + addForEachItemActivity(state.nodes, data.agent_name, itemKey, entry); + } + replaceNode(state.nodes, data.agent_name); }, agent_message: (state, _data) => { const data = _data as unknown as AgentMessageData; const nd = ensureNode(state.nodes, data.agent_name); nd.latest_message = data.content; + replaceNode(state.nodes, data.agent_name); }, script_started: (state, _data) => { const data = _data as { agent_name: string }; const nd = ensureNode(state.nodes, data.agent_name); nd.status = 'running'; + replaceNode(state.nodes, data.agent_name); }, script_completed: (state, _data) => { @@ -436,6 +590,7 @@ const eventHandlers: Record { @@ -445,6 +600,7 @@ const eventHandlers: Record { @@ -452,7 +608,9 @@ const eventHandlers: Record { @@ -463,6 +621,7 @@ const eventHandlers: Record { @@ -485,6 +644,7 @@ const eventHandlers: Record { @@ -500,6 +660,8 @@ const eventHandlers: Record { @@ -512,6 +674,8 @@ const eventHandlers: Record { @@ -519,21 +683,33 @@ const eventHandlers: Record { const data = _data as unknown as ForEachStartedData; const nd = ensureNode(state.nodes, data.group_name, 'for_each_group'); nd.status = 'running'; + nd.for_each_items = []; if (state.groupProgress[data.group_name]) { state.groupProgress[data.group_name]!.total = data.item_count; state.groupProgress[data.group_name]!.completed = 0; state.groupProgress[data.group_name]!.failed = 0; } + replaceNode(state.nodes, data.group_name); }, - for_each_item_started: (_state, _data) => { - // No-op for now + for_each_item_started: (state, _data) => { + const data = _data as unknown as ForEachItemStartedData; + const nd = ensureNode(state.nodes, data.group_name, 'for_each_group'); + if (!nd.for_each_items) nd.for_each_items = []; + nd.for_each_items.push({ + key: data.item_key ?? String(data.index), + index: data.index, + status: 'running', + activity: [], + }); + replaceNode(state.nodes, data.group_name); }, for_each_item_completed: (state, _data) => { @@ -541,6 +717,19 @@ const eventHandlers: Record i.key === itemKey); + if (item) { + item.status = 'completed'; + item.elapsed = data.elapsed; + item.tokens = data.tokens; + item.cost_usd = data.cost_usd; + item.output = data.output; + } + } + replaceNode(state.nodes, data.group_name); }, for_each_item_failed: (state, _data) => { @@ -548,6 +737,18 @@ const eventHandlers: Record i.key === itemKey); + if (item) { + item.status = 'failed'; + item.elapsed = data.elapsed; + item.error_type = data.error_type; + item.error_message = data.message; + } + } + replaceNode(state.nodes, data.group_name); }, for_each_completed: (state, _data) => { @@ -558,6 +759,7 @@ const eventHandlers: Record { @@ -566,6 +768,11 @@ const eventHandlers: Record; routes: Array<{ from: string; to: string; when?: string }>; parallel_groups?: Array<{ name: string; agents: string[] }>; @@ -140,10 +141,18 @@ export interface ScriptFailedData { // --- Gate events --- +export interface GateOptionDetail { + label: string; + value: string; + route: string; + prompt_for?: string | null; +} + export interface GatePresentedData { agent_name: string; prompt?: string; options?: string[]; + option_details?: GateOptionDetail[]; } export interface GateResolvedData { @@ -198,18 +207,26 @@ export interface ForEachStartedData { export interface ForEachItemStartedData { group_name: string; + item_key: string; index: number; - item: unknown; + item?: unknown; } export interface ForEachItemCompletedData { group_name: string; + item_key: string; index: number; + elapsed?: number; + tokens?: number; + cost_usd?: number; + output?: unknown; } export interface ForEachItemFailedData { group_name: string; + item_key: string; index: number; + elapsed?: number; error_type?: string; message?: string; } diff --git a/src/conductor/web/frontend/tsconfig.tsbuildinfo b/src/conductor/web/frontend/tsconfig.tsbuildinfo index 73098fb..8ca3ca9 100644 --- a/src/conductor/web/frontend/tsconfig.tsbuildinfo +++ b/src/conductor/web/frontend/tsconfig.tsbuildinfo @@ -1 +1 @@ -{"root":["./src/app.tsx","./src/main.tsx","./src/components/detail/activitystream.tsx","./src/components/detail/agentdetail.tsx","./src/components/detail/detailpanel.tsx","./src/components/detail/gatedetail.tsx","./src/components/detail/groupdetail.tsx","./src/components/detail/metadatagrid.tsx","./src/components/detail/outputviewer.tsx","./src/components/detail/scriptdetail.tsx","./src/components/graph/agentnode.tsx","./src/components/graph/animatededge.tsx","./src/components/graph/endnode.tsx","./src/components/graph/gatenode.tsx","./src/components/graph/groupnode.tsx","./src/components/graph/scriptnode.tsx","./src/components/graph/workflowgraph.tsx","./src/components/graph/graph-layout.ts","./src/components/layout/header.tsx","./src/components/layout/outputpane.tsx","./src/components/layout/resizablelayout.tsx","./src/components/layout/statusbar.tsx","./src/hooks/use-elapsed-timer.ts","./src/hooks/use-websocket.ts","./src/lib/constants.ts","./src/lib/utils.ts","./src/stores/workflow-store.ts","./src/types/events.ts"],"version":"5.9.3"} \ No newline at end of file +{"root":["./src/app.tsx","./src/main.tsx","./src/components/detail/activitystream.tsx","./src/components/detail/agentdetail.tsx","./src/components/detail/detailpanel.tsx","./src/components/detail/gatedetail.tsx","./src/components/detail/groupdetail.tsx","./src/components/detail/metadatagrid.tsx","./src/components/detail/outputviewer.tsx","./src/components/detail/scriptdetail.tsx","./src/components/graph/agentnode.tsx","./src/components/graph/animatededge.tsx","./src/components/graph/endnode.tsx","./src/components/graph/gatenode.tsx","./src/components/graph/groupnode.tsx","./src/components/graph/scriptnode.tsx","./src/components/graph/startnode.tsx","./src/components/graph/workflowgraph.tsx","./src/components/graph/graph-layout.ts","./src/components/layout/header.tsx","./src/components/layout/outputpane.tsx","./src/components/layout/resizablelayout.tsx","./src/components/layout/statusbar.tsx","./src/hooks/use-elapsed-timer.ts","./src/hooks/use-websocket.ts","./src/lib/constants.ts","./src/lib/utils.ts","./src/stores/workflow-store.ts","./src/types/events.ts"],"version":"5.9.3"} \ No newline at end of file diff --git a/src/conductor/web/server.py b/src/conductor/web/server.py index ab4fd2b..29ce96c 100644 --- a/src/conductor/web/server.py +++ b/src/conductor/web/server.py @@ -20,6 +20,7 @@ import asyncio import contextlib +import json import logging from collections.abc import AsyncGenerator from contextlib import asynccontextmanager @@ -74,6 +75,9 @@ def __init__( self._workflow_completed = False self._queue: asyncio.Queue[dict[str, Any]] = asyncio.Queue() + # Gate response channel (web client → engine) + self._gate_response_queue: asyncio.Queue[dict[str, Any]] = asyncio.Queue() + # Auto-shutdown support (--web-bg) self._bg_event = asyncio.Event() self._grace_task: asyncio.Task[None] | None = None @@ -136,8 +140,14 @@ async def websocket_endpoint(ws: WebSocket) -> None: self._grace_task = None try: while True: - # Keep-alive: wait for any client message (ping/pong) - await ws.receive_text() + # Read messages from client (keep-alive pings or gate responses) + raw = await ws.receive_text() + try: + msg = json.loads(raw) + if isinstance(msg, dict) and msg.get("type") == "gate_response": + self._gate_response_queue.put_nowait(msg) + except (json.JSONDecodeError, TypeError): + pass # Ignore non-JSON messages (keep-alive pings) except WebSocketDisconnect: pass finally: @@ -193,6 +203,41 @@ async def _broadcaster(self) -> None: self._connections.discard(ws) self._maybe_start_grace_timer() + # ------------------------------------------------------------------ + # Gate response channel (web client → engine) + # ------------------------------------------------------------------ + + def has_connections(self) -> bool: + """Check if any WebSocket clients are connected. + + Returns: + True if at least one web client is connected. + """ + return len(self._connections) > 0 + + async def wait_for_gate_response(self, agent_name: str) -> dict[str, Any]: + """Wait for a gate response from a web client. + + Blocks until a ``gate_response`` message is received via WebSocket + that matches the given agent name. Non-matching messages are + re-queued so they are not lost. + + Args: + agent_name: The name of the human_gate agent to wait for. + + Returns: + The gate response payload dict with keys ``selected_value`` + and optionally ``additional_input``. + """ + while True: + msg = await self._gate_response_queue.get() + if msg.get("agent_name") == agent_name: + return msg + # Not for this agent — put it back + self._gate_response_queue.put_nowait(msg) + # Yield to avoid busy-loop + await asyncio.sleep(0.01) + # ------------------------------------------------------------------ # Auto-shutdown (--web-bg) # ------------------------------------------------------------------ diff --git a/src/conductor/web/static/assets/index-B6RHOQs6.css b/src/conductor/web/static/assets/index-B6RHOQs6.css deleted file mode 100644 index a78428b..0000000 --- a/src/conductor/web/static/assets/index-B6RHOQs6.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-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-duration: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-400:oklch(70.4% .191 22.216);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-green-400:oklch(79.2% .209 151.711);--color-green-600:oklch(62.7% .194 149.214);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-600:oklch(60.9% .126 221.723);--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-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-wider:.05em;--leading-tight:1.25;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:calc(var(--spacing) * 0)}.end{inset-inline-end:var(--spacing)}.-top-0\.5{top:calc(var(--spacing) * -.5)}.-right-0\.5{right:calc(var(--spacing) * -.5)}.z-10{z-index:10}.-mx-1{margin-inline:calc(var(--spacing) * -1)}.my-0\.5{margin-block:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.-mb-px{margin-bottom:-1px}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.ml-\[4\.25rem\]{margin-left:4.25rem}.ml-\[calc\(7ch\+5ch\+8ch\+1rem\)\]{margin-left:calc(20ch + 1rem)}.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-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-11{height:calc(var(--spacing) * 11)}.h-\[3px\]{height:3px}.h-full{height:100%}.max-h-24{max-height:calc(var(--spacing) * 24)}.max-h-\[400px\]{max-height:400px}.\!w-2{width:calc(var(--spacing) * 2)!important}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-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-full{width:100%}.max-w-\[16ch\]{max-width:16ch}.max-w-\[140px\]{max-width:140px}.max-w-\[200px\]{max-width:200px}.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}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-col-resize{cursor:col-resize}.cursor-row-resize{cursor:row-resize}.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-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-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-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-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.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-\[var\(--completed\)\]{border-color:var(--completed)}.border-transparent{border-color:#0000}.\!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\(--completed-muted\)\]{background-color:var(--completed-muted)}.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-transparent{background-color:#0000}.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-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-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.pt-px{padding-top:1px}.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}.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-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.break-words{overflow-wrap:break-word}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.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-green-400{color:var(--color-green-400)}.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-400{color:var(--color-red-400)}.text-white{color:var(--color-white)}.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,)}.opacity-40{opacity:.4}.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\(--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)}.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)}.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,)}.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-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.placeholder\:text-\[var\(--text-muted\)\]::placeholder{color:var(--text-muted)}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media(hover:hover){.hover\:bg-\[var\(--surface-hover\)\]:hover{background-color:var(--surface-hover)}.hover\:bg-\[var\(--text-muted\)\]:hover{background-color:var(--text-muted)}.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\:underline:hover{text-decoration-line:underline}}}: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 dash-flow{to{stroke-dashoffset:-20px}}::-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-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-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@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-BjXAFktV.js b/src/conductor/web/static/assets/index-BjXAFktV.js new file mode 100644 index 0000000..5d26c46 --- /dev/null +++ b/src/conductor/web/static/assets/index-BjXAFktV.js @@ -0,0 +1,230 @@ +var I2=Object.defineProperty;var V2=(e,n,i)=>n in e?I2(e,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[n]=i;var kt=(e,n,i)=>V2(e,typeof n!="symbol"?n+"":n,i);function G2(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 Go(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Id={exports:{}},lo={};/** + * @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 gx;function Y2(){if(gx)return lo;gx=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 lo.Fragment=n,lo.jsx=i,lo.jsxs=i,lo}var yx;function $2(){return yx||(yx=1,Id.exports=Y2()),Id.exports}var E=$2(),Vd={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 xx;function X2(){if(xx)return Ae;xx=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(B){return B===null||typeof B!="object"?null:(B=y&&B[y]||B["@@iterator"],typeof B=="function"?B:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,S={};function _(B,P,N){this.props=B,this.context=P,this.refs=S,this.updater=N||b}_.prototype.isReactComponent={},_.prototype.setState=function(B,P){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,P,"setState")},_.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function z(){}z.prototype=_.prototype;function w(B,P,N){this.props=B,this.context=P,this.refs=S,this.updater=N||b}var T=w.prototype=new z;T.constructor=w,C(T,_.prototype),T.isPureReactComponent=!0;var U=Array.isArray;function A(){}var L={H:null,A:null,T:null,S:null},q=Object.prototype.hasOwnProperty;function I(B,P,N){var V=N.ref;return{$$typeof:e,type:B,key:P,ref:V!==void 0?V:null,props:N}}function $(B,P){return I(B.type,P,B.props)}function R(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function D(B){var P={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(N){return P[N]})}var ee=/\/+/g;function H(B,P){return typeof B=="object"&&B!==null&&B.key!=null?D(""+B.key):P.toString(36)}function G(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(A,A):(B.status="pending",B.then(function(P){B.status==="pending"&&(B.status="fulfilled",B.value=P)},function(P){B.status==="pending"&&(B.status="rejected",B.reason=P)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function j(B,P,N,V,F){var J=typeof B;(J==="undefined"||J==="boolean")&&(B=null);var ne=!1;if(B===null)ne=!0;else switch(J){case"bigint":case"string":case"number":ne=!0;break;case"object":switch(B.$$typeof){case e:case n:ne=!0;break;case m:return ne=B._init,j(ne(B._payload),P,N,V,F)}}if(ne)return F=F(B),ne=V===""?"."+H(B,0):V,U(F)?(N="",ne!=null&&(N=ne.replace(ee,"$&/")+"/"),j(F,P,N,"",function(ge){return ge})):F!=null&&(R(F)&&(F=$(F,N+(F.key==null||B&&B.key===F.key?"":(""+F.key).replace(ee,"$&/")+"/")+ne)),P.push(F)),1;ne=0;var re=V===""?".":V+":";if(U(B))for(var se=0;se>>1,M=j[K];if(0>>1;Ko(N,Z))Vo(F,N)?(j[K]=F,j[V]=Z,K=V):(j[K]=N,j[P]=Z,K=P);else if(Vo(F,Z))j[K]=F,j[V]=Z,K=V;else break e}}return Y}function o(j,Y){var Z=j.sortIndex-Y.sortIndex;return Z!==0?Z:j.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,f=u.now();e.unstable_now=function(){return u.now()-f}}var d=[],h=[],m=1,p=null,y=3,v=!1,b=!1,C=!1,S=!1,_=typeof setTimeout=="function"?setTimeout:null,z=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function T(j){for(var Y=i(h);Y!==null;){if(Y.callback===null)l(h);else if(Y.startTime<=j)l(h),Y.sortIndex=Y.expirationTime,n(d,Y);else break;Y=i(h)}}function U(j){if(C=!1,T(j),!b)if(i(d)!==null)b=!0,A||(A=!0,D());else{var Y=i(h);Y!==null&&G(U,Y.startTime-j)}}var A=!1,L=-1,q=5,I=-1;function $(){return S?!0:!(e.unstable_now()-Ij&&$());){var K=p.callback;if(typeof K=="function"){p.callback=null,y=p.priorityLevel;var M=K(p.expirationTime<=j);if(j=e.unstable_now(),typeof M=="function"){p.callback=M,T(j),Y=!0;break t}p===i(d)&&l(d),T(j)}else l(d);p=i(d)}if(p!==null)Y=!0;else{var B=i(h);B!==null&&G(U,B.startTime-j),Y=!1}}break e}finally{p=null,y=Z,v=!1}Y=void 0}}finally{Y?D():A=!1}}}var D;if(typeof w=="function")D=function(){w(R)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,H=ee.port2;ee.port1.onmessage=R,D=function(){H.postMessage(null)}}else D=function(){_(R,0)};function G(j,Y){L=_(function(){j(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(j){j.callback=null},e.unstable_forceFrameRate=function(j){0>j||125K?(j.sortIndex=Z,n(h,j),i(d)===null&&j===i(h)&&(C?(z(L),L=-1):C=!0,G(U,Z-K))):(j.sortIndex=M,n(d,j),b||v||(b=!0,A||(A=!0,D()))),j},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(j){var Y=y;return function(){var Z=y;y=Y;try{return j.apply(this,arguments)}finally{y=Z}}}})($d)),$d}var wx;function Q2(){return wx||(wx=1,Yd.exports=F2()),Yd.exports}var Xd={exports:{}},$t={};/** + * @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 Sx;function Z2(){if(Sx)return $t;Sx=1;var e=Yo();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(),Xd.exports=Z2(),Xd.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 Ex;function K2(){if(Ex)return ao;Ex=1;var e=Q2(),n=Yo(),i=j1();function l(t){var r="https://react.dev/errors/"+t;if(1M||(t.current=K[M],K[M]=null,M--)}function N(t,r){M++,K[M]=t.current,t.current=r}var V=B(null),F=B(null),J=B(null),ne=B(null);function re(t,r){switch(N(J,r),N(F,t),N(V,null),r.nodeType){case 9:case 11:t=(t=r.documentElement)&&(t=t.namespaceURI)?q0(t):0;break;default:if(t=r.tagName,r=r.namespaceURI)r=q0(r),t=U0(r,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}P(V),N(V,t)}function se(){P(V),P(F),P(J)}function ge(t){t.memoizedState!==null&&N(ne,t);var r=V.current,a=U0(r,t.type);r!==a&&(N(F,t),N(V,a))}function xe(t){F.current===t&&(P(V),P(F)),ne.current===t&&(P(ne),to._currentValue=Z)}var ye,he;function Se(t){if(ye===void 0)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);ye=r&&r[1]||"",he=-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:"")?Se(a):""}function lt(t,r){switch(t.tag){case 26:case 27:case 5:return Se(t.type);case 16:return Se("Lazy");case 13:return t.child!==r&&r!==null?Se("Suspense Fallback"):Se("Suspense");case 19:return Se("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 Se("Activity");default:return""}}function Je(t){try{var r="",a=null;do r+=lt(t,a),a=t,t=t.return;while(t);return r}catch(c){return` +Error generating stack: `+c.message+` +`+c.stack}}var Tt=Object.prototype.hasOwnProperty,Vt=e.unstable_scheduleCallback,Lt=e.unstable_cancelCallback,Sn=e.unstable_shouldYield,jn=e.unstable_requestPaint,Mt=e.unstable_now,jr=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,me=e.unstable_UserBlockingPriority,Ne=e.unstable_NormalPriority,Le=e.unstable_LowPriority,Ge=e.unstable_IdlePriority,Pt=e.log,On=e.unstable_setDisableYieldValue,Ht=null,xt=null;function Gt(t){if(typeof Pt=="function"&&On(t),xt&&typeof xt.setStrictMode=="function")try{xt.setStrictMode(Ht,t)}catch{}}var Qe=Math.clz32?Math.clz32:zc,$n=Math.log,un=Math.LN2;function zc(t){return t>>>=0,t===0?32:31-($n(t)/un|0)|0}var Ji=256,Wi=262144,el=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 tl(t,r,a){var c=t.pendingLanes;if(c===0)return 0;var g=0,x=t.suspendedLanes,k=t.pingedLanes;t=t.warmLanes;var O=c&134217727;return O!==0?(c=O&~x,c!==0?g=ir(c):(k&=O,k!==0?g=ir(k):a||(a=O&~t,a!==0&&(g=ir(a))))):(O=c&~x,O!==0?g=ir(O):k!==0?g=ir(k):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 gi(t,r){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&r)===0}function Ac(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 ns(){var t=el;return el<<=1,(el&62914560)===0&&(el=4194304),t}function da(t){for(var r=[],a=0;31>a;a++)r.push(t);return r}function yi(t,r){t.pendingLanes|=r,r!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Tc(t,r,a,c,g,x){var k=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=k&~a;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Rc=/[\n"\\]/g;function Zt(t){return t.replace(Rc,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function bi(t,r,a,c,g,x,k,O){t.name="",k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?t.type=k:t.removeAttribute("type"),r!=null?k==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+Qt(r)):t.value!==""+Qt(r)&&(t.value=""+Qt(r)):k!=="submit"&&k!=="reset"||t.removeAttribute("value"),r!=null?ya(t,k,Qt(r)):a!=null?ya(t,k,Qt(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=""+Qt(O):t.removeAttribute("name")}function ms(t,r,a,c,g,x,k,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)){Br(t);return}a=a!=null?""+Qt(a):"",r=r!=null?""+Qt(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,k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(t.name=k),Br(t)}function ya(t,r,a){r==="number"&&vi(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"),Uc=!1;if(ur)try{var va={};Object.defineProperty(va,"passive",{get:function(){Uc=!0}}),window.addEventListener("test",va,va),window.removeEventListener("test",va,va)}catch{Uc=!1}var qr=null,Ic=null,ys=null;function Um(){if(ys)return ys;var t,r=Ic,a=r.length,c,g="value"in qr?qr.value:qr.textContent,x=g.length;for(t=0;t=Sa),Xm=" ",Pm=!1;function Fm(t,r){switch(t){case"keyup":return uE.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Qm(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var sl=!1;function fE(t,r){switch(t){case"compositionend":return Qm(r);case"keypress":return r.which!==32?null:(Pm=!0,Xm);case"textInput":return t=r.data,t===Xm&&Pm?null:t;default:return null}}function dE(t,r){if(sl)return t==="compositionend"||!Xc&&Fm(t,r)?(t=Um(),ys=Ic=qr=null,sl=!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=rg(a)}}function lg(t,r){return t&&r?t===r?!0:t&&t.nodeType===3?!1:r&&r.nodeType===3?lg(t,r.parentNode):"contains"in t?t.contains(r):t.compareDocumentPosition?!!(t.compareDocumentPosition(r)&16):!1:!1}function ag(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var r=vi(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=vi(t.document)}return r}function Qc(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 bE=ur&&"documentMode"in document&&11>=document.documentMode,ul=null,Zc=null,ka=null,Kc=!1;function og(t,r,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Kc||ul==null||ul!==vi(c)||(c=ul,"selectionStart"in c&&Qc(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}),ka&&Na(ka,c)||(ka=c,c=cu(Zc,"onSelect"),0>=k,g-=k,Pn=1<<32-Qe(r)+g|a<je?(Ue=we,we=null):Ue=we.sibling;var $e=ae(te,we,ie[je],fe);if($e===null){we===null&&(we=Ue);break}t&&we&&$e.alternate===null&&r(te,we),W=x($e,W,je),Ye===null?_e=$e:Ye.sibling=$e,Ye=$e,we=Ue}if(je===ie.length)return a(te,we),Ie&&fr(te,je),_e;if(we===null){for(;jeje?(Ue=we,we=null):Ue=we.sibling;var oi=ae(te,we,$e.value,fe);if(oi===null){we===null&&(we=Ue);break}t&&we&&oi.alternate===null&&r(te,we),W=x(oi,W,je),Ye===null?_e=oi:Ye.sibling=oi,Ye=oi,we=Ue}if($e.done)return a(te,we),Ie&&fr(te,je),_e;if(we===null){for(;!$e.done;je++,$e=ie.next())$e=de(te,$e.value,fe),$e!==null&&(W=x($e,W,je),Ye===null?_e=$e:Ye.sibling=$e,Ye=$e);return Ie&&fr(te,je),_e}for(we=c(we);!$e.done;je++,$e=ie.next())$e=oe(we,te,je,$e.value,fe),$e!==null&&(t&&$e.alternate!==null&&we.delete($e.key===null?je:$e.key),W=x($e,W,je),Ye===null?_e=$e:Ye.sibling=$e,Ye=$e);return t&&we.forEach(function(U2){return r(te,U2)}),Ie&&fr(te,je),_e}function tt(te,W,ie,fe){if(typeof ie=="object"&&ie!==null&&ie.type===C&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case v:e:{for(var _e=ie.key;W!==null;){if(W.key===_e){if(_e=ie.type,_e===C){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===_e||typeof _e=="object"&&_e!==null&&_e.$$typeof===q&&Ti(_e)===W.type){a(te,W.sibling),fe=g(W,ie.props),ja(fe,ie),fe.return=te,te=fe;break e}a(te,W);break}else r(te,W);W=W.sibling}ie.type===C?(fe=Ni(ie.props.children,te.mode,fe,ie.key),fe.return=te,te=fe):(fe=Cs(ie.type,ie.key,ie.props,null,te.mode,fe),ja(fe,ie),fe.return=te,te=fe)}return k(te);case b:e:{for(_e=ie.key;W!==null;){if(W.key===_e)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=lf(ie,te.mode,fe),fe.return=te,te=fe}return k(te);case q:return ie=Ti(ie),tt(te,W,ie,fe)}if(G(ie))return ve(te,W,ie,fe);if(D(ie)){if(_e=D(ie),typeof _e!="function")throw Error(l(150));return ie=_e.call(ie),ke(te,W,ie,fe)}if(typeof ie.then=="function")return tt(te,W,Ds(ie),fe);if(ie.$$typeof===w)return tt(te,W,Ts(te,ie),fe);Rs(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=rf(ie,te.mode,fe),fe.return=te,te=fe),k(te)):a(te,W)}return function(te,W,ie,fe){try{Ma=0;var _e=tt(te,W,ie,fe);return bl=null,_e}catch(we){if(we===vl||we===js)throw we;var Ye=fn(29,we,null,te.mode);return Ye.lanes=fe,Ye.return=te,Ye}finally{}}}var ji=Tg(!0),Mg=Tg(!1),Yr=!1;function yf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function xf(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 $r(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Xr(t,r,a){var c=t.updateQueue;if(c===null)return null;if(c=c.shared,(Xe&2)!==0){var g=c.pending;return g===null?r.next=r:(r.next=g.next,g.next=r),c.pending=r,r=ks(t),pg(t,null,a),r}return Ns(t,c,r,a),ks(t)}function Oa(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,is(t,a)}}function vf(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 k={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};x===null?g=x=k:x=x.next=k,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 bf=!1;function Da(){if(bf){var t=xl;if(t!==null)throw t}}function Ra(t,r,a,c){bf=!1;var g=t.updateQueue;Yr=!1;var x=g.firstBaseUpdate,k=g.lastBaseUpdate,O=g.shared.pending;if(O!==null){g.shared.pending=null;var Q=O,le=Q.next;Q.next=null,k===null?x=le:k.next=le,k=Q;var ce=t.alternate;ce!==null&&(ce=ce.updateQueue,O=ce.lastBaseUpdate,O!==k&&(O===null?ce.firstBaseUpdate=le:O.next=le,ce.lastBaseUpdate=Q))}if(x!==null){var de=g.baseState;k=0,ce=le=Q=null,O=x;do{var ae=O.lane&-536870913,oe=ae!==O.lane;if(oe?(qe&ae)===ae:(c&ae)===ae){ae!==0&&ae===yl&&(bf=!0),ce!==null&&(ce=ce.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var ve=t,ke=O;ae=r;var tt=a;switch(ke.tag){case 1:if(ve=ke.payload,typeof ve=="function"){de=ve.call(tt,de,ae);break e}de=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=ke.payload,ae=typeof ve=="function"?ve.call(tt,de,ae):ve,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,k|=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),Kr|=k,t.lanes=k,t.memoizedState=de}}function jg(t,r){if(typeof t!="function")throw Error(l(191,t));t.call(r)}function Og(t,r){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;tx?x:8;var k=j.T,O={};j.T=O,qf(t,!1,r,a);try{var Q=g(),le=j.S;if(le!==null&&le(O,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var ce=AE(Q,c);Ba(t,r,ce,gn(t))}else Ba(t,r,c,gn(t))}catch(de){Ba(t,r,{then:function(){},status:"rejected",reason:de},gn())}finally{Y.p=x,k!==null&&O.types!==null&&(k.types=O.types),j.T=k}}function RE(){}function Hf(t,r,a,c){if(t.tag!==5)throw Error(l(476));var g=fy(t).queue;cy(t,g,r,Z,a===null?RE:function(){return dy(t),a(c)})}function fy(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 dy(t){var r=fy(t);r.next===null&&(r=t.alternate.memoizedState),Ba(t,r.next.queue,{},gn())}function Bf(){return qt(to)}function hy(){return bt().memoizedState}function py(){return bt().memoizedState}function LE(t){for(var r=t.return;r!==null;){switch(r.tag){case 24:case 3:var a=gn();t=$r(a);var c=Xr(r,t,a);c!==null&&(nn(c,r,a),Oa(c,r,a)),r={cache:hf()},t.payload=r;return}r=r.return}}function HE(t,r,a){var c=gn();a={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},$s(t)?gy(r,a):(a=tf(t,r,a,c),a!==null&&(nn(a,t,c),yy(a,r,c)))}function my(t,r,a){var c=gn();Ba(t,r,a,c)}function Ba(t,r,a,c){var g={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if($s(t))gy(r,g);else{var x=t.alternate;if(t.lanes===0&&(x===null||x.lanes===0)&&(x=r.lastRenderedReducer,x!==null))try{var k=r.lastRenderedState,O=x(k,a);if(g.hasEagerState=!0,g.eagerState=O,cn(O,k))return Ns(t,r,g,0),nt===null&&Es(),!1}catch{}finally{}if(a=tf(t,r,g,c),a!==null)return nn(a,t,c),yy(a,r,c),!0}return!1}function qf(t,r,a,c){if(c={lane:2,revertLane:yd(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},$s(t)){if(r)throw Error(l(479))}else r=tf(t,a,c,2),r!==null&&nn(r,t,2)}function $s(t){var r=t.alternate;return t===Te||r!==null&&r===Te}function gy(t,r){Sl=Bs=!0;var a=t.pending;a===null?r.next=r:(r.next=a.next,a.next=r),t.pending=r}function yy(t,r,a){if((a&4194048)!==0){var c=r.lanes;c&=t.pendingLanes,a|=c,r.lanes=a,is(t,a)}}var qa={readContext:qt,use:Is,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};qa.useEffectEvent=mt;var xy={readContext:qt,use:Is,useCallback:function(t,r){return Ft().memoizedState=[t,r===void 0?null:r],t},useContext:qt,useEffect:ty,useImperativeHandle:function(t,r,a){a=a!=null?a.concat([t]):null,Gs(4194308,4,ly.bind(null,r,t),a)},useLayoutEffect:function(t,r){return Gs(4194308,4,t,r)},useInsertionEffect:function(t,r){Gs(4,2,t,r)},useMemo:function(t,r){var a=Ft();r=r===void 0?null:r;var c=t();if(Oi){Gt(!0);try{t()}finally{Gt(!1)}}return a.memoizedState=[c,r],c},useReducer:function(t,r,a){var c=Ft();if(a!==void 0){var g=a(r);if(Oi){Gt(!0);try{a(r)}finally{Gt(!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=HE.bind(null,Te,t),[c.memoizedState,t]},useRef:function(t){var r=Ft();return t={current:t},r.memoizedState=t},useState:function(t){t=jf(t);var r=t.queue,a=my.bind(null,Te,r);return r.dispatch=a,[t.memoizedState,a]},useDebugValue:Rf,useDeferredValue:function(t,r){var a=Ft();return Lf(a,t,r)},useTransition:function(){var t=jf(!1);return t=cy.bind(null,Te,t.queue,!0,!1),Ft().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,r,a){var c=Te,g=Ft();if(Ie){if(a===void 0)throw Error(l(407));a=a()}else{if(a=r(),nt===null)throw Error(l(349));(qe&127)!==0||qg(c,r,a)}g.memoizedState=a;var x={value:a,getSnapshot:r};return g.queue=x,ty(Ig.bind(null,c,x,t),[t]),c.flags|=2048,El(9,{destroy:void 0},Ug.bind(null,c,x,a,r),null),a},useId:function(){var t=Ft(),r=nt.identifierPrefix;if(Ie){var a=Fn,c=Pn;a=(c&~(1<<32-Qe(c)-1)).toString(32)+a,r="_"+r+"R_"+a,a=qs++,0<\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof c.is=="string"?k.createElement("select",{is:c.is}):k.createElement("select"),c.multiple?x.multiple=!0:c.size&&(x.size=c.size);break;default:x=typeof c.is=="string"?k.createElement(g,{is:c.is}):k.createElement(g)}}x[jt]=r,x[Yt]=c;e:for(k=r.child;k!==null;){if(k.tag===5||k.tag===6)x.appendChild(k.stateNode);else if(k.tag!==4&&k.tag!==27&&k.child!==null){k.child.return=k,k=k.child;continue}if(k===r)break e;for(;k.sibling===null;){if(k.return===null||k.return===r)break e;k=k.return}k.sibling.return=k.return,k=k.sibling}r.stateNode=x;e:switch(It(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 ot(r),Wf(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=J.current,ml(r)){if(t=r.stateNode,a=r.memoizedProps,c=null,g=Bt,g!==null)switch(g.tag){case 27:case 5:c=g.memoizedProps}t[jt]=r,t=!!(t.nodeValue===a||c!==null&&c.suppressHydrationWarning===!0||H0(t.nodeValue,a)),t||Vr(r,!0)}else t=fu(t).createTextNode(c),t[jt]=r,r.stateNode=t}return ot(r),null;case 31:if(a=r.memoizedState,t===null||t.memoizedState!==null){if(c=ml(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[jt]=r}else ki(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ot(r),t=!1}else a=uf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return r.flags&256?(hn(r),r):(hn(r),null);if((r.flags&128)!==0)throw Error(l(558))}return ot(r),null;case 13:if(c=r.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(g=ml(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[jt]=r}else ki(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ot(r),g=!1}else g=uf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=g),g=!0;if(!g)return r.flags&256?(hn(r),r):(hn(r),null)}return hn(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),Zs(r,r.updateQueue),ot(r),null);case 4:return se(),t===null&&wd(r.stateNode.containerInfo),ot(r),null;case 10:return hr(r.type),ot(r),null;case 19:if(P(vt),c=r.memoizedState,c===null)return ot(r),null;if(g=(r.flags&128)!==0,x=c.rendering,x===null)if(g)Ia(c,!1);else{if(gt!==0||t!==null&&(t.flags&128)!==0)for(t=r.child;t!==null;){if(x=Hs(t),x!==null){for(r.flags|=128,Ia(c,!1),t=x.updateQueue,r.updateQueue=t,Zs(r,t),r.subtreeFlags=0,t=a,a=r.child;a!==null;)mg(a,t),a=a.sibling;return N(vt,vt.current&1|2),Ie&&fr(r,c.treeForkCount),r.child}t=t.sibling}c.tail!==null&&Mt()>tu&&(r.flags|=128,g=!0,Ia(c,!1),r.lanes=4194304)}else{if(!g)if(t=Hs(x),t!==null){if(r.flags|=128,g=!0,t=t.updateQueue,r.updateQueue=t,Zs(r,t),Ia(c,!0),c.tail===null&&c.tailMode==="hidden"&&!x.alternate&&!Ie)return ot(r),null}else 2*Mt()-c.renderingStartTime>tu&&a!==536870912&&(r.flags|=128,g=!0,Ia(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=Mt(),t.sibling=null,a=vt.current,N(vt,g?a&1|2:a&1),Ie&&fr(r,c.treeForkCount),t):(ot(r),null);case 22:case 23:return hn(r),Sf(),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&&(ot(r),r.subtreeFlags&6&&(r.flags|=8192)):ot(r),a=r.updateQueue,a!==null&&Zs(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(Ai),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),r.memoizedState.cache!==a&&(r.flags|=2048),hr(St),ot(r),null;case 25:return null;case 30:return null}throw Error(l(156,r.tag))}function VE(t,r){switch(of(r),r.tag){case 1:return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 3:return hr(St),se(),t=r.flags,(t&65536)!==0&&(t&128)===0?(r.flags=t&-65537|128,r):null;case 26:case 27:case 5:return xe(r),null;case 31:if(r.memoizedState!==null){if(hn(r),r.alternate===null)throw Error(l(340));ki()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 13:if(hn(r),t=r.memoizedState,t!==null&&t.dehydrated!==null){if(r.alternate===null)throw Error(l(340));ki()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 19:return P(vt),null;case 4:return se(),null;case 10:return hr(r.type),null;case 22:case 23:return hn(r),Sf(),t!==null&&P(Ai),t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 24:return hr(St),null;case 25:return null;default:return null}}function Vy(t,r){switch(of(r),r.tag){case 3:hr(St),se();break;case 26:case 27:case 5:xe(r);break;case 4:se();break;case 31:r.memoizedState!==null&&hn(r);break;case 13:hn(r);break;case 19:P(vt);break;case 10:hr(r.type);break;case 22:case 23:hn(r),Sf(),t!==null&&P(Ai);break;case 24:hr(St)}}function Va(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,k=a.inst;c=x(),k.destroy=c}a=a.next}while(a!==g)}}catch(O){Ke(r,r.return,O)}}function Qr(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 k=c.inst,O=k.destroy;if(O!==void 0){k.destroy=void 0,g=r;var Q=a,le=O;try{le()}catch(ce){Ke(g,Q,ce)}}}c=c.next}while(c!==x)}}catch(ce){Ke(r,r.return,ce)}}function Gy(t){var r=t.updateQueue;if(r!==null){var a=t.stateNode;try{Og(r,a)}catch(c){Ke(t,t.return,c)}}}function Yy(t,r,a){a.props=Di(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(c){Ke(t,r,c)}}function Ga(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){Ke(t,r,g)}}function Qn(t,r){var a=t.ref,c=t.refCleanup;if(a!==null)if(typeof c=="function")try{c()}catch(g){Ke(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){Ke(t,r,g)}else a.current=null}function $y(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){Ke(t,t.return,g)}}function ed(t,r,a){try{var c=t.stateNode;c2(c,t.type,a,r),c[Yt]=r}catch(g){Ke(t,t.return,g)}}function Xy(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ni(t.type)||t.tag===4}function td(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Xy(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&&ni(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 nd(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&&ni(t.type)&&(a=t.stateNode,r=null),t=t.child,t!==null))for(nd(t,r,a),t=t.sibling;t!==null;)nd(t,r,a),t=t.sibling}function Ks(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&&ni(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Ks(t,r,a),t=t.sibling;t!==null;)Ks(t,r,a),t=t.sibling}function Py(t){var r=t.stateNode,a=t.memoizedProps;try{for(var c=t.type,g=r.attributes;g.length;)r.removeAttributeNode(g[0]);It(r,c,a),r[jt]=t,r[Yt]=a}catch(x){Ke(t,t.return,x)}}var xr=!1,Nt=!1,rd=!1,Fy=typeof WeakSet=="function"?WeakSet:Set,Dt=null;function GE(t,r){if(t=t.containerInfo,Ed=xu,t=ag(t),Qc(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 k=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=k+g),de!==x||c!==0&&de.nodeType!==3||(Q=k+c),de.nodeType===3&&(k+=de.nodeValue.length),(oe=de.firstChild)!==null;)ae=de,de=oe;for(;;){if(de===t)break t;if(ae===a&&++le===g&&(O=k),ae===x&&++ce===c&&(Q=k),(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(Nd={focusedElem:t,selectionRange:a},xu=!1,Dt=r;Dt!==null;)if(r=Dt,t=r.child,(r.subtreeFlags&1028)!==0&&t!==null)t.return=r,Dt=t;else for(;Dt!==null;){switch(r=Dt,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"))),It(x,c,a),x[jt]=t,wt(x),c=x;break e;case"link":var k=ex("link","href",g).get(c+(a.href||""));if(k){for(var O=0;Ott&&(k=tt,tt=ke,ke=k);var te=ig(O,ke),W=ig(O,tt);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>tt?(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,j.T=null,a=cd,cd=null;var x=Wr,k=_r;if(Ot=0,Al=Wr=null,_r=0,(Xe&6)!==0)throw Error(l(331));var O=Xe;if(Xe|=4,l0(x.current),n0(x,x.current,k,a),Xe=O,Qa(0,!1),xt&&typeof xt.onPostCommitFiberRoot=="function")try{xt.onPostCommitFiberRoot(Ht,x)}catch{}return!0}finally{Y.p=g,j.T=c,_0(t,r)}}function N0(t,r,a){r=En(a,r),r=Gf(t.stateNode,r,2),t=Xr(t,r,2),t!==null&&(yi(t,2),Zn(t))}function Ke(t,r,a){if(t.tag===3)N0(t,t,a);else for(;r!==null;){if(r.tag===3){N0(r,t,a);break}else if(r.tag===1){var c=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Jr===null||!Jr.has(c))){t=En(a,t),a=ky(2),c=Xr(r,a,2),c!==null&&(Cy(a,c,r,t),yi(c,2),Zn(c));break}}r=r.return}}function pd(t,r,a){var c=t.pingCache;if(c===null){c=t.pingCache=new XE;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)||(ad=!0,g.add(a),t=KE.bind(null,t,r,a),r.then(t,t))}function KE(t,r,a){var c=t.pingCache;c!==null&&c.delete(r),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,nt===t&&(qe&a)===a&&(gt===4||gt===3&&(qe&62914560)===qe&&300>Mt()-eu?(Xe&2)===0&&Tl(t,0):od|=a,zl===qe&&(zl=0)),Zn(t)}function k0(t,r){r===0&&(r=ns()),t=Ei(t,r),t!==null&&(yi(t,r),Zn(t))}function JE(t){var r=t.memoizedState,a=0;r!==null&&(a=r.retryLane),k0(t,a)}function WE(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),k0(t,a)}function e2(t,r){return Vt(t,r)}var ou=null,jl=null,md=!1,su=!1,gd=!1,ti=0;function Zn(t){t!==jl&&t.next===null&&(jl===null?ou=jl=t:jl=jl.next=t),su=!0,md||(md=!0,n2())}function Qa(t,r){if(!gd&&su){gd=!0;do for(var a=!1,c=ou;c!==null;){if(t!==0){var g=c.pendingLanes;if(g===0)var x=0;else{var k=c.suspendedLanes,O=c.pingedLanes;x=(1<<31-Qe(42|t)+1)-1,x&=g&~(k&~O),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(a=!0,T0(c,x))}else x=qe,x=tl(c,c===nt?x:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(x&3)===0||gi(c,x)||(a=!0,T0(c,x));c=c.next}while(a);gd=!1}}function t2(){C0()}function C0(){su=md=!1;var t=0;ti!==0&&d2()&&(t=ti);for(var r=Mt(),a=null,c=ou;c!==null;){var g=c.next,x=z0(c,r);x===0?(c.next=null,a===null?ou=g:a.next=g,g===null&&(jl=a)):(a=c,(t!==0||(x&3)!==0)&&(su=!0)),c=g}Ot!==0&&Ot!==5||Qa(t),ti!==0&&(ti=0)}function z0(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&&B0(de)&&(Q=Q.responseEnd,k+=ce*(Q"u"?null:document;function Z0(t,r,a){var c=Ol;if(c&&typeof r=="string"&&r){var g=Zt(r);g='link[rel="'+t+'"][href="'+g+'"]',typeof a=="string"&&(g+='[crossorigin="'+a+'"]'),Q0.has(g)||(Q0.add(g),t={rel:t,crossOrigin:a,href:r},c.querySelector(g)===null&&(r=c.createElement("link"),It(r,"link",t),wt(r),c.head.appendChild(r)))}}function w2(t){Er.D(t),Z0("dns-prefetch",t,null)}function S2(t,r){Er.C(t,r),Z0("preconnect",t,r)}function _2(t,r,a){Er.L(t,r,a);var c=Ol;if(c&&t&&r){var g='link[rel="preload"][as="'+Zt(r)+'"]';r==="image"&&a&&a.imageSrcSet?(g+='[imagesrcset="'+Zt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(g+='[imagesizes="'+Zt(a.imageSizes)+'"]')):g+='[href="'+Zt(t)+'"]';var x=g;switch(r){case"style":x=Dl(t);break;case"script":x=Rl(t)}Tn.has(x)||(t=p({rel:"preload",href:r==="image"&&a&&a.imageSrcSet?void 0:t,as:r},a),Tn.set(x,t),c.querySelector(g)!==null||r==="style"&&c.querySelector(Wa(x))||r==="script"&&c.querySelector(eo(x))||(r=c.createElement("link"),It(r,"link",t),wt(r),c.head.appendChild(r)))}}function E2(t,r){Er.m(t,r);var a=Ol;if(a&&t){var c=r&&typeof r.as=="string"?r.as:"script",g='link[rel="modulepreload"][as="'+Zt(c)+'"][href="'+Zt(t)+'"]',x=g;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Rl(t)}if(!Tn.has(x)&&(t=p({rel:"modulepreload",href:t},r),Tn.set(x,t),a.querySelector(g)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(eo(x)))return}c=a.createElement("link"),It(c,"link",t),wt(c),a.head.appendChild(c)}}}function N2(t,r,a){Er.S(t,r,a);var c=Ol;if(c&&t){var g=Lr(c).hoistableStyles,x=Dl(t);r=r||"default";var k=g.get(x);if(!k){var O={loading:0,preload:null};if(k=c.querySelector(Wa(x)))O.loading=5;else{t=p({rel:"stylesheet",href:t,"data-precedence":r},a),(a=Tn.get(x))&&jd(t,a);var Q=k=c.createElement("link");wt(Q),It(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,hu(k,r,c)}k={type:"stylesheet",instance:k,count:1,state:O},g.set(x,k)}}}function k2(t,r){Er.X(t,r);var a=Ol;if(a&&t){var c=Lr(a).hoistableScripts,g=Rl(t),x=c.get(g);x||(x=a.querySelector(eo(g)),x||(t=p({src:t,async:!0},r),(r=Tn.get(g))&&Od(t,r),x=a.createElement("script"),wt(x),It(x,"link",t),a.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},c.set(g,x))}}function C2(t,r){Er.M(t,r);var a=Ol;if(a&&t){var c=Lr(a).hoistableScripts,g=Rl(t),x=c.get(g);x||(x=a.querySelector(eo(g)),x||(t=p({src:t,async:!0,type:"module"},r),(r=Tn.get(g))&&Od(t,r),x=a.createElement("script"),wt(x),It(x,"link",t),a.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},c.set(g,x))}}function K0(t,r,a,c){var g=(g=J.current)?du(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=Dl(a.href),a=Lr(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=Dl(a.href);var x=Lr(g).hoistableStyles,k=x.get(t);if(k||(g=g.ownerDocument||g,k={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(t,k),(x=g.querySelector(Wa(t)))&&!x._p&&(k.instance=x,k.state.loading=5),Tn.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},Tn.set(t,a),x||z2(g,t,a,k.state))),r&&c===null)throw Error(l(528,""));return k}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=Rl(a),a=Lr(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 Dl(t){return'href="'+Zt(t)+'"'}function Wa(t){return'link[rel="stylesheet"]['+t+"]"}function J0(t){return p({},t,{"data-precedence":t.precedence,precedence:null})}function z2(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}),It(r,"link",a),wt(r),t.head.appendChild(r))}function Rl(t){return'[src="'+Zt(t)+'"]'}function eo(t){return"script[async]"+t}function W0(t,r,a){if(r.count++,r.instance===null)switch(r.type){case"style":var c=t.querySelector('style[data-href~="'+Zt(a.href)+'"]');if(c)return r.instance=c,wt(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"),wt(c),It(c,"style",g),hu(c,a.precedence,t),r.instance=c;case"stylesheet":g=Dl(a.href);var x=t.querySelector(Wa(g));if(x)return r.state.loading|=4,r.instance=x,wt(x),x;c=J0(a),(g=Tn.get(g))&&jd(c,g),x=(t.ownerDocument||t).createElement("link"),wt(x);var k=x;return k._p=new Promise(function(O,Q){k.onload=O,k.onerror=Q}),It(x,"link",c),r.state.loading|=4,hu(x,a.precedence,t),r.instance=x;case"script":return x=Rl(a.src),(g=t.querySelector(eo(x)))?(r.instance=g,wt(g),g):(c=a,(g=Tn.get(x))&&(c=p({},a),Od(c,g)),t=t.ownerDocument||t,g=t.createElement("script"),wt(g),It(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,hu(c,a.precedence,t));return r.instance}function hu(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,k=0;k title"):null)}function A2(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 nx(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function T2(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=Dl(c.href),x=r.querySelector(Wa(g));if(x){r=x._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(t.count++,t=mu.bind(t),r.then(t,t)),a.state.loading|=4,a.instance=x,wt(x);return}x=r.ownerDocument||r,c=J0(c),(g=Tn.get(g))&&jd(c,g),x=x.createElement("link"),wt(x);var k=x;k._p=new Promise(function(O,Q){k.onload=O,k.onerror=Q}),It(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=mu.bind(t),r.addEventListener("load",a),r.addEventListener("error",a))}}var Dd=0;function M2(t,r){return t.stylesheets&&t.count===0&&yu(t,t.stylesheets),0Dd?50:800)+r);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(c),clearTimeout(g)}}:null}function mu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)yu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var gu=null;function yu(t,r){t.stylesheets=null,t.unsuspend!==null&&(t.count++,gu=new Map,r.forEach(j2,t),gu=null,mu.call(t))}function j2(t,r){if(!(r.state.loading&4)){var a=gu.get(t);if(a)var c=a.get(null);else{a=new Map,gu.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(),Gd.exports=K2(),Gd.exports}var W2=J2();/** + * @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=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),O1=(...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 tN={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 nN=X.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:i=2,absoluteStrokeWidth:l,className:o="",children:s,iconNode:u,...f},d)=>X.createElement("svg",{ref:d,...tN,width:n,height:n,stroke:e,strokeWidth:l?Number(i)*24/Number(n):i,className:O1("lucide",o),...f},[...u.map(([h,m])=>X.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 ht=(e,n)=>{const i=X.forwardRef(({className:l,...o},s)=>X.createElement(nN,{ref:s,iconNode:n,className:O1(`lucide-${eN(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 D1=ht("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 rN=ht("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 Ii=ht("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 oa=ht("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 $o=ht("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 iN=ht("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 lN=ht("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 R1=ht("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 aN=ht("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 oN=ht("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 sN=ht("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 To=ht("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 uN=ht("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 cN=ht("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 fN=ht("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 dN=ht("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 hN=ht("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 pN=ht("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 kx=ht("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 mN=ht("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 gN=ht("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 yN=ht("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 xN=ht("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 L1=ht("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Cx=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},vN=(e=>e?Cx(e):Cx),bN=e=>e;function wN(e,n=bN){const i=Vl.useSyncExternalStore(e.subscribe,Vl.useCallback(()=>n(e.getState()),[e,n]),Vl.useCallback(()=>n(e.getInitialState()),[e,n]));return Vl.useDebugValue(i),i}const zx=e=>{const n=vN(e),i=l=>wN(n,l);return Object.assign(i,n),i},SN=(e=>e?zx(e):zx);function ut(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 Nu(e,n,i){ut(e,n).activity.push(i)}function Fe(e,n){e[n]&&(e[n]={...e[n]})}function oo(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 Ee=SN(e=>({workflowName:"",workflowStatus:"pending",workflowStartTime:null,workflowFailure: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,_wsSend:null,setWsSend:n=>{e({_wsSend:n})},sendGateResponse:(n,i,l)=>{const o=Ee.getState()._wsSend;o&&o({type:"gate_response",agent_name:n,selected_value:i,additional_input:l||{}})},processEvent:n=>{const i=Ax[n.type];i&&e(l=>{const o={...l,nodes:{...l.nodes},groupProgress:{...l.groupProgress},eventLog:[...l.eventLog],activityLog:[...l.activityLog]};i(o,n.data);const s=Tx(n);s&&o.eventLog.push(s);const u=Mx(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};for(const o of n){const s=Ax[o.type];s&&s(l,o.data);const u=Tx(o);u&&l.eventLog.push(u);const f=Mx(o);f&&l.activityLog.push(f)}return l})},selectNode:n=>{e({selectedNode: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))}))}})),Ax={workflow_started:(e,n)=>{const i=n;e.workflowStatus="running",e.workflowStartTime=Date.now()/1e3,e.workflowName=i.name||"",e.entryPoint=i.entry_point||null,e.agents=i.agents||[],e.routes=i.routes||[],e.parallelGroups=i.parallel_groups||[],e.forEachGroups=i.for_each_groups||[],ut(e.nodes,"$start","start"),e.nodes.$start.status="running",Fe(e.nodes,"$start");const l=new Set,o=new Set;for(const s of e.parallelGroups){for(const u of s.agents)l.add(u);o.add(s.name),ut(e.nodes,s.name,"parallel_group"),e.groupProgress[s.name]={total:s.agents.length,completed:0,failed:0};for(const u of s.agents)ut(e.nodes,u,"agent")}for(const s of e.forEachGroups)o.add(s.name),ut(e.nodes,s.name,"for_each_group"),e.groupProgress[s.name]={total:0,completed:0,failed:0};for(const s of e.agents)if(!o.has(s.name)&&!l.has(s.name)){const u=s.type||"agent";ut(e.nodes,s.name,u),s.model&&(e.nodes[s.name].model=s.model),o.add(s.name)}e.agentsTotal=o.size},agent_started:(e,n)=>{const i=n,l=ut(e.nodes,i.agent_name);l.iteration!=null&&(l.output!=null||l.error_type!=null)&&(l.iterationHistory||(l.iterationHistory=[]),l.iterationHistory.push({iteration:l.iteration,prompt:l.prompt,output:l.output,elapsed:l.elapsed,model:l.model,tokens:l.tokens,input_tokens:l.input_tokens,output_tokens:l.output_tokens,cost_usd:l.cost_usd,activity:l.activity,error_type:l.error_type,error_message:l.error_message})),l.status="running",l.iteration=i.iteration,l.activity=[],l.prompt=void 0,l.output=void 0,l.error_type=void 0,l.error_message=void 0,Fe(e.nodes,i.agent_name)},agent_completed:(e,n)=>{const i=n,l=ut(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,i.cost_usd&&(e.totalCost+=i.cost_usd),i.tokens&&(e.totalTokens+=i.tokens),Fe(e.nodes,i.agent_name)},agent_failed:(e,n)=>{const i=n,l=ut(e.nodes,i.agent_name);l.status="failed",l.elapsed=i.elapsed,l.error_type=i.error_type,l.error_message=i.message,Fe(e.nodes,i.agent_name)},agent_prompt_rendered:(e,n)=>{var s;const i=n,l=n.item_key,o=ut(e.nodes,i.agent_name);if(o.prompt=i.rendered_prompt,o.context_keys=i.context_keys,l){oo(e.nodes,i.agent_name,l,{type:"prompt",icon:"📝",label:"prompt",text:"Prompt rendered",detail:((s=i.rendered_prompt)==null?void 0:s.slice(0,500))||null});const u=e.nodes[i.agent_name];if(u!=null&&u.for_each_items){const f=u.for_each_items.find(d=>d.key===l);f&&(f.prompt=i.rendered_prompt)}}Fe(e.nodes,i.agent_name)},agent_reasoning:(e,n)=>{const i=n,l=n.item_key,o={type:"reasoning",icon:"💭",label:"thinking",text:i.content};Nu(e.nodes,i.agent_name,o),l&&oo(e.nodes,i.agent_name,l,o),Fe(e.nodes,i.agent_name)},agent_tool_start:(e,n)=>{const i=n,l=n.item_key,o={type:"tool-start",icon:"🔧",label:"tool",text:i.tool_name,detail:i.arguments||null};Nu(e.nodes,i.agent_name,o),l&&oo(e.nodes,i.agent_name,l,o),Fe(e.nodes,i.agent_name)},agent_tool_complete:(e,n)=>{const i=n,l=n.item_key,o={type:"tool-complete",icon:"✓",label:"result",text:i.tool_name||"done",detail:i.result||null};Nu(e.nodes,i.agent_name,o),l&&oo(e.nodes,i.agent_name,l,o),Fe(e.nodes,i.agent_name)},agent_turn_start:(e,n)=>{const i=n,l=n.item_key,o={type:"turn",icon:"⏳",label:"turn",text:`Turn ${i.turn??"?"}`};Nu(e.nodes,i.agent_name,o),l&&oo(e.nodes,i.agent_name,l,o),Fe(e.nodes,i.agent_name)},agent_message:(e,n)=>{const i=n,l=ut(e.nodes,i.agent_name);l.latest_message=i.content,Fe(e.nodes,i.agent_name)},script_started:(e,n)=>{const i=n,l=ut(e.nodes,i.agent_name);l.status="running",Fe(e.nodes,i.agent_name)},script_completed:(e,n)=>{const i=n,l=ut(e.nodes,i.agent_name);l.status="completed",e.agentsCompleted++,l.elapsed=i.elapsed,l.stdout=i.stdout,l.stderr=i.stderr,l.exit_code=i.exit_code,Fe(e.nodes,i.agent_name)},script_failed:(e,n)=>{const i=n,l=ut(e.nodes,i.agent_name);l.status="failed",l.elapsed=i.elapsed,l.error_type=i.error_type,l.error_message=i.message,Fe(e.nodes,i.agent_name)},gate_presented:(e,n)=>{const i=n,l=ut(e.nodes,i.agent_name);l.status="waiting",l.options=i.options,l.option_details=i.option_details,l.prompt=i.prompt,Fe(e.nodes,i.agent_name)},gate_resolved:(e,n)=>{const i=n,l=ut(e.nodes,i.agent_name);l.status="completed",e.agentsCompleted++,l.selected_option=i.selected_option,l.route=i.route,l.additional_input=i.additional_input,Fe(e.nodes,i.agent_name)},route_taken:(e,n)=>{const i=n;e.highlightedEdges=[...e.highlightedEdges.filter(l=>!(l.from===i.from_agent&&l.to===i.to_agent)),{from:i.from_agent,to:i.to_agent,state:"taken"}]},parallel_started:(e,n)=>{const i=n,l=ut(e.nodes,i.group_name,"parallel_group");l.status="running",e.groupProgress[i.group_name]&&(e.groupProgress[i.group_name].total=i.agents.length,e.groupProgress[i.group_name].completed=0,e.groupProgress[i.group_name].failed=0),Fe(e.nodes,i.group_name)},parallel_agent_completed:(e,n)=>{const i=n;e.groupProgress[i.group_name]&&e.groupProgress[i.group_name].completed++;const l=ut(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,i.cost_usd&&(e.totalCost+=i.cost_usd),i.tokens&&(e.totalTokens+=i.tokens),Fe(e.nodes,i.agent_name),Fe(e.nodes,i.group_name)},parallel_agent_failed:(e,n)=>{const i=n;e.groupProgress[i.group_name]&&e.groupProgress[i.group_name].failed++;const l=ut(e.nodes,i.agent_name);l.status="failed",l.elapsed=i.elapsed,l.error_type=i.error_type,l.error_message=i.message,Fe(e.nodes,i.agent_name),Fe(e.nodes,i.group_name)},parallel_completed:(e,n)=>{const i=n;e.agentsCompleted++;const l=ut(e.nodes,i.group_name,"parallel_group");l.status=i.failure_count===0?"completed":"failed",Fe(e.nodes,i.group_name)},for_each_started:(e,n)=>{const i=n,l=ut(e.nodes,i.group_name,"for_each_group");l.status="running",l.for_each_items=[],e.groupProgress[i.group_name]&&(e.groupProgress[i.group_name].total=i.item_count,e.groupProgress[i.group_name].completed=0,e.groupProgress[i.group_name].failed=0),Fe(e.nodes,i.group_name)},for_each_item_started:(e,n)=>{const i=n,l=ut(e.nodes,i.group_name,"for_each_group");l.for_each_items||(l.for_each_items=[]),l.for_each_items.push({key:i.item_key??String(i.index),index:i.index,status:"running",activity:[]}),Fe(e.nodes,i.group_name)},for_each_item_completed:(e,n)=>{const i=n;e.groupProgress[i.group_name]&&e.groupProgress[i.group_name].completed++;const l=ut(e.nodes,i.group_name,"for_each_group");if(l.for_each_items){const o=i.item_key??String(i.index),s=l.for_each_items.find(u=>u.key===o);s&&(s.status="completed",s.elapsed=i.elapsed,s.tokens=i.tokens,s.cost_usd=i.cost_usd,s.output=i.output)}Fe(e.nodes,i.group_name)},for_each_item_failed:(e,n)=>{const i=n;e.groupProgress[i.group_name]&&e.groupProgress[i.group_name].failed++;const l=ut(e.nodes,i.group_name,"for_each_group");if(l.for_each_items){const o=i.item_key??String(i.index),s=l.for_each_items.find(u=>u.key===o);s&&(s.status="failed",s.elapsed=i.elapsed,s.error_type=i.error_type,s.error_message=i.message)}Fe(e.nodes,i.group_name)},for_each_completed:(e,n)=>{const i=n;e.agentsCompleted++;const l=ut(e.nodes,i.group_name,"for_each_group");l.status=(i.failure_count??0)===0?"completed":"failed",l.elapsed=i.elapsed,l.success_count=i.success_count,l.failure_count=i.failure_count,Fe(e.nodes,i.group_name)},workflow_completed:(e,n)=>{const i=n;e.workflowStatus="completed",e.workflowOutput=i.output??null,e.nodes.$end&&(e.nodes.$end.status="completed",Fe(e.nodes,"$end")),e.nodes.$start&&(e.nodes.$start.status="completed",Fe(e.nodes,"$start")),e.highlightedEdges=[]},workflow_failed:(e,n)=>{const i=n;e.workflowStatus="failed",i.agent_name&&e.nodes[i.agent_name]&&(e.nodes[i.agent_name].status="failed",Fe(e.nodes,i.agent_name)),e.workflowFailure={error_type:i.error_type,message:i.message},e.nodes.$start&&(e.nodes.$start.status="completed",Fe(e.nodes,"$start")),e.highlightedEdges=[]}};function Tx(e){var l;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 ${qu(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 ${qu(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 ${qu(i.elapsed)}`:""}`};case"workflow_failed":return{timestamp:n,level:"error",source:"workflow",message:`Workflow failed: ${i.message||i.error_type||"unknown error"}`};default:return null}}function qu(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 Mx(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:so(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?so(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?so(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:so(String(i.content||""),500)};case"agent_completed":return{timestamp:n,source:String(i.agent_name),type:"turn",message:`Completed${i.elapsed!=null?` in ${qu(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?so(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 so(e,n){return e.length<=n?e:e.slice(0,n)+"…"}function _N(){const e=Ee(n=>n.workflowName);return E.jsxs("header",{className:"flex items-center justify-between px-4 py-2 bg-[var(--surface)] border-b border-[var(--border)] flex-shrink-0",children:[E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx(D1,{className:"w-4 h-4 text-[var(--running)]"}),E.jsx("h1",{className:"text-sm font-semibold text-[var(--text)]",children:"Conductor"}),e&&E.jsxs("span",{className:"text-sm text-[var(--text-muted)] font-normal",children:["— ",e]})]}),E.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Dashboard v1.0"})]})}function H1(e){var n,i,l="";if(typeof e=="string"||typeof e=="number")l+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(n=0;n{const n=CN(e),{conflictingClassGroups:i,conflictingClassGroupModifiers:l}=e;return{getClassGroupId:u=>{const f=u.split(Qp);return f[0]===""&&f.length!==1&&f.shift(),B1(f,n)||kN(u)},getConflictingClassGroupIds:(u,f)=>{const d=i[u]||[];return f&&l[u]?[...d,...l[u]]:d}}},B1=(e,n)=>{var u;if(e.length===0)return n.classGroupId;const i=e[0],l=n.nextPart.get(i),o=l?B1(e.slice(1),l):void 0;if(o)return o;if(n.validators.length===0)return;const s=e.join(Qp);return(u=n.validators.find(({validator:f})=>f(s)))==null?void 0:u.classGroupId},jx=/^\[(.+)\]$/,kN=e=>{if(jx.test(e)){const n=jx.exec(e)[1],i=n==null?void 0:n.substring(0,n.indexOf(":"));if(i)return"arbitrary.."+i}},CN=e=>{const{theme:n,prefix:i}=e,l={nextPart:new Map,validators:[]};return AN(Object.entries(e.classGroups),i).forEach(([s,u])=>{bp(u,l,s,n)}),l},bp=(e,n,i,l)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?n:Ox(n,o);s.classGroupId=i;return}if(typeof o=="function"){if(zN(o)){bp(o(l),n,i,l);return}n.validators.push({validator:o,classGroupId:i});return}Object.entries(o).forEach(([s,u])=>{bp(u,Ox(n,s),i,l)})})},Ox=(e,n)=>{let i=e;return n.split(Qp).forEach(l=>{i.nextPart.has(l)||i.nextPart.set(l,{nextPart:new Map,validators:[]}),i=i.nextPart.get(l)}),i},zN=e=>e.isThemeGetter,AN=(e,n)=>n?e.map(([i,l])=>{const o=l.map(s=>typeof s=="string"?n+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([u,f])=>[n+u,f])):s);return[i,o]}):e,TN=e=>{if(e<1)return{get:()=>{},set:()=>{}};let n=0,i=new Map,l=new Map;const o=(s,u)=>{i.set(s,u),n++,n>e&&(n=0,l=i,i=new Map)};return{get(s){let u=i.get(s);if(u!==void 0)return u;if((u=l.get(s))!==void 0)return o(s,u),u},set(s,u){i.has(s)?i.set(s,u):o(s,u)}}},q1="!",MN=e=>{const{separator:n,experimentalParseClassName:i}=e,l=n.length===1,o=n[0],s=n.length,u=f=>{const d=[];let h=0,m=0,p;for(let S=0;Sm?p-m:void 0;return{modifiers:d,hasImportantModifier:v,baseClassName:b,maybePostfixModifierPosition:C}};return i?f=>i({className:f,parseClassName:u}):u},jN=e=>{if(e.length<=1)return e;const n=[];let i=[];return e.forEach(l=>{l[0]==="["?(n.push(...i.sort(),l),i=[]):i.push(l)}),n.push(...i.sort()),n},ON=e=>({cache:TN(e.cacheSize),parseClassName:MN(e),...NN(e)}),DN=/\s+/,RN=(e,n)=>{const{parseClassName:i,getClassGroupId:l,getConflictingClassGroupIds:o}=n,s=[],u=e.trim().split(DN);let f="";for(let d=u.length-1;d>=0;d-=1){const h=u[d],{modifiers:m,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:v}=i(h);let b=!!v,C=l(b?y.substring(0,v):y);if(!C){if(!b){f=h+(f.length>0?" "+f:f);continue}if(C=l(y),!C){f=h+(f.length>0?" "+f:f);continue}b=!1}const S=jN(m).join(":"),_=p?S+q1:S,z=_+C;if(s.includes(z))continue;s.push(z);const w=o(C,b);for(let T=0;T0?" "+f:f)}return f};function LN(){let e=0,n,i,l="";for(;e{if(typeof e=="string")return e;let n,i="";for(let l=0;lp(m),e());return i=ON(h),l=i.cache.get,o=i.cache.set,s=f,f(d)}function f(d){const h=l(d);if(h)return h;const m=RN(d,i);return o(d,m),m}return function(){return s(LN.apply(null,arguments))}}const st=e=>{const n=i=>i[e]||[];return n.isThemeGetter=!0,n},I1=/^\[(?:([a-z-]+):)?(.+)\]$/i,BN=/^\d+\/\d+$/,qN=new Set(["px","full","screen"]),UN=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,IN=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,VN=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,GN=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,YN=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Nr=e=>Pl(e)||qN.has(e)||BN.test(e),si=e=>sa(e,"length",JN),Pl=e=>!!e&&!Number.isNaN(Number(e)),Pd=e=>sa(e,"number",Pl),uo=e=>!!e&&Number.isInteger(Number(e)),$N=e=>e.endsWith("%")&&Pl(e.slice(0,-1)),Oe=e=>I1.test(e),ui=e=>UN.test(e),XN=new Set(["length","size","percentage"]),PN=e=>sa(e,XN,V1),FN=e=>sa(e,"position",V1),QN=new Set(["image","url"]),ZN=e=>sa(e,QN,ek),KN=e=>sa(e,"",WN),co=()=>!0,sa=(e,n,i)=>{const l=I1.exec(e);return l?l[1]?typeof n=="string"?l[1]===n:n.has(l[1]):i(l[2]):!1},JN=e=>IN.test(e)&&!VN.test(e),V1=()=>!1,WN=e=>GN.test(e),ek=e=>YN.test(e),tk=()=>{const e=st("colors"),n=st("spacing"),i=st("blur"),l=st("brightness"),o=st("borderColor"),s=st("borderRadius"),u=st("borderSpacing"),f=st("borderWidth"),d=st("contrast"),h=st("grayscale"),m=st("hueRotate"),p=st("invert"),y=st("gap"),v=st("gradientColorStops"),b=st("gradientColorStopPositions"),C=st("inset"),S=st("margin"),_=st("opacity"),z=st("padding"),w=st("saturate"),T=st("scale"),U=st("sepia"),A=st("skew"),L=st("space"),q=st("translate"),I=()=>["auto","contain","none"],$=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto",Oe,n],D=()=>[Oe,n],ee=()=>["",Nr,si],H=()=>["auto",Pl,Oe],G=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],j=()=>["solid","dashed","dotted","double","none"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>["start","end","center","between","around","evenly","stretch"],K=()=>["","0",Oe],M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>[Pl,Oe];return{cacheSize:500,separator:":",theme:{colors:[co],spacing:[Nr,si],blur:["none","",ui,Oe],brightness:B(),borderColor:[e],borderRadius:["none","","full",ui,Oe],borderSpacing:D(),borderWidth:ee(),contrast:B(),grayscale:K(),hueRotate:B(),invert:K(),gap:D(),gradientColorStops:[e],gradientColorStopPositions:[$N,si],inset:R(),margin:R(),opacity:B(),padding:D(),saturate:B(),scale:B(),sepia:K(),skew:B(),space:D(),translate:D()},classGroups:{aspect:[{aspect:["auto","square","video",Oe]}],container:["container"],columns:[{columns:[ui]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...G(),Oe]}],overflow:[{overflow:$()}],"overflow-x":[{"overflow-x":$()}],"overflow-y":[{"overflow-y":$()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[C]}],"inset-x":[{"inset-x":[C]}],"inset-y":[{"inset-y":[C]}],start:[{start:[C]}],end:[{end:[C]}],top:[{top:[C]}],right:[{right:[C]}],bottom:[{bottom:[C]}],left:[{left:[C]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",uo,Oe]}],basis:[{basis:R()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Oe]}],grow:[{grow:K()}],shrink:[{shrink:K()}],order:[{order:["first","last","none",uo,Oe]}],"grid-cols":[{"grid-cols":[co]}],"col-start-end":[{col:["auto",{span:["full",uo,Oe]},Oe]}],"col-start":[{"col-start":H()}],"col-end":[{"col-end":H()}],"grid-rows":[{"grid-rows":[co]}],"row-start-end":[{row:["auto",{span:[uo,Oe]},Oe]}],"row-start":[{"row-start":H()}],"row-end":[{"row-end":H()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Oe]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Oe]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",...Z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[z]}],px:[{px:[z]}],py:[{py:[z]}],ps:[{ps:[z]}],pe:[{pe:[z]}],pt:[{pt:[z]}],pr:[{pr:[z]}],pb:[{pb:[z]}],pl:[{pl:[z]}],m:[{m:[S]}],mx:[{mx:[S]}],my:[{my:[S]}],ms:[{ms:[S]}],me:[{me:[S]}],mt:[{mt:[S]}],mr:[{mr:[S]}],mb:[{mb:[S]}],ml:[{ml:[S]}],"space-x":[{"space-x":[L]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[L]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Oe,n]}],"min-w":[{"min-w":[Oe,n,"min","max","fit"]}],"max-w":[{"max-w":[Oe,n,"none","full","min","max","fit","prose",{screen:[ui]},ui]}],h:[{h:[Oe,n,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Oe,n,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Oe,n,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Oe,n,"auto","min","max","fit"]}],"font-size":[{text:["base",ui,si]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Pd]}],"font-family":[{font:[co]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Oe]}],"line-clamp":[{"line-clamp":["none",Pl,Pd]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Nr,Oe]}],"list-image":[{"list-image":["none",Oe]}],"list-style-type":[{list:["none","disc","decimal",Oe]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...j(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Nr,si]}],"underline-offset":[{"underline-offset":["auto",Nr,Oe]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Oe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Oe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...G(),FN]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",PN]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},ZN]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[f]}],"border-w-x":[{"border-x":[f]}],"border-w-y":[{"border-y":[f]}],"border-w-s":[{"border-s":[f]}],"border-w-e":[{"border-e":[f]}],"border-w-t":[{"border-t":[f]}],"border-w-r":[{"border-r":[f]}],"border-w-b":[{"border-b":[f]}],"border-w-l":[{"border-l":[f]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...j(),"hidden"]}],"divide-x":[{"divide-x":[f]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[f]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:j()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...j()]}],"outline-offset":[{"outline-offset":[Nr,Oe]}],"outline-w":[{outline:[Nr,si]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[Nr,si]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ui,KN]}],"shadow-color":[{shadow:[co]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...Y(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Y()}],filter:[{filter:["","none"]}],blur:[{blur:[i]}],brightness:[{brightness:[l]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",ui,Oe]}],grayscale:[{grayscale:[h]}],"hue-rotate":[{"hue-rotate":[m]}],invert:[{invert:[p]}],saturate:[{saturate:[w]}],sepia:[{sepia:[U]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[i]}],"backdrop-brightness":[{"backdrop-brightness":[l]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"backdrop-grayscale":[{"backdrop-grayscale":[h]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[m]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[U]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[u]}],"border-spacing-x":[{"border-spacing-x":[u]}],"border-spacing-y":[{"border-spacing-y":[u]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Oe]}],duration:[{duration:B()}],ease:[{ease:["linear","in","out","in-out",Oe]}],delay:[{delay:B()}],animate:[{animate:["none","spin","ping","pulse","bounce",Oe]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[T]}],"scale-x":[{"scale-x":[T]}],"scale-y":[{"scale-y":[T]}],rotate:[{rotate:[uo,Oe]}],"translate-x":[{"translate-x":[q]}],"translate-y":[{"translate-y":[q]}],"skew-x":[{"skew-x":[A]}],"skew-y":[{"skew-y":[A]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Oe]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Oe]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Oe]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Nr,si,Pd]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},nk=HN(tk);function Rt(...e){return nk(EN(e))}function Wl(e){if(e==null)return"—";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 G1(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function wp(e){return e==null?"—":`$${e.toFixed(4)}`}function Eo(e){return e==null?"—":e.toLocaleString()}function rk(){const e=Ee(s=>s.workflowStatus),n=Ee(s=>s.workflowStartTime),[i,l]=X.useState("—"),o=X.useRef(null);return X.useEffect(()=>{if(e==="running"&&n!=null){const s=()=>{const u=Date.now()/1e3-n;l(Wl(u))};return s(),o.current=setInterval(s,500),()=>{o.current&&clearInterval(o.current)}}else(e==="completed"||e==="failed")&&o.current&&(clearInterval(o.current),o.current=null)},[e,n]),i}function ik(){const e=Ee(p=>p.workflowStatus),n=Ee(p=>p.agentsCompleted),i=Ee(p=>p.agentsTotal),l=Ee(p=>p.totalCost),o=Ee(p=>p.totalTokens),s=Ee(p=>p.wsStatus),u=Ee(p=>p.workflowFailure),f=rk(),d=(()=>{switch(e){case"pending":return"Waiting for workflow…";case"running":return"Running";case"completed":return"Completed";case"failed":{if(!u)return"Failed";const p=u.error_type||"";return p==="MaxIterationsError"?"Failed: exceeded maximum iterations":p==="TimeoutError"?"Failed: workflow timed out":u.message?`Failed: ${u.message}`:`Failed: ${p}`}}})(),h={pending:"bg-[var(--pending)]",running:"bg-[var(--running)] animate-pulse",completed:"bg-[var(--completed)]",failed:"bg-[var(--failed)]"}[e],m=(()=>{switch(s){case"connected":return E.jsxs("span",{className:"flex items-center gap-1 text-[var(--completed)]",children:[E.jsx(xN,{className:"w-3 h-3"}),E.jsx("span",{children:"Connected"})]});case"disconnected":return E.jsxs("span",{className:"flex items-center gap-1 text-[var(--failed)]",children:[E.jsx(yN,{className:"w-3 h-3"}),E.jsx("span",{children:"Disconnected"})]});case"reconnecting":return E.jsxs("span",{className:"flex items-center gap-1 text-[var(--waiting)]",children:[E.jsx(To,{className:"w-3 h-3 animate-spin"}),E.jsx("span",{children:"Reconnecting…"})]});case"connecting":return E.jsxs("span",{className:"flex items-center gap-1 text-[var(--text-muted)]",children:[E.jsx(To,{className:"w-3 h-3 animate-spin"}),E.jsx("span",{children:"Connecting…"})]})}})();return E.jsxs("footer",{className:"flex items-center gap-4 px-4 py-1.5 bg-[var(--surface)] border-t border-[var(--border)] text-xs flex-shrink-0",children:[E.jsx("span",{className:Rt("w-2 h-2 rounded-full flex-shrink-0",h)}),E.jsx("span",{className:"text-[var(--text)]",children:d}),i>0&&E.jsxs("span",{className:"text-[var(--text-muted)]",children:[n,"/",i," agents"]}),e!=="pending"&&E.jsx("span",{className:"text-[var(--text-muted)] font-mono",children:f}),o>0&&E.jsxs("span",{className:"flex items-center gap-1 text-[var(--text-muted)]",title:"Total tokens used",children:[E.jsx(sN,{className:"w-3 h-3"}),E.jsx("span",{className:"font-mono",children:o.toLocaleString()})]}),l>0&&E.jsxs("span",{className:"flex items-center gap-1 text-[var(--text-muted)]",title:"Total cost",children:[E.jsx(lN,{className:"w-3 h-3"}),E.jsxs("span",{className:"font-mono",children:["$",l.toFixed(4)]})]}),E.jsx("span",{className:"flex-1"}),m]})}const cc=X.createContext(null);cc.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"},Zp=10,Vi=X.useLayoutEffect,Dx=P2.useId,lk=typeof Dx=="function"?Dx:()=>null;let ak=0;function Kp(e=null){const n=lk(),i=X.useRef(e||n||null);return i.current===null&&(i.current=""+ak++),e??i.current}function Y1({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:b="div",...C}){const S=X.useContext(cc);if(S===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:_,expandPanel:z,getPanelSize:w,getPanelStyle:T,groupId:U,isPanelCollapsed:A,reevaluatePanelConstraints:L,registerPanel:q,resizePanel:I,unregisterPanel:$}=S,R=Kp(u),D=X.useRef({callbacks:{onCollapse:h,onExpand:m,onResize:p},constraints:{collapsedSize:i,collapsible:l,defaultSize:o,maxSize:f,minSize:d},id:R,idIsFromProps:u!==void 0,order:y});X.useRef({didLogMissingDefaultSizeWarning:!1}),Vi(()=>{const{callbacks:H,constraints:G}=D.current,j={...G};D.current.id=R,D.current.idIsFromProps=u!==void 0,D.current.order=y,H.onCollapse=h,H.onExpand=m,H.onResize=p,G.collapsedSize=i,G.collapsible=l,G.defaultSize=o,G.maxSize=f,G.minSize=d,(j.collapsedSize!==G.collapsedSize||j.collapsible!==G.collapsible||j.maxSize!==G.maxSize||j.minSize!==G.minSize)&&L(D.current,j)}),Vi(()=>{const H=D.current;return q(H),()=>{$(H)}},[y,R,q,$]),X.useImperativeHandle(s,()=>({collapse:()=>{_(D.current)},expand:H=>{z(D.current,H)},getId(){return R},getSize(){return w(D.current)},isCollapsed(){return A(D.current)},isExpanded(){return!A(D.current)},resize:H=>{I(D.current,H)}}),[_,z,w,A,R,I]);const ee=T(D.current,o);return X.createElement(b,{...C,children:e,className:n,id:R,style:{...ee,...v},[yt.groupId]:U,[yt.panel]:"",[yt.panelCollapsible]:l||void 0,[yt.panelId]:R,[yt.panelSize]:parseFloat(""+ee.flexGrow).toFixed(1)})}const xo=X.forwardRef((e,n)=>X.createElement(Y1,{...e,forwardedRef:n}));Y1.displayName="Panel";xo.displayName="forwardRef(Panel)";let Sp=null,Uu=-1,hi=null;function ok(e,n){if(n){const i=(n&Q1)!==0,l=(n&Z1)!==0,o=(n&K1)!==0,s=(n&J1)!==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 sk(){hi!==null&&(document.head.removeChild(hi),Sp=null,hi=null,Uu=-1)}function Fd(e,n){var i,l;const o=ok(e,n);if(Sp!==o){if(Sp=o,hi===null&&(hi=document.createElement("style"),document.head.appendChild(hi)),Uu>=0){var s;(s=hi.sheet)===null||s===void 0||s.removeRule(Uu)}Uu=(i=(l=hi.sheet)===null||l===void 0?void 0:l.insertRule(`*{cursor: ${o} !important;}`))!==null&&i!==void 0?i:-1}}function $1(e){return e.type==="keydown"}function X1(e){return e.type.startsWith("pointer")}function P1(e){return e.type.startsWith("mouse")}function fc(e){if(X1(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(P1(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function uk(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function ck(e,n,i){return e.xn.x&&e.yn.y}function fk(e,n){if(e===n)throw new Error("Cannot compare node with itself");const i={a:Hx(e),b:Hx(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:Lx(Rx(i.a)),b:Lx(Rx(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 dk=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function hk(e){var n;const i=getComputedStyle((n=F1(e))!==null&&n!==void 0?n:e).display;return i==="flex"||i==="inline-flex"}function pk(e){const n=getComputedStyle(e);return!!(n.position==="fixed"||n.zIndex!=="auto"&&(n.position!=="static"||hk(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"||dk.test(n.willChange)||n.webkitOverflowScrolling==="touch")}function Rx(e){let n=e.length;for(;n--;){const i=e[n];if(Re(i,"Missing node"),pk(i))return i}return null}function Lx(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Hx(e){const n=[];for(;e;)n.push(e),e=F1(e);return n}function F1(e){const{parentNode:n}=e;return n&&n instanceof ShadowRoot?n.host:n}const Q1=1,Z1=2,K1=4,J1=8,mk=uk()==="coarse";let Vn=[],Fl=!1,qi=new Map,dc=new Map;const Mo=new Set;function gk(e,n,i,l,o){var s;const{ownerDocument:u}=n,f={direction:i,element:n,hitAreaMargins:l,setResizeHandlerState:o},d=(s=qi.get(u))!==null&&s!==void 0?s:0;return qi.set(u,d+1),Mo.add(f),Fu(),function(){var m;dc.delete(e),Mo.delete(f);const p=(m=qi.get(u))!==null&&m!==void 0?m:1;if(qi.set(u,p-1),Fu(),p===1&&qi.delete(u),Vn.includes(f)){const y=Vn.indexOf(f);y>=0&&Vn.splice(y,1),Wp(),o("up",!0,null)}}}function yk(e){const{target:n}=e,{x:i,y:l}=fc(e);Fl=!0,Jp({target:n,x:i,y:l}),Fu(),Vn.length>0&&(Qu("down",e),e.preventDefault(),W1(n)||e.stopImmediatePropagation())}function Qd(e){const{x:n,y:i}=fc(e);if(Fl&&e.buttons===0&&(Fl=!1,Qu("up",e)),!Fl){const{target:l}=e;Jp({target:l,x:n,y:i})}Qu("move",e),Wp(),Vn.length>0&&e.preventDefault()}function Zd(e){const{target:n}=e,{x:i,y:l}=fc(e);dc.clear(),Fl=!1,Vn.length>0&&(e.preventDefault(),W1(n)||e.stopImmediatePropagation()),Qu("up",e),Jp({target:n,x:i,y:l}),Wp(),Fu()}function W1(e){let n=e;for(;n;){if(n.hasAttribute(yt.resizeHandle))return!0;n=n.parentElement}return!1}function Jp({target:e,x:n,y:i}){Vn.splice(0);let l=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(l=e),Mo.forEach(o=>{const{element:s,hitAreaMargins:u}=o,f=s.getBoundingClientRect(),{bottom:d,left:h,right:m,top:p}=f,y=mk?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)&&fk(l,s)>0){let b=l,C=!1;for(;b&&!b.contains(s);){if(ck(b.getBoundingClientRect(),f)){C=!0;break}b=b.parentElement}if(C)return}Vn.push(o)}})}function Kd(e,n){dc.set(e,n)}function Wp(){let e=!1,n=!1;Vn.forEach(l=>{const{direction:o}=l;o==="horizontal"?e=!0:n=!0});let i=0;dc.forEach(l=>{i|=l}),e&&n?Fd("intersection",i):e?Fd("horizontal",i):n?Fd("vertical",i):sk()}let Jd=new AbortController;function Fu(){Jd.abort(),Jd=new AbortController;const e={capture:!0,signal:Jd.signal};Mo.size&&(Fl?(Vn.length>0&&qi.forEach((n,i)=>{const{body:l}=i;n>0&&(l.addEventListener("contextmenu",Zd,e),l.addEventListener("pointerleave",Qd,e),l.addEventListener("pointermove",Qd,e))}),window.addEventListener("pointerup",Zd,e),window.addEventListener("pointercancel",Zd,e)):qi.forEach((n,i)=>{const{body:l}=i;n>0&&(l.addEventListener("pointerdown",yk,e),l.addEventListener("pointermove",Qd,e))}))}function Qu(e,n){Mo.forEach(i=>{const{setResizeHandlerState:l}=i,o=Vn.includes(i);l(e,o,n)})}function xk(){const[e,n]=X.useState(0);return X.useCallback(()=>n(i=>i+1),[])}function Re(e,n){if(!e)throw console.error(n),Error(n)}function $i(e,n,i=Zp){return e.toFixed(i)===n.toFixed(i)?0:e>n?1:-1}function Cr(e,n,i=Zp){return $i(e,n,i)===0}function xn(e,n,i){return $i(e,n,i)===0}function vk(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:b,minSize:C=0}=y;if(b){const S=n[p];if(Re(S!=null,`Previous layout not found for panel index ${p}`),xn(S,C)){const _=S-v;$i(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}}{const p=e<0?1:-1;let y=e<0?d:f,v=0;for(;;){const C=n[y];Re(C!=null,`Previous layout not found for panel index ${y}`);const _=Gl({panelConstraints:i,panelIndex:y,size:100})-C;if(v+=_,y+=p,y<0||y>=i.length)break}const b=Math.min(Math.abs(e),Math.abs(v));e=e<0?0-b:b}{let y=e<0?f:d;for(;y>=0&&y=0))break;e<0?y--:y++}}if(vk(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,b=Gl({panelConstraints:i,panelIndex:p,size:v});if(u[p]=b,!xn(b,v)){let C=v-b,_=e<0?d:f;for(;_>=0&&_0?_--:_++}}}const m=u.reduce((p,y)=>y+p,0);return xn(m,100)?u:o}function bk({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:b=100,minSize:C=0}=v;y===f?(l=C,o=b):(s+=C,u+=b)});const d=Math.min(o,100-s),h=Math.max(l,100-u),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 ew(e,n,i=document){const o=jo(e,i).findIndex(s=>s.getAttribute(yt.resizeHandleId)===n);return o??null}function tw(e,n,i){const l=ew(e,n,i);return l!=null?[l,l+1]:[-1,-1]}function nw(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 hc(e,n=document){const i=n.querySelector(`[${yt.resizeHandleId}="${e}"]`);return i||null}function wk(e,n,i,l=document){var o,s,u,f;const d=hc(n,l),h=jo(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 Sk({committedValuesRef:e,eagerValuesRef:n,groupId:i,layout:l,panelDataArray:o,panelGroupElement:s,setLayout:u}){X.useRef({didWarnAboutMissingResizeHandle:!1}),Vi(()=>{if(!s)return;const f=jo(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]),X.useEffect(()=>{if(!s)return;const f=n.current;Re(f,"Eager values not found");const{panelDataArray:d}=f,h=nw(i,s);Re(h!=null,`No group found for id "${i}"`);const m=jo(i,s);Re(m,`No resize handles found for group id "${i}"`);const p=m.map(y=>{const v=y.getAttribute(yt.resizeHandleId);Re(v,"Resize handle element has no handle id attribute");const[b,C]=wk(i,v,d,s);if(b==null||C==null)return()=>{};const S=_=>{if(!_.defaultPrevented)switch(_.key){case"Enter":{_.preventDefault();const z=d.findIndex(w=>w.id===b);if(z>=0){const w=d[z];Re(w,`No panel data found for index ${z}`);const T=l[z],{collapsedSize:U=0,collapsible:A,minSize:L=0}=w.constraints;if(T!=null&&A){const q=vo({delta:xn(T,U)?L-U:U-T,initialLayout:l,panelConstraints:d.map(I=>I.constraints),pivotIndices:tw(i,v,s),prevLayout:l,trigger:"keyboard"});l!==q&&u(q)}}break}}};return y.addEventListener("keydown",S),()=>{y.removeEventListener("keydown",S)}});return()=>{p.forEach(y=>y())}},[s,e,n,i,l,o,u])}function Bx(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:b}=u;b&&b(l,p),m&&(y||v)&&(v&&(p==null||Cr(p,h))&&!Cr(l,h)&&v(),y&&(p==null||!Cr(p,h))&&Cr(l,h)&&y())}})}function ku(e,n){if(e.length!==n.length)return!1;for(let i=0;i{i!==null&&clearTimeout(i),i=setTimeout(()=>{e(...o)},n)}}function qx(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 iw(e){return`react-resizable-panels:${e}`}function lw(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 aw(e,n){try{const i=iw(e),l=n.getItem(i);if(l){const o=JSON.parse(l);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function zk(e,n,i){var l,o;const s=(l=aw(e,i))!==null&&l!==void 0?l:{},u=lw(n);return(o=s[u])!==null&&o!==void 0?o:null}function Ak(e,n,i,l,o){var s;const u=iw(e),f=lw(n),d=(s=aw(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 Ux({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(!xn(l,100)&&i.length>0)for(let s=0;s(qx(bo),bo.getItem(e)),setItem:(e,n)=>{qx(bo),bo.setItem(e,n)}},Ix={};function ow({autoSaveId:e=null,children:n,className:i="",direction:l,forwardedRef:o,id:s=null,onLayout:u=null,keyboardResizeBy:f=null,storage:d=bo,style:h,tagName:m="div",...p}){const y=Kp(s),v=X.useRef(null),[b,C]=X.useState(null),[S,_]=X.useState([]),z=xk(),w=X.useRef({}),T=X.useRef(new Map),U=X.useRef(0),A=X.useRef({autoSaveId:e,direction:l,dragState:b,id:y,keyboardResizeBy:f,onLayout:u,storage:d}),L=X.useRef({layout:S,panelDataArray:[],panelDataArrayChanged:!1});X.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),X.useImperativeHandle(o,()=>({getId:()=>A.current.id,getLayout:()=>{const{layout:N}=L.current;return N},setLayout:N=>{const{onLayout:V}=A.current,{layout:F,panelDataArray:J}=L.current,ne=Ux({layout:N,panelConstraints:J.map(re=>re.constraints)});Bx(F,ne)||(_(ne),L.current.layout=ne,V&&V(ne),Hl(J,ne,w.current))}}),[]),Vi(()=>{A.current.autoSaveId=e,A.current.direction=l,A.current.dragState=b,A.current.id=y,A.current.onLayout=u,A.current.storage=d}),Sk({committedValuesRef:A,eagerValuesRef:L,groupId:y,layout:S,panelDataArray:L.current.panelDataArray,setLayout:_,panelGroupElement:v.current}),X.useEffect(()=>{const{panelDataArray:N}=L.current;if(e){if(S.length===0||S.length!==N.length)return;let V=Ix[e];V==null&&(V=Ck(Ak,Tk),Ix[e]=V);const F=[...N],J=new Map(T.current);V(e,F,J,S,d)}},[e,S,d]),X.useEffect(()=>{});const q=X.useCallback(N=>{const{onLayout:V}=A.current,{layout:F,panelDataArray:J}=L.current;if(N.constraints.collapsible){const ne=J.map(xe=>xe.constraints),{collapsedSize:re=0,panelSize:se,pivotIndices:ge}=Hi(J,N,F);if(Re(se!=null,`Panel size not found for panel "${N.id}"`),!Cr(se,re)){T.current.set(N.id,se);const ye=Il(J,N)===J.length-1?se-re:re-se,he=vo({delta:ye,initialLayout:F,panelConstraints:ne,pivotIndices:ge,prevLayout:F,trigger:"imperative-api"});ku(F,he)||(_(he),L.current.layout=he,V&&V(he),Hl(J,he,w.current))}}},[]),I=X.useCallback((N,V)=>{const{onLayout:F}=A.current,{layout:J,panelDataArray:ne}=L.current;if(N.constraints.collapsible){const re=ne.map(Se=>Se.constraints),{collapsedSize:se=0,panelSize:ge=0,minSize:xe=0,pivotIndices:ye}=Hi(ne,N,J),he=V??xe;if(Cr(ge,se)){const Se=T.current.get(N.id),Me=Se!=null&&Se>=he?Se:he,lt=Il(ne,N)===ne.length-1?ge-Me:Me-ge,Je=vo({delta:lt,initialLayout:J,panelConstraints:re,pivotIndices:ye,prevLayout:J,trigger:"imperative-api"});ku(J,Je)||(_(Je),L.current.layout=Je,F&&F(Je),Hl(ne,Je,w.current))}}},[]),$=X.useCallback(N=>{const{layout:V,panelDataArray:F}=L.current,{panelSize:J}=Hi(F,N,V);return Re(J!=null,`Panel size not found for panel "${N.id}"`),J},[]),R=X.useCallback((N,V)=>{const{panelDataArray:F}=L.current,J=Il(F,N);return kk({defaultSize:V,dragState:b,layout:S,panelData:F,panelIndex:J})},[b,S]),D=X.useCallback(N=>{const{layout:V,panelDataArray:F}=L.current,{collapsedSize:J=0,collapsible:ne,panelSize:re}=Hi(F,N,V);return Re(re!=null,`Panel size not found for panel "${N.id}"`),ne===!0&&Cr(re,J)},[]),ee=X.useCallback(N=>{const{layout:V,panelDataArray:F}=L.current,{collapsedSize:J=0,collapsible:ne,panelSize:re}=Hi(F,N,V);return Re(re!=null,`Panel size not found for panel "${N.id}"`),!ne||$i(re,J)>0},[]),H=X.useCallback(N=>{const{panelDataArray:V}=L.current;V.push(N),V.sort((F,J)=>{const ne=F.order,re=J.order;return ne==null&&re==null?0:ne==null?-1:re==null?1:ne-re}),L.current.panelDataArrayChanged=!0,z()},[z]);Vi(()=>{if(L.current.panelDataArrayChanged){L.current.panelDataArrayChanged=!1;const{autoSaveId:N,onLayout:V,storage:F}=A.current,{layout:J,panelDataArray:ne}=L.current;let re=null;if(N){const ge=zk(N,ne,F);ge&&(T.current=new Map(Object.entries(ge.expandToSizes)),re=ge.layout)}re==null&&(re=Nk({panelDataArray:ne}));const se=Ux({layout:re,panelConstraints:ne.map(ge=>ge.constraints)});Bx(J,se)||(_(se),L.current.layout=se,V&&V(se),Hl(ne,se,w.current))}}),Vi(()=>{const N=L.current;return()=>{N.layout=[]}},[]);const G=X.useCallback(N=>{let V=!1;const F=v.current;return F&&window.getComputedStyle(F,null).getPropertyValue("direction")==="rtl"&&(V=!0),function(ne){ne.preventDefault();const re=v.current;if(!re)return()=>null;const{direction:se,dragState:ge,id:xe,keyboardResizeBy:ye,onLayout:he}=A.current,{layout:Se,panelDataArray:Me}=L.current,{initialLayout:Ce}=ge??{},lt=tw(xe,N,re);let Je=Ek(ne,N,se,ge,ye,re);const Tt=se==="horizontal";Tt&&V&&(Je=-Je);const Vt=Me.map(jn=>jn.constraints),Lt=vo({delta:Je,initialLayout:Ce??Se,panelConstraints:Vt,pivotIndices:lt,prevLayout:Se,trigger:$1(ne)?"keyboard":"mouse-or-touch"}),Sn=!ku(Se,Lt);(X1(ne)||P1(ne))&&U.current!=Je&&(U.current=Je,!Sn&&Je!==0?Tt?Kd(N,Je<0?Q1:Z1):Kd(N,Je<0?K1:J1):Kd(N,0)),Sn&&(_(Lt),L.current.layout=Lt,he&&he(Lt),Hl(Me,Lt,w.current))}},[]),j=X.useCallback((N,V)=>{const{onLayout:F}=A.current,{layout:J,panelDataArray:ne}=L.current,re=ne.map(Se=>Se.constraints),{panelSize:se,pivotIndices:ge}=Hi(ne,N,J);Re(se!=null,`Panel size not found for panel "${N.id}"`);const ye=Il(ne,N)===ne.length-1?se-V:V-se,he=vo({delta:ye,initialLayout:J,panelConstraints:re,pivotIndices:ge,prevLayout:J,trigger:"imperative-api"});ku(J,he)||(_(he),L.current.layout=he,F&&F(he),Hl(ne,he,w.current))},[]),Y=X.useCallback((N,V)=>{const{layout:F,panelDataArray:J}=L.current,{collapsedSize:ne=0,collapsible:re}=V,{collapsedSize:se=0,collapsible:ge,maxSize:xe=100,minSize:ye=0}=N.constraints,{panelSize:he}=Hi(J,N,F);he!=null&&(re&&ge&&Cr(he,ne)?Cr(ne,se)||j(N,se):hexe&&j(N,xe))},[j]),Z=X.useCallback((N,V)=>{const{direction:F}=A.current,{layout:J}=L.current;if(!v.current)return;const ne=hc(N,v.current);Re(ne,`Drag handle element not found for id "${N}"`);const re=rw(F,V);C({dragHandleId:N,dragHandleRect:ne.getBoundingClientRect(),initialCursorPosition:re,initialLayout:J})},[]),K=X.useCallback(()=>{C(null)},[]),M=X.useCallback(N=>{const{panelDataArray:V}=L.current,F=Il(V,N);F>=0&&(V.splice(F,1),delete w.current[N.id],L.current.panelDataArrayChanged=!0,z())},[z]),B=X.useMemo(()=>({collapsePanel:q,direction:l,dragState:b,expandPanel:I,getPanelSize:$,getPanelStyle:R,groupId:y,isPanelCollapsed:D,isPanelExpanded:ee,reevaluatePanelConstraints:Y,registerPanel:H,registerResizeHandle:G,resizePanel:j,startDragging:Z,stopDragging:K,unregisterPanel:M,panelGroupElement:v.current}),[q,b,l,I,$,R,y,D,ee,Y,H,G,j,Z,K,M]),P={display:"flex",flexDirection:l==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return X.createElement(cc.Provider,{value:B},X.createElement(m,{...p,children:n,className:i,id:s,ref:v,style:{...P,...h},[yt.group]:"",[yt.groupDirection]:l,[yt.groupId]:y}))}const _p=X.forwardRef((e,n)=>X.createElement(ow,{...e,forwardedRef:n}));ow.displayName="PanelGroup";_p.displayName="forwardRef(PanelGroup)";function Il(e,n){return e.findIndex(i=>i===n||i.id===n.id)}function Hi(e,n,i){const l=Il(e,n),s=l===e.length-1?[l-1,l]:[l,l+1],u=i[l];return{...n.constraints,panelSize:u,pivotIndices:s}}function Mk({disabled:e,handleId:n,resizeHandler:i,panelGroupElement:l}){X.useEffect(()=>{if(e||i==null||l==null)return;const o=hc(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(yt.groupId);Re(f,`No group element found for id "${f}"`);const d=jo(f,l),h=ew(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 Ep({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",...b}){var C,S;const _=X.useRef(null),z=X.useRef({onClick:u,onDragging:f,onPointerDown:h,onPointerUp:m});X.useEffect(()=>{z.current.onClick=u,z.current.onDragging=f,z.current.onPointerDown=h,z.current.onPointerUp=m});const w=X.useContext(cc);if(w===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:T,groupId:U,registerResizeHandle:A,startDragging:L,stopDragging:q,panelGroupElement:I}=w,$=Kp(o),[R,D]=X.useState("inactive"),[ee,H]=X.useState(!1),[G,j]=X.useState(null),Y=X.useRef({state:R});Vi(()=>{Y.current.state=R}),X.useEffect(()=>{if(i)j(null);else{const B=A($);j(()=>B)}},[i,$,A]);const Z=(C=l==null?void 0:l.coarse)!==null&&C!==void 0?C:15,K=(S=l==null?void 0:l.fine)!==null&&S!==void 0?S:5;X.useEffect(()=>{if(i||G==null)return;const B=_.current;Re(B,"Element ref not attached");let P=!1;return gk($,B,T,{coarse:Z,fine:K},(V,F,J)=>{if(!F){D("inactive");return}switch(V){case"down":{D("drag"),P=!1,Re(J,'Expected event to be defined for "down" action'),L($,J);const{onDragging:ne,onPointerDown:re}=z.current;ne==null||ne(!0),re==null||re();break}case"move":{const{state:ne}=Y.current;P=!0,ne!=="drag"&&D("hover"),Re(J,'Expected event to be defined for "move" action'),G(J);break}case"up":{D("hover"),q();const{onClick:ne,onDragging:re,onPointerUp:se}=z.current;re==null||re(!1),se==null||se(),P||ne==null||ne();break}}})},[Z,T,i,K,A,$,G,L,q]),Mk({disabled:i,handleId:$,resizeHandler:G,panelGroupElement:I});const M={touchAction:"none",userSelect:"none"};return X.createElement(v,{...b,children:e,className:n,id:o,onBlur:()=>{H(!1),s==null||s()},onFocus:()=>{H(!0),d==null||d()},ref:_,role:"separator",style:{...M,...p},tabIndex:y,[yt.groupDirection]:T,[yt.groupId]:U,[yt.resizeHandle]:"",[yt.resizeHandleActive]:R==="drag"?"pointer":ee?"keyboard":void 0,[yt.resizeHandleEnabled]:!i,[yt.resizeHandleId]:$,[yt.resizeHandleState]:R})}Ep.displayName="PanelResizeHandle";function At(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let i=0,l;i{}};function pc(){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}})}Iu.prototype=pc.prototype={constructor:Iu,on:function(e,n){var i=this._,l=Ok(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)),Gx.hasOwnProperty(n)?{space:Gx[n],local:e}:e}function Rk(e){return function(){var n=this.ownerDocument,i=this.namespaceURI;return i===Np&&n.documentElement.namespaceURI===Np?n.createElement(e):n.createElementNS(i,e)}}function Lk(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function sw(e){var n=mc(e);return(n.local?Lk:Rk)(n)}function Hk(){}function em(e){return e==null?Hk:function(){return this.querySelector(e)}}function Bk(e){typeof e!="function"&&(e=em(e));for(var n=this._groups,i=n.length,l=new Array(i),o=0;o=w&&(w=z+1);!(U=S[w])&&++w=0;)(u=l[o])&&(s&&u.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(u,s),s=u);return this}function uC(e){e||(e=cC);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 fC(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function dC(){return Array.from(this)}function hC(){for(var e=this._groups,n=0,i=e.length;n1?this.each((n==null?EC:typeof n=="function"?kC:NC)(e,n,i??"")):ea(this.node(),e)}function ea(e,n){return e.style.getPropertyValue(n)||hw(e).getComputedStyle(e,null).getPropertyValue(n)}function zC(e){return function(){delete this[e]}}function AC(e,n){return function(){this[e]=n}}function TC(e,n){return function(){var i=n.apply(this,arguments);i==null?delete this[e]:this[e]=i}}function MC(e,n){return arguments.length>1?this.each((n==null?zC:typeof n=="function"?TC:AC)(e,n)):this.node()[e]}function pw(e){return e.trim().split(/^|\s+/)}function tm(e){return e.classList||new mw(e)}function mw(e){this._node=e,this._names=pw(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 gw(e,n){for(var i=tm(e),l=-1,o=n.length;++l=0&&(i=n.slice(l+1),n=n.slice(0,l)),{type:n,name:i}})}function lz(e){return function(){var n=this.__on;if(n){for(var i=0,l=-1,o=n.length,s;i()=>e;function kp(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}})}kp.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function mz(e){return!e.ctrlKey&&!e.button}function gz(){return this.parentNode}function yz(e,n){return n??{x:e.x,y:e.y}}function xz(){return navigator.maxTouchPoints||"ontouchstart"in this}function Sw(){var e=mz,n=gz,i=yz,l=xz,o={},s=pc("start","drag","end"),u=0,f,d,h,m,p=0;function y(T){T.on("mousedown.drag",v).filter(l).on("touchstart.drag",S).on("touchmove.drag",_,pz).on("touchend.drag touchcancel.drag",z).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(T,U){if(!(m||!e.call(this,T,U))){var A=w(this,n.call(this,T,U),T,U,"mouse");A&&(vn(T.view).on("mousemove.drag",b,Oo).on("mouseup.drag",C,Oo),bw(T.view),Wd(T),h=!1,f=T.clientX,d=T.clientY,A("start",T))}}function b(T){if(Ql(T),!h){var U=T.clientX-f,A=T.clientY-d;h=U*U+A*A>p}o.mouse("drag",T)}function C(T){vn(T.view).on("mousemove.drag mouseup.drag",null),ww(T.view,h),Ql(T),o.mouse("end",T)}function S(T,U){if(e.call(this,T,U)){var A=T.changedTouches,L=n.call(this,T,U),q=A.length,I,$;for(I=0;I>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):i===8?zu(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):i===4?zu(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=bz.exec(e))?new ln(n[1],n[2],n[3],1):(n=wz.exec(e))?new ln(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=Sz.exec(e))?zu(n[1],n[2],n[3],n[4]):(n=_z.exec(e))?zu(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=Ez.exec(e))?Zx(n[1],n[2]/100,n[3]/100,1):(n=Nz.exec(e))?Zx(n[1],n[2]/100,n[3]/100,n[4]):Yx.hasOwnProperty(e)?Px(Yx[e]):e==="transparent"?new ln(NaN,NaN,NaN,0):null}function Px(e){return new ln(e>>16&255,e>>8&255,e&255,1)}function zu(e,n,i,l){return l<=0&&(e=n=i=NaN),new ln(e,n,i,l)}function zz(e){return e instanceof Po||(e=Xi(e)),e?(e=e.rgb(),new ln(e.r,e.g,e.b,e.opacity)):new ln}function Cp(e,n,i,l){return arguments.length===1?zz(e):new ln(e,n,i,l??1)}function ln(e,n,i,l){this.r=+e,this.g=+n,this.b=+i,this.opacity=+l}nm(ln,Cp,_w(Po,{brighter(e){return e=e==null?Ku:Math.pow(Ku,e),new ln(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Do:Math.pow(Do,e),new ln(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ln(Gi(this.r),Gi(this.g),Gi(this.b),Ju(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:Fx,formatHex:Fx,formatHex8:Az,formatRgb:Qx,toString:Qx}));function Fx(){return`#${Ui(this.r)}${Ui(this.g)}${Ui(this.b)}`}function Az(){return`#${Ui(this.r)}${Ui(this.g)}${Ui(this.b)}${Ui((isNaN(this.opacity)?1:this.opacity)*255)}`}function Qx(){const e=Ju(this.opacity);return`${e===1?"rgb(":"rgba("}${Gi(this.r)}, ${Gi(this.g)}, ${Gi(this.b)}${e===1?")":`, ${e})`}`}function Ju(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Gi(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ui(e){return e=Gi(e),(e<16?"0":"")+e.toString(16)}function Zx(e,n,i,l){return l<=0?e=n=i=NaN:i<=0||i>=1?e=n=NaN:n<=0&&(e=NaN),new qn(e,n,i,l)}function Ew(e){if(e instanceof qn)return new qn(e.h,e.s,e.l,e.opacity);if(e instanceof Po||(e=Xi(e)),!e)return new qn;if(e instanceof qn)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 qn(u,f,d,e.opacity)}function Tz(e,n,i,l){return arguments.length===1?Ew(e):new qn(e,n,i,l??1)}function qn(e,n,i,l){this.h=+e,this.s=+n,this.l=+i,this.opacity=+l}nm(qn,Tz,_w(Po,{brighter(e){return e=e==null?Ku:Math.pow(Ku,e),new qn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Do:Math.pow(Do,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,i=this.l,l=i+(i<.5?i:1-i)*n,o=2*i-l;return new ln(eh(e>=240?e-240:e+120,o,l),eh(e,o,l),eh(e<120?e+240:e-120,o,l),this.opacity)},clamp(){return new qn(Kx(this.h),Au(this.s),Au(this.l),Ju(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=Ju(this.opacity);return`${e===1?"hsl(":"hsla("}${Kx(this.h)}, ${Au(this.s)*100}%, ${Au(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Kx(e){return e=(e||0)%360,e<0?e+360:e}function Au(e){return Math.max(0,Math.min(1,e||0))}function eh(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 rm=e=>()=>e;function Mz(e,n){return function(i){return e+i*n}}function jz(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 Oz(e){return(e=+e)==1?Nw:function(n,i){return i-n?jz(n,i,e):rm(isNaN(n)?i:n)}}function Nw(e,n){var i=n-e;return i?Mz(e,i):rm(isNaN(e)?n:e)}const Wu=(function e(n){var i=Oz(n);function l(o,s){var u=i((o=Cp(o)).r,(s=Cp(s)).r),f=i(o.g,s.g),d=i(o.b,s.b),h=Nw(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 Dz(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:Jn(l,o)})),i=th.lastIndex;return i180?m+=360:m-h>180&&(h+=360),y.push({i:p.push(o(p)+"rotate(",null,l)-2,x:Jn(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:Jn(h,m)}):m&&p.push(o(p)+"skewX("+m+l)}function d(h,m,p,y,v,b){if(h!==p||m!==y){var C=v.push(o(v)+"scale(",null,",",null,")");b.push({i:C-4,x:Jn(h,p)},{i:C-2,x:Jn(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 b=-1,C=y.length,S;++b=0&&e._call.call(void 0,n),e=e._next;--ta}function ev(){Pi=(tc=Lo.now())+gc,ta=wo=0;try{Qz()}finally{ta=0,Kz(),Pi=0}}function Zz(){var e=Lo.now(),n=e-tc;n>Aw&&(gc-=n,tc=e)}function Kz(){for(var e,n=ec,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:ec=i);So=e,Tp(l)}function Tp(e){if(!ta){wo&&(wo=clearTimeout(wo));var n=e-Pi;n>24?(e<1/0&&(wo=setTimeout(ev,e-Lo.now()-gc)),fo&&(fo=clearInterval(fo))):(fo||(tc=Lo.now(),fo=setInterval(Zz,Aw)),ta=1,Tw(ev))}}function tv(e,n,i){var l=new nc;return n=n==null?0:+n,l.restart(o=>{l.stop(),e(o+n)},n,i),l}var Jz=pc("start","end","cancel","interrupt"),Wz=[],jw=0,nv=1,Mp=2,Gu=3,rv=4,jp=5,Yu=6;function yc(e,n,i,l,o,s){var u=e.__transition;if(!u)e.__transition={};else if(i in u)return;eA(e,i,{name:n,index:l,group:o,on:Jz,tween:Wz,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:jw})}function lm(e,n){var i=Yn(e,n);if(i.state>jw)throw new Error("too late; already scheduled");return i}function rr(e,n){var i=Yn(e,n);if(i.state>Gu)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 eA(e,n,i){var l=e.__transition,o;l[n]=i,i.timer=Mw(s,0,i.time);function s(h){i.state=nv,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!==nv)return d();for(m in l)if(v=l[m],v.name===i.name){if(v.state===Gu)return tv(u);v.state===rv?(v.state=Yu,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete l[m]):+mMp&&l.state=0&&(n=n.slice(0,i)),!n||n==="start"})}function TA(e,n,i){var l,o,s=AA(n)?lm:rr;return function(){var u=s(this,e),f=u.on;f!==l&&(o=(l=f).copy()).on(n,i),u.on=o}}function MA(e,n){var i=this._id;return arguments.length<2?Yn(this.node(),i).on.on(e):this.each(TA(i,e,n))}function jA(e){return function(){var n=this.parentNode;for(var i in this.__transition)if(+i!==e)return;n&&n.removeChild(this)}}function OA(){return this.on("end.remove",jA(this._id))}function DA(e){var n=this._name,i=this._id;typeof e!="function"&&(e=em(e));for(var l=this._groups,o=l.length,s=new Array(o),u=0;u()=>e;function lT(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 zr(e,n,i){this.k=e,this.x=n,this.y=i}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 xc=new zr(1,0,0);Lw.prototype=zr.prototype;function Lw(e){for(;!e.__zoom;)if(!(e=e.parentNode))return xc;return e.__zoom}function nh(e){e.stopImmediatePropagation()}function ho(e){e.preventDefault(),e.stopImmediatePropagation()}function aT(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function oT(){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 iv(){return this.__zoom||xc}function sT(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function uT(){return navigator.maxTouchPoints||"ontouchstart"in this}function cT(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 Hw(){var e=aT,n=oT,i=cT,l=sT,o=uT,s=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],f=250,d=Vu,h=pc("start","zoom","end"),m,p,y,v=500,b=150,C=0,S=10;function _(H){H.property("__zoom",iv).on("wheel.zoom",q,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",$).filter(o).on("touchstart.zoom",R).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",ee).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(H,G,j,Y){var Z=H.selection?H.selection():H;Z.property("__zoom",iv),H!==Z?U(H,G,j,Y):Z.interrupt().each(function(){A(this,arguments).event(Y).start().zoom(null,typeof G=="function"?G.apply(this,arguments):G).end()})},_.scaleBy=function(H,G,j,Y){_.scaleTo(H,function(){var Z=this.__zoom.k,K=typeof G=="function"?G.apply(this,arguments):G;return Z*K},j,Y)},_.scaleTo=function(H,G,j,Y){_.transform(H,function(){var Z=n.apply(this,arguments),K=this.__zoom,M=j==null?T(Z):typeof j=="function"?j.apply(this,arguments):j,B=K.invert(M),P=typeof G=="function"?G.apply(this,arguments):G;return i(w(z(K,P),M,B),Z,u)},j,Y)},_.translateBy=function(H,G,j,Y){_.transform(H,function(){return i(this.__zoom.translate(typeof G=="function"?G.apply(this,arguments):G,typeof j=="function"?j.apply(this,arguments):j),n.apply(this,arguments),u)},null,Y)},_.translateTo=function(H,G,j,Y,Z){_.transform(H,function(){var K=n.apply(this,arguments),M=this.__zoom,B=Y==null?T(K):typeof Y=="function"?Y.apply(this,arguments):Y;return i(xc.translate(B[0],B[1]).scale(M.k).translate(typeof G=="function"?-G.apply(this,arguments):-G,typeof j=="function"?-j.apply(this,arguments):-j),K,u)},Y,Z)};function z(H,G){return G=Math.max(s[0],Math.min(s[1],G)),G===H.k?H:new zr(G,H.x,H.y)}function w(H,G,j){var Y=G[0]-j[0]*H.k,Z=G[1]-j[1]*H.k;return Y===H.x&&Z===H.y?H:new zr(H.k,Y,Z)}function T(H){return[(+H[0][0]+ +H[1][0])/2,(+H[0][1]+ +H[1][1])/2]}function U(H,G,j,Y){H.on("start.zoom",function(){A(this,arguments).event(Y).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(Y).end()}).tween("zoom",function(){var Z=this,K=arguments,M=A(Z,K).event(Y),B=n.apply(Z,K),P=j==null?T(B):typeof j=="function"?j.apply(Z,K):j,N=Math.max(B[1][0]-B[0][0],B[1][1]-B[0][1]),V=Z.__zoom,F=typeof G=="function"?G.apply(Z,K):G,J=d(V.invert(P).concat(N/V.k),F.invert(P).concat(N/F.k));return function(ne){if(ne===1)ne=F;else{var re=J(ne),se=N/re[2];ne=new zr(se,P[0]-re[0]*se,P[1]-re[1]*se)}M.zoom(null,ne)}})}function A(H,G,j){return!j&&H.__zooming||new L(H,G)}function L(H,G){this.that=H,this.args=G,this.active=0,this.sourceEvent=null,this.extent=n.apply(H,G),this.taps=0}L.prototype={event:function(H){return H&&(this.sourceEvent=H),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(H,G){return this.mouse&&H!=="mouse"&&(this.mouse[1]=G.invert(this.mouse[0])),this.touch0&&H!=="touch"&&(this.touch0[1]=G.invert(this.touch0[0])),this.touch1&&H!=="touch"&&(this.touch1[1]=G.invert(this.touch1[0])),this.that.__zoom=G,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(H){var G=vn(this.that).datum();h.call(H,this.that,new lT(H,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:h}),G)}};function q(H,...G){if(!e.apply(this,arguments))return;var j=A(this,G).event(H),Y=this.__zoom,Z=Math.max(s[0],Math.min(s[1],Y.k*Math.pow(2,l.apply(this,arguments)))),K=Bn(H);if(j.wheel)(j.mouse[0][0]!==K[0]||j.mouse[0][1]!==K[1])&&(j.mouse[1]=Y.invert(j.mouse[0]=K)),clearTimeout(j.wheel);else{if(Y.k===Z)return;j.mouse=[K,Y.invert(K)],$u(this),j.start()}ho(H),j.wheel=setTimeout(M,b),j.zoom("mouse",i(w(z(Y,Z),j.mouse[0],j.mouse[1]),j.extent,u));function M(){j.wheel=null,j.end()}}function I(H,...G){if(y||!e.apply(this,arguments))return;var j=H.currentTarget,Y=A(this,G,!0).event(H),Z=vn(H.view).on("mousemove.zoom",P,!0).on("mouseup.zoom",N,!0),K=Bn(H,j),M=H.clientX,B=H.clientY;bw(H.view),nh(H),Y.mouse=[K,this.__zoom.invert(K)],$u(this),Y.start();function P(V){if(ho(V),!Y.moved){var F=V.clientX-M,J=V.clientY-B;Y.moved=F*F+J*J>C}Y.event(V).zoom("mouse",i(w(Y.that.__zoom,Y.mouse[0]=Bn(V,j),Y.mouse[1]),Y.extent,u))}function N(V){Z.on("mousemove.zoom mouseup.zoom",null),ww(V.view,Y.moved),ho(V),Y.event(V).end()}}function $(H,...G){if(e.apply(this,arguments)){var j=this.__zoom,Y=Bn(H.changedTouches?H.changedTouches[0]:H,this),Z=j.invert(Y),K=j.k*(H.shiftKey?.5:2),M=i(w(z(j,K),Y,Z),n.apply(this,G),u);ho(H),f>0?vn(this).transition().duration(f).call(U,M,Y,H):vn(this).call(_.transform,M,Y,H)}}function R(H,...G){if(e.apply(this,arguments)){var j=H.touches,Y=j.length,Z=A(this,G,H.changedTouches.length===Y).event(H),K,M,B,P;for(nh(H),M=0;M"[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."},Ho=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Bw=["Enter"," ","Escape"],qw={"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 na;(function(e){e.Strict="strict",e.Loose="loose"})(na||(na={}));var Yi;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Yi||(Yi={}));var Bo;(function(e){e.Partial="partial",e.Full="full"})(Bo||(Bo={}));const Uw={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 rc;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(rc||(rc={}));var be;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(be||(be={}));const lv={[be.Left]:be.Right,[be.Right]:be.Left,[be.Top]:be.Bottom,[be.Bottom]:be.Top};function Iw(e){return e===null?null:e?"valid":"invalid"}const Vw=e=>"id"in e&&"source"in e&&"target"in e,fT=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),om=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Fo=(e,n=[0,0])=>{const{width:i,height:l}=Mr(e),o=e.origin??n,s=i*o[0],u=l*o[1];return{x:e.position.x-s,y:e.position.y-u}},dT=(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):om(o)?o:n.nodeLookup.get(o.id));const f=u?ic(u,n.nodeOrigin):{x:0,y:0,x2:0,y2:0};return vc(l,f)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return bc(i)},Qo=(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=vc(i,ic(o)),l=!0)}),l?bc(i):{x:0,y:0,width:0,height:0}},sm=(e,n,[i,l,o]=[0,0,1],s=!1,u=!1)=>{const f={...Ko(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,b=m.height??h.height??h.initialHeight??null,C=qo(f,ia(h)),S=(v??0)*(b??0),_=s&&C>0;(!h.internals.handleBounds||_||C>=S||h.dragging)&&d.push(h)}return d},hT=(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 pT(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 mT({nodes:e,width:n,height:i,panZoom:l,minZoom:o,maxZoom:s},u){if(e.size===0)return Promise.resolve(!0);const f=pT(e,u),d=Qo(f),h=um(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 Gw({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,b=f.measured.height;v&&b&&(p=[[d,h],[d+v,h+b]])}else f&&la(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=la(p)?Fi(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 gT({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),b=!v&&y.parentId&&u.find(C=>C.id===y.parentId);(v||b)&&u.push(y)}const f=new Set(n.map(y=>y.id)),d=l.filter(y=>y.deletable!==!1),m=hT(u,d);for(const y of d)f.has(y.id)&&!m.find(b=>b.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 ra=(e,n=0,i=1)=>Math.min(Math.max(e,n),i),Fi=(e={x:0,y:0},n,i)=>({x:ra(e.x,n[0][0],n[1][0]-((i==null?void 0:i.width)??0)),y:ra(e.y,n[0][1],n[1][1]-((i==null?void 0:i.height)??0))});function Yw(e,n,i){const{width:l,height:o}=Mr(i),{x:s,y:u}=i.internals.positionAbsolute;return Fi(e,[[s,u],[s+l,u+o]],n)}const av=(e,n,i)=>ei?-ra(Math.abs(e-i),1,n)/n:0,$w=(e,n,i=15,l=40)=>{const o=av(e.x,l,n.width-l)*i,s=av(e.y,l,n.height-l)*i;return[o,s]},vc=(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)}),Op=({x:e,y:n,width:i,height:l})=>({x:e,y:n,x2:e+i,y2:n+l}),bc=({x:e,y:n,x2:i,y2:l})=>({x:e,y:n,width:i-e,height:l-n}),ia=(e,n=[0,0])=>{var o,s;const{x:i,y:l}=om(e)?e.internals.positionAbsolute:Fo(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}},ic=(e,n=[0,0])=>{var o,s;const{x:i,y:l}=om(e)?e.internals.positionAbsolute:Fo(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)}},Xw=(e,n)=>bc(vc(Op(e),Op(n))),qo=(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)},ov=e=>Un(e.width)&&Un(e.height)&&Un(e.x)&&Un(e.y),Un=e=>!isNaN(e)&&isFinite(e),yT=(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},[i,l,o],s=!1,u=[1,1])=>{const f={x:(e-i)/o,y:(n-l)/o};return s?Zo(f,u):f},lc=({x:e,y:n},[i,l,o])=>({x:e*o+i,y:n*o+l});function Bl(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 xT(e,n,i){if(typeof e=="string"||typeof e=="number"){const l=Bl(e,i),o=Bl(e,n);return{top:l,right:o,bottom:l,left:o,x:o*2,y:l*2}}if(typeof e=="object"){const l=Bl(e.top??e.y??0,i),o=Bl(e.bottom??e.y??0,i),s=Bl(e.left??e.x??0,n),u=Bl(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 vT(e,n,i,l,o,s){const{x:u,y:f}=lc(e,[n,i,l]),{x:d,y:h}=lc({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 um=(e,n,i,l,o,s)=>{const u=xT(s,n,i),f=(n-u.x)/e.width,d=(i-u.y)/e.height,h=Math.min(f,d),m=ra(h,l,o),p=e.x+e.width/2,y=e.y+e.height/2,v=n/2-p*m,b=i/2-y*m,C=vT(e,v,b,m,n,i),S={left:Math.min(C.left-u.left,0),top:Math.min(C.top-u.top,0),right:Math.min(C.right-u.right,0),bottom:Math.min(C.bottom-u.bottom,0)};return{x:v-S.left+S.right,y:b-S.top+S.bottom,zoom:m}},Uo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function la(e){return e!=null&&e!=="parent"}function Mr(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 Pw(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 Fw(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 sv(e,n){if(e.size!==n.size)return!1;for(const i of e)if(!n.has(i))return!1;return!0}function bT(){let e,n;return{promise:new Promise((l,o)=>{e=l,n=o}),resolve:e,reject:n}}function wT(e){return{...qw,...e||{}}}function ko(e,{snapGrid:n=[0,0],snapToGrid:i=!1,transform:l,containerBounds:o}){const{x:s,y:u}=In(e),f=Ko({x:s-((o==null?void 0:o.left)??0),y:u-((o==null?void 0:o.top)??0)},l),{x:d,y:h}=i?Zo(f,n):f;return{xSnapped:d,ySnapped:h,...f}}const cm=e=>({width:e.offsetWidth,height:e.offsetHeight}),Qw=e=>{var n;return((n=e==null?void 0:e.getRootNode)==null?void 0:n.call(e))||(window==null?void 0:window.document)},ST=["INPUT","SELECT","TEXTAREA"];function Zw(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:ST.includes(n.nodeName)||n.hasAttribute("contenteditable")||!!n.closest(".nokey")}const Kw=e=>"clientX"in e,In=(e,n)=>{var s,u;const i=Kw(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)}},uv=(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,...cm(u)}})};function Jw({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 ju(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function cv({pos:e,x1:n,y1:i,x2:l,y2:o,c:s}){switch(e){case be.Left:return[n-ju(n-l,s),i];case be.Right:return[n+ju(l-n,s),i];case be.Top:return[n,i-ju(i-o,s)];case be.Bottom:return[n,i+ju(o-i,s)]}}function fm({sourceX:e,sourceY:n,sourcePosition:i=be.Bottom,targetX:l,targetY:o,targetPosition:s=be.Top,curvature:u=.25}){const[f,d]=cv({pos:i,x1:e,y1:n,x2:l,y2:o,c:u}),[h,m]=cv({pos:s,x1:l,y1:o,x2:e,y2:n,c:u}),[p,y,v,b]=Jw({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,b]}function Ww({sourceX:e,sourceY:n,targetX:i,targetY:l}){const o=Math.abs(i-e)/2,s=i0}const NT=({source:e,sourceHandle:n,target:i,targetHandle:l})=>`xy-edge__${e}${n||""}-${i}${l||""}`,kT=(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)),CT=(e,n,i={})=>{if(!e.source||!e.target)return n;const l=i.getEdgeId||NT;let o;return Vw(e)?o={...e}:o={...e,id:l(e)},kT(o,n)?n:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,n.concat(o))};function eS({sourceX:e,sourceY:n,targetX:i,targetY:l}){const[o,s,u,f]=Ww({sourceX:e,sourceY:n,targetX:i,targetY:l});return[`M ${e},${n}L ${i},${l}`,o,s,u,f]}const fv={[be.Left]:{x:-1,y:0},[be.Right]:{x:1,y:0},[be.Top]:{x:0,y:-1},[be.Bottom]:{x:0,y:1}},zT=({source:e,sourcePosition:n=be.Bottom,target:i})=>n===be.Left||n===be.Right?e.xMath.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function AT({source:e,sourcePosition:n=be.Bottom,target:i,targetPosition:l=be.Top,center:o,offset:s,stepPosition:u}){const f=fv[n],d=fv[l],h={x:e.x+f.x*s,y:e.y+f.y*s},m={x:i.x+d.x*s,y:i.y+d.y*s},p=zT({source:h,sourcePosition:n,target:m}),y=p.x!==0?"x":"y",v=p[y];let b=[],C,S;const _={x:0,y:0},z={x:0,y:0},[,,w,T]=Ww({sourceX:e.x,sourceY:e.y,targetX:i.x,targetY:i.y});if(f[y]*d[y]===-1){y==="x"?(C=o.x??h.x+(m.x-h.x)*u,S=o.y??(h.y+m.y)/2):(C=o.x??(h.x+m.x)/2,S=o.y??h.y+(m.y-h.y)*u);const A=[{x:C,y:h.y},{x:C,y:m.y}],L=[{x:h.x,y:S},{x:m.x,y:S}];f[y]===v?b=y==="x"?A:L:b=y==="x"?L:A}else{const A=[{x:h.x,y:m.y}],L=[{x:m.x,y:h.y}];if(y==="x"?b=f.x===v?L:A:b=f.y===v?A:L,n===l){const D=Math.abs(e[y]-i[y]);if(D<=s){const ee=Math.min(s-1,s-D);f[y]===v?_[y]=(h[y]>e[y]?-1:1)*ee:z[y]=(m[y]>i[y]?-1:1)*ee}}if(n!==l){const D=y==="x"?"y":"x",ee=f[y]===d[D],H=h[D]>m[D],G=h[D]=R?(C=(q.x+I.x)/2,S=b[0].y):(C=b[0].x,S=(q.y+I.y)/2)}return[[e,{x:h.x+_.x,y:h.y+_.y},...b,{x:m.x+z.x,y:m.y+z.y},i],C,S,w,T]}function TT(e,n,i,l){const o=Math.min(dv(e,n)/2,dv(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 T="";return w>0&&wi.id===n):e[0])||null}function Rp(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=Rp(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 tS=1e3,OT=10,dm={nodeOrigin:[0,0],nodeExtent:Ho,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},DT={...dm,checkEquality:!0};function hm(e,n){const i={...e};for(const l in n)n[l]!==void 0&&(i[l]=n[l]);return i}function RT(e,n,i){const l=hm(dm,i);for(const o of e.values())if(o.parentId)mm(o,e,n,l);else{const s=Fo(o,l.nodeOrigin),u=la(o.extent)?o.extent:l.nodeExtent,f=Fi(s,u,Mr(o));o.internals.positionAbsolute=f}}function LT(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 pm(e){return e==="manual"}function Lp(e,n,i,l={}){var h,m;const o=hm(DT,l),s={i:0},u=new Map(n),f=o!=null&&o.elevateNodesOnSelect&&!pm(o.zIndexMode)?tS: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=Fo(p,o.nodeOrigin),b=la(p.extent)?p.extent:o.nodeExtent,C=Fi(v,b,Mr(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:C,handleBounds:LT(p,y),z:nS(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&&mm(y,n,i,l,s)}return d}function HT(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 mm(e,n,i,l,o){const{elevateNodesOnSelect:s,nodeOrigin:u,nodeExtent:f,zIndexMode:d}=hm(dm,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}HT(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*OT),o&&m.internals.rootParentIndex!==void 0&&(o.i=m.internals.rootParentIndex);const p=s&&!pm(d)?tS:0,{x:y,y:v,z:b}=BT(e,m,u,f,p,d),{positionAbsolute:C}=e.internals,S=y!==C.x||v!==C.y;(S||b!==e.internals.z)&&n.set(e.id,{...e,internals:{...e.internals,positionAbsolute:S?{x:y,y:v}:C,z:b}})}function nS(e,n,i){const l=Un(e.zIndex)?e.zIndex:0;return pm(i)?l:l+(e.selected?n:0)}function BT(e,n,i,l,o,s){const{x:u,y:f}=n.internals.positionAbsolute,d=Mr(e),h=Fo(e,i),m=la(e.extent)?Fi(h,e.extent,d):h;let p=Fi({x:u+m.x,y:f+m.y},l,d);e.extent==="parent"&&(p=Yw(p,d,n));const y=nS(e,o,s),v=n.internals.z??0;return{x:p.x,y:p.y,z:v>=y?v+1:y}}function gm(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)??ia(d),m=Xw(h,f.rect);s.set(f.parentId,{expandedRect:m,parent:d})}return s.size>0&&s.forEach(({expandedRect:f,parent:d},h)=>{var w;const m=d.internals.positionAbsolute,p=Mr(d),y=d.origin??l,v=f.x0||b>0||_||z)&&(o.push({id:h,type:"position",position:{x:d.position.x-v+_,y:d.position.y-b+z}}),(w=i.get(h))==null||w.forEach(T=>{e.some(U=>U.id===T.id)||o.push({id:T.id,type:"position",position:{x:T.position.x+v,y:T.position.y+b}})})),(p.width0){const v=gm(y,n,i,o);h.push(...v)}return{changes:h,updatedInternals:d}}async function UT({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 gv(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 rS(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}`;gv("source",d,m,e,o,u),gv("target",d,h,e,s,f),n.set(l.id,l)}}function iS(e,n){if(!e.parentId)return!1;const i=n.get(e.parentId);return i?i.selected?!0:iS(i,n):!1}function yv(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 IT(e,n,i,l){const o=new Map;for(const[s,u]of e)if((u.selected||u.id===l)&&(!u.parentId||!iS(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 rh({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 VT({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=Zo(s,n);return{x:u.x-s.x,y:u.y-s.y}}function GT({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,b=!1,C=null;function S({noDragClassName:z,handleSelector:w,domNode:T,isSelectable:U,nodeId:A,nodeClickDistance:L=0}){y=vn(T);function q({x:D,y:ee}){const{nodeLookup:H,nodeExtent:G,snapGrid:j,snapToGrid:Y,nodeOrigin:Z,onNodeDrag:K,onSelectionDrag:M,onError:B,updateNodePositions:P}=n();s={x:D,y:ee};let N=!1;const V=f.size>1,F=V&&G?Op(Qo(f)):null,J=V&&Y?VT({dragItems:f,snapGrid:j,x:D,y:ee}):null;for(const[ne,re]of f){if(!H.has(ne))continue;let se={x:D-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)}:Zo(se,j));let ge=null;if(V&&G&&!re.extent&&F){const{positionAbsolute:he}=re.internals,Se=he.x-F.x+G[0][0],Me=he.x+re.measured.width-F.x2+G[1][0],Ce=he.y-F.y+G[0][1],lt=he.y+re.measured.height-F.y2+G[1][1];ge=[[Se,Ce],[Me,lt]]}const{position:xe,positionAbsolute:ye}=Gw({nodeId:ne,nextPosition:se,nodeLookup:H,nodeExtent:ge||G,nodeOrigin:Z,onError:B});N=N||re.position.x!==xe.x||re.position.y!==xe.y,re.position=xe,re.internals.positionAbsolute=ye}if(b=b||N,!!N&&(P(f,!0),C&&(l||K||!A&&M))){const[ne,re]=rh({nodeId:A,dragItems:f,nodeLookup:H});l==null||l(C,f,ne,re),K==null||K(C,ne,re),A||M==null||M(C,re)}}async function I(){if(!m)return;const{transform:D,panBy:ee,autoPanSpeed:H,autoPanOnNodeDrag:G}=n();if(!G){d=!1,cancelAnimationFrame(u);return}const[j,Y]=$w(h,m,H);(j!==0||Y!==0)&&(s.x=(s.x??0)-j/D[2],s.y=(s.y??0)-Y/D[2],await ee({x:j,y:Y})&&q(s)),u=requestAnimationFrame(I)}function $(D){var V;const{nodeLookup:ee,multiSelectionActive:H,nodesDraggable:G,transform:j,snapGrid:Y,snapToGrid:Z,selectNodesOnDrag:K,onNodeDragStart:M,onSelectionDragStart:B,unselectNodesAndEdges:P}=n();p=!0,(!K||!U)&&!H&&A&&((V=ee.get(A))!=null&&V.selected||P()),U&&K&&A&&(e==null||e(A));const N=ko(D.sourceEvent,{transform:j,snapGrid:Y,snapToGrid:Z,containerBounds:m});if(s=N,f=IT(ee,G,N,A),f.size>0&&(i||M||!A&&B)){const[F,J]=rh({nodeId:A,dragItems:f,nodeLookup:ee});i==null||i(D.sourceEvent,f,F,J),M==null||M(D.sourceEvent,F,J),A||B==null||B(D.sourceEvent,J)}}const R=Sw().clickDistance(L).on("start",D=>{const{domNode:ee,nodeDragThreshold:H,transform:G,snapGrid:j,snapToGrid:Y}=n();m=(ee==null?void 0:ee.getBoundingClientRect())||null,v=!1,b=!1,C=D.sourceEvent,H===0&&$(D),s=ko(D.sourceEvent,{transform:G,snapGrid:j,snapToGrid:Y,containerBounds:m}),h=In(D.sourceEvent,m)}).on("drag",D=>{const{autoPanOnNodeDrag:ee,transform:H,snapGrid:G,snapToGrid:j,nodeDragThreshold:Y,nodeLookup:Z}=n(),K=ko(D.sourceEvent,{transform:H,snapGrid:G,snapToGrid:j,containerBounds:m});if(C=D.sourceEvent,(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1||A&&!Z.has(A))&&(v=!0),!v){if(!d&&ee&&p&&(d=!0,I()),!p){const M=In(D.sourceEvent,m),B=M.x-h.x,P=M.y-h.y;Math.sqrt(B*B+P*P)>Y&&$(D)}(s.x!==K.xSnapped||s.y!==K.ySnapped)&&f&&p&&(h=In(D.sourceEvent,m),q(K))}}).on("end",D=>{if(!(!p||v)&&(d=!1,p=!1,cancelAnimationFrame(u),f.size>0)){const{nodeLookup:ee,updateNodePositions:H,onNodeDragStop:G,onSelectionDragStop:j}=n();if(b&&(H(f,!1),b=!1),o||G||!A&&j){const[Y,Z]=rh({nodeId:A,dragItems:f,nodeLookup:ee,dragging:!1});o==null||o(D.sourceEvent,f,Y,Z),G==null||G(D.sourceEvent,Y,Z),A||j==null||j(D.sourceEvent,Z)}}}).filter(D=>{const ee=D.target;return!D.button&&(!z||!yv(ee,`.${z}`,T))&&(!w||yv(ee,w,T))});y.call(R)}function _(){y==null||y.on(".drag",null)}return{update:S,destroy:_}}function YT(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())qo(o,ia(s))>0&&l.push(s);return l}const $T=250;function XT(e,n,i,l){var f,d;let o=[],s=1/0;const u=YT(e,i,n+$T);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}=Qi(h,p,p.position,!0),b=Math.sqrt(Math.pow(y-e.x,2)+Math.pow(v-e.y,2));b>n||(b1){const h=l.type==="source"?"target":"source";return o.find(m=>m.type===h)??o[0]}return o[0]}function lS(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,...Qi(u,d,d.position,!0)}:d}function aS(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function PT(e,n){let i=null;return n?i=!0:e&&!n&&(i=!1),i}const oS=()=>!0;function FT(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:b,onConnect:C,onConnectEnd:S,isValidConnection:_=oS,onReconnectEnd:z,updateConnection:w,getTransform:T,getFromHandle:U,autoPanSpeed:A,dragThreshold:L=1,handleDomNode:q}){const I=Qw(e.target);let $=0,R;const{x:D,y:ee}=In(e),H=aS(s,q),G=f==null?void 0:f.getBoundingClientRect();let j=!1;if(!G||!H)return;const Y=lS(o,H,l,d,n);if(!Y)return;let Z=In(e,G),K=!1,M=null,B=!1,P=null;function N(){if(!m||!G)return;const[xe,ye]=$w(Z,G,A);y({x:xe,y:ye}),$=requestAnimationFrame(N)}const V={...Y,nodeId:o,type:H,position:Y.position},F=d.get(o);let ne={inProgress:!0,isValid:null,from:Qi(F,V,be.Left,!0),fromHandle:V,fromPosition:V.position,fromNode:F,to:Z,toHandle:null,toPosition:lv[V.position],toNode:null,pointer:Z};function re(){j=!0,w(ne),b==null||b(e,{nodeId:o,handleId:l,handleType:H})}L===0&&re();function se(xe){if(!j){const{x:lt,y:Je}=In(xe),Tt=lt-D,Vt=Je-ee;if(!(Tt*Tt+Vt*Vt>L*L))return;re()}if(!U()||!V){ge(xe);return}const ye=T();Z=In(xe,G),R=XT(Ko(Z,ye,!1,[1,1]),i,d,V),K||(N(),K=!0);const he=sS(xe,{handle:R,connectionMode:n,fromNodeId:o,fromHandleId:l,fromType:u?"target":"source",isValidConnection:_,doc:I,lib:h,flowId:p,nodeLookup:d});P=he.handleDomNode,M=he.connection,B=PT(!!R,he.isValid);const Se=d.get(o),Me=Se?Qi(Se,V,be.Left,!0):ne.from,Ce={...ne,from:Me,isValid:B,to:he.toHandle&&B?lc({x:he.toHandle.x,y:he.toHandle.y},ye):Z,toHandle:he.toHandle,toPosition:B&&he.toHandle?he.toHandle.position:lv[V.position],toNode:he.toHandle?d.get(he.toHandle.nodeId):null,pointer:Z};w(Ce),ne=Ce}function ge(xe){if(!("touches"in xe&&xe.touches.length>0)){if(j){(R||P)&&M&&B&&(C==null||C(M));const{inProgress:ye,...he}=ne,Se={...he,toPosition:ne.toHandle?ne.toPosition:null};S==null||S(xe,Se),s&&(z==null||z(xe,Se))}v(),cancelAnimationFrame($),K=!1,B=!1,M=null,P=null,I.removeEventListener("mousemove",se),I.removeEventListener("mouseup",ge),I.removeEventListener("touchmove",se),I.removeEventListener("touchend",ge)}}I.addEventListener("mousemove",se),I.addEventListener("mouseup",ge),I.addEventListener("touchmove",se),I.addEventListener("touchend",ge)}function sS(e,{handle:n,connectionMode:i,fromNodeId:l,fromHandleId:o,fromType:s,doc:u,lib:f,flowId:d,isValidConnection:h=oS,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:b}=In(e),C=u.elementFromPoint(v,b),S=C!=null&&C.classList.contains(`${f}-flow__handle`)?C:y,_={handleDomNode:S,isValid:!1,connection:null,toHandle:null};if(S){const z=aS(void 0,S),w=S.getAttribute("data-nodeid"),T=S.getAttribute("data-handleid"),U=S.classList.contains("connectable"),A=S.classList.contains("connectableend");if(!w||!z)return _;const L={source:p?w:l,sourceHandle:p?T:o,target:p?l:w,targetHandle:p?o:T};_.connection=L;const I=U&&A&&(i===na.Strict?p&&z==="source"||!p&&z==="target":w!==l||T!==o);_.isValid=I&&h(L),_.toHandle=lS(w,z,T,m,i,!0)}return _}const Hp={onPointerDown:FT,isValid:sS};function QT({domNode:e,panZoom:n,getTransform:i,getViewScale:l}){const o=vn(e);function s({translateExtent:f,width:d,height:h,zoomStep:m=1,pannable:p=!0,zoomable:y=!0,inversePan:v=!1}){const b=w=>{if(w.sourceEvent.type!=="wheel"||!n)return;const T=i(),U=w.sourceEvent.ctrlKey&&Uo()?10:1,A=-w.sourceEvent.deltaY*(w.sourceEvent.deltaMode===1?.05:w.sourceEvent.deltaMode?1:.002)*m,L=T[2]*Math.pow(2,A*U);n.scaleTo(L)};let C=[0,0];const S=w=>{(w.sourceEvent.type==="mousedown"||w.sourceEvent.type==="touchstart")&&(C=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY])},_=w=>{const T=i();if(w.sourceEvent.type!=="mousemove"&&w.sourceEvent.type!=="touchmove"||!n)return;const U=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY],A=[U[0]-C[0],U[1]-C[1]];C=U;const L=l()*Math.max(T[2],Math.log(T[2]))*(v?-1:1),q={x:T[0]-A[0]*L,y:T[1]-A[1]*L},I=[[0,0],[d,h]];n.setViewportConstrained({x:q.x,y:q.y,zoom:T[2]},I,f)},z=Hw().on("start",S).on("zoom",p?_:null).on("zoom.wheel",y?b:null);o.call(z,{})}function u(){o.on("zoom",null)}return{update:s,destroy:u,pointer:Bn}}const wc=e=>({x:e.x,y:e.y,zoom:e.k}),ih=({x:e,y:n,zoom:i})=>xc.translate(e,n).scale(i),Yl=(e,n)=>e.target.closest(`.${n}`),uS=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),ZT=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,lh=(e,n=0,i=ZT,l=()=>{})=>{const o=typeof n=="number"&&n>0;return o||l(),o?e.transition().duration(n).ease(i).on("end",l):e},cS=e=>{const n=e.ctrlKey&&Uo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n};function KT({zoomPanValues:e,noWheelClassName:n,d3Selection:i,d3Zoom:l,panOnScrollMode:o,panOnScrollSpeed:s,zoomOnPinch:u,onPanZoomStart:f,onPanZoom:d,onPanZoomEnd:h}){return m=>{if(Yl(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=Bn(m),_=cS(m),z=p*Math.pow(2,_);l.scaleTo(i,z,S,m);return}const y=m.deltaMode===1?20:1;let v=o===Yi.Vertical?0:m.deltaX*y,b=o===Yi.Horizontal?0:m.deltaY*y;!Uo()&&m.shiftKey&&o!==Yi.Vertical&&(v=m.deltaY*y,b=0),l.translateBy(i,-(v/p)*s,-(b/p)*s,{internal:!0});const C=wc(i.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(d==null||d(m,C),e.panScrollTimeout=setTimeout(()=>{h==null||h(m,C),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,f==null||f(m,C))}}function JT({noWheelClassName:e,preventScrolling:n,d3ZoomHandler:i}){return function(l,o){const s=l.type==="wheel",u=!n&&s&&!l.ctrlKey,f=Yl(l,e);if(l.ctrlKey&&s&&f&&l.preventDefault(),u||f)return null;l.preventDefault(),i.call(this,l,o)}}function WT({zoomPanValues:e,onDraggingChange:n,onPanZoomStart:i}){return l=>{var s,u,f;if((s=l.sourceEvent)!=null&&s.internal)return;const o=wc(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 e3({zoomPanValues:e,panOnDrag:n,onPaneContextMenu:i,onTransformChange:l,onPanZoom:o}){return s=>{var u,f;e.usedRightMouseButton=!!(i&&uS(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,wc(s.transform)))}}function t3({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&&uS(n,e.mouseButton??0)&&!e.usedRightMouseButton&&u.sourceEvent&&s(u.sourceEvent),e.usedRightMouseButton=!1,l(!1),o)){const d=wc(u.transform);e.prevViewport=d,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(u.sourceEvent,d)},i?150:0)}}}function n3({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,b=p.type==="wheel";if(p.button===1&&p.type==="mousedown"&&(Yl(p,`${h}-flow__node`)||Yl(p,`${h}-flow__edge`)))return!0;if(!l&&!y&&!o&&!s&&!i||u||m&&!b||Yl(p,f)&&b||Yl(p,d)&&(!b||o&&b&&!e)||!i&&p.ctrlKey&&b)return!1;if(!i&&p.type==="touchstart"&&((S=p.touches)==null?void 0:S.length)>1)return p.preventDefault(),!1;if(!y&&!o&&!v&&b||!l&&(p.type==="mousedown"||p.type==="touchstart")||Array.isArray(l)&&!l.includes(p.button)&&p.type==="mousedown")return!1;const C=Array.isArray(l)&&l.includes(p.button)||!p.button||p.button<=1;return(!p.ctrlKey||b)&&C}}function r3({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=Hw().scaleExtent([n,i]).translateExtent(l),y=vn(e).call(p);z({x:o.x,y:o.y,zoom:ra(o.zoom,n,i)},[[0,0],[m.width,m.height]],l);const v=y.on("wheel.zoom"),b=y.on("dblclick.zoom");p.wheelDelta(cS);function C(R,D){return y?new Promise(ee=>{p==null||p.interpolate((D==null?void 0:D.interpolate)==="linear"?No:Vu).transform(lh(y,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>ee(!0)),R)}):Promise.resolve(!1)}function S({noWheelClassName:R,noPanClassName:D,onPaneContextMenu:ee,userSelectionActive:H,panOnScroll:G,panOnDrag:j,panOnScrollMode:Y,panOnScrollSpeed:Z,preventScrolling:K,zoomOnPinch:M,zoomOnScroll:B,zoomOnDoubleClick:P,zoomActivationKeyPressed:N,lib:V,onTransformChange:F,connectionInProgress:J,paneClickDistance:ne,selectionOnDrag:re}){H&&!h.isZoomingOrPanning&&_();const se=G&&!N&&!H;p.clickDistance(re?1/0:!Un(ne)||ne<0?0:ne);const ge=se?KT({zoomPanValues:h,noWheelClassName:R,d3Selection:y,d3Zoom:p,panOnScrollMode:Y,panOnScrollSpeed:Z,zoomOnPinch:M,onPanZoomStart:u,onPanZoom:s,onPanZoomEnd:f}):JT({noWheelClassName:R,preventScrolling:K,d3ZoomHandler:v});if(y.on("wheel.zoom",ge,{passive:!1}),!H){const ye=WT({zoomPanValues:h,onDraggingChange:d,onPanZoomStart:u});p.on("start",ye);const he=e3({zoomPanValues:h,panOnDrag:j,onPaneContextMenu:!!ee,onPanZoom:s,onTransformChange:F});p.on("zoom",he);const Se=t3({zoomPanValues:h,panOnDrag:j,panOnScroll:G,onPaneContextMenu:ee,onPanZoomEnd:f,onDraggingChange:d});p.on("end",Se)}const xe=n3({zoomActivationKeyPressed:N,panOnDrag:j,zoomOnScroll:B,panOnScroll:G,zoomOnDoubleClick:P,zoomOnPinch:M,userSelectionActive:H,noPanClassName:D,noWheelClassName:R,lib:V,connectionInProgress:J});p.filter(xe),P?y.on("dblclick.zoom",b):y.on("dblclick.zoom",null)}function _(){p.on("zoom",null)}async function z(R,D,ee){const H=ih(R),G=p==null?void 0:p.constrain()(H,D,ee);return G&&await C(G),new Promise(j=>j(G))}async function w(R,D){const ee=ih(R);return await C(ee,D),new Promise(H=>H(ee))}function T(R){if(y){const D=ih(R),ee=y.property("__zoom");(ee.k!==R.zoom||ee.x!==R.x||ee.y!==R.y)&&(p==null||p.transform(y,D,null,{sync:!0}))}}function U(){const R=y?Lw(y.node()):{x:0,y:0,k:1};return{x:R.x,y:R.y,zoom:R.k}}function A(R,D){return y?new Promise(ee=>{p==null||p.interpolate((D==null?void 0:D.interpolate)==="linear"?No:Vu).scaleTo(lh(y,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>ee(!0)),R)}):Promise.resolve(!1)}function L(R,D){return y?new Promise(ee=>{p==null||p.interpolate((D==null?void 0:D.interpolate)==="linear"?No:Vu).scaleBy(lh(y,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>ee(!0)),R)}):Promise.resolve(!1)}function q(R){p==null||p.scaleExtent(R)}function I(R){p==null||p.translateExtent(R)}function $(R){const D=!Un(R)||R<0?0:R;p==null||p.clickDistance(D)}return{update:S,destroy:_,setViewport:w,setViewportConstrained:z,getViewport:U,scaleTo:A,scaleBy:L,setScaleExtent:q,setTranslateExtent:I,syncViewport:T,setClickDistance:$}}var aa;(function(e){e.Line="line",e.Handle="handle"})(aa||(aa={}));function i3({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 xv(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 ci(e,n){return Math.max(0,n-e)}function fi(e,n){return Math.max(0,e-n)}function Ou(e,n,i){return Math.max(0,n-e,e-i)}function vv(e,n){return e?!n:n}function l3(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:b}=i,{minWidth:C,maxWidth:S,minHeight:_,maxHeight:z}=l,{x:w,y:T,width:U,height:A,aspectRatio:L}=e;let q=Math.floor(m?v-e.pointerX:0),I=Math.floor(p?b-e.pointerY:0);const $=U+(d?-q:q),R=A+(h?-I:I),D=-s[0]*U,ee=-s[1]*A;let H=Ou($,C,S),G=Ou(R,_,z);if(u){let Z=0,K=0;d&&q<0?Z=ci(w+q+D,u[0][0]):!d&&q>0&&(Z=fi(w+$+D,u[1][0])),h&&I<0?K=ci(T+I+ee,u[0][1]):!h&&I>0&&(K=fi(T+R+ee,u[1][1])),H=Math.max(H,Z),G=Math.max(G,K)}if(f){let Z=0,K=0;d&&q>0?Z=fi(w+q,f[0][0]):!d&&q<0&&(Z=ci(w+$,f[1][0])),h&&I>0?K=fi(T+I,f[0][1]):!h&&I<0&&(K=ci(T+R,f[1][1])),H=Math.max(H,Z),G=Math.max(G,K)}if(o){if(m){const Z=Ou($/L,_,z)*L;if(H=Math.max(H,Z),u){let K=0;!d&&!h||d&&!h&&y?K=fi(T+ee+$/L,u[1][1])*L:K=ci(T+ee+(d?q:-q)/L,u[0][1])*L,H=Math.max(H,K)}if(f){let K=0;!d&&!h||d&&!h&&y?K=ci(T+$/L,f[1][1])*L:K=fi(T+(d?q:-q)/L,f[0][1])*L,H=Math.max(H,K)}}if(p){const Z=Ou(R*L,C,S)/L;if(G=Math.max(G,Z),u){let K=0;!d&&!h||h&&!d&&y?K=fi(w+R*L+D,u[1][0])/L:K=ci(w+(h?I:-I)*L+D,u[0][0])/L,G=Math.max(G,K)}if(f){let K=0;!d&&!h||h&&!d&&y?K=ci(w+R*L,f[1][0])/L:K=fi(w+(h?I:-I)*L,f[0][0])/L,G=Math.max(G,K)}}}I=I+(I<0?G:-G),q=q+(q<0?H:-H),o&&(y?$>R*L?I=(vv(d,h)?-q:q)/L:q=(vv(d,h)?-I:I)*L:m?(I=q/L,h=d):(q=I*L,d=h));const j=d?w+q:w,Y=h?T+I:T;return{width:U+(d?-q:q),height:A+(h?-I:I),x:s[0]*q*(d?-1:1)+j,y:s[1]*I*(h?-1:1)+Y}}const fS={width:0,height:0,x:0,y:0},a3={...fS,pointerX:0,pointerY:0,aspectRatio:1};function o3(e){return[[0,0],[e.measured.width,e.measured.height]]}function s3(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 u3({domNode:e,nodeId:n,getStoreItems:i,onChange:l,onEnd:o}){const s=vn(e);let u={controlDirection:xv("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:b,onResizeEnd:C,shouldResize:S}){let _={...fS},z={...a3};u={boundaries:m,resizeDirection:y,keepAspectRatio:p,controlDirection:xv(h)};let w,T=null,U=[],A,L,q,I=!1;const $=Sw().on("start",R=>{const{nodeLookup:D,transform:ee,snapGrid:H,snapToGrid:G,nodeOrigin:j,paneDomNode:Y}=i();if(w=D.get(n),!w)return;T=(Y==null?void 0:Y.getBoundingClientRect())??null;const{xSnapped:Z,ySnapped:K}=ko(R.sourceEvent,{transform:ee,snapGrid:H,snapToGrid:G,containerBounds:T});_={width:w.measured.width??0,height:w.measured.height??0,x:w.position.x??0,y:w.position.y??0},z={..._,pointerX:Z,pointerY:K,aspectRatio:_.width/_.height},A=void 0,w.parentId&&(w.extent==="parent"||w.expandParent)&&(A=D.get(w.parentId),L=A&&w.extent==="parent"?o3(A):void 0),U=[],q=void 0;for(const[M,B]of D)if(B.parentId===n&&(U.push({id:M,position:{...B.position},extent:B.extent}),B.extent==="parent"||B.expandParent)){const P=s3(B,w,B.origin??j);q?q=[[Math.min(P[0][0],q[0][0]),Math.min(P[0][1],q[0][1])],[Math.max(P[1][0],q[1][0]),Math.max(P[1][1],q[1][1])]]:q=P}v==null||v(R,{..._})}).on("drag",R=>{const{transform:D,snapGrid:ee,snapToGrid:H,nodeOrigin:G}=i(),j=ko(R.sourceEvent,{transform:D,snapGrid:ee,snapToGrid:H,containerBounds:T}),Y=[];if(!w)return;const{x:Z,y:K,width:M,height:B}=_,P={},N=w.origin??G,{width:V,height:F,x:J,y:ne}=l3(z,u.controlDirection,j,u.boundaries,u.keepAspectRatio,N,L,q),re=V!==M,se=F!==B,ge=J!==Z&&re,xe=ne!==K&&se;if(!ge&&!xe&&!re&&!se)return;if((ge||xe||N[0]===1||N[1]===1)&&(P.x=ge?J:_.x,P.y=xe?ne:_.y,_.x=P.x,_.y=P.y,U.length>0)){const Me=J-Z,Ce=ne-K;for(const lt of U)lt.position={x:lt.position.x-Me+N[0]*(V-M),y:lt.position.y-Ce+N[1]*(F-B)},Y.push(lt)}if((re||se)&&(P.width=re&&(!u.resizeDirection||u.resizeDirection==="horizontal")?V:_.width,P.height=se&&(!u.resizeDirection||u.resizeDirection==="vertical")?F:_.height,_.width=P.width,_.height=P.height),A&&w.expandParent){const Me=N[0]*(P.width??0);P.x&&P.x{I&&(C==null||C(R,{..._}),o==null||o({..._}),I=!1)});s.call($)}function d(){s.on(".drag",null)}return{update:f,destroy:d}}var ah={exports:{}},oh={},sh={exports:{}},uh={};/** + * @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 c3(){if(bv)return uh;bv=1;var e=Yo();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(),b=l({inst:{value:v,getSnapshot:y}}),C=b[0].inst,S=b[1];return s(function(){C.value=v,C.getSnapshot=y,d(C)&&S({inst:C})},[p,v,y]),o(function(){return d(C)&&S({inst:C}),p(function(){d(C)&&S({inst:C})})},[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 uh.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,uh}var wv;function f3(){return wv||(wv=1,sh.exports=c3()),sh.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 Sv;function d3(){if(Sv)return oh;Sv=1;var e=Yo(),n=f3();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 oh.useSyncExternalStoreWithSelector=function(h,m,p,y,v){var b=s(null);if(b.current===null){var C={hasValue:!1,value:null};b.current=C}else C=b.current;b=f(function(){function _(A){if(!z){if(z=!0,w=A,A=y(A),v!==void 0&&C.hasValue){var L=C.value;if(v(L,A))return T=L}return T=A}if(L=T,l(w,A))return L;var q=y(A);return v!==void 0&&v(L,q)?(w=A,L):(w=A,T=q)}var z=!1,w,T,U=p===void 0?null:p;return[function(){return _(m())},U===null?void 0:function(){return _(U())}]},[m,p,y,v]);var S=o(h,b[0],b[1]);return u(function(){C.hasValue=!0,C.value=S},[S]),d(S),S},oh}var _v;function h3(){return _v||(_v=1,ah.exports=d3()),ah.exports}var p3=h3();const m3=Go(p3),g3={},Ev=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(b=>b(n,v))}},o=()=>n,d={setState:l,getState:o,getInitialState:()=>h,subscribe:m=>(i.add(m),()=>i.delete(m)),destroy:()=>{(g3?"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},y3=e=>e?Ev(e):Ev,{useDebugValue:x3}=Vl,{useSyncExternalStoreWithSelector:v3}=m3,b3=e=>e;function dS(e,n=b3,i){const l=v3(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,i);return x3(l),l}const Nv=(e,n)=>{const i=y3(e),l=(o,s=n)=>dS(i,o,s);return Object.assign(l,i),l},w3=(e,n)=>e?Nv(e,n):Nv;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 S3=j1();const Sc=X.createContext(null),_3=Sc.Provider,hS=tr.error001();function Ve(e,n){const i=X.useContext(Sc);if(i===null)throw new Error(hS);return dS(i,e,n)}function pt(){const e=X.useContext(Sc);if(e===null)throw new Error(hS);return X.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const kv={display:"none"},E3={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},pS="react-flow__node-desc",mS="react-flow__edge-desc",N3="react-flow__aria-live",k3=e=>e.ariaLiveMessage,C3=e=>e.ariaLabelConfig;function z3({rfId:e}){const n=Ve(k3);return E.jsx("div",{id:`${N3}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:E3,children:n})}function A3({rfId:e,disableKeyboardA11y:n}){const i=Ve(C3);return E.jsxs(E.Fragment,{children:[E.jsx("div",{id:`${pS}-${e}`,style:kv,children:n?i["node.a11yDescription.default"]:i["node.a11yDescription.keyboardDisabled"]}),E.jsx("div",{id:`${mS}-${e}`,style:kv,children:i["edge.a11yDescription.default"]}),!n&&E.jsx(z3,{rfId:e})]})}const _c=X.forwardRef(({position:e="top-left",children:n,className:i,style:l,...o},s)=>{const u=`${e}`.split("-");return E.jsx("div",{className:At(["react-flow__panel",i,...u]),style:l,ref:s,...o,children:n})});_c.displayName="Panel";function T3({proOptions:e,position:n="bottom-right"}){return e!=null&&e.hideAttribution?null:E.jsx(_c,{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:E.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const M3=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}},Du=e=>e.id;function j3(e,n){return dt(e.selectedNodes.map(Du),n.selectedNodes.map(Du))&&dt(e.selectedEdges.map(Du),n.selectedEdges.map(Du))}function O3({onSelectionChange:e}){const n=pt(),{selectedNodes:i,selectedEdges:l}=Ve(M3,j3);return X.useEffect(()=>{const o={nodes:i,edges:l};e==null||e(o),n.getState().onSelectionChangeHandlers.forEach(s=>s(o))},[i,l,e]),null}const D3=e=>!!e.onSelectionChangeHandlers;function R3({onSelectionChange:e}){const n=Ve(D3);return e||n?E.jsx(O3,{onSelectionChange:e}):null}const gS=[0,0],L3={x:0,y:0,zoom:1},H3=["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"],Cv=[...H3,"rfId"],B3=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}),zv={translateExtent:Ho,nodeOrigin:gS,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function q3(e){const{setNodes:n,setEdges:i,setMinZoom:l,setMaxZoom:o,setTranslateExtent:s,setNodeExtent:u,reset:f,setDefaultNodesAndEdges:d}=Ve(B3,dt),h=pt();X.useEffect(()=>(d(e.defaultNodes,e.defaultEdges),()=>{m.current=zv,f()}),[]);const m=X.useRef(zv);return X.useEffect(()=>{for(const p of Cv){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:wT(y)}):p==="fitView"?h.setState({fitViewQueued:y}):p==="fitViewOptions"?h.setState({fitViewOptions:y}):h.setState({[p]:y})))}m.current=e},Cv.map(p=>e[p])),null}function Av(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function U3(e){var l;const[n,i]=X.useState(e==="system"?null:e);return X.useEffect(()=>{if(e!=="system"){i(e);return}const o=Av(),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=Av())!=null&&l.matches?"dark":"light"}const Tv=typeof document<"u"?document:null;function Io(e=null,n={target:Tv,actInsideInputWithModifier:!0}){const[i,l]=X.useState(!1),o=X.useRef(!1),s=X.useRef(new Set([])),[u,f]=X.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 X.useEffect(()=>{const d=(n==null?void 0:n.target)??Tv,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)&&Zw(v))return!1;const C=jv(v.code,f);if(s.current.add(v[C]),Mv(u,s.current,!1)){const z=((_=(S=v.composedPath)==null?void 0:S.call(v))==null?void 0:_[0])||v.target,w=(z==null?void 0:z.nodeName)==="BUTTON"||(z==null?void 0:z.nodeName)==="A";n.preventDefault!==!1&&(o.current||!w)&&v.preventDefault(),l(!0)}},p=v=>{const b=jv(v.code,f);Mv(u,s.current,!0)?(l(!1),s.current.clear()):s.current.delete(v[b]),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 Mv(e,n,i){return e.filter(l=>i||l.length===n.size).some(l=>l.every(o=>n.has(o)))}function jv(e,n){return n.includes(e)?"code":"key"}const I3=()=>{const e=pt();return X.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=um(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 Ko(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=lc(n,i);return{x:u.x+o,y:u.y+s}}}),[])};function yS(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)V3(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 V3(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 xS(e,n){return yS(e,n)}function vS(e,n){return yS(e,n)}function Bi(e,n){return{id:e,type:"select",selected:n}}function $l(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(Bi(s.id,u)))}return l}function Ov({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 Dv(e){return{id:e.id,type:"remove"}}const Rv=e=>fT(e),G3=e=>Vw(e);function bS(e){return X.forwardRef(e)}const Y3=typeof window<"u"?X.useLayoutEffect:X.useEffect;function Lv(e){const[n,i]=X.useState(BigInt(0)),[l]=X.useState(()=>$3(()=>i(o=>o+BigInt(1))));return Y3(()=>{const o=l.get();o.length&&(e(o),l.reset())},[n]),l}function $3(e){let n=[];return{get:()=>n,reset:()=>{n=[]},push:i=>{n.push(i),e()}}}const wS=X.createContext(null);function X3({children:e}){const n=pt(),i=X.useCallback(f=>{const{nodes:d=[],setNodes:h,hasDefaultNodes:m,onNodesChange:p,nodeLookup:y,fitViewQueued:v,onNodesChangeMiddlewareMap:b}=n.getState();let C=d;for(const _ of f)C=typeof _=="function"?_(C):_;let S=Ov({items:C,lookup:y});for(const _ of b.values())S=_(S);m&&h(C),S.length>0?p==null||p(S):v&&window.requestAnimationFrame(()=>{const{fitViewQueued:_,nodes:z,setNodes:w}=n.getState();_&&w(z)})},[]),l=Lv(i),o=X.useCallback(f=>{const{edges:d=[],setEdges:h,hasDefaultEdges:m,onEdgesChange:p,edgeLookup:y}=n.getState();let v=d;for(const b of f)v=typeof b=="function"?b(v):b;m?h(v):p&&p(Ov({items:v,lookup:y}))},[]),s=Lv(o),u=X.useMemo(()=>({nodeQueue:l,edgeQueue:s}),[]);return E.jsx(wS.Provider,{value:u,children:e})}function P3(){const e=X.useContext(wS);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const F3=e=>!!e.panZoom;function Jo(){const e=I3(),n=pt(),i=P3(),l=Ve(F3),o=X.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(),b=Rv(p)?p:y.get(p.id),C=b.parentId?Fw(b.position,b.measured,b.parentId,y,v):b.position,S={...b,position:C,width:((_=b.measured)==null?void 0:_.width)??b.width,height:((z=b.measured)==null?void 0:z.height)??b.height};return ia(S)},h=(p,y,v={replace:!1})=>{u(b=>b.map(C=>{if(C.id===p){const S=typeof y=="function"?y(C):y;return v.replace&&Rv(S)?S:{...C,...S}}return C}))},m=(p,y,v={replace:!1})=>{f(b=>b.map(C=>{if(C.id===p){const S=typeof y=="function"?y(C):y;return v.replace&&G3(S)?S:{...C,...S}}return C}))};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(),[b,C,S]=v;return{nodes:p.map(_=>({..._})),edges:y.map(_=>({..._})),viewport:{x:b,y:C,zoom:S}}},deleteElements:async({nodes:p=[],edges:y=[]})=>{const{nodes:v,edges:b,onNodesDelete:C,onEdgesDelete:S,triggerNodeChanges:_,triggerEdgeChanges:z,onDelete:w,onBeforeDelete:T}=n.getState(),{nodes:U,edges:A}=await gT({nodesToRemove:p,edgesToRemove:y,nodes:v,edges:b,onBeforeDelete:T}),L=A.length>0,q=U.length>0;if(L){const I=A.map(Dv);S==null||S(A),z(I)}if(q){const I=U.map(Dv);C==null||C(U),_(I)}return(q||L)&&(w==null||w({nodes:U,edges:A})),{deletedNodes:U,deletedEdges:A}},getIntersectingNodes:(p,y=!0,v)=>{const b=ov(p),C=b?p:d(p),S=v!==void 0;return C?(v||n.getState().nodes).filter(_=>{const z=n.getState().nodeLookup.get(_.id);if(z&&!b&&(_.id===p.id||!z.internals.positionAbsolute))return!1;const w=ia(S?_:z),T=qo(w,C);return y&&T>0||T>=w.width*w.height||T>=C.width*C.height}):[]},isNodeIntersecting:(p,y,v=!0)=>{const C=ov(p)?p:d(p);if(!C)return!1;const S=qo(C,y);return v&&S>0||S>=y.width*y.height||S>=C.width*C.height},updateNode:h,updateNodeData:(p,y,v={replace:!1})=>{h(p,b=>{const C=typeof y=="function"?y(b):y;return v.replace?{...b,data:C}:{...b,data:{...b.data,...C}}},v)},updateEdge:m,updateEdgeData:(p,y,v={replace:!1})=>{m(p,b=>{const C=typeof y=="function"?y(b):y;return v.replace?{...b,data:C}:{...b,data:{...b.data,...C}}},v)},getNodesBounds:p=>{const{nodeLookup:y,nodeOrigin:v}=n.getState();return dT(p,{nodeLookup:y,nodeOrigin:v})},getHandleConnections:({type:p,id:y,nodeId:v})=>{var b;return Array.from(((b=n.getState().connectionLookup.get(`${v}-${p}${y?`-${y}`:""}`))==null?void 0:b.values())??[])},getNodeConnections:({type:p,handleId:y,nodeId:v})=>{var b;return Array.from(((b=n.getState().connectionLookup.get(`${v}${p?y?`-${p}-${y}`:`-${p}`:""}`))==null?void 0:b.values())??[])},fitView:async p=>{const y=n.getState().fitViewResolver??bT();return n.setState({fitViewQueued:!0,fitViewOptions:p,fitViewResolver:y}),i.nodeQueue.push(v=>[...v]),y.promise}}},[]);return X.useMemo(()=>({...o,...e,viewportInitialized:l}),[l])}const Hv=e=>e.selected,Q3=typeof window<"u"?window:void 0;function Z3({deleteKeyCode:e,multiSelectionKeyCode:n}){const i=pt(),{deleteElements:l}=Jo(),o=Io(e,{actInsideInputWithModifier:!1}),s=Io(n,{target:Q3});X.useEffect(()=>{if(o){const{edges:u,nodes:f}=i.getState();l({nodes:f.filter(Hv),edges:u.filter(Hv)}),i.setState({nodesSelectionActive:!1})}},[o]),X.useEffect(()=>{i.setState({multiSelectionActive:s})},[s])}function K3(e){const n=pt();X.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=cm(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 Ec={position:"absolute",width:"100%",height:"100%",top:0,left:0},J3=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function W3({onPaneContextMenu:e,zoomOnScroll:n=!0,zoomOnPinch:i=!0,panOnScroll:l=!1,panOnScrollSpeed:o=.5,panOnScrollMode:s=Yi.Free,zoomOnDoubleClick:u=!0,panOnDrag:f=!0,defaultViewport:d,translateExtent:h,minZoom:m,maxZoom:p,zoomActivationKeyCode:y,preventScrolling:v=!0,children:b,noWheelClassName:C,noPanClassName:S,onViewportChange:_,isControlledViewport:z,paneClickDistance:w,selectionOnDrag:T}){const U=pt(),A=X.useRef(null),{userSelectionActive:L,lib:q,connectionInProgress:I}=Ve(J3,dt),$=Io(y),R=X.useRef();K3(A);const D=X.useCallback(ee=>{_==null||_({x:ee[0],y:ee[1],zoom:ee[2]}),z||U.setState({transform:ee})},[_,z]);return X.useEffect(()=>{if(A.current){R.current=r3({domNode:A.current,minZoom:m,maxZoom:p,translateExtent:h,viewport:d,onDraggingChange:j=>U.setState(Y=>Y.paneDragging===j?Y:{paneDragging:j}),onPanZoomStart:(j,Y)=>{const{onViewportChangeStart:Z,onMoveStart:K}=U.getState();K==null||K(j,Y),Z==null||Z(Y)},onPanZoom:(j,Y)=>{const{onViewportChange:Z,onMove:K}=U.getState();K==null||K(j,Y),Z==null||Z(Y)},onPanZoomEnd:(j,Y)=>{const{onViewportChangeEnd:Z,onMoveEnd:K}=U.getState();K==null||K(j,Y),Z==null||Z(Y)}});const{x:ee,y:H,zoom:G}=R.current.getViewport();return U.setState({panZoom:R.current,transform:[ee,H,G],domNode:A.current.closest(".react-flow")}),()=>{var j;(j=R.current)==null||j.destroy()}}},[]),X.useEffect(()=>{var ee;(ee=R.current)==null||ee.update({onPaneContextMenu:e,zoomOnScroll:n,zoomOnPinch:i,panOnScroll:l,panOnScrollSpeed:o,panOnScrollMode:s,zoomOnDoubleClick:u,panOnDrag:f,zoomActivationKeyPressed:$,preventScrolling:v,noPanClassName:S,userSelectionActive:L,noWheelClassName:C,lib:q,onTransformChange:D,connectionInProgress:I,selectionOnDrag:T,paneClickDistance:w})},[e,n,i,l,o,s,u,f,$,v,S,L,C,q,D,I,T,w]),E.jsx("div",{className:"react-flow__renderer",ref:A,style:Ec,children:b})}const eM=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function tM(){const{userSelectionActive:e,userSelectionRect:n}=Ve(eM,dt);return e&&n?E.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 ch=(e,n)=>i=>{i.target===n.current&&(e==null||e(i))},nM=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function rM({isSelecting:e,selectionKeyPressed:n,selectionMode:i=Bo.Full,panOnDrag:l,paneClickDistance:o,selectionOnDrag:s,onSelectionStart:u,onSelectionEnd:f,onPaneClick:d,onPaneContextMenu:h,onPaneScroll:m,onPaneMouseEnter:p,onPaneMouseMove:y,onPaneMouseLeave:v,children:b}){const C=pt(),{userSelectionActive:S,elementsSelectable:_,dragging:z,connectionInProgress:w}=Ve(nM,dt),T=_&&(e||S),U=X.useRef(null),A=X.useRef(),L=X.useRef(new Set),q=X.useRef(new Set),I=X.useRef(!1),$=Z=>{if(I.current||w){I.current=!1;return}d==null||d(Z),C.getState().resetSelectedElements(),C.setState({nodesSelectionActive:!1})},R=Z=>{if(Array.isArray(l)&&(l!=null&&l.includes(2))){Z.preventDefault();return}h==null||h(Z)},D=m?Z=>m(Z):void 0,ee=Z=>{I.current&&(Z.stopPropagation(),I.current=!1)},H=Z=>{var F,J;const{domNode:K}=C.getState();if(A.current=K==null?void 0:K.getBoundingClientRect(),!A.current)return;const M=Z.target===U.current;if(!M&&!!Z.target.closest(".nokey")||!e||!(s&&M||n)||Z.button!==0||!Z.isPrimary)return;(J=(F=Z.target)==null?void 0:F.setPointerCapture)==null||J.call(F,Z.pointerId),I.current=!1;const{x:N,y:V}=In(Z.nativeEvent,A.current);C.setState({userSelectionRect:{width:0,height:0,startX:N,startY:V,x:N,y:V}}),M||(Z.stopPropagation(),Z.preventDefault())},G=Z=>{const{userSelectionRect:K,transform:M,nodeLookup:B,edgeLookup:P,connectionLookup:N,triggerNodeChanges:V,triggerEdgeChanges:F,defaultEdgeOptions:J,resetSelectedElements:ne}=C.getState();if(!A.current||!K)return;const{x:re,y:se}=In(Z.nativeEvent,A.current),{startX:ge,startY:xe}=K;if(!I.current){const Ce=n?0:o;if(Math.hypot(re-ge,se-xe)<=Ce)return;ne(),u==null||u(Z)}I.current=!0;const ye={startX:ge,startY:xe,x:reCe.id)),q.current=new Set;const Me=(J==null?void 0:J.selectable)??!0;for(const Ce of L.current){const lt=N.get(Ce);if(lt)for(const{edgeId:Je}of lt.values()){const Tt=P.get(Je);Tt&&(Tt.selectable??Me)&&q.current.add(Je)}}if(!sv(he,L.current)){const Ce=$l(B,L.current,!0);V(Ce)}if(!sv(Se,q.current)){const Ce=$l(P,q.current);F(Ce)}C.setState({userSelectionRect:ye,userSelectionActive:!0,nodesSelectionActive:!1})},j=Z=>{var K,M;Z.button===0&&((M=(K=Z.target)==null?void 0:K.releasePointerCapture)==null||M.call(K,Z.pointerId),!S&&Z.target===U.current&&C.getState().userSelectionRect&&($==null||$(Z)),C.setState({userSelectionActive:!1,userSelectionRect:null}),I.current&&(f==null||f(Z),C.setState({nodesSelectionActive:L.current.size>0})))},Y=l===!0||Array.isArray(l)&&l.includes(0);return E.jsxs("div",{className:At(["react-flow__pane",{draggable:Y,dragging:z,selection:e}]),onClick:T?void 0:ch($,U),onContextMenu:ch(R,U),onWheel:ch(D,U),onPointerEnter:T?void 0:p,onPointerMove:T?G:y,onPointerUp:T?j:void 0,onPointerDownCapture:T?H:void 0,onClickCapture:T?ee:void 0,onPointerLeave:v,ref:U,style:Ec,children:[b,E.jsx(tM,{})]})}function Bp({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 SS({nodeRef:e,disabled:n=!1,noDragClassName:i,handleSelector:l,nodeId:o,isSelectable:s,nodeClickDistance:u}){const f=pt(),[d,h]=X.useState(!1),m=X.useRef();return X.useEffect(()=>{m.current=GT({getStoreItems:()=>f.getState(),onNodeMouseDown:p=>{Bp({id:p,store:f,nodeRef:e})},onDragStart:()=>{h(!0)},onDragStop:()=>{h(!1)}})},[]),X.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 iM=e=>n=>n.selected&&(n.draggable||e&&typeof n.draggable>"u");function _S(){const e=pt();return X.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=iM(u),v=o?s[0]:5,b=o?s[1]:5,C=i.direction.x*v*i.factor,S=i.direction.y*b*i.factor;for(const[,_]of h){if(!y(_))continue;let z={x:_.internals.positionAbsolute.x+C,y:_.internals.positionAbsolute.y+S};o&&(z=Zo(z,s));const{position:w,positionAbsolute:T}=Gw({nodeId:_.id,nextPosition:z,nodeLookup:h,nodeExtent:l,nodeOrigin:m,onError:f});_.position=w,_.internals.positionAbsolute=T,p.set(_.id,_)}d(p)},[])}const ym=X.createContext(null),lM=ym.Provider;ym.Consumer;const ES=()=>X.useContext(ym),aM=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),oM=(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===na.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 sM({type:e="source",position:n=be.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,j;const b=u||null,C=e==="target",S=pt(),_=ES(),{connectOnClick:z,noPanClassName:w,rfId:T}=Ve(aM,dt),{connectingFrom:U,connectingTo:A,clickConnecting:L,isPossibleEndHandle:q,connectionInProcess:I,clickConnectionInProcess:$,valid:R}=Ve(oM(_,b,e),dt);_||(j=(G=S.getState()).onError)==null||j.call(G,"010",tr.error010());const D=Y=>{const{defaultEdgeOptions:Z,onConnect:K,hasDefaultEdges:M}=S.getState(),B={...Z,...Y};if(M){const{edges:P,setEdges:N}=S.getState();N(CT(B,P))}K==null||K(B),f==null||f(B)},ee=Y=>{if(!_)return;const Z=Kw(Y.nativeEvent);if(o&&(Z&&Y.button===0||!Z)){const K=S.getState();Hp.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:C,handleId:b,nodeId:_,flowId:K.rfId,panBy:K.panBy,cancelConnection:K.cancelConnection,onConnectStart:K.onConnectStart,onConnectEnd:(...M)=>{var B,P;return(P=(B=S.getState()).onConnectEnd)==null?void 0:P.call(B,...M)},updateConnection:K.updateConnection,onConnect:D,isValidConnection:i||((...M)=>{var B,P;return((P=(B=S.getState()).isValidConnection)==null?void 0:P.call(B,...M))??!0}),getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,autoPanSpeed:K.autoPanSpeed,dragThreshold:K.connectionDragThreshold})}Z?m==null||m(Y):p==null||p(Y)},H=Y=>{const{onClickConnectStart:Z,onClickConnectEnd:K,connectionClickStartHandle:M,connectionMode:B,isValidConnection:P,lib:N,rfId:V,nodeLookup:F,connection:J}=S.getState();if(!_||!M&&!o)return;if(!M){Z==null||Z(Y.nativeEvent,{nodeId:_,handleId:b,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:_,type:e,id:b}});return}const ne=Qw(Y.target),re=i||P,{connection:se,isValid:ge}=Hp.isValid(Y.nativeEvent,{handle:{nodeId:_,id:b,type:e},connectionMode:B,fromNodeId:M.nodeId,fromHandleId:M.id||null,fromType:M.type,isValidConnection:re,flowId:V,doc:ne,lib:N,nodeLookup:F});ge&&se&&D(se);const xe=structuredClone(J);delete xe.inProgress,xe.toPosition=xe.toHandle?xe.toHandle.position:null,K==null||K(Y,xe),S.setState({connectionClickStartHandle:null})};return E.jsx("div",{"data-handleid":b,"data-nodeid":_,"data-handlepos":n,"data-id":`${T}-${_}-${b}-${e}`,className:At(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",w,h,{source:!C,target:C,connectable:l,connectablestart:o,connectableend:s,clickconnecting:L,connectingfrom:U,connectingto:A,valid:R,connectionindicator:l&&(!I||q)&&(I||$?s:o)}]),onMouseDown:ee,onTouchStart:ee,onClick:z?H:void 0,ref:v,...y,children:d})}const on=X.memo(bS(sM));function uM({data:e,isConnectable:n,sourcePosition:i=be.Bottom}){return E.jsxs(E.Fragment,{children:[e==null?void 0:e.label,E.jsx(on,{type:"source",position:i,isConnectable:n})]})}function cM({data:e,isConnectable:n,targetPosition:i=be.Top,sourcePosition:l=be.Bottom}){return E.jsxs(E.Fragment,{children:[E.jsx(on,{type:"target",position:i,isConnectable:n}),e==null?void 0:e.label,E.jsx(on,{type:"source",position:l,isConnectable:n})]})}function fM(){return null}function dM({data:e,isConnectable:n,targetPosition:i=be.Top}){return E.jsxs(E.Fragment,{children:[E.jsx(on,{type:"target",position:i,isConnectable:n}),e==null?void 0:e.label]})}const ac={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Bv={input:uM,default:cM,output:dM,group:fM};function hM(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 pM=e=>{const{width:n,height:i,x:l,y:o}=Qo(e.nodeLookup,{filter:s=>!!s.selected});return{width:Un(n)?n:null,height:Un(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 mM({onSelectionContextMenu:e,noPanClassName:n,disableKeyboardA11y:i}){const l=pt(),{width:o,height:s,transformString:u,userSelectionActive:f}=Ve(pM,dt),d=_S(),h=X.useRef(null);X.useEffect(()=>{var v;i||(v=h.current)==null||v.focus({preventScroll:!0})},[i]);const m=!f&&o!==null&&s!==null;if(SS({nodeRef:h,disabled:!m}),!m)return null;const p=e?v=>{const b=l.getState().nodes.filter(C=>C.selected);e(v,b)}:void 0,y=v=>{Object.prototype.hasOwnProperty.call(ac,v.key)&&(v.preventDefault(),d({direction:ac[v.key],factor:v.shiftKey?4:1}))};return E.jsx("div",{className:At(["react-flow__nodesselection","react-flow__container",n]),style:{transform:u},children:E.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 qv=typeof window<"u"?window:void 0,gM=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function NS({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:b,panActivationKeyCode:C,zoomActivationKeyCode:S,elementsSelectable:_,zoomOnScroll:z,zoomOnPinch:w,panOnScroll:T,panOnScrollSpeed:U,panOnScrollMode:A,zoomOnDoubleClick:L,panOnDrag:q,defaultViewport:I,translateExtent:$,minZoom:R,maxZoom:D,preventScrolling:ee,onSelectionContextMenu:H,noWheelClassName:G,noPanClassName:j,disableKeyboardA11y:Y,onViewportChange:Z,isControlledViewport:K}){const{nodesSelectionActive:M,userSelectionActive:B}=Ve(gM,dt),P=Io(h,{target:qv}),N=Io(C,{target:qv}),V=N||q,F=N||T,J=m&&V!==!0,ne=P||B||J;return Z3({deleteKeyCode:d,multiSelectionKeyCode:b}),E.jsx(W3,{onPaneContextMenu:s,elementsSelectable:_,zoomOnScroll:z,zoomOnPinch:w,panOnScroll:F,panOnScrollSpeed:U,panOnScrollMode:A,zoomOnDoubleClick:L,panOnDrag:!P&&V,defaultViewport:I,translateExtent:$,minZoom:R,maxZoom:D,zoomActivationKeyCode:S,preventScrolling:ee,noWheelClassName:G,noPanClassName:j,onViewportChange:Z,isControlledViewport:K,paneClickDistance:f,selectionOnDrag:J,children:E.jsxs(rM,{onSelectionStart:y,onSelectionEnd:v,onPaneClick:n,onPaneMouseEnter:i,onPaneMouseMove:l,onPaneMouseLeave:o,onPaneContextMenu:s,onPaneScroll:u,panOnDrag:V,isSelecting:!!ne,selectionMode:p,selectionKeyPressed:P,paneClickDistance:f,selectionOnDrag:J,children:[e,M&&E.jsx(mM,{onSelectionContextMenu:H,noPanClassName:j,disableKeyboardA11y:Y})]})})}NS.displayName="FlowRenderer";const yM=X.memo(NS),xM=e=>n=>e?sm(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 vM(e){return Ve(X.useCallback(xM(e),[e]),dt)}const bM=e=>e.updateNodeInternals;function wM(){const e=Ve(bM),[n]=X.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 X.useEffect(()=>()=>{n==null||n.disconnect()},[n]),n}function SM({node:e,nodeType:n,hasDimensions:i,resizeObserver:l}){const o=pt(),s=X.useRef(null),u=X.useRef(null),f=X.useRef(e.sourcePosition),d=X.useRef(e.targetPosition),h=X.useRef(n),m=i&&!!e.internals.handleBounds;return X.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]),X.useEffect(()=>()=>{u.current&&(l==null||l.unobserve(u.current),u.current=null)},[]),X.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 _M({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:b,rfId:C,nodeTypes:S,nodeClickDistance:_,onError:z}){const{node:w,internals:T,isParent:U}=Ve(re=>{const se=re.nodeLookup.get(e),ge=re.parentLookup.has(e);return{node:se,internals:se.internals,isParent:ge}},dt);let A=w.type||"default",L=(S==null?void 0:S[A])||Bv[A];L===void 0&&(z==null||z("003",tr.error003(A)),A="default",L=(S==null?void 0:S.default)||Bv.default);const q=!!(w.draggable||f&&typeof w.draggable>"u"),I=!!(w.selectable||d&&typeof w.selectable>"u"),$=!!(w.connectable||h&&typeof w.connectable>"u"),R=!!(w.focusable||m&&typeof w.focusable>"u"),D=pt(),ee=Pw(w),H=SM({node:w,nodeType:A,hasDimensions:ee,resizeObserver:p}),G=SS({nodeRef:H,disabled:w.hidden||!q,noDragClassName:y,handleSelector:w.dragHandle,nodeId:e,isSelectable:I,nodeClickDistance:_}),j=_S();if(w.hidden)return null;const Y=Mr(w),Z=hM(w),K=I||q||n||i||l||o,M=i?re=>i(re,{...T.userNode}):void 0,B=l?re=>l(re,{...T.userNode}):void 0,P=o?re=>o(re,{...T.userNode}):void 0,N=s?re=>s(re,{...T.userNode}):void 0,V=u?re=>u(re,{...T.userNode}):void 0,F=re=>{const{selectNodesOnDrag:se,nodeDragThreshold:ge}=D.getState();I&&(!se||!q||ge>0)&&Bp({id:e,store:D,nodeRef:H}),n&&n(re,{...T.userNode})},J=re=>{if(!(Zw(re.nativeEvent)||b)){if(Bw.includes(re.key)&&I){const se=re.key==="Escape";Bp({id:e,store:D,unselect:se,nodeRef:H})}else if(q&&w.selected&&Object.prototype.hasOwnProperty.call(ac,re.key)){re.preventDefault();const{ariaLabelConfig:se}=D.getState();D.setState({ariaLiveMessage:se["node.a11yDescription.ariaLiveMessage"]({direction:re.key.replace("Arrow","").toLowerCase(),x:~~T.positionAbsolute.x,y:~~T.positionAbsolute.y})}),j({direction:ac[re.key],factor:re.shiftKey?4:1})}}},ne=()=>{var Se;if(b||!((Se=H.current)!=null&&Se.matches(":focus-visible")))return;const{transform:re,width:se,height:ge,autoPanOnNodeFocus:xe,setCenter:ye}=D.getState();if(!xe)return;sm(new Map([[e,w]]),{x:0,y:0,width:se,height:ge},re,!0).length>0||ye(w.position.x+Y.width/2,w.position.y+Y.height/2,{zoom:re[2]})};return E.jsx("div",{className:At(["react-flow__node",`react-flow__node-${A}`,{[v]:q},w.className,{selected:w.selected,selectable:I,parent:U,draggable:q,dragging:G}]),ref:H,style:{zIndex:T.z,transform:`translate(${T.positionAbsolute.x}px,${T.positionAbsolute.y}px)`,pointerEvents:K?"all":"none",visibility:ee?"visible":"hidden",...w.style,...Z},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:M,onMouseMove:B,onMouseLeave:P,onContextMenu:N,onClick:F,onDoubleClick:V,onKeyDown:R?J:void 0,tabIndex:R?0:void 0,onFocus:R?ne:void 0,role:w.ariaRole??(R?"group":void 0),"aria-roledescription":"node","aria-describedby":b?void 0:`${pS}-${C}`,"aria-label":w.ariaLabel,...w.domAttributes,children:E.jsx(lM,{value:e,children:E.jsx(L,{id:e,data:w.data,type:A,positionAbsoluteX:T.positionAbsolute.x,positionAbsoluteY:T.positionAbsolute.y,selected:w.selected??!1,selectable:I,draggable:q,deletable:w.deletable??!0,isConnectable:$,sourcePosition:w.sourcePosition,targetPosition:w.targetPosition,dragging:G,dragHandle:w.dragHandle,zIndex:T.z,parentId:w.parentId,...Y})})})}var EM=X.memo(_M);const NM=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function kS(e){const{nodesDraggable:n,nodesConnectable:i,nodesFocusable:l,elementsSelectable:o,onError:s}=Ve(NM,dt),u=vM(e.onlyRenderVisibleElements),f=wM();return E.jsx("div",{className:"react-flow__nodes",style:Ec,children:u.map(d=>E.jsx(EM,{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))})}kS.displayName="NodeRenderer";const kM=X.memo(kS);function CM(e){return Ve(X.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&&ET({sourceNode:s,targetNode:u,width:i.width,height:i.height,transform:i.transform})&&l.push(o.id)}return l},[e]),dt)}const zM=({color:e="none",strokeWidth:n=1})=>{const i={strokeWidth:n,...e&&{stroke:e}};return E.jsx("polyline",{className:"arrow",style:i,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},AM=({color:e="none",strokeWidth:n=1})=>{const i={strokeWidth:n,...e&&{stroke:e,fill:e}};return E.jsx("polyline",{className:"arrowclosed",style:i,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Uv={[rc.Arrow]:zM,[rc.ArrowClosed]:AM};function TM(e){const n=pt();return X.useMemo(()=>{var o,s;return Object.prototype.hasOwnProperty.call(Uv,e)?Uv[e]:((s=(o=n.getState()).onError)==null||s.call(o,"009",tr.error009(e)),null)},[e])}const MM=({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=TM(n);return d?E.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:E.jsx(d,{color:i,strokeWidth:u})}):null},CS=({defaultColor:e,rfId:n})=>{const i=Ve(s=>s.edges),l=Ve(s=>s.defaultEdgeOptions),o=X.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?E.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:E.jsx("defs",{children:o.map(s=>E.jsx(MM,{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};CS.displayName="MarkerDefinitions";var jM=X.memo(CS);function zS({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]=X.useState({x:1,y:0,width:0,height:0}),v=At(["react-flow__edge-textwrapper",h]),b=X.useRef(null);return X.useEffect(()=>{if(b.current){const C=b.current.getBBox();y({x:C.x,y:C.y,width:C.width,height:C.height})}},[i]),i?E.jsxs("g",{transform:`translate(${e-p.width/2} ${n-p.height/2})`,className:v,visibility:p.width?"visible":"hidden",...m,children:[o&&E.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}),E.jsx("text",{className:"react-flow__edge-text",y:p.height/2,dy:"0.3em",ref:b,style:l,children:i}),d]}):null}zS.displayName="EdgeText";const OM=X.memo(zS);function Wo({path:e,labelX:n,labelY:i,label:l,labelStyle:o,labelShowBg:s,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d,interactionWidth:h=20,...m}){return E.jsxs(E.Fragment,{children:[E.jsx("path",{...m,d:e,fill:"none",className:At(["react-flow__edge-path",m.className])}),h?E.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}):null,l&&Un(n)&&Un(i)?E.jsx(OM,{x:n,y:i,label:l,labelStyle:o,labelShowBg:s,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d}):null]})}function Iv({pos:e,x1:n,y1:i,x2:l,y2:o}){return e===be.Left||e===be.Right?[.5*(n+l),i]:[n,.5*(i+o)]}function AS({sourceX:e,sourceY:n,sourcePosition:i=be.Bottom,targetX:l,targetY:o,targetPosition:s=be.Top}){const[u,f]=Iv({pos:i,x1:e,y1:n,x2:l,y2:o}),[d,h]=Iv({pos:s,x1:l,y1:o,x2:e,y2:n}),[m,p,y,v]=Jw({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 TS(e){return X.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:b,markerEnd:C,markerStart:S,interactionWidth:_})=>{const[z,w,T]=AS({sourceX:i,sourceY:l,sourcePosition:u,targetX:o,targetY:s,targetPosition:f}),U=e.isInternal?void 0:n;return E.jsx(Wo,{id:U,path:z,labelX:w,labelY:T,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:y,labelBgBorderRadius:v,style:b,markerEnd:C,markerStart:S,interactionWidth:_})})}const DM=TS({isInternal:!1}),MS=TS({isInternal:!0});DM.displayName="SimpleBezierEdge";MS.displayName="SimpleBezierEdgeInternal";function jS(e){return X.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=be.Bottom,targetPosition:b=be.Top,markerEnd:C,markerStart:S,pathOptions:_,interactionWidth:z})=>{const[w,T,U]=Dp({sourceX:i,sourceY:l,sourcePosition:v,targetX:o,targetY:s,targetPosition:b,borderRadius:_==null?void 0:_.borderRadius,offset:_==null?void 0:_.offset,stepPosition:_==null?void 0:_.stepPosition}),A=e.isInternal?void 0:n;return E.jsx(Wo,{id:A,path:w,labelX:T,labelY:U,label:u,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:y,markerEnd:C,markerStart:S,interactionWidth:z})})}const OS=jS({isInternal:!1}),DS=jS({isInternal:!0});OS.displayName="SmoothStepEdge";DS.displayName="SmoothStepEdgeInternal";function RS(e){return X.memo(({id:n,...i})=>{var o;const l=e.isInternal?void 0:n;return E.jsx(OS,{...i,id:l,pathOptions:X.useMemo(()=>{var s;return{borderRadius:0,offset:(s=i.pathOptions)==null?void 0:s.offset}},[(o=i.pathOptions)==null?void 0:o.offset])})})}const RM=RS({isInternal:!1}),LS=RS({isInternal:!0});RM.displayName="StepEdge";LS.displayName="StepEdgeInternal";function HS(e){return X.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:b,interactionWidth:C})=>{const[S,_,z]=eS({sourceX:i,sourceY:l,targetX:o,targetY:s}),w=e.isInternal?void 0:n;return E.jsx(Wo,{id:w,path:S,labelX:_,labelY:z,label:u,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:p,style:y,markerEnd:v,markerStart:b,interactionWidth:C})})}const LM=HS({isInternal:!1}),BS=HS({isInternal:!0});LM.displayName="StraightEdge";BS.displayName="StraightEdgeInternal";function qS(e){return X.memo(({id:n,sourceX:i,sourceY:l,targetX:o,targetY:s,sourcePosition:u=be.Bottom,targetPosition:f=be.Top,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:y,labelBgBorderRadius:v,style:b,markerEnd:C,markerStart:S,pathOptions:_,interactionWidth:z})=>{const[w,T,U]=fm({sourceX:i,sourceY:l,sourcePosition:u,targetX:o,targetY:s,targetPosition:f,curvature:_==null?void 0:_.curvature}),A=e.isInternal?void 0:n;return E.jsx(Wo,{id:A,path:w,labelX:T,labelY:U,label:d,labelStyle:h,labelShowBg:m,labelBgStyle:p,labelBgPadding:y,labelBgBorderRadius:v,style:b,markerEnd:C,markerStart:S,interactionWidth:z})})}const HM=qS({isInternal:!1}),US=qS({isInternal:!0});HM.displayName="BezierEdge";US.displayName="BezierEdgeInternal";const Vv={default:US,straight:BS,step:LS,smoothstep:DS,simplebezier:MS},Gv={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},BM=(e,n,i)=>i===be.Left?e-n:i===be.Right?e+n:e,qM=(e,n,i)=>i===be.Top?e-n:i===be.Bottom?e+n:e,Yv="react-flow__edgeupdater";function $v({position:e,centerX:n,centerY:i,radius:l=10,onMouseDown:o,onMouseEnter:s,onMouseOut:u,type:f}){return E.jsx("circle",{onMouseDown:o,onMouseEnter:s,onMouseOut:u,className:At([Yv,`${Yv}-${f}`]),cx:BM(n,l,e),cy:qM(i,l,e),r:l,stroke:"transparent",fill:"transparent"})}function UM({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 b=pt(),C=(T,U)=>{if(T.button!==0)return;const{autoPanOnConnect:A,domNode:L,connectionMode:q,connectionRadius:I,lib:$,onConnectStart:R,cancelConnection:D,nodeLookup:ee,rfId:H,panBy:G,updateConnection:j}=b.getState(),Y=U.type==="target",Z=(B,P)=>{y(!1),p==null||p(B,i,U.type,P)},K=B=>h==null?void 0:h(i,B),M=(B,P)=>{y(!0),m==null||m(T,i,U.type),R==null||R(B,P)};Hp.onPointerDown(T.nativeEvent,{autoPanOnConnect:A,connectionMode:q,connectionRadius:I,domNode:L,handleId:U.id,nodeId:U.nodeId,nodeLookup:ee,isTarget:Y,edgeUpdaterType:U.type,lib:$,flowId:H,cancelConnection:D,panBy:G,isValidConnection:(...B)=>{var P,N;return((N=(P=b.getState()).isValidConnection)==null?void 0:N.call(P,...B))??!0},onConnect:K,onConnectStart:M,onConnectEnd:(...B)=>{var P,N;return(N=(P=b.getState()).onConnectEnd)==null?void 0:N.call(P,...B)},onReconnectEnd:Z,updateConnection:j,getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,dragThreshold:b.getState().connectionDragThreshold,handleDomNode:T.currentTarget})},S=T=>C(T,{nodeId:i.target,id:i.targetHandle??null,type:"target"}),_=T=>C(T,{nodeId:i.source,id:i.sourceHandle??null,type:"source"}),z=()=>v(!0),w=()=>v(!1);return E.jsxs(E.Fragment,{children:[(e===!0||e==="source")&&E.jsx($v,{position:f,centerX:l,centerY:o,radius:n,onMouseDown:S,onMouseEnter:z,onMouseOut:w,type:"source"}),(e===!0||e==="target")&&E.jsx($v,{position:d,centerX:s,centerY:u,radius:n,onMouseDown:_,onMouseEnter:z,onMouseOut:w,type:"target"})]})}function IM({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:b,edgeTypes:C,noPanClassName:S,onError:_,disableKeyboardA11y:z}){let w=Ve(ye=>ye.edgeLookup.get(e));const T=Ve(ye=>ye.defaultEdgeOptions);w=T?{...T,...w}:w;let U=w.type||"default",A=(C==null?void 0:C[U])||Vv[U];A===void 0&&(_==null||_("011",tr.error011(U)),U="default",A=(C==null?void 0:C.default)||Vv.default);const L=!!(w.focusable||n&&typeof w.focusable>"u"),q=typeof p<"u"&&(w.reconnectable||i&&typeof w.reconnectable>"u"),I=!!(w.selectable||l&&typeof w.selectable>"u"),$=X.useRef(null),[R,D]=X.useState(!1),[ee,H]=X.useState(!1),G=pt(),{zIndex:j,sourceX:Y,sourceY:Z,targetX:K,targetY:M,sourcePosition:B,targetPosition:P}=Ve(X.useCallback(ye=>{const he=ye.nodeLookup.get(w.source),Se=ye.nodeLookup.get(w.target);if(!he||!Se)return{zIndex:w.zIndex,...Gv};const Me=MT({id:e,sourceNode:he,targetNode:Se,sourceHandle:w.sourceHandle||null,targetHandle:w.targetHandle||null,connectionMode:ye.connectionMode,onError:_});return{zIndex:_T({selected:w.selected,zIndex:w.zIndex,sourceNode:he,targetNode:Se,elevateOnSelect:ye.elevateEdgesOnSelect,zIndexMode:ye.zIndexMode}),...Me||Gv}},[w.source,w.target,w.sourceHandle,w.targetHandle,w.selected,w.zIndex]),dt),N=X.useMemo(()=>w.markerStart?`url('#${Rp(w.markerStart,b)}')`:void 0,[w.markerStart,b]),V=X.useMemo(()=>w.markerEnd?`url('#${Rp(w.markerEnd,b)}')`:void 0,[w.markerEnd,b]);if(w.hidden||Y===null||Z===null||K===null||M===null)return null;const F=ye=>{var Ce;const{addSelectedEdges:he,unselectNodesAndEdges:Se,multiSelectionActive:Me}=G.getState();I&&(G.setState({nodesSelectionActive:!1}),w.selected&&Me?(Se({nodes:[],edges:[w]}),(Ce=$.current)==null||Ce.blur()):he([e])),o&&o(ye,w)},J=s?ye=>{s(ye,{...w})}:void 0,ne=u?ye=>{u(ye,{...w})}:void 0,re=f?ye=>{f(ye,{...w})}:void 0,se=d?ye=>{d(ye,{...w})}:void 0,ge=h?ye=>{h(ye,{...w})}:void 0,xe=ye=>{var he;if(!z&&Bw.includes(ye.key)&&I){const{unselectNodesAndEdges:Se,addSelectedEdges:Me}=G.getState();ye.key==="Escape"?((he=$.current)==null||he.blur(),Se({edges:[w]})):Me([e])}};return E.jsx("svg",{style:{zIndex:j},children:E.jsxs("g",{className:At(["react-flow__edge",`react-flow__edge-${U}`,w.className,S,{selected:w.selected,animated:w.animated,inactive:!I&&!o,updating:R,selectable:I}]),onClick:F,onDoubleClick:J,onContextMenu:ne,onMouseEnter:re,onMouseMove:se,onMouseLeave:ge,onKeyDown:L?xe:void 0,tabIndex:L?0:void 0,role:w.ariaRole??(L?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":w.ariaLabel===null?void 0:w.ariaLabel||`Edge from ${w.source} to ${w.target}`,"aria-describedby":L?`${mS}-${b}`:void 0,ref:$,...w.domAttributes,children:[!ee&&E.jsx(A,{id:e,source:w.source,target:w.target,type:w.type,selected:w.selected,animated:w.animated,selectable:I,deletable:w.deletable??!0,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,sourceX:Y,sourceY:Z,targetX:K,targetY:M,sourcePosition:B,targetPosition:P,data:w.data,style:w.style,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerStart:N,markerEnd:V,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth}),q&&E.jsx(UM,{edge:w,isReconnectable:q,reconnectRadius:m,onReconnect:p,onReconnectStart:y,onReconnectEnd:v,sourceX:Y,sourceY:Z,targetX:K,targetY:M,sourcePosition:B,targetPosition:P,setUpdateHover:D,setReconnecting:H})]})})}var VM=X.memo(IM);const GM=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function IS({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:b,disableKeyboardA11y:C}){const{edgesFocusable:S,edgesReconnectable:_,elementsSelectable:z,onError:w}=Ve(GM,dt),T=CM(n);return E.jsxs("div",{className:"react-flow__edges",children:[E.jsx(jM,{defaultColor:e,rfId:i}),T.map(U=>E.jsx(VM,{id:U,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:b,rfId:i,onError:w,edgeTypes:l,disableKeyboardA11y:C},U))]})}IS.displayName="EdgeRenderer";const YM=X.memo(IS),$M=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function XM({children:e}){const n=Ve($M);return E.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:e})}function PM(e){const n=Jo(),i=X.useRef(!1);X.useEffect(()=>{!i.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),i.current=!0)},[e,n.viewportInitialized])}const FM=e=>{var n;return(n=e.panZoom)==null?void 0:n.syncViewport};function QM(e){const n=Ve(FM),i=pt();return X.useEffect(()=>{e&&(n==null||n(e),i.setState({transform:[e.x,e.y,e.zoom]}))},[e,n]),null}function ZM(e){return e.connection.inProgress?{...e.connection,to:Ko(e.connection.to,e.transform)}:{...e.connection}}function KM(e){return ZM}function JM(e){const n=KM();return Ve(n,dt)}const WM=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function e4({containerStyle:e,style:n,type:i,component:l}){const{nodesConnectable:o,width:s,height:u,isValid:f,inProgress:d}=Ve(WM,dt);return!(s&&o&&d)?null:E.jsx("svg",{style:e,width:s,height:u,className:"react-flow__connectionline react-flow__container",children:E.jsx("g",{className:At(["react-flow__connection",Iw(f)]),children:E.jsx(VS,{style:n,type:i,CustomComponent:l,isValid:f})})})}const VS=({style:e,type:n=pi.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}=JM();if(!o)return;if(i)return E.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:Iw(l),toNode:m,toHandle:p,pointer:v});let b="";const C={sourceX:s.x,sourceY:s.y,sourcePosition:d,targetX:h.x,targetY:h.y,targetPosition:y};switch(n){case pi.Bezier:[b]=fm(C);break;case pi.SimpleBezier:[b]=AS(C);break;case pi.Step:[b]=Dp({...C,borderRadius:0});break;case pi.SmoothStep:[b]=Dp(C);break;default:[b]=eS(C)}return E.jsx("path",{d:b,fill:"none",className:"react-flow__connection-path",style:e})};VS.displayName="ConnectionLine";const t4={};function Xv(e=t4){X.useRef(e),pt(),X.useEffect(()=>{},[e])}function n4(){pt(),X.useRef(!1),X.useEffect(()=>{},[])}function GS({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:b,connectionLineStyle:C,connectionLineComponent:S,connectionLineContainerStyle:_,selectionKeyCode:z,selectionOnDrag:w,selectionMode:T,multiSelectionKeyCode:U,panActivationKeyCode:A,zoomActivationKeyCode:L,deleteKeyCode:q,onlyRenderVisibleElements:I,elementsSelectable:$,defaultViewport:R,translateExtent:D,minZoom:ee,maxZoom:H,preventScrolling:G,defaultMarkerColor:j,zoomOnScroll:Y,zoomOnPinch:Z,panOnScroll:K,panOnScrollSpeed:M,panOnScrollMode:B,zoomOnDoubleClick:P,panOnDrag:N,onPaneClick:V,onPaneMouseEnter:F,onPaneMouseMove:J,onPaneMouseLeave:ne,onPaneScroll:re,onPaneContextMenu:se,paneClickDistance:ge,nodeClickDistance:xe,onEdgeContextMenu:ye,onEdgeMouseEnter:he,onEdgeMouseMove:Se,onEdgeMouseLeave:Me,reconnectRadius:Ce,onReconnect:lt,onReconnectStart:Je,onReconnectEnd:Tt,noDragClassName:Vt,noWheelClassName:Lt,noPanClassName:Sn,disableKeyboardA11y:jn,nodeExtent:Mt,rfId:jr,viewport:ue,onViewportChange:me}){return Xv(e),Xv(n),n4(),PM(i),QM(ue),E.jsx(yM,{onPaneClick:V,onPaneMouseEnter:F,onPaneMouseMove:J,onPaneMouseLeave:ne,onPaneContextMenu:se,onPaneScroll:re,paneClickDistance:ge,deleteKeyCode:q,selectionKeyCode:z,selectionOnDrag:w,selectionMode:T,onSelectionStart:y,onSelectionEnd:v,multiSelectionKeyCode:U,panActivationKeyCode:A,zoomActivationKeyCode:L,elementsSelectable:$,zoomOnScroll:Y,zoomOnPinch:Z,zoomOnDoubleClick:P,panOnScroll:K,panOnScrollSpeed:M,panOnScrollMode:B,panOnDrag:N,defaultViewport:R,translateExtent:D,minZoom:ee,maxZoom:H,onSelectionContextMenu:p,preventScrolling:G,noDragClassName:Vt,noWheelClassName:Lt,noPanClassName:Sn,disableKeyboardA11y:jn,onViewportChange:me,isControlledViewport:!!ue,children:E.jsxs(XM,{children:[E.jsx(YM,{edgeTypes:n,onEdgeClick:o,onEdgeDoubleClick:u,onReconnect:lt,onReconnectStart:Je,onReconnectEnd:Tt,onlyRenderVisibleElements:I,onEdgeContextMenu:ye,onEdgeMouseEnter:he,onEdgeMouseMove:Se,onEdgeMouseLeave:Me,reconnectRadius:Ce,defaultMarkerColor:j,noPanClassName:Sn,disableKeyboardA11y:jn,rfId:jr}),E.jsx(e4,{style:C,type:b,component:S,containerStyle:_}),E.jsx("div",{className:"react-flow__edgelabel-renderer"}),E.jsx(kM,{nodeTypes:e,onNodeClick:l,onNodeDoubleClick:s,onNodeMouseEnter:f,onNodeMouseMove:d,onNodeMouseLeave:h,onNodeContextMenu:m,nodeClickDistance:xe,onlyRenderVisibleElements:I,noPanClassName:Sn,noDragClassName:Vt,disableKeyboardA11y:jn,nodeExtent:Mt,rfId:jr}),E.jsx("div",{className:"react-flow__viewport-portal"})]})})}GS.displayName="GraphView";const r4=X.memo(GS),Pv=({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,b=new Map,C=new Map,S=new Map,_=l??n??[],z=i??e??[],w=m??[0,0],T=p??Ho;rS(C,S,_);const U=Lp(z,v,b,{nodeOrigin:w,nodeExtent:T,zIndexMode:y});let A=[0,0,1];if(u&&o&&s){const L=Qo(v,{filter:R=>!!((R.width||R.initialWidth)&&(R.height||R.initialHeight))}),{x:q,y:I,zoom:$}=um(L,o,s,d,h,(f==null?void 0:f.padding)??.1);A=[q,I,$]}return{rfId:"1",width:o??0,height:s??0,transform:A,nodes:z,nodesInitialized:U,nodeLookup:v,parentLookup:b,edges:_,edgeLookup:S,connectionLookup:C,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:i!==void 0,hasDefaultEdges:l!==void 0,panZoom:null,minZoom:d,maxZoom:h,translateExtent:Ho,nodeExtent:T,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:na.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:w,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:{...Uw},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:yT,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:qw,zIndexMode:y,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},i4=({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})=>w3((v,b)=>{async function C(){const{nodeLookup:S,panZoom:_,fitViewOptions:z,fitViewResolver:w,width:T,height:U,minZoom:A,maxZoom:L}=b();_&&(await mT({nodes:S,width:T,height:U,panZoom:_,minZoom:A,maxZoom:L},z),w==null||w.resolve(!0),v({fitViewResolver:null}))}return{...Pv({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:w,elevateNodesOnSelect:T,fitViewQueued:U,zIndexMode:A}=b(),L=Lp(S,_,z,{nodeOrigin:w,nodeExtent:p,elevateNodesOnSelect:T,checkEquality:!0,zIndexMode:A});U&&L?(C(),v({nodes:S,nodesInitialized:L,fitViewQueued:!1,fitViewOptions:void 0})):v({nodes:S,nodesInitialized:L})},setEdges:S=>{const{connectionLookup:_,edgeLookup:z}=b();rS(_,z,S),v({edges:S})},setDefaultNodesAndEdges:(S,_)=>{if(S){const{setNodes:z}=b();z(S),v({hasDefaultNodes:!0})}if(_){const{setEdges:z}=b();z(_),v({hasDefaultEdges:!0})}},updateNodeInternals:S=>{const{triggerNodeChanges:_,nodeLookup:z,parentLookup:w,domNode:T,nodeOrigin:U,nodeExtent:A,debug:L,fitViewQueued:q,zIndexMode:I}=b(),{changes:$,updatedInternals:R}=qT(S,z,w,T,U,A,I);R&&(RT(z,w,{nodeOrigin:U,nodeExtent:A,zIndexMode:I}),q?(C(),v({fitViewQueued:!1,fitViewOptions:void 0})):v({}),($==null?void 0:$.length)>0&&(L&&console.log("React Flow: trigger node changes",$),_==null||_($)))},updateNodePositions:(S,_=!1)=>{const z=[];let w=[];const{nodeLookup:T,triggerNodeChanges:U,connection:A,updateConnection:L,onNodesChangeMiddlewareMap:q}=b();for(const[I,$]of S){const R=T.get(I),D=!!(R!=null&&R.expandParent&&(R!=null&&R.parentId)&&($!=null&&$.position)),ee={id:I,type:"position",position:D?{x:Math.max(0,$.position.x),y:Math.max(0,$.position.y)}:$.position,dragging:_};if(R&&A.inProgress&&A.fromNode.id===R.id){const H=Qi(R,A.fromHandle,be.Left,!0);L({...A,from:H})}D&&R.parentId&&z.push({id:I,parentId:R.parentId,rect:{...$.internals.positionAbsolute,width:$.measured.width??0,height:$.measured.height??0}}),w.push(ee)}if(z.length>0){const{parentLookup:I,nodeOrigin:$}=b(),R=gm(z,T,I,$);w.push(...R)}for(const I of q.values())w=I(w);U(w)},triggerNodeChanges:S=>{const{onNodesChange:_,setNodes:z,nodes:w,hasDefaultNodes:T,debug:U}=b();if(S!=null&&S.length){if(T){const A=xS(S,w);z(A)}U&&console.log("React Flow: trigger node changes",S),_==null||_(S)}},triggerEdgeChanges:S=>{const{onEdgesChange:_,setEdges:z,edges:w,hasDefaultEdges:T,debug:U}=b();if(S!=null&&S.length){if(T){const A=vS(S,w);z(A)}U&&console.log("React Flow: trigger edge changes",S),_==null||_(S)}},addSelectedNodes:S=>{const{multiSelectionActive:_,edgeLookup:z,nodeLookup:w,triggerNodeChanges:T,triggerEdgeChanges:U}=b();if(_){const A=S.map(L=>Bi(L,!0));T(A);return}T($l(w,new Set([...S]),!0)),U($l(z))},addSelectedEdges:S=>{const{multiSelectionActive:_,edgeLookup:z,nodeLookup:w,triggerNodeChanges:T,triggerEdgeChanges:U}=b();if(_){const A=S.map(L=>Bi(L,!0));U(A);return}U($l(z,new Set([...S]))),T($l(w,new Set,!0))},unselectNodesAndEdges:({nodes:S,edges:_}={})=>{const{edges:z,nodes:w,nodeLookup:T,triggerNodeChanges:U,triggerEdgeChanges:A}=b(),L=S||w,q=_||z,I=[];for(const R of L){if(!R.selected)continue;const D=T.get(R.id);D&&(D.selected=!1),I.push(Bi(R.id,!1))}const $=[];for(const R of q)R.selected&&$.push(Bi(R.id,!1));U(I),A($)},setMinZoom:S=>{const{panZoom:_,maxZoom:z}=b();_==null||_.setScaleExtent([S,z]),v({minZoom:S})},setMaxZoom:S=>{const{panZoom:_,minZoom:z}=b();_==null||_.setScaleExtent([z,S]),v({maxZoom:S})},setTranslateExtent:S=>{var _;(_=b().panZoom)==null||_.setTranslateExtent(S),v({translateExtent:S})},resetSelectedElements:()=>{const{edges:S,nodes:_,triggerNodeChanges:z,triggerEdgeChanges:w,elementsSelectable:T}=b();if(!T)return;const U=_.reduce((L,q)=>q.selected?[...L,Bi(q.id,!1)]:L,[]),A=S.reduce((L,q)=>q.selected?[...L,Bi(q.id,!1)]:L,[]);z(U),w(A)},setNodeExtent:S=>{const{nodes:_,nodeLookup:z,parentLookup:w,nodeOrigin:T,elevateNodesOnSelect:U,nodeExtent:A,zIndexMode:L}=b();S[0][0]===A[0][0]&&S[0][1]===A[0][1]&&S[1][0]===A[1][0]&&S[1][1]===A[1][1]||(Lp(_,z,w,{nodeOrigin:T,nodeExtent:S,elevateNodesOnSelect:U,checkEquality:!1,zIndexMode:L}),v({nodeExtent:S}))},panBy:S=>{const{transform:_,width:z,height:w,panZoom:T,translateExtent:U}=b();return UT({delta:S,panZoom:T,transform:_,translateExtent:U,width:z,height:w})},setCenter:async(S,_,z)=>{const{width:w,height:T,maxZoom:U,panZoom:A}=b();if(!A)return Promise.resolve(!1);const L=typeof(z==null?void 0:z.zoom)<"u"?z.zoom:U;return await A.setViewport({x:w/2-S*L,y:T/2-_*L,zoom:L},{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:{...Uw}})},updateConnection:S=>{v({connection:S})},reset:()=>v({...Pv()})}},Object.is);function l4({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[b]=X.useState(()=>i4({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 E.jsx(_3,{value:b,children:E.jsx(X3,{children:v})})}function a4({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 X.useContext(Sc)?E.jsx(E.Fragment,{children:e}):E.jsx(l4,{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 o4={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function s4({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:b,onConnectEnd:C,onClickConnectStart:S,onClickConnectEnd:_,onNodeMouseEnter:z,onNodeMouseMove:w,onNodeMouseLeave:T,onNodeContextMenu:U,onNodeDoubleClick:A,onNodeDragStart:L,onNodeDrag:q,onNodeDragStop:I,onNodesDelete:$,onEdgesDelete:R,onDelete:D,onSelectionChange:ee,onSelectionDragStart:H,onSelectionDrag:G,onSelectionDragStop:j,onSelectionContextMenu:Y,onSelectionStart:Z,onSelectionEnd:K,onBeforeDelete:M,connectionMode:B,connectionLineType:P=pi.Bezier,connectionLineStyle:N,connectionLineComponent:V,connectionLineContainerStyle:F,deleteKeyCode:J="Backspace",selectionKeyCode:ne="Shift",selectionOnDrag:re=!1,selectionMode:se=Bo.Full,panActivationKeyCode:ge="Space",multiSelectionKeyCode:xe=Uo()?"Meta":"Control",zoomActivationKeyCode:ye=Uo()?"Meta":"Control",snapToGrid:he,snapGrid:Se,onlyRenderVisibleElements:Me=!1,selectNodesOnDrag:Ce,nodesDraggable:lt,autoPanOnNodeFocus:Je,nodesConnectable:Tt,nodesFocusable:Vt,nodeOrigin:Lt=gS,edgesFocusable:Sn,edgesReconnectable:jn,elementsSelectable:Mt=!0,defaultViewport:jr=L3,minZoom:ue=.5,maxZoom:me=2,translateExtent:Ne=Ho,preventScrolling:Le=!0,nodeExtent:Ge,defaultMarkerColor:Pt="#b1b1b7",zoomOnScroll:On=!0,zoomOnPinch:Ht=!0,panOnScroll:xt=!1,panOnScrollSpeed:Gt=.5,panOnScrollMode:Qe=Yi.Free,zoomOnDoubleClick:$n=!0,panOnDrag:un=!0,onPaneClick:zc,onPaneMouseEnter:Ji,onPaneMouseMove:Wi,onPaneMouseLeave:el,onPaneScroll:ir,onPaneContextMenu:tl,paneClickDistance:gi=1,nodeClickDistance:Ac=0,children:ns,onReconnect:da,onReconnectStart:yi,onReconnectEnd:Tc,onEdgeContextMenu:rs,onEdgeDoubleClick:is,onEdgeMouseEnter:ls,onEdgeMouseMove:ha,onEdgeMouseLeave:pa,reconnectRadius:as=10,onNodesChange:os,onEdgesChange:Xn,noDragClassName:jt="nodrag",noWheelClassName:Yt="nowheel",noPanClassName:lr="nopan",fitView:nl,fitViewOptions:ss,connectOnClick:Mc,attributionPosition:us,proOptions:xi,defaultEdgeOptions:ma,elevateNodesOnSelect:Or=!0,elevateEdgesOnSelect:Dr=!1,disableKeyboardA11y:Rr=!1,autoPanOnConnect:Lr,autoPanOnNodeDrag:wt,autoPanSpeed:cs,connectionRadius:fs,isValidConnection:ar,onError:Hr,style:jc,id:ga,nodeDragThreshold:ds,connectionDragThreshold:Oc,viewport:rl,onViewportChange:il,width:Dn,height:Qt,colorMode:hs="light",debug:Dc,onScroll:Br,ariaLabelConfig:ps,zIndexMode:vi="basic",...Rc},Zt){const bi=ga||"1",ms=U3(hs),ya=X.useCallback(or=>{or.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Br==null||Br(or)},[Br]);return E.jsx("div",{"data-testid":"rf__wrapper",...Rc,onScroll:ya,style:{...jc,...o4},ref:Zt,className:At(["react-flow",o,ms]),id:ga,role:"application",children:E.jsxs(a4,{nodes:e,edges:n,width:Dn,height:Qt,fitView:nl,fitViewOptions:ss,minZoom:ue,maxZoom:me,nodeOrigin:Lt,nodeExtent:Ge,zIndexMode:vi,children:[E.jsx(r4,{onInit:h,onNodeClick:f,onEdgeClick:d,onNodeMouseEnter:z,onNodeMouseMove:w,onNodeMouseLeave:T,onNodeContextMenu:U,onNodeDoubleClick:A,nodeTypes:s,edgeTypes:u,connectionLineType:P,connectionLineStyle:N,connectionLineComponent:V,connectionLineContainerStyle:F,selectionKeyCode:ne,selectionOnDrag:re,selectionMode:se,deleteKeyCode:J,multiSelectionKeyCode:xe,panActivationKeyCode:ge,zoomActivationKeyCode:ye,onlyRenderVisibleElements:Me,defaultViewport:jr,translateExtent:Ne,minZoom:ue,maxZoom:me,preventScrolling:Le,zoomOnScroll:On,zoomOnPinch:Ht,zoomOnDoubleClick:$n,panOnScroll:xt,panOnScrollSpeed:Gt,panOnScrollMode:Qe,panOnDrag:un,onPaneClick:zc,onPaneMouseEnter:Ji,onPaneMouseMove:Wi,onPaneMouseLeave:el,onPaneScroll:ir,onPaneContextMenu:tl,paneClickDistance:gi,nodeClickDistance:Ac,onSelectionContextMenu:Y,onSelectionStart:Z,onSelectionEnd:K,onReconnect:da,onReconnectStart:yi,onReconnectEnd:Tc,onEdgeContextMenu:rs,onEdgeDoubleClick:is,onEdgeMouseEnter:ls,onEdgeMouseMove:ha,onEdgeMouseLeave:pa,reconnectRadius:as,defaultMarkerColor:Pt,noDragClassName:jt,noWheelClassName:Yt,noPanClassName:lr,rfId:bi,disableKeyboardA11y:Rr,nodeExtent:Ge,viewport:rl,onViewportChange:il}),E.jsx(q3,{nodes:e,edges:n,defaultNodes:i,defaultEdges:l,onConnect:v,onConnectStart:b,onConnectEnd:C,onClickConnectStart:S,onClickConnectEnd:_,nodesDraggable:lt,autoPanOnNodeFocus:Je,nodesConnectable:Tt,nodesFocusable:Vt,edgesFocusable:Sn,edgesReconnectable:jn,elementsSelectable:Mt,elevateNodesOnSelect:Or,elevateEdgesOnSelect:Dr,minZoom:ue,maxZoom:me,nodeExtent:Ge,onNodesChange:os,onEdgesChange:Xn,snapToGrid:he,snapGrid:Se,connectionMode:B,translateExtent:Ne,connectOnClick:Mc,defaultEdgeOptions:ma,fitView:nl,fitViewOptions:ss,onNodesDelete:$,onEdgesDelete:R,onDelete:D,onNodeDragStart:L,onNodeDrag:q,onNodeDragStop:I,onSelectionDrag:G,onSelectionDragStart:H,onSelectionDragStop:j,onMove:m,onMoveStart:p,onMoveEnd:y,noPanClassName:lr,nodeOrigin:Lt,rfId:bi,autoPanOnConnect:Lr,autoPanOnNodeDrag:wt,autoPanSpeed:cs,onError:Hr,connectionRadius:fs,isValidConnection:ar,selectNodesOnDrag:Ce,nodeDragThreshold:ds,connectionDragThreshold:Oc,onBeforeDelete:M,debug:Dc,ariaLabelConfig:ps,zIndexMode:vi}),E.jsx(R3,{onSelectionChange:ee}),ns,E.jsx(T3,{proOptions:xi,position:us}),E.jsx(A3,{rfId:bi,disableKeyboardA11y:Rr})]})})}var u4=bS(s4);const c4=e=>{var n;return(n=e.domNode)==null?void 0:n.querySelector(".react-flow__edgelabel-renderer")};function f4({children:e}){const n=Ve(c4);return n?S3.createPortal(e,n):null}function d4(e){const[n,i]=X.useState(e),l=X.useCallback(o=>i(s=>xS(o,s)),[]);return[n,i,l]}function h4(e){const[n,i]=X.useState(e),l=X.useCallback(o=>i(s=>vS(o,s)),[]);return[n,i,l]}function p4({dimensions:e,lineWidth:n,variant:i,className:l}){return E.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",i,l])})}function m4({radius:e,className:n}){return E.jsx("circle",{cx:e,cy:e,r:e,className:At(["react-flow__background-pattern","dots",n])})}var Ar;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ar||(Ar={}));const g4={[Ar.Dots]:1,[Ar.Lines]:1,[Ar.Cross]:6},y4=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function YS({id:e,variant:n=Ar.Dots,gap:i=20,size:l,lineWidth:o=1,offset:s=0,color:u,bgColor:f,style:d,className:h,patternClassName:m}){const p=X.useRef(null),{transform:y,patternId:v}=Ve(y4,dt),b=l||g4[n],C=n===Ar.Dots,S=n===Ar.Cross,_=Array.isArray(i)?i:[i,i],z=[_[0]*y[2]||1,_[1]*y[2]||1],w=b*y[2],T=Array.isArray(s)?s:[s,s],U=S?[w,w]:z,A=[T[0]*y[2]||1+U[0]/2,T[1]*y[2]||1+U[1]/2],L=`${v}${e||""}`;return E.jsxs("svg",{className:At(["react-flow__background",h]),style:{...d,...Ec,"--xy-background-color-props":f,"--xy-background-pattern-color-props":u},ref:p,"data-testid":"rf__background",children:[E.jsx("pattern",{id:L,x:y[0]%z[0],y:y[1]%z[1],width:z[0],height:z[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${A[0]},-${A[1]})`,children:C?E.jsx(m4,{radius:w/2,className:m}):E.jsx(p4,{dimensions:U,lineWidth:o,variant:n,className:m})}),E.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${L})`})]})}YS.displayName="Background";const x4=X.memo(YS);function v4(){return E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:E.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function b4(){return E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:E.jsx("path",{d:"M0 0h32v4.2H0z"})})}function w4(){return E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:E.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 S4(){return E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:E.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 _4(){return E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:E.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 Ru({children:e,className:n,...i}){return E.jsx("button",{type:"button",className:At(["react-flow__controls-button",n]),...i,children:e})}const E4=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function $S({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 b=pt(),{isInteractive:C,minZoomReached:S,maxZoomReached:_,ariaLabelConfig:z}=Ve(E4,dt),{zoomIn:w,zoomOut:T,fitView:U}=Jo(),A=()=>{w(),s==null||s()},L=()=>{T(),u==null||u()},q=()=>{U(o),f==null||f()},I=()=>{b.setState({nodesDraggable:!C,nodesConnectable:!C,elementsSelectable:!C}),d==null||d(!C)},$=y==="horizontal"?"horizontal":"vertical";return E.jsxs(_c,{className:At(["react-flow__controls",$,h]),position:p,style:e,"data-testid":"rf__controls","aria-label":v??z["controls.ariaLabel"],children:[n&&E.jsxs(E.Fragment,{children:[E.jsx(Ru,{onClick:A,className:"react-flow__controls-zoomin",title:z["controls.zoomIn.ariaLabel"],"aria-label":z["controls.zoomIn.ariaLabel"],disabled:_,children:E.jsx(v4,{})}),E.jsx(Ru,{onClick:L,className:"react-flow__controls-zoomout",title:z["controls.zoomOut.ariaLabel"],"aria-label":z["controls.zoomOut.ariaLabel"],disabled:S,children:E.jsx(b4,{})})]}),i&&E.jsx(Ru,{className:"react-flow__controls-fitview",onClick:q,title:z["controls.fitView.ariaLabel"],"aria-label":z["controls.fitView.ariaLabel"],children:E.jsx(w4,{})}),l&&E.jsx(Ru,{className:"react-flow__controls-interactive",onClick:I,title:z["controls.interactive.ariaLabel"],"aria-label":z["controls.interactive.ariaLabel"],children:C?E.jsx(_4,{}):E.jsx(S4,{})}),m]})}$S.displayName="Controls";const N4=X.memo($S);function k4({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:b,backgroundColor:C}=s||{},S=u||b||C;return E.jsx("rect",{className:At(["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 C4=X.memo(k4),z4=e=>e.nodes.map(n=>n.id),fh=e=>e instanceof Function?e:()=>e;function A4({nodeStrokeColor:e,nodeColor:n,nodeClassName:i="",nodeBorderRadius:l=5,nodeStrokeWidth:o,nodeComponent:s=C4,onClick:u}){const f=Ve(z4,dt),d=fh(n),h=fh(e),m=fh(i),p=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return E.jsx(E.Fragment,{children:f.map(y=>E.jsx(M4,{id:y,nodeColorFunc:d,nodeStrokeColorFunc:h,nodeClassNameFunc:m,nodeBorderRadius:l,nodeStrokeWidth:o,NodeComponent:s,onClick:u,shapeRendering:p},y))})}function T4({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}=Ve(b=>{const C=b.nodeLookup.get(e);if(!C)return{node:void 0,x:0,y:0,width:0,height:0};const S=C.internals.userNode,{x:_,y:z}=C.internals.positionAbsolute,{width:w,height:T}=Mr(S);return{node:S,x:_,y:z,width:w,height:T}},dt);return!h||h.hidden||!Pw(h)?null:E.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 M4=X.memo(T4);var j4=X.memo(A4);const O4=200,D4=150,R4=e=>!e.hidden,L4=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?Xw(Qo(e.nodeLookup,{filter:R4}),n):n,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},H4="react-flow__minimap-desc";function XS({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:b,pannable:C=!1,zoomable:S=!1,ariaLabel:_,inversePan:z,zoomStep:w=1,offsetScale:T=5}){const U=pt(),A=X.useRef(null),{boundingRect:L,viewBB:q,rfId:I,panZoom:$,translateExtent:R,flowWidth:D,flowHeight:ee,ariaLabelConfig:H}=Ve(L4,dt),G=(e==null?void 0:e.width)??O4,j=(e==null?void 0:e.height)??D4,Y=L.width/G,Z=L.height/j,K=Math.max(Y,Z),M=K*G,B=K*j,P=T*K,N=L.x-(M-L.width)/2-P,V=L.y-(B-L.height)/2-P,F=M+P*2,J=B+P*2,ne=`${H4}-${I}`,re=X.useRef(0),se=X.useRef();re.current=K,X.useEffect(()=>{if(A.current&&$)return se.current=QT({domNode:A.current,panZoom:$,getTransform:()=>U.getState().transform,getViewScale:()=>re.current}),()=>{var he;(he=se.current)==null||he.destroy()}},[$]),X.useEffect(()=>{var he;(he=se.current)==null||he.update({translateExtent:R,width:D,height:ee,inversePan:z,pannable:C,zoomStep:w,zoomable:S})},[C,S,z,w,R,D,ee]);const ge=v?he=>{var Ce;const[Se,Me]=((Ce=se.current)==null?void 0:Ce.pointer(he))||[0,0];v(he,{x:Se,y:Me})}:void 0,xe=b?X.useCallback((he,Se)=>{const Me=U.getState().nodeLookup.get(Se).internals.userNode;b(he,Me)},[]):void 0,ye=_??H["minimap.ariaLabel"];return E.jsx(_c,{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*K: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:At(["react-flow__minimap",n]),"data-testid":"rf__minimap",children:E.jsxs("svg",{width:G,height:j,viewBox:`${N} ${V} ${F} ${J}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ne,ref:A,onClick:ge,children:[ye&&E.jsx("title",{id:ne,children:ye}),E.jsx(j4,{onClick:xe,nodeColor:l,nodeStrokeColor:i,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:u,nodeComponent:f}),E.jsx("path",{className:"react-flow__minimap-mask",d:`M${N-P},${V-P}h${F+P*2}v${J+P*2}h${-F-P*2}z + M${q.x},${q.y}h${q.width}v${q.height}h${-q.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}XS.displayName="MiniMap";const B4=X.memo(XS),q4=e=>n=>e?`${Math.max(1/n.transform[2],1)}`:void 0,U4={[aa.Line]:"right",[aa.Handle]:"bottom-right"};function I4({nodeId:e,position:n,variant:i=aa.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:b,onResizeStart:C,onResize:S,onResizeEnd:_}){const z=ES(),w=typeof e=="string"?e:z,T=pt(),U=X.useRef(null),A=i===aa.Handle,L=Ve(X.useCallback(q4(A&&v),[A,v]),dt),q=X.useRef(null),I=n??U4[i];X.useEffect(()=>{if(!(!U.current||!w))return q.current||(q.current=u3({domNode:U.current,nodeId:w,getStoreItems:()=>{const{nodeLookup:R,transform:D,snapGrid:ee,snapToGrid:H,nodeOrigin:G,domNode:j}=T.getState();return{nodeLookup:R,transform:D,snapGrid:ee,snapToGrid:H,nodeOrigin:G,paneDomNode:j}},onChange:(R,D)=>{const{triggerNodeChanges:ee,nodeLookup:H,parentLookup:G,nodeOrigin:j}=T.getState(),Y=[],Z={x:R.x,y:R.y},K=H.get(w);if(K&&K.expandParent&&K.parentId){const M=K.origin??j,B=R.width??K.measured.width??0,P=R.height??K.measured.height??0,N={id:K.id,parentId:K.parentId,rect:{width:B,height:P,...Fw({x:R.x??K.position.x,y:R.y??K.position.y},{width:B,height:P},K.parentId,H,M)}},V=gm([N],H,G,j);Y.push(...V),Z.x=R.x?Math.max(M[0]*B,R.x):void 0,Z.y=R.y?Math.max(M[1]*P,R.y):void 0}if(Z.x!==void 0&&Z.y!==void 0){const M={id:w,type:"position",position:{...Z}};Y.push(M)}if(R.width!==void 0&&R.height!==void 0){const B={id:w,type:"dimensions",resizing:!0,setAttributes:y?y==="horizontal"?"width":"height":!0,dimensions:{width:R.width,height:R.height}};Y.push(B)}for(const M of D){const B={...M,type:"position"};Y.push(B)}ee(Y)},onEnd:({width:R,height:D})=>{const ee={id:w,type:"dimensions",resizing:!1,dimensions:{width:R,height:D}};T.getState().triggerNodeChanges([ee])}})),q.current.update({controlPosition:I,boundaries:{minWidth:f,minHeight:d,maxWidth:h,maxHeight:m},keepAspectRatio:p,resizeDirection:y,onResizeStart:C,onResize:S,onResizeEnd:_,shouldResize:b}),()=>{var R;(R=q.current)==null||R.destroy()}},[I,f,d,h,m,p,C,S,_,b]);const $=I.split("-");return E.jsx("div",{className:At(["react-flow__resize-control","nodrag",...$,i,l]),ref:U,style:{...o,scale:L,...u&&{[A?"backgroundColor":"borderColor"]:u}},children:s})}X.memo(I4);var dh,Fv;function xm(){if(Fv)return dh;Fv=1;var e="\0",n="\0",i="";class l{constructor(m){kt(this,"_isDirected",!0);kt(this,"_isMultigraph",!1);kt(this,"_isCompound",!1);kt(this,"_label");kt(this,"_defaultNodeLabelFn",()=>{});kt(this,"_defaultEdgeLabelFn",()=>{});kt(this,"_nodes",{});kt(this,"_in",{});kt(this,"_preds",{});kt(this,"_out",{});kt(this,"_sucs",{});kt(this,"_edgeObjs",{});kt(this,"_edgeLabels",{});kt(this,"_nodeCount",0);kt(this,"_edgeCount",0);kt(this,"_parent");kt(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(b){y.length>1?v.setNode(b,p):v.setNode(b)}),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([C,S]){m(C)&&p.setNode(C,S)}),Object.values(this._edgeObjs).forEach(function(C){p.hasNode(C.v)&&p.hasNode(C.w)&&p.setEdge(C,y.edge(C))});var v={};function b(C){var S=y.parent(C);return S===void 0||p.hasNode(S)?(v[C]=S,S):S in v?v[S]:b(S)}return this._isCompound&&p.nodes().forEach(C=>p.setParent(C,b(C))),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(b,C){return v.length>1?y.setEdge(b,C,p):y.setEdge(b,C),C}),this}setEdge(){var m,p,y,v,b=!1,C=arguments[0];typeof C=="object"&&C!==null&&"v"in C?(m=C.v,p=C.w,y=C.name,arguments.length===2&&(v=arguments[1],b=!0)):(m=C,p=arguments[1],y=arguments[3],arguments.length>2&&(v=arguments[2],b=!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 b&&(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]=b?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),b=this._edgeObjs[v];return b&&(m=b.v,p=b.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(b=>b.v===p):v}}outEdges(m,p){var y=this._out[m];if(y){var v=Object.values(y);return p?v.filter(b=>b.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,b=""+p;if(!h&&v>b){var C=v;v=b,b=C}return v+i+b+i+(y===void 0?e:y)}function f(h,m,p,y){var v=""+m,b=""+p;if(!h&&v>b){var C=v;v=b,b=C}var S={v,w:b};return y&&(S.name=y),S}function d(h,m){return u(h,m.v,m.w,m.name)}return dh=l,dh}var hh,Qv;function V4(){return Qv||(Qv=1,hh="2.2.4"),hh}var ph,Zv;function G4(){return Zv||(Zv=1,ph={Graph:xm(),version:V4()}),ph}var mh,Kv;function Y4(){if(Kv)return mh;Kv=1;var e=xm();mh={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 mh}var gh,Jv;function $4(){if(Jv)return gh;Jv=1,gh=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 gh}var yh,Wv;function PS(){if(Wv)return yh;Wv=1;class e{constructor(){kt(this,"_arr",[]);kt(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 b=v.v!==m?v.v:v.w,C=d[b],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 xh}var vh,tb;function X4(){if(tb)return vh;tb=1;var e=FS();vh=n;function n(i,l,o){return i.nodes().reduce(function(s,u){return s[u]=e(i,u,l,o),s},{})}return vh}var bh,nb;function QS(){if(nb)return bh;nb=1,bh=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 bh}var wh,rb;function P4(){if(rb)return wh;rb=1;var e=QS();wh=n;function n(i){return e(i).filter(function(l){return l.length>1||l.length===1&&i.hasEdge(l[0],l[0])})}return wh}var Sh,ib;function F4(){if(ib)return Sh;ib=1,Sh=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],b=h[y],C=p[y],S=v.distance+b.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 Nh}var kh,sb;function Z4(){if(sb)return kh;sb=1;var e=KS();kh=n;function n(i,l){return e(i,l,"post")}return kh}var Ch,ub;function K4(){if(ub)return Ch;ub=1;var e=KS();Ch=n;function n(i,l){return e(i,l,"pre")}return Ch}var zh,cb;function J4(){if(cb)return zh;cb=1;var e=xm(),n=PS();zh=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 b=o(p);b0;){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 zh}var Ah,fb;function W4(){return fb||(fb=1,Ah={components:$4(),dijkstra:FS(),dijkstraAll:X4(),findCycles:P4(),floydWarshall:F4(),isAcyclic:Q4(),postorder:Z4(),preorder:K4(),prim:J4(),tarjan:QS(),topsort:ZS()}),Ah}var Th,db;function Gn(){if(db)return Th;db=1;var e=G4();return Th={Graph:e.Graph,json:Y4(),alg:W4(),version:e.version},Th}var Mh,hb;function e5(){if(hb)return Mh;hb=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 Mh=e,Mh}var jh,pb;function t5(){if(pb)return jh;pb=1;let e=Gn().Graph,n=e5();jh=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],b=m[0],C;for(;h.nodeCount();){for(;C=b.dequeue();)s(h,m,p,C);for(;C=v.dequeue();)s(h,m,p,C);if(h.nodeCount()){for(let S=m.length-2;S>0;--S)if(C=m[S].dequeue(),C){y=y.concat(s(h,m,p,C,!0));break}}}return y}function s(h,m,p,y,v){let b=v?[]:void 0;return h.inEdges(y.v).forEach(C=>{let S=h.edge(C),_=h.node(C.v);v&&b.push({v:C.v,w:C.w}),_.out-=S,f(m,p,_)}),h.outEdges(y.v).forEach(C=>{let S=h.edge(C),_=C.w,z=h.node(_);z.in-=S,f(m,p,z)}),h.removeNode(y.v),b}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),w=_+z;p.setEdge(S.v,S.w,w),v=Math.max(v,p.node(S.v).out+=z),y=Math.max(y,p.node(S.w).in+=z)});let b=d(v+y+3).map(()=>new n),C=y+1;return p.nodes().forEach(S=>{f(b,C,p.node(S))}),{graph:p,buckets:b,zeroIdx:C}}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;pI.setNode($,q.node($))),q.edges().forEach($=>{let R=I.edge($.v,$.w)||{weight:0,minlen:1},D=q.edge($);I.setEdge($.v,$.w,{weight:R.weight+D.weight,minlen:Math.max(R.minlen,D.minlen)})}),I}function l(q){let I=new e({multigraph:q.isMultigraph()}).setGraph(q.graph());return q.nodes().forEach($=>{q.children($).length||I.setNode($,q.node($))}),q.edges().forEach($=>{I.setEdge($,q.edge($))}),I}function o(q){let I=q.nodes().map($=>{let R={};return q.outEdges($).forEach(D=>{R[D.w]=(R[D.w]||0)+q.edge(D).weight}),R});return L(q.nodes(),I)}function s(q){let I=q.nodes().map($=>{let R={};return q.inEdges($).forEach(D=>{R[D.v]=(R[D.v]||0)+q.edge(D).weight}),R});return L(q.nodes(),I)}function u(q,I){let $=q.x,R=q.y,D=I.x-$,ee=I.y-R,H=q.width/2,G=q.height/2;if(!D&&!ee)throw new Error("Not possible to find intersection inside of the rectangle");let j,Y;return Math.abs(ee)*H>Math.abs(D)*G?(ee<0&&(G=-G),j=G*D/ee,Y=G):(D<0&&(H=-H),j=H,Y=H*ee/D),{x:$+j,y:R+Y}}function f(q){let I=T(b(q)+1).map(()=>[]);return q.nodes().forEach($=>{let R=q.node($),D=R.rank;D!==void 0&&(I[D][R.order]=$)}),I}function d(q){let I=q.nodes().map(R=>{let D=q.node(R).rank;return D===void 0?Number.MAX_VALUE:D}),$=v(Math.min,I);q.nodes().forEach(R=>{let D=q.node(R);Object.hasOwn(D,"rank")&&(D.rank-=$)})}function h(q){let I=q.nodes().map(H=>q.node(H).rank),$=v(Math.min,I),R=[];q.nodes().forEach(H=>{let G=q.node(H).rank-$;R[G]||(R[G]=[]),R[G].push(H)});let D=0,ee=q.graph().nodeRankFactor;Array.from(R).forEach((H,G)=>{H===void 0&&G%ee!==0?--D:H!==void 0&&D&&H.forEach(j=>q.node(j).rank+=D)})}function m(q,I,$,R){let D={width:0,height:0};return arguments.length>=4&&(D.rank=$,D.order=R),n(q,"border",D,I)}function p(q,I=y){const $=[];for(let R=0;Ry){const $=p(I);return q.apply(null,$.map(R=>q.apply(null,R)))}else return q.apply(null,I)}function b(q){const $=q.nodes().map(R=>{let D=q.node(R).rank;return D===void 0?Number.MIN_VALUE:D});return v(Math.max,$)}function C(q,I){let $={lhs:[],rhs:[]};return q.forEach(R=>{I(R)?$.lhs.push(R):$.rhs.push(R)}),$}function S(q,I){let $=Date.now();try{return I()}finally{console.log(q+" time: "+(Date.now()-$)+"ms")}}function _(q,I){return I()}let z=0;function w(q){var I=++z;return q+(""+I)}function T(q,I,$=1){I==null&&(I=q,q=0);let R=ee=>eeIR[I]),Object.entries(q).reduce((R,[D,ee])=>(R[D]=$(ee,D),R),{})}function L(q,I){return q.reduce(($,R,D)=>($[R]=I[D],$),{})}return Oh}var Dh,gb;function n5(){if(gb)return Dh;gb=1;let e=t5(),n=zt().uniqueId;Dh={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 Dh}var Rh,yb;function r5(){if(yb)return Rh;yb=1;let e=zt();Rh={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,b,C;for(C=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 Rh}var Lh,xb;function oc(){if(xb)return Lh;xb=1;const{applyWithChunking:e}=zt();Lh={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 Lh}var Hh,vb;function JS(){if(vb)return Hh;vb=1;var e=Gn().Graph,n=oc().slack;Hh=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 Hh}var Bh,bb;function i5(){if(bb)return Bh;bb=1;var e=JS(),n=oc().slack,i=oc().longestPath,l=Gn().alg.preorder,o=Gn().alg.postorder,s=zt().simplify;Bh=u,u.initLowLimValues=m,u.initCutValues=f,u.calcCutValue=h,u.leaveEdge=y,u.enterEdge=v,u.exchangeEdges=b;function u(z){z=s(z),i(z);var w=e(z);m(w),f(w,z);for(var T,U;T=y(w);)U=v(w,z,T),b(w,z,T,U)}function f(z,w){var T=o(z,z.nodes());T=T.slice(0,T.length-1),T.forEach(U=>d(z,w,U))}function d(z,w,T){var U=z.node(T),A=U.parent;z.edge(T,A).cutvalue=h(z,w,T)}function h(z,w,T){var U=z.node(T),A=U.parent,L=!0,q=w.edge(T,A),I=0;return q||(L=!1,q=w.edge(A,T)),I=q.weight,w.nodeEdges(T).forEach($=>{var R=$.v===T,D=R?$.w:$.v;if(D!==A){var ee=R===L,H=w.edge($).weight;if(I+=ee?H:-H,S(z,T,D)){var G=z.edge(T,D).cutvalue;I+=ee?-G:G}}}),I}function m(z,w){arguments.length<2&&(w=z.nodes()[0]),p(z,{},1,w)}function p(z,w,T,U,A){var L=T,q=z.node(U);return w[U]=!0,z.neighbors(U).forEach(I=>{Object.hasOwn(w,I)||(T=p(z,w,T,I,U))}),q.low=L,q.lim=T++,A?q.parent=A:delete q.parent,T}function y(z){return z.edges().find(w=>z.edge(w).cutvalue<0)}function v(z,w,T){var U=T.v,A=T.w;w.hasEdge(U,A)||(U=T.w,A=T.v);var L=z.node(U),q=z.node(A),I=L,$=!1;L.lim>q.lim&&(I=q,$=!0);var R=w.edges().filter(D=>$===_(z,z.node(D.v),I)&&$!==_(z,z.node(D.w),I));return R.reduce((D,ee)=>n(w,ee)!w.node(A).parent),U=l(z,T);U=U.slice(1),U.forEach(A=>{var L=z.node(A).parent,q=w.edge(A,L),I=!1;q||(q=w.edge(L,A),I=!0),w.node(A).rank=w.node(L).rank+(I?q.minlen:-q.minlen)})}function S(z,w,T){return z.hasEdge(w,T)}function _(z,w,T){return T.low<=w.lim&&w.lim<=T.lim}return Bh}var qh,wb;function l5(){if(wb)return qh;wb=1;var e=oc(),n=e.longestPath,i=JS(),l=i5();qh=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 qh}var Uh,Sb;function a5(){if(Sb)return Uh;Sb=1,Uh=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 Uh}var Ih,_b;function o5(){if(_b)return Ih;_b=1;let e=zt();Ih={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 b=e.addBorderNode(u,"_bt"),C=e.addBorderNode(u,"_bb"),S=u.node(y);u.setParent(b,y),S.borderTop=b,u.setParent(C,y),S.borderBottom=C,v.forEach(_=>{i(u,f,d,h,m,p,_);let z=u.node(_),w=z.borderTop?z.borderTop:_,T=z.borderBottom?z.borderBottom:_,U=z.borderTop?h:2*h,A=w!==T?1:m-p[y]+1;u.setEdge(b,w,{weight:U,minlen:A,nestingEdge:!0}),u.setEdge(T,C,{weight:U,minlen:A,nestingEdge:!0})}),u.parent(y)||u.setEdge(f,b,{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 Ih}var Vh,Eb;function s5(){if(Eb)return Vh;Eb=1;let e=zt();Vh=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 Gh}var Yh,kb;function c5(){if(kb)return Yh;kb=1;let e=zt();Yh=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 Yh}var $h,Cb;function f5(){if(Cb)return $h;Cb=1;let e=zt().zipObject;$h=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,b)=>v.pos-b.pos)),d=1;for(;d{let v=y.pos+d;m[v]+=y.weight;let b=0;for(;v>0;)v%2&&(b+=m[v+1]),v=v-1>>1,m[v]+=y.weight;p+=y.weight*b}),p}return $h}var Xh,zb;function d5(){if(zb)return Xh;zb=1,Xh=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 Xh}var Ph,Ab;function h5(){if(Ab)return Ph;Ab=1;let e=zt();Ph=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 Ph}var Fh,Tb;function p5(){if(Tb)return Fh;Tb=1;let e=zt();Fh=n;function n(o,s){let u=e.partition(o,b=>Object.hasOwn(b,"barycenter")),f=u.lhs,d=u.rhs.sort((b,C)=>C.i-b.i),h=[],m=0,p=0,y=0;f.sort(l(!!s)),y=i(h,d,y),f.forEach(b=>{y+=b.vs.length,h.push(b.vs),m+=b.barycenter*b.weight,p+=b.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 Fh}var Qh,Mb;function m5(){if(Mb)return Qh;Mb=1;let e=d5(),n=h5(),i=p5();Qh=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,b={};y&&(m=m.filter(z=>z!==y&&z!==v));let C=e(u,m);C.forEach(z=>{if(u.children(z.v).length){let w=l(u,z.v,d,h);b[z.v]=w,Object.hasOwn(w,"barycenter")&&s(z,w)}});let S=n(C,d);o(S,b);let _=i(S,h);if(y&&(_.vs=[y,_.vs,v].flat(!0),u.predecessors(y).length)){let z=u.node(u.predecessors(y)[0]),w=u.node(u.predecessors(v)[0]);Object.hasOwn(_,"barycenter")||(_.barycenter=0,_.weight=0),_.barycenter=(_.barycenter*_.weight+z.order+w.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 Qh}var Zh,jb;function g5(){if(jb)return Zh;jb=1;let e=Gn().Graph,n=zt();Zh=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 b=v.v===m?v.w:v.v,C=h.edge(b,m),S=C!==void 0?C.weight:0;h.setEdge(b,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 Zh}var Kh,Ob;function y5(){if(Ob)return Kh;Ob=1,Kh=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 Kh}var Jh,Db;function x5(){if(Db)return Jh;Db=1;let e=c5(),n=f5(),i=m5(),l=g5(),o=y5(),s=Gn().Graph,u=zt();Jh=f;function f(p,y){if(y&&typeof y.customOrder=="function"){y.customOrder(p,f);return}let v=u.maxRank(p),b=d(p,u.range(1,v+1),"inEdges"),C=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 w=0,T=0;T<4;++w,++T){h(w%2?b:C,w%4>=2),S=u.buildLayerMatrix(p);let U=n(p,S);U<_&&(T=0,z=Object.assign({},S),_=U)}m(p,z)}function d(p,y,v){const b=new Map,C=(S,_)=>{b.has(S)||b.set(S,[]),b.get(S).push(_)};for(const S of p.nodes()){const _=p.node(S);if(typeof _.rank=="number"&&C(_.rank,S),typeof _.minRank=="number"&&typeof _.maxRank=="number")for(let z=_.minRank;z<=_.maxRank;z++)z!==_.rank&&C(z,S)}return y.map(function(S){return l(p,S,v,b.get(S)||[])})}function h(p,y){let v=new s;p.forEach(function(b){let C=b.graph().root,S=i(b,C,v,y);S.vs.forEach((_,z)=>b.node(_).order=z),o(b,v,S.vs)})}function m(p,y){Object.values(y).forEach(v=>v.forEach((b,C)=>p.node(b).order=C))}return Jh}var Wh,Rb;function v5(){if(Rb)return Wh;Rb=1;let e=Gn().Graph,n=zt();Wh={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 w(T,U){let A=0,L=0,q=T.length,I=U[U.length-1];return U.forEach(($,R)=>{let D=o(S,$),ee=D?S.node(D).order:q;(D||$===I)&&(U.slice(L,R+1).forEach(H=>{S.predecessors(H).forEach(G=>{let j=S.node(G),Y=j.order;(Y{$=U[R],S.node($).dummy&&S.predecessors($).forEach(D=>{let ee=S.node(D);ee.dummy&&(ee.orderI)&&s(z,D,$)})})}function T(U,A){let L=-1,q,I=0;return A.forEach(($,R)=>{if(S.node($).dummy==="border"){let D=S.predecessors($);D.length&&(q=S.node(D[0]).order,w(A,I,R,L,q),I=R,L=q)}w(A,I,A.length,q,U.length)}),A}return _.length&&_.reduce(T),z}function o(S,_){if(S.node(_).dummy)return S.predecessors(_).find(z=>S.node(z).dummy)}function s(S,_,z){if(_>z){let T=_;_=z,z=T}let w=S[_];w||(S[_]=w={}),w[z]=!0}function u(S,_,z){if(_>z){let w=_;_=z,z=w}return!!S[_]&&Object.hasOwn(S[_],z)}function f(S,_,z,w){let T={},U={},A={};return _.forEach(L=>{L.forEach((q,I)=>{T[q]=q,U[q]=q,A[q]=I})}),_.forEach(L=>{let q=-1;L.forEach(I=>{let $=w(I);if($.length){$=$.sort((D,ee)=>A[D]-A[ee]);let R=($.length-1)/2;for(let D=Math.floor(R),ee=Math.ceil(R);D<=ee;++D){let H=$[D];U[I]===I&&qMath.max(D,U[ee.v]+A.edge(ee)),0)}function $(R){let D=A.outEdges(R).reduce((H,G)=>Math.min(H,U[G.w]-A.edge(G)),Number.POSITIVE_INFINITY),ee=S.node(R);D!==Number.POSITIVE_INFINITY&&ee.borderType!==L&&(U[R]=Math.max(U[R],D))}return q(I,A.predecessors.bind(A)),q($,A.successors.bind(A)),Object.keys(w).forEach(R=>U[R]=U[z[R]]),U}function h(S,_,z,w){let T=new e,U=S.graph(),A=b(U.nodesep,U.edgesep,w);return _.forEach(L=>{let q;L.forEach(I=>{let $=z[I];if(T.setNode($),q){var R=z[q],D=T.edge(R,$);T.setEdge(R,$,Math.max(A(S,I,q),D||0))}q=I})}),T}function m(S,_){return Object.values(_).reduce((z,w)=>{let T=Number.NEGATIVE_INFINITY,U=Number.POSITIVE_INFINITY;Object.entries(w).forEach(([L,q])=>{let I=C(S,L)/2;T=Math.max(q+I,T),U=Math.min(q-I,U)});const A=T-U;return A{["l","r"].forEach(A=>{let L=U+A,q=S[L];if(q===_)return;let I=Object.values(q),$=w-n.applyWithChunking(Math.min,I);A!=="l"&&($=T-n.applyWithChunking(Math.max,I)),$&&(S[L]=n.mapValues(q,R=>R+$))})})}function y(S,_){return n.mapValues(S.ul,(z,w)=>{if(_)return S[_.toLowerCase()][w];{let T=Object.values(S).map(U=>U[w]).sort((U,A)=>U-A);return(T[1]+T[2])/2}})}function v(S){let _=n.buildLayerMatrix(S),z=Object.assign(i(S,_),l(S,_)),w={},T;["u","d"].forEach(A=>{T=A==="u"?_:Object.values(_).reverse(),["l","r"].forEach(L=>{L==="r"&&(T=T.map(R=>Object.values(R).reverse()));let q=(A==="u"?S.predecessors:S.successors).bind(S),I=f(S,T,z,q),$=d(S,T,I.root,I.align,L==="r");L==="r"&&($=n.mapValues($,R=>-R)),w[A+L]=$})});let U=m(S,w);return p(w,U),y(w,S.graph().align)}function b(S,_,z){return(w,T,U)=>{let A=w.node(T),L=w.node(U),q=0,I;if(q+=A.width/2,Object.hasOwn(A,"labelpos"))switch(A.labelpos.toLowerCase()){case"l":I=-A.width/2;break;case"r":I=A.width/2;break}if(I&&(q+=z?I:-I),I=0,q+=(A.dummy?_:S)/2,q+=(L.dummy?_:S)/2,q+=L.width/2,Object.hasOwn(L,"labelpos"))switch(L.labelpos.toLowerCase()){case"l":I=L.width/2;break;case"r":I=-L.width/2;break}return I&&(q+=z?I:-I),I=0,q}}function C(S,_){return S.node(_).width}return Wh}var ep,Lb;function b5(){if(Lb)return ep;Lb=1;let e=zt(),n=v5().positionX;ep=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 ep}var tp,Hb;function w5(){if(Hb)return tp;Hb=1;let e=n5(),n=r5(),i=l5(),l=zt().normalizeRanks,o=a5(),s=zt().removeEmptyRanks,u=o5(),f=s5(),d=u5(),h=x5(),m=b5(),p=zt(),y=Gn().Graph;tp=v;function v(N,V){let F=V&&V.debugTiming?p.time:p.notime;F("layout",()=>{let J=F(" buildLayoutGraph",()=>q(N));F(" runLayout",()=>b(J,F,V)),F(" updateInputGraph",()=>C(N,J))})}function b(N,V,F){V(" makeSpaceForEdgeLabels",()=>I(N)),V(" removeSelfEdges",()=>Z(N)),V(" acyclic",()=>e.run(N)),V(" nestingGraph.run",()=>u.run(N)),V(" rank",()=>i(p.asNonCompoundGraph(N))),V(" injectEdgeLabelProxies",()=>$(N)),V(" removeEmptyRanks",()=>s(N)),V(" nestingGraph.cleanup",()=>u.cleanup(N)),V(" normalizeRanks",()=>l(N)),V(" assignRankMinMax",()=>R(N)),V(" removeEdgeLabelProxies",()=>D(N)),V(" normalize.run",()=>n.run(N)),V(" parentDummyChains",()=>o(N)),V(" addBorderSegments",()=>f(N)),V(" order",()=>h(N,F)),V(" insertSelfEdges",()=>K(N)),V(" adjustCoordinateSystem",()=>d.adjust(N)),V(" position",()=>m(N)),V(" positionSelfEdges",()=>M(N)),V(" removeBorderNodes",()=>Y(N)),V(" normalize.undo",()=>n.undo(N)),V(" fixupEdgeLabelCoords",()=>G(N)),V(" undoCoordinateSystem",()=>d.undo(N)),V(" translateGraph",()=>ee(N)),V(" assignNodeIntersects",()=>H(N)),V(" reversePoints",()=>j(N)),V(" acyclic.undo",()=>e.undo(N))}function C(N,V){N.nodes().forEach(F=>{let J=N.node(F),ne=V.node(F);J&&(J.x=ne.x,J.y=ne.y,J.rank=ne.rank,V.children(F).length&&(J.width=ne.width,J.height=ne.height))}),N.edges().forEach(F=>{let J=N.edge(F),ne=V.edge(F);J.points=ne.points,Object.hasOwn(ne,"x")&&(J.x=ne.x,J.y=ne.y)}),N.graph().width=V.graph().width,N.graph().height=V.graph().height}let S=["nodesep","edgesep","ranksep","marginx","marginy"],_={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},z=["acyclicer","ranker","rankdir","align"],w=["width","height","rank"],T={width:0,height:0},U=["minlen","weight","width","height","labeloffset"],A={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},L=["labelpos"];function q(N){let V=new y({multigraph:!0,compound:!0}),F=P(N.graph());return V.setGraph(Object.assign({},_,B(F,S),p.pick(F,z))),N.nodes().forEach(J=>{let ne=P(N.node(J));const re=B(ne,w);Object.keys(T).forEach(se=>{re[se]===void 0&&(re[se]=T[se])}),V.setNode(J,re),V.setParent(J,N.parent(J))}),N.edges().forEach(J=>{let ne=P(N.edge(J));V.setEdge(J,Object.assign({},A,B(ne,U),p.pick(ne,L)))}),V}function I(N){let V=N.graph();V.ranksep/=2,N.edges().forEach(F=>{let J=N.edge(F);J.minlen*=2,J.labelpos.toLowerCase()!=="c"&&(V.rankdir==="TB"||V.rankdir==="BT"?J.width+=J.labeloffset:J.height+=J.labeloffset)})}function $(N){N.edges().forEach(V=>{let F=N.edge(V);if(F.width&&F.height){let J=N.node(V.v),re={rank:(N.node(V.w).rank-J.rank)/2+J.rank,e:V};p.addDummyNode(N,"edge-proxy",re,"_ep")}})}function R(N){let V=0;N.nodes().forEach(F=>{let J=N.node(F);J.borderTop&&(J.minRank=N.node(J.borderTop).rank,J.maxRank=N.node(J.borderBottom).rank,V=Math.max(V,J.maxRank))}),N.graph().maxRank=V}function D(N){N.nodes().forEach(V=>{let F=N.node(V);F.dummy==="edge-proxy"&&(N.edge(F.e).labelRank=F.rank,N.removeNode(V))})}function ee(N){let V=Number.POSITIVE_INFINITY,F=0,J=Number.POSITIVE_INFINITY,ne=0,re=N.graph(),se=re.marginx||0,ge=re.marginy||0;function xe(ye){let he=ye.x,Se=ye.y,Me=ye.width,Ce=ye.height;V=Math.min(V,he-Me/2),F=Math.max(F,he+Me/2),J=Math.min(J,Se-Ce/2),ne=Math.max(ne,Se+Ce/2)}N.nodes().forEach(ye=>xe(N.node(ye))),N.edges().forEach(ye=>{let he=N.edge(ye);Object.hasOwn(he,"x")&&xe(he)}),V-=se,J-=ge,N.nodes().forEach(ye=>{let he=N.node(ye);he.x-=V,he.y-=J}),N.edges().forEach(ye=>{let he=N.edge(ye);he.points.forEach(Se=>{Se.x-=V,Se.y-=J}),Object.hasOwn(he,"x")&&(he.x-=V),Object.hasOwn(he,"y")&&(he.y-=J)}),re.width=F-V+se,re.height=ne-J+ge}function H(N){N.edges().forEach(V=>{let F=N.edge(V),J=N.node(V.v),ne=N.node(V.w),re,se;F.points?(re=F.points[0],se=F.points[F.points.length-1]):(F.points=[],re=ne,se=J),F.points.unshift(p.intersectRect(J,re)),F.points.push(p.intersectRect(ne,se))})}function G(N){N.edges().forEach(V=>{let F=N.edge(V);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 j(N){N.edges().forEach(V=>{let F=N.edge(V);F.reversed&&F.points.reverse()})}function Y(N){N.nodes().forEach(V=>{if(N.children(V).length){let F=N.node(V),J=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-J.y),F.x=re.x+F.width/2,F.y=J.y+F.height/2}}),N.nodes().forEach(V=>{N.node(V).dummy==="border"&&N.removeNode(V)})}function Z(N){N.edges().forEach(V=>{if(V.v===V.w){var F=N.node(V.v);F.selfEdges||(F.selfEdges=[]),F.selfEdges.push({e:V,label:N.edge(V)}),N.removeEdge(V)}})}function K(N){var V=p.buildLayerMatrix(N);V.forEach(F=>{var J=0;F.forEach((ne,re)=>{var se=N.node(ne);se.order=re+J,(se.selfEdges||[]).forEach(ge=>{p.addDummyNode(N,"selfedge",{width:ge.label.width,height:ge.label.height,rank:se.rank,order:re+ ++J,e:ge.e,label:ge.label},"_se")}),delete se.selfEdges})})}function M(N){N.nodes().forEach(V=>{var F=N.node(V);if(F.dummy==="selfedge"){var J=N.node(F.e.v),ne=J.x+J.width/2,re=J.y,se=F.x-ne,ge=J.height/2;N.setEdge(F.e,F.label),N.removeNode(V),F.label.points=[{x:ne+2*se/3,y:re-ge},{x:ne+5*se/6,y:re-ge},{x:ne+se,y:re},{x:ne+5*se/6,y:re+ge},{x:ne+2*se/3,y:re+ge}],F.label.x=F.x,F.label.y=F.y}})}function B(N,V){return p.mapValues(p.pick(N,V),Number)}function P(N){var V={};return N&&Object.entries(N).forEach(([F,J])=>{typeof F=="string"&&(F=F.toLowerCase()),V[F]=J}),V}return tp}var np,Bb;function S5(){if(Bb)return np;Bb=1;let e=zt(),n=Gn().Graph;np={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 np}var rp,qb;function _5(){return qb||(qb=1,rp="1.1.8"),rp}var ip,Ub;function E5(){return Ub||(Ub=1,ip={graphlib:Gn(),layout:w5(),debug:S5(),util:{time:zt().time,notime:zt().notime},version:_5()}),ip}var N5=E5();const Ib=Go(N5),_o=180,Xl=44,Vb=20,Gb=40,k5=20,Yb=12;function C5(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 b of v.agents)m.add(b),p.set(b,v.name);for(const v of i){const b=o[v.name],C=v.agents.length,S=_o+Vb*2,_=Gb+C*Xl+(C-1)*Yb+k5;f.push({id:v.name,type:"groupNode",position:{x:0,y:0},data:{label:v.name,type:"parallel_group",status:(b==null?void 0:b.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 z5(f,d),{nodes:f,edges:d}}function z5(e,n){var l,o,s,u;const i=new Ib.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)||_o,m=d&&((o=f.style)==null?void 0:o.height)||Xl;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);Ib.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)||_o,p=h&&((u=f.style)==null?void 0:u.height)||Xl;f.position={x:d.x-m/2,y:d.y-p/2}}}const ct={pending:"#52525b",running:"#3b82f6",completed:"#22c55e",failed:"#ef4444",waiting:"#f59e0b",skipped:"#6b7280"},A5=X.memo(function({data:n,id:i,selected:l}){const o=n,u=Ee(b=>{var C;return(C=b.nodes[i])==null?void 0:C.status})||o.status||"pending",f=ct[u]||ct.pending,d=Ee(b=>{var C;return(C=b.nodes[i])==null?void 0:C.elapsed}),h=Ee(b=>{var C;return(C=b.nodes[i])==null?void 0:C.model}),m=Ee(b=>{var C;return(C=b.nodes[i])==null?void 0:C.tokens}),p=Ee(b=>{var C;return(C=b.nodes[i])==null?void 0:C.cost_usd}),y=Ee(b=>{var C;return(C=b.nodes[i])==null?void 0:C.iteration}),v=X.useMemo(()=>{const b=[`Status: ${u}`];return y!=null&&y>1&&b.push(`Iteration: ${y}`),d!=null&&b.push(`Elapsed: ${T5(d)}`),h&&b.push(`Model: ${h}`),m!=null&&b.push(`Tokens: ${m.toLocaleString()}`),p!=null&&b.push(`Cost: $${p.toFixed(4)}`),b.join(` +`)},[u,d,h,m,p,y]);return E.jsxs(E.Fragment,{children:[E.jsx(on,{type:"target",position:be.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),E.jsxs("div",{title:v,className:Rt("flex items-center gap-2 px-3 py-2 rounded-lg border-2 bg-[var(--node-bg)] min-w-[140px] max-w-[200px] 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)]"),style:{borderColor:f},children:[E.jsx("div",{className:Rt("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",u==="running"&&"animate-pulse"),style:{backgroundColor:`${f}20`},children:E.jsx(rN,{className:"w-3.5 h-3.5",style:{color:f}})}),E.jsx("span",{className:"text-xs font-medium text-[var(--text)] truncate",children:o.label}),y!=null&&y>1&&E.jsxs("span",{className:"ml-auto 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:["×",y]})]}),E.jsx(on,{type:"source",position:be.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function T5(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`}const M5=X.memo(function({data:n,id:i,selected:l}){const o=n,u=Ee(p=>{var y;return(y=p.nodes[i])==null?void 0:y.status})||o.status||"pending",f=ct[u]||ct.pending,d=Ee(p=>{var y;return(y=p.nodes[i])==null?void 0:y.elapsed}),h=Ee(p=>{var y;return(y=p.nodes[i])==null?void 0:y.exit_code}),m=X.useMemo(()=>{const p=[`Status: ${u}`];return d!=null&&p.push(`Elapsed: ${j5(d)}`),h!=null&&p.push(`Exit code: ${h}`),p.join(` +`)},[u,d,h]);return E.jsxs(E.Fragment,{children:[E.jsx(on,{type:"target",position:be.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),E.jsxs("div",{title:m,className:Rt("flex items-center gap-2 px-3 py-2 rounded-lg border-2 bg-[var(--node-bg)] min-w-[140px] max-w-[200px] 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)]"),style:{borderColor:f},children:[E.jsx("div",{className:Rt("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",u==="running"&&"animate-pulse"),style:{backgroundColor:`${f}20`},children:E.jsx(gN,{className:"w-3.5 h-3.5",style:{color:f}})}),E.jsx("span",{className:"text-xs font-medium text-[var(--text)] truncate",children:o.label})]}),E.jsx(on,{type:"source",position:be.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function j5(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`}const O5=X.memo(function({data:n,id:i,selected:l}){const o=n,u=Ee(p=>{var y;return(y=p.nodes[i])==null?void 0:y.status})||o.status||"pending",f=ct[u]||ct.pending,d=Ee(p=>{var y;return(y=p.nodes[i])==null?void 0:y.selected_option}),h=Ee(p=>{var y;return(y=p.nodes[i])==null?void 0:y.route}),m=X.useMemo(()=>{const p=[`Status: ${u}`];return d&&p.push(`Selected: ${d}`),h&&p.push(`Route: ${h}`),p.join(` +`)},[u,d,h]);return E.jsxs(E.Fragment,{children:[E.jsx(on,{type:"target",position:be.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),E.jsxs("div",{title:m,className:Rt("flex items-center gap-2 px-3 py-2 rounded-lg border-2 border-dashed bg-[var(--node-bg)] min-w-[140px] max-w-[200px] 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)]"),style:{borderColor:f},children:[E.jsx("div",{className:Rt("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",u==="waiting"&&"animate-pulse"),style:{backgroundColor:`${f}20`},children:E.jsx(pN,{className:"w-3.5 h-3.5",style:{color:f}})}),E.jsx("span",{className:"text-xs font-medium text-[var(--text)] truncate",children:o.label})]}),E.jsx(on,{type:"source",position:be.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})}),D5=X.memo(function({data:n,id:i,selected:l}){const o=n,u=o.type==="for_each_group"?fN:oN,f=o.progress,h=Ee(y=>{var v;return(v=y.nodes[i])==null?void 0:v.status})||o.status||"pending",m=ct[h]||ct.pending,p=f?`${f.completed+f.failed}/${f.total}${f.failed>0?` (${f.failed} failed)`:""}`:null;return E.jsxs(E.Fragment,{children:[E.jsx(on,{type:"target",position:be.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),E.jsxs("div",{className:Rt("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)]"),style:{borderColor:m,minHeight:"100%"},children:[E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx(u,{className:"w-3.5 h-3.5",style:{color:m}}),E.jsx("span",{className:"text-xs font-medium text-[var(--text-secondary)]",children:o.label})]}),p&&E.jsx("span",{className:"text-[10px] text-[var(--text-muted)] font-mono",children:p})]}),E.jsx(on,{type:"source",position:be.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})}),R5=X.memo(function({data:n,selected:i}){const o=n.status||"pending",s=o==="completed",u=o==="failed",f=!s&&!u,d=s?ct.completed:u?ct.failed:ct.pending;return E.jsxs(E.Fragment,{children:[E.jsx(on,{type:"target",position:be.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),E.jsx("div",{className:Rt("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?E.jsx(Ii,{className:"w-5 h-5 text-white",strokeWidth:3}):u?E.jsx(mN,{className:"w-3.5 h-3.5 text-white",fill:"white"}):E.jsx(Ii,{className:"w-5 h-5",strokeWidth:2.5,style:{color:f?ct.pending:d}})})]})}),L5=X.memo(function({data:n,selected:i}){const o=n.status||"pending",s=ct[o]||ct.pending,u=o==="running"||o==="completed";return E.jsxs(E.Fragment,{children:[E.jsx("div",{className:Rt("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:E.jsx(cN,{className:"w-4 h-4 ml-0.5",style:{color:u?"white":s}})}),E.jsx(on,{type:"source",position:be.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})}),H5=X.memo(function({id:n,sourceX:i,sourceY:l,targetX:o,targetY:s,sourcePosition:u,targetPosition:f,source:d,target:h,data:m}){const p=Ee(L=>L.highlightedEdges),y=X.useMemo(()=>p.find(L=>L.from===d&&L.to===h),[p,d,h]),[v,b,C]=fm({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",w=(y==null?void 0:y.state)==="highlighted";let T="var(--edge-color)",U=2,A;return z?(T="var(--edge-taken)",U=3):w&&(T="var(--edge-active)",U=3),_&&!z&&!w&&(A="6 3"),E.jsxs(E.Fragment,{children:[E.jsx(Wo,{id:n,path:v,style:{stroke:T,strokeWidth:U,strokeDasharray:A,transition:"stroke 0.3s ease, stroke-width 0.3s ease"},markerEnd:`url(#arrow-${z?"taken":w?"active":"default"})`}),_&&E.jsx(f4,{children:E.jsx("div",{className:"nodrag nopan",style:{position:"absolute",transform:`translate(-50%, -50%) translate(${b}px,${C}px)`,pointerEvents:"all"},children:E.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(--edge-taken)":"var(--surface)",color:z?"var(--bg)":"var(--text-muted)",border:`1px solid ${z?"var(--edge-taken)":"var(--border)"}`},title:S,children:S})})}),z&&E.jsx("circle",{r:"3",fill:"var(--edge-taken)",children:E.jsx("animateMotion",{dur:"1s",repeatCount:"indefinite",path:v})})]})}),B5={agentNode:A5,scriptNode:M5,gateNode:O5,groupNode:D5,endNode:R5,startNode:L5},q5={animatedEdge:H5},U5={type:"animatedEdge"};function I5(){return E.jsx("svg",{style:{position:"absolute",width:0,height:0},children:E.jsxs("defs",{children:[E.jsx("marker",{id:"arrow-default",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:E.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"var(--edge-color)"})}),E.jsx("marker",{id:"arrow-active",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:E.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"var(--edge-active)"})}),E.jsx("marker",{id:"arrow-taken",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:E.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"var(--edge-taken)"})})]})})}function V5(){const e=Ee(U=>U.agents),n=Ee(U=>U.routes),i=Ee(U=>U.parallelGroups),l=Ee(U=>U.forEachGroups),o=Ee(U=>U.nodes),s=Ee(U=>U.groupProgress),u=Ee(U=>U.selectNode),f=Ee(U=>U.selectedNode),d=Ee(U=>U.workflowStatus),h=Ee(U=>U.entryPoint),[m,p,y]=d4([]),[v,b,C]=h4([]),S=X.useRef(!1);X.useEffect(()=>{if(e.length===0||S.current)return;S.current=!0;const{nodes:U,edges:A}=C5(e,n,i,l,o,s,h);p(U),b(A)},[e,n,i,l,o,s,h,p,b]),X.useEffect(()=>{S.current&&p(U=>U.map(A=>{const L=o[A.id];if(!L)return A;const q=L.status||"pending",I=A.data.status;if(q!==I){const $={...A.data,status:q};return A.data.groupName&&s[A.data.groupName]&&($.progress=s[A.data.groupName]),{...A,data:$}}if(A.data.groupName&&s[A.data.groupName]){const $=A.data.progress,R=s[A.data.groupName];if(R&&(!$||$.completed!==R.completed||$.failed!==R.failed))return{...A,data:{...A.data,progress:R}}}return A}))},[o,s,p]);const _=X.useCallback((U,A)=>{A.type==="groupNode"&&A.data.type!=="for_each_group"||u(A.id)},[u]),z=X.useCallback(()=>{u(null)},[u]),w=X.useCallback(U=>{var L;const A=((L=U.data)==null?void 0:L.status)||"pending";return ct[A]||ct.pending},[]);X.useEffect(()=>{p(U=>U.map(A=>({...A,selected:A.id===f})))},[f,p]);const T=d==="pending"&&e.length===0;return E.jsxs("div",{className:"w-full h-full relative",children:[E.jsx(I5,{}),T&&E.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center pointer-events-none",children:[E.jsx(To,{className:"w-8 h-8 text-[var(--text-muted)] animate-spin mb-3 opacity-40"}),E.jsx("p",{className:"text-sm text-[var(--text-muted)] animate-pulse",children:"Waiting for workflow…"})]}),E.jsxs(u4,{nodes:m,edges:v,onNodesChange:y,onEdgesChange:C,onNodeClick:_,onPaneClick:z,nodeTypes:B5,edgeTypes:q5,defaultEdgeOptions:U5,fitView:!0,fitViewOptions:{padding:.2},minZoom:.2,maxZoom:2,proOptions:{hideAttribution:!0},nodesDraggable:!0,nodesConnectable:!1,elementsSelectable:!0,children:[E.jsx(x4,{variant:Ar.Dots,gap:20,size:1,color:"var(--border-subtle)"}),E.jsx(B4,{nodeColor:w,maskColor:"var(--minimap-mask)",style:{background:"var(--minimap-bg)"},pannable:!0,zoomable:!0}),E.jsx(N4,{showInteractive:!1,children:E.jsx(G5,{})}),E.jsx(Y5,{})]})]})}function G5(){const{fitView:e}=Jo(),n=X.useCallback(()=>{e({padding:.2,duration:300})},[e]);return E.jsx("button",{onClick:n,className:"react-flow__controls-button",title:"Fit view (F)",style:{display:"flex",alignItems:"center",justifyContent:"center"},children:E.jsx(uN,{className:"w-3.5 h-3.5"})})}function Y5(){const{fitView:e}=Jo();return X.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 ua({items:e}){const n=e.filter(i=>i.value!=null&&i.value!=="");return n.length===0?null:E.jsx("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1.5 text-xs",children:n.map(({label:i,value:l})=>E.jsxs("div",{className:"contents",children:[E.jsx("dt",{className:"text-[var(--text-muted)] whitespace-nowrap",children:i}),E.jsx("dd",{className:"text-[var(--text)] break-words",children:typeof l=="object"?JSON.stringify(l):String(l)})]},i))})}function WS(e){const n=[];return e.elapsed!=null&&n.push({label:"Elapsed",value:Wl(e.elapsed)}),e.model&&n.push({label:"Model",value:e.model}),e.tokens!=null&&n.push({label:"Tokens",value:Eo(e.tokens)}),e.input_tokens!=null&&e.output_tokens!=null&&n.push({label:"In / Out",value:`${Eo(e.input_tokens)} / ${Eo(e.output_tokens)}`}),e.cost_usd!=null&&n.push({label:"Cost",value:wp(e.cost_usd)}),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 Zi({output:e,title:n="Output",defaultExpanded:i=!0,maxHeight:l="300px"}){const[o,s]=X.useState(i),[u,f]=X.useState(!1),d=G1(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 E.jsxs("div",{className:"space-y-1.5",children:[E.jsxs("div",{className:"flex items-center justify-between",children:[E.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?E.jsx(oa,{className:"w-3 h-3"}):E.jsx($o,{className:"w-3 h-3"}),n]}),o&&E.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?E.jsx(Ii,{className:"w-3 h-3 text-[var(--completed)]"}):E.jsx(R1,{className:"w-3 h-3"})})]}),o&&E.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?E.jsx($5,{text:d}):d})]})}function $5({text:e}){const n=e.split(/("(?:[^"\\]|\\.)*")/g);return E.jsx(E.Fragment,{children:n.map((i,l)=>{if(l%2===1){const s=n.slice(l+1).join(""),u=/^\s*:/.test(s);return E.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 E.jsx("span",{dangerouslySetInnerHTML:{__html:o}},l)})})}function vm({activity:e,defaultExpanded:n=!0}){const[i,l]=X.useState(n),o=X.useRef(null);return X.useEffect(()=>{o.current&&i&&(o.current.scrollTop=o.current.scrollHeight)},[e.length,i]),e.length===0?null:E.jsxs("div",{className:"space-y-1.5",children:[E.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?E.jsx(oa,{className:"w-3 h-3"}):E.jsx($o,{className:"w-3 h-3"}),"Activity (",e.length,")"]}),i&&E.jsx("div",{ref:o,className:"max-h-[400px] overflow-y-auto space-y-0.5",children:e.map((s,u)=>E.jsx(X5,{entry:s},u))})]})}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 E.jsxs("div",{className:Rt("py-1.5 px-2 rounded text-[11px] leading-relaxed border-b border-[var(--border-subtle)] last:border-b-0"),children:[E.jsxs("div",{className:"flex items-start gap-1.5",children:[E.jsx("span",{className:"w-4 text-center flex-shrink-0",children:e.icon}),E.jsx("span",{className:"text-[var(--text-muted)] uppercase text-[9px] font-semibold tracking-wider w-12 flex-shrink-0 pt-px",children:e.label}),E.jsx("span",{className:Rt("break-words",n[e.type]||"text-[var(--text)]"),children:typeof e.text=="object"?JSON.stringify(e.text):e.text})]}),e.detail&&E.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 P5({node:e}){const n=e.status,i=ct[n]||ct.pending,l=e.iterationHistory&&e.iterationHistory.length>0;return E.jsxs("div",{className:"space-y-4",children:[E.jsxs("div",{className:"flex items-center gap-2",children:[E.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}),E.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Agent"})]}),l?E.jsx($b,{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}}):E.jsxs(E.Fragment,{children:[E.jsx(ua,{items:WS(e)}),e.prompt&&E.jsx(Zi,{output:e.prompt,title:"Input / Prompt",defaultExpanded:!0}),E.jsx(vm,{activity:e.activity,defaultExpanded:n!=="completed"}),e.output!=null&&E.jsx(Zi,{output:e.output,title:"Output"})]}),l&&[...e.iterationHistory].reverse().map(o=>E.jsx($b,{label:`Iteration ${o.iteration}`,defaultExpanded:!1,status:n,snapshot:o},o.iteration))]})}function $b({label:e,defaultExpanded:n,snapshot:i,status:l}){const[o,s]=X.useState(n);return E.jsxs("div",{className:"border border-[var(--border)] rounded-lg overflow-hidden",children:[E.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?E.jsx(oa,{className:"w-3.5 h-3.5 text-[var(--text-muted)] flex-shrink-0"}):E.jsx($o,{className:"w-3.5 h-3.5 text-[var(--text-muted)] flex-shrink-0"}),E.jsx("span",{className:"text-xs font-semibold text-[var(--text)]",children:e}),i.elapsed!=null&&E.jsx("span",{className:"text-[10px] text-[var(--text-muted)] ml-auto",children:F5(i.elapsed)})]}),o&&E.jsxs("div",{className:"px-3 py-3 space-y-3 border-t border-[var(--border)]",children:[E.jsx(ua,{items:WS(i)}),i.prompt&&E.jsx(Zi,{output:i.prompt,title:"Input / Prompt",defaultExpanded:!1}),E.jsx(vm,{activity:i.activity,defaultExpanded:n&&l!=="completed"}),i.output!=null&&E.jsx(Zi,{output:i.output,title:"Output",defaultExpanded:!0}),i.error_type&&E.jsxs("div",{className:"text-xs text-red-400",children:[E.jsx("span",{className:"font-semibold",children:i.error_type}),i.error_message&&E.jsxs("span",{className:"ml-1",children:["— ",i.error_message]})]})]})]})}function F5(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 Q5({node:e}){const n=e.status,i=ct[n]||ct.pending,l=[];e.elapsed!=null&&l.push({label:"Elapsed",value:Wl(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),E.jsxs("div",{className:"space-y-4",children:[E.jsxs("div",{className:"flex items-center gap-2",children:[E.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}),E.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Script"})]}),E.jsx(ua,{items:l}),o&&E.jsx(Zi,{output:o,title:"Output"})]})}function Z5(e,n){const i={};return(e[e.length-1]===""?[...e,""]:e).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const K5=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,J5=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,W5={};function Xb(e,n){return(W5.jsx?J5:K5).test(e)}const ej=/[ \t\n\f\r]/g;function tj(e){return typeof e=="object"?e.type==="text"?Pb(e.value):!1:Pb(e)}function Pb(e){return e.replace(ej,"")===""}class es{constructor(n,i,l){this.normal=i,this.property=n,l&&(this.space=l)}}es.prototype.normal={};es.prototype.property={};es.prototype.space=void 0;function e_(e,n){const i={},l={};for(const o of e)Object.assign(i,o.property),Object.assign(l,o.normal);return new es(i,l,n)}function qp(e){return e.toLowerCase()}class sn{constructor(n,i){this.attribute=i,this.property=n}}sn.prototype.attribute="";sn.prototype.booleanish=!1;sn.prototype.boolean=!1;sn.prototype.commaOrSpaceSeparated=!1;sn.prototype.commaSeparated=!1;sn.prototype.defined=!1;sn.prototype.mustUseProperty=!1;sn.prototype.number=!1;sn.prototype.overloadedBoolean=!1;sn.prototype.property="";sn.prototype.spaceSeparated=!1;sn.prototype.space=void 0;let nj=0;const De=Ki(),Ct=Ki(),Up=Ki(),pe=Ki(),rt=Ki(),Kl=Ki(),yn=Ki();function Ki(){return 2**++nj}const Ip=Object.freeze(Object.defineProperty({__proto__:null,boolean:De,booleanish:Ct,commaOrSpaceSeparated:yn,commaSeparated:Kl,number:pe,overloadedBoolean:Up,spaceSeparated:rt},Symbol.toStringTag,{value:"Module"})),lp=Object.keys(Ip);class bm extends sn{constructor(n,i,l,o){let s=-1;if(super(n,i),Fb(this,"space",o),typeof l=="number")for(;++s4&&i.slice(0,4)==="data"&&oj.test(n)){if(n.charAt(4)==="-"){const s=n.slice(5).replace(Qb,cj);l="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=n.slice(4);if(!Qb.test(s)){let u=s.replace(aj,uj);u.charAt(0)!=="-"&&(u="-"+u),n="data"+u}}o=bm}return new o(l,n)}function uj(e){return"-"+e.toLowerCase()}function cj(e){return e.charAt(1).toUpperCase()}const fj=e_([t_,rj,i_,l_,a_],"html"),wm=e_([t_,ij,i_,l_,a_],"svg");function dj(e){return e.join(" ").trim()}var ql={},ap,Zb;function hj(){if(Zb)return ap;Zb=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 b(S,_){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];_=_||{};var z=1,w=1;function T(H){var G=H.match(n);G&&(z+=G.length);var j=H.lastIndexOf(d);w=~j?H.length-j:w+H.length}function U(){var H={line:z,column:w};return function(G){return G.position=new A(H),I(),G}}function A(H){this.start=H,this.end={line:z,column:w},this.source=_.source}A.prototype.content=S;function L(H){var G=new Error(_.source+":"+z+":"+w+": "+H);if(G.reason=H,G.filename=_.source,G.line=z,G.column=w,G.source=S,!_.silent)throw G}function q(H){var G=H.exec(S);if(G){var j=G[0];return T(j),S=S.slice(j.length),G}}function I(){q(i)}function $(H){var G;for(H=H||[];G=R();)G!==!1&&H.push(G);return H}function R(){var H=U();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 L("End of comment missing");var j=S.slice(2,G-2);return w+=2,T(j),S=S.slice(G),w+=2,H({type:y,comment:j})}}function D(){var H=U(),G=q(l);if(G){if(R(),!q(o))return L("property missing ':'");var j=q(s),Y=H({type:v,property:C(G[0].replace(e,p)),value:j?C(j[0].replace(e,p)):p});return q(u),Y}}function ee(){var H=[];$(H);for(var G;G=D();)G!==!1&&(H.push(G),$(H));return H}return I(),ee()}function C(S){return S?S.replace(f,p):p}return ap=b,ap}var Kb;function pj(){if(Kb)return ql;Kb=1;var e=ql&&ql.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(ql,"__esModule",{value:!0}),ql.default=i;const n=e(hj());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 ql}var po={},Jb;function mj(){if(Jb)return po;Jb=1,Object.defineProperty(po,"__esModule",{value:!0}),po.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 po.camelCase=d,po}var mo,Wb;function gj(){if(Wb)return mo;Wb=1;var e=mo&&mo.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},n=e(pj()),i=mj();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,mo=l,mo}var yj=gj();const xj=Go(yj),o_=s_("end"),Sm=s_("start");function s_(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 vj(e){const n=Sm(e),i=o_(e);if(n&&i)return{start:n,end:i}}function Co(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?e1(e.position):"start"in e||"end"in e?e1(e):"line"in e||"column"in e?Vp(e):""}function Vp(e){return t1(e&&e.line)+":"+t1(e&&e.column)}function e1(e){return Vp(e&&e.start)+"-"+Vp(e&&e.end)}function t1(e){return e&&typeof e=="number"?e:1}class Xt 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=Co(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 _m={}.hasOwnProperty,bj=new Map,wj=/[A-Z]/g,Sj=new Set(["table","tbody","thead","tfoot","tr"]),_j=new Set(["td","th"]),u_="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Ej(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=jj(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=Mj(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"?wm:fj,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},s=c_(o,e,void 0);return s&&typeof s!="string"?s:o.create(e,o.Fragment,{children:s||void 0},void 0)}function c_(e,n,i){if(n.type==="element")return Nj(e,n,i);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return kj(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return zj(e,n,i);if(n.type==="mdxjsEsm")return Cj(e,n);if(n.type==="root")return Aj(e,n,i);if(n.type==="text")return Tj(e,n)}function Nj(e,n,i){const l=e.schema;let o=l;n.tagName.toLowerCase()==="svg"&&l.space==="html"&&(o=wm,e.schema=o),e.ancestors.push(n);const s=d_(e,n.tagName,!1),u=Oj(e,n);let f=Nm(e,n);return Sj.has(n.tagName)&&(f=f.filter(function(d){return typeof d=="string"?!tj(d):!0})),f_(e,u,s,n),Em(u,f),e.ancestors.pop(),e.schema=l,e.create(n,s,u,i)}function kj(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 Cj(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Vo(e,n.position)}function zj(e,n,i){const l=e.schema;let o=l;n.name==="svg"&&l.space==="html"&&(o=wm,e.schema=o),e.ancestors.push(n);const s=n.name===null?e.Fragment:d_(e,n.name,!0),u=Dj(e,n),f=Nm(e,n);return f_(e,u,s,n),Em(u,f),e.ancestors.pop(),e.schema=l,e.create(n,s,u,i)}function Aj(e,n,i){const l={};return Em(l,Nm(e,n)),e.create(n,e.Fragment,l,i)}function Tj(e,n){return n.value}function f_(e,n,i,l){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(n.node=l)}function Em(e,n){if(n.length>0){const i=n.length>1?n:n[0];i&&(e.children=i)}}function Mj(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 jj(e,n){return i;function i(l,o,s,u){const f=Array.isArray(s.children),d=Sm(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 Oj(e,n){const i={};let l,o;for(o in n.properties)if(o!=="children"&&_m.call(n.properties,o)){const s=Rj(e,o,n.properties[o]);if(s){const[u,f]=s;e.tableCellAlignToStyle&&u==="align"&&typeof f=="string"&&_j.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 Dj(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 Vo(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 Vo(e,n.position);else s=l.value===null?!0:l.value;i[o]=s}return i}function Nm(e,n){const i=[];let l=-1;const o=e.passKeys?new Map:bj;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 i1={}.hasOwnProperty;function Gj(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 Jl(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Wn=mi(/[A-Za-z]/),bn=mi(/[\dA-Za-z]/),Xj=mi(/[#-'*+\--9=?A-Z^-~]/);function Gp(e){return e!==null&&(e<32||e===127)}const Yp=mi(/\d/),Pj=mi(/[\dA-Fa-f]/),Fj=mi(/[!-/:-@[-`{-~]/);function ze(e){return e!==null&&e<-2}function an(e){return e!==null&&(e<0||e===32)}function Pe(e){return e===-2||e===-1||e===32}const Qj=mi(new RegExp("\\p{P}|\\p{S}","u")),Zj=mi(/\s/);function mi(e){return n;function n(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function fa(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 it(e,n,i,l){const o=l?l-1:Number.POSITIVE_INFINITY;let s=0;return u;function u(d){return Pe(d)?(e.enter(i),f(d)):n(d)}function f(d){return Pe(d)&&s++u))return;const L=n.events.length;let q=L,I,$;for(;q--;)if(n.events[q][0]==="exit"&&n.events[q][1].type==="chunkFlow"){if(I){$=n.events[q][1].end;break}I=!0}for(_(l),A=L;Aw;){const U=i[T];n.containerState=U[1],U[0].exit.call(n,e)}i.length=w}function z(){o.write([null]),s=void 0,o=void 0,n.containerState._closeFlow=void 0}}function tO(e,n,i){return it(e,e.attempt(this.parser.constructs.document,n,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function a1(e){if(e===null||an(e)||Zj(e))return 1;if(Qj(e))return 2}function Cm(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};o1(p,-d),o1(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=Mn(h,[["enter",e[l][1],n],["exit",e[l][1],n]])),h=Mn(h,[["enter",o,n],["enter",u,n],["exit",u,n],["enter",s,n]]),h=Mn(h,Cm(n.parser.constructs.insideSpan.null,e.slice(l+1,i),n)),h=Mn(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=Mn(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&&Pe(A)?it(e,z,"linePrefix",s+1)(A):z(A)}function z(A){return A===null||ze(A)?e.check(s1,C,T)(A):(e.enter("codeFlowValue"),w(A))}function w(A){return A===null||ze(A)?(e.exit("codeFlowValue"),z(A)):(e.consume(A),w)}function T(A){return e.exit("codeFenced"),n(A)}function U(A,L,q){let I=0;return $;function $(G){return A.enter("lineEnding"),A.consume(G),A.exit("lineEnding"),R}function R(G){return A.enter("codeFencedFence"),Pe(G)?it(A,D,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):D(G)}function D(G){return G===f?(A.enter("codeFencedFenceSequence"),ee(G)):q(G)}function ee(G){return G===f?(I++,A.consume(G),ee):I>=u?(A.exit("codeFencedFenceSequence"),Pe(G)?it(A,H,"whitespace")(G):H(G)):q(G)}function H(G){return G===null||ze(G)?(A.exit("codeFencedFence"),L(G)):q(G)}}}function hO(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 sp={name:"codeIndented",tokenize:mO},pO={partial:!0,tokenize:gO};function mO(e,n,i){const l=this;return o;function o(h){return e.enter("codeIndented"),it(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):ze(h)?e.attempt(pO,u,d)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||ze(h)?(e.exit("codeFlowValue"),u(h)):(e.consume(h),f)}function d(h){return e.exit("codeIndented"),n(h)}}function gO(e,n,i){const l=this;return o;function o(u){return l.parser.lazy[l.now().line]?i(u):ze(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o):it(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):ze(u)?o(u):i(u)}}const yO={name:"codeText",previous:vO,resolve:xO,tokenize:bO};function xO(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&&go(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),go(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),go(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 v_(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||Gp(_)?i(_):(e.enter(l),e.enter(u),e.enter(f),e.enter("chunkString",{contentType:"string"}),C(_))}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||ze(_)?i(_):(e.consume(_),_===92?b:v)}function b(_){return _===60||_===62||_===92?(e.consume(_),v):v(_)}function C(_){return!m&&(_===null||_===41||an(_))?(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):ze(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||ze(v)||f++>999?(e.exit("chunkString"),m(v)):(e.consume(v),d||(d=!Pe(v)),v===92?y:p)}function y(v){return v===91||v===92||v===93?(e.consume(v),f++,p):p(v)}}function w_(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):ze(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),it(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===u||y===null||ze(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 zo(e,n){let i;return l;function l(o){return ze(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i=!0,l):Pe(o)?it(e,l,i?"linePrefix":"lineSuffix")(o):n(o)}}const zO={name:"definition",tokenize:TO},AO={partial:!0,tokenize:MO};function TO(e,n,i){const l=this;let o;return s;function s(v){return e.enter("definition"),u(v)}function u(v){return b_.call(l,e,f,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function f(v){return o=Jl(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 an(v)?zo(e,h)(v):h(v)}function h(v){return v_(e,m,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function m(v){return e.attempt(AO,p,p)(v)}function p(v){return Pe(v)?it(e,y,"whitespace")(v):y(v)}function y(v){return v===null||ze(v)?(e.exit("definition"),l.parser.defined.push(o),n(v)):i(v)}}function MO(e,n,i){return l;function l(f){return an(f)?zo(e,o)(f):i(f)}function o(f){return w_(e,s,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function s(f){return Pe(f)?it(e,u,"whitespace")(f):u(f)}function u(f){return f===null||ze(f)?n(f):i(f)}}const jO={name:"hardBreakEscape",tokenize:OO};function OO(e,n,i){return l;function l(s){return e.enter("hardBreakEscape"),e.consume(s),o}function o(s){return ze(s)?(e.exit("hardBreakEscape"),n(s)):i(s)}}const DO={name:"headingAtx",resolve:RO,tokenize:LO};function RO(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 LO(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||an(m)?(e.exit("atxHeadingSequence"),f(m)):i(m)}function f(m){return m===35?(e.enter("atxHeadingSequence"),d(m)):m===null||ze(m)?(e.exit("atxHeading"),n(m)):Pe(m)?it(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||an(m)?(e.exit("atxHeadingText"),f(m)):(e.consume(m),h)}}const HO=["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"],c1=["pre","script","style","textarea"],BO={concrete:!0,name:"htmlFlow",resolveTo:IO,tokenize:VO},qO={partial:!0,tokenize:YO},UO={partial:!0,tokenize:GO};function IO(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 VO(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,C):N===63?(e.consume(N),o=3,l.interrupt?n:M):Wn(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,b):Wn(N)?(e.consume(N),o=4,l.interrupt?n:M):i(N)}function v(N){return N===45?(e.consume(N),l.interrupt?n:M):i(N)}function b(N){const V="CDATA[";return N===V.charCodeAt(f++)?(e.consume(N),f===V.length?l.interrupt?n:D:b):i(N)}function C(N){return Wn(N)?(e.consume(N),u=String.fromCharCode(N),S):i(N)}function S(N){if(N===null||N===47||N===62||an(N)){const V=N===47,F=u.toLowerCase();return!V&&!s&&c1.includes(F)?(o=1,l.interrupt?n(N):D(N)):HO.includes(u.toLowerCase())?(o=6,V?(e.consume(N),_):l.interrupt?n(N):D(N)):(o=7,l.interrupt&&!l.parser.lazy[l.now().line]?i(N):s?z(N):w(N))}return N===45||bn(N)?(e.consume(N),u+=String.fromCharCode(N),S):i(N)}function _(N){return N===62?(e.consume(N),l.interrupt?n:D):i(N)}function z(N){return Pe(N)?(e.consume(N),z):$(N)}function w(N){return N===47?(e.consume(N),$):N===58||N===95||Wn(N)?(e.consume(N),T):Pe(N)?(e.consume(N),w):$(N)}function T(N){return N===45||N===46||N===58||N===95||bn(N)?(e.consume(N),T):U(N)}function U(N){return N===61?(e.consume(N),A):Pe(N)?(e.consume(N),U):w(N)}function A(N){return N===null||N===60||N===61||N===62||N===96?i(N):N===34||N===39?(e.consume(N),d=N,L):Pe(N)?(e.consume(N),A):q(N)}function L(N){return N===d?(e.consume(N),d=null,I):N===null||ze(N)?i(N):(e.consume(N),L)}function q(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||an(N)?U(N):(e.consume(N),q)}function I(N){return N===47||N===62||Pe(N)?w(N):i(N)}function $(N){return N===62?(e.consume(N),R):i(N)}function R(N){return N===null||ze(N)?D(N):Pe(N)?(e.consume(N),R):i(N)}function D(N){return N===45&&o===2?(e.consume(N),j):N===60&&o===1?(e.consume(N),Y):N===62&&o===4?(e.consume(N),B):N===63&&o===3?(e.consume(N),M):N===93&&o===5?(e.consume(N),K):ze(N)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(qO,P,ee)(N)):N===null||ze(N)?(e.exit("htmlFlowData"),ee(N)):(e.consume(N),D)}function ee(N){return e.check(UO,H,P)(N)}function H(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),G}function G(N){return N===null||ze(N)?ee(N):(e.enter("htmlFlowData"),D(N))}function j(N){return N===45?(e.consume(N),M):D(N)}function Y(N){return N===47?(e.consume(N),u="",Z):D(N)}function Z(N){if(N===62){const V=u.toLowerCase();return c1.includes(V)?(e.consume(N),B):D(N)}return Wn(N)&&u.length<8?(e.consume(N),u+=String.fromCharCode(N),Z):D(N)}function K(N){return N===93?(e.consume(N),M):D(N)}function M(N){return N===62?(e.consume(N),B):N===45&&o===2?(e.consume(N),M):D(N)}function B(N){return N===null||ze(N)?(e.exit("htmlFlowData"),P(N)):(e.consume(N),B)}function P(N){return e.exit("htmlFlow"),n(N)}}function GO(e,n,i){const l=this;return o;function o(u){return ze(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(Nc,n,i)}}const $O={name:"htmlText",tokenize:XO};function XO(e,n,i){const l=this;let o,s,u;return f;function f(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),d}function d(M){return M===33?(e.consume(M),h):M===47?(e.consume(M),U):M===63?(e.consume(M),w):Wn(M)?(e.consume(M),q):i(M)}function h(M){return M===45?(e.consume(M),m):M===91?(e.consume(M),s=0,b):Wn(M)?(e.consume(M),z):i(M)}function m(M){return M===45?(e.consume(M),v):i(M)}function p(M){return M===null?i(M):M===45?(e.consume(M),y):ze(M)?(u=p,Y(M)):(e.consume(M),p)}function y(M){return M===45?(e.consume(M),v):p(M)}function v(M){return M===62?j(M):M===45?y(M):p(M)}function b(M){const B="CDATA[";return M===B.charCodeAt(s++)?(e.consume(M),s===B.length?C:b):i(M)}function C(M){return M===null?i(M):M===93?(e.consume(M),S):ze(M)?(u=C,Y(M)):(e.consume(M),C)}function S(M){return M===93?(e.consume(M),_):C(M)}function _(M){return M===62?j(M):M===93?(e.consume(M),_):C(M)}function z(M){return M===null||M===62?j(M):ze(M)?(u=z,Y(M)):(e.consume(M),z)}function w(M){return M===null?i(M):M===63?(e.consume(M),T):ze(M)?(u=w,Y(M)):(e.consume(M),w)}function T(M){return M===62?j(M):w(M)}function U(M){return Wn(M)?(e.consume(M),A):i(M)}function A(M){return M===45||bn(M)?(e.consume(M),A):L(M)}function L(M){return ze(M)?(u=L,Y(M)):Pe(M)?(e.consume(M),L):j(M)}function q(M){return M===45||bn(M)?(e.consume(M),q):M===47||M===62||an(M)?I(M):i(M)}function I(M){return M===47?(e.consume(M),j):M===58||M===95||Wn(M)?(e.consume(M),$):ze(M)?(u=I,Y(M)):Pe(M)?(e.consume(M),I):j(M)}function $(M){return M===45||M===46||M===58||M===95||bn(M)?(e.consume(M),$):R(M)}function R(M){return M===61?(e.consume(M),D):ze(M)?(u=R,Y(M)):Pe(M)?(e.consume(M),R):I(M)}function D(M){return M===null||M===60||M===61||M===62||M===96?i(M):M===34||M===39?(e.consume(M),o=M,ee):ze(M)?(u=D,Y(M)):Pe(M)?(e.consume(M),D):(e.consume(M),H)}function ee(M){return M===o?(e.consume(M),o=void 0,G):M===null?i(M):ze(M)?(u=ee,Y(M)):(e.consume(M),ee)}function H(M){return M===null||M===34||M===39||M===60||M===61||M===96?i(M):M===47||M===62||an(M)?I(M):(e.consume(M),H)}function G(M){return M===47||M===62||an(M)?I(M):i(M)}function j(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),n):i(M)}function Y(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),Z}function Z(M){return Pe(M)?it(e,K,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):K(M)}function K(M){return e.enter("htmlTextData"),u(M)}}const zm={name:"labelEnd",resolveAll:ZO,resolveTo:KO,tokenize:JO},PO={tokenize:WO},FO={tokenize:eD},QO={tokenize:tD};function ZO(e){let n=-1;const i=[];for(;++n=3&&(h===null||ze(h))?(e.exit("thematicBreak"),n(h)):i(h)}function d(h){return h===o?(e.consume(h),l++,d):(e.exit("thematicBreakSequence"),Pe(h)?it(e,f,"whitespace")(h):f(h))}}const rn={continuation:{tokenize:fD},exit:hD,name:"list",tokenize:cD},sD={partial:!0,tokenize:pD},uD={partial:!0,tokenize:dD};function cD(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 b=l.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!l.containerState.marker||v===l.containerState.marker:Yp(v)){if(l.containerState.type||(l.containerState.type=b,e.enter(b,{_container:!0})),b==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(Xu,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 Yp(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(Nc,l.interrupt?i:m,e.attempt(sD,y,p))}function m(v){return l.containerState.initialBlankLine=!0,s++,y(v)}function p(v){return Pe(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 fD(e,n,i){const l=this;return l.containerState._closeFlow=void 0,e.check(Nc,o,s);function o(f){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,it(e,n,"listItemIndent",l.containerState.size+1)(f)}function s(f){return l.containerState.furtherBlankLines||!Pe(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(uD,n,u)(f))}function u(f){return l.containerState._closeFlow=!0,l.interrupt=void 0,it(e,e.attempt(rn,n,i),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function dD(e,n,i){const l=this;return it(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 hD(e){e.exit(this.containerState.type)}function pD(e,n,i){const l=this;return it(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!Pe(s)&&u&&u[1].type==="listItemPrefixWhitespace"?n(s):i(s)}}const f1={name:"setextUnderline",resolveTo:mD,tokenize:gD};function mD(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 gD(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"),Pe(h)?it(e,d,"lineSuffix")(h):d(h))}function d(h){return h===null||ze(h)?(e.exit("setextHeadingLine"),n(h)):i(h)}}const yD={tokenize:xD};function xD(e){const n=this,i=e.attempt(Nc,l,e.attempt(this.parser.constructs.flowInitial,o,it(e,e.attempt(this.parser.constructs.flow,o,e.attempt(_O,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 vD={resolveAll:__()},bD=S_("string"),wD=S_("text");function S_(e){return{resolveAll:__(e==="text"?SD: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 RD(e,n){let i=-1;const l=[];let o;for(;++i0){const Pt=Ne.tokenStack[Ne.tokenStack.length-1];(Pt[1]||h1).call(Ne,void 0,Pt[0])}for(me.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})},Ge=-1;++Ge0&&(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 QD(e,n){const i={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function ZD(e,n){const i={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function KD(e,n){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",l=String(n.identifier).toUpperCase(),o=fa(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 JD(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 WD(e,n){if(e.options.allowDangerousHtml){const i={type:"raw",value:n.value};return e.patch(n,i),e.applyData(n,i)}}function k_(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 eR(e,n){const i=String(n.identifier).toUpperCase(),l=e.definitionById.get(i);if(!l)return k_(e,n);const o={src:fa(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:fa(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 nR(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 rR(e,n){const i=String(n.identifier).toUpperCase(),l=e.definitionById.get(i);if(!l)return k_(e,n);const o={href:fa(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 iR(e,n){const i={href:fa(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 lR(e,n,i){const l=e.all(n),o=i?aR(i):C_(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 oR(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=Sm(n.children[1]),d=o_(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 dR(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(g1(n.slice(o),o>0,!1)),s.join("")}function g1(e,n,i){let l=0,o=e.length;if(n){let s=e.codePointAt(l);for(;s===p1||s===m1;)l++,s=e.codePointAt(l)}if(i){let s=e.codePointAt(o-1);for(;s===p1||s===m1;)o--,s=e.codePointAt(o-1)}return o>l?e.slice(l,o):""}function mR(e,n){const i={type:"text",value:pR(String(n.value))};return e.patch(n,i),e.applyData(n,i)}function gR(e,n){const i={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,i),e.applyData(n,i)}const yR={blockquote:XD,break:PD,code:FD,delete:QD,emphasis:ZD,footnoteReference:KD,heading:JD,html:WD,imageReference:eR,image:tR,inlineCode:nR,linkReference:rR,link:iR,listItem:lR,list:oR,paragraph:sR,root:uR,strong:cR,table:fR,tableCell:hR,tableRow:dR,text:mR,thematicBreak:gR,toml:Lu,yaml:Lu,definition:Lu,footnoteDefinition:Lu};function Lu(){}const z_=-1,kc=0,Ao=1,sc=2,Am=3,Tm=4,Mm=5,jm=6,A_=7,T_=8,y1=typeof self=="object"?self:globalThis,xR=(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 kc:case z_:return i(u,o);case Ao:{const f=i([],o);for(const d of u)f.push(l(d));return f}case sc:{const f=i({},o);for(const[d,h]of u)f[l(d)]=l(h);return f}case Am:return i(new Date(u),o);case Tm:{const{source:f,flags:d}=u;return i(new RegExp(f,d),o)}case Mm:{const f=i(new Map,o);for(const[d,h]of u)f.set(l(d),l(h));return f}case jm:{const f=i(new Set,o);for(const d of u)f.add(l(d));return f}case A_:{const{name:f,message:d}=u;return i(new y1[f](d),o)}case T_: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 y1[s](u),o)};return l},x1=e=>xR(new Map,e)(0),Ul="",{toString:vR}={},{keys:bR}=Object,yo=e=>{const n=typeof e;if(n!=="object"||!e)return[kc,n];const i=vR.call(e).slice(8,-1);switch(i){case"Array":return[Ao,Ul];case"Object":return[sc,Ul];case"Date":return[Am,Ul];case"RegExp":return[Tm,Ul];case"Map":return[Mm,Ul];case"Set":return[jm,Ul];case"DataView":return[Ao,i]}return i.includes("Array")?[Ao,i]:i.includes("Error")?[A_,i]:[sc,i]},Hu=([e,n])=>e===kc&&(n==="function"||n==="symbol"),wR=(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]=yo(u);switch(f){case kc:{let m=u;switch(d){case"bigint":f=T_,m=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);m=null;break;case"undefined":return o([z_],u)}return o([f,m],u)}case Ao:{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 sc:{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 bR(u))(e||!Hu(yo(u[y])))&&m.push([s(y),s(u[y])]);return p}case Am:return o([f,u.toISOString()],u);case Tm:{const{source:m,flags:p}=u;return o([f,{source:m,flags:p}],u)}case Mm:{const m=[],p=o([f,m],u);for(const[y,v]of u)(e||!(Hu(yo(y))||Hu(yo(v))))&&m.push([s(y),s(v)]);return p}case jm:{const m=[],p=o([f,m],u);for(const y of u)(e||!Hu(yo(y)))&&m.push(s(y));return p}}const{message:h}=u;return o([f,{name:d,message:h}],u)};return s},v1=(e,{json:n,lossy:i}={})=>{const l=[];return wR(!(n||i),!!n,new Map,l)(e),l},uc=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?x1(v1(e,n)):structuredClone(e):(e,n)=>x1(v1(e,n));function SR(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 _R(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function ER(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=e.options.footnoteBackContent||SR,l=e.options.footnoteBackLabel||_R,o=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let d=-1;for(;++d0&&b.push({type:"text",value:" "});let z=typeof i=="string"?i:i(d,v);typeof z=="string"&&(z={type:"text",value:z}),b.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(...b)}else m.push(...b);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:{...uc(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 M_=(function(e){if(e==null)return zR;if(typeof e=="function")return Cc(e);if(typeof e=="object")return Array.isArray(e)?NR(e):kR(e);if(typeof e=="string")return CR(e);throw new Error("Expected function, string, or object as test")});function NR(e){const n=[];let i=-1;for(;++i":""))+")"})}return y;function y(){let v=j_,b,C,S;if((!n||s(d,h,m[m.length-1]||void 0))&&(v=OR(i(d,m)),v[0]===b1))return v;if("children"in d&&d.children){const _=d;if(_.children&&v[0]!==MR)for(C=(l?_.children.length:-1)+u,S=m.concat(_);C>-1&&C<_.children.length;){const z=_.children[C];if(b=f(z,C,S)(),b[0]===b1)return b;C=typeof b[1]=="number"?b[1]:C+u}}return v}}}function OR(e){return Array.isArray(e)?e:typeof e=="number"?[TR,e]:e==null?j_:[e]}function O_(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),jR(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 Xp={}.hasOwnProperty,DR={};function RR(e,n){const i=n||DR,l=new Map,o=new Map,s=new Map,u={...yR,...i.handlers},f={all:h,applyData:HR,definitionById:l,footnoteById:o,footnoteCounts:s,footnoteOrder:[],handlers:u,one:d,options:i,patch:LR,wrap:qR};return O_(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(Xp.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:C,...S}=m,_=uc(S);return _.children=f.all(m),_}return uc(m)}return(f.options.unknownHandler||BR)(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 w1(e){let n=0,i=e.charCodeAt(n);for(;i===9||i===32;)n++,i=e.charCodeAt(n);return e.slice(n)}function S1(e,n){const i=RR(e,n),l=i.one(e,void 0),o=ER(i),s=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return o&&s.children.push({type:"text",value:` +`},o),s}function UR(e,n){return e&&"run"in e?async function(i,l){const o=S1(i,{file:l,...n});await e.run(o,l)}:function(i,l){return S1(i,{file:l,...e||n})}}function _1(e){if(e)throw e}var cp,E1;function IR(){if(E1)return cp;E1=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 cp=function d(){var h,m,p,y,v,b,C=arguments[0],S=1,_=arguments.length,z=!1;for(typeof C=="boolean"&&(z=C,C=arguments[1]||{},S=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});S<_;++S)if(h=arguments[S],h!=null)for(m in h)p=f(C,m),y=f(h,m),C!==y&&(z&&y&&(s(y)||(v=o(y)))?(v?(v=!1,b=p&&o(p)?p:[]):b=p&&s(p)?p:{},u(C,{name:m,newValue:d(z,b,y)})):typeof y<"u"&&u(C,{name:m,newValue:y}));return C},cp}var VR=IR();const fp=Go(VR);function Pp(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 GR(){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 Kn={basename:$R,dirname:XR,extname:PR,join:FR,sep:"/"};function $R(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');ts(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 XR(e){if(ts(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 PR(e){ts(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 FR(...e){let n=-1,i;for(;++n0&&e.codePointAt(e.length-1)===47&&(i+="/"),n?"/"+i:i}function ZR(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 ts(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const KR={cwd:JR};function JR(){return"/"}function Fp(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function WR(e){if(typeof e=="string")e=new URL(e);else if(!Fp(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 e6(e)}function e6(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,...b]=m;const C=l[y][1];Pp(C)&&Pp(v)&&(v=fp(!0,C,v)),l[y]=[h,v,...b]}}}}const i6=new Om().freeze();function mp(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function gp(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function yp(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 k1(e){if(!Pp(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function C1(e,n,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function Bu(e){return l6(e)?e:new D_(e)}function l6(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function a6(e){return typeof e=="string"||o6(e)}function o6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const s6="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",z1=[],A1={allowDangerousHtml:!0},u6=/^(https?|ircs?|mailto|xmpp)$/i,c6=[{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=d6(e),i=h6(e);return p6(n.runSync(n.parse(i),i),e)}function d6(e){const n=e.rehypePlugins||z1,i=e.remarkPlugins||z1,l=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...A1}:A1;return i6().use($D).use(i).use(UR,l).use(n)}function h6(e){const n=e.children||"",i=new D_;return typeof n=="string"&&(i.value=n),i}function p6(e,n){const i=n.allowedElements,l=n.allowElement,o=n.components,s=n.disallowedElements,u=n.skipHtml,f=n.unwrapDisallowed,d=n.urlTransform||m6;for(const m of c6)Object.hasOwn(n,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+s6+m.id,void 0);return O_(e,h),Ej(e,{Fragment:E.Fragment,components:o,ignoreInvalidStyle:!0,jsx:E.jsx,jsxs:E.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 op)if(Object.hasOwn(op,v)&&Object.hasOwn(m.properties,v)){const b=m.properties[v],C=op[v];(C===null||C.includes(m.tagName))&&(m.properties[v]=d(String(b||""),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 m6(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||u6.test(e.slice(0,n))?e:""}function g6({node:e}){const n=Ee(w=>w.sendGateResponse),i=Ee(w=>w.wsStatus),[l,o]=X.useState(null),[s,u]=X.useState(""),[f,d]=X.useState(null),[h,m]=X.useState(!1),p=e.status==="waiting",y=e.status==="completed";X.useEffect(()=>{p&&(o(null),u(""),d(null),m(!1))},[p]);const v=p&&i==="connected"&&l===null,b=(w,T)=>{if(v){if(T){o(w),d(T);return}o(w),m(!0),n(e.name,w)}},C=()=>{if(l===null||f===null)return;const w={[f]:s};m(!0),n(e.name,l,w),d(null)},S=e.option_details,_=S==null?void 0:S.find(w=>w.value===e.selected_option),z=(_==null?void 0:_.label)||e.selected_option;return E.jsxs("div",{className:"space-y-3",children:[p&&E.jsxs(E.Fragment,{children:[E.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:[E.jsxs("span",{className:"relative flex h-2.5 w-2.5 flex-shrink-0",children:[E.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-amber-400 opacity-75"}),E.jsx("span",{className:"relative inline-flex rounded-full h-2.5 w-2.5 bg-amber-500"})]}),E.jsx("span",{className:"text-xs font-semibold text-amber-400 tracking-wide",children:"Decision Required"})]}),e.prompt&&E.jsx("div",{className:"border-l-2 border-amber-500/50 pl-3 py-0.5",children:E.jsx(xp,{text:e.prompt,muted:!1})}),S&&S.length>0&&E.jsxs("div",{className:"space-y-2",children:[E.jsx("div",{className:"flex flex-col gap-1.5",children:S.map(w=>{const T=l===w.value,U=l!==null&&!T;return E.jsx("button",{disabled:!v&&!T,onClick:()=>b(w.value,w.prompt_for),className:`w-full text-left px-3 py-2.5 rounded-lg border transition-all duration-150 ${T?"border-green-500/60 bg-green-500/10":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:E.jsxs("div",{className:"flex items-center gap-2.5",children:[E.jsx("div",{className:"flex-shrink-0",children:T?E.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500 flex items-center justify-center",children:E.jsx(Ii,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}):E.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"}`})}),E.jsx("div",{className:"flex-1 min-w-0",children:E.jsx("span",{className:`text-xs font-medium ${T?"text-green-400":"text-[var(--text)]"}`,children:w.label})}),w.route&&E.jsxs("span",{className:"text-[10px] text-[var(--text-muted)] flex-shrink-0",children:["→ ",w.route]})]})},w.value)})}),h&&!f&&E.jsxs("div",{className:"flex items-center gap-2 px-1",children:[E.jsx(To,{className:"w-3 h-3 text-green-400 animate-spin"}),E.jsx("span",{className:"text-[10px] text-green-400",children:"Sending..."})]}),v&&E.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&&E.jsxs("div",{className:"space-y-1.5",children:[E.jsx("h4",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)] font-semibold",children:"Options"}),E.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.options.map(w=>E.jsx("span",{className:"text-[11px] px-2 py-0.5 rounded border border-[var(--border)] text-[var(--text-muted)]",children:w},w))})]}),f&&E.jsxs("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--bg)] overflow-hidden",children:[E.jsx("div",{className:"px-3 py-2 border-b border-[var(--border)] bg-[var(--surface)]",children:E.jsx("h4",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)] font-semibold",children:f})}),E.jsxs("div",{className:"p-3 space-y-2",children:[E.jsx("input",{type:"text",value:s,onChange:w=>u(w.target.value),onKeyDown:w=>w.key==="Enter"&&C(),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}),E.jsxs("div",{className:"flex items-center justify-between",children:[E.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:"Press Enter or click Submit"}),E.jsxs("button",{onClick:C,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:[E.jsx(hN,{className:"w-3 h-3"}),"Submit"]})]})]})]})]}),y&&E.jsxs(E.Fragment,{children:[E.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:[E.jsx(Ii,{className:"w-3.5 h-3.5 text-green-400 flex-shrink-0"}),E.jsx("span",{className:"text-xs font-semibold text-green-400 tracking-wide",children:"Decision Completed"})]}),e.prompt&&E.jsx("div",{className:"border-l-2 border-[var(--border)] pl-3 py-0.5",children:E.jsx(xp,{text:e.prompt,muted:!0})}),z&&E.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:[E.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500 flex items-center justify-center flex-shrink-0",children:E.jsx(Ii,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),E.jsx("span",{className:"text-xs font-medium text-[var(--text)]",children:z}),e.route&&E.jsxs("span",{className:"ml-auto text-[10px] text-[var(--text-muted)]",children:["→ ",e.route]})]}),S&&S.length>1&&E.jsx("div",{className:"space-y-1",children:S.filter(w=>w.value!==e.selected_option).map(w=>E.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 rounded-lg opacity-35",children:[E.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[var(--border)] flex-shrink-0"}),E.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:w.label}),w.route&&E.jsxs("span",{className:"ml-auto text-[10px] text-[var(--text-muted)]",children:["→ ",w.route]})]},w.value))}),!S&&e.options&&e.options.length>0&&E.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.options.map(w=>E.jsxs("span",{className:`text-[11px] px-2.5 py-1 rounded-lg border ${w===e.selected_option?"border-green-500/30 text-green-400 bg-green-500/5":"border-[var(--border)] text-[var(--text-muted)] opacity-40"}`,children:[w===e.selected_option&&"✓ ",w]},w))}),E.jsx(y6,{node:e})]}),!p&&!y&&E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Human Gate"}),E.jsxs("span",{className:"text-[10px] text-[var(--text-muted)] capitalize",children:["(",e.status,")"]})]}),e.prompt&&E.jsx("div",{className:"border-l-2 border-[var(--border)] pl-3 py-0.5",children:E.jsx(xp,{text:e.prompt,muted:!0})})]})]})}function xp({text:e,muted:n}){const i=n?"text-[var(--text-muted)]":"text-[var(--text)]";return E.jsx("div",{className:`gate-markdown text-xs leading-relaxed ${i}`,children:E.jsx(f6,{components:{h1:({children:l})=>E.jsx("h1",{className:"text-sm font-bold mb-2 mt-1",children:l}),h2:({children:l})=>E.jsx("h2",{className:"text-xs font-bold mb-1.5 mt-1",children:l}),h3:({children:l})=>E.jsx("h3",{className:"text-xs font-semibold mb-1 mt-1",children:l}),p:({children:l})=>E.jsx("p",{className:"mb-1.5 last:mb-0",children:l}),ul:({children:l})=>E.jsx("ul",{className:"list-disc list-inside mb-1.5 space-y-0.5",children:l}),ol:({children:l})=>E.jsx("ol",{className:"list-decimal list-inside mb-1.5 space-y-0.5",children:l}),li:({children:l})=>E.jsx("li",{children:l}),code:({children:l,className:o})=>(o==null?void 0:o.includes("language-"))?E.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}):E.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})=>E.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})=>E.jsx("strong",{className:"font-semibold",children:l}),em:({children:l})=>E.jsx("em",{className:"italic",children:l}),a:({href:l,children:o})=>E.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})=>E.jsx("blockquote",{className:"border-l-2 border-[var(--border)] pl-2.5 my-1.5 opacity-80",children:l}),hr:()=>E.jsx("hr",{className:"border-[var(--border)] my-2"})},children:e})})}function y6({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:E.jsx(ua,{items:n})}function x6({node:e}){const n=e.status,i=ct[n]||ct.pending,o=Ee(m=>m.groupProgress)[e.name],s=e.type==="for_each_group",[u,f]=X.useState(!0),d=[];e.elapsed!=null&&d.push({label:"Elapsed",value:Wl(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 E.jsxs("div",{className:"space-y-4",children:[E.jsxs("div",{className:"flex items-center gap-2",children:[E.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}),E.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s?"For-Each Group":"Parallel Group"})]}),o&&o.total>0&&E.jsxs("div",{className:"space-y-1",children:[E.jsxs("div",{className:"flex justify-between text-[10px] text-[var(--text-muted)]",children:[E.jsx("span",{children:"Progress"}),E.jsxs("span",{children:[o.completed+o.failed,"/",o.total]})]}),E.jsx("div",{className:"h-1.5 bg-[var(--bg)] rounded-full overflow-hidden",children:E.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)"}})})]}),E.jsx(ua,{items:d}),s&&h&&h.length>0&&E.jsxs("div",{className:"space-y-2",children:[E.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?E.jsx(oa,{className:"w-3 h-3"}):E.jsx($o,{className:"w-3 h-3"}),"Items (",h.length,")"]}),u&&E.jsx("div",{className:"space-y-1",children:h.map(m=>E.jsx(b6,{item:m},`${m.key}-${m.index}`))})]})]})}const v6={running:ct.running,completed:ct.completed,failed:ct.failed};function b6({item:e}){const[n,i]=X.useState(e.status==="running"),l=v6[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:Wl(e.elapsed)}),e.tokens!=null&&s.push({label:"Tokens",value:Eo(e.tokens)}),e.cost_usd!=null&&s.push({label:"Cost",value:wp(e.cost_usd)}),E.jsxs("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--surface)] overflow-hidden",children:[E.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?E.jsx(oa,{className:"w-3 h-3 text-[var(--text-muted)] flex-shrink-0"}):E.jsx($o,{className:"w-3 h-3 text-[var(--text-muted)] flex-shrink-0"}):e.status==="running"?E.jsx(To,{className:"w-3 h-3 animate-spin flex-shrink-0",style:{color:l}}):E.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0 ml-0.5 mr-0.5",style:{backgroundColor:l}}),E.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)&&E.jsxs("span",{className:"flex items-center gap-2 text-[10px] text-[var(--text-muted)] flex-shrink-0",children:[e.elapsed!=null&&E.jsx("span",{children:Wl(e.elapsed)}),e.tokens!=null&&E.jsx("span",{children:Eo(e.tokens)}),e.cost_usd!=null&&E.jsx("span",{children:wp(e.cost_usd)})]}),E.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&&E.jsxs("div",{className:"px-3 py-3 space-y-3 border-t border-[var(--border)]",children:[s.length>0&&E.jsx(ua,{items:s}),e.prompt&&E.jsx(Zi,{output:e.prompt,title:"Input / Prompt",defaultExpanded:!1}),e.activity&&e.activity.length>0&&E.jsx(vm,{activity:e.activity,defaultExpanded:e.status!=="completed"}),e.output!=null&&E.jsx(Zi,{output:e.output,title:"Output",defaultExpanded:!0}),e.status==="failed"&&(e.error_type||e.error_message)&&E.jsxs("div",{className:"text-xs text-red-400",children:[e.error_type&&E.jsx("span",{className:"font-semibold",children:e.error_type}),e.error_message&&E.jsxs("span",{className:"ml-1",children:["— ",e.error_message]})]})]})]})}function w6(){const e=Ee(s=>s.selectedNode),n=Ee(s=>s.nodes),i=Ee(s=>s.selectNode),l=e?n[e]:null;if(!e||!l)return E.jsxs("div",{className:"h-full flex flex-col bg-[var(--surface)]",children:[E.jsx("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:E.jsx("h2",{className:"text-sm font-semibold text-[var(--text)]",children:"Detail"})}),E.jsx("div",{className:"flex-1 flex items-center justify-center",children:E.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Click a node to view details"})})]});const o=(()=>{switch(l.type){case"script":return Q5;case"human_gate":return g6;case"parallel_group":case"for_each_group":return x6;default:return P5}})();return E.jsxs("div",{className:"h-full flex flex-col bg-[var(--surface)]",children:[E.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)] flex-shrink-0",children:[E.jsx("h2",{className:"text-sm font-semibold text-[var(--text)] truncate",children:e}),E.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:E.jsx(L1,{className:"w-4 h-4"})})]}),E.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3",children:E.jsx(o,{node:l})})]})}function Pu(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function S6(){const e=Ee(S=>S.eventLog),n=Ee(S=>S.activityLog),i=Ee(S=>S.workflowOutput),l=Ee(S=>S.workflowStatus),[o,s]=X.useState("log"),[u,f]=X.useState(!1),[d,h]=X.useState(0),[m,p]=X.useState(0),y=X.useCallback(S=>{s(S),S==="log"&&h(e.length),S==="activity"&&p(n.length)},[e.length,n.length]);X.useEffect(()=>{o==="log"&&h(e.length)},[o,e.length]),X.useEffect(()=>{o==="activity"&&p(n.length)},[o,n.length]),X.useEffect(()=>{l==="completed"&&i!=null&&s("output")},[l,i]);const v=i!=null,b=o!=="log"?Math.max(0,e.length-d):0,C=o!=="activity"?Math.max(0,n.length-m):0;return u?E.jsx("div",{className:"flex items-center bg-[var(--surface)] border-t border-[var(--border)] px-3 py-1",children:E.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:[E.jsx(iN,{className:"w-3 h-3"}),E.jsx(kx,{className:"w-3 h-3"}),E.jsx("span",{children:"Output"}),n.length>0&&E.jsxs("span",{className:"text-[10px] text-[var(--text-muted)]",children:["(",n.length,")"]})]})}):E.jsxs("div",{className:"flex flex-col h-full bg-[var(--surface)] border-t border-[var(--border)]",children:[E.jsxs("div",{className:"flex items-center justify-between px-2 flex-shrink-0 border-b border-[var(--border)]",children:[E.jsxs("div",{className:"flex items-center gap-0.5",children:[E.jsx(vp,{active:o==="log",onClick:()=>y("log"),icon:E.jsx(kx,{className:"w-3 h-3"}),label:"Log",count:e.length,unread:b}),E.jsx(vp,{active:o==="activity",onClick:()=>y("activity"),icon:E.jsx(D1,{className:"w-3 h-3"}),label:"Activity",count:n.length,unread:C}),E.jsx(vp,{active:o==="output",onClick:()=>y("output"),icon:E.jsx(aN,{className:"w-3 h-3"}),label:"Output",badge:v?l==="failed"?"error":"success":void 0})]}),E.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:E.jsx(oa,{className:"w-3.5 h-3.5"})})]}),E.jsx("div",{className:"flex-1 overflow-hidden",children:o==="activity"?E.jsx(_6,{entries:n}):o==="log"?E.jsx(E6,{entries:e}):E.jsx(N6,{output:i,status:l})})]})}function vp({active:e,onClick:n,icon:i,label:l,count:o,badge:s,unread:u}){return E.jsxs("button",{onClick:n,className:Rt("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,E.jsx("span",{children:l}),o!=null&&o>0&&E.jsx("span",{className:"text-[10px] text-[var(--text-muted)] tabular-nums",children:o}),s&&E.jsx("span",{className:Rt("w-1.5 h-1.5 rounded-full",s==="success"?"bg-[var(--completed)]":"bg-[var(--failed)]")}),!e&&u!=null&&u>0&&E.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:E.jsx("span",{className:"text-[8px] font-bold text-white leading-none tabular-nums",children:u>99?"99+":u})})]})}const T1={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 _6({entries:e}){const n=X.useRef(null),i=X.useRef(!0),l=Ee(d=>d.selectNode),[o,s]=X.useState(""),u=X.useCallback(()=>{const d=n.current;if(!d)return;const h=d.scrollHeight-d.scrollTop-d.clientHeight<30;i.current=h},[]),f=X.useMemo(()=>{if(!o)return e;const d=o.toLowerCase();return e.filter(h=>h.source.toLowerCase().includes(d)||Pu(h.message).toLowerCase().includes(d))},[e,o]);return X.useEffect(()=>{n.current&&i.current&&(n.current.scrollTop=n.current.scrollHeight)},[f.length]),e.length===0?E.jsx("div",{className:"h-full flex items-center justify-center",children:E.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Waiting for agent activity…"})}):E.jsxs("div",{className:"h-full flex flex-col",children:[E.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-[var(--border-subtle)] flex-shrink-0",children:[E.jsx(dN,{className:"w-3 h-3 text-[var(--text-muted)] flex-shrink-0"}),E.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&&E.jsxs(E.Fragment,{children:[E.jsxs("span",{className:"text-[10px] text-[var(--text-muted)] tabular-nums flex-shrink-0",children:[f.length," of ",e.length]}),E.jsx("button",{onClick:()=>s(""),className:"text-[var(--text-muted)] hover:text-[var(--text)] transition-colors flex-shrink-0",title:"Clear filter",children:E.jsx(L1,{className:"w-3 h-3"})})]})]}),E.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=T1[d.type]||T1.message,p=R_(d.timestamp);return E.jsxs("div",{className:"group",children:[E.jsxs("div",{className:"flex gap-1.5 hover:bg-[var(--surface-hover)] rounded px-1 -mx-1",children:[E.jsx("span",{className:"text-[var(--text-muted)] flex-shrink-0 select-none tabular-nums",children:p}),E.jsx("span",{className:Rt("flex-shrink-0 w-[5ch] text-[10px] font-semibold tabular-nums select-none",m.labelColor),children:m.label}),E.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}),E.jsx("span",{className:Rt("break-words min-w-0",m.color,d.type==="reasoning"&&"italic"),children:Pu(d.message)})]}),d.detail&&E.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:Pu(d.detail)})]},h)}),o&&f.length===0&&E.jsx("div",{className:"flex items-center justify-center py-4",children:E.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:['No matches for "',o,'"']})})]})]})}const M1={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 E6({entries:e}){const n=X.useRef(null),i=X.useRef(!0),l=Ee(s=>s.selectNode),o=X.useCallback(()=>{const s=n.current;if(!s)return;const u=s.scrollHeight-s.scrollTop-s.clientHeight<30;i.current=u},[]);return X.useEffect(()=>{n.current&&i.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.length]),e.length===0?E.jsx("div",{className:"h-full flex items-center justify-center",children:E.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Waiting for events…"})}):E.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=M1[s.level]||M1.info,d=R_(s.timestamp);return E.jsxs("div",{className:"flex gap-2 hover:bg-[var(--surface-hover)] rounded px-1 -mx-1",children:[E.jsx("span",{className:"text-[var(--text-muted)] flex-shrink-0 select-none tabular-nums",children:d}),E.jsx("span",{className:Rt("flex-shrink-0 w-3 text-center select-none",f.color),children:f.icon}),E.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}),E.jsx("span",{className:Rt("break-words",s.level==="error"?"text-red-400":s.level==="success"?"text-green-400":"text-[var(--text)]"),children:Pu(s.message)})]},u)})})}function R_(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 N6({output:e,status:n}){const[i,l]=X.useState(!1),o=G1(e),s=async()=>{o&&(await navigator.clipboard.writeText(o),l(!0),setTimeout(()=>l(!1),2e3))};return e==null?E.jsx("div",{className:"h-full flex items-center justify-center",children:E.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"})}):E.jsxs("div",{className:"h-full flex flex-col",children:[E.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-b border-[var(--border-subtle)] flex-shrink-0",children:[E.jsx("span",{className:"text-[10px] text-[var(--text-muted)] uppercase tracking-wider font-semibold",children:"Workflow Result"}),E.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?E.jsxs(E.Fragment,{children:[E.jsx(Ii,{className:"w-3 h-3 text-[var(--completed)]"}),E.jsx("span",{className:"text-[var(--completed)]",children:"Copied"})]}):E.jsxs(E.Fragment,{children:[E.jsx(R1,{className:"w-3 h-3"}),E.jsx("span",{children:"Copy"})]})})]}),E.jsx("div",{className:"flex-1 overflow-auto px-3 py-2",children:E.jsx("pre",{className:"font-mono text-[11px] leading-relaxed text-[var(--text)] whitespace-pre-wrap break-words",children:typeof e=="object"?E.jsx(k6,{text:o}):o})})]})}function k6({text:e}){const n=e.split(/("(?:[^"\\]|\\.)*")/g);return E.jsx(E.Fragment,{children:n.map((i,l)=>{if(l%2===1){const s=n.slice(l+1).join(""),u=/^\s*:/.test(s);return E.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 E.jsx("span",{dangerouslySetInnerHTML:{__html:o}},l)})})}function C6(){const e=Ee(n=>n.selectedNode);return E.jsxs(_p,{direction:"vertical",className:"flex-1 overflow-hidden",children:[E.jsx(xo,{defaultSize:70,minSize:30,children:E.jsxs(_p,{direction:"horizontal",className:"h-full",children:[E.jsx(xo,{defaultSize:e?65:100,minSize:40,children:E.jsx(V5,{})}),e&&E.jsxs(E.Fragment,{children:[E.jsx(Ep,{className:"w-[3px] bg-[var(--border)] hover:bg-[var(--text-muted)] transition-colors cursor-col-resize"}),E.jsx(xo,{defaultSize:35,minSize:20,maxSize:60,children:E.jsx(w6,{})})]})]})}),E.jsx(Ep,{className:"h-[3px] bg-[var(--border)] hover:bg-[var(--text-muted)] transition-colors cursor-row-resize"}),E.jsx(xo,{defaultSize:30,minSize:5,maxSize:70,collapsible:!0,children:E.jsx(S6,{})})]})}const z6=3e4;function A6(){const e=Ee(h=>h.processEvent),n=Ee(h=>h.replayState),i=Ee(h=>h.setWsStatus),l=Ee(h=>h.setWsSend),o=X.useRef(null),s=X.useRef(1e3),u=X.useRef(null),f=X.useCallback(()=>{const m=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;try{const p=new WebSocket(m);o.current=p,p.onopen=()=>{s.current=1e3,i("connected"),l(y=>{p.readyState===WebSocket.OPEN&&p.send(JSON.stringify(y))})},p.onmessage=y=>{try{const v=JSON.parse(y.data);e(v)}catch(v){console.error("Failed to parse WebSocket message:",v)}},p.onclose=()=>{i("disconnected"),l(null),o.current=null,d()},p.onerror=()=>{}}catch{d()}},[e,i,l]),d=X.useCallback(()=>{i("reconnecting"),u.current=setTimeout(()=>{s.current=Math.min(s.current*2,z6),f()},s.current)},[f,i]);X.useEffect(()=>(i("connecting"),fetch("/api/state").then(h=>h.json()).then(h=>{h&&h.length>0&&n(h),f()}).catch(h=>{console.error("Failed to fetch state:",h),f()}),()=>{u.current&&clearTimeout(u.current),o.current&&o.current.close(),l(null)}),[f,n,i,l])}function T6(){A6();const e=Ee(i=>i.selectNode),n=Ee(i=>i.workflowName);return X.useEffect(()=>{document.title=n?`Conductor — ${n}`:"Conductor Dashboard"},[n]),X.useEffect(()=>{const i=l=>{l.key==="Escape"&&e(null)};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[e]),E.jsxs("div",{className:"h-full flex flex-col bg-[var(--bg)]",children:[E.jsx(_N,{}),E.jsx(C6,{}),E.jsx(ik,{})]})}W2.createRoot(document.getElementById("root")).render(E.jsx(X.StrictMode,{children:E.jsx(T6,{})})); diff --git a/src/conductor/web/static/assets/index-DQdjaAAR.js b/src/conductor/web/static/assets/index-DQdjaAAR.js deleted file mode 100644 index 7cb2e6e..0000000 --- a/src/conductor/web/static/assets/index-DQdjaAAR.js +++ /dev/null @@ -1,207 +0,0 @@ -var G_=Object.defineProperty;var V_=(t,l,r)=>l in t?G_(t,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[l]=r;var ft=(t,l,r)=>V_(t,typeof l!="symbol"?l+"":l,r);function Y_(t,l){for(var r=0;ri[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const u of s)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&i(c)}).observe(document,{childList:!0,subtree:!0});function r(s){const u={};return s.integrity&&(u.integrity=s.integrity),s.referrerPolicy&&(u.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?u.credentials="include":s.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(s){if(s.ep)return;s.ep=!0;const u=r(s);fetch(s.href,u)}})();function zh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Gf={exports:{}},_i={};/** - * @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 k0;function X_(){if(k0)return _i;k0=1;var t=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function r(i,s,u){var c=null;if(u!==void 0&&(c=""+u),s.key!==void 0&&(c=""+s.key),"key"in s){u={};for(var d in s)d!=="key"&&(u[d]=s[d])}else u=s;return s=u.ref,{$$typeof:t,type:i,key:c,ref:s!==void 0?s:null,props:u}}return _i.Fragment=l,_i.jsx=r,_i.jsxs=r,_i}var H0;function $_(){return H0||(H0=1,Gf.exports=X_()),Gf.exports}var C=$_(),Vf={exports:{}},Ee={};/** - * @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 L0;function Q_(){if(L0)return Ee;L0=1;var t=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),v=Symbol.iterator;function x(O){return O===null||typeof O!="object"?null:(O=v&&O[v]||O["@@iterator"],typeof O=="function"?O:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,_={};function E(O,X,j){this.props=O,this.context=X,this.refs=_,this.updater=j||w}E.prototype.isReactComponent={},E.prototype.setState=function(O,X){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,X,"setState")},E.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function M(){}M.prototype=E.prototype;function S(O,X,j){this.props=O,this.context=X,this.refs=_,this.updater=j||w}var z=S.prototype=new M;z.constructor=S,N(z,E.prototype),z.isPureReactComponent=!0;var k=Array.isArray;function R(){}var H={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function q(O,X,j){var G=j.ref;return{$$typeof:t,type:O,key:X,ref:G!==void 0?G:null,props:j}}function Z(O,X){return q(O.type,X,O.props)}function U(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function L(O){var X={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(j){return X[j]})}var te=/\/+/g;function B(O,X){return typeof O=="object"&&O!==null&&O.key!=null?L(""+O.key):X.toString(36)}function J(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(R,R):(O.status="pending",O.then(function(X){O.status==="pending"&&(O.status="fulfilled",O.value=X)},function(X){O.status==="pending"&&(O.status="rejected",O.reason=X)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function T(O,X,j,G,$){var W=typeof O;(W==="undefined"||W==="boolean")&&(O=null);var ee=!1;if(O===null)ee=!0;else switch(W){case"bigint":case"string":case"number":ee=!0;break;case"object":switch(O.$$typeof){case t:case l:ee=!0;break;case y:return ee=O._init,T(ee(O._payload),X,j,G,$)}}if(ee)return $=$(O),ee=G===""?"."+B(O,0):G,k($)?(j="",ee!=null&&(j=ee.replace(te,"$&/")+"/"),T($,X,j,"",function(he){return he})):$!=null&&(U($)&&($=Z($,j+($.key==null||O&&O.key===$.key?"":(""+$.key).replace(te,"$&/")+"/")+ee)),X.push($)),1;ee=0;var ne=G===""?".":G+":";if(k(O))for(var ue=0;ue>>1,ie=T[I];if(0>>1;Is(j,K))Gs($,j)?(T[I]=$,T[G]=K,I=G):(T[I]=j,T[X]=K,I=X);else if(Gs($,K))T[I]=$,T[G]=K,I=G;else break e}}return Y}function s(T,Y){var K=T.sortIndex-Y.sortIndex;return K!==0?K:T.id-Y.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var c=Date,d=c.now();t.unstable_now=function(){return c.now()-d}}var h=[],m=[],y=1,g=null,v=3,x=!1,w=!1,N=!1,_=!1,E=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function z(T){for(var Y=r(m);Y!==null;){if(Y.callback===null)i(m);else if(Y.startTime<=T)i(m),Y.sortIndex=Y.expirationTime,l(h,Y);else break;Y=r(m)}}function k(T){if(N=!1,z(T),!w)if(r(h)!==null)w=!0,R||(R=!0,L());else{var Y=r(m);Y!==null&&J(k,Y.startTime-T)}}var R=!1,H=-1,D=5,q=-1;function Z(){return _?!0:!(t.unstable_now()-qT&&Z());){var I=g.callback;if(typeof I=="function"){g.callback=null,v=g.priorityLevel;var ie=I(g.expirationTime<=T);if(T=t.unstable_now(),typeof ie=="function"){g.callback=ie,z(T),Y=!0;break t}g===r(h)&&i(h),z(T)}else i(h);g=r(h)}if(g!==null)Y=!0;else{var O=r(m);O!==null&&J(k,O.startTime-T),Y=!1}}break e}finally{g=null,v=K,x=!1}Y=void 0}}finally{Y?L():R=!1}}}var L;if(typeof S=="function")L=function(){S(U)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,B=te.port2;te.port1.onmessage=U,L=function(){B.postMessage(null)}}else L=function(){E(U,0)};function J(T,Y){H=E(function(){T(t.unstable_now())},Y)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(T){T.callback=null},t.unstable_forceFrameRate=function(T){0>T||125I?(T.sortIndex=K,l(m,T),r(h)===null&&T===r(m)&&(N?(M(H),H=-1):N=!0,J(k,K-I))):(T.sortIndex=ie,l(h,T),w||x||(w=!0,R||(R=!0,L()))),T},t.unstable_shouldYield=Z,t.unstable_wrapCallback=function(T){var Y=v;return function(){var K=v;v=Y;try{return T.apply(this,arguments)}finally{v=K}}}})($f)),$f}var U0;function I_(){return U0||(U0=1,Xf.exports=K_()),Xf.exports}var Qf={exports:{}},Ct={};/** - * @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 G0;function J_(){if(G0)return Ct;G0=1;var t=Ki();function l(h){var m="https://react.dev/errors/"+h;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(l){console.error(l)}}return t(),Qf.exports=J_(),Qf.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 Y0;function F_(){if(Y0)return Si;Y0=1;var t=I_(),l=Ki(),r=dx();function i(e){var n="https://react.dev/errors/"+e;if(1ie||(e.current=I[ie],I[ie]=null,ie--)}function j(e,n){ie++,I[ie]=e.current,e.current=n}var G=O(null),$=O(null),W=O(null),ee=O(null);function ne(e,n){switch(j(W,n),j($,e),j(G,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?l0(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=l0(n),e=r0(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}X(G),j(G,e)}function ue(){X(G),X($),X(W)}function he(e){e.memoizedState!==null&&j(ee,e);var n=G.current,a=r0(n,e.type);n!==a&&(j($,e),j(G,a))}function ye(e){$.current===e&&(X(G),X($)),ee.current===e&&(X(ee),vi._currentValue=K)}var ge,de;function xe(e){if(ge===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);ge=n&&n[1]||"",de=-1)":-1f||Q[o]!==le[f]){var se=` -`+Q[o].replace(" at new "," at ");return e.displayName&&se.includes("")&&(se=se.replace("",e.displayName)),se}while(1<=o&&0<=f);break}}}finally{Ae=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?xe(a):""}function We(e,n){switch(e.tag){case 26:case 27:case 5:return xe(e.type);case 16:return xe("Lazy");case 13:return e.child!==n&&n!==null?xe("Suspense Fallback"):xe("Suspense");case 19:return xe("SuspenseList");case 0:case 15:return Se(e.type,!1);case 11:return Se(e.type.render,!1);case 1:return Se(e.type,!0);case 31:return xe("Activity");default:return""}}function $e(e){try{var n="",a=null;do n+=We(e,a),a=e,e=e.return;while(e);return n}catch(o){return` -Error generating stack: `+o.message+` -`+o.stack}}var Et=Object.prototype.hasOwnProperty,Ut=t.unstable_scheduleCallback,zt=t.unstable_cancelCallback,vn=t.unstable_shouldYield,An=t.unstable_requestPaint,vt=t.unstable_now,_l=t.unstable_getCurrentPriorityLevel,Tn=t.unstable_ImmediatePriority,ra=t.unstable_UserBlockingPriority,Ga=t.unstable_NormalPriority,Su=t.unstable_LowPriority,Sl=t.unstable_IdlePriority,Eu=t.log,Nu=t.unstable_setDisableYieldValue,Va=null,Mt=null;function xn(e){if(typeof Eu=="function"&&Nu(e),Mt&&typeof Mt.setStrictMode=="function")try{Mt.setStrictMode(Va,e)}catch{}}var At=Math.clz32?Math.clz32:Mu,Cu=Math.log,zu=Math.LN2;function Mu(e){return e>>>=0,e===0?32:31-(Cu(e)/zu|0)|0}var El=256,Nl=262144,Cl=4194304;function On(e){var n=e&42;if(n!==0)return n;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function zl(e,n,a){var o=e.pendingLanes;if(o===0)return 0;var f=0,p=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var A=o&134217727;return A!==0?(o=A&~p,o!==0?f=On(o):(b&=A,b!==0?f=On(b):a||(a=A&~e,a!==0&&(f=On(a))))):(A=o&~p,A!==0?f=On(A):b!==0?f=On(b):a||(a=o&~e,a!==0&&(f=On(a)))),f===0?0:n!==0&&n!==f&&(n&p)===0&&(p=f&-f,a=n&-n,p>=a||p===32&&(a&4194048)!==0)?n:f}function Ya(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function Au(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 ao(){var e=Cl;return Cl<<=1,(Cl&62914560)===0&&(Cl=4194304),e}function Ar(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function Xa(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Tu(e,n,a,o,f,p){var b=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var A=e.entanglements,Q=e.expirationTimes,le=e.hiddenUpdates;for(a=b&~a;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var ku=/[\n"\\]/g;function jt(e){return e.replace(ku,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Za(e,n,a,o,f,p,b,A){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),n!=null?b==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Ot(n)):e.value!==""+Ot(n)&&(e.value=""+Ot(n)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),n!=null?Dr(e,b,Ot(n)):a!=null?Dr(e,b,Ot(a)):o!=null&&e.removeAttribute("value"),f==null&&p!=null&&(e.defaultChecked=!!p),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?e.name=""+Ot(A):e.removeAttribute("name")}function yo(e,n,a,o,f,p,b,A){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),n!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||n!=null)){fa(e);return}a=a!=null?""+Ot(a):"",n=n!=null?""+Ot(n):a,A||n===e.value||(e.value=n),e.defaultValue=n}o=o??f,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=A?e.checked:!!o,e.defaultChecked=!!o,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),fa(e)}function Dr(e,n,a){n==="number"&&Qa(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Dn(e,n,a,o){if(e=e.options,n){n={};for(var f=0;f"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Uu=!1;if(Hn)try{var Hr={};Object.defineProperty(Hr,"passive",{get:function(){Uu=!0}}),window.addEventListener("test",Hr,Hr),window.removeEventListener("test",Hr,Hr)}catch{Uu=!1}var da=null,Gu=null,xo=null;function rg(){if(xo)return xo;var e,n=Gu,a=n.length,o,f="value"in da?da.value:da.textContent,p=f.length;for(e=0;e=qr),fg=" ",dg=!1;function hg(e,n){switch(e){case"keyup":return uw.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gg(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Dl=!1;function fw(e,n){switch(e){case"compositionend":return gg(n);case"keypress":return n.which!==32?null:(dg=!0,fg);case"textInput":return e=n.data,e===fg&&dg?null:e;default:return null}}function dw(e,n){if(Dl)return e==="compositionend"||!Qu&&hg(e,n)?(e=rg(),xo=Gu=da=null,Dl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:a,offset:n-e};e=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=_g(a)}}function Eg(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Eg(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Ng(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Qa(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=Qa(e.document)}return n}function Iu(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var bw=Hn&&"documentMode"in document&&11>=document.documentMode,kl=null,Ju=null,Yr=null,Fu=!1;function Cg(e,n,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Fu||kl==null||kl!==Qa(o)||(o=kl,"selectionStart"in o&&Iu(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),Yr&&Vr(Yr,o)||(Yr=o,o=ds(Ju,"onSelect"),0>=b,f-=b,wn=1<<32-At(n)+f|a<Ce?(Re=ve,ve=null):Re=ve.sibling;var Le=re(P,ve,ae[Ce],ce);if(Le===null){ve===null&&(ve=Re);break}e&&ve&&Le.alternate===null&&n(P,ve),F=p(Le,F,Ce),He===null?be=Le:He.sibling=Le,He=Le,ve=Re}if(Ce===ae.length)return a(P,ve),De&&Bn(P,Ce),be;if(ve===null){for(;CeCe?(Re=ve,ve=null):Re=ve.sibling;var Da=re(P,ve,Le.value,ce);if(Da===null){ve===null&&(ve=Re);break}e&&ve&&Da.alternate===null&&n(P,ve),F=p(Da,F,Ce),He===null?be=Da:He.sibling=Da,He=Da,ve=Re}if(Le.done)return a(P,ve),De&&Bn(P,Ce),be;if(ve===null){for(;!Le.done;Ce++,Le=ae.next())Le=fe(P,Le.value,ce),Le!==null&&(F=p(Le,F,Ce),He===null?be=Le:He.sibling=Le,He=Le);return De&&Bn(P,Ce),be}for(ve=o(ve);!Le.done;Ce++,Le=ae.next())Le=oe(ve,P,Ce,Le.value,ce),Le!==null&&(e&&Le.alternate!==null&&ve.delete(Le.key===null?Ce:Le.key),F=p(Le,F,Ce),He===null?be=Le:He.sibling=Le,He=Le);return e&&ve.forEach(function(U_){return n(P,U_)}),De&&Bn(P,Ce),be}function Ye(P,F,ae,ce){if(typeof ae=="object"&&ae!==null&&ae.type===N&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case x:e:{for(var be=ae.key;F!==null;){if(F.key===be){if(be=ae.type,be===N){if(F.tag===7){a(P,F.sibling),ce=f(F,ae.props.children),ce.return=P,P=ce;break e}}else if(F.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===D&&al(be)===F.type){a(P,F.sibling),ce=f(F,ae.props),Ir(ce,ae),ce.return=P,P=ce;break e}a(P,F);break}else n(P,F);F=F.sibling}ae.type===N?(ce=Wa(ae.props.children,P.mode,ce,ae.key),ce.return=P,P=ce):(ce=Ao(ae.type,ae.key,ae.props,null,P.mode,ce),Ir(ce,ae),ce.return=P,P=ce)}return b(P);case w:e:{for(be=ae.key;F!==null;){if(F.key===be)if(F.tag===4&&F.stateNode.containerInfo===ae.containerInfo&&F.stateNode.implementation===ae.implementation){a(P,F.sibling),ce=f(F,ae.children||[]),ce.return=P,P=ce;break e}else{a(P,F);break}else n(P,F);F=F.sibling}ce=lc(ae,P.mode,ce),ce.return=P,P=ce}return b(P);case D:return ae=al(ae),Ye(P,F,ae,ce)}if(J(ae))return pe(P,F,ae,ce);if(L(ae)){if(be=L(ae),typeof be!="function")throw Error(i(150));return ae=be.call(ae),we(P,F,ae,ce)}if(typeof ae.then=="function")return Ye(P,F,Ho(ae),ce);if(ae.$$typeof===S)return Ye(P,F,jo(P,ae),ce);Lo(P,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint"?(ae=""+ae,F!==null&&F.tag===6?(a(P,F.sibling),ce=f(F,ae),ce.return=P,P=ce):(a(P,F),ce=ac(ae,P.mode,ce),ce.return=P,P=ce),b(P)):a(P,F)}return function(P,F,ae,ce){try{Kr=0;var be=Ye(P,F,ae,ce);return Ql=null,be}catch(ve){if(ve===$l||ve===Do)throw ve;var He=Vt(29,ve,null,P.mode);return He.lanes=ce,He.return=P,He}finally{}}}var rl=Ig(!0),Jg=Ig(!1),ya=!1;function mc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yc(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function va(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function xa(e,n,a){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(Be&2)!==0){var f=o.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),o.pending=n,n=Mo(e),Rg(e,null,a),n}return zo(e,o,n,a),Mo(e)}function Jr(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,ro(e,a)}}function vc(e,n){var a=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,a===o)){var f=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var b={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?f=p=b:p=p.next=b,a=a.next}while(a!==null);p===null?f=p=n:p=p.next=n}else f=p=n;a={baseState:o.baseState,firstBaseUpdate:f,lastBaseUpdate:p,shared:o.shared,callbacks:o.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var xc=!1;function Fr(){if(xc){var e=Xl;if(e!==null)throw e}}function Wr(e,n,a,o){xc=!1;var f=e.updateQueue;ya=!1;var p=f.firstBaseUpdate,b=f.lastBaseUpdate,A=f.shared.pending;if(A!==null){f.shared.pending=null;var Q=A,le=Q.next;Q.next=null,b===null?p=le:b.next=le,b=Q;var se=e.alternate;se!==null&&(se=se.updateQueue,A=se.lastBaseUpdate,A!==b&&(A===null?se.firstBaseUpdate=le:A.next=le,se.lastBaseUpdate=Q))}if(p!==null){var fe=f.baseState;b=0,se=le=Q=null,A=p;do{var re=A.lane&-536870913,oe=re!==A.lane;if(oe?(je&re)===re:(o&re)===re){re!==0&&re===Yl&&(xc=!0),se!==null&&(se=se.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var pe=e,we=A;re=n;var Ye=a;switch(we.tag){case 1:if(pe=we.payload,typeof pe=="function"){fe=pe.call(Ye,fe,re);break e}fe=pe;break e;case 3:pe.flags=pe.flags&-65537|128;case 0:if(pe=we.payload,re=typeof pe=="function"?pe.call(Ye,fe,re):pe,re==null)break e;fe=g({},fe,re);break e;case 2:ya=!0}}re=A.callback,re!==null&&(e.flags|=64,oe&&(e.flags|=8192),oe=f.callbacks,oe===null?f.callbacks=[re]:oe.push(re))}else oe={lane:re,tag:A.tag,payload:A.payload,callback:A.callback,next:null},se===null?(le=se=oe,Q=fe):se=se.next=oe,b|=re;if(A=A.next,A===null){if(A=f.shared.pending,A===null)break;oe=A,A=oe.next,oe.next=null,f.lastBaseUpdate=oe,f.shared.pending=null}}while(!0);se===null&&(Q=fe),f.baseState=Q,f.firstBaseUpdate=le,f.lastBaseUpdate=se,p===null&&(f.shared.lanes=0),Ea|=b,e.lanes=b,e.memoizedState=fe}}function Fg(e,n){if(typeof e!="function")throw Error(i(191,e));e.call(n)}function Wg(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;ep?p:8;var b=T.T,A={};T.T=A,Bc(e,!1,n,a);try{var Q=f(),le=T.S;if(le!==null&&le(A,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var se=Aw(Q,o);ti(e,n,se,Zt(e))}else ti(e,n,o,Zt(e))}catch(fe){ti(e,n,{then:function(){},status:"rejected",reason:fe},Zt())}finally{Y.p=p,b!==null&&A.types!==null&&(b.types=A.types),T.T=b}}function kw(){}function Hc(e,n,a,o){if(e.tag!==5)throw Error(i(476));var f=Tp(e).queue;Ap(e,f,n,K,a===null?kw:function(){return Op(e),a(o)})}function Tp(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vn,lastRenderedState:K},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vn,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Op(e){var n=Tp(e);n.next===null&&(n=e.alternate.memoizedState),ti(e,n.next.queue,{},Zt())}function Lc(){return bt(vi)}function jp(){return lt().memoizedState}function Rp(){return lt().memoizedState}function Hw(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=Zt();e=va(a);var o=xa(n,e,a);o!==null&&(Bt(o,n,a),Jr(o,n,a)),n={cache:dc()},e.payload=n;return}n=n.return}}function Lw(e,n,a){var o=Zt();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Zo(e)?kp(n,a):(a=tc(e,n,a,o),a!==null&&(Bt(a,e,o),Hp(a,n,o)))}function Dp(e,n,a){var o=Zt();ti(e,n,a,o)}function ti(e,n,a,o){var f={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Zo(e))kp(n,f);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var b=n.lastRenderedState,A=p(b,a);if(f.hasEagerState=!0,f.eagerState=A,Gt(A,b))return zo(e,n,f,0),Xe===null&&Co(),!1}catch{}finally{}if(a=tc(e,n,f,o),a!==null)return Bt(a,e,o),Hp(a,n,o),!0}return!1}function Bc(e,n,a,o){if(o={lane:2,revertLane:yf(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Zo(e)){if(n)throw Error(i(479))}else n=tc(e,a,o,2),n!==null&&Bt(n,e,2)}function Zo(e){var n=e.alternate;return e===Ne||n!==null&&n===Ne}function kp(e,n){Kl=Uo=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function Hp(e,n,a){if((a&4194048)!==0){var o=n.lanes;o&=e.pendingLanes,a|=o,n.lanes=a,ro(e,a)}}var ni={readContext:bt,use:Yo,useCallback:Pe,useContext:Pe,useEffect:Pe,useImperativeHandle:Pe,useLayoutEffect:Pe,useInsertionEffect:Pe,useMemo:Pe,useReducer:Pe,useRef:Pe,useState:Pe,useDebugValue:Pe,useDeferredValue:Pe,useTransition:Pe,useSyncExternalStore:Pe,useId:Pe,useHostTransitionStatus:Pe,useFormState:Pe,useActionState:Pe,useOptimistic:Pe,useMemoCache:Pe,useCacheRefresh:Pe};ni.useEffectEvent=Pe;var Lp={readContext:bt,use:Yo,useCallback:function(e,n){return Tt().memoizedState=[e,n===void 0?null:n],e},useContext:bt,useEffect:bp,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,$o(4194308,4,Ep.bind(null,n,e),a)},useLayoutEffect:function(e,n){return $o(4194308,4,e,n)},useInsertionEffect:function(e,n){$o(4,2,e,n)},useMemo:function(e,n){var a=Tt();n=n===void 0?null:n;var o=e();if(il){xn(!0);try{e()}finally{xn(!1)}}return a.memoizedState=[o,n],o},useReducer:function(e,n,a){var o=Tt();if(a!==void 0){var f=a(n);if(il){xn(!0);try{a(n)}finally{xn(!1)}}}else f=n;return o.memoizedState=o.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},o.queue=e,e=e.dispatch=Lw.bind(null,Ne,e),[o.memoizedState,e]},useRef:function(e){var n=Tt();return e={current:e},n.memoizedState=e},useState:function(e){e=Oc(e);var n=e.queue,a=Dp.bind(null,Ne,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:Dc,useDeferredValue:function(e,n){var a=Tt();return kc(a,e,n)},useTransition:function(){var e=Oc(!1);return e=Ap.bind(null,Ne,e.queue,!0,!1),Tt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var o=Ne,f=Tt();if(De){if(a===void 0)throw Error(i(407));a=a()}else{if(a=n(),Xe===null)throw Error(i(349));(je&127)!==0||lp(o,n,a)}f.memoizedState=a;var p={value:a,getSnapshot:n};return f.queue=p,bp(ip.bind(null,o,p,e),[e]),o.flags|=2048,Jl(9,{destroy:void 0},rp.bind(null,o,p,a,n),null),a},useId:function(){var e=Tt(),n=Xe.identifierPrefix;if(De){var a=_n,o=wn;a=(o&~(1<<32-At(o)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Go++,0<\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof o.is=="string"?b.createElement("select",{is:o.is}):b.createElement("select"),o.multiple?p.multiple=!0:o.size&&(p.size=o.size);break;default:p=typeof o.is=="string"?b.createElement(f,{is:o.is}):b.createElement(f)}}p[pt]=n,p[Nt]=o;e:for(b=n.child;b!==null;){if(b.tag===5||b.tag===6)p.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===n)break e;for(;b.sibling===null;){if(b.return===null||b.return===n)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}n.stateNode=p;e:switch(_t(p,f,o),f){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Xn(n)}}return Ze(n),Wc(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==o&&Xn(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(i(166));if(e=W.current,Gl(n)){if(e=n.stateNode,a=n.memoizedProps,o=null,f=xt,f!==null)switch(f.tag){case 27:case 5:o=f.memoizedProps}e[pt]=n,e=!!(e.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||n0(e.nodeValue,a)),e||pa(n,!0)}else e=hs(e).createTextNode(o),e[pt]=n,n.stateNode=e}return Ze(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(o=Gl(n),a!==null){if(e===null){if(!o)throw Error(i(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(557));e[pt]=n}else Pa(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ze(n),e=!1}else a=sc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(Xt(n),n):(Xt(n),null);if((n.flags&128)!==0)throw Error(i(558))}return Ze(n),null;case 13:if(o=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=Gl(n),o!==null&&o.dehydrated!==null){if(e===null){if(!f)throw Error(i(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(i(317));f[pt]=n}else Pa(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ze(n),f=!1}else f=sc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(Xt(n),n):(Xt(n),null)}return Xt(n),(n.flags&128)!==0?(n.lanes=a,n):(a=o!==null,e=e!==null&&e.memoizedState!==null,a&&(o=n.child,f=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(f=o.alternate.memoizedState.cachePool.pool),p=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),p!==f&&(o.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),Wo(n,n.updateQueue),Ze(n),null);case 4:return ue(),e===null&&wf(n.stateNode.containerInfo),Ze(n),null;case 10:return Un(n.type),Ze(n),null;case 19:if(X(at),o=n.memoizedState,o===null)return Ze(n),null;if(f=(n.flags&128)!==0,p=o.rendering,p===null)if(f)li(o,!1);else{if(et!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(p=qo(e),p!==null){for(n.flags|=128,li(o,!1),e=p.updateQueue,n.updateQueue=e,Wo(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Dg(a,e),a=a.sibling;return j(at,at.current&1|2),De&&Bn(n,o.treeForkCount),n.child}e=e.sibling}o.tail!==null&&vt()>as&&(n.flags|=128,f=!0,li(o,!1),n.lanes=4194304)}else{if(!f)if(e=qo(p),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,Wo(n,e),li(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!De)return Ze(n),null}else 2*vt()-o.renderingStartTime>as&&a!==536870912&&(n.flags|=128,f=!0,li(o,!1),n.lanes=4194304);o.isBackwards?(p.sibling=n.child,n.child=p):(e=o.last,e!==null?e.sibling=p:n.child=p,o.last=p)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=vt(),e.sibling=null,a=at.current,j(at,f?a&1|2:a&1),De&&Bn(n,o.treeForkCount),e):(Ze(n),null);case 22:case 23:return Xt(n),wc(),o=n.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(a&536870912)!==0&&(n.flags&128)===0&&(Ze(n),n.subtreeFlags&6&&(n.flags|=8192)):Ze(n),a=n.updateQueue,a!==null&&Wo(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==a&&(n.flags|=2048),e!==null&&X(nl),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),Un(ot),Ze(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function Vw(e,n){switch(ic(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Un(ot),ue(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return ye(n),null;case 31:if(n.memoizedState!==null){if(Xt(n),n.alternate===null)throw Error(i(340));Pa()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Xt(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(i(340));Pa()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return X(at),null;case 4:return ue(),null;case 10:return Un(n.type),null;case 22:case 23:return Xt(n),wc(),e!==null&&X(nl),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Un(ot),null;case 25:return null;default:return null}}function om(e,n){switch(ic(n),n.tag){case 3:Un(ot),ue();break;case 26:case 27:case 5:ye(n);break;case 4:ue();break;case 31:n.memoizedState!==null&&Xt(n);break;case 13:Xt(n);break;case 19:X(at);break;case 10:Un(n.type);break;case 22:case 23:Xt(n),wc(),e!==null&&X(nl);break;case 24:Un(ot)}}function ri(e,n){try{var a=n.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var f=o.next;a=f;do{if((a.tag&e)===e){o=void 0;var p=a.create,b=a.inst;o=p(),b.destroy=o}a=a.next}while(a!==f)}}catch(A){Ue(n,n.return,A)}}function _a(e,n,a){try{var o=n.updateQueue,f=o!==null?o.lastEffect:null;if(f!==null){var p=f.next;o=p;do{if((o.tag&e)===e){var b=o.inst,A=b.destroy;if(A!==void 0){b.destroy=void 0,f=n;var Q=a,le=A;try{le()}catch(se){Ue(f,Q,se)}}}o=o.next}while(o!==p)}}catch(se){Ue(n,n.return,se)}}function sm(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{Wg(n,a)}catch(o){Ue(e,e.return,o)}}}function um(e,n,a){a.props=ol(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(o){Ue(e,n,o)}}function ii(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof a=="function"?e.refCleanup=a(o):a.current=o}}catch(f){Ue(e,n,f)}}function Sn(e,n){var a=e.ref,o=e.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(f){Ue(e,n,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){Ue(e,n,f)}else a.current=null}function cm(e){var n=e.type,a=e.memoizedProps,o=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(f){Ue(e,e.return,f)}}function Pc(e,n,a){try{var o=e.stateNode;c_(o,e.type,a,n),o[Nt]=n}catch(f){Ue(e,e.return,f)}}function fm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Aa(e.type)||e.tag===4}function ef(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||fm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Aa(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function tf(e,n,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=kn));else if(o!==4&&(o===27&&Aa(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(tf(e,n,a),e=e.sibling;e!==null;)tf(e,n,a),e=e.sibling}function Po(e,n,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(o!==4&&(o===27&&Aa(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Po(e,n,a),e=e.sibling;e!==null;)Po(e,n,a),e=e.sibling}function dm(e){var n=e.stateNode,a=e.memoizedProps;try{for(var o=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);_t(n,o,a),n[pt]=e,n[Nt]=a}catch(p){Ue(e,e.return,p)}}var $n=!1,ct=!1,nf=!1,hm=typeof WeakSet=="function"?WeakSet:Set,yt=null;function Yw(e,n){if(e=e.containerInfo,Ef=bs,e=Ng(e),Iu(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var o=a.getSelection&&a.getSelection();if(o&&o.rangeCount!==0){a=o.anchorNode;var f=o.anchorOffset,p=o.focusNode;o=o.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var b=0,A=-1,Q=-1,le=0,se=0,fe=e,re=null;t:for(;;){for(var oe;fe!==a||f!==0&&fe.nodeType!==3||(A=b+f),fe!==p||o!==0&&fe.nodeType!==3||(Q=b+o),fe.nodeType===3&&(b+=fe.nodeValue.length),(oe=fe.firstChild)!==null;)re=fe,fe=oe;for(;;){if(fe===e)break t;if(re===a&&++le===f&&(A=b),re===p&&++se===o&&(Q=b),(oe=fe.nextSibling)!==null)break;fe=re,re=fe.parentNode}fe=oe}a=A===-1||Q===-1?null:{start:A,end:Q}}else a=null}a=a||{start:0,end:0}}else a=null;for(Nf={focusedElem:e,selectionRange:a},bs=!1,yt=n;yt!==null;)if(n=yt,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,yt=e;else for(;yt!==null;){switch(n=yt,p=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a title"))),_t(p,o,a),p[pt]=e,it(p),o=p;break e;case"link":var b=x0("link","href",f).get(o+(a.href||""));if(b){for(var A=0;AYe&&(b=Ye,Ye=we,we=b);var P=Sg(A,we),F=Sg(A,Ye);if(P&&F&&(oe.rangeCount!==1||oe.anchorNode!==P.node||oe.anchorOffset!==P.offset||oe.focusNode!==F.node||oe.focusOffset!==F.offset)){var ae=fe.createRange();ae.setStart(P.node,P.offset),oe.removeAllRanges(),we>Ye?(oe.addRange(ae),oe.extend(F.node,F.offset)):(ae.setEnd(F.node,F.offset),oe.addRange(ae))}}}}for(fe=[],oe=A;oe=oe.parentNode;)oe.nodeType===1&&fe.push({element:oe,left:oe.scrollLeft,top:oe.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;Aa?32:a,T.T=null,a=cf,cf=null;var p=Ca,b=Jn;if(mt=0,tr=Ca=null,Jn=0,(Be&6)!==0)throw Error(i(331));var A=Be;if(Be|=4,Em(p.current),wm(p,p.current,b,a),Be=A,di(0,!1),Mt&&typeof Mt.onPostCommitFiberRoot=="function")try{Mt.onPostCommitFiberRoot(Va,p)}catch{}return!0}finally{Y.p=f,T.T=o,Vm(e,n)}}function Xm(e,n,a){n=Pt(a,n),n=Vc(e.stateNode,n,2),e=xa(e,n,2),e!==null&&(Xa(e,2),En(e))}function Ue(e,n,a){if(e.tag===3)Xm(e,e,a);else for(;n!==null;){if(n.tag===3){Xm(n,e,a);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Na===null||!Na.has(o))){e=Pt(a,e),a=$p(2),o=xa(n,a,2),o!==null&&(Qp(a,o,n,e),Xa(o,2),En(o));break}}n=n.return}}function gf(e,n,a){var o=e.pingCache;if(o===null){o=e.pingCache=new Qw;var f=new Set;o.set(n,f)}else f=o.get(n),f===void 0&&(f=new Set,o.set(n,f));f.has(a)||(rf=!0,f.add(a),e=Fw.bind(null,e,n,a),n.then(e,e))}function Fw(e,n,a){var o=e.pingCache;o!==null&&o.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Xe===e&&(je&a)===a&&(et===4||et===3&&(je&62914560)===je&&300>vt()-ns?(Be&2)===0&&nr(e,0):of|=a,er===je&&(er=0)),En(e)}function $m(e,n){n===0&&(n=ao()),e=Fa(e,n),e!==null&&(Xa(e,n),En(e))}function Ww(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),$m(e,a)}function Pw(e,n){var a=0;switch(e.tag){case 31:case 13:var o=e.stateNode,f=e.memoizedState;f!==null&&(a=f.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(i(314))}o!==null&&o.delete(n),$m(e,a)}function e_(e,n){return Ut(e,n)}var us=null,lr=null,pf=!1,cs=!1,mf=!1,Ma=0;function En(e){e!==lr&&e.next===null&&(lr===null?us=lr=e:lr=lr.next=e),cs=!0,pf||(pf=!0,n_())}function di(e,n){if(!mf&&cs){mf=!0;do for(var a=!1,o=us;o!==null;){if(e!==0){var f=o.pendingLanes;if(f===0)var p=0;else{var b=o.suspendedLanes,A=o.pingedLanes;p=(1<<31-At(42|e)+1)-1,p&=f&~(b&~A),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,Im(o,p))}else p=je,p=zl(o,o===Xe?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||Ya(o,p)||(a=!0,Im(o,p));o=o.next}while(a);mf=!1}}function t_(){Qm()}function Qm(){cs=pf=!1;var e=0;Ma!==0&&d_()&&(e=Ma);for(var n=vt(),a=null,o=us;o!==null;){var f=o.next,p=Zm(o,n);p===0?(o.next=null,a===null?us=f:a.next=f,f===null&&(lr=a)):(a=o,(e!==0||(p&3)!==0)&&(cs=!0)),o=f}mt!==0&&mt!==5||di(e),Ma!==0&&(Ma=0)}function Zm(e,n){for(var a=e.suspendedLanes,o=e.pingedLanes,f=e.expirationTimes,p=e.pendingLanes&-62914561;0A)break;var se=Q.transferSize,fe=Q.initiatorType;se&&a0(fe)&&(Q=Q.responseEnd,b+=se*(Q"u"?null:document;function p0(e,n,a){var o=rr;if(o&&typeof n=="string"&&n){var f=jt(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),g0.has(f)||(g0.add(f),e={rel:e,crossOrigin:a,href:n},o.querySelector(f)===null&&(n=o.createElement("link"),_t(n,"link",e),it(n),o.head.appendChild(n)))}}function w_(e){Fn.D(e),p0("dns-prefetch",e,null)}function __(e,n){Fn.C(e,n),p0("preconnect",e,n)}function S_(e,n,a){Fn.L(e,n,a);var o=rr;if(o&&e&&n){var f='link[rel="preload"][as="'+jt(n)+'"]';n==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+jt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+jt(a.imageSizes)+'"]')):f+='[href="'+jt(e)+'"]';var p=f;switch(n){case"style":p=ir(e);break;case"script":p=or(e)}rn.has(p)||(e=g({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),rn.set(p,e),o.querySelector(f)!==null||n==="style"&&o.querySelector(mi(p))||n==="script"&&o.querySelector(yi(p))||(n=o.createElement("link"),_t(n,"link",e),it(n),o.head.appendChild(n)))}}function E_(e,n){Fn.m(e,n);var a=rr;if(a&&e){var o=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+jt(o)+'"][href="'+jt(e)+'"]',p=f;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=or(e)}if(!rn.has(p)&&(e=g({rel:"modulepreload",href:e},n),rn.set(p,e),a.querySelector(f)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(yi(p)))return}o=a.createElement("link"),_t(o,"link",e),it(o),a.head.appendChild(o)}}}function N_(e,n,a){Fn.S(e,n,a);var o=rr;if(o&&e){var f=ua(o).hoistableStyles,p=ir(e);n=n||"default";var b=f.get(p);if(!b){var A={loading:0,preload:null};if(b=o.querySelector(mi(p)))A.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":n},a),(a=rn.get(p))&&jf(e,a);var Q=b=o.createElement("link");it(Q),_t(Q,"link",e),Q._p=new Promise(function(le,se){Q.onload=le,Q.onerror=se}),Q.addEventListener("load",function(){A.loading|=1}),Q.addEventListener("error",function(){A.loading|=2}),A.loading|=4,ps(b,n,o)}b={type:"stylesheet",instance:b,count:1,state:A},f.set(p,b)}}}function C_(e,n){Fn.X(e,n);var a=rr;if(a&&e){var o=ua(a).hoistableScripts,f=or(e),p=o.get(f);p||(p=a.querySelector(yi(f)),p||(e=g({src:e,async:!0},n),(n=rn.get(f))&&Rf(e,n),p=a.createElement("script"),it(p),_t(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(f,p))}}function z_(e,n){Fn.M(e,n);var a=rr;if(a&&e){var o=ua(a).hoistableScripts,f=or(e),p=o.get(f);p||(p=a.querySelector(yi(f)),p||(e=g({src:e,async:!0,type:"module"},n),(n=rn.get(f))&&Rf(e,n),p=a.createElement("script"),it(p),_t(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(f,p))}}function m0(e,n,a,o){var f=(f=W.current)?gs(f):null;if(!f)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=ir(a.href),a=ua(f).hoistableStyles,o=a.get(n),o||(o={type:"style",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=ir(a.href);var p=ua(f).hoistableStyles,b=p.get(e);if(b||(f=f.ownerDocument||f,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,b),(p=f.querySelector(mi(e)))&&!p._p&&(b.instance=p,b.state.loading=5),rn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},rn.set(e,a),p||M_(f,e,a,b.state))),n&&o===null)throw Error(i(528,""));return b}if(n&&o!==null)throw Error(i(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=or(a),a=ua(f).hoistableScripts,o=a.get(n),o||(o={type:"script",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function ir(e){return'href="'+jt(e)+'"'}function mi(e){return'link[rel="stylesheet"]['+e+"]"}function y0(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function M_(e,n,a,o){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=e.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),_t(n,"link",a),it(n),e.head.appendChild(n))}function or(e){return'[src="'+jt(e)+'"]'}function yi(e){return"script[async]"+e}function v0(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var o=e.querySelector('style[data-href~="'+jt(a.href)+'"]');if(o)return n.instance=o,it(o),o;var f=g({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),it(o),_t(o,"style",f),ps(o,a.precedence,e),n.instance=o;case"stylesheet":f=ir(a.href);var p=e.querySelector(mi(f));if(p)return n.state.loading|=4,n.instance=p,it(p),p;o=y0(a),(f=rn.get(f))&&jf(o,f),p=(e.ownerDocument||e).createElement("link"),it(p);var b=p;return b._p=new Promise(function(A,Q){b.onload=A,b.onerror=Q}),_t(p,"link",o),n.state.loading|=4,ps(p,a.precedence,e),n.instance=p;case"script":return p=or(a.src),(f=e.querySelector(yi(p)))?(n.instance=f,it(f),f):(o=a,(f=rn.get(p))&&(o=g({},a),Rf(o,f)),e=e.ownerDocument||e,f=e.createElement("script"),it(f),_t(f,"link",o),e.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,ps(o,a.precedence,e));return n.instance}function ps(e,n,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=o.length?o[o.length-1]:null,p=f,b=0;b title"):null)}function A_(e,n,a){if(a===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function w0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function T_(e,n,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var f=ir(o.href),p=n.querySelector(mi(f));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=ys.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=p,it(p);return}p=n.ownerDocument||n,o=y0(o),(f=rn.get(f))&&jf(o,f),p=p.createElement("link"),it(p);var b=p;b._p=new Promise(function(A,Q){b.onload=A,b.onerror=Q}),_t(p,"link",o),a.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=ys.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var Df=0;function O_(e,n){return e.stylesheets&&e.count===0&&xs(e,e.stylesheets),0Df?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(f)}}:null}function ys(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)xs(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var vs=null;function xs(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,vs=new Map,n.forEach(j_,e),vs=null,ys.call(e))}function j_(e,n){if(!(n.state.loading&4)){var a=vs.get(e);if(a)var o=a.get(null);else{a=new Map,vs.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(l){console.error(l)}}return t(),Yf.exports=F_(),Yf.exports}var P_=W_();/** - * @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 eS=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),hx=(...t)=>t.filter((l,r,i)=>!!l&&l.trim()!==""&&i.indexOf(l)===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 tS={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 nS=V.forwardRef(({color:t="currentColor",size:l=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:s="",children:u,iconNode:c,...d},h)=>V.createElement("svg",{ref:h,...tS,width:l,height:l,stroke:t,strokeWidth:i?Number(r)*24/Number(l):r,className:hx("lucide",s),...d},[...c.map(([m,y])=>V.createElement(m,y)),...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 nt=(t,l)=>{const r=V.forwardRef(({className:i,...s},u)=>V.createElement(nS,{ref:u,iconNode:l,className:hx(`lucide-${eS(t)}`,i),...s}));return r.displayName=`${t}`,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 gx=nt("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 aS=nt("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 px=nt("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 Mh=nt("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 mx=nt("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 lS=nt("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 rS=nt("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);/** - * @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 iS=nt("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 yx=nt("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 oS=nt("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 sS=nt("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 uS=nt("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 oh=nt("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 cS=nt("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 fS=nt("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 dS=nt("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 hS=nt("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 $0=nt("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 gS=nt("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 pS=nt("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 mS=nt("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 vx=nt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Q0=t=>{let l;const r=new Set,i=(m,y)=>{const g=typeof m=="function"?m(l):m;if(!Object.is(g,l)){const v=l;l=y??(typeof g!="object"||g===null)?g:Object.assign({},l,g),r.forEach(x=>x(l,v))}},s=()=>l,d={setState:i,getState:s,getInitialState:()=>h,subscribe:m=>(r.add(m),()=>r.delete(m))},h=l=t(i,s,d);return d},yS=(t=>t?Q0(t):Q0),vS=t=>t;function xS(t,l=vS){const r=dr.useSyncExternalStore(t.subscribe,dr.useCallback(()=>l(t.getState()),[t,l]),dr.useCallback(()=>l(t.getInitialState()),[t,l]));return dr.useDebugValue(r),r}const Z0=t=>{const l=yS(t),r=i=>xS(l,i);return Object.assign(r,l),r},bS=(t=>t?Z0(t):Z0);function rt(t,l,r="agent"){return t[l]||(t[l]={name:l,status:"pending",type:r,activity:[]}),t[l].activity||(t[l].activity=[]),t[l]}function zs(t,l,r){rt(t,l).activity.push(r)}const _e=bS(t=>({workflowName:"",workflowStatus:"pending",workflowStartTime:null,workflowFailure:null,agents:[],routes:[],parallelGroups:[],forEachGroups:[],nodes:{},groupProgress:{},highlightedEdges:[],agentsCompleted:0,agentsTotal:0,totalCost:0,totalTokens:0,selectedNode:null,wsStatus:"connecting",eventLog:[],activityLog:[],workflowOutput:null,processEvent:l=>{const r=K0[l.type];r&&t(i=>{const s={...i,nodes:{...i.nodes},groupProgress:{...i.groupProgress},eventLog:[...i.eventLog],activityLog:[...i.activityLog]};r(s,l.data);const u=I0(l);u&&s.eventLog.push(u);const c=J0(l);return c&&s.activityLog.push(c),s})},replayState:l=>{t(r=>{const i={...r,agentsCompleted:0,totalCost:0,totalTokens:0,nodes:{},groupProgress:{},highlightedEdges:[],eventLog:[],activityLog:[],workflowOutput:null};for(const s of l){const u=K0[s.type];u&&u(i,s.data);const c=I0(s);c&&i.eventLog.push(c);const d=J0(s);d&&i.activityLog.push(d)}return i})},selectNode:l=>{t({selectedNode:l})},setWsStatus:l=>{t({wsStatus:l})},setEdgeHighlight:(l,r,i)=>{t(s=>({highlightedEdges:[...s.highlightedEdges.filter(u=>!(u.from===l&&u.to===r)),{from:l,to:r,state:i}]}))},clearEdgeHighlight:(l,r)=>{t(i=>({highlightedEdges:i.highlightedEdges.filter(s=>!(s.from===l&&s.to===r))}))}})),K0={workflow_started:(t,l)=>{const r=l;t.workflowStatus="running",t.workflowStartTime=Date.now()/1e3,t.workflowName=r.name||"",t.agents=r.agents||[],t.routes=r.routes||[],t.parallelGroups=r.parallel_groups||[],t.forEachGroups=r.for_each_groups||[];const i=new Set,s=new Set;for(const u of t.parallelGroups){for(const c of u.agents)i.add(c);s.add(u.name),rt(t.nodes,u.name,"parallel_group"),t.groupProgress[u.name]={total:u.agents.length,completed:0,failed:0};for(const c of u.agents)rt(t.nodes,c,"agent")}for(const u of t.forEachGroups)s.add(u.name),rt(t.nodes,u.name,"for_each_group"),t.groupProgress[u.name]={total:0,completed:0,failed:0};for(const u of t.agents)if(!s.has(u.name)&&!i.has(u.name)){const c=u.type||"agent";rt(t.nodes,u.name,c),u.model&&(t.nodes[u.name].model=u.model),s.add(u.name)}t.agentsTotal=s.size},agent_started:(t,l)=>{const r=l,i=rt(t.nodes,r.agent_name);i.status="running",i.iteration=r.iteration,i.activity=[]},agent_completed:(t,l)=>{const r=l,i=rt(t.nodes,r.agent_name);i.status="completed",t.agentsCompleted++,i.elapsed=r.elapsed,i.model=r.model,i.tokens=r.tokens,i.input_tokens=r.input_tokens,i.output_tokens=r.output_tokens,i.cost_usd=r.cost_usd,i.output=r.output,i.output_keys=r.output_keys,r.cost_usd&&(t.totalCost+=r.cost_usd),r.tokens&&(t.totalTokens+=r.tokens)},agent_failed:(t,l)=>{const r=l,i=rt(t.nodes,r.agent_name);i.status="failed",i.elapsed=r.elapsed,i.error_type=r.error_type,i.error_message=r.message},agent_prompt_rendered:(t,l)=>{const r=l,i=rt(t.nodes,r.agent_name);i.prompt=r.rendered_prompt,i.context_keys=r.context_keys},agent_reasoning:(t,l)=>{const r=l;zs(t.nodes,r.agent_name,{type:"reasoning",icon:"💭",label:"thinking",text:r.content})},agent_tool_start:(t,l)=>{const r=l;zs(t.nodes,r.agent_name,{type:"tool-start",icon:"🔧",label:"tool",text:r.tool_name,detail:r.arguments||null})},agent_tool_complete:(t,l)=>{const r=l;zs(t.nodes,r.agent_name,{type:"tool-complete",icon:"✓",label:"result",text:r.tool_name||"done",detail:r.result||null})},agent_turn_start:(t,l)=>{const r=l;zs(t.nodes,r.agent_name,{type:"turn",icon:"⏳",label:"turn",text:`Turn ${r.turn??"?"}`})},agent_message:(t,l)=>{const r=l,i=rt(t.nodes,r.agent_name);i.latest_message=r.content},script_started:(t,l)=>{const r=l,i=rt(t.nodes,r.agent_name);i.status="running"},script_completed:(t,l)=>{const r=l,i=rt(t.nodes,r.agent_name);i.status="completed",t.agentsCompleted++,i.elapsed=r.elapsed,i.stdout=r.stdout,i.stderr=r.stderr,i.exit_code=r.exit_code},script_failed:(t,l)=>{const r=l,i=rt(t.nodes,r.agent_name);i.status="failed",i.elapsed=r.elapsed,i.error_type=r.error_type,i.error_message=r.message},gate_presented:(t,l)=>{const r=l,i=rt(t.nodes,r.agent_name);i.status="waiting",i.options=r.options,i.prompt=r.prompt},gate_resolved:(t,l)=>{const r=l,i=rt(t.nodes,r.agent_name);i.status="completed",t.agentsCompleted++,i.selected_option=r.selected_option,i.route=r.route,i.additional_input=r.additional_input},route_taken:(t,l)=>{const r=l;t.highlightedEdges=[...t.highlightedEdges.filter(i=>!(i.from===r.from_agent&&i.to===r.to_agent)),{from:r.from_agent,to:r.to_agent,state:"taken"}]},parallel_started:(t,l)=>{const r=l,i=rt(t.nodes,r.group_name,"parallel_group");i.status="running",t.groupProgress[r.group_name]&&(t.groupProgress[r.group_name].total=r.agents.length,t.groupProgress[r.group_name].completed=0,t.groupProgress[r.group_name].failed=0)},parallel_agent_completed:(t,l)=>{const r=l;t.groupProgress[r.group_name]&&t.groupProgress[r.group_name].completed++;const i=rt(t.nodes,r.agent_name);i.status="completed",i.elapsed=r.elapsed,i.model=r.model,i.tokens=r.tokens,i.cost_usd=r.cost_usd,r.cost_usd&&(t.totalCost+=r.cost_usd),r.tokens&&(t.totalTokens+=r.tokens)},parallel_agent_failed:(t,l)=>{const r=l;t.groupProgress[r.group_name]&&t.groupProgress[r.group_name].failed++;const i=rt(t.nodes,r.agent_name);i.status="failed",i.elapsed=r.elapsed,i.error_type=r.error_type,i.error_message=r.message},parallel_completed:(t,l)=>{const r=l;t.agentsCompleted++;const i=rt(t.nodes,r.group_name,"parallel_group");i.status=r.failure_count===0?"completed":"failed"},for_each_started:(t,l)=>{const r=l,i=rt(t.nodes,r.group_name,"for_each_group");i.status="running",t.groupProgress[r.group_name]&&(t.groupProgress[r.group_name].total=r.item_count,t.groupProgress[r.group_name].completed=0,t.groupProgress[r.group_name].failed=0)},for_each_item_started:(t,l)=>{},for_each_item_completed:(t,l)=>{const r=l;t.groupProgress[r.group_name]&&t.groupProgress[r.group_name].completed++},for_each_item_failed:(t,l)=>{const r=l;t.groupProgress[r.group_name]&&t.groupProgress[r.group_name].failed++},for_each_completed:(t,l)=>{const r=l;t.agentsCompleted++;const i=rt(t.nodes,r.group_name,"for_each_group");i.status=(r.failure_count??0)===0?"completed":"failed",i.elapsed=r.elapsed,i.success_count=r.success_count,i.failure_count=r.failure_count},workflow_completed:(t,l)=>{const r=l;t.workflowStatus="completed",t.workflowOutput=r.output??null,t.nodes.$end&&(t.nodes.$end.status="completed"),t.highlightedEdges=[]},workflow_failed:(t,l)=>{const r=l;t.workflowStatus="failed",r.agent_name&&t.nodes[r.agent_name]&&(t.nodes[r.agent_name].status="failed"),t.workflowFailure={error_type:r.error_type,message:r.message},t.highlightedEdges=[]}};function I0(t){var i;const l=t.timestamp,r=t.data;switch(t.type){case"workflow_started":return{timestamp:l,level:"info",source:"workflow",message:`Workflow "${r.name||""}" started`};case"agent_started":return{timestamp:l,level:"info",source:String(r.agent_name),message:`Agent started${r.iteration!=null?` (iteration ${r.iteration})`:""}`};case"agent_completed":return{timestamp:l,level:"success",source:String(r.agent_name),message:`Agent completed${r.elapsed!=null?` in ${Bs(r.elapsed)}`:""}${r.tokens!=null?` · ${r.tokens.toLocaleString()} tokens`:""}${r.cost_usd!=null?` · $${r.cost_usd.toFixed(4)}`:""}`};case"agent_failed":return{timestamp:l,level:"error",source:String(r.agent_name),message:`Agent failed: ${r.message||r.error_type||"unknown error"}`};case"script_started":return{timestamp:l,level:"info",source:String(r.agent_name),message:"Script started"};case"script_completed":return{timestamp:l,level:"success",source:String(r.agent_name),message:`Script completed (exit ${r.exit_code??"?"})${r.elapsed!=null?` in ${Bs(r.elapsed)}`:""}`};case"script_failed":return{timestamp:l,level:"error",source:String(r.agent_name),message:`Script failed: ${r.message||r.error_type||"unknown error"}`};case"gate_presented":return{timestamp:l,level:"warning",source:String(r.agent_name),message:"Waiting for human input…"};case"gate_resolved":return{timestamp:l,level:"success",source:String(r.agent_name),message:`Gate resolved → ${r.selected_option||"continue"}`};case"route_taken":return{timestamp:l,level:"debug",source:"router",message:`${r.from_agent} → ${r.to_agent}`};case"parallel_started":return{timestamp:l,level:"info",source:String(r.group_name),message:`Parallel group started (${((i=r.agents)==null?void 0:i.length)||"?"} agents)`};case"parallel_completed":return{timestamp:l,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:l,level:"info",source:String(r.group_name),message:`For-each started (${r.item_count} items)`};case"for_each_completed":return{timestamp:l,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:l,level:"success",source:"workflow",message:`Workflow completed${r.elapsed!=null?` in ${Bs(r.elapsed)}`:""}`};case"workflow_failed":return{timestamp:l,level:"error",source:"workflow",message:`Workflow failed: ${r.message||r.error_type||"unknown error"}`};default:return null}}function Bs(t){if(t<1)return`${(t*1e3).toFixed(0)}ms`;if(t<60)return`${t.toFixed(1)}s`;const l=Math.floor(t/60),r=(t%60).toFixed(0);return`${l}m ${r}s`}function J0(t){const l=t.timestamp,r=t.data;switch(t.type){case"agent_started":return{timestamp:l,source:String(r.agent_name),type:"turn",message:`Agent started${r.iteration!=null?` (iteration ${r.iteration})`:""}`};case"agent_prompt_rendered":return{timestamp:l,source:String(r.agent_name),type:"prompt",message:"Prompt rendered",detail:Ei(String(r.rendered_prompt||""),500)};case"agent_reasoning":return{timestamp:l,source:String(r.agent_name),type:"reasoning",message:String(r.content||"")};case"agent_tool_start":return{timestamp:l,source:String(r.agent_name),type:"tool-start",message:`→ ${r.tool_name}`,detail:r.arguments?Ei(String(r.arguments),300):null};case"agent_tool_complete":return{timestamp:l,source:String(r.agent_name),type:"tool-complete",message:`← ${r.tool_name||"done"}`,detail:r.result?Ei(String(r.result),300):null};case"agent_turn_start":return{timestamp:l,source:String(r.agent_name),type:"turn",message:`Turn ${r.turn??"?"}`};case"agent_message":return{timestamp:l,source:String(r.agent_name),type:"message",message:Ei(String(r.content||""),500)};case"agent_completed":return{timestamp:l,source:String(r.agent_name),type:"turn",message:`Completed${r.elapsed!=null?` in ${Bs(r.elapsed)}`:""}${r.tokens!=null?` · ${r.tokens.toLocaleString()} tokens`:""}`};case"agent_failed":return{timestamp:l,source:String(r.agent_name),type:"turn",message:`Failed: ${r.message||r.error_type||"unknown"}`};case"script_started":return{timestamp:l,source:String(r.agent_name),type:"turn",message:"Script started"};case"script_completed":return{timestamp:l,source:String(r.agent_name),type:"tool-complete",message:`Script completed (exit ${r.exit_code??"?"})`,detail:r.stdout?Ei(String(r.stdout),300):null};case"script_failed":return{timestamp:l,source:String(r.agent_name),type:"turn",message:`Script failed: ${r.message||r.error_type||"unknown"}`};default:return null}}function Ei(t,l){return t.length<=l?t:t.slice(0,l)+"…"}function wS(){const t=_e(l=>l.workflowName);return C.jsxs("header",{className:"flex items-center justify-between px-4 py-2 bg-[var(--surface)] border-b border-[var(--border)] flex-shrink-0",children:[C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx(gx,{className:"w-4 h-4 text-[var(--running)]"}),C.jsx("h1",{className:"text-sm font-semibold text-[var(--text)]",children:"Conductor"}),t&&C.jsxs("span",{className:"text-sm text-[var(--text-muted)] font-normal",children:["— ",t]})]}),C.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Dashboard v1.0"})]})}function xx(t){var l,r,i="";if(typeof t=="string"||typeof t=="number")i+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(l=0;l{const l=NS(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=t;return{getClassGroupId:c=>{const d=c.split(Ah);return d[0]===""&&d.length!==1&&d.shift(),bx(d,l)||ES(c)},getConflictingClassGroupIds:(c,d)=>{const h=r[c]||[];return d&&i[c]?[...h,...i[c]]:h}}},bx=(t,l)=>{var c;if(t.length===0)return l.classGroupId;const r=t[0],i=l.nextPart.get(r),s=i?bx(t.slice(1),i):void 0;if(s)return s;if(l.validators.length===0)return;const u=t.join(Ah);return(c=l.validators.find(({validator:d})=>d(u)))==null?void 0:c.classGroupId},F0=/^\[(.+)\]$/,ES=t=>{if(F0.test(t)){const l=F0.exec(t)[1],r=l==null?void 0:l.substring(0,l.indexOf(":"));if(r)return"arbitrary.."+r}},NS=t=>{const{theme:l,prefix:r}=t,i={nextPart:new Map,validators:[]};return zS(Object.entries(t.classGroups),r).forEach(([u,c])=>{sh(c,i,u,l)}),i},sh=(t,l,r,i)=>{t.forEach(s=>{if(typeof s=="string"){const u=s===""?l:W0(l,s);u.classGroupId=r;return}if(typeof s=="function"){if(CS(s)){sh(s(i),l,r,i);return}l.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([u,c])=>{sh(c,W0(l,u),r,i)})})},W0=(t,l)=>{let r=t;return l.split(Ah).forEach(i=>{r.nextPart.has(i)||r.nextPart.set(i,{nextPart:new Map,validators:[]}),r=r.nextPart.get(i)}),r},CS=t=>t.isThemeGetter,zS=(t,l)=>l?t.map(([r,i])=>{const s=i.map(u=>typeof u=="string"?l+u:typeof u=="object"?Object.fromEntries(Object.entries(u).map(([c,d])=>[l+c,d])):u);return[r,s]}):t,MS=t=>{if(t<1)return{get:()=>{},set:()=>{}};let l=0,r=new Map,i=new Map;const s=(u,c)=>{r.set(u,c),l++,l>t&&(l=0,i=r,r=new Map)};return{get(u){let c=r.get(u);if(c!==void 0)return c;if((c=i.get(u))!==void 0)return s(u,c),c},set(u,c){r.has(u)?r.set(u,c):s(u,c)}}},wx="!",AS=t=>{const{separator:l,experimentalParseClassName:r}=t,i=l.length===1,s=l[0],u=l.length,c=d=>{const h=[];let m=0,y=0,g;for(let _=0;_y?g-y:void 0;return{modifiers:h,hasImportantModifier:x,baseClassName:w,maybePostfixModifierPosition:N}};return r?d=>r({className:d,parseClassName:c}):c},TS=t=>{if(t.length<=1)return t;const l=[];let r=[];return t.forEach(i=>{i[0]==="["?(l.push(...r.sort(),i),r=[]):r.push(i)}),l.push(...r.sort()),l},OS=t=>({cache:MS(t.cacheSize),parseClassName:AS(t),...SS(t)}),jS=/\s+/,RS=(t,l)=>{const{parseClassName:r,getClassGroupId:i,getConflictingClassGroupIds:s}=l,u=[],c=t.trim().split(jS);let d="";for(let h=c.length-1;h>=0;h-=1){const m=c[h],{modifiers:y,hasImportantModifier:g,baseClassName:v,maybePostfixModifierPosition:x}=r(m);let w=!!x,N=i(w?v.substring(0,x):v);if(!N){if(!w){d=m+(d.length>0?" "+d:d);continue}if(N=i(v),!N){d=m+(d.length>0?" "+d:d);continue}w=!1}const _=TS(y).join(":"),E=g?_+wx:_,M=E+N;if(u.includes(M))continue;u.push(M);const S=s(N,w);for(let z=0;z0?" "+d:d)}return d};function DS(){let t=0,l,r,i="";for(;t{if(typeof t=="string")return t;let l,r="";for(let i=0;ig(y),t());return r=OS(m),i=r.cache.get,s=r.cache.set,u=d,d(h)}function d(h){const m=i(h);if(m)return m;const y=RS(h,r);return s(h,y),y}return function(){return u(DS.apply(null,arguments))}}const Ke=t=>{const l=r=>r[t]||[];return l.isThemeGetter=!0,l},Sx=/^\[(?:([a-z-]+):)?(.+)\]$/i,HS=/^\d+\/\d+$/,LS=new Set(["px","full","screen"]),BS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qS=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,US=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,GS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,VS=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Wn=t=>yr(t)||LS.has(t)||HS.test(t),ka=t=>Mr(t,"length",JS),yr=t=>!!t&&!Number.isNaN(Number(t)),Zf=t=>Mr(t,"number",yr),Ni=t=>!!t&&Number.isInteger(Number(t)),YS=t=>t.endsWith("%")&&yr(t.slice(0,-1)),ze=t=>Sx.test(t),Ha=t=>BS.test(t),XS=new Set(["length","size","percentage"]),$S=t=>Mr(t,XS,Ex),QS=t=>Mr(t,"position",Ex),ZS=new Set(["image","url"]),KS=t=>Mr(t,ZS,WS),IS=t=>Mr(t,"",FS),Ci=()=>!0,Mr=(t,l,r)=>{const i=Sx.exec(t);return i?i[1]?typeof l=="string"?i[1]===l:l.has(i[1]):r(i[2]):!1},JS=t=>qS.test(t)&&!US.test(t),Ex=()=>!1,FS=t=>GS.test(t),WS=t=>VS.test(t),PS=()=>{const t=Ke("colors"),l=Ke("spacing"),r=Ke("blur"),i=Ke("brightness"),s=Ke("borderColor"),u=Ke("borderRadius"),c=Ke("borderSpacing"),d=Ke("borderWidth"),h=Ke("contrast"),m=Ke("grayscale"),y=Ke("hueRotate"),g=Ke("invert"),v=Ke("gap"),x=Ke("gradientColorStops"),w=Ke("gradientColorStopPositions"),N=Ke("inset"),_=Ke("margin"),E=Ke("opacity"),M=Ke("padding"),S=Ke("saturate"),z=Ke("scale"),k=Ke("sepia"),R=Ke("skew"),H=Ke("space"),D=Ke("translate"),q=()=>["auto","contain","none"],Z=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto",ze,l],L=()=>[ze,l],te=()=>["",Wn,ka],B=()=>["auto",yr,ze],J=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],T=()=>["solid","dashed","dotted","double","none"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>["start","end","center","between","around","evenly","stretch"],I=()=>["","0",ze],ie=()=>["auto","avoid","all","avoid-page","page","left","right","column"],O=()=>[yr,ze];return{cacheSize:500,separator:":",theme:{colors:[Ci],spacing:[Wn,ka],blur:["none","",Ha,ze],brightness:O(),borderColor:[t],borderRadius:["none","","full",Ha,ze],borderSpacing:L(),borderWidth:te(),contrast:O(),grayscale:I(),hueRotate:O(),invert:I(),gap:L(),gradientColorStops:[t],gradientColorStopPositions:[YS,ka],inset:U(),margin:U(),opacity:O(),padding:L(),saturate:O(),scale:O(),sepia:I(),skew:O(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",ze]}],container:["container"],columns:[{columns:[Ha]}],"break-after":[{"break-after":ie()}],"break-before":[{"break-before":ie()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...J(),ze]}],overflow:[{overflow:Z()}],"overflow-x":[{"overflow-x":Z()}],"overflow-y":[{"overflow-y":Z()}],overscroll:[{overscroll:q()}],"overscroll-x":[{"overscroll-x":q()}],"overscroll-y":[{"overscroll-y":q()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ni,ze]}],basis:[{basis:U()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ze]}],grow:[{grow:I()}],shrink:[{shrink:I()}],order:[{order:["first","last","none",Ni,ze]}],"grid-cols":[{"grid-cols":[Ci]}],"col-start-end":[{col:["auto",{span:["full",Ni,ze]},ze]}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":[Ci]}],"row-start-end":[{row:["auto",{span:[Ni,ze]},ze]}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ze]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ze]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...K()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...K(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...K(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[M]}],px:[{px:[M]}],py:[{py:[M]}],ps:[{ps:[M]}],pe:[{pe:[M]}],pt:[{pt:[M]}],pr:[{pr:[M]}],pb:[{pb:[M]}],pl:[{pl:[M]}],m:[{m:[_]}],mx:[{mx:[_]}],my:[{my:[_]}],ms:[{ms:[_]}],me:[{me:[_]}],mt:[{mt:[_]}],mr:[{mr:[_]}],mb:[{mb:[_]}],ml:[{ml:[_]}],"space-x":[{"space-x":[H]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[H]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ze,l]}],"min-w":[{"min-w":[ze,l,"min","max","fit"]}],"max-w":[{"max-w":[ze,l,"none","full","min","max","fit","prose",{screen:[Ha]},Ha]}],h:[{h:[ze,l,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ze,l,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ze,l,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ze,l,"auto","min","max","fit"]}],"font-size":[{text:["base",Ha,ka]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Zf]}],"font-family":[{font:[Ci]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ze]}],"line-clamp":[{"line-clamp":["none",yr,Zf]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Wn,ze]}],"list-image":[{"list-image":["none",ze]}],"list-style-type":[{list:["none","disc","decimal",ze]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[E]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...T(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Wn,ka]}],"underline-offset":[{"underline-offset":["auto",Wn,ze]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ze]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ze]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[E]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...J(),QS]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",$S]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},KS]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[w]}],"gradient-via-pos":[{via:[w]}],"gradient-to-pos":[{to:[w]}],"gradient-from":[{from:[x]}],"gradient-via":[{via:[x]}],"gradient-to":[{to:[x]}],rounded:[{rounded:[u]}],"rounded-s":[{"rounded-s":[u]}],"rounded-e":[{"rounded-e":[u]}],"rounded-t":[{"rounded-t":[u]}],"rounded-r":[{"rounded-r":[u]}],"rounded-b":[{"rounded-b":[u]}],"rounded-l":[{"rounded-l":[u]}],"rounded-ss":[{"rounded-ss":[u]}],"rounded-se":[{"rounded-se":[u]}],"rounded-ee":[{"rounded-ee":[u]}],"rounded-es":[{"rounded-es":[u]}],"rounded-tl":[{"rounded-tl":[u]}],"rounded-tr":[{"rounded-tr":[u]}],"rounded-br":[{"rounded-br":[u]}],"rounded-bl":[{"rounded-bl":[u]}],"border-w":[{border:[d]}],"border-w-x":[{"border-x":[d]}],"border-w-y":[{"border-y":[d]}],"border-w-s":[{"border-s":[d]}],"border-w-e":[{"border-e":[d]}],"border-w-t":[{"border-t":[d]}],"border-w-r":[{"border-r":[d]}],"border-w-b":[{"border-b":[d]}],"border-w-l":[{"border-l":[d]}],"border-opacity":[{"border-opacity":[E]}],"border-style":[{border:[...T(),"hidden"]}],"divide-x":[{"divide-x":[d]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[d]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[E]}],"divide-style":[{divide:T()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...T()]}],"outline-offset":[{"outline-offset":[Wn,ze]}],"outline-w":[{outline:[Wn,ka]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[Wn,ka]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Ha,IS]}],"shadow-color":[{shadow:[Ci]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...Y(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Y()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[i]}],contrast:[{contrast:[h]}],"drop-shadow":[{"drop-shadow":["","none",Ha,ze]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[y]}],invert:[{invert:[g]}],saturate:[{saturate:[S]}],sepia:[{sepia:[k]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[i]}],"backdrop-contrast":[{"backdrop-contrast":[h]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[y]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[E]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[k]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[c]}],"border-spacing-x":[{"border-spacing-x":[c]}],"border-spacing-y":[{"border-spacing-y":[c]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ze]}],duration:[{duration:O()}],ease:[{ease:["linear","in","out","in-out",ze]}],delay:[{delay:O()}],animate:[{animate:["none","spin","ping","pulse","bounce",ze]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[z]}],"scale-x":[{"scale-x":[z]}],"scale-y":[{"scale-y":[z]}],rotate:[{rotate:[Ni,ze]}],"translate-x":[{"translate-x":[D]}],"translate-y":[{"translate-y":[D]}],"skew-x":[{"skew-x":[R]}],"skew-y":[{"skew-y":[R]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ze]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ze]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ze]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Wn,ka,Zf]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},eE=kS(PS);function St(...t){return eE(_S(t))}function iu(t){if(t==null)return"—";if(t<1)return`${(t*1e3).toFixed(0)}ms`;if(t<60)return`${t.toFixed(1)}s`;const l=Math.floor(t/60),r=(t%60).toFixed(0);return`${l}m ${r}s`}function Nx(t){if(t==null)return"";if(typeof t=="string")return t;try{return JSON.stringify(t,null,2)}catch{return String(t)}}function tE(t){return t==null?"—":`$${t.toFixed(4)}`}function Kf(t){return t==null?"—":t.toLocaleString()}function nE(){const t=_e(u=>u.workflowStatus),l=_e(u=>u.workflowStartTime),[r,i]=V.useState("—"),s=V.useRef(null);return V.useEffect(()=>{if(t==="running"&&l!=null){const u=()=>{const c=Date.now()/1e3-l;i(iu(c))};return u(),s.current=setInterval(u,500),()=>{s.current&&clearInterval(s.current)}}else(t==="completed"||t==="failed")&&s.current&&(clearInterval(s.current),s.current=null)},[t,l]),r}function aE(){const t=_e(g=>g.workflowStatus),l=_e(g=>g.agentsCompleted),r=_e(g=>g.agentsTotal),i=_e(g=>g.totalCost),s=_e(g=>g.totalTokens),u=_e(g=>g.wsStatus),c=_e(g=>g.workflowFailure),d=nE(),h=(()=>{switch(t){case"pending":return"Waiting for workflow…";case"running":return"Running";case"completed":return"Completed";case"failed":{if(!c)return"Failed";const g=c.error_type||"";return g==="MaxIterationsError"?"Failed: exceeded maximum iterations":g==="TimeoutError"?"Failed: workflow timed out":c.message?`Failed: ${c.message}`:`Failed: ${g}`}}})(),m={pending:"bg-[var(--pending)]",running:"bg-[var(--running)] animate-pulse",completed:"bg-[var(--completed)]",failed:"bg-[var(--failed)]"}[t],y=(()=>{switch(u){case"connected":return C.jsxs("span",{className:"flex items-center gap-1 text-[var(--completed)]",children:[C.jsx(mS,{className:"w-3 h-3"}),C.jsx("span",{children:"Connected"})]});case"disconnected":return C.jsxs("span",{className:"flex items-center gap-1 text-[var(--failed)]",children:[C.jsx(pS,{className:"w-3 h-3"}),C.jsx("span",{children:"Disconnected"})]});case"reconnecting":return C.jsxs("span",{className:"flex items-center gap-1 text-[var(--waiting)]",children:[C.jsx(oh,{className:"w-3 h-3 animate-spin"}),C.jsx("span",{children:"Reconnecting…"})]});case"connecting":return C.jsxs("span",{className:"flex items-center gap-1 text-[var(--text-muted)]",children:[C.jsx(oh,{className:"w-3 h-3 animate-spin"}),C.jsx("span",{children:"Connecting…"})]})}})();return C.jsxs("footer",{className:"flex items-center gap-4 px-4 py-1.5 bg-[var(--surface)] border-t border-[var(--border)] text-xs flex-shrink-0",children:[C.jsx("span",{className:St("w-2 h-2 rounded-full flex-shrink-0",m)}),C.jsx("span",{className:"text-[var(--text)]",children:h}),r>0&&C.jsxs("span",{className:"text-[var(--text-muted)]",children:[l,"/",r," agents"]}),t!=="pending"&&C.jsx("span",{className:"text-[var(--text-muted)] font-mono",children:d}),s>0&&C.jsxs("span",{className:"flex items-center gap-1 text-[var(--text-muted)]",title:"Total tokens used",children:[C.jsx(uS,{className:"w-3 h-3"}),C.jsx("span",{className:"font-mono",children:s.toLocaleString()})]}),i>0&&C.jsxs("span",{className:"flex items-center gap-1 text-[var(--text-muted)]",title:"Total cost",children:[C.jsx(iS,{className:"w-3 h-3"}),C.jsxs("span",{className:"font-mono",children:["$",i.toFixed(4)]})]}),C.jsx("span",{className:"flex-1"}),y]})}const ou=V.createContext(null);ou.displayName="PanelGroupContext";const tt={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"},Th=10,gl=V.useLayoutEffect,P0=Z_.useId,lE=typeof P0=="function"?P0:()=>null;let rE=0;function Oh(t=null){const l=lE(),r=V.useRef(t||l||null);return r.current===null&&(r.current=""+rE++),t??r.current}function Cx({children:t,className:l="",collapsedSize:r,collapsible:i,defaultSize:s,forwardedRef:u,id:c,maxSize:d,minSize:h,onCollapse:m,onExpand:y,onResize:g,order:v,style:x,tagName:w="div",...N}){const _=V.useContext(ou);if(_===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:E,expandPanel:M,getPanelSize:S,getPanelStyle:z,groupId:k,isPanelCollapsed:R,reevaluatePanelConstraints:H,registerPanel:D,resizePanel:q,unregisterPanel:Z}=_,U=Oh(c),L=V.useRef({callbacks:{onCollapse:m,onExpand:y,onResize:g},constraints:{collapsedSize:r,collapsible:i,defaultSize:s,maxSize:d,minSize:h},id:U,idIsFromProps:c!==void 0,order:v});V.useRef({didLogMissingDefaultSizeWarning:!1}),gl(()=>{const{callbacks:B,constraints:J}=L.current,T={...J};L.current.id=U,L.current.idIsFromProps=c!==void 0,L.current.order=v,B.onCollapse=m,B.onExpand=y,B.onResize=g,J.collapsedSize=r,J.collapsible=i,J.defaultSize=s,J.maxSize=d,J.minSize=h,(T.collapsedSize!==J.collapsedSize||T.collapsible!==J.collapsible||T.maxSize!==J.maxSize||T.minSize!==J.minSize)&&H(L.current,T)}),gl(()=>{const B=L.current;return D(B),()=>{Z(B)}},[v,U,D,Z]),V.useImperativeHandle(u,()=>({collapse:()=>{E(L.current)},expand:B=>{M(L.current,B)},getId(){return U},getSize(){return S(L.current)},isCollapsed(){return R(L.current)},isExpanded(){return!R(L.current)},resize:B=>{q(L.current,B)}}),[E,M,S,R,U,q]);const te=z(L.current,s);return V.createElement(w,{...N,children:t,className:l,id:U,style:{...te,...x},[tt.groupId]:k,[tt.panel]:"",[tt.panelCollapsible]:i||void 0,[tt.panelId]:U,[tt.panelSize]:parseFloat(""+te.flexGrow).toFixed(1)})}const Ai=V.forwardRef((t,l)=>V.createElement(Cx,{...t,forwardedRef:l}));Cx.displayName="Panel";Ai.displayName="forwardRef(Panel)";let uh=null,qs=-1,qa=null;function iE(t,l){if(l){const r=(l&Ox)!==0,i=(l&jx)!==0,s=(l&Rx)!==0,u=(l&Dx)!==0;if(r)return s?"se-resize":u?"ne-resize":"e-resize";if(i)return s?"sw-resize":u?"nw-resize":"w-resize";if(s)return"s-resize";if(u)return"n-resize"}switch(t){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function oE(){qa!==null&&(document.head.removeChild(qa),uh=null,qa=null,qs=-1)}function If(t,l){var r,i;const s=iE(t,l);if(uh!==s){if(uh=s,qa===null&&(qa=document.createElement("style"),document.head.appendChild(qa)),qs>=0){var u;(u=qa.sheet)===null||u===void 0||u.removeRule(qs)}qs=(r=(i=qa.sheet)===null||i===void 0?void 0:i.insertRule(`*{cursor: ${s} !important;}`))!==null&&r!==void 0?r:-1}}function zx(t){return t.type==="keydown"}function Mx(t){return t.type.startsWith("pointer")}function Ax(t){return t.type.startsWith("mouse")}function su(t){if(Mx(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(Ax(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function sE(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function uE(t,l,r){return t.xl.x&&t.yl.y}function cE(t,l){if(t===l)throw new Error("Cannot compare node with itself");const r={a:ny(t),b:ny(l)};let i;for(;r.a.at(-1)===r.b.at(-1);)t=r.a.pop(),l=r.b.pop(),i=t;Me(i,"Stacking order can only be calculated for elements with a common ancestor");const s={a:ty(ey(r.a)),b:ty(ey(r.b))};if(s.a===s.b){const u=i.childNodes,c={a:r.a.at(-1),b:r.b.at(-1)};let d=u.length;for(;d--;){const h=u[d];if(h===c.a)return 1;if(h===c.b)return-1}}return Math.sign(s.a-s.b)}const fE=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function dE(t){var l;const r=getComputedStyle((l=Tx(t))!==null&&l!==void 0?l:t).display;return r==="flex"||r==="inline-flex"}function hE(t){const l=getComputedStyle(t);return!!(l.position==="fixed"||l.zIndex!=="auto"&&(l.position!=="static"||dE(t))||+l.opacity<1||"transform"in l&&l.transform!=="none"||"webkitTransform"in l&&l.webkitTransform!=="none"||"mixBlendMode"in l&&l.mixBlendMode!=="normal"||"filter"in l&&l.filter!=="none"||"webkitFilter"in l&&l.webkitFilter!=="none"||"isolation"in l&&l.isolation==="isolate"||fE.test(l.willChange)||l.webkitOverflowScrolling==="touch")}function ey(t){let l=t.length;for(;l--;){const r=t[l];if(Me(r,"Missing node"),hE(r))return r}return null}function ty(t){return t&&Number(getComputedStyle(t).zIndex)||0}function ny(t){const l=[];for(;t;)l.push(t),t=Tx(t);return l}function Tx(t){const{parentNode:l}=t;return l&&l instanceof ShadowRoot?l.host:l}const Ox=1,jx=2,Rx=4,Dx=8,gE=sE()==="coarse";let pn=[],vr=!1,dl=new Map,uu=new Map;const Li=new Set;function pE(t,l,r,i,s){var u;const{ownerDocument:c}=l,d={direction:r,element:l,hitAreaMargins:i,setResizeHandlerState:s},h=(u=dl.get(c))!==null&&u!==void 0?u:0;return dl.set(c,h+1),Li.add(d),Qs(),function(){var y;uu.delete(t),Li.delete(d);const g=(y=dl.get(c))!==null&&y!==void 0?y:1;if(dl.set(c,g-1),Qs(),g===1&&dl.delete(c),pn.includes(d)){const v=pn.indexOf(d);v>=0&&pn.splice(v,1),Rh(),s("up",!0,null)}}}function mE(t){const{target:l}=t,{x:r,y:i}=su(t);vr=!0,jh({target:l,x:r,y:i}),Qs(),pn.length>0&&(Zs("down",t),t.preventDefault(),kx(l)||t.stopImmediatePropagation())}function Jf(t){const{x:l,y:r}=su(t);if(vr&&t.buttons===0&&(vr=!1,Zs("up",t)),!vr){const{target:i}=t;jh({target:i,x:l,y:r})}Zs("move",t),Rh(),pn.length>0&&t.preventDefault()}function Ff(t){const{target:l}=t,{x:r,y:i}=su(t);uu.clear(),vr=!1,pn.length>0&&(t.preventDefault(),kx(l)||t.stopImmediatePropagation()),Zs("up",t),jh({target:l,x:r,y:i}),Rh(),Qs()}function kx(t){let l=t;for(;l;){if(l.hasAttribute(tt.resizeHandle))return!0;l=l.parentElement}return!1}function jh({target:t,x:l,y:r}){pn.splice(0);let i=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(i=t),Li.forEach(s=>{const{element:u,hitAreaMargins:c}=s,d=u.getBoundingClientRect(),{bottom:h,left:m,right:y,top:g}=d,v=gE?c.coarse:c.fine;if(l>=m-v&&l<=y+v&&r>=g-v&&r<=h+v){if(i!==null&&document.contains(i)&&u!==i&&!u.contains(i)&&!i.contains(u)&&cE(i,u)>0){let w=i,N=!1;for(;w&&!w.contains(u);){if(uE(w.getBoundingClientRect(),d)){N=!0;break}w=w.parentElement}if(N)return}pn.push(s)}})}function Wf(t,l){uu.set(t,l)}function Rh(){let t=!1,l=!1;pn.forEach(i=>{const{direction:s}=i;s==="horizontal"?t=!0:l=!0});let r=0;uu.forEach(i=>{r|=i}),t&&l?If("intersection",r):t?If("horizontal",r):l?If("vertical",r):oE()}let Pf=new AbortController;function Qs(){Pf.abort(),Pf=new AbortController;const t={capture:!0,signal:Pf.signal};Li.size&&(vr?(pn.length>0&&dl.forEach((l,r)=>{const{body:i}=r;l>0&&(i.addEventListener("contextmenu",Ff,t),i.addEventListener("pointerleave",Jf,t),i.addEventListener("pointermove",Jf,t))}),window.addEventListener("pointerup",Ff,t),window.addEventListener("pointercancel",Ff,t)):dl.forEach((l,r)=>{const{body:i}=r;l>0&&(i.addEventListener("pointerdown",mE,t),i.addEventListener("pointermove",Jf,t))}))}function Zs(t,l){Li.forEach(r=>{const{setResizeHandlerState:i}=r,s=pn.includes(r);i(t,s,l)})}function yE(){const[t,l]=V.useState(0);return V.useCallback(()=>l(r=>r+1),[])}function Me(t,l){if(!t)throw console.error(l),Error(l)}function yl(t,l,r=Th){return t.toFixed(r)===l.toFixed(r)?0:t>l?1:-1}function ea(t,l,r=Th){return yl(t,l,r)===0}function Kt(t,l,r){return yl(t,l,r)===0}function vE(t,l,r){if(t.length!==l.length)return!1;for(let i=0;i0&&(t=t<0?0-E:E)}}}{const g=t<0?d:h,v=r[g];Me(v,`No panel constraints found for index ${g}`);const{collapsedSize:x=0,collapsible:w,minSize:N=0}=v;if(w){const _=l[g];if(Me(_!=null,`Previous layout not found for panel index ${g}`),Kt(_,N)){const E=_-x;yl(E,Math.abs(t))>0&&(t=t<0?0-E:E)}}}}{const g=t<0?1:-1;let v=t<0?h:d,x=0;for(;;){const N=l[v];Me(N!=null,`Previous layout not found for panel index ${v}`);const E=hr({panelConstraints:r,panelIndex:v,size:100})-N;if(x+=E,v+=g,v<0||v>=r.length)break}const w=Math.min(Math.abs(t),Math.abs(x));t=t<0?0-w:w}{let v=t<0?d:h;for(;v>=0&&v=0))break;t<0?v--:v++}}if(vE(s,c))return s;{const g=t<0?h:d,v=l[g];Me(v!=null,`Previous layout not found for panel index ${g}`);const x=v+m,w=hr({panelConstraints:r,panelIndex:g,size:x});if(c[g]=w,!Kt(w,x)){let N=x-w,E=t<0?h:d;for(;E>=0&&E0?E--:E++}}}const y=c.reduce((g,v)=>v+g,0);return Kt(y,100)?c:s}function xE({layout:t,panelsArray:l,pivotIndices:r}){let i=0,s=100,u=0,c=0;const d=r[0];Me(d!=null,"No pivot index found"),l.forEach((g,v)=>{const{constraints:x}=g,{maxSize:w=100,minSize:N=0}=x;v===d?(i=N,s=w):(u+=N,c+=w)});const h=Math.min(s,100-u),m=Math.max(i,100-c),y=t[d];return{valueMax:h,valueMin:m,valueNow:y}}function Bi(t,l=document){return Array.from(l.querySelectorAll(`[${tt.resizeHandleId}][data-panel-group-id="${t}"]`))}function Hx(t,l,r=document){const s=Bi(t,r).findIndex(u=>u.getAttribute(tt.resizeHandleId)===l);return s??null}function Lx(t,l,r){const i=Hx(t,l,r);return i!=null?[i,i+1]:[-1,-1]}function Bx(t,l=document){var r;if(l instanceof HTMLElement&&(l==null||(r=l.dataset)===null||r===void 0?void 0:r.panelGroupId)==t)return l;const i=l.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return i||null}function cu(t,l=document){const r=l.querySelector(`[${tt.resizeHandleId}="${t}"]`);return r||null}function bE(t,l,r,i=document){var s,u,c,d;const h=cu(l,i),m=Bi(t,i),y=h?m.indexOf(h):-1,g=(s=(u=r[y])===null||u===void 0?void 0:u.id)!==null&&s!==void 0?s:null,v=(c=(d=r[y+1])===null||d===void 0?void 0:d.id)!==null&&c!==void 0?c:null;return[g,v]}function wE({committedValuesRef:t,eagerValuesRef:l,groupId:r,layout:i,panelDataArray:s,panelGroupElement:u,setLayout:c}){V.useRef({didWarnAboutMissingResizeHandle:!1}),gl(()=>{if(!u)return;const d=Bi(r,u);for(let h=0;h{d.forEach((h,m)=>{h.removeAttribute("aria-controls"),h.removeAttribute("aria-valuemax"),h.removeAttribute("aria-valuemin"),h.removeAttribute("aria-valuenow")})}},[r,i,s,u]),V.useEffect(()=>{if(!u)return;const d=l.current;Me(d,"Eager values not found");const{panelDataArray:h}=d,m=Bx(r,u);Me(m!=null,`No group found for id "${r}"`);const y=Bi(r,u);Me(y,`No resize handles found for group id "${r}"`);const g=y.map(v=>{const x=v.getAttribute(tt.resizeHandleId);Me(x,"Resize handle element has no handle id attribute");const[w,N]=bE(r,x,h,u);if(w==null||N==null)return()=>{};const _=E=>{if(!E.defaultPrevented)switch(E.key){case"Enter":{E.preventDefault();const M=h.findIndex(S=>S.id===w);if(M>=0){const S=h[M];Me(S,`No panel data found for index ${M}`);const z=i[M],{collapsedSize:k=0,collapsible:R,minSize:H=0}=S.constraints;if(z!=null&&R){const D=Ti({delta:Kt(z,k)?H-k:k-z,initialLayout:i,panelConstraints:h.map(q=>q.constraints),pivotIndices:Lx(r,x,u),prevLayout:i,trigger:"keyboard"});i!==D&&c(D)}}break}}};return v.addEventListener("keydown",_),()=>{v.removeEventListener("keydown",_)}});return()=>{g.forEach(v=>v())}},[u,t,l,r,i,s,c])}function ay(t,l){if(t.length!==l.length)return!1;for(let r=0;ru.constraints);let i=0,s=100;for(let u=0;u{const u=t[s];Me(u,`Panel data not found for index ${s}`);const{callbacks:c,constraints:d,id:h}=u,{collapsedSize:m=0,collapsible:y}=d,g=r[h];if(g==null||i!==g){r[h]=i;const{onCollapse:v,onExpand:x,onResize:w}=c;w&&w(i,g),y&&(v||x)&&(x&&(g==null||ea(g,m))&&!ea(i,m)&&x(),v&&(g==null||!ea(g,m))&&ea(i,m)&&v())}})}function Ms(t,l){if(t.length!==l.length)return!1;for(let r=0;r{r!==null&&clearTimeout(r),r=setTimeout(()=>{t(...s)},l)}}function ly(t){try{if(typeof localStorage<"u")t.getItem=l=>localStorage.getItem(l),t.setItem=(l,r)=>{localStorage.setItem(l,r)};else throw new Error("localStorage not supported in this environment")}catch(l){console.error(l),t.getItem=()=>null,t.setItem=()=>{}}}function Ux(t){return`react-resizable-panels:${t}`}function Gx(t){return t.map(l=>{const{constraints:r,id:i,idIsFromProps:s,order:u}=l;return s?i:u?`${u}:${JSON.stringify(r)}`:JSON.stringify(r)}).sort((l,r)=>l.localeCompare(r)).join(",")}function Vx(t,l){try{const r=Ux(t),i=l.getItem(r);if(i){const s=JSON.parse(i);if(typeof s=="object"&&s!=null)return s}}catch{}return null}function zE(t,l,r){var i,s;const u=(i=Vx(t,r))!==null&&i!==void 0?i:{},c=Gx(l);return(s=u[c])!==null&&s!==void 0?s:null}function ME(t,l,r,i,s){var u;const c=Ux(t),d=Gx(l),h=(u=Vx(t,s))!==null&&u!==void 0?u:{};h[d]={expandToSizes:Object.fromEntries(r.entries()),layout:i};try{s.setItem(c,JSON.stringify(h))}catch(m){console.error(m)}}function ry({layout:t,panelConstraints:l}){const r=[...t],i=r.reduce((u,c)=>u+c,0);if(r.length!==l.length)throw Error(`Invalid ${l.length} panel layout: ${r.map(u=>`${u}%`).join(", ")}`);if(!Kt(i,100)&&r.length>0)for(let u=0;u(ly(Oi),Oi.getItem(t)),setItem:(t,l)=>{ly(Oi),Oi.setItem(t,l)}},iy={};function Yx({autoSaveId:t=null,children:l,className:r="",direction:i,forwardedRef:s,id:u=null,onLayout:c=null,keyboardResizeBy:d=null,storage:h=Oi,style:m,tagName:y="div",...g}){const v=Oh(u),x=V.useRef(null),[w,N]=V.useState(null),[_,E]=V.useState([]),M=yE(),S=V.useRef({}),z=V.useRef(new Map),k=V.useRef(0),R=V.useRef({autoSaveId:t,direction:i,dragState:w,id:v,keyboardResizeBy:d,onLayout:c,storage:h}),H=V.useRef({layout:_,panelDataArray:[],panelDataArrayChanged:!1});V.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),V.useImperativeHandle(s,()=>({getId:()=>R.current.id,getLayout:()=>{const{layout:j}=H.current;return j},setLayout:j=>{const{onLayout:G}=R.current,{layout:$,panelDataArray:W}=H.current,ee=ry({layout:j,panelConstraints:W.map(ne=>ne.constraints)});ay($,ee)||(E(ee),H.current.layout=ee,G&&G(ee),ur(W,ee,S.current))}}),[]),gl(()=>{R.current.autoSaveId=t,R.current.direction=i,R.current.dragState=w,R.current.id=v,R.current.onLayout=c,R.current.storage=h}),wE({committedValuesRef:R,eagerValuesRef:H,groupId:v,layout:_,panelDataArray:H.current.panelDataArray,setLayout:E,panelGroupElement:x.current}),V.useEffect(()=>{const{panelDataArray:j}=H.current;if(t){if(_.length===0||_.length!==j.length)return;let G=iy[t];G==null&&(G=CE(ME,AE),iy[t]=G);const $=[...j],W=new Map(z.current);G(t,$,W,_,h)}},[t,_,h]),V.useEffect(()=>{});const D=V.useCallback(j=>{const{onLayout:G}=R.current,{layout:$,panelDataArray:W}=H.current;if(j.constraints.collapsible){const ee=W.map(ye=>ye.constraints),{collapsedSize:ne=0,panelSize:ue,pivotIndices:he}=cl(W,j,$);if(Me(ue!=null,`Panel size not found for panel "${j.id}"`),!ea(ue,ne)){z.current.set(j.id,ue);const ge=fr(W,j)===W.length-1?ue-ne:ne-ue,de=Ti({delta:ge,initialLayout:$,panelConstraints:ee,pivotIndices:he,prevLayout:$,trigger:"imperative-api"});Ms($,de)||(E(de),H.current.layout=de,G&&G(de),ur(W,de,S.current))}}},[]),q=V.useCallback((j,G)=>{const{onLayout:$}=R.current,{layout:W,panelDataArray:ee}=H.current;if(j.constraints.collapsible){const ne=ee.map(xe=>xe.constraints),{collapsedSize:ue=0,panelSize:he=0,minSize:ye=0,pivotIndices:ge}=cl(ee,j,W),de=G??ye;if(ea(he,ue)){const xe=z.current.get(j.id),Ae=xe!=null&&xe>=de?xe:de,We=fr(ee,j)===ee.length-1?he-Ae:Ae-he,$e=Ti({delta:We,initialLayout:W,panelConstraints:ne,pivotIndices:ge,prevLayout:W,trigger:"imperative-api"});Ms(W,$e)||(E($e),H.current.layout=$e,$&&$($e),ur(ee,$e,S.current))}}},[]),Z=V.useCallback(j=>{const{layout:G,panelDataArray:$}=H.current,{panelSize:W}=cl($,j,G);return Me(W!=null,`Panel size not found for panel "${j.id}"`),W},[]),U=V.useCallback((j,G)=>{const{panelDataArray:$}=H.current,W=fr($,j);return NE({defaultSize:G,dragState:w,layout:_,panelData:$,panelIndex:W})},[w,_]),L=V.useCallback(j=>{const{layout:G,panelDataArray:$}=H.current,{collapsedSize:W=0,collapsible:ee,panelSize:ne}=cl($,j,G);return Me(ne!=null,`Panel size not found for panel "${j.id}"`),ee===!0&&ea(ne,W)},[]),te=V.useCallback(j=>{const{layout:G,panelDataArray:$}=H.current,{collapsedSize:W=0,collapsible:ee,panelSize:ne}=cl($,j,G);return Me(ne!=null,`Panel size not found for panel "${j.id}"`),!ee||yl(ne,W)>0},[]),B=V.useCallback(j=>{const{panelDataArray:G}=H.current;G.push(j),G.sort(($,W)=>{const ee=$.order,ne=W.order;return ee==null&&ne==null?0:ee==null?-1:ne==null?1:ee-ne}),H.current.panelDataArrayChanged=!0,M()},[M]);gl(()=>{if(H.current.panelDataArrayChanged){H.current.panelDataArrayChanged=!1;const{autoSaveId:j,onLayout:G,storage:$}=R.current,{layout:W,panelDataArray:ee}=H.current;let ne=null;if(j){const he=zE(j,ee,$);he&&(z.current=new Map(Object.entries(he.expandToSizes)),ne=he.layout)}ne==null&&(ne=EE({panelDataArray:ee}));const ue=ry({layout:ne,panelConstraints:ee.map(he=>he.constraints)});ay(W,ue)||(E(ue),H.current.layout=ue,G&&G(ue),ur(ee,ue,S.current))}}),gl(()=>{const j=H.current;return()=>{j.layout=[]}},[]);const J=V.useCallback(j=>{let G=!1;const $=x.current;return $&&window.getComputedStyle($,null).getPropertyValue("direction")==="rtl"&&(G=!0),function(ee){ee.preventDefault();const ne=x.current;if(!ne)return()=>null;const{direction:ue,dragState:he,id:ye,keyboardResizeBy:ge,onLayout:de}=R.current,{layout:xe,panelDataArray:Ae}=H.current,{initialLayout:Se}=he??{},We=Lx(ye,j,ne);let $e=SE(ee,j,ue,he,ge,ne);const Et=ue==="horizontal";Et&&G&&($e=-$e);const Ut=Ae.map(An=>An.constraints),zt=Ti({delta:$e,initialLayout:Se??xe,panelConstraints:Ut,pivotIndices:We,prevLayout:xe,trigger:zx(ee)?"keyboard":"mouse-or-touch"}),vn=!Ms(xe,zt);(Mx(ee)||Ax(ee))&&k.current!=$e&&(k.current=$e,!vn&&$e!==0?Et?Wf(j,$e<0?Ox:jx):Wf(j,$e<0?Rx:Dx):Wf(j,0)),vn&&(E(zt),H.current.layout=zt,de&&de(zt),ur(Ae,zt,S.current))}},[]),T=V.useCallback((j,G)=>{const{onLayout:$}=R.current,{layout:W,panelDataArray:ee}=H.current,ne=ee.map(xe=>xe.constraints),{panelSize:ue,pivotIndices:he}=cl(ee,j,W);Me(ue!=null,`Panel size not found for panel "${j.id}"`);const ge=fr(ee,j)===ee.length-1?ue-G:G-ue,de=Ti({delta:ge,initialLayout:W,panelConstraints:ne,pivotIndices:he,prevLayout:W,trigger:"imperative-api"});Ms(W,de)||(E(de),H.current.layout=de,$&&$(de),ur(ee,de,S.current))},[]),Y=V.useCallback((j,G)=>{const{layout:$,panelDataArray:W}=H.current,{collapsedSize:ee=0,collapsible:ne}=G,{collapsedSize:ue=0,collapsible:he,maxSize:ye=100,minSize:ge=0}=j.constraints,{panelSize:de}=cl(W,j,$);de!=null&&(ne&&he&&ea(de,ee)?ea(ee,ue)||T(j,ue):deye&&T(j,ye))},[T]),K=V.useCallback((j,G)=>{const{direction:$}=R.current,{layout:W}=H.current;if(!x.current)return;const ee=cu(j,x.current);Me(ee,`Drag handle element not found for id "${j}"`);const ne=qx($,G);N({dragHandleId:j,dragHandleRect:ee.getBoundingClientRect(),initialCursorPosition:ne,initialLayout:W})},[]),I=V.useCallback(()=>{N(null)},[]),ie=V.useCallback(j=>{const{panelDataArray:G}=H.current,$=fr(G,j);$>=0&&(G.splice($,1),delete S.current[j.id],H.current.panelDataArrayChanged=!0,M())},[M]),O=V.useMemo(()=>({collapsePanel:D,direction:i,dragState:w,expandPanel:q,getPanelSize:Z,getPanelStyle:U,groupId:v,isPanelCollapsed:L,isPanelExpanded:te,reevaluatePanelConstraints:Y,registerPanel:B,registerResizeHandle:J,resizePanel:T,startDragging:K,stopDragging:I,unregisterPanel:ie,panelGroupElement:x.current}),[D,w,i,q,Z,U,v,L,te,Y,B,J,T,K,I,ie]),X={display:"flex",flexDirection:i==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return V.createElement(ou.Provider,{value:O},V.createElement(y,{...g,children:l,className:r,id:u,ref:x,style:{...X,...m},[tt.group]:"",[tt.groupDirection]:i,[tt.groupId]:v}))}const ch=V.forwardRef((t,l)=>V.createElement(Yx,{...t,forwardedRef:l}));Yx.displayName="PanelGroup";ch.displayName="forwardRef(PanelGroup)";function fr(t,l){return t.findIndex(r=>r===l||r.id===l.id)}function cl(t,l,r){const i=fr(t,l),u=i===t.length-1?[i-1,i]:[i,i+1],c=r[i];return{...l.constraints,panelSize:c,pivotIndices:u}}function TE({disabled:t,handleId:l,resizeHandler:r,panelGroupElement:i}){V.useEffect(()=>{if(t||r==null||i==null)return;const s=cu(l,i);if(s==null)return;const u=c=>{if(!c.defaultPrevented)switch(c.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{c.preventDefault(),r(c);break}case"F6":{c.preventDefault();const d=s.getAttribute(tt.groupId);Me(d,`No group element found for id "${d}"`);const h=Bi(d,i),m=Hx(d,l,i);Me(m!==null,`No resize element found for id "${l}"`);const y=c.shiftKey?m>0?m-1:h.length-1:m+1{s.removeEventListener("keydown",u)}},[i,t,l,r])}function fh({children:t=null,className:l="",disabled:r=!1,hitAreaMargins:i,id:s,onBlur:u,onClick:c,onDragging:d,onFocus:h,onPointerDown:m,onPointerUp:y,style:g={},tabIndex:v=0,tagName:x="div",...w}){var N,_;const E=V.useRef(null),M=V.useRef({onClick:c,onDragging:d,onPointerDown:m,onPointerUp:y});V.useEffect(()=>{M.current.onClick=c,M.current.onDragging=d,M.current.onPointerDown=m,M.current.onPointerUp=y});const S=V.useContext(ou);if(S===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:z,groupId:k,registerResizeHandle:R,startDragging:H,stopDragging:D,panelGroupElement:q}=S,Z=Oh(s),[U,L]=V.useState("inactive"),[te,B]=V.useState(!1),[J,T]=V.useState(null),Y=V.useRef({state:U});gl(()=>{Y.current.state=U}),V.useEffect(()=>{if(r)T(null);else{const O=R(Z);T(()=>O)}},[r,Z,R]);const K=(N=i==null?void 0:i.coarse)!==null&&N!==void 0?N:15,I=(_=i==null?void 0:i.fine)!==null&&_!==void 0?_:5;V.useEffect(()=>{if(r||J==null)return;const O=E.current;Me(O,"Element ref not attached");let X=!1;return pE(Z,O,z,{coarse:K,fine:I},(G,$,W)=>{if(!$){L("inactive");return}switch(G){case"down":{L("drag"),X=!1,Me(W,'Expected event to be defined for "down" action'),H(Z,W);const{onDragging:ee,onPointerDown:ne}=M.current;ee==null||ee(!0),ne==null||ne();break}case"move":{const{state:ee}=Y.current;X=!0,ee!=="drag"&&L("hover"),Me(W,'Expected event to be defined for "move" action'),J(W);break}case"up":{L("hover"),D();const{onClick:ee,onDragging:ne,onPointerUp:ue}=M.current;ne==null||ne(!1),ue==null||ue(),X||ee==null||ee();break}}})},[K,z,r,I,R,Z,J,H,D]),TE({disabled:r,handleId:Z,resizeHandler:J,panelGroupElement:q});const ie={touchAction:"none",userSelect:"none"};return V.createElement(x,{...w,children:t,className:l,id:s,onBlur:()=>{B(!1),u==null||u()},onFocus:()=>{B(!0),h==null||h()},ref:E,role:"separator",style:{...ie,...g},tabIndex:v,[tt.groupDirection]:z,[tt.groupId]:k,[tt.resizeHandle]:"",[tt.resizeHandleActive]:U==="drag"?"pointer":te?"keyboard":void 0,[tt.resizeHandleEnabled]:!r,[tt.resizeHandleId]:Z,[tt.resizeHandleState]:U})}fh.displayName="PanelResizeHandle";function gt(t){if(typeof t=="string"||typeof t=="number")return""+t;let l="";if(Array.isArray(t))for(let r=0,i;r{}};function fu(){for(var t=0,l=arguments.length,r={},i;t=0&&(i=r.slice(s+1),r=r.slice(0,s)),r&&!l.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}Us.prototype=fu.prototype={constructor:Us,on:function(t,l){var r=this._,i=jE(t+"",r),s,u=-1,c=i.length;if(arguments.length<2){for(;++u0)for(var r=new Array(s),i=0,s,u;i=0&&(l=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),sy.hasOwnProperty(l)?{space:sy[l],local:t}:t}function DE(t){return function(){var l=this.ownerDocument,r=this.namespaceURI;return r===dh&&l.documentElement.namespaceURI===dh?l.createElement(t):l.createElementNS(r,t)}}function kE(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Xx(t){var l=du(t);return(l.local?kE:DE)(l)}function HE(){}function Dh(t){return t==null?HE:function(){return this.querySelector(t)}}function LE(t){typeof t!="function"&&(t=Dh(t));for(var l=this._groups,r=l.length,i=new Array(r),s=0;s=S&&(S=M+1);!(k=_[S])&&++S=0;)(c=i[s])&&(u&&c.compareDocumentPosition(u)^4&&u.parentNode.insertBefore(c,u),u=c);return this}function s2(t){t||(t=u2);function l(g,v){return g&&v?t(g.__data__,v.__data__):!g-!v}for(var r=this._groups,i=r.length,s=new Array(i),u=0;ul?1:t>=l?0:NaN}function c2(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function f2(){return Array.from(this)}function d2(){for(var t=this._groups,l=0,r=t.length;l1?this.each((l==null?S2:typeof l=="function"?N2:E2)(t,l,r??"")):wr(this.node(),t)}function wr(t,l){return t.style.getPropertyValue(l)||Ix(t).getComputedStyle(t,null).getPropertyValue(l)}function z2(t){return function(){delete this[t]}}function M2(t,l){return function(){this[t]=l}}function A2(t,l){return function(){var r=l.apply(this,arguments);r==null?delete this[t]:this[t]=r}}function T2(t,l){return arguments.length>1?this.each((l==null?z2:typeof l=="function"?A2:M2)(t,l)):this.node()[t]}function Jx(t){return t.trim().split(/^|\s+/)}function kh(t){return t.classList||new Fx(t)}function Fx(t){this._node=t,this._names=Jx(t.getAttribute("class")||"")}Fx.prototype={add:function(t){var l=this._names.indexOf(t);l<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var l=this._names.indexOf(t);l>=0&&(this._names.splice(l,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Wx(t,l){for(var r=kh(t),i=-1,s=l.length;++i=0&&(r=l.slice(i+1),l=l.slice(0,i)),{type:l,name:r}})}function lN(t){return function(){var l=this.__on;if(l){for(var r=0,i=-1,s=l.length,u;r()=>t;function hh(t,{sourceEvent:l,subject:r,target:i,identifier:s,active:u,x:c,y:d,dx:h,dy:m,dispatch:y}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:l,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:u,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:d,enumerable:!0,configurable:!0},dx:{value:h,enumerable:!0,configurable:!0},dy:{value:m,enumerable:!0,configurable:!0},_:{value:y}})}hh.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function gN(t){return!t.ctrlKey&&!t.button}function pN(){return this.parentNode}function mN(t,l){return l??{x:t.x,y:t.y}}function yN(){return navigator.maxTouchPoints||"ontouchstart"in this}function lb(){var t=gN,l=pN,r=mN,i=yN,s={},u=fu("start","drag","end"),c=0,d,h,m,y,g=0;function v(z){z.on("mousedown.drag",x).filter(i).on("touchstart.drag",_).on("touchmove.drag",E,hN).on("touchend.drag touchcancel.drag",M).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(z,k){if(!(y||!t.call(this,z,k))){var R=S(this,l.call(this,z,k),z,k,"mouse");R&&(It(z.view).on("mousemove.drag",w,qi).on("mouseup.drag",N,qi),nb(z.view),ed(z),m=!1,d=z.clientX,h=z.clientY,R("start",z))}}function w(z){if(xr(z),!m){var k=z.clientX-d,R=z.clientY-h;m=k*k+R*R>g}s.mouse("drag",z)}function N(z){It(z.view).on("mousemove.drag mouseup.drag",null),ab(z.view,m),xr(z),s.mouse("end",z)}function _(z,k){if(t.call(this,z,k)){var R=z.changedTouches,H=l.call(this,z,k),D=R.length,q,Z;for(q=0;q>8&15|l>>4&240,l>>4&15|l&240,(l&15)<<4|l&15,1):r===8?Ts(l>>24&255,l>>16&255,l>>8&255,(l&255)/255):r===4?Ts(l>>12&15|l>>8&240,l>>8&15|l>>4&240,l>>4&15|l&240,((l&15)<<4|l&15)/255):null):(l=xN.exec(t))?new qt(l[1],l[2],l[3],1):(l=bN.exec(t))?new qt(l[1]*255/100,l[2]*255/100,l[3]*255/100,1):(l=wN.exec(t))?Ts(l[1],l[2],l[3],l[4]):(l=_N.exec(t))?Ts(l[1]*255/100,l[2]*255/100,l[3]*255/100,l[4]):(l=SN.exec(t))?py(l[1],l[2]/100,l[3]/100,1):(l=EN.exec(t))?py(l[1],l[2]/100,l[3]/100,l[4]):uy.hasOwnProperty(t)?dy(uy[t]):t==="transparent"?new qt(NaN,NaN,NaN,0):null}function dy(t){return new qt(t>>16&255,t>>8&255,t&255,1)}function Ts(t,l,r,i){return i<=0&&(t=l=r=NaN),new qt(t,l,r,i)}function zN(t){return t instanceof Ji||(t=vl(t)),t?(t=t.rgb(),new qt(t.r,t.g,t.b,t.opacity)):new qt}function gh(t,l,r,i){return arguments.length===1?zN(t):new qt(t,l,r,i??1)}function qt(t,l,r,i){this.r=+t,this.g=+l,this.b=+r,this.opacity=+i}Hh(qt,gh,rb(Ji,{brighter(t){return t=t==null?Is:Math.pow(Is,t),new qt(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Ui:Math.pow(Ui,t),new qt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new qt(pl(this.r),pl(this.g),pl(this.b),Js(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:hy,formatHex:hy,formatHex8:MN,formatRgb:gy,toString:gy}));function hy(){return`#${hl(this.r)}${hl(this.g)}${hl(this.b)}`}function MN(){return`#${hl(this.r)}${hl(this.g)}${hl(this.b)}${hl((isNaN(this.opacity)?1:this.opacity)*255)}`}function gy(){const t=Js(this.opacity);return`${t===1?"rgb(":"rgba("}${pl(this.r)}, ${pl(this.g)}, ${pl(this.b)}${t===1?")":`, ${t})`}`}function Js(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function pl(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function hl(t){return t=pl(t),(t<16?"0":"")+t.toString(16)}function py(t,l,r,i){return i<=0?t=l=r=NaN:r<=0||r>=1?t=l=NaN:l<=0&&(t=NaN),new dn(t,l,r,i)}function ib(t){if(t instanceof dn)return new dn(t.h,t.s,t.l,t.opacity);if(t instanceof Ji||(t=vl(t)),!t)return new dn;if(t instanceof dn)return t;t=t.rgb();var l=t.r/255,r=t.g/255,i=t.b/255,s=Math.min(l,r,i),u=Math.max(l,r,i),c=NaN,d=u-s,h=(u+s)/2;return d?(l===u?c=(r-i)/d+(r0&&h<1?0:c,new dn(c,d,h,t.opacity)}function AN(t,l,r,i){return arguments.length===1?ib(t):new dn(t,l,r,i??1)}function dn(t,l,r,i){this.h=+t,this.s=+l,this.l=+r,this.opacity=+i}Hh(dn,AN,rb(Ji,{brighter(t){return t=t==null?Is:Math.pow(Is,t),new dn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Ui:Math.pow(Ui,t),new dn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,l=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*l,s=2*r-i;return new qt(td(t>=240?t-240:t+120,s,i),td(t,s,i),td(t<120?t+240:t-120,s,i),this.opacity)},clamp(){return new dn(my(this.h),Os(this.s),Os(this.l),Js(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 t=Js(this.opacity);return`${t===1?"hsl(":"hsla("}${my(this.h)}, ${Os(this.s)*100}%, ${Os(this.l)*100}%${t===1?")":`, ${t})`}`}}));function my(t){return t=(t||0)%360,t<0?t+360:t}function Os(t){return Math.max(0,Math.min(1,t||0))}function td(t,l,r){return(t<60?l+(r-l)*t/60:t<180?r:t<240?l+(r-l)*(240-t)/60:l)*255}const Lh=t=>()=>t;function TN(t,l){return function(r){return t+r*l}}function ON(t,l,r){return t=Math.pow(t,r),l=Math.pow(l,r)-t,r=1/r,function(i){return Math.pow(t+i*l,r)}}function jN(t){return(t=+t)==1?ob:function(l,r){return r-l?ON(l,r,t):Lh(isNaN(l)?r:l)}}function ob(t,l){var r=l-t;return r?TN(t,r):Lh(isNaN(t)?l:t)}const Fs=(function t(l){var r=jN(l);function i(s,u){var c=r((s=gh(s)).r,(u=gh(u)).r),d=r(s.g,u.g),h=r(s.b,u.b),m=ob(s.opacity,u.opacity);return function(y){return s.r=c(y),s.g=d(y),s.b=h(y),s.opacity=m(y),s+""}}return i.gamma=t,i})(1);function RN(t,l){l||(l=[]);var r=t?Math.min(l.length,t.length):0,i=l.slice(),s;return function(u){for(s=0;sr&&(u=l.slice(r,u),d[c]?d[c]+=u:d[++c]=u),(i=i[0])===(s=s[0])?d[c]?d[c]+=s:d[++c]=s:(d[++c]=null,h.push({i:c,x:Nn(i,s)})),r=nd.lastIndex;return r180?y+=360:y-m>180&&(m+=360),v.push({i:g.push(s(g)+"rotate(",null,i)-2,x:Nn(m,y)})):y&&g.push(s(g)+"rotate("+y+i)}function d(m,y,g,v){m!==y?v.push({i:g.push(s(g)+"skewX(",null,i)-2,x:Nn(m,y)}):y&&g.push(s(g)+"skewX("+y+i)}function h(m,y,g,v,x,w){if(m!==g||y!==v){var N=x.push(s(x)+"scale(",null,",",null,")");w.push({i:N-4,x:Nn(m,g)},{i:N-2,x:Nn(y,v)})}else(g!==1||v!==1)&&x.push(s(x)+"scale("+g+","+v+")")}return function(m,y){var g=[],v=[];return m=t(m),y=t(y),u(m.translateX,m.translateY,y.translateX,y.translateY,g,v),c(m.rotate,y.rotate,g,v),d(m.skewX,y.skewX,g,v),h(m.scaleX,m.scaleY,y.scaleX,y.scaleY,g,v),m=y=null,function(x){for(var w=-1,N=v.length,_;++w=0&&t._call.call(void 0,l),t=t._next;--_r}function xy(){xl=(Ps=Vi.now())+hu,_r=ji=0;try{KN()}finally{_r=0,JN(),xl=0}}function IN(){var t=Vi.now(),l=t-Ps;l>fb&&(hu-=l,Ps=t)}function JN(){for(var t,l=Ws,r,i=1/0;l;)l._call?(i>l._time&&(i=l._time),t=l,l=l._next):(r=l._next,l._next=null,l=t?t._next=r:Ws=r);Ri=t,yh(i)}function yh(t){if(!_r){ji&&(ji=clearTimeout(ji));var l=t-xl;l>24?(t<1/0&&(ji=setTimeout(xy,t-Vi.now()-hu)),zi&&(zi=clearInterval(zi))):(zi||(Ps=Vi.now(),zi=setInterval(IN,fb)),_r=1,db(xy))}}function by(t,l,r){var i=new eu;return l=l==null?0:+l,i.restart(s=>{i.stop(),t(s+l)},l,r),i}var FN=fu("start","end","cancel","interrupt"),WN=[],gb=0,wy=1,vh=2,Vs=3,_y=4,xh=5,Ys=6;function gu(t,l,r,i,s,u){var c=t.__transition;if(!c)t.__transition={};else if(r in c)return;PN(t,r,{name:l,index:i,group:s,on:FN,tween:WN,time:u.time,delay:u.delay,duration:u.duration,ease:u.ease,timer:null,state:gb})}function qh(t,l){var r=yn(t,l);if(r.state>gb)throw new Error("too late; already scheduled");return r}function Mn(t,l){var r=yn(t,l);if(r.state>Vs)throw new Error("too late; already running");return r}function yn(t,l){var r=t.__transition;if(!r||!(r=r[l]))throw new Error("transition not found");return r}function PN(t,l,r){var i=t.__transition,s;i[l]=r,r.timer=hb(u,0,r.time);function u(m){r.state=wy,r.timer.restart(c,r.delay,r.time),r.delay<=m&&c(m-r.delay)}function c(m){var y,g,v,x;if(r.state!==wy)return h();for(y in i)if(x=i[y],x.name===r.name){if(x.state===Vs)return by(c);x.state===_y?(x.state=Ys,x.timer.stop(),x.on.call("interrupt",t,t.__data__,x.index,x.group),delete i[y]):+yvh&&i.state=0&&(l=l.slice(0,r)),!l||l==="start"})}function AC(t,l,r){var i,s,u=MC(l)?qh:Mn;return function(){var c=u(this,t),d=c.on;d!==i&&(s=(i=d).copy()).on(l,r),c.on=s}}function TC(t,l){var r=this._id;return arguments.length<2?yn(this.node(),r).on.on(t):this.each(AC(r,t,l))}function OC(t){return function(){var l=this.parentNode;for(var r in this.__transition)if(+r!==t)return;l&&l.removeChild(this)}}function jC(){return this.on("end.remove",OC(this._id))}function RC(t){var l=this._name,r=this._id;typeof t!="function"&&(t=Dh(t));for(var i=this._groups,s=i.length,u=new Array(s),c=0;c()=>t;function lz(t,{sourceEvent:l,target:r,transform:i,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:l,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:s}})}function ta(t,l,r){this.k=t,this.x=l,this.y=r}ta.prototype={constructor:ta,scale:function(t){return t===1?this:new ta(this.k*t,this.x,this.y)},translate:function(t,l){return t===0&l===0?this:new ta(this.k,this.x+this.k*t,this.y+this.k*l)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var pu=new ta(1,0,0);vb.prototype=ta.prototype;function vb(t){for(;!t.__zoom;)if(!(t=t.parentNode))return pu;return t.__zoom}function ad(t){t.stopImmediatePropagation()}function Mi(t){t.preventDefault(),t.stopImmediatePropagation()}function rz(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function iz(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Sy(){return this.__zoom||pu}function oz(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function sz(){return navigator.maxTouchPoints||"ontouchstart"in this}function uz(t,l,r){var i=t.invertX(l[0][0])-r[0][0],s=t.invertX(l[1][0])-r[1][0],u=t.invertY(l[0][1])-r[0][1],c=t.invertY(l[1][1])-r[1][1];return t.translate(s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s),c>u?(u+c)/2:Math.min(0,u)||Math.max(0,c))}function xb(){var t=rz,l=iz,r=uz,i=oz,s=sz,u=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],d=250,h=Gs,m=fu("start","zoom","end"),y,g,v,x=500,w=150,N=0,_=10;function E(B){B.property("__zoom",Sy).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",q).on("dblclick.zoom",Z).filter(s).on("touchstart.zoom",U).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",te).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(B,J,T,Y){var K=B.selection?B.selection():B;K.property("__zoom",Sy),B!==K?k(B,J,T,Y):K.interrupt().each(function(){R(this,arguments).event(Y).start().zoom(null,typeof J=="function"?J.apply(this,arguments):J).end()})},E.scaleBy=function(B,J,T,Y){E.scaleTo(B,function(){var K=this.__zoom.k,I=typeof J=="function"?J.apply(this,arguments):J;return K*I},T,Y)},E.scaleTo=function(B,J,T,Y){E.transform(B,function(){var K=l.apply(this,arguments),I=this.__zoom,ie=T==null?z(K):typeof T=="function"?T.apply(this,arguments):T,O=I.invert(ie),X=typeof J=="function"?J.apply(this,arguments):J;return r(S(M(I,X),ie,O),K,c)},T,Y)},E.translateBy=function(B,J,T,Y){E.transform(B,function(){return r(this.__zoom.translate(typeof J=="function"?J.apply(this,arguments):J,typeof T=="function"?T.apply(this,arguments):T),l.apply(this,arguments),c)},null,Y)},E.translateTo=function(B,J,T,Y,K){E.transform(B,function(){var I=l.apply(this,arguments),ie=this.__zoom,O=Y==null?z(I):typeof Y=="function"?Y.apply(this,arguments):Y;return r(pu.translate(O[0],O[1]).scale(ie.k).translate(typeof J=="function"?-J.apply(this,arguments):-J,typeof T=="function"?-T.apply(this,arguments):-T),I,c)},Y,K)};function M(B,J){return J=Math.max(u[0],Math.min(u[1],J)),J===B.k?B:new ta(J,B.x,B.y)}function S(B,J,T){var Y=J[0]-T[0]*B.k,K=J[1]-T[1]*B.k;return Y===B.x&&K===B.y?B:new ta(B.k,Y,K)}function z(B){return[(+B[0][0]+ +B[1][0])/2,(+B[0][1]+ +B[1][1])/2]}function k(B,J,T,Y){B.on("start.zoom",function(){R(this,arguments).event(Y).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(Y).end()}).tween("zoom",function(){var K=this,I=arguments,ie=R(K,I).event(Y),O=l.apply(K,I),X=T==null?z(O):typeof T=="function"?T.apply(K,I):T,j=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),G=K.__zoom,$=typeof J=="function"?J.apply(K,I):J,W=h(G.invert(X).concat(j/G.k),$.invert(X).concat(j/$.k));return function(ee){if(ee===1)ee=$;else{var ne=W(ee),ue=j/ne[2];ee=new ta(ue,X[0]-ne[0]*ue,X[1]-ne[1]*ue)}ie.zoom(null,ee)}})}function R(B,J,T){return!T&&B.__zooming||new H(B,J)}function H(B,J){this.that=B,this.args=J,this.active=0,this.sourceEvent=null,this.extent=l.apply(B,J),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,J){return this.mouse&&B!=="mouse"&&(this.mouse[1]=J.invert(this.mouse[0])),this.touch0&&B!=="touch"&&(this.touch0[1]=J.invert(this.touch0[0])),this.touch1&&B!=="touch"&&(this.touch1[1]=J.invert(this.touch1[0])),this.that.__zoom=J,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(B){var J=It(this.that).datum();m.call(B,this.that,new lz(B,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:m}),J)}};function D(B,...J){if(!t.apply(this,arguments))return;var T=R(this,J).event(B),Y=this.__zoom,K=Math.max(u[0],Math.min(u[1],Y.k*Math.pow(2,i.apply(this,arguments)))),I=fn(B);if(T.wheel)(T.mouse[0][0]!==I[0]||T.mouse[0][1]!==I[1])&&(T.mouse[1]=Y.invert(T.mouse[0]=I)),clearTimeout(T.wheel);else{if(Y.k===K)return;T.mouse=[I,Y.invert(I)],Xs(this),T.start()}Mi(B),T.wheel=setTimeout(ie,w),T.zoom("mouse",r(S(M(Y,K),T.mouse[0],T.mouse[1]),T.extent,c));function ie(){T.wheel=null,T.end()}}function q(B,...J){if(v||!t.apply(this,arguments))return;var T=B.currentTarget,Y=R(this,J,!0).event(B),K=It(B.view).on("mousemove.zoom",X,!0).on("mouseup.zoom",j,!0),I=fn(B,T),ie=B.clientX,O=B.clientY;nb(B.view),ad(B),Y.mouse=[I,this.__zoom.invert(I)],Xs(this),Y.start();function X(G){if(Mi(G),!Y.moved){var $=G.clientX-ie,W=G.clientY-O;Y.moved=$*$+W*W>N}Y.event(G).zoom("mouse",r(S(Y.that.__zoom,Y.mouse[0]=fn(G,T),Y.mouse[1]),Y.extent,c))}function j(G){K.on("mousemove.zoom mouseup.zoom",null),ab(G.view,Y.moved),Mi(G),Y.event(G).end()}}function Z(B,...J){if(t.apply(this,arguments)){var T=this.__zoom,Y=fn(B.changedTouches?B.changedTouches[0]:B,this),K=T.invert(Y),I=T.k*(B.shiftKey?.5:2),ie=r(S(M(T,I),Y,K),l.apply(this,J),c);Mi(B),d>0?It(this).transition().duration(d).call(k,ie,Y,B):It(this).call(E.transform,ie,Y,B)}}function U(B,...J){if(t.apply(this,arguments)){var T=B.touches,Y=T.length,K=R(this,J,B.changedTouches.length===Y).event(B),I,ie,O,X;for(ad(B),ie=0;ie"[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:t=>`Node type "${t}" 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:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:l,sourceHandle:r,targetHandle:i})=>`Couldn't create edge for ${t} handle id: "${t==="source"?r:i}", edge id: ${l}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/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."},Yi=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],bb=["Enter"," ","Escape"],wb={"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:t,x:l,y:r})=>`Moved selected node ${t}. New position, x: ${l}, 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 Sr;(function(t){t.Strict="strict",t.Loose="loose"})(Sr||(Sr={}));var ml;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(ml||(ml={}));var Xi;(function(t){t.Partial="partial",t.Full="full"})(Xi||(Xi={}));const _b={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ua;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(Ua||(Ua={}));var tu;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(tu||(tu={}));var me;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(me||(me={}));const Ey={[me.Left]:me.Right,[me.Right]:me.Left,[me.Top]:me.Bottom,[me.Bottom]:me.Top};function Sb(t){return t===null?null:t?"valid":"invalid"}const Eb=t=>"id"in t&&"source"in t&&"target"in t,cz=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),Gh=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),Fi=(t,l=[0,0])=>{const{width:r,height:i}=la(t),s=t.origin??l,u=r*s[0],c=i*s[1];return{x:t.position.x-u,y:t.position.y-c}},fz=(t,l={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const r=t.reduce((i,s)=>{const u=typeof s=="string";let c=!l.nodeLookup&&!u?s:void 0;l.nodeLookup&&(c=u?l.nodeLookup.get(s):Gh(s)?s:l.nodeLookup.get(s.id));const d=c?nu(c,l.nodeOrigin):{x:0,y:0,x2:0,y2:0};return mu(i,d)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return yu(r)},Wi=(t,l={})=>{let r={x:1/0,y:1/0,x2:-1/0,y2:-1/0},i=!1;return t.forEach(s=>{(l.filter===void 0||l.filter(s))&&(r=mu(r,nu(s)),i=!0)}),i?yu(r):{x:0,y:0,width:0,height:0}},Vh=(t,l,[r,i,s]=[0,0,1],u=!1,c=!1)=>{const d={...eo(l,[r,i,s]),width:l.width/s,height:l.height/s},h=[];for(const m of t.values()){const{measured:y,selectable:g=!0,hidden:v=!1}=m;if(c&&!g||v)continue;const x=y.width??m.width??m.initialWidth??null,w=y.height??m.height??m.initialHeight??null,N=$i(d,Nr(m)),_=(x??0)*(w??0),E=u&&N>0;(!m.internals.handleBounds||E||N>=_||m.dragging)&&h.push(m)}return h},dz=(t,l)=>{const r=new Set;return t.forEach(i=>{r.add(i.id)}),l.filter(i=>r.has(i.source)||r.has(i.target))};function hz(t,l){const r=new Map,i=l!=null&&l.nodes?new Set(l.nodes.map(s=>s.id)):null;return t.forEach(s=>{s.measured.width&&s.measured.height&&((l==null?void 0:l.includeHiddenNodes)||!s.hidden)&&(!i||i.has(s.id))&&r.set(s.id,s)}),r}async function gz({nodes:t,width:l,height:r,panZoom:i,minZoom:s,maxZoom:u},c){if(t.size===0)return Promise.resolve(!0);const d=hz(t,c),h=Wi(d),m=Yh(h,l,r,(c==null?void 0:c.minZoom)??s,(c==null?void 0:c.maxZoom)??u,(c==null?void 0:c.padding)??.1);return await i.setViewport(m,{duration:c==null?void 0:c.duration,ease:c==null?void 0:c.ease,interpolate:c==null?void 0:c.interpolate}),Promise.resolve(!0)}function Nb({nodeId:t,nextPosition:l,nodeLookup:r,nodeOrigin:i=[0,0],nodeExtent:s,onError:u}){const c=r.get(t),d=c.parentId?r.get(c.parentId):void 0,{x:h,y:m}=d?d.internals.positionAbsolute:{x:0,y:0},y=c.origin??i;let g=c.extent||s;if(c.extent==="parent"&&!c.expandParent)if(!d)u==null||u("005",zn.error005());else{const x=d.measured.width,w=d.measured.height;x&&w&&(g=[[h,m],[h+x,m+w]])}else d&&Cr(c.extent)&&(g=[[c.extent[0][0]+h,c.extent[0][1]+m],[c.extent[1][0]+h,c.extent[1][1]+m]]);const v=Cr(g)?bl(l,g,c.measured):l;return(c.measured.width===void 0||c.measured.height===void 0)&&(u==null||u("015",zn.error015())),{position:{x:v.x-h+(c.measured.width??0)*y[0],y:v.y-m+(c.measured.height??0)*y[1]},positionAbsolute:v}}async function pz({nodesToRemove:t=[],edgesToRemove:l=[],nodes:r,edges:i,onBeforeDelete:s}){const u=new Set(t.map(v=>v.id)),c=[];for(const v of r){if(v.deletable===!1)continue;const x=u.has(v.id),w=!x&&v.parentId&&c.find(N=>N.id===v.parentId);(x||w)&&c.push(v)}const d=new Set(l.map(v=>v.id)),h=i.filter(v=>v.deletable!==!1),y=dz(c,h);for(const v of h)d.has(v.id)&&!y.find(w=>w.id===v.id)&&y.push(v);if(!s)return{edges:y,nodes:c};const g=await s({nodes:c,edges:y});return typeof g=="boolean"?g?{edges:y,nodes:c}:{edges:[],nodes:[]}:g}const Er=(t,l=0,r=1)=>Math.min(Math.max(t,l),r),bl=(t={x:0,y:0},l,r)=>({x:Er(t.x,l[0][0],l[1][0]-((r==null?void 0:r.width)??0)),y:Er(t.y,l[0][1],l[1][1]-((r==null?void 0:r.height)??0))});function Cb(t,l,r){const{width:i,height:s}=la(r),{x:u,y:c}=r.internals.positionAbsolute;return bl(t,[[u,c],[u+i,c+s]],l)}const Ny=(t,l,r)=>tr?-Er(Math.abs(t-r),1,l)/l:0,zb=(t,l,r=15,i=40)=>{const s=Ny(t.x,i,l.width-i)*r,u=Ny(t.y,i,l.height-i)*r;return[s,u]},mu=(t,l)=>({x:Math.min(t.x,l.x),y:Math.min(t.y,l.y),x2:Math.max(t.x2,l.x2),y2:Math.max(t.y2,l.y2)}),bh=({x:t,y:l,width:r,height:i})=>({x:t,y:l,x2:t+r,y2:l+i}),yu=({x:t,y:l,x2:r,y2:i})=>({x:t,y:l,width:r-t,height:i-l}),Nr=(t,l=[0,0])=>{var s,u;const{x:r,y:i}=Gh(t)?t.internals.positionAbsolute:Fi(t,l);return{x:r,y:i,width:((s=t.measured)==null?void 0:s.width)??t.width??t.initialWidth??0,height:((u=t.measured)==null?void 0:u.height)??t.height??t.initialHeight??0}},nu=(t,l=[0,0])=>{var s,u;const{x:r,y:i}=Gh(t)?t.internals.positionAbsolute:Fi(t,l);return{x:r,y:i,x2:r+(((s=t.measured)==null?void 0:s.width)??t.width??t.initialWidth??0),y2:i+(((u=t.measured)==null?void 0:u.height)??t.height??t.initialHeight??0)}},Mb=(t,l)=>yu(mu(bh(t),bh(l))),$i=(t,l)=>{const r=Math.max(0,Math.min(t.x+t.width,l.x+l.width)-Math.max(t.x,l.x)),i=Math.max(0,Math.min(t.y+t.height,l.y+l.height)-Math.max(t.y,l.y));return Math.ceil(r*i)},Cy=t=>hn(t.width)&&hn(t.height)&&hn(t.x)&&hn(t.y),hn=t=>!isNaN(t)&&isFinite(t),mz=(t,l)=>{},Pi=(t,l=[1,1])=>({x:l[0]*Math.round(t.x/l[0]),y:l[1]*Math.round(t.y/l[1])}),eo=({x:t,y:l},[r,i,s],u=!1,c=[1,1])=>{const d={x:(t-r)/s,y:(l-i)/s};return u?Pi(d,c):d},au=({x:t,y:l},[r,i,s])=>({x:t*s+r,y:l*s+i});function cr(t,l){if(typeof t=="number")return Math.floor((l-l/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const r=parseFloat(t);if(!Number.isNaN(r))return Math.floor(r)}if(typeof t=="string"&&t.endsWith("%")){const r=parseFloat(t);if(!Number.isNaN(r))return Math.floor(l*r*.01)}return console.error(`[React Flow] The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function yz(t,l,r){if(typeof t=="string"||typeof t=="number"){const i=cr(t,r),s=cr(t,l);return{top:i,right:s,bottom:i,left:s,x:s*2,y:i*2}}if(typeof t=="object"){const i=cr(t.top??t.y??0,r),s=cr(t.bottom??t.y??0,r),u=cr(t.left??t.x??0,l),c=cr(t.right??t.x??0,l);return{top:i,right:c,bottom:s,left:u,x:u+c,y:i+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function vz(t,l,r,i,s,u){const{x:c,y:d}=au(t,[l,r,i]),{x:h,y:m}=au({x:t.x+t.width,y:t.y+t.height},[l,r,i]),y=s-h,g=u-m;return{left:Math.floor(c),top:Math.floor(d),right:Math.floor(y),bottom:Math.floor(g)}}const Yh=(t,l,r,i,s,u)=>{const c=yz(u,l,r),d=(l-c.x)/t.width,h=(r-c.y)/t.height,m=Math.min(d,h),y=Er(m,i,s),g=t.x+t.width/2,v=t.y+t.height/2,x=l/2-g*y,w=r/2-v*y,N=vz(t,x,w,y,l,r),_={left:Math.min(N.left-c.left,0),top:Math.min(N.top-c.top,0),right:Math.min(N.right-c.right,0),bottom:Math.min(N.bottom-c.bottom,0)};return{x:x-_.left+_.right,y:w-_.top+_.bottom,zoom:y}},Qi=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function Cr(t){return t!=null&&t!=="parent"}function la(t){var l,r;return{width:((l=t.measured)==null?void 0:l.width)??t.width??t.initialWidth??0,height:((r=t.measured)==null?void 0:r.height)??t.height??t.initialHeight??0}}function Ab(t){var l,r;return(((l=t.measured)==null?void 0:l.width)??t.width??t.initialWidth)!==void 0&&(((r=t.measured)==null?void 0:r.height)??t.height??t.initialHeight)!==void 0}function Tb(t,l={width:0,height:0},r,i,s){const u={...t},c=i.get(r);if(c){const d=c.origin||s;u.x+=c.internals.positionAbsolute.x-(l.width??0)*d[0],u.y+=c.internals.positionAbsolute.y-(l.height??0)*d[1]}return u}function zy(t,l){if(t.size!==l.size)return!1;for(const r of t)if(!l.has(r))return!1;return!0}function xz(){let t,l;return{promise:new Promise((i,s)=>{t=i,l=s}),resolve:t,reject:l}}function bz(t){return{...wb,...t||{}}}function Hi(t,{snapGrid:l=[0,0],snapToGrid:r=!1,transform:i,containerBounds:s}){const{x:u,y:c}=gn(t),d=eo({x:u-((s==null?void 0:s.left)??0),y:c-((s==null?void 0:s.top)??0)},i),{x:h,y:m}=r?Pi(d,l):d;return{xSnapped:h,ySnapped:m,...d}}const Xh=t=>({width:t.offsetWidth,height:t.offsetHeight}),Ob=t=>{var l;return((l=t==null?void 0:t.getRootNode)==null?void 0:l.call(t))||(window==null?void 0:window.document)},wz=["INPUT","SELECT","TEXTAREA"];function jb(t){var i,s;const l=((s=(i=t.composedPath)==null?void 0:i.call(t))==null?void 0:s[0])||t.target;return(l==null?void 0:l.nodeType)!==1?!1:wz.includes(l.nodeName)||l.hasAttribute("contenteditable")||!!l.closest(".nokey")}const Rb=t=>"clientX"in t,gn=(t,l)=>{var u,c;const r=Rb(t),i=r?t.clientX:(u=t.touches)==null?void 0:u[0].clientX,s=r?t.clientY:(c=t.touches)==null?void 0:c[0].clientY;return{x:i-((l==null?void 0:l.left)??0),y:s-((l==null?void 0:l.top)??0)}},My=(t,l,r,i,s)=>{const u=l.querySelectorAll(`.${t}`);return!u||!u.length?null:Array.from(u).map(c=>{const d=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),type:t,nodeId:s,position:c.getAttribute("data-handlepos"),x:(d.left-r.left)/i,y:(d.top-r.top)/i,...Xh(c)}})};function Db({sourceX:t,sourceY:l,targetX:r,targetY:i,sourceControlX:s,sourceControlY:u,targetControlX:c,targetControlY:d}){const h=t*.125+s*.375+c*.375+r*.125,m=l*.125+u*.375+d*.375+i*.125,y=Math.abs(h-t),g=Math.abs(m-l);return[h,m,y,g]}function Ds(t,l){return t>=0?.5*t:l*25*Math.sqrt(-t)}function Ay({pos:t,x1:l,y1:r,x2:i,y2:s,c:u}){switch(t){case me.Left:return[l-Ds(l-i,u),r];case me.Right:return[l+Ds(i-l,u),r];case me.Top:return[l,r-Ds(r-s,u)];case me.Bottom:return[l,r+Ds(s-r,u)]}}function $h({sourceX:t,sourceY:l,sourcePosition:r=me.Bottom,targetX:i,targetY:s,targetPosition:u=me.Top,curvature:c=.25}){const[d,h]=Ay({pos:r,x1:t,y1:l,x2:i,y2:s,c}),[m,y]=Ay({pos:u,x1:i,y1:s,x2:t,y2:l,c}),[g,v,x,w]=Db({sourceX:t,sourceY:l,targetX:i,targetY:s,sourceControlX:d,sourceControlY:h,targetControlX:m,targetControlY:y});return[`M${t},${l} C${d},${h} ${m},${y} ${i},${s}`,g,v,x,w]}function kb({sourceX:t,sourceY:l,targetX:r,targetY:i}){const s=Math.abs(r-t)/2,u=r0}const Ez=({source:t,sourceHandle:l,target:r,targetHandle:i})=>`xy-edge__${t}${l||""}-${r}${i||""}`,Nz=(t,l)=>l.some(r=>r.source===t.source&&r.target===t.target&&(r.sourceHandle===t.sourceHandle||!r.sourceHandle&&!t.sourceHandle)&&(r.targetHandle===t.targetHandle||!r.targetHandle&&!t.targetHandle)),Cz=(t,l,r={})=>{if(!t.source||!t.target)return l;const i=r.getEdgeId||Ez;let s;return Eb(t)?s={...t}:s={...t,id:i(t)},Nz(s,l)?l:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,l.concat(s))};function Hb({sourceX:t,sourceY:l,targetX:r,targetY:i}){const[s,u,c,d]=kb({sourceX:t,sourceY:l,targetX:r,targetY:i});return[`M ${t},${l}L ${r},${i}`,s,u,c,d]}const Ty={[me.Left]:{x:-1,y:0},[me.Right]:{x:1,y:0},[me.Top]:{x:0,y:-1},[me.Bottom]:{x:0,y:1}},zz=({source:t,sourcePosition:l=me.Bottom,target:r})=>l===me.Left||l===me.Right?t.xMath.sqrt(Math.pow(l.x-t.x,2)+Math.pow(l.y-t.y,2));function Mz({source:t,sourcePosition:l=me.Bottom,target:r,targetPosition:i=me.Top,center:s,offset:u,stepPosition:c}){const d=Ty[l],h=Ty[i],m={x:t.x+d.x*u,y:t.y+d.y*u},y={x:r.x+h.x*u,y:r.y+h.y*u},g=zz({source:m,sourcePosition:l,target:y}),v=g.x!==0?"x":"y",x=g[v];let w=[],N,_;const E={x:0,y:0},M={x:0,y:0},[,,S,z]=kb({sourceX:t.x,sourceY:t.y,targetX:r.x,targetY:r.y});if(d[v]*h[v]===-1){v==="x"?(N=s.x??m.x+(y.x-m.x)*c,_=s.y??(m.y+y.y)/2):(N=s.x??(m.x+y.x)/2,_=s.y??m.y+(y.y-m.y)*c);const R=[{x:N,y:m.y},{x:N,y:y.y}],H=[{x:m.x,y:_},{x:y.x,y:_}];d[v]===x?w=v==="x"?R:H:w=v==="x"?H:R}else{const R=[{x:m.x,y:y.y}],H=[{x:y.x,y:m.y}];if(v==="x"?w=d.x===x?H:R:w=d.y===x?R:H,l===i){const L=Math.abs(t[v]-r[v]);if(L<=u){const te=Math.min(u-1,u-L);d[v]===x?E[v]=(m[v]>t[v]?-1:1)*te:M[v]=(y[v]>r[v]?-1:1)*te}}if(l!==i){const L=v==="x"?"y":"x",te=d[v]===h[L],B=m[L]>y[L],J=m[L]=U?(N=(D.x+q.x)/2,_=w[0].y):(N=w[0].x,_=(D.y+q.y)/2)}return[[t,{x:m.x+E.x,y:m.y+E.y},...w,{x:y.x+M.x,y:y.y+M.y},r],N,_,S,z]}function Az(t,l,r,i){const s=Math.min(Oy(t,l)/2,Oy(l,r)/2,i),{x:u,y:c}=l;if(t.x===u&&u===r.x||t.y===c&&c===r.y)return`L${u} ${c}`;if(t.y===c){const m=t.x{let z="";return S>0&&Sr.id===l):t[0])||null}function _h(t,l){return t?typeof t=="string"?t:`${l?`${l}__`:""}${Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("&")}`:""}function Oz(t,{id:l,defaultColor:r,defaultMarkerStart:i,defaultMarkerEnd:s}){const u=new Set;return t.reduce((c,d)=>([d.markerStart||i,d.markerEnd||s].forEach(h=>{if(h&&typeof h=="object"){const m=_h(h,l);u.has(m)||(c.push({id:m,color:h.color||r,...h}),u.add(m))}}),c),[]).sort((c,d)=>c.id.localeCompare(d.id))}const Lb=1e3,jz=10,Qh={nodeOrigin:[0,0],nodeExtent:Yi,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Rz={...Qh,checkEquality:!0};function Zh(t,l){const r={...t};for(const i in l)l[i]!==void 0&&(r[i]=l[i]);return r}function Dz(t,l,r){const i=Zh(Qh,r);for(const s of t.values())if(s.parentId)Ih(s,t,l,i);else{const u=Fi(s,i.nodeOrigin),c=Cr(s.extent)?s.extent:i.nodeExtent,d=bl(u,c,la(s));s.internals.positionAbsolute=d}}function kz(t,l){if(!t.handles)return t.measured?l==null?void 0:l.internals.handleBounds:void 0;const r=[],i=[];for(const s of t.handles){const u={id:s.id,width:s.width??1,height:s.height??1,nodeId:t.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?r.push(u):s.type==="target"&&i.push(u)}return{source:r,target:i}}function Kh(t){return t==="manual"}function Sh(t,l,r,i={}){var m,y;const s=Zh(Rz,i),u={i:0},c=new Map(l),d=s!=null&&s.elevateNodesOnSelect&&!Kh(s.zIndexMode)?Lb:0;let h=t.length>0;l.clear(),r.clear();for(const g of t){let v=c.get(g.id);if(s.checkEquality&&g===(v==null?void 0:v.internals.userNode))l.set(g.id,v);else{const x=Fi(g,s.nodeOrigin),w=Cr(g.extent)?g.extent:s.nodeExtent,N=bl(x,w,la(g));v={...s.defaults,...g,measured:{width:(m=g.measured)==null?void 0:m.width,height:(y=g.measured)==null?void 0:y.height},internals:{positionAbsolute:N,handleBounds:kz(g,v),z:Bb(g,d,s.zIndexMode),userNode:g}},l.set(g.id,v)}(v.measured===void 0||v.measured.width===void 0||v.measured.height===void 0)&&!v.hidden&&(h=!1),g.parentId&&Ih(v,l,r,i,u)}return h}function Hz(t,l){if(!t.parentId)return;const r=l.get(t.parentId);r?r.set(t.id,t):l.set(t.parentId,new Map([[t.id,t]]))}function Ih(t,l,r,i,s){const{elevateNodesOnSelect:u,nodeOrigin:c,nodeExtent:d,zIndexMode:h}=Zh(Qh,i),m=t.parentId,y=l.get(m);if(!y){console.warn(`Parent node ${m} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Hz(t,r),s&&!y.parentId&&y.internals.rootParentIndex===void 0&&h==="auto"&&(y.internals.rootParentIndex=++s.i,y.internals.z=y.internals.z+s.i*jz),s&&y.internals.rootParentIndex!==void 0&&(s.i=y.internals.rootParentIndex);const g=u&&!Kh(h)?Lb:0,{x:v,y:x,z:w}=Lz(t,y,c,d,g,h),{positionAbsolute:N}=t.internals,_=v!==N.x||x!==N.y;(_||w!==t.internals.z)&&l.set(t.id,{...t,internals:{...t.internals,positionAbsolute:_?{x:v,y:x}:N,z:w}})}function Bb(t,l,r){const i=hn(t.zIndex)?t.zIndex:0;return Kh(r)?i:i+(t.selected?l:0)}function Lz(t,l,r,i,s,u){const{x:c,y:d}=l.internals.positionAbsolute,h=la(t),m=Fi(t,r),y=Cr(t.extent)?bl(m,t.extent,h):m;let g=bl({x:c+y.x,y:d+y.y},i,h);t.extent==="parent"&&(g=Cb(g,h,l));const v=Bb(t,s,u),x=l.internals.z??0;return{x:g.x,y:g.y,z:x>=v?x+1:v}}function Jh(t,l,r,i=[0,0]){var c;const s=[],u=new Map;for(const d of t){const h=l.get(d.parentId);if(!h)continue;const m=((c=u.get(d.parentId))==null?void 0:c.expandedRect)??Nr(h),y=Mb(m,d.rect);u.set(d.parentId,{expandedRect:y,parent:h})}return u.size>0&&u.forEach(({expandedRect:d,parent:h},m)=>{var S;const y=h.internals.positionAbsolute,g=la(h),v=h.origin??i,x=d.x0||w>0||E||M)&&(s.push({id:m,type:"position",position:{x:h.position.x-x+E,y:h.position.y-w+M}}),(S=r.get(m))==null||S.forEach(z=>{t.some(k=>k.id===z.id)||s.push({id:z.id,type:"position",position:{x:z.position.x+x,y:z.position.y+w}})})),(g.width0){const x=Jh(v,l,r,s);m.push(...x)}return{changes:m,updatedInternals:h}}async function qz({delta:t,panZoom:l,transform:r,translateExtent:i,width:s,height:u}){if(!l||!t.x&&!t.y)return Promise.resolve(!1);const c=await l.setViewportConstrained({x:r[0]+t.x,y:r[1]+t.y,zoom:r[2]},[[0,0],[s,u]],i),d=!!c&&(c.x!==r[0]||c.y!==r[1]||c.k!==r[2]);return Promise.resolve(d)}function ky(t,l,r,i,s,u){let c=s;const d=i.get(c)||new Map;i.set(c,d.set(r,l)),c=`${s}-${t}`;const h=i.get(c)||new Map;if(i.set(c,h.set(r,l)),u){c=`${s}-${t}-${u}`;const m=i.get(c)||new Map;i.set(c,m.set(r,l))}}function qb(t,l,r){t.clear(),l.clear();for(const i of r){const{source:s,target:u,sourceHandle:c=null,targetHandle:d=null}=i,h={edgeId:i.id,source:s,target:u,sourceHandle:c,targetHandle:d},m=`${s}-${c}--${u}-${d}`,y=`${u}-${d}--${s}-${c}`;ky("source",h,y,t,s,c),ky("target",h,m,t,u,d),l.set(i.id,i)}}function Ub(t,l){if(!t.parentId)return!1;const r=l.get(t.parentId);return r?r.selected?!0:Ub(r,l):!1}function Hy(t,l,r){var s;let i=t;do{if((s=i==null?void 0:i.matches)!=null&&s.call(i,l))return!0;if(i===r)return!1;i=i==null?void 0:i.parentElement}while(i);return!1}function Uz(t,l,r,i){const s=new Map;for(const[u,c]of t)if((c.selected||c.id===i)&&(!c.parentId||!Ub(c,t))&&(c.draggable||l&&typeof c.draggable>"u")){const d=t.get(u);d&&s.set(u,{id:u,position:d.position||{x:0,y:0},distance:{x:r.x-d.internals.positionAbsolute.x,y:r.y-d.internals.positionAbsolute.y},extent:d.extent,parentId:d.parentId,origin:d.origin,expandParent:d.expandParent,internals:{positionAbsolute:d.internals.positionAbsolute||{x:0,y:0}},measured:{width:d.measured.width??0,height:d.measured.height??0}})}return s}function ld({nodeId:t,dragItems:l,nodeLookup:r,dragging:i=!0}){var c,d,h;const s=[];for(const[m,y]of l){const g=(c=r.get(m))==null?void 0:c.internals.userNode;g&&s.push({...g,position:y.position,dragging:i})}if(!t)return[s[0],s];const u=(d=r.get(t))==null?void 0:d.internals.userNode;return[u?{...u,position:((h=l.get(t))==null?void 0:h.position)||u.position,dragging:i}:s[0],s]}function Gz({dragItems:t,snapGrid:l,x:r,y:i}){const s=t.values().next().value;if(!s)return null;const u={x:r-s.distance.x,y:i-s.distance.y},c=Pi(u,l);return{x:c.x-u.x,y:c.y-u.y}}function Vz({onNodeMouseDown:t,getStoreItems:l,onDragStart:r,onDrag:i,onDragStop:s}){let u={x:null,y:null},c=0,d=new Map,h=!1,m={x:0,y:0},y=null,g=!1,v=null,x=!1,w=!1,N=null;function _({noDragClassName:M,handleSelector:S,domNode:z,isSelectable:k,nodeId:R,nodeClickDistance:H=0}){v=It(z);function D({x:L,y:te}){const{nodeLookup:B,nodeExtent:J,snapGrid:T,snapToGrid:Y,nodeOrigin:K,onNodeDrag:I,onSelectionDrag:ie,onError:O,updateNodePositions:X}=l();u={x:L,y:te};let j=!1;const G=d.size>1,$=G&&J?bh(Wi(d)):null,W=G&&Y?Gz({dragItems:d,snapGrid:T,x:L,y:te}):null;for(const[ee,ne]of d){if(!B.has(ee))continue;let ue={x:L-ne.distance.x,y:te-ne.distance.y};Y&&(ue=W?{x:Math.round(ue.x+W.x),y:Math.round(ue.y+W.y)}:Pi(ue,T));let he=null;if(G&&J&&!ne.extent&&$){const{positionAbsolute:de}=ne.internals,xe=de.x-$.x+J[0][0],Ae=de.x+ne.measured.width-$.x2+J[1][0],Se=de.y-$.y+J[0][1],We=de.y+ne.measured.height-$.y2+J[1][1];he=[[xe,Se],[Ae,We]]}const{position:ye,positionAbsolute:ge}=Nb({nodeId:ee,nextPosition:ue,nodeLookup:B,nodeExtent:he||J,nodeOrigin:K,onError:O});j=j||ne.position.x!==ye.x||ne.position.y!==ye.y,ne.position=ye,ne.internals.positionAbsolute=ge}if(w=w||j,!!j&&(X(d,!0),N&&(i||I||!R&&ie))){const[ee,ne]=ld({nodeId:R,dragItems:d,nodeLookup:B});i==null||i(N,d,ee,ne),I==null||I(N,ee,ne),R||ie==null||ie(N,ne)}}async function q(){if(!y)return;const{transform:L,panBy:te,autoPanSpeed:B,autoPanOnNodeDrag:J}=l();if(!J){h=!1,cancelAnimationFrame(c);return}const[T,Y]=zb(m,y,B);(T!==0||Y!==0)&&(u.x=(u.x??0)-T/L[2],u.y=(u.y??0)-Y/L[2],await te({x:T,y:Y})&&D(u)),c=requestAnimationFrame(q)}function Z(L){var G;const{nodeLookup:te,multiSelectionActive:B,nodesDraggable:J,transform:T,snapGrid:Y,snapToGrid:K,selectNodesOnDrag:I,onNodeDragStart:ie,onSelectionDragStart:O,unselectNodesAndEdges:X}=l();g=!0,(!I||!k)&&!B&&R&&((G=te.get(R))!=null&&G.selected||X()),k&&I&&R&&(t==null||t(R));const j=Hi(L.sourceEvent,{transform:T,snapGrid:Y,snapToGrid:K,containerBounds:y});if(u=j,d=Uz(te,J,j,R),d.size>0&&(r||ie||!R&&O)){const[$,W]=ld({nodeId:R,dragItems:d,nodeLookup:te});r==null||r(L.sourceEvent,d,$,W),ie==null||ie(L.sourceEvent,$,W),R||O==null||O(L.sourceEvent,W)}}const U=lb().clickDistance(H).on("start",L=>{const{domNode:te,nodeDragThreshold:B,transform:J,snapGrid:T,snapToGrid:Y}=l();y=(te==null?void 0:te.getBoundingClientRect())||null,x=!1,w=!1,N=L.sourceEvent,B===0&&Z(L),u=Hi(L.sourceEvent,{transform:J,snapGrid:T,snapToGrid:Y,containerBounds:y}),m=gn(L.sourceEvent,y)}).on("drag",L=>{const{autoPanOnNodeDrag:te,transform:B,snapGrid:J,snapToGrid:T,nodeDragThreshold:Y,nodeLookup:K}=l(),I=Hi(L.sourceEvent,{transform:B,snapGrid:J,snapToGrid:T,containerBounds:y});if(N=L.sourceEvent,(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1||R&&!K.has(R))&&(x=!0),!x){if(!h&&te&&g&&(h=!0,q()),!g){const ie=gn(L.sourceEvent,y),O=ie.x-m.x,X=ie.y-m.y;Math.sqrt(O*O+X*X)>Y&&Z(L)}(u.x!==I.xSnapped||u.y!==I.ySnapped)&&d&&g&&(m=gn(L.sourceEvent,y),D(I))}}).on("end",L=>{if(!(!g||x)&&(h=!1,g=!1,cancelAnimationFrame(c),d.size>0)){const{nodeLookup:te,updateNodePositions:B,onNodeDragStop:J,onSelectionDragStop:T}=l();if(w&&(B(d,!1),w=!1),s||J||!R&&T){const[Y,K]=ld({nodeId:R,dragItems:d,nodeLookup:te,dragging:!1});s==null||s(L.sourceEvent,d,Y,K),J==null||J(L.sourceEvent,Y,K),R||T==null||T(L.sourceEvent,K)}}}).filter(L=>{const te=L.target;return!L.button&&(!M||!Hy(te,`.${M}`,z))&&(!S||Hy(te,S,z))});v.call(U)}function E(){v==null||v.on(".drag",null)}return{update:_,destroy:E}}function Yz(t,l,r){const i=[],s={x:t.x-r,y:t.y-r,width:r*2,height:r*2};for(const u of l.values())$i(s,Nr(u))>0&&i.push(u);return i}const Xz=250;function $z(t,l,r,i){var d,h;let s=[],u=1/0;const c=Yz(t,r,l+Xz);for(const m of c){const y=[...((d=m.internals.handleBounds)==null?void 0:d.source)??[],...((h=m.internals.handleBounds)==null?void 0:h.target)??[]];for(const g of y){if(i.nodeId===g.nodeId&&i.type===g.type&&i.id===g.id)continue;const{x:v,y:x}=wl(m,g,g.position,!0),w=Math.sqrt(Math.pow(v-t.x,2)+Math.pow(x-t.y,2));w>l||(w1){const m=i.type==="source"?"target":"source";return s.find(y=>y.type===m)??s[0]}return s[0]}function Gb(t,l,r,i,s,u=!1){var m,y,g;const c=i.get(t);if(!c)return null;const d=s==="strict"?(m=c.internals.handleBounds)==null?void 0:m[l]:[...((y=c.internals.handleBounds)==null?void 0:y.source)??[],...((g=c.internals.handleBounds)==null?void 0:g.target)??[]],h=(r?d==null?void 0:d.find(v=>v.id===r):d==null?void 0:d[0])??null;return h&&u?{...h,...wl(c,h,h.position,!0)}:h}function Vb(t,l){return t||(l!=null&&l.classList.contains("target")?"target":l!=null&&l.classList.contains("source")?"source":null)}function Qz(t,l){let r=null;return l?r=!0:t&&!l&&(r=!1),r}const Yb=()=>!0;function Zz(t,{connectionMode:l,connectionRadius:r,handleId:i,nodeId:s,edgeUpdaterType:u,isTarget:c,domNode:d,nodeLookup:h,lib:m,autoPanOnConnect:y,flowId:g,panBy:v,cancelConnection:x,onConnectStart:w,onConnect:N,onConnectEnd:_,isValidConnection:E=Yb,onReconnectEnd:M,updateConnection:S,getTransform:z,getFromHandle:k,autoPanSpeed:R,dragThreshold:H=1,handleDomNode:D}){const q=Ob(t.target);let Z=0,U;const{x:L,y:te}=gn(t),B=Vb(u,D),J=d==null?void 0:d.getBoundingClientRect();let T=!1;if(!J||!B)return;const Y=Gb(s,B,i,h,l);if(!Y)return;let K=gn(t,J),I=!1,ie=null,O=!1,X=null;function j(){if(!y||!J)return;const[ye,ge]=zb(K,J,R);v({x:ye,y:ge}),Z=requestAnimationFrame(j)}const G={...Y,nodeId:s,type:B,position:Y.position},$=h.get(s);let ee={inProgress:!0,isValid:null,from:wl($,G,me.Left,!0),fromHandle:G,fromPosition:G.position,fromNode:$,to:K,toHandle:null,toPosition:Ey[G.position],toNode:null,pointer:K};function ne(){T=!0,S(ee),w==null||w(t,{nodeId:s,handleId:i,handleType:B})}H===0&&ne();function ue(ye){if(!T){const{x:We,y:$e}=gn(ye),Et=We-L,Ut=$e-te;if(!(Et*Et+Ut*Ut>H*H))return;ne()}if(!k()||!G){he(ye);return}const ge=z();K=gn(ye,J),U=$z(eo(K,ge,!1,[1,1]),r,h,G),I||(j(),I=!0);const de=Xb(ye,{handle:U,connectionMode:l,fromNodeId:s,fromHandleId:i,fromType:c?"target":"source",isValidConnection:E,doc:q,lib:m,flowId:g,nodeLookup:h});X=de.handleDomNode,ie=de.connection,O=Qz(!!U,de.isValid);const xe=h.get(s),Ae=xe?wl(xe,G,me.Left,!0):ee.from,Se={...ee,from:Ae,isValid:O,to:de.toHandle&&O?au({x:de.toHandle.x,y:de.toHandle.y},ge):K,toHandle:de.toHandle,toPosition:O&&de.toHandle?de.toHandle.position:Ey[G.position],toNode:de.toHandle?h.get(de.toHandle.nodeId):null,pointer:K};S(Se),ee=Se}function he(ye){if(!("touches"in ye&&ye.touches.length>0)){if(T){(U||X)&&ie&&O&&(N==null||N(ie));const{inProgress:ge,...de}=ee,xe={...de,toPosition:ee.toHandle?ee.toPosition:null};_==null||_(ye,xe),u&&(M==null||M(ye,xe))}x(),cancelAnimationFrame(Z),I=!1,O=!1,ie=null,X=null,q.removeEventListener("mousemove",ue),q.removeEventListener("mouseup",he),q.removeEventListener("touchmove",ue),q.removeEventListener("touchend",he)}}q.addEventListener("mousemove",ue),q.addEventListener("mouseup",he),q.addEventListener("touchmove",ue),q.addEventListener("touchend",he)}function Xb(t,{handle:l,connectionMode:r,fromNodeId:i,fromHandleId:s,fromType:u,doc:c,lib:d,flowId:h,isValidConnection:m=Yb,nodeLookup:y}){const g=u==="target",v=l?c.querySelector(`.${d}-flow__handle[data-id="${h}-${l==null?void 0:l.nodeId}-${l==null?void 0:l.id}-${l==null?void 0:l.type}"]`):null,{x,y:w}=gn(t),N=c.elementFromPoint(x,w),_=N!=null&&N.classList.contains(`${d}-flow__handle`)?N:v,E={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const M=Vb(void 0,_),S=_.getAttribute("data-nodeid"),z=_.getAttribute("data-handleid"),k=_.classList.contains("connectable"),R=_.classList.contains("connectableend");if(!S||!M)return E;const H={source:g?S:i,sourceHandle:g?z:s,target:g?i:S,targetHandle:g?s:z};E.connection=H;const q=k&&R&&(r===Sr.Strict?g&&M==="source"||!g&&M==="target":S!==i||z!==s);E.isValid=q&&m(H),E.toHandle=Gb(S,M,z,y,r,!0)}return E}const Eh={onPointerDown:Zz,isValid:Xb};function Kz({domNode:t,panZoom:l,getTransform:r,getViewScale:i}){const s=It(t);function u({translateExtent:d,width:h,height:m,zoomStep:y=1,pannable:g=!0,zoomable:v=!0,inversePan:x=!1}){const w=S=>{if(S.sourceEvent.type!=="wheel"||!l)return;const z=r(),k=S.sourceEvent.ctrlKey&&Qi()?10:1,R=-S.sourceEvent.deltaY*(S.sourceEvent.deltaMode===1?.05:S.sourceEvent.deltaMode?1:.002)*y,H=z[2]*Math.pow(2,R*k);l.scaleTo(H)};let N=[0,0];const _=S=>{(S.sourceEvent.type==="mousedown"||S.sourceEvent.type==="touchstart")&&(N=[S.sourceEvent.clientX??S.sourceEvent.touches[0].clientX,S.sourceEvent.clientY??S.sourceEvent.touches[0].clientY])},E=S=>{const z=r();if(S.sourceEvent.type!=="mousemove"&&S.sourceEvent.type!=="touchmove"||!l)return;const k=[S.sourceEvent.clientX??S.sourceEvent.touches[0].clientX,S.sourceEvent.clientY??S.sourceEvent.touches[0].clientY],R=[k[0]-N[0],k[1]-N[1]];N=k;const H=i()*Math.max(z[2],Math.log(z[2]))*(x?-1:1),D={x:z[0]-R[0]*H,y:z[1]-R[1]*H},q=[[0,0],[h,m]];l.setViewportConstrained({x:D.x,y:D.y,zoom:z[2]},q,d)},M=xb().on("start",_).on("zoom",g?E:null).on("zoom.wheel",v?w:null);s.call(M,{})}function c(){s.on("zoom",null)}return{update:u,destroy:c,pointer:fn}}const vu=t=>({x:t.x,y:t.y,zoom:t.k}),rd=({x:t,y:l,zoom:r})=>pu.translate(t,l).scale(r),gr=(t,l)=>t.target.closest(`.${l}`),$b=(t,l)=>l===2&&Array.isArray(t)&&t.includes(2),Iz=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,id=(t,l=0,r=Iz,i=()=>{})=>{const s=typeof l=="number"&&l>0;return s||i(),s?t.transition().duration(l).ease(r).on("end",i):t},Qb=t=>{const l=t.ctrlKey&&Qi()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*l};function Jz({zoomPanValues:t,noWheelClassName:l,d3Selection:r,d3Zoom:i,panOnScrollMode:s,panOnScrollSpeed:u,zoomOnPinch:c,onPanZoomStart:d,onPanZoom:h,onPanZoomEnd:m}){return y=>{if(gr(y,l))return y.ctrlKey&&y.preventDefault(),!1;y.preventDefault(),y.stopImmediatePropagation();const g=r.property("__zoom").k||1;if(y.ctrlKey&&c){const _=fn(y),E=Qb(y),M=g*Math.pow(2,E);i.scaleTo(r,M,_,y);return}const v=y.deltaMode===1?20:1;let x=s===ml.Vertical?0:y.deltaX*v,w=s===ml.Horizontal?0:y.deltaY*v;!Qi()&&y.shiftKey&&s!==ml.Vertical&&(x=y.deltaY*v,w=0),i.translateBy(r,-(x/g)*u,-(w/g)*u,{internal:!0});const N=vu(r.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?(h==null||h(y,N),t.panScrollTimeout=setTimeout(()=>{m==null||m(y,N),t.isPanScrolling=!1},150)):(t.isPanScrolling=!0,d==null||d(y,N))}}function Fz({noWheelClassName:t,preventScrolling:l,d3ZoomHandler:r}){return function(i,s){const u=i.type==="wheel",c=!l&&u&&!i.ctrlKey,d=gr(i,t);if(i.ctrlKey&&u&&d&&i.preventDefault(),c||d)return null;i.preventDefault(),r.call(this,i,s)}}function Wz({zoomPanValues:t,onDraggingChange:l,onPanZoomStart:r}){return i=>{var u,c,d;if((u=i.sourceEvent)!=null&&u.internal)return;const s=vu(i.transform);t.mouseButton=((c=i.sourceEvent)==null?void 0:c.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=s,((d=i.sourceEvent)==null?void 0:d.type)==="mousedown"&&l(!0),r&&(r==null||r(i.sourceEvent,s))}}function Pz({zoomPanValues:t,panOnDrag:l,onPaneContextMenu:r,onTransformChange:i,onPanZoom:s}){return u=>{var c,d;t.usedRightMouseButton=!!(r&&$b(l,t.mouseButton??0)),(c=u.sourceEvent)!=null&&c.sync||i([u.transform.x,u.transform.y,u.transform.k]),s&&!((d=u.sourceEvent)!=null&&d.internal)&&(s==null||s(u.sourceEvent,vu(u.transform)))}}function e3({zoomPanValues:t,panOnDrag:l,panOnScroll:r,onDraggingChange:i,onPanZoomEnd:s,onPaneContextMenu:u}){return c=>{var d;if(!((d=c.sourceEvent)!=null&&d.internal)&&(t.isZoomingOrPanning=!1,u&&$b(l,t.mouseButton??0)&&!t.usedRightMouseButton&&c.sourceEvent&&u(c.sourceEvent),t.usedRightMouseButton=!1,i(!1),s)){const h=vu(c.transform);t.prevViewport=h,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{s==null||s(c.sourceEvent,h)},r?150:0)}}}function t3({zoomActivationKeyPressed:t,zoomOnScroll:l,zoomOnPinch:r,panOnDrag:i,panOnScroll:s,zoomOnDoubleClick:u,userSelectionActive:c,noWheelClassName:d,noPanClassName:h,lib:m,connectionInProgress:y}){return g=>{var _;const v=t||l,x=r&&g.ctrlKey,w=g.type==="wheel";if(g.button===1&&g.type==="mousedown"&&(gr(g,`${m}-flow__node`)||gr(g,`${m}-flow__edge`)))return!0;if(!i&&!v&&!s&&!u&&!r||c||y&&!w||gr(g,d)&&w||gr(g,h)&&(!w||s&&w&&!t)||!r&&g.ctrlKey&&w)return!1;if(!r&&g.type==="touchstart"&&((_=g.touches)==null?void 0:_.length)>1)return g.preventDefault(),!1;if(!v&&!s&&!x&&w||!i&&(g.type==="mousedown"||g.type==="touchstart")||Array.isArray(i)&&!i.includes(g.button)&&g.type==="mousedown")return!1;const N=Array.isArray(i)&&i.includes(g.button)||!g.button||g.button<=1;return(!g.ctrlKey||w)&&N}}function n3({domNode:t,minZoom:l,maxZoom:r,translateExtent:i,viewport:s,onPanZoom:u,onPanZoomStart:c,onPanZoomEnd:d,onDraggingChange:h}){const m={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},y=t.getBoundingClientRect(),g=xb().scaleExtent([l,r]).translateExtent(i),v=It(t).call(g);M({x:s.x,y:s.y,zoom:Er(s.zoom,l,r)},[[0,0],[y.width,y.height]],i);const x=v.on("wheel.zoom"),w=v.on("dblclick.zoom");g.wheelDelta(Qb);function N(U,L){return v?new Promise(te=>{g==null||g.interpolate((L==null?void 0:L.interpolate)==="linear"?ki:Gs).transform(id(v,L==null?void 0:L.duration,L==null?void 0:L.ease,()=>te(!0)),U)}):Promise.resolve(!1)}function _({noWheelClassName:U,noPanClassName:L,onPaneContextMenu:te,userSelectionActive:B,panOnScroll:J,panOnDrag:T,panOnScrollMode:Y,panOnScrollSpeed:K,preventScrolling:I,zoomOnPinch:ie,zoomOnScroll:O,zoomOnDoubleClick:X,zoomActivationKeyPressed:j,lib:G,onTransformChange:$,connectionInProgress:W,paneClickDistance:ee,selectionOnDrag:ne}){B&&!m.isZoomingOrPanning&&E();const ue=J&&!j&&!B;g.clickDistance(ne?1/0:!hn(ee)||ee<0?0:ee);const he=ue?Jz({zoomPanValues:m,noWheelClassName:U,d3Selection:v,d3Zoom:g,panOnScrollMode:Y,panOnScrollSpeed:K,zoomOnPinch:ie,onPanZoomStart:c,onPanZoom:u,onPanZoomEnd:d}):Fz({noWheelClassName:U,preventScrolling:I,d3ZoomHandler:x});if(v.on("wheel.zoom",he,{passive:!1}),!B){const ge=Wz({zoomPanValues:m,onDraggingChange:h,onPanZoomStart:c});g.on("start",ge);const de=Pz({zoomPanValues:m,panOnDrag:T,onPaneContextMenu:!!te,onPanZoom:u,onTransformChange:$});g.on("zoom",de);const xe=e3({zoomPanValues:m,panOnDrag:T,panOnScroll:J,onPaneContextMenu:te,onPanZoomEnd:d,onDraggingChange:h});g.on("end",xe)}const ye=t3({zoomActivationKeyPressed:j,panOnDrag:T,zoomOnScroll:O,panOnScroll:J,zoomOnDoubleClick:X,zoomOnPinch:ie,userSelectionActive:B,noPanClassName:L,noWheelClassName:U,lib:G,connectionInProgress:W});g.filter(ye),X?v.on("dblclick.zoom",w):v.on("dblclick.zoom",null)}function E(){g.on("zoom",null)}async function M(U,L,te){const B=rd(U),J=g==null?void 0:g.constrain()(B,L,te);return J&&await N(J),new Promise(T=>T(J))}async function S(U,L){const te=rd(U);return await N(te,L),new Promise(B=>B(te))}function z(U){if(v){const L=rd(U),te=v.property("__zoom");(te.k!==U.zoom||te.x!==U.x||te.y!==U.y)&&(g==null||g.transform(v,L,null,{sync:!0}))}}function k(){const U=v?vb(v.node()):{x:0,y:0,k:1};return{x:U.x,y:U.y,zoom:U.k}}function R(U,L){return v?new Promise(te=>{g==null||g.interpolate((L==null?void 0:L.interpolate)==="linear"?ki:Gs).scaleTo(id(v,L==null?void 0:L.duration,L==null?void 0:L.ease,()=>te(!0)),U)}):Promise.resolve(!1)}function H(U,L){return v?new Promise(te=>{g==null||g.interpolate((L==null?void 0:L.interpolate)==="linear"?ki:Gs).scaleBy(id(v,L==null?void 0:L.duration,L==null?void 0:L.ease,()=>te(!0)),U)}):Promise.resolve(!1)}function D(U){g==null||g.scaleExtent(U)}function q(U){g==null||g.translateExtent(U)}function Z(U){const L=!hn(U)||U<0?0:U;g==null||g.clickDistance(L)}return{update:_,destroy:E,setViewport:S,setViewportConstrained:M,getViewport:k,scaleTo:R,scaleBy:H,setScaleExtent:D,setTranslateExtent:q,syncViewport:z,setClickDistance:Z}}var zr;(function(t){t.Line="line",t.Handle="handle"})(zr||(zr={}));function a3({width:t,prevWidth:l,height:r,prevHeight:i,affectsX:s,affectsY:u}){const c=t-l,d=r-i,h=[c>0?1:c<0?-1:0,d>0?1:d<0?-1:0];return c&&s&&(h[0]=h[0]*-1),d&&u&&(h[1]=h[1]*-1),h}function Ly(t){const l=t.includes("right")||t.includes("left"),r=t.includes("bottom")||t.includes("top"),i=t.includes("left"),s=t.includes("top");return{isHorizontal:l,isVertical:r,affectsX:i,affectsY:s}}function La(t,l){return Math.max(0,l-t)}function Ba(t,l){return Math.max(0,t-l)}function ks(t,l,r){return Math.max(0,l-t,t-r)}function By(t,l){return t?!l:l}function l3(t,l,r,i,s,u,c,d){let{affectsX:h,affectsY:m}=l;const{isHorizontal:y,isVertical:g}=l,v=y&&g,{xSnapped:x,ySnapped:w}=r,{minWidth:N,maxWidth:_,minHeight:E,maxHeight:M}=i,{x:S,y:z,width:k,height:R,aspectRatio:H}=t;let D=Math.floor(y?x-t.pointerX:0),q=Math.floor(g?w-t.pointerY:0);const Z=k+(h?-D:D),U=R+(m?-q:q),L=-u[0]*k,te=-u[1]*R;let B=ks(Z,N,_),J=ks(U,E,M);if(c){let K=0,I=0;h&&D<0?K=La(S+D+L,c[0][0]):!h&&D>0&&(K=Ba(S+Z+L,c[1][0])),m&&q<0?I=La(z+q+te,c[0][1]):!m&&q>0&&(I=Ba(z+U+te,c[1][1])),B=Math.max(B,K),J=Math.max(J,I)}if(d){let K=0,I=0;h&&D>0?K=Ba(S+D,d[0][0]):!h&&D<0&&(K=La(S+Z,d[1][0])),m&&q>0?I=Ba(z+q,d[0][1]):!m&&q<0&&(I=La(z+U,d[1][1])),B=Math.max(B,K),J=Math.max(J,I)}if(s){if(y){const K=ks(Z/H,E,M)*H;if(B=Math.max(B,K),c){let I=0;!h&&!m||h&&!m&&v?I=Ba(z+te+Z/H,c[1][1])*H:I=La(z+te+(h?D:-D)/H,c[0][1])*H,B=Math.max(B,I)}if(d){let I=0;!h&&!m||h&&!m&&v?I=La(z+Z/H,d[1][1])*H:I=Ba(z+(h?D:-D)/H,d[0][1])*H,B=Math.max(B,I)}}if(g){const K=ks(U*H,N,_)/H;if(J=Math.max(J,K),c){let I=0;!h&&!m||m&&!h&&v?I=Ba(S+U*H+L,c[1][0])/H:I=La(S+(m?q:-q)*H+L,c[0][0])/H,J=Math.max(J,I)}if(d){let I=0;!h&&!m||m&&!h&&v?I=La(S+U*H,d[1][0])/H:I=Ba(S+(m?q:-q)*H,d[0][0])/H,J=Math.max(J,I)}}}q=q+(q<0?J:-J),D=D+(D<0?B:-B),s&&(v?Z>U*H?q=(By(h,m)?-D:D)/H:D=(By(h,m)?-q:q)*H:y?(q=D/H,m=h):(D=q*H,h=m));const T=h?S+D:S,Y=m?z+q:z;return{width:k+(h?-D:D),height:R+(m?-q:q),x:u[0]*D*(h?-1:1)+T,y:u[1]*q*(m?-1:1)+Y}}const Zb={width:0,height:0,x:0,y:0},r3={...Zb,pointerX:0,pointerY:0,aspectRatio:1};function i3(t){return[[0,0],[t.measured.width,t.measured.height]]}function o3(t,l,r){const i=l.position.x+t.position.x,s=l.position.y+t.position.y,u=t.measured.width??0,c=t.measured.height??0,d=r[0]*u,h=r[1]*c;return[[i-d,s-h],[i+u-d,s+c-h]]}function s3({domNode:t,nodeId:l,getStoreItems:r,onChange:i,onEnd:s}){const u=It(t);let c={controlDirection:Ly("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function d({controlPosition:m,boundaries:y,keepAspectRatio:g,resizeDirection:v,onResizeStart:x,onResize:w,onResizeEnd:N,shouldResize:_}){let E={...Zb},M={...r3};c={boundaries:y,resizeDirection:v,keepAspectRatio:g,controlDirection:Ly(m)};let S,z=null,k=[],R,H,D,q=!1;const Z=lb().on("start",U=>{const{nodeLookup:L,transform:te,snapGrid:B,snapToGrid:J,nodeOrigin:T,paneDomNode:Y}=r();if(S=L.get(l),!S)return;z=(Y==null?void 0:Y.getBoundingClientRect())??null;const{xSnapped:K,ySnapped:I}=Hi(U.sourceEvent,{transform:te,snapGrid:B,snapToGrid:J,containerBounds:z});E={width:S.measured.width??0,height:S.measured.height??0,x:S.position.x??0,y:S.position.y??0},M={...E,pointerX:K,pointerY:I,aspectRatio:E.width/E.height},R=void 0,S.parentId&&(S.extent==="parent"||S.expandParent)&&(R=L.get(S.parentId),H=R&&S.extent==="parent"?i3(R):void 0),k=[],D=void 0;for(const[ie,O]of L)if(O.parentId===l&&(k.push({id:ie,position:{...O.position},extent:O.extent}),O.extent==="parent"||O.expandParent)){const X=o3(O,S,O.origin??T);D?D=[[Math.min(X[0][0],D[0][0]),Math.min(X[0][1],D[0][1])],[Math.max(X[1][0],D[1][0]),Math.max(X[1][1],D[1][1])]]:D=X}x==null||x(U,{...E})}).on("drag",U=>{const{transform:L,snapGrid:te,snapToGrid:B,nodeOrigin:J}=r(),T=Hi(U.sourceEvent,{transform:L,snapGrid:te,snapToGrid:B,containerBounds:z}),Y=[];if(!S)return;const{x:K,y:I,width:ie,height:O}=E,X={},j=S.origin??J,{width:G,height:$,x:W,y:ee}=l3(M,c.controlDirection,T,c.boundaries,c.keepAspectRatio,j,H,D),ne=G!==ie,ue=$!==O,he=W!==K&&ne,ye=ee!==I&&ue;if(!he&&!ye&&!ne&&!ue)return;if((he||ye||j[0]===1||j[1]===1)&&(X.x=he?W:E.x,X.y=ye?ee:E.y,E.x=X.x,E.y=X.y,k.length>0)){const Ae=W-K,Se=ee-I;for(const We of k)We.position={x:We.position.x-Ae+j[0]*(G-ie),y:We.position.y-Se+j[1]*($-O)},Y.push(We)}if((ne||ue)&&(X.width=ne&&(!c.resizeDirection||c.resizeDirection==="horizontal")?G:E.width,X.height=ue&&(!c.resizeDirection||c.resizeDirection==="vertical")?$:E.height,E.width=X.width,E.height=X.height),R&&S.expandParent){const Ae=j[0]*(X.width??0);X.x&&X.x{q&&(N==null||N(U,{...E}),s==null||s({...E}),q=!1)});u.call(Z)}function h(){u.on(".drag",null)}return{update:d,destroy:h}}var od={exports:{}},sd={},ud={exports:{}},cd={};/** - * @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 qy;function u3(){if(qy)return cd;qy=1;var t=Ki();function l(g,v){return g===v&&(g!==0||1/g===1/v)||g!==g&&v!==v}var r=typeof Object.is=="function"?Object.is:l,i=t.useState,s=t.useEffect,u=t.useLayoutEffect,c=t.useDebugValue;function d(g,v){var x=v(),w=i({inst:{value:x,getSnapshot:v}}),N=w[0].inst,_=w[1];return u(function(){N.value=x,N.getSnapshot=v,h(N)&&_({inst:N})},[g,x,v]),s(function(){return h(N)&&_({inst:N}),g(function(){h(N)&&_({inst:N})})},[g]),c(x),x}function h(g){var v=g.getSnapshot;g=g.value;try{var x=v();return!r(g,x)}catch{return!0}}function m(g,v){return v()}var y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:d;return cd.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:y,cd}var Uy;function c3(){return Uy||(Uy=1,ud.exports=u3()),ud.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 Gy;function f3(){if(Gy)return sd;Gy=1;var t=Ki(),l=c3();function r(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var i=typeof Object.is=="function"?Object.is:r,s=l.useSyncExternalStore,u=t.useRef,c=t.useEffect,d=t.useMemo,h=t.useDebugValue;return sd.useSyncExternalStoreWithSelector=function(m,y,g,v,x){var w=u(null);if(w.current===null){var N={hasValue:!1,value:null};w.current=N}else N=w.current;w=d(function(){function E(R){if(!M){if(M=!0,S=R,R=v(R),x!==void 0&&N.hasValue){var H=N.value;if(x(H,R))return z=H}return z=R}if(H=z,i(S,R))return H;var D=v(R);return x!==void 0&&x(H,D)?(S=R,H):(S=R,z=D)}var M=!1,S,z,k=g===void 0?null:g;return[function(){return E(y())},k===null?void 0:function(){return E(k())}]},[y,g,v,x]);var _=s(m,w[0],w[1]);return c(function(){N.hasValue=!0,N.value=_},[_]),h(_),_},sd}var Vy;function d3(){return Vy||(Vy=1,od.exports=f3()),od.exports}var h3=d3();const g3=zh(h3),p3={},Yy=t=>{let l;const r=new Set,i=(y,g)=>{const v=typeof y=="function"?y(l):y;if(!Object.is(v,l)){const x=l;l=g??(typeof v!="object"||v===null)?v:Object.assign({},l,v),r.forEach(w=>w(l,x))}},s=()=>l,h={setState:i,getState:s,getInitialState:()=>m,subscribe:y=>(r.add(y),()=>r.delete(y)),destroy:()=>{(p3?"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()}},m=l=t(i,s,h);return h},m3=t=>t?Yy(t):Yy,{useDebugValue:y3}=dr,{useSyncExternalStoreWithSelector:v3}=g3,x3=t=>t;function Kb(t,l=x3,r){const i=v3(t.subscribe,t.getState,t.getServerState||t.getInitialState,l,r);return y3(i),i}const Xy=(t,l)=>{const r=m3(t),i=(s,u=l)=>Kb(r,s,u);return Object.assign(i,r),i},b3=(t,l)=>t?Xy(t,l):Xy;function Je(t,l){if(Object.is(t,l))return!0;if(typeof t!="object"||t===null||typeof l!="object"||l===null)return!1;if(t instanceof Map&&l instanceof Map){if(t.size!==l.size)return!1;for(const[i,s]of t)if(!Object.is(s,l.get(i)))return!1;return!0}if(t instanceof Set&&l instanceof Set){if(t.size!==l.size)return!1;for(const i of t)if(!l.has(i))return!1;return!0}const r=Object.keys(t);if(r.length!==Object.keys(l).length)return!1;for(const i of r)if(!Object.prototype.hasOwnProperty.call(l,i)||!Object.is(t[i],l[i]))return!1;return!0}var w3=dx();const xu=V.createContext(null),_3=xu.Provider,Ib=zn.error001();function ke(t,l){const r=V.useContext(xu);if(r===null)throw new Error(Ib);return Kb(r,t,l)}function Fe(){const t=V.useContext(xu);if(t===null)throw new Error(Ib);return V.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe}),[t])}const $y={display:"none"},S3={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Jb="react-flow__node-desc",Fb="react-flow__edge-desc",E3="react-flow__aria-live",N3=t=>t.ariaLiveMessage,C3=t=>t.ariaLabelConfig;function z3({rfId:t}){const l=ke(N3);return C.jsx("div",{id:`${E3}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:S3,children:l})}function M3({rfId:t,disableKeyboardA11y:l}){const r=ke(C3);return C.jsxs(C.Fragment,{children:[C.jsx("div",{id:`${Jb}-${t}`,style:$y,children:l?r["node.a11yDescription.default"]:r["node.a11yDescription.keyboardDisabled"]}),C.jsx("div",{id:`${Fb}-${t}`,style:$y,children:r["edge.a11yDescription.default"]}),!l&&C.jsx(z3,{rfId:t})]})}const bu=V.forwardRef(({position:t="top-left",children:l,className:r,style:i,...s},u)=>{const c=`${t}`.split("-");return C.jsx("div",{className:gt(["react-flow__panel",r,...c]),style:i,ref:u,...s,children:l})});bu.displayName="Panel";function A3({proOptions:t,position:l="bottom-right"}){return t!=null&&t.hideAttribution?null:C.jsx(bu,{position:l,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:C.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const T3=t=>{const l=[],r=[];for(const[,i]of t.nodeLookup)i.selected&&l.push(i.internals.userNode);for(const[,i]of t.edgeLookup)i.selected&&r.push(i);return{selectedNodes:l,selectedEdges:r}},Hs=t=>t.id;function O3(t,l){return Je(t.selectedNodes.map(Hs),l.selectedNodes.map(Hs))&&Je(t.selectedEdges.map(Hs),l.selectedEdges.map(Hs))}function j3({onSelectionChange:t}){const l=Fe(),{selectedNodes:r,selectedEdges:i}=ke(T3,O3);return V.useEffect(()=>{const s={nodes:r,edges:i};t==null||t(s),l.getState().onSelectionChangeHandlers.forEach(u=>u(s))},[r,i,t]),null}const R3=t=>!!t.onSelectionChangeHandlers;function D3({onSelectionChange:t}){const l=ke(R3);return t||l?C.jsx(j3,{onSelectionChange:t}):null}const Wb=[0,0],k3={x:0,y:0,zoom:1},H3=["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"],Qy=[...H3,"rfId"],L3=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges}),Zy={translateExtent:Yi,nodeOrigin:Wb,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function B3(t){const{setNodes:l,setEdges:r,setMinZoom:i,setMaxZoom:s,setTranslateExtent:u,setNodeExtent:c,reset:d,setDefaultNodesAndEdges:h}=ke(L3,Je),m=Fe();V.useEffect(()=>(h(t.defaultNodes,t.defaultEdges),()=>{y.current=Zy,d()}),[]);const y=V.useRef(Zy);return V.useEffect(()=>{for(const g of Qy){const v=t[g],x=y.current[g];v!==x&&(typeof t[g]>"u"||(g==="nodes"?l(v):g==="edges"?r(v):g==="minZoom"?i(v):g==="maxZoom"?s(v):g==="translateExtent"?u(v):g==="nodeExtent"?c(v):g==="ariaLabelConfig"?m.setState({ariaLabelConfig:bz(v)}):g==="fitView"?m.setState({fitViewQueued:v}):g==="fitViewOptions"?m.setState({fitViewOptions:v}):m.setState({[g]:v})))}y.current=t},Qy.map(g=>t[g])),null}function Ky(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function q3(t){var i;const[l,r]=V.useState(t==="system"?null:t);return V.useEffect(()=>{if(t!=="system"){r(t);return}const s=Ky(),u=()=>r(s!=null&&s.matches?"dark":"light");return u(),s==null||s.addEventListener("change",u),()=>{s==null||s.removeEventListener("change",u)}},[t]),l!==null?l:(i=Ky())!=null&&i.matches?"dark":"light"}const Iy=typeof document<"u"?document:null;function Zi(t=null,l={target:Iy,actInsideInputWithModifier:!0}){const[r,i]=V.useState(!1),s=V.useRef(!1),u=V.useRef(new Set([])),[c,d]=V.useMemo(()=>{if(t!==null){const m=(Array.isArray(t)?t:[t]).filter(g=>typeof g=="string").map(g=>g.replace("+",` -`).replace(` - -`,` -+`).split(` -`)),y=m.reduce((g,v)=>g.concat(...v),[]);return[m,y]}return[[],[]]},[t]);return V.useEffect(()=>{const h=(l==null?void 0:l.target)??Iy,m=(l==null?void 0:l.actInsideInputWithModifier)??!0;if(t!==null){const y=x=>{var _,E;if(s.current=x.ctrlKey||x.metaKey||x.shiftKey||x.altKey,(!s.current||s.current&&!m)&&jb(x))return!1;const N=Fy(x.code,d);if(u.current.add(x[N]),Jy(c,u.current,!1)){const M=((E=(_=x.composedPath)==null?void 0:_.call(x))==null?void 0:E[0])||x.target,S=(M==null?void 0:M.nodeName)==="BUTTON"||(M==null?void 0:M.nodeName)==="A";l.preventDefault!==!1&&(s.current||!S)&&x.preventDefault(),i(!0)}},g=x=>{const w=Fy(x.code,d);Jy(c,u.current,!0)?(i(!1),u.current.clear()):u.current.delete(x[w]),x.key==="Meta"&&u.current.clear(),s.current=!1},v=()=>{u.current.clear(),i(!1)};return h==null||h.addEventListener("keydown",y),h==null||h.addEventListener("keyup",g),window.addEventListener("blur",v),window.addEventListener("contextmenu",v),()=>{h==null||h.removeEventListener("keydown",y),h==null||h.removeEventListener("keyup",g),window.removeEventListener("blur",v),window.removeEventListener("contextmenu",v)}}},[t,i]),r}function Jy(t,l,r){return t.filter(i=>r||i.length===l.size).some(i=>i.every(s=>l.has(s)))}function Fy(t,l){return l.includes(t)?"code":"key"}const U3=()=>{const t=Fe();return V.useMemo(()=>({zoomIn:l=>{const{panZoom:r}=t.getState();return r?r.scaleBy(1.2,{duration:l==null?void 0:l.duration}):Promise.resolve(!1)},zoomOut:l=>{const{panZoom:r}=t.getState();return r?r.scaleBy(1/1.2,{duration:l==null?void 0:l.duration}):Promise.resolve(!1)},zoomTo:(l,r)=>{const{panZoom:i}=t.getState();return i?i.scaleTo(l,{duration:r==null?void 0:r.duration}):Promise.resolve(!1)},getZoom:()=>t.getState().transform[2],setViewport:async(l,r)=>{const{transform:[i,s,u],panZoom:c}=t.getState();return c?(await c.setViewport({x:l.x??i,y:l.y??s,zoom:l.zoom??u},r),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[l,r,i]=t.getState().transform;return{x:l,y:r,zoom:i}},setCenter:async(l,r,i)=>t.getState().setCenter(l,r,i),fitBounds:async(l,r)=>{const{width:i,height:s,minZoom:u,maxZoom:c,panZoom:d}=t.getState(),h=Yh(l,i,s,u,c,(r==null?void 0:r.padding)??.1);return d?(await d.setViewport(h,{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:(l,r={})=>{const{transform:i,snapGrid:s,snapToGrid:u,domNode:c}=t.getState();if(!c)return l;const{x:d,y:h}=c.getBoundingClientRect(),m={x:l.x-d,y:l.y-h},y=r.snapGrid??s,g=r.snapToGrid??u;return eo(m,i,g,y)},flowToScreenPosition:l=>{const{transform:r,domNode:i}=t.getState();if(!i)return l;const{x:s,y:u}=i.getBoundingClientRect(),c=au(l,r);return{x:c.x+s,y:c.y+u}}}),[])};function Pb(t,l){const r=[],i=new Map,s=[];for(const u of t)if(u.type==="add"){s.push(u);continue}else if(u.type==="remove"||u.type==="replace")i.set(u.id,[u]);else{const c=i.get(u.id);c?c.push(u):i.set(u.id,[u])}for(const u of l){const c=i.get(u.id);if(!c){r.push(u);continue}if(c[0].type==="remove")continue;if(c[0].type==="replace"){r.push({...c[0].item});continue}const d={...u};for(const h of c)G3(h,d);r.push(d)}return s.length&&s.forEach(u=>{u.index!==void 0?r.splice(u.index,0,{...u.item}):r.push({...u.item})}),r}function G3(t,l){switch(t.type){case"select":{l.selected=t.selected;break}case"position":{typeof t.position<"u"&&(l.position=t.position),typeof t.dragging<"u"&&(l.dragging=t.dragging);break}case"dimensions":{typeof t.dimensions<"u"&&(l.measured={...t.dimensions},t.setAttributes&&((t.setAttributes===!0||t.setAttributes==="width")&&(l.width=t.dimensions.width),(t.setAttributes===!0||t.setAttributes==="height")&&(l.height=t.dimensions.height))),typeof t.resizing=="boolean"&&(l.resizing=t.resizing);break}}}function e1(t,l){return Pb(t,l)}function t1(t,l){return Pb(t,l)}function fl(t,l){return{id:t,type:"select",selected:l}}function pr(t,l=new Set,r=!1){const i=[];for(const[s,u]of t){const c=l.has(s);!(u.selected===void 0&&!c)&&u.selected!==c&&(r&&(u.selected=c),i.push(fl(u.id,c)))}return i}function Wy({items:t=[],lookup:l}){var s;const r=[],i=new Map(t.map(u=>[u.id,u]));for(const[u,c]of t.entries()){const d=l.get(c.id),h=((s=d==null?void 0:d.internals)==null?void 0:s.userNode)??d;h!==void 0&&h!==c&&r.push({id:c.id,item:c,type:"replace"}),h===void 0&&r.push({item:c,type:"add",index:u})}for(const[u]of l)i.get(u)===void 0&&r.push({id:u,type:"remove"});return r}function Py(t){return{id:t.id,type:"remove"}}const ev=t=>cz(t),V3=t=>Eb(t);function n1(t){return V.forwardRef(t)}const Y3=typeof window<"u"?V.useLayoutEffect:V.useEffect;function tv(t){const[l,r]=V.useState(BigInt(0)),[i]=V.useState(()=>X3(()=>r(s=>s+BigInt(1))));return Y3(()=>{const s=i.get();s.length&&(t(s),i.reset())},[l]),i}function X3(t){let l=[];return{get:()=>l,reset:()=>{l=[]},push:r=>{l.push(r),t()}}}const a1=V.createContext(null);function $3({children:t}){const l=Fe(),r=V.useCallback(d=>{const{nodes:h=[],setNodes:m,hasDefaultNodes:y,onNodesChange:g,nodeLookup:v,fitViewQueued:x,onNodesChangeMiddlewareMap:w}=l.getState();let N=h;for(const E of d)N=typeof E=="function"?E(N):E;let _=Wy({items:N,lookup:v});for(const E of w.values())_=E(_);y&&m(N),_.length>0?g==null||g(_):x&&window.requestAnimationFrame(()=>{const{fitViewQueued:E,nodes:M,setNodes:S}=l.getState();E&&S(M)})},[]),i=tv(r),s=V.useCallback(d=>{const{edges:h=[],setEdges:m,hasDefaultEdges:y,onEdgesChange:g,edgeLookup:v}=l.getState();let x=h;for(const w of d)x=typeof w=="function"?w(x):w;y?m(x):g&&g(Wy({items:x,lookup:v}))},[]),u=tv(s),c=V.useMemo(()=>({nodeQueue:i,edgeQueue:u}),[]);return C.jsx(a1.Provider,{value:c,children:t})}function Q3(){const t=V.useContext(a1);if(!t)throw new Error("useBatchContext must be used within a BatchProvider");return t}const Z3=t=>!!t.panZoom;function to(){const t=U3(),l=Fe(),r=Q3(),i=ke(Z3),s=V.useMemo(()=>{const u=g=>l.getState().nodeLookup.get(g),c=g=>{r.nodeQueue.push(g)},d=g=>{r.edgeQueue.push(g)},h=g=>{var E,M;const{nodeLookup:v,nodeOrigin:x}=l.getState(),w=ev(g)?g:v.get(g.id),N=w.parentId?Tb(w.position,w.measured,w.parentId,v,x):w.position,_={...w,position:N,width:((E=w.measured)==null?void 0:E.width)??w.width,height:((M=w.measured)==null?void 0:M.height)??w.height};return Nr(_)},m=(g,v,x={replace:!1})=>{c(w=>w.map(N=>{if(N.id===g){const _=typeof v=="function"?v(N):v;return x.replace&&ev(_)?_:{...N,..._}}return N}))},y=(g,v,x={replace:!1})=>{d(w=>w.map(N=>{if(N.id===g){const _=typeof v=="function"?v(N):v;return x.replace&&V3(_)?_:{...N,..._}}return N}))};return{getNodes:()=>l.getState().nodes.map(g=>({...g})),getNode:g=>{var v;return(v=u(g))==null?void 0:v.internals.userNode},getInternalNode:u,getEdges:()=>{const{edges:g=[]}=l.getState();return g.map(v=>({...v}))},getEdge:g=>l.getState().edgeLookup.get(g),setNodes:c,setEdges:d,addNodes:g=>{const v=Array.isArray(g)?g:[g];r.nodeQueue.push(x=>[...x,...v])},addEdges:g=>{const v=Array.isArray(g)?g:[g];r.edgeQueue.push(x=>[...x,...v])},toObject:()=>{const{nodes:g=[],edges:v=[],transform:x}=l.getState(),[w,N,_]=x;return{nodes:g.map(E=>({...E})),edges:v.map(E=>({...E})),viewport:{x:w,y:N,zoom:_}}},deleteElements:async({nodes:g=[],edges:v=[]})=>{const{nodes:x,edges:w,onNodesDelete:N,onEdgesDelete:_,triggerNodeChanges:E,triggerEdgeChanges:M,onDelete:S,onBeforeDelete:z}=l.getState(),{nodes:k,edges:R}=await pz({nodesToRemove:g,edgesToRemove:v,nodes:x,edges:w,onBeforeDelete:z}),H=R.length>0,D=k.length>0;if(H){const q=R.map(Py);_==null||_(R),M(q)}if(D){const q=k.map(Py);N==null||N(k),E(q)}return(D||H)&&(S==null||S({nodes:k,edges:R})),{deletedNodes:k,deletedEdges:R}},getIntersectingNodes:(g,v=!0,x)=>{const w=Cy(g),N=w?g:h(g),_=x!==void 0;return N?(x||l.getState().nodes).filter(E=>{const M=l.getState().nodeLookup.get(E.id);if(M&&!w&&(E.id===g.id||!M.internals.positionAbsolute))return!1;const S=Nr(_?E:M),z=$i(S,N);return v&&z>0||z>=S.width*S.height||z>=N.width*N.height}):[]},isNodeIntersecting:(g,v,x=!0)=>{const N=Cy(g)?g:h(g);if(!N)return!1;const _=$i(N,v);return x&&_>0||_>=v.width*v.height||_>=N.width*N.height},updateNode:m,updateNodeData:(g,v,x={replace:!1})=>{m(g,w=>{const N=typeof v=="function"?v(w):v;return x.replace?{...w,data:N}:{...w,data:{...w.data,...N}}},x)},updateEdge:y,updateEdgeData:(g,v,x={replace:!1})=>{y(g,w=>{const N=typeof v=="function"?v(w):v;return x.replace?{...w,data:N}:{...w,data:{...w.data,...N}}},x)},getNodesBounds:g=>{const{nodeLookup:v,nodeOrigin:x}=l.getState();return fz(g,{nodeLookup:v,nodeOrigin:x})},getHandleConnections:({type:g,id:v,nodeId:x})=>{var w;return Array.from(((w=l.getState().connectionLookup.get(`${x}-${g}${v?`-${v}`:""}`))==null?void 0:w.values())??[])},getNodeConnections:({type:g,handleId:v,nodeId:x})=>{var w;return Array.from(((w=l.getState().connectionLookup.get(`${x}${g?v?`-${g}-${v}`:`-${g}`:""}`))==null?void 0:w.values())??[])},fitView:async g=>{const v=l.getState().fitViewResolver??xz();return l.setState({fitViewQueued:!0,fitViewOptions:g,fitViewResolver:v}),r.nodeQueue.push(x=>[...x]),v.promise}}},[]);return V.useMemo(()=>({...s,...t,viewportInitialized:i}),[i])}const nv=t=>t.selected,K3=typeof window<"u"?window:void 0;function I3({deleteKeyCode:t,multiSelectionKeyCode:l}){const r=Fe(),{deleteElements:i}=to(),s=Zi(t,{actInsideInputWithModifier:!1}),u=Zi(l,{target:K3});V.useEffect(()=>{if(s){const{edges:c,nodes:d}=r.getState();i({nodes:d.filter(nv),edges:c.filter(nv)}),r.setState({nodesSelectionActive:!1})}},[s]),V.useEffect(()=>{r.setState({multiSelectionActive:u})},[u])}function J3(t){const l=Fe();V.useEffect(()=>{const r=()=>{var s,u,c,d;if(!t.current||!(((u=(s=t.current).checkVisibility)==null?void 0:u.call(s))??!0))return!1;const i=Xh(t.current);(i.height===0||i.width===0)&&((d=(c=l.getState()).onError)==null||d.call(c,"004",zn.error004())),l.setState({width:i.width||500,height:i.height||500})};if(t.current){r(),window.addEventListener("resize",r);const i=new ResizeObserver(()=>r());return i.observe(t.current),()=>{window.removeEventListener("resize",r),i&&t.current&&i.unobserve(t.current)}}},[])}const wu={position:"absolute",width:"100%",height:"100%",top:0,left:0},F3=t=>({userSelectionActive:t.userSelectionActive,lib:t.lib,connectionInProgress:t.connection.inProgress});function W3({onPaneContextMenu:t,zoomOnScroll:l=!0,zoomOnPinch:r=!0,panOnScroll:i=!1,panOnScrollSpeed:s=.5,panOnScrollMode:u=ml.Free,zoomOnDoubleClick:c=!0,panOnDrag:d=!0,defaultViewport:h,translateExtent:m,minZoom:y,maxZoom:g,zoomActivationKeyCode:v,preventScrolling:x=!0,children:w,noWheelClassName:N,noPanClassName:_,onViewportChange:E,isControlledViewport:M,paneClickDistance:S,selectionOnDrag:z}){const k=Fe(),R=V.useRef(null),{userSelectionActive:H,lib:D,connectionInProgress:q}=ke(F3,Je),Z=Zi(v),U=V.useRef();J3(R);const L=V.useCallback(te=>{E==null||E({x:te[0],y:te[1],zoom:te[2]}),M||k.setState({transform:te})},[E,M]);return V.useEffect(()=>{if(R.current){U.current=n3({domNode:R.current,minZoom:y,maxZoom:g,translateExtent:m,viewport:h,onDraggingChange:T=>k.setState(Y=>Y.paneDragging===T?Y:{paneDragging:T}),onPanZoomStart:(T,Y)=>{const{onViewportChangeStart:K,onMoveStart:I}=k.getState();I==null||I(T,Y),K==null||K(Y)},onPanZoom:(T,Y)=>{const{onViewportChange:K,onMove:I}=k.getState();I==null||I(T,Y),K==null||K(Y)},onPanZoomEnd:(T,Y)=>{const{onViewportChangeEnd:K,onMoveEnd:I}=k.getState();I==null||I(T,Y),K==null||K(Y)}});const{x:te,y:B,zoom:J}=U.current.getViewport();return k.setState({panZoom:U.current,transform:[te,B,J],domNode:R.current.closest(".react-flow")}),()=>{var T;(T=U.current)==null||T.destroy()}}},[]),V.useEffect(()=>{var te;(te=U.current)==null||te.update({onPaneContextMenu:t,zoomOnScroll:l,zoomOnPinch:r,panOnScroll:i,panOnScrollSpeed:s,panOnScrollMode:u,zoomOnDoubleClick:c,panOnDrag:d,zoomActivationKeyPressed:Z,preventScrolling:x,noPanClassName:_,userSelectionActive:H,noWheelClassName:N,lib:D,onTransformChange:L,connectionInProgress:q,selectionOnDrag:z,paneClickDistance:S})},[t,l,r,i,s,u,c,d,Z,x,_,H,N,D,L,q,z,S]),C.jsx("div",{className:"react-flow__renderer",ref:R,style:wu,children:w})}const P3=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function eM(){const{userSelectionActive:t,userSelectionRect:l}=ke(P3,Je);return t&&l?C.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:l.width,height:l.height,transform:`translate(${l.x}px, ${l.y}px)`}}):null}const fd=(t,l)=>r=>{r.target===l.current&&(t==null||t(r))},tM=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,connectionInProgress:t.connection.inProgress,dragging:t.paneDragging});function nM({isSelecting:t,selectionKeyPressed:l,selectionMode:r=Xi.Full,panOnDrag:i,paneClickDistance:s,selectionOnDrag:u,onSelectionStart:c,onSelectionEnd:d,onPaneClick:h,onPaneContextMenu:m,onPaneScroll:y,onPaneMouseEnter:g,onPaneMouseMove:v,onPaneMouseLeave:x,children:w}){const N=Fe(),{userSelectionActive:_,elementsSelectable:E,dragging:M,connectionInProgress:S}=ke(tM,Je),z=E&&(t||_),k=V.useRef(null),R=V.useRef(),H=V.useRef(new Set),D=V.useRef(new Set),q=V.useRef(!1),Z=K=>{if(q.current||S){q.current=!1;return}h==null||h(K),N.getState().resetSelectedElements(),N.setState({nodesSelectionActive:!1})},U=K=>{if(Array.isArray(i)&&(i!=null&&i.includes(2))){K.preventDefault();return}m==null||m(K)},L=y?K=>y(K):void 0,te=K=>{q.current&&(K.stopPropagation(),q.current=!1)},B=K=>{var $,W;const{domNode:I}=N.getState();if(R.current=I==null?void 0:I.getBoundingClientRect(),!R.current)return;const ie=K.target===k.current;if(!ie&&!!K.target.closest(".nokey")||!t||!(u&&ie||l)||K.button!==0||!K.isPrimary)return;(W=($=K.target)==null?void 0:$.setPointerCapture)==null||W.call($,K.pointerId),q.current=!1;const{x:j,y:G}=gn(K.nativeEvent,R.current);N.setState({userSelectionRect:{width:0,height:0,startX:j,startY:G,x:j,y:G}}),ie||(K.stopPropagation(),K.preventDefault())},J=K=>{const{userSelectionRect:I,transform:ie,nodeLookup:O,edgeLookup:X,connectionLookup:j,triggerNodeChanges:G,triggerEdgeChanges:$,defaultEdgeOptions:W,resetSelectedElements:ee}=N.getState();if(!R.current||!I)return;const{x:ne,y:ue}=gn(K.nativeEvent,R.current),{startX:he,startY:ye}=I;if(!q.current){const Se=l?0:s;if(Math.hypot(ne-he,ue-ye)<=Se)return;ee(),c==null||c(K)}q.current=!0;const ge={startX:he,startY:ye,x:neSe.id)),D.current=new Set;const Ae=(W==null?void 0:W.selectable)??!0;for(const Se of H.current){const We=j.get(Se);if(We)for(const{edgeId:$e}of We.values()){const Et=X.get($e);Et&&(Et.selectable??Ae)&&D.current.add($e)}}if(!zy(de,H.current)){const Se=pr(O,H.current,!0);G(Se)}if(!zy(xe,D.current)){const Se=pr(X,D.current);$(Se)}N.setState({userSelectionRect:ge,userSelectionActive:!0,nodesSelectionActive:!1})},T=K=>{var I,ie;K.button===0&&((ie=(I=K.target)==null?void 0:I.releasePointerCapture)==null||ie.call(I,K.pointerId),!_&&K.target===k.current&&N.getState().userSelectionRect&&(Z==null||Z(K)),N.setState({userSelectionActive:!1,userSelectionRect:null}),q.current&&(d==null||d(K),N.setState({nodesSelectionActive:H.current.size>0})))},Y=i===!0||Array.isArray(i)&&i.includes(0);return C.jsxs("div",{className:gt(["react-flow__pane",{draggable:Y,dragging:M,selection:t}]),onClick:z?void 0:fd(Z,k),onContextMenu:fd(U,k),onWheel:fd(L,k),onPointerEnter:z?void 0:g,onPointerMove:z?J:v,onPointerUp:z?T:void 0,onPointerDownCapture:z?B:void 0,onClickCapture:z?te:void 0,onPointerLeave:x,ref:k,style:wu,children:[w,C.jsx(eM,{})]})}function Nh({id:t,store:l,unselect:r=!1,nodeRef:i}){const{addSelectedNodes:s,unselectNodesAndEdges:u,multiSelectionActive:c,nodeLookup:d,onError:h}=l.getState(),m=d.get(t);if(!m){h==null||h("012",zn.error012(t));return}l.setState({nodesSelectionActive:!1}),m.selected?(r||m.selected&&c)&&(u({nodes:[m],edges:[]}),requestAnimationFrame(()=>{var y;return(y=i==null?void 0:i.current)==null?void 0:y.blur()})):s([t])}function l1({nodeRef:t,disabled:l=!1,noDragClassName:r,handleSelector:i,nodeId:s,isSelectable:u,nodeClickDistance:c}){const d=Fe(),[h,m]=V.useState(!1),y=V.useRef();return V.useEffect(()=>{y.current=Vz({getStoreItems:()=>d.getState(),onNodeMouseDown:g=>{Nh({id:g,store:d,nodeRef:t})},onDragStart:()=>{m(!0)},onDragStop:()=>{m(!1)}})},[]),V.useEffect(()=>{if(!(l||!t.current||!y.current))return y.current.update({noDragClassName:r,handleSelector:i,domNode:t.current,isSelectable:u,nodeId:s,nodeClickDistance:c}),()=>{var g;(g=y.current)==null||g.destroy()}},[r,i,l,u,t,s,c]),h}const aM=t=>l=>l.selected&&(l.draggable||t&&typeof l.draggable>"u");function r1(){const t=Fe();return V.useCallback(r=>{const{nodeExtent:i,snapToGrid:s,snapGrid:u,nodesDraggable:c,onError:d,updateNodePositions:h,nodeLookup:m,nodeOrigin:y}=t.getState(),g=new Map,v=aM(c),x=s?u[0]:5,w=s?u[1]:5,N=r.direction.x*x*r.factor,_=r.direction.y*w*r.factor;for(const[,E]of m){if(!v(E))continue;let M={x:E.internals.positionAbsolute.x+N,y:E.internals.positionAbsolute.y+_};s&&(M=Pi(M,u));const{position:S,positionAbsolute:z}=Nb({nodeId:E.id,nextPosition:M,nodeLookup:m,nodeExtent:i,nodeOrigin:y,onError:d});E.position=S,E.internals.positionAbsolute=z,g.set(E.id,E)}h(g)},[])}const Fh=V.createContext(null),lM=Fh.Provider;Fh.Consumer;const i1=()=>V.useContext(Fh),rM=t=>({connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName,rfId:t.rfId}),iM=(t,l,r)=>i=>{const{connectionClickStartHandle:s,connectionMode:u,connection:c}=i,{fromHandle:d,toHandle:h,isValid:m}=c,y=(h==null?void 0:h.nodeId)===t&&(h==null?void 0:h.id)===l&&(h==null?void 0:h.type)===r;return{connectingFrom:(d==null?void 0:d.nodeId)===t&&(d==null?void 0:d.id)===l&&(d==null?void 0:d.type)===r,connectingTo:y,clickConnecting:(s==null?void 0:s.nodeId)===t&&(s==null?void 0:s.id)===l&&(s==null?void 0:s.type)===r,isPossibleEndHandle:u===Sr.Strict?(d==null?void 0:d.type)!==r:t!==(d==null?void 0:d.nodeId)||l!==(d==null?void 0:d.id),connectionInProcess:!!d,clickConnectionInProcess:!!s,valid:y&&m}};function oM({type:t="source",position:l=me.Top,isValidConnection:r,isConnectable:i=!0,isConnectableStart:s=!0,isConnectableEnd:u=!0,id:c,onConnect:d,children:h,className:m,onMouseDown:y,onTouchStart:g,...v},x){var J,T;const w=c||null,N=t==="target",_=Fe(),E=i1(),{connectOnClick:M,noPanClassName:S,rfId:z}=ke(rM,Je),{connectingFrom:k,connectingTo:R,clickConnecting:H,isPossibleEndHandle:D,connectionInProcess:q,clickConnectionInProcess:Z,valid:U}=ke(iM(E,w,t),Je);E||(T=(J=_.getState()).onError)==null||T.call(J,"010",zn.error010());const L=Y=>{const{defaultEdgeOptions:K,onConnect:I,hasDefaultEdges:ie}=_.getState(),O={...K,...Y};if(ie){const{edges:X,setEdges:j}=_.getState();j(Cz(O,X))}I==null||I(O),d==null||d(O)},te=Y=>{if(!E)return;const K=Rb(Y.nativeEvent);if(s&&(K&&Y.button===0||!K)){const I=_.getState();Eh.onPointerDown(Y.nativeEvent,{handleDomNode:Y.currentTarget,autoPanOnConnect:I.autoPanOnConnect,connectionMode:I.connectionMode,connectionRadius:I.connectionRadius,domNode:I.domNode,nodeLookup:I.nodeLookup,lib:I.lib,isTarget:N,handleId:w,nodeId:E,flowId:I.rfId,panBy:I.panBy,cancelConnection:I.cancelConnection,onConnectStart:I.onConnectStart,onConnectEnd:(...ie)=>{var O,X;return(X=(O=_.getState()).onConnectEnd)==null?void 0:X.call(O,...ie)},updateConnection:I.updateConnection,onConnect:L,isValidConnection:r||((...ie)=>{var O,X;return((X=(O=_.getState()).isValidConnection)==null?void 0:X.call(O,...ie))??!0}),getTransform:()=>_.getState().transform,getFromHandle:()=>_.getState().connection.fromHandle,autoPanSpeed:I.autoPanSpeed,dragThreshold:I.connectionDragThreshold})}K?y==null||y(Y):g==null||g(Y)},B=Y=>{const{onClickConnectStart:K,onClickConnectEnd:I,connectionClickStartHandle:ie,connectionMode:O,isValidConnection:X,lib:j,rfId:G,nodeLookup:$,connection:W}=_.getState();if(!E||!ie&&!s)return;if(!ie){K==null||K(Y.nativeEvent,{nodeId:E,handleId:w,handleType:t}),_.setState({connectionClickStartHandle:{nodeId:E,type:t,id:w}});return}const ee=Ob(Y.target),ne=r||X,{connection:ue,isValid:he}=Eh.isValid(Y.nativeEvent,{handle:{nodeId:E,id:w,type:t},connectionMode:O,fromNodeId:ie.nodeId,fromHandleId:ie.id||null,fromType:ie.type,isValidConnection:ne,flowId:G,doc:ee,lib:j,nodeLookup:$});he&&ue&&L(ue);const ye=structuredClone(W);delete ye.inProgress,ye.toPosition=ye.toHandle?ye.toHandle.position:null,I==null||I(Y,ye),_.setState({connectionClickStartHandle:null})};return C.jsx("div",{"data-handleid":w,"data-nodeid":E,"data-handlepos":l,"data-id":`${z}-${E}-${w}-${t}`,className:gt(["react-flow__handle",`react-flow__handle-${l}`,"nodrag",S,m,{source:!N,target:N,connectable:i,connectablestart:s,connectableend:u,clickconnecting:H,connectingfrom:k,connectingto:R,valid:U,connectionindicator:i&&(!q||D)&&(q||Z?u:s)}]),onMouseDown:te,onTouchStart:te,onClick:M?B:void 0,ref:x,...v,children:h})}const Ft=V.memo(n1(oM));function sM({data:t,isConnectable:l,sourcePosition:r=me.Bottom}){return C.jsxs(C.Fragment,{children:[t==null?void 0:t.label,C.jsx(Ft,{type:"source",position:r,isConnectable:l})]})}function uM({data:t,isConnectable:l,targetPosition:r=me.Top,sourcePosition:i=me.Bottom}){return C.jsxs(C.Fragment,{children:[C.jsx(Ft,{type:"target",position:r,isConnectable:l}),t==null?void 0:t.label,C.jsx(Ft,{type:"source",position:i,isConnectable:l})]})}function cM(){return null}function fM({data:t,isConnectable:l,targetPosition:r=me.Top}){return C.jsxs(C.Fragment,{children:[C.jsx(Ft,{type:"target",position:r,isConnectable:l}),t==null?void 0:t.label]})}const lu={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},av={input:sM,default:uM,output:fM,group:cM};function dM(t){var l,r,i,s;return t.internals.handleBounds===void 0?{width:t.width??t.initialWidth??((l=t.style)==null?void 0:l.width),height:t.height??t.initialHeight??((r=t.style)==null?void 0:r.height)}:{width:t.width??((i=t.style)==null?void 0:i.width),height:t.height??((s=t.style)==null?void 0:s.height)}}const hM=t=>{const{width:l,height:r,x:i,y:s}=Wi(t.nodeLookup,{filter:u=>!!u.selected});return{width:hn(l)?l:null,height:hn(r)?r:null,userSelectionActive:t.userSelectionActive,transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]}) translate(${i}px,${s}px)`}};function gM({onSelectionContextMenu:t,noPanClassName:l,disableKeyboardA11y:r}){const i=Fe(),{width:s,height:u,transformString:c,userSelectionActive:d}=ke(hM,Je),h=r1(),m=V.useRef(null);V.useEffect(()=>{var x;r||(x=m.current)==null||x.focus({preventScroll:!0})},[r]);const y=!d&&s!==null&&u!==null;if(l1({nodeRef:m,disabled:!y}),!y)return null;const g=t?x=>{const w=i.getState().nodes.filter(N=>N.selected);t(x,w)}:void 0,v=x=>{Object.prototype.hasOwnProperty.call(lu,x.key)&&(x.preventDefault(),h({direction:lu[x.key],factor:x.shiftKey?4:1}))};return C.jsx("div",{className:gt(["react-flow__nodesselection","react-flow__container",l]),style:{transform:c},children:C.jsx("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:r?void 0:-1,onKeyDown:r?void 0:v,style:{width:s,height:u}})})}const lv=typeof window<"u"?window:void 0,pM=t=>({nodesSelectionActive:t.nodesSelectionActive,userSelectionActive:t.userSelectionActive});function o1({children:t,onPaneClick:l,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:u,onPaneScroll:c,paneClickDistance:d,deleteKeyCode:h,selectionKeyCode:m,selectionOnDrag:y,selectionMode:g,onSelectionStart:v,onSelectionEnd:x,multiSelectionKeyCode:w,panActivationKeyCode:N,zoomActivationKeyCode:_,elementsSelectable:E,zoomOnScroll:M,zoomOnPinch:S,panOnScroll:z,panOnScrollSpeed:k,panOnScrollMode:R,zoomOnDoubleClick:H,panOnDrag:D,defaultViewport:q,translateExtent:Z,minZoom:U,maxZoom:L,preventScrolling:te,onSelectionContextMenu:B,noWheelClassName:J,noPanClassName:T,disableKeyboardA11y:Y,onViewportChange:K,isControlledViewport:I}){const{nodesSelectionActive:ie,userSelectionActive:O}=ke(pM,Je),X=Zi(m,{target:lv}),j=Zi(N,{target:lv}),G=j||D,$=j||z,W=y&&G!==!0,ee=X||O||W;return I3({deleteKeyCode:h,multiSelectionKeyCode:w}),C.jsx(W3,{onPaneContextMenu:u,elementsSelectable:E,zoomOnScroll:M,zoomOnPinch:S,panOnScroll:$,panOnScrollSpeed:k,panOnScrollMode:R,zoomOnDoubleClick:H,panOnDrag:!X&&G,defaultViewport:q,translateExtent:Z,minZoom:U,maxZoom:L,zoomActivationKeyCode:_,preventScrolling:te,noWheelClassName:J,noPanClassName:T,onViewportChange:K,isControlledViewport:I,paneClickDistance:d,selectionOnDrag:W,children:C.jsxs(nM,{onSelectionStart:v,onSelectionEnd:x,onPaneClick:l,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:u,onPaneScroll:c,panOnDrag:G,isSelecting:!!ee,selectionMode:g,selectionKeyPressed:X,paneClickDistance:d,selectionOnDrag:W,children:[t,ie&&C.jsx(gM,{onSelectionContextMenu:B,noPanClassName:T,disableKeyboardA11y:Y})]})})}o1.displayName="FlowRenderer";const mM=V.memo(o1),yM=t=>l=>t?Vh(l.nodeLookup,{x:0,y:0,width:l.width,height:l.height},l.transform,!0).map(r=>r.id):Array.from(l.nodeLookup.keys());function vM(t){return ke(V.useCallback(yM(t),[t]),Je)}const xM=t=>t.updateNodeInternals;function bM(){const t=ke(xM),[l]=V.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(r=>{const i=new Map;r.forEach(s=>{const u=s.target.getAttribute("data-id");i.set(u,{id:u,nodeElement:s.target,force:!0})}),t(i)}));return V.useEffect(()=>()=>{l==null||l.disconnect()},[l]),l}function wM({node:t,nodeType:l,hasDimensions:r,resizeObserver:i}){const s=Fe(),u=V.useRef(null),c=V.useRef(null),d=V.useRef(t.sourcePosition),h=V.useRef(t.targetPosition),m=V.useRef(l),y=r&&!!t.internals.handleBounds;return V.useEffect(()=>{u.current&&!t.hidden&&(!y||c.current!==u.current)&&(c.current&&(i==null||i.unobserve(c.current)),i==null||i.observe(u.current),c.current=u.current)},[y,t.hidden]),V.useEffect(()=>()=>{c.current&&(i==null||i.unobserve(c.current),c.current=null)},[]),V.useEffect(()=>{if(u.current){const g=m.current!==l,v=d.current!==t.sourcePosition,x=h.current!==t.targetPosition;(g||v||x)&&(m.current=l,d.current=t.sourcePosition,h.current=t.targetPosition,s.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:u.current,force:!0}]])))}},[t.id,l,t.sourcePosition,t.targetPosition]),u}function _M({id:t,onClick:l,onMouseEnter:r,onMouseMove:i,onMouseLeave:s,onContextMenu:u,onDoubleClick:c,nodesDraggable:d,elementsSelectable:h,nodesConnectable:m,nodesFocusable:y,resizeObserver:g,noDragClassName:v,noPanClassName:x,disableKeyboardA11y:w,rfId:N,nodeTypes:_,nodeClickDistance:E,onError:M}){const{node:S,internals:z,isParent:k}=ke(ne=>{const ue=ne.nodeLookup.get(t),he=ne.parentLookup.has(t);return{node:ue,internals:ue.internals,isParent:he}},Je);let R=S.type||"default",H=(_==null?void 0:_[R])||av[R];H===void 0&&(M==null||M("003",zn.error003(R)),R="default",H=(_==null?void 0:_.default)||av.default);const D=!!(S.draggable||d&&typeof S.draggable>"u"),q=!!(S.selectable||h&&typeof S.selectable>"u"),Z=!!(S.connectable||m&&typeof S.connectable>"u"),U=!!(S.focusable||y&&typeof S.focusable>"u"),L=Fe(),te=Ab(S),B=wM({node:S,nodeType:R,hasDimensions:te,resizeObserver:g}),J=l1({nodeRef:B,disabled:S.hidden||!D,noDragClassName:v,handleSelector:S.dragHandle,nodeId:t,isSelectable:q,nodeClickDistance:E}),T=r1();if(S.hidden)return null;const Y=la(S),K=dM(S),I=q||D||l||r||i||s,ie=r?ne=>r(ne,{...z.userNode}):void 0,O=i?ne=>i(ne,{...z.userNode}):void 0,X=s?ne=>s(ne,{...z.userNode}):void 0,j=u?ne=>u(ne,{...z.userNode}):void 0,G=c?ne=>c(ne,{...z.userNode}):void 0,$=ne=>{const{selectNodesOnDrag:ue,nodeDragThreshold:he}=L.getState();q&&(!ue||!D||he>0)&&Nh({id:t,store:L,nodeRef:B}),l&&l(ne,{...z.userNode})},W=ne=>{if(!(jb(ne.nativeEvent)||w)){if(bb.includes(ne.key)&&q){const ue=ne.key==="Escape";Nh({id:t,store:L,unselect:ue,nodeRef:B})}else if(D&&S.selected&&Object.prototype.hasOwnProperty.call(lu,ne.key)){ne.preventDefault();const{ariaLabelConfig:ue}=L.getState();L.setState({ariaLiveMessage:ue["node.a11yDescription.ariaLiveMessage"]({direction:ne.key.replace("Arrow","").toLowerCase(),x:~~z.positionAbsolute.x,y:~~z.positionAbsolute.y})}),T({direction:lu[ne.key],factor:ne.shiftKey?4:1})}}},ee=()=>{var xe;if(w||!((xe=B.current)!=null&&xe.matches(":focus-visible")))return;const{transform:ne,width:ue,height:he,autoPanOnNodeFocus:ye,setCenter:ge}=L.getState();if(!ye)return;Vh(new Map([[t,S]]),{x:0,y:0,width:ue,height:he},ne,!0).length>0||ge(S.position.x+Y.width/2,S.position.y+Y.height/2,{zoom:ne[2]})};return C.jsx("div",{className:gt(["react-flow__node",`react-flow__node-${R}`,{[x]:D},S.className,{selected:S.selected,selectable:q,parent:k,draggable:D,dragging:J}]),ref:B,style:{zIndex:z.z,transform:`translate(${z.positionAbsolute.x}px,${z.positionAbsolute.y}px)`,pointerEvents:I?"all":"none",visibility:te?"visible":"hidden",...S.style,...K},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:ie,onMouseMove:O,onMouseLeave:X,onContextMenu:j,onClick:$,onDoubleClick:G,onKeyDown:U?W:void 0,tabIndex:U?0:void 0,onFocus:U?ee:void 0,role:S.ariaRole??(U?"group":void 0),"aria-roledescription":"node","aria-describedby":w?void 0:`${Jb}-${N}`,"aria-label":S.ariaLabel,...S.domAttributes,children:C.jsx(lM,{value:t,children:C.jsx(H,{id:t,data:S.data,type:R,positionAbsoluteX:z.positionAbsolute.x,positionAbsoluteY:z.positionAbsolute.y,selected:S.selected??!1,selectable:q,draggable:D,deletable:S.deletable??!0,isConnectable:Z,sourcePosition:S.sourcePosition,targetPosition:S.targetPosition,dragging:J,dragHandle:S.dragHandle,zIndex:z.z,parentId:S.parentId,...Y})})})}var SM=V.memo(_M);const EM=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,onError:t.onError});function s1(t){const{nodesDraggable:l,nodesConnectable:r,nodesFocusable:i,elementsSelectable:s,onError:u}=ke(EM,Je),c=vM(t.onlyRenderVisibleElements),d=bM();return C.jsx("div",{className:"react-flow__nodes",style:wu,children:c.map(h=>C.jsx(SM,{id:h,nodeTypes:t.nodeTypes,nodeExtent:t.nodeExtent,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,resizeObserver:d,nodesDraggable:l,nodesConnectable:r,nodesFocusable:i,elementsSelectable:s,nodeClickDistance:t.nodeClickDistance,onError:u},h))})}s1.displayName="NodeRenderer";const NM=V.memo(s1);function CM(t){return ke(V.useCallback(r=>{if(!t)return r.edges.map(s=>s.id);const i=[];if(r.width&&r.height)for(const s of r.edges){const u=r.nodeLookup.get(s.source),c=r.nodeLookup.get(s.target);u&&c&&Sz({sourceNode:u,targetNode:c,width:r.width,height:r.height,transform:r.transform})&&i.push(s.id)}return i},[t]),Je)}const zM=({color:t="none",strokeWidth:l=1})=>{const r={strokeWidth:l,...t&&{stroke:t}};return C.jsx("polyline",{className:"arrow",style:r,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},MM=({color:t="none",strokeWidth:l=1})=>{const r={strokeWidth:l,...t&&{stroke:t,fill:t}};return C.jsx("polyline",{className:"arrowclosed",style:r,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},rv={[tu.Arrow]:zM,[tu.ArrowClosed]:MM};function AM(t){const l=Fe();return V.useMemo(()=>{var s,u;return Object.prototype.hasOwnProperty.call(rv,t)?rv[t]:((u=(s=l.getState()).onError)==null||u.call(s,"009",zn.error009(t)),null)},[t])}const TM=({id:t,type:l,color:r,width:i=12.5,height:s=12.5,markerUnits:u="strokeWidth",strokeWidth:c,orient:d="auto-start-reverse"})=>{const h=AM(l);return h?C.jsx("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${i}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:u,orient:d,refX:"0",refY:"0",children:C.jsx(h,{color:r,strokeWidth:c})}):null},u1=({defaultColor:t,rfId:l})=>{const r=ke(u=>u.edges),i=ke(u=>u.defaultEdgeOptions),s=V.useMemo(()=>Oz(r,{id:l,defaultColor:t,defaultMarkerStart:i==null?void 0:i.markerStart,defaultMarkerEnd:i==null?void 0:i.markerEnd}),[r,i,l,t]);return s.length?C.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:C.jsx("defs",{children:s.map(u=>C.jsx(TM,{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};u1.displayName="MarkerDefinitions";var OM=V.memo(u1);function c1({x:t,y:l,label:r,labelStyle:i,labelShowBg:s=!0,labelBgStyle:u,labelBgPadding:c=[2,4],labelBgBorderRadius:d=2,children:h,className:m,...y}){const[g,v]=V.useState({x:1,y:0,width:0,height:0}),x=gt(["react-flow__edge-textwrapper",m]),w=V.useRef(null);return V.useEffect(()=>{if(w.current){const N=w.current.getBBox();v({x:N.x,y:N.y,width:N.width,height:N.height})}},[r]),r?C.jsxs("g",{transform:`translate(${t-g.width/2} ${l-g.height/2})`,className:x,visibility:g.width?"visible":"hidden",...y,children:[s&&C.jsx("rect",{width:g.width+2*c[0],x:-c[0],y:-c[1],height:g.height+2*c[1],className:"react-flow__edge-textbg",style:u,rx:d,ry:d}),C.jsx("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:w,style:i,children:r}),h]}):null}c1.displayName="EdgeText";const jM=V.memo(c1);function no({path:t,labelX:l,labelY:r,label:i,labelStyle:s,labelShowBg:u,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,interactionWidth:m=20,...y}){return C.jsxs(C.Fragment,{children:[C.jsx("path",{...y,d:t,fill:"none",className:gt(["react-flow__edge-path",y.className])}),m?C.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}):null,i&&hn(l)&&hn(r)?C.jsx(jM,{x:l,y:r,label:i,labelStyle:s,labelShowBg:u,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h}):null]})}function iv({pos:t,x1:l,y1:r,x2:i,y2:s}){return t===me.Left||t===me.Right?[.5*(l+i),r]:[l,.5*(r+s)]}function f1({sourceX:t,sourceY:l,sourcePosition:r=me.Bottom,targetX:i,targetY:s,targetPosition:u=me.Top}){const[c,d]=iv({pos:r,x1:t,y1:l,x2:i,y2:s}),[h,m]=iv({pos:u,x1:i,y1:s,x2:t,y2:l}),[y,g,v,x]=Db({sourceX:t,sourceY:l,targetX:i,targetY:s,sourceControlX:c,sourceControlY:d,targetControlX:h,targetControlY:m});return[`M${t},${l} C${c},${d} ${h},${m} ${i},${s}`,y,g,v,x]}function d1(t){return V.memo(({id:l,sourceX:r,sourceY:i,targetX:s,targetY:u,sourcePosition:c,targetPosition:d,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:x,style:w,markerEnd:N,markerStart:_,interactionWidth:E})=>{const[M,S,z]=f1({sourceX:r,sourceY:i,sourcePosition:c,targetX:s,targetY:u,targetPosition:d}),k=t.isInternal?void 0:l;return C.jsx(no,{id:k,path:M,labelX:S,labelY:z,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:x,style:w,markerEnd:N,markerStart:_,interactionWidth:E})})}const RM=d1({isInternal:!1}),h1=d1({isInternal:!0});RM.displayName="SimpleBezierEdge";h1.displayName="SimpleBezierEdgeInternal";function g1(t){return V.memo(({id:l,sourceX:r,sourceY:i,targetX:s,targetY:u,label:c,labelStyle:d,labelShowBg:h,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:g,style:v,sourcePosition:x=me.Bottom,targetPosition:w=me.Top,markerEnd:N,markerStart:_,pathOptions:E,interactionWidth:M})=>{const[S,z,k]=wh({sourceX:r,sourceY:i,sourcePosition:x,targetX:s,targetY:u,targetPosition:w,borderRadius:E==null?void 0:E.borderRadius,offset:E==null?void 0:E.offset,stepPosition:E==null?void 0:E.stepPosition}),R=t.isInternal?void 0:l;return C.jsx(no,{id:R,path:S,labelX:z,labelY:k,label:c,labelStyle:d,labelShowBg:h,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:g,style:v,markerEnd:N,markerStart:_,interactionWidth:M})})}const p1=g1({isInternal:!1}),m1=g1({isInternal:!0});p1.displayName="SmoothStepEdge";m1.displayName="SmoothStepEdgeInternal";function y1(t){return V.memo(({id:l,...r})=>{var s;const i=t.isInternal?void 0:l;return C.jsx(p1,{...r,id:i,pathOptions:V.useMemo(()=>{var u;return{borderRadius:0,offset:(u=r.pathOptions)==null?void 0:u.offset}},[(s=r.pathOptions)==null?void 0:s.offset])})})}const DM=y1({isInternal:!1}),v1=y1({isInternal:!0});DM.displayName="StepEdge";v1.displayName="StepEdgeInternal";function x1(t){return V.memo(({id:l,sourceX:r,sourceY:i,targetX:s,targetY:u,label:c,labelStyle:d,labelShowBg:h,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:g,style:v,markerEnd:x,markerStart:w,interactionWidth:N})=>{const[_,E,M]=Hb({sourceX:r,sourceY:i,targetX:s,targetY:u}),S=t.isInternal?void 0:l;return C.jsx(no,{id:S,path:_,labelX:E,labelY:M,label:c,labelStyle:d,labelShowBg:h,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:g,style:v,markerEnd:x,markerStart:w,interactionWidth:N})})}const kM=x1({isInternal:!1}),b1=x1({isInternal:!0});kM.displayName="StraightEdge";b1.displayName="StraightEdgeInternal";function w1(t){return V.memo(({id:l,sourceX:r,sourceY:i,targetX:s,targetY:u,sourcePosition:c=me.Bottom,targetPosition:d=me.Top,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:x,style:w,markerEnd:N,markerStart:_,pathOptions:E,interactionWidth:M})=>{const[S,z,k]=$h({sourceX:r,sourceY:i,sourcePosition:c,targetX:s,targetY:u,targetPosition:d,curvature:E==null?void 0:E.curvature}),R=t.isInternal?void 0:l;return C.jsx(no,{id:R,path:S,labelX:z,labelY:k,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:x,style:w,markerEnd:N,markerStart:_,interactionWidth:M})})}const HM=w1({isInternal:!1}),_1=w1({isInternal:!0});HM.displayName="BezierEdge";_1.displayName="BezierEdgeInternal";const ov={default:_1,straight:b1,step:v1,smoothstep:m1,simplebezier:h1},sv={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},LM=(t,l,r)=>r===me.Left?t-l:r===me.Right?t+l:t,BM=(t,l,r)=>r===me.Top?t-l:r===me.Bottom?t+l:t,uv="react-flow__edgeupdater";function cv({position:t,centerX:l,centerY:r,radius:i=10,onMouseDown:s,onMouseEnter:u,onMouseOut:c,type:d}){return C.jsx("circle",{onMouseDown:s,onMouseEnter:u,onMouseOut:c,className:gt([uv,`${uv}-${d}`]),cx:LM(l,i,t),cy:BM(r,i,t),r:i,stroke:"transparent",fill:"transparent"})}function qM({isReconnectable:t,reconnectRadius:l,edge:r,sourceX:i,sourceY:s,targetX:u,targetY:c,sourcePosition:d,targetPosition:h,onReconnect:m,onReconnectStart:y,onReconnectEnd:g,setReconnecting:v,setUpdateHover:x}){const w=Fe(),N=(z,k)=>{if(z.button!==0)return;const{autoPanOnConnect:R,domNode:H,connectionMode:D,connectionRadius:q,lib:Z,onConnectStart:U,cancelConnection:L,nodeLookup:te,rfId:B,panBy:J,updateConnection:T}=w.getState(),Y=k.type==="target",K=(O,X)=>{v(!1),g==null||g(O,r,k.type,X)},I=O=>m==null?void 0:m(r,O),ie=(O,X)=>{v(!0),y==null||y(z,r,k.type),U==null||U(O,X)};Eh.onPointerDown(z.nativeEvent,{autoPanOnConnect:R,connectionMode:D,connectionRadius:q,domNode:H,handleId:k.id,nodeId:k.nodeId,nodeLookup:te,isTarget:Y,edgeUpdaterType:k.type,lib:Z,flowId:B,cancelConnection:L,panBy:J,isValidConnection:(...O)=>{var X,j;return((j=(X=w.getState()).isValidConnection)==null?void 0:j.call(X,...O))??!0},onConnect:I,onConnectStart:ie,onConnectEnd:(...O)=>{var X,j;return(j=(X=w.getState()).onConnectEnd)==null?void 0:j.call(X,...O)},onReconnectEnd:K,updateConnection:T,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,dragThreshold:w.getState().connectionDragThreshold,handleDomNode:z.currentTarget})},_=z=>N(z,{nodeId:r.target,id:r.targetHandle??null,type:"target"}),E=z=>N(z,{nodeId:r.source,id:r.sourceHandle??null,type:"source"}),M=()=>x(!0),S=()=>x(!1);return C.jsxs(C.Fragment,{children:[(t===!0||t==="source")&&C.jsx(cv,{position:d,centerX:i,centerY:s,radius:l,onMouseDown:_,onMouseEnter:M,onMouseOut:S,type:"source"}),(t===!0||t==="target")&&C.jsx(cv,{position:h,centerX:u,centerY:c,radius:l,onMouseDown:E,onMouseEnter:M,onMouseOut:S,type:"target"})]})}function UM({id:t,edgesFocusable:l,edgesReconnectable:r,elementsSelectable:i,onClick:s,onDoubleClick:u,onContextMenu:c,onMouseEnter:d,onMouseMove:h,onMouseLeave:m,reconnectRadius:y,onReconnect:g,onReconnectStart:v,onReconnectEnd:x,rfId:w,edgeTypes:N,noPanClassName:_,onError:E,disableKeyboardA11y:M}){let S=ke(ge=>ge.edgeLookup.get(t));const z=ke(ge=>ge.defaultEdgeOptions);S=z?{...z,...S}:S;let k=S.type||"default",R=(N==null?void 0:N[k])||ov[k];R===void 0&&(E==null||E("011",zn.error011(k)),k="default",R=(N==null?void 0:N.default)||ov.default);const H=!!(S.focusable||l&&typeof S.focusable>"u"),D=typeof g<"u"&&(S.reconnectable||r&&typeof S.reconnectable>"u"),q=!!(S.selectable||i&&typeof S.selectable>"u"),Z=V.useRef(null),[U,L]=V.useState(!1),[te,B]=V.useState(!1),J=Fe(),{zIndex:T,sourceX:Y,sourceY:K,targetX:I,targetY:ie,sourcePosition:O,targetPosition:X}=ke(V.useCallback(ge=>{const de=ge.nodeLookup.get(S.source),xe=ge.nodeLookup.get(S.target);if(!de||!xe)return{zIndex:S.zIndex,...sv};const Ae=Tz({id:t,sourceNode:de,targetNode:xe,sourceHandle:S.sourceHandle||null,targetHandle:S.targetHandle||null,connectionMode:ge.connectionMode,onError:E});return{zIndex:_z({selected:S.selected,zIndex:S.zIndex,sourceNode:de,targetNode:xe,elevateOnSelect:ge.elevateEdgesOnSelect,zIndexMode:ge.zIndexMode}),...Ae||sv}},[S.source,S.target,S.sourceHandle,S.targetHandle,S.selected,S.zIndex]),Je),j=V.useMemo(()=>S.markerStart?`url('#${_h(S.markerStart,w)}')`:void 0,[S.markerStart,w]),G=V.useMemo(()=>S.markerEnd?`url('#${_h(S.markerEnd,w)}')`:void 0,[S.markerEnd,w]);if(S.hidden||Y===null||K===null||I===null||ie===null)return null;const $=ge=>{var Se;const{addSelectedEdges:de,unselectNodesAndEdges:xe,multiSelectionActive:Ae}=J.getState();q&&(J.setState({nodesSelectionActive:!1}),S.selected&&Ae?(xe({nodes:[],edges:[S]}),(Se=Z.current)==null||Se.blur()):de([t])),s&&s(ge,S)},W=u?ge=>{u(ge,{...S})}:void 0,ee=c?ge=>{c(ge,{...S})}:void 0,ne=d?ge=>{d(ge,{...S})}:void 0,ue=h?ge=>{h(ge,{...S})}:void 0,he=m?ge=>{m(ge,{...S})}:void 0,ye=ge=>{var de;if(!M&&bb.includes(ge.key)&&q){const{unselectNodesAndEdges:xe,addSelectedEdges:Ae}=J.getState();ge.key==="Escape"?((de=Z.current)==null||de.blur(),xe({edges:[S]})):Ae([t])}};return C.jsx("svg",{style:{zIndex:T},children:C.jsxs("g",{className:gt(["react-flow__edge",`react-flow__edge-${k}`,S.className,_,{selected:S.selected,animated:S.animated,inactive:!q&&!s,updating:U,selectable:q}]),onClick:$,onDoubleClick:W,onContextMenu:ee,onMouseEnter:ne,onMouseMove:ue,onMouseLeave:he,onKeyDown:H?ye:void 0,tabIndex:H?0:void 0,role:S.ariaRole??(H?"group":"img"),"aria-roledescription":"edge","data-id":t,"data-testid":`rf__edge-${t}`,"aria-label":S.ariaLabel===null?void 0:S.ariaLabel||`Edge from ${S.source} to ${S.target}`,"aria-describedby":H?`${Fb}-${w}`:void 0,ref:Z,...S.domAttributes,children:[!te&&C.jsx(R,{id:t,source:S.source,target:S.target,type:S.type,selected:S.selected,animated:S.animated,selectable:q,deletable:S.deletable??!0,label:S.label,labelStyle:S.labelStyle,labelShowBg:S.labelShowBg,labelBgStyle:S.labelBgStyle,labelBgPadding:S.labelBgPadding,labelBgBorderRadius:S.labelBgBorderRadius,sourceX:Y,sourceY:K,targetX:I,targetY:ie,sourcePosition:O,targetPosition:X,data:S.data,style:S.style,sourceHandleId:S.sourceHandle,targetHandleId:S.targetHandle,markerStart:j,markerEnd:G,pathOptions:"pathOptions"in S?S.pathOptions:void 0,interactionWidth:S.interactionWidth}),D&&C.jsx(qM,{edge:S,isReconnectable:D,reconnectRadius:y,onReconnect:g,onReconnectStart:v,onReconnectEnd:x,sourceX:Y,sourceY:K,targetX:I,targetY:ie,sourcePosition:O,targetPosition:X,setUpdateHover:L,setReconnecting:B})]})})}var GM=V.memo(UM);const VM=t=>({edgesFocusable:t.edgesFocusable,edgesReconnectable:t.edgesReconnectable,elementsSelectable:t.elementsSelectable,connectionMode:t.connectionMode,onError:t.onError});function S1({defaultMarkerColor:t,onlyRenderVisibleElements:l,rfId:r,edgeTypes:i,noPanClassName:s,onReconnect:u,onEdgeContextMenu:c,onEdgeMouseEnter:d,onEdgeMouseMove:h,onEdgeMouseLeave:m,onEdgeClick:y,reconnectRadius:g,onEdgeDoubleClick:v,onReconnectStart:x,onReconnectEnd:w,disableKeyboardA11y:N}){const{edgesFocusable:_,edgesReconnectable:E,elementsSelectable:M,onError:S}=ke(VM,Je),z=CM(l);return C.jsxs("div",{className:"react-flow__edges",children:[C.jsx(OM,{defaultColor:t,rfId:r}),z.map(k=>C.jsx(GM,{id:k,edgesFocusable:_,edgesReconnectable:E,elementsSelectable:M,noPanClassName:s,onReconnect:u,onContextMenu:c,onMouseEnter:d,onMouseMove:h,onMouseLeave:m,onClick:y,reconnectRadius:g,onDoubleClick:v,onReconnectStart:x,onReconnectEnd:w,rfId:r,onError:S,edgeTypes:i,disableKeyboardA11y:N},k))]})}S1.displayName="EdgeRenderer";const YM=V.memo(S1),XM=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function $M({children:t}){const l=ke(XM);return C.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:l},children:t})}function QM(t){const l=to(),r=V.useRef(!1);V.useEffect(()=>{!r.current&&l.viewportInitialized&&t&&(setTimeout(()=>t(l),1),r.current=!0)},[t,l.viewportInitialized])}const ZM=t=>{var l;return(l=t.panZoom)==null?void 0:l.syncViewport};function KM(t){const l=ke(ZM),r=Fe();return V.useEffect(()=>{t&&(l==null||l(t),r.setState({transform:[t.x,t.y,t.zoom]}))},[t,l]),null}function IM(t){return t.connection.inProgress?{...t.connection,to:eo(t.connection.to,t.transform)}:{...t.connection}}function JM(t){return IM}function FM(t){const l=JM();return ke(l,Je)}const WM=t=>({nodesConnectable:t.nodesConnectable,isValid:t.connection.isValid,inProgress:t.connection.inProgress,width:t.width,height:t.height});function PM({containerStyle:t,style:l,type:r,component:i}){const{nodesConnectable:s,width:u,height:c,isValid:d,inProgress:h}=ke(WM,Je);return!(u&&s&&h)?null:C.jsx("svg",{style:t,width:u,height:c,className:"react-flow__connectionline react-flow__container",children:C.jsx("g",{className:gt(["react-flow__connection",Sb(d)]),children:C.jsx(E1,{style:l,type:r,CustomComponent:i,isValid:d})})})}const E1=({style:t,type:l=Ua.Bezier,CustomComponent:r,isValid:i})=>{const{inProgress:s,from:u,fromNode:c,fromHandle:d,fromPosition:h,to:m,toNode:y,toHandle:g,toPosition:v,pointer:x}=FM();if(!s)return;if(r)return C.jsx(r,{connectionLineType:l,connectionLineStyle:t,fromNode:c,fromHandle:d,fromX:u.x,fromY:u.y,toX:m.x,toY:m.y,fromPosition:h,toPosition:v,connectionStatus:Sb(i),toNode:y,toHandle:g,pointer:x});let w="";const N={sourceX:u.x,sourceY:u.y,sourcePosition:h,targetX:m.x,targetY:m.y,targetPosition:v};switch(l){case Ua.Bezier:[w]=$h(N);break;case Ua.SimpleBezier:[w]=f1(N);break;case Ua.Step:[w]=wh({...N,borderRadius:0});break;case Ua.SmoothStep:[w]=wh(N);break;default:[w]=Hb(N)}return C.jsx("path",{d:w,fill:"none",className:"react-flow__connection-path",style:t})};E1.displayName="ConnectionLine";const eA={};function fv(t=eA){V.useRef(t),Fe(),V.useEffect(()=>{},[t])}function tA(){Fe(),V.useRef(!1),V.useEffect(()=>{},[])}function N1({nodeTypes:t,edgeTypes:l,onInit:r,onNodeClick:i,onEdgeClick:s,onNodeDoubleClick:u,onEdgeDoubleClick:c,onNodeMouseEnter:d,onNodeMouseMove:h,onNodeMouseLeave:m,onNodeContextMenu:y,onSelectionContextMenu:g,onSelectionStart:v,onSelectionEnd:x,connectionLineType:w,connectionLineStyle:N,connectionLineComponent:_,connectionLineContainerStyle:E,selectionKeyCode:M,selectionOnDrag:S,selectionMode:z,multiSelectionKeyCode:k,panActivationKeyCode:R,zoomActivationKeyCode:H,deleteKeyCode:D,onlyRenderVisibleElements:q,elementsSelectable:Z,defaultViewport:U,translateExtent:L,minZoom:te,maxZoom:B,preventScrolling:J,defaultMarkerColor:T,zoomOnScroll:Y,zoomOnPinch:K,panOnScroll:I,panOnScrollSpeed:ie,panOnScrollMode:O,zoomOnDoubleClick:X,panOnDrag:j,onPaneClick:G,onPaneMouseEnter:$,onPaneMouseMove:W,onPaneMouseLeave:ee,onPaneScroll:ne,onPaneContextMenu:ue,paneClickDistance:he,nodeClickDistance:ye,onEdgeContextMenu:ge,onEdgeMouseEnter:de,onEdgeMouseMove:xe,onEdgeMouseLeave:Ae,reconnectRadius:Se,onReconnect:We,onReconnectStart:$e,onReconnectEnd:Et,noDragClassName:Ut,noWheelClassName:zt,noPanClassName:vn,disableKeyboardA11y:An,nodeExtent:vt,rfId:_l,viewport:Tn,onViewportChange:ra}){return fv(t),fv(l),tA(),QM(r),KM(Tn),C.jsx(mM,{onPaneClick:G,onPaneMouseEnter:$,onPaneMouseMove:W,onPaneMouseLeave:ee,onPaneContextMenu:ue,onPaneScroll:ne,paneClickDistance:he,deleteKeyCode:D,selectionKeyCode:M,selectionOnDrag:S,selectionMode:z,onSelectionStart:v,onSelectionEnd:x,multiSelectionKeyCode:k,panActivationKeyCode:R,zoomActivationKeyCode:H,elementsSelectable:Z,zoomOnScroll:Y,zoomOnPinch:K,zoomOnDoubleClick:X,panOnScroll:I,panOnScrollSpeed:ie,panOnScrollMode:O,panOnDrag:j,defaultViewport:U,translateExtent:L,minZoom:te,maxZoom:B,onSelectionContextMenu:g,preventScrolling:J,noDragClassName:Ut,noWheelClassName:zt,noPanClassName:vn,disableKeyboardA11y:An,onViewportChange:ra,isControlledViewport:!!Tn,children:C.jsxs($M,{children:[C.jsx(YM,{edgeTypes:l,onEdgeClick:s,onEdgeDoubleClick:c,onReconnect:We,onReconnectStart:$e,onReconnectEnd:Et,onlyRenderVisibleElements:q,onEdgeContextMenu:ge,onEdgeMouseEnter:de,onEdgeMouseMove:xe,onEdgeMouseLeave:Ae,reconnectRadius:Se,defaultMarkerColor:T,noPanClassName:vn,disableKeyboardA11y:An,rfId:_l}),C.jsx(PM,{style:N,type:w,component:_,containerStyle:E}),C.jsx("div",{className:"react-flow__edgelabel-renderer"}),C.jsx(NM,{nodeTypes:t,onNodeClick:i,onNodeDoubleClick:u,onNodeMouseEnter:d,onNodeMouseMove:h,onNodeMouseLeave:m,onNodeContextMenu:y,nodeClickDistance:ye,onlyRenderVisibleElements:q,noPanClassName:vn,noDragClassName:Ut,disableKeyboardA11y:An,nodeExtent:vt,rfId:_l}),C.jsx("div",{className:"react-flow__viewport-portal"})]})})}N1.displayName="GraphView";const nA=V.memo(N1),dv=({nodes:t,edges:l,defaultNodes:r,defaultEdges:i,width:s,height:u,fitView:c,fitViewOptions:d,minZoom:h=.5,maxZoom:m=2,nodeOrigin:y,nodeExtent:g,zIndexMode:v="basic"}={})=>{const x=new Map,w=new Map,N=new Map,_=new Map,E=i??l??[],M=r??t??[],S=y??[0,0],z=g??Yi;qb(N,_,E);const k=Sh(M,x,w,{nodeOrigin:S,nodeExtent:z,zIndexMode:v});let R=[0,0,1];if(c&&s&&u){const H=Wi(x,{filter:U=>!!((U.width||U.initialWidth)&&(U.height||U.initialHeight))}),{x:D,y:q,zoom:Z}=Yh(H,s,u,h,m,(d==null?void 0:d.padding)??.1);R=[D,q,Z]}return{rfId:"1",width:s??0,height:u??0,transform:R,nodes:M,nodesInitialized:k,nodeLookup:x,parentLookup:w,edges:E,edgeLookup:_,connectionLookup:N,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:r!==void 0,hasDefaultEdges:i!==void 0,panZoom:null,minZoom:h,maxZoom:m,translateExtent:Yi,nodeExtent:z,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Sr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:S,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:c??!1,fitViewOptions:d,fitViewResolver:null,connection:{..._b},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:mz,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:wb,zIndexMode:v,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},aA=({nodes:t,edges:l,defaultNodes:r,defaultEdges:i,width:s,height:u,fitView:c,fitViewOptions:d,minZoom:h,maxZoom:m,nodeOrigin:y,nodeExtent:g,zIndexMode:v})=>b3((x,w)=>{async function N(){const{nodeLookup:_,panZoom:E,fitViewOptions:M,fitViewResolver:S,width:z,height:k,minZoom:R,maxZoom:H}=w();E&&(await gz({nodes:_,width:z,height:k,panZoom:E,minZoom:R,maxZoom:H},M),S==null||S.resolve(!0),x({fitViewResolver:null}))}return{...dv({nodes:t,edges:l,width:s,height:u,fitView:c,fitViewOptions:d,minZoom:h,maxZoom:m,nodeOrigin:y,nodeExtent:g,defaultNodes:r,defaultEdges:i,zIndexMode:v}),setNodes:_=>{const{nodeLookup:E,parentLookup:M,nodeOrigin:S,elevateNodesOnSelect:z,fitViewQueued:k,zIndexMode:R}=w(),H=Sh(_,E,M,{nodeOrigin:S,nodeExtent:g,elevateNodesOnSelect:z,checkEquality:!0,zIndexMode:R});k&&H?(N(),x({nodes:_,nodesInitialized:H,fitViewQueued:!1,fitViewOptions:void 0})):x({nodes:_,nodesInitialized:H})},setEdges:_=>{const{connectionLookup:E,edgeLookup:M}=w();qb(E,M,_),x({edges:_})},setDefaultNodesAndEdges:(_,E)=>{if(_){const{setNodes:M}=w();M(_),x({hasDefaultNodes:!0})}if(E){const{setEdges:M}=w();M(E),x({hasDefaultEdges:!0})}},updateNodeInternals:_=>{const{triggerNodeChanges:E,nodeLookup:M,parentLookup:S,domNode:z,nodeOrigin:k,nodeExtent:R,debug:H,fitViewQueued:D,zIndexMode:q}=w(),{changes:Z,updatedInternals:U}=Bz(_,M,S,z,k,R,q);U&&(Dz(M,S,{nodeOrigin:k,nodeExtent:R,zIndexMode:q}),D?(N(),x({fitViewQueued:!1,fitViewOptions:void 0})):x({}),(Z==null?void 0:Z.length)>0&&(H&&console.log("React Flow: trigger node changes",Z),E==null||E(Z)))},updateNodePositions:(_,E=!1)=>{const M=[];let S=[];const{nodeLookup:z,triggerNodeChanges:k,connection:R,updateConnection:H,onNodesChangeMiddlewareMap:D}=w();for(const[q,Z]of _){const U=z.get(q),L=!!(U!=null&&U.expandParent&&(U!=null&&U.parentId)&&(Z!=null&&Z.position)),te={id:q,type:"position",position:L?{x:Math.max(0,Z.position.x),y:Math.max(0,Z.position.y)}:Z.position,dragging:E};if(U&&R.inProgress&&R.fromNode.id===U.id){const B=wl(U,R.fromHandle,me.Left,!0);H({...R,from:B})}L&&U.parentId&&M.push({id:q,parentId:U.parentId,rect:{...Z.internals.positionAbsolute,width:Z.measured.width??0,height:Z.measured.height??0}}),S.push(te)}if(M.length>0){const{parentLookup:q,nodeOrigin:Z}=w(),U=Jh(M,z,q,Z);S.push(...U)}for(const q of D.values())S=q(S);k(S)},triggerNodeChanges:_=>{const{onNodesChange:E,setNodes:M,nodes:S,hasDefaultNodes:z,debug:k}=w();if(_!=null&&_.length){if(z){const R=e1(_,S);M(R)}k&&console.log("React Flow: trigger node changes",_),E==null||E(_)}},triggerEdgeChanges:_=>{const{onEdgesChange:E,setEdges:M,edges:S,hasDefaultEdges:z,debug:k}=w();if(_!=null&&_.length){if(z){const R=t1(_,S);M(R)}k&&console.log("React Flow: trigger edge changes",_),E==null||E(_)}},addSelectedNodes:_=>{const{multiSelectionActive:E,edgeLookup:M,nodeLookup:S,triggerNodeChanges:z,triggerEdgeChanges:k}=w();if(E){const R=_.map(H=>fl(H,!0));z(R);return}z(pr(S,new Set([..._]),!0)),k(pr(M))},addSelectedEdges:_=>{const{multiSelectionActive:E,edgeLookup:M,nodeLookup:S,triggerNodeChanges:z,triggerEdgeChanges:k}=w();if(E){const R=_.map(H=>fl(H,!0));k(R);return}k(pr(M,new Set([..._]))),z(pr(S,new Set,!0))},unselectNodesAndEdges:({nodes:_,edges:E}={})=>{const{edges:M,nodes:S,nodeLookup:z,triggerNodeChanges:k,triggerEdgeChanges:R}=w(),H=_||S,D=E||M,q=[];for(const U of H){if(!U.selected)continue;const L=z.get(U.id);L&&(L.selected=!1),q.push(fl(U.id,!1))}const Z=[];for(const U of D)U.selected&&Z.push(fl(U.id,!1));k(q),R(Z)},setMinZoom:_=>{const{panZoom:E,maxZoom:M}=w();E==null||E.setScaleExtent([_,M]),x({minZoom:_})},setMaxZoom:_=>{const{panZoom:E,minZoom:M}=w();E==null||E.setScaleExtent([M,_]),x({maxZoom:_})},setTranslateExtent:_=>{var E;(E=w().panZoom)==null||E.setTranslateExtent(_),x({translateExtent:_})},resetSelectedElements:()=>{const{edges:_,nodes:E,triggerNodeChanges:M,triggerEdgeChanges:S,elementsSelectable:z}=w();if(!z)return;const k=E.reduce((H,D)=>D.selected?[...H,fl(D.id,!1)]:H,[]),R=_.reduce((H,D)=>D.selected?[...H,fl(D.id,!1)]:H,[]);M(k),S(R)},setNodeExtent:_=>{const{nodes:E,nodeLookup:M,parentLookup:S,nodeOrigin:z,elevateNodesOnSelect:k,nodeExtent:R,zIndexMode:H}=w();_[0][0]===R[0][0]&&_[0][1]===R[0][1]&&_[1][0]===R[1][0]&&_[1][1]===R[1][1]||(Sh(E,M,S,{nodeOrigin:z,nodeExtent:_,elevateNodesOnSelect:k,checkEquality:!1,zIndexMode:H}),x({nodeExtent:_}))},panBy:_=>{const{transform:E,width:M,height:S,panZoom:z,translateExtent:k}=w();return qz({delta:_,panZoom:z,transform:E,translateExtent:k,width:M,height:S})},setCenter:async(_,E,M)=>{const{width:S,height:z,maxZoom:k,panZoom:R}=w();if(!R)return Promise.resolve(!1);const H=typeof(M==null?void 0:M.zoom)<"u"?M.zoom:k;return await R.setViewport({x:S/2-_*H,y:z/2-E*H,zoom:H},{duration:M==null?void 0:M.duration,ease:M==null?void 0:M.ease,interpolate:M==null?void 0:M.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{x({connection:{..._b}})},updateConnection:_=>{x({connection:_})},reset:()=>x({...dv()})}},Object.is);function lA({initialNodes:t,initialEdges:l,defaultNodes:r,defaultEdges:i,initialWidth:s,initialHeight:u,initialMinZoom:c,initialMaxZoom:d,initialFitViewOptions:h,fitView:m,nodeOrigin:y,nodeExtent:g,zIndexMode:v,children:x}){const[w]=V.useState(()=>aA({nodes:t,edges:l,defaultNodes:r,defaultEdges:i,width:s,height:u,fitView:m,minZoom:c,maxZoom:d,fitViewOptions:h,nodeOrigin:y,nodeExtent:g,zIndexMode:v}));return C.jsx(_3,{value:w,children:C.jsx($3,{children:x})})}function rA({children:t,nodes:l,edges:r,defaultNodes:i,defaultEdges:s,width:u,height:c,fitView:d,fitViewOptions:h,minZoom:m,maxZoom:y,nodeOrigin:g,nodeExtent:v,zIndexMode:x}){return V.useContext(xu)?C.jsx(C.Fragment,{children:t}):C.jsx(lA,{initialNodes:l,initialEdges:r,defaultNodes:i,defaultEdges:s,initialWidth:u,initialHeight:c,fitView:d,initialFitViewOptions:h,initialMinZoom:m,initialMaxZoom:y,nodeOrigin:g,nodeExtent:v,zIndexMode:x,children:t})}const iA={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function oA({nodes:t,edges:l,defaultNodes:r,defaultEdges:i,className:s,nodeTypes:u,edgeTypes:c,onNodeClick:d,onEdgeClick:h,onInit:m,onMove:y,onMoveStart:g,onMoveEnd:v,onConnect:x,onConnectStart:w,onConnectEnd:N,onClickConnectStart:_,onClickConnectEnd:E,onNodeMouseEnter:M,onNodeMouseMove:S,onNodeMouseLeave:z,onNodeContextMenu:k,onNodeDoubleClick:R,onNodeDragStart:H,onNodeDrag:D,onNodeDragStop:q,onNodesDelete:Z,onEdgesDelete:U,onDelete:L,onSelectionChange:te,onSelectionDragStart:B,onSelectionDrag:J,onSelectionDragStop:T,onSelectionContextMenu:Y,onSelectionStart:K,onSelectionEnd:I,onBeforeDelete:ie,connectionMode:O,connectionLineType:X=Ua.Bezier,connectionLineStyle:j,connectionLineComponent:G,connectionLineContainerStyle:$,deleteKeyCode:W="Backspace",selectionKeyCode:ee="Shift",selectionOnDrag:ne=!1,selectionMode:ue=Xi.Full,panActivationKeyCode:he="Space",multiSelectionKeyCode:ye=Qi()?"Meta":"Control",zoomActivationKeyCode:ge=Qi()?"Meta":"Control",snapToGrid:de,snapGrid:xe,onlyRenderVisibleElements:Ae=!1,selectNodesOnDrag:Se,nodesDraggable:We,autoPanOnNodeFocus:$e,nodesConnectable:Et,nodesFocusable:Ut,nodeOrigin:zt=Wb,edgesFocusable:vn,edgesReconnectable:An,elementsSelectable:vt=!0,defaultViewport:_l=k3,minZoom:Tn=.5,maxZoom:ra=2,translateExtent:Ga=Yi,preventScrolling:Su=!0,nodeExtent:Sl,defaultMarkerColor:Eu="#b1b1b7",zoomOnScroll:Nu=!0,zoomOnPinch:Va=!0,panOnScroll:Mt=!1,panOnScrollSpeed:xn=.5,panOnScrollMode:At=ml.Free,zoomOnDoubleClick:Cu=!0,panOnDrag:zu=!0,onPaneClick:Mu,onPaneMouseEnter:El,onPaneMouseMove:Nl,onPaneMouseLeave:Cl,onPaneScroll:On,onPaneContextMenu:zl,paneClickDistance:Ya=1,nodeClickDistance:Au=0,children:ao,onReconnect:Ar,onReconnectStart:Xa,onReconnectEnd:Tu,onEdgeContextMenu:lo,onEdgeDoubleClick:ro,onEdgeMouseEnter:io,onEdgeMouseMove:Tr,onEdgeMouseLeave:Or,reconnectRadius:oo=10,onNodesChange:so,onEdgesChange:bn,noDragClassName:pt="nodrag",noWheelClassName:Nt="nowheel",noPanClassName:jn="nopan",fitView:Ml,fitViewOptions:uo,connectOnClick:Ou,attributionPosition:co,proOptions:$a,defaultEdgeOptions:jr,elevateNodesOnSelect:ia=!0,elevateEdgesOnSelect:oa=!1,disableKeyboardA11y:sa=!1,autoPanOnConnect:ua,autoPanOnNodeDrag:it,autoPanSpeed:fo,connectionRadius:ho,isValidConnection:Rn,onError:ca,style:ju,id:Rr,nodeDragThreshold:go,connectionDragThreshold:Ru,viewport:Al,onViewportChange:Tl,width:on,height:Ot,colorMode:po="light",debug:Du,onScroll:fa,ariaLabelConfig:mo,zIndexMode:Qa="basic",...ku},jt){const Za=Rr||"1",yo=q3(po),Dr=V.useCallback(Dn=>{Dn.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),fa==null||fa(Dn)},[fa]);return C.jsx("div",{"data-testid":"rf__wrapper",...ku,onScroll:Dr,style:{...ju,...iA},ref:jt,className:gt(["react-flow",s,yo]),id:Rr,role:"application",children:C.jsxs(rA,{nodes:t,edges:l,width:on,height:Ot,fitView:Ml,fitViewOptions:uo,minZoom:Tn,maxZoom:ra,nodeOrigin:zt,nodeExtent:Sl,zIndexMode:Qa,children:[C.jsx(nA,{onInit:m,onNodeClick:d,onEdgeClick:h,onNodeMouseEnter:M,onNodeMouseMove:S,onNodeMouseLeave:z,onNodeContextMenu:k,onNodeDoubleClick:R,nodeTypes:u,edgeTypes:c,connectionLineType:X,connectionLineStyle:j,connectionLineComponent:G,connectionLineContainerStyle:$,selectionKeyCode:ee,selectionOnDrag:ne,selectionMode:ue,deleteKeyCode:W,multiSelectionKeyCode:ye,panActivationKeyCode:he,zoomActivationKeyCode:ge,onlyRenderVisibleElements:Ae,defaultViewport:_l,translateExtent:Ga,minZoom:Tn,maxZoom:ra,preventScrolling:Su,zoomOnScroll:Nu,zoomOnPinch:Va,zoomOnDoubleClick:Cu,panOnScroll:Mt,panOnScrollSpeed:xn,panOnScrollMode:At,panOnDrag:zu,onPaneClick:Mu,onPaneMouseEnter:El,onPaneMouseMove:Nl,onPaneMouseLeave:Cl,onPaneScroll:On,onPaneContextMenu:zl,paneClickDistance:Ya,nodeClickDistance:Au,onSelectionContextMenu:Y,onSelectionStart:K,onSelectionEnd:I,onReconnect:Ar,onReconnectStart:Xa,onReconnectEnd:Tu,onEdgeContextMenu:lo,onEdgeDoubleClick:ro,onEdgeMouseEnter:io,onEdgeMouseMove:Tr,onEdgeMouseLeave:Or,reconnectRadius:oo,defaultMarkerColor:Eu,noDragClassName:pt,noWheelClassName:Nt,noPanClassName:jn,rfId:Za,disableKeyboardA11y:sa,nodeExtent:Sl,viewport:Al,onViewportChange:Tl}),C.jsx(B3,{nodes:t,edges:l,defaultNodes:r,defaultEdges:i,onConnect:x,onConnectStart:w,onConnectEnd:N,onClickConnectStart:_,onClickConnectEnd:E,nodesDraggable:We,autoPanOnNodeFocus:$e,nodesConnectable:Et,nodesFocusable:Ut,edgesFocusable:vn,edgesReconnectable:An,elementsSelectable:vt,elevateNodesOnSelect:ia,elevateEdgesOnSelect:oa,minZoom:Tn,maxZoom:ra,nodeExtent:Sl,onNodesChange:so,onEdgesChange:bn,snapToGrid:de,snapGrid:xe,connectionMode:O,translateExtent:Ga,connectOnClick:Ou,defaultEdgeOptions:jr,fitView:Ml,fitViewOptions:uo,onNodesDelete:Z,onEdgesDelete:U,onDelete:L,onNodeDragStart:H,onNodeDrag:D,onNodeDragStop:q,onSelectionDrag:J,onSelectionDragStart:B,onSelectionDragStop:T,onMove:y,onMoveStart:g,onMoveEnd:v,noPanClassName:jn,nodeOrigin:zt,rfId:Za,autoPanOnConnect:ua,autoPanOnNodeDrag:it,autoPanSpeed:fo,onError:ca,connectionRadius:ho,isValidConnection:Rn,selectNodesOnDrag:Se,nodeDragThreshold:go,connectionDragThreshold:Ru,onBeforeDelete:ie,debug:Du,ariaLabelConfig:mo,zIndexMode:Qa}),C.jsx(D3,{onSelectionChange:te}),ao,C.jsx(A3,{proOptions:$a,position:co}),C.jsx(M3,{rfId:Za,disableKeyboardA11y:sa})]})})}var sA=n1(oA);const uA=t=>{var l;return(l=t.domNode)==null?void 0:l.querySelector(".react-flow__edgelabel-renderer")};function cA({children:t}){const l=ke(uA);return l?w3.createPortal(t,l):null}function fA(t){const[l,r]=V.useState(t),i=V.useCallback(s=>r(u=>e1(s,u)),[]);return[l,r,i]}function dA(t){const[l,r]=V.useState(t),i=V.useCallback(s=>r(u=>t1(s,u)),[]);return[l,r,i]}function hA({dimensions:t,lineWidth:l,variant:r,className:i}){return C.jsx("path",{strokeWidth:l,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`,className:gt(["react-flow__background-pattern",r,i])})}function gA({radius:t,className:l}){return C.jsx("circle",{cx:t,cy:t,r:t,className:gt(["react-flow__background-pattern","dots",l])})}var na;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(na||(na={}));const pA={[na.Dots]:1,[na.Lines]:1,[na.Cross]:6},mA=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function C1({id:t,variant:l=na.Dots,gap:r=20,size:i,lineWidth:s=1,offset:u=0,color:c,bgColor:d,style:h,className:m,patternClassName:y}){const g=V.useRef(null),{transform:v,patternId:x}=ke(mA,Je),w=i||pA[l],N=l===na.Dots,_=l===na.Cross,E=Array.isArray(r)?r:[r,r],M=[E[0]*v[2]||1,E[1]*v[2]||1],S=w*v[2],z=Array.isArray(u)?u:[u,u],k=_?[S,S]:M,R=[z[0]*v[2]||1+k[0]/2,z[1]*v[2]||1+k[1]/2],H=`${x}${t||""}`;return C.jsxs("svg",{className:gt(["react-flow__background",m]),style:{...h,...wu,"--xy-background-color-props":d,"--xy-background-pattern-color-props":c},ref:g,"data-testid":"rf__background",children:[C.jsx("pattern",{id:H,x:v[0]%M[0],y:v[1]%M[1],width:M[0],height:M[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${R[0]},-${R[1]})`,children:N?C.jsx(gA,{radius:S/2,className:y}):C.jsx(hA,{dimensions:k,lineWidth:s,variant:l,className:y})}),C.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${H})`})]})}C1.displayName="Background";const yA=V.memo(C1);function vA(){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:C.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function xA(){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:C.jsx("path",{d:"M0 0h32v4.2H0z"})})}function bA(){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:C.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 wA(){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:C.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 _A(){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:C.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 Ls({children:t,className:l,...r}){return C.jsx("button",{type:"button",className:gt(["react-flow__controls-button",l]),...r,children:t})}const SA=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom,ariaLabelConfig:t.ariaLabelConfig});function z1({style:t,showZoom:l=!0,showFitView:r=!0,showInteractive:i=!0,fitViewOptions:s,onZoomIn:u,onZoomOut:c,onFitView:d,onInteractiveChange:h,className:m,children:y,position:g="bottom-left",orientation:v="vertical","aria-label":x}){const w=Fe(),{isInteractive:N,minZoomReached:_,maxZoomReached:E,ariaLabelConfig:M}=ke(SA,Je),{zoomIn:S,zoomOut:z,fitView:k}=to(),R=()=>{S(),u==null||u()},H=()=>{z(),c==null||c()},D=()=>{k(s),d==null||d()},q=()=>{w.setState({nodesDraggable:!N,nodesConnectable:!N,elementsSelectable:!N}),h==null||h(!N)},Z=v==="horizontal"?"horizontal":"vertical";return C.jsxs(bu,{className:gt(["react-flow__controls",Z,m]),position:g,style:t,"data-testid":"rf__controls","aria-label":x??M["controls.ariaLabel"],children:[l&&C.jsxs(C.Fragment,{children:[C.jsx(Ls,{onClick:R,className:"react-flow__controls-zoomin",title:M["controls.zoomIn.ariaLabel"],"aria-label":M["controls.zoomIn.ariaLabel"],disabled:E,children:C.jsx(vA,{})}),C.jsx(Ls,{onClick:H,className:"react-flow__controls-zoomout",title:M["controls.zoomOut.ariaLabel"],"aria-label":M["controls.zoomOut.ariaLabel"],disabled:_,children:C.jsx(xA,{})})]}),r&&C.jsx(Ls,{className:"react-flow__controls-fitview",onClick:D,title:M["controls.fitView.ariaLabel"],"aria-label":M["controls.fitView.ariaLabel"],children:C.jsx(bA,{})}),i&&C.jsx(Ls,{className:"react-flow__controls-interactive",onClick:q,title:M["controls.interactive.ariaLabel"],"aria-label":M["controls.interactive.ariaLabel"],children:N?C.jsx(_A,{}):C.jsx(wA,{})}),y]})}z1.displayName="Controls";const EA=V.memo(z1);function NA({id:t,x:l,y:r,width:i,height:s,style:u,color:c,strokeColor:d,strokeWidth:h,className:m,borderRadius:y,shapeRendering:g,selected:v,onClick:x}){const{background:w,backgroundColor:N}=u||{},_=c||w||N;return C.jsx("rect",{className:gt(["react-flow__minimap-node",{selected:v},m]),x:l,y:r,rx:y,ry:y,width:i,height:s,style:{fill:_,stroke:d,strokeWidth:h},shapeRendering:g,onClick:x?E=>x(E,t):void 0})}const CA=V.memo(NA),zA=t=>t.nodes.map(l=>l.id),dd=t=>t instanceof Function?t:()=>t;function MA({nodeStrokeColor:t,nodeColor:l,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:u=CA,onClick:c}){const d=ke(zA,Je),h=dd(l),m=dd(t),y=dd(r),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return C.jsx(C.Fragment,{children:d.map(v=>C.jsx(TA,{id:v,nodeColorFunc:h,nodeStrokeColorFunc:m,nodeClassNameFunc:y,nodeBorderRadius:i,nodeStrokeWidth:s,NodeComponent:u,onClick:c,shapeRendering:g},v))})}function AA({id:t,nodeColorFunc:l,nodeStrokeColorFunc:r,nodeClassNameFunc:i,nodeBorderRadius:s,nodeStrokeWidth:u,shapeRendering:c,NodeComponent:d,onClick:h}){const{node:m,x:y,y:g,width:v,height:x}=ke(w=>{const N=w.nodeLookup.get(t);if(!N)return{node:void 0,x:0,y:0,width:0,height:0};const _=N.internals.userNode,{x:E,y:M}=N.internals.positionAbsolute,{width:S,height:z}=la(_);return{node:_,x:E,y:M,width:S,height:z}},Je);return!m||m.hidden||!Ab(m)?null:C.jsx(d,{x:y,y:g,width:v,height:x,style:m.style,selected:!!m.selected,className:i(m),color:l(m),borderRadius:s,strokeColor:r(m),strokeWidth:u,shapeRendering:c,onClick:h,id:m.id})}const TA=V.memo(AA);var OA=V.memo(MA);const jA=200,RA=150,DA=t=>!t.hidden,kA=t=>{const l={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:l,boundingRect:t.nodeLookup.size>0?Mb(Wi(t.nodeLookup,{filter:DA}),l):l,rfId:t.rfId,panZoom:t.panZoom,translateExtent:t.translateExtent,flowWidth:t.width,flowHeight:t.height,ariaLabelConfig:t.ariaLabelConfig}},HA="react-flow__minimap-desc";function M1({style:t,className:l,nodeStrokeColor:r,nodeColor:i,nodeClassName:s="",nodeBorderRadius:u=5,nodeStrokeWidth:c,nodeComponent:d,bgColor:h,maskColor:m,maskStrokeColor:y,maskStrokeWidth:g,position:v="bottom-right",onClick:x,onNodeClick:w,pannable:N=!1,zoomable:_=!1,ariaLabel:E,inversePan:M,zoomStep:S=1,offsetScale:z=5}){const k=Fe(),R=V.useRef(null),{boundingRect:H,viewBB:D,rfId:q,panZoom:Z,translateExtent:U,flowWidth:L,flowHeight:te,ariaLabelConfig:B}=ke(kA,Je),J=(t==null?void 0:t.width)??jA,T=(t==null?void 0:t.height)??RA,Y=H.width/J,K=H.height/T,I=Math.max(Y,K),ie=I*J,O=I*T,X=z*I,j=H.x-(ie-H.width)/2-X,G=H.y-(O-H.height)/2-X,$=ie+X*2,W=O+X*2,ee=`${HA}-${q}`,ne=V.useRef(0),ue=V.useRef();ne.current=I,V.useEffect(()=>{if(R.current&&Z)return ue.current=Kz({domNode:R.current,panZoom:Z,getTransform:()=>k.getState().transform,getViewScale:()=>ne.current}),()=>{var de;(de=ue.current)==null||de.destroy()}},[Z]),V.useEffect(()=>{var de;(de=ue.current)==null||de.update({translateExtent:U,width:L,height:te,inversePan:M,pannable:N,zoomStep:S,zoomable:_})},[N,_,M,S,U,L,te]);const he=x?de=>{var Se;const[xe,Ae]=((Se=ue.current)==null?void 0:Se.pointer(de))||[0,0];x(de,{x:xe,y:Ae})}:void 0,ye=w?V.useCallback((de,xe)=>{const Ae=k.getState().nodeLookup.get(xe).internals.userNode;w(de,Ae)},[]):void 0,ge=E??B["minimap.ariaLabel"];return C.jsx(bu,{position:v,style:{...t,"--xy-minimap-background-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-background-color-props":typeof m=="string"?m:void 0,"--xy-minimap-mask-stroke-color-props":typeof y=="string"?y:void 0,"--xy-minimap-mask-stroke-width-props":typeof g=="number"?g*I:void 0,"--xy-minimap-node-background-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-width-props":typeof c=="number"?c:void 0},className:gt(["react-flow__minimap",l]),"data-testid":"rf__minimap",children:C.jsxs("svg",{width:J,height:T,viewBox:`${j} ${G} ${$} ${W}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ee,ref:R,onClick:he,children:[ge&&C.jsx("title",{id:ee,children:ge}),C.jsx(OA,{onClick:ye,nodeColor:i,nodeStrokeColor:r,nodeBorderRadius:u,nodeClassName:s,nodeStrokeWidth:c,nodeComponent:d}),C.jsx("path",{className:"react-flow__minimap-mask",d:`M${j-X},${G-X}h${$+X*2}v${W+X*2}h${-$-X*2}z - M${D.x},${D.y}h${D.width}v${D.height}h${-D.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}M1.displayName="MiniMap";const LA=V.memo(M1),BA=t=>l=>t?`${Math.max(1/l.transform[2],1)}`:void 0,qA={[zr.Line]:"right",[zr.Handle]:"bottom-right"};function UA({nodeId:t,position:l,variant:r=zr.Handle,className:i,style:s=void 0,children:u,color:c,minWidth:d=10,minHeight:h=10,maxWidth:m=Number.MAX_VALUE,maxHeight:y=Number.MAX_VALUE,keepAspectRatio:g=!1,resizeDirection:v,autoScale:x=!0,shouldResize:w,onResizeStart:N,onResize:_,onResizeEnd:E}){const M=i1(),S=typeof t=="string"?t:M,z=Fe(),k=V.useRef(null),R=r===zr.Handle,H=ke(V.useCallback(BA(R&&x),[R,x]),Je),D=V.useRef(null),q=l??qA[r];V.useEffect(()=>{if(!(!k.current||!S))return D.current||(D.current=s3({domNode:k.current,nodeId:S,getStoreItems:()=>{const{nodeLookup:U,transform:L,snapGrid:te,snapToGrid:B,nodeOrigin:J,domNode:T}=z.getState();return{nodeLookup:U,transform:L,snapGrid:te,snapToGrid:B,nodeOrigin:J,paneDomNode:T}},onChange:(U,L)=>{const{triggerNodeChanges:te,nodeLookup:B,parentLookup:J,nodeOrigin:T}=z.getState(),Y=[],K={x:U.x,y:U.y},I=B.get(S);if(I&&I.expandParent&&I.parentId){const ie=I.origin??T,O=U.width??I.measured.width??0,X=U.height??I.measured.height??0,j={id:I.id,parentId:I.parentId,rect:{width:O,height:X,...Tb({x:U.x??I.position.x,y:U.y??I.position.y},{width:O,height:X},I.parentId,B,ie)}},G=Jh([j],B,J,T);Y.push(...G),K.x=U.x?Math.max(ie[0]*O,U.x):void 0,K.y=U.y?Math.max(ie[1]*X,U.y):void 0}if(K.x!==void 0&&K.y!==void 0){const ie={id:S,type:"position",position:{...K}};Y.push(ie)}if(U.width!==void 0&&U.height!==void 0){const O={id:S,type:"dimensions",resizing:!0,setAttributes:v?v==="horizontal"?"width":"height":!0,dimensions:{width:U.width,height:U.height}};Y.push(O)}for(const ie of L){const O={...ie,type:"position"};Y.push(O)}te(Y)},onEnd:({width:U,height:L})=>{const te={id:S,type:"dimensions",resizing:!1,dimensions:{width:U,height:L}};z.getState().triggerNodeChanges([te])}})),D.current.update({controlPosition:q,boundaries:{minWidth:d,minHeight:h,maxWidth:m,maxHeight:y},keepAspectRatio:g,resizeDirection:v,onResizeStart:N,onResize:_,onResizeEnd:E,shouldResize:w}),()=>{var U;(U=D.current)==null||U.destroy()}},[q,d,h,m,y,g,N,_,E,w]);const Z=q.split("-");return C.jsx("div",{className:gt(["react-flow__resize-control","nodrag",...Z,r,i]),ref:k,style:{...s,scale:H,...c&&{[R?"backgroundColor":"borderColor"]:c}},children:u})}V.memo(UA);var hd,hv;function Wh(){if(hv)return hd;hv=1;var t="\0",l="\0",r="";class i{constructor(y){ft(this,"_isDirected",!0);ft(this,"_isMultigraph",!1);ft(this,"_isCompound",!1);ft(this,"_label");ft(this,"_defaultNodeLabelFn",()=>{});ft(this,"_defaultEdgeLabelFn",()=>{});ft(this,"_nodes",{});ft(this,"_in",{});ft(this,"_preds",{});ft(this,"_out",{});ft(this,"_sucs",{});ft(this,"_edgeObjs",{});ft(this,"_edgeLabels",{});ft(this,"_nodeCount",0);ft(this,"_edgeCount",0);ft(this,"_parent");ft(this,"_children");y&&(this._isDirected=Object.hasOwn(y,"directed")?y.directed:!0,this._isMultigraph=Object.hasOwn(y,"multigraph")?y.multigraph:!1,this._isCompound=Object.hasOwn(y,"compound")?y.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[l]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(y){return this._label=y,this}graph(){return this._label}setDefaultNodeLabel(y){return this._defaultNodeLabelFn=y,typeof y!="function"&&(this._defaultNodeLabelFn=()=>y),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var y=this;return this.nodes().filter(g=>Object.keys(y._in[g]).length===0)}sinks(){var y=this;return this.nodes().filter(g=>Object.keys(y._out[g]).length===0)}setNodes(y,g){var v=arguments,x=this;return y.forEach(function(w){v.length>1?x.setNode(w,g):x.setNode(w)}),this}setNode(y,g){return Object.hasOwn(this._nodes,y)?(arguments.length>1&&(this._nodes[y]=g),this):(this._nodes[y]=arguments.length>1?g:this._defaultNodeLabelFn(y),this._isCompound&&(this._parent[y]=l,this._children[y]={},this._children[l][y]=!0),this._in[y]={},this._preds[y]={},this._out[y]={},this._sucs[y]={},++this._nodeCount,this)}node(y){return this._nodes[y]}hasNode(y){return Object.hasOwn(this._nodes,y)}removeNode(y){var g=this;if(Object.hasOwn(this._nodes,y)){var v=x=>g.removeEdge(g._edgeObjs[x]);delete this._nodes[y],this._isCompound&&(this._removeFromParentsChildList(y),delete this._parent[y],this.children(y).forEach(function(x){g.setParent(x)}),delete this._children[y]),Object.keys(this._in[y]).forEach(v),delete this._in[y],delete this._preds[y],Object.keys(this._out[y]).forEach(v),delete this._out[y],delete this._sucs[y],--this._nodeCount}return this}setParent(y,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(g===void 0)g=l;else{g+="";for(var v=g;v!==void 0;v=this.parent(v))if(v===y)throw new Error("Setting "+g+" as parent of "+y+" would create a cycle");this.setNode(g)}return this.setNode(y),this._removeFromParentsChildList(y),this._parent[y]=g,this._children[g][y]=!0,this}_removeFromParentsChildList(y){delete this._children[this._parent[y]][y]}parent(y){if(this._isCompound){var g=this._parent[y];if(g!==l)return g}}children(y=l){if(this._isCompound){var g=this._children[y];if(g)return Object.keys(g)}else{if(y===l)return this.nodes();if(this.hasNode(y))return[]}}predecessors(y){var g=this._preds[y];if(g)return Object.keys(g)}successors(y){var g=this._sucs[y];if(g)return Object.keys(g)}neighbors(y){var g=this.predecessors(y);if(g){const x=new Set(g);for(var v of this.successors(y))x.add(v);return Array.from(x.values())}}isLeaf(y){var g;return this.isDirected()?g=this.successors(y):g=this.neighbors(y),g.length===0}filterNodes(y){var g=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});g.setGraph(this.graph());var v=this;Object.entries(this._nodes).forEach(function([N,_]){y(N)&&g.setNode(N,_)}),Object.values(this._edgeObjs).forEach(function(N){g.hasNode(N.v)&&g.hasNode(N.w)&&g.setEdge(N,v.edge(N))});var x={};function w(N){var _=v.parent(N);return _===void 0||g.hasNode(_)?(x[N]=_,_):_ in x?x[_]:w(_)}return this._isCompound&&g.nodes().forEach(N=>g.setParent(N,w(N))),g}setDefaultEdgeLabel(y){return this._defaultEdgeLabelFn=y,typeof y!="function"&&(this._defaultEdgeLabelFn=()=>y),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(y,g){var v=this,x=arguments;return y.reduce(function(w,N){return x.length>1?v.setEdge(w,N,g):v.setEdge(w,N),N}),this}setEdge(){var y,g,v,x,w=!1,N=arguments[0];typeof N=="object"&&N!==null&&"v"in N?(y=N.v,g=N.w,v=N.name,arguments.length===2&&(x=arguments[1],w=!0)):(y=N,g=arguments[1],v=arguments[3],arguments.length>2&&(x=arguments[2],w=!0)),y=""+y,g=""+g,v!==void 0&&(v=""+v);var _=c(this._isDirected,y,g,v);if(Object.hasOwn(this._edgeLabels,_))return w&&(this._edgeLabels[_]=x),this;if(v!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(y),this.setNode(g),this._edgeLabels[_]=w?x:this._defaultEdgeLabelFn(y,g,v);var E=d(this._isDirected,y,g,v);return y=E.v,g=E.w,Object.freeze(E),this._edgeObjs[_]=E,s(this._preds[g],y),s(this._sucs[y],g),this._in[g][_]=E,this._out[y][_]=E,this._edgeCount++,this}edge(y,g,v){var x=arguments.length===1?h(this._isDirected,arguments[0]):c(this._isDirected,y,g,v);return this._edgeLabels[x]}edgeAsObj(){const y=this.edge(...arguments);return typeof y!="object"?{label:y}:y}hasEdge(y,g,v){var x=arguments.length===1?h(this._isDirected,arguments[0]):c(this._isDirected,y,g,v);return Object.hasOwn(this._edgeLabels,x)}removeEdge(y,g,v){var x=arguments.length===1?h(this._isDirected,arguments[0]):c(this._isDirected,y,g,v),w=this._edgeObjs[x];return w&&(y=w.v,g=w.w,delete this._edgeLabels[x],delete this._edgeObjs[x],u(this._preds[g],y),u(this._sucs[y],g),delete this._in[g][x],delete this._out[y][x],this._edgeCount--),this}inEdges(y,g){var v=this._in[y];if(v){var x=Object.values(v);return g?x.filter(w=>w.v===g):x}}outEdges(y,g){var v=this._out[y];if(v){var x=Object.values(v);return g?x.filter(w=>w.w===g):x}}nodeEdges(y,g){var v=this.inEdges(y,g);if(v)return v.concat(this.outEdges(y,g))}}function s(m,y){m[y]?m[y]++:m[y]=1}function u(m,y){--m[y]||delete m[y]}function c(m,y,g,v){var x=""+y,w=""+g;if(!m&&x>w){var N=x;x=w,w=N}return x+r+w+r+(v===void 0?t:v)}function d(m,y,g,v){var x=""+y,w=""+g;if(!m&&x>w){var N=x;x=w,w=N}var _={v:x,w};return v&&(_.name=v),_}function h(m,y){return c(m,y.v,y.w,y.name)}return hd=i,hd}var gd,gv;function GA(){return gv||(gv=1,gd="2.2.4"),gd}var pd,pv;function VA(){return pv||(pv=1,pd={Graph:Wh(),version:GA()}),pd}var md,mv;function YA(){if(mv)return md;mv=1;var t=Wh();md={write:l,read:s};function l(u){var c={options:{directed:u.isDirected(),multigraph:u.isMultigraph(),compound:u.isCompound()},nodes:r(u),edges:i(u)};return u.graph()!==void 0&&(c.value=structuredClone(u.graph())),c}function r(u){return u.nodes().map(function(c){var d=u.node(c),h=u.parent(c),m={v:c};return d!==void 0&&(m.value=d),h!==void 0&&(m.parent=h),m})}function i(u){return u.edges().map(function(c){var d=u.edge(c),h={v:c.v,w:c.w};return c.name!==void 0&&(h.name=c.name),d!==void 0&&(h.value=d),h})}function s(u){var c=new t(u.options).setGraph(u.value);return u.nodes.forEach(function(d){c.setNode(d.v,d.value),d.parent&&c.setParent(d.v,d.parent)}),u.edges.forEach(function(d){c.setEdge({v:d.v,w:d.w,name:d.name},d.value)}),c}return md}var yd,yv;function XA(){if(yv)return yd;yv=1,yd=t;function t(l){var r={},i=[],s;function u(c){Object.hasOwn(r,c)||(r[c]=!0,s.push(c),l.successors(c).forEach(u),l.predecessors(c).forEach(u))}return l.nodes().forEach(function(c){s=[],u(c),s.length&&i.push(s)}),i}return yd}var vd,vv;function A1(){if(vv)return vd;vv=1;class t{constructor(){ft(this,"_arr",[]);ft(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 i=this._keyIndices[r];if(i!==void 0)return this._arr[i].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(r,i){var s=this._keyIndices;if(r=String(r),!Object.hasOwn(s,r)){var u=this._arr,c=u.length;return s[r]=c,u.push({key:r,priority:i}),this._decrease(c),!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,i){var s=this._keyIndices[r];if(i>this._arr[s].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[s].priority+" New: "+i);this._arr[s].priority=i,this._decrease(s)}_heapify(r){var i=this._arr,s=2*r,u=s+1,c=r;s>1,!(i[u].priority1;function r(s,u,c,d){return i(s,String(u),c||l,d||function(h){return s.outEdges(h)})}function i(s,u,c,d){var h={},m=new t,y,g,v=function(x){var w=x.v!==y?x.v:x.w,N=h[w],_=c(x),E=g.distance+_;if(_<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+x+" Weight: "+_);E0&&(y=m.removeMin(),g=h[y],g.distance!==Number.POSITIVE_INFINITY);)d(y).forEach(v);return h}return xd}var bd,bv;function $A(){if(bv)return bd;bv=1;var t=T1();bd=l;function l(r,i,s){return r.nodes().reduce(function(u,c){return u[c]=t(r,c,i,s),u},{})}return bd}var wd,wv;function O1(){if(wv)return wd;wv=1,wd=t;function t(l){var r=0,i=[],s={},u=[];function c(d){var h=s[d]={onStack:!0,lowlink:r,index:r++};if(i.push(d),l.successors(d).forEach(function(g){Object.hasOwn(s,g)?s[g].onStack&&(h.lowlink=Math.min(h.lowlink,s[g].index)):(c(g),h.lowlink=Math.min(h.lowlink,s[g].lowlink))}),h.lowlink===h.index){var m=[],y;do y=i.pop(),s[y].onStack=!1,m.push(y);while(d!==y);u.push(m)}}return l.nodes().forEach(function(d){Object.hasOwn(s,d)||c(d)}),u}return wd}var _d,_v;function QA(){if(_v)return _d;_v=1;var t=O1();_d=l;function l(r){return t(r).filter(function(i){return i.length>1||i.length===1&&r.hasEdge(i[0],i[0])})}return _d}var Sd,Sv;function ZA(){if(Sv)return Sd;Sv=1,Sd=l;var t=()=>1;function l(i,s,u){return r(i,s||t,u||function(c){return i.outEdges(c)})}function r(i,s,u){var c={},d=i.nodes();return d.forEach(function(h){c[h]={},c[h][h]={distance:0},d.forEach(function(m){h!==m&&(c[h][m]={distance:Number.POSITIVE_INFINITY})}),u(h).forEach(function(m){var y=m.v===h?m.w:m.v,g=s(m);c[h][y]={distance:g,predecessor:h}})}),d.forEach(function(h){var m=c[h];d.forEach(function(y){var g=c[y];d.forEach(function(v){var x=g[h],w=m[v],N=g[v],_=x.distance+w.distance;_s.successors(g):g=>s.neighbors(g),h=c==="post"?l:r,m=[],y={};return u.forEach(g=>{if(!s.hasNode(g))throw new Error("Graph does not have node: "+g);h(g,d,y,m)}),m}function l(s,u,c,d){for(var h=[[s,!1]];h.length>0;){var m=h.pop();m[1]?d.push(m[0]):Object.hasOwn(c,m[0])||(c[m[0]]=!0,h.push([m[0],!0]),i(u(m[0]),y=>h.push([y,!1])))}}function r(s,u,c,d){for(var h=[s];h.length>0;){var m=h.pop();Object.hasOwn(c,m)||(c[m]=!0,d.push(m),i(u(m),y=>h.push(y)))}}function i(s,u){for(var c=s.length;c--;)u(s[c],c,s);return s}return Cd}var zd,zv;function IA(){if(zv)return zd;zv=1;var t=R1();zd=l;function l(r,i){return t(r,i,"post")}return zd}var Md,Mv;function JA(){if(Mv)return Md;Mv=1;var t=R1();Md=l;function l(r,i){return t(r,i,"pre")}return Md}var Ad,Av;function FA(){if(Av)return Ad;Av=1;var t=Wh(),l=A1();Ad=r;function r(i,s){var u=new t,c={},d=new l,h;function m(g){var v=g.v===h?g.w:g.v,x=d.priority(v);if(x!==void 0){var w=s(g);w0;){if(h=d.removeMin(),Object.hasOwn(c,h))u.setEdge(h,c[h]);else{if(y)throw new Error("Input graph is not connected: "+i);y=!0}i.nodeEdges(h).forEach(m)}return u}return Ad}var Td,Tv;function WA(){return Tv||(Tv=1,Td={components:XA(),dijkstra:T1(),dijkstraAll:$A(),findCycles:QA(),floydWarshall:ZA(),isAcyclic:KA(),postorder:IA(),preorder:JA(),prim:FA(),tarjan:O1(),topsort:j1()}),Td}var Od,Ov;function mn(){if(Ov)return Od;Ov=1;var t=VA();return Od={Graph:t.Graph,json:YA(),alg:WA(),version:t.version},Od}var jd,jv;function PA(){if(jv)return jd;jv=1;class t{constructor(){let s={};s._next=s._prev=s,this._sentinel=s}dequeue(){let s=this._sentinel,u=s._prev;if(u!==s)return l(u),u}enqueue(s){let u=this._sentinel;s._prev&&s._next&&l(s),s._next=u._next,u._next._prev=s,u._next=s,s._prev=u}toString(){let s=[],u=this._sentinel,c=u._prev;for(;c!==u;)s.push(JSON.stringify(c,r)),c=c._prev;return"["+s.join(", ")+"]"}}function l(i){i._prev._next=i._next,i._next._prev=i._prev,delete i._next,delete i._prev}function r(i,s){if(i!=="_next"&&i!=="_prev")return s}return jd=t,jd}var Rd,Rv;function eT(){if(Rv)return Rd;Rv=1;let t=mn().Graph,l=PA();Rd=i;let r=()=>1;function i(m,y){if(m.nodeCount()<=1)return[];let g=c(m,y||r);return s(g.graph,g.buckets,g.zeroIdx).flatMap(x=>m.outEdges(x.v,x.w))}function s(m,y,g){let v=[],x=y[y.length-1],w=y[0],N;for(;m.nodeCount();){for(;N=w.dequeue();)u(m,y,g,N);for(;N=x.dequeue();)u(m,y,g,N);if(m.nodeCount()){for(let _=y.length-2;_>0;--_)if(N=y[_].dequeue(),N){v=v.concat(u(m,y,g,N,!0));break}}}return v}function u(m,y,g,v,x){let w=x?[]:void 0;return m.inEdges(v.v).forEach(N=>{let _=m.edge(N),E=m.node(N.v);x&&w.push({v:N.v,w:N.w}),E.out-=_,d(y,g,E)}),m.outEdges(v.v).forEach(N=>{let _=m.edge(N),E=N.w,M=m.node(E);M.in-=_,d(y,g,M)}),m.removeNode(v.v),w}function c(m,y){let g=new t,v=0,x=0;m.nodes().forEach(_=>{g.setNode(_,{v:_,in:0,out:0})}),m.edges().forEach(_=>{let E=g.edge(_.v,_.w)||0,M=y(_),S=E+M;g.setEdge(_.v,_.w,S),x=Math.max(x,g.node(_.v).out+=M),v=Math.max(v,g.node(_.w).in+=M)});let w=h(x+v+3).map(()=>new l),N=v+1;return g.nodes().forEach(_=>{d(w,N,g.node(_))}),{graph:g,buckets:w,zeroIdx:N}}function d(m,y,g){g.out?g.in?m[g.out-g.in+y].enqueue(g):m[m.length-1].enqueue(g):m[0].enqueue(g)}function h(m){const y=[];for(let g=0;gq.setNode(Z,D.node(Z))),D.edges().forEach(Z=>{let U=q.edge(Z.v,Z.w)||{weight:0,minlen:1},L=D.edge(Z);q.setEdge(Z.v,Z.w,{weight:U.weight+L.weight,minlen:Math.max(U.minlen,L.minlen)})}),q}function i(D){let q=new t({multigraph:D.isMultigraph()}).setGraph(D.graph());return D.nodes().forEach(Z=>{D.children(Z).length||q.setNode(Z,D.node(Z))}),D.edges().forEach(Z=>{q.setEdge(Z,D.edge(Z))}),q}function s(D){let q=D.nodes().map(Z=>{let U={};return D.outEdges(Z).forEach(L=>{U[L.w]=(U[L.w]||0)+D.edge(L).weight}),U});return H(D.nodes(),q)}function u(D){let q=D.nodes().map(Z=>{let U={};return D.inEdges(Z).forEach(L=>{U[L.v]=(U[L.v]||0)+D.edge(L).weight}),U});return H(D.nodes(),q)}function c(D,q){let Z=D.x,U=D.y,L=q.x-Z,te=q.y-U,B=D.width/2,J=D.height/2;if(!L&&!te)throw new Error("Not possible to find intersection inside of the rectangle");let T,Y;return Math.abs(te)*B>Math.abs(L)*J?(te<0&&(J=-J),T=J*L/te,Y=J):(L<0&&(B=-B),T=B,Y=B*te/L),{x:Z+T,y:U+Y}}function d(D){let q=z(w(D)+1).map(()=>[]);return D.nodes().forEach(Z=>{let U=D.node(Z),L=U.rank;L!==void 0&&(q[L][U.order]=Z)}),q}function h(D){let q=D.nodes().map(U=>{let L=D.node(U).rank;return L===void 0?Number.MAX_VALUE:L}),Z=x(Math.min,q);D.nodes().forEach(U=>{let L=D.node(U);Object.hasOwn(L,"rank")&&(L.rank-=Z)})}function m(D){let q=D.nodes().map(B=>D.node(B).rank),Z=x(Math.min,q),U=[];D.nodes().forEach(B=>{let J=D.node(B).rank-Z;U[J]||(U[J]=[]),U[J].push(B)});let L=0,te=D.graph().nodeRankFactor;Array.from(U).forEach((B,J)=>{B===void 0&&J%te!==0?--L:B!==void 0&&L&&B.forEach(T=>D.node(T).rank+=L)})}function y(D,q,Z,U){let L={width:0,height:0};return arguments.length>=4&&(L.rank=Z,L.order=U),l(D,"border",L,q)}function g(D,q=v){const Z=[];for(let U=0;Uv){const Z=g(q);return D.apply(null,Z.map(U=>D.apply(null,U)))}else return D.apply(null,q)}function w(D){const Z=D.nodes().map(U=>{let L=D.node(U).rank;return L===void 0?Number.MIN_VALUE:L});return x(Math.max,Z)}function N(D,q){let Z={lhs:[],rhs:[]};return D.forEach(U=>{q(U)?Z.lhs.push(U):Z.rhs.push(U)}),Z}function _(D,q){let Z=Date.now();try{return q()}finally{console.log(D+" time: "+(Date.now()-Z)+"ms")}}function E(D,q){return q()}let M=0;function S(D){var q=++M;return D+(""+q)}function z(D,q,Z=1){q==null&&(q=D,D=0);let U=te=>teqU[q]),Object.entries(D).reduce((U,[L,te])=>(U[L]=Z(te,L),U),{})}function H(D,q){return D.reduce((Z,U,L)=>(Z[U]=q[L],Z),{})}return Dd}var kd,kv;function tT(){if(kv)return kd;kv=1;let t=eT(),l=dt().uniqueId;kd={run:r,undo:s};function r(u){(u.graph().acyclicer==="greedy"?t(u,d(u)):i(u)).forEach(h=>{let m=u.edge(h);u.removeEdge(h),m.forwardName=h.name,m.reversed=!0,u.setEdge(h.w,h.v,m,l("rev"))});function d(h){return m=>h.edge(m).weight}}function i(u){let c=[],d={},h={};function m(y){Object.hasOwn(h,y)||(h[y]=!0,d[y]=!0,u.outEdges(y).forEach(g=>{Object.hasOwn(d,g.w)?c.push(g):m(g.w)}),delete d[y])}return u.nodes().forEach(m),c}function s(u){u.edges().forEach(c=>{let d=u.edge(c);if(d.reversed){u.removeEdge(c);let h=d.forwardName;delete d.reversed,delete d.forwardName,u.setEdge(c.w,c.v,d,h)}})}return kd}var Hd,Hv;function nT(){if(Hv)return Hd;Hv=1;let t=dt();Hd={run:l,undo:i};function l(s){s.graph().dummyChains=[],s.edges().forEach(u=>r(s,u))}function r(s,u){let c=u.v,d=s.node(c).rank,h=u.w,m=s.node(h).rank,y=u.name,g=s.edge(u),v=g.labelRank;if(m===d+1)return;s.removeEdge(u);let x,w,N;for(N=0,++d;d{let c=s.node(u),d=c.edgeLabel,h;for(s.setEdge(c.edgeObj,d);c.dummy;)h=s.successors(u)[0],s.removeNode(u),d.points.push({x:c.x,y:c.y}),c.dummy==="edge-label"&&(d.x=c.x,d.y=c.y,d.width=c.width,d.height=c.height),u=h,c=s.node(u)})}return Hd}var Ld,Lv;function ru(){if(Lv)return Ld;Lv=1;const{applyWithChunking:t}=dt();Ld={longestPath:l,slack:r};function l(i){var s={};function u(c){var d=i.node(c);if(Object.hasOwn(s,c))return d.rank;s[c]=!0;let h=i.outEdges(c).map(y=>y==null?Number.POSITIVE_INFINITY:u(y.w)-i.edge(y).minlen);var m=t(Math.min,h);return m===Number.POSITIVE_INFINITY&&(m=0),d.rank=m}i.sources().forEach(u)}function r(i,s){return i.node(s.w).rank-i.node(s.v).rank-i.edge(s).minlen}return Ld}var Bd,Bv;function D1(){if(Bv)return Bd;Bv=1;var t=mn().Graph,l=ru().slack;Bd=r;function r(c){var d=new t({directed:!1}),h=c.nodes()[0],m=c.nodeCount();d.setNode(h,{});for(var y,g;i(d,c){var g=y.v,v=m===g?y.w:g;!c.hasNode(v)&&!l(d,y)&&(c.setNode(v,{}),c.setEdge(m,v,{}),h(v))})}return c.nodes().forEach(h),c.nodeCount()}function s(c,d){return d.edges().reduce((m,y)=>{let g=Number.POSITIVE_INFINITY;return c.hasNode(y.v)!==c.hasNode(y.w)&&(g=l(d,y)),gd.node(m).rank+=h)}return Bd}var qd,qv;function aT(){if(qv)return qd;qv=1;var t=D1(),l=ru().slack,r=ru().longestPath,i=mn().alg.preorder,s=mn().alg.postorder,u=dt().simplify;qd=c,c.initLowLimValues=y,c.initCutValues=d,c.calcCutValue=m,c.leaveEdge=v,c.enterEdge=x,c.exchangeEdges=w;function c(M){M=u(M),r(M);var S=t(M);y(S),d(S,M);for(var z,k;z=v(S);)k=x(S,M,z),w(S,M,z,k)}function d(M,S){var z=s(M,M.nodes());z=z.slice(0,z.length-1),z.forEach(k=>h(M,S,k))}function h(M,S,z){var k=M.node(z),R=k.parent;M.edge(z,R).cutvalue=m(M,S,z)}function m(M,S,z){var k=M.node(z),R=k.parent,H=!0,D=S.edge(z,R),q=0;return D||(H=!1,D=S.edge(R,z)),q=D.weight,S.nodeEdges(z).forEach(Z=>{var U=Z.v===z,L=U?Z.w:Z.v;if(L!==R){var te=U===H,B=S.edge(Z).weight;if(q+=te?B:-B,_(M,z,L)){var J=M.edge(z,L).cutvalue;q+=te?-J:J}}}),q}function y(M,S){arguments.length<2&&(S=M.nodes()[0]),g(M,{},1,S)}function g(M,S,z,k,R){var H=z,D=M.node(k);return S[k]=!0,M.neighbors(k).forEach(q=>{Object.hasOwn(S,q)||(z=g(M,S,z,q,k))}),D.low=H,D.lim=z++,R?D.parent=R:delete D.parent,z}function v(M){return M.edges().find(S=>M.edge(S).cutvalue<0)}function x(M,S,z){var k=z.v,R=z.w;S.hasEdge(k,R)||(k=z.w,R=z.v);var H=M.node(k),D=M.node(R),q=H,Z=!1;H.lim>D.lim&&(q=D,Z=!0);var U=S.edges().filter(L=>Z===E(M,M.node(L.v),q)&&Z!==E(M,M.node(L.w),q));return U.reduce((L,te)=>l(S,te)!S.node(R).parent),k=i(M,z);k=k.slice(1),k.forEach(R=>{var H=M.node(R).parent,D=S.edge(R,H),q=!1;D||(D=S.edge(H,R),q=!0),S.node(R).rank=S.node(H).rank+(q?D.minlen:-D.minlen)})}function _(M,S,z){return M.hasEdge(S,z)}function E(M,S,z){return z.low<=S.lim&&S.lim<=z.lim}return qd}var Ud,Uv;function lT(){if(Uv)return Ud;Uv=1;var t=ru(),l=t.longestPath,r=D1(),i=aT();Ud=s;function s(h){var m=h.graph().ranker;if(m instanceof Function)return m(h);switch(h.graph().ranker){case"network-simplex":d(h);break;case"tight-tree":c(h);break;case"longest-path":u(h);break;case"none":break;default:d(h)}}var u=l;function c(h){l(h),r(h)}function d(h){i(h)}return Ud}var Gd,Gv;function rT(){if(Gv)return Gd;Gv=1,Gd=t;function t(i){let s=r(i);i.graph().dummyChains.forEach(u=>{let c=i.node(u),d=c.edgeObj,h=l(i,s,d.v,d.w),m=h.path,y=h.lca,g=0,v=m[g],x=!0;for(;u!==d.w;){if(c=i.node(u),x){for(;(v=m[g])!==y&&i.node(v).maxRankm||y>s[g].lim));for(v=g,g=c;(g=i.parent(g))!==v;)h.push(g);return{path:d.concat(h.reverse()),lca:v}}function r(i){let s={},u=0;function c(d){let h=u;i.children(d).forEach(c),s[d]={low:h,lim:u++}}return i.children().forEach(c),s}return Gd}var Vd,Vv;function iT(){if(Vv)return Vd;Vv=1;let t=dt();Vd={run:l,cleanup:u};function l(c){let d=t.addDummyNode(c,"root",{},"_root"),h=i(c),m=Object.values(h),y=t.applyWithChunking(Math.max,m)-1,g=2*y+1;c.graph().nestingRoot=d,c.edges().forEach(x=>c.edge(x).minlen*=g);let v=s(c)+1;c.children().forEach(x=>r(c,d,g,v,y,h,x)),c.graph().nodeRankFactor=g}function r(c,d,h,m,y,g,v){let x=c.children(v);if(!x.length){v!==d&&c.setEdge(d,v,{weight:0,minlen:h});return}let w=t.addBorderNode(c,"_bt"),N=t.addBorderNode(c,"_bb"),_=c.node(v);c.setParent(w,v),_.borderTop=w,c.setParent(N,v),_.borderBottom=N,x.forEach(E=>{r(c,d,h,m,y,g,E);let M=c.node(E),S=M.borderTop?M.borderTop:E,z=M.borderBottom?M.borderBottom:E,k=M.borderTop?m:2*m,R=S!==z?1:y-g[v]+1;c.setEdge(w,S,{weight:k,minlen:R,nestingEdge:!0}),c.setEdge(z,N,{weight:k,minlen:R,nestingEdge:!0})}),c.parent(v)||c.setEdge(d,w,{weight:0,minlen:y+g[v]})}function i(c){var d={};function h(m,y){var g=c.children(m);g&&g.length&&g.forEach(v=>h(v,y+1)),d[m]=y}return c.children().forEach(m=>h(m,1)),d}function s(c){return c.edges().reduce((d,h)=>d+c.edge(h).weight,0)}function u(c){var d=c.graph();c.removeNode(d.nestingRoot),delete d.nestingRoot,c.edges().forEach(h=>{var m=c.edge(h);m.nestingEdge&&c.removeEdge(h)})}return Vd}var Yd,Yv;function oT(){if(Yv)return Yd;Yv=1;let t=dt();Yd=l;function l(i){function s(u){let c=i.children(u),d=i.node(u);if(c.length&&c.forEach(s),Object.hasOwn(d,"minRank")){d.borderLeft=[],d.borderRight=[];for(let h=d.minRank,m=d.maxRank+1;hi(h.node(m))),h.edges().forEach(m=>i(h.edge(m)))}function i(h){let m=h.width;h.width=h.height,h.height=m}function s(h){h.nodes().forEach(m=>u(h.node(m))),h.edges().forEach(m=>{let y=h.edge(m);y.points.forEach(u),Object.hasOwn(y,"y")&&u(y)})}function u(h){h.y=-h.y}function c(h){h.nodes().forEach(m=>d(h.node(m))),h.edges().forEach(m=>{let y=h.edge(m);y.points.forEach(d),Object.hasOwn(y,"x")&&d(y)})}function d(h){let m=h.x;h.x=h.y,h.y=m}return Xd}var $d,$v;function uT(){if($v)return $d;$v=1;let t=dt();$d=l;function l(r){let i={},s=r.nodes().filter(y=>!r.children(y).length),u=s.map(y=>r.node(y).rank),c=t.applyWithChunking(Math.max,u),d=t.range(c+1).map(()=>[]);function h(y){if(i[y])return;i[y]=!0;let g=r.node(y);d[g.rank].push(y),r.successors(y).forEach(h)}return s.sort((y,g)=>r.node(y).rank-r.node(g).rank).forEach(h),d}return $d}var Qd,Qv;function cT(){if(Qv)return Qd;Qv=1;let t=dt().zipObject;Qd=l;function l(i,s){let u=0;for(let c=1;cx)),d=s.flatMap(v=>i.outEdges(v).map(x=>({pos:c[x.w],weight:i.edge(x).weight})).sort((x,w)=>x.pos-w.pos)),h=1;for(;h{let x=v.pos+h;y[x]+=v.weight;let w=0;for(;x>0;)x%2&&(w+=y[x+1]),x=x-1>>1,y[x]+=v.weight;g+=v.weight*w}),g}return Qd}var Zd,Zv;function fT(){if(Zv)return Zd;Zv=1,Zd=t;function t(l,r=[]){return r.map(i=>{let s=l.inEdges(i);if(s.length){let u=s.reduce((c,d)=>{let h=l.edge(d),m=l.node(d.v);return{sum:c.sum+h.weight*m.order,weight:c.weight+h.weight}},{sum:0,weight:0});return{v:i,barycenter:u.sum/u.weight,weight:u.weight}}else return{v:i}})}return Zd}var Kd,Kv;function dT(){if(Kv)return Kd;Kv=1;let t=dt();Kd=l;function l(s,u){let c={};s.forEach((h,m)=>{let y=c[h.v]={indegree:0,in:[],out:[],vs:[h.v],i:m};h.barycenter!==void 0&&(y.barycenter=h.barycenter,y.weight=h.weight)}),u.edges().forEach(h=>{let m=c[h.v],y=c[h.w];m!==void 0&&y!==void 0&&(y.indegree++,m.out.push(c[h.w]))});let d=Object.values(c).filter(h=>!h.indegree);return r(d)}function r(s){let u=[];function c(h){return m=>{m.merged||(m.barycenter===void 0||h.barycenter===void 0||m.barycenter>=h.barycenter)&&i(h,m)}}function d(h){return m=>{m.in.push(h),--m.indegree===0&&s.push(m)}}for(;s.length;){let h=s.pop();u.push(h),h.in.reverse().forEach(c(h)),h.out.forEach(d(h))}return u.filter(h=>!h.merged).map(h=>t.pick(h,["vs","i","barycenter","weight"]))}function i(s,u){let c=0,d=0;s.weight&&(c+=s.barycenter*s.weight,d+=s.weight),u.weight&&(c+=u.barycenter*u.weight,d+=u.weight),s.vs=u.vs.concat(s.vs),s.barycenter=c/d,s.weight=d,s.i=Math.min(u.i,s.i),u.merged=!0}return Kd}var Id,Iv;function hT(){if(Iv)return Id;Iv=1;let t=dt();Id=l;function l(s,u){let c=t.partition(s,w=>Object.hasOwn(w,"barycenter")),d=c.lhs,h=c.rhs.sort((w,N)=>N.i-w.i),m=[],y=0,g=0,v=0;d.sort(i(!!u)),v=r(m,h,v),d.forEach(w=>{v+=w.vs.length,m.push(w.vs),y+=w.barycenter*w.weight,g+=w.weight,v=r(m,h,v)});let x={vs:m.flat(!0)};return g&&(x.barycenter=y/g,x.weight=g),x}function r(s,u,c){let d;for(;u.length&&(d=u[u.length-1]).i<=c;)u.pop(),s.push(d.vs),c++;return c}function i(s){return(u,c)=>u.barycenterc.barycenter?1:s?c.i-u.i:u.i-c.i}return Id}var Jd,Jv;function gT(){if(Jv)return Jd;Jv=1;let t=fT(),l=dT(),r=hT();Jd=i;function i(c,d,h,m){let y=c.children(d),g=c.node(d),v=g?g.borderLeft:void 0,x=g?g.borderRight:void 0,w={};v&&(y=y.filter(M=>M!==v&&M!==x));let N=t(c,y);N.forEach(M=>{if(c.children(M.v).length){let S=i(c,M.v,h,m);w[M.v]=S,Object.hasOwn(S,"barycenter")&&u(M,S)}});let _=l(N,h);s(_,w);let E=r(_,m);if(v&&(E.vs=[v,E.vs,x].flat(!0),c.predecessors(v).length)){let M=c.node(c.predecessors(v)[0]),S=c.node(c.predecessors(x)[0]);Object.hasOwn(E,"barycenter")||(E.barycenter=0,E.weight=0),E.barycenter=(E.barycenter*E.weight+M.order+S.order)/(E.weight+2),E.weight+=2}return E}function s(c,d){c.forEach(h=>{h.vs=h.vs.flatMap(m=>d[m]?d[m].vs:m)})}function u(c,d){c.barycenter!==void 0?(c.barycenter=(c.barycenter*c.weight+d.barycenter*d.weight)/(c.weight+d.weight),c.weight+=d.weight):(c.barycenter=d.barycenter,c.weight=d.weight)}return Jd}var Fd,Fv;function pT(){if(Fv)return Fd;Fv=1;let t=mn().Graph,l=dt();Fd=r;function r(s,u,c,d){d||(d=s.nodes());let h=i(s),m=new t({compound:!0}).setGraph({root:h}).setDefaultNodeLabel(y=>s.node(y));return d.forEach(y=>{let g=s.node(y),v=s.parent(y);(g.rank===u||g.minRank<=u&&u<=g.maxRank)&&(m.setNode(y),m.setParent(y,v||h),s[c](y).forEach(x=>{let w=x.v===y?x.w:x.v,N=m.edge(w,y),_=N!==void 0?N.weight:0;m.setEdge(w,y,{weight:s.edge(x).weight+_})}),Object.hasOwn(g,"minRank")&&m.setNode(y,{borderLeft:g.borderLeft[u],borderRight:g.borderRight[u]}))}),m}function i(s){for(var u;s.hasNode(u=l.uniqueId("_root")););return u}return Fd}var Wd,Wv;function mT(){if(Wv)return Wd;Wv=1,Wd=t;function t(l,r,i){let s={},u;i.forEach(c=>{let d=l.parent(c),h,m;for(;d;){if(h=l.parent(d),h?(m=s[h],s[h]=d):(m=u,u=d),m&&m!==d){r.setEdge(m,d);return}d=h}})}return Wd}var Pd,Pv;function yT(){if(Pv)return Pd;Pv=1;let t=uT(),l=cT(),r=gT(),i=pT(),s=mT(),u=mn().Graph,c=dt();Pd=d;function d(g,v){if(v&&typeof v.customOrder=="function"){v.customOrder(g,d);return}let x=c.maxRank(g),w=h(g,c.range(1,x+1),"inEdges"),N=h(g,c.range(x-1,-1,-1),"outEdges"),_=t(g);if(y(g,_),v&&v.disableOptimalOrderHeuristic)return;let E=Number.POSITIVE_INFINITY,M;for(let S=0,z=0;z<4;++S,++z){m(S%2?w:N,S%4>=2),_=c.buildLayerMatrix(g);let k=l(g,_);k{w.has(_)||w.set(_,[]),w.get(_).push(E)};for(const _ of g.nodes()){const E=g.node(_);if(typeof E.rank=="number"&&N(E.rank,_),typeof E.minRank=="number"&&typeof E.maxRank=="number")for(let M=E.minRank;M<=E.maxRank;M++)M!==E.rank&&N(M,_)}return v.map(function(_){return i(g,_,x,w.get(_)||[])})}function m(g,v){let x=new u;g.forEach(function(w){let N=w.graph().root,_=r(w,N,x,v);_.vs.forEach((E,M)=>w.node(E).order=M),s(w,x,_.vs)})}function y(g,v){Object.values(v).forEach(x=>x.forEach((w,N)=>g.node(w).order=N))}return Pd}var eh,ex;function vT(){if(ex)return eh;ex=1;let t=mn().Graph,l=dt();eh={positionX:x,findType1Conflicts:r,findType2Conflicts:i,addConflict:u,hasConflict:c,verticalAlignment:d,horizontalCompaction:h,alignCoordinates:g,findSmallestWidthAlignment:y,balance:v};function r(_,E){let M={};function S(z,k){let R=0,H=0,D=z.length,q=k[k.length-1];return k.forEach((Z,U)=>{let L=s(_,Z),te=L?_.node(L).order:D;(L||Z===q)&&(k.slice(H,U+1).forEach(B=>{_.predecessors(B).forEach(J=>{let T=_.node(J),Y=T.order;(Y{Z=k[U],_.node(Z).dummy&&_.predecessors(Z).forEach(L=>{let te=_.node(L);te.dummy&&(te.orderq)&&u(M,L,Z)})})}function z(k,R){let H=-1,D,q=0;return R.forEach((Z,U)=>{if(_.node(Z).dummy==="border"){let L=_.predecessors(Z);L.length&&(D=_.node(L[0]).order,S(R,q,U,H,D),q=U,H=D)}S(R,q,R.length,D,k.length)}),R}return E.length&&E.reduce(z),M}function s(_,E){if(_.node(E).dummy)return _.predecessors(E).find(M=>_.node(M).dummy)}function u(_,E,M){if(E>M){let z=E;E=M,M=z}let S=_[E];S||(_[E]=S={}),S[M]=!0}function c(_,E,M){if(E>M){let S=E;E=M,M=S}return!!_[E]&&Object.hasOwn(_[E],M)}function d(_,E,M,S){let z={},k={},R={};return E.forEach(H=>{H.forEach((D,q)=>{z[D]=D,k[D]=D,R[D]=q})}),E.forEach(H=>{let D=-1;H.forEach(q=>{let Z=S(q);if(Z.length){Z=Z.sort((L,te)=>R[L]-R[te]);let U=(Z.length-1)/2;for(let L=Math.floor(U),te=Math.ceil(U);L<=te;++L){let B=Z[L];k[q]===q&&DMath.max(L,k[te.v]+R.edge(te)),0)}function Z(U){let L=R.outEdges(U).reduce((B,J)=>Math.min(B,k[J.w]-R.edge(J)),Number.POSITIVE_INFINITY),te=_.node(U);L!==Number.POSITIVE_INFINITY&&te.borderType!==H&&(k[U]=Math.max(k[U],L))}return D(q,R.predecessors.bind(R)),D(Z,R.successors.bind(R)),Object.keys(S).forEach(U=>k[U]=k[M[U]]),k}function m(_,E,M,S){let z=new t,k=_.graph(),R=w(k.nodesep,k.edgesep,S);return E.forEach(H=>{let D;H.forEach(q=>{let Z=M[q];if(z.setNode(Z),D){var U=M[D],L=z.edge(U,Z);z.setEdge(U,Z,Math.max(R(_,q,D),L||0))}D=q})}),z}function y(_,E){return Object.values(E).reduce((M,S)=>{let z=Number.NEGATIVE_INFINITY,k=Number.POSITIVE_INFINITY;Object.entries(S).forEach(([H,D])=>{let q=N(_,H)/2;z=Math.max(D+q,z),k=Math.min(D-q,k)});const R=z-k;return R{["l","r"].forEach(R=>{let H=k+R,D=_[H];if(D===E)return;let q=Object.values(D),Z=S-l.applyWithChunking(Math.min,q);R!=="l"&&(Z=z-l.applyWithChunking(Math.max,q)),Z&&(_[H]=l.mapValues(D,U=>U+Z))})})}function v(_,E){return l.mapValues(_.ul,(M,S)=>{if(E)return _[E.toLowerCase()][S];{let z=Object.values(_).map(k=>k[S]).sort((k,R)=>k-R);return(z[1]+z[2])/2}})}function x(_){let E=l.buildLayerMatrix(_),M=Object.assign(r(_,E),i(_,E)),S={},z;["u","d"].forEach(R=>{z=R==="u"?E:Object.values(E).reverse(),["l","r"].forEach(H=>{H==="r"&&(z=z.map(U=>Object.values(U).reverse()));let D=(R==="u"?_.predecessors:_.successors).bind(_),q=d(_,z,M,D),Z=h(_,z,q.root,q.align,H==="r");H==="r"&&(Z=l.mapValues(Z,U=>-U)),S[R+H]=Z})});let k=y(_,S);return g(S,k),v(S,_.graph().align)}function w(_,E,M){return(S,z,k)=>{let R=S.node(z),H=S.node(k),D=0,q;if(D+=R.width/2,Object.hasOwn(R,"labelpos"))switch(R.labelpos.toLowerCase()){case"l":q=-R.width/2;break;case"r":q=R.width/2;break}if(q&&(D+=M?q:-q),q=0,D+=(R.dummy?E:_)/2,D+=(H.dummy?E:_)/2,D+=H.width/2,Object.hasOwn(H,"labelpos"))switch(H.labelpos.toLowerCase()){case"l":q=H.width/2;break;case"r":q=-H.width/2;break}return q&&(D+=M?q:-q),q=0,D}}function N(_,E){return _.node(E).width}return eh}var th,tx;function xT(){if(tx)return th;tx=1;let t=dt(),l=vT().positionX;th=r;function r(s){s=t.asNonCompoundGraph(s),i(s),Object.entries(l(s)).forEach(([u,c])=>s.node(u).x=c)}function i(s){let u=t.buildLayerMatrix(s),c=s.graph().ranksep,d=0;u.forEach(h=>{const m=h.reduce((y,g)=>{const v=s.node(g).height;return y>v?y:v},0);h.forEach(y=>s.node(y).y=d+m/2),d+=m+c})}return th}var nh,nx;function bT(){if(nx)return nh;nx=1;let t=tT(),l=nT(),r=lT(),i=dt().normalizeRanks,s=rT(),u=dt().removeEmptyRanks,c=iT(),d=oT(),h=sT(),m=yT(),y=xT(),g=dt(),v=mn().Graph;nh=x;function x(j,G){let $=G&&G.debugTiming?g.time:g.notime;$("layout",()=>{let W=$(" buildLayoutGraph",()=>D(j));$(" runLayout",()=>w(W,$,G)),$(" updateInputGraph",()=>N(j,W))})}function w(j,G,$){G(" makeSpaceForEdgeLabels",()=>q(j)),G(" removeSelfEdges",()=>K(j)),G(" acyclic",()=>t.run(j)),G(" nestingGraph.run",()=>c.run(j)),G(" rank",()=>r(g.asNonCompoundGraph(j))),G(" injectEdgeLabelProxies",()=>Z(j)),G(" removeEmptyRanks",()=>u(j)),G(" nestingGraph.cleanup",()=>c.cleanup(j)),G(" normalizeRanks",()=>i(j)),G(" assignRankMinMax",()=>U(j)),G(" removeEdgeLabelProxies",()=>L(j)),G(" normalize.run",()=>l.run(j)),G(" parentDummyChains",()=>s(j)),G(" addBorderSegments",()=>d(j)),G(" order",()=>m(j,$)),G(" insertSelfEdges",()=>I(j)),G(" adjustCoordinateSystem",()=>h.adjust(j)),G(" position",()=>y(j)),G(" positionSelfEdges",()=>ie(j)),G(" removeBorderNodes",()=>Y(j)),G(" normalize.undo",()=>l.undo(j)),G(" fixupEdgeLabelCoords",()=>J(j)),G(" undoCoordinateSystem",()=>h.undo(j)),G(" translateGraph",()=>te(j)),G(" assignNodeIntersects",()=>B(j)),G(" reversePoints",()=>T(j)),G(" acyclic.undo",()=>t.undo(j))}function N(j,G){j.nodes().forEach($=>{let W=j.node($),ee=G.node($);W&&(W.x=ee.x,W.y=ee.y,W.rank=ee.rank,G.children($).length&&(W.width=ee.width,W.height=ee.height))}),j.edges().forEach($=>{let W=j.edge($),ee=G.edge($);W.points=ee.points,Object.hasOwn(ee,"x")&&(W.x=ee.x,W.y=ee.y)}),j.graph().width=G.graph().width,j.graph().height=G.graph().height}let _=["nodesep","edgesep","ranksep","marginx","marginy"],E={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},M=["acyclicer","ranker","rankdir","align"],S=["width","height","rank"],z={width:0,height:0},k=["minlen","weight","width","height","labeloffset"],R={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},H=["labelpos"];function D(j){let G=new v({multigraph:!0,compound:!0}),$=X(j.graph());return G.setGraph(Object.assign({},E,O($,_),g.pick($,M))),j.nodes().forEach(W=>{let ee=X(j.node(W));const ne=O(ee,S);Object.keys(z).forEach(ue=>{ne[ue]===void 0&&(ne[ue]=z[ue])}),G.setNode(W,ne),G.setParent(W,j.parent(W))}),j.edges().forEach(W=>{let ee=X(j.edge(W));G.setEdge(W,Object.assign({},R,O(ee,k),g.pick(ee,H)))}),G}function q(j){let G=j.graph();G.ranksep/=2,j.edges().forEach($=>{let W=j.edge($);W.minlen*=2,W.labelpos.toLowerCase()!=="c"&&(G.rankdir==="TB"||G.rankdir==="BT"?W.width+=W.labeloffset:W.height+=W.labeloffset)})}function Z(j){j.edges().forEach(G=>{let $=j.edge(G);if($.width&&$.height){let W=j.node(G.v),ne={rank:(j.node(G.w).rank-W.rank)/2+W.rank,e:G};g.addDummyNode(j,"edge-proxy",ne,"_ep")}})}function U(j){let G=0;j.nodes().forEach($=>{let W=j.node($);W.borderTop&&(W.minRank=j.node(W.borderTop).rank,W.maxRank=j.node(W.borderBottom).rank,G=Math.max(G,W.maxRank))}),j.graph().maxRank=G}function L(j){j.nodes().forEach(G=>{let $=j.node(G);$.dummy==="edge-proxy"&&(j.edge($.e).labelRank=$.rank,j.removeNode(G))})}function te(j){let G=Number.POSITIVE_INFINITY,$=0,W=Number.POSITIVE_INFINITY,ee=0,ne=j.graph(),ue=ne.marginx||0,he=ne.marginy||0;function ye(ge){let de=ge.x,xe=ge.y,Ae=ge.width,Se=ge.height;G=Math.min(G,de-Ae/2),$=Math.max($,de+Ae/2),W=Math.min(W,xe-Se/2),ee=Math.max(ee,xe+Se/2)}j.nodes().forEach(ge=>ye(j.node(ge))),j.edges().forEach(ge=>{let de=j.edge(ge);Object.hasOwn(de,"x")&&ye(de)}),G-=ue,W-=he,j.nodes().forEach(ge=>{let de=j.node(ge);de.x-=G,de.y-=W}),j.edges().forEach(ge=>{let de=j.edge(ge);de.points.forEach(xe=>{xe.x-=G,xe.y-=W}),Object.hasOwn(de,"x")&&(de.x-=G),Object.hasOwn(de,"y")&&(de.y-=W)}),ne.width=$-G+ue,ne.height=ee-W+he}function B(j){j.edges().forEach(G=>{let $=j.edge(G),W=j.node(G.v),ee=j.node(G.w),ne,ue;$.points?(ne=$.points[0],ue=$.points[$.points.length-1]):($.points=[],ne=ee,ue=W),$.points.unshift(g.intersectRect(W,ne)),$.points.push(g.intersectRect(ee,ue))})}function J(j){j.edges().forEach(G=>{let $=j.edge(G);if(Object.hasOwn($,"x"))switch(($.labelpos==="l"||$.labelpos==="r")&&($.width-=$.labeloffset),$.labelpos){case"l":$.x-=$.width/2+$.labeloffset;break;case"r":$.x+=$.width/2+$.labeloffset;break}})}function T(j){j.edges().forEach(G=>{let $=j.edge(G);$.reversed&&$.points.reverse()})}function Y(j){j.nodes().forEach(G=>{if(j.children(G).length){let $=j.node(G),W=j.node($.borderTop),ee=j.node($.borderBottom),ne=j.node($.borderLeft[$.borderLeft.length-1]),ue=j.node($.borderRight[$.borderRight.length-1]);$.width=Math.abs(ue.x-ne.x),$.height=Math.abs(ee.y-W.y),$.x=ne.x+$.width/2,$.y=W.y+$.height/2}}),j.nodes().forEach(G=>{j.node(G).dummy==="border"&&j.removeNode(G)})}function K(j){j.edges().forEach(G=>{if(G.v===G.w){var $=j.node(G.v);$.selfEdges||($.selfEdges=[]),$.selfEdges.push({e:G,label:j.edge(G)}),j.removeEdge(G)}})}function I(j){var G=g.buildLayerMatrix(j);G.forEach($=>{var W=0;$.forEach((ee,ne)=>{var ue=j.node(ee);ue.order=ne+W,(ue.selfEdges||[]).forEach(he=>{g.addDummyNode(j,"selfedge",{width:he.label.width,height:he.label.height,rank:ue.rank,order:ne+ ++W,e:he.e,label:he.label},"_se")}),delete ue.selfEdges})})}function ie(j){j.nodes().forEach(G=>{var $=j.node(G);if($.dummy==="selfedge"){var W=j.node($.e.v),ee=W.x+W.width/2,ne=W.y,ue=$.x-ee,he=W.height/2;j.setEdge($.e,$.label),j.removeNode(G),$.label.points=[{x:ee+2*ue/3,y:ne-he},{x:ee+5*ue/6,y:ne-he},{x:ee+ue,y:ne},{x:ee+5*ue/6,y:ne+he},{x:ee+2*ue/3,y:ne+he}],$.label.x=$.x,$.label.y=$.y}})}function O(j,G){return g.mapValues(g.pick(j,G),Number)}function X(j){var G={};return j&&Object.entries(j).forEach(([$,W])=>{typeof $=="string"&&($=$.toLowerCase()),G[$]=W}),G}return nh}var ah,ax;function wT(){if(ax)return ah;ax=1;let t=dt(),l=mn().Graph;ah={debugOrdering:r};function r(i){let s=t.buildLayerMatrix(i),u=new l({compound:!0,multigraph:!0}).setGraph({});return i.nodes().forEach(c=>{u.setNode(c,{label:c}),u.setParent(c,"layer"+i.node(c).rank)}),i.edges().forEach(c=>u.setEdge(c.v,c.w,{},c.name)),s.forEach((c,d)=>{let h="layer"+d;u.setNode(h,{rank:"same"}),c.reduce((m,y)=>(u.setEdge(m,y,{style:"invis"}),y))}),u}return ah}var lh,lx;function _T(){return lx||(lx=1,lh="1.1.8"),lh}var rh,rx;function ST(){return rx||(rx=1,rh={graphlib:mn(),layout:bT(),debug:wT(),util:{time:dt().time,notime:dt().notime},version:_T()}),rh}var ET=ST();const ix=zh(ET),Di=180,mr=44,ox=20,sx=40,NT=20,ux=12;function CT(t,l,r,i,s,u){const c=[],d=[],h=new Set,m=new Set,y=new Map;for(const v of r)for(const x of v.agents)m.add(x),y.set(x,v.name);for(const v of r){const x=s[v.name],w=v.agents.length,N=Di+ox*2,_=sx+w*mr+(w-1)*ux+NT;c.push({id:v.name,type:"groupNode",position:{x:0,y:0},data:{label:v.name,type:"parallel_group",status:(x==null?void 0:x.status)||"pending",groupName:v.name,progress:u[v.name]},style:{width:N,height:_}});for(let E=0;E${v.to}`,source:v.from,target:v.to,type:"animatedEdge",data:{when:v.when},animated:!1});return zT(c,d),{nodes:c,edges:d}}function zT(t,l){var i,s,u,c;const r=new ix.graphlib.Graph;r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:"TB",nodesep:50,ranksep:70,marginx:30,marginy:30});for(const d of t){if(d.parentId)continue;const h=d.type==="groupNode",m=h&&((i=d.style)==null?void 0:i.width)||Di,y=h&&((s=d.style)==null?void 0:s.height)||mr;r.setNode(d.id,{width:m,height:y})}for(const d of l)r.hasNode(d.source)&&r.hasNode(d.target)&&r.setEdge(d.source,d.target);ix.layout(r);for(const d of t){if(d.parentId)continue;const h=r.node(d.id);if(!h)continue;const m=d.type==="groupNode",y=m&&((u=d.style)==null?void 0:u.width)||Di,g=m&&((c=d.style)==null?void 0:c.height)||mr;d.position={x:h.x-y/2,y:h.y-g/2}}}const ht={pending:"#52525b",running:"#3b82f6",completed:"#22c55e",failed:"#ef4444",waiting:"#f59e0b",skipped:"#6b7280"},MT=V.memo(function({data:l,id:r,selected:i}){const s=l,u=s.status||"pending",c=ht[u]||ht.pending,d=_e(v=>{var x;return(x=v.nodes[r])==null?void 0:x.elapsed}),h=_e(v=>{var x;return(x=v.nodes[r])==null?void 0:x.model}),m=_e(v=>{var x;return(x=v.nodes[r])==null?void 0:x.tokens}),y=_e(v=>{var x;return(x=v.nodes[r])==null?void 0:x.cost_usd}),g=V.useMemo(()=>{const v=[`Status: ${u}`];return d!=null&&v.push(`Elapsed: ${AT(d)}`),h&&v.push(`Model: ${h}`),m!=null&&v.push(`Tokens: ${m.toLocaleString()}`),y!=null&&v.push(`Cost: $${y.toFixed(4)}`),v.join(` -`)},[u,d,h,m,y]);return C.jsxs(C.Fragment,{children:[C.jsx(Ft,{type:"target",position:me.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),C.jsxs("div",{title:g,className:St("flex items-center gap-2 px-3 py-2 rounded-lg border-2 bg-[var(--node-bg)] min-w-[140px] max-w-[200px] transition-all duration-300",i&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]",u==="running"&&"shadow-[0_0_12px_var(--running-glow)]"),style:{borderColor:c},children:[C.jsx("div",{className:St("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",u==="running"&&"animate-pulse"),style:{backgroundColor:`${c}20`},children:C.jsx(aS,{className:"w-3.5 h-3.5",style:{color:c}})}),C.jsx("span",{className:"text-xs font-medium text-[var(--text)] truncate",children:s.label})]}),C.jsx(Ft,{type:"source",position:me.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function AT(t){if(t<1)return`${(t*1e3).toFixed(0)}ms`;if(t<60)return`${t.toFixed(1)}s`;const l=Math.floor(t/60),r=(t%60).toFixed(0);return`${l}m ${r}s`}const TT=V.memo(function({data:l,id:r,selected:i}){const s=l,u=s.status||"pending",c=ht[u]||ht.pending,d=_e(y=>{var g;return(g=y.nodes[r])==null?void 0:g.elapsed}),h=_e(y=>{var g;return(g=y.nodes[r])==null?void 0:g.exit_code}),m=V.useMemo(()=>{const y=[`Status: ${u}`];return d!=null&&y.push(`Elapsed: ${OT(d)}`),h!=null&&y.push(`Exit code: ${h}`),y.join(` -`)},[u,d,h]);return C.jsxs(C.Fragment,{children:[C.jsx(Ft,{type:"target",position:me.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),C.jsxs("div",{title:m,className:St("flex items-center gap-2 px-3 py-2 rounded-lg border-2 bg-[var(--node-bg)] min-w-[140px] max-w-[200px] transition-all duration-300",i&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]",u==="running"&&"shadow-[0_0_12px_var(--running-glow)]"),style:{borderColor:c},children:[C.jsx("div",{className:St("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",u==="running"&&"animate-pulse"),style:{backgroundColor:`${c}20`},children:C.jsx(gS,{className:"w-3.5 h-3.5",style:{color:c}})}),C.jsx("span",{className:"text-xs font-medium text-[var(--text)] truncate",children:s.label})]}),C.jsx(Ft,{type:"source",position:me.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})});function OT(t){if(t<1)return`${(t*1e3).toFixed(0)}ms`;if(t<60)return`${t.toFixed(1)}s`;const l=Math.floor(t/60),r=(t%60).toFixed(0);return`${l}m ${r}s`}const jT=V.memo(function({data:l,id:r,selected:i}){const s=l,u=s.status||"pending",c=ht[u]||ht.pending,d=_e(y=>{var g;return(g=y.nodes[r])==null?void 0:g.selected_option}),h=_e(y=>{var g;return(g=y.nodes[r])==null?void 0:g.route}),m=V.useMemo(()=>{const y=[`Status: ${u}`];return d&&y.push(`Selected: ${d}`),h&&y.push(`Route: ${h}`),y.join(` -`)},[u,d,h]);return C.jsxs(C.Fragment,{children:[C.jsx(Ft,{type:"target",position:me.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),C.jsxs("div",{title:m,className:St("flex items-center gap-2 px-3 py-2 rounded-lg border-2 border-dashed bg-[var(--node-bg)] min-w-[140px] max-w-[200px] transition-all duration-300",i&&"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)]"),style:{borderColor:c},children:[C.jsx("div",{className:St("flex items-center justify-center w-6 h-6 rounded-md flex-shrink-0",u==="waiting"&&"animate-pulse"),style:{backgroundColor:`${c}20`},children:C.jsx(hS,{className:"w-3.5 h-3.5",style:{color:c}})}),C.jsx("span",{className:"text-xs font-medium text-[var(--text)] truncate",children:s.label})]}),C.jsx(Ft,{type:"source",position:me.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})}),RT=V.memo(function({data:l,id:r,selected:i}){const s=l,c=s.type==="for_each_group"?fS:sS,d=s.progress,m=_e(v=>{var x;return(x=v.nodes[r])==null?void 0:x.status})||s.status||"pending",y=ht[m]||ht.pending,g=d?`${d.completed+d.failed}/${d.total}${d.failed>0?` (${d.failed} failed)`:""}`:null;return C.jsxs(C.Fragment,{children:[C.jsx(Ft,{type:"target",position:me.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),C.jsxs("div",{className:St("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",i&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]",m==="running"&&"shadow-[0_0_16px_var(--running-glow)]"),style:{borderColor:y,minHeight:"100%"},children:[C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx(c,{className:"w-3.5 h-3.5",style:{color:y}}),C.jsx("span",{className:"text-xs font-medium text-[var(--text-secondary)]",children:s.label})]}),g&&C.jsx("span",{className:"text-[10px] text-[var(--text-muted)] font-mono",children:g})]}),C.jsx(Ft,{type:"source",position:me.Bottom,className:"!bg-[var(--border)] !border-none !w-2 !h-2"})]})}),DT=V.memo(function({data:l,selected:r}){const s=l.status||"pending",u=ht[s]||ht.pending;return C.jsxs(C.Fragment,{children:[C.jsx(Ft,{type:"target",position:me.Top,className:"!bg-[var(--border)] !border-none !w-2 !h-2"}),C.jsx("div",{className:St("flex items-center justify-center w-11 h-11 rounded-full border-2 bg-[var(--node-bg)] transition-all duration-300",r&&"ring-2 ring-[var(--accent)] ring-offset-1 ring-offset-[var(--bg)]",s==="completed"&&"shadow-[0_0_12px_var(--completed-muted)]"),style:{borderColor:u},children:C.jsx(rS,{className:"w-4 h-4",style:{color:u}})})]})}),kT=V.memo(function({id:l,sourceX:r,sourceY:i,targetX:s,targetY:u,sourcePosition:c,targetPosition:d,source:h,target:m,data:y}){const g=_e(H=>H.highlightedEdges),v=V.useMemo(()=>g.find(H=>H.from===h&&H.to===m),[g,h,m]),[x,w,N]=$h({sourceX:r,sourceY:i,targetX:s,targetY:u,sourcePosition:c,targetPosition:d}),_=y==null?void 0:y.when,E=!!_,M=(v==null?void 0:v.state)==="taken",S=(v==null?void 0:v.state)==="highlighted";let z="var(--edge-color)",k=2,R;return M?(z="var(--edge-taken)",k=3):S&&(z="var(--edge-active)",k=3),E&&!M&&!S&&(R="6 3"),C.jsxs(C.Fragment,{children:[C.jsx(no,{id:l,path:x,style:{stroke:z,strokeWidth:k,strokeDasharray:R,transition:"stroke 0.3s ease, stroke-width 0.3s ease"},markerEnd:`url(#arrow-${M?"taken":S?"active":"default"})`}),E&&C.jsx(cA,{children:C.jsx("div",{className:"nodrag nopan",style:{position:"absolute",transform:`translate(-50%, -50%) translate(${w}px,${N}px)`,pointerEvents:"all"},children:C.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:M?"var(--edge-taken)":"var(--surface)",color:M?"var(--bg)":"var(--text-muted)",border:`1px solid ${M?"var(--edge-taken)":"var(--border)"}`},title:_,children:_})})}),M&&C.jsx("circle",{r:"3",fill:"var(--edge-taken)",children:C.jsx("animateMotion",{dur:"1s",repeatCount:"indefinite",path:x})})]})}),HT={agentNode:MT,scriptNode:TT,gateNode:jT,groupNode:RT,endNode:DT},LT={animatedEdge:kT},BT={type:"animatedEdge"};function qT(){return C.jsx("svg",{style:{position:"absolute",width:0,height:0},children:C.jsxs("defs",{children:[C.jsx("marker",{id:"arrow-default",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:C.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"var(--edge-color)"})}),C.jsx("marker",{id:"arrow-active",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:C.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"var(--edge-active)"})}),C.jsx("marker",{id:"arrow-taken",viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:C.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"var(--edge-taken)"})})]})})}function UT(){const t=_e(z=>z.agents),l=_e(z=>z.routes),r=_e(z=>z.parallelGroups),i=_e(z=>z.forEachGroups),s=_e(z=>z.nodes),u=_e(z=>z.groupProgress),c=_e(z=>z.selectNode),d=_e(z=>z.selectedNode),h=_e(z=>z.workflowStatus),[m,y,g]=fA([]),[v,x,w]=dA([]),N=V.useRef(!1);V.useEffect(()=>{if(t.length===0||N.current)return;N.current=!0;const{nodes:z,edges:k}=CT(t,l,r,i,s,u);y(z),x(k)},[t,l,r,i,s,u,y,x]),V.useEffect(()=>{N.current&&y(z=>z.map(k=>{const R=s[k.id];if(!R)return k;const H=R.status||"pending",D=k.data.status;if(H!==D){const q={...k.data,status:H};return k.data.groupName&&u[k.data.groupName]&&(q.progress=u[k.data.groupName]),{...k,data:q}}if(k.data.groupName&&u[k.data.groupName]){const q=k.data.progress,Z=u[k.data.groupName];if(Z&&(!q||q.completed!==Z.completed||q.failed!==Z.failed))return{...k,data:{...k.data,progress:Z}}}return k}))},[s,u,y]);const _=V.useCallback((z,k)=>{k.type!=="groupNode"&&c(k.id)},[c]),E=V.useCallback(()=>{c(null)},[c]),M=V.useCallback(z=>{var R;const k=((R=z.data)==null?void 0:R.status)||"pending";return ht[k]||ht.pending},[]);V.useEffect(()=>{y(z=>z.map(k=>({...k,selected:k.id===d})))},[d,y]);const S=h==="pending"&&t.length===0;return C.jsxs("div",{className:"w-full h-full relative",children:[C.jsx(qT,{}),S&&C.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center pointer-events-none",children:[C.jsx(oh,{className:"w-8 h-8 text-[var(--text-muted)] animate-spin mb-3 opacity-40"}),C.jsx("p",{className:"text-sm text-[var(--text-muted)] animate-pulse",children:"Waiting for workflow…"})]}),C.jsxs(sA,{nodes:m,edges:v,onNodesChange:g,onEdgesChange:w,onNodeClick:_,onPaneClick:E,nodeTypes:HT,edgeTypes:LT,defaultEdgeOptions:BT,fitView:!0,fitViewOptions:{padding:.2},minZoom:.2,maxZoom:2,proOptions:{hideAttribution:!0},nodesDraggable:!0,nodesConnectable:!1,elementsSelectable:!0,children:[C.jsx(yA,{variant:na.Dots,gap:20,size:1,color:"var(--border-subtle)"}),C.jsx(LA,{nodeColor:M,maskColor:"var(--minimap-mask)",style:{background:"var(--minimap-bg)"},pannable:!0,zoomable:!0}),C.jsx(EA,{showInteractive:!1,children:C.jsx(GT,{})}),C.jsx(VT,{})]})]})}function GT(){const{fitView:t}=to(),l=V.useCallback(()=>{t({padding:.2,duration:300})},[t]);return C.jsx("button",{onClick:l,className:"react-flow__controls-button",title:"Fit view (F)",style:{display:"flex",alignItems:"center",justifyContent:"center"},children:C.jsx(cS,{className:"w-3.5 h-3.5"})})}function VT(){const{fitView:t}=to();return V.useEffect(()=>{const l=r=>{var s;const i=(s=r.target)==null?void 0:s.tagName;i==="INPUT"||i==="TEXTAREA"||i==="SELECT"||r.key==="f"&&!r.ctrlKey&&!r.metaKey&&!r.altKey&&t({padding:.2,duration:300})};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[t]),null}function _u({items:t}){const l=t.filter(r=>r.value!=null&&r.value!=="");return l.length===0?null:C.jsx("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1.5 text-xs",children:l.map(({label:r,value:i})=>C.jsxs("div",{className:"contents",children:[C.jsx("dt",{className:"text-[var(--text-muted)] whitespace-nowrap",children:r}),C.jsx("dd",{className:"text-[var(--text)] break-words",children:typeof i=="object"?JSON.stringify(i):String(i)})]},r))})}function YT(t){const l=[];return t.elapsed!=null&&l.push({label:"Elapsed",value:iu(t.elapsed)}),t.model&&l.push({label:"Model",value:t.model}),t.tokens!=null&&l.push({label:"Tokens",value:Kf(t.tokens)}),t.input_tokens!=null&&t.output_tokens!=null&&l.push({label:"In / Out",value:`${Kf(t.input_tokens)} / ${Kf(t.output_tokens)}`}),t.cost_usd!=null&&l.push({label:"Cost",value:tE(t.cost_usd)}),t.iteration!=null&&l.push({label:"Iteration",value:t.iteration}),t.error_type&&l.push({label:"Error",value:t.error_type}),t.error_message&&l.push({label:"Message",value:t.error_message}),l}function Ch({output:t,title:l="Output",defaultExpanded:r=!0,maxHeight:i="300px"}){const[s,u]=V.useState(r),[c,d]=V.useState(!1),h=Nx(t);if(!h)return null;const m=typeof t=="object"&&t!==null,y=async()=>{await navigator.clipboard.writeText(h),d(!0),setTimeout(()=>d(!1),2e3)};return C.jsxs("div",{className:"space-y-1.5",children:[C.jsxs("div",{className:"flex items-center justify-between",children:[C.jsxs("button",{onClick:()=>u(!s),className:"flex items-center gap-1 text-[10px] uppercase tracking-wider text-[var(--text-muted)] hover:text-[var(--text)] transition-colors font-semibold",children:[s?C.jsx(Mh,{className:"w-3 h-3"}):C.jsx(mx,{className:"w-3 h-3"}),l]}),s&&C.jsx("button",{onClick:y,className:"flex items-center gap-1 text-[10px] text-[var(--text-muted)] hover:text-[var(--text)] transition-colors",title:"Copy to clipboard",children:c?C.jsx(px,{className:"w-3 h-3 text-[var(--completed)]"}):C.jsx(yx,{className:"w-3 h-3"})})]}),s&&C.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:i},children:m?C.jsx(XT,{text:h}):h})]})}function XT({text:t}){const l=t.split(/("(?:[^"\\]|\\.)*")/g);return C.jsx(C.Fragment,{children:l.map((r,i)=>{if(i%2===1){const u=l.slice(i+1).join(""),c=/^\s*:/.test(u);return C.jsx("span",{className:c?"text-blue-400":"text-green-400",children:r},i)}const s=r.replace(/\b(true|false|null)\b|(-?\d+\.?\d*(?:e[+-]?\d+)?)/gi,(u,c,d)=>c?`${u}`:d?`${u}`:u);return C.jsx("span",{dangerouslySetInnerHTML:{__html:s}},i)})})}function $T({activity:t}){const[l,r]=V.useState(!0),i=V.useRef(null);return V.useEffect(()=>{i.current&&l&&(i.current.scrollTop=i.current.scrollHeight)},[t.length,l]),t.length===0?null:C.jsxs("div",{className:"space-y-1.5",children:[C.jsxs("button",{onClick:()=>r(!l),className:"flex items-center gap-1 text-[10px] uppercase tracking-wider text-[var(--text-muted)] hover:text-[var(--text)] transition-colors font-semibold",children:[l?C.jsx(Mh,{className:"w-3 h-3"}):C.jsx(mx,{className:"w-3 h-3"}),"Activity (",t.length,")"]}),l&&C.jsx("div",{ref:i,className:"max-h-[400px] overflow-y-auto space-y-0.5",children:t.map((s,u)=>C.jsx(QT,{entry:s},u))})]})}function QT({entry:t}){const l={reasoning:"text-indigo-400/70","tool-start":"text-blue-400","tool-complete":"text-green-400",turn:"text-amber-400",message:"text-[var(--text)]"};return C.jsxs("div",{className:St("py-1.5 px-2 rounded text-[11px] leading-relaxed border-b border-[var(--border-subtle)] last:border-b-0"),children:[C.jsxs("div",{className:"flex items-start gap-1.5",children:[C.jsx("span",{className:"w-4 text-center flex-shrink-0",children:t.icon}),C.jsx("span",{className:"text-[var(--text-muted)] uppercase text-[9px] font-semibold tracking-wider w-12 flex-shrink-0 pt-px",children:t.label}),C.jsx("span",{className:St("break-words",l[t.type]||"text-[var(--text)]"),children:typeof t.text=="object"?JSON.stringify(t.text):t.text})]}),t.detail&&C.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 t.detail=="object"?JSON.stringify(t.detail,null,2):t.detail})]})}function ZT({node:t}){const l=t.status,r=ht[l]||ht.pending;return C.jsxs("div",{className:"space-y-4",children:[C.jsxs("div",{className:"flex items-center gap-2",children:[C.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:l}),C.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Agent"})]}),C.jsx(_u,{items:YT(t)}),t.prompt&&C.jsx(Ch,{output:t.prompt,title:"Input / Prompt",defaultExpanded:!0}),C.jsx($T,{activity:t.activity}),t.output!=null&&C.jsx(Ch,{output:t.output,title:"Output"})]})}function KT({node:t}){const l=t.status,r=ht[l]||ht.pending,i=[];t.elapsed!=null&&i.push({label:"Elapsed",value:iu(t.elapsed)}),t.exit_code!=null&&i.push({label:"Exit Code",value:t.exit_code}),t.error_type&&i.push({label:"Error",value:t.error_type}),t.error_message&&i.push({label:"Message",value:t.error_message});let s="";return t.stdout&&(s+=t.stdout),t.stderr&&(s+=(s?` - ---- stderr --- -`:"")+t.stderr),C.jsxs("div",{className:"space-y-4",children:[C.jsxs("div",{className:"flex items-center gap-2",children:[C.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:l}),C.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Script"})]}),C.jsx(_u,{items:i}),s&&C.jsx(Ch,{output:s,title:"Output"})]})}function IT({node:t}){const l=t.status,r=ht[l]||ht.pending,i=[];if(t.selected_option&&i.push({label:"Selected",value:t.selected_option}),t.route&&i.push({label:"Route",value:t.route}),t.additional_input){const s=typeof t.additional_input=="object"?JSON.stringify(t.additional_input):t.additional_input;i.push({label:"Input",value:s})}return C.jsxs("div",{className:"space-y-4",children:[C.jsxs("div",{className:"flex items-center gap-2",children:[C.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:l}),C.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"Human Gate"})]}),t.prompt&&C.jsxs("div",{className:"space-y-1.5",children:[C.jsx("h4",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)] font-semibold",children:"Prompt"}),C.jsx("p",{className:"text-xs text-[var(--text)] bg-[var(--bg)] border border-[var(--border)] rounded-md p-3",children:t.prompt})]}),t.options&&t.options.length>0&&C.jsxs("div",{className:"space-y-1.5",children:[C.jsx("h4",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)] font-semibold",children:"Options"}),C.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.options.map(s=>C.jsx("span",{className:`text-[11px] px-2 py-0.5 rounded border ${s===t.selected_option?"border-[var(--completed)] text-[var(--completed)] bg-[var(--completed-muted)]":"border-[var(--border)] text-[var(--text-muted)]"}`,children:s},s))})]}),C.jsx(_u,{items:i})]})}function JT({node:t}){const l=t.status,r=ht[l]||ht.pending,s=_e(d=>d.groupProgress)[t.name],u=t.type==="for_each_group",c=[];return t.elapsed!=null&&c.push({label:"Elapsed",value:iu(t.elapsed)}),s&&(c.push({label:"Total",value:s.total}),c.push({label:"Completed",value:s.completed}),s.failed>0&&c.push({label:"Failed",value:s.failed})),t.success_count!=null&&c.push({label:"Success",value:t.success_count}),t.failure_count!=null&&c.push({label:"Failures",value:t.failure_count}),C.jsxs("div",{className:"space-y-4",children:[C.jsxs("div",{className:"flex items-center gap-2",children:[C.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:l}),C.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:u?"For-Each Group":"Parallel Group"})]}),s&&s.total>0&&C.jsxs("div",{className:"space-y-1",children:[C.jsxs("div",{className:"flex justify-between text-[10px] text-[var(--text-muted)]",children:[C.jsx("span",{children:"Progress"}),C.jsxs("span",{children:[s.completed+s.failed,"/",s.total]})]}),C.jsx("div",{className:"h-1.5 bg-[var(--bg)] rounded-full overflow-hidden",children:C.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${(s.completed+s.failed)/s.total*100}%`,background:s.failed>0?`linear-gradient(90deg, var(--completed) ${s.completed/(s.completed+s.failed)*100}%, var(--failed) 0%)`:"var(--completed)"}})})]}),C.jsx(_u,{items:c})]})}function FT(){const t=_e(u=>u.selectedNode),l=_e(u=>u.nodes),r=_e(u=>u.selectNode),i=t?l[t]:null;if(!t||!i)return C.jsxs("div",{className:"h-full flex flex-col bg-[var(--surface)]",children:[C.jsx("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:C.jsx("h2",{className:"text-sm font-semibold text-[var(--text)]",children:"Detail"})}),C.jsx("div",{className:"flex-1 flex items-center justify-center",children:C.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Click a node to view details"})})]});const s=(()=>{switch(i.type){case"script":return KT;case"human_gate":return IT;case"parallel_group":case"for_each_group":return JT;default:return ZT}})();return C.jsxs("div",{className:"h-full flex flex-col bg-[var(--surface)]",children:[C.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)] flex-shrink-0",children:[C.jsx("h2",{className:"text-sm font-semibold text-[var(--text)] truncate",children:t}),C.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:C.jsx(vx,{className:"w-4 h-4"})})]}),C.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3",children:C.jsx(s,{node:i})})]})}function $s(t){if(t==null)return"";if(typeof t=="string")return t;try{return JSON.stringify(t,null,2)}catch{return String(t)}}function WT(){const t=_e(_=>_.eventLog),l=_e(_=>_.activityLog),r=_e(_=>_.workflowOutput),i=_e(_=>_.workflowStatus),[s,u]=V.useState("log"),[c,d]=V.useState(!1),[h,m]=V.useState(0),[y,g]=V.useState(0),v=V.useCallback(_=>{u(_),_==="log"&&m(t.length),_==="activity"&&g(l.length)},[t.length,l.length]);V.useEffect(()=>{s==="log"&&m(t.length)},[s,t.length]),V.useEffect(()=>{s==="activity"&&g(l.length)},[s,l.length]),V.useEffect(()=>{i==="completed"&&r!=null&&u("output")},[i,r]);const x=r!=null,w=s!=="log"?Math.max(0,t.length-h):0,N=s!=="activity"?Math.max(0,l.length-y):0;return c?C.jsx("div",{className:"flex items-center bg-[var(--surface)] border-t border-[var(--border)] px-3 py-1",children:C.jsxs("button",{onClick:()=>d(!1),className:"flex items-center gap-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text)] transition-colors",children:[C.jsx(lS,{className:"w-3 h-3"}),C.jsx($0,{className:"w-3 h-3"}),C.jsx("span",{children:"Output"}),l.length>0&&C.jsxs("span",{className:"text-[10px] text-[var(--text-muted)]",children:["(",l.length,")"]})]})}):C.jsxs("div",{className:"flex flex-col h-full bg-[var(--surface)] border-t border-[var(--border)]",children:[C.jsxs("div",{className:"flex items-center justify-between px-2 flex-shrink-0 border-b border-[var(--border)]",children:[C.jsxs("div",{className:"flex items-center gap-0.5",children:[C.jsx(ih,{active:s==="log",onClick:()=>v("log"),icon:C.jsx($0,{className:"w-3 h-3"}),label:"Log",count:t.length,unread:w}),C.jsx(ih,{active:s==="activity",onClick:()=>v("activity"),icon:C.jsx(gx,{className:"w-3 h-3"}),label:"Activity",count:l.length,unread:N}),C.jsx(ih,{active:s==="output",onClick:()=>v("output"),icon:C.jsx(oS,{className:"w-3 h-3"}),label:"Output",badge:x?i==="failed"?"error":"success":void 0})]}),C.jsx("button",{onClick:()=>d(!0),className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--surface-hover)] transition-colors",title:"Collapse panel",children:C.jsx(Mh,{className:"w-3.5 h-3.5"})})]}),C.jsx("div",{className:"flex-1 overflow-hidden",children:s==="activity"?C.jsx(PT,{entries:l}):s==="log"?C.jsx(e4,{entries:t}):C.jsx(t4,{output:r,status:i})})]})}function ih({active:t,onClick:l,icon:r,label:i,count:s,badge:u,unread:c}){return C.jsxs("button",{onClick:l,className:St("relative flex items-center gap-1.5 px-3 py-1.5 text-xs transition-colors border-b-2 -mb-px",t?"text-[var(--text)] border-[var(--accent)]":"text-[var(--text-muted)] border-transparent hover:text-[var(--text-secondary)]"),children:[r,C.jsx("span",{children:i}),s!=null&&s>0&&C.jsx("span",{className:"text-[10px] text-[var(--text-muted)] tabular-nums",children:s}),u&&C.jsx("span",{className:St("w-1.5 h-1.5 rounded-full",u==="success"?"bg-[var(--completed)]":"bg-[var(--failed)]")}),!t&&c!=null&&c>0&&C.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:C.jsx("span",{className:"text-[8px] font-bold text-white leading-none tabular-nums",children:c>99?"99+":c})})]})}const cx={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 PT({entries:t}){const l=V.useRef(null),r=V.useRef(!0),i=_e(h=>h.selectNode),[s,u]=V.useState(""),c=V.useCallback(()=>{const h=l.current;if(!h)return;const m=h.scrollHeight-h.scrollTop-h.clientHeight<30;r.current=m},[]),d=V.useMemo(()=>{if(!s)return t;const h=s.toLowerCase();return t.filter(m=>m.source.toLowerCase().includes(h)||$s(m.message).toLowerCase().includes(h))},[t,s]);return V.useEffect(()=>{l.current&&r.current&&(l.current.scrollTop=l.current.scrollHeight)},[d.length]),t.length===0?C.jsx("div",{className:"h-full flex items-center justify-center",children:C.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Waiting for agent activity…"})}):C.jsxs("div",{className:"h-full flex flex-col",children:[C.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-[var(--border-subtle)] flex-shrink-0",children:[C.jsx(dS,{className:"w-3 h-3 text-[var(--text-muted)] flex-shrink-0"}),C.jsx("input",{type:"text",value:s,onChange:h=>u(h.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"}),s&&C.jsxs(C.Fragment,{children:[C.jsxs("span",{className:"text-[10px] text-[var(--text-muted)] tabular-nums flex-shrink-0",children:[d.length," of ",t.length]}),C.jsx("button",{onClick:()=>u(""),className:"text-[var(--text-muted)] hover:text-[var(--text)] transition-colors flex-shrink-0",title:"Clear filter",children:C.jsx(vx,{className:"w-3 h-3"})})]})]}),C.jsxs("div",{ref:l,onScroll:c,className:"flex-1 overflow-y-auto font-mono text-[11px] leading-[1.6] px-3 py-2",children:[d.map((h,m)=>{const y=cx[h.type]||cx.message,g=k1(h.timestamp);return C.jsxs("div",{className:"group",children:[C.jsxs("div",{className:"flex gap-1.5 hover:bg-[var(--surface-hover)] rounded px-1 -mx-1",children:[C.jsx("span",{className:"text-[var(--text-muted)] flex-shrink-0 select-none tabular-nums",children:g}),C.jsx("span",{className:St("flex-shrink-0 w-[5ch] text-[10px] font-semibold tabular-nums select-none",y.labelColor),children:y.label}),C.jsx("button",{onClick:()=>i(h.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 ${h.source}`,children:h.source}),C.jsx("span",{className:St("break-words min-w-0",y.color,h.type==="reasoning"&&"italic"),children:$s(h.message)})]}),h.detail&&C.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:$s(h.detail)})]},m)}),s&&d.length===0&&C.jsx("div",{className:"flex items-center justify-center py-4",children:C.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:['No matches for "',s,'"']})})]})]})}const fx={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 e4({entries:t}){const l=V.useRef(null),r=V.useRef(!0),i=_e(u=>u.selectNode),s=V.useCallback(()=>{const u=l.current;if(!u)return;const c=u.scrollHeight-u.scrollTop-u.clientHeight<30;r.current=c},[]);return V.useEffect(()=>{l.current&&r.current&&(l.current.scrollTop=l.current.scrollHeight)},[t.length]),t.length===0?C.jsx("div",{className:"h-full flex items-center justify-center",children:C.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Waiting for events…"})}):C.jsx("div",{ref:l,onScroll:s,className:"h-full overflow-y-auto font-mono text-[11px] leading-[1.6] px-3 py-2",children:t.map((u,c)=>{const d=fx[u.level]||fx.info,h=k1(u.timestamp);return C.jsxs("div",{className:"flex gap-2 hover:bg-[var(--surface-hover)] rounded px-1 -mx-1",children:[C.jsx("span",{className:"text-[var(--text-muted)] flex-shrink-0 select-none tabular-nums",children:h}),C.jsx("span",{className:St("flex-shrink-0 w-3 text-center select-none",d.color),children:d.icon}),C.jsx("button",{onClick:()=>i(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}),C.jsx("span",{className:St("break-words",u.level==="error"?"text-red-400":u.level==="success"?"text-green-400":"text-[var(--text)]"),children:$s(u.message)})]},c)})})}function k1(t){const l=new Date(t*1e3),r=l.getHours().toString().padStart(2,"0"),i=l.getMinutes().toString().padStart(2,"0"),s=l.getSeconds().toString().padStart(2,"0");return`${r}:${i}:${s}`}function t4({output:t,status:l}){const[r,i]=V.useState(!1),s=Nx(t),u=async()=>{s&&(await navigator.clipboard.writeText(s),i(!0),setTimeout(()=>i(!1),2e3))};return t==null?C.jsx("div",{className:"h-full flex items-center justify-center",children:C.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:l==="running"?"Workflow running — output will appear when complete…":l==="failed"?"Workflow failed — no output produced":"No output yet"})}):C.jsxs("div",{className:"h-full flex flex-col",children:[C.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-b border-[var(--border-subtle)] flex-shrink-0",children:[C.jsx("span",{className:"text-[10px] text-[var(--text-muted)] uppercase tracking-wider font-semibold",children:"Workflow Result"}),C.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?C.jsxs(C.Fragment,{children:[C.jsx(px,{className:"w-3 h-3 text-[var(--completed)]"}),C.jsx("span",{className:"text-[var(--completed)]",children:"Copied"})]}):C.jsxs(C.Fragment,{children:[C.jsx(yx,{className:"w-3 h-3"}),C.jsx("span",{children:"Copy"})]})})]}),C.jsx("div",{className:"flex-1 overflow-auto px-3 py-2",children:C.jsx("pre",{className:"font-mono text-[11px] leading-relaxed text-[var(--text)] whitespace-pre-wrap break-words",children:typeof t=="object"?C.jsx(n4,{text:s}):s})})]})}function n4({text:t}){const l=t.split(/("(?:[^"\\]|\\.)*")/g);return C.jsx(C.Fragment,{children:l.map((r,i)=>{if(i%2===1){const u=l.slice(i+1).join(""),c=/^\s*:/.test(u);return C.jsx("span",{className:c?"text-blue-400":"text-green-400",children:r},i)}const s=r.replace(/\b(true|false|null)\b|(-?\d+\.?\d*(?:e[+-]?\d+)?)/gi,(u,c,d)=>c?`${u}`:d?`${u}`:u);return C.jsx("span",{dangerouslySetInnerHTML:{__html:s}},i)})})}function a4(){const t=_e(l=>l.selectedNode);return C.jsxs(ch,{direction:"vertical",className:"flex-1 overflow-hidden",children:[C.jsx(Ai,{defaultSize:70,minSize:30,children:C.jsxs(ch,{direction:"horizontal",className:"h-full",children:[C.jsx(Ai,{defaultSize:t?65:100,minSize:40,children:C.jsx(UT,{})}),t&&C.jsxs(C.Fragment,{children:[C.jsx(fh,{className:"w-[3px] bg-[var(--border)] hover:bg-[var(--text-muted)] transition-colors cursor-col-resize"}),C.jsx(Ai,{defaultSize:35,minSize:20,maxSize:60,children:C.jsx(FT,{})})]})]})}),C.jsx(fh,{className:"h-[3px] bg-[var(--border)] hover:bg-[var(--text-muted)] transition-colors cursor-row-resize"}),C.jsx(Ai,{defaultSize:30,minSize:5,maxSize:70,collapsible:!0,children:C.jsx(WT,{})})]})}const l4=3e4;function r4(){const t=_e(h=>h.processEvent),l=_e(h=>h.replayState),r=_e(h=>h.setWsStatus),i=V.useRef(null),s=V.useRef(1e3),u=V.useRef(null),c=V.useCallback(()=>{const m=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;try{const y=new WebSocket(m);i.current=y,y.onopen=()=>{s.current=1e3,r("connected")},y.onmessage=g=>{try{const v=JSON.parse(g.data);t(v)}catch(v){console.error("Failed to parse WebSocket message:",v)}},y.onclose=()=>{r("disconnected"),i.current=null,d()},y.onerror=()=>{}}catch{d()}},[t,r]),d=V.useCallback(()=>{r("reconnecting"),u.current=setTimeout(()=>{s.current=Math.min(s.current*2,l4),c()},s.current)},[c,r]);V.useEffect(()=>(r("connecting"),fetch("/api/state").then(h=>h.json()).then(h=>{h&&h.length>0&&l(h),c()}).catch(h=>{console.error("Failed to fetch state:",h),c()}),()=>{u.current&&clearTimeout(u.current),i.current&&i.current.close()}),[c,l,r])}function i4(){r4();const t=_e(r=>r.selectNode),l=_e(r=>r.workflowName);return V.useEffect(()=>{document.title=l?`Conductor — ${l}`:"Conductor Dashboard"},[l]),V.useEffect(()=>{const r=i=>{i.key==="Escape"&&t(null)};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[t]),C.jsxs("div",{className:"h-full flex flex-col bg-[var(--bg)]",children:[C.jsx(wS,{}),C.jsx(a4,{}),C.jsx(aE,{})]})}P_.createRoot(document.getElementById("root")).render(C.jsx(V.StrictMode,{children:C.jsx(i4,{})})); diff --git a/src/conductor/web/static/assets/index-JgDg1jWx.css b/src/conductor/web/static/assets/index-JgDg1jWx.css new file mode 100644 index 0000000..0699b41 --- /dev/null +++ b/src/conductor/web/static/assets/index-JgDg1jWx.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-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-duration: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-400:oklch(70.4% .191 22.216);--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-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-cyan-400:oklch(78.9% .154 211.53);--color-cyan-600:oklch(60.9% .126 221.723);--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-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;--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;--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}.absolute{position:absolute}.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)}.-right-0\.5{right:calc(var(--spacing) * -.5)}.z-10{z-index:10}.-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-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-\[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-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-\[3px\]{height:3px}.h-full{height:100%}.max-h-24{max-height:calc(var(--spacing) * 24)}.max-h-\[400px\]{max-height:400px}.\!w-2{width:calc(var(--spacing) * 2)!important}.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-full{width:100%}.max-w-\[16ch\]{max-width:16ch}.max-w-\[140px\]{max-width:140px}.max-w-\[200px\]{max-width:200px}.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}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.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}.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-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-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)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.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-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\/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-transparent{border-color:#0000}.\!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-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-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-transparent{background-color:#0000}.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}.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\(--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-green-400{color:var(--color-green-400)}.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-400{color:var(--color-red-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-35{opacity:.35}.opacity-40{opacity:.4}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.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)}.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)}.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,)}.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}.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\:bg-\[var\(--node-bg\)\]:hover{background-color:var(--node-bg)}.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\: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\:underline:hover{text-decoration-line:underline}}.focus\:border-amber-400:focus{border-color:var(--color-amber-400)}}: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 dash-flow{to{stroke-dashoffset:-20px}}::-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-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-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}.react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #777;--xy-background-pattern-lines-color-default: #777;--xy-background-pattern-cross-color-default: #777;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{z-index:1001;overflow:visible;position:absolute}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background-color:var(--xy-handle-background-color, var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));border-radius:100%}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:0;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px) translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px) translateY(-50%)}.react-flow__attribution{font-size:10px;background:var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;left:0;top:0}.react-flow__viewport-portal{position:absolute;width:100%;height:100%;left:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__minimap{background:var( --xy-minimap-background-color-props, var(--xy-minimap-background-color, var(--xy-minimap-background-color-default)) )}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var( --xy-minimap-mask-background-color-props, var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default)) );stroke:var( --xy-minimap-mask-stroke-color-props, var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default)) );stroke-width:var( --xy-minimap-mask-stroke-width-props, var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default)) )}.react-flow__minimap-node{fill:var( --xy-minimap-node-background-color-props, var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default)) );stroke:var( --xy-minimap-node-stroke-color-props, var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default)) );stroke-width:var( --xy-minimap-node-stroke-width-props, var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default)) )}.react-flow__background-pattern.dots{fill:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default)) )}.react-flow__background-pattern.lines{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default)) )}.react-flow__background-pattern.cross{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default)) )}.react-flow__controls{display:flex;flex-direction:column;box-shadow:var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default))}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{display:flex;justify-content:center;align-items:center;height:26px;width:26px;padding:4px;border:none;background:var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));border-bottom:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) );color:var( --xy-controls-button-color-props, var(--xy-controls-button-color, var(--xy-controls-button-color-default)) );cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px;fill:currentColor}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:var(--xy-node-border-radius, var(--xy-node-border-radius-default));width:150px;font-size:12px;color:var(--xy-node-color, var(--xy-node-color-default));text-align:center;border:var(--xy-node-border, var(--xy-node-border-default));background-color:var(--xy-node-background-color, var(--xy-node-background-color-default))}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color, var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color, var(--xy-selection-background-color-default));border:var(--xy-selection-border, var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var( --xy-controls-button-background-color-hover-props, var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default)) );color:var( --xy-controls-button-color-hover-props, var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default)) )}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) )}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:5px;height:5px;border:1px solid #fff;border-radius:1px;background-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));translate:-50% -50%}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color, var(--xy-edge-label-color-default))} diff --git a/src/conductor/web/static/index.html b/src/conductor/web/static/index.html index 2c0f4f8..18b660d 100644 --- a/src/conductor/web/static/index.html +++ b/src/conductor/web/static/index.html @@ -4,8 +4,8 @@ Conductor Dashboard - - + +
    diff --git a/tests/test_integration/test_implement_flow.py b/tests/test_integration/test_implement_flow.py new file mode 100644 index 0000000..c854c32 --- /dev/null +++ b/tests/test_integration/test_implement_flow.py @@ -0,0 +1,295 @@ +"""Integration tests for the implement.yaml workflow flow. + +Verifies the epic_selector → coder → epic_reviewer → committer loop +routes correctly across multiple epics, and routes to plan_reviewer +when all epics are complete. +""" + +from pathlib import Path +from typing import Any + +import pytest + +from conductor.config.loader import load_workflow +from conductor.config.schema import AgentDef +from conductor.engine.workflow import WorkflowEngine +from conductor.providers.copilot import CopilotProvider + +IMPLEMENT_YAML = Path(__file__).parent.parent.parent / "examples" / "implement.yaml" + + +def create_implement_mock_handler( + total_epics: int = 3, + reject_epic: int | None = None, +) -> tuple[Any, list[str]]: + """Create a mock handler that simulates the implement workflow agents. + + Args: + total_epics: Number of epics to simulate. + reject_epic: If set, the epic_reviewer will REQUEST_CHANGES on this + epic number (1-indexed) the first time, then APPROVE on retry. + + Returns: + Tuple of (mock_handler, agent_call_log) where agent_call_log is a + list of agent names in the order they were called. + """ + agent_calls: list[str] = [] + epic_counter = {"current": 0, "rejected": set()} + + def mock_handler( + agent: AgentDef, rendered_prompt: str, context: dict[str, Any] + ) -> dict[str, Any]: + agent_calls.append(agent.name) + + if agent.name == "epic_selector": + epic_counter["current"] += 1 + epic_num = epic_counter["current"] + + if epic_num > total_epics: + return { + "plan_summary": "Test plan with epics", + "all_epics": [ + {"id": f"EPIC-{i:03d}", "status": "DONE"} for i in range(1, total_epics + 1) + ], + "current_epic": "", + "epic_details": "", + "prerequisites_met": True, + "all_complete": True, + "remaining_count": 0, + } + + return { + "plan_summary": f"Test plan: {total_epics} epics total", + "all_epics": [ + { + "id": f"EPIC-{i:03d}", + "status": "DONE" if i < epic_num else "NOT STARTED", + } + for i in range(1, total_epics + 1) + ], + "current_epic": f"EPIC-{epic_num:03d}", + "epic_details": f"Details for EPIC-{epic_num:03d}: implement feature {epic_num}", + "prerequisites_met": True, + "all_complete": False, + "remaining_count": total_epics - epic_num + 1, + } + + elif agent.name == "coder": + # Extract epic from context + _epic = "EPIC-???" + for line in rendered_prompt.split("\n"): + if "EPIC-" in line and "Implement" in line: + _epic = line.strip().split("**")[-2] if "**" in line else line.strip() + break + + return { + "current_epic": f"EPIC-{epic_counter['current']:03d}", + "epic_details": f"Implemented EPIC-{epic_counter['current']:03d}", + "files_modified": [f"src/feature_{epic_counter['current']}.py"], + "changes_made": [f"Added feature {epic_counter['current']}"], + "tests_added": [f"tests/test_feature_{epic_counter['current']}.py"], + "edge_cases_handled": ["null input"], + "implementation_notes": "Implementation complete", + } + + elif agent.name == "epic_reviewer": + current = epic_counter["current"] + # If this epic should be rejected and hasn't been yet + if reject_epic and current == reject_epic and current not in epic_counter["rejected"]: + epic_counter["rejected"].add(current) + return { + "decision": "REQUEST_CHANGES", + "feedback": "Need better error handling", + "issues": ["Missing null check", "No logging"], + "strengths": ["Good structure"], + "approved": False, + } + + return { + "decision": "APPROVE", + "feedback": "Implementation looks good", + "issues": [], + "strengths": ["Clean code", "Good tests"], + "approved": True, + } + + elif agent.name == "committer": + current = epic_counter["current"] + remaining = total_epics - current + return { + "epic_completed": f"EPIC-{current:03d}", + "commit_message": f"EPIC-{current:03d}: Implement feature {current}", + "plan_updated": True, + "remaining_epics": [f"EPIC-{i:03d}" for i in range(current + 1, total_epics + 1)], + "all_complete": remaining == 0, + "next_epic": f"EPIC-{current + 1:03d}" if remaining > 0 else "", + } + + elif agent.name == "plan_reviewer": + return { + "decision": "APPROVE", + "feedback": "All changes look great", + "architecture_issues": [], + "code_issues": [], + "documentation_issues": [], + "test_gaps": [], + "strengths": ["Consistent patterns", "Good coverage"], + "approved": True, + } + + elif agent.name == "fixer": + return { + "issues_fixed": ["Fixed all issues"], + "files_modified": ["src/fix.py"], + "tests_added": ["tests/test_fix.py"], + "documentation_updated": ["README.md"], + "commit_message": "fix: Address review feedback", + "fix_notes": "All issues resolved", + "all_issues_resolved": True, + } + + return {} + + return mock_handler, agent_calls + + +@pytest.fixture +def implement_config(): + """Load the implement.yaml workflow config.""" + if not IMPLEMENT_YAML.exists(): + pytest.skip(f"implement.yaml not found at {IMPLEMENT_YAML}") + return load_workflow(IMPLEMENT_YAML) + + +class TestImplementWorkflowFlow: + """Tests verifying the routing flow of implement.yaml.""" + + @pytest.mark.asyncio + async def test_single_epic_flow(self, implement_config) -> None: + """Test flow with 1 epic: selector → coder → reviewer → committer.""" + mock_handler, agent_calls = create_implement_mock_handler(total_epics=1) + provider = CopilotProvider(mock_handler=mock_handler) + engine = WorkflowEngine(implement_config, provider) + + result = await engine.run({"plan": "test-plan.md"}) + + # Verify agent call sequence + assert agent_calls == [ + "epic_selector", # Selects EPIC-001 + "coder", # Implements EPIC-001 + "epic_reviewer", # Reviews EPIC-001 + "committer", # Commits, reports all_complete=True + "plan_reviewer", # Holistic review, approves + ] + assert result is not None + await provider.close() + + @pytest.mark.asyncio + async def test_multi_epic_flow(self, implement_config) -> None: + """Test flow with 3 epics loops through epic_selector for each.""" + mock_handler, agent_calls = create_implement_mock_handler(total_epics=3) + provider = CopilotProvider(mock_handler=mock_handler) + engine = WorkflowEngine(implement_config, provider) + + result = await engine.run({"plan": "test-plan.md"}) + + # Should loop: selector→coder→reviewer→committer, 3 times, + # then committer routes to plan_reviewer + expected = [] + for _i in range(3): + expected.extend(["epic_selector", "coder", "epic_reviewer", "committer"]) + expected.append("plan_reviewer") + + assert agent_calls == expected + assert result is not None + await provider.close() + + @pytest.mark.asyncio + async def test_epic_reviewer_reject_loops_to_coder(self, implement_config) -> None: + """Test that REQUEST_CHANGES from epic_reviewer routes back to coder, not epic_selector.""" + mock_handler, agent_calls = create_implement_mock_handler(total_epics=1, reject_epic=1) + provider = CopilotProvider(mock_handler=mock_handler) + engine = WorkflowEngine(implement_config, provider) + + result = await engine.run({"plan": "test-plan.md"}) + + # Epic 1: selector → coder → reviewer (REJECT) → coder → reviewer (APPROVE) → committer + # Then: plan_reviewer + assert agent_calls == [ + "epic_selector", # Selects EPIC-001 + "coder", # Implements (first attempt) + "epic_reviewer", # Rejects + "coder", # Re-implements + "epic_reviewer", # Approves + "committer", # Commits, all_complete + "plan_reviewer", # Holistic review + ] + assert result is not None + await provider.close() + + @pytest.mark.asyncio + async def test_coder_always_routes_to_reviewer(self, implement_config) -> None: + """Verify coder ALWAYS routes to epic_reviewer (no conditional skip).""" + mock_handler, agent_calls = create_implement_mock_handler(total_epics=2) + provider = CopilotProvider(mock_handler=mock_handler) + engine = WorkflowEngine(implement_config, provider) + + await engine.run({"plan": "test-plan.md"}) + + # Every coder call should be immediately followed by epic_reviewer + for i, call in enumerate(agent_calls): + if call == "coder": + assert i + 1 < len(agent_calls) + assert agent_calls[i + 1] == "epic_reviewer", ( + f"coder at index {i} was followed by '{agent_calls[i + 1]}', " + f"expected 'epic_reviewer'" + ) + await provider.close() + + @pytest.mark.asyncio + async def test_committer_loops_to_epic_selector_not_coder(self, implement_config) -> None: + """Verify committer routes to epic_selector (not coder) when more epics remain.""" + mock_handler, agent_calls = create_implement_mock_handler(total_epics=2) + provider = CopilotProvider(mock_handler=mock_handler) + engine = WorkflowEngine(implement_config, provider) + + await engine.run({"plan": "test-plan.md"}) + + # Every committer call (except the last) should be followed by epic_selector + committer_indices = [i for i, c in enumerate(agent_calls) if c == "committer"] + for idx in committer_indices[:-1]: # All except last + assert agent_calls[idx + 1] == "epic_selector", ( + f"committer at index {idx} was followed by '{agent_calls[idx + 1]}', " + f"expected 'epic_selector'" + ) + # Last committer should be followed by plan_reviewer + last_committer = committer_indices[-1] + assert agent_calls[last_committer + 1] == "plan_reviewer" + await provider.close() + + @pytest.mark.asyncio + async def test_entry_point_is_epic_selector(self, implement_config) -> None: + """Verify the workflow starts with epic_selector, not coder.""" + mock_handler, agent_calls = create_implement_mock_handler(total_epics=1) + provider = CopilotProvider(mock_handler=mock_handler) + engine = WorkflowEngine(implement_config, provider) + + await engine.run({"plan": "test-plan.md"}) + + assert agent_calls[0] == "epic_selector" + await provider.close() + + @pytest.mark.asyncio + async def test_epic_selector_all_complete_routes_to_plan_reviewer( + self, implement_config + ) -> None: + """If epic_selector reports all_complete, routes directly to plan_reviewer.""" + mock_handler, agent_calls = create_implement_mock_handler(total_epics=0) + # Override: epic_selector will immediately say all_complete + provider = CopilotProvider(mock_handler=mock_handler) + engine = WorkflowEngine(implement_config, provider) + + await engine.run({"plan": "test-plan.md"}) + + assert agent_calls == ["epic_selector", "plan_reviewer"] + await provider.close()