Skip to content

feat: add lab folder with original platform copy and full backend interfaces#1286

Closed
Abdullakala wants to merge 3 commits into
VoltAgent:mainfrom
Abdullakala:feat/lab-platform-original-with-backend
Closed

feat: add lab folder with original platform copy and full backend interfaces#1286
Abdullakala wants to merge 3 commits into
VoltAgent:mainfrom
Abdullakala:feat/lab-platform-original-with-backend

Conversation

@Abdullakala
Copy link
Copy Markdown

@Abdullakala Abdullakala commented May 16, 2026

Summary

  • add a standalone lab folder as requested
  • include an exact static copy of the original platform UI in lab/platform
  • add complete backend API interfaces in lab/backend covering docs/agents/tools/workflows/memory/observability/system endpoints
  • add websocket interface support for /ws, /ws/logs, /ws/observability
  • add OpenAPI contract at lab/backend/openapi.json
  • add run instructions in lab/README.md

Notes

  • lab/platform is copied as-is from the deployed frontend assets (no source modifications)
  • backend interface server defaults to port 3141; can be changed with PORT

How To Run

Platform copy

cd lab/platform
npx --yes serve -l 5180

Backend interfaces

cd lab/backend
npm install
npm start

Summary by cubic

Adds a standalone lab environment with the original platform UI and a mock backend exposing HTTP and WebSocket interfaces for local testing. Also extracts a reusable Assistant UI template and updates the example to use it.

  • New Features

    • Added lab/platform: exact static copy of the original platform UI.
    • Added lab/backend: mock API interfaces for docs/agents/tools/workflows/memory/observability/system using express and ws.
    • WebSockets: /ws, /ws/logs, /ws/observability.
    • OpenAPI contract at lab/backend/openapi.json.
    • lab/README.md with run instructions; backend defaults to port 3141 (overridable via PORT).
  • Refactors

    • Extracted AssistantUiTemplate and updated examples/with-assistant-ui/app/assistant.tsx to use it, reducing inline layout code.

Written for commit eeaabc1. Summary will update on new commits. Review in cubic

Summary by CodeRabbit

Release Notes

  • New Features

    • Added Assistant UI template component for improved interface organization
    • Introduced lab backend server with Express, WebSocket support, and API documentation
    • Expanded syntax highlighting for multiple programming languages and template engines
    • Added comprehensive diagram rendering support (flowcharts, class diagrams, ER diagrams, state diagrams, and more)
  • Documentation

    • Added lab folder setup and usage guide

Review Change Stack

Copilot AI and others added 3 commits May 16, 2026 01:05
Copilot AI review requested due to automatic review settings May 16, 2026 04:38
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 16, 2026

⚠️ No Changeset found

Latest commit: eeaabc1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 16, 2026

📝 Walkthrough

Walkthrough

This PR consolidates assistant UI layout into a reusable template component, establishes a mock backend lab environment with HTTP and WebSocket APIs, provides OpenAPI specification, and adds compiled language grammar and diagram rendering assets for the lab platform.

Changes

Lab environment and assistant UI improvements

Layer / File(s) Summary
Assistant UI template extraction
examples/with-assistant-ui/app/assistant.tsx, examples/with-assistant-ui/components/assistant-ui/assistant-ui-template.tsx
New AssistantUiTemplate component encapsulates sidebar layout, breadcrumb navigation, and thread view; Assistant component simplified to render the template inside AssistantRuntimeProvider.
Lab backend API server
lab/backend/package.json, lab/backend/server.js
Express server with JSON middleware listens on port 3141; implements placeholder REST endpoints for agents, tools, workflows, memory, observability, and updates; WebSocket handler sends periodic events and echoes messages.
Lab API specification and documentation
lab/README.md, lab/backend/openapi.json
OpenAPI 3.1.0 spec defines server URL and routes for all lab backend endpoints; README documents lab folder structure (platform frontend copy, backend interfaces) and run instructions.
Language grammars and diagram rendering assets
lab/platform/assets/_baseUniq-*.js, lab/platform/assets/*-*.js (60+ minified modules)
Compiled TextMate syntax grammars for 30+ languages (C, C#, CSS, CoffeeScript, Elm, Erlang, etc.); Mermaid diagram renderers (block, C4, class, ER, flowchart, radar, state); SVG helpers and utility modules for deduplication and graph operations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A template blooms where sidebars dwell,
A backend server rings its bell,
With grammars dressed in minified guise,
And diagrams dancing before our eyes!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main changes: adding a lab folder with platform copy and backend interfaces.
Description check ✅ Passed The description covers all required sections from the template: summary of changes, notes, run instructions, and includes auto-generated descriptions. However, the PR checklist items are not explicitly marked as completed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.

🔧 ast-grep (0.42.2)
lab/platform/assets/c4Diagram-YG6GDRKO-BL_nz_sa.js
lab/platform/assets/chunk-B4BG7PRW-DcBagHIU.js
lab/platform/assets/flowDiagram-NV44I4VS-ClQlyUQL.js

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Warning

⚠️ This pull request might be slop. It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a standalone lab/ area intended to (1) host a static copy of the platform UI and (2) provide a runnable “backend interfaces” server (HTTP + WebSocket) with an OpenAPI contract, plus a small refactor in the with-assistant-ui example to extract a reusable UI template.

Changes:

  • Added lab/platform static frontend bundle and supporting assets.
  • Added lab/backend Node/Express server implementing stubbed HTTP endpoints, WebSocket endpoints, and serving openapi.json.
  • Refactored examples/with-assistant-ui to move the assistant UI layout into AssistantUiTemplate.

Reviewed changes

Copilot reviewed 33 out of 152 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
lab/README.md Documents how to run the lab platform and backend interfaces.
lab/platform/index.html Static platform entry HTML.
lab/platform/robots.txt Platform static file (currently contains HTML).
lab/platform/manifest.json Platform static file (currently contains HTML).
lab/platform/favicon.ico Platform static file (currently contains HTML).
lab/platform/assets/yaml-Buea-lGh.js Static platform asset bundle file.
lab/platform/assets/xsl-CtQFsRM5.js Static platform asset bundle file.
lab/platform/assets/xml-sdJ4AIDG.js Static platform asset bundle file.
lab/platform/assets/vue-html-AaS7Mt5G.js Static platform asset bundle file.
lab/platform/assets/turtle-BsS91CYL.js Static platform asset bundle file.
lab/platform/assets/ts-tags-zn1MmPIZ.js Static platform asset bundle file.
lab/platform/assets/tex-CvyZ59Mk.js Static platform asset bundle file.
lab/platform/assets/stateDiagram-v2-4FDKWEC3-N7tz6IMb.js Static platform asset bundle file.
lab/platform/assets/stateDiagram-FKZM4ZOC-Cl7LJNn4.js Static platform asset bundle file.
lab/platform/assets/sparql-rVzFXLq3.js Static platform asset bundle file.
lab/platform/assets/soy-Brmx7dQM.js Static platform asset bundle file.
lab/platform/assets/shellsession-BADoaaVG.js Static platform asset bundle file.
lab/platform/assets/shaderlab-Dg9Lc6iA.js Static platform asset bundle file.
lab/platform/assets/sdbl-DVxCFoDh.js Static platform asset bundle file.
lab/platform/assets/sas-cz2c8ADy.js Static platform asset bundle file.
lab/platform/assets/rst-D5oM4XIm.js Static platform asset bundle file.
lab/platform/assets/regexp-CDVJQ6XC.js Static platform asset bundle file.
lab/platform/assets/r-Dspwwk_N.js Static platform asset bundle file.
lab/platform/assets/qml-3beO22l8.js Static platform asset bundle file.
lab/platform/assets/postcss-CXtECtnM.js Static platform asset bundle file.
lab/platform/assets/pieDiagram-ADFJNKIX-Dle3pQx4.js Static platform asset bundle file.
lab/platform/assets/min-PctrvoVu.js Static platform asset bundle file.
lab/platform/assets/json-Cp-IABpG.js Static platform asset bundle file.
lab/platform/assets/jison-wvAkD_A8.js Static platform asset bundle file.
lab/platform/assets/jinja-4LBKfQ-Z.js Static platform asset bundle file.
lab/platform/assets/infoDiagram-WHAUD3N6-DfALfyb4.js Static platform asset bundle file.
lab/platform/assets/hxml-Bvhsp5Yf.js Static platform asset bundle file.
lab/platform/assets/hurl-irOxFIW8.js Static platform asset bundle file.
lab/platform/assets/http-jrhK8wxY.js Static platform asset bundle file.
lab/platform/assets/html-derivative-BFtXZ54Q.js Static platform asset bundle file.
lab/platform/assets/hlsl-D3lLCCz7.js Static platform asset bundle file.
lab/platform/assets/handlebars-BL8al0AC.js Static platform asset bundle file.
lab/platform/assets/haml-B8DHNrY2.js Static platform asset bundle file.
lab/platform/assets/graph-CegXrlrm.js Static platform asset bundle file.
lab/platform/assets/glsl-DplSGwfg.js Static platform asset bundle file.
lab/platform/assets/git-rebase-r7XF79zn.js Static platform asset bundle file.
lab/platform/assets/git-commit-F4YmCXRG.js Static platform asset bundle file.
lab/platform/assets/gdshader-DkwncUOv.js Static platform asset bundle file.
lab/platform/assets/gdresource-BOOCDP_w.js Static platform asset bundle file.
lab/platform/assets/fortran-fixed-form-CkoXwp7k.js Static platform asset bundle file.
lab/platform/assets/erb-CgJxNhIT.js Static platform asset bundle file.
lab/platform/assets/elm-DbKCFpqz.js Static platform asset bundle file.
lab/platform/assets/edge-BkV0erSs.js Static platform asset bundle file.
lab/platform/assets/diff-D97Zzqfu.js Static platform asset bundle file.
lab/platform/assets/diagram-S2PKOQOG-Drk1KIep.js Static platform asset bundle file.
lab/platform/assets/diagram-QEK2KX5R-Ct1lk99Q.js Static platform asset bundle file.
lab/platform/assets/csv-fuZLfV_i.js Static platform asset bundle file.
lab/platform/assets/cmake-D1j8_8rp.js Static platform asset bundle file.
lab/platform/assets/clone-HkO5ylrb.js Static platform asset bundle file.
lab/platform/assets/classDiagram-v2-WZHVMYZB-B-lkttJ3.js Static platform asset bundle file.
lab/platform/assets/classDiagram-2ON5EDUG-B-lkttJ3.js Static platform asset bundle file.
lab/platform/assets/chunk-TZMSLE5B-oztTaqWQ.js Static platform asset bundle file.
lab/platform/assets/chunk-QZHKN3VN-B_-fBwR7.js Static platform asset bundle file.
lab/platform/assets/chunk-QN33PNHL-CzCWXHSf.js Static platform asset bundle file.
lab/platform/assets/chunk-FMBD7UC4-LFJYBKSk.js Static platform asset bundle file.
lab/platform/assets/chunk-55IACEB6-Dg9qakZE.js Static platform asset bundle file.
lab/platform/assets/chunk-4BX2VUAB-WXA4Du9f.js Static platform asset bundle file.
lab/platform/assets/channel-BDeWBRqP.js Static platform asset bundle file.
lab/platform/assets/cairo-KRGpt6FW.js Static platform asset bundle file.
lab/platform/assets/arc-BrOl2lkQ.js Static platform asset bundle file.
lab/backend/package.json Adds lab backend package metadata and dependencies.
lab/backend/openapi.json Defines OpenAPI 3.1 contract for lab backend interfaces.
lab/backend/server.js Implements the lab backend HTTP routes, OpenAPI serving, and WebSocket behavior.
examples/with-assistant-ui/components/assistant-ui/assistant-ui-template.tsx Extracts assistant UI layout into a reusable component.
examples/with-assistant-ui/app/assistant.tsx Uses AssistantUiTemplate to reduce inline layout duplication.
Files not reviewed (17)
  • lab/backend/package-lock.json: Language not supported
  • lab/platform/assets/angular-html-CU67Zn6k.js: Language not supported
  • lab/platform/assets/apl-dKokRX4l.js: Language not supported
  • lab/platform/assets/astro-CbQHKStN.js: Language not supported
  • lab/platform/assets/blockDiagram-VD42YOAC-CfyOY9ab.js: Language not supported
  • lab/platform/assets/bsl-BO_Y6i37.js: Language not supported
  • lab/platform/assets/c-BIGW1oBm.js: Language not supported
  • lab/platform/assets/c4Diagram-YG6GDRKO-BL_nz_sa.js: Language not supported
  • lab/platform/assets/cairo-KRGpt6FW.js: Language not supported
  • lab/platform/assets/chunk-4BX2VUAB-WXA4Du9f.js: Language not supported
  • lab/platform/assets/chunk-55IACEB6-Dg9qakZE.js: Language not supported
  • lab/platform/assets/chunk-B4BG7PRW-DcBagHIU.js: Language not supported
  • lab/platform/assets/chunk-DI55MBZ5-Cq0LW-mU.js: Language not supported
  • lab/platform/assets/chunk-QN33PNHL-CzCWXHSf.js: Language not supported
  • lab/platform/assets/chunk-QZHKN3VN-B_-fBwR7.js: Language not supported
  • lab/platform/assets/chunk-TZMSLE5B-oztTaqWQ.js: Language not supported
  • lab/platform/assets/classDiagram-2ON5EDUG-B-lkttJ3.js: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lab/backend/server.js
Comment on lines +135 to +156
const timer = setInterval(() => {
if (socket.readyState === socket.OPEN) {
socket.send(
JSON.stringify(
ok({
type: url.includes("observability")
? "OBSERVABILITY_EVENT"
: url.includes("logs")
? "LOG_EVENT"
: "ECHO",
timestamp: new Date().toISOString(),
}),
),
);
}
}, 5000);

socket.on("message", (msg) => {
if (socket.readyState === socket.OPEN) {
socket.send(JSON.stringify(ok({ type: "echo", payload: String(msg) })));
}
});
Comment thread lab/backend/server.js
Comment on lines +127 to +129
app.get("/openapi.json", (_req, res) => {
res.sendFile(new URL("./openapi.json", import.meta.url).pathname);
});
Comment thread lab/platform/robots.txt
Comment on lines +1 to +10
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>VoltOps LLM Observability</title>
<link rel="icon" type="image/x-icon" href="/assets/favicon-C74GXrn2.ico">
<script type="module" crossorigin src="/assets/index-Thzn6MGJ.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Dqs7gYcN.css">
Comment on lines +1 to +10
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>VoltOps LLM Observability</title>
<link rel="icon" type="image/x-icon" href="/assets/favicon-C74GXrn2.ico">
<script type="module" crossorigin src="/assets/index-Thzn6MGJ.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Dqs7gYcN.css">
Comment thread lab/platform/favicon.ico
Comment on lines +1 to +10
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>VoltOps LLM Observability</title>
<link rel="icon" type="image/x-icon" href="/assets/favicon-C74GXrn2.ico">
<script type="module" crossorigin src="/assets/index-Thzn6MGJ.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Dqs7gYcN.css">
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

🧹 Nitpick comments (4)
lab/platform/assets/erDiagram-Q2GNP2WA-CxwraNrX.js (1)

1-61: Consider adding source maps and documenting asset provenance.

These compiled JavaScript assets (diagram renderers and syntax grammars) lack source maps, making debugging difficult. For a lab environment, consider:

  1. Source maps: Include .js.map files for easier debugging and stack trace resolution
  2. Provenance tracking: Document the build process, source repository, and version/commit these assets were built from
  3. Dependency audit: Verify these assets come from trusted sources and have no known vulnerabilities
  4. Build reproducibility: Consider keeping the source files and build configuration so assets can be regenerated if needed

While committing compiled assets is acceptable for a lab/testing environment, these practices improve maintainability and security posture.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lab/platform/assets/erDiagram-Q2GNP2WA-CxwraNrX.js` around lines 1 - 61, The
compiled asset (exported symbol "ne" containing parser=Xt, get db() => new qt,
renderer=Nt, styles=te) lacks source maps and provenance metadata; add
generation of corresponding .js.map files during the build for this file, embed
or publish a manifest alongside the artifact that records the source
repo/commit/tag, build tool versions, and build command, and ensure the build
pipeline records dependency versions (for a dependency audit) and keeps the
original source and build config to enable reproducible rebuilds; update the
process that emits the parser (Xt), runtime class (qt), and renderer (Nt) to
include sourceMappingURL comments and produce a provenance/manifest artifact.
lab/backend/server.js (1)

5-11: ⚡ Quick win

Add error handling middleware.

The server has no error handling middleware, so unhandled errors in route handlers will crash the process or send default Express error responses without the { success, data } wrapper.

🛡️ Proposed error handler

Add this after all routes but before server.listen():

 app.get("/openapi.json", (_req, res) => {
   res.sendFile(new URL("./openapi.json", import.meta.url).pathname);
 });

+// Error handling middleware (must be last)
+app.use((err, _req, res, _next) => {
+  console.error("Express error:", err);
+  res.status(err.status || 500).json({
+    success: false,
+    error: { message: err.message || "Internal server error" }
+  });
+});
+
 wss.on("connection", (socket, request) => {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lab/backend/server.js` around lines 5 - 11, The app lacks centralized Express
error-handling middleware, so add an error handler function (signature: (err,
req, res, next)) after all route registrations and before calling
server.listen() to catch unhandled errors from route handlers; the handler
should set an appropriate HTTP status (default 500), log the error, and send a
JSON response following the project's wrapper shape (e.g., { success: false,
data: { message: err.message, ... } } or similar) so all errors use the same
response format; reference the existing app and server.listen() to locate where
to insert this middleware.
lab/backend/openapi.json (2)

18-18: 💤 Low value

SSE streaming endpoints documented but not implemented.

The OpenAPI spec documents SSE (Server-Sent Events) endpoints for /agents/{id}/stream, /agents/{id}/stream-object, and /workflows/{id}/stream, but server.js returns notImpl() stubs for these paths. Consider adding a note in the spec or implementing basic SSE handlers.

💡 Basic SSE implementation example
app.post("/agents/:id/stream", (req, res) => {
  res.setHeader("Content-Type", "text/event-stream");
  res.setHeader("Cache-Control", "no-cache");
  res.setHeader("Connection", "keep-alive");
  
  let count = 0;
  const interval = setInterval(() => {
    res.write(`data: ${JSON.stringify({ chunk: count++, id: req.params.id })}\n\n`);
    if (count > 5) {
      clearInterval(interval);
      res.end();
    }
  }, 1000);
  
  req.on("close", () => clearInterval(interval));
});

Also applies to: 20-20, 28-28

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lab/backend/openapi.json` at line 18, OpenAPI documents SSE endpoints but
server.js currently returns notImpl() for the routes; replace those stubs for
"/agents/:id/stream", "/agents/:id/stream-object", and "/workflows/:id/stream"
with basic SSE handlers in server.js (the route handlers that currently call
notImpl()) that set "Content-Type: text/event-stream", disable
caching/keep-alive headers, stream data chunks via res.write(...) in SSE format,
handle client disconnect with req.on("close") to clear intervals and call
res.end() when finished; alternatively, if you don't want to implement streaming
yet, update openapi.json to mark these operations as "deprecated" or add a
description noting they are not implemented to keep spec accurate.

1-64: ⚖️ Poor tradeoff

Consider adding request/response schemas to make the OpenAPI spec more useful.

The current spec only includes operation summaries without defining parameters, request bodies, or response schemas. While sufficient for a mock lab backend, adding these would make the contract more actionable for API consumers and enable better tooling (validation, client generation, etc.).

Example structure for one endpoint:

📋 Example schema enhancement
"/agents/{id}/text": {
  "post": {
    "summary": "Generate text response",
    "parameters": [
      {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": { "type": "string" }
      }
    ],
    "requestBody": {
      "required": true,
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "input": { "type": "string" }
            }
          }
        }
      }
    },
    "responses": {
      "200": {
        "description": "Success",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "success": { "type": "boolean" },
                "data": {
                  "type": "object",
                  "properties": {
                    "id": { "type": "string" },
                    "mode": { "type": "string" },
                    "input": { "type": "string", "nullable": true }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lab/backend/openapi.json` around lines 1 - 64, The OpenAPI document currently
lists only operation summaries; update key paths (e.g. "/agents/{id}/text",
"/agents/{id}/stream", "/agents", "/tools/{name}/execute",
"/api/memory/conversations", etc.) to include explicit "parameters" for
path/query inputs, "requestBody" schemas for POST/PUT endpoints, and "responses"
with JSON schema objects (200, 4xx errors) so clients and generators can
validate types; follow the example in the review by adding for each endpoint a
path parameter schema (e.g. id: string),
requestBody.content.application/json.schema with properties (e.g. input:
string), and responses.{200}.content.application/json.schema describing success
payloads and error shapes, and reuse common components/schemas for shared models
under "components/schemas".
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lab/backend/server.js`:
- Around line 131-159: The connection handler currently treats all connections
the same; parse and validate the request URL path (use request.url -> pathname)
and map it to a single route value (e.g., "/ws", "/ws/logs",
"/ws/observability"); if the path is not one of the allowed routes send an error
and close the socket (policy violation code) to reject invalid connections;
compute a single eventType once per connection from that route (instead of
choosing per interval) and only send that eventType in the setInterval and
message responses (keep clearing timer on "close"); update the message handler
to keep path-scoped behavior (e.g., echo remains per-connection) and reference
the existing wss.on("connection"), request.url, timer, socket.send,
socket.on("message") and socket.on("close") when applying the changes.
- Around line 5-11: The server lacks CORS which causes browser requests from the
frontend (port 5180) to be blocked; install the cors package, require/import it
in lab/backend/server.js, and add app.use(cors({ origin:
'http://localhost:5180', credentials: true })) before any route/middleware
registrations (replace origin with the platform frontend URL if different); also
update package.json dependencies to include "cors" and, for WebSocket
connections, ensure the WebSocketServer (wss / WebSocketServer) is configured to
accept that origin (e.g., validate the incoming connection's Origin header in
the WebSocket upgrade/connection handler) so both HTTP and ws requests from the
frontend are allowed.
- Line 136: The comparison uses socket.OPEN which is non-idiomatic; change
checks of socket.readyState === socket.OPEN to compare against the WebSocket
class constant instead (e.g., WebSocket.OPEN or numeric 1). Locate the lines
that check socket.readyState (the instances named socket in this file) and
replace socket.OPEN with WebSocket.OPEN (ensure WebSocket is the imported/ws
class in scope) so the readyState comparisons use the class constant
consistently (also update the similar check around the second occurrence).

In `@lab/platform/assets/arc-BrOl2lkQ.js`:
- Around line 174-183: The arrow-function fluent setters (innerRadius,
outerRadius, cornerRadius, padRadius, startAngle, endAngle, padAngle, context)
incorrectly use arguments.length (arrow functions lack their own arguments);
convert each arrow fn to a regular function declaration (e.g., function(n) { ...
}) so arguments.length correctly reflects the call, preserving the existing body
logic (type checks, Q(+n) conversion, null handling for padRadius/context,
assignment to local vars l/h/D/S/v/R/V/a and returning i). Ensure no other
behavior changes aside from swapping => to function and keeping the same return
value and assignments.

In `@lab/platform/assets/blockDiagram-VD42YOAC-CfyOY9ab.js`:
- Line 1: The async callbacks passed to Array.prototype.forEach over
classData.members and classData.methods do not await DOM measurements, causing
layout races; replace those forEach(async ...) usages with for...of loops inside
an async function and await each measurement iteration so y accumulation,
transform positioning and divider placement occur only after measurements
complete (update the code paths that compute class box height/positions—look for
loops over classData.members and classData.methods and the surrounding layout
calc code that uses y, transform, and divider placement—and convert them to
sequential for...of with await so subsequent layout logic runs after the
measurements).

In `@lab/platform/assets/chunk-55IACEB6-Dg9qakZE.js`:
- Line 1: getDiagramElement (the exported variable d) can throw in sandbox mode
because the iframe lookup `o("`#i`"+t)` may return no nodes so `n.nodes()[0]` or
its `contentDocument` is undefined; update the sandbox branch to guard the
iframe lookup and node dereference: check that `n` exists, `n.nodes().length >
0`, and that `n.nodes()[0].contentDocument` is present before accessing `.body`,
and fall back to querying the top-level `body` or returning null/empty selection
when the iframe is missing so diagram rendering does not crash.

In `@lab/platform/assets/chunk-B4BG7PRW-DcBagHIU.js`:
- Around line 112-116: The CSS rule currently targets "`#dependencyStart`,
.dependency" causing both start and end markers to get the same styles; change
the first selector from "`#dependencyStart`" to "`#dependencyEnd`" so the rule
becomes "`#dependencyEnd`, .dependency" to correctly style end-arrow markers
(locate the selector block that contains fill/stroke/stroke-width and update it
accordingly).

In `@lab/platform/assets/chunk-DI55MBZ5-Cq0LW-mU.js`:
- Line 1: The SVG anchor injection occurs where the code writes the click URL
into xlink:href (look for uses of m.url or the local variable url and the DOM
call that sets 'xlink:href' / setAttributeNS for anchors); fix it by
validating/sanitizing the URL before writing: implement an allowlist of safe
schemes (e.g. http, https, mailto, tel, maybe data:image/* if required), reject
anything starting with "javascript:", "data:text/html", "vbscript:" (or any
non-allowlisted scheme), and fallback to a safe placeholder like "#" or remove
the href; also trim and percent-encode/escape the value to remove quotes before
calling setAttributeNS to prevent attribute injection. Ensure the check is
applied wherever m.url or the click/url variable is written into xlink:href or
setAttributeNS.

In `@lab/platform/assets/cose-bilkent-S5V4N54A-CJPxbiqc.js`:
- Line 1: extractPositionedEdges is reading Cytoscape internals via
b._private.rscratch (private API) which is brittle; replace that access by using
supported public APIs or the layout output instead: stop touching
_private.rscratch in extractPositionedEdges and obtain edge geometry from the
createCytoscapeInstance/it → ot layout output (the edge geometry produced by the
layout), or call Cytoscape public methods (e.g. public edge
geometry/control-point APIs provided by your Cytoscape version) to get
start/mid/end coordinates; update calls in st/it to pass the layout-provided
edge geometry through so extractPositionedEdges and downstream code
(extractPositionedEdges, it/createCytoscapeInstance, ot, st) consume only
public, stable data.

In `@lab/platform/assets/dagre-6UL2VRFP-oyfIpHO7.js`:
- Line 1: The cyclic edge ID contains a typo: m.id = h+"-cyc<lic-special-2" —
update the string concatenation for the symbol m.id (where h is the prefix) to
remove the stray '<' and use a consistent token such as "-cyclic-special-2" so
generated edge IDs match other cyclic IDs and downstream ID-based logic (search
for the assignment to m.id near the cyclic-edge handling code in the j
function/rendering logic).

---

Nitpick comments:
In `@lab/backend/openapi.json`:
- Line 18: OpenAPI documents SSE endpoints but server.js currently returns
notImpl() for the routes; replace those stubs for "/agents/:id/stream",
"/agents/:id/stream-object", and "/workflows/:id/stream" with basic SSE handlers
in server.js (the route handlers that currently call notImpl()) that set
"Content-Type: text/event-stream", disable caching/keep-alive headers, stream
data chunks via res.write(...) in SSE format, handle client disconnect with
req.on("close") to clear intervals and call res.end() when finished;
alternatively, if you don't want to implement streaming yet, update openapi.json
to mark these operations as "deprecated" or add a description noting they are
not implemented to keep spec accurate.
- Around line 1-64: The OpenAPI document currently lists only operation
summaries; update key paths (e.g. "/agents/{id}/text", "/agents/{id}/stream",
"/agents", "/tools/{name}/execute", "/api/memory/conversations", etc.) to
include explicit "parameters" for path/query inputs, "requestBody" schemas for
POST/PUT endpoints, and "responses" with JSON schema objects (200, 4xx errors)
so clients and generators can validate types; follow the example in the review
by adding for each endpoint a path parameter schema (e.g. id: string),
requestBody.content.application/json.schema with properties (e.g. input:
string), and responses.{200}.content.application/json.schema describing success
payloads and error shapes, and reuse common components/schemas for shared models
under "components/schemas".

In `@lab/backend/server.js`:
- Around line 5-11: The app lacks centralized Express error-handling middleware,
so add an error handler function (signature: (err, req, res, next)) after all
route registrations and before calling server.listen() to catch unhandled errors
from route handlers; the handler should set an appropriate HTTP status (default
500), log the error, and send a JSON response following the project's wrapper
shape (e.g., { success: false, data: { message: err.message, ... } } or similar)
so all errors use the same response format; reference the existing app and
server.listen() to locate where to insert this middleware.

In `@lab/platform/assets/erDiagram-Q2GNP2WA-CxwraNrX.js`:
- Around line 1-61: The compiled asset (exported symbol "ne" containing
parser=Xt, get db() => new qt, renderer=Nt, styles=te) lacks source maps and
provenance metadata; add generation of corresponding .js.map files during the
build for this file, embed or publish a manifest alongside the artifact that
records the source repo/commit/tag, build tool versions, and build command, and
ensure the build pipeline records dependency versions (for a dependency audit)
and keeps the original source and build config to enable reproducible rebuilds;
update the process that emits the parser (Xt), runtime class (qt), and renderer
(Nt) to include sourceMappingURL comments and produce a provenance/manifest
artifact.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1c1d2b9b-d078-4224-84bc-8dab96581ec1

📥 Commits

Reviewing files that changed from the base of the PR and between 08414ed and eeaabc1.

⛔ Files ignored due to path filters (3)
  • lab/backend/package-lock.json is excluded by !**/package-lock.json
  • lab/platform/assets/favicon-C74GXrn2.ico is excluded by !**/*.ico
  • lab/platform/favicon.ico is excluded by !**/*.ico
