diff --git a/.gitignore b/.gitignore index 5ac8096..5cd9827 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ # will have compiled files and executables debug/ target/ -doc/ # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html @@ -18,4 +17,6 @@ Cargo.lock .idea/ *.dot -.direnv \ No newline at end of file +.direnv + +**/render-docs \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index d423abc..95f4c41 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,9 +4,11 @@ members = [ "scopegraphs", "scopegraphs-macros", "scopegraphs-regular-expressions", + "scopegraphs-render-docs", ] default-members = [ "scopegraphs", "scopegraphs-macros", "scopegraphs-regular-expressions", + "scopegraphs-render-docs", ] diff --git a/flake.nix b/flake.nix index f4da116..42180ad 100644 --- a/flake.nix +++ b/flake.nix @@ -20,13 +20,71 @@ }; in { devShells.default = pkgs.mkShell rec { - rustToolchain = pkgs.rust-bin.stable.latest.default.override { - targets = [ "wasm32-unknown-unknown" ]; - extensions = [ "rust-src" "rust-analyzer" ]; - }; - RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library"; + buildInputs = with pkgs; [ + # necessary for building wgpu in 3rd party packages (in most cases) + libxkbcommon + wayland + xorg.libX11 + xorg.libXcursor + xorg.libXrandr + xorg.libXi + alsa-lib + fontconfig + freetype + shaderc + directx-shader-compiler + pkg-config + cmake + mold # could use any linker, needed for rustix (but mold is fast) - buildInputs = with pkgs; [ trunk rustToolchain cargo-watch ]; + libGL + vulkan-headers + vulkan-loader + vulkan-tools + vulkan-tools-lunarg + vulkan-extension-layer + vulkan-validation-layers # don't need them *strictly* but immensely helpful + + cargo-nextest + cargo-fuzz + cargo-watch + + # nice for developing wgpu itself + typos + + # if you don't already have rust installed through other means, + # this shell.nix can do that for you with this below + yq # for tomlq below + rustup + + # nice tools + gdb + rr + evcxr + valgrind + renderdoc + just + + # for this project + nodePackages.browser-sync + ]; + + shellHook = '' + export RUSTC_VERSION="$(tomlq -r .toolchain.channel rust-toolchain.toml)" + export PATH="$PATH:''${CARGO_HOME:-~/.cargo}/bin" + export PATH="$PATH:''${RUSTUP_HOME:-~/.rustup/toolchains/$RUSTC_VERSION-x86_64-unknown-linux/bin}" + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${ + builtins.toString (pkgs.lib.makeLibraryPath buildInputs) + }"; + + # for this project + cargo install cargo-docs-rs + + rustup default $RUSTC_VERSION + rustup toolchain add nightly + rustup component add rust-src rust-analyzer + + ''; }; }); } diff --git a/scopegraphs-macros/Cargo.toml b/scopegraphs-macros/Cargo.toml index 7672e52..e191041 100644 --- a/scopegraphs-macros/Cargo.toml +++ b/scopegraphs-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "scopegraphs-macros" -version = "0.2.9" +version = "0.2.13" edition = "2021" license = "MIT OR Apache-2.0" authors = [ @@ -20,7 +20,7 @@ proc-macro = true [dependencies] syn = { version = "2.0.29", features = [] } quote = "1.0.33" -scopegraphs-regular-expressions = { path = "../scopegraphs-regular-expressions", features = ["dot"], version = "0.2.0" } +scopegraphs-regular-expressions = { path = "../scopegraphs-regular-expressions", features = ["dot"], version = "0.2" } proc-macro2 = "1.0.69" [dev-dependencies] diff --git a/scopegraphs-regular-expressions/Cargo.toml b/scopegraphs-regular-expressions/Cargo.toml index 20815bd..0020135 100644 --- a/scopegraphs-regular-expressions/Cargo.toml +++ b/scopegraphs-regular-expressions/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "scopegraphs-regular-expressions" -version = "0.2.10" +version = "0.2.13" edition = "2021" license = "MIT OR Apache-2.0" authors = [ diff --git a/scopegraphs-render-docs/.gitignore b/scopegraphs-render-docs/.gitignore new file mode 100644 index 0000000..39b97e9 --- /dev/null +++ b/scopegraphs-render-docs/.gitignore @@ -0,0 +1,6 @@ +**/target +**/*.rs.bk +Cargo.lock +.idea/ + +render-docs \ No newline at end of file diff --git a/scopegraphs-render-docs/CHANGELOG.md b/scopegraphs-render-docs/CHANGELOG.md new file mode 100644 index 0000000..b4a6951 --- /dev/null +++ b/scopegraphs-render-docs/CHANGELOG.md @@ -0,0 +1,149 @@ + +### v0.5.0 (2024-01-12) + +#### Breaking Changes + +* include_mmd! now always uses CARGO_MANIFEST_DIR as root (PR #47 by [Rjected](https://github.com/Rjected)) + +#### Miscellaneous + + +### v0.4.0 (2023-12-13) YANKED + +#### Breaking Changes + +* `path` attribute is no longer supported for importing diagrams from external files + +#### Features + +* `include_mmd!` macro-like syntax for embedding diagrams from files +* multiple diagrams can now be imported from filesystem per documented entity +* imported diagrams can now be placed freely at any place inside the doc comment + +#### Miscellaneous + +* syn bumped to version 2 (PR #42 by [maurer](https://github.com/maurer) + + +### v0.3.1 (2023-04-17) + +#### Features + +* mermaid is updated to v10 (PR #46 by [frehberg](https://github.com/frehberg)) +* better handling of a failure to load mermaidjs (PR #46 by [frehberg](https://github.com/frehberg)) + +#### Miscellaneous + +* add Frehberg as a maintainer on GitHub, and package owner on Crates.io + + +### v0.3.0 (2023-02-16) + +#### Maintenance + +* update dependencies + + +### v0.2.2 (2023-02-02) + +#### Bug Fixes + +* gracefully handle failure to write mermaid.js files ([514c67c9](514c67c9)) + + +### v0.2.1 (2023-02-01) + +#### Maintenance + +* MermaidJS updated to version 9.3.0 + + +## v0.2.0 (2023-01-31) + +#### Bug Fixes + +* embedding broken when dependants are built with `--no-deps` [06e263b3](06e263b3) by [frehberg](https://github.com/frehberg) + +#### Features + +* allow loading diagrams from filesystem via macro attrs [0eb7e08f](0eb7e08f) by [drbh](https://github.com/drbh) + + +### v0.1.12 (2022-08-17) + +mermaid.js upgraded to version 9.1.4 + +#### Bug Fixes + +* failing doctest ([680ea555](680ea555)) +* typo in changelog ([75419467](75419467)) + + + +## 0.1.11 (2021-05-31) + + +#### Features + +* verbose mermaid.js logging ([33746ab3](33746ab3)) by [yunhong](https://github.com/allenchou13) +* mermaid.js version 13.4 ([33746ab3](33746ab3)) by [yunhong](https://github.com/allenchou13) + + +## 0.1.10 (2021-05-31) + + +#### Features + +* lower MSRV to 1.31.1 ([2fd0f032](2fd0f032)) + + +## 0.1.9 (2021-05-15) + +#### Features + +* upgrade mermaid.js to 8.10.1 ([fbb13e1db](fbb13e1db)) by [José Duarte](https://github.com/jmg-duarte) + + +## 0.1.8 (2021-04-08) + +#### Bug Fixes + +* fallback to CDN version of mermaid.js if local isn't found ([de9f274e](de9f274e)) + + +## 0.1.7 (2021-04-08) + +#### Features + +* use local version of the mermaid.js library ([8f523072](8f523072)) by [Le Savon Fou](https://github.com/lesavonfou) + +#### Bug Fixes + +* fix doctests ([ea685563](ea685563)) by [Le Savon Fou](https://github.com/lesavonfou) + + +## 0.1.6 (2021-01-28) + + +#### Bug Fixes + +* use regex to detect the dark themes reliably on docs.rs ([ce24cd6e](ce24cd6e)) + + + +## 0.1.5 (2021-01-28) + + +#### Bug Fixes + +* initialization script wasn't firing at page load ([36268718](36268718)) + + + +## 0.1.4 (2021-01-28) + + +#### Features + +* dark mode and custom themes ([62ec6783](62ec6783)) +* add crossorigin attribute to script tag ([fa9f4546](fa9f4546)) by [Mark Schmale](https://github.com/themasch) diff --git a/scopegraphs-render-docs/Cargo.toml b/scopegraphs-render-docs/Cargo.toml new file mode 100644 index 0000000..17d3009 --- /dev/null +++ b/scopegraphs-render-docs/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "scopegraphs-render-docs" +version = "0.2.18" +authors = ["Mike Lubinets ", "Frank Rehberger ", "Jonathan Dönszelmann "] +description = "Derived from Aquamarine, a mermaid.js integration for rustdoc, renders scopegraphs by executing doctests to generate mermaid" +keywords = ["proc_macro", "docs", "rustdoc", "mermaid", "diagram"] +categories = ["visualization", "development-tools::build-utils"] +repository = "https://github.com/metaborg/rust-scopegraphs/" +edition = "2018" +license = "MIT" +include = ["src/**/*", "Cargo.toml", "doc/js/**"] + +[lib] +proc-macro = true + +[dependencies] +quote = "1" +proc-macro2 = "1" +proc-macro-error = { version = "1", default-features = false } +itertools = "0.10" +syn = "2" +include_dir = "0.7" +uuid = { version = "1.8.0", features = ["v4"] } + +[dev-dependencies] +pretty_assertions = "1" diff --git a/scopegraphs-render-docs/LICENSE b/scopegraphs-render-docs/LICENSE new file mode 100644 index 0000000..117ef4d --- /dev/null +++ b/scopegraphs-render-docs/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020 Mike Lubinets + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/scopegraphs-render-docs/README.md b/scopegraphs-render-docs/README.md new file mode 100644 index 0000000..32a6892 --- /dev/null +++ b/scopegraphs-render-docs/README.md @@ -0,0 +1,93 @@ +# Aquamarine + +[![GitHub](https://img.shields.io/github/license/mersinvald/aquamarine)](LICENSE) +[![crates.io](https://img.shields.io/crates/d/aquamarine)](https://crates.io/crates/aquamarine) +[![docs.rs](https://docs.rs/aquamarine/badge.svg)](https://docs.rs/aquamarine) + +*Compiler support: this crate requires rustc 1.38.0 or newer* + +Aquamarine is a procedural macro extension for [rustdoc](https://doc.rust-lang.org/rustdoc/index.html), +that aims to improve the visual component of Rust documentation through use of the [mermaid.js](https://mermaid-js.github.io/mermaid/#/) diagrams. + +`#[aquamarine]` macro works through embedding the [mermaid.js](https://github.com/mermaid-js/mermaid) into the generated rustdoc HTML page, modifying the doc comment attributes. + +To inline a diagram into the documentation, use the `mermaid` snippet in a doc-string: + +```rust +#[cfg_attr(doc, aquamarine::aquamarine)] +/// ```mermaid +/// graph LR +/// s([Source]) --> a[[aquamarine]] +/// r[[rustdoc]] --> f([Docs w/ Mermaid!]) +/// subgraph rustc[Rust Compiler] +/// a -. inject mermaid.js .-> r +/// end +/// ``` +pub fn example() {} +``` +The diagram will appear in place of the `mermaid` code block, preserving all the comments around it. You can even add multiple diagrams! + +To see it in action, go to the [demo crate](https://docs.rs/aquamarine-demo-crate) docs.rs page. + +![light](resources/light.png) + +You can learn more about `mermaid.js` and what it can do in the mermaid's [documentation MdBook](https://mermaid-js.github.io/mermaid/#/) + +### Dark-mode + +Aquamarine will automatically select the `dark` theme as a default, if the current `rustdoc` theme is either `ayu` or `dark`. + +You might need to reload the page to redraw the diagrams after changing the theme. + +![light](resources/dark.png) + +### Custom themes + +Theming is supported on per-diagram basis, through the mermaid's `%%init%%` attribute. + +*Note*: custom theme will override the default theme + +```rust +/// ```mermaid +/// %%{init: { +/// 'theme': 'base', +/// 'themeVariables': { +/// 'primaryColor': '#ffcccc', +/// 'edgeLabelBackground':'#ccccff', +/// 'tertiaryColor': '#fff0f0' }}}%% +/// graph TD +/// A(Diagram needs to be drawn) --> B{Does it have 'init' annotation?} +/// B -->|No| C(Apply default theme) +/// B -->|Yes| D(Apply customized theme) +/// ``` +``` + +![custom](resources/custom.png) + +To learn more, see the [Theming Section](https://mermaid-js.github.io/mermaid/#/theming) of the mermaid.js book + +### Separating diagrams from code + +A diagram, or multiple, can be loaded from file to reduce clutter in the documentation comments. + + +```rust +#[cfg_attr(doc, aquamarine::aquamarine)] +/// My diagram #1 +/// include_mmd!("diagram1.mmd") +/// My diagram #2 +/// include_mmd!("diagram2.mmd") +pub fn example_foad_from_file() {} +``` + +![import](resources/import.png) + +### In the wild + +Crates that use `aquamarine` in their documentation + + - [google/autocxx](https://github.com/google/autocxx) + - [replicadse/senile](https://github.com/replicadse/senile) + - [teloxide](https://github.com/teloxide/teloxide) + +[and other](https://crates.io/crates/aquamarine/reverse_dependencies) diff --git a/scopegraphs-render-docs/doc/js/Diagram.d.ts b/scopegraphs-render-docs/doc/js/Diagram.d.ts new file mode 100644 index 0000000..f6194c8 --- /dev/null +++ b/scopegraphs-render-docs/doc/js/Diagram.d.ts @@ -0,0 +1,29 @@ +import { DetailedError } from './utils'; +export declare type ParseErrorFunction = (err: string | DetailedError | unknown, hash?: any) => void; +/** + * An object representing a parsed mermaid diagram definition. + * @privateRemarks This is exported as part of the public mermaidAPI. + */ +export declare class Diagram { + text: string; + type: string; + parser: any; + renderer: any; + db: import("./diagram-api/types").DiagramDb; + private detectError?; + constructor(text: string); + parse(): void; + render(id: string, version: string): Promise; + getParser(): any; + getType(): string; +} +/** + * Parse the text asynchronously and generate a Diagram object asynchronously. + * **Warning:** This function may be changed in the future. + * @alpha + * @param text - The mermaid diagram definition. + * @returns A the Promise of a Diagram object. + * @throws {@link UnknownDiagramError} if the diagram type can not be found. + * @privateRemarks This is exported as part of the public mermaidAPI. + */ +export declare const getDiagramFromText: (text: string) => Promise; diff --git a/scopegraphs-render-docs/doc/js/accessibility.d.ts b/scopegraphs-render-docs/doc/js/accessibility.d.ts new file mode 100644 index 0000000..126ec0b --- /dev/null +++ b/scopegraphs-render-docs/doc/js/accessibility.d.ts @@ -0,0 +1,27 @@ +/** + * Accessibility (a11y) functions, types, helpers + * @see https://www.w3.org/WAI/ + * @see https://www.w3.org/TR/wai-aria-1.1/ + * @see https://www.w3.org/TR/svg-aam-1.0/ + * + */ +import { D3Element } from './mermaidAPI'; +/** + * Add role and aria-roledescription to the svg element + * + * @param svg - d3 object that contains the SVG HTML element + * @param diagramType - diagram name for to the aria-roledescription + */ +export declare function setA11yDiagramInfo(svg: D3Element, diagramType: string | null | undefined): void; +/** + * Add an accessible title and/or description element to a chart. + * The title is usually not displayed and the description is never displayed. + * + * The following charts display their title as a visual and accessibility element: gantt + * + * @param svg - d3 node to insert the a11y title and desc info + * @param a11yTitle - a11y title. null and undefined are meaningful: means to skip it + * @param a11yDesc - a11y description. null and undefined are meaningful: means to skip it + * @param baseId - id used to construct the a11y title and description id + */ +export declare function addSVGa11yTitleDescription(svg: D3Element, a11yTitle: string | null | undefined, a11yDesc: string | null | undefined, baseId: string): void; diff --git a/scopegraphs-render-docs/doc/js/accessibility.spec.d.ts b/scopegraphs-render-docs/doc/js/accessibility.spec.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/scopegraphs-render-docs/doc/js/accessibility.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/scopegraphs-render-docs/doc/js/arc-c50f0902.js b/scopegraphs-render-docs/doc/js/arc-c50f0902.js new file mode 100644 index 0000000..e426fcb --- /dev/null +++ b/scopegraphs-render-docs/doc/js/arc-c50f0902.js @@ -0,0 +1,145 @@ +import { c as constant, p as path } from "./constant-b644328d.js"; +import { O as pi, P as cos, Q as sin, R as halfPi, T as epsilon, K as tau, V as sqrt, W as min, X as abs, Y as atan2, Z as asin, _ as acos, $ as max } from "./utils-1aebe9b6.js"; +function arcInnerRadius(d) { + return d.innerRadius; +} +function arcOuterRadius(d) { + return d.outerRadius; +} +function arcStartAngle(d) { + return d.startAngle; +} +function arcEndAngle(d) { + return d.endAngle; +} +function arcPadAngle(d) { + return d && d.padAngle; +} +function intersect(x0, y0, x1, y1, x2, y2, x3, y3) { + var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10; + if (t * t < epsilon) + return; + t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t; + return [x0 + t * x10, y0 + t * y10]; +} +function cornerTangents(x0, y0, x1, y1, r1, rc, cw) { + var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00; + if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) + cx0 = cx1, cy0 = cy1; + return { + cx: cx0, + cy: cy0, + x01: -ox, + y01: -oy, + x11: cx0 * (r1 / r - 1), + y11: cy0 * (r1 / r - 1) + }; +} +function d3arc() { + var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null; + function arc() { + var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi, a1 = endAngle.apply(this, arguments) - halfPi, da = abs(a1 - a0), cw = a1 > a0; + if (!context) + context = buffer = path(); + if (r1 < r0) + r = r1, r1 = r0, r0 = r; + if (!(r1 > epsilon)) + context.moveTo(0, 0); + else if (da > tau - epsilon) { + context.moveTo(r1 * cos(a0), r1 * sin(a0)); + context.arc(0, 0, r1, a0, a1, !cw); + if (r0 > epsilon) { + context.moveTo(r0 * cos(a1), r0 * sin(a1)); + context.arc(0, 0, r0, a1, a0, cw); + } + } else { + var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1; + if (rp > epsilon) { + var p0 = asin(rp / r0 * sin(ap)), p1 = asin(rp / r1 * sin(ap)); + if ((da0 -= p0 * 2) > epsilon) + p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0; + else + da0 = 0, a00 = a10 = (a0 + a1) / 2; + if ((da1 -= p1 * 2) > epsilon) + p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1; + else + da1 = 0, a01 = a11 = (a0 + a1) / 2; + } + var x01 = r1 * cos(a01), y01 = r1 * sin(a01), x10 = r0 * cos(a10), y10 = r0 * sin(a10); + if (rc > epsilon) { + var x11 = r1 * cos(a11), y11 = r1 * sin(a11), x00 = r0 * cos(a00), y00 = r0 * sin(a00), oc; + if (da < pi && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) { + var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]); + rc0 = min(rc, (r0 - lc) / (kc - 1)); + rc1 = min(rc, (r1 - lc) / (kc + 1)); + } + } + if (!(da1 > epsilon)) + context.moveTo(x01, y01); + else if (rc1 > epsilon) { + t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw); + t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw); + context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01); + if (rc1 < rc) + context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw); + else { + context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw); + context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw); + context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw); + } + } else + context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw); + if (!(r0 > epsilon) || !(da0 > epsilon)) + context.lineTo(x10, y10); + else if (rc0 > epsilon) { + t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw); + t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw); + context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01); + if (rc0 < rc) + context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw); + else { + context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw); + context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw); + context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw); + } + } else + context.arc(0, 0, r0, a10, a00, cw); + } + context.closePath(); + if (buffer) + return context = null, buffer + "" || null; + } + arc.centroid = function() { + var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2; + return [cos(a) * r, sin(a) * r]; + }; + arc.innerRadius = function(_) { + return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant(+_), arc) : innerRadius; + }; + arc.outerRadius = function(_) { + return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant(+_), arc) : outerRadius; + }; + arc.cornerRadius = function(_) { + return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant(+_), arc) : cornerRadius; + }; + arc.padRadius = function(_) { + return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant(+_), arc) : padRadius; + }; + arc.startAngle = function(_) { + return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), arc) : startAngle; + }; + arc.endAngle = function(_) { + return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), arc) : endAngle; + }; + arc.padAngle = function(_) { + return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), arc) : padAngle; + }; + arc.context = function(_) { + return arguments.length ? (context = _ == null ? null : _, arc) : context; + }; + return arc; +} +export { + d3arc as d +}; +//# sourceMappingURL=arc-c50f0902.js.map diff --git a/scopegraphs-render-docs/doc/js/arc-f7872e1e.js b/scopegraphs-render-docs/doc/js/arc-f7872e1e.js new file mode 100644 index 0000000..288fe32 --- /dev/null +++ b/scopegraphs-render-docs/doc/js/arc-f7872e1e.js @@ -0,0 +1,85 @@ +import { c as V, p as sn } from "./constant-2fe7eae5.js"; +import { O as en, P as Z, Q as O, R as rn, T as y, K as ln, V as z, W as b, X as un, Y as t, Z as an, _ as on, $ as tn } from "./utils-8ea37061.js"; +function fn(l) { + return l.innerRadius; +} +function cn(l) { + return l.outerRadius; +} +function yn(l) { + return l.startAngle; +} +function gn(l) { + return l.endAngle; +} +function mn(l) { + return l && l.padAngle; +} +function pn(l, x, D, q, h, v, W, r) { + var s = D - l, n = q - x, m = W - h, i = r - v, u = i * s - m * n; + if (!(u * u < y)) + return u = (m * (x - v) - i * (l - h)) / u, [l + u * s, x + u * n]; +} +function H(l, x, D, q, h, v, W) { + var r = l - D, s = x - q, n = (W ? v : -v) / z(r * r + s * s), m = n * s, i = -n * r, u = l + m, f = x + i, c = D + m, E = q + i, o = (u + c) / 2, I = (f + E) / 2, p = c - u, g = E - f, R = p * p + g * g, K = h - v, P = u * E - c * f, Q = (g < 0 ? -1 : 1) * z(tn(0, K * K * R - P * P)), S = (P * g - p * Q) / R, d = (-P * p - g * Q) / R, A = (P * g + p * Q) / R, T = (-P * p + g * Q) / R, e = S - o, a = d - I, X = A - o, Y = T - I; + return e * e + a * a > X * X + Y * Y && (S = A, d = T), { + cx: S, + cy: d, + x01: -m, + y01: -i, + x11: S * (h / K - 1), + y11: d * (h / K - 1) + }; +} +function hn() { + var l = fn, x = cn, D = V(0), q = null, h = yn, v = gn, W = mn, r = null; + function s() { + var n, m, i = +l.apply(this, arguments), u = +x.apply(this, arguments), f = h.apply(this, arguments) - rn, c = v.apply(this, arguments) - rn, E = un(c - f), o = c > f; + if (r || (r = n = sn()), u < i && (m = u, u = i, i = m), !(u > y)) + r.moveTo(0, 0); + else if (E > ln - y) + r.moveTo(u * Z(f), u * O(f)), r.arc(0, 0, u, f, c, !o), i > y && (r.moveTo(i * Z(c), i * O(c)), r.arc(0, 0, i, c, f, o)); + else { + var I = f, p = c, g = f, R = c, K = E, P = E, Q = W.apply(this, arguments) / 2, S = Q > y && (q ? +q.apply(this, arguments) : z(i * i + u * u)), d = b(un(u - i) / 2, +D.apply(this, arguments)), A = d, T = d, e, a; + if (S > y) { + var X = an(S / i * O(Q)), Y = an(S / u * O(Q)); + (K -= X * 2) > y ? (X *= o ? 1 : -1, g += X, R -= X) : (K = 0, g = R = (f + c) / 2), (P -= Y * 2) > y ? (Y *= o ? 1 : -1, I += Y, p -= Y) : (P = 0, I = p = (f + c) / 2); + } + var $ = u * Z(I), j = u * O(I), B = i * Z(R), C = i * O(R); + if (d > y) { + var F = u * Z(p), G = u * O(p), J = i * Z(g), L = i * O(g), w; + if (E < en && (w = pn($, j, J, L, F, G, B, C))) { + var M = $ - w[0], N = j - w[1], U = F - w[0], k = G - w[1], _ = 1 / O(on((M * U + N * k) / (z(M * M + N * N) * z(U * U + k * k))) / 2), nn = z(w[0] * w[0] + w[1] * w[1]); + A = b(d, (i - nn) / (_ - 1)), T = b(d, (u - nn) / (_ + 1)); + } + } + P > y ? T > y ? (e = H(J, L, $, j, u, T, o), a = H(F, G, B, C, u, T, o), r.moveTo(e.cx + e.x01, e.cy + e.y01), T < d ? r.arc(e.cx, e.cy, T, t(e.y01, e.x01), t(a.y01, a.x01), !o) : (r.arc(e.cx, e.cy, T, t(e.y01, e.x01), t(e.y11, e.x11), !o), r.arc(0, 0, u, t(e.cy + e.y11, e.cx + e.x11), t(a.cy + a.y11, a.cx + a.x11), !o), r.arc(a.cx, a.cy, T, t(a.y11, a.x11), t(a.y01, a.x01), !o))) : (r.moveTo($, j), r.arc(0, 0, u, I, p, !o)) : r.moveTo($, j), !(i > y) || !(K > y) ? r.lineTo(B, C) : A > y ? (e = H(B, C, F, G, i, -A, o), a = H($, j, J, L, i, -A, o), r.lineTo(e.cx + e.x01, e.cy + e.y01), A < d ? r.arc(e.cx, e.cy, A, t(e.y01, e.x01), t(a.y01, a.x01), !o) : (r.arc(e.cx, e.cy, A, t(e.y01, e.x01), t(e.y11, e.x11), !o), r.arc(0, 0, i, t(e.cy + e.y11, e.cx + e.x11), t(a.cy + a.y11, a.cx + a.x11), o), r.arc(a.cx, a.cy, A, t(a.y11, a.x11), t(a.y01, a.x01), !o))) : r.arc(0, 0, i, R, g, o); + } + if (r.closePath(), n) + return r = null, n + "" || null; + } + return s.centroid = function() { + var n = (+l.apply(this, arguments) + +x.apply(this, arguments)) / 2, m = (+h.apply(this, arguments) + +v.apply(this, arguments)) / 2 - en / 2; + return [Z(m) * n, O(m) * n]; + }, s.innerRadius = function(n) { + return arguments.length ? (l = typeof n == "function" ? n : V(+n), s) : l; + }, s.outerRadius = function(n) { + return arguments.length ? (x = typeof n == "function" ? n : V(+n), s) : x; + }, s.cornerRadius = function(n) { + return arguments.length ? (D = typeof n == "function" ? n : V(+n), s) : D; + }, s.padRadius = function(n) { + return arguments.length ? (q = n == null ? null : typeof n == "function" ? n : V(+n), s) : q; + }, s.startAngle = function(n) { + return arguments.length ? (h = typeof n == "function" ? n : V(+n), s) : h; + }, s.endAngle = function(n) { + return arguments.length ? (v = typeof n == "function" ? n : V(+n), s) : v; + }, s.padAngle = function(n) { + return arguments.length ? (W = typeof n == "function" ? n : V(+n), s) : W; + }, s.context = function(n) { + return arguments.length ? (r = n ?? null, s) : r; + }, s; +} +export { + hn as d +}; +//# sourceMappingURL=arc-f7872e1e.js.map diff --git a/scopegraphs-render-docs/doc/js/array-2ff2c7a6.js b/scopegraphs-render-docs/doc/js/array-2ff2c7a6.js new file mode 100644 index 0000000..d9d798a --- /dev/null +++ b/scopegraphs-render-docs/doc/js/array-2ff2c7a6.js @@ -0,0 +1,7 @@ +function t(r) { + return typeof r == "object" && "length" in r ? r : Array.from(r); +} +export { + t as a +}; +//# sourceMappingURL=array-2ff2c7a6.js.map diff --git a/scopegraphs-render-docs/doc/js/array-b7dcf730.js b/scopegraphs-render-docs/doc/js/array-b7dcf730.js new file mode 100644 index 0000000..a37a9a7 --- /dev/null +++ b/scopegraphs-render-docs/doc/js/array-b7dcf730.js @@ -0,0 +1,7 @@ +function array(x) { + return typeof x === "object" && "length" in x ? x : Array.from(x); +} +export { + array as a +}; +//# sourceMappingURL=array-b7dcf730.js.map diff --git a/scopegraphs-render-docs/doc/js/assignWithDepth.d.ts b/scopegraphs-render-docs/doc/js/assignWithDepth.d.ts new file mode 100644 index 0000000..48afd39 --- /dev/null +++ b/scopegraphs-render-docs/doc/js/assignWithDepth.d.ts @@ -0,0 +1,31 @@ +export default assignWithDepth; +/** + * @function assignWithDepth Extends the functionality of {@link ObjectConstructor.assign} with the + * ability to merge arbitrary-depth objects For each key in src with path `k` (recursively) + * performs an Object.assign(dst[`k`], src[`k`]) with a slight change from the typical handling of + * undefined for dst[`k`]: instead of raising an error, dst[`k`] is auto-initialized to {} and + * effectively merged with src[`k`]

Additionally, dissimilar types will not clobber unless the + * config.clobber parameter === true. Example: + * + * ```js + * let config_0 = { foo: { bar: 'bar' }, bar: 'foo' }; + * let config_1 = { foo: 'foo', bar: 'bar' }; + * let result = assignWithDepth(config_0, config_1); + * console.log(result); + * //-> result: { foo: { bar: 'bar' }, bar: 'bar' } + * ``` + * + * Traditional Object.assign would have clobbered foo in config_0 with foo in config_1. If src is a + * destructured array of objects and dst is not an array, assignWithDepth will apply each element + * of src to dst in order. + * @param {any} dst - The destination of the merge + * @param {any} src - The source object(s) to merge into destination + * @param {{ depth: number; clobber: boolean }} [config={ depth: 2, clobber: false }] - Depth: depth + * to traverse within src and dst for merging - clobber: should dissimilar types clobber (default: + * { depth: 2, clobber: false }). Default is `{ depth: 2, clobber: false }` + * @returns {any} + */ +declare function assignWithDepth(dst: any, src: any, config?: { + depth: number; + clobber: boolean; +} | undefined): any; diff --git a/scopegraphs-render-docs/doc/js/c4Diagram-44c43e89.js b/scopegraphs-render-docs/doc/js/c4Diagram-44c43e89.js new file mode 100644 index 0000000..af11b63 --- /dev/null +++ b/scopegraphs-render-docs/doc/js/c4Diagram-44c43e89.js @@ -0,0 +1,2535 @@ +import { m as mermaidAPI } from "./mermaidAPI-3ae0f2f0.js"; +import { o as setAccTitle, p as getAccTitle, q as getAccDescription, v as setAccDescription, g as getConfig, b as sanitizeText, e as common, d as assignWithDepth, l as log } from "./commonDb-573409be.js"; +import { select } from "d3"; +import { sanitizeUrl } from "@braintree/sanitize-url"; +import { j as calculateTextWidth, k as configureSvgSize, w as wrapLabel, m as calculateTextHeight } from "./utils-d622194a.js"; +import "stylis"; +import "dompurify"; +import "lodash-es/isEmpty.js"; +import "dayjs"; +import "khroma"; +import "lodash-es/memoize.js"; +var parser = function() { + var o = function(k, v, o2, l) { + for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) + ; + return o2; + }, $V0 = [1, 6], $V1 = [1, 7], $V2 = [1, 8], $V3 = [1, 9], $V4 = [1, 16], $V5 = [1, 11], $V6 = [1, 12], $V7 = [1, 13], $V8 = [1, 14], $V9 = [1, 15], $Va = [1, 27], $Vb = [1, 33], $Vc = [1, 34], $Vd = [1, 35], $Ve = [1, 36], $Vf = [1, 37], $Vg = [1, 72], $Vh = [1, 73], $Vi = [1, 74], $Vj = [1, 75], $Vk = [1, 76], $Vl = [1, 77], $Vm = [1, 78], $Vn = [1, 38], $Vo = [1, 39], $Vp = [1, 40], $Vq = [1, 41], $Vr = [1, 42], $Vs = [1, 43], $Vt = [1, 44], $Vu = [1, 45], $Vv = [1, 46], $Vw = [1, 47], $Vx = [1, 48], $Vy = [1, 49], $Vz = [1, 50], $VA = [1, 51], $VB = [1, 52], $VC = [1, 53], $VD = [1, 54], $VE = [1, 55], $VF = [1, 56], $VG = [1, 57], $VH = [1, 59], $VI = [1, 60], $VJ = [1, 61], $VK = [1, 62], $VL = [1, 63], $VM = [1, 64], $VN = [1, 65], $VO = [1, 66], $VP = [1, 67], $VQ = [1, 68], $VR = [1, 69], $VS = [24, 52], $VT = [24, 44, 46, 47, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84], $VU = [15, 24, 44, 46, 47, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84], $VV = [1, 94], $VW = [1, 95], $VX = [1, 96], $VY = [1, 97], $VZ = [15, 24, 52], $V_ = [7, 8, 9, 10, 18, 22, 25, 26, 27, 28], $V$ = [15, 24, 43, 52], $V01 = [15, 24, 43, 52, 86, 87, 89, 90], $V11 = [15, 43], $V21 = [44, 46, 47, 48, 49, 50, 51, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84]; + var parser2 = { + trace: function trace() { + }, + yy: {}, + symbols_: { "error": 2, "start": 3, "mermaidDoc": 4, "direction": 5, "directive": 6, "direction_tb": 7, "direction_bt": 8, "direction_rl": 9, "direction_lr": 10, "graphConfig": 11, "openDirective": 12, "typeDirective": 13, "closeDirective": 14, "NEWLINE": 15, ":": 16, "argDirective": 17, "open_directive": 18, "type_directive": 19, "arg_directive": 20, "close_directive": 21, "C4_CONTEXT": 22, "statements": 23, "EOF": 24, "C4_CONTAINER": 25, "C4_COMPONENT": 26, "C4_DYNAMIC": 27, "C4_DEPLOYMENT": 28, "otherStatements": 29, "diagramStatements": 30, "otherStatement": 31, "title": 32, "accDescription": 33, "acc_title": 34, "acc_title_value": 35, "acc_descr": 36, "acc_descr_value": 37, "acc_descr_multiline_value": 38, "boundaryStatement": 39, "boundaryStartStatement": 40, "boundaryStopStatement": 41, "boundaryStart": 42, "LBRACE": 43, "ENTERPRISE_BOUNDARY": 44, "attributes": 45, "SYSTEM_BOUNDARY": 46, "BOUNDARY": 47, "CONTAINER_BOUNDARY": 48, "NODE": 49, "NODE_L": 50, "NODE_R": 51, "RBRACE": 52, "diagramStatement": 53, "PERSON": 54, "PERSON_EXT": 55, "SYSTEM": 56, "SYSTEM_DB": 57, "SYSTEM_QUEUE": 58, "SYSTEM_EXT": 59, "SYSTEM_EXT_DB": 60, "SYSTEM_EXT_QUEUE": 61, "CONTAINER": 62, "CONTAINER_DB": 63, "CONTAINER_QUEUE": 64, "CONTAINER_EXT": 65, "CONTAINER_EXT_DB": 66, "CONTAINER_EXT_QUEUE": 67, "COMPONENT": 68, "COMPONENT_DB": 69, "COMPONENT_QUEUE": 70, "COMPONENT_EXT": 71, "COMPONENT_EXT_DB": 72, "COMPONENT_EXT_QUEUE": 73, "REL": 74, "BIREL": 75, "REL_U": 76, "REL_D": 77, "REL_L": 78, "REL_R": 79, "REL_B": 80, "REL_INDEX": 81, "UPDATE_EL_STYLE": 82, "UPDATE_REL_STYLE": 83, "UPDATE_LAYOUT_CONFIG": 84, "attribute": 85, "STR": 86, "STR_KEY": 87, "STR_VALUE": 88, "ATTRIBUTE": 89, "ATTRIBUTE_EMPTY": 90, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 7: "direction_tb", 8: "direction_bt", 9: "direction_rl", 10: "direction_lr", 15: "NEWLINE", 16: ":", 18: "open_directive", 19: "type_directive", 20: "arg_directive", 21: "close_directive", 22: "C4_CONTEXT", 24: "EOF", 25: "C4_CONTAINER", 26: "C4_COMPONENT", 27: "C4_DYNAMIC", 28: "C4_DEPLOYMENT", 32: "title", 33: "accDescription", 34: "acc_title", 35: "acc_title_value", 36: "acc_descr", 37: "acc_descr_value", 38: "acc_descr_multiline_value", 43: "LBRACE", 44: "ENTERPRISE_BOUNDARY", 46: "SYSTEM_BOUNDARY", 47: "BOUNDARY", 48: "CONTAINER_BOUNDARY", 49: "NODE", 50: "NODE_L", 51: "NODE_R", 52: "RBRACE", 54: "PERSON", 55: "PERSON_EXT", 56: "SYSTEM", 57: "SYSTEM_DB", 58: "SYSTEM_QUEUE", 59: "SYSTEM_EXT", 60: "SYSTEM_EXT_DB", 61: "SYSTEM_EXT_QUEUE", 62: "CONTAINER", 63: "CONTAINER_DB", 64: "CONTAINER_QUEUE", 65: "CONTAINER_EXT", 66: "CONTAINER_EXT_DB", 67: "CONTAINER_EXT_QUEUE", 68: "COMPONENT", 69: "COMPONENT_DB", 70: "COMPONENT_QUEUE", 71: "COMPONENT_EXT", 72: "COMPONENT_EXT_DB", 73: "COMPONENT_EXT_QUEUE", 74: "REL", 75: "BIREL", 76: "REL_U", 77: "REL_D", 78: "REL_L", 79: "REL_R", 80: "REL_B", 81: "REL_INDEX", 82: "UPDATE_EL_STYLE", 83: "UPDATE_REL_STYLE", 84: "UPDATE_LAYOUT_CONFIG", 86: "STR", 87: "STR_KEY", 88: "STR_VALUE", 89: "ATTRIBUTE", 90: "ATTRIBUTE_EMPTY" }, + productions_: [0, [3, 1], [3, 1], [3, 2], [5, 1], [5, 1], [5, 1], [5, 1], [4, 1], [6, 4], [6, 6], [12, 1], [13, 1], [17, 1], [14, 1], [11, 4], [11, 4], [11, 4], [11, 4], [11, 4], [23, 1], [23, 1], [23, 2], [29, 1], [29, 2], [29, 3], [31, 1], [31, 1], [31, 2], [31, 2], [31, 1], [39, 3], [40, 3], [40, 3], [40, 4], [42, 2], [42, 2], [42, 2], [42, 2], [42, 2], [42, 2], [42, 2], [41, 1], [30, 1], [30, 2], [30, 3], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 1], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [45, 1], [45, 2], [85, 1], [85, 2], [85, 1], [85, 1]], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 4: + yy.setDirection("TB"); + break; + case 5: + yy.setDirection("BT"); + break; + case 6: + yy.setDirection("RL"); + break; + case 7: + yy.setDirection("LR"); + break; + case 11: + yy.parseDirective("%%{", "open_directive"); + break; + case 12: + break; + case 13: + $$[$0] = $$[$0].trim().replace(/'/g, '"'); + yy.parseDirective($$[$0], "arg_directive"); + break; + case 14: + yy.parseDirective("}%%", "close_directive", "c4Context"); + break; + case 15: + case 16: + case 17: + case 18: + case 19: + yy.setC4Type($$[$0 - 3]); + break; + case 26: + yy.setTitle($$[$0].substring(6)); + this.$ = $$[$0].substring(6); + break; + case 27: + yy.setAccDescription($$[$0].substring(15)); + this.$ = $$[$0].substring(15); + break; + case 28: + this.$ = $$[$0].trim(); + yy.setTitle(this.$); + break; + case 29: + case 30: + this.$ = $$[$0].trim(); + yy.setAccDescription(this.$); + break; + case 35: + case 36: + $$[$0].splice(2, 0, "ENTERPRISE"); + yy.addPersonOrSystemBoundary(...$$[$0]); + this.$ = $$[$0]; + break; + case 37: + yy.addPersonOrSystemBoundary(...$$[$0]); + this.$ = $$[$0]; + break; + case 38: + $$[$0].splice(2, 0, "CONTAINER"); + yy.addContainerBoundary(...$$[$0]); + this.$ = $$[$0]; + break; + case 39: + yy.addDeploymentNode("node", ...$$[$0]); + this.$ = $$[$0]; + break; + case 40: + yy.addDeploymentNode("nodeL", ...$$[$0]); + this.$ = $$[$0]; + break; + case 41: + yy.addDeploymentNode("nodeR", ...$$[$0]); + this.$ = $$[$0]; + break; + case 42: + yy.popBoundaryParseStack(); + break; + case 46: + yy.addPersonOrSystem("person", ...$$[$0]); + this.$ = $$[$0]; + break; + case 47: + yy.addPersonOrSystem("external_person", ...$$[$0]); + this.$ = $$[$0]; + break; + case 48: + yy.addPersonOrSystem("system", ...$$[$0]); + this.$ = $$[$0]; + break; + case 49: + yy.addPersonOrSystem("system_db", ...$$[$0]); + this.$ = $$[$0]; + break; + case 50: + yy.addPersonOrSystem("system_queue", ...$$[$0]); + this.$ = $$[$0]; + break; + case 51: + yy.addPersonOrSystem("external_system", ...$$[$0]); + this.$ = $$[$0]; + break; + case 52: + yy.addPersonOrSystem("external_system_db", ...$$[$0]); + this.$ = $$[$0]; + break; + case 53: + yy.addPersonOrSystem("external_system_queue", ...$$[$0]); + this.$ = $$[$0]; + break; + case 54: + yy.addContainer("container", ...$$[$0]); + this.$ = $$[$0]; + break; + case 55: + yy.addContainer("container_db", ...$$[$0]); + this.$ = $$[$0]; + break; + case 56: + yy.addContainer("container_queue", ...$$[$0]); + this.$ = $$[$0]; + break; + case 57: + yy.addContainer("external_container", ...$$[$0]); + this.$ = $$[$0]; + break; + case 58: + yy.addContainer("external_container_db", ...$$[$0]); + this.$ = $$[$0]; + break; + case 59: + yy.addContainer("external_container_queue", ...$$[$0]); + this.$ = $$[$0]; + break; + case 60: + yy.addComponent("component", ...$$[$0]); + this.$ = $$[$0]; + break; + case 61: + yy.addComponent("component_db", ...$$[$0]); + this.$ = $$[$0]; + break; + case 62: + yy.addComponent("component_queue", ...$$[$0]); + this.$ = $$[$0]; + break; + case 63: + yy.addComponent("external_component", ...$$[$0]); + this.$ = $$[$0]; + break; + case 64: + yy.addComponent("external_component_db", ...$$[$0]); + this.$ = $$[$0]; + break; + case 65: + yy.addComponent("external_component_queue", ...$$[$0]); + this.$ = $$[$0]; + break; + case 67: + yy.addRel("rel", ...$$[$0]); + this.$ = $$[$0]; + break; + case 68: + yy.addRel("birel", ...$$[$0]); + this.$ = $$[$0]; + break; + case 69: + yy.addRel("rel_u", ...$$[$0]); + this.$ = $$[$0]; + break; + case 70: + yy.addRel("rel_d", ...$$[$0]); + this.$ = $$[$0]; + break; + case 71: + yy.addRel("rel_l", ...$$[$0]); + this.$ = $$[$0]; + break; + case 72: + yy.addRel("rel_r", ...$$[$0]); + this.$ = $$[$0]; + break; + case 73: + yy.addRel("rel_b", ...$$[$0]); + this.$ = $$[$0]; + break; + case 74: + $$[$0].splice(0, 1); + yy.addRel("rel", ...$$[$0]); + this.$ = $$[$0]; + break; + case 75: + yy.updateElStyle("update_el_style", ...$$[$0]); + this.$ = $$[$0]; + break; + case 76: + yy.updateRelStyle("update_rel_style", ...$$[$0]); + this.$ = $$[$0]; + break; + case 77: + yy.updateLayoutConfig("update_layout_config", ...$$[$0]); + this.$ = $$[$0]; + break; + case 78: + this.$ = [$$[$0]]; + break; + case 79: + $$[$0].unshift($$[$0 - 1]); + this.$ = $$[$0]; + break; + case 80: + case 82: + this.$ = $$[$0].trim(); + break; + case 81: + let kv = {}; + kv[$$[$0 - 1].trim()] = $$[$0].trim(); + this.$ = kv; + break; + case 83: + this.$ = ""; + break; + } + }, + table: [{ 3: 1, 4: 2, 5: 3, 6: 4, 7: $V0, 8: $V1, 9: $V2, 10: $V3, 11: 5, 12: 10, 18: $V4, 22: $V5, 25: $V6, 26: $V7, 27: $V8, 28: $V9 }, { 1: [3] }, { 1: [2, 1] }, { 1: [2, 2] }, { 3: 17, 4: 2, 5: 3, 6: 4, 7: $V0, 8: $V1, 9: $V2, 10: $V3, 11: 5, 12: 10, 18: $V4, 22: $V5, 25: $V6, 26: $V7, 27: $V8, 28: $V9 }, { 1: [2, 8] }, { 1: [2, 4] }, { 1: [2, 5] }, { 1: [2, 6] }, { 1: [2, 7] }, { 13: 18, 19: [1, 19] }, { 15: [1, 20] }, { 15: [1, 21] }, { 15: [1, 22] }, { 15: [1, 23] }, { 15: [1, 24] }, { 19: [2, 11] }, { 1: [2, 3] }, { 14: 25, 16: [1, 26], 21: $Va }, o([16, 21], [2, 12]), { 23: 28, 29: 29, 30: 30, 31: 31, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf, 39: 58, 40: 70, 42: 71, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 53: 32, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }, { 23: 79, 29: 29, 30: 30, 31: 31, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf, 39: 58, 40: 70, 42: 71, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 53: 32, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }, { 23: 80, 29: 29, 30: 30, 31: 31, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf, 39: 58, 40: 70, 42: 71, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 53: 32, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }, { 23: 81, 29: 29, 30: 30, 31: 31, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf, 39: 58, 40: 70, 42: 71, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 53: 32, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }, { 23: 82, 29: 29, 30: 30, 31: 31, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf, 39: 58, 40: 70, 42: 71, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 53: 32, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }, { 15: [1, 83] }, { 17: 84, 20: [1, 85] }, { 15: [2, 14] }, { 24: [1, 86] }, o($VS, [2, 20], { 53: 32, 39: 58, 40: 70, 42: 71, 30: 87, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }), o($VS, [2, 21]), o($VT, [2, 23], { 15: [1, 88] }), o($VS, [2, 43], { 15: [1, 89] }), o($VU, [2, 26]), o($VU, [2, 27]), { 35: [1, 90] }, { 37: [1, 91] }, o($VU, [2, 30]), { 45: 92, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 98, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 99, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 100, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 101, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 102, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 103, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 104, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 105, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 106, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 107, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 108, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 109, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 110, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 111, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 112, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 113, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 114, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 115, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 116, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, o($VZ, [2, 66]), { 45: 117, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 118, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 119, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 120, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 121, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 122, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 123, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 124, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 125, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 126, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 127, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 30: 128, 39: 58, 40: 70, 42: 71, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 53: 32, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }, { 15: [1, 130], 43: [1, 129] }, { 45: 131, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 132, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 133, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 134, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 135, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 136, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 137, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 24: [1, 138] }, { 24: [1, 139] }, { 24: [1, 140] }, { 24: [1, 141] }, o($V_, [2, 9]), { 14: 142, 21: $Va }, { 21: [2, 13] }, { 1: [2, 15] }, o($VS, [2, 22]), o($VT, [2, 24], { 31: 31, 29: 143, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf }), o($VS, [2, 44], { 29: 29, 30: 30, 31: 31, 53: 32, 39: 58, 40: 70, 42: 71, 23: 144, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }), o($VU, [2, 28]), o($VU, [2, 29]), o($VZ, [2, 46]), o($V$, [2, 78], { 85: 93, 45: 145, 86: $VV, 87: $VW, 89: $VX, 90: $VY }), o($V01, [2, 80]), { 88: [1, 146] }, o($V01, [2, 82]), o($V01, [2, 83]), o($VZ, [2, 47]), o($VZ, [2, 48]), o($VZ, [2, 49]), o($VZ, [2, 50]), o($VZ, [2, 51]), o($VZ, [2, 52]), o($VZ, [2, 53]), o($VZ, [2, 54]), o($VZ, [2, 55]), o($VZ, [2, 56]), o($VZ, [2, 57]), o($VZ, [2, 58]), o($VZ, [2, 59]), o($VZ, [2, 60]), o($VZ, [2, 61]), o($VZ, [2, 62]), o($VZ, [2, 63]), o($VZ, [2, 64]), o($VZ, [2, 65]), o($VZ, [2, 67]), o($VZ, [2, 68]), o($VZ, [2, 69]), o($VZ, [2, 70]), o($VZ, [2, 71]), o($VZ, [2, 72]), o($VZ, [2, 73]), o($VZ, [2, 74]), o($VZ, [2, 75]), o($VZ, [2, 76]), o($VZ, [2, 77]), { 41: 147, 52: [1, 148] }, { 15: [1, 149] }, { 43: [1, 150] }, o($V11, [2, 35]), o($V11, [2, 36]), o($V11, [2, 37]), o($V11, [2, 38]), o($V11, [2, 39]), o($V11, [2, 40]), o($V11, [2, 41]), { 1: [2, 16] }, { 1: [2, 17] }, { 1: [2, 18] }, { 1: [2, 19] }, { 15: [1, 151] }, o($VT, [2, 25]), o($VS, [2, 45]), o($V$, [2, 79]), o($V01, [2, 81]), o($VZ, [2, 31]), o($VZ, [2, 42]), o($V21, [2, 32]), o($V21, [2, 33], { 15: [1, 152] }), o($V_, [2, 10]), o($V21, [2, 34])], + defaultActions: { 2: [2, 1], 3: [2, 2], 5: [2, 8], 6: [2, 4], 7: [2, 5], 8: [2, 6], 9: [2, 7], 16: [2, 11], 17: [2, 3], 27: [2, 14], 85: [2, 13], 86: [2, 15], 138: [2, 16], 139: [2, 17], 140: [2, 18], 141: [2, 19] }, + parseError: function parseError(str, hash) { + if (hash.recoverable) { + this.trace(str); + } else { + var error = new Error(str); + error.hash = hash; + throw error; + } + }, + parse: function parse(input) { + var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k)) { + sharedState.yy[k] = this.yy[k]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function lex() { + var token; + token = tstack.pop() || lexer2.lex() || EOF; + if (typeof token !== "number") { + if (token instanceof Array) { + tstack = token; + token = tstack.pop(); + } + token = self.symbols_[token] || token; + } + return token; + } + var symbol, state, action, r, yyval = {}, p, len, newState, expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state] && table[state][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push("'" + this.terminals_[p] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r !== "undefined") { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; + } + }; + var lexer = function() { + var lexer2 = { + EOF: 1, + parseError: function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); + } + }, + // resets the lexer, sets new input + setInput: function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + 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 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, + // consumes and returns one char from the input + input: function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, + // unshifts one char (or a string) into the input + unput: function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = 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); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, + // When called from action, caches matched text and appends it on next action + more: function() { + this._more = true; + return this; + }, + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } 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).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, + // retain first n characters of the match + less: function(n) { + this.unput(this.match.slice(n)); + }, + // displays already matched input, i.e. for error messages + pastInput: function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, + // displays upcoming input, i.e. for error messages + upcomingInput: function() { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20 - next.length); + } + return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: function() { + var pre = this.pastInput(); + var c2 = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c2 + "^"; + }, + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: function(match, indexed_rule) { + var token, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + 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 + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length + }; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token) { + return token; + } else if (this._backtrack) { + for (var k in backup) { + this[k] = backup[k]; + } + return false; + } + return false; + }, + // return next match in input + next: function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token, match, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rules[i]); + if (token !== false) { + return token; + } else if (this._backtrack) { + match = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match) { + token = this.test_match(match, rules[index]); + if (token !== false) { + return token; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, + // return next match that has a token + lex: function lex() { + var r = this.next(); + if (r) { + return r; + } else { + return this.lex(); + } + }, + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: function begin(condition) { + this.conditionStack.push(condition); + }, + // pop the previously active lexer condition state off the condition stack + popState: function popState() { + var n = this.conditionStack.length - 1; + if (n > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: function topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + if (n >= 0) { + return this.conditionStack[n]; + } else { + return "INITIAL"; + } + }, + // alias for begin(condition) + pushState: function pushState(condition) { + this.begin(condition); + }, + // return the number of states currently on the stack + stateStackSize: function stateStackSize() { + return this.conditionStack.length; + }, + options: {}, + performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + switch ($avoiding_name_collisions) { + case 0: + this.begin("open_directive"); + return 18; + case 1: + return 7; + case 2: + return 8; + case 3: + return 9; + case 4: + return 10; + case 5: + this.begin("type_directive"); + return 19; + case 6: + this.popState(); + this.begin("arg_directive"); + return 16; + case 7: + this.popState(); + this.popState(); + return 21; + case 8: + return 20; + case 9: + return 32; + case 10: + return 33; + case 11: + this.begin("acc_title"); + return 34; + case 12: + this.popState(); + return "acc_title_value"; + case 13: + this.begin("acc_descr"); + return 36; + case 14: + this.popState(); + return "acc_descr_value"; + case 15: + this.begin("acc_descr_multiline"); + break; + case 16: + this.popState(); + break; + case 17: + return "acc_descr_multiline_value"; + case 18: + break; + case 19: + c; + break; + case 20: + return 15; + case 21: + break; + case 22: + return 22; + case 23: + return 25; + case 24: + return 26; + case 25: + return 27; + case 26: + return 28; + case 27: + this.begin("person_ext"); + return 55; + case 28: + this.begin("person"); + return 54; + case 29: + this.begin("system_ext_queue"); + return 61; + case 30: + this.begin("system_ext_db"); + return 60; + case 31: + this.begin("system_ext"); + return 59; + case 32: + this.begin("system_queue"); + return 58; + case 33: + this.begin("system_db"); + return 57; + case 34: + this.begin("system"); + return 56; + case 35: + this.begin("boundary"); + return 47; + case 36: + this.begin("enterprise_boundary"); + return 44; + case 37: + this.begin("system_boundary"); + return 46; + case 38: + this.begin("container_ext_queue"); + return 67; + case 39: + this.begin("container_ext_db"); + return 66; + case 40: + this.begin("container_ext"); + return 65; + case 41: + this.begin("container_queue"); + return 64; + case 42: + this.begin("container_db"); + return 63; + case 43: + this.begin("container"); + return 62; + case 44: + this.begin("container_boundary"); + return 48; + case 45: + this.begin("component_ext_queue"); + return 73; + case 46: + this.begin("component_ext_db"); + return 72; + case 47: + this.begin("component_ext"); + return 71; + case 48: + this.begin("component_queue"); + return 70; + case 49: + this.begin("component_db"); + return 69; + case 50: + this.begin("component"); + return 68; + case 51: + this.begin("node"); + return 49; + case 52: + this.begin("node"); + return 49; + case 53: + this.begin("node_l"); + return 50; + case 54: + this.begin("node_r"); + return 51; + case 55: + this.begin("rel"); + return 74; + case 56: + this.begin("birel"); + return 75; + case 57: + this.begin("rel_u"); + return 76; + case 58: + this.begin("rel_u"); + return 76; + case 59: + this.begin("rel_d"); + return 77; + case 60: + this.begin("rel_d"); + return 77; + case 61: + this.begin("rel_l"); + return 78; + case 62: + this.begin("rel_l"); + return 78; + case 63: + this.begin("rel_r"); + return 79; + case 64: + this.begin("rel_r"); + return 79; + case 65: + this.begin("rel_b"); + return 80; + case 66: + this.begin("rel_index"); + return 81; + case 67: + this.begin("update_el_style"); + return 82; + case 68: + this.begin("update_rel_style"); + return 83; + case 69: + this.begin("update_layout_config"); + return 84; + case 70: + return "EOF_IN_STRUCT"; + case 71: + this.begin("attribute"); + return "ATTRIBUTE_EMPTY"; + case 72: + this.begin("attribute"); + break; + case 73: + this.popState(); + this.popState(); + break; + case 74: + return 90; + case 75: + break; + case 76: + return 90; + case 77: + this.begin("string"); + break; + case 78: + this.popState(); + break; + case 79: + return "STR"; + case 80: + this.begin("string_kv"); + break; + case 81: + this.begin("string_kv_key"); + return "STR_KEY"; + case 82: + this.popState(); + this.begin("string_kv_value"); + break; + case 83: + return "STR_VALUE"; + case 84: + this.popState(); + this.popState(); + break; + case 85: + return "STR"; + case 86: + return "LBRACE"; + case 87: + return "RBRACE"; + case 88: + return "SPACE"; + case 89: + return "EOL"; + case 90: + return 24; + } + }, + rules: [/^(?:%%\{)/, /^(?:.*direction\s+TB[^\n]*)/, /^(?:.*direction\s+BT[^\n]*)/, /^(?:.*direction\s+RL[^\n]*)/, /^(?:.*direction\s+LR[^\n]*)/, /^(?:((?:(?!\}%%)[^:.])*))/, /^(?::)/, /^(?:\}%%)/, /^(?:((?:(?!\}%%).|\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": [16, 17], "inclusive": false }, "acc_descr": { "rules": [14], "inclusive": false }, "acc_title": { "rules": [12], "inclusive": false }, "close_directive": { "rules": [], "inclusive": false }, "arg_directive": { "rules": [7, 8], "inclusive": false }, "type_directive": { "rules": [6, 7], "inclusive": false }, "open_directive": { "rules": [5], "inclusive": false }, "string_kv_value": { "rules": [83, 84], "inclusive": false }, "string_kv_key": { "rules": [82], "inclusive": false }, "string_kv": { "rules": [81], "inclusive": false }, "string": { "rules": [78, 79], "inclusive": false }, "attribute": { "rules": [73, 74, 75, 76, 77, 80, 85], "inclusive": false }, "update_layout_config": { "rules": [70, 71, 72, 73], "inclusive": false }, "update_rel_style": { "rules": [70, 71, 72, 73], "inclusive": false }, "update_el_style": { "rules": [70, 71, 72, 73], "inclusive": false }, "rel_b": { "rules": [70, 71, 72, 73], "inclusive": false }, "rel_r": { "rules": [70, 71, 72, 73], "inclusive": false }, "rel_l": { "rules": [70, 71, 72, 73], "inclusive": false }, "rel_d": { "rules": [70, 71, 72, 73], "inclusive": false }, "rel_u": { "rules": [70, 71, 72, 73], "inclusive": false }, "rel_bi": { "rules": [], "inclusive": false }, "rel": { "rules": [70, 71, 72, 73], "inclusive": false }, "node_r": { "rules": [70, 71, 72, 73], "inclusive": false }, "node_l": { "rules": [70, 71, 72, 73], "inclusive": false }, "node": { "rules": [70, 71, 72, 73], "inclusive": false }, "index": { "rules": [], "inclusive": false }, "rel_index": { "rules": [70, 71, 72, 73], "inclusive": false }, "component_ext_queue": { "rules": [], "inclusive": false }, "component_ext_db": { "rules": [70, 71, 72, 73], "inclusive": false }, "component_ext": { "rules": [70, 71, 72, 73], "inclusive": false }, "component_queue": { "rules": [70, 71, 72, 73], "inclusive": false }, "component_db": { "rules": [70, 71, 72, 73], "inclusive": false }, "component": { "rules": [70, 71, 72, 73], "inclusive": false }, "container_boundary": { "rules": [70, 71, 72, 73], "inclusive": false }, "container_ext_queue": { "rules": [], "inclusive": false }, "container_ext_db": { "rules": [70, 71, 72, 73], "inclusive": false }, "container_ext": { "rules": [70, 71, 72, 73], "inclusive": false }, "container_queue": { "rules": [70, 71, 72, 73], "inclusive": false }, "container_db": { "rules": [70, 71, 72, 73], "inclusive": false }, "container": { "rules": [70, 71, 72, 73], "inclusive": false }, "birel": { "rules": [70, 71, 72, 73], "inclusive": false }, "system_boundary": { "rules": [70, 71, 72, 73], "inclusive": false }, "enterprise_boundary": { "rules": [70, 71, 72, 73], "inclusive": false }, "boundary": { "rules": [70, 71, 72, 73], "inclusive": false }, "system_ext_queue": { "rules": [70, 71, 72, 73], "inclusive": false }, "system_ext_db": { "rules": [70, 71, 72, 73], "inclusive": false }, "system_ext": { "rules": [70, 71, 72, 73], "inclusive": false }, "system_queue": { "rules": [70, 71, 72, 73], "inclusive": false }, "system_db": { "rules": [70, 71, 72, 73], "inclusive": false }, "system": { "rules": [70, 71, 72, 73], "inclusive": false }, "person_ext": { "rules": [70, 71, 72, 73], "inclusive": false }, "person": { "rules": [70, 71, 72, 73], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 9, 10, 11, 13, 15, 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, 65, 66, 67, 68, 69, 86, 87, 88, 89, 90], "inclusive": true } } + }; + return lexer2; + }(); + parser2.lexer = lexer; + function Parser() { + this.yy = {}; + } + Parser.prototype = parser2; + parser2.Parser = Parser; + return new Parser(); +}(); +parser.parser = parser; +const c4Parser = parser; +let c4ShapeArray = []; +let boundaryParseStack = [""]; +let currentBoundaryParse = "global"; +let parentBoundaryParse = ""; +let boundarys = [ + { + alias: "global", + label: { text: "global" }, + type: { text: "global" }, + tags: null, + link: null, + parentBoundary: "" + } +]; +let rels = []; +let title = ""; +let wrapEnabled = false; +let c4ShapeInRow$1 = 4; +let c4BoundaryInRow$1 = 2; +var c4Type; +const getC4Type = function() { + return c4Type; +}; +const setC4Type = function(c4TypeParam) { + let sanitizedText = sanitizeText(c4TypeParam, getConfig()); + c4Type = sanitizedText; +}; +const parseDirective = function(statement, context, type) { + mermaidAPI.parseDirective(this, statement, context, type); +}; +const addRel = function(type, from, to, label, techn, descr, sprite, tags, link) { + if (type === void 0 || type === null || from === void 0 || from === null || to === void 0 || to === null || label === void 0 || label === null) { + return; + } + let rel = {}; + const old = rels.find((rel2) => rel2.from === from && rel2.to === to); + if (old) { + rel = old; + } else { + rels.push(rel); + } + rel.type = type; + rel.from = from; + rel.to = to; + rel.label = { text: label }; + if (techn === void 0 || techn === null) { + rel.techn = { text: "" }; + } else { + if (typeof techn === "object") { + let [key, value] = Object.entries(techn)[0]; + rel[key] = { text: value }; + } else { + rel.techn = { text: techn }; + } + } + if (descr === void 0 || descr === null) { + rel.descr = { text: "" }; + } else { + if (typeof descr === "object") { + let [key, value] = Object.entries(descr)[0]; + rel[key] = { text: value }; + } else { + rel.descr = { text: descr }; + } + } + if (typeof sprite === "object") { + let [key, value] = Object.entries(sprite)[0]; + rel[key] = value; + } else { + rel.sprite = sprite; + } + if (typeof tags === "object") { + let [key, value] = Object.entries(tags)[0]; + rel[key] = value; + } else { + rel.tags = tags; + } + if (typeof link === "object") { + let [key, value] = Object.entries(link)[0]; + rel[key] = value; + } else { + rel.link = link; + } + rel.wrap = autoWrap(); +}; +const addPersonOrSystem = function(typeC4Shape, alias, label, descr, sprite, tags, link) { + if (alias === null || label === null) { + return; + } + let personOrSystem = {}; + const old = c4ShapeArray.find((personOrSystem2) => personOrSystem2.alias === alias); + if (old && alias === old.alias) { + personOrSystem = old; + } else { + personOrSystem.alias = alias; + c4ShapeArray.push(personOrSystem); + } + if (label === void 0 || label === null) { + personOrSystem.label = { text: "" }; + } else { + personOrSystem.label = { text: label }; + } + if (descr === void 0 || descr === null) { + personOrSystem.descr = { text: "" }; + } else { + if (typeof descr === "object") { + let [key, value] = Object.entries(descr)[0]; + personOrSystem[key] = { text: value }; + } else { + personOrSystem.descr = { text: descr }; + } + } + if (typeof sprite === "object") { + let [key, value] = Object.entries(sprite)[0]; + personOrSystem[key] = value; + } else { + personOrSystem.sprite = sprite; + } + if (typeof tags === "object") { + let [key, value] = Object.entries(tags)[0]; + personOrSystem[key] = value; + } else { + personOrSystem.tags = tags; + } + if (typeof link === "object") { + let [key, value] = Object.entries(link)[0]; + personOrSystem[key] = value; + } else { + personOrSystem.link = link; + } + personOrSystem.typeC4Shape = { text: typeC4Shape }; + personOrSystem.parentBoundary = currentBoundaryParse; + personOrSystem.wrap = autoWrap(); +}; +const addContainer = function(typeC4Shape, alias, label, techn, descr, sprite, tags, link) { + if (alias === null || label === null) { + return; + } + let container = {}; + const old = c4ShapeArray.find((container2) => container2.alias === alias); + if (old && alias === old.alias) { + container = old; + } else { + container.alias = alias; + c4ShapeArray.push(container); + } + if (label === void 0 || label === null) { + container.label = { text: "" }; + } else { + container.label = { text: label }; + } + if (techn === void 0 || techn === null) { + container.techn = { text: "" }; + } else { + if (typeof techn === "object") { + let [key, value] = Object.entries(techn)[0]; + container[key] = { text: value }; + } else { + container.techn = { text: techn }; + } + } + if (descr === void 0 || descr === null) { + container.descr = { text: "" }; + } else { + if (typeof descr === "object") { + let [key, value] = Object.entries(descr)[0]; + container[key] = { text: value }; + } else { + container.descr = { text: descr }; + } + } + if (typeof sprite === "object") { + let [key, value] = Object.entries(sprite)[0]; + container[key] = value; + } else { + container.sprite = sprite; + } + if (typeof tags === "object") { + let [key, value] = Object.entries(tags)[0]; + container[key] = value; + } else { + container.tags = tags; + } + if (typeof link === "object") { + let [key, value] = Object.entries(link)[0]; + container[key] = value; + } else { + container.link = link; + } + container.wrap = autoWrap(); + container.typeC4Shape = { text: typeC4Shape }; + container.parentBoundary = currentBoundaryParse; +}; +const addComponent = function(typeC4Shape, alias, label, techn, descr, sprite, tags, link) { + if (alias === null || label === null) { + return; + } + let component = {}; + const old = c4ShapeArray.find((component2) => component2.alias === alias); + if (old && alias === old.alias) { + component = old; + } else { + component.alias = alias; + c4ShapeArray.push(component); + } + if (label === void 0 || label === null) { + component.label = { text: "" }; + } else { + component.label = { text: label }; + } + if (techn === void 0 || techn === null) { + component.techn = { text: "" }; + } else { + if (typeof techn === "object") { + let [key, value] = Object.entries(techn)[0]; + component[key] = { text: value }; + } else { + component.techn = { text: techn }; + } + } + if (descr === void 0 || descr === null) { + component.descr = { text: "" }; + } else { + if (typeof descr === "object") { + let [key, value] = Object.entries(descr)[0]; + component[key] = { text: value }; + } else { + component.descr = { text: descr }; + } + } + if (typeof sprite === "object") { + let [key, value] = Object.entries(sprite)[0]; + component[key] = value; + } else { + component.sprite = sprite; + } + if (typeof tags === "object") { + let [key, value] = Object.entries(tags)[0]; + component[key] = value; + } else { + component.tags = tags; + } + if (typeof link === "object") { + let [key, value] = Object.entries(link)[0]; + component[key] = value; + } else { + component.link = link; + } + component.wrap = autoWrap(); + component.typeC4Shape = { text: typeC4Shape }; + component.parentBoundary = currentBoundaryParse; +}; +const addPersonOrSystemBoundary = function(alias, label, type, tags, link) { + if (alias === null || label === null) { + return; + } + let boundary = {}; + const old = boundarys.find((boundary2) => boundary2.alias === alias); + if (old && alias === old.alias) { + boundary = old; + } else { + boundary.alias = alias; + boundarys.push(boundary); + } + if (label === void 0 || label === null) { + boundary.label = { text: "" }; + } else { + boundary.label = { text: label }; + } + if (type === void 0 || type === null) { + boundary.type = { text: "system" }; + } else { + if (typeof type === "object") { + let [key, value] = Object.entries(type)[0]; + boundary[key] = { text: value }; + } else { + boundary.type = { text: type }; + } + } + if (typeof tags === "object") { + let [key, value] = Object.entries(tags)[0]; + boundary[key] = value; + } else { + boundary.tags = tags; + } + if (typeof link === "object") { + let [key, value] = Object.entries(link)[0]; + boundary[key] = value; + } else { + boundary.link = link; + } + boundary.parentBoundary = currentBoundaryParse; + boundary.wrap = autoWrap(); + parentBoundaryParse = currentBoundaryParse; + currentBoundaryParse = alias; + boundaryParseStack.push(parentBoundaryParse); +}; +const addContainerBoundary = function(alias, label, type, tags, link) { + if (alias === null || label === null) { + return; + } + let boundary = {}; + const old = boundarys.find((boundary2) => boundary2.alias === alias); + if (old && alias === old.alias) { + boundary = old; + } else { + boundary.alias = alias; + boundarys.push(boundary); + } + if (label === void 0 || label === null) { + boundary.label = { text: "" }; + } else { + boundary.label = { text: label }; + } + if (type === void 0 || type === null) { + boundary.type = { text: "container" }; + } else { + if (typeof type === "object") { + let [key, value] = Object.entries(type)[0]; + boundary[key] = { text: value }; + } else { + boundary.type = { text: type }; + } + } + if (typeof tags === "object") { + let [key, value] = Object.entries(tags)[0]; + boundary[key] = value; + } else { + boundary.tags = tags; + } + if (typeof link === "object") { + let [key, value] = Object.entries(link)[0]; + boundary[key] = value; + } else { + boundary.link = link; + } + boundary.parentBoundary = currentBoundaryParse; + boundary.wrap = autoWrap(); + parentBoundaryParse = currentBoundaryParse; + currentBoundaryParse = alias; + boundaryParseStack.push(parentBoundaryParse); +}; +const addDeploymentNode = function(nodeType, alias, label, type, descr, sprite, tags, link) { + if (alias === null || label === null) { + return; + } + let boundary = {}; + const old = boundarys.find((boundary2) => boundary2.alias === alias); + if (old && alias === old.alias) { + boundary = old; + } else { + boundary.alias = alias; + boundarys.push(boundary); + } + if (label === void 0 || label === null) { + boundary.label = { text: "" }; + } else { + boundary.label = { text: label }; + } + if (type === void 0 || type === null) { + boundary.type = { text: "node" }; + } else { + if (typeof type === "object") { + let [key, value] = Object.entries(type)[0]; + boundary[key] = { text: value }; + } else { + boundary.type = { text: type }; + } + } + if (descr === void 0 || descr === null) { + boundary.descr = { text: "" }; + } else { + if (typeof descr === "object") { + let [key, value] = Object.entries(descr)[0]; + boundary[key] = { text: value }; + } else { + boundary.descr = { text: descr }; + } + } + if (typeof tags === "object") { + let [key, value] = Object.entries(tags)[0]; + boundary[key] = value; + } else { + boundary.tags = tags; + } + if (typeof link === "object") { + let [key, value] = Object.entries(link)[0]; + boundary[key] = value; + } else { + boundary.link = link; + } + boundary.nodeType = nodeType; + boundary.parentBoundary = currentBoundaryParse; + boundary.wrap = autoWrap(); + parentBoundaryParse = currentBoundaryParse; + currentBoundaryParse = alias; + boundaryParseStack.push(parentBoundaryParse); +}; +const popBoundaryParseStack = function() { + currentBoundaryParse = parentBoundaryParse; + boundaryParseStack.pop(); + parentBoundaryParse = boundaryParseStack.pop(); + boundaryParseStack.push(parentBoundaryParse); +}; +const updateElStyle = function(typeC4Shape, elementName, bgColor, fontColor, borderColor, shadowing, shape, sprite, techn, legendText, legendSprite) { + let old = c4ShapeArray.find((element) => element.alias === elementName); + if (old === void 0) { + old = boundarys.find((element) => element.alias === elementName); + if (old === void 0) { + return; + } + } + if (bgColor !== void 0 && bgColor !== null) { + if (typeof bgColor === "object") { + let [key, value] = Object.entries(bgColor)[0]; + old[key] = value; + } else { + old.bgColor = bgColor; + } + } + if (fontColor !== void 0 && fontColor !== null) { + if (typeof fontColor === "object") { + let [key, value] = Object.entries(fontColor)[0]; + old[key] = value; + } else { + old.fontColor = fontColor; + } + } + if (borderColor !== void 0 && borderColor !== null) { + if (typeof borderColor === "object") { + let [key, value] = Object.entries(borderColor)[0]; + old[key] = value; + } else { + old.borderColor = borderColor; + } + } + if (shadowing !== void 0 && shadowing !== null) { + if (typeof shadowing === "object") { + let [key, value] = Object.entries(shadowing)[0]; + old[key] = value; + } else { + old.shadowing = shadowing; + } + } + if (shape !== void 0 && shape !== null) { + if (typeof shape === "object") { + let [key, value] = Object.entries(shape)[0]; + old[key] = value; + } else { + old.shape = shape; + } + } + if (sprite !== void 0 && sprite !== null) { + if (typeof sprite === "object") { + let [key, value] = Object.entries(sprite)[0]; + old[key] = value; + } else { + old.sprite = sprite; + } + } + if (techn !== void 0 && techn !== null) { + if (typeof techn === "object") { + let [key, value] = Object.entries(techn)[0]; + old[key] = value; + } else { + old.techn = techn; + } + } + if (legendText !== void 0 && legendText !== null) { + if (typeof legendText === "object") { + let [key, value] = Object.entries(legendText)[0]; + old[key] = value; + } else { + old.legendText = legendText; + } + } + if (legendSprite !== void 0 && legendSprite !== null) { + if (typeof legendSprite === "object") { + let [key, value] = Object.entries(legendSprite)[0]; + old[key] = value; + } else { + old.legendSprite = legendSprite; + } + } +}; +const updateRelStyle = function(typeC4Shape, from, to, textColor, lineColor, offsetX, offsetY) { + const old = rels.find((rel) => rel.from === from && rel.to === to); + if (old === void 0) { + return; + } + if (textColor !== void 0 && textColor !== null) { + if (typeof textColor === "object") { + let [key, value] = Object.entries(textColor)[0]; + old[key] = value; + } else { + old.textColor = textColor; + } + } + if (lineColor !== void 0 && lineColor !== null) { + if (typeof lineColor === "object") { + let [key, value] = Object.entries(lineColor)[0]; + old[key] = value; + } else { + old.lineColor = lineColor; + } + } + if (offsetX !== void 0 && offsetX !== null) { + if (typeof offsetX === "object") { + let [key, value] = Object.entries(offsetX)[0]; + old[key] = parseInt(value); + } else { + old.offsetX = parseInt(offsetX); + } + } + if (offsetY !== void 0 && offsetY !== null) { + if (typeof offsetY === "object") { + let [key, value] = Object.entries(offsetY)[0]; + old[key] = parseInt(value); + } else { + old.offsetY = parseInt(offsetY); + } + } +}; +const updateLayoutConfig = function(typeC4Shape, c4ShapeInRowParam, c4BoundaryInRowParam) { + let c4ShapeInRowValue = c4ShapeInRow$1; + let c4BoundaryInRowValue = c4BoundaryInRow$1; + if (typeof c4ShapeInRowParam === "object") { + const value = Object.values(c4ShapeInRowParam)[0]; + c4ShapeInRowValue = parseInt(value); + } else { + c4ShapeInRowValue = parseInt(c4ShapeInRowParam); + } + if (typeof c4BoundaryInRowParam === "object") { + const value = Object.values(c4BoundaryInRowParam)[0]; + c4BoundaryInRowValue = parseInt(value); + } else { + c4BoundaryInRowValue = parseInt(c4BoundaryInRowParam); + } + if (c4ShapeInRowValue >= 1) { + c4ShapeInRow$1 = c4ShapeInRowValue; + } + if (c4BoundaryInRowValue >= 1) { + c4BoundaryInRow$1 = c4BoundaryInRowValue; + } +}; +const getC4ShapeInRow = function() { + return c4ShapeInRow$1; +}; +const getC4BoundaryInRow = function() { + return c4BoundaryInRow$1; +}; +const getCurrentBoundaryParse = function() { + return currentBoundaryParse; +}; +const getParentBoundaryParse = function() { + return parentBoundaryParse; +}; +const getC4ShapeArray = function(parentBoundary) { + if (parentBoundary === void 0 || parentBoundary === null) { + return c4ShapeArray; + } else { + return c4ShapeArray.filter((personOrSystem) => { + return personOrSystem.parentBoundary === parentBoundary; + }); + } +}; +const getC4Shape = function(alias) { + return c4ShapeArray.find((personOrSystem) => personOrSystem.alias === alias); +}; +const getC4ShapeKeys = function(parentBoundary) { + return Object.keys(getC4ShapeArray(parentBoundary)); +}; +const getBoundarys = function(parentBoundary) { + if (parentBoundary === void 0 || parentBoundary === null) { + return boundarys; + } else { + return boundarys.filter((boundary) => boundary.parentBoundary === parentBoundary); + } +}; +const getRels = function() { + return rels; +}; +const getTitle = function() { + return title; +}; +const setWrap = function(wrapSetting) { + wrapEnabled = wrapSetting; +}; +const autoWrap = function() { + return wrapEnabled; +}; +const clear = function() { + c4ShapeArray = []; + boundarys = [ + { + alias: "global", + label: { text: "global" }, + type: { text: "global" }, + tags: null, + link: null, + parentBoundary: "" + } + ]; + parentBoundaryParse = ""; + currentBoundaryParse = "global"; + boundaryParseStack = [""]; + rels = []; + boundaryParseStack = [""]; + title = ""; + wrapEnabled = false; + c4ShapeInRow$1 = 4; + c4BoundaryInRow$1 = 2; +}; +const LINETYPE = { + 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 +}; +const ARROWTYPE = { + FILLED: 0, + OPEN: 1 +}; +const PLACEMENT = { + LEFTOF: 0, + RIGHTOF: 1, + OVER: 2 +}; +const setTitle = function(txt) { + let sanitizedText = sanitizeText(txt, getConfig()); + title = sanitizedText; +}; +const c4Db = { + addPersonOrSystem, + addPersonOrSystemBoundary, + addContainer, + addContainerBoundary, + addComponent, + addDeploymentNode, + popBoundaryParseStack, + addRel, + updateElStyle, + updateRelStyle, + updateLayoutConfig, + autoWrap, + setWrap, + getC4ShapeArray, + getC4Shape, + getC4ShapeKeys, + getBoundarys, + getCurrentBoundaryParse, + getParentBoundaryParse, + getRels, + getTitle, + getC4Type, + getC4ShapeInRow, + getC4BoundaryInRow, + setAccTitle, + getAccTitle, + getAccDescription, + setAccDescription, + parseDirective, + getConfig: () => getConfig().c4, + clear, + LINETYPE, + ARROWTYPE, + PLACEMENT, + setTitle, + setC4Type + // apply, +}; +const drawRect = function(elem, rectData) { + const rectElem = elem.append("rect"); + rectElem.attr("x", rectData.x); + rectElem.attr("y", rectData.y); + rectElem.attr("fill", rectData.fill); + rectElem.attr("stroke", rectData.stroke); + rectElem.attr("width", rectData.width); + rectElem.attr("height", rectData.height); + rectElem.attr("rx", rectData.rx); + rectElem.attr("ry", rectData.ry); + if (rectData.attrs !== "undefined" && rectData.attrs !== null) { + for (let attrKey in rectData.attrs) { + rectElem.attr(attrKey, rectData.attrs[attrKey]); + } + } + if (rectData.class !== "undefined") { + rectElem.attr("class", rectData.class); + } + return rectElem; +}; +const drawImage = function(elem, width, height, x, y, link) { + const imageElem = elem.append("image"); + imageElem.attr("width", width); + imageElem.attr("height", height); + imageElem.attr("x", x); + imageElem.attr("y", y); + let sanitizedLink = link.startsWith("data:image/png;base64") ? link : sanitizeUrl(link); + imageElem.attr("xlink:href", sanitizedLink); +}; +const drawRels$1 = (elem, rels2, conf2) => { + const relsElem = elem.append("g"); + let i = 0; + for (let rel of rels2) { + let textColor = rel.textColor ? rel.textColor : "#444444"; + let strokeColor = rel.lineColor ? rel.lineColor : "#444444"; + let offsetX = rel.offsetX ? parseInt(rel.offsetX) : 0; + let offsetY = rel.offsetY ? parseInt(rel.offsetY) : 0; + let url = ""; + if (i === 0) { + let line = relsElem.append("line"); + line.attr("x1", rel.startPoint.x); + line.attr("y1", rel.startPoint.y); + line.attr("x2", rel.endPoint.x); + line.attr("y2", rel.endPoint.y); + line.attr("stroke-width", "1"); + line.attr("stroke", strokeColor); + line.style("fill", "none"); + if (rel.type !== "rel_b") { + line.attr("marker-end", "url(" + url + "#arrowhead)"); + } + if (rel.type === "birel" || rel.type === "rel_b") { + line.attr("marker-start", "url(" + url + "#arrowend)"); + } + i = -1; + } else { + let line = relsElem.append("path"); + line.attr("fill", "none").attr("stroke-width", "1").attr("stroke", strokeColor).attr( + "d", + "Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx", rel.startPoint.x).replaceAll("starty", rel.startPoint.y).replaceAll( + "controlx", + rel.startPoint.x + (rel.endPoint.x - rel.startPoint.x) / 2 - (rel.endPoint.x - rel.startPoint.x) / 4 + ).replaceAll("controly", rel.startPoint.y + (rel.endPoint.y - rel.startPoint.y) / 2).replaceAll("stopx", rel.endPoint.x).replaceAll("stopy", rel.endPoint.y) + ); + if (rel.type !== "rel_b") { + line.attr("marker-end", "url(" + url + "#arrowhead)"); + } + if (rel.type === "birel" || rel.type === "rel_b") { + line.attr("marker-start", "url(" + url + "#arrowend)"); + } + } + let messageConf = conf2.messageFont(); + _drawTextCandidateFunc(conf2)( + rel.label.text, + relsElem, + Math.min(rel.startPoint.x, rel.endPoint.x) + Math.abs(rel.endPoint.x - rel.startPoint.x) / 2 + offsetX, + Math.min(rel.startPoint.y, rel.endPoint.y) + Math.abs(rel.endPoint.y - rel.startPoint.y) / 2 + offsetY, + rel.label.width, + rel.label.height, + { fill: textColor }, + messageConf + ); + if (rel.techn && rel.techn.text !== "") { + messageConf = conf2.messageFont(); + _drawTextCandidateFunc(conf2)( + "[" + rel.techn.text + "]", + relsElem, + Math.min(rel.startPoint.x, rel.endPoint.x) + Math.abs(rel.endPoint.x - rel.startPoint.x) / 2 + offsetX, + Math.min(rel.startPoint.y, rel.endPoint.y) + Math.abs(rel.endPoint.y - rel.startPoint.y) / 2 + conf2.messageFontSize + 5 + offsetY, + Math.max(rel.label.width, rel.techn.width), + rel.techn.height, + { fill: textColor, "font-style": "italic" }, + messageConf + ); + } + } +}; +const drawBoundary$1 = function(elem, boundary, conf2) { + const boundaryElem = elem.append("g"); + let fillColor = boundary.bgColor ? boundary.bgColor : "none"; + let strokeColor = boundary.borderColor ? boundary.borderColor : "#444444"; + let fontColor = boundary.fontColor ? boundary.fontColor : "black"; + let attrsValue = { "stroke-width": 1, "stroke-dasharray": "7.0,7.0" }; + if (boundary.nodeType) { + attrsValue = { "stroke-width": 1 }; + } + let rectData = { + x: boundary.x, + y: boundary.y, + fill: fillColor, + stroke: strokeColor, + width: boundary.width, + height: boundary.height, + rx: 2.5, + ry: 2.5, + attrs: attrsValue + }; + drawRect(boundaryElem, rectData); + let boundaryConf = conf2.boundaryFont(); + boundaryConf.fontWeight = "bold"; + boundaryConf.fontSize = boundaryConf.fontSize + 2; + boundaryConf.fontColor = fontColor; + _drawTextCandidateFunc(conf2)( + boundary.label.text, + boundaryElem, + boundary.x, + boundary.y + boundary.label.Y, + boundary.width, + boundary.height, + { fill: "#444444" }, + boundaryConf + ); + if (boundary.type && boundary.type.text !== "") { + boundaryConf = conf2.boundaryFont(); + boundaryConf.fontColor = fontColor; + _drawTextCandidateFunc(conf2)( + boundary.type.text, + boundaryElem, + boundary.x, + boundary.y + boundary.type.Y, + boundary.width, + boundary.height, + { fill: "#444444" }, + boundaryConf + ); + } + if (boundary.descr && boundary.descr.text !== "") { + boundaryConf = conf2.boundaryFont(); + boundaryConf.fontSize = boundaryConf.fontSize - 2; + boundaryConf.fontColor = fontColor; + _drawTextCandidateFunc(conf2)( + boundary.descr.text, + boundaryElem, + boundary.x, + boundary.y + boundary.descr.Y, + boundary.width, + boundary.height, + { fill: "#444444" }, + boundaryConf + ); + } +}; +const drawC4Shape = function(elem, c4Shape, conf2) { + var _a; + let fillColor = c4Shape.bgColor ? c4Shape.bgColor : conf2[c4Shape.typeC4Shape.text + "_bg_color"]; + let strokeColor = c4Shape.borderColor ? c4Shape.borderColor : conf2[c4Shape.typeC4Shape.text + "_border_color"]; + let fontColor = c4Shape.fontColor ? c4Shape.fontColor : "#FFFFFF"; + let personImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII="; + switch (c4Shape.typeC4Shape.text) { + case "person": + personImg = "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": + personImg = "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 c4ShapeElem = elem.append("g"); + c4ShapeElem.attr("class", "person-man"); + const rect = getNoteRect(); + switch (c4Shape.typeC4Shape.text) { + case "person": + case "external_person": + case "system": + case "external_system": + case "container": + case "external_container": + case "component": + case "external_component": + rect.x = c4Shape.x; + rect.y = c4Shape.y; + rect.fill = fillColor; + rect.width = c4Shape.width; + rect.height = c4Shape.height; + rect.stroke = strokeColor; + rect.rx = 2.5; + rect.ry = 2.5; + rect.attrs = { "stroke-width": 0.5 }; + drawRect(c4ShapeElem, rect); + break; + case "system_db": + case "external_system_db": + case "container_db": + case "external_container_db": + case "component_db": + case "external_component_db": + c4ShapeElem.append("path").attr("fill", fillColor).attr("stroke-width", "0.5").attr("stroke", strokeColor).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", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.width / 2).replaceAll("height", c4Shape.height) + ); + c4ShapeElem.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", strokeColor).attr( + "d", + "Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.width / 2) + ); + break; + case "system_queue": + case "external_system_queue": + case "container_queue": + case "external_container_queue": + case "component_queue": + case "external_component_queue": + c4ShapeElem.append("path").attr("fill", fillColor).attr("stroke-width", "0.5").attr("stroke", strokeColor).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", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("width", c4Shape.width).replaceAll("half", c4Shape.height / 2) + ); + c4ShapeElem.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", strokeColor).attr( + "d", + "Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx", c4Shape.x + c4Shape.width).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.height / 2) + ); + break; + } + let c4ShapeFontConf = getC4ShapeFont(conf2, c4Shape.typeC4Shape.text); + c4ShapeElem.append("text").attr("fill", fontColor).attr("font-family", c4ShapeFontConf.fontFamily).attr("font-size", c4ShapeFontConf.fontSize - 2).attr("font-style", "italic").attr("lengthAdjust", "spacing").attr("textLength", c4Shape.typeC4Shape.width).attr("x", c4Shape.x + c4Shape.width / 2 - c4Shape.typeC4Shape.width / 2).attr("y", c4Shape.y + c4Shape.typeC4Shape.Y).text("<<" + c4Shape.typeC4Shape.text + ">>"); + switch (c4Shape.typeC4Shape.text) { + case "person": + case "external_person": + drawImage( + c4ShapeElem, + 48, + 48, + c4Shape.x + c4Shape.width / 2 - 24, + c4Shape.y + c4Shape.image.Y, + personImg + ); + break; + } + let textFontConf = conf2[c4Shape.typeC4Shape.text + "Font"](); + textFontConf.fontWeight = "bold"; + textFontConf.fontSize = textFontConf.fontSize + 2; + textFontConf.fontColor = fontColor; + _drawTextCandidateFunc(conf2)( + c4Shape.label.text, + c4ShapeElem, + c4Shape.x, + c4Shape.y + c4Shape.label.Y, + c4Shape.width, + c4Shape.height, + { fill: fontColor }, + textFontConf + ); + textFontConf = conf2[c4Shape.typeC4Shape.text + "Font"](); + textFontConf.fontColor = fontColor; + if (c4Shape.techn && ((_a = c4Shape.techn) == null ? void 0 : _a.text) !== "") { + _drawTextCandidateFunc(conf2)( + c4Shape.techn.text, + c4ShapeElem, + c4Shape.x, + c4Shape.y + c4Shape.techn.Y, + c4Shape.width, + c4Shape.height, + { fill: fontColor, "font-style": "italic" }, + textFontConf + ); + } else if (c4Shape.type && c4Shape.type.text !== "") { + _drawTextCandidateFunc(conf2)( + c4Shape.type.text, + c4ShapeElem, + c4Shape.x, + c4Shape.y + c4Shape.type.Y, + c4Shape.width, + c4Shape.height, + { fill: fontColor, "font-style": "italic" }, + textFontConf + ); + } + if (c4Shape.descr && c4Shape.descr.text !== "") { + textFontConf = conf2.personFont(); + textFontConf.fontColor = fontColor; + _drawTextCandidateFunc(conf2)( + c4Shape.descr.text, + c4ShapeElem, + c4Shape.x, + c4Shape.y + c4Shape.descr.Y, + c4Shape.width, + c4Shape.height, + { fill: fontColor }, + textFontConf + ); + } + return c4Shape.height; +}; +const insertDatabaseIcon = function(elem) { + elem.append("defs").append("symbol").attr("id", "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" + ); +}; +const insertComputerIcon = function(elem) { + elem.append("defs").append("symbol").attr("id", "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" + ); +}; +const insertClockIcon = function(elem) { + elem.append("defs").append("symbol").attr("id", "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" + ); +}; +const insertArrowHead = function(elem) { + elem.append("defs").append("marker").attr("id", "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"); +}; +const insertArrowEnd = function(elem) { + elem.append("defs").append("marker").attr("id", "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"); +}; +const insertArrowFilledHead = function(elem) { + elem.append("defs").append("marker").attr("id", "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"); +}; +const insertDynamicNumber = function(elem) { + elem.append("defs").append("marker").attr("id", "sequencenumber").attr("refX", 15).attr("refY", 15).attr("markerWidth", 60).attr("markerHeight", 40).attr("orient", "auto").append("circle").attr("cx", 15).attr("cy", 15).attr("r", 6); +}; +const insertArrowCrossHead = function(elem) { + const defs = elem.append("defs"); + const marker = defs.append("marker").attr("id", "crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 16).attr("refY", 4); + marker.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"); + marker.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"); +}; +const getNoteRect = function() { + return { + x: 0, + y: 0, + fill: "#EDF2AE", + stroke: "#666", + width: 100, + anchor: "start", + height: 100, + rx: 0, + ry: 0 + }; +}; +const getC4ShapeFont = (cnf, typeC4Shape) => { + return { + fontFamily: cnf[typeC4Shape + "FontFamily"], + fontSize: cnf[typeC4Shape + "FontSize"], + fontWeight: cnf[typeC4Shape + "FontWeight"] + }; +}; +const _drawTextCandidateFunc = function() { + function byText(content, g, x, y, width, height, textAttrs) { + const text = g.append("text").attr("x", x + width / 2).attr("y", y + height / 2 + 5).style("text-anchor", "middle").text(content); + _setTextAttrs(text, textAttrs); + } + function byTspan(content, g, x, y, width, height, textAttrs, conf2) { + const { fontSize, fontFamily, fontWeight } = conf2; + const lines = content.split(common.lineBreakRegex); + for (let i = 0; i < lines.length; i++) { + const dy = i * fontSize - fontSize * (lines.length - 1) / 2; + const text = g.append("text").attr("x", x + width / 2).attr("y", y).style("text-anchor", "middle").attr("dominant-baseline", "middle").style("font-size", fontSize).style("font-weight", fontWeight).style("font-family", fontFamily); + text.append("tspan").attr("dy", dy).text(lines[i]).attr("alignment-baseline", "mathematical"); + _setTextAttrs(text, textAttrs); + } + } + function byFo(content, g, x, y, width, height, textAttrs, conf2) { + const s = g.append("switch"); + const f = s.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height); + const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%"); + text.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content); + byTspan(content, s, x, y, width, height, textAttrs, conf2); + _setTextAttrs(text, textAttrs); + } + function _setTextAttrs(toText, fromTextAttrsDict) { + for (const key in fromTextAttrsDict) { + if (fromTextAttrsDict.hasOwnProperty(key)) { + toText.attr(key, fromTextAttrsDict[key]); + } + } + } + return function(conf2) { + return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan; + }; +}(); +const svgDraw = { + drawRect, + drawBoundary: drawBoundary$1, + drawC4Shape, + drawRels: drawRels$1, + drawImage, + insertArrowHead, + insertArrowEnd, + insertArrowFilledHead, + insertDynamicNumber, + insertArrowCrossHead, + insertDatabaseIcon, + insertComputerIcon, + insertClockIcon, + getNoteRect, + sanitizeUrl + // TODO why is this exported? +}; +let globalBoundaryMaxX = 0, globalBoundaryMaxY = 0; +let c4ShapeInRow = 4; +let c4BoundaryInRow = 2; +parser.yy = c4Db; +let conf = {}; +class Bounds { + constructor(diagObj) { + this.name = ""; + this.data = {}; + this.data.startx = void 0; + this.data.stopx = void 0; + this.data.starty = void 0; + this.data.stopy = void 0; + this.data.widthLimit = void 0; + this.nextData = {}; + this.nextData.startx = void 0; + this.nextData.stopx = void 0; + this.nextData.starty = void 0; + this.nextData.stopy = void 0; + this.nextData.cnt = 0; + setConf(diagObj.db.getConfig()); + } + setData(startx, stopx, starty, stopy) { + this.nextData.startx = this.data.startx = startx; + this.nextData.stopx = this.data.stopx = stopx; + this.nextData.starty = this.data.starty = starty; + this.nextData.stopy = this.data.stopy = stopy; + } + updateVal(obj, key, val, fun) { + if (obj[key] === void 0) { + obj[key] = val; + } else { + obj[key] = fun(val, obj[key]); + } + } + insert(c4Shape) { + this.nextData.cnt = this.nextData.cnt + 1; + let _startx = this.nextData.startx === this.nextData.stopx ? this.nextData.stopx + c4Shape.margin : this.nextData.stopx + c4Shape.margin * 2; + let _stopx = _startx + c4Shape.width; + let _starty = this.nextData.starty + c4Shape.margin * 2; + let _stopy = _starty + c4Shape.height; + if (_startx >= this.data.widthLimit || _stopx >= this.data.widthLimit || this.nextData.cnt > c4ShapeInRow) { + _startx = this.nextData.startx + c4Shape.margin + conf.nextLinePaddingX; + _starty = this.nextData.stopy + c4Shape.margin * 2; + this.nextData.stopx = _stopx = _startx + c4Shape.width; + this.nextData.starty = this.nextData.stopy; + this.nextData.stopy = _stopy = _starty + c4Shape.height; + this.nextData.cnt = 1; + } + c4Shape.x = _startx; + c4Shape.y = _starty; + this.updateVal(this.data, "startx", _startx, Math.min); + this.updateVal(this.data, "starty", _starty, Math.min); + this.updateVal(this.data, "stopx", _stopx, Math.max); + this.updateVal(this.data, "stopy", _stopy, Math.max); + this.updateVal(this.nextData, "startx", _startx, Math.min); + this.updateVal(this.nextData, "starty", _starty, Math.min); + this.updateVal(this.nextData, "stopx", _stopx, Math.max); + this.updateVal(this.nextData, "stopy", _stopy, Math.max); + } + init(diagObj) { + 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 + }; + setConf(diagObj.db.getConfig()); + } + bumpLastMargin(margin) { + this.data.stopx += margin; + this.data.stopy += margin; + } +} +const setConf = function(cnf) { + assignWithDepth(conf, cnf); + if (cnf.fontFamily) { + conf.personFontFamily = conf.systemFontFamily = conf.messageFontFamily = cnf.fontFamily; + } + if (cnf.fontSize) { + conf.personFontSize = conf.systemFontSize = conf.messageFontSize = cnf.fontSize; + } + if (cnf.fontWeight) { + conf.personFontWeight = conf.systemFontWeight = conf.messageFontWeight = cnf.fontWeight; + } +}; +const c4ShapeFont = (cnf, typeC4Shape) => { + return { + fontFamily: cnf[typeC4Shape + "FontFamily"], + fontSize: cnf[typeC4Shape + "FontSize"], + fontWeight: cnf[typeC4Shape + "FontWeight"] + }; +}; +const boundaryFont = (cnf) => { + return { + fontFamily: cnf.boundaryFontFamily, + fontSize: cnf.boundaryFontSize, + fontWeight: cnf.boundaryFontWeight + }; +}; +const messageFont = (cnf) => { + return { + fontFamily: cnf.messageFontFamily, + fontSize: cnf.messageFontSize, + fontWeight: cnf.messageFontWeight + }; +}; +function calcC4ShapeTextWH(textType, c4Shape, c4ShapeTextWrap, textConf, textLimitWidth) { + if (!c4Shape[textType].width) { + if (c4ShapeTextWrap) { + c4Shape[textType].text = wrapLabel(c4Shape[textType].text, textLimitWidth, textConf); + c4Shape[textType].textLines = c4Shape[textType].text.split(common.lineBreakRegex).length; + c4Shape[textType].width = textLimitWidth; + c4Shape[textType].height = calculateTextHeight(c4Shape[textType].text, textConf); + } else { + let lines = c4Shape[textType].text.split(common.lineBreakRegex); + c4Shape[textType].textLines = lines.length; + let lineHeight = 0; + c4Shape[textType].height = 0; + c4Shape[textType].width = 0; + for (const line of lines) { + c4Shape[textType].width = Math.max( + calculateTextWidth(line, textConf), + c4Shape[textType].width + ); + lineHeight = calculateTextHeight(line, textConf); + c4Shape[textType].height = c4Shape[textType].height + lineHeight; + } + } + } +} +const drawBoundary = function(diagram2, boundary, bounds) { + boundary.x = bounds.data.startx; + boundary.y = bounds.data.starty; + boundary.width = bounds.data.stopx - bounds.data.startx; + boundary.height = bounds.data.stopy - bounds.data.starty; + boundary.label.y = conf.c4ShapeMargin - 35; + let boundaryTextWrap = boundary.wrap && conf.wrap; + let boundaryLabelConf = boundaryFont(conf); + boundaryLabelConf.fontSize = boundaryLabelConf.fontSize + 2; + boundaryLabelConf.fontWeight = "bold"; + let textLimitWidth = calculateTextWidth(boundary.label.text, boundaryLabelConf); + calcC4ShapeTextWH("label", boundary, boundaryTextWrap, boundaryLabelConf, textLimitWidth); + svgDraw.drawBoundary(diagram2, boundary, conf); +}; +const drawC4ShapeArray = function(currentBounds, diagram2, c4ShapeArray2, c4ShapeKeys) { + let Y = 0; + for (const c4ShapeKey of c4ShapeKeys) { + Y = 0; + const c4Shape = c4ShapeArray2[c4ShapeKey]; + let c4ShapeTypeConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text); + c4ShapeTypeConf.fontSize = c4ShapeTypeConf.fontSize - 2; + c4Shape.typeC4Shape.width = calculateTextWidth( + "<<" + c4Shape.typeC4Shape.text + ">>", + c4ShapeTypeConf + ); + c4Shape.typeC4Shape.height = c4ShapeTypeConf.fontSize + 2; + c4Shape.typeC4Shape.Y = conf.c4ShapePadding; + Y = c4Shape.typeC4Shape.Y + c4Shape.typeC4Shape.height - 4; + c4Shape.image = { width: 0, height: 0, Y: 0 }; + switch (c4Shape.typeC4Shape.text) { + case "person": + case "external_person": + c4Shape.image.width = 48; + c4Shape.image.height = 48; + c4Shape.image.Y = Y; + Y = c4Shape.image.Y + c4Shape.image.height; + break; + } + if (c4Shape.sprite) { + c4Shape.image.width = 48; + c4Shape.image.height = 48; + c4Shape.image.Y = Y; + Y = c4Shape.image.Y + c4Shape.image.height; + } + let c4ShapeTextWrap = c4Shape.wrap && conf.wrap; + let textLimitWidth = conf.width - conf.c4ShapePadding * 2; + let c4ShapeLabelConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text); + c4ShapeLabelConf.fontSize = c4ShapeLabelConf.fontSize + 2; + c4ShapeLabelConf.fontWeight = "bold"; + calcC4ShapeTextWH("label", c4Shape, c4ShapeTextWrap, c4ShapeLabelConf, textLimitWidth); + c4Shape["label"].Y = Y + 8; + Y = c4Shape["label"].Y + c4Shape["label"].height; + if (c4Shape.type && c4Shape.type.text !== "") { + c4Shape.type.text = "[" + c4Shape.type.text + "]"; + let c4ShapeTypeConf2 = c4ShapeFont(conf, c4Shape.typeC4Shape.text); + calcC4ShapeTextWH("type", c4Shape, c4ShapeTextWrap, c4ShapeTypeConf2, textLimitWidth); + c4Shape["type"].Y = Y + 5; + Y = c4Shape["type"].Y + c4Shape["type"].height; + } else if (c4Shape.techn && c4Shape.techn.text !== "") { + c4Shape.techn.text = "[" + c4Shape.techn.text + "]"; + let c4ShapeTechnConf = c4ShapeFont(conf, c4Shape.techn.text); + calcC4ShapeTextWH("techn", c4Shape, c4ShapeTextWrap, c4ShapeTechnConf, textLimitWidth); + c4Shape["techn"].Y = Y + 5; + Y = c4Shape["techn"].Y + c4Shape["techn"].height; + } + let rectHeight = Y; + let rectWidth = c4Shape.label.width; + if (c4Shape.descr && c4Shape.descr.text !== "") { + let c4ShapeDescrConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text); + calcC4ShapeTextWH("descr", c4Shape, c4ShapeTextWrap, c4ShapeDescrConf, textLimitWidth); + c4Shape["descr"].Y = Y + 20; + Y = c4Shape["descr"].Y + c4Shape["descr"].height; + rectWidth = Math.max(c4Shape.label.width, c4Shape.descr.width); + rectHeight = Y - c4Shape["descr"].textLines * 5; + } + rectWidth = rectWidth + conf.c4ShapePadding; + c4Shape.width = Math.max(c4Shape.width || conf.width, rectWidth, conf.width); + c4Shape.height = Math.max(c4Shape.height || conf.height, rectHeight, conf.height); + c4Shape.margin = c4Shape.margin || conf.c4ShapeMargin; + currentBounds.insert(c4Shape); + svgDraw.drawC4Shape(diagram2, c4Shape, conf); + } + currentBounds.bumpLastMargin(conf.c4ShapeMargin); +}; +class Point { + constructor(x, y) { + this.x = x; + this.y = y; + } +} +let getIntersectPoint = function(fromNode, endPoint) { + let x1 = fromNode.x; + let y1 = fromNode.y; + let x2 = endPoint.x; + let y2 = endPoint.y; + let fromCenterX = x1 + fromNode.width / 2; + let fromCenterY = y1 + fromNode.height / 2; + let dx = Math.abs(x1 - x2); + let dy = Math.abs(y1 - y2); + let tanDYX = dy / dx; + let fromDYX = fromNode.height / fromNode.width; + let returnPoint = null; + if (y1 == y2 && x1 < x2) { + returnPoint = new Point(x1 + fromNode.width, fromCenterY); + } else if (y1 == y2 && x1 > x2) { + returnPoint = new Point(x1, fromCenterY); + } else if (x1 == x2 && y1 < y2) { + returnPoint = new Point(fromCenterX, y1 + fromNode.height); + } else if (x1 == x2 && y1 > y2) { + returnPoint = new Point(fromCenterX, y1); + } + if (x1 > x2 && y1 < y2) { + if (fromDYX >= tanDYX) { + returnPoint = new Point(x1, fromCenterY + tanDYX * fromNode.width / 2); + } else { + returnPoint = new Point( + fromCenterX - dx / dy * fromNode.height / 2, + y1 + fromNode.height + ); + } + } else if (x1 < x2 && y1 < y2) { + if (fromDYX >= tanDYX) { + returnPoint = new Point(x1 + fromNode.width, fromCenterY + tanDYX * fromNode.width / 2); + } else { + returnPoint = new Point( + fromCenterX + dx / dy * fromNode.height / 2, + y1 + fromNode.height + ); + } + } else if (x1 < x2 && y1 > y2) { + if (fromDYX >= tanDYX) { + returnPoint = new Point(x1 + fromNode.width, fromCenterY - tanDYX * fromNode.width / 2); + } else { + returnPoint = new Point(fromCenterX + fromNode.height / 2 * dx / dy, y1); + } + } else if (x1 > x2 && y1 > y2) { + if (fromDYX >= tanDYX) { + returnPoint = new Point(x1, fromCenterY - fromNode.width / 2 * tanDYX); + } else { + returnPoint = new Point(fromCenterX - fromNode.height / 2 * dx / dy, y1); + } + } + return returnPoint; +}; +let getIntersectPoints = function(fromNode, endNode) { + let endIntersectPoint = { x: 0, y: 0 }; + endIntersectPoint.x = endNode.x + endNode.width / 2; + endIntersectPoint.y = endNode.y + endNode.height / 2; + let startPoint = getIntersectPoint(fromNode, endIntersectPoint); + endIntersectPoint.x = fromNode.x + fromNode.width / 2; + endIntersectPoint.y = fromNode.y + fromNode.height / 2; + let endPoint = getIntersectPoint(endNode, endIntersectPoint); + return { startPoint, endPoint }; +}; +const drawRels = function(diagram2, rels2, getC4ShapeObj, diagObj) { + let i = 0; + for (let rel of rels2) { + i = i + 1; + let relTextWrap = rel.wrap && conf.wrap; + let relConf = messageFont(conf); + let diagramType = diagObj.db.getC4Type(); + if (diagramType === "C4Dynamic") { + rel.label.text = i + ": " + rel.label.text; + } + let textLimitWidth = calculateTextWidth(rel.label.text, relConf); + calcC4ShapeTextWH("label", rel, relTextWrap, relConf, textLimitWidth); + if (rel.techn && rel.techn.text !== "") { + textLimitWidth = calculateTextWidth(rel.techn.text, relConf); + calcC4ShapeTextWH("techn", rel, relTextWrap, relConf, textLimitWidth); + } + if (rel.descr && rel.descr.text !== "") { + textLimitWidth = calculateTextWidth(rel.descr.text, relConf); + calcC4ShapeTextWH("descr", rel, relTextWrap, relConf, textLimitWidth); + } + let fromNode = getC4ShapeObj(rel.from); + let endNode = getC4ShapeObj(rel.to); + let points = getIntersectPoints(fromNode, endNode); + rel.startPoint = points.startPoint; + rel.endPoint = points.endPoint; + } + svgDraw.drawRels(diagram2, rels2, conf); +}; +function drawInsideBoundary(diagram2, parentBoundaryAlias, parentBounds, currentBoundaries, diagObj) { + let currentBounds = new Bounds(diagObj); + currentBounds.data.widthLimit = parentBounds.data.widthLimit / Math.min(c4BoundaryInRow, currentBoundaries.length); + for (let [i, currentBoundary] of currentBoundaries.entries()) { + let Y = 0; + currentBoundary.image = { width: 0, height: 0, Y: 0 }; + if (currentBoundary.sprite) { + currentBoundary.image.width = 48; + currentBoundary.image.height = 48; + currentBoundary.image.Y = Y; + Y = currentBoundary.image.Y + currentBoundary.image.height; + } + let currentBoundaryTextWrap = currentBoundary.wrap && conf.wrap; + let currentBoundaryLabelConf = boundaryFont(conf); + currentBoundaryLabelConf.fontSize = currentBoundaryLabelConf.fontSize + 2; + currentBoundaryLabelConf.fontWeight = "bold"; + calcC4ShapeTextWH( + "label", + currentBoundary, + currentBoundaryTextWrap, + currentBoundaryLabelConf, + currentBounds.data.widthLimit + ); + currentBoundary["label"].Y = Y + 8; + Y = currentBoundary["label"].Y + currentBoundary["label"].height; + if (currentBoundary.type && currentBoundary.type.text !== "") { + currentBoundary.type.text = "[" + currentBoundary.type.text + "]"; + let currentBoundaryTypeConf = boundaryFont(conf); + calcC4ShapeTextWH( + "type", + currentBoundary, + currentBoundaryTextWrap, + currentBoundaryTypeConf, + currentBounds.data.widthLimit + ); + currentBoundary["type"].Y = Y + 5; + Y = currentBoundary["type"].Y + currentBoundary["type"].height; + } + if (currentBoundary.descr && currentBoundary.descr.text !== "") { + let currentBoundaryDescrConf = boundaryFont(conf); + currentBoundaryDescrConf.fontSize = currentBoundaryDescrConf.fontSize - 2; + calcC4ShapeTextWH( + "descr", + currentBoundary, + currentBoundaryTextWrap, + currentBoundaryDescrConf, + currentBounds.data.widthLimit + ); + currentBoundary["descr"].Y = Y + 20; + Y = currentBoundary["descr"].Y + currentBoundary["descr"].height; + } + if (i == 0 || i % c4BoundaryInRow === 0) { + let _x = parentBounds.data.startx + conf.diagramMarginX; + let _y = parentBounds.data.stopy + conf.diagramMarginY + Y; + currentBounds.setData(_x, _x, _y, _y); + } else { + let _x = currentBounds.data.stopx !== currentBounds.data.startx ? currentBounds.data.stopx + conf.diagramMarginX : currentBounds.data.startx; + let _y = currentBounds.data.starty; + currentBounds.setData(_x, _x, _y, _y); + } + currentBounds.name = currentBoundary.alias; + let currentPersonOrSystemArray = diagObj.db.getC4ShapeArray(currentBoundary.alias); + let currentPersonOrSystemKeys = diagObj.db.getC4ShapeKeys(currentBoundary.alias); + if (currentPersonOrSystemKeys.length > 0) { + drawC4ShapeArray( + currentBounds, + diagram2, + currentPersonOrSystemArray, + currentPersonOrSystemKeys + ); + } + parentBoundaryAlias = currentBoundary.alias; + let nextCurrentBoundarys = diagObj.db.getBoundarys(parentBoundaryAlias); + if (nextCurrentBoundarys.length > 0) { + drawInsideBoundary( + diagram2, + parentBoundaryAlias, + currentBounds, + nextCurrentBoundarys, + diagObj + ); + } + if (currentBoundary.alias !== "global") { + drawBoundary(diagram2, currentBoundary, currentBounds); + } + parentBounds.data.stopy = Math.max( + currentBounds.data.stopy + conf.c4ShapeMargin, + parentBounds.data.stopy + ); + parentBounds.data.stopx = Math.max( + currentBounds.data.stopx + conf.c4ShapeMargin, + parentBounds.data.stopx + ); + globalBoundaryMaxX = Math.max(globalBoundaryMaxX, parentBounds.data.stopx); + globalBoundaryMaxY = Math.max(globalBoundaryMaxY, parentBounds.data.stopy); + } +} +const draw = function(_text, id, _version, diagObj) { + conf = getConfig().c4; + const securityLevel = getConfig().securityLevel; + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = select("#i" + id); + } + const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body"); + let db = diagObj.db; + diagObj.db.setWrap(conf.wrap); + c4ShapeInRow = db.getC4ShapeInRow(); + c4BoundaryInRow = db.getC4BoundaryInRow(); + log.debug(`C:${JSON.stringify(conf, null, 2)}`); + const diagram2 = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : select(`[id="${id}"]`); + svgDraw.insertComputerIcon(diagram2); + svgDraw.insertDatabaseIcon(diagram2); + svgDraw.insertClockIcon(diagram2); + let screenBounds = new Bounds(diagObj); + screenBounds.setData( + conf.diagramMarginX, + conf.diagramMarginX, + conf.diagramMarginY, + conf.diagramMarginY + ); + screenBounds.data.widthLimit = screen.availWidth; + globalBoundaryMaxX = conf.diagramMarginX; + globalBoundaryMaxY = conf.diagramMarginY; + const title2 = diagObj.db.getTitle(); + let currentBoundaries = diagObj.db.getBoundarys(""); + drawInsideBoundary(diagram2, "", screenBounds, currentBoundaries, diagObj); + svgDraw.insertArrowHead(diagram2); + svgDraw.insertArrowEnd(diagram2); + svgDraw.insertArrowCrossHead(diagram2); + svgDraw.insertArrowFilledHead(diagram2); + drawRels(diagram2, diagObj.db.getRels(), diagObj.db.getC4Shape, diagObj); + screenBounds.data.stopx = globalBoundaryMaxX; + screenBounds.data.stopy = globalBoundaryMaxY; + const box = screenBounds.data; + let boxHeight = box.stopy - box.starty; + let height = boxHeight + 2 * conf.diagramMarginY; + let boxWidth = box.stopx - box.startx; + const width = boxWidth + 2 * conf.diagramMarginX; + if (title2) { + diagram2.append("text").text(title2).attr("x", (box.stopx - box.startx) / 2 - 4 * conf.diagramMarginX).attr("y", box.starty + conf.diagramMarginY); + } + configureSvgSize(diagram2, height, width, conf.useMaxWidth); + const extraVertForTitle = title2 ? 60 : 0; + diagram2.attr( + "viewBox", + box.startx - conf.diagramMarginX + " -" + (conf.diagramMarginY + extraVertForTitle) + " " + width + " " + (height + extraVertForTitle) + ); + log.debug(`models:`, box); +}; +const c4Renderer = { + drawPersonOrSystemArray: drawC4ShapeArray, + drawBoundary, + setConf, + draw +}; +const getStyles = (options) => `.person { + stroke: ${options.personBorder}; + fill: ${options.personBkg}; + } +`; +const c4Styles = getStyles; +const diagram = { + parser: c4Parser, + db: c4Db, + renderer: c4Renderer, + styles: c4Styles, + init: (cnf) => { + c4Renderer.setConf(cnf.c4); + } +}; +export { + diagram +}; +//# sourceMappingURL=c4Diagram-44c43e89.js.map diff --git a/scopegraphs-render-docs/doc/js/c4Diagram-be8b5c2c.js b/scopegraphs-render-docs/doc/js/c4Diagram-be8b5c2c.js new file mode 100644 index 0000000..be93fe6 --- /dev/null +++ b/scopegraphs-render-docs/doc/js/c4Diagram-be8b5c2c.js @@ -0,0 +1,2527 @@ +import { m as mermaidAPI } from "./mermaidAPI-c841a67f.js"; +import { q as setAccTitle, v as getAccTitle, w as getAccDescription, x as setAccDescription, g as getConfig, b as sanitizeText, f as common, d as assignWithDepth, h as select, l as log } from "./commonDb-89160e91.js"; +import { s as sanitizeUrl_1, q as calculateTextWidth, v as configureSvgSize, w as wrapLabel, x as calculateTextHeight } from "./utils-1aebe9b6.js"; +var parser = function() { + var o = function(k, v, o2, l) { + for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) + ; + return o2; + }, $V0 = [1, 6], $V1 = [1, 7], $V2 = [1, 8], $V3 = [1, 9], $V4 = [1, 16], $V5 = [1, 11], $V6 = [1, 12], $V7 = [1, 13], $V8 = [1, 14], $V9 = [1, 15], $Va = [1, 27], $Vb = [1, 33], $Vc = [1, 34], $Vd = [1, 35], $Ve = [1, 36], $Vf = [1, 37], $Vg = [1, 72], $Vh = [1, 73], $Vi = [1, 74], $Vj = [1, 75], $Vk = [1, 76], $Vl = [1, 77], $Vm = [1, 78], $Vn = [1, 38], $Vo = [1, 39], $Vp = [1, 40], $Vq = [1, 41], $Vr = [1, 42], $Vs = [1, 43], $Vt = [1, 44], $Vu = [1, 45], $Vv = [1, 46], $Vw = [1, 47], $Vx = [1, 48], $Vy = [1, 49], $Vz = [1, 50], $VA = [1, 51], $VB = [1, 52], $VC = [1, 53], $VD = [1, 54], $VE = [1, 55], $VF = [1, 56], $VG = [1, 57], $VH = [1, 59], $VI = [1, 60], $VJ = [1, 61], $VK = [1, 62], $VL = [1, 63], $VM = [1, 64], $VN = [1, 65], $VO = [1, 66], $VP = [1, 67], $VQ = [1, 68], $VR = [1, 69], $VS = [24, 52], $VT = [24, 44, 46, 47, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84], $VU = [15, 24, 44, 46, 47, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84], $VV = [1, 94], $VW = [1, 95], $VX = [1, 96], $VY = [1, 97], $VZ = [15, 24, 52], $V_ = [7, 8, 9, 10, 18, 22, 25, 26, 27, 28], $V$ = [15, 24, 43, 52], $V01 = [15, 24, 43, 52, 86, 87, 89, 90], $V11 = [15, 43], $V21 = [44, 46, 47, 48, 49, 50, 51, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84]; + var parser2 = { + trace: function trace() { + }, + yy: {}, + symbols_: { "error": 2, "start": 3, "mermaidDoc": 4, "direction": 5, "directive": 6, "direction_tb": 7, "direction_bt": 8, "direction_rl": 9, "direction_lr": 10, "graphConfig": 11, "openDirective": 12, "typeDirective": 13, "closeDirective": 14, "NEWLINE": 15, ":": 16, "argDirective": 17, "open_directive": 18, "type_directive": 19, "arg_directive": 20, "close_directive": 21, "C4_CONTEXT": 22, "statements": 23, "EOF": 24, "C4_CONTAINER": 25, "C4_COMPONENT": 26, "C4_DYNAMIC": 27, "C4_DEPLOYMENT": 28, "otherStatements": 29, "diagramStatements": 30, "otherStatement": 31, "title": 32, "accDescription": 33, "acc_title": 34, "acc_title_value": 35, "acc_descr": 36, "acc_descr_value": 37, "acc_descr_multiline_value": 38, "boundaryStatement": 39, "boundaryStartStatement": 40, "boundaryStopStatement": 41, "boundaryStart": 42, "LBRACE": 43, "ENTERPRISE_BOUNDARY": 44, "attributes": 45, "SYSTEM_BOUNDARY": 46, "BOUNDARY": 47, "CONTAINER_BOUNDARY": 48, "NODE": 49, "NODE_L": 50, "NODE_R": 51, "RBRACE": 52, "diagramStatement": 53, "PERSON": 54, "PERSON_EXT": 55, "SYSTEM": 56, "SYSTEM_DB": 57, "SYSTEM_QUEUE": 58, "SYSTEM_EXT": 59, "SYSTEM_EXT_DB": 60, "SYSTEM_EXT_QUEUE": 61, "CONTAINER": 62, "CONTAINER_DB": 63, "CONTAINER_QUEUE": 64, "CONTAINER_EXT": 65, "CONTAINER_EXT_DB": 66, "CONTAINER_EXT_QUEUE": 67, "COMPONENT": 68, "COMPONENT_DB": 69, "COMPONENT_QUEUE": 70, "COMPONENT_EXT": 71, "COMPONENT_EXT_DB": 72, "COMPONENT_EXT_QUEUE": 73, "REL": 74, "BIREL": 75, "REL_U": 76, "REL_D": 77, "REL_L": 78, "REL_R": 79, "REL_B": 80, "REL_INDEX": 81, "UPDATE_EL_STYLE": 82, "UPDATE_REL_STYLE": 83, "UPDATE_LAYOUT_CONFIG": 84, "attribute": 85, "STR": 86, "STR_KEY": 87, "STR_VALUE": 88, "ATTRIBUTE": 89, "ATTRIBUTE_EMPTY": 90, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 7: "direction_tb", 8: "direction_bt", 9: "direction_rl", 10: "direction_lr", 15: "NEWLINE", 16: ":", 18: "open_directive", 19: "type_directive", 20: "arg_directive", 21: "close_directive", 22: "C4_CONTEXT", 24: "EOF", 25: "C4_CONTAINER", 26: "C4_COMPONENT", 27: "C4_DYNAMIC", 28: "C4_DEPLOYMENT", 32: "title", 33: "accDescription", 34: "acc_title", 35: "acc_title_value", 36: "acc_descr", 37: "acc_descr_value", 38: "acc_descr_multiline_value", 43: "LBRACE", 44: "ENTERPRISE_BOUNDARY", 46: "SYSTEM_BOUNDARY", 47: "BOUNDARY", 48: "CONTAINER_BOUNDARY", 49: "NODE", 50: "NODE_L", 51: "NODE_R", 52: "RBRACE", 54: "PERSON", 55: "PERSON_EXT", 56: "SYSTEM", 57: "SYSTEM_DB", 58: "SYSTEM_QUEUE", 59: "SYSTEM_EXT", 60: "SYSTEM_EXT_DB", 61: "SYSTEM_EXT_QUEUE", 62: "CONTAINER", 63: "CONTAINER_DB", 64: "CONTAINER_QUEUE", 65: "CONTAINER_EXT", 66: "CONTAINER_EXT_DB", 67: "CONTAINER_EXT_QUEUE", 68: "COMPONENT", 69: "COMPONENT_DB", 70: "COMPONENT_QUEUE", 71: "COMPONENT_EXT", 72: "COMPONENT_EXT_DB", 73: "COMPONENT_EXT_QUEUE", 74: "REL", 75: "BIREL", 76: "REL_U", 77: "REL_D", 78: "REL_L", 79: "REL_R", 80: "REL_B", 81: "REL_INDEX", 82: "UPDATE_EL_STYLE", 83: "UPDATE_REL_STYLE", 84: "UPDATE_LAYOUT_CONFIG", 86: "STR", 87: "STR_KEY", 88: "STR_VALUE", 89: "ATTRIBUTE", 90: "ATTRIBUTE_EMPTY" }, + productions_: [0, [3, 1], [3, 1], [3, 2], [5, 1], [5, 1], [5, 1], [5, 1], [4, 1], [6, 4], [6, 6], [12, 1], [13, 1], [17, 1], [14, 1], [11, 4], [11, 4], [11, 4], [11, 4], [11, 4], [23, 1], [23, 1], [23, 2], [29, 1], [29, 2], [29, 3], [31, 1], [31, 1], [31, 2], [31, 2], [31, 1], [39, 3], [40, 3], [40, 3], [40, 4], [42, 2], [42, 2], [42, 2], [42, 2], [42, 2], [42, 2], [42, 2], [41, 1], [30, 1], [30, 2], [30, 3], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 1], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [45, 1], [45, 2], [85, 1], [85, 2], [85, 1], [85, 1]], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 4: + yy.setDirection("TB"); + break; + case 5: + yy.setDirection("BT"); + break; + case 6: + yy.setDirection("RL"); + break; + case 7: + yy.setDirection("LR"); + break; + case 11: + yy.parseDirective("%%{", "open_directive"); + break; + case 12: + break; + case 13: + $$[$0] = $$[$0].trim().replace(/'/g, '"'); + yy.parseDirective($$[$0], "arg_directive"); + break; + case 14: + yy.parseDirective("}%%", "close_directive", "c4Context"); + break; + case 15: + case 16: + case 17: + case 18: + case 19: + yy.setC4Type($$[$0 - 3]); + break; + case 26: + yy.setTitle($$[$0].substring(6)); + this.$ = $$[$0].substring(6); + break; + case 27: + yy.setAccDescription($$[$0].substring(15)); + this.$ = $$[$0].substring(15); + break; + case 28: + this.$ = $$[$0].trim(); + yy.setTitle(this.$); + break; + case 29: + case 30: + this.$ = $$[$0].trim(); + yy.setAccDescription(this.$); + break; + case 35: + case 36: + $$[$0].splice(2, 0, "ENTERPRISE"); + yy.addPersonOrSystemBoundary(...$$[$0]); + this.$ = $$[$0]; + break; + case 37: + yy.addPersonOrSystemBoundary(...$$[$0]); + this.$ = $$[$0]; + break; + case 38: + $$[$0].splice(2, 0, "CONTAINER"); + yy.addContainerBoundary(...$$[$0]); + this.$ = $$[$0]; + break; + case 39: + yy.addDeploymentNode("node", ...$$[$0]); + this.$ = $$[$0]; + break; + case 40: + yy.addDeploymentNode("nodeL", ...$$[$0]); + this.$ = $$[$0]; + break; + case 41: + yy.addDeploymentNode("nodeR", ...$$[$0]); + this.$ = $$[$0]; + break; + case 42: + yy.popBoundaryParseStack(); + break; + case 46: + yy.addPersonOrSystem("person", ...$$[$0]); + this.$ = $$[$0]; + break; + case 47: + yy.addPersonOrSystem("external_person", ...$$[$0]); + this.$ = $$[$0]; + break; + case 48: + yy.addPersonOrSystem("system", ...$$[$0]); + this.$ = $$[$0]; + break; + case 49: + yy.addPersonOrSystem("system_db", ...$$[$0]); + this.$ = $$[$0]; + break; + case 50: + yy.addPersonOrSystem("system_queue", ...$$[$0]); + this.$ = $$[$0]; + break; + case 51: + yy.addPersonOrSystem("external_system", ...$$[$0]); + this.$ = $$[$0]; + break; + case 52: + yy.addPersonOrSystem("external_system_db", ...$$[$0]); + this.$ = $$[$0]; + break; + case 53: + yy.addPersonOrSystem("external_system_queue", ...$$[$0]); + this.$ = $$[$0]; + break; + case 54: + yy.addContainer("container", ...$$[$0]); + this.$ = $$[$0]; + break; + case 55: + yy.addContainer("container_db", ...$$[$0]); + this.$ = $$[$0]; + break; + case 56: + yy.addContainer("container_queue", ...$$[$0]); + this.$ = $$[$0]; + break; + case 57: + yy.addContainer("external_container", ...$$[$0]); + this.$ = $$[$0]; + break; + case 58: + yy.addContainer("external_container_db", ...$$[$0]); + this.$ = $$[$0]; + break; + case 59: + yy.addContainer("external_container_queue", ...$$[$0]); + this.$ = $$[$0]; + break; + case 60: + yy.addComponent("component", ...$$[$0]); + this.$ = $$[$0]; + break; + case 61: + yy.addComponent("component_db", ...$$[$0]); + this.$ = $$[$0]; + break; + case 62: + yy.addComponent("component_queue", ...$$[$0]); + this.$ = $$[$0]; + break; + case 63: + yy.addComponent("external_component", ...$$[$0]); + this.$ = $$[$0]; + break; + case 64: + yy.addComponent("external_component_db", ...$$[$0]); + this.$ = $$[$0]; + break; + case 65: + yy.addComponent("external_component_queue", ...$$[$0]); + this.$ = $$[$0]; + break; + case 67: + yy.addRel("rel", ...$$[$0]); + this.$ = $$[$0]; + break; + case 68: + yy.addRel("birel", ...$$[$0]); + this.$ = $$[$0]; + break; + case 69: + yy.addRel("rel_u", ...$$[$0]); + this.$ = $$[$0]; + break; + case 70: + yy.addRel("rel_d", ...$$[$0]); + this.$ = $$[$0]; + break; + case 71: + yy.addRel("rel_l", ...$$[$0]); + this.$ = $$[$0]; + break; + case 72: + yy.addRel("rel_r", ...$$[$0]); + this.$ = $$[$0]; + break; + case 73: + yy.addRel("rel_b", ...$$[$0]); + this.$ = $$[$0]; + break; + case 74: + $$[$0].splice(0, 1); + yy.addRel("rel", ...$$[$0]); + this.$ = $$[$0]; + break; + case 75: + yy.updateElStyle("update_el_style", ...$$[$0]); + this.$ = $$[$0]; + break; + case 76: + yy.updateRelStyle("update_rel_style", ...$$[$0]); + this.$ = $$[$0]; + break; + case 77: + yy.updateLayoutConfig("update_layout_config", ...$$[$0]); + this.$ = $$[$0]; + break; + case 78: + this.$ = [$$[$0]]; + break; + case 79: + $$[$0].unshift($$[$0 - 1]); + this.$ = $$[$0]; + break; + case 80: + case 82: + this.$ = $$[$0].trim(); + break; + case 81: + let kv = {}; + kv[$$[$0 - 1].trim()] = $$[$0].trim(); + this.$ = kv; + break; + case 83: + this.$ = ""; + break; + } + }, + table: [{ 3: 1, 4: 2, 5: 3, 6: 4, 7: $V0, 8: $V1, 9: $V2, 10: $V3, 11: 5, 12: 10, 18: $V4, 22: $V5, 25: $V6, 26: $V7, 27: $V8, 28: $V9 }, { 1: [3] }, { 1: [2, 1] }, { 1: [2, 2] }, { 3: 17, 4: 2, 5: 3, 6: 4, 7: $V0, 8: $V1, 9: $V2, 10: $V3, 11: 5, 12: 10, 18: $V4, 22: $V5, 25: $V6, 26: $V7, 27: $V8, 28: $V9 }, { 1: [2, 8] }, { 1: [2, 4] }, { 1: [2, 5] }, { 1: [2, 6] }, { 1: [2, 7] }, { 13: 18, 19: [1, 19] }, { 15: [1, 20] }, { 15: [1, 21] }, { 15: [1, 22] }, { 15: [1, 23] }, { 15: [1, 24] }, { 19: [2, 11] }, { 1: [2, 3] }, { 14: 25, 16: [1, 26], 21: $Va }, o([16, 21], [2, 12]), { 23: 28, 29: 29, 30: 30, 31: 31, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf, 39: 58, 40: 70, 42: 71, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 53: 32, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }, { 23: 79, 29: 29, 30: 30, 31: 31, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf, 39: 58, 40: 70, 42: 71, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 53: 32, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }, { 23: 80, 29: 29, 30: 30, 31: 31, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf, 39: 58, 40: 70, 42: 71, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 53: 32, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }, { 23: 81, 29: 29, 30: 30, 31: 31, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf, 39: 58, 40: 70, 42: 71, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 53: 32, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }, { 23: 82, 29: 29, 30: 30, 31: 31, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf, 39: 58, 40: 70, 42: 71, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 53: 32, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }, { 15: [1, 83] }, { 17: 84, 20: [1, 85] }, { 15: [2, 14] }, { 24: [1, 86] }, o($VS, [2, 20], { 53: 32, 39: 58, 40: 70, 42: 71, 30: 87, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }), o($VS, [2, 21]), o($VT, [2, 23], { 15: [1, 88] }), o($VS, [2, 43], { 15: [1, 89] }), o($VU, [2, 26]), o($VU, [2, 27]), { 35: [1, 90] }, { 37: [1, 91] }, o($VU, [2, 30]), { 45: 92, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 98, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 99, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 100, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 101, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 102, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 103, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 104, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 105, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 106, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 107, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 108, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 109, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 110, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 111, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 112, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 113, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 114, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 115, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 116, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, o($VZ, [2, 66]), { 45: 117, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 118, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 119, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 120, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 121, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 122, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 123, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 124, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 125, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 126, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 127, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 30: 128, 39: 58, 40: 70, 42: 71, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 53: 32, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }, { 15: [1, 130], 43: [1, 129] }, { 45: 131, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 132, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 133, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 134, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 135, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 136, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 45: 137, 85: 93, 86: $VV, 87: $VW, 89: $VX, 90: $VY }, { 24: [1, 138] }, { 24: [1, 139] }, { 24: [1, 140] }, { 24: [1, 141] }, o($V_, [2, 9]), { 14: 142, 21: $Va }, { 21: [2, 13] }, { 1: [2, 15] }, o($VS, [2, 22]), o($VT, [2, 24], { 31: 31, 29: 143, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf }), o($VS, [2, 44], { 29: 29, 30: 30, 31: 31, 53: 32, 39: 58, 40: 70, 42: 71, 23: 144, 32: $Vb, 33: $Vc, 34: $Vd, 36: $Ve, 38: $Vf, 44: $Vg, 46: $Vh, 47: $Vi, 48: $Vj, 49: $Vk, 50: $Vl, 51: $Vm, 54: $Vn, 55: $Vo, 56: $Vp, 57: $Vq, 58: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 63: $Vw, 64: $Vx, 65: $Vy, 66: $Vz, 67: $VA, 68: $VB, 69: $VC, 70: $VD, 71: $VE, 72: $VF, 73: $VG, 74: $VH, 75: $VI, 76: $VJ, 77: $VK, 78: $VL, 79: $VM, 80: $VN, 81: $VO, 82: $VP, 83: $VQ, 84: $VR }), o($VU, [2, 28]), o($VU, [2, 29]), o($VZ, [2, 46]), o($V$, [2, 78], { 85: 93, 45: 145, 86: $VV, 87: $VW, 89: $VX, 90: $VY }), o($V01, [2, 80]), { 88: [1, 146] }, o($V01, [2, 82]), o($V01, [2, 83]), o($VZ, [2, 47]), o($VZ, [2, 48]), o($VZ, [2, 49]), o($VZ, [2, 50]), o($VZ, [2, 51]), o($VZ, [2, 52]), o($VZ, [2, 53]), o($VZ, [2, 54]), o($VZ, [2, 55]), o($VZ, [2, 56]), o($VZ, [2, 57]), o($VZ, [2, 58]), o($VZ, [2, 59]), o($VZ, [2, 60]), o($VZ, [2, 61]), o($VZ, [2, 62]), o($VZ, [2, 63]), o($VZ, [2, 64]), o($VZ, [2, 65]), o($VZ, [2, 67]), o($VZ, [2, 68]), o($VZ, [2, 69]), o($VZ, [2, 70]), o($VZ, [2, 71]), o($VZ, [2, 72]), o($VZ, [2, 73]), o($VZ, [2, 74]), o($VZ, [2, 75]), o($VZ, [2, 76]), o($VZ, [2, 77]), { 41: 147, 52: [1, 148] }, { 15: [1, 149] }, { 43: [1, 150] }, o($V11, [2, 35]), o($V11, [2, 36]), o($V11, [2, 37]), o($V11, [2, 38]), o($V11, [2, 39]), o($V11, [2, 40]), o($V11, [2, 41]), { 1: [2, 16] }, { 1: [2, 17] }, { 1: [2, 18] }, { 1: [2, 19] }, { 15: [1, 151] }, o($VT, [2, 25]), o($VS, [2, 45]), o($V$, [2, 79]), o($V01, [2, 81]), o($VZ, [2, 31]), o($VZ, [2, 42]), o($V21, [2, 32]), o($V21, [2, 33], { 15: [1, 152] }), o($V_, [2, 10]), o($V21, [2, 34])], + defaultActions: { 2: [2, 1], 3: [2, 2], 5: [2, 8], 6: [2, 4], 7: [2, 5], 8: [2, 6], 9: [2, 7], 16: [2, 11], 17: [2, 3], 27: [2, 14], 85: [2, 13], 86: [2, 15], 138: [2, 16], 139: [2, 17], 140: [2, 18], 141: [2, 19] }, + parseError: function parseError(str, hash) { + if (hash.recoverable) { + this.trace(str); + } else { + var error = new Error(str); + error.hash = hash; + throw error; + } + }, + parse: function parse(input) { + var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k)) { + sharedState.yy[k] = this.yy[k]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function lex() { + var token; + token = tstack.pop() || lexer2.lex() || EOF; + if (typeof token !== "number") { + if (token instanceof Array) { + tstack = token; + token = tstack.pop(); + } + token = self.symbols_[token] || token; + } + return token; + } + var symbol, state, action, r, yyval = {}, p, len, newState, expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state] && table[state][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push("'" + this.terminals_[p] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r !== "undefined") { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; + } + }; + var lexer = function() { + var lexer2 = { + EOF: 1, + parseError: function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); + } + }, + // resets the lexer, sets new input + setInput: function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + 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 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, + // consumes and returns one char from the input + input: function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, + // unshifts one char (or a string) into the input + unput: function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = 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); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, + // When called from action, caches matched text and appends it on next action + more: function() { + this._more = true; + return this; + }, + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } 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).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, + // retain first n characters of the match + less: function(n) { + this.unput(this.match.slice(n)); + }, + // displays already matched input, i.e. for error messages + pastInput: function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, + // displays upcoming input, i.e. for error messages + upcomingInput: function() { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20 - next.length); + } + return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: function() { + var pre = this.pastInput(); + var c2 = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c2 + "^"; + }, + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: function(match, indexed_rule) { + var token, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + 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 + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length + }; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token) { + return token; + } else if (this._backtrack) { + for (var k in backup) { + this[k] = backup[k]; + } + return false; + } + return false; + }, + // return next match in input + next: function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token, match, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rules[i]); + if (token !== false) { + return token; + } else if (this._backtrack) { + match = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match) { + token = this.test_match(match, rules[index]); + if (token !== false) { + return token; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, + // return next match that has a token + lex: function lex() { + var r = this.next(); + if (r) { + return r; + } else { + return this.lex(); + } + }, + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: function begin(condition) { + this.conditionStack.push(condition); + }, + // pop the previously active lexer condition state off the condition stack + popState: function popState() { + var n = this.conditionStack.length - 1; + if (n > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: function topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + if (n >= 0) { + return this.conditionStack[n]; + } else { + return "INITIAL"; + } + }, + // alias for begin(condition) + pushState: function pushState(condition) { + this.begin(condition); + }, + // return the number of states currently on the stack + stateStackSize: function stateStackSize() { + return this.conditionStack.length; + }, + options: {}, + performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + switch ($avoiding_name_collisions) { + case 0: + this.begin("open_directive"); + return 18; + case 1: + return 7; + case 2: + return 8; + case 3: + return 9; + case 4: + return 10; + case 5: + this.begin("type_directive"); + return 19; + case 6: + this.popState(); + this.begin("arg_directive"); + return 16; + case 7: + this.popState(); + this.popState(); + return 21; + case 8: + return 20; + case 9: + return 32; + case 10: + return 33; + case 11: + this.begin("acc_title"); + return 34; + case 12: + this.popState(); + return "acc_title_value"; + case 13: + this.begin("acc_descr"); + return 36; + case 14: + this.popState(); + return "acc_descr_value"; + case 15: + this.begin("acc_descr_multiline"); + break; + case 16: + this.popState(); + break; + case 17: + return "acc_descr_multiline_value"; + case 18: + break; + case 19: + c; + break; + case 20: + return 15; + case 21: + break; + case 22: + return 22; + case 23: + return 25; + case 24: + return 26; + case 25: + return 27; + case 26: + return 28; + case 27: + this.begin("person_ext"); + return 55; + case 28: + this.begin("person"); + return 54; + case 29: + this.begin("system_ext_queue"); + return 61; + case 30: + this.begin("system_ext_db"); + return 60; + case 31: + this.begin("system_ext"); + return 59; + case 32: + this.begin("system_queue"); + return 58; + case 33: + this.begin("system_db"); + return 57; + case 34: + this.begin("system"); + return 56; + case 35: + this.begin("boundary"); + return 47; + case 36: + this.begin("enterprise_boundary"); + return 44; + case 37: + this.begin("system_boundary"); + return 46; + case 38: + this.begin("container_ext_queue"); + return 67; + case 39: + this.begin("container_ext_db"); + return 66; + case 40: + this.begin("container_ext"); + return 65; + case 41: + this.begin("container_queue"); + return 64; + case 42: + this.begin("container_db"); + return 63; + case 43: + this.begin("container"); + return 62; + case 44: + this.begin("container_boundary"); + return 48; + case 45: + this.begin("component_ext_queue"); + return 73; + case 46: + this.begin("component_ext_db"); + return 72; + case 47: + this.begin("component_ext"); + return 71; + case 48: + this.begin("component_queue"); + return 70; + case 49: + this.begin("component_db"); + return 69; + case 50: + this.begin("component"); + return 68; + case 51: + this.begin("node"); + return 49; + case 52: + this.begin("node"); + return 49; + case 53: + this.begin("node_l"); + return 50; + case 54: + this.begin("node_r"); + return 51; + case 55: + this.begin("rel"); + return 74; + case 56: + this.begin("birel"); + return 75; + case 57: + this.begin("rel_u"); + return 76; + case 58: + this.begin("rel_u"); + return 76; + case 59: + this.begin("rel_d"); + return 77; + case 60: + this.begin("rel_d"); + return 77; + case 61: + this.begin("rel_l"); + return 78; + case 62: + this.begin("rel_l"); + return 78; + case 63: + this.begin("rel_r"); + return 79; + case 64: + this.begin("rel_r"); + return 79; + case 65: + this.begin("rel_b"); + return 80; + case 66: + this.begin("rel_index"); + return 81; + case 67: + this.begin("update_el_style"); + return 82; + case 68: + this.begin("update_rel_style"); + return 83; + case 69: + this.begin("update_layout_config"); + return 84; + case 70: + return "EOF_IN_STRUCT"; + case 71: + this.begin("attribute"); + return "ATTRIBUTE_EMPTY"; + case 72: + this.begin("attribute"); + break; + case 73: + this.popState(); + this.popState(); + break; + case 74: + return 90; + case 75: + break; + case 76: + return 90; + case 77: + this.begin("string"); + break; + case 78: + this.popState(); + break; + case 79: + return "STR"; + case 80: + this.begin("string_kv"); + break; + case 81: + this.begin("string_kv_key"); + return "STR_KEY"; + case 82: + this.popState(); + this.begin("string_kv_value"); + break; + case 83: + return "STR_VALUE"; + case 84: + this.popState(); + this.popState(); + break; + case 85: + return "STR"; + case 86: + return "LBRACE"; + case 87: + return "RBRACE"; + case 88: + return "SPACE"; + case 89: + return "EOL"; + case 90: + return 24; + } + }, + rules: [/^(?:%%\{)/, /^(?:.*direction\s+TB[^\n]*)/, /^(?:.*direction\s+BT[^\n]*)/, /^(?:.*direction\s+RL[^\n]*)/, /^(?:.*direction\s+LR[^\n]*)/, /^(?:((?:(?!\}%%)[^:.])*))/, /^(?::)/, /^(?:\}%%)/, /^(?:((?:(?!\}%%).|\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": [16, 17], "inclusive": false }, "acc_descr": { "rules": [14], "inclusive": false }, "acc_title": { "rules": [12], "inclusive": false }, "close_directive": { "rules": [], "inclusive": false }, "arg_directive": { "rules": [7, 8], "inclusive": false }, "type_directive": { "rules": [6, 7], "inclusive": false }, "open_directive": { "rules": [5], "inclusive": false }, "string_kv_value": { "rules": [83, 84], "inclusive": false }, "string_kv_key": { "rules": [82], "inclusive": false }, "string_kv": { "rules": [81], "inclusive": false }, "string": { "rules": [78, 79], "inclusive": false }, "attribute": { "rules": [73, 74, 75, 76, 77, 80, 85], "inclusive": false }, "update_layout_config": { "rules": [70, 71, 72, 73], "inclusive": false }, "update_rel_style": { "rules": [70, 71, 72, 73], "inclusive": false }, "update_el_style": { "rules": [70, 71, 72, 73], "inclusive": false }, "rel_b": { "rules": [70, 71, 72, 73], "inclusive": false }, "rel_r": { "rules": [70, 71, 72, 73], "inclusive": false }, "rel_l": { "rules": [70, 71, 72, 73], "inclusive": false }, "rel_d": { "rules": [70, 71, 72, 73], "inclusive": false }, "rel_u": { "rules": [70, 71, 72, 73], "inclusive": false }, "rel_bi": { "rules": [], "inclusive": false }, "rel": { "rules": [70, 71, 72, 73], "inclusive": false }, "node_r": { "rules": [70, 71, 72, 73], "inclusive": false }, "node_l": { "rules": [70, 71, 72, 73], "inclusive": false }, "node": { "rules": [70, 71, 72, 73], "inclusive": false }, "index": { "rules": [], "inclusive": false }, "rel_index": { "rules": [70, 71, 72, 73], "inclusive": false }, "component_ext_queue": { "rules": [], "inclusive": false }, "component_ext_db": { "rules": [70, 71, 72, 73], "inclusive": false }, "component_ext": { "rules": [70, 71, 72, 73], "inclusive": false }, "component_queue": { "rules": [70, 71, 72, 73], "inclusive": false }, "component_db": { "rules": [70, 71, 72, 73], "inclusive": false }, "component": { "rules": [70, 71, 72, 73], "inclusive": false }, "container_boundary": { "rules": [70, 71, 72, 73], "inclusive": false }, "container_ext_queue": { "rules": [], "inclusive": false }, "container_ext_db": { "rules": [70, 71, 72, 73], "inclusive": false }, "container_ext": { "rules": [70, 71, 72, 73], "inclusive": false }, "container_queue": { "rules": [70, 71, 72, 73], "inclusive": false }, "container_db": { "rules": [70, 71, 72, 73], "inclusive": false }, "container": { "rules": [70, 71, 72, 73], "inclusive": false }, "birel": { "rules": [70, 71, 72, 73], "inclusive": false }, "system_boundary": { "rules": [70, 71, 72, 73], "inclusive": false }, "enterprise_boundary": { "rules": [70, 71, 72, 73], "inclusive": false }, "boundary": { "rules": [70, 71, 72, 73], "inclusive": false }, "system_ext_queue": { "rules": [70, 71, 72, 73], "inclusive": false }, "system_ext_db": { "rules": [70, 71, 72, 73], "inclusive": false }, "system_ext": { "rules": [70, 71, 72, 73], "inclusive": false }, "system_queue": { "rules": [70, 71, 72, 73], "inclusive": false }, "system_db": { "rules": [70, 71, 72, 73], "inclusive": false }, "system": { "rules": [70, 71, 72, 73], "inclusive": false }, "person_ext": { "rules": [70, 71, 72, 73], "inclusive": false }, "person": { "rules": [70, 71, 72, 73], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 9, 10, 11, 13, 15, 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, 65, 66, 67, 68, 69, 86, 87, 88, 89, 90], "inclusive": true } } + }; + return lexer2; + }(); + parser2.lexer = lexer; + function Parser() { + this.yy = {}; + } + Parser.prototype = parser2; + parser2.Parser = Parser; + return new Parser(); +}(); +parser.parser = parser; +const c4Parser = parser; +let c4ShapeArray = []; +let boundaryParseStack = [""]; +let currentBoundaryParse = "global"; +let parentBoundaryParse = ""; +let boundarys = [ + { + alias: "global", + label: { text: "global" }, + type: { text: "global" }, + tags: null, + link: null, + parentBoundary: "" + } +]; +let rels = []; +let title = ""; +let wrapEnabled = false; +let c4ShapeInRow$1 = 4; +let c4BoundaryInRow$1 = 2; +var c4Type; +const getC4Type = function() { + return c4Type; +}; +const setC4Type = function(c4TypeParam) { + let sanitizedText = sanitizeText(c4TypeParam, getConfig()); + c4Type = sanitizedText; +}; +const parseDirective = function(statement, context, type) { + mermaidAPI.parseDirective(this, statement, context, type); +}; +const addRel = function(type, from, to, label, techn, descr, sprite, tags, link) { + if (type === void 0 || type === null || from === void 0 || from === null || to === void 0 || to === null || label === void 0 || label === null) { + return; + } + let rel = {}; + const old = rels.find((rel2) => rel2.from === from && rel2.to === to); + if (old) { + rel = old; + } else { + rels.push(rel); + } + rel.type = type; + rel.from = from; + rel.to = to; + rel.label = { text: label }; + if (techn === void 0 || techn === null) { + rel.techn = { text: "" }; + } else { + if (typeof techn === "object") { + let [key, value] = Object.entries(techn)[0]; + rel[key] = { text: value }; + } else { + rel.techn = { text: techn }; + } + } + if (descr === void 0 || descr === null) { + rel.descr = { text: "" }; + } else { + if (typeof descr === "object") { + let [key, value] = Object.entries(descr)[0]; + rel[key] = { text: value }; + } else { + rel.descr = { text: descr }; + } + } + if (typeof sprite === "object") { + let [key, value] = Object.entries(sprite)[0]; + rel[key] = value; + } else { + rel.sprite = sprite; + } + if (typeof tags === "object") { + let [key, value] = Object.entries(tags)[0]; + rel[key] = value; + } else { + rel.tags = tags; + } + if (typeof link === "object") { + let [key, value] = Object.entries(link)[0]; + rel[key] = value; + } else { + rel.link = link; + } + rel.wrap = autoWrap(); +}; +const addPersonOrSystem = function(typeC4Shape, alias, label, descr, sprite, tags, link) { + if (alias === null || label === null) { + return; + } + let personOrSystem = {}; + const old = c4ShapeArray.find((personOrSystem2) => personOrSystem2.alias === alias); + if (old && alias === old.alias) { + personOrSystem = old; + } else { + personOrSystem.alias = alias; + c4ShapeArray.push(personOrSystem); + } + if (label === void 0 || label === null) { + personOrSystem.label = { text: "" }; + } else { + personOrSystem.label = { text: label }; + } + if (descr === void 0 || descr === null) { + personOrSystem.descr = { text: "" }; + } else { + if (typeof descr === "object") { + let [key, value] = Object.entries(descr)[0]; + personOrSystem[key] = { text: value }; + } else { + personOrSystem.descr = { text: descr }; + } + } + if (typeof sprite === "object") { + let [key, value] = Object.entries(sprite)[0]; + personOrSystem[key] = value; + } else { + personOrSystem.sprite = sprite; + } + if (typeof tags === "object") { + let [key, value] = Object.entries(tags)[0]; + personOrSystem[key] = value; + } else { + personOrSystem.tags = tags; + } + if (typeof link === "object") { + let [key, value] = Object.entries(link)[0]; + personOrSystem[key] = value; + } else { + personOrSystem.link = link; + } + personOrSystem.typeC4Shape = { text: typeC4Shape }; + personOrSystem.parentBoundary = currentBoundaryParse; + personOrSystem.wrap = autoWrap(); +}; +const addContainer = function(typeC4Shape, alias, label, techn, descr, sprite, tags, link) { + if (alias === null || label === null) { + return; + } + let container = {}; + const old = c4ShapeArray.find((container2) => container2.alias === alias); + if (old && alias === old.alias) { + container = old; + } else { + container.alias = alias; + c4ShapeArray.push(container); + } + if (label === void 0 || label === null) { + container.label = { text: "" }; + } else { + container.label = { text: label }; + } + if (techn === void 0 || techn === null) { + container.techn = { text: "" }; + } else { + if (typeof techn === "object") { + let [key, value] = Object.entries(techn)[0]; + container[key] = { text: value }; + } else { + container.techn = { text: techn }; + } + } + if (descr === void 0 || descr === null) { + container.descr = { text: "" }; + } else { + if (typeof descr === "object") { + let [key, value] = Object.entries(descr)[0]; + container[key] = { text: value }; + } else { + container.descr = { text: descr }; + } + } + if (typeof sprite === "object") { + let [key, value] = Object.entries(sprite)[0]; + container[key] = value; + } else { + container.sprite = sprite; + } + if (typeof tags === "object") { + let [key, value] = Object.entries(tags)[0]; + container[key] = value; + } else { + container.tags = tags; + } + if (typeof link === "object") { + let [key, value] = Object.entries(link)[0]; + container[key] = value; + } else { + container.link = link; + } + container.wrap = autoWrap(); + container.typeC4Shape = { text: typeC4Shape }; + container.parentBoundary = currentBoundaryParse; +}; +const addComponent = function(typeC4Shape, alias, label, techn, descr, sprite, tags, link) { + if (alias === null || label === null) { + return; + } + let component = {}; + const old = c4ShapeArray.find((component2) => component2.alias === alias); + if (old && alias === old.alias) { + component = old; + } else { + component.alias = alias; + c4ShapeArray.push(component); + } + if (label === void 0 || label === null) { + component.label = { text: "" }; + } else { + component.label = { text: label }; + } + if (techn === void 0 || techn === null) { + component.techn = { text: "" }; + } else { + if (typeof techn === "object") { + let [key, value] = Object.entries(techn)[0]; + component[key] = { text: value }; + } else { + component.techn = { text: techn }; + } + } + if (descr === void 0 || descr === null) { + component.descr = { text: "" }; + } else { + if (typeof descr === "object") { + let [key, value] = Object.entries(descr)[0]; + component[key] = { text: value }; + } else { + component.descr = { text: descr }; + } + } + if (typeof sprite === "object") { + let [key, value] = Object.entries(sprite)[0]; + component[key] = value; + } else { + component.sprite = sprite; + } + if (typeof tags === "object") { + let [key, value] = Object.entries(tags)[0]; + component[key] = value; + } else { + component.tags = tags; + } + if (typeof link === "object") { + let [key, value] = Object.entries(link)[0]; + component[key] = value; + } else { + component.link = link; + } + component.wrap = autoWrap(); + component.typeC4Shape = { text: typeC4Shape }; + component.parentBoundary = currentBoundaryParse; +}; +const addPersonOrSystemBoundary = function(alias, label, type, tags, link) { + if (alias === null || label === null) { + return; + } + let boundary = {}; + const old = boundarys.find((boundary2) => boundary2.alias === alias); + if (old && alias === old.alias) { + boundary = old; + } else { + boundary.alias = alias; + boundarys.push(boundary); + } + if (label === void 0 || label === null) { + boundary.label = { text: "" }; + } else { + boundary.label = { text: label }; + } + if (type === void 0 || type === null) { + boundary.type = { text: "system" }; + } else { + if (typeof type === "object") { + let [key, value] = Object.entries(type)[0]; + boundary[key] = { text: value }; + } else { + boundary.type = { text: type }; + } + } + if (typeof tags === "object") { + let [key, value] = Object.entries(tags)[0]; + boundary[key] = value; + } else { + boundary.tags = tags; + } + if (typeof link === "object") { + let [key, value] = Object.entries(link)[0]; + boundary[key] = value; + } else { + boundary.link = link; + } + boundary.parentBoundary = currentBoundaryParse; + boundary.wrap = autoWrap(); + parentBoundaryParse = currentBoundaryParse; + currentBoundaryParse = alias; + boundaryParseStack.push(parentBoundaryParse); +}; +const addContainerBoundary = function(alias, label, type, tags, link) { + if (alias === null || label === null) { + return; + } + let boundary = {}; + const old = boundarys.find((boundary2) => boundary2.alias === alias); + if (old && alias === old.alias) { + boundary = old; + } else { + boundary.alias = alias; + boundarys.push(boundary); + } + if (label === void 0 || label === null) { + boundary.label = { text: "" }; + } else { + boundary.label = { text: label }; + } + if (type === void 0 || type === null) { + boundary.type = { text: "container" }; + } else { + if (typeof type === "object") { + let [key, value] = Object.entries(type)[0]; + boundary[key] = { text: value }; + } else { + boundary.type = { text: type }; + } + } + if (typeof tags === "object") { + let [key, value] = Object.entries(tags)[0]; + boundary[key] = value; + } else { + boundary.tags = tags; + } + if (typeof link === "object") { + let [key, value] = Object.entries(link)[0]; + boundary[key] = value; + } else { + boundary.link = link; + } + boundary.parentBoundary = currentBoundaryParse; + boundary.wrap = autoWrap(); + parentBoundaryParse = currentBoundaryParse; + currentBoundaryParse = alias; + boundaryParseStack.push(parentBoundaryParse); +}; +const addDeploymentNode = function(nodeType, alias, label, type, descr, sprite, tags, link) { + if (alias === null || label === null) { + return; + } + let boundary = {}; + const old = boundarys.find((boundary2) => boundary2.alias === alias); + if (old && alias === old.alias) { + boundary = old; + } else { + boundary.alias = alias; + boundarys.push(boundary); + } + if (label === void 0 || label === null) { + boundary.label = { text: "" }; + } else { + boundary.label = { text: label }; + } + if (type === void 0 || type === null) { + boundary.type = { text: "node" }; + } else { + if (typeof type === "object") { + let [key, value] = Object.entries(type)[0]; + boundary[key] = { text: value }; + } else { + boundary.type = { text: type }; + } + } + if (descr === void 0 || descr === null) { + boundary.descr = { text: "" }; + } else { + if (typeof descr === "object") { + let [key, value] = Object.entries(descr)[0]; + boundary[key] = { text: value }; + } else { + boundary.descr = { text: descr }; + } + } + if (typeof tags === "object") { + let [key, value] = Object.entries(tags)[0]; + boundary[key] = value; + } else { + boundary.tags = tags; + } + if (typeof link === "object") { + let [key, value] = Object.entries(link)[0]; + boundary[key] = value; + } else { + boundary.link = link; + } + boundary.nodeType = nodeType; + boundary.parentBoundary = currentBoundaryParse; + boundary.wrap = autoWrap(); + parentBoundaryParse = currentBoundaryParse; + currentBoundaryParse = alias; + boundaryParseStack.push(parentBoundaryParse); +}; +const popBoundaryParseStack = function() { + currentBoundaryParse = parentBoundaryParse; + boundaryParseStack.pop(); + parentBoundaryParse = boundaryParseStack.pop(); + boundaryParseStack.push(parentBoundaryParse); +}; +const updateElStyle = function(typeC4Shape, elementName, bgColor, fontColor, borderColor, shadowing, shape, sprite, techn, legendText, legendSprite) { + let old = c4ShapeArray.find((element) => element.alias === elementName); + if (old === void 0) { + old = boundarys.find((element) => element.alias === elementName); + if (old === void 0) { + return; + } + } + if (bgColor !== void 0 && bgColor !== null) { + if (typeof bgColor === "object") { + let [key, value] = Object.entries(bgColor)[0]; + old[key] = value; + } else { + old.bgColor = bgColor; + } + } + if (fontColor !== void 0 && fontColor !== null) { + if (typeof fontColor === "object") { + let [key, value] = Object.entries(fontColor)[0]; + old[key] = value; + } else { + old.fontColor = fontColor; + } + } + if (borderColor !== void 0 && borderColor !== null) { + if (typeof borderColor === "object") { + let [key, value] = Object.entries(borderColor)[0]; + old[key] = value; + } else { + old.borderColor = borderColor; + } + } + if (shadowing !== void 0 && shadowing !== null) { + if (typeof shadowing === "object") { + let [key, value] = Object.entries(shadowing)[0]; + old[key] = value; + } else { + old.shadowing = shadowing; + } + } + if (shape !== void 0 && shape !== null) { + if (typeof shape === "object") { + let [key, value] = Object.entries(shape)[0]; + old[key] = value; + } else { + old.shape = shape; + } + } + if (sprite !== void 0 && sprite !== null) { + if (typeof sprite === "object") { + let [key, value] = Object.entries(sprite)[0]; + old[key] = value; + } else { + old.sprite = sprite; + } + } + if (techn !== void 0 && techn !== null) { + if (typeof techn === "object") { + let [key, value] = Object.entries(techn)[0]; + old[key] = value; + } else { + old.techn = techn; + } + } + if (legendText !== void 0 && legendText !== null) { + if (typeof legendText === "object") { + let [key, value] = Object.entries(legendText)[0]; + old[key] = value; + } else { + old.legendText = legendText; + } + } + if (legendSprite !== void 0 && legendSprite !== null) { + if (typeof legendSprite === "object") { + let [key, value] = Object.entries(legendSprite)[0]; + old[key] = value; + } else { + old.legendSprite = legendSprite; + } + } +}; +const updateRelStyle = function(typeC4Shape, from, to, textColor, lineColor, offsetX, offsetY) { + const old = rels.find((rel) => rel.from === from && rel.to === to); + if (old === void 0) { + return; + } + if (textColor !== void 0 && textColor !== null) { + if (typeof textColor === "object") { + let [key, value] = Object.entries(textColor)[0]; + old[key] = value; + } else { + old.textColor = textColor; + } + } + if (lineColor !== void 0 && lineColor !== null) { + if (typeof lineColor === "object") { + let [key, value] = Object.entries(lineColor)[0]; + old[key] = value; + } else { + old.lineColor = lineColor; + } + } + if (offsetX !== void 0 && offsetX !== null) { + if (typeof offsetX === "object") { + let [key, value] = Object.entries(offsetX)[0]; + old[key] = parseInt(value); + } else { + old.offsetX = parseInt(offsetX); + } + } + if (offsetY !== void 0 && offsetY !== null) { + if (typeof offsetY === "object") { + let [key, value] = Object.entries(offsetY)[0]; + old[key] = parseInt(value); + } else { + old.offsetY = parseInt(offsetY); + } + } +}; +const updateLayoutConfig = function(typeC4Shape, c4ShapeInRowParam, c4BoundaryInRowParam) { + let c4ShapeInRowValue = c4ShapeInRow$1; + let c4BoundaryInRowValue = c4BoundaryInRow$1; + if (typeof c4ShapeInRowParam === "object") { + const value = Object.values(c4ShapeInRowParam)[0]; + c4ShapeInRowValue = parseInt(value); + } else { + c4ShapeInRowValue = parseInt(c4ShapeInRowParam); + } + if (typeof c4BoundaryInRowParam === "object") { + const value = Object.values(c4BoundaryInRowParam)[0]; + c4BoundaryInRowValue = parseInt(value); + } else { + c4BoundaryInRowValue = parseInt(c4BoundaryInRowParam); + } + if (c4ShapeInRowValue >= 1) { + c4ShapeInRow$1 = c4ShapeInRowValue; + } + if (c4BoundaryInRowValue >= 1) { + c4BoundaryInRow$1 = c4BoundaryInRowValue; + } +}; +const getC4ShapeInRow = function() { + return c4ShapeInRow$1; +}; +const getC4BoundaryInRow = function() { + return c4BoundaryInRow$1; +}; +const getCurrentBoundaryParse = function() { + return currentBoundaryParse; +}; +const getParentBoundaryParse = function() { + return parentBoundaryParse; +}; +const getC4ShapeArray = function(parentBoundary) { + if (parentBoundary === void 0 || parentBoundary === null) { + return c4ShapeArray; + } else { + return c4ShapeArray.filter((personOrSystem) => { + return personOrSystem.parentBoundary === parentBoundary; + }); + } +}; +const getC4Shape = function(alias) { + return c4ShapeArray.find((personOrSystem) => personOrSystem.alias === alias); +}; +const getC4ShapeKeys = function(parentBoundary) { + return Object.keys(getC4ShapeArray(parentBoundary)); +}; +const getBoundarys = function(parentBoundary) { + if (parentBoundary === void 0 || parentBoundary === null) { + return boundarys; + } else { + return boundarys.filter((boundary) => boundary.parentBoundary === parentBoundary); + } +}; +const getRels = function() { + return rels; +}; +const getTitle = function() { + return title; +}; +const setWrap = function(wrapSetting) { + wrapEnabled = wrapSetting; +}; +const autoWrap = function() { + return wrapEnabled; +}; +const clear = function() { + c4ShapeArray = []; + boundarys = [ + { + alias: "global", + label: { text: "global" }, + type: { text: "global" }, + tags: null, + link: null, + parentBoundary: "" + } + ]; + parentBoundaryParse = ""; + currentBoundaryParse = "global"; + boundaryParseStack = [""]; + rels = []; + boundaryParseStack = [""]; + title = ""; + wrapEnabled = false; + c4ShapeInRow$1 = 4; + c4BoundaryInRow$1 = 2; +}; +const LINETYPE = { + 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 +}; +const ARROWTYPE = { + FILLED: 0, + OPEN: 1 +}; +const PLACEMENT = { + LEFTOF: 0, + RIGHTOF: 1, + OVER: 2 +}; +const setTitle = function(txt) { + let sanitizedText = sanitizeText(txt, getConfig()); + title = sanitizedText; +}; +const c4Db = { + addPersonOrSystem, + addPersonOrSystemBoundary, + addContainer, + addContainerBoundary, + addComponent, + addDeploymentNode, + popBoundaryParseStack, + addRel, + updateElStyle, + updateRelStyle, + updateLayoutConfig, + autoWrap, + setWrap, + getC4ShapeArray, + getC4Shape, + getC4ShapeKeys, + getBoundarys, + getCurrentBoundaryParse, + getParentBoundaryParse, + getRels, + getTitle, + getC4Type, + getC4ShapeInRow, + getC4BoundaryInRow, + setAccTitle, + getAccTitle, + getAccDescription, + setAccDescription, + parseDirective, + getConfig: () => getConfig().c4, + clear, + LINETYPE, + ARROWTYPE, + PLACEMENT, + setTitle, + setC4Type + // apply, +}; +const drawRect = function(elem, rectData) { + const rectElem = elem.append("rect"); + rectElem.attr("x", rectData.x); + rectElem.attr("y", rectData.y); + rectElem.attr("fill", rectData.fill); + rectElem.attr("stroke", rectData.stroke); + rectElem.attr("width", rectData.width); + rectElem.attr("height", rectData.height); + rectElem.attr("rx", rectData.rx); + rectElem.attr("ry", rectData.ry); + if (rectData.attrs !== "undefined" && rectData.attrs !== null) { + for (let attrKey in rectData.attrs) { + rectElem.attr(attrKey, rectData.attrs[attrKey]); + } + } + if (rectData.class !== "undefined") { + rectElem.attr("class", rectData.class); + } + return rectElem; +}; +const drawImage = function(elem, width, height, x, y, link) { + const imageElem = elem.append("image"); + imageElem.attr("width", width); + imageElem.attr("height", height); + imageElem.attr("x", x); + imageElem.attr("y", y); + let sanitizedLink = link.startsWith("data:image/png;base64") ? link : sanitizeUrl_1(link); + imageElem.attr("xlink:href", sanitizedLink); +}; +const drawRels$1 = (elem, rels2, conf2) => { + const relsElem = elem.append("g"); + let i = 0; + for (let rel of rels2) { + let textColor = rel.textColor ? rel.textColor : "#444444"; + let strokeColor = rel.lineColor ? rel.lineColor : "#444444"; + let offsetX = rel.offsetX ? parseInt(rel.offsetX) : 0; + let offsetY = rel.offsetY ? parseInt(rel.offsetY) : 0; + let url = ""; + if (i === 0) { + let line = relsElem.append("line"); + line.attr("x1", rel.startPoint.x); + line.attr("y1", rel.startPoint.y); + line.attr("x2", rel.endPoint.x); + line.attr("y2", rel.endPoint.y); + line.attr("stroke-width", "1"); + line.attr("stroke", strokeColor); + line.style("fill", "none"); + if (rel.type !== "rel_b") { + line.attr("marker-end", "url(" + url + "#arrowhead)"); + } + if (rel.type === "birel" || rel.type === "rel_b") { + line.attr("marker-start", "url(" + url + "#arrowend)"); + } + i = -1; + } else { + let line = relsElem.append("path"); + line.attr("fill", "none").attr("stroke-width", "1").attr("stroke", strokeColor).attr( + "d", + "Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx", rel.startPoint.x).replaceAll("starty", rel.startPoint.y).replaceAll( + "controlx", + rel.startPoint.x + (rel.endPoint.x - rel.startPoint.x) / 2 - (rel.endPoint.x - rel.startPoint.x) / 4 + ).replaceAll("controly", rel.startPoint.y + (rel.endPoint.y - rel.startPoint.y) / 2).replaceAll("stopx", rel.endPoint.x).replaceAll("stopy", rel.endPoint.y) + ); + if (rel.type !== "rel_b") { + line.attr("marker-end", "url(" + url + "#arrowhead)"); + } + if (rel.type === "birel" || rel.type === "rel_b") { + line.attr("marker-start", "url(" + url + "#arrowend)"); + } + } + let messageConf = conf2.messageFont(); + _drawTextCandidateFunc(conf2)( + rel.label.text, + relsElem, + Math.min(rel.startPoint.x, rel.endPoint.x) + Math.abs(rel.endPoint.x - rel.startPoint.x) / 2 + offsetX, + Math.min(rel.startPoint.y, rel.endPoint.y) + Math.abs(rel.endPoint.y - rel.startPoint.y) / 2 + offsetY, + rel.label.width, + rel.label.height, + { fill: textColor }, + messageConf + ); + if (rel.techn && rel.techn.text !== "") { + messageConf = conf2.messageFont(); + _drawTextCandidateFunc(conf2)( + "[" + rel.techn.text + "]", + relsElem, + Math.min(rel.startPoint.x, rel.endPoint.x) + Math.abs(rel.endPoint.x - rel.startPoint.x) / 2 + offsetX, + Math.min(rel.startPoint.y, rel.endPoint.y) + Math.abs(rel.endPoint.y - rel.startPoint.y) / 2 + conf2.messageFontSize + 5 + offsetY, + Math.max(rel.label.width, rel.techn.width), + rel.techn.height, + { fill: textColor, "font-style": "italic" }, + messageConf + ); + } + } +}; +const drawBoundary$1 = function(elem, boundary, conf2) { + const boundaryElem = elem.append("g"); + let fillColor = boundary.bgColor ? boundary.bgColor : "none"; + let strokeColor = boundary.borderColor ? boundary.borderColor : "#444444"; + let fontColor = boundary.fontColor ? boundary.fontColor : "black"; + let attrsValue = { "stroke-width": 1, "stroke-dasharray": "7.0,7.0" }; + if (boundary.nodeType) { + attrsValue = { "stroke-width": 1 }; + } + let rectData = { + x: boundary.x, + y: boundary.y, + fill: fillColor, + stroke: strokeColor, + width: boundary.width, + height: boundary.height, + rx: 2.5, + ry: 2.5, + attrs: attrsValue + }; + drawRect(boundaryElem, rectData); + let boundaryConf = conf2.boundaryFont(); + boundaryConf.fontWeight = "bold"; + boundaryConf.fontSize = boundaryConf.fontSize + 2; + boundaryConf.fontColor = fontColor; + _drawTextCandidateFunc(conf2)( + boundary.label.text, + boundaryElem, + boundary.x, + boundary.y + boundary.label.Y, + boundary.width, + boundary.height, + { fill: "#444444" }, + boundaryConf + ); + if (boundary.type && boundary.type.text !== "") { + boundaryConf = conf2.boundaryFont(); + boundaryConf.fontColor = fontColor; + _drawTextCandidateFunc(conf2)( + boundary.type.text, + boundaryElem, + boundary.x, + boundary.y + boundary.type.Y, + boundary.width, + boundary.height, + { fill: "#444444" }, + boundaryConf + ); + } + if (boundary.descr && boundary.descr.text !== "") { + boundaryConf = conf2.boundaryFont(); + boundaryConf.fontSize = boundaryConf.fontSize - 2; + boundaryConf.fontColor = fontColor; + _drawTextCandidateFunc(conf2)( + boundary.descr.text, + boundaryElem, + boundary.x, + boundary.y + boundary.descr.Y, + boundary.width, + boundary.height, + { fill: "#444444" }, + boundaryConf + ); + } +}; +const drawC4Shape = function(elem, c4Shape, conf2) { + var _a; + let fillColor = c4Shape.bgColor ? c4Shape.bgColor : conf2[c4Shape.typeC4Shape.text + "_bg_color"]; + let strokeColor = c4Shape.borderColor ? c4Shape.borderColor : conf2[c4Shape.typeC4Shape.text + "_border_color"]; + let fontColor = c4Shape.fontColor ? c4Shape.fontColor : "#FFFFFF"; + let personImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII="; + switch (c4Shape.typeC4Shape.text) { + case "person": + personImg = "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": + personImg = "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 c4ShapeElem = elem.append("g"); + c4ShapeElem.attr("class", "person-man"); + const rect = getNoteRect(); + switch (c4Shape.typeC4Shape.text) { + case "person": + case "external_person": + case "system": + case "external_system": + case "container": + case "external_container": + case "component": + case "external_component": + rect.x = c4Shape.x; + rect.y = c4Shape.y; + rect.fill = fillColor; + rect.width = c4Shape.width; + rect.height = c4Shape.height; + rect.stroke = strokeColor; + rect.rx = 2.5; + rect.ry = 2.5; + rect.attrs = { "stroke-width": 0.5 }; + drawRect(c4ShapeElem, rect); + break; + case "system_db": + case "external_system_db": + case "container_db": + case "external_container_db": + case "component_db": + case "external_component_db": + c4ShapeElem.append("path").attr("fill", fillColor).attr("stroke-width", "0.5").attr("stroke", strokeColor).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", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.width / 2).replaceAll("height", c4Shape.height) + ); + c4ShapeElem.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", strokeColor).attr( + "d", + "Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.width / 2) + ); + break; + case "system_queue": + case "external_system_queue": + case "container_queue": + case "external_container_queue": + case "component_queue": + case "external_component_queue": + c4ShapeElem.append("path").attr("fill", fillColor).attr("stroke-width", "0.5").attr("stroke", strokeColor).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", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("width", c4Shape.width).replaceAll("half", c4Shape.height / 2) + ); + c4ShapeElem.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", strokeColor).attr( + "d", + "Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx", c4Shape.x + c4Shape.width).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.height / 2) + ); + break; + } + let c4ShapeFontConf = getC4ShapeFont(conf2, c4Shape.typeC4Shape.text); + c4ShapeElem.append("text").attr("fill", fontColor).attr("font-family", c4ShapeFontConf.fontFamily).attr("font-size", c4ShapeFontConf.fontSize - 2).attr("font-style", "italic").attr("lengthAdjust", "spacing").attr("textLength", c4Shape.typeC4Shape.width).attr("x", c4Shape.x + c4Shape.width / 2 - c4Shape.typeC4Shape.width / 2).attr("y", c4Shape.y + c4Shape.typeC4Shape.Y).text("<<" + c4Shape.typeC4Shape.text + ">>"); + switch (c4Shape.typeC4Shape.text) { + case "person": + case "external_person": + drawImage( + c4ShapeElem, + 48, + 48, + c4Shape.x + c4Shape.width / 2 - 24, + c4Shape.y + c4Shape.image.Y, + personImg + ); + break; + } + let textFontConf = conf2[c4Shape.typeC4Shape.text + "Font"](); + textFontConf.fontWeight = "bold"; + textFontConf.fontSize = textFontConf.fontSize + 2; + textFontConf.fontColor = fontColor; + _drawTextCandidateFunc(conf2)( + c4Shape.label.text, + c4ShapeElem, + c4Shape.x, + c4Shape.y + c4Shape.label.Y, + c4Shape.width, + c4Shape.height, + { fill: fontColor }, + textFontConf + ); + textFontConf = conf2[c4Shape.typeC4Shape.text + "Font"](); + textFontConf.fontColor = fontColor; + if (c4Shape.techn && ((_a = c4Shape.techn) == null ? void 0 : _a.text) !== "") { + _drawTextCandidateFunc(conf2)( + c4Shape.techn.text, + c4ShapeElem, + c4Shape.x, + c4Shape.y + c4Shape.techn.Y, + c4Shape.width, + c4Shape.height, + { fill: fontColor, "font-style": "italic" }, + textFontConf + ); + } else if (c4Shape.type && c4Shape.type.text !== "") { + _drawTextCandidateFunc(conf2)( + c4Shape.type.text, + c4ShapeElem, + c4Shape.x, + c4Shape.y + c4Shape.type.Y, + c4Shape.width, + c4Shape.height, + { fill: fontColor, "font-style": "italic" }, + textFontConf + ); + } + if (c4Shape.descr && c4Shape.descr.text !== "") { + textFontConf = conf2.personFont(); + textFontConf.fontColor = fontColor; + _drawTextCandidateFunc(conf2)( + c4Shape.descr.text, + c4ShapeElem, + c4Shape.x, + c4Shape.y + c4Shape.descr.Y, + c4Shape.width, + c4Shape.height, + { fill: fontColor }, + textFontConf + ); + } + return c4Shape.height; +}; +const insertDatabaseIcon = function(elem) { + elem.append("defs").append("symbol").attr("id", "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" + ); +}; +const insertComputerIcon = function(elem) { + elem.append("defs").append("symbol").attr("id", "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" + ); +}; +const insertClockIcon = function(elem) { + elem.append("defs").append("symbol").attr("id", "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" + ); +}; +const insertArrowHead = function(elem) { + elem.append("defs").append("marker").attr("id", "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"); +}; +const insertArrowEnd = function(elem) { + elem.append("defs").append("marker").attr("id", "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"); +}; +const insertArrowFilledHead = function(elem) { + elem.append("defs").append("marker").attr("id", "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"); +}; +const insertDynamicNumber = function(elem) { + elem.append("defs").append("marker").attr("id", "sequencenumber").attr("refX", 15).attr("refY", 15).attr("markerWidth", 60).attr("markerHeight", 40).attr("orient", "auto").append("circle").attr("cx", 15).attr("cy", 15).attr("r", 6); +}; +const insertArrowCrossHead = function(elem) { + const defs = elem.append("defs"); + const marker = defs.append("marker").attr("id", "crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 16).attr("refY", 4); + marker.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"); + marker.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"); +}; +const getNoteRect = function() { + return { + x: 0, + y: 0, + fill: "#EDF2AE", + stroke: "#666", + width: 100, + anchor: "start", + height: 100, + rx: 0, + ry: 0 + }; +}; +const getC4ShapeFont = (cnf, typeC4Shape) => { + return { + fontFamily: cnf[typeC4Shape + "FontFamily"], + fontSize: cnf[typeC4Shape + "FontSize"], + fontWeight: cnf[typeC4Shape + "FontWeight"] + }; +}; +const _drawTextCandidateFunc = function() { + function byText(content, g, x, y, width, height, textAttrs) { + const text = g.append("text").attr("x", x + width / 2).attr("y", y + height / 2 + 5).style("text-anchor", "middle").text(content); + _setTextAttrs(text, textAttrs); + } + function byTspan(content, g, x, y, width, height, textAttrs, conf2) { + const { fontSize, fontFamily, fontWeight } = conf2; + const lines = content.split(common.lineBreakRegex); + for (let i = 0; i < lines.length; i++) { + const dy = i * fontSize - fontSize * (lines.length - 1) / 2; + const text = g.append("text").attr("x", x + width / 2).attr("y", y).style("text-anchor", "middle").attr("dominant-baseline", "middle").style("font-size", fontSize).style("font-weight", fontWeight).style("font-family", fontFamily); + text.append("tspan").attr("dy", dy).text(lines[i]).attr("alignment-baseline", "mathematical"); + _setTextAttrs(text, textAttrs); + } + } + function byFo(content, g, x, y, width, height, textAttrs, conf2) { + const s = g.append("switch"); + const f = s.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height); + const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%"); + text.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content); + byTspan(content, s, x, y, width, height, textAttrs, conf2); + _setTextAttrs(text, textAttrs); + } + function _setTextAttrs(toText, fromTextAttrsDict) { + for (const key in fromTextAttrsDict) { + if (fromTextAttrsDict.hasOwnProperty(key)) { + toText.attr(key, fromTextAttrsDict[key]); + } + } + } + return function(conf2) { + return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan; + }; +}(); +const svgDraw = { + drawRect, + drawBoundary: drawBoundary$1, + drawC4Shape, + drawRels: drawRels$1, + drawImage, + insertArrowHead, + insertArrowEnd, + insertArrowFilledHead, + insertDynamicNumber, + insertArrowCrossHead, + insertDatabaseIcon, + insertComputerIcon, + insertClockIcon, + getNoteRect, + sanitizeUrl: sanitizeUrl_1 + // TODO why is this exported? +}; +let globalBoundaryMaxX = 0, globalBoundaryMaxY = 0; +let c4ShapeInRow = 4; +let c4BoundaryInRow = 2; +parser.yy = c4Db; +let conf = {}; +class Bounds { + constructor(diagObj) { + this.name = ""; + this.data = {}; + this.data.startx = void 0; + this.data.stopx = void 0; + this.data.starty = void 0; + this.data.stopy = void 0; + this.data.widthLimit = void 0; + this.nextData = {}; + this.nextData.startx = void 0; + this.nextData.stopx = void 0; + this.nextData.starty = void 0; + this.nextData.stopy = void 0; + this.nextData.cnt = 0; + setConf(diagObj.db.getConfig()); + } + setData(startx, stopx, starty, stopy) { + this.nextData.startx = this.data.startx = startx; + this.nextData.stopx = this.data.stopx = stopx; + this.nextData.starty = this.data.starty = starty; + this.nextData.stopy = this.data.stopy = stopy; + } + updateVal(obj, key, val, fun) { + if (obj[key] === void 0) { + obj[key] = val; + } else { + obj[key] = fun(val, obj[key]); + } + } + insert(c4Shape) { + this.nextData.cnt = this.nextData.cnt + 1; + let _startx = this.nextData.startx === this.nextData.stopx ? this.nextData.stopx + c4Shape.margin : this.nextData.stopx + c4Shape.margin * 2; + let _stopx = _startx + c4Shape.width; + let _starty = this.nextData.starty + c4Shape.margin * 2; + let _stopy = _starty + c4Shape.height; + if (_startx >= this.data.widthLimit || _stopx >= this.data.widthLimit || this.nextData.cnt > c4ShapeInRow) { + _startx = this.nextData.startx + c4Shape.margin + conf.nextLinePaddingX; + _starty = this.nextData.stopy + c4Shape.margin * 2; + this.nextData.stopx = _stopx = _startx + c4Shape.width; + this.nextData.starty = this.nextData.stopy; + this.nextData.stopy = _stopy = _starty + c4Shape.height; + this.nextData.cnt = 1; + } + c4Shape.x = _startx; + c4Shape.y = _starty; + this.updateVal(this.data, "startx", _startx, Math.min); + this.updateVal(this.data, "starty", _starty, Math.min); + this.updateVal(this.data, "stopx", _stopx, Math.max); + this.updateVal(this.data, "stopy", _stopy, Math.max); + this.updateVal(this.nextData, "startx", _startx, Math.min); + this.updateVal(this.nextData, "starty", _starty, Math.min); + this.updateVal(this.nextData, "stopx", _stopx, Math.max); + this.updateVal(this.nextData, "stopy", _stopy, Math.max); + } + init(diagObj) { + 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 + }; + setConf(diagObj.db.getConfig()); + } + bumpLastMargin(margin) { + this.data.stopx += margin; + this.data.stopy += margin; + } +} +const setConf = function(cnf) { + assignWithDepth(conf, cnf); + if (cnf.fontFamily) { + conf.personFontFamily = conf.systemFontFamily = conf.messageFontFamily = cnf.fontFamily; + } + if (cnf.fontSize) { + conf.personFontSize = conf.systemFontSize = conf.messageFontSize = cnf.fontSize; + } + if (cnf.fontWeight) { + conf.personFontWeight = conf.systemFontWeight = conf.messageFontWeight = cnf.fontWeight; + } +}; +const c4ShapeFont = (cnf, typeC4Shape) => { + return { + fontFamily: cnf[typeC4Shape + "FontFamily"], + fontSize: cnf[typeC4Shape + "FontSize"], + fontWeight: cnf[typeC4Shape + "FontWeight"] + }; +}; +const boundaryFont = (cnf) => { + return { + fontFamily: cnf.boundaryFontFamily, + fontSize: cnf.boundaryFontSize, + fontWeight: cnf.boundaryFontWeight + }; +}; +const messageFont = (cnf) => { + return { + fontFamily: cnf.messageFontFamily, + fontSize: cnf.messageFontSize, + fontWeight: cnf.messageFontWeight + }; +}; +function calcC4ShapeTextWH(textType, c4Shape, c4ShapeTextWrap, textConf, textLimitWidth) { + if (!c4Shape[textType].width) { + if (c4ShapeTextWrap) { + c4Shape[textType].text = wrapLabel(c4Shape[textType].text, textLimitWidth, textConf); + c4Shape[textType].textLines = c4Shape[textType].text.split(common.lineBreakRegex).length; + c4Shape[textType].width = textLimitWidth; + c4Shape[textType].height = calculateTextHeight(c4Shape[textType].text, textConf); + } else { + let lines = c4Shape[textType].text.split(common.lineBreakRegex); + c4Shape[textType].textLines = lines.length; + let lineHeight = 0; + c4Shape[textType].height = 0; + c4Shape[textType].width = 0; + for (const line of lines) { + c4Shape[textType].width = Math.max( + calculateTextWidth(line, textConf), + c4Shape[textType].width + ); + lineHeight = calculateTextHeight(line, textConf); + c4Shape[textType].height = c4Shape[textType].height + lineHeight; + } + } + } +} +const drawBoundary = function(diagram2, boundary, bounds) { + boundary.x = bounds.data.startx; + boundary.y = bounds.data.starty; + boundary.width = bounds.data.stopx - bounds.data.startx; + boundary.height = bounds.data.stopy - bounds.data.starty; + boundary.label.y = conf.c4ShapeMargin - 35; + let boundaryTextWrap = boundary.wrap && conf.wrap; + let boundaryLabelConf = boundaryFont(conf); + boundaryLabelConf.fontSize = boundaryLabelConf.fontSize + 2; + boundaryLabelConf.fontWeight = "bold"; + let textLimitWidth = calculateTextWidth(boundary.label.text, boundaryLabelConf); + calcC4ShapeTextWH("label", boundary, boundaryTextWrap, boundaryLabelConf, textLimitWidth); + svgDraw.drawBoundary(diagram2, boundary, conf); +}; +const drawC4ShapeArray = function(currentBounds, diagram2, c4ShapeArray2, c4ShapeKeys) { + let Y = 0; + for (const c4ShapeKey of c4ShapeKeys) { + Y = 0; + const c4Shape = c4ShapeArray2[c4ShapeKey]; + let c4ShapeTypeConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text); + c4ShapeTypeConf.fontSize = c4ShapeTypeConf.fontSize - 2; + c4Shape.typeC4Shape.width = calculateTextWidth( + "<<" + c4Shape.typeC4Shape.text + ">>", + c4ShapeTypeConf + ); + c4Shape.typeC4Shape.height = c4ShapeTypeConf.fontSize + 2; + c4Shape.typeC4Shape.Y = conf.c4ShapePadding; + Y = c4Shape.typeC4Shape.Y + c4Shape.typeC4Shape.height - 4; + c4Shape.image = { width: 0, height: 0, Y: 0 }; + switch (c4Shape.typeC4Shape.text) { + case "person": + case "external_person": + c4Shape.image.width = 48; + c4Shape.image.height = 48; + c4Shape.image.Y = Y; + Y = c4Shape.image.Y + c4Shape.image.height; + break; + } + if (c4Shape.sprite) { + c4Shape.image.width = 48; + c4Shape.image.height = 48; + c4Shape.image.Y = Y; + Y = c4Shape.image.Y + c4Shape.image.height; + } + let c4ShapeTextWrap = c4Shape.wrap && conf.wrap; + let textLimitWidth = conf.width - conf.c4ShapePadding * 2; + let c4ShapeLabelConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text); + c4ShapeLabelConf.fontSize = c4ShapeLabelConf.fontSize + 2; + c4ShapeLabelConf.fontWeight = "bold"; + calcC4ShapeTextWH("label", c4Shape, c4ShapeTextWrap, c4ShapeLabelConf, textLimitWidth); + c4Shape["label"].Y = Y + 8; + Y = c4Shape["label"].Y + c4Shape["label"].height; + if (c4Shape.type && c4Shape.type.text !== "") { + c4Shape.type.text = "[" + c4Shape.type.text + "]"; + let c4ShapeTypeConf2 = c4ShapeFont(conf, c4Shape.typeC4Shape.text); + calcC4ShapeTextWH("type", c4Shape, c4ShapeTextWrap, c4ShapeTypeConf2, textLimitWidth); + c4Shape["type"].Y = Y + 5; + Y = c4Shape["type"].Y + c4Shape["type"].height; + } else if (c4Shape.techn && c4Shape.techn.text !== "") { + c4Shape.techn.text = "[" + c4Shape.techn.text + "]"; + let c4ShapeTechnConf = c4ShapeFont(conf, c4Shape.techn.text); + calcC4ShapeTextWH("techn", c4Shape, c4ShapeTextWrap, c4ShapeTechnConf, textLimitWidth); + c4Shape["techn"].Y = Y + 5; + Y = c4Shape["techn"].Y + c4Shape["techn"].height; + } + let rectHeight = Y; + let rectWidth = c4Shape.label.width; + if (c4Shape.descr && c4Shape.descr.text !== "") { + let c4ShapeDescrConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text); + calcC4ShapeTextWH("descr", c4Shape, c4ShapeTextWrap, c4ShapeDescrConf, textLimitWidth); + c4Shape["descr"].Y = Y + 20; + Y = c4Shape["descr"].Y + c4Shape["descr"].height; + rectWidth = Math.max(c4Shape.label.width, c4Shape.descr.width); + rectHeight = Y - c4Shape["descr"].textLines * 5; + } + rectWidth = rectWidth + conf.c4ShapePadding; + c4Shape.width = Math.max(c4Shape.width || conf.width, rectWidth, conf.width); + c4Shape.height = Math.max(c4Shape.height || conf.height, rectHeight, conf.height); + c4Shape.margin = c4Shape.margin || conf.c4ShapeMargin; + currentBounds.insert(c4Shape); + svgDraw.drawC4Shape(diagram2, c4Shape, conf); + } + currentBounds.bumpLastMargin(conf.c4ShapeMargin); +}; +class Point { + constructor(x, y) { + this.x = x; + this.y = y; + } +} +let getIntersectPoint = function(fromNode, endPoint) { + let x1 = fromNode.x; + let y1 = fromNode.y; + let x2 = endPoint.x; + let y2 = endPoint.y; + let fromCenterX = x1 + fromNode.width / 2; + let fromCenterY = y1 + fromNode.height / 2; + let dx = Math.abs(x1 - x2); + let dy = Math.abs(y1 - y2); + let tanDYX = dy / dx; + let fromDYX = fromNode.height / fromNode.width; + let returnPoint = null; + if (y1 == y2 && x1 < x2) { + returnPoint = new Point(x1 + fromNode.width, fromCenterY); + } else if (y1 == y2 && x1 > x2) { + returnPoint = new Point(x1, fromCenterY); + } else if (x1 == x2 && y1 < y2) { + returnPoint = new Point(fromCenterX, y1 + fromNode.height); + } else if (x1 == x2 && y1 > y2) { + returnPoint = new Point(fromCenterX, y1); + } + if (x1 > x2 && y1 < y2) { + if (fromDYX >= tanDYX) { + returnPoint = new Point(x1, fromCenterY + tanDYX * fromNode.width / 2); + } else { + returnPoint = new Point( + fromCenterX - dx / dy * fromNode.height / 2, + y1 + fromNode.height + ); + } + } else if (x1 < x2 && y1 < y2) { + if (fromDYX >= tanDYX) { + returnPoint = new Point(x1 + fromNode.width, fromCenterY + tanDYX * fromNode.width / 2); + } else { + returnPoint = new Point( + fromCenterX + dx / dy * fromNode.height / 2, + y1 + fromNode.height + ); + } + } else if (x1 < x2 && y1 > y2) { + if (fromDYX >= tanDYX) { + returnPoint = new Point(x1 + fromNode.width, fromCenterY - tanDYX * fromNode.width / 2); + } else { + returnPoint = new Point(fromCenterX + fromNode.height / 2 * dx / dy, y1); + } + } else if (x1 > x2 && y1 > y2) { + if (fromDYX >= tanDYX) { + returnPoint = new Point(x1, fromCenterY - fromNode.width / 2 * tanDYX); + } else { + returnPoint = new Point(fromCenterX - fromNode.height / 2 * dx / dy, y1); + } + } + return returnPoint; +}; +let getIntersectPoints = function(fromNode, endNode) { + let endIntersectPoint = { x: 0, y: 0 }; + endIntersectPoint.x = endNode.x + endNode.width / 2; + endIntersectPoint.y = endNode.y + endNode.height / 2; + let startPoint = getIntersectPoint(fromNode, endIntersectPoint); + endIntersectPoint.x = fromNode.x + fromNode.width / 2; + endIntersectPoint.y = fromNode.y + fromNode.height / 2; + let endPoint = getIntersectPoint(endNode, endIntersectPoint); + return { startPoint, endPoint }; +}; +const drawRels = function(diagram2, rels2, getC4ShapeObj, diagObj) { + let i = 0; + for (let rel of rels2) { + i = i + 1; + let relTextWrap = rel.wrap && conf.wrap; + let relConf = messageFont(conf); + let diagramType = diagObj.db.getC4Type(); + if (diagramType === "C4Dynamic") { + rel.label.text = i + ": " + rel.label.text; + } + let textLimitWidth = calculateTextWidth(rel.label.text, relConf); + calcC4ShapeTextWH("label", rel, relTextWrap, relConf, textLimitWidth); + if (rel.techn && rel.techn.text !== "") { + textLimitWidth = calculateTextWidth(rel.techn.text, relConf); + calcC4ShapeTextWH("techn", rel, relTextWrap, relConf, textLimitWidth); + } + if (rel.descr && rel.descr.text !== "") { + textLimitWidth = calculateTextWidth(rel.descr.text, relConf); + calcC4ShapeTextWH("descr", rel, relTextWrap, relConf, textLimitWidth); + } + let fromNode = getC4ShapeObj(rel.from); + let endNode = getC4ShapeObj(rel.to); + let points = getIntersectPoints(fromNode, endNode); + rel.startPoint = points.startPoint; + rel.endPoint = points.endPoint; + } + svgDraw.drawRels(diagram2, rels2, conf); +}; +function drawInsideBoundary(diagram2, parentBoundaryAlias, parentBounds, currentBoundaries, diagObj) { + let currentBounds = new Bounds(diagObj); + currentBounds.data.widthLimit = parentBounds.data.widthLimit / Math.min(c4BoundaryInRow, currentBoundaries.length); + for (let [i, currentBoundary] of currentBoundaries.entries()) { + let Y = 0; + currentBoundary.image = { width: 0, height: 0, Y: 0 }; + if (currentBoundary.sprite) { + currentBoundary.image.width = 48; + currentBoundary.image.height = 48; + currentBoundary.image.Y = Y; + Y = currentBoundary.image.Y + currentBoundary.image.height; + } + let currentBoundaryTextWrap = currentBoundary.wrap && conf.wrap; + let currentBoundaryLabelConf = boundaryFont(conf); + currentBoundaryLabelConf.fontSize = currentBoundaryLabelConf.fontSize + 2; + currentBoundaryLabelConf.fontWeight = "bold"; + calcC4ShapeTextWH( + "label", + currentBoundary, + currentBoundaryTextWrap, + currentBoundaryLabelConf, + currentBounds.data.widthLimit + ); + currentBoundary["label"].Y = Y + 8; + Y = currentBoundary["label"].Y + currentBoundary["label"].height; + if (currentBoundary.type && currentBoundary.type.text !== "") { + currentBoundary.type.text = "[" + currentBoundary.type.text + "]"; + let currentBoundaryTypeConf = boundaryFont(conf); + calcC4ShapeTextWH( + "type", + currentBoundary, + currentBoundaryTextWrap, + currentBoundaryTypeConf, + currentBounds.data.widthLimit + ); + currentBoundary["type"].Y = Y + 5; + Y = currentBoundary["type"].Y + currentBoundary["type"].height; + } + if (currentBoundary.descr && currentBoundary.descr.text !== "") { + let currentBoundaryDescrConf = boundaryFont(conf); + currentBoundaryDescrConf.fontSize = currentBoundaryDescrConf.fontSize - 2; + calcC4ShapeTextWH( + "descr", + currentBoundary, + currentBoundaryTextWrap, + currentBoundaryDescrConf, + currentBounds.data.widthLimit + ); + currentBoundary["descr"].Y = Y + 20; + Y = currentBoundary["descr"].Y + currentBoundary["descr"].height; + } + if (i == 0 || i % c4BoundaryInRow === 0) { + let _x = parentBounds.data.startx + conf.diagramMarginX; + let _y = parentBounds.data.stopy + conf.diagramMarginY + Y; + currentBounds.setData(_x, _x, _y, _y); + } else { + let _x = currentBounds.data.stopx !== currentBounds.data.startx ? currentBounds.data.stopx + conf.diagramMarginX : currentBounds.data.startx; + let _y = currentBounds.data.starty; + currentBounds.setData(_x, _x, _y, _y); + } + currentBounds.name = currentBoundary.alias; + let currentPersonOrSystemArray = diagObj.db.getC4ShapeArray(currentBoundary.alias); + let currentPersonOrSystemKeys = diagObj.db.getC4ShapeKeys(currentBoundary.alias); + if (currentPersonOrSystemKeys.length > 0) { + drawC4ShapeArray( + currentBounds, + diagram2, + currentPersonOrSystemArray, + currentPersonOrSystemKeys + ); + } + parentBoundaryAlias = currentBoundary.alias; + let nextCurrentBoundarys = diagObj.db.getBoundarys(parentBoundaryAlias); + if (nextCurrentBoundarys.length > 0) { + drawInsideBoundary( + diagram2, + parentBoundaryAlias, + currentBounds, + nextCurrentBoundarys, + diagObj + ); + } + if (currentBoundary.alias !== "global") { + drawBoundary(diagram2, currentBoundary, currentBounds); + } + parentBounds.data.stopy = Math.max( + currentBounds.data.stopy + conf.c4ShapeMargin, + parentBounds.data.stopy + ); + parentBounds.data.stopx = Math.max( + currentBounds.data.stopx + conf.c4ShapeMargin, + parentBounds.data.stopx + ); + globalBoundaryMaxX = Math.max(globalBoundaryMaxX, parentBounds.data.stopx); + globalBoundaryMaxY = Math.max(globalBoundaryMaxY, parentBounds.data.stopy); + } +} +const draw = function(_text, id, _version, diagObj) { + conf = getConfig().c4; + const securityLevel = getConfig().securityLevel; + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = select("#i" + id); + } + const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body"); + let db = diagObj.db; + diagObj.db.setWrap(conf.wrap); + c4ShapeInRow = db.getC4ShapeInRow(); + c4BoundaryInRow = db.getC4BoundaryInRow(); + log.debug(`C:${JSON.stringify(conf, null, 2)}`); + const diagram2 = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : select(`[id="${id}"]`); + svgDraw.insertComputerIcon(diagram2); + svgDraw.insertDatabaseIcon(diagram2); + svgDraw.insertClockIcon(diagram2); + let screenBounds = new Bounds(diagObj); + screenBounds.setData( + conf.diagramMarginX, + conf.diagramMarginX, + conf.diagramMarginY, + conf.diagramMarginY + ); + screenBounds.data.widthLimit = screen.availWidth; + globalBoundaryMaxX = conf.diagramMarginX; + globalBoundaryMaxY = conf.diagramMarginY; + const title2 = diagObj.db.getTitle(); + let currentBoundaries = diagObj.db.getBoundarys(""); + drawInsideBoundary(diagram2, "", screenBounds, currentBoundaries, diagObj); + svgDraw.insertArrowHead(diagram2); + svgDraw.insertArrowEnd(diagram2); + svgDraw.insertArrowCrossHead(diagram2); + svgDraw.insertArrowFilledHead(diagram2); + drawRels(diagram2, diagObj.db.getRels(), diagObj.db.getC4Shape, diagObj); + screenBounds.data.stopx = globalBoundaryMaxX; + screenBounds.data.stopy = globalBoundaryMaxY; + const box = screenBounds.data; + let boxHeight = box.stopy - box.starty; + let height = boxHeight + 2 * conf.diagramMarginY; + let boxWidth = box.stopx - box.startx; + const width = boxWidth + 2 * conf.diagramMarginX; + if (title2) { + diagram2.append("text").text(title2).attr("x", (box.stopx - box.startx) / 2 - 4 * conf.diagramMarginX).attr("y", box.starty + conf.diagramMarginY); + } + configureSvgSize(diagram2, height, width, conf.useMaxWidth); + const extraVertForTitle = title2 ? 60 : 0; + diagram2.attr( + "viewBox", + box.startx - conf.diagramMarginX + " -" + (conf.diagramMarginY + extraVertForTitle) + " " + width + " " + (height + extraVertForTitle) + ); + log.debug(`models:`, box); +}; +const c4Renderer = { + drawPersonOrSystemArray: drawC4ShapeArray, + drawBoundary, + setConf, + draw +}; +const getStyles = (options) => `.person { + stroke: ${options.personBorder}; + fill: ${options.personBkg}; + } +`; +const c4Styles = getStyles; +const diagram = { + parser: c4Parser, + db: c4Db, + renderer: c4Renderer, + styles: c4Styles, + init: (cnf) => { + c4Renderer.setConf(cnf.c4); + } +}; +export { + diagram +}; +//# sourceMappingURL=c4Diagram-be8b5c2c.js.map diff --git a/scopegraphs-render-docs/doc/js/c4Diagram-d4b415eb.js b/scopegraphs-render-docs/doc/js/c4Diagram-d4b415eb.js new file mode 100644 index 0000000..7312df2 --- /dev/null +++ b/scopegraphs-render-docs/doc/js/c4Diagram-d4b415eb.js @@ -0,0 +1,1623 @@ +import { m as Ve } from "./mermaidAPI-67f627de.js"; +import { q as je, v as Ue, w as Fe, x as ze, g as Ut, b as ve, f as le, d as Xe, h as Qt, l as _e } from "./commonDb-41f8b4c5.js"; +import { s as ke, q as Yt, v as We, w as Qe, x as xe } from "./utils-8ea37061.js"; +var qt = function() { + var e = function(Ot, _, x, m) { + for (x = x || {}, m = Ot.length; m--; x[Ot[m]] = _) + ; + return x; + }, t = [1, 6], i = [1, 7], o = [1, 8], l = [1, 9], n = [1, 16], r = [1, 11], a = [1, 12], s = [1, 13], u = [1, 14], d = [1, 15], y = [1, 27], p = [1, 33], C = [1, 34], T = [1, 35], R = [1, 36], D = [1, 37], L = [1, 72], Y = [1, 73], Q = [1, 74], H = [1, 75], q = [1, 76], G = [1, 77], K = [1, 78], J = [1, 38], Z = [1, 39], $ = [1, 40], tt = [1, 41], et = [1, 42], nt = [1, 43], it = [1, 44], st = [1, 45], at = [1, 46], rt = [1, 47], lt = [1, 48], ot = [1, 49], ct = [1, 50], ht = [1, 51], ut = [1, 52], dt = [1, 53], ft = [1, 54], pt = [1, 55], yt = [1, 56], gt = [1, 57], bt = [1, 59], _t = [1, 60], xt = [1, 61], mt = [1, 62], Et = [1, 63], vt = [1, 64], kt = [1, 65], At = [1, 66], Ct = [1, 67], wt = [1, 68], Tt = [1, 69], Nt = [24, 52], $t = [24, 44, 46, 47, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84], It = [15, 24, 44, 46, 47, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84], E = [1, 94], v = [1, 95], k = [1, 96], A = [1, 97], w = [15, 24, 52], fe = [7, 8, 9, 10, 18, 22, 25, 26, 27, 28], pe = [15, 24, 43, 52], zt = [15, 24, 43, 52, 86, 87, 89, 90], Dt = [15, 43], te = [44, 46, 47, 48, 49, 50, 51, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84], ee = { + trace: function() { + }, + yy: {}, + symbols_: { error: 2, start: 3, mermaidDoc: 4, direction: 5, directive: 6, direction_tb: 7, direction_bt: 8, direction_rl: 9, direction_lr: 10, graphConfig: 11, openDirective: 12, typeDirective: 13, closeDirective: 14, NEWLINE: 15, ":": 16, argDirective: 17, open_directive: 18, type_directive: 19, arg_directive: 20, close_directive: 21, C4_CONTEXT: 22, statements: 23, EOF: 24, C4_CONTAINER: 25, C4_COMPONENT: 26, C4_DYNAMIC: 27, C4_DEPLOYMENT: 28, otherStatements: 29, diagramStatements: 30, otherStatement: 31, title: 32, accDescription: 33, acc_title: 34, acc_title_value: 35, acc_descr: 36, acc_descr_value: 37, acc_descr_multiline_value: 38, boundaryStatement: 39, boundaryStartStatement: 40, boundaryStopStatement: 41, boundaryStart: 42, LBRACE: 43, ENTERPRISE_BOUNDARY: 44, attributes: 45, SYSTEM_BOUNDARY: 46, BOUNDARY: 47, CONTAINER_BOUNDARY: 48, NODE: 49, NODE_L: 50, NODE_R: 51, RBRACE: 52, diagramStatement: 53, PERSON: 54, PERSON_EXT: 55, SYSTEM: 56, SYSTEM_DB: 57, SYSTEM_QUEUE: 58, SYSTEM_EXT: 59, SYSTEM_EXT_DB: 60, SYSTEM_EXT_QUEUE: 61, CONTAINER: 62, CONTAINER_DB: 63, CONTAINER_QUEUE: 64, CONTAINER_EXT: 65, CONTAINER_EXT_DB: 66, CONTAINER_EXT_QUEUE: 67, COMPONENT: 68, COMPONENT_DB: 69, COMPONENT_QUEUE: 70, COMPONENT_EXT: 71, COMPONENT_EXT_DB: 72, COMPONENT_EXT_QUEUE: 73, REL: 74, BIREL: 75, REL_U: 76, REL_D: 77, REL_L: 78, REL_R: 79, REL_B: 80, REL_INDEX: 81, UPDATE_EL_STYLE: 82, UPDATE_REL_STYLE: 83, UPDATE_LAYOUT_CONFIG: 84, attribute: 85, STR: 86, STR_KEY: 87, STR_VALUE: 88, ATTRIBUTE: 89, ATTRIBUTE_EMPTY: 90, $accept: 0, $end: 1 }, + terminals_: { 2: "error", 7: "direction_tb", 8: "direction_bt", 9: "direction_rl", 10: "direction_lr", 15: "NEWLINE", 16: ":", 18: "open_directive", 19: "type_directive", 20: "arg_directive", 21: "close_directive", 22: "C4_CONTEXT", 24: "EOF", 25: "C4_CONTAINER", 26: "C4_COMPONENT", 27: "C4_DYNAMIC", 28: "C4_DEPLOYMENT", 32: "title", 33: "accDescription", 34: "acc_title", 35: "acc_title_value", 36: "acc_descr", 37: "acc_descr_value", 38: "acc_descr_multiline_value", 43: "LBRACE", 44: "ENTERPRISE_BOUNDARY", 46: "SYSTEM_BOUNDARY", 47: "BOUNDARY", 48: "CONTAINER_BOUNDARY", 49: "NODE", 50: "NODE_L", 51: "NODE_R", 52: "RBRACE", 54: "PERSON", 55: "PERSON_EXT", 56: "SYSTEM", 57: "SYSTEM_DB", 58: "SYSTEM_QUEUE", 59: "SYSTEM_EXT", 60: "SYSTEM_EXT_DB", 61: "SYSTEM_EXT_QUEUE", 62: "CONTAINER", 63: "CONTAINER_DB", 64: "CONTAINER_QUEUE", 65: "CONTAINER_EXT", 66: "CONTAINER_EXT_DB", 67: "CONTAINER_EXT_QUEUE", 68: "COMPONENT", 69: "COMPONENT_DB", 70: "COMPONENT_QUEUE", 71: "COMPONENT_EXT", 72: "COMPONENT_EXT_DB", 73: "COMPONENT_EXT_QUEUE", 74: "REL", 75: "BIREL", 76: "REL_U", 77: "REL_D", 78: "REL_L", 79: "REL_R", 80: "REL_B", 81: "REL_INDEX", 82: "UPDATE_EL_STYLE", 83: "UPDATE_REL_STYLE", 84: "UPDATE_LAYOUT_CONFIG", 86: "STR", 87: "STR_KEY", 88: "STR_VALUE", 89: "ATTRIBUTE", 90: "ATTRIBUTE_EMPTY" }, + productions_: [0, [3, 1], [3, 1], [3, 2], [5, 1], [5, 1], [5, 1], [5, 1], [4, 1], [6, 4], [6, 6], [12, 1], [13, 1], [17, 1], [14, 1], [11, 4], [11, 4], [11, 4], [11, 4], [11, 4], [23, 1], [23, 1], [23, 2], [29, 1], [29, 2], [29, 3], [31, 1], [31, 1], [31, 2], [31, 2], [31, 1], [39, 3], [40, 3], [40, 3], [40, 4], [42, 2], [42, 2], [42, 2], [42, 2], [42, 2], [42, 2], [42, 2], [41, 1], [30, 1], [30, 2], [30, 3], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 1], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [53, 2], [45, 1], [45, 2], [85, 1], [85, 2], [85, 1], [85, 1]], + performAction: function(_, x, m, g, O, h, Vt) { + var f = h.length - 1; + switch (O) { + case 4: + g.setDirection("TB"); + break; + case 5: + g.setDirection("BT"); + break; + case 6: + g.setDirection("RL"); + break; + case 7: + g.setDirection("LR"); + break; + case 11: + g.parseDirective("%%{", "open_directive"); + break; + case 12: + break; + case 13: + h[f] = h[f].trim().replace(/'/g, '"'), g.parseDirective(h[f], "arg_directive"); + break; + case 14: + g.parseDirective("}%%", "close_directive", "c4Context"); + break; + case 15: + case 16: + case 17: + case 18: + case 19: + g.setC4Type(h[f - 3]); + break; + case 26: + g.setTitle(h[f].substring(6)), this.$ = h[f].substring(6); + break; + case 27: + g.setAccDescription(h[f].substring(15)), this.$ = h[f].substring(15); + break; + case 28: + this.$ = h[f].trim(), g.setTitle(this.$); + break; + case 29: + case 30: + this.$ = h[f].trim(), g.setAccDescription(this.$); + break; + case 35: + case 36: + h[f].splice(2, 0, "ENTERPRISE"), g.addPersonOrSystemBoundary(...h[f]), this.$ = h[f]; + break; + case 37: + g.addPersonOrSystemBoundary(...h[f]), this.$ = h[f]; + break; + case 38: + h[f].splice(2, 0, "CONTAINER"), g.addContainerBoundary(...h[f]), this.$ = h[f]; + break; + case 39: + g.addDeploymentNode("node", ...h[f]), this.$ = h[f]; + break; + case 40: + g.addDeploymentNode("nodeL", ...h[f]), this.$ = h[f]; + break; + case 41: + g.addDeploymentNode("nodeR", ...h[f]), this.$ = h[f]; + break; + case 42: + g.popBoundaryParseStack(); + break; + case 46: + g.addPersonOrSystem("person", ...h[f]), this.$ = h[f]; + break; + case 47: + g.addPersonOrSystem("external_person", ...h[f]), this.$ = h[f]; + break; + case 48: + g.addPersonOrSystem("system", ...h[f]), this.$ = h[f]; + break; + case 49: + g.addPersonOrSystem("system_db", ...h[f]), this.$ = h[f]; + break; + case 50: + g.addPersonOrSystem("system_queue", ...h[f]), this.$ = h[f]; + break; + case 51: + g.addPersonOrSystem("external_system", ...h[f]), this.$ = h[f]; + break; + case 52: + g.addPersonOrSystem("external_system_db", ...h[f]), this.$ = h[f]; + break; + case 53: + g.addPersonOrSystem("external_system_queue", ...h[f]), this.$ = h[f]; + break; + case 54: + g.addContainer("container", ...h[f]), this.$ = h[f]; + break; + case 55: + g.addContainer("container_db", ...h[f]), this.$ = h[f]; + break; + case 56: + g.addContainer("container_queue", ...h[f]), this.$ = h[f]; + break; + case 57: + g.addContainer("external_container", ...h[f]), this.$ = h[f]; + break; + case 58: + g.addContainer("external_container_db", ...h[f]), this.$ = h[f]; + break; + case 59: + g.addContainer("external_container_queue", ...h[f]), this.$ = h[f]; + break; + case 60: + g.addComponent("component", ...h[f]), this.$ = h[f]; + break; + case 61: + g.addComponent("component_db", ...h[f]), this.$ = h[f]; + break; + case 62: + g.addComponent("component_queue", ...h[f]), this.$ = h[f]; + break; + case 63: + g.addComponent("external_component", ...h[f]), this.$ = h[f]; + break; + case 64: + g.addComponent("external_component_db", ...h[f]), this.$ = h[f]; + break; + case 65: + g.addComponent("external_component_queue", ...h[f]), this.$ = h[f]; + break; + case 67: + g.addRel("rel", ...h[f]), this.$ = h[f]; + break; + case 68: + g.addRel("birel", ...h[f]), this.$ = h[f]; + break; + case 69: + g.addRel("rel_u", ...h[f]), this.$ = h[f]; + break; + case 70: + g.addRel("rel_d", ...h[f]), this.$ = h[f]; + break; + case 71: + g.addRel("rel_l", ...h[f]), this.$ = h[f]; + break; + case 72: + g.addRel("rel_r", ...h[f]), this.$ = h[f]; + break; + case 73: + g.addRel("rel_b", ...h[f]), this.$ = h[f]; + break; + case 74: + h[f].splice(0, 1), g.addRel("rel", ...h[f]), this.$ = h[f]; + break; + case 75: + g.updateElStyle("update_el_style", ...h[f]), this.$ = h[f]; + break; + case 76: + g.updateRelStyle("update_rel_style", ...h[f]), this.$ = h[f]; + break; + case 77: + g.updateLayoutConfig("update_layout_config", ...h[f]), this.$ = h[f]; + break; + case 78: + this.$ = [h[f]]; + break; + case 79: + h[f].unshift(h[f - 1]), this.$ = h[f]; + break; + case 80: + case 82: + this.$ = h[f].trim(); + break; + case 81: + let Pt = {}; + Pt[h[f - 1].trim()] = h[f].trim(), this.$ = Pt; + break; + case 83: + this.$ = ""; + break; + } + }, + table: [{ 3: 1, 4: 2, 5: 3, 6: 4, 7: t, 8: i, 9: o, 10: l, 11: 5, 12: 10, 18: n, 22: r, 25: a, 26: s, 27: u, 28: d }, { 1: [3] }, { 1: [2, 1] }, { 1: [2, 2] }, { 3: 17, 4: 2, 5: 3, 6: 4, 7: t, 8: i, 9: o, 10: l, 11: 5, 12: 10, 18: n, 22: r, 25: a, 26: s, 27: u, 28: d }, { 1: [2, 8] }, { 1: [2, 4] }, { 1: [2, 5] }, { 1: [2, 6] }, { 1: [2, 7] }, { 13: 18, 19: [1, 19] }, { 15: [1, 20] }, { 15: [1, 21] }, { 15: [1, 22] }, { 15: [1, 23] }, { 15: [1, 24] }, { 19: [2, 11] }, { 1: [2, 3] }, { 14: 25, 16: [1, 26], 21: y }, e([16, 21], [2, 12]), { 23: 28, 29: 29, 30: 30, 31: 31, 32: p, 33: C, 34: T, 36: R, 38: D, 39: 58, 40: 70, 42: 71, 44: L, 46: Y, 47: Q, 48: H, 49: q, 50: G, 51: K, 53: 32, 54: J, 55: Z, 56: $, 57: tt, 58: et, 59: nt, 60: it, 61: st, 62: at, 63: rt, 64: lt, 65: ot, 66: ct, 67: ht, 68: ut, 69: dt, 70: ft, 71: pt, 72: yt, 73: gt, 74: bt, 75: _t, 76: xt, 77: mt, 78: Et, 79: vt, 80: kt, 81: At, 82: Ct, 83: wt, 84: Tt }, { 23: 79, 29: 29, 30: 30, 31: 31, 32: p, 33: C, 34: T, 36: R, 38: D, 39: 58, 40: 70, 42: 71, 44: L, 46: Y, 47: Q, 48: H, 49: q, 50: G, 51: K, 53: 32, 54: J, 55: Z, 56: $, 57: tt, 58: et, 59: nt, 60: it, 61: st, 62: at, 63: rt, 64: lt, 65: ot, 66: ct, 67: ht, 68: ut, 69: dt, 70: ft, 71: pt, 72: yt, 73: gt, 74: bt, 75: _t, 76: xt, 77: mt, 78: Et, 79: vt, 80: kt, 81: At, 82: Ct, 83: wt, 84: Tt }, { 23: 80, 29: 29, 30: 30, 31: 31, 32: p, 33: C, 34: T, 36: R, 38: D, 39: 58, 40: 70, 42: 71, 44: L, 46: Y, 47: Q, 48: H, 49: q, 50: G, 51: K, 53: 32, 54: J, 55: Z, 56: $, 57: tt, 58: et, 59: nt, 60: it, 61: st, 62: at, 63: rt, 64: lt, 65: ot, 66: ct, 67: ht, 68: ut, 69: dt, 70: ft, 71: pt, 72: yt, 73: gt, 74: bt, 75: _t, 76: xt, 77: mt, 78: Et, 79: vt, 80: kt, 81: At, 82: Ct, 83: wt, 84: Tt }, { 23: 81, 29: 29, 30: 30, 31: 31, 32: p, 33: C, 34: T, 36: R, 38: D, 39: 58, 40: 70, 42: 71, 44: L, 46: Y, 47: Q, 48: H, 49: q, 50: G, 51: K, 53: 32, 54: J, 55: Z, 56: $, 57: tt, 58: et, 59: nt, 60: it, 61: st, 62: at, 63: rt, 64: lt, 65: ot, 66: ct, 67: ht, 68: ut, 69: dt, 70: ft, 71: pt, 72: yt, 73: gt, 74: bt, 75: _t, 76: xt, 77: mt, 78: Et, 79: vt, 80: kt, 81: At, 82: Ct, 83: wt, 84: Tt }, { 23: 82, 29: 29, 30: 30, 31: 31, 32: p, 33: C, 34: T, 36: R, 38: D, 39: 58, 40: 70, 42: 71, 44: L, 46: Y, 47: Q, 48: H, 49: q, 50: G, 51: K, 53: 32, 54: J, 55: Z, 56: $, 57: tt, 58: et, 59: nt, 60: it, 61: st, 62: at, 63: rt, 64: lt, 65: ot, 66: ct, 67: ht, 68: ut, 69: dt, 70: ft, 71: pt, 72: yt, 73: gt, 74: bt, 75: _t, 76: xt, 77: mt, 78: Et, 79: vt, 80: kt, 81: At, 82: Ct, 83: wt, 84: Tt }, { 15: [1, 83] }, { 17: 84, 20: [1, 85] }, { 15: [2, 14] }, { 24: [1, 86] }, e(Nt, [2, 20], { 53: 32, 39: 58, 40: 70, 42: 71, 30: 87, 44: L, 46: Y, 47: Q, 48: H, 49: q, 50: G, 51: K, 54: J, 55: Z, 56: $, 57: tt, 58: et, 59: nt, 60: it, 61: st, 62: at, 63: rt, 64: lt, 65: ot, 66: ct, 67: ht, 68: ut, 69: dt, 70: ft, 71: pt, 72: yt, 73: gt, 74: bt, 75: _t, 76: xt, 77: mt, 78: Et, 79: vt, 80: kt, 81: At, 82: Ct, 83: wt, 84: Tt }), e(Nt, [2, 21]), e($t, [2, 23], { 15: [1, 88] }), e(Nt, [2, 43], { 15: [1, 89] }), e(It, [2, 26]), e(It, [2, 27]), { 35: [1, 90] }, { 37: [1, 91] }, e(It, [2, 30]), { 45: 92, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 98, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 99, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 100, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 101, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 102, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 103, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 104, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 105, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 106, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 107, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 108, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 109, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 110, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 111, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 112, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 113, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 114, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 115, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 116, 85: 93, 86: E, 87: v, 89: k, 90: A }, e(w, [2, 66]), { 45: 117, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 118, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 119, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 120, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 121, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 122, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 123, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 124, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 125, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 126, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 127, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 30: 128, 39: 58, 40: 70, 42: 71, 44: L, 46: Y, 47: Q, 48: H, 49: q, 50: G, 51: K, 53: 32, 54: J, 55: Z, 56: $, 57: tt, 58: et, 59: nt, 60: it, 61: st, 62: at, 63: rt, 64: lt, 65: ot, 66: ct, 67: ht, 68: ut, 69: dt, 70: ft, 71: pt, 72: yt, 73: gt, 74: bt, 75: _t, 76: xt, 77: mt, 78: Et, 79: vt, 80: kt, 81: At, 82: Ct, 83: wt, 84: Tt }, { 15: [1, 130], 43: [1, 129] }, { 45: 131, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 132, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 133, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 134, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 135, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 136, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 45: 137, 85: 93, 86: E, 87: v, 89: k, 90: A }, { 24: [1, 138] }, { 24: [1, 139] }, { 24: [1, 140] }, { 24: [1, 141] }, e(fe, [2, 9]), { 14: 142, 21: y }, { 21: [2, 13] }, { 1: [2, 15] }, e(Nt, [2, 22]), e($t, [2, 24], { 31: 31, 29: 143, 32: p, 33: C, 34: T, 36: R, 38: D }), e(Nt, [2, 44], { 29: 29, 30: 30, 31: 31, 53: 32, 39: 58, 40: 70, 42: 71, 23: 144, 32: p, 33: C, 34: T, 36: R, 38: D, 44: L, 46: Y, 47: Q, 48: H, 49: q, 50: G, 51: K, 54: J, 55: Z, 56: $, 57: tt, 58: et, 59: nt, 60: it, 61: st, 62: at, 63: rt, 64: lt, 65: ot, 66: ct, 67: ht, 68: ut, 69: dt, 70: ft, 71: pt, 72: yt, 73: gt, 74: bt, 75: _t, 76: xt, 77: mt, 78: Et, 79: vt, 80: kt, 81: At, 82: Ct, 83: wt, 84: Tt }), e(It, [2, 28]), e(It, [2, 29]), e(w, [2, 46]), e(pe, [2, 78], { 85: 93, 45: 145, 86: E, 87: v, 89: k, 90: A }), e(zt, [2, 80]), { 88: [1, 146] }, e(zt, [2, 82]), e(zt, [2, 83]), e(w, [2, 47]), e(w, [2, 48]), e(w, [2, 49]), e(w, [2, 50]), e(w, [2, 51]), e(w, [2, 52]), e(w, [2, 53]), e(w, [2, 54]), e(w, [2, 55]), e(w, [2, 56]), e(w, [2, 57]), e(w, [2, 58]), e(w, [2, 59]), e(w, [2, 60]), e(w, [2, 61]), e(w, [2, 62]), e(w, [2, 63]), e(w, [2, 64]), e(w, [2, 65]), e(w, [2, 67]), e(w, [2, 68]), e(w, [2, 69]), e(w, [2, 70]), e(w, [2, 71]), e(w, [2, 72]), e(w, [2, 73]), e(w, [2, 74]), e(w, [2, 75]), e(w, [2, 76]), e(w, [2, 77]), { 41: 147, 52: [1, 148] }, { 15: [1, 149] }, { 43: [1, 150] }, e(Dt, [2, 35]), e(Dt, [2, 36]), e(Dt, [2, 37]), e(Dt, [2, 38]), e(Dt, [2, 39]), e(Dt, [2, 40]), e(Dt, [2, 41]), { 1: [2, 16] }, { 1: [2, 17] }, { 1: [2, 18] }, { 1: [2, 19] }, { 15: [1, 151] }, e($t, [2, 25]), e(Nt, [2, 45]), e(pe, [2, 79]), e(zt, [2, 81]), e(w, [2, 31]), e(w, [2, 42]), e(te, [2, 32]), e(te, [2, 33], { 15: [1, 152] }), e(fe, [2, 10]), e(te, [2, 34])], + defaultActions: { 2: [2, 1], 3: [2, 2], 5: [2, 8], 6: [2, 4], 7: [2, 5], 8: [2, 6], 9: [2, 7], 16: [2, 11], 17: [2, 3], 27: [2, 14], 85: [2, 13], 86: [2, 15], 138: [2, 16], 139: [2, 17], 140: [2, 18], 141: [2, 19] }, + parseError: function(_, x) { + if (x.recoverable) + this.trace(_); + else { + var m = new Error(_); + throw m.hash = x, m; + } + }, + parse: function(_) { + var x = this, m = [0], g = [], O = [null], h = [], Vt = this.table, f = "", Pt = 0, ye = 0, Ne = 2, ge = 1, Be = h.slice.call(arguments, 1), S = Object.create(this.lexer), Mt = { yy: {} }; + for (var ie in this.yy) + Object.prototype.hasOwnProperty.call(this.yy, ie) && (Mt.yy[ie] = this.yy[ie]); + S.setInput(_, Mt.yy), Mt.yy.lexer = S, Mt.yy.parser = this, typeof S.yylloc > "u" && (S.yylloc = {}); + var se = S.yylloc; + h.push(se); + var Ye = S.options && S.options.ranges; + typeof Mt.yy.parseError == "function" ? this.parseError = Mt.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError; + function Ie() { + var X; + return X = g.pop() || S.lex() || ge, typeof X != "number" && (X instanceof Array && (g = X, X = g.pop()), X = x.symbols_[X] || X), X; + } + for (var M, Lt, N, ae, Bt = {}, Xt, z, be, Wt; ; ) { + if (Lt = m[m.length - 1], this.defaultActions[Lt] ? N = this.defaultActions[Lt] : ((M === null || typeof M > "u") && (M = Ie()), N = Vt[Lt] && Vt[Lt][M]), typeof N > "u" || !N.length || !N[0]) { + var re = ""; + Wt = []; + for (Xt in Vt[Lt]) + this.terminals_[Xt] && Xt > Ne && Wt.push("'" + this.terminals_[Xt] + "'"); + S.showPosition ? re = "Parse error on line " + (Pt + 1) + `: +` + S.showPosition() + ` +Expecting ` + Wt.join(", ") + ", got '" + (this.terminals_[M] || M) + "'" : re = "Parse error on line " + (Pt + 1) + ": Unexpected " + (M == ge ? "end of input" : "'" + (this.terminals_[M] || M) + "'"), this.parseError(re, { + text: S.match, + token: this.terminals_[M] || M, + line: S.yylineno, + loc: se, + expected: Wt + }); + } + if (N[0] instanceof Array && N.length > 1) + throw new Error("Parse Error: multiple actions possible at state: " + Lt + ", token: " + M); + switch (N[0]) { + case 1: + m.push(M), O.push(S.yytext), h.push(S.yylloc), m.push(N[1]), M = null, ye = S.yyleng, f = S.yytext, Pt = S.yylineno, se = S.yylloc; + break; + case 2: + if (z = this.productions_[N[1]][1], Bt.$ = O[O.length - z], Bt._$ = { + first_line: h[h.length - (z || 1)].first_line, + last_line: h[h.length - 1].last_line, + first_column: h[h.length - (z || 1)].first_column, + last_column: h[h.length - 1].last_column + }, Ye && (Bt._$.range = [ + h[h.length - (z || 1)].range[0], + h[h.length - 1].range[1] + ]), ae = this.performAction.apply(Bt, [ + f, + ye, + Pt, + Mt.yy, + N[1], + O, + h + ].concat(Be)), typeof ae < "u") + return ae; + z && (m = m.slice(0, -1 * z * 2), O = O.slice(0, -1 * z), h = h.slice(0, -1 * z)), m.push(this.productions_[N[1]][0]), O.push(Bt.$), h.push(Bt._$), be = Vt[m[m.length - 2]][m[m.length - 1]], m.push(be); + break; + case 3: + return !0; + } + } + return !0; + } + }, Le = function() { + var Ot = { + EOF: 1, + parseError: function(x, m) { + if (this.yy.parser) + this.yy.parser.parseError(x, m); + else + throw new Error(x); + }, + // resets the lexer, sets new input + setInput: function(_, x) { + return this.yy = x || this.yy || {}, this._input = _, 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; + }, + // consumes and returns one char from the input + input: function() { + var _ = this._input[0]; + this.yytext += _, this.yyleng++, this.offset++, this.match += _, this.matched += _; + var x = _.match(/(?:\r\n?|\n).*/g); + return x ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), _; + }, + // unshifts one char (or a string) into the input + unput: function(_) { + var x = _.length, m = _.split(/(?:\r\n?|\n)/g); + this._input = _ + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - x), this.offset -= x; + 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), m.length - 1 && (this.yylineno -= m.length - 1); + var O = 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: m ? (m.length === g.length ? this.yylloc.first_column : 0) + g[g.length - m.length].length - m[0].length : this.yylloc.first_column - x + }, this.options.ranges && (this.yylloc.range = [O[0], O[0] + this.yyleng - x]), this.yyleng = this.yytext.length, this; + }, + // When called from action, caches matched text and appends it on next action + more: function() { + return this._more = !0, this; + }, + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: 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; + }, + // retain first n characters of the match + less: function(_) { + this.unput(this.match.slice(_)); + }, + // displays already matched input, i.e. for error messages + pastInput: function() { + var _ = this.matched.substr(0, this.matched.length - this.match.length); + return (_.length > 20 ? "..." : "") + _.substr(-20).replace(/\n/g, ""); + }, + // displays upcoming input, i.e. for error messages + upcomingInput: function() { + var _ = this.match; + return _.length < 20 && (_ += this._input.substr(0, 20 - _.length)), (_.substr(0, 20) + (_.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: function() { + var _ = this.pastInput(), x = new Array(_.length + 1).join("-"); + return _ + this.upcomingInput() + ` +` + x + "^"; + }, + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: function(_, x) { + var m, g, O; + if (this.options.backtrack_lexer && (O = { + 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 && (O.yylloc.range = this.yylloc.range.slice(0))), g = _[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 + _[0].length + }, this.yytext += _[0], this.match += _[0], this.matches = _, 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(_[0].length), this.matched += _[0], m = this.performAction.call(this, this.yy, this, x, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), m) + return m; + if (this._backtrack) { + for (var h in O) + this[h] = O[h]; + return !1; + } + return !1; + }, + // return next match in input + next: function() { + if (this.done) + return this.EOF; + this._input || (this.done = !0); + var _, x, m, g; + this._more || (this.yytext = "", this.match = ""); + for (var O = this._currentRules(), h = 0; h < O.length; h++) + if (m = this._input.match(this.rules[O[h]]), m && (!x || m[0].length > x[0].length)) { + if (x = m, g = h, this.options.backtrack_lexer) { + if (_ = this.test_match(m, O[h]), _ !== !1) + return _; + if (this._backtrack) { + x = !1; + continue; + } else + return !1; + } else if (!this.options.flex) + break; + } + return x ? (_ = this.test_match(x, O[g]), _ !== !1 ? _ : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text. +` + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + }, + // return next match that has a token + lex: function() { + var x = this.next(); + return x || this.lex(); + }, + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: function(x) { + this.conditionStack.push(x); + }, + // pop the previously active lexer condition state off the condition stack + popState: function() { + var x = this.conditionStack.length - 1; + return x > 0 ? this.conditionStack.pop() : this.conditionStack[0]; + }, + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: function() { + return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules; + }, + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: function(x) { + return x = this.conditionStack.length - 1 - Math.abs(x || 0), x >= 0 ? this.conditionStack[x] : "INITIAL"; + }, + // alias for begin(condition) + pushState: function(x) { + this.begin(x); + }, + // return the number of states currently on the stack + stateStackSize: function() { + return this.conditionStack.length; + }, + options: {}, + performAction: function(x, m, g, O) { + switch (g) { + case 0: + return this.begin("open_directive"), 18; + case 1: + return 7; + case 2: + return 8; + case 3: + return 9; + case 4: + return 10; + case 5: + return this.begin("type_directive"), 19; + case 6: + return this.popState(), this.begin("arg_directive"), 16; + case 7: + return this.popState(), this.popState(), 21; + case 8: + return 20; + case 9: + return 32; + case 10: + return 33; + case 11: + return this.begin("acc_title"), 34; + case 12: + return this.popState(), "acc_title_value"; + case 13: + return this.begin("acc_descr"), 36; + case 14: + return this.popState(), "acc_descr_value"; + case 15: + this.begin("acc_descr_multiline"); + break; + case 16: + this.popState(); + break; + case 17: + return "acc_descr_multiline_value"; + case 18: + break; + case 19: + c; + break; + case 20: + return 15; + case 21: + break; + case 22: + return 22; + case 23: + return 25; + case 24: + return 26; + case 25: + return 27; + case 26: + return 28; + case 27: + return this.begin("person_ext"), 55; + case 28: + return this.begin("person"), 54; + case 29: + return this.begin("system_ext_queue"), 61; + case 30: + return this.begin("system_ext_db"), 60; + case 31: + return this.begin("system_ext"), 59; + case 32: + return this.begin("system_queue"), 58; + case 33: + return this.begin("system_db"), 57; + case 34: + return this.begin("system"), 56; + case 35: + return this.begin("boundary"), 47; + case 36: + return this.begin("enterprise_boundary"), 44; + case 37: + return this.begin("system_boundary"), 46; + case 38: + return this.begin("container_ext_queue"), 67; + case 39: + return this.begin("container_ext_db"), 66; + case 40: + return this.begin("container_ext"), 65; + case 41: + return this.begin("container_queue"), 64; + case 42: + return this.begin("container_db"), 63; + case 43: + return this.begin("container"), 62; + case 44: + return this.begin("container_boundary"), 48; + case 45: + return this.begin("component_ext_queue"), 73; + case 46: + return this.begin("component_ext_db"), 72; + case 47: + return this.begin("component_ext"), 71; + case 48: + return this.begin("component_queue"), 70; + case 49: + return this.begin("component_db"), 69; + case 50: + return this.begin("component"), 68; + case 51: + return this.begin("node"), 49; + case 52: + return this.begin("node"), 49; + case 53: + return this.begin("node_l"), 50; + case 54: + return this.begin("node_r"), 51; + case 55: + return this.begin("rel"), 74; + case 56: + return this.begin("birel"), 75; + case 57: + return this.begin("rel_u"), 76; + case 58: + return this.begin("rel_u"), 76; + case 59: + return this.begin("rel_d"), 77; + case 60: + return this.begin("rel_d"), 77; + case 61: + return this.begin("rel_l"), 78; + case 62: + return this.begin("rel_l"), 78; + case 63: + return this.begin("rel_r"), 79; + case 64: + return this.begin("rel_r"), 79; + case 65: + return this.begin("rel_b"), 80; + case 66: + return this.begin("rel_index"), 81; + case 67: + return this.begin("update_el_style"), 82; + case 68: + return this.begin("update_rel_style"), 83; + case 69: + return this.begin("update_layout_config"), 84; + case 70: + return "EOF_IN_STRUCT"; + case 71: + return this.begin("attribute"), "ATTRIBUTE_EMPTY"; + case 72: + this.begin("attribute"); + break; + case 73: + this.popState(), this.popState(); + break; + case 74: + return 90; + case 75: + break; + case 76: + return 90; + case 77: + this.begin("string"); + break; + case 78: + this.popState(); + break; + case 79: + return "STR"; + case 80: + this.begin("string_kv"); + break; + case 81: + return this.begin("string_kv_key"), "STR_KEY"; + case 82: + this.popState(), this.begin("string_kv_value"); + break; + case 83: + return "STR_VALUE"; + case 84: + this.popState(), this.popState(); + break; + case 85: + return "STR"; + case 86: + return "LBRACE"; + case 87: + return "RBRACE"; + case 88: + return "SPACE"; + case 89: + return "EOL"; + case 90: + return 24; + } + }, + rules: [/^(?:%%\{)/, /^(?:.*direction\s+TB[^\n]*)/, /^(?:.*direction\s+BT[^\n]*)/, /^(?:.*direction\s+RL[^\n]*)/, /^(?:.*direction\s+LR[^\n]*)/, /^(?:((?:(?!\}%%)[^:.])*))/, /^(?::)/, /^(?:\}%%)/, /^(?:((?:(?!\}%%).|\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: [16, 17], inclusive: !1 }, acc_descr: { rules: [14], inclusive: !1 }, acc_title: { rules: [12], inclusive: !1 }, close_directive: { rules: [], inclusive: !1 }, arg_directive: { rules: [7, 8], inclusive: !1 }, type_directive: { rules: [6, 7], inclusive: !1 }, open_directive: { rules: [5], inclusive: !1 }, string_kv_value: { rules: [83, 84], inclusive: !1 }, string_kv_key: { rules: [82], inclusive: !1 }, string_kv: { rules: [81], inclusive: !1 }, string: { rules: [78, 79], inclusive: !1 }, attribute: { rules: [73, 74, 75, 76, 77, 80, 85], inclusive: !1 }, update_layout_config: { rules: [70, 71, 72, 73], inclusive: !1 }, update_rel_style: { rules: [70, 71, 72, 73], inclusive: !1 }, update_el_style: { rules: [70, 71, 72, 73], inclusive: !1 }, rel_b: { rules: [70, 71, 72, 73], inclusive: !1 }, rel_r: { rules: [70, 71, 72, 73], inclusive: !1 }, rel_l: { rules: [70, 71, 72, 73], inclusive: !1 }, rel_d: { rules: [70, 71, 72, 73], inclusive: !1 }, rel_u: { rules: [70, 71, 72, 73], inclusive: !1 }, rel_bi: { rules: [], inclusive: !1 }, rel: { rules: [70, 71, 72, 73], inclusive: !1 }, node_r: { rules: [70, 71, 72, 73], inclusive: !1 }, node_l: { rules: [70, 71, 72, 73], inclusive: !1 }, node: { rules: [70, 71, 72, 73], inclusive: !1 }, index: { rules: [], inclusive: !1 }, rel_index: { rules: [70, 71, 72, 73], inclusive: !1 }, component_ext_queue: { rules: [], inclusive: !1 }, component_ext_db: { rules: [70, 71, 72, 73], inclusive: !1 }, component_ext: { rules: [70, 71, 72, 73], inclusive: !1 }, component_queue: { rules: [70, 71, 72, 73], inclusive: !1 }, component_db: { rules: [70, 71, 72, 73], inclusive: !1 }, component: { rules: [70, 71, 72, 73], inclusive: !1 }, container_boundary: { rules: [70, 71, 72, 73], inclusive: !1 }, container_ext_queue: { rules: [], inclusive: !1 }, container_ext_db: { rules: [70, 71, 72, 73], inclusive: !1 }, container_ext: { rules: [70, 71, 72, 73], inclusive: !1 }, container_queue: { rules: [70, 71, 72, 73], inclusive: !1 }, container_db: { rules: [70, 71, 72, 73], inclusive: !1 }, container: { rules: [70, 71, 72, 73], inclusive: !1 }, birel: { rules: [70, 71, 72, 73], inclusive: !1 }, system_boundary: { rules: [70, 71, 72, 73], inclusive: !1 }, enterprise_boundary: { rules: [70, 71, 72, 73], inclusive: !1 }, boundary: { rules: [70, 71, 72, 73], inclusive: !1 }, system_ext_queue: { rules: [70, 71, 72, 73], inclusive: !1 }, system_ext_db: { rules: [70, 71, 72, 73], inclusive: !1 }, system_ext: { rules: [70, 71, 72, 73], inclusive: !1 }, system_queue: { rules: [70, 71, 72, 73], inclusive: !1 }, system_db: { rules: [70, 71, 72, 73], inclusive: !1 }, system: { rules: [70, 71, 72, 73], inclusive: !1 }, person_ext: { rules: [70, 71, 72, 73], inclusive: !1 }, person: { rules: [70, 71, 72, 73], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 9, 10, 11, 13, 15, 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, 65, 66, 67, 68, 69, 86, 87, 88, 89, 90], inclusive: !0 } } + }; + return Ot; + }(); + ee.lexer = Le; + function ne() { + this.yy = {}; + } + return ne.prototype = ee, ee.Parser = ne, new ne(); +}(); +qt.parser = qt; +const He = qt; +let j = [], Rt = [""], P = "global", V = "", F = [ + { + alias: "global", + label: { text: "global" }, + type: { text: "global" }, + tags: null, + link: null, + parentBoundary: "" + } +], Ft = [], he = "", ue = !1, Gt = 4, Kt = 2; +var Ae; +const qe = function() { + return Ae; +}, Ge = function(e) { + Ae = ve(e, Ut()); +}, Ke = function(e, t, i) { + Ve.parseDirective(this, e, t, i); +}, Je = function(e, t, i, o, l, n, r, a, s) { + if (e == null || t === void 0 || t === null || i === void 0 || i === null || o === void 0 || o === null) + return; + let u = {}; + const d = Ft.find((y) => y.from === t && y.to === i); + if (d ? u = d : Ft.push(u), u.type = e, u.from = t, u.to = i, u.label = { text: o }, l == null) + u.techn = { text: "" }; + else if (typeof l == "object") { + let [y, p] = Object.entries(l)[0]; + u[y] = { text: p }; + } else + u.techn = { text: l }; + if (n == null) + u.descr = { text: "" }; + else if (typeof n == "object") { + let [y, p] = Object.entries(n)[0]; + u[y] = { text: p }; + } else + u.descr = { text: n }; + if (typeof r == "object") { + let [y, p] = Object.entries(r)[0]; + u[y] = p; + } else + u.sprite = r; + if (typeof a == "object") { + let [y, p] = Object.entries(a)[0]; + u[y] = p; + } else + u.tags = a; + if (typeof s == "object") { + let [y, p] = Object.entries(s)[0]; + u[y] = p; + } else + u.link = s; + u.wrap = St(); +}, Ze = function(e, t, i, o, l, n, r) { + if (t === null || i === null) + return; + let a = {}; + const s = j.find((u) => u.alias === t); + if (s && t === s.alias ? a = s : (a.alias = t, j.push(a)), i == null ? a.label = { text: "" } : a.label = { text: i }, o == null) + a.descr = { text: "" }; + else if (typeof o == "object") { + let [u, d] = Object.entries(o)[0]; + a[u] = { text: d }; + } else + a.descr = { text: o }; + if (typeof l == "object") { + let [u, d] = Object.entries(l)[0]; + a[u] = d; + } else + a.sprite = l; + if (typeof n == "object") { + let [u, d] = Object.entries(n)[0]; + a[u] = d; + } else + a.tags = n; + if (typeof r == "object") { + let [u, d] = Object.entries(r)[0]; + a[u] = d; + } else + a.link = r; + a.typeC4Shape = { text: e }, a.parentBoundary = P, a.wrap = St(); +}, $e = function(e, t, i, o, l, n, r, a) { + if (t === null || i === null) + return; + let s = {}; + const u = j.find((d) => d.alias === t); + if (u && t === u.alias ? s = u : (s.alias = t, j.push(s)), i == null ? s.label = { text: "" } : s.label = { text: i }, o == null) + s.techn = { text: "" }; + else if (typeof o == "object") { + let [d, y] = Object.entries(o)[0]; + s[d] = { text: y }; + } else + s.techn = { text: o }; + if (l == null) + s.descr = { text: "" }; + else if (typeof l == "object") { + let [d, y] = Object.entries(l)[0]; + s[d] = { text: y }; + } else + s.descr = { text: l }; + if (typeof n == "object") { + let [d, y] = Object.entries(n)[0]; + s[d] = y; + } else + s.sprite = n; + if (typeof r == "object") { + let [d, y] = Object.entries(r)[0]; + s[d] = y; + } else + s.tags = r; + if (typeof a == "object") { + let [d, y] = Object.entries(a)[0]; + s[d] = y; + } else + s.link = a; + s.wrap = St(), s.typeC4Shape = { text: e }, s.parentBoundary = P; +}, t0 = function(e, t, i, o, l, n, r, a) { + if (t === null || i === null) + return; + let s = {}; + const u = j.find((d) => d.alias === t); + if (u && t === u.alias ? s = u : (s.alias = t, j.push(s)), i == null ? s.label = { text: "" } : s.label = { text: i }, o == null) + s.techn = { text: "" }; + else if (typeof o == "object") { + let [d, y] = Object.entries(o)[0]; + s[d] = { text: y }; + } else + s.techn = { text: o }; + if (l == null) + s.descr = { text: "" }; + else if (typeof l == "object") { + let [d, y] = Object.entries(l)[0]; + s[d] = { text: y }; + } else + s.descr = { text: l }; + if (typeof n == "object") { + let [d, y] = Object.entries(n)[0]; + s[d] = y; + } else + s.sprite = n; + if (typeof r == "object") { + let [d, y] = Object.entries(r)[0]; + s[d] = y; + } else + s.tags = r; + if (typeof a == "object") { + let [d, y] = Object.entries(a)[0]; + s[d] = y; + } else + s.link = a; + s.wrap = St(), s.typeC4Shape = { text: e }, s.parentBoundary = P; +}, e0 = function(e, t, i, o, l) { + if (e === null || t === null) + return; + let n = {}; + const r = F.find((a) => a.alias === e); + if (r && e === r.alias ? n = r : (n.alias = e, F.push(n)), t == null ? n.label = { text: "" } : n.label = { text: t }, i == null) + n.type = { text: "system" }; + else if (typeof i == "object") { + let [a, s] = Object.entries(i)[0]; + n[a] = { text: s }; + } else + n.type = { text: i }; + if (typeof o == "object") { + let [a, s] = Object.entries(o)[0]; + n[a] = s; + } else + n.tags = o; + if (typeof l == "object") { + let [a, s] = Object.entries(l)[0]; + n[a] = s; + } else + n.link = l; + n.parentBoundary = P, n.wrap = St(), V = P, P = e, Rt.push(V); +}, n0 = function(e, t, i, o, l) { + if (e === null || t === null) + return; + let n = {}; + const r = F.find((a) => a.alias === e); + if (r && e === r.alias ? n = r : (n.alias = e, F.push(n)), t == null ? n.label = { text: "" } : n.label = { text: t }, i == null) + n.type = { text: "container" }; + else if (typeof i == "object") { + let [a, s] = Object.entries(i)[0]; + n[a] = { text: s }; + } else + n.type = { text: i }; + if (typeof o == "object") { + let [a, s] = Object.entries(o)[0]; + n[a] = s; + } else + n.tags = o; + if (typeof l == "object") { + let [a, s] = Object.entries(l)[0]; + n[a] = s; + } else + n.link = l; + n.parentBoundary = P, n.wrap = St(), V = P, P = e, Rt.push(V); +}, i0 = function(e, t, i, o, l, n, r, a) { + if (t === null || i === null) + return; + let s = {}; + const u = F.find((d) => d.alias === t); + if (u && t === u.alias ? s = u : (s.alias = t, F.push(s)), i == null ? s.label = { text: "" } : s.label = { text: i }, o == null) + s.type = { text: "node" }; + else if (typeof o == "object") { + let [d, y] = Object.entries(o)[0]; + s[d] = { text: y }; + } else + s.type = { text: o }; + if (l == null) + s.descr = { text: "" }; + else if (typeof l == "object") { + let [d, y] = Object.entries(l)[0]; + s[d] = { text: y }; + } else + s.descr = { text: l }; + if (typeof r == "object") { + let [d, y] = Object.entries(r)[0]; + s[d] = y; + } else + s.tags = r; + if (typeof a == "object") { + let [d, y] = Object.entries(a)[0]; + s[d] = y; + } else + s.link = a; + s.nodeType = e, s.parentBoundary = P, s.wrap = St(), V = P, P = t, Rt.push(V); +}, s0 = function() { + P = V, Rt.pop(), V = Rt.pop(), Rt.push(V); +}, a0 = function(e, t, i, o, l, n, r, a, s, u, d) { + let y = j.find((p) => p.alias === t); + if (!(y === void 0 && (y = F.find((p) => p.alias === t), y === void 0))) { + if (i != null) + if (typeof i == "object") { + let [p, C] = Object.entries(i)[0]; + y[p] = C; + } else + y.bgColor = i; + if (o != null) + if (typeof o == "object") { + let [p, C] = Object.entries(o)[0]; + y[p] = C; + } else + y.fontColor = o; + if (l != null) + if (typeof l == "object") { + let [p, C] = Object.entries(l)[0]; + y[p] = C; + } else + y.borderColor = l; + if (n != null) + if (typeof n == "object") { + let [p, C] = Object.entries(n)[0]; + y[p] = C; + } else + y.shadowing = n; + if (r != null) + if (typeof r == "object") { + let [p, C] = Object.entries(r)[0]; + y[p] = C; + } else + y.shape = r; + if (a != null) + if (typeof a == "object") { + let [p, C] = Object.entries(a)[0]; + y[p] = C; + } else + y.sprite = a; + if (s != null) + if (typeof s == "object") { + let [p, C] = Object.entries(s)[0]; + y[p] = C; + } else + y.techn = s; + if (u != null) + if (typeof u == "object") { + let [p, C] = Object.entries(u)[0]; + y[p] = C; + } else + y.legendText = u; + if (d != null) + if (typeof d == "object") { + let [p, C] = Object.entries(d)[0]; + y[p] = C; + } else + y.legendSprite = d; + } +}, r0 = function(e, t, i, o, l, n, r) { + const a = Ft.find((s) => s.from === t && s.to === i); + if (a !== void 0) { + if (o != null) + if (typeof o == "object") { + let [s, u] = Object.entries(o)[0]; + a[s] = u; + } else + a.textColor = o; + if (l != null) + if (typeof l == "object") { + let [s, u] = Object.entries(l)[0]; + a[s] = u; + } else + a.lineColor = l; + if (n != null) + if (typeof n == "object") { + let [s, u] = Object.entries(n)[0]; + a[s] = parseInt(u); + } else + a.offsetX = parseInt(n); + if (r != null) + if (typeof r == "object") { + let [s, u] = Object.entries(r)[0]; + a[s] = parseInt(u); + } else + a.offsetY = parseInt(r); + } +}, l0 = function(e, t, i) { + let o = Gt, l = Kt; + if (typeof t == "object") { + const n = Object.values(t)[0]; + o = parseInt(n); + } else + o = parseInt(t); + if (typeof i == "object") { + const n = Object.values(i)[0]; + l = parseInt(n); + } else + l = parseInt(i); + o >= 1 && (Gt = o), l >= 1 && (Kt = l); +}, o0 = function() { + return Gt; +}, c0 = function() { + return Kt; +}, h0 = function() { + return P; +}, u0 = function() { + return V; +}, Ce = function(e) { + return e == null ? j : j.filter((t) => t.parentBoundary === e); +}, d0 = function(e) { + return j.find((t) => t.alias === e); +}, f0 = function(e) { + return Object.keys(Ce(e)); +}, p0 = function(e) { + return e == null ? F : F.filter((t) => t.parentBoundary === e); +}, y0 = function() { + return Ft; +}, g0 = function() { + return he; +}, b0 = function(e) { + ue = e; +}, St = function() { + return ue; +}, _0 = function() { + j = [], F = [ + { + alias: "global", + label: { text: "global" }, + type: { text: "global" }, + tags: null, + link: null, + parentBoundary: "" + } + ], V = "", P = "global", Rt = [""], Ft = [], Rt = [""], he = "", ue = !1, Gt = 4, Kt = 2; +}, x0 = { + 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 +}, m0 = { + FILLED: 0, + OPEN: 1 +}, E0 = { + LEFTOF: 0, + RIGHTOF: 1, + OVER: 2 +}, v0 = function(e) { + he = ve(e, Ut()); +}, we = { + addPersonOrSystem: Ze, + addPersonOrSystemBoundary: e0, + addContainer: $e, + addContainerBoundary: n0, + addComponent: t0, + addDeploymentNode: i0, + popBoundaryParseStack: s0, + addRel: Je, + updateElStyle: a0, + updateRelStyle: r0, + updateLayoutConfig: l0, + autoWrap: St, + setWrap: b0, + getC4ShapeArray: Ce, + getC4Shape: d0, + getC4ShapeKeys: f0, + getBoundarys: p0, + getCurrentBoundaryParse: h0, + getParentBoundaryParse: u0, + getRels: y0, + getTitle: g0, + getC4Type: qe, + getC4ShapeInRow: o0, + getC4BoundaryInRow: c0, + setAccTitle: je, + getAccTitle: Ue, + getAccDescription: Fe, + setAccDescription: ze, + parseDirective: Ke, + getConfig: () => Ut().c4, + clear: _0, + LINETYPE: x0, + ARROWTYPE: m0, + PLACEMENT: E0, + setTitle: v0, + setC4Type: Ge + // apply, +}, de = function(e, t) { + const i = e.append("rect"); + if (i.attr("x", t.x), i.attr("y", t.y), i.attr("fill", t.fill), i.attr("stroke", t.stroke), i.attr("width", t.width), i.attr("height", t.height), i.attr("rx", t.rx), i.attr("ry", t.ry), t.attrs !== "undefined" && t.attrs !== null) + for (let o in t.attrs) + i.attr(o, t.attrs[o]); + return t.class !== "undefined" && i.attr("class", t.class), i; +}, Te = function(e, t, i, o, l, n) { + const r = e.append("image"); + r.attr("width", t), r.attr("height", i), r.attr("x", o), r.attr("y", l); + let a = n.startsWith("data:image/png;base64") ? n : ke(n); + r.attr("xlink:href", a); +}, k0 = (e, t, i) => { + const o = e.append("g"); + let l = 0; + for (let n of t) { + let r = n.textColor ? n.textColor : "#444444", a = n.lineColor ? n.lineColor : "#444444", s = n.offsetX ? parseInt(n.offsetX) : 0, u = n.offsetY ? parseInt(n.offsetY) : 0, d = ""; + if (l === 0) { + let p = o.append("line"); + p.attr("x1", n.startPoint.x), p.attr("y1", n.startPoint.y), p.attr("x2", n.endPoint.x), p.attr("y2", n.endPoint.y), p.attr("stroke-width", "1"), p.attr("stroke", a), p.style("fill", "none"), n.type !== "rel_b" && p.attr("marker-end", "url(" + d + "#arrowhead)"), (n.type === "birel" || n.type === "rel_b") && p.attr("marker-start", "url(" + d + "#arrowend)"), l = -1; + } else { + let p = o.append("path"); + p.attr("fill", "none").attr("stroke-width", "1").attr("stroke", a).attr( + "d", + "Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx", n.startPoint.x).replaceAll("starty", n.startPoint.y).replaceAll( + "controlx", + n.startPoint.x + (n.endPoint.x - n.startPoint.x) / 2 - (n.endPoint.x - n.startPoint.x) / 4 + ).replaceAll("controly", n.startPoint.y + (n.endPoint.y - n.startPoint.y) / 2).replaceAll("stopx", n.endPoint.x).replaceAll("stopy", n.endPoint.y) + ), n.type !== "rel_b" && p.attr("marker-end", "url(" + d + "#arrowhead)"), (n.type === "birel" || n.type === "rel_b") && p.attr("marker-start", "url(" + d + "#arrowend)"); + } + let y = i.messageFont(); + W(i)( + n.label.text, + o, + Math.min(n.startPoint.x, n.endPoint.x) + Math.abs(n.endPoint.x - n.startPoint.x) / 2 + s, + Math.min(n.startPoint.y, n.endPoint.y) + Math.abs(n.endPoint.y - n.startPoint.y) / 2 + u, + n.label.width, + n.label.height, + { fill: r }, + y + ), n.techn && n.techn.text !== "" && (y = i.messageFont(), W(i)( + "[" + n.techn.text + "]", + o, + Math.min(n.startPoint.x, n.endPoint.x) + Math.abs(n.endPoint.x - n.startPoint.x) / 2 + s, + Math.min(n.startPoint.y, n.endPoint.y) + Math.abs(n.endPoint.y - n.startPoint.y) / 2 + i.messageFontSize + 5 + u, + Math.max(n.label.width, n.techn.width), + n.techn.height, + { fill: r, "font-style": "italic" }, + y + )); + } +}, A0 = function(e, t, i) { + const o = e.append("g"); + let l = t.bgColor ? t.bgColor : "none", n = t.borderColor ? t.borderColor : "#444444", r = t.fontColor ? t.fontColor : "black", a = { "stroke-width": 1, "stroke-dasharray": "7.0,7.0" }; + t.nodeType && (a = { "stroke-width": 1 }); + let s = { + x: t.x, + y: t.y, + fill: l, + stroke: n, + width: t.width, + height: t.height, + rx: 2.5, + ry: 2.5, + attrs: a + }; + de(o, s); + let u = i.boundaryFont(); + u.fontWeight = "bold", u.fontSize = u.fontSize + 2, u.fontColor = r, W(i)( + t.label.text, + o, + t.x, + t.y + t.label.Y, + t.width, + t.height, + { fill: "#444444" }, + u + ), t.type && t.type.text !== "" && (u = i.boundaryFont(), u.fontColor = r, W(i)( + t.type.text, + o, + t.x, + t.y + t.type.Y, + t.width, + t.height, + { fill: "#444444" }, + u + )), t.descr && t.descr.text !== "" && (u = i.boundaryFont(), u.fontSize = u.fontSize - 2, u.fontColor = r, W(i)( + t.descr.text, + o, + t.x, + t.y + t.descr.Y, + t.width, + t.height, + { fill: "#444444" }, + u + )); +}, C0 = function(e, t, i) { + var y; + let o = t.bgColor ? t.bgColor : i[t.typeC4Shape.text + "_bg_color"], l = t.borderColor ? t.borderColor : i[t.typeC4Shape.text + "_border_color"], n = t.fontColor ? t.fontColor : "#FFFFFF", r = "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": + r = "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": + r = "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 a = e.append("g"); + a.attr("class", "person-man"); + const s = Oe(); + switch (t.typeC4Shape.text) { + case "person": + case "external_person": + case "system": + case "external_system": + case "container": + case "external_container": + case "component": + case "external_component": + s.x = t.x, s.y = t.y, s.fill = o, s.width = t.width, s.height = t.height, s.stroke = l, s.rx = 2.5, s.ry = 2.5, s.attrs = { "stroke-width": 0.5 }, de(a, s); + break; + case "system_db": + case "external_system_db": + case "container_db": + case "external_container_db": + case "component_db": + case "external_component_db": + a.append("path").attr("fill", o).attr("stroke-width", "0.5").attr("stroke", l).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) + ), a.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", l).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": + a.append("path").attr("fill", o).attr("stroke-width", "0.5").attr("stroke", l).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) + ), a.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", l).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 = L0(i, t.typeC4Shape.text); + switch (a.append("text").attr("fill", n).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": + Te( + a, + 48, + 48, + t.x + t.width / 2 - 24, + t.y + t.image.Y, + r + ); + break; + } + let d = i[t.typeC4Shape.text + "Font"](); + return d.fontWeight = "bold", d.fontSize = d.fontSize + 2, d.fontColor = n, W(i)( + t.label.text, + a, + t.x, + t.y + t.label.Y, + t.width, + t.height, + { fill: n }, + d + ), d = i[t.typeC4Shape.text + "Font"](), d.fontColor = n, t.techn && ((y = t.techn) == null ? void 0 : y.text) !== "" ? W(i)( + t.techn.text, + a, + t.x, + t.y + t.techn.Y, + t.width, + t.height, + { fill: n, "font-style": "italic" }, + d + ) : t.type && t.type.text !== "" && W(i)( + t.type.text, + a, + t.x, + t.y + t.type.Y, + t.width, + t.height, + { fill: n, "font-style": "italic" }, + d + ), t.descr && t.descr.text !== "" && (d = i.personFont(), d.fontColor = n, W(i)( + t.descr.text, + a, + t.x, + t.y + t.descr.Y, + t.width, + t.height, + { fill: n }, + d + )), t.height; +}, w0 = function(e) { + e.append("defs").append("symbol").attr("id", "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" + ); +}, T0 = function(e) { + e.append("defs").append("symbol").attr("id", "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" + ); +}, O0 = function(e) { + e.append("defs").append("symbol").attr("id", "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" + ); +}, R0 = function(e) { + e.append("defs").append("marker").attr("id", "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"); +}, S0 = function(e) { + e.append("defs").append("marker").attr("id", "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"); +}, D0 = function(e) { + e.append("defs").append("marker").attr("id", "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"); +}, P0 = function(e) { + e.append("defs").append("marker").attr("id", "sequencenumber").attr("refX", 15).attr("refY", 15).attr("markerWidth", 60).attr("markerHeight", 40).attr("orient", "auto").append("circle").attr("cx", 15).attr("cy", 15).attr("r", 6); +}, M0 = function(e) { + const i = e.append("defs").append("marker").attr("id", "crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 16).attr("refY", 4); + i.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"), i.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"); +}, Oe = function() { + return { + x: 0, + y: 0, + fill: "#EDF2AE", + stroke: "#666", + width: 100, + anchor: "start", + height: 100, + rx: 0, + ry: 0 + }; +}, L0 = (e, t) => ({ + fontFamily: e[t + "FontFamily"], + fontSize: e[t + "FontSize"], + fontWeight: e[t + "FontWeight"] +}), W = function() { + function e(l, n, r, a, s, u, d) { + const y = n.append("text").attr("x", r + s / 2).attr("y", a + u / 2 + 5).style("text-anchor", "middle").text(l); + o(y, d); + } + function t(l, n, r, a, s, u, d, y) { + const { fontSize: p, fontFamily: C, fontWeight: T } = y, R = l.split(le.lineBreakRegex); + for (let D = 0; D < R.length; D++) { + const L = D * p - p * (R.length - 1) / 2, Y = n.append("text").attr("x", r + s / 2).attr("y", a).style("text-anchor", "middle").attr("dominant-baseline", "middle").style("font-size", p).style("font-weight", T).style("font-family", C); + Y.append("tspan").attr("dy", L).text(R[D]).attr("alignment-baseline", "mathematical"), o(Y, d); + } + } + function i(l, n, r, a, s, u, d, y) { + const p = n.append("switch"), T = p.append("foreignObject").attr("x", r).attr("y", a).attr("width", s).attr("height", u).append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%"); + T.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(l), t(l, p, r, a, s, u, d, y), o(T, d); + } + function o(l, n) { + for (const r in n) + n.hasOwnProperty(r) && l.attr(r, n[r]); + } + return function(l) { + return l.textPlacement === "fo" ? i : l.textPlacement === "old" ? e : t; + }; +}(), U = { + drawRect: de, + drawBoundary: A0, + drawC4Shape: C0, + drawRels: k0, + drawImage: Te, + insertArrowHead: R0, + insertArrowEnd: S0, + insertArrowFilledHead: D0, + insertDynamicNumber: P0, + insertArrowCrossHead: M0, + insertDatabaseIcon: w0, + insertComputerIcon: T0, + insertClockIcon: O0, + getNoteRect: Oe, + sanitizeUrl: ke + // TODO why is this exported? +}; +let Jt = 0, Zt = 0, Re = 4, oe = 2; +qt.yy = we; +let b = {}; +class Se { + constructor(t) { + this.name = "", this.data = {}, this.data.startx = void 0, this.data.stopx = void 0, this.data.starty = void 0, this.data.stopy = void 0, this.data.widthLimit = void 0, this.nextData = {}, this.nextData.startx = void 0, this.nextData.stopx = void 0, this.nextData.starty = void 0, this.nextData.stopy = void 0, this.nextData.cnt = 0, ce(t.db.getConfig()); + } + setData(t, i, o, l) { + this.nextData.startx = this.data.startx = t, this.nextData.stopx = this.data.stopx = i, this.nextData.starty = this.data.starty = o, this.nextData.stopy = this.data.stopy = l; + } + updateVal(t, i, o, l) { + t[i] === void 0 ? t[i] = o : t[i] = l(o, t[i]); + } + insert(t) { + this.nextData.cnt = this.nextData.cnt + 1; + let i = this.nextData.startx === this.nextData.stopx ? this.nextData.stopx + t.margin : this.nextData.stopx + t.margin * 2, o = i + t.width, l = this.nextData.starty + t.margin * 2, n = l + t.height; + (i >= this.data.widthLimit || o >= this.data.widthLimit || this.nextData.cnt > Re) && (i = this.nextData.startx + t.margin + b.nextLinePaddingX, l = this.nextData.stopy + t.margin * 2, this.nextData.stopx = o = i + t.width, this.nextData.starty = this.nextData.stopy, this.nextData.stopy = n = l + t.height, this.nextData.cnt = 1), t.x = i, t.y = l, this.updateVal(this.data, "startx", i, Math.min), this.updateVal(this.data, "starty", l, Math.min), this.updateVal(this.data, "stopx", o, Math.max), this.updateVal(this.data, "stopy", n, Math.max), this.updateVal(this.nextData, "startx", i, Math.min), this.updateVal(this.nextData, "starty", l, Math.min), this.updateVal(this.nextData, "stopx", o, Math.max), this.updateVal(this.nextData, "stopy", n, 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 + }, ce(t.db.getConfig()); + } + bumpLastMargin(t) { + this.data.stopx += t, this.data.stopy += t; + } +} +const ce = function(e) { + Xe(b, e), e.fontFamily && (b.personFontFamily = b.systemFontFamily = b.messageFontFamily = e.fontFamily), e.fontSize && (b.personFontSize = b.systemFontSize = b.messageFontSize = e.fontSize), e.fontWeight && (b.personFontWeight = b.systemFontWeight = b.messageFontWeight = e.fontWeight); +}, jt = (e, t) => ({ + fontFamily: e[t + "FontFamily"], + fontSize: e[t + "FontSize"], + fontWeight: e[t + "FontWeight"] +}), Ht = (e) => ({ + fontFamily: e.boundaryFontFamily, + fontSize: e.boundaryFontSize, + fontWeight: e.boundaryFontWeight +}), N0 = (e) => ({ + fontFamily: e.messageFontFamily, + fontSize: e.messageFontSize, + fontWeight: e.messageFontWeight +}); +function I(e, t, i, o, l) { + if (!t[e].width) + if (i) + t[e].text = Qe(t[e].text, l, o), t[e].textLines = t[e].text.split(le.lineBreakRegex).length, t[e].width = l, t[e].height = xe(t[e].text, o); + else { + let n = t[e].text.split(le.lineBreakRegex); + t[e].textLines = n.length; + let r = 0; + t[e].height = 0, t[e].width = 0; + for (const a of n) + t[e].width = Math.max( + Yt(a, o), + t[e].width + ), r = xe(a, o), t[e].height = t[e].height + r; + } +} +const De = function(e, t, i) { + t.x = i.data.startx, t.y = i.data.starty, t.width = i.data.stopx - i.data.startx, t.height = i.data.stopy - i.data.starty, t.label.y = b.c4ShapeMargin - 35; + let o = t.wrap && b.wrap, l = Ht(b); + l.fontSize = l.fontSize + 2, l.fontWeight = "bold"; + let n = Yt(t.label.text, l); + I("label", t, o, l, n), U.drawBoundary(e, t, b); +}, Pe = function(e, t, i, o) { + let l = 0; + for (const n of o) { + l = 0; + const r = i[n]; + let a = jt(b, r.typeC4Shape.text); + switch (a.fontSize = a.fontSize - 2, r.typeC4Shape.width = Yt( + "<<" + r.typeC4Shape.text + ">>", + a + ), r.typeC4Shape.height = a.fontSize + 2, r.typeC4Shape.Y = b.c4ShapePadding, l = r.typeC4Shape.Y + r.typeC4Shape.height - 4, r.image = { width: 0, height: 0, Y: 0 }, r.typeC4Shape.text) { + case "person": + case "external_person": + r.image.width = 48, r.image.height = 48, r.image.Y = l, l = r.image.Y + r.image.height; + break; + } + r.sprite && (r.image.width = 48, r.image.height = 48, r.image.Y = l, l = r.image.Y + r.image.height); + let s = r.wrap && b.wrap, u = b.width - b.c4ShapePadding * 2, d = jt(b, r.typeC4Shape.text); + if (d.fontSize = d.fontSize + 2, d.fontWeight = "bold", I("label", r, s, d, u), r.label.Y = l + 8, l = r.label.Y + r.label.height, r.type && r.type.text !== "") { + r.type.text = "[" + r.type.text + "]"; + let C = jt(b, r.typeC4Shape.text); + I("type", r, s, C, u), r.type.Y = l + 5, l = r.type.Y + r.type.height; + } else if (r.techn && r.techn.text !== "") { + r.techn.text = "[" + r.techn.text + "]"; + let C = jt(b, r.techn.text); + I("techn", r, s, C, u), r.techn.Y = l + 5, l = r.techn.Y + r.techn.height; + } + let y = l, p = r.label.width; + if (r.descr && r.descr.text !== "") { + let C = jt(b, r.typeC4Shape.text); + I("descr", r, s, C, u), r.descr.Y = l + 20, l = r.descr.Y + r.descr.height, p = Math.max(r.label.width, r.descr.width), y = l - r.descr.textLines * 5; + } + p = p + b.c4ShapePadding, r.width = Math.max(r.width || b.width, p, b.width), r.height = Math.max(r.height || b.height, y, b.height), r.margin = r.margin || b.c4ShapeMargin, e.insert(r), U.drawC4Shape(t, r, b); + } + e.bumpLastMargin(b.c4ShapeMargin); +}; +class B { + constructor(t, i) { + this.x = t, this.y = i; + } +} +let me = function(e, t) { + let i = e.x, o = e.y, l = t.x, n = t.y, r = i + e.width / 2, a = o + e.height / 2, s = Math.abs(i - l), u = Math.abs(o - n), d = u / s, y = e.height / e.width, p = null; + return o == n && i < l ? p = new B(i + e.width, a) : o == n && i > l ? p = new B(i, a) : i == l && o < n ? p = new B(r, o + e.height) : i == l && o > n && (p = new B(r, o)), i > l && o < n ? y >= d ? p = new B(i, a + d * e.width / 2) : p = new B( + r - s / u * e.height / 2, + o + e.height + ) : i < l && o < n ? y >= d ? p = new B(i + e.width, a + d * e.width / 2) : p = new B( + r + s / u * e.height / 2, + o + e.height + ) : i < l && o > n ? y >= d ? p = new B(i + e.width, a - d * e.width / 2) : p = new B(r + e.height / 2 * s / u, o) : i > l && o > n && (y >= d ? p = new B(i, a - e.width / 2 * d) : p = new B(r - e.height / 2 * s / u, o)), p; +}, B0 = function(e, t) { + let i = { x: 0, y: 0 }; + i.x = t.x + t.width / 2, i.y = t.y + t.height / 2; + let o = me(e, i); + i.x = e.x + e.width / 2, i.y = e.y + e.height / 2; + let l = me(t, i); + return { startPoint: o, endPoint: l }; +}; +const Y0 = function(e, t, i, o) { + let l = 0; + for (let n of t) { + l = l + 1; + let r = n.wrap && b.wrap, a = N0(b); + o.db.getC4Type() === "C4Dynamic" && (n.label.text = l + ": " + n.label.text); + let u = Yt(n.label.text, a); + I("label", n, r, a, u), n.techn && n.techn.text !== "" && (u = Yt(n.techn.text, a), I("techn", n, r, a, u)), n.descr && n.descr.text !== "" && (u = Yt(n.descr.text, a), I("descr", n, r, a, u)); + let d = i(n.from), y = i(n.to), p = B0(d, y); + n.startPoint = p.startPoint, n.endPoint = p.endPoint; + } + U.drawRels(e, t, b); +}; +function Me(e, t, i, o, l) { + let n = new Se(l); + n.data.widthLimit = i.data.widthLimit / Math.min(oe, o.length); + for (let [r, a] of o.entries()) { + let s = 0; + a.image = { width: 0, height: 0, Y: 0 }, a.sprite && (a.image.width = 48, a.image.height = 48, a.image.Y = s, s = a.image.Y + a.image.height); + let u = a.wrap && b.wrap, d = Ht(b); + if (d.fontSize = d.fontSize + 2, d.fontWeight = "bold", I( + "label", + a, + u, + d, + n.data.widthLimit + ), a.label.Y = s + 8, s = a.label.Y + a.label.height, a.type && a.type.text !== "") { + a.type.text = "[" + a.type.text + "]"; + let T = Ht(b); + I( + "type", + a, + u, + T, + n.data.widthLimit + ), a.type.Y = s + 5, s = a.type.Y + a.type.height; + } + if (a.descr && a.descr.text !== "") { + let T = Ht(b); + T.fontSize = T.fontSize - 2, I( + "descr", + a, + u, + T, + n.data.widthLimit + ), a.descr.Y = s + 20, s = a.descr.Y + a.descr.height; + } + if (r == 0 || r % oe === 0) { + let T = i.data.startx + b.diagramMarginX, R = i.data.stopy + b.diagramMarginY + s; + n.setData(T, T, R, R); + } else { + let T = n.data.stopx !== n.data.startx ? n.data.stopx + b.diagramMarginX : n.data.startx, R = n.data.starty; + n.setData(T, T, R, R); + } + n.name = a.alias; + let y = l.db.getC4ShapeArray(a.alias), p = l.db.getC4ShapeKeys(a.alias); + p.length > 0 && Pe( + n, + e, + y, + p + ), t = a.alias; + let C = l.db.getBoundarys(t); + C.length > 0 && Me( + e, + t, + n, + C, + l + ), a.alias !== "global" && De(e, a, n), i.data.stopy = Math.max( + n.data.stopy + b.c4ShapeMargin, + i.data.stopy + ), i.data.stopx = Math.max( + n.data.stopx + b.c4ShapeMargin, + i.data.stopx + ), Jt = Math.max(Jt, i.data.stopx), Zt = Math.max(Zt, i.data.stopy); + } +} +const I0 = function(e, t, i, o) { + b = Ut().c4; + const l = Ut().securityLevel; + let n; + l === "sandbox" && (n = Qt("#i" + t)); + const r = l === "sandbox" ? Qt(n.nodes()[0].contentDocument.body) : Qt("body"); + let a = o.db; + o.db.setWrap(b.wrap), Re = a.getC4ShapeInRow(), oe = a.getC4BoundaryInRow(), _e.debug(`C:${JSON.stringify(b, null, 2)}`); + const s = l === "sandbox" ? r.select(`[id="${t}"]`) : Qt(`[id="${t}"]`); + U.insertComputerIcon(s), U.insertDatabaseIcon(s), U.insertClockIcon(s); + let u = new Se(o); + u.setData( + b.diagramMarginX, + b.diagramMarginX, + b.diagramMarginY, + b.diagramMarginY + ), u.data.widthLimit = screen.availWidth, Jt = b.diagramMarginX, Zt = b.diagramMarginY; + const d = o.db.getTitle(); + let y = o.db.getBoundarys(""); + Me(s, "", u, y, o), U.insertArrowHead(s), U.insertArrowEnd(s), U.insertArrowCrossHead(s), U.insertArrowFilledHead(s), Y0(s, o.db.getRels(), o.db.getC4Shape, o), u.data.stopx = Jt, u.data.stopy = Zt; + const p = u.data; + let T = p.stopy - p.starty + 2 * b.diagramMarginY; + const D = p.stopx - p.startx + 2 * b.diagramMarginX; + d && s.append("text").text(d).attr("x", (p.stopx - p.startx) / 2 - 4 * b.diagramMarginX).attr("y", p.starty + b.diagramMarginY), We(s, T, D, b.useMaxWidth); + const L = d ? 60 : 0; + s.attr( + "viewBox", + p.startx - b.diagramMarginX + " -" + (b.diagramMarginY + L) + " " + D + " " + (T + L) + ), _e.debug("models:", p); +}, Ee = { + drawPersonOrSystemArray: Pe, + drawBoundary: De, + setConf: ce, + draw: I0 +}, V0 = (e) => `.person { + stroke: ${e.personBorder}; + fill: ${e.personBkg}; + } +`, j0 = V0, X0 = { + parser: He, + db: we, + renderer: Ee, + styles: j0, + init: (e) => { + Ee.setConf(e.c4); + } +}; +export { + X0 as diagram +}; +//# sourceMappingURL=c4Diagram-d4b415eb.js.map diff --git a/scopegraphs-render-docs/doc/js/classDiagram-634fc78b.js b/scopegraphs-render-docs/doc/js/classDiagram-634fc78b.js new file mode 100644 index 0000000..b089196 --- /dev/null +++ b/scopegraphs-render-docs/doc/js/classDiagram-634fc78b.js @@ -0,0 +1,146 @@ +import { p as parser, d as db, s as styles } from "./styles-16907e1b.js"; +import { select } from "d3"; +import { layout } from "dagre-d3-es/src/dagre/index.js"; +import * as graphlib from "dagre-d3-es/src/graphlib/index.js"; +import { g as getConfig, l as log } from "./commonDb-573409be.js"; +import { s as svgDraw } from "./svgDraw-2526cba0.js"; +import { k as configureSvgSize } from "./utils-d622194a.js"; +import "./mermaidAPI-3ae0f2f0.js"; +import "stylis"; +import "dompurify"; +import "lodash-es/isEmpty.js"; +import "dayjs"; +import "khroma"; +import "@braintree/sanitize-url"; +import "lodash-es/memoize.js"; +let idCache = {}; +const padding = 20; +const getGraphId = function(label) { + const foundEntry = Object.entries(idCache).find((entry) => entry[1].label === label); + if (foundEntry) { + return foundEntry[0]; + } +}; +const insertMarkers = function(elem) { + elem.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z"); + elem.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z"); + elem.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).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"); + elem.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).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"); + elem.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).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"); + elem.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).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"); + elem.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).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"); + elem.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).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"); +}; +const draw = function(text, id, _version, diagObj) { + const conf = getConfig().class; + idCache = {}; + log.info("Rendering diagram " + text); + const securityLevel = getConfig().securityLevel; + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = select("#i" + id); + } + const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body"); + const diagram2 = root.select(`[id='${id}']`); + insertMarkers(diagram2); + const g = new graphlib.Graph({ + multigraph: true + }); + g.setGraph({ + isMultiGraph: true + }); + g.setDefaultEdgeLabel(function() { + return {}; + }); + const classes = diagObj.db.getClasses(); + const keys = Object.keys(classes); + for (const key of keys) { + const classDef = classes[key]; + const node = svgDraw.drawClass(diagram2, classDef, conf, diagObj); + idCache[node.id] = node; + g.setNode(node.id, node); + log.info("Org height: " + node.height); + } + const relations = diagObj.db.getRelations(); + relations.forEach(function(relation) { + log.info( + "tjoho" + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation) + ); + g.setEdge( + getGraphId(relation.id1), + getGraphId(relation.id2), + { + relation + }, + relation.title || "DEFAULT" + ); + }); + const notes = diagObj.db.getNotes(); + notes.forEach(function(note) { + log.debug(`Adding note: ${JSON.stringify(note)}`); + const node = svgDraw.drawNote(diagram2, note, conf, diagObj); + idCache[node.id] = node; + g.setNode(node.id, node); + if (note.class && note.class in classes) { + g.setEdge( + note.id, + getGraphId(note.class), + { + relation: { + id1: note.id, + id2: note.class, + relation: { + type1: "none", + type2: "none", + lineType: 10 + } + } + }, + "DEFAULT" + ); + } + }); + layout(g); + g.nodes().forEach(function(v) { + if (v !== void 0 && g.node(v) !== void 0) { + log.debug("Node " + v + ": " + JSON.stringify(g.node(v))); + root.select("#" + (diagObj.db.lookUpDomId(v) || v)).attr( + "transform", + "translate(" + (g.node(v).x - g.node(v).width / 2) + "," + (g.node(v).y - g.node(v).height / 2) + " )" + ); + } + }); + g.edges().forEach(function(e) { + if (e !== void 0 && g.edge(e) !== void 0) { + log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(g.edge(e))); + svgDraw.drawEdge(diagram2, g.edge(e), g.edge(e).relation, conf, diagObj); + } + }); + const svgBounds = diagram2.node().getBBox(); + const width = svgBounds.width + padding * 2; + const height = svgBounds.height + padding * 2; + configureSvgSize(diagram2, height, width, conf.useMaxWidth); + const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`; + log.debug(`viewBox ${vBox}`); + diagram2.attr("viewBox", vBox); +}; +const renderer = { + draw +}; +const diagram = { + parser, + db, + renderer, + styles, + init: (cnf) => { + if (!cnf.class) { + cnf.class = {}; + } + cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; + db.clear(); + } +}; +export { + diagram +}; +//# sourceMappingURL=classDiagram-634fc78b.js.map diff --git a/scopegraphs-render-docs/doc/js/classDiagram-6d218cdd.js b/scopegraphs-render-docs/doc/js/classDiagram-6d218cdd.js new file mode 100644 index 0000000..8c9f580 --- /dev/null +++ b/scopegraphs-render-docs/doc/js/classDiagram-6d218cdd.js @@ -0,0 +1,140 @@ +import { p as parser, d as db, s as styles } from "./styles-123f2a17.js"; +import { g as getConfig, l as log, h as select } from "./commonDb-89160e91.js"; +import { G as Graph, l as layout } from "./layout-3ff13c4c.js"; +import { s as svgDraw } from "./svgDraw-dd61ddfa.js"; +import { v as configureSvgSize } from "./utils-1aebe9b6.js"; +import "./mermaidAPI-c841a67f.js"; +import "./line-fbe8f138.js"; +import "./array-b7dcf730.js"; +import "./constant-b644328d.js"; +let idCache = {}; +const padding = 20; +const getGraphId = function(label) { + const foundEntry = Object.entries(idCache).find((entry) => entry[1].label === label); + if (foundEntry) { + return foundEntry[0]; + } +}; +const insertMarkers = function(elem) { + elem.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z"); + elem.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z"); + elem.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).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"); + elem.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).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"); + elem.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).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"); + elem.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).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"); + elem.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).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"); + elem.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).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"); +}; +const draw = function(text, id, _version, diagObj) { + const conf = getConfig().class; + idCache = {}; + log.info("Rendering diagram " + text); + const securityLevel = getConfig().securityLevel; + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = select("#i" + id); + } + const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body"); + const diagram2 = root.select(`[id='${id}']`); + insertMarkers(diagram2); + const g = new Graph({ + multigraph: true + }); + g.setGraph({ + isMultiGraph: true + }); + g.setDefaultEdgeLabel(function() { + return {}; + }); + const classes = diagObj.db.getClasses(); + const keys = Object.keys(classes); + for (const key of keys) { + const classDef = classes[key]; + const node = svgDraw.drawClass(diagram2, classDef, conf, diagObj); + idCache[node.id] = node; + g.setNode(node.id, node); + log.info("Org height: " + node.height); + } + const relations = diagObj.db.getRelations(); + relations.forEach(function(relation) { + log.info( + "tjoho" + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation) + ); + g.setEdge( + getGraphId(relation.id1), + getGraphId(relation.id2), + { + relation + }, + relation.title || "DEFAULT" + ); + }); + const notes = diagObj.db.getNotes(); + notes.forEach(function(note) { + log.debug(`Adding note: ${JSON.stringify(note)}`); + const node = svgDraw.drawNote(diagram2, note, conf, diagObj); + idCache[node.id] = node; + g.setNode(node.id, node); + if (note.class && note.class in classes) { + g.setEdge( + note.id, + getGraphId(note.class), + { + relation: { + id1: note.id, + id2: note.class, + relation: { + type1: "none", + type2: "none", + lineType: 10 + } + } + }, + "DEFAULT" + ); + } + }); + layout(g); + g.nodes().forEach(function(v) { + if (v !== void 0 && g.node(v) !== void 0) { + log.debug("Node " + v + ": " + JSON.stringify(g.node(v))); + root.select("#" + (diagObj.db.lookUpDomId(v) || v)).attr( + "transform", + "translate(" + (g.node(v).x - g.node(v).width / 2) + "," + (g.node(v).y - g.node(v).height / 2) + " )" + ); + } + }); + g.edges().forEach(function(e) { + if (e !== void 0 && g.edge(e) !== void 0) { + log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(g.edge(e))); + svgDraw.drawEdge(diagram2, g.edge(e), g.edge(e).relation, conf, diagObj); + } + }); + const svgBounds = diagram2.node().getBBox(); + const width = svgBounds.width + padding * 2; + const height = svgBounds.height + padding * 2; + configureSvgSize(diagram2, height, width, conf.useMaxWidth); + const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`; + log.debug(`viewBox ${vBox}`); + diagram2.attr("viewBox", vBox); +}; +const renderer = { + draw +}; +const diagram = { + parser, + db, + renderer, + styles, + init: (cnf) => { + if (!cnf.class) { + cnf.class = {}; + } + cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; + db.clear(); + } +}; +export { + diagram +}; +//# sourceMappingURL=classDiagram-6d218cdd.js.map diff --git a/scopegraphs-render-docs/doc/js/classDiagram-7b4b2ee6.js b/scopegraphs-render-docs/doc/js/classDiagram-7b4b2ee6.js new file mode 100644 index 0000000..f912d87 --- /dev/null +++ b/scopegraphs-render-docs/doc/js/classDiagram-7b4b2ee6.js @@ -0,0 +1,94 @@ +import { p as W, d as M, s as H } from "./styles-b64b35cd.js"; +import { g as S, l as d, h as u } from "./commonDb-41f8b4c5.js"; +import { G as X, l as Y } from "./layout-492ec81d.js"; +import { s as l } from "./svgDraw-0a992cdb.js"; +import { v as Z } from "./utils-8ea37061.js"; +import "./mermaidAPI-67f627de.js"; +import "./line-05ccbb85.js"; +import "./array-2ff2c7a6.js"; +import "./constant-2fe7eae5.js"; +let h = {}; +const g = 20, p = function(e) { + const s = Object.entries(h).find((k) => k[1].label === e); + if (s) + return s[0]; +}, D = function(e) { + e.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).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", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z"), e.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).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", "compositionEnd").attr("refX", 19).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"), e.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).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", "aggregationEnd").attr("refX", 19).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"), e.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).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", "dependencyEnd").attr("refX", 19).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"); +}, $ = function(e, s, k, a) { + const f = S().class; + h = {}, d.info("Rendering diagram " + e); + const L = S().securityLevel; + let y; + L === "sandbox" && (y = u("#i" + s)); + const x = L === "sandbox" ? u(y.nodes()[0].contentDocument.body) : u("body"), n = x.select(`[id='${s}']`); + D(n); + const r = new X({ + multigraph: !0 + }); + r.setGraph({ + isMultiGraph: !0 + }), r.setDefaultEdgeLabel(function() { + return {}; + }); + const m = a.db.getClasses(), N = Object.keys(m); + for (const t of N) { + const o = m[t], i = l.drawClass(n, o, f, a); + h[i.id] = i, r.setNode(i.id, i), d.info("Org height: " + i.height); + } + a.db.getRelations().forEach(function(t) { + d.info( + "tjoho" + p(t.id1) + p(t.id2) + JSON.stringify(t) + ), r.setEdge( + p(t.id1), + p(t.id2), + { + relation: t + }, + t.title || "DEFAULT" + ); + }), a.db.getNotes().forEach(function(t) { + d.debug(`Adding note: ${JSON.stringify(t)}`); + const o = l.drawNote(n, t, f, a); + h[o.id] = o, r.setNode(o.id, o), t.class && t.class in m && r.setEdge( + t.id, + p(t.class), + { + relation: { + id1: t.id, + id2: t.class, + relation: { + type1: "none", + type2: "none", + lineType: 10 + } + } + }, + "DEFAULT" + ); + }), Y(r), r.nodes().forEach(function(t) { + t !== void 0 && r.node(t) !== void 0 && (d.debug("Node " + t + ": " + JSON.stringify(r.node(t))), x.select("#" + (a.db.lookUpDomId(t) || t)).attr( + "transform", + "translate(" + (r.node(t).x - r.node(t).width / 2) + "," + (r.node(t).y - r.node(t).height / 2) + " )" + )); + }), r.edges().forEach(function(t) { + t !== void 0 && r.edge(t) !== void 0 && (d.debug("Edge " + t.v + " -> " + t.w + ": " + JSON.stringify(r.edge(t))), l.drawEdge(n, r.edge(t), r.edge(t).relation, f, a)); + }); + const c = n.node().getBBox(), E = c.width + g * 2, b = c.height + g * 2; + Z(n, b, E, f.useMaxWidth); + const w = `${c.x - g} ${c.y - g} ${E} ${b}`; + d.debug(`viewBox ${w}`), n.attr("viewBox", w); +}, B = { + draw: $ +}, z = { + parser: W, + db: M, + renderer: B, + styles: H, + init: (e) => { + e.class || (e.class = {}), e.class.arrowMarkerAbsolute = e.arrowMarkerAbsolute, M.clear(); + } +}; +export { + z as diagram +}; +//# sourceMappingURL=classDiagram-7b4b2ee6.js.map diff --git a/scopegraphs-render-docs/doc/js/classDiagram-v2-556a8c31.js b/scopegraphs-render-docs/doc/js/classDiagram-v2-556a8c31.js new file mode 100644 index 0000000..9f7936d --- /dev/null +++ b/scopegraphs-render-docs/doc/js/classDiagram-v2-556a8c31.js @@ -0,0 +1,198 @@ +import { p as M, d as k, s as B } from "./styles-b64b35cd.js"; +import { l as p, g as r, h as v, f as C } from "./commonDb-41f8b4c5.js"; +import { G as R } from "./layout-492ec81d.js"; +import { r as G } from "./index-6271e032.js"; +import { u as I, B as _, A as D, y as A, z } from "./utils-8ea37061.js"; +import "./mermaidAPI-67f627de.js"; +import "./edges-de377bae.js"; +import "./createText-23817c58.js"; +import "./svgDraw-0a992cdb.js"; +import "./line-05ccbb85.js"; +import "./array-2ff2c7a6.js"; +import "./constant-2fe7eae5.js"; +const E = (o) => C.sanitizeText(o, r()); +let S = { + dividerMargin: 10, + padding: 5, + textHeight: 10, + curve: void 0 +}; +const $ = function(o, l, b, a) { + const e = Object.keys(o); + p.info("keys:", e), p.info(o), e.forEach(function(s) { + var y, f; + const t = o[s]; + let i = ""; + t.cssClasses.length > 0 && (i = i + " " + t.cssClasses.join(" ")); + const n = { labelStyle: "", style: "" }, m = t.label ?? t.id, c = 0, u = "class_box", d = { + labelStyle: n.labelStyle, + shape: u, + labelText: E(m), + classData: t, + rx: c, + ry: c, + class: i, + style: n.style, + id: t.id, + domId: t.domId, + tooltip: a.db.getTooltip(t.id) || "", + haveCallback: t.haveCallback, + link: t.link, + width: t.type === "group" ? 500 : void 0, + type: t.type, + // TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release + padding: ((y = r().flowchart) == null ? void 0 : y.padding) ?? ((f = r().class) == null ? void 0 : f.padding) + }; + l.setNode(t.id, d), p.info("setNode", d); + }); +}, q = function(o, l, b, a) { + p.info(o), o.forEach(function(e, s) { + var x, h; + const t = e, i = "", n = { labelStyle: "", style: "" }, m = t.text, c = 0, u = "note", d = { + labelStyle: n.labelStyle, + shape: u, + labelText: E(m), + noteData: t, + rx: c, + ry: c, + class: i, + style: n.style, + id: t.id, + domId: t.id, + tooltip: "", + type: "note", + // TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release + padding: ((x = r().flowchart) == null ? void 0 : x.padding) ?? ((h = r().class) == null ? void 0 : h.padding) + }; + if (l.setNode(t.id, d), p.info("setNode", d), !t.class || !(t.class in a)) + return; + const y = b + s, f = { + id: `edgeNote${y}`, + //Set relationship style and line type + classes: "relation", + pattern: "dotted", + // Set link type for rendering + arrowhead: "none", + //Set edge extra labels + startLabelRight: "", + endLabelLeft: "", + //Set relation arrow types + arrowTypeStart: "none", + arrowTypeEnd: "none", + style: "fill:none", + labelStyle: "", + curve: D(S.curve, A) + }; + l.setEdge(t.id, t.class, f, y); + }); +}, F = function(o, l) { + const b = r().flowchart; + let a = 0; + o.forEach(function(e) { + var t; + a++; + const s = { + //Set relationship style and line type + classes: "relation", + pattern: e.relation.lineType == 1 ? "dashed" : "solid", + id: "id" + a, + // Set link type for rendering + arrowhead: e.type === "arrow_open" ? "none" : "normal", + //Set edge extra labels + startLabelRight: e.relationTitle1 === "none" ? "" : e.relationTitle1, + endLabelLeft: e.relationTitle2 === "none" ? "" : e.relationTitle2, + //Set relation arrow types + arrowTypeStart: L(e.relation.type1), + arrowTypeEnd: L(e.relation.type2), + style: "fill:none", + labelStyle: "", + curve: D(b == null ? void 0 : b.curve, A) + }; + if (p.info(s, e), e.style !== void 0) { + const i = z(e.style); + s.style = i.style, s.labelStyle = i.labelStyle; + } + e.text = e.title, e.text === void 0 ? e.style !== void 0 && (s.arrowheadStyle = "fill: #333") : (s.arrowheadStyle = "fill: #333", s.labelpos = "c", ((t = r().flowchart) == null ? void 0 : t.htmlLabels) ?? r().htmlLabels ? (s.labelType = "html", s.label = '' + e.text + "") : (s.labelType = "text", s.label = e.text.replace(C.lineBreakRegex, ` +`), e.style === void 0 && (s.style = s.style || "stroke: #333; stroke-width: 1.5px;fill:none"), s.labelStyle = s.labelStyle.replace("color:", "fill:"))), l.setEdge(e.id1, e.id2, s, a); + }); +}, H = function(o) { + S = { + ...S, + ...o + }; +}, P = function(o, l, b, a) { + p.info("Drawing class - ", l); + const e = r().flowchart ?? r().class, s = r().securityLevel; + p.info("config:", e); + const t = (e == null ? void 0 : e.nodeSpacing) ?? 50, i = (e == null ? void 0 : e.rankSpacing) ?? 50, n = new R({ + multigraph: !0, + compound: !0 + }).setGraph({ + rankdir: a.db.getDirection(), + nodesep: t, + ranksep: i, + marginx: 8, + marginy: 8 + }).setDefaultEdgeLabel(function() { + return {}; + }), m = a.db.getClasses(), c = a.db.getRelations(), u = a.db.getNotes(); + p.info(c), $(m, n, l, a), F(c, n), q(u, n, c.length + 1, m); + let d; + s === "sandbox" && (d = v("#i" + l)); + const y = s === "sandbox" ? ( + // @ts-ignore Ignore type error for now + v(d.nodes()[0].contentDocument.body) + ) : v("body"), f = y.select(`[id="${l}"]`), x = y.select("#" + l + " g"); + if (G( + x, + n, + ["aggregation", "extension", "composition", "dependency", "lollipop"], + "classDiagram", + l + ), I.insertTitle(f, "classTitleText", (e == null ? void 0 : e.titleTopMargin) ?? 5, a.db.getDiagramTitle()), _(n, f, e == null ? void 0 : e.diagramPadding, e == null ? void 0 : e.useMaxWidth), !(e != null && e.htmlLabels)) { + const h = s === "sandbox" ? d.nodes()[0].contentDocument : document, N = h.querySelectorAll('[id="' + l + '"] .edgeLabel .label'); + for (const w of N) { + const T = w.getBBox(), g = h.createElementNS("http://www.w3.org/2000/svg", "rect"); + g.setAttribute("rx", 0), g.setAttribute("ry", 0), g.setAttribute("width", T.width), g.setAttribute("height", T.height), w.insertBefore(g, w.firstChild); + } + } +}; +function L(o) { + let l; + switch (o) { + case 0: + l = "aggregation"; + break; + case 1: + l = "extension"; + break; + case 2: + l = "composition"; + break; + case 3: + l = "dependency"; + break; + case 4: + l = "lollipop"; + break; + default: + l = "none"; + } + return l; +} +const V = { + setConf: H, + draw: P +}, se = { + parser: M, + db: k, + renderer: V, + styles: B, + init: (o) => { + o.class || (o.class = {}), o.class.arrowMarkerAbsolute = o.arrowMarkerAbsolute, k.clear(); + } +}; +export { + se as diagram +}; +//# sourceMappingURL=classDiagram-v2-556a8c31.js.map diff --git a/scopegraphs-render-docs/doc/js/classDiagram-v2-6aaa1e9f.js b/scopegraphs-render-docs/doc/js/classDiagram-v2-6aaa1e9f.js new file mode 100644 index 0000000..3355b68 --- /dev/null +++ b/scopegraphs-render-docs/doc/js/classDiagram-v2-6aaa1e9f.js @@ -0,0 +1,270 @@ +import { p as parser, d as db, s as styles } from "./styles-123f2a17.js"; +import { l as log, g as getConfig, h as select, f as common } from "./commonDb-89160e91.js"; +import { G as Graph } from "./layout-3ff13c4c.js"; +import { r as render } from "./index-c47ff54b.js"; +import { u as utils, B as setupGraphViewbox, A as interpolateToCurve, y as curveLinear, z as getStylesFromArray } from "./utils-1aebe9b6.js"; +import "./mermaidAPI-c841a67f.js"; +import "./edges-17d4be60.js"; +import "./createText-b0d5c0ec.js"; +import "./svgDraw-dd61ddfa.js"; +import "./line-fbe8f138.js"; +import "./array-b7dcf730.js"; +import "./constant-b644328d.js"; +const sanitizeText = (txt) => common.sanitizeText(txt, getConfig()); +let conf = { + dividerMargin: 10, + padding: 5, + textHeight: 10, + curve: void 0 +}; +const addClasses = function(classes, g, _id, diagObj) { + const keys = Object.keys(classes); + log.info("keys:", keys); + log.info(classes); + keys.forEach(function(id) { + var _a, _b; + const vertex = classes[id]; + let cssClassStr = ""; + if (vertex.cssClasses.length > 0) { + cssClassStr = cssClassStr + " " + vertex.cssClasses.join(" "); + } + const styles2 = { labelStyle: "", style: "" }; + const vertexText = vertex.label ?? vertex.id; + const radius = 0; + const shape = "class_box"; + const node = { + labelStyle: styles2.labelStyle, + shape, + labelText: sanitizeText(vertexText), + classData: vertex, + rx: radius, + ry: radius, + class: cssClassStr, + style: styles2.style, + id: vertex.id, + domId: vertex.domId, + tooltip: diagObj.db.getTooltip(vertex.id) || "", + haveCallback: vertex.haveCallback, + link: vertex.link, + width: vertex.type === "group" ? 500 : void 0, + type: vertex.type, + // TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release + padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding) + }; + g.setNode(vertex.id, node); + log.info("setNode", node); + }); +}; +const addNotes = function(notes, g, startEdgeId, classes) { + log.info(notes); + notes.forEach(function(note, i) { + var _a, _b; + const vertex = note; + const cssNoteStr = ""; + const styles2 = { labelStyle: "", style: "" }; + const vertexText = vertex.text; + const radius = 0; + const shape = "note"; + const node = { + labelStyle: styles2.labelStyle, + shape, + labelText: sanitizeText(vertexText), + noteData: vertex, + rx: radius, + ry: radius, + class: cssNoteStr, + style: styles2.style, + id: vertex.id, + domId: vertex.id, + tooltip: "", + type: "note", + // TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release + padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding) + }; + g.setNode(vertex.id, node); + log.info("setNode", node); + if (!vertex.class || !(vertex.class in classes)) { + return; + } + const edgeId = startEdgeId + i; + const edgeData = { + id: `edgeNote${edgeId}`, + //Set relationship style and line type + classes: "relation", + pattern: "dotted", + // Set link type for rendering + arrowhead: "none", + //Set edge extra labels + startLabelRight: "", + endLabelLeft: "", + //Set relation arrow types + arrowTypeStart: "none", + arrowTypeEnd: "none", + style: "fill:none", + labelStyle: "", + curve: interpolateToCurve(conf.curve, curveLinear) + }; + g.setEdge(vertex.id, vertex.class, edgeData, edgeId); + }); +}; +const addRelations = function(relations, g) { + const conf2 = getConfig().flowchart; + let cnt = 0; + relations.forEach(function(edge) { + var _a; + cnt++; + const edgeData = { + //Set relationship style and line type + classes: "relation", + pattern: edge.relation.lineType == 1 ? "dashed" : "solid", + id: "id" + cnt, + // Set link type for rendering + arrowhead: edge.type === "arrow_open" ? "none" : "normal", + //Set edge extra labels + startLabelRight: edge.relationTitle1 === "none" ? "" : edge.relationTitle1, + endLabelLeft: edge.relationTitle2 === "none" ? "" : edge.relationTitle2, + //Set relation arrow types + arrowTypeStart: getArrowMarker(edge.relation.type1), + arrowTypeEnd: getArrowMarker(edge.relation.type2), + style: "fill:none", + labelStyle: "", + curve: interpolateToCurve(conf2 == null ? void 0 : conf2.curve, curveLinear) + }; + log.info(edgeData, edge); + if (edge.style !== void 0) { + const styles2 = getStylesFromArray(edge.style); + edgeData.style = styles2.style; + edgeData.labelStyle = styles2.labelStyle; + } + edge.text = edge.title; + if (edge.text === void 0) { + if (edge.style !== void 0) { + edgeData.arrowheadStyle = "fill: #333"; + } + } else { + edgeData.arrowheadStyle = "fill: #333"; + edgeData.labelpos = "c"; + if (((_a = getConfig().flowchart) == null ? void 0 : _a.htmlLabels) ?? getConfig().htmlLabels) { + edgeData.labelType = "html"; + edgeData.label = '' + edge.text + ""; + } else { + edgeData.labelType = "text"; + edgeData.label = edge.text.replace(common.lineBreakRegex, "\n"); + if (edge.style === void 0) { + edgeData.style = edgeData.style || "stroke: #333; stroke-width: 1.5px;fill:none"; + } + edgeData.labelStyle = edgeData.labelStyle.replace("color:", "fill:"); + } + } + g.setEdge(edge.id1, edge.id2, edgeData, cnt); + }); +}; +const setConf = function(cnf) { + conf = { + ...conf, + ...cnf + }; +}; +const draw = function(text, id, _version, diagObj) { + log.info("Drawing class - ", id); + const conf2 = getConfig().flowchart ?? getConfig().class; + const securityLevel = getConfig().securityLevel; + log.info("config:", conf2); + const nodeSpacing = (conf2 == null ? void 0 : conf2.nodeSpacing) ?? 50; + const rankSpacing = (conf2 == null ? void 0 : conf2.rankSpacing) ?? 50; + const g = new Graph({ + multigraph: true, + compound: true + }).setGraph({ + rankdir: diagObj.db.getDirection(), + nodesep: nodeSpacing, + ranksep: rankSpacing, + marginx: 8, + marginy: 8 + }).setDefaultEdgeLabel(function() { + return {}; + }); + const classes = diagObj.db.getClasses(); + const relations = diagObj.db.getRelations(); + const notes = diagObj.db.getNotes(); + log.info(relations); + addClasses(classes, g, id, diagObj); + addRelations(relations, g); + addNotes(notes, g, relations.length + 1, classes); + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = select("#i" + id); + } + const root = securityLevel === "sandbox" ? ( + // @ts-ignore Ignore type error for now + select(sandboxElement.nodes()[0].contentDocument.body) + ) : select("body"); + const svg = root.select(`[id="${id}"]`); + const element = root.select("#" + id + " g"); + render( + element, + g, + ["aggregation", "extension", "composition", "dependency", "lollipop"], + "classDiagram", + id + ); + utils.insertTitle(svg, "classTitleText", (conf2 == null ? void 0 : conf2.titleTopMargin) ?? 5, diagObj.db.getDiagramTitle()); + setupGraphViewbox(g, svg, conf2 == null ? void 0 : conf2.diagramPadding, conf2 == null ? void 0 : conf2.useMaxWidth); + if (!(conf2 == null ? void 0 : conf2.htmlLabels)) { + const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document; + const labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label'); + for (const label of labels) { + const dim = label.getBBox(); + const rect = doc.createElementNS("http://www.w3.org/2000/svg", "rect"); + rect.setAttribute("rx", 0); + rect.setAttribute("ry", 0); + rect.setAttribute("width", dim.width); + rect.setAttribute("height", dim.height); + label.insertBefore(rect, label.firstChild); + } + } +}; +function getArrowMarker(type) { + let marker; + switch (type) { + case 0: + marker = "aggregation"; + break; + case 1: + marker = "extension"; + break; + case 2: + marker = "composition"; + break; + case 3: + marker = "dependency"; + break; + case 4: + marker = "lollipop"; + break; + default: + marker = "none"; + } + return marker; +} +const renderer = { + setConf, + draw +}; +const diagram = { + parser, + db, + renderer, + styles, + init: (cnf) => { + if (!cnf.class) { + cnf.class = {}; + } + cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; + db.clear(); + } +}; +export { + diagram +}; +//# sourceMappingURL=classDiagram-v2-6aaa1e9f.js.map diff --git a/scopegraphs-render-docs/doc/js/classDiagram-v2-72bddc41.js b/scopegraphs-render-docs/doc/js/classDiagram-v2-72bddc41.js new file mode 100644 index 0000000..dd46f85 --- /dev/null +++ b/scopegraphs-render-docs/doc/js/classDiagram-v2-72bddc41.js @@ -0,0 +1,278 @@ +import { p as parser, d as db, s as styles } from "./styles-16907e1b.js"; +import { select, curveLinear } from "d3"; +import * as graphlib from "dagre-d3-es/src/graphlib/index.js"; +import { l as log, g as getConfig, e as common } from "./commonDb-573409be.js"; +import { r as render } from "./index-5219d011.js"; +import { u as utils, s as setupGraphViewbox, o as interpolateToCurve, n as getStylesFromArray } from "./utils-d622194a.js"; +import "./mermaidAPI-3ae0f2f0.js"; +import "stylis"; +import "dompurify"; +import "lodash-es/isEmpty.js"; +import "dayjs"; +import "khroma"; +import "dagre-d3-es/src/dagre/index.js"; +import "dagre-d3-es/src/graphlib/json.js"; +import "./edges-2e77835f.js"; +import "./createText-1f5f8f92.js"; +import "@khanacademy/simple-markdown"; +import "./svgDraw-2526cba0.js"; +import "@braintree/sanitize-url"; +import "lodash-es/memoize.js"; +const sanitizeText = (txt) => common.sanitizeText(txt, getConfig()); +let conf = { + dividerMargin: 10, + padding: 5, + textHeight: 10, + curve: void 0 +}; +const addClasses = function(classes, g, _id, diagObj) { + const keys = Object.keys(classes); + log.info("keys:", keys); + log.info(classes); + keys.forEach(function(id) { + var _a, _b; + const vertex = classes[id]; + let cssClassStr = ""; + if (vertex.cssClasses.length > 0) { + cssClassStr = cssClassStr + " " + vertex.cssClasses.join(" "); + } + const styles2 = { labelStyle: "", style: "" }; + const vertexText = vertex.label ?? vertex.id; + const radius = 0; + const shape = "class_box"; + const node = { + labelStyle: styles2.labelStyle, + shape, + labelText: sanitizeText(vertexText), + classData: vertex, + rx: radius, + ry: radius, + class: cssClassStr, + style: styles2.style, + id: vertex.id, + domId: vertex.domId, + tooltip: diagObj.db.getTooltip(vertex.id) || "", + haveCallback: vertex.haveCallback, + link: vertex.link, + width: vertex.type === "group" ? 500 : void 0, + type: vertex.type, + // TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release + padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding) + }; + g.setNode(vertex.id, node); + log.info("setNode", node); + }); +}; +const addNotes = function(notes, g, startEdgeId, classes) { + log.info(notes); + notes.forEach(function(note, i) { + var _a, _b; + const vertex = note; + const cssNoteStr = ""; + const styles2 = { labelStyle: "", style: "" }; + const vertexText = vertex.text; + const radius = 0; + const shape = "note"; + const node = { + labelStyle: styles2.labelStyle, + shape, + labelText: sanitizeText(vertexText), + noteData: vertex, + rx: radius, + ry: radius, + class: cssNoteStr, + style: styles2.style, + id: vertex.id, + domId: vertex.id, + tooltip: "", + type: "note", + // TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release + padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding) + }; + g.setNode(vertex.id, node); + log.info("setNode", node); + if (!vertex.class || !(vertex.class in classes)) { + return; + } + const edgeId = startEdgeId + i; + const edgeData = { + id: `edgeNote${edgeId}`, + //Set relationship style and line type + classes: "relation", + pattern: "dotted", + // Set link type for rendering + arrowhead: "none", + //Set edge extra labels + startLabelRight: "", + endLabelLeft: "", + //Set relation arrow types + arrowTypeStart: "none", + arrowTypeEnd: "none", + style: "fill:none", + labelStyle: "", + curve: interpolateToCurve(conf.curve, curveLinear) + }; + g.setEdge(vertex.id, vertex.class, edgeData, edgeId); + }); +}; +const addRelations = function(relations, g) { + const conf2 = getConfig().flowchart; + let cnt = 0; + relations.forEach(function(edge) { + var _a; + cnt++; + const edgeData = { + //Set relationship style and line type + classes: "relation", + pattern: edge.relation.lineType == 1 ? "dashed" : "solid", + id: "id" + cnt, + // Set link type for rendering + arrowhead: edge.type === "arrow_open" ? "none" : "normal", + //Set edge extra labels + startLabelRight: edge.relationTitle1 === "none" ? "" : edge.relationTitle1, + endLabelLeft: edge.relationTitle2 === "none" ? "" : edge.relationTitle2, + //Set relation arrow types + arrowTypeStart: getArrowMarker(edge.relation.type1), + arrowTypeEnd: getArrowMarker(edge.relation.type2), + style: "fill:none", + labelStyle: "", + curve: interpolateToCurve(conf2 == null ? void 0 : conf2.curve, curveLinear) + }; + log.info(edgeData, edge); + if (edge.style !== void 0) { + const styles2 = getStylesFromArray(edge.style); + edgeData.style = styles2.style; + edgeData.labelStyle = styles2.labelStyle; + } + edge.text = edge.title; + if (edge.text === void 0) { + if (edge.style !== void 0) { + edgeData.arrowheadStyle = "fill: #333"; + } + } else { + edgeData.arrowheadStyle = "fill: #333"; + edgeData.labelpos = "c"; + if (((_a = getConfig().flowchart) == null ? void 0 : _a.htmlLabels) ?? getConfig().htmlLabels) { + edgeData.labelType = "html"; + edgeData.label = '' + edge.text + ""; + } else { + edgeData.labelType = "text"; + edgeData.label = edge.text.replace(common.lineBreakRegex, "\n"); + if (edge.style === void 0) { + edgeData.style = edgeData.style || "stroke: #333; stroke-width: 1.5px;fill:none"; + } + edgeData.labelStyle = edgeData.labelStyle.replace("color:", "fill:"); + } + } + g.setEdge(edge.id1, edge.id2, edgeData, cnt); + }); +}; +const setConf = function(cnf) { + conf = { + ...conf, + ...cnf + }; +}; +const draw = function(text, id, _version, diagObj) { + log.info("Drawing class - ", id); + const conf2 = getConfig().flowchart ?? getConfig().class; + const securityLevel = getConfig().securityLevel; + log.info("config:", conf2); + const nodeSpacing = (conf2 == null ? void 0 : conf2.nodeSpacing) ?? 50; + const rankSpacing = (conf2 == null ? void 0 : conf2.rankSpacing) ?? 50; + const g = new graphlib.Graph({ + multigraph: true, + compound: true + }).setGraph({ + rankdir: diagObj.db.getDirection(), + nodesep: nodeSpacing, + ranksep: rankSpacing, + marginx: 8, + marginy: 8 + }).setDefaultEdgeLabel(function() { + return {}; + }); + const classes = diagObj.db.getClasses(); + const relations = diagObj.db.getRelations(); + const notes = diagObj.db.getNotes(); + log.info(relations); + addClasses(classes, g, id, diagObj); + addRelations(relations, g); + addNotes(notes, g, relations.length + 1, classes); + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = select("#i" + id); + } + const root = securityLevel === "sandbox" ? ( + // @ts-ignore Ignore type error for now + select(sandboxElement.nodes()[0].contentDocument.body) + ) : select("body"); + const svg = root.select(`[id="${id}"]`); + const element = root.select("#" + id + " g"); + render( + element, + g, + ["aggregation", "extension", "composition", "dependency", "lollipop"], + "classDiagram", + id + ); + utils.insertTitle(svg, "classTitleText", (conf2 == null ? void 0 : conf2.titleTopMargin) ?? 5, diagObj.db.getDiagramTitle()); + setupGraphViewbox(g, svg, conf2 == null ? void 0 : conf2.diagramPadding, conf2 == null ? void 0 : conf2.useMaxWidth); + if (!(conf2 == null ? void 0 : conf2.htmlLabels)) { + const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document; + const labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label'); + for (const label of labels) { + const dim = label.getBBox(); + const rect = doc.createElementNS("http://www.w3.org/2000/svg", "rect"); + rect.setAttribute("rx", 0); + rect.setAttribute("ry", 0); + rect.setAttribute("width", dim.width); + rect.setAttribute("height", dim.height); + label.insertBefore(rect, label.firstChild); + } + } +}; +function getArrowMarker(type) { + let marker; + switch (type) { + case 0: + marker = "aggregation"; + break; + case 1: + marker = "extension"; + break; + case 2: + marker = "composition"; + break; + case 3: + marker = "dependency"; + break; + case 4: + marker = "lollipop"; + break; + default: + marker = "none"; + } + return marker; +} +const renderer = { + setConf, + draw +}; +const diagram = { + parser, + db, + renderer, + styles, + init: (cnf) => { + if (!cnf.class) { + cnf.class = {}; + } + cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; + db.clear(); + } +}; +export { + diagram +}; +//# sourceMappingURL=classDiagram-v2-72bddc41.js.map diff --git a/scopegraphs-render-docs/doc/js/commonDb-41f8b4c5.js b/scopegraphs-render-docs/doc/js/commonDb-41f8b4c5.js new file mode 100644 index 0000000..2804d96 --- /dev/null +++ b/scopegraphs-render-docs/doc/js/commonDb-41f8b4c5.js @@ -0,0 +1,5186 @@ +var Do = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; +function mh(t) { + return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; +} +var xi = {}, Ro = { + get exports() { + return xi; + }, + set exports(t) { + xi = t; + } +}; +(function(t, e) { + (function(i, r) { + t.exports = r(); + })(Do, function() { + var i = 1e3, r = 6e4, o = 36e5, n = "millisecond", s = "second", l = "minute", h = "hour", u = "day", f = "week", g = "month", x = "quarter", _ = "year", M = "date", z = "Invalid Date", j = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, Ot = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, nt = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(k) { + var y = ["th", "st", "nd", "rd"], p = k % 100; + return "[" + k + (y[(p - 20) % 10] || y[p] || y[0]) + "]"; + } }, Q = function(k, y, p) { + var B = String(k); + return !B || B.length >= y ? k : "" + Array(y + 1 - B.length).join(p) + k; + }, H = { s: Q, z: function(k) { + var y = -k.utcOffset(), p = Math.abs(y), B = Math.floor(p / 60), b = p % 60; + return (y <= 0 ? "+" : "-") + Q(B, 2, "0") + ":" + Q(b, 2, "0"); + }, m: function k(y, p) { + if (y.date() < p.date()) + return -k(p, y); + var B = 12 * (p.year() - y.year()) + (p.month() - y.month()), b = y.clone().add(B, g), F = p - b < 0, w = y.clone().add(B + (F ? -1 : 1), g); + return +(-(B + (p - b) / (F ? b - w : w - b)) || 0); + }, a: function(k) { + return k < 0 ? Math.ceil(k) || 0 : Math.floor(k); + }, p: function(k) { + return { M: g, y: _, w: f, d: u, D: M, h, m: l, s, ms: n, Q: x }[k] || String(k || "").toLowerCase().replace(/s$/, ""); + }, u: function(k) { + return k === void 0; + } }, at = "en", lt = {}; + lt[at] = nt; + var It = function(k) { + return k instanceof qt; + }, Ht = function k(y, p, B) { + var b; + if (!y) + return at; + if (typeof y == "string") { + var F = y.toLowerCase(); + lt[F] && (b = F), p && (lt[F] = p, b = F); + var w = y.split("-"); + if (!b && w.length > 1) + return k(w[0]); + } else { + var O = y.name; + lt[O] = y, b = O; + } + return !B && b && (at = b), b || !B && at; + }, W = function(k, y) { + if (It(k)) + return k.clone(); + var p = typeof y == "object" ? y : {}; + return p.date = k, p.args = arguments, new qt(p); + }, D = H; + D.l = Ht, D.i = It, D.w = function(k, y) { + return W(k, { locale: y.$L, utc: y.$u, x: y.$x, $offset: y.$offset }); + }; + var qt = function() { + function k(p) { + this.$L = Ht(p.locale, null, !0), this.parse(p); + } + var y = k.prototype; + return y.parse = function(p) { + this.$d = function(B) { + var b = B.date, F = B.utc; + if (b === null) + return new Date(NaN); + if (D.u(b)) + return new Date(); + if (b instanceof Date) + return new Date(b); + if (typeof b == "string" && !/Z$/i.test(b)) { + var w = b.match(j); + if (w) { + var O = w[2] - 1 || 0, $ = (w[7] || "0").substring(0, 3); + return F ? new Date(Date.UTC(w[1], O, w[3] || 1, w[4] || 0, w[5] || 0, w[6] || 0, $)) : new Date(w[1], O, w[3] || 1, w[4] || 0, w[5] || 0, w[6] || 0, $); + } + } + return new Date(b); + }(p), this.$x = p.x || {}, this.init(); + }, y.init = function() { + var p = this.$d; + this.$y = p.getFullYear(), this.$M = p.getMonth(), this.$D = p.getDate(), this.$W = p.getDay(), this.$H = p.getHours(), this.$m = p.getMinutes(), this.$s = p.getSeconds(), this.$ms = p.getMilliseconds(); + }, y.$utils = function() { + return D; + }, y.isValid = function() { + return this.$d.toString() !== z; + }, y.isSame = function(p, B) { + var b = W(p); + return this.startOf(B) <= b && b <= this.endOf(B); + }, y.isAfter = function(p, B) { + return W(p) < this.startOf(B); + }, y.isBefore = function(p, B) { + return this.endOf(B) < W(p); + }, y.$g = function(p, B, b) { + return D.u(p) ? this[B] : this.set(b, p); + }, y.unix = function() { + return Math.floor(this.valueOf() / 1e3); + }, y.valueOf = function() { + return this.$d.getTime(); + }, y.startOf = function(p, B) { + var b = this, F = !!D.u(B) || B, w = D.p(p), O = function(bt, G) { + var ct = D.w(b.$u ? Date.UTC(b.$y, G, bt) : new Date(b.$y, G, bt), b); + return F ? ct : ct.endOf(u); + }, $ = function(bt, G) { + return D.w(b.toDate()[bt].apply(b.toDate("s"), (F ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(G)), b); + }, A = this.$W, P = this.$M, R = this.$D, ht = "set" + (this.$u ? "UTC" : ""); + switch (w) { + case _: + return F ? O(1, 0) : O(31, 11); + case g: + return F ? O(1, P) : O(0, P + 1); + case f: + var N = this.$locale().weekStart || 0, dt = (A < N ? A + 7 : A) - N; + return O(F ? R - dt : R + (6 - dt), P); + case u: + case M: + return $(ht + "Hours", 0); + case h: + return $(ht + "Minutes", 1); + case l: + return $(ht + "Seconds", 2); + case s: + return $(ht + "Milliseconds", 3); + default: + return this.clone(); + } + }, y.endOf = function(p) { + return this.startOf(p, !1); + }, y.$set = function(p, B) { + var b, F = D.p(p), w = "set" + (this.$u ? "UTC" : ""), O = (b = {}, b[u] = w + "Date", b[M] = w + "Date", b[g] = w + "Month", b[_] = w + "FullYear", b[h] = w + "Hours", b[l] = w + "Minutes", b[s] = w + "Seconds", b[n] = w + "Milliseconds", b)[F], $ = F === u ? this.$D + (B - this.$W) : B; + if (F === g || F === _) { + var A = this.clone().set(M, 1); + A.$d[O]($), A.init(), this.$d = A.set(M, Math.min(this.$D, A.daysInMonth())).$d; + } else + O && this.$d[O]($); + return this.init(), this; + }, y.set = function(p, B) { + return this.clone().$set(p, B); + }, y.get = function(p) { + return this[D.p(p)](); + }, y.add = function(p, B) { + var b, F = this; + p = Number(p); + var w = D.p(B), O = function(P) { + var R = W(F); + return D.w(R.date(R.date() + Math.round(P * p)), F); + }; + if (w === g) + return this.set(g, this.$M + p); + if (w === _) + return this.set(_, this.$y + p); + if (w === u) + return O(1); + if (w === f) + return O(7); + var $ = (b = {}, b[l] = r, b[h] = o, b[s] = i, b)[w] || 1, A = this.$d.getTime() + p * $; + return D.w(A, this); + }, y.subtract = function(p, B) { + return this.add(-1 * p, B); + }, y.format = function(p) { + var B = this, b = this.$locale(); + if (!this.isValid()) + return b.invalidDate || z; + var F = p || "YYYY-MM-DDTHH:mm:ssZ", w = D.z(this), O = this.$H, $ = this.$m, A = this.$M, P = b.weekdays, R = b.months, ht = function(G, ct, Ut, Dt) { + return G && (G[ct] || G(B, F)) || Ut[ct].slice(0, Dt); + }, N = function(G) { + return D.s(O % 12 || 12, G, "0"); + }, dt = b.meridiem || function(G, ct, Ut) { + var Dt = G < 12 ? "AM" : "PM"; + return Ut ? Dt.toLowerCase() : Dt; + }, bt = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: A + 1, MM: D.s(A + 1, 2, "0"), MMM: ht(b.monthsShort, A, R, 3), MMMM: ht(R, A), D: this.$D, DD: D.s(this.$D, 2, "0"), d: String(this.$W), dd: ht(b.weekdaysMin, this.$W, P, 2), ddd: ht(b.weekdaysShort, this.$W, P, 3), dddd: P[this.$W], H: String(O), HH: D.s(O, 2, "0"), h: N(1), hh: N(2), a: dt(O, $, !0), A: dt(O, $, !1), m: String($), mm: D.s($, 2, "0"), s: String(this.$s), ss: D.s(this.$s, 2, "0"), SSS: D.s(this.$ms, 3, "0"), Z: w }; + return F.replace(Ot, function(G, ct) { + return ct || bt[G] || w.replace(":", ""); + }); + }, y.utcOffset = function() { + return 15 * -Math.round(this.$d.getTimezoneOffset() / 15); + }, y.diff = function(p, B, b) { + var F, w = D.p(B), O = W(p), $ = (O.utcOffset() - this.utcOffset()) * r, A = this - O, P = D.m(this, O); + return P = (F = {}, F[_] = P / 12, F[g] = P, F[x] = P / 3, F[f] = (A - $) / 6048e5, F[u] = (A - $) / 864e5, F[h] = A / o, F[l] = A / r, F[s] = A / i, F)[w] || A, b ? P : D.a(P); + }, y.daysInMonth = function() { + return this.endOf(g).$D; + }, y.$locale = function() { + return lt[this.$L]; + }, y.locale = function(p, B) { + if (!p) + return this.$L; + var b = this.clone(), F = Ht(p, B, !0); + return F && (b.$L = F), b; + }, y.clone = function() { + return D.w(this.$d, this); + }, y.toDate = function() { + return new Date(this.valueOf()); + }, y.toJSON = function() { + return this.isValid() ? this.toISOString() : null; + }, y.toISOString = function() { + return this.$d.toISOString(); + }, y.toString = function() { + return this.$d.toUTCString(); + }, k; + }(), ie = qt.prototype; + return W.prototype = ie, [["$ms", n], ["$s", s], ["$m", l], ["$H", h], ["$W", u], ["$M", g], ["$y", _], ["$D", M]].forEach(function(k) { + ie[k[1]] = function(y) { + return this.$g(y, k[0], k[1]); + }; + }), W.extend = function(k, y) { + return k.$i || (k(y, qt, W), k.$i = !0), W; + }, W.locale = Ht, W.isDayjs = It, W.unix = function(k) { + return W(1e3 * k); + }, W.en = lt[at], W.Ls = lt, W.p = {}, W; + }); +})(Ro); +const No = xi, Bt = { + trace: 0, + debug: 1, + info: 2, + warn: 3, + error: 4, + fatal: 5 +}, et = { + trace: (...t) => { + }, + debug: (...t) => { + }, + info: (...t) => { + }, + warn: (...t) => { + }, + error: (...t) => { + }, + fatal: (...t) => { + } +}, Ch = function(t = "fatal") { + let e = Bt.fatal; + typeof t == "string" ? (t = t.toLowerCase(), t in Bt && (e = Bt[t])) : typeof t == "number" && (e = t), et.trace = () => { + }, et.debug = () => { + }, et.info = () => { + }, et.warn = () => { + }, et.error = () => { + }, et.fatal = () => { + }, e <= Bt.fatal && (et.fatal = console.error ? console.error.bind(console, ut("FATAL"), "color: orange") : console.log.bind(console, "\x1B[35m", ut("FATAL"))), e <= Bt.error && (et.error = console.error ? console.error.bind(console, ut("ERROR"), "color: orange") : console.log.bind(console, "\x1B[31m", ut("ERROR"))), e <= Bt.warn && (et.warn = console.warn ? console.warn.bind(console, ut("WARN"), "color: orange") : console.log.bind(console, "\x1B[33m", ut("WARN"))), e <= Bt.info && (et.info = console.info ? console.info.bind(console, ut("INFO"), "color: lightblue") : console.log.bind(console, "\x1B[34m", ut("INFO"))), e <= Bt.debug && (et.debug = console.debug ? console.debug.bind(console, ut("DEBUG"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", ut("DEBUG"))), e <= Bt.trace && (et.trace = console.debug ? console.debug.bind(console, ut("TRACE"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", ut("TRACE"))); +}, ut = (t) => `%c${No().format("ss.SSS")} : ${t} : `; +var zo = { value: () => { +} }; +function Mr() { + for (var t = 0, e = arguments.length, i = {}, r; t < e; ++t) { + if (!(r = arguments[t] + "") || r in i || /[\s.]/.test(r)) + throw new Error("illegal type: " + r); + i[r] = []; + } + return new Me(i); +} +function Me(t) { + this._ = t; +} +function $o(t, e) { + return t.trim().split(/^|\s+/).map(function(i) { + var r = "", o = i.indexOf("."); + if (o >= 0 && (r = i.slice(o + 1), i = i.slice(0, o)), i && !e.hasOwnProperty(i)) + throw new Error("unknown type: " + i); + return { type: i, name: r }; + }); +} +Me.prototype = Mr.prototype = { + constructor: Me, + on: function(t, e) { + var i = this._, r = $o(t + "", i), o, n = -1, s = r.length; + if (arguments.length < 2) { + for (; ++n < s; ) + if ((o = (t = r[n]).type) && (o = Wo(i[o], t.name))) + return o; + return; + } + if (e != null && typeof e != "function") + throw new Error("invalid callback: " + e); + for (; ++n < s; ) + if (o = (t = r[n]).type) + i[o] = ar(i[o], t.name, e); + else if (e == null) + for (o in i) + i[o] = ar(i[o], t.name, null); + return this; + }, + copy: function() { + var t = {}, e = this._; + for (var i in e) + t[i] = e[i].slice(); + return new Me(t); + }, + call: function(t, e) { + if ((o = arguments.length - 2) > 0) + for (var i = new Array(o), r = 0, o, n; r < o; ++r) + i[r] = arguments[r + 2]; + if (!this._.hasOwnProperty(t)) + throw new Error("unknown type: " + t); + for (n = this._[t], r = 0, o = n.length; r < o; ++r) + n[r].value.apply(e, i); + }, + apply: function(t, e, i) { + if (!this._.hasOwnProperty(t)) + throw new Error("unknown type: " + t); + for (var r = this._[t], o = 0, n = r.length; o < n; ++o) + r[o].value.apply(e, i); + } +}; +function Wo(t, e) { + for (var i = 0, r = t.length, o; i < r; ++i) + if ((o = t[i]).name === e) + return o.value; +} +function ar(t, e, i) { + for (var r = 0, o = t.length; r < o; ++r) + if (t[r].name === e) { + t[r] = zo, t = t.slice(0, r).concat(t.slice(r + 1)); + break; + } + return i != null && t.push({ name: e, value: i }), t; +} +var Ti = "http://www.w3.org/1999/xhtml"; +const lr = { + svg: "http://www.w3.org/2000/svg", + xhtml: Ti, + xlink: "http://www.w3.org/1999/xlink", + xml: "http://www.w3.org/XML/1998/namespace", + xmlns: "http://www.w3.org/2000/xmlns/" +}; +function Xe(t) { + var e = t += "", i = e.indexOf(":"); + return i >= 0 && (e = t.slice(0, i)) !== "xmlns" && (t = t.slice(i + 1)), lr.hasOwnProperty(e) ? { space: lr[e], local: t } : t; +} +function Po(t) { + return function() { + var e = this.ownerDocument, i = this.namespaceURI; + return i === Ti && e.documentElement.namespaceURI === Ti ? e.createElement(t) : e.createElementNS(i, t); + }; +} +function Ho(t) { + return function() { + return this.ownerDocument.createElementNS(t.space, t.local); + }; +} +function Or(t) { + var e = Xe(t); + return (e.local ? Ho : Po)(e); +} +function qo() { +} +function Ii(t) { + return t == null ? qo : function() { + return this.querySelector(t); + }; +} +function Uo(t) { + typeof t != "function" && (t = Ii(t)); + for (var e = this._groups, i = e.length, r = new Array(i), o = 0; o < i; ++o) + for (var n = e[o], s = n.length, l = r[o] = new Array(s), h, u, f = 0; f < s; ++f) + (h = n[f]) && (u = t.call(h, h.__data__, f, n)) && ("__data__" in h && (u.__data__ = h.__data__), l[f] = u); + return new st(r, this._parents); +} +function Go(t) { + return t == null ? [] : Array.isArray(t) ? t : Array.from(t); +} +function Vo() { + return []; +} +function Ir(t) { + return t == null ? Vo : function() { + return this.querySelectorAll(t); + }; +} +function Yo(t) { + return function() { + return Go(t.apply(this, arguments)); + }; +} +function Xo(t) { + typeof t == "function" ? t = Yo(t) : t = Ir(t); + for (var e = this._groups, i = e.length, r = [], o = [], n = 0; n < i; ++n) + for (var s = e[n], l = s.length, h, u = 0; u < l; ++u) + (h = s[u]) && (r.push(t.call(h, h.__data__, u, s)), o.push(h)); + return new st(r, o); +} +function Dr(t) { + return function() { + return this.matches(t); + }; +} +function Rr(t) { + return function(e) { + return e.matches(t); + }; +} +var jo = Array.prototype.find; +function Ko(t) { + return function() { + return jo.call(this.children, t); + }; +} +function Zo() { + return this.firstElementChild; +} +function Jo(t) { + return this.select(t == null ? Zo : Ko(typeof t == "function" ? t : Rr(t))); +} +var Qo = Array.prototype.filter; +function tn() { + return Array.from(this.children); +} +function en(t) { + return function() { + return Qo.call(this.children, t); + }; +} +function rn(t) { + return this.selectAll(t == null ? tn : en(typeof t == "function" ? t : Rr(t))); +} +function on(t) { + typeof t != "function" && (t = Dr(t)); + for (var e = this._groups, i = e.length, r = new Array(i), o = 0; o < i; ++o) + for (var n = e[o], s = n.length, l = r[o] = [], h, u = 0; u < s; ++u) + (h = n[u]) && t.call(h, h.__data__, u, n) && l.push(h); + return new st(r, this._parents); +} +function Nr(t) { + return new Array(t.length); +} +function nn() { + return new st(this._enter || this._groups.map(Nr), this._parents); +} +function We(t, e) { + this.ownerDocument = t.ownerDocument, this.namespaceURI = t.namespaceURI, this._next = null, this._parent = t, this.__data__ = e; +} +We.prototype = { + constructor: We, + appendChild: function(t) { + return this._parent.insertBefore(t, this._next); + }, + insertBefore: function(t, e) { + return this._parent.insertBefore(t, e); + }, + querySelector: function(t) { + return this._parent.querySelector(t); + }, + querySelectorAll: function(t) { + return this._parent.querySelectorAll(t); + } +}; +function sn(t) { + return function() { + return t; + }; +} +function an(t, e, i, r, o, n) { + for (var s = 0, l, h = e.length, u = n.length; s < u; ++s) + (l = e[s]) ? (l.__data__ = n[s], r[s] = l) : i[s] = new We(t, n[s]); + for (; s < h; ++s) + (l = e[s]) && (o[s] = l); +} +function ln(t, e, i, r, o, n, s) { + var l, h, u = /* @__PURE__ */ new Map(), f = e.length, g = n.length, x = new Array(f), _; + for (l = 0; l < f; ++l) + (h = e[l]) && (x[l] = _ = s.call(h, h.__data__, l, e) + "", u.has(_) ? o[l] = h : u.set(_, h)); + for (l = 0; l < g; ++l) + _ = s.call(t, n[l], l, n) + "", (h = u.get(_)) ? (r[l] = h, h.__data__ = n[l], u.delete(_)) : i[l] = new We(t, n[l]); + for (l = 0; l < f; ++l) + (h = e[l]) && u.get(x[l]) === h && (o[l] = h); +} +function hn(t) { + return t.__data__; +} +function cn(t, e) { + if (!arguments.length) + return Array.from(this, hn); + var i = e ? ln : an, r = this._parents, o = this._groups; + typeof t != "function" && (t = sn(t)); + for (var n = o.length, s = new Array(n), l = new Array(n), h = new Array(n), u = 0; u < n; ++u) { + var f = r[u], g = o[u], x = g.length, _ = un(t.call(f, f && f.__data__, u, r)), M = _.length, z = l[u] = new Array(M), j = s[u] = new Array(M), Ot = h[u] = new Array(x); + i(f, g, z, j, Ot, _, e); + for (var nt = 0, Q = 0, H, at; nt < M; ++nt) + if (H = z[nt]) { + for (nt >= Q && (Q = nt + 1); !(at = j[Q]) && ++Q < M; ) + ; + H._next = at || null; + } + } + return s = new st(s, r), s._enter = l, s._exit = h, s; +} +function un(t) { + return typeof t == "object" && "length" in t ? t : Array.from(t); +} +function fn() { + return new st(this._exit || this._groups.map(Nr), this._parents); +} +function dn(t, e, i) { + var r = this.enter(), o = this, n = this.exit(); + return typeof t == "function" ? (r = t(r), r && (r = r.selection())) : r = r.append(t + ""), e != null && (o = e(o), o && (o = o.selection())), i == null ? n.remove() : i(n), r && o ? r.merge(o).order() : o; +} +function gn(t) { + for (var e = t.selection ? t.selection() : t, i = this._groups, r = e._groups, o = i.length, n = r.length, s = Math.min(o, n), l = new Array(o), h = 0; h < s; ++h) + for (var u = i[h], f = r[h], g = u.length, x = l[h] = new Array(g), _, M = 0; M < g; ++M) + (_ = u[M] || f[M]) && (x[M] = _); + for (; h < o; ++h) + l[h] = i[h]; + return new st(l, this._parents); +} +function pn() { + for (var t = this._groups, e = -1, i = t.length; ++e < i; ) + for (var r = t[e], o = r.length - 1, n = r[o], s; --o >= 0; ) + (s = r[o]) && (n && s.compareDocumentPosition(n) ^ 4 && n.parentNode.insertBefore(s, n), n = s); + return this; +} +function mn(t) { + t || (t = Cn); + function e(g, x) { + return g && x ? t(g.__data__, x.__data__) : !g - !x; + } + for (var i = this._groups, r = i.length, o = new Array(r), n = 0; n < r; ++n) { + for (var s = i[n], l = s.length, h = o[n] = new Array(l), u, f = 0; f < l; ++f) + (u = s[f]) && (h[f] = u); + h.sort(e); + } + return new st(o, this._parents).order(); +} +function Cn(t, e) { + return t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN; +} +function yn() { + var t = arguments[0]; + return arguments[0] = this, t.apply(null, arguments), this; +} +function bn() { + return Array.from(this); +} +function _n() { + for (var t = this._groups, e = 0, i = t.length; e < i; ++e) + for (var r = t[e], o = 0, n = r.length; o < n; ++o) { + var s = r[o]; + if (s) + return s; + } + return null; +} +function xn() { + let t = 0; + for (const e of this) + ++t; + return t; +} +function Tn() { + return !this.node(); +} +function kn(t) { + for (var e = this._groups, i = 0, r = e.length; i < r; ++i) + for (var o = e[i], n = 0, s = o.length, l; n < s; ++n) + (l = o[n]) && t.call(l, l.__data__, n, o); + return this; +} +function Sn(t) { + return function() { + this.removeAttribute(t); + }; +} +function Bn(t) { + return function() { + this.removeAttributeNS(t.space, t.local); + }; +} +function vn(t, e) { + return function() { + this.setAttribute(t, e); + }; +} +function wn(t, e) { + return function() { + this.setAttributeNS(t.space, t.local, e); + }; +} +function Ln(t, e) { + return function() { + var i = e.apply(this, arguments); + i == null ? this.removeAttribute(t) : this.setAttribute(t, i); + }; +} +function Fn(t, e) { + return function() { + var i = e.apply(this, arguments); + i == null ? this.removeAttributeNS(t.space, t.local) : this.setAttributeNS(t.space, t.local, i); + }; +} +function An(t, e) { + var i = Xe(t); + if (arguments.length < 2) { + var r = this.node(); + return i.local ? r.getAttributeNS(i.space, i.local) : r.getAttribute(i); + } + return this.each((e == null ? i.local ? Bn : Sn : typeof e == "function" ? i.local ? Fn : Ln : i.local ? wn : vn)(i, e)); +} +function zr(t) { + return t.ownerDocument && t.ownerDocument.defaultView || t.document && t || t.defaultView; +} +function En(t) { + return function() { + this.style.removeProperty(t); + }; +} +function Mn(t, e, i) { + return function() { + this.style.setProperty(t, e, i); + }; +} +function On(t, e, i) { + return function() { + var r = e.apply(this, arguments); + r == null ? this.style.removeProperty(t) : this.style.setProperty(t, r, i); + }; +} +function In(t, e, i) { + return arguments.length > 1 ? this.each((e == null ? En : typeof e == "function" ? On : Mn)(t, e, i ?? "")) : Qt(this.node(), t); +} +function Qt(t, e) { + return t.style.getPropertyValue(e) || zr(t).getComputedStyle(t, null).getPropertyValue(e); +} +function Dn(t) { + return function() { + delete this[t]; + }; +} +function Rn(t, e) { + return function() { + this[t] = e; + }; +} +function Nn(t, e) { + return function() { + var i = e.apply(this, arguments); + i == null ? delete this[t] : this[t] = i; + }; +} +function zn(t, e) { + return arguments.length > 1 ? this.each((e == null ? Dn : typeof e == "function" ? Nn : Rn)(t, e)) : this.node()[t]; +} +function $r(t) { + return t.trim().split(/^|\s+/); +} +function Di(t) { + return t.classList || new Wr(t); +} +function Wr(t) { + this._node = t, this._names = $r(t.getAttribute("class") || ""); +} +Wr.prototype = { + add: function(t) { + var e = this._names.indexOf(t); + e < 0 && (this._names.push(t), this._node.setAttribute("class", this._names.join(" "))); + }, + remove: function(t) { + var e = this._names.indexOf(t); + e >= 0 && (this._names.splice(e, 1), this._node.setAttribute("class", this._names.join(" "))); + }, + contains: function(t) { + return this._names.indexOf(t) >= 0; + } +}; +function Pr(t, e) { + for (var i = Di(t), r = -1, o = e.length; ++r < o; ) + i.add(e[r]); +} +function Hr(t, e) { + for (var i = Di(t), r = -1, o = e.length; ++r < o; ) + i.remove(e[r]); +} +function $n(t) { + return function() { + Pr(this, t); + }; +} +function Wn(t) { + return function() { + Hr(this, t); + }; +} +function Pn(t, e) { + return function() { + (e.apply(this, arguments) ? Pr : Hr)(this, t); + }; +} +function Hn(t, e) { + var i = $r(t + ""); + if (arguments.length < 2) { + for (var r = Di(this.node()), o = -1, n = i.length; ++o < n; ) + if (!r.contains(i[o])) + return !1; + return !0; + } + return this.each((typeof e == "function" ? Pn : e ? $n : Wn)(i, e)); +} +function qn() { + this.textContent = ""; +} +function Un(t) { + return function() { + this.textContent = t; + }; +} +function Gn(t) { + return function() { + var e = t.apply(this, arguments); + this.textContent = e ?? ""; + }; +} +function Vn(t) { + return arguments.length ? this.each(t == null ? qn : (typeof t == "function" ? Gn : Un)(t)) : this.node().textContent; +} +function Yn() { + this.innerHTML = ""; +} +function Xn(t) { + return function() { + this.innerHTML = t; + }; +} +function jn(t) { + return function() { + var e = t.apply(this, arguments); + this.innerHTML = e ?? ""; + }; +} +function Kn(t) { + return arguments.length ? this.each(t == null ? Yn : (typeof t == "function" ? jn : Xn)(t)) : this.node().innerHTML; +} +function Zn() { + this.nextSibling && this.parentNode.appendChild(this); +} +function Jn() { + return this.each(Zn); +} +function Qn() { + this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild); +} +function ts() { + return this.each(Qn); +} +function es(t) { + var e = typeof t == "function" ? t : Or(t); + return this.select(function() { + return this.appendChild(e.apply(this, arguments)); + }); +} +function is() { + return null; +} +function rs(t, e) { + var i = typeof t == "function" ? t : Or(t), r = e == null ? is : typeof e == "function" ? e : Ii(e); + return this.select(function() { + return this.insertBefore(i.apply(this, arguments), r.apply(this, arguments) || null); + }); +} +function os() { + var t = this.parentNode; + t && t.removeChild(this); +} +function ns() { + return this.each(os); +} +function ss() { + var t = this.cloneNode(!1), e = this.parentNode; + return e ? e.insertBefore(t, this.nextSibling) : t; +} +function as() { + var t = this.cloneNode(!0), e = this.parentNode; + return e ? e.insertBefore(t, this.nextSibling) : t; +} +function ls(t) { + return this.select(t ? as : ss); +} +function hs(t) { + return arguments.length ? this.property("__data__", t) : this.node().__data__; +} +function cs(t) { + return function(e) { + t.call(this, e, this.__data__); + }; +} +function us(t) { + return t.trim().split(/^|\s+/).map(function(e) { + var i = "", r = e.indexOf("."); + return r >= 0 && (i = e.slice(r + 1), e = e.slice(0, r)), { type: e, name: i }; + }); +} +function fs(t) { + return function() { + var e = this.__on; + if (e) { + for (var i = 0, r = -1, o = e.length, n; i < o; ++i) + n = e[i], (!t.type || n.type === t.type) && n.name === t.name ? this.removeEventListener(n.type, n.listener, n.options) : e[++r] = n; + ++r ? e.length = r : delete this.__on; + } + }; +} +function ds(t, e, i) { + return function() { + var r = this.__on, o, n = cs(e); + if (r) { + for (var s = 0, l = r.length; s < l; ++s) + if ((o = r[s]).type === t.type && o.name === t.name) { + this.removeEventListener(o.type, o.listener, o.options), this.addEventListener(o.type, o.listener = n, o.options = i), o.value = e; + return; + } + } + this.addEventListener(t.type, n, i), o = { type: t.type, name: t.name, value: e, listener: n, options: i }, r ? r.push(o) : this.__on = [o]; + }; +} +function gs(t, e, i) { + var r = us(t + ""), o, n = r.length, s; + if (arguments.length < 2) { + var l = this.node().__on; + if (l) { + for (var h = 0, u = l.length, f; h < u; ++h) + for (o = 0, f = l[h]; o < n; ++o) + if ((s = r[o]).type === f.type && s.name === f.name) + return f.value; + } + return; + } + for (l = e ? ds : fs, o = 0; o < n; ++o) + this.each(l(r[o], e, i)); + return this; +} +function qr(t, e, i) { + var r = zr(t), o = r.CustomEvent; + typeof o == "function" ? o = new o(e, i) : (o = r.document.createEvent("Event"), i ? (o.initEvent(e, i.bubbles, i.cancelable), o.detail = i.detail) : o.initEvent(e, !1, !1)), t.dispatchEvent(o); +} +function ps(t, e) { + return function() { + return qr(this, t, e); + }; +} +function ms(t, e) { + return function() { + return qr(this, t, e.apply(this, arguments)); + }; +} +function Cs(t, e) { + return this.each((typeof e == "function" ? ms : ps)(t, e)); +} +function* ys() { + for (var t = this._groups, e = 0, i = t.length; e < i; ++e) + for (var r = t[e], o = 0, n = r.length, s; o < n; ++o) + (s = r[o]) && (yield s); +} +var Ur = [null]; +function st(t, e) { + this._groups = t, this._parents = e; +} +function Ce() { + return new st([[document.documentElement]], Ur); +} +function bs() { + return this; +} +st.prototype = Ce.prototype = { + constructor: st, + select: Uo, + selectAll: Xo, + selectChild: Jo, + selectChildren: rn, + filter: on, + data: cn, + enter: nn, + exit: fn, + join: dn, + merge: gn, + selection: bs, + order: pn, + sort: mn, + call: yn, + nodes: bn, + node: _n, + size: xn, + empty: Tn, + each: kn, + attr: An, + style: In, + property: zn, + classed: Hn, + text: Vn, + html: Kn, + raise: Jn, + lower: ts, + append: es, + insert: rs, + remove: ns, + clone: ls, + datum: hs, + on: gs, + dispatch: Cs, + [Symbol.iterator]: ys +}; +function yh(t) { + return typeof t == "string" ? new st([[document.querySelector(t)]], [document.documentElement]) : new st([[t]], Ur); +} +function Ri(t, e, i) { + t.prototype = e.prototype = i, i.constructor = t; +} +function Gr(t, e) { + var i = Object.create(t.prototype); + for (var r in e) + i[r] = e[r]; + return i; +} +function ye() { +} +var de = 0.7, Pe = 1 / de, Zt = "\\s*([+-]?\\d+)\\s*", ge = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", _t = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", _s = /^#([0-9a-f]{3,8})$/, xs = new RegExp(`^rgb\\(${Zt},${Zt},${Zt}\\)$`), Ts = new RegExp(`^rgb\\(${_t},${_t},${_t}\\)$`), ks = new RegExp(`^rgba\\(${Zt},${Zt},${Zt},${ge}\\)$`), Ss = new RegExp(`^rgba\\(${_t},${_t},${_t},${ge}\\)$`), Bs = new RegExp(`^hsl\\(${ge},${_t},${_t}\\)$`), vs = new RegExp(`^hsla\\(${ge},${_t},${_t},${ge}\\)$`), hr = { + aliceblue: 15792383, + antiquewhite: 16444375, + aqua: 65535, + aquamarine: 8388564, + azure: 15794175, + beige: 16119260, + bisque: 16770244, + black: 0, + blanchedalmond: 16772045, + blue: 255, + blueviolet: 9055202, + brown: 10824234, + burlywood: 14596231, + cadetblue: 6266528, + chartreuse: 8388352, + chocolate: 13789470, + coral: 16744272, + cornflowerblue: 6591981, + cornsilk: 16775388, + crimson: 14423100, + cyan: 65535, + darkblue: 139, + darkcyan: 35723, + darkgoldenrod: 12092939, + darkgray: 11119017, + darkgreen: 25600, + darkgrey: 11119017, + darkkhaki: 12433259, + darkmagenta: 9109643, + darkolivegreen: 5597999, + darkorange: 16747520, + darkorchid: 10040012, + darkred: 9109504, + darksalmon: 15308410, + darkseagreen: 9419919, + darkslateblue: 4734347, + darkslategray: 3100495, + darkslategrey: 3100495, + darkturquoise: 52945, + darkviolet: 9699539, + deeppink: 16716947, + deepskyblue: 49151, + dimgray: 6908265, + dimgrey: 6908265, + dodgerblue: 2003199, + firebrick: 11674146, + floralwhite: 16775920, + forestgreen: 2263842, + fuchsia: 16711935, + gainsboro: 14474460, + ghostwhite: 16316671, + gold: 16766720, + goldenrod: 14329120, + gray: 8421504, + green: 32768, + greenyellow: 11403055, + grey: 8421504, + honeydew: 15794160, + hotpink: 16738740, + indianred: 13458524, + indigo: 4915330, + ivory: 16777200, + khaki: 15787660, + lavender: 15132410, + lavenderblush: 16773365, + lawngreen: 8190976, + lemonchiffon: 16775885, + lightblue: 11393254, + lightcoral: 15761536, + lightcyan: 14745599, + lightgoldenrodyellow: 16448210, + lightgray: 13882323, + lightgreen: 9498256, + lightgrey: 13882323, + lightpink: 16758465, + lightsalmon: 16752762, + lightseagreen: 2142890, + lightskyblue: 8900346, + lightslategray: 7833753, + lightslategrey: 7833753, + lightsteelblue: 11584734, + lightyellow: 16777184, + lime: 65280, + limegreen: 3329330, + linen: 16445670, + magenta: 16711935, + maroon: 8388608, + mediumaquamarine: 6737322, + mediumblue: 205, + mediumorchid: 12211667, + mediumpurple: 9662683, + mediumseagreen: 3978097, + mediumslateblue: 8087790, + mediumspringgreen: 64154, + mediumturquoise: 4772300, + mediumvioletred: 13047173, + midnightblue: 1644912, + mintcream: 16121850, + mistyrose: 16770273, + moccasin: 16770229, + navajowhite: 16768685, + navy: 128, + oldlace: 16643558, + olive: 8421376, + olivedrab: 7048739, + orange: 16753920, + orangered: 16729344, + orchid: 14315734, + palegoldenrod: 15657130, + palegreen: 10025880, + paleturquoise: 11529966, + palevioletred: 14381203, + papayawhip: 16773077, + peachpuff: 16767673, + peru: 13468991, + pink: 16761035, + plum: 14524637, + powderblue: 11591910, + purple: 8388736, + rebeccapurple: 6697881, + red: 16711680, + rosybrown: 12357519, + royalblue: 4286945, + saddlebrown: 9127187, + salmon: 16416882, + sandybrown: 16032864, + seagreen: 3050327, + seashell: 16774638, + sienna: 10506797, + silver: 12632256, + skyblue: 8900331, + slateblue: 6970061, + slategray: 7372944, + slategrey: 7372944, + snow: 16775930, + springgreen: 65407, + steelblue: 4620980, + tan: 13808780, + teal: 32896, + thistle: 14204888, + tomato: 16737095, + turquoise: 4251856, + violet: 15631086, + wheat: 16113331, + white: 16777215, + whitesmoke: 16119285, + yellow: 16776960, + yellowgreen: 10145074 +}; +Ri(ye, pe, { + copy(t) { + return Object.assign(new this.constructor(), this, t); + }, + displayable() { + return this.rgb().displayable(); + }, + hex: cr, + // Deprecated! Use color.formatHex. + formatHex: cr, + formatHex8: ws, + formatHsl: Ls, + formatRgb: ur, + toString: ur +}); +function cr() { + return this.rgb().formatHex(); +} +function ws() { + return this.rgb().formatHex8(); +} +function Ls() { + return Vr(this).formatHsl(); +} +function ur() { + return this.rgb().formatRgb(); +} +function pe(t) { + var e, i; + return t = (t + "").trim().toLowerCase(), (e = _s.exec(t)) ? (i = e[1].length, e = parseInt(e[1], 16), i === 6 ? fr(e) : i === 3 ? new ot(e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, (e & 15) << 4 | e & 15, 1) : i === 8 ? Be(e >> 24 & 255, e >> 16 & 255, e >> 8 & 255, (e & 255) / 255) : i === 4 ? Be(e >> 12 & 15 | e >> 8 & 240, e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, ((e & 15) << 4 | e & 15) / 255) : null) : (e = xs.exec(t)) ? new ot(e[1], e[2], e[3], 1) : (e = Ts.exec(t)) ? new ot(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, 1) : (e = ks.exec(t)) ? Be(e[1], e[2], e[3], e[4]) : (e = Ss.exec(t)) ? Be(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, e[4]) : (e = Bs.exec(t)) ? pr(e[1], e[2] / 100, e[3] / 100, 1) : (e = vs.exec(t)) ? pr(e[1], e[2] / 100, e[3] / 100, e[4]) : hr.hasOwnProperty(t) ? fr(hr[t]) : t === "transparent" ? new ot(NaN, NaN, NaN, 0) : null; +} +function fr(t) { + return new ot(t >> 16 & 255, t >> 8 & 255, t & 255, 1); +} +function Be(t, e, i, r) { + return r <= 0 && (t = e = i = NaN), new ot(t, e, i, r); +} +function Fs(t) { + return t instanceof ye || (t = pe(t)), t ? (t = t.rgb(), new ot(t.r, t.g, t.b, t.opacity)) : new ot(); +} +function ki(t, e, i, r) { + return arguments.length === 1 ? Fs(t) : new ot(t, e, i, r ?? 1); +} +function ot(t, e, i, r) { + this.r = +t, this.g = +e, this.b = +i, this.opacity = +r; +} +Ri(ot, ki, Gr(ye, { + brighter(t) { + return t = t == null ? Pe : Math.pow(Pe, t), new ot(this.r * t, this.g * t, this.b * t, this.opacity); + }, + darker(t) { + return t = t == null ? de : Math.pow(de, t), new ot(this.r * t, this.g * t, this.b * t, this.opacity); + }, + rgb() { + return this; + }, + clamp() { + return new ot(Wt(this.r), Wt(this.g), Wt(this.b), He(this.opacity)); + }, + displayable() { + return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1; + }, + hex: dr, + // Deprecated! Use color.formatHex. + formatHex: dr, + formatHex8: As, + formatRgb: gr, + toString: gr +})); +function dr() { + return `#${$t(this.r)}${$t(this.g)}${$t(this.b)}`; +} +function As() { + return `#${$t(this.r)}${$t(this.g)}${$t(this.b)}${$t((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`; +} +function gr() { + const t = He(this.opacity); + return `${t === 1 ? "rgb(" : "rgba("}${Wt(this.r)}, ${Wt(this.g)}, ${Wt(this.b)}${t === 1 ? ")" : `, ${t})`}`; +} +function He(t) { + return isNaN(t) ? 1 : Math.max(0, Math.min(1, t)); +} +function Wt(t) { + return Math.max(0, Math.min(255, Math.round(t) || 0)); +} +function $t(t) { + return t = Wt(t), (t < 16 ? "0" : "") + t.toString(16); +} +function pr(t, e, i, r) { + return r <= 0 ? t = e = i = NaN : i <= 0 || i >= 1 ? t = e = NaN : e <= 0 && (t = NaN), new mt(t, e, i, r); +} +function Vr(t) { + if (t instanceof mt) + return new mt(t.h, t.s, t.l, t.opacity); + if (t instanceof ye || (t = pe(t)), !t) + return new mt(); + if (t instanceof mt) + return t; + t = t.rgb(); + var e = t.r / 255, i = t.g / 255, r = t.b / 255, o = Math.min(e, i, r), n = Math.max(e, i, r), s = NaN, l = n - o, h = (n + o) / 2; + return l ? (e === n ? s = (i - r) / l + (i < r) * 6 : i === n ? s = (r - e) / l + 2 : s = (e - i) / l + 4, l /= h < 0.5 ? n + o : 2 - n - o, s *= 60) : l = h > 0 && h < 1 ? 0 : s, new mt(s, l, h, t.opacity); +} +function Es(t, e, i, r) { + return arguments.length === 1 ? Vr(t) : new mt(t, e, i, r ?? 1); +} +function mt(t, e, i, r) { + this.h = +t, this.s = +e, this.l = +i, this.opacity = +r; +} +Ri(mt, Es, Gr(ye, { + brighter(t) { + return t = t == null ? Pe : Math.pow(Pe, t), new mt(this.h, this.s, this.l * t, this.opacity); + }, + darker(t) { + return t = t == null ? de : Math.pow(de, t), new mt(this.h, this.s, this.l * t, this.opacity); + }, + rgb() { + var t = this.h % 360 + (this.h < 0) * 360, e = isNaN(t) || isNaN(this.s) ? 0 : this.s, i = this.l, r = i + (i < 0.5 ? i : 1 - i) * e, o = 2 * i - r; + return new ot( + di(t >= 240 ? t - 240 : t + 120, o, r), + di(t, o, r), + di(t < 120 ? t + 240 : t - 120, o, r), + this.opacity + ); + }, + clamp() { + return new mt(mr(this.h), ve(this.s), ve(this.l), He(this.opacity)); + }, + displayable() { + return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1; + }, + formatHsl() { + const t = He(this.opacity); + return `${t === 1 ? "hsl(" : "hsla("}${mr(this.h)}, ${ve(this.s) * 100}%, ${ve(this.l) * 100}%${t === 1 ? ")" : `, ${t})`}`; + } +})); +function mr(t) { + return t = (t || 0) % 360, t < 0 ? t + 360 : t; +} +function ve(t) { + return Math.max(0, Math.min(1, t || 0)); +} +function di(t, e, i) { + return (t < 60 ? e + (i - e) * t / 60 : t < 180 ? i : t < 240 ? e + (i - e) * (240 - t) / 60 : e) * 255; +} +const Ni = (t) => () => t; +function Yr(t, e) { + return function(i) { + return t + i * e; + }; +} +function Ms(t, e, i) { + return t = Math.pow(t, i), e = Math.pow(e, i) - t, i = 1 / i, function(r) { + return Math.pow(t + r * e, i); + }; +} +function bh(t, e) { + var i = e - t; + return i ? Yr(t, i > 180 || i < -180 ? i - 360 * Math.round(i / 360) : i) : Ni(isNaN(t) ? e : t); +} +function Os(t) { + return (t = +t) == 1 ? Xr : function(e, i) { + return i - e ? Ms(e, i, t) : Ni(isNaN(e) ? i : e); + }; +} +function Xr(t, e) { + var i = e - t; + return i ? Yr(t, i) : Ni(isNaN(t) ? e : t); +} +const Cr = function t(e) { + var i = Os(e); + function r(o, n) { + var s = i((o = ki(o)).r, (n = ki(n)).r), l = i(o.g, n.g), h = i(o.b, n.b), u = Xr(o.opacity, n.opacity); + return function(f) { + return o.r = s(f), o.g = l(f), o.b = h(f), o.opacity = u(f), o + ""; + }; + } + return r.gamma = t, r; +}(1); +function At(t, e) { + return t = +t, e = +e, function(i) { + return t * (1 - i) + e * i; + }; +} +var Si = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, gi = new RegExp(Si.source, "g"); +function Is(t) { + return function() { + return t; + }; +} +function Ds(t) { + return function(e) { + return t(e) + ""; + }; +} +function Rs(t, e) { + var i = Si.lastIndex = gi.lastIndex = 0, r, o, n, s = -1, l = [], h = []; + for (t = t + "", e = e + ""; (r = Si.exec(t)) && (o = gi.exec(e)); ) + (n = o.index) > i && (n = e.slice(i, n), l[s] ? l[s] += n : l[++s] = n), (r = r[0]) === (o = o[0]) ? l[s] ? l[s] += o : l[++s] = o : (l[++s] = null, h.push({ i: s, x: At(r, o) })), i = gi.lastIndex; + return i < e.length && (n = e.slice(i), l[s] ? l[s] += n : l[++s] = n), l.length < 2 ? h[0] ? Ds(h[0].x) : Is(e) : (e = h.length, function(u) { + for (var f = 0, g; f < e; ++f) + l[(g = h[f]).i] = g.x(u); + return l.join(""); + }); +} +var yr = 180 / Math.PI, Bi = { + translateX: 0, + translateY: 0, + rotate: 0, + skewX: 0, + scaleX: 1, + scaleY: 1 +}; +function jr(t, e, i, r, o, n) { + var s, l, h; + return (s = Math.sqrt(t * t + e * e)) && (t /= s, e /= s), (h = t * i + e * r) && (i -= t * h, r -= e * h), (l = Math.sqrt(i * i + r * r)) && (i /= l, r /= l, h /= l), t * r < e * i && (t = -t, e = -e, h = -h, s = -s), { + translateX: o, + translateY: n, + rotate: Math.atan2(e, t) * yr, + skewX: Math.atan(h) * yr, + scaleX: s, + scaleY: l + }; +} +var we; +function Ns(t) { + const e = new (typeof DOMMatrix == "function" ? DOMMatrix : WebKitCSSMatrix)(t + ""); + return e.isIdentity ? Bi : jr(e.a, e.b, e.c, e.d, e.e, e.f); +} +function zs(t) { + return t == null || (we || (we = document.createElementNS("http://www.w3.org/2000/svg", "g")), we.setAttribute("transform", t), !(t = we.transform.baseVal.consolidate())) ? Bi : (t = t.matrix, jr(t.a, t.b, t.c, t.d, t.e, t.f)); +} +function Kr(t, e, i, r) { + function o(u) { + return u.length ? u.pop() + " " : ""; + } + function n(u, f, g, x, _, M) { + if (u !== g || f !== x) { + var z = _.push("translate(", null, e, null, i); + M.push({ i: z - 4, x: At(u, g) }, { i: z - 2, x: At(f, x) }); + } else + (g || x) && _.push("translate(" + g + e + x + i); + } + function s(u, f, g, x) { + u !== f ? (u - f > 180 ? f += 360 : f - u > 180 && (u += 360), x.push({ i: g.push(o(g) + "rotate(", null, r) - 2, x: At(u, f) })) : f && g.push(o(g) + "rotate(" + f + r); + } + function l(u, f, g, x) { + u !== f ? x.push({ i: g.push(o(g) + "skewX(", null, r) - 2, x: At(u, f) }) : f && g.push(o(g) + "skewX(" + f + r); + } + function h(u, f, g, x, _, M) { + if (u !== g || f !== x) { + var z = _.push(o(_) + "scale(", null, ",", null, ")"); + M.push({ i: z - 4, x: At(u, g) }, { i: z - 2, x: At(f, x) }); + } else + (g !== 1 || x !== 1) && _.push(o(_) + "scale(" + g + "," + x + ")"); + } + return function(u, f) { + var g = [], x = []; + return u = t(u), f = t(f), n(u.translateX, u.translateY, f.translateX, f.translateY, g, x), s(u.rotate, f.rotate, g, x), l(u.skewX, f.skewX, g, x), h(u.scaleX, u.scaleY, f.scaleX, f.scaleY, g, x), u = f = null, function(_) { + for (var M = -1, z = x.length, j; ++M < z; ) + g[(j = x[M]).i] = j.x(_); + return g.join(""); + }; + }; +} +var $s = Kr(Ns, "px, ", "px)", "deg)"), Ws = Kr(zs, ", ", ")", ")"), te = 0, ae = 0, ne = 0, Zr = 1e3, qe, le, Ue = 0, Pt = 0, je = 0, me = typeof performance == "object" && performance.now ? performance : Date, Jr = typeof window == "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(t) { + setTimeout(t, 17); +}; +function zi() { + return Pt || (Jr(Ps), Pt = me.now() + je); +} +function Ps() { + Pt = 0; +} +function Ge() { + this._call = this._time = this._next = null; +} +Ge.prototype = Qr.prototype = { + constructor: Ge, + restart: function(t, e, i) { + if (typeof t != "function") + throw new TypeError("callback is not a function"); + i = (i == null ? zi() : +i) + (e == null ? 0 : +e), !this._next && le !== this && (le ? le._next = this : qe = this, le = this), this._call = t, this._time = i, vi(); + }, + stop: function() { + this._call && (this._call = null, this._time = 1 / 0, vi()); + } +}; +function Qr(t, e, i) { + var r = new Ge(); + return r.restart(t, e, i), r; +} +function Hs() { + zi(), ++te; + for (var t = qe, e; t; ) + (e = Pt - t._time) >= 0 && t._call.call(void 0, e), t = t._next; + --te; +} +function br() { + Pt = (Ue = me.now()) + je, te = ae = 0; + try { + Hs(); + } finally { + te = 0, Us(), Pt = 0; + } +} +function qs() { + var t = me.now(), e = t - Ue; + e > Zr && (je -= e, Ue = t); +} +function Us() { + for (var t, e = qe, i, r = 1 / 0; e; ) + e._call ? (r > e._time && (r = e._time), t = e, e = e._next) : (i = e._next, e._next = null, e = t ? t._next = i : qe = i); + le = t, vi(r); +} +function vi(t) { + if (!te) { + ae && (ae = clearTimeout(ae)); + var e = t - Pt; + e > 24 ? (t < 1 / 0 && (ae = setTimeout(br, t - me.now() - je)), ne && (ne = clearInterval(ne))) : (ne || (Ue = me.now(), ne = setInterval(qs, Zr)), te = 1, Jr(br)); + } +} +function _r(t, e, i) { + var r = new Ge(); + return e = e == null ? 0 : +e, r.restart((o) => { + r.stop(), t(o + e); + }, e, i), r; +} +var Gs = Mr("start", "end", "cancel", "interrupt"), Vs = [], to = 0, xr = 1, wi = 2, Oe = 3, Tr = 4, Li = 5, Ie = 6; +function Ke(t, e, i, r, o, n) { + var s = t.__transition; + if (!s) + t.__transition = {}; + else if (i in s) + return; + Ys(t, i, { + name: e, + index: r, + // For context during callback. + group: o, + // For context during callback. + on: Gs, + tween: Vs, + time: n.time, + delay: n.delay, + duration: n.duration, + ease: n.ease, + timer: null, + state: to + }); +} +function $i(t, e) { + var i = yt(t, e); + if (i.state > to) + throw new Error("too late; already scheduled"); + return i; +} +function xt(t, e) { + var i = yt(t, e); + if (i.state > Oe) + throw new Error("too late; already running"); + return i; +} +function yt(t, e) { + var i = t.__transition; + if (!i || !(i = i[e])) + throw new Error("transition not found"); + return i; +} +function Ys(t, e, i) { + var r = t.__transition, o; + r[e] = i, i.timer = Qr(n, 0, i.time); + function n(u) { + i.state = xr, i.timer.restart(s, i.delay, i.time), i.delay <= u && s(u - i.delay); + } + function s(u) { + var f, g, x, _; + if (i.state !== xr) + return h(); + for (f in r) + if (_ = r[f], _.name === i.name) { + if (_.state === Oe) + return _r(s); + _.state === Tr ? (_.state = Ie, _.timer.stop(), _.on.call("interrupt", t, t.__data__, _.index, _.group), delete r[f]) : +f < e && (_.state = Ie, _.timer.stop(), _.on.call("cancel", t, t.__data__, _.index, _.group), delete r[f]); + } + if (_r(function() { + i.state === Oe && (i.state = Tr, i.timer.restart(l, i.delay, i.time), l(u)); + }), i.state = wi, i.on.call("start", t, t.__data__, i.index, i.group), i.state === wi) { + for (i.state = Oe, o = new Array(x = i.tween.length), f = 0, g = -1; f < x; ++f) + (_ = i.tween[f].value.call(t, t.__data__, i.index, i.group)) && (o[++g] = _); + o.length = g + 1; + } + } + function l(u) { + for (var f = u < i.duration ? i.ease.call(null, u / i.duration) : (i.timer.restart(h), i.state = Li, 1), g = -1, x = o.length; ++g < x; ) + o[g].call(t, f); + i.state === Li && (i.on.call("end", t, t.__data__, i.index, i.group), h()); + } + function h() { + i.state = Ie, i.timer.stop(), delete r[e]; + for (var u in r) + return; + delete t.__transition; + } +} +function Xs(t, e) { + var i = t.__transition, r, o, n = !0, s; + if (i) { + e = e == null ? null : e + ""; + for (s in i) { + if ((r = i[s]).name !== e) { + n = !1; + continue; + } + o = r.state > wi && r.state < Li, r.state = Ie, r.timer.stop(), r.on.call(o ? "interrupt" : "cancel", t, t.__data__, r.index, r.group), delete i[s]; + } + n && delete t.__transition; + } +} +function js(t) { + return this.each(function() { + Xs(this, t); + }); +} +function Ks(t, e) { + var i, r; + return function() { + var o = xt(this, t), n = o.tween; + if (n !== i) { + r = i = n; + for (var s = 0, l = r.length; s < l; ++s) + if (r[s].name === e) { + r = r.slice(), r.splice(s, 1); + break; + } + } + o.tween = r; + }; +} +function Zs(t, e, i) { + var r, o; + if (typeof i != "function") + throw new Error(); + return function() { + var n = xt(this, t), s = n.tween; + if (s !== r) { + o = (r = s).slice(); + for (var l = { name: e, value: i }, h = 0, u = o.length; h < u; ++h) + if (o[h].name === e) { + o[h] = l; + break; + } + h === u && o.push(l); + } + n.tween = o; + }; +} +function Js(t, e) { + var i = this._id; + if (t += "", arguments.length < 2) { + for (var r = yt(this.node(), i).tween, o = 0, n = r.length, s; o < n; ++o) + if ((s = r[o]).name === t) + return s.value; + return null; + } + return this.each((e == null ? Ks : Zs)(i, t, e)); +} +function Wi(t, e, i) { + var r = t._id; + return t.each(function() { + var o = xt(this, r); + (o.value || (o.value = {}))[e] = i.apply(this, arguments); + }), function(o) { + return yt(o, r).value[e]; + }; +} +function eo(t, e) { + var i; + return (typeof e == "number" ? At : e instanceof pe ? Cr : (i = pe(e)) ? (e = i, Cr) : Rs)(t, e); +} +function Qs(t) { + return function() { + this.removeAttribute(t); + }; +} +function ta(t) { + return function() { + this.removeAttributeNS(t.space, t.local); + }; +} +function ea(t, e, i) { + var r, o = i + "", n; + return function() { + var s = this.getAttribute(t); + return s === o ? null : s === r ? n : n = e(r = s, i); + }; +} +function ia(t, e, i) { + var r, o = i + "", n; + return function() { + var s = this.getAttributeNS(t.space, t.local); + return s === o ? null : s === r ? n : n = e(r = s, i); + }; +} +function ra(t, e, i) { + var r, o, n; + return function() { + var s, l = i(this), h; + return l == null ? void this.removeAttribute(t) : (s = this.getAttribute(t), h = l + "", s === h ? null : s === r && h === o ? n : (o = h, n = e(r = s, l))); + }; +} +function oa(t, e, i) { + var r, o, n; + return function() { + var s, l = i(this), h; + return l == null ? void this.removeAttributeNS(t.space, t.local) : (s = this.getAttributeNS(t.space, t.local), h = l + "", s === h ? null : s === r && h === o ? n : (o = h, n = e(r = s, l))); + }; +} +function na(t, e) { + var i = Xe(t), r = i === "transform" ? Ws : eo; + return this.attrTween(t, typeof e == "function" ? (i.local ? oa : ra)(i, r, Wi(this, "attr." + t, e)) : e == null ? (i.local ? ta : Qs)(i) : (i.local ? ia : ea)(i, r, e)); +} +function sa(t, e) { + return function(i) { + this.setAttribute(t, e.call(this, i)); + }; +} +function aa(t, e) { + return function(i) { + this.setAttributeNS(t.space, t.local, e.call(this, i)); + }; +} +function la(t, e) { + var i, r; + function o() { + var n = e.apply(this, arguments); + return n !== r && (i = (r = n) && aa(t, n)), i; + } + return o._value = e, o; +} +function ha(t, e) { + var i, r; + function o() { + var n = e.apply(this, arguments); + return n !== r && (i = (r = n) && sa(t, n)), i; + } + return o._value = e, o; +} +function ca(t, e) { + var i = "attr." + t; + if (arguments.length < 2) + return (i = this.tween(i)) && i._value; + if (e == null) + return this.tween(i, null); + if (typeof e != "function") + throw new Error(); + var r = Xe(t); + return this.tween(i, (r.local ? la : ha)(r, e)); +} +function ua(t, e) { + return function() { + $i(this, t).delay = +e.apply(this, arguments); + }; +} +function fa(t, e) { + return e = +e, function() { + $i(this, t).delay = e; + }; +} +function da(t) { + var e = this._id; + return arguments.length ? this.each((typeof t == "function" ? ua : fa)(e, t)) : yt(this.node(), e).delay; +} +function ga(t, e) { + return function() { + xt(this, t).duration = +e.apply(this, arguments); + }; +} +function pa(t, e) { + return e = +e, function() { + xt(this, t).duration = e; + }; +} +function ma(t) { + var e = this._id; + return arguments.length ? this.each((typeof t == "function" ? ga : pa)(e, t)) : yt(this.node(), e).duration; +} +function Ca(t, e) { + if (typeof e != "function") + throw new Error(); + return function() { + xt(this, t).ease = e; + }; +} +function ya(t) { + var e = this._id; + return arguments.length ? this.each(Ca(e, t)) : yt(this.node(), e).ease; +} +function ba(t, e) { + return function() { + var i = e.apply(this, arguments); + if (typeof i != "function") + throw new Error(); + xt(this, t).ease = i; + }; +} +function _a(t) { + if (typeof t != "function") + throw new Error(); + return this.each(ba(this._id, t)); +} +function xa(t) { + typeof t != "function" && (t = Dr(t)); + for (var e = this._groups, i = e.length, r = new Array(i), o = 0; o < i; ++o) + for (var n = e[o], s = n.length, l = r[o] = [], h, u = 0; u < s; ++u) + (h = n[u]) && t.call(h, h.__data__, u, n) && l.push(h); + return new wt(r, this._parents, this._name, this._id); +} +function Ta(t) { + if (t._id !== this._id) + throw new Error(); + for (var e = this._groups, i = t._groups, r = e.length, o = i.length, n = Math.min(r, o), s = new Array(r), l = 0; l < n; ++l) + for (var h = e[l], u = i[l], f = h.length, g = s[l] = new Array(f), x, _ = 0; _ < f; ++_) + (x = h[_] || u[_]) && (g[_] = x); + for (; l < r; ++l) + s[l] = e[l]; + return new wt(s, this._parents, this._name, this._id); +} +function ka(t) { + return (t + "").trim().split(/^|\s+/).every(function(e) { + var i = e.indexOf("."); + return i >= 0 && (e = e.slice(0, i)), !e || e === "start"; + }); +} +function Sa(t, e, i) { + var r, o, n = ka(e) ? $i : xt; + return function() { + var s = n(this, t), l = s.on; + l !== r && (o = (r = l).copy()).on(e, i), s.on = o; + }; +} +function Ba(t, e) { + var i = this._id; + return arguments.length < 2 ? yt(this.node(), i).on.on(t) : this.each(Sa(i, t, e)); +} +function va(t) { + return function() { + var e = this.parentNode; + for (var i in this.__transition) + if (+i !== t) + return; + e && e.removeChild(this); + }; +} +function wa() { + return this.on("end.remove", va(this._id)); +} +function La(t) { + var e = this._name, i = this._id; + typeof t != "function" && (t = Ii(t)); + for (var r = this._groups, o = r.length, n = new Array(o), s = 0; s < o; ++s) + for (var l = r[s], h = l.length, u = n[s] = new Array(h), f, g, x = 0; x < h; ++x) + (f = l[x]) && (g = t.call(f, f.__data__, x, l)) && ("__data__" in f && (g.__data__ = f.__data__), u[x] = g, Ke(u[x], e, i, x, u, yt(f, i))); + return new wt(n, this._parents, e, i); +} +function Fa(t) { + var e = this._name, i = this._id; + typeof t != "function" && (t = Ir(t)); + for (var r = this._groups, o = r.length, n = [], s = [], l = 0; l < o; ++l) + for (var h = r[l], u = h.length, f, g = 0; g < u; ++g) + if (f = h[g]) { + for (var x = t.call(f, f.__data__, g, h), _, M = yt(f, i), z = 0, j = x.length; z < j; ++z) + (_ = x[z]) && Ke(_, e, i, z, x, M); + n.push(x), s.push(f); + } + return new wt(n, s, e, i); +} +var Aa = Ce.prototype.constructor; +function Ea() { + return new Aa(this._groups, this._parents); +} +function Ma(t, e) { + var i, r, o; + return function() { + var n = Qt(this, t), s = (this.style.removeProperty(t), Qt(this, t)); + return n === s ? null : n === i && s === r ? o : o = e(i = n, r = s); + }; +} +function io(t) { + return function() { + this.style.removeProperty(t); + }; +} +function Oa(t, e, i) { + var r, o = i + "", n; + return function() { + var s = Qt(this, t); + return s === o ? null : s === r ? n : n = e(r = s, i); + }; +} +function Ia(t, e, i) { + var r, o, n; + return function() { + var s = Qt(this, t), l = i(this), h = l + ""; + return l == null && (h = l = (this.style.removeProperty(t), Qt(this, t))), s === h ? null : s === r && h === o ? n : (o = h, n = e(r = s, l)); + }; +} +function Da(t, e) { + var i, r, o, n = "style." + e, s = "end." + n, l; + return function() { + var h = xt(this, t), u = h.on, f = h.value[n] == null ? l || (l = io(e)) : void 0; + (u !== i || o !== f) && (r = (i = u).copy()).on(s, o = f), h.on = r; + }; +} +function Ra(t, e, i) { + var r = (t += "") == "transform" ? $s : eo; + return e == null ? this.styleTween(t, Ma(t, r)).on("end.style." + t, io(t)) : typeof e == "function" ? this.styleTween(t, Ia(t, r, Wi(this, "style." + t, e))).each(Da(this._id, t)) : this.styleTween(t, Oa(t, r, e), i).on("end.style." + t, null); +} +function Na(t, e, i) { + return function(r) { + this.style.setProperty(t, e.call(this, r), i); + }; +} +function za(t, e, i) { + var r, o; + function n() { + var s = e.apply(this, arguments); + return s !== o && (r = (o = s) && Na(t, s, i)), r; + } + return n._value = e, n; +} +function $a(t, e, i) { + var r = "style." + (t += ""); + if (arguments.length < 2) + return (r = this.tween(r)) && r._value; + if (e == null) + return this.tween(r, null); + if (typeof e != "function") + throw new Error(); + return this.tween(r, za(t, e, i ?? "")); +} +function Wa(t) { + return function() { + this.textContent = t; + }; +} +function Pa(t) { + return function() { + var e = t(this); + this.textContent = e ?? ""; + }; +} +function Ha(t) { + return this.tween("text", typeof t == "function" ? Pa(Wi(this, "text", t)) : Wa(t == null ? "" : t + "")); +} +function qa(t) { + return function(e) { + this.textContent = t.call(this, e); + }; +} +function Ua(t) { + var e, i; + function r() { + var o = t.apply(this, arguments); + return o !== i && (e = (i = o) && qa(o)), e; + } + return r._value = t, r; +} +function Ga(t) { + var e = "text"; + if (arguments.length < 1) + return (e = this.tween(e)) && e._value; + if (t == null) + return this.tween(e, null); + if (typeof t != "function") + throw new Error(); + return this.tween(e, Ua(t)); +} +function Va() { + for (var t = this._name, e = this._id, i = ro(), r = this._groups, o = r.length, n = 0; n < o; ++n) + for (var s = r[n], l = s.length, h, u = 0; u < l; ++u) + if (h = s[u]) { + var f = yt(h, e); + Ke(h, t, i, u, s, { + time: f.time + f.delay + f.duration, + delay: 0, + duration: f.duration, + ease: f.ease + }); + } + return new wt(r, this._parents, t, i); +} +function Ya() { + var t, e, i = this, r = i._id, o = i.size(); + return new Promise(function(n, s) { + var l = { value: s }, h = { value: function() { + --o === 0 && n(); + } }; + i.each(function() { + var u = xt(this, r), f = u.on; + f !== t && (e = (t = f).copy(), e._.cancel.push(l), e._.interrupt.push(l), e._.end.push(h)), u.on = e; + }), o === 0 && n(); + }); +} +var Xa = 0; +function wt(t, e, i, r) { + this._groups = t, this._parents = e, this._name = i, this._id = r; +} +function ro() { + return ++Xa; +} +var vt = Ce.prototype; +wt.prototype = { + constructor: wt, + select: La, + selectAll: Fa, + selectChild: vt.selectChild, + selectChildren: vt.selectChildren, + filter: xa, + merge: Ta, + selection: Ea, + transition: Va, + call: vt.call, + nodes: vt.nodes, + node: vt.node, + size: vt.size, + empty: vt.empty, + each: vt.each, + on: Ba, + attr: na, + attrTween: ca, + style: Ra, + styleTween: $a, + text: Ha, + textTween: Ga, + remove: wa, + tween: Js, + delay: da, + duration: ma, + ease: ya, + easeVarying: _a, + end: Ya, + [Symbol.iterator]: vt[Symbol.iterator] +}; +function ja(t) { + return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; +} +var Ka = { + time: null, + // Set on use. + delay: 0, + duration: 250, + ease: ja +}; +function Za(t, e) { + for (var i; !(i = t.__transition) || !(i = i[e]); ) + if (!(t = t.parentNode)) + throw new Error(`transition ${e} not found`); + return i; +} +function Ja(t) { + var e, i; + t instanceof wt ? (e = t._id, t = t._name) : (e = ro(), (i = Ka).time = zi(), t = t == null ? null : t + ""); + for (var r = this._groups, o = r.length, n = 0; n < o; ++n) + for (var s = r[n], l = s.length, h, u = 0; u < l; ++u) + (h = s[u]) && Ke(h, t, e, u, s, i || Za(h, e)); + return new wt(r, this._parents, t, e); +} +Ce.prototype.interrupt = js; +Ce.prototype.transition = Ja; +function he(t, e, i) { + this.k = t, this.x = e, this.y = i; +} +he.prototype = { + constructor: he, + scale: function(t) { + return t === 1 ? this : new he(this.k * t, this.x, this.y); + }, + translate: function(t, e) { + return t === 0 & e === 0 ? this : new he(this.k, this.x + this.k * t, this.y + this.k * e); + }, + apply: function(t) { + return [t[0] * this.k + this.x, t[1] * this.k + this.y]; + }, + applyX: function(t) { + return t * this.k + this.x; + }, + applyY: function(t) { + return t * this.k + this.y; + }, + invert: function(t) { + return [(t[0] - this.x) / this.k, (t[1] - this.y) / this.k]; + }, + invertX: function(t) { + return (t - this.x) / this.k; + }, + invertY: function(t) { + return (t - this.y) / this.k; + }, + rescaleX: function(t) { + return t.copy().domain(t.range().map(this.invertX, this).map(t.invert, t)); + }, + rescaleY: function(t) { + return t.copy().domain(t.range().map(this.invertY, this).map(t.invert, t)); + }, + toString: function() { + return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")"; + } +}; +he.prototype; +/*! @license DOMPurify 2.4.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.5/LICENSE */ +function Et(t) { + return Et = 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; + }, Et(t); +} +function Fi(t, e) { + return Fi = Object.setPrototypeOf || function(r, o) { + return r.__proto__ = o, r; + }, Fi(t, e); +} +function Qa() { + if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { + })), !0; + } catch { + return !1; + } +} +function De(t, e, i) { + return Qa() ? De = Reflect.construct : De = function(o, n, s) { + var l = [null]; + l.push.apply(l, n); + var h = Function.bind.apply(o, l), u = new h(); + return s && Fi(u, s.prototype), u; + }, De.apply(null, arguments); +} +function pt(t) { + return tl(t) || el(t) || il(t) || rl(); +} +function tl(t) { + if (Array.isArray(t)) + return Ai(t); +} +function el(t) { + if (typeof Symbol < "u" && t[Symbol.iterator] != null || t["@@iterator"] != null) + return Array.from(t); +} +function il(t, e) { + if (t) { + if (typeof t == "string") + return Ai(t, e); + var i = Object.prototype.toString.call(t).slice(8, -1); + if (i === "Object" && t.constructor && (i = t.constructor.name), i === "Map" || i === "Set") + return Array.from(t); + if (i === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)) + return Ai(t, e); + } +} +function Ai(t, e) { + (e == null || e > t.length) && (e = t.length); + for (var i = 0, r = new Array(e); i < e; i++) + r[i] = t[i]; + return r; +} +function rl() { + throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); +} +var ol = Object.hasOwnProperty, kr = Object.setPrototypeOf, nl = Object.isFrozen, sl = Object.getPrototypeOf, al = Object.getOwnPropertyDescriptor, J = Object.freeze, Ct = Object.seal, ll = Object.create, oo = typeof Reflect < "u" && Reflect, Ve = oo.apply, Ei = oo.construct; +Ve || (Ve = function(e, i, r) { + return e.apply(i, r); +}); +J || (J = function(e) { + return e; +}); +Ct || (Ct = function(e) { + return e; +}); +Ei || (Ei = function(e, i) { + return De(e, pt(i)); +}); +var hl = ft(Array.prototype.forEach), Sr = ft(Array.prototype.pop), se = ft(Array.prototype.push), Re = ft(String.prototype.toLowerCase), pi = ft(String.prototype.toString), cl = ft(String.prototype.match), gt = ft(String.prototype.replace), ul = ft(String.prototype.indexOf), fl = ft(String.prototype.trim), K = ft(RegExp.prototype.test), mi = dl(TypeError); +function ft(t) { + return function(e) { + for (var i = arguments.length, r = new Array(i > 1 ? i - 1 : 0), o = 1; o < i; o++) + r[o - 1] = arguments[o]; + return Ve(t, e, r); + }; +} +function dl(t) { + return function() { + for (var e = arguments.length, i = new Array(e), r = 0; r < e; r++) + i[r] = arguments[r]; + return Ei(t, i); + }; +} +function E(t, e, i) { + i = i || Re, kr && kr(t, null); + for (var r = e.length; r--; ) { + var o = e[r]; + if (typeof o == "string") { + var n = i(o); + n !== o && (nl(e) || (e[r] = n), o = n); + } + t[o] = !0; + } + return t; +} +function zt(t) { + var e = ll(null), i; + for (i in t) + Ve(ol, t, [i]) === !0 && (e[i] = t[i]); + return e; +} +function Le(t, e) { + for (; t !== null; ) { + var i = al(t, e); + if (i) { + if (i.get) + return ft(i.get); + if (typeof i.value == "function") + return ft(i.value); + } + t = sl(t); + } + function r(o) { + return console.warn("fallback value for", o), null; + } + return r; +} +var Br = J(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), Ci = J(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), yi = J(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), gl = J(["animate", "color-profile", "cursor", "discard", "fedropshadow", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), bi = J(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover"]), pl = J(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), vr = J(["#text"]), wr = J(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "xmlns", "slot"]), _i = J(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), Lr = J(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Fe = J(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), ml = Ct(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Cl = Ct(/<%[\w\W]*|[\w\W]*%>/gm), yl = Ct(/\${[\w\W]*}/gm), bl = Ct(/^data-[\-\w.\u00B7-\uFFFF]/), _l = Ct(/^aria-[\-\w]+$/), xl = Ct( + /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i + // eslint-disable-line no-useless-escape +), Tl = Ct(/^(?:\w+script|data):/i), kl = Ct( + /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g + // eslint-disable-line no-control-regex +), Sl = Ct(/^html$/i), Bl = function() { + return typeof window > "u" ? null : window; +}, vl = function(e, i) { + if (Et(e) !== "object" || typeof e.createPolicy != "function") + return null; + var r = null, o = "data-tt-policy-suffix"; + i.currentScript && i.currentScript.hasAttribute(o) && (r = i.currentScript.getAttribute(o)); + var n = "dompurify" + (r ? "#" + r : ""); + try { + return e.createPolicy(n, { + createHTML: function(l) { + return l; + }, + createScriptURL: function(l) { + return l; + } + }); + } catch { + return console.warn("TrustedTypes policy " + n + " could not be created."), null; + } +}; +function no() { + var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Bl(), e = function(a) { + return no(a); + }; + if (e.version = "2.4.5", e.removed = [], !t || !t.document || t.document.nodeType !== 9) + return e.isSupported = !1, e; + var i = t.document, r = t.document, o = t.DocumentFragment, n = t.HTMLTemplateElement, s = t.Node, l = t.Element, h = t.NodeFilter, u = t.NamedNodeMap, f = u === void 0 ? t.NamedNodeMap || t.MozNamedAttrMap : u, g = t.HTMLFormElement, x = t.DOMParser, _ = t.trustedTypes, M = l.prototype, z = Le(M, "cloneNode"), j = Le(M, "nextSibling"), Ot = Le(M, "childNodes"), nt = Le(M, "parentNode"); + if (typeof n == "function") { + var Q = r.createElement("template"); + Q.content && Q.content.ownerDocument && (r = Q.content.ownerDocument); + } + var H = vl(_, i), at = H ? H.createHTML("") : "", lt = r, It = lt.implementation, Ht = lt.createNodeIterator, W = lt.createDocumentFragment, D = lt.getElementsByTagName, qt = i.importNode, ie = {}; + try { + ie = zt(r).documentMode ? r.documentMode : {}; + } catch { + } + var k = {}; + e.isSupported = typeof nt == "function" && It && typeof It.createHTMLDocument < "u" && ie !== 9; + var y = ml, p = Cl, B = yl, b = bl, F = _l, w = Tl, O = kl, $ = xl, A = null, P = E({}, [].concat(pt(Br), pt(Ci), pt(yi), pt(bi), pt(vr))), R = null, ht = E({}, [].concat(pt(wr), pt(_i), pt(Lr), pt(Fe))), N = Object.seal(Object.create(null, { + tagNameCheck: { + writable: !0, + configurable: !1, + enumerable: !0, + value: null + }, + attributeNameCheck: { + writable: !0, + configurable: !1, + enumerable: !0, + value: null + }, + allowCustomizedBuiltInElements: { + writable: !0, + configurable: !1, + enumerable: !0, + value: !1 + } + })), dt = null, bt = null, G = !0, ct = !0, Ut = !1, Dt = !0, Gt = !1, Rt = !1, ri = !1, oi = !1, Vt = !1, be = !1, _e = !1, Gi = !0, Vi = !1, vo = "user-content-", ni = !0, re = !1, Yt = {}, Xt = null, Yi = E({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]), Xi = null, ji = E({}, ["audio", "video", "img", "source", "image", "track"]), si = null, Ki = E({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), xe = "http://www.w3.org/1998/Math/MathML", Te = "http://www.w3.org/2000/svg", Tt = "http://www.w3.org/1999/xhtml", jt = Tt, ai = !1, li = null, wo = E({}, [xe, Te, Tt], pi), Nt, Lo = ["application/xhtml+xml", "text/html"], Fo = "text/html", q, Kt = null, Ao = r.createElement("form"), Zi = function(a) { + return a instanceof RegExp || a instanceof Function; + }, hi = function(a) { + Kt && Kt === a || ((!a || Et(a) !== "object") && (a = {}), a = zt(a), Nt = // eslint-disable-next-line unicorn/prefer-includes + Lo.indexOf(a.PARSER_MEDIA_TYPE) === -1 ? Nt = Fo : Nt = a.PARSER_MEDIA_TYPE, q = Nt === "application/xhtml+xml" ? pi : Re, A = "ALLOWED_TAGS" in a ? E({}, a.ALLOWED_TAGS, q) : P, R = "ALLOWED_ATTR" in a ? E({}, a.ALLOWED_ATTR, q) : ht, li = "ALLOWED_NAMESPACES" in a ? E({}, a.ALLOWED_NAMESPACES, pi) : wo, si = "ADD_URI_SAFE_ATTR" in a ? E( + zt(Ki), + // eslint-disable-line indent + a.ADD_URI_SAFE_ATTR, + // eslint-disable-line indent + q + // eslint-disable-line indent + ) : Ki, Xi = "ADD_DATA_URI_TAGS" in a ? E( + zt(ji), + // eslint-disable-line indent + a.ADD_DATA_URI_TAGS, + // eslint-disable-line indent + q + // eslint-disable-line indent + ) : ji, Xt = "FORBID_CONTENTS" in a ? E({}, a.FORBID_CONTENTS, q) : Yi, dt = "FORBID_TAGS" in a ? E({}, a.FORBID_TAGS, q) : {}, bt = "FORBID_ATTR" in a ? E({}, a.FORBID_ATTR, q) : {}, Yt = "USE_PROFILES" in a ? a.USE_PROFILES : !1, G = a.ALLOW_ARIA_ATTR !== !1, ct = a.ALLOW_DATA_ATTR !== !1, Ut = a.ALLOW_UNKNOWN_PROTOCOLS || !1, Dt = a.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Gt = a.SAFE_FOR_TEMPLATES || !1, Rt = a.WHOLE_DOCUMENT || !1, Vt = a.RETURN_DOM || !1, be = a.RETURN_DOM_FRAGMENT || !1, _e = a.RETURN_TRUSTED_TYPE || !1, oi = a.FORCE_BODY || !1, Gi = a.SANITIZE_DOM !== !1, Vi = a.SANITIZE_NAMED_PROPS || !1, ni = a.KEEP_CONTENT !== !1, re = a.IN_PLACE || !1, $ = a.ALLOWED_URI_REGEXP || $, jt = a.NAMESPACE || Tt, N = a.CUSTOM_ELEMENT_HANDLING || {}, a.CUSTOM_ELEMENT_HANDLING && Zi(a.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (N.tagNameCheck = a.CUSTOM_ELEMENT_HANDLING.tagNameCheck), a.CUSTOM_ELEMENT_HANDLING && Zi(a.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (N.attributeNameCheck = a.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), a.CUSTOM_ELEMENT_HANDLING && typeof a.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (N.allowCustomizedBuiltInElements = a.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), Gt && (ct = !1), be && (Vt = !0), Yt && (A = E({}, pt(vr)), R = [], Yt.html === !0 && (E(A, Br), E(R, wr)), Yt.svg === !0 && (E(A, Ci), E(R, _i), E(R, Fe)), Yt.svgFilters === !0 && (E(A, yi), E(R, _i), E(R, Fe)), Yt.mathMl === !0 && (E(A, bi), E(R, Lr), E(R, Fe))), a.ADD_TAGS && (A === P && (A = zt(A)), E(A, a.ADD_TAGS, q)), a.ADD_ATTR && (R === ht && (R = zt(R)), E(R, a.ADD_ATTR, q)), a.ADD_URI_SAFE_ATTR && E(si, a.ADD_URI_SAFE_ATTR, q), a.FORBID_CONTENTS && (Xt === Yi && (Xt = zt(Xt)), E(Xt, a.FORBID_CONTENTS, q)), ni && (A["#text"] = !0), Rt && E(A, ["html", "head", "body"]), A.table && (E(A, ["tbody"]), delete dt.tbody), J && J(a), Kt = a); + }, Ji = E({}, ["mi", "mo", "mn", "ms", "mtext"]), Qi = E({}, ["foreignobject", "desc", "title", "annotation-xml"]), Eo = E({}, ["title", "style", "font", "a", "script"]), ke = E({}, Ci); + E(ke, yi), E(ke, gl); + var ci = E({}, bi); + E(ci, pl); + var Mo = function(a) { + var d = nt(a); + (!d || !d.tagName) && (d = { + namespaceURI: jt, + tagName: "template" + }); + var C = Re(a.tagName), I = Re(d.tagName); + return li[a.namespaceURI] ? a.namespaceURI === Te ? d.namespaceURI === Tt ? C === "svg" : d.namespaceURI === xe ? C === "svg" && (I === "annotation-xml" || Ji[I]) : Boolean(ke[C]) : a.namespaceURI === xe ? d.namespaceURI === Tt ? C === "math" : d.namespaceURI === Te ? C === "math" && Qi[I] : Boolean(ci[C]) : a.namespaceURI === Tt ? d.namespaceURI === Te && !Qi[I] || d.namespaceURI === xe && !Ji[I] ? !1 : !ci[C] && (Eo[C] || !ke[C]) : !!(Nt === "application/xhtml+xml" && li[a.namespaceURI]) : !1; + }, kt = function(a) { + se(e.removed, { + element: a + }); + try { + a.parentNode.removeChild(a); + } catch { + try { + a.outerHTML = at; + } catch { + a.remove(); + } + } + }, ui = function(a, d) { + try { + se(e.removed, { + attribute: d.getAttributeNode(a), + from: d + }); + } catch { + se(e.removed, { + attribute: null, + from: d + }); + } + if (d.removeAttribute(a), a === "is" && !R[a]) + if (Vt || be) + try { + kt(d); + } catch { + } + else + try { + d.setAttribute(a, ""); + } catch { + } + }, tr = function(a) { + var d, C; + if (oi) + a = "" + a; + else { + var I = cl(a, /^[\r\n\t ]+/); + C = I && I[0]; + } + Nt === "application/xhtml+xml" && jt === Tt && (a = '' + a + ""); + var tt = H ? H.createHTML(a) : a; + if (jt === Tt) + try { + d = new x().parseFromString(tt, Nt); + } catch { + } + if (!d || !d.documentElement) { + d = It.createDocument(jt, "template", null); + try { + d.documentElement.innerHTML = ai ? at : tt; + } catch { + } + } + var Y = d.body || d.documentElement; + return a && C && Y.insertBefore(r.createTextNode(C), Y.childNodes[0] || null), jt === Tt ? D.call(d, Rt ? "html" : "body")[0] : Rt ? d.documentElement : Y; + }, er = function(a) { + return Ht.call( + a.ownerDocument || a, + a, + // eslint-disable-next-line no-bitwise + h.SHOW_ELEMENT | h.SHOW_COMMENT | h.SHOW_TEXT, + null, + !1 + ); + }, Oo = function(a) { + return a instanceof g && (typeof a.nodeName != "string" || typeof a.textContent != "string" || typeof a.removeChild != "function" || !(a.attributes instanceof f) || typeof a.removeAttribute != "function" || typeof a.setAttribute != "function" || typeof a.namespaceURI != "string" || typeof a.insertBefore != "function" || typeof a.hasChildNodes != "function"); + }, oe = function(a) { + return Et(s) === "object" ? a instanceof s : a && Et(a) === "object" && typeof a.nodeType == "number" && typeof a.nodeName == "string"; + }, St = function(a, d, C) { + k[a] && hl(k[a], function(I) { + I.call(e, d, C, Kt); + }); + }, ir = function(a) { + var d; + if (St("beforeSanitizeElements", a, null), Oo(a) || K(/[\u0080-\uFFFF]/, a.nodeName)) + return kt(a), !0; + var C = q(a.nodeName); + if (St("uponSanitizeElement", a, { + tagName: C, + allowedTags: A + }), a.hasChildNodes() && !oe(a.firstElementChild) && (!oe(a.content) || !oe(a.content.firstElementChild)) && K(/<[/\w]/g, a.innerHTML) && K(/<[/\w]/g, a.textContent) || C === "select" && K(/