{post.title}
++ ID: {post.id} | Slug: {post.slug} |{" "} + {post.published ? "已发布" : "草稿"} +
+diff --git a/.gitignore b/.gitignore index 538af3f..aeed9c9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +dist/ node_modules/ .wrangler/ .dev.vars diff --git a/README.md b/README.md index 4f46c0e..d9c428e 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,59 @@ # SproutBlog -Cloudflare Worker + D1 的极简博客。 +Cloudflare Worker + D1 + 静态资源(Vite/React SPA)。Worker **仅处理 `/api/*`**,前端构建产物输出到 `dist/`,由 `[assets]` 提供;`wrangler deploy` 一次部署 API + 前端。 ## 功能 -- 公共博客页 -- Markdown 渲染 -- 简单后台 CRUD -- 手机和电脑自适应 +- 公共博客(React + React Router) +- Markdown(marked + KaTeX + highlight.js + Mermaid,按需动态加载) +- 简单后台 CRUD(Cookie / Basic Auth 与原先一致) +- 评论(cwd-widget) +- 手机与桌面适配(沿用原样式) ## 初始化 -1. 创建 D1 数据库: - `wrangler d1 create sproutblog` -2. 把生成的 `database_id` 填到 `wrangler.toml` -3. 应用迁移: - `wrangler d1 migrations apply sproutblog --remote` -4. 本地运行: - `npm run dev` +1. 创建 D1:`wrangler d1 create sproutblog`,把 `database_id` 写入 `wrangler.toml`。 +2. 应用迁移:`wrangler d1 migrations apply sproutblog --remote` +3. 安装依赖:`npm install` -## 可选后台密码 +## 开发 -如果要给 `/admin` 加密码,设置 `ADMIN_PASSWORD`: +- 一体化(会先 `vite build` 再同时拉起 Worker 与前端开发服务器): + - `npm run dev` + - Worker:默认 `http://127.0.0.1:8787`(读取 `dist` 静态资源) + - 前端:`http://127.0.0.1:5173`,`/api` 代理到 `8787` +- 仅 Worker(需已有 `dist`):`npm run dev:worker` +- 仅前端 + API 代理:`npm run dev:client` +- 修改 React 后若要在 `8787` 上看到最新静态文件,请再执行 `npm run build`。 -`wrangler secret put ADMIN_PASSWORD` +## 部署 +```bash +npm run deploy +``` + +等同 `npm run build && wrangler deploy`。 + +## 环境变量 + +- `SITE_TITLE` / `SITE_TITLE_EN` / `CWD_API_BASE`:可在 `wrangler.toml` 的 `[vars]` 中配置。 +- `ADMIN_PASSWORD`:生产环境建议使用 `wrangler secret put ADMIN_PASSWORD`,勿提交仓库。 +- 前端可选:`VITE_CWD_SITE_ID`(构建时注入;否则以 `/api/config` 中的 `CWD_SITE_ID` 为准)。 + +## API 说明(节选) + +| 方法 | 路径 | 说明 | +|------|------|------| +| GET | `/api/config` | 站点公开配置 | +| POST | `/api/admin/session` | 设置后台 Cookie(body: `{ token }`) | +| GET | `/api/posts` | 列表;未登录仅返回已发布文章 | +| GET | `/api/posts/:idOrSlug?bump=1` | 详情;`bump=1` 且匿名访问已发布文章时增加浏览量 | +| POST/PUT/DELETE | `/api/posts` … | 写操作需鉴权(与原先一致) | + +## 目录结构(节选) + +- `src/worker` — Worker 入口 +- `src/api` — 路由与 HTTP 处理 +- `src/db` — D1 访问 +- `client/` — Vite + React 源码,构建至 `dist/` +- `migrations/` — D1 SQL diff --git a/client/index.html b/client/index.html new file mode 100644 index 0000000..b22cf0b --- /dev/null +++ b/client/index.html @@ -0,0 +1,32 @@ + + +
+ + +加载站点配置…
+
+ 加载中…
'; + let cancelled = false; + (async () => { + try { + await renderMarkdownInto(el, markdown); + if (!cancelled) initPostToc(el); + } catch { + if (!cancelled) { + el.innerHTML = "渲染失败。
"; + el.classList.remove("markdown-pending"); + } + } + })(); + return () => { + cancelled = true; + teardownPostTocUi(); + }; + }, [markdown]); + + return ; +} diff --git a/client/src/lib/markdown.ts b/client/src/lib/markdown.ts new file mode 100644 index 0000000..afd0762 --- /dev/null +++ b/client/src/lib/markdown.ts @@ -0,0 +1,73 @@ +import { marked } from "marked"; +import markedKatex from "marked-katex-extension"; +import hljs from "highlight.js"; + +marked.use( + markedKatex({ + throwOnError: false, + nonStandard: true + }) +); +marked.setOptions({ gfm: true, breaks: true }); + +function decodeHtmlEntities(str: string): string { + return String(str) + .replace(/ /g, "\u00a0") + .replace(/&/g, "&") + .replace(/</g, "<") + .replace(/>/g, ">") + .replace(/"/g, '"') + .replace(/'/g, "'") + .replace(/(\d+);/g, (_, n) => { + const code = Number(n); + return code >= 0 && code <= 0x10ffff ? String.fromCharCode(code) : ""; + }) + .replace(/([0-9a-fA-F]+);/g, (_, h) => { + const code = parseInt(h, 16); + return code >= 0 && code <= 0x10ffff ? String.fromCharCode(code) : ""; + }); +} + +function escapeHtml(s: string): string { + return String(s) + .replace(/&/g, "&") + .replace(//g, ">") + .replace(/"/g, """) + .replace(/'/g, "'"); +} + +function mermaidFencedToDiv(html: string): string { + return html.replace( + /([\s\S]*?)<\/code><\/pre>/gi,
+ (_, inner: string) => {
+ const raw = decodeHtmlEntities(inner);
+ return `${escapeHtml(raw)}`;
+ }
+ );
+}
+
+/** 将 Markdown 渲染进元素(含 KaTeX、高亮、Mermaid) */
+export async function renderMarkdownInto(
+ el: HTMLElement,
+ markdown: string
+): Promise {
+ let html = marked.parse(markdown, { async: false }) as string;
+ if (typeof html !== "string") html = "";
+ html = mermaidFencedToDiv(html);
+ el.innerHTML = html;
+ el.classList.remove("markdown-pending");
+ el.querySelectorAll("pre code").forEach((block) => {
+ try {
+ hljs.highlightElement(block as HTMLElement);
+ } catch {
+ /* ignore */
+ }
+ });
+ const mNodes = el.querySelectorAll(".mermaid");
+ if (mNodes.length) {
+ const mermaid = (await import("mermaid")).default;
+ mermaid.initialize({ startOnLoad: false, theme: "neutral" });
+ await mermaid.run({ nodes: [...mNodes] as HTMLElement[] });
+ }
+}
diff --git a/client/src/lib/postToc.ts b/client/src/lib/postToc.ts
new file mode 100644
index 0000000..fc1845c
--- /dev/null
+++ b/client/src/lib/postToc.ts
@@ -0,0 +1,246 @@
+/**
+ * 文章目录(由旧 post-toc.js 迁移)
+ */
+const HEADING_SEL = "h2, h3, h4";
+
+function headingText(h: Element): string {
+ return (h.textContent || "").replace(/\s+/g, " ").trim();
+}
+
+function makeHeadingIds(headings: Element[]): void {
+ const used = new Set();
+ headings.forEach((h) => {
+ if (h.id && !used.has(h.id)) {
+ used.add(h.id);
+ return;
+ }
+ const raw = headingText(h);
+ let base =
+ raw
+ .toLowerCase()
+ .replace(/\s+/g, "-")
+ .replace(/[^a-z0-9\u2e80-\u9fff-]/gi, "-")
+ .replace(/-+/g, "-")
+ .replace(/^-|-$/g, "") || "section";
+ let id = base;
+ let n = 0;
+ while (used.has(id) || document.getElementById(id)) id = `${base}-${++n}`;
+ h.id = id;
+ used.add(id);
+ });
+}
+
+function buildTocOl(headings: Element[]) {
+ const ol = document.createElement("ol");
+ ol.className = "toc-tree";
+ const links: HTMLAnchorElement[] = [];
+ const path: { level: number; li: HTMLLIElement }[] = [];
+
+ for (const h of headings) {
+ const level = parseInt(h.tagName[1], 10);
+ if (level < 2 || level > 6) continue;
+
+ const li = document.createElement("li");
+ li.className = "toc-item";
+ const a = document.createElement("a");
+ a.className = "toc-link";
+ a.href = "#" + h.id;
+ a.textContent = headingText(h);
+ a.dataset.targetId = h.id;
+ li.appendChild(a);
+ links.push(a);
+
+ while (path.length && path[path.length - 1].level >= level) path.pop();
+
+ if (path.length === 0) {
+ ol.appendChild(li);
+ } else {
+ const parentLi = path[path.length - 1].li;
+ let sub = parentLi.querySelector(":scope > ol.toc-sub");
+ if (!sub) {
+ sub = document.createElement("ol");
+ sub.className = "toc-sub";
+ parentLi.appendChild(sub);
+ }
+ sub.appendChild(li);
+ }
+ path.push({ level, li });
+ }
+
+ return { ol, links };
+}
+
+function setActive(
+ linkGroups: HTMLAnchorElement[][],
+ activeId: string | null
+): void {
+ for (const links of linkGroups) {
+ for (const a of links) {
+ const on = a.dataset.targetId === activeId;
+ a.classList.toggle("toc-link--active", !!on);
+ }
+ }
+}
+
+function bindScrollSpy(
+ headings: Element[],
+ linkGroups: HTMLAnchorElement[][],
+ desktopAside: HTMLElement | null,
+ mobileFab: HTMLElement | null,
+ scope: Element | null | undefined
+): void {
+ const OFFSET = 100;
+
+ function update() {
+ const inArticle = scope ? scope.getBoundingClientRect().bottom > 120 : true;
+ if (desktopAside)
+ desktopAside.classList.toggle("post-toc--hidden", !inArticle);
+ if (mobileFab) mobileFab.classList.toggle("toc-fab--hidden", !inArticle);
+
+ const y = window.scrollY + OFFSET;
+ let current: string | null = headings[0]?.id || null;
+ for (const h of headings) {
+ if (h.getBoundingClientRect().top + window.scrollY <= y)
+ current = h.id || null;
+ }
+ if (current) setActive(linkGroups, current);
+ }
+
+ let ticking = false;
+ function onScroll() {
+ if (ticking) return;
+ ticking = true;
+ requestAnimationFrame(() => {
+ update();
+ ticking = false;
+ });
+ }
+
+ window.addEventListener("scroll", onScroll, { passive: true });
+ window.addEventListener("resize", onScroll, { passive: true });
+ update();
+}
+
+function bindTocLinks(
+ container: HTMLElement,
+ onNavigate?: (() => void) | null
+): void {
+ container.addEventListener("click", (e) => {
+ const t = e.target as HTMLElement | null;
+ const a = t?.closest("a.toc-link") as HTMLAnchorElement | null;
+ if (!a) return;
+ const id = a.getAttribute("href")?.slice(1);
+ if (!id) return;
+ const target = document.getElementById(id);
+ if (target) {
+ e.preventDefault();
+ target.scrollIntoView({ behavior: "smooth", block: "start" });
+ history.replaceState(null, "", "#" + id);
+ onNavigate?.();
+ }
+ });
+}
+
+function initDesktop(
+ aside: HTMLElement,
+ nav: HTMLElement,
+ headings: Element[]
+): HTMLAnchorElement[] {
+ const { ol, links } = buildTocOl(headings);
+ nav.innerHTML = "";
+ nav.appendChild(ol);
+ aside.hidden = false;
+ bindTocLinks(nav, null);
+ return links;
+}
+
+function initMobile(headings: Element[]) {
+ if (document.getElementById("toc-fab")) return { links: [] as HTMLAnchorElement[], fab: null as HTMLElement | null };
+
+ const { ol, links } = buildTocOl(headings);
+
+ const panel = document.createElement("div");
+ panel.id = "toc-panel";
+ panel.setAttribute("aria-label", "文章目录");
+ panel.setAttribute("role", "navigation");
+ const panelTitle = document.createElement("p");
+ panelTitle.className = "toc-panel__title";
+ panelTitle.textContent = "目录";
+ panel.appendChild(panelTitle);
+ panel.appendChild(ol);
+ document.body.appendChild(panel);
+
+ const fab = document.createElement("button");
+ fab.id = "toc-fab";
+ fab.type = "button";
+ fab.setAttribute("aria-label", "打开文章目录");
+ fab.setAttribute("aria-controls", "toc-panel");
+ fab.setAttribute("aria-expanded", "false");
+ fab.innerHTML = `
+ `;
+ document.body.appendChild(fab);
+
+ function openPanel() {
+ panel.classList.add("toc-panel--open");
+ fab.setAttribute("aria-expanded", "true");
+ fab.setAttribute("aria-label", "关闭文章目录");
+ fab.classList.add("toc-fab--open");
+ }
+ function closePanel() {
+ panel.classList.remove("toc-panel--open");
+ fab.setAttribute("aria-expanded", "false");
+ fab.setAttribute("aria-label", "打开文章目录");
+ fab.classList.remove("toc-fab--open");
+ }
+
+ fab.addEventListener("click", () => {
+ panel.classList.contains("toc-panel--open") ? closePanel() : openPanel();
+ });
+
+ document.addEventListener("keydown", (e) => {
+ if (e.key === "Escape") closePanel();
+ });
+
+ bindTocLinks(panel, closePanel);
+
+ return { links, fab };
+}
+
+export function teardownPostTocUi(): void {
+ document.getElementById("toc-fab")?.remove();
+ document.getElementById("toc-panel")?.remove();
+}
+
+export function initPostToc(markdownBody: HTMLElement | null): void {
+ const aside = document.getElementById("post-toc");
+ const nav = document.getElementById("post-toc-nav");
+ if (!markdownBody) return;
+
+ const headings = [...markdownBody.querySelectorAll(HEADING_SEL)];
+ if (headings.length === 0) {
+ if (aside) aside.hidden = true;
+ return;
+ }
+
+ makeHeadingIds(headings);
+ const scope = markdownBody.closest(".post-with-toc");
+
+ let desktopLinks: HTMLAnchorElement[] = [];
+ if (aside && nav) {
+ desktopLinks = initDesktop(aside, nav, headings);
+ }
+
+ const { links: mobileLinks, fab: mobileElem } = initMobile(headings);
+
+ const fab = mobileElem || document.getElementById("toc-fab");
+ bindScrollSpy(headings, [desktopLinks, mobileLinks], aside, fab, scope);
+
+ if (location.hash.length > 1) {
+ const id = decodeURIComponent(location.hash.slice(1));
+ if (headings.some((h) => h.id === id)) {
+ setActive([desktopLinks, mobileLinks], id);
+ }
+ }
+}
diff --git a/utils.js b/client/src/lib/text.ts
similarity index 50%
rename from utils.js
rename to client/src/lib/text.ts
index d7fd3d0..d1ea2c7 100644
--- a/utils.js
+++ b/client/src/lib/text.ts
@@ -1,37 +1,4 @@
-export function cleanText(value) {
- return String(value ?? "").trim();
-}
-
-export function isTruthy(value) {
- return value === true || value === "true" || value === "1" || value === 1 || value === "on" || value === "yes";
-}
-
-export function escapeHtml(value) {
- return String(value ?? "")
- .replace(/&/g, "&")
- .replace(//g, ">")
- .replace(/"/g, """)
- .replace(/'/g, "'");
-}
-
-export function escapeAttr(value) {
- return escapeHtml(value).replace(/`/g, "`");
-}
-
-export function formatDateTime(value) {
- if (!value) return "";
- const date = new Date(value);
- if (Number.isNaN(date.getTime())) return escapeHtml(value);
- const yyyy = date.getFullYear();
- const mm = String(date.getMonth() + 1).padStart(2, "0");
- const dd = String(date.getDate()).padStart(2, "0");
- const hh = String(date.getHours()).padStart(2, "0");
- const mi = String(date.getMinutes()).padStart(2, "0");
- return `${yyyy}-${mm}-${dd} ${hh}:${mi}`;
-}
-
-export function stripMarkdown(text) {
+export function stripMarkdown(text: unknown): string {
return String(text ?? "")
.replace(/```[\s\S]*?```/g, " ")
.replace(/\$\$[\s\S]*?\$\$/g, " ")
@@ -47,6 +14,14 @@ export function stripMarkdown(text) {
.trim();
}
-export function b64EncodeUtf8(str) {
- return btoa(unescape(encodeURIComponent(str)));
+export function formatDateTime(value: unknown): string {
+ if (!value) return "";
+ const date = new Date(String(value));
+ if (Number.isNaN(date.getTime())) return String(value);
+ const yyyy = date.getFullYear();
+ const mm = String(date.getMonth() + 1).padStart(2, "0");
+ const dd = String(date.getDate()).padStart(2, "0");
+ const hh = String(date.getHours()).padStart(2, "0");
+ const mi = String(date.getMinutes()).padStart(2, "0");
+ return `${yyyy}-${mm}-${dd} ${hh}:${mi}`;
}
diff --git a/client/src/main.tsx b/client/src/main.tsx
new file mode 100644
index 0000000..4835fb3
--- /dev/null
+++ b/client/src/main.tsx
@@ -0,0 +1,11 @@
+import { StrictMode } from "react";
+import { createRoot } from "react-dom/client";
+import { App } from "./App";
+import "./styles/app.css";
+import "./styles/markdown.css";
+
+createRoot(document.getElementById("root")!).render(
+
+
+
+);
diff --git a/client/src/pages/Admin.tsx b/client/src/pages/Admin.tsx
new file mode 100644
index 0000000..3045d13
--- /dev/null
+++ b/client/src/pages/Admin.tsx
@@ -0,0 +1,234 @@
+import { FormEvent, useEffect, useState } from "react";
+import { Link, useNavigate, useParams, useSearchParams } from "react-router-dom";
+import {
+ deletePostApi,
+ fetchPost,
+ fetchPosts,
+ savePost,
+ type Post
+} from "../api";
+import { useSiteConfig } from "../ConfigContext";
+
+export function AdminDashboard() {
+ const { siteTitle } = useSiteConfig();
+ const [q, setQ] = useState("");
+ const [inputQ, setInputQ] = useState("");
+ const [posts, setPosts] = useState([]);
+
+ useEffect(() => {
+ document.title = `后台 - ${siteTitle}`;
+ }, [siteTitle]);
+
+ useEffect(() => {
+ const id = window.setTimeout(() => setQ(inputQ.trim()), 300);
+ return () => clearTimeout(id);
+ }, [inputQ]);
+
+ useEffect(() => {
+ let cancelled = false;
+ (async () => {
+ try {
+ const list = await fetchPosts(q || undefined, {
+ credentials: "include"
+ });
+ if (!cancelled) setPosts(list);
+ } catch {
+ if (!cancelled) setPosts([]);
+ }
+ })();
+ return () => {
+ cancelled = true;
+ };
+ }, [q]);
+
+ return (
+ <>
+
+ 返回
+
+ 后台
+
+ 新建文章
+
+
+ 文章列表
+
+ {posts.length ? (
+ posts.map((post) => (
+
+ {post.title}
+
+ ID: {post.id} | Slug: {post.slug} |{" "}
+ {post.published ? "已发布" : "草稿"}
+
+
+ 编辑
+ setPosts((p) => p.filter((x) => x.id !== post.id))} />
+
+
+ ))
+ ) : (
+ 没有找到文章。
+ )}
+
+ >
+ );
+}
+
+function DeleteButton({
+ postId,
+ onDone
+}: {
+ postId: number;
+ onDone: () => void;
+}) {
+ return (
+
+ );
+}
+
+export function AdminEditor() {
+ const { id: idParam } = useParams();
+ const [search] = useSearchParams();
+ const navigate = useNavigate();
+ const { siteTitle } = useSiteConfig();
+ const id = idParam ? Number(idParam) : Number(search.get("id") || "") || null;
+
+ const [title, setTitle] = useState("");
+ const [slug, setSlug] = useState("");
+ const [excerpt, setExcerpt] = useState("");
+ const [content, setContent] = useState("");
+ const [published, setPublished] = useState(true);
+
+ useEffect(() => {
+ document.title = `后台 - ${siteTitle}`;
+ }, [siteTitle]);
+
+ useEffect(() => {
+ if (!id) {
+ setTitle("");
+ setSlug("");
+ setExcerpt("");
+ setContent("");
+ setPublished(true);
+ return;
+ }
+ let cancelled = false;
+ (async () => {
+ try {
+ const post = await fetchPost(String(id), false, {
+ credentials: "include"
+ });
+ if (cancelled) return;
+ setTitle(post.title);
+ setSlug(post.slug);
+ setExcerpt(post.excerpt || "");
+ setContent(post.content || "");
+ setPublished(!!post.published);
+ } catch {
+ if (!cancelled) alert("加载文章失败");
+ }
+ })();
+ return () => {
+ cancelled = true;
+ };
+ }, [id]);
+
+ async function onSubmit(e: FormEvent) {
+ e.preventDefault();
+ try {
+ const payload = {
+ title,
+ slug,
+ excerpt,
+ content,
+ published: published ? 1 : 0,
+ id: id || undefined
+ };
+ const saved = await savePost(payload, id);
+ navigate(`/admin/edit/${saved.id}?saved=1`, { replace: true });
+ } catch (er) {
+ alert(er instanceof Error ? er.message : "保存失败");
+ }
+ }
+
+ return (
+ <>
+
+ 返回后台
+
+ {id ? `编辑 #${id}` : "新建文章"}
+
+ >
+ );
+}
diff --git a/client/src/pages/Home.tsx b/client/src/pages/Home.tsx
new file mode 100644
index 0000000..a897c86
--- /dev/null
+++ b/client/src/pages/Home.tsx
@@ -0,0 +1,95 @@
+import { useEffect, useState } from "react";
+import { Link } from "react-router-dom";
+import { fetchPosts, type Post } from "../api";
+import { useSiteConfig } from "../ConfigContext";
+import { formatDateTime, stripMarkdown } from "../lib/text";
+
+export function Home() {
+ const { siteTitle } = useSiteConfig();
+ const [inputQ, setInputQ] = useState("");
+ const [q, setQ] = useState("");
+ const [posts, setPosts] = useState([]);
+ const [err, setErr] = useState(null);
+
+ useEffect(() => {
+ document.title = siteTitle;
+ }, [siteTitle]);
+
+ useEffect(() => {
+ const id = window.setTimeout(() => setQ(inputQ.trim()), 300);
+ return () => clearTimeout(id);
+ }, [inputQ]);
+
+ useEffect(() => {
+ let cancelled = false;
+ (async () => {
+ try {
+ setErr(null);
+ const list = await fetchPosts(q || undefined);
+ if (!cancelled) setPosts(list);
+ } catch {
+ if (!cancelled) setErr("加载失败");
+ }
+ })();
+ return () => {
+ cancelled = true;
+ };
+ }, [q]);
+
+ return (
+ <>
+
+ {q ? (
+
+ 搜索:{q}
+
+ ) : null}
+ {err ? {err}
: null}
+ {posts.length ? (
+ posts.map((post) => {
+ const excerpt =
+ post.excerpt || stripMarkdown(post.content).slice(0, 180);
+ const views = Number(post.view_count) || 0;
+ return (
+
+
+
+ {post.title}
+
+
+
+ {excerpt}
+ {excerpt.length >= 180 ? "…" : ""}
+
+
+
+ 创建于:{formatDateTime(post.created_at)}
+
+
+ 最后更新于:{formatDateTime(post.updated_at)}
+
+ 浏览 {views}
+
+
+ );
+ })
+ ) : (
+ 暂无文章。
+ )}
+ >
+ );
+}
diff --git a/client/src/pages/PostPage.tsx b/client/src/pages/PostPage.tsx
new file mode 100644
index 0000000..b6f1fc3
--- /dev/null
+++ b/client/src/pages/PostPage.tsx
@@ -0,0 +1,85 @@
+import { useEffect, useState } from "react";
+import { Link, useParams } from "react-router-dom";
+import { fetchPost } from "../api";
+import { useSiteConfig } from "../ConfigContext";
+import { CwdComments } from "../components/CwdComments";
+import { MarkdownBody } from "../components/MarkdownBody";
+import { formatDateTime } from "../lib/text";
+
+export function PostPage() {
+ const { slug = "" } = useParams();
+ const { siteTitle } = useSiteConfig();
+ const [title, setTitle] = useState("");
+ const [content, setContent] = useState("");
+ const [updatedAt, setUpdatedAt] = useState("");
+ const [views, setViews] = useState(0);
+ const [err, setErr] = useState(null);
+
+ useEffect(() => {
+ let cancelled = false;
+ (async () => {
+ try {
+ setErr(null);
+ const post = await fetchPost(decodeURIComponent(slug), true);
+ if (cancelled) return;
+ setTitle(post.title);
+ setContent(post.content || "");
+ setUpdatedAt(post.updated_at);
+ setViews(Number(post.view_count) || 0);
+ document.title = `${post.title} - ${siteTitle}`;
+ } catch {
+ if (!cancelled) {
+ setErr("文章不存在或加载失败");
+ document.title = `404 - ${siteTitle}`;
+ }
+ }
+ })();
+ return () => {
+ cancelled = true;
+ };
+ }, [slug, siteTitle]);
+
+ if (err) {
+ return (
+ <>
+
+ 返回
+
+ 404
+ {err}
+ >
+ );
+ }
+
+ return (
+ <>
+
+ 返回
+
+
+
+
+ {title}
+
+ {formatDateTime(updatedAt)}
+ 浏览 {views}
+
+
+
+
+
+
+
+ >
+ );
+}
diff --git a/client/src/styles/app.css b/client/src/styles/app.css
new file mode 100644
index 0000000..5c9340b
--- /dev/null
+++ b/client/src/styles/app.css
@@ -0,0 +1,612 @@
+:root {
+ --page-max: 920px;
+ --page-pad-x: 24px;
+ --page-pad-y: 24px;
+ --page-gap: 24px;
+ --text: #2a1f0e;
+ --muted: #6b5a42;
+ --line: #d9cdb8;
+ /* 笔记纸底色与格线 */
+ --paper-bg: #fdf8ec;
+ --paper-rule: rgba(160, 140, 100, 0.18);
+ --paper-grid: rgba(160, 140, 100, 0.10);
+ --paper-rule-spacing: 28px;
+ /**
+ * 有网:Inter(拉丁)+ Noto Sans SC(补中文,外链见 render 中 Google Fonts)
+ * 无网/外链失败:不加载 webfont 时,浏览器跳过未解析名称,用后续系统无衬线
+ */
+ --font-sans: "Inter", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
+ /* 行内/块 等;无 Source Code Pro 时走系统等宽 */
+ --font-mono: "Source Code Pro", Menlo, Monaco, Consolas, "Courier New", monospace;
+}
+html {
+ margin: 0;
+ padding: 0;
+ background: var(--paper-bg);
+ color: var(--text);
+ font-family: var(--font-sans);
+ scroll-behavior: smooth;
+ -webkit-text-size-adjust: 100%;
+ text-size-adjust: 100%;
+}
+body {
+ margin: 0;
+ padding: 0;
+ color: var(--text);
+ font-family: var(--font-sans);
+ line-height: 1.7;
+ overflow-x: hidden;
+ /* 笔记纸纹理:竖向 + 横向格线,横线更淡 */
+ background-color: var(--paper-bg);
+ background-image:
+ repeating-linear-gradient(
+ 90deg,
+ transparent,
+ transparent calc(var(--paper-rule-spacing) - 1px),
+ var(--paper-grid) calc(var(--paper-rule-spacing) - 1px),
+ var(--paper-grid) var(--paper-rule-spacing)
+ ),
+ repeating-linear-gradient(
+ 180deg,
+ transparent,
+ transparent calc(var(--paper-rule-spacing) - 1px),
+ rgba(160, 140, 100, 0.07) calc(var(--paper-rule-spacing) - 1px),
+ rgba(160, 140, 100, 0.07) var(--paper-rule-spacing)
+ );
+}
+code,
+kbd,
+samp {
+ font-family: var(--font-mono);
+}
+main {
+ width: min(100%, var(--page-max));
+ margin: 0 auto;
+ padding: var(--page-pad-y) var(--page-pad-x) 32px;
+ box-sizing: border-box;
+}
+.site-footer {
+ width: min(100%, var(--page-max));
+ margin: 0 auto;
+ padding: 20px var(--page-pad-x) 28px;
+ box-sizing: border-box;
+ border-top: 1px solid var(--line);
+ text-align: center;
+ font-size: 0.88rem;
+ color: var(--muted);
+}
+.site-footer p {
+ margin: 0;
+ line-height: 1.6;
+}
+.site-footer p.site-footer-geo {
+ margin-top: 10px;
+ font-size: 0.82rem;
+ color: var(--muted);
+ word-break: break-word;
+}
+header.site-header {
+ margin-bottom: var(--page-gap);
+ padding-bottom: 16px;
+ border-bottom: 1px solid var(--line);
+}
+.site-brand {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+}
+.site-titles {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 2px;
+ min-width: 0;
+}
+.site-title-link {
+ text-decoration: none;
+ color: inherit;
+ font-weight: 700;
+ font-size: 1.25rem;
+ line-height: 1.2;
+}
+.site-title-en {
+ font-size: 0.82rem;
+ font-weight: 500;
+ color: var(--muted);
+ letter-spacing: 0.02em;
+}
+.site-logo {
+ flex-shrink: 0;
+ width: 40px;
+ height: 40px;
+ object-fit: contain;
+ cursor: pointer;
+ /* 让 logo 白底融入纸张背景 */
+ mix-blend-mode: multiply;
+}
+.admin-gate {
+ position: fixed;
+ inset: 0;
+ background: rgba(0, 0, 0, 0.35);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ z-index: 9999;
+ padding: 16px;
+ box-sizing: border-box;
+}
+.admin-gate[hidden] {
+ display: none !important;
+}
+.admin-gate-panel {
+ background: var(--paper-bg);
+ padding: 16px 18px;
+ border-radius: 6px;
+ border: 1px solid #c8b99a;
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+ align-items: center;
+ width: min(100%, 420px);
+ box-sizing: border-box;
+}
+.admin-gate-panel input[type="password"] {
+ width: 100%;
+ box-sizing: border-box;
+ min-width: 0;
+}
+h1,
+h2,
+h3 {
+ line-height: 1.3;
+ margin: 0 0 12px;
+ word-break: break-word;
+}
+article,
+section {
+ margin: 0 0 24px;
+}
+p {
+ margin: 0 0 12px;
+ word-break: break-word;
+}
+a {
+ color: inherit;
+}
+input,
+textarea,
+button {
+ font: inherit;
+ max-width: 100%;
+}
+input[type="text"],
+input[type="password"],
+textarea {
+ width: 100%;
+ box-sizing: border-box;
+ min-width: 0;
+}
+textarea {
+ min-height: 320px;
+ resize: vertical;
+}
+pre {
+ font-family: var(--font-mono);
+ font-size: 0.92em;
+ white-space: pre-wrap;
+ word-break: break-word;
+ overflow-x: auto;
+}
+img {
+ max-width: 100%;
+ height: auto;
+}
+hr {
+ border: 0;
+ border-top: 1px solid #d4c5a8;
+ margin: 24px 0;
+}
+.post-card {
+ padding-bottom: 16px;
+ border-bottom: 1px solid #e4d9c4;
+}
+.post-card:last-of-type {
+ padding-bottom: 0;
+ border-bottom: 0;
+}
+.post-card .post-excerpt {
+ margin: 0 0 10px;
+}
+.post-card .post-meta {
+ font-size: 0.9em;
+ color: #555;
+ margin: 0 0 16px;
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: 8px 16px;
+}
+.post-detail-meta {
+ font-size: 0.95em;
+ color: #555;
+ margin: 0 0 16px;
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: 8px 16px;
+}
+.post-detail-views {
+ color: #666;
+}
+.post-comments {
+ margin-top: 36px;
+ padding-top: 28px;
+ border-top: 1px solid var(--line);
+}
+.post-comments__title {
+ font-size: 1.35rem;
+ margin: 0 0 16px;
+}
+form {
+ margin: 0;
+}
+@media (max-width: 1024px) {
+ :root {
+ --page-max: 840px;
+ --page-pad-x: 20px;
+ --page-pad-y: 20px;
+ --page-gap: 20px;
+ }
+}
+@media (max-width: 768px) {
+ :root {
+ --page-max: 100%;
+ --page-pad-x: 16px;
+ --page-pad-y: 16px;
+ --page-gap: 18px;
+ }
+ .site-logo {
+ width: 36px;
+ height: 36px;
+ }
+ .site-title-link {
+ font-size: 1.1rem;
+ }
+ .post-card .post-meta,
+ .post-detail-meta {
+ gap: 6px 12px;
+ }
+}
+@media (max-width: 480px) {
+ :root {
+ --page-pad-x: 14px;
+ --page-pad-y: 14px;
+ --page-gap: 16px;
+ }
+ body {
+ line-height: 1.68;
+ }
+ header.site-header {
+ padding-bottom: 12px;
+ }
+ textarea {
+ min-height: 240px;
+ }
+ .site-brand {
+ gap: 10px;
+ align-items: flex-start;
+ }
+ .site-logo {
+ width: 32px;
+ height: 32px;
+ }
+ .site-title-link {
+ font-size: 1rem;
+ }
+ .post-card .post-meta,
+ .post-detail-meta {
+ font-size: 0.82em;
+ flex-direction: row;
+ flex-wrap: wrap;
+ align-items: baseline;
+ gap: 4px 10px;
+ row-gap: 4px;
+ }
+ .post-card .post-meta span,
+ .post-detail-meta span {
+ white-space: nowrap;
+ }
+ .admin-gate-panel {
+ padding: 14px 14px;
+ }
+}
+
+/* ----- 文章页布局 ----- */
+main:has(.post-with-toc),
+body:has(.post-with-toc) .site-footer {
+ width: min(100%, 920px);
+ max-width: 920px;
+}
+.post-with-toc {
+ display: block;
+ width: 100%;
+}
+.post-with-toc__main {
+ min-width: 0;
+ width: min(100%, 720px);
+ margin: 0 auto;
+}
+/* ═══ 桌面端目录(≥1181px)═══════════════════════════════════ */
+.post-toc {
+ position: fixed;
+ top: 96px;
+ right: max(14px, calc((100vw - 1400px) / 2));
+ z-index: 20;
+ width: 260px;
+ max-width: min(30vw, 260px);
+ transition: opacity 0.18s ease, visibility 0.18s ease;
+}
+.post-toc--hidden {
+ visibility: hidden;
+ opacity: 0;
+ pointer-events: none;
+}
+.post-toc__inner {
+ box-sizing: border-box;
+ max-height: calc(100vh - 128px);
+ overflow-y: auto;
+ -webkit-overflow-scrolling: touch;
+ scrollbar-width: thin;
+}
+.post-toc__title {
+ margin: 0 0 10px;
+ font-size: 0.75rem;
+ font-weight: 500;
+ color: #888;
+}
+.post-toc__nav {
+ position: relative;
+ margin: 0;
+ border-left: 1px solid #d4c5a8;
+ padding-left: 14px;
+}
+
+/* 桌面:≤1180px 完全隐藏 aside */
+@media (max-width: 1180px) {
+ .post-toc {
+ display: none;
+ }
+ main:has(.post-with-toc),
+ body:has(.post-with-toc) .site-footer {
+ width: min(100%, var(--page-max));
+ max-width: var(--page-max);
+ }
+}
+
+/* ═══ 公共目录列表样式(桌面 & 移动端共用类名)══════════════ */
+.toc-tree,
+.toc-sub {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+.toc-sub {
+ margin-top: 2px;
+ margin-bottom: 2px;
+ padding-left: 10px;
+}
+.toc-item {
+ margin: 0;
+}
+.toc-link {
+ display: block;
+ position: relative;
+ padding: 5px 0 6px;
+ font-size: 0.88rem;
+ line-height: 1.5;
+ text-decoration: none;
+ color: #777;
+}
+.toc-sub .toc-link {
+ color: #999;
+ font-size: 0.82rem;
+}
+.toc-link:hover,
+.toc-sub .toc-link:hover {
+ color: #111;
+}
+.toc-link--active {
+ color: #111;
+ font-weight: 500;
+}
+/* 桌面目录:当前项左侧指示条 */
+.post-toc__nav .toc-link--active::before {
+ content: "";
+ position: absolute;
+ left: -16px;
+ top: 0.15em;
+ bottom: 0.15em;
+ width: 2px;
+ background: #111;
+ border-radius: 0;
+}
+
+/* ═══ 移动端 FAB(JS append 到 body,≤1180px 显示)═════════ */
+#toc-fab {
+ display: none;
+}
+@media (max-width: 1180px) {
+ #toc-fab {
+ display: inline-flex;
+ position: fixed;
+ right: 20px;
+ bottom: calc(22px + env(safe-area-inset-bottom));
+ z-index: 50;
+ width: 44px;
+ height: 44px;
+ align-items: center;
+ justify-content: center;
+ border: 1px solid rgba(160, 130, 80, 0.25);
+ border-radius: 50%;
+ background: rgba(253, 248, 236, 0.97);
+ box-shadow: 0 6px 20px rgba(100, 80, 40, 0.16);
+ color: #333;
+ cursor: pointer;
+ -webkit-tap-highlight-color: transparent;
+ transition: opacity 0.18s, visibility 0.18s, transform 0.18s;
+ }
+ #toc-fab.toc-fab--hidden {
+ opacity: 0;
+ visibility: hidden;
+ pointer-events: none;
+ transform: scale(0.85);
+ }
+ /* 汉堡线 */
+ .toc-fab__icon {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ width: 18px;
+ transition: gap 0.18s;
+ }
+ .toc-fab__icon span {
+ display: block;
+ height: 2px;
+ width: 18px;
+ background: currentColor;
+ border-radius: 2px;
+ transition: transform 0.18s, opacity 0.18s, width 0.18s;
+ transform-origin: center;
+ }
+ /* 打开状态 → X 形 */
+ #toc-fab.toc-fab--open .toc-fab__icon {
+ gap: 0;
+ }
+ #toc-fab.toc-fab--open .toc-fab__icon span:nth-child(1) {
+ transform: translateY(2px) rotate(45deg);
+ }
+ #toc-fab.toc-fab--open .toc-fab__icon span:nth-child(2) {
+ opacity: 0;
+ width: 0;
+ }
+ #toc-fab.toc-fab--open .toc-fab__icon span:nth-child(3) {
+ transform: translateY(-2px) rotate(-45deg);
+ }
+}
+
+/* ═══ 移动端弹出面板(JS append 到 body,≤1180px 显示)══════ */
+#toc-panel {
+ display: none;
+}
+@media (max-width: 1180px) {
+ #toc-panel {
+ display: block;
+ position: fixed;
+ right: 16px;
+ bottom: calc(76px + env(safe-area-inset-bottom));
+ z-index: 49;
+ width: min(300px, calc(100vw - 32px));
+ max-height: min(60vh, 440px);
+ overflow-y: auto;
+ -webkit-overflow-scrolling: touch;
+ box-sizing: border-box;
+ padding: 14px 16px 16px;
+ background: rgba(253, 248, 236, 0.98);
+ border: 1px solid rgba(160, 130, 80, 0.2);
+ border-radius: 12px;
+ box-shadow: 0 12px 36px rgba(100, 80, 40, 0.18);
+ /* 默认隐藏 */
+ opacity: 0;
+ visibility: hidden;
+ pointer-events: none;
+ transform: translateY(10px) scale(0.97);
+ transform-origin: bottom right;
+ transition: opacity 0.16s ease, visibility 0.16s ease, transform 0.16s ease;
+ }
+ #toc-panel.toc-panel--open {
+ opacity: 1;
+ visibility: visible;
+ pointer-events: auto;
+ transform: none;
+ }
+ .toc-panel__title {
+ margin: 0 0 8px;
+ font-size: 0.75rem;
+ font-weight: 500;
+ color: #888;
+ }
+ /* 移动端面板:当前项左侧指示条 */
+ #toc-panel .toc-link--active::before {
+ content: "";
+ position: absolute;
+ left: -14px;
+ top: 0.15em;
+ bottom: 0.15em;
+ width: 2px;
+ background: #111;
+ border-radius: 0;
+ }
+ #toc-panel .toc-tree {
+ border-left: 1px solid #d4c5a8;
+ padding-left: 14px;
+ }
+ #toc-panel .toc-link {
+ font-size: 0.9rem;
+ padding: 6px 0 7px;
+ }
+ #toc-panel .toc-sub .toc-link {
+ font-size: 0.84rem;
+ }
+}
+
+/* React:可点击 Logo 用于后台入口 */
+.admin-gate-logo-btn {
+ all: unset;
+ display: flex;
+ align-items: center;
+ cursor: pointer;
+ flex-shrink: 0;
+}
+
+/* ═══ cwd-widget 评论区覆盖:融入纸张主题 ═══════════════════ */
+#comments > div,
+#comments .cwd-widget,
+#comments [class*="card"],
+#comments [class*="form-wrap"],
+#comments [class*="comment-form"],
+#comments [class*="CommentForm"],
+#comments form {
+ background: var(--paper-bg) !important;
+ border-color: var(--line) !important;
+ box-shadow: 0 2px 12px rgba(100, 80, 40, 0.1) !important;
+}
+#comments input[type="text"],
+#comments input[type="email"],
+#comments input[type="url"],
+#comments textarea {
+ background: rgba(255, 252, 240, 0.8) !important;
+ border-color: #c8b99a !important;
+ color: var(--text) !important;
+}
+#comments input[type="text"]:focus,
+#comments input[type="email"]:focus,
+#comments input[type="url"]:focus,
+#comments textarea:focus {
+ border-color: #a08060 !important;
+ outline: none !important;
+ box-shadow: 0 0 0 2px rgba(160, 128, 96, 0.2) !important;
+}
+#comments [class*="comment-item"],
+#comments [class*="CommentItem"],
+#comments [class*="comment-card"] {
+ background: rgba(255, 252, 240, 0.6) !important;
+ border-color: var(--line) !important;
+}
+/* 兜底:widget 内所有白色背景块 */
+#comments > div[style*="background"],
+#comments > div > div[style*="background:#fff"],
+#comments > div > div[style*="background: #fff"],
+#comments > div > div[style*="background:white"],
+#comments > div > div[style*="background: white"] {
+ background: var(--paper-bg) !important;
+}
diff --git a/public/css/markdown.css b/client/src/styles/markdown.css
similarity index 96%
rename from public/css/markdown.css
rename to client/src/styles/markdown.css
index cf3e407..116eb9e 100644
--- a/public/css/markdown.css
+++ b/client/src/styles/markdown.css
@@ -23,11 +23,13 @@
.markdown-body h2 {
font-size: 1.5rem;
margin: 22px 0 10px;
+ scroll-margin-top: 1.25em;
}
.markdown-body h3 {
font-size: 1.25rem;
margin: 18px 0 8px;
+ scroll-margin-top: 1.15em;
}
.markdown-body h4,
@@ -35,6 +37,7 @@
.markdown-body h6 {
font-size: 1.05rem;
margin: 16px 0 8px;
+ scroll-margin-top: 1.05em;
}
.markdown-body p {
@@ -83,7 +86,7 @@
}
.markdown-body code {
- font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
+ font-family: var(--font-mono);
font-size: 0.92em;
}
diff --git a/client/src/vite-env.d.ts b/client/src/vite-env.d.ts
new file mode 100644
index 0000000..d74857c
--- /dev/null
+++ b/client/src/vite-env.d.ts
@@ -0,0 +1,9 @@
+///
+
+interface ImportMetaEnv {
+ readonly VITE_CWD_SITE_ID?: string;
+}
+
+interface ImportMeta {
+ readonly env: ImportMetaEnv;
+}
diff --git a/client/tsconfig.json b/client/tsconfig.json
new file mode 100644
index 0000000..cf049fa
--- /dev/null
+++ b/client/tsconfig.json
@@ -0,0 +1,24 @@
+{
+ "compilerOptions": {
+ "target": "ES2022",
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
+ "module": "ESNext",
+ "skipLibCheck": true,
+ "moduleResolution": "bundler",
+ "allowImportingTsExtensions": true,
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "noEmit": true,
+ "jsx": "react-jsx",
+ "strict": true,
+ "noUnusedLocals": false,
+ "noUnusedParameters": false,
+ "noFallthroughCasesInSwitch": true,
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["src/*"]
+ }
+ },
+ "include": ["src/**/*.ts", "src/**/*.tsx"],
+ "exclude": ["vite.config.ts"]
+}
diff --git a/client/vite.config.ts b/client/vite.config.ts
new file mode 100644
index 0000000..e3798f0
--- /dev/null
+++ b/client/vite.config.ts
@@ -0,0 +1,33 @@
+import path from "node:path";
+import { defineConfig } from "vite";
+import react from "@vitejs/plugin-react";
+
+const root = path.resolve(__dirname);
+
+export default defineConfig(({ mode }) => {
+ const isDesktop = mode === "desktop";
+ return {
+ plugins: [react()],
+ root,
+ publicDir: path.join(root, "public"),
+ define: {
+ "import.meta.env.VITE_API_BASE": JSON.stringify(
+ isDesktop ? "https://blog.smyhub.com" : ""
+ )
+ },
+ build: {
+ outDir: path.resolve(__dirname, isDesktop ? "../dist-desktop" : "../dist"),
+ emptyOutDir: true,
+ chunkSizeWarningLimit: 1200
+ },
+ server: {
+ port: 5173,
+ proxy: {
+ "/api": {
+ target: "http://127.0.0.1:8787",
+ changeOrigin: true
+ }
+ }
+ }
+ };
+});
diff --git a/dist-desktop/assets/_baseUniq-D-yNBara.js b/dist-desktop/assets/_baseUniq-D-yNBara.js
new file mode 100644
index 0000000..96e90ed
--- /dev/null
+++ b/dist-desktop/assets/_baseUniq-D-yNBara.js
@@ -0,0 +1 @@
+import{aX as L,bt as ln,aH as A,aV as P,aG as z,bu as gn,bv as dn,bw as hn,bx as W,by as pn,bo as An,bz as m,aY as N,b1 as B,b4 as T,bA as _n,a$ as on,bB as wn,br as On,aI as V,bp as vn,bC as R}from"./mermaid.core-DD7RPEfx.js";var Pn="[object Symbol]";function x(n){return typeof n=="symbol"||L(n)&&ln(n)==Pn}function yn(n,r){for(var e=-1,i=n==null?0:n.length,f=Array(i);++e-1}function M(n){return z(n)?gn(n):dn(n)}var Ln=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xn=/^\w*$/;function $(n,r){if(A(n))return!1;var e=typeof n;return e=="number"||e=="symbol"||e=="boolean"||n==null||x(n)?!0:xn.test(n)||!Ln.test(n)||r!=null&&n in Object(r)}var Mn=500;function $n(n){var r=hn(n,function(i){return e.size===Mn&&e.clear(),i}),e=r.cache;return r}var Cn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Gn=/\\(\\)?/g,Dn=$n(function(n){var r=[];return n.charCodeAt(0)===46&&r.push(""),n.replace(Cn,function(e,i,f,t){r.push(f?t.replace(Gn,"$1"):i||e)}),r});function Fn(n){return n==null?"":k(n)}function j(n,r){return A(n)?n:$(n,r)?[n]:Dn(Fn(n))}function I(n){if(typeof n=="string"||x(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function nn(n,r){r=j(r,n);for(var e=0,i=r.length;n!=null&&eu))return!1;var h=t.get(n),g=t.get(r);if(h&&g)return h==r&&g==n;var l=-1,d=!0,o=e&Wn?new y:void 0;for(t.set(n,r),t.set(r,n);++l=Ur){var h=r?null:Br(n);if(h)return C(h);s=!1,f=tn,a=new y}else a=r?[]:u;n:for(;++ir*r+G*G&&(j=w,z=p),{cx:j,cy:z,x01:-n,y01:-d,x11:j*(v/T-1),y11:z*(v/T-1)}}function hn(){var l=cn,h=yn,I=B(0),D=null,v=gn,A=dn,C=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,F=rn(c-f),t=c>f;if(a||(a=n=O()),sy))a.moveTo(0,0);else if(F>tn-y)a.moveTo(s*H(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*H(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=F,S=F,j=C.apply(this,arguments)/2,z=j>y&&(D?+D.apply(this,arguments):L(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(z>y){var G=sn(z/u*q(j)),M=sn(z/s*q(j));(P-=G*2)>y?(G*=t?1:-1,R+=G,T-=G):(P=0,R=T=(f+c)/2),(S-=M*2)>y?(M*=t?1:-1,m+=M,g-=M):(S=0,m=g=(f+c)/2)}var J=s*H(m),K=s*q(m),N=u*H(T),Q=u*q(T);if(w>y){var U=s*H(g),V=s*q(g),X=u*H(R),Y=u*q(R),E;if(Fy?x>y?(e=W(X,Y,J,K,s,x,t),r=W(U,V,N,Q,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),xy)||!(P>y)?a.lineTo(N,Q):p>y?(e=W(N,Q,U,V,u,-p,t),r=W(J,K,X,Y,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),ps?(this.rect.x-=(this.labelWidth-s)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(s+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(o+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>o?(this.rect.y-=(this.labelHeight-o)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(o+this.labelHeight))}}},i.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==l.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},i.prototype.transform=function(t){var s=this.rect.x;s>e.WORLD_BOUNDARY?s=e.WORLD_BOUNDARY:s<-e.WORLD_BOUNDARY&&(s=-e.WORLD_BOUNDARY);var o=this.rect.y;o>e.WORLD_BOUNDARY?o=e.WORLD_BOUNDARY:o<-e.WORLD_BOUNDARY&&(o=-e.WORLD_BOUNDARY);var c=new f(s,o),h=t.inverseTransformPoint(c);this.setLocation(h.x,h.y)},i.prototype.getLeft=function(){return this.rect.x},i.prototype.getRight=function(){return this.rect.x+this.rect.width},i.prototype.getTop=function(){return this.rect.y},i.prototype.getBottom=function(){return this.rect.y+this.rect.height},i.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},A.exports=i}),(function(A,P,L){var g=L(0);function l(){}for(var a in g)l[a]=g[a];l.MAX_ITERATIONS=2500,l.DEFAULT_EDGE_LENGTH=50,l.DEFAULT_SPRING_STRENGTH=.45,l.DEFAULT_REPULSION_STRENGTH=4500,l.DEFAULT_GRAVITY_STRENGTH=.4,l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,l.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,l.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,l.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,l.COOLING_ADAPTATION_FACTOR=.33,l.ADAPTATION_LOWER_NODE_LIMIT=1e3,l.ADAPTATION_UPPER_NODE_LIMIT=5e3,l.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,l.MAX_NODE_DISPLACEMENT=l.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,l.MIN_REPULSION_DIST=l.DEFAULT_EDGE_LENGTH/10,l.CONVERGENCE_CHECK_PERIOD=100,l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,l.MIN_EDGE_LENGTH=1,l.GRID_CALCULATION_CHECK_PERIOD=10,A.exports=l}),(function(A,P,L){function g(l,a){l==null&&a==null?(this.x=0,this.y=0):(this.x=l,this.y=a)}g.prototype.getX=function(){return this.x},g.prototype.getY=function(){return this.y},g.prototype.setX=function(l){this.x=l},g.prototype.setY=function(l){this.y=l},g.prototype.getDifference=function(l){return new DimensionD(this.x-l.x,this.y-l.y)},g.prototype.getCopy=function(){return new g(this.x,this.y)},g.prototype.translate=function(l){return this.x+=l.width,this.y+=l.height,this},A.exports=g}),(function(A,P,L){var g=L(2),l=L(10),a=L(0),e=L(7),r=L(3),f=L(1),i=L(13),u=L(12),t=L(11);function s(c,h,T){g.call(this,T),this.estimatedSize=l.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=c,h!=null&&h instanceof e?this.graphManager=h:h!=null&&h instanceof Layout&&(this.graphManager=h.graphManager)}s.prototype=Object.create(g.prototype);for(var o in g)s[o]=g[o];s.prototype.getNodes=function(){return this.nodes},s.prototype.getEdges=function(){return this.edges},s.prototype.getGraphManager=function(){return this.graphManager},s.prototype.getParent=function(){return this.parent},s.prototype.getLeft=function(){return this.left},s.prototype.getRight=function(){return this.right},s.prototype.getTop=function(){return this.top},s.prototype.getBottom=function(){return this.bottom},s.prototype.isConnected=function(){return this.isConnected},s.prototype.add=function(c,h,T){if(h==null&&T==null){var d=c;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(d)>-1)throw"Node already in graph!";return d.owner=this,this.getNodes().push(d),d}else{var v=c;if(!(this.getNodes().indexOf(h)>-1&&this.getNodes().indexOf(T)>-1))throw"Source or target not in graph!";if(!(h.owner==T.owner&&h.owner==this))throw"Both owners must be this graph!";return h.owner!=T.owner?null:(v.source=h,v.target=T,v.isInterGraph=!1,this.getEdges().push(v),h.edges.push(v),T!=h&&T.edges.push(v),v)}},s.prototype.remove=function(c){var h=c;if(c instanceof r){if(h==null)throw"Node is null!";if(!(h.owner!=null&&h.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var T=h.edges.slice(),d,v=T.length,N=0;N-1&&G>-1))throw"Source and/or target doesn't know this edge!";d.source.edges.splice(C,1),d.target!=d.source&&d.target.edges.splice(G,1);var F=d.source.owner.getEdges().indexOf(d);if(F==-1)throw"Not in owner's edge list!";d.source.owner.getEdges().splice(F,1)}},s.prototype.updateLeftTop=function(){for(var c=l.MAX_VALUE,h=l.MAX_VALUE,T,d,v,N=this.getNodes(),F=N.length,C=0;CT&&(c=T),h>d&&(h=d)}return c==l.MAX_VALUE?null:(N[0].getParent().paddingLeft!=null?v=N[0].getParent().paddingLeft:v=this.margin,this.left=h-v,this.top=c-v,new u(this.left,this.top))},s.prototype.updateBounds=function(c){for(var h=l.MAX_VALUE,T=-l.MAX_VALUE,d=l.MAX_VALUE,v=-l.MAX_VALUE,N,F,C,G,Z,X=this.nodes,K=X.length,D=0;DN&&(h=N),TC&&(d=C),vN&&(h=N),TC&&(d=C),v=this.nodes.length){var K=0;T.forEach(function(D){D.owner==c&&K++}),K==this.nodes.length&&(this.isConnected=!0)}},A.exports=s}),(function(A,P,L){var g,l=L(1);function a(e){g=L(6),this.layout=e,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var e=this.layout.newGraph(),r=this.layout.newNode(null),f=this.add(e,r);return this.setRootGraph(f),this.rootGraph},a.prototype.add=function(e,r,f,i,u){if(f==null&&i==null&&u==null){if(e==null)throw"Graph is null!";if(r==null)throw"Parent node is null!";if(this.graphs.indexOf(e)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(e),e.parent!=null)throw"Already has a parent!";if(r.child!=null)throw"Already has a child!";return e.parent=r,r.child=e,e}else{u=f,i=r,f=e;var t=i.getOwner(),s=u.getOwner();if(!(t!=null&&t.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(s!=null&&s.getGraphManager()==this))throw"Target not in this graph mgr!";if(t==s)return f.isInterGraph=!1,t.add(f,i,u);if(f.isInterGraph=!0,f.source=i,f.target=u,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},a.prototype.remove=function(e){if(e instanceof g){var r=e;if(r.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(r==this.rootGraph||r.parent!=null&&r.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(r.getEdges());for(var i,u=f.length,t=0;t=e.getRight()?r[0]+=Math.min(e.getX()-a.getX(),a.getRight()-e.getRight()):e.getX()<=a.getX()&&e.getRight()>=a.getRight()&&(r[0]+=Math.min(a.getX()-e.getX(),e.getRight()-a.getRight())),a.getY()<=e.getY()&&a.getBottom()>=e.getBottom()?r[1]+=Math.min(e.getY()-a.getY(),a.getBottom()-e.getBottom()):e.getY()<=a.getY()&&e.getBottom()>=a.getBottom()&&(r[1]+=Math.min(a.getY()-e.getY(),e.getBottom()-a.getBottom()));var u=Math.abs((e.getCenterY()-a.getCenterY())/(e.getCenterX()-a.getCenterX()));e.getCenterY()===a.getCenterY()&&e.getCenterX()===a.getCenterX()&&(u=1);var t=u*r[0],s=r[1]/u;r[0]t)return r[0]=f,r[1]=o,r[2]=u,r[3]=X,!1;if(iu)return r[0]=s,r[1]=i,r[2]=G,r[3]=t,!1;if(fu?(r[0]=h,r[1]=T,n=!0):(r[0]=c,r[1]=o,n=!0):p===y&&(f>u?(r[0]=s,r[1]=o,n=!0):(r[0]=d,r[1]=T,n=!0)),-E===y?u>f?(r[2]=Z,r[3]=X,m=!0):(r[2]=G,r[3]=C,m=!0):E===y&&(u>f?(r[2]=F,r[3]=C,m=!0):(r[2]=K,r[3]=X,m=!0)),n&&m)return!1;if(f>u?i>t?(I=this.getCardinalDirection(p,y,4),w=this.getCardinalDirection(E,y,2)):(I=this.getCardinalDirection(-p,y,3),w=this.getCardinalDirection(-E,y,1)):i>t?(I=this.getCardinalDirection(-p,y,1),w=this.getCardinalDirection(-E,y,3)):(I=this.getCardinalDirection(p,y,2),w=this.getCardinalDirection(E,y,4)),!n)switch(I){case 1:W=o,S=f+-N/y,r[0]=S,r[1]=W;break;case 2:S=d,W=i+v*y,r[0]=S,r[1]=W;break;case 3:W=T,S=f+N/y,r[0]=S,r[1]=W;break;case 4:S=h,W=i+-v*y,r[0]=S,r[1]=W;break}if(!m)switch(w){case 1:q=C,x=u+-rt/y,r[2]=x,r[3]=q;break;case 2:x=K,q=t+D*y,r[2]=x,r[3]=q;break;case 3:q=X,x=u+rt/y,r[2]=x,r[3]=q;break;case 4:x=Z,q=t+-D*y,r[2]=x,r[3]=q;break}}return!1},l.getCardinalDirection=function(a,e,r){return a>e?r:1+r%4},l.getIntersection=function(a,e,r,f){if(f==null)return this.getIntersection2(a,e,r);var i=a.x,u=a.y,t=e.x,s=e.y,o=r.x,c=r.y,h=f.x,T=f.y,d=void 0,v=void 0,N=void 0,F=void 0,C=void 0,G=void 0,Z=void 0,X=void 0,K=void 0;return N=s-u,C=i-t,Z=t*u-i*s,F=T-c,G=o-h,X=h*c-o*T,K=N*G-F*C,K===0?null:(d=(C*X-G*Z)/K,v=(F*Z-N*X)/K,new g(d,v))},l.angleOfVector=function(a,e,r,f){var i=void 0;return a!==r?(i=Math.atan((f-e)/(r-a)),r=0){var T=(-o+Math.sqrt(o*o-4*s*c))/(2*s),d=(-o-Math.sqrt(o*o-4*s*c))/(2*s),v=null;return T>=0&&T<=1?[T]:d>=0&&d<=1?[d]:v}else return null},l.HALF_PI=.5*Math.PI,l.ONE_AND_HALF_PI=1.5*Math.PI,l.TWO_PI=2*Math.PI,l.THREE_PI=3*Math.PI,A.exports=l}),(function(A,P,L){function g(){}g.sign=function(l){return l>0?1:l<0?-1:0},g.floor=function(l){return l<0?Math.ceil(l):Math.floor(l)},g.ceil=function(l){return l<0?Math.floor(l):Math.ceil(l)},A.exports=g}),(function(A,P,L){function g(){}g.MAX_VALUE=2147483647,g.MIN_VALUE=-2147483648,A.exports=g}),(function(A,P,L){var g=(function(){function i(u,t){for(var s=0;s"u"?"undefined":g(a);return a==null||e!="object"&&e!="function"},A.exports=l}),(function(A,P,L){function g(o){if(Array.isArray(o)){for(var c=0,h=Array(o.length);c0&&c;){for(N.push(C[0]);N.length>0&&c;){var G=N[0];N.splice(0,1),v.add(G);for(var Z=G.getEdges(),d=0;d-1&&C.splice(rt,1)}v=new Set,F=new Map}}return o},s.prototype.createDummyNodesForBendpoints=function(o){for(var c=[],h=o.source,T=this.graphManager.calcLowestCommonAncestor(o.source,o.target),d=0;d0){for(var T=this.edgeToDummyNodes.get(h),d=0;d=0&&c.splice(X,1);var K=F.getNeighborsList();K.forEach(function(n){if(h.indexOf(n)<0){var m=T.get(n),p=m-1;p==1&&G.push(n),T.set(n,p)}})}h=h.concat(G),(c.length==1||c.length==2)&&(d=!0,v=c[0])}return v},s.prototype.setGraphManager=function(o){this.graphManager=o},A.exports=s}),(function(A,P,L){function g(){}g.seed=1,g.x=0,g.nextDouble=function(){return g.x=Math.sin(g.seed++)*1e4,g.x-Math.floor(g.x)},A.exports=g}),(function(A,P,L){var g=L(5);function l(a,e){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}l.prototype.getWorldOrgX=function(){return this.lworldOrgX},l.prototype.setWorldOrgX=function(a){this.lworldOrgX=a},l.prototype.getWorldOrgY=function(){return this.lworldOrgY},l.prototype.setWorldOrgY=function(a){this.lworldOrgY=a},l.prototype.getWorldExtX=function(){return this.lworldExtX},l.prototype.setWorldExtX=function(a){this.lworldExtX=a},l.prototype.getWorldExtY=function(){return this.lworldExtY},l.prototype.setWorldExtY=function(a){this.lworldExtY=a},l.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},l.prototype.setDeviceOrgX=function(a){this.ldeviceOrgX=a},l.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},l.prototype.setDeviceOrgY=function(a){this.ldeviceOrgY=a},l.prototype.getDeviceExtX=function(){return this.ldeviceExtX},l.prototype.setDeviceExtX=function(a){this.ldeviceExtX=a},l.prototype.getDeviceExtY=function(){return this.ldeviceExtY},l.prototype.setDeviceExtY=function(a){this.ldeviceExtY=a},l.prototype.transformX=function(a){var e=0,r=this.lworldExtX;return r!=0&&(e=this.ldeviceOrgX+(a-this.lworldOrgX)*this.ldeviceExtX/r),e},l.prototype.transformY=function(a){var e=0,r=this.lworldExtY;return r!=0&&(e=this.ldeviceOrgY+(a-this.lworldOrgY)*this.ldeviceExtY/r),e},l.prototype.inverseTransformX=function(a){var e=0,r=this.ldeviceExtX;return r!=0&&(e=this.lworldOrgX+(a-this.ldeviceOrgX)*this.lworldExtX/r),e},l.prototype.inverseTransformY=function(a){var e=0,r=this.ldeviceExtY;return r!=0&&(e=this.lworldOrgY+(a-this.ldeviceOrgY)*this.lworldExtY/r),e},l.prototype.inverseTransformPoint=function(a){var e=new g(this.inverseTransformX(a.x),this.inverseTransformY(a.y));return e},A.exports=l}),(function(A,P,L){function g(t){if(Array.isArray(t)){for(var s=0,o=Array(t.length);sa.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-a.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>a.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(a.COOLING_ADAPTATION_FACTOR,1-(t-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*(1-a.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*a.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},i.prototype.calcSpringForces=function(){for(var t=this.getAllEdges(),s,o=0;o0&&arguments[0]!==void 0?arguments[0]:!0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o,c,h,T,d=this.getAllNodes(),v;if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&t&&this.updateGrid(),v=new Set,o=0;oN||v>N)&&(t.gravitationForceX=-this.gravityConstant*h,t.gravitationForceY=-this.gravityConstant*T)):(N=s.getEstimatedSize()*this.compoundGravityRangeFactor,(d>N||v>N)&&(t.gravitationForceX=-this.gravityConstant*h*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*T*this.compoundGravityConstant))},i.prototype.isConverged=function(){var t,s=!1;return this.totalIterations>this.maxIterations/3&&(s=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=d.length||N>=d[0].length)){for(var F=0;Fi}}]),r})();A.exports=e}),(function(A,P,L){function g(){}g.svd=function(l){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=l.length,this.n=l[0].length;var a=Math.min(this.m,this.n);this.s=(function(Tt){for(var Ct=[];Tt-- >0;)Ct.push(0);return Ct})(Math.min(this.m+1,this.n)),this.U=(function(Tt){var Ct=function $t(bt){if(bt.length==0)return 0;for(var zt=[],St=0;St0;)Ct.push(0);return Ct})(this.n),r=(function(Tt){for(var Ct=[];Tt-- >0;)Ct.push(0);return Ct})(this.m),f=!0,i=Math.min(this.m-1,this.n),u=Math.max(0,Math.min(this.n-2,this.m)),t=0;t=0;E--)if(this.s[E]!==0){for(var y=E+1;y=0;V--){if((function(Tt,Ct){return Tt&&Ct})(V0;){var Q=void 0,It=void 0;for(Q=n-2;Q>=-1&&Q!==-1;Q--)if(Math.abs(e[Q])<=ht+_*(Math.abs(this.s[Q])+Math.abs(this.s[Q+1]))){e[Q]=0;break}if(Q===n-2)It=4;else{var Nt=void 0;for(Nt=n-1;Nt>=Q&&Nt!==Q;Nt--){var vt=(Nt!==n?Math.abs(e[Nt]):0)+(Nt!==Q+1?Math.abs(e[Nt-1]):0);if(Math.abs(this.s[Nt])<=ht+_*vt){this.s[Nt]=0;break}}Nt===Q?It=3:Nt===n-1?It=1:(It=2,Q=Nt)}switch(Q++,It){case 1:{var it=e[n-2];e[n-2]=0;for(var gt=n-2;gt>=Q;gt--){var mt=g.hypot(this.s[gt],it),At=this.s[gt]/mt,Ot=it/mt;this.s[gt]=mt,gt!==Q&&(it=-Ot*e[gt-1],e[gt-1]=At*e[gt-1]);for(var Et=0;Et=this.s[Q+1]);){var Lt=this.s[Q];if(this.s[Q]=this.s[Q+1],this.s[Q+1]=Lt,QMath.abs(a)?(e=a/l,e=Math.abs(l)*Math.sqrt(1+e*e)):a!=0?(e=l/a,e=Math.abs(a)*Math.sqrt(1+e*e)):e=0,e},A.exports=g}),(function(A,P,L){var g=(function(){function e(r,f){for(var i=0;i2&&arguments[2]!==void 0?arguments[2]:1,u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;l(this,e),this.sequence1=r,this.sequence2=f,this.match_score=i,this.mismatch_penalty=u,this.gap_penalty=t,this.iMax=r.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var s=0;s=0;r--){var f=this.listeners[r];f.event===a&&f.callback===e&&this.listeners.splice(r,1)}},l.emit=function(a,e){for(var r=0;r{var P={45:((a,e,r)=>{var f={};f.layoutBase=r(551),f.CoSEConstants=r(806),f.CoSEEdge=r(767),f.CoSEGraph=r(880),f.CoSEGraphManager=r(578),f.CoSELayout=r(765),f.CoSENode=r(991),f.ConstraintHandler=r(902),a.exports=f}),806:((a,e,r)=>{var f=r(551).FDLayoutConstants;function i(){}for(var u in f)i[u]=f[u];i.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,i.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,i.DEFAULT_COMPONENT_SEPERATION=60,i.TILE=!0,i.TILING_PADDING_VERTICAL=10,i.TILING_PADDING_HORIZONTAL=10,i.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,i.ENFORCE_CONSTRAINTS=!0,i.APPLY_LAYOUT=!0,i.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,i.TREE_REDUCTION_ON_INCREMENTAL=!0,i.PURE_INCREMENTAL=i.DEFAULT_INCREMENTAL,a.exports=i}),767:((a,e,r)=>{var f=r(551).FDLayoutEdge;function i(t,s,o){f.call(this,t,s,o)}i.prototype=Object.create(f.prototype);for(var u in f)i[u]=f[u];a.exports=i}),880:((a,e,r)=>{var f=r(551).LGraph;function i(t,s,o){f.call(this,t,s,o)}i.prototype=Object.create(f.prototype);for(var u in f)i[u]=f[u];a.exports=i}),578:((a,e,r)=>{var f=r(551).LGraphManager;function i(t){f.call(this,t)}i.prototype=Object.create(f.prototype);for(var u in f)i[u]=f[u];a.exports=i}),765:((a,e,r)=>{var f=r(551).FDLayout,i=r(578),u=r(880),t=r(991),s=r(767),o=r(806),c=r(902),h=r(551).FDLayoutConstants,T=r(551).LayoutConstants,d=r(551).Point,v=r(551).PointD,N=r(551).DimensionD,F=r(551).Layout,C=r(551).Integer,G=r(551).IGeometry,Z=r(551).LGraph,X=r(551).Transform,K=r(551).LinkedList;function D(){f.call(this),this.toBeTiled={},this.constraints={}}D.prototype=Object.create(f.prototype);for(var rt in f)D[rt]=f[rt];D.prototype.newGraphManager=function(){var n=new i(this);return this.graphManager=n,n},D.prototype.newGraph=function(n){return new u(null,this.graphManager,n)},D.prototype.newNode=function(n){return new t(this.graphManager,n)},D.prototype.newEdge=function(n){return new s(null,null,n)},D.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(o.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=h.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=h.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=h.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},D.prototype.initSpringEmbedder=function(){f.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/h.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},D.prototype.layout=function(){var n=T.DEFAULT_CREATE_BENDS_AS_NEEDED;return n&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},D.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(o.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var m=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(I){return m.has(I)});this.graphManager.setAllNodesToApplyGravitation(p)}}else{var n=this.getFlatForest();if(n.length>0)this.positionNodesRadially(n);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var m=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(E){return m.has(E)});this.graphManager.setAllNodesToApplyGravitation(p),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),o.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},D.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%h.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 n=new Set(this.getAllNodes()),m=this.nodesWithGravity.filter(function(y){return n.has(y)});this.graphManager.setAllNodesToApplyGravitation(m),this.graphManager.updateBounds(),this.updateGrid(),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=h.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()),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var p=!this.isTreeGrowing&&!this.isGrowthFinished,E=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(p,E),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},D.prototype.getPositionsData=function(){for(var n=this.graphManager.getAllNodes(),m={},p=0;p0&&this.updateDisplacements();for(var p=0;p0&&(E.fixedNodeWeight=I)}}if(this.constraints.relativePlacementConstraint){var w=new Map,S=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(O){n.fixedNodesOnHorizontal.add(O),n.fixedNodesOnVertical.add(O)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var W=this.constraints.alignmentConstraint.vertical,p=0;p=2*O.length/3;_--)H=Math.floor(Math.random()*(_+1)),$=O[_],O[_]=O[H],O[H]=$;return O},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=w.has(O.left)?w.get(O.left):O.left,$=w.has(O.right)?w.get(O.right):O.right;n.nodesInRelativeHorizontal.includes(H)||(n.nodesInRelativeHorizontal.push(H),n.nodeToRelativeConstraintMapHorizontal.set(H,[]),n.dummyToNodeForVerticalAlignment.has(H)?n.nodeToTempPositionMapHorizontal.set(H,n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()):n.nodeToTempPositionMapHorizontal.set(H,n.idToNodeMap.get(H).getCenterX())),n.nodesInRelativeHorizontal.includes($)||(n.nodesInRelativeHorizontal.push($),n.nodeToRelativeConstraintMapHorizontal.set($,[]),n.dummyToNodeForVerticalAlignment.has($)?n.nodeToTempPositionMapHorizontal.set($,n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get($)[0]).getCenterX()):n.nodeToTempPositionMapHorizontal.set($,n.idToNodeMap.get($).getCenterX())),n.nodeToRelativeConstraintMapHorizontal.get(H).push({right:$,gap:O.gap}),n.nodeToRelativeConstraintMapHorizontal.get($).push({left:H,gap:O.gap})}else{var _=S.has(O.top)?S.get(O.top):O.top,ht=S.has(O.bottom)?S.get(O.bottom):O.bottom;n.nodesInRelativeVertical.includes(_)||(n.nodesInRelativeVertical.push(_),n.nodeToRelativeConstraintMapVertical.set(_,[]),n.dummyToNodeForHorizontalAlignment.has(_)?n.nodeToTempPositionMapVertical.set(_,n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(_)[0]).getCenterY()):n.nodeToTempPositionMapVertical.set(_,n.idToNodeMap.get(_).getCenterY())),n.nodesInRelativeVertical.includes(ht)||(n.nodesInRelativeVertical.push(ht),n.nodeToRelativeConstraintMapVertical.set(ht,[]),n.dummyToNodeForHorizontalAlignment.has(ht)?n.nodeToTempPositionMapVertical.set(ht,n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(ht)[0]).getCenterY()):n.nodeToTempPositionMapVertical.set(ht,n.idToNodeMap.get(ht).getCenterY())),n.nodeToRelativeConstraintMapVertical.get(_).push({bottom:ht,gap:O.gap}),n.nodeToRelativeConstraintMapVertical.get(ht).push({top:_,gap:O.gap})}});else{var q=new Map,V=new Map;this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=w.has(O.left)?w.get(O.left):O.left,$=w.has(O.right)?w.get(O.right):O.right;q.has(H)?q.get(H).push($):q.set(H,[$]),q.has($)?q.get($).push(H):q.set($,[H])}else{var _=S.has(O.top)?S.get(O.top):O.top,ht=S.has(O.bottom)?S.get(O.bottom):O.bottom;V.has(_)?V.get(_).push(ht):V.set(_,[ht]),V.has(ht)?V.get(ht).push(_):V.set(ht,[_])}});var Y=function(H,$){var _=[],ht=[],Q=new K,It=new Set,Nt=0;return H.forEach(function(vt,it){if(!It.has(it)){_[Nt]=[],ht[Nt]=!1;var gt=it;for(Q.push(gt),It.add(gt),_[Nt].push(gt);Q.length!=0;){gt=Q.shift(),$.has(gt)&&(ht[Nt]=!0);var mt=H.get(gt);mt.forEach(function(At){It.has(At)||(Q.push(At),It.add(At),_[Nt].push(At))})}Nt++}}),{components:_,isFixed:ht}},et=Y(q,n.fixedNodesOnHorizontal);this.componentsOnHorizontal=et.components,this.fixedComponentsOnHorizontal=et.isFixed;var z=Y(V,n.fixedNodesOnVertical);this.componentsOnVertical=z.components,this.fixedComponentsOnVertical=z.isFixed}}},D.prototype.updateDisplacements=function(){var n=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(z){var O=n.idToNodeMap.get(z.nodeId);O.displacementX=0,O.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var m=this.constraints.alignmentConstraint.vertical,p=0;p1){var S;for(S=0;SE&&(E=Math.floor(w.y)),I=Math.floor(w.x+o.DEFAULT_COMPONENT_SEPERATION)}this.transform(new v(T.WORLD_CENTER_X-w.x/2,T.WORLD_CENTER_Y-w.y/2))},D.radialLayout=function(n,m,p){var E=Math.max(this.maxDiagonalInTree(n),o.DEFAULT_RADIAL_SEPARATION);D.branchRadialLayout(m,null,0,359,0,E);var y=Z.calculateBounds(n),I=new X;I.setDeviceOrgX(y.getMinX()),I.setDeviceOrgY(y.getMinY()),I.setWorldOrgX(p.x),I.setWorldOrgY(p.y);for(var w=0;w1;){var $=H[0];H.splice(0,1);var _=V.indexOf($);_>=0&&V.splice(_,1),z--,Y--}m!=null?O=(V.indexOf(H[0])+1)%z:O=0;for(var ht=Math.abs(E-p)/Y,Q=O;et!=Y;Q=++Q%z){var It=V[Q].getOtherEnd(n);if(It!=m){var Nt=(p+et*ht)%360,vt=(Nt+ht)%360;D.branchRadialLayout(It,n,Nt,vt,y+I,I),et++}}},D.maxDiagonalInTree=function(n){for(var m=C.MIN_VALUE,p=0;pm&&(m=y)}return m},D.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},D.prototype.groupZeroDegreeMembers=function(){var n=this,m={};this.memberGroups={},this.idToDummyNode={};for(var p=[],E=this.graphManager.getAllNodes(),y=0;y"u"&&(m[S]=[]),m[S]=m[S].concat(I)}Object.keys(m).forEach(function(W){if(m[W].length>1){var x="DummyCompound_"+W;n.memberGroups[x]=m[W];var q=m[W][0].getParent(),V=new t(n.graphManager);V.id=x,V.paddingLeft=q.paddingLeft||0,V.paddingRight=q.paddingRight||0,V.paddingBottom=q.paddingBottom||0,V.paddingTop=q.paddingTop||0,n.idToDummyNode[x]=V;var Y=n.getGraphManager().add(n.newGraph(),V),et=q.getChild();et.add(V);for(var z=0;zy?(E.rect.x-=(E.labelWidth-y)/2,E.setWidth(E.labelWidth),E.labelMarginLeft=(E.labelWidth-y)/2):E.labelPosHorizontal=="right"&&E.setWidth(y+E.labelWidth)),E.labelHeight&&(E.labelPosVertical=="top"?(E.rect.y-=E.labelHeight,E.setHeight(I+E.labelHeight),E.labelMarginTop=E.labelHeight):E.labelPosVertical=="center"&&E.labelHeight>I?(E.rect.y-=(E.labelHeight-I)/2,E.setHeight(E.labelHeight),E.labelMarginTop=(E.labelHeight-I)/2):E.labelPosVertical=="bottom"&&E.setHeight(I+E.labelHeight))}})},D.prototype.repopulateCompounds=function(){for(var n=this.compoundOrder.length-1;n>=0;n--){var m=this.compoundOrder[n],p=m.id,E=m.paddingLeft,y=m.paddingTop,I=m.labelMarginLeft,w=m.labelMarginTop;this.adjustLocations(this.tiledMemberPack[p],m.rect.x,m.rect.y,E,y,I,w)}},D.prototype.repopulateZeroDegreeMembers=function(){var n=this,m=this.tiledZeroDegreePack;Object.keys(m).forEach(function(p){var E=n.idToDummyNode[p],y=E.paddingLeft,I=E.paddingTop,w=E.labelMarginLeft,S=E.labelMarginTop;n.adjustLocations(m[p],E.rect.x,E.rect.y,y,I,w,S)})},D.prototype.getToBeTiled=function(n){var m=n.id;if(this.toBeTiled[m]!=null)return this.toBeTiled[m];var p=n.getChild();if(p==null)return this.toBeTiled[m]=!1,!1;for(var E=p.getNodes(),y=0;y0)return this.toBeTiled[m]=!1,!1;if(I.getChild()==null){this.toBeTiled[I.id]=!1;continue}if(!this.getToBeTiled(I))return this.toBeTiled[m]=!1,!1}return this.toBeTiled[m]=!0,!0},D.prototype.getNodeDegree=function(n){n.id;for(var m=n.getEdges(),p=0,E=0;Eq&&(q=Y.rect.height)}p+=q+n.verticalPadding}},D.prototype.tileCompoundMembers=function(n,m){var p=this;this.tiledMemberPack=[],Object.keys(n).forEach(function(E){var y=m[E];if(p.tiledMemberPack[E]=p.tileNodes(n[E],y.paddingLeft+y.paddingRight),y.rect.width=p.tiledMemberPack[E].width,y.rect.height=p.tiledMemberPack[E].height,y.setCenter(p.tiledMemberPack[E].centerX,p.tiledMemberPack[E].centerY),y.labelMarginLeft=0,y.labelMarginTop=0,o.NODE_DIMENSIONS_INCLUDE_LABELS){var I=y.rect.width,w=y.rect.height;y.labelWidth&&(y.labelPosHorizontal=="left"?(y.rect.x-=y.labelWidth,y.setWidth(I+y.labelWidth),y.labelMarginLeft=y.labelWidth):y.labelPosHorizontal=="center"&&y.labelWidth>I?(y.rect.x-=(y.labelWidth-I)/2,y.setWidth(y.labelWidth),y.labelMarginLeft=(y.labelWidth-I)/2):y.labelPosHorizontal=="right"&&y.setWidth(I+y.labelWidth)),y.labelHeight&&(y.labelPosVertical=="top"?(y.rect.y-=y.labelHeight,y.setHeight(w+y.labelHeight),y.labelMarginTop=y.labelHeight):y.labelPosVertical=="center"&&y.labelHeight>w?(y.rect.y-=(y.labelHeight-w)/2,y.setHeight(y.labelHeight),y.labelMarginTop=(y.labelHeight-w)/2):y.labelPosVertical=="bottom"&&y.setHeight(w+y.labelHeight))}})},D.prototype.tileNodes=function(n,m){var p=this.tileNodesByFavoringDim(n,m,!0),E=this.tileNodesByFavoringDim(n,m,!1),y=this.getOrgRatio(p),I=this.getOrgRatio(E),w;return IS&&(S=z.getWidth())});var W=I/y,x=w/y,q=Math.pow(p-E,2)+4*(W+E)*(x+p)*y,V=(E-p+Math.sqrt(q))/(2*(W+E)),Y;m?(Y=Math.ceil(V),Y==V&&Y++):Y=Math.floor(V);var et=Y*(W+E)-E;return S>et&&(et=S),et+=E*2,et},D.prototype.tileNodesByFavoringDim=function(n,m,p){var E=o.TILING_PADDING_VERTICAL,y=o.TILING_PADDING_HORIZONTAL,I=o.TILING_COMPARE_BY,w={rows:[],rowWidth:[],rowHeight:[],width:0,height:m,verticalPadding:E,horizontalPadding:y,centerX:0,centerY:0};I&&(w.idealRowWidth=this.calcIdealRowWidth(n,p));var S=function(O){return O.rect.width*O.rect.height},W=function(O,H){return S(H)-S(O)};n.sort(function(z,O){var H=W;return w.idealRowWidth?(H=I,H(z.id,O.id)):H(z,O)});for(var x=0,q=0,V=0;V0&&(w+=n.horizontalPadding),n.rowWidth[p]=w,n.width0&&(S+=n.verticalPadding);var W=0;S>n.rowHeight[p]&&(W=n.rowHeight[p],n.rowHeight[p]=S,W=n.rowHeight[p]-W),n.height+=W,n.rows[p].push(m)},D.prototype.getShortestRowIndex=function(n){for(var m=-1,p=Number.MAX_VALUE,E=0;Ep&&(m=E,p=n.rowWidth[E]);return m},D.prototype.canAddHorizontal=function(n,m,p){if(n.idealRowWidth){var E=n.rows.length-1,y=n.rowWidth[E];return y+m+n.horizontalPadding<=n.idealRowWidth}var I=this.getShortestRowIndex(n);if(I<0)return!0;var w=n.rowWidth[I];if(w+n.horizontalPadding+m<=n.width)return!0;var S=0;n.rowHeight[I]0&&(S=p+n.verticalPadding-n.rowHeight[I]);var W;n.width-w>=m+n.horizontalPadding?W=(n.height+S)/(w+m+n.horizontalPadding):W=(n.height+S)/n.width,S=p+n.verticalPadding;var x;return n.widthI&&m!=p){E.splice(-1,1),n.rows[p].push(y),n.rowWidth[m]=n.rowWidth[m]-I,n.rowWidth[p]=n.rowWidth[p]+I,n.width=n.rowWidth[instance.getLongestRowIndex(n)];for(var w=Number.MIN_VALUE,S=0;Sw&&(w=E[S].height);m>0&&(w+=n.verticalPadding);var W=n.rowHeight[m]+n.rowHeight[p];n.rowHeight[m]=w,n.rowHeight[p]0)for(var et=y;et<=I;et++)Y[0]+=this.grid[et][w-1].length+this.grid[et][w].length-1;if(I0)for(var et=w;et<=S;et++)Y[3]+=this.grid[y-1][et].length+this.grid[y][et].length-1;for(var z=C.MAX_VALUE,O,H,$=0;${var f=r(551).FDLayoutNode,i=r(551).IMath;function u(s,o,c,h){f.call(this,s,o,c,h)}u.prototype=Object.create(f.prototype);for(var t in f)u[t]=f[t];u.prototype.calculateDisplacement=function(){var s=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementX=s.coolingFactor*s.maxNodeDisplacement*i.sign(this.displacementX)),Math.abs(this.displacementY)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementY=s.coolingFactor*s.maxNodeDisplacement*i.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},u.prototype.propogateDisplacementToChildren=function(s,o){for(var c=this.getChild().getNodes(),h,T=0;T{function f(c){if(Array.isArray(c)){for(var h=0,T=Array(c.length);h0){var Lt=0;ot.forEach(function(st){B=="horizontal"?(tt.set(st,d.has(st)?v[d.get(st)]:k.get(st)),Lt+=tt.get(st)):(tt.set(st,d.has(st)?N[d.get(st)]:k.get(st)),Lt+=tt.get(st))}),Lt=Lt/ot.length,lt.forEach(function(st){J.has(st)||tt.set(st,Lt)})}else{var ft=0;lt.forEach(function(st){B=="horizontal"?ft+=d.has(st)?v[d.get(st)]:k.get(st):ft+=d.has(st)?N[d.get(st)]:k.get(st)}),ft=ft/lt.length,lt.forEach(function(st){tt.set(st,ft)})}});for(var wt=function(){var ot=ut.shift(),Lt=U.get(ot);Lt.forEach(function(ft){if(tt.get(ft.id)st&&(st=kt),KtXt&&(Xt=Kt)}}catch(ee){Ct=!0,$t=ee}finally{try{!Tt&&bt.return&&bt.return()}finally{if(Ct)throw $t}}var ce=(Lt+st)/2-(ft+Xt)/2,Qt=!0,jt=!1,_t=void 0;try{for(var Jt=lt[Symbol.iterator](),oe;!(Qt=(oe=Jt.next()).done);Qt=!0){var te=oe.value;tt.set(te,tt.get(te)+ce)}}catch(ee){jt=!0,_t=ee}finally{try{!Qt&&Jt.return&&Jt.return()}finally{if(jt)throw _t}}})}return tt},rt=function(U){var B=0,J=0,k=0,at=0;if(U.forEach(function(j){j.left?v[d.get(j.left)]-v[d.get(j.right)]>=0?B++:J++:N[d.get(j.top)]-N[d.get(j.bottom)]>=0?k++:at++}),B>J&&k>at)for(var ct=0;ctJ)for(var nt=0;ntat)for(var tt=0;tt1)h.fixedNodeConstraint.forEach(function(b,U){E[U]=[b.position.x,b.position.y],y[U]=[v[d.get(b.nodeId)],N[d.get(b.nodeId)]]}),I=!0;else if(h.alignmentConstraint)(function(){var b=0;if(h.alignmentConstraint.vertical){for(var U=h.alignmentConstraint.vertical,B=function(tt){var j=new Set;U[tt].forEach(function(pt){j.add(pt)});var ut=new Set([].concat(f(j)).filter(function(pt){return S.has(pt)})),wt=void 0;ut.size>0?wt=v[d.get(ut.values().next().value)]:wt=K(j).x,U[tt].forEach(function(pt){E[b]=[wt,N[d.get(pt)]],y[b]=[v[d.get(pt)],N[d.get(pt)]],b++})},J=0;J0?wt=v[d.get(ut.values().next().value)]:wt=K(j).y,k[tt].forEach(function(pt){E[b]=[v[d.get(pt)],wt],y[b]=[v[d.get(pt)],N[d.get(pt)]],b++})},ct=0;ctV&&(V=q[et].length,Y=et);if(V0){var Et={x:0,y:0};h.fixedNodeConstraint.forEach(function(b,U){var B={x:v[d.get(b.nodeId)],y:N[d.get(b.nodeId)]},J=b.position,k=X(J,B);Et.x+=k.x,Et.y+=k.y}),Et.x/=h.fixedNodeConstraint.length,Et.y/=h.fixedNodeConstraint.length,v.forEach(function(b,U){v[U]+=Et.x}),N.forEach(function(b,U){N[U]+=Et.y}),h.fixedNodeConstraint.forEach(function(b){v[d.get(b.nodeId)]=b.position.x,N[d.get(b.nodeId)]=b.position.y})}if(h.alignmentConstraint){if(h.alignmentConstraint.vertical)for(var Dt=h.alignmentConstraint.vertical,Rt=function(U){var B=new Set;Dt[U].forEach(function(at){B.add(at)});var J=new Set([].concat(f(B)).filter(function(at){return S.has(at)})),k=void 0;J.size>0?k=v[d.get(J.values().next().value)]:k=K(B).x,B.forEach(function(at){S.has(at)||(v[d.get(at)]=k)})},Ht=0;Ht0?k=N[d.get(J.values().next().value)]:k=K(B).y,B.forEach(function(at){S.has(at)||(N[d.get(at)]=k)})},Ft=0;Ft{a.exports=A})},L={};function g(a){var e=L[a];if(e!==void 0)return e.exports;var r=L[a]={exports:{}};return P[a](r,r.exports,g),r.exports}var l=g(45);return l})()})})(le)),le.exports}var pr=he.exports,De;function yr(){return De||(De=1,(function(R,M){(function(P,L){R.exports=L(vr())})(pr,function(A){return(()=>{var P={658:(a=>{a.exports=Object.assign!=null?Object.assign.bind(Object):function(e){for(var r=arguments.length,f=Array(r>1?r-1:0),i=1;i{var f=(function(){function t(s,o){var c=[],h=!0,T=!1,d=void 0;try{for(var v=s[Symbol.iterator](),N;!(h=(N=v.next()).done)&&(c.push(N.value),!(o&&c.length===o));h=!0);}catch(F){T=!0,d=F}finally{try{!h&&v.return&&v.return()}finally{if(T)throw d}}return c}return function(s,o){if(Array.isArray(s))return s;if(Symbol.iterator in Object(s))return t(s,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),i=r(140).layoutBase.LinkedList,u={};u.getTopMostNodes=function(t){for(var s={},o=0;o0&&I.merge(x)});for(var w=0;w1){N=d[0],F=N.connectedEdges().length,d.forEach(function(y){y.connectedEdges().length0&&c.set("dummy"+(c.size+1),Z),X},u.relocateComponent=function(t,s,o){if(!o.fixedNodeConstraint){var c=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY,d=Number.NEGATIVE_INFINITY;if(o.quality=="draft"){var v=!0,N=!1,F=void 0;try{for(var C=s.nodeIndexes[Symbol.iterator](),G;!(v=(G=C.next()).done);v=!0){var Z=G.value,X=f(Z,2),K=X[0],D=X[1],rt=o.cy.getElementById(K);if(rt){var n=rt.boundingBox(),m=s.xCoords[D]-n.w/2,p=s.xCoords[D]+n.w/2,E=s.yCoords[D]-n.h/2,y=s.yCoords[D]+n.h/2;mh&&(h=p),Ed&&(d=y)}}}catch(x){N=!0,F=x}finally{try{!v&&C.return&&C.return()}finally{if(N)throw F}}var I=t.x-(h+c)/2,w=t.y-(d+T)/2;s.xCoords=s.xCoords.map(function(x){return x+I}),s.yCoords=s.yCoords.map(function(x){return x+w})}else{Object.keys(s).forEach(function(x){var q=s[x],V=q.getRect().x,Y=q.getRect().x+q.getRect().width,et=q.getRect().y,z=q.getRect().y+q.getRect().height;Vh&&(h=Y),etd&&(d=z)});var S=t.x-(h+c)/2,W=t.y-(d+T)/2;Object.keys(s).forEach(function(x){var q=s[x];q.setCenter(q.getCenterX()+S,q.getCenterY()+W)})}}},u.calcBoundingBox=function(t,s,o,c){for(var h=Number.MAX_SAFE_INTEGER,T=Number.MIN_SAFE_INTEGER,d=Number.MAX_SAFE_INTEGER,v=Number.MIN_SAFE_INTEGER,N=void 0,F=void 0,C=void 0,G=void 0,Z=t.descendants().not(":parent"),X=Z.length,K=0;KN&&(h=N),TC&&(d=C),v{var f=r(548),i=r(140).CoSELayout,u=r(140).CoSENode,t=r(140).layoutBase.PointD,s=r(140).layoutBase.DimensionD,o=r(140).layoutBase.LayoutConstants,c=r(140).layoutBase.FDLayoutConstants,h=r(140).CoSEConstants,T=function(v,N){var F=v.cy,C=v.eles,G=C.nodes(),Z=C.edges(),X=void 0,K=void 0,D=void 0,rt={};v.randomize&&(X=N.nodeIndexes,K=N.xCoords,D=N.yCoords);var n=function(x){return typeof x=="function"},m=function(x,q){return n(x)?x(q):x},p=f.calcParentsWithoutChildren(F,C),E=function W(x,q,V,Y){for(var et=q.length,z=0;z0){var Q=void 0;Q=V.getGraphManager().add(V.newGraph(),$),W(Q,H,V,Y)}}},y=function(x,q,V){for(var Y=0,et=0,z=0;z0?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=Y/et:n(v.idealEdgeLength)?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=v.idealEdgeLength,h.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,h.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)},I=function(x,q){q.fixedNodeConstraint&&(x.constraints.fixedNodeConstraint=q.fixedNodeConstraint),q.alignmentConstraint&&(x.constraints.alignmentConstraint=q.alignmentConstraint),q.relativePlacementConstraint&&(x.constraints.relativePlacementConstraint=q.relativePlacementConstraint)};v.nestingFactor!=null&&(h.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=v.nestingFactor),v.gravity!=null&&(h.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=v.gravity),v.numIter!=null&&(h.MAX_ITERATIONS=c.MAX_ITERATIONS=v.numIter),v.gravityRange!=null&&(h.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=v.gravityRange),v.gravityCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=v.gravityCompound),v.gravityRangeCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=v.gravityRangeCompound),v.initialEnergyOnIncremental!=null&&(h.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=v.initialEnergyOnIncremental),v.tilingCompareBy!=null&&(h.TILING_COMPARE_BY=v.tilingCompareBy),v.quality=="proof"?o.QUALITY=2:o.QUALITY=0,h.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=v.nodeDimensionsIncludeLabels,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!v.randomize,h.ANIMATE=c.ANIMATE=o.ANIMATE=v.animate,h.TILE=v.tile,h.TILING_PADDING_VERTICAL=typeof v.tilingPaddingVertical=="function"?v.tilingPaddingVertical.call():v.tilingPaddingVertical,h.TILING_PADDING_HORIZONTAL=typeof v.tilingPaddingHorizontal=="function"?v.tilingPaddingHorizontal.call():v.tilingPaddingHorizontal,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!0,h.PURE_INCREMENTAL=!v.randomize,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=v.uniformNodeDimensions,v.step=="transformed"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!1),v.step=="enforced"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!1),v.step=="cose"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!0),v.step=="all"&&(v.randomize?h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!0),v.fixedNodeConstraint||v.alignmentConstraint||v.relativePlacementConstraint?h.TREE_REDUCTION_ON_INCREMENTAL=!1:h.TREE_REDUCTION_ON_INCREMENTAL=!0;var w=new i,S=w.newGraphManager();return E(S.addRoot(),f.getTopMostNodes(G),w,v),y(w,S,Z),I(w,v),w.runLayout(),rt};a.exports={coseLayout:T}}),212:((a,e,r)=>{var f=(function(){function v(N,F){for(var C=0;C0)if(p){var I=t.getTopMostNodes(C.eles.nodes());if(D=t.connectComponents(G,C.eles,I),D.forEach(function(vt){var it=vt.boundingBox();rt.push({x:it.x1+it.w/2,y:it.y1+it.h/2})}),C.randomize&&D.forEach(function(vt){C.eles=vt,X.push(o(C))}),C.quality=="default"||C.quality=="proof"){var w=G.collection();if(C.tile){var S=new Map,W=[],x=[],q=0,V={nodeIndexes:S,xCoords:W,yCoords:x},Y=[];if(D.forEach(function(vt,it){vt.edges().length==0&&(vt.nodes().forEach(function(gt,mt){w.merge(vt.nodes()[mt]),gt.isParent()||(V.nodeIndexes.set(vt.nodes()[mt].id(),q++),V.xCoords.push(vt.nodes()[0].position().x),V.yCoords.push(vt.nodes()[0].position().y))}),Y.push(it))}),w.length>1){var et=w.boundingBox();rt.push({x:et.x1+et.w/2,y:et.y1+et.h/2}),D.push(w),X.push(V);for(var z=Y.length-1;z>=0;z--)D.splice(Y[z],1),X.splice(Y[z],1),rt.splice(Y[z],1)}}D.forEach(function(vt,it){C.eles=vt,K.push(h(C,X[it])),t.relocateComponent(rt[it],K[it],C)})}else D.forEach(function(vt,it){t.relocateComponent(rt[it],X[it],C)});var O=new Set;if(D.length>1){var H=[],$=Z.filter(function(vt){return vt.css("display")=="none"});D.forEach(function(vt,it){var gt=void 0;if(C.quality=="draft"&&(gt=X[it].nodeIndexes),vt.nodes().not($).length>0){var mt={};mt.edges=[],mt.nodes=[];var At=void 0;vt.nodes().not($).forEach(function(Ot){if(C.quality=="draft")if(!Ot.isParent())At=gt.get(Ot.id()),mt.nodes.push({x:X[it].xCoords[At]-Ot.boundingbox().w/2,y:X[it].yCoords[At]-Ot.boundingbox().h/2,width:Ot.boundingbox().w,height:Ot.boundingbox().h});else{var Et=t.calcBoundingBox(Ot,X[it].xCoords,X[it].yCoords,gt);mt.nodes.push({x:Et.topLeftX,y:Et.topLeftY,width:Et.width,height:Et.height})}else K[it][Ot.id()]&&mt.nodes.push({x:K[it][Ot.id()].getLeft(),y:K[it][Ot.id()].getTop(),width:K[it][Ot.id()].getWidth(),height:K[it][Ot.id()].getHeight()})}),vt.edges().forEach(function(Ot){var Et=Ot.source(),Dt=Ot.target();if(Et.css("display")!="none"&&Dt.css("display")!="none")if(C.quality=="draft"){var Rt=gt.get(Et.id()),Ht=gt.get(Dt.id()),Ut=[],Pt=[];if(Et.isParent()){var Ft=t.calcBoundingBox(Et,X[it].xCoords,X[it].yCoords,gt);Ut.push(Ft.topLeftX+Ft.width/2),Ut.push(Ft.topLeftY+Ft.height/2)}else Ut.push(X[it].xCoords[Rt]),Ut.push(X[it].yCoords[Rt]);if(Dt.isParent()){var Yt=t.calcBoundingBox(Dt,X[it].xCoords,X[it].yCoords,gt);Pt.push(Yt.topLeftX+Yt.width/2),Pt.push(Yt.topLeftY+Yt.height/2)}else Pt.push(X[it].xCoords[Ht]),Pt.push(X[it].yCoords[Ht]);mt.edges.push({startX:Ut[0],startY:Ut[1],endX:Pt[0],endY:Pt[1]})}else K[it][Et.id()]&&K[it][Dt.id()]&&mt.edges.push({startX:K[it][Et.id()].getCenterX(),startY:K[it][Et.id()].getCenterY(),endX:K[it][Dt.id()].getCenterX(),endY:K[it][Dt.id()].getCenterY()})}),mt.nodes.length>0&&(H.push(mt),O.add(it))}});var _=m.packComponents(H,C.randomize).shifts;if(C.quality=="draft")X.forEach(function(vt,it){var gt=vt.xCoords.map(function(At){return At+_[it].dx}),mt=vt.yCoords.map(function(At){return At+_[it].dy});vt.xCoords=gt,vt.yCoords=mt});else{var ht=0;O.forEach(function(vt){Object.keys(K[vt]).forEach(function(it){var gt=K[vt][it];gt.setCenter(gt.getCenterX()+_[ht].dx,gt.getCenterY()+_[ht].dy)}),ht++})}}}else{var E=C.eles.boundingBox();if(rt.push({x:E.x1+E.w/2,y:E.y1+E.h/2}),C.randomize){var y=o(C);X.push(y)}C.quality=="default"||C.quality=="proof"?(K.push(h(C,X[0])),t.relocateComponent(rt[0],K[0],C)):t.relocateComponent(rt[0],X[0],C)}var Q=function(it,gt){if(C.quality=="default"||C.quality=="proof"){typeof it=="number"&&(it=gt);var mt=void 0,At=void 0,Ot=it.data("id");return K.forEach(function(Dt){Ot in Dt&&(mt={x:Dt[Ot].getRect().getCenterX(),y:Dt[Ot].getRect().getCenterY()},At=Dt[Ot])}),C.nodeDimensionsIncludeLabels&&(At.labelWidth&&(At.labelPosHorizontal=="left"?mt.x+=At.labelWidth/2:At.labelPosHorizontal=="right"&&(mt.x-=At.labelWidth/2)),At.labelHeight&&(At.labelPosVertical=="top"?mt.y+=At.labelHeight/2:At.labelPosVertical=="bottom"&&(mt.y-=At.labelHeight/2))),mt==null&&(mt={x:it.position("x"),y:it.position("y")}),{x:mt.x,y:mt.y}}else{var Et=void 0;return X.forEach(function(Dt){var Rt=Dt.nodeIndexes.get(it.id());Rt!=null&&(Et={x:Dt.xCoords[Rt],y:Dt.yCoords[Rt]})}),Et==null&&(Et={x:it.position("x"),y:it.position("y")}),{x:Et.x,y:Et.y}}};if(C.quality=="default"||C.quality=="proof"||C.randomize){var It=t.calcParentsWithoutChildren(G,Z),Nt=Z.filter(function(vt){return vt.css("display")=="none"});C.eles=Z.not(Nt),Z.nodes().not(":parent").not(Nt).layoutPositions(F,C,Q),It.length>0&&It.forEach(function(vt){vt.position(Q(vt))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),v})();a.exports=d}),657:((a,e,r)=>{var f=r(548),i=r(140).layoutBase.Matrix,u=r(140).layoutBase.SVD,t=function(o){var c=o.cy,h=o.eles,T=h.nodes(),d=h.nodes(":parent"),v=new Map,N=new Map,F=new Map,C=[],G=[],Z=[],X=[],K=[],D=[],rt=[],n=[],m=void 0,p=1e8,E=1e-9,y=o.piTol,I=o.samplingType,w=o.nodeSeparation,S=void 0,W=function(){for(var U=0,B=0,J=!1;B=at;){nt=k[at++];for(var xt=C[nt],lt=0;ltut&&(ut=K[Lt],wt=Lt)}return wt},q=function(U){var B=void 0;if(U){B=Math.floor(Math.random()*m);for(var k=0;k=1)break;j=tt}for(var pt=0;pt=1)break;j=tt}for(var lt=0;lt0&&(B.isParent()?C[U].push(F.get(B.id())):C[U].push(B.id()))})});var Nt=function(U){var B=N.get(U),J=void 0;v.get(U).forEach(function(k){c.getElementById(k).isParent()?J=F.get(k):J=k,C[B].push(J),C[N.get(J)].push(U)})},vt=!0,it=!1,gt=void 0;try{for(var mt=v.keys()[Symbol.iterator](),At;!(vt=(At=mt.next()).done);vt=!0){var Ot=At.value;Nt(Ot)}}catch(b){it=!0,gt=b}finally{try{!vt&&mt.return&&mt.return()}finally{if(it)throw gt}}m=N.size;var Et=void 0;if(m>2){S=m{var f=r(212),i=function(t){t&&t("layout","fcose",f)};typeof cytoscape<"u"&&i(cytoscape),a.exports=i}),140:(a=>{a.exports=A})},L={};function g(a){var e=L[a];if(e!==void 0)return e.exports;var r=L[a]={exports:{}};return P[a](r,r.exports,g),r.exports}var l=g(579);return l})()})})(he)),he.exports}var Er=yr();const mr=cr(Er);var xe={L:"left",R:"right",T:"top",B:"bottom"},Ie={L:dt(R=>`${R},${R/2} 0,${R} 0,0`,"L"),R:dt(R=>`0,${R/2} ${R},0 ${R},${R}`,"R"),T:dt(R=>`0,0 ${R},0 ${R/2},${R}`,"T"),B:dt(R=>`${R/2},0 ${R},${R} 0,${R}`,"B")},se={L:dt((R,M)=>R-M+2,"L"),R:dt((R,M)=>R-2,"R"),T:dt((R,M)=>R-M+2,"T"),B:dt((R,M)=>R-2,"B")},Tr=dt(function(R){return Wt(R)?R==="L"?"R":"L":R==="T"?"B":"T"},"getOppositeArchitectureDirection"),Re=dt(function(R){const M=R;return M==="L"||M==="R"||M==="T"||M==="B"},"isArchitectureDirection"),Wt=dt(function(R){const M=R;return M==="L"||M==="R"},"isArchitectureDirectionX"),qt=dt(function(R){const M=R;return M==="T"||M==="B"},"isArchitectureDirectionY"),Te=dt(function(R,M){const A=Wt(R)&&qt(M),P=qt(R)&&Wt(M);return A||P},"isArchitectureDirectionXY"),Nr=dt(function(R){const M=R[0],A=R[1],P=Wt(M)&&qt(A),L=qt(M)&&Wt(A);return P||L},"isArchitecturePairXY"),Lr=dt(function(R){return R!=="LL"&&R!=="RR"&&R!=="TT"&&R!=="BB"},"isValidArchitectureDirectionPair"),ye=dt(function(R,M){const A=`${R}${M}`;return Lr(A)?A:void 0},"getArchitectureDirectionPair"),Cr=dt(function([R,M],A){const P=A[0],L=A[1];return Wt(P)?qt(L)?[R+(P==="L"?-1:1),M+(L==="T"?1:-1)]:[R+(P==="L"?-1:1),M]:Wt(L)?[R+(L==="L"?1:-1),M+(P==="T"?1:-1)]:[R,M+(P==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Ar=dt(function(R){return R==="LT"||R==="TL"?[1,1]:R==="BL"||R==="LB"?[1,-1]:R==="BR"||R==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),wr=dt(function(R,M){return Te(R,M)?"bend":Wt(R)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Mr=dt(function(R){return R.type==="service"},"isArchitectureService"),Or=dt(function(R){return R.type==="junction"},"isArchitectureJunction"),be=dt(R=>R.data(),"edgeData"),ie=dt(R=>R.data(),"nodeData"),Dr=rr.architecture,ae,Pe=(ae=class{constructor(){this.nodes={},this.groups={},this.edges=[],this.registeredIds={},this.elements={},this.diagramId="",this.setAccTitle=qe,this.getAccTitle=Qe,this.setDiagramTitle=Je,this.getDiagramTitle=Ke,this.getAccDescription=je,this.setAccDescription=_e,this.clear()}setDiagramId(M){this.diagramId=M}getDiagramId(){return this.diagramId}clear(){this.nodes={},this.groups={},this.edges=[],this.registeredIds={},this.dataStructures=void 0,this.elements={},this.diagramId="",tr()}addService({id:M,icon:A,in:P,title:L,iconText:g}){if(this.registeredIds[M]!==void 0)throw new Error(`The service id [${M}] is already in use by another ${this.registeredIds[M]}`);if(P!==void 0){if(M===P)throw new Error(`The service [${M}] cannot be placed within itself`);if(this.registeredIds[P]===void 0)throw new Error(`The service [${M}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds[P]==="node")throw new Error(`The service [${M}]'s parent is not a group`)}this.registeredIds[M]="node",this.nodes[M]={id:M,type:"service",icon:A,iconText:g,title:L,edges:[],in:P}}getServices(){return Object.values(this.nodes).filter(Mr)}addJunction({id:M,in:A}){if(this.registeredIds[M]!==void 0)throw new Error(`The junction id [${M}] is already in use by another ${this.registeredIds[M]}`);if(A!==void 0){if(M===A)throw new Error(`The junction [${M}] cannot be placed within itself`);if(this.registeredIds[A]===void 0)throw new Error(`The junction [${M}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds[A]==="node")throw new Error(`The junction [${M}]'s parent is not a group`)}this.registeredIds[M]="node",this.nodes[M]={id:M,type:"junction",edges:[],in:A}}getJunctions(){return Object.values(this.nodes).filter(Or)}getNodes(){return Object.values(this.nodes)}getNode(M){return this.nodes[M]??null}addGroup({id:M,icon:A,in:P,title:L}){var g,l,a;if(((g=this.registeredIds)==null?void 0:g[M])!==void 0)throw new Error(`The group id [${M}] is already in use by another ${this.registeredIds[M]}`);if(P!==void 0){if(M===P)throw new Error(`The group [${M}] cannot be placed within itself`);if(((l=this.registeredIds)==null?void 0:l[P])===void 0)throw new Error(`The group [${M}]'s parent does not exist. Please make sure the parent is created before this group`);if(((a=this.registeredIds)==null?void 0:a[P])==="node")throw new Error(`The group [${M}]'s parent is not a group`)}this.registeredIds[M]="group",this.groups[M]={id:M,icon:A,title:L,in:P}}getGroups(){return Object.values(this.groups)}addEdge({lhsId:M,rhsId:A,lhsDir:P,rhsDir:L,lhsInto:g,rhsInto:l,lhsGroup:a,rhsGroup:e,title:r}){if(!Re(P))throw new Error(`Invalid direction given for left hand side of edge ${M}--${A}. Expected (L,R,T,B) got ${String(P)}`);if(!Re(L))throw new Error(`Invalid direction given for right hand side of edge ${M}--${A}. Expected (L,R,T,B) got ${String(L)}`);if(this.nodes[M]===void 0&&this.groups[M]===void 0)throw new Error(`The left-hand id [${M}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(this.nodes[A]===void 0&&this.groups[A]===void 0)throw new Error(`The right-hand id [${A}] does not yet exist. Please create the service/group before declaring an edge to it.`);const f=this.nodes[M].in,i=this.nodes[A].in;if(a&&f&&i&&f==i)throw new Error(`The left-hand id [${M}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(e&&f&&i&&f==i)throw new Error(`The right-hand id [${A}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const u={lhsId:M,lhsDir:P,lhsInto:g,lhsGroup:a,rhsId:A,rhsDir:L,rhsInto:l,rhsGroup:e,title:r};this.edges.push(u),this.nodes[M]&&this.nodes[A]&&(this.nodes[M].edges.push(this.edges[this.edges.length-1]),this.nodes[A].edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}getDataStructures(){if(this.dataStructures===void 0){const M={},A=Object.entries(this.nodes).reduce((e,[r,f])=>(e[r]=f.edges.reduce((i,u)=>{var o,c;const t=(o=this.getNode(u.lhsId))==null?void 0:o.in,s=(c=this.getNode(u.rhsId))==null?void 0:c.in;if(t&&s&&t!==s){const h=wr(u.lhsDir,u.rhsDir);h!=="bend"&&(M[t]??(M[t]={}),M[t][s]=h,M[s]??(M[s]={}),M[s][t]=h)}if(u.lhsId===r){const h=ye(u.lhsDir,u.rhsDir);h&&(i[h]=u.rhsId)}else{const h=ye(u.rhsDir,u.lhsDir);h&&(i[h]=u.lhsId)}return i},{}),e),{}),P=Object.keys(A)[0],L={[P]:1},g=Object.keys(A).reduce((e,r)=>r===P?e:{...e,[r]:1},{}),l=dt(e=>{const r={[e]:[0,0]},f=[e];for(;f.length>0;){const i=f.shift();if(i){L[i]=1,delete g[i];const u=A[i],[t,s]=r[i];Object.entries(u).forEach(([o,c])=>{L[c]||(r[c]=Cr([t,s],o),f.push(c))})}}return r},"BFS"),a=[l(P)];for(;Object.keys(g).length>0;)a.push(l(Object.keys(g)[0]));this.dataStructures={adjList:A,spatialMaps:a,groupAlignments:M}}return this.dataStructures}setElementForId(M,A){this.elements[M]=A}getElementById(M){return this.elements[M]}getConfig(){return er({...Dr,...ir().architecture})}getConfigField(M){return this.getConfig()[M]}},dt(ae,"ArchitectureDB"),ae),xr=dt((R,M)=>{lr(R,M),R.groups.map(A=>M.addGroup(A)),R.services.map(A=>M.addService({...A,type:"service"})),R.junctions.map(A=>M.addJunction({...A,type:"junction"})),R.edges.map(A=>M.addEdge(A))},"populateDb"),Ge={parser:{yy:void 0},parse:dt(async R=>{var P;const M=await fr("architecture",R);Se.debug(M);const A=(P=Ge.parser)==null?void 0:P.yy;if(!(A instanceof Pe))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");xr(M,A)},"parse")},Ir=dt(R=>`
+ .edge {
+ stroke-width: ${R.archEdgeWidth};
+ stroke: ${R.archEdgeColor};
+ fill: none;
+ }
+
+ .arrow {
+ fill: ${R.archEdgeArrowColor};
+ }
+
+ .node-bkg {
+ fill: none;
+ stroke: ${R.archGroupBorderColor};
+ stroke-width: ${R.archGroupBorderWidth};
+ stroke-dasharray: 8;
+ }
+ .node-icon-text {
+ display: flex;
+ align-items: center;
+ }
+
+ .node-icon-text > div {
+ color: #fff;
+ margin: 1px;
+ height: fit-content;
+ text-align: center;
+ overflow: hidden;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ }
+`,"getStyles"),Rr=Ir,re=dt(R=>` ${R} `,"wrapIcon"),ne={prefix:"mermaid-architecture",height:80,width:80,icons:{database:{body:re(' ')},server:{body:re(' ')},disk:{body:re(' ')},internet:{body:re(' ')},cloud:{body:re(' ')},unknown:hr,blank:{body:re("")}}},Sr=dt(async function(R,M,A,P){const L=A.getConfigField("padding"),g=A.getConfigField("iconSize"),l=g/2,a=g/6,e=a/2;await Promise.all(M.edges().map(async r=>{var X,K;const{source:f,sourceDir:i,sourceArrow:u,sourceGroup:t,target:s,targetDir:o,targetArrow:c,targetGroup:h,label:T}=be(r);let{x:d,y:v}=r[0].sourceEndpoint();const{x:N,y:F}=r[0].midpoint();let{x:C,y:G}=r[0].targetEndpoint();const Z=L+4;if(t&&(Wt(i)?d+=i==="L"?-Z:Z:v+=i==="T"?-Z:Z+18),h&&(Wt(o)?C+=o==="L"?-Z:Z:G+=o==="T"?-Z:Z+18),!t&&((X=A.getNode(f))==null?void 0:X.type)==="junction"&&(Wt(i)?d+=i==="L"?l:-l:v+=i==="T"?l:-l),!h&&((K=A.getNode(s))==null?void 0:K.type)==="junction"&&(Wt(o)?C+=o==="L"?l:-l:G+=o==="T"?l:-l),r[0]._private.rscratch){const D=R.insert("g");if(D.insert("path").attr("d",`M ${d},${v} L ${N},${F} L${C},${G} `).attr("class","edge").attr("id",`${P}-${or(f,s,{prefix:"L"})}`),u){const rt=Wt(i)?se[i](d,a):d-e,n=qt(i)?se[i](v,a):v-e;D.insert("polygon").attr("points",Ie[i](a)).attr("transform",`translate(${rt},${n})`).attr("class","arrow")}if(c){const rt=Wt(o)?se[o](C,a):C-e,n=qt(o)?se[o](G,a):G-e;D.insert("polygon").attr("points",Ie[o](a)).attr("transform",`translate(${rt},${n})`).attr("class","arrow")}if(T){const rt=Te(i,o)?"XY":Wt(i)?"X":"Y";let n=0;rt==="X"?n=Math.abs(d-C):rt==="Y"?n=Math.abs(v-G)/1.5:n=Math.abs(d-C)/2;const m=D.append("g");if(await me(m,T,{useHtmlLabels:!1,width:n,classes:"architecture-service-label"},Ee()),m.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),rt==="X")m.attr("transform","translate("+N+", "+F+")");else if(rt==="Y")m.attr("transform","translate("+N+", "+F+") rotate(-90)");else if(rt==="XY"){const p=ye(i,o);if(p&&Nr(p)){const E=m.node().getBoundingClientRect(),[y,I]=Ar(p);m.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*y*I*45})`);const w=m.node().getBoundingClientRect();m.attr("transform",`
+ translate(${N}, ${F-E.height/2})
+ translate(${y*w.width/2}, ${I*w.height/2})
+ rotate(${-1*y*I*45}, 0, ${E.height/2})
+ `)}}}}}))},"drawEdges"),Fr=dt(async function(R,M,A,P){const g=A.getConfigField("padding")*.75,l=A.getConfigField("fontSize"),e=A.getConfigField("iconSize")/2;await Promise.all(M.nodes().map(async r=>{const f=ie(r);if(f.type==="group"){const{h:i,w:u,x1:t,y1:s}=r.boundingBox(),o=R.append("rect");o.attr("id",`${P}-group-${f.id}`).attr("x",t+e).attr("y",s+e).attr("width",u).attr("height",i).attr("class","node-bkg");const c=R.append("g");let h=t,T=s;if(f.icon){const d=c.append("g");d.html(`${await pe(f.icon,{height:g,width:g,fallbackPrefix:ne.prefix})} `),d.attr("transform","translate("+(h+e+1)+", "+(T+e+1)+")"),h+=g,T+=l/2-1-2}if(f.label){const d=c.append("g");await me(d,f.label,{useHtmlLabels:!1,width:u,classes:"architecture-service-label"},Ee()),d.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),d.attr("transform","translate("+(h+e+4)+", "+(T+e+2)+")")}A.setElementForId(f.id,o)}}))},"drawGroups"),br=dt(async function(R,M,A,P){const L=Ee();for(const g of A){const l=M.append("g"),a=R.getConfigField("iconSize");if(g.title){const i=l.append("g");await me(i,g.title,{useHtmlLabels:!1,width:a*1.5,classes:"architecture-service-label"},L),i.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),i.attr("transform","translate("+a/2+", "+a+")")}const e=l.append("g");if(g.icon)e.html(`${await pe(g.icon,{height:a,width:a,fallbackPrefix:ne.prefix})} `);else if(g.iconText){e.html(`${await pe("blank",{height:a,width:a,fallbackPrefix:ne.prefix})} `);const t=e.append("g").append("foreignObject").attr("width",a).attr("height",a).append("div").attr("class","node-icon-text").attr("style",`height: ${a}px;`).append("div").html(ar(g.iconText,L)),s=parseInt(window.getComputedStyle(t.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;t.attr("style",`-webkit-line-clamp: ${Math.floor((a-2)/s)};`)}else e.append("path").attr("class","node-bkg").attr("id",`${P}-node-${g.id}`).attr("d",`M0,${a} V5 Q0,0 5,0 H${a-5} Q${a},0 ${a},5 V${a} Z`);l.attr("id",`${P}-service-${g.id}`).attr("class","architecture-service");const{width:r,height:f}=l.node().getBBox();g.width=r,g.height=f,R.setElementForId(g.id,l)}return 0},"drawServices"),Pr=dt(function(R,M,A,P){A.forEach(L=>{const g=M.append("g"),l=R.getConfigField("iconSize");g.append("g").append("rect").attr("id",`${P}-node-${L.id}`).attr("fill-opacity","0").attr("width",l).attr("height",l),g.attr("class","architecture-junction");const{width:e,height:r}=g._groups[0][0].getBBox();g.width=e,g.height=r,R.setElementForId(L.id,g)})},"drawJunctions");sr([{name:ne.prefix,icons:ne}]);Fe.use(mr);function Ue(R,M,A){R.forEach(P=>{M.add({group:"nodes",data:{type:"service",id:P.id,icon:P.icon,label:P.title,parent:P.in,width:A.getConfigField("iconSize"),height:A.getConfigField("iconSize")},classes:"node-service"})})}dt(Ue,"addServices");function Ye(R,M,A){R.forEach(P=>{M.add({group:"nodes",data:{type:"junction",id:P.id,parent:P.in,width:A.getConfigField("iconSize"),height:A.getConfigField("iconSize")},classes:"node-junction"})})}dt(Ye,"addJunctions");function Xe(R,M){M.nodes().map(A=>{const P=ie(A);if(P.type==="group")return;P.x=A.position().x,P.y=A.position().y,R.getElementById(P.id).attr("transform","translate("+(P.x||0)+","+(P.y||0)+")")})}dt(Xe,"positionNodes");function He(R,M){R.forEach(A=>{M.add({group:"nodes",data:{type:"group",id:A.id,icon:A.icon,label:A.title,parent:A.in},classes:"node-group"})})}dt(He,"addGroups");function We(R,M){R.forEach(A=>{const{lhsId:P,rhsId:L,lhsInto:g,lhsGroup:l,rhsInto:a,lhsDir:e,rhsDir:r,rhsGroup:f,title:i}=A,u=Te(A.lhsDir,A.rhsDir)?"segments":"straight",t={id:`${P}-${L}`,label:i,source:P,sourceDir:e,sourceArrow:g,sourceGroup:l,sourceEndpoint:e==="L"?"0 50%":e==="R"?"100% 50%":e==="T"?"50% 0":"50% 100%",target:L,targetDir:r,targetArrow:a,targetGroup:f,targetEndpoint:r==="L"?"0 50%":r==="R"?"100% 50%":r==="T"?"50% 0":"50% 100%"};M.add({group:"edges",data:t,classes:u})})}dt(We,"addEdges");function Ve(R,M,A){const P=dt((a,e)=>Object.entries(a).reduce((r,[f,i])=>{var s;let u=0;const t=Object.entries(i);if(t.length===1)return r[f]=t[0][1],r;for(let o=0;o{const e={},r={};return Object.entries(a).forEach(([f,[i,u]])=>{var s,o,c;const t=((s=R.getNode(f))==null?void 0:s.in)??"default";e[u]??(e[u]={}),(o=e[u])[t]??(o[t]=[]),e[u][t].push(f),r[i]??(r[i]={}),(c=r[i])[t]??(c[t]=[]),r[i][t].push(f)}),{horiz:Object.values(P(e,"horizontal")).filter(f=>f.length>1),vert:Object.values(P(r,"vertical")).filter(f=>f.length>1)}}),[g,l]=L.reduce(([a,e],{horiz:r,vert:f})=>[[...a,...r],[...e,...f]],[[],[]]);return{horizontal:g,vertical:l}}dt(Ve,"getAlignments");function ze(R,M){const A=[],P=dt(g=>`${g[0]},${g[1]}`,"posToStr"),L=dt(g=>g.split(",").map(l=>parseInt(l)),"strToPos");return R.forEach(g=>{const l=Object.fromEntries(Object.entries(g).map(([f,i])=>[P(i),f])),a=[P([0,0])],e={},r={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};for(;a.length>0;){const f=a.shift();if(f){e[f]=1;const i=l[f];if(i){const u=L(f);Object.entries(r).forEach(([t,s])=>{const o=P([u[0]+s[0],u[1]+s[1]]),c=l[o];c&&!e[o]&&(a.push(o),A.push({[xe[t]]:c,[xe[Tr(t)]]:i,gap:1.5*M.getConfigField("iconSize")}))})}}}}),A}dt(ze,"getRelativeConstraints");function $e(R,M,A,P,L,{spatialMaps:g,groupAlignments:l}){return new Promise(a=>{const e=nr("body").append("div").attr("id","cy").attr("style","display:none"),r=Fe({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"straight","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"edge[label]",style:{label:"data(label)"}},{selector:"edge.segments",style:{"curve-style":"segments","segment-weights":"0","segment-distances":[.5],"edge-distances":"endpoints","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"node",style:{"compound-sizing-wrt-labels":"include"}},{selector:"node[label]",style:{"text-valign":"bottom","text-halign":"center","font-size":`${L.getConfigField("fontSize")}px`}},{selector:".node-service",style:{label:"data(label)",width:"data(width)",height:"data(height)"}},{selector:".node-junction",style:{width:"data(width)",height:"data(height)"}},{selector:".node-group",style:{padding:`${L.getConfigField("padding")}px`}}],layout:{name:"grid",boundingBox:{x1:0,x2:100,y1:0,y2:100}}});e.remove(),He(A,r),Ue(R,r,L),Ye(M,r,L),We(P,r);const f=Ve(L,g,l),i=ze(g,L),u=r.layout({name:"fcose",quality:"proof",randomize:L.getConfigField("randomize"),styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(t){const[s,o]=t.connectedNodes(),{parent:c}=ie(s),{parent:h}=ie(o);return c===h?1.5*L.getConfigField("iconSize"):.5*L.getConfigField("iconSize")},edgeElasticity(t){const[s,o]=t.connectedNodes(),{parent:c}=ie(s),{parent:h}=ie(o);return c===h?.45:.001},alignmentConstraint:f,relativePlacementConstraint:i});u.one("layoutstop",()=>{var s;function t(o,c,h,T){let d,v;const{x:N,y:F}=o,{x:C,y:G}=c;v=(T-F+(N-h)*(F-G)/(N-C))/Math.sqrt(1+Math.pow((F-G)/(N-C),2)),d=Math.sqrt(Math.pow(T-F,2)+Math.pow(h-N,2)-Math.pow(v,2));const Z=Math.sqrt(Math.pow(C-N,2)+Math.pow(G-F,2));d=d/Z;let X=(C-N)*(T-F)-(G-F)*(h-N);switch(!0){case X>=0:X=1;break;case X<0:X=-1;break}let K=(C-N)*(h-N)+(G-F)*(T-F);switch(!0){case K>=0:K=1;break;case K<0:K=-1;break}return v=Math.abs(v)*X,d=d*K,{distances:v,weights:d}}dt(t,"getSegmentWeights"),r.startBatch();for(const o of Object.values(r.edges()))if((s=o.data)!=null&&s.call(o)){const{x:c,y:h}=o.source().position(),{x:T,y:d}=o.target().position();if(c!==T&&h!==d){const v=o.sourceEndpoint(),N=o.targetEndpoint(),{sourceDir:F}=be(o),[C,G]=qt(F)?[v.x,N.y]:[N.x,v.y],{weights:Z,distances:X}=t(v,N,C,G);o.style("segment-distances",X),o.style("segment-weights",Z)}}r.endBatch(),u.run()}),u.run(),r.ready(t=>{Se.info("Ready",t),a(r)})})}dt($e,"layoutArchitecture");var Gr=dt(async(R,M,A,P)=>{const L=P.db;L.setDiagramId(M);const g=L.getServices(),l=L.getJunctions(),a=L.getGroups(),e=L.getEdges(),r=L.getDataStructures(),f=ke(M),i=f.append("g");i.attr("class","architecture-edges");const u=f.append("g");u.attr("class","architecture-services");const t=f.append("g");t.attr("class","architecture-groups"),await br(L,u,g,M),Pr(L,u,l,M);const s=await $e(g,l,a,e,L,r);await Sr(i,s,L,M),await Fr(t,s,L,M),Xe(L,s),Ze(void 0,f,L.getConfigField("padding"),L.getConfigField("useMaxWidth"))},"draw"),Ur={draw:Gr},Br={parser:Ge,get db(){return new Pe},renderer:Ur,styles:Rr};export{Br as diagram};
diff --git a/dist-desktop/assets/blockDiagram-DXYQGD6D-rHreedhf.js b/dist-desktop/assets/blockDiagram-DXYQGD6D-rHreedhf.js
new file mode 100644
index 0000000..354c434
--- /dev/null
+++ b/dist-desktop/assets/blockDiagram-DXYQGD6D-rHreedhf.js
@@ -0,0 +1,132 @@
+import{g as ge}from"./chunk-FMBD7UC4-TatyaWoN.js";import{_ as d,D as lt,d as C,e as de,l as v,z as ue,B as pe,ai as fe,R as xe,S as ye,c as M,O as be,aj as Y,ak as vt,al as at,am as we,u as st,k as me,an as Le,i as Ct,ao as Ot,ap as Se}from"./mermaid.core-DD7RPEfx.js";import{c as ve}from"./clone-DL0QTDot.js";import{G as Ee}from"./graph-C_fMmQpx.js";import{c as _e}from"./channel-Bv1ZAY8d.js";import"./index-jkhvCyNw.js";import"./_baseUniq-D-yNBara.js";var bt=(function(){var e=d(function(N,y,u,p){for(u=u||{},p=N.length;p--;u[N[p]]=y);return u},"o"),t=[1,15],a=[1,7],i=[1,13],l=[1,14],s=[1,19],r=[1,16],n=[1,17],c=[1,18],x=[8,30],h=[8,10,21,28,29,30,31,39,43,46],f=[1,23],w=[1,24],b=[8,10,15,16,21,28,29,30,31,39,43,46],m=[8,10,15,16,21,27,28,29,30,31,39,43,46],_=[1,49],L={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(y,u,p,S,E,o,k){var g=o.length-1;switch(E){case 4:S.getLogger().debug("Rule: separator (NL) ");break;case 5:S.getLogger().debug("Rule: separator (Space) ");break;case 6:S.getLogger().debug("Rule: separator (EOF) ");break;case 7:S.getLogger().debug("Rule: hierarchy: ",o[g-1]),S.setHierarchy(o[g-1]);break;case 8:S.getLogger().debug("Stop NL ");break;case 9:S.getLogger().debug("Stop EOF ");break;case 10:S.getLogger().debug("Stop NL2 ");break;case 11:S.getLogger().debug("Stop EOF2 ");break;case 12:S.getLogger().debug("Rule: statement: ",o[g]),typeof o[g].length=="number"?this.$=o[g]:this.$=[o[g]];break;case 13:S.getLogger().debug("Rule: statement #2: ",o[g-1]),this.$=[o[g-1]].concat(o[g]);break;case 14:S.getLogger().debug("Rule: link: ",o[g],y),this.$={edgeTypeStr:o[g],label:""};break;case 15:S.getLogger().debug("Rule: LABEL link: ",o[g-3],o[g-1],o[g]),this.$={edgeTypeStr:o[g],label:o[g-1]};break;case 18:const D=parseInt(o[g]),T=S.generateId();this.$={id:T,type:"space",label:"",width:D,children:[]};break;case 23:S.getLogger().debug("Rule: (nodeStatement link node) ",o[g-2],o[g-1],o[g]," typestr: ",o[g-1].edgeTypeStr);const K=S.edgeStrToEdgeData(o[g-1].edgeTypeStr);this.$=[{id:o[g-2].id,label:o[g-2].label,type:o[g-2].type,directions:o[g-2].directions},{id:o[g-2].id+"-"+o[g].id,start:o[g-2].id,end:o[g].id,label:o[g-1].label,type:"edge",directions:o[g].directions,arrowTypeEnd:K,arrowTypeStart:"arrow_open"},{id:o[g].id,label:o[g].label,type:S.typeStr2Type(o[g].typeStr),directions:o[g].directions}];break;case 24:S.getLogger().debug("Rule: nodeStatement (abc88 node size) ",o[g-1],o[g]),this.$={id:o[g-1].id,label:o[g-1].label,type:S.typeStr2Type(o[g-1].typeStr),directions:o[g-1].directions,widthInColumns:parseInt(o[g],10)};break;case 25:S.getLogger().debug("Rule: nodeStatement (node) ",o[g]),this.$={id:o[g].id,label:o[g].label,type:S.typeStr2Type(o[g].typeStr),directions:o[g].directions,widthInColumns:1};break;case 26:S.getLogger().debug("APA123",this?this:"na"),S.getLogger().debug("COLUMNS: ",o[g]),this.$={type:"column-setting",columns:o[g]==="auto"?-1:parseInt(o[g])};break;case 27:S.getLogger().debug("Rule: id-block statement : ",o[g-2],o[g-1]),S.generateId(),this.$={...o[g-2],type:"composite",children:o[g-1]};break;case 28:S.getLogger().debug("Rule: blockStatement : ",o[g-2],o[g-1],o[g]);const P=S.generateId();this.$={id:P,type:"composite",label:"",children:o[g-1]};break;case 29:S.getLogger().debug("Rule: node (NODE_ID separator): ",o[g]),this.$={id:o[g]};break;case 30:S.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",o[g-1],o[g]),this.$={id:o[g-1],label:o[g].label,typeStr:o[g].typeStr,directions:o[g].directions};break;case 31:S.getLogger().debug("Rule: dirList: ",o[g]),this.$=[o[g]];break;case 32:S.getLogger().debug("Rule: dirList: ",o[g-1],o[g]),this.$=[o[g-1]].concat(o[g]);break;case 33:S.getLogger().debug("Rule: nodeShapeNLabel: ",o[g-2],o[g-1],o[g]),this.$={typeStr:o[g-2]+o[g],label:o[g-1]};break;case 34:S.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",o[g-3],o[g-2]," #3:",o[g-1],o[g]),this.$={typeStr:o[g-3]+o[g],label:o[g-2],directions:o[g-1]};break;case 35:case 36:this.$={type:"classDef",id:o[g-1].trim(),css:o[g].trim()};break;case 37:this.$={type:"applyClass",id:o[g-1].trim(),styleClass:o[g].trim()};break;case 38:this.$={type:"applyStyles",id:o[g-1].trim(),stylesStr:o[g].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:c},{8:[1,20]},e(x,[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:c}),e(h,[2,16],{14:22,15:f,16:w}),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(b,[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:c},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(m,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(x,[2,13]),{26:35,31:s},{31:[2,14]},{17:[1,36]},e(b,[2,24]),{10:t,11:37,13:4,14:22,15:f,16:w,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:c},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(m,[2,30]),{18:[1,43]},{18:[1,44]},e(b,[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:_},{15:[1,50]},e(h,[2,27]),e(m,[2,33]),{38:[1,51]},{33:52,34:_,38:[2,31]},{31:[2,15]},e(m,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:d(function(y,u){if(u.recoverable)this.trace(y);else{var p=new Error(y);throw p.hash=u,p}},"parseError"),parse:d(function(y){var u=this,p=[0],S=[],E=[null],o=[],k=this.table,g="",D=0,T=0,K=2,P=1,Q=o.slice.call(arguments,1),R=Object.create(this.lexer),U={yy:{}};for(var et in this.yy)Object.prototype.hasOwnProperty.call(this.yy,et)&&(U.yy[et]=this.yy[et]);R.setInput(y,U.yy),U.yy.lexer=R,U.yy.parser=this,typeof R.yylloc>"u"&&(R.yylloc={});var rt=R.yylloc;o.push(rt);var oe=R.options&&R.options.ranges;typeof U.yy.parseError=="function"?this.parseError=U.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function he(X){p.length=p.length-2*X,E.length=E.length-X,o.length=o.length-X}d(he,"popStack");function It(){var X;return X=S.pop()||R.lex()||P,typeof X!="number"&&(X instanceof Array&&(S=X,X=S.pop()),X=u.symbols_[X]||X),X}d(It,"lex");for(var H,$,V,ft,tt={},ct,J,Bt,ot;;){if($=p[p.length-1],this.defaultActions[$]?V=this.defaultActions[$]:((H===null||typeof H>"u")&&(H=It()),V=k[$]&&k[$][H]),typeof V>"u"||!V.length||!V[0]){var xt="";ot=[];for(ct in k[$])this.terminals_[ct]&&ct>K&&ot.push("'"+this.terminals_[ct]+"'");R.showPosition?xt="Parse error on line "+(D+1)+`:
+`+R.showPosition()+`
+Expecting `+ot.join(", ")+", got '"+(this.terminals_[H]||H)+"'":xt="Parse error on line "+(D+1)+": Unexpected "+(H==P?"end of input":"'"+(this.terminals_[H]||H)+"'"),this.parseError(xt,{text:R.match,token:this.terminals_[H]||H,line:R.yylineno,loc:rt,expected:ot})}if(V[0]instanceof Array&&V.length>1)throw new Error("Parse Error: multiple actions possible at state: "+$+", token: "+H);switch(V[0]){case 1:p.push(H),E.push(R.yytext),o.push(R.yylloc),p.push(V[1]),H=null,T=R.yyleng,g=R.yytext,D=R.yylineno,rt=R.yylloc;break;case 2:if(J=this.productions_[V[1]][1],tt.$=E[E.length-J],tt._$={first_line:o[o.length-(J||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(J||1)].first_column,last_column:o[o.length-1].last_column},oe&&(tt._$.range=[o[o.length-(J||1)].range[0],o[o.length-1].range[1]]),ft=this.performAction.apply(tt,[g,T,D,U.yy,V[1],E,o].concat(Q)),typeof ft<"u")return ft;J&&(p=p.slice(0,-1*J*2),E=E.slice(0,-1*J),o=o.slice(0,-1*J)),p.push(this.productions_[V[1]][0]),E.push(tt.$),o.push(tt._$),Bt=k[p[p.length-2]][p[p.length-1]],p.push(Bt);break;case 3:return!0}}return!0},"parse")},B=(function(){var N={EOF:1,parseError:d(function(u,p){if(this.yy.parser)this.yy.parser.parseError(u,p);else throw new Error(u)},"parseError"),setInput:d(function(y,u){return this.yy=u||this.yy||{},this._input=y,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var y=this._input[0];this.yytext+=y,this.yyleng++,this.offset++,this.match+=y,this.matched+=y;var u=y.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),y},"input"),unput:d(function(y){var u=y.length,p=y.split(/(?:\r\n?|\n)/g);this._input=y+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u),this.offset-=u;var S=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),p.length-1&&(this.yylineno-=p.length-1);var E=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:p?(p.length===S.length?this.yylloc.first_column:0)+S[S.length-p.length].length-p[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[E[0],E[0]+this.yyleng-u]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
+`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(y){this.unput(this.match.slice(y))},"less"),pastInput:d(function(){var y=this.matched.substr(0,this.matched.length-this.match.length);return(y.length>20?"...":"")+y.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var y=this.match;return y.length<20&&(y+=this._input.substr(0,20-y.length)),(y.substr(0,20)+(y.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var y=this.pastInput(),u=new Array(y.length+1).join("-");return y+this.upcomingInput()+`
+`+u+"^"},"showPosition"),test_match:d(function(y,u){var p,S,E;if(this.options.backtrack_lexer&&(E={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(E.yylloc.range=this.yylloc.range.slice(0))),S=y[0].match(/(?:\r\n?|\n).*/g),S&&(this.yylineno+=S.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:S?S[S.length-1].length-S[S.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+y[0].length},this.yytext+=y[0],this.match+=y[0],this.matches=y,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(y[0].length),this.matched+=y[0],p=this.performAction.call(this,this.yy,this,u,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),p)return p;if(this._backtrack){for(var o in E)this[o]=E[o];return!1}return!1},"test_match"),next:d(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var y,u,p,S;this._more||(this.yytext="",this.match="");for(var E=this._currentRules(),o=0;ou[0].length)){if(u=p,S=o,this.options.backtrack_lexer){if(y=this.test_match(p,E[o]),y!==!1)return y;if(this._backtrack){u=!1;continue}else return!1}else if(!this.options.flex)break}return u?(y=this.test_match(u,E[S]),y!==!1?y:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
+`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:d(function(){var u=this.next();return u||this.lex()},"lex"),begin:d(function(u){this.conditionStack.push(u)},"begin"),popState:d(function(){var u=this.conditionStack.length-1;return u>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:d(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:d(function(u){return u=this.conditionStack.length-1-Math.abs(u||0),u>=0?this.conditionStack[u]:"INITIAL"},"topState"),pushState:d(function(u){this.begin(u)},"pushState"),stateStackSize:d(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:d(function(u,p,S,E){switch(S){case 0:return u.getLogger().debug("Found block-beta"),10;case 1:return u.getLogger().debug("Found id-block"),29;case 2:return u.getLogger().debug("Found block"),10;case 3:u.getLogger().debug(".",p.yytext);break;case 4:u.getLogger().debug("_",p.yytext);break;case 5:return 5;case 6:return p.yytext=-1,28;case 7:return p.yytext=p.yytext.replace(/columns\s+/,""),u.getLogger().debug("COLUMNS (LEX)",p.yytext),28;case 8:this.pushState("md_string");break;case 9:return"MD_STR";case 10:this.popState();break;case 11:this.pushState("string");break;case 12:u.getLogger().debug("LEX: POPPING STR:",p.yytext),this.popState();break;case 13:return u.getLogger().debug("LEX: STR end:",p.yytext),"STR";case 14:return p.yytext=p.yytext.replace(/space\:/,""),u.getLogger().debug("SPACE NUM (LEX)",p.yytext),21;case 15:return p.yytext="1",u.getLogger().debug("COLUMNS (LEX)",p.yytext),21;case 16:return 42;case 17:return"LINKSTYLE";case 18:return"INTERPOLATE";case 19:return this.pushState("CLASSDEF"),39;case 20:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";case 21:return this.popState(),this.pushState("CLASSDEFID"),40;case 22:return this.popState(),41;case 23:return this.pushState("CLASS"),43;case 24:return this.popState(),this.pushState("CLASS_STYLE"),44;case 25:return this.popState(),45;case 26:return this.pushState("STYLE_STMNT"),46;case 27:return this.popState(),this.pushState("STYLE_DEFINITION"),47;case 28:return this.popState(),48;case 29:return this.pushState("acc_title"),"acc_title";case 30:return this.popState(),"acc_title_value";case 31:return this.pushState("acc_descr"),"acc_descr";case 32:return this.popState(),"acc_descr_value";case 33:this.pushState("acc_descr_multiline");break;case 34:this.popState();break;case 35:return"acc_descr_multiline_value";case 36:return 30;case 37:return this.popState(),u.getLogger().debug("Lex: (("),"NODE_DEND";case 38:return this.popState(),u.getLogger().debug("Lex: (("),"NODE_DEND";case 39:return this.popState(),u.getLogger().debug("Lex: ))"),"NODE_DEND";case 40:return this.popState(),u.getLogger().debug("Lex: (("),"NODE_DEND";case 41:return this.popState(),u.getLogger().debug("Lex: (("),"NODE_DEND";case 42:return this.popState(),u.getLogger().debug("Lex: (-"),"NODE_DEND";case 43:return this.popState(),u.getLogger().debug("Lex: -)"),"NODE_DEND";case 44:return this.popState(),u.getLogger().debug("Lex: (("),"NODE_DEND";case 45:return this.popState(),u.getLogger().debug("Lex: ]]"),"NODE_DEND";case 46:return this.popState(),u.getLogger().debug("Lex: ("),"NODE_DEND";case 47:return this.popState(),u.getLogger().debug("Lex: ])"),"NODE_DEND";case 48:return this.popState(),u.getLogger().debug("Lex: /]"),"NODE_DEND";case 49:return this.popState(),u.getLogger().debug("Lex: /]"),"NODE_DEND";case 50:return this.popState(),u.getLogger().debug("Lex: )]"),"NODE_DEND";case 51:return this.popState(),u.getLogger().debug("Lex: )"),"NODE_DEND";case 52:return this.popState(),u.getLogger().debug("Lex: ]>"),"NODE_DEND";case 53:return this.popState(),u.getLogger().debug("Lex: ]"),"NODE_DEND";case 54:return u.getLogger().debug("Lexa: -)"),this.pushState("NODE"),35;case 55:return u.getLogger().debug("Lexa: (-"),this.pushState("NODE"),35;case 56:return u.getLogger().debug("Lexa: ))"),this.pushState("NODE"),35;case 57:return u.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 58:return u.getLogger().debug("Lex: ((("),this.pushState("NODE"),35;case 59:return u.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 60:return u.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 61:return u.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 62:return u.getLogger().debug("Lexc: >"),this.pushState("NODE"),35;case 63:return u.getLogger().debug("Lexa: (["),this.pushState("NODE"),35;case 64:return u.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 65:return this.pushState("NODE"),35;case 66:return this.pushState("NODE"),35;case 67:return this.pushState("NODE"),35;case 68:return this.pushState("NODE"),35;case 69:return this.pushState("NODE"),35;case 70:return this.pushState("NODE"),35;case 71:return this.pushState("NODE"),35;case 72:return u.getLogger().debug("Lexa: ["),this.pushState("NODE"),35;case 73:return this.pushState("BLOCK_ARROW"),u.getLogger().debug("LEX ARR START"),37;case 74:return u.getLogger().debug("Lex: NODE_ID",p.yytext),31;case 75:return u.getLogger().debug("Lex: EOF",p.yytext),8;case 76:this.pushState("md_string");break;case 77:this.pushState("md_string");break;case 78:return"NODE_DESCR";case 79:this.popState();break;case 80:u.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 81:u.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 82:return u.getLogger().debug("LEX: NODE_DESCR:",p.yytext),"NODE_DESCR";case 83:u.getLogger().debug("LEX POPPING"),this.popState();break;case 84:u.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 85:return p.yytext=p.yytext.replace(/^,\s*/,""),u.getLogger().debug("Lex (right): dir:",p.yytext),"DIR";case 86:return p.yytext=p.yytext.replace(/^,\s*/,""),u.getLogger().debug("Lex (left):",p.yytext),"DIR";case 87:return p.yytext=p.yytext.replace(/^,\s*/,""),u.getLogger().debug("Lex (x):",p.yytext),"DIR";case 88:return p.yytext=p.yytext.replace(/^,\s*/,""),u.getLogger().debug("Lex (y):",p.yytext),"DIR";case 89:return p.yytext=p.yytext.replace(/^,\s*/,""),u.getLogger().debug("Lex (up):",p.yytext),"DIR";case 90:return p.yytext=p.yytext.replace(/^,\s*/,""),u.getLogger().debug("Lex (down):",p.yytext),"DIR";case 91:return p.yytext="]>",u.getLogger().debug("Lex (ARROW_DIR end):",p.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";case 92:return u.getLogger().debug("Lex: LINK","#"+p.yytext+"#"),15;case 93:return u.getLogger().debug("Lex: LINK",p.yytext),15;case 94:return u.getLogger().debug("Lex: LINK",p.yytext),15;case 95:return u.getLogger().debug("Lex: LINK",p.yytext),15;case 96:return u.getLogger().debug("Lex: START_LINK",p.yytext),this.pushState("LLABEL"),16;case 97:return u.getLogger().debug("Lex: START_LINK",p.yytext),this.pushState("LLABEL"),16;case 98:return u.getLogger().debug("Lex: START_LINK",p.yytext),this.pushState("LLABEL"),16;case 99:this.pushState("md_string");break;case 100:return u.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";case 101:return this.popState(),u.getLogger().debug("Lex: LINK","#"+p.yytext+"#"),15;case 102:return this.popState(),u.getLogger().debug("Lex: LINK",p.yytext),15;case 103:return this.popState(),u.getLogger().debug("Lex: LINK",p.yytext),15;case 104:return u.getLogger().debug("Lex: COLON",p.yytext),p.yytext=p.yytext.slice(1),27}},"anonymous"),rules:[/^(?:block-beta\b)/,/^(?:block:)/,/^(?:block\b)/,/^(?:[\s]+)/,/^(?:[\n]+)/,/^(?:((\u000D\u000A)|(\u000A)))/,/^(?:columns\s+auto\b)/,/^(?:columns\s+[\d]+)/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:space[:]\d+)/,/^(?:space\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\s+)/,/^(?:DEFAULT\s+)/,/^(?:\w+\s+)/,/^(?:[^\n]*)/,/^(?:class\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:style\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:end\b\s*)/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:[\)]\))/,/^(?:\}\})/,/^(?:\})/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\()/,/^(?:\]\])/,/^(?:\()/,/^(?:\]\))/,/^(?:\\\])/,/^(?:\/\])/,/^(?:\)\])/,/^(?:[\)])/,/^(?:\]>)/,/^(?:[\]])/,/^(?:-\))/,/^(?:\(-)/,/^(?:\)\))/,/^(?:\))/,/^(?:\(\(\()/,/^(?:\(\()/,/^(?:\{\{)/,/^(?:\{)/,/^(?:>)/,/^(?:\(\[)/,/^(?:\()/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\[\\)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:\[)/,/^(?:<\[)/,/^(?:[^\(\[\n\-\)\{\}\s\<\>:]+)/,/^(?:$)/,/^(?:["][`])/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:\]>\s*\()/,/^(?:,?\s*right\s*)/,/^(?:,?\s*left\s*)/,/^(?:,?\s*x\s*)/,/^(?:,?\s*y\s*)/,/^(?:,?\s*up\s*)/,/^(?:,?\s*down\s*)/,/^(?:\)\s*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*~~[\~]+\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:["][`])/,/^(?:["])/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?::\d+)/],conditions:{STYLE_DEFINITION:{rules:[28],inclusive:!1},STYLE_STMNT:{rules:[27],inclusive:!1},CLASSDEFID:{rules:[22],inclusive:!1},CLASSDEF:{rules:[20,21],inclusive:!1},CLASS_STYLE:{rules:[25],inclusive:!1},CLASS:{rules:[24],inclusive:!1},LLABEL:{rules:[99,100,101,102,103],inclusive:!1},ARROW_DIR:{rules:[85,86,87,88,89,90,91],inclusive:!1},BLOCK_ARROW:{rules:[76,81,84],inclusive:!1},NODE:{rules:[37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,77,80],inclusive:!1},md_string:{rules:[9,10,78,79],inclusive:!1},space:{rules:[],inclusive:!1},string:{rules:[12,13,82,83],inclusive:!1},acc_descr_multiline:{rules:[34,35],inclusive:!1},acc_descr:{rules:[32],inclusive:!1},acc_title:{rules:[30],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,11,14,15,16,17,18,19,23,26,29,31,33,36,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,92,93,94,95,96,97,98,104],inclusive:!0}}};return N})();L.lexer=B;function I(){this.yy={}}return d(I,"Parser"),I.prototype=L,L.Parser=I,new I})();bt.parser=bt;var ke=bt,Z=new Map,Et=[],wt=new Map,Rt="color",zt="fill",De="bgFill",Xt=",",Te=M(),gt=new Map,_t="",Ne=d(e=>me.sanitizeText(e,Te),"sanitizeText"),Ie=d(function(e,t=""){let a=gt.get(e);a||(a={id:e,styles:[],textStyles:[]},gt.set(e,a)),t!=null&&t.split(Xt).forEach(i=>{const l=i.replace(/([^;]*);/,"$1").trim();if(RegExp(Rt).exec(i)){const r=l.replace(zt,De).replace(Rt,zt);a.textStyles.push(r)}a.styles.push(l)})},"addStyleClass"),Be=d(function(e,t=""){const a=Z.get(e);t!=null&&(a.styles=t.split(Xt))},"addStyle2Node"),Ce=d(function(e,t){e.split(",").forEach(function(a){let i=Z.get(a);if(i===void 0){const l=a.trim();i={id:l,type:"na",children:[]},Z.set(l,i)}i.classes||(i.classes=[]),i.classes.push(t)})},"setCssClass"),jt=d((e,t)=>{const a=e.flat(),i=[],l=a.find(r=>(r==null?void 0:r.type)==="column-setting"),s=(l==null?void 0:l.columns)??-1;for(const r of a){if(typeof s=="number"&&s>0&&r.type!=="column-setting"&&typeof r.widthInColumns=="number"&&r.widthInColumns>s&&v.warn(`Block ${r.id} width ${r.widthInColumns} exceeds configured column width ${s}`),r.label&&(r.label=Ne(r.label)),r.type==="classDef"){Ie(r.id,r.css);continue}if(r.type==="applyClass"){Ce(r.id,(r==null?void 0:r.styleClass)??"");continue}if(r.type==="applyStyles"){r!=null&&r.stylesStr&&Be(r.id,r==null?void 0:r.stylesStr);continue}if(r.type==="column-setting")t.columns=r.columns??-1;else if(r.type==="edge"){const n=(wt.get(r.id)??0)+1;wt.set(r.id,n),r.id=n+"-"+r.id,Et.push(r)}else{r.label||(r.type==="composite"?r.label="":r.label=r.id);const n=Z.get(r.id);if(n===void 0?Z.set(r.id,r):(r.type!=="na"&&(n.type=r.type),r.label!==r.id&&(n.label=r.label)),r.children&&jt(r.children,r),r.type==="space"){const c=r.width??1;for(let x=0;x{v.debug("Clear called"),ue(),nt={id:"root",type:"composite",children:[],columns:-1},Z=new Map([["root",nt]]),kt=[],gt=new Map,Et=[],wt=new Map,_t=""},"clear");function Vt(e){switch(v.debug("typeStr2Type",e),e){case"[]":return"square";case"()":return v.debug("we have a round"),"round";case"(())":return"circle";case">]":return"rect_left_inv_arrow";case"{}":return"diamond";case"{{}}":return"hexagon";case"([])":return"stadium";case"[[]]":return"subroutine";case"[()]":return"cylinder";case"((()))":return"doublecircle";case"[//]":return"lean_right";case"[\\\\]":return"lean_left";case"[/\\]":return"trapezoid";case"[\\/]":return"inv_trapezoid";case"<[]>":return"block_arrow";default:return"na"}}d(Vt,"typeStr2Type");function Gt(e){switch(v.debug("typeStr2Type",e),e){case"==":return"thick";default:return"normal"}}d(Gt,"edgeTypeStr2Type");function Zt(e){switch(e.replace(/^[\s-]+|[\s-]+$/g,"")){case"x":return"arrow_cross";case"o":return"arrow_circle";case">":return"arrow_point";default:return""}}d(Zt,"edgeStrToEdgeData");var At=0,Re=d(()=>(At++,"id-"+Math.random().toString(36).substr(2,12)+"-"+At),"generateId"),ze=d(e=>{nt.children=e,jt(e,nt),kt=nt.children},"setHierarchy"),Ae=d(e=>{const t=Z.get(e);return t?t.columns?t.columns:t.children?t.children.length:-1:-1},"getColumns"),Me=d(()=>[...Z.values()],"getBlocksFlat"),Fe=d(()=>kt||[],"getBlocks"),Pe=d(()=>Et,"getEdges"),We=d(e=>Z.get(e),"getBlock"),Ye=d(e=>{Z.set(e.id,e)},"setBlock"),He=d(e=>{_t=e},"setDiagramId"),Ke=d(()=>_t,"getDiagramId"),Ue=d(()=>v,"getLogger"),Xe=d(function(){return gt},"getClasses"),je={getConfig:d(()=>lt().block,"getConfig"),typeStr2Type:Vt,edgeTypeStr2Type:Gt,edgeStrToEdgeData:Zt,getLogger:Ue,getBlocksFlat:Me,getBlocks:Fe,getEdges:Pe,setHierarchy:ze,getBlock:We,setBlock:Ye,getColumns:Ae,getClasses:Xe,clear:Oe,generateId:Re,setDiagramId:He,getDiagramId:Ke},Ve=je,yt=d((e,t)=>{const a=_e,i=a(e,"r"),l=a(e,"g"),s=a(e,"b");return pe(i,l,s,t)},"fade"),Ge=d(e=>`.label {
+ font-family: ${e.fontFamily};
+ color: ${e.nodeTextColor||e.textColor};
+ }
+ .cluster-label text {
+ fill: ${e.titleColor};
+ }
+ .cluster-label span,p {
+ color: ${e.titleColor};
+ }
+
+
+
+ .label text,span,p {
+ fill: ${e.nodeTextColor||e.textColor};
+ color: ${e.nodeTextColor||e.textColor};
+ }
+
+ .node rect,
+ .node circle,
+ .node ellipse,
+ .node polygon,
+ .node path {
+ fill: ${e.mainBkg};
+ stroke: ${e.nodeBorder};
+ stroke-width: 1px;
+ }
+ .flowchart-label text {
+ text-anchor: middle;
+ }
+ // .flowchart-label .text-outer-tspan {
+ // text-anchor: middle;
+ // }
+ // .flowchart-label .text-inner-tspan {
+ // text-anchor: start;
+ // }
+
+ .node .label {
+ text-align: center;
+ }
+ .node.clickable {
+ cursor: pointer;
+ }
+
+ .arrowheadPath {
+ fill: ${e.arrowheadColor};
+ }
+
+ .edgePath .path {
+ stroke: ${e.lineColor};
+ stroke-width: 2.0px;
+ }
+
+ .flowchart-link {
+ stroke: ${e.lineColor};
+ fill: none;
+ }
+
+ .edgeLabel {
+ background-color: ${e.edgeLabelBackground};
+ /*
+ * This is for backward compatibility with existing code that didn't
+ * add a \`\` around edge labels.
+ *
+ * TODO: We should probably remove this in a future release.
+ */
+ p {
+ margin: 0;
+ padding: 0;
+ display: inline;
+ }
+ rect {
+ opacity: 0.5;
+ background-color: ${e.edgeLabelBackground};
+ fill: ${e.edgeLabelBackground};
+ }
+ text-align: center;
+ }
+
+ /* For html labels only */
+ .labelBkg {
+ background-color: ${e.edgeLabelBackground};
+ }
+
+ .node .cluster {
+ // fill: ${yt(e.mainBkg,.5)};
+ fill: ${yt(e.clusterBkg,.5)};
+ stroke: ${yt(e.clusterBorder,.2)};
+ box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
+ stroke-width: 1px;
+ }
+
+ .cluster text {
+ fill: ${e.titleColor};
+ }
+
+ .cluster span,p {
+ color: ${e.titleColor};
+ }
+ /* .cluster div {
+ color: ${e.titleColor};
+ } */
+
+ div.mermaidTooltip {
+ position: absolute;
+ text-align: center;
+ max-width: 200px;
+ padding: 2px;
+ font-family: ${e.fontFamily};
+ font-size: 12px;
+ background: ${e.tertiaryColor};
+ border: 1px solid ${e.border2};
+ border-radius: 2px;
+ pointer-events: none;
+ z-index: 100;
+ }
+
+ .flowchartTitleText {
+ text-anchor: middle;
+ font-size: 18px;
+ fill: ${e.textColor};
+ }
+ ${ge()}
+`,"getStyles"),Ze=Ge,qe=d((e,t,a,i)=>{t.forEach(l=>{nr[l](e,a,i)})},"insertMarkers"),Je=d((e,t,a)=>{v.trace("Making markers for ",a),e.append("defs").append("marker").attr("id",a+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),Qe=d((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),$e=d((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),tr=d((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),er=d((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",a+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),rr=d((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",6).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),ar=d((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),sr=d((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),ir=d((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),nr={extension:Je,composition:Qe,aggregation:$e,dependency:tr,lollipop:er,point:rr,circle:ar,cross:sr,barb:ir},lr=qe,Kt,Ut,A=((Ut=(Kt=M())==null?void 0:Kt.block)==null?void 0:Ut.padding)??8;function mt(e,t){if(e===0||!Number.isInteger(e))throw new Error("Columns must be an integer !== 0.");if(t<0||!Number.isInteger(t))throw new Error("Position must be a non-negative integer."+t);if(e<0)return{px:t,py:0};if(e===1)return{px:0,py:t};const a=t%e,i=Math.floor(t/e);return{px:a,py:i}}d(mt,"calculateBlockPosition");var cr=d(e=>{let t=0,a=0;for(const i of e.children){const{width:l,height:s,x:r,y:n}=i.size??{width:0,height:0,x:0,y:0};v.debug("getMaxChildSize abc95 child:",i.id,"width:",l,"height:",s,"x:",r,"y:",n,i.type),i.type!=="space"&&(l>t&&(t=l/(i.widthInColumns??1)),s>a&&(a=s))}return{width:t,height:a}},"getMaxChildSize");function dt(e,t,a=0,i=0){var r,n,c,x,h,f,w,b,m,_,L;v.debug("setBlockSizes abc95 (start)",e.id,(r=e==null?void 0:e.size)==null?void 0:r.x,"block width =",e==null?void 0:e.size,"siblingWidth",a),(n=e==null?void 0:e.size)!=null&&n.width||(e.size={width:a,height:i,x:0,y:0});let l=0,s=0;if(((c=e.children)==null?void 0:c.length)>0){for(const E of e.children)dt(E,t);const B=cr(e);l=B.width,s=B.height,v.debug("setBlockSizes abc95 maxWidth of",e.id,":s children is ",l,s);for(const E of e.children)E.size&&(v.debug(`abc95 Setting size of children of ${e.id} id=${E.id} ${l} ${s} ${JSON.stringify(E.size)}`),E.size.width=l*(E.widthInColumns??1)+A*((E.widthInColumns??1)-1),E.size.height=s,E.size.x=0,E.size.y=0,v.debug(`abc95 updating size of ${e.id} children child:${E.id} maxWidth:${l} maxHeight:${s}`));for(const E of e.children)dt(E,t,l,s);const I=e.columns??-1;let N=0;for(const E of e.children)N+=E.widthInColumns??1;let y=e.children.length;I>0&&I0?Math.min(e.children.length,I):e.children.length;if(E>0){const o=(p-E*A-A)/E;v.debug("abc95 (growing to fit) width",e.id,p,(w=e.size)==null?void 0:w.width,o);for(const k of e.children)k.size&&(k.size.width=o)}}e.size={width:p,height:S,x:0,y:0}}v.debug("setBlockSizes abc94 (done)",e.id,(b=e==null?void 0:e.size)==null?void 0:b.x,(m=e==null?void 0:e.size)==null?void 0:m.width,(_=e==null?void 0:e.size)==null?void 0:_.y,(L=e==null?void 0:e.size)==null?void 0:L.height)}d(dt,"setBlockSizes");function Dt(e,t){var i,l,s,r,n,c,x,h,f,w,b,m,_,L,B,I,N;v.debug(`abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${(i=e==null?void 0:e.size)==null?void 0:i.x} y: ${(l=e==null?void 0:e.size)==null?void 0:l.y} width: ${(s=e==null?void 0:e.size)==null?void 0:s.width}`);const a=e.columns??-1;if(v.debug("layoutBlocks columns abc95",e.id,"=>",a,e),e.children&&e.children.length>0){const y=((n=(r=e==null?void 0:e.children[0])==null?void 0:r.size)==null?void 0:n.width)??0,u=e.children.length*y+(e.children.length-1)*A;v.debug("widthOfChildren 88",u,"posX");const p=new Map;{let g=0;for(const D of e.children){if(!D.size)continue;const{py:T}=mt(a,g),K=p.get(T)??0;D.size.height>K&&p.set(T,D.size.height);let P=(D==null?void 0:D.widthInColumns)??1;a>0&&(P=Math.min(P,a-g%a)),g+=P}}const S=new Map;{let g=0;const D=[...p.keys()].sort((T,K)=>T-K);for(const T of D)S.set(T,g),g+=(p.get(T)??0)+A}let E=0;v.debug("abc91 block?.size?.x",e.id,(c=e==null?void 0:e.size)==null?void 0:c.x);let o=(x=e==null?void 0:e.size)!=null&&x.x?((h=e==null?void 0:e.size)==null?void 0:h.x)+(-((f=e==null?void 0:e.size)==null?void 0:f.width)/2||0):-A,k=0;for(const g of e.children){const D=e;if(!g.size)continue;const{width:T,height:K}=g.size,{px:P,py:Q}=mt(a,E);if(Q!=k&&(k=Q,o=(w=e==null?void 0:e.size)!=null&&w.x?((b=e==null?void 0:e.size)==null?void 0:b.x)+(-((m=e==null?void 0:e.size)==null?void 0:m.width)/2||0):-A,v.debug("New row in layout for block",e.id," and child ",g.id,k)),v.debug(`abc89 layout blocks (child) id: ${g.id} Pos: ${E} (px, py) ${P},${Q} (${(_=D==null?void 0:D.size)==null?void 0:_.x},${(L=D==null?void 0:D.size)==null?void 0:L.y}) parent: ${D.id} width: ${T}${A}`),D.size){const U=T/2;g.size.x=o+A+U,v.debug(`abc91 layout blocks (calc) px, pyid:${g.id} startingPos=X${o} new startingPosX${g.size.x} ${U} padding=${A} width=${T} halfWidth=${U} => x:${g.size.x} y:${g.size.y} ${g.widthInColumns} (width * (child?.w || 1)) / 2 ${T*((g==null?void 0:g.widthInColumns)??1)/2}`),o=g.size.x+U;const et=S.get(Q)??0,rt=p.get(Q)??K;g.size.y=D.size.y-D.size.height/2+et+rt/2+A,v.debug(`abc88 layout blocks (calc) px, pyid:${g.id}startingPosX${o}${A}${U}=>x:${g.size.x}y:${g.size.y}${g.widthInColumns}(width * (child?.w || 1)) / 2${T*((g==null?void 0:g.widthInColumns)??1)/2}`)}g.children&&Dt(g);let R=(g==null?void 0:g.widthInColumns)??1;a>0&&(R=Math.min(R,a-E%a)),E+=R,v.debug("abc88 columnsPos",g,E)}}v.debug(`layout blocks (<==layoutBlocks) ${e.id} x: ${(B=e==null?void 0:e.size)==null?void 0:B.x} y: ${(I=e==null?void 0:e.size)==null?void 0:I.y} width: ${(N=e==null?void 0:e.size)==null?void 0:N.width}`)}d(Dt,"layoutBlocks");function Tt(e,{minX:t,minY:a,maxX:i,maxY:l}={minX:0,minY:0,maxX:0,maxY:0}){if(e.size&&e.id!=="root"){const{x:s,y:r,width:n,height:c}=e.size;s-n/2i&&(i=s+n/2),r+c/2>l&&(l=r+c/2)}if(e.children)for(const s of e.children)({minX:t,minY:a,maxX:i,maxY:l}=Tt(s,{minX:t,minY:a,maxX:i,maxY:l}));return{minX:t,minY:a,maxX:i,maxY:l}}d(Tt,"findBounds");function qt(e){const t=e.getBlock("root");if(!t)return;dt(t,e,0,0),Dt(t),v.debug("getBlocks",JSON.stringify(t,null,2));const{minX:a,minY:i,maxX:l,maxY:s}=Tt(t),r=s-i,n=l-a;return{x:a,y:i,width:n,height:r}}d(qt,"layout");var or=d(async(e,t,a,i=!1,l=!1)=>{let s=t||"";typeof s=="object"&&(s=s[0]);const r=M(),n=Y(r);return await vt(e,s,{style:a,isTitle:i,useHtmlLabels:n,markdown:!1,isNode:l,width:Number.POSITIVE_INFINITY},r)},"createLabel"),G=or,hr=d((e,t,a,i,l)=>{t.arrowTypeStart&&Mt(e,"start",t.arrowTypeStart,a,i,l),t.arrowTypeEnd&&Mt(e,"end",t.arrowTypeEnd,a,i,l)},"addEdgeMarkers"),gr={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},Mt=d((e,t,a,i,l,s)=>{const r=gr[a];if(!r){v.warn(`Unknown arrow type: ${a}`);return}const n=t==="start"?"Start":"End";e.attr(`marker-${t}`,`url(${i}#${l}_${s}-${r}${n})`)},"addEdgeMarker"),Lt={},W={},dr=d(async(e,t)=>{const a=M(),i=Y(a),l=e.insert("g").attr("class","edgeLabel"),s=l.insert("g").attr("class","label"),r=t.labelType==="markdown",n=await vt(e,t.label,{style:t.labelStyle,useHtmlLabels:i,addSvgBackground:r,isNode:!1,markdown:r,width:r?void 0:Number.POSITIVE_INFINITY},a);s.node().appendChild(n);let c=n.getBBox(),x=c;if(i){const f=n.children[0],w=C(n);c=f.getBoundingClientRect(),x=c,w.attr("width",c.width),w.attr("height",c.height)}else{const f=C(n).select("text").node();f&&typeof f.getBBox=="function"&&(x=f.getBBox())}s.attr("transform",at(x,i)),Lt[t.id]=l,t.width=c.width,t.height=c.height;let h;if(t.startLabelLeft){const f=e.insert("g").attr("class","edgeTerminals"),w=f.insert("g").attr("class","inner"),b=await G(w,t.startLabelLeft,t.labelStyle);h=b;let m=b.getBBox();if(i){const _=b.children[0],L=C(b);m=_.getBoundingClientRect(),L.attr("width",m.width),L.attr("height",m.height)}w.attr("transform",at(m,i)),W[t.id]||(W[t.id]={}),W[t.id].startLeft=f,it(h,t.startLabelLeft)}if(t.startLabelRight){const f=e.insert("g").attr("class","edgeTerminals"),w=f.insert("g").attr("class","inner"),b=await G(f,t.startLabelRight,t.labelStyle);h=b,w.node().appendChild(b);let m=b.getBBox();if(i){const _=b.children[0],L=C(b);m=_.getBoundingClientRect(),L.attr("width",m.width),L.attr("height",m.height)}w.attr("transform",at(m,i)),W[t.id]||(W[t.id]={}),W[t.id].startRight=f,it(h,t.startLabelRight)}if(t.endLabelLeft){const f=e.insert("g").attr("class","edgeTerminals"),w=f.insert("g").attr("class","inner"),b=await G(w,t.endLabelLeft,t.labelStyle);h=b;let m=b.getBBox();if(i){const _=b.children[0],L=C(b);m=_.getBoundingClientRect(),L.attr("width",m.width),L.attr("height",m.height)}w.attr("transform",at(m,i)),f.node().appendChild(b),W[t.id]||(W[t.id]={}),W[t.id].endLeft=f,it(h,t.endLabelLeft)}if(t.endLabelRight){const f=e.insert("g").attr("class","edgeTerminals"),w=f.insert("g").attr("class","inner"),b=await G(w,t.endLabelRight,t.labelStyle);h=b;let m=b.getBBox();if(i){const _=b.children[0],L=C(b);m=_.getBoundingClientRect(),L.attr("width",m.width),L.attr("height",m.height)}w.attr("transform",at(m,i)),f.node().appendChild(b),W[t.id]||(W[t.id]={}),W[t.id].endRight=f,it(h,t.endLabelRight)}return n},"insertEdgeLabel");function it(e,t){Y(M())&&e&&(e.style.width=t.length*9+"px",e.style.height="12px")}d(it,"setTerminalWidth");var ur=d((e,t)=>{v.debug("Moving label abc88 ",e.id,e.label,Lt[e.id],t);let a=t.updatedPath?t.updatedPath:t.originalPath;const i=M(),{subGraphTitleTotalMargin:l}=we(i);if(e.label){const s=Lt[e.id];let r=e.x,n=e.y;if(a){const c=st.calcLabelPosition(a);v.debug("Moving label "+e.label+" from (",r,",",n,") to (",c.x,",",c.y,") abc88"),t.updatedPath&&(r=c.x,n=c.y)}s.attr("transform",`translate(${r}, ${n+l/2})`)}if(e.startLabelLeft){const s=W[e.id].startLeft;let r=e.x,n=e.y;if(a){const c=st.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",a);r=c.x,n=c.y}s.attr("transform",`translate(${r}, ${n})`)}if(e.startLabelRight){const s=W[e.id].startRight;let r=e.x,n=e.y;if(a){const c=st.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",a);r=c.x,n=c.y}s.attr("transform",`translate(${r}, ${n})`)}if(e.endLabelLeft){const s=W[e.id].endLeft;let r=e.x,n=e.y;if(a){const c=st.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",a);r=c.x,n=c.y}s.attr("transform",`translate(${r}, ${n})`)}if(e.endLabelRight){const s=W[e.id].endRight;let r=e.x,n=e.y;if(a){const c=st.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",a);r=c.x,n=c.y}s.attr("transform",`translate(${r}, ${n})`)}},"positionEdgeLabel"),pr=d((e,t)=>{const a=e.x,i=e.y,l=Math.abs(t.x-a),s=Math.abs(t.y-i),r=e.width/2,n=e.height/2;return l>=r||s>=n},"outsideNode"),fr=d((e,t,a)=>{v.debug(`intersection calc abc89:
+ outsidePoint: ${JSON.stringify(t)}
+ insidePoint : ${JSON.stringify(a)}
+ node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const i=e.x,l=e.y,s=Math.abs(i-a.x),r=e.width/2;let n=a.xMath.abs(i-t.x)*c){let f=a.y{v.debug("abc88 cutPathAtIntersect",e,t);let a=[],i=e[0],l=!1;return e.forEach(s=>{if(!pr(t,s)&&!l){const r=fr(t,i,s);let n=!1;a.forEach(c=>{n=n||c.x===r.x&&c.y===r.y}),a.some(c=>c.x===r.x&&c.y===r.y)||a.push(r),l=!0}else i=s,l||a.push(s)}),a},"cutPathAtIntersect"),xr=d(function(e,t,a,i,l,s,r){let n=a.points;v.debug("abc88 InsertEdge: edge=",a,"e=",t);let c=!1;const x=s.node(t.v);var h=s.node(t.w);h!=null&&h.intersect&&(x!=null&&x.intersect)&&(n=n.slice(1,a.points.length-1),n.unshift(x.intersect(n[0])),n.push(h.intersect(n[n.length-1]))),a.toCluster&&(v.debug("to cluster abc88",i[a.toCluster]),n=Ft(a.points,i[a.toCluster].node),c=!0),a.fromCluster&&(v.debug("from cluster abc88",i[a.fromCluster]),n=Ft(n.reverse(),i[a.fromCluster].node).reverse(),c=!0);const f=n.filter(y=>!Number.isNaN(y.y));let w=ye;a.curve&&(l==="graph"||l==="flowchart")&&(w=a.curve);const{x:b,y:m}=fe(a),_=xe().x(b).y(m).curve(w);let L;switch(a.thickness){case"normal":L="edge-thickness-normal";break;case"thick":L="edge-thickness-thick";break;case"invisible":L="edge-thickness-thick";break;default:L=""}switch(a.pattern){case"solid":L+=" edge-pattern-solid";break;case"dotted":L+=" edge-pattern-dotted";break;case"dashed":L+=" edge-pattern-dashed";break}const B=e.append("path").attr("d",_(f)).attr("id",a.id).attr("class"," "+L+(a.classes?" "+a.classes:"")).attr("style",a.style);let I="";(M().flowchart.arrowMarkerAbsolute||M().state.arrowMarkerAbsolute)&&(I=be(!0)),hr(B,a,I,r,l);let N={};return c&&(N.updatedPath=n),N.originalPath=a.points,N},"insertEdge"),yr=d(e=>{const t=new Set;for(const a of e)switch(a){case"x":t.add("right"),t.add("left");break;case"y":t.add("up"),t.add("down");break;default:t.add(a);break}return t},"expandAndDeduplicateDirections"),br=d((e,t,a)=>{const i=yr(e),l=2,s=t.height+2*a.padding,r=s/l,n=t.width+2*r+a.padding,c=a.padding/2;return i.has("right")&&i.has("left")&&i.has("up")&&i.has("down")?[{x:0,y:0},{x:r,y:0},{x:n/2,y:2*c},{x:n-r,y:0},{x:n,y:0},{x:n,y:-s/3},{x:n+2*c,y:-s/2},{x:n,y:-2*s/3},{x:n,y:-s},{x:n-r,y:-s},{x:n/2,y:-s-2*c},{x:r,y:-s},{x:0,y:-s},{x:0,y:-2*s/3},{x:-2*c,y:-s/2},{x:0,y:-s/3}]:i.has("right")&&i.has("left")&&i.has("up")?[{x:r,y:0},{x:n-r,y:0},{x:n,y:-s/2},{x:n-r,y:-s},{x:r,y:-s},{x:0,y:-s/2}]:i.has("right")&&i.has("left")&&i.has("down")?[{x:0,y:0},{x:r,y:-s},{x:n-r,y:-s},{x:n,y:0}]:i.has("right")&&i.has("up")&&i.has("down")?[{x:0,y:0},{x:n,y:-r},{x:n,y:-s+r},{x:0,y:-s}]:i.has("left")&&i.has("up")&&i.has("down")?[{x:n,y:0},{x:0,y:-r},{x:0,y:-s+r},{x:n,y:-s}]:i.has("right")&&i.has("left")?[{x:r,y:0},{x:r,y:-c},{x:n-r,y:-c},{x:n-r,y:0},{x:n,y:-s/2},{x:n-r,y:-s},{x:n-r,y:-s+c},{x:r,y:-s+c},{x:r,y:-s},{x:0,y:-s/2}]:i.has("up")&&i.has("down")?[{x:n/2,y:0},{x:0,y:-c},{x:r,y:-c},{x:r,y:-s+c},{x:0,y:-s+c},{x:n/2,y:-s},{x:n,y:-s+c},{x:n-r,y:-s+c},{x:n-r,y:-c},{x:n,y:-c}]:i.has("right")&&i.has("up")?[{x:0,y:0},{x:n,y:-r},{x:0,y:-s}]:i.has("right")&&i.has("down")?[{x:0,y:0},{x:n,y:0},{x:0,y:-s}]:i.has("left")&&i.has("up")?[{x:n,y:0},{x:0,y:-r},{x:n,y:-s}]:i.has("left")&&i.has("down")?[{x:n,y:0},{x:0,y:0},{x:n,y:-s}]:i.has("right")?[{x:r,y:-c},{x:r,y:-c},{x:n-r,y:-c},{x:n-r,y:0},{x:n,y:-s/2},{x:n-r,y:-s},{x:n-r,y:-s+c},{x:r,y:-s+c},{x:r,y:-s+c}]:i.has("left")?[{x:r,y:0},{x:r,y:-c},{x:n-r,y:-c},{x:n-r,y:-s+c},{x:r,y:-s+c},{x:r,y:-s},{x:0,y:-s/2}]:i.has("up")?[{x:r,y:-c},{x:r,y:-s+c},{x:0,y:-s+c},{x:n/2,y:-s},{x:n,y:-s+c},{x:n-r,y:-s+c},{x:n-r,y:-c}]:i.has("down")?[{x:n/2,y:0},{x:0,y:-c},{x:r,y:-c},{x:r,y:-s+c},{x:n-r,y:-s+c},{x:n-r,y:-c},{x:n,y:-c}]:[{x:0,y:0}]},"getArrowPoints");function Jt(e,t){return e.intersect(t)}d(Jt,"intersectNode");var wr=Jt;function Qt(e,t,a,i){var l=e.x,s=e.y,r=l-i.x,n=s-i.y,c=Math.sqrt(t*t*n*n+a*a*r*r),x=Math.abs(t*a*r/c);i.x0}d(St,"sameSign");var Lr=ee,Sr=re;function re(e,t,a){var i=e.x,l=e.y,s=[],r=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(m){r=Math.min(r,m.x),n=Math.min(n,m.y)}):(r=Math.min(r,t.x),n=Math.min(n,t.y));for(var c=i-e.width/2-r,x=l-e.height/2-n,h=0;h1&&s.sort(function(m,_){var L=m.x-a.x,B=m.y-a.y,I=Math.sqrt(L*L+B*B),N=_.x-a.x,y=_.y-a.y,u=Math.sqrt(N*N+y*y);return I{var a=e.x,i=e.y,l=t.x-a,s=t.y-i,r=e.width/2,n=e.height/2,c,x;return Math.abs(s)*r>Math.abs(l)*n?(s<0&&(n=-n),c=s===0?0:n*l/s,x=n):(l<0&&(r=-r),c=r,x=l===0?0:r*s/l),{x:a+c,y:i+x}},"intersectRect"),Er=vr,O={node:wr,circle:mr,ellipse:$t,polygon:Sr,rect:Er},F=d(async(e,t,a,i)=>{const l=M();let s;const r=t.useHtmlLabels||Y(l);a?s=a:s="node default";const n=e.insert("g").attr("class",s).attr("id",t.domId||t.id),c=n.insert("g").attr("class","label").attr("style",t.labelStyle);let x;t.labelText===void 0?x="":x=typeof t.labelText=="string"?t.labelText:t.labelText[0];let h;t.labelType==="markdown"?h=vt(c,Ct(Ot(x),l),{useHtmlLabels:r,width:t.width||l.flowchart.wrappingWidth,classes:"markdown-node-label"},l):h=await G(c,Ct(Ot(x),l),t.labelStyle,!1,i);let f=h.getBBox();const w=t.padding/2;if(Y(l)){const b=h.children[0],m=C(h);await Se(b,x),f=b.getBoundingClientRect(),m.attr("width",f.width),m.attr("height",f.height)}return r?c.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"):c.attr("transform","translate(0, "+-f.height/2+")"),t.centerLabel&&c.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),c.insert("rect",":first-child"),{shapeSvg:n,bbox:f,halfPadding:w,label:c}},"labelHelper"),z=d((e,t)=>{const a=t.node().getBBox();e.width=a.width,e.height=a.height},"updateNodeBounds");function q(e,t,a,i){return e.insert("polygon",":first-child").attr("points",i.map(function(l){return l.x+","+l.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+a/2+")")}d(q,"insertPolygonShape");var _r=d(async(e,t)=>{t.useHtmlLabels||Y(M())||(t.centerLabel=!0);const{shapeSvg:i,bbox:l,halfPadding:s}=await F(e,t,"node "+t.classes,!0);v.info("Classes = ",t.classes);const r=i.insert("rect",":first-child");return r.attr("rx",t.rx).attr("ry",t.ry).attr("x",-l.width/2-s).attr("y",-l.height/2-s).attr("width",l.width+t.padding).attr("height",l.height+t.padding),z(t,r),t.intersect=function(n){return O.rect(t,n)},i},"note"),kr=_r,Pt=d(e=>e?" "+e:"","formatClass"),j=d((e,t)=>`${t||"node default"}${Pt(e.classes)} ${Pt(e.class)}`,"getClassesFromNode"),Wt=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await F(e,t,j(t,void 0),!0),l=i.width+t.padding,s=i.height+t.padding,r=l+s,n=[{x:r/2,y:0},{x:r,y:-r/2},{x:r/2,y:-r},{x:0,y:-r/2}];v.info("Question main (Circle)");const c=q(a,r,r,n);return c.attr("style",t.style),z(t,c),t.intersect=function(x){return v.warn("Intersect called"),O.polygon(t,n,x)},a},"question"),Dr=d((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),i=28,l=[{x:0,y:i/2},{x:i/2,y:0},{x:0,y:-i/2},{x:-i/2,y:0}];return a.insert("polygon",":first-child").attr("points",l.map(function(r){return r.x+","+r.y}).join(" ")).attr("class","state-start").attr("r",7).attr("width",28).attr("height",28),t.width=28,t.height=28,t.intersect=function(r){return O.circle(t,14,r)},a},"choice"),Tr=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await F(e,t,j(t,void 0),!0),l=4,s=i.height+t.padding,r=s/l,n=i.width+2*r+t.padding,c=[{x:r,y:0},{x:n-r,y:0},{x:n,y:-s/2},{x:n-r,y:-s},{x:r,y:-s},{x:0,y:-s/2}],x=q(a,n,s,c);return x.attr("style",t.style),z(t,x),t.intersect=function(h){return O.polygon(t,c,h)},a},"hexagon"),Nr=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await F(e,t,void 0,!0),l=2,s=i.height+2*t.padding,r=s/l,n=i.width+2*r+t.padding,c=br(t.directions,i,t),x=q(a,n,s,c);return x.attr("style",t.style),z(t,x),t.intersect=function(h){return O.polygon(t,c,h)},a},"block_arrow"),Ir=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await F(e,t,j(t,void 0),!0),l=i.width+t.padding,s=i.height+t.padding,r=[{x:-s/2,y:0},{x:l,y:0},{x:l,y:-s},{x:-s/2,y:-s},{x:0,y:-s/2}];return q(a,l,s,r).attr("style",t.style),t.width=l+s,t.height=s,t.intersect=function(c){return O.polygon(t,r,c)},a},"rect_left_inv_arrow"),Br=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await F(e,t,j(t),!0),l=i.width+t.padding,s=i.height+t.padding,r=[{x:-2*s/6,y:0},{x:l-s/6,y:0},{x:l+2*s/6,y:-s},{x:s/6,y:-s}],n=q(a,l,s,r);return n.attr("style",t.style),z(t,n),t.intersect=function(c){return O.polygon(t,r,c)},a},"lean_right"),Cr=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await F(e,t,j(t,void 0),!0),l=i.width+t.padding,s=i.height+t.padding,r=[{x:2*s/6,y:0},{x:l+s/6,y:0},{x:l-2*s/6,y:-s},{x:-s/6,y:-s}],n=q(a,l,s,r);return n.attr("style",t.style),z(t,n),t.intersect=function(c){return O.polygon(t,r,c)},a},"lean_left"),Or=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await F(e,t,j(t,void 0),!0),l=i.width+t.padding,s=i.height+t.padding,r=[{x:-2*s/6,y:0},{x:l+2*s/6,y:0},{x:l-s/6,y:-s},{x:s/6,y:-s}],n=q(a,l,s,r);return n.attr("style",t.style),z(t,n),t.intersect=function(c){return O.polygon(t,r,c)},a},"trapezoid"),Rr=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await F(e,t,j(t,void 0),!0),l=i.width+t.padding,s=i.height+t.padding,r=[{x:s/6,y:0},{x:l-s/6,y:0},{x:l+2*s/6,y:-s},{x:-2*s/6,y:-s}],n=q(a,l,s,r);return n.attr("style",t.style),z(t,n),t.intersect=function(c){return O.polygon(t,r,c)},a},"inv_trapezoid"),zr=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await F(e,t,j(t,void 0),!0),l=i.width+t.padding,s=i.height+t.padding,r=[{x:0,y:0},{x:l+s/2,y:0},{x:l,y:-s/2},{x:l+s/2,y:-s},{x:0,y:-s}],n=q(a,l,s,r);return n.attr("style",t.style),z(t,n),t.intersect=function(c){return O.polygon(t,r,c)},a},"rect_right_inv_arrow"),Ar=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await F(e,t,j(t,void 0),!0),l=i.width+t.padding,s=l/2,r=s/(2.5+l/50),n=i.height+r+t.padding,c="M 0,"+r+" a "+s+","+r+" 0,0,0 "+l+" 0 a "+s+","+r+" 0,0,0 "+-l+" 0 l 0,"+n+" a "+s+","+r+" 0,0,0 "+l+" 0 l 0,"+-n,x=a.attr("label-offset-y",r).insert("path",":first-child").attr("style",t.style).attr("d",c).attr("transform","translate("+-l/2+","+-(n/2+r)+")");return z(t,x),t.intersect=function(h){const f=O.rect(t,h),w=f.x-t.x;if(s!=0&&(Math.abs(w)t.height/2-r)){let b=r*r*(1-w*w/(s*s));b!=0&&(b=Math.sqrt(b)),b=r-b,h.y-t.y>0&&(b=-b),f.y+=b}return f},a},"cylinder"),Mr=d(async(e,t)=>{const{shapeSvg:a,bbox:i,halfPadding:l}=await F(e,t,"node "+t.classes+" "+t.class,!0),s=a.insert("rect",":first-child"),r=t.positioned?t.width:i.width+t.padding,n=t.positioned?t.height:i.height+t.padding,c=t.positioned?-r/2:-i.width/2-l,x=t.positioned?-n/2:-i.height/2-l;if(s.attr("class","basic label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",c).attr("y",x).attr("width",r).attr("height",n),t.props){const h=new Set(Object.keys(t.props));t.props.borders&&(ut(s,t.props.borders,r,n),h.delete("borders")),h.forEach(f=>{v.warn(`Unknown node property ${f}`)})}return z(t,s),t.intersect=function(h){return O.rect(t,h)},a},"rect"),Fr=d(async(e,t)=>{const{shapeSvg:a,bbox:i,halfPadding:l}=await F(e,t,"node "+t.classes,!0),s=a.insert("rect",":first-child"),r=t.positioned?t.width:i.width+t.padding,n=t.positioned?t.height:i.height+t.padding,c=t.positioned?-r/2:-i.width/2-l,x=t.positioned?-n/2:-i.height/2-l;if(s.attr("class","basic cluster composite label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",c).attr("y",x).attr("width",r).attr("height",n),t.props){const h=new Set(Object.keys(t.props));t.props.borders&&(ut(s,t.props.borders,r,n),h.delete("borders")),h.forEach(f=>{v.warn(`Unknown node property ${f}`)})}return z(t,s),t.intersect=function(h){return O.rect(t,h)},a},"composite"),Pr=d(async(e,t)=>{const{shapeSvg:a}=await F(e,t,"label",!0);v.trace("Classes = ",t.class);const i=a.insert("rect",":first-child"),l=0,s=0;if(i.attr("width",l).attr("height",s),a.attr("class","label edgeLabel"),t.props){const r=new Set(Object.keys(t.props));t.props.borders&&(ut(i,t.props.borders,l,s),r.delete("borders")),r.forEach(n=>{v.warn(`Unknown node property ${n}`)})}return z(t,i),t.intersect=function(r){return O.rect(t,r)},a},"labelRect");function ut(e,t,a,i){const l=[],s=d(n=>{l.push(n,0)},"addBorder"),r=d(n=>{l.push(0,n)},"skipBorder");t.includes("t")?(v.debug("add top border"),s(a)):r(a),t.includes("r")?(v.debug("add right border"),s(i)):r(i),t.includes("b")?(v.debug("add bottom border"),s(a)):r(a),t.includes("l")?(v.debug("add left border"),s(i)):r(i),e.attr("stroke-dasharray",l.join(" "))}d(ut,"applyNodePropertyBorders");var Wr=d(async(e,t)=>{let a;t.classes?a="node "+t.classes:a="node default";const i=e.insert("g").attr("class",a).attr("id",t.domId||t.id),l=i.insert("rect",":first-child"),s=i.insert("line"),r=i.insert("g").attr("class","label"),n=t.labelText.flat?t.labelText.flat():t.labelText;let c="";typeof n=="object"?c=n[0]:c=n,v.info("Label text abc79",c,n,typeof n=="object");const x=await G(r,c,t.labelStyle,!0,!0);let h={width:0,height:0};if(Y(M())){const _=x.children[0],L=C(x);h=_.getBoundingClientRect(),L.attr("width",h.width),L.attr("height",h.height)}v.info("Text 2",n);const f=n.slice(1,n.length);let w=x.getBBox();const b=await G(r,f.join?f.join("
"):f,t.labelStyle,!0,!0);if(Y(M())){const _=b.children[0],L=C(b);h=_.getBoundingClientRect(),L.attr("width",h.width),L.attr("height",h.height)}const m=t.padding/2;return C(b).attr("transform","translate( "+(h.width>w.width?0:(w.width-h.width)/2)+", "+(w.height+m+5)+")"),C(x).attr("transform","translate( "+(h.width{const{shapeSvg:a,bbox:i}=await F(e,t,j(t,void 0),!0),l=i.height+t.padding,s=i.width+l/4+t.padding,r=a.insert("rect",":first-child").attr("style",t.style).attr("rx",l/2).attr("ry",l/2).attr("x",-s/2).attr("y",-l/2).attr("width",s).attr("height",l);return z(t,r),t.intersect=function(n){return O.rect(t,n)},a},"stadium"),Hr=d(async(e,t)=>{const{shapeSvg:a,bbox:i,halfPadding:l}=await F(e,t,j(t,void 0),!0),s=a.insert("circle",":first-child");return s.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",i.width/2+l).attr("width",i.width+t.padding).attr("height",i.height+t.padding),v.info("Circle main"),z(t,s),t.intersect=function(r){return v.info("Circle intersect",t,i.width/2+l,r),O.circle(t,i.width/2+l,r)},a},"circle"),Kr=d(async(e,t)=>{const{shapeSvg:a,bbox:i,halfPadding:l}=await F(e,t,j(t,void 0),!0),s=5,r=a.insert("g",":first-child"),n=r.insert("circle"),c=r.insert("circle");return r.attr("class",t.class),n.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",i.width/2+l+s).attr("width",i.width+t.padding+s*2).attr("height",i.height+t.padding+s*2),c.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",i.width/2+l).attr("width",i.width+t.padding).attr("height",i.height+t.padding),v.info("DoubleCircle main"),z(t,n),t.intersect=function(x){return v.info("DoubleCircle intersect",t,i.width/2+l+s,x),O.circle(t,i.width/2+l+s,x)},a},"doublecircle"),Ur=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await F(e,t,j(t,void 0),!0),l=i.width+t.padding,s=i.height+t.padding,r=[{x:0,y:0},{x:l,y:0},{x:l,y:-s},{x:0,y:-s},{x:0,y:0},{x:-8,y:0},{x:l+8,y:0},{x:l+8,y:-s},{x:-8,y:-s},{x:-8,y:0}],n=q(a,l,s,r);return n.attr("style",t.style),z(t,n),t.intersect=function(c){return O.polygon(t,r,c)},a},"subroutine"),Xr=d((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),i=a.insert("circle",":first-child");return i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),z(t,i),t.intersect=function(l){return O.circle(t,7,l)},a},"start"),Yt=d((e,t,a)=>{const i=e.insert("g").attr("class","node default").attr("id",t.domId||t.id);let l=70,s=10;a==="LR"&&(l=10,s=70);const r=i.append("rect").attr("x",-1*l/2).attr("y",-1*s/2).attr("width",l).attr("height",s).attr("class","fork-join");return z(t,r),t.height=t.height+t.padding/2,t.width=t.width+t.padding/2,t.intersect=function(n){return O.rect(t,n)},i},"forkJoin"),jr=d((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),i=a.insert("circle",":first-child"),l=a.insert("circle",":first-child");return l.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),i.attr("class","state-end").attr("r",5).attr("width",10).attr("height",10),z(t,l),t.intersect=function(s){return O.circle(t,7,s)},a},"end"),Vr=d(async(e,t)=>{var E;const a=t.padding/2,i=4,l=8;let s;t.classes?s="node "+t.classes:s="node default";const r=e.insert("g").attr("class",s).attr("id",t.domId||t.id),n=r.insert("rect",":first-child"),c=r.insert("line"),x=r.insert("line");let h=0,f=i;const w=r.insert("g").attr("class","label");let b=0;const m=(E=t.classData.annotations)==null?void 0:E[0],_=t.classData.annotations[0]?"«"+t.classData.annotations[0]+"»":"",L=await G(w,_,t.labelStyle,!0,!0);let B=L.getBBox();if(Y(M())){const o=L.children[0],k=C(L);B=o.getBoundingClientRect(),k.attr("width",B.width),k.attr("height",B.height)}t.classData.annotations[0]&&(f+=B.height+i,h+=B.width);let I=t.classData.label;t.classData.type!==void 0&&t.classData.type!==""&&(Y(M())?I+="<"+t.classData.type+">":I+="<"+t.classData.type+">");const N=await G(w,I,t.labelStyle,!0,!0);C(N).attr("class","classTitle");let y=N.getBBox();if(Y(M())){const o=N.children[0],k=C(N);y=o.getBoundingClientRect(),k.attr("width",y.width),k.attr("height",y.height)}f+=y.height+i,y.width>h&&(h=y.width);const u=[];t.classData.members.forEach(async o=>{const k=o.getDisplayDetails();let g=k.displayText;Y(M())&&(g=g.replace(/
/g,">"));const D=await G(w,g,k.cssStyle?k.cssStyle:t.labelStyle,!0,!0);let T=D.getBBox();if(Y(M())){const K=D.children[0],P=C(D);T=K.getBoundingClientRect(),P.attr("width",T.width),P.attr("height",T.height)}T.width>h&&(h=T.width),f+=T.height+i,u.push(D)}),f+=l;const p=[];if(t.classData.methods.forEach(async o=>{const k=o.getDisplayDetails();let g=k.displayText;Y(M())&&(g=g.replace(/
/g,">"));const D=await G(w,g,k.cssStyle?k.cssStyle:t.labelStyle,!0,!0);let T=D.getBBox();if(Y(M())){const K=D.children[0],P=C(D);T=K.getBoundingClientRect(),P.attr("width",T.width),P.attr("height",T.height)}T.width>h&&(h=T.width),f+=T.height+i,p.push(D)}),f+=l,m){let o=(h-B.width)/2;C(L).attr("transform","translate( "+(-1*h/2+o)+", "+-1*f/2+")"),b=B.height+i}let S=(h-y.width)/2;return C(N).attr("transform","translate( "+(-1*h/2+S)+", "+(-1*f/2+b)+")"),b+=y.height+i,c.attr("class","divider").attr("x1",-h/2-a).attr("x2",h/2+a).attr("y1",-f/2-a+l+b).attr("y2",-f/2-a+l+b),b+=l,u.forEach(o=>{C(o).attr("transform","translate( "+-h/2+", "+(-1*f/2+b+l/2)+")");const k=o==null?void 0:o.getBBox();b+=((k==null?void 0:k.height)??0)+i}),b+=l,x.attr("class","divider").attr("x1",-h/2-a).attr("x2",h/2+a).attr("y1",-f/2-a+l+b).attr("y2",-f/2-a+l+b),b+=l,p.forEach(o=>{C(o).attr("transform","translate( "+-h/2+", "+(-1*f/2+b)+")");const k=o==null?void 0:o.getBBox();b+=((k==null?void 0:k.height)??0)+i}),n.attr("style",t.style).attr("class","outer title-state").attr("x",-h/2-a).attr("y",-(f/2)-a).attr("width",h+t.padding).attr("height",f+t.padding),z(t,n),t.intersect=function(o){return O.rect(t,o)},r},"class_box"),Ht={rhombus:Wt,composite:Fr,question:Wt,rect:Mr,labelRect:Pr,rectWithTitle:Wr,choice:Dr,circle:Hr,doublecircle:Kr,stadium:Yr,hexagon:Tr,block_arrow:Nr,rect_left_inv_arrow:Ir,lean_right:Br,lean_left:Cr,trapezoid:Or,inv_trapezoid:Rr,rect_right_inv_arrow:zr,cylinder:Ar,start:Xr,end:jr,note:kr,subroutine:Ur,fork:Yt,join:Yt,class_box:Vr},ht={},ae=d(async(e,t,a)=>{let i,l;if(t.link){let s;M().securityLevel==="sandbox"?s="_top":t.linkTarget&&(s=t.linkTarget||"_blank"),i=e.insert("svg:a").attr("xlink:href",t.link).attr("target",s),l=await Ht[t.shape](i,t,a)}else l=await Ht[t.shape](e,t,a),i=l;return t.tooltip&&l.attr("title",t.tooltip),t.class&&l.attr("class","node default "+t.class),ht[t.id]=i,t.haveCallback&&ht[t.id].attr("class",ht[t.id].attr("class")+" clickable"),i},"insertNode"),Gr=d(e=>{const t=ht[e.id];v.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");const a=8,i=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+i-e.width/2)+", "+(e.y-e.height/2-a)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),i},"positionNode");function Nt(e,t,a=!1){var b,m,_;const i=e;let l="default";(((b=i==null?void 0:i.classes)==null?void 0:b.length)||0)>0&&(l=((i==null?void 0:i.classes)??[]).join(" ")),l=l+" flowchart-label";let s=0,r="",n;switch(i.type){case"round":s=5,r="rect";break;case"composite":s=0,r="composite",n=0;break;case"square":r="rect";break;case"diamond":r="question";break;case"hexagon":r="hexagon";break;case"block_arrow":r="block_arrow";break;case"odd":r="rect_left_inv_arrow";break;case"lean_right":r="lean_right";break;case"lean_left":r="lean_left";break;case"trapezoid":r="trapezoid";break;case"inv_trapezoid":r="inv_trapezoid";break;case"rect_left_inv_arrow":r="rect_left_inv_arrow";break;case"circle":r="circle";break;case"ellipse":r="ellipse";break;case"stadium":r="stadium";break;case"subroutine":r="subroutine";break;case"cylinder":r="cylinder";break;case"group":r="rect";break;case"doublecircle":r="doublecircle";break;default:r="rect"}const c=Le((i==null?void 0:i.styles)??[]),x=i.label,h=i.size??{width:0,height:0,x:0,y:0},f=t.getDiagramId();return{labelStyle:c.labelStyle,shape:r,labelText:x,rx:s,ry:s,class:l,style:c.style,id:i.id,domId:f?`${f}-${i.id}`:i.id,directions:i.directions,width:h.width,height:h.height,x:h.x,y:h.y,positioned:a,intersect:void 0,type:i.type,padding:n??((_=(m=lt())==null?void 0:m.block)==null?void 0:_.padding)??0}}d(Nt,"getNodeFromBlock");async function se(e,t,a){const i=Nt(t,a,!1);if(i.type==="group")return;const l=lt(),s=await ae(e,i,{config:l}),r=s.node().getBBox(),n=a.getBlock(i.id);n.size={width:r.width,height:r.height,x:0,y:0,node:s},a.setBlock(n),s.remove()}d(se,"calculateBlockSize");async function ie(e,t,a){const i=Nt(t,a,!0);if(a.getBlock(i.id).type!=="space"){const s=lt();await ae(e,i,{config:s}),t.intersect=i==null?void 0:i.intersect,Gr(i)}}d(ie,"insertBlockPositioned");async function pt(e,t,a,i){for(const l of t)await i(e,l,a),l.children&&await pt(e,l.children,a,i)}d(pt,"performOperations");async function ne(e,t,a){await pt(e,t,a,se)}d(ne,"calculateBlockSizes");async function le(e,t,a){await pt(e,t,a,ie)}d(le,"insertBlocks");async function ce(e,t,a,i,l){const s=new Ee({multigraph:!0,compound:!0});s.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(const r of a)r.size&&s.setNode(r.id,{width:r.size.width,height:r.size.height,intersect:r.intersect});for(const r of t)if(r.start&&r.end){const n=i.getBlock(r.start),c=i.getBlock(r.end);if(n!=null&&n.size&&(c!=null&&c.size)){const x=n.size,h=c.size,f=[{x:x.x,y:x.y},{x:x.x+(h.x-x.x)/2,y:x.y+(h.y-x.y)/2},{x:h.x,y:h.y}],w=l?`${l}-${r.id}`:r.id;xr(e,{v:r.start,w:r.end,name:w},{...r,id:w,arrowTypeEnd:r.arrowTypeEnd,arrowTypeStart:r.arrowTypeStart,points:f,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"},void 0,"block",s,l),r.label&&(await dr(e,{...r,label:r.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:r.arrowTypeEnd,arrowTypeStart:r.arrowTypeStart,points:f,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"}),ur({...r,x:f[1].x,y:f[1].y},{originalPath:f}))}}}d(ce,"insertEdges");var Zr=d(function(e,t){return t.db.getClasses()},"getClasses"),qr=d(async function(e,t,a,i){const{securityLevel:l,block:s}=lt(),r=i.db;r.setDiagramId(t);let n;l==="sandbox"&&(n=C("#i"+t));const c=l==="sandbox"?C(n.nodes()[0].contentDocument.body):C("body"),x=l==="sandbox"?c.select(`[id="${t}"]`):C(`[id="${t}"]`);lr(x,["point","circle","cross"],i.type,t);const f=r.getBlocks(),w=r.getBlocksFlat(),b=r.getEdges(),m=x.insert("g").attr("class","block");await ne(m,f,r);const _=qt(r);if(await le(m,f,r),await ce(m,b,w,r,t),_){const L=_,B=Math.max(1,Math.round(.125*(L.width/L.height))),I=L.height+B+10,N=L.width+10,{useMaxWidth:y}=s;de(x,I,N,!!y),v.debug("Here Bounds",_,L),x.attr("viewBox",`${L.x-5} ${L.y-5} ${L.width+10} ${L.height+10}`)}},"draw"),Jr={draw:qr,getClasses:Zr},ia={parser:ke,db:Ve,renderer:Jr,styles:Ze};export{ia as diagram};
diff --git a/dist-desktop/assets/c4Diagram-AHTNJAMY-Cnif2nNv.js b/dist-desktop/assets/c4Diagram-AHTNJAMY-Cnif2nNv.js
new file mode 100644
index 0000000..c1e4457
--- /dev/null
+++ b/dist-desktop/assets/c4Diagram-AHTNJAMY-Cnif2nNv.js
@@ -0,0 +1,10 @@
+import{g as Se,d as De}from"./chunk-YZCP3GAM-Blce-T0j.js";import{s as Pe,g as Be,a as Ie,b as Me,_ as y,c as Bt,d as jt,l as de,e as Le,f as Ne,h as Tt,i as ge,j as Ye,w as je,k as $t,m as fe}from"./mermaid.core-DD7RPEfx.js";import"./index-jkhvCyNw.js";var Ft=(function(){var a=y(function(_t,x,v,E){for(v=v||{},E=_t.length;E--;v[_t[E]]=x);return v},"o"),t=[1,24],s=[1,25],o=[1,26],r=[1,27],l=[1,28],e=[1,63],n=[1,64],i=[1,65],u=[1,66],d=[1,67],f=[1,68],g=[1,69],m=[1,29],O=[1,30],S=[1,31],P=[1,32],M=[1,33],U=[1,34],H=[1,35],q=[1,36],G=[1,37],K=[1,38],J=[1,39],Z=[1,40],$=[1,41],tt=[1,42],et=[1,43],at=[1,44],it=[1,45],nt=[1,46],st=[1,47],rt=[1,48],lt=[1,50],ot=[1,51],ct=[1,52],ht=[1,53],ut=[1,54],dt=[1,55],ft=[1,56],pt=[1,57],yt=[1,58],gt=[1,59],bt=[1,60],Ct=[14,42],Qt=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],St=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],A=[1,82],k=[1,83],C=[1,84],w=[1,85],T=[12,14,42],le=[12,14,33,42],Mt=[12,14,33,42,76,77,79,80],vt=[12,33],Ht=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],qt={trace:y(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:y(function(x,v,E,b,R,h,Dt){var p=h.length-1;switch(R){case 3:b.setDirection("TB");break;case 4:b.setDirection("BT");break;case 5:b.setDirection("RL");break;case 6:b.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:b.setC4Type(h[p-3]);break;case 19:b.setTitle(h[p].substring(6)),this.$=h[p].substring(6);break;case 20:b.setAccDescription(h[p].substring(15)),this.$=h[p].substring(15);break;case 21:this.$=h[p].trim(),b.setTitle(this.$);break;case 22:case 23:this.$=h[p].trim(),b.setAccDescription(this.$);break;case 28:h[p].splice(2,0,"ENTERPRISE"),b.addPersonOrSystemBoundary(...h[p]),this.$=h[p];break;case 29:h[p].splice(2,0,"SYSTEM"),b.addPersonOrSystemBoundary(...h[p]),this.$=h[p];break;case 30:b.addPersonOrSystemBoundary(...h[p]),this.$=h[p];break;case 31:h[p].splice(2,0,"CONTAINER"),b.addContainerBoundary(...h[p]),this.$=h[p];break;case 32:b.addDeploymentNode("node",...h[p]),this.$=h[p];break;case 33:b.addDeploymentNode("nodeL",...h[p]),this.$=h[p];break;case 34:b.addDeploymentNode("nodeR",...h[p]),this.$=h[p];break;case 35:b.popBoundaryParseStack();break;case 39:b.addPersonOrSystem("person",...h[p]),this.$=h[p];break;case 40:b.addPersonOrSystem("external_person",...h[p]),this.$=h[p];break;case 41:b.addPersonOrSystem("system",...h[p]),this.$=h[p];break;case 42:b.addPersonOrSystem("system_db",...h[p]),this.$=h[p];break;case 43:b.addPersonOrSystem("system_queue",...h[p]),this.$=h[p];break;case 44:b.addPersonOrSystem("external_system",...h[p]),this.$=h[p];break;case 45:b.addPersonOrSystem("external_system_db",...h[p]),this.$=h[p];break;case 46:b.addPersonOrSystem("external_system_queue",...h[p]),this.$=h[p];break;case 47:b.addContainer("container",...h[p]),this.$=h[p];break;case 48:b.addContainer("container_db",...h[p]),this.$=h[p];break;case 49:b.addContainer("container_queue",...h[p]),this.$=h[p];break;case 50:b.addContainer("external_container",...h[p]),this.$=h[p];break;case 51:b.addContainer("external_container_db",...h[p]),this.$=h[p];break;case 52:b.addContainer("external_container_queue",...h[p]),this.$=h[p];break;case 53:b.addComponent("component",...h[p]),this.$=h[p];break;case 54:b.addComponent("component_db",...h[p]),this.$=h[p];break;case 55:b.addComponent("component_queue",...h[p]),this.$=h[p];break;case 56:b.addComponent("external_component",...h[p]),this.$=h[p];break;case 57:b.addComponent("external_component_db",...h[p]),this.$=h[p];break;case 58:b.addComponent("external_component_queue",...h[p]),this.$=h[p];break;case 60:b.addRel("rel",...h[p]),this.$=h[p];break;case 61:b.addRel("birel",...h[p]),this.$=h[p];break;case 62:b.addRel("rel_u",...h[p]),this.$=h[p];break;case 63:b.addRel("rel_d",...h[p]),this.$=h[p];break;case 64:b.addRel("rel_l",...h[p]),this.$=h[p];break;case 65:b.addRel("rel_r",...h[p]),this.$=h[p];break;case 66:b.addRel("rel_b",...h[p]),this.$=h[p];break;case 67:h[p].splice(0,1),b.addRel("rel",...h[p]),this.$=h[p];break;case 68:b.updateElStyle("update_el_style",...h[p]),this.$=h[p];break;case 69:b.updateRelStyle("update_rel_style",...h[p]),this.$=h[p];break;case 70:b.updateLayoutConfig("update_layout_config",...h[p]),this.$=h[p];break;case 71:this.$=[h[p]];break;case 72:h[p].unshift(h[p-1]),this.$=h[p];break;case 73:case 75:this.$=h[p].trim();break;case 74:let Et={};Et[h[p-1].trim()]=h[p].trim(),this.$=Et;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:t,23:s,24:o,26:r,28:l,29:49,30:61,32:62,34:e,36:n,37:i,38:u,39:d,40:f,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:70,19:20,20:21,21:22,22:t,23:s,24:o,26:r,28:l,29:49,30:61,32:62,34:e,36:n,37:i,38:u,39:d,40:f,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:71,19:20,20:21,21:22,22:t,23:s,24:o,26:r,28:l,29:49,30:61,32:62,34:e,36:n,37:i,38:u,39:d,40:f,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:72,19:20,20:21,21:22,22:t,23:s,24:o,26:r,28:l,29:49,30:61,32:62,34:e,36:n,37:i,38:u,39:d,40:f,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:73,19:20,20:21,21:22,22:t,23:s,24:o,26:r,28:l,29:49,30:61,32:62,34:e,36:n,37:i,38:u,39:d,40:f,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{14:[1,74]},a(Ct,[2,13],{43:23,29:49,30:61,32:62,20:75,34:e,36:n,37:i,38:u,39:d,40:f,41:g,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt}),a(Ct,[2,14]),a(Qt,[2,16],{12:[1,76]}),a(Ct,[2,36],{12:[1,77]}),a(St,[2,19]),a(St,[2,20]),{25:[1,78]},{27:[1,79]},a(St,[2,23]),{35:80,75:81,76:A,77:k,79:C,80:w},{35:86,75:81,76:A,77:k,79:C,80:w},{35:87,75:81,76:A,77:k,79:C,80:w},{35:88,75:81,76:A,77:k,79:C,80:w},{35:89,75:81,76:A,77:k,79:C,80:w},{35:90,75:81,76:A,77:k,79:C,80:w},{35:91,75:81,76:A,77:k,79:C,80:w},{35:92,75:81,76:A,77:k,79:C,80:w},{35:93,75:81,76:A,77:k,79:C,80:w},{35:94,75:81,76:A,77:k,79:C,80:w},{35:95,75:81,76:A,77:k,79:C,80:w},{35:96,75:81,76:A,77:k,79:C,80:w},{35:97,75:81,76:A,77:k,79:C,80:w},{35:98,75:81,76:A,77:k,79:C,80:w},{35:99,75:81,76:A,77:k,79:C,80:w},{35:100,75:81,76:A,77:k,79:C,80:w},{35:101,75:81,76:A,77:k,79:C,80:w},{35:102,75:81,76:A,77:k,79:C,80:w},{35:103,75:81,76:A,77:k,79:C,80:w},{35:104,75:81,76:A,77:k,79:C,80:w},a(T,[2,59]),{35:105,75:81,76:A,77:k,79:C,80:w},{35:106,75:81,76:A,77:k,79:C,80:w},{35:107,75:81,76:A,77:k,79:C,80:w},{35:108,75:81,76:A,77:k,79:C,80:w},{35:109,75:81,76:A,77:k,79:C,80:w},{35:110,75:81,76:A,77:k,79:C,80:w},{35:111,75:81,76:A,77:k,79:C,80:w},{35:112,75:81,76:A,77:k,79:C,80:w},{35:113,75:81,76:A,77:k,79:C,80:w},{35:114,75:81,76:A,77:k,79:C,80:w},{35:115,75:81,76:A,77:k,79:C,80:w},{20:116,29:49,30:61,32:62,34:e,36:n,37:i,38:u,39:d,40:f,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{12:[1,118],33:[1,117]},{35:119,75:81,76:A,77:k,79:C,80:w},{35:120,75:81,76:A,77:k,79:C,80:w},{35:121,75:81,76:A,77:k,79:C,80:w},{35:122,75:81,76:A,77:k,79:C,80:w},{35:123,75:81,76:A,77:k,79:C,80:w},{35:124,75:81,76:A,77:k,79:C,80:w},{35:125,75:81,76:A,77:k,79:C,80:w},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},a(Ct,[2,15]),a(Qt,[2,17],{21:22,19:130,22:t,23:s,24:o,26:r,28:l}),a(Ct,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:t,23:s,24:o,26:r,28:l,34:e,36:n,37:i,38:u,39:d,40:f,41:g,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt}),a(St,[2,21]),a(St,[2,22]),a(T,[2,39]),a(le,[2,71],{75:81,35:132,76:A,77:k,79:C,80:w}),a(Mt,[2,73]),{78:[1,133]},a(Mt,[2,75]),a(Mt,[2,76]),a(T,[2,40]),a(T,[2,41]),a(T,[2,42]),a(T,[2,43]),a(T,[2,44]),a(T,[2,45]),a(T,[2,46]),a(T,[2,47]),a(T,[2,48]),a(T,[2,49]),a(T,[2,50]),a(T,[2,51]),a(T,[2,52]),a(T,[2,53]),a(T,[2,54]),a(T,[2,55]),a(T,[2,56]),a(T,[2,57]),a(T,[2,58]),a(T,[2,60]),a(T,[2,61]),a(T,[2,62]),a(T,[2,63]),a(T,[2,64]),a(T,[2,65]),a(T,[2,66]),a(T,[2,67]),a(T,[2,68]),a(T,[2,69]),a(T,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},a(vt,[2,28]),a(vt,[2,29]),a(vt,[2,30]),a(vt,[2,31]),a(vt,[2,32]),a(vt,[2,33]),a(vt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},a(Qt,[2,18]),a(Ct,[2,38]),a(le,[2,72]),a(Mt,[2,74]),a(T,[2,24]),a(T,[2,35]),a(Ht,[2,25]),a(Ht,[2,26],{12:[1,138]}),a(Ht,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:y(function(x,v){if(v.recoverable)this.trace(x);else{var E=new Error(x);throw E.hash=v,E}},"parseError"),parse:y(function(x){var v=this,E=[0],b=[],R=[null],h=[],Dt=this.table,p="",Et=0,oe=0,we=2,ce=1,Te=h.slice.call(arguments,1),D=Object.create(this.lexer),At={yy:{}};for(var Gt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Gt)&&(At.yy[Gt]=this.yy[Gt]);D.setInput(x,At.yy),At.yy.lexer=D,At.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var Kt=D.yylloc;h.push(Kt);var Oe=D.options&&D.options.ranges;typeof At.yy.parseError=="function"?this.parseError=At.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Re(L){E.length=E.length-2*L,R.length=R.length-L,h.length=h.length-L}y(Re,"popStack");function he(){var L;return L=b.pop()||D.lex()||ce,typeof L!="number"&&(L instanceof Array&&(b=L,L=b.pop()),L=v.symbols_[L]||L),L}y(he,"lex");for(var I,kt,N,Jt,wt={},Nt,W,ue,Yt;;){if(kt=E[E.length-1],this.defaultActions[kt]?N=this.defaultActions[kt]:((I===null||typeof I>"u")&&(I=he()),N=Dt[kt]&&Dt[kt][I]),typeof N>"u"||!N.length||!N[0]){var Zt="";Yt=[];for(Nt in Dt[kt])this.terminals_[Nt]&&Nt>we&&Yt.push("'"+this.terminals_[Nt]+"'");D.showPosition?Zt="Parse error on line "+(Et+1)+`:
+`+D.showPosition()+`
+Expecting `+Yt.join(", ")+", got '"+(this.terminals_[I]||I)+"'":Zt="Parse error on line "+(Et+1)+": Unexpected "+(I==ce?"end of input":"'"+(this.terminals_[I]||I)+"'"),this.parseError(Zt,{text:D.match,token:this.terminals_[I]||I,line:D.yylineno,loc:Kt,expected:Yt})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+kt+", token: "+I);switch(N[0]){case 1:E.push(I),R.push(D.yytext),h.push(D.yylloc),E.push(N[1]),I=null,oe=D.yyleng,p=D.yytext,Et=D.yylineno,Kt=D.yylloc;break;case 2:if(W=this.productions_[N[1]][1],wt.$=R[R.length-W],wt._$={first_line:h[h.length-(W||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(W||1)].first_column,last_column:h[h.length-1].last_column},Oe&&(wt._$.range=[h[h.length-(W||1)].range[0],h[h.length-1].range[1]]),Jt=this.performAction.apply(wt,[p,oe,Et,At.yy,N[1],R,h].concat(Te)),typeof Jt<"u")return Jt;W&&(E=E.slice(0,-1*W*2),R=R.slice(0,-1*W),h=h.slice(0,-1*W)),E.push(this.productions_[N[1]][0]),R.push(wt.$),h.push(wt._$),ue=Dt[E[E.length-2]][E[E.length-1]],E.push(ue);break;case 3:return!0}}return!0},"parse")},Ce=(function(){var _t={EOF:1,parseError:y(function(v,E){if(this.yy.parser)this.yy.parser.parseError(v,E);else throw new Error(v)},"parseError"),setInput:y(function(x,v){return this.yy=v||this.yy||{},this._input=x,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:y(function(){var x=this._input[0];this.yytext+=x,this.yyleng++,this.offset++,this.match+=x,this.matched+=x;var v=x.match(/(?:\r\n?|\n).*/g);return v?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),x},"input"),unput:y(function(x){var v=x.length,E=x.split(/(?:\r\n?|\n)/g);this._input=x+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-v),this.offset-=v;var b=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),E.length-1&&(this.yylineno-=E.length-1);var R=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:E?(E.length===b.length?this.yylloc.first_column:0)+b[b.length-E.length].length-E[0].length:this.yylloc.first_column-v},this.options.ranges&&(this.yylloc.range=[R[0],R[0]+this.yyleng-v]),this.yyleng=this.yytext.length,this},"unput"),more:y(function(){return this._more=!0,this},"more"),reject:y(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
+`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:y(function(x){this.unput(this.match.slice(x))},"less"),pastInput:y(function(){var x=this.matched.substr(0,this.matched.length-this.match.length);return(x.length>20?"...":"")+x.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:y(function(){var x=this.match;return x.length<20&&(x+=this._input.substr(0,20-x.length)),(x.substr(0,20)+(x.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:y(function(){var x=this.pastInput(),v=new Array(x.length+1).join("-");return x+this.upcomingInput()+`
+`+v+"^"},"showPosition"),test_match:y(function(x,v){var E,b,R;if(this.options.backtrack_lexer&&(R={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(R.yylloc.range=this.yylloc.range.slice(0))),b=x[0].match(/(?:\r\n?|\n).*/g),b&&(this.yylineno+=b.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:b?b[b.length-1].length-b[b.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+x[0].length},this.yytext+=x[0],this.match+=x[0],this.matches=x,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(x[0].length),this.matched+=x[0],E=this.performAction.call(this,this.yy,this,v,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),E)return E;if(this._backtrack){for(var h in R)this[h]=R[h];return!1}return!1},"test_match"),next:y(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var x,v,E,b;this._more||(this.yytext="",this.match="");for(var R=this._currentRules(),h=0;hv[0].length)){if(v=E,b=h,this.options.backtrack_lexer){if(x=this.test_match(E,R[h]),x!==!1)return x;if(this._backtrack){v=!1;continue}else return!1}else if(!this.options.flex)break}return v?(x=this.test_match(v,R[b]),x!==!1?x:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
+`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:y(function(){var v=this.next();return v||this.lex()},"lex"),begin:y(function(v){this.conditionStack.push(v)},"begin"),popState:y(function(){var v=this.conditionStack.length-1;return v>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:y(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:y(function(v){return v=this.conditionStack.length-1-Math.abs(v||0),v>=0?this.conditionStack[v]:"INITIAL"},"topState"),pushState:y(function(v){this.begin(v)},"pushState"),stateStackSize:y(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:y(function(v,E,b,R){switch(b){case 0:return 6;case 1:return 7;case 2:return 8;case 3:return 9;case 4:return 22;case 5:return 23;case 6:return this.begin("acc_title"),24;case 7:return this.popState(),"acc_title_value";case 8:return this.begin("acc_descr"),26;case 9:return this.popState(),"acc_descr_value";case 10:this.begin("acc_descr_multiline");break;case 11:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:break;case 14:c;break;case 15:return 12;case 16:break;case 17:return 11;case 18:return 15;case 19:return 16;case 20:return 17;case 21:return 18;case 22:return this.begin("person_ext"),45;case 23:return this.begin("person"),44;case 24:return this.begin("system_ext_queue"),51;case 25:return this.begin("system_ext_db"),50;case 26:return this.begin("system_ext"),49;case 27:return this.begin("system_queue"),48;case 28:return this.begin("system_db"),47;case 29:return this.begin("system"),46;case 30:return this.begin("boundary"),37;case 31:return this.begin("enterprise_boundary"),34;case 32:return this.begin("system_boundary"),36;case 33:return this.begin("container_ext_queue"),57;case 34:return this.begin("container_ext_db"),56;case 35:return this.begin("container_ext"),55;case 36:return this.begin("container_queue"),54;case 37:return this.begin("container_db"),53;case 38:return this.begin("container"),52;case 39:return this.begin("container_boundary"),38;case 40:return this.begin("component_ext_queue"),63;case 41:return this.begin("component_ext_db"),62;case 42:return this.begin("component_ext"),61;case 43:return this.begin("component_queue"),60;case 44:return this.begin("component_db"),59;case 45:return this.begin("component"),58;case 46:return this.begin("node"),39;case 47:return this.begin("node"),39;case 48:return this.begin("node_l"),40;case 49:return this.begin("node_r"),41;case 50:return this.begin("rel"),64;case 51:return this.begin("birel"),65;case 52:return this.begin("rel_u"),66;case 53:return this.begin("rel_u"),66;case 54:return this.begin("rel_d"),67;case 55:return this.begin("rel_d"),67;case 56:return this.begin("rel_l"),68;case 57:return this.begin("rel_l"),68;case 58:return this.begin("rel_r"),69;case 59:return this.begin("rel_r"),69;case 60:return this.begin("rel_b"),70;case 61:return this.begin("rel_index"),71;case 62:return this.begin("update_el_style"),72;case 63:return this.begin("update_rel_style"),73;case 64:return this.begin("update_layout_config"),74;case 65:return"EOF_IN_STRUCT";case 66:return this.begin("attribute"),"ATTRIBUTE_EMPTY";case 67:this.begin("attribute");break;case 68:this.popState(),this.popState();break;case 69:return 80;case 70:break;case 71:return 80;case 72:this.begin("string");break;case 73:this.popState();break;case 74:return"STR";case 75:this.begin("string_kv");break;case 76:return this.begin("string_kv_key"),"STR_KEY";case 77:this.popState(),this.begin("string_kv_value");break;case 78:return"STR_VALUE";case 79:this.popState(),this.popState();break;case 80:return"STR";case 81:return"LBRACE";case 82:return"RBRACE";case 83:return"SPACE";case 84:return"EOL";case 85:return 14}},"anonymous"),rules:[/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:title\s[^#\n;]+)/,/^(?:accDescription\s[^#\n;]+)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:C4Context\b)/,/^(?:C4Container\b)/,/^(?:C4Component\b)/,/^(?:C4Dynamic\b)/,/^(?:C4Deployment\b)/,/^(?:Person_Ext\b)/,/^(?:Person\b)/,/^(?:SystemQueue_Ext\b)/,/^(?:SystemDb_Ext\b)/,/^(?:System_Ext\b)/,/^(?:SystemQueue\b)/,/^(?:SystemDb\b)/,/^(?:System\b)/,/^(?:Boundary\b)/,/^(?:Enterprise_Boundary\b)/,/^(?:System_Boundary\b)/,/^(?:ContainerQueue_Ext\b)/,/^(?:ContainerDb_Ext\b)/,/^(?:Container_Ext\b)/,/^(?:ContainerQueue\b)/,/^(?:ContainerDb\b)/,/^(?:Container\b)/,/^(?:Container_Boundary\b)/,/^(?:ComponentQueue_Ext\b)/,/^(?:ComponentDb_Ext\b)/,/^(?:Component_Ext\b)/,/^(?:ComponentQueue\b)/,/^(?:ComponentDb\b)/,/^(?:Component\b)/,/^(?:Deployment_Node\b)/,/^(?:Node\b)/,/^(?:Node_L\b)/,/^(?:Node_R\b)/,/^(?:Rel\b)/,/^(?:BiRel\b)/,/^(?:Rel_Up\b)/,/^(?:Rel_U\b)/,/^(?:Rel_Down\b)/,/^(?:Rel_D\b)/,/^(?:Rel_Left\b)/,/^(?:Rel_L\b)/,/^(?:Rel_Right\b)/,/^(?:Rel_R\b)/,/^(?:Rel_Back\b)/,/^(?:RelIndex\b)/,/^(?:UpdateElementStyle\b)/,/^(?:UpdateRelStyle\b)/,/^(?:UpdateLayoutConfig\b)/,/^(?:$)/,/^(?:[(][ ]*[,])/,/^(?:[(])/,/^(?:[)])/,/^(?:,,)/,/^(?:,)/,/^(?:[ ]*["]["])/,/^(?:[ ]*["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[ ]*[\$])/,/^(?:[^=]*)/,/^(?:[=][ ]*["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:[^,]+)/,/^(?:\{)/,/^(?:\})/,/^(?:[\s]+)/,/^(?:[\n\r]+)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},string_kv_value:{rules:[78,79],inclusive:!1},string_kv_key:{rules:[77],inclusive:!1},string_kv:{rules:[76],inclusive:!1},string:{rules:[73,74],inclusive:!1},attribute:{rules:[68,69,70,71,72,75,80],inclusive:!1},update_layout_config:{rules:[65,66,67,68],inclusive:!1},update_rel_style:{rules:[65,66,67,68],inclusive:!1},update_el_style:{rules:[65,66,67,68],inclusive:!1},rel_b:{rules:[65,66,67,68],inclusive:!1},rel_r:{rules:[65,66,67,68],inclusive:!1},rel_l:{rules:[65,66,67,68],inclusive:!1},rel_d:{rules:[65,66,67,68],inclusive:!1},rel_u:{rules:[65,66,67,68],inclusive:!1},rel_bi:{rules:[],inclusive:!1},rel:{rules:[65,66,67,68],inclusive:!1},node_r:{rules:[65,66,67,68],inclusive:!1},node_l:{rules:[65,66,67,68],inclusive:!1},node:{rules:[65,66,67,68],inclusive:!1},index:{rules:[],inclusive:!1},rel_index:{rules:[65,66,67,68],inclusive:!1},component_ext_queue:{rules:[65,66,67,68],inclusive:!1},component_ext_db:{rules:[65,66,67,68],inclusive:!1},component_ext:{rules:[65,66,67,68],inclusive:!1},component_queue:{rules:[65,66,67,68],inclusive:!1},component_db:{rules:[65,66,67,68],inclusive:!1},component:{rules:[65,66,67,68],inclusive:!1},container_boundary:{rules:[65,66,67,68],inclusive:!1},container_ext_queue:{rules:[65,66,67,68],inclusive:!1},container_ext_db:{rules:[65,66,67,68],inclusive:!1},container_ext:{rules:[65,66,67,68],inclusive:!1},container_queue:{rules:[65,66,67,68],inclusive:!1},container_db:{rules:[65,66,67,68],inclusive:!1},container:{rules:[65,66,67,68],inclusive:!1},birel:{rules:[65,66,67,68],inclusive:!1},system_boundary:{rules:[65,66,67,68],inclusive:!1},enterprise_boundary:{rules:[65,66,67,68],inclusive:!1},boundary:{rules:[65,66,67,68],inclusive:!1},system_ext_queue:{rules:[65,66,67,68],inclusive:!1},system_ext_db:{rules:[65,66,67,68],inclusive:!1},system_ext:{rules:[65,66,67,68],inclusive:!1},system_queue:{rules:[65,66,67,68],inclusive:!1},system_db:{rules:[65,66,67,68],inclusive:!1},system:{rules:[65,66,67,68],inclusive:!1},person_ext:{rules:[65,66,67,68],inclusive:!1},person:{rules:[65,66,67,68],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,81,82,83,84,85],inclusive:!0}}};return _t})();qt.lexer=Ce;function Lt(){this.yy={}}return y(Lt,"Parser"),Lt.prototype=qt,qt.Parser=Lt,new Lt})();Ft.parser=Ft;var Ue=Ft,V=[],xt=[""],B="global",F="",X=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],It=[],ie="",ne=!1,Vt=4,zt=2,be,Fe=y(function(){return be},"getC4Type"),Ve=y(function(a){be=ge(a,Bt())},"setC4Type"),ze=y(function(a,t,s,o,r,l,e,n,i){if(a==null||t===void 0||t===null||s===void 0||s===null||o===void 0||o===null)return;let u={};const d=It.find(f=>f.from===t&&f.to===s);if(d?u=d:It.push(u),u.type=a,u.from=t,u.to=s,u.label={text:o},r==null)u.techn={text:""};else if(typeof r=="object"){let[f,g]=Object.entries(r)[0];u[f]={text:g}}else u.techn={text:r};if(l==null)u.descr={text:""};else if(typeof l=="object"){let[f,g]=Object.entries(l)[0];u[f]={text:g}}else u.descr={text:l};if(typeof e=="object"){let[f,g]=Object.entries(e)[0];u[f]=g}else u.sprite=e;if(typeof n=="object"){let[f,g]=Object.entries(n)[0];u[f]=g}else u.tags=n;if(typeof i=="object"){let[f,g]=Object.entries(i)[0];u[f]=g}else u.link=i;u.wrap=mt()},"addRel"),Xe=y(function(a,t,s,o,r,l,e){if(t===null||s===null)return;let n={};const i=V.find(u=>u.alias===t);if(i&&t===i.alias?n=i:(n.alias=t,V.push(n)),s==null?n.label={text:""}:n.label={text:s},o==null)n.descr={text:""};else if(typeof o=="object"){let[u,d]=Object.entries(o)[0];n[u]={text:d}}else n.descr={text:o};if(typeof r=="object"){let[u,d]=Object.entries(r)[0];n[u]=d}else n.sprite=r;if(typeof l=="object"){let[u,d]=Object.entries(l)[0];n[u]=d}else n.tags=l;if(typeof e=="object"){let[u,d]=Object.entries(e)[0];n[u]=d}else n.link=e;n.typeC4Shape={text:a},n.parentBoundary=B,n.wrap=mt()},"addPersonOrSystem"),We=y(function(a,t,s,o,r,l,e,n){if(t===null||s===null)return;let i={};const u=V.find(d=>d.alias===t);if(u&&t===u.alias?i=u:(i.alias=t,V.push(i)),s==null?i.label={text:""}:i.label={text:s},o==null)i.techn={text:""};else if(typeof o=="object"){let[d,f]=Object.entries(o)[0];i[d]={text:f}}else i.techn={text:o};if(r==null)i.descr={text:""};else if(typeof r=="object"){let[d,f]=Object.entries(r)[0];i[d]={text:f}}else i.descr={text:r};if(typeof l=="object"){let[d,f]=Object.entries(l)[0];i[d]=f}else i.sprite=l;if(typeof e=="object"){let[d,f]=Object.entries(e)[0];i[d]=f}else i.tags=e;if(typeof n=="object"){let[d,f]=Object.entries(n)[0];i[d]=f}else i.link=n;i.wrap=mt(),i.typeC4Shape={text:a},i.parentBoundary=B},"addContainer"),Qe=y(function(a,t,s,o,r,l,e,n){if(t===null||s===null)return;let i={};const u=V.find(d=>d.alias===t);if(u&&t===u.alias?i=u:(i.alias=t,V.push(i)),s==null?i.label={text:""}:i.label={text:s},o==null)i.techn={text:""};else if(typeof o=="object"){let[d,f]=Object.entries(o)[0];i[d]={text:f}}else i.techn={text:o};if(r==null)i.descr={text:""};else if(typeof r=="object"){let[d,f]=Object.entries(r)[0];i[d]={text:f}}else i.descr={text:r};if(typeof l=="object"){let[d,f]=Object.entries(l)[0];i[d]=f}else i.sprite=l;if(typeof e=="object"){let[d,f]=Object.entries(e)[0];i[d]=f}else i.tags=e;if(typeof n=="object"){let[d,f]=Object.entries(n)[0];i[d]=f}else i.link=n;i.wrap=mt(),i.typeC4Shape={text:a},i.parentBoundary=B},"addComponent"),He=y(function(a,t,s,o,r){if(a===null||t===null)return;let l={};const e=X.find(n=>n.alias===a);if(e&&a===e.alias?l=e:(l.alias=a,X.push(l)),t==null?l.label={text:""}:l.label={text:t},s==null)l.type={text:"system"};else if(typeof s=="object"){let[n,i]=Object.entries(s)[0];l[n]={text:i}}else l.type={text:s};if(typeof o=="object"){let[n,i]=Object.entries(o)[0];l[n]=i}else l.tags=o;if(typeof r=="object"){let[n,i]=Object.entries(r)[0];l[n]=i}else l.link=r;l.parentBoundary=B,l.wrap=mt(),F=B,B=a,xt.push(F)},"addPersonOrSystemBoundary"),qe=y(function(a,t,s,o,r){if(a===null||t===null)return;let l={};const e=X.find(n=>n.alias===a);if(e&&a===e.alias?l=e:(l.alias=a,X.push(l)),t==null?l.label={text:""}:l.label={text:t},s==null)l.type={text:"container"};else if(typeof s=="object"){let[n,i]=Object.entries(s)[0];l[n]={text:i}}else l.type={text:s};if(typeof o=="object"){let[n,i]=Object.entries(o)[0];l[n]=i}else l.tags=o;if(typeof r=="object"){let[n,i]=Object.entries(r)[0];l[n]=i}else l.link=r;l.parentBoundary=B,l.wrap=mt(),F=B,B=a,xt.push(F)},"addContainerBoundary"),Ge=y(function(a,t,s,o,r,l,e,n){if(t===null||s===null)return;let i={};const u=X.find(d=>d.alias===t);if(u&&t===u.alias?i=u:(i.alias=t,X.push(i)),s==null?i.label={text:""}:i.label={text:s},o==null)i.type={text:"node"};else if(typeof o=="object"){let[d,f]=Object.entries(o)[0];i[d]={text:f}}else i.type={text:o};if(r==null)i.descr={text:""};else if(typeof r=="object"){let[d,f]=Object.entries(r)[0];i[d]={text:f}}else i.descr={text:r};if(typeof e=="object"){let[d,f]=Object.entries(e)[0];i[d]=f}else i.tags=e;if(typeof n=="object"){let[d,f]=Object.entries(n)[0];i[d]=f}else i.link=n;i.nodeType=a,i.parentBoundary=B,i.wrap=mt(),F=B,B=t,xt.push(F)},"addDeploymentNode"),Ke=y(function(){B=F,xt.pop(),F=xt.pop(),xt.push(F)},"popBoundaryParseStack"),Je=y(function(a,t,s,o,r,l,e,n,i,u,d){let f=V.find(g=>g.alias===t);if(!(f===void 0&&(f=X.find(g=>g.alias===t),f===void 0))){if(s!=null)if(typeof s=="object"){let[g,m]=Object.entries(s)[0];f[g]=m}else f.bgColor=s;if(o!=null)if(typeof o=="object"){let[g,m]=Object.entries(o)[0];f[g]=m}else f.fontColor=o;if(r!=null)if(typeof r=="object"){let[g,m]=Object.entries(r)[0];f[g]=m}else f.borderColor=r;if(l!=null)if(typeof l=="object"){let[g,m]=Object.entries(l)[0];f[g]=m}else f.shadowing=l;if(e!=null)if(typeof e=="object"){let[g,m]=Object.entries(e)[0];f[g]=m}else f.shape=e;if(n!=null)if(typeof n=="object"){let[g,m]=Object.entries(n)[0];f[g]=m}else f.sprite=n;if(i!=null)if(typeof i=="object"){let[g,m]=Object.entries(i)[0];f[g]=m}else f.techn=i;if(u!=null)if(typeof u=="object"){let[g,m]=Object.entries(u)[0];f[g]=m}else f.legendText=u;if(d!=null)if(typeof d=="object"){let[g,m]=Object.entries(d)[0];f[g]=m}else f.legendSprite=d}},"updateElStyle"),Ze=y(function(a,t,s,o,r,l,e){const n=It.find(i=>i.from===t&&i.to===s);if(n!==void 0){if(o!=null)if(typeof o=="object"){let[i,u]=Object.entries(o)[0];n[i]=u}else n.textColor=o;if(r!=null)if(typeof r=="object"){let[i,u]=Object.entries(r)[0];n[i]=u}else n.lineColor=r;if(l!=null)if(typeof l=="object"){let[i,u]=Object.entries(l)[0];n[i]=parseInt(u)}else n.offsetX=parseInt(l);if(e!=null)if(typeof e=="object"){let[i,u]=Object.entries(e)[0];n[i]=parseInt(u)}else n.offsetY=parseInt(e)}},"updateRelStyle"),$e=y(function(a,t,s){let o=Vt,r=zt;if(typeof t=="object"){const l=Object.values(t)[0];o=parseInt(l)}else o=parseInt(t);if(typeof s=="object"){const l=Object.values(s)[0];r=parseInt(l)}else r=parseInt(s);o>=1&&(Vt=o),r>=1&&(zt=r)},"updateLayoutConfig"),t0=y(function(){return Vt},"getC4ShapeInRow"),e0=y(function(){return zt},"getC4BoundaryInRow"),a0=y(function(){return B},"getCurrentBoundaryParse"),i0=y(function(){return F},"getParentBoundaryParse"),_e=y(function(a){return a==null?V:V.filter(t=>t.parentBoundary===a)},"getC4ShapeArray"),n0=y(function(a){return V.find(t=>t.alias===a)},"getC4Shape"),s0=y(function(a){return Object.keys(_e(a))},"getC4ShapeKeys"),xe=y(function(a){return a==null?X:X.filter(t=>t.parentBoundary===a)},"getBoundaries"),r0=xe,l0=y(function(){return It},"getRels"),o0=y(function(){return ie},"getTitle"),c0=y(function(a){ne=a},"setWrap"),mt=y(function(){return ne},"autoWrap"),h0=y(function(){V=[],X=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],F="",B="global",xt=[""],It=[],xt=[""],ie="",ne=!1,Vt=4,zt=2},"clear"),u0={SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25},d0={FILLED:0,OPEN:1},f0={LEFTOF:0,RIGHTOF:1,OVER:2},p0=y(function(a){ie=ge(a,Bt())},"setTitle"),te={addPersonOrSystem:Xe,addPersonOrSystemBoundary:He,addContainer:We,addContainerBoundary:qe,addComponent:Qe,addDeploymentNode:Ge,popBoundaryParseStack:Ke,addRel:ze,updateElStyle:Je,updateRelStyle:Ze,updateLayoutConfig:$e,autoWrap:mt,setWrap:c0,getC4ShapeArray:_e,getC4Shape:n0,getC4ShapeKeys:s0,getBoundaries:xe,getBoundarys:r0,getCurrentBoundaryParse:a0,getParentBoundaryParse:i0,getRels:l0,getTitle:o0,getC4Type:Fe,getC4ShapeInRow:t0,getC4BoundaryInRow:e0,setAccTitle:Me,getAccTitle:Ie,getAccDescription:Be,setAccDescription:Pe,getConfig:y(()=>Bt().c4,"getConfig"),clear:h0,LINETYPE:u0,ARROWTYPE:d0,PLACEMENT:f0,setTitle:p0,setC4Type:Ve},se=y(function(a,t){return De(a,t)},"drawRect"),me=y(function(a,t,s,o,r,l){const e=a.append("image");e.attr("width",t),e.attr("height",s),e.attr("x",o),e.attr("y",r);let n=l.startsWith("data:image/png;base64")?l:Ye.sanitizeUrl(l);e.attr("xlink:href",n)},"drawImage"),y0=y((a,t,s,o)=>{const r=a.append("g");let l=0;for(let e of t){let n=e.textColor?e.textColor:"#444444",i=e.lineColor?e.lineColor:"#444444",u=e.offsetX?parseInt(e.offsetX):0,d=e.offsetY?parseInt(e.offsetY):0,f="";if(l===0){let m=r.append("line");m.attr("x1",e.startPoint.x),m.attr("y1",e.startPoint.y),m.attr("x2",e.endPoint.x),m.attr("y2",e.endPoint.y),m.attr("stroke-width","1"),m.attr("stroke",i),m.style("fill","none"),e.type!=="rel_b"&&m.attr("marker-end","url("+f+"#"+o+"-arrowhead)"),(e.type==="birel"||e.type==="rel_b")&&m.attr("marker-start","url("+f+"#"+o+"-arrowend)"),l=-1}else{let m=r.append("path");m.attr("fill","none").attr("stroke-width","1").attr("stroke",i).attr("d","Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx",e.startPoint.x).replaceAll("starty",e.startPoint.y).replaceAll("controlx",e.startPoint.x+(e.endPoint.x-e.startPoint.x)/2-(e.endPoint.x-e.startPoint.x)/4).replaceAll("controly",e.startPoint.y+(e.endPoint.y-e.startPoint.y)/2).replaceAll("stopx",e.endPoint.x).replaceAll("stopy",e.endPoint.y)),e.type!=="rel_b"&&m.attr("marker-end","url("+f+"#"+o+"-arrowhead)"),(e.type==="birel"||e.type==="rel_b")&&m.attr("marker-start","url("+f+"#"+o+"-arrowend)")}let g=s.messageFont();Q(s)(e.label.text,r,Math.min(e.startPoint.x,e.endPoint.x)+Math.abs(e.endPoint.x-e.startPoint.x)/2+u,Math.min(e.startPoint.y,e.endPoint.y)+Math.abs(e.endPoint.y-e.startPoint.y)/2+d,e.label.width,e.label.height,{fill:n},g),e.techn&&e.techn.text!==""&&(g=s.messageFont(),Q(s)("["+e.techn.text+"]",r,Math.min(e.startPoint.x,e.endPoint.x)+Math.abs(e.endPoint.x-e.startPoint.x)/2+u,Math.min(e.startPoint.y,e.endPoint.y)+Math.abs(e.endPoint.y-e.startPoint.y)/2+s.messageFontSize+5+d,Math.max(e.label.width,e.techn.width),e.techn.height,{fill:n,"font-style":"italic"},g))}},"drawRels"),g0=y(function(a,t,s){const o=a.append("g");let r=t.bgColor?t.bgColor:"none",l=t.borderColor?t.borderColor:"#444444",e=t.fontColor?t.fontColor:"black",n={"stroke-width":1,"stroke-dasharray":"7.0,7.0"};t.nodeType&&(n={"stroke-width":1});let i={x:t.x,y:t.y,fill:r,stroke:l,width:t.width,height:t.height,rx:2.5,ry:2.5,attrs:n};se(o,i);let u=s.boundaryFont();u.fontWeight="bold",u.fontSize=u.fontSize+2,u.fontColor=e,Q(s)(t.label.text,o,t.x,t.y+t.label.Y,t.width,t.height,{fill:"#444444"},u),t.type&&t.type.text!==""&&(u=s.boundaryFont(),u.fontColor=e,Q(s)(t.type.text,o,t.x,t.y+t.type.Y,t.width,t.height,{fill:"#444444"},u)),t.descr&&t.descr.text!==""&&(u=s.boundaryFont(),u.fontSize=u.fontSize-2,u.fontColor=e,Q(s)(t.descr.text,o,t.x,t.y+t.descr.Y,t.width,t.height,{fill:"#444444"},u))},"drawBoundary"),b0=y(function(a,t,s){var f;let o=t.bgColor?t.bgColor:s[t.typeC4Shape.text+"_bg_color"],r=t.borderColor?t.borderColor:s[t.typeC4Shape.text+"_border_color"],l=t.fontColor?t.fontColor:"#FFFFFF",e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";switch(t.typeC4Shape.text){case"person":e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";break;case"external_person":e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII=";break}const n=a.append("g");n.attr("class","person-man");const i=Se();switch(t.typeC4Shape.text){case"person":case"external_person":case"system":case"external_system":case"container":case"external_container":case"component":case"external_component":i.x=t.x,i.y=t.y,i.fill=o,i.width=t.width,i.height=t.height,i.stroke=r,i.rx=2.5,i.ry=2.5,i.attrs={"stroke-width":.5},se(n,i);break;case"system_db":case"external_system_db":case"container_db":case"external_container_db":case"component_db":case"external_component_db":n.append("path").attr("fill",o).attr("stroke-width","0.5").attr("stroke",r).attr("d","Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("half",t.width/2).replaceAll("height",t.height)),n.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",r).attr("d","Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("half",t.width/2));break;case"system_queue":case"external_system_queue":case"container_queue":case"external_container_queue":case"component_queue":case"external_component_queue":n.append("path").attr("fill",o).attr("stroke-width","0.5").attr("stroke",r).attr("d","Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("width",t.width).replaceAll("half",t.height/2)),n.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",r).attr("d","Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx",t.x+t.width).replaceAll("starty",t.y).replaceAll("half",t.height/2));break}let u=C0(s,t.typeC4Shape.text);switch(n.append("text").attr("fill",l).attr("font-family",u.fontFamily).attr("font-size",u.fontSize-2).attr("font-style","italic").attr("lengthAdjust","spacing").attr("textLength",t.typeC4Shape.width).attr("x",t.x+t.width/2-t.typeC4Shape.width/2).attr("y",t.y+t.typeC4Shape.Y).text("<<"+t.typeC4Shape.text+">>"),t.typeC4Shape.text){case"person":case"external_person":me(n,48,48,t.x+t.width/2-24,t.y+t.image.Y,e);break}let d=s[t.typeC4Shape.text+"Font"]();return d.fontWeight="bold",d.fontSize=d.fontSize+2,d.fontColor=l,Q(s)(t.label.text,n,t.x,t.y+t.label.Y,t.width,t.height,{fill:l},d),d=s[t.typeC4Shape.text+"Font"](),d.fontColor=l,t.techn&&((f=t.techn)==null?void 0:f.text)!==""?Q(s)(t.techn.text,n,t.x,t.y+t.techn.Y,t.width,t.height,{fill:l,"font-style":"italic"},d):t.type&&t.type.text!==""&&Q(s)(t.type.text,n,t.x,t.y+t.type.Y,t.width,t.height,{fill:l,"font-style":"italic"},d),t.descr&&t.descr.text!==""&&(d=s.personFont(),d.fontColor=l,Q(s)(t.descr.text,n,t.x,t.y+t.descr.Y,t.width,t.height,{fill:l},d)),t.height},"drawC4Shape"),_0=y(function(a,t){a.append("defs").append("symbol").attr("id",t+"-database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},"insertDatabaseIcon"),x0=y(function(a,t){a.append("defs").append("symbol").attr("id",t+"-computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},"insertComputerIcon"),m0=y(function(a,t){a.append("defs").append("symbol").attr("id",t+"-clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")},"insertClockIcon"),v0=y(function(a,t){a.append("defs").append("marker").attr("id",t+"-arrowhead").attr("refX",9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z")},"insertArrowHead"),E0=y(function(a,t){a.append("defs").append("marker").attr("id",t+"-arrowend").attr("refX",1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z")},"insertArrowEnd"),A0=y(function(a,t){a.append("defs").append("marker").attr("id",t+"-filled-head").attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"insertArrowFilledHead"),k0=y(function(a,t){const o=a.append("defs").append("marker").attr("id",t+"-crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",16).attr("refY",4);o.append("path").attr("fill","black").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 9,2 V 6 L16,4 Z"),o.append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 0,1 L 6,7 M 6,1 L 0,7")},"insertArrowCrossHead"),C0=y((a,t)=>({fontFamily:a[t+"FontFamily"],fontSize:a[t+"FontSize"],fontWeight:a[t+"FontWeight"]}),"getC4ShapeFont"),Q=(function(){function a(r,l,e,n,i,u,d){const f=l.append("text").attr("x",e+i/2).attr("y",n+u/2+5).style("text-anchor","middle").text(r);o(f,d)}y(a,"byText");function t(r,l,e,n,i,u,d,f){const{fontSize:g,fontFamily:m,fontWeight:O}=f,S=r.split($t.lineBreakRegex);for(let P=0;P=this.data.widthLimit||o>=this.data.widthLimit||this.nextData.cnt>ve)&&(s=this.nextData.startx+t.margin+_.nextLinePaddingX,r=this.nextData.stopy+t.margin*2,this.nextData.stopx=o=s+t.width,this.nextData.starty=this.nextData.stopy,this.nextData.stopy=l=r+t.height,this.nextData.cnt=1),t.x=s,t.y=r,this.updateVal(this.data,"startx",s,Math.min),this.updateVal(this.data,"starty",r,Math.min),this.updateVal(this.data,"stopx",o,Math.max),this.updateVal(this.data,"stopy",l,Math.max),this.updateVal(this.nextData,"startx",s,Math.min),this.updateVal(this.nextData,"starty",r,Math.min),this.updateVal(this.nextData,"stopx",o,Math.max),this.updateVal(this.nextData,"stopy",l,Math.max)}init(t){this.name="",this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,widthLimit:void 0},this.nextData={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,cnt:0},ae(t.db.getConfig())}bumpLastMargin(t){this.data.stopx+=t,this.data.stopy+=t}},y(Ot,"Bounds"),Ot),ae=y(function(a){Ne(_,a),a.fontFamily&&(_.personFontFamily=_.systemFontFamily=_.messageFontFamily=a.fontFamily),a.fontSize&&(_.personFontSize=_.systemFontSize=_.messageFontSize=a.fontSize),a.fontWeight&&(_.personFontWeight=_.systemFontWeight=_.messageFontWeight=a.fontWeight)},"setConf"),Pt=y((a,t)=>({fontFamily:a[t+"FontFamily"],fontSize:a[t+"FontSize"],fontWeight:a[t+"FontWeight"]}),"c4ShapeFont"),Ut=y(a=>({fontFamily:a.boundaryFontFamily,fontSize:a.boundaryFontSize,fontWeight:a.boundaryFontWeight}),"boundaryFont"),w0=y(a=>({fontFamily:a.messageFontFamily,fontSize:a.messageFontSize,fontWeight:a.messageFontWeight}),"messageFont");function j(a,t,s,o,r){if(!t[a].width)if(s)t[a].text=je(t[a].text,r,o),t[a].textLines=t[a].text.split($t.lineBreakRegex).length,t[a].width=r,t[a].height=fe(t[a].text,o);else{let l=t[a].text.split($t.lineBreakRegex);t[a].textLines=l.length;let e=0;t[a].height=0,t[a].width=0;for(const n of l)t[a].width=Math.max(Tt(n,o),t[a].width),e=fe(n,o),t[a].height=t[a].height+e}}y(j,"calcC4ShapeTextWH");var Ae=y(function(a,t,s){t.x=s.data.startx,t.y=s.data.starty,t.width=s.data.stopx-s.data.startx,t.height=s.data.stopy-s.data.starty,t.label.y=_.c4ShapeMargin-35;let o=t.wrap&&_.wrap,r=Ut(_);r.fontSize=r.fontSize+2,r.fontWeight="bold";let l=Tt(t.label.text,r);j("label",t,o,r,l),z.drawBoundary(a,t,_)},"drawBoundary"),ke=y(function(a,t,s,o){let r=0;for(const l of o){r=0;const e=s[l];let n=Pt(_,e.typeC4Shape.text);switch(n.fontSize=n.fontSize-2,e.typeC4Shape.width=Tt("«"+e.typeC4Shape.text+"»",n),e.typeC4Shape.height=n.fontSize+2,e.typeC4Shape.Y=_.c4ShapePadding,r=e.typeC4Shape.Y+e.typeC4Shape.height-4,e.image={width:0,height:0,Y:0},e.typeC4Shape.text){case"person":case"external_person":e.image.width=48,e.image.height=48,e.image.Y=r,r=e.image.Y+e.image.height;break}e.sprite&&(e.image.width=48,e.image.height=48,e.image.Y=r,r=e.image.Y+e.image.height);let i=e.wrap&&_.wrap,u=_.width-_.c4ShapePadding*2,d=Pt(_,e.typeC4Shape.text);if(d.fontSize=d.fontSize+2,d.fontWeight="bold",j("label",e,i,d,u),e.label.Y=r+8,r=e.label.Y+e.label.height,e.type&&e.type.text!==""){e.type.text="["+e.type.text+"]";let m=Pt(_,e.typeC4Shape.text);j("type",e,i,m,u),e.type.Y=r+5,r=e.type.Y+e.type.height}else if(e.techn&&e.techn.text!==""){e.techn.text="["+e.techn.text+"]";let m=Pt(_,e.techn.text);j("techn",e,i,m,u),e.techn.Y=r+5,r=e.techn.Y+e.techn.height}let f=r,g=e.label.width;if(e.descr&&e.descr.text!==""){let m=Pt(_,e.typeC4Shape.text);j("descr",e,i,m,u),e.descr.Y=r+20,r=e.descr.Y+e.descr.height,g=Math.max(e.label.width,e.descr.width),f=r-e.descr.textLines*5}g=g+_.c4ShapePadding,e.width=Math.max(e.width||_.width,g,_.width),e.height=Math.max(e.height||_.height,f,_.height),e.margin=e.margin||_.c4ShapeMargin,a.insert(e),z.drawC4Shape(t,e,_)}a.bumpLastMargin(_.c4ShapeMargin)},"drawC4ShapeArray"),Rt,Y=(Rt=class{constructor(t,s){this.x=t,this.y=s}},y(Rt,"Point"),Rt),pe=y(function(a,t){let s=a.x,o=a.y,r=t.x,l=t.y,e=s+a.width/2,n=o+a.height/2,i=Math.abs(s-r),u=Math.abs(o-l),d=u/i,f=a.height/a.width,g=null;return o==l&&sr?g=new Y(s,n):s==r&&ol&&(g=new Y(e,o)),s>r&&o=d?g=new Y(s,n+d*a.width/2):g=new Y(e-i/u*a.height/2,o+a.height):s=d?g=new Y(s+a.width,n+d*a.width/2):g=new Y(e+i/u*a.height/2,o+a.height):sl?f>=d?g=new Y(s+a.width,n-d*a.width/2):g=new Y(e+a.height/2*i/u,o):s>r&&o>l&&(f>=d?g=new Y(s,n-a.width/2*d):g=new Y(e-a.height/2*i/u,o)),g},"getIntersectPoint"),T0=y(function(a,t){let s={x:0,y:0};s.x=t.x+t.width/2,s.y=t.y+t.height/2;let o=pe(a,s);s.x=a.x+a.width/2,s.y=a.y+a.height/2;let r=pe(t,s);return{startPoint:o,endPoint:r}},"getIntersectPoints"),O0=y(function(a,t,s,o,r){let l=0;for(let e of t){l=l+1;let n=e.wrap&&_.wrap,i=w0(_);o.db.getC4Type()==="C4Dynamic"&&(e.label.text=l+": "+e.label.text);let d=Tt(e.label.text,i);j("label",e,n,i,d),e.techn&&e.techn.text!==""&&(d=Tt(e.techn.text,i),j("techn",e,n,i,d)),e.descr&&e.descr.text!==""&&(d=Tt(e.descr.text,i),j("descr",e,n,i,d));let f=s(e.from),g=s(e.to),m=T0(f,g);e.startPoint=m.startPoint,e.endPoint=m.endPoint}z.drawRels(a,t,_,r)},"drawRels");function re(a,t,s,o,r){let l=new Ee(r);l.data.widthLimit=s.data.widthLimit/Math.min(ee,o.length);for(let[e,n]of o.entries()){let i=0;n.image={width:0,height:0,Y:0},n.sprite&&(n.image.width=48,n.image.height=48,n.image.Y=i,i=n.image.Y+n.image.height);let u=n.wrap&&_.wrap,d=Ut(_);if(d.fontSize=d.fontSize+2,d.fontWeight="bold",j("label",n,u,d,l.data.widthLimit),n.label.Y=i+8,i=n.label.Y+n.label.height,n.type&&n.type.text!==""){n.type.text="["+n.type.text+"]";let O=Ut(_);j("type",n,u,O,l.data.widthLimit),n.type.Y=i+5,i=n.type.Y+n.type.height}if(n.descr&&n.descr.text!==""){let O=Ut(_);O.fontSize=O.fontSize-2,j("descr",n,u,O,l.data.widthLimit),n.descr.Y=i+20,i=n.descr.Y+n.descr.height}if(e==0||e%ee===0){let O=s.data.startx+_.diagramMarginX,S=s.data.stopy+_.diagramMarginY+i;l.setData(O,O,S,S)}else{let O=l.data.stopx!==l.data.startx?l.data.stopx+_.diagramMarginX:l.data.startx,S=l.data.starty;l.setData(O,O,S,S)}l.name=n.alias;let f=r.db.getC4ShapeArray(n.alias),g=r.db.getC4ShapeKeys(n.alias);g.length>0&&ke(l,a,f,g),t=n.alias;let m=r.db.getBoundaries(t);m.length>0&&re(a,t,l,m,r),n.alias!=="global"&&Ae(a,n,l),s.data.stopy=Math.max(l.data.stopy+_.c4ShapeMargin,s.data.stopy),s.data.stopx=Math.max(l.data.stopx+_.c4ShapeMargin,s.data.stopx),Xt=Math.max(Xt,s.data.stopx),Wt=Math.max(Wt,s.data.stopy)}}y(re,"drawInsideBoundary");var R0=y(function(a,t,s,o){_=Bt().c4;const r=Bt().securityLevel;let l;r==="sandbox"&&(l=jt("#i"+t));const e=r==="sandbox"?jt(l.nodes()[0].contentDocument.body):jt("body");let n=o.db;o.db.setWrap(_.wrap),ve=n.getC4ShapeInRow(),ee=n.getC4BoundaryInRow(),de.debug(`C:${JSON.stringify(_,null,2)}`);const i=r==="sandbox"?e.select(`[id="${t}"]`):jt(`[id="${t}"]`);z.insertComputerIcon(i,t),z.insertDatabaseIcon(i,t),z.insertClockIcon(i,t);let u=new Ee(o);u.setData(_.diagramMarginX,_.diagramMarginX,_.diagramMarginY,_.diagramMarginY),u.data.widthLimit=screen.availWidth,Xt=_.diagramMarginX,Wt=_.diagramMarginY;const d=o.db.getTitle();let f=o.db.getBoundaries("");re(i,"",u,f,o),z.insertArrowHead(i,t),z.insertArrowEnd(i,t),z.insertArrowCrossHead(i,t),z.insertArrowFilledHead(i,t),O0(i,o.db.getRels(),o.db.getC4Shape,o,t),u.data.stopx=Xt,u.data.stopy=Wt;const g=u.data;let O=g.stopy-g.starty+2*_.diagramMarginY;const P=g.stopx-g.startx+2*_.diagramMarginX;d&&i.append("text").text(d).attr("x",(g.stopx-g.startx)/2-4*_.diagramMarginX).attr("y",g.starty+_.diagramMarginY),Le(i,O,P,_.useMaxWidth);const M=d?60:0;i.attr("viewBox",g.startx-_.diagramMarginX+" -"+(_.diagramMarginY+M)+" "+P+" "+(O+M)),de.debug("models:",g)},"draw"),ye={drawPersonOrSystemArray:ke,drawBoundary:Ae,setConf:ae,draw:R0},S0=y(a=>`.person {
+ stroke: ${a.personBorder};
+ fill: ${a.personBkg};
+ }
+`,"getStyles"),D0=S0,M0={parser:Ue,db:te,renderer:ye,styles:D0,init:y(({c4:a,wrap:t})=>{ye.setConf(a),te.setWrap(t)},"init")};export{M0 as diagram};
diff --git a/dist-desktop/assets/channel-Bv1ZAY8d.js b/dist-desktop/assets/channel-Bv1ZAY8d.js
new file mode 100644
index 0000000..d25ecd8
--- /dev/null
+++ b/dist-desktop/assets/channel-Bv1ZAY8d.js
@@ -0,0 +1 @@
+import{aq as o,ar as n}from"./mermaid.core-DD7RPEfx.js";const t=(r,a)=>o.lang.round(n.parse(r)[a]);export{t as c};
diff --git a/dist-desktop/assets/chunk-4BX2VUAB-CI7enyPF.js b/dist-desktop/assets/chunk-4BX2VUAB-CI7enyPF.js
new file mode 100644
index 0000000..4556958
--- /dev/null
+++ b/dist-desktop/assets/chunk-4BX2VUAB-CI7enyPF.js
@@ -0,0 +1 @@
+import{_ as l}from"./mermaid.core-DD7RPEfx.js";function m(e,c){var i,t,o;e.accDescr&&((i=c.setAccDescription)==null||i.call(c,e.accDescr)),e.accTitle&&((t=c.setAccTitle)==null||t.call(c,e.accTitle)),e.title&&((o=c.setDiagramTitle)==null||o.call(c,e.title))}l(m,"populateCommonDb");export{m as p};
diff --git a/dist-desktop/assets/chunk-4TB4RGXK-D8YpqJC4.js b/dist-desktop/assets/chunk-4TB4RGXK-D8YpqJC4.js
new file mode 100644
index 0000000..5ac279f
--- /dev/null
+++ b/dist-desktop/assets/chunk-4TB4RGXK-D8YpqJC4.js
@@ -0,0 +1,206 @@
+import{g as et}from"./chunk-FMBD7UC4-TatyaWoN.js";import{c as tt}from"./chunk-YZCP3GAM-Blce-T0j.js";import{g as st}from"./chunk-55IACEB6-D6svk_zs.js";import{s as it}from"./chunk-EDXVE4YY-D2oMcFeR.js";import{_ as f,l as Oe,c as F,o as at,r as rt,u as we,d as pe,y as nt,b as ut,a as lt,s as ot,g as ct,p as ht,q as dt,k as v,z as pt,x as At,i as ft,Q as G}from"./mermaid.core-DD7RPEfx.js";var Ve=(function(){var s=f(function(I,c,h,p){for(h=h||{},p=I.length;p--;h[I[p]]=c);return h},"o"),i=[1,18],a=[1,19],u=[1,20],o=[1,41],n=[1,26],l=[1,42],A=[1,24],m=[1,25],C=[1,32],O=[1,33],fe=[1,34],b=[1,45],ge=[1,35],me=[1,36],Ce=[1,37],be=[1,38],ke=[1,27],Ee=[1,28],Te=[1,29],ye=[1,30],De=[1,31],k=[1,44],E=[1,46],T=[1,43],y=[1,47],Fe=[1,9],d=[1,8,9],ee=[1,58],te=[1,59],se=[1,60],ie=[1,61],ae=[1,62],Be=[1,63],_e=[1,64],N=[1,8,9,41],Me=[1,77],P=[1,8,9,12,13,22,39,41,44,46,68,69,70,71,72,73,74,79,81],re=[1,8,9,12,13,18,20,22,39,41,44,46,47,60,68,69,70,71,72,73,74,79,81,86,100,102,103],ne=[13,60,86,100,102,103],Y=[13,60,73,74,86,100,102,103],Pe=[13,60,68,69,70,71,72,86,100,102,103],ue=[1,102],K=[1,120],W=[1,116],Q=[1,112],j=[1,118],X=[1,113],q=[1,114],H=[1,115],J=[1,117],Z=[1,119],Re=[22,50,60,61,82,86,87,88,89,90],Se=[1,8,9,39,41,44,46],le=[1,8,9,22],Ge=[1,150],Ue=[1,8,9,61],L=[1,8,9,22,50,60,61,82,86,87,88,89,90],Ne={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,ANNOTATION_START:46,ANNOTATION_END:47,CLASS:48,emptyBody:49,SPACE:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"ANNOTATION_START",47:"ANNOTATION_END",48:"CLASS",50:"SPACE",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[24,4],[24,7],[24,6],[43,2],[43,3],[49,0],[49,2],[49,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:f(function(c,h,p,r,g,e,$){var t=e.length-1;switch(g){case 8:this.$=e[t-1];break;case 9:case 10:case 13:case 15:this.$=e[t];break;case 11:case 14:this.$=e[t-2]+"."+e[t];break;case 12:case 16:this.$=e[t-1]+e[t];break;case 17:case 18:this.$=e[t-1]+"~"+e[t]+"~";break;case 19:r.addRelation(e[t]);break;case 20:e[t-1].title=r.cleanupLabel(e[t]),r.addRelation(e[t-1]);break;case 31:this.$=e[t].trim(),r.setAccTitle(this.$);break;case 32:case 33:this.$=e[t].trim(),r.setAccDescription(this.$);break;case 34:r.addClassesToNamespace(e[t-3],e[t-1][0],e[t-1][1]);break;case 35:r.addClassesToNamespace(e[t-4],e[t-1][0],e[t-1][1]);break;case 36:this.$=e[t],r.addNamespace(e[t]);break;case 37:this.$=[[e[t]],[]];break;case 38:this.$=[[e[t-1]],[]];break;case 39:e[t][0].unshift(e[t-2]),this.$=e[t];break;case 40:this.$=[[],[e[t]]];break;case 41:this.$=[[],[e[t-1]]];break;case 42:e[t][1].unshift(e[t-2]),this.$=e[t];break;case 44:r.setCssClass(e[t-2],e[t]);break;case 45:r.addMembers(e[t-3],e[t-1]);break;case 47:r.setCssClass(e[t-5],e[t-3]),r.addMembers(e[t-5],e[t-1]);break;case 48:r.addAnnotation(e[t-3],e[t-1]);break;case 49:r.addAnnotation(e[t-6],e[t-4]),r.addMembers(e[t-6],e[t-1]);break;case 50:r.addAnnotation(e[t-5],e[t-3]);break;case 51:this.$=e[t],r.addClass(e[t]);break;case 52:this.$=e[t-1],r.addClass(e[t-1]),r.setClassLabel(e[t-1],e[t]);break;case 56:r.addAnnotation(e[t],e[t-2]);break;case 57:case 70:this.$=[e[t]];break;case 58:e[t].push(e[t-1]),this.$=e[t];break;case 59:break;case 60:r.addMember(e[t-1],r.cleanupLabel(e[t]));break;case 61:break;case 62:break;case 63:this.$={id1:e[t-2],id2:e[t],relation:e[t-1],relationTitle1:"none",relationTitle2:"none"};break;case 64:this.$={id1:e[t-3],id2:e[t],relation:e[t-1],relationTitle1:e[t-2],relationTitle2:"none"};break;case 65:this.$={id1:e[t-3],id2:e[t],relation:e[t-2],relationTitle1:"none",relationTitle2:e[t-1]};break;case 66:this.$={id1:e[t-4],id2:e[t],relation:e[t-2],relationTitle1:e[t-3],relationTitle2:e[t-1]};break;case 67:this.$=r.addNote(e[t],e[t-1]);break;case 68:this.$=r.addNote(e[t]);break;case 69:this.$=e[t-2],r.defineClass(e[t-1],e[t]);break;case 71:this.$=e[t-2].concat([e[t]]);break;case 72:r.setDirection("TB");break;case 73:r.setDirection("BT");break;case 74:r.setDirection("RL");break;case 75:r.setDirection("LR");break;case 76:this.$={type1:e[t-2],type2:e[t],lineType:e[t-1]};break;case 77:this.$={type1:"none",type2:e[t],lineType:e[t-1]};break;case 78:this.$={type1:e[t-1],type2:"none",lineType:e[t]};break;case 79:this.$={type1:"none",type2:"none",lineType:e[t]};break;case 80:this.$=r.relationType.AGGREGATION;break;case 81:this.$=r.relationType.EXTENSION;break;case 82:this.$=r.relationType.COMPOSITION;break;case 83:this.$=r.relationType.DEPENDENCY;break;case 84:this.$=r.relationType.LOLLIPOP;break;case 85:this.$=r.lineType.LINE;break;case 86:this.$=r.lineType.DOTTED_LINE;break;case 87:case 93:this.$=e[t-2],r.setClickEvent(e[t-1],e[t]);break;case 88:case 94:this.$=e[t-3],r.setClickEvent(e[t-2],e[t-1]),r.setTooltip(e[t-2],e[t]);break;case 89:this.$=e[t-2],r.setLink(e[t-1],e[t]);break;case 90:this.$=e[t-3],r.setLink(e[t-2],e[t-1],e[t]);break;case 91:this.$=e[t-3],r.setLink(e[t-2],e[t-1]),r.setTooltip(e[t-2],e[t]);break;case 92:this.$=e[t-4],r.setLink(e[t-3],e[t-2],e[t]),r.setTooltip(e[t-3],e[t-1]);break;case 95:this.$=e[t-3],r.setClickEvent(e[t-2],e[t-1],e[t]);break;case 96:this.$=e[t-4],r.setClickEvent(e[t-3],e[t-2],e[t-1]),r.setTooltip(e[t-3],e[t]);break;case 97:this.$=e[t-3],r.setLink(e[t-2],e[t]);break;case 98:this.$=e[t-4],r.setLink(e[t-3],e[t-1],e[t]);break;case 99:this.$=e[t-4],r.setLink(e[t-3],e[t-1]),r.setTooltip(e[t-3],e[t]);break;case 100:this.$=e[t-5],r.setLink(e[t-4],e[t-2],e[t]),r.setTooltip(e[t-4],e[t-1]);break;case 101:this.$=e[t-2],r.setCssStyle(e[t-1],e[t]);break;case 102:r.setCssClass(e[t-1],e[t]);break;case 103:this.$=[e[t]];break;case 104:e[t-2].push(e[t]),this.$=e[t-2];break;case 106:this.$=e[t-1]+e[t];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:u,38:22,42:o,43:23,46:n,48:l,51:A,52:m,54:C,56:O,57:fe,60:b,62:ge,63:me,64:Ce,65:be,75:ke,76:Ee,78:Te,82:ye,83:De,86:k,100:E,102:T,103:y},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},s(Fe,[2,5],{8:[1,48]}),{8:[1,49]},s(d,[2,19],{22:[1,50]}),s(d,[2,21]),s(d,[2,22]),s(d,[2,23]),s(d,[2,24]),s(d,[2,25]),s(d,[2,26]),s(d,[2,27]),s(d,[2,28]),s(d,[2,29]),s(d,[2,30]),{34:[1,51]},{36:[1,52]},s(d,[2,33]),s(d,[2,59],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:ee,69:te,70:se,71:ie,72:ae,73:Be,74:_e}),{39:[1,65]},s(N,[2,43],{39:[1,67],44:[1,66],46:[1,68]}),s(d,[2,61]),s(d,[2,62]),{16:69,60:b,86:k,100:E,102:T},{16:39,17:40,19:70,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:71,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:72,60:b,86:k,100:E,102:T,103:y},{60:[1,73]},{13:[1,74]},{16:39,17:40,19:75,60:b,86:k,100:E,102:T,103:y},{13:Me,55:76},{58:78,60:[1,79]},s(d,[2,72]),s(d,[2,73]),s(d,[2,74]),s(d,[2,75]),s(P,[2,13],{16:39,17:40,19:81,18:[1,80],20:[1,82],60:b,86:k,100:E,102:T,103:y}),s(P,[2,15],{20:[1,83]}),{15:84,16:85,17:86,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:87,60:b,86:k,100:E,102:T,103:y},s(re,[2,129]),s(re,[2,130]),s(re,[2,131]),s(re,[2,132]),s([1,8,9,12,13,20,22,39,41,44,46,68,69,70,71,72,73,74,79,81],[2,133]),s(Fe,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:88,33:i,35:a,37:u,42:o,46:n,48:l,51:A,52:m,54:C,56:O,57:fe,60:b,62:ge,63:me,64:Ce,65:be,75:ke,76:Ee,78:Te,82:ye,83:De,86:k,100:E,102:T,103:y}),{5:89,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:u,38:22,42:o,43:23,46:n,48:l,51:A,52:m,54:C,56:O,57:fe,60:b,62:ge,63:me,64:Ce,65:be,75:ke,76:Ee,78:Te,82:ye,83:De,86:k,100:E,102:T,103:y},s(d,[2,20]),s(d,[2,31]),s(d,[2,32]),{13:[1,91],16:39,17:40,19:90,60:b,86:k,100:E,102:T,103:y},{53:92,66:56,67:57,68:ee,69:te,70:se,71:ie,72:ae,73:Be,74:_e},s(d,[2,60]),{67:93,73:Be,74:_e},s(ne,[2,79],{66:94,68:ee,69:te,70:se,71:ie,72:ae}),s(Y,[2,80]),s(Y,[2,81]),s(Y,[2,82]),s(Y,[2,83]),s(Y,[2,84]),s(Pe,[2,85]),s(Pe,[2,86]),{8:[1,96],24:97,30:98,40:95,43:23,48:l,54:C,56:O},{16:99,60:b,86:k,100:E,102:T},{41:[1,101],45:100,51:ue},{16:103,60:b,86:k,100:E,102:T},{47:[1,104]},{13:[1,105]},{13:[1,106]},{79:[1,107],81:[1,108]},{22:K,50:W,59:109,60:Q,82:j,84:110,85:111,86:X,87:q,88:H,89:J,90:Z},{60:[1,121]},{13:Me,55:122},s(N,[2,68]),s(N,[2,134]),{22:K,50:W,59:123,60:Q,61:[1,124],82:j,84:110,85:111,86:X,87:q,88:H,89:J,90:Z},s(Re,[2,70]),{16:39,17:40,19:125,60:b,86:k,100:E,102:T,103:y},s(P,[2,16]),s(P,[2,17]),s(P,[2,18]),{39:[2,36]},{15:127,16:85,17:86,18:[1,126],39:[2,9],60:b,86:k,100:E,102:T,103:y},{39:[2,10]},s(Se,[2,51],{11:128,12:[1,129]}),s(Fe,[2,7]),{9:[1,130]},s(le,[2,63]),{16:39,17:40,19:131,60:b,86:k,100:E,102:T,103:y},{13:[1,133],16:39,17:40,19:132,60:b,86:k,100:E,102:T,103:y},s(ne,[2,78],{66:134,68:ee,69:te,70:se,71:ie,72:ae}),s(ne,[2,77]),{41:[1,135]},{24:97,30:98,40:136,43:23,48:l,54:C,56:O},{8:[1,137],41:[2,37]},{8:[1,138],41:[2,40]},s(N,[2,44],{39:[1,139]}),{41:[1,140]},s(N,[2,46]),{41:[2,57],45:141,51:ue},{47:[1,142]},{16:39,17:40,19:143,60:b,86:k,100:E,102:T,103:y},s(d,[2,87],{13:[1,144]}),s(d,[2,89],{13:[1,146],77:[1,145]}),s(d,[2,93],{13:[1,147],80:[1,148]}),{13:[1,149]},s(d,[2,101],{61:Ge}),s(Ue,[2,103],{85:151,22:K,50:W,60:Q,82:j,86:X,87:q,88:H,89:J,90:Z}),s(L,[2,105]),s(L,[2,107]),s(L,[2,108]),s(L,[2,109]),s(L,[2,110]),s(L,[2,111]),s(L,[2,112]),s(L,[2,113]),s(L,[2,114]),s(L,[2,115]),s(d,[2,102]),s(N,[2,67]),s(d,[2,69],{61:Ge}),{60:[1,152]},s(P,[2,14]),{15:153,16:85,17:86,60:b,86:k,100:E,102:T,103:y},{39:[2,12]},s(Se,[2,52]),{13:[1,154]},{1:[2,4]},s(le,[2,65]),s(le,[2,64]),{16:39,17:40,19:155,60:b,86:k,100:E,102:T,103:y},s(ne,[2,76]),s(d,[2,34]),{41:[1,156]},{24:97,30:98,40:157,41:[2,38],43:23,48:l,54:C,56:O},{24:97,30:98,40:158,41:[2,41],43:23,48:l,54:C,56:O},{45:159,51:ue},s(N,[2,45]),{41:[2,58]},s(N,[2,48],{39:[1,160]}),s(d,[2,56]),s(d,[2,88]),s(d,[2,90]),s(d,[2,91],{77:[1,161]}),s(d,[2,94]),s(d,[2,95],{13:[1,162]}),s(d,[2,97],{13:[1,164],77:[1,163]}),{22:K,50:W,60:Q,82:j,84:165,85:111,86:X,87:q,88:H,89:J,90:Z},s(L,[2,106]),s(Re,[2,71]),{39:[2,11]},{14:[1,166]},s(le,[2,66]),s(d,[2,35]),{41:[2,39]},{41:[2,42]},{41:[1,167]},{41:[1,169],45:168,51:ue},s(d,[2,92]),s(d,[2,96]),s(d,[2,98]),s(d,[2,99],{77:[1,170]}),s(Ue,[2,104],{85:151,22:K,50:W,60:Q,82:j,86:X,87:q,88:H,89:J,90:Z}),s(Se,[2,8]),s(N,[2,47]),{41:[1,171]},s(N,[2,50]),s(d,[2,100]),s(N,[2,49])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],84:[2,36],86:[2,10],127:[2,12],130:[2,4],141:[2,58],153:[2,11],157:[2,39],158:[2,42]},parseError:f(function(c,h){if(h.recoverable)this.trace(c);else{var p=new Error(c);throw p.hash=h,p}},"parseError"),parse:f(function(c){var h=this,p=[0],r=[],g=[null],e=[],$=this.table,t="",ce=0,ze=0,He=2,Ye=1,Je=e.slice.call(arguments,1),D=Object.create(this.lexer),w={yy:{}};for(var Le in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Le)&&(w.yy[Le]=this.yy[Le]);D.setInput(c,w.yy),w.yy.lexer=D,w.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var xe=D.yylloc;e.push(xe);var Ze=D.options&&D.options.ranges;typeof w.yy.parseError=="function"?this.parseError=w.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function $e(_){p.length=p.length-2*_,g.length=g.length-_,e.length=e.length-_}f($e,"popStack");function Ke(){var _;return _=r.pop()||D.lex()||Ye,typeof _!="number"&&(_ instanceof Array&&(r=_,_=r.pop()),_=h.symbols_[_]||_),_}f(Ke,"lex");for(var B,V,S,ve,R={},he,x,We,de;;){if(V=p[p.length-1],this.defaultActions[V]?S=this.defaultActions[V]:((B===null||typeof B>"u")&&(B=Ke()),S=$[V]&&$[V][B]),typeof S>"u"||!S.length||!S[0]){var Ie="";de=[];for(he in $[V])this.terminals_[he]&&he>He&&de.push("'"+this.terminals_[he]+"'");D.showPosition?Ie="Parse error on line "+(ce+1)+`:
+`+D.showPosition()+`
+Expecting `+de.join(", ")+", got '"+(this.terminals_[B]||B)+"'":Ie="Parse error on line "+(ce+1)+": Unexpected "+(B==Ye?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(Ie,{text:D.match,token:this.terminals_[B]||B,line:D.yylineno,loc:xe,expected:de})}if(S[0]instanceof Array&&S.length>1)throw new Error("Parse Error: multiple actions possible at state: "+V+", token: "+B);switch(S[0]){case 1:p.push(B),g.push(D.yytext),e.push(D.yylloc),p.push(S[1]),B=null,ze=D.yyleng,t=D.yytext,ce=D.yylineno,xe=D.yylloc;break;case 2:if(x=this.productions_[S[1]][1],R.$=g[g.length-x],R._$={first_line:e[e.length-(x||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(x||1)].first_column,last_column:e[e.length-1].last_column},Ze&&(R._$.range=[e[e.length-(x||1)].range[0],e[e.length-1].range[1]]),ve=this.performAction.apply(R,[t,ze,ce,w.yy,S[1],g,e].concat(Je)),typeof ve<"u")return ve;x&&(p=p.slice(0,-1*x*2),g=g.slice(0,-1*x),e=e.slice(0,-1*x)),p.push(this.productions_[S[1]][0]),g.push(R.$),e.push(R._$),We=$[p[p.length-2]][p[p.length-1]],p.push(We);break;case 3:return!0}}return!0},"parse")},qe=(function(){var I={EOF:1,parseError:f(function(h,p){if(this.yy.parser)this.yy.parser.parseError(h,p);else throw new Error(h)},"parseError"),setInput:f(function(c,h){return this.yy=h||this.yy||{},this._input=c,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:f(function(){var c=this._input[0];this.yytext+=c,this.yyleng++,this.offset++,this.match+=c,this.matched+=c;var h=c.match(/(?:\r\n?|\n).*/g);return h?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),c},"input"),unput:f(function(c){var h=c.length,p=c.split(/(?:\r\n?|\n)/g);this._input=c+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-h),this.offset-=h;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),p.length-1&&(this.yylineno-=p.length-1);var g=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:p?(p.length===r.length?this.yylloc.first_column:0)+r[r.length-p.length].length-p[0].length:this.yylloc.first_column-h},this.options.ranges&&(this.yylloc.range=[g[0],g[0]+this.yyleng-h]),this.yyleng=this.yytext.length,this},"unput"),more:f(function(){return this._more=!0,this},"more"),reject:f(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
+`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:f(function(c){this.unput(this.match.slice(c))},"less"),pastInput:f(function(){var c=this.matched.substr(0,this.matched.length-this.match.length);return(c.length>20?"...":"")+c.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:f(function(){var c=this.match;return c.length<20&&(c+=this._input.substr(0,20-c.length)),(c.substr(0,20)+(c.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:f(function(){var c=this.pastInput(),h=new Array(c.length+1).join("-");return c+this.upcomingInput()+`
+`+h+"^"},"showPosition"),test_match:f(function(c,h){var p,r,g;if(this.options.backtrack_lexer&&(g={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(g.yylloc.range=this.yylloc.range.slice(0))),r=c[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+c[0].length},this.yytext+=c[0],this.match+=c[0],this.matches=c,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(c[0].length),this.matched+=c[0],p=this.performAction.call(this,this.yy,this,h,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),p)return p;if(this._backtrack){for(var e in g)this[e]=g[e];return!1}return!1},"test_match"),next:f(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var c,h,p,r;this._more||(this.yytext="",this.match="");for(var g=this._currentRules(),e=0;eh[0].length)){if(h=p,r=e,this.options.backtrack_lexer){if(c=this.test_match(p,g[e]),c!==!1)return c;if(this._backtrack){h=!1;continue}else return!1}else if(!this.options.flex)break}return h?(c=this.test_match(h,g[r]),c!==!1?c:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
+`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:f(function(){var h=this.next();return h||this.lex()},"lex"),begin:f(function(h){this.conditionStack.push(h)},"begin"),popState:f(function(){var h=this.conditionStack.length-1;return h>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:f(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:f(function(h){return h=this.conditionStack.length-1-Math.abs(h||0),h>=0?this.conditionStack[h]:"INITIAL"},"topState"),pushState:f(function(h){this.begin(h)},"pushState"),stateStackSize:f(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:f(function(h,p,r,g){switch(r){case 0:return 62;case 1:return 63;case 2:return 64;case 3:return 65;case 4:break;case 5:break;case 6:return this.begin("acc_title"),33;case 7:return this.popState(),"acc_title_value";case 8:return this.begin("acc_descr"),35;case 9:return this.popState(),"acc_descr_value";case 10:this.begin("acc_descr_multiline");break;case 11:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:return 8;case 14:break;case 15:return 7;case 16:return 7;case 17:return"EDGE_STATE";case 18:this.begin("callback_name");break;case 19:this.popState();break;case 20:this.popState(),this.begin("callback_args");break;case 21:return 79;case 22:this.popState();break;case 23:return 80;case 24:this.popState();break;case 25:return"STR";case 26:this.begin("string");break;case 27:return 82;case 28:return 57;case 29:return this.begin("namespace"),42;case 30:return this.popState(),8;case 31:break;case 32:return this.begin("namespace-body"),39;case 33:return this.popState(),41;case 34:return"EOF_IN_STRUCT";case 35:return 8;case 36:break;case 37:return"EDGE_STATE";case 38:return this.begin("class"),48;case 39:return this.popState(),8;case 40:break;case 41:return this.popState(),this.popState(),41;case 42:return this.begin("class-body"),39;case 43:return this.popState(),41;case 44:return"EOF_IN_STRUCT";case 45:return"EDGE_STATE";case 46:return"OPEN_IN_STRUCT";case 47:break;case 48:return"MEMBER";case 49:return 83;case 50:return 75;case 51:return 76;case 52:return 78;case 53:return 54;case 54:return 56;case 55:return 46;case 56:return 47;case 57:return 81;case 58:this.popState();break;case 59:return"GENERICTYPE";case 60:this.begin("generic");break;case 61:this.popState();break;case 62:return"BQUOTE_STR";case 63:this.begin("bqstring");break;case 64:return 77;case 65:return 77;case 66:return 77;case 67:return 77;case 68:return 69;case 69:return 69;case 70:return 71;case 71:return 71;case 72:return 70;case 73:return 68;case 74:return 72;case 75:return 73;case 76:return 74;case 77:return 22;case 78:return 44;case 79:return 100;case 80:return 18;case 81:return"PLUS";case 82:return 87;case 83:return 61;case 84:return 89;case 85:return 89;case 86:return 90;case 87:return"EQUALS";case 88:return"EQUALS";case 89:return 60;case 90:return 12;case 91:return 14;case 92:return"PUNCTUATION";case 93:return 86;case 94:return 102;case 95:return 50;case 96:return 50;case 97:return 9}},"anonymous"),rules:[/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:classDiagram-v2\b)/,/^(?:classDiagram\b)/,/^(?:\[\*\])/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:["])/,/^(?:[^"]*)/,/^(?:["])/,/^(?:style\b)/,/^(?:classDef\b)/,/^(?:namespace\b)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:[{])/,/^(?:[}])/,/^(?:$)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:\[\*\])/,/^(?:class\b)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:[}])/,/^(?:[{])/,/^(?:[}])/,/^(?:$)/,/^(?:\[\*\])/,/^(?:[{])/,/^(?:[\n])/,/^(?:[^{}\n]*)/,/^(?:cssClass\b)/,/^(?:callback\b)/,/^(?:link\b)/,/^(?:click\b)/,/^(?:note for\b)/,/^(?:note\b)/,/^(?:<<)/,/^(?:>>)/,/^(?:href\b)/,/^(?:[~])/,/^(?:[^~]*)/,/^(?:~)/,/^(?:[`])/,/^(?:[^`]+)/,/^(?:[`])/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:\s*<\|)/,/^(?:\s*\|>)/,/^(?:\s*>)/,/^(?:\s*<)/,/^(?:\s*\*)/,/^(?:\s*o\b)/,/^(?:\s*\(\))/,/^(?:--)/,/^(?:\.\.)/,/^(?::{1}[^:\n;]+)/,/^(?::{3})/,/^(?:-)/,/^(?:\.)/,/^(?:\+)/,/^(?::)/,/^(?:,)/,/^(?:#)/,/^(?:#)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:\w+)/,/^(?:\[)/,/^(?:\])/,/^(?:[!"#$%&'*+,-.`?\\/])/,/^(?:[0-9]+)/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\s)/,/^(?:\s)/,/^(?:$)/],conditions:{"namespace-body":{rules:[26,33,34,35,36,37,38,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},namespace:{rules:[26,29,30,31,32,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},"class-body":{rules:[26,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},class:{rules:[26,39,40,41,42,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},acc_descr_multiline:{rules:[11,12,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},acc_descr:{rules:[9,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},acc_title:{rules:[7,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},callback_args:{rules:[22,23,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},callback_name:{rules:[19,20,21,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},href:{rules:[26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},struct:{rules:[26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},generic:{rules:[26,49,50,51,52,53,54,55,56,57,58,59,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},bqstring:{rules:[26,49,50,51,52,53,54,55,56,57,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},string:{rules:[24,25,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,26,27,28,29,38,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97],inclusive:!0}}};return I})();Ne.lexer=qe;function oe(){this.yy={}}return f(oe,"Parser"),oe.prototype=Ne,Ne.Parser=oe,new oe})();Ve.parser=Ve;var Ft=Ve,Qe=["#","+","~","-",""],U,je=(U=class{constructor(i,a){this.memberType=a,this.visibility="",this.classifier="",this.text="";const u=ft(i,F());this.parseMember(u)}getDisplayDetails(){let i=this.visibility+G(this.id);this.memberType==="method"&&(i+=`(${G(this.parameters.trim())})`,this.returnType&&(i+=" : "+G(this.returnType))),i=i.trim();const a=this.parseClassifier();return{displayText:i,cssStyle:a}}parseMember(i){let a="";if(this.memberType==="method"){const n=/([#+~-])?(.+)\((.*)\)([\s$*])?(.*)([$*])?/.exec(i);if(n){const l=n[1]?n[1].trim():"";if(Qe.includes(l)&&(this.visibility=l),this.id=n[2],this.parameters=n[3]?n[3].trim():"",a=n[4]?n[4].trim():"",this.returnType=n[5]?n[5].trim():"",a===""){const A=this.returnType.substring(this.returnType.length-1);/[$*]/.exec(A)&&(a=A,this.returnType=this.returnType.substring(0,this.returnType.length-1))}}}else{const o=i.length,n=i.substring(0,1),l=i.substring(o-1);Qe.includes(n)&&(this.visibility=n),/[$*]/.exec(l)&&(a=l),this.id=i.substring(this.visibility===""?0:1,a===""?o:o-1)}this.classifier=a,this.id=this.id.startsWith(" ")?" "+this.id.trim():this.id.trim();const u=`${this.visibility?"\\"+this.visibility:""}${G(this.id)}${this.memberType==="method"?`(${G(this.parameters)})${this.returnType?" : "+G(this.returnType):""}`:""}`;this.text=u.replaceAll("<","<").replaceAll(">",">"),this.text.startsWith("\\<")&&(this.text=this.text.replace("\\<","~"))}parseClassifier(){switch(this.classifier){case"*":return"font-style:italic;";case"$":return"text-decoration:underline;";default:return""}}},f(U,"ClassMember"),U),Ae="classId-",Xe=0,M=f(s=>v.sanitizeText(s,F()),"sanitizeText"),z,Bt=(z=class{constructor(){this.relations=[],this.classes=new Map,this.styleClasses=new Map,this.notes=new Map,this.interfaces=[],this.namespaces=new Map,this.namespaceCounter=0,this.diagramId="",this.functions=[],this.lineType={LINE:0,DOTTED_LINE:1},this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3,LOLLIPOP:4},this.setupToolTips=f(i=>{const a=tt();pe(i).select("svg").selectAll("g").filter(function(){return pe(this).attr("title")!==null}).on("mouseover",n=>{const l=pe(n.currentTarget),A=l.attr("title");if(!A)return;const m=n.currentTarget.getBoundingClientRect();a.transition().duration(200).style("opacity",".9"),a.html(nt.sanitize(A)).style("left",`${window.scrollX+m.left+m.width/2}px`).style("top",`${window.scrollY+m.bottom+4}px`),l.classed("hover",!0)}).on("mouseout",n=>{a.transition().duration(500).style("opacity",0),pe(n.currentTarget).classed("hover",!1)})},"setupToolTips"),this.direction="TB",this.setAccTitle=ut,this.getAccTitle=lt,this.setAccDescription=ot,this.getAccDescription=ct,this.setDiagramTitle=ht,this.getDiagramTitle=dt,this.getConfig=f(()=>F().class,"getConfig"),this.functions.push(this.setupToolTips.bind(this)),this.clear(),this.addRelation=this.addRelation.bind(this),this.addClassesToNamespace=this.addClassesToNamespace.bind(this),this.addNamespace=this.addNamespace.bind(this),this.setCssClass=this.setCssClass.bind(this),this.addMembers=this.addMembers.bind(this),this.addClass=this.addClass.bind(this),this.setClassLabel=this.setClassLabel.bind(this),this.addAnnotation=this.addAnnotation.bind(this),this.addMember=this.addMember.bind(this),this.cleanupLabel=this.cleanupLabel.bind(this),this.addNote=this.addNote.bind(this),this.defineClass=this.defineClass.bind(this),this.setDirection=this.setDirection.bind(this),this.setLink=this.setLink.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.clear=this.clear.bind(this),this.setTooltip=this.setTooltip.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setCssStyle=this.setCssStyle.bind(this)}splitClassNameAndType(i){const a=v.sanitizeText(i,F());let u="",o=a;if(a.indexOf("~")>0){const n=a.split("~");o=M(n[0]),u=M(n[1])}return{className:o,type:u}}setClassLabel(i,a){const u=v.sanitizeText(i,F());a&&(a=M(a));const{className:o}=this.splitClassNameAndType(u);this.classes.get(o).label=a,this.classes.get(o).text=`${a}${this.classes.get(o).type?`<${this.classes.get(o).type}>`:""}`}addClass(i){const a=v.sanitizeText(i,F()),{className:u,type:o}=this.splitClassNameAndType(a);if(this.classes.has(u))return;const n=v.sanitizeText(u,F());this.classes.set(n,{id:n,type:o,label:n,text:`${n}${o?`<${o}>`:""}`,shape:"classBox",cssClasses:"default",methods:[],members:[],annotations:[],styles:[],domId:Ae+n+"-"+Xe}),Xe++}addInterface(i,a){const u={id:`interface${this.interfaces.length}`,label:i,classId:a};this.interfaces.push(u)}setDiagramId(i){this.diagramId=i}lookUpDomId(i){const a=v.sanitizeText(i,F());if(this.classes.has(a)){const u=this.classes.get(a).domId;return this.diagramId?`${this.diagramId}-${u}`:u}throw new Error("Class not found: "+a)}clear(){this.relations=[],this.classes=new Map,this.notes=new Map,this.interfaces=[],this.functions=[],this.functions.push(this.setupToolTips.bind(this)),this.namespaces=new Map,this.namespaceCounter=0,this.diagramId="",this.direction="TB",pt()}getClass(i){return this.classes.get(i)}getClasses(){return this.classes}getRelations(){return this.relations}getNote(i){const a=typeof i=="number"?`note${i}`:i;return this.notes.get(a)}getNotes(){return this.notes}addRelation(i){Oe.debug("Adding relation: "+JSON.stringify(i));const a=[this.relationType.LOLLIPOP,this.relationType.AGGREGATION,this.relationType.COMPOSITION,this.relationType.DEPENDENCY,this.relationType.EXTENSION];i.relation.type1===this.relationType.LOLLIPOP&&!a.includes(i.relation.type2)?(this.addClass(i.id2),this.addInterface(i.id1,i.id2),i.id1=`interface${this.interfaces.length-1}`):i.relation.type2===this.relationType.LOLLIPOP&&!a.includes(i.relation.type1)?(this.addClass(i.id1),this.addInterface(i.id2,i.id1),i.id2=`interface${this.interfaces.length-1}`):(this.addClass(i.id1),this.addClass(i.id2)),i.id1=this.splitClassNameAndType(i.id1).className,i.id2=this.splitClassNameAndType(i.id2).className,i.relationTitle1=v.sanitizeText(i.relationTitle1.trim(),F()),i.relationTitle2=v.sanitizeText(i.relationTitle2.trim(),F()),this.relations.push(i)}addAnnotation(i,a){const u=this.splitClassNameAndType(i).className;this.classes.get(u).annotations.push(a)}addMember(i,a){this.addClass(i);const u=this.splitClassNameAndType(i).className,o=this.classes.get(u);if(typeof a=="string"){const n=a.trim();n.startsWith("<<")&&n.endsWith(">>")?o.annotations.push(M(n.substring(2,n.length-2))):n.indexOf(")")>0?o.methods.push(new je(n,"method")):n&&o.members.push(new je(n,"attribute"))}}addMembers(i,a){Array.isArray(a)&&(a.reverse(),a.forEach(u=>this.addMember(i,u)))}addNote(i,a){const u=this.notes.size,o={id:`note${u}`,class:a,text:i,index:u};return this.notes.set(o.id,o),o.id}cleanupLabel(i){return i.startsWith(":")&&(i=i.substring(1)),M(i.trim())}setCssClass(i,a){i.split(",").forEach(u=>{let o=u;/\d/.exec(u[0])&&(o=Ae+o);const n=this.classes.get(o);n&&(n.cssClasses+=" "+a)})}defineClass(i,a){for(const u of i){let o=this.styleClasses.get(u);o===void 0&&(o={id:u,styles:[],textStyles:[]},this.styleClasses.set(u,o)),a&&a.forEach(n=>{if(/color/.exec(n)){const l=n.replace("fill","bgFill");o.textStyles.push(l)}o.styles.push(n)}),this.classes.forEach(n=>{n.cssClasses.includes(u)&&n.styles.push(...a.flatMap(l=>l.split(",")))})}}setTooltip(i,a){i.split(",").forEach(u=>{a!==void 0&&(this.classes.get(u).tooltip=M(a))})}getTooltip(i,a){return a&&this.namespaces.has(a)?this.namespaces.get(a).classes.get(i).tooltip:this.classes.get(i).tooltip}setLink(i,a,u){const o=F();i.split(",").forEach(n=>{let l=n;/\d/.exec(n[0])&&(l=Ae+l);const A=this.classes.get(l);A&&(A.link=we.formatUrl(a,o),o.securityLevel==="sandbox"?A.linkTarget="_top":typeof u=="string"?A.linkTarget=M(u):A.linkTarget="_blank")}),this.setCssClass(i,"clickable")}setClickEvent(i,a,u){i.split(",").forEach(o=>{this.setClickFunc(o,a,u),this.classes.get(o).haveCallback=!0}),this.setCssClass(i,"clickable")}setClickFunc(i,a,u){const o=v.sanitizeText(i,F());if(F().securityLevel!=="loose"||a===void 0)return;const l=o;if(this.classes.has(l)){let A=[];if(typeof u=="string"){A=u.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let m=0;m{const m=this.lookUpDomId(l),C=document.querySelector(`[id="${m}"]`);C!==null&&C.addEventListener("click",()=>{we.runFunc(a,...A)},!1)})}}bindFunctions(i){this.functions.forEach(a=>{a(i)})}escapeHtml(i){return i.replace(/&/g,"&").replace(/ /g,">").replace(/"/g,""").replace(/'/g,"'")}getDirection(){return this.direction}setDirection(i){this.direction=i}addNamespace(i){this.namespaces.has(i)||(this.namespaces.set(i,{id:i,classes:new Map,notes:new Map,children:new Map,domId:Ae+i+"-"+this.namespaceCounter}),this.namespaceCounter++)}getNamespace(i){return this.namespaces.get(i)}getNamespaces(){return this.namespaces}addClassesToNamespace(i,a,u){if(this.namespaces.has(i)){for(const o of a){const{className:n}=this.splitClassNameAndType(o),l=this.getClass(n);l.parent=i,this.namespaces.get(i).classes.set(n,l)}for(const o of u){const n=this.getNote(o);n.parent=i,this.namespaces.get(i).notes.set(o,n)}}}setCssStyle(i,a){const u=this.classes.get(i);if(!(!a||!u))for(const o of a)o.includes(",")?u.styles.push(...o.split(",")):u.styles.push(o)}getArrowMarker(i){let a;switch(i){case 0:a="aggregation";break;case 1:a="extension";break;case 2:a="composition";break;case 3:a="dependency";break;case 4:a="lollipop";break;default:a="none"}return a}getData(){var n;const i=[],a=[],u=F();for(const l of this.namespaces.values()){const A={id:l.id,label:l.id,isGroup:!0,padding:u.class.padding??16,shape:"rect",cssStyles:[],look:u.look};i.push(A)}for(const l of this.classes.values()){const A={...l,type:void 0,isGroup:!1,parentId:l.parent,look:u.look};i.push(A)}for(const l of this.notes.values()){const A={id:l.id,label:l.text,isGroup:!1,shape:"note",padding:u.class.padding??6,cssStyles:["text-align: left","white-space: nowrap",`fill: ${u.themeVariables.noteBkgColor}`,`stroke: ${u.themeVariables.noteBorderColor}`],look:u.look,parentId:l.parent,labelType:"markdown"};i.push(A);const m=(n=this.classes.get(l.class))==null?void 0:n.id;if(m){const C={id:`edgeNote${l.index}`,start:l.id,end:m,type:"normal",thickness:"normal",classes:"relation",arrowTypeStart:"none",arrowTypeEnd:"none",arrowheadStyle:"",labelStyle:[""],style:["fill: none"],pattern:"dotted",look:u.look};a.push(C)}}for(const l of this.interfaces){const A={id:l.id,label:l.label,isGroup:!1,shape:"rect",cssStyles:["opacity: 0;"],look:u.look};i.push(A)}let o=0;for(const l of this.relations){o++;const A={id:At(l.id1,l.id2,{prefix:"id",counter:o}),start:l.id1,end:l.id2,type:"normal",label:l.title,labelpos:"c",thickness:"normal",classes:"relation",arrowTypeStart:this.getArrowMarker(l.relation.type1),arrowTypeEnd:this.getArrowMarker(l.relation.type2),startLabelRight:l.relationTitle1==="none"?"":l.relationTitle1,endLabelLeft:l.relationTitle2==="none"?"":l.relationTitle2,arrowheadStyle:"",labelStyle:["display: inline-block"],style:l.style||"",pattern:l.relation.lineType==1?"dashed":"solid",look:u.look,labelType:"markdown"};a.push(A)}return{nodes:i,edges:a,other:{},config:u,direction:this.getDirection()}}},f(z,"ClassDB"),z),gt=f(s=>`g.classGroup text {
+ fill: ${s.nodeBorder||s.classText};
+ stroke: none;
+ font-family: ${s.fontFamily};
+ font-size: 10px;
+
+ .title {
+ font-weight: bolder;
+ }
+
+}
+
+ .cluster-label text {
+ fill: ${s.titleColor};
+ }
+ .cluster-label span {
+ color: ${s.titleColor};
+ }
+ .cluster-label span p {
+ background-color: transparent;
+ }
+
+ .cluster rect {
+ fill: ${s.clusterBkg};
+ stroke: ${s.clusterBorder};
+ stroke-width: 1px;
+ }
+
+ .cluster text {
+ fill: ${s.titleColor};
+ }
+
+ .cluster span {
+ color: ${s.titleColor};
+ }
+
+.nodeLabel, .edgeLabel {
+ color: ${s.classText};
+}
+
+.noteLabel .nodeLabel, .noteLabel .edgeLabel {
+ color: ${s.noteTextColor};
+}
+.edgeLabel .label rect {
+ fill: ${s.mainBkg};
+}
+.label text {
+ fill: ${s.classText};
+}
+
+.labelBkg {
+ background: ${s.mainBkg};
+}
+.edgeLabel .label span {
+ background: ${s.mainBkg};
+}
+
+.classTitle {
+ font-weight: bolder;
+}
+.node rect,
+ .node circle,
+ .node ellipse,
+ .node polygon,
+ .node path {
+ fill: ${s.mainBkg};
+ stroke: ${s.nodeBorder};
+ stroke-width: ${s.strokeWidth};
+ }
+
+
+.divider {
+ stroke: ${s.nodeBorder};
+ stroke-width: 1;
+}
+
+g.clickable {
+ cursor: pointer;
+}
+
+g.classGroup rect {
+ fill: ${s.mainBkg};
+ stroke: ${s.nodeBorder};
+}
+
+g.classGroup line {
+ stroke: ${s.nodeBorder};
+ stroke-width: 1;
+}
+
+.classLabel .box {
+ stroke: none;
+ stroke-width: 0;
+ fill: ${s.mainBkg};
+ opacity: 0.5;
+}
+
+.classLabel .label {
+ fill: ${s.nodeBorder};
+ font-size: 10px;
+}
+
+.relation {
+ stroke: ${s.lineColor};
+ stroke-width: ${s.strokeWidth};
+ fill: none;
+}
+
+.dashed-line{
+ stroke-dasharray: 3;
+}
+
+.dotted-line{
+ stroke-dasharray: 1 2;
+}
+
+[id$="-compositionStart"], .composition {
+ fill: ${s.lineColor} !important;
+ stroke: ${s.lineColor} !important;
+ stroke-width: 1;
+}
+
+[id$="-compositionEnd"], .composition {
+ fill: ${s.lineColor} !important;
+ stroke: ${s.lineColor} !important;
+ stroke-width: 1;
+}
+
+[id$="-dependencyStart"], .dependency {
+ fill: ${s.lineColor} !important;
+ stroke: ${s.lineColor} !important;
+ stroke-width: 1;
+}
+
+[id$="-dependencyEnd"], .dependency {
+ fill: ${s.lineColor} !important;
+ stroke: ${s.lineColor} !important;
+ stroke-width: 1;
+}
+
+[id$="-extensionStart"], .extension {
+ fill: transparent !important;
+ stroke: ${s.lineColor} !important;
+ stroke-width: 1;
+}
+
+[id$="-extensionEnd"], .extension {
+ fill: transparent !important;
+ stroke: ${s.lineColor} !important;
+ stroke-width: 1;
+}
+
+[id$="-aggregationStart"], .aggregation {
+ fill: transparent !important;
+ stroke: ${s.lineColor} !important;
+ stroke-width: 1;
+}
+
+[id$="-aggregationEnd"], .aggregation {
+ fill: transparent !important;
+ stroke: ${s.lineColor} !important;
+ stroke-width: 1;
+}
+
+[id$="-lollipopStart"], .lollipop {
+ fill: ${s.mainBkg} !important;
+ stroke: ${s.lineColor} !important;
+ stroke-width: 1;
+}
+
+[id$="-lollipopEnd"], .lollipop {
+ fill: ${s.mainBkg} !important;
+ stroke: ${s.lineColor} !important;
+ stroke-width: 1;
+}
+
+.edgeTerminals {
+ font-size: 11px;
+ line-height: initial;
+}
+
+.classTitleText {
+ text-anchor: middle;
+ font-size: 18px;
+ fill: ${s.textColor};
+}
+
+.edgeLabel[data-look="neo"] {
+ background-color: ${s.edgeLabelBackground};
+ p {
+ background-color: ${s.edgeLabelBackground};
+ }
+ rect {
+ opacity: 0.5;
+ background-color: ${s.edgeLabelBackground};
+ fill: ${s.edgeLabelBackground};
+ }
+ text-align: center;
+}
+ ${et()}
+`,"getStyles"),_t=gt,mt=f((s,i="TB")=>{if(!s.doc)return i;let a=i;for(const u of s.doc)u.stmt==="dir"&&(a=u.value);return a},"getDir"),Ct=f(function(s,i){return i.db.getClasses()},"getClasses"),bt=f(async function(s,i,a,u){Oe.info("REF0:"),Oe.info("Drawing class diagram (v3)",i);const{securityLevel:o,state:n,layout:l}=F();u.db.setDiagramId(i);const A=u.db.getData(),m=st(i,o);A.type=u.type,A.layoutAlgorithm=at(l),A.nodeSpacing=(n==null?void 0:n.nodeSpacing)||50,A.rankSpacing=(n==null?void 0:n.rankSpacing)||50,A.markers=["aggregation","extension","composition","dependency","lollipop"],A.diagramId=i,await rt(A,m);const C=8;we.insertTitle(m,"classDiagramTitleText",(n==null?void 0:n.titleTopMargin)??25,u.db.getDiagramTitle()),it(m,C,"classDiagram",(n==null?void 0:n.useMaxWidth)??!0)},"draw"),St={getClasses:Ct,draw:bt,getDir:mt};export{Bt as C,Ft as a,St as c,_t as s};
diff --git a/dist-desktop/assets/chunk-55IACEB6-D6svk_zs.js b/dist-desktop/assets/chunk-55IACEB6-D6svk_zs.js
new file mode 100644
index 0000000..5750dec
--- /dev/null
+++ b/dist-desktop/assets/chunk-55IACEB6-D6svk_zs.js
@@ -0,0 +1 @@
+import{_ as a,d as o}from"./mermaid.core-DD7RPEfx.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};
diff --git a/dist-desktop/assets/chunk-EDXVE4YY-D2oMcFeR.js b/dist-desktop/assets/chunk-EDXVE4YY-D2oMcFeR.js
new file mode 100644
index 0000000..605d768
--- /dev/null
+++ b/dist-desktop/assets/chunk-EDXVE4YY-D2oMcFeR.js
@@ -0,0 +1 @@
+import{_ as a,e as w,l as x}from"./mermaid.core-DD7RPEfx.js";var d=a((e,t,i,o)=>{e.attr("class",i);const{width:r,height:h,x:n,y:c}=u(e,t);w(e,h,r,o);const s=l(n,c,r,h,t);e.attr("viewBox",s),x.debug(`viewBox configured: ${s} with padding: ${t}`)},"setupViewPortForSVG"),u=a((e,t)=>{var o;const i=((o=e.node())==null?void 0:o.getBBox())||{width:0,height:0,x:0,y:0};return{width:i.width+t*2,height:i.height+t*2,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),l=a((e,t,i,o,r)=>`${e-r} ${t-r} ${i} ${o}`,"createViewBox");export{d as s};
diff --git a/dist-desktop/assets/chunk-FMBD7UC4-TatyaWoN.js b/dist-desktop/assets/chunk-FMBD7UC4-TatyaWoN.js
new file mode 100644
index 0000000..cb1f83b
--- /dev/null
+++ b/dist-desktop/assets/chunk-FMBD7UC4-TatyaWoN.js
@@ -0,0 +1,15 @@
+import{_ as e}from"./mermaid.core-DD7RPEfx.js";var l=e(()=>`
+ /* Font Awesome icon styling - consolidated */
+ .label-icon {
+ display: inline-block;
+ height: 1em;
+ overflow: visible;
+ vertical-align: -0.125em;
+ }
+
+ .node .label-icon path {
+ fill: currentColor;
+ stroke: revert;
+ stroke-width: revert;
+ }
+`,"getIconStyles");export{l as g};
diff --git a/dist-desktop/assets/chunk-OYMX7WX6-Bgc90t5_.js b/dist-desktop/assets/chunk-OYMX7WX6-Bgc90t5_.js
new file mode 100644
index 0000000..74ad0b9
--- /dev/null
+++ b/dist-desktop/assets/chunk-OYMX7WX6-Bgc90t5_.js
@@ -0,0 +1,231 @@
+import{g as te}from"./chunk-55IACEB6-D6svk_zs.js";import{s as ee}from"./chunk-EDXVE4YY-D2oMcFeR.js";import{_ as f,l as b,c as F,r as se,u as ie,a as re,b as ae,g as ne,s as le,p as oe,q as ce,T as he,k as H,z as ue}from"./mermaid.core-DD7RPEfx.js";var vt=(function(){var t=f(function(V,l,h,n){for(h=h||{},n=V.length;n--;h[V[n]]=l);return h},"o"),e=[1,2],s=[1,3],a=[1,4],i=[2,4],o=[1,9],u=[1,11],p=[1,16],S=[1,17],T=[1,18],E=[1,19],m=[1,33],L=[1,20],v=[1,21],O=[1,22],w=[1,23],C=[1,24],d=[1,26],D=[1,27],$=[1,28],B=[1,29],I=[1,30],G=[1,31],P=[1,32],at=[1,35],nt=[1,36],lt=[1,37],ot=[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(l,h,n,g,_,r,Z){var c=r.length-1;switch(_){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:e,5:s,6:a},{1:[3]},{3:5,4:e,5:s,6:a},{3:6,4:e,5:s,6:a},t([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:o,5:u,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:S,19:T,22:E,24:m,25:L,26:v,27:O,28:w,29:C,32:25,33:d,35:D,37:$,38:B,41:I,45:G,48:P,51:at,52:nt,53:lt,54:ot,57:K},t(y,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:p,17:S,19:T,22:E,24:m,25:L,26:v,27:O,28:w,29:C,32:25,33:d,35:D,37:$,38:B,41:I,45:G,48:P,51:at,52:nt,53:lt,54:ot,57:K},t(y,[2,7]),t(y,[2,8]),t(y,[2,9]),t(y,[2,10]),t(y,[2,11]),t(y,[2,12],{14:[1,40],15:[1,41]}),t(y,[2,16]),{18:[1,42]},t(y,[2,18],{20:[1,43]}),{23:[1,44]},t(y,[2,22]),t(y,[2,23]),t(y,[2,24]),t(y,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},t(y,[2,28]),{34:[1,49]},{36:[1,50]},t(y,[2,31]),{13:51,24:m,57:K},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},t(ct,[2,44],{58:[1,56]}),t(ct,[2,45],{58:[1,57]}),t(y,[2,38]),t(y,[2,39]),t(y,[2,40]),t(y,[2,41]),t(y,[2,6]),t(y,[2,13]),{13:58,24:m,57:K},t(y,[2,17]),t(xt,i,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},t(y,[2,29]),t(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]},t(y,[2,14],{14:[1,71]}),{4:o,5:u,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:S,19:T,21:[1,72],22:E,24:m,25:L,26:v,27:O,28:w,29:C,32:25,33:d,35:D,37:$,38:B,41:I,45:G,48:P,51:at,52:nt,53:lt,54:ot,57:K},t(y,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},t(y,[2,34]),t(y,[2,35]),t(y,[2,36]),t(y,[2,37]),t(ct,[2,46]),t(ct,[2,47]),t(y,[2,15]),t(y,[2,19]),t(xt,i,{7:78}),t(y,[2,26]),t(y,[2,27]),{5:[1,79]},{5:[1,80]},{4:o,5:u,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:S,19:T,21:[1,81],22:E,24:m,25:L,26:v,27:O,28:w,29:C,32:25,33:d,35:D,37:$,38:B,41:I,45:G,48:P,51:at,52:nt,53:lt,54:ot,57:K},t(y,[2,32]),t(y,[2,33]),t(y,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:f(function(l,h){if(h.recoverable)this.trace(l);else{var n=new Error(l);throw n.hash=h,n}},"parseError"),parse:f(function(l){var h=this,n=[0],g=[],_=[null],r=[],Z=this.table,c="",U=0,X=0,ut=2,tt=1,Tt=r.slice.call(arguments,1),k=Object.create(this.lexer),W={yy:{}};for(var Et in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Et)&&(W.yy[Et]=this.yy[Et]);k.setInput(l,W.yy),W.yy.lexer=k,W.yy.parser=this,typeof k.yylloc>"u"&&(k.yylloc={});var _t=k.yylloc;r.push(_t);var Qt=k.options&&k.options.ranges;typeof W.yy.parseError=="function"?this.parseError=W.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Zt(R){n.length=n.length-2*R,_.length=_.length-R,r.length=r.length-R}f(Zt,"popStack");function Lt(){var R;return R=g.pop()||k.lex()||tt,typeof R!="number"&&(R instanceof Array&&(g=R,R=g.pop()),R=h.symbols_[R]||R),R}f(Lt,"lex");for(var x,j,N,mt,J={},dt,Y,Ot,ft;;){if(j=n[n.length-1],this.defaultActions[j]?N=this.defaultActions[j]:((x===null||typeof x>"u")&&(x=Lt()),N=Z[j]&&Z[j][x]),typeof N>"u"||!N.length||!N[0]){var bt="";ft=[];for(dt in Z[j])this.terminals_[dt]&&dt>ut&&ft.push("'"+this.terminals_[dt]+"'");k.showPosition?bt="Parse error on line "+(U+1)+`:
+`+k.showPosition()+`
+Expecting `+ft.join(", ")+", got '"+(this.terminals_[x]||x)+"'":bt="Parse error on line "+(U+1)+": Unexpected "+(x==tt?"end of input":"'"+(this.terminals_[x]||x)+"'"),this.parseError(bt,{text:k.match,token:this.terminals_[x]||x,line:k.yylineno,loc:_t,expected:ft})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+j+", token: "+x);switch(N[0]){case 1:n.push(x),_.push(k.yytext),r.push(k.yylloc),n.push(N[1]),x=null,X=k.yyleng,c=k.yytext,U=k.yylineno,_t=k.yylloc;break;case 2:if(Y=this.productions_[N[1]][1],J.$=_[_.length-Y],J._$={first_line:r[r.length-(Y||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(Y||1)].first_column,last_column:r[r.length-1].last_column},Qt&&(J._$.range=[r[r.length-(Y||1)].range[0],r[r.length-1].range[1]]),mt=this.performAction.apply(J,[c,X,U,W.yy,N[1],_,r].concat(Tt)),typeof mt<"u")return mt;Y&&(n=n.slice(0,-1*Y*2),_=_.slice(0,-1*Y),r=r.slice(0,-1*Y)),n.push(this.productions_[N[1]][0]),_.push(J.$),r.push(J._$),Ot=Z[n[n.length-2]][n[n.length-1]],n.push(Ot);break;case 3:return!0}}return!0},"parse")},qt=(function(){var V={EOF:1,parseError:f(function(h,n){if(this.yy.parser)this.yy.parser.parseError(h,n);else throw new Error(h)},"parseError"),setInput:f(function(l,h){return this.yy=h||this.yy||{},this._input=l,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:f(function(){var l=this._input[0];this.yytext+=l,this.yyleng++,this.offset++,this.match+=l,this.matched+=l;var h=l.match(/(?:\r\n?|\n).*/g);return h?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),l},"input"),unput:f(function(l){var h=l.length,n=l.split(/(?:\r\n?|\n)/g);this._input=l+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-h),this.offset-=h;var g=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===g.length?this.yylloc.first_column:0)+g[g.length-n.length].length-n[0].length:this.yylloc.first_column-h},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-h]),this.yyleng=this.yytext.length,this},"unput"),more:f(function(){return this._more=!0,this},"more"),reject:f(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
+`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:f(function(l){this.unput(this.match.slice(l))},"less"),pastInput:f(function(){var l=this.matched.substr(0,this.matched.length-this.match.length);return(l.length>20?"...":"")+l.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:f(function(){var l=this.match;return l.length<20&&(l+=this._input.substr(0,20-l.length)),(l.substr(0,20)+(l.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:f(function(){var l=this.pastInput(),h=new Array(l.length+1).join("-");return l+this.upcomingInput()+`
+`+h+"^"},"showPosition"),test_match:f(function(l,h){var n,g,_;if(this.options.backtrack_lexer&&(_={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(_.yylloc.range=this.yylloc.range.slice(0))),g=l[0].match(/(?:\r\n?|\n).*/g),g&&(this.yylineno+=g.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:g?g[g.length-1].length-g[g.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+l[0].length},this.yytext+=l[0],this.match+=l[0],this.matches=l,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(l[0].length),this.matched+=l[0],n=this.performAction.call(this,this.yy,this,h,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var r in _)this[r]=_[r];return!1}return!1},"test_match"),next:f(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var l,h,n,g;this._more||(this.yytext="",this.match="");for(var _=this._currentRules(),r=0;r<_.length;r++)if(n=this._input.match(this.rules[_[r]]),n&&(!h||n[0].length>h[0].length)){if(h=n,g=r,this.options.backtrack_lexer){if(l=this.test_match(n,_[r]),l!==!1)return l;if(this._backtrack){h=!1;continue}else return!1}else if(!this.options.flex)break}return h?(l=this.test_match(h,_[g]),l!==!1?l:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
+`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:f(function(){var h=this.next();return h||this.lex()},"lex"),begin:f(function(h){this.conditionStack.push(h)},"begin"),popState:f(function(){var h=this.conditionStack.length-1;return h>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:f(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:f(function(h){return h=this.conditionStack.length-1-Math.abs(h||0),h>=0?this.conditionStack[h]:"INITIAL"},"topState"),pushState:f(function(h){this.begin(h)},"pushState"),stateStackSize:f(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:f(function(h,n,g,_){switch(g){case 0:return 38;case 1:return 40;case 2:return 39;case 3:return 44;case 4:return 51;case 5:return 52;case 6:return 53;case 7:return 54;case 8:break;case 9:break;case 10:return 5;case 11:break;case 12:break;case 13:break;case 14:break;case 15:return this.pushState("SCALE"),17;case 16:return 18;case 17:this.popState();break;case 18:return this.begin("acc_title"),33;case 19:return this.popState(),"acc_title_value";case 20:return this.begin("acc_descr"),35;case 21:return this.popState(),"acc_descr_value";case 22:this.begin("acc_descr_multiline");break;case 23:this.popState();break;case 24:return"acc_descr_multiline_value";case 25:return this.pushState("CLASSDEF"),41;case 26:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";case 27:return this.popState(),this.pushState("CLASSDEFID"),42;case 28:return this.popState(),43;case 29:return this.pushState("CLASS"),48;case 30:return this.popState(),this.pushState("CLASS_STYLE"),49;case 31:return this.popState(),50;case 32:return this.pushState("STYLE"),45;case 33:return this.popState(),this.pushState("STYLEDEF_STYLES"),46;case 34:return this.popState(),47;case 35:return this.pushState("SCALE"),17;case 36:return 18;case 37:this.popState();break;case 38:this.pushState("STATE");break;case 39:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),25;case 40:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),26;case 41:return this.popState(),n.yytext=n.yytext.slice(0,-10).trim(),27;case 42:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),25;case 43:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),26;case 44:return this.popState(),n.yytext=n.yytext.slice(0,-10).trim(),27;case 45:return 51;case 46:return 52;case 47:return 53;case 48:return 54;case 49:this.pushState("STATE_STRING");break;case 50:return this.pushState("STATE_ID"),"AS";case 51:return this.popState(),"ID";case 52:this.popState();break;case 53:return"STATE_DESCR";case 54:return 19;case 55:this.popState();break;case 56:return this.popState(),this.pushState("struct"),20;case 57:break;case 58:return this.popState(),21;case 59:break;case 60:return this.begin("NOTE"),29;case 61:return this.popState(),this.pushState("NOTE_ID"),59;case 62:return this.popState(),this.pushState("NOTE_ID"),60;case 63:this.popState(),this.pushState("FLOATING_NOTE");break;case 64:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";case 65:break;case 66:return"NOTE_TEXT";case 67:return this.popState(),"ID";case 68:return this.popState(),this.pushState("NOTE_TEXT"),24;case 69:return this.popState(),n.yytext=n.yytext.substr(2).trim(),31;case 70:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),31;case 71:return 6;case 72:return 6;case 73:return 16;case 74:return 57;case 75:return 24;case 76:return n.yytext=n.yytext.trim(),14;case 77:return 15;case 78:return 28;case 79:return 58;case 80:return 5;case 81:return"INVALID"}},"anonymous"),rules:[/^(?:click\b)/i,/^(?:href\b)/i,/^(?:"[^"]*")/i,/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:style\s+)/i,/^(?:[\w,]+\s+)/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:(?:[^:\n;]|:[^:\n;])+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[12,13],inclusive:!1},struct:{rules:[12,13,25,29,32,38,45,46,47,48,57,58,59,60,74,75,76,77,78,79],inclusive:!1},FLOATING_NOTE_ID:{rules:[67],inclusive:!1},FLOATING_NOTE:{rules:[64,65,66],inclusive:!1},NOTE_TEXT:{rules:[69,70],inclusive:!1},NOTE_ID:{rules:[68],inclusive:!1},NOTE:{rules:[61,62,63],inclusive:!1},STYLEDEF_STYLEOPTS:{rules:[],inclusive:!1},STYLEDEF_STYLES:{rules:[34],inclusive:!1},STYLE_IDS:{rules:[],inclusive:!1},STYLE:{rules:[33],inclusive:!1},CLASS_STYLE:{rules:[31],inclusive:!1},CLASS:{rules:[30],inclusive:!1},CLASSDEFID:{rules:[28],inclusive:!1},CLASSDEF:{rules:[26,27],inclusive:!1},acc_descr_multiline:{rules:[23,24],inclusive:!1},acc_descr:{rules:[21],inclusive:!1},acc_title:{rules:[19],inclusive:!1},SCALE:{rules:[16,17,36,37],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[51],inclusive:!1},STATE_STRING:{rules:[52,53],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[12,13,39,40,41,42,43,44,49,50,54,55,56],inclusive:!1},ID:{rules:[12,13],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,13,14,15,18,20,22,25,29,32,35,38,56,60,71,72,73,74,75,76,77,79,80,81],inclusive:!0}}};return V})();gt.lexer=qt;function ht(){this.yy={}}return f(ht,"Parser"),ht.prototype=gt,gt.Parser=ht,new ht})();vt.parser=vt;var Ye=vt,de="TB",Bt="TB",Rt="dir",Q="state",q="root",Ct="relation",fe="classDef",pe="style",Se="applyClass",it="default",Gt="divider",Yt="fill:none",Vt="fill: #333",Mt="c",Ut="markdown",Wt="normal",kt="rect",Dt="rectWithTitle",ye="stateStart",ge="stateEnd",It="divider",Nt="roundedWithTitle",Te="note",Ee="noteGroup",rt="statediagram",_e="state",me=`${rt}-${_e}`,jt="transition",be="note",ke="note-edge",De=`${jt} ${ke}`,ve=`${rt}-${be}`,Ce="cluster",Ae=`${rt}-${Ce}`,xe="cluster-alt",Le=`${rt}-${xe}`,Ht="parent",zt="note",Oe="state",At="----",Re=`${At}${zt}`,wt=`${At}${Ht}`,Kt=f((t,e=Bt)=>{if(!t.doc)return e;let s=e;for(const a of t.doc)a.stmt==="dir"&&(s=a.value);return s},"getDir"),Ie=f(function(t,e){return e.db.getClasses()},"getClasses"),Ne=f(async function(t,e,s,a){b.info("REF0:"),b.info("Drawing state diagram (v2)",e);const{securityLevel:i,state:o,layout:u}=F();a.db.extract(a.db.getRootDocV2());const p=a.db.getData(),S=te(e,i);p.type=a.type,p.layoutAlgorithm=u,p.nodeSpacing=(o==null?void 0:o.nodeSpacing)||50,p.rankSpacing=(o==null?void 0:o.rankSpacing)||50,F().look==="neo"?p.markers=["barbNeo"]:p.markers=["barb"],p.diagramId=e,await se(p,S);const E=8;try{(typeof a.db.getLinks=="function"?a.db.getLinks():new Map).forEach((L,v)=>{var B;const O=typeof v=="string"?v:typeof(v==null?void 0:v.id)=="string"?v.id:"";if(!O){b.warn("⚠️ Invalid or missing stateId from key:",JSON.stringify(v));return}const w=(B=S.node())==null?void 0:B.querySelectorAll("g");let C;if(w==null||w.forEach(I=>{var P;((P=I.textContent)==null?void 0:P.trim())===O&&(C=I)}),!C){b.warn("⚠️ Could not find node matching text:",O);return}const d=C.parentNode;if(!d){b.warn("⚠️ Node has no parent, cannot wrap:",O);return}const D=document.createElementNS("http://www.w3.org/2000/svg","a"),$=L.url.replace(/^"+|"+$/g,"");if(D.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",$),D.setAttribute("target","_blank"),L.tooltip){const I=L.tooltip.replace(/^"+|"+$/g,"");D.setAttribute("title",I)}d.replaceChild(D,C),D.appendChild(C),b.info("🔗 Wrapped node in tag for:",O,L.url)})}catch(m){b.error("❌ Error injecting clickable links:",m)}ie.insertTitle(S,"statediagramTitleText",(o==null?void 0:o.titleTopMargin)??25,a.db.getDiagramTitle()),ee(S,E,rt,(o==null?void 0:o.useMaxWidth)??!0)},"draw"),Ve={getClasses:Ie,draw:Ne,getDir:Kt},St=new Map,M=0;function yt(t="",e=0,s="",a=At){const i=s!==null&&s.length>0?`${a}${s}`:"";return`${Oe}-${t}${i}-${e}`}f(yt,"stateDomId");var we=f((t,e,s,a,i,o,u,p)=>{b.trace("items",e),e.forEach(S=>{switch(S.stmt){case Q:st(t,S,s,a,i,o,u,p);break;case it:st(t,S,s,a,i,o,u,p);break;case Ct:{st(t,S.state1,s,a,i,o,u,p),st(t,S.state2,s,a,i,o,u,p);const T=u==="neo",E={id:"edge"+M,start:S.state1.id,end:S.state2.id,arrowhead:"normal",arrowTypeEnd:T?"arrow_barb_neo":"arrow_barb",style:Yt,labelStyle:"",label:H.sanitizeText(S.description??"",F()),arrowheadStyle:Vt,labelpos:Mt,labelType:Ut,thickness:Wt,classes:jt,look:u};i.push(E),M++}break}})},"setupDoc"),$t=f((t,e=Bt)=>{let s=e;if(t.doc)for(const a of t.doc)a.stmt==="dir"&&(s=a.value);return s},"getDir");function et(t,e,s){if(!e.id||e.id===" "||e.id==="")return;e.cssClasses&&(Array.isArray(e.cssCompiledStyles)||(e.cssCompiledStyles=[]),e.cssClasses.split(" ").forEach(i=>{const o=s.get(i);o&&(e.cssCompiledStyles=[...e.cssCompiledStyles??[],...o.styles])}));const a=t.find(i=>i.id===e.id);a?Object.assign(a,e):t.push(e)}f(et,"insertOrUpdateNode");function Xt(t){var e;return((e=t==null?void 0:t.classes)==null?void 0:e.join(" "))??""}f(Xt,"getClassesFromDbInfo");function Jt(t){return(t==null?void 0:t.styles)??[]}f(Jt,"getStylesFromDbInfo");var st=f((t,e,s,a,i,o,u,p)=>{var v,O,w;const S=e.id,T=s.get(S),E=Xt(T),m=Jt(T),L=F();if(b.info("dataFetcher parsedItem",e,T,m),S!=="root"){let C=kt;e.start===!0?C=ye:e.start===!1&&(C=ge),e.type!==it&&(C=e.type),St.get(S)||St.set(S,{id:S,shape:C,description:H.sanitizeText(S,L),cssClasses:`${E} ${me}`,cssStyles:m});const d=St.get(S);e.description&&(Array.isArray(d.description)?(d.shape=Dt,d.description.push(e.description)):(v=d.description)!=null&&v.length&&d.description.length>0?(d.shape=Dt,d.description===S?d.description=[e.description]:d.description=[d.description,e.description]):(d.shape=kt,d.description=e.description),d.description=H.sanitizeTextOrArray(d.description,L)),((O=d.description)==null?void 0:O.length)===1&&d.shape===Dt&&(d.type==="group"?d.shape=Nt:d.shape=kt),!d.type&&e.doc&&(b.info("Setting cluster for XCX",S,$t(e)),d.type="group",d.isGroup=!0,d.dir=$t(e),d.shape=e.type===Gt?It:Nt,d.cssClasses=`${d.cssClasses} ${Ae} ${o?Le:""}`);const D={labelStyle:"",shape:d.shape,label:d.description,cssClasses:d.cssClasses,cssCompiledStyles:[],cssStyles:d.cssStyles,id:S,dir:d.dir,domId:yt(S,M),type:d.type,isGroup:d.type==="group",padding:8,rx:10,ry:10,look:u,labelType:"markdown"};if(D.shape===It&&(D.label=""),t&&t.id!=="root"&&(b.trace("Setting node ",S," to be child of its parent ",t.id),D.parentId=t.id),D.centerLabel=!0,e.note){const $={labelStyle:"",shape:Te,label:e.note.text,labelType:"markdown",cssClasses:ve,cssStyles:[],cssCompiledStyles:[],id:S+Re+"-"+M,domId:yt(S,M,zt),type:d.type,isGroup:d.type==="group",padding:(w=L.flowchart)==null?void 0:w.padding,look:u,position:e.note.position},B=S+wt,I={labelStyle:"",shape:Ee,label:e.note.text,cssClasses:d.cssClasses,cssStyles:[],id:S+wt,domId:yt(S,M,Ht),type:"group",isGroup:!0,padding:16,look:u,position:e.note.position};M++,I.id=B,$.parentId=B,et(a,I,p),et(a,$,p),et(a,D,p);let G=S,P=$.id;e.note.position==="left of"&&(G=$.id,P=S),i.push({id:G+"-"+P,start:G,end:P,arrowhead:"none",arrowTypeEnd:"",style:Yt,labelStyle:"",classes:De,arrowheadStyle:Vt,labelpos:Mt,labelType:Ut,thickness:Wt,look:u})}else et(a,D,p)}e.doc&&(b.trace("Adding nodes children "),we(e,e.doc,s,a,i,!o,u,p))},"dataFetcher"),$e=f(()=>{St.clear(),M=0},"reset"),A={START_NODE:"[*]",START_TYPE:"start",END_NODE:"[*]",END_TYPE:"end",COLOR_KEYWORD:"color",FILL_KEYWORD:"fill",BG_FILL:"bgFill",STYLECLASS_SEP:","},Pt=f(()=>new Map,"newClassesList"),Ft=f(()=>({relations:[],states:new Map,documents:{}}),"newDoc"),pt=f(t=>JSON.parse(JSON.stringify(t)),"clone"),z,Me=(z=class{constructor(e){this.version=e,this.nodes=[],this.edges=[],this.rootDoc=[],this.classes=Pt(),this.documents={root:Ft()},this.currentDocument=this.documents.root,this.startEndCount=0,this.dividerCnt=0,this.links=new Map,this.getAccTitle=re,this.setAccTitle=ae,this.getAccDescription=ne,this.setAccDescription=le,this.setDiagramTitle=oe,this.getDiagramTitle=ce,this.clear(),this.setRootDoc=this.setRootDoc.bind(this),this.getDividerId=this.getDividerId.bind(this),this.setDirection=this.setDirection.bind(this),this.trimColon=this.trimColon.bind(this)}extract(e){this.clear(!0);for(const i of Array.isArray(e)?e:e.doc)switch(i.stmt){case Q:this.addState(i.id.trim(),i.type,i.doc,i.description,i.note);break;case Ct:this.addRelation(i.state1,i.state2,i.description);break;case fe:this.addStyleClass(i.id.trim(),i.classes);break;case pe:this.handleStyleDef(i);break;case Se:this.setCssClass(i.id.trim(),i.styleClass);break;case"click":this.addLink(i.id,i.url,i.tooltip);break}const s=this.getStates(),a=F();$e(),st(void 0,this.getRootDocV2(),s,this.nodes,this.edges,!0,a.look,this.classes);for(const i of this.nodes)if(Array.isArray(i.label)){if(i.description=i.label.slice(1),i.isGroup&&i.description.length>0)throw new Error(`Group nodes can only have label. Remove the additional description for node [${i.id}]`);i.label=i.label[0]}}handleStyleDef(e){const s=e.id.trim().split(","),a=e.styleClass.split(",");for(const i of s){let o=this.getState(i);if(!o){const u=i.trim();this.addState(u),o=this.getState(u)}o&&(o.styles=a.map(u=>{var p;return(p=u.replace(/;/g,""))==null?void 0:p.trim()}))}}setRootDoc(e){b.info("Setting root doc",e),this.rootDoc=e,this.version===1?this.extract(e):this.extract(this.getRootDocV2())}docTranslator(e,s,a){if(s.stmt===Ct){this.docTranslator(e,s.state1,!0),this.docTranslator(e,s.state2,!1);return}if(s.stmt===Q&&(s.id===A.START_NODE?(s.id=e.id+(a?"_start":"_end"),s.start=a):s.id=s.id.trim()),s.stmt!==q&&s.stmt!==Q||!s.doc)return;const i=[];let o=[];for(const u of s.doc)if(u.type===Gt){const p=pt(u);p.doc=pt(o),i.push(p),o=[]}else o.push(u);if(i.length>0&&o.length>0){const u={stmt:Q,id:he(),type:"divider",doc:pt(o)};i.push(pt(u)),s.doc=i}s.doc.forEach(u=>this.docTranslator(s,u,!0))}getRootDocV2(){return this.docTranslator({id:q,stmt:q},{id:q,stmt:q,doc:this.rootDoc},!0),{id:q,doc:this.rootDoc}}addState(e,s=it,a=void 0,i=void 0,o=void 0,u=void 0,p=void 0,S=void 0){const T=e==null?void 0:e.trim();if(!this.currentDocument.states.has(T))b.info("Adding state ",T,i),this.currentDocument.states.set(T,{stmt:Q,id:T,descriptions:[],type:s,doc:a,note:o,classes:[],styles:[],textStyles:[]});else{const E=this.currentDocument.states.get(T);if(!E)throw new Error(`State not found: ${T}`);E.doc||(E.doc=a),E.type||(E.type=s)}if(i&&(b.info("Setting state description",T,i),(Array.isArray(i)?i:[i]).forEach(m=>this.addDescription(T,m.trim()))),o){const E=this.currentDocument.states.get(T);if(!E)throw new Error(`State not found: ${T}`);E.note=o,E.note.text=H.sanitizeText(E.note.text,F())}u&&(b.info("Setting state classes",T,u),(Array.isArray(u)?u:[u]).forEach(m=>this.setCssClass(T,m.trim()))),p&&(b.info("Setting state styles",T,p),(Array.isArray(p)?p:[p]).forEach(m=>this.setStyle(T,m.trim()))),S&&(b.info("Setting state styles",T,p),(Array.isArray(S)?S:[S]).forEach(m=>this.setTextStyle(T,m.trim())))}clear(e){this.nodes=[],this.edges=[],this.documents={root:Ft()},this.currentDocument=this.documents.root,this.startEndCount=0,this.classes=Pt(),e||(this.links=new Map,ue())}getState(e){return this.currentDocument.states.get(e)}getStates(){return this.currentDocument.states}logDocuments(){b.info("Documents = ",this.documents)}getRelations(){return this.currentDocument.relations}addLink(e,s,a){this.links.set(e,{url:s,tooltip:a}),b.warn("Adding link",e,s,a)}getLinks(){return this.links}startIdIfNeeded(e=""){return e===A.START_NODE?(this.startEndCount++,`${A.START_TYPE}${this.startEndCount}`):e}startTypeIfNeeded(e="",s=it){return e===A.START_NODE?A.START_TYPE:s}endIdIfNeeded(e=""){return e===A.END_NODE?(this.startEndCount++,`${A.END_TYPE}${this.startEndCount}`):e}endTypeIfNeeded(e="",s=it){return e===A.END_NODE?A.END_TYPE:s}addRelationObjs(e,s,a=""){const i=this.startIdIfNeeded(e.id.trim()),o=this.startTypeIfNeeded(e.id.trim(),e.type),u=this.startIdIfNeeded(s.id.trim()),p=this.startTypeIfNeeded(s.id.trim(),s.type);this.addState(i,o,e.doc,e.description,e.note,e.classes,e.styles,e.textStyles),this.addState(u,p,s.doc,s.description,s.note,s.classes,s.styles,s.textStyles),this.currentDocument.relations.push({id1:i,id2:u,relationTitle:H.sanitizeText(a,F())})}addRelation(e,s,a){if(typeof e=="object"&&typeof s=="object")this.addRelationObjs(e,s,a);else if(typeof e=="string"&&typeof s=="string"){const i=this.startIdIfNeeded(e.trim()),o=this.startTypeIfNeeded(e),u=this.endIdIfNeeded(s.trim()),p=this.endTypeIfNeeded(s);this.addState(i,o),this.addState(u,p),this.currentDocument.relations.push({id1:i,id2:u,relationTitle:a?H.sanitizeText(a,F()):void 0})}}addDescription(e,s){var o;const a=this.currentDocument.states.get(e),i=s.startsWith(":")?s.replace(":","").trim():s;(o=a==null?void 0:a.descriptions)==null||o.push(H.sanitizeText(i,F()))}cleanupLabel(e){return e.startsWith(":")?e.slice(2).trim():e.trim()}getDividerId(){return this.dividerCnt++,`divider-id-${this.dividerCnt}`}addStyleClass(e,s=""){this.classes.has(e)||this.classes.set(e,{id:e,styles:[],textStyles:[]});const a=this.classes.get(e);s&&a&&s.split(A.STYLECLASS_SEP).forEach(i=>{const o=i.replace(/([^;]*);/,"$1").trim();if(RegExp(A.COLOR_KEYWORD).exec(i)){const p=o.replace(A.FILL_KEYWORD,A.BG_FILL).replace(A.COLOR_KEYWORD,A.FILL_KEYWORD);a.textStyles.push(p)}a.styles.push(o)})}getClasses(){return this.classes}setCssClass(e,s){e.split(",").forEach(a=>{var o;let i=this.getState(a);if(!i){const u=a.trim();this.addState(u),i=this.getState(u)}(o=i==null?void 0:i.classes)==null||o.push(s)})}setStyle(e,s){var a,i;(i=(a=this.getState(e))==null?void 0:a.styles)==null||i.push(s)}setTextStyle(e,s){var a,i;(i=(a=this.getState(e))==null?void 0:a.textStyles)==null||i.push(s)}getDirectionStatement(){return this.rootDoc.find(e=>e.stmt===Rt)}getDirection(){var e;return((e=this.getDirectionStatement())==null?void 0:e.value)??de}setDirection(e){const s=this.getDirectionStatement();s?s.value=e:this.rootDoc.unshift({stmt:Rt,value:e})}trimColon(e){return e.startsWith(":")?e.slice(1).trim():e.trim()}getData(){const e=F();return{nodes:this.nodes,edges:this.edges,other:{},config:e,direction:Kt(this.getRootDocV2())}}getConfig(){return F().state}},f(z,"StateDB"),z.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3},z),Pe=f(t=>`
+defs [id$="-barbEnd"] {
+ fill: ${t.transitionColor};
+ stroke: ${t.transitionColor};
+ }
+g.stateGroup text {
+ fill: ${t.nodeBorder};
+ stroke: none;
+ font-size: 10px;
+}
+g.stateGroup text {
+ fill: ${t.textColor};
+ stroke: none;
+ font-size: 10px;
+
+}
+g.stateGroup .state-title {
+ font-weight: bolder;
+ fill: ${t.stateLabelColor};
+}
+
+g.stateGroup rect {
+ fill: ${t.mainBkg};
+ stroke: ${t.nodeBorder};
+}
+
+g.stateGroup line {
+ stroke: ${t.lineColor};
+ stroke-width: ${t.strokeWidth||1};
+}
+
+.transition {
+ stroke: ${t.transitionColor};
+ stroke-width: ${t.strokeWidth||1};
+ fill: none;
+}
+
+.stateGroup .composit {
+ fill: ${t.background};
+ border-bottom: 1px
+}
+
+.stateGroup .alt-composit {
+ fill: #e0e0e0;
+ border-bottom: 1px
+}
+
+.state-note {
+ stroke: ${t.noteBorderColor};
+ fill: ${t.noteBkgColor};
+
+ text {
+ fill: ${t.noteTextColor};
+ stroke: none;
+ font-size: 10px;
+ }
+}
+
+.stateLabel .box {
+ stroke: none;
+ stroke-width: 0;
+ fill: ${t.mainBkg};
+ opacity: 0.5;
+}
+
+.edgeLabel .label rect {
+ fill: ${t.labelBackgroundColor};
+ opacity: 0.5;
+}
+.edgeLabel {
+ background-color: ${t.edgeLabelBackground};
+ p {
+ background-color: ${t.edgeLabelBackground};
+ }
+ rect {
+ opacity: 0.5;
+ background-color: ${t.edgeLabelBackground};
+ fill: ${t.edgeLabelBackground};
+ }
+ text-align: center;
+}
+.edgeLabel .label text {
+ fill: ${t.transitionLabelColor||t.tertiaryTextColor};
+}
+.label div .edgeLabel {
+ color: ${t.transitionLabelColor||t.tertiaryTextColor};
+}
+
+.stateLabel text {
+ fill: ${t.stateLabelColor};
+ font-size: 10px;
+ font-weight: bold;
+}
+
+.node circle.state-start {
+ fill: ${t.specialStateColor};
+ stroke: ${t.specialStateColor};
+}
+
+.node .fork-join {
+ fill: ${t.specialStateColor};
+ stroke: ${t.specialStateColor};
+}
+
+.node circle.state-end {
+ fill: ${t.innerEndBackground};
+ stroke: ${t.background};
+ stroke-width: 1.5
+}
+.end-state-inner {
+ fill: ${t.compositeBackground||t.background};
+ // stroke: ${t.background};
+ stroke-width: 1.5
+}
+
+.node rect {
+ fill: ${t.stateBkg||t.mainBkg};
+ stroke: ${t.stateBorder||t.nodeBorder};
+ stroke-width: ${t.strokeWidth||1}px;
+}
+.node polygon {
+ fill: ${t.mainBkg};
+ stroke: ${t.stateBorder||t.nodeBorder};;
+ stroke-width: ${t.strokeWidth||1}px;
+}
+[id$="-barbEnd"] {
+ fill: ${t.lineColor};
+}
+
+.statediagram-cluster rect {
+ fill: ${t.compositeTitleBackground};
+ stroke: ${t.stateBorder||t.nodeBorder};
+ stroke-width: ${t.strokeWidth||1}px;
+}
+
+.cluster-label, .nodeLabel {
+ color: ${t.stateLabelColor};
+ // line-height: 1;
+}
+
+.statediagram-cluster rect.outer {
+ rx: 5px;
+ ry: 5px;
+}
+.statediagram-state .divider {
+ stroke: ${t.stateBorder||t.nodeBorder};
+}
+
+.statediagram-state .title-state {
+ rx: 5px;
+ ry: 5px;
+}
+.statediagram-cluster.statediagram-cluster .inner {
+ fill: ${t.compositeBackground||t.background};
+}
+.statediagram-cluster.statediagram-cluster-alt .inner {
+ fill: ${t.altBackground?t.altBackground:"#efefef"};
+}
+
+.statediagram-cluster .inner {
+ rx:0;
+ ry:0;
+}
+
+.statediagram-state rect.basic {
+ rx: 5px;
+ ry: 5px;
+}
+.statediagram-state rect.divider {
+ stroke-dasharray: 10,10;
+ fill: ${t.altBackground?t.altBackground:"#efefef"};
+}
+
+.note-edge {
+ stroke-dasharray: 5;
+}
+
+.statediagram-note rect {
+ fill: ${t.noteBkgColor};
+ stroke: ${t.noteBorderColor};
+ stroke-width: 1px;
+ rx: 0;
+ ry: 0;
+}
+.statediagram-note rect {
+ fill: ${t.noteBkgColor};
+ stroke: ${t.noteBorderColor};
+ stroke-width: 1px;
+ rx: 0;
+ ry: 0;
+}
+
+.statediagram-note text {
+ fill: ${t.noteTextColor};
+}
+
+.statediagram-note .nodeLabel {
+ color: ${t.noteTextColor};
+}
+.statediagram .edgeLabel {
+ color: red; // ${t.noteTextColor};
+}
+
+[id$="-dependencyStart"], [id$="-dependencyEnd"] {
+ fill: ${t.lineColor};
+ stroke: ${t.lineColor};
+ stroke-width: ${t.strokeWidth||1};
+}
+
+.statediagramTitleText {
+ text-anchor: middle;
+ font-size: 18px;
+ fill: ${t.textColor};
+}
+
+[data-look="neo"].statediagram-cluster rect {
+ fill: ${t.mainBkg};
+ stroke: ${t.useGradient?"url("+t.svgId+"-gradient)":t.stateBorder||t.nodeBorder};
+ stroke-width: ${t.strokeWidth??1};
+}
+[data-look="neo"].statediagram-cluster rect.outer {
+ rx: ${t.radius}px;
+ ry: ${t.radius}px;
+ filter: ${t.dropShadow?t.dropShadow.replace("url(#drop-shadow)",`url(${t.svgId}-drop-shadow)`):"none"}
+}
+`,"getStyles"),Ue=Pe;export{Me as S,Ye as a,Ve as b,Ue as s};
diff --git a/dist-desktop/assets/chunk-QZHKN3VN-BFI20CEN.js b/dist-desktop/assets/chunk-QZHKN3VN-BFI20CEN.js
new file mode 100644
index 0000000..8bfe545
--- /dev/null
+++ b/dist-desktop/assets/chunk-QZHKN3VN-BFI20CEN.js
@@ -0,0 +1 @@
+import{_ as s}from"./mermaid.core-DD7RPEfx.js";var t,e=(t=class{constructor(i){this.init=i,this.records=this.init()}reset(){this.records=this.init()}},s(t,"ImperativeState"),t);export{e as I};
diff --git a/dist-desktop/assets/chunk-YZCP3GAM-Blce-T0j.js b/dist-desktop/assets/chunk-YZCP3GAM-Blce-T0j.js
new file mode 100644
index 0000000..3cde1d9
--- /dev/null
+++ b/dist-desktop/assets/chunk-YZCP3GAM-Blce-T0j.js
@@ -0,0 +1 @@
+import{_ as i,d as l,U as d,j as o}from"./mermaid.core-DD7RPEfx.js";var x=i((r,t)=>{const e=r.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx&&e.attr("rx",t.rx),t.ry&&e.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)e.attr(s,t.attrs[s]);return t.class&&e.attr("class",t.class),e},"drawRect"),p=i((r,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};x(r,e).lower()},"drawBackgroundRect"),y=i((r,t)=>{const e=t.text.replace(d," "),s=r.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const a=s.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.text(e),s},"drawText"),m=i((r,t,e,s)=>{const a=r.append("image");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",n)},"drawImage"),g=i((r,t,e,s)=>{const a=r.append("use");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),h=i(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),f=i(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),w=i(()=>{let r=l(".mermaidTooltip");return r.empty()&&(r=l("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),r},"createTooltip");export{p as a,f as b,w as c,x as d,g as e,m as f,h as g,y as h};
diff --git a/dist-desktop/assets/classDiagram-6PBFFD2Q-vWrFBNY5.js b/dist-desktop/assets/classDiagram-6PBFFD2Q-vWrFBNY5.js
new file mode 100644
index 0000000..2a81860
--- /dev/null
+++ b/dist-desktop/assets/classDiagram-6PBFFD2Q-vWrFBNY5.js
@@ -0,0 +1 @@
+import{s as a,c as s,a as e,C as t}from"./chunk-4TB4RGXK-D8YpqJC4.js";import{_ as i}from"./mermaid.core-DD7RPEfx.js";import"./chunk-FMBD7UC4-TatyaWoN.js";import"./chunk-YZCP3GAM-Blce-T0j.js";import"./chunk-55IACEB6-D6svk_zs.js";import"./chunk-EDXVE4YY-D2oMcFeR.js";import"./index-jkhvCyNw.js";var n={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{n as diagram};
diff --git a/dist-desktop/assets/classDiagram-v2-HSJHXN6E-vWrFBNY5.js b/dist-desktop/assets/classDiagram-v2-HSJHXN6E-vWrFBNY5.js
new file mode 100644
index 0000000..2a81860
--- /dev/null
+++ b/dist-desktop/assets/classDiagram-v2-HSJHXN6E-vWrFBNY5.js
@@ -0,0 +1 @@
+import{s as a,c as s,a as e,C as t}from"./chunk-4TB4RGXK-D8YpqJC4.js";import{_ as i}from"./mermaid.core-DD7RPEfx.js";import"./chunk-FMBD7UC4-TatyaWoN.js";import"./chunk-YZCP3GAM-Blce-T0j.js";import"./chunk-55IACEB6-D6svk_zs.js";import"./chunk-EDXVE4YY-D2oMcFeR.js";import"./index-jkhvCyNw.js";var n={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{n as diagram};
diff --git a/dist-desktop/assets/clone-DL0QTDot.js b/dist-desktop/assets/clone-DL0QTDot.js
new file mode 100644
index 0000000..7e8ef8d
--- /dev/null
+++ b/dist-desktop/assets/clone-DL0QTDot.js
@@ -0,0 +1 @@
+import{b as r}from"./graph-C_fMmQpx.js";var e=4;function a(o){return r(o,e)}export{a as c};
diff --git a/dist-desktop/assets/cose-bilkent-S5V4N54A-DA7lnOJ3.js b/dist-desktop/assets/cose-bilkent-S5V4N54A-DA7lnOJ3.js
new file mode 100644
index 0000000..8bed26d
--- /dev/null
+++ b/dist-desktop/assets/cose-bilkent-S5V4N54A-DA7lnOJ3.js
@@ -0,0 +1 @@
+import{_ as V,l as $,d as lt}from"./mermaid.core-DD7RPEfx.js";import{c as tt}from"./cytoscape.esm-D_LviqZs.js";import{g as gt}from"./index-jkhvCyNw.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;vh&&(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-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;sD&&(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;my&&(v=y),Ds&&(u=s),Ey&&(v=y),Ds&&(u=s),E=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=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]r)return l[0]=g,l[1]=a,l[2]=d,l[3]=L,!1;if(nd)return l[0]=h,l[1]=n,l[2]=f,l[3]=r,!1;if(gd?(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)),l0?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"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);p0&&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-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;u0){for(var D=this.edgeToDummyNodes.get(v),u=0;u=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);ht.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;a0&&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;ay||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=u.length||y>=u[0].length)){for(var O=0;On}}]),l})();N.exports=i}),(function(N,I,T){var o=(function(){function i(l,g){for(var n=0;n2&&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=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;lg.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;h0)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;c1){var R;for(R=0;RL&&(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;C1;){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;cf&&(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"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=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;A0)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;LM&&(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.height0&&(C+=s.horizontalPadding),s.rowWidth[c]=C,s.width0&&(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;Lc&&(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]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.widthm&&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;RC&&(C=L[R].height);f>0&&(C+=s.verticalPadding);var M=s.rowHeight[f]+s.rowHeight[c];s.rowHeight[f]=C,s.rowHeight[c]0)for(var F=A;F<=m;F++)x[0]+=this.grid[F][C-1].length+this.grid[F][C].length-1;if(m0)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;X0){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=gt(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=lt("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"),Nt=Lt;export{Nt as render};
diff --git a/dist-desktop/assets/cytoscape.esm-D_LviqZs.js b/dist-desktop/assets/cytoscape.esm-D_LviqZs.js
new file mode 100644
index 0000000..b0f3dab
--- /dev/null
+++ b/dist-desktop/assets/cytoscape.esm-D_LviqZs.js
@@ -0,0 +1,331 @@
+function ks(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,a=Array(e);t=r.length?{done:!0}:{done:!1,value:r[a++]}},e:function(u){throw u},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,s=!0,o=!1;return{s:function(){t=t.call(r)},n:function(){var u=t.next();return s=u.done,u},e:function(u){o=!0,i=u},f:function(){try{s||t.return==null||t.return()}finally{if(o)throw i}}}}function Zl(r,e,t){return(e=Ql(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tc(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function ac(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var a,n,i,s,o=[],u=!0,l=!1;try{if(i=(t=t.call(r)).next,e===0){if(Object(t)!==t)return;u=!1}else for(;!(u=(a=i.call(t)).done)&&(o.push(a.value),o.length!==e);u=!0);}catch(v){l=!0,n=v}finally{try{if(!u&&t.return!=null&&(s=t.return(),Object(s)!==s))return}finally{if(l)throw n}}return o}}function nc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ic(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qe(r,e){return jf(r)||ac(r,e)||Us(r,e)||nc()}function pn(r){return ec(r)||tc(r)||Us(r)||ic()}function sc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var a=t.call(r,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function Ql(r){var e=sc(r,"string");return typeof e=="symbol"?e:e+""}function rr(r){"@babel/helpers - typeof";return rr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rr(r)}function Us(r,e){if(r){if(typeof r=="string")return ks(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ks(r,e):void 0}}var je=typeof window>"u"?null:window,Eo=je?je.navigator:null;je&&je.document;var oc=rr(""),Jl=rr({}),uc=rr(function(){}),lc=typeof HTMLElement>"u"?"undefined":rr(HTMLElement),Ra=function(e){return e&&e.instanceString&&$e(e.instanceString)?e.instanceString():null},he=function(e){return e!=null&&rr(e)==oc},$e=function(e){return e!=null&&rr(e)===uc},Ve=function(e){return!Tr(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Me=function(e){return e!=null&&rr(e)===Jl&&!Ve(e)&&e.constructor===Object},vc=function(e){return e!=null&&rr(e)===Jl},ae=function(e){return e!=null&&rr(e)===rr(1)&&!isNaN(e)},fc=function(e){return ae(e)&&Math.floor(e)===e},yn=function(e){if(lc!=="undefined")return e!=null&&e instanceof HTMLElement},Tr=function(e){return Ma(e)||jl(e)},Ma=function(e){return Ra(e)==="collection"&&e._private.single},jl=function(e){return Ra(e)==="collection"&&!e._private.single},Ks=function(e){return Ra(e)==="core"},ev=function(e){return Ra(e)==="stylesheet"},cc=function(e){return Ra(e)==="event"},ot=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},dc=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},hc=function(e){return Me(e)&&ae(e.x1)&&ae(e.x2)&&ae(e.y1)&&ae(e.y2)},gc=function(e){return vc(e)&&$e(e.then)},pc=function(){return Eo&&Eo.userAgent.match(/msie|trident|edge/i)},Yt=function(e,t){t||(t=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],s=0;st?1:0},Cc=function(e,t){return-1*tv(e,t)},ye=Object.assign!=null?Object.assign.bind(Object):function(r){for(var e=arguments,t=1;t1&&(g-=1),g<1/6?d+(y-d)*6*g:g<1/2?y:g<2/3?d+(y-d)*(2/3-g)*6:d}var f=new RegExp("^"+bc+"$").exec(e);if(f){if(a=parseInt(f[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(f[2]),n<0||n>100||(n=n/100,i=parseFloat(f[3]),i<0||i>100)||(i=i/100,s=f[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(n===0)o=u=l=Math.round(i*255);else{var c=i<.5?i*(1+n):i+n-i*n,h=2*i-c;o=Math.round(255*v(h,c,a+1/3)),u=Math.round(255*v(h,c,a)),l=Math.round(255*v(h,c,a-1/3))}t=[o,u,l,s]}return t},kc=function(e){var t,a=new RegExp("^"+yc+"$").exec(e);if(a){t=[];for(var n=[],i=1;i<=3;i++){var s=a[i];if(s[s.length-1]==="%"&&(n[i]=!0),s=parseFloat(s),n[i]&&(s=s/100*255),s<0||s>255)return;t.push(Math.floor(s))}var o=n[1]||n[2]||n[3],u=n[1]&&n[2]&&n[3];if(o&&!u)return;var l=a[4];if(l!==void 0){if(l=parseFloat(l),l<0||l>1)return;t.push(l)}}return t},Dc=function(e){return Bc[e.toLowerCase()]},av=function(e){return(Ve(e)?e:null)||Dc(e)||Tc(e)||kc(e)||Sc(e)},Bc={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},nv=function(e){for(var t=e.map,a=e.keys,n=a.length,i=0;i=u||R<0||m&&L>=c}function T(){var A=e();if(x(A))return k(A);d=setTimeout(T,C(A))}function k(A){return d=void 0,b&&v?w(A):(v=f=void 0,h)}function D(){d!==void 0&&clearTimeout(d),g=0,v=y=f=d=void 0}function B(){return d===void 0?h:k(e())}function P(){var A=e(),R=x(A);if(v=arguments,f=this,y=A,R){if(d===void 0)return E(y);if(m)return clearTimeout(d),d=setTimeout(T,u),w(y)}return d===void 0&&(d=setTimeout(T,u)),h}return P.cancel=D,P.flush=B,P}return li=s,li}var Fc=zc(),Na=La(Fc),vi=je?je.performance:null,ov=vi&&vi.now?function(){return vi.now()}:function(){return Date.now()},Vc=(function(){if(je){if(je.requestAnimationFrame)return function(r){je.requestAnimationFrame(r)};if(je.mozRequestAnimationFrame)return function(r){je.mozRequestAnimationFrame(r)};if(je.webkitRequestAnimationFrame)return function(r){je.webkitRequestAnimationFrame(r)};if(je.msRequestAnimationFrame)return function(r){je.msRequestAnimationFrame(r)}}return function(r){r&&setTimeout(function(){r(ov())},1e3/60)}})(),mn=function(e){return Vc(e)},Xr=ov,Ct=9261,uv=65599,_t=5381,lv=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ct,a=t,n;n=e.next(),!n.done;)a=a*uv+n.value|0;return a},xa=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ct;return t*uv+e|0},Ea=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:_t;return(t<<5)+t+e|0},qc=function(e,t){return e*2097152+t},jr=function(e){return e[0]*2097152+e[1]},Ua=function(e,t){return[xa(e[0],t[0]),Ea(e[1],t[1])]},Fo=function(e,t){var a={value:0,done:!1},n=0,i=e.length,s={next:function(){return n=0;n--)e[n]===t&&e.splice(n,1)},Js=function(e){e.splice(0,e.length)},Zc=function(e,t){for(var a=0;a"u"?"undefined":rr(Set))!==Jc?Set:jc,Mn=function(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!Ks(e)){He("An element must have a core reference and parameters set");return}var n=t.group;if(n==null&&(t.data&&t.data.source!=null&&t.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){He("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:t.selectable===void 0?!0:!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0?!0:!!t.grabbable,pannable:t.pannable===void 0?n==="edges":!!t.pannable,active:!1,classes:new jt,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),t.renderedPosition){var s=t.renderedPosition,o=e.pan(),u=e.zoom();i.position={x:(s.x-o.x)/u,y:(s.y-o.y)/u}}var l=[];Ve(t.classes)?l=t.classes:he(t.classes)&&(l=t.classes.split(/\s+/));for(var v=0,f=l.length;vm?1:0},v=function(p,m,b,w,E){var C;if(b==null&&(b=0),E==null&&(E=a),b<0)throw new Error("lo must be non-negative");for(w==null&&(w=p.length);bD;0<=D?k++:k--)T.push(k);return T}).apply(this).reverse(),x=[],w=0,E=C.length;wB;0<=B?++T:--T)P.push(s(p,b));return P},y=function(p,m,b,w){var E,C,x;for(w==null&&(w=a),E=p[b];b>m;){if(x=b-1>>1,C=p[x],w(E,C)<0){p[b]=C,b=x;continue}break}return p[b]=E},g=function(p,m,b){var w,E,C,x,T;for(b==null&&(b=a),E=p.length,T=m,C=p[m],w=2*m+1;w0;){var C=m.pop(),x=g(C),T=C.id();if(c[T]=x,x!==1/0)for(var k=C.neighborhood().intersect(d),D=0;D0)for(O.unshift(M);f[_];){var N=f[_];O.unshift(N.edge),O.unshift(N.node),q=N.node,_=q.id()}return o.spawn(O)}}}},sd={kruskal:function(e){e=e||function(b){return 1};for(var t=this.byGroup(),a=t.nodes,n=t.edges,i=a.length,s=new Array(i),o=a,u=function(w){for(var E=0;E0;){if(E(),x++,w===v){for(var T=[],k=i,D=v,B=p[D];T.unshift(k),B!=null&&T.unshift(B),k=g[D],k!=null;)D=k.id(),B=p[D];return{found:!0,distance:f[w],path:this.spawn(T),steps:x}}h[w]=!0;for(var P=b._private.edges,A=0;AB&&(d[D]=B,m[D]=k,b[D]=E),!i){var P=k*v+T;!i&&d[P]>B&&(d[P]=B,m[P]=T,b[P]=E)}}}for(var A=0;A1&&arguments[1]!==void 0?arguments[1]:s,se=b(me),de=[],fe=se;;){if(fe==null)return t.spawn();var xe=m(fe),be=xe.edge,Se=xe.pred;if(de.unshift(fe[0]),fe.same(ge)&&de.length>0)break;be!=null&&de.unshift(be),fe=Se}return u.spawn(de)},C=0;C=0;v--){var f=l[v],c=f[1],h=f[2];(t[c]===o&&t[h]===u||t[c]===u&&t[h]===o)&&l.splice(v,1)}for(var d=0;dn;){var i=Math.floor(Math.random()*t.length);t=hd(i,e,t),a--}return t},gd={kargerStein:function(){var e=this,t=this.byGroup(),a=t.nodes,n=t.edges;n.unmergeBy(function(O){return O.isLoop()});var i=a.length,s=n.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),u=Math.floor(i/dd);if(i<2){He("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],v=0;v1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=t;i1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,i=t;i1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=0,i=0,s=t;s1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(t,a):(a0&&e.splice(0,t));for(var o=0,u=e.length-1;u>=0;u--){var l=e[u];s?isFinite(l)||(e[u]=-1/0,o++):e.splice(u,1)}i&&e.sort(function(c,h){return c-h});var v=e.length,f=Math.floor(v/2);return v%2!==0?e[f+1+o]:(e[f-1+o]+e[f+o])/2},xd=function(e){return Math.PI*e/180},Ka=function(e,t){return Math.atan2(t,e)-Math.PI/2},js=Math.log2||function(r){return Math.log(r)/Math.log(2)},eo=function(e){return e>0?1:e<0?-1:0},Dt=function(e,t){return Math.sqrt(xt(e,t))},xt=function(e,t){var a=t.x-e.x,n=t.y-e.y;return a*a+n*n},Ed=function(e){for(var t=e.length,a=0,n=0;n=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Td=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Sd=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},kd=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},pv=function(e,t,a){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},sn=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},on=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,s;if(t.length===1)a=n=i=s=t[0];else if(t.length===2)a=i=t[0],s=n=t[1];else if(t.length===4){var o=Qe(t,4);a=o[0],n=o[1],i=o[2],s=o[3]}return e.x1-=s,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Wo=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},ro=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2t.y2||t.y1>e.y2)},at=function(e,t,a){return e.x1<=t&&t<=e.x2&&e.y1<=a&&a<=e.y2},$o=function(e,t){return at(e,t.x,t.y)},yv=function(e,t){return at(e,t.x1,t.y1)&&at(e,t.x2,t.y2)},Dd=(di=Math.hypot)!==null&&di!==void 0?di:function(r,e){return Math.sqrt(r*r+e*e)};function Bd(r,e){if(r.length<3)throw new Error("Need at least 3 vertices");var t=function(T,k){return{x:T.x+k.x,y:T.y+k.y}},a=function(T,k){return{x:T.x-k.x,y:T.y-k.y}},n=function(T,k){return{x:T.x*k,y:T.y*k}},i=function(T,k){return T.x*k.y-T.y*k.x},s=function(T){var k=Dd(T.x,T.y);return k===0?{x:0,y:0}:{x:T.x/k,y:T.y/k}},o=function(T){for(var k=0,D=0;D7&&arguments[7]!==void 0?arguments[7]:"auto",l=u==="auto"?lt(i,s):u,v=i/2,f=s/2;l=Math.min(l,v,f);var c=l!==v,h=l!==f,d;if(c){var y=a-v+l-o,g=n-f-o,p=a+v-l+o,m=g;if(d=nt(e,t,a,n,y,g,p,m,!1),d.length>0)return d}if(h){var b=a+v+o,w=n-f+l-o,E=b,C=n+f-l+o;if(d=nt(e,t,a,n,b,w,E,C,!1),d.length>0)return d}if(c){var x=a-v+l-o,T=n+f+o,k=a+v-l+o,D=T;if(d=nt(e,t,a,n,x,T,k,D,!1),d.length>0)return d}if(h){var B=a-v-o,P=n-f+l-o,A=B,R=n+f-l+o;if(d=nt(e,t,a,n,B,P,A,R,!1),d.length>0)return d}var L;{var I=a-v+l,M=n-f+l;if(L=ga(e,t,a,n,I,M,l+o),L.length>0&&L[0]<=I&&L[1]<=M)return[L[0],L[1]]}{var O=a+v-l,q=n-f+l;if(L=ga(e,t,a,n,O,q,l+o),L.length>0&&L[0]>=O&&L[1]<=q)return[L[0],L[1]]}{var _=a+v-l,N=n+f-l;if(L=ga(e,t,a,n,_,N,l+o),L.length>0&&L[0]>=_&&L[1]>=N)return[L[0],L[1]]}{var F=a-v+l,U=n+f-l;if(L=ga(e,t,a,n,F,U,l+o),L.length>0&&L[0]<=F&&L[1]>=U)return[L[0],L[1]]}return[]},Ad=function(e,t,a,n,i,s,o){var u=o,l=Math.min(a,i),v=Math.max(a,i),f=Math.min(n,s),c=Math.max(n,s);return l-u<=e&&e<=v+u&&f-u<=t&&t<=c+u},Rd=function(e,t,a,n,i,s,o,u,l){var v={x1:Math.min(a,o,i)-l,x2:Math.max(a,o,i)+l,y1:Math.min(n,u,s)-l,y2:Math.max(n,u,s)+l};return!(ev.x2||tv.y2)},Md=function(e,t,a,n){a-=n;var i=t*t-4*e*a;if(i<0)return[];var s=Math.sqrt(i),o=2*e,u=(-t+s)/o,l=(-t-s)/o;return[u,l]},Ld=function(e,t,a,n,i){var s=1e-5;e===0&&(e=s),t/=e,a/=e,n/=e;var o,u,l,v,f,c,h,d;if(u=(3*a-t*t)/9,l=-(27*n)+t*(9*a-2*(t*t)),l/=54,o=u*u*u+l*l,i[1]=0,h=t/3,o>0){f=l+Math.sqrt(o),f=f<0?-Math.pow(-f,1/3):Math.pow(f,1/3),c=l-Math.sqrt(o),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+f+c,h+=(f+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+f)/2,i[3]=h,i[5]=-h;return}if(i[5]=i[3]=0,o===0){d=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),i[0]=-h+2*d,i[4]=i[2]=-(d+h);return}u=-u,v=u*u*u,v=Math.acos(l/Math.sqrt(v)),d=2*Math.sqrt(u),i[0]=-h+d*Math.cos(v/3),i[2]=-h+d*Math.cos((v+2*Math.PI)/3),i[4]=-h+d*Math.cos((v+4*Math.PI)/3)},Id=function(e,t,a,n,i,s,o,u){var l=1*a*a-4*a*i+2*a*o+4*i*i-4*i*o+o*o+n*n-4*n*s+2*n*u+4*s*s-4*s*u+u*u,v=9*a*i-3*a*a-3*a*o-6*i*i+3*i*o+9*n*s-3*n*n-3*n*u-6*s*s+3*s*u,f=3*a*a-6*a*i+a*o-a*e+2*i*i+2*i*e-o*e+3*n*n-6*n*s+n*u-n*t+2*s*s+2*s*t-u*t,c=1*a*i-a*a+a*e-i*e+n*s-n*n+n*t-s*t,h=[];Ld(l,v,f,c,h);for(var d=1e-7,y=[],g=0;g<6;g+=2)Math.abs(h[g+1])=0&&h[g]<=1&&y.push(h[g]);y.push(1),y.push(0);for(var p=-1,m,b,w,E=0;E=0?wl?(e-i)*(e-i)+(t-s)*(t-s):v-c},Er=function(e,t,a){for(var n,i,s,o,u,l=0,v=0;v=e&&e>=s||n<=e&&e<=s)u=(e-n)/(s-n)*(o-i)+i,u>t&&l++;else continue;return l%2!==0},Yr=function(e,t,a,n,i,s,o,u,l){var v=new Array(a.length),f;u[0]!=null?(f=Math.atan(u[1]/u[0]),u[0]<0?f=f+Math.PI/2:f=-f-Math.PI/2):f=u;for(var c=Math.cos(-f),h=Math.sin(-f),d=0;d0){var g=xn(v,-l);y=wn(g)}else y=v;return Er(e,t,y)},Nd=function(e,t,a,n,i,s,o,u){for(var l=new Array(a.length*2),v=0;v=0&&g<=1&&m.push(g),p>=0&&p<=1&&m.push(p),m.length===0)return[];var b=m[0]*u[0]+e,w=m[0]*u[1]+t;if(m.length>1){if(m[0]==m[1])return[b,w];var E=m[1]*u[0]+e,C=m[1]*u[1]+t;return[b,w,E,C]}else return[b,w]},hi=function(e,t,a){return t<=e&&e<=a||a<=e&&e<=t?e:e<=t&&t<=a||a<=t&&t<=e?t:a},nt=function(e,t,a,n,i,s,o,u,l){var v=e-i,f=a-e,c=o-i,h=t-s,d=n-t,y=u-s,g=c*h-y*v,p=f*h-d*v,m=y*f-c*d;if(m!==0){var b=g/m,w=p/m,E=.001,C=0-E,x=1+E;return C<=b&&b<=x&&C<=w&&w<=x?[e+b*f,t+b*d]:l?[e+b*f,t+b*d]:[]}else return g===0||p===0?hi(e,a,o)===o?[o,u]:hi(e,a,i)===i?[i,s]:hi(i,o,a)===a?[a,n]:[]:[]},Fd=function(e,t,a,n,i){var s=[],o=n/2,u=i/2,l=t,v=a;s.push({x:l+o*e[0],y:v+u*e[1]});for(var f=1;f0){var y=xn(f,-u);h=wn(y)}else h=f}else h=a;for(var g,p,m,b,w=0;w2){for(var d=[v[0],v[1]],y=Math.pow(d[0]-e,2)+Math.pow(d[1]-t,2),g=1;gv&&(v=w)},get:function(b){return l[b]}},c=0;c0?L=R.edgesTo(A)[0]:L=A.edgesTo(R)[0];var I=n(L);A=A.id(),x[A]>x[B]+I&&(x[A]=x[B]+I,T.nodes.indexOf(A)<0?T.push(A):T.updateItem(A),C[A]=0,E[A]=[]),x[A]==x[B]+I&&(C[A]=C[A]+C[B],E[A].push(B))}else for(var M=0;M0;){for(var N=w.pop(),F=0;F0&&o.push(a[u]);o.length!==0&&i.push(n.collection(o))}return i},jd=function(e,t){for(var a=0;a5&&arguments[5]!==void 0?arguments[5]:th,o=n,u,l,v=0;v=2?ua(e,t,a,0,Zo,ah):ua(e,t,a,0,Yo)},squaredEuclidean:function(e,t,a){return ua(e,t,a,0,Zo)},manhattan:function(e,t,a){return ua(e,t,a,0,Yo)},max:function(e,t,a){return ua(e,t,a,-1/0,nh)}};Zt["squared-euclidean"]=Zt.squaredEuclidean;Zt.squaredeuclidean=Zt.squaredEuclidean;function In(r,e,t,a,n,i){var s;return $e(r)?s=r:s=Zt[r]||Zt.euclidean,e===0&&$e(r)?s(n,i):s(e,t,a,n,i)}var ih=vr({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),ao=function(e){return ih(e)},En=function(e,t,a,n,i){var s=i!=="kMedoids",o=s?function(f){return a[f]}:function(f){return n[f](a)},u=function(c){return n[c](t)},l=a,v=t;return In(e,n.length,o,u,l,v)},pi=function(e,t,a){for(var n=a.length,i=new Array(n),s=new Array(n),o=new Array(t),u=null,l=0;la)return!1}return!0},uh=function(e,t,a){for(var n=0;no&&(o=t[l][v],u=v);i[u].push(e[l])}for(var f=0;f=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var d=t[s],y=t[n[s]],g;i.mode==="dendrogram"?g={left:d,right:y,key:d.key}:g={value:d.value.concat(y.value),key:d.key},e[d.index]=g,e.splice(y.index,1),t[d.key]=g;for(var p=0;pa[y.key][m.key]&&(u=a[y.key][m.key])):i.linkage==="max"?(u=a[d.key][m.key],a[d.key][m.key]0&&n.push(i);return n},tu=function(e,t,a){for(var n=[],i=0;io&&(s=l,o=t[i*e+l])}s>0&&n.push(s)}for(var v=0;vl&&(u=v,l=f)}a[i]=s[u]}return n=tu(e,t,a),n},au=function(e){for(var t=this.cy(),a=this.nodes(),n=wh(e),i={},s=0;s=B?(P=B,B=R,A=L):R>P&&(P=R);for(var I=0;I0?1:0;x[k%n.minIterations*o+F]=U,N+=U}if(N>0&&(k>=n.minIterations-1||k==n.maxIterations-1)){for(var J=0,Z=0;Z1||C>1)&&(o=!0),f[b]=[],m.outgoers().forEach(function(T){T.isEdge()&&f[b].push(T.id())})}else c[b]=[void 0,m.target().id()]}):s.forEach(function(m){var b=m.id();if(m.isNode()){var w=m.degree(!0);w%2&&(u?l?o=!0:l=b:u=b),f[b]=[],m.connectedEdges().forEach(function(E){return f[b].push(E.id())})}else c[b]=[m.source().id(),m.target().id()]});var h={found:!1,trail:void 0};if(o)return h;if(l&&u)if(i){if(v&&l!=v)return h;v=l}else{if(v&&l!=v&&u!=v)return h;v||(v=l)}else v||(v=s[0].id());var d=function(b){for(var w=b,E=[b],C,x,T;f[w].length;)C=f[w].shift(),x=c[C][0],T=c[C][1],w!=T?(f[T]=f[T].filter(function(k){return k!=C}),w=T):!i&&w!=x&&(f[x]=f[x].filter(function(k){return k!=C}),w=x),E.unshift(C),E.unshift(w);return E},y=[],g=[];for(g=d(v);g.length!=1;)f[g[0]].length==0?(y.unshift(s.getElementById(g.shift())),y.unshift(s.getElementById(g.shift()))):g=d(g.shift()).concat(g);y.unshift(s.getElementById(g.shift()));for(var p in f)if(f[p].length)return h;return h.found=!0,h.trail=this.spawn(y,!0),h}},Ya=function(){var e=this,t={},a=0,n=0,i=[],s=[],o={},u=function(c,h){for(var d=s.length-1,y=[],g=e.spawn();s[d].x!=c||s[d].y!=h;)y.push(s.pop().edge),d--;y.push(s.pop().edge),y.forEach(function(p){var m=p.connectedNodes().intersection(e);g.merge(p),m.forEach(function(b){var w=b.id(),E=b.connectedEdges().intersection(e);g.merge(b),t[w].cutVertex?g.merge(E.filter(function(C){return C.isLoop()})):g.merge(E)})}),i.push(g)},l=function(c,h,d){c===d&&(n+=1),t[h]={id:a,low:a++,cutVertex:!1};var y=e.getElementById(h).connectedEdges().intersection(e);if(y.size()===0)i.push(e.spawn(e.getElementById(h)));else{var g,p,m,b;y.forEach(function(w){g=w.source().id(),p=w.target().id(),m=g===h?p:g,m!==d&&(b=w.id(),o[b]||(o[b]=!0,s.push({x:h,y:m,edge:w})),m in t?t[h].low=Math.min(t[h].low,t[m].id):(l(c,m,h),t[h].low=Math.min(t[h].low,t[m].low),t[h].id<=t[m].low&&(t[h].cutVertex=!0,u(h,m))))})}};e.forEach(function(f){if(f.isNode()){var c=f.id();c in t||(n=0,l(c,c),t[c].cutVertex=n>1)}});var v=Object.keys(t).filter(function(f){return t[f].cutVertex}).map(function(f){return e.getElementById(f)});return{cut:e.spawn(v),components:i}},Bh={hopcroftTarjanBiconnected:Ya,htbc:Ya,htb:Ya,hopcroftTarjanBiconnectedComponents:Ya},Za=function(){var e=this,t={},a=0,n=[],i=[],s=e.spawn(e),o=function(l){i.push(l),t[l]={index:a,low:a++,explored:!1};var v=e.getElementById(l).connectedEdges().intersection(e);if(v.forEach(function(y){var g=y.target().id();g!==l&&(g in t||o(g),t[g].explored||(t[l].low=Math.min(t[l].low,t[g].low)))}),t[l].index===t[l].low){for(var f=e.spawn();;){var c=i.pop();if(f.merge(e.getElementById(c)),t[c].low=t[l].index,t[c].explored=!0,c===l)break}var h=f.edgesWith(f),d=f.merge(h);n.push(d),s=s.difference(d)}};return e.forEach(function(u){if(u.isNode()){var l=u.id();l in t||o(l)}}),{cut:s,components:n}},Ph={tarjanStronglyConnected:Za,tsc:Za,tscc:Za,tarjanStronglyConnectedComponents:Za},Sv={};[Ca,id,sd,ud,vd,cd,gd,Gd,Ut,Kt,Ps,rh,hh,mh,Sh,Dh,Bh,Ph].forEach(function(r){ye(Sv,r)});/*!
+Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
+Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
+Licensed under The MIT License (http://opensource.org/licenses/MIT)
+*/var kv=0,Dv=1,Bv=2,Or=function(e){if(!(this instanceof Or))return new Or(e);this.id="Thenable/1.0.7",this.state=kv,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};Or.prototype={fulfill:function(e){return nu(this,Dv,"fulfillValue",e)},reject:function(e){return nu(this,Bv,"rejectReason",e)},then:function(e,t){var a=this,n=new Or;return a.onFulfilled.push(su(e,n,"fulfill")),a.onRejected.push(su(t,n,"reject")),Pv(a),n.proxy}};var nu=function(e,t,a,n){return e.state===kv&&(e.state=t,e[a]=n,Pv(e)),e},Pv=function(e){e.state===Dv?iu(e,"onFulfilled",e.fulfillValue):e.state===Bv&&iu(e,"onRejected",e.rejectReason)},iu=function(e,t,a){if(e[t].length!==0){var n=e[t];e[t]=[];var i=function(){for(var o=0;o0}},clearQueue:function(){return function(){var t=this,a=t.length!==void 0,n=a?t:[t],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var s=0;s-1}return Fi=e,Fi}var Vi,Pu;function Xh(){if(Pu)return Vi;Pu=1;var r=zn();function e(t,a){var n=this.__data__,i=r(n,t);return i<0?(++this.size,n.push([t,a])):n[i][1]=a,this}return Vi=e,Vi}var qi,Au;function Yh(){if(Au)return qi;Au=1;var r=Wh(),e=$h(),t=Uh(),a=Kh(),n=Xh();function i(s){var o=-1,u=s==null?0:s.length;for(this.clear();++o-1&&a%1==0&&a0&&this.spawn(n).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){Ve(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=t===void 0,i=[],s=0,o=a.length;s0&&this.spawn(i).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var a=this;if(t==null)t=250;else if(t===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},t),a}};un.className=un.classNames=un.classes;var Re={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:er,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Re.variable="(?:[\\w-.]|(?:\\\\"+Re.metaChar+"))+";Re.className="(?:[\\w-]|(?:\\\\"+Re.metaChar+"))+";Re.value=Re.string+"|"+Re.number;Re.id=Re.variable;(function(){var r,e,t;for(r=Re.comparatorOp.split("|"),t=0;t=0)&&e!=="="&&(Re.comparatorOp+="|\\!"+e)})();var Fe=function(){return{checks:[]}},ue={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},Ls=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(r,e){return Cc(r.selector,e.selector)}),kg=(function(){for(var r={},e,t=0;t0&&v.edgeCount>0)return ze("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(v.edgeCount>1)return ze("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;v.edgeCount===1&&ze("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},Mg=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(v){return v??""},t=function(v){return he(v)?'"'+v+'"':e(v)},a=function(v){return" "+v+" "},n=function(v,f){var c=v.type,h=v.value;switch(c){case ue.GROUP:{var d=e(h);return d.substring(0,d.length-1)}case ue.DATA_COMPARE:{var y=v.field,g=v.operator;return"["+y+a(e(g))+t(h)+"]"}case ue.DATA_BOOL:{var p=v.operator,m=v.field;return"["+e(p)+m+"]"}case ue.DATA_EXIST:{var b=v.field;return"["+b+"]"}case ue.META_COMPARE:{var w=v.operator,E=v.field;return"[["+E+a(e(w))+t(h)+"]]"}case ue.STATE:return h;case ue.ID:return"#"+h;case ue.CLASS:return"."+h;case ue.PARENT:case ue.CHILD:return i(v.parent,f)+a(">")+i(v.child,f);case ue.ANCESTOR:case ue.DESCENDANT:return i(v.ancestor,f)+" "+i(v.descendant,f);case ue.COMPOUND_SPLIT:{var C=i(v.left,f),x=i(v.subject,f),T=i(v.right,f);return C+(C.length>0?" ":"")+x+T}case ue.TRUE:return""}},i=function(v,f){return v.checks.reduce(function(c,h,d){return c+(f===v&&d===0?"$":"")+n(h,f)},"")},s="",o=0;o1&&o=0&&(t=t.replace("!",""),f=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),v=!0),(i||o||v)&&(u=!i&&!s?"":""+e,l=""+a),v&&(e=u=u.toLowerCase(),a=l=l.toLowerCase()),t){case"*=":n=u.indexOf(l)>=0;break;case"$=":n=u.indexOf(l,u.length-l.length)>=0;break;case"^=":n=u.indexOf(l)===0;break;case"=":n=e===a;break;case">":c=!0,n=e>a;break;case">=":c=!0,n=e>=a;break;case"<":c=!0,n=e0;){var v=n.shift();e(v),i.add(v.id()),o&&a(n,i,v)}return r}function zv(r,e,t){if(t.isParent())for(var a=t._private.children,n=0;n1&&arguments[1]!==void 0?arguments[1]:!0;return oo(this,r,e,zv)};function Fv(r,e,t){if(t.isChild()){var a=t._private.parent;e.has(a.id())||r.push(a)}}Qt.forEachUp=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return oo(this,r,e,Fv)};function qg(r,e,t){Fv(r,e,t),zv(r,e,t)}Qt.forEachUpAndDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return oo(this,r,e,qg)};Qt.ancestors=Qt.parents;var ka,Vv;ka=Vv={data:Ne.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Ne.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Ne.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ne.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Ne.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Ne.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};ka.attr=ka.data;ka.removeAttr=ka.removeData;var _g=Vv,Vn={};function hs(r){return function(e){var t=this;if(e===void 0&&(e=!0),t.length!==0)if(t.isNode()&&!t.removed()){for(var a=0,n=t[0],i=n._private.edges,s=0;se}),minIndegree:It("indegree",function(r,e){return re}),minOutdegree:It("outdegree",function(r,e){return re})});ye(Vn,{totalDegree:function(e){for(var t=0,a=this.nodes(),n=0;n0,c=f;f&&(v=v[0]);var h=c?v.position():{x:0,y:0};t!==void 0?l.position(e,t+h[e]):i!==void 0&&l.position({x:i.x+h.x,y:i.y+h.y})}else{var d=a.position(),y=o?a.parent():null,g=y&&y.length>0,p=g;g&&(y=y[0]);var m=p?y.position():{x:0,y:0};return i={x:d.x-m.x,y:d.y-m.y},e===void 0?i:i[e]}else if(!s)return;return this}};Ir.modelPosition=Ir.point=Ir.position;Ir.modelPositions=Ir.points=Ir.positions;Ir.renderedPoint=Ir.renderedPosition;Ir.relativePoint=Ir.relativePosition;var Gg=qv,Xt,gt;Xt=gt={};gt.renderedBoundingBox=function(r){var e=this.boundingBox(r),t=this.cy(),a=t.zoom(),n=t.pan(),i=e.x1*a+n.x,s=e.x2*a+n.x,o=e.y1*a+n.y,u=e.y2*a+n.y;return{x1:i,x2:s,y1:o,y2:u,w:s-i,h:u-o}};gt.dirtyCompoundBoundsCache=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(t){if(t.isParent()){var a=t._private;a.compoundBoundsClean=!1,a.bbCache=null,r||t.emitAndNotify("bounds")}}),this)};gt.updateCompoundBounds=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!r&&e.batching())return this;function t(s){if(!s.isParent())return;var o=s._private,u=s.children(),l=s.pstyle("compound-sizing-wrt-labels").value==="include",v={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},f=u.boundingBox({includeLabels:l,includeOverlays:!1,useCache:!1}),c=o.position;(f.w===0||f.h===0)&&(f={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},f.x1=c.x-f.w/2,f.x2=c.x+f.w/2,f.y1=c.y-f.h/2,f.y2=c.y+f.h/2);function h(k,D,B){var P=0,A=0,R=D+B;return k>0&&R>0&&(P=D/R*k,A=B/R*k),{biasDiff:P,biasComplementDiff:A}}function d(k,D,B,P){if(B.units==="%")switch(P){case"width":return k>0?B.pfValue*k:0;case"height":return D>0?B.pfValue*D:0;case"average":return k>0&&D>0?B.pfValue*(k+D)/2:0;case"min":return k>0&&D>0?k>D?B.pfValue*D:B.pfValue*k:0;case"max":return k>0&&D>0?k>D?B.pfValue*k:B.pfValue*D:0;default:return 0}else return B.units==="px"?B.pfValue:0}var y=v.width.left.value;v.width.left.units==="px"&&v.width.val>0&&(y=y*100/v.width.val);var g=v.width.right.value;v.width.right.units==="px"&&v.width.val>0&&(g=g*100/v.width.val);var p=v.height.top.value;v.height.top.units==="px"&&v.height.val>0&&(p=p*100/v.height.val);var m=v.height.bottom.value;v.height.bottom.units==="px"&&v.height.val>0&&(m=m*100/v.height.val);var b=h(v.width.val-f.w,y,g),w=b.biasDiff,E=b.biasComplementDiff,C=h(v.height.val-f.h,p,m),x=C.biasDiff,T=C.biasComplementDiff;o.autoPadding=d(f.w,f.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(f.w,v.width.val),c.x=(-w+f.x1+f.x2+E)/2,o.autoHeight=Math.max(f.h,v.height.val),c.y=(-x+f.y1+f.y2+T)/2}for(var a=0;ae.x2?n:e.x2,e.y1=ae.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},rt=function(e,t){return t==null?e:Lr(e,t.x1,t.y1,t.x2,t.y2)},la=function(e,t,a){return xr(e,t,a)},Qa=function(e,t,a){if(!t.cy().headless()){var n=t._private,i=n.rstyle,s=i.arrowWidth/2,o=t.pstyle(a+"-arrow-shape").value,u,l;if(o!=="none"){a==="source"?(u=i.srcX,l=i.srcY):a==="target"?(u=i.tgtX,l=i.tgtY):(u=i.midX,l=i.midY);var v=n.arrowBounds=n.arrowBounds||{},f=v[a]=v[a]||{};f.x1=u-s,f.y1=l-s,f.x2=u+s,f.y2=l+s,f.w=f.x2-f.x1,f.h=f.y2-f.y1,sn(f,1),Lr(e,f.x1,f.y1,f.x2,f.y2)}}},gs=function(e,t,a){if(!t.cy().headless()){var n;a?n=a+"-":n="";var i=t._private,s=i.rstyle,o=t.pstyle(n+"label").strValue;if(o){var u=t.pstyle("text-halign"),l=t.pstyle("text-valign"),v=la(s,"labelWidth",a),f=la(s,"labelHeight",a),c=la(s,"labelX",a),h=la(s,"labelY",a),d=t.pstyle(n+"text-margin-x").pfValue,y=t.pstyle(n+"text-margin-y").pfValue,g=t.isEdge(),p=t.pstyle(n+"text-rotation"),m=t.pstyle("text-outline-width").pfValue,b=t.pstyle("text-border-width").pfValue,w=b/2,E=t.pstyle("text-background-padding").pfValue,C=2,x=f,T=v,k=T/2,D=x/2,B,P,A,R;if(g)B=c-k,P=c+k,A=h-D,R=h+D;else{switch(u.value){case"left":B=c-T,P=c;break;case"center":B=c-k,P=c+k;break;case"right":B=c,P=c+T;break}switch(l.value){case"top":A=h-x,R=h;break;case"center":A=h-D,R=h+D;break;case"bottom":A=h,R=h+x;break}}var L=d-Math.max(m,w)-E-C,I=d+Math.max(m,w)+E+C,M=y-Math.max(m,w)-E-C,O=y+Math.max(m,w)+E+C;B+=L,P+=I,A+=M,R+=O;var q=a||"main",_=i.labelBounds,N=_[q]=_[q]||{};N.x1=B,N.y1=A,N.x2=P,N.y2=R,N.w=P-B,N.h=R-A,N.leftPad=L,N.rightPad=I,N.topPad=M,N.botPad=O;var F=g&&p.strValue==="autorotate",U=p.pfValue!=null&&p.pfValue!==0;if(F||U){var J=F?la(i.rstyle,"labelAngle",a):p.pfValue,Z=Math.cos(J),j=Math.sin(J),re=(B+P)/2,ne=(A+R)/2;if(!g){switch(u.value){case"left":re=P;break;case"right":re=B;break}switch(l.value){case"top":ne=R;break;case"bottom":ne=A;break}}var Q=function(we,me){return we=we-re,me=me-ne,{x:we*Z-me*j+re,y:we*j+me*Z+ne}},V=Q(B,A),H=Q(B,R),W=Q(P,A),Y=Q(P,R);B=Math.min(V.x,H.x,W.x,Y.x),P=Math.max(V.x,H.x,W.x,Y.x),A=Math.min(V.y,H.y,W.y,Y.y),R=Math.max(V.y,H.y,W.y,Y.y)}var te=q+"Rot",ce=_[te]=_[te]||{};ce.x1=B,ce.y1=A,ce.x2=P,ce.y2=R,ce.w=P-B,ce.h=R-A,Lr(e,B,A,P,R),Lr(i.labelBounds.all,B,A,P,R)}return e}},il=function(e,t){if(!t.cy().headless()){var a=t.pstyle("outline-opacity").value,n=t.pstyle("outline-width").value,i=t.pstyle("outline-offset").value,s=n+i;Gv(e,t,a,s,"outside",s/2)}},Gv=function(e,t,a,n,i,s){if(!(a===0||n<=0||i==="inside")){var o=t.cy(),u=o.renderer(),l=u.nodeShapes[u.getNodeShape(t)];if(l){var v=t.position(),f=v.x,c=v.y,h=t.width(),d=t.height();if(l.hasMiterBounds){i==="center"&&(n/=2);var y=l.miterBounds(f,c,h,d,n);rt(e,y)}else s!=null&&s>0&&on(e,[s,s,s,s])}}},Hg=function(e,t){if(!t.cy().headless()){var a=t.pstyle("border-opacity").value,n=t.pstyle("border-width").pfValue,i=t.pstyle("border-position").value;Gv(e,t,a,n,i)}},Wg=function(e,t){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),s=yr(),o=e._private,u=e.isNode(),l=e.isEdge(),v,f,c,h,d,y,g=o.rstyle,p=u&&n?e.pstyle("bounds-expansion").pfValue:[0],m=function(Be){return Be.pstyle("display").value!=="none"},b=!n||m(e)&&(!l||m(e.source())&&m(e.target()));if(b){var w=0,E=0;n&&t.includeOverlays&&(w=e.pstyle("overlay-opacity").value,w!==0&&(E=e.pstyle("overlay-padding").value));var C=0,x=0;n&&t.includeUnderlays&&(C=e.pstyle("underlay-opacity").value,C!==0&&(x=e.pstyle("underlay-padding").value));var T=Math.max(E,x),k=0,D=0;if(n&&(k=e.pstyle("width").pfValue,D=k/2),u&&t.includeNodes){var B=e.position();d=B.x,y=B.y;var P=e.outerWidth(),A=P/2,R=e.outerHeight(),L=R/2;v=d-A,f=d+A,c=y-L,h=y+L,Lr(s,v,c,f,h),n&&il(s,e),n&&t.includeOutlines&&!i&&il(s,e),n&&Hg(s,e)}else if(l&&t.includeEdges)if(n&&!i){var I=e.pstyle("curve-style").strValue;if(v=Math.min(g.srcX,g.midX,g.tgtX),f=Math.max(g.srcX,g.midX,g.tgtX),c=Math.min(g.srcY,g.midY,g.tgtY),h=Math.max(g.srcY,g.midY,g.tgtY),v-=D,f+=D,c-=D,h+=D,Lr(s,v,c,f,h),I==="haystack"){var M=g.haystackPts;if(M&&M.length===2){if(v=M[0].x,c=M[0].y,f=M[1].x,h=M[1].y,v>f){var O=v;v=f,f=O}if(c>h){var q=c;c=h,h=q}Lr(s,v-D,c-D,f+D,h+D)}}else if(I==="bezier"||I==="unbundled-bezier"||tt(I,"segments")||tt(I,"taxi")){var _;switch(I){case"bezier":case"unbundled-bezier":_=g.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":_=g.linePts;break}if(_!=null)for(var N=0;N<_.length;N++){var F=_[N];v=F.x-D,f=F.x+D,c=F.y-D,h=F.y+D,Lr(s,v,c,f,h)}}}else{var U=e.source(),J=U.position(),Z=e.target(),j=Z.position();if(v=J.x,f=j.x,c=J.y,h=j.y,v>f){var re=v;v=f,f=re}if(c>h){var ne=c;c=h,h=ne}v-=D,f+=D,c-=D,h+=D,Lr(s,v,c,f,h)}if(n&&t.includeEdges&&l&&(Qa(s,e,"mid-source"),Qa(s,e,"mid-target"),Qa(s,e,"source"),Qa(s,e,"target")),n){var Q=e.pstyle("ghost").value==="yes";if(Q){var V=e.pstyle("ghost-offset-x").pfValue,H=e.pstyle("ghost-offset-y").pfValue;Lr(s,s.x1+V,s.y1+H,s.x2+V,s.y2+H)}}var W=o.bodyBounds=o.bodyBounds||{};Wo(W,s),on(W,p),sn(W,1),n&&(v=s.x1,f=s.x2,c=s.y1,h=s.y2,Lr(s,v-T,c-T,f+T,h+T));var Y=o.overlayBounds=o.overlayBounds||{};Wo(Y,s),on(Y,p),sn(Y,1);var te=o.labelBounds=o.labelBounds||{};te.all!=null?Sd(te.all):te.all=yr(),n&&t.includeLabels&&(t.includeMainLabels&&gs(s,e,null),l&&(t.includeSourceLabels&&gs(s,e,"source"),t.includeTargetLabels&&gs(s,e,"target")))}return s.x1=Dr(s.x1),s.y1=Dr(s.y1),s.x2=Dr(s.x2),s.y2=Dr(s.y2),s.w=Dr(s.x2-s.x1),s.h=Dr(s.y2-s.y1),s.w>0&&s.h>0&&b&&(on(s,p),sn(s,1)),s},Hv=function(e){var t=0,a=function(s){return(s?1:0)<0&&arguments[0]!==void 0?arguments[0]:ip,e=arguments.length>1?arguments[1]:void 0,t=0;t=0;o--)s(o);return this};ct.removeAllListeners=function(){return this.removeListener("*")};ct.emit=ct.trigger=function(r,e,t){var a=this.listeners,n=a.length;return this.emitting++,Ve(e)||(e=[e]),sp(this,function(i,s){t!=null&&(a=[{event:s.event,type:s.type,namespace:s.namespace,callback:t}],n=a.length);for(var o=function(){var v=a[u];if(v.type===s.type&&(!v.namespace||v.namespace===s.namespace||v.namespace===np)&&i.eventMatches(i.context,v,s)){var f=[s];e!=null&&Zc(f,e),i.beforeEmit(i.context,v,s),v.conf&&v.conf.one&&(i.listeners=i.listeners.filter(function(d){return d!==v}));var c=i.callbackContext(i.context,v,s),h=v.callback.apply(c,f);i.afterEmit(i.context,v,s),h===!1&&(s.stopPropagation(),s.preventDefault())}},u=0;u1&&!s){var o=this.length-1,u=this[o],l=u._private.data.id;this[o]=void 0,this[e]=u,i.set(l,{ele:u,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,a=e._private.data.id,n=t.map,i=n.get(a);if(!i)return this;var s=i.index;return this.unmergeAt(s),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&he(e)){var a=e;e=t.mutableElements().filter(a)}for(var n=0;n=0;t--){var a=this[t];e(a)&&this.unmergeAt(t)}return this},map:function(e,t){for(var a=[],n=this,i=0;ia&&(a=u,n=o)}return{value:a,ele:n}},min:function(e,t){for(var a=1/0,n,i=this,s=0;s=0&&i"u"?"undefined":rr(Symbol))!=e&&rr(Symbol.iterator)!=e;t&&(Cn[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,s=this.length;return Zl({next:function(){return i1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],n=a.cy();if(n.styleEnabled()&&a){a._private.styleDirty&&(a._private.styleDirty=!1,n.style().apply(a));var i=a._private.style[e];return i??(t?n.style().getDefaultProperty(e):null)}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var a=t.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var a=this[0];if(a)return t.style().getRenderedStyle(a,e)},style:function(e,t){var a=this.cy();if(!a.styleEnabled())return this;var n=!1,i=a.style();if(Me(e)){var s=e;i.applyBypass(this,s,n),this.emitAndNotify("style")}else if(he(e))if(t===void 0){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}else i.applyBypass(this,e,t,n),this.emitAndNotify("style");else if(e===void 0){var u=this[0];return u?i.getRawStyle(u):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var a=!1,n=t.style(),i=this;if(e===void 0)for(var s=0;s0&&e.push(v[0]),e.push(o[0])}return this.spawn(e,!0).filter(r)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});dr.neighbourhood=dr.neighborhood;dr.closedNeighbourhood=dr.closedNeighborhood;dr.openNeighbourhood=dr.openNeighborhood;ye(dr,{source:Br(function(e){var t=this[0],a;return t&&(a=t._private.source||t.cy().collection()),a&&e?a.filter(e):a},"source"),target:Br(function(e){var t=this[0],a;return t&&(a=t._private.target||t.cy().collection()),a&&e?a.filter(e):a},"target"),sources:pl({attr:"source"}),targets:pl({attr:"target"})});function pl(r){return function(t){for(var a=[],n=0;n0);return s},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});dr.componentsOf=dr.components;var lr=function(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){He("A collection must have a reference to the core");return}var i=new Kr,s=!1;if(!t)t=[];else if(t.length>0&&Me(t[0])&&!Ma(t[0])){s=!0;for(var o=[],u=new jt,l=0,v=t.length;l0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,a=t.cy(),n=a._private,i=[],s=[],o,u=0,l=t.length;u0){for(var q=o.length===t.length?t:new lr(a,o),_=0;_0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,a=[],n={},i=t._private.cy;function s(R){for(var L=R._private.edges,I=0;I0&&(r?B.emitAndNotify("remove"):e&&B.emit("remove"));for(var P=0;P0?P=R:B=R;while(Math.abs(A)>s&&++L=i?m(D,L):I===0?L:w(D,B,B+l)}var C=!1;function x(){C=!0,(r!==e||t!==a)&&b()}var T=function(B){return C||x(),r===e&&t===a?B:B===0?0:B===1?1:g(E(B),e,a)};T.getControlPoints=function(){return[{x:r,y:e},{x:t,y:a}]};var k="generateBezier("+[r,e,t,a]+")";return T.toString=function(){return k},T}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var yp=(function(){function r(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,i){var s={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:s.v,dv:r(s)}}function t(a,n){var i={dx:a.v,dv:r(a)},s=e(a,n*.5,i),o=e(a,n*.5,s),u=e(a,n,o),l=1/6*(i.dx+2*(s.dx+o.dx)+u.dx),v=1/6*(i.dv+2*(s.dv+o.dv)+u.dv);return a.x=a.x+l*n,a.v=a.v+v*n,a}return function a(n,i,s){var o={x:-1,v:0,tension:null,friction:null},u=[0],l=0,v=1/1e4,f=16/1e3,c,h,d;for(n=parseFloat(n)||500,i=parseFloat(i)||20,s=s||null,o.tension=n,o.friction=i,c=s!==null,c?(l=a(n,i),h=l/s*f):h=f;d=t(d||o,h),u.push(1+d.x),l+=16,Math.abs(d.x)>v&&Math.abs(d.v)>v;);return c?function(y){return u[y*(u.length-1)|0]}:l}})(),qe=function(e,t,a,n){var i=pp(e,t,a,n);return function(s,o,u){return s+(o-s)*i(u)}},vn={linear:function(e,t,a){return e+(t-e)*a},ease:qe(.25,.1,.25,1),"ease-in":qe(.42,0,1,1),"ease-out":qe(0,0,.58,1),"ease-in-out":qe(.42,0,.58,1),"ease-in-sine":qe(.47,0,.745,.715),"ease-out-sine":qe(.39,.575,.565,1),"ease-in-out-sine":qe(.445,.05,.55,.95),"ease-in-quad":qe(.55,.085,.68,.53),"ease-out-quad":qe(.25,.46,.45,.94),"ease-in-out-quad":qe(.455,.03,.515,.955),"ease-in-cubic":qe(.55,.055,.675,.19),"ease-out-cubic":qe(.215,.61,.355,1),"ease-in-out-cubic":qe(.645,.045,.355,1),"ease-in-quart":qe(.895,.03,.685,.22),"ease-out-quart":qe(.165,.84,.44,1),"ease-in-out-quart":qe(.77,0,.175,1),"ease-in-quint":qe(.755,.05,.855,.06),"ease-out-quint":qe(.23,1,.32,1),"ease-in-out-quint":qe(.86,0,.07,1),"ease-in-expo":qe(.95,.05,.795,.035),"ease-out-expo":qe(.19,1,.22,1),"ease-in-out-expo":qe(1,0,0,1),"ease-in-circ":qe(.6,.04,.98,.335),"ease-out-circ":qe(.075,.82,.165,1),"ease-in-out-circ":qe(.785,.135,.15,.86),spring:function(e,t,a){if(a===0)return vn.linear;var n=yp(e,t,a);return function(i,s,o){return i+(s-i)*n(o)}},"cubic-bezier":qe};function bl(r,e,t,a,n){if(a===1||e===t)return t;var i=n(e,t,a);return r==null||((r.roundValue||r.color)&&(i=Math.round(i)),r.min!==void 0&&(i=Math.max(i,r.min)),r.max!==void 0&&(i=Math.min(i,r.max))),i}function wl(r,e){return r.pfValue!=null||r.value!=null?r.pfValue!=null&&(e==null||e.type.units!=="%")?r.pfValue:r.value:r}function Ot(r,e,t,a,n){var i=n!=null?n.type:null;t<0?t=0:t>1&&(t=1);var s=wl(r,n),o=wl(e,n);if(ae(s)&&ae(o))return bl(i,s,o,t,a);if(Ve(s)&&Ve(o)){for(var u=[],l=0;l0?(h==="spring"&&d.push(s.duration),s.easingImpl=vn[h].apply(null,d)):s.easingImpl=vn[h]}var y=s.easingImpl,g;if(s.duration===0?g=1:g=(t-u)/s.duration,s.applying&&(g=s.progress),g<0?g=0:g>1&&(g=1),s.delay==null){var p=s.startPosition,m=s.position;if(m&&n&&!r.locked()){var b={};fa(p.x,m.x)&&(b.x=Ot(p.x,m.x,g,y)),fa(p.y,m.y)&&(b.y=Ot(p.y,m.y,g,y)),r.position(b)}var w=s.startPan,E=s.pan,C=i.pan,x=E!=null&&a;x&&(fa(w.x,E.x)&&(C.x=Ot(w.x,E.x,g,y)),fa(w.y,E.y)&&(C.y=Ot(w.y,E.y,g,y)),r.emit("pan"));var T=s.startZoom,k=s.zoom,D=k!=null&&a;D&&(fa(T,k)&&(i.zoom=Ta(i.minZoom,Ot(T,k,g,y),i.maxZoom)),r.emit("zoom")),(x||D)&&r.emit("viewport");var B=s.style;if(B&&B.length>0&&n){for(var P=0;P=0;x--){var T=C[x];T()}C.splice(0,C.length)},m=h.length-1;m>=0;m--){var b=h[m],w=b._private;if(w.stopped){h.splice(m,1),w.hooked=!1,w.playing=!1,w.started=!1,p(w.frames);continue}!w.playing&&!w.applying||(w.playing&&w.applying&&(w.applying=!1),w.started||bp(v,b,r),mp(v,b,r,f),w.applying&&(w.applying=!1),p(w.frames),w.step!=null&&w.step(r),b.completed()&&(h.splice(m,1),w.hooked=!1,w.playing=!1,w.started=!1,p(w.completes)),y=!0)}return!f&&h.length===0&&d.length===0&&a.push(v),y}for(var i=!1,s=0;s0?e.notify("draw",t):e.notify("draw")),t.unmerge(a),e.emit("step")}var wp={animate:Ne.animate(),animation:Ne.animation(),animated:Ne.animated(),clearQueue:Ne.clearQueue(),delay:Ne.delay(),delayAnimation:Ne.delayAnimation(),stop:Ne.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function t(){e._private.animationsRunning&&mn(function(i){xl(i,e),t()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,s){xl(s,e)},a.beforeRenderPriorities.animations):t()}},xp={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,a){var n=t.qualifier;return n!=null?e!==a.target&&Ma(a.target)&&n.matches(a.target):!0},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,a){return t.qualifier!=null?a.target:e}},en=function(e){return he(e)?new vt(e):e},ef={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new qn(xp,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,a){return this.emitter().on(e,en(t),a),this},removeListener:function(e,t,a){return this.emitter().removeListener(e,en(t),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,a){return this.emitter().one(e,en(t),a),this},once:function(e,t,a){return this.emitter().one(e,en(t),a),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Ne.eventAliasesOn(ef);var Os={png:function(e){var t=this._private.renderer;return e=e||{},t.png(e)},jpg:function(e){var t=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",t.jpg(e)}};Os.jpeg=Os.jpg;var fn={layout:function(e){var t=this;if(e==null){He("Layout options must be specified to make a layout");return}if(e.name==null){He("A `name` must be specified to make a layout");return}var a=e.name,n=t.extension("layout",a);if(n==null){He("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;he(e.eles)?i=t.$(e.eles):i=e.eles!=null?e.eles:t.$();var s=new n(ye({},e,{cy:t,eles:i}));return s}};fn.createLayout=fn.makeLayout=fn.layout;var Ep={notify:function(e,t){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var n=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();t!=null&&n.merge(t);return}if(a.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var n=e.batchNotifications[a];n.empty()?t.notify(a):t.notify(a,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var a=Object.keys(e),n=0;n0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(a){var n=a._private;n.rscratch={},n.rstyle={},n.animation.current=[],n.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Ns.invalidateDimensions=Ns.resize;var cn={collection:function(e,t){return he(e)?this.$(e):Tr(e)?e.collection():Ve(e)?(t||(t={}),new lr(this,e,t.unique,t.removed)):new lr(this)},nodes:function(e){var t=this.$(function(a){return a.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(a){return a.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};cn.elements=cn.filter=cn.$;var sr={},ma="t",Tp="f";sr.apply=function(r){for(var e=this,t=e._private,a=t.cy,n=a.collection(),i=0;i0;if(c||f&&h){var d=void 0;c&&h||c?d=l.properties:h&&(d=l.mappedProperties);for(var y=0;y1&&(w=1),o.color){var C=a.valueMin[0],x=a.valueMax[0],T=a.valueMin[1],k=a.valueMax[1],D=a.valueMin[2],B=a.valueMax[2],P=a.valueMin[3]==null?1:a.valueMin[3],A=a.valueMax[3]==null?1:a.valueMax[3],R=[Math.round(C+(x-C)*w),Math.round(T+(k-T)*w),Math.round(D+(B-D)*w),Math.round(P+(A-P)*w)];i={bypass:a.bypass,name:a.name,value:R,strValue:"rgb("+R[0]+", "+R[1]+", "+R[2]+")"}}else if(o.number){var L=a.valueMin+(a.valueMax-a.valueMin)*w;i=this.parse(a.name,L,a.bypass,c)}else return!1;if(!i)return y(),!1;i.mapping=a,a=i;break}case s.data:{for(var I=a.field.split("."),M=f.data,O=0;O0&&i>0){for(var o={},u=!1,l=0;l0?r.delayAnimation(s).play().promise().then(b):b()}).then(function(){return r.animation({style:o,duration:i,easing:r.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){t.removeBypasses(r,n),r.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(r,n),r.emitAndNotify("style"),a.transitioning=!1)};sr.checkTrigger=function(r,e,t,a,n,i){var s=this.properties[e],o=n(s);r.removed()||o!=null&&o(t,a,r)&&i(s)};sr.checkZOrderTrigger=function(r,e,t,a){var n=this;this.checkTrigger(r,e,t,a,function(i){return i.triggersZOrder},function(){n._private.cy.notify("zorder",r)})};sr.checkBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBounds},function(n){r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache()})};sr.checkConnectedEdgesBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBoundsOfConnectedEdges},function(n){r.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};sr.checkParallelEdgesBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBoundsOfParallelEdges},function(n){r.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};sr.checkTriggers=function(r,e,t,a){r.dirtyStyleCache(),this.checkZOrderTrigger(r,e,t,a),this.checkBoundsTrigger(r,e,t,a),this.checkConnectedEdgesBoundsTrigger(r,e,t,a),this.checkParallelEdgesBoundsTrigger(r,e,t,a)};var Va={};Va.applyBypass=function(r,e,t,a){var n=this,i=[],s=!0;if(e==="*"||e==="**"){if(t!==void 0)for(var o=0;on.length?a=a.substr(n.length):a=""}function u(){i.length>s.length?i=i.substr(s.length):i=""}for(;;){var l=a.match(/^\s*$/);if(l)break;var v=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!v){ze("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=v[0];var f=v[1];if(f!=="core"){var c=new vt(f);if(c.invalid){ze("Skipping parsing of block: Invalid selector found in string stylesheet: "+f),o();continue}}var h=v[2],d=!1;i=h;for(var y=[];;){var g=i.match(/^\s*$/);if(g)break;var p=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!p){ze("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+h),d=!0;break}s=p[0];var m=p[1],b=p[2],w=e.properties[m];if(!w){ze("Skipping property: Invalid property name in: "+s),u();continue}var E=t.parse(m,b);if(!E){ze("Skipping property: Invalid property definition in: "+s),u();continue}y.push({name:m,val:b}),u()}if(d){o();break}t.selector(f);for(var C=0;C=7&&e[0]==="d"&&(v=new RegExp(o.data.regex).exec(e))){if(t)return!1;var c=o.data;return{name:r,value:v,strValue:""+e,mapped:c,field:v[1],bypass:t}}else if(e.length>=10&&e[0]==="m"&&(f=new RegExp(o.mapData.regex).exec(e))){if(t||l.multiple)return!1;var h=o.mapData;if(!(l.color||l.number))return!1;var d=this.parse(r,f[4]);if(!d||d.mapped)return!1;var y=this.parse(r,f[5]);if(!y||y.mapped)return!1;if(d.pfValue===y.pfValue||d.strValue===y.strValue)return ze("`"+r+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+r+": "+d.strValue+"`"),this.parse(r,d.strValue);if(l.color){var g=d.value,p=y.value,m=g[0]===p[0]&&g[1]===p[1]&&g[2]===p[2]&&(g[3]===p[3]||(g[3]==null||g[3]===1)&&(p[3]==null||p[3]===1));if(m)return!1}return{name:r,value:f,strValue:""+e,mapped:h,field:f[1],fieldMin:parseFloat(f[2]),fieldMax:parseFloat(f[3]),valueMin:d.value,valueMax:y.value,bypass:t}}}if(l.multiple&&a!=="multiple"){var b;if(u?b=e.split(/\s+/):Ve(e)?b=e:b=[e],l.evenMultiple&&b.length%2!==0)return null;for(var w=[],E=[],C=[],x="",T=!1,k=0;k0?" ":"")+D.strValue}return l.validate&&!l.validate(w,E)?null:l.singleEnum&&T?w.length===1&&he(w[0])?{name:r,value:w[0],strValue:w[0],bypass:t}:null:{name:r,value:w,pfValue:C,strValue:x,bypass:t,units:E}}var B=function(){for(var Q=0;Ql.max||l.strictMax&&e===l.max))return null;var I={name:r,value:e,strValue:""+e+(P||""),units:P,bypass:t};return l.unitless||P!=="px"&&P!=="em"?I.pfValue=e:I.pfValue=P==="px"||!P?e:this.getEmSizeInPixels()*e,(P==="ms"||P==="s")&&(I.pfValue=P==="ms"?e:1e3*e),(P==="deg"||P==="rad")&&(I.pfValue=P==="rad"?e:xd(e)),P==="%"&&(I.pfValue=e/100),I}else if(l.propList){var M=[],O=""+e;if(O!=="none"){for(var q=O.split(/\s*,\s*|\s+/),_=0;_0&&o>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){u=Math.min((s-2*t)/a.w,(o-2*t)/a.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u=a.minZoom&&(a.maxZoom=t),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t=this._private,a=t.pan,n=t.zoom,i,s,o=!1;if(t.zoomingEnabled||(o=!0),ae(e)?s=e:Me(e)&&(s=e.level,e.position!=null?i=Ln(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!t.panningEnabled&&(o=!0)),s=s>t.maxZoom?t.maxZoom:s,s=st.maxZoom||!t.zoomingEnabled?s=!0:(t.zoom=u,i.push("zoom"))}if(n&&(!s||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;ae(l.x)&&(t.pan.x=l.x,o=!1),ae(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(he(e)){var a=e;e=this.mutableElements().filter(a)}else Tr(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),s=this.height();t=t===void 0?this._private.zoom:t;var o={x:(i-t*(n.x1+n.x2))/2,y:(s-t*(n.y1+n.y2))/2};return o}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container,a=this;return e.sizeCache=e.sizeCache||(t?(function(){var n=a.window().getComputedStyle(t),i=function(o){return parseFloat(n.getPropertyValue(o))};return{width:t.clientWidth-i("padding-left")-i("padding-right"),height:t.clientHeight-i("padding-top")-i("padding-bottom")}})():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,a=this.renderedExtent(),n={x1:(a.x1-e.x)/t,x2:(a.x2-e.x)/t,y1:(a.y1-e.y)/t,y2:(a.y2-e.y)/t};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};Pt.centre=Pt.center;Pt.autolockNodes=Pt.autolock;Pt.autoungrabifyNodes=Pt.autoungrabify;var Ba={data:Ne.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Ne.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Ne.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ne.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Ba.attr=Ba.data;Ba.removeAttr=Ba.removeData;var Pa=function(e){var t=this;e=ye({},e);var a=e.container;a&&!yn(a)&&yn(a[0])&&(a=a[0]);var n=a?a._cyreg:null;n=n||{},n&&n.cy&&(n.cy.destroy(),n={});var i=n.readies=n.readies||[];a&&(a._cyreg=n),n.cy=t;var s=je!==void 0&&a!==void 0&&!e.headless,o=e;o.layout=ye({name:s?"grid":"null"},o.layout),o.renderer=ye({name:s?"canvas":"null"},o.renderer);var u=function(d,y,g){return y!==void 0?y:g!==void 0?g:d},l=this._private={container:a,ready:!1,options:o,elements:new lr(this),listeners:[],aniEles:new lr(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,o.zoomingEnabled),userZoomingEnabled:u(!0,o.userZoomingEnabled),panningEnabled:u(!0,o.panningEnabled),userPanningEnabled:u(!0,o.userPanningEnabled),boxSelectionEnabled:u(!0,o.boxSelectionEnabled),autolock:u(!1,o.autolock,o.autolockNodes),autoungrabify:u(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:u(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?s:o.styleEnabled,zoom:ae(o.zoom)?o.zoom:1,pan:{x:Me(o.pan)&&ae(o.pan.x)?o.pan.x:0,y:Me(o.pan)&&ae(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var v=function(d,y){var g=d.some(gc);if(g)return ea.all(d).then(y);y(d)};l.styleEnabled&&t.setStyle([]);var f=ye({},o,o.renderer);t.initRenderer(f);var c=function(d,y,g){t.notifications(!1);var p=t.mutableElements();p.length>0&&p.remove(),d!=null&&(Me(d)||Ve(d))&&t.add(d),t.one("layoutready",function(b){t.notifications(!0),t.emit(b),t.one("load",y),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",g),t.emit("done")});var m=ye({},t._private.options.layout);m.eles=t.elements(),t.layout(m).run()};v([o.style,o.elements],function(h){var d=h[0],y=h[1];l.styleEnabled&&t.style().append(d),c(y,function(){t.startAnimationLoop(),l.ready=!0,$e(o.ready)&&t.on("ready",o.ready);for(var g=0;g0,o=!!r.boundingBox,u=yr(o?r.boundingBox:structuredClone(e.extent())),l;if(Tr(r.roots))l=r.roots;else if(Ve(r.roots)){for(var v=[],f=0;f0;){var R=A(),L=k(R,B);if(L)R.outgoers().filter(function(ge){return ge.isNode()&&t.has(ge)}).forEach(P);else if(L===null){ze("Detected double maximal shift for node `"+R.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var I=0;if(r.avoidOverlap)for(var M=0;M0&&p[0].length<=3?be/2:0),De=2*Math.PI/p[fe].length*xe;return fe===0&&p[0].length===1&&(Se=1),{x:W.x+Se*Math.cos(De),y:W.y+Se*Math.sin(De)}}else{var Oe=p[fe].length,Le=Math.max(Oe===1?0:o?(u.w-r.padding*2-Y.w)/((r.grid?ce:Oe)-1):(u.w-r.padding*2-Y.w)/((r.grid?ce:Oe)+1),I),Ae={x:W.x+(xe+1-(Oe+1)/2)*Le,y:W.y+(fe+1-(Z+1)/2)*te};return Ae}},we={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(we).indexOf(r.direction)===-1&&He("Invalid direction '".concat(r.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(we).join(", ")));var me=function(se){return Wc(Be(se),u,we[r.direction])};return t.nodes().layoutPositions(this,r,me),this};var Pp={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function tf(r){this.options=ye({},Pp,r)}tf.prototype.run=function(){var r=this.options,e=r,t=r.cy,a=e.eles,n=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var s=yr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},u=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,l=u/Math.max(1,i.length-1),v,f=0,c=0;c1&&e.avoidOverlap){f*=1.75;var p=Math.cos(l)-Math.cos(0),m=Math.sin(l)-Math.sin(0),b=Math.sqrt(f*f/(p*p+m*m));v=Math.max(b,v)}var w=function(C,x){var T=e.startAngle+x*l*(n?1:-1),k=v*Math.cos(T),D=v*Math.sin(T),B={x:o.x+k,y:o.y+D};return B};return a.nodes().layoutPositions(this,e,w),this};var Ap={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function af(r){this.options=ye({},Ap,r)}af.prototype.run=function(){for(var r=this.options,e=r,t=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=r.cy,n=e.eles,i=n.nodes().not(":parent"),s=yr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},u=[],l=0,v=0;v0){var E=Math.abs(m[0].value-w.value);E>=g&&(m=[],p.push(m))}m.push(w)}var C=l+e.minNodeSpacing;if(!e.avoidOverlap){var x=p.length>0&&p[0].length>1,T=Math.min(s.w,s.h)/2-C,k=T/(p.length+x?1:0);C=Math.min(C,k)}for(var D=0,B=0;B1&&e.avoidOverlap){var L=Math.cos(R)-Math.cos(0),I=Math.sin(R)-Math.sin(0),M=Math.sqrt(C*C/(L*L+I*I));D=Math.max(M,D)}P.r=D,D+=C}if(e.equidistant){for(var O=0,q=0,_=0;_=r.numIter||(zp(a,r),a.temperature=a.temperature*r.coolingFactor,a.temperature=r.animationThreshold&&i(),mn(v)}};v()}else{for(;l;)l=s(u),u++;Tl(a,r),o()}return this};$n.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};$n.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Mp=function(e,t,a){for(var n=a.eles.edges(),i=a.eles.nodes(),s=yr(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:s.w,clientHeight:s.h,boundingBox:s},u=a.eles.components(),l={},v=0;v0){o.graphSet.push(T);for(var v=0;vn.count?0:n.graph},nf=function(e,t,a,n){var i=n.graphSet[a];if(-10)var f=n.nodeOverlap*v,c=Math.sqrt(o*o+u*u),h=f*o/c,d=f*u/c;else var y=Sn(e,o,u),g=Sn(t,-1*o,-1*u),p=g.x-y.x,m=g.y-y.y,b=p*p+m*m,c=Math.sqrt(b),f=(e.nodeRepulsion+t.nodeRepulsion)/b,h=f*p/c,d=f*m/c;e.isLocked||(e.offsetX-=h,e.offsetY-=d),t.isLocked||(t.offsetX+=h,t.offsetY+=d)}},qp=function(e,t,a,n){if(a>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(n>0)var s=e.maxY-t.minY;else var s=t.maxY-e.minY;return i>=0&&s>=0?Math.sqrt(i*i+s*s):0},Sn=function(e,t,a){var n=e.positionX,i=e.positionY,s=e.height||1,o=e.width||1,u=a/t,l=s/o,v={};return t===0&&0a?(v.x=n,v.y=i+s/2,v):0t&&-1*l<=u&&u<=l?(v.x=n-o/2,v.y=i-o*a/2/t,v):0=l)?(v.x=n+s*t/2/a,v.y=i+s/2,v):(0>a&&(u<=-1*l||u>=l)&&(v.x=n-s*t/2/a,v.y=i-s/2),v)},_p=function(e,t){for(var a=0;aa){var g=t.gravity*h/y,p=t.gravity*d/y;c.offsetX+=g,c.offsetY+=p}}}}},Hp=function(e,t){var a=[],n=0,i=-1;for(a.push.apply(a,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var s=a[n++],o=e.idToIndex[s],u=e.layoutNodes[o],l=u.children;if(0a)var i={x:a*e/n,y:a*t/n};else var i={x:e,y:t};return i},of=function(e,t){var a=e.parentId;if(a!=null){var n=t.layoutNodes[t.idToIndex[a]],i=!1;if((n.maxX==null||e.maxX+n.padRight>n.maxX)&&(n.maxX=e.maxX+n.padRight,i=!0),(n.minX==null||e.minX-n.padLeftn.maxY)&&(n.maxY=e.maxY+n.padBottom,i=!0),(n.minY==null||e.minY-n.padTopp&&(d+=g+t.componentSpacing,h=0,y=0,g=0)}}},Up={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function uf(r){this.options=ye({},Up,r)}uf.prototype.run=function(){var r=this.options,e=r,t=r.cy,a=e.eles,n=a.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=yr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(i.h===0||i.w===0)a.nodes().layoutPositions(this,e,function(U){return{x:i.x1,y:i.y1}});else{var s=n.size(),o=Math.sqrt(s*i.h/i.w),u=Math.round(o),l=Math.round(i.w/i.h*o),v=function(J){if(J==null)return Math.min(u,l);var Z=Math.min(u,l);Z==u?u=J:l=J},f=function(J){if(J==null)return Math.max(u,l);var Z=Math.max(u,l);Z==u?u=J:l=J},c=e.rows,h=e.cols!=null?e.cols:e.columns;if(c!=null&&h!=null)u=c,l=h;else if(c!=null&&h==null)u=c,l=Math.ceil(s/u);else if(c==null&&h!=null)l=h,u=Math.ceil(s/l);else if(l*u>s){var d=v(),y=f();(d-1)*y>=s?v(d-1):(y-1)*d>=s&&f(y-1)}else for(;l*u=s?f(p+1):v(g+1)}var m=i.w/l,b=i.h/u;if(e.condense&&(m=0,b=0),e.avoidOverlap)for(var w=0;w=l&&(L=0,R++)},M={},O=0;O(L=Od(r,e,I[M],I[M+1],I[M+2],I[M+3])))return g(x,L),!0}else if(k.edgeType==="bezier"||k.edgeType==="multibezier"||k.edgeType==="self"||k.edgeType==="compound"){for(var I=k.allpts,M=0;M+5(L=Id(r,e,I[M],I[M+1],I[M+2],I[M+3],I[M+4],I[M+5])))return g(x,L),!0}for(var O=O||T.source,q=q||T.target,_=n.getArrowWidth(D,B),N=[{name:"source",x:k.arrowStartX,y:k.arrowStartY,angle:k.srcArrowAngle},{name:"target",x:k.arrowEndX,y:k.arrowEndY,angle:k.tgtArrowAngle},{name:"mid-source",x:k.midX,y:k.midY,angle:k.midsrcArrowAngle},{name:"mid-target",x:k.midX,y:k.midY,angle:k.midtgtArrowAngle}],M=0;M0&&(p(O),p(q))}function b(x,T,k){return xr(x,T,k)}function w(x,T){var k=x._private,D=c,B;T?B=T+"-":B="",x.boundingBox();var P=k.labelBounds[T||"main"],A=x.pstyle(B+"label").value,R=x.pstyle("text-events").strValue==="yes";if(!(!R||!A)){var L=b(k.rscratch,"labelX",T),I=b(k.rscratch,"labelY",T),M=b(k.rscratch,"labelAngle",T),O=x.pstyle(B+"text-margin-x").pfValue,q=x.pstyle(B+"text-margin-y").pfValue,_=P.x1-D-O,N=P.x2+D-O,F=P.y1-D-q,U=P.y2+D-q;if(M){var J=Math.cos(M),Z=Math.sin(M),j=function(Y,te){return Y=Y-L,te=te-I,{x:Y*J-te*Z+L,y:Y*Z+te*J+I}},re=j(_,F),ne=j(_,U),Q=j(N,F),V=j(N,U),H=[re.x+O,re.y+q,Q.x+O,Q.y+q,V.x+O,V.y+q,ne.x+O,ne.y+q];if(Er(r,e,H))return g(x),!0}else if(at(P,r,e))return g(x),!0}}for(var E=s.length-1;E>=0;E--){var C=s[E];C.isNode()?p(C)||w(C):m(C)||w(C)||w(C,"source")||w(C,"target")}return o};Rt.getAllInBox=function(r,e,t,a){var n=this.getCachedZSortedEles().interactive,i=this.cy.zoom(),s=2/i,o=[],u=Math.min(r,t),l=Math.max(r,t),v=Math.min(e,a),f=Math.max(e,a);r=u,t=l,e=v,a=f;var c=yr({x1:r,y1:e,x2:t,y2:a}),h=[{x:c.x1,y:c.y1},{x:c.x2,y:c.y1},{x:c.x2,y:c.y2},{x:c.x1,y:c.y2}],d=[[h[0],h[1]],[h[1],h[2]],[h[2],h[3]],[h[3],h[0]]];function y(Y,te,ce){return xr(Y,te,ce)}function g(Y,te){var ce=Y._private,Be=s,we="";Y.boundingBox();var me=ce.labelBounds.main;if(!me)return null;var ge=y(ce.rscratch,"labelX",te),se=y(ce.rscratch,"labelY",te),de=y(ce.rscratch,"labelAngle",te),fe=Y.pstyle(we+"text-margin-x").pfValue,xe=Y.pstyle(we+"text-margin-y").pfValue,be=me.x1-Be-fe,Se=me.x2+Be-fe,De=me.y1-Be-xe,Oe=me.y2+Be-xe;if(de){var Le=Math.cos(de),Ae=Math.sin(de),X=function(z,G){return z=z-ge,G=G-se,{x:z*Le-G*Ae+ge,y:z*Ae+G*Le+se}};return[X(be,De),X(Se,De),X(Se,Oe),X(be,Oe)]}else return[{x:be,y:De},{x:Se,y:De},{x:Se,y:Oe},{x:be,y:Oe}]}function p(Y,te,ce,Be){function we(me,ge,se){return(se.y-me.y)*(ge.x-me.x)>(ge.y-me.y)*(se.x-me.x)}return we(Y,ce,Be)!==we(te,ce,Be)&&we(Y,te,ce)!==we(Y,te,Be)}for(var m=0;m0?-(Math.PI-e.ang):Math.PI+e.ang},Jp=function(e,t,a,n,i){if(e!==Pl?Al(t,e,Vr):Qp(kr,Vr),Al(t,a,kr),Dl=Vr.nx*kr.ny-Vr.ny*kr.nx,Bl=Vr.nx*kr.nx-Vr.ny*-kr.ny,$r=Math.asin(Math.max(-1,Math.min(1,Dl))),Math.abs($r)<1e-6){zs=t.x,Fs=t.y,Et=zt=0;return}Tt=1,dn=!1,Bl<0?$r<0?$r=Math.PI+$r:($r=Math.PI-$r,Tt=-1,dn=!0):$r>0&&(Tt=-1,dn=!0),t.radius!==void 0?zt=t.radius:zt=n,bt=$r/2,rn=Math.min(Vr.len/2,kr.len/2),i?(zr=Math.abs(Math.cos(bt)*zt/Math.sin(bt)),zr>rn?(zr=rn,Et=Math.abs(zr*Math.sin(bt)/Math.cos(bt))):Et=zt):(zr=Math.min(rn,zt),Et=Math.abs(zr*Math.sin(bt)/Math.cos(bt))),Vs=t.x+kr.nx*zr,qs=t.y+kr.ny*zr,zs=Vs-kr.ny*Et*Tt,Fs=qs+kr.nx*Et*Tt,cf=t.x+Vr.nx*zr,df=t.y+Vr.ny*zr,Pl=t};function hf(r,e){e.radius===0?r.lineTo(e.cx,e.cy):r.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function ho(r,e,t,a){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return a===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(Jp(r,e,t,a,n),{cx:zs,cy:Fs,radius:Et,startX:cf,startY:df,stopX:Vs,stopY:qs,startAngle:Vr.ang+Math.PI/2*Tt,endAngle:kr.ang-Math.PI/2*Tt,counterClockwise:dn})}var Aa=.01,jp=Math.sqrt(2*Aa),gr={};gr.findMidptPtsEtc=function(r,e){var t=e.posPts,a=e.intersectionPts,n=e.vectorNormInverse,i,s=r.pstyle("source-endpoint"),o=r.pstyle("target-endpoint"),u=s.units!=null&&o.units!=null,l=function(E,C,x,T){var k=T-C,D=x-E,B=Math.sqrt(D*D+k*k);return{x:-k/B,y:D/B}},v=r.pstyle("edge-distances").value;switch(v){case"node-position":i=t;break;case"intersection":i=a;break;case"endpoints":{if(u){var f=this.manualEndptToPx(r.source()[0],s),c=Qe(f,2),h=c[0],d=c[1],y=this.manualEndptToPx(r.target()[0],o),g=Qe(y,2),p=g[0],m=g[1],b={x1:h,y1:d,x2:p,y2:m};n=l(h,d,p,m),i=b}else ze("Edge ".concat(r.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=a;break}}return{midptPts:i,vectorNormInverse:n}};gr.findHaystackPoints=function(r){for(var e=0;e0?Math.max(G-$,0):Math.min(G+$,0)},A=P(D,T),R=P(B,k),L=!1;m===l?p=Math.abs(A)>Math.abs(R)?n:a:m===u||m===o?(p=a,L=!0):(m===i||m===s)&&(p=n,L=!0);var I=p===a,M=I?R:A,O=I?B:D,q=eo(O),_=!1;!(L&&(w||C))&&(m===o&&O<0||m===u&&O>0||m===i&&O>0||m===s&&O<0)&&(q*=-1,M=q*Math.abs(M),_=!0);var N;if(w){var F=E<0?1+E:E;N=F*M}else{var U=E<0?M:0;N=U+E*q}var J=function(G){return Math.abs(G)=Math.abs(M)},Z=J(N),j=J(Math.abs(M)-Math.abs(N)),re=Z||j;if(re&&!_)if(I){var ne=Math.abs(O)<=c/2,Q=Math.abs(D)<=h/2;if(ne){var V=(v.x1+v.x2)/2,H=v.y1,W=v.y2;t.segpts=[V,H,V,W]}else if(Q){var Y=(v.y1+v.y2)/2,te=v.x1,ce=v.x2;t.segpts=[te,Y,ce,Y]}else t.segpts=[v.x1,v.y2]}else{var Be=Math.abs(O)<=f/2,we=Math.abs(B)<=d/2;if(Be){var me=(v.y1+v.y2)/2,ge=v.x1,se=v.x2;t.segpts=[ge,me,se,me]}else if(we){var de=(v.x1+v.x2)/2,fe=v.y1,xe=v.y2;t.segpts=[de,fe,de,xe]}else t.segpts=[v.x2,v.y1]}else if(I){var be=v.y1+N+(g?c/2*q:0),Se=v.x1,De=v.x2;t.segpts=[Se,be,De,be]}else{var Oe=v.x1+N+(g?f/2*q:0),Le=v.y1,Ae=v.y2;t.segpts=[Oe,Le,Oe,Ae]}if(t.isRound){var X=r.pstyle("taxi-radius").value,S=r.pstyle("radius-type").value[0]==="arc-radius";t.radii=new Array(t.segpts.length/2).fill(X),t.isArcRadius=new Array(t.segpts.length/2).fill(S)}};gr.tryToCorrectInvalidPoints=function(r,e){var t=r._private.rscratch;if(t.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,s=e.srcH,o=e.tgtW,u=e.tgtH,l=e.srcShape,v=e.tgtShape,f=e.srcCornerRadius,c=e.tgtCornerRadius,h=e.srcRs,d=e.tgtRs,y=!ae(t.startX)||!ae(t.startY),g=!ae(t.arrowStartX)||!ae(t.arrowStartY),p=!ae(t.endX)||!ae(t.endY),m=!ae(t.arrowEndX)||!ae(t.arrowEndY),b=3,w=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth,E=b*w,C=Dt({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.startX,y:t.startY}),x=CO.poolIndex()){var q=M;M=O,O=q}var _=A.srcPos=M.position(),N=A.tgtPos=O.position(),F=A.srcW=M.outerWidth(),U=A.srcH=M.outerHeight(),J=A.tgtW=O.outerWidth(),Z=A.tgtH=O.outerHeight(),j=A.srcShape=t.nodeShapes[e.getNodeShape(M)],re=A.tgtShape=t.nodeShapes[e.getNodeShape(O)],ne=A.srcCornerRadius=M.pstyle("corner-radius").value==="auto"?"auto":M.pstyle("corner-radius").pfValue,Q=A.tgtCornerRadius=O.pstyle("corner-radius").value==="auto"?"auto":O.pstyle("corner-radius").pfValue,V=A.tgtRs=O._private.rscratch,H=A.srcRs=M._private.rscratch;A.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var W=0;W=jp||(De=Math.sqrt(Math.max(Se*Se,Aa)+Math.max(be*be,Aa)));var Oe=A.vector={x:Se,y:be},Le=A.vectorNorm={x:Oe.x/De,y:Oe.y/De},Ae={x:-Le.y,y:Le.x};A.nodesOverlap=!ae(De)||re.checkPoint(me[0],me[1],0,J,Z,N.x,N.y,Q,V)||j.checkPoint(se[0],se[1],0,F,U,_.x,_.y,ne,H),A.vectorNormInverse=Ae,R={nodesOverlap:A.nodesOverlap,dirCounts:A.dirCounts,calculatedIntersection:!0,hasBezier:A.hasBezier,hasUnbundled:A.hasUnbundled,eles:A.eles,srcPos:N,srcRs:V,tgtPos:_,tgtRs:H,srcW:J,srcH:Z,tgtW:F,tgtH:U,srcIntn:de,tgtIntn:ge,srcShape:re,tgtShape:j,posPts:{x1:xe.x2,y1:xe.y2,x2:xe.x1,y2:xe.y1},intersectionPts:{x1:fe.x2,y1:fe.y2,x2:fe.x1,y2:fe.y1},vector:{x:-Oe.x,y:-Oe.y},vectorNorm:{x:-Le.x,y:-Le.y},vectorNormInverse:{x:-Ae.x,y:-Ae.y}}}var X=we?R:A;te.nodesOverlap=X.nodesOverlap,te.srcIntn=X.srcIntn,te.tgtIntn=X.tgtIntn,te.isRound=ce.startsWith("round"),n&&(M.isParent()||M.isChild()||O.isParent()||O.isChild())&&(M.parents().anySame(O)||O.parents().anySame(M)||M.same(O)&&M.isParent())?e.findCompoundLoopPoints(Y,X,W,Be):M===O?e.findLoopPoints(Y,X,W,Be):ce.endsWith("segments")?e.findSegmentsPoints(Y,X):ce.endsWith("taxi")?e.findTaxiPoints(Y,X):ce==="straight"||!Be&&A.eles.length%2===1&&W===Math.floor(A.eles.length/2)?e.findStraightEdgePoints(Y):e.findBezierPoints(Y,X,W,Be,we),e.findEndpoints(Y),e.tryToCorrectInvalidPoints(Y,X),e.checkForInvalidEdgeWarning(Y),e.storeAllpts(Y),e.storeEdgeProjections(Y),e.calculateArrowAngles(Y),e.recalculateEdgeLabelProjections(Y),e.calculateLabelAngles(Y)}},x=0;x0){var me=l,ge=xt(me,Gt(s)),se=xt(me,Gt(we)),de=ge;if(se2){var fe=xt(me,{x:we[2],y:we[3]});fe0){var K=v,le=xt(K,Gt(s)),ee=xt(K,Gt($)),ie=le;if(ee2){var oe=xt(K,{x:$[2],y:$[3]});oe=d||x){g={cp:w,segment:C};break}}if(g)break}var T=g.cp,k=g.segment,D=(d-p)/k.length,B=k.t1-k.t0,P=h?k.t0+B*D:k.t1-B*D;P=Ta(0,P,1),e=$t(T.p0,T.p1,T.p2,P),c=ry(T.p0,T.p1,T.p2,P);break}case"straight":case"segments":case"haystack":{for(var A=0,R,L,I,M,O=a.allpts.length,q=0;q+3=d));q+=2);var _=d-L,N=_/R;N=Ta(0,N,1),e=Cd(I,M,N),c=yf(I,M);break}}s("labelX",f,e.x),s("labelY",f,e.y),s("labelAutoAngle",f,c)}};l("source"),l("target"),this.applyLabelDimensions(r)}};Gr.applyLabelDimensions=function(r){this.applyPrefixedLabelDimensions(r),r.isEdge()&&(this.applyPrefixedLabelDimensions(r,"source"),this.applyPrefixedLabelDimensions(r,"target"))};Gr.applyPrefixedLabelDimensions=function(r,e){var t=r._private,a=this.getLabelText(r,e),n=kt(a,r._private.labelDimsKey);if(xr(t.rscratch,"prefixedLabelDimsKey",e)!==n){Ur(t.rscratch,"prefixedLabelDimsKey",e,n);var i=this.calculateLabelDimensions(r,a),s=r.pstyle("line-height").pfValue,o=r.pstyle("text-wrap").strValue,u=xr(t.rscratch,"labelWrapCachedLines",e)||[],l=o!=="wrap"?1:Math.max(u.length,1),v=i.height/l,f=v*s,c=i.width,h=i.height+(l-1)*(s-1)*v;Ur(t.rstyle,"labelWidth",e,c),Ur(t.rscratch,"labelWidth",e,c),Ur(t.rstyle,"labelHeight",e,h),Ur(t.rscratch,"labelHeight",e,h),Ur(t.rscratch,"labelLineHeight",e,f)}};Gr.getLabelText=function(r,e){var t=r._private,a=e?e+"-":"",n=r.pstyle(a+"label").strValue,i=r.pstyle("text-transform").value,s=function(U,J){return J?(Ur(t.rscratch,U,e,J),J):xr(t.rscratch,U,e)};if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var o=r.pstyle("text-wrap").value;if(o==="wrap"){var u=s("labelKey");if(u!=null&&s("labelWrapKey")===u)return s("labelWrapCachedText");for(var l="",v=n.split(`
+`),f=r.pstyle("text-max-width").pfValue,c=r.pstyle("text-overflow-wrap").value,h=c==="anywhere",d=[],y=/[\s\u200b]+|$/g,g=0;gf){var E=p.matchAll(y),C="",x=0,T=Cr(E),k;try{for(T.s();!(k=T.n()).done;){var D=k.value,B=D[0],P=p.substring(x,D.index);x=D.index+B.length;var A=C.length===0?P:C+P+B,R=this.calculateLabelDimensions(r,A),L=R.width;L<=f?C+=P+B:(C&&d.push(C),C=P+B)}}catch(F){T.e(F)}finally{T.f()}C.match(/^[\s\u200b]+$/)||d.push(C)}else d.push(p)}s("labelWrapCachedLines",d),n=s("labelWrapCachedText",d.join(`
+`)),s("labelWrapKey",u)}else if(o==="ellipsis"){var I=r.pstyle("text-max-width").pfValue,M="",O="…",q=!1;if(this.calculateLabelDimensions(r,n).widthI)break;M+=n[_],_===n.length-1&&(q=!0)}return q||(M+=O),M}return n};Gr.getLabelJustification=function(r){var e=r.pstyle("text-justification").strValue,t=r.pstyle("text-halign").strValue;if(e==="auto")if(r.isNode())switch(t){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};Gr.calculateLabelDimensions=function(r,e){var t=this,a=t.cy.window(),n=a.document,i=0,s=r.pstyle("font-style").strValue,o=r.pstyle("font-size").pfValue,u=r.pstyle("font-family").strValue,l=r.pstyle("font-weight").strValue,v=this.labelCalcCanvas,f=this.labelCalcCanvasContext;if(!v){v=this.labelCalcCanvas=n.createElement("canvas"),f=this.labelCalcCanvasContext=v.getContext("2d");var c=v.style;c.position="absolute",c.left="-9999px",c.top="-9999px",c.zIndex="-1",c.visibility="hidden",c.pointerEvents="none"}f.font="".concat(s," ").concat(l," ").concat(o,"px ").concat(u);for(var h=0,d=0,y=e.split(`
+`),g=0;g1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(s),o)for(var u=0;u=r.desktopTapThreshold2}var or=i(S);ar&&(r.hoverData.tapholdCancelled=!0);var Nr=function(){var Sr=r.hoverData.dragDelta=r.hoverData.dragDelta||[];Sr.length===0?(Sr.push(ke[0]),Sr.push(ke[1])):(Sr[0]+=ke[0],Sr[1]+=ke[1])};G=!0,n(Ee,["mousemove","vmousemove","tapdrag"],S,{x:ee[0],y:ee[1]});var We=function(Sr){return{originalEvent:S,type:Sr,position:{x:ee[0],y:ee[1]}}},Wr=function(){r.data.bgActivePosistion=void 0,r.hoverData.selecting||$.emit(We("boxstart")),pe[4]=1,r.hoverData.selecting=!0,r.redrawHint("select",!0),r.redraw()};if(r.hoverData.which===3){if(ar){var Ar=We("cxtdrag");ve?ve.emit(Ar):$.emit(Ar),r.hoverData.cxtDragged=!0,(!r.hoverData.cxtOver||Ee!==r.hoverData.cxtOver)&&(r.hoverData.cxtOver&&r.hoverData.cxtOver.emit(We("cxtdragout")),r.hoverData.cxtOver=Ee,Ee&&Ee.emit(We("cxtdragover")))}}else if(r.hoverData.dragging){if(G=!0,$.panningEnabled()&&$.userPanningEnabled()){var Jr;if(r.hoverData.justStartedPan){var Ha=r.hoverData.mdownPos;Jr={x:(ee[0]-Ha[0])*K,y:(ee[1]-Ha[1])*K},r.hoverData.justStartedPan=!1}else Jr={x:ke[0]*K,y:ke[1]*K};$.panBy(Jr),$.emit(We("dragpan")),r.hoverData.dragged=!0}ee=r.projectIntoViewport(S.clientX,S.clientY)}else if(pe[4]==1&&(ve==null||ve.pannable())){if(ar){if(!r.hoverData.dragging&&$.boxSelectionEnabled()&&(or||!$.panningEnabled()||!$.userPanningEnabled()))Wr();else if(!r.hoverData.selecting&&$.panningEnabled()&&$.userPanningEnabled()){var mt=s(ve,r.hoverData.downs);mt&&(r.hoverData.dragging=!0,r.hoverData.justStartedPan=!0,pe[4]=0,r.data.bgActivePosistion=Gt(ie),r.redrawHint("select",!0),r.redraw())}ve&&ve.pannable()&&ve.active()&&ve.unactivate()}}else{if(ve&&ve.pannable()&&ve.active()&&ve.unactivate(),(!ve||!ve.grabbed())&&Ee!=Ce&&(Ce&&n(Ce,["mouseout","tapdragout"],S,{x:ee[0],y:ee[1]}),Ee&&n(Ee,["mouseover","tapdragover"],S,{x:ee[0],y:ee[1]}),r.hoverData.last=Ee),ve)if(ar){if($.boxSelectionEnabled()&&or)ve&&ve.grabbed()&&(y(Pe),ve.emit(We("freeon")),Pe.emit(We("free")),r.dragData.didDrag&&(ve.emit(We("dragfreeon")),Pe.emit(We("dragfree")))),Wr();else if(ve&&ve.grabbed()&&r.nodeIsDraggable(ve)){var br=!r.dragData.didDrag;br&&r.redrawHint("eles",!0),r.dragData.didDrag=!0,r.hoverData.draggingEles||h(Pe,{inDragLayer:!0});var cr={x:0,y:0};if(ae(ke[0])&&ae(ke[1])&&(cr.x+=ke[0],cr.y+=ke[1],br)){var wr=r.hoverData.dragDelta;wr&&ae(wr[0])&&ae(wr[1])&&(cr.x+=wr[0],cr.y+=wr[1])}r.hoverData.draggingEles=!0,Pe.silentShift(cr).emit(We("position")).emit(We("drag")),r.redrawHint("drag",!0),r.redraw()}}else Nr();G=!0}if(pe[2]=ee[0],pe[3]=ee[1],G)return S.stopPropagation&&S.stopPropagation(),S.preventDefault&&S.preventDefault(),!1}},!1);var D,B,P;r.registerBinding(e,"mouseup",function(S){if(!(r.hoverData.which===1&&S.which!==1&&r.hoverData.capture)){var z=r.hoverData.capture;if(z){r.hoverData.capture=!1;var G=r.cy,$=r.projectIntoViewport(S.clientX,S.clientY),K=r.selection,le=r.findNearestElement($[0],$[1],!0,!1),ee=r.dragData.possibleDragElements,ie=r.hoverData.down,oe=i(S);r.data.bgActivePosistion&&(r.redrawHint("select",!0),r.redraw()),r.hoverData.tapholdCancelled=!0,r.data.bgActivePosistion=void 0,ie&&ie.unactivate();var pe=function(Ue){return{originalEvent:S,type:Ue,position:{x:$[0],y:$[1]}}};if(r.hoverData.which===3){var Ee=pe("cxttapend");if(ie?ie.emit(Ee):G.emit(Ee),!r.hoverData.cxtDragged){var Ce=pe("cxttap");ie?ie.emit(Ce):G.emit(Ce)}r.hoverData.cxtDragged=!1,r.hoverData.which=null}else if(r.hoverData.which===1){if(n(le,["mouseup","tapend","vmouseup"],S,{x:$[0],y:$[1]}),!r.dragData.didDrag&&!r.hoverData.dragged&&!r.hoverData.selecting&&!r.hoverData.isOverThresholdDrag&&(n(ie,["click","tap","vclick"],S,{x:$[0],y:$[1]}),B=!1,S.timeStamp-P<=G.multiClickDebounceTime()?(D&&clearTimeout(D),B=!0,P=null,n(ie,["dblclick","dbltap","vdblclick"],S,{x:$[0],y:$[1]})):(D=setTimeout(function(){B||n(ie,["oneclick","onetap","voneclick"],S,{x:$[0],y:$[1]})},G.multiClickDebounceTime()),P=S.timeStamp)),ie==null&&!r.dragData.didDrag&&!r.hoverData.selecting&&!r.hoverData.dragged&&!i(S)&&(G.$(t).unselect(["tapunselect"]),ee.length>0&&r.redrawHint("eles",!0),r.dragData.possibleDragElements=ee=G.collection()),le==ie&&!r.dragData.didDrag&&!r.hoverData.selecting&&le!=null&&le._private.selectable&&(r.hoverData.dragging||(G.selectionType()==="additive"||oe?le.selected()?le.unselect(["tapunselect"]):le.select(["tapselect"]):oe||(G.$(t).unmerge(le).unselect(["tapunselect"]),le.select(["tapselect"]))),r.redrawHint("eles",!0)),r.hoverData.selecting){var ve=G.collection(r.getAllInBox(K[0],K[1],K[2],K[3]));r.redrawHint("select",!0),ve.length>0&&r.redrawHint("eles",!0),G.emit(pe("boxend"));var ke=function(Ue){return Ue.selectable()&&!Ue.selected()};G.selectionType()==="additive"||oe||G.$(t).unmerge(ve).unselect(),ve.emit(pe("box")).stdFilter(ke).select().emit(pe("boxselect")),r.redraw()}if(r.hoverData.dragging&&(r.hoverData.dragging=!1,r.redrawHint("select",!0),r.redrawHint("eles",!0),r.redraw()),!K[4]){r.redrawHint("drag",!0),r.redrawHint("eles",!0);var Pe=ie&&ie.grabbed();y(ee),Pe&&(ie.emit(pe("freeon")),ee.emit(pe("free")),r.dragData.didDrag&&(ie.emit(pe("dragfreeon")),ee.emit(pe("dragfree"))))}}K[4]=0,r.hoverData.down=null,r.hoverData.cxtStarted=!1,r.hoverData.draggingEles=!1,r.hoverData.selecting=!1,r.hoverData.isOverThresholdDrag=!1,r.dragData.didDrag=!1,r.hoverData.dragged=!1,r.hoverData.dragDelta=[],r.hoverData.mdownPos=null,r.hoverData.mdownGPos=null,r.hoverData.which=null}}},!1);var A=[],R=4,L,I=1e5,M=function(S,z){for(var G=0;G=R){var $=A;if(L=M($,5),!L){var K=Math.abs($[0]);L=O($)&&K>5}if(L)for(var le=0;le<$.length;le++)I=Math.min(Math.abs($[le]),I)}else A.push(G),z=!0;else L&&(I=Math.min(Math.abs(G),I));if(!r.scrollingPage){var ee=r.cy,ie=ee.zoom(),oe=ee.pan(),pe=r.projectIntoViewport(S.clientX,S.clientY),Ee=[pe[0]*ie+oe.x,pe[1]*ie+oe.y];if(r.hoverData.draggingEles||r.hoverData.dragging||r.hoverData.cxtStarted||x()){S.preventDefault();return}if(ee.panningEnabled()&&ee.userPanningEnabled()&&ee.zoomingEnabled()&&ee.userZoomingEnabled()){S.preventDefault(),r.data.wheelZooming=!0,clearTimeout(r.data.wheelTimeout),r.data.wheelTimeout=setTimeout(function(){r.data.wheelZooming=!1,r.redrawHint("eles",!0),r.redraw()},150);var Ce;z&&Math.abs(G)>5&&(G=eo(G)*5),Ce=G/-250,L&&(Ce/=I,Ce*=3),Ce=Ce*r.wheelSensitivity;var ve=S.deltaMode===1;ve&&(Ce*=33);var ke=ee.zoom()*Math.pow(10,Ce);S.type==="gesturechange"&&(ke=r.gestureStartZoom*S.scale),ee.zoom({level:ke,renderedPosition:{x:Ee[0],y:Ee[1]}}),ee.emit({type:S.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:S,position:{x:pe[0],y:pe[1]}})}}}};r.registerBinding(r.container,"wheel",q,!0),r.registerBinding(e,"scroll",function(S){r.scrollingPage=!0,clearTimeout(r.scrollingPageTimeout),r.scrollingPageTimeout=setTimeout(function(){r.scrollingPage=!1},250)},!0),r.registerBinding(r.container,"gesturestart",function(S){r.gestureStartZoom=r.cy.zoom(),r.hasTouchStarted||S.preventDefault()},!0),r.registerBinding(r.container,"gesturechange",function(X){r.hasTouchStarted||q(X)},!0),r.registerBinding(r.container,"mouseout",function(S){var z=r.projectIntoViewport(S.clientX,S.clientY);r.cy.emit({originalEvent:S,type:"mouseout",position:{x:z[0],y:z[1]}})},!1),r.registerBinding(r.container,"mouseover",function(S){var z=r.projectIntoViewport(S.clientX,S.clientY);r.cy.emit({originalEvent:S,type:"mouseover",position:{x:z[0],y:z[1]}})},!1);var _,N,F,U,J,Z,j,re,ne,Q,V,H,W,Y=function(S,z,G,$){return Math.sqrt((G-S)*(G-S)+($-z)*($-z))},te=function(S,z,G,$){return(G-S)*(G-S)+($-z)*($-z)},ce;r.registerBinding(r.container,"touchstart",ce=function(S){if(r.hasTouchStarted=!0,!!T(S)){p(),r.touchData.capture=!0,r.data.bgActivePosistion=void 0;var z=r.cy,G=r.touchData.now,$=r.touchData.earlier;if(S.touches[0]){var K=r.projectIntoViewport(S.touches[0].clientX,S.touches[0].clientY);G[0]=K[0],G[1]=K[1]}if(S.touches[1]){var K=r.projectIntoViewport(S.touches[1].clientX,S.touches[1].clientY);G[2]=K[0],G[3]=K[1]}if(S.touches[2]){var K=r.projectIntoViewport(S.touches[2].clientX,S.touches[2].clientY);G[4]=K[0],G[5]=K[1]}var le=function(or){return{originalEvent:S,type:or,position:{x:G[0],y:G[1]}}};if(S.touches[1]){r.touchData.singleTouchMoved=!0,y(r.dragData.touchDragEles);var ee=r.findContainerClientCoords();ne=ee[0],Q=ee[1],V=ee[2],H=ee[3],_=S.touches[0].clientX-ne,N=S.touches[0].clientY-Q,F=S.touches[1].clientX-ne,U=S.touches[1].clientY-Q,W=0<=_&&_<=V&&0<=F&&F<=V&&0<=N&&N<=H&&0<=U&&U<=H;var ie=z.pan(),oe=z.zoom();J=Y(_,N,F,U),Z=te(_,N,F,U),j=[(_+F)/2,(N+U)/2],re=[(j[0]-ie.x)/oe,(j[1]-ie.y)/oe];var pe=200,Ee=pe*pe;if(Z=1){for(var Pr=r.touchData.startPosition=[null,null,null,null,null,null],Ke=0;Ke=r.touchTapThreshold2}if(z&&r.touchData.cxt){S.preventDefault();var Ke=S.touches[0].clientX-ne,Ye=S.touches[0].clientY-Q,Je=S.touches[1].clientX-ne,or=S.touches[1].clientY-Q,Nr=te(Ke,Ye,Je,or),We=Nr/Z,Wr=150,Ar=Wr*Wr,Jr=1.5,Ha=Jr*Jr;if(We>=Ha||Nr>=Ar){r.touchData.cxt=!1,r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var mt=oe("cxttapend");r.touchData.start?(r.touchData.start.unactivate().emit(mt),r.touchData.start=null):$.emit(mt)}}if(z&&r.touchData.cxt){var mt=oe("cxtdrag");r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.touchData.start?r.touchData.start.emit(mt):$.emit(mt),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxtDragged=!0;var br=r.findNearestElement(K[0],K[1],!0,!0);(!r.touchData.cxtOver||br!==r.touchData.cxtOver)&&(r.touchData.cxtOver&&r.touchData.cxtOver.emit(oe("cxtdragout")),r.touchData.cxtOver=br,br&&br.emit(oe("cxtdragover")))}else if(z&&S.touches[2]&&$.boxSelectionEnabled())S.preventDefault(),r.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,r.touchData.selecting||$.emit(oe("boxstart")),r.touchData.selecting=!0,r.touchData.didSelect=!0,G[4]=1,!G||G.length===0||G[0]===void 0?(G[0]=(K[0]+K[2]+K[4])/3,G[1]=(K[1]+K[3]+K[5])/3,G[2]=(K[0]+K[2]+K[4])/3+1,G[3]=(K[1]+K[3]+K[5])/3+1):(G[2]=(K[0]+K[2]+K[4])/3,G[3]=(K[1]+K[3]+K[5])/3),r.redrawHint("select",!0),r.redraw();else if(z&&S.touches[1]&&!r.touchData.didSelect&&$.zoomingEnabled()&&$.panningEnabled()&&$.userZoomingEnabled()&&$.userPanningEnabled()){S.preventDefault(),r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var cr=r.dragData.touchDragEles;if(cr){r.redrawHint("drag",!0);for(var wr=0;wr0&&!r.hoverData.draggingEles&&!r.swipePanning&&r.data.bgActivePosistion!=null&&(r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.redraw())}},!1);var we;r.registerBinding(e,"touchcancel",we=function(S){var z=r.touchData.start;r.touchData.capture=!1,z&&z.unactivate()});var me,ge,se,de;if(r.registerBinding(e,"touchend",me=function(S){var z=r.touchData.start,G=r.touchData.capture;if(G)S.touches.length===0&&(r.touchData.capture=!1),S.preventDefault();else return;var $=r.selection;r.swipePanning=!1,r.hoverData.draggingEles=!1;var K=r.cy,le=K.zoom(),ee=r.touchData.now,ie=r.touchData.earlier;if(S.touches[0]){var oe=r.projectIntoViewport(S.touches[0].clientX,S.touches[0].clientY);ee[0]=oe[0],ee[1]=oe[1]}if(S.touches[1]){var oe=r.projectIntoViewport(S.touches[1].clientX,S.touches[1].clientY);ee[2]=oe[0],ee[3]=oe[1]}if(S.touches[2]){var oe=r.projectIntoViewport(S.touches[2].clientX,S.touches[2].clientY);ee[4]=oe[0],ee[5]=oe[1]}var pe=function(Ar){return{originalEvent:S,type:Ar,position:{x:ee[0],y:ee[1]}}};z&&z.unactivate();var Ee;if(r.touchData.cxt){if(Ee=pe("cxttapend"),z?z.emit(Ee):K.emit(Ee),!r.touchData.cxtDragged){var Ce=pe("cxttap");z?z.emit(Ce):K.emit(Ce)}r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!1,r.touchData.start=null,r.redraw();return}if(!S.touches[2]&&K.boxSelectionEnabled()&&r.touchData.selecting){r.touchData.selecting=!1;var ve=K.collection(r.getAllInBox($[0],$[1],$[2],$[3]));$[0]=void 0,$[1]=void 0,$[2]=void 0,$[3]=void 0,$[4]=0,r.redrawHint("select",!0),K.emit(pe("boxend"));var ke=function(Ar){return Ar.selectable()&&!Ar.selected()};ve.emit(pe("box")).stdFilter(ke).select().emit(pe("boxselect")),ve.nonempty()&&r.redrawHint("eles",!0),r.redraw()}if(z!=null&&z.unactivate(),S.touches[2])r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);else if(!S.touches[1]){if(!S.touches[0]){if(!S.touches[0]){r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Pe=r.dragData.touchDragEles;if(z!=null){var ar=z._private.grabbed;y(Pe),r.redrawHint("drag",!0),r.redrawHint("eles",!0),ar&&(z.emit(pe("freeon")),Pe.emit(pe("free")),r.dragData.didDrag&&(z.emit(pe("dragfreeon")),Pe.emit(pe("dragfree")))),n(z,["touchend","tapend","vmouseup","tapdragout"],S,{x:ee[0],y:ee[1]}),z.unactivate(),r.touchData.start=null}else{var Ue=r.findNearestElement(ee[0],ee[1],!0,!0);n(Ue,["touchend","tapend","vmouseup","tapdragout"],S,{x:ee[0],y:ee[1]})}var Pr=r.touchData.startPosition[0]-ee[0],Ke=Pr*Pr,Ye=r.touchData.startPosition[1]-ee[1],Je=Ye*Ye,or=Ke+Je,Nr=or*le*le;r.touchData.singleTouchMoved||(z||K.$(":selected").unselect(["tapunselect"]),n(z,["tap","vclick"],S,{x:ee[0],y:ee[1]}),ge=!1,S.timeStamp-de<=K.multiClickDebounceTime()?(se&&clearTimeout(se),ge=!0,de=null,n(z,["dbltap","vdblclick"],S,{x:ee[0],y:ee[1]})):(se=setTimeout(function(){ge||n(z,["onetap","voneclick"],S,{x:ee[0],y:ee[1]})},K.multiClickDebounceTime()),de=S.timeStamp)),z!=null&&!r.dragData.didDrag&&z._private.selectable&&Nr"u"){var fe=[],xe=function(S){return{clientX:S.clientX,clientY:S.clientY,force:1,identifier:S.pointerId,pageX:S.pageX,pageY:S.pageY,radiusX:S.width/2,radiusY:S.height/2,screenX:S.screenX,screenY:S.screenY,target:S.target}},be=function(S){return{event:S,touch:xe(S)}},Se=function(S){fe.push(be(S))},De=function(S){for(var z=0;z0)return F[0]}return null},d=Object.keys(c),y=0;y0?h:mv(i,s,e,t,a,n,o,u)},checkPoint:function(e,t,a,n,i,s,o,u){u=u==="auto"?lt(n,i):u;var l=2*u;if(Yr(e,t,this.points,s,o,n,i-l,[0,-1],a)||Yr(e,t,this.points,s,o,n-l,i,[0,-1],a))return!0;var v=n/2+2*a,f=i/2+2*a,c=[s-v,o-f,s-v,o,s+v,o,s+v,o-f];return!!(Er(e,t,c)||St(e,t,l,l,s+n/2-u,o+i/2-u,a)||St(e,t,l,l,s-n/2+u,o+i/2-u,a))}}};Zr.registerNodeShapes=function(){var r=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",pr(3,0)),this.generateRoundPolygon("round-triangle",pr(3,0)),this.generatePolygon("rectangle",pr(4,0)),r.square=r.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var t=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",t),this.generateRoundPolygon("round-diamond",t)}this.generatePolygon("pentagon",pr(5,0)),this.generateRoundPolygon("round-pentagon",pr(5,0)),this.generatePolygon("hexagon",pr(6,0)),this.generateRoundPolygon("round-hexagon",pr(6,0)),this.generatePolygon("heptagon",pr(7,0)),this.generateRoundPolygon("round-heptagon",pr(7,0)),this.generatePolygon("octagon",pr(8,0)),this.generateRoundPolygon("round-octagon",pr(8,0));var a=new Array(20);{var n=Ds(5,0),i=Ds(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o=e.deqFastCost*w)break}else if(l){if(m>=e.deqCost*h||m>=e.deqAvgCost*c)break}else if(b>=e.deqNoDrawCost*ms)break;var E=e.deq(a,g,y);if(E.length>0)for(var C=0;C0&&(e.onDeqd(a,d),!l&&e.shouldRedraw(a,d,g,y)&&i())},o=e.priority||Qs;n.beforeRender(s,o(a))}}}},iy=(function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:bn;dt(this,r),this.idsByKey=new Kr,this.keyForId=new Kr,this.cachesByLvl=new Kr,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=t}return ht(r,[{key:"getIdsFor",value:function(t){t==null&&He("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(t);return n||(n=new jt,a.set(t,n)),n}},{key:"addIdForKey",value:function(t,a){t!=null&&this.getIdsFor(t).add(a)}},{key:"deleteIdForKey",value:function(t,a){t!=null&&this.getIdsFor(t).delete(a)}},{key:"getNumberOfIdsForKey",value:function(t){return t==null?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var a=t.id(),n=this.keyForId.get(a),i=this.getKey(t);this.deleteIdForKey(n,a),this.addIdForKey(i,a),this.keyForId.set(a,i)}},{key:"deleteKeyMappingFor",value:function(t){var a=t.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(t){var a=t.id(),n=this.keyForId.get(a),i=this.getKey(t);return n!==i}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var a=this.cachesByLvl,n=this.lvls,i=a.get(t);return i||(i=new Kr,a.set(t,i),n.push(t)),i}},{key:"getCache",value:function(t,a){return this.getCachesAt(a).get(t)}},{key:"get",value:function(t,a){var n=this.getKey(t),i=this.getCache(n,a);return i!=null&&this.updateKeyMappingFor(t),i}},{key:"getForCachedKey",value:function(t,a){var n=this.keyForId.get(t.id()),i=this.getCache(n,a);return i}},{key:"hasCache",value:function(t,a){return this.getCachesAt(a).has(t)}},{key:"has",value:function(t,a){var n=this.getKey(t);return this.hasCache(n,a)}},{key:"setCache",value:function(t,a,n){n.key=t,this.getCachesAt(a).set(t,n)}},{key:"set",value:function(t,a,n){var i=this.getKey(t);this.setCache(i,a,n),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,a){this.getCachesAt(a).delete(t)}},{key:"delete",value:function(t,a){var n=this.getKey(t);this.deleteCache(n,a)}},{key:"invalidateKey",value:function(t){var a=this;this.lvls.forEach(function(n){return a.deleteCache(t,n)})}},{key:"invalidate",value:function(t){var a=t.id(),n=this.keyForId.get(a);this.deleteKeyMappingFor(t);var i=this.doesEleInvalidateKey(t);return i&&this.invalidateKey(n),i||this.getNumberOfIdsForKey(n)===0}}])})(),Il=25,tn=50,hn=-4,_s=3,Tf=7.99,sy=8,oy=1024,uy=1024,ly=1024,vy=.2,fy=.8,cy=10,dy=.15,hy=.1,gy=.9,py=.9,yy=100,my=1,Wt={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},by=vr({getKey:null,doesEleInvalidateKey:bn,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:fv,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),ya=function(e,t){var a=this;a.renderer=e,a.onDequeues=[];var n=by(t);ye(a,n),a.lookup=new iy(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},tr=ya.prototype;tr.reasons=Wt;tr.getTextureQueue=function(r){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[r]=e.eleImgCaches[r]||[]};tr.getRetiredTextureQueue=function(r){var e=this,t=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=t[r]=t[r]||[];return a};tr.getElementQueue=function(){var r=this,e=r.eleCacheQueue=r.eleCacheQueue||new za(function(t,a){return a.reqs-t.reqs});return e};tr.getElementKeyToQueue=function(){var r=this,e=r.eleKeyToCacheQueue=r.eleKeyToCacheQueue||{};return e};tr.getElement=function(r,e,t,a,n){var i=this,s=this.renderer,o=s.cy.zoom(),u=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!r.visible()||r.removed()||!i.allowEdgeTxrCaching&&r.isEdge()||!i.allowParentTxrCaching&&r.isParent())return null;if(a==null&&(a=Math.ceil(js(o*t))),a=Tf||a>_s)return null;var l=Math.pow(2,a),v=e.h*l,f=e.w*l,c=s.eleTextBiggerThanMin(r,l);if(!this.isVisible(r,c))return null;var h=u.get(r,a);if(h&&h.invalidated&&(h.invalidated=!1,h.texture.invalidatedWidth-=h.width),h)return h;var d;if(v<=Il?d=Il:v<=tn?d=tn:d=Math.ceil(v/tn)*tn,v>ly||f>uy)return null;var y=i.getTextureQueue(d),g=y[y.length-2],p=function(){return i.recycleTexture(d,f)||i.addTexture(d,f)};g||(g=y[y.length-1]),g||(g=p()),g.width-g.usedWidtha;B--)k=i.getElement(r,e,t,B,Wt.downscale);D()}else return i.queueElement(r,C.level-1),C;else{var P;if(!b&&!w&&!E)for(var A=a-1;A>=hn;A--){var R=u.get(r,A);if(R){P=R;break}}if(m(P))return i.queueElement(r,a),P;g.context.translate(g.usedWidth,0),g.context.scale(l,l),this.drawElement(g.context,r,e,c,!1),g.context.scale(1/l,1/l),g.context.translate(-g.usedWidth,0)}return h={x:g.usedWidth,texture:g,level:a,scale:l,width:f,height:v,scaledLabelShown:c},g.usedWidth+=Math.ceil(f+sy),g.eleCaches.push(h),u.set(r,a,h),i.checkTextureFullness(g),h};tr.invalidateElements=function(r){for(var e=0;e=vy*r.width&&this.retireTexture(r)};tr.checkTextureFullness=function(r){var e=this,t=e.getTextureQueue(r.height);r.usedWidth/r.width>fy&&r.fullnessChecks>=cy?ut(t,r):r.fullnessChecks++};tr.retireTexture=function(r){var e=this,t=r.height,a=e.getTextureQueue(t),n=this.lookup;ut(a,r),r.retired=!0;for(var i=r.eleCaches,s=0;s=e)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,Js(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),ut(n,s),a.push(s),s}};tr.queueElement=function(r,e){var t=this,a=t.getElementQueue(),n=t.getElementKeyToQueue(),i=this.getKey(r),s=n[i];if(s)s.level=Math.max(s.level,e),s.eles.merge(r),s.reqs++,a.updateItem(s);else{var o={eles:r.spawn().merge(r),level:e,reqs:1,key:i};a.push(o),n[i]=o}};tr.dequeue=function(r){for(var e=this,t=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,s=0;s0;s++){var o=t.pop(),u=o.key,l=o.eles[0],v=i.hasCache(l,o.level);if(a[u]=null,v)continue;n.push(o);var f=e.getBoundingBox(l);e.getElement(l,f,r,o.level,Wt.dequeue)}return n};tr.removeFromQueue=function(r){var e=this,t=e.getElementQueue(),a=e.getElementKeyToQueue(),n=this.getKey(r),i=a[n];i!=null&&(i.eles.length===1?(i.reqs=Zs,t.updateItem(i),t.pop(),a[n]=null):i.eles.unmerge(r))};tr.onDequeue=function(r){this.onDequeues.push(r)};tr.offDequeue=function(r){ut(this.onDequeues,r)};tr.setupDequeueing=Cf.setupDequeueing({deqRedrawThreshold:yy,deqCost:dy,deqAvgCost:hy,deqNoDrawCost:gy,deqFastCost:py,deq:function(e,t,a){return e.dequeue(t,a)},onDeqd:function(e,t){for(var a=0;a=xy||t>Dn)return null}a.validateLayersElesOrdering(t,r);var u=a.layersByLevel,l=Math.pow(2,t),v=u[t]=u[t]||[],f,c=a.levelIsComplete(t,r),h,d=function(){var D=function(L){if(a.validateLayersElesOrdering(L,r),a.levelIsComplete(L,r))return h=u[L],!0},B=function(L){if(!h)for(var I=t+L;ba<=I&&I<=Dn&&!D(I);I+=L);};B(1),B(-1);for(var P=v.length-1;P>=0;P--){var A=v[P];A.invalid&&ut(v,A)}};if(!c)d();else return v;var y=function(){if(!f){f=yr();for(var D=0;DNl||A>Nl)return null;var R=P*A;if(R>Py)return null;var L=a.makeLayer(f,t);if(B!=null){var I=v.indexOf(B)+1;v.splice(I,0,L)}else(D.insert===void 0||D.insert)&&v.unshift(L);return L};if(a.skipping&&!o)return null;for(var p=null,m=r.length/wy,b=!o,w=0;w=m||!yv(p.bb,E.boundingBox()))&&(p=g({insert:!0,after:p}),!p))return null;h||b?a.queueLayer(p,E):a.drawEleInLayer(p,E,t,e),p.eles.push(E),x[t]=p}return h||(b?null:v)};fr.getEleLevelForLayerLevel=function(r,e){return r};fr.drawEleInLayer=function(r,e,t,a){var n=this,i=this.renderer,s=r.context,o=e.boundingBox();o.w===0||o.h===0||!e.visible()||(t=n.getEleLevelForLayerLevel(t,a),i.setImgSmoothing(s,!1),i.drawCachedElement(s,e,null,null,t,Ay),i.setImgSmoothing(s,!0))};fr.levelIsComplete=function(r,e){var t=this,a=t.layersByLevel[r];if(!a||a.length===0)return!1;for(var n=0,i=0;i0||s.invalid)return!1;n+=s.eles.length}return n===e.length};fr.validateLayersElesOrdering=function(r,e){var t=this.layersByLevel[r];if(t)for(var a=0;a0){e=!0;break}}return e};fr.invalidateElements=function(r){var e=this;r.length!==0&&(e.lastInvalidationTime=Xr(),!(r.length===0||!e.haveLayers())&&e.updateElementsInLayers(r,function(a,n,i){e.invalidateLayer(a)}))};fr.invalidateLayer=function(r){if(this.lastInvalidationTime=Xr(),!r.invalid){var e=r.level,t=r.eles,a=this.layersByLevel[e];ut(a,r),r.elesQueue=[],r.invalid=!0,r.replacement&&(r.replacement.invalid=!0);for(var n=0;n3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o=e._private.rscratch;if(!(i&&!e.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var u;t&&(u=t,r.translate(-u.x1,-u.y1));var l=i?e.pstyle("opacity").value:1,v=i?e.pstyle("line-opacity").value:1,f=e.pstyle("curve-style").value,c=e.pstyle("line-style").value,h=e.pstyle("width").pfValue,d=e.pstyle("line-cap").value,y=e.pstyle("line-outline-width").value,g=e.pstyle("line-outline-color").value,p=l*v,m=l*v,b=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p;f==="straight-triangle"?(s.eleStrokeStyle(r,e,L),s.drawEdgeTrianglePath(e,r,o.allpts)):(r.lineWidth=h,r.lineCap=d,s.eleStrokeStyle(r,e,L),s.drawEdgePath(e,r,o.allpts,c),r.lineCap="butt")},w=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p;if(r.lineWidth=h+y,r.lineCap=d,y>0)s.colorStrokeStyle(r,g[0],g[1],g[2],L);else{r.lineCap="butt";return}f==="straight-triangle"?s.drawEdgeTrianglePath(e,r,o.allpts):(s.drawEdgePath(e,r,o.allpts,c),r.lineCap="butt")},E=function(){n&&s.drawEdgeOverlay(r,e)},C=function(){n&&s.drawEdgeUnderlay(r,e)},x=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;s.drawArrowheads(r,e,L)},T=function(){s.drawElementText(r,e,null,a)};r.lineJoin="round";var k=e.pstyle("ghost").value==="yes";if(k){var D=e.pstyle("ghost-offset-x").pfValue,B=e.pstyle("ghost-offset-y").pfValue,P=e.pstyle("ghost-opacity").value,A=p*P;r.translate(D,B),b(A),x(A),r.translate(-D,-B)}else w();C(),b(),x(),E(),T(),t&&r.translate(u.x1,u.y1)}};var Df=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,a){if(a.visible()){var n=a.pstyle("".concat(e,"-opacity")).value;if(n!==0){var i=this,s=i.usePaths(),o=a._private.rscratch,u=a.pstyle("".concat(e,"-padding")).pfValue,l=2*u,v=a.pstyle("".concat(e,"-color")).value;t.lineWidth=l,o.edgeType==="self"&&!s?t.lineCap="butt":t.lineCap="round",i.colorStrokeStyle(t,v[0],v[1],v[2],n),i.drawEdgePath(a,t,o.allpts,"solid")}}}};Qr.drawEdgeOverlay=Df("overlay");Qr.drawEdgeUnderlay=Df("underlay");Qr.drawEdgePath=function(r,e,t,a){var n=r._private.rscratch,i=e,s,o=!1,u=this.usePaths(),l=r.pstyle("line-dash-pattern").pfValue,v=r.pstyle("line-dash-offset").pfValue;if(u){var f=t.join("$"),c=n.pathCacheKey&&n.pathCacheKey===f;c?(s=e=n.pathCache,o=!0):(s=e=new Path2D,n.pathCacheKey=f,n.pathCache=s)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(l),i.lineDashOffset=v;break;case"solid":i.setLineDash([]);break}if(!o&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(t[0],t[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var h=2;h+35&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(a==null){if(i&&!s.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var o=e.pstyle("label");if(!o||!o.value)return;var u=s.getLabelJustification(e);r.textAlign=u,r.textBaseline="bottom"}else{var l=e.element()._private.rscratch.badLine,v=e.pstyle("label"),f=e.pstyle("source-label"),c=e.pstyle("target-label");if(l||(!v||!v.value)&&(!f||!f.value)&&(!c||!c.value))return;r.textAlign="center",r.textBaseline="bottom"}var h=!t,d;t&&(d=t,r.translate(-d.x1,-d.y1)),n==null?(s.drawText(r,e,null,h,i),e.isEdge()&&(s.drawText(r,e,"source",h,i),s.drawText(r,e,"target",h,i))):s.drawText(r,e,n,h,i),t&&r.translate(d.x1,d.y1)};Mt.getFontCache=function(r){var e;this.fontCaches=this.fontCaches||[];for(var t=0;t2&&arguments[2]!==void 0?arguments[2]:!0,a=e.pstyle("font-style").strValue,n=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,s=e.pstyle("font-weight").strValue,o=t?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,u=e.pstyle("text-outline-opacity").value*o,l=e.pstyle("color").value,v=e.pstyle("text-outline-color").value;r.font=a+" "+s+" "+n+" "+i,r.lineJoin="round",this.colorFillStyle(r,l[0],l[1],l[2],o),this.colorStrokeStyle(r,v[0],v[1],v[2],u)};function _y(r,e,t,a,n){var i=Math.min(a,n),s=i/2,o=e+a/2,u=t+n/2;r.beginPath(),r.arc(o,u,s,0,Math.PI*2),r.closePath()}function ql(r,e,t,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,s=Math.min(i,a/2,n/2);r.beginPath(),r.moveTo(e+s,t),r.lineTo(e+a-s,t),r.quadraticCurveTo(e+a,t,e+a,t+s),r.lineTo(e+a,t+n-s),r.quadraticCurveTo(e+a,t+n,e+a-s,t+n),r.lineTo(e+s,t+n),r.quadraticCurveTo(e,t+n,e,t+n-s),r.lineTo(e,t+s),r.quadraticCurveTo(e,t,e+s,t),r.closePath()}Mt.getTextAngle=function(r,e){var t,a=r._private,n=a.rscratch,i=e?e+"-":"",s=r.pstyle(i+"text-rotation");if(s.strValue==="autorotate"){var o=xr(n,"labelAngle",e);t=r.isEdge()?o:0}else s.strValue==="none"?t=0:t=s.pfValue;return t};Mt.drawText=function(r,e,t){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,s=i.rscratch,o=n?e.effectiveOpacity():1;if(!(n&&(o===0||e.pstyle("text-opacity").value===0))){t==="main"&&(t=null);var u=xr(s,"labelX",t),l=xr(s,"labelY",t),v,f,c=this.getLabelText(e,t);if(c!=null&&c!==""&&!isNaN(u)&&!isNaN(l)){this.setupTextStyle(r,e,n);var h=t?t+"-":"",d=xr(s,"labelWidth",t),y=xr(s,"labelHeight",t),g=e.pstyle(h+"text-margin-x").pfValue,p=e.pstyle(h+"text-margin-y").pfValue,m=e.isEdge(),b=e.pstyle("text-halign").value,w=e.pstyle("text-valign").value;m&&(b="center",w="center"),u+=g,l+=p;var E;switch(a?E=this.getTextAngle(e,t):E=0,E!==0&&(v=u,f=l,r.translate(v,f),r.rotate(E),u=0,l=0),w){case"top":break;case"center":l+=y/2;break;case"bottom":l+=y;break}var C=e.pstyle("text-background-opacity").value,x=e.pstyle("text-border-opacity").value,T=e.pstyle("text-border-width").pfValue,k=e.pstyle("text-background-padding").pfValue,D=e.pstyle("text-background-shape").strValue,B=D==="round-rectangle"||D==="roundrectangle",P=D==="circle",A=2;if(C>0||T>0&&x>0){var R=r.fillStyle,L=r.strokeStyle,I=r.lineWidth,M=e.pstyle("text-background-color").value,O=e.pstyle("text-border-color").value,q=e.pstyle("text-border-style").value,_=C>0,N=T>0&&x>0,F=u-k;switch(b){case"left":F-=d;break;case"center":F-=d/2;break}var U=l-y-k,J=d+2*k,Z=y+2*k;if(_&&(r.fillStyle="rgba(".concat(M[0],",").concat(M[1],",").concat(M[2],",").concat(C*o,")")),N&&(r.strokeStyle="rgba(".concat(O[0],",").concat(O[1],",").concat(O[2],",").concat(x*o,")"),r.lineWidth=T,r.setLineDash))switch(q){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"double":r.lineWidth=T/4,r.setLineDash([]);break;case"solid":default:r.setLineDash([]);break}if(B?(r.beginPath(),ql(r,F,U,J,Z,A)):P?(r.beginPath(),_y(r,F,U,J,Z)):(r.beginPath(),r.rect(F,U,J,Z)),_&&r.fill(),N&&r.stroke(),N&&q==="double"){var j=T/2;r.beginPath(),B?ql(r,F+j,U+j,J-2*j,Z-2*j,A):r.rect(F+j,U+j,J-2*j,Z-2*j),r.stroke()}r.fillStyle=R,r.strokeStyle=L,r.lineWidth=I,r.setLineDash&&r.setLineDash([])}var re=2*e.pstyle("text-outline-width").pfValue;if(re>0&&(r.lineWidth=re),e.pstyle("text-wrap").value==="wrap"){var ne=xr(s,"labelWrapCachedLines",t),Q=xr(s,"labelLineHeight",t),V=d/2,H=this.getLabelJustification(e);switch(H==="auto"||(b==="left"?H==="left"?u+=-d:H==="center"&&(u+=-V):b==="center"?H==="left"?u+=-V:H==="right"&&(u+=V):b==="right"&&(H==="center"?u+=V:H==="right"&&(u+=d))),w){case"top":l-=(ne.length-1)*Q;break;case"center":case"bottom":l-=(ne.length-1)*Q;break}for(var W=0;W0&&r.strokeText(ne[W],u,l),r.fillText(ne[W],u,l),l+=Q}else re>0&&r.strokeText(c,u,l),r.fillText(c,u,l);E!==0&&(r.rotate(-E),r.translate(-v,-f))}}};var pt={};pt.drawNode=function(r,e,t){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o,u,l=e._private,v=l.rscratch,f=e.position();if(!(!ae(f.x)||!ae(f.y))&&!(i&&!e.visible())){var c=i?e.effectiveOpacity():1,h=s.usePaths(),d,y=!1,g=e.padding();o=e.width()+2*g,u=e.height()+2*g;var p;t&&(p=t,r.translate(-p.x1,-p.y1));for(var m=e.pstyle("background-image"),b=m.value,w=new Array(b.length),E=new Array(b.length),C=0,x=0;x0&&arguments[0]!==void 0?arguments[0]:A;s.eleFillStyle(r,e,S)},Q=function(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:N;s.colorStrokeStyle(r,R[0],R[1],R[2],S)},V=function(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Z;s.colorStrokeStyle(r,U[0],U[1],U[2],S)},H=function(S,z,G,$){var K=s.nodePathCache=s.nodePathCache||[],le=vv(G==="polygon"?G+","+$.join(","):G,""+z,""+S,""+re),ee=K[le],ie,oe=!1;return ee!=null?(ie=ee,oe=!0,v.pathCache=ie):(ie=new Path2D,K[le]=v.pathCache=ie),{path:ie,cacheHit:oe}},W=e.pstyle("shape").strValue,Y=e.pstyle("shape-polygon-points").pfValue;if(h){r.translate(f.x,f.y);var te=H(o,u,W,Y);d=te.path,y=te.cacheHit}var ce=function(){if(!y){var S=f;h&&(S={x:0,y:0}),s.nodeShapes[s.getNodeShape(e)].draw(d||r,S.x,S.y,o,u,re,v)}h?r.fill(d):r.fill()},Be=function(){for(var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,G=l.backgrounding,$=0,K=0;K0&&arguments[0]!==void 0?arguments[0]:!1,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;s.hasPie(e)&&(s.drawPie(r,e,z),S&&(h||s.nodeShapes[s.getNodeShape(e)].draw(r,f.x,f.y,o,u,re,v)))},me=function(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;s.hasStripe(e)&&(r.save(),h?r.clip(v.pathCache):(s.nodeShapes[s.getNodeShape(e)].draw(r,f.x,f.y,o,u,re,v),r.clip()),s.drawStripe(r,e,z),r.restore(),S&&(h||s.nodeShapes[s.getNodeShape(e)].draw(r,f.x,f.y,o,u,re,v)))},ge=function(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,z=(B>0?B:-B)*S,G=B>0?0:255;B!==0&&(s.colorFillStyle(r,G,G,G,z),h?r.fill(d):r.fill())},se=function(){if(P>0){if(r.lineWidth=P,r.lineCap=M,r.lineJoin=I,r.setLineDash)switch(L){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash(q),r.lineDashOffset=_;break;case"solid":case"double":r.setLineDash([]);break}if(O!=="center"){if(r.save(),r.lineWidth*=2,O==="inside")h?r.clip(d):r.clip();else{var S=new Path2D;S.rect(-o/2-P,-u/2-P,o+2*P,u+2*P),S.addPath(d),r.clip(S,"evenodd")}h?r.stroke(d):r.stroke(),r.restore()}else h?r.stroke(d):r.stroke();if(L==="double"){r.lineWidth=P/3;var z=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",h?r.stroke(d):r.stroke(),r.globalCompositeOperation=z}r.setLineDash&&r.setLineDash([])}},de=function(){if(F>0){if(r.lineWidth=F,r.lineCap="butt",r.setLineDash)switch(J){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"solid":case"double":r.setLineDash([]);break}var S=f;h&&(S={x:0,y:0});var z=s.getNodeShape(e),G=P;O==="inside"&&(G=0),O==="outside"&&(G*=2);var $=(o+G+(F+j))/o,K=(u+G+(F+j))/u,le=o*$,ee=u*K,ie=s.nodeShapes[z].points,oe;if(h){var pe=H(le,ee,z,ie);oe=pe.path}if(z==="ellipse")s.drawEllipsePath(oe||r,S.x,S.y,le,ee);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(z)){var Ee=0,Ce=0,ve=0;z==="round-diamond"?Ee=(G+j+F)*1.4:z==="round-heptagon"?(Ee=(G+j+F)*1.075,ve=-(G/2+j+F)/35):z==="round-hexagon"?Ee=(G+j+F)*1.12:z==="round-pentagon"?(Ee=(G+j+F)*1.13,ve=-(G/2+j+F)/15):z==="round-tag"?(Ee=(G+j+F)*1.12,Ce=(G/2+F+j)*.07):z==="round-triangle"&&(Ee=(G+j+F)*(Math.PI/2),ve=-(G+j/2+F)/Math.PI),Ee!==0&&($=(o+Ee)/o,le=o*$,["round-hexagon","round-tag"].includes(z)||(K=(u+Ee)/u,ee=u*K)),re=re==="auto"?wv(le,ee):re;for(var ke=le/2,Pe=ee/2,ar=re+(G+F+j)/2,Ue=new Array(ie.length/2),Pr=new Array(ie.length/2),Ke=0;Ke0){if(n=n||a.position(),i==null||s==null){var h=a.padding();i=a.width()+2*h,s=a.height()+2*h}o.colorFillStyle(t,v[0],v[1],v[2],l),o.nodeShapes[f].draw(t,n.x,n.y,i+u*2,s+u*2,c),t.fill()}}}};pt.drawNodeOverlay=Bf("overlay");pt.drawNodeUnderlay=Bf("underlay");pt.hasPie=function(r){return r=r[0],r._private.hasPie};pt.hasStripe=function(r){return r=r[0],r._private.hasStripe};pt.drawPie=function(r,e,t,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),s=e.pstyle("pie-hole"),o=e.pstyle("pie-start-angle").pfValue,u=a.x,l=a.y,v=e.width(),f=e.height(),c=Math.min(v,f)/2,h,d=0,y=this.usePaths();if(y&&(u=0,l=0),i.units==="%"?c=c*i.pfValue:i.pfValue!==void 0&&(c=i.pfValue/2),s.units==="%"?h=c*s.pfValue:s.pfValue!==void 0&&(h=s.pfValue/2),!(h>=c))for(var g=1;g<=n.pieBackgroundN;g++){var p=e.pstyle("pie-"+g+"-background-size").value,m=e.pstyle("pie-"+g+"-background-color").value,b=e.pstyle("pie-"+g+"-background-opacity").value*t,w=p/100;w+d>1&&(w=1-d);var E=1.5*Math.PI+2*Math.PI*d;E+=o;var C=2*Math.PI*w,x=E+C;p===0||d>=1||d+w>1||(h===0?(r.beginPath(),r.moveTo(u,l),r.arc(u,l,c,E,x),r.closePath()):(r.beginPath(),r.arc(u,l,c,E,x),r.arc(u,l,h,x,E,!0),r.closePath()),this.colorFillStyle(r,m[0],m[1],m[2],b),r.fill(),d+=w)}};pt.drawStripe=function(r,e,t,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=a.x,s=a.y,o=e.width(),u=e.height(),l=0,v=this.usePaths();r.save();var f=e.pstyle("stripe-direction").value,c=e.pstyle("stripe-size");switch(f){case"vertical":break;case"righward":r.rotate(-Math.PI/2);break}var h=o,d=u;c.units==="%"?(h=h*c.pfValue,d=d*c.pfValue):c.pfValue!==void 0&&(h=c.pfValue,d=c.pfValue),v&&(i=0,s=0),s-=h/2,i-=d/2;for(var y=1;y<=n.stripeBackgroundN;y++){var g=e.pstyle("stripe-"+y+"-background-size").value,p=e.pstyle("stripe-"+y+"-background-color").value,m=e.pstyle("stripe-"+y+"-background-opacity").value*t,b=g/100;b+l>1&&(b=1-l),!(g===0||l>=1||l+b>1)&&(r.beginPath(),r.rect(i,s+d*l,h,d*b),r.closePath(),this.colorFillStyle(r,p[0],p[1],p[2],m),r.fill(),l+=b)}r.restore()};var mr={},Gy=100;mr.getPixelRatio=function(){var r=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),t=r.backingStorePixelRatio||r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/t};mr.paintCache=function(r){for(var e=this.paintCaches=this.paintCaches||[],t=!0,a,n=0;ne.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!f&&(v[e.NODE]=!0,v[e.SELECT_BOX]=!0);var m=t.style(),b=t.zoom(),w=s!==void 0?s:b,E=t.pan(),C={x:E.x,y:E.y},x={zoom:b,pan:{x:E.x,y:E.y}},T=e.prevViewport,k=T===void 0||x.zoom!==T.zoom||x.pan.x!==T.pan.x||x.pan.y!==T.pan.y;!k&&!(y&&!d)&&(e.motionBlurPxRatio=1),o&&(C=o),w*=u,C.x*=u,C.y*=u;var D=e.getCachedZSortedEles();function B(Q,V,H,W,Y){var te=Q.globalCompositeOperation;Q.globalCompositeOperation="destination-out",e.colorFillStyle(Q,255,255,255,e.motionBlurTransparency),Q.fillRect(V,H,W,Y),Q.globalCompositeOperation=te}function P(Q,V){var H,W,Y,te;!e.clearingMotionBlur&&(Q===l.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||Q===l.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(H={x:E.x*h,y:E.y*h},W=b*h,Y=e.canvasWidth*h,te=e.canvasHeight*h):(H=C,W=w,Y=e.canvasWidth,te=e.canvasHeight),Q.setTransform(1,0,0,1,0,0),V==="motionBlur"?B(Q,0,0,Y,te):!a&&(V===void 0||V)&&Q.clearRect(0,0,Y,te),n||(Q.translate(H.x,H.y),Q.scale(W,W)),o&&Q.translate(o.x,o.y),s&&Q.scale(s,s)}if(f||(e.textureDrawLastFrame=!1),f){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=t.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var A=e.data.bufferContexts[e.TEXTURE_BUFFER];A.setTransform(1,0,0,1,0,0),A.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:A,drawOnlyNodeLayer:!0,forcedPxRatio:u*e.textureMult});var x=e.textureCache.viewport={zoom:t.zoom(),pan:t.pan(),width:e.canvasWidth,height:e.canvasHeight};x.mpan={x:(0-x.pan.x)/x.zoom,y:(0-x.pan.y)/x.zoom}}v[e.DRAG]=!1,v[e.NODE]=!1;var R=l.contexts[e.NODE],L=e.textureCache.texture,x=e.textureCache.viewport;R.setTransform(1,0,0,1,0,0),c?B(R,0,0,x.width,x.height):R.clearRect(0,0,x.width,x.height);var I=m.core("outside-texture-bg-color").value,M=m.core("outside-texture-bg-opacity").value;e.colorFillStyle(R,I[0],I[1],I[2],M),R.fillRect(0,0,x.width,x.height);var b=t.zoom();P(R,!1),R.clearRect(x.mpan.x,x.mpan.y,x.width/x.zoom/u,x.height/x.zoom/u),R.drawImage(L,x.mpan.x,x.mpan.y,x.width/x.zoom/u,x.height/x.zoom/u)}else e.textureOnViewport&&!a&&(e.textureCache=null);var O=t.extent(),q=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),_=e.hideEdgesOnViewport&&q,N=[];if(N[e.NODE]=!v[e.NODE]&&c&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,N[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),N[e.DRAG]=!v[e.DRAG]&&c&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,N[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),v[e.NODE]||n||i||N[e.NODE]){var F=c&&!N[e.NODE]&&h!==1,R=a||(F?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:l.contexts[e.NODE]),U=c&&!F?"motionBlur":void 0;P(R,U),_?e.drawCachedNodes(R,D.nondrag,u,O):e.drawLayeredElements(R,D.nondrag,u,O),e.debug&&e.drawDebugPoints(R,D.nondrag),!n&&!c&&(v[e.NODE]=!1)}if(!i&&(v[e.DRAG]||n||N[e.DRAG])){var F=c&&!N[e.DRAG]&&h!==1,R=a||(F?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:l.contexts[e.DRAG]);P(R,c&&!F?"motionBlur":void 0),_?e.drawCachedNodes(R,D.drag,u,O):e.drawCachedElements(R,D.drag,u,O),e.debug&&e.drawDebugPoints(R,D.drag),!n&&!c&&(v[e.DRAG]=!1)}if(this.drawSelectionRectangle(r,P),c&&h!==1){var J=l.contexts[e.NODE],Z=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],j=l.contexts[e.DRAG],re=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],ne=function(V,H,W){V.setTransform(1,0,0,1,0,0),W||!p?V.clearRect(0,0,e.canvasWidth,e.canvasHeight):B(V,0,0,e.canvasWidth,e.canvasHeight);var Y=h;V.drawImage(H,0,0,e.canvasWidth*Y,e.canvasHeight*Y,0,0,e.canvasWidth,e.canvasHeight)};(v[e.NODE]||N[e.NODE])&&(ne(J,Z,N[e.NODE]),v[e.NODE]=!1),(v[e.DRAG]||N[e.DRAG])&&(ne(j,re,N[e.DRAG]),v[e.DRAG]=!1)}e.prevViewport=x,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),c&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!f,e.mbFrames=0,v[e.NODE]=!0,v[e.DRAG]=!0,e.redraw()},Gy)),a||t.emit("render")};var ca;mr.drawSelectionRectangle=function(r,e){var t=this,a=t.cy,n=t.data,i=a.style(),s=r.drawOnlyNodeLayer,o=r.drawAllLayers,u=n.canvasNeedsRedraw,l=r.forcedContext;if(t.showFps||!s&&u[t.SELECT_BOX]&&!o){var v=l||n.contexts[t.SELECT_BOX];if(e(v),t.selection[4]==1&&(t.hoverData.selecting||t.touchData.selecting)){var f=t.cy.zoom(),c=i.core("selection-box-border-width").value/f;v.lineWidth=c,v.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",v.fillRect(t.selection[0],t.selection[1],t.selection[2]-t.selection[0],t.selection[3]-t.selection[1]),c>0&&(v.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",v.strokeRect(t.selection[0],t.selection[1],t.selection[2]-t.selection[0],t.selection[3]-t.selection[1]))}if(n.bgActivePosistion&&!t.hoverData.selecting){var f=t.cy.zoom(),h=n.bgActivePosistion;v.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",v.beginPath(),v.arc(h.x,h.y,i.core("active-bg-size").pfValue/f,0,2*Math.PI),v.fill()}var d=t.lastRedrawTime;if(t.showFps&&d){d=Math.round(d);var y=Math.round(1e3/d),g="1 frame = "+d+" ms = "+y+" fps";if(v.setTransform(1,0,0,1,0,0),v.fillStyle="rgba(255, 0, 0, 0.75)",v.strokeStyle="rgba(255, 0, 0, 0.75)",v.font="30px Arial",!ca){var p=v.measureText(g);ca=p.actualBoundingBoxAscent}v.fillText(g,0,ca);var m=60;v.strokeRect(0,ca+10,250,20),v.fillRect(0,ca+10,250*Math.min(y/m,1),20)}o||(u[t.SELECT_BOX]=!1)}};function _l(r,e,t){var a=r.createShader(e);if(r.shaderSource(a,t),r.compileShader(a),!r.getShaderParameter(a,r.COMPILE_STATUS))throw new Error(r.getShaderInfoLog(a));return a}function Hy(r,e,t){var a=_l(r,r.VERTEX_SHADER,e),n=_l(r,r.FRAGMENT_SHADER,t),i=r.createProgram();if(r.attachShader(i,a),r.attachShader(i,n),r.linkProgram(i),!r.getProgramParameter(i,r.LINK_STATUS))throw new Error("Could not initialize shaders");return i}function Wy(r,e,t){t===void 0&&(t=e);var a=r.makeOffscreenCanvas(e,t),n=a.context=a.getContext("2d");return a.clear=function(){return n.clearRect(0,0,a.width,a.height)},a.clear(),a}function yo(r){var e=r.pixelRatio,t=r.cy.zoom(),a=r.cy.pan();return{zoom:t*e,pan:{x:a.x*e,y:a.y*e}}}function $y(r){var e=r.pixelRatio,t=r.cy.zoom();return t*e}function Uy(r,e,t,a,n){var i=a*t+e.x,s=n*t+e.y;return s=Math.round(r.canvasHeight-s),[i,s]}function Ky(r,e){return e.picking?!0:r.pstyle("background-fill").value!=="solid"||r.pstyle("background-image").strValue!=="none"?!1:r.pstyle("border-width").value===0||r.pstyle("border-opacity").value===0?!0:r.pstyle("border-style").value==="solid"}function Xy(r,e){if(r.length!==e.length)return!1;for(var t=0;t>0&255)/255,t[1]=(r>>8&255)/255,t[2]=(r>>16&255)/255,t[3]=(r>>24&255)/255,t}function Yy(r){return r[0]+(r[1]<<8)+(r[2]<<16)+(r[3]<<24)}function Zy(r,e){var t=r.createTexture();return t.buffer=function(a){r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR_MIPMAP_NEAREST),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,a),r.generateMipmap(r.TEXTURE_2D),r.bindTexture(r.TEXTURE_2D,null)},t.deleteTexture=function(){r.deleteTexture(t)},t}function Pf(r,e){switch(e){case"float":return[1,r.FLOAT,4];case"vec2":return[2,r.FLOAT,4];case"vec3":return[3,r.FLOAT,4];case"vec4":return[4,r.FLOAT,4];case"int":return[1,r.INT,4];case"ivec2":return[2,r.INT,4]}}function Af(r,e,t){switch(e){case r.FLOAT:return new Float32Array(t);case r.INT:return new Int32Array(t)}}function Qy(r,e,t,a,n,i){switch(e){case r.FLOAT:return new Float32Array(t.buffer,i*a,n);case r.INT:return new Int32Array(t.buffer,i*a,n)}}function Jy(r,e,t,a){var n=Pf(r,e),i=Qe(n,2),s=i[0],o=i[1],u=Af(r,o,a),l=r.createBuffer();return r.bindBuffer(r.ARRAY_BUFFER,l),r.bufferData(r.ARRAY_BUFFER,u,r.STATIC_DRAW),o===r.FLOAT?r.vertexAttribPointer(t,s,o,!1,0,0):o===r.INT&&r.vertexAttribIPointer(t,s,o,0,0),r.enableVertexAttribArray(t),r.bindBuffer(r.ARRAY_BUFFER,null),l}function Fr(r,e,t,a){var n=Pf(r,t),i=Qe(n,3),s=i[0],o=i[1],u=i[2],l=Af(r,o,e*s),v=s*u,f=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,f),r.bufferData(r.ARRAY_BUFFER,e*v,r.DYNAMIC_DRAW),r.enableVertexAttribArray(a),o===r.FLOAT?r.vertexAttribPointer(a,s,o,!1,v,0):o===r.INT&&r.vertexAttribIPointer(a,s,o,v,0),r.vertexAttribDivisor(a,1),r.bindBuffer(r.ARRAY_BUFFER,null);for(var c=new Array(e),h=0;hs&&(o=s/a,u=a*o,l=n*o),{scale:o,texW:u,texH:l}}},{key:"draw",value:function(t,a,n){var i=this;if(this.locked)throw new Error("can't draw, atlas is locked");var s=this.texSize,o=this.texRows,u=this.texHeight,l=this.getScale(a),v=l.scale,f=l.texW,c=l.texH,h=function(b,w){if(n&&w){var E=w.context,C=b.x,x=b.row,T=C,k=u*x;E.save(),E.translate(T,k),E.scale(v,v),n(E,a),E.restore()}},d=[null,null],y=function(){h(i.freePointer,i.canvas),d[0]={x:i.freePointer.x,y:i.freePointer.row*u,w:f,h:c},d[1]={x:i.freePointer.x+f,y:i.freePointer.row*u,w:0,h:c},i.freePointer.x+=f,i.freePointer.x==s&&(i.freePointer.x=0,i.freePointer.row++)},g=function(){var b=i.scratch,w=i.canvas;b.clear(),h({x:0,row:0},b);var E=s-i.freePointer.x,C=f-E,x=u;{var T=i.freePointer.x,k=i.freePointer.row*u,D=E;w.context.drawImage(b,0,0,D,x,T,k,D,x),d[0]={x:T,y:k,w:D,h:c}}{var B=E,P=(i.freePointer.row+1)*u,A=C;w&&w.context.drawImage(b,B,0,A,x,0,P,A,x),d[1]={x:0,y:P,w:A,h:c}}i.freePointer.x=C,i.freePointer.row++},p=function(){i.freePointer.x=0,i.freePointer.row++};if(this.freePointer.x+f<=s)y();else{if(this.freePointer.row>=o-1)return!1;this.freePointer.x===s?(p(),y()):this.enableWrapping?g():(p(),y())}return this.keyToLocation.set(t,d),this.needsBuffer=!0,d}},{key:"getOffsets",value:function(t){return this.keyToLocation.get(t)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(t){if(this.locked)return!1;var a=this.texSize,n=this.texRows,i=this.getScale(t),s=i.texW;return this.freePointer.x+s>a?this.freePointer.row1&&arguments[1]!==void 0?arguments[1]:{},i=n.forceRedraw,s=i===void 0?!1:i,o=n.filterEle,u=o===void 0?function(){return!0}:o,l=n.filterType,v=l===void 0?function(){return!0}:l,f=!1,c=!1,h=Cr(t),d;try{for(h.s();!(d=h.n()).done;){var y=d.value;if(u(y)){var g=Cr(this.renderTypes.values()),p;try{var m=function(){var w=p.value,E=w.type;if(v(E)){var C=a.collections.get(w.collection),x=w.getKey(y),T=Array.isArray(x)?x:[x];if(s)T.forEach(function(P){return C.markKeyForGC(P)}),c=!0;else{var k=w.getID?w.getID(y):y.id(),D=a._key(E,k),B=a.typeAndIdToKey.get(D);B!==void 0&&!Xy(T,B)&&(f=!0,a.typeAndIdToKey.delete(D),B.forEach(function(P){return C.markKeyForGC(P)}))}}};for(g.s();!(p=g.n()).done;)m()}catch(b){g.e(b)}finally{g.f()}}}}catch(b){h.e(b)}finally{h.f()}return c&&(this.gc(),f=!1),f}},{key:"gc",value:function(){var t=Cr(this.collections.values()),a;try{for(t.s();!(a=t.n()).done;){var n=a.value;n.gc()}}catch(i){t.e(i)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(t,a,n,i){var s=this.renderTypes.get(a),o=this.collections.get(s.collection),u=!1,l=o.draw(i,n,function(c){s.drawClipped?(c.save(),c.beginPath(),c.rect(0,0,n.w,n.h),c.clip(),s.drawElement(c,t,n,!0,!0),c.restore()):s.drawElement(c,t,n,!0,!0),u=!0});if(u){var v=s.getID?s.getID(t):t.id(),f=this._key(a,v);this.typeAndIdToKey.has(f)?this.typeAndIdToKey.get(f).push(i):this.typeAndIdToKey.set(f,[i])}return l}},{key:"getAtlasInfo",value:function(t,a){var n=this,i=this.renderTypes.get(a),s=i.getKey(t),o=Array.isArray(s)?s:[s];return o.map(function(u){var l=i.getBoundingBox(t,u),v=n.getOrCreateAtlas(t,a,l,u),f=v.getOffsets(u),c=Qe(f,2),h=c[0],d=c[1];return{atlas:v,tex:h,tex1:h,tex2:d,bb:l}})}},{key:"getDebugInfo",value:function(){var t=[],a=Cr(this.collections),n;try{for(a.s();!(n=a.n()).done;){var i=Qe(n.value,2),s=i[0],o=i[1],u=o.getCounts(),l=u.keyCount,v=u.atlasCount;t.push({type:s,keyCount:l,atlasCount:v})}}catch(f){a.e(f)}finally{a.f()}return t}}])})(),om=(function(){function r(e){dt(this,r),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return ht(r,[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(t,a){return a})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(t){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(t):!0}},{key:"getAtlasIndexForBatch",value:function(t){var a=this.batchAtlases.indexOf(t);if(a<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(t),a=this.batchAtlases.length-1}return a}}])})(),um=`
+ float circleSD(vec2 p, float r) {
+ return distance(vec2(0), p) - r; // signed distance
+ }
+`,lm=`
+ float rectangleSD(vec2 p, vec2 b) {
+ vec2 d = abs(p)-b;
+ return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
+ }
+`,vm=`
+ float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
+ cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
+ cr.x = (p.y > 0.0) ? cr.x : cr.y;
+ vec2 q = abs(p) - b + cr.x;
+ return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
+ }
+`,fm=`
+ float ellipseSD(vec2 p, vec2 ab) {
+ p = abs( p ); // symmetry
+
+ // find root with Newton solver
+ vec2 q = ab*(p-ab);
+ float w = (q.x1.0) ? d : -d;
+ }
+`,wa={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Bn={IGNORE:1,USE_BB:2},xs=0,$l=1,Ul=2,Es=3,Vt=4,an=5,da=6,ha=7,cm=(function(){function r(e,t,a){dt(this,r),this.r=e,this.gl=t,this.maxInstances=a.webglBatchSize,this.atlasSize=a.webglTexSize,this.bgColor=a.bgColor,this.debug=a.webglDebug,this.batchDebugInfo=[],a.enableWrapping=!0,a.createTextureCanvas=Wy,this.atlasManager=new sm(e,a),this.batchManager=new om(a),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(wa.SCREEN),this.pickingProgram=this._createShaderProgram(wa.PICKING),this.vao=this._createVAO()}return ht(r,[{key:"addAtlasCollection",value:function(t,a){this.atlasManager.addAtlasCollection(t,a)}},{key:"addTextureAtlasRenderType",value:function(t,a){this.atlasManager.addRenderType(t,a)}},{key:"addSimpleShapeRenderType",value:function(t,a){this.simpleShapeOptions.set(t,a)}},{key:"invalidate",value:function(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=a.type,i=this.atlasManager;return n?i.invalidate(t,{filterType:function(o){return o===n},forceRedraw:!0}):i.invalidate(t)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(t){var a=this.gl,n=`#version 300 es
+ precision highp float;
+
+ uniform mat3 uPanZoomMatrix;
+ uniform int uAtlasSize;
+
+ // instanced
+ in vec2 aPosition; // a vertex from the unit square
+
+ in mat3 aTransform; // used to transform verticies, eg into a bounding box
+ in int aVertType; // the type of thing we are rendering
+
+ // the z-index that is output when using picking mode
+ in vec4 aIndex;
+
+ // For textures
+ in int aAtlasId; // which shader unit/atlas to use
+ in vec4 aTex; // x/y/w/h of texture in atlas
+
+ // for edges
+ in vec4 aPointAPointB;
+ in vec4 aPointCPointD;
+ in vec2 aLineWidth; // also used for node border width
+
+ // simple shapes
+ in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
+ in vec4 aColor; // also used for edges
+ in vec4 aBorderColor; // aLineWidth is used for border width
+
+ // output values passed to the fragment shader
+ out vec2 vTexCoord;
+ out vec4 vColor;
+ out vec2 vPosition;
+ // flat values are not interpolated
+ flat out int vAtlasId;
+ flat out int vVertType;
+ flat out vec2 vTopRight;
+ flat out vec2 vBotLeft;
+ flat out vec4 vCornerRadius;
+ flat out vec4 vBorderColor;
+ flat out vec2 vBorderWidth;
+ flat out vec4 vIndex;
+
+ void main(void) {
+ int vid = gl_VertexID;
+ vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
+
+ if(aVertType == `.concat(xs,`) {
+ float texX = aTex.x; // texture coordinates
+ float texY = aTex.y;
+ float texW = aTex.z;
+ float texH = aTex.w;
+
+ if(vid == 1 || vid == 2 || vid == 4) {
+ texX += texW;
+ }
+ if(vid == 2 || vid == 4 || vid == 5) {
+ texY += texH;
+ }
+
+ float d = float(uAtlasSize);
+ vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
+
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
+ }
+ else if(aVertType == `).concat(Vt," || aVertType == ").concat(ha,`
+ || aVertType == `).concat(an," || aVertType == ").concat(da,`) { // simple shapes
+
+ // the bounding box is needed by the fragment shader
+ vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
+ vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
+ vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
+
+ // calculations are done in the fragment shader, just pass these along
+ vColor = aColor;
+ vCornerRadius = aCornerRadius;
+ vBorderColor = aBorderColor;
+ vBorderWidth = aLineWidth;
+
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
+ }
+ else if(aVertType == `).concat($l,`) {
+ vec2 source = aPointAPointB.xy;
+ vec2 target = aPointAPointB.zw;
+
+ // adjust the geometry so that the line is centered on the edge
+ position.y = position.y - 0.5;
+
+ // stretch the unit square into a long skinny rectangle
+ vec2 xBasis = target - source;
+ vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
+ vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
+
+ gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
+ vColor = aColor;
+ }
+ else if(aVertType == `).concat(Ul,`) {
+ vec2 pointA = aPointAPointB.xy;
+ vec2 pointB = aPointAPointB.zw;
+ vec2 pointC = aPointCPointD.xy;
+ vec2 pointD = aPointCPointD.zw;
+
+ // adjust the geometry so that the line is centered on the edge
+ position.y = position.y - 0.5;
+
+ vec2 p0, p1, p2, pos;
+ if(position.x == 0.0) { // The left side of the unit square
+ p0 = pointA;
+ p1 = pointB;
+ p2 = pointC;
+ pos = position;
+ } else { // The right side of the unit square, use same approach but flip the geometry upside down
+ p0 = pointD;
+ p1 = pointC;
+ p2 = pointB;
+ pos = vec2(0.0, -position.y);
+ }
+
+ vec2 p01 = p1 - p0;
+ vec2 p12 = p2 - p1;
+ vec2 p21 = p1 - p2;
+
+ // Find the normal vector.
+ vec2 tangent = normalize(normalize(p12) + normalize(p01));
+ vec2 normal = vec2(-tangent.y, tangent.x);
+
+ // Find the vector perpendicular to p0 -> p1.
+ vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
+
+ // Determine the bend direction.
+ float sigma = sign(dot(p01 + p21, normal));
+ float width = aLineWidth[0];
+
+ if(sign(pos.y) == -sigma) {
+ // This is an intersecting vertex. Adjust the position so that there's no overlap.
+ vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
+ } else {
+ // This is a non-intersecting vertex. Treat it like a mitre join.
+ vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
+ }
+
+ vColor = aColor;
+ }
+ else if(aVertType == `).concat(Es,` && vid < 3) {
+ // massage the first triangle into an edge arrow
+ if(vid == 0)
+ position = vec2(-0.15, -0.3);
+ if(vid == 1)
+ position = vec2( 0.0, 0.0);
+ if(vid == 2)
+ position = vec2( 0.15, -0.3);
+
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
+ vColor = aColor;
+ }
+ else {
+ gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
+ }
+
+ vAtlasId = aAtlasId;
+ vVertType = aVertType;
+ vIndex = aIndex;
+ }
+ `),i=this.batchManager.getIndexArray(),s=`#version 300 es
+ precision highp float;
+
+ // declare texture unit for each texture atlas in the batch
+ `.concat(i.map(function(l){return"uniform sampler2D uTexture".concat(l,";")}).join(`
+ `),`
+
+ uniform vec4 uBGColor;
+ uniform float uZoom;
+
+ in vec2 vTexCoord;
+ in vec4 vColor;
+ in vec2 vPosition; // model coordinates
+
+ flat in int vAtlasId;
+ flat in vec4 vIndex;
+ flat in int vVertType;
+ flat in vec2 vTopRight;
+ flat in vec2 vBotLeft;
+ flat in vec4 vCornerRadius;
+ flat in vec4 vBorderColor;
+ flat in vec2 vBorderWidth;
+
+ out vec4 outColor;
+
+ `).concat(um,`
+ `).concat(lm,`
+ `).concat(vm,`
+ `).concat(fm,`
+
+ vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
+ return vec4(
+ top.rgb + (bot.rgb * (1.0 - top.a)),
+ top.a + (bot.a * (1.0 - top.a))
+ );
+ }
+
+ vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
+ // scale to the zoom level so that borders don't look blurry when zoomed in
+ // note 1.5 is an aribitrary value chosen because it looks good
+ return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
+ }
+
+ void main(void) {
+ if(vVertType == `).concat(xs,`) {
+ // look up the texel from the texture unit
+ `).concat(i.map(function(l){return"if(vAtlasId == ".concat(l,") outColor = texture(uTexture").concat(l,", vTexCoord);")}).join(`
+ else `),`
+ }
+ else if(vVertType == `).concat(Es,`) {
+ // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
+ outColor = blend(vColor, uBGColor);
+ outColor.a = 1.0; // make opaque, masks out line under arrow
+ }
+ else if(vVertType == `).concat(Vt,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
+ outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
+ }
+ else if(vVertType == `).concat(Vt," || vVertType == ").concat(ha,`
+ || vVertType == `).concat(an," || vVertType == ").concat(da,`) { // use SDF
+
+ float outerBorder = vBorderWidth[0];
+ float innerBorder = vBorderWidth[1];
+ float borderPadding = outerBorder * 2.0;
+ float w = vTopRight.x - vBotLeft.x - borderPadding;
+ float h = vTopRight.y - vBotLeft.y - borderPadding;
+ vec2 b = vec2(w/2.0, h/2.0); // half width, half height
+ vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
+
+ float d; // signed distance
+ if(vVertType == `).concat(Vt,`) {
+ d = rectangleSD(p, b);
+ } else if(vVertType == `).concat(ha,` && w == h) {
+ d = circleSD(p, b.x); // faster than ellipse
+ } else if(vVertType == `).concat(ha,`) {
+ d = ellipseSD(p, b);
+ } else {
+ d = roundRectangleSD(p, b, vCornerRadius.wzyx);
+ }
+
+ // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
+ // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
+ if(d > 0.0) {
+ if(d > outerBorder) {
+ discard;
+ } else {
+ outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
+ }
+ } else {
+ if(d > innerBorder) {
+ vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
+ vec4 innerBorderColor = blend(vBorderColor, vColor);
+ outColor = distInterp(innerBorderColor, outerColor, d);
+ }
+ else {
+ vec4 outerColor;
+ if(innerBorder == 0.0 && outerBorder == 0.0) {
+ outerColor = vec4(0);
+ } else if(innerBorder == 0.0) {
+ outerColor = vBorderColor;
+ } else {
+ outerColor = blend(vBorderColor, vColor);
+ }
+ outColor = distInterp(vColor, outerColor, d - innerBorder);
+ }
+ }
+ }
+ else {
+ outColor = vColor;
+ }
+
+ `).concat(t.picking?`if(outColor.a == 0.0) discard;
+ else outColor = vIndex;`:"",`
+ }
+ `),o=Hy(a,n,s);o.aPosition=a.getAttribLocation(o,"aPosition"),o.aIndex=a.getAttribLocation(o,"aIndex"),o.aVertType=a.getAttribLocation(o,"aVertType"),o.aTransform=a.getAttribLocation(o,"aTransform"),o.aAtlasId=a.getAttribLocation(o,"aAtlasId"),o.aTex=a.getAttribLocation(o,"aTex"),o.aPointAPointB=a.getAttribLocation(o,"aPointAPointB"),o.aPointCPointD=a.getAttribLocation(o,"aPointCPointD"),o.aLineWidth=a.getAttribLocation(o,"aLineWidth"),o.aColor=a.getAttribLocation(o,"aColor"),o.aCornerRadius=a.getAttribLocation(o,"aCornerRadius"),o.aBorderColor=a.getAttribLocation(o,"aBorderColor"),o.uPanZoomMatrix=a.getUniformLocation(o,"uPanZoomMatrix"),o.uAtlasSize=a.getUniformLocation(o,"uAtlasSize"),o.uBGColor=a.getUniformLocation(o,"uBGColor"),o.uZoom=a.getUniformLocation(o,"uZoom"),o.uTextures=[];for(var u=0;u1&&arguments[1]!==void 0?arguments[1]:wa.SCREEN;this.panZoomMatrix=t,this.renderTarget=a,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(t,a){return t.visible()?a&&a.isVisible?a.isVisible(t):!0:!1}},{key:"drawTexture",value:function(t,a,n){var i=this.atlasManager,s=this.batchManager,o=i.getRenderTypeOpts(n);if(this._isVisible(t,o)&&!(t.isEdge()&&!this._isValidEdge(t))){if(this.renderTarget.picking&&o.getTexPickingMode){var u=o.getTexPickingMode(t);if(u===Bn.IGNORE)return;if(u==Bn.USE_BB){this.drawPickingRectangle(t,a,n);return}}var l=i.getAtlasInfo(t,n),v=Cr(l),f;try{for(v.s();!(f=v.n()).done;){var c=f.value,h=c.atlas,d=c.tex1,y=c.tex2;s.canAddToCurrentBatch(h)||this.endBatch();for(var g=s.getAtlasIndexForBatch(h),p=0,m=[[d,!0],[y,!1]];p=this.maxInstances&&this.endBatch()}}}}catch(B){v.e(B)}finally{v.f()}}}},{key:"setTransformMatrix",value:function(t,a,n,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=0;if(n.shapeProps&&n.shapeProps.padding&&(o=t.pstyle(n.shapeProps.padding).pfValue),i){var u=i.bb,l=i.tex1,v=i.tex2,f=l.w/(l.w+v.w);s||(f=1-f);var c=this._getAdjustedBB(u,o,s,f);this._applyTransformMatrix(a,c,n,t)}else{var h=n.getBoundingBox(t),d=this._getAdjustedBB(h,o,!0,1);this._applyTransformMatrix(a,d,n,t)}}},{key:"_applyTransformMatrix",value:function(t,a,n,i){var s,o;Hl(t);var u=n.getRotation?n.getRotation(i):0;if(u!==0){var l=n.getRotationPoint(i),v=l.x,f=l.y;gn(t,t,[v,f]),Wl(t,t,u);var c=n.getRotationOffset(i);s=c.x+(a.xOffset||0),o=c.y+(a.yOffset||0)}else s=a.x1,o=a.y1;gn(t,t,[s,o]),Gs(t,t,[a.w,a.h])}},{key:"_getAdjustedBB",value:function(t,a,n,i){var s=t.x1,o=t.y1,u=t.w,l=t.h,v=t.yOffset;a&&(s-=a,o-=a,u+=2*a,l+=2*a);var f=0,c=u*i;return n&&i<1?u=c:!n&&i<1&&(f=u-c,s+=f,u=c),{x1:s,y1:o,w:u,h:l,xOffset:f,yOffset:v}}},{key:"drawPickingRectangle",value:function(t,a,n){var i=this.atlasManager.getRenderTypeOpts(n),s=this.instanceCount;this.vertTypeBuffer.getView(s)[0]=Vt;var o=this.indexBuffer.getView(s);Ft(a,o);var u=this.colorBuffer.getView(s);wt([0,0,0],1,u);var l=this.transformBuffer.getMatrixView(s);this.setTransformMatrix(t,l,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(t,a,n){var i=this.simpleShapeOptions.get(n);if(this._isVisible(t,i)){var s=i.shapeProps,o=this._getVertTypeForShape(t,s.shape);if(o===void 0||i.isSimple&&!i.isSimple(t,this.renderTarget)){this.drawTexture(t,a,n);return}var u=this.instanceCount;if(this.vertTypeBuffer.getView(u)[0]=o,o===an||o===da){var l=i.getBoundingBox(t),v=this._getCornerRadius(t,s.radius,l),f=this.cornerRadiusBuffer.getView(u);f[0]=v,f[1]=v,f[2]=v,f[3]=v,o===da&&(f[0]=0,f[2]=0)}var c=this.indexBuffer.getView(u);Ft(a,c);var h=this.renderTarget.picking?1:n==="node-body"?t.effectiveOpacity():1,d=this.renderTarget.picking?1:t.pstyle(s.opacity).value*h,y=t.pstyle(s.color).value,g=this.colorBuffer.getView(u);wt(y,d,g);var p=this.lineWidthBuffer.getView(u);if(p[0]=0,p[1]=0,s.border){var m=t.pstyle("border-width").value;if(m>0){var b=t.pstyle("border-color").value,w=h*t.pstyle("border-opacity").value,E=this.borderColorBuffer.getView(u);wt(b,w,E);var C=t.pstyle("border-position").value;if(C==="inside")p[0]=0,p[1]=-m;else if(C==="outside")p[0]=m,p[1]=0;else{var x=m/2;p[0]=x,p[1]=-x}}}var T=this.transformBuffer.getMatrixView(u);this.setTransformMatrix(t,T,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(t,a){var n=t.pstyle(a).value;switch(n){case"rectangle":return Vt;case"ellipse":return ha;case"roundrectangle":case"round-rectangle":return an;case"bottom-round-rectangle":return da;default:return}}},{key:"_getCornerRadius",value:function(t,a,n){var i=n.w,s=n.h;if(t.pstyle(a).value==="auto")return lt(i,s);var o=t.pstyle(a).pfValue,u=i/2,l=s/2;return Math.min(o,l,u)}},{key:"drawEdgeArrow",value:function(t,a,n){if(t.visible()){var i=t._private.rscratch,s,o,u;if(n==="source"?(s=i.arrowStartX,o=i.arrowStartY,u=i.srcArrowAngle):(s=i.arrowEndX,o=i.arrowEndY,u=i.tgtArrowAngle),!(isNaN(s)||s==null||isNaN(o)||o==null||isNaN(u)||u==null)){var l=t.pstyle(n+"-arrow-shape").value;if(l!=="none"){var v=t.pstyle(n+"-arrow-color").value,f=t.pstyle("opacity").value,c=t.pstyle("line-opacity").value,h=f*c,d=t.pstyle("width").pfValue,y=t.pstyle("arrow-scale").value,g=this.r.getArrowWidth(d,y),p=this.instanceCount,m=this.transformBuffer.getMatrixView(p);Hl(m),gn(m,m,[s,o]),Gs(m,m,[g,g]),Wl(m,m,u),this.vertTypeBuffer.getView(p)[0]=Es;var b=this.indexBuffer.getView(p);Ft(a,b);var w=this.colorBuffer.getView(p);wt(v,h,w),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(t,a){if(t.visible()){var n=this._getEdgePoints(t);if(n){var i=t.pstyle("opacity").value,s=t.pstyle("line-opacity").value,o=t.pstyle("width").pfValue,u=t.pstyle("line-color").value,l=i*s;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),n.length==4){var v=this.instanceCount;this.vertTypeBuffer.getView(v)[0]=$l;var f=this.indexBuffer.getView(v);Ft(a,f);var c=this.colorBuffer.getView(v);wt(u,l,c);var h=this.lineWidthBuffer.getView(v);h[0]=o;var d=this.pointAPointBBuffer.getView(v);d[0]=n[0],d[1]=n[1],d[2]=n[2],d[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var y=0;y=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(t){var a=t._private.rscratch;return!(a.badLine||a.allpts==null||isNaN(a.allpts[0]))}},{key:"_getEdgePoints",value:function(t){var a=t._private.rscratch;if(this._isValidEdge(t)){var n=a.allpts;if(n.length==4)return n;var i=this._getNumSegments(t);return this._getCurveSegmentPoints(n,i)}}},{key:"_getNumSegments",value:function(t){var a=15;return Math.min(Math.max(a,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(t,a){if(t.length==4)return t;for(var n=Array((a+1)*2),i=0;i<=a;i++)if(i==0)n[0]=t[0],n[1]=t[1];else if(i==a)n[i*2]=t[t.length-2],n[i*2+1]=t[t.length-1];else{var s=i/a;this._setCurvePoint(t,s,n,i*2)}return n}},{key:"_setCurvePoint",value:function(t,a,n,i){if(t.length<=2)n[i]=t[0],n[i+1]=t[1];else{for(var s=Array(t.length-2),o=0;o0}},o=function(f){var c=f.pstyle("text-events").strValue==="yes";return c?Bn.USE_BB:Bn.IGNORE},u=function(f){var c=f.position(),h=c.x,d=c.y,y=f.outerWidth(),g=f.outerHeight();return{w:y,h:g,x1:h-y/2,y1:d-g/2}};t.drawing.addAtlasCollection("node",{texRows:r.webglTexRowsNodes}),t.drawing.addAtlasCollection("label",{texRows:r.webglTexRows}),t.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),t.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:u,isSimple:Ky,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),t.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:u,isVisible:s("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),t.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:u,isVisible:s("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),t.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:o,getKey:Cs(e.getLabelKey,null),getBoundingBox:Ts(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:n(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:i("label")}),t.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:o,getKey:Cs(e.getSourceLabelKey,"source"),getBoundingBox:Ts(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:n("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:i("source-label")}),t.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:o,getKey:Cs(e.getTargetLabelKey,"target"),getBoundingBox:Ts(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:n("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:i("target-label")});var l=Na(function(){console.log("garbage collect flag set"),t.data.gc=!0},1e4);t.onUpdateEleCalcs(function(v,f){var c=!1;f&&f.length>0&&(c|=t.drawing.invalidate(f)),c&&l()}),hm(t)};function dm(r){var e=r.cy.container(),t=e&&e.style&&e.style.backgroundColor||"white";return av(t)}function Mf(r,e){var t=r._private.rscratch;return xr(t,"labelWrapCachedLines",e)||[]}var Cs=function(e,t){return function(a){var n=e(a),i=Mf(a,t);return i.length>1?i.map(function(s,o){return"".concat(n,"_").concat(o)}):n}},Ts=function(e,t){return function(a,n){var i=e(a);if(typeof n=="string"){var s=n.indexOf("_");if(s>0){var o=Number(n.substring(s+1)),u=Mf(a,t),l=i.h/u.length,v=l*o,f=i.y1+v;return{x1:i.x1,w:i.w,y1:f,h:l,yOffset:v}}}return i}};function hm(r){{var e=r.render;r.render=function(i){i=i||{};var s=r.cy;r.webgl&&(s.zoom()>Tf?(gm(r),e.call(r,i)):(pm(r),If(r,i,wa.SCREEN)))}}{var t=r.matchCanvasSize;r.matchCanvasSize=function(i){t.call(r,i),r.pickingFrameBuffer.setFramebufferAttachmentSizes(r.canvasWidth,r.canvasHeight),r.pickingFrameBuffer.needsDraw=!0}}r.findNearestElements=function(i,s,o,u){return Em(r,i,s)};{var a=r.invalidateCachedZSortedEles;r.invalidateCachedZSortedEles=function(){a.call(r),r.pickingFrameBuffer.needsDraw=!0}}{var n=r.notify;r.notify=function(i,s){n.call(r,i,s),i==="viewport"||i==="bounds"?r.pickingFrameBuffer.needsDraw=!0:i==="background"&&r.drawing.invalidate(s,{type:"node-body"})}}}function gm(r){var e=r.data.contexts[r.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function pm(r){var e=function(a){a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,r.canvasWidth,r.canvasHeight),a.restore()};e(r.data.contexts[r.NODE]),e(r.data.contexts[r.DRAG])}function ym(r){var e=r.canvasWidth,t=r.canvasHeight,a=yo(r),n=a.pan,i=a.zoom,s=ws();gn(s,s,[n.x,n.y]),Gs(s,s,[i,i]);var o=ws();tm(o,e,t);var u=ws();return rm(u,o,s),u}function Lf(r,e){var t=r.canvasWidth,a=r.canvasHeight,n=yo(r),i=n.pan,s=n.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t,a),e.translate(i.x,i.y),e.scale(s,s)}function mm(r,e){r.drawSelectionRectangle(e,function(t){return Lf(r,t)})}function bm(r){var e=r.data.contexts[r.NODE];e.save(),Lf(r,e),e.strokeStyle="rgba(0, 0, 0, 0.3)",e.beginPath(),e.moveTo(-1e3,0),e.lineTo(1e3,0),e.stroke(),e.beginPath(),e.moveTo(0,-1e3),e.lineTo(0,1e3),e.stroke(),e.restore()}function wm(r){var e=function(n,i,s){for(var o=n.atlasManager.getAtlasCollection(i),u=r.data.contexts[r.NODE],l=o.atlases,v=0;v=0&&w.add(x)}return w}function Em(r,e,t){var a=xm(r,e,t),n=r.getCachedZSortedEles(),i,s,o=Cr(a),u;try{for(o.s();!(u=o.n()).done;){var l=u.value,v=n[l];if(!i&&v.isNode()&&(i=v),!s&&v.isEdge()&&(s=v),i&&s)break}}catch(f){o.e(f)}finally{o.f()}return[i,s].filter(Boolean)}function Ss(r,e,t){var a=r.drawing;e+=1,t.isNode()?(a.drawNode(t,e,"node-underlay"),a.drawNode(t,e,"node-body"),a.drawTexture(t,e,"label"),a.drawNode(t,e,"node-overlay")):(a.drawEdgeLine(t,e),a.drawEdgeArrow(t,e,"source"),a.drawEdgeArrow(t,e,"target"),a.drawTexture(t,e,"label"),a.drawTexture(t,e,"edge-source-label"),a.drawTexture(t,e,"edge-target-label"))}function If(r,e,t){var a;r.webglDebug&&(a=performance.now());var n=r.drawing,i=0;if(t.screen&&r.data.canvasNeedsRedraw[r.SELECT_BOX]&&mm(r,e),r.data.canvasNeedsRedraw[r.NODE]||t.picking){var s=r.data.contexts[r.WEBGL];t.screen?(s.clearColor(0,0,0,0),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA)):s.disable(s.BLEND),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.viewport(0,0,s.canvas.width,s.canvas.height);var o=ym(r),u=r.getCachedZSortedEles();if(i=u.length,n.startFrame(o,t),t.screen){for(var l=0;l0&&s>0){h.clearRect(0,0,i,s),h.globalCompositeOperation="source-over";var d=this.getCachedZSortedEles();if(r.full)h.translate(-a.x1*l,-a.y1*l),h.scale(l,l),this.drawElements(h,d),h.scale(1/l,1/l),h.translate(a.x1*l,a.y1*l);else{var y=e.pan(),g={x:y.x*l,y:y.y*l};l*=e.zoom(),h.translate(g.x,g.y),h.scale(l,l),this.drawElements(h,d),h.scale(1/l,1/l),h.translate(-g.x,-g.y)}r.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=r.bg,h.rect(0,0,i,s),h.fill())}return c};function Cm(r,e){for(var t=atob(r),a=new ArrayBuffer(t.length),n=new Uint8Array(a),i=0;i"u"?"undefined":rr(OffscreenCanvas))!=="undefined")t=new OffscreenCanvas(r,e);else{var a=this.cy.window(),n=a.document;t=n.createElement("canvas"),t.width=r,t.height=e}return t};[kf,Hr,Qr,po,Mt,pt,mr,Rf,yt,Ga,zf].forEach(function(r){ye(Te,r)});var km=[{name:"null",impl:ff},{name:"base",impl:Ef},{name:"canvas",impl:Tm}],Dm=[{type:"layout",extensions:Zp},{type:"renderer",extensions:km}],Vf={},qf={};function _f(r,e,t){var a=t,n=function(T){ze("Can not register `"+e+"` for `"+r+"` since `"+T+"` already exists in the prototype and can not be overridden")};if(r==="core"){if(Pa.prototype[e])return n(e);Pa.prototype[e]=t}else if(r==="collection"){if(lr.prototype[e])return n(e);lr.prototype[e]=t}else if(r==="layout"){for(var i=function(T){this.options=T,t.call(this,T),Me(this._private)||(this._private={}),this._private.cy=T.cy,this._private.listeners=[],this.createEmitter()},s=i.prototype=Object.create(t.prototype),o=[],u=0;u{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",E(e)),T(e,0),i.trace(f)},"adjustClustersAndEdges"),T=X((e,t)=>{var c,a;if(i.warn("extractor - ",t,E(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",E(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,")",E(v)),i.debug("Old graph after copy",E(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",E(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
+ Node.id = `,d,`
+ data=`,w.height,`
+Parent cluster`,c.height),t.setNode(c.id,w),t.parent(d)||(i.trace("Setting parent",d,c.id),t.setParent(d,c.id,w))}if(i.info("(Insert) Node XXX"+d+": "+JSON.stringify(t.node(d))),s!=null&&s.clusterNode){i.info("Cluster identified XBX",d,s.width,t.node(d));const{ranksep:w,nodesep:m}=t.graph();s.graph.setGraph({...s.graph.graph(),ranksep:w+25,nodesep:m});const N=await j(g,s.graph,n,o,t.node(d),a),S=N.elem;z(s,S),s.diff=N.diff||0,i.info("New compound node after recursive render XAX",d,"width",s.width,"height",s.height),U(S,s)}else t.children(d).length>0?(i.trace("Cluster - the non recursive path XBX",d,s.id,s,s.width,"Graph:",t),i.trace(D(s.id,t)),f.set(s.id,{id:D(s.id,t),node:s})):(i.trace("Node - the non recursive path XAX",d,g,t.node(d),r),await $(g,t.node(d),{config:a,dir:r}))})),await X(async()=>{const d=t.edges().map(async function(s){const w=t.edge(s.v,s.w,s.name);i.info("Edge "+s.v+" -> "+s.w+": "+JSON.stringify(s)),i.info("Edge "+s.v+" -> "+s.w+": ",s," ",JSON.stringify(t.edge(s))),i.info("Fix",f,"ids:",s.v,s.w,"Translating: ",f.get(s.v),f.get(s.w)),await Z(C,w)});await Promise.all(d)},"processEdges")(),i.info("Graph before layout:",JSON.stringify(E(t))),i.info("############################################# XXX"),i.info("### Layout ### XXX"),i.info("############################################# XXX"),I(t),i.info("Graph after layout:",JSON.stringify(E(t)));let p=0,{subGraphTitleTotalMargin:y}=q(a);return await Promise.all(oe(t).map(async function(d){var w;const s=t.node(d);if(i.info("Position XBX => "+d+": ("+s.x,","+s.y,") width: ",s.width," height: ",s.height),s!=null&&s.clusterNode)s.y+=y,i.info("A tainted cluster node XBX1",d,s.id,s.width,s.height,s.x,s.y,t.parent(d)),f.get(s.id).node=s,P(s);else if(t.children(d).length>0){i.info("A pure cluster node XBX1",d,s.id,s.x,s.y,s.width,s.height,t.parent(d)),s.height+=y,t.node(s.parentId);const m=(s==null?void 0:s.padding)/2||0,N=((w=s==null?void 0:s.labelBBox)==null?void 0:w.height)||0,S=N-m||0;i.debug("OffsetY",S,"labelHeight",N,"halfPadding",m),await K(l,s),f.get(s.id).node=s}else{const m=t.node(s.parentId);s.y+=y/2,i.info("A regular node XBX1 - using the padding",s.id,"parent",s.parentId,s.width,s.height,s.x,s.y,"offsetY",s.offsetY,"parent",m,m==null?void 0:m.offsetY,s),P(s)}})),t.edges().forEach(function(d){const s=t.edge(d);i.info("Edge "+d.v+" -> "+d.w+": "+JSON.stringify(s),s),s.points.forEach(S=>S.y+=y/2);const w=t.node(d.v);var m=t.node(d.w);const N=Q(v,s,f,n,w,m,o);W(s,N)}),t.nodes().forEach(function(d){const s=t.node(d);i.info(d,s.type,s.diff),s.isGroup&&(p=s.diff)}),i.warn("Returning from recursive render XAX",u,p),{elem:u,diff:p}},"recursiveRender"),we=X(async(e,t)=>{var a,r,u,l,v,C;const n=new B({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:((a=e.config)==null?void 0:a.nodeSpacing)||((u=(r=e.config)==null?void 0:r.flowchart)==null?void 0:u.nodeSpacing)||e.nodeSpacing,ranksep:((l=e.config)==null?void 0:l.rankSpacing)||((C=(v=e.config)==null?void 0:v.flowchart)==null?void 0:C.rankSpacing)||e.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),o=t.select("g");F(o,e.markers,e.type,e.diagramId),Y(),_(),H(),te(),e.nodes.forEach(g=>{n.setNode(g.id,{...g}),g.parentId&&n.setParent(g.id,g.parentId)}),i.debug("Edges:",e.edges),e.edges.forEach(g=>{if(g.start===g.end){const h=g.start,p=h+"---"+h+"---1",y=h+"---"+h+"---2",d=n.node(h);n.setNode(p,{domId:p,id:p,parentId:d.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),n.setParent(p,d.parentId),n.setNode(y,{domId:y,id:y,parentId:d.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),n.setParent(y,d.parentId);const s=structuredClone(g),w=structuredClone(g),m=structuredClone(g);s.label="",s.arrowTypeEnd="none",s.id=h+"-cyclic-special-1",w.arrowTypeStart="none",w.arrowTypeEnd="none",w.id=h+"-cyclic-special-mid",m.label="",d.isGroup&&(s.fromCluster=h,m.toCluster=h),m.id=h+"-cyclic-special-2",m.arrowTypeStart="none",n.setEdge(h,p,s,h+"-cyclic-special-0"),n.setEdge(p,y,w,h+"-cyclic-special-1"),n.setEdge(y,h,m,h+"-cyc=1e21?n.toLocaleString("en").replace(/,/g,""):n.toString(10)}function j(n,t){if(!isFinite(n)||n===0)return null;var e=(n=t?n.toExponential(t-1):n.toExponential()).indexOf("e"),i=n.slice(0,e);return[i.length>1?i[0]+i.slice(2):i,+n.slice(e+1)]}function K(n){return n=j(Math.abs(n)),n?n[1]:NaN}function Q(n,t){return function(e,i){for(var o=e.length,a=[],c=0,h=n[0],M=0;o>0&&h>0&&(M+h+1>i&&(h=Math.max(1,i-M)),a.push(e.substring(o-=h,o+h)),!((M+=h+1)>i));)h=n[c=(c+1)%n.length];return a.reverse().join(t)}}function V(n){return function(t){return t.replace(/[0-9]/g,function(e){return n[+e]})}}var W=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function $(n){if(!(t=W.exec(n)))throw new Error("invalid format: "+n);var t;return new L({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}$.prototype=L.prototype;function L(n){this.fill=n.fill===void 0?" ":n.fill+"",this.align=n.align===void 0?">":n.align+"",this.sign=n.sign===void 0?"-":n.sign+"",this.symbol=n.symbol===void 0?"":n.symbol+"",this.zero=!!n.zero,this.width=n.width===void 0?void 0:+n.width,this.comma=!!n.comma,this.precision=n.precision===void 0?void 0:+n.precision,this.trim=!!n.trim,this.type=n.type===void 0?"":n.type+""}L.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function _(n){n:for(var t=n.length,e=1,i=-1,o;e0&&(i=0);break}return i>0?n.slice(0,i)+n.slice(o+1):n}var N;function v(n,t){var e=j(n,t);if(!e)return N=void 0,n.toPrecision(t);var i=e[0],o=e[1],a=o-(N=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,c=i.length;return a===c?i:a>c?i+new Array(a-c+1).join("0"):a>0?i.slice(0,a)+"."+i.slice(a):"0."+new Array(1-a).join("0")+j(n,Math.max(0,t+a-1))[0]}function X(n,t){var e=j(n,t);if(!e)return n+"";var i=e[0],o=e[1];return o<0?"0."+new Array(-o).join("0")+i:i.length>o+1?i.slice(0,o+1)+"."+i.slice(o+1):i+new Array(o-i.length+2).join("0")}const O={"%":(n,t)=>(n*100).toFixed(t),b:n=>Math.round(n).toString(2),c:n=>n+"",d:J,e:(n,t)=>n.toExponential(t),f:(n,t)=>n.toFixed(t),g:(n,t)=>n.toPrecision(t),o:n=>Math.round(n).toString(8),p:(n,t)=>X(n*100,t),r:X,s:v,X:n=>Math.round(n).toString(16).toUpperCase(),x:n=>Math.round(n).toString(16)};function R(n){return n}var U=Array.prototype.map,Y=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function nn(n){var t=n.grouping===void 0||n.thousands===void 0?R:Q(U.call(n.grouping,Number),n.thousands+""),e=n.currency===void 0?"":n.currency[0]+"",i=n.currency===void 0?"":n.currency[1]+"",o=n.decimal===void 0?".":n.decimal+"",a=n.numerals===void 0?R:V(U.call(n.numerals,String)),c=n.percent===void 0?"%":n.percent+"",h=n.minus===void 0?"−":n.minus+"",M=n.nan===void 0?"NaN":n.nan+"";function T(f,g){f=$(f);var b=f.fill,p=f.align,m=f.sign,w=f.symbol,S=f.zero,E=f.width,F=f.comma,y=f.precision,C=f.trim,d=f.type;d==="n"?(F=!0,d="g"):O[d]||(y===void 0&&(y=12),C=!0,d="g"),(S||b==="0"&&p==="=")&&(S=!0,b="0",p="=");var q=(g&&g.prefix!==void 0?g.prefix:"")+(w==="$"?e:w==="#"&&/[boxX]/.test(d)?"0"+d.toLowerCase():""),B=(w==="$"?i:/[%p]/.test(d)?c:"")+(g&&g.suffix!==void 0?g.suffix:""),D=O[d],H=/[defgprs%]/.test(d);y=y===void 0?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y));function G(r){var l=q,u=B,x,I,k;if(d==="c")u=D(r)+u,r="";else{r=+r;var P=r<0||1/r<0;if(r=isNaN(r)?M:D(Math.abs(r),y),C&&(r=_(r)),P&&+r==0&&m!=="+"&&(P=!1),l=(P?m==="("?m:h:m==="-"||m==="("?"":m)+l,u=(d==="s"&&!isNaN(r)&&N!==void 0?Y[8+N/3]:"")+u+(P&&m==="("?")":""),H){for(x=-1,I=r.length;++xk||k>57){u=(k===46?o+r.slice(x+1):r.slice(x))+u,r=r.slice(0,x);break}}}F&&!S&&(r=t(r,1/0));var z=l.length+r.length+u.length,s=z