📒 Files selected for processing (149)
  • examples/with-assistant-ui/app/assistant.tsx
  • examples/with-assistant-ui/components/assistant-ui/assistant-ui-template.tsx
  • lab/README.md
  • lab/backend/openapi.json
  • lab/backend/package.json
  • lab/backend/server.js
  • lab/platform/assets/_baseUniq-BZHRInkB.js
  • lab/platform/assets/angular-html-CU67Zn6k.js
  • lab/platform/assets/angular-ts-BwZT4LLn.js
  • lab/platform/assets/apl-dKokRX4l.js
  • lab/platform/assets/arc-BrOl2lkQ.js
  • lab/platform/assets/architectureDiagram-VXUJARFQ-DYJVnw04.js
  • lab/platform/assets/astro-CbQHKStN.js
  • lab/platform/assets/blade-D4QpJJKB.js
  • lab/platform/assets/blockDiagram-VD42YOAC-CfyOY9ab.js
  • lab/platform/assets/bsl-BO_Y6i37.js
  • lab/platform/assets/c-BIGW1oBm.js
  • lab/platform/assets/c4Diagram-YG6GDRKO-BL_nz_sa.js
  • lab/platform/assets/cairo-KRGpt6FW.js
  • lab/platform/assets/channel-BDeWBRqP.js
  • lab/platform/assets/chunk-4BX2VUAB-WXA4Du9f.js
  • lab/platform/assets/chunk-55IACEB6-Dg9qakZE.js
  • lab/platform/assets/chunk-B4BG7PRW-DcBagHIU.js
  • lab/platform/assets/chunk-DI55MBZ5-Cq0LW-mU.js
  • lab/platform/assets/chunk-FMBD7UC4-LFJYBKSk.js
  • lab/platform/assets/chunk-QN33PNHL-CzCWXHSf.js
  • lab/platform/assets/chunk-QZHKN3VN-B_-fBwR7.js
  • lab/platform/assets/chunk-TZMSLE5B-oztTaqWQ.js
  • lab/platform/assets/classDiagram-2ON5EDUG-B-lkttJ3.js
  • lab/platform/assets/classDiagram-v2-WZHVMYZB-B-lkttJ3.js
  • lab/platform/assets/clone-HkO5ylrb.js
  • lab/platform/assets/cmake-D1j8_8rp.js
  • lab/platform/assets/cobol-nwyudZeR.js
  • lab/platform/assets/coffee-Ch7k5sss.js
  • lab/platform/assets/cose-bilkent-S5V4N54A-CJPxbiqc.js
  • lab/platform/assets/cpp-CofmeUqb.js
  • lab/platform/assets/crystal-tKQVLTB8.js
  • lab/platform/assets/csharp-COcwbKMJ.js
  • lab/platform/assets/css-DPfMkruS.js
  • lab/platform/assets/csv-fuZLfV_i.js
  • lab/platform/assets/cytoscape.esm-BQaXIfA_.js
  • lab/platform/assets/dagre-6UL2VRFP-oyfIpHO7.js
  • lab/platform/assets/diagram-PSM6KHXK-CK-2EJVN.js
  • lab/platform/assets/diagram-QEK2KX5R-Ct1lk99Q.js
  • lab/platform/assets/diagram-S2PKOQOG-Drk1KIep.js
  • lab/platform/assets/diff-D97Zzqfu.js
  • lab/platform/assets/edge-BkV0erSs.js
  • lab/platform/assets/elixir-CDX3lj18.js
  • lab/platform/assets/elm-DbKCFpqz.js
  • lab/platform/assets/erDiagram-Q2GNP2WA-CxwraNrX.js
  • lab/platform/assets/erb-CgJxNhIT.js
  • lab/platform/assets/erlang-DsQrWhSR.js
  • lab/platform/assets/flowDiagram-NV44I4VS-ClQlyUQL.js
  • lab/platform/assets/fortran-fixed-form-CkoXwp7k.js
  • lab/platform/assets/fortran-free-form-BxgE0vQu.js
  • lab/platform/assets/fsharp-CXgrBDvD.js
  • lab/platform/assets/gdresource-BOOCDP_w.js
  • lab/platform/assets/gdscript-C5YyOfLZ.js
  • lab/platform/assets/gdshader-DkwncUOv.js
  • lab/platform/assets/git-commit-F4YmCXRG.js
  • lab/platform/assets/git-rebase-r7XF79zn.js
  • lab/platform/assets/gitGraphDiagram-NY62KEGX-B0M9QSlE.js
  • lab/platform/assets/glimmer-js-Rg0-pVw9.js
  • lab/platform/assets/glimmer-ts-U6CK756n.js
  • lab/platform/assets/glsl-DplSGwfg.js
  • lab/platform/assets/go-CxLEBnE3.js
  • lab/platform/assets/graph-CegXrlrm.js
  • lab/platform/assets/graphql-ChdNCCLP.js
  • lab/platform/assets/hack-CaT9iCJl.js
  • lab/platform/assets/haml-B8DHNrY2.js
  • lab/platform/assets/handlebars-BL8al0AC.js
  • lab/platform/assets/haxe-CzTSHFRz.js
  • lab/platform/assets/hlsl-D3lLCCz7.js
  • lab/platform/assets/html-GMplVEZG.js
  • lab/platform/assets/html-derivative-BFtXZ54Q.js
  • lab/platform/assets/http-jrhK8wxY.js
  • lab/platform/assets/hurl-irOxFIW8.js
  • lab/platform/assets/hxml-Bvhsp5Yf.js
  • lab/platform/assets/index-Dqs7gYcN.css
  • lab/platform/assets/index-Thzn6MGJ.js
  • lab/platform/assets/infoDiagram-WHAUD3N6-DfALfyb4.js
  • lab/platform/assets/java-CylS5w8V.js
  • lab/platform/assets/javascript-wDzz0qaB.js
  • lab/platform/assets/jinja-4LBKfQ-Z.js
  • lab/platform/assets/jison-wvAkD_A8.js
  • lab/platform/assets/journeyDiagram-XKPGCS4Q-DCuu5wCt.js
  • lab/platform/assets/json-Cp-IABpG.js
  • lab/platform/assets/jsx-g9-lgVsj.js
  • lab/platform/assets/julia-CxzCAyBv.js
  • lab/platform/assets/kanban-definition-3W4ZIXB7-Cb6-cZfX.js
  • lab/platform/assets/latex-DGMBWnxU.js
  • lab/platform/assets/layout-iIBNTqio.js
  • lab/platform/assets/less-B1dDrJ26.js
  • lab/platform/assets/liquid-DYVedYrR.js
  • lab/platform/assets/lua-BaeVxFsk.js
  • lab/platform/assets/markdown-Cvjx9yec.js
  • lab/platform/assets/marko-DZsq8hO1.js
  • lab/platform/assets/mdc-DUICxH0z.js
  • lab/platform/assets/min-PctrvoVu.js
  • lab/platform/assets/mindmap-definition-VGOIOE7T-DICjuFuY.js
  • lab/platform/assets/nginx-BpAMiNFr.js
  • lab/platform/assets/nim-CVrawwO9.js
  • lab/platform/assets/perl-C0TMdlhV.js
  • lab/platform/assets/php-Dhbhpdrm.js
  • lab/platform/assets/pieDiagram-ADFJNKIX-Dle3pQx4.js
  • lab/platform/assets/postcss-CXtECtnM.js
  • lab/platform/assets/pug-CGlum2m_.js
  • lab/platform/assets/python-B6aJPvgy.js
  • lab/platform/assets/qml-3beO22l8.js
  • lab/platform/assets/r-Dspwwk_N.js
  • lab/platform/assets/razor-Uh8Bk_45.js
  • lab/platform/assets/regexp-CDVJQ6XC.js
  • lab/platform/assets/requirementDiagram-UZGBJVZJ-B8_TtRuA.js
  • lab/platform/assets/rst-D5oM4XIm.js
  • lab/platform/assets/ruby-Cw6WdidG.js
  • lab/platform/assets/sas-cz2c8ADy.js
  • lab/platform/assets/scss-OYdSNvt2.js
  • lab/platform/assets/sdbl-DVxCFoDh.js
  • lab/platform/assets/sequenceDiagram-WL72ISMW-UHIAcE0H.js
  • lab/platform/assets/shaderlab-Dg9Lc6iA.js
  • lab/platform/assets/shellscript-Yzrsuije.js
  • lab/platform/assets/shellsession-BADoaaVG.js
  • lab/platform/assets/soy-Brmx7dQM.js
  • lab/platform/assets/sparql-rVzFXLq3.js
  • lab/platform/assets/sql-BLtJtn59.js
  • lab/platform/assets/stata-BH5u7GGu.js
  • lab/platform/assets/stateDiagram-FKZM4ZOC-Cl7LJNn4.js
  • lab/platform/assets/stateDiagram-v2-4FDKWEC3-N7tz6IMb.js
  • lab/platform/assets/stylus-BEDo0Tqx.js
  • lab/platform/assets/surrealql-Bq5Q-fJD.js
  • lab/platform/assets/svelte-zxCyuUbr.js
  • lab/platform/assets/templ-P3uqSqPl.js
  • lab/platform/assets/tex-CvyZ59Mk.js
  • lab/platform/assets/timeline-definition-IT6M3QCI-BHdbKzdR.js
  • lab/platform/assets/treemap-KMMF4GRG-CMg-_Gj0.js
  • lab/platform/assets/ts-tags-zn1MmPIZ.js
  • lab/platform/assets/tsx-COt5Ahok.js
  • lab/platform/assets/turtle-BsS91CYL.js
  • lab/platform/assets/twig-ChbOoGGc.js
  • lab/platform/assets/typescript-BPQ3VLAy.js
  • lab/platform/assets/vue-DN_0RTcg.js
  • lab/platform/assets/vue-html-AaS7Mt5G.js
  • lab/platform/assets/vue-vine-CQOfvN7w.js
  • lab/platform/assets/xml-sdJ4AIDG.js
  • lab/platform/assets/xsl-CtQFsRM5.js
  • lab/platform/assets/yaml-Buea-lGh.js
  • lab/platform/index.html
  • lab/platform/manifest.json
  • lab/platform/robots.txt

Comment thread lab/backend/server.js
Comment on lines +5 to +11
const app = express();
const server = http.createServer(app);
const wss = new WebSocketServer({ server });

const PORT = process.env.PORT || 3141;

app.use(express.json({ limit: "2mb" }));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add CORS middleware to enable cross-origin requests from the platform frontend.

The backend runs on port 3141 while the platform frontend (per README) runs on port 5180. Without CORS headers, the browser will block all fetch requests and WebSocket connections from the frontend to this backend.

🔧 Proposed fix

Install the cors package and add the middleware:

 import http from "node:http";
 import express from "express";
 import { WebSocketServer } from "ws";
+import cors from "cors";

 const app = express();
 const server = http.createServer(app);
 const wss = new WebSocketServer({ server });

 const PORT = process.env.PORT || 3141;

+app.use(cors());
 app.use(express.json({ limit: "2mb" }));

Then add to package.json:

"dependencies": {
  "cors": "^2.8.5",
  "express": "^4.21.2",
  "ws": "^8.18.3"
}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const app = express();
const server = http.createServer(app);
const wss = new WebSocketServer({ server });
const PORT = process.env.PORT || 3141;
app.use(express.json({ limit: "2mb" }));
import http from "node:http";
import express from "express";
import { WebSocketServer } from "ws";
import cors from "cors";
const app = express();
const server = http.createServer(app);
const wss = new WebSocketServer({ server });
const PORT = process.env.PORT || 3141;
app.use(cors());
app.use(express.json({ limit: "2mb" }));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lab/backend/server.js` around lines 5 - 11, The server lacks CORS which
causes browser requests from the frontend (port 5180) to be blocked; install the
cors package, require/import it in lab/backend/server.js, and add app.use(cors({
origin: 'http://localhost:5180', credentials: true })) before any
route/middleware registrations (replace origin with the platform frontend URL if
different); also update package.json dependencies to include "cors" and, for
WebSocket connections, ensure the WebSocketServer (wss / WebSocketServer) is
configured to accept that origin (e.g., validate the incoming connection's
Origin header in the WebSocket upgrade/connection handler) so both HTTP and ws
requests from the frontend are allowed.

Comment thread lab/backend/server.js
Comment on lines +131 to +159
wss.on("connection", (socket, request) => {
const url = request.url || "/ws";
socket.send(JSON.stringify(ok({ type: "connected", path: url })));

const timer = setInterval(() => {
if (socket.readyState === socket.OPEN) {
socket.send(
JSON.stringify(
ok({
type: url.includes("observability")
? "OBSERVABILITY_EVENT"
: url.includes("logs")
? "LOG_EVENT"
: "ECHO",
timestamp: new Date().toISOString(),
}),
),
);
}
}, 5000);

socket.on("message", (msg) => {
if (socket.readyState === socket.OPEN) {
socket.send(JSON.stringify(ok({ type: "echo", payload: String(msg) })));
}
});

socket.on("close", () => clearInterval(timer));
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Implement path-based WebSocket routing to match README documentation.

The README claims distinct WebSocket endpoints (/ws, /ws/logs, /ws/observability), but the current implementation uses a single handler that sends the same event types to all connections regardless of the requested path. While the code inspects request.url for event type selection (lines 140-144), clients connecting to different paths receive interleaved event types rather than path-specific streams.

🔀 Proposed fix to add path-based routing
 wss.on("connection", (socket, request) => {
   const url = request.url || "/ws";
   socket.send(JSON.stringify(ok({ type: "connected", path: url })));

+  // Determine event type based on path
+  let eventType = "ECHO";
+  if (url.includes("/observability")) {
+    eventType = "OBSERVABILITY_EVENT";
+  } else if (url.includes("/logs")) {
+    eventType = "LOG_EVENT";
+  }
+
   const timer = setInterval(() => {
     if (socket.readyState === socket.OPEN) {
       socket.send(
         JSON.stringify(
           ok({
-            type: url.includes("observability")
-              ? "OBSERVABILITY_EVENT"
-              : url.includes("logs")
-                ? "LOG_EVENT"
-                : "ECHO",
+            type: eventType,
             timestamp: new Date().toISOString(),
           }),
         ),
       );
     }
   }, 5000);

Better yet, validate the path and reject invalid connections:

 wss.on("connection", (socket, request) => {
   const url = request.url || "/ws";
+  
+  const validPaths = ["/ws", "/ws/logs", "/ws/observability"];
+  if (!validPaths.some(path => url.startsWith(path))) {
+    socket.close(1008, "Invalid WebSocket path");
+    return;
+  }
+
   socket.send(JSON.stringify(ok({ type: "connected", path: url })));
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
wss.on("connection", (socket, request) => {
const url = request.url || "/ws";
socket.send(JSON.stringify(ok({ type: "connected", path: url })));
const timer = setInterval(() => {
if (socket.readyState === socket.OPEN) {
socket.send(
JSON.stringify(
ok({
type: url.includes("observability")
? "OBSERVABILITY_EVENT"
: url.includes("logs")
? "LOG_EVENT"
: "ECHO",
timestamp: new Date().toISOString(),
}),
),
);
}
}, 5000);
socket.on("message", (msg) => {
if (socket.readyState === socket.OPEN) {
socket.send(JSON.stringify(ok({ type: "echo", payload: String(msg) })));
}
});
socket.on("close", () => clearInterval(timer));
});
wss.on("connection", (socket, request) => {
const url = request.url || "/ws";
const validPaths = ["/ws", "/ws/logs", "/ws/observability"];
if (!validPaths.some(path => url.startsWith(path))) {
socket.close(1008, "Invalid WebSocket path");
return;
}
socket.send(JSON.stringify(ok({ type: "connected", path: url })));
// Determine event type based on path
let eventType = "ECHO";
if (url.includes("/observability")) {
eventType = "OBSERVABILITY_EVENT";
} else if (url.includes("/logs")) {
eventType = "LOG_EVENT";
}
const timer = setInterval(() => {
if (socket.readyState === socket.OPEN) {
socket.send(
JSON.stringify(
ok({
type: eventType,
timestamp: new Date().toISOString(),
}),
),
);
}
}, 5000);
socket.on("message", (msg) => {
if (socket.readyState === socket.OPEN) {
socket.send(JSON.stringify(ok({ type: "echo", payload: String(msg) })));
}
});
socket.on("close", () => clearInterval(timer));
});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lab/backend/server.js` around lines 131 - 159, The connection handler
currently treats all connections the same; parse and validate the request URL
path (use request.url -> pathname) and map it to a single route value (e.g.,
"/ws", "/ws/logs", "/ws/observability"); if the path is not one of the allowed
routes send an error and close the socket (policy violation code) to reject
invalid connections; compute a single eventType once per connection from that
route (instead of choosing per interval) and only send that eventType in the
setInterval and message responses (keep clearing timer on "close"); update the
message handler to keep path-scoped behavior (e.g., echo remains per-connection)
and reference the existing wss.on("connection"), request.url, timer,
socket.send, socket.on("message") and socket.on("close") when applying the
changes.

Comment thread lab/backend/server.js
socket.send(JSON.stringify(ok({ type: "connected", path: url })));

const timer = setInterval(() => {
if (socket.readyState === socket.OPEN) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify the correct way to check WebSocket ready state in ws library v8.18.3
rg -nP --type=js -C3 'readyState.*OPEN|OPEN.*readyState' node_modules/ws/ 2>/dev/null | head -20 || echo "ws not installed; checking online docs recommended"

Repository: VoltAgent/voltagent

Length of output: 45


🌐 Web query:

ws npm package version 8.18.3 WebSocket readyState constants documentation

💡 Result:

The ws npm package (including version 8.18.3) follows the standard WebSocket API readyState constants, which are defined on the WebSocket class [1][2]. These constants are used to describe the current state of the connection [1][2]. The readyState constants are as follows: | Constant | Value | Description | |:--- |:--- |:--- | | CONNECTING | 0 | The connection is not yet open [1][2]. | | OPEN | 1 | The connection is open and ready to communicate [1][2]. | | CLOSING | 2 | The connection is in the process of closing [1][2]. | | CLOSED | 3 | The connection is closed [1][2]. | You can access these constants directly from the WebSocket class (e.g., WebSocket.OPEN) [1][2]. The readyState property on a WebSocket instance returns one of these numeric values [1][2]. These constants are consistent with the native browser WebSocket API [3][4].

Citations:


🏁 Script executed:

cat -n lab/backend/server.js | sed -n '130,160p'

Repository: VoltAgent/voltagent

Length of output: 1077


🏁 Script executed:

head -20 lab/backend/server.js

Repository: VoltAgent/voltagent

Length of output: 497


🏁 Script executed:

rg -n "import.*WebSocket|require.*WebSocket" lab/backend/server.js

Repository: VoltAgent/voltagent

Length of output: 103


Use WebSocket.OPEN or the numeric value 1 instead of socket.OPEN.

The socket.readyState property should be compared against WebSocket.OPEN (or the numeric constant 1), not socket.OPEN. While accessing the constant through the instance may work in JavaScript, the ws library documentation explicitly recommends accessing constants directly from the WebSocket class as WebSocket.OPEN. This is the idiomatic pattern for the ws library.

Also applies to: 153-153

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lab/backend/server.js` at line 136, The comparison uses socket.OPEN which is
non-idiomatic; change checks of socket.readyState === socket.OPEN to compare
against the WebSocket class constant instead (e.g., WebSocket.OPEN or numeric
1). Locate the lines that check socket.readyState (the instances named socket in
this file) and replace socket.OPEN with WebSocket.OPEN (ensure WebSocket is the
imported/ws class in scope) so the readyState comparisons use the class constant
consistently (also update the similar check around the second occurrence).

Comment on lines +174 to +183
(i.innerRadius = (n) => (arguments.length ? ((l = typeof n == "function" ? n : Q(+n)), i) : l)),
(i.outerRadius = (n) => (arguments.length ? ((h = typeof n == "function" ? n : Q(+n)), i) : h)),
(i.cornerRadius = (n) =>
arguments.length ? ((D = typeof n == "function" ? n : Q(+n)), i) : D),
(i.padRadius = (n) =>
arguments.length ? ((S = n == null ? null : typeof n == "function" ? n : Q(+n)), i) : S),
(i.startAngle = (n) => (arguments.length ? ((v = typeof n == "function" ? n : Q(+n)), i) : v)),
(i.endAngle = (n) => (arguments.length ? ((R = typeof n == "function" ? n : Q(+n)), i) : R)),
(i.padAngle = (n) => (arguments.length ? ((V = typeof n == "function" ? n : Q(+n)), i) : V)),
(i.context = (n) => (arguments.length ? ((a = n ?? null), i) : a)),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n --pcre2 'i\.(innerRadius|outerRadius|cornerRadius|padRadius|startAngle|endAngle|padAngle|context)\s*=\s*\([^)]+\)\s*=>\s*\(arguments\.length' lab/platform/assets/arc-BrOl2lkQ.js
sed -n '170,186p' lab/platform/assets/arc-BrOl2lkQ.js

Repository: VoltAgent/voltagent

Length of output: 1668


Arrow-based fluent setters check the wrong arguments object and will fail to set values.

Lines 174–183 use arrow functions with arguments.length checks to determine if arguments were passed. Arrow functions don't have their own arguments binding; they inherit it from the enclosing scope. This means all eight setters (innerRadius, outerRadius, cornerRadius, padRadius, startAngle, endAngle, padAngle, context) will check the outer function's arguments.length instead of detecting whether a parameter was passed, breaking the setter logic.

Convert these arrow functions to regular functions to give them their own arguments object:

Proposed fix
-    (i.innerRadius = (n) => (arguments.length ? ((l = typeof n == "function" ? n : Q(+n)), i) : l)),
-    (i.outerRadius = (n) => (arguments.length ? ((h = typeof n == "function" ? n : Q(+n)), i) : h)),
-    (i.cornerRadius = (n) =>
-      arguments.length ? ((D = typeof n == "function" ? n : Q(+n)), i) : D),
-    (i.padRadius = (n) =>
-      arguments.length ? ((S = n == null ? null : typeof n == "function" ? n : Q(+n)), i) : S),
-    (i.startAngle = (n) => (arguments.length ? ((v = typeof n == "function" ? n : Q(+n)), i) : v)),
-    (i.endAngle = (n) => (arguments.length ? ((R = typeof n == "function" ? n : Q(+n)), i) : R)),
-    (i.padAngle = (n) => (arguments.length ? ((V = typeof n == "function" ? n : Q(+n)), i) : V)),
-    (i.context = (n) => (arguments.length ? ((a = n ?? null), i) : a)),
+    (i.innerRadius = function (n) { return arguments.length ? ((l = typeof n == "function" ? n : Q(+n)), i) : l; }),
+    (i.outerRadius = function (n) { return arguments.length ? ((h = typeof n == "function" ? n : Q(+n)), i) : h; }),
+    (i.cornerRadius = function (n) { return arguments.length ? ((D = typeof n == "function" ? n : Q(+n)), i) : D; }),
+    (i.padRadius = function (n) { return arguments.length ? ((S = n == null ? null : typeof n == "function" ? n : Q(+n)), i) : S; }),
+    (i.startAngle = function (n) { return arguments.length ? ((v = typeof n == "function" ? n : Q(+n)), i) : v; }),
+    (i.endAngle = function (n) { return arguments.length ? ((R = typeof n == "function" ? n : Q(+n)), i) : R; }),
+    (i.padAngle = function (n) { return arguments.length ? ((V = typeof n == "function" ? n : Q(+n)), i) : V; }),
+    (i.context = function (n) { return arguments.length ? ((a = n ?? null), i) : a; }),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lab/platform/assets/arc-BrOl2lkQ.js` around lines 174 - 183, The
arrow-function fluent setters (innerRadius, outerRadius, cornerRadius,
padRadius, startAngle, endAngle, padAngle, context) incorrectly use
arguments.length (arrow functions lack their own arguments); convert each arrow
fn to a regular function declaration (e.g., function(n) { ... }) so
arguments.length correctly reflects the call, preserving the existing body logic
(type checks, Q(+n) conversion, null handling for padRadius/context, assignment
to local vars l/h/D/S/v/R/V/a and returning i). Ensure no other behavior changes
aside from swapping => to function and keeping the same return value and
assignments.

@@ -0,0 +1,122 @@
import{g as de}from"./chunk-FMBD7UC4-LFJYBKSk.js";import{_ as d,H as st,d as R,e as ge,l as m,z as ue,B as pe,ap as fe,a5 as xe,ad as ye,c as z,aa as be,aq as Z,ar as Ht,as as we,u as et,k as me,at as Le,au as yt,i as bt,av as Se}from"./index-Thzn6MGJ.js";import{c as ve}from"./clone-HkO5ylrb.js";import{G as Ee}from"./graph-CegXrlrm.js";import{c as _e}from"./channel-BDeWBRqP.js";import"./_baseUniq-BZHRInkB.js";var wt=(function(){var e=d(function(N,x,g,p){for(g=g||{},p=N.length;p--;g[N[p]]=x);return g},"o"),t=[1,15],a=[1,7],i=[1,13],l=[1,14],s=[1,19],r=[1,16],n=[1,17],o=[1,18],u=[8,30],h=[8,10,21,28,29,30,31,39,43,46],y=[1,23],b=[1,24],L=[8,10,15,16,21,28,29,30,31,39,43,46],E=[8,10,15,16,21,27,28,29,30,31,39,43,46],D=[1,49],v={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:d(function(x,g,p,w,S,c,_){var f=c.length-1;switch(S){case 4:w.getLogger().debug("Rule: separator (NL) ");break;case 5:w.getLogger().debug("Rule: separator (Space) ");break;case 6:w.getLogger().debug("Rule: separator (EOF) ");break;case 7:w.getLogger().debug("Rule: hierarchy: ",c[f-1]),w.setHierarchy(c[f-1]);break;case 8:w.getLogger().debug("Stop NL ");break;case 9:w.getLogger().debug("Stop EOF ");break;case 10:w.getLogger().debug("Stop NL2 ");break;case 11:w.getLogger().debug("Stop EOF2 ");break;case 12:w.getLogger().debug("Rule: statement: ",c[f]),typeof c[f].length=="number"?this.$=c[f]:this.$=[c[f]];break;case 13:w.getLogger().debug("Rule: statement #2: ",c[f-1]),this.$=[c[f-1]].concat(c[f]);break;case 14:w.getLogger().debug("Rule: link: ",c[f],x),this.$={edgeTypeStr:c[f],label:""};break;case 15:w.getLogger().debug("Rule: LABEL link: ",c[f-3],c[f-1],c[f]),this.$={edgeTypeStr:c[f],label:c[f-1]};break;case 18:const A=parseInt(c[f]),O=w.generateId();this.$={id:O,type:"space",label:"",width:A,children:[]};break;case 23:w.getLogger().debug("Rule: (nodeStatement link node) ",c[f-2],c[f-1],c[f]," typestr: ",c[f-1].edgeTypeStr);const X=w.edgeStrToEdgeData(c[f-1].edgeTypeStr);this.$=[{id:c[f-2].id,label:c[f-2].label,type:c[f-2].type,directions:c[f-2].directions},{id:c[f-2].id+"-"+c[f].id,start:c[f-2].id,end:c[f].id,label:c[f-1].label,type:"edge",directions:c[f].directions,arrowTypeEnd:X,arrowTypeStart:"arrow_open"},{id:c[f].id,label:c[f].label,type:w.typeStr2Type(c[f].typeStr),directions:c[f].directions}];break;case 24:w.getLogger().debug("Rule: nodeStatement (abc88 node size) ",c[f-1],c[f]),this.$={id:c[f-1].id,label:c[f-1].label,type:w.typeStr2Type(c[f-1].typeStr),directions:c[f-1].directions,widthInColumns:parseInt(c[f],10)};break;case 25:w.getLogger().debug("Rule: nodeStatement (node) ",c[f]),this.$={id:c[f].id,label:c[f].label,type:w.typeStr2Type(c[f].typeStr),directions:c[f].directions,widthInColumns:1};break;case 26:w.getLogger().debug("APA123",this?this:"na"),w.getLogger().debug("COLUMNS: ",c[f]),this.$={type:"column-setting",columns:c[f]==="auto"?-1:parseInt(c[f])};break;case 27:w.getLogger().debug("Rule: id-block statement : ",c[f-2],c[f-1]),w.generateId(),this.$={...c[f-2],type:"composite",children:c[f-1]};break;case 28:w.getLogger().debug("Rule: blockStatement : ",c[f-2],c[f-1],c[f]);const P=w.generateId();this.$={id:P,type:"composite",label:"",children:c[f-1]};break;case 29:w.getLogger().debug("Rule: node (NODE_ID separator): ",c[f]),this.$={id:c[f]};break;case 30:w.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",c[f-1],c[f]),this.$={id:c[f-1],label:c[f].label,typeStr:c[f].typeStr,directions:c[f].directions};break;case 31:w.getLogger().debug("Rule: dirList: ",c[f]),this.$=[c[f]];break;case 32:w.getLogger().debug("Rule: dirList: ",c[f-1],c[f]),this.$=[c[f-1]].concat(c[f]);break;case 33:w.getLogger().debug("Rule: nodeShapeNLabel: ",c[f-2],c[f-1],c[f]),this.$={typeStr:c[f-2]+c[f],label:c[f-1]};break;case 34:w.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",c[f-3],c[f-2]," #3:",c[f-1],c[f]),this.$={typeStr:c[f-3]+c[f],label:c[f-2],directions:c[f-1]};break;case 35:case 36:this.$={type:"classDef",id:c[f-1].trim(),css:c[f].trim()};break;case 37:this.$={type:"applyClass",id:c[f-1].trim(),styleClass:c[f].trim()};break;case 38:this.$={type:"applyStyles",id:c[f-1].trim(),stylesStr:c[f].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:t,11:3,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:i,29:l,31:s,39:r,43:n,46:o},{8:[1,20]},e(u,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:t,21:a,28:i,29:l,31:s,39:r,43:n,46:o}),e(h,[2,16],{14:22,15:y,16:b}),e(h,[2,17]),e(h,[2,18]),e(h,[2,19]),e(h,[2,20]),e(h,[2,21]),e(h,[2,22]),e(L,[2,25],{27:[1,25]}),e(h,[2,26]),{19:26,26:12,31:s},{10:t,11:27,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:i,29:l,31:s,39:r,43:n,46:o},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(E,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(u,[2,13]),{26:35,31:s},{31:[2,14]},{17:[1,36]},e(L,[2,24]),{10:t,11:37,13:4,14:22,15:y,16:b,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:i,29:l,31:s,39:r,43:n,46:o},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(E,[2,30]),{18:[1,43]},{18:[1,44]},e(L,[2,23]),{18:[1,45]},{30:[1,46]},e(h,[2,28]),e(h,[2,35]),e(h,[2,36]),e(h,[2,37]),e(h,[2,38]),{36:[1,47]},{33:48,34:D},{15:[1,50]},e(h,[2,27]),e(E,[2,33]),{38:[1,51]},{33:52,34:D,38:[2,31]},{31:[2,15]},e(E,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:d(function(x,g){if(g.recoverable)this.trace(x);else{var p=new Error(x);throw p.hash=g,p}},"parseError"),parse:d(function(x){var g=this,p=[0],w=[],S=[null],c=[],_=this.table,f="",A=0,O=0,X=2,P=1,J=c.slice.call(arguments,1),M=Object.create(this.lexer),Q={yy:{}};for(var ut in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ut)&&(Q.yy[ut]=this.yy[ut]);M.setInput(x,Q.yy),Q.yy.lexer=M,Q.yy.parser=this,typeof M.yylloc>"u"&&(M.yylloc={});var pt=M.yylloc;c.push(pt);var oe=M.options&&M.options.ranges;typeof Q.yy.parseError=="function"?this.parseError=Q.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function he(H){p.length=p.length-2*H,S.length=S.length-H,c.length=c.length-H}d(he,"popStack");function Tt(){var H;return H=w.pop()||M.lex()||P,typeof H!="number"&&(H instanceof Array&&(w=H,H=w.pop()),H=g.symbols_[H]||H),H}d(Tt,"lex");for(var Y,$,U,ft,tt={},it,q,Ct,nt;;){if($=p[p.length-1],this.defaultActions[$]?U=this.defaultActions[$]:((Y===null||typeof Y>"u")&&(Y=Tt()),U=_[$]&&_[$][Y]),typeof U>"u"||!U.length||!U[0]){var xt="";nt=[];for(it in _[$])this.terminals_[it]&&it>X&&nt.push("'"+this.terminals_[it]+"'");M.showPosition?xt="Parse error on line "+(A+1)+`:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n --pcre2 'forEach\s*\(\s*async\b' lab/platform/assets/blockDiagram-VD42YOAC-CfyOY9ab.js
rg -n -C2 --pcre2 'classData\.(members|methods)\.forEach\s*\(\s*async\b' lab/platform/assets/blockDiagram-VD42YOAC-CfyOY9ab.js

Repository: VoltAgent/voltagent

Length of output: 50375


🏁 Script executed:

# Extract the specific function containing these forEach calls to better understand the context
rg -A 30 'classData\.members\.forEach.*async' lab/platform/assets/blockDiagram-VD42YOAC-CfyOY9ab.js | head -50

Repository: VoltAgent/voltagent

Length of output: 26673


Replace async forEach loops with for...of to prevent race conditions in class-box layout calculations.

The forEach(async ...) callbacks on classData.members and classData.methods don't block execution. Layout calculations (y accumulation, transform positioning, divider placement) proceed immediately after forEach returns, even though the async DOM measurements inside those callbacks are still pending. This causes non-deterministic sizing of class boxes.

Proposed fix
- t.classData.members.forEach(async c => {
-   ...
-   const A = b.node().appendChild(await j(...));
-   ...
-   g.push(A);
- });
+ for (const c of t.classData.members) {
+   ...
+   const A = b.node().appendChild(await j(...));
+   ...
+   g.push(A);
+ }

- t.classData.methods.forEach(async c => {
-   ...
-   const A = b.node().appendChild(await j(...));
-   ...
-   p.push(A);
- });
+ for (const c of t.classData.methods) {
+   ...
+   const A = b.node().appendChild(await j(...));
+   ...
+   p.push(A);
+ }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lab/platform/assets/blockDiagram-VD42YOAC-CfyOY9ab.js` at line 1, The async
callbacks passed to Array.prototype.forEach over classData.members and
classData.methods do not await DOM measurements, causing layout races; replace
those forEach(async ...) usages with for...of loops inside an async function and
await each measurement iteration so y accumulation, transform positioning and
divider placement occur only after measurements complete (update the code paths
that compute class box height/positions—look for loops over classData.members
and classData.methods and the surrounding layout calc code that uses y,
transform, and divider placement—and convert them to sequential for...of with
await so subsequent layout logic runs after the measurements).

@@ -0,0 +1 @@
import{_ as a,d as o}from"./index-Thzn6MGJ.js";var d=a((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{d as g};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Guard sandbox iframe lookup before dereferencing.

Line 1 can throw when #i${t} is missing or not yet mounted (n.nodes()[0] is undefined), which breaks diagram rendering in sandbox mode.

Suggested fix
-var d=a((t,e)=>{let n;return e==="sandbox"&&(n=o("`#i`"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");
+var d=a((t,e)=>{
+  const selector = `[id="${CSS.escape(String(t))}"]`;
+  if (e === "sandbox") {
+    const iframe = o("`#i`" + t).nodes()[0];
+    const body = iframe?.contentDocument?.body;
+    return (body ? o(body) : o("body")).select(selector);
+  }
+  return o("body").select(selector);
+},"getDiagramElement");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lab/platform/assets/chunk-55IACEB6-Dg9qakZE.js` at line 1, getDiagramElement
(the exported variable d) can throw in sandbox mode because the iframe lookup
`o("`#i`"+t)` may return no nodes so `n.nodes()[0]` or its `contentDocument` is
undefined; update the sandbox branch to guard the iframe lookup and node
dereference: check that `n` exists, `n.nodes().length > 0`, and that
`n.nodes()[0].contentDocument` is present before accessing `.body`, and fall
back to querying the top-level `body` or returning null/empty selection when the
iframe is missing so diagram rendering does not crash.

Comment on lines +112 to +116
#dependencyStart, .dependency {
fill: ${s.lineColor} !important;
stroke: ${s.lineColor} !important;
stroke-width: 1;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix duplicated dependency marker selector.

Line 112 repeats #dependencyStart; this should target the end marker, otherwise end-arrow styling can be inconsistent.

Suggested fix
-#dependencyStart, .dependency {
+#dependencyEnd, .dependency {
   fill: ${s.lineColor} !important;
   stroke: ${s.lineColor} !important;
   stroke-width: 1;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#dependencyStart, .dependency {
fill: ${s.lineColor} !important;
stroke: ${s.lineColor} !important;
stroke-width: 1;
}
`#dependencyEnd`, .dependency {
fill: ${s.lineColor} !important;
stroke: ${s.lineColor} !important;
stroke-width: 1;
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lab/platform/assets/chunk-B4BG7PRW-DcBagHIU.js` around lines 112 - 116, The
CSS rule currently targets "`#dependencyStart`, .dependency" causing both start
and end markers to get the same styles; change the first selector from
"`#dependencyStart`" to "`#dependencyEnd`" so the rule becomes "`#dependencyEnd`,
.dependency" to correctly style end-arrow markers (locate the selector block
that contains fill/stroke/stroke-width and update it accordingly).

@@ -0,0 +1,220 @@
import{g as te}from"./chunk-55IACEB6-Dg9qakZE.js";import{s as ee}from"./chunk-QN33PNHL-CzCWXHSf.js";import{_ as f,l as D,c as F,r as se,u as ie,a as re,b as ae,g as ne,s as oe,q as le,t as ce,ae as he,k as z,z as ue}from"./index-Thzn6MGJ.js";var vt=(function(){var e=f(function(V,o,h,n){for(h=h||{},n=V.length;n--;h[V[n]]=o);return h},"o"),t=[1,2],s=[1,3],a=[1,4],i=[2,4],l=[1,9],d=[1,11],S=[1,16],p=[1,17],T=[1,18],_=[1,19],m=[1,33],k=[1,20],A=[1,21],$=[1,22],x=[1,23],R=[1,24],u=[1,26],L=[1,27],I=[1,28],N=[1,29],G=[1,30],P=[1,31],B=[1,32],at=[1,35],nt=[1,36],ot=[1,37],lt=[1,38],K=[1,34],y=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],ct=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],xt=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],gt={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:f(function(o,h,n,g,E,r,Z){var c=r.length-1;switch(E){case 3:return g.setRootDoc(r[c]),r[c];case 4:this.$=[];break;case 5:r[c]!="nl"&&(r[c-1].push(r[c]),this.$=r[c-1]);break;case 6:case 7:this.$=r[c];break;case 8:this.$="nl";break;case 12:this.$=r[c];break;case 13:const tt=r[c-1];tt.description=g.trimColon(r[c]),this.$=tt;break;case 14:this.$={stmt:"relation",state1:r[c-2],state2:r[c]};break;case 15:const Tt=g.trimColon(r[c]);this.$={stmt:"relation",state1:r[c-3],state2:r[c-1],description:Tt};break;case 19:this.$={stmt:"state",id:r[c-3],type:"default",description:"",doc:r[c-1]};break;case 20:var U=r[c],X=r[c-2].trim();if(r[c].match(":")){var ut=r[c].split(":");U=ut[0],X=[X,ut[1]]}this.$={stmt:"state",id:U,type:"default",description:X};break;case 21:this.$={stmt:"state",id:r[c-3],type:"default",description:r[c-5],doc:r[c-1]};break;case 22:this.$={stmt:"state",id:r[c],type:"fork"};break;case 23:this.$={stmt:"state",id:r[c],type:"join"};break;case 24:this.$={stmt:"state",id:r[c],type:"choice"};break;case 25:this.$={stmt:"state",id:g.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:r[c-1].trim(),note:{position:r[c-2].trim(),text:r[c].trim()}};break;case 29:this.$=r[c].trim(),g.setAccTitle(this.$);break;case 30:case 31:this.$=r[c].trim(),g.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:r[c-3],url:r[c-2],tooltip:r[c-1]};break;case 33:this.$={stmt:"click",id:r[c-3],url:r[c-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:r[c-1].trim(),classes:r[c].trim()};break;case 36:this.$={stmt:"style",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 37:this.$={stmt:"applyClass",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 38:g.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:g.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:g.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:g.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:r[c].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:t,5:s,6:a},{1:[3]},{3:5,4:t,5:s,6:a},{3:6,4:t,5:s,6:a},e([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:l,5:d,8:8,9:10,10:12,11:13,12:14,13:15,16:S,17:p,19:T,22:_,24:m,25:k,26:A,27:$,28:x,29:R,32:25,33:u,35:L,37:I,38:N,41:G,45:P,48:B,51:at,52:nt,53:ot,54:lt,57:K},e(y,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:S,17:p,19:T,22:_,24:m,25:k,26:A,27:$,28:x,29:R,32:25,33:u,35:L,37:I,38:N,41:G,45:P,48:B,51:at,52:nt,53:ot,54:lt,57:K},e(y,[2,7]),e(y,[2,8]),e(y,[2,9]),e(y,[2,10]),e(y,[2,11]),e(y,[2,12],{14:[1,40],15:[1,41]}),e(y,[2,16]),{18:[1,42]},e(y,[2,18],{20:[1,43]}),{23:[1,44]},e(y,[2,22]),e(y,[2,23]),e(y,[2,24]),e(y,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},e(y,[2,28]),{34:[1,49]},{36:[1,50]},e(y,[2,31]),{13:51,24:m,57:K},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},e(ct,[2,44],{58:[1,56]}),e(ct,[2,45],{58:[1,57]}),e(y,[2,38]),e(y,[2,39]),e(y,[2,40]),e(y,[2,41]),e(y,[2,6]),e(y,[2,13]),{13:58,24:m,57:K},e(y,[2,17]),e(xt,i,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},e(y,[2,29]),e(y,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},e(y,[2,14],{14:[1,71]}),{4:l,5:d,8:8,9:10,10:12,11:13,12:14,13:15,16:S,17:p,19:T,21:[1,72],22:_,24:m,25:k,26:A,27:$,28:x,29:R,32:25,33:u,35:L,37:I,38:N,41:G,45:P,48:B,51:at,52:nt,53:ot,54:lt,57:K},e(y,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},e(y,[2,34]),e(y,[2,35]),e(y,[2,36]),e(y,[2,37]),e(ct,[2,46]),e(ct,[2,47]),e(y,[2,15]),e(y,[2,19]),e(xt,i,{7:78}),e(y,[2,26]),e(y,[2,27]),{5:[1,79]},{5:[1,80]},{4:l,5:d,8:8,9:10,10:12,11:13,12:14,13:15,16:S,17:p,19:T,21:[1,81],22:_,24:m,25:k,26:A,27:$,28:x,29:R,32:25,33:u,35:L,37:I,38:N,41:G,45:P,48:B,51:at,52:nt,53:ot,54:lt,57:K},e(y,[2,32]),e(y,[2,33]),e(y,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:f(function(o,h){if(h.recoverable)this.trace(o);else{var n=new Error(o);throw n.hash=h,n}},"parseError"),parse:f(function(o){var h=this,n=[0],g=[],E=[null],r=[],Z=this.table,c="",U=0,X=0,ut=2,tt=1,Tt=r.slice.call(arguments,1),b=Object.create(this.lexer),j={yy:{}};for(var Et in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Et)&&(j.yy[Et]=this.yy[Et]);b.setInput(o,j.yy),j.yy.lexer=b,j.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var _t=b.yylloc;r.push(_t);var Qt=b.options&&b.options.ranges;typeof j.yy.parseError=="function"?this.parseError=j.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Zt(O){n.length=n.length-2*O,E.length=E.length-O,r.length=r.length-O}f(Zt,"popStack");function Lt(){var O;return O=g.pop()||b.lex()||tt,typeof O!="number"&&(O instanceof Array&&(g=O,O=g.pop()),O=h.symbols_[O]||O),O}f(Lt,"lex");for(var C,H,w,mt,J={},dt,Y,Ot,ft;;){if(H=n[n.length-1],this.defaultActions[H]?w=this.defaultActions[H]:((C===null||typeof C>"u")&&(C=Lt()),w=Z[H]&&Z[H][C]),typeof w>"u"||!w.length||!w[0]){var Dt="";ft=[];for(dt in Z[H])this.terminals_[dt]&&dt>ut&&ft.push("'"+this.terminals_[dt]+"'");b.showPosition?Dt="Parse error on line "+(U+1)+`:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Sanitize link URLs before writing xlink:href.

Line 1 injects m.url into SVG anchors after only stripping quotes. This allows unsafe schemes to be embedded from diagram input.

Suggested fix
-const L=m.url.replace(/^"+|"+$/g,"");
-if(u.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",L),u.setAttribute("target","_blank"),m.tooltip){
+const rawUrl = m.url.replace(/^"+|"+$/g,"");
+const safeUrl = ie.formatUrl(rawUrl, F());
+if (!safeUrl) {
+  D.warn("⚠️ Skipping unsafe link for state:", A);
+  return;
+}
+u.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",safeUrl);
+u.setAttribute("target", i === "sandbox" ? "_top" : "_blank");
+if (m.tooltip){
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lab/platform/assets/chunk-DI55MBZ5-Cq0LW-mU.js` at line 1, The SVG anchor
injection occurs where the code writes the click URL into xlink:href (look for
uses of m.url or the local variable url and the DOM call that sets 'xlink:href'
/ setAttributeNS for anchors); fix it by validating/sanitizing the URL before
writing: implement an allowlist of safe schemes (e.g. http, https, mailto, tel,
maybe data:image/* if required), reject anything starting with "javascript:",
"data:text/html", "vbscript:" (or any non-allowlisted scheme), and fallback to a
safe placeholder like "#" or remove the href; also trim and
percent-encode/escape the value to remove quotes before calling setAttributeNS
to prevent attribute injection. Ensure the check is applied wherever m.url or
the click/url variable is written into xlink:href or setAttributeNS.

@@ -0,0 +1 @@
import{aL as lt,_ as V,l as $,d as gt}from"./index-Thzn6MGJ.js";import{c as tt}from"./cytoscape.esm-BQaXIfA_.js";var k={exports:{}},Z={exports:{}},Q={exports:{}},ut=Q.exports,j;function ft(){return j||(j=1,(function(G,b){(function(I,T){G.exports=T()})(ut,function(){return(function(N){var I={};function T(o){if(I[o])return I[o].exports;var e=I[o]={i:o,l:!1,exports:{}};return N[o].call(e.exports,e,e.exports,T),e.l=!0,e.exports}return T.m=N,T.c=I,T.i=function(o){return o},T.d=function(o,e,t){T.o(o,e)||Object.defineProperty(o,e,{configurable:!1,enumerable:!0,get:t})},T.n=function(o){var e=o&&o.__esModule?function(){return o.default}:function(){return o};return T.d(e,"a",e),e},T.o=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)},T.p="",T(T.s=26)})([(function(N,I,T){function o(){}o.QUALITY=1,o.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,o.DEFAULT_INCREMENTAL=!1,o.DEFAULT_ANIMATION_ON_LAYOUT=!0,o.DEFAULT_ANIMATION_DURING_LAYOUT=!1,o.DEFAULT_ANIMATION_PERIOD=50,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,o.DEFAULT_GRAPH_MARGIN=15,o.NODE_DIMENSIONS_INCLUDE_LABELS=!1,o.SIMPLE_NODE_SIZE=40,o.SIMPLE_NODE_HALF_SIZE=o.SIMPLE_NODE_SIZE/2,o.EMPTY_COMPOUND_NODE_SIZE=40,o.MIN_EDGE_LENGTH=1,o.WORLD_BOUNDARY=1e6,o.INITIAL_WORLD_BOUNDARY=o.WORLD_BOUNDARY/1e3,o.WORLD_CENTER_X=1200,o.WORLD_CENTER_Y=900,N.exports=o}),(function(N,I,T){var o=T(2),e=T(8),t=T(9);function i(g,n,d){o.call(this,d),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=d,this.bendpoints=[],this.source=g,this.target=n}i.prototype=Object.create(o.prototype);for(var l in o)i[l]=o[l];i.prototype.getSource=function(){return this.source},i.prototype.getTarget=function(){return this.target},i.prototype.isInterGraph=function(){return this.isInterGraph},i.prototype.getLength=function(){return this.length},i.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},i.prototype.getBendpoints=function(){return this.bendpoints},i.prototype.getLca=function(){return this.lca},i.prototype.getSourceInLca=function(){return this.sourceInLca},i.prototype.getTargetInLca=function(){return this.targetInLca},i.prototype.getOtherEnd=function(g){if(this.source===g)return this.target;if(this.target===g)return this.source;throw"Node is not incident with this edge"},i.prototype.getOtherEndInGraph=function(g,n){for(var d=this.getOtherEnd(g),r=n.getGraphManager().getRoot();;){if(d.getOwner()==n)return d;if(d.getOwner()==r)break;d=d.getOwner().getParent()}return null},i.prototype.updateLength=function(){var g=new Array(4);this.isOverlapingSourceAndTarget=e.getIntersection(this.target.getRect(),this.source.getRect(),g),this.isOverlapingSourceAndTarget||(this.lengthX=g[0]-g[2],this.lengthY=g[1]-g[3],Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},i.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},N.exports=i}),(function(N,I,T){function o(e){this.vGraphObject=e}N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(13),i=T(0),l=T(16),g=T(4);function n(r,h,a,p){a==null&&p==null&&(p=h),o.call(this,p),r.graphManager!=null&&(r=r.graphManager),this.estimatedSize=e.MIN_VALUE,this.inclusionTreeDepth=e.MAX_VALUE,this.vGraphObject=p,this.edges=[],this.graphManager=r,a!=null&&h!=null?this.rect=new t(h.x,h.y,a.width,a.height):this.rect=new t}n.prototype=Object.create(o.prototype);for(var d in o)n[d]=o[d];n.prototype.getEdges=function(){return this.edges},n.prototype.getChild=function(){return this.child},n.prototype.getOwner=function(){return this.owner},n.prototype.getWidth=function(){return this.rect.width},n.prototype.setWidth=function(r){this.rect.width=r},n.prototype.getHeight=function(){return this.rect.height},n.prototype.setHeight=function(r){this.rect.height=r},n.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},n.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},n.prototype.getCenter=function(){return new g(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},n.prototype.getLocation=function(){return new g(this.rect.x,this.rect.y)},n.prototype.getRect=function(){return this.rect},n.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},n.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},n.prototype.setRect=function(r,h){this.rect.x=r.x,this.rect.y=r.y,this.rect.width=h.width,this.rect.height=h.height},n.prototype.setCenter=function(r,h){this.rect.x=r-this.rect.width/2,this.rect.y=h-this.rect.height/2},n.prototype.setLocation=function(r,h){this.rect.x=r,this.rect.y=h},n.prototype.moveBy=function(r,h){this.rect.x+=r,this.rect.y+=h},n.prototype.getEdgeListToNode=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(p.target==r){if(p.source!=a)throw"Incorrect edge source!";h.push(p)}}),h},n.prototype.getEdgesBetween=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(!(p.source==a||p.target==a))throw"Incorrect edge source and/or target";(p.target==r||p.source==r)&&h.push(p)}),h},n.prototype.getNeighborsList=function(){var r=new Set,h=this;return h.edges.forEach(function(a){if(a.source==h)r.add(a.target);else{if(a.target!=h)throw"Incorrect incidency!";r.add(a.source)}}),r},n.prototype.withChildren=function(){var r=new Set,h,a;if(r.add(this),this.child!=null)for(var p=this.child.getNodes(),v=0;v<p.length;v++)h=p[v],a=h.withChildren(),a.forEach(function(D){r.add(D)});return r},n.prototype.getNoOfChildren=function(){var r=0,h;if(this.child==null)r=1;else for(var a=this.child.getNodes(),p=0;p<a.length;p++)h=a[p],r+=h.getNoOfChildren();return r==0&&(r=1),r},n.prototype.getEstimatedSize=function(){if(this.estimatedSize==e.MIN_VALUE)throw"assert failed";return this.estimatedSize},n.prototype.calcEstimatedSize=function(){return this.child==null?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},n.prototype.scatter=function(){var r,h,a=-i.INITIAL_WORLD_BOUNDARY,p=i.INITIAL_WORLD_BOUNDARY;r=i.WORLD_CENTER_X+l.nextDouble()*(p-a)+a;var v=-i.INITIAL_WORLD_BOUNDARY,D=i.INITIAL_WORLD_BOUNDARY;h=i.WORLD_CENTER_Y+l.nextDouble()*(D-v)+v,this.rect.x=r,this.rect.y=h},n.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var r=this.getChild();if(r.updateBounds(!0),this.rect.x=r.getLeft(),this.rect.y=r.getTop(),this.setWidth(r.getRight()-r.getLeft()),this.setHeight(r.getBottom()-r.getTop()),i.NODE_DIMENSIONS_INCLUDE_LABELS){var h=r.getRight()-r.getLeft(),a=r.getBottom()-r.getTop();this.labelWidth>h&&(this.rect.x-=(this.labelWidth-h)/2,this.setWidth(this.labelWidth)),this.labelHeight>a&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-a)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-a),this.setHeight(this.labelHeight))}}},n.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==e.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},n.prototype.transform=function(r){var h=this.rect.x;h>i.WORLD_BOUNDARY?h=i.WORLD_BOUNDARY:h<-i.WORLD_BOUNDARY&&(h=-i.WORLD_BOUNDARY);var a=this.rect.y;a>i.WORLD_BOUNDARY?a=i.WORLD_BOUNDARY:a<-i.WORLD_BOUNDARY&&(a=-i.WORLD_BOUNDARY);var p=new g(h,a),v=r.inverseTransformPoint(p);this.setLocation(v.x,v.y)},n.prototype.getLeft=function(){return this.rect.x},n.prototype.getRight=function(){return this.rect.x+this.rect.width},n.prototype.getTop=function(){return this.rect.y},n.prototype.getBottom=function(){return this.rect.y+this.rect.height},n.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},N.exports=n}),(function(N,I,T){function o(e,t){e==null&&t==null?(this.x=0,this.y=0):(this.x=e,this.y=t)}o.prototype.getX=function(){return this.x},o.prototype.getY=function(){return this.y},o.prototype.setX=function(e){this.x=e},o.prototype.setY=function(e){this.y=e},o.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},o.prototype.getCopy=function(){return new o(this.x,this.y)},o.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(0),i=T(6),l=T(3),g=T(1),n=T(13),d=T(12),r=T(11);function h(p,v,D){o.call(this,D),this.estimatedSize=e.MIN_VALUE,this.margin=t.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=p,v!=null&&v instanceof i?this.graphManager=v:v!=null&&v instanceof Layout&&(this.graphManager=v.graphManager)}h.prototype=Object.create(o.prototype);for(var a in o)h[a]=o[a];h.prototype.getNodes=function(){return this.nodes},h.prototype.getEdges=function(){return this.edges},h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getParent=function(){return this.parent},h.prototype.getLeft=function(){return this.left},h.prototype.getRight=function(){return this.right},h.prototype.getTop=function(){return this.top},h.prototype.getBottom=function(){return this.bottom},h.prototype.isConnected=function(){return this.isConnected},h.prototype.add=function(p,v,D){if(v==null&&D==null){var u=p;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var E=p;if(!(this.getNodes().indexOf(v)>-1&&this.getNodes().indexOf(D)>-1))throw"Source or target not in graph!";if(!(v.owner==D.owner&&v.owner==this))throw"Both owners must be this graph!";return v.owner!=D.owner?null:(E.source=v,E.target=D,E.isInterGraph=!1,this.getEdges().push(E),v.edges.push(E),D!=v&&D.edges.push(E),E)}},h.prototype.remove=function(p){var v=p;if(p instanceof l){if(v==null)throw"Node is null!";if(!(v.owner!=null&&v.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var D=v.edges.slice(),u,E=D.length,y=0;y<E;y++)u=D[y],u.isInterGraph?this.graphManager.remove(u):u.source.owner.remove(u);var O=this.nodes.indexOf(v);if(O==-1)throw"Node not in owner node list!";this.nodes.splice(O,1)}else if(p instanceof g){var u=p;if(u==null)throw"Edge is null!";if(!(u.source!=null&&u.target!=null))throw"Source and/or target is null!";if(!(u.source.owner!=null&&u.target.owner!=null&&u.source.owner==this&&u.target.owner==this))throw"Source and/or target owner is invalid!";var s=u.source.edges.indexOf(u),f=u.target.edges.indexOf(u);if(!(s>-1&&f>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(s,1),u.target!=u.source&&u.target.edges.splice(f,1);var O=u.source.owner.getEdges().indexOf(u);if(O==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(O,1)}},h.prototype.updateLeftTop=function(){for(var p=e.MAX_VALUE,v=e.MAX_VALUE,D,u,E,y=this.getNodes(),O=y.length,s=0;s<O;s++){var f=y[s];D=f.getTop(),u=f.getLeft(),p>D&&(p=D),v>u&&(v=u)}return p==e.MAX_VALUE?null:(y[0].getParent().paddingLeft!=null?E=y[0].getParent().paddingLeft:E=this.margin,this.left=v-E,this.top=p-E,new d(this.left,this.top))},h.prototype.updateBounds=function(p){for(var v=e.MAX_VALUE,D=-e.MAX_VALUE,u=e.MAX_VALUE,E=-e.MAX_VALUE,y,O,s,f,c,L=this.nodes,A=L.length,m=0;m<A;m++){var C=L[m];p&&C.child!=null&&C.updateBounds(),y=C.getLeft(),O=C.getRight(),s=C.getTop(),f=C.getBottom(),v>y&&(v=y),D<O&&(D=O),u>s&&(u=s),E<f&&(E=f)}var R=new n(v,u,D-v,E-u);v==e.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),L[0].getParent().paddingLeft!=null?c=L[0].getParent().paddingLeft:c=this.margin,this.left=R.x-c,this.right=R.x+R.width+c,this.top=R.y-c,this.bottom=R.y+R.height+c},h.calculateBounds=function(p){for(var v=e.MAX_VALUE,D=-e.MAX_VALUE,u=e.MAX_VALUE,E=-e.MAX_VALUE,y,O,s,f,c=p.length,L=0;L<c;L++){var A=p[L];y=A.getLeft(),O=A.getRight(),s=A.getTop(),f=A.getBottom(),v>y&&(v=y),D<O&&(D=O),u>s&&(u=s),E<f&&(E=f)}var m=new n(v,u,D-v,E-u);return m},h.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},h.prototype.getEstimatedSize=function(){if(this.estimatedSize==e.MIN_VALUE)throw"assert failed";return this.estimatedSize},h.prototype.calcEstimatedSize=function(){for(var p=0,v=this.nodes,D=v.length,u=0;u<D;u++){var E=v[u];p+=E.calcEstimatedSize()}return p==0?this.estimatedSize=t.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=p/Math.sqrt(this.nodes.length),this.estimatedSize},h.prototype.updateConnected=function(){var p=this;if(this.nodes.length==0){this.isConnected=!0;return}var v=new r,D=new Set,u=this.nodes[0],E,y,O=u.withChildren();for(O.forEach(function(m){v.push(m),D.add(m)});v.length!==0;){u=v.shift(),E=u.getEdges();for(var s=E.length,f=0;f<s;f++){var c=E[f];if(y=c.getOtherEndInGraph(u,this),y!=null&&!D.has(y)){var L=y.withChildren();L.forEach(function(m){v.push(m),D.add(m)})}}}if(this.isConnected=!1,D.size>=this.nodes.length){var A=0;D.forEach(function(m){m.owner==p&&A++}),A==this.nodes.length&&(this.isConnected=!0)}},N.exports=h}),(function(N,I,T){var o,e=T(1);function t(i){o=T(5),this.layout=i,this.graphs=[],this.edges=[]}t.prototype.addRoot=function(){var i=this.layout.newGraph(),l=this.layout.newNode(null),g=this.add(i,l);return this.setRootGraph(g),this.rootGraph},t.prototype.add=function(i,l,g,n,d){if(g==null&&n==null&&d==null){if(i==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(i)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(i),i.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return i.parent=l,l.child=i,i}else{d=g,n=l,g=i;var r=n.getOwner(),h=d.getOwner();if(!(r!=null&&r.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(h!=null&&h.getGraphManager()==this))throw"Target not in this graph mgr!";if(r==h)return g.isInterGraph=!1,r.add(g,n,d);if(g.isInterGraph=!0,g.source=n,g.target=d,this.edges.indexOf(g)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(g),!(g.source!=null&&g.target!=null))throw"Edge source and/or target is null!";if(!(g.source.edges.indexOf(g)==-1&&g.target.edges.indexOf(g)==-1))throw"Edge already in source and/or target incidency list!";return g.source.edges.push(g),g.target.edges.push(g),g}},t.prototype.remove=function(i){if(i instanceof o){var l=i;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var g=[];g=g.concat(l.getEdges());for(var n,d=g.length,r=0;r<d;r++)n=g[r],l.remove(n);var h=[];h=h.concat(l.getNodes());var a;d=h.length;for(var r=0;r<d;r++)a=h[r],l.remove(a);l==this.rootGraph&&this.setRootGraph(null);var p=this.graphs.indexOf(l);this.graphs.splice(p,1),l.parent=null}else if(i instanceof e){if(n=i,n==null)throw"Edge is null!";if(!n.isInterGraph)throw"Not an inter-graph edge!";if(!(n.source!=null&&n.target!=null))throw"Source and/or target is null!";if(!(n.source.edges.indexOf(n)!=-1&&n.target.edges.indexOf(n)!=-1))throw"Source and/or target doesn't know this edge!";var p=n.source.edges.indexOf(n);if(n.source.edges.splice(p,1),p=n.target.edges.indexOf(n),n.target.edges.splice(p,1),!(n.source.owner!=null&&n.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(n.source.owner.getGraphManager().edges.indexOf(n)==-1)throw"Not in owner graph manager's edge list!";var p=n.source.owner.getGraphManager().edges.indexOf(n);n.source.owner.getGraphManager().edges.splice(p,1)}},t.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},t.prototype.getGraphs=function(){return this.graphs},t.prototype.getAllNodes=function(){if(this.allNodes==null){for(var i=[],l=this.getGraphs(),g=l.length,n=0;n<g;n++)i=i.concat(l[n].getNodes());this.allNodes=i}return this.allNodes},t.prototype.resetAllNodes=function(){this.allNodes=null},t.prototype.resetAllEdges=function(){this.allEdges=null},t.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},t.prototype.getAllEdges=function(){if(this.allEdges==null){var i=[],l=this.getGraphs();l.length;for(var g=0;g<l.length;g++)i=i.concat(l[g].getEdges());i=i.concat(this.edges),this.allEdges=i}return this.allEdges},t.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},t.prototype.setAllNodesToApplyGravitation=function(i){if(this.allNodesToApplyGravitation!=null)throw"assert failed";this.allNodesToApplyGravitation=i},t.prototype.getRoot=function(){return this.rootGraph},t.prototype.setRootGraph=function(i){if(i.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=i,i.parent==null&&(i.parent=this.layout.newNode("Root node"))},t.prototype.getLayout=function(){return this.layout},t.prototype.isOneAncestorOfOther=function(i,l){if(!(i!=null&&l!=null))throw"assert failed";if(i==l)return!0;var g=i.getOwner(),n;do{if(n=g.getParent(),n==null)break;if(n==l)return!0;if(g=n.getOwner(),g==null)break}while(!0);g=l.getOwner();do{if(n=g.getParent(),n==null)break;if(n==i)return!0;if(g=n.getOwner(),g==null)break}while(!0);return!1},t.prototype.calcLowestCommonAncestors=function(){for(var i,l,g,n,d,r=this.getAllEdges(),h=r.length,a=0;a<h;a++){if(i=r[a],l=i.source,g=i.target,i.lca=null,i.sourceInLca=l,i.targetInLca=g,l==g){i.lca=l.getOwner();continue}for(n=l.getOwner();i.lca==null;){for(i.targetInLca=g,d=g.getOwner();i.lca==null;){if(d==n){i.lca=d;break}if(d==this.rootGraph)break;if(i.lca!=null)throw"assert failed";i.targetInLca=d.getParent(),d=i.targetInLca.getOwner()}if(n==this.rootGraph)break;i.lca==null&&(i.sourceInLca=n.getParent(),n=i.sourceInLca.getOwner())}if(i.lca==null)throw"assert failed"}},t.prototype.calcLowestCommonAncestor=function(i,l){if(i==l)return i.getOwner();var g=i.getOwner();do{if(g==null)break;var n=l.getOwner();do{if(n==null)break;if(n==g)return n;n=n.getParent().getOwner()}while(!0);g=g.getParent().getOwner()}while(!0);return g},t.prototype.calcInclusionTreeDepths=function(i,l){i==null&&l==null&&(i=this.rootGraph,l=1);for(var g,n=i.getNodes(),d=n.length,r=0;r<d;r++)g=n[r],g.inclusionTreeDepth=l,g.child!=null&&this.calcInclusionTreeDepths(g.child,l+1)},t.prototype.includesInvalidEdge=function(){for(var i,l=this.edges.length,g=0;g<l;g++)if(i=this.edges[g],this.isOneAncestorOfOther(i.source,i.target))return!0;return!1},N.exports=t}),(function(N,I,T){var o=T(0);function e(){}for(var t in o)e[t]=o[t];e.MAX_ITERATIONS=2500,e.DEFAULT_EDGE_LENGTH=50,e.DEFAULT_SPRING_STRENGTH=.45,e.DEFAULT_REPULSION_STRENGTH=4500,e.DEFAULT_GRAVITY_STRENGTH=.4,e.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,e.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,e.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,e.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,e.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,e.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,e.COOLING_ADAPTATION_FACTOR=.33,e.ADAPTATION_LOWER_NODE_LIMIT=1e3,e.ADAPTATION_UPPER_NODE_LIMIT=5e3,e.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,e.MAX_NODE_DISPLACEMENT=e.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,e.MIN_REPULSION_DIST=e.DEFAULT_EDGE_LENGTH/10,e.CONVERGENCE_CHECK_PERIOD=100,e.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,e.MIN_EDGE_LENGTH=1,e.GRID_CALCULATION_CHECK_PERIOD=10,N.exports=e}),(function(N,I,T){var o=T(12);function e(){}e.calcSeparationAmount=function(t,i,l,g){if(!t.intersects(i))throw"assert failed";var n=new Array(2);this.decideDirectionsForOverlappingNodes(t,i,n),l[0]=Math.min(t.getRight(),i.getRight())-Math.max(t.x,i.x),l[1]=Math.min(t.getBottom(),i.getBottom())-Math.max(t.y,i.y),t.getX()<=i.getX()&&t.getRight()>=i.getRight()?l[0]+=Math.min(i.getX()-t.getX(),t.getRight()-i.getRight()):i.getX()<=t.getX()&&i.getRight()>=t.getRight()&&(l[0]+=Math.min(t.getX()-i.getX(),i.getRight()-t.getRight())),t.getY()<=i.getY()&&t.getBottom()>=i.getBottom()?l[1]+=Math.min(i.getY()-t.getY(),t.getBottom()-i.getBottom()):i.getY()<=t.getY()&&i.getBottom()>=t.getBottom()&&(l[1]+=Math.min(t.getY()-i.getY(),i.getBottom()-t.getBottom()));var d=Math.abs((i.getCenterY()-t.getCenterY())/(i.getCenterX()-t.getCenterX()));i.getCenterY()===t.getCenterY()&&i.getCenterX()===t.getCenterX()&&(d=1);var r=d*l[0],h=l[1]/d;l[0]<h?h=l[0]:r=l[1],l[0]=-1*n[0]*(h/2+g),l[1]=-1*n[1]*(r/2+g)},e.decideDirectionsForOverlappingNodes=function(t,i,l){t.getCenterX()<i.getCenterX()?l[0]=-1:l[0]=1,t.getCenterY()<i.getCenterY()?l[1]=-1:l[1]=1},e.getIntersection2=function(t,i,l){var g=t.getCenterX(),n=t.getCenterY(),d=i.getCenterX(),r=i.getCenterY();if(t.intersects(i))return l[0]=g,l[1]=n,l[2]=d,l[3]=r,!0;var h=t.getX(),a=t.getY(),p=t.getRight(),v=t.getX(),D=t.getBottom(),u=t.getRight(),E=t.getWidthHalf(),y=t.getHeightHalf(),O=i.getX(),s=i.getY(),f=i.getRight(),c=i.getX(),L=i.getBottom(),A=i.getRight(),m=i.getWidthHalf(),C=i.getHeightHalf(),R=!1,M=!1;if(g===d){if(n>r)return l[0]=g,l[1]=a,l[2]=d,l[3]=L,!1;if(n<r)return l[0]=g,l[1]=D,l[2]=d,l[3]=s,!1}else if(n===r){if(g>d)return l[0]=h,l[1]=n,l[2]=f,l[3]=r,!1;if(g<d)return l[0]=p,l[1]=n,l[2]=O,l[3]=r,!1}else{var S=t.height/t.width,Y=i.height/i.width,w=(r-n)/(d-g),x=void 0,F=void 0,U=void 0,P=void 0,_=void 0,X=void 0;if(-S===w?g>d?(l[0]=v,l[1]=D,R=!0):(l[0]=p,l[1]=a,R=!0):S===w&&(g>d?(l[0]=h,l[1]=a,R=!0):(l[0]=u,l[1]=D,R=!0)),-Y===w?d>g?(l[2]=c,l[3]=L,M=!0):(l[2]=f,l[3]=s,M=!0):Y===w&&(d>g?(l[2]=O,l[3]=s,M=!0):(l[2]=A,l[3]=L,M=!0)),R&&M)return!1;if(g>d?n>r?(x=this.getCardinalDirection(S,w,4),F=this.getCardinalDirection(Y,w,2)):(x=this.getCardinalDirection(-S,w,3),F=this.getCardinalDirection(-Y,w,1)):n>r?(x=this.getCardinalDirection(-S,w,1),F=this.getCardinalDirection(-Y,w,3)):(x=this.getCardinalDirection(S,w,2),F=this.getCardinalDirection(Y,w,4)),!R)switch(x){case 1:P=a,U=g+-y/w,l[0]=U,l[1]=P;break;case 2:U=u,P=n+E*w,l[0]=U,l[1]=P;break;case 3:P=D,U=g+y/w,l[0]=U,l[1]=P;break;case 4:U=v,P=n+-E*w,l[0]=U,l[1]=P;break}if(!M)switch(F){case 1:X=s,_=d+-C/w,l[2]=_,l[3]=X;break;case 2:_=A,X=r+m*w,l[2]=_,l[3]=X;break;case 3:X=L,_=d+C/w,l[2]=_,l[3]=X;break;case 4:_=c,X=r+-m*w,l[2]=_,l[3]=X;break}}return!1},e.getCardinalDirection=function(t,i,l){return t>i?l:1+l%4},e.getIntersection=function(t,i,l,g){if(g==null)return this.getIntersection2(t,i,l);var n=t.x,d=t.y,r=i.x,h=i.y,a=l.x,p=l.y,v=g.x,D=g.y,u=void 0,E=void 0,y=void 0,O=void 0,s=void 0,f=void 0,c=void 0,L=void 0,A=void 0;return y=h-d,s=n-r,c=r*d-n*h,O=D-p,f=a-v,L=v*p-a*D,A=y*f-O*s,A===0?null:(u=(s*L-f*c)/A,E=(O*c-y*L)/A,new o(u,E))},e.angleOfVector=function(t,i,l,g){var n=void 0;return t!==l?(n=Math.atan((g-i)/(l-t)),l<t?n+=Math.PI:g<i&&(n+=this.TWO_PI)):g<i?n=this.ONE_AND_HALF_PI:n=this.HALF_PI,n},e.doIntersect=function(t,i,l,g){var n=t.x,d=t.y,r=i.x,h=i.y,a=l.x,p=l.y,v=g.x,D=g.y,u=(r-n)*(D-p)-(v-a)*(h-d);if(u===0)return!1;var E=((D-p)*(v-n)+(a-v)*(D-d))/u,y=((d-h)*(v-n)+(r-n)*(D-d))/u;return 0<E&&E<1&&0<y&&y<1},e.HALF_PI=.5*Math.PI,e.ONE_AND_HALF_PI=1.5*Math.PI,e.TWO_PI=2*Math.PI,e.THREE_PI=3*Math.PI,N.exports=e}),(function(N,I,T){function o(){}o.sign=function(e){return e>0?1:e<0?-1:0},o.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},o.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},N.exports=o}),(function(N,I,T){function o(){}o.MAX_VALUE=2147483647,o.MIN_VALUE=-2147483648,N.exports=o}),(function(N,I,T){var o=(function(){function n(d,r){for(var h=0;h<r.length;h++){var a=r[h];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(d,a.key,a)}}return function(d,r,h){return r&&n(d.prototype,r),h&&n(d,h),d}})();function e(n,d){if(!(n instanceof d))throw new TypeError("Cannot call a class as a function")}var t=function(d){return{value:d,next:null,prev:null}},i=function(d,r,h,a){return d!==null?d.next=r:a.head=r,h!==null?h.prev=r:a.tail=r,r.prev=d,r.next=h,a.length++,r},l=function(d,r){var h=d.prev,a=d.next;return h!==null?h.next=a:r.head=a,a!==null?a.prev=h:r.tail=h,d.prev=d.next=null,r.length--,d},g=(function(){function n(d){var r=this;e(this,n),this.length=0,this.head=null,this.tail=null,d!=null&&d.forEach(function(h){return r.push(h)})}return o(n,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(r,h){return i(h.prev,t(r),h,this)}},{key:"insertAfter",value:function(r,h){return i(h,t(r),h.next,this)}},{key:"insertNodeBefore",value:function(r,h){return i(h.prev,r,h,this)}},{key:"insertNodeAfter",value:function(r,h){return i(h,r,h.next,this)}},{key:"push",value:function(r){return i(this.tail,t(r),null,this)}},{key:"unshift",value:function(r){return i(null,t(r),this.head,this)}},{key:"remove",value:function(r){return l(r,this)}},{key:"pop",value:function(){return l(this.tail,this).value}},{key:"popNode",value:function(){return l(this.tail,this)}},{key:"shift",value:function(){return l(this.head,this).value}},{key:"shiftNode",value:function(){return l(this.head,this)}},{key:"get_object_at",value:function(r){if(r<=this.length()){for(var h=1,a=this.head;h<r;)a=a.next,h++;return a.value}}},{key:"set_object_at",value:function(r,h){if(r<=this.length()){for(var a=1,p=this.head;a<r;)p=p.next,a++;p.value=h}}}]),n})();N.exports=g}),(function(N,I,T){function o(e,t,i){this.x=null,this.y=null,e==null&&t==null&&i==null?(this.x=0,this.y=0):typeof e=="number"&&typeof t=="number"&&i==null?(this.x=e,this.y=t):e.constructor.name=="Point"&&t==null&&i==null&&(i=e,this.x=i.x,this.y=i.y)}o.prototype.getX=function(){return this.x},o.prototype.getY=function(){return this.y},o.prototype.getLocation=function(){return new o(this.x,this.y)},o.prototype.setLocation=function(e,t,i){e.constructor.name=="Point"&&t==null&&i==null?(i=e,this.setLocation(i.x,i.y)):typeof e=="number"&&typeof t=="number"&&i==null&&(parseInt(e)==e&&parseInt(t)==t?this.move(e,t):(this.x=Math.floor(e+.5),this.y=Math.floor(t+.5)))},o.prototype.move=function(e,t){this.x=e,this.y=t},o.prototype.translate=function(e,t){this.x+=e,this.y+=t},o.prototype.equals=function(e){if(e.constructor.name=="Point"){var t=e;return this.x==t.x&&this.y==t.y}return this==e},o.prototype.toString=function(){return new o().constructor.name+"[x="+this.x+",y="+this.y+"]"},N.exports=o}),(function(N,I,T){function o(e,t,i,l){this.x=0,this.y=0,this.width=0,this.height=0,e!=null&&t!=null&&i!=null&&l!=null&&(this.x=e,this.y=t,this.width=i,this.height=l)}o.prototype.getX=function(){return this.x},o.prototype.setX=function(e){this.x=e},o.prototype.getY=function(){return this.y},o.prototype.setY=function(e){this.y=e},o.prototype.getWidth=function(){return this.width},o.prototype.setWidth=function(e){this.width=e},o.prototype.getHeight=function(){return this.height},o.prototype.setHeight=function(e){this.height=e},o.prototype.getRight=function(){return this.x+this.width},o.prototype.getBottom=function(){return this.y+this.height},o.prototype.intersects=function(e){return!(this.getRight()<e.x||this.getBottom()<e.y||e.getRight()<this.x||e.getBottom()<this.y)},o.prototype.getCenterX=function(){return this.x+this.width/2},o.prototype.getMinX=function(){return this.getX()},o.prototype.getMaxX=function(){return this.getX()+this.width},o.prototype.getCenterY=function(){return this.y+this.height/2},o.prototype.getMinY=function(){return this.getY()},o.prototype.getMaxY=function(){return this.getY()+this.height},o.prototype.getWidthHalf=function(){return this.width/2},o.prototype.getHeightHalf=function(){return this.height/2},N.exports=o}),(function(N,I,T){var o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function e(){}e.lastID=0,e.createID=function(t){return e.isPrimitive(t)?t:(t.uniqueID!=null||(t.uniqueID=e.getString(),e.lastID++),t.uniqueID)},e.getString=function(t){return t==null&&(t=e.lastID),"Object#"+t},e.isPrimitive=function(t){var i=typeof t>"u"?"undefined":o(t);return t==null||i!="object"&&i!="function"},N.exports=e}),(function(N,I,T){function o(a){if(Array.isArray(a)){for(var p=0,v=Array(a.length);p<a.length;p++)v[p]=a[p];return v}else return Array.from(a)}var e=T(0),t=T(6),i=T(3),l=T(1),g=T(5),n=T(4),d=T(17),r=T(27);function h(a){r.call(this),this.layoutQuality=e.QUALITY,this.createBendsAsNeeded=e.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=e.DEFAULT_INCREMENTAL,this.animationOnLayout=e.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=e.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=e.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=e.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new t(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,a!=null&&(this.isRemoteUse=a)}h.RANDOM_SEED=1,h.prototype=Object.create(r.prototype),h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},h.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},h.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},h.prototype.newGraphManager=function(){var a=new t(this);return this.graphManager=a,a},h.prototype.newGraph=function(a){return new g(null,this.graphManager,a)},h.prototype.newNode=function(a){return new i(this.graphManager,a)},h.prototype.newEdge=function(a){return new l(null,null,a)},h.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},h.prototype.runLayout=function(){this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters();var a;return this.checkLayoutSuccess()?a=!1:a=this.layout(),e.ANIMATE==="during"?!1:(a&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,a)},h.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},h.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var a=this.graphManager.getAllEdges(),p=0;p<a.length;p++)a[p];for(var v=this.graphManager.getRoot().getNodes(),p=0;p<v.length;p++)v[p];this.update(this.graphManager.getRoot())}},h.prototype.update=function(a){if(a==null)this.update2();else if(a instanceof i){var p=a;if(p.getChild()!=null)for(var v=p.getChild().getNodes(),D=0;D<v.length;D++)update(v[D]);if(p.vGraphObject!=null){var u=p.vGraphObject;u.update(p)}}else if(a instanceof l){var E=a;if(E.vGraphObject!=null){var y=E.vGraphObject;y.update(E)}}else if(a instanceof g){var O=a;if(O.vGraphObject!=null){var s=O.vGraphObject;s.update(O)}}},h.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=e.QUALITY,this.animationDuringLayout=e.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=e.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=e.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=e.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=e.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=e.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},h.prototype.transform=function(a){if(a==null)this.transform(new n(0,0));else{var p=new d,v=this.graphManager.getRoot().updateLeftTop();if(v!=null){p.setWorldOrgX(a.x),p.setWorldOrgY(a.y),p.setDeviceOrgX(v.x),p.setDeviceOrgY(v.y);for(var D=this.getAllNodes(),u,E=0;E<D.length;E++)u=D[E],u.transform(p)}}},h.prototype.positionNodesRandomly=function(a){if(a==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var p,v,D=a.getNodes(),u=0;u<D.length;u++)p=D[u],v=p.getChild(),v==null||v.getNodes().length==0?p.scatter():(this.positionNodesRandomly(v),p.updateBounds())},h.prototype.getFlatForest=function(){for(var a=[],p=!0,v=this.graphManager.getRoot().getNodes(),D=!0,u=0;u<v.length;u++)v[u].getChild()!=null&&(D=!1);if(!D)return a;var E=new Set,y=[],O=new Map,s=[];for(s=s.concat(v);s.length>0&&p;){for(y.push(s[0]);y.length>0&&p;){var f=y[0];y.splice(0,1),E.add(f);for(var c=f.getEdges(),u=0;u<c.length;u++){var L=c[u].getOtherEnd(f);if(O.get(f)!=L)if(!E.has(L))y.push(L),O.set(L,f);else{p=!1;break}}}if(!p)a=[];else{var A=[].concat(o(E));a.push(A);for(var u=0;u<A.length;u++){var m=A[u],C=s.indexOf(m);C>-1&&s.splice(C,1)}E=new Set,O=new Map}}return a},h.prototype.createDummyNodesForBendpoints=function(a){for(var p=[],v=a.source,D=this.graphManager.calcLowestCommonAncestor(a.source,a.target),u=0;u<a.bendpoints.length;u++){var E=this.newNode(null);E.setRect(new Point(0,0),new Dimension(1,1)),D.add(E);var y=this.newEdge(null);this.graphManager.add(y,v,E),p.add(E),v=E}var y=this.newEdge(null);return this.graphManager.add(y,v,a.target),this.edgeToDummyNodes.set(a,p),a.isInterGraph()?this.graphManager.remove(a):D.remove(a),p},h.prototype.createBendpointsFromDummyNodes=function(){var a=[];a=a.concat(this.graphManager.getAllEdges()),a=[].concat(o(this.edgeToDummyNodes.keys())).concat(a);for(var p=0;p<a.length;p++){var v=a[p];if(v.bendpoints.length>0){for(var D=this.edgeToDummyNodes.get(v),u=0;u<D.length;u++){var E=D[u],y=new n(E.getCenterX(),E.getCenterY()),O=v.bendpoints.get(u);O.x=y.x,O.y=y.y,E.getOwner().remove(E)}this.graphManager.add(v,v.source,v.target)}}},h.transform=function(a,p,v,D){if(v!=null&&D!=null){var u=p;if(a<=50){var E=p/v;u-=(p-E)/50*(50-a)}else{var y=p*D;u+=(y-p)/50*(a-50)}return u}else{var O,s;return a<=50?(O=9*p/500,s=p/10):(O=9*p/50,s=-8*p),O*a+s}},h.findCenterOfTree=function(a){var p=[];p=p.concat(a);var v=[],D=new Map,u=!1,E=null;(p.length==1||p.length==2)&&(u=!0,E=p[0]);for(var y=0;y<p.length;y++){var O=p[y],s=O.getNeighborsList().size;D.set(O,O.getNeighborsList().size),s==1&&v.push(O)}var f=[];for(f=f.concat(v);!u;){var c=[];c=c.concat(f),f=[];for(var y=0;y<p.length;y++){var O=p[y],L=p.indexOf(O);L>=0&&p.splice(L,1);var A=O.getNeighborsList();A.forEach(function(R){if(v.indexOf(R)<0){var M=D.get(R),S=M-1;S==1&&f.push(R),D.set(R,S)}})}v=v.concat(f),(p.length==1||p.length==2)&&(u=!0,E=p[0])}return E},h.prototype.setGraphManager=function(a){this.graphManager=a},N.exports=h}),(function(N,I,T){function o(){}o.seed=1,o.x=0,o.nextDouble=function(){return o.x=Math.sin(o.seed++)*1e4,o.x-Math.floor(o.x)},N.exports=o}),(function(N,I,T){var o=T(4);function e(t,i){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}e.prototype.getWorldOrgX=function(){return this.lworldOrgX},e.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},e.prototype.getWorldOrgY=function(){return this.lworldOrgY},e.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},e.prototype.getWorldExtX=function(){return this.lworldExtX},e.prototype.setWorldExtX=function(t){this.lworldExtX=t},e.prototype.getWorldExtY=function(){return this.lworldExtY},e.prototype.setWorldExtY=function(t){this.lworldExtY=t},e.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},e.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},e.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},e.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},e.prototype.getDeviceExtX=function(){return this.ldeviceExtX},e.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},e.prototype.getDeviceExtY=function(){return this.ldeviceExtY},e.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},e.prototype.transformX=function(t){var i=0,l=this.lworldExtX;return l!=0&&(i=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/l),i},e.prototype.transformY=function(t){var i=0,l=this.lworldExtY;return l!=0&&(i=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/l),i},e.prototype.inverseTransformX=function(t){var i=0,l=this.ldeviceExtX;return l!=0&&(i=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/l),i},e.prototype.inverseTransformY=function(t){var i=0,l=this.ldeviceExtY;return l!=0&&(i=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/l),i},e.prototype.inverseTransformPoint=function(t){var i=new o(this.inverseTransformX(t.x),this.inverseTransformY(t.y));return i},N.exports=e}),(function(N,I,T){function o(r){if(Array.isArray(r)){for(var h=0,a=Array(r.length);h<r.length;h++)a[h]=r[h];return a}else return Array.from(r)}var e=T(15),t=T(7),i=T(0),l=T(8),g=T(9);function n(){e.call(this),this.useSmartIdealEdgeLengthCalculation=t.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=t.DEFAULT_EDGE_LENGTH,this.springConstant=t.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=t.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=t.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=t.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=t.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=t.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*t.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=t.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=t.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=t.MAX_ITERATIONS}n.prototype=Object.create(e.prototype);for(var d in e)n[d]=e[d];n.prototype.initParameters=function(){e.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=t.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},n.prototype.calcIdealEdgeLengths=function(){for(var r,h,a,p,v,D,u=this.getGraphManager().getAllEdges(),E=0;E<u.length;E++)r=u[E],r.idealLength=this.idealEdgeLength,r.isInterGraph&&(a=r.getSource(),p=r.getTarget(),v=r.getSourceInLca().getEstimatedSize(),D=r.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(r.idealLength+=v+D-2*i.SIMPLE_NODE_SIZE),h=r.getLca().getInclusionTreeDepth(),r.idealLength+=t.DEFAULT_EDGE_LENGTH*t.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(a.getInclusionTreeDepth()+p.getInclusionTreeDepth()-2*h))},n.prototype.initSpringEmbedder=function(){var r=this.getAllNodes().length;this.incremental?(r>t.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*t.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-t.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT_INCREMENTAL):(r>t.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(t.COOLING_ADAPTATION_FACTOR,1-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*(1-t.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},n.prototype.calcSpringForces=function(){for(var r=this.getAllEdges(),h,a=0;a<r.length;a++)h=r[a],this.calcSpringForce(h,h.idealLength)},n.prototype.calcRepulsionForces=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a,p,v,D,u=this.getAllNodes(),E;if(this.useFRGridVariant)for(this.totalIterations%t.GRID_CALCULATION_CHECK_PERIOD==1&&r&&this.updateGrid(),E=new Set,a=0;a<u.length;a++)v=u[a],this.calculateRepulsionForceOfANode(v,E,r,h),E.add(v);else for(a=0;a<u.length;a++)for(v=u[a],p=a+1;p<u.length;p++)D=u[p],v.getOwner()==D.getOwner()&&this.calcRepulsionForce(v,D)},n.prototype.calcGravitationalForces=function(){for(var r,h=this.getAllNodesToApplyGravitation(),a=0;a<h.length;a++)r=h[a],this.calcGravitationalForce(r)},n.prototype.moveNodes=function(){for(var r=this.getAllNodes(),h,a=0;a<r.length;a++)h=r[a],h.move()},n.prototype.calcSpringForce=function(r,h){var a=r.getSource(),p=r.getTarget(),v,D,u,E;if(this.uniformLeafNodeSizes&&a.getChild()==null&&p.getChild()==null)r.updateLengthSimple();else if(r.updateLength(),r.isOverlapingSourceAndTarget)return;v=r.getLength(),v!=0&&(D=this.springConstant*(v-h),u=D*(r.lengthX/v),E=D*(r.lengthY/v),a.springForceX+=u,a.springForceY+=E,p.springForceX-=u,p.springForceY-=E)},n.prototype.calcRepulsionForce=function(r,h){var a=r.getRect(),p=h.getRect(),v=new Array(2),D=new Array(4),u,E,y,O,s,f,c;if(a.intersects(p)){l.calcSeparationAmount(a,p,v,t.DEFAULT_EDGE_LENGTH/2),f=2*v[0],c=2*v[1];var L=r.noOfChildren*h.noOfChildren/(r.noOfChildren+h.noOfChildren);r.repulsionForceX-=L*f,r.repulsionForceY-=L*c,h.repulsionForceX+=L*f,h.repulsionForceY+=L*c}else this.uniformLeafNodeSizes&&r.getChild()==null&&h.getChild()==null?(u=p.getCenterX()-a.getCenterX(),E=p.getCenterY()-a.getCenterY()):(l.getIntersection(a,p,D),u=D[2]-D[0],E=D[3]-D[1]),Math.abs(u)<t.MIN_REPULSION_DIST&&(u=g.sign(u)*t.MIN_REPULSION_DIST),Math.abs(E)<t.MIN_REPULSION_DIST&&(E=g.sign(E)*t.MIN_REPULSION_DIST),y=u*u+E*E,O=Math.sqrt(y),s=this.repulsionConstant*r.noOfChildren*h.noOfChildren/y,f=s*u/O,c=s*E/O,r.repulsionForceX-=f,r.repulsionForceY-=c,h.repulsionForceX+=f,h.repulsionForceY+=c},n.prototype.calcGravitationalForce=function(r){var h,a,p,v,D,u,E,y;h=r.getOwner(),a=(h.getRight()+h.getLeft())/2,p=(h.getTop()+h.getBottom())/2,v=r.getCenterX()-a,D=r.getCenterY()-p,u=Math.abs(v)+r.getWidth()/2,E=Math.abs(D)+r.getHeight()/2,r.getOwner()==this.graphManager.getRoot()?(y=h.getEstimatedSize()*this.gravityRangeFactor,(u>y||E>y)&&(r.gravitationForceX=-this.gravityConstant*v,r.gravitationForceY=-this.gravityConstant*D)):(y=h.getEstimatedSize()*this.compoundGravityRangeFactor,(u>y||E>y)&&(r.gravitationForceX=-this.gravityConstant*v*this.compoundGravityConstant,r.gravitationForceY=-this.gravityConstant*D*this.compoundGravityConstant))},n.prototype.isConverged=function(){var r,h=!1;return this.totalIterations>this.maxIterations/3&&(h=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),r=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,r||h},n.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},n.prototype.calcNoOfChildrenForAllNodes=function(){for(var r,h=this.graphManager.getAllNodes(),a=0;a<h.length;a++)r=h[a],r.noOfChildren=r.getNoOfChildren()},n.prototype.calcGrid=function(r){var h=0,a=0;h=parseInt(Math.ceil((r.getRight()-r.getLeft())/this.repulsionRange)),a=parseInt(Math.ceil((r.getBottom()-r.getTop())/this.repulsionRange));for(var p=new Array(h),v=0;v<h;v++)p[v]=new Array(a);for(var v=0;v<h;v++)for(var D=0;D<a;D++)p[v][D]=new Array;return p},n.prototype.addNodeToGrid=function(r,h,a){var p=0,v=0,D=0,u=0;p=parseInt(Math.floor((r.getRect().x-h)/this.repulsionRange)),v=parseInt(Math.floor((r.getRect().width+r.getRect().x-h)/this.repulsionRange)),D=parseInt(Math.floor((r.getRect().y-a)/this.repulsionRange)),u=parseInt(Math.floor((r.getRect().height+r.getRect().y-a)/this.repulsionRange));for(var E=p;E<=v;E++)for(var y=D;y<=u;y++)this.grid[E][y].push(r),r.setGridCoordinates(p,v,D,u)},n.prototype.updateGrid=function(){var r,h,a=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),r=0;r<a.length;r++)h=a[r],this.addNodeToGrid(h,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},n.prototype.calculateRepulsionForceOfANode=function(r,h,a,p){if(this.totalIterations%t.GRID_CALCULATION_CHECK_PERIOD==1&&a||p){var v=new Set;r.surrounding=new Array;for(var D,u=this.grid,E=r.startX-1;E<r.finishX+2;E++)for(var y=r.startY-1;y<r.finishY+2;y++)if(!(E<0||y<0||E>=u.length||y>=u[0].length)){for(var O=0;O<u[E][y].length;O++)if(D=u[E][y][O],!(r.getOwner()!=D.getOwner()||r==D)&&!h.has(D)&&!v.has(D)){var s=Math.abs(r.getCenterX()-D.getCenterX())-(r.getWidth()/2+D.getWidth()/2),f=Math.abs(r.getCenterY()-D.getCenterY())-(r.getHeight()/2+D.getHeight()/2);s<=this.repulsionRange&&f<=this.repulsionRange&&v.add(D)}}r.surrounding=[].concat(o(v))}for(E=0;E<r.surrounding.length;E++)this.calcRepulsionForce(r,r.surrounding[E])},n.prototype.calcRepulsionRange=function(){return 0},N.exports=n}),(function(N,I,T){var o=T(1),e=T(7);function t(l,g,n){o.call(this,l,g,n),this.idealLength=e.DEFAULT_EDGE_LENGTH}t.prototype=Object.create(o.prototype);for(var i in o)t[i]=o[i];N.exports=t}),(function(N,I,T){var o=T(3);function e(i,l,g,n){o.call(this,i,l,g,n),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}e.prototype=Object.create(o.prototype);for(var t in o)e[t]=o[t];e.prototype.setGridCoordinates=function(i,l,g,n){this.startX=i,this.finishX=l,this.startY=g,this.finishY=n},N.exports=e}),(function(N,I,T){function o(e,t){this.width=0,this.height=0,e!==null&&t!==null&&(this.height=t,this.width=e)}o.prototype.getWidth=function(){return this.width},o.prototype.setWidth=function(e){this.width=e},o.prototype.getHeight=function(){return this.height},o.prototype.setHeight=function(e){this.height=e},N.exports=o}),(function(N,I,T){var o=T(14);function e(){this.map={},this.keys=[]}e.prototype.put=function(t,i){var l=o.createID(t);this.contains(l)||(this.map[l]=i,this.keys.push(t))},e.prototype.contains=function(t){return o.createID(t),this.map[t]!=null},e.prototype.get=function(t){var i=o.createID(t);return this.map[i]},e.prototype.keySet=function(){return this.keys},N.exports=e}),(function(N,I,T){var o=T(14);function e(){this.set={}}e.prototype.add=function(t){var i=o.createID(t);this.contains(i)||(this.set[i]=t)},e.prototype.remove=function(t){delete this.set[o.createID(t)]},e.prototype.clear=function(){this.set={}},e.prototype.contains=function(t){return this.set[o.createID(t)]==t},e.prototype.isEmpty=function(){return this.size()===0},e.prototype.size=function(){return Object.keys(this.set).length},e.prototype.addAllTo=function(t){for(var i=Object.keys(this.set),l=i.length,g=0;g<l;g++)t.push(this.set[i[g]])},e.prototype.size=function(){return Object.keys(this.set).length},e.prototype.addAll=function(t){for(var i=t.length,l=0;l<i;l++){var g=t[l];this.add(g)}},N.exports=e}),(function(N,I,T){var o=(function(){function l(g,n){for(var d=0;d<n.length;d++){var r=n[d];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(g,r.key,r)}}return function(g,n,d){return n&&l(g.prototype,n),d&&l(g,d),g}})();function e(l,g){if(!(l instanceof g))throw new TypeError("Cannot call a class as a function")}var t=T(11),i=(function(){function l(g,n){e(this,l),(n!==null||n!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var d=void 0;g instanceof t?d=g.size():d=g.length,this._quicksort(g,0,d-1)}return o(l,[{key:"_quicksort",value:function(n,d,r){if(d<r){var h=this._partition(n,d,r);this._quicksort(n,d,h),this._quicksort(n,h+1,r)}}},{key:"_partition",value:function(n,d,r){for(var h=this._get(n,d),a=d,p=r;;){for(;this.compareFunction(h,this._get(n,p));)p--;for(;this.compareFunction(this._get(n,a),h);)a++;if(a<p)this._swap(n,a,p),a++,p--;else return p}}},{key:"_get",value:function(n,d){return n instanceof t?n.get_object_at(d):n[d]}},{key:"_set",value:function(n,d,r){n instanceof t?n.set_object_at(d,r):n[d]=r}},{key:"_swap",value:function(n,d,r){var h=this._get(n,d);this._set(n,d,this._get(n,r)),this._set(n,r,h)}},{key:"_defaultCompareFunction",value:function(n,d){return d>n}}]),l})();N.exports=i}),(function(N,I,T){var o=(function(){function i(l,g){for(var n=0;n<g.length;n++){var d=g[n];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(l,d.key,d)}}return function(l,g,n){return g&&i(l.prototype,g),n&&i(l,n),l}})();function e(i,l){if(!(i instanceof l))throw new TypeError("Cannot call a class as a function")}var t=(function(){function i(l,g){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;e(this,i),this.sequence1=l,this.sequence2=g,this.match_score=n,this.mismatch_penalty=d,this.gap_penalty=r,this.iMax=l.length+1,this.jMax=g.length+1,this.grid=new Array(this.iMax);for(var h=0;h<this.iMax;h++){this.grid[h]=new Array(this.jMax);for(var a=0;a<this.jMax;a++)this.grid[h][a]=0}this.tracebackGrid=new Array(this.iMax);for(var p=0;p<this.iMax;p++){this.tracebackGrid[p]=new Array(this.jMax);for(var v=0;v<this.jMax;v++)this.tracebackGrid[p][v]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return o(i,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var g=1;g<this.jMax;g++)this.grid[0][g]=this.grid[0][g-1]+this.gap_penalty,this.tracebackGrid[0][g]=[!1,!1,!0];for(var n=1;n<this.iMax;n++)this.grid[n][0]=this.grid[n-1][0]+this.gap_penalty,this.tracebackGrid[n][0]=[!1,!0,!1];for(var d=1;d<this.iMax;d++)for(var r=1;r<this.jMax;r++){var h=void 0;this.sequence1[d-1]===this.sequence2[r-1]?h=this.grid[d-1][r-1]+this.match_score:h=this.grid[d-1][r-1]+this.mismatch_penalty;var a=this.grid[d-1][r]+this.gap_penalty,p=this.grid[d][r-1]+this.gap_penalty,v=[h,a,p],D=this.arrayAllMaxIndexes(v);this.grid[d][r]=v[D[0]],this.tracebackGrid[d][r]=[D.includes(0),D.includes(1),D.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var g=[];for(g.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});g[0];){var n=g[0],d=this.tracebackGrid[n.pos[0]][n.pos[1]];d[0]&&g.push({pos:[n.pos[0]-1,n.pos[1]-1],seq1:this.sequence1[n.pos[0]-1]+n.seq1,seq2:this.sequence2[n.pos[1]-1]+n.seq2}),d[1]&&g.push({pos:[n.pos[0]-1,n.pos[1]],seq1:this.sequence1[n.pos[0]-1]+n.seq1,seq2:"-"+n.seq2}),d[2]&&g.push({pos:[n.pos[0],n.pos[1]-1],seq1:"-"+n.seq1,seq2:this.sequence2[n.pos[1]-1]+n.seq2}),n.pos[0]===0&&n.pos[1]===0&&this.alignments.push({sequence1:n.seq1,sequence2:n.seq2}),g.shift()}return this.alignments}},{key:"getAllIndexes",value:function(g,n){for(var d=[],r=-1;(r=g.indexOf(n,r+1))!==-1;)d.push(r);return d}},{key:"arrayAllMaxIndexes",value:function(g){return this.getAllIndexes(g,Math.max.apply(null,g))}}]),i})();N.exports=t}),(function(N,I,T){var o=function(){};o.FDLayout=T(18),o.FDLayoutConstants=T(7),o.FDLayoutEdge=T(19),o.FDLayoutNode=T(20),o.DimensionD=T(21),o.HashMap=T(22),o.HashSet=T(23),o.IGeometry=T(8),o.IMath=T(9),o.Integer=T(10),o.Point=T(12),o.PointD=T(4),o.RandomSeed=T(16),o.RectangleD=T(13),o.Transform=T(17),o.UniqueIDGeneretor=T(14),o.Quicksort=T(24),o.LinkedList=T(11),o.LGraphObject=T(2),o.LGraph=T(5),o.LEdge=T(1),o.LGraphManager=T(6),o.LNode=T(3),o.Layout=T(15),o.LayoutConstants=T(0),o.NeedlemanWunsch=T(25),N.exports=o}),(function(N,I,T){function o(){this.listeners=[]}var e=o.prototype;e.addListener=function(t,i){this.listeners.push({event:t,callback:i})},e.removeListener=function(t,i){for(var l=this.listeners.length;l>=0;l--){var g=this.listeners[l];g.event===t&&g.callback===i&&this.listeners.splice(l,1)}},e.emit=function(t,i){for(var l=0;l<this.listeners.length;l++){var g=this.listeners[l];t===g.event&&g.callback(i)}},N.exports=o})])})})(Q)),Q.exports}var ct=Z.exports,z;function pt(){return z||(z=1,(function(G,b){(function(I,T){G.exports=T(ft())})(ct,function(N){return(function(I){var T={};function o(e){if(T[e])return T[e].exports;var t=T[e]={i:e,l:!1,exports:{}};return I[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=I,o.c=T,o.i=function(e){return e},o.d=function(e,t,i){o.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=7)})([(function(I,T){I.exports=N}),(function(I,T,o){var e=o(0).FDLayoutConstants;function t(){}for(var i in e)t[i]=e[i];t.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,t.DEFAULT_RADIAL_SEPARATION=e.DEFAULT_EDGE_LENGTH,t.DEFAULT_COMPONENT_SEPERATION=60,t.TILE=!0,t.TILING_PADDING_VERTICAL=10,t.TILING_PADDING_HORIZONTAL=10,t.TREE_REDUCTION_ON_INCREMENTAL=!1,I.exports=t}),(function(I,T,o){var e=o(0).FDLayoutEdge;function t(l,g,n){e.call(this,l,g,n)}t.prototype=Object.create(e.prototype);for(var i in e)t[i]=e[i];I.exports=t}),(function(I,T,o){var e=o(0).LGraph;function t(l,g,n){e.call(this,l,g,n)}t.prototype=Object.create(e.prototype);for(var i in e)t[i]=e[i];I.exports=t}),(function(I,T,o){var e=o(0).LGraphManager;function t(l){e.call(this,l)}t.prototype=Object.create(e.prototype);for(var i in e)t[i]=e[i];I.exports=t}),(function(I,T,o){var e=o(0).FDLayoutNode,t=o(0).IMath;function i(g,n,d,r){e.call(this,g,n,d,r)}i.prototype=Object.create(e.prototype);for(var l in e)i[l]=e[l];i.prototype.move=function(){var g=this.graphManager.getLayout();this.displacementX=g.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=g.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>g.coolingFactor*g.maxNodeDisplacement&&(this.displacementX=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementX)),Math.abs(this.displacementY)>g.coolingFactor*g.maxNodeDisplacement&&(this.displacementY=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),g.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},i.prototype.propogateDisplacementToChildren=function(g,n){for(var d=this.getChild().getNodes(),r,h=0;h<d.length;h++)r=d[h],r.getChild()==null?(r.moveBy(g,n),r.displacementX+=g,r.displacementY+=n):r.propogateDisplacementToChildren(g,n)},i.prototype.setPred1=function(g){this.pred1=g},i.prototype.getPred1=function(){return pred1},i.prototype.getPred2=function(){return pred2},i.prototype.setNext=function(g){this.next=g},i.prototype.getNext=function(){return next},i.prototype.setProcessed=function(g){this.processed=g},i.prototype.isProcessed=function(){return processed},I.exports=i}),(function(I,T,o){var e=o(0).FDLayout,t=o(4),i=o(3),l=o(5),g=o(2),n=o(1),d=o(0).FDLayoutConstants,r=o(0).LayoutConstants,h=o(0).Point,a=o(0).PointD,p=o(0).Layout,v=o(0).Integer,D=o(0).IGeometry,u=o(0).LGraph,E=o(0).Transform;function y(){e.call(this),this.toBeTiled={}}y.prototype=Object.create(e.prototype);for(var O in e)y[O]=e[O];y.prototype.newGraphManager=function(){var s=new t(this);return this.graphManager=s,s},y.prototype.newGraph=function(s){return new i(null,this.graphManager,s)},y.prototype.newNode=function(s){return new l(this.graphManager,s)},y.prototype.newEdge=function(s){return new g(null,null,s)},y.prototype.initParameters=function(){e.prototype.initParameters.call(this,arguments),this.isSubLayout||(n.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=n.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=n.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=d.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=d.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=d.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=d.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=d.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/d.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=d.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},y.prototype.layout=function(){var s=r.DEFAULT_CREATE_BENDS_AS_NEEDED;return s&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},y.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(n.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var f=new Set(this.getAllNodes()),c=this.nodesWithGravity.filter(function(m){return f.has(m)});this.graphManager.setAllNodesToApplyGravitation(c)}}else{var s=this.getFlatForest();if(s.length>0)this.positionNodesRadially(s);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var f=new Set(this.getAllNodes()),c=this.nodesWithGravity.filter(function(L){return f.has(L)});this.graphManager.setAllNodesToApplyGravitation(c),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},y.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var s=new Set(this.getAllNodes()),f=this.nodesWithGravity.filter(function(A){return s.has(A)});this.graphManager.setAllNodesToApplyGravitation(f),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var c=!this.isTreeGrowing&&!this.isGrowthFinished,L=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(c,L),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},y.prototype.getPositionsData=function(){for(var s=this.graphManager.getAllNodes(),f={},c=0;c<s.length;c++){var L=s[c].rect,A=s[c].id;f[A]={id:A,x:L.getCenterX(),y:L.getCenterY(),w:L.width,h:L.height}}return f},y.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var s=!1;if(d.ANIMATE==="during")this.emit("layoutstarted");else{for(;!s;)s=this.tick();this.graphManager.updateBounds()}},y.prototype.calculateNodesToApplyGravitationTo=function(){var s=[],f,c=this.graphManager.getGraphs(),L=c.length,A;for(A=0;A<L;A++)f=c[A],f.updateConnected(),f.isConnected||(s=s.concat(f.getNodes()));return s},y.prototype.createBendpoints=function(){var s=[];s=s.concat(this.graphManager.getAllEdges());var f=new Set,c;for(c=0;c<s.length;c++){var L=s[c];if(!f.has(L)){var A=L.getSource(),m=L.getTarget();if(A==m)L.getBendpoints().push(new a),L.getBendpoints().push(new a),this.createDummyNodesForBendpoints(L),f.add(L);else{var C=[];if(C=C.concat(A.getEdgeListToNode(m)),C=C.concat(m.getEdgeListToNode(A)),!f.has(C[0])){if(C.length>1){var R;for(R=0;R<C.length;R++){var M=C[R];M.getBendpoints().push(new a),this.createDummyNodesForBendpoints(M)}}C.forEach(function(S){f.add(S)})}}}if(f.size==s.length)break}},y.prototype.positionNodesRadially=function(s){for(var f=new h(0,0),c=Math.ceil(Math.sqrt(s.length)),L=0,A=0,m=0,C=new a(0,0),R=0;R<s.length;R++){R%c==0&&(m=0,A=L,R!=0&&(A+=n.DEFAULT_COMPONENT_SEPERATION),L=0);var M=s[R],S=p.findCenterOfTree(M);f.x=m,f.y=A,C=y.radialLayout(M,S,f),C.y>L&&(L=Math.floor(C.y)),m=Math.floor(C.x+n.DEFAULT_COMPONENT_SEPERATION)}this.transform(new a(r.WORLD_CENTER_X-C.x/2,r.WORLD_CENTER_Y-C.y/2))},y.radialLayout=function(s,f,c){var L=Math.max(this.maxDiagonalInTree(s),n.DEFAULT_RADIAL_SEPARATION);y.branchRadialLayout(f,null,0,359,0,L);var A=u.calculateBounds(s),m=new E;m.setDeviceOrgX(A.getMinX()),m.setDeviceOrgY(A.getMinY()),m.setWorldOrgX(c.x),m.setWorldOrgY(c.y);for(var C=0;C<s.length;C++){var R=s[C];R.transform(m)}var M=new a(A.getMaxX(),A.getMaxY());return m.inverseTransformPoint(M)},y.branchRadialLayout=function(s,f,c,L,A,m){var C=(L-c+1)/2;C<0&&(C+=180);var R=(C+c)%360,M=R*D.TWO_PI/360,S=A*Math.cos(M),Y=A*Math.sin(M);s.setCenter(S,Y);var w=[];w=w.concat(s.getEdges());var x=w.length;f!=null&&x--;for(var F=0,U=w.length,P,_=s.getEdgesBetween(f);_.length>1;){var X=_[0];_.splice(0,1);var H=w.indexOf(X);H>=0&&w.splice(H,1),U--,x--}f!=null?P=(w.indexOf(_[0])+1)%U:P=0;for(var W=Math.abs(L-c)/x,B=P;F!=x;B=++B%U){var K=w[B].getOtherEnd(s);if(K!=f){var q=(c+F*W)%360,ht=(q+W)%360;y.branchRadialLayout(K,s,q,ht,A+m,m),F++}}},y.maxDiagonalInTree=function(s){for(var f=v.MIN_VALUE,c=0;c<s.length;c++){var L=s[c],A=L.getDiagonal();A>f&&(f=A)}return f},y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},y.prototype.groupZeroDegreeMembers=function(){var s=this,f={};this.memberGroups={},this.idToDummyNode={};for(var c=[],L=this.graphManager.getAllNodes(),A=0;A<L.length;A++){var m=L[A],C=m.getParent();this.getNodeDegreeWithChildren(m)===0&&(C.id==null||!this.getToBeTiled(C))&&c.push(m)}for(var A=0;A<c.length;A++){var m=c[A],R=m.getParent().id;typeof f[R]>"u"&&(f[R]=[]),f[R]=f[R].concat(m)}Object.keys(f).forEach(function(M){if(f[M].length>1){var S="DummyCompound_"+M;s.memberGroups[S]=f[M];var Y=f[M][0].getParent(),w=new l(s.graphManager);w.id=S,w.paddingLeft=Y.paddingLeft||0,w.paddingRight=Y.paddingRight||0,w.paddingBottom=Y.paddingBottom||0,w.paddingTop=Y.paddingTop||0,s.idToDummyNode[S]=w;var x=s.getGraphManager().add(s.newGraph(),w),F=Y.getChild();F.add(w);for(var U=0;U<f[M].length;U++){var P=f[M][U];F.remove(P),x.add(P)}}})},y.prototype.clearCompounds=function(){var s={},f={};this.performDFSOnCompounds();for(var c=0;c<this.compoundOrder.length;c++)f[this.compoundOrder[c].id]=this.compoundOrder[c],s[this.compoundOrder[c].id]=[].concat(this.compoundOrder[c].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[c].getChild()),this.compoundOrder[c].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(s,f)},y.prototype.clearZeroDegreeMembers=function(){var s=this,f=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(c){var L=s.idToDummyNode[c];f[c]=s.tileNodes(s.memberGroups[c],L.paddingLeft+L.paddingRight),L.rect.width=f[c].width,L.rect.height=f[c].height})},y.prototype.repopulateCompounds=function(){for(var s=this.compoundOrder.length-1;s>=0;s--){var f=this.compoundOrder[s],c=f.id,L=f.paddingLeft,A=f.paddingTop;this.adjustLocations(this.tiledMemberPack[c],f.rect.x,f.rect.y,L,A)}},y.prototype.repopulateZeroDegreeMembers=function(){var s=this,f=this.tiledZeroDegreePack;Object.keys(f).forEach(function(c){var L=s.idToDummyNode[c],A=L.paddingLeft,m=L.paddingTop;s.adjustLocations(f[c],L.rect.x,L.rect.y,A,m)})},y.prototype.getToBeTiled=function(s){var f=s.id;if(this.toBeTiled[f]!=null)return this.toBeTiled[f];var c=s.getChild();if(c==null)return this.toBeTiled[f]=!1,!1;for(var L=c.getNodes(),A=0;A<L.length;A++){var m=L[A];if(this.getNodeDegree(m)>0)return this.toBeTiled[f]=!1,!1;if(m.getChild()==null){this.toBeTiled[m.id]=!1;continue}if(!this.getToBeTiled(m))return this.toBeTiled[f]=!1,!1}return this.toBeTiled[f]=!0,!0},y.prototype.getNodeDegree=function(s){s.id;for(var f=s.getEdges(),c=0,L=0;L<f.length;L++){var A=f[L];A.getSource().id!==A.getTarget().id&&(c=c+1)}return c},y.prototype.getNodeDegreeWithChildren=function(s){var f=this.getNodeDegree(s);if(s.getChild()==null)return f;for(var c=s.getChild().getNodes(),L=0;L<c.length;L++){var A=c[L];f+=this.getNodeDegreeWithChildren(A)}return f},y.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},y.prototype.fillCompexOrderByDFS=function(s){for(var f=0;f<s.length;f++){var c=s[f];c.getChild()!=null&&this.fillCompexOrderByDFS(c.getChild().getNodes()),this.getToBeTiled(c)&&this.compoundOrder.push(c)}},y.prototype.adjustLocations=function(s,f,c,L,A){f+=L,c+=A;for(var m=f,C=0;C<s.rows.length;C++){var R=s.rows[C];f=m;for(var M=0,S=0;S<R.length;S++){var Y=R[S];Y.rect.x=f,Y.rect.y=c,f+=Y.rect.width+s.horizontalPadding,Y.rect.height>M&&(M=Y.rect.height)}c+=M+s.verticalPadding}},y.prototype.tileCompoundMembers=function(s,f){var c=this;this.tiledMemberPack=[],Object.keys(s).forEach(function(L){var A=f[L];c.tiledMemberPack[L]=c.tileNodes(s[L],A.paddingLeft+A.paddingRight),A.rect.width=c.tiledMemberPack[L].width,A.rect.height=c.tiledMemberPack[L].height})},y.prototype.tileNodes=function(s,f){var c=n.TILING_PADDING_VERTICAL,L=n.TILING_PADDING_HORIZONTAL,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:f,verticalPadding:c,horizontalPadding:L};s.sort(function(R,M){return R.rect.width*R.rect.height>M.rect.width*M.rect.height?-1:R.rect.width*R.rect.height<M.rect.width*M.rect.height?1:0});for(var m=0;m<s.length;m++){var C=s[m];A.rows.length==0?this.insertNodeToRow(A,C,0,f):this.canAddHorizontal(A,C.rect.width,C.rect.height)?this.insertNodeToRow(A,C,this.getShortestRowIndex(A),f):this.insertNodeToRow(A,C,A.rows.length,f),this.shiftToLastRow(A)}return A},y.prototype.insertNodeToRow=function(s,f,c,L){var A=L;if(c==s.rows.length){var m=[];s.rows.push(m),s.rowWidth.push(A),s.rowHeight.push(0)}var C=s.rowWidth[c]+f.rect.width;s.rows[c].length>0&&(C+=s.horizontalPadding),s.rowWidth[c]=C,s.width<C&&(s.width=C);var R=f.rect.height;c>0&&(R+=s.verticalPadding);var M=0;R>s.rowHeight[c]&&(M=s.rowHeight[c],s.rowHeight[c]=R,M=s.rowHeight[c]-M),s.height+=M,s.rows[c].push(f)},y.prototype.getShortestRowIndex=function(s){for(var f=-1,c=Number.MAX_VALUE,L=0;L<s.rows.length;L++)s.rowWidth[L]<c&&(f=L,c=s.rowWidth[L]);return f},y.prototype.getLongestRowIndex=function(s){for(var f=-1,c=Number.MIN_VALUE,L=0;L<s.rows.length;L++)s.rowWidth[L]>c&&(f=L,c=s.rowWidth[L]);return f},y.prototype.canAddHorizontal=function(s,f,c){var L=this.getShortestRowIndex(s);if(L<0)return!0;var A=s.rowWidth[L];if(A+s.horizontalPadding+f<=s.width)return!0;var m=0;s.rowHeight[L]<c&&L>0&&(m=c+s.verticalPadding-s.rowHeight[L]);var C;s.width-A>=f+s.horizontalPadding?C=(s.height+m)/(A+f+s.horizontalPadding):C=(s.height+m)/s.width,m=c+s.verticalPadding;var R;return s.width<f?R=(s.height+m)/f:R=(s.height+m)/s.width,R<1&&(R=1/R),C<1&&(C=1/C),C<R},y.prototype.shiftToLastRow=function(s){var f=this.getLongestRowIndex(s),c=s.rowWidth.length-1,L=s.rows[f],A=L[L.length-1],m=A.width+s.horizontalPadding;if(s.width-s.rowWidth[c]>m&&f!=c){L.splice(-1,1),s.rows[c].push(A),s.rowWidth[f]=s.rowWidth[f]-m,s.rowWidth[c]=s.rowWidth[c]+m,s.width=s.rowWidth[instance.getLongestRowIndex(s)];for(var C=Number.MIN_VALUE,R=0;R<L.length;R++)L[R].height>C&&(C=L[R].height);f>0&&(C+=s.verticalPadding);var M=s.rowHeight[f]+s.rowHeight[c];s.rowHeight[f]=C,s.rowHeight[c]<A.height+s.verticalPadding&&(s.rowHeight[c]=A.height+s.verticalPadding);var S=s.rowHeight[f]+s.rowHeight[c];s.height+=S-M,this.shiftToLastRow(s)}},y.prototype.tilingPreLayout=function(){n.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},y.prototype.tilingPostLayout=function(){n.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},y.prototype.reduceTrees=function(){for(var s=[],f=!0,c;f;){var L=this.graphManager.getAllNodes(),A=[];f=!1;for(var m=0;m<L.length;m++)c=L[m],c.getEdges().length==1&&!c.getEdges()[0].isInterGraph&&c.getChild()==null&&(A.push([c,c.getEdges()[0],c.getOwner()]),f=!0);if(f==!0){for(var C=[],R=0;R<A.length;R++)A[R][0].getEdges().length==1&&(C.push(A[R]),A[R][0].getOwner().remove(A[R][0]));s.push(C),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=s},y.prototype.growTree=function(s){for(var f=s.length,c=s[f-1],L,A=0;A<c.length;A++)L=c[A],this.findPlaceforPrunedNode(L),L[2].add(L[0]),L[2].add(L[1],L[1].source,L[1].target);s.splice(s.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},y.prototype.findPlaceforPrunedNode=function(s){var f,c,L=s[0];L==s[1].source?c=s[1].target:c=s[1].source;var A=c.startX,m=c.finishX,C=c.startY,R=c.finishY,M=0,S=0,Y=0,w=0,x=[M,Y,S,w];if(C>0)for(var F=A;F<=m;F++)x[0]+=this.grid[F][C-1].length+this.grid[F][C].length-1;if(m<this.grid.length-1)for(var F=C;F<=R;F++)x[1]+=this.grid[m+1][F].length+this.grid[m][F].length-1;if(R<this.grid[0].length-1)for(var F=A;F<=m;F++)x[2]+=this.grid[F][R+1].length+this.grid[F][R].length-1;if(A>0)for(var F=C;F<=R;F++)x[3]+=this.grid[A-1][F].length+this.grid[A][F].length-1;for(var U=v.MAX_VALUE,P,_,X=0;X<x.length;X++)x[X]<U?(U=x[X],P=1,_=X):x[X]==U&&P++;if(P==3&&U==0)x[0]==0&&x[1]==0&&x[2]==0?f=1:x[0]==0&&x[1]==0&&x[3]==0?f=0:x[0]==0&&x[2]==0&&x[3]==0?f=3:x[1]==0&&x[2]==0&&x[3]==0&&(f=2);else if(P==2&&U==0){var H=Math.floor(Math.random()*2);x[0]==0&&x[1]==0?H==0?f=0:f=1:x[0]==0&&x[2]==0?H==0?f=0:f=2:x[0]==0&&x[3]==0?H==0?f=0:f=3:x[1]==0&&x[2]==0?H==0?f=1:f=2:x[1]==0&&x[3]==0?H==0?f=1:f=3:H==0?f=2:f=3}else if(P==4&&U==0){var H=Math.floor(Math.random()*4);f=H}else f=_;f==0?L.setCenter(c.getCenterX(),c.getCenterY()-c.getHeight()/2-d.DEFAULT_EDGE_LENGTH-L.getHeight()/2):f==1?L.setCenter(c.getCenterX()+c.getWidth()/2+d.DEFAULT_EDGE_LENGTH+L.getWidth()/2,c.getCenterY()):f==2?L.setCenter(c.getCenterX(),c.getCenterY()+c.getHeight()/2+d.DEFAULT_EDGE_LENGTH+L.getHeight()/2):L.setCenter(c.getCenterX()-c.getWidth()/2-d.DEFAULT_EDGE_LENGTH-L.getWidth()/2,c.getCenterY())},I.exports=y}),(function(I,T,o){var e={};e.layoutBase=o(0),e.CoSEConstants=o(1),e.CoSEEdge=o(2),e.CoSEGraph=o(3),e.CoSEGraphManager=o(4),e.CoSELayout=o(6),e.CoSENode=o(5),I.exports=e})])})})(Z)),Z.exports}var dt=k.exports,J;function vt(){return J||(J=1,(function(G,b){(function(I,T){G.exports=T(pt())})(dt,function(N){return(function(I){var T={};function o(e){if(T[e])return T[e].exports;var t=T[e]={i:e,l:!1,exports:{}};return I[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=I,o.c=T,o.i=function(e){return e},o.d=function(e,t,i){o.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=1)})([(function(I,T){I.exports=N}),(function(I,T,o){var e=o(0).layoutBase.LayoutConstants,t=o(0).layoutBase.FDLayoutConstants,i=o(0).CoSEConstants,l=o(0).CoSELayout,g=o(0).CoSENode,n=o(0).layoutBase.PointD,d=o(0).layoutBase.DimensionD,r={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function h(D,u){var E={};for(var y in D)E[y]=D[y];for(var y in u)E[y]=u[y];return E}function a(D){this.options=h(r,D),p(this.options)}var p=function(u){u.nodeRepulsion!=null&&(i.DEFAULT_REPULSION_STRENGTH=t.DEFAULT_REPULSION_STRENGTH=u.nodeRepulsion),u.idealEdgeLength!=null&&(i.DEFAULT_EDGE_LENGTH=t.DEFAULT_EDGE_LENGTH=u.idealEdgeLength),u.edgeElasticity!=null&&(i.DEFAULT_SPRING_STRENGTH=t.DEFAULT_SPRING_STRENGTH=u.edgeElasticity),u.nestingFactor!=null&&(i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=t.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=u.nestingFactor),u.gravity!=null&&(i.DEFAULT_GRAVITY_STRENGTH=t.DEFAULT_GRAVITY_STRENGTH=u.gravity),u.numIter!=null&&(i.MAX_ITERATIONS=t.MAX_ITERATIONS=u.numIter),u.gravityRange!=null&&(i.DEFAULT_GRAVITY_RANGE_FACTOR=t.DEFAULT_GRAVITY_RANGE_FACTOR=u.gravityRange),u.gravityCompound!=null&&(i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=t.DEFAULT_COMPOUND_GRAVITY_STRENGTH=u.gravityCompound),u.gravityRangeCompound!=null&&(i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=t.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=u.gravityRangeCompound),u.initialEnergyOnIncremental!=null&&(i.DEFAULT_COOLING_FACTOR_INCREMENTAL=t.DEFAULT_COOLING_FACTOR_INCREMENTAL=u.initialEnergyOnIncremental),u.quality=="draft"?e.QUALITY=0:u.quality=="proof"?e.QUALITY=2:e.QUALITY=1,i.NODE_DIMENSIONS_INCLUDE_LABELS=t.NODE_DIMENSIONS_INCLUDE_LABELS=e.NODE_DIMENSIONS_INCLUDE_LABELS=u.nodeDimensionsIncludeLabels,i.DEFAULT_INCREMENTAL=t.DEFAULT_INCREMENTAL=e.DEFAULT_INCREMENTAL=!u.randomize,i.ANIMATE=t.ANIMATE=e.ANIMATE=u.animate,i.TILE=u.tile,i.TILING_PADDING_VERTICAL=typeof u.tilingPaddingVertical=="function"?u.tilingPaddingVertical.call():u.tilingPaddingVertical,i.TILING_PADDING_HORIZONTAL=typeof u.tilingPaddingHorizontal=="function"?u.tilingPaddingHorizontal.call():u.tilingPaddingHorizontal};a.prototype.run=function(){var D,u,E=this.options;this.idToLNode={};var y=this.layout=new l,O=this;O.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var s=y.newGraphManager();this.gm=s;var f=this.options.eles.nodes(),c=this.options.eles.edges();this.root=s.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(f),y);for(var L=0;L<c.length;L++){var A=c[L],m=this.idToLNode[A.data("source")],C=this.idToLNode[A.data("target")];if(m!==C&&m.getEdgesBetween(C).length==0){var R=s.add(y.newEdge(),m,C);R.id=A.id()}}var M=function(w,x){typeof w=="number"&&(w=x);var F=w.data("id"),U=O.idToLNode[F];return{x:U.getRect().getCenterX(),y:U.getRect().getCenterY()}},S=function Y(){for(var w=function(){E.fit&&E.cy.fit(E.eles,E.padding),D||(D=!0,O.cy.one("layoutready",E.ready),O.cy.trigger({type:"layoutready",layout:O}))},x=O.options.refresh,F,U=0;U<x&&!F;U++)F=O.stopped||O.layout.tick();if(F){y.checkLayoutSuccess()&&!y.isSubLayout&&y.doPostLayout(),y.tilingPostLayout&&y.tilingPostLayout(),y.isLayoutFinished=!0,O.options.eles.nodes().positions(M),w(),O.cy.one("layoutstop",O.options.stop),O.cy.trigger({type:"layoutstop",layout:O}),u&&cancelAnimationFrame(u),D=!1;return}var P=O.layout.getPositionsData();E.eles.nodes().positions(function(_,X){if(typeof _=="number"&&(_=X),!_.isParent()){for(var H=_.id(),W=P[H],B=_;W==null&&(W=P[B.data("parent")]||P["DummyCompound_"+B.data("parent")],P[H]=W,B=B.parent()[0],B!=null););return W!=null?{x:W.x,y:W.y}:{x:_.position("x"),y:_.position("y")}}}),w(),u=requestAnimationFrame(Y)};return y.addListener("layoutstarted",function(){O.options.animate==="during"&&(u=requestAnimationFrame(S))}),y.runLayout(),this.options.animate!=="during"&&(O.options.eles.nodes().not(":parent").layoutPositions(O,O.options,M),D=!1),this},a.prototype.getTopMostNodes=function(D){for(var u={},E=0;E<D.length;E++)u[D[E].id()]=!0;var y=D.filter(function(O,s){typeof O=="number"&&(O=s);for(var f=O.parent()[0];f!=null;){if(u[f.id()])return!1;f=f.parent()[0]}return!0});return y},a.prototype.processChildrenList=function(D,u,E){for(var y=u.length,O=0;O<y;O++){var s=u[O],f=s.children(),c,L=s.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if(s.outerWidth()!=null&&s.outerHeight()!=null?c=D.add(new g(E.graphManager,new n(s.position("x")-L.w/2,s.position("y")-L.h/2),new d(parseFloat(L.w),parseFloat(L.h)))):c=D.add(new g(this.graphManager)),c.id=s.data("id"),c.paddingLeft=parseInt(s.css("padding")),c.paddingTop=parseInt(s.css("padding")),c.paddingRight=parseInt(s.css("padding")),c.paddingBottom=parseInt(s.css("padding")),this.options.nodeDimensionsIncludeLabels&&s.isParent()){var A=s.boundingBox({includeLabels:!0,includeNodes:!1}).w,m=s.boundingBox({includeLabels:!0,includeNodes:!1}).h,C=s.css("text-halign");c.labelWidth=A,c.labelHeight=m,c.labelPos=C}if(this.idToLNode[s.data("id")]=c,isNaN(c.rect.x)&&(c.rect.x=0),isNaN(c.rect.y)&&(c.rect.y=0),f!=null&&f.length>0){var R;R=E.getGraphManager().add(E.newGraph(),c),this.processChildrenList(R,f,E)}}},a.prototype.stop=function(){return this.stopped=!0,this};var v=function(u){u("layout","cose-bilkent",a)};typeof cytoscape<"u"&&v(cytoscape),I.exports=v})])})})(k)),k.exports}var yt=vt();const Et=lt(yt);tt.use(Et);function et(G,b){G.forEach(N=>{const I={id:N.id,labelText:N.label,height:N.height,width:N.width,padding:N.padding??0};Object.keys(N).forEach(T=>{["id","label","height","width","padding","x","y"].includes(T)||(I[T]=N[T])}),b.add({group:"nodes",data:I,position:{x:N.x??0,y:N.y??0}})})}V(et,"addNodes");function rt(G,b){G.forEach(N=>{const I={id:N.id,source:N.start,target:N.end};Object.keys(N).forEach(T=>{["id","start","end"].includes(T)||(I[T]=N[T])}),b.add({group:"edges",data:I})})}V(rt,"addEdges");function it(G){return new Promise(b=>{const N=gt("body").append("div").attr("id","cy").attr("style","display:none"),I=tt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});N.remove(),et(G.nodes,I),rt(G.edges,I),I.nodes().forEach(function(o){o.layoutDimensions=()=>{const e=o.data();return{w:e.width,h:e.height}}});const T={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};I.layout(T).run(),I.ready(o=>{$.info("Cytoscape ready",o),b(I)})})}V(it,"createCytoscapeInstance");function nt(G){return G.nodes().map(b=>{const N=b.data(),I=b.position(),T={id:N.id,x:I.x,y:I.y};return Object.keys(N).forEach(o=>{o!=="id"&&(T[o]=N[o])}),T})}V(nt,"extractPositionedNodes");function ot(G){return G.edges().map(b=>{const N=b.data(),I=b._private.rscratch,T={id:N.id,source:N.source,target:N.target,startX:I.startX,startY:I.startY,midX:I.midX,midY:I.midY,endX:I.endX,endY:I.endY};return Object.keys(N).forEach(o=>{["id","source","target"].includes(o)||(T[o]=N[o])}),T})}V(ot,"extractPositionedEdges");async function st(G,b){$.debug("Starting cose-bilkent layout algorithm");try{at(G);const N=await it(G),I=nt(N),T=ot(N);return $.debug(`Layout completed: ${I.length} nodes, ${T.length} edges`),{nodes:I,edges:T}}catch(N){throw $.error("Error in cose-bilkent layout algorithm:",N),N}}V(st,"executeCoseBilkentLayout");function at(G){if(!G)throw new Error("Layout data is required");if(!G.config)throw new Error("Configuration is required in layout data");if(!G.rootNode)throw new Error("Root node is required");if(!G.nodes||!Array.isArray(G.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(G.edges))throw new Error("Edges array is required in layout data");return!0}V(at,"validateLayoutData");var Lt=V(async(G,b,{insertCluster:N,insertEdge:I,insertEdgeLabel:T,insertMarkers:o,insertNode:e,log:t,positionEdgeLabel:i},{algorithm:l})=>{const g={},n={},d=b.select("g");o(d,G.markers,G.type,G.diagramId);const r=d.insert("g").attr("class","subgraphs"),h=d.insert("g").attr("class","edgePaths"),a=d.insert("g").attr("class","edgeLabels"),p=d.insert("g").attr("class","nodes");t.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(G.nodes.map(async u=>{if(u.isGroup){const E={...u};n[u.id]=E,g[u.id]=E,await N(r,u)}else{const E={...u};g[u.id]=E;const y=await e(p,u,{config:G.config,dir:G.direction||"TB"}),O=y.node().getBBox();E.width=O.width,E.height=O.height,E.domId=y,t.debug(`Node ${u.id} dimensions: ${O.width}x${O.height}`)}})),t.debug("Running cose-bilkent layout algorithm");const v={...G,nodes:G.nodes.map(u=>{const E=g[u.id];return{...u,width:E.width,height:E.height}})},D=await st(v,G.config);t.debug("Positioning nodes based on layout results"),D.nodes.forEach(u=>{const E=g[u.id];E!=null&&E.domId&&(E.domId.attr("transform",`translate(${u.x}, ${u.y})`),E.x=u.x,E.y=u.y,t.debug(`Positioned node ${E.id} at center (${u.x}, ${u.y})`))}),D.edges.forEach(u=>{const E=G.edges.find(y=>y.id===u.id);E&&(E.points=[{x:u.startX,y:u.startY},{x:u.midX,y:u.midY},{x:u.endX,y:u.endY}])}),t.debug("Inserting and positioning edges"),await Promise.all(G.edges.map(async u=>{await T(a,u);const E=g[u.start??""],y=g[u.end??""];if(E&&y){const O=D.edges.find(s=>s.id===u.id);if(O){t.debug("APA01 positionedEdge",O);const s={...u},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}else{const s={...u,points:[{x:E.x||0,y:E.y||0},{x:y.x||0,y:y.y||0}]},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}}})),t.debug("Cose-bilkent rendering completed")},"render"),At=Lt;export{At as render};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Is cytoscapenode/edge_private(specifically_private.rscratch) considered a stable public API for retrieving edge geometry in current Cytoscape.js versions?

💡 Result:

No, the _private property and its sub-properties, including _private.rscratch, are not considered a stable public API in Cytoscape.js [1][2]. In Cytoscape.js, the _private object is an internal data structure used by the library to manage element state, rendering information, and internal cache [3][4]. Properties prefixed with an underscore are conventionally private in JavaScript and, specifically within the Cytoscape.js codebase, are intended for internal use only [1][2]. Key points regarding _private.rscratch: - Internal Nature: The rscratch (renderer scratch) object is used by the renderer to store transient, calculated values—such as geometry, layout-specific data, or rendering error states—that are necessary for drawing elements [3][5][1]. - Lack of Stability: Because these properties are internal, they are subject to change, renaming, or removal without notice in any future version of the library [1][2]. Relying on them creates brittle code that is likely to break during library updates [1]. - Community Guidance: The Cytoscape.js maintainers and community consistently advise against accessing _private properties [1][2]. When developers have requested access to information stored there (such as label bounds or rendering errors), the recommended approach is to use or request a formal, supported public API method [1][2]. If you need to retrieve edge geometry or other rendering-related information, you should check the official Cytoscape.js documentation for supported methods (e.g., those available on the collection object) or open a feature request on the project's GitHub repository if the required functionality is not currently exposed via a public API [1][2].

Citations:


Avoid relying on Cytoscape private internals (_private.rscratch) for edge geometry.

extractPositionedEdges reads b._private.rscratch to access edge layout geometry. This is internal API not intended for external use and is subject to change without notice in any Cytoscape version. The maintainers explicitly advise against accessing _private properties and recommend using supported public API methods instead. Consider pinning a specific Cytoscape version or requesting a public API method that exposes edge geometry through documented interfaces.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lab/platform/assets/cose-bilkent-S5V4N54A-CJPxbiqc.js` at line 1,
extractPositionedEdges is reading Cytoscape internals via b._private.rscratch
(private API) which is brittle; replace that access by using supported public
APIs or the layout output instead: stop touching _private.rscratch in
extractPositionedEdges and obtain edge geometry from the
createCytoscapeInstance/it → ot layout output (the edge geometry produced by the
layout), or call Cytoscape public methods (e.g. public edge
geometry/control-point APIs provided by your Cytoscape version) to get
start/mid/end coordinates; update calls in st/it to pass the layout-provided
edge geometry through so extractPositionedEdges and downstream code
(extractPositionedEdges, it/createCytoscapeInstance, ot, st) consume only
public, stable data.

@@ -0,0 +1,4 @@
import{_ as X,aw as F,ax as Y,ay as _,az as H,l as i,c as V,aA as z,aB as U,an as $,as as q,ao as P,am as K,aC as Q,aD as W,aE as Z}from"./index-Thzn6MGJ.js";import{i as x,G as B}from"./graph-CegXrlrm.js";import{l as I}from"./layout-iIBNTqio.js";import{c as L}from"./clone-HkO5ylrb.js";import{m as A}from"./min-PctrvoVu.js";import"./_baseUniq-BZHRInkB.js";function p(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:ee(e),edges:ne(e)};return x(e.graph())||(t.value=L(e.graph())),t}function ee(e){return A(e.nodes(),function(t){var n=e.node(t),o=e.parent(t),c={v:t};return x(n)||(c.value=n),x(o)||(c.parent=o),c})}function ne(e){return A(e.edges(),function(t){var n=e.edge(t),o={v:t.v,w:t.w};return x(t.name)||(o.name=t.name),x(n)||(o.value=n),o})}var f=new Map,b=new Map,J=new Map,te=X(()=>{b.clear(),J.clear(),f.clear()},"clear"),O=X((e,t)=>{const n=b.get(t)||[];return i.trace("In isDescendant",t," ",e," = ",n.includes(e)),n.includes(e)},"isDescendant"),se=X((e,t)=>{const n=b.get(t)||[];return i.info("Descendants of ",t," is ",n),i.info("Edge is ",e),e.v===t||e.w===t?!1:n?n.includes(e.v)||O(e.v,t)||O(e.w,t)||n.includes(e.w):(i.debug("Tilt, ",t,",not in descendants"),!1)},"edgeInCluster"),G=X((e,t,n,o)=>{i.warn("Copying children of ",e,"root",o,"data",t.node(e),o);const c=t.children(e)||[];e!==o&&c.push(e),i.warn("Copying (nodes) clusterId",e,"nodes",c),c.forEach(a=>{if(t.children(a).length>0)G(a,t,n,o);else{const r=t.node(a);i.info("cp ",a," to ",o," with parent ",e),n.setNode(a,r),o!==t.parent(a)&&(i.warn("Setting parent",a,t.parent(a)),n.setParent(a,t.parent(a))),e!==o&&a!==e?(i.debug("Setting parent",a,e),n.setParent(a,e)):(i.info("In copy ",e,"root",o,"data",t.node(e),o),i.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==o,"node!==clusterId",a!==e));const u=t.edges(a);i.debug("Copying Edges",u),u.forEach(l=>{i.info("Edge",l);const v=t.edge(l.v,l.w,l.name);i.info("Edge data",v,o);try{se(l,o)?(i.info("Copying as ",l.v,l.w,v,l.name),n.setEdge(l.v,l.w,v,l.name),i.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]))):i.info("Skipping copy of edge ",l.v,"-->",l.w," rootId: ",o," clusterId:",e)}catch(C){i.error(C)}})}i.debug("Removing node",a),t.removeNode(a)})},"copy"),R=X((e,t)=>{const n=t.children(e);let o=[...n];for(const c of n)J.set(c,e),o=[...o,...R(c,t)];return o},"extractDescendants"),ie=X((e,t,n)=>{const o=e.edges().filter(l=>l.v===t||l.w===t),c=e.edges().filter(l=>l.v===n||l.w===n),a=o.map(l=>({v:l.v===t?n:l.v,w:l.w===t?t:l.w})),r=c.map(l=>({v:l.v,w:l.w}));return a.filter(l=>r.some(v=>l.v===v.v&&l.w===v.w))},"findCommonEdges"),D=X((e,t,n)=>{const o=t.children(e);if(i.trace("Searching children of id ",e,o),o.length<1)return e;let c;for(const a of o){const r=D(a,t,n),u=ie(t,n,r);if(r)if(u.length>0)c=r;else return r}return c},"findNonClusterChild"),k=X(e=>!f.has(e)||!f.get(e).externalConnections?e:f.has(e)?f.get(e).id:e,"getAnchorId"),re=X((e,t)=>{if(!e||t>10){i.debug("Opting out, no graph ");return}else i.debug("Opting in, graph ");e.nodes().forEach(function(n){e.children(n).length>0&&(i.warn("Cluster identified",n," Replacement id in edges: ",D(n,e,n)),b.set(n,R(n,e)),f.set(n,{id:D(n,e,n),clusterData:e.node(n)}))}),e.nodes().forEach(function(n){const o=e.children(n),c=e.edges();o.length>0?(i.debug("Cluster identified",n,b),c.forEach(a=>{const r=O(a.v,n),u=O(a.w,n);r^u&&(i.warn("Edge: ",a," leaves cluster ",n),i.warn("Descendants of XXX ",n,": ",b.get(n)),f.get(n).externalConnections=!0)})):i.debug("Not a cluster ",n,b)});for(let n of f.keys()){const o=f.get(n).id,c=e.parent(o);c!==n&&f.has(c)&&!f.get(c).externalConnections&&(f.get(n).id=c)}e.edges().forEach(function(n){const o=e.edge(n);i.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),i.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(e.edge(n)));let c=n.v,a=n.w;if(i.warn("Fix XXX",f,"ids:",n.v,n.w,"Translating: ",f.get(n.v)," --- ",f.get(n.w)),f.get(n.v)||f.get(n.w)){if(i.warn("Fixing and trying - removing XXX",n.v,n.w,n.name),c=k(n.v),a=k(n.w),e.removeEdge(n.v,n.w,n.name),c!==n.v){const r=e.parent(c);f.get(r).externalConnections=!0,o.fromCluster=n.v}if(a!==n.w){const r=e.parent(a);f.get(r).externalConnections=!0,o.toCluster=n.w}i.warn("Fix Replacing with XXX",c,a,n.name),e.setEdge(c,a,o,n.name)}}),i.warn("Adjusted Graph",p(e)),T(e,0),i.trace(f)},"adjustClustersAndEdges"),T=X((e,t)=>{var c,a;if(i.warn("extractor - ",t,p(e),e.children("D")),t>10){i.error("Bailing out");return}let n=e.nodes(),o=!1;for(const r of n){const u=e.children(r);o=o||u.length>0}if(!o){i.debug("Done, no node has children",e.nodes());return}i.debug("Nodes = ",n,t);for(const r of n)if(i.debug("Extracting node",r,f,f.has(r)&&!f.get(r).externalConnections,!e.parent(r),e.node(r),e.children("D")," Depth ",t),!f.has(r))i.debug("Not a cluster",r,t);else if(!f.get(r).externalConnections&&e.children(r)&&e.children(r).length>0){i.warn("Cluster without external connections, without a parent and with children",r,t);let l=e.graph().rankdir==="TB"?"LR":"TB";(a=(c=f.get(r))==null?void 0:c.clusterData)!=null&&a.dir&&(l=f.get(r).clusterData.dir,i.warn("Fixing dir",f.get(r).clusterData.dir,l));const v=new B({multigraph:!0,compound:!0}).setGraph({rankdir:l,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});i.warn("Old graph before copy",p(e)),G(r,e,v,r),e.setNode(r,{clusterNode:!0,id:r,clusterData:f.get(r).clusterData,label:f.get(r).label,graph:v}),i.warn("New graph after copy node: (",r,")",p(v)),i.debug("Old graph after copy",p(e))}else i.warn("Cluster ** ",r," **not meeting the criteria !externalConnections:",!f.get(r).externalConnections," no parent: ",!e.parent(r)," children ",e.children(r)&&e.children(r).length>0,e.children("D"),t),i.debug(f);n=e.nodes(),i.warn("New list of nodes",n);for(const r of n){const u=e.node(r);i.warn(" Now next level",r,u),u!=null&&u.clusterNode&&T(u.graph,t+1)}},"extractor"),M=X((e,t)=>{if(t.length===0)return[];let n=Object.assign([],t);return t.forEach(o=>{const c=e.children(o),a=M(e,c);n=[...n,...a]}),n},"sorter"),oe=X(e=>M(e,e.children()),"sortNodesByHierarchy"),j=X(async(e,t,n,o,c,a)=>{i.warn("Graph in recursive render:XAX",p(t),c);const r=t.graph().rankdir;i.trace("Dir in recursive render - dir:",r);const u=e.insert("g").attr("class","root");t.nodes()?i.info("Recursive render XXX",t.nodes()):i.info("No nodes found for",t),t.edges().length>0&&i.info("Recursive edges",t.edge(t.edges()[0]));const l=u.insert("g").attr("class","clusters"),v=u.insert("g").attr("class","edgePaths"),C=u.insert("g").attr("class","edgeLabels"),g=u.insert("g").attr("class","nodes");await Promise.all(t.nodes().map(async function(d){const s=t.node(d);if(c!==void 0){const w=JSON.parse(JSON.stringify(c.clusterData));i.trace(`Setting data for parent cluster XXX
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix malformed cyclic edge id string.

m.id=h+"-cyc<lic-special-2" appears to contain a typo (<). This can cause inconsistent edge IDs versus the other cyclic IDs and break downstream ID-based handling.

Suggested fix
- m.id=h+"-cyc<lic-special-2"
+ m.id=h+"-cyclic-special-2"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lab/platform/assets/dagre-6UL2VRFP-oyfIpHO7.js` at line 1, The cyclic edge ID
contains a typo: m.id = h+"-cyc<lic-special-2" — update the string concatenation
for the symbol m.id (where h is the prefix) to remove the stray '<' and use a
consistent token such as "-cyclic-special-2" so generated edge IDs match other
cyclic IDs and downstream ID-based logic (search for the assignment to m.id near
the cyclic-edge handling code in the j function/rendering logic).

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 152 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="lab/platform/manifest.json">

<violation number="1" location="lab/platform/manifest.json:1">
P2: File named `manifest.json` contains HTML instead of JSON content, identical to `index.html`</violation>
</file>

Note: This PR contains a large number of files. cubic only reviews up to 100 files per PR, so some files may not have been reviewed. cubic prioritizes the most important files to review.
On a pro plan you can use ultrareview for larger PRs.
Re-trigger cubic

@@ -0,0 +1,17 @@
<!DOCTYPE html>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: File named manifest.json contains HTML instead of JSON content, identical to index.html

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At lab/platform/manifest.json, line 1:

<comment>File named `manifest.json` contains HTML instead of JSON content, identical to `index.html`</comment>

<file context>
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="en">
+
</file context>

@Abdullakala Abdullakala closed this by deleting the head repository May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants