@ai-projector/ide 0.0.0-stage → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +35 -2
- package/bin/install-desktop +17 -0
- package/bin/install-desktop.cmd +11 -0
- package/bin/projector +22 -0
- package/bin/projector.cmd +11 -0
- package/dist/assets/CodeViewer--WUSmn5i.css +1 -0
- package/dist/assets/CodeViewer-C-C3aibO.js +1 -0
- package/dist/assets/DiscussionView-Cd3exhWx.css +1 -0
- package/dist/assets/DiscussionView-K3YyWE-E.js +2 -0
- package/dist/assets/EditorSettings-DlzJc8cp.js +13 -0
- package/dist/assets/EditorSettings-jSngmpPq.css +1 -0
- package/dist/assets/HtmlViewer-DULKK0_6.js +2 -0
- package/dist/assets/HtmlViewer-XHn9rACG.css +1 -0
- package/dist/assets/ImageViewport-BT_ftU4z.js +1 -0
- package/dist/assets/ImageViewport-JcG9P4B6.css +1 -0
- package/dist/assets/IssueView-ChJFmrTW.js +1 -0
- package/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/assets/MarkdownViewer-C646XbYf.css +1 -0
- package/dist/assets/MarkdownViewer-Dm2MVp3X.js +2 -0
- package/dist/assets/PullRequestView-Cipn5P0H.js +3 -0
- package/dist/assets/PullRequestView-CzZn9mOg.css +1 -0
- package/dist/assets/ReleaseView-Cz6dH4ej.js +2 -0
- package/dist/assets/ReleaseView-VLO9NVfI.css +1 -0
- package/dist/assets/SplitPanes-0-UT7ksm.css +1 -0
- package/dist/assets/SplitPanes-DNDTWIta.js +1 -0
- package/dist/assets/SvgViewer-DP6-1_fw.css +1 -0
- package/dist/assets/SvgViewer-DkoULP8F.js +2 -0
- package/dist/assets/TerminalView-C30_q784.css +1 -0
- package/dist/assets/TerminalView-fWmIbnZn.js +16 -0
- package/dist/assets/TrackerDetail-CBaLycQg.css +1 -0
- package/dist/assets/TrackerDetail-DuzfEwSZ.js +1 -0
- package/dist/assets/UiButton-AkN01P3P.css +1 -0
- package/dist/assets/UiButton-DvucBdmd.js +2 -0
- package/dist/assets/UiPanel-BUDYIo-h.css +1 -0
- package/dist/assets/UiPanel-DtI4DFYT.js +1 -0
- package/dist/assets/UiViewerPage-CMFEzZ2i.css +1 -0
- package/dist/assets/UiViewerPage-aHNgiSjO.js +2 -0
- package/dist/assets/VisualMarkdownEditor-1DNSAYyq.css +1 -0
- package/dist/assets/VisualMarkdownEditor-BHx2olWh.js +1070 -0
- package/dist/assets/_plugin-vue_export-helper-D62Ebo7D.js +3 -0
- package/dist/assets/apl-gfMMiTNf.js +1 -0
- package/dist/assets/asciiarmor-C_eisQCp.js +1 -0
- package/dist/assets/asn1-DCl_8MCW.js +1 -0
- package/dist/assets/asterisk-BEn0Cwpx.js +1 -0
- package/dist/assets/brainfuck-D5EjA2JK.js +1 -0
- package/dist/assets/clike-xvONpD0Z.js +1 -0
- package/dist/assets/clojure-BflJGmDX.js +1 -0
- package/dist/assets/cmake-84nbDH0I.js +1 -0
- package/dist/assets/cobol-DHLQUbN7.js +1 -0
- package/dist/assets/coffeescript-De_zI4J0.js +1 -0
- package/dist/assets/commonlisp-DgAKBe0r.js +1 -0
- package/dist/assets/compiler-dom.esm-bundler-C5a_rSi1.js +9 -0
- package/dist/assets/crystal-Bl6YKCG_.js +1 -0
- package/dist/assets/css-CnaYoQib.js +1 -0
- package/dist/assets/cypher-p9eYesGn.js +1 -0
- package/dist/assets/d-DWkQyNnU.js +1 -0
- package/dist/assets/diff-ChtP43wD.js +1 -0
- package/dist/assets/dist-23D313r2.js +13 -0
- package/dist/assets/dist-9YLT-RM-.js +11 -0
- package/dist/assets/dist-9guQ6tUS.js +1 -0
- package/dist/assets/dist-BA_HKdx1.js +2 -0
- package/dist/assets/dist-BMX-4S0G.js +1 -0
- package/dist/assets/dist-BQmIGtmd.js +6 -0
- package/dist/assets/dist-BVEl6uFx.js +1 -0
- package/dist/assets/dist-BuiJgwGF.js +9 -0
- package/dist/assets/dist-Bzl1vuDO.js +1 -0
- package/dist/assets/dist-C1mn-4rn.js +1 -0
- package/dist/assets/dist-CG79NjMk.js +1 -0
- package/dist/assets/dist-CRLdLpSX.js +2 -0
- package/dist/assets/dist-Coak6JQD.js +1 -0
- package/dist/assets/dist-CpgyHBvu.js +1 -0
- package/dist/assets/dist-CrRIwgTS.js +1 -0
- package/dist/assets/dist-Cu_4z-jQ.js +1 -0
- package/dist/assets/dist-CxoUUhWx.js +1 -0
- package/dist/assets/dist-CzOhSFRQ.js +1 -0
- package/dist/assets/dist-DN5Y0OA5.js +1 -0
- package/dist/assets/dist-Dqsd8MyB.js +1 -0
- package/dist/assets/dist-Dvv0YQ-H.js +23 -0
- package/dist/assets/dist-DzoDV6Eh.js +2 -0
- package/dist/assets/dist-NMUsQt1c.js +1 -0
- package/dist/assets/dist-ZRLBgDFY.js +1 -0
- package/dist/assets/dist-cLGxPfRN.js +1 -0
- package/dist/assets/dist-p1Xy77w3.js +1 -0
- package/dist/assets/dockerfile-DJkHQgkl.js +1 -0
- package/dist/assets/dtd-DTF72YNO.js +1 -0
- package/dist/assets/dylan-S7ucR4pR.js +1 -0
- package/dist/assets/ebnf-D4c0_ac3.js +1 -0
- package/dist/assets/ecl-BVIeWmwY.js +1 -0
- package/dist/assets/editor-theme-ClBxXjSu.js +1 -0
- package/dist/assets/eiffel-BEjRio4Q.js +1 -0
- package/dist/assets/elm-Cshzl8qu.js +1 -0
- package/dist/assets/erlang-BV0c4Hdn.js +1 -0
- package/dist/assets/events.worker-C2Opu9Sc.js +1 -0
- package/dist/assets/external-link-lkcxItwM.js +1 -0
- package/dist/assets/factor-LKH5gN8L.js +1 -0
- package/dist/assets/fcl-ClOhbFR7.js +1 -0
- package/dist/assets/forth-D6RzAl64.js +1 -0
- package/dist/assets/fortran-Bt6PBEDR.js +1 -0
- package/dist/assets/gas-BHEdbvp9.js +1 -0
- package/dist/assets/gherkin-oBAE_ms0.js +1 -0
- package/dist/assets/github-emoji-CXJ5RSZS.js +169 -0
- package/dist/assets/github-emoji-D8dkjuM_.css +1 -0
- package/dist/assets/groovy-CUrWKPia.js +1 -0
- package/dist/assets/haskell-BRsoo5mP.js +1 -0
- package/dist/assets/haxe-DjVOVvNP.js +1 -0
- package/dist/assets/http-CLVgA2GD.js +1 -0
- package/dist/assets/hub-DfPcTPCC.js +1 -0
- package/dist/assets/idl-BUZw3wgd.js +1 -0
- package/dist/assets/javascript-lS2r2ifg.js +1 -0
- package/dist/assets/julia-CQfgDRfP.js +1 -0
- package/dist/assets/livescript-BXxG0Yva.js +1 -0
- package/dist/assets/lua-DPCEkfD_.js +1 -0
- package/dist/assets/main-JoBAi6ol.css +1 -0
- package/dist/assets/main-iz4ud0jC.js +178 -0
- package/dist/assets/mathematica-u8YMmbU0.js +1 -0
- package/dist/assets/mbox-BEMVcqjs.js +1 -0
- package/dist/assets/mirc-C9zpzAZU.js +1 -0
- package/dist/assets/mllike-B45xgp2S.js +1 -0
- package/dist/assets/modelica-CqHI_q-D.js +1 -0
- package/dist/assets/mscgen-qgSLujhx.js +1 -0
- package/dist/assets/mumps-BSzj6Xyz.js +1 -0
- package/dist/assets/nginx-C-ORUuei.js +1 -0
- package/dist/assets/nsis-viPvXFiq.js +1 -0
- package/dist/assets/ntriples-CzMBulkp.js +1 -0
- package/dist/assets/octave-D2Q8cUp1.js +1 -0
- package/dist/assets/oz-BwTct_5T.js +1 -0
- package/dist/assets/pascal-Dp_KdFgX.js +1 -0
- package/dist/assets/perl-BkSkiI9m.js +1 -0
- package/dist/assets/pig-AF4Hwhju.js +1 -0
- package/dist/assets/powershell-D8WpQPaX.js +1 -0
- package/dist/assets/preload-helper-BLdHbfdN.js +1 -0
- package/dist/assets/properties-C357ku5U.js +1 -0
- package/dist/assets/protobuf-D1ij_kNL.js +1 -0
- package/dist/assets/pug-BqCHZ5xT.js +1 -0
- package/dist/assets/puppet-BZyAS7I4.js +1 -0
- package/dist/assets/python-B_1Jd8HM.js +1 -0
- package/dist/assets/q-B9NhS7L_.js +1 -0
- package/dist/assets/r-CxDmU1I4.js +1 -0
- package/dist/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/assets/rpm-gpDK5sbt.js +1 -0
- package/dist/assets/ruby-ChfNwlCY.js +1 -0
- package/dist/assets/sas-C2OyD2Y6.js +1 -0
- package/dist/assets/scheme-D9qYN0V5.js +1 -0
- package/dist/assets/shared.esm-bundler-DoSbGLUP.js +2 -0
- package/dist/assets/shared.worker-DpKROrNH.js +1 -0
- package/dist/assets/shell-DwuoZtxw.js +1 -0
- package/dist/assets/sieve-tLWDfEkZ.js +1 -0
- package/dist/assets/simple-mode-DXiLM1-G.js +1 -0
- package/dist/assets/smalltalk-BLp5-jwC.js +1 -0
- package/dist/assets/solr-B78wSQJQ.js +1 -0
- package/dist/assets/sparql-Dz-mlCAC.js +1 -0
- package/dist/assets/spreadsheet-CTIncYxj.js +1 -0
- package/dist/assets/sql-DuQMFDvy.js +1 -0
- package/dist/assets/stex-DNzd62Q_.js +1 -0
- package/dist/assets/styles-CCXo2OoQ.css +1 -0
- package/dist/assets/styles-DZDDPlL3.js +1 -0
- package/dist/assets/stylus-BOVgKnng.js +1 -0
- package/dist/assets/swift-DKB6_1j6.js +1 -0
- package/dist/assets/tcl-BGfruO1u.js +1 -0
- package/dist/assets/textile-C4jVoHG1.js +1 -0
- package/dist/assets/tiddlywiki-VlUiK86J.js +1 -0
- package/dist/assets/tiki-CvUEFusT.js +1 -0
- package/dist/assets/toml-BPTmHmyx.js +1 -0
- package/dist/assets/troff-C2dAgh7P.js +1 -0
- package/dist/assets/ttcn-PPSTk1ow.js +1 -0
- package/dist/assets/ttcn-cfg-2b4Gb5sE.js +1 -0
- package/dist/assets/turtle-Cx3rYX2g.js +1 -0
- package/dist/assets/vb-BthdM_4N.js +1 -0
- package/dist/assets/vbscript-D9f6rSsU.js +1 -0
- package/dist/assets/velocity-CqftRsjg.js +1 -0
- package/dist/assets/verilog-CjI9Y6RI.js +1 -0
- package/dist/assets/vhdl-kS471soi.js +1 -0
- package/dist/assets/webidl-D5jiJvOU.js +1 -0
- package/dist/assets/xquery-BKJx4mf9.js +1 -0
- package/dist/assets/yacas-CXXgtw0p.js +1 -0
- package/dist/assets/z80-Co3PbHdE.js +1 -0
- package/dist/favicon.svg +5 -0
- package/dist/file-icons/LICENSE-lucide.txt +43 -0
- package/dist/file-icons/NOTICE.md +8 -0
- package/dist/file-icons/icons/archive.svg +1 -0
- package/dist/file-icons/icons/assets.svg +1 -0
- package/dist/file-icons/icons/audio.svg +1 -0
- package/dist/file-icons/icons/c.svg +1 -0
- package/dist/file-icons/icons/components.svg +1 -0
- package/dist/file-icons/icons/config.svg +1 -0
- package/dist/file-icons/icons/cpp.svg +1 -0
- package/dist/file-icons/icons/css.svg +1 -0
- package/dist/file-icons/icons/database.svg +1 -0
- package/dist/file-icons/icons/docker.svg +1 -0
- package/dist/file-icons/icons/env.svg +1 -0
- package/dist/file-icons/icons/executable.svg +1 -0
- package/dist/file-icons/icons/file.svg +1 -0
- package/dist/file-icons/icons/folder-open.svg +1 -0
- package/dist/file-icons/icons/folder.svg +1 -0
- package/dist/file-icons/icons/font.svg +1 -0
- package/dist/file-icons/icons/git.svg +1 -0
- package/dist/file-icons/icons/go.svg +1 -0
- package/dist/file-icons/icons/graphql.svg +1 -0
- package/dist/file-icons/icons/html.svg +1 -0
- package/dist/file-icons/icons/ignore.svg +1 -0
- package/dist/file-icons/icons/image.svg +1 -0
- package/dist/file-icons/icons/java.svg +1 -0
- package/dist/file-icons/icons/javascript.svg +1 -0
- package/dist/file-icons/icons/json.svg +1 -0
- package/dist/file-icons/icons/kotlin.svg +1 -0
- package/dist/file-icons/icons/license.svg +1 -0
- package/dist/file-icons/icons/lock.svg +1 -0
- package/dist/file-icons/icons/markdown.svg +1 -0
- package/dist/file-icons/icons/package.svg +1 -0
- package/dist/file-icons/icons/php.svg +1 -0
- package/dist/file-icons/icons/python.svg +1 -0
- package/dist/file-icons/icons/react.svg +1 -0
- package/dist/file-icons/icons/ruby.svg +1 -0
- package/dist/file-icons/icons/rust.svg +1 -0
- package/dist/file-icons/icons/sass.svg +1 -0
- package/dist/file-icons/icons/shell.svg +1 -0
- package/dist/file-icons/icons/source.svg +1 -0
- package/dist/file-icons/icons/svelte.svg +1 -0
- package/dist/file-icons/icons/swift.svg +1 -0
- package/dist/file-icons/icons/tests.svg +1 -0
- package/dist/file-icons/icons/toml.svg +1 -0
- package/dist/file-icons/icons/typescript.svg +1 -0
- package/dist/file-icons/icons/video.svg +1 -0
- package/dist/file-icons/icons/vite.svg +1 -0
- package/dist/file-icons/icons/vue.svg +1 -0
- package/dist/file-icons/icons/yaml.svg +1 -0
- package/dist/file-icons/theme.json +572 -0
- package/dist/file-icons/theme.schema.json +137 -0
- package/dist/github.svg +1 -0
- package/dist/gitlab.svg +1 -0
- package/dist/hub.html +21 -0
- package/dist/icons/apple-touch-icon.png +0 -0
- package/dist/icons/icon-192.png +0 -0
- package/dist/icons/icon-512.png +0 -0
- package/dist/icons/maskable-512.png +0 -0
- package/dist/index.html +42 -0
- package/dist/manifest.webmanifest +37 -0
- package/dist/sw.js +81 -0
- package/package.json +62 -4
- package/packages/cli/app/agent-host.js +163 -0
- package/packages/cli/app/desktop.js +77 -0
- package/packages/cli/app/fix-node-pty.js +52 -0
- package/packages/cli/app/import-companion-key.js +57 -0
- package/packages/cli/app/install-desktop.js +4 -0
- package/packages/cli/app/launch.js +134 -0
- package/packages/cli/app/restart.js +32 -0
- package/packages/cli/commands/logs.js +10 -0
- package/packages/cli/commands/open.js +49 -0
- package/packages/cli/commands/projects.js +18 -0
- package/packages/cli/commands/run.js +39 -0
- package/packages/cli/commands/search.js +19 -0
- package/packages/cli/commands/server.js +32 -0
- package/packages/cli/commands/status.js +42 -0
- package/packages/cli/common/output.js +13 -0
- package/packages/cli/modules/api/index.js +60 -0
- package/packages/cli/modules/arguments/index.js +188 -0
- package/packages/cli/modules/command-runtime/index.js +24 -0
- package/packages/cli/modules/projects/index.js +118 -0
- package/packages/cli/modules/server/index.js +226 -0
- package/packages/cli/modules/server-process/index.js +204 -0
- package/packages/core/modules/agent-features/index.js +8 -0
- package/packages/core/modules/agent-judge/index.js +73 -0
- package/packages/core/modules/agent-read/index.js +25 -0
- package/packages/core/modules/agent-role/index.js +187 -0
- package/packages/core/modules/agent-task/contract.js +34 -0
- package/packages/core/modules/agent-task/index.js +1 -0
- package/packages/core/modules/agent-widgets/bars/index.js +11 -0
- package/packages/core/modules/agent-widgets/button/index.js +19 -0
- package/packages/core/modules/agent-widgets/card/index.js +13 -0
- package/packages/core/modules/agent-widgets/checks/index.js +19 -0
- package/packages/core/modules/agent-widgets/chips/index.js +15 -0
- package/packages/core/modules/agent-widgets/columns/index.js +12 -0
- package/packages/core/modules/agent-widgets/donut/index.js +11 -0
- package/packages/core/modules/agent-widgets/field/index.js +39 -0
- package/packages/core/modules/agent-widgets/form/index.js +18 -0
- package/packages/core/modules/agent-widgets/git-info/index.js +29 -0
- package/packages/core/modules/agent-widgets/image/index.js +22 -0
- package/packages/core/modules/agent-widgets/inline-icon/index.js +45 -0
- package/packages/core/modules/agent-widgets/input/index.js +16 -0
- package/packages/core/modules/agent-widgets/intelligent-form/index.js +32 -0
- package/packages/core/modules/agent-widgets/line/index.js +12 -0
- package/packages/core/modules/agent-widgets/row/index.js +11 -0
- package/packages/core/modules/agent-widgets/safe-secret-show/index.js +21 -0
- package/packages/core/modules/agent-widgets/slider/index.js +18 -0
- package/packages/core/modules/agent-widgets/stat/index.js +16 -0
- package/packages/core/modules/agent-widgets/steps/index.js +14 -0
- package/packages/core/modules/agent-widgets/tab/index.js +12 -0
- package/packages/core/modules/agent-widgets/tabs/index.js +24 -0
- package/packages/core/modules/agents-integration/claude/index.js +1 -0
- package/packages/core/modules/agents-integration/codex/index.js +1 -0
- package/packages/core/modules/agents-integration/cursor/index.js +1 -0
- package/packages/core/modules/agents-integration/kimi/index.js +1 -0
- package/packages/core/modules/agents-integration/opencode/index.js +1 -0
- package/packages/core/modules/app-paths/index.js +14 -0
- package/packages/core/modules/app-paths/logs.js +194 -0
- package/packages/core/modules/app-paths/network-mode.js +24 -0
- package/packages/core/modules/app-paths/paths.js +40 -0
- package/packages/core/modules/app-paths/server-mode.js +18 -0
- package/packages/core/modules/appearance/index.js +35 -0
- package/packages/core/modules/browser/index.js +86 -0
- package/packages/core/modules/devcontainer/classify.js +101 -0
- package/packages/core/modules/devcontainer/contract.js +1 -0
- package/packages/core/modules/devcontainer/index.js +1 -0
- package/packages/core/modules/directories/contract.js +1 -0
- package/packages/core/modules/directories/index.js +1 -0
- package/packages/core/modules/docker/contract.js +1 -0
- package/packages/core/modules/docker/index.js +1 -0
- package/packages/core/modules/editor-themes/index.js +17 -0
- package/packages/core/modules/environment/index.js +1 -0
- package/packages/core/modules/file-icons/contract.js +177 -0
- package/packages/core/modules/file-icons/index.js +1 -0
- package/packages/core/modules/github/index.js +23 -0
- package/packages/core/modules/gitlab/index.js +164 -0
- package/packages/core/modules/hub/index.js +1 -0
- package/packages/core/modules/hub/protocol.js +19 -0
- package/packages/core/modules/ide/agent-command.js +48 -0
- package/packages/core/modules/ide/command-help.js +73 -0
- package/packages/core/modules/ide/commands.js +191 -0
- package/packages/core/modules/ide/index.js +6 -0
- package/packages/core/modules/ide/keybinding-editor.js +34 -0
- package/packages/core/modules/ide/keybindings.js +45 -0
- package/packages/core/modules/ide/palette.js +33 -0
- package/packages/core/modules/ide/safety.js +10 -0
- package/packages/core/modules/launcher/actions.js +5 -0
- package/packages/core/modules/launcher/index.js +5 -0
- package/packages/core/modules/launcher/launcher-model.js +236 -0
- package/packages/core/modules/launcher/launcher.js +76 -0
- package/packages/core/modules/launcher/query.js +42 -0
- package/packages/core/modules/network-mode/index.js +3 -0
- package/packages/core/modules/network-mode/network-mode.js +8 -0
- package/packages/core/modules/os/bash.js +11 -0
- package/packages/core/modules/os/contract.js +1 -0
- package/packages/core/modules/os/index.js +3 -0
- package/packages/core/modules/os/modules/darwin/catalog.js +108 -0
- package/packages/core/modules/os/modules/darwin/directories.js +40 -0
- package/packages/core/modules/os/modules/darwin/docker.js +15 -0
- package/packages/core/modules/os/modules/darwin/gtk.js +6 -0
- package/packages/core/modules/os/modules/darwin/helper.swift +172 -0
- package/packages/core/modules/os/modules/darwin/index.js +12 -0
- package/packages/core/modules/os/modules/darwin/install-desktop.js +135 -0
- package/packages/core/modules/os/modules/darwin/processes.js +97 -0
- package/packages/core/modules/os/modules/darwin/resident.js +235 -0
- package/packages/core/modules/os/modules/darwin/secrets.js +53 -0
- package/packages/core/modules/os/modules/darwin/shell.js +105 -0
- package/packages/core/modules/os/modules/darwin/shortcut.js +61 -0
- package/packages/core/modules/os/modules/darwin/tools.js +52 -0
- package/packages/core/modules/os/modules/darwin/windows.js +135 -0
- package/packages/core/modules/os/modules/linux/bus.js +48 -0
- package/packages/core/modules/os/modules/linux/catalog.js +47 -0
- package/packages/core/modules/os/modules/linux/directories.js +49 -0
- package/packages/core/modules/os/modules/linux/docker.js +48 -0
- package/packages/core/modules/os/modules/linux/index.js +53 -0
- package/packages/core/modules/os/modules/linux/install-desktop.js +66 -0
- package/packages/core/modules/os/modules/linux/processes.js +85 -0
- package/packages/core/modules/os/modules/linux/resident.js +139 -0
- package/packages/core/modules/os/modules/linux/secrets.js +118 -0
- package/packages/core/modules/os/modules/linux/shortcut.js +124 -0
- package/packages/core/modules/os/modules/linux/tools.js +14 -0
- package/packages/core/modules/os/modules/linux/tray.js +190 -0
- package/packages/core/modules/os/modules/linux/windows.js +187 -0
- package/packages/core/modules/os/modules/windows/agent-process.js +60 -0
- package/packages/core/modules/os/modules/windows/alert.js +20 -0
- package/packages/core/modules/os/modules/windows/catalog.js +91 -0
- package/packages/core/modules/os/modules/windows/color-scheme.js +26 -0
- package/packages/core/modules/os/modules/windows/directories.js +101 -0
- package/packages/core/modules/os/modules/windows/docker.js +17 -0
- package/packages/core/modules/os/modules/windows/git.js +42 -0
- package/packages/core/modules/os/modules/windows/hwnd.js +275 -0
- package/packages/core/modules/os/modules/windows/index.js +28 -0
- package/packages/core/modules/os/modules/windows/install-desktop.js +140 -0
- package/packages/core/modules/os/modules/windows/kill-tree.js +26 -0
- package/packages/core/modules/os/modules/windows/processes.js +300 -0
- package/packages/core/modules/os/modules/windows/ps.js +73 -0
- package/packages/core/modules/os/modules/windows/resident-pipe.js +206 -0
- package/packages/core/modules/os/modules/windows/resident.js +286 -0
- package/packages/core/modules/os/modules/windows/secrets.js +110 -0
- package/packages/core/modules/os/modules/windows/shell.js +288 -0
- package/packages/core/modules/os/modules/windows/shortcut.js +82 -0
- package/packages/core/modules/os/modules/windows/tools.js +273 -0
- package/packages/core/modules/os/modules/windows/windows.js +133 -0
- package/packages/core/modules/os/os.js +175 -0
- package/packages/core/modules/os/session-env.js +11 -0
- package/packages/core/modules/os-posix/agent-process.js +105 -0
- package/packages/core/modules/os-posix/contract.js +1 -0
- package/packages/core/modules/os-posix/git.js +26 -0
- package/packages/core/modules/os-posix/index.js +4 -0
- package/packages/core/modules/os-posix/tools.js +258 -0
- package/packages/core/modules/os-posix/xdg.js +8 -0
- package/packages/core/modules/project/contract.js +1 -0
- package/packages/core/modules/project/index.js +1 -0
- package/packages/core/modules/project/ref.js +126 -0
- package/packages/core/modules/server-mode/index.js +3 -0
- package/packages/core/modules/server-mode/server-mode.js +13 -0
- package/packages/core/modules/terminal/contract.js +1 -0
- package/packages/core/modules/terminal/index.js +1 -0
- package/packages/core/modules/usage-analytics/index.js +80 -0
- package/packages/core/modules/widget-catalog/guide.js +76 -0
- package/packages/core/modules/widget-catalog/index.js +219 -0
- package/packages/core/modules/workspace/changes.js +114 -0
- package/packages/core/modules/workspace/contract.js +1 -0
- package/packages/core/modules/workspace/file-size.js +12 -0
- package/packages/core/modules/workspace/files-exclude.js +119 -0
- package/packages/core/modules/workspace/git-decorations.js +4 -0
- package/packages/core/modules/workspace/git-graph.js +35 -0
- package/packages/core/modules/workspace/index.js +11 -0
- package/packages/core/modules/workspace/paths.js +16 -0
- package/packages/core/modules/workspace/pipeline-status.js +86 -0
- package/packages/core/modules/workspace/pull-requests.js +1 -0
- package/packages/core/modules/workspace/pull-status.js +56 -0
- package/packages/core/modules/workspace/scope.js +34 -0
- package/packages/core/modules/workspace/search.js +28 -0
- package/packages/core/modules/workspace/tree-page.js +25 -0
- package/packages/server/app/agents.js +30 -0
- package/packages/server/app/api.js +159 -0
- package/packages/server/app/claude-runner.js +17 -0
- package/packages/server/app/dev-plugin.js +76 -0
- package/packages/server/app/dev-runtime.js +119 -0
- package/packages/server/app/features.js +35 -0
- package/packages/server/app/plugin.js +140 -0
- package/packages/server/app/projector-runner.js +15 -0
- package/packages/server/app/runtime-contract.js +1 -0
- package/packages/server/app/standalone.js +42 -0
- package/packages/server/app/static.js +57 -0
- package/packages/server/app/widgets-mcp.js +36 -0
- package/packages/server/app/widgets.js +54 -0
- package/packages/server/middlewares/local-origin.js +4 -0
- package/packages/server/modules/access/access.js +118 -0
- package/packages/server/modules/access/connections.js +36 -0
- package/packages/server/modules/access/http.js +93 -0
- package/packages/server/modules/access/hub.js +19 -0
- package/packages/server/modules/access/index.js +6 -0
- package/packages/server/modules/access/lan-url.js +21 -0
- package/packages/server/modules/access/password.js +68 -0
- package/packages/server/modules/access/session.js +38 -0
- package/packages/server/modules/agent/agent-host.js +46 -0
- package/packages/server/modules/agent/agent-runs.js +162 -0
- package/packages/server/modules/agent/attachments.js +88 -0
- package/packages/server/modules/agent/backend.js +1 -0
- package/packages/server/modules/agent/chat-archive.js +67 -0
- package/packages/server/modules/agent/command-bridge.js +94 -0
- package/packages/server/modules/agent/controls.js +10 -0
- package/packages/server/modules/agent/event-streams.js +40 -0
- package/packages/server/modules/agent/history-store.js +320 -0
- package/packages/server/modules/agent/history.js +160 -0
- package/packages/server/modules/agent/hosted-process.js +279 -0
- package/packages/server/modules/agent/hosted-run.js +85 -0
- package/packages/server/modules/agent/hosted-runner.js +126 -0
- package/packages/server/modules/agent/index.js +35 -0
- package/packages/server/modules/agent/injection.js +14 -0
- package/packages/server/modules/agent/jobs-diff.js +114 -0
- package/packages/server/modules/agent/jobs-files.js +65 -0
- package/packages/server/modules/agent/jobs-followup.js +66 -0
- package/packages/server/modules/agent/jobs-live.js +180 -0
- package/packages/server/modules/agent/jobs-store.js +59 -0
- package/packages/server/modules/agent/jobs-worktree.js +161 -0
- package/packages/server/modules/agent/jobs.js +316 -0
- package/packages/server/modules/agent/judge-store.js +21 -0
- package/packages/server/modules/agent/lens-request.js +34 -0
- package/packages/server/modules/agent/queue-store.js +21 -0
- package/packages/server/modules/agent/recent-chats.js +63 -0
- package/packages/server/modules/agent/registry.js +108 -0
- package/packages/server/modules/agent/replay.js +84 -0
- package/packages/server/modules/agent/request.js +132 -0
- package/packages/server/modules/agent/role-store.js +21 -0
- package/packages/server/modules/agent/run-hub.js +105 -0
- package/packages/server/modules/agent/run-request.js +208 -0
- package/packages/server/modules/agent/secret-show.js +108 -0
- package/packages/server/modules/agent/side-request.js +142 -0
- package/packages/server/modules/agent/usage-history.js +62 -0
- package/packages/server/modules/agent/worktrees.js +136 -0
- package/packages/server/modules/agent-features/catalog.js +18 -0
- package/packages/server/modules/agent-features/index.js +2 -0
- package/packages/server/modules/agent-features/store.js +172 -0
- package/packages/server/modules/agent-mcp/index.js +106 -0
- package/packages/server/modules/agent-roles/index.js +3 -0
- package/packages/server/modules/agent-roles/project.js +231 -0
- package/packages/server/modules/agent-roles/runtime.js +68 -0
- package/packages/server/modules/agent-roles/store.js +190 -0
- package/packages/server/modules/agents/acp/acp-backend.js +320 -0
- package/packages/server/modules/agents/acp/acp-client.js +153 -0
- package/packages/server/modules/agents/acp/acp-controls.js +179 -0
- package/packages/server/modules/agents/acp/acp-dialect.js +82 -0
- package/packages/server/modules/agents/acp/acp-elicitation.js +135 -0
- package/packages/server/modules/agents/acp/acp-events.js +340 -0
- package/packages/server/modules/agents/acp/acp-process.js +78 -0
- package/packages/server/modules/agents/acp/acp-programs.js +11 -0
- package/packages/server/modules/agents/acp/acp-tools.js +208 -0
- package/packages/server/modules/agents/acp/index.js +4 -0
- package/packages/server/modules/agents/acp/mcp-config.js +100 -0
- package/packages/server/modules/agents/claude-code/claude-code-backend.js +342 -0
- package/packages/server/modules/agents/claude-code/claude-code-checkpoints.js +97 -0
- package/packages/server/modules/agents/claude-code/claude-code-env.js +46 -0
- package/packages/server/modules/agents/claude-code/claude-code-events.js +299 -0
- package/packages/server/modules/agents/claude-code/claude-code-input.js +97 -0
- package/packages/server/modules/agents/claude-code/claude-code-replay.js +71 -0
- package/packages/server/modules/agents/claude-code/claude-code-sessions.js +207 -0
- package/packages/server/modules/agents/claude-code/claude-code-times.js +42 -0
- package/packages/server/modules/agents/claude-code/index.js +2 -0
- package/packages/server/modules/agents/claude-code/questions.js +51 -0
- package/packages/server/modules/agents/codex/dialect.js +130 -0
- package/packages/server/modules/agents/codex/forms.js +24 -0
- package/packages/server/modules/agents/codex/index.js +17 -0
- package/packages/server/modules/agents/cursor/dialect.js +66 -0
- package/packages/server/modules/agents/cursor/images.js +12 -0
- package/packages/server/modules/agents/cursor/index.js +30 -0
- package/packages/server/modules/agents/cursor/plan.js +44 -0
- package/packages/server/modules/agents/cursor/questions.js +37 -0
- package/packages/server/modules/agents/cursor/selection.js +29 -0
- package/packages/server/modules/agents/cursor/task.js +32 -0
- package/packages/server/modules/agents/cursor/todos.js +69 -0
- package/packages/server/modules/agents/ide-mcp/config.js +40 -0
- package/packages/server/modules/agents/ide-mcp/index.js +1 -0
- package/packages/server/modules/agents/ide-mcp/server.js +154 -0
- package/packages/server/modules/agents/kimi/dialect.js +18 -0
- package/packages/server/modules/agents/kimi/index.js +11 -0
- package/packages/server/modules/agents/opencode/dialect.js +232 -0
- package/packages/server/modules/agents/opencode/index.js +21 -0
- package/packages/server/modules/agents/opencode/read.js +46 -0
- package/packages/server/modules/agents/opencode/sessions.js +69 -0
- package/packages/server/modules/agents/projector/agent-lens.js +110 -0
- package/packages/server/modules/agents/projector/agent-tools.js +290 -0
- package/packages/server/modules/agents/projector/answer-doctor.js +32 -0
- package/packages/server/modules/agents/projector/form-doctor.js +33 -0
- package/packages/server/modules/agents/projector/index.js +12 -0
- package/packages/server/modules/agents/projector/project-instructions.js +34 -0
- package/packages/server/modules/agents/projector/projector-backend.js +350 -0
- package/packages/server/modules/agents/projector/projector-budget.js +70 -0
- package/packages/server/modules/agents/projector/projector-compaction.js +128 -0
- package/packages/server/modules/agents/projector/projector-controls.js +70 -0
- package/packages/server/modules/agents/projector/projector-guard.js +196 -0
- package/packages/server/modules/agents/projector/projector-history.js +87 -0
- package/packages/server/modules/agents/projector/projector-hooks.js +201 -0
- package/packages/server/modules/agents/projector/projector-input.js +40 -0
- package/packages/server/modules/agents/projector/projector-mcp-config.js +1 -0
- package/packages/server/modules/agents/projector/projector-mcp.js +119 -0
- package/packages/server/modules/agents/projector/projector-memory.js +92 -0
- package/packages/server/modules/agents/projector/projector-retry.js +52 -0
- package/packages/server/modules/agents/projector/projector-review.js +40 -0
- package/packages/server/modules/agents/projector/projector-side.js +56 -0
- package/packages/server/modules/agents/projector/projector-skills.js +143 -0
- package/packages/server/modules/agents/projector/projector-task.js +235 -0
- package/packages/server/modules/agents/projector/projector-usage.js +19 -0
- package/packages/server/modules/agents/projector/projector-web-search.js +76 -0
- package/packages/server/modules/agents/projector/projector-web.js +172 -0
- package/packages/server/modules/agents/projector/prompts.js +46 -0
- package/packages/server/modules/agents/projector/secrets/secret-destination.js +226 -0
- package/packages/server/modules/agents/projector/secrets/secret-show.js +23 -0
- package/packages/server/modules/agents/projector/secrets/secret-tools.js +124 -0
- package/packages/server/modules/agents/projector/tool-spec.js +4 -0
- package/packages/server/modules/agents/projector/tool-specs.js +167 -0
- package/packages/server/modules/agents/projector/widgets.js +4 -0
- package/packages/server/modules/agents/widgets-mcp/config.js +34 -0
- package/packages/server/modules/agents/widgets-mcp/index.js +1 -0
- package/packages/server/modules/agents-integration/_/usage-cache.js +19 -0
- package/packages/server/modules/agents-integration/claude/client.js +33 -0
- package/packages/server/modules/agents-integration/claude/index.js +1 -0
- package/packages/server/modules/agents-integration/claude/usage.js +49 -0
- package/packages/server/modules/agents-integration/codex/cli.js +86 -0
- package/packages/server/modules/agents-integration/codex/index.js +1 -0
- package/packages/server/modules/agents-integration/codex/usage.js +45 -0
- package/packages/server/modules/agents-integration/cursor/client.js +40 -0
- package/packages/server/modules/agents-integration/cursor/credentials.js +34 -0
- package/packages/server/modules/agents-integration/cursor/index.js +1 -0
- package/packages/server/modules/agents-integration/cursor/usage.js +59 -0
- package/packages/server/modules/agents-integration/kimi/client.js +48 -0
- package/packages/server/modules/agents-integration/kimi/credential-config.js +167 -0
- package/packages/server/modules/agents-integration/kimi/credentials.js +261 -0
- package/packages/server/modules/agents-integration/kimi/index.js +1 -0
- package/packages/server/modules/agents-integration/kimi/usage.js +149 -0
- package/packages/server/modules/agents-integration/opencode/client.js +30 -0
- package/packages/server/modules/agents-integration/opencode/credentials.js +36 -0
- package/packages/server/modules/agents-integration/opencode/index.js +1 -0
- package/packages/server/modules/agents-integration/opencode/usage.js +47 -0
- package/packages/server/modules/appearance/index.js +38 -0
- package/packages/server/modules/browser/cookies.js +112 -0
- package/packages/server/modules/browser/guard.js +55 -0
- package/packages/server/modules/browser/index.js +2 -0
- package/packages/server/modules/browser/key.js +34 -0
- package/packages/server/modules/browser/proxy.js +255 -0
- package/packages/server/modules/browser/rewrite.js +82 -0
- package/packages/server/modules/devcontainer/discovery.js +85 -0
- package/packages/server/modules/devcontainer/exec.js +81 -0
- package/packages/server/modules/devcontainer/index.js +4 -0
- package/packages/server/modules/devcontainer/launch.js +51 -0
- package/packages/server/modules/devcontainer/state.js +68 -0
- package/packages/server/modules/devcontainer/trust.js +41 -0
- package/packages/server/modules/directories/directories.js +34 -0
- package/packages/server/modules/directories/index.js +1 -0
- package/packages/server/modules/docker/actions.js +121 -0
- package/packages/server/modules/docker/daemon.js +72 -0
- package/packages/server/modules/docker/index.js +4 -0
- package/packages/server/modules/docker/settings.js +127 -0
- package/packages/server/modules/docker/snapshot.js +105 -0
- package/packages/server/modules/environments/execution.js +125 -0
- package/packages/server/modules/environments/index.js +3 -0
- package/packages/server/modules/environments/reconcile.js +62 -0
- package/packages/server/modules/environments/settings.js +58 -0
- package/packages/server/modules/events/implementation.js +85 -0
- package/packages/server/modules/events/index.js +1 -0
- package/packages/server/modules/folder-picker/index.js +1 -0
- package/packages/server/modules/folder-picker/pick-folder.js +2 -0
- package/packages/server/modules/git-import/clone.js +47 -0
- package/packages/server/modules/git-import/container.js +57 -0
- package/packages/server/modules/git-import/import.js +82 -0
- package/packages/server/modules/git-import/index.js +4 -0
- package/packages/server/modules/git-import/jobs.js +68 -0
- package/packages/server/modules/github/api.js +260 -0
- package/packages/server/modules/github/browser.js +185 -0
- package/packages/server/modules/github/clone.js +55 -0
- package/packages/server/modules/github/container.js +15 -0
- package/packages/server/modules/github/discussions.js +141 -0
- package/packages/server/modules/github/emojis.js +14 -0
- package/packages/server/modules/github/history.js +205 -0
- package/packages/server/modules/github/index.js +11 -0
- package/packages/server/modules/github/issues.js +81 -0
- package/packages/server/modules/github/navigation.js +35 -0
- package/packages/server/modules/github/pipelines.js +266 -0
- package/packages/server/modules/github/pulls.js +111 -0
- package/packages/server/modules/github/releases.js +241 -0
- package/packages/server/modules/gitlab/api.js +257 -0
- package/packages/server/modules/gitlab/base.js +24 -0
- package/packages/server/modules/gitlab/blob-search.js +110 -0
- package/packages/server/modules/gitlab/browser.js +296 -0
- package/packages/server/modules/gitlab/clone.js +78 -0
- package/packages/server/modules/gitlab/compare.js +68 -0
- package/packages/server/modules/gitlab/connection.js +55 -0
- package/packages/server/modules/gitlab/container.js +15 -0
- package/packages/server/modules/gitlab/history.js +127 -0
- package/packages/server/modules/gitlab/icon.js +67 -0
- package/packages/server/modules/gitlab/index.js +14 -0
- package/packages/server/modules/gitlab/issues.js +61 -0
- package/packages/server/modules/gitlab/merge-requests.js +287 -0
- package/packages/server/modules/gitlab/navigation.js +187 -0
- package/packages/server/modules/gitlab/oauth.js +250 -0
- package/packages/server/modules/gitlab/pipelines.js +240 -0
- package/packages/server/modules/gitlab/releases.js +226 -0
- package/packages/server/modules/gitlab/search.js +75 -0
- package/packages/server/modules/gitlab/trackers.js +96 -0
- package/packages/server/modules/http/download.js +50 -0
- package/packages/server/modules/http/http.js +8 -0
- package/packages/server/modules/http/index.js +2 -0
- package/packages/server/modules/hub/connector.js +114 -0
- package/packages/server/modules/hub/hub.js +142 -0
- package/packages/server/modules/hub/index.js +1 -0
- package/packages/server/modules/ide/editor-settings.js +37 -0
- package/packages/server/modules/ide/index.js +3 -0
- package/packages/server/modules/ide/keybindings.js +37 -0
- package/packages/server/modules/ide/mcp-bridge.js +150 -0
- package/packages/server/modules/instance/index.js +2 -0
- package/packages/server/modules/instance/instance.js +50 -0
- package/packages/server/modules/integration-store/index.js +2 -0
- package/packages/server/modules/integration-store/list.js +12 -0
- package/packages/server/modules/integration-store/store.js +141 -0
- package/packages/server/modules/judge/approval.js +35 -0
- package/packages/server/modules/judge/index.js +3 -0
- package/packages/server/modules/judge/settings.js +35 -0
- package/packages/server/modules/judge/verdict.js +141 -0
- package/packages/server/modules/launcher/browse.js +29 -0
- package/packages/server/modules/launcher/folders.js +138 -0
- package/packages/server/modules/launcher/hosted-search.js +43 -0
- package/packages/server/modules/launcher/index.js +12 -0
- package/packages/server/modules/launcher/launcher.js +352 -0
- package/packages/server/modules/launcher/potential.js +70 -0
- package/packages/server/modules/launcher/project-entries.js +165 -0
- package/packages/server/modules/network/eu-context.js +29 -0
- package/packages/server/modules/network/index.js +1 -0
- package/packages/server/modules/openai-gateway/config.js +125 -0
- package/packages/server/modules/openai-gateway/gateway.js +178 -0
- package/packages/server/modules/openai-gateway/index.js +7 -0
- package/packages/server/modules/preferences/index.js +7 -0
- package/packages/server/modules/preferences/preferences.js +142 -0
- package/packages/server/modules/processes/index.js +6 -0
- package/packages/server/modules/processes/processes.js +174 -0
- package/packages/server/modules/project-presentation/implementation.js +130 -0
- package/packages/server/modules/project-presentation/index.js +1 -0
- package/packages/server/modules/project-widgets/index.js +210 -0
- package/packages/server/modules/projects/discovery.js +179 -0
- package/packages/server/modules/projects/favicon.js +180 -0
- package/packages/server/modules/projects/index.js +11 -0
- package/packages/server/modules/projects/inspect.js +148 -0
- package/packages/server/modules/projects/remote-icon.js +39 -0
- package/packages/server/modules/projects/store.js +41 -0
- package/packages/server/modules/projects/types.js +1 -0
- package/packages/server/modules/providers/atomic-file.js +29 -0
- package/packages/server/modules/providers/balance.js +125 -0
- package/packages/server/modules/providers/index.js +15 -0
- package/packages/server/modules/providers/kinds.js +24 -0
- package/packages/server/modules/providers/model-list.js +16 -0
- package/packages/server/modules/providers/models.js +124 -0
- package/packages/server/modules/providers/openai-client.js +40 -0
- package/packages/server/modules/providers/provider-seeds.js +39 -0
- package/packages/server/modules/providers/provider-store.js +317 -0
- package/packages/server/modules/providers/quiet-model.js +36 -0
- package/packages/server/modules/providers/secret-obfuscation.js +48 -0
- package/packages/server/modules/providers/thinking.js +105 -0
- package/packages/server/modules/providers/types.js +1 -0
- package/packages/server/modules/restart/index.js +1 -0
- package/packages/server/modules/restart/restart.js +56 -0
- package/packages/server/modules/secrets/index.js +1 -0
- package/packages/server/modules/secrets/vault.js +51 -0
- package/packages/server/modules/spend/index.js +2 -0
- package/packages/server/modules/spend/ledger.js +82 -0
- package/packages/server/modules/spend/store.js +92 -0
- package/packages/server/modules/terminal/drop-files.js +42 -0
- package/packages/server/modules/terminal/index.js +15 -0
- package/packages/server/modules/terminal/link-files.js +44 -0
- package/packages/server/modules/terminal/scenario-folder.js +20 -0
- package/packages/server/modules/terminal/session-state.js +85 -0
- package/packages/server/modules/terminal/socket.js +159 -0
- package/packages/server/modules/terminal/terminal-activity.js +56 -0
- package/packages/server/modules/terminal/terminal-file.js +32 -0
- package/packages/server/modules/terminal/terminal-mouse.js +29 -0
- package/packages/server/modules/terminal/terminal.js +308 -0
- package/packages/server/modules/terminal/terminate.js +68 -0
- package/packages/server/modules/terminal-control/control.js +75 -0
- package/packages/server/modules/terminal-control/handlers.js +10 -0
- package/packages/server/modules/terminal-control/index.js +3 -0
- package/packages/server/modules/terminal-control/shared-socket.js +319 -0
- package/packages/server/modules/terminal-control/socket.js +153 -0
- package/packages/server/modules/transport/implementation.js +24 -0
- package/packages/server/modules/transport/index.js +2 -0
- package/packages/server/modules/transport/router.js +16 -0
- package/packages/server/modules/transport/types.js +1 -0
- package/packages/server/modules/usage-analytics/index.js +4 -0
- package/packages/server/modules/usage-analytics/limits.js +144 -0
- package/packages/server/modules/usage-analytics/overview.js +117 -0
- package/packages/server/modules/usage-analytics/providers.js +120 -0
- package/packages/server/modules/usage-analytics/store.js +152 -0
- package/packages/server/modules/window/desktop.js +24 -0
- package/packages/server/modules/window/index.js +8 -0
- package/packages/server/modules/window/window.js +86 -0
- package/packages/server/modules/workspace/archive.py +109 -0
- package/packages/server/modules/workspace/external-files.js +22 -0
- package/packages/server/modules/workspace/files-exclude.js +73 -0
- package/packages/server/modules/workspace/files.js +332 -0
- package/packages/server/modules/workspace/find-paths.js +92 -0
- package/packages/server/modules/workspace/git-branches.js +159 -0
- package/packages/server/modules/workspace/git-compare.js +121 -0
- package/packages/server/modules/workspace/git-history.js +182 -0
- package/packages/server/modules/workspace/git-sync.js +245 -0
- package/packages/server/modules/workspace/git-tree.js +126 -0
- package/packages/server/modules/workspace/git.js +276 -0
- package/packages/server/modules/workspace/ignored.js +23 -0
- package/packages/server/modules/workspace/import.js +190 -0
- package/packages/server/modules/workspace/index.js +15 -0
- package/packages/server/modules/workspace/paths.js +38 -0
- package/packages/server/modules/workspace/reveal.js +14 -0
- package/packages/server/modules/workspace/search.js +136 -0
- package/packages/server/modules/workspace/site.js +62 -0
- package/packages/server/modules/workspace/watcher.js +176 -0
- package/packages/server/routes/api/agent-answer-repair.js +35 -0
- package/packages/server/routes/api/agent-chats.js +77 -0
- package/packages/server/routes/api/agent-features.js +36 -0
- package/packages/server/routes/api/agent-form-repair.js +35 -0
- package/packages/server/routes/api/agent-hooks.js +35 -0
- package/packages/server/routes/api/agent-jobs.js +322 -0
- package/packages/server/routes/api/agent-judge.js +33 -0
- package/packages/server/routes/api/agent-lens.js +27 -0
- package/packages/server/routes/api/agent-mcp.js +41 -0
- package/packages/server/routes/api/agent-memory.js +33 -0
- package/packages/server/routes/api/agent-project-roles.js +112 -0
- package/packages/server/routes/api/agent-project-widgets.js +67 -0
- package/packages/server/routes/api/agent-roles.js +106 -0
- package/packages/server/routes/api/agent-secret-show.js +87 -0
- package/packages/server/routes/api/agent-side.js +70 -0
- package/packages/server/routes/api/agent-skills.js +31 -0
- package/packages/server/routes/api/agent-web.js +27 -0
- package/packages/server/routes/api/agent-worktrees.js +49 -0
- package/packages/server/routes/api/agent.js +269 -0
- package/packages/server/routes/api/analytics.js +21 -0
- package/packages/server/routes/api/app/hide.js +12 -0
- package/packages/server/routes/api/app/mode.js +49 -0
- package/packages/server/routes/api/app/network.js +54 -0
- package/packages/server/routes/api/app/open.js +33 -0
- package/packages/server/routes/api/app/quit.js +14 -0
- package/packages/server/routes/api/app/restart.js +18 -0
- package/packages/server/routes/api/appearance.js +70 -0
- package/packages/server/routes/api/browser.js +27 -0
- package/packages/server/routes/api/claude.js +15 -0
- package/packages/server/routes/api/codex.js +15 -0
- package/packages/server/routes/api/cursor.js +15 -0
- package/packages/server/routes/api/directories.js +16 -0
- package/packages/server/routes/api/docker.js +74 -0
- package/packages/server/routes/api/events.js +25 -0
- package/packages/server/routes/api/health.js +20 -0
- package/packages/server/routes/api/hub.js +26 -0
- package/packages/server/routes/api/ide/commands.js +72 -0
- package/packages/server/routes/api/ide/editor.js +37 -0
- package/packages/server/routes/api/ide/files-exclude.js +37 -0
- package/packages/server/routes/api/ide/keybindings.js +37 -0
- package/packages/server/routes/api/inspect.js +21 -0
- package/packages/server/routes/api/integrations/[...action].js +201 -0
- package/packages/server/routes/api/integrations/github-browse.js +190 -0
- package/packages/server/routes/api/kimi.js +15 -0
- package/packages/server/routes/api/launcher/icon.js +16 -0
- package/packages/server/routes/api/launcher/launch.js +27 -0
- package/packages/server/routes/api/launcher/search.js +20 -0
- package/packages/server/routes/api/launcher/settings.js +68 -0
- package/packages/server/routes/api/openai.js +94 -0
- package/packages/server/routes/api/opencode.js +15 -0
- package/packages/server/routes/api/pick-folder.js +12 -0
- package/packages/server/routes/api/preview-icon.js +21 -0
- package/packages/server/routes/api/projects/[id]/index.js +240 -0
- package/packages/server/routes/api/projects/[id]/site.js +59 -0
- package/packages/server/routes/api/projects/[id]/terminals.js +38 -0
- package/packages/server/routes/api/projects/[id]/workspace-read.js +126 -0
- package/packages/server/routes/api/projects/[id]/workspace.js +147 -0
- package/packages/server/routes/api/projects/index.js +62 -0
- package/packages/server/routes/api/providers/active.js +12 -0
- package/packages/server/routes/api/providers/balance.js +15 -0
- package/packages/server/routes/api/providers/models.js +19 -0
- package/packages/server/routes/api/providers.js +23 -0
- package/packages/server/routes/api/status.js +11 -0
- package/resources/icons/128.png +0 -0
- package/resources/icons/16.png +0 -0
- package/resources/icons/256.png +0 -0
- package/resources/icons/32.png +0 -0
- package/resources/icons/48.png +0 -0
- package/resources/icons/512.png +0 -0
- package/resources/icons/64.png +0 -0
- package/resources/icons/projector.svg +5 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import{n as e,r as t,t as n}from"./rolldown-runtime-XKyaHtl9.js";import{V as r,W as i,q as a}from"./shared.esm-bundler-DoSbGLUP.js";import{A as o,Jt as s,O as c,Sn as l,St as u,Ut as d,_ as f,ht as p,kn as m,lt as h,mn as g,pn as _,t as v,v as y,x as b,y as x,yn as S}from"./_plugin-vue_export-helper-D62Ebo7D.js";import{t as C}from"./UiButton-DvucBdmd.js";import{t as w}from"./ImageViewport-BT_ftU4z.js";var T={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function E(e,t){return p(),b(`svg`,T,[...t[0]||=[y(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M18 6L6 18M6 6l12 12`},null,-1)]])}var D=_({name:`lucide-x`,render:E}),O=[`aria-label`,`aria-labelledby`],k=v(o({__name:`UiDialog`,props:{label:{},labelledby:{},align:{},width:{},fullscreen:{type:Boolean},flush:{type:Boolean}},emits:[`cancel`,`close`],setup(e,{expose:t,emit:n}){let a=n,o=S();return t({open:()=>o.value?.showModal(),close:()=>o.value?.close(),get element(){return o.value}}),(t,n)=>(p(),b(`dialog`,{ref_key:`dialog`,ref:o,class:r([`ui-dialog`,[e.align??`center`,{fullscreen:e.fullscreen,flush:e.flush}]]),style:i(e.width?{"--dialog-width":e.width}:void 0),"aria-label":e.label,"aria-labelledby":e.labelledby,onCancel:n[0]||=e=>a(`cancel`,e),onClose:n[1]||=e=>a(`close`)},[u(t.$slots,`default`,{},void 0,!0)],46,O))}}),[[`__scopeId`,`data-v-5f6bedc7`]]),A=l([]),j=new Map,M=0;function N(e){if(e instanceof Element&&e.isConnected){let t=e.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top,height:t.height}}if(e&&!(e instanceof Element))return{...e,height:0};let t=document.activeElement;return t instanceof HTMLElement&&t!==document.body?N(t):{x:window.innerWidth/2,y:window.innerHeight-48,height:0}}function P(e){clearTimeout(j.get(e)),j.delete(e),A.value=A.value.filter(t=>t.id!==e)}function F(e,t,n=`success`,r=n===`error`?5e3:1600){let i=N(e);A.value.filter(e=>Math.abs(e.x-i.x)<4&&Math.abs(e.y-i.y)<4).forEach(e=>P(e.id));let a=++M;return A.value=[...A.value.slice(-3),{id:a,kind:n,text:t,...i}],j.set(a,setTimeout(()=>P(a),r)),a}async function I(e,t,n=`Скопировано`,r=`Не удалось скопировать`){try{return await navigator.clipboard.writeText(t),F(e,n),!0}catch{return F(e,r,`error`),!1}}var L=l([]),R=new Map;function z(e){clearTimeout(R.get(e)),R.delete(e),L.value=L.value.filter(t=>t.id!==e)}function B(e,t,n=15e3){L.value.filter(t=>t.text===e).forEach(e=>z(e.id));let r=++M;return L.value=[...L.value.slice(-3),{id:r,text:e,action:t}],R.set(r,setTimeout(()=>z(r),n)),r}function V(e,t){let n=0;d(e,e=>{n&&z(n),n=e?B(e,t):0},{immediate:!0}),g(()=>n&&z(n))}function H(e,t){if(!(!e||e.startsWith(`#`)||/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(e)))try{let n=new URL(e,`https://projector.invalid/${t}`),r=decodeURIComponent(n.pathname.slice(1));return r.split(`/`).includes(`..`)||r.includes(`\0`)||r.includes(`\\`)?void 0:r}catch{return}}var U=n(((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw Error(`map is read-only`)}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw Error(`set is read-only`)}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let r=e[t],i=typeof r;i!==`object`&&i!==`function`||Object.isFrozen(r)||n(r)}),e}var r=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function i(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function a(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}var o=`</span>`,s=e=>!!e.scope,c=(e,{prefix:t})=>{if(e.startsWith(`language:`))return e.replace(`language:`,`language-`);if(e.includes(`.`)){let n=e.split(`.`);return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${`_`.repeat(t+1)}`)].join(` `)}return`${t}${e}`},l=class{constructor(e,t){this.buffer=``,this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!s(e))return;let t=c(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){s(e)&&(this.buffer+=o)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},u=(e={})=>{let t={children:[]};return Object.assign(t,e),t},d=class e{constructor(){this.rootNode=u(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=u({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t==`string`?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){typeof t!=`string`&&t.children&&(t.children.every(e=>typeof e==`string`)?t.children=[t.children.join(``)]:t.children.forEach(t=>{e._collapse(t)}))}},f=class extends d{constructor(e){super(),this.options=e}addText(e){e!==``&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function p(e){return e?typeof e==`string`?e:e.source:null}function m(e){return _(`(?=`,e,`)`)}function h(e){return _(`(?:`,e,`)*`)}function g(e){return _(`(?:`,e,`)?`)}function _(...e){return e.map(e=>p(e)).join(``)}function v(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function y(...e){return`(`+(v(e).capture?``:`?:`)+e.map(e=>p(e)).join(`|`)+`)`}function b(e){return RegExp(e.toString()+`|`).exec(``).length-1}function x(e,t){let n=e&&e.exec(t);return n&&n.index===0}var S=new RegExp(y(/\[(?:[^\\\]]|\\.)*\]/,/\(\?<(?![=!])[^>]+>/,/\(\?'[^']+'/,/\(\??/,/\\([1-9][0-9]*)/,/\\./));function C(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;let t=n,r=p(e),i=``;for(;r.length>0;){let e=S.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),e[0][0]===`\\`&&e[1]?i+=`\\`+String(Number(e[1])+t):(i+=e[0],(e[0]===`(`||/^\(\?[<']/.test(e[0]))&&n++)}return i}).map(e=>`(${e})`).join(t)}var w=/\b\B/,T=`[a-zA-Z]\\w*`,E=`[a-zA-Z_]\\w*`,D=`\\b\\d+(\\.\\d+)?`,O=`(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)`,k=`\\b(0b[01]+)`,A=`!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~`,j=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=_(t,/.*\b/,e.binary,/\b.*/)),a({scope:`meta`,begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{e.index!==0&&t.ignoreMatch()}},e)},M={begin:`\\\\[\\s\\S]`,relevance:0},N={scope:`string`,begin:`'`,end:`'`,illegal:`\\n`,contains:[M]},P={scope:`string`,begin:`"`,end:`"`,illegal:`\\n`,contains:[M]},F={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},I=function(e,t,n={}){let r=a({scope:`comment`,begin:e,end:t,contains:[]},n);r.contains.push({scope:`doctag`,begin:`[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)`,end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=y(`I`,`a`,`is`,`so`,`us`,`to`,`at`,`if`,`in`,`it`,`on`,/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:_(/[ ]+/,`(`,i,/[.]?[:]?([.][ ]|[ ])/,`){3}`)}),r},L=I(`//`,`$`),R=I(`/\\*`,`\\*/`),z=I(`#`,`$`),B=Object.freeze({__proto__:null,APOS_STRING_MODE:N,BACKSLASH_ESCAPE:M,BINARY_NUMBER_MODE:{scope:`number`,begin:k,relevance:0},BINARY_NUMBER_RE:k,COMMENT:I,C_BLOCK_COMMENT_MODE:R,C_LINE_COMMENT_MODE:L,C_NUMBER_MODE:{scope:`number`,begin:O,relevance:0},C_NUMBER_RE:O,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:z,IDENT_RE:T,MATCH_NOTHING_RE:w,METHOD_GUARD:{begin:`\\.\\s*[a-zA-Z_]\\w*`,relevance:0},NUMBER_MODE:{scope:`number`,begin:D,relevance:0},NUMBER_RE:D,PHRASAL_WORDS_MODE:F,QUOTE_STRING_MODE:P,REGEXP_MODE:{scope:`regexp`,begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[M,{begin:/\[/,end:/\]/,relevance:0,contains:[M]}]},RE_STARTERS_RE:A,SHEBANG:j,TITLE_MODE:{scope:`title`,begin:T,relevance:0},UNDERSCORE_IDENT_RE:E,UNDERSCORE_TITLE_MODE:{scope:`title`,begin:E,relevance:0}});function V(e,t){e.input[e.index-1]===`.`&&t.ignoreMatch()}function H(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function U(e,t){t&&e.beginKeywords&&(e.begin=`\\b(`+e.beginKeywords.split(` `).join(`|`)+`)(?!\\.)(?=\\b|\\s)`,e.__beforeBegin=V,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function ee(e,t){Array.isArray(e.illegal)&&(e.illegal=y(...e.illegal))}function te(e,t){if(e.match){if(e.begin||e.end)throw Error(`begin & end are not supported with match`);e.begin=e.match,delete e.match}}function W(e,t){e.relevance===void 0&&(e.relevance=1)}var ne=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error(`beforeMatch cannot be used with starts`);let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=_(n.beforeMatch,m(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},G=[`of`,`and`,`for`,`in`,`not`,`or`,`if`,`then`,`parent`,`list`,`value`],re=`keyword`;function K(e,t,n=re){let r=Object.create(null);return typeof e==`string`?i(n,e.split(` `)):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(n){Object.assign(r,K(e[n],t,n))}),r;function i(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){let n=t.split(`|`);r[n[0]]=[e,ie(n[0],n[1])]})}}function ie(e,t){return t?Number(t):+!q(e)}function q(e){return G.includes(e.toLowerCase())}var ae={},oe=e=>{console.error(e)},se=(e,...t)=>{console.log(`WARN: ${e}`,...t)},ce=(e,t)=>{ae[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),ae[`${e}/${t}`]=!0)},le=Error();function ue(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let e=1;e<=t.length;e++)o[e+r]=i[e],a[e+r]=!0,r+=b(t[e-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function de(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw oe(`skip, excludeBegin, returnBegin not compatible with beginScope: {}`),le;if(typeof e.beginScope!=`object`||e.beginScope===null)throw oe(`beginScope must be object`),le;ue(e,e.begin,{key:`beginScope`}),e.begin=C(e.begin,{joinWith:``})}}function fe(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw oe(`skip, excludeEnd, returnEnd not compatible with endScope: {}`),le;if(typeof e.endScope!=`object`||e.endScope===null)throw oe(`endScope must be object`),le;ue(e,e.end,{key:`endScope`}),e.end=C(e.end,{joinWith:``})}}function pe(e){e.scope&&typeof e.scope==`object`&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function me(e){pe(e),typeof e.beginScope==`string`&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope==`string`&&(e.endScope={_wrap:e.endScope}),de(e),fe(e)}function he(e){function t(t,n){return new RegExp(p(t),`m`+(e.case_insensitive?`i`:``)+(e.unicodeRegex?`u`:``)+(n?`g`:``))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=b(e)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let e=this.regexes.map(e=>e[1]);this.matcherRe=t(C(e,{joinWith:`|`}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&e!==void 0),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),t.type===`begin`&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()&&!(n&&n.index===this.lastIndex)){let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function i(e){let t=new r;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:`begin`})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:`end`}),e.illegal&&t.addRule(e.illegal,{type:`illegal`}),t}function o(n,r){let a=n;if(n.isCompiled)return a;[H,te,me,ne].forEach(e=>e(n,r)),e.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[U,ee,W].forEach(e=>e(n,r)),n.isCompiled=!0;let s=null;return typeof n.keywords==`object`&&n.keywords.$pattern&&(n.keywords=Object.assign({},n.keywords),s=n.keywords.$pattern,delete n.keywords.$pattern),s||=/\w+/,n.keywords&&=K(n.keywords,e.case_insensitive),a.keywordPatternRe=t(s,!0),r&&(n.begin||=/\B|\b/,a.beginRe=t(a.begin),!n.end&&!n.endsWithParent&&(n.end=/\B|\b/),n.end&&(a.endRe=t(a.end)),a.terminatorEnd=p(a.end)||``,n.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(n.end?`|`:``)+r.terminatorEnd)),n.illegal&&(a.illegalRe=t(n.illegal)),n.contains||=[],n.contains=[].concat(...n.contains.map(function(e){return _e(e===`self`?n:e)})),n.contains.forEach(function(e){o(e,a)}),n.starts&&o(n.starts,r),a.matcher=i(a),a}if(e.compilerExtensions||=[],e.contains&&e.contains.includes(`self`))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),o(e)}function ge(e){return e?e.endsWithParent||ge(e.starts):!1}function _e(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return a(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:ge(e)?a(e,{starts:e.starts?a(e.starts):null}):Object.isFrozen(e)?a(e):e}var ve=`11.12.0`,ye=class extends Error{constructor(e,t){super(e),this.name=`HTMLInjectionError`,this.html=t}},be=i,xe=a,Se=Symbol(`nomatch`),Ce=7,we=function(e){let t=Object.create(null),i=Object.create(null),a=[],o=!0,s=`Could not find the language '{}', did you forget to load/include a language module?`,c={disableAutodetect:!0,name:`Plain text`,contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:`hljs-`,cssSelector:`pre code`,languages:null,__emitter:f};function u(e){return l.noHighlightRe.test(e)}function d(e){let t=e.className+` `;t+=e.parentNode?e.parentNode.className:``;let n=l.languageDetectRe.exec(t);if(n){let t=N(n[1]);return t||(se(s.replace(`{}`,n[1])),se(`Falling back to no-highlight mode for this block.`,e)),t?n[1]:`no-highlight`}return t.split(/\s+/).find(e=>u(e)||N(e))}function p(e,t,n){let r=``,i=``;typeof t==`object`?(r=e,n=t.ignoreIllegals,i=t.language):(ce(`10.7.0`,`highlight(lang, code, ...args) has been deprecated.`),ce(`10.7.0`,`Please use highlight(code, options) instead.
|
|
2
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(n=!0);let a={code:r,language:i};z(`before:highlight`,a);let o=a.result?a.result:v(a.language,a.code,n);return o.code=a.code,z(`after:highlight`,o),o}function v(e,n,i,a){let c=Object.create(null);function u(e,t){return e.keywords[t]}function d(){if(!A.keywords){M.addText(P);return}let e=0;A.keywordPatternRe.lastIndex=0;let t=A.keywordPatternRe.exec(P),n=``;for(;t;){n+=P.substring(e,t.index);let r=D.case_insensitive?t[0].toLowerCase():t[0],i=u(A,r);if(i){let[e,a]=i;if(M.addText(n),n=``,c[r]=(c[r]||0)+1,c[r]<=Ce&&(F+=a),e.startsWith(`_`))n+=t[0];else{let n=D.classNameAliases[e]||e;m(t[0],n)}}else n+=t[0];e=A.keywordPatternRe.lastIndex,t=A.keywordPatternRe.exec(P)}n+=P.substring(e),M.addText(n)}function f(){if(P===``)return;let e=null;if(typeof A.subLanguage==`string`){if(!t[A.subLanguage]){M.addText(P);return}e=v(A.subLanguage,P,!0,j[A.subLanguage]),j[A.subLanguage]=e._top}else e=S(P,A.subLanguage.length?A.subLanguage:null);A.relevance>0&&(F+=e.relevance),M.__addSublanguage(e._emitter,e.language)}function p(){A.subLanguage==null?d():f(),P=``}function m(e,t){e!==``&&(M.startScope(t),M.addText(e),M.endScope())}function h(e,t){let n=1,r=t.length-1;for(;n<=r;){if(!e._emit[n]){n++;continue}let r=D.classNameAliases[e[n]]||e[n],i=t[n];r?m(i,r):(P=i,d(),P=``),n++}}function g(e,t){return e.scope&&typeof e.scope==`string`&&M.openNode(D.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(m(P,D.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),P=``):e.beginScope._multi&&(h(e.beginScope,t),P=``)),A=Object.create(e,{parent:{value:A}}),A}function _(e,t,n){let i=x(e.endRe,n);if(i){if(e[`on:end`]){let n=new r(e);e[`on:end`](t,n),n.isMatchIgnored&&(i=!1)}if(i){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return _(e.parent,t,n)}function y(e){return A.matcher.regexIndex===0?(P+=e[0],1):(R=!0,0)}function b(e){let t=e[0],n=e.rule,i=new r(n),a=[n.__beforeBegin,n[`on:begin`]];for(let n of a)if(n&&(n(e,i),i.isMatchIgnored))return y(t);return n.skip?P+=t:(n.excludeBegin&&(P+=t),p(),!n.returnBegin&&!n.excludeBegin&&(P=t)),g(n,e),n.returnBegin?0:t.length}function C(e){let t=e[0],r=n.substring(e.index),i=_(A,e,r);if(!i)return Se;let a=A;A.endScope&&A.endScope._wrap?(p(),m(t,A.endScope._wrap)):A.endScope&&A.endScope._multi?(p(),h(A.endScope,e)):a.skip?P+=t:(a.returnEnd||a.excludeEnd||(P+=t),p(),a.excludeEnd&&(P=t));do A.scope&&M.closeNode(),!A.skip&&!A.subLanguage&&(F+=A.relevance),A=A.parent;while(A!==i.parent);return i.starts&&g(i.starts,e),a.returnEnd?0:t.length}function w(){let e=[];for(let t=A;t!==D;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>M.openNode(e))}let T={};function E(t,r){let a=r&&r[0];if(P+=t,a==null)return p(),0;if(T.type===`begin`&&r.type===`end`&&T.index===r.index&&a===``){if(P+=n.slice(r.index,r.index+1),!o){let t=Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=T.rule,t}return 1}if(T=r,r.type===`begin`)return b(r);if(r.type===`illegal`&&!i){let e=Error(`Illegal lexeme "`+a+`" for mode "`+(A.scope||`<unnamed>`)+`"`);throw e.mode=A,e}if(r.type===`end`){let e=C(r);if(e!==Se)return e}if(r.type===`illegal`&&a===``)return r.index===n.length||(P+=`
|
|
3
|
+
`),1;if(L>1e5&&L>r.index*3)throw Error(`potential infinite loop, way more iterations than matches`);return P+=a,a.length}let D=N(e);if(!D)throw oe(s.replace(`{}`,e)),Error(`Unknown language: "`+e+`"`);let O=he(D),k=``,A=a||O,j={},M=new l.__emitter(l);w();let P=``,F=0,I=0,L=0,R=!1;try{if(D.__emitTokens)D.__emitTokens(n,M);else{for(A.matcher.considerAll();;){L++,R?R=!1:A.matcher.considerAll(),A.matcher.lastIndex=I;let e=A.matcher.exec(n);if(!e)break;let t=E(n.substring(I,e.index),e);I=e.index+t}E(n.substring(I))}return M.finalize(),k=M.toHTML(),{language:e,value:k,relevance:F,illegal:!1,_emitter:M,_top:A}}catch(t){if(t.message&&t.message.includes(`Illegal`))return{language:e,value:be(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:I,context:n.slice(I-100,I+100),mode:t.mode,resultSoFar:k},_emitter:M};if(o)return{language:e,value:be(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:A};throw t}}function b(e){let t={value:be(e),illegal:!1,relevance:0,_top:c,_emitter:new l.__emitter(l)};return t._emitter.addText(e),t}function S(e,n){n=n||l.languages||Object.keys(t);let r=b(e),i=n.filter(N).filter(F).map(t=>v(t,e,!1));i.unshift(r);let[a,o]=i.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(N(e.language).supersetOf===t.language)return 1;if(N(t.language).supersetOf===e.language)return-1}return 0}),s=a;return s.secondBest=o,s}function C(e,t,n){let r=t&&i[t]||n;e.classList.add(`hljs`),e.classList.add(`language-${r}`)}function w(e){let t=null,n=d(e);if(u(n))return;if(z(`before:highlightElement`,{el:e,language:n}),e.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);return}if(e.children.length>0&&(l.ignoreUnescapedHTML||(console.warn(`One of your code blocks includes unescaped HTML. This is a potentially serious security risk.`),console.warn(`https://github.com/highlightjs/highlight.js/wiki/security`),console.warn(`The element with unescaped HTML:`),console.warn(e)),l.throwUnescapedHTML))throw new ye(`One of your code blocks includes unescaped HTML.`,e.innerHTML);t=e;let r=t.textContent,i=n?p(r,{language:n,ignoreIllegals:!0}):S(r);e.innerHTML=i.value,e.dataset.highlighted=`yes`,C(e,n,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),z(`after:highlightElement`,{el:e,result:i,text:r})}function T(e){l=xe(l,e)}let E=()=>{k(),ce(`10.6.0`,`initHighlighting() deprecated. Use highlightAll() now.`)};function D(){k(),ce(`10.6.0`,`initHighlightingOnLoad() deprecated. Use highlightAll() now.`)}let O=!1;function k(){function e(){k()}document.readyState===`loading`?(O||window.addEventListener(`DOMContentLoaded`,e,!1),O=!0):document.querySelectorAll(l.cssSelector).forEach(w)}function A(n,r){let i=null;try{i=r(e)}catch(e){if(oe(`Language definition for '{}' could not be registered.`.replace(`{}`,n)),o)oe(e);else throw e;i=c}i.name||(i.name=n),t[n]=i,i.rawDefinition=r.bind(null,e),i.aliases&&P(i.aliases,{languageName:n})}function j(e){delete t[e];for(let t of Object.keys(i))i[t]===e&&delete i[t]}function M(){return Object.keys(t)}function N(e){return e=(e||``).toLowerCase(),t[e]||t[i[e]]}function P(e,{languageName:t}){typeof e==`string`&&(e=[e]),e.forEach(e=>{i[e.toLowerCase()]=t})}function F(e){let t=N(e);return t&&!t.disableAutodetect}function I(e){e[`before:highlightBlock`]&&!e[`before:highlightElement`]&&(e[`before:highlightElement`]=t=>{e[`before:highlightBlock`](Object.assign({block:t.el},t))}),e[`after:highlightBlock`]&&!e[`after:highlightElement`]&&(e[`after:highlightElement`]=t=>{e[`after:highlightBlock`](Object.assign({block:t.el},t))})}function L(e){I(e),a.push(e)}function R(e){let t=a.indexOf(e);t!==-1&&a.splice(t,1)}function z(e,t){let n=e;a.forEach(function(e){e[n]&&e[n](t)})}function V(e){return ce(`10.7.0`,`highlightBlock will be removed entirely in v12.0`),ce(`10.7.0`,`Please use highlightElement now.`),w(e)}Object.assign(e,{highlight:p,highlightAuto:S,highlightAll:k,highlightElement:w,highlightBlock:V,configure:T,initHighlighting:E,initHighlightingOnLoad:D,registerLanguage:A,unregisterLanguage:j,listLanguages:M,getLanguage:N,registerAliases:P,autoDetection:F,inherit:xe,addPlugin:L,removePlugin:R}),e.debugMode=function(){o=!1},e.safeMode=function(){o=!0},e.versionString=ve,e.regex={concat:_,lookahead:m,either:y,optional:g,anyNumberOfTimes:h};for(let e in B)typeof B[e]==`object`&&n(B[e]);return Object.assign(e,B),e},Te=we({});Te.newInstance=()=>we({}),t.exports=Te,Te.HighlightJS=Te,Te.default=Te})),ee=n(((e,t)=>{function n(e){let t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:`symbol`,begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},a={begin:/\s/,contains:[{className:`keyword`,begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(a,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{className:`string`}),c=e.inherit(e.QUOTE_STRING_MODE,{className:`string`}),l={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:`attr`,begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:`string`,endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:`HTML, XML`,aliases:[`html`,`xhtml`,`rss`,`atom`,`xjb`,`xsd`,`xsl`,`plist`,`wsf`,`svg`],case_insensitive:!0,unicodeRegex:!0,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,relevance:10,contains:[a,c,s,o,{begin:/\[/,end:/\]/,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,contains:[a,o,c,s]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:`meta`,end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:`tag`,begin:/<style(?=\s|>)/,end:/>/,keywords:{name:`style`},contains:[l],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:`css`}},{className:`tag`,begin:/<script(?=\s|>)/,end:/>/,keywords:{name:`script`},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:`javascript`}},{className:`tag`,begin:/<>|<\/>/},{className:`tag`,begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:`name`,begin:n,relevance:0,starts:l}]},{className:`tag`,begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:`name`,begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}t.exports=n})),te=n(((e,t)=>{function n(e){let t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:[`self`,{begin:/:-/,contains:[n]}]};Object.assign(n,{className:`variable`,variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,`(?![\\w\\d])(?![$])`)},r]});let i={className:`subst`,begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},a=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:`comment`}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:`string`})]}},s={className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(s);let c={match:/\\"/},l={className:`string`,begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:`number`},e.NUMBER_MODE,n]},f=e.SHEBANG({binary:`(fish|bash|zsh|sh|csh|ksh|tcsh|dash|scsh)`,relevance:10}),p={className:`function`,begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=[`if`,`then`,`else`,`elif`,`fi`,`time`,`for`,`while`,`until`,`in`,`do`,`done`,`case`,`esac`,`coproc`,`function`,`select`],h=[`true`,`false`],g={match:/(\/[a-z._-]+)+/},_=[`break`,`cd`,`continue`,`eval`,`exec`,`exit`,`export`,`getopts`,`hash`,`pwd`,`readonly`,`return`,`shift`,`test`,`times`,`trap`,`umask`,`unset`],v=[`alias`,`bind`,`builtin`,`caller`,`command`,`declare`,`echo`,`enable`,`help`,`let`,`local`,`logout`,`mapfile`,`printf`,`read`,`readarray`,`source`,`sudo`,`type`,`typeset`,`ulimit`,`unalias`],y=`autoload.bg.bindkey.bye.cap.chdir.clone.comparguments.compcall.compctl.compdescribe.compfiles.compgroups.compquote.comptags.comptry.compvalues.dirs.disable.disown.echotc.echoti.emulate.fc.fg.float.functions.getcap.getln.history.integer.jobs.kill.limit.log.noglob.popd.print.pushd.pushln.rehash.sched.setcap.setopt.stat.suspend.ttyctl.unfunction.unhash.unlimit.unsetopt.vared.wait.whence.where.which.zcompile.zformat.zftp.zle.zmodload.zparseopts.zprof.zpty.zregexparse.zsocket.zstyle.ztcp`.split(`.`),b=`chcon.chgrp.chown.chmod.cp.dd.df.dir.dircolors.ln.ls.mkdir.mkfifo.mknod.mktemp.mv.realpath.rm.rmdir.shred.sync.touch.truncate.vdir.b2sum.base32.base64.cat.cksum.comm.csplit.cut.expand.fmt.fold.head.join.md5sum.nl.numfmt.od.paste.ptx.pr.sha1sum.sha224sum.sha256sum.sha384sum.sha512sum.shuf.sort.split.sum.tac.tail.tr.tsort.unexpand.uniq.wc.arch.basename.chroot.date.dirname.du.echo.env.expr.factor.groups.hostid.id.link.logname.nice.nohup.nproc.pathchk.pinky.printenv.printf.pwd.readlink.runcon.seq.sleep.stat.stdbuf.stty.tee.test.timeout.tty.uname.unlink.uptime.users.who.whoami.yes`.split(`.`);return{name:`Bash`,aliases:[`sh`,`zsh`],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:m,literal:h,built_in:[..._,...v,`set`,`shopt`,...y,...b]},contains:[f,e.SHEBANG(),p,d,a,o,g,s,c,l,u,n]}}t.exports=n})),W=n(((e,t)=>{function n(e){let t=e.regex,n=e.COMMENT(`//`,`$`,{contains:[{begin:/\\\n/}]}),r=`[a-zA-Z_]\\w*::`,i=`(decltype\\(auto\\)|`+t.optional(r)+`[a-zA-Z_]\\w*`+t.optional(`<[^<>]+>`)+`)`,a={className:`type`,variants:[{begin:`\\b[a-z\\d_]*_t\\b`},{match:t.concat(/\batomic_/,t.either(`bool`,`char`,`schar`,`uchar`,`short`,`ushort`,`int`,`uint`,`long`,`ulong`,`llong`,`ullong`,`char16_t`,`char32_t`,`wchar_t`,`int_least8_t`,`uint_least8_t`,`int_least16_t`,`uint_least16_t`,`int_least32_t`,`uint_least32_t`,`int_least64_t`,`uint_least64_t`,`int_fast8_t`,`uint_fast8_t`,`int_fast16_t`,`uint_fast16_t`,`int_fast32_t`,`uint_fast32_t`,`int_fast64_t`,`uint_fast64_t`,`intptr_t`,`uintptr_t`,`size_t`,`ptrdiff_t`,`intmax_t`,`uintmax_t`),/\b/)}]},o={className:`string`,variants:[{begin:`(u8?|U|L)?"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]},{begin:`(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)`,end:`'`,illegal:`.`},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\\s"]{0,16})\(/,end:/\)([^()\\\s"]{0,16})"/})]},s={className:`number`,variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},c={scope:`meta`,begin:/#\s*include\b/,end:/$/,keywords:{keyword:`include`},contains:[{begin:/\\\n/},o,{scope:`string`,begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},l={className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(o,{className:`string`}),n,e.C_BLOCK_COMMENT_MODE]},u=[c,l],d={className:`title`,begin:t.optional(r)+e.IDENT_RE,relevance:0},f=t.optional(r)+e.IDENT_RE+`\\s*\\(`,p={keyword:`asm.auto.break.case.continue.default.do.else.enum.extern.for.fortran.goto.if.inline.register.restrict.return.sizeof.typeof.typeof_unqual.struct.switch.typedef.union.volatile.while._Alignas._Alignof._Atomic._Generic._Noreturn._Static_assert._Thread_local.alignas.alignof.noreturn.static_assert.thread_local._Pragma`.split(`.`),type:`float.double.signed.unsigned.int.short.long.char.void._Bool._BitInt._Complex._Imaginary._Decimal32._Decimal64._Decimal96._Decimal128._Decimal64x._Decimal128x._Float16._Float32._Float64._Float128._Float32x._Float64x._Float128x.const.static.constexpr.complex.bool.imaginary`.split(`.`),literal:`true false NULL`,built_in:`std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr`},m=[...u,a,n,e.C_BLOCK_COMMENT_MODE,s,o],h={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:`new throw return else`,end:/;/}],keywords:p,contains:m.concat([{begin:/\(/,end:/\)/,keywords:p,contains:m.concat([`self`]),relevance:0}]),relevance:0},g={begin:`(`+i+`[\\*&\\s]+){1,12}`+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:p,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:`decltype\\(auto\\)`,keywords:p,relevance:0},{begin:f,returnBegin:!0,contains:[e.inherit(d,{className:`title.function`})],relevance:0},{relevance:0,match:/,/},{className:`params`,begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,o,s,a,{begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:[`self`,n,e.C_BLOCK_COMMENT_MODE,o,s,a]}]},a,n,e.C_BLOCK_COMMENT_MODE,...u]};return{name:`C`,aliases:[`h`],keywords:p,disableAutodetect:!0,illegal:`</`,contains:[].concat(h,g,m,[...u,{begin:e.IDENT_RE+`::`,keywords:p},{className:`class`,beginKeywords:`enum class struct union`,end:/[{;:<>=]/,contains:[{beginKeywords:`final class struct`},e.TITLE_MODE]}]),exports:{preprocessor:l,strings:o,keywords:p}}}t.exports=n})),ne=n(((e,t)=>{function n(e){let t=e.regex,n=e.COMMENT(`//`,`$`,{contains:[{begin:/\\\n/}]}),r=`[a-zA-Z_]\\w*::`,i=`(?!struct)(decltype\\(auto\\)|`+t.optional(r)+`[a-zA-Z_]\\w*`+t.optional(`<[^<>]+>`)+`)`,a={className:`type`,begin:`\\b[a-z\\d_]*_t\\b`},o={className:`string`,variants:[{begin:`(u8?|U|L)?"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]},{begin:`(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)`,end:`'`,illegal:`.`},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\\s"]{0,16})\(/,end:/\)([^()\\\s"]{0,16})"/})]},s={className:`number`,variants:[{begin:`[+-]?(?:(?:\\b[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|\\b[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|\\b0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)`},{begin:`[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)`}],relevance:0},c=[{scope:`meta`,begin:/#\s*include\b/,end:/$/,keywords:{keyword:`include`},contains:[{begin:/\\\n/},o,{scope:`string`,begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},{className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(o,{className:`string`}),n,e.C_BLOCK_COMMENT_MODE]}],l={className:`title`,begin:t.optional(r)+e.IDENT_RE,relevance:0},u=t.optional(r)+e.IDENT_RE+`\\s*\\(`,d=`alignas.alignof.and.and_eq.asm.atomic_cancel.atomic_commit.atomic_noexcept.auto.bitand.bitor.break.case.catch.class.co_await.co_return.co_yield.compl.concept.const_cast|10.consteval.constexpr.constinit.continue.decltype.default.delete.do.dynamic_cast|10.else.enum.explicit.export.extern.false.final.for.friend.goto.if.import.inline.module.mutable.namespace.new.noexcept.not.not_eq.nullptr.operator.or.or_eq.override.private.protected.public.reflexpr.register.reinterpret_cast|10.requires.return.sizeof.static_assert.static_cast|10.struct.switch.synchronized.template.this.thread_local.throw.transaction_safe.transaction_safe_dynamic.true.try.typedef.typeid.typename.union.using.virtual.volatile.while.xor.xor_eq`.split(`.`),f=[`bool`,`char`,`char16_t`,`char32_t`,`char8_t`,`double`,`float`,`int`,`long`,`short`,`void`,`wchar_t`,`unsigned`,`signed`,`const`,`static`],p=`any.auto_ptr.barrier.binary_semaphore.bitset.complex.condition_variable.condition_variable_any.counting_semaphore.deque.false_type.flat_map.flat_set.future.imaginary.initializer_list.istringstream.jthread.latch.lock_guard.multimap.multiset.mutex.optional.ostringstream.packaged_task.pair.promise.priority_queue.queue.recursive_mutex.recursive_timed_mutex.scoped_lock.set.shared_future.shared_lock.shared_mutex.shared_timed_mutex.shared_ptr.stack.string_view.stringstream.timed_mutex.thread.true_type.tuple.unique_lock.unique_ptr.unordered_map.unordered_multimap.unordered_multiset.unordered_set.variant.vector.weak_ptr.wstring.wstring_view`.split(`.`),m=`abort.abs.acos.apply.as_const.asin.atan.atan2.calloc.ceil.cerr.cin.clog.cos.cosh.cout.declval.endl.exchange.exit.exp.fabs.floor.fmod.forward.fprintf.fputs.free.frexp.fscanf.future.invoke.isalnum.isalpha.iscntrl.isdigit.isgraph.islower.isprint.ispunct.isspace.isupper.isxdigit.labs.launder.ldexp.log.log10.make_pair.make_shared.make_shared_for_overwrite.make_tuple.make_unique.malloc.memchr.memcmp.memcpy.memset.modf.move.pow.printf.putchar.puts.realloc.scanf.sin.sinh.snprintf.sprintf.sqrt.sscanf.std.stderr.stdin.stdout.strcat.strchr.strcmp.strcpy.strcspn.strlen.strncat.strncmp.strncpy.strpbrk.strrchr.strspn.strstr.swap.tan.tanh.terminate.to_underlying.tolower.toupper.vfprintf.visit.vprintf.vsprintf`.split(`.`),h={type:f,keyword:d,literal:[`NULL`,`false`,`nullopt`,`nullptr`,`true`],built_in:[`_Pragma`],_type_hints:p},g={className:`function.dispatch`,relevance:0,keywords:{_hint:m},begin:t.concat(/\b/,`(?!${d.join(`|`)})`,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},_=[g,...c,a,n,e.C_BLOCK_COMMENT_MODE,s,o],v={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:`new throw return else`,end:/;/}],keywords:h,contains:_.concat([{begin:/\(/,end:/\)/,keywords:h,contains:_.concat([`self`]),relevance:0}]),relevance:0},y={className:`function`,begin:`(`+i+`[\\*&\\s]+){1,12}`+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:h,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:`decltype\\(auto\\)`,keywords:h,relevance:0},{begin:u,returnBegin:!0,contains:[l],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[o,s]},{relevance:0,match:/,/},{className:`params`,begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,o,s,a,{begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[`self`,n,e.C_BLOCK_COMMENT_MODE,o,s,a]}]},a,n,e.C_BLOCK_COMMENT_MODE,...c]};return{name:`C++`,aliases:[`cc`,`c++`,`h++`,`hpp`,`hh`,`hxx`,`cxx`],keywords:h,illegal:`</`,classNameAliases:{"function.dispatch":`built_in`},contains:[].concat(v,y,g,_,[...c,{begin:`\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)`,end:`>`,keywords:h,contains:[`self`,a]},{begin:e.IDENT_RE+`::`,keywords:h},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:`keyword`,3:`title.class`}}])}}t.exports=n})),G=n(((e,t)=>{function n(e){let t=[`bool`,`byte`,`char`,`decimal`,`delegate`,`double`,`dynamic`,`enum`,`float`,`int`,`long`,`nint`,`nuint`,`object`,`sbyte`,`short`,`string`,`ulong`,`uint`,`ushort`],n=[`public`,`private`,`protected`,`static`,`internal`,`protected`,`abstract`,`async`,`extern`,`override`,`unsafe`,`virtual`,`new`,`sealed`,`partial`],r={keyword:`abstract.as.base.break.case.catch.class.const.continue.do.else.event.explicit.extern.finally.fixed.for.foreach.goto.if.implicit.in.interface.internal.is.lock.namespace.new.operator.out.override.params.private.protected.public.readonly.record.ref.return.scoped.sealed.sizeof.stackalloc.static.struct.switch.this.throw.try.typeof.unchecked.unsafe.using.virtual.void.volatile.while`.split(`.`).concat(`add.alias.and.ascending.args.async.await.by.descending.dynamic.equals.file.from.get.global.group.init.into.join.let.nameof.not.notnull.on.or.orderby.partial.record.remove.required.scoped.select.set.unmanaged.value|0.var.when.where.with.yield`.split(`.`)),built_in:t,literal:[`default`,`false`,`null`,`true`]},i=e.inherit(e.TITLE_MODE,{begin:`[a-zA-Z](\\.?\\w)*`}),a=`([uU][lL]?|[lL][uU]?)?`,o={className:`number`,variants:[{begin:`\\b0[bB]_*[01](_*[01])*`+a},{begin:`(-?)\\b0[xX]_*[a-fA-F0-9](_*[a-fA-F0-9])*`+a},{begin:`(-?)(\\b\\d(_*\\d)*(\\.(\\d(_*\\d)*)?)?|\\.\\d(_*\\d)*)([eE][-+]?\\d(_*\\d)*)?([fFdDmM]|[uU][lL]?|[lL][uU]?)?`}],relevance:0},s={className:`string`,begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},c={className:`string`,begin:`@"`,end:`"`,contains:[{begin:`""`}]},l=e.inherit(c,{illegal:/\n/}),u={className:`subst`,begin:/\{/,end:/\}/,keywords:r},d=e.inherit(u,{illegal:/\n/}),f={className:`string`,begin:/\$"/,end:`"`,illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,d]},p={className:`string`,begin:/\$@"/,end:`"`,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:`""`},u]},m=e.inherit(p,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:`""`},d]});u.contains=[p,f,c,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,o,e.C_BLOCK_COMMENT_MODE],d.contains=[m,f,l,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,o,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let h={variants:[s,p,f,c,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},g={begin:`<`,end:`>`,contains:[{beginKeywords:`in out`},i]},_=e.IDENT_RE+`(<`+e.IDENT_RE+`(\\s*,\\s*`+e.IDENT_RE+`)*>)?(\\[\\])?`,v={begin:`@`+e.IDENT_RE,relevance:0};return{name:`C#`,aliases:[`cs`,`c#`],keywords:r,illegal:/::/,contains:[e.COMMENT(`///`,`$`,{returnBegin:!0,contains:[{className:`doctag`,variants:[{begin:`///`,relevance:0},{begin:`<!--|-->`},{begin:`</?`,end:`>`}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:`meta`,begin:`#`,end:`$`,keywords:{keyword:`if else elif endif define undef warning error line region endregion pragma checksum`}},h,o,{beginKeywords:`class interface`,relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:`where class`},i,g,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:`namespace`,relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[i,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:`record`,relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[i,g,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:`meta`,begin:`^\\s*\\[(?=[\\w])`,excludeBegin:!0,end:`\\]`,excludeEnd:!0,contains:[{className:`string`,begin:/"/,end:/"/}]},{beginKeywords:`new return throw await else`,relevance:0},{className:`function`,begin:`(`+_+`\\s+)+`+e.IDENT_RE+`\\s*(<[^=]+>\\s*)?\\(`,returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:r,contains:[{beginKeywords:n.join(` `),relevance:0},{begin:e.IDENT_RE+`\\s*(<[^=]+>\\s*)?\\(`,returnBegin:!0,contains:[e.TITLE_MODE,g],relevance:0},{match:/\(\)/},{className:`params`,begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:r,relevance:0,contains:[h,o,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},v]}}t.exports=n})),re=n(((e,t)=>{var n=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},UNICODE_RANGE:{scope:`number`,begin:/\b[Uu]\+[0-9A-Fa-f][0-9A-Fa-f?]{0,5}(-[0-9A-Fa-f][0-9A-Fa-f]{0,5})?/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),r=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),i=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),a=[...r,...i],o=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),s=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),c=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),l=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.corner-bottom-left-shape.corner-bottom-right-shape.corner-shape.corner-top-left-shape.corner-top-right-shape.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.unicode-range.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse();function u(e){let t=e.regex,r=n(e),i={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},u=/@-?\w[\w]*(-\w+)*/,d=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:`CSS`,case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:`from to`},classNameAliases:{keyframePosition:`selector-tag`},contains:[r.BLOCK_COMMENT,i,r.CSS_NUMBER_MODE,{className:`selector-id`,begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:`selector-class`,begin:`\\.[a-zA-Z-][a-zA-Z0-9_-]*`,relevance:0},r.ATTRIBUTE_SELECTOR_MODE,{className:`selector-pseudo`,variants:[{begin:`:(`+s.join(`|`)+`)`},{begin:`:(:)?(`+c.join(`|`)+`)`}]},r.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+l.join(`|`)+`)\\b`},{begin:/:/,end:/[;}{]/,contains:[r.BLOCK_COMMENT,r.HEXCOLOR,r.IMPORTANT,r.CSS_NUMBER_MODE,r.UNICODE_RANGE,...d,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:`url data-uri`},contains:[...d,{className:`string`,begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},r.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:`[{;]`,relevance:0,illegal:/:/,contains:[{className:`keyword`,begin:u},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:o.join(` `)},contains:[{begin:/[a-z-]+(?=:)/,className:`attribute`},...d,r.CSS_NUMBER_MODE]}]},{className:`selector-tag`,begin:`\\b(`+a.join(`|`)+`)\\b`}]}}t.exports=u})),K=n(((e,t)=>{function n(e){let t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:`>`,subLanguage:`xml`,relevance:0},r={match:/^ {0,3}([-*_])[ \t]*(?:\1[ \t]*){2,}$/},i={className:`code`,variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:`(~{3,})[^~](.|\\n)*?\\1~*[ ]*`},{begin:"```",end:"```+[ ]*$"},{begin:`~~~`,end:`~~~+[ ]*$`},{begin:"`.+?`"},{begin:`(?=^( {4}|\\t))`,contains:[{begin:`^( {4}|\\t)`,end:`(\\n)$`}],relevance:0}]},a={className:`bullet`,begin:`^[ ]*([*+-]|(\\d+\\.))(?=\\s+)`,end:`\\s+`,excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:`symbol`,begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:`link`,begin:/:\s*/,end:/$/,excludeBegin:!0}]},s={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:`string`,relevance:0,begin:`\\[`,end:`\\]`,excludeBegin:!0,returnEnd:!0},{className:`link`,relevance:0,begin:`\\]\\(`,end:`\\)`,excludeBegin:!0,excludeEnd:!0},{className:`symbol`,relevance:0,begin:`\\]\\[`,end:`\\]`,excludeBegin:!0,excludeEnd:!0}]},c={className:`strong`,contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},l={className:`emphasis`,contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},u=e.inherit(c,{contains:[]}),d=e.inherit(l,{contains:[]});c.contains.push(d),l.contains.push(u);let f=[n,s];return[c,l,u,d].forEach(e=>{e.contains=e.contains.concat(f)}),f=f.concat(c,l),{name:`Markdown`,aliases:[`md`,`mkdown`,`mkd`],contains:[{className:`section`,variants:[{begin:`^#{1,6}`,end:`$`,contains:f},{begin:`(?=^.+?\\n[=-]{2,}$)`,contains:[{begin:`^[=-]*$`},{begin:`^`,end:`\\n`,contains:f}]}]},n,a,r,c,l,{className:`quote`,begin:`^>\\s+`,contains:f,end:`$`},i,s,o,{scope:`literal`,match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}t.exports=n})),ie=n(((e,t)=>{function n(e){let t=e.regex;return{name:`Diff`,aliases:[`patch`],contains:[{className:`meta`,relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^@@ +-\d+ +\+\d+,\d+ +@@/,/^@@ +-\d+,\d+ +\+\d+ +@@/,/^@@ +-\d+ +\+\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:`comment`,variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:`addition`,begin:/^\+/,end:/$/},{className:`deletion`,begin:/^-/,end:/$/},{className:`addition`,begin:/^!/,end:/$/}]}}t.exports=n})),q=n(((e,t)=>{function n(e){let t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=t.concat(r,/(::\w+)*/),a={"variable.constant":[`__FILE__`,`__LINE__`,`__ENCODING__`],"variable.language":[`self`,`super`],keyword:`alias.and.begin.BEGIN.break.case.class.defined.do.else.elsif.end.END.ensure.for.if.in.module.next.not.or.redo.require.rescue.retry.return.then.undef.unless.until.when.while.yield.include.extend.prepend.public.private.protected.raise.throw`.split(`.`),built_in:[`proc`,`lambda`,`attr_accessor`,`attr_reader`,`attr_writer`,`define_method`,`private_constant`,`module_function`],literal:[`true`,`false`,`nil`]},o={className:`doctag`,begin:`@[A-Za-z]+`},s={begin:`#<`,end:`>`},c=[e.COMMENT(`#`,`$`,{contains:[o]}),e.COMMENT(`^=begin`,`^=end`,{contains:[o],relevance:10}),e.COMMENT(`^__END__`,e.MATCH_NOTHING_RE)],l={className:`subst`,begin:/#\{/,end:/\}/,keywords:a},u={className:`string`,contains:[e.BACKSLASH_ESCAPE,l],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,l]})]}]},d=`[0-9](_?[0-9])*`,f={className:`number`,relevance:0,variants:[{begin:`\\b([1-9](_?[0-9])*|0)(\\.(${d}))?([eE][+-]?(${d})|r)?i?\\b`},{begin:`\\b0[dD][0-9](_?[0-9])*r?i?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*r?i?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*r?i?\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b`},{begin:`\\b0(_?[0-7])+r?i?\\b`}]},p={variants:[{match:/\(\)/},{className:`params`,begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},m=[u,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:`title.class`,4:`title.class.inherited`},keywords:a},{match:[/(include|extend)\s+/,i],scope:{2:`title.class`},keywords:a},{relevance:0,match:[i,/\.new[. (]/],scope:{1:`title.class`}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`},{relevance:0,match:r,scope:`title.class`},{match:[/def/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[p]},{begin:`::`},{className:`symbol`,begin:e.UNDERSCORE_IDENT_RE+`(!|\\?)?:`,relevance:0},{className:`symbol`,begin:`:(?!\\s)`,contains:[u,{begin:n}],relevance:0},f,{className:`variable`,begin:`(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])`},{className:`params`,begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:a},{begin:`(`+e.RE_STARTERS_RE+`|unless)\\s*`,keywords:`unless`,contains:[{className:`regexp`,contains:[e.BACKSLASH_ESCAPE,l],illegal:/\n/,variants:[{begin:`/`,end:`/[a-z]*`},{begin:/%r\{/,end:/\}[a-z]*/},{begin:`%r\\(`,end:`\\)[a-z]*`},{begin:`%r!`,end:`![a-z]*`},{begin:`%r\\[`,end:`\\][a-z]*`}]}].concat(s,c),relevance:0}].concat(s,c);l.contains=m,p.contains=m;let h=[{begin:/^\s*=>/,starts:{end:`$`,contains:m}},{className:`meta.prompt`,begin:`^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]|(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>)(?=[ ])`,starts:{end:`$`,keywords:a,contains:m}}];return c.unshift(s),{name:`Ruby`,aliases:[`rb`,`gemspec`,`podspec`,`thor`,`irb`],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:`ruby`})].concat(h,c,m)}}t.exports=n})),ae=n(((e,t)=>{function n(e){let t={keyword:[`break`,`case`,`chan`,`const`,`continue`,`default`,`defer`,`else`,`fallthrough`,`for`,`func`,`go`,`goto`,`if`,`import`,`interface`,`map`,`package`,`range`,`return`,`select`,`struct`,`switch`,`type`,`var`],type:[`bool`,`byte`,`complex64`,`complex128`,`error`,`float32`,`float64`,`int8`,`int16`,`int32`,`int64`,`string`,`uint8`,`uint16`,`uint32`,`uint64`,`int`,`uint`,`uintptr`,`rune`],literal:[`true`,`false`,`iota`,`nil`],built_in:[`append`,`cap`,`close`,`complex`,`copy`,`imag`,`len`,`make`,`new`,`panic`,`print`,`println`,`real`,`recover`,`delete`]};return{name:`Go`,aliases:[`golang`],keywords:t,illegal:`</`,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:`string`,variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:`number`,variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\b0[bB](_?[01])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:`function`,beginKeywords:`func`,end:`\\s*(\\{|$)`,excludeEnd:!0,contains:[e.TITLE_MODE,{className:`params`,begin:/\(/,end:/\)/,endsParent:!0,keywords:t,illegal:/["']/}]}]}}t.exports=n})),oe=n(((e,t)=>{function n(e){let t=e.regex;return{name:`GraphQL`,aliases:[`gql`],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:[`query`,`mutation`,`subscription`,`type`,`input`,`schema`,`directive`,`interface`,`union`,`scalar`,`fragment`,`enum`,`on`],literal:[`true`,`false`,`null`]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:`punctuation`,match:/[.]{3}/,relevance:0},{scope:`punctuation`,begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:`variable`,begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:`meta`,match:/@\w+/,excludeEnd:!0},{scope:`symbol`,begin:t.concat(/[_A-Za-z][_0-9A-Za-z]*/,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}t.exports=n})),se=n(((e,t)=>{function n(e){let t=e.regex,n={className:`number`,relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},r=e.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];let i={className:`variable`,variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},a={className:`literal`,begin:/\bon|off|true|false|yes|no\b/},o={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:`'''`,end:`'''`,relevance:10},{begin:`"""`,end:`"""`,relevance:10},{begin:`"`,end:`"`},{begin:`'`,end:`'`}]},s={begin:/\[/,end:/\]/,contains:[r,a,i,o,n,`self`],relevance:0},c=t.either(/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/);return{name:`TOML, also INI`,aliases:[`toml`],case_insensitive:!0,illegal:/\S/,contains:[r,{className:`section`,begin:/\[+/,end:/\]+/},{begin:t.concat(c,`(\\s*\\.\\s*`,c,`)*`,t.lookahead(/\s*=\s*[^#\s]/)),className:`attr`,starts:{end:/$/,contains:[r,s,a,i,o,n]}}]}}t.exports=n})),ce=n(((e,t)=>{var n=`[0-9](_*[0-9])*`,r=`\\.(${n})`,i=`[0-9a-fA-F](_*[0-9a-fA-F])*`,a={className:`number`,variants:[{begin:`(\\b(${n})((${r})|\\.)?|(${r}))[eE][+-]?(${n})[fFdD]?\\b`},{begin:`\\b(${n})((${r})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${r})[fFdD]?\\b`},{begin:`\\b(${n})[fFdD]\\b`},{begin:`\\b0[xX]((${i})\\.?|(${i})?\\.(${i}))[pP][+-]?(${n})[fFdD]?\\b`},{begin:`\\b(0|[1-9](_*[0-9])*)[lL]?\\b`},{begin:`\\b0[xX](${i})[lL]?\\b`},{begin:`\\b0(_*[0-7])*[lL]?\\b`},{begin:`\\b0[bB][01](_*[01])*[lL]?\\b`}],relevance:0};function o(e,t,n){return n===-1?``:e.replace(t,r=>o(e,t,n-1))}function s(e){let t=e.regex,n=`[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*`,r=`(?:(?:\\s*\\[\\s*])+)?`,i=`(?:\\?(?:\\s+(?:extends|super)\\s+[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*<@@@>(?:(?:\\s*\\[\\s*])+)?)?|[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*<@@@>(?:(?:\\s*\\[\\s*])+)?)`,s=o(`(?:\\s*<\\s*`+i+`(?:\\s*,\\s*`+i+`)*\\s*>)?`,/<@@@>/g,2),c={keyword:`synchronized.abstract.private.var.static.if.const .for.while.strictfp.finally.protected.import.native.final.void.enum.else.break.transient.catch.instanceof.volatile.case.assert.package.default.public.try.switch.continue.throws.protected.public.private.module.requires.exports.do.sealed.yield.permits.goto.when`.split(`.`),literal:[`false`,`true`,`null`],type:[`char`,`boolean`,`long`,`float`,`int`,`byte`,`short`,`double`],built_in:[`super`,`this`]},l={className:`meta`,begin:`@`+n,contains:[{begin:/\(/,end:/\)/,contains:[`self`]}]},u={className:`params`,begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:`Java`,aliases:[`jsp`],keywords:c,illegal:/<\/|#/,contains:[e.COMMENT(`/\\*\\*`,`\\*/`,{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:`doctag`,begin:`@[A-Za-z]+`}]}),{begin:/import java\.[a-z]+\./,keywords:`import`,relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:`string`,contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:`keyword`,3:`title.class`}},{match:/non-sealed/,scope:`keyword`},{beginKeywords:`new throw return else yield assert`,relevance:0},{begin:[n,t.concat(s,r,/\s+/),n,r,/\s*/,/=(?!=)/],className:{1:`type`,3:`variable`,6:`operator`}},{begin:[/record/,/\s+/,n],className:{1:`keyword`,3:`title.class`},contains:[u,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{begin:[n,t.concat(s,r,/\s+/),n,/\s*(?=\()/],className:{1:`type`,3:`title.function`},keywords:c,contains:[{className:`params`,begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[l,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},a,l]}}t.exports=s})),le=n(((e,t)=>{var n=`[A-Za-z$_][0-9A-Za-z$_]*`,r=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),i=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],a=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),o=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],s=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],c=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`self`,`global`],l=[].concat(s,a,o);function u(e){let t=e.regex,u=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},d=n,f={begin:`<>`,end:`</>`},p=/<[A-Za-z0-9\\._:-]+\s*\/>/,m={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let n=e[0].length+e.index,r=e.input[n];if(r===`<`||r===`,`){t.ignoreMatch();return}r===`>`&&(u(e,{after:n})||t.ignoreMatch());let i,a=e.input.substring(n);((i=a.match(/^\s*=/))||(i=a.match(/^\s+extends\s+/))&&i.index===0)&&t.ignoreMatch()}},h={$pattern:n,keyword:r,literal:i,built_in:l,"variable.language":c},g=`[0-9](_?[0-9])*`,_=`\\.(${g})`,v=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,y={className:`number`,variants:[{begin:`(\\b(${v})((${_})|\\.)?|(${_}))[eE][+-]?(${g})\\b`},{begin:`\\b(${v})\\b((${_})\\b|\\.)?|(${_})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},b={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:h,contains:[]},x={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:`xml`}},S={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:`css`}},C={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:`graphql`}},w={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,b]},T={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:d+`(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},E=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,S,C,w,{match:/\$\d+/},y];b.contains=E.concat({begin:/\{/,end:/\}/,keywords:h,contains:[`self`].concat(E)});let D=[].concat(T,b.contains),O=D.concat([{begin:/(\s*)\(/,end:/\)/,keywords:h,contains:[`self`].concat(D)}]),k={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:O},A={variants:[{match:[/class/,/\s+/,d,/\s+/,/extends/,/\s+/,t.concat(d,`(`,t.concat(/\./,d),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,d],scope:{1:`keyword`,3:`title.class`}}]},j={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...a,...o]}},M={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},N={variants:[{match:[/function/,/\s+/,d,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[k],illegal:/%/},P={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function F(e){return t.concat(`(?!`,e.join(`|`),`)`)}let I={match:t.concat(/\b/,F([...s,`super`,`import`,`await`].map(e=>`${e}\\s*\\(`)),d,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},L={begin:t.concat(/\./,t.lookahead(t.concat(d,/(?![0-9A-Za-z$_(])/))),end:d,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},R={match:[/get|set/,/\s+/,d,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},k]},z=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,B={match:[/const|var|let/,/\s+/,d,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(z)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[k]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:h,exports:{PARAMS_CONTAINS:O,CLASS_REFERENCE:j},illegal:/#(?![$_A-Za-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),M,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,S,C,w,T,{match:/\$\d+/},y,j,{scope:`attr`,match:d+t.lookahead(`:`),relevance:0},B,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[T,e.REGEXP_MODE,{className:`function`,begin:z,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:O}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:f.begin,end:f.end},{match:p},{begin:m.begin,"on:begin":m.isTrulyOpeningTag,end:m.end}],subLanguage:`xml`,contains:[{begin:m.begin,end:m.end,skip:!0,contains:[`self`]}]}]},N,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[k,e.inherit(e.TITLE_MODE,{begin:d,className:`title.function`})]},{match:/\.\.\./,relevance:0},L,{match:`\\$`+d,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[k]},I,P,A,R,{match:/\$[(.]/}]}}t.exports=u})),ue=n(((e,t)=>{var n={scope:`number`,match:`([-+]?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)|NaN|[-+]?Infinity`,relevance:0};function r(e){let t={className:`attr`,begin:/(("(\\.|[^\\"\r\n])*")|('(\\.|[^\\'\r\n])*'))(?=\s*:)/,relevance:1.01},r={match:/[{}[\],:]/,className:`punctuation`,relevance:0},i=[`true`,`false`,`null`],a={scope:`literal`,beginKeywords:i.join(` `)};return{name:`JSON`,aliases:[`jsonc`,`json5`],keywords:{literal:i},contains:[t,r,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,n,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:`\\S`}}t.exports=r})),de=n(((e,t)=>{var n=`[0-9](_*[0-9])*`,r=`\\.(${n})`,i=`[0-9a-fA-F](_*[0-9a-fA-F])*`,a={className:`number`,variants:[{begin:`(\\b(${n})((${r})|\\.)?|(${r}))[eE][+-]?(${n})[fFdD]?\\b`},{begin:`\\b(${n})((${r})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${r})[fFdD]?\\b`},{begin:`\\b(${n})[fFdD]\\b`},{begin:`\\b0[xX]((${i})\\.?|(${i})?\\.(${i}))[pP][+-]?(${n})[fFdD]?\\b`},{begin:`\\b(0|[1-9](_*[0-9])*)[lL]?\\b`},{begin:`\\b0[xX](${i})[lL]?\\b`},{begin:`\\b0(_*[0-7])*[lL]?\\b`},{begin:`\\b0[bB][01](_*[01])*[lL]?\\b`}],relevance:0};function o(e){let t={keyword:`abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual`,built_in:`Byte Short Char Int Long Boolean Float Double Void Unit Nothing`,literal:`true false null`},n={className:`keyword`,begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:`symbol`,begin:/@\w+/}]}},r={className:`symbol`,begin:e.UNDERSCORE_IDENT_RE+`@`},i={className:`subst`,begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},o={className:`variable`,begin:`\\$`+e.UNDERSCORE_IDENT_RE},s={className:`string`,variants:[{begin:`"""`,end:`"""(?=[^"])`,contains:[o,i]},{begin:`'`,end:`'`,illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:`"`,end:`"`,illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,o,i]}]};i.contains.push(s);let c={className:`meta`,begin:`@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*`+e.UNDERSCORE_IDENT_RE+`)?`},l={className:`meta`,begin:`@`+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(s,{className:`string`}),`self`]}]},u=a,d=e.COMMENT(`/\\*`,`\\*/`,{contains:[e.C_BLOCK_COMMENT_MODE]}),f={variants:[{className:`type`,begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},p=f;return p.variants[1].contains=[f],f.variants[1].contains=[p],{name:`Kotlin`,aliases:[`kt`,`kts`,`ktm`,`ktx`],keywords:t,contains:[e.COMMENT(`/\\*\\*`,`\\*/`,{relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`}]}),e.C_LINE_COMMENT_MODE,d,n,r,c,l,{className:`function`,beginKeywords:`fun`,end:`[(]|$`,returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+`\\s*\\(`,returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:`type`,begin:/</,end:/>/,keywords:`reified`,relevance:0},{className:`params`,begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[f,e.C_LINE_COMMENT_MODE,d],relevance:0},e.C_LINE_COMMENT_MODE,d,c,l,s,e.C_NUMBER_MODE]},d]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:`title.class`},keywords:`class interface trait`,end:/[:\{(]|$/,excludeEnd:!0,illegal:`extends implements`,contains:[{beginKeywords:`public protected internal private constructor`},e.UNDERSCORE_TITLE_MODE,{className:`type`,begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},c,l]},s,{className:`meta`,begin:`^#!/usr/bin/env`,end:`$`,illegal:`
|
|
4
|
+
`},u]}}t.exports=o})),fe=n(((e,t)=>{var n=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},UNICODE_RANGE:{scope:`number`,begin:/\b[Uu]\+[0-9A-Fa-f][0-9A-Fa-f?]{0,5}(-[0-9A-Fa-f][0-9A-Fa-f]{0,5})?/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),r=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),i=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),a=[...r,...i],o=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),s=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),c=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),l=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.corner-bottom-left-shape.corner-bottom-right-shape.corner-shape.corner-top-left-shape.corner-top-right-shape.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.unicode-range.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse(),u=s.concat(c).sort().reverse();function d(e){let t=n(e),r=u,i=`([\\w-]+|@\\{[\\w-]+\\})`,d=[],f=[],p=function(e){return{className:`string`,begin:`~?`+e+`.*?`+e}},m=function(e,t,n){return{className:e,begin:t,relevance:n}},h={$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:o.join(` `)},g={begin:`\\(`,end:`\\)`,contains:f,keywords:h,relevance:0};f.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p(`'`),p(`"`),t.CSS_NUMBER_MODE,{begin:`(url|data-uri)\\(`,starts:{className:`string`,end:`[\\)\\n]`,excludeEnd:!0}},t.UNICODE_RANGE,t.HEXCOLOR,g,m(`variable`,`@@?[\\w-]+`,10),m(`variable`,`@\\{[\\w-]+\\}`),m(`built_in`,"~?`[^`]*?`"),{className:`attribute`,begin:`[\\w-]+\\s*:`,end:`:`,returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:`and not`},t.FUNCTION_DISPATCH);let _=f.concat({begin:/\{/,end:/\}/,contains:d}),v={beginKeywords:`when`,endsWithParent:!0,contains:[{beginKeywords:`and not`}].concat(f)},y={begin:i+`\\s*:`,returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+l.join(`|`)+`)\\b`,end:/(?=:)/,starts:{endsWithParent:!0,illegal:`[<=$]`,relevance:0,contains:f}}]},b={className:`keyword`,begin:`@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b`,starts:{end:`[;{}]`,keywords:h,returnEnd:!0,contains:f,relevance:0}},x={className:`variable`,variants:[{begin:`@[\\w-]+\\s*:`,relevance:15},{begin:`@[\\w-]+`}],starts:{end:`[;}]`,returnEnd:!0,contains:_}},S={variants:[{begin:`[\\.#:&\\[>]`,end:`[;{}]`},{begin:i,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,v,m(`keyword`,`all\\b`),m(`variable`,`@\\{[\\w-]+\\}`),{begin:`\\b(`+a.join(`|`)+`)\\b`,className:`selector-tag`},t.CSS_NUMBER_MODE,m(`selector-tag`,i,0),m(`selector-id`,`#`+i),m(`selector-class`,`\\.`+i,0),m(`selector-tag`,`&`,0),t.ATTRIBUTE_SELECTOR_MODE,{className:`selector-pseudo`,begin:`:(`+s.join(`|`)+`)`},{className:`selector-pseudo`,begin:`:(:)?(`+c.join(`|`)+`)`},{begin:/\(/,end:/\)/,relevance:0,contains:_},{begin:`!important`},t.FUNCTION_DISPATCH]},C={begin:`[\\w-]+:(:)?(${r.join(`|`)})`,returnBegin:!0,contains:[S]};return d.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,x,C,y,S,v,t.FUNCTION_DISPATCH),{name:`Less`,case_insensitive:!0,illegal:`[=>'/<($"]`,contains:d}}t.exports=d})),pe=n(((e,t)=>{function n(e){let t=`\\[=*\\[`,n=`\\]=*\\]`,r={begin:t,end:n,contains:[`self`]},i=[e.COMMENT(`--(?!\\[=*\\[)`,`$`),e.COMMENT(`--\\[=*\\[`,n,{contains:[r],relevance:10})];return{name:`Lua`,aliases:[`pluto`],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:`true false nil`,keyword:`and break do else elseif end for goto if in local global not or repeat return then until while`,built_in:`_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove`},contains:i.concat([{className:`function`,beginKeywords:`function`,end:`\\)`,contains:[e.inherit(e.TITLE_MODE,{begin:`([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*`}),{className:`params`,begin:`\\(`,endsWithParent:!0,contains:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:`string`,begin:t,end:n,contains:[r],relevance:5}])}}t.exports=n})),me=n(((e,t)=>{function n(e){let t={className:`variable`,variants:[{begin:`\\$\\(`+e.UNDERSCORE_IDENT_RE+`\\)`,contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},r={className:`variable`,begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:`subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value`},contains:[t,n]},i={begin:`^`+e.UNDERSCORE_IDENT_RE+`\\s*(?=[:+?]?=)`},a={className:`meta`,begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:`.PHONY`}},o={className:`section`,begin:/^[^\s]+:/,end:/$/,contains:[t]};return{name:`Makefile`,aliases:[`mk`,`mak`,`make`],keywords:{$pattern:/[\w-]+/,keyword:`define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath`},contains:[e.HASH_COMMENT_MODE,t,n,r,i,a,o]}}t.exports=n})),he=n(((e,t)=>{function n(e){let t=e.regex,n=`abs.accept.alarm.and.atan2.bind.binmode.bless.break.caller.chdir.chmod.chomp.chop.chown.chr.chroot.class.close.closedir.connect.continue.cos.crypt.dbmclose.dbmopen.defined.delete.die.do.dump.each.else.elsif.endgrent.endhostent.endnetent.endprotoent.endpwent.endservent.eof.eval.exec.exists.exit.exp.fcntl.field.fileno.flock.for.foreach.fork.format.formline.getc.getgrent.getgrgid.getgrnam.gethostbyaddr.gethostbyname.gethostent.getlogin.getnetbyaddr.getnetbyname.getnetent.getpeername.getpgrp.getpriority.getprotobyname.getprotobynumber.getprotoent.getpwent.getpwnam.getpwuid.getservbyname.getservbyport.getservent.getsockname.getsockopt.given.glob.gmtime.goto.grep.gt.hex.if.index.int.ioctl.join.keys.kill.last.lc.lcfirst.length.link.listen.local.localtime.log.lstat.lt.ma.map.method.mkdir.msgctl.msgget.msgrcv.msgsnd.my.ne.next.no.not.oct.open.opendir.or.ord.our.pack.package.pipe.pop.pos.print.printf.prototype.push.q|0.qq.quotemeta.qw.qx.rand.read.readdir.readline.readlink.readpipe.recv.redo.ref.rename.require.reset.return.reverse.rewinddir.rindex.rmdir.say.scalar.seek.seekdir.select.semctl.semget.semop.send.setgrent.sethostent.setnetent.setpgrp.setpriority.setprotoent.setpwent.setservent.setsockopt.shift.shmctl.shmget.shmread.shmwrite.shutdown.sin.sleep.socket.socketpair.sort.splice.split.sprintf.sqrt.srand.stat.state.study.sub.substr.symlink.syscall.sysopen.sysread.sysseek.system.syswrite.tell.telldir.tie.tied.time.times.tr.truncate.uc.ucfirst.umask.undef.unless.unlink.unpack.unshift.untie.until.use.utime.values.vec.wait.waitpid.wantarray.warn.when.while.write.x|0.xor.y|0`.split(`.`),r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(` `)},a={className:`subst`,begin:`[$@]\\{`,end:`\\}`,keywords:i},o={begin:/->\{/,end:/\}/},s={scope:`attr`,match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:`variable`,variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,`(?![A-Za-z])(?![@$%])`)},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[s]},l={className:`number`,variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},u=[e.BACKSLASH_ESCAPE,a,c],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(e,n,i=`\\1`)=>{let a=i===`\\1`?i:t.concat(i,n);return t.concat(t.concat(`(?:`,e,`)`),n,/(?:\\.|[^\\\/])*?/,a,/(?:\\.|[^\\\/])*?/,i,r)},p=(e,n,i)=>t.concat(t.concat(`(?:`,e,`)`),n,/(?:\\.|[^\\\/])*?/,i,r),m=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:`string`,contains:u,variants:[{begin:`q[qwxr]?\\s*\\(`,end:`\\)`,relevance:5},{begin:`q[qwxr]?\\s*\\[`,end:`\\]`,relevance:5},{begin:`q[qwxr]?\\s*\\{`,end:`\\}`,relevance:5},{begin:`q[qwxr]?\\s*\\|`,end:`\\|`,relevance:5},{begin:`q[qwxr]?\\s*<`,end:`>`,relevance:5},{begin:`qw\\s+q`,end:`q`,relevance:5},{begin:`'`,end:`'`,contains:[e.BACKSLASH_ESCAPE]},{begin:`"`,end:`"`},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:`-?\\w+\\s*=>`,relevance:0}]},l,{begin:`(\\/\\/|`+e.RE_STARTERS_RE+`|\\b(split|return|print|reverse|grep)\\b)\\s*`,keywords:`split return print reverse grep`,relevance:0,contains:[e.HASH_COMMENT_MODE,{className:`regexp`,variants:[{begin:f(`s|tr|y`,t.either(...d,{capture:!0}))},{begin:f(`s|tr|y`,`\\(`,`\\)`)},{begin:f(`s|tr|y`,`\\[`,`\\]`)},{begin:f(`s|tr|y`,`\\{`,`\\}`)}],relevance:2},{className:`regexp`,variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p(`(?:m|qr)?`,/\//,/\//)},{begin:p(`m|qr`,t.either(...d,{capture:!0}),/\1/)},{begin:p(`m|qr`,/\(/,/\)/)},{begin:p(`m|qr`,/\[/,/\]/)},{begin:p(`m|qr`,/\{/,/\}/)}]}]},{className:`function`,beginKeywords:`sub method`,end:`(\\s*\\(.*?\\))?[;{]`,excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,s]},{className:`class`,beginKeywords:`class`,end:`[;{]`,excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,s,l]},{begin:`-\\w\\b`,relevance:0},{begin:`^__DATA__$`,end:`^__END__$`,subLanguage:`mojolicious`,contains:[{begin:`^@@.*`,end:`$`,className:`comment`}]}];return a.contains=m,o.contains=m,{name:`Perl`,aliases:[`pl`,`pm`],keywords:i,contains:m}}t.exports=n})),ge=n(((e,t)=>{function n(e){let t={className:`built_in`,begin:`\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+`},n=/[a-zA-Z@][a-zA-Z0-9_]*/,r={"variable.language":[`this`,`super`],$pattern:n,keyword:`while.export.sizeof.typedef.const.struct.for.union.volatile.static.mutable.if.do.return.goto.enum.else.break.extern.asm.case.default.register.explicit.typename.switch.continue.inline.readonly.assign.readwrite.self.@synchronized.id.typeof.nonatomic.IBOutlet.IBAction.strong.weak.copy.in.out.inout.bycopy.byref.oneway.__strong.__weak.__block.__autoreleasing.@private.@protected.@public.@try.@property.@end.@throw.@catch.@finally.@autoreleasepool.@synthesize.@dynamic.@selector.@optional.@required.@encode.@package.@import.@defs.@compatibility_alias.__bridge.__bridge_transfer.__bridge_retained.__bridge_retain.__covariant.__contravariant.__kindof._Nonnull._Nullable._Null_unspecified.__FUNCTION__.__PRETTY_FUNCTION__.__attribute__.getter.setter.retain.unsafe_unretained.nonnull.nullable.null_unspecified.null_resettable.class.instancetype.NS_DESIGNATED_INITIALIZER.NS_UNAVAILABLE.NS_REQUIRES_SUPER.NS_RETURNS_INNER_POINTER.NS_INLINE.NS_AVAILABLE.NS_DEPRECATED.NS_ENUM.NS_OPTIONS.NS_SWIFT_UNAVAILABLE.NS_ASSUME_NONNULL_BEGIN.NS_ASSUME_NONNULL_END.NS_REFINED_FOR_SWIFT.NS_SWIFT_NAME.NS_SWIFT_NOTHROW.NS_DURING.NS_HANDLER.NS_ENDHANDLER.NS_VALUERETURN.NS_VOIDRETURN`.split(`.`),literal:[`false`,`true`,`FALSE`,`TRUE`,`nil`,`YES`,`NO`,`NULL`],built_in:[`dispatch_once_t`,`dispatch_queue_t`,`dispatch_sync`,`dispatch_async`,`dispatch_once`],type:[`int`,`float`,`char`,`unsigned`,`signed`,`short`,`long`,`double`,`wchar_t`,`unichar`,`void`,`bool`,`BOOL`,`id|0`,`_Bool`]},i={$pattern:n,keyword:[`@interface`,`@class`,`@protocol`,`@implementation`]};return{name:`Objective-C`,aliases:[`mm`,`objc`,`obj-c`,`obj-c++`,`objective-c++`],keywords:r,illegal:`</`,contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:`string`,variants:[{begin:`@"`,end:`"`,illegal:`\\n`,contains:[e.BACKSLASH_ESCAPE]}]},{className:`meta`,begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:`if else elif endif define undef warning error line pragma ifdef ifndef include`},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:`string`}),{className:`string`,begin:/<.*?>/,end:/$/,illegal:`\\n`},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:`class`,begin:`(`+i.keyword.join(`|`)+`)\\b`,end:/(\{|$)/,excludeEnd:!0,keywords:i,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:`\\.`+e.UNDERSCORE_IDENT_RE,relevance:0}]}}t.exports=n})),_e=n(((e,t)=>{function n(e){let t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),a=t.concat(/[A-Z]+/,n),o={scope:`variable`,match:`\\$+`+r},s={scope:`meta`,variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:`subst`,variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},l=e.inherit(e.APOS_STRING_MODE,{illegal:null}),u=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(c)}),d={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(e,t)=>{t.data._beginMatch=e[1]||e[2]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}},f=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[
|
|
5
|
+
]`,m={scope:`string`,variants:[u,l,d,f]},h={scope:`number`,variants:[{begin:`\\b0[bB][01]+(?:_[01]+)*\\b`},{begin:`\\b0[oO][0-7]+(?:_[0-7]+)*\\b`},{begin:`\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b`},{begin:`(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?`}],relevance:0},g=[`false`,`null`,`true`],_=`__CLASS__.__DIR__.__FILE__.__FUNCTION__.__COMPILER_HALT_OFFSET__.__LINE__.__METHOD__.__NAMESPACE__.__TRAIT__.die.echo.exit.include.include_once.print.require.require_once.array.abstract.and.as.binary.bool.boolean.break.callable.case.catch.class.clone.const.continue.declare.default.do.double.else.elseif.empty.enddeclare.endfor.endforeach.endif.endswitch.endwhile.enum.eval.extends.final.finally.float.for.foreach.from.global.goto.if.implements.instanceof.insteadof.int.integer.interface.isset.iterable.list.match|0.mixed.new.never.object.or.private.protected.public.readonly.real.return.string.switch.throw.trait.try.unset.use.var.void.while.xor.yield`.split(`.`),v=`Error|0.AppendIterator.ArgumentCountError.ArithmeticError.ArrayIterator.ArrayObject.AssertionError.BadFunctionCallException.BadMethodCallException.CachingIterator.CallbackFilterIterator.CompileError.Countable.DirectoryIterator.DivisionByZeroError.DomainException.EmptyIterator.ErrorException.Exception.FilesystemIterator.FilterIterator.GlobIterator.InfiniteIterator.InvalidArgumentException.IteratorIterator.LengthException.LimitIterator.LogicException.MultipleIterator.NoRewindIterator.OutOfBoundsException.OutOfRangeException.OuterIterator.OverflowException.ParentIterator.ParseError.RangeException.RecursiveArrayIterator.RecursiveCachingIterator.RecursiveCallbackFilterIterator.RecursiveDirectoryIterator.RecursiveFilterIterator.RecursiveIterator.RecursiveIteratorIterator.RecursiveRegexIterator.RecursiveTreeIterator.RegexIterator.RuntimeException.SeekableIterator.SplDoublyLinkedList.SplFileInfo.SplFileObject.SplFixedArray.SplHeap.SplMaxHeap.SplMinHeap.SplObjectStorage.SplObserver.SplPriorityQueue.SplQueue.SplStack.SplSubject.SplTempFileObject.TypeError.UnderflowException.UnexpectedValueException.UnhandledMatchError.ArrayAccess.BackedEnum.Closure.Fiber.Generator.Iterator.IteratorAggregate.Serializable.Stringable.Throwable.Traversable.UnitEnum.WeakReference.WeakMap.Directory.__PHP_Incomplete_Class.parent.php_user_filter.self.static.stdClass`.split(`.`),y={keyword:_,literal:(e=>{let t=[];return e.forEach(e=>{t.push(e),e.toLowerCase()===e?t.push(e.toUpperCase()):t.push(e.toLowerCase())}),t})(g),built_in:v},b=e=>e.map(e=>e.replace(/\|\d+$/,``)),x={variants:[{match:[/new/,t.concat(p,`+`),t.concat(`(?!`,b(v).join(`\\b|`),`\\b)`),i],scope:{1:`keyword`,4:`title.class`}}]},S=t.concat(r,`\\b(?!\\()`),C={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),S],scope:{2:`variable.constant`}},{match:[/::/,/class/],scope:{2:`variable.language`}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),S],scope:{1:`title.class`,3:`variable.constant`}},{match:[i,t.concat(`::`,t.lookahead(/(?!class\b)/))],scope:{1:`title.class`}},{match:[i,/::/,/class/],scope:{1:`title.class`,3:`variable.language`}}]},w={scope:`attr`,match:t.concat(r,t.lookahead(`:`),t.lookahead(/(?!::)/))},T={relevance:0,begin:/\(/,end:/\)/,keywords:y,contains:[w,o,C,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,m,h,x]},E={relevance:0,match:[/\b/,t.concat(`(?!fn\\b|function\\b|`,b(_).join(`\\b|`),`|`,b(v).join(`\\b|`),`\\b)`),r,t.concat(p,`*`),t.lookahead(/(?=\()/)],scope:{3:`title.function.invoke`},contains:[T]};T.contains.push(E);let D=[w,C,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,m,h,x],O={begin:t.concat(/#\[\s*\\?/,t.either(i,a)),beginScope:`meta`,end:/]/,endScope:`meta`,keywords:{literal:g,keyword:[`new`,`array`]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:[`new`,`array`]},contains:[`self`,...D]},...D,{scope:`meta`,variants:[{match:i},{match:a}]}]};return{case_insensitive:!1,keywords:y,contains:[O,e.HASH_COMMENT_MODE,e.COMMENT(`//`,`$`),e.COMMENT(`/\\*`,`\\*/`,{contains:[{scope:`doctag`,match:`@[A-Za-z]+`}]}),{match:/__halt_compiler\(\);/,keywords:`__halt_compiler`,starts:{scope:`comment`,end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:`meta`,endsParent:!0}]}},s,{scope:`variable.language`,match:/\$this\b/},o,E,C,{match:[/const/,/\s/,r],scope:{1:`keyword`,3:`variable.constant`}},x,{scope:`function`,relevance:0,beginKeywords:`fn function`,end:/[;{]/,excludeEnd:!0,illegal:`[$%\\[]`,contains:[{beginKeywords:`use`},e.UNDERSCORE_TITLE_MODE,{begin:`=>`,endsParent:!0},{scope:`params`,begin:`\\(`,end:`\\)`,excludeBegin:!0,excludeEnd:!0,keywords:y,contains:[`self`,O,o,C,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE,e.HASH_COMMENT_MODE,m,h]}]},{scope:`class`,variants:[{beginKeywords:`enum`,illegal:/[($"]/},{beginKeywords:`class interface trait`,illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:`extends implements`},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:`namespace`,relevance:0,end:`;`,illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:`title.class`})]},{beginKeywords:`use`,relevance:0,end:`;`,contains:[{match:/\b(as|const|function)\b/,scope:`keyword`},e.UNDERSCORE_TITLE_MODE]},m,h]}}t.exports=n})),ve=n(((e,t)=>{function n(e){return{name:`PHP template`,subLanguage:`xml`,contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:`php`,contains:[{begin:`/\\*`,end:`\\*/`,skip:!0},{begin:`b"`,end:`"`,skip:!0},{begin:`b'`,end:`'`,skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}t.exports=n})),ye=n(((e,t)=>{function n(e){return{name:`Plain text`,aliases:[`text`,`txt`],disableAutodetect:!0}}t.exports=n})),be=n(((e,t)=>{function n(e){let t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=`and.as.assert.async.await.break.case.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.lazy.match.nonlocal|10.not.or.pass.raise.return.try.while.with.yield`.split(`.`),i={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:`__import__.abs.aiter.all.anext.any.ascii.bin.bool.breakpoint.bytearray.bytes.callable.chr.classmethod.compile.complex.delattr.dict.dir.divmod.enumerate.eval.exec.filter.float.format.frozendict.frozenset.getattr.globals.hasattr.hash.help.hex.id.input.int.isinstance.issubclass.iter.len.list.locals.map.max.memoryview.min.next.object.oct.open.ord.pow.print.property.range.repr.reversed.round.sentinel.set.setattr.slice.sorted.staticmethod.str.sum.super.tuple.type.vars.zip`.split(`.`),literal:[`__debug__`,`Ellipsis`,`False`,`None`,`NotImplemented`,`True`],type:[`Any`,`Callable`,`Coroutine`,`Dict`,`List`,`Literal`,`Generic`,`Optional`,`Sequence`,`Set`,`Tuple`,`Type`,`Union`]},a={className:`meta`,begin:/^(>>>|\.\.\.) /},o={className:`subst`,begin:/\{/,end:/\}/,keywords:i,illegal:/#/},s={begin:/\{\{/,relevance:0},c={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([fFtT][rR]|[rR][fFtT]|[fFtT])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([fFtT][rR]|[rR][fFtT]|[fFtT])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fFtT][rR]|[rR][fFtT]|[fFtT])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,s,o]},{begin:/([fFtT][rR]|[rR][fFtT]|[fFtT])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,o]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},l=`[0-9](_?[0-9])*`,u=`(\\b(${l}))?\\.(${l})|\\b(${l})\\.`,d=`\\b|${r.join(`|`)}`,f={className:`number`,relevance:0,variants:[{begin:`(\\b(${l})|(${u}))[eE][+-]?(${l})[jJ]?(?=${d})`},{begin:`(${u})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${d})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${d})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${d})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${d})`},{begin:`\\b(${l})[jJ](?=${d})`}]},p={className:`comment`,begin:t.lookahead(/# type:/),end:/$/,keywords:i,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:`params`,variants:[{className:``,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,contains:[`self`,a,f,c,e.HASH_COMMENT_MODE]}]};return o.contains=[c,f,a],{name:`Python`,aliases:[`py`,`gyp`,`ipython`],unicodeRegex:!0,keywords:i,illegal:/(<\/|\?)|=>/,contains:[a,f,{scope:`variable.language`,match:/\bself\b/},{beginKeywords:`if`,relevance:0},{match:/\bor\b/,scope:`keyword`},c,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:`keyword`,3:`title.class`,6:`title.class.inherited`}},{className:`meta`,begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[f,m,c]}]}}t.exports=n})),xe=n(((e,t)=>{function n(e){return{aliases:[`pycon`],contains:[{className:`meta.prompt`,starts:{end:/ |$/,starts:{end:`$`,subLanguage:`python`}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}t.exports=n})),Se=n(((e,t)=>{function n(e){let t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,a=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:`R`,keywords:{$pattern:n,keyword:`function if in break next repeat else for while`,literal:`NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10`,built_in:`LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm`},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:`doctag`,match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:`doctag`,begin:`@param`,end:/$/,contains:[{scope:`variable`,variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:`doctag`,match:/@[a-zA-Z]+/},{scope:`keyword`,match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:`"`,end:`"`,relevance:0},{begin:`'`,end:`'`,relevance:0}]},{relevance:0,variants:[{scope:{1:`operator`,2:`number`},match:[i,r]},{scope:{1:`operator`,2:`number`},match:[/%[^%]*%/,r]},{scope:{1:`punctuation`,2:`number`},match:[a,r]},{scope:{2:`number`},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:`operator`},match:[n,/\s+/,/<-/,/\s+/]},{scope:`operator`,relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:`punctuation`,relevance:0,match:a},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}t.exports=n})),Ce=n(((e,t)=>{function n(e){let t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),a={scope:`title.function.invoke`,relevance:0,begin:t.concat(/\b/,/(?!(?:let|for|while|if|else|match)\b)/,i,t.lookahead(/\s*\(/))},o=`([ui](8|16|32|64|128|size)|f(16|32|64|128))?`,s=`abstract.as.async.await.become.box.break.const.continue.crate.do.dyn.else.enum.extern.false.final.fn.for.if.impl.in.let.loop.macro.match.mod.move.mut.override.priv.pub.raw.ref.return.self.Self.static.struct.super.trait.true.try.type.typeof.union.unsafe.unsized.use.virtual.where.while.yield`.split(`.`),c=[`true`,`false`,`Some`,`None`,`Ok`,`Err`],l=`drop .Copy.Send.Sized.Sync.Drop.Fn.FnMut.FnOnce.ToOwned.Clone.Debug.PartialEq.PartialOrd.Eq.Ord.AsRef.AsMut.Into.From.Default.Iterator.Extend.IntoIterator.DoubleEndedIterator.ExactSizeIterator.SliceConcatExt.ToString.assert!.assert_eq!.bitflags!.bytes!.cfg!.col!.concat!.concat_idents!.debug_assert!.debug_assert_eq!.env!.eprintln!.panic!.file!.format!.format_args!.include_bytes!.include_str!.line!.local_data_key!.module_path!.option_env!.print!.println!.select!.stringify!.try!.unimplemented!.unreachable!.vec!.write!.writeln!.macro_rules!.assert_ne!.debug_assert_ne!`.split(`.`),u=[`i8`,`i16`,`i32`,`i64`,`i128`,`isize`,`u8`,`u16`,`u32`,`u64`,`u128`,`usize`,`f16`,`f32`,`f64`,`f128`,`str`,`char`,`bool`,`Box`,`Option`,`Result`,`String`,`Vec`];return{name:`Rust`,aliases:[`rs`],keywords:{$pattern:e.IDENT_RE+`!?`,type:u,keyword:s,literal:c,built_in:l},illegal:`</`,contains:[e.C_LINE_COMMENT_MODE,e.COMMENT(`/\\*`,`\\*/`,{contains:[`self`]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{scope:`symbol`,begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:`string`,variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:`char.escape`,match:/\\('|"|\\|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{scope:`number`,variants:[{begin:`\\b0b([01_]+)`+o},{begin:`\\b0o([0-7_]+)`+o},{begin:`\\b0x([A-Fa-f0-9_]+)`+o},{begin:`\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)`+o}],relevance:0},{begin:[/\bsafe/,/\s+/,/extern/],scope:{1:`keyword`,3:`keyword`}},{begin:[/fn/,/\s+/,r],scope:{1:`keyword`,3:`title.function`}},{scope:`meta`,begin:`#!?\\[`,end:`\\]`,contains:[{scope:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],scope:{1:`keyword`,3:`keyword`,4:`variable`}},{begin:[/for/,/\s+/,r,/\s+/,/in/],scope:{1:`keyword`,3:`variable`,5:`keyword`}},{begin:[/type/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}},{begin:e.IDENT_RE+`::`,keywords:{keyword:`Self`,built_in:l,type:u}},{scope:`punctuation`,begin:`->`},a]}}t.exports=n})),we=n(((e,t)=>{var n=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},UNICODE_RANGE:{scope:`number`,begin:/\b[Uu]\+[0-9A-Fa-f][0-9A-Fa-f?]{0,5}(-[0-9A-Fa-f][0-9A-Fa-f]{0,5})?/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),r=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),i=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),a=[...r,...i],o=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),s=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),c=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),l=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.corner-bottom-left-shape.corner-bottom-right-shape.corner-shape.corner-top-left-shape.corner-top-right-shape.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.unicode-range.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse();function u(e){let t=n(e),r=c,i=s,u=`@[a-z-]+`,d={className:`variable`,begin:`(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b`,relevance:0};return{name:`SCSS`,case_insensitive:!0,illegal:`[=/|']`,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:`selector-id`,begin:`#[A-Za-z0-9_-]+`,relevance:0},{className:`selector-class`,begin:`\\.[A-Za-z0-9_-]+`,relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:`selector-tag`,begin:`\\b(`+a.join(`|`)+`)\\b`,relevance:0},{className:`selector-pseudo`,begin:`:(`+i.join(`|`)+`)`},{className:`selector-pseudo`,begin:`:(:)?(`+r.join(`|`)+`)`},d,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+l.join(`|`)+`)\\b`},{begin:`\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b`},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,d,t.HEXCOLOR,t.CSS_NUMBER_MODE,t.UNICODE_RANGE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:`@(page|font-face)`,keywords:{$pattern:u,keyword:`@page @font-face`}},{begin:`@`,end:`[{;]`,returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:o.join(` `)},contains:[{begin:u,className:`keyword`},{begin:/[a-z-]+(?=:)/,className:`attribute`},d,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}t.exports=u})),Te=n(((e,t)=>{function n(e){return{name:`Shell Session`,aliases:[`console`,`shellsession`],contains:[{className:`meta.prompt`,begin:/^\s{0,3}[./~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:`bash`}}]}}t.exports=n})),Ee=n(((e,t)=>{function n(e){let t=e.regex,n=e.COMMENT(`--`,`$`),r={scope:`string`,variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},a=[`true`,`false`,`unknown`],o=[`double precision`,`large object`,`with timezone`,`without timezone`],s=`bigint.binary.blob.boolean.char.character.clob.date.dec.decfloat.decimal.float.int.integer.interval.nchar.nclob.national.numeric.real.row.smallint.time.timestamp.varchar.varying.varbinary`.split(`.`),c=[`add`,`asc`,`collation`,`desc`,`final`,`first`,`last`,`view`],l=`abs.acos.all.allocate.alter.and.any.are.array.array_agg.array_max_cardinality.as.asensitive.asin.asymmetric.at.atan.atomic.authorization.avg.begin.begin_frame.begin_partition.between.bigint.binary.blob.boolean.both.by.call.called.cardinality.cascaded.case.cast.ceil.ceiling.char.char_length.character.character_length.check.classifier.clob.close.coalesce.collate.collect.column.commit.condition.connect.constraint.contains.convert.copy.corr.corresponding.cos.cosh.count.covar_pop.covar_samp.create.cross.cube.cume_dist.current.current_catalog.current_date.current_default_transform_group.current_path.current_role.current_row.current_schema.current_time.current_timestamp.current_path.current_role.current_transform_group_for_type.current_user.cursor.cycle.date.day.deallocate.dec.decimal.decfloat.declare.default.define.delete.dense_rank.deref.describe.deterministic.disconnect.distinct.double.drop.dynamic.each.element.else.empty.end.end_frame.end_partition.end-exec.equals.escape.every.except.exec.execute.exists.exp.external.extract.false.fetch.filter.first_value.float.floor.for.foreign.frame_row.free.from.full.function.fusion.get.global.grant.group.grouping.groups.having.hold.hour.identity.in.indicator.initial.inner.inout.insensitive.insert.int.integer.intersect.intersection.interval.into.is.join.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.language.large.last_value.lateral.lead.leading.left.like.like_regex.listagg.ln.local.localtime.localtimestamp.log.log10.lower.match.match_number.match_recognize.matches.max.member.merge.method.min.minute.mod.modifies.module.month.multiset.national.natural.nchar.nclob.new.no.none.normalize.not.nth_value.ntile.null.nullif.numeric.octet_length.occurrences_regex.of.offset.old.omit.on.one.only.open.or.order.out.outer.over.overlaps.overlay.parameter.partition.pattern.per.percent.percent_rank.percentile_cont.percentile_disc.period.portion.position.position_regex.power.precedes.precision.prepare.primary.procedure.ptf.range.rank.reads.real.recursive.ref.references.referencing.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.release.result.return.returns.revoke.right.rollback.rollup.row.row_number.rows.running.savepoint.scope.scroll.search.second.seek.select.sensitive.session_user.set.show.similar.sin.sinh.skip.smallint.some.specific.specifictype.sql.sqlexception.sqlstate.sqlwarning.sqrt.start.static.stddev_pop.stddev_samp.submultiset.subset.substring.substring_regex.succeeds.sum.symmetric.system.system_time.system_user.table.tablesample.tan.tanh.then.time.timestamp.timezone_hour.timezone_minute.to.trailing.translate.translate_regex.translation.treat.trigger.trim.trim_array.true.truncate.uescape.union.unique.unknown.unnest.update.upper.user.using.value.values.value_of.var_pop.var_samp.varbinary.varchar.varying.versioning.when.whenever.where.width_bucket.window.with.within.without.year`.split(`.`),u=`abs.acos.array_agg.asin.atan.avg.cast.ceil.ceiling.coalesce.corr.cos.cosh.count.covar_pop.covar_samp.cume_dist.dense_rank.deref.element.exp.extract.first_value.floor.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.last_value.lead.listagg.ln.log.log10.lower.max.min.mod.nth_value.ntile.nullif.percent_rank.percentile_cont.percentile_disc.position.position_regex.power.rank.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.row_number.sin.sinh.sqrt.stddev_pop.stddev_samp.substring.substring_regex.sum.tan.tanh.translate.translate_regex.treat.trim.trim_array.unnest.upper.value_of.var_pop.var_samp.width_bucket`.split(`.`),d=[`current_catalog`,`current_date`,`current_default_transform_group`,`current_path`,`current_role`,`current_schema`,`current_transform_group_for_type`,`current_user`,`session_user`,`system_time`,`system_user`,`current_time`,`localtime`,`current_timestamp`,`localtimestamp`],f=[`create table`,`insert into`,`primary key`,`foreign key`,`not null`,`alter table`,`add constraint`,`grouping sets`,`on overflow`,`character set`,`respect nulls`,`ignore nulls`,`nulls first`,`nulls last`,`depth first`,`breadth first`],p=u,m=[...l,...c].filter(e=>!u.includes(e)),h={scope:`variable`,match:/@[a-z0-9][a-z0-9_]*/},g={scope:`operator`,match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},_={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function v(e){return t.concat(/\b/,t.either(...e.map(e=>e.replace(/\s+/,`\\s+`))),/\b/)}let y={scope:`keyword`,match:v(f),relevance:0};function b(e,{exceptions:t,when:n}={}){let r=n;return t||=[],e.map(e=>e.match(/\|\d+$/)||t.includes(e)?e:r(e)?`${e}|0`:e)}return{name:`SQL`,case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:b(m,{when:e=>e.length<3}),literal:a,type:s,built_in:d},contains:[{scope:`type`,match:v(o)},y,_,h,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,g]}}t.exports=n})),De=n(((e,t)=>{function n(e){return e?typeof e==`string`?e:e.source:null}function r(e){return i(`(?=`,e,`)`)}function i(...e){return e.map(e=>n(e)).join(``)}function a(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function o(...e){return`(`+(a(e).capture?``:`?:`)+e.map(e=>n(e)).join(`|`)+`)`}new RegExp(o(/\[(?:[^\\\]]|\\.)*\]/,/\(\?<(?![=!])[^>]+>/,/\(\?'[^']+'/,/\(\??/,/\\([1-9][0-9]*)/,/\\./));var s=e=>i(/\b/,e,/\w$/.test(e)?/\b/:/\B/),c=[`Protocol`,`Type`].map(s),l=[`init`,`self`].map(s),u=[`Any`,`Self`],d=[`actor`,`any`,`associatedtype`,`async`,`await`,/as\?/,/as!/,`as`,`borrowing`,`break`,`case`,`catch`,`class`,`consume`,`consuming`,`continue`,`convenience`,`copy`,`default`,`defer`,`deinit`,`didSet`,`distributed`,`do`,`dynamic`,`each`,`else`,`enum`,`extension`,`fallthrough`,/fileprivate\(set\)/,`fileprivate`,`final`,`for`,`func`,`get`,`guard`,`if`,`import`,`indirect`,`infix`,/init\?/,/init!/,`inout`,/internal\(set\)/,`internal`,`in`,`is`,`isolated`,`nonisolated`,`lazy`,`let`,`macro`,`mutating`,`nonmutating`,/open\(set\)/,`open`,`operator`,`optional`,`override`,`package`,`postfix`,`precedencegroup`,`prefix`,/private\(set\)/,`private`,`protocol`,/public\(set\)/,`public`,`repeat`,`required`,`rethrows`,`return`,`set`,`some`,`static`,`struct`,`subscript`,`super`,`switch`,`throws`,`throw`,/try\?/,/try!/,`try`,`typealias`,/unowned\(safe\)/,/unowned\(unsafe\)/,`unowned`,`var`,`weak`,`where`,`while`,`willSet`],f=[`false`,`nil`,`true`],p=[`assignment`,`associativity`,`higherThan`,`left`,`lowerThan`,`none`,`right`],m=[`#colorLiteral`,`#column`,`#dsohandle`,`#else`,`#elseif`,`#endif`,`#error`,`#file`,`#fileID`,`#fileLiteral`,`#filePath`,`#function`,`#if`,`#imageLiteral`,`#keyPath`,`#line`,`#selector`,`#sourceLocation`,`#warning`],h=`abs.all.any.assert.assertionFailure.debugPrint.dump.fatalError.getVaList.isKnownUniquelyReferenced.max.min.numericCast.pointwiseMax.pointwiseMin.precondition.preconditionFailure.print.readLine.repeatElement.sequence.stride.swap.swift_unboxFromSwiftValueWithType.transcode.type.unsafeBitCast.unsafeDowncast.withExtendedLifetime.withUnsafeMutablePointer.withUnsafePointer.withVaList.withoutActuallyEscaping.zip`.split(`.`),g=o(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),_=o(g,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),v=i(g,_,`*`),y=o(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),b=o(y,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),x=i(y,b,`*`),S=i(/[A-Z]/,b,`*`),C=[`attached`,`autoclosure`,i(/convention\(/,o(`swift`,`block`,`c`),/\)/),`discardableResult`,`dynamicCallable`,`dynamicMemberLookup`,`escaping`,`freestanding`,`frozen`,`GKInspectable`,`IBAction`,`IBDesignable`,`IBInspectable`,`IBOutlet`,`IBSegueAction`,`inlinable`,`main`,`nonobjc`,`NSApplicationMain`,`NSCopying`,`NSManaged`,i(/objc\(/,x,/\)/),`objc`,`objcMembers`,`propertyWrapper`,`requires_stored_property_inits`,`resultBuilder`,`Sendable`,`testable`,`UIApplicationMain`,`unchecked`,`unknown`,`usableFromInline`,`warn_unqualified_access`],w=[`iOS`,`iOSApplicationExtension`,`macOS`,`macOSApplicationExtension`,`macCatalyst`,`macCatalystApplicationExtension`,`watchOS`,`watchOSApplicationExtension`,`tvOS`,`tvOSApplicationExtension`,`swift`];function T(e){let t={match:/\s+/,relevance:0},n=e.COMMENT(`/\\*`,`\\*/`,{contains:[`self`]}),a=[e.C_LINE_COMMENT_MODE,n],g={match:[/\./,o(...c,...l)],className:{2:`keyword`}},y={match:i(/\./,o(...d)),relevance:0},T=d.filter(e=>typeof e==`string`).concat([`_|0`]),E={variants:[{className:`keyword`,match:o(...d.filter(e=>typeof e!=`string`).concat(u).map(s),...l)}]},D={$pattern:o(/\b\w+/,/#\w+/),keyword:T.concat(m),literal:f},O=[g,y,E],k=[{match:i(/\./,o(...h)),relevance:0},{className:`built_in`,match:i(/\b/,o(...h),/(?=\()/)}],A={match:/->/,relevance:0},j=[A,{className:`operator`,relevance:0,variants:[{match:v},{match:`\\.(\\.|${_})+`}]}],M=`([0-9]_*)+`,N=`([0-9a-fA-F]_*)+`,P={className:`number`,relevance:0,variants:[{match:`\\b(${M})(\\.(${M}))?([eE][+-]?(${M}))?\\b`},{match:`\\b0x(${N})(\\.(${N}))?([pP][+-]?(${M}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},F=(e=``)=>({className:`subst`,variants:[{match:i(/\\/,e,/[0\\tnr"']/)},{match:i(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),I=(e=``)=>({className:`subst`,match:i(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}),L=(e=``)=>({className:`subst`,label:`interpol`,begin:i(/\\/,e,/\(/),end:/\)/}),R=(e=``)=>({begin:i(e,/"""/),end:i(/"""/,e),contains:[F(e),I(e),L(e)]}),z=(e=``)=>({begin:i(e,/"/),end:i(/"/,e),contains:[F(e),L(e)]}),B={className:`string`,variants:[R(),R(`#`),R(`##`),R(`###`),z(),z(`#`),z(`##`),z(`###`)]},V=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],H={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:V},U=e=>{let t=i(e,/\//),n=i(/\//,e);return{begin:t,end:n,contains:[...V,{scope:`comment`,begin:`#(?!.*${n})`,end:/$/}]}},ee={scope:`regexp`,variants:[U(`###`),U(`##`),U(`#`),H]},te={match:i(/`/,x,/`/)},W=[te,{className:`variable`,match:/\$\d+/},{className:`variable`,match:`\\$${b}+`}],ne=[{match:/(@|#(un)?)available/,scope:`keyword`,starts:{contains:[{begin:/\(/,end:/\)/,keywords:w,contains:[...j,P,B]}]}},{scope:`keyword`,match:i(/@/,o(...C),r(o(/\(/,/\s+/)))},{scope:`meta`,match:i(/@/,x)}],G={match:r(/\b[A-Z]/),relevance:0,contains:[{className:`type`,match:i(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,b,`+`)},{className:`type`,match:S,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:i(/\s+&\s+/,r(S)),relevance:0}]},re={begin:/</,end:/>/,keywords:D,contains:[...a,...O,...ne,A,G]};G.contains.push(re);let K={begin:/\(/,end:/\)/,relevance:0,keywords:D,contains:[`self`,{match:i(x,/\s*:/),keywords:`_|0`,relevance:0},...a,ee,...O,...k,...j,P,B,...W,...ne,G]},ie={begin:/</,end:/>/,keywords:`repeat each`,contains:[...a,G]},q={begin:/\(/,end:/\)/,keywords:D,contains:[{begin:o(r(i(x,/\s*:/)),r(i(x,/\s+/,x,/\s*:/))),end:/:/,relevance:0,contains:[{className:`keyword`,match:/\b_\b/},{className:`params`,match:x}]},...a,...O,...j,P,B,...ne,G,K],endsParent:!0,illegal:/["']/},ae={match:[/(func|macro)/,/\s+/,o(te.match,x,v)],className:{1:`keyword`,3:`title.function`},contains:[ie,q,t],illegal:[/\[/,/%/]},oe={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:`keyword`},contains:[ie,q,t],illegal:/\[|%/},se={match:[/operator/,/\s+/,v],className:{1:`keyword`,3:`title`}},ce={begin:[/precedencegroup/,/\s+/,S],className:{1:`keyword`,3:`title`},contains:[G],keywords:[...p,...f],end:/}/},le={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:`keyword`,3:`keyword`,5:`title.function`}},ue={match:[/class\b/,/\s+/,/var\b/],scope:{1:`keyword`,3:`keyword`}},de={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,x,/\s*/],beginScope:{1:`keyword`,3:`title.class`},keywords:D,contains:[ie,...O,{begin:/:/,end:/\{/,keywords:D,contains:[{scope:`title.class.inherited`,match:S},...O],relevance:0}]};for(let e of B.variants){let t=e.contains.find(e=>e.label===`interpol`);t.keywords=D;let n=[...O,...k,...j,P,B,...W];t.contains=[...n,{begin:/\(/,end:/\)/,contains:[`self`,...n]}]}return{name:`Swift`,keywords:D,contains:[...a,ae,oe,le,ue,de,se,ce,{beginKeywords:`import`,end:/$/,contains:[...a],relevance:0},ee,...O,...k,...j,P,B,...W,...ne,G,K]}}t.exports=T})),Oe=n(((e,t)=>{function n(e){let t=`true false yes no null`,n=`[\\w#;/?:@&=+$,.~*'()[\\]]+`,r={className:`attr`,variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:`template-variable`,variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},a={className:`string`,relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:`char.escape`,relevance:0}]},o={className:`string`,relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},s=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),c={className:`number`,begin:`\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b`},l={end:`,`,endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},u={begin:/\{/,end:/\}/,contains:[l],illegal:`\\n`,relevance:0},d={begin:`\\[`,end:`\\]`,contains:[l],illegal:`\\n`,relevance:0},f=[r,{className:`meta`,begin:`^---\\s*$`,relevance:10},{className:`string`,begin:`[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*`},{begin:`<%[%=-]?`,end:`[%-]?%>`,subLanguage:`ruby`,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:`!\\w+!`+n},{className:`type`,begin:`!<`+n+`>`},{className:`type`,begin:`!`+n},{className:`type`,begin:`!!`+n},{className:`meta`,begin:`&`+e.UNDERSCORE_IDENT_RE+`$`},{className:`meta`,begin:`\\*`+e.UNDERSCORE_IDENT_RE+`$`},{className:`bullet`,begin:`-(?=[ ]|$)`,relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},c,{className:`number`,begin:e.C_NUMBER_RE+`\\b`,relevance:0},u,d,a,o],p=[...f];return p.pop(),p.push(s),l.contains=p,{name:`YAML`,case_insensitive:!0,aliases:[`yml`],contains:f}}t.exports=n})),ke=n(((e,t)=>{var n=`[A-Za-z$_][0-9A-Za-z$_]*`,r=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),i=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],a=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),o=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],s=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],c=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`self`,`global`],l=[].concat(s,a,o);function u(e){let t=e.regex,u=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},d=n,f={begin:`<>`,end:`</>`},p=/<[A-Za-z0-9\\._:-]+\s*\/>/,m={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let n=e[0].length+e.index,r=e.input[n];if(r===`<`||r===`,`){t.ignoreMatch();return}r===`>`&&(u(e,{after:n})||t.ignoreMatch());let i,a=e.input.substring(n);((i=a.match(/^\s*=/))||(i=a.match(/^\s+extends\s+/))&&i.index===0)&&t.ignoreMatch()}},h={$pattern:n,keyword:r,literal:i,built_in:l,"variable.language":c},g=`[0-9](_?[0-9])*`,_=`\\.(${g})`,v=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,y={className:`number`,variants:[{begin:`(\\b(${v})((${_})|\\.)?|(${_}))[eE][+-]?(${g})\\b`},{begin:`\\b(${v})\\b((${_})\\b|\\.)?|(${_})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},b={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:h,contains:[]},x={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:`xml`}},S={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:`css`}},C={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:`graphql`}},w={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,b]},T={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:d+`(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},E=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,S,C,w,{match:/\$\d+/},y];b.contains=E.concat({begin:/\{/,end:/\}/,keywords:h,contains:[`self`].concat(E)});let D=[].concat(T,b.contains),O=D.concat([{begin:/(\s*)\(/,end:/\)/,keywords:h,contains:[`self`].concat(D)}]),k={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:O},A={variants:[{match:[/class/,/\s+/,d,/\s+/,/extends/,/\s+/,t.concat(d,`(`,t.concat(/\./,d),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,d],scope:{1:`keyword`,3:`title.class`}}]},j={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...a,...o]}},M={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},N={variants:[{match:[/function/,/\s+/,d,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[k],illegal:/%/},P={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function F(e){return t.concat(`(?!`,e.join(`|`),`)`)}let I={match:t.concat(/\b/,F([...s,`super`,`import`,`await`].map(e=>`${e}\\s*\\(`)),d,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},L={begin:t.concat(/\./,t.lookahead(t.concat(d,/(?![0-9A-Za-z$_(])/))),end:d,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},R={match:[/get|set/,/\s+/,d,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},k]},z=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,B={match:[/const|var|let/,/\s+/,d,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(z)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[k]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:h,exports:{PARAMS_CONTAINS:O,CLASS_REFERENCE:j},illegal:/#(?![$_A-Za-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),M,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,x,S,C,w,T,{match:/\$\d+/},y,j,{scope:`attr`,match:d+t.lookahead(`:`),relevance:0},B,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[T,e.REGEXP_MODE,{className:`function`,begin:z,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:O}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:f.begin,end:f.end},{match:p},{begin:m.begin,"on:begin":m.isTrulyOpeningTag,end:m.end}],subLanguage:`xml`,contains:[{begin:m.begin,end:m.end,skip:!0,contains:[`self`]}]}]},N,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[k,e.inherit(e.TITLE_MODE,{begin:d,className:`title.function`})]},{match:/\.\.\./,relevance:0},L,{match:`\\$`+d,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[k]},I,P,A,R,{match:/\$[(.]/}]}}function d(e){let t=e.regex,a=u(e),o=n,s=[`any`,`void`,`number`,`boolean`,`string`,`object`,`never`,`symbol`,`bigint`,`unknown`],d={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:`keyword`,3:`title.class`}},f={beginKeywords:`interface`,end:/\{/,excludeEnd:!0,keywords:{keyword:`interface extends`,built_in:s},contains:[a.exports.CLASS_REFERENCE]},p={className:`meta`,relevance:10,begin:/^\s*['"]use strict['"]/},m={$pattern:n,keyword:r.concat([`type`,`interface`,`public`,`private`,`protected`,`implements`,`declare`,`abstract`,`readonly`,`enum`,`override`,`satisfies`]),literal:i,built_in:l.concat(s),"variable.language":c},h={className:`meta`,begin:`@`+o},g=(e,t,n)=>{let r=e.contains.findIndex(e=>e.label===t);if(r===-1)throw Error(`can not find mode to replace`);e.contains.splice(r,1,n)};Object.assign(a.keywords,m),a.exports.PARAMS_CONTAINS.push(h);let _=a.contains.find(e=>e.scope===`attr`),v=Object.assign({},_,{match:t.concat(o,t.lookahead(/\s*\?:/))});a.exports.PARAMS_CONTAINS.push([a.exports.CLASS_REFERENCE,_,v]),a.contains=a.contains.concat([h,d,f,v]),g(a,`shebang`,e.SHEBANG()),g(a,`use_strict`,p);let y=a.contains.find(e=>e.label===`func.def`);return y.relevance=0,Object.assign(a,{name:`TypeScript`,aliases:[`ts`,`tsx`,`mts`,`cts`]}),a}t.exports=d})),Ae=n(((e,t)=>{function n(e){let t=e.regex,n={className:`string`,begin:/"(""|[^/n])"C\b/},r={className:`string`,begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,a=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,s=/\d{1,2}(:\d{1,2}){1,2}/,c={className:`literal`,variants:[{begin:t.concat(/# */,t.either(a,i),/ *#/)},{begin:t.concat(/# */,s,/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,t.either(a,i),/ +/,t.either(o,s),/ *#/)}]},l={className:`number`,relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:`label`,begin:/^\w+:/},d=e.COMMENT(/'''/,/$/,{contains:[{className:`doctag`,begin:/<\/?/,end:/>/}]}),f=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:`Visual Basic .NET`,aliases:[`vb`],case_insensitive:!0,classNameAliases:{label:`symbol`},keywords:{keyword:`addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield`,built_in:`addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort`,type:`boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort`,literal:`true false nothing`},illegal:`//|\\{|\\}|endif|gosub|variant|wend|^\\$ `,contains:[n,r,c,l,u,d,f,{className:`meta`,begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:`const disable else elseif enable end externalsource if region then`},contains:[f]}]}}t.exports=n})),je=n(((e,t)=>{function n(e){e.regex;let t=e.COMMENT(/\(;/,/;\)/);return t.contains.push(`self`),{name:`WebAssembly`,keywords:{$pattern:/[\w.]+/,keyword:`anyfunc,block,br,br_if,br_table,call,call_indirect,data,drop,elem,else,end,export,func,global.get,global.set,local.get,local.set,local.tee,get_global,get_local,global,if,import,local,loop,memory,memory.grow,memory.size,module,mut,nop,offset,param,result,return,select,set_global,set_local,start,table,tee_local,then,type,unreachable`.split(`,`)},contains:[e.COMMENT(/;;/,/$/),t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:`keyword`,3:`operator`}},{className:`variable`,begin:/\$[\w_]+/},{match:/(\((?!;)|\))+/,className:`punctuation`,relevance:0},{begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:`keyword`,3:`title.function`}},e.QUOTE_STRING_MODE,{match:/(i32|i64|f32|f64)(?!\.)/,className:`type`},{className:`keyword`,match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/},{className:`number`,relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/}]}}t.exports=n})),Me=t(n(((e,t)=>{var n=U();n.registerLanguage(`xml`,ee()),n.registerLanguage(`bash`,te()),n.registerLanguage(`c`,W()),n.registerLanguage(`cpp`,ne()),n.registerLanguage(`csharp`,G()),n.registerLanguage(`css`,re()),n.registerLanguage(`markdown`,K()),n.registerLanguage(`diff`,ie()),n.registerLanguage(`ruby`,q()),n.registerLanguage(`go`,ae()),n.registerLanguage(`graphql`,oe()),n.registerLanguage(`ini`,se()),n.registerLanguage(`java`,ce()),n.registerLanguage(`javascript`,le()),n.registerLanguage(`json`,ue()),n.registerLanguage(`kotlin`,de()),n.registerLanguage(`less`,fe()),n.registerLanguage(`lua`,pe()),n.registerLanguage(`makefile`,me()),n.registerLanguage(`perl`,he()),n.registerLanguage(`objectivec`,ge()),n.registerLanguage(`php`,_e()),n.registerLanguage(`php-template`,ve()),n.registerLanguage(`plaintext`,ye()),n.registerLanguage(`python`,be()),n.registerLanguage(`python-repl`,xe()),n.registerLanguage(`r`,Se()),n.registerLanguage(`rust`,Ce()),n.registerLanguage(`scss`,we()),n.registerLanguage(`shell`,Te()),n.registerLanguage(`sql`,Ee()),n.registerLanguage(`swift`,De()),n.registerLanguage(`yaml`,Oe()),n.registerLanguage(`typescript`,ke()),n.registerLanguage(`vbnet`,Ae()),n.registerLanguage(`wasm`,je()),n.HighlightJS=n,n.default=n,t.exports=n}))()).default,Ne={};function Pe(e){let t=Ne[e];if(t)return t;t=Ne[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);t.push(n)}for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[r]=`%`+(`0`+r.toString(16).toUpperCase()).slice(-2)}return t}function Fe(e,t){typeof t!=`string`&&(t=Fe.defaultChars);let n=Pe(t);return e.replace(/(%[a-f0-9]{2})+/gi,function(e){let t=``;for(let r=0,i=e.length;r<i;r+=3){let a=parseInt(e.slice(r+1,r+3),16);if(a<128)t+=n[a];else{if((a&224)==192&&r+3<i){let n=parseInt(e.slice(r+4,r+6),16);if((n&192)==128){let e=a<<6&1984|n&63;t+=e<128?`��`:String.fromCharCode(e),r+=3;continue}}if((a&240)==224&&r+6<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16);if((n&192)==128&&(i&192)==128){let e=a<<12&61440|n<<6&4032|i&63;t+=e<2048||e>=55296&&e<=57343?`���`:String.fromCharCode(e),r+=6;continue}}if((a&248)==240&&r+9<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16),o=parseInt(e.slice(r+10,r+12),16);if((n&192)==128&&(i&192)==128&&(o&192)==128){let e=a<<18&1835008|n<<12&258048|i<<6&4032|o&63;e<65536||e>1114111?t+=`����`:(e-=65536,t+=String.fromCharCode(55296+(e>>10),56320+(e&1023))),r+=9;continue}}t+=`�`}}return t})}Fe.defaultChars=`;/?:@&=+$,#`,Fe.componentChars=``;var Ie={};function Le(e){let t=Ie[e];if(t)return t;t=Ie[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);/^[0-9a-z]$/i.test(n)?t.push(n):t.push(`%`+(`0`+e.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<e.length;n++)t[e.charCodeAt(n)]=e[n];return t}function Re(e,t,n){typeof t!=`string`&&(n=t,t=Re.defaultChars),n===void 0&&(n=!0);let r=Le(t),i=``;for(let t=0,a=e.length;t<a;t++){let o=e.charCodeAt(t);if(n&&o===37&&t+2<a&&/^[0-9a-f]{2}$/i.test(e.slice(t+1,t+3)))i+=e.slice(t,t+3),t+=2;else if(o<128)i+=r[o];else if(o>=55296&&o<=57343){if(o>=55296&&o<=56319&&t+1<a){let n=e.charCodeAt(t+1);if(n>=56320&&n<=57343){i+=encodeURIComponent(e[t]+e[t+1]),t++;continue}}i+=`%EF%BF%BD`}else i+=encodeURIComponent(e[t])}return i}Re.defaultChars=`;/?:@&=+$,-_.!~*'()#`,Re.componentChars=`-_.!~*'()`;function ze(e){let t=``;return t+=e.protocol||``,t+=e.slashes?`//`:``,t+=e.auth?e.auth+`@`:``,e.hostname&&e.hostname.indexOf(`:`)!==-1?t+=`[`+e.hostname+`]`:t+=e.hostname||``,t+=e.port?`:`+e.port:``,t+=e.pathname||``,t+=e.search||``,t+=e.hash||``,t}function Be(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var Ve=/^([a-z0-9.+-]+:)/i,He=/:[0-9]*$/,Ue=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,We=[`%`,`/`,`?`,`;`,`#`,`'`,`{`,`}`,`|`,`\\`,`^`,"`",`<`,`>`,`"`,"`",` `,`\r`,`
|
|
6
|
+
`,` `],Ge=[`/`,`?`,`#`],Ke=255,qe=/^[+a-z0-9A-Z_-]{0,63}$/,Je=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Ye={javascript:!0,"javascript:":!0},Xe={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Ze(e,t){if(e&&e instanceof Be)return e;let n=new Be;return n.parse(e,t),n}Be.prototype.parse=function(e,t){let n,r,i,a=e;if(a=a.trim(),!t&&e.split(`#`).length===1){let e=Ue.exec(a);if(e)return this.pathname=e[1],e[2]&&(this.search=e[2]),this}let o=Ve.exec(a);if(o&&(o=o[0],n=o.toLowerCase(),this.protocol=o,a=a.substr(o.length)),(t||o||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=a.substr(0,2)===`//`,i&&!(o&&Ye[o])&&(a=a.substr(2),this.slashes=!0)),!Ye[o]&&(i||o&&!Xe[o])){let e=-1;for(let t=0;t<Ge.length;t++)r=a.indexOf(Ge[t]),r!==-1&&(e===-1||r<e)&&(e=r);let t,n;n=e===-1?a.lastIndexOf(`@`):a.lastIndexOf(`@`,e),n!==-1&&(t=a.slice(0,n),a=a.slice(n+1),this.auth=t),e=-1;for(let t=0;t<We.length;t++)r=a.indexOf(We[t]),r!==-1&&(e===-1||r<e)&&(e=r);e===-1&&(e=a.length),a[e-1]===`:`&&e--;let i=a.slice(0,e);a=a.slice(e),this.parseHost(i),this.hostname=this.hostname||``;let o=this.hostname[0]===`[`&&this.hostname[this.hostname.length-1]===`]`;if(!o){let e=this.hostname.split(/\./);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n&&!n.match(qe)){let r=``;for(let e=0,t=n.length;e<t;e++)n.charCodeAt(e)>127?r+=`x`:r+=n[e];if(!r.match(qe)){let r=e.slice(0,t),i=e.slice(t+1),o=n.match(Je);o&&(r.push(o[1]),i.unshift(o[2])),i.length&&(a=i.join(`.`)+a),this.hostname=r.join(`.`);break}}}}this.hostname.length>Ke&&(this.hostname=``),o&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let s=a.indexOf(`#`);s!==-1&&(this.hash=a.substr(s),a=a.slice(0,s));let c=a.indexOf(`?`);return c!==-1&&(this.search=a.substr(c),a=a.slice(0,c)),a&&(this.pathname=a),Xe[n]&&this.hostname&&!this.pathname&&(this.pathname=``),this},Be.prototype.parseHost=function(e){let t=He.exec(e);t&&(t=t[0],t!==`:`&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var Qe=e({decode:()=>Fe,encode:()=>Re,format:()=>ze,parse:()=>Ze}),$e=e({Any:()=>et,Cc:()=>tt,Cf:()=>nt,P:()=>rt,S:()=>it,Z:()=>at}),et=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,tt=/[\0-\x1F\x7F-\x9F]/,nt=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,rt=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B4E\u1B4F\u1B5A-\u1B60\u1B7D-\u1B7F\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDD6E\uDEAD\uDED0\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9\uDFD4\uDFD5\uDFD7\uDFD8]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09\uDFE1]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDD6D-\uDD6F\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD839\uDDFF|\uD83A[\uDD5E\uDD5F]/,it=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C1\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2429\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E5\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD803[\uDD8E\uDD8F\uDED1-\uDED8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDC00-\uDCEF\uDCFA-\uDCFC\uDD00-\uDEB3\uDEBA-\uDED0\uDEE0-\uDEF0\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED8\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0-\uDCBB\uDCC0\uDCC1\uDCD0-\uDCD8\uDD00-\uDE57\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF-\uDEF8\uDF00-\uDF92\uDF94-\uDFEF\uDFFA]/,at=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,ot=[8364,0,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,0,381,0,0,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,0,382,376];function st(e){return e===0||e>=55296&&e<=57343||e>1114111}function ct(e){return st(e)?65533:e>=128&&e<=159&&ot[e-128]||e}function lt(e){return e-1>>>0<127||e-160>>>0<55136?String.fromCharCode(e):String.fromCodePoint(ct(e))}var ut=(()=>{let e=new Uint8Array(127),t=0;for(let n=33;n<=126;n++)n!==34&&n!==36&&n!==92&&(e[n]=t++);return e})();function dt(e,t,n,r,i,a){let o=e.length,s=a*90,c=0,l=()=>{let t=ut[e.charCodeAt(c++)];return t<a?t:t*91-s+ut[e.charCodeAt(c++)]},u=n-r,d=n+i,f=new Int32Array(d);f.fill(-1,r,a),f.fill(-1,a+u,d);let p=new Int32Array(d),m=new Int32Array(d);function h(t,n){let r=0,i=n,a=n+t;for(;i<a;){let t=ut[e.charCodeAt(c++)];if(t<89)r+=t,f[i++]=r;else if(t===89){let t=ut[e.charCodeAt(c++)]+2;for(;t--;)f[i++]=++r}else{let t=ut[e.charCodeAt(c++)];r+=89+(t<90?t*91+ut[e.charCodeAt(c++)]:ut[e.charCodeAt(c++)]*8281+ut[e.charCodeAt(c++)]*91+ut[e.charCodeAt(c++)]),f[i++]=r}}}h(r,0),h(u,a);let g=new Int32Array(i*2),_=0,v=0;function y(e,t){for(let n=0;n<e;n++){let e=t+n,r=l(),i=l();g[v*2]=r,g[v*2+1]=i,v+=1,p[e]=_;let a=(f[r]<0?m[r]:1)+(f[i]<0?m[i]:1);m[e]=a,_+=a}}y(i-a+r,a+u),y(a-r,r);let b=new Uint16Array(_),x=0;for(let e=0;e<v;e++)for(let t=0;t<2;t++){let n=g[e*2+t],r=f[n];if(r<0){let e=p[n],t=e+m[n];for(;e<t;)b[x++]=b[e++]}else b[x++]=r}let S=new Uint16Array(t),C=0;for(;c<o;){let t=ut[e.charCodeAt(c++)];t>=a&&(t=t*91-s+ut[e.charCodeAt(c++)]);let n=f[t];if(n<0){let e=p[t],n=e+m[t];for(;e<n;)S[C++]=b[e++]}else S[C++]=n}return S}var ft=dt("!}.&u%}'&}*'~!6*)%&,~!J~!J~%L~y<~!R,~~%Lu~~#GD~~#|)1#%}^%}2%+#.##%##%}&%##%'#%##&%#%#'%#&#%#&#'#%%#&#%##%#)%''%&%#%#'%#%%#%%}%%%#%#&(23#%%#&-%0%('1#(##%#'##+%'*.:1}#%#6-+(%'%%#%%%}#L'2351&('%}&/N'(0(/*-%(%%}#'+&T%7.2}#&%&#%#36/5##%&%%#&#%%#))2%%##%&&'0~!#*+&'%1~!%).'3q?&%'1~!.##%6(~!+%%%(Gw'rT~!E#<nA%#jZ~!H%(~!42##~!*31&~!G%U~#)5~#`3~!J~!Z~%]~%Y~%C~!q~!u~#kz~%#~!6'~!D~!U~!?~#T~!c%~!G#'~%7|~!G~!J~!G&~#pb~(Df}#%}*&}#%##%##%##&#-}&'#'&%#.++}%mI,#,@&(}*%}*'%&##&#%##%}&0}#.},U},%}+%}&%}#%##&}B%(}(%}+%)})%##%#&}&%##%&}<%}>%#%&}*%}(%}9%}/%})%}*%}*%}?&}&%}3%}&*#%})%#%#)}#&#-#+*%E%%'%'#%}#*V##&##I}#&&##%&%#&&Qf%%))w/0+&%#(#.%-''''++++7}>%4'',##1,#%#&%##&#'##&#*#9)%&%}#*}%,#+P(%A&%#'&##wSD',9E00#y#@}(+}&%&>~!#~!X}#*}(&&}(&}(,%}%&#+&}#&}I%#%}%)#(},'%#*}4%%#%}(''}#/##(##),%-##%%)#&}(.}&%#&}%%}*&#%},&&}&%}#%*'#%})%}D&}&%}-&}6&#&}-,%}#%})-(~+`~,=?~I9'9%~!,#%})%})%}@%}?%}(~!?~#<~#pP~#BG~#=1#%K+~#?#~%;)~#A~#mF1~#A'~'X%'~#lR~#N~'N~#r~#m#-~#i'?%#'%~#B%##%,%#~#_%#0%~#]732~,w~2+#:&#%&'0%&>%}#>##F+)#%&&#(+_}4&}-%}(&}@&}O7Fdf0@+/v4}&WU##&/0#&'('B#%}.%}'+#%}#%%&#&%#%##+#&#)#6#'#.},%}c%},%#%##%&#&%#&~#>'*-.%##%##%}#%%}%'~#)D1}#%*&~#_%%'(~#S2%'.}#~#=##*'*-%}&'%'##&&~'E%.#&~#M4}%%##&'%#~#O1##%&#'+~#<B%##%%'%+~#;#@%}#&%#&&%#(~#H1}'%'##&&~#?A}&'~#D#%32}'&&&&~#[}'(#%}'~#;C})&}%%#%~#=&%,3}%'(#%%~#^'#&&)#%'~#Y%-~#d-%'~#^%%&#&&&}#~#b~2t*&'~&(~&@~0%~e~3}%*''0})&}+~!9##-}#%-hD*)1fC#%/&/fB#40~!+#)*4~!+~!K'&:~!/*7~!.#~!H~!L':~%x&~!H#~!*~%1~!I#~!+A~#p'~!F~~#-#~,,(~.Z~!V~%;'B'mq-W~!N~%I%#&&#&}#%},%%}'%}+X#%}#&}(%}'%}<%}#%}%%'}'%}:~![)9@~%>~#UA%-%##&~!C%~!-.9:~!1~!-^2/:a~!y,D*J#-5)/4~%23,~#G~!L1~!0X3`~!2+~!!0-~&E~!W~!o,>Y&]~%cZx_&~#O*9#A#'#+I'%#)~!0B*-5A+-((F&*M#)(-7-5+'-3a5Vi~!Y~!?+[)%3),ERHm~!+:D,VG.+)?fB%%*(%)'(#&80%1'8`K8?`+'Z#&O&'H5#*9)A%%5&3))0%39+.*7#()&&*=4@**L)<'_&*+..;(#*+)./&0#3)%')-8(4ixD(&.}%,('aI:,)%,k2231T)I'#/-W7,/'Q#.'Y24+h')37</31&83##&0#),H(?'&?/1##%#&&#%''-%&&&#(&''&#.-'%#%%(,')*'&#&#'##%(%(#%('#&##%%%%('%#%#%%#%#&%##h>w+v<ayvyvcg.uuhKr}g/v|g>u9i[~>g5uI~=RvdwEg;v/g;uk!!TTSx]@RT!U!#!@VBRUU!'UTe-d0c`e&gSdicedFcrdTaqb.kYcAohdYd@a3e+d}dMdtd.aJ#bqcK`dle/e.e'dwdPdodddjbEb}ogd^ofdpduc6j?l%d{drdqc)d7bacOdQ%T#Y)X.sR[yH>6Vyv3[xwLu>vo'!*.[yBacahoj>6Rew3[xqdZa#!a&#^(X-[yG>6Vyu3[xvg3sEr|g.u/Ri9db0T#^(Xa)!-[y;>6Vylg4wKs{JwNZt3@3r=c4Z([xlg;wKt!cpq's@v7A'*a(a+!-a#[y<3Dt?3Dt'>6Vym3[xmg9rxsNJwLZt4~?r?db1T#`-!(Xa,!0[yS>6Vz%NuQs.g4wKtnJwNZtS@3r>c4Z([y%g;wKtrdga8!a(!#&T*Y-Xa#!a0<or[yc3Dtq>6Vz43[y3JwNZtf@3s!Ju}!%Dti:pm3c_%X#tjB5pkd6q!r]u?voC'*-a.a2!0a&a+[yI3DtI3Ds~3DtH>6Vyw3[xx;:s#~<5pKJwNZtE@3r~d`a)!a2T#a.(!+U.X1[yT3Dt`3Dtv>6Vz&3[y&g9rxwzcxstPu.<rAJwLZtT~?r@dZa%!a.&^*Za(/Reu[ya>6Vz23[y1g3sEr}wkg{NuQRg{ci(U#5@b`~,cg#U(2WnH5wugcRh7dX#T(Y,a'Ta!!a,[yZ<]mj>6Vz,3[y+Pv#5ReZKu+=,%!H}7ABwkaS?Rh:BcW(X#<]mrj:ubv/ARekdg%!(!a.*Ta(Y.X1!#sP>Rl*Dt6[y>>6Vyo3Wf*jOvuumvuRgRJuq*!:9<B@bX~3jVv&v@s@5Re[d/rQt{uAvo&a&a*)a2!,0Wf!3Dt0=Bs'>6Re}3[xy~<5s%JwJZt1~Gs)c;&!#2sJkNuXvzq7rxu,Re8dka4!a8(aEZ+a@Y.X1Xa)[yd=Bs(3DtP>6Vz53[y4cX#X&Re:avRe9~<5s&JwJZtQ~Gs*i^rzvdRg+Jv{%!2sbB@bX}kdga,!Za?&^*T1/!a'Dt+[y6>6Vyf3Wf%g/u;s4hGu6?Rh-JvZ,!c%#&RoX54Rivj7uyvf8RgTKvZB%*!2sGh<vu5Rgq<=C::9bb~#dZ#T&Ta6Y.X*Dt>[y93Wf)coZ(T,6VyifluvRgC@95@B@bX~/hFu34cC#T,k/unq8w8Q5RkUklwQuzunq8w8Q5Rk8d/rJu?v8w9)-&!a0a;a&aIWejg3sEr/h1s<DtDJvyZqY5aws3Jvy!&Wei~Hr1:au5@Bag>23E~5c:Z&bX};kKv?w&unuVu5Rjc;>bs)#~@:Rh.=ay<a]C;b`}Vd6s/t{uAvoaxa()!a,a7%-a#a2Dt,[yF2Wo[>6Vyt3[xuNuPRi&NuPwpi#RoWh?vf8Ri%Jv]!%Ri:KvxD!.'2WeAjZu`q9rxu,Re7woeAg-unLq(qA_/*2Wg_g3u5q^9:4E}/jTrxrzv=Wkkd~0UX#^^Xa-a1a5T&a=U1a'*aEa]!a*aPaA-adok[y54Rn>;:p3~Dp5g9rpsFNvZqjg3uJp4~<5p0Pw;5qlJwNZt*@3p1Pw:5p/Ou!5p2JvG'!6Vye=<qnJvh_[xhg3v,Rh3kOwOw-sDuev/Re^dha[a%!%!a+#Ta7)-5TaCaO!aka!a)sf[yb2>Rl!9ARiq5E}Qg=ucRkBE|oJrJ_@Wk~@Wk{JrJ_@Wk|@WkyJrJ_@Wk}@WkzJvO_[y2g-vMRmiKuYC!)&>Ri;>Ri<@3RkNc](X#@9Rk=g5vuRmhKvDB!+'=]meg3u4Rmgd)#Y'Vz3CARmfd`a+!%T'!+#Ta1Ta6TaM-sTDt9[yA9sYd'%Y#s[[xpj:ueunaXRgEjRq,v-vuqdd2'`#6Rev<32@5>:2<E}5xIo9a*X#Y(;5RePJvD_g>vyRgNj8w)v8<wggs:RgXiZt|vjx,hSq3ah!-(~@:Ro/Ou!5RhWj^v(pyw8unRhUdx-UY#^Ua.a3a70!)%UX1TaDa)'omRiRRhE[y:3Dsz=Br,>6Vyj3[xkg6ruwjcqsrPw;5r*Ku]D'Zt-@3r(~?r.i[vwv]dU1a--U#`a4(g/vsRhPOu!5RhLj:rmu9Wo!~@:wdh@g/vsRiTjXuvvNr}:RhBj^v(pyw8unRn]dz1UYa'a+^Y(!aETZalaRY.Ta?a4[yDJw1!#qLsW>6Vyrfzq-pLflpwRe|Js>%!Dt@3Dt&Jvy_[xs~HrnjMuwpsw'RecKu+D#'!t<~Grl~?rjg5u-x,gwp{ah!-(~@:Rg~Ou!5Rh'jXuvvNr}:Rh#cW#X/c;&!#2sLi[v7u7RgpJv)(!iLrxu,Re6j7v@s@5Se[e7d`aW!Za(a`T.a#!a3!&aDa-!9)Dt_=6s+3[x~~DR|h~DS6avhGun5RkZj3w)v-]mkKunB!&*]kb97R|i<ARk<c:Z(6Vy}Juh'!wziMRoS:F|vkLuauJv5vtvQRh1d='T+Y#VyO~DR|jcF#T'7R|g97R|kJv3'!ay<Rj,Jvh&!:ReXcsa6*a+#a#_aIRf9aLRf?c,Z&Rf5Rf7c.Z&Rf;Rf>cQ#%T'p-Rf8Rf=ct#%'(*!,p,Rf4p+Rf6Rf:Rf<d~'Ua%U*^UYa(!a,-!#a4YaTalaEX0a8a<Weo3Dt/3Dsx=Br93Wen~Dr;~<5p<JwNZt2@3p=Pw:5p;Ou!5r3c7&!#:p>3Ds}KvGB)_6Vyk2sM=<r7x'eovA(!hFu1ARf}cV#X&@r5j6rvwQa^Rf3c=Za'wkghJv__g;unRggA53B9=b^}%j6uduo5Jq;!(hIv%2Re`Ou4ARe_e%a#^^^Xa&!a*a2!&a6YaP!*ad!#a:aE/5Rn?[y@>6Vyp;:pE~DrY~<5pBJwNZt8@3pCh=rt3rWPw:5pAJup_[xoNuPpF9c!#'45pD5ARn)d8#X'X*3@rU72s]h>v<<sSjJpqvewOJq/(!hNw'5ReBk0s2u3w/w'5ReE5@Jq.!a+JQ!&WeU23d(#Y&RjG5]jBk!u7w&u0udARjEe#+^^^Ub#!a2/a`Z(agT1!a-a;|@TaG!aS[yV=Re~fow'RguNuPRe?bz#'>RoUWeL>:Cbb|?JwPZtVg6ruRmzJvD'!6Vz(g/vmRh~Jvy_[y(g9voRgyx*cy(#2>Ri2B9b]~9kIw9u7rluJu3Rg]dI#a%UY'@=p%CAx.gQZ&RhwwygtRm{x5g_Z'+ABqR9Woa=Bp&dV#^*Xa'!&@o{g4v]Rk;Jv{!%Rk[wkkiA5RkiwwfUB=x,fUuqC&*!>RfTg8v0RfV~ARfSd;rJsAuAv9wR'ae+/aO!a@aza/a#[yQ@Wg!2Wemg3sEr0JvB_g>uvReWg2v+Re=KupB_+[y!2AbY~-~Hr2AJwD!(h<~El>h<~El?Kun@+_:9b`}Kg-v/Ri3g;vtwyk_9]k_d=&T#*U.6qh@Ab`|K9:H|CJv[!&3Dtex'fDwC%!Rf[9WlMd[(^X,!a%Z06Vz!@WgBg=v~Rgvg,QRe@awd,#Y+jTv|Q~EfWj]uNr|~FRfXdy#Y&^Ua%!aO.!(a)Ua;=!a@aKap!a-,a!Ta]a[rSa]p?[y82sK=Bq~;:p:~<5p8Pw:5p7d'#Y'Wf(;RnRi[u4w&RgJJvG'!6Vyh=<r#ijuuv/sIKuYD'ZtG@3p9~Gr&d2#`(g<vtRgFj`u5w&rqpxRf2CJuY!+:wfnTOu!5Rg}jNs1ucv&RfwJvA!&3@q|BDcC#T,k/unq8w8Q5RkTklwQuzunq8w8Q5Rk9dga#!a'!a=#a0!:+Tb*b@aO.a4!aba8aFJv^}?!VyR~Dr<g;u%Rn.~<5p[x'e`wNZtR@3p]Pw:5pZhNvjBp.woe_g5u-r4JwF!%DtO3:ooc7&!#:p^3DtpLuGw(!+%)Dtk6Vz#2sd=<r8d'#Y([y#<x3gJt`w@!)%}MRiowzikRij=]ilxAf3,U(#B2Rf#g0v-Rm[ck{`U#]giKv3>)!&6Ri154s,KuGB_%@r68r:dJ|t`#X(9<E|u2@H|rx3gJu?w'!+'1Nu7Reg4=H~+9<wxgY95Rm]xLggZ-`(X}U2:Ri4h<uOawRmsJv__5@bb{jbV~3dka#a'a]!,#a+U=a>b6a3b%!/aKa/)!arwve^VyJ;:pR~DpTg3uJpS~<5pOPw;5qmPw:5pNOu!5pQJvG'!6Vyx=<qoJvA!{~Jup!%@qk7Rn/KvyD!}''[xz;>wkh'?Rh,x8gyt`w5D!&),(SgyccRgztJ@3pPB5p#d'(Y#<]mmifubw&RgoJvE&!82s^JvF&!8Rf,ADb]~;x=h'rNu]vK!,%'*0RnORh)4Rh*AqQg-vaRnNg;wHwkh'ba~4cE#Ta*x3gctyw@'!+%RnFRnD<4Rn@hFvK5RnCxWg[#`&a0Ua()`1Rm75Rg[c]%X#qi8Rg^NvdRj>BwzgZauwji7Rm6A4wgg]d1#&(*,.0a#Rm;Rm<Rm=Rm>Rm?Rm@RmARmBe%#^^^Xaea?aC/b+(,!a+a#!a/!>a&Ta<aKbD!2wphBRnk[yPw}hE|.=Br-3Dtm>6Vy~g6urRf.x,hPrNav!%'RnqRo%Ro#Nu;q[Pw;5r+JwNZtM@3r)d'#Y'Weh;xChL#`&RnmRnoKu}>%(!Rne~Bs-;2wjcussJv+'!aYSO}6@B<5?ba~8LrNvj!.%*ROwungw~ng~:9;Ri^>wtnig;wHRnixDh@|(UZ.x1h@|)!#:2<H|*xHn]#-UX'3Ro)z=iT}6ARns=Bwsn_wpnaRncw]aR(#UXa&Ua*a/=]iPd'#Y&Ro'WnXf{QRm2hNvj]nZd`'T~&1`{|`#9b]{}c:'!#Wl{>@=be}]?cl{{U#:5Abb}Jds#^YaF!a*b4a#a3aPa>&Tb!bH!*a_!Eau?/a&RjY<]gj>6Vz*;:pe~DrZg,QRj1JwNZtX@wihspcJvZ&!VyX9WmOJu|!|N2WmHJvh&!]ht~Bpbcn&T(!#RmQ<s7Nu;padH#X'`+WmJ@>RmKCARhnKup=!)&Wf+:RhqNuPpf9c!#'45pd5AwghpARn(Ls@w!%,)!RmP@Wfe<E|IJva!&WmNg8vsRmLd`*.`#Y'Xa!axRn*]hrA8Rhug5s@rXg8u!RmMd8#X'X*3@rV72smdI*#UY&RmICARho~GsgxVgd)Ta'U-Y&Xa!T#RnEWnA@Wffg1uDRi0hFvK5RnBxGnG&#`%owp)@wsf+bX}Ze-*1!a*^^^Ua|!#a.aq&Ya2!a>.a6!a:aO`aJDtL[y`@Wg#>6Vz12@wzoYRoZNuPRi!NuPRhzg=ucRi,@=b`{Yg=ucRi-ACJvB!&Sh[ebSh]ebi`wUuFRm4Jw2_[y0JvB!.<Ju(!&SoG}6Shd}6<Ju(!&SoH}6She}6Kur@._g5vHRieJvx!{L2G{Kx6gd'T#?Rh82Wi5cZ#X(g1w)Rm5dW-Y(Ta#!a)!#aYa=wnfE=su2>>bU{0j9udv:<svj8uQv-7RgHdE%#^'sq9sp=>Bb_{TJv`!&g/r|snj6v(us5d,#Y(56H}[978H}]Jw5!&g1rushJvB!+j;v{u5?zDhd}6}bj;v{u5?zDhe}6}ce*#`(^^^a[aea!=!a6a*aoXb1a.!aAbL!b>,b'aL!aV@Wf|2Wlg3[y/JwNZt^@3piPw:5pgJunZou3@rsJva&!Vy_g<v~Rm#JvG'!6Vz0=<r{Ju{%!:pj@WfsiXuJu3Rm:JvZ&!WfA~Bph@c4Z&Dtwax5rubx(#:awRk1@d,#Y&RfjRfid1#,Y(@Wfp2Wlrg5s@ryKu[@!,'=]ig9wlk?Rk>g5u-rqJvy'!@9RkQcH(T#=>Ri~@<wkj(Wj(KuZB*!&<7rw@9RkRcH(T#=>Ri}@<wkj)Wj)dg(Ta2Xa9X#`-!a*CARhg@@=I}d9x;c~#X%so=<sj>2@@=aybb}XjWv0Q~EfEj3vLv;<d,#Y(56H}`978H}_dgaPaFa'a/!#a3Y0a_a;a|!1(a7-[yE3[xt;:pJNvZrrg3uJrvJwNZt=@3pIh=rt3rxPw:5pGOu!5rpJvG'!6Vys=<rz@c4Z&Dt(ax5rtJvZ!&~BpH@wsfNg-vaRlNci*U#=<wei<F}a5@Jq.!a*JQ!%@qZ23d(#Y&RjH5]jCk!u7w&u0udARjFd/prq=tyvpaEa(a:.!a1aZ(@@=I}:9wpd%=<sX55w_h}@@=I{t=ay<aU@@=I}T=ay<2@@=I})?C9:9au@9Cb]}DP~=x-fAZ(2Wl1=ay<aU@@=I}>5@d##Y+jTv|vV~EfFj]uNpn~FRfGdgaK!Z2&!a8a-Tb({E!acTbM*!a(DtY[yYd'%Y#sl[y*hHvh>Re5x2c{Z}.j4uCvcawRiMd+#X+_x&d!},<5RkX;2Hzw@x,gavfB-!{CcF&T#Roe;RodwWbBg5urRgaKvHC*_6Vz+<4opieuew&Rmq@d]&Y)X,T#X0Rh}<BqP=4qS9:ReMg/ujReNJw0!/<Jui%!bd{kawwnemRelAxUa?a3#*.&UX(Ya+a/RhvRnQ<o}9Wmtd-#Y&RgSRmw9;Rmxay=Rmyg-vaRmuxEhSrNu,v-voC!%(aR.a(a7+1Ro1>Ro5CE{A9b]{@;5x#eO{:g;urRi+KrNA!%(Ro3>Ro79;Ri_Ku@>{;&!x%gX|{KunA_+g5QRj/g3u5Rj#g>uERj%wio/xRhS&!,!#^1U}wba{8>>@=be}qC@:D5ba{7Ku+A&!}x?ba}t>>@=be}se(aA^^^Uat!b0#{pa+awUazbGa#aLb9bgaWac'a5TbS=Br!d1#`%scp_Jvl!#rT>Re0JvX&!VyN=H{Fcm#U&:pY=ReaJv2&!]h0=]nUJvG'!6Vy|=<r%JrM_=]h2@Wlud'#)U'Wf'b]{i=]h/Jvh!&~BpWg=v]RnMx+ny#'Nu;pVwjnu=]nwxJnx,T#`&Reqwjnt=]nvieu9vrRjLLuYwP(#+!th@wih5pX~Gr'g5v/Rh4KunA'!-CARnP@wwiN:Rm_9x'cvw>!|l=<saKvAA!0&3@q}>w^e1bp#&Re2Re3BDx7gH#T|f5H|eKuZ>!%(:qNAH{]Jv6!+3B2B9=b^{X<5<B92:E{ZLvhwA(a;a%!igQuyRmad+#Y}m@3Rh5d8#X'X*:AqUAHzmaxwbh<aXRnVcF}RT#Nw&cj#U(BWnug/vsRntdka)(a3+.Zb7aYYan1!bVa@Xa}[y^@b[{G=H{+hFu73Rj&Pv#5ReQcK%T#sig1v{Rj'Ku+D#'!t]~Grm~?rkKuMB!01d5#`'Vy.ta3Dtu~Hroc8#'{^45s85AwZbP&!#Rn!wghxWn#KvEA!)&2RlA2RlBx:h|#(T,=]j09Wobz>x]z/@awRoTd+#Y(az]hFhCrm4d,#Y+jTv|Q~EfMj]uNr|~FRfOdCa!Xa9_X#@<plJvf!%b`{(9;Rgwc;.!#2x7cw#T|UDb]|T5Ju={(!=@E{&Jv)&!Ab`{'awJvf!~*>>@=be{#KuY>!+&4Ezyi[ugv&RjIdea+T)#UXa&T-T&a!Rh9auRmW=]kLg5vuRn+g3u4Rn-Ow6ARn,hHus5xNk?#UX(U~)/g8v0RkD~AwkkF?Ri.OuNBwkkA?Ri/d|a2`a*^UYa.!aBTZaTa'Xa;!(!2!-a#b2[yC>6Vyq3[xr2Wi?g1rusVh%s?DtF~<5rbJs;%!DtBfswKtCj[uvuSsEu3RgVx3o:u+wN'*Zt;@3rd~Grh~?rfg8w)Lq)qE&-a%!>bI|`jWv0vV~EfCjTv|vV~Ef@j]uNpn~FRfBcK#T']gWNu7x,k7q4ai(0!hHv8<RhmkMu9vrsBuev/RhlCJvB!,g<v{wchh~@:Rhji[vrv{wchi~@:RhkdS&a5UY#Ta!RgPwwiI5BwciI~@:Rh`x'iJvj'!5]iJPu8Bwch]~@:Rhach)U#h3rp]gLh@t|Ax,hTq3ah!-(~@:Ro0Ou!5RhXj^v(pyw8unRhVd|)`,^UYas!a?/a2Z'a^Ta{Tb7Ta(a#!a,Wf&9sZ3DtAadamov=Bqt3[xig8vsRm~>waiL2b`{QJv*_Ouv2qgj<v]v2BqfdR'X*X#Y-@3qr~Gqv~?p6hHv-]glPup5Lq+q?_%*b_{qF{n9b^{rOu4ARhpKvCD!+&~Bqp:5Dbb}nwoiKl&unuTuBv]v+ueunaXRf0=Jvh!0nKufu8v1w&w7q%w&uHrz:Rgnj5w,uxDJq/(!hNw'5ReCk0s2u3w/w'5ReFd>Za&!*UaA=<wkgsRnSJv^!%Refifw3vyRgOKu_B'!,<]gkiiu:w&Rh<=C@a^<B57@2F{[<B5@aW:=3away9A5aW=<B=C@a^<B57@2F{Ie-#`(^^^bCara.b8aza6!/bZ,!adTbnTbOb+aFaS!aAT9@Wf~2Wli3Dtl2@d,#Y&RfnRfmJwJZtN~GqyJva&!VyMg<v~Rm%iXuJu3Rm9Jv[_=]ih9wlkDRkCd1#`(@Wg>2Wls3cH#T(@<Rj*=>Ri|b~'#23s9h<~El.d'#Y&Dtxi^rzvdRl#d*#U%(o|B2s`hJwSaxRmDKv4B&!1:Rmdd5#`'Vx}to~Hq{x'f1v3(!BA5ba|bJv_&!Wfug1v]ReIdO+U/Y#&G}-8wze=Rh{g1v]ReHg/uQRf/by#)ibQwERl/cH#T(@<Rj+=>Ri{cNu+vlax-!(#a0qa9<Rii2;;bU{H;x<i=&X#Rk`<4wwi=C9H~8xAI(Y#<azRi@45wXI<B9;5bb~7dL(X#Xa(+!aL6Vy{g5QqOau:5au2@ay547EzbxOcU(UX-T#Ta#:Cbb|A?wjh/b_|SOw6ARgtihr}u7Rhy<d1#T)X1@@=I|~=ay<2@@=aybb}Sj3vLv;<d,#Y(56H}A978H}@dGpvs@uAu`vcw9*!aFa+ai%(b!aXa8.a?a[ozWey=sU2@G}Nch&U#Rf_WexKu+D#'!t:~Gr`~?r^j]uNr|~FRg*j^psurwJt|RmcKv)@&!)7Rkv~Br[@wxfO:Rl3co#U'6Rezj_q#vIuavjRltwzeyh@vr5JqD0!>aY?C9:9au@9Cb]}9cl#U*5;5<H||jbuus1ucv&Rfvg1v~d/pppzqFr^a--a~!aMat1(hFv;Wiz@@=Izoj5uuv-7Rix~Cw`fk2WlVcZ#X,k)u3vWs@u2]ktg;wEx'fBq(_2Wg/jTv|vV~EfoJv]!15x'hzqG!(P~EfU~CRl_j6v(us5x4i-#T(2WmZ?C2F|d>Kq<aj1!*jTqIsBv=Wl`~Cw`fi2WlWj`v0u*~>RlR=c>Z,k#u3vWs@u2]kr<c1Z+jTqIsBv=Wla~Cw`fm2WlXdmb3!a{(arZa`bkTa%TbQTa-a9+c'!aM!/[yL=Bqug.w'RifhFvyDRj.g>vgwyk^9]k^Jv3_@WfbAARkhJw2_[x|JvB_wkoIRoKwkoJRoLd'(Y#<]gm=<9<H|yd'%_X#skDtb3awwqkgNulRkgdB#^',9:p'hJwSaxRmEBwVb8@4=H|qLu+w50&!)@3qs~?pU>Awwn;;Rn=c:Z'ARn<=<qwKvC@!/&~BqqJv6!&]eVb^z^xRge'/a%+^`#Sge}6<4Rn3=]n0Pw2>Rn8Jw0!&>Rn:>Rn6cY#a7+!a&=<wkaNw~h3z_c5Z{=wjh#=]nLKv^D!&)Vyz=bW|swYb<WetcG#T(2wxa@qVx@gD#Y&b^|V5JwG&!5bb|pg/w&RgD@x=kHs=uAvn!a%%/'+RmSRh694Ro`g-vaRmRhHv-]mlxCcS#`&ba~.5cD#Ta)P~=d,#Y(56H{>978H{Dd_#{2^Y%_+qbbb{6g3sERhsbU{?dfa.,`a(Xa<!aiX#(55RiG54RiHcI#T'WiU3RiVNvdwtfcRlKNvdd,#Y&RlHRlExQgf.1*^T'X#Sgf}6Wn4=]hfPrk>Rn7Jw0!&>Rn5>Rn9Lunw?&a2!,5<oq@@wqfdRlJj5Q~=d,#Y(~ARfcOuN]fdDKw;ay(}i!547E}j?cI#T(@5bV}iCbV}hdv(^^Tb?a40,b##Tbo!a*bR!a<b|a/!aKai!aU[yK=]o^g:v>ReGJwPZtK<7Rh+h<~El,Pv#5ReR@awwxjCg,ulRjDJv6&!]j!z?aQeeg>w=Sh<eeJw;!&axEzOg,Qosc!#*:wkeJ]eJ>x'h-u(!%Ro.w~h.zPdNZ(X,Ya![x{;9ReY;wkgxRiF:x?ap#Y&RmUg<s2Rkod]+UY0TZ'!a&A9sw<=bczLNvuw{gqzNhJwSaxRmCKuLay!#&s_Rf-55b^{uJvZa!!c%#(55Ri654wmiu5RiuawLu,vp!+}^%b_}Y9;wkgxba}o>A9:=b^}zKuh=a''!3awRk3c*'!#aHRk6c+Z&Rk5Rk4Jv)&!awRjSawd9*`#0?C2@EzMj8u<uJ5RmbjQrquJu3x,k>uq@_+=ayb^|W~ARkEOuN]k@7dhzV^X/X&a-#zRzSb`zXcJzTT#2WkVKvDBzW!%FzY9;5bbzWjQrquJu3Jw3%!b`zU=ayb^zQd:#X(T-a!6Vyywxh}=b]{Jg=u1RiAdGp~qHtzv!w(wA+a+a;<!aJaYai'anasb(=azRmV:Cbb{MLq2vb!%')RjuRjrRjtRjqx3jnqCw3!%')Rk(Rk+Rk&Rk)Lq2vb!%')Rj{RjxRjzRjwLq2vb!%')RjsRjpRjfRjex3jcqCw3!%')Rk'Rk*RjkRjl9<CbbzfOu4ARhxLq2vb!%')RjyRjvRjhRjgx=joq*uKvb!%')+-Rk.Rk%Rj~Rk-Rk#Rj}x=jdq*uKvb!%')+-Rk,Rk!Rj|RjmRjjRjidAq&qKs@uAv8Aa.'*-a@a&0!aM@a5[y73Dsy3Ds|3Dt):wxgI2sHJwJZt.~Gqxwsf0ikrzt}Rl0Jvy_[xj~HqzKv_A|D!&WfP8axRoVcf,U#k(v]v+ueunaXRf1Ju}'!g8u#Ri=jQw!sCunLprq>!,')~<5qeGzq9F{W=c##%s5au:5aU3CBE|;d4#X(D!a&6Vygx(b;#(=]ed?C2F{N<capoq2r[a&!aPa9,'Pw;5s:@@=I|,55w_h|@@=IzcP~=x'fCqB_2Wl2>aU@@=I|1OuNBc1Z+jTqIsBv=Wlc~Cw`fl2WlZ~AcTa%!Z+jTqIsBv=Wlb~Cw`fh2WlYk+uNqJsBv=WlSg,u3dca3#UXaMYa)TaB-=cM|7T#<bI}l5@B932:aV2G{BOuNBJq:|M!5Ezt=<B=C@a^<B57@2F{v>cB{/T#=ay<bI{3Jv6!a.6BKq0ah&+!5E}HP~Ef{978BaU@@=Iza<7d#.Y#978BaU@@=IzH~AJq0!(@@=IzG978BaU@@=IzFe,aU*Y&^^^bvJb,b:bFad!a,c2Ta>aL.bo6!a#CbTa'T#Re{2Wlh2@G{yg6t~Ro_NvdRfticuRQRllJv3&!x&c|zs@Jw3!%RflwpfkRlpKuL;%(!Re<@G|C2GzdhIvuBwgjAg-u0RjAKQB%!(GzZ@G|5NuuRl7d='T+Y#Vy[g<v~Rm!==G|>JvA!)@wma=]m1ifuaw&RmnLs@vT'!|/+[y,g:v>ReTJw1!#qX=x!eC{bLu+wT&)ZtZauq_~Graci&U#F|89:r_Lupvq!.)&2RlG8RfaC=x!eF{_h?rpWlmd&'!#X|&]k::xJey#`'T|+<E|&2@H|%dE#(^,g;u.RiEg6vjRiC9xCkA{O|zY#g=ucRmXKs0@!&*@G|m@awRknJuh!,3d(}gY}eJvj!%Rm):Jw3!%Rm+Rm-Ls0w(&!a(a#@b[|6cZ#X'7RkxWgAOu4ARn'dH'U#Y*Vz-Wm'CARm}d]*#a%^a*T'aK!a<9bV{PC=p*Jw4!&SgxcbB5r]idw(wBRmF7xFkt#&`(Rm/Rm8E|!JuY_9:Rl5=wrgr2:bbxd@xXfB(a*#T+!.X0X1Ta/a'T&RlDRfL>RlyARl9b[z[>RfZ:RlL:RfRwlg/ARl;9;RlxKv,A/!%7s69<74=BA5ba{-8Bde#`a<XaKYa1,a'P~=wxfB2bZ}}?C972@@=I}r8@55B9;5bb}G978B2@@=aybb}3j3vLv;<Jw3&!>Rfk=ayb^}4~Ad1#`*@@=aybb{w2@>==<bbz]dx+UY#^UaF!a9!bB'Ya1.!ajXa#%olRhD[y=3Dt#Ov5BrHKuMB%!(Rf^Wep~HrJwkiQjKr|~FRg)Ku+D#'!t5~GrF~?rDdV)UY,Z/_7RkuG{<~BrBg,rlsO:235B@bX}|d?a1!#`(6Vyn5@d##Y+jTv|vV~EfIj]uNpn~FRfH7Lq2vb1!a9-978BaU@@=Iz9978BbU}#~AJq0!(@@=Iz8978BaU@@=Iz7~AJQ|}!978BbU}!JvkaK!AdUa21-U#`a+(g/vsRn~Ou!5RPj:rmu9WhOjXuvvNr}:RhAj^v(pyw8unRn[kPr}p|u7vwv]RiSBd;pppzq@qHQa?(b.!a.a`@.|xa(hFv;Wiyj5uuv-7Riw~Cw`fg2WlU978BbU|wOuNBJqG!(P~EfD~CRlQcZ#X,k)u3vWs@u2]ksg;wEx'f@q1_2Wg.j]uNpn~FRfqJv]!15x'h{qG!(@@=IzK~CRl^j6v(us5x4i,#T(2WmY?C2F{1>Kq<aj1!*jTqIsBv=Wld~Cw`fj2Wl[j`v0u*~>RlT=c>Z,k#u3vWs@u2]kq<c1Z+jTqIsBv=Wle~Cw`fn2Wl]dn1#c(a(b^a2!b/bAT(bj!aDa7bu,a_a{c0!2T0g:v>ReD2@G{42@G{5~DpM~<5rc=Bx6i>{RT#RnI@zCx]y]z:2Jv[!zr5Awyk]9]k]dD(Y+X#6Vz.g=wKtgwhaCwgmTWj2Lu,w%_+/[y-B;b^xeg3u3Rj-2@bX{*KrJ<!+'@Wg(g?QRlC@Jv`!%b[zIwsfII}8JQ_@w|kW|=Jv(%!AqcOuNBJvEzh!bYzjLs@wP#(0!oy@>RkdJwMZtc3Dtd@BcG#T'9bWxg2@2Fznd*#Y+;2x'c}w<zizixNgwa#Z'U+!/!a'!a+w~g~z6wcn{Rn}wcnzRn|5Rh%=]nJg5vuRmvNvdRlvcprJu}w*az*a#!%.a.'Bot9qT]kj@Wg'ay2Gzv@Jv`!%b[zEwsfHI}1;ck#Ux`<Cbbx_Lu+w!a&0*!wko*wwo,So,}6Juqxf!E}PigQuyRm`d3(`#8>Rn%:A5B;bZ~%KvhCa!a2!x>k7#Uxb@b{#xaRk7Jw0!)>wwhlShl}6>wwhmShm}6CJvB!.x'hhvj{!!5Bwkhhbaz}x'hivjz~!5Bwkhibaz|xEhTrNu,v-vpD!a%&/)a3a.,%Ro2t[CE{)@3re9b]{%wjo09:rgc:Z&Ro6=<riifuaw&RmoKrNA!%(Ro4>Ro89;Ri`dSaL'UYzxZb)7Rka3xRhT&!,!#^1U}vbaz{>>@=be}yC@:D5bazzKu+A&!}{?ba}y>>@=be}wxBh[t`u~vJvr!%a!a()a,a0a4RoC=]o;Ju(!%RoGRhdwjh`=]oAg>w#Ro?g5vuRo=NvdRl|Ku]C.!&;RoEJvB!%RoORoMBx'h[v+_?w~h`}~5?w~hd~!xKh]oiptu-utv.vp!#%&a30a@a'a+(a/aOp(o~p!RoDJu(!%RoHRhewjha=]oBNvdRl}g>w#Ro@g5vuRo>c[#X']o<CauRoRAd-#Y':RkpauRoQKu]C.!&;RoFJvB!%RoNRoPBx'h]v+_?w~ha}t5?w~he}ue!/UbhYacXaW^Tc&a;b:a-c/#b&aja1(!cL+!bKbt!bmcRc9aIc?8[yW3Dtt94Rg`Jv}!&SiRMzBhEebShEMNuPRe>x7gL#TzuwjirRipc<Z&>on;>z=h-MSh.Mwqczx'a7vj&!>Re4@=ResJt__NuPRi*NuPRi)j]uNr|~FRfzKrJ>_+@Wfy@Wf]2WocKrJ<!+'@Wg%g/QRl@@Jv`!&awRl<wsfFIzgLu(w*!.*&ShBMwvhIRhI9;RhNx1hK'!#Sn]Mx1hK~0!#:2<H~7cNu+w7D*'1ZtW>Rn1~?rOc:Z&Rn2=<rQ<7wjh&=BSnLMc]#X(6Vz)w[b=a!U#9wzgMc3#&(RgMRitRis<x,gKt`ax!&+SioM=BSilMc3#&(RgKRinRimKurB,!&SiQMzBhDebShDM6BJQ!(P~Efx978B2@@=I}WLrJw!!,a*&@G}O@9wkibRid@@x'fKwC!&SlDMSfLMjUv~Q~EfKKv3@a+!(hFv-]mpx/hYZ(C5RiWz<o/MwkhY?So/M@x,gbvfB*&!SgEM:SoeeehFu3:Rgbda(,^TZa)X/7Sg[eb:2RgI~BrMC@wgkc:wwkcRerx3h(uUvK!&*,SnOM4Sh*MArRg;wHRh(x=h;rJvPwI!a4',a'0@Wg&=BSh/Mg>w=Rh=g3w*wwgGRgGcW(X#;Sg}M2Gzk@Jv`!&awRl=wsfGIz`dKZ*T'Y-:RhR7RhQg5u-p`j6v(us5d,#Y+~Awkia?RicOuNBwkibba}Ld6p~tyu_vbAa'a+!a/'a3aEa8a!>Sh,ebJv{!&Sh@ebSaReb9;SgwebNuPRi(NvdRl)NuPRi'hHu^<Rm^Jvv_@Wl(g;u1Si/ebKu'B&!*Sh?eb@Wl'z@aPeb95Si.ebcpputyvjB)!,&a+0a%ShAMWeK@G}C@WfJ9;RhMwvhH9w{ia}ix,hJvRA1(!zAn[MRhHx1hJ~*!#hFv(BSn[MBJQ!(@@=I~'978B2@@=I}2db.Ua<'X}+T#a0XaG2G}E;wkg|wuh!Rh!x,hZu,@)!&So0MVy)C5RiXACJvB!&5RiY5RiZg8w)cG}*T#2@bU}=KsA>(!a.3wkhZba~(x,h^u(A!&(SoCMRhb5Bz=h[eb?w~hb~6x,h_u(A!&(SoDMRhc5Bz=h]eb?w~hc~6e)aA1T#T,^^^c-bMb&blcPaP(a/!0!bA=b5c@a(!bfbrc#2afwmhARnjwchORnp2Wlf3DtsNvdRl-2@wpa<]m0bx(#:awRk2@Jw3!%RfhwpfgRlnKQB%!(G{V@G|'NuuRl6d='T+Y#VyUg<v~Rl~==G|<Jv+'!aYShC}6@B<5?ba~8@Jw3'!g2QRljhLrpWlOd+#Y'g.w'rIg>w*wgj@g-u0Rj@Lu+wT&)ZtUauq]~GrGci&U#F|39:rELrNvj!.%*RhCwunfw~nf~:9;Ri]>wtnhg;wHRnhx3hDs@v~!/+'@Wfr@9RkSNu&Rlo=@<5GzoKs0@_+@Wl+@awRkmJuh!-3d(}pY#qWJvj!%Rm(:Jw3!%Rm,Rm*de&!1U-U#`)Re;@G|.@9Ri82@wjfvRlq=@<5GzpLvOvr!).&2RlF8Rf`C=x!eE{.Jw3_g2QRlkhLrpWlPde(!#U{s,UXa*Ta'[y'g:v>ReS;x0PZ&RnlRnn~HrKJw1}f!=x!eB|2w]aP(#Xa&a*Ta.Ua2a7=]iOd'#Y&Ro&WnWg;u.RiDg6vjRiBNvdRlzhNvj]nYJuW_2Wm3x)kFze{9d])!a.!,Y01!#&aC!a3RndC=ox~BrC@2b^{pg,rlse7x'ksuq!%Rm.E{xidw(wBRmGx9o+)X#wwo-So-}69:Rl4@xSf@a#XZ'X)X,Ta(/ARl8b[xc>RfY:RlI:RfQwlg.ARl:9;Rlwdn'#^XafaQa1X1TaHTa)@b[{zcZ#X'7RkwWg@Ou4ARn&x)kG#{,g7u/RkGdH'U#Y*Vz'Wm&CARm|bx#(A]gUbUzJj9Q~=d,#Y(56H}l978H{U7d,0#U*2>ABb_xZ978BbU{e~AJQ{g!978BbU{hxMh?ad{oUYZ.x1h?{l!#:2<H{mx3n[t{vl!,&a%3Ro(z=iS}6ARnr=Bwsn^wvn`Rnbd`*T}B0!#^X'BG{c9b]{a>>@=be}F?JvS!&BG{d7BG}(Bde#`a1X,Ya@!a'P~=wxf@2bZ}I56B2@@=aybb}08@55B9;5bb}<j3vLv;<Jw3&!>Rfg=ayb^}&OuNBKuLA!)a!P~=x#fD{f2@>==<bbzl?C972@@=Ix^d6rSu,v7w*C(0a)a6#B+a%!sQ[y?3Dt%3[xn~<5rLOu!5p@Ku+D#'!t7~GrP~?rNKvlaya7'!h+v-5qMg=t|cd,U#5AAaa5Abb{S@52B5@a[@52B5Gx[iXueu;d<#`a(!/549C;ag>23ExY5@Dah89b^~689Jv)!~2b[~1Lv'w(%*!a#bX|aPrmawRe]keu7uhv-q6rxu,q`xTo]/a5aU!bNaDXbi!b-!ao!b<bwA!#5@B932:aV2G|:d-)Y#hJrL>RhG<7@C5<H|_=Cau:5aj5@B932:bJ|ng>vIbs)#?C2F|9jPv0w.vISh-MKvUaz(.!9ABbb|[5;5<H|Eg>unwfh;9:4E|YjQsBt|vjx'hYq3!(?C2F|J:2<BaY?C2F|GOu!5x,g|p{ah!-(?C2F|c9:4E|OjXuvvNr}:Rh&i[w*t|cd+U#jJvsu)vsSn~Mkfrmu9p}u7vwv]So!McW#Xa!ax5@A5aY:5;5<H|>kJv~vYrquJu3x4ib#T)2@SmZM?C2F|Bj:rmu9@xPhI(a*a#U#`a3-5Abb|L~@:RhK9:4E|0@52B5G|#C::aY?C2F|-:2<BaY?C2F|.5Jvk!a)javYrquJu3x4ia#T)2@SmYM?C2F|HAxPhH(!a#U#`a*-5Abb|4~@:RhJ9:4E|R@52B5G|F:2<BaY?C2F|Sc^#Xa2j=Qq5CJvB!-g<v{z;hhM?C2F|Zi[vrv{z;hiM?C2F|XKsA>!a)-g<v{z;h[eb?C2F|]i[vrv{z;h]eb?C2F|^iZu.vix,hZq3ah!.(?C2F|QOu!5ShXM:2<BaY?C2F|P",13494,2713,49,25,61),pt;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.FLAG13=8192]=`FLAG13`,e[e.BRANCH_LENGTH=8064]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`,e[e.VALUE_MASK=8191]=`VALUE_MASK`})(pt||={});var mt;(function(e){e[e.AMP=38]=`AMP`,e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_X=120]=`LOWER_X`})(mt||={});var ht=32,gt=21,_t=2097151,vt=2047,yt=0;function bt(e){let t=e>>>gt;return t===vt?yt:t}function xt(e){return e-mt.ZERO>>>0<=9}function St(e){return(e|ht)-mt.LOWER_A>>>0<=5}function Ct(e){return(e|ht)-mt.LOWER_A>>>0<=25}function wt(e){return e===mt.EQUALS||Ct(e)||xt(e)}var Tt;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(Tt||={});var Et;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(Et||={});function Dt(e,t,n,r){let i=(t&pt.BRANCH_LENGTH)>>7,a=t&pt.JUMP_TABLE;if(a){if(i===0)return r===a?n:-1;let t=r-a;if(t>>>0>=i)return-1;let o=e[n+t];return o===0?-1:n+i+o-1&65535}if(i===0)return-1;let o=i+1>>1,s=n+o+i;for(let t=0;t<i;t++){let i=e[n+(t>>1)]>>((t&1)<<3)&255;if(i===r)return s+e[n+o+t]&65535;if(i>r)return-1}return-1}function Ot(e,t,n){return n===1?String.fromCharCode(e[t]&pt.VALUE_MASK):n===2?String.fromCharCode(e[t+1]):String.fromCharCode(e[t+1],e[t+2])}function kt(e,t,n){let r=t+1,i=0,a=r;if(r<n&&(e.charCodeAt(r)|ht)===mt.LOWER_X)for(r+=1,a=r;r<n;){let t=e.charCodeAt(r);if(xt(t))i=i*16+(t-mt.ZERO);else if(St(t))i=i*16+((t|ht)-mt.LOWER_A+10);else break;r+=1}else for(;r<n;){let t=e.charCodeAt(r)-mt.ZERO;if(t>>>0>9)break;i=i*10+t,r+=1}if(r===a)return 0;r<n&&e.charCodeAt(r)===mt.SEMI&&(r+=1),i>1114111&&(i=1114112);let o=r-t;return o>=vt&&(yt=o,o=vt),o<<gt|i}function At(e,t,n){let r=ft,i=e.indexOf(`&`);if(i<0)return e;let a=e.length,o=0,s=``,c=r[0],l=c&pt.JUMP_TABLE,u=(c&pt.BRANCH_LENGTH)>>7;do{let c=i+1,d=e.charCodeAt(c),f,p;if(d===mt.NUM){let n=kt(e,c,a);f=bt(n),t&&f>0&&e.charCodeAt(c+f-1)!==mt.SEMI&&(f=0),p=f===0?``:lt(n&_t)}else if(Ct(d)){f=0,p=``;let n=d-l,i;if(n>>>0<u){let e=r[1+n];i=e===0?-1:u+e&65535}else i=-1;let o=0,s=0,m=i<0?0:r[i],h=c+1;trie:for(;h<a;){for(;(m&(pt.VALUE_LENGTH|pt.FLAG13))===0&&(m&pt.JUMP_TABLE)!==0;){let t=m&pt.JUMP_TABLE,n=(m&pt.BRANCH_LENGTH)>>7;if(n===0){if(e.charCodeAt(h)!==t)break trie;i+=1}else{let a=e.charCodeAt(h)-t;if(a>>>0>=n)break trie;let o=r[i+1+a];if(o===0)break trie;i=i+n+o&65535}if(m=r[i],h+=1,h>=a)break trie}if((m&(pt.VALUE_LENGTH|pt.FLAG13))===pt.FLAG13){let t=(m&pt.BRANCH_LENGTH)>>7;if(e.charCodeAt(h)!==(m&pt.JUMP_TABLE))break;h+=1;let n=t-1,a=i+1,o=0;for(;o+1<n;o+=2){let t=r[a];if(e.charCodeAt(h)!==(t&255)||(h+=1,e.charCodeAt(h)!==(t>>8&255)))break trie;h+=1,a+=1}if(o<n){if(e.charCodeAt(h)!==(r[a]&255))break;h+=1}i+=1+(t>>1),m=r[i];continue}let n=m>>>14,l=e.charCodeAt(h);if(n!==0){if(l===mt.SEMI){f=h-c+1,p=n===1?String.fromCharCode(m&pt.VALUE_MASK):Ot(r,i,n);break}if(!t&&(m&pt.FLAG13)===0&&(f=h-c,o=i,s=n),n===1)break}let u=Dt(r,m,i+(n||1),l);if(u<0)break;i=u,m=r[i],h+=1}if(p===``){let e=m>>>14;e!==0&&!t&&(m&pt.FLAG13)===0&&(f=h-c,o=i,s=e),f>0&&(p=Ot(r,o,s))}}else f=0,p=``;f===0||n&&d!==mt.NUM&&e.charCodeAt(c+f-1)!==mt.SEMI&&c+f<a&&wt(e.charCodeAt(c+f))?i=c:(o<i&&(s+=e.slice(o,i)),s+=p,i=o=c+f),e.charCodeAt(i)!==mt.AMP&&(i=e.indexOf(`&`,i))}while(i>=0);return s+e.slice(o)}function jt(e){return At(e,!0,!1)}var Mt=class{src_Any=et.source;src_Cc=tt.source;src_Z=at.source;src_P=rt.source;src_ZPCc=[this.src_Z,this.src_P,this.src_Cc].join(`|`);src_ZCc=[this.src_Z,this.src_Cc].join(`|`);cache={};opts={maxLength:1e4,urlAuth:!1,schema_names:[]};constructor(e={}){this.opts={...this.opts,...e}}set(e={}){return this.opts={...this.opts,...e},this.cache={},this}escapeRE(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}nestedPairRE(e,t,n=4){let r=this.escapeRE(e),i=this.escapeRE(t),a=`(?:(?!${this.src_ZCc}|${r}|${i}).)`,o=`${r}${a}{0,1000}${i}`;for(let e=2;e<=n;e++)o=`${r}(?:${a}|${o}){0,1000}${i}`;return o}get_text_separators(){return this.cache.text_separators??=/[><\uff5c]/}get_pseudo_letter(){return this.cache.src_pseudo_letter??=RegExp(`(?:(?!${this.get_text_separators().source}|${this.src_ZPCc})${this.src_Any})`)}get_ipv4_addr(){return this.cache.src_ip4??=RegExp(`(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])[.]){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])`)}get_ipv6_addr(){let e=`[0-9A-Fa-f]{1,4}`,t=`(?:(?:${e}:${e})|${this.get_ipv4_addr().source})`;return this.cache.src_ip6_addr??=RegExp(`(?:(?:${e}:){6}${t}|::(?:${e}:){5}${t}|(?:${e})?::(?:${e}:){4}${t}|(?:(?:${e}:){0,1}${e})?::(?:${e}:){3}${t}|(?:(?:${e}:){0,2}${e})?::(?:${e}:){2}${t}|(?:(?:${e}:){0,3}${e})?::${e}:${t}|(?:(?:${e}:){0,4}${e})?::${t}|(?:(?:${e}:){0,5}${e})?::${e}|(?:(?:${e}:){0,6}${e})?::)`)}get_ipv6_url_host(){return this.cache.src_ip6_host??=RegExp(`\\[${this.get_ipv6_addr().source}\\]`)}get_ipv6_mail_host(){return this.cache.src_ipv6_mail_host??=RegExp(`\\[IPv6:${this.get_ipv6_addr().source}\\]`)}get_auth(){return this.cache.src_auth??=RegExp(`(?:(?:(?!${this.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`)}get_port(){return this.cache.src_port??=RegExp(`(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?`)}get_host_terminator(){return this.cache.src_host_terminator??=RegExp(`(?=$|${this.get_text_separators().source}|${this.src_ZPCc})(?!${this.opts[`---`]?`-(?!--)|`:`-|`}_|:\\d|\\.-|\\.(?!$|${this.src_ZPCc}))`)}get_path_terminator(){return this.cache.src_path_terminator??=RegExp(`${this.src_ZPCc}|${this.get_text_separators().source}`)}get_path(){return this.cache.src_path??=RegExp(`(?:[/?#](?:${this.nestedPairRE(`[`,`]`)}|${this.nestedPairRE(`(`,`)`)}|${this.nestedPairRE(`{`,`}`)}|\\"(?:(?!${this.src_ZCc}|["]).){1,100}\\"|\\'(?:(?!${this.src_ZCc}|[']).){1,100}\\'|\\'(?=${this.get_pseudo_letter().source}|[-])|\\.{2,20}[:]?[a-zA-Z0-9%/&]|\\.(?!${this.src_ZCc}|[.]|$)|`+(this.opts[`---`]?`\\-(?!--(?:[^-]|$))(?:-{0,19})|`:`\\-{1,20}|`)+`,(?!${this.src_ZCc}|$)|;(?!${this.src_ZCc}|$)|\\!{1,20}(?!${this.src_ZCc}|[!]|$)|\\?(?!${this.src_ZCc}|[?]|$)|`+this.get_path_extra().source+`[\\\\/:%@#&=_~*]|(?!${this.get_path_terminator().source}).){1,${this.opts.maxLength}}|\\/)?`)}get_mail_name(){return this.cache.src_mail_name??=RegExp("[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9](?:[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9]|[.](?=[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9])){0,63}")}get_xn(){return this.cache.src_xn??=RegExp(`xn--[a-z0-9\\-]{1,59}`)}get_tld(){if(this.cache.tld)return this.cache.tld;let e=[...new Set(this.opts.tlds||[])].sort().reverse().join(`|`);return this.cache.tld=RegExp(`${e||`$#none#$`}|${this.get_xn().source}`),this.cache.tld}get_domain_root(){return this.cache.src_domain_root??=RegExp(`(?:`+this.get_xn().source+`|${this.get_pseudo_letter().source}{1,63})`)}get_domain(){return this.cache.src_domain??=RegExp(`(?:`+this.get_xn().source+`|(?:${this.get_pseudo_letter().source})|(?:${this.get_pseudo_letter().source}(?:-|${this.get_pseudo_letter().source}){0,61}${this.get_pseudo_letter().source}))`)}get_url_host_port(){return this.cache.url_host_port??=RegExp(`(?:`+this.get_ipv6_url_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,10}${this.get_domain().source}))`+this.get_port().source+this.get_host_terminator().source)}get_fuzzy_url_host_port(){return this.cache.fuzzy_url_host_port??=RegExp(`(?:`+(this.opts.fuzzyIP?this.get_ipv4_addr().source+`|`:``)+`(?:(?:(?:${this.get_domain().source})\\.){1,10}(?:${this.get_tld().source})))`+this.get_host_terminator().source)}get_mail_host(){return this.cache.src_mail_host??=RegExp(`(?:`+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,4}${this.get_domain().source}))`+this.get_host_terminator().source)}get_fuzzy_mail_host(){return this.cache.src_fuzzy_mail_host??=RegExp(`(?:`+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})[.]){1,4}${this.get_domain_root().source}))`+this.get_host_terminator().source)}get_path_extra(){return this.cache.src_path_extra??=RegExp(``)}get_fuzzy_mail_host_search(){return this.cache.mail_fuzzy_host_search??=RegExp(`@${this.get_fuzzy_mail_host().source}`,`ig`)}get_fuzzy_link_search(){return this.cache.link_fuzzy_search??=RegExp(`(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uff5c]|${this.src_ZPCc}))(?:(?![$+<=>^\`|\uff5c])${this.get_fuzzy_url_host_port().source}${this.get_path().source})`,`ig`)}get_http_validator(){return this.cache.http_validator??=RegExp(`\\/\\/`+(this.opts.urlAuth?this.get_auth().source:``)+this.get_url_host_port().source+this.get_path().source,`iy`)}get_relative_proto_validator(){return this.cache.relative_proto_validator??=RegExp((this.opts.urlAuth?this.get_auth().source:``)+`(?:localhost|${this.get_ipv6_url_host().source}|(?:(?:${this.get_domain().source})[.]){1,10}${this.get_domain_root().source})`+this.get_port().source+this.get_host_terminator().source+this.get_path().source,`iy`)}get_mail_name_validator(){return this.cache.mail_name_validator??=RegExp(`(?:^|${this.get_text_separators().source}|"|\\(|${this.src_ZCc})(${this.get_mail_name().source})$`)}get_mailto_validator(){return this.cache.mailto_validator??=RegExp(`${this.get_mail_name().source}@${this.get_mail_host().source}`,`iy`)}get_schema_names(){return this.cache.schema_names??=new RegExp((this.opts.schema_names||[]).map(e=>this.escapeRE(e)).join(`|`))}get_schema_search(){return this.cache.schema_search??=RegExp(`(^|(?!_)(?:[><\uff5c]|${this.src_ZPCc}))(${this.get_schema_names().source})`,`ig`)}get_schema_at_start(){return this.cache.schema_at_start??=RegExp(`^${this.get_schema_search().source}`,`i`)}},Nt={validate:(e,t,n)=>{let r=n.re.get_http_validator();r.lastIndex=t;let i=r.exec(e);return i?i[0].length:0},normalize:(e,t)=>t.normalize(e)},Pt={"http:":Nt,"https:":Nt,"ftp:":Nt,"//":{validate:function(e,t,n){let r=n.re.get_relative_proto_validator();r.lastIndex=t;let i=r.exec(e);return i?t>=3&&e[t-3]===`:`||t>=3&&e[t-3]===`/`?0:i[0].length:0},normalize:(e,t)=>t.normalize(e)},"mailto:":{validate:function(e,t,n){let r=n.re.get_mailto_validator();r.lastIndex=t;let i=r.exec(e);return i?i[0].length:0},normalize:(e,t)=>t.normalize(e)}},Ft=`a:cdefgilmnoqrstuwxz|b:abdefghijmnorstvwyz|c:acdfghiklmnoruvwxyz|d:ejkmoz|e:cegrstu|f:ijkmor|g:abdefghilmnpqrstuwy|h:kmnrtu|i:delmnoqrst|j:emop|k:eghimnprwyz|l:abcikrstuvy|m:acdeghklmnopqrstuvwxyz|n:acefgilopruz|o:m|p:aefghklmnrstwy|q:a|r:eosuw|s:abcdeghijklmnortuvxyz|t:cdfghjklmnortvwz|u:agksyz|v:aceginu|w:fs|y:et|z:amw`,It=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф`;function Lt(){let e=It.split(`|`);return Ft.split(`|`).forEach(t=>{let n=t.indexOf(`:`),r=t.slice(0,n);for(let i of t.slice(n+1))e.push(r+i)}),e}var Rt={fuzzyLink:!1,fuzzyEmail:!0,fuzzyIP:!1,"---":!1,tlds:Lt(),urlAuth:!1,maxLength:1e4},zt=class{schema;index;lastIndex;raw;text;url;constructor(e,t,n,r){let i=e.slice(n,r);this.schema=t.toLowerCase(),this.index=n,this.lastIndex=r,this.raw=i,this.text=i,this.url=i}},Bt=class{__opts__;__schemas__;re;constructor(e={}){let{rebuilder:t,...n}=e;this.__opts__={...Rt,...n},this.__schemas__={...Pt},this.re=t||new Mt,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)})}add(e,t=null){if(!t)delete this.__schemas__[e];else{let n={normalize:(e,t)=>t.normalize(e),...t};this.__schemas__[e]=n}return this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}set(e={}){return this.__opts__={...this.__opts__,...e},this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}test(e){if(!e.length)return!1;let t,n;for(n=this.re.get_schema_search(),n.lastIndex=0;(t=n.exec(e))!==null;)if(this.testSchemaAt(e,t[2],n.lastIndex))return!0;if(this.__opts__.fuzzyLink&&this.__schemas__[`http:`]&&(n=this.re.get_fuzzy_link_search(),n.lastIndex=0,n.exec(e)!==null))return!0;if(this.__opts__.fuzzyEmail&&this.__schemas__[`mailto:`]&&e.indexOf(`@`)>=0){let n=this.re.get_fuzzy_mail_host_search(),r=this.re.get_mail_name_validator();for(n.lastIndex=0;(t=n.exec(e))!==null;){let n=e.slice(Math.max(0,t.index-65),t.index);if(r.test(n))return!0}}return!1}testSchemaAt(e,t,n){return this.__schemas__[t.toLowerCase()]?this.__schemas__[t.toLowerCase()].validate(e.slice(0,n+this.__opts__.maxLength),n,this):0}match(e){let t=[],n=this.re.get_schema_search(),r,i,a,o,s,c,l=!1,u=!1,d=!1,f=0;if(!e.length)return null;for(n.lastIndex=0,this.__opts__.fuzzyLink&&this.__schemas__[`http:`]&&(r=this.re.get_fuzzy_link_search(),r.lastIndex=0),this.__opts__.fuzzyEmail&&this.__schemas__[`mailto:`]&&(i=this.re.get_fuzzy_mail_host_search(),i.lastIndex=0,a=this.re.get_mail_name_validator());;){let p=Math.max(f-1,0);if(i&&a&&!d&&(!s||s.index<f))for(i.lastIndex<p&&(i.lastIndex=p);;){let t=i.exec(e);if(!t){d=!0,s=void 0;break}let n=a.exec(e.slice(Math.max(0,t.index-65),t.index));if(n){if(s={schema:`mailto:`,index:t.index-n[1].length,lastIndex:t.index+t[0].length},s.index>=f)break;i.lastIndex<p&&(i.lastIndex=p)}}if(r&&!u&&(!o||o.index<f))for(r.lastIndex<p&&(r.lastIndex=p);;){let t=r.exec(e);if(!t){u=!0,o=void 0;break}if(o={schema:``,index:t.index+t[1].length,lastIndex:t.index+t[0].length},o.index>=f)break;r.lastIndex<p&&(r.lastIndex=p)}let m=s;(!m||o&&(o.index<m.index||o.index===m.index&&o.lastIndex>m.lastIndex))&&(m=o);let h;if(!l)for(;;){if(!c){n.lastIndex<p&&(n.lastIndex=p);let t=n.exec(e);if(!t){l=!0;break}c={schema:t[2],index:t.index+t[1].length,lastIndex:t.index+t[0].length}}if(c.index<f){c=void 0;continue}if(m&&c.index>m.index)break;let t=c;c=void 0;let r=this.testSchemaAt(e,t.schema,t.lastIndex);if(r){h={schema:t.schema,index:t.index,lastIndex:t.lastIndex+r};break}}let g=h;if((!g||s&&(s.index<g.index||s.index===g.index&&s.lastIndex>g.lastIndex))&&(g=s),(!g||o&&(o.index<g.index||o.index===g.index&&o.lastIndex>g.lastIndex))&&(g=o),!g)break;g===s?s=void 0:g===o&&(o=void 0);let _=new zt(e,g.schema,g.index,g.lastIndex);_.schema?this.__schemas__[_.schema].normalize(_,this):this.normalize(_),t.push(_),f=g.lastIndex}return t.length?t:null}matchAtStart(e){if(!e.length)return null;let t=this.re.get_schema_at_start().exec(e);if(!t)return null;let n=this.testSchemaAt(e,t[2],t[0].length);if(!n)return null;let r=new zt(e,t[2],t.index+t[1].length,t.index+t[0].length+n);return this.__schemas__[r.schema].normalize(r,this),r}tlds(e,t=!1){return e=Array.isArray(e)?e:[e],t?this.__opts__.tlds=this.__opts__.tlds.concat(e):this.__opts__.tlds=e,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}normalize(e){e.schema||(e.url=`http://${e.url}`),e.schema===`mailto:`&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:${e.url}`)}},Vt=2147483647,Ht=36,Ut=1,Wt=26,Gt=38,Kt=700,qt=72,Jt=128,Yt=`-`,Xt=/^xn--/,Zt=/[^\0-\x7F]/,Qt=/[\x2E\u3002\uFF0E\uFF61]/g,$t={overflow:`Overflow: input needs wider integers to process`,"not-basic":`Illegal input >= 0x80 (not a basic code point)`,"invalid-input":`Invalid input`},en=35,tn=Math.floor,nn=String.fromCharCode;function rn(e){throw RangeError($t[e])}function an(e,t){let n=[],r=e.length;for(;r--;)n[r]=t(e[r]);return n}function on(e,t){let n=e.split(`@`),r=``;n.length>1&&(r=n[0]+`@`,e=n[1]),e=e.replace(Qt,`.`);let i=an(e.split(`.`),t).join(`.`);return r+i}function sn(e){let t=[],n=0,r=e.length;for(;n<r;){let i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){let r=e.charCodeAt(n++);(r&64512)==56320?t.push(((i&1023)<<10)+(r&1023)+65536):(t.push(i),n--)}else t.push(i)}return t}var cn=e=>String.fromCodePoint(...e),ln=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:Ht},un=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},dn=function(e,t,n){let r=0;for(e=n?tn(e/Kt):e>>1,e+=tn(e/t);e>455;r+=Ht)e=tn(e/en);return tn(r+36*e/(e+Gt))},fn=function(e){let t=[],n=e.length,r=0,i=Jt,a=qt,o=e.lastIndexOf(Yt);o<0&&(o=0);for(let n=0;n<o;++n)e.charCodeAt(n)>=128&&rn(`not-basic`),t.push(e.charCodeAt(n));for(let s=o>0?o+1:0;s<n;){let o=r;for(let t=1,i=Ht;;i+=Ht){s>=n&&rn(`invalid-input`);let o=ln(e.charCodeAt(s++));o>=Ht&&rn(`invalid-input`),o>tn((Vt-r)/t)&&rn(`overflow`),r+=o*t;let c=i<=a?Ut:i>=a+Wt?Wt:i-a;if(o<c)break;let l=Ht-c;t>tn(Vt/l)&&rn(`overflow`),t*=l}let c=t.length+1;a=dn(r-o,c,o==0),tn(r/c)>Vt-i&&rn(`overflow`),i+=tn(r/c),r%=c,t.splice(r++,0,i)}return String.fromCodePoint(...t)},pn=function(e){let t=[];e=sn(e);let n=e.length,r=Jt,i=0,a=qt;for(let n of e)n<128&&t.push(nn(n));let o=t.length,s=o;for(o&&t.push(Yt);s<n;){let n=Vt;for(let t of e)t>=r&&t<n&&(n=t);let c=s+1;n-r>tn((Vt-i)/c)&&rn(`overflow`),i+=(n-r)*c,r=n;for(let n of e)if(n<r&&++i>Vt&&rn(`overflow`),n===r){let e=i;for(let n=Ht;;n+=Ht){let r=n<=a?Ut:n>=a+Wt?Wt:n-a;if(e<r)break;let i=e-r,o=Ht-r;t.push(nn(un(r+i%o,0))),e=tn(i/o)}t.push(nn(un(e,0))),a=dn(i,c,s===o),i=0,++s}++i,++r}return t.join(``)},mn={version:`2.3.1`,ucs2:{decode:sn,encode:cn},decode:fn,encode:pn,toASCII:function(e){return on(e,function(e){return Zt.test(e)?`xn--`+pn(e):e})},toUnicode:function(e){return on(e,function(e){return Xt.test(e)?fn(e.slice(4).toLowerCase()):e})}},hn=Object.defineProperty,gn=(e,t)=>{let n={};for(var r in e)hn(n,r,{get:e[r],enumerable:!0});return t||hn(n,Symbol.toStringTag,{value:`Module`}),n},_n=gn({arrayReplaceAt:()=>yn,asciiTrim:()=>Hn,callable:()=>vn,escapeHtml:()=>Mn,escapeRE:()=>Pn,fromCodePoint:()=>xn,isMdAsciiPunct:()=>zn,isPunctChar:()=>Ln,isPunctCharCode:()=>Rn,isSpace:()=>Fn,isValidEntityCode:()=>bn,isWhiteSpace:()=>In,lib:()=>Un,normalizeReference:()=>Bn,unescapeAll:()=>Dn,unescapeMd:()=>En});function vn(e){let t=function(...n){return Reflect.construct(e,n,new.target&&new.target!==t?new.target:e)};return Object.defineProperty(t,"name",{value:e.name}),Object.setPrototypeOf(t,e),t.prototype=e.prototype,t}function yn(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function bn(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function xn(e){if(e>65535){e-=65536;let t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var Sn=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,Cn=RegExp(`${Sn.source}|&([a-z#][a-z0-9]{1,31});`,`gi`),wn=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function Tn(e,t){if(t.charCodeAt(0)===35&&wn.test(t)){let n=t[1].toLowerCase()===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return bn(n)?xn(n):e}let n=jt(e);return n===e?e:n}function En(e){return e.indexOf(`\\`)<0?e:e.replace(Sn,`$1`)}function Dn(e){return e.indexOf(`\\`)<0&&e.indexOf(`&`)<0?e:e.replace(Cn,function(e,t,n){return t||Tn(e,n)})}var On=/[&<>"]/,kn=/[&<>"]/g,An={"&":`&`,"<":`<`,">":`>`,'"':`"`};function jn(e){return An[e]}function Mn(e){return On.test(e)?e.replace(kn,jn):e}var Nn=/[.?*+^$[\]\\(){}|-]/g;function Pn(e){return e.replace(Nn,`\\$&`)}function Fn(e){switch(e){case 9:case 32:return!0}return!1}function In(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function Ln(e){return rt.test(e)||it.test(e)}function Rn(e){return Ln(xn(e))}function zn(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function Bn(e){return e=e.trim().replace(/\s+/g,` `),e.toLowerCase().toUpperCase()}function Vn(e){return e===32||e===9||e===10||e===13}function Hn(e){let t=0;for(;t<e.length&&Vn(e.charCodeAt(t));t++);let n=e.length-1;for(;n>=t&&Vn(e.charCodeAt(n));n--);return e.slice(t,n+1)}var Un={mdurl:Qe,ucmicro:$e};function Wn(e,t,n){let r,i,a,o,s=e.posMax,c=e.pos;for(e.pos=t+1,r=1;e.pos<s;){if(a=e.src.charCodeAt(e.pos),a===93&&(r--,r===0)){i=!0;break}if(o=e.pos,e.md.inline.skipToken(e),a===91){if(o===e.pos-1)r++;else if(n)return e.pos=c,-1}}let l=-1;return i&&(l=e.pos),e.pos=c,l}function Gn(e,t,n){let r,i=t,a={ok:!1,pos:0,str:``};if(e.charCodeAt(i)===60){for(i++;i<n;){if(r=e.charCodeAt(i),r===10||r===60)return a;if(r===62)return a.pos=i+1,a.str=Dn(e.slice(t+1,i)),a.ok=!0,a;r===92&&i+1<n?i+=2:i++}return a}let o=0;for(;i<n&&(r=e.charCodeAt(i),!(r===32||r<32||r===127));)if(r===92&&i+1<n){if(e.charCodeAt(i+1)===32){i++;continue}i+=2}else{if(r===40&&(o++,o>32))return a;if(r===41){if(o===0)break;o--}i++}return t===i||o!==0||(a.str=Dn(e.slice(t,i)),a.pos=i,a.ok=!0),a}function Kn(e,t,n,r){let i,a=t,o={ok:!1,can_continue:!1,pos:0,str:``,marker:0};if(r)o.str=r.str,o.marker=r.marker;else{if(a>=n)return o;let r=e.charCodeAt(a);if(r!==34&&r!==39&&r!==40)return o;t++,a++,r===40&&(r=41),o.marker=r}for(;a<n;){if(i=e.charCodeAt(a),i===o.marker)return o.pos=a+1,o.str+=Dn(e.slice(t,a)),o.ok=!0,o;if(i===40&&o.marker===41)return o;i===92&&a+1<n&&a++,a++}return o.can_continue=!0,o.str+=Dn(e.slice(t,a)),o}var qn=gn({parseLinkDestination:()=>Gn,parseLinkLabel:()=>Wn,parseLinkTitle:()=>Kn});function Jn(e){"@babel/helpers - typeof";return Jn=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},Jn(e)}function Yn(e,t){if(Jn(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Jn(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Xn(e){var t=Yn(e,`string`);return Jn(t)==`symbol`?t:t+``}function Zn(e,t,n){return(t=Xn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Qn=class{constructor(e,t,n){Zn(this,`map`,null),Zn(this,`level`,0),Zn(this,`children`,null),Zn(this,`content`,``),Zn(this,`markup`,``),Zn(this,`info`,``),Zn(this,`block`,!1),Zn(this,`hidden`,!1),this.type=e,this.tag=t,this.attrs=null,this.nesting=n,this.meta=null}attrIndex(e){if(!this.attrs)return-1;let t=this.attrs;for(let n=0,r=t.length;n<r;n++)if(t[n][0]===e)return n;return-1}attrPush(e){this.attrs?this.attrs.push(e):this.attrs=[e]}attrSet(e,t){let n=this.attrIndex(e),r=[e,t];n<0?this.attrPush(r):this.attrs[n]=r}attrGet(e){let t=this.attrIndex(e),n=null;return t>=0&&(n=this.attrs[t][1]),n}attrJoin(e,t){let n=this.attrIndex(e);n<0?this.attrPush([e,t]):this.attrs[n][1]=`${this.attrs[n][1]} ${t}`}},$n=class{constructor(){Zn(this,`__rules__`,[]),Zn(this,`__cache__`,null)}__find__(e){for(let t=0;t<this.__rules__.length;t++)if(this.__rules__[t].name===e)return t;return-1}__compile__(){let e=new Set;this.__rules__.forEach(t=>{t.enabled&&t.alt.forEach(t=>{t&&e.add(t)})}),this.__cache__=Object.create(null),this.__cache__[``]=[],this.__rules__.forEach(e=>{e.enabled&&this.__cache__[``].push(e.fn)}),e.forEach(e=>{this.__cache__[e]=[],this.__rules__.forEach(t=>{t.enabled&&t.alt.indexOf(e)>=0&&this.__cache__[e].push(t.fn)})})}at(e,t,n={}){let r=this.__find__(e);if(r===-1)throw Error(`Parser rule not found: ${e}`);this.__rules__[r].fn=t,this.__rules__[r].alt=n.alt||[],this.__cache__=null}before(e,t,n,r={}){let i=this.__find__(e);if(i===-1)throw Error(`Parser rule not found: ${e}`);this.__rules__.splice(i,0,{name:t,enabled:!0,fn:n,alt:r.alt||[]}),this.__cache__=null}after(e,t,n,r={}){let i=this.__find__(e);if(i===-1)throw Error(`Parser rule not found: ${e}`);this.__rules__.splice(i+1,0,{name:t,enabled:!0,fn:n,alt:r.alt||[]}),this.__cache__=null}push(e,t,n={}){this.__rules__.push({name:e,enabled:!0,fn:t,alt:n.alt||[]}),this.__cache__=null}enable(e,t=!1){Array.isArray(e)||(e=[e]);let n=[];return e.forEach(e=>{let r=this.__find__(e);if(r<0){if(t)return;throw Error(`Rules manager: invalid rule name ${e}`)}this.__rules__[r].enabled=!0,n.push(e)}),this.__cache__=null,n}enableOnly(e,t=!1){Array.isArray(e)||(e=[e]),this.__rules__.forEach(e=>{e.enabled=!1}),this.enable(e,t)}disable(e,t=!1){Array.isArray(e)||(e=[e]);let n=[];return e.forEach(e=>{let r=this.__find__(e);if(r<0){if(t)return;throw Error(`Rules manager: invalid rule name ${e}`)}this.__rules__[r].enabled=!1,n.push(e)}),this.__cache__=null,n}getRules(e){return this.__cache__||this.__compile__(),this.__cache__[e]||[]}},er={};er.code_inline=function(e,t,n,r,i){let a=e[t];return`<code${i.renderAttrs(a)}>${Mn(a.content)}</code>`},er.code_block=function(e,t,n,r,i){let a=e[t];return`<pre${i.renderAttrs(a)}><code>${Mn(e[t].content)}</code></pre>\n`},er.fence=function(e,t,n,r,i){let a=e[t],o=a.info?Dn(a.info).trim():``,s=``,c=``;if(o){let e=o.split(/(\s+)/g);s=e[0],c=e.slice(2).join(``)}let l;if(l=n.highlight&&n.highlight(a.content,s,c)||Mn(a.content),l.indexOf(`<pre`)===0)return l+`
|
|
7
|
+
`;if(o){let e=a.attrIndex(`class`),t=a.attrs?a.attrs.slice():[];e<0?t.push([`class`,`${n.langPrefix}${s}`]):(t[e]=[t[e][0],t[e][1]],t[e][1]+=` ${n.langPrefix}${s}`);let r={attrs:t};return`<pre><code${i.renderAttrs(r)}>${l}</code></pre>\n`}return`<pre><code${i.renderAttrs(a)}>${l}</code></pre>\n`},er.image=function(e,t,n,r,i){let a=e[t];return a.attrs[a.attrIndex(`alt`)][1]=i.renderInlineAsText(a.children,n,r),i.renderToken(e,t,n)},er.hardbreak=function(e,t,n){return n.xhtmlOut?`<br />
|
|
8
|
+
`:`<br>
|
|
9
|
+
`},er.softbreak=function(e,t,n){return n.breaks?n.xhtmlOut?`<br />
|
|
10
|
+
`:`<br>
|
|
11
|
+
`:`
|
|
12
|
+
`},er.text=function(e,t){return Mn(e[t].content)},er.html_block=function(e,t){return e[t].content},er.html_inline=function(e,t){return e[t].content};var tr=class{constructor(){Zn(this,`rules`,Object.assign({},er))}renderAttrs(e){let t,n,r;if(!e.attrs)return``;for(r=``,t=0,n=e.attrs.length;t<n;t++)r+=` ${Mn(e.attrs[t][0])}="${Mn(String(e.attrs[t][1]))}"`;return r}renderToken(e,t,n){let r=e[t],i=``;if(r.hidden)return``;let a=t-1;for(;a>=0&&e[a].hidden&&e[a].nesting===0;)a--;r.block&&r.nesting!==-1&&a>=0&&e[a].hidden&&e[a].nesting===-1&&(i+=`
|
|
13
|
+
`),i+=(r.nesting===-1?`</`:`<`)+r.tag,i+=this.renderAttrs(r),r.nesting===0&&n.xhtmlOut&&(i+=` /`);let o=!1;if(r.block&&(o=!0,r.nesting===1)){let n=t+1;for(;n<e.length&&e[n].hidden&&e[n].nesting===0;)n++;if(n<e.length){let t=e[n];(t.type===`inline`||t.hidden||t.nesting===-1&&t.tag===r.tag)&&(o=!1)}}return i+=o?`>
|
|
14
|
+
`:`>`,i}renderInline(e,t,n){let r=``,i=this.rules;for(let a=0,o=e.length;a<o;a++){let o=e[a].type;i[o]===void 0?r+=this.renderToken(e,a,t):r+=i[o](e,a,t,n,this)}return r}renderInlineAsText(e,t,n){let r=``;for(let i=0,a=e.length;i<a;i++)switch(e[i].type){case`text`:case`code_inline`:r+=e[i].content;break;case`image`:r+=this.renderInlineAsText(e[i].children,t,n);break;case`html_inline`:case`html_block`:r+=e[i].content;break;case`softbreak`:case`hardbreak`:r+=`
|
|
15
|
+
`}return r}render(e,t,n){let r=``,i=this.rules;for(let a=0,o=e.length;a<o;a++){let o=e[a].type;o===`inline`?r+=this.renderInline(e[a].children,t,n):i[o]===void 0?r+=this.renderToken(e,a,t):r+=i[o](e,a,t,n,this)}return r}},nr=class{constructor(e,t,n){Zn(this,`tokens`,[]),Zn(this,`inlineMode`,!1),Zn(this,`Token`,Qn),this.src=e,this.env=n,this.md=t}},rr=/\r\n?/g,ir=/\0/g;function ar(e){let t;t=e.src.replace(rr,`
|
|
16
|
+
`),t=t.replace(ir,`�`),e.src=t}function or(e){let t;e.inlineMode?(t=new e.Token(`inline`,``,0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function sr(e){let t=e.tokens,n=0;for(let e=0;e<t.length;e++)t[e].type!==`reference_definition`&&(e!==n&&(t[n]=t[e]),n++);t.length!==n&&(t.length=n)}function cr(e){let t=e.tokens;for(let n=0,r=t.length;n<r;n++){let r=t[n];r.type===`inline`&&e.md.inline.parse(r.content,e.md,e.env,r.children)}}function lr(e){return/^<a[>\s]/i.test(e)}function ur(e){return/^<\/a\s*>/i.test(e)}function dr(e){let t=e.tokens;if(e.md.options.linkify)for(let n=0,r=t.length;n<r;n++){if(t[n].type!==`inline`||!e.md.linkify.test(t[n].content))continue;let r=t[n].children,i=[],a=0;for(let t=r.length-1;t>=0;t--){let n=r[t];if(n.type===`link_close`)for(t--;r[t].level!==n.level&&r[t].type!==`link_open`;)t--;else if(n.type===`html_inline`&&(lr(n.content)&&a>0&&a--,ur(n.content)&&a++),!(a>0)&&n.type===`text`&&e.md.linkify.test(n.content)){let a=n.content,o=e.md.linkify.match(a),s=[],c=n.level,l=0;o.length>0&&o[0].index===0&&t>0&&r[t-1].type===`text_special`&&(o=o.slice(1));for(let t=0;t<o.length;t++){let n=o[t].url,r=e.md.normalizeLink(n);if(!e.md.validateLink(r))continue;let i=o[t].text;i=o[t].schema?o[t].schema===`mailto:`&&!/^mailto:/i.test(i)?e.md.normalizeLinkText(`mailto:${i}`).replace(/^mailto:/,``):e.md.normalizeLinkText(i):e.md.normalizeLinkText(`http://${i}`).replace(/^http:\/\//,``);let u=o[t].index;if(u>l){let t=new e.Token(`text`,``,0);t.content=a.slice(l,u),t.level=c,s.push(t)}let d=new e.Token(`link_open`,`a`,1);d.attrs=[[`href`,r]],d.level=c++,d.markup=`linkify`,d.info=`auto`,s.push(d);let f=new e.Token(`text`,``,0);f.content=i,f.level=c,s.push(f);let p=new e.Token(`link_close`,`a`,-1);p.level=--c,p.markup=`linkify`,p.info=`auto`,s.push(p),l=o[t].lastIndex}if(l<a.length){let t=new e.Token(`text`,``,0);t.content=a.slice(l),t.level=c,s.push(t)}i.push({index:t,nodes:s})}}if(i.length>0){let e=r.length;for(let t of i)e+=t.nodes.length-1;let a=Array(e),o=0,s=0;i.reverse();for(let e=0;e<r.length;e++){let t=i[o];if(t?.index===e){for(let e of t.nodes)a[s++]=e;o++}else a[s++]=r[e]}t[n].children=a}}}var fr=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,pr=/\((c|tm|r)\)/i,mr=/\((c|tm|r)\)/gi,hr={c:`©`,r:`®`,tm:`™`};function gr(e,t){return hr[t.toLowerCase()]}function _r(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&(r.content=r.content.replace(mr,gr)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function vr(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&fr.test(r.content)&&(r.content=r.content.replace(/\+-/g,`±`).replace(/\.{2,}/g,`…`).replace(/([?!])…/g,`$1..`).replace(/([?!]){4,}/g,`$1$1$1`).replace(/,{2,}/g,`,`).replace(/(^|[^-])---(?=[^-]|$)/gm,`$1—`).replace(/(^|\s)--(?=\s|$)/gm,`$1–`).replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,`$1–`)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function yr(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type===`inline`&&(pr.test(e.tokens[t].content)&&_r(e.tokens[t].children),fr.test(e.tokens[t].content)&&vr(e.tokens[t].children))}var br=/['"]/,xr=/['"]/g,Sr=`’`,Cr=1e3;function wr(e,t,n){for(;e.length>n;){let n=e.pop();n.isSingleQuote?t.single=n.prevSameQuoteIdx:t.double=n.prevSameQuoteIdx}}function Tr(e,t,n,r){e[t]||(e[t]=[]),e[t].push({pos:n,ch:r})}function Er(e,t){let n=``,r=0;t.sort((e,t)=>e.pos-t.pos);for(let i=0;i<t.length;i++){let a=t[i];n+=e.slice(r,a.pos)+a.ch,r=a.pos+1}return n+e.slice(r)}function Dr(e,t){let n,r=[],i={single:-1,double:-1},a={};for(let o=0;o<e.length;o++){let s=e[o],c=e[o].level;for(n=r.length-1;n>=0&&!(r[n].level<=c);n--);if(wr(r,i,n+1),s.type!==`text`)continue;let l=s.content,u=0,d=l.length;OUTER:for(;u<d;){xr.lastIndex=u;let s=xr.exec(l);if(!s)break;let f=!0,p=!0;u=s.index+1;let m=s[0]===`'`,h=32;if(s.index-1>=0)h=l.charCodeAt(s.index-1);else for(n=o-1;n>=0&&e[n].type!==`softbreak`&&e[n].type!==`hardbreak`;n--)if(e[n].content){h=e[n].content.charCodeAt(e[n].content.length-1);break}let g=32;if(u<d)g=l.charCodeAt(u);else for(n=o+1;n<e.length&&e[n].type!==`softbreak`&&e[n].type!==`hardbreak`;n++)if(e[n].content){g=e[n].content.charCodeAt(0);break}let _=zn(h)||Rn(h),v=zn(g)||Rn(g),y=In(h),b=In(g);if(b?f=!1:v&&(y||_||(f=!1)),y?p=!1:_&&(b||v||(p=!1)),g===34&&s[0]===`"`&&h>=48&&h<=57&&(p=f=!1),f&&p&&(f=_,p=v),!f&&!p)m&&Tr(a,o,s.index,Sr);else{if(p&&(n=m?i.single:i.double,n>=0&&r[n].level===c)){let e=r[n],c,l;m?(c=t.md.options.quotes[2],l=t.md.options.quotes[3]):(c=t.md.options.quotes[0],l=t.md.options.quotes[1]),Tr(a,o,s.index,l),Tr(a,e.tokenIdx,e.contentPos,c),wr(r,i,n);continue OUTER}if(f){if(r.length>=Cr)return;r.push({tokenIdx:o,contentPos:s.index,isSingleQuote:m,level:c,prevSameQuoteIdx:m?i.single:i.double}),m?i.single=r.length-1:i.double=r.length-1}else p&&m&&Tr(a,o,s.index,Sr)}}}Object.keys(a).forEach(function(t){let n=Number(t);e[n].content=Er(e[n].content,a[t])})}function Or(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type===`inline`&&br.test(e.tokens[t].content)&&Dr(e.tokens[t].children,e)}function kr(e){let t,n,r=e.length;for(t=0;t<r;t++)e[t].type===`text_special`&&(e[t].type=`text`);for(t=n=0;t<r;t++)e[t].type===`text`&&t+1<r&&e[t+1].type===`text`?e[t+1].content=e[t].content+e[t+1].content:(t!==n&&(e[n]=e[t]),n++);t!==n&&(e.length=n)}function Ar(e){let t,n,r=e.tokens,i=r.length;for(let e=0;e<i;e++){if(r[e].type!==`inline`)continue;let i=r[e].children,a=i.length;for(t=0;t<a;t++)i[t].type===`text_special`&&(i[t].type=`text`),i[t].children&&kr(i[t].children);for(t=n=0;t<a;t++)i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}}var jr=[[`normalize`,ar],[`block`,or],[`strip_references`,sr],[`inline`,cr],[`linkify`,dr],[`replacements`,yr],[`smartquotes`,Or],[`text_join`,Ar]],Mr=class{constructor(){Zn(this,`ruler`,new $n),Zn(this,`State`,nr);for(let e=0;e<jr.length;e++)this.ruler.push(jr[e][0],jr[e][1])}process(e){let t=this.ruler.getRules(``);for(let n=0,r=t.length;n<r;n++)t[n](e)}},Nr=class{constructor(e,t,n,r){Zn(this,`bMarks`,[]),Zn(this,`eMarks`,[]),Zn(this,`tShift`,[]),Zn(this,`sCount`,[]),Zn(this,`bsCount`,[]),Zn(this,`blkIndent`,0),Zn(this,`line`,0),Zn(this,`lineMax`,0),Zn(this,`tight`,!1),Zn(this,`listIndent`,-1),Zn(this,`parentType`,`root`),Zn(this,`level`,0),Zn(this,`Token`,Qn),this.src=e,this.md=t,this.env=n,this.tokens=r;let i=this.src;for(let e=0,t=0,n=0,r=0,a=i.length,o=!1;t<a;t++){let s=i.charCodeAt(t);if(!o){if(Fn(s)){n++,s===9?r+=4-r%4:r++;continue}o=!0}(s===10||t===a-1)&&(s!==10&&t++,this.bMarks.push(e),this.eMarks.push(t),this.tShift.push(n),this.sCount.push(r),this.bsCount.push(0),o=!1,n=0,r=0,e=t+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}push(e,t,n){let r=new Qn(e,t,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r}isEmpty(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]}skipEmptyLines(e){for(let t=this.lineMax;e<t&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e}skipSpaces(e){for(let t=this.src.length;e<t&&Fn(this.src.charCodeAt(e));e++);return e}skipSpacesBack(e,t){if(e<=t)return e;for(;e>t;)if(!Fn(this.src.charCodeAt(--e)))return e+1;return e}skipChars(e,t){for(let n=this.src.length;e<n&&this.src.charCodeAt(e)===t;e++);return e}skipCharsBack(e,t,n){if(e<=n)return e;for(;e>n;)if(t!==this.src.charCodeAt(--e))return e+1;return e}getLines(e,t,n,r){if(e>=t)return``;let i=Array(t-e);for(let a=0,o=e;o<t;o++,a++){let e=0,s=this.bMarks[o],c=s,l;for(l=o+1<t||r?this.eMarks[o]+1:this.eMarks[o];c<l&&e<n;){let t=this.src.charCodeAt(c);if(Fn(t))t===9?e+=4-(e+this.bsCount[o])%4:e++;else if(c-s<this.tShift[o])e++;else break;c++}e>n?i[a]=Array(e-n+1).join(` `)+this.src.slice(c,l):i[a]=this.src.slice(c,l)}return i.join(``)}},Pr=65536;function Fr(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function Ir(e){let t=[],n=e.length,r=0,i=e.charCodeAt(r),a=!1,o=0,s=``;for(;r<n;)i===124&&(a?(s+=e.substring(o,r-1),o=r):(t.push(s+e.substring(o,r)),s=``,o=r+1)),a=i===92,r++,i=e.charCodeAt(r);return t.push(s+e.substring(o)),t}function Lr(e,t,n,r){if(t+2>n)return!1;let i=t+1;if(e.sCount[i]<e.blkIndent||e.sCount[i]-e.blkIndent>=4)return!1;let a=e.bMarks[i]+e.tShift[i];if(a>=e.eMarks[i])return!1;let o=e.src.charCodeAt(a++);if(o!==124&&o!==45&&o!==58||a>=e.eMarks[i])return!1;let s=e.src.charCodeAt(a++);if(s!==124&&s!==45&&s!==58&&!Fn(s)||o===45&&Fn(s))return!1;for(;a<e.eMarks[i];){let t=e.src.charCodeAt(a);if(t!==124&&t!==45&&t!==58&&!Fn(t))return!1;a++}let c=Fr(e,t+1),l=c.split(`|`),u=[];for(let e=0;e<l.length;e++){let t=l[e].trim();if(!t){if(e===0||e===l.length-1)continue;return!1}if(!/^:?-+:?$/.test(t))return!1;t.charCodeAt(t.length-1)===58?u.push(t.charCodeAt(0)===58?`center`:`right`):t.charCodeAt(0)===58?u.push(`left`):u.push(``)}if(c=Fr(e,t).trim(),c.indexOf(`|`)===-1||e.sCount[t]-e.blkIndent>=4)return!1;l=Ir(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop();let d=l.length;if(d===0||d!==u.length)return!1;if(r)return!0;let f=e.parentType;e.parentType=`table`;let p=e.md.block.ruler.getRules(`blockquote`),m=e.push(`table_open`,`table`,1),h=[t,0];m.map=h;let g=e.push(`thead_open`,`thead`,1);g.map=[t,t+1];let _=e.push(`tr_open`,`tr`,1);_.map=[t,t+1];for(let t=0;t<l.length;t++){let n=e.push(`th_open`,`th`,1);u[t]&&(n.attrs=[[`style`,`text-align:${u[t]}`]]);let r=e.push(`inline`,``,0);r.content=l[t].trim(),r.children=[],e.push(`th_close`,`th`,-1)}e.push(`tr_close`,`tr`,-1),e.push(`thead_close`,`thead`,-1);let v,y=0;for(i=t+2;i<n&&!(e.sCount[i]<e.blkIndent);i++){let r=!1;for(let t=0,a=p.length;t<a;t++)if(p[t](e,i,n,!0)){r=!0;break}if(r||(c=Fr(e,i).trim(),!c)||e.sCount[i]-e.blkIndent>=4||(l=Ir(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop(),y+=d-l.length,y>Pr))break;if(i===t+2){let n=e.push(`tbody_open`,`tbody`,1);n.map=v=[t+2,0]}let a=e.push(`tr_open`,`tr`,1);a.map=[i,i+1];for(let t=0;t<d;t++){let n=e.push(`td_open`,`td`,1);u[t]&&(n.attrs=[[`style`,`text-align:${u[t]}`]]);let r=e.push(`inline`,``,0);r.content=l[t]?l[t].trim():``,r.children=[],e.push(`td_close`,`td`,-1)}e.push(`tr_close`,`tr`,-1)}return v&&(e.push(`tbody_close`,`tbody`,-1),v[1]=i),e.push(`table_close`,`table`,-1),h[1]=i,e.parentType=f,e.line=i,!0}function Rr(e,t,n){if(e.sCount[t]-e.blkIndent<4)return!1;let r=t+1,i=r;for(;r<n;)if(e.isEmpty(r))r++;else if(e.sCount[r]-e.blkIndent>=4)r++,i=r;else break;e.line=i;let a=e.push(`code_block`,`code`,0);return a.content=e.getLines(t,i,4+e.blkIndent,!1)+`
|
|
17
|
+
`,a.map=[t,e.line],!0}function zr(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||i+3>a)return!1;let o=e.src.charCodeAt(i);if(o!==126&&o!==96)return!1;let s=i;i=e.skipChars(i,o);let c=i-s;if(c<3)return!1;let l=e.src.slice(s,i),u=e.src.slice(i,a);if(o===96&&u.indexOf(String.fromCharCode(o))>=0)return!1;if(r)return!0;let d=t,f=!1;for(;d++,!(d>=n||(i=s=e.bMarks[d]+e.tShift[d],a=e.eMarks[d],i<a&&e.sCount[d]<e.blkIndent));)if(e.src.charCodeAt(i)===o&&!(e.sCount[d]-e.blkIndent>=4)&&(i=e.skipChars(i,o),!(i-s<c)&&(i=e.skipSpaces(i),!(i<a)))){f=!0;break}c=e.sCount[t],e.line=d+ +!!f;let p=e.push(`fence`,`code`,0);return p.info=u,p.content=e.getLines(t+1,d,c,!0),p.markup=l,p.map=[t,e.line],!0}function Br(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=e.lineMax;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==62)return!1;if(r)return!0;let s=[],c=[],l=[],u=[],d=e.md.block.ruler.getRules(`blockquote`),f=e.parentType;e.parentType=`blockquote`;let p=!1,m;for(m=t;m<n;m++){let t=e.sCount[m]<e.blkIndent;if(i=e.bMarks[m]+e.tShift[m],a=e.eMarks[m],i>=a)break;if(e.src.charCodeAt(i++)===62&&!t){let t=e.sCount[m]+1,n,r;e.src.charCodeAt(i)===32?(i++,t++,r=!1,n=!0):e.src.charCodeAt(i)===9?(n=!0,(e.bsCount[m]+t)%4==3?(i++,t++,r=!1):r=!0):n=!1;let o=t;for(s.push(e.bMarks[m]),e.bMarks[m]=i;i<a;){let t=e.src.charCodeAt(i);if(Fn(t))t===9?o+=4-(o+e.bsCount[m]+ +!!r)%4:o++;else break;i++}p=i>=a,c.push(e.bsCount[m]),e.bsCount[m]=e.sCount[m]+1+ +!!n,l.push(e.sCount[m]),e.sCount[m]=o-t,u.push(e.tShift[m]),e.tShift[m]=i-e.bMarks[m];continue}if(p)break;let r=!1;for(let t=0,i=d.length;t<i;t++)if(d[t](e,m,n,!0)){r=!0;break}if(r){e.lineMax=m,e.blkIndent!==0&&(s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]-=e.blkIndent);break}s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]=-1}let h=e.blkIndent;e.blkIndent=0;let g=e.push(`blockquote_open`,`blockquote`,1);g.markup=`>`;let _=[t,0];g.map=_,e.md.block.tokenize(e,t,m);let v=e.push(`blockquote_close`,`blockquote`,-1);v.markup=`>`,e.lineMax=o,e.parentType=f,_[1]=e.line;for(let n=0;n<u.length;n++)e.bMarks[n+t]=s[n],e.tShift[n+t]=u[n],e.sCount[n+t]=l[n],e.bsCount[n+t]=c[n];return e.blkIndent=h,!0}function Vr(e,t,n,r){let i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let a=e.bMarks[t]+e.tShift[t],o=e.src.charCodeAt(a++);if(o!==42&&o!==45&&o!==95)return!1;let s=1;for(;a<i;){let t=e.src.charCodeAt(a++);if(t!==o&&!Fn(t))return!1;t===o&&s++}if(s<3)return!1;if(r)return!0;e.line=t+1;let c=e.push(`hr`,`hr`,0);return c.map=[t,e.line],c.markup=Array(s+1).join(String.fromCharCode(o)),!0}function Hr(e,t){let n=e.eMarks[t],r=e.bMarks[t]+e.tShift[t],i=e.src.charCodeAt(r++);return i!==42&&i!==45&&i!==43||r<n&&!Fn(e.src.charCodeAt(r))?-1:r}function Ur(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t],i=n;if(i+1>=r)return-1;let a=e.src.charCodeAt(i++);if(a<48||a>57)return-1;for(;;){if(i>=r)return-1;if(a=e.src.charCodeAt(i++),a>=48&&a<=57){if(i-n>=10)return-1}else{if(a===41||a===46)break;return-1}}return i<r&&(a=e.src.charCodeAt(i),!Fn(a))?-1:i}function Wr(e,t){let n=e.level+2;for(let r=t+2,i=e.tokens.length-2;r<i;r++)e.tokens[r].level===n&&e.tokens[r].type===`paragraph_open`&&(e.tokens[r+2].hidden=!0,e.tokens[r].hidden=!0,r+=2)}function Gr(e,t,n,r){let i,a,o,s,c=t,l=!0;if(e.sCount[c]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[c]-e.listIndent>=4&&e.sCount[c]<e.blkIndent)return!1;let u=!1;r&&e.parentType===`paragraph`&&e.sCount[c]>=e.blkIndent&&(u=!0);let d,f,p;if((p=Ur(e,c))>=0){if(d=!0,o=e.bMarks[c]+e.tShift[c],f=Number(e.src.slice(o,p-1)),u&&f!==1)return!1}else if((p=Hr(e,c))>=0)d=!1;else return!1;if(u&&e.skipSpaces(p)>=e.eMarks[c])return!1;if(r)return!0;let m=e.src.charCodeAt(p-1),h=e.tokens.length;d?(s=e.push(`ordered_list_open`,`ol`,1),f!==1&&(s.attrs=[[`start`,f]])):s=e.push(`bullet_list_open`,`ul`,1);let g=[c,0];s.map=g,s.markup=String.fromCharCode(m);let _=!1,v=e.md.block.ruler.getRules(`list`),y=e.parentType;for(e.parentType=`list`;c<n;){a=p,i=e.eMarks[c];let t=e.sCount[c]+p-(e.bMarks[c]+e.tShift[c]),r=t;for(;a<i;){let t=e.src.charCodeAt(a);if(t===9)r+=4-(r+e.bsCount[c])%4;else if(t===32)r++;else break;a++}let u=a,f;f=u>=i?1:r-t,f>4&&(f=1);let h=t+f;s=e.push(`list_item_open`,`li`,1),s.markup=String.fromCharCode(m);let g=[c,0];s.map=g,d&&(s.info=e.src.slice(o,p-1));let y=e.tight,b=e.tShift[c],x=e.sCount[c],S=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=h,e.tight=!0,e.tShift[c]=u-e.bMarks[c],e.sCount[c]=r,u>=i&&e.isEmpty(c+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,c,n),(!e.tight||_)&&(l=!1),_=e.line-c>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=S,e.tShift[c]=b,e.sCount[c]=x,e.tight=y,s=e.push(`list_item_close`,`li`,-1),s.markup=String.fromCharCode(m),c=e.line,g[1]=c,c>=n||e.sCount[c]<e.blkIndent||e.sCount[c]-e.blkIndent>=4)break;let C=!1;for(let t=0,r=v.length;t<r;t++)if(v[t](e,c,n,!0)){C=!0;break}if(C)break;if(d){if(p=Ur(e,c),p<0)break;o=e.bMarks[c]+e.tShift[c]}else if(p=Hr(e,c),p<0)break;if(m!==e.src.charCodeAt(p-1))break}return s=d?e.push(`ordered_list_close`,`ol`,-1):e.push(`bullet_list_close`,`ul`,-1),s.markup=String.fromCharCode(m),g[1]=c,e.line=c,e.parentType=y,l&&Wr(e,h),!0}function Kr(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=t+1;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==91)return!1;function s(t){let n=e.lineMax;if(t>=n||e.isEmpty(t))return null;let r=!1;if(e.sCount[t]-e.blkIndent>3&&(r=!0),e.sCount[t]<0&&(r=!0),!r){let r=e.md.block.ruler.getRules(`reference`),i=e.parentType;e.parentType=`reference`;let a=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,t,n,!0)){a=!0;break}if(e.parentType=i,a)return null}let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];return e.src.slice(i,a+1)}let c=e.src.slice(i,a+1);a=c.length;let l=-1;for(i=1;i<a;i++){let e=c.charCodeAt(i);if(e===91)return!1;if(e===93){l=i;break}if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(e===92&&(i++,i<a&&c.charCodeAt(i)===10)){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}}if(l<0||c.charCodeAt(l+1)!==58)return!1;for(i=l+2;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!Fn(e))break}let u=e.md.helpers.parseLinkDestination(c,i,a);if(!u.ok)return!1;let d=e.md.normalizeLink(u.str);if(!e.md.validateLink(d))return!1;i=u.pos;let f=i,p=o,m=i;for(;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!Fn(e))break}let h=e.md.helpers.parseLinkTitle(c,i,a);for(;h.can_continue;){let t=s(o);if(t===null)break;c+=t,i=a,a=c.length,o++,h=e.md.helpers.parseLinkTitle(c,i,a,h)}let g;for(i<a&&m!==i&&h.ok?(g=h.str,i=h.pos):(g=``,i=f,o=p);i<a&&Fn(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10&&g)for(g=``,i=f,o=p;i<a&&Fn(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10)return!1;let _=Bn(c.slice(1,l));if(!_)return!1;if(r)return!0;e.env.references===void 0&&(e.env.references={}),e.env.references[_]===void 0&&(e.env.references[_]={title:g,href:d});let v=e.push(`reference_definition`,``,0);v.map=[t,o],v.hidden=!0;let y=Object.create(null);return y.label=_,v.meta=y,e.line=o,!0}var qr=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),Jr=`<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,Yr=`<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>`,Xr=RegExp(`^(?:${Jr}|${Yr}|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`),Zr=RegExp(`^(?:${Jr}|${Yr})`),Qr=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Za-z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[RegExp(`^</?(${qr.join(`|`)})(?=(\\s|/?>|$))`,`i`),/^$/,!0],[RegExp(`${Zr.source}\\s*$`),/^$/,!1]];function $r(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(i)!==60)return!1;let o=e.src.slice(i,a),s=0;for(;s<Qr.length&&!Qr[s][0].test(o);s++);if(s===Qr.length)return!1;if(r)return Qr[s][2];let c=t+1,l=Qr[s][1].test(``);if(!Qr[s][1].test(o)){for(;c<n&&!(e.sCount[c]<e.blkIndent&&(l||!e.isEmpty(c)));c++)if(i=e.bMarks[c]+e.tShift[c],a=e.eMarks[c],o=e.src.slice(i,a),Qr[s][1].test(o)){o.length!==0&&c++;break}}e.line=c;let u=e.push(`html_block`,``,0);return u.map=[t,c],u.content=e.getLines(t,c,e.blkIndent,!0),!0}function ei(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let o=e.src.charCodeAt(i);if(o!==35||i>=a)return!1;let s=1;for(o=e.src.charCodeAt(++i);o===35&&i<a&&s<=6;)s++,o=e.src.charCodeAt(++i);if(s>6||i<a&&!Fn(o))return!1;if(r)return!0;a=e.skipSpacesBack(a,i);let c=e.skipCharsBack(a,35,i);c>i&&Fn(e.src.charCodeAt(c-1))&&(a=c),e.line=t+1;let l=e.push(`heading_open`,`h${s}`,1);l.markup=`########`.slice(0,s),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=Hn(e.src.slice(i,a)),u.map=[t,e.line],u.children=[];let d=e.push(`heading_close`,`h${s}`,-1);return d.markup=`########`.slice(0,s),!0}function ti(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`);if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.parentType;e.parentType=`paragraph`;let a=0,o,s=t+1;for(;s<n&&!e.isEmpty(s);s++){if(e.sCount[s]-e.blkIndent>3)continue;if(e.sCount[s]>=e.blkIndent){let t=e.bMarks[s]+e.tShift[s],n=e.eMarks[s];if(t<n&&(o=e.src.charCodeAt(t),(o===45||o===61)&&(t=e.skipChars(t,o),t=e.skipSpaces(t),t>=n))){a=o===61?1:2;break}}if(e.sCount[s]<0)continue;let t=!1;for(let i=0,a=r.length;i<a;i++)if(r[i](e,s,n,!0)){t=!0;break}if(t)break}if(!a)return e.parentType=i,!1;let c=Hn(e.getLines(t,s,e.blkIndent,!1));e.line=s+1;let l=e.push(`heading_open`,`h${a}`,1);l.markup=String.fromCharCode(o),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=c,u.map=[t,e.line-1],u.children=[];let d=e.push(`heading_close`,`h${a}`,-1);return d.markup=String.fromCharCode(o),e.parentType=i,!0}function ni(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`),i=e.parentType,a=t+1;for(e.parentType=`paragraph`;a<n&&!e.isEmpty(a);a++){if(e.sCount[a]-e.blkIndent>3||e.sCount[a]<0)continue;let t=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,a,n,!0)){t=!0;break}if(t)break}let o=Hn(e.getLines(t,a,e.blkIndent,!1));e.line=a;let s=e.push(`paragraph_open`,`p`,1);s.map=[t,e.line];let c=e.push(`inline`,``,0);return c.content=o,c.map=[t,e.line],c.children=[],e.push(`paragraph_close`,`p`,-1),e.parentType=i,!0}var ri=[[`table`,Lr,[`paragraph`,`reference`]],[`code`,Rr],[`fence`,zr,[`paragraph`,`reference`,`blockquote`,`list`]],[`blockquote`,Br,[`paragraph`,`reference`,`blockquote`,`list`]],[`hr`,Vr,[`paragraph`,`reference`,`blockquote`,`list`]],[`list`,Gr,[`paragraph`,`reference`,`blockquote`]],[`reference`,Kr],[`html_block`,$r,[`paragraph`,`reference`,`blockquote`]],[`heading`,ei,[`paragraph`,`reference`,`blockquote`]],[`lheading`,ti],[`paragraph`,ni]],ii=class{constructor(){Zn(this,`ruler`,new $n),Zn(this,`State`,Nr);for(let e=0;e<ri.length;e++)this.ruler.push(ri[e][0],ri[e][1],{alt:(ri[e][2]||[]).slice()})}tokenize(e,t,n){let r=this.ruler.getRules(``),i=r.length,a=e.md.options.maxNesting,o=t,s=!1;for(;o<n&&(e.line=o=e.skipEmptyLines(o),!(o>=n||e.sCount[o]<e.blkIndent));){if(e.level>=a){e.line=n;break}let t=e.line,c=!1;for(let a=0;a<i;a++)if(c=r[a](e,o,n,!1),c){if(t>=e.line)throw Error(`block rule didn't increment state.line`);break}if(!c)throw Error(`none of the block rules matched`);e.tight=!s,e.isEmpty(e.line-1)&&(s=!0),o=e.line,o<n&&e.isEmpty(o)&&(s=!0,o++,e.line=o)}}parse(e,t,n,r){if(!e)return;let i=new this.State(e,t,n,r);this.tokenize(i,i.line,i.lineMax)}},ai=class{constructor(e,t,n,r){Zn(this,`pos`,0),Zn(this,`level`,0),Zn(this,`pending`,``),Zn(this,`pendingLevel`,0),Zn(this,`cache`,{}),Zn(this,`backticks`,{}),Zn(this,`backticksScanned`,!1),Zn(this,`linkLevel`,0),Zn(this,`delimiters`,[]),Zn(this,`_prev_delimiters`,[]),Zn(this,`Token`,Qn),this.src=e,this.env=n,this.md=t,this.tokens=r,this.tokens_meta=Array(r.length),this.posMax=this.src.length}pushPending(){let e=new Qn(`text`,``,0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending=``,e}push(e,t,n){this.pending&&this.pushPending();let r=new Qn(e,t,n),i;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r}scanDelims(e,t){let n=this.posMax,r=this.src.charCodeAt(e),i;if(e===0)i=32;else if(e===1)i=this.src.charCodeAt(0),(i&63488)==55296&&(i=65533);else if(i=this.src.charCodeAt(e-1),(i&64512)==56320){let t=this.src.charCodeAt(e-2);i=(t&64512)==55296?65536+(t-55296<<10)+(i-56320):65533}else(i&64512)==55296&&(i=65533);let a=e;for(;a<n&&this.src.charCodeAt(a)===r;)a++;let o=a-e,s=a<n?this.src.charCodeAt(a):32;if((s&64512)==55296){let e=this.src.charCodeAt(a+1);s=(e&64512)==56320?65536+(s-55296<<10)+(e-56320):65533}else(s&64512)==56320&&(s=65533);let c=zn(i)||Rn(i),l=zn(s)||Rn(s),u=In(i),d=In(s),f=!d&&(!l||u||c),p=!u&&(!c||d||l);return{can_open:f&&(t||!p||c),can_close:p&&(t||!f||l),length:o}}};function oi(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function si(e,t){let n=e.pos;for(;n<e.posMax&&!oi(e.src.charCodeAt(n));)n++;return n!==e.pos&&(t||(e.pending+=e.src.slice(e.pos,n)),e.pos=n,!0)}function ci(e){return e>=65&&e<=90||e>=97&&e<=122}function li(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===45||e===46}function ui(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;let n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;let i=n-Math.min(10,e.pending.length,n),a=n;for(;a>i&&li(e.src.charCodeAt(a-1));)a--;if(a===n||!ci(e.src.charCodeAt(a)))return!1;let o=n-a,s=e.md.linkify.matchAtStart(e.src.slice(a));if(!s)return!1;let c=s.url;if(c.length<=o)return!1;let l=c.length;for(;l>0&&c.charCodeAt(l-1)===42;)l--;l!==c.length&&(c=c.slice(0,l));let u=e.md.normalizeLink(c);if(!e.md.validateLink(u))return!1;if(!t){e.pending=e.pending.slice(0,-o);let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,u]],t.markup=`linkify`,t.info=`auto`;let n=e.push(`text`,``,0);n.content=e.md.normalizeLinkText(c);let r=e.push(`link_close`,`a`,-1);r.markup=`linkify`,r.info=`auto`}return e.pos+=c.length-o,!0}function di(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;let r=e.pending.length-1,i=e.posMax;if(!t){if(r>=0&&e.pending.charCodeAt(r)===32){if(r>=1&&e.pending.charCodeAt(r-1)===32){let t=r-1;for(;t>=1&&e.pending.charCodeAt(t-1)===32;)t--;e.pending=e.pending.slice(0,t),e.push(`hardbreak`,`br`,0)}else e.pending=e.pending.slice(0,-1),e.push(`softbreak`,`br`,0)}else e.push(`softbreak`,`br`,0)}for(n++;n<i&&Fn(e.src.charCodeAt(n));)n++;return e.pos=n,!0}var fi=[];for(let e=0;e<256;e++)fi.push(0);`\\!"#$%&'()*+,./:;<=>?@[]^_\`{|}~-`.split(``).forEach(function(e){fi[e.charCodeAt(0)]=1});function pi(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=e.src.charCodeAt(n);if(i===10){for(t||e.push(`hardbreak`,`br`,0),n++;n<r&&(i=e.src.charCodeAt(n),Fn(i));)n++;return e.pos=n,!0}if(i===32){if(!t){let t=e.push(`text_special`,``,0);t.content=`\\`,t.markup=`\\`,t.info=`escape`}return e.pos=n,!0}let a=e.src[n];if(i>=55296&&i<=56319&&n+1<r){let t=e.src.charCodeAt(n+1);t>=56320&&t<=57343&&(a+=e.src[n+1],n++)}let o=`\\`+a;if(!t){let t=e.push(`text_special`,``,0);t.content=i<256&&fi[i]!==0?a:o,t.markup=o,t.info=`escape`}return e.pos=n+1,!0}function mi(e){let t={},n=0;for(;(n=e.indexOf("`",n))!==-1;){let r=n;for(;e.charCodeAt(++n)===96;);t[n-r]=r}return t}function hi(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==96)return!1;let r=e.posMax,i=n+1;for(;i<r&&e.src.charCodeAt(i)===96;)i++;let a=e.src.slice(n,i),o=a.length;if(e.backticksScanned||=(e.backticks=mi(e.src),!0),(e.backticks[o]??-1)>=i){let n=i,s;for(;(s=e.src.indexOf("`",n))!==-1&&s<r;){for(n=s+1;e.src.charCodeAt(n)===96;)n++;if(n>r)break;if(n-s===o){if(!t){let t=e.push(`code_inline`,`code`,0);t.markup=a;let n=e.src.slice(i,s).replace(/\n/g,` `);n.startsWith(` `)&&n.endsWith(` `)&&/[^ ]/.test(n)&&(n=n.slice(1,-1)),t.content=n}return e.pos=n,!0}}}return t||(e.pending+=a),e.pos=i,!0}function gi(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==126)return!1;let i=e.scanDelims(e.pos,!0),a=i.length,o=String.fromCharCode(r);if(a<2)return!1;let s;a%2&&(s=e.push(`text`,``,0),s.content=o,a--);for(let t=0;t<a;t+=2)s=e.push(`text`,``,0),s.content=o+o,e.delimiters.push({marker:r,length:0,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return e.pos+=i.length,!0}function _i(e,t){let n,r=[],i=t.length;for(let a=0;a<i;a++){let i=t[a];if(i.marker!==126||i.end===-1)continue;let o=t[i.end];n=e.tokens[i.token],n.type=`s_open`,n.tag=`s`,n.nesting=1,n.markup=`~~`,n.content=``,n=e.tokens[o.token],n.type=`s_close`,n.tag=`s`,n.nesting=-1,n.markup=`~~`,n.content=``,e.tokens[o.token-1].type===`text`&&e.tokens[o.token-1].content===`~`&&r.push(o.token-1)}for(;r.length;){let t=r.pop(),i=t+1;for(;i<e.tokens.length&&e.tokens[i].type===`s_close`;)i++;i--,t!==i&&(n=e.tokens[i],e.tokens[i]=e.tokens[t],e.tokens[t]=n)}}function vi(e){let t=e.tokens_meta,n=e.tokens_meta.length;_i(e,e.delimiters);for(let r=0;r<n;r++){let n=t[r]?.delimiters;n&&_i(e,n)}}var yi={tokenize:gi,postProcess:vi};function bi(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==95&&r!==42)return!1;let i=e.scanDelims(e.pos,r===42);for(let t=0;t<i.length;t++){let t=e.push(`text`,``,0);t.content=String.fromCharCode(r),e.delimiters.push({marker:r,length:i.length,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return e.pos+=i.length,!0}function xi(e,t){let n=t.length;for(let r=n-1;r>=0;r--){let n=t[r];if(n.marker!==95&&n.marker!==42||n.end===-1)continue;let i=t[n.end],a=r>0&&t[r-1].end===n.end+1&&t[r-1].marker===n.marker&&t[r-1].token===n.token-1&&t[n.end+1].token===i.token+1,o=String.fromCharCode(n.marker),s=e.tokens[n.token];s.type=a?`strong_open`:`em_open`,s.tag=a?`strong`:`em`,s.nesting=1,s.markup=a?o+o:o,s.content=``;let c=e.tokens[i.token];c.type=a?`strong_close`:`em_close`,c.tag=a?`strong`:`em`,c.nesting=-1,c.markup=a?o+o:o,c.content=``,a&&(e.tokens[t[r-1].token].content=``,e.tokens[t[n.end+1].token].content=``,r--)}}function Si(e){let t=e.tokens_meta,n=e.tokens_meta.length;xi(e,e.delimiters);for(let r=0;r<n;r++){let n=t[r]?.delimiters;n&&xi(e,n)}}var Ci={tokenize:bi,postProcess:Si};function wi(e,t){let n,r,i,a,o=``,s=``,c=e.pos,l=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;let u=e.pos,d=e.posMax,f=e.pos+1,p=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(p<0)return!1;let m=p+1;if(m<d&&e.src.charCodeAt(m)===40){for(l=!1,m++;m<d&&(n=e.src.charCodeAt(m),Fn(n)||n===10);m++);if(m>=d)return!1;if(c=m,i=e.md.helpers.parseLinkDestination(e.src,m,e.posMax),i.ok){for(o=e.md.normalizeLink(i.str),e.md.validateLink(o)?m=i.pos:o=``,c=m;m<d&&(n=e.src.charCodeAt(m),Fn(n)||n===10);m++);if(i=e.md.helpers.parseLinkTitle(e.src,m,e.posMax),m<d&&c!==m&&i.ok)for(s=i.str,m=i.pos;m<d&&(n=e.src.charCodeAt(m),Fn(n)||n===10);m++);}(m>=d||e.src.charCodeAt(m)!==41)&&(l=!0),m++}if(l){if(e.env.references===void 0)return!1;if(m<d&&e.src.charCodeAt(m)===91?(c=m+1,m=e.md.helpers.parseLinkLabel(e,m),m>=0?r=e.src.slice(c,m++):m=p+1):m=p+1,r||=e.src.slice(f,p),r=Bn(r),a=e.env.references[r],!a)return e.pos=u,!1;o=a.href,s=a.title}if(!t){e.pos=f,e.posMax=p;let t=e.push(`link_open`,`a`,1),n=[[`href`,o]];if(t.attrs=n,s&&n.push([`title`,s]),r){let e=Object.create(null);e.label=r,t.meta=e}e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push(`link_close`,`a`,-1)}return e.pos=m,e.posMax=d,!0}function Ti(e,t){let n,r,i,a,o,s,c,l,u=``,d=e.pos,f=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;let p=e.pos+2,m=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(m<0)return!1;if(a=m+1,a<f&&e.src.charCodeAt(a)===40){for(a++;a<f&&(n=e.src.charCodeAt(a),Fn(n)||n===10);a++);if(a>=f)return!1;for(l=a,s=e.md.helpers.parseLinkDestination(e.src,a,e.posMax),s.ok&&(u=e.md.normalizeLink(s.str),e.md.validateLink(u)?a=s.pos:u=``),l=a;a<f&&(n=e.src.charCodeAt(a),Fn(n)||n===10);a++);if(s=e.md.helpers.parseLinkTitle(e.src,a,e.posMax),a<f&&l!==a&&s.ok)for(c=s.str,a=s.pos;a<f&&(n=e.src.charCodeAt(a),Fn(n)||n===10);a++);else c=``;if(a>=f||e.src.charCodeAt(a)!==41)return e.pos=d,!1;a++}else{if(e.env.references===void 0)return!1;if(a<f&&e.src.charCodeAt(a)===91?(l=a+1,a=e.md.helpers.parseLinkLabel(e,a),a>=0?i=e.src.slice(l,a++):a=m+1):a=m+1,i||=e.src.slice(p,m),i=Bn(i),o=e.env.references[i],!o)return e.pos=d,!1;u=o.href,c=o.title}if(!t){r=e.src.slice(p,m);let t=[];e.md.inline.parse(r,e.md,e.env,t);let n=e.push(`image`,`img`,0),a=[[`src`,u],[`alt`,``]];if(n.attrs=a,n.children=t,n.content=r,c&&a.push([`title`,c]),i){let e=Object.create(null);e.label=i,n.meta=e}}return e.pos=a,e.posMax=f,!0}var Ei=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,Di=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Oi(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==60)return!1;let r=e.pos,i=e.posMax;for(;;){if(++n>=i)return!1;let t=e.src.charCodeAt(n);if(t===60)return!1;if(t===62)break}let a=e.src.slice(r+1,n);if(Di.test(a)){let n=e.md.normalizeLink(a);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}if(Ei.test(a)){let n=e.md.normalizeLink(`mailto:${a}`);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}return!1}function ki(e){return/^<a[>\s]/i.test(e)}function Ai(e){return/^<\/a\s*>/i.test(e)}function ji(e){let t=e|32;return t>=97&&t<=122}function Mi(e,t){if(!e.md.options.html)return!1;let n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=n)return!1;let i=e.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!ji(i))return!1;let a=e.src.slice(r).match(Xr);if(!a)return!1;if(!t){let t=e.push(`html_inline`,``,0);t.content=a[0],ki(t.content)&&e.linkLevel++,Ai(t.content)&&e.linkLevel--}return e.pos+=a[0].length,!0}var Ni=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,Pi=/^&([a-z][a-z0-9]{1,31});/i;function Fi(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){let r=e.src.slice(n).match(Ni);if(r){if(!t){let t=r[1][0].toLowerCase()===`x`?parseInt(r[1].slice(1),16):parseInt(r[1],10),n=e.push(`text_special`,``,0);n.content=bn(t)?xn(t):xn(65533),n.markup=r[0],n.info=`entity`}return e.pos+=r[0].length,!0}}else{let r=e.src.slice(n).match(Pi);if(r){let n=jt(r[0]);if(n!==r[0]){if(!t){let t=e.push(`text_special`,``,0);t.content=n,t.markup=r[0],t.info=`entity`}return e.pos+=r[0].length,!0}}}return!1}function Ii(e){let t={},n=e.length;if(!n)return;let r=0,i=-2,a=[];for(let o=0;o<n;o++){let n=e[o];if(a.push(0),(e[r].marker!==n.marker||i!==n.token-1)&&(r=o),i=n.token,n.length=n.length||0,!n.close)continue;t.hasOwnProperty(n.marker)||(t[n.marker]=[-1,-1,-1,-1,-1,-1]);let s=t[n.marker][(n.open?3:0)+n.length%3],c=r-a[r]-1,l=c;for(;c>s;c-=a[c]+1){let t=e[c];if(t.marker===n.marker&&t.open&&t.end<0){let r=!1;if((t.close||n.open)&&(t.length+n.length)%3==0&&(t.length%3!=0||n.length%3!=0)&&(r=!0),!r){let r=c>0&&!e[c-1].open?a[c-1]+1:0;a[o]=o-c+r,a[c]=r,n.open=!1,t.end=o,t.close=!1,l=-1,i=-2;break}}}l!==-1&&(t[n.marker][(n.open?3:0)+(n.length||0)%3]=l)}}function Li(e){let t=e.tokens_meta,n=e.tokens_meta.length;Ii(e.delimiters);for(let e=0;e<n;e++){let n=t[e]?.delimiters;n&&Ii(n)}}function Ri(e){let t,n,r=0,i=e.tokens,a=e.tokens.length;for(t=n=0;t<a;t++)i[t].nesting<0&&r--,i[t].level=r,i[t].nesting>0&&r++,i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}var zi=[[`text`,si],[`linkify`,ui],[`newline`,di],[`escape`,pi],[`backticks`,hi],[`strikethrough`,yi.tokenize],[`emphasis`,Ci.tokenize],[`link`,wi],[`image`,Ti],[`autolink`,Oi],[`html_inline`,Mi],[`entity`,Fi]],Bi=[[`balance_pairs`,Li],[`strikethrough`,yi.postProcess],[`emphasis`,Ci.postProcess],[`fragments_join`,Ri]],Vi=class{constructor(){Zn(this,`ruler`,new $n),Zn(this,`ruler2`,new $n),Zn(this,`State`,ai);for(let e=0;e<zi.length;e++)this.ruler.push(zi[e][0],zi[e][1]);for(let e=0;e<Bi.length;e++)this.ruler2.push(Bi[e][0],Bi[e][1])}skipToken(e){let t=e.pos,n=this.ruler.getRules(``),r=n.length,i=e.md.options.maxNesting,a=e.cache;if(a[t]!==void 0){e.pos=a[t];return}let o=!1;if(e.level<i){for(let i=0;i<r;i++)if(e.level++,o=n[i](e,!0),e.level--,o){if(t>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}else e.pos=e.posMax;o||e.pos++,a[t]=e.pos}tokenize(e){let t=this.ruler.getRules(``),n=t.length,r=e.posMax,i=e.md.options.maxNesting;for(;e.pos<r;){let a=e.pos,o=!1;if(e.level<i){for(let r=0;r<n;r++)if(o=t[r](e,!1),o){if(a>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}if(o){if(e.pos>=r)break}else e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()}parse(e,t,n,r){let i=new this.State(e,t,n,r);this.tokenize(i);let a=this.ruler2.getRules(``),o=a.length;for(let e=0;e<o;e++)a[e](i)}},Hi={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`strip_references`,`inline`,`text_join`]},block:{rules:[`paragraph`]},inline:{rules:[`text`],rules2:[`balance_pairs`,`fragments_join`]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`strip_references`,`inline`,`text_join`]},block:{rules:[`blockquote`,`code`,`fence`,`heading`,`hr`,`html_block`,`lheading`,`list`,`reference`,`paragraph`]},inline:{rules:[`autolink`,`backticks`,`emphasis`,`entity`,`escape`,`html_inline`,`image`,`link`,`newline`,`text`],rules2:[`balance_pairs`,`emphasis`,`fragments_join`]}}}},Ui=/^(vbscript|javascript|file|data):/,Wi=/^data:image\/(gif|png|jpeg|webp);/,Gi=[`http:`,`https:`,`mailto:`],Ki=class{validateLink(e){let t=e.trim().toLowerCase();return!Ui.test(t)||Wi.test(t)}normalizeLink(e){let t=Ze(e,!0);if(t.hostname&&(!t.protocol||Gi.indexOf(t.protocol)>=0))try{t.hostname=mn.toASCII(t.hostname)}catch{}return t.auth&&=Re(t.auth),t.hostname&&=Re(t.hostname),t.pathname&&=Re(t.pathname),t.search&&=Re(t.search),t.hash&&=Re(t.hash),ze(t)}normalizeLinkText(e){let t=Ze(e,!0);if(t.hostname&&(!t.protocol||Gi.indexOf(t.protocol)>=0))try{t.hostname=mn.toUnicode(t.hostname)}catch{}return Fe(ze(t),Fe.defaultChars+`%`)}constructor(...e){Zn(this,`inline`,new Vi),Zn(this,`block`,new ii),Zn(this,`core`,new Mr),Zn(this,`renderer`,new tr),Zn(this,`linkify`,new Bt),Zn(this,`utils`,_n),Zn(this,`helpers`,Object.assign({},qn));let[t,n]=e;typeof t==`string`?(this.configure(t),n&&this.set(n)):(this.configure(`default`),this.set(t||{}))}set(e){return Object.assign(this.options,e),this}configure(e){let t;if(typeof e==`string`){let n=e;if(t=Hi[n],!t)throw Error(`Wrong 'markdown-it' preset "${n}", check name`)}else t=e;if(!t)throw Error("Wrong `markdown-it` preset, can't be empty");t.options&&(this.options={...t.options});let n=t.components;if(n){[`core`,`block`,`inline`].forEach(e=>{let t=n[e]?.rules;t&&this[e].ruler.enableOnly(t)});let e=n.inline?.rules2;e&&this.inline.ruler2.enableOnly(e)}return this}enable(e,t=!1){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(t=>{n=n.concat(this[t].ruler.enable(e,!0))}),n=n.concat(this.inline.ruler2.enable(e,!0));let r=e.filter(e=>n.indexOf(e)<0);if(r.length&&!t)throw Error(`MarkdownIt. Failed to enable unknown rule(s): ${r}`);return this}disable(e,t=!1){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(t=>{n=n.concat(this[t].ruler.disable(e,!0))}),n=n.concat(this.inline.ruler2.disable(e,!0));let r=e.filter(e=>n.indexOf(e)<0);if(r.length&&!t)throw Error(`MarkdownIt. Failed to disable unknown rule(s): ${r}`);return this}use(e,...t){return e.apply(e,[this,...t]),this}parse(e,t){if(typeof e!=`string`)throw Error(`Input data should be a String`);let n=new this.core.State(e,this,t);return this.core.process(n),n.tokens}render(e,t={}){return this.renderer.render(this.parse(e,t),this.options,t)}parseInline(e,t){let n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens}renderInline(e,t={}){return this.renderer.render(this.parseInline(e,t),this.options,t)}};Zn(Ki,`Token`,Qn),Zn(Ki,`Ruler`,$n),Zn(Ki,`Renderer`,tr),Zn(Ki,`ParserCore`,Mr),Zn(Ki,`StateCore`,nr),Zn(Ki,`ParserBlock`,ii),Zn(Ki,`StateBlock`,Nr),Zn(Ki,`ParserInline`,Vi),Zn(Ki,`StateInline`,ai);var qi=vn(Ki);function Ji(e,t){this.v=e,this.k=t}function Yi(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Xi(e){if(Array.isArray(e))return e}function Zi(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Qi(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
18
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $i(e,t){return Xi(e)||Zi(e,t)||ea(e,t)||Qi()}function ea(e,t){if(e){if(typeof e==`string`)return Yi(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yi(e,t):void 0}}function ta(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof Ji;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}ta.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},ta.prototype.next=function(e){return this._invoke(`next`,e)},ta.prototype.throw=function(e){return this._invoke(`throw`,e)},ta.prototype.return=function(e){return this._invoke(`return`,e)};var na=Object.entries,ra=Object.setPrototypeOf,ia=Object.isFrozen,aa=Object.getPrototypeOf,oa=Object.getOwnPropertyDescriptor,sa=Object.freeze,ca=Object.seal,la=Object.create,ua=typeof Reflect<`u`&&Reflect,da=ua.apply,fa=ua.construct;sa||=function(e){return e},ca||=function(e){return e},da||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},fa||=function(e){return new e(...[...arguments].slice(1))};var pa=Na(Array.prototype.forEach);Array.prototype.indexOf;var ma=Na(Array.prototype.lastIndexOf),ha=Na(Array.prototype.pop),ga=Na(Array.prototype.push);Array.prototype.slice;var _a=Na(Array.prototype.splice),va=Array.isArray,ya=Na(String.prototype.toLowerCase),ba=Na(String.prototype.toString),xa=Na(String.prototype.match),Sa=Na(String.prototype.replace),Ca=Na(String.prototype.indexOf),wa=Na(String.prototype.trim),Ta=Na(Number.prototype.toString),Ea=Na(Boolean.prototype.toString),Da=typeof BigInt>`u`?null:Na(BigInt.prototype.toString),Oa=typeof Symbol>`u`?null:Na(Symbol.prototype.toString),ka=Na(Object.prototype.hasOwnProperty),Aa=Na(Object.prototype.toString),ja=Na(RegExp.prototype.test),Ma=Pa(TypeError);function Na(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return da(e,t,n)}}function Pa(e){return function(){return fa(e,[...arguments])}}function Fa(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ya;if(ra&&ra(e,null),!va(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(ia(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Ia(e){for(let t=0;t<e.length;t++)ka(e,t)||(e[t]=null);return e}function La(e){let t=la(null);for(let r of na(e)){var n=$i(r,2);let i=n[0],a=n[1];ka(e,i)&&(t[i]=va(a)?Ia(a):a&&typeof a==`object`&&a.constructor===Object?La(a):a)}return t}function Ra(e){switch(typeof e){case`string`:return e;case`number`:return Ta(e);case`boolean`:return Ea(e);case`bigint`:return Da?Da(e):`0`;case`symbol`:return Oa?Oa(e):`Symbol()`;case`undefined`:return Aa(e);case`function`:case`object`:{if(e===null)return Aa(e);let t=e,n=za(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Aa(e)}return Aa(e)}default:return Aa(e)}}function za(e,t){for(;e!==null;){let n=oa(e,t);if(n){if(n.get)return Na(n.get);if(typeof n.value==`function`)return Na(n.value)}e=aa(e)}function n(){return null}return n}function Ba(e){try{return ja(e,``),!0}catch{return!1}}var Va=sa(`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.search.section.select.shadow.slot.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`.split(`.`)),Ha=sa(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Ua=sa([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Wa=sa([`animate`,`color-profile`,`cursor`,`discard`,`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`]),Ga=sa(`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.mprescripts`.split(`.`)),Ka=sa([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),qa=sa([`#text`]),Ja=sa(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.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.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Ya=sa(`accent-height.accumulate.additive.alignment-baseline.amplitude.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.dominant-baseline.dur.edgemode.elevation.end.exponent.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.intercept.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.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.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.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.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`.split(`.`)),Xa=sa(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.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`.split(`.`)),Za=sa([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Qa=ca(/{{[\w\W]*|^[\w\W]*}}/g),$a=ca(/<%[\w\W]*|^[\w\W]*%>/g),eo=ca(/\${[\w\W]*/g),to=ca(/^data-[\-\w.\u00B7-\uFFFF]+$/),no=ca(/^aria-[\-\w]+$/),ro=ca(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),io=ca(/^(?:\w+script|data):/i),ao=ca(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),oo=ca(/^html$/i),so=ca(/^[a-z][.\w]*(-[.\w]+)+$/i),co=ca(/<[/\w!]/g),lo=ca(/<[/\w]/g),uo=ca(/<\/no(script|embed|frames)/i),fo=ca(/\/>/i),po={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},mo=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],ho=sa(Fa({},mo)),go=function(){let e={};return pa(mo,t=>{e[t]=ca(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),sa(e)}(),_o=function(){return typeof window>`u`?null:window},vo=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},yo=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},bo=function(e,t,n,r){return ka(e,t)&&va(e[t])?Fa(r.base?La(r.base):{},e[t],r.transform):n},xo=function(e,t,n){let r=ka(e,t)?e[t]:void 0;return r&&typeof r==`object`?La(r):n()};function So(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_o(),t=e=>So(e);if(t.version=`3.4.16`,t.removed=[],!e||!e.document||e.document.nodeType!==po.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=za(d,`cloneNode`),p=za(d,`remove`),m=za(d,`removeAttributeNode`),h=za(d,`nextSibling`),g=za(d,`childNodes`),_=za(d,`parentNode`),v=za(d,`shadowRoot`),y=za(d,`attributes`),b=o&&o.prototype?za(o.prototype,`nodeType`):null,x=o&&o.prototype?za(o.prototype,`nodeName`):null,S=o&&o.prototype?za(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let T,E=``,D,O=!1,k=0,A=function(){if(k>0)throw Ma(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},j=function(e){A(),k++;try{return T.createHTML(e)}finally{k--}},M=function(e){A(),k++;try{return T.createScriptURL(e)}finally{k--}},N=function(){return O||=(D=vo(u,i),!0),D},P=n,F=P.implementation,I=P.createNodeIterator,L=P.createDocumentFragment,R=P.getElementsByTagName,z=r.importNode,B=yo();t.isSupported=typeof na==`function`&&typeof _==`function`&&F&&F.createHTMLDocument!==void 0;let V=Qa,H=$a,U=eo,ee=to,te=no,W=io,ne=ao,G=so,re=ro,K=null,ie=Fa({},[...Va,...Ha,...Ua,...Ga,...qa]),q=null,ae=Fa({},[...Ja,...Ya,...Xa,...Za]),oe=Object.seal(la(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}})),se=null,ce=null,le=Object.seal(la(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ue=!0,de=!0,fe=!1,pe=!0,me=!1,he=!0,ge=!1,_e=!1,ve=null,ye=null,be=!1,xe=!1,Se=!1,Ce=!1,we=!0,Te=!1,Ee=`user-content-`,De=!0,Oe=!1,ke={},Ae=null,je=Fa({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Me=null,Ne=Fa({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Pe=null,Fe=Fa({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ie=`http://www.w3.org/1998/Math/MathML`,Le=`http://www.w3.org/2000/svg`,Re=`http://www.w3.org/1999/xhtml`,ze=Re,Be=!1,Ve=null,He=Fa({},[Ie,Le,Re],ba),Ue=sa([`mi`,`mo`,`mn`,`ms`,`mtext`]),We=Fa({},Ue),Ge=sa([`annotation-xml`]),Ke=Fa({},Ge),qe=Fa({},[`title`,`style`,`font`,`a`,`script`]),Je=null,Ye=[`application/xhtml+xml`,`text/html`],Xe=null,Ze=null,Qe=n.createElement(`form`),$e=function(e){return e instanceof RegExp||e instanceof Function},et=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ze&&Ze===e)return;e&&typeof e==`object`||(e={}),e=La(e),Je=Ye.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Xe=Je===`application/xhtml+xml`?ba:ya,K=bo(e,`ALLOWED_TAGS`,ie,{transform:Xe}),q=bo(e,`ALLOWED_ATTR`,ae,{transform:Xe}),Ve=bo(e,`ALLOWED_NAMESPACES`,He,{transform:ba}),Pe=bo(e,`ADD_URI_SAFE_ATTR`,Fe,{transform:Xe,base:Fe}),Me=bo(e,`ADD_DATA_URI_TAGS`,Ne,{transform:Xe,base:Ne}),Ae=bo(e,`FORBID_CONTENTS`,je,{transform:Xe}),se=bo(e,`FORBID_TAGS`,La({}),{transform:Xe}),ce=bo(e,`FORBID_ATTR`,La({}),{transform:Xe}),ke=ka(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?La(e.USE_PROFILES):e.USE_PROFILES:!1,ue=e.ALLOW_ARIA_ATTR!==!1,de=e.ALLOW_DATA_ATTR!==!1,fe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,pe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,me=e.SAFE_FOR_TEMPLATES||!1,he=e.SAFE_FOR_XML!==!1,ge=e.WHOLE_DOCUMENT||!1,xe=e.RETURN_DOM||!1,Se=e.RETURN_DOM_FRAGMENT||!1,Ce=e.RETURN_TRUSTED_TYPE||!1,be=e.FORCE_BODY||!1,we=e.SANITIZE_DOM!==!1,Te=e.SANITIZE_NAMED_PROPS||!1,De=e.KEEP_CONTENT!==!1,Oe=e.IN_PLACE||!1,re=Ba(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:ro,ze=typeof e.NAMESPACE==`string`?e.NAMESPACE:Re,We=xo(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>Fa({},Ue)),Ke=xo(e,`HTML_INTEGRATION_POINTS`,()=>Fa({},Ge));let t=xo(e,`CUSTOM_ELEMENT_HANDLING`,()=>la(null));if(oe=la(null),ka(t,`tagNameCheck`)&&$e(t.tagNameCheck)&&(oe.tagNameCheck=t.tagNameCheck),ka(t,`attributeNameCheck`)&&$e(t.attributeNameCheck)&&(oe.attributeNameCheck=t.attributeNameCheck),ka(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(oe.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),ca(oe),me&&(de=!1),Se&&(xe=!0),ke&&(K=Fa({},qa),q=la(null),ke.html===!0&&(Fa(K,Va),Fa(q,Ja)),ke.svg===!0&&(Fa(K,Ha),Fa(q,Ya),Fa(q,Za)),ke.svgFilters===!0&&(Fa(K,Ua),Fa(q,Ya),Fa(q,Za)),ke.mathMl===!0&&(Fa(K,Ga),Fa(q,Xa),Fa(q,Za))),le.tagCheck=null,le.attributeCheck=null,ka(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?le.tagCheck=e.ADD_TAGS:va(e.ADD_TAGS)&&(K===ie&&(K=La(K)),Fa(K,e.ADD_TAGS,Xe))),ka(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?le.attributeCheck=e.ADD_ATTR:va(e.ADD_ATTR)&&(q===ae&&(q=La(q)),Fa(q,e.ADD_ATTR,Xe))),ka(e,`ADD_FORBID_CONTENTS`)&&va(e.ADD_FORBID_CONTENTS)&&(Ae===je&&(Ae=La(Ae)),Fa(Ae,e.ADD_FORBID_CONTENTS,Xe)),De&&(K[`#text`]=!0),ge&&Fa(K,[`html`,`head`,`body`]),K.table&&(Fa(K,[`tbody`]),delete se.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Ma(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Ma(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=T;T=e.TRUSTED_TYPES_POLICY;try{E=j(``)}catch(e){throw T=t,e}}else e.TRUSTED_TYPES_POLICY===null?(T=void 0,E=``):(T===void 0&&(T=N()),T&&typeof E==`string`&&(E=j(``)));sa&&sa(e),Ze=e},tt=Fa({},[...Ha,...Ua,...Wa]),nt=Fa({},[...Ga,...Ka]),rt=function(e,t,n){return t.namespaceURI===Re?e===`svg`:t.namespaceURI===Ie?e===`svg`&&(n===`annotation-xml`||We[n]):!!tt[e]},it=function(e,t,n){return t.namespaceURI===Re?e===`math`:t.namespaceURI===Le?e===`math`&&Ke[n]:!!nt[e]},at=function(e,t,n){return t.namespaceURI===Le&&!Ke[n]||t.namespaceURI===Ie&&!We[n]?!1:!nt[e]&&(qe[e]||!tt[e])},ot=function(e){let t=_(e);t&&t.tagName||(t={namespaceURI:ze,tagName:`template`});let n=ya(e.tagName),r=ya(t.tagName);return Ve[e.namespaceURI]?e.namespaceURI===Le?rt(n,t,r):e.namespaceURI===Ie?it(n,t,r):e.namespaceURI===Re?at(n,t,r):!!(Je===`application/xhtml+xml`&&Ve[e.namespaceURI]):!1},st=function(e){ga(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw Ma(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},ct=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},lt=function(e){ft(e);let t=g(e);if(t){let e=[];pa(t,t=>{ga(e,t)}),pa(e,e=>{try{p(e)}catch{}})}let n=y(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&ct(e,r,i)}},ut=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}ga(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(xe||Se)try{st(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},dt=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||q[Xe(i)]||ct(e,r,i)}},ft=function(e){let t=[e];for(;t.length>0;){let e=t.pop();C(e)===po.element&&dt(e);let n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},pt=function(e,t){return he?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},mt=function(e){if(!he)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=C(e);if(n===po.processingInstruction||n===po.comment&&ja(lo,e.data)){try{p(e)}catch{}continue}if(n===po.element){let t=e,n=Xe(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&pt(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=g(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},ht=function(e){let t=null,r=null;if(be)e=`<remove></remove>`+e;else{let t=xa(e,/^[\r\n\t ]+/);r=t&&t[0]}Je===`application/xhtml+xml`&&ze===Re&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=T?j(e):e;if(ze===Re)try{t=new l().parseFromString(i,Je)}catch{}if(!t||!t.documentElement){t=F.createDocument(ze,`template`,null);try{t.documentElement.innerHTML=Be?E:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),ze===Re?R.call(t,ge?`html`:`body`)[0]:ge?t.documentElement:a},gt=function(e){let t=S?S(e):e.ownerDocument;return I.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},_t=function(e){return e=Sa(e,V,` `),e=Sa(e,H,` `),e=Sa(e,U,` `),e},vt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=I.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=_t(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&pa(i,e=>{bt(e.content)&&vt(e.content)})},yt=function(e){let t=x?x(e):null;return typeof t!=`string`||Xe(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},bt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===po.documentFragment}catch{return!1}},xt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function St(e,n,r){e.length!==0&&pa(e,e=>{e.call(t,n,r,Ze)})}let Ct=function(e,t){return!!(he&&e.hasChildNodes()&&!xt(e.firstElementChild)&&ja(co,e.textContent)&&ja(co,e.innerHTML)||he&&e.namespaceURI===Re&&ho[t]&&(xt(e.firstElementChild)||typeof e.textContent==`string`&&ja(go[t],e.textContent))||e.nodeType===po.processingInstruction||he&&e.nodeType===po.comment&&ja(lo,e.data))},wt=function(e,t){return e instanceof RegExp?ja(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Tt=function(e,t,n){if(!se[t]&&jt(t)&&wt(oe.tagNameCheck,t))return!1;if(De&&!Ae[t]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return st(e),!0},Et=function(e,t,n,r){return e.length===0?t:t===n||t===r?La(t):t},Dt=function(e,t){return e===t||_(e)!==null?!1:(Oe&&ft(e),!0)},Ot=function(e,n){if(St(B.beforeSanitizeElements,e,null),Dt(e,n))return!0;if(yt(e))return st(e),!0;let r=Xe(w(e));if(K=Et(B.uponSanitizeElement,K,ie,ve),St(B.uponSanitizeElement,e,{tagName:r,allowedTags:K}),Dt(e,n))return!0;if(Ct(e,r))return st(e),!0;if(se[r]||!(le.tagCheck instanceof Function&&le.tagCheck(r))&&!K[r]){let t=Tt(e,r,n);return t===!1&&(St(B.afterSanitizeElements,e,null),Dt(e,n))?!0:t}if(C(e)===po.element&&!ot(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&ja(uo,e.innerHTML))return st(e),!0;if(me&&e.nodeType===po.text){let n=_t(e.textContent);e.textContent!==n&&(ga(t.removed,{element:e.cloneNode()}),e.textContent=n)}return St(B.afterSanitizeElements,e,null),Dt(e,n)},kt=function(e,t,r){if(ce[t]||pt(t,e)||we&&(t===`id`||t===`name`)&&(r in n||r in Qe))return!1;let i=q[t]||le.attributeCheck instanceof Function&&le.attributeCheck(t,e);return de&&ja(ee,t)||ue&&ja(te,t)?!0:i?Pe[t]||ja(re,Sa(r,ne,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Ca(r,`data:`)===0&&Me[e]||fe&&!ja(W,Sa(r,ne,``))?!0:!r:jt(e)&&wt(oe.tagNameCheck,e)&&wt(oe.attributeNameCheck,t,e)||t===`is`&&oe.allowCustomizedBuiltInElements&&wt(oe.tagNameCheck,r)},At=Fa({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),jt=function(e){return!At[ya(e)]&&ja(G,e)},Mt=function(e,t,n,r){if(T&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return j(r);case`TrustedScriptURL`:return M(r)}return r},Nt=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!yt(e)||(st(e),!1)}catch{return ut(t,e),!1}},Pt=function(e,n){if(St(B.beforeSanitizeAttributes,e,null),Dt(e,n))return;let r=e.attributes;if(!r||yt(e))return;q=Et(B.uponSanitizeAttribute,q,ae,ye);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:q,forceKeepAttr:void 0},a=r.length,o=Xe(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=Xe(s),d=l,f=s===`value`?d:wa(d),p=!1;i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,St(B.uponSanitizeAttribute,e,i),f=i.attrValue,Te&&(u===`id`||u===`name`)&&Ca(f,Ee)!==0&&(ut(s,e,n),f=Ee+f,p=!0),he&&ja(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)||u===`attributename`&&xa(f,`href`)?ut(s,e,n):i.forceKeepAttr||(i.keepAttr?!pe&&ja(fo,f)?ut(s,e,n):(me&&(f=_t(f)),kt(o,u,f)?(f=Mt(o,u,c,f),f!==d&&Nt(e,s,c,f)&&p&&ha(t.removed)):ut(s,e,n)):ut(s,e,n))}St(B.afterSanitizeAttributes,e,null),Dt(e,n)},Ft=function(e){let t=null,n=gt(e);for(St(B.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(St(B.uponSanitizeShadowNode,t,null),Ot(t,e),Pt(t,e),bt(t.content)&&Ft(t.content),C(t)===po.element){let e=v(t);bt(e)&&(It(e),Ft(e))}St(B.afterSanitizeShadowDOM,e,null)},It=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Ft(e.shadow);continue}let n=e.node,r=C(n)===po.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&Xe(e)===`template`){let e=n.content;bt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);bt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Be=!e,Be&&(e=`<!-->`),typeof e!=`string`&&!xt(e)&&(e=Ra(e),typeof e!=`string`))throw Ma(`dirty is not a string, aborting`);if(!t.isSupported)return e;_e?(K=ve,q=ye):et(n),(B.uponSanitizeElement.length>0||B.uponSanitizeAttribute.length>0)&&(K=La(K)),B.uponSanitizeAttribute.length>0&&(q=La(q)),t.removed=[];let c=Oe&&typeof e!=`string`&&xt(e);if(c){mt(e);let t=w(e);if(typeof t==`string`){let n=Xe(t);if(!K[n]||se[n])throw lt(e),Ma(`root node is forbidden and cannot be sanitized in-place`)}if(yt(e))throw lt(e),Ma(`root node is clobbered and cannot be sanitized in-place`);try{It(e)}catch(t){throw lt(e),t}}else if(xt(e))i=ht(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===po.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),It(i);else{if(!xe&&!me&&!ge&&e.indexOf(`<`)===-1)return T&&Ce?j(e):e;if(i=ht(e),!i)return xe?null:Ce?E:``}i&&be&&st(i.firstChild);let l=c?e:i;try{let e=gt(l);for(;o=e.nextNode();)Ot(o,l),Pt(o,l),bt(o.content)&&Ft(o.content)}catch(n){throw c&&(lt(e),pa(t.removed,e=>{e.element&&ft(e.element)})),n}if(c){let n=!1;if(pa(t.removed,t=>{t.element&&(t.element===e&&(n=!0),ft(t.element))}),n)throw Ma(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return me&&vt(e),e}if(xe){if(me&&vt(i),Se)for(s=L.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(q.shadowroot||q.shadowrootmode)&&(s=z.call(r,s,!0)),s}let u=ge?i.outerHTML:i.innerHTML;return ge&&K[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&ja(oo,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
19
|
+
`+u),me&&(u=_t(u)),T&&Ce?j(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};et(e),_e=!0,ve=K,ye=q},t.clearConfig=function(){Ze=null,_e=!1,ve=null,ye=null,T=D,E=``},t.isValidAttribute=function(e,t,n){Ze||et({});let r=Xe(e),i=Xe(t);return kt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&ka(B,e)&&ga(B[e],t)},t.removeHook=function(e,t){if(ka(B,e)){if(t!==void 0){let n=ma(B[e],t);return n===-1?void 0:_a(B[e],n,1)[0]}return ha(B[e])}},t.removeHooks=function(e){ka(B,e)&&(B[e]=[])},t.removeAllHooks=function(){B=yo()},t}var Co=So(),wo={class:`frame`},To={class:`modal-head`},Eo=[`title`],Do={class:`stage`},Oo=v(o({__name:`ImageModal`,props:{src:{},svg:{},width:{},height:{},alt:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=S(),o=f(()=>n.alt||`Изображение`),l=!1;function u(){l||(l=!0,r(`close`),i.value?.close())}function d(){l||(l=!0,r(`close`))}function g(e){e.target===i.value?.element&&u()}function _(e){e.preventDefault(),u()}return h(()=>i.value?.open()),(t,n)=>(p(),x(k,{ref_key:`dialog`,ref:i,class:`image-modal`,label:e.alt||`Просмотр изображения`,width:`1400px`,fullscreen:``,flush:``,onCancel:_,onClose:d,onClick:g},{default:s(()=>[y(`div`,wo,[y(`header`,To,[y(`span`,{class:`modal-title u-truncate`,title:o.value},a(o.value),9,Eo),c(C,{shape:`icon`,class:`image-modal-close`,"aria-label":`Закрыть`,title:`Закрыть`,onClick:n[0]||=e=>u()},{default:s(()=>[c(m(D),{"aria-hidden":`true`})]),_:1})]),y(`div`,Do,[c(w,{src:e.src,svg:e.svg,width:e.width,height:e.height,alt:e.alt,identity:e.src,background:`transparent`},null,8,[`src`,`svg`,`width`,`height`,`alt`,`identity`])])])]),_:1},8,[`label`]))}}),[[`__scopeId`,`data-v-230cb89a`]]),ko=[[`flowchart`,`flowchart-elk`,/^\s*flowchart-elk/],[`mindmap`,`mindmap`,/^\s*mindmap/],[`architecture`,`architecture`,/^\s*architecture/],[`agentflow`,`agentflow`,/^\s*agentflow-beta\b/],[`c4`,`c4`,/^\s*(?:C4Context|C4Container|C4Component|C4Dynamic|C4Deployment)/],[`kanban`,`kanban`,/^\s*kanban/],[`class`,`classDiagram`,/^\s*classDiagram/],[`er`,`er`,/^\s*erDiagram/],[`gantt`,`gantt`,/^\s*gantt/],[`info`,`info`,/^\s*info/],[`pie`,`pie`,/^\s*pie/],[`requirement`,`requirement`,/^\s*requirement(Diagram)?/],[`sequence`,`sequence`,/^\s*sequenceDiagram/],[`swimlane`,`swimlane`,/^\s*swimlane-beta\b/],[`flowchart`,`flowchart-v2`,/^\s*(graph|flowchart)/],[`timeline`,`timeline`,/^\s*timeline/],[`gitGraph`,`gitGraph`,/^\s*gitGraph/],[`state`,`stateDiagram`,/^\s*stateDiagram/],[`journey`,`journey`,/^\s*journey/],[`quadrantChart`,`quadrantChart`,/^\s*quadrantChart/],[`sankey`,`sankey`,/^\s*sankey(-beta)?/],[`packet`,`packet`,/^\s*packet(-beta)?/],[`xychart`,`xychart`,/^\s*xychart(-beta)?/],[`block`,`block`,/^\s*block(-beta)?/],[`eventmodeling`,`eventmodeling`,/^\s*eventmodeling/],[`treeView`,`treeView`,/^\s*treeView-beta/],[`radar`,`radar`,/^\s*radar-beta/],[`ishikawa`,`ishikawa`,/^\s*ishikawa(-beta)?\b/i],[`treemap`,`treemap`,/^\s*treemap/],[`railroad`,`railroad`,/^\s*railroad-beta/i],[`railroad`,`railroadEbnf`,/^\s*railroad-ebnf-beta/i],[`railroad`,`railroadAbnf`,/^\s*railroad-abnf-beta/i],[`railroad`,`railroadPeg`,/^\s*railroad-peg-beta/i],[`venn`,`venn`,/^\s*venn-beta/],[`wardley`,`wardley`,/^\s*wardley-beta/i],[`cynefin`,`cynefin`,/^\s*cynefin-beta(?:[\s:]|$)/],[`usecase`,`usecase`,/^\s*usecase-beta(?:\s|$)/]];function Ao(e){for(let[t,n,r]of ko)if(r.test(e))return{type:t,mermaidType:n};return null}var jo=class extends Error{code;type;mermaidType;line;column;snippet;constructor(e,t=`syntax`,n={}){super(e),this.name=`PeleError`,this.code=t,this.type=n.type??null,this.mermaidType=n.mermaidType??null,this.line=n.line??0,this.column=n.column??0,this.snippet=n.snippet??``}};function Mo(e,t,n){return Array.from(e.matchAll(t),e=>[e.index,e.index+e[0].length,n])}function No(e,t){let n=0;for(let[r,i,a]of e){let e=r-n;if(t<e)break;if(t<e+a)return r+Math.min(t-e,i-r-1);n+=i-r-a}return t+n}function Po(e,t){for(let n=e.length-1;n>=0;n--)t=No(e[n],t);return t}var Fo;function Io(e,t){let n=Fo;Fo=e;try{return t()}finally{Fo=n}}function Lo(e,t){return Fo!==void 0&&e===Fo.parsed?Fo.find(t):[e,t]}function Ro(e,t){let n=e.trimEnd().length;n>0&&t>=n?([e,t]=Lo(e,n-1),t++):[e,t]=Lo(e,t);let r=1,i=0;for(let n=e.indexOf(`
|
|
20
|
+
`);n!==-1&&n<t;n=e.indexOf(`
|
|
21
|
+
`,n+1))r++,i=n+1;let a=e.indexOf(`
|
|
22
|
+
`,t);a===-1&&(a=e.length);let o=t-i+1,s=e.slice(i,a);return{line:r,column:o,snippet:s+`
|
|
23
|
+
`+`-`.repeat(o-1)+`^`}}function zo(e,t,n,r,i=!1){let a=Ro(t,n),o=i?`Lexical error on line ${a.line}. Unrecognized text.`:`Parse error on line ${a.line}:`;return new jo(i?`${o}
|
|
24
|
+
${a.snippet}`:`${o}
|
|
25
|
+
${a.snippet}
|
|
26
|
+
${r}`,`syntax`,{type:e,...a})}var Bo=`amp:38,lt:60,gt:62,quot:34,apos:39,nbsp:160,shy:173,iexcl:161,cent:162,pound:163,curren:164,yen:165,sect:167,copy:169,laquo:171,not:172,reg:174,deg:176,plusmn:177,sup2:178,sup3:179,micro:181,para:182,middot:183,sup1:185,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,euro:8364,trade:8482,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,radic:8730,infin:8734,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830,check:10003,cross:10007,AMP:38,LT:60,GT:62,QUOT:34,lsqb:91,rsqb:93,lcub:123,rcub:125,verbar:124,VerticalLine:124,midast:42,DiacriticalGrave:96,Hat:94,UnderBar:95,equals:61,colon:58,semi:59,num:35,percnt:37,lpar:40,rpar:41,lbrack:91,rbrack:93,lbrace:123,rbrace:125,vert:124,sol:47,bsol:92,quest:63,excl:33,ast:42,plus:43,comma:44,period:46,dollar:36,commat:64,grave:96,hat:94,lowbar:95,tilde:126,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969`,Vo;function Ho(e){if(!Vo){Vo=new Map;for(let e of Bo.split(`,`)){let t=e.indexOf(`:`);Vo.set(e.slice(0,t),String.fromCodePoint(Number(e.slice(t+1))))}}return Vo.get(e)}function Uo(e,t){return e>0&&e<=1114111&&(e<55296||e>57343)?String.fromCodePoint(e):t}var Wo=/&(?:#(\d+)|#[xX]([0-9a-fA-F]+)|(\w+));/g,Go=`fl°`,Ko=`¶ß`;function qo(e){let t=``,n=0,r=e.indexOf(Go);for(;r!==-1;){let i=e.indexOf(`¶`,r+2);if(i===-1)break;if(e[i+1]===`ß`){let a=e[r+2]===`°`;t+=e.slice(n,r)+(a?`&#`:`&`)+e.slice(r+(a?3:2),i)+`;`,n=i+2}r=e.indexOf(Go,i+1)}return n===0?e:t+e.slice(n)}var Jo=/fl°°?(\w+)¶ß/g;function Yo(e){return e.includes(Ko)?e.replace(Jo,`#$1;`):e}function Xo(e){return e.includes(Ko)&&(e=qo(e)),e.includes(`&`)&&(e=e.replace(Wo,(e,t,n,r)=>t?Uo(Number(t),e):n?Uo(parseInt(n,16),e):Ho(r)??e)),e}var Zo,Qo=new Map;function $o(e,t){let n=Zo,r=Qo;Zo=e,Qo=new Map;try{return t()}finally{Zo=n,Qo=r}}function es(e){if(Zo===void 0)return``;let t=Qo.get(e);return t===void 0&&(t=Zo(e)??``,Qo.set(e,t)),t}var ts,ns=new Map;function rs(e,t){let n=ts,r=ns;ts=e,ns=new Map;try{return t()}finally{ts=n,ns=r}}function is(){return ts!==void 0}function as(e){return Number.isFinite(e)&&e>0}function os(e,t){if(ts===void 0)return;let n=t+`
|
|
27
|
+
`+e;if(ns.has(n))return ns.get(n);let r=ts(e,t)??void 0,i=r&&as(r.width)&&as(r.height)&&typeof(`svg`in r?r.svg:r.html)==`string`?r:void 0;return ns.set(n,i),i}function ss(e){if(ts===void 0)return e();let t=ts;ts=void 0;try{return e()}finally{ts=t}}var cs=class{constructor(e){this.message=e}message},ls=64;function us(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0,configurable:!0}):e[t]=n}var ds=class{lines;i=0;constructor(e){this.lines=(e.includes(`\r`)?e.replace(/\r\n?/g,`
|
|
28
|
+
`):e).split(`
|
|
29
|
+
`)}skipBlank(){for(;this.i<this.lines.length;){let e=this.lines[this.i].trim();if(e!==``&&e[0]!==`#`&&e!==`---`)break;this.i++}}indent(){let e=this.lines[this.i],t=0;for(;t<e.length&&e[t]===` `;)t++;if(e[t]===` `)throw Error(`YAML: tabs are not allowed for indentation`);return t}},fs=/^[-+]?(?:0|[1-9][0-9]*)$/,ps=/^[-+]?0x[0-9a-fA-F]+$/,ms=/^[-+]?0o[0-7]+$/,hs=/^[-+]?0b[01]+$/,gs=/^[-+]?(?:[0-9][0-9]*(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][-+]?[0-9]+)?$/,_s=/[\s#:,[\]{}&*!|>'"%@`]/;function vs(e){return e===` `||e===` `||e===`
|
|
30
|
+
`||e===`\r`}function ys(e){let t=e[0],n,r;if(t===`"`||t===`'`){let i=1;for(;;){if(i>=e.length)return null;let n=e[i];if(t===`"`&&n===`\\`)i+=2;else if(n===t){if(t===`"`||e[i+1]!==`'`)break;i+=2}else i++}for(n=i+1,r=n;vs(e[r]);)r++;if(e[r]!==`:`)return null}else{if(t===void 0||_s.test(t)||t===`-`&&(e.length<2||vs(e[1])||e[1]===`:`||e[1]===`#`))return null;for(r=1;r<e.length&&e[r]!==`:`&&e[r]!==`#`;)r++;if(e[r]!==`:`)return null;for(n=r;vs(e[n-1]);)n--}let i=r+1;if(i<e.length&&!vs(e[i]))return null;for(;vs(e[i]);)i++;return{key:e.slice(0,n),length:i}}function bs(e){let t=e.trim();if(t===``||t===`~`||t===`null`||t===`Null`||t===`NULL`)return null;if(t===`true`||t===`True`||t===`TRUE`)return!0;if(t===`false`||t===`False`||t===`FALSE`)return!1;let n=t[0];if(n!==`-`&&n!==`+`&&n!==`.`&&(n<`0`||n>`9`))return t;if(fs.test(t)||gs.test(t))return Number(t);if(ps.test(t)||ms.test(t)||hs.test(t)){let e=t[0]===`-`,n=Number(e||t[0]===`+`?t.slice(1):t);return e?-n:n}return/^[-+]?\.(?:inf|Inf|INF)$/.test(t)?t[0]===`-`?-1/0:1/0:/^\.(?:nan|NaN|NAN)$/.test(t)?NaN:t}var xs={0:`\0`,a:`\x07`,b:`\b`,t:` `,n:`
|
|
31
|
+
`,v:`\v`,f:`\f`,r:`\r`,e:`\x1B`," ":` `,'"':`"`,"/":`/`,"\\":`\\`,N:`
`,_:`\xA0`,L:`\u2028`,P:`\u2029`};function Ss(e){if(!e.includes(`
|
|
32
|
+
`))return e;let t=e.split(`
|
|
33
|
+
`),n=t.length-1;for(let e=0;e<=n;e++){let r=t[e],i=0,a=r.length;if(e>0)for(;i<a&&(r.charCodeAt(i)===32||r.charCodeAt(i)===9);)i++;if(e<n)for(;a>i&&(r.charCodeAt(a-1)===32||r.charCodeAt(a-1)===9);)a--;t[e]=r.slice(i,a)}return t.join(`
|
|
34
|
+
`).replace(/\n+/g,e=>e.length===1?` `:`
|
|
35
|
+
`.repeat(e.length-1))}function Cs(e){if(!e.includes(`\\`))return Ss(e);let t=``,n=Ss(e.replace(/\\\n[ \t]*/g,``));for(let e=0;e<n.length;e++){let r=n[e];if(r!==`\\`){t+=r;continue}let i=n[++e];if(i===`x`||i===`u`||i===`U`){let r=i===`x`?2:i===`u`?4:8;t+=String.fromCodePoint(parseInt(n.slice(e+1,e+1+r),16)),e+=r}else if(i in xs)t+=xs[i];else throw Error(`YAML: unknown escape sequence`)}return t}function ws(e,t,n){for(;t<e.length;){let r=e[t];if(r===` `||r===`
|
|
36
|
+
`||r===` `||r===`\r`||n&&r===`,`)t++;else if(r===`#`&&(t===0||/\s/.test(e[t-1]))){let n=e.indexOf(`
|
|
37
|
+
`,t);t=n===-1?e.length:n}else break}return t}function Ts(e,t){if(!t)throw Error(`YAML: missed comma between flow collection entries`);if(e===`,`)throw Error(`YAML: expected the node content, but found ','`)}function Es(e,t,n,r=0){if(r>ls)throw Error(`YAML: nesting is too deep`);t=ws(e,t,!1);let i=e[t];if(i===`{`){let n={};t++;let i=!0;for(;;){if(t=ws(e,t,!1),t>=e.length)throw new cs(`YAML: unexpected end of the stream within a flow collection`);if(e[t]===`}`)return[n,t+1];Ts(e[t],i);let a;[a,t]=Es(e,t,`:,}`,r+1),t=ws(e,t,!1);let o=null;e[t]===`:`&&([o,t]=Es(e,t+1,`,}`,r+1)),us(n,String(a),o),t=ws(e,t,!1),i=e[t]===`,`,i&&t++}}if(i===`[`){let n=[];t++;let i=!0;for(;;){if(t=ws(e,t,!1),t>=e.length)throw new cs(`YAML: unexpected end of the stream within a flow collection`);if(e[t]===`]`)return[n,t+1];Ts(e[t],i);let a;[a,t]=Es(e,t,`,]`,r+1),n.push(a),t=ws(e,t,!1),i=e[t]===`,`,i&&t++}}if(i===`"`){let n=t+1;for(;n<e.length&&e[n]!==`"`;)n+=e[n]===`\\`?2:1;if(n>=e.length)throw new cs(`YAML: unexpected end of the stream within a double quoted scalar`);return[Cs(e.slice(t+1,n)),n+1]}if(i===`'`){let n=t+1;for(;n<e.length;){if(e[n]===`'`){if(e[n+1]!==`'`)break;n++}n++}if(n>=e.length)throw new cs(`YAML: unexpected end of the stream within a single quoted scalar`);return[Ss(e.slice(t+1,n)).replace(/''/g,`'`),n+1]}let a=t;for(;a<e.length;){let r=e[a];if(n.includes(r)&&(r!==`:`||a+1>=e.length||/[\s,[\]{}]/.test(e[a+1])))break;if(r===`#`&&a>t&&/\s/.test(e[a-1])){let n=e.indexOf(`
|
|
38
|
+
`,a);return[bs(Ss(e.slice(t,a).trim())),n===-1?e.length:n]}a++}return[bs(Ss(e.slice(t,a).trim())),a]}function Ds(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(t)r===`\\`&&t===`"`?n++:r===t&&(t=``);else if(r===`"`||r===`'`)t=r;else if(r===`#`&&(n===0||e[n-1]===` `||e[n-1]===` `))return e.slice(0,n)}return e}function Os(e,t,n){let r=t[0]===`>`,i=t.includes(`-`)?`-`:t.includes(`+`)?`+`:``,a=/[1-9]/.exec(t),o=a?n+Number(a[0]):-1,s=[];for(;e.i<e.lines.length;){let t=e.lines[e.i];if(t.trim()===``){s.push(``),e.i++;continue}let r=t.length-t.trimStart().length;if(o===-1){if(r<=n)break;o=r}if(r<o)break;s.push(t.slice(o)),e.i++}let c=0;for(;s.length>0&&s[s.length-1]===``;)s.pop(),c++;let l;if(r){l=``;for(let e=0;e<s.length;e++){let t=s[e];if(e>0){let n=s[e-1];t===``?l+=`
|
|
39
|
+
`:n!==``&&(l+=/^[ \t]/.test(n)||/^[ \t]/.test(t)?`
|
|
40
|
+
`:` `)}l+=t}}else l=s.join(`
|
|
41
|
+
`);return s.length===0?i===`+`?`
|
|
42
|
+
`.repeat(c):``:i===`-`?l:i===`+`?l+`
|
|
43
|
+
`.repeat(c+1):l+`
|
|
44
|
+
`}function ks(e,t,n){let r=t[0];if((r===`|`||r===`>`)&&/^[|>][-+0-9]*\s*(?:#.*)?$/.test(t))return Os(e,t,n);if(r===`{`||r===`[`||r===`"`||r===`'`){let n=e.i,r=t,i=0,a=1;for(;;)try{let[t,i]=Es(r,0,``),a=0;for(let e=r.indexOf(`
|
|
45
|
+
`);e!==-1&&e<i;e=r.indexOf(`
|
|
46
|
+
`,e+1))a++;let o=r.indexOf(`
|
|
47
|
+
`,i);if(Ds(r.slice(i,o===-1?r.length:o)).trim()!==``)throw Error(`YAML: unexpected content after a value`);return e.i=n+a,t}catch(t){if(!(t instanceof cs))throw t;if(n+i>=e.lines.length)throw Error(t.message);let o=e.lines.slice(n+i,n+i+a);r+=`
|
|
48
|
+
`+o.join(`
|
|
49
|
+
`),i+=o.length,a*=2}}let i=Ds(t).trim();for(;e.i<e.lines.length;){let t=e.lines[e.i];if(t.trim()===``){let t=e.i;for(;t<e.lines.length&&e.lines[t].trim()===``;)t++;if(t>=e.lines.length||e.lines[t].length-e.lines[t].trimStart().length<=n)break;i+=`
|
|
50
|
+
`.repeat(t-e.i),e.i=t;continue}if(t.length-t.trimStart().length<=n)break;let r=Ds(t).trim();i+=(i.endsWith(`
|
|
51
|
+
`)?``:` `)+r,e.i++}return bs(i)}function As(e,t,n=0){if(n>ls)throw Error(`YAML: nesting is too deep`);if(e.skipBlank(),e.i>=e.lines.length)return null;let r=e.indent();if(r<t)return null;let i=e.lines[e.i].slice(r);if(i===`-`||i.startsWith(`- `)){let t=[];for(;e.i<e.lines.length&&(e.skipBlank(),!(e.i>=e.lines.length||e.indent()!==r));){let i=e.lines[e.i].slice(r);if(i!==`-`&&!i.startsWith(`- `))break;let a=i.slice(1),o=a.length-a.trimStart().length+1,s=Ds(a).trim();s===``?(e.i++,t.push(As(e,r+1,n+1))):ys(s)===null?(e.i++,t.push(ks(e,a.trim(),r))):(e.lines[e.i]=` `.repeat(r+o)+a.trimStart(),t.push(As(e,r+o,n+1)))}return t}if(ys(i)===null)return e.i++,ks(e,i.trim(),r-1);let a={};for(;e.i<e.lines.length&&(e.skipBlank(),!(e.i>=e.lines.length));){let t=e.indent();if(t<r)break;if(t>r)throw Error(`YAML: bad indentation of a mapping entry`);let i=e.lines[e.i].slice(r),o=ys(i);if(!o)throw Error(`YAML: can not read a block mapping entry`);let s=String(Es(o.key,0,``)[0]),c=i.slice(o.length);if(e.i++,Ds(c).trim()===``){if(e.skipBlank(),e.i<e.lines.length){let t=e.indent(),i=e.lines[e.i].slice(t),o=i===`-`||i.startsWith(`- `);us(a,s,t>r||o&&t===r?As(e,o?r:r+1,n+1):null)}else us(a,s,null)}else us(a,s,ks(e,c.trim(),r))}return a}function js(e){let t=e.trim();if(t[0]===`{`||t[0]===`[`)try{let[e,n]=Es(t,0,``);if(ws(t,n,!1)===t.length)return e}catch(e){throw e instanceof cs?Error(e.message):e}let n=new ds(e),r=As(n,0);if(n.skipBlank(),n.i<n.lines.length&&n.lines[n.i].trim()!==`...`)throw Error(`YAML: end of the stream or a document separator is expected`);return r}function J(e){return e<128?e===32||e>=9&&e<=13:e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288||e===65279}function Ms(e){return e===32||e===9}function Ns(e){return e===10||e===13||e===8232||e===8233}function Ps(e){return e>=48&&e<=57}function Fs(e){return e>=65&&e<=90||e>=97&&e<=122}function Is(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Ls(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95}var Rs=/^\s*%%(?!{)[^\n]+\n?/gm,zs=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,Bs=/<(\w+)([^>]*)>/g,Vs=/="([^"]*)"/g,Hs=new Set([`__proto__`,`constructor`,`prototype`]);function Us(e,t,n){return n?.push(Mo(e,t,0)),e.replace(t,``)}function Ws(e,t){e.includes(`%%`)&&(e=Us(e,Rs,t));let n=e.trimStart();return t?.push([[0,e.length-n.length,0]]),n}function Gs(e){return e.includes(`\r`)?e.replace(/\r\n?/g,`
|
|
52
|
+
`):e}function Ks(e){return e===`
|
|
53
|
+
`||e===`\r`}function qs(e){return e!==void 0&&/\s/.test(e)}function Js(e){let t=0;for(;t<e.length&&qs(e[t])&&!Ks(e[t]);)t++;let n=e.slice(0,t);if(!e.startsWith(`---`,t))return;let r=[];for(let n=t+3;n<e.length&&qs(e[n]);n++)Ks(e[n])&&r.push(n);if(r.length===0)return;let i=n+`---`,a=t=>{if(!Ks(e[t])||!e.startsWith(i,t+1))return-1;let n=-1;for(let r=t+1+i.length;r<e.length&&qs(e[r]);r++)Ks(e[r])&&(n=r);return n},o=`
|
|
54
|
+
`+i,s=-1;for(let t=e.lastIndexOf(o);t>r[0];t=e.lastIndexOf(o,t-1))if(a(t)!==-1){s=t;break}if(s===-1)return;let c=r[0];for(let e of r)e<s&&(c=e);let l=c+1,u=l>0?l-1:0;for(let t=e.indexOf(o,u);t!==-1&&t<=s;t=e.indexOf(o,t+1)){if(t<l)continue;let r=a(t);if(r!==-1)return{indent:n,body:e.slice(l,t),length:r+1}}}function Ys(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Xs(e,t){for(let n of Object.keys(t)){if(Hs.has(n))continue;let r=t[n],i=e[n];Ys(r)&&Ys(i)?Xs(i,r):e[n]=Ys(r)?Xs({},r):r}return e}function Zs(e,t,n){if(!e.includes(`%%{`))return e;let r=e.trim().replace(/'/g,`"`);zs.lastIndex=0;let i;for(;(i=zs.exec(r))!==null;){i.index===zs.lastIndex&&zs.lastIndex++;let e=i[1]??i[2];if(e===`wrap`)t.wrap=!0;else if((e===`init`||e===`initialize`)&&i[4])try{let e=JSON.parse(i[4].trim());Ys(e)&&Xs(t,e)}catch{}}return zs.lastIndex=0,Us(e,zs,n)}function Qs(e,t){let n=Gs(e),r=n.includes(`<`)?n.lastIndexOf(`>`):-1;r>0&&(n=n.slice(0,r+1).replace(Bs,(e,t,n)=>`<`+t+n.replace(Vs,`='$1'`)+`>`)+n.slice(r+1));let i={},a,o=0,s=n.includes(`---`)?Js(n):void 0;if(s){let e=s.indent?s.body.split(`
|
|
55
|
+
`).map(e=>e.startsWith(s.indent)?e.slice(s.indent.length):e).join(`
|
|
56
|
+
`):s.body,r;try{r=js(e)}catch(e){throw new jo(`Front matter is not valid YAML. ${e.message}`,`syntax`)}if(Ys(r)&&(r.title&&(a=String(r.title)),Ys(r.config)&&Xs(i,r.config),r.displayMode)){let e=Ys(i.gantt)?i.gantt:i.gantt={};e.displayMode=String(r.displayMode)}for(let e=n.indexOf(`
|
|
57
|
+
`);e!==-1&&e<s.length;e=n.indexOf(`
|
|
58
|
+
`,e+1))o++;n=n.slice(s.length),t?.push([[0,s.length,0]])}return n=Zs(n,i,t),{text:Ws(n),title:a,config:i,withComments:n,lineOffset:o}}var $s=/#\w+;/g,ec=/^\+?\d+$/,tc=RegExp(`[\\n\\r\u2028\u2029]`,`g`);function nc(e){if(e===void 0)return;let t=[];return e.push(t),t}function rc(e,t,n){let r=nc(n),i=e.indexOf(t);if(i===-1)return e;let a=``,o=0;for(;i!==-1;){tc.lastIndex=i;let n=tc.test(e)?tc.lastIndex-1:e.length,s=!1,c=-1;for(let r=i+t.length;r<n;r++){let t=e.charCodeAt(r);if(t===58)s=!0;else if(t===35){if(s){c=r;break}}else J(t)&&(s=!1)}if(c!==-1){let t=e.lastIndexOf(`;`,n-1);t>c&&(r?.push([t,t+1,0]),a+=e.slice(o,t),o=t+1)}i=n>=e.length?-1:e.indexOf(t,n+1)}return o===0?e:a+e.slice(o)}function ic(e,t){if(!e.includes(`#`))return e;e=rc(rc(e,`style`,t),`classDef`,t);let n=nc(t);return e.replace($s,(e,t)=>{let r=e.substring(1,e.length-1),i=(ec.test(r)?`fl°°`:`fl°`)+r+`¶ß`;return n?.push([t,t+e.length,i.length]),i})}var ac=`7q7q9vfgfgopij5b9999atg87q997q7qfgfgfgfgfgfgfgfgfgfg7q7qg8g8g8fgs7ijijk2k2ijgzlmk27qdwijfgn5k2lmijlmk2ijgzk2ijq8ijijgz7q7q7qd1fg99fgfgdwfgfg7qfgfg6666dw66n5fgfgfgfg99dw7qfgdwk2dwdwdw9a789ag8`,oc=`7q99d6fgfgopk26m9999atg87q997q7qfgfgfgfgfgfgfgfgfgfg9999g8g8g8gzr3k2k2k2k2ijgzlmk27qfgk2gzn5k2lmijlmk2ijgzk2ijq8ijijgz997q99g8fg99fggzfggzfg99gzgz7q7qfg7qopgzgzgzgzatfg99gzfglmfgfgdwat7satg8`,sc=1.2;function cc(e){let t=new Uint16Array(95);for(let n=0;n<95;n++)t[n]=parseInt(e.substr(n*2,2),36);return t}var lc,uc;function dc(e){return e>=4352&&e<=4447||e>=11904&&e<=42191||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65072&&e<=65103||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=55296&&e<=56319}function fc(e){return e===173||e>=768&&e<=879||e>=8203&&e<=8207||e>=56320&&e<=57343||e>=65024&&e<=65039||e===65279}var pc={width(e,t,n){let r=!!(n&4),i=n&24?t/sc:t,a=n&1?uc??=cc(oc):lc??=cc(ac),o=0;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(!(n<32)){if(n<127)o+=r?600:a[n-32];else{if(fc(n))continue;dc(n)?o+=r?1200:1e3:o+=r?600:580}}}return o*i/1e3}};function mc(){let e=globalThis;try{if(e.OffscreenCanvas)return new e.OffscreenCanvas(1,1).getContext(`2d`);if(e.document)return e.document.createElement(`canvas`).getContext(`2d`)}catch{return null}return null}var hc=2e4;function gc(){let e=globalThis;return e.document?.fonts??e.fonts}function _c(e,t,n){try{return e?.check(t,n)??!0}catch{return!0}}function vc(e,t=`monospace`){let n=mc();if(!n)return null;let r=new Map,i=``,a=gc()?.size;return{width(o,s,c){let l=gc();l?.size!==a&&(a=l?.size,r.clear());let u=c&24?s/sc:s,d=(c&2?`italic `:``)+(c&1?`bold `:``)+u+`px `+(c&4?t:e),f=r.get(d);f||r.set(d,f=new Map);let p=f.get(o);return p===void 0&&(d!==i&&(n.font=i=d),p=n.measureText(o).width,_c(l,d,o)&&(f.size>=hc&&f.clear(),f.set(o,p))),p}}}var yc=new Map;function bc(e=`sans-serif`,t=`monospace`){let n=e+`
|
|
59
|
+
`+t,r=yc.get(n);return r||(r=vc(e,t)??pc,yc.set(n,r)),r}function xc(){yc.clear()}var Sc=/[&<>"\x00-\x08\x0b\x0c\x0e-\x1f\x7f\ud800-\udfff\ufffe\uffff]/u,Cc=/[&<>"]|[\x00-\x08\x0b\x0c\x0e-\x1f\x7f\ud800-\udfff\ufffe\uffff]+/gu,wc={"&":`&`,"<":`<`,">":`>`,'"':`"`},Tc=/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f\ud800-\udfff\ufffe\uffff]/u;function Ec(e){return Sc.test(e)?e.replace(Cc,e=>wc[e]??``):e}function Y(e){return Ec(Xo(e))}var Dc=[];for(let e=0;e<100;e++)Dc.push(e===0?``:e%10==0?`.`+e/10:`.`+(e<10?`0`+e:e));function X(e){let t=Math.round(e*100);if(t===0)return`0`;if(t>0){if(t<1e11){let e=Math.floor(t/100);return e+Dc[t-e*100]}}else if(t>-1e11){let e=-t,n=Math.floor(e/100);return`-`+n+Dc[e-n*100]}return String(t/100)}function Z(e,t,n,r,i){let a=e.lines;if(a.length===0)return``;let o=e.lineHeight,s=e.heights,c=e.size*.35,l=n-e.height/2,u=a.length===1&&a[0].length===1?a[0][0]:void 0;if(u&&u.icon===void 0&&u.math===void 0&&u.style===0)return`<text${r} x="${X(t)}" y="${X(l+o/2+c)}" text-anchor="middle">${Ec(u.text)}</text>`;let d=Hc(e),f=r,p;r=Uc(r,d);let m=``,h=``;for(let n=0;n<a.length;n++){let r=a[n],u=s?s[n]:o,g=l+u/2,_=g+c,v=!1;for(let e of r)(e.icon!==void 0||e.math)&&(v=!0);if(v){let a=t-e.widths[n]/2;for(let t of r){if(t.math){let n=`x="${X(a)}" y="${X(g-t.math.height/2)}" width="${X(t.math.width)}" height="${X(t.math.height)}"`;p??=Nc(f),h+=p.halo===void 0?Pc(t.math,n,e.size,p.attrs):`<rect ${n} rx="2" fill="${p.halo}"/>`}else if(t.icon!==void 0){let n=e.size*1.1,r=i?.(t.icon)??``;h+=`<svg class="pele-icon" data-icon="${Y(t.icon)}" x="${X(a)}" y="${X(g-n/2)}" width="${X(n)}" height="${X(n)}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${r}</svg>`}else t.text!==``&&(m+=`<tspan x="${X(a)}" y="${X(_)}" text-anchor="start"${Vc(t.style&~d)}>${Ec(t.text)}</tspan>`);a+=t.width}}else{for(let e=0;e<r.length;e++){let n=r[e],i=e===0?` x="${X(t)}" y="${X(_)}"`:``;m+=`<tspan${i}${Vc(n.style&~d)}>${Ec(n.text)}</tspan>`}r.length===0&&(m+=`<tspan x="${X(t)}" y="${X(_)}"> </tspan>`)}l+=u}return`<text${r} text-anchor="middle" xml:space="preserve">${m}</text>${h}`}var Oc=/ fill="([^"]*)"/,kc=/ stroke="([^"]*)"/,Ac=/ style="([^"]*)"/,jc=/(?:^|;)\s*fill:([^;]*)/,Mc=/(?:^|;)\s*opacity:([^;]*)/;function Nc(e){let t=Ac.exec(e)?.[1]??``,n=(jc.exec(t)?.[1]??Oc.exec(e)?.[1]??``).trim();if(n===`none`)return{attrs:``,halo:kc.exec(e)?.[1]??`none`};let r=Mc.exec(t)?.[1].trim();return{attrs:(n===``?``:` color="${n}"`)+(r?` opacity="${r}"`:``)}}function Pc(e,t,n,r){return`svg`in e?`<svg class="pele-math" ${t} overflow="visible"${r}>${e.svg}</svg>`:`<foreignObject class="pele-math" ${t} overflow="visible"${r}><div xmlns="http://www.w3.org/1999/xhtml" style="display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:${X(n)}px;line-height:normal;white-space:nowrap">${e.html}</div></foreignObject>`}var Fc=` font-weight="var(--_w)"`,Ic=` font-style="italic"`,Lc=` text-decoration="underline"`,Rc=` font-family="var(--_fm)"`,zc=` baseline-shift="sub" font-size="smaller"`,Bc=` baseline-shift="super" font-size="smaller"`;function Vc(e){return(e&1?Fc:``)+(e&2?Ic:``)+(e&4?Rc:``)+(e&32?Lc:``)+(e&8?zc:e&16?Bc:``)}function Hc(e){let t=7,n=!1;for(let r of e.lines)for(let e of r)e.icon!==void 0||e.text===``||(t&=e.style,n=!0);return n?t:0}function Uc(e,t){return e+(t&1&&!e.includes(` font-weight="`)?Fc:``)+(t&2&&!e.includes(` font-style="`)?Ic:``)+(t&4&&!e.includes(` font-family="`)?Rc:``)}var Wc=new Set(`black blue blueviolet brown crimson darkblue darkcyan darkgreen darkmagenta darkolivegreen darkorchid darkred darkslateblue darkslategray darkviolet dimgray firebrick forestgreen green indigo maroon mediumblue mediumslateblue mediumvioletred midnightblue navy olive purple rebeccapurple royalblue saddlebrown seagreen sienna slateblue steelblue teal`.split(` `)),Gc=new Set(`aliceblue antiquewhite aqua aquamarine azure beige bisque blanchedalmond burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk cyan darkgoldenrod darkgray darkkhaki darkorange darksalmon darkseagreen darkturquoise deeppink deepskyblue dodgerblue floralwhite fuchsia gainsboro ghostwhite gold goldenrod gray greenyellow honeydew hotpink indianred ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightpink lightsalmon lightseagreen lightskyblue lightslategray lightsteelblue lightyellow lime limegreen linen magenta mediumaquamarine mediumorchid mediumpurple mediumseagreen mediumspringgreen mediumturquoise mintcream mistyrose moccasin navajowhite oldlace olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue red rosybrown salmon sandybrown seashell silver skyblue slategray snow springgreen tan thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen`.split(` `)),Kc=`var(--pele-fg-on-light,#1f1f1f)`,qc=`var(--pele-fg-on-dark,#fff)`,Jc=/[";]fill:([^;"]*)/,Yc=/[";](?:fill-)?opacity:([^;"]*)/g,Xc=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i,Zc=/^(rgba?|hsla?)\(([^()]*)\)$/i,Qc=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?(%|deg|grad|rad|turn)?$/i,$c=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,el=(e,t,n)=>.2126*$c(e)+.7152*$c(t)+.0722*$c(n),tl=e=>Math.min(Math.max(e,0),1),nl=Math.sqrt(1.05*(el(31/255,31/255,31/255)+.05))-.05;function rl(e,t){let n=Qc.exec(e);return!n||n[1]&&n[1]!==`%`?NaN:tl(parseFloat(e)/(n[1]?100:t))}function il(e){let t=Qc.exec(e);if(!t||t[1]===`%`)return NaN;let n=t[1]?.toLowerCase(),r=parseFloat(e);return n===`turn`?r*360:n===`rad`?r*180/Math.PI:n===`grad`?r*.9:r}function al(e,t){let n=e.includes(`,`),[r,i,a]=n?[e]:e.split(`/`);if(a!==void 0)return;let o=r.trim().split(n?/\s*,\s*/:/\s+/);if(n?o.length<3||o.length>4:o.length!==3)return;if(i!==void 0&&o.push(i.trim()),!n)return o.map(e=>e===`none`?`0`:e);let s=o.slice(+!!t,3).filter(e=>e.endsWith(`%`)).length;return s===(t?2:3)||!t&&s===0?o:void 0}function ol(e){let t=e.trim().toLowerCase(),n=t.replace(`grey`,`gray`);return Xc.test(t)||Wc.has(n)||Gc.has(n)||t===`transparent`||t===`currentcolor`}function sl(e){let t=e.trim().toLowerCase(),n=t.replace(`grey`,`gray`);if(Wc.has(n))return[0,1];if(Gc.has(n))return[1,1];if(Xc.test(t)){let e=t.length<6?t.slice(1).replace(/./g,`$&$&`):t.slice(1),n=t=>parseInt(e.slice(2*t,2*t+2),16)/255;return[el(n(0),n(1),n(2)),e.length===8?n(3):1]}let r=Zc.exec(t),i=r?.[1].startsWith(`hsl`)??!1,a=r&&al(r[2],i);if(!a)return;let o=a.length===4?rl(a[3],1):1,s;if(!i)s=a.slice(0,3).map(e=>rl(e,255));else{let e=(il(a[0])%360+360)%360/30,t=rl(a[1],100),n=rl(a[2],100),r=t*Math.min(n,1-n);s=[0,8,4].map(t=>{let i=(t+e)%12;return n-r*Math.max(-1,Math.min(i-3,9-i,1))})}let c=el(s[0],s[1],s[2]);return Number.isNaN(c+o)?void 0:[c,o]}function cl(e){let t=1;for(let[,n]of e.matchAll(Yc))t*=rl(n.trim(),1);return t}var ll=new Map;function ul(e,t=``){let n=`${e}\0${t}`;if(ll.has(n))return ll.get(n);ll.size>1e3&&ll.clear();let r=dl(e,t);return ll.set(n,r),r}function dl(e,t){let n=Jc.exec(e),r=n&&!Jc.test(t)?sl(n[1]):void 0;if(r&&r[1]*cl(e)>=.5)return r[0]>nl?Kc:qc}function fl(e){let t=Jc.exec(e)?.[1].trim().toLowerCase();if(!t||t===`none`||t===`transparent`)return!1;let n=cl(e);return(sl(t)?.[1]??1)*(Number.isNaN(n)?1:n)>0}function pl(e,t){let n=ul(e.shape,e.text)??t;return n?` fill="${n}"`:``}var ml={pie:{prefix:`pie`,first:1},gitGraph:{prefix:`git`,first:0},timeline:{prefix:`cScale`,first:0},radar:{prefix:`cScale`,first:0},treemap:{prefix:`cScale`,first:0},mindmap:{prefix:`cScale`,first:1},venn:{prefix:`venn`,first:1,repeat:!0}},hl=8,gl=/^[\w\s#%.,+\-/()]{1,200}$/,_l=/([\w-]*)\s*\(/g,vl=/var\(\s*([\w-]*)/gi,yl=new Set([`rgb`,`rgba`,`hsl`,`hsla`,`hwb`,`lab`,`lch`,`oklab`,`oklch`,`color`,`color-mix`,`light-dark`,`var`]),bl=e=>Ys(e)?e:{};function xl(e){if(typeof e!=`string`)return;let t=e.trim();if(!gl.test(t))return;if(!t.includes(`(`))return ol(t)?t:void 0;let n=0;for(let e of t)if(e===`(`)n++;else if(e===`)`&&--n<0)return;if(n===0){for(let[,e]of t.matchAll(_l))if(!yl.has(e.toLowerCase()))return;for(let[,e]of t.matchAll(vl))if(!e.startsWith(`--pele-`))return;return t}}function Sl(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?n++:a===`)`?n--:a===`,`&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t.map(e=>e.trim())}function Cl(e,t){if(e===`xychart`){let e=bl(t.xyChart).plotColorPalette;return typeof e==`string`?{list:Sl(e),repeat:!0}:void 0}let n=ml[e];if(n===void 0)return;let r=[];for(let e=0;e<hl;e++)r.push(t[n.prefix+(n.first+e)]);return n.repeat&&(r=r.filter(e=>e!=null&&e!==``)),{list:r,repeat:n.repeat===!0}}var wl={style:``,inks:[]};function Tl(e,t){let n=Cl(e,bl(t.themeVariables));if(n===void 0||n.list.length===0)return wl;let{list:r,repeat:i}=n,a=``,o=[];for(let e=0;e<hl&&!(!i&&e>=r.length);e++){let t=xl(r[e%r.length]);t!==void 0&&(a+=`;--pele-series-${e+1}:${t}`,o[e]=ul(`;fill:${t}`))}return a===``?wl:{style:Ec(a),inks:o}}var El=wl;function Dl(e,t){let n=El;El=e;try{return t()}finally{El=n}}var Ol=()=>El.style;function kl(e){let t=El.inks[(e%hl+hl)%hl];return t?` fill="${t}"`:``}function Al(e){return e.ownerDocument?.defaultView??globalThis}function jl(e,t){let n=e.clientWidth-(parseFloat(t.paddingLeft)||0)-(parseFloat(t.paddingRight)||0);return n>0?n:0}function Ml(e,t,n,r,i){let a=t.width/n,o=t.height/n,s=(e,t,n)=>t>=n?Math.min(Math.max(e,n-t),0):Math.min(Math.max(e,0),n-t);return{x:s(r,a,e.width),y:s(i,o,e.height),width:a,height:o}}var Nl=1.25,Pl=48,Fl=4,Il=`--_bg:var(--pele-bg,#fff);--_fg:var(--pele-fg,#1f1f1f);--_b:var(--pele-border,#8a8a8a);position:absolute;top:var(--pele-zoom-top,8px);right:var(--pele-zoom-right,8px);bottom:var(--pele-zoom-bottom,auto);left:var(--pele-zoom-left,auto);display:flex;flex-direction:column;gap:2px;padding:2px;width:auto;max-width:none;border:1px solid var(--_b);border-radius:var(--pele-radius,4px);background:var(--_bg);color:var(--_fg);line-height:0`,Ll=`appearance:none;display:grid;place-items:center;width:24px;height:24px;margin:0;padding:0;border:0;border-radius:calc(var(--pele-radius,4px) - 1px);background:transparent;color:inherit;font:inherit;cursor:var(--pele-zoom-cursor,pointer)`,Rl={zoomIn:`M5 12h14M12 5v14`,zoomOut:`M5 12h14`,reset:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8M3 3v5h5`},zl={zoomIn:`Zoom in`,zoomOut:`Zoom out`,reset:`Reset zoom`};function Bl(e,t,n){let r=null,i={width:0,height:0},a={width:0,height:0},o={width:0,height:0},s=!1,c=``,l={width:``,height:``,maxWidth:``,margin:``,display:``},u=null,d=0,f=0,p=0,m=0,h=()=>Al(e),g=()=>i.width>0&&a.width>0?a.width/i.width:1,_=()=>Math.max(g(),t.maxScale??3),v=()=>r!==null&&i.width>0&&(t.always===!0||g()<.999),y=()=>{if(!r||d!==0)return;let t=r.getBoundingClientRect();a={width:t.width,height:t.height},o={width:Math.max(a.width,e.clientWidth),height:Math.max(a.height,e.clientHeight)},s=o.width>a.width+1||o.height>a.height+1,s||(o=a);let n=h().getComputedStyle(e);c=[`Top`,`Right`,`Bottom`,`Left`].map(e=>`${-(parseFloat(n.getPropertyValue(`padding-${e.toLowerCase()}`))||0)}px`).join(` `)},b,x={},S=!1,C=()=>{if(t.controls===!1)return;let n=v();if(!b){if(!n)return;let r=e.ownerDocument;b=r.createElement(`div`),b.className=`pele pele-zoom`,b.setAttribute(`style`,Il);let i={zoomIn:()=>k((d||g())*Nl*Nl),zoomOut:()=>k((d||g())/(Nl*Nl)),reset:()=>E()};for(let e of[`zoomIn`,`zoomOut`,`reset`]){let n=r.createElement(`button`),a=t.labels?.[e]??zl[e];n.type=`button`,n.className=`pele-zoom-${e===`zoomIn`?`in`:e===`zoomOut`?`out`:`reset`}`,n.setAttribute(`style`,Ll),n.setAttribute(`aria-label`,a),n.title=a,n.innerHTML=`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${Rl[e]}"/></svg>`,n.addEventListener(`click`,i[e]),x[e]=n,b.append(n)}}n&&!S&&h().getComputedStyle(e).position===`static`&&(e.style.position=`relative`,S=!0),n&&b.parentNode!==e&&e.append(b),b.hidden=!n,b.style.display=n?`flex`:`none`;let r=(e,t)=>{e&&(e.disabled=t,e.style.opacity=t?`0.35`:``,e.style.cursor=t?`default`:`var(--pele-zoom-cursor,pointer)`)};r(x.zoomIn,(d||g())>=_()*.999),r(x.zoomOut,d===0),x.reset&&(x.reset.style.display=d===0?`none`:`grid`)},w=e=>b!==void 0&&e.target instanceof h().Node&&b.contains(e.target),T=()=>{r&&(O(),r.style.width=l.width,r.style.height=l.height,r.style.maxWidth=l.maxWidth,r.style.margin=l.margin,r.style.display=l.display)},E=()=>{r&&(T(),d=0,r.setAttribute(`viewBox`,`0 0 ${i.width} ${i.height}`),r.style.cursor=``,r.style.userSelect=``,y(),r.style.touchAction=v()?`pan-y`:``,v()?r.setAttribute(`tabindex`,`0`):r.removeAttribute(`tabindex`),ue(v()),C(),D())},D=()=>{if(!r||!b||b.hidden)return;let t=b.getBoundingClientRect(),n=[...r.querySelectorAll(`text`)].some(e=>{let n=e.getBoundingClientRect();return n.right>t.left&&n.left<t.right&&n.bottom>t.top&&n.top<t.bottom}),i=r.getBoundingClientRect(),a=t.left-Fl;if(!n||i.right-a>=i.width/2)return;let o=e.getBoundingClientRect(),s=e.offsetWidth>0?o.width/e.offsetWidth:1,c=parseFloat(h().getComputedStyle(e).paddingRight)||0,l=o.left+(e.clientLeft+e.clientWidth-c)*s,d=[r.style.maxWidth,r.style.marginRight];r.style.maxWidth=`${(a-i.left)/s}px`,r.style.marginRight=`${Math.max(l-a,0)/s}px`,u={before:d,after:[r.style.maxWidth,r.style.marginRight]},r.getBoundingClientRect().right>a+1&&O(),y()},O=()=>{!r||!u||(r.style.maxWidth===u.after[0]&&(r.style.maxWidth=u.before[0]),r.style.marginRight===u.after[1]&&(r.style.marginRight=u.before[1]),u=null)},k=(e,t,n)=>{if(!r||(d===0&&y(),!v()))return;let i=d||g(),a=Math.min(Math.max(e,g()),_());if(a<=g()*1.001){E();return}let l=r.getBoundingClientRect(),u=t??l.left+l.width/2,m=n??l.top+l.height/2,h=(d?f:0)+(u-l.left)/i,b=(d?p:0)+(m-l.top)/i;d=a;let x=l;s&&(r.style.maxWidth=`none`,r.style.margin=c,r.style.display=`block`,r.style.width=`${o.width}px`,r.style.height=`${o.height}px`,x=r.getBoundingClientRect()),A(h-(u-x.left)/d,b-(m-x.top)/d),r.style.cursor=`grab`,r.style.userSelect=`none`,r.style.touchAction=`none`,C()},A=(e,t)=>{if(!r)return;let n=Ml(i,o,d,e,t);f=n.x,p=n.y,r.setAttribute(`viewBox`,`${f} ${p} ${n.width} ${n.height}`)},j=(e,t)=>{d!==0&&A(f-e/d,p-t/d)},M=()=>{F();let t=e.clientWidth+e.clientHeight;t!==m&&(m=t,E())},N,P,F=()=>{if(!n)return;let t=h();t!==P&&(N?.disconnect(),P=t,N=t.ResizeObserver?new t.ResizeObserver(M):void 0,N?.observe(e))},I=()=>{F(),d===0?O():T();let t=e.firstElementChild;r=t&&t.localName===`svg`?t:null,d=0,r?(i={width:Number(r.getAttribute(`width`))||0,height:Number(r.getAttribute(`height`))||0},l={width:r.style.width,height:r.style.height,maxWidth:r.style.maxWidth,margin:r.style.margin,display:r.style.display},E()):(b?.remove(),ue(!1))},L=new Map,R=!1,z=0,B=0,V=()=>{let[e,t]=[...L.values()];return{distance:Math.hypot(e.x-t.x,e.y-t.y),x:(e.x+t.x)/2,y:(e.y+t.y)/2}},H=()=>{R=!1},U=t=>{!v()||w(t)||t.pointerType===`mouse`&&t.button!==0||(L.set(t.pointerId,{x:t.clientX,y:t.clientY}),z=0,L.size===2&&(B=V().distance),(L.size===2||d!==0)&&(e.setPointerCapture?.(t.pointerId),r&&(r.style.cursor=`grabbing`)))},ee=e=>{let t=L.get(e.pointerId);if(t){if(L.size===2){let t=V();L.set(e.pointerId,{x:e.clientX,y:e.clientY});let n=V();B>0&&n.distance>0&&k((d||g())*(n.distance/t.distance),n.x,n.y),j(n.x-t.x,n.y-t.y),R=!0;return}L.set(e.pointerId,{x:e.clientX,y:e.clientY}),d!==0&&(z+=Math.abs(e.clientX-t.x)+Math.abs(e.clientY-t.y),z>4&&(R=!0),j(e.clientX-t.x,e.clientY-t.y))}},te=e=>{L.delete(e.pointerId)&&(B=0,L.size===0&&r&&d!==0&&(r.style.cursor=`grab`))},W=e=>{!R||e.detail===0||(R=!1,e.preventDefault(),e.stopPropagation())},ne=e=>{if(!(e.ctrlKey||e.metaKey)||!v())return;e.preventDefault(),d===0&&y();let t=Math.min(Math.max(-e.deltaY,-24),24);k((d||g())*2**(t*.02),e.clientX,e.clientY)},G=e=>{!v()||w(e)||(e.preventDefault(),d===0?k(Math.max(1,g()*2),e.clientX,e.clientY):E())},re=e=>{if(!v()||w(e)||e.ctrlKey||e.metaKey||e.altKey)return;let t=e.key;if(t===`+`||t===`=`)k((d||g())*Nl);else if(t===`-`)k((d||g())/Nl);else{if(d===0)return;if(t===`0`||t===`Escape`)E();else if(t===`ArrowLeft`)j(Pl,0);else if(t===`ArrowRight`)j(-Pl,0);else if(t===`ArrowUp`)j(0,Pl);else if(t===`ArrowDown`)j(0,-Pl);else return}e.preventDefault()},K=e=>{if(!r||e.target!==r)return;let t=!0;try{t=r.matches(`:focus-visible`)}catch{}r.style.outline=t?``:`none`},ie=0,q=e=>{v()&&(e.preventDefault(),d===0&&y(),ie=d||g())},ae=e=>{if(ie===0)return;e.preventDefault();let{scale:t,clientX:n,clientY:r}=e;k(ie*t,n,r)},oe=()=>{ie=0},se=[[`pointerdown`,H,{capture:!0}],[`pointerdown`,U],[`pointermove`,ee],[`pointerup`,te],[`pointercancel`,te],[`click`,W,{capture:!0}],[`dblclick`,G],[`keydown`,re],[`focusin`,K]];for(let[t,n,r]of se)e.addEventListener(t,n,r);let ce=[[`wheel`,ne,{passive:!1}],[`gesturestart`,q,{passive:!1}],[`gesturechange`,ae,{passive:!1}],[`gestureend`,oe,{passive:!1}]],le=!1;function ue(t){if(t!==le){le=t;for(let[n,r,i]of ce)t?e.addEventListener(n,r,i):e.removeEventListener(n,r,i);t||(ie=0)}}return m=e.clientWidth+e.clientHeight,I(),{get scale(){return d||g()},get fit(){return g()},zoomBy(e){k((d||g())*e)},zoomTo(e){k(e)},reset:E,refresh:I,resized:M,destroy(){E(),O(),r&&(r.style.touchAction=``,r.removeAttribute(`tabindex`)),b?.remove(),S&&(e.style.position=``),N?.disconnect(),ue(!1);for(let[t,n,r]of se)e.removeEventListener(t,n,r)}}}function Vl(e,t){let n=t?Al(t).getComputedStyle(t):e;return{family:n.getPropertyValue(`--pele-font`).trim()||e.fontFamily||void 0,mono:n.getPropertyValue(`--pele-font-mono`).trim()||void 0}}function Hl(e){return[...new Set([e.ownerDocument?.fonts,globalThis.document?.fonts])].filter(e=>e!==void 0)}var Ul=new WeakMap;function Wl(e){let t=Ul.get(e);return t||(t=e.ready.then(()=>{Ul.delete(e),xc()}),Ul.set(e,t)),t}var Gl=new WeakMap;function Kl(e,t){Promise.all(e.map(Wl)).then(()=>{let e=t.deref();e&&Gl.get(e)?.()})}var ql=new WeakMap,Jl=0,Yl=Math.random().toString(36).slice(2,7),Xl=`position:relative;height:1.3em;margin-top:-1.3em;line-height:1.3;font-size:0.8em;color:var(--pele-error,#e45756);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;`,Zl=`margin:0;font-size:0.8em;font-family:var(--pele-font-mono,monospace);color:var(--pele-error,#e45756);white-space:pre-wrap;`;function Ql(e){return e instanceof Error?e.message:String(e)}function $l(e){let t=e.split(`
|
|
60
|
+
`).filter(e=>e.trim()!==``);return t.length>1?`${t[0]} ${t[t.length-1]}`:t[0]??``}function eu(e,t,n,r={}){ql.get(t)?.destroy();let i=n,a=r,o,s,c=!1,l,u,d,f=`pele-${Yl}-${++Jl}`,p={},m,h=-1,g=!1,_=!1,v=!1,y=(n,r)=>{let{onRender:i,onError:s,sanitize:c,...l}=a,d={...l,idPrefix:l.idPrefix??f,fontFamily:l.fontFamily??p.family,fontFamilyMono:l.fontFamilyMono??p.mono,maxWidth:void 0};r&&(u=e.render(o,d),m=void 0);let g=a.maxWidth??jl(t,n);return h=g,g>0&&g<u.width&&(m??=e.render(o,{...d,maxWidth:1}).svg!==u.svg,m)?e.render(o,{...d,maxWidth:g}):u},b=e=>{a.sanitize?t.replaceChildren(a.sanitize(e)):t.innerHTML=e},x,S=()=>{let e=d?t.firstElementChild:null;if(e?.style&&(e.style.opacity=l===void 0?``:`0.4`),l===void 0){x?.remove(),x=void 0;return}let n=t.ownerDocument;if(!n)return;x??=n.createElement(`div`),x.className=`pele pele-error`;let r=Ql(l);e?(x.textContent=$l(r),x.title=r,x.setAttribute(`style`,Xl),x.parentNode!==t&&t.append(x)):(x.textContent=r,x.removeAttribute(`title`),x.setAttribute(`style`,Zl),t.replaceChildren(x))},C=e=>{l=e,S(),a.onError?.(e)},w=()=>{if(_||v)return;let e=Hl(t).filter(e=>e.status===`loading`);e.length!==0&&(_=!0,Kl(e,new WeakRef(R)))},T=()=>{_=!1,g=!0,M()},E=(e,n=!e)=>{let r=Al(t).getComputedStyle(t),i=t.firstElementChild??null,f={fonts:p,natural:u,adapts:m,drawnFor:h,stale:g},_;try{if(e&&(p=Vl(r,i),g=t.isConnected===!1),_=y(r,e),n&&_.svg===d?.svg){e&&(s=o),c&&l!==void 0&&(l=void 0,S());return}b(_.svg)}catch(e){throw{fonts:p,natural:u,adapts:m,drawnFor:h,stale:g}=f,e}if(e&&(s=o),e&&!i&&t.firstElementChild){let e=Vl(r,t.firstElementChild);if(e.family!==p.family||e.mono!==p.mono){let t={fonts:p,natural:u,adapts:m,drawnFor:h};p=e;try{let e=y(r,!0);b(e.svg),_=e}catch{({fonts:p,natural:u,adapts:m,drawnFor:h}=t)}}}d=_,c&&(l=void 0),S(),D?.refresh(),w(),a.onRender?.(_)},D,O=!1,k=()=>{let e=a.zoom??`auto`;e!==O&&(D?.destroy(),O=e,D=e===!1?void 0:Bl(t,typeof e==`object`?e:{always:e===!0},!1))},A=()=>t.isConnected===!1||!(t.clientWidth>0),j=()=>t.isConnected!==!1&&!(t.clientWidth>0),M=()=>{if(v||(L(),!o||A()))return;let e=Al(t).getComputedStyle(t),n=Vl(e,t.firstElementChild??null);try{if(g||n.family!==p.family||n.mono!==p.mono)E(!0,!0);else if(m!==!1&&a.maxWidth===void 0){let n=jl(t,e);n!==h&&n!==d?.width&&E(!1)}}catch(e){g=!1,c&&(l=e),o!==s&&(o=s,c=!1),S(),a.onError?.(e)}D?.resized(),w()},N,P,F,I=()=>{F!==void 0&&N?.cancelAnimationFrame(F),F=void 0},L=()=>{let e=Al(t);e!==N&&(P?.disconnect(),I(),N=e,P=e.ResizeObserver?new e.ResizeObserver(()=>{if(F===void 0){if(!e.requestAnimationFrame)return M();F=e.requestAnimationFrame(()=>{F=void 0,M()})}}):void 0,P?.observe(t))},R={get result(){return d},get source(){return i},get error(){return l},get zoom(){return D},update(t,n=a){let r=!c||t!==i||n.limit!==a.limit||n.maxEdges!==a.maxEdges||n.config!==a.config;i=t,a=n;let l=o;if(r)try{l=e.parse(t,n)}catch(e){c=!1,C(e),k();return}let u=d;if(o=l,c=!0,j())g=!0,k();else{try{E(!0)}catch(e){if(d!==u)throw k(),e;o=s,c=!1,C(e)}k()}},refresh:M,destroy(){v=!0,P?.disconnect(),P=void 0,I(),N=void 0,D?.destroy(),Gl.delete(R),ql.get(t)===R&&ql.delete(t)}};Gl.set(R,T);try{o=e.parse(n,r),c=!0,E(!0)}catch(e){if(d)throw e;o=s,c=!1,C(e)}return k(),L(),ql.set(t,R),R}var tu=new Map;function nu(...e){for(let t of e)tu.set(t.type,t)}var ru=5e4,iu=4e6,au=5e3;function ou(e){try{return e()}catch(e){throw e instanceof RangeError?new jo(`Diagram is nested too deeply.`,`limit`):e}}function su(e,t){try{return t()}catch(t){if(t instanceof RangeError)throw new jo(`Diagram is nested too deeply.`,`limit`,e);if(t instanceof jo){t.type??=e.type,t.mermaidType??=e.mermaidType;let n=Yo(t.message);n!==t.message&&(t.stack=t.stack?.replace(t.message,()=>n),t.message=n),t.snippet=Yo(t.snippet)}throw t}}var cu=new WeakMap;function lu(e,t=ru,n=au,r){if(e.length>t)throw new jo(`Diagram source is longer than the limit of ${t} characters.`,`limit`);let i=Qs(e),a=Ao(i.text);if(a===null)throw new jo(`No diagram type detected for the given text.`,`unsupported-diagram`);let o=tu.get(a.type);if(o===void 0)throw new jo(`Diagram type "${a.type}" is not supported yet.`,`unsupported-diagram`,a);let s=r?{...r,...i.config}:i.config,c=o.keepComments===!0,l=ic(c?i.withComments:i.text)+`
|
|
61
|
+
`,u=su(a,()=>Io({parsed:l,find:uu(e,c)},()=>o.parse(l,s,i.title,i.lineOffset,{maxEdges:n})));return{...a,diagram:o,model:u,config:s}}function uu(e,t){let n,r=``;return i=>{if(n===void 0){n=[];let i=Qs(e,n);ic(t?i.withComments:Ws(i.withComments,n),n),r=Gs(e)+`
|
|
62
|
+
`}return[r,Po(n,i)]}}function du(e,t){if(typeof e==`string`)return lu(e,t.limit,t.maxEdges,t.config);let n=cu.get(e);if(n===void 0)throw TypeError(`render() takes diagram text or a model that parse() returned.`);return n}function fu(e,t={}){return ou(()=>{let n=lu(e,t.limit,t.maxEdges,t.config),r=n.model;return Object.defineProperty(r,"mermaidType",{value:n.mermaidType,enumerable:!0}),cu.set(r,n),r})}function pu(e,t={}){return ou(()=>{let{type:n,mermaidType:r,diagram:i,model:a,config:o}=du(e,t),s=o[i.section??n],c=typeof s==`object`&&!!s&&!Array.isArray(s)&&s.useMaxWidth===!1,l=t.responsive??!c,u=t.icons,d=u&&(e=>u(Xo(e))),f=su({type:n,mermaidType:r},()=>Dl(Tl(n,o),()=>rs(i.math?t.math:void 0,()=>$o(d,()=>i.render(a,o,{...t,responsive:l,icons:d}))))),p=t.outputLimit??iu;if(f.svg.length>p)throw new jo(`Diagram output is longer than the limit of ${p} characters.`,`limit`,{type:n,mermaidType:r});for(let e of f.links)e.id=Xo(e.id);return{type:n,mermaidType:r,...f}})}function mu(e,t,n={}){return eu({parse:fu,render:pu},e,t,n)}var hu=`about:blank`,gu=/^([^\w]*)(javascript|data|vbscript)/im,_u=/&#(\w+)(^\w|;)?/g,vu=/&(newline|tab);/gi,yu=/[\u0000-\u001F\u007F-\u009F -\uD800-\uDFFF\uFFFE\uFFFF]/gimu,bu=/^.+(:|:)/gim,xu=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g;function Su(e){try{return decodeURIComponent(e)}catch{return e}}function Cu(e,t){let n=t?Su(e.trim()):e.trim(),r,i=0;do{if(++i>32)return;n=n.replace(yu,``).replace(_u,(e,t)=>String.fromCharCode(t)).replace(vu,``).replace(yu,``).replace(xu,``).trim(),t&&(n=Su(n)),r=n.match(yu)||n.match(_u)||n.match(vu)||n.match(xu)}while(r&&r.length>0);return n}function wu(e){if(!e)return hu;let t=Cu(e,!0),n=Cu(e,!1);if(!t||!n)return hu;if(t[0]===`.`||t[0]===`/`)return n;let r=t.trimStart().match(bu);if(!r)return n;let i=r[0].toLowerCase().trim();if(gu.test(i))return hu;let a=n.trimStart().replace(/\\/g,`/`);if(i===`mailto:`||i.includes(`://`))return a;if(i===`http:`||i===`https:`){let e;try{e=new URL(a)}catch{return hu}return e.protocol=e.protocol.toLowerCase(),e.hostname=e.hostname.toLowerCase(),e.toString()}return a}function Tu(e){return wu(Xo(e))}var Eu=[`http`,`https`,`mailto`,`tel`],Du=[`http`,`https`],Ou=/^([a-z][a-z0-9+.-]*):/i,ku=/^[\\/]{2}/;function Au(e,t){if(ku.test(e))return!1;let n=Ou.exec(e);return!n||t.includes(n[1].toLowerCase())}function ju(e,t){let n=Cu(e,!0);return n!==void 0&&Au(e,t)&&Au(n,t)?e:void 0}function Mu(e,t){return t.links===!1?void 0:ju(e,t.linkSchemes??Eu)}function Nu(e,t){return t.images===!1?void 0:ju(e,t.imageSchemes??Du)}var Pu=new RegExp(Tc.source,`gu`);function Fu(e,t){let n=wu(e);return n===hu||Mu(n,t)===void 0?!1:Mu(e.replace(Pu,``).replace(/[\t\n\r]/g,``).replace(/^[\x00-\x20]+/,``),t)!==void 0}function Iu(e,t,n,r,i,a=``){let o=Mu(t,i);return o===void 0?e:(r.push({id:n,href:o,internal:!1}),`<a href="${Ec(o)}"${a}${Lu(i)}>${e}</a>`)}function Lu(e){let t=e.linkRel??`noopener`;return t?` rel="${Ec(t)}"`:``}var Ru=[[`rect`,`proc`,`process`,`rectangle`,`squareRect`],[`rounded`,`event`,`roundedRect`],[`stadium`,`terminal`,`pill`],[`fr-rect`,`subprocess`,`subproc`,`framed-rectangle`,`subroutine`],[`cyl`,`db`,`database`,`cylinder`],[`datastore`,`data-store`],[`folder`,`directory`],[`bucket`],[`console`],[`browser`],[`person`],[`circle`,`circ`],[`bang`],[`cloud`],[`diam`,`decision`,`diamond`,`question`],[`hex`,`hexagon`,`prepare`],[`lean-r`,`lean-right`,`in-out`,`lean_right`],[`lean-l`,`lean-left`,`out-in`,`lean_left`],[`trap-b`,`priority`,`trapezoid-bottom`,`trapezoid`],[`trap-t`,`manual`,`trapezoid-top`,`inv-trapezoid`,`inv_trapezoid`],[`dbl-circ`,`double-circle`,`doublecircle`],[`text`],[`notch-rect`,`card`,`notched-rectangle`],[`lin-rect`,`lined-rectangle`,`lined-process`,`lin-proc`,`shaded-process`],[`sm-circ`,`start`,`small-circle`,`stateStart`],[`fr-circ`,`stop`,`framed-circle`,`stateEnd`],[`fork`,`join`,`forkJoin`],[`hourglass`,`collate`],[`brace`,`comment`,`brace-l`],[`brace-r`],[`braces`],[`bolt`,`com-link`,`lightning-bolt`],[`doc`,`document`],[`delay`,`half-rounded-rectangle`],[`h-cyl`,`das`,`horizontal-cylinder`],[`lin-cyl`,`disk`,`lined-cylinder`],[`curv-trap`,`curved-trapezoid`,`display`],[`div-rect`,`div-proc`,`divided-rectangle`,`divided-process`],[`tri`,`extract`,`triangle`],[`win-pane`,`internal-storage`,`window-pane`],[`f-circ`,`junction`,`filled-circle`],[`notch-pent`,`loop-limit`,`notched-pentagon`],[`flip-tri`,`manual-file`,`flipped-triangle`],[`sl-rect`,`manual-input`,`sloped-rectangle`],[`docs`,`documents`,`st-doc`,`stacked-document`],[`st-rect`,`procs`,`processes`,`stacked-rectangle`],[`bow-rect`,`stored-data`,`bow-tie-rectangle`],[`cross-circ`,`summary`,`crossed-circle`],[`tag-doc`,`tagged-document`],[`tag-rect`,`tagged-rectangle`,`tag-proc`,`tagged-process`],[`flag`,`paper-tape`],[`odd`,`rect_left_inv_arrow`],[`lin-doc`,`lined-document`]],zu=`state.choice.note.composite.rectWithTitle.labelRect.block_arrow.collapsedGroup.iconSquare.iconCircle.icon.iconRounded.imageSquare.anchor.kanbanItem.mindmapCircle.defaultMindmapNode.classBox.erBox.requirementBox.usecaseActor.usecaseActorHollow.usecaseActorAwesome.usecaseActorIcon.usecaseBusiness.usecaseEllipse.usecaseJsonTable`.split(`.`),Bu=new Map([[`square`,`rect`],[`round`,`rounded`],[`ellipse`,`ellipse`],[`hexagon`,`hex`],[`diamond`,`diam`]]),Vu=new Map;for(let e of Ru)for(let t of e)Vu.set(t,e[0]);for(let e of zu)Vu.set(e,e);function Hu(e){return Vu.has(e)}function Uu(e){return e===void 0?`rect`:Bu.get(e)??Vu.get(e)??`rect`}var Wu=new Map([[`task`,`roundedRect`],[`tool`,`subroutine`],[`input`,`lean-right`],[`decision`,`diamond`],[`refdoc`,`lin-doc`],[`action`,`hexagon`],[`round`,`rect`]]),Gu=new Set(`doc.stadium.terminal.circle.trapezoid.inv_trapezoid.inv-trapezoid.doublecircle.double-circle.typeDeclaration.procs.lean_left.lean-left.in-out.cylinder.ellipse.odd.tag-rect.tagged-rectangle.delay.half-rounded-rectangle.lin-rect.lined-rectangle.win-pane.window-pane.curv-trap.curved-trapezoid`.split(`.`)),Ku=new Set([`roundedRect`,`subroutine`,`subprocess`,`subproc`,`framed-rectangle`,`lean-right`,`diamond`,`lin-doc`,`lined-document`,`hexagon`,`hex`,`connector`,`collapsedGroup`]),qu=`roundedRect`;function Ju(e){return e&&(Wu.get(e)??e)}function Yu(e){return Hu(e)||e===`constructor`}function Xu(e,t){for(let n of e)n.isGroup||(n.shape&&n.shape!==`squareRect`&&n.shape!==`rect`||(n.shape=qu),Gu.has(n.shape)?(t.emitError(`SHAPE_REMOVED`,`shape "${n.shape}" was removed in v0.8.1, using "${qu}"`,{nodeId:n.id}),n.shape=qu):Ku.has(n.shape)||(t.emitWarning(`SHAPE_UNSUPPORTED`,`shape "${n.shape}" is not supported, using "${qu}"`,{nodeId:n.id}),n.shape=qu))}var Zu=new Set([`shape`,`view`,`icon`,`img`,`form`,`pos`,`w`,`h`,`class`,`style`,`labelType`]),Qu=new Set([`subroutine`,`subprocess`,`subproc`,`framed-rectangle`,`tool`]);function $u(e){return Qu.has(e.type)}function ed(e){return e===`markdown`||e===`string`||e===`text`?e:`markdown`}function td(e){return e.startsWith(`"`)&&e.endsWith(`"`)?e.substring(1,e.length-1):e}function nd(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function rd(e){let t=e=>Array.isArray(e)?[]:nd(e)?{}:e,n=t(e),r=[[e,n]];for(;r.length>0;){let[e,n]=r.pop();if(Array.isArray(e))for(let i of e){let e=t(i);n.push(e),typeof i==`object`&&i&&r.push([i,e])}else if(nd(e))for(let i of Object.keys(e)){if(i===`__proto__`||i===`constructor`||i===`prototype`)continue;let a=e[i],o=t(a);n[i]=o,typeof a==`object`&&a&&r.push([a,o])}}return n}function id(e,t){return Object.assign(e??{},t)}var ad=/:\s*[>|][\d+-]*\s*$/,od=/,([\t ]*)$/;function sd(e){let t=!1,n=!1,r=0,i,a=[];for(let o of e.split(`
|
|
63
|
+
`)){if(i!==void 0){let e=o.length-o.trimStart().length;if(o.trim()===``||e>i){a.push(o);continue}i=void 0}let e=-1;for(let i=0;i<o.length;i++){let a=o[i];if(n)a===`\\`?i++:a===`"`&&(n=!1);else if(t)a===`'`&&(t=!1);else if(a===`"`)n=!0;else if(a===`'`)t=!0;else if(a===`#`&&(i===0||o[i-1]===` `||o[i-1]===` `)){e=i;break}else a===`[`||a===`{`?r++:(a===`]`||a===`}`)&&(r=Math.max(0,r-1))}if(t||n||r>0){a.push(o);continue}let s=e>=0?o.slice(0,e):o,c=e>=0?o.slice(e):``;ad.test(s)?(i=o.length-o.trimStart().length,a.push(o)):a.push(s.replace(od,`$1`)+c)}return a.join(`
|
|
64
|
+
`)}function cd(e,t){if(e===`arrow_point`&&t===`normal`)return`sequence`;if(e===`arrow_cross`&&t===`normal`)return`failure`;if(e===`arrow_open`&&t===`dotted`)return`reference`}function ld(e){let t=e.trim(),n=t.slice(0,-1),r=`arrow_open`;switch(t.slice(-1)){case`x`:r=`arrow_cross`;break;case`>`:r=`arrow_point`;break;case`-`:case`.`:n=t}let i=`normal`,a=n.length-1,o=0;for(let e=0;e<n.length;e++)n[e]===`.`&&o++;return o>0&&(i=`dotted`,a=o),{type:r,stroke:i,length:a}}function ud(e){if(!e)return;let t={},n=!1;for(let r of Object.keys(e))Zu.has(r)||(t[r]=e[r],n=!0);return n?t:void 0}var dd=class{type=`agentflow`;direction;nodes=new Map;edges=[];subgraphs=[];connectors=new Map;classes=new Map;tooltips=new Map;defaultEdgeStyle;defaultInterpolate;mappings=[];diagnostics=[];title;accTitle;accDescr;lineOffset;subgraphLookup=new Map;globalNodes=new Set;members=new Set;edgeById=new Map;pairCount=new Map;subCount=0;bareMappings=new Set;firstMapping=new Map;reported=new Map;options;constructor(e={}){this.options=e,this.lineOffset=e.lineOffset??0}metadata(e,t,n){let r=t.includes(`
|
|
65
|
+
`),i;try{i=js(r?t+`
|
|
66
|
+
`:`{
|
|
67
|
+
`+t+`
|
|
68
|
+
}`)}catch(a){let o=r?sd(t):t,s;if(o!==t)try{s=js(o+`
|
|
69
|
+
`)}catch{s=void 0}if(s===void 0){let{line:t,column:r}=this.errorAt(n),i=n?` (${t}:${r})`:``;throw new jo(`Metadata of "${e}" is not valid YAML. ${a.message}${i}`,`syntax`,{type:`agentflow`,line:t,column:r})}i=s}return rd(i??{})}errorAt(e){if(e===void 0)return{line:0,column:0};let t=this.options.source;if(t===void 0)return{line:e.first_line+this.lineOffset,column:e.first_column+1};let n=0;for(let r=1;r<e.first_line;r++)n=t.indexOf(`
|
|
70
|
+
`,n)+1;let{line:r,column:i}=Ro(t,n+e.first_column);return{line:r,column:i}}shapeError(e,t){return new jo(e,`semantic`,{type:`agentflow`,...this.errorAt(t)})}addVertex(e,t,n,r,i,a,o={},s,c){if(!e||e.trim().length===0)return;let l,u,d;s!==void 0&&(l=this.metadata(e,s,c),nd(l)&&(u=l,typeof l.shape==`string`&&(d=l.shape,l.shape=Ju(l.shape))));let f=this.subgraphLookup.get(e);if(f&&l){f.metadata=id(f.metadata,l);return}let p=this.connectors.get(e);if(p&&l){p.metadata=id(p.metadata,l);return}if(e===`connectors`)return;let m=this.edgeById.get(e);if(m){u?.animate!==void 0&&(m.animate=u.animate),u?.animation!==void 0&&(m.animation=u.animation),u?.curve!==void 0&&(m.interpolate=u.curve),l&&(m.metadata=id(m.metadata,l));return}let h=this.nodes.get(e);if(h===void 0&&(h={id:e,labelType:`text`,styles:[],classes:[]},this.nodes.set(e,h)),t===void 0?h.text===void 0&&(h.text=e):(h.labelType=t.type,h.text=td(t.text.trim())),n!==void 0&&(h.type=n),r!=null)for(let e of r)h.styles.push(e);if(i!=null)for(let e of i)h.classes.push(e);if(a!==void 0&&(h.dir=a),h.props===void 0?h.props=o:o!==void 0&&Object.assign(h.props,o),l&&(h.metadata=id(h.metadata,l),u!==void 0)){if(u.shape){let e=d??u.shape;if(typeof e!=`string`)throw this.shapeError(`No such shape: ${JSON.stringify(e)}.`,c);if(e!==e.toLowerCase()||e.includes(`_`))throw this.shapeError(`No such shape: ${e}. Shape names should be lowercase.`,c);let t=u.shape;if(!Yu(t))throw this.shapeError(`No such shape: ${t}.`,c);h.type=t}u.label&&(h.text=String(u.label),h.labelType=ed(u.labelType))}}addSingleLink(e,t,n,r){let i={start:e,end:t,type:void 0,text:``,labelType:`text`,classes:[],isUserDefinedId:!1,interpolate:this.defaultInterpolate},a=n?.text;a!==void 0&&(i.text=td(a.text.trim()),i.labelType=ed(a.type)),n!==void 0&&(i.type=n.type,i.stroke=n.stroke,i.length=n.length>10?10:n.length,n.edgeSemantic&&(i.edgeSemantic=n.edgeSemantic));let o=e+`\0`+t,s=this.pairCount.get(o)??0;r&&!this.edgeById.has(r)?(i.id=r,i.isUserDefinedId=!0):i.id=`L_${e}_${t}_${s===0?0:s+1}`;let c=this.options.maxEdges;if(c!==void 0&&this.edges.length>=c)throw new jo(`Edge limit exceeded. The limit is ${c}.`,`limit`,{type:`agentflow`});this.edges.push(i),this.pairCount.set(o,s+1),this.edgeById.has(i.id)||this.edgeById.set(i.id,i)}addLink(e,t,n){let r=typeof n?.id==`string`?n.id.replace(`@`,``):void 0,i=e[e.length-1],a=t[0];for(let o of e)for(let e of t)this.addSingleLink(o,e,n,o===i&&e===a?r:void 0)}updateLinkInterpolate(e,t){for(let n of e)n==="default"?this.defaultInterpolate=t:this.edgeAt(n).interpolate=t}updateLink(e,t){for(let n of e){if(n==="default"){this.defaultEdgeStyle=t;continue}let e=this.edgeAt(n);e.style=t,t.length>0&&!t.some(e=>e?.startsWith(`fill`))&&t.push(`fill:none`)}}edgeAt(e){let t=this.edges[Number(e)];if(t===void 0)throw new jo(`The index ${e} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${this.edges.length-1}. (Help: Ensure that the index is within the range of existing edges.)`,`semantic`,{type:`agentflow`});return t}addClass(e,t){let n=t.join().replace(/\\,/g,`§§§`).replace(/,/g,`;`).replace(/§§§/g,`,`).split(`;`);for(let t of e.split(`,`)){let e=this.classes.get(t);e===void 0&&(e={id:t,styles:[],textStyles:[]},this.classes.set(t,e));for(let t of n)t.includes(`color`)&&e.textStyles.push(t.replace(`fill`,`bgFill`)),e.styles.push(t)}}setDirection(e){let t=e.trim();t.includes(`<`)&&(t=`RL`),t.includes(`^`)&&(t=`BT`),t.includes(`>`)&&(t=`LR`),t.includes(`v`)&&(t=`TB`),t===`TD`&&(t=`TB`),this.direction=t}setClass(e,t){for(let n of e.split(`,`))this.nodes.get(n)?.classes.push(t),this.edgeById.get(n)?.classes.push(t),this.subgraphLookup.get(n)?.classes.push(t)}setTooltip(e,t){if(t!==void 0)for(let n of e.split(`,`))this.tooltips.set(n,t)}setLink(e,t,n){let r=t.trim();for(let t of e.split(`,`)){let e=this.nodes.get(t);e!==void 0&&(e.link=r?Tu(r):void 0,e.linkTarget=n)}this.setClass(e,`clickable`)}setClickEvent(e,t,n){this.setClass(e,`clickable`)}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
71
|
+
`)}addSubGraph(e,t,n,r){let i=e?.text?.trim(),a=n?.text||``;e!==void 0&&e===n&&/\s/.test(a)&&(i=void 0);let o=new Set,s=[],c;for(let e of t)if(typeof e==`string`)e.trim()!==``&&!o.has(e)&&(o.add(e),s.push(e));else if(Array.isArray(e))for(let t of e)t.trim()!==``&&!o.has(t)&&(o.add(t),s.push(t));else c=e.value;c??=this.options.inheritDir?this.direction??this.options.direction:void 0,i??=`subGraph`+this.subCount,this.subCount++;let l=this.members,u=s.filter(e=>e!==i&&!this.globalNodes.has(e)&&!l.has(e));for(let e of u)l.add(e);let d=this.subgraphLookup.get(i);if(d){for(let e of u)d.nodes.push(e);return a.trim()&&(d.title=a.trim()),c&&(d.dir=c),i}let f={id:i,nodes:u,title:a.trim(),classes:[],dir:c,labelType:ed(n?.type),type:`flow`};return this.subgraphs.push(f),this.subgraphLookup.set(i,f),i}addGlobal(e){let t=!1,n=e=>{let n=e.trim();n!==``&&(this.globalNodes.add(n),this.members.delete(n)&&(t=!0))};for(let t of e)if(typeof t==`string`)n(t);else if(Array.isArray(t))for(let e of t)n(e);if(t)for(let e of this.subgraphs)e.nodes=e.nodes.filter(e=>!this.globalNodes.has(e))}addConnector(e,t){let n=e?.text?.trim();if(!n)return``;let r=t?.text?.trim()??``,i=this.connectors.get(n);if(i)r.length>0&&(i.text=r);else{let e={id:n,labelType:`text`,styles:[],classes:[],isConnector:!0,text:r.length>0?r:n};this.connectors.set(n,e),this.nodes.set(n,e)}return n}destructLink(e,t){let n=ld(e);return t&&(t.includes(`.`)?`dotted`:`normal`)!==n.stroke?{type:`INVALID`,stroke:`INVALID`}:{...n,edgeSemantic:cd(n.type,n.stroke)}}subgraph(e){return this.subgraphLookup.get(e)}vertexKind(e){if($u(e))return`tool`;let t=Ju(e.type);return t===`hexagon`||t===`hex`?`action`:t===`lean-right`||t===`lean_right`?`input`:t===`lin-doc`||t===`lined-document`?`refdoc`:t===`diamond`?`decision`:`task`}semanticModel(){let e=[],t=[];for(let[n,r]of this.nodes){if(this.subgraphLookup.has(n))continue;let i=ud(r.metadata);if(r.isConnector){let e={id:n};r.text!==void 0&&r.text!==n&&(e.title=r.text),i&&(e.metadata=i),t.push(e);continue}let a={id:n};r.text!==void 0&&(a.label=r.text);let o=Ju(r.type);o!==void 0&&(a.shape=o),a.vertexKind=this.vertexKind(r),i&&(a.metadata=i),e.push(a)}let n={vertices:e,edges:this.edges.map(e=>{let t={start:e.start,end:e.end};return e.id!==void 0&&(t.id=e.id),e.text.length>0&&(t.label=e.text),e.type!==void 0&&(t.type=e.type),e.stroke!==void 0&&(t.stroke=e.stroke),e.edgeSemantic!==void 0&&(t.edgeSemantic=e.edgeSemantic),e.length!==void 0&&(t.length=e.length),e.metadata&&Object.keys(e.metadata).length>0&&(t.metadata={...e.metadata}),t}),subGraphs:this.subgraphs.map(e=>{let t={id:e.id,nodes:[...e.nodes],type:e.type,title:e.title};e.dir!==void 0&&(t.direction=e.dir);let n=ud(e.metadata);return n&&(t.metadata=n),t}),connectors:t,diagnostics:this.diagnostics};return this.direction!==void 0&&(n.direction=this.direction),n}position(e){let t=e?.first_line??0,n=e?.first_column??0;return{startLine:t+this.lineOffset,startColumn:n,endLine:(e?.last_line??t)+this.lineOffset,endColumn:e?.last_column??n,startIndex:0,endIndex:0}}pushMapping(e,t,n){let r={id:e,type:t,position:n};return this.mappings.push(r),this.firstMapping.has(e)||this.firstMapping.set(e,r),r}addVertexMapping(e,t,n,r){if(!e)return;let i=this.pushMapping(e,`vertex`,this.position(r));n??this.bareMappings.add(i)}extendVertexMapping(e,t){if(!e||!t)return;let n=this.position(t);for(let t=this.mappings.length-1;t>=0;t--){let r=this.mappings[t];if(r.type!==`vertex`||r.id!==e)continue;this.bareMappings.delete(r)&&(r.type=`attachment`);let i=r.position;(n.endLine>i.endLine||n.endLine===i.endLine&&n.endColumn>i.endColumn)&&(i.endLine=n.endLine,i.endColumn=n.endColumn);return}this.pushMapping(e,`attachment`,n)}addEdgeMapping(e,t,n,r){let i=Array.isArray(t)?t.filter(e=>typeof e==`string`&&e!==``):[];this.pushMapping(i.length>0?i.join(`>`):`edge`,`edge`,this.position(r))}blockMapping(e,t,n,r){if(!e)return;let i=this.position(n),a=r?this.position(r):i;this.pushMapping(e,t,{startLine:i.startLine,startColumn:i.startColumn,endLine:a.endLine,endColumn:a.endColumn,startIndex:0,endIndex:0})}addSubgraphMapping(e,t,n,r){let i=typeof e==`string`?e:e?.text;this.blockMapping(i??``,`subgraph`,n,r)}addConnectorMapping(e,t,n,r){this.blockMapping(e?.text?.trim()??``,`connector`,n,r)}emit(e,t,n,r){let i=r?.nodeId??r?.edgeId,a={id:e,severity:t,message:n};r?.nodeId?a.nodeId=r.nodeId:r?.edgeId&&(a.edgeId=r.edgeId);let o=i?this.firstMapping.get(i):void 0;o&&(a.position=o.position);let s=i??``,c=this.reported.get(s);if(c===void 0)this.reported.set(s,[a]);else{for(let r of c)if(r.id===e&&r.severity===t&&r.message===n&&r.nodeId===a.nodeId&&r.edgeId===a.edgeId)return;c.push(a)}this.diagnostics.push(a),this.options.log?.(t,`agentflow[${e}]: ${n}`)}emitWarning(e,t,n){this.emit(e,`warning`,t,n)}emitError(e,t,n){this.emit(e,`error`,t,n)}},fd=`4q 0 b 0 5 0 6 m 2 u 2 cp 5 b f 4 8 0 2 0 3m 4 2 1 3 3 9 0 2 2 2 0 2 j 2 2a 2 3u 9 4d a 11 3 0 8 12 21 q 6 2 1a 16 10 1 2 2q 2 0 g 1 8 1 b 2 3 0 h 0 2 t u 2g c 0 p w a 1 5 0 6 l 5 0 a 0 4 0 o o 20 0 2 a 2g 1h 4 0 j 0 8 9 g 6 2 6 6 7 3 1 3 l 2 6 2 0 4 3 4 0 h 0 e 1 2 2 f 1 k 5 5 1 3 l 2 6 2 1 2 1 2 1 w 3 2 0 k 2 h 8 2 2 2 l 2 6 2 1 2 4 4 0 j 0 g 1 10 7 3 1 3 l 2 6 2 1 2 4 4 0 v 1 2 2 g 0 i 0 2 5 4 2 2 3 4 1 2 0 2 1 4 1 4 2 4 b n 0 1h 7 2 2 2 m 2 9 2 4 4 0 r 1 7 1 10 7 2 2 2 m 2 9 2 4 4 0 x 0 2 1 g 1 j 7 2 2 2 14 3 0 h 0 i 1 p 5 6 h 4 n 2 8 2 0 3 6 1n 1b 2 1 d 6 1n 1 2 0 3 1 2 0 3 0 7 3 2 6 2 2 2 0 2 0 3 1 2 3 2 1 a 0 3 4 2 0 m 3 x 0 1s 7 2 z s 4 38 16 l 0 h 5 5 3 4 0 4 1 8 2 5 c d 0 i 11 2 0 6 0 3 16 2 98 2 3 3 6 2 0 2 3 3 14 2 3 3 w 2 3 3 6 2 0 2 3 3 e 2 1k 2 3 3 1u 12 f h 2c d h7 3 g 2 p 6 22 m c 2 3 f h f h f c 2 2 g 1f 10 0 5 0 1w 2f 9 14 2 0 6 1x b s 1g t 3 4 c 17 m 6 1l m a 1g 2b 0 2m 1a i 6 1k t e 1 b 17 r z 16 2 b z 30 3 2 3 4 1 a 5b 1t 7p 3 5 3 11 3 5 3 7 2 0 2 0 2 0 2 u 3 1g 2 6 2 0 4 2 2 6 4 3 3 5 5 c 6 2 2 6 39 0 e 0 h c 2u 0 5 0 3 9 2 0 4 4 7 0 2 0 2 0 2 3 2 a 3 3 6 4 5 0 1h 1 22k 1a 2 1a 2 3o 7 3 4 1 d 11 2 0 6 0 3 1j 8 0 h m a 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 29 0 d2 1 17 4 6 1 5 2d 7 2 2 2h 2 3 6 14 4 2l i q 1i f e9 52t 23 g5o 1g wc 1w 19 3 7g 4 f b 1 l 1a h o 9 1x 1e 8 3 2u 3 3 2 3 d a 26 9 2 2 2 3 2 m u 1f f 1d 1r 5 4 0 f r b m q s 8 1a t 0 1d 14 o 2 2 7 l m 4 0 6 1b 2 0 4 1 3 4 3 0 2 0 p 2 3 a 8 2 d 5 3 5 3 5 a 6 2 6 42 y u 8mb d m 5 1c 6it a5 3 2x 13 6 d 4 6 0 2 9 2 c 2 4 2 0 2 1 2 1 2 2z y a2 j 1r 3 1h 15 b 39 4 2 3q 11 p 7 p c 2g 4 5 3 5 3 5 3 2`,pd;function md(){let e=fd.split(` `),t=new Uint16Array(e.length),n=0;for(let r=0;r<e.length;r+=2){let i=n+parseInt(e[r],36);n=i+parseInt(e[r+1],36),t[r]=i,t[r+1]=n}return t}function hd(e){if(e<170||e>65500)return!1;let t=pd??=md(),n=0,r=(t.length>>1)-1;for(;n<=r;){let i=n+r>>1;if(e<t[i*2])r=i-1;else if(e>t[i*2+1])n=i+1;else return!0}return!1}var gd=`$end.INVALID.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.SHAPE_DATA.CALLBACKNAME.CALLBACKARGS.MD_STR.STR.STYLE.DEFAULT.LINKSTYLE.INTERPOLATE.CLASSDEF.CLASS.HREF.CLICK.GRAPH.flow.connector.global.end.LINK_TARGET.NODIR.DIR.direction_tb.direction_bt.direction_rl.direction_lr.direction_td.LINK_ID.NUM.BRKT.STYLE_SEPARATOR.COLON.AMP.SEMI.COMMA.MULT.LINK.START_LINK.EDGE_TEXT.-).TEXT.(-.STADIUMEND.STADIUMSTART.SUBROUTINEEND.SUBROUTINESTART.VERTEX_WITH_PROPS_START.TAGEND.CYLINDEREND.CYLINDERSTART.DOUBLECIRCLEEND.DOUBLECIRCLESTART.TRAPEND.INVTRAPEND.TRAPSTART.INVTRAPSTART.TAGSTART.UP.SEP.DOWN.COMMENT.NODE_STRING.MINUS.UNICODE_TEXT.PIPE.PE.PS.SQE.SQS.DIAMOND_STOP.DIAMOND_START.NEWLINE.SPACE.EOF`.split(`.`),_d=new Uint8Array(128);for(let e of`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!"#$%&'*+.\`?\\_/`)_d[e.charCodeAt(0)]=1;var vd=/accTitle\s*:\s*/y,yd=/accDescr\s*:\s*/y,bd=/accDescr\s*\{\s*/y,xd=/call\s+/y,Sd=/click\s+/y,Cd=/(?:\r?\n)*\s*\n/y,wd=/\s*(?:LR|RL|TB|BT|TD|BR)\b/y,Td=/\s*[<>^]/y,Ed=/\s*v\b/y,Dd=[/.*direction\s+TB[^\n]*/y,/.*direction\s+BT[^\n]*/y,/.*direction\s+RL[^\n]*/y,/.*direction\s+LR[^\n]*/y,/.*direction\s+TD[^\n]*/y],Od=/[\n\r\u2028\u2029]/g,kd=/\(\s*\)/y,Ad=/\n\s*/g;function jd(e){let t=e.length,n=[],r=[],i=[],a=[],o=[],s=0,c=0,l=1,u=0,d=!0,f=e.indexOf(`direction`),p=e.indexOf(`@`),m=-1,h=0,g=0,_=-1,v=-1,y=-1,b=-1,x=-1,S=-1,C=-1,w=t=>{let n=-1;for(let r=c;r<t;r++){let i=e.charCodeAt(r);i===10?(l++,n=r):i===13&&(r+1<t&&e.charCodeAt(r+1)===10&&r++,l++,n=r)}if(n<0)u+=t-c;else{let r=n+1;for(;r<t;){let t=e.charCodeAt(r);if(t===8232||t===8233)break;r++}u=r-n-1}c=t},T=(t,o)=>{n.push(t),r.push(e.slice(c,o)),i.push(c),a.push(l,u),w(o),a.push(l,u)},E=(t,o)=>{n.push(t),r.push(e.slice(c,o)),i.push(c),a.push(l,u),u+=o-c,c=o,a.push(l,u)},D=(t,o)=>{n.push(t),r.push(e.slice(c,o)),i.push(c),a.push(l,u);for(let t=c;t<o;t++){let n=e.charCodeAt(t);n===10||n===13?(l++,u=0):u++}c=o,a.push(l,u)},O=(e,t,o)=>{n.push(e),r.push(t),i.push(c),a.push(l,u),w(o),a.push(l,u)},k=e=>{o.push(s),s=e},A=()=>{o.length>0&&(s=o.pop())},j=(t,n)=>(t.lastIndex=n,t.test(e)?t.lastIndex:-1),M=t=>e.startsWith(t,c)&&!Ls(e.charCodeAt(c+t.length)),N=n=>{if(n>=v&&n<=y)return y;let r=n;for(;r<t&&J(e.charCodeAt(r));)r++;return v=n,y=r,r},P=n=>{if(n>=b&&n<=x)return x;let r=n;for(;r<t;){let t=e.charCodeAt(r);if(t!==32&&t!==9)break;r++}return b=n,x=r,r},F=t=>{let n=N(t);if(n===C||e.charCodeAt(n)!==45||e.charCodeAt(n+1)!==45)return-1;let r=n+2;for(;e.charCodeAt(r)===45;)r++;let i=e.charCodeAt(r);return i===120||i===62?N(r+1):(C=n,-1)},I=()=>{let t=N(c);if(t===S||e.charCodeAt(t)!==45)return!1;let n=e.charCodeAt(t+1),r=t+2;if(n===45){for(;e.charCodeAt(r)===45;)r++;let n=e.charCodeAt(r);return n===120||n===62?T(42,N(r+1)):(k(10),T(43,N(t+2))),!0}if(n===46){for(;e.charCodeAt(r)===46;)r++;if(e.charCodeAt(r)===45)return T(42,N(r+1)),!0}return S=t,!1},L=n=>{if(e.charCodeAt(n)!==37||e.charCodeAt(n+1)!==37||e.charCodeAt(n+2)===123)return-1;let r=e.indexOf(`
|
|
72
|
+
`,n+2);return r===-1?t:r},R=()=>{e.charCodeAt(c+1)===96?(k(2),w(c+2)):(k(1),w(c+1))},z=t=>{let n=e.charCodeAt(c+1);return t===40?(n===45?(k(8),E(47,c+2)):n===91?(k(7),E(49,c+2)):n===40&&e.charCodeAt(c+2)===40?(k(7),E(57,c+3)):(k(7),E(72,c+1)),!0):t===91?(n===91?(k(7),E(51,c+2)):n===40?(k(7),E(55,c+2)):n===47?(k(9),E(60,c+2)):n===92?(k(9),E(61,c+2)):(k(7),E(74,c+1)),!0):t===124?(k(7),E(70,c+1),!0):t===123&&(k(7),E(76,c+1),!0)},B=()=>{let n=c;for(;n<t;){let r=e.charCodeAt(n);if(r<128&&_d[r]===1)n++;else if(r===45&&n+1<t){let t=e.charCodeAt(n+1);if(t===62||t===45||t===46)break;n++}else break}return n!==c&&(E(67,n),!0)},V=n=>{let r=n;for(;r<t;){let t=e.charCodeAt(r);if(t!==32&&t!==9)break;r++}return r},H=n=>{let r;switch(n){case 97:if(e.startsWith(`acc`,c)){if((r=j(vd,c))>=0)return k(3),T(2,r),!0;if((r=j(yd,c))>=0)return k(4),T(4,r),!0;if((r=j(bd,c))>=0)return k(5),w(r),!0}if(M(`agentflow-beta`))return d&&(d=!1,k(6)),E(20,c+14),!0;break;case 64:if(e.charCodeAt(c+1)===123)return k(14),O(7,``,c+2),!0;break;case 99:if((r=j(xd,c))>=0)return k(12),w(r),!0;if(M(`classDef`))return E(16,c+8),!0;if(M(`class`))return E(17,c+5),!0;if((r=j(Sd,c))>=0)return k(11),w(r),!0;if(M(`connector`))return E(22,c+9),!0;break;case 34:return R(),!0;case 115:if(M(`style`))return E(12,c+5),!0;break;case 100:if(M(`default`))return E(13,c+7),!0;break;case 108:if(M(`linkStyle`))return E(14,c+9),!0;break;case 105:if(M(`interpolate`))return E(15,c+11),!0;break;case 104:if(e.startsWith(`href`,c)&&J(e.charCodeAt(c+4)))return T(18,c+5),!0;break;case 102:if(M(`flow`))return E(21,c+4),!0;break;case 103:if(M(`global`))return E(23,V(c+6)),!0;break;case 101:if(M(`end`))return E(24,V(c+3)),!0;break;case 95:if(M(`_self`))return E(25,c+5),!0;if(M(`_blank`))return E(25,c+6),!0;if(M(`_parent`))return E(25,c+7),!0;if(M(`_top`))return E(25,c+4),!0}if(f!==-1&&c>=h&&(f<c&&(f=e.indexOf(`direction`,c)),f!==-1&&(m<c&&(Od.lastIndex=c,m=Od.test(e)?Od.lastIndex-1:t),f<m))){for(let e=0;e<5;e++)if((r=j(Dd[e],c))>=0)return T(28+e,r),!0;h=m}if(p!==-1&&n!==34&&!J(n)){if(c>=g){p<c&&(p=e.indexOf(`@`,c));let n=c;for(;n<t;){let t=e.charCodeAt(n);if(t===34||J(t))break;n++}if(g=n,_=-1,p!==-1&&p<n)for(let r=Math.min(n,t-1)-1;r>=p;r--){if(e.charCodeAt(r)!==64)continue;let t=e.charCodeAt(r+1);if(t!==123&&t!==34){_=r;break}}}if(_>c)return E(33,_+1),!0}if(n>=48&&n<=57){let n=c+1;for(;n<t;){let t=e.charCodeAt(n);if(t<48||t>57)break;n++}return E(34,n),!0}switch(n){case 35:return E(35,c+1),!0;case 58:return e.charCodeAt(c+1)===58&&e.charCodeAt(c+2)===58?E(36,c+3):E(37,c+1),!0;case 38:return E(38,c+1),!0;case 59:return E(39,c+1),!0;case 44:return E(40,c+1),!0;case 42:return E(41,c+1),!0;case 60:return E(62,c+1),!0;case 45:return I()||B()||E(68,c+1),!0;case 40:return z(n);case 91:return e.charCodeAt(c+1)===124?(E(52,c+2),!0):z(n);case 124:case 123:return z(n);case 62:return k(7),E(53,c+1),!0;case 94:return E(63,c+1),!0;case 92:return e.charCodeAt(c+1)===124?(E(64,c+2),!0):B();case 118:return Ls(e.charCodeAt(c+1))?B():(E(65,c+1),!0);case 37:return(r=L(c))>=0?(T(66,r),!0):B()}if(J(n)){if(I())return!0;if((n===32||n===9)&&(r=L(P(c)))>=0)return T(66,r),!0;for(r=c;;){let t=e.charCodeAt(r);if(t===10)r++;else if(t===13&&e.charCodeAt(r+1)===10)r+=2;else break}return r>c?T(77,r):T(78,c+1),!0}return n<128?B():hd(n)?(E(69,c+1),!0):!1};e:for(;;){if(c>=t){let e=-1;switch(s){case 0:e=79;break;case 3:e=3;break;case 4:e=5;break;case 5:e=6;break;case 11:e=19;break;case 12:e=8;break;case 13:e=9}e!==-1&&E(e,t);break}let o=e.charCodeAt(c),d=!0;switch(s){case 0:d=H(o);break;case 1:if(o===34)e.charCodeAt(c+1)===96?(k(2),w(c+2)):(A(),w(c+1));else{let n=e.indexOf(`"`,c);T(11,n===-1?t:n)}break;case 2:if(o===96)e.charCodeAt(c+1)===34?(A(),w(c+2)):d=!1;else if(o===34)R();else{let n=c+1;for(;n<t;){let t=e.charCodeAt(n);if(t===96||t===34)break;n++}T(10,n)}break;case 3:case 4:{let n=e.indexOf(`
|
|
73
|
+
`,c);n===-1&&(n=t);let r=s===3?3:5;A(),T(r,n);break}case 5:if(o===125)A(),w(c+1);else{let n=e.indexOf(`}`,c);n===-1&&(n=t),T(6,n)}break;case 6:{let e;o===34?R():(e=j(Cd,c))>=0?(A(),T(26,e)):(e=j(wd,c))>=0||(e=j(Td,c))>=0||(e=j(Ed,c))>=0?(A(),T(27,e)):d=z(o);break}case 7:{let n=e.charCodeAt(c+1);switch(o){case 34:R();break;case 40:case 91:case 123:z(o);break;case 93:A(),n===41?E(48,c+2):n===93?E(50,c+2):E(73,c+1);break;case 41:A(),n===93?E(54,c+2):n===41&&e.charCodeAt(c+2)===41?E(56,c+3):E(71,c+1);break;case 124:A(),E(70,c+1);break;case 125:A(),E(75,c+1);break;case 37:{let e=L(c);e>=0?w(e):d=!1;break}default:{let n=c+1;for(;n<t;){let t=e.charCodeAt(n);if(t===91||t===93||t===40||t===41||t===123||t===125||t===124||t===34||t===37)break;n++}T(46,n)}}break}case 8:{let n=e.charCodeAt(c+1),r;if(o===34)R();else if(o===37&&(r=L(c))>=0)w(r);else if((o===45||o===47||o===41)&&n===41)A(),E(45,c+2);else if(o===40||o===91||o===123)z(o);else if(o===41||o===93||o===125)d=!1;else{let n=c+1;for(;n<t;){let t=e.charCodeAt(n);if(t===34||t===40||t===41||t===91||t===93||t===123||t===125||(t===45||t===47)&&e.charCodeAt(n+1)===41||t===37&&e.charCodeAt(n+1)===37&&e.charCodeAt(n+2)!==123)break;n++}D(46,n)}break}case 9:{let n=e.charCodeAt(c+1);if(o===34){R();break}switch(o){case 40:n===45||n===91||n===40&&e.charCodeAt(c+2)===40?z(o):n===93?(A(),E(58,c+2)):z(o);break;case 91:case 123:z(o);break;case 92:n===93?(A(),E(58,c+2)):E(46,c+1);break;case 47:n===93?(A(),E(59,c+2)):E(46,c+1);break;case 93:case 41:n===93?(A(),E(58,c+2)):d=!1;break;case 125:d=!1;break;case 37:{let e=L(c);e>=0?w(e):d=!1;break}default:{if((o===63||o===61)&&n===93){A(),E(58,c+2);break}let r=c+1;for(;r<t;){let t=e.charCodeAt(r);if(t===92||t===91||t===93||t===40||t===41||t===123||t===125||t===47||t===37)break;r++}T(46,r)}}break}case 10:{if(o===34){R();break}let n=F(c);if(n>=0){A(),T(42,n);break}if(o===45&&e.charCodeAt(c+1)===45){d=!1;break}let r=c+1;for(;r<t;){let t=e.charCodeAt(r);if(t===34)break;if(t===45){if(e.charCodeAt(r+1)===45)break}else if(J(t)&&F(r)>=0)break;r++}D(44,r);break}case 11:if(o===34)R();else if(J(o))A(),w(c+1);else{let n=c+1;for(;n<t&&!J(e.charCodeAt(n));)n++;E(19,n)}break;case 12:if(o===40){let e=j(kd,c);A(),e>=0?w(e):(k(13),w(c+1))}else{let n=e.indexOf(`(`,c);n===-1&&(n=t),T(8,n)}break;case 13:if(o===41)A(),w(c+1);else{let n=e.indexOf(`)`,c);n===-1&&(n=t),T(9,n)}break;case 14:if(o===34)k(15),E(7,c+1);else if(o===125)A(),w(c+1);else if(o===94)d=!1;else{let n=c+1;for(;n<t;){let t=e.charCodeAt(n);if(t===125||t===94||t===34)break;n++}T(7,n)}break;case 15:if(o===34)A(),E(7,c+1);else{let n=e.indexOf(`"`,c);n===-1&&(n=t),O(7,e.slice(c,n).replace(Ad,`<br/>`),n)}}if(!d)return n.push(1),r.push(``),i.push(c),a.push(l,u,l,u),{types:n,texts:r,starts:i,locs:a};continue e}return n.push(0),r.push(``),i.push(t),a.push(l,u,l,u),{types:n,texts:r,starts:i,locs:a}}var Md=new Uint8Array(80);for(let e of[34,67,65,68,13,40,37,38,35,41,69])Md[e]=1;var Nd=new Uint8Array(80);for(let e of[34,69,67,27,65,68,40,37,38,35,41])Nd[e]=1;var Pd=new Uint8Array(80);for(let e of[34,67,78,68,38,69,37,41,35,12,14,16,17,19,20,27,21,22,23,24,65,63,43])Pd[e]=1;var Fd=new Uint8Array(80);for(let e of[34,67,37,78,35,12])Fd[e]=1;var Id=new Uint8Array(80);for(let e of[77,39,79,66])Id[e]=1;var Ld=`'UNICODE_TEXT', 'TEXT', 'TAGSTART'`,Rd=`'COMMENT', 'SEMI', 'NEWLINE', 'EOF'`,zd=new Uint8Array(80);for(let e of[66,77,78,79])zd[e]=1;var Bd=[],Vd=/}[^\S\n]*\n/g;function Hd(e,t,n=!1){let r=!n&&e.includes(`}`)?e.replace(Vd,`}
|
|
74
|
+
`):e,{types:i,texts:a,starts:o,locs:s}=jd(r),c=0,l,u=0,d=0,f=t=>{let n=i[c],a=o[c];if(n===79||n===0){let e=c;for(;e>0&&zd[i[e-1]];)e--;a=r.slice(0,o[e]).trimEnd().length}let s=r===e?a:Po([Mo(e,Vd,2)],a);throw n===1?zo(`agentflow`,e,s,``,!0):zo(`agentflow`,e,s,`Expecting ${t}, got '${gd[n]}'`)},p=(e,t)=>({first_line:s[4*e],first_column:s[4*e+1],last_line:s[4*t+2],last_column:s[4*t+3]}),m=(e,t=``)=>(i[c]!==e&&f(`'${gd[e]}'${t?`, `+t:``}`),a[c++]),h=()=>{Id[i[c]]===0&&f(Rd),c++},g=()=>{Md[i[c]]===0&&f(`'NODE_STRING'`);let e=a[c++];for(;Md[i[c]]===1;)e+=a[c++];return e},_=()=>{Nd[i[c]]===0&&f(`'NODE_STRING'`);let e=a[c++];for(;Nd[i[c]]===1;)e+=a[c++];return e},v=()=>{let e=i[c],t;if(e===11)t=`string`;else if(e===10)t=`markdown`;else if(e===46||e===62||e===53||e===69)t=`text`;else return f(`${Ld}, 'TAGEND', 'STR', 'MD_STR'`);let n=a[c++];for(;;){let e=i[c];if(e!==46&&e!==62&&e!==53&&e!==69)break;n+=a[c++]}return{text:n,type:t}},y=e=>{m(e,Ld)},b=()=>{let e=i[c],t;if(e===11)t=`string`;else if(e===10)t=`markdown`;else if(e===44||e===69)t=`text`;else return f(`'EDGE_TEXT', 'STR', 'MD_STR'`);let n=a[c++];for(;i[c]===44||i[c]===69;)n+=a[c++];return{text:n,type:t}},x=()=>{let e=i[c],t;if(e===11)t=`text`;else if(e===10)t=`markdown`;else if(Pd[e]===1)t=`text`;else return f(`'NODE_STRING', 'STR', 'MD_STR'`);let n=a[c++];for(;Pd[i[c]]===1;)n+=a[c++];return{text:n,type:t}},S=()=>{u=c;let e=a[c++];for(;i[c]===7;)e+=a[c++];return d=c-1,e},C=(e,n,r,i)=>{let a=p(r,i);t.addVertex(e,void 0,void 0,void 0,void 0,void 0,void 0,n,a),t.extendVertexMapping(e,a)},w=(e,n)=>{n.data!==void 0&&t.addVertex(e,void 0,void 0,void 0,void 0,void 0,void 0,n.data,p(n.dataFrom,n.dataTo))},T=()=>{let e=c,n=g(),r,a,o;switch(i[c]){case 74:c++,r=v(),y(73),a=`square`;break;case 57:c++,r=v(),y(56),a=`doublecircle`;break;case 72:c++,i[c]===72?(c++,r=v(),y(71),m(71),a=`circle`):(r=v(),y(71),a=`round`);break;case 47:c++,r=v(),y(45),a=`ellipse`;break;case 49:c++,r=v(),y(48),a=`stadium`;break;case 51:c++,r=v(),y(50),a=`subroutine`;break;case 52:{c++;let e=m(67);m(37);let t=m(67);m(70),r=v(),y(73),a=`rect`,o={[e]:t};break}case 55:c++,r=v(),y(54),a=`cylinder`;break;case 76:c++,i[c]===76?(c++,r=v(),y(75),m(75),a=`hexagon`):(r=v(),y(75),a=`diamond`);break;case 53:c++,r=v(),y(73),a=`odd`;break;case 60:c++,r=v(),i[c]===59?(c++,a=`lean_right`):(y(58),a=`trapezoid`);break;case 61:c++,r=v(),i[c]===58?(c++,a=`lean_left`):(y(59),a=`inv_trapezoid`)}return o===void 0?a===void 0?t.addVertex(n):t.addVertex(n,r,a):t.addVertex(n,r,a,void 0,void 0,void 0,o),t.addVertexMapping(n,r,a,p(e,c-1)),n},E=()=>{let e=T();return i[c]===36&&(c++,t.setClass(e,g())),e},D=()=>{let e=[E()];for(l=void 0;;){let t=i[c]===7?S():void 0,n=u,r=d;if(i[c]!==78)return l=t,e;do c++;while(i[c]===78);if(i[c]!==38)return t!==void 0&&f(`'AMP'`),e;c++,i[c]!==78&&f(`'SPACE'`);do c++;while(i[c]===78);let a=E();t!==void 0&&C(e[e.length-1],t,n,r),e.push(a)}},O=()=>{let e;if(i[c]===33&&(e=a[c++]),i[c]===42){let n=t.destructLink(a[c++]);return e!==void 0&&(n.id=e),i[c]===70&&(c++,n.text=v(),y(70),i[c]===78&&c++),n}if(i[c]===43){let n=a[c++],r=b(),i=m(42,`'EDGE_TEXT'`),o=t.destructLink(i,n);return o.text=r,e!==void 0&&(o.id=e),o}return f(`'LINK', 'START_LINK'`)},k=()=>{let e=c,n=D();l!==void 0&&C(n[n.length-1],l,u,d);let r=n;for(;;){let a=i[c];if(a!==42&&a!==43&&a!==33)return r;let o=O(),s=D();l!==void 0&&C(s[s.length-1],l,u,d),t.addLink(n,s,o),t.addEdgeMapping(n,s,o,p(e,c-1)),r=s.concat(r),n=s}},A=()=>{Fd[i[c]]===0&&f(`'NODE_STRING', 'NUM', 'COLON', 'BRKT'`);let e=a[c++];for(;Fd[i[c]]===1;)e+=a[c++];return e},j=()=>{let e=[A()];for(;i[c]===40;)c++,e.push(A());return e},M=()=>{c++,m(78);let e;if(i[c]===13)e=[a[c++]];else for(e=[m(34,`'DEFAULT'`)];i[c]===40;)c++,e.push(m(34));if(m(78),i[c]!==15){t.updateLink(e,j());return}c++,m(78);let n=_();if(i[c]===78){c++;let r=j();t.updateLinkInterpolate(e,n),t.updateLink(e,r)}else t.updateLinkInterpolate(e,n)},N=(e,n)=>{if(i[c]!==78){t.setLink(e,n);return}if(c++,i[c]===25){t.setLink(e,n,a[c++]);return}let r=m(11,`'LINK_TARGET'`);i[c]===78?(c++,t.setLink(e,n,m(25))):t.setLink(e,n),t.setTooltip(e,r)},P=()=>{let e=a[c++];switch(i[c]){case 8:{let n=a[c++],r=i[c]===9,o=r?a[c++]:void 0,s;i[c]===78&&(c++,s=m(11)),r?t.setClickEvent(e,n,o):t.setClickEvent(e,n),s!==void 0&&t.setTooltip(e,s);return}case 18:c++,N(e,m(11));return;case 11:N(e,a[c++]);return;default:{let n=_();if(i[c]===78){c++;let r=m(11);t.setClickEvent(e,n),t.setTooltip(e,r)}else t.setClickEvent(e,n)}}},F=e=>{m(78,Rd);let t=x(),n={text:``,type:`text`};i[c]===74&&(c++,n=v(),y(73));let r=i[c]===7?S():void 0;return Id[i[c]]===0&&f(`${Rd}, 'SHAPE_DATA'`),{global:!1,at:e,id:t,title:n,data:r,dataFrom:u,dataTo:d,list:[],collect:!1}},I=()=>{let e=i[c];switch(e){case 12:{c++,m(78);let e=g();return m(78),t.addVertex(e,void 0,void 0,j()),h(),Bd}case 14:return M(),h(),Bd;case 16:{c++,m(78);let e=g();return m(78),t.addClass(e,j()),h(),Bd}case 17:{c++,m(78);let e=g();return m(78),t.setClass(e,g()),h(),Bd}case 19:return P(),h(),Bd;case 22:{let e=F(c++),n=c++,r=t.addConnector(e.id,e.title);return w(r,e),t.addConnectorMapping(e.id,e.title,p(e.at,e.at),p(n,n)),r}case 28:case 29:case 30:case 31:case 32:return c++,{stmt:`dir`,value:Ud[e-28]};case 2:{c++;let e=m(3).trim();return t.setAccTitle(e),e}case 4:{c++;let e=m(5).trim();return t.setAccDescription(e),e}case 6:{let e=a[c++].trim();return t.setAccDescription(e),e}default:{Md[e]===0&&f(Wd);let t=k();return h(),t}}},L=()=>{let e=[],n=[],r=!1;for(;;){let o=i[c];if(o===0)break;if(o===24){let i=e.pop();if(i===void 0)break;let a=c++;if(i.global){t.addGlobal(n),n=i.list,r=i.collect;continue}let o=t.addSubGraph(i.id,n,i.title,`flow`);w(o,i),t.addSubgraphMapping(i.id,i.title,p(i.at,i.at),p(a,a)),n=i.list,r=i.collect,r&&n.push(o)}else if(o===39||o===77||o===78||o===79)r&&n.push(a[c]),c++;else if(o===66)c++;else if(o===21||o===23){let t=c++,a;o===23||Id[i[c]]===1?(a={global:o===23,at:t,id:void 0,title:void 0,data:void 0,dataFrom:0,dataTo:0,list:n,collect:r},h()):(a=F(t),a.list=n,a.collect=r,c++),e.push(a),n=[],r=!0}else{let e=I();r&&(!Array.isArray(e)||e.length>0)&&n.push(e)}}e.length>0&&f(`'end'`)};for(;i[c]===78||i[c]===77||i[c]===66;)c++;if(m(20,`'SPACE', 'NEWLINE', 'COMMENT'`),i[c]===26)c++,t.setDirection(`TB`);else{let e=m(27,`'NODIR'`),n=i[c];if(n===78){do c++;while(i[c]===78);n=i[c],n!==77&&f(`'NEWLINE', 'SPACE'`)}else n!==39&&n!==77&&n!==66&&f(`'COMMENT', 'SEMI', 'NEWLINE', 'SPACE'`);c++,t.setDirection(e)}L(),i[c]!==0&&f(Wd)}var Ud=[`TB`,`BT`,`RL`,`LR`,`TD`],Wd=`'COMMENT', 'SEMI', 'NEWLINE', 'SPACE', 'EOF', 'flow', 'global', 'connector', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'STYLE', 'LINKSTYLE', 'CLASSDEF', 'CLASS', 'CLICK', 'NODE_STRING'`;function Gd(e,t,n=0){return{w:e,h:t,kind:n,pin:0,hint:NaN,key:NaN,span:0,x:0,y:0,rank:0}}function Kd(e,t,n=1,r=0,i=0){return{tail:e,head:t,minlen:n,labelW:r,labelH:i,tailDx:0,headDx:0,tailFixed:!1,headFixed:!1,reversed:!1,points:[],labelX:0,labelY:0}}var qd=24,Jd=2e4,Yd=16,Xd=8,Zd=.125,Qd=3,$d=18,ef=10,tf=14,nf=2,rf=28,af=12,of=12,sf=8,cf=4,lf=.5,uf=.5,df=1,ff=12,pf=24,mf=40,hf=400,gf=16,_f=new Float64Array(2*gf+2),vf=new Float64Array(2*gf+2);function yf(e){return e===1||e===2}function bf(e,t,n,r){for(let i=t+1;i<n;i++){let n=e[i],a=r[n],o=i-1;for(;o>=t&&(r[e[o]]>a||r[e[o]]===a&&e[o]>n);)e[o+1]=e[o],o--;e[o+1]=n}}function xf(e,t,n,r,i,a){let o=(e,t)=>n[e]<n[t]||n[e]===n[t]&&(i?r[e]>r[t]:r[e]<r[t]);for(let n=0;n<t;n+=8)for(let r=n+1,i=Math.min(t,n+8);r<i;r++){let t=e[r],i=r-1;for(;i>=n&&o(t,e[i]);)e[i+1]=e[i],i--;e[i+1]=t}let s=e,c=a;for(let e=8;e<t;e*=2){for(let n=0;n<t;n+=2*e){let r=Math.min(t,n+e),i=Math.min(t,n+2*e),a=n,l=r,u=n;for(;a<r&&l<i;)c[u++]=o(s[l],s[a])?s[l++]:s[a++];for(;a<r;)c[u++]=s[a++];for(;l<i;)c[u++]=s[l++]}let n=s;s=c,c=n}if(s!==e)for(let n=0;n<t;n++)e[n]=s[n]}function Sf(e,t,n){let r=e.length;if(r===0)return{width:0,height:0};let i=t.length;if(r===1&&i===0&&e[0].kind===0){let t=e[0];return t.rank=0,t.x=t.w/2,t.y=t.h/2,{width:t.w,height:t.h}}let a=1;if(i>0){let e=new Set;for(let n of t){let t=Math.min(n.tail,n.head),i=Math.max(n.tail,n.head),o=t*r+i;if(n.labelW>0||e.has(o)){a=2;break}e.add(o)}}Cf(e,t),wf(e,t,a);let o=new Int32Array(i),s=0;for(let n=0;n<i;n++){let r=t[n];o[n]=Math.abs(e[r.head].rank-e[r.tail].rank),o[n]>1&&(s+=o[n]-1)}let c=new Uint8Array(i);if(s>Jd){let e=[];for(let t=0;t<i;t++)o[t]>1&&e.push(t);e.sort((e,t)=>o[t]-o[e]||e-t);for(let t of e){if(s<=Jd)break;c[t]=1,s-=o[t]-1}}let l=r+s,u=new Float64Array(l),d=new Float64Array(l),f=new Uint8Array(l),p=new Int32Array(l),m=0;for(let t=0;t<r;t++){let n=e[t];u[t]=n.w,d[t]=n.h,f[t]=n.kind,p[t]=n.rank,n.rank>m&&(m=n.rank)}let h=0;for(let e=0;e<i;e++)c[e]||(h+=o[e]);let g=new Int32Array(h),_=new Int32Array(h),v=new Float64Array(h),y=new Float64Array(h),b=new Int32Array(i).fill(-1),x=new Uint8Array(m+1),S=new Int32Array(i).fill(-1),C=!1;for(let t=0;t<r;t++)e[t].span>0&&e[t].kind===0&&(C=!0);let w=C?new Uint8Array(h):void 0,T=C?new Uint8Array(h):void 0,E=new Int32Array(i).fill(-1),D=new Int32Array(i).fill(-1),O=new Float64Array(l).fill(NaN);for(let t=0;t<r;t++)O[t]=e[t].key;let k=!1;{let e=r,n=0;for(let r=0;r<i;r++){if(c[r])continue;let i=t[r],o=i.reversed?i.head:i.tail,s=i.reversed?i.tail:i.head,l=i.reversed?i.headDx:i.tailDx,m=i.reversed?i.tailDx:i.headDx;(l!==0||m!==0)&&(k=!0);let h=p[o],C=p[s],A=-1;i.labelW>0&&(A=h+(C-h>>1),a===2&&C-h>=4?(A&1)==1&&(A+=i.reversed?1:-1):a===2&&!(A&1)&&(A+=i.reversed?1:-1));let j=o;C-h>1&&(b[r]=e),E[r]=n,w&&!(i.reversed?i.headFixed:i.tailFixed)&&(w[n]=i.reversed?2:1);for(let t=h+1;t<C;t++){let a=e++;p[a]=t,O[a]=O[o]+(O[s]-O[o])*(t-h)/(C-h),t===A?(u[a]=i.labelW,d[a]=i.labelH,f[a]=2,S[r]=a,x[t]|=i.reversed?2:1):f[a]=1,g[n]=j,_[n]=a,v[n]=j===o?l:0,n++,j=a}g[n]=j,_[n]=s,v[n]=j===o?l:0,y[n]=m,T&&!(i.reversed?i.tailFixed:i.headFixed)&&(T[n]=i.reversed?1:2),D[r]=n,n++}}let A;if(n.groups){let{of:e,parent:a}=n.groups;A=new Int32Array(l);for(let t=0;t<r;t++)A[t]=e[t];let s=e=>{let t=0;for(;e>=0;e=a[e])t++;return t},c=(e,t)=>{let n=s(e),r=s(t);for(;n>r;n--)e=a[e];for(;r>n;r--)t=a[t];for(;e!==t;)e=a[e],t=a[t];return e};for(let n=0;n<i;n++){if(b[n]<0)continue;let r=t[n],i=c(e[r.tail],e[r.head]);for(let e=b[n],t=e+o[n]-1;e<t;e++)A[e]=i}}let j=new Int32Array(l+1),M=new Int32Array(l+1);for(let e=0;e<h;e++)j[g[e]+1]++,M[_[e]+1]++;for(let e=0;e<l;e++)j[e+1]+=j[e],M[e+1]+=M[e];let N=new Int32Array(h),P=new Int32Array(h);{let e=j.slice(0,l),t=M.slice(0,l);for(let n=0;n<h;n++)N[e[g[n]]++]=n,P[t[_[n]]++]=n}let F=new Int32Array(m+2);for(let e=0;e<l;e++)F[p[e]+1]++;for(let e=0;e<=m;e++)F[e+1]+=F[e];let I=new Int32Array(l),L=new Int32Array(l);{let e=new Int32Array(l),t=F.slice(0,m+1);for(let n=0;n<l;n++)e[t[p[n]]++]=n;for(let e=0;e<=m;e++)t[e]=F[e];let n=new Uint8Array(l),r=[];for(let i=0;i<l;i++)if(!n[e[i]])for(r.push(e[i]);r.length>0;){let e=r.pop();if(!n[e]){n[e]=1,I[t[p[e]]++]=e;for(let t=j[e+1]-1;t>=j[e];t--){let e=_[N[t]];n[e]||r.push(e)}}}}let R=(e,t)=>{let n=F[e],r=F[e+1];if(r-n<2)return!1;for(let e=n;e<r;e++)if(Number.isNaN(t(I[e])))return!1;let i=Array.from(I.subarray(n,r)),a=new Map;return i.forEach((e,t)=>a.set(e,t)),i.sort((e,n)=>t(e)-t(n)||a.get(e)-a.get(n)),I.set(i,n),!0};for(let e=0;e<=m;e++)R(e,e=>O[e]);let z=!1;for(let t=0;t<r;t++)e[t].pin!==0&&(z=!0);if(z)for(let t=0;t<=m;t++){let n=Array.from(I.subarray(F[t],F[t+1])),i=new Map;n.forEach((e,t)=>i.set(e,t));let a=t=>t<r?e[t].pin:0;n.sort((e,t)=>a(e)-a(t)||i.get(e)-i.get(t)),I.set(n,F[t])}let B=new Uint8Array(m+1),V=t=>t<r&&(e[t].kind===3||e[t].kind===4)?e[t].hint:NaN;for(let e of[0,m])R(e,V)&&(B[e]=1);let H=()=>{for(let e=0;e<=m;e++){let t=F[e];for(let n=t,r=F[e+1];n<r;n++)L[I[n]]=n-t}};H();let U={n:l,real:r,maxRank:m,W:u,KIND:f,RANK:p,EF:g,ET:_,EFD:v,ETD:y,succStart:j,succE:N,predStart:M,predE:P,layerStart:F,order:I,pos:L,offsets:k,fixed:B,GRP:A,groupParent:n.groups?.parent},ee=0,te=0;if(h>0&&m>0&&([ee,te]=Rf(U,e),H()),n.orderOnly){let a=Bf(U,n);for(let t=0;t<r;t++)e[t].x=a[t];for(let e=0;e<i;e++){let n=t[e],r=n.reversed?n.head:n.tail,i=n.reversed?n.tail:n.head,s=[p[r],a[r]];if(!c[e]&&b[e]>=0)for(let t=b[e],n=t+o[e]-1;t<n;t++)s.push(p[t],a[t]);s.push(p[i],a[i]),n.points=s}return{width:0,height:0,crossings:ee,declared:te}}w&&T&&Ef(U,e,w,T);let W=Bf(U,n),ne=Pf(U);if(w&&T){let r=kf(U,w,T);jf(U,e,W,r,n,ne),Mf(U,e,W,w,T,r,ne),Nf(U,W,ne,n);for(let e=0;e<i;e++){if(c[e])continue;let n=t[e],r=v[E[e]],i=y[D[e]];n.tailDx=n.reversed?i:r,n.headDx=n.reversed?r:i}}Of(U,W,ne);let G=new Uint8Array(l);ne&&!n.tracks&&If(U,W,ne,b,o,n.apart?0:n.edgeSep,G),n.tracks||Lf(U,W,b,o,n.edgeSep,G);let re=new Int32Array(i+1),K=n.tracks||w&&!n.straight?{from:[],to:[],rank:[],lower:[],track:[],levels:[],wide:[]}:void 0,ie=new Int32Array(m+1);if(K){for(let e=0;e<i;e++){if(re[e]=K.from.length,c[e])continue;let t=b[e],r=!1;for(let i=t,a=t<0?t:t+o[e]-1;i<a;i++){let e=ne!==void 0&&ne[p[i]]===1;!n.tracks&&e!==(G[i]===1)&&(r=!0)}if(r)continue;let i=W[g[E[e]]]+v[E[e]],a=p[g[E[e]]];for(let n=t,r=t<0?t:t+o[e]-1;n<r;n++)ne&&ne[p[n]]||(K.from.push(i),K.to.push(W[n]),K.rank.push(a),K.lower.push(n),i=W[n],a=p[n]);K.from.push(i),K.to.push(W[_[D[e]]]+y[D[e]]),K.rank.push(a),K.lower.push(-1)}re[i]=K.from.length}let q=(e,t)=>{let n=!1;for(let r=F[e];r<F[e+1];r++){let e=f[I[r]];if(e===t)n=!0;else if(e!==1)return!1}return n},ae=q(0,3)?a:0,oe=q(m,4)?a:0,se=new Float64Array(m+1);for(let e=0;e<h;e++){let t=Math.abs(W[g[e]]+v[e]-W[_[e]]-y[e]);t>se[p[g[e]]]&&(se[p[g[e]]]=t)}let ce=new Float64Array(m+1),le=new Float64Array(m+1),ue=e=>(e<ae||e>=m-oe?n.portSep:n.rankSep)/a,de=new Float64Array(m+1);for(let e=0;e<m;e++)de[e]=K?ue(e):Math.max(ue(e),Math.min(Qd*n.rankSep/a,se[e]*Zd));let fe=new Uint8Array(m+1).fill(1);for(let e=0;e<r;e++)fe[p[e]]=0;for(let e=1;e<m;e++){if(n.tracks||!fe[e]||x[e]!==1&&x[e]!==2)continue;let t=Math.min((n.headRoom??0)/2,de[x[e]===1?e-1:e]/2);de[e-1]+=x[e]===1?-t:t,de[e]+=x[e]===1?t:-t}let pe=e=>f[e]===1&&fe[p[e]]&&!n.tracks?(le[p[e]]-ce[p[e]])/4:0,me=n.tracks?$d:rf,he=n.tracks?ef:af,ge=n.tracks?tf:af,_e=new Int32Array(m+1);if(K){let e=new Float64Array(m+1);for(let t=0;t<m;t++){if(ne&&ne[t])continue;let n=t+1;for(e[t]=de[t];n<m&&ne&&ne[n];)e[t]+=de[n++];_e[t]=n}for(let t=0;t<K.from.length;t++)K.wide.push(+(Math.abs(K.from[t]-K.to[t])>nf*e[K.rank[t]]));let t=new Float64Array(m+1);Ff(K,ie,!n.tracks,e,t);for(let r=0;r<m;r++)ie[r]>0?de[r]+=Math.max(0,2*me+(ie[r]-1)*he-e[r]):t[r]>0&&(de[r]+=Math.max(0,Math.min(Qd*n.rankSep,t[r])-e[r]))}let ve=0;for(let e=0;e<=m;e++){let t=0;for(let n=F[e];n<F[e+1];n++)d[I[n]]>t&&(t=d[I[n]]);ce[e]=ve,le[e]=ve+t,ve+=t+de[e]}let ye=ve,be=(e,t=K.track[e])=>{let r=K.rank[e],i=le[r],a=ce[_e[r]],o=n.tracks?ie[r]:K.levels[e],s=o>1?Math.min(ge,(a-i-2*me)/(o-1)):0;return(i+a)/2+(t-(o-1)/2)*s},xe=1/0,Se=-1/0;for(let e=0;e<l;e++){let t=u[e]/2;W[e]-t<xe&&(xe=W[e]-t),W[e]+t>Se&&(Se=W[e]+t)}let Ce=new Uint8Array(m+1),we=new Uint8Array(m+1);for(let e=0;e<r;e++)f[e]!==0||!w||(M[e+1]>M[e]&&(Ce[p[e]]=1),j[e+1]>j[e]&&(we[p[e]]=1));for(let t=0;t<r;t++){let n=e[t],r=n.rank;n.x=W[t]-xe,n.y=f[t]===0&&we[r]&&!Ce[r]?le[r]-n.h/2:f[t]===0&&Ce[r]&&!we[r]?ce[r]+n.h/2:(ce[r]+le[r])/2}for(let r=0;r<i;r++){let i=t[r],a=e[i.reversed?i.head:i.tail],s=e[i.reversed?i.tail:i.head],c=[a.x+(i.reversed?i.headDx:i.tailDx),a.y+a.h/2],l=b[r];if(K&&re[r+1]>re[r])for(let e=re[r];e<re[r+1];e++){if(K.track[e]>=0&&(n.tracks||K.wide[e]===1)){let t=be(e);c.push(K.from[e]-xe,t,K.to[e]-xe,t)}else K.track[e]>0&&c.push(K.from[e]-xe,be(e,K.track[e]-1));let t=K.lower[e];t<0||(c.push(W[t]-xe,ce[p[t]]+pe(t)),le[p[t]]>ce[p[t]]&&c.push(W[t]-xe,le[p[t]]-pe(t)))}else if(l>=0)for(let e=l,t=l+o[r]-1;e<t;e++){if(G[e])continue;let t=W[e]-xe,n=ce[p[e]],r=le[p[e]];c.push(t,n+pe(e)),r>n&&c.push(t,r-pe(e))}if(c.push(s.x+(i.reversed?i.tailDx:i.headDx),s.y-s.h/2),i.reversed)for(let e=0,t=c.length-2;e<t;e+=2,t-=2){let n=c[e],r=c[e+1];c[e]=c[t],c[e+1]=c[t+1],c[t]=n,c[t+1]=r}i.points=c;let u=S[r];u>=0?(i.labelX=W[u]-xe,i.labelY=(ce[p[u]]+le[p[u]])/2):i.labelW>0&&(i.labelX=(c[0]+c[c.length-2])/2,i.labelY=(c[1]+c[c.length-1])/2)}return{width:Se-xe,height:ye}}function Cf(e,t){let n=e.length,r=t.length,i=new Int32Array(n+1);for(let n=0;n<r;n++){let r=t[n];r.reversed=e[r.head].kind===3||e[r.tail].kind===4,r.reversed||i[r.tail+1]++}for(let e=0;e<n;e++)i[e+1]+=i[e];let a=new Int32Array(i[n]);{let e=i.slice(0,n);for(let n=0;n<r;n++)t[n].reversed||(a[e[t[n].tail]++]=n)}let o=new Uint8Array(n),s=i.slice(0,n),c=[];for(let e=0;e<n;e++)if(o[e]===0)for(c.push(e),o[e]=1;c.length>0;){let e=c[c.length-1];if(s[e]<i[e+1]){let n=t[a[s[e]++]],r=n.head;o[r]===1?n.reversed=!0:o[r]===0&&(o[r]=1,c.push(r))}else o[e]=2,c.pop()}}function wf(e,t,n){let r=e.length,i=t.length,a=new Int32Array(i),o=new Int32Array(i),s=new Int32Array(i),c=new Int32Array(r+1),l=new Int32Array(r+1);for(let e=0;e<i;e++){let r=t[e],i=r.reversed?r.head:r.tail,u=r.reversed?r.tail:r.head;a[e]=i,o[e]=u,s[e]=Math.max(1,r.minlen)*n,c[i+1]++,l[u+1]++}for(let e=0;e<r;e++)c[e+1]+=c[e],l[e+1]+=l[e];let u=new Int32Array(i),d=new Int32Array(i);{let e=c.slice(0,r),t=l.slice(0,r);for(let n=0;n<i;n++)u[e[a[n]]++]=n,d[t[o[n]]++]=n}let f=new Int32Array(r);for(let t=0;t<r;t++)e[t].kind===3&&(f[t]=-n);let p=new Int32Array(r);for(let e=0;e<r;e++)p[e]=l[e+1]-l[e];let m=new Int32Array(r),h=0;for(let e=0;e<r;e++)p[e]===0&&(m[h++]=e);for(let e=0;e<h;e++){let t=m[e];for(let e=c[t];e<c[t+1];e++){let n=u[e],r=o[n];f[t]+s[n]>f[r]&&(f[r]=f[t]+s[n]),--p[r]===0&&(m[h++]=r)}}for(let e=0;e<8;e++){let e=!1;for(let t=h-1;t>=0;t--){let n=m[t],r=l[n+1]-l[n],i=c[n+1]-c[n];if(r===0&&i===0)continue;let p=-1/0,h=1/0;for(let e=l[n];e<l[n+1];e++){let t=d[e];p=Math.max(p,f[a[t]]+s[t])}for(let e=c[n];e<c[n+1];e++){let t=u[e];h=Math.min(h,f[o[t]]-s[t])}let g=f[n];i>r&&h!==1/0?g=h:r>i&&p!==-1/0&&(g=p),g!==f[n]&&(f[n]=g,e=!0)}if(!e)break}let g=1/0,_=-1/0,v=!1;for(let t=0;t<r;t++){let n=e[t].kind;n===3&&(v=!0),n!==3&&n!==4&&(f[t]<g&&(g=f[t]),f[t]>_&&(_=f[t]))}g===1/0&&(g=0,_=0);for(let t=0;t<r;t++)e[t].kind===3?f[t]=g-n:e[t].kind===4&&(f[t]=_+n);v&&(g-=n);for(let t=0;t<r;t++)e[t].rank=f[t]-g}function Tf(e,t,n,r,i,a,o){let s=n===0?e.predStart:e.succStart,c=n===0?e.predE:e.succE,l=n===0?e.EF:e.ET,u=e.pos;for(let e=s[t];e<s[t+1];e++)i[c[e]]!==0&&a.push(c[e]);if(a.length<2)return 0;a.sort((e,t)=>u[l[e]]-u[l[t]]||e-t);let d=e=>{let t=0;o[0]=0;for(let n=1;n<a.length;n++){let r=i[a[n]]===i[a[n-1]];o[n]=e(r&&i[a[n]]===1,r),t+=o[n]}return t},f=d(()=>1);if(r/f<Xd&&(f=d(e=>e?.5:1)),r/f<Xd&&(f=d((e,t)=>+!t)),f===0)return 0;let p=Math.min(Yd,r/f);for(let e=1;e<a.length;e++)o[e]*=p;return f*p}function Ef(e,t,n,r){let{real:i,W:a,EFD:o,ETD:s}=e;for(let c=0;c<i;c++){let i=Math.min(t[c].span,a[c]);if(!(i<=0||t[c].kind!==0))for(let t=0;t<2;t++){let a=[],l=[],u=Tf(e,c,t,i,t===0?r:n,a,l);if(u===0)continue;let d=t===0?s:o,f=-u/2;for(let e=0;e<a.length;e++)f+=l[e],d[a[e]]=f}}}function Df(e,t,n,r){if(!t)return n;let{KIND:i,RANK:a,EF:o,ET:s,succStart:c,succE:l,predStart:u,predE:d}=e;for(let e=0;e<1e5;e++){let e=r===0?o[n]:s[n];if(i[e]!==1||!t[a[e]])break;n=r===0?d[u[e]]:l[c[e]]}return n}function Of(e,t,n){let{maxRank:r,KIND:i,EF:a,ET:o,EFD:s,ETD:c,succStart:l,succE:u,predStart:d,predE:f,layerStart:p,order:m}=e;for(let[h,g]of[[0,3],[r,4]]){let r=p[h],_=p[h+1],v=[];for(let p=r;p<_;p++){let r=m[p],h=g===3;if(i[r]!==g||(h?l[r+1]-l[r]:d[r+1]-d[r])!==1)break;let _=Df(e,n,h?u[l[r]]:f[d[r]],+!!h),y=h?t[o[_]]+c[_]:t[a[_]]+s[_];if(v.length>0&&y<v[v.length-1]+df)break;v.push(y)}if(v.length!==0&&v.length===_-r)for(let e=r;e<_;e++)t[m[e]]=v[e-r]}}function kf(e,t,n){let r=[new Int32Array(e.n),new Int32Array(e.n)];for(let i=0;i<e.EF.length;i++)n[i]!==0&&r[0][e.ET[i]]++,t[i]!==0&&r[1][e.EF[i]]++;return r}function Af(e,t){return Math.max(.25,Math.min(.5,4*Math.abs(t)/(Math.abs(e)||1)))}function jf(e,t,n,r,i,a){let o=i.edgeSep,{n:s,real:c,maxRank:l,KIND:u,RANK:d,W:f,EF:p,ET:m,EFD:h,ETD:g,succStart:_,succE:v,predStart:y,predE:b,layerStart:x,order:S,pos:C}=e,w=e=>u[e]===2||u[e]===1&&(a===void 0||a[d[e]]!==1),T=(e,i)=>{let a=i===0?p[e]:m[e];return[i===0?n[a]+h[e]:n[a]+g[e],a<c&&t[a].kind===0?r[1-i][a]:0]},E=e=>{let t=x[d[e]],r=t+C[e],a=t=>f[t]/2+f[e]/2+(u[t]===0?i.nodeSep/2+o/2:u[t]===u[e]?o:o/2);return[r>t?n[S[r-1]]+a(S[r-1]):-1/0,r+1<x[d[e]+1]?n[S[r+1]]-a(S[r+1]):1/0]},D=(e,t,n,r,i)=>{let a=(t[1]===n[1]?Math.abs(t[0]-e)<=Math.abs(n[0]-e):t[1]<n[1])?[t[0],n[0]]:[n[0],t[0]];return a.find(e=>e>=r&&e<=i)??Math.max(r,Math.min(i,a[0]))},O=new Uint8Array(s),k=[];for(let t=1;t<l;t++)for(let r=x[t];r<x[t+1];r++){if(!w(S[r])||O[S[r]])continue;let t=S[r];for(;yf(u[p[b[y[t]]]]);)t=p[b[y[t]]];let i=t,o=-1/0,s=1/0;k.length=0;for(let e=t;yf(u[e]);e=m[v[_[e]]]){if(i=e,!w(e))continue;O[e]=1,k.push(e);let[t,n]=E(e);t>o&&(o=t),n<s&&(s=n)}if(o<=s){let e=D(n[k[0]],T(b[y[t]],0),T(v[_[i]],1),o,s);for(let t of k)n[t]=e}else for(let t of k){let[r,i]=E(t);r>i||(n[t]=D(n[t],T(Df(e,a,b[y[t]],0),0),T(Df(e,a,v[_[t]],1),1),r,i))}}}function Mf(e,t,n,r,i,a,o){let{real:s,W:c,EF:l,ET:u,EFD:d,ETD:f,succStart:p,succE:m,predStart:h,predE:g,pos:_}=e,v=(p,m,h,g,_)=>{if(a[m][h]<2)return 0;p=Df(e,o,p,m);let v=m===0?l[p]:u[p],y=m===0?n[v]+d[p]:n[v]+f[p];if(_&&Math.abs(y-n[h])<=g/2+uf)return Math.max(-g/2,Math.min(g/2,y-n[h]));let b=y,x=0;v<s&&t[v].kind===0&&(m===0?r:i)[p]!==0&&a[1-m][v]>=2&&(x=Math.max(0,Math.min(t[v].span,c[v])),x>0&&(b=n[v]));let S=Math.max(n[h]-g/2,b-x/2),C=Math.min(n[h]+g/2,b+x/2);if(S>C+uf){let e=Math.max(0,g/2-mf);return Math.max(-e,Math.min(e,y-n[h]))}let w=(n[h]*x+b*g)/(x+g);return Math.max(S,Math.min(C,w))-n[h]},y=[];for(let n=0;n<s;n++){let a=Math.min(t[n].span,c[n]);if(!(a<=0||t[n].kind!==0))for(let t=0;t<2;t++){let o=t===0?l:u,s=t===0?h:p,c=t===0?g:m,d=[],f=[];if(Tf(e,n,t,a,t===0?i:r,d,f),d.length===0)continue;d.length===1&&(f[0]=0);let v=[];for(let e=s[n];e<s[n+1];e++)v.push(c[e]);v.sort((e,t)=>_[o[e]]-_[o[t]]||e-t),y.push({v:n,side:t,span:a,ids:d,room:f,all:v})}}for(let e=0,t=!0;t&&e<6;e++){t=!1;for(let{v:n,side:a,span:o,ids:s,room:c,all:l}of y){let u=a===0?i:r,p=a===0?f:d,m=0,h=-o/2;for(let r=0;r<=l.length;r++){let i=r<l.length&&u[l[r]]===0;if(r<l.length&&!i)continue;let d=0;for(let e=r-1;e>=0&&u[l[e]]!==0;e--)d++;let f=i?p[l[r]]-Yd:o/2;if(d>0){let r=[],i=[],l=0;for(let t=0;t<d;t++){t>0&&(l+=c[m+t]),r.push(v(s[m+t],a,n,o,e>0)-l),i.push(1);let u=t>0&&c[m+t]===0;for(;r.length>1&&(u||r[r.length-2]/i[i.length-2]>r[r.length-1]/i[i.length-1]);){u=!1;let e=r.pop(),t=i.pop();r[r.length-1]+=e,i[i.length-1]+=t}}let u=l,g=0;l=0;for(let e=0;e<r.length;e++){let n=f-u<h?(h+f-u)/2:Math.max(h,Math.min(f-u,r[e]/i[e]));for(let r=0;r<i[e];r++,g++)g>0&&(l+=c[m+g]),Math.abs(p[s[m+g]]-n-l)>.01&&(t=!0),p[s[m+g]]=n+l}m+=d}i&&(h=p[l[r]]+Yd)}}}}function Nf(e,t,n,r){let{n:i,KIND:a,RANK:o,EF:s,ET:c,EFD:l,ETD:u,layerStart:d,order:f,pos:p}=e,m=e=>n!==void 0&&a[e]===1&&n[o[e]]===1,h=[],g=[],_=[],v=[];for(let t=0;t<s.length;t++){if(m(s[t]))continue;let r=Df(e,n,t,1);h.push(s[t]),g.push(c[r]),_.push(l[t]),v.push(u[r])}let y=e=>t[g[e]]+v[e]-t[h[e]]-_[e],b=new Int32Array(i),x=[];for(let e=0;e<i;e++)b[e]=e,x.push([e]);let S=(e,t)=>{let n=b[e],r=b[t];if(n!==r){x[n].length<x[r].length&&([n,r]=[r,n]);for(let e of x[r])b[e]=n,x[n].push(e);x[r]=[]}},C=[];for(let e=0;e<h.length;e++){let t=Math.abs(y(e));t<.01?S(h[e],g[e]):t<=pf&&C.push(e)}if(C.length===0)return;C.sort((e,t)=>Math.abs(y(e))-Math.abs(y(t))||e-t);let w=t=>zf(e,r,t),T=(e,n)=>{for(let r of x[e]){let i=d[o[r]],a=d[o[r]+1],s=i+p[r];if(s>i&&b[f[s-1]]!==e&&t[r]+n-t[f[s-1]]<w(r)+w(f[s-1])-.01||s+1<a&&b[f[s+1]]!==e&&t[f[s+1]]-t[r]-n<w(r)+w(f[s+1])-.01)return!1}return!0};for(let e of C){let n=y(e);if(Math.abs(n)<.01){S(h[e],g[e]);continue}if(Math.abs(n)>pf||b[h[e]]===b[g[e]])continue;let r=b[h[e]],i=b[g[e]],o=x[r].length<=x[i].length?r:i;for(let s of[o,o===r?i:r]){let i=s===r?n:-n;if(!(Math.abs(n)>ff&&!x[s].every(e=>a[e]===1))&&T(s,i)){for(let e of x[s])t[e]+=i;S(h[e],g[e]);break}}}}function Pf(e){let{maxRank:t,KIND:n,layerStart:r,order:i}=e,a=new Uint8Array(t+1),o=!1;for(let e=1;e<t;e++){let t=r[e+1]>r[e];for(let a=r[e];t&&a<r[e+1];a++)n[i[a]]!==1&&(t=!1);t&&(a[e]=1,o=!0)}return o?a:void 0}function Ff(e,t,n,r,i){let{from:a,to:o,rank:s,track:c,levels:l,wide:u}=e,d=a.length,f=new Map;for(let e=0;e<d;e++){if(c.push(-1),l.push(0),Math.abs(a[e]-o[e])<uf)continue;let t=f.get(s[e]);t?t.push(e):f.set(s[e],[e])}if(f.size===0)return;let p=new Float64Array(d),m=new Float64Array(d);for(let e=0;e<d;e++)p[e]=Math.min(a[e],o[e]),m[e]=Math.max(a[e],o[e]);let h=(e,t)=>+(e>=p[t]-uf&&e<=m[t]+uf),g=(e,t)=>Math.abs(a[e]-a[t])<uf||Math.abs(o[e]-o[t])<uf,_=(e,t)=>p[e]<m[t]-uf&&p[t]<m[e]-uf,v=(e,t)=>_(e,t)&&!g(e,t),y=(e,t)=>_(e,t)||h(o[e],t)+h(a[t],e)+h(o[t],e)+h(a[e],t)>0,b=(e,t)=>h(o[e],t)+h(a[t],e),x=e=>{let t=e.map((e,t)=>t).sort((t,n)=>p[e[t]]-p[e[n]]),n=[];for(let r=0;r<t.length;r++){let i=t[r],a=m[e[i]]+4*uf;for(let o=r+1;o<t.length&&p[e[t[o]]]<=a;o++){let e=t[o];n.push(Math.min(i,e),Math.max(i,e))}}return n},S=e=>{e.sort((e,t)=>m[t]-p[t]-(m[e]-p[e])||p[e]-p[t]||e-t);let t=e.length,r=[],i=e.map((e,t)=>t),a=e=>{for(;i[e]!==e;)e=i[e]=i[i[e]];return e},o=t<=hf,s=o?x(e):[],u=o?e.map(()=>[]):[];for(let t=0;t<s.length;t+=2){let n=s[t],r=s[t+1];v(e[n],e[r])&&(u[n].push(r),u[r].push(n))}let d=e.map((e,t)=>t);if(o){let n=new Int32Array(t),o=[];for(let e=0;e<t;e++)r.push([]),o.push([]);for(let t=0;t<s.length;t+=2){let c=s[t],l=s[t+1],u=e[c],d=e[l];if(!y(u,d))continue;i[a(c)]=a(l);let f=b(u,d),p=b(d,u);if(f===p)continue;let m=f<p?c:l,h=f<p?l:c;r[h].push(m),o[m].push(h),n[h]++}let c=new Uint8Array(t);d=[];for(let e=0;e<t;e++){let e=-1;for(let r=0;r<t&&!(!c[r]&&((e<0||n[r]<n[e])&&(e=r),n[r]===0));r++);c[e]=1,d.push(e);for(let t of o[e])n[t]--}}let f=new Set,h=[],g=0;for(let t of d){let n=e[t],i=0;for(let n of r[t]??[])c[e[n]]>=i&&(i=c[e[n]]+1);if(o){f.clear();for(let n of u[t])f.add(c[e[n]]);for(;f.has(i);)i++}else{for(;h[i]?.some(e=>v(n,e));)i++;(h[i]??=[]).push(n)}c[n]=i,i>=g&&(g=i+1)}let _=new Int32Array(t).fill(g),S=new Int32Array(t).fill(-1);for(let n=0;n<t;n++){let t=a(n);_[t]=Math.min(_[t],c[e[n]]),S[t]=Math.max(S[t],c[e[n]])}for(let r=0;r<t;r++){let t=a(r);l[e[r]]=S[t]-_[t]+1,n&&(c[e[r]]-=_[t])}return g},C=(e,t,n)=>{let r=Af(o[e]-a[e],t);for(let i=0;i<=gf;i++){let s=i/gf,c=1-s;n[2*i]=a[e]+(o[e]-a[e])*s*s*(3-2*s),n[2*i+1]=t*(3*r*s*c*c+3*(1-r)*s*s*c+s*s*s)}},w=(e,t,n)=>{let r=n*n*1.000000001;for(let i=0;i<=gf;i++){let a=e[2*i],o=e[2*i+1];for(let e=0;e<gf;e++){let i=t[2*e+2]-t[2*e],s=t[2*e+3]-t[2*e+1],c=Math.max(0,Math.min(1,((a-t[2*e])*i+(o-t[2*e+1])*s)/(i*i+s*s||1))),l=a-t[2*e]-c*i,u=o-t[2*e+1]-c*s;if(l*l+u*u<r&&Math.hypot(l,u)<n)return!0}}return!1},T=(e,t,n,r)=>{let i=Math.max(n/2,n-2*of);return C(e,i,_f),C(t,i,vf),w(_f,vf,r)||w(vf,_f,r)};for(let[e,s]of f){if(!n){t[e]=S(s);continue}if(s.length>hf)continue;let d=s.filter(e=>u[e]===1);S(d);let f=new Set(d.filter(e=>l[e]>1)),h=x(s);for(let t=0;t<h.length;t+=2){let n=s[h[t]],i=s[h[t+1]];f.has(n)&&f.has(i)||!v(n,i)||a[n]<o[n]!=a[i]<o[i]||T(n,i,r[e],u[n]===1||u[i]===1?sf:cf)&&f.add(n).add(i)}for(let e of d)c[e]=-1,l[e]=0;if(f.size===0)continue;let b=0,C=0,w=new Set;for(let e=0;e<h.length;e+=2){let t=s[h[e]],n=s[h[e+1]];if(f.has(t)&&f.has(n)){if(!_(t,n))continue;a[t]<o[t]==a[n]<o[n]?g(t,n)||C++:b++}else(f.has(t)||f.has(n))&&y(t,n)&&w.add(t).add(n)}if(b>C){for(let t of s)(m[t]-p[t])*lf>i[e]&&(i[e]=(m[t]-p[t])*lf);continue}let E=s.filter(e=>f.has(e)||u[e]!==1&&w.has(e));S(E);let D=0;for(let e of E)l[e]>D&&(D=l[e]);t[e]=D}}function If(e,t,n,r,i,a,o){let{maxRank:s,EF:c,ET:l,EFD:u,ETD:d,succStart:f,succE:p,predStart:m,predE:h,layerStart:g,order:_}=e,v=new Float64Array(t.length),y=new Float64Array(t.length),b=new Float64Array(t.length);for(let a=0;a<r.length;a++){let o=r[a];if(o<0)continue;let s=o+i[a]-1,g=e.RANK[o];for(let e=o;e<s;e++){if(!n[g+e-o])continue;let r=e;for(;r+1<s&&n[g+r+1-o];)r++;let i=h[m[e]],a=p[f[r]],_=t[c[i]]+u[i],x=t[l[a]]+d[a],S=r-e+2;for(let t=e;t<=r;t++)v[t]=_+(x-_)*(t-e+1)/S,y[t]=_,b[t]=x;e=r}}let x=[];for(let r=1;r<s;r++){if(!n[r])continue;let i=g[r],s=g[r+1],c=Array.from(_.subarray(i,s)).sort((e,t)=>y[e]-y[t]||b[e]-b[t]||e-t);for(let n=0;n<c.length;){x.length=0;let r=n;for(;r<c.length&&Math.abs(y[c[r]]-y[c[n]])<df&&Math.abs(b[c[r]]-b[c[n]])<df;r++)x.push(c[r]);x.sort((t,n)=>e.pos[t]-e.pos[n]);for(let e=0;e<x.length;e++){let n=x[e];t[n]=v[n]+(e-(x.length-1)/2)*a,(x.length===1||a===0)&&(o[n]=1)}n=r}}}function Lf(e,t,n,r,i,a){let{maxRank:o,W:s,KIND:c,RANK:l,EF:u,ET:d,EFD:f,ETD:p,succStart:m,succE:h,predStart:g,predE:_,layerStart:v,order:y}=e,b=new Uint8Array(o+1),x=!1;for(let e=1;e<o;e++){let t=!1,n=!1;for(let r=v[e];r<v[e+1];r++){let e=c[y[r]];e===2?t=!0:e!==1&&(n=!0)}t&&!n&&(b[e]=1,x=!0)}if(x)for(let e=0;e<n.length;e++){let o=n[e];if(!(o<0))for(let n=o,x=o+r[e]-1;n<x;n++){if(c[n]!==1||!b[l[n]])continue;let e=n,r=n;for(;e>o&&a[e-1];)e--;for(;r+1<x&&a[r+1];)r++;let S=_[g[e]],C=h[m[r]],w=t[u[S]]+f[S],T=t[d[C]]+p[C],E=Math.min(w,T)-i,D=Math.max(w,T)+i,O=!0,k=l[n];for(let e=v[k];O&&e<v[k+1];e++){let n=y[e];c[n]===2&&t[n]+s[n]/2>E&&t[n]-s[n]/2<D&&(O=!1)}if(!O)continue;a[n]=1;let A=r-e+2;for(let n=e;n<=r;n++)t[n]=w+(T-w)*(n-e+1)/A}}}function Rf(e,t){let{n,real:r,maxRank:i,W:a,EF:o,ET:s,EFD:c,ETD:l,succStart:u,succE:d,predStart:f,predE:p,layerStart:m,order:h,pos:g,offsets:_,fixed:v,GRP:y,groupParent:b}=e,x=0;for(let e=0;e<=i;e++)x=Math.max(x,m[e+1]-m[e]);if(x<2)return[0,0];let S=_?new Int32Array(o.length):void 0,C=new Int32Array(S?o.length:0),w=new Int32Array(S?n:0),T=S?d.slice():d,E=new Uint8Array(S?n:0);if(S){let e=p.slice(),t=(e,t,n,r)=>{for(let i=t+1;i<n;i++)if(r[e[i]]!==r[e[t]])return e.subarray(t,n).sort((e,t)=>r[e]-r[t]),!0;return!1};for(let r=0;r<n;r++){if(w[r]=1,t(e,f[r],f[r+1],l))for(let t=f[r]+1;t<f[r+1];t++)l[e[t]]!==l[e[t-1]]&&w[r]++,C[e[t]]=w[r]-1;t(T,u[r],u[r+1],c)&&(E[r]=1)}}let D=1;for(;D<(S?x+o.length:x);)D<<=1;let O=new Int32Array(2*D),k=new Int32Array(o.length),A=()=>{let e=0;for(let t=0;t<i;t++){let n=m[t+2]-m[t+1];if(S){let e=0;for(let n=m[t+1];n<m[t+2];n++){let t=h[n];for(let n=f[t];n<f[t+1];n++)S[p[n]]=e+C[p[n]];e+=w[t]}n=e}if(n<2)continue;let r=0;for(let e=m[t];e<m[t+1];e++){let t=h[e],n=u[t],i=u[t+1],a=r;for(let e=n;e<i;e++)k[r++]=S?S[T[e]]:g[s[d[e]]];let o=r-a;if(!(o<2)){if(S&&E[t])for(let e=a+1;e<r;e++){let t=k[e],r=c[T[n+e-a]],i=e-1;for(;i>=a&&c[T[n+i-a]]===r&&k[i]>t;)k[i+1]=k[i],i--;k[i+1]=t}else if(o<=12)for(let e=a+1;e<r;e++){let t=k[e],n=e-1;for(;n>=a&&k[n]>t;)k[n+1]=k[n],n--;k[n+1]=t}else k.subarray(a,r).sort()}}if(r<2)continue;let i=1;for(;i<n;)i<<=1;O.fill(0,0,2*i);for(let t=0;t<r;t++){let n=k[t]+i;for(O[n]++;n>1;)!(n&1)&&(e+=O[n+1]),n>>=1,O[n]++}}return e},j=A(),M=new Float64Array(n),N=new Int32Array(x),P=new Int32Array(x),F=b?b.length:0,I=new Int32Array(F);for(let e=0;e<F;e++)for(let t=e;t>=0;t=b[t])I[e]++;let L=new Float64Array(F),R=new Int32Array(F),z=new Int32Array(F),B=(e,t)=>{let r=m[e],i=m[e+1];for(let e=r;e<i;e++)for(let t=y[h[e]];t>=0;t=b[t])L[t]=0,R[t]=0;for(let e=r;e<i;e++){let n=h[e];for(let r=y[n];r>=0;r=b[r])R[r]===0&&(z[r]=e),L[r]+=t[n],R[r]++}let a=e=>e>=n?L[e-n]/R[e-n]:t[e],o=e=>e>=n?z[e-n]:r+g[e],s=Array.from(h.subarray(r,i)).sort((e,t)=>{let r=e,i=t,s=y[e],c=y[t],l=s<0?0:I[s],u=c<0?0:I[c];for(;l>u;l--)r=n+s,s=b[s];for(;u>l;u--)i=n+c,c=b[c];for(;s!==c;)r=n+s,s=b[s],i=n+c,c=b[c];return a(r)-a(i)||o(r)-o(i)});h.set(s,r);for(let e=r;e<i;e++)g[h[e]]=e-r};if(y){let e=new Float64Array(n);for(let t=0;t<=i;t++){for(let n=m[t];n<m[t+1];n++)e[h[n]]=n-m[t];B(t,e)}}let V=y?A():j;if(V===0)return[0,j];let H=h.slice(),U=Math.min(V,j),ee=(e,n)=>{let b=e?f:u,x=e?p:d,S=e?o:s,C=e?c:l;for(let o=1;o<=i;o++){let s=e?o:i-o;if(v[s])continue;let c=m[s],l=m[s+1],u=0;for(let n=c;n<l;n++){let i=h[n],o=i<r?t[i].pin:0;if(o!==0){M[i]=o*1e9,N[u++]=i;continue}let d=b[i],f=b[i+1];if(d===f){if(y){let t=e?m[s]-m[s-1]:m[s+2]-m[s+1];M[i]=(n-c)*t/(l-c);continue}M[i]=-1;continue}let p=0;for(let e=d;e<f;e++){let t=S[x[e]];p+=g[t],_&&a[t]>0&&(p+=C[x[e]]/a[t])}M[i]=p/(f-d),N[u++]=i}if(y){B(s,M);continue}if(u<2)continue;xf(N,u,M,g,n,P);let d=0;for(let e=c;e<l;e++)M[h[e]]!==-1&&(h[e]=N[d++]);for(let e=c;e<l;e++)g[h[e]]=e-c}},te=()=>{let e=0;for(let t=0;t<=i;t++)for(let n=m[t];n<m[t+1];n++)if(!(h[n]>=r))for(let r=n+1;r<m[t+1];r++)h[r]<h[n]&&e++;return e},W=()=>{for(let e=0;e<=i;e++)for(let t=m[e];t<m[e+1];t++)g[h[t]]=t-m[e]},ne=e=>e<r?t[e].pin:0,G=(e,t)=>{let n=t?o[e]:s[e];return _&&a[n]>0?g[n]+(t?c[e]:l[e])/a[n]:g[n]},re=(e,t)=>{let n=0;for(let r=f[e];r<f[e+1];r++){let e=G(p[r],!0);for(let r=f[t];r<f[t+1];r++)e>G(p[r],!0)&&n++}for(let r=u[e];r<u[e+1];r++){let e=G(d[r],!1);for(let r=u[t];r<u[t+1];r++)e>G(d[r],!1)&&n++}return n},K=()=>{for(let e=0;e<8;e++){let e=!1;for(let t=0;t<=i;t++){if(v[t])continue;let n=m[t];for(let r=n;r+1<m[t+1];r++){let t=h[r],i=h[r+1];ne(t)!==ne(i)||y&&y[t]!==y[i]||re(i,t)>=re(t,i)||(h[r]=i,h[r+1]=t,g[i]=r-n,g[t]=r+1-n,e=!0)}}if(!e)break}},ie=h.slice(),q=n<=600,ae=H,oe=1/0;for(let e=0;e<(q?2:1);e++){e>0&&(h.set(ie),W());let t=U,n=ie.slice();for(let r=0,i=0;i<4&&r<qd;r++,i++){ee((r+e)%2==0,r%4>=2);let a=A();if(a<t&&(t=a,n.set(h),i=0,a===0))break}if(h.set(n),q&&t>0){W(),K();let e=A();e<t&&(t=e,n.set(h))}let r=q?te():0;(e===0||t<V||t===V&&r<oe)&&(V=t,ae=n,oe=r)}if(h.set(ae),W(),H.set(ae),y&&(V=A()),!q)return[V,j];for(let e=0;e<r;e++)if(t[e].pin!==0)return[V,j];if(oe===0||v[0]||v[i])return[V,j];for(let e=0;e<=i;e++)h.subarray(m[e],m[e+1]).reverse();return W(),(A()>V||te()>=oe)&&h.set(H),[V,j]}function zf(e,t,n){return e.W[n]/2+(e.KIND[n]===0?t.nodeSep:t.edgeSep)/2}function Bf(e,t){let{n,maxRank:r,W:i,KIND:a,EF:o,ET:s,EFD:c,ETD:l,succStart:u,succE:d,predStart:f,predE:p,layerStart:m,order:h,pos:g}=e,_=o.length,v=new Float64Array(n);for(let r=0;r<n;r++)v[r]=zf(e,t,r);let y=new Int32Array(_);for(let e=0;e<_;e++)y[e]=g[s[e]];for(let e=0;e<n;e++)u[e+1]-u[e]>1&&bf(d,u[e],u[e+1],y);for(let e=0;e<_;e++)y[e]=g[o[e]];for(let e=0;e<n;e++)f[e+1]-f[e]>1&&bf(p,f[e],f[e+1],y);let b=new Uint8Array(_);for(let e=1;e<=r;e++){let t=m[e]-m[e-1],n=m[e],r=m[e+1],i=0,s=n;for(let e=n;e<r;e++){let n=h[e],c=-1;if(yf(a[n])){let e=o[p[f[n]]];yf(a[e])&&(c=e)}let l=c>=0?g[c]:t;if(c>=0||e===r-1){for(let t=s;t<=e;t++){let e=h[t],n=yf(a[e]);for(let t=f[e];t<f[e+1];t++){let e=p[t],r=g[o[e]];(r<i||l<r)&&!(n&&yf(a[o[e]]))&&(b[e]=1)}}s=e+1,i=l}}}let x=[],S=new Int32Array(n),C=new Int32Array(n),w=new Float64Array(n),T=new Int32Array(n),E=new Int32Array(n),D=new Float64Array(n),O=new Int32Array(n),k=new Int32Array(n+1),A=new Int32Array(n),j=new Int32Array(n),M=new Int32Array(n),N=new Float64Array(n);for(let e=0;e<4;e++){let t=e<2,i=(e&1)==1,a=t?f:u,_=t?p:d,y=t?o:s,P=t?l:c,F=t?c:l;for(let e=0;e<n;e++)S[e]=e,C[e]=e,w[e]=0,O[e]=0,k[e+1]=0,N[e]=0;for(let e=0;e<=r;e++){let n=t?e:r-e,o=m[n],s=m[n+1],c=t?n-1:n+1,l=c>=0&&c<=r?m[c+1]-m[c]-1:0,u=-1;for(let e=i?s-1:o;i?e>=o:e<s;i?e--:e++){let t=h[e],n=a[t],r=a[t+1]-n;if(r===0)continue;let o=n+(r-1>>1),s=n+(r>>1);for(let e=0;e<2&&(e!==1||o!==s);e++){let n=_[e===0===i?s:o],r=y[n],a=i?l-g[r]:g[r];C[t]===t&&u<a&&b[n]===0&&(C[r]=t,C[t]=S[t]=S[r],w[t]=w[r]+F[n]-P[n],u=a)}}}let I=0;for(let e=0;e<=r;e++){let t=m[e],n=m[e+1];for(let e=t+1;e<n;e++){let t=i?h[e]:h[e-1],n=i?h[e-1]:h[e],r=v[t]+v[n];T[I]=S[t],E[I]=S[n],D[I]=i?r-w[t]+w[n]:r+w[t]-w[n],O[S[n]]++,k[S[t]+1]++,I++}}for(let e=0;e<n;e++)k[e+1]+=k[e];for(let e=0;e<n;e++)j[e]=k[e];for(let e=0;e<I;e++)A[j[T[e]]++]=e;let L=0;for(let e=0;e<n;e++)S[e]===e&&O[e]===0&&(M[L++]=e);for(let e=0;e<L;e++){let t=M[e];for(let e=k[t];e<k[t+1];e++){let n=A[e],r=E[n];N[t]+D[n]>N[r]&&(N[r]=N[t]+D[n]),--O[r]===0&&(M[L++]=r)}}for(let e=L-1;e>=0;e--){let t=M[e],n=1/0;for(let e=k[t];e<k[t+1];e++){let t=A[e],r=N[E[t]]-D[t];r<n&&(n=r)}n!==1/0&&n>N[t]&&(N[t]=n)}let R=new Float64Array(n);for(let e=0;e<n;e++)R[e]=(i?-N[S[e]]:N[S[e]])+w[e];x.push(R)}let P=0,F=1/0,I=[],L=[];for(let e=0;e<4;e++){let t=1/0,r=-1/0,a=x[e];for(let e=0;e<n;e++){let n=i[e]/2;a[e]-n<t&&(t=a[e]-n),a[e]+n>r&&(r=a[e]+n)}I.push(t),L.push(r),r-t<F&&(F=r-t,P=e)}for(let e=0;e<4;e++){let t=e&1?L[P]-L[e]:I[P]-I[e];if(t!==0){let r=x[e];for(let e=0;e<n;e++)r[e]+=t}}let R=new Float64Array(n);for(let e=0;e<n;e++){let t=x[0][e],n=x[1][e],r=x[2][e],i=x[3][e],a;t>n&&(a=t,t=n,n=a),r>i&&(a=r,r=i,i=a),t>r&&(a=t,t=r,r=a),n>i&&(a=n,n=i,i=a),n>r&&(a=n,n=r,r=a),R[e]=(n+r)/2}return R}function Vf(e){return e===`BT`||e===`LR`||e===`RL`?e:`TB`}var Hf=4e4,Uf=400,Wf=500,Gf=1.5,Kf=4;function qf(e,t,n,r){let i=[];for(let t of e)i.push(t.x,t.y,t.w,t.h);let a=[];for(let e of t)a.push(e.labelX,e.labelY);let o=[];for(let e of n){o.push(e.x,e.y);for(let t of e.ports)o.push(t.px,t.py)}return{nodes:i,routes:t.map(e=>e.route),labels:a,levels:o,total:r}}function Jf(e,t,n,r){t.forEach((t,n)=>{t.x=e.nodes[4*n],t.y=e.nodes[4*n+1],t.w=e.nodes[4*n+2],t.h=e.nodes[4*n+3]}),n.forEach((t,n)=>{t.route=e.routes[n],t.labelX=e.labels[2*n],t.labelY=e.labels[2*n+1]});let i=0;for(let t of r){t.x=e.levels[i++],t.y=e.levels[i++];for(let n of t.ports)n.px=e.levels[i++],n.py=e.levels[i++]}return e.total}var Yf=24,Xf=.5,Zf=3,Qf=2,$f=Math.max(3,Zf,Qf+1),ep=.62,tp=128;function np(e){return e.tracks?1:e.straight?2:0}function rp(e,t,n=0){let r=0;for(let e of t)e.src!==e.dst&&e.route.length>3&&(r+=(e.route.length/3-1)*$f);let i=new Float64Array(r),a=new Float64Array(r),o=new Float64Array(r),s=new Float64Array(r),c=new Float64Array(r),l=new Float64Array(r),u=new Int32Array(r),d=new Uint8Array(r),f=0,p=1/0,m=-1/0,h=NaN,g=NaN,_=NaN,v=NaN,y=(e,t,n,r,y,b)=>{let x=f-1;n===_&&r===v&&(b===r&&g===r||y===n&&h===n)&&u[x]===e&&d[x]===t&&(n-h)*(y-n)+(r-g)*(b-r)>0&&(f--,n=h,r=g),h=n,g=r,_=y,v=b,d[f]=t,i[f]=Math.min(n,y),o[f]=Math.max(n,y),a[f]=n<=y?r:b,s[f]=n<=y?b:r,c[f]=Math.min(r,b),l[f]=Math.max(r,b),c[f]<p&&(p=c[f]),l[f]>m&&(m=l[f]),u[f++]=e};for(let e=0;e<t.length;e++){let r=t[e];if(r.src===r.dst)continue;let i=r.route,a=e=>Math.abs(i[e]-i[e-3])<.01||Math.abs(i[e+1]-i[e-2])<.01,o=e=>Math.abs(i[e]-i[e-3])+Math.abs(i[e+1]-i[e-2]),s=e=>n===0&&e>0&&e<i.length-3&&a(e)&&a(e+3)&&o(e)>=.01&&o(e+3)>=.01&&Math.abs(i[e]-i[e-3])<.01!=Math.abs(i[e+3]-i[e])<.01,c=i[0],l=i[1];for(let t=3;t<i.length;t+=3){let r=+(t===3)|(t===i.length-3?2:0),u=c,d=l,f=i[t],p=i[t+1];if(c=f,l=p,a(t)||n===2){if(!s(t)){y(e,r,u,d,f,p);continue}let n=s(t-3)?o(t)/2:o(t),a=s(t+3)?o(t+3)/2:o(t+3),m=(f-i[t-3])/o(t),h=(p-i[t-2])/o(t),g=(i[t+3]-f)/o(t+3),_=(i[t+4]-p)/o(t+3),v=f-m*n,b=p-h*n;y(e,r,u,d,v,b);let x=f-m*n*(1-ep),S=p-h*n*(1-ep),C=f+g*a*(1-ep),w=p+_*a*(1-ep);c=f+g*a,l=p+_*a;let T=r|(t+3===i.length-3?2:0),E=v,D=b;for(let t=1;t<=Qf;t++){let n=t/Qf,r=1-n,i=r*r*r*v+3*r*r*n*x+3*r*n*n*C+n*n*n*c,a=r*r*r*b+3*r*r*n*S+3*r*n*n*w+n*n*n*l;y(e,T,E,D,i,a),E=i,D=a}continue}if(n===1){let n=i[t+2]===0,a=n?u:(u+f)/2,o=n?(d+p)/2:d;y(e,r,u,d,a,o),y(e,r,a,o,n?f:a,n?o:p),y(e,r,n?f:a,n?o:p,f,p);continue}let m=i[t+2]===0,h=m?Af(f-u,p-d):Af(p-d,f-u),g=u,_=d;for(let t=1;t<=Zf;t++){let n=t/Zf,i=1-n,a=n*n*(3-2*n),o=3*h*n*i*i+3*(1-h)*n*n*i+n*n*n,s=u+(f-u)*(m?a:o),c=d+(p-d)*(m?o:a);y(e,r,g,_,s,c),g=s,_=c}}}let b=m>p?Math.round(Math.sqrt(f)):1,x=m>p?b/(m-p):0,S=e=>Math.min(b-1,Math.floor((e-p)*x)),C=new Int32Array(f),w=new Int32Array(b+1);for(let e=0;e<f;e++){C[e]=S(c[e]);for(let t=C[e],n=S(l[e]);t<=n;t++)w[t+1]++}for(let e=0;e<b;e++)w[e+1]+=w[e];let T=w.slice(0,b),E=new Int32Array(w[b]);for(let e=0;e<f;e++)for(let t=C[e],n=S(l[e]);t<=n;t++)E[T[t]++]=e;let D=new Float64Array(t.length*8),O=(e,t,n,r)=>Math.abs(e[t]-e[n])<Xf&&Math.abs(e[t]-e[r])<Xf||Math.abs(e[t+1]-e[n+1])<Xf&&Math.abs(e[t+1]-e[r+1])<Xf;for(let e=0;e<t.length;e++){let n=t[e].route;if(n.length<6)continue;let r=3;for(;r+3<n.length&&O(n,0,r,r+3);)r+=3;let i=n.length-3,a=i-3;for(;a>=3&&O(n,i,a,a-3);)a-=3;D.set([n[0],n[1],n[r],n[r+1],n[a],n[a+1],n[i],n[i+1]],e*8)}let k=(e,t,n,r)=>{let i=e*8+(t===1?0:4),a=D[i],o=D[i+1],s=D[i+2]-a,c=D[i+3]-o,l=s*s+c*c,u=l>0?Math.max(0,Math.min(1,((n-a)*s+(r-o)*c)/l)):0;return Math.hypot(n-a-u*s,r-o-u*c)<Xf},A=0;for(let n=0;n<b;n++){let r=w[n+1];if(r-w[n]>tp)E.subarray(w[n],r).sort((e,t)=>i[e]-i[t]||e-t);else for(let e=w[n]+1;e<r;e++){let t=E[e],r=e;for(;r>w[n]&&i[E[r-1]]>i[t];r--)E[r]=E[r-1];E[r]=t}for(let f=w[n];f<r;f++){let p=E[f],m=o[p]-i[p],h=s[p]-a[p],g=C[p]===n;for(let _=f+1;_<r;_++){let r=E[_];if(i[r]>o[p])break;if(l[r]<c[p]||c[r]>l[p]||u[p]===u[r]||!g&&C[r]!==n)continue;let f=m*(a[r]-a[p])-h*(i[r]-i[p]),v=m*(s[r]-a[p])-h*(o[r]-i[p]);if(f>0==v>0)continue;let y=o[r]-i[r],b=s[r]-a[r],x=y*(a[p]-a[r])-b*(i[p]-i[r]),S=y*(s[p]-a[r])-b*(o[p]-i[r]);if(x>0==S>0)continue;let w=t[u[p]],T=t[u[r]],D=x/(x-S),O=i[p]+D*m,j=a[p]+D*h,M=(t,n,i)=>(d[p]&n)!==0&&(d[r]&i)!==0||Math.abs(O-e[t].x)<e[t].w/2+Yf&&Math.abs(j-e[t].y)<e[t].h/2+Yf||k(u[p],n,O,j)&&k(u[r],i,O,j);w.src===T.src&&M(w.src,1,1)||w.src===T.dst&&M(w.src,1,2)||w.dst===T.src&&M(w.dst,2,1)||w.dst===T.dst&&M(w.dst,2,2)||A++}}}return A}function ip(e,t){let n=t=>{let n=new Set;for(let r=e[t].parent;r>=0&&!n.has(r);r=e[r].parent)n.add(r);return n};for(let[r,i]of t){if(r<0||i<0||r===i)continue;let t=n(r),a=n(i);for(let n of t)a.has(n)||(e[n].dir=void 0);for(let n of a)t.has(n)||(e[n].dir=void 0)}}function ap(e,t,n,r){for(let t of e)t.x+=n,t.y+=r;for(let e of t){for(let t=0;t<e.route.length;t+=3)e.route[t]+=n,e.route[t+1]+=r;e.labelX+=n,e.labelY+=r}}function op(e,t,n=-1){return{w:e,h:t,parent:n,isGroup:!1,dir:void 0,padX:0,padTop:0,padBottom:0,minW:0,seq:0,span:0,x:0,y:0}}function sp(e){return e===`TB`?0:e===`BT`?2:e===`LR`?3:1}function cp(e){return e+2&3}function lp(e,t,n,r){let i=e.length,a=new Map,o=[],s=(e,t)=>{let n={id:e,dir:t,items:[],edges:[],ports:[],portOf:new Map,routes:new Map,x:0,y:0};return a.set(e,n),n},c=s(-1,n),l=[];for(let e=0;e<i;e++)l.push([]);let u=[];for(let t=0;t<i;t++){let n=e[t].parent;n>=0&&n<i&&n!==t&&e[n].isGroup?l[n].push(t):(e[t].parent=-1,u.push(t))}c.items=u,o.push(c);let d=new Int32Array(i),f=new Uint8Array(i),p=t=>{for(let n=t;n<o.length;n++){let t=o[n];for(let n of t.items)if(f[n]=1,d[n]=t.id<0?0:d[t.id]+1,e[n].isGroup){let r=s(n,e[n].dir??t.dir);r.items=l[n],o.push(r)}}};p(0);for(let t=0;t<i;t++){if(f[t])continue;let r=e[t].parent;if(l[r]=l[r].filter(e=>e!==t),e[t].parent=-1,c.items.push(t),f[t]=1,d[t]=0,e[t].isGroup){let r=o.length,i=s(t,e[t].dir??n);i.items=l[t],o.push(i),p(r)}}for(let t=o.length-1;t>0;t--){let n=o[t],r=1/0;for(let t of n.items)e[t].seq<r&&(r=e[t].seq);r!==1/0&&(e[n.id].seq=r)}for(let t of o)t.items.sort((t,n)=>e[t].seq-e[n].seq||t-n);let m=0;for(let n of t){let t=n.src,r=n.dst,i=0;for(;d[t]>d[r];i++)t=e[t].parent;for(;d[r]>d[t];i++)r=e[r].parent;for(;t!==r&&e[t].parent!==e[r].parent;i+=2)t=e[t].parent,r=e[r].parent;t!==r&&(m+i>Hf?(n.src=t,n.dst=r):m+=i)}let h=[],g=[];for(let n=0;n<t.length;n++){let r=t[n];if(r.route=[],r.src===r.dst){h.push(n);continue}let i=r.src,o=r.dst,s=[],c=[];for(;d[i]>d[o];)s.push(i),i=e[i].parent;for(;d[o]>d[i];)c.push(o),o=e[o].parent;if(i===o)g.push(n);else{for(;e[i].parent!==e[o].parent;)s.push(i),c.push(o),i=e[i].parent,o=e[o].parent;a.get(e[i].parent).edges.push({e:n,a:i,b:o});for(let[t,r]of[[s,!0],[c,!1]])for(let i of t){let t=a.get(e[i].parent),o={e:n,inner:i,out:r,side:0,hint:NaN,px:0,py:0,route:[]};t.ports.push(o),t.portOf.set(n*2+ +!r,o)}}}let _=new Int32Array(i),v=(e,t,n)=>(n?t.src:t.dst)!==e,y=(n,r)=>{let i=n.dir===`TB`||n.dir===`BT`,o=sp(n.dir),s=[],c=[];n.items.forEach((t,n)=>{_[t]=n;let a=e[t],o=r?Gd(i?a.w:a.h,i?a.h:a.w):Gd(0,0);o.span=a.isGroup?Math.min(a.span,o.w-2*a.padX):a.span,o.key=S?x[t]:NaN,s.push(o)});let l=(n,r,i)=>e[n].isGroup&&v(n,t[r],i),u=(n,o,s)=>{if(!r||!e[n].isGroup||!v(n,t[o],s))return 0;let c=a.get(n).portOf.get(o*2+ +!s);return i?c.px-e[n].w/2:c.py-e[n].h/2};for(let e of n.edges){let n=t[e.e],a=Kd(_[e.a],_[e.b],n.minlen);r&&(a.labelW=i?n.labelW:n.labelH,a.labelH=i?n.labelH:n.labelW,a.tailDx=u(e.a,e.e,!0),a.headDx=u(e.b,e.e,!1),a.tailFixed=l(e.a,e.e,!0),a.headFixed=l(e.b,e.e,!1)),c.push(a)}let d=new Int32Array(n.ports.length).fill(-1);return n.ports.forEach((e,r)=>{if(e.side===o||e.side===cp(o)){let i=s.length,a=Gd(0,0,e.side===o?3:4);a.key=S?x[e.out?t[e.e].dst:t[e.e].src]:NaN,a.hint=Number.isNaN(e.hint)&&S&&w?w(n,e):e.hint,s.push(a),d[r]=i;let f=e.out?Kd(_[e.inner],i):Kd(i,_[e.inner]);e.out?(f.tailDx=u(e.inner,e.e,!0),f.tailFixed=l(e.inner,e.e,!0)):(f.headDx=u(e.inner,e.e,!1),f.headFixed=l(e.inner,e.e,!1)),c.push(f)}else s[_[e.inner]].pin=e.side===0||e.side===3?-1:1}),{lnodes:s,ledges:c,dummies:d}},b=m>1&&m<=Uf&&t.length<=Wf,x=new Float64Array(i).fill(NaN),S=!1,C=0,w,T=o.length>1&&b;for(let e of o)e.dir!==n&&(T=!1);if(T){let a=n===`TB`||n===`BT`,o=new Int32Array(i).fill(-1),s=new Int32Array(i).fill(-1),c=[],l=[],u=[];for(let t=0;t<i;t++)e[t].isGroup&&(s[t]=u.length,u.push(-1));for(let t=0;t<i;t++){let n=e[t].parent;e[t].isGroup?u[s[t]]=n>=0?s[n]:-1:(o[t]=c.length,c.push(Gd(a?e[t].w:e[t].h,a?e[t].h:e[t].w)),l.push(n>=0?s[n]:-1))}let d=[],f=new Int32Array(t.length).fill(-1);t.forEach((e,t)=>{e.src===e.dst||o[e.src]<0||o[e.dst]<0||(f[t]=d.length,d.push(Kd(o[e.src],o[e.dst],e.minlen,a?e.labelW:e.labelH,a?e.labelH:e.labelW)))});let p=Sf(c,d,{...r,groups:{of:Int32Array.from(l),parent:Int32Array.from(u)},orderOnly:!0});C=Math.min(p.crossings??0,p.declared??0);let m=new Float64Array(i),h=new Int32Array(i),g=new Int32Array(i).fill(-1);for(let t=0;t<i;t++)if(!(o[t]<0)){x[t]=c[o[t]].x;for(let n=e[t].parent;n>=0;n=e[n].parent)m[n]+=x[t],h[n]++,g[n]=Math.max(g[n],c[o[t]].rank)}for(let e=0;e<i;e++)h[e]>0&&(x[e]=m[e]/h[e]);w=(e,n)=>{let r=f[n.e];if(r<0||e.id<0||!n.out||n.side!==cp(sp(e.dir)))return NaN;let i=d[r].points,a=x[t[n.e].src],o=0;for(let t=0;t<i.length;t+=2)i[t]===g[e.id]&&(a=i[t+1]),i[t]===g[e.id]+1&&(o=i[t+1]);return a+o*1e-6}}let E=new Map,D=(e,t,n)=>{if(!b)return{lnodes:t,ledges:n,size:Sf(t,n,r)};let i=[];for(let e of t)i.push(e.w,e.h,e.kind,e.pin,e.hint,e.key,e.span);for(let e of n)i.push(e.tail,e.head,e.minlen,e.labelW,e.labelH,e.tailDx,e.headDx,+e.tailFixed,+e.headFixed);let a=E.get(e.id);a||E.set(e.id,a=[]);for(let e of a){let t=e.given.length===i.length;for(let n=0;t&&n<i.length;n++)t=Object.is(e.given[n],i[n]);if(t)return e}let o={given:i,lnodes:t,ledges:n,size:Sf(t,n,r)};return a.push(o),o},O={width:0,height:0},k=()=>{for(let n of o){for(let r of n.ports)e[r.inner].isGroup&&v(r.inner,t[r.e],r.out)&&(a.get(r.inner).portOf.get(r.e*2+ +!r.out).side=r.side);if(n.edges.length===0)continue;let r=!1;for(let i of n.edges){let n=t[i.e];(e[i.a].isGroup&&n.src!==i.a||e[i.b].isGroup&&n.dst!==i.b)&&(r=!0)}if(!r)continue;let{lnodes:i,ledges:o}=y(n,!1);Cf(i,o),wf(i,o,1);let s=sp(n.dir);n.edges.forEach((n,r)=>{let i=t[n.e],c=!o[r].reversed;e[n.a].isGroup&&i.src!==n.a&&(a.get(n.a).portOf.get(n.e*2).side=c?cp(s):s),e[n.b].isGroup&&i.dst!==n.b&&(a.get(n.b).portOf.get(n.e*2+1).side=c?s:cp(s))})}for(let n=o.length-1;n>=0;n--){let r=o[n],i=r.id>=0?e[r.id]:void 0,s=r.dir===`TB`||r.dir===`BT`,c=r.dir===`BT`||r.dir===`RL`,l=y(r,!0),{lnodes:u,ledges:d,size:f}=D(r,l.lnodes,l.ledges),p=l.dummies,m=s?f.width:f.height,h=s?f.height:f.width,g=i?i.padX:0,_=i?i.padTop:0,b=Math.max(m+2*g,i?i.minW:0),x=h+_+(i?i.padBottom:0),S=(b-m)/2,C=_,w=(e,t)=>S+(s?e:c?f.height-t:t),T=(e,t)=>C+(s?c?f.height-t:t:e),E=+!s,k=e=>{let t=[];for(let n=0;n<e.length;n+=2)t.push(w(e[n],e[n+1]),T(e[n],e[n+1]),E);return t};r.items.forEach((t,n)=>{e[t].x=w(u[n].x,u[n].y),e[t].y=T(u[n].x,u[n].y)}),r.edges.forEach((e,n)=>{let i=d[n];r.routes.set(e.e,k(i.points));let a=t[e.e];a.labelW>0&&(a.labelX=w(i.labelX,i.labelY),a.labelY=T(i.labelX,i.labelY))});let A=r.edges.length;r.ports.forEach((n,r)=>{let i=e[n.inner];if(p[r]>=0){let e=k(d[A++].points),t=n.out?e.length-3:0,r=e[t],i=e[t+1];n.side===0?i=0:n.side===2?i=x:r=n.side===3?0:b,n.out?e.push(r,i,E):e.unshift(r,i,E),n.px=r,n.py=i,n.route=e;return}let o=i.x,s=i.y;if(i.isGroup&&v(n.inner,t[n.e],n.out)){let e=a.get(n.inner).portOf.get(n.e*2+ +!n.out);o+=e.px-i.w/2,s+=e.py-i.h/2}else n.side===0?s-=i.h/2:n.side===2?s+=i.h/2:n.side===3?o-=i.w/2:o+=i.w/2;let c=o,l=s;n.side===0?l=0:n.side===2?l=x:c=n.side===3?0:b;let u=n.side===0||n.side===2?0:1;n.px=c,n.py=l,n.route=n.out?[o,s,u,c,l,u]:[c,l,u,o,s,u]}),i?(i.w=b,i.h=x):O={width:b,height:x}}for(let t of o){let n=t.x,r=t.y;for(let i of t.items){let t=e[i];if(t.x+=n,t.y+=r,t.isGroup){let e=a.get(i);e.x=t.x-t.w/2,e.y=t.y-t.h/2}}}let n=(e,t,n,r)=>{for(let i=0;i<t.length;i+=3){let a=t[i]+n,o=t[i+1]+r,s=e.length;s>=3&&Math.abs(e[s-3]-a)<.01&&Math.abs(e[s-2]-o)<.01||e.push(a,o,t[i+2])}};for(let r of o)for(let i of r.edges){let o=t[i.e],s=[],c=[];for(let t=o.src;e[t].parent!==r.id;t=e[t].parent)c.push(a.get(e[t].parent));for(let e of c)n(s,e.portOf.get(i.e*2).route,e.x,e.y);n(s,r.routes.get(i.e),r.x,r.y);let l=[];for(let t=o.dst;e[t].parent!==r.id;t=e[t].parent)l.push(a.get(e[t].parent));for(let e=l.length-1;e>=0;e--)n(s,l[e].portOf.get(i.e*2+1).route,l[e].x,l[e].y);o.route=s,o.labelW>0&&(o.labelX+=r.x,o.labelY+=r.y)}},A=np(r);S=T,k();let j=-1;if(T&&(j=rp(e,t,A),j>C*Gf+Kf)){let n=qf(e,t,o,O);S=!1,k();let r=rp(e,t,A);r>=j?(S=!0,O=Jf(n,e,t,o)):j=r}if(S===T&&b){let n=!1;for(let r of o){if(r.id<0)continue;let i=e[r.id],a=r.dir===`TB`||r.dir===`BT`,o=cp(sp(r.dir)),s=[];for(let e of r.ports){if(e.side!==o)continue;let n=t[e.e].route,c=r.x+e.px,l=r.y+e.py,u=-1;for(let t=0;t<n.length&&(u<0||e.out);t+=3)Math.abs(n[t]-c)<.01&&Math.abs(n[t+1]-l)<.01&&(u=t);if(u<0)continue;let d=+!a,f=e.out?u+3:u-3;for(;f>=0&&f<n.length&&Math.abs(n[f+d]-n[u+d])<Xf;)f+=e.out?3:-3;f<0||f>=n.length||(e.hint=n[f+d]-(a?i.x-i.w/2:i.y-i.h/2),s.push([a?e.px:e.py,e.hint]))}s.sort((e,t)=>e[0]-t[0]);for(let e=1;e<s.length;e++)s[e-1][1]>s[e][1]&&(n=!0)}if(n){let n=j>=0?j:rp(e,t,A),r=n>0?qf(e,t,o,O):void 0;r&&(k(),rp(e,t,A)>=n&&(O=Jf(r,e,t,o)))}}for(let n of g){let r=t[n],i=e[r.src],a=e[r.dst];r.route=[i.x,i.y,0,a.x,a.y,0],r.labelX=(i.x+a.x)/2,r.labelY=(i.y+a.y)/2}for(let n of h){let r=t[n],i=e[r.src];r.labelX=i.x+i.w/2+28+r.labelW/2,r.labelY=i.y}return O}function up(e,t){for(let n=0;n<t.length;n+=3){let r=Math.round(t[n+1]),i=e.get(r);i?i.push(t[n]):e.set(r,[t[n]])}}function dp(e,t,n,r){if(t===0)return e.x;let i=e.y-e.h/2,a=e.x-e.w/2,o=t/2,s=[a+r-6+o,e.x,a+e.w-r+6-o],c=n.get(Math.round(i));if(c===void 0)return s[0];let l=s[0],u=-1;for(let t of s){let n=1/0;for(let r of c)r>a&&r<a+e.w&&(n=Math.min(n,Math.abs(r-t)-o));if(n>=6)return t;n>u+.5&&(u=n,l=t)}return l}function fp(e,t,n,r){let i=t>0?r.get(Math.round(e.y-e.h/2)):void 0;if(i===void 0)return!1;let a=e.x-e.w/2;for(let r of i)if(r>a&&r<a+e.w&&Math.abs(r-n)<t/2+4)return!0;return!1}function pp(e,t,n,r,i,a,o,s){let c=1;for(let e=a[o].parent;e>=0&&c<8;e=a[e].parent)c++;let l=`color-mix(in srgb,var(--_a) ${X(100*(1-.5**c))}%,var(--_bg))`;return`<g class="pele-cluster-title" data-id="${i}">`+Z(e,t,n,` fill="none" stroke="${l}" stroke-width="5" stroke-linejoin="round"`,s)+Z(e,t,n,r,s)+`</g>`}var mp=8,hp=12,gp=.62,_p=6;function vp(){let e=new Map;return{add(t,n,r){let i=bp(r);n>=0&&i>0&&i+_p>(e.get(t*4+n)??0)&&e.set(t*4+n,i+_p)},of:(t,n)=>n>=0?e.get(t*4+n)??0:0}}function yp(e,t,n,r,i=n>0?n+_p:0,a=r>0?r+_p:0){let o=t===`linear`,s=t===`step`||t===`stepBefore`||t===`stepAfter`,c=[],l=[],u=[],d=(e,t,n,r)=>Math.abs(e-n)<.01&&Math.abs(t-r)<.01;for(let n=0;n<e.length;n+=3){let r=e[n],i=e[n+1],a=e[n+2],o=c.length-1;if(s&&o>=0&&Math.abs(r-c[o])>=.01&&Math.abs(i-l[o])>=.01){let e=c[o],n=l[o],s=t===`stepBefore`?n:t===`stepAfter`?i:(n+i)/2,f=t===`stepBefore`?e:t===`stepAfter`?r:(e+r)/2,p=a===0?[e,s,r,s]:[f,n,f,i];for(let t=0;t<4;t+=2)d(p[t],p[t+1],e,n)||d(p[t],p[t+1],r,i)||(c.push(p[t]),l.push(p[t+1]),u.push(a))}c.push(r),l.push(i),u.push(a)}let f=c.length-1,p=e=>Math.abs(c[e]-c[e-1])<.01||Math.abs(l[e]-l[e-1])<.01,m=e=>o||p(e),h=(e,t,n)=>{if(!m(Math.max(e,t)))return n===0?[0,Math.sign(l[t]-l[e])||1]:[Math.sign(c[t]-c[e])||1,0];let r=c[t]-c[e],i=l[t]-l[e],a=Math.hypot(r,i)||1;return[r/a,i/a]},[g,_]=h(0,1,u[1]),[v,y]=h(f-1,f,u[f]),b=c[0],x=l[0],S=c[f],C=l[f];c[0]+=g*n,l[0]+=_*n,c[f]-=v*r,l[f]-=y*r;let w=e=>Math.abs(c[e]-c[e-1])+Math.abs(l[e]-l[e-1]),T=e=>!o&&e>0&&e<f&&p(e)&&p(e+1)&&w(e)>=.01&&w(e+1)>=.01&&Math.abs(c[e]-c[e-1])<.01!=Math.abs(c[e+1]-c[e])<.01,E=(e,t,n)=>Math.abs(c[e]-c[e-1])*Math.abs(t)+Math.abs(l[e]-l[e-1])*Math.abs(n),D=(e,t,n)=>{let r=Math.min(Math.max(0,e-_p-t),n/4);return r+Math.min(e-t-r,(n-r)/4)},O=a>r&&(!m(f)||T(f-1))?D(a,r,E(f,v,y)):0,k=i>n&&(!m(1)||T(1))?D(i,n,E(1,g,_)):0;O>=1&&(c.splice(f,0,c[f]-v*O),l.splice(f,0,l[f]-y*O),u.splice(f,0,u[f]),f++),k>=1&&(c.splice(1,0,c[0]+g*k),l.splice(1,0,l[0]+_*k),u.splice(1,0,u[1]),f++);let A=[],j=e=>(A.push(Tp(e)),X(e));A.push(77,2);let M=`M${j(c[0])},${j(l[0])}`,N=c[0],P=l[0],F=(e,t)=>{d(e,t,N,P)||(A.push(76,2),M+=`L${j(e)},${j(t)}`,N=e,P=t)};for(let e=1;e<=f;e++){let t=c[e],n=l[e];if(!m(e)){let r=u[e]===0,i=r?n-P:t-N,a=Math.abs(i)*Af(r?t-N:n-P,i),o=r?0:Math.sign(i)*a,s=r?Math.sign(i)*a:0;A.push(67,6),M+=`C${j(N+o)},${j(P+s)} ${j(t-o)},${j(n-s)} ${j(t)},${j(n)}`,N=t,P=n;continue}if(!T(e)){if(e<f&&p(e)&&p(e+1)&&(t-c[e-1])*(c[e+1]-t)+(n-l[e-1])*(l[e+1]-n)>0)continue;F(t,n);continue}let r=T(e-1)?w(e)/2:w(e),i=T(e+1)?w(e+1)/2:w(e+1);s&&(r=i=Math.min(hp,r,i));let[a,o]=h(e-1,e,u[e]),[d,g]=h(e,e+1,u[e+1]);F(t-a*r,n-o*r),N=t+d*i,P=n+g*i,s?(A.push(81,4),M+=`Q${j(t)},${j(n)} ${j(N)},${j(P)}`):(A.push(67,6),M+=`C${j(t-a*r*(1-gp))},${j(n-o*r*(1-gp))} ${j(t+d*i*(1-gp))},${j(n+g*i*(1-gp))} ${j(N)},${j(P)}`)}return{d:M,tokens:A,sx:b,sy:x,sdx:-g,sdy:-_,ex:S,ey:C,edx:v,edy:y}}function bp(e){return e===`arrow_point`?mp-1:e===`arrow_circle`?mp:e===`arrow_cross`?4:0}function xp(e,t,n,r,i,a,o=`none`){let s=-i,c=r;if(e===`arrow_point`){let e=t-r*mp,l=n-i*mp,u=mp*.42;return`<path class="pele-marker" d="M${X(t)},${X(n)}L${X(e+s*u)},${X(l+c*u)}L${X(e-s*u)},${X(l-c*u)}Z" fill="${a}" stroke="${o}"/>`}if(e===`arrow_circle`)return`<circle class="pele-marker" cx="${X(t-r*4)}" cy="${X(n-i*4)}" r="3.5" fill="${a}" stroke="${o}"/>`;if(e===`arrow_cross`){let e=t-r*4,a=n-i*4,o=3.5,l=(r+s)*o,u=(i+c)*o,d=(r-s)*o,f=(i-c)*o;return`<path class="pele-marker" d="M${X(e-l)},${X(a-u)}L${X(e+l)},${X(a+u)}M${X(e-d)},${X(a-f)}L${X(e+d)},${X(a+f)}"/>`}return``}var Sp=Array.from({length:23},(e,t)=>+`1e${t}`);function Cp(e){return Ep(wp(e))}function wp(e){let t=[],n=-1;for(let r=0;r<e.length;){let i=e.charCodeAt(r);if(i>=65&&i<=90&&i!==69)n=t.length+1,t.push(i,0),r++;else if(i===45||i===46||i>=48&&i<=57){let a=i===45?r+1:r,o=0,s=-1;for(let t=e.charCodeAt(a);t>=48&&t<=57||t===46&&s<0;t=e.charCodeAt(++a))t===46?s=0:(o=o*10+t-48,s>=0&&s++);let c;if((e.charCodeAt(a)|32)==101||o>2**53-1||s>22){for(let t=e.charCodeAt(a);t===46||t===101||t===69||t>=48&&t<=57||(t===45||t===43)&&(e.charCodeAt(a-1)|32)==101;t=e.charCodeAt(++a));c=Number(e.slice(r,a))}else c=s>0?o/Sp[s]:o,i===45&&(c=-c);n>=0&&(t.push(c),t[n]++),r=a}else r++}return t}function Tp(e){let t=Math.round(e*100);return t===0?0:t/100}function Ep(e){let t=[],n=0,r=0;for(let i=0;i<e.length;){let a=e[i],o=e[i+1],s=i+2,c=s+o;if(i=c,a===72||a===86)for(let i=s;i<c;i++)a===72?n=e[i]:r=e[i],t.push(n,r);else if(a===67||a===81){let i=a===67,o=i?6:4;for(let a=s;a+o<=c;a+=o){let o=e[a],s=e[a+1],c=e[a+2],l=e[a+3],u=i?e[a+4]:c,d=i?e[a+5]:l;for(let e=.125;e<=1;e+=.125){let a=n+(o-n)*e,f=r+(s-r)*e,p=o+(c-o)*e,m=s+(l-s)*e;if(i){let t=c+(u-c)*e,n=l+(d-l)*e;a+=(p-a)*e,f+=(m-f)*e,p+=(t-p)*e,m+=(n-m)*e}t.push(a+(p-a)*e,f+(m-f)*e)}n=u,r=d}}else if(a===65)for(let i=s;i+7<=c;i+=7)Dp(t,n,r,e[i],e[i+1],e[i+3],e[i+4],e[i+5],e[i+6]),n=e[i+5],r=e[i+6];else for(let i=s;i+2<=c;i+=2)a===77&&i===s&&t.length>0&&t.push(NaN,NaN),n=e[i],r=e[i+1],t.push(n,r)}return t}function Dp(e,t,n,r,i,a,o,s,c){let l=(t-s)/2,u=(n-c)/2;if(r===0||i===0||l===0&&u===0){e.push(s,c);return}let d=Math.max(1,Math.sqrt(l*l/(r*r)+u*u/(i*i)));r*=d,i*=d;let f=(a===o?-1:1)*Math.sqrt(Math.max(0,(r*r*i*i-r*r*u*u-i*i*l*l)/(r*r*u*u+i*i*l*l))),p=f*r*u/i+(t+s)/2,m=-f*i*l/r+(n+c)/2,h=Math.atan2((n-m)/i,(t-p)/r),g=Math.atan2((c-m)/i,(s-p)/r)-h;o&&g<0?g+=2*Math.PI:!o&&g>0&&(g-=2*Math.PI);for(let t=1;t<=8;t++)e.push(p+r*Math.cos(h+g*t/8),m+i*Math.sin(h+g*t/8))}function Op(e,t,n,r,i,a,o,s){let c=0,l=1;for(let u=0;u<4;u++){let d=u===0?-n:u===1?n:u===2?-r:r,f=u===0?e-i:u===1?o-e:u===2?t-a:s-t;d===0?f<0&&(l=-1):d<0?c=Math.max(c,f/d):l=Math.min(l,f/d)}return c<l}function kp(e,t,n,r,i){for(let a=0;a+2<e.length;a+=2){let o=e[a],s=e[a+1],c=e[a+2],l=e[a+3];if(!(o<t&&c<t||o>r&&c>r||s<n&&l<n||s>i&&l>i)&&Op(o,s,c-o,l-s,t,n,r,i))return!0}return!1}function Ap(e,t,n,r){if(n.length===0)return;let i=r?Ep(r):Cp(e),a=1/0,o=1/0,s=-1/0,c=-1/0;for(let e=0;e<i.length+t.length;e+=2){let n=e<i.length?i[e]:t[e-i.length],r=e<i.length?i[e+1]:t[e+1-i.length];n<a&&(a=n),n>s&&(s=n),r<o&&(o=r),r>c&&(c=r)}let l,u=1/0;for(let e of n){let[n,r,d,f]=e.box;if(s<n+.5||a>d-.5||c<r+.5||o>f-.5)continue;let p=kp(i,n+.5,r+.5,d-.5,f-.5);for(let e=0;e<t.length&&!p;e+=2)p=t[e]>n+.5&&t[e]<d-.5&&t[e+1]>r+.5&&t[e+1]<f-.5;if(!p)continue;if(a<n||s>d||o<r||c>f)return``;let m=(d-n)*(f-r);m<u&&(u=m,l=e)}return l}function jp(e,t=``){return(/[";]stroke:/.test(t)?void 0:ul(e.shape))??``}function Mp(e,t){let n=/[";]fill:([^;"]*)/.exec(t.shape)?.[1].trim();return n?e.replace(/ fill="var\(--_bg\)"/g,` fill="${n}"`):e}function Np(e,t,n,r=``,i){let a=Ap(e,t,n,i);return a&&jp(a,r)}var Pp=4;function Fp(e,t,n=``,r=!1){let i=e=>n.includes(e)?RegExp(`[";]${e}:([^;"]+);`).exec(n)?.[1].trim():void 0,a=i(`stroke`);if(a===`none`||a===`transparent`)return``;let o=r?`2.5`:i(`stroke-width`),s=``,c=``;o!==void 0&&/^[\d.]+(?:px)?$/.test(o)?parseFloat(o)!==1&&(s=` stroke-width="${X(parseFloat(o)+Pp)}"`):o!==void 0&&(c+=`stroke-width:calc(${o} + ${Pp}px);`);for(let e of[`opacity`,`stroke-opacity`]){let t=i(e);t!==void 0&&(c+=`${e}:${t};`)}let l=`<path d="${e}"/>`+t.replace(/ class="pele-marker"/g,``);return s||c?`<g${s}${c?` style="${c}"`:``}>${l}</g>`:l}function Ip(e,t,n,r=``,i=!1){return Fp(e.d,xp(t,e.sx,e.sy,e.sdx,e.sdy,`var(--_bg)`,`var(--_bg)`)+xp(n,e.ex,e.ey,e.edx,e.edy,`var(--_bg)`,`var(--_bg)`),r,i)}function Lp(e){return e?`<g class="pele-casings" fill="none" stroke="var(--_bg)" stroke-width="${1+Pp}" stroke-linecap="round" stroke-linejoin="round" pointer-events="none">${e}</g>`:``}function Rp(e,t,n,r,i,a){let o=t.width+8,s=t.height;return`<g class="pele-edge-label" data-id="${Y(e)}"><rect x="${X(n-o/2)}" y="${X(r-s/2)}" width="${X(o)}" height="${X(s)}" rx="3" fill="var(--_bg)"/>`+Z(t,n,r,i,a)+`</g>`}function zp(e,t,n,r,i,a,o,s){let c=(i?t:n)/2,l=Math.min(c-4,8+r*6),u=a+r*8,d=Math.hypot(u,l)||1,f=(r,a)=>i?`${X(e.x+a)},${X(e.y+n/2+r)}`:`${X(e.x+t/2+r)},${X(e.y+a)}`,p=u/d*o,m=l/d*o;return i?(s.labelX=e.x,s.labelY=e.y+n/2+u+4+s.labelH/2):(s.labelX=e.x+t/2+u+4+s.labelW/2,s.labelY=e.y),{d:`M${f(0,-l)}C${f(u,-l*2)} ${f(u,l*2)} ${f(p,l+m)}`,sx:i?e.x-l:e.x+t/2,sy:i?e.y+n/2:e.y-l,sdx:i?0:-1,sdy:i?-1:0,ex:i?e.x+l:e.x+t/2,ey:i?e.y+n/2:e.y+l,edx:i?-l/d:-u/d,edy:i?-u/d:-l/d}}var Bp=`--_bg:var(--pele-bg,#fff);--_fg:var(--pele-fg,#1f1f1f);--_m:var(--pele-muted,#6e6e6e);--_l:var(--pele-line,#1f1f1f);--_s:var(--pele-surface,#f3f3f3);--_a:var(--pele-surface-alt,#e6e6e6);--_b:var(--pele-border,#8a8a8a);--_c:var(--pele-accent,#5b7bd5);color:var(--_fg)`,Vp=`var(--_fm)`,Hp=`var(--pele-radius,4px)`,Up=` style="rx:var(--_r)"`,Wp=/[";]fill:/,Gp=e=>Wp.test(e);function Kp(e){let t=e.indexOf(` style="`);return t<0?e+Up:`${e.slice(0,t+8)}rx:var(--_r);${e.slice(t+8)}`}var qp=`var(--pele-critical,#e45756)`,Jp=String.raw`(?:"[^"'\\\n<>{}();:@]*"|'[^"'\\\n<>{}();:@]*'|[\p{L}\p{N}_-][\p{L}\p{N}_ .-]*)`,Yp=new RegExp(String.raw`^\s*${Jp}(?:\s*,\s*${Jp})*\s*$`,`u`);function Xp(e,t){return e&&Yp.test(e)?e:t}function Zp(e,t,n){return`;--_fm:var(--pele-font-mono,${Xp(n,`monospace`)});font:${e}px sans-serif;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;font-family:var(--pele-font,${Xp(t,`sans-serif`)})`}var Qp=new Set([`fill`,`fill-opacity`,`stroke`,`stroke-width`,`stroke-dasharray`,`stroke-dashoffset`,`stroke-linecap`,`stroke-linejoin`,`stroke-opacity`,`opacity`,`rx`,`ry`]),$p=new Set([`color`,`font-size`,`font-family`,`font-weight`,`font-style`,`text-decoration`,`letter-spacing`,`word-spacing`,`opacity`]),em=/url\s*\(|expression\s*\(|javascript:|[<>{};\\]|@import|image-set|\/\*/i,tm={shape:``,line:``,text:``,stroke:void 0,bold:!1,italic:!1,fontSize:void 0};function nm(e){if(e.length===0)return tm;let t=new Map,n=new Map;for(let r of e){let e=r.indexOf(`:`);if(e<=0)continue;let i=r.slice(0,e).trim().toLowerCase(),a=r.slice(e+1).replace(/!important/gi,``).trim();a===``||em.test(a)||Tc.test(a)||(Qp.has(i)&&t.set(i,a),$p.has(i)&&n.set(i===`color`?`fill`:i,a))}if(t.size===0&&n.size===0)return tm;let r=``,i=``;for(let[e,n]of t)r+=`${e}:${n};`,e!==`fill`&&e!==`fill-opacity`&&(i+=`${e}:${n};`);let a=``;for(let[e,t]of n)a+=`${e}:${t};`;let o=n.get(`font-weight`),s=n.get(`font-size`),c=s&&/^[\d.]+(px)?$/.test(s)?parseFloat(s):void 0;return{shape:r?` style="${Ec(r)}"`:``,line:i?` style="${Ec(i)}"`:``,text:a?` style="${Ec(a)}"`:``,stroke:t.get(`stroke`),bold:o===`bold`||o===`bolder`||Number(o)>=600,italic:n.get(`font-style`)===`italic`,fontSize:c!==void 0&&c>0&&c<=200?c:void 0}}var rm=/[^\w-]+/g;function im(e){let t=e.replace(rm,` `).trim();return t===``?``:` `+t}var am=[`#4c78a8`,`#f58518`,`#54a24b`,`#e45756`,`#72b7b2`,`#eeca3b`,`#b279a2`,`#9d755d`];function om(e){let t=(e%8+8)%8;return`var(--pele-series-${t+1},${am[t]})`}var sm=[[`tw`,`title`],[`hw`,`heading`],[`w`,`bold`]],cm=/var\(--_(r|tw|hw|w)\)/g;function lm(e,t,n,r,i,a,o){let s=Ec(i.idPrefix??`pele`),c=``,l=``;a.accTitle&&(c+=`<title id="${s}-title">${Y(a.accTitle)}</title>`,l+=` aria-labelledby="${s}-title"`),a.accDescr&&(c+=`<desc id="${s}-desc">${Y(a.accDescr)}</desc>`,l+=` aria-describedby="${s}-desc"`);let u=i.responsive===!1?``:`max-width:100%;height:auto;`,d=new Set;for(let[,e]of o.matchAll(cm))if(d.add(e),d.size===4)break;let f=d.has(`r`)?`;--_r:${Hp}`:``;for(let[e,t]of sm)d.has(e)&&(f+=`;--_${e}:var(--pele-${t}-weight,bold)`);return`<svg xmlns="http://www.w3.org/2000/svg" class="pele pele-${e}" viewBox="0 0 ${t} ${n}" width="${t}" height="${n}" style="${u}${Bp}${f}${Ec(Zp(r,i.fontFamily,i.fontFamilyMono))}${Ol()}" fill="var(--_fg)" role="graphics-document document" aria-roledescription="${e}"${l}>`+c+o+`</svg>`}var um=18,dm=12,fm=12,pm=(e,t,n)=>(n?t:e)-2*fm,mm=e=>(t,n,r)=>r?0:t-2*e(n)-2*fm;function hm(e,t,n){let r=Math.min(1,Math.abs(e)/t);return n*(1-Math.sqrt(1-r*r))}var gm=(e,t,n,r)=>n&1?hm(r,t/2,e/2):hm(r,e/2,t/2),_m=(e,t,n)=>(n?t:e)*.6,vm=(e,t,n,r)=>n&1?0:hm(r,e/2,Math.min(12,Math.max(6,e/14))),ym=(e,t)=>()=>({w:e,h:t,dy:0});function bm(e,t,n){let r=Math.max(1.6*e+40,80),i=(t+10)/(1-(e+8)/r),a=i/2-10-t/2;return{w:r,h:i,dy:n?-a:a}}function xm(e,t){return`<path d="${e}"${t}/>`}var Sm=(e,t,n)=>n&1?t/8:0,Cm=(e,t)=>({w:Math.max(e+2*um,2*um+12),h:t+2*dm,dy:0});function wm(e,t){let n=``;for(let t=0;t<e.length;t+=2)n+=(t?` `:``)+X(e[t])+`,`+X(e[t+1]);return`<polygon points="${n}"${t}/>`}function Tm(e,t,n,r=``){return`<rect x="${X(-e/2)}" y="${X(-t/2)}" width="${X(e)}" height="${X(t)}"${r}${n}/>`}var Em={rect:{size:Cm,span:pm,draw:(e,t,n)=>Tm(e,t,Kp(n))},rounded:{size:Cm,span:pm,draw:(e,t,n)=>Tm(e,t,n,` rx="${X(Math.min(12,t/2))}"`)},stadium:{inset:(e,t,n,r)=>n&1?hm(r,t/2,t/2):0,span:(e,t,n)=>n?t*.6:e-t,size:(e,t)=>{let n=t+2*dm;return{w:e+n*.5+2*um-8,h:n,dy:0}},draw:(e,t,n)=>Tm(e,t,n,` rx="${X(t/2)}"`)},"fr-rect":{span:pm,size:(e,t)=>({w:e+2*um+16,h:t+2*dm,dy:0}),draw:(e,t,n,r)=>{let i=e/2-8;return Tm(e,t,Kp(n))+`<path d="M${X(-i)},${X(-t/2)}V${X(t/2)}M${X(i)},${X(-t/2)}V${X(t/2)}" fill="none"${r}/>`}},cyl:{inset:vm,span:(e,t,n)=>n?t-2*fm-12:e*.6,size:(e,t)=>{let n=Math.max(e+2*um,56),r=Math.min(12,Math.max(6,n/14));return{w:n,h:t+2*dm+2*r,dy:r/2}},draw:(e,t,n,r)=>{let i=e/2,a=Math.min(12,Math.max(6,e/14)),o=-t/2+a,s=t/2-a;return`<path d="M${X(-i)},${X(o)}A${X(i)},${X(a)} 0 0 1 ${X(i)},${X(o)}V${X(s)}A${X(i)},${X(a)} 0 0 1 ${X(-i)},${X(s)}Z"${n}/><path d="M${X(-i)},${X(o)}A${X(i)},${X(a)} 0 0 0 ${X(i)},${X(o)}" fill="none"${r}/>`}},circle:{inset:gm,span:_m,size:(e,t)=>{let n=Math.max(Math.sqrt(e*e+t*t)+16,44);return{w:n,h:n,dy:0}},draw:(e,t,n)=>`<circle r="${X(e/2)}"${n}/>`},"dbl-circ":{inset:gm,span:_m,size:(e,t)=>{let n=Math.max(Math.sqrt(e*e+t*t)+26,54);return{w:n,h:n,dy:0}},draw:(e,t,n,r)=>`<circle r="${X(e/2)}"${n}/><circle r="${X(e/2-5)}" fill="none"${r}/>`},ellipse:{inset:gm,span:_m,size:(e,t)=>({w:e*1.3+2*um,h:t*1.2+2*dm,dy:0}),draw:(e,t,n)=>`<ellipse rx="${X(e/2)}" ry="${X(t/2)}"${n}/>`},diam:{inset:(e,t,n,r)=>n&1?Math.abs(r)*e/t:Math.abs(r)*t/e,span:(e,t,n)=>(n?t:e)*.6,size:(e,t)=>{let n=e+16,r=t+8;return{w:n+1.6*r,h:n/1.6+r,dy:0}},draw:(e,t,n)=>wm([0,-t/2,e/2,0,0,t/2,-e/2,0],n)},hex:{inset:(e,t,n,r)=>n&1?Math.abs(r)/2:0,span:(e,t,n)=>n?t*.5:e-t/2-fm,size:(e,t)=>{let n=t+2*dm;return{w:e+2*um+n/2,h:n,dy:0}},draw:(e,t,n)=>{let r=t/4;return wm([-e/2+r,-t/2,e/2-r,-t/2,e/2,0,e/2-r,t/2,-e/2+r,t/2,-e/2,0],n)}},odd:{inset:(e,t,n)=>n===3?t/4:0,span:mm(()=>0),size:(e,t)=>{let n=t+2*dm;return{w:e+2*um+n/4,h:n,dy:0}},draw:(e,t,n)=>{let r=t/4;return wm([-e/2,-t/2,e/2,-t/2,e/2,t/2,-e/2,t/2,-e/2+r,0],n)}},"lean-r":{inset:Sm,span:mm(e=>e/4),size:(e,t)=>{let n=t+2*dm;return{w:e+2*um+n/2,h:n,dy:0}},draw:(e,t,n)=>{let r=t/4;return wm([-e/2+r,-t/2,e/2,-t/2,e/2-r,t/2,-e/2,t/2],n)}},"lean-l":{inset:Sm,span:mm(e=>e/4),size:(e,t)=>{let n=t+2*dm;return{w:e+2*um+n/2,h:n,dy:0}},draw:(e,t,n)=>{let r=t/4;return wm([-e/2,-t/2,e/2-r,-t/2,e/2,t/2,-e/2+r,t/2],n)}},"trap-b":{inset:Sm,span:mm(e=>e/4),size:(e,t)=>{let n=t+2*dm;return{w:e+2*um+n/2,h:n,dy:0}},draw:(e,t,n)=>{let r=t/4;return wm([-e/2+r,-t/2,e/2-r,-t/2,e/2,t/2,-e/2,t/2],n)}},"trap-t":{inset:Sm,span:mm(e=>e/4),size:(e,t)=>{let n=t+2*dm;return{w:e+2*um+n/2,h:n,dy:0}},draw:(e,t,n)=>{let r=t/4;return wm([-e/2,-t/2,e/2,-t/2,e/2-r,t/2,-e/2+r,t/2],n)}},text:{bare:!0,span:pm,size:(e,t)=>({w:e+8,h:t+8,dy:0}),draw:(e,t)=>Tm(e,t,` fill="none" stroke="none"`)},"sm-circ":{noLabel:!0,inset:gm,span:_m,size:ym(14,14),draw:(e,t,n)=>`<circle r="${X(e/2)}"${n}/>`},"f-circ":{noLabel:!0,inset:gm,span:_m,size:ym(14,14),draw:(e,t,n,r)=>`<circle r="${X(e/2)}" fill="var(--_l)"${r}/>`},"fr-circ":{noLabel:!0,inset:gm,span:_m,size:ym(18,18),draw:(e,t,n,r)=>`<circle r="${X(e/2)}"${n}/><circle r="${X(e/2-4)}" fill="var(--_l)"${r}/>`},fork:{noLabel:!0,span:(e,t,n)=>(n?t:e)-8,size:ym(72,8),draw:(e,t,n,r)=>Tm(e,t,` fill="var(--_l)"${r}`,` rx="2"`)},"notch-rect":{size:Cm,span:pm,draw:(e,t,n)=>wm([-e/2+10,-t/2,e/2,-t/2,e/2,t/2,-e/2,t/2,-e/2,-t/2+10],n)},"lin-rect":{span:pm,size:(e,t)=>({w:e+2*um+8,h:t+2*dm,dy:0}),draw:(e,t,n,r)=>Tm(e,t,Kp(n))+`<path d="M${X(-e/2+8)},${X(-t/2)}V${X(t/2)}" fill="none"${r}/>`},"div-rect":{span:pm,size:(e,t)=>({w:e+2*um,h:t+2*dm+8,dy:4}),draw:(e,t,n,r)=>Tm(e,t,Kp(n))+`<path d="M${X(-e/2)},${X(-t/2+8)}H${X(e/2)}" fill="none"${r}/>`},"win-pane":{span:pm,size:(e,t)=>({w:e+2*um+8,h:t+2*dm+8,dy:4}),draw:(e,t,n,r)=>Tm(e,t,Kp(n))+`<path d="M${X(-e/2+8)},${X(-t/2)}V${X(t/2)}M${X(-e/2)},${X(-t/2+8)}H${X(e/2)}" fill="none"${r}/>`},tri:{inset:(e,t,n)=>n&1?e/4:0,size:(e,t)=>bm(e,t,!1),draw:(e,t,n)=>wm([0,-t/2,e/2,t/2,-e/2,t/2],n)},"flip-tri":{inset:(e,t,n)=>n&1?e/4:0,size:(e,t)=>bm(e,t,!0),draw:(e,t,n)=>wm([-e/2,-t/2,e/2,-t/2,0,t/2],n)},"sl-rect":{inset:(e,t,n)=>n===0?5:0,size:(e,t)=>({w:e+2*um,h:t+2*dm+10,dy:5}),draw:(e,t,n)=>wm([-e/2,-t/2+10,e/2,-t/2,e/2,t/2,-e/2,t/2],n)},"notch-pent":{span:pm,size:(e,t)=>({w:e+2*um,h:t+2*dm,dy:0}),draw:(e,t,n)=>wm([-e/2+10,-t/2,e/2-10,-t/2,e/2,-t/2+10,e/2,t/2,-e/2,t/2,-e/2,-t/2+10],n)},hourglass:{noLabel:!0,inset:(e,t,n)=>n&1?e/2:0,size:ym(32,40),draw:(e,t,n)=>wm([-e/2,-t/2,e/2,-t/2,-e/2,t/2,e/2,t/2],n)},delay:{size:(e,t)=>{let n=t+2*dm;return{w:e+2*um+n/4,h:n,dy:0}},draw:(e,t,n)=>{let r=t/2;return`<path d="M${X(-e/2)},${X(-r)}H${X(e/2-r)}A${X(r)},${X(r)} 0 0 1 ${X(e/2-r)},${X(r)}H${X(-e/2)}Z"${n}/>`}},"h-cyl":{size:(e,t)=>{let n=t+2*dm,r=Math.min(12,n/4);return{w:e+2*um+2*r,h:n,dy:0}},draw:(e,t,n,r)=>{let i=t/2,a=Math.min(12,t/4),o=-e/2+a,s=e/2-a;return`<path d="M${X(o)},${X(-i)}H${X(s)}A${X(a)},${X(i)} 0 0 1 ${X(s)},${X(i)}H${X(o)}A${X(a)},${X(i)} 0 0 1 ${X(o)},${X(-i)}Z"${n}/><path d="M${X(s)},${X(-i)}A${X(a)},${X(i)} 0 0 0 ${X(s)},${X(i)}" fill="none"${r}/>`}},"cross-circ":{noLabel:!0,inset:gm,span:_m,size:ym(44,44),draw:(e,t,n,r)=>{let i=e/2,a=i*Math.SQRT1_2;return`<circle r="${X(i)}"${n}/><path d="M${X(-a)},${X(-a)}L${X(a)},${X(a)}M${X(a)},${X(-a)}L${X(-a)},${X(a)}" fill="none"${r}/>`}},"st-rect":{span:(e,t,n)=>(n?t:e)-2*fm-8,size:(e,t)=>({w:e+2*um+8,h:t+2*dm+8,dy:4}),draw:(e,t,n)=>{let r=e-8,i=t-8,a=``;for(let o=0;o<3;o++){let s=-e/2+(2-o)*4,c=-t/2+o*4;a+=`<rect x="${X(s)}" y="${X(c)}" width="${X(r)}" height="${X(i)}"${Kp(n)}/>`}return a}},doc:{inset:(e,t,n)=>n===2?10:0,size:(e,t)=>({w:e+2*um,h:t+2*dm+10,dy:-5}),draw:(e,t,n)=>Om(e,t,n)},flag:{inset:(e,t,n)=>n&1?0:8,size:(e,t)=>({w:e+2*um,h:t+2*dm+16,dy:0}),draw:(e,t,n)=>{let r=e/2,i=t/2-8,a=e/4;return`<path d="M${X(-r)},${X(-i)}q${X(a)},-10 ${X(2*a)},0t${X(2*a)},0V${X(i)}q${X(-a)},10 ${X(-2*a)},0t${X(-2*a)},0Z"${n}/>`}},datastore:{size:Cm,span:pm,draw:(e,t,n,r)=>Tm(e,t,n.replace(`stroke="var(--_b)"`,`stroke="none"`))+`<path d="M${X(-e/2)},${X(-t/2)}H${X(e/2)}M${X(-e/2)},${X(t/2)}H${X(e/2)}" fill="none"${r}/>`},folder:{size:(e,t)=>({w:Math.max(e+2*um,64),h:t+2*dm+8,dy:4}),draw:(e,t,n)=>{let r=e/2,i=t/2,a=Math.min(e*.4,48);return xm(`M${X(-r)},${X(-i)}H${X(-r+a)}L${X(-r+a+8)},${X(-i+8)}H${X(r)}V${X(i)}H${X(-r)}Z`,n)}},bucket:{size:(e,t)=>({w:e+2*um+20,h:t+2*dm+10,dy:3}),inset:(e,t,n)=>n&1?t/12:0,draw:(e,t,n,r)=>{let i=e/2,a=t/2,o=t/6;return xm(`M${X(-i)},${X(-a+5)}A${X(i)},${X(5)} 0 0 1 ${X(i)},${X(-a+5)}L${X(i-o)},${X(a-5)}A${X(i-o)},${X(5)} 0 0 1 ${X(-i+o)},${X(a-5)}Z`,n)+`<path d="M${X(-i)},${X(-a+5)}A${X(i)},${X(5)} 0 0 0 ${X(i)},${X(-a+5)}" fill="none"${r}/>`}},console:{span:pm,size:(e,t)=>({w:Math.max(e+2*um,72),h:t+2*dm+12,dy:6}),draw:(e,t,n,r)=>Tm(e,t,Kp(n))+`<path d="M${X(-e/2)},${X(-t/2+12)}H${X(e/2)}M${X(-e/2+7)},${X(-t/2+4)}l3,2.5l-3,2.5M${X(-e/2+13)},${X(-t/2+9)}h4" fill="none"${r}/>`},browser:{span:pm,size:(e,t)=>({w:Math.max(e+2*um,72),h:t+2*dm+12,dy:6}),draw:(e,t,n,r)=>{let i=``;for(let n=0;n<3;n++)i+=`<circle cx="${X(-e/2+8+n*7)}" cy="${X(-t/2+6)}" r="1.5" fill="none"${r}/>`;return Tm(e,t,Kp(n))+`<path d="M${X(-e/2)},${X(-t/2+12)}H${X(e/2)}" fill="none"${r}/>`+i}},person:{size:(e,t)=>({w:Math.max(e+2*um,56),h:t+2*dm+26,dy:13}),draw:(e,t,n)=>{let r=-t/2;return`<rect x="${X(-e/2)}" y="${X(r+26)}" width="${X(e)}" height="${X(t-26)}" rx="12"${n}/><circle cy="${X(r+14)}" r="13"${n}/>`}},bang:{size:(e,t)=>({w:e+2*um+28,h:t+2*dm+24,dy:0}),inset:()=>3,draw:(e,t,n)=>{let r=[];for(let n=0;n<28;n++){let i=Math.PI*n/14-Math.PI/2,a=n%2==0?1:.82;r.push(e/2*Math.cos(i)*a,t/2*Math.sin(i)*a)}return wm(r,n)}},cloud:{size:(e,t)=>({w:e+2*um+32,h:t+2*dm+24,dy:0}),inset:(e,t,n)=>n&1?2:1,draw:(e,t,n)=>{let r=e/2,i=t/2,a=i*.55;return xm(`M${X(-r+a)},${X(i)}A${X(a)},${X(a)} 0 0 1 ${X(-r+a*.6)},${X(-i*.1)}A${X(r*.42)},${X(i*.7)} 0 0 1 ${X(-r*.1)},${X(-i*.72)}A${X(r*.4)},${X(i*.62)} 0 0 1 ${X(r*.62)},${X(-i*.42)}A${X(a*1.05)},${X(a*1.05)} 0 0 1 ${X(r-a)},${X(i)}Z`,n)}},brace:{bare:!0,size:(e,t)=>({w:e+2*um+12,h:t+2*dm,dy:0}),draw:(e,t,n,r)=>Tm(e,t,` fill="none" stroke="none"`)+Dm(-e/2+12,t,-1,r)},"brace-r":{bare:!0,size:(e,t)=>({w:e+2*um+12,h:t+2*dm,dy:0}),draw:(e,t,n,r)=>Tm(e,t,` fill="none" stroke="none"`)+Dm(e/2-12,t,1,r)},braces:{bare:!0,size:(e,t)=>({w:e+2*um+24,h:t+2*dm,dy:0}),draw:(e,t,n,r)=>Tm(e,t,` fill="none" stroke="none"`)+Dm(-e/2+12,t,-1,r)+Dm(e/2-12,t,1,r)},bolt:{noLabel:!0,size:ym(36,56),inset:(e,t,n)=>n&1?e/4:0,draw:(e,t,n)=>wm([e*.15,-t/2,-e/2,t*.08,-e*.05,t*.08,-e*.15,t/2,e/2,-t*.08,e*.05,-t*.08],n)},"lin-cyl":{inset:vm,span:(e,t,n)=>n?t-2*fm-20:e*.6,size:(e,t)=>{let n=Math.max(e+2*um,56),r=Math.min(12,Math.max(6,n/14));return{w:n,h:t+2*dm+2*r+8,dy:r/2+4}},draw:(e,t,n,r)=>{let i=e/2,a=Math.min(12,Math.max(6,e/14)),o=-t/2+a,s=t/2-a,c=e=>`M${X(-i)},${X(e)}A${X(i)},${X(a)} 0 0 0 ${X(i)},${X(e)}`;return xm(`M${X(-i)},${X(o)}A${X(i)},${X(a)} 0 0 1 ${X(i)},${X(o)}V${X(s)}A${X(i)},${X(a)} 0 0 1 ${X(-i)},${X(s)}Z`,n)+`<path d="${c(o)}${c(o+8)}" fill="none"${r}/>`}},"curv-trap":{size:(e,t)=>{let n=t+2*dm;return{w:e+2*um+n*.6,h:n,dy:0}},draw:(e,t,n)=>{let r=e/2,i=t/2,a=t*.3;return xm(`M${X(-r+a)},${X(-i)}H${X(r-a)}A${X(a)},${X(i)} 0 0 1 ${X(r-a)},${X(i)}H${X(-r+a)}L${X(-r)},0Z`,n)}},docs:{size:(e,t)=>({w:e+2*um+8,h:t+2*dm+18,dy:-1}),inset:(e,t,n)=>n===2?10:0,draw:(e,t,n)=>{let r=``;for(let i=0;i<3;i++)r+=`<g transform="translate(${(1-i)*4},${(i-1)*4})">${Om(e-8,t-8,n)}</g>`;return r}},"bow-rect":{size:(e,t)=>{let n=t+2*dm;return{w:e+2*um+n*.4,h:n,dy:0}},inset:(e,t,n)=>n===1?t*.2:0,draw:(e,t,n)=>{let r=e/2,i=t/2,a=t*.2;return xm(`M${X(-r+a)},${X(-i)}H${X(r)}A${X(a)},${X(i)} 0 0 0 ${X(r)},${X(i)}H${X(-r+a)}A${X(a)},${X(i)} 0 0 1 ${X(-r+a)},${X(-i)}Z`,n)}},"tag-rect":{size:Cm,span:pm,draw:(e,t,n,r)=>Tm(e,t,Kp(n))+`<path d="M${X(e/2-12)},${X(t/2)}L${X(e/2)},${X(t/2-12)}" fill="none"${r}/>`},"tag-doc":{size:(e,t)=>({w:e+2*um,h:t+2*dm+10,dy:-5}),inset:(e,t,n)=>n===2?10:0,draw:(e,t,n,r)=>Om(e,t,n)+`<path d="M${X(e/2-12)},${X(t/2-14)}L${X(e/2)},${X(t/2-26)}" fill="none"${r}/>`},"lin-doc":{size:(e,t)=>({w:e+2*um+8,h:t+2*dm+10,dy:-5}),inset:(e,t,n)=>n===2?10:0,draw:(e,t,n,r)=>Om(e,t,n)+`<path d="M${X(-e/2+8)},${X(-t/2)}V${X(t/2-6)}" fill="none"${r}/>`},collapsedGroup:{size:(e,t)=>({w:e+2*um+8,h:t+2*dm+8,dy:-2}),draw:(e,t,n)=>`<rect x="${X(-e/2+6)}" y="${X(-t/2+8)}" width="${X(e-12)}" height="${X(t-8)}"${Kp(n)}/><rect x="${X(-e/2)}" y="${X(-t/2)}" width="${X(e)}" height="${X(t-4)}"${Kp(n)}/>`}};function Dm(e,t,n,r){let i=t/2,a=6*n;return`<path d="M${X(e)},${X(-i)}q${X(a)},0 ${X(a)},6V-6q0,6 ${X(a)},6q${X(-a)},0 ${X(-a)},6V${X(i-6)}q0,6 ${X(-a)},6" fill="none"${r}/>`}function Om(e,t,n){let r=e/2,i=-t/2,a=t/2-10,o=e/4;return`<path d="M${X(-r)},${X(i)}H${X(r)}V${X(a)}q${X(-o)},-12 ${X(-2*o)},0t${X(-2*o)},0Z"${n}/>`}var km=Em.rect,Am=new Map(Object.entries(Em));function jm(e,t,n){return(Am.get(e)??km).size(t,n)}function Mm(e,t,n,r,i){return(Am.get(e)??km).draw(t,n,r,i)}function Nm(e,t,n,r,i=0){return Am.get(e)?.inset?.(t,n,r,i)??0}function Pm(e,t,n,r){return Math.max(0,Am.get(e)?.span?.(t,n,r)??0)}function Fm(e){return Am.get(e)?.noLabel!==!0}function Im(e){return(Am.get(e)??km).bare!==!0}function Lm(e,t,n){let r=e[t]-n.x,i=e[t+1]-n.y;return Math.abs(Math.abs(i)-n.h/2)<.5?i<0?0:2:Math.abs(Math.abs(r)-n.w/2)<.5?r<0?3:1:-1}function Rm(e,t,n,r){if(r.isGroup)return;let i=Lm(e,t,r);if(i===0||i===2){let a=Nm(n.shape,n.w,n.h,i,e[t]-r.x)+(r.h-n.h)/2;e[t+1]+=i===0?a:-a}else if(i>=0){let a=Nm(n.shape,n.w,n.h,i,e[t+1]-r.y)+(r.w-n.w)/2;e[t]+=i===3?a:-a}}var zm=1.5,Bm=1.3,Vm=/<br\s*\/?>|\\n|\n/gi,Hm=/<\/?([a-zA-Z][\w-]*)(?:\s[^<>]*)?\/?>/y,Um=/(fa[bklrs]?):fa-([\w-]+)/g,Wm=/[<\\\n*_]|fa[bklrs]?:fa-/,Gm=new Map([[`b`,1],[`strong`,1],[`i`,2],[`em`,2],[`cite`,2],[`dfn`,2],[`var`,2],[`code`,4],[`kbd`,4],[`samp`,4],[`tt`,4],[`sub`,8],[`sup`,16],[`u`,32],[`ins`,32]]),Km=24,qm=new Set(`a abbr address article aside audio b bdi bdo big blockquote body br button caption center cite code col colgroup data dd del details dfn dialog div dl dt em embed fieldset figcaption figure font footer form h1 h2 h3 h4 h5 h6 head header hr html i iframe img input ins kbd label legend li link main map mark meta meter nav noscript object ol optgroup option output p picture pre progress q rp rt ruby s samp script section select small source span strike strong style sub summary sup table tbody td template textarea tfoot th thead time title tr track tt u ul var video wbr`.split(` `)),Jm=`\\u2e80-\\u9fff\\uf900-\\ufaff\\uff00-\\uff60`,Ym=`、。,.:;!?)]}」』】〕〉》〙〗ー…‥・ゝゞぁぃぅぇぉっゃゅょゎァィゥェォッャュョヮ,.:;!?)\\]}`,Xm=`([{「『【〔〈《〘〖([{`,Zm=RegExp(`[${Jm}]`),Qm=`\\u200b\\u00ad`,$m=RegExp(`[${Qm}]`),eh=RegExp(`\\s*(?:[${Xm}]*[${Jm}][${Ym}]*|[^\\s${Jm}${Qm}]+[${Qm}]*[${Ym}]*|[${Qm}]+)\\s*|\\s+`,`g`),th=57344,nh=6400,rh=/\$\$(.+?)\$\$/g,ih=/[\ue000-\uf8ff]/,ah=/([\ue000-\uf8ff])/,oh,sh={lines:[],widths:[],width:0,height:0,size:0,lineHeight:0};function ch(e){let t=e.split(`
|
|
75
|
+
`),n=1/0;for(let e of t){if(e.trim()===``)continue;let t=e.length-e.trimStart().length;t<n&&(n=t)}return n===1/0||n===0?e:t.map(e=>e.slice(Math.min(n,e.length-e.trimStart().length))).join(`
|
|
76
|
+
`)}function lh(e){return e!==void 0&&e.icon===void 0&&e.math===void 0}function uh(e,t,n){if(t!==``){if(oh!==void 0&&ih.test(t)){let r=oh,i=t.split(ah);for(let t=0;t<i.length;t++){if(t%2==0){i[t]!==``&&dh(e,i[t],n);continue}let a=i[t].charCodeAt(0)-th,o=r.math[a];o?e.push({text:``,style:n,math:o,width:o.width}):dh(e,`$$${r.tex[a]}$$`,n)}return}dh(e,t,n)}}function dh(e,t,n){let r=Xo(t),i=e[e.length-1];lh(i)&&i.style===n?i.text+=r:e.push({text:r,style:n,width:0})}function fh(e,t,n){if(!t.includes(`:fa-`)){uh(e,t,n);return}let r=0;Um.lastIndex=0;let i;for(;(i=Um.exec(t))!==null;){let a=`${i[1]}:fa-${i[2]}`;if(uh(e,t.slice(r,i.index),n),r=i.index+i[0].length,es(a)!==``)e.push({text:``,style:n,icon:a,width:0});else if(t[r]===` `)r++;else if(r===t.length){let t=e[e.length-1];lh(t)&&(t.text=t.text.trimEnd())}}uh(e,t.slice(r),n)}function ph(e,t,n,r,i){let a=i.style,o=0,s=``,c=0,l=t.length,u=()=>{fh(e,s,a|(i.shifts[i.shifts.length-1]??0)),s=``};for(;c<l;){let e=t[c];if(e===`<`){Hm.lastIndex=c;let e=Hm.exec(t);if(e&&e.index===c){let n=e[1].toLowerCase(),o=t[c+1]===`/`,s=Gm.get(n)??0;if(s&Km){u();let e=i.shifts.lastIndexOf(s);o?e!==-1&&i.shifts.splice(e,1):i.shifts.push(s)}else s&&(u(),i.style=o?i.style&~s|r&s:i.style|s,a=o?a&~s|r&s:a|s);if(s||qm.has(n)){c+=e[0].length;continue}}}else if(n&&(e===`*`||e===`_`)){let n=t[c+1]===e,i=n?1:2,s=n?2:1,d=(o&i)===0,f=c>0?t[c-1]:` `,p=c+s<l?t[c+s]:` `,m=d&&p.trim()!==``&&t.indexOf(n?e+e:e,c+s)!==-1,h=!d&&f.trim()!==``,g=e===`_`&&/\w/.test(f)&&/\w/.test(p);if((m||h)&&!g){u(),o=m?o|i:o&~i,a=m?a|i:a&~i|r&i,c+=s;continue}}s+=e,c++}u()}function mh(e,t,n){let r=0;for(let i of e)i.width=i.icon===void 0?i.math?i.math.width:t.width(i.text,n,i.style):n*1.25,r+=i.width;return r}function hh(e,t,n,r,i,a){let o=[],s=0,c=(e=!1)=>{let r=o[o.length-1];if(lh(r)){let i=r.text.trimEnd();if(e&&r.text.endsWith(``)&&(i=i.slice(0,-1)+`-`),i!==r.text){r.text=i;let e=t.width(i,n,r.style);s+=e-r.width,r.width=e}}i.push(o),a.push(s),o=[],s=0};for(let i of e){if(i.icon!==void 0||i.math){let e=i.math?i.math.width:n*1.25;s>0&&s+e>r&&c(),o.push({...i,width:e}),s+=e;continue}let a=i.text.match(eh)??[],l=i.text.includes(``),u=l?a.length:0,d=new Float64Array(u),f=new Float64Array(u+1);for(let r=u-1;r>=0;r--){let o=a[r].endsWith(``),s=a[r].trimEnd();d[r]=t.width(o?s.slice(0,-1):s,n,i.style),f[r]=o?r===u-1?i===e[e.length-1]?d[r]:1/0:d[r]+f[r+1]:d[r]}for(let e=0;e<a.length;e++){let u=a[e],p=l?d[e]:t.width(u.trimEnd(),n,i.style),m=!l||!u.endsWith(``)?s+p<=r:s+t.width(u.slice(0,-1)+`-`,n,i.style)<=r||s+f[e]<=r;s>0&&!m&&(c(u.trimStart()===u),u=u.trimStart());let h=o[o.length-1];if(lh(h)&&h.style===i.style){if(h.text+=u,p>0||u.trimEnd()!==u){let e=h.width;h.width=t.width(h.text,n,h.style),s+=h.width-e}}else{let e=t.width(u,n,i.style);o.push({text:u,style:i.style,width:e}),s+=e}}}(o.length>0||i.length===0)&&c()}function Q(e,t,n,r,i,a=0){if(e===void 0||e===``)return sh;let o=Math.round(r*zm);if(is()&&e.includes(`$$`)&&!ih.test(e)){let s={tex:[],math:[]},c=e.replace(rh,(e,t)=>s.tex.length===nh?e:(s.tex.push(t),String.fromCharCode(th+s.tex.length-1)));if(s.tex.length>0){for(let e of s.tex)s.math.push(os(Xo(e),r));return gh(c,t,n,r,i,a,o,s)}}if(!Wm.test(e)&&!e.includes(`&`)&&!e.includes(`fl`)){let t=e.trim(),s=n.width(t,r,a);if(s<=i||!(t.includes(` `)||Zm.test(t)||$m.test(t)))return{lines:[[{text:t,style:a,width:s}]],widths:[s],width:s,height:o,size:r,lineHeight:o};let c=[],l=[];hh([{text:t,style:a,width:s}],n,r,i,c,l);let u=0;for(let e of l)e>u&&(u=e);let d=c.length>1?Math.round(r*Bm):o;return{lines:c,widths:l,width:u,height:c.length*d,size:r,lineHeight:d}}return gh(e,t,n,r,i,a,o)}function gh(e,t,n,r,i,a,o,s){let c=oh;oh=s;try{let c=_h(e,t,n,r,i,a,o);return s?vh(c):c}finally{oh=c}}function _h(e,t,n,r,i,a,o){let s=t?ch(e.replace(/\r\n?/g,`
|
|
77
|
+
`)).trim():e.trim(),c=[],l=[],u=0,d={style:a,shifts:[]};for(let e of s.split(Vm)){let o=[];ph(o,e.trim(),t,a,d);let s=mh(o,n,r);s>i?hh(o,n,r,i,c,l):(c.push(o),l.push(s))}for(let e of l)e>u&&(u=e);let f=c.length>1?Math.round(r*Bm):o;return{lines:c,widths:l,width:u,height:c.length*f,size:r,lineHeight:f}}function vh(e){let t;for(let n=0;n<e.lines.length;n++){let r=e.lineHeight;for(let t of e.lines[n])t.math&&(r=Math.max(r,Math.ceil(t.math.height+e.size/4)));r!==e.lineHeight&&t===void 0&&(t=e.lines.map(()=>e.lineHeight)),t&&(t[n]=r)}if(t===void 0)return e.heights===void 0?e:{...e,heights:void 0,height:e.lines.length*e.lineHeight};let n=0;for(let e of t)n+=e;return{...e,heights:t,height:n}}function yh(e){for(let t of e)if(t.math)return!0;return!1}function bh(e,t){let n=e.heights;if(!n)return(t+.5)*e.lineHeight;let r=0;for(let e=0;e<t;e++)r+=n[e];return r+n[t]/2}function xh(e,t){let n=e.widths[t],r=e.heights?e.heights[t]:e.lineHeight,i={lines:[e.lines[t]],widths:[n],width:n,height:r,size:e.size,lineHeight:e.lineHeight};return r!==e.lineHeight&&(i.heights=[r]),i}function Sh(e,t,n,r){let i=r(t,!1),a=e.maxWidth;if(a===void 0||!(a>0)||i.width<=a)return i;let o=Math.min(n,t),s=t;i=r(s,!0);for(let e=0;e<3&&i.width>a&&s>o;e++)s=Math.max(o,s-(i.width-a)),i=r(s,!0);return i}function Ch(e){let t=e.maxWidth;return t!==void 0&&t>0?Math.max(80,t-2*(e.padding??8)):4e3}function wh(e,t,n,r=0){let i=e.maxWidth;return i===void 0||!(i>0)?t:Math.max(Math.min(n,t),Math.min(t,i-r))}var Th=640;function Eh(e,t){let n=t(!1),r=e.maxWidth;if(e.autoDirection===!1||r===void 0||!(r>0)||n.width<=r)return n;let i=e.directionBreakpoint;if(r>=(i!==void 0&&i>0?i:Th))return n;let a=t(!0);return a.width<n.width?a:n}function Dh(e){return e===`LR`||e===`RL`}function Oh(e,t){let n=t(!1),r=e.maxWidth;if(r===void 0||!(r>0)||n.width<=r)return n;let i=t(!0);return i.width<n.width?i:n}var kh=new Map([[`tool`,0],[`task`,1],[`decision`,2],[`input`,3],[`refdoc`,4],[`connector`,5],[`action`,6]]),Ah=kh.size,jh=e=>Math.max(1,e-Ah),Mh=(e,t)=>{let n=Ah+e%jh(t);return t>0?n%t:n};function Nh(e,t,n,r){let i=n.size;for(let a of e){if(a.isGroup||a.shape===`collapsedGroup`){a.colorIndex=Mh(n.get(a.id)??i++,r);continue}let e=t(a.id);e&&kh.has(e)&&(a.kind=e)}}function Ph(e,t,n){let r=[],i=[],a=e.subgraphs,o=t=>{let n=[];for(let r of t){let t=e.classes.get(r);t?.styles&&(n=[...n,...t.styles].map(e=>e.trim())),t?.textStyles&&(n=[...n,...t.textStyles].map(e=>e.trim()))}return n},s=new Set,c=new Map,l=new Set;for(let t of a){if(t.metadata?.view!==`collapsed`||s.has(t.id))continue;let n=[t.id];for(;n.length>0;){let r=e.subgraph(n.pop())?.nodes;if(r!==void 0)for(let e of r)e===t.id||s.has(e)||(s.add(e),c.set(e,t.id),l.has(e)||n.push(e))}l.add(t.id)}let u=new Map;for(let e of s){let t=[e],n=c.get(e);for(;;){let e=u.get(n),r=e??c.get(n);if(r===void 0||(e===void 0&&t.push(n),n=r,e!==void 0))break}for(let e of t)u.set(e,n)}let d=new Map;a.forEach((e,t)=>d.set(e.id,t));let f=new Map,p=(e,t,n)=>{let r=d.get(e);if(r===void 0||r<n)return!1;let i=t;for(let t=0;i!==void 0&&t<=a.length;t++){if(i===e)return!0;i=f.get(i)}return!1};for(let t=a.length-1;t>=0;t--){let n=a[t];if(!s.has(n.id))for(let r of n.nodes)p(r,n.id,t)?e.emitWarning(`CONTAINMENT_VIOLATION`,`Container "${n.id}" cannot contain "${r}" because "${r}" already contains it. The nesting that would close the loop is dropped.`,{nodeId:r}):f.set(r,n.id)}let m=new Map;for(let e=a.length-1;e>=0;e--){let t=a[e];if(s.has(t.id))continue;let n=t.metadata?.view===`collapsed`,i={id:t.id,label:t.title,labelType:t.labelType,parentId:f.get(t.id),cssStyles:[],cssCompiledStyles:o(t.classes),cssClasses:t.classes.join(` `),shape:n?`collapsedGroup`:`flowGroup`,dir:t.dir,isGroup:!n,metadata:n?{...t.metadata,containerType:t.type}:t.metadata};r.push(i),m.set(t.id,i)}for(let t of e.nodes.values()){if(s.has(t.id))continue;let n=m.get(t.id);if(n){n.cssStyles=t.styles,n.cssCompiledStyles=o(t.classes),n.cssClasses=t.classes.join(` `);continue}let i=Ju(t.type),a={id:t.id,label:t.text,labelType:t.labelType,parentId:f.get(t.id),cssStyles:t.styles,cssCompiledStyles:o([`default`,`node`,...t.classes]),cssClasses:`default `+t.classes.join(` `),dir:t.dir,link:t.link,linkTarget:t.linkTarget,tooltip:e.tooltips.get(t.id),metadata:t.metadata,isGroup:!1,shape:i===`square`||i===void 0?`squareRect`:i};r.push(a),m.set(t.id,a)}e.edges.forEach((t,r)=>{let a=u.get(t.start)??t.start,s=u.get(t.end)??t.end;if(a===s&&t.start!==t.end)return;let c=[...e.defaultEdgeStyle??[]];t.style&&c.push(...t.style);let l=t.type===`arrow_open`?`none`:t.type===`arrow_cross`||t.type===`arrow_point`?t.type:`arrow_point`;i.push({id:t.id||`L_${a}_${s}_${r}`,isUserDefinedId:t.isUserDefinedId,start:a,end:s,type:t.type??`normal`,label:t.text,labelType:t.labelType,thickness:t.stroke,pattern:t.stroke,minlen:t.length,classes:`edge-thickness-normal edge-pattern-solid flowchart-link`,arrowTypeStart:`none`,arrowTypeEnd:l,cssCompiledStyles:o(t.classes),style:c,animate:t.animate,animation:t.animation,curve:t.interpolate||e.defaultInterpolate||n,metadata:t.metadata})}),Xu(r,e);let h=new Map;for(let e of a){let t=f.get(e.id);if(t===void 0)continue;let n=h.get(t);n?n.push(e.id):h.set(t,[e.id])}let g=new Map;for(let e of a){if(f.get(e.id)!==void 0)continue;let t=[e.id];for(;t.length>0;){let e=t.pop();if(g.has(e))continue;g.set(e,g.size);let n=h.get(e);if(n)for(let e=n.length-1;e>=0;e--)t.push(n[e])}}return Nh(r,t=>{if(e.connectors.has(t))return`connector`;let n=e.nodes.get(t);return n?e.vertexKind(n):void 0},g,t),{nodes:r,edges:i}}var Fh=8,Ih=40,Lh=16,Rh=48,zh=20,Bh=26,Vh=14,Hh=`collapsed`,Uh={TB:2,RL:3,BT:0,LR:1},Wh=new WeakMap;function Gh(e,t){let n=Wh.get(e);if(n===void 0){let r=t.flowchart?.curve;n=Ph(e,Fh,typeof r==`string`?r:void 0),Wh.set(e,n)}return n}function Kh(e,t,n){let r=e.agentflow?.[t];return typeof r==`number`&&r>0?Math.min(r,2e3):n}function qh(e,t,n){let r=om(e);return` fill="${r}"${Gp(n.shape)?``:` fill-opacity="${t}"`} stroke="${r}"`}function Jh(e,t,n){return Dh(e.direction)?Eh(n,r=>Yh(e,t,n,r)):Yh(e,t,n,!1)}function Yh(e,t,n,r){let i=Gh(e,t),a=n.fontSize??16,o=Math.round(a*.875),s=n.measurer??bc(n.fontFamily,n.fontFamilyMono),c=Kh(t,`wrappingWidth`,120),l=Kh(t,`minNodeWidth`,120),u=n.padding??8,d=n.icons,f=new Map,p=[],m=[];i.nodes.forEach((e,t)=>f.set(e.id,t));for(let e of i.nodes){let t=nm(e.cssStyles.length>0?e.cssCompiledStyles.concat(e.cssStyles):e.cssCompiledStyles),n=+!!t.bold|(t.italic?2:0),r=e.labelType===`markdown`,i=t.fontSize??a,o,u;if(e.isGroup){let a=Q(e.label,r,s,i,4e3,n);o={node:e,style:t,label:a,shape:`group`,w:0,h:0,dy:0,loops:0},u=op(0,0),u.isGroup=!0,u.dir=e.dir?Vf(e.dir):void 0,u.padX=zh,u.padTop=a.height>0?a.height+16:zh,u.padBottom=zh,u.minW=a.width+2*zh-12}else if(e.shape===`collapsedGroup`){let a=Q(e.label,r,s,i,c,n),d=Math.max(a.width,l)+2*um,f=a.height+2*dm+Vh;o={node:e,style:t,label:a,shape:Hh,w:d,h:f,dy:-Vh/2,loops:0},u=op(d,f)}else{let a=Uu(e.shape),d=Q(e.label,r,s,i,c,n),f=jm(a,a===`diam`?d.width:Math.max(d.width,l),d.height);o={node:e,style:t,label:d,shape:a,w:f.w,h:f.h,dy:f.dy,loops:0},u=op(f.w,f.h)}u.seq=p.length,p.push(o),m.push(u)}i.nodes.forEach((e,t)=>{m[t].parent=e.parentId===void 0?-1:f.get(e.parentId)??-1}),ip(m,i.edges.map(e=>[f.get(e.start)??-1,f.get(e.end)??-1]));let h=r?`TB`:Vf(e.direction),g=e=>{let t;for(let n=m[e].parent,r=0;n>=0&&t===void 0&&r<1e4;n=m[n].parent,r++)t=m[n].dir;return t??h},_=e=>{let t=g(e);return t===`LR`||t===`RL`},v=new Int32Array(m.length).fill(-1);for(let e=0;e<m.length;e++){let t=[],n=e;for(;n>=0&&v[n]<0&&t.length<=m.length;)t.push(n),n=m[n].parent;let r=n>=0?v[n]+1:0;for(let e=t.length-1;e>=0;e--)v[t[e]]=r++}let y=(e,t)=>{let n=t;for(let r=v[t];r>v[e];r--)n=m[n].parent;return n===e&&t!==e},b=[],x=[],S=[],C=[];for(let e of i.edges){let t=f.get(e.start),n=f.get(e.end);if(t===void 0||n===void 0)continue;let r=Q(e.label,e.labelType===`markdown`,s,o,c);y(t,n)||y(n,t)?C.push({edge:e,label:r,src:t,dst:n}):(t===n&&(p[t].loops++,_(t)?m[t].h+=2*(Bh+(r.height>0?r.height+8:0)):m[t].w+=2*(Bh+(r.width>0?r.width+12:0))),S.push(e),x.push(r),b.push({src:t,dst:n,minlen:e.minlen??1,labelW:r.width>0?r.width+12:0,labelH:r.height>0?r.height+4:0,route:[],labelX:0,labelY:0}))}let w=lp(m,b,h,{nodeSep:Kh(t,`nodeSpacing`,Ih),edgeSep:Lh,rankSep:Kh(t,`rankSpacing`,Rh),portSep:20}),T=Q(e.title,!1,s,a,4e3,1),E=T.height>0?T.height+12:0,D=Math.max(w.width,T.width);ap(m,b,u+(D-w.width)/2,u+E);let O=Math.ceil(D+2*u),k=Math.ceil(w.height+E+2*u),A=[],j=[],M=[],N=[],P=C.length*m.length<2e6;for(let{edge:e,src:t,dst:n}of C){let r=y(n,t),i=r?n:t,a=r?t:n,o=m[i],s=m[a],c=Uh[o.dir??g(i)],l=r?c:c+2&3,u=e=>{let t=!(e&1),n=e===0||e===3?-1:1,i=t?s.x:s.x+n*s.w/2,a=t?s.y+n*s.h/2:s.y,c=t?s.x:o.x+n*o.w/2,l=t?o.y+n*o.h/2:s.y,u=+!t;return r?[i,a,u,c,l,u]:[c,l,u,i,a,u]},d=e=>{for(let t=0;t<m.length;t++){let n=m[t];if(t!==a&&!n.isGroup&&n.x+n.w/2>Math.min(e[0],e[3])-1&&n.x-n.w/2<Math.max(e[0],e[3])+1&&n.y+n.h/2>Math.min(e[1],e[4])-1&&n.y-n.h/2<Math.max(e[1],e[4])+1)return!0}return!1},f=u(l);if(P&&d(f))for(let e of[l+1&3,l+3&3,l+2&3]){let t=u(e);if(!d(t)){f=t;break}}N.push(f),M.push((f[0]+f[3])/2,(f[1]+f[4])/2);let h=f.slice();Rm(h,r?0:3,p[a],s),j.push(yp(h,`linear`,0,bp(e.arrowTypeEnd)))}let F=new Map,I=!1;for(let e of m)e.isGroup&&(I=!0);if(I){for(let e of b)up(F,e.route);for(let e of N)up(F,e)}let L=``,R=``,z=[];for(let e=0;e<p.length;e++){let t=p[e],r=m[e],i=t.node,a=r.x,o=r.y,s=im(i.cssClasses.replace(/^default\s?/,``)),c=Y(i.id);if(r.isGroup){fl(t.style.shape)&&z.push({box:[a-r.w/2,o-r.h/2,a+r.w/2,o+r.h/2],shape:t.style.shape});let e=dp(r,t.label.width,F,zh);L+=`<g class="pele-cluster pele-flow${s}" data-id="${c}"><rect x="${X(a-r.w/2)}" y="${X(o-r.h/2)}" width="${X(r.w)}" height="${X(r.h)}"${Kp(qh(i.colorIndex??kh.size,`0.06`,t.style)+t.style.shape)}/>`+Z(t.label,e,o-r.h/2+8+t.label.height/2,` class="pele-cluster-label"${pl(t.style,`var(--_m)`)}${t.style.text}`,d)+`</g>`;continue}let l=t.w,u=t.h,f=``,h;if(t.shape===Hh){let e=om(i.colorIndex??kh.size),n=u/2-Vh-2,r=n+(Vh+2)/2;h=`<rect x="${X(-l/2)}" y="${X(-u/2)}" width="${X(l)}" height="${X(u)}"${Kp(qh(i.colorIndex??kh.size,`0.06`,t.style)+t.style.shape)}/><path d="M${X(-l/2+10)},${X(n)}H${X(l/2-10)}" fill="none" stroke="${e}" stroke-dasharray="3 3"${t.style.line}/><path class="pele-collapsed-mark" d="${Xh(-9,r)}${Xh(0,r)}${Xh(9,r)}" fill="${e}" stroke="none"/>`}else{let e=kh.get(i.kind??`task`)??1;f=` pele-kind-${i.kind??`task`}`,h=Mm(t.shape,l,u,qh(e,`0.14`,t.style)+t.style.shape,` stroke="${om(e)}"`+t.style.line)}let g=t.shape===Hh||Im(t.shape)?pl(t.style):``,_=Z(t.label,0,t.dy,` class="pele-label"${g}${t.style.text}`,d);if(/ internal-link(?: |$)/.test(s+` `)&&i.label&&n.links!==!1){let e=Xo(i.label),t=Fu(e,n),r=Ec(e);_=`<a class="internal-link"${t?` href="${r}"${Lu(n)}`:``} data-href="${r}">${_}</a>`,A.push({id:i.id,href:e,internal:!0})}let v=h+_;i.tooltip&&(v=`<title>${Y(i.tooltip)}</title>`+v),i.link&&(v=Iu(v,i.link,i.id,A,n,i.linkTarget?` target="${Ec(i.linkTarget)}"`:``)),R+=`<g class="pele-node pele-shape-${t.shape}${f}${s}" data-id="${c}" transform="translate(${X(a)},${X(o)})">${v}</g>`}let B=``,V=``,H=``,U=(e,t,n,r,i)=>{let a=e.style.length>0||e.cssCompiledStyles.length>0?nm(e.cssCompiledStyles.concat(e.style)):void 0,o=e.arrowTypeEnd,s=Np(n.d,[n.ex,n.ey],z,a?.line,n.tokens),c=s||(a?.stroke?Ec(a.stroke):`var(--_l)`),l=e.thickness===`dotted`?`reference`:o===`arrow_cross`?`failure`:`sequence`,u=im(e.classes.replace(/edge-thickness-normal|edge-pattern-solid|flowchart-link/g,``));s===``&&(B+=Ip(n,`none`,o,a?.line)),V+=`<g class="pele-edge pele-edge-${l}${u}" data-id="${Y(e.id)}"${s?` stroke="${s}"`:``}${a?.line??``}><path d="${n.d}"${e.thickness===`dotted`?` stroke-dasharray="3 4"`:``}/>`+xp(o,n.ex,n.ey,n.edx,n.edy,c)+`</g>`,t.width>0&&(H+=Rp(e.id,t,r,i,a?.text??``,d))},ee=new Map;for(let e=0;e<b.length;e++){let t=b[e],n=S[e],r=x[e],i=n.arrowTypeEnd,a;if(t.src===t.dst){let e=p[t.src],n=ee.get(t.src)??0;ee.set(t.src,n+1),a=zp(m[t.src],e.w,e.h,n,_(t.src),Bh,bp(i),t)}else{let e=t.route.slice();Rm(e,0,p[t.src],m[t.src]),Rm(e,e.length-3,p[t.dst],m[t.dst]),a=yp(e,n.curve,0,bp(i))}U(n,r,a,t.labelX,t.labelY)}return C.forEach((e,t)=>U(e.edge,e.label,j[t],M[2*t],M[2*t+1])),{svg:lm(`agentflow`,O,k,a,n,e,Z(T,O/2,u+T.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(L?`<g class="pele-clusters">${L}</g>`:``)+Lp(B)+(V?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${V}</g>`:``)+(H?`<g class="pele-edge-labels" font-size="${o}">${H}</g>`:``)+`<g class="pele-nodes">${R}</g>`),width:O,height:k,links:A}}function Xh(e,t){return`M${X(e-1.75)},${X(t)}a1.75,1.75 0 1 0 3.5,0a1.75,1.75 0 1 0 -3.5,0Z`}var Zh={type:`agentflow`,keepComments:!0,parse(e,t,n,r,i){let a=new dd({inheritDir:(t.flowchart??{}).inheritDir===!0,direction:typeof t.direction==`string`?t.direction:void 0,lineOffset:r,source:e,maxEdges:i.maxEdges});return n&&(a.title=n),Hd(e,a),Gh(a,t),a},render:Jh};function Qh(e){throw new jo(e,`semantic`,{type:`architecture`})}var $h=class{type=`architecture`;title;accTitle;accDescr;nodes=new Map;groups=new Map;edges=[];layoutHints=[];registered=new Map;register(e,t,n){this.registered.has(t)&&Qh(`The ${e} id [${t}] is already in use by another ${this.registered.get(t)}`),n!==void 0&&(t===n&&Qh(`The ${e} [${t}] cannot be placed within itself`),this.registered.has(n)||Qh(`The ${e} [${t}]'s parent does not exist. Please make sure the parent is created before this ${e}`),this.registered.get(n)===`node`&&Qh(`The ${e} [${t}]'s parent is not a group`)),this.registered.set(t,e===`group`?`group`:`node`)}addService({id:e,icon:t,iconText:n,title:r,in:i}){this.register(`service`,e,i),this.nodes.set(e,{id:e,type:`service`,icon:t,iconText:n,title:r,in:i})}addJunction({id:e,in:t}){this.register(`junction`,e,t),this.nodes.set(e,{id:e,type:`junction`,in:t})}addGroup({id:e,icon:t,title:n,in:r}){this.register(`group`,e,r),this.groups.set(e,{id:e,icon:t,title:n,in:r})}addEdge({lhsId:e,rhsId:t,lhsDir:n,rhsDir:r,lhsInto:i,rhsInto:a,lhsGroup:o,rhsGroup:s,title:c}){let l=[[`left`,e,o],[`right`,t,s]];for(let[e,t]of l)this.registered.has(t)||Qh(`The ${e}-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);for(let[e,t]of l)this.nodes.has(t)||Qh(`The ${e}-hand id [${t}] is a group. Add {group} to a service inside it instead.`);let u=this.nodes.get(e).in;if(u!==void 0&&u===this.nodes.get(t).in)for(let[e,t,n]of l)n&&Qh(`The ${e}-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);this.edges.push({lhsId:e,lhsDir:n,lhsInto:i,lhsGroup:o,rhsId:t,rhsDir:r,rhsInto:a,rhsGroup:s,title:c})}addLayoutHint(e){e.members.length<2&&Qh(`An align directive requires at least two members; got ${e.members.length}`);let t=new Set;for(let n of e.members)this.registered.get(n)!==`node`&&Qh(`align ${e.direction} references [${n}], which is not a service or junction`),t.has(n)&&Qh(`align ${e.direction} lists [${n}] more than once`),t.add(n);this.layoutHints.push(e)}};function eg(e,t){e.accDescr&&(t.accDescr=e.accDescr.replace(/\n\s+/g,`
|
|
78
|
+
`)),e.accTitle&&(t.accTitle=e.accTitle.replace(/^\s+/g,``)),e.title&&(t.title=e.title);for(let n of e.groups)t.addGroup(n);for(let n of e.services)t.addService(n);for(let n of e.junctions)t.addJunction(n);for(let n of e.edges)t.addEdge(n);for(let n of e.alignments)t.addLayoutHint({direction:n.direction,members:[...n.members]})}var tg=new WeakMap;function ng(e){let t=e.map((e,t)=>t),n=[];for(let r=0;r<128;r++){let i=String.fromCharCode(r);n.push(t.filter(t=>{let{pattern:n,first:r}=e[t];return typeof n==`string`?n[0]===i:r===void 0||r.includes(i)}))}let r={starting:n,every:t,longer:e.map(t=>t.longer?.map(t=>e.indexOf(t)))};return tg.set(e,r),r}function rg(e,t,n){let r=[],i=[],a=[],o=new Uint8Array(t.length),{starting:s,every:c,longer:l}=tg.get(t)??ng(t),u=[],d=e.length,f=(n,i)=>{if(o[n])return-1;let a=t[n];if(a.match!==void 0)return a.match(e,i,r[r.length-1]??-1);if(a.scanner!==void 0)return(u[n]??=a.scanner())(e,i,r[r.length-1]??-1);let s=a.pattern;return typeof s==`string`?e.startsWith(s,i)?i+s.length:-1:(s.lastIndex=i,s.test(e)?s.lastIndex:(a.opener!==void 0&&(a.opener.lastIndex=i,a.opener.test(e)&&(o[n]=1)),-1))},p=0;e:for(;p<d;){let o=e.charCodeAt(p);for(let e of o<128?s[o]:c){let n=f(e,p);if(n<=p)continue;let o=e,s=l[e];if(s!==void 0)for(let e of s){let t=f(e,p);if(t>n){o=e,n=t;break}}t[o].hidden||(r.push(o),i.push(p),a.push(n)),p=n;continue e}throw zo(n,e,p,``,!0)}return r.push(-1),i.push(d),a.push(d),{kinds:r,starts:i,ends:a,src:e}}var ig={name:`ACC_DESCR`,pattern:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/y,first:` a`},ag={name:`ACC_TITLE`,pattern:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/y,first:` a`},og={name:`TITLE`,pattern:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/y,first:` t`};function sg(e){return{...og,pattern:new RegExp(String.raw`[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|(?!${e}))`,`y`)}}var cg={name:`STRING`,pattern:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/y,first:`"'`},lg={name:`NEWLINE`,pattern:/\r?\n/y,first:`\r
|
|
79
|
+
`},ug={name:`WHITESPACE`,pattern:/[\t ]+/y,hidden:!0,first:` `},dg={name:`YAML`,pattern:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/y,hidden:!0,opener:/---[\t ]*\r?\n/y,first:`-`},fg={name:`DIRECTIVE`,pattern:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/y,hidden:!0,opener:/[\t ]*%%{/y,first:` %`},pg={name:`SINGLE_LINE_COMMENT`,pattern:/[\t ]*%%[^\n\r]*/y,first:` %`,hidden:!0};function mg(e){return{name:e,pattern:RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)+`(?:(?=%%)|(?!\\S))`,`y`),first:e[0]}}var hg=/accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/,gg=/accTitle[\t ]*:([^\n\r]*)/,_g=/title([\t ][^\n\r]*|)/;function vg(e){return e.trim().replace(/[\t ]{2,}/gm,` `)}function yg(e){return vg(_g.exec(e)[1])}function bg(e){return vg(gg.exec(e)[1])}function xg(e){let t=hg.exec(e);return t[1]===void 0?t[2].replace(/^\s*/gm,``).replace(/\s+$/gm,``).replace(/[\t ]{2,}/gm,` `).replace(/[\n\r]{2,}/gm,`
|
|
80
|
+
`):vg(t[1])}var Sg=new Map([[`b`,`\b`],[`f`,`\f`],[`n`,`
|
|
81
|
+
`],[`r`,`\r`],[`t`,` `],[`v`,`\v`],[`0`,`\0`]]);function Cg(e){if(!e.includes(`\\`))return e.slice(1,-1);let t=``;for(let n=1;n<e.length-1;n++){let r=e[n];if(r===`\\`){let r=e[++n];t+=Sg.get(r)??r}else t+=r}return t}var wg=class{constructor(e,t,n){this.tokens=e,this.types=t,this.diagram=n,this.kinds=e.kinds}tokens;types;diagram;i=0;kinds;get kind(){return this.kinds[this.i]}text(e=this.i){return this.tokens.src.slice(this.tokens.starts[e],this.tokens.ends[e])}take(){return this.text(this.i++)}accept(e){return this.kinds[this.i]===e&&(this.i++,!0)}expect(e){return this.kinds[this.i]!==e&&this.fail(`token of type '${this.types[e].name}'`),this.take()}fail(e){let t=this.kind===-1?`end of input`:`\`${this.text()}\``,{src:n,starts:r,ends:i}=this.tokens,a=r[this.i];if(this.kind===-1){let e=this.i;for(;e>0&&n.slice(r[e-1],i[e-1]).trim()===``;)e--;e>0&&(a=i[e-1])}throw zo(this.diagram,n,a,`Expecting ${e} but found ${t}.`)}},Tg={name:`ID`,pattern:/[\w]([-\w]*\w)?/y};function Eg(e){return{name:e,pattern:e,longer:[Tg]}}var Dg=[Eg(`architecture-beta`),Eg(`junction`),Eg(`service`),Eg(`column`),Eg(`group`),Eg(`align`),Eg(`row`),{name:`--`,pattern:`--`,longer:[dg]},Eg(`in`),{name:`:`,pattern:`:`},{name:`-`,pattern:`-`,longer:[dg]},{name:`ARROW_DIRECTION`,pattern:/L|R|T|B/y},{name:`ARROW_GROUP`,pattern:/\{group\}/y},{name:`ARROW_INTO`,pattern:/<|>/y},ig,ag,sg(String.raw`[-\w]*\w`),cg,Tg,lg,ug,dg,fg,pg,{name:`ARCH_ICON`,pattern:/\([\w-:]+\)/y},{name:`ARCH_TITLE`,pattern:/\[(?:"([^"\\]|\\.)*"|'([^'\\]|\\.)*'|[^\[\]\r\n]+)\]/y}];function Og(e){let t=e.slice(1,-1).trim();return(t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`))&&(t=t.slice(1,-1).replace(/\\"/g,`"`).replace(/\\'/g,`'`)),t.trim()}function kg(e){let t=new wg(rg(e,Dg,`architecture`),Dg,`architecture`),n={$type:`Architecture`,groups:[],services:[],junctions:[],edges:[],alignments:[]},r=e=>t.kinds[t.i]===e,i=()=>{if(t.kind!==-1)for(t.kind!==19&&t.fail(`a line break or the end of input`);t.kind===19;)t.i++};for(;t.kind===19;)t.i++;for(t.expect(0);t.kind!==-1;){switch(t.kind){case 19:t.i++;continue;case 14:n.accDescr=xg(t.take());break;case 15:n.accTitle=bg(t.take());break;case 16:n.title=yg(t.take());break;case 4:{t.i++;let e={$type:`Group`,id:t.expect(18)};r(24)&&(e.icon=t.take().slice(1,-1)),r(25)&&(e.title=Og(t.take())),t.accept(8)&&(e.in=t.expect(18)),n.groups.push(e);break}case 2:{t.i++;let e={$type:`Service`,id:t.expect(18)};r(17)?e.iconText=Cg(t.take()):r(24)&&(e.icon=t.take().slice(1,-1)),r(25)&&(e.title=Og(t.take())),t.accept(8)&&(e.in=t.expect(18)),n.services.push(e);break}case 1:{t.i++;let e={$type:`Junction`,id:t.expect(18)};t.accept(8)&&(e.in=t.expect(18)),n.junctions.push(e);break}case 18:{let e=t.take(),i=t.accept(12);t.expect(9);let a=t.expect(11),o=t.accept(13),s;t.accept(7)||(r(10)||t.fail(`'--' or '-'`),t.i++,s=Og(t.expect(25)),t.expect(10));let c=t.accept(13),l=t.expect(11);t.expect(9);let u=t.expect(18),d=t.accept(12);n.edges.push({$type:`Edge`,lhsId:e,lhsGroup:i,lhsDir:a,lhsInto:o,title:s,rhsInto:c,rhsDir:l,rhsId:u,rhsGroup:d});break}case 5:{t.i++,!r(6)&&!r(3)&&t.fail(`'row' or 'column'`);let e=t.take(),i=[t.expect(18),t.expect(18)];for(;r(18);)i.push(t.take());n.alignments.push({$type:`Alignment`,direction:e,members:i});break}default:t.fail(`a group, a service, a junction, an edge, an alignment, a title, or a line break`)}i()}return n}var Ag=new Map([[`database`,`M4 6a8 3 0 1 0 16 0a8 3 0 1 0-16 0M4 6v12a8 3 0 0 0 16 0V6M4 12a8 3 0 0 0 16 0`],[`server`,`M3 4h18v7H3zM3 13h18v7H3zM7 7.5h.01M7 16.5h.01M11 7.5h6M11 16.5h6`],[`disk`,`M5 3h14v18H5zM12 6.5a4 4 0 1 0 0 8a4 4 0 1 0 0-8M12 10.5h.01M8 18h3`],[`internet`,`M3 12a9 9 0 1 0 18 0a9 9 0 1 0-18 0M3 12h18M12 3a13 13 0 0 0 0 18M12 3a13 13 0 0 1 0 18`],[`cloud`,`M7 18a4 4 0 0 1-.5-7.97A6 6 0 0 1 18 9.5a4.25 4.25 0 0 1-.5 8.5z`]]);function jg(e){let t=Ag.get(e);return t===void 0?``:`<path d="${t}" stroke="var(--_fg)" stroke-width="1.5"/>`}var Mg=[-1,1,0,0],Ng=[0,0,-1,1];function Pg(e){return e===`L`?0:e===`R`?1:e===`T`?2:3}var Fg=64,Ig=2**25,Lg=2**26;function Rg(e,t,n,r){let i=e.length,a=t.length,o=a,s=new Map,c=new Map,l=new Int32Array(i+a).fill(o),u=new Int32Array(a+1),d=[];for(let e=0;e<=a;e++)d.push([]);t.forEach((e,t)=>{c.set(e.id,t);let n=e.in===void 0?void 0:c.get(e.in);n!==void 0&&n!==t?(l[i+t]=n,u[t]=u[n]+1):u[t]=1}),e.forEach((e,t)=>{s.set(e.id,t);let n=e.in===void 0?void 0:c.get(e.in);n!==void 0&&(l[t]=n),d[l[t]].push(t)});for(let e=0;e<a;e++)d[l[i+e]].push(i+e);let f=[],p=[],m=[],h=[],g=[],_=[],v=Array(i+a),y=Array(i+a),b=(e,t,n,r,a)=>{if(e===t)return;let o=e,s=t,c=l[e],d=l[t];for(;c!==d;)u[c]>=u[d]?(o=i+c,c=l[o]):(s=i+d,d=l[s]);let v=f.length;f.push(e),p.push(t),m.push(n),h.push(r),g.push(o),_.push(s),(a[o]??=[]).push(v),(a[s]??=[]).push(v)};for(let e of r){let t=e.direction===`row`;for(let n=1;n<e.members.length;n++){let r=s.get(e.members[n-1]),i=s.get(e.members[n]);r!==void 0&&i!==void 0&&b(r,i,t?1:3,t?0:2,v)}}for(let e of[!1,!0])for(let t of n){if(t.lhsDir===t.rhsDir!==e)continue;let n=s.get(t.lhsId),r=s.get(t.rhsId);n!==void 0&&r!==void 0&&b(n,r,Pg(t.lhsDir),Pg(t.rhsDir),y)}let x=new Int32Array(i+a),S=new Int32Array(i+a),C=new Int32Array(i+a).fill(1),w=new Int32Array(i+a).fill(1),T=new Uint8Array(i+a),E=[],D=new Map,O=[],k=new Map,A=0,j=0,M=0,N=(e,t)=>{j=0,M=0;for(let n=e;n!==t;n=i+l[n])j+=x[n],M+=S[n]},P=(e,t,n)=>{if(x[e]=t,S[e]=n,T[e]=1,E.push(e),C[e]*w[e]>Fg)O.push(e);else for(let r=n;r<n+w[e];r++)for(let n=t;n<t+C[e];n++)D.set((n+Ig)*Lg+r+Ig,e)},F=(e,t,n,r,i)=>x[e]<t+r&&t<x[e]+C[e]&&S[e]<n+i&&n<S[e]+w[e],I=(e,t,n,r)=>{if(n*r>Fg){for(let i=A;i<E.length;i++)if(F(E[i],e,t,n,r))return E[i];return-1}for(let i=t;i<t+r;i++)for(let t=e;t<e+n;t++){let e=D.get((t+Ig)*Lg+i+Ig);if(e!==void 0)return e}for(let i of O)if(F(i,e,t,n,r))return i;return-1},L=(e,t,n,r,i,a)=>{let o=`${e},${t},${n},${r},${i},${a}`,s=k.get(o)??0;for(;;){let o=I(e+s*i,t+s*a,n,r);if(o<0)break;s=i>0?x[o]+C[o]-e:i<0?e+n-x[o]:a>0?S[o]+w[o]-t:t+r-S[o]}return k.set(o,s),s},R=(e,t)=>{let n=g[t]===e,r=n?_[t]:g[t];if(T[r])return;let i=n?m[t]:h[t],a=n?h[t]:m[t];N(n?f[t]:p[t],e);let o=j,s=M;N(n?p[t]:f[t],r);let c=Mg[i],l=Ng[i],u=0,d=0,v=Mg[i]+Mg[a]===0&&Ng[i]+Ng[a]===0;i===a?(c=+(Mg[i]===0),l=1-c):v||(u=-Mg[a],d=-Ng[a]);let b,E;if(c===0?(E=l>0?S[e]+w[e]:S[e]-w[r],b=x[e]+o+u-j):(b=c>0?x[e]+C[e]:x[e]-C[r],E=S[e]+s+d-M),v){let e=y[r];if(e!==void 0&&e.length>1){let t=[];for(let n of e){let e=_[n]===r,o=e?g[n]:_[n];if(!T[o]||(e?m[n]:h[n])!==i||(e?h[n]:m[n])!==a)continue;N(e?f[n]:p[n],o);let s=c===0?x[o]+j:S[o]+M;N(e?p[n]:f[n],r),t.push(s-(c===0?j:M))}t.length>1&&(t.sort((e,t)=>e-t),c===0?b=t[t.length-1>>1]:E=t[t.length-1>>1])}let t=+(c===0),n=1-t,o=L(b,E,C[r],w[r],t,n),s=o===0?0:L(b,E,C[r],w[r],-t,-n),l=o<=s?o:-s;b+=t*l,E+=n*l}else{let e=L(b,E,C[r],w[r],c,l);b+=c*e,E+=l*e}P(r,b,E)},z=e=>{let t=d[e];if(t.length===0)return;E.length=0;let n=[];for(let e of t){if(T[e])continue;A=E.length,n.push(A),D.clear(),O.length=0,k.clear(),P(e,0,0);let t=A,r=A,i=0;for(;;){if(t<E.length){let e=E[t++],n=v[e];if(n!==void 0)for(let t of n)R(e,t);continue}if(r>=E.length)break;let e=y[E[r]];e===void 0||i>=e.length?(r++,i=0):R(E[r],e[i++])}}n.push(E.length);let r=n.length-1,o=Array(r),s=Array(r),c=Array(r),l=Array(r),u=0,f=0;for(let e=0;e<r;e++){let t=1/0,r=1/0,i=-1/0,a=-1/0;for(let o=n[e];o<n[e+1];o++){let e=E[o];t=Math.min(t,x[e]),r=Math.min(r,S[e]),i=Math.max(i,x[e]+C[e]),a=Math.max(a,S[e]+w[e])}o[e]=t,s[e]=r,c[e]=i-t,l[e]=a-r,u+=c[e]*l[e],f=Math.max(f,c[e])}let p=Math.max(f,Math.ceil(Math.sqrt(u*2))),m=0,h=0,g=0,_=0;for(let e=0;e<r;e++){m>0&&m+c[e]>p&&(h+=g,m=0,g=0);for(let t=n[e];t<n[e+1];t++)x[E[t]]+=m-o[e],S[E[t]]+=h-s[e];m+=c[e],g=Math.max(g,l[e]),_=Math.max(_,m)}e<a&&(C[i+e]=_,w[i+e]=h+g)};for(let e=a-1;e>=0;e--)z(e);z(o);let B=new Int32Array(a),V=new Int32Array(a),H=new Int32Array(a),U=new Uint8Array(a);for(let e=0;e<a;e++){let t=l[i+e];H[e]=t===o?-1:t,B[e]=x[i+e]+(t===o?0:B[t]),V[e]=S[i+e]+(t===o?0:V[t]),d[e].length===0&&(U[e]=1)}let ee=new Int32Array(i),te=new Int32Array(i),W=new Int32Array(i);for(let e=0;e<i;e++){let t=l[e];W[e]=t===o?-1:t,ee[e]=x[e]+(t===o?0:B[t]),te[e]=S[e]+(t===o?0:V[t])}return{col:ee,row:te,groupCol:B,groupRow:V,groupCols:C.slice(i),groupRows:w.slice(i),groupParent:H,groupEmpty:U,nodeParent:W}}var zg=12,Bg=6,Vg=4,Hg=3,Ug=[-1,1,0,0],Wg=[0,0,-1,1];function Gg(e,t,n,r,i){let a=e.architecture,o=typeof a==`object`&&a&&!Array.isArray(a)?a[t]:void 0;return typeof o==`number`&&Number.isFinite(o)?Math.min(i,Math.max(r,o)):n}function Kg(e){let t=new Map;for(let n of e.sort((e,t)=>e-t))t.has(n)||t.set(n,t.size);return t}function qg(e,t,n,r,i){return`<svg class="pele-icon" data-icon="${Y(e)}" x="${X(t)}" y="${X(n)}" width="${X(r)}" height="${X(r)}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${i?.(e)??jg(e)}</svg>`}function Jg(e,t,n,r){let i=e.lines.length>n;if(!i&&e.width<=t)return e;let a=r.width(`…`,e.size,0),o=[],s=[],c=0;for(let l=0;l<Math.min(n,e.lines.length);l++){let u=e.lines[l].map(e=>({...e})),d=e.widths[l];if(d>t||i&&l===n-1)for(;;){let n=u[u.length-1];if(n===void 0){u.push({text:`…`,style:0,width:a}),d=a;break}let i=d-n.width;if(n.icon===void 0&&i+a<t){let o=0,s=n.text.length;for(;o<s;){let c=o+s+1>>1;i+r.width(n.text.slice(0,c),e.size,n.style)+a<=t?o=c:s=c-1}let c=o>0?n.text.charCodeAt(o-1):0;c>=55296&&c<=56319&&o--,n.text=n.text.slice(0,o).trimEnd()+`…`,n.width=r.width(n.text,e.size,n.style),d=i+n.width;break}u.pop(),d=i}o.push(u),s.push(d),c=Math.max(c,d)}return{...e,lines:o,widths:s,width:c,height:o.length*e.lineHeight}}function Yg(e,t){let{x:n,y:r,dx:i,dy:a}=e,{x:o,y:s,dx:c,dy:l}=t,u=n+i*zg,d=r+a*zg,f=o+c*zg,p=s+l*zg;if(i*c+a*l===0){let e=i===0?n:o,t=i===0?s:r;return(e-n)*i+(t-r)*a>0&&(e-o)*c+(t-s)*l>0?[n,r,e,t,o,s]:i===0?[n,r,u,d,f,d,f,p,o,s]:[n,r,u,d,u,p,f,p,o,s]}let m=i!==0,h=m?s-r:o-n;if(i===-c&&a===-l){if((o-n)*i+(s-r)*a>0){if(Math.abs(h)<.5)return[n,r,o,s];if(m){let a=i>0?e.x1:t.x1,c=i>0?t.x0:e.x0,l=a<c?(a+c)/2:(n+o)/2;return[n,r,l,r,l,s,o,s]}let c=a>0?e.y1:t.y1,l=a>0?t.y0:e.y0,u=c<l?(c+l)/2:(r+s)/2;return[n,r,n,u,o,u,o,s]}}else if(Math.abs(h)>=1){if(m){let e=i>0?Math.max(n,o)+zg:Math.min(n,o)-zg;return[n,r,e,r,e,s,o,s]}let e=a>0?Math.max(r,s)+zg:Math.min(r,s)-zg;return[n,r,n,e,o,e,o,s]}if(m){let i=e.y1+zg<=t.y0?(e.y1+t.y0)/2:t.y1+zg<=e.y0?(t.y1+e.y0)/2:Math.max(e.y1,t.y1)+zg;return[n,r,u,r,u,i,f,i,f,s,o,s]}let g=e.x1+zg<=t.x0?(e.x1+t.x0)/2:t.x1+zg<=e.x0?(t.x1+e.x0)/2:Math.max(e.x1,t.x1)+zg;return[n,r,n,d,g,d,g,p,o,p,o,s]}function Xg(e){let t=[e[0],e[1]];for(let n=2;n<e.length;n+=2){let r=e[n],i=e[n+1],a=t.length,o=Math.abs(r-t[a-2])<.01,s=Math.abs(i-t[a-1])<.01;o&&s||(a>=4&&(o&&Math.abs(t[a-4]-t[a-2])<.01||s&&Math.abs(t[a-3]-t[a-1])<.01)?(t[a-2]=r,t[a-1]=i):t.push(r,i))}return t}function Zg(e,t,n){let r=e.length/2,i=Array(r),a=Array(r);for(let t=0;t<r;t++)i[t]=e[t*2],a[t]=e[t*2+1];let o=(e,t,n)=>{let r=Math.hypot(i[t]-i[e],a[t]-a[e]),o=Math.min(n,Math.max(0,r-1));r>0&&o>0&&(i[e]+=(i[t]-i[e])/r*o,a[e]+=(a[t]-a[e])/r*o)};o(0,1,t),o(r-1,r-2,n);let s=`M${X(i[0])},${X(a[0])}`;for(let e=1;e<r-1;e++){let t=Math.hypot(i[e]-i[e-1],a[e]-a[e-1]),n=Math.hypot(i[e+1]-i[e],a[e+1]-a[e]),r=Math.min(Bg,t/2,n/2);if(r<.5){s+=`L${X(i[e])},${X(a[e])}`;continue}let o=i[e]-(i[e]-i[e-1])/t*r,c=a[e]-(a[e]-a[e-1])/t*r,l=i[e]+(i[e+1]-i[e])/n*r,u=a[e]+(a[e+1]-a[e])/n*r;s+=`L${X(o)},${X(c)}Q${X(i[e])},${X(a[e])} ${X(l)},${X(u)}`}return s+`L${X(i[r-1])},${X(a[r-1])}`}function Qg(e,t,n){return Oh(n,r=>$g(e,t,n,r))}function $g(e,t,n,r){let i=Gg(t,`iconSize`,48,8,512),a=Gg(t,`fontSize`,n.fontSize??16,4,128),o=Math.min(Gg(t,`padding`,20,0,256),r?12:1/0),s=Math.round(a*.875),c=n.measurer??bc(n.fontFamily,n.fontFamilyMono),l=n.padding??8,u=n.icons,d=i/2,f=[...e.nodes.values()],p=[...e.groups.values()],m=f.length,h=p.length,g=Rg(f,p,e.edges,e.layoutHints),_=new Map;f.forEach((e,t)=>_.set(e.id,t));let v=Array(m),y=new Float64Array(m),b=new Float64Array(m),x=r?Math.max(i,64):Math.max(i*2.25,96);for(let e=0;e<m;e++){let t=f[e],n=Q(t.type===`service`?t.title:void 0,!0,c,a,x);v[e]=n,y[e]=Math.max(i,2*Math.ceil(n.width/2)),b[e]=i+(n.height>0?Vg+n.height:0)}let S=[],C=[];for(let e=0;e<m;e++)S.push(g.col[e]),C.push(g.row[e]);for(let e=0;e<h;e++)g.groupEmpty[e]&&(S.push(g.groupCol[e]),C.push(g.groupRow[e]));let w=Kg(S),T=Kg(C),E=w.size,D=T.size,O=new Float64Array(E),k=new Float64Array(D),A=r?Math.max(24,2*zg):Math.max(40,Math.round(i*.75)),j=new Float64Array(E).fill(A),M=new Float64Array(D).fill(A),N=new Int32Array(m),P=new Int32Array(m);for(let e=0;e<m;e++){let t=N[e]=w.get(g.col[e]),n=P[e]=T.get(g.row[e]);O[t]=Math.max(O[t],y[e]),k[n]=Math.max(k[n],b[e])}for(let e=0;e<h;e++){if(!g.groupEmpty[e])continue;let t=w.get(g.groupCol[e]),n=T.get(g.groupRow[e]);O[t]=Math.max(O[t],i),k[n]=Math.max(k[n],d)}let F=e.edges.length,I=Array(F),L=new Int32Array(F*2);for(let t=0;t<F;t++){let n=e.edges[t],r=L[t*2]=_.get(n.lhsId)??-1,i=L[t*2+1]=_.get(n.rhsId)??-1,a=Q(n.title,!0,c,s,160);if(I[t]=a,!(a.width===0||r<0||i<0)){if(N[r]!==N[i]){let e=Math.min(N[r],N[i]);j[e]=Math.max(j[e],Math.ceil(a.width)+28)}else if(O[N[r]]=Math.max(O[N[r]],2*Math.ceil(a.width/2)+8),P[r]!==P[i]){let e=Math.min(P[r],P[i]);M[e]=Math.max(M[e],Math.ceil(a.height)+24)}}}let R=Array(h),z=new Int32Array(h),B=new Int32Array(h),V=new Int32Array(h),H=new Int32Array(h),U=new Float64Array(h),ee=new Float64Array(h),te=new Float64Array(h),W=new Float64Array(h),ne=new Float64Array(h),G=new Float64Array(h),re=new Float64Array(E),K=new Float64Array(E),ie=new Float64Array(D),q=new Float64Array(D),ae=Math.round(a*1.25);for(let e=0;e<h;e++){z[e]=w.get(g.groupCol[e]),B[e]=w.get(g.groupCol[e]+g.groupCols[e]-1),V[e]=T.get(g.groupRow[e]),H[e]=T.get(g.groupRow[e]+g.groupRows[e]-1);let t=Q(p[e].title,!0,c,a,r?Math.max(80,Ch(n)/2):320);R[e]=t;let i=p[e].icon?ae:0;ne[e]=t.width+i+(t.width>0&&i>0?6:0),G[e]=Math.max(t.height,i)}for(let e=h-1;e>=0;e--){let t=o+U[e],n=o+ee[e],r=(G[e]>0?Math.max(o,G[e]+12):o)+te[e],i=o+W[e];if(ne[e]>0){let r=t+n;for(let t=z[e];t<=B[e];t++)r+=O[t]+(t<B[e]?K[t]+j[t]+re[t+1]:0);ne[e]+20>r&&(n+=Math.ceil(ne[e]+20-r))}U[e]=t,ee[e]=n,te[e]=r,W[e]=i,re[z[e]]=Math.max(re[z[e]],t),K[B[e]]=Math.max(K[B[e]],n),ie[V[e]]=Math.max(ie[V[e]],r),q[H[e]]=Math.max(q[H[e]],i);let a=g.groupParent[e];a<0||(z[a]===z[e]&&(U[a]=Math.max(U[a],t)),B[a]===B[e]&&(ee[a]=Math.max(ee[a],n)),V[a]===V[e]&&(te[a]=Math.max(te[a],r)),H[a]===H[e]&&(W[a]=Math.max(W[a],i)))}let oe=new Float64Array(E),se=new Float64Array(D),ce=0;for(let e=0;e<E;e++)oe[e]=ce+re[e],ce=oe[e]+O[e]+K[e]+(e<E-1?j[e]:0);let le=0;for(let e=0;e<D;e++)se[e]=le+ie[e],le=se[e]+k[e]+q[e]+(e<D-1?M[e]:0);let ue=0,de=0,fe=ce,pe=le,me=e=>oe[z[e]]-U[e],he=e=>oe[B[e]]+O[B[e]]+ee[e],ge=e=>se[V[e]]-te[e],_e=e=>se[H[e]]+k[H[e]]+W[e],ve=e=>oe[N[e]]+O[N[e]]/2,ye=(e,t,n)=>{let r=Ug[t],i=Wg[t],a=ve(e),o=se[P[e]],s={x:a,y:o+d,dx:r,dy:i,x0:a-y[e]/2,y0:o,x1:a+y[e]/2,y1:o+b[e],gap:0,wire:!1};f[e].type===`junction`?(s.x0=s.x1=a,s.y0=s.y1=s.y,s.gap=Hg):r===0?s.y=i<0?o:o+b[e]+(v[e].height>0?2:0):s.x=a+r*d;let c=n?g.nodeParent[e]:-1;return c>=0&&(s.x0=me(c),s.x1=he(c),s.y0=ge(c),s.y1=_e(c),s.gap=0,s.wire=f[e].type===`junction`,r===0?s.y=i<0?s.y0:s.y1:s.x=r<0?s.x0:s.x1),s},be=``,xe=``,Se=[],Ce=bp(`arrow_point`);for(let t=0;t<F;t++){let n=e.edges[t],r=L[t*2],i=L[t*2+1];if(r<0||i<0)continue;let a=ye(r,Pg(n.lhsDir),n.lhsGroup),o=ye(i,Pg(n.rhsDir),n.rhsGroup);a.x===o.x&&a.y===o.y&&a.dx===o.dx&&(a.x-=8*Math.abs(a.dy),a.y-=8*Math.abs(a.dx),o.x+=8*Math.abs(a.dy),o.y+=8*Math.abs(a.dx));let s=Yg(a,o);a.wire&&s.unshift(ve(r),se[P[r]]+d),o.wire&&s.push(ve(i),se[P[i]]+d);let c=Xg(s);if(c.length<4)continue;let l=Y(`${n.lhsId}-${n.rhsId}`);be+=`<g class="pele-edge" data-id="${l}"><path d="${Zg(c,n.lhsInto&&!a.wire?Ce+a.gap:0,n.rhsInto&&!o.wire?Ce+o.gap:0)}"/>`+(n.lhsInto?xp(`arrow_point`,a.x+a.dx*a.gap,a.y+a.dy*a.gap,-a.dx,-a.dy,`var(--_l)`):``)+(n.rhsInto?xp(`arrow_point`,o.x+o.dx*o.gap,o.y+o.dy*o.gap,-o.dx,-o.dy,`var(--_l)`):``)+`</g>`;let f=-1,p=-1,m=-1,h=-1,g=I[t];for(let e=0;e<c.length;e+=2)ue=Math.min(ue,c[e]-4),fe=Math.max(fe,c[e]+4),de=Math.min(de,c[e+1]-4),pe=Math.max(pe,c[e+1]+4);for(let e=0;e+3<c.length;e+=2){let t=Math.abs(c[e+1]-c[e+3])<.01,n=Math.abs(c[e]-c[e+2])+Math.abs(c[e+1]-c[e+3]);t||Se.push(c[e],Math.min(c[e+1],c[e+3]),Math.max(c[e+1],c[e+3])),n>p&&(f=e,p=n),t&&n>h&&(m=e,h=n)}if(g.width>0){let e=h>=g.width+8?m:f,t=(c[e]+c[e+2])/2,r=(c[e+1]+c[e+3])/2,i=g.width+8,s=Math.abs(c[e]-c[e+2])<.01;for(let e of[a,o])t+i/2<=e.x0||t-i/2>=e.x1||r+g.height/2<=e.y0||r-g.height/2>=e.y1||(s?t=t>=(e.x0+e.x1)/2?e.x1+i/2+4:e.x0-i/2-4:r=r>=(e.y0+e.y1)/2?e.y1+g.height/2+4:e.y0-g.height/2-4);ue=Math.min(ue,t-i/2),fe=Math.max(fe,t+i/2),de=Math.min(de,r-g.height/2),pe=Math.max(pe,r+g.height/2),xe+=Rp(`${n.lhsId}-${n.rhsId}`,g,t,r,``,u)}}let we=``;for(let e=0;e<h;e++){let t=p[e],n=me(e),r=ge(e),i=he(e)-n,a=R[e],o=``;if(ne[e]>0){let s=r+G[e]+12,c=[];for(let e=0;e<Se.length;e+=3)Se[e+1]<s&&Se[e+2]>r&&Se[e]>n&&Se[e]<n+i&&c.push(Se[e]);c.sort((e,t)=>e-t),c.push(n+i-4);let l=n+10;for(let t of c){if(t-6-l>=ne[e])break;l=Math.max(l,t+6)}l+ne[e]>n+i-4&&(l=n+10);let d=r+6+G[e]/2,f=l;t.icon&&(o+=qg(t.icon,l,d-ae/2,ae,u),f+=ae+6),o+=Z(a,f+a.width/2,d,` class="pele-cluster-label" fill="var(--_m)"`,u)}we+=`<g class="pele-cluster" data-id="${Y(t.id)}"><rect x="${X(n)}" y="${X(r)}" width="${X(i)}" height="${X(_e(e)-r)}" fill="var(--_a)" fill-opacity="0.5" stroke="var(--_b)"${Up}/>`+o+`</g>`}let Te=``,Ee=i*.5,De=Math.max(6,Math.round(a*.75));for(let e=0;e<m;e++){let t=f[e],n=`data-id="${Y(t.id)}" transform="translate(${X(ve(e))},${X(se[P[e]])})"`;if(t.type===`junction`){Te+=`<g class="pele-node pele-junction" ${n}><circle cy="${X(d)}" r="${Hg}" fill="var(--_l)"/></g>`;continue}let r=``;if(t.icon)r=qg(t.icon,-Ee/2,(i-Ee)/2,Ee,u);else if(t.iconText){let e=Q(t.iconText,!1,c,De,i-8),n=Math.max(1,Math.floor((i-4)/(e.lineHeight||1)));r=Z(Jg(e,i-8,n,c),0,d,` class="pele-icon-text" font-size="${De}"`,u)}Te+=`<g class="pele-node pele-service" ${n}><rect x="${X(-d)}" width="${X(i)}" height="${X(i)}" fill="var(--_s)" stroke="var(--_b)"${Up}/>`+r+Z(v[e],0,i+Vg+v[e].height/2,` class="pele-label"`,u)+`</g>`}let Oe=Q(e.title,!1,c,a,r?Ch(n):4e3,1),ke=Oe.height>0?Oe.height+12:0,Ae=Math.ceil(Math.max(fe-ue,Oe.width)+2*l),je=Math.ceil(pe-de+ke+2*l),Me=Math.round((Ae-(fe-ue))/2-ue),Ne=Math.round(l+ke-de),Pe=(we?`<g class="pele-clusters">${we}</g>`:``)+(be?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round" stroke-linejoin="round">${be}</g>`:``)+(xe?`<g class="pele-edge-labels" font-size="${s}">${xe}</g>`:``)+(Te?`<g class="pele-nodes">${Te}</g>`:``);return{svg:lm(`architecture`,Ae,je,a,n,e,Z(Oe,Ae/2,l+Oe.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(Pe?`<g transform="translate(${Me},${Ne})">${Pe}</g>`:``)),width:Ae,height:je,links:[]}}var e_={type:`architecture`,parse(e,t,n){let r=new $h;return n&&(r.title=n),eg(kg(e),r),r},render:Qg},t_=1e5;function n_(e){switch(e){case`[]`:return`square`;case`()`:return`round`;case`(())`:return`circle`;case`>]`:return`rect_left_inv_arrow`;case`{}`:return`diamond`;case`{{}}`:return`hexagon`;case`([])`:return`stadium`;case`[[]]`:return`subroutine`;case`[()]`:return`cylinder`;case`((()))`:return`doublecircle`;case`[//]`:return`lean_right`;case`[\\\\]`:return`lean_left`;case`[/\\]`:return`trapezoid`;case`[\\/]`:return`inv_trapezoid`;case`<[]>`:return`block_arrow`;default:return`na`}}function r_(e){switch(e.trim().slice(-1)){case`x`:return`arrow_cross`;case`o`:return`arrow_circle`;case`>`:return`arrow_point`;default:return``}}function i_(e){switch(e.trim().charAt(0)){case`x`:return`arrow_cross`;case`o`:return`arrow_circle`;case`<`:return`arrow_point`;default:return`arrow_open`}}function a_(e){return e.includes(`==`)?`thick`:`normal`}function o_(e){return e.includes(`.-`)?`dotted`:`solid`}function s_(e,t){let n=e.flat(),r=-1;for(let e of n)if(e.type===`column-setting`){r=e.columns??-1;break}return{list:n,at:0,parent:t,children:[],columns:r}}var c_=class{type=`block`;title;root={id:`root`,type:`composite`,children:[],columns:-1};blocks=[];edges=[];classes=new Map;byId=new Map;typeStr2Type=n_;edgeStrToEdgeData=r_;edgeStrToEdgeStartData=i_;edgeStrToThickness=a_;edgeStrToPattern=o_;warn;pending=new Set;edgeCount=new Map;ids=0;colors=0;spaces=0;constructor(e={}){this.warn=e.warn}generateId(){return`id-`+ ++this.ids}addStyleClass(e,t=``){let n=this.classes.get(e);n||(n={id:e,styles:[],textStyles:[]},this.classes.set(e,n));for(let e of t.split(`,`)){let t=e.indexOf(`;`),r=(t===-1?e:e.slice(0,t)+e.slice(t+1)).trim();e.includes(`color`)&&n.textStyles.push(r.replace(`fill`,`bgFill`).replace(`color`,`fill`)),n.styles.push(r)}}addStyle2Node(e,t=``){this.named(e).styles=t.split(`,`)}setCssClass(e,t){for(let n of e.split(`,`))(this.named(n.trim()).classes??=[]).push(t)}named(e){let t=this.byId.get(e);return t===void 0&&(t={id:e,type:`na`,children:[]},this.byId.set(e,t),this.pending.add(e)),t}setHierarchy(e){let t=[s_(e,this.root)];for(;t.length>0;){let e=t[t.length-1];if(e.at===e.list.length){e.parent.children=e.children,t.pop();continue}let n=e.list[e.at++];switch(e.columns>0&&n.type!==`column-setting`&&typeof n.widthInColumns==`number`&&n.widthInColumns>e.columns&&this.warn?.(`Block ${n.id} width ${n.widthInColumns} exceeds configured column width ${e.columns}`),n.type){case`classDef`:this.addStyleClass(n.id,n.css);continue;case`applyClass`:this.setCssClass(n.id,n.styleClass??``);continue;case`applyStyles`:n.stylesStr&&this.addStyle2Node(n.id,n.stylesStr);continue;case`column-setting`:e.parent.columns=n.columns??-1;continue;case`edge`:{let e=(this.edgeCount.get(n.id)??0)+1;this.edgeCount.set(n.id,e),n.id=e+`-`+n.id,this.edges.push(n);continue}}n.id??=this.generateId(),n.label||=n.type===`composite`?``:n.id;let r=this.byId.get(n.id),i=r===void 0||this.pending.delete(n.id);i?(r&&(n.classes=r.classes,n.styles=r.styles),n.type===`composite`&&(n.colorIndex=this.colors++),this.byId.set(n.id,n)):(n.type!==`na`&&(r.type=n.type),n.label!==n.id&&(r.label=n.label));let a=n.children;if(n.children=[],n.type===`space`){let t=n.width??1;if(!(t<=t_-this.spaces))throw new jo(`A block diagram can hold at most ${t_} space blocks.`,`limit`,{type:`block`});this.spaces+=Math.max(t,0);for(let r=0;r<t;r++){let t={...n,id:n.id+`-`+r,children:[]};this.byId.set(t.id,t),e.children.push(t)}}else i&&e.children.push(n);a&&a.length>0&&t.push(s_(a,n))}this.blocks=this.root.children??[]}},l_=`$end.INVALID.BLOCK_DIAGRAM_KEY.id-block.COLUMNS.MD_STR.STR.SPACE_BLOCK.DEFAULT.LINKSTYLE.INTERPOLATE.classDef.DEFAULT_CLASSDEF_ID.CLASSDEF_ID.CLASSDEF_STYLEOPTS.class.CLASSENTITY_IDS.STYLECLASS.style.STYLE_ENTITY_IDS.STYLE_DEFINITION_DATA.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.end.NODE_DSTART.NODE_DEND.BLOCK_ARROW_START.BLOCK_ARROW_END.DIR.NODE_ID.LINK.START_LINK.LINK_LABEL.SIZE.EOF`.split(`.`),u_=[`right`,`left`,`x`,`y`,`up`,`down`],d_=new Uint8Array(128);for(let e of[9,10,11,12,13,32,40,41,45,58,60,61,62,91,123,125])d_[e]=1;function f_(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c=(e,t,a)=>(n.push(e),r.push(t),i.push(s),s=a,!0),l=(t,n)=>c(t,e.slice(s,n),n),u=e=>{a.push(o),o=e},d=()=>{a.length>0&&(o=a.pop())},f=n=>{for(;n<t&&J(e.charCodeAt(n));)n++;return n},p=n=>{for(;n<t;){let t=e.charCodeAt(n);if(t<48||t>57)break;n++}return n},m=n=>{for(;n<t&&Ls(e.charCodeAt(n));)n++;return n},h=t=>e.startsWith(t,s)&&!Ls(e.charCodeAt(s+t.length)),g=()=>(e.charCodeAt(s+1)===96?(u(2),s+=2):(u(1),s++),!0),_=t=>{if(e.charCodeAt(t)!==46)return-1;do t++;while(e.charCodeAt(t)===46);if(e.charCodeAt(t)!==45)return-1;let n=e.charCodeAt(t+1);return n===120||n===111||n===62?t+2:t+1},v=t=>{let n=e.charCodeAt(t);(n===120||n===111||n===60)&&t++;let r=e.charCodeAt(t);if(r===46)return _(t);if(r!==45&&r!==61)return-1;let i=t+1;for(;e.charCodeAt(i)===r;)i++;if(i-t===1)return r===45?_(i):-1;let a=e.charCodeAt(i);return a===120||a===111||a===62?i+1:i-t>=3?i:-1},y=()=>{let t=v(s);if(t>=0)return l(33,f(t));let n=e.charCodeAt(s)===60?s+1:s,r=e.charCodeAt(n),i=e.charCodeAt(n+1);return r===45&&(i===45||i===46)||r===61&&i===61?(u(6),l(34,f(n+2))):!1},b=n=>{let r=e.indexOf(`
|
|
82
|
+
`,s);return r===-1&&(r=t),d(),l(n,r)},x=(t,n)=>{let r=m(s);if(r===s)return!1;for(;e.charCodeAt(r)===44;){let e=f(r+1),t=m(e);if(t===e)break;r=t}return o=n,l(t,r)},S=n=>{if(J(n))return s=f(s+1),!0;let r;switch(n){case 98:if(e.startsWith(`block`,s)){if(h(`block-beta`))return l(2,s+10);if(e.charCodeAt(s+5)===58)return l(3,s+6);if(!Ls(e.charCodeAt(s+5)))return l(2,s+5)}break;case 99:if(e.startsWith(`columns`,s)){if(r=f(s+7),r>s+7){if(e.startsWith(`auto`,r)&&!Ls(e.charCodeAt(r+4)))return c(4,`-1`,r+4);let t=p(r);if(t>r)return c(4,e.slice(r,t),t)}}else if(e.startsWith(`class`,s)){let t=e.startsWith(`Def`,s+5),n=t?s+8:s+5;if(r=f(n),r>n)return u(t?7:9),l(t?11:15,r)}break;case 34:return g();case 115:if(e.startsWith(`space`,s)){if(e.charCodeAt(s+5)===58){let t=p(s+6);if(t>s+6)return c(7,e.slice(s+6,t),t)}if(!Ls(e.charCodeAt(s+5)))return c(7,`1`,s+5)}else if(e.startsWith(`style`,s)&&(r=f(s+5),r>s+5))return u(11),l(18,r);break;case 100:if(h(`default`))return l(8,s+7);break;case 108:if(h(`linkStyle`))return l(9,s+9);break;case 105:if(h(`interpolate`))return l(10,s+11);break;case 97:if(e.startsWith(`accTitle`,s)){if(r=f(s+8),e.charCodeAt(r)===58)return u(13),l(21,f(r+1))}else if(e.startsWith(`accDescr`,s)){r=f(s+8);let t=e.charCodeAt(r);if(t===58)return u(14),l(23,f(r+1));if(t===123)return u(15),s=f(r+1),!0}break;case 101:if(h(`end`))return l(26,f(s+3));break;case 45:return e.charCodeAt(s+1)===41?(u(3),l(27,s+2)):y();case 61:return y();case 60:return e.charCodeAt(s+1)===91?(u(4),l(29,s+2)):y();case 40:{let t=e.charCodeAt(s+1),n=t===45||t===91?2:t===40?e.charCodeAt(s+2)===40?3:2:1;return u(3),l(27,s+n)}case 41:case 123:return u(3),l(27,e.charCodeAt(s+1)===n?s+2:s+1);case 62:return u(3),l(27,s+1);case 91:{let t=e.charCodeAt(s+1);return u(3),l(27,t===91||t===124||t===40||t===92||t===47?s+2:s+1)}case 58:{let t=p(s+1);return t>s+1&&c(36,e.slice(s+1,t),t)}}for(r=s;r<t;){let t=e.charCodeAt(r);if(t<128?d_[t]===1:J(t))break;r++}return r>s&&l(32,r)},C=t=>{let n=e.charCodeAt(s+1),r=0;switch(t){case 34:return g();case 40:r=n===45?2:n===40?e.charCodeAt(s+2)===40?3:2:1;break;case 41:r=n===41?e.charCodeAt(s+2)===41?3:2:n===93?2:1;break;case 125:r=n===125?2:1;break;case 45:r=n===41?2:0;break;case 93:r=n===93||n===41||n===62?2:1;break;case 92:case 47:r=n===93?2:0}return r!==0&&(d(),l(28,s+r))},w=t=>{if(t===41)return d(),d(),c(30,`]>`,f(s+1));let n=f(t===44?s+1:s);for(let r of u_)if(e.startsWith(r,n)){let i=f(n+r.length);return c(31,e.slice(t===44?n:s,i),i)}return!1};for(;;){if(s>=t){let e=-1;switch(o){case 0:e=37;break;case 1:e=6;break;case 8:e=14;break;case 10:e=17;break;case 12:e=20;break;case 13:e=22;break;case 14:e=24;break;case 15:e=25}s=t,e!==-1&&c(e,``,t);break}let a=e.charCodeAt(s),p=!0;switch(o){case 0:p=S(a);break;case 1:if(a===34)d(),s++;else{let n=e.indexOf(`"`,s);l(6,n===-1?t:n)}break;case 2:if(a===96)p=e.charCodeAt(s+1)===34,p&&(d(),s+=2);else if(a===34)p=!1;else{let n=s+1;for(;n<t;){let t=e.charCodeAt(n);if(t===96||t===34)break;n++}l(5,n)}break;case 3:p=C(a);break;case 4:if(a===34)g();else if(a===93&&e.charCodeAt(s+1)===62){let t=f(s+2);p=e.charCodeAt(t)===40,p&&(u(5),s=t+1)}else p=!1;break;case 5:p=w(a);break;case 6:if(a===34)e.charCodeAt(s+1)===96?g():(l(35,s+1),u(1));else{let e=v(f(s));p=e>=0,p&&(d(),l(33,f(e)))}break;case 7:{let t=12,n=e.startsWith(`DEFAULT`,s)?s+7:s,r=f(n);(n===s||r===n)&&(t=13,n=m(s),r=f(n)),p=n>s&&r>n,p&&(o=8,l(t,r));break}case 8:b(14);break;case 9:p=x(16,10);break;case 10:b(17);break;case 11:p=x(19,12);break;case 12:b(20);break;case 13:b(22);break;case 14:b(24);break;case 15:if(a===125)d(),s++;else{let n=e.indexOf(`}`,s);l(25,n===-1?t:n)}}if(!p)return n.push(1),r.push(``),i.push(s),{types:n,texts:r,starts:i}}return n.push(0),r.push(``),i.push(t),{types:n,texts:r,starts:i}}var p_=`'NODE_ID', 'COLUMNS', 'SPACE_BLOCK', 'BLOCK_DIAGRAM_KEY', 'id-block', 'classDef', 'class', 'style'`;function m_(e){let t=e[e.length-1];return Array.isArray(t)?(e.pop(),e.concat(t)):e}function h_(e,t){let{types:n,texts:r,starts:i}=f_(e),a=0,o=t=>{let r=n[a];throw r===1?zo(`block`,e,i[a],``,!0):zo(`block`,e,i[a],`Expecting ${t}, got '${l_[r]}'`)},s=e=>(n[a]!==e&&o(`'${l_[e]}'`),r[a++]),c=()=>{let e=s(32);if(n[a]===27){let t=r[a++];return{id:e,label:s(6),typeStr:t+s(28)}}if(n[a]===29){let t=r[a++],i=s(6),o=[s(31)];for(;n[a]===31;)o.push(r[a++]);return{id:e,label:i,typeStr:t+s(30),directions:o}}return{id:e}},l=()=>{let e=c(),i=n[a]===36?parseInt(r[a++],10):1,o={id:e.id,label:e.label,type:t.typeStr2Type(e.typeStr),directions:e.directions,widthInColumns:i},l;for(;n[a]===33||n[a]===34;){let e=``;n[a++]===34&&(s(35),e=s(6),s(33));let i=r[a-1],u=c(),d=t.edgeStrToEdgeData(i),f=t.edgeStrToEdgeStartData(i),p=t.edgeStrToThickness(i),m=t.edgeStrToPattern(i);l??=[{id:o.id,label:o.label,type:o.type,directions:o.directions}],o={id:u.id,label:u.label,type:t.typeStr2Type(u.typeStr),directions:u.directions},l.push({id:l[l.length-1].id+`-`+u.id,start:l[l.length-1].id,end:u.id,label:e,type:`edge`,thickness:p,pattern:m,directions:u.directions,arrowTypeEnd:d,arrowTypeStart:f},o)}return l??o};s(2);let u=[],d=[];for(;;)switch(n[a]){case 32:d.push(l());break;case 4:d.push({type:`column-setting`,columns:parseInt(r[a++],10)});break;case 7:{let e=parseInt(r[a++],10);d.push({id:t.generateId(),type:`space`,label:``,width:e,children:[]});break}case 2:a++,u.push({list:d,header:void 0}),d=[];break;case 3:a++,n[a]!==32&&o(`'NODE_ID'`),u.push({list:d,header:l()}),d=[];break;case 26:{let e=u.pop();if(e===void 0||d.length===0)return o(p_);a++;let n=t.generateId(),r=m_(d);d=e.list,d.push(e.header===void 0?{id:n,type:`composite`,label:``,children:r}:{...e.header,type:`composite`,children:r});break}case 11:{a++;let e=s(13).trim();d.push({type:`classDef`,id:e,css:s(14).trim()});break}case 15:{a++;let e=s(16).trim();d.push({type:`applyClass`,id:e,styleClass:s(17).trim()});break}case 18:{a++;let e=s(19).trim();d.push({type:`applyStyles`,id:e,stylesStr:s(20).trim()});break}case 37:u.length>0&&o(p_+`, 'end'`),d.length===0&&o(p_),t.setHierarchy(m_(d));return;default:o(d.length===0?p_:p_+(u.length>0?`, 'end'`:`, 'EOF'`))}}function g_(e,t,n,r){return ss(()=>Q(e,!1,t,n,r,1))}function __(e,t,n,r,i,a,o){let s=g_(e,t,n,4e3);if(s.height===0)return{width:i,height:a,content:o};let c=s.height+12,l=Math.max(i,Math.ceil(s.width+2*r));return{width:l,height:Math.ceil(a+c),content:Z(s,l/2,r+s.height/2,` class="pele-title" font-weight="var(--_tw)"`)+`<g transform="translate(${X((l-i)/2)},${X(c)})">${o}</g>`}}var v_=1,y_=2,b_=4,x_=8,S_=7,C_=20,w_=12;function T_(e){let t=0;if(e)for(let n of e)switch(n.trim()){case`right`:t|=v_;break;case`left`:t|=y_;break;case`up`:t|=b_;break;case`down`:t|=x_;break;case`x`:t|=v_|y_;break;case`y`:t|=b_|x_}return t}var E_=(e,t)=>e&t?1:0;function D_(e){return e!==0&&(e&(b_|x_))===0?`x`:e!==0&&(e&(v_|y_))===0?`y`:``}function O_(e,t,n){let r=D_(e),i=E_(e,y_)-E_(e,v_),a=E_(e,b_)-E_(e,x_);if(r===`x`){let r=Math.max(n+8,14)+2*S_,a=Math.min(r/2,C_);return{w:Math.max(t+12,16)+a*(e===(v_|y_)?2:1),h:r,dx:i*a/2,dy:0}}if(r===`y`){let r=Math.max(t+16,14)+2*S_,i=Math.min(r/2,C_);return{w:r,h:Math.max(n+8,16)+i*(e===(b_|x_)?2:1),dx:0,dy:a*i/2}}return{w:Math.max(t+16,24)+w_*(E_(e,y_)+E_(e,v_)),h:Math.max(n+8,24)+w_*(E_(e,b_)+E_(e,x_)),dx:i*w_/2,dy:a*w_/2}}function k_(e,t,n,r){let i=D_(e),a=t/2,o=n/2,s;if(i===`x`){let t=Math.min(o,C_),n=o-S_,r=e&y_?-a+t:-a,i=e&v_?a-t:a;s=[r,-n,i,-n],e&v_&&s.push(i,-o,a,0,i,o),s.push(i,n,r,n),e&y_&&s.push(r,o,-a,0,r,-o)}else if(i===`y`){let t=Math.min(a,C_),n=a-S_,r=e&b_?-o+t:-o,i=e&x_?o-t:o;s=[n,r,n,i],e&x_&&s.push(a,i,0,o,-a,i),s.push(-n,i,-n,r),e&b_&&s.push(-a,r,0,-o,a,r)}else{let t=e&y_?-a+w_:-a,n=e&v_?a-w_:a,r=e&b_?-o+w_:-o,i=e&x_?o-w_:o,c=(t+n)/2,l=(r+i)/2,u=Math.min(10,(n-t)/2),d=Math.min(10,(i-r)/2);s=[t,r],e&b_&&s.push(c-u,r,c,-o,c+u,r),s.push(n,r),e&v_&&s.push(n,l-d,a,l,n,l+d),s.push(n,i),e&x_&&s.push(c+u,i,c,o,c-u,i),s.push(t,i),e&y_&&s.push(t,l+d,-a,l,t,l-d)}let c=``;for(let e=0;e<s.length;e+=2)c+=(e?` `:``)+X(s[e])+`,`+X(s[e+1]);return`<polygon points="${c}" stroke-linejoin="round"${r}/>`}var A_=1e3;function j_(e,t){if(e===0||!Number.isInteger(e))throw new jo(`Columns must be an integer !== 0.`,`semantic`,{type:`block`});if(t<0||!Number.isInteger(t))throw new jo(`Position must be a non-negative integer.`+t,`semantic`,{type:`block`});return e<0?{px:t,py:0}:{px:t%e,py:Math.floor(t/e)}}function M_(e,t,n){let r=e.columns,i=[],a=0,o=0,s=0,c=0;for(let n of e.children){let{px:e,py:l}=j_(r,a),u=n.span>=1?Math.min(n.span,A_):1;if(r>0&&u>r-e&&(u=r-e),n.span=u,n.col=e,n.row=l,a+=u,e+u>o&&(o=e+u),l===i.length&&i.push(0),n.children.length===0?i[l]=-1:i[l]>=0&&n.nh>i[l]&&(i[l]=n.nh),n.space)continue;let d=(n.nw-t*(u-1))/u;d>s&&(s=d),n.nh>c&&(c=n.nh)}let l=(i.length-1)*t+P_(e.rowGaps);for(let e=0;e<i.length;e++)i[e]<0&&(i[e]=c),l+=i[e];e.cols=o,e.heights=i,e.nw=Math.max(e.nw,o*s+(o-1)*t+P_(e.colGaps)+2*n),e.nh=l+2*n+e.head}function N_(e,t,n){let{cols:r,heights:i,rowGaps:a,colGaps:o}=e,s=i.length,c=(e.w-2*n-(r-1)*t-P_(o))/r,l=e.h-2*n-e.head-(s-1)*t-P_(a),u=[];if(o.length>0){let e=0;for(let t=0;t<r;t++)u.push(e),e+=o[t]??0}let d=0;for(let e of i)d+=e;let f=d>0?l/d:0,p=d>0?0:l/s,m=e.x-e.w/2+n,h=e.y-e.h/2+n+e.head,g=0;for(let n of e.children){for(;g<n.row;g++)h+=i[g]*f+p+t+(a[g]??0);let e=u[n.col]??0;n.w=c*n.span+t*(n.span-1)+(u[n.col+n.span-1]??0)-e,n.h=i[g]*f+p,n.x=m+n.col*(c+t)+e+n.w/2,n.y=h+n.h/2}}function P_(e){let t=0;for(let n of e)t+=n??0;return t}function F_(e,t){let n=[e];for(let e=0;e<n.length;e++)for(let t of n[e].children)n.push(t);for(let e=n.length-1;e>=0;e--){let r=n[e];r.children.length>0&&M_(r,t,e===0?0:t)}e.w=e.nw,e.h=e.nh,e.x=e.w/2,e.y=e.h/2;for(let e=0;e<n.length;e++){let r=n[e];r.children.length>0&&N_(r,t,e===0?0:t)}return{width:e.w,height:e.h}}var I_=12,L_=200,R_=8,z_=` fill="var(--_s)" stroke="var(--_b)"`,B_=` stroke="var(--_b)"`,V_=[],H_=[],U_=[],W_=[],G_=[`default`],K_=2e6,q_=4,J_=new Map([[`square`,`rect`],[`round`,`rounded`],[`circle`,`circle`],[`doublecircle`,`dbl-circ`],[`diamond`,`diam`],[`hexagon`,`hex`],[`stadium`,`stadium`],[`subroutine`,`fr-rect`],[`cylinder`,`cyl`],[`rect_left_inv_arrow`,`odd`],[`lean_right`,`lean-r`],[`lean_left`,`lean-l`],[`trapezoid`,`trap-b`],[`inv_trapezoid`,`trap-t`]]),Y_=new Set([`circle`,`dbl-circ`,`diam`]),X_=new Set([`stadium`,`hex`,`odd`,`lean-r`,`lean-l`,`trap-b`,`trap-t`]);function Z_(e){return e.kind===0&&(e.shape===`circle`||e.shape===`dbl-circ`)}function Q_(e,t,n){let r=e.bw/2,i=e.bh/2,a=Math.abs(t-e.x),o=i;return Z_(e)?o=Math.sqrt(Math.max(r*r-a*a,0)):e.kind===0&&e.shape===`diam`?o=i*Math.max(1-a/r,0):e.kind===0?o=i-Nm(e.shape,e.bw,e.bh,n>0?2:0):e.kind===1&&D_(e.mask)===`x`&&(o=i-S_),e.y+n*o}function $_(e,t,n){let r=e.bw/2,i=e.bh/2,a=Math.abs(t-e.y),o=r;return Z_(e)?o=Math.sqrt(Math.max(i*i-a*a,0)):e.kind===0&&e.shape===`diam`?o=r*Math.max(1-a/i,0):e.kind===0?o=r-Nm(e.shape,e.bw,e.bh,n>0?1:3):e.kind===1&&D_(e.mask)===`y`&&(o=r-S_),e.x+n*o}function ev(e,t,n,r){let i=t-e.x,a=n-e.y,o=e.bw/2,s=e.bh/2,c;c=Z_(e)?o/(Math.hypot(i,a)||1):e.kind===0&&e.shape===`diam`?1/(Math.abs(i)/o+Math.abs(a)/s||1):Math.min(i===0?1/0:o/Math.abs(i),a===0?1/0:s/Math.abs(a)),c===1/0&&(c=0),r.push(e.x+i*c,e.y+a*c)}function tv(e,t,n,r,i){let a=i.x-i.bw/2+1,o=i.x+i.bw/2-1,s=i.y-i.bh/2+1,c=i.y+i.bh/2-1;if(e<a&&n<a||e>o&&n>o||t<s&&r<s||t>c&&r>c)return!1;if(e===n||t===r)return!0;let l=n-e,u=r-t,d=(n,r)=>Math.sign(l*(r-t)-u*(n-e)),f=d(a,s);return f===0||d(o,s)!==f||d(o,c)!==f||d(a,c)!==f}function nv(e,t,n,r){let i=0;for(let a of r)if(a!==t&&a!==n){for(let t=0;t+3<e.length;t+=2)if(tv(e[t],e[t+1],e[t+2],e[t+3],a)){i++;break}}return i}function rv(e,t,n,r){let i=e.x-e.bw/2,a=e.x+e.bw/2,o=e.y-e.bh/2,s=e.y+e.bh/2,c=t.x-t.bw/2,l=t.x+t.bw/2,u=t.y-t.bh/2,d=t.y+t.bh/2,f=Math.max(i,c),p=Math.min(a,l),m=Math.max(o,u),h=Math.min(s,d),g=p-f>6,_=h-m>6;if(g&&_){let n=e.bw*e.bh<=t.bw*t.bh?e:t,r=n===e?t:e,i=n.y-n.bh/2-(r.y-r.bh/2),a=r.y+r.bh/2-(n.y+n.bh/2),o=n.x-n.bw/2-(r.x-r.bw/2),s=r.x+r.bw/2-(n.x+n.bw/2),c=Math.min(i,a,o,s),l;return l=c===a?[n.x,Q_(n,n.x,1),n.x,r.y+r.bh/2]:c===i?[n.x,Q_(n,n.x,-1),n.x,r.y-r.bh/2]:c===s?[$_(n,n.y,1),n.y,r.x+r.bw/2,n.y]:[$_(n,n.y,-1),n.y,r.x-r.bw/2,n.y],n===e?l:[l[2],l[3],l[0],l[1]]}if(g){let r=Math.min(6,(p-f)/2),i=Math.min(Math.max((f+p)/2+n,f+r),p-r),a=t.y>e.y?1:-1;return[i,Q_(e,i,a),i,Q_(t,i,-a)]}if(_){let r=Math.min(6,(h-m)/2),i=Math.min(Math.max((m+h)/2+n,m+r),h-r),a=t.x>e.x?1:-1;return[$_(e,i,a),i,$_(t,i,-a),i]}let v=t.x>e.x?1:-1,y=t.y>e.y?1:-1,b=[$_(e,e.y,v),e.y,t.x,e.y,t.x,Q_(t,t.x,-y)],x=[e.x,Q_(e,e.x,y),e.x,t.y,$_(t,t.y,-v),t.y],S=Math.abs(t.x-e.x)>=Math.abs(t.y-e.y),C=S?b:x;if(r===void 0)return C;let w=nv(C,e,t,r);if(w===0)return C;let T=S?x:b,E=nv(T,e,t,r);if(E<w&&(C=T,w=E),w===0)return C;let D=[];return ev(e,t.x,t.y,D),ev(t,e.x,e.y,D),nv(D,e,t,r)<w?D:C}function iv(e,t,n){let r=e.length,i=e[0],a=e[1],o=e[r-2],s=e[r-1],c=e[2]-i,l=e[3]-a,u=Math.hypot(c,l);c/=u||1,l/=u||1;let d=o-e[r-4],f=s-e[r-3],p=Math.hypot(d,f);if(d/=p||1,f/=p||1,r===4&&t+n>u){let e=u/(t+n);t*=e,n*=e}t=Math.min(t,u),n=Math.min(n,p);let m=`M${X(i+c*t)},${X(a+l*t)}`;if(r===6){let r=Math.max(0,Math.min(R_,u-t,p-n));m+=`L${X(e[2]-c*r)},${X(e[3]-l*r)}Q${X(e[2])},${X(e[3])} ${X(e[2]+d*r)},${X(e[3]+f*r)}`}return m+=`L${X(o-d*n)},${X(s-f*n)}`,{d:m,sx:i,sy:a,sdx:-c,sdy:-l,ex:o,ey:s,edx:d,edy:f}}function av(e,t){let n=e.bw/2,r=e.bh/2,i=Math.max(1,Math.min(10+5*(t-1),n,r));if(Z_(e)){let t=e.x+n*Math.SQRT1_2,r=e.y-n*Math.SQRT1_2,a=2*Math.asin(Math.min(1,i/(2*n))),o=i=>Math.atan2(e.y-n*Math.sin(i)-r,e.x+n*Math.cos(i)-t);return[t,r,i,o(Math.PI/4+a),o(Math.PI/4-a)]}if(e.kind===0&&e.shape===`diam`){let t=Math.atan2(r,n);return[e.x+n/2,e.y-r/2,i,t+Math.PI,t]}return[e.x+n,e.y-r,i,Math.PI,Math.PI/2]}function ov(e,t,n,r){let[i,a,o,s,c]=av(e,t),l=s+n/o,u=c-r/o,d=(u-l)%(2*Math.PI);d<=0&&(d+=2*Math.PI);let f=i+o*Math.cos(l),p=a+o*Math.sin(l),m=i+o*Math.cos(u),h=a+o*Math.sin(u),g=i+o*Math.cos(s),_=a+o*Math.sin(s),v=i+o*Math.cos(c),y=a+o*Math.sin(c),b=Math.hypot(g-f,_-p),x=Math.hypot(v-m,y-h);return{d:`M${X(f)},${X(p)}A${X(o)},${X(o)} 0 ${+(d>Math.PI)} 1 ${X(m)},${X(h)}`,sx:g,sy:_,sdx:b>0?(g-f)/b:Math.sin(s),sdy:b>0?(_-p)/b:-Math.cos(s),ex:v,ey:y,edx:x>0?(v-m)/x:-Math.sin(c),edy:x>0?(y-h)/x:Math.cos(c)}}var sv=[.5,.3,.7,.15,.85];function cv(e,t,n,r,i,a,o){if(o===void 0)return!1;for(let s of o)if(s!==i&&s!==a&&Math.abs(e-s.x)<(n+s.bw)/2&&Math.abs(t-s.y)<(r+s.bh)/2)return!0;return!1}function lv(e,t,n,r,i,a,o){if(o===void 0)return .5;for(let s of sv)if(!cv(e[t]+(e[t+2]-e[t])*s,e[t+1]+(e[t+3]-e[t+1])*s,n,r,i,a,o))return s;return .5}function uv(e,t,n,r,i,a){let o=n[e[0]][0]===n[e[0]][2],s=-1/0,c=1/0,l=-q_,u=!1;for(let r=0;r<e.length;r++){let i=n[e[r]];if(o?i[0]!==i[2]:i[1]!==i[3])return 0;s=Math.max(s,o?Math.min(i[1],i[3]):Math.min(i[0],i[2])),c=Math.min(c,o?Math.max(i[1],i[3]):Math.max(i[0],i[2]));let a=t[e[r]];l+=(o?a.label.height:a.label.width+8)+q_;for(let n=0;n<r;n++){let r=t[e[n]];Math.abs(a.lx-r.lx)<(a.label.width+r.label.width)/2+8&&Math.abs(a.ly-r.ly)<(a.label.height+r.label.height)/2&&(u=!0)}}if(!u)return 0;if(l>c-s-2*mp)return l-(c-s-2*mp);let d=[],f=(s+c-l)/2;for(let n of e){let{label:e,lx:s,ly:c}=t[n],l=o?e.height:e.width+8,u=f+l/2;if(cv(o?s:u,o?u:c,e.width+8,e.height,r,i,a))return 0;d.push(u),f+=l+q_}return e.forEach((e,n)=>{o?t[e].ly=d[n]:t[e].lx=d[n]}),0}function dv(e,t,n,r,i,a){let o=new Set;for(let n=t;n!==void 0;n=e[n.index])o.add(n);let s,c=n;for(;c!==void 0&&!o.has(c);)s=c,c=e[c.index];if(c===void 0||s===void 0||c===t)return!1;let l=t;for(;e[l.index]!==c;)l=e[l.index];let u;if(r){if(l.row===s.row)return!1;u=Math.max(l.row,s.row)-1,c.rowGaps===W_&&(c.rowGaps=[])}else{let[e,t]=l.col<s.col?[l,s]:[s,l];if(t.col<e.col+e.span)return!1;u=t.col-1,c.colGaps===W_&&(c.colGaps=[])}let d=r?c.rowGaps:c.colGaps;return a.has(d)||a.set(d,d.slice()),d[u]=Math.max(d[u]??0,(a.get(d)[u]??0)+i),!0}function fv(e,t,n){return Oh(n,r=>pv(e,t,n,r))}function pv(e,t,n,r){let i=n.fontSize??16,a=Math.round(i*.875),o=n.measurer??bc(n.fontFamily,n.fontFamilyMono),s=n.padding??8,c=n.icons,l=t.block?.padding,u=Math.min(typeof l==`number`&&l>=0?Math.min(l,200):I_,r?6:1/0),d=r?80:L_,f=t=>{let n=[],r=e=>{for(let t of e)for(let e of t.split(`;`))n.push(e)};for(let n of t.classes&&t.classes.length>0?t.classes:G_){let t=e.classes.get(n);t&&r(t.styles)}return t.styles&&r(t.styles),nm(n)},p=(e,t)=>{let a=e.type,s=a===`space`?nm(V_):f(e),c=+!!s.bold|(s.italic?2:0),l=s.fontSize??i,p=0,m=``,h,g=0,_=0,v=0,y=0,b=0,x=0;if(a===`space`)p=3,h=Q(void 0,!1,o,l,d);else if(a===`composite`)p=2,h=Q(e.label,!1,o,l,r?Ch(n):4e3,c),v=h.height>0?h.height+4:0,g=h.width+2*u,_=v+2*u;else if(a===`block_arrow`){p=1,h=Q(e.label,!1,o,l,d,c);let t=!0;for(let e of h.lines)for(let n of e)(n.icon!==void 0||n.text.trim()!==``)&&(t=!1);y=T_(e.directions);let n=t?O_(y,0,0):O_(y,h.width,h.height);g=n.w,_=n.h,b=n.dx,x=n.dy}else{m=J_.get(a??``)??`rect`,h=Q(e.label,!1,o,l,d,c);let t=jm(m,h.width,h.height);g=t.w,_=m===`cyl`?Math.max(t.h,h.height+40):t.h,x=t.dy}return{children:[],columns:p===2?e.columns??-1:-1,span:p===3?1:e.widthInColumns??1,space:p===3,head:v,nw:g,nh:_,col:0,row:0,cols:0,heights:U_,rowGaps:W_,colGaps:W_,x:0,y:0,w:0,h:0,block:e,kind:p,index:t,shape:m,label:h,style:s,mask:y,dx:b,dy:x,bw:0,bh:0}},m=p(e.root,0);m.nw=0,m.nh=0;let h=[m],g=[],_=new Map;for(let e=0;e<h.length;e++){let t=h[e];if(t.kind===2)for(let e of t.block.children??H_){let n=p(e,h.length);t.children.push(n),g[n.index]=t,h.push(n),n.kind!==3&&_.set(e.id,n)}}let v=[],y=[],b=h.map(e=>e.nw),x=()=>{for(let e of h)e.nw=b[e.index];let e=F_(m,u);v.length=0,y.length=0;for(let e of h)e.kind===0&&Y_.has(e.shape)?(e.bw=e.nw,e.bh=e.nh):e.kind===1?(e.bw=e.span>1?e.w:e.nw,e.bh=e.nh):(e.bw=e.w,e.bh=e.kind===0&&X_.has(e.shape)?e.nh:e.h),e.kind===0&&e.shape===`cyl`&&(e.dy=Math.min(12,Math.max(6,e.bw/14))/2),e.kind===0||e.kind===1?v.push(e):e.head>0&&y.push({x:e.x,y:e.y-e.h/2+(e.head+u)/2+2,bw:e.label.width,bh:e.label.height});return e},S=x(),C=new Map,w=new Set,T=[],E=[];for(let t of e.edges){let e=_.get(t.start??``),n=_.get(t.end??``);if(e===void 0||n===void 0)continue;let r=Math.min(e.index,n.index)*h.length+Math.max(e.index,n.index);C.set(r,(C.get(r)??0)+1),t.label&&w.add(r),T.push([e,n]),E.push(t)}let D=E.length*v.length<=K_?v:void 0,O=[],k=new Map,A=[],j=()=>{let e=new Map;O.length=0,k.clear();for(let t=0;t<E.length;t++){let[n,r]=T[t],i=Math.min(n.index,r.index)*h.length+Math.max(n.index,r.index),s=C.get(i)??1,c=e.get(i)??0;e.set(i,c+1);let l=Q(E[t].label,!1,o,a,L_),u,d,f;if(n===r){let[e,t,r]=av(n,c+1);u=[],d=e+r+6+l.width/2,f=t-r/2}else{let e=w.has(i)?Math.round(a*1.5)+2:14;u=rv(n,r,(c-(s-1)/2)*e,D);let o=u.length,p=Math.abs(u[2]-u[0])+Math.abs(u[3]-u[1]),m=Math.abs(u[o-2]-u[o-4])+Math.abs(u[o-1]-u[o-3]),h=o===6&&m>p?2:0,g=l.width>0?lv(u,h,l.width+8,l.height,n,r,D):.5;if(d=u[h]+(u[h+2]-u[h])*g,f=u[h+1]+(u[h+3]-u[h+1])*g,l.width>0&&s>1){A[t]=u.slice(h,h+4);let e=k.get(i);e?e.push(t):k.set(i,[t])}}O.push({edge:E[t],points:u,loop:n===r?c+1:0,label:l,lx:d,ly:f})}},M=e=>{j();let t=D&&[...D,...y],n=new Map,i=!1;for(let a of k.values()){if(a.length<2)continue;let[o,s]=T[a[0]],c=uv(a,O,A,o,s,t),l=A[a[0]][0]===A[a[0]][2];e&&c>0&&(l||!r)&&dv(g,o,s,l,Math.ceil(c),n)&&(i=!0)}return i},N=()=>{let e=0;for(let t=0;t<O.length;t++){let n=O[t];for(let r=t+1;r<O.length;r++){let t=O[r],i=(n.label.width+8)/2,a=(t.label.width+8)/2,o=Math.min(n.lx+i,t.lx+a)-Math.max(n.lx-i,t.lx-a),s=Math.min(n.ly+n.label.height/2,t.ly+t.label.height/2)-Math.max(n.ly-n.label.height/2,t.ly-t.label.height/2);n.label.width>0&&t.label.width>0&&o>0&&s>0&&(e+=o*s)}}return e},P=0,F=0,I=0,L=0,R=(e,t,n,r)=>{e-n/2<P&&(P=e-n/2),e+n/2>I&&(I=e+n/2),t-r/2<F&&(F=t-r/2),t+r/2>L&&(L=t+r/2)},z=()=>{P=0,F=0,I=S.width,L=S.height;for(let e=0;e<O.length;e++){let t=O[e];if(t.loop>0){let[n,r,i]=av(T[e][0],t.loop);R(n,r,2*i+2,2*i+2)}t.label.width>0&&R(t.lx,t.ly,t.label.width+8,t.label.height)}return I-P};if(M(E.length*E.length<=K_)){let e=N(),t=z(),r=!0;for(let e=0;e<3&&r;e++)S=x(),r=M(e<2);let i=z(),a=n.maxWidth!==void 0&&n.maxWidth>0?n.maxWidth:1/0;if(N()>e-1||i>t&&Math.ceil(i+2*s)>a){for(let e of h)e.rowGaps=W_,e.colGaps=W_;S=x(),M(!1)}}z();let B=g_(e.title,o,i,r?Ch(n):4e3),V=B.height>0?B.height+12:0,H=Math.max(I-P,B.width),U=s-P+(H-(I-P))/2,ee=s+V-F;for(let e of h)e.x+=U,e.y+=ee;let te=Math.ceil(H+2*s),W=Math.ceil(L-F+V+2*s),ne=``,G=``,re=[];for(let e=1;e<h.length;e++){let t=h[e];if(t.kind===3)continue;let n=im((t.block.classes??V_).join(` `)),r=Y(t.block.id);if(t.kind===2){let e=t.y-t.h/2;fl(t.style.shape)&&re.push({box:[t.x-t.w/2,e,t.x+t.w/2,e+t.h],shape:t.style.shape}),ne+=`<g class="pele-cluster${n}" data-id="${r}"><rect x="${X(t.x-t.w/2)}" y="${X(e)}" width="${X(t.w)}" height="${X(t.h)}" fill="var(--_a)"${Gp(t.style.shape)?``:` fill-opacity="0.5"`} stroke="var(--_b)"${Kp(t.style.shape)}/>`+Z(t.label,t.x,e+(t.head+u)/2+2,` class="pele-cluster-label"${pl(t.style,`var(--_m)`)}${t.style.text}`,c)+`</g>`;continue}let i=t.kind===1,a=t.label;if(t.span>1&&t.label.width>0&&t.label.lines.length>1&&t.bw>t.nw&&(i||!Y_.has(t.shape))){let e=+!!t.style.bold|(t.style.italic?2:0),n=t.label.width+(t.bw-t.nw);a=Q(t.block.label,!1,o,t.label.size,n,e)}G+=`<g class="pele-node pele-shape-${i?`block-arrow`:t.shape}${n}" data-id="${r}" transform="translate(${X(t.x)},${X(t.y)})">`+(i?k_(t.mask,t.bw,t.bh,z_+t.style.shape):Mm(t.shape,t.bw,t.bh,z_+t.style.shape,B_+t.style.line))+Z(a,t.dx,t.dy,` class="pele-label"${i||Im(t.shape)?pl(t.style):``}${t.style.text}`,c)+`</g>`}let K=``,ie=``,q=``;for(let e=0;e<O.length;e++){let{edge:t,points:n,loop:r,label:i}=O[e],a=t.arrowTypeStart??``,o=t.arrowTypeEnd??``,s;if(r>0)s=ov(T[e][0],r,bp(a),bp(o));else{for(let e=0;e<n.length;e+=2)n[e]+=U,n[e+1]+=ee;s=iv(n,bp(a),bp(o))}let l=Np(s.d,[s.sx,s.sy,s.ex,s.ey],re);l===``&&(K+=Ip(s,a,o,``,t.thickness===`thick`));let u=Y(t.id);if(ie+=`<g class="pele-edge" data-id="${u}"${l?` stroke="${l}"`:``}><path d="${s.d}"${t.thickness===`thick`?` stroke-width="2.5"`:``}${t.pattern===`dotted`?` stroke-dasharray="3 4"`:``}/>`+xp(a,s.sx,s.sy,s.sdx,s.sdy,l||`var(--_l)`)+xp(o,s.ex,s.ey,s.edx,s.edy,l||`var(--_l)`)+`</g>`,i.width>0){let n=O[e].lx+U,r=O[e].ly+ee;q+=Rp(t.id,i,n,r,``,c)}}return{svg:lm(`block`,te,W,i,n,e,Z(B,te/2,s+B.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(ne?`<g class="pele-clusters">${ne}</g>`:``)+Lp(K)+(ie?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${ie}</g>`:``)+`<g class="pele-nodes">${G}</g>`+(q?`<g class="pele-edge-labels" font-size="${a}">${q}</g>`:``)),width:te,height:W,links:[]}}var mv={type:`block`,math:!0,parse(e,t,n){let r=new c_;return r.title=n,h_(e,r),r},render:fv},hv=new Set([`label`,`type`,`descr`,`techn`,`sprite`,`tags`,`link`,`bgColor`,`fontColor`,`borderColor`,`shadowing`,`shape`,`legendText`,`legendSprite`]),gv=new Set([`label`,`descr`,`techn`,`sprite`,`tags`,`link`,`textColor`,`lineColor`]);function _v(e,t){let{key:n,value:r}=t;`from`in e&&(n===`offsetX`||n===`offsetY`)?e[n]=parseInt(r):(`from`in e?gv:hv).has(n)?e[n]=r:(e.extra??=new Map).set(n,r)}function vv(e,t,n){n!==void 0&&(typeof n==`string`?e[t]=n:_v(e,n))}function yv(e,t,n){n===void 0?e[t]??=``:vv(e,t,n)}function bv(e,t){e.labelAttr=void 0,typeof t==`object`?(e.label=``,e.labelAttr=t,_v(e,t)):e.label=t??``}var xv=class{type=`c4`;c4Type;title;accTitle;accDescr;shapes=[];boundaries=[{alias:`global`,label:`global`,type:`global`,parent:void 0}];rels=[];shapeInRow=4;boundaryInRow=2;shapeIndex=new Map;boundaryIndex=new Map;relIndex=new Map;current=this.boundaries[0];stack=[];setC4Type(e){this.c4Type=e}setTitle(e){this.title=e}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
83
|
+
`)}element(e,t,n,r){let i=typeof n==`string`?t.get(n):void 0;return i===void 0&&(i={alias:``,label:``,parent:void 0},e.push(i),typeof n==`string`?(i.alias=n,t.set(n,i)):(i.aliasAttr=n,_v(i,n))),bv(i,r),i}addPersonOrSystem(e,t){let n=this.element(this.shapes,this.shapeIndex,t[0],t[1]);yv(n,`descr`,t[2]),this.finishShape(n,e,t,3)}addContainer(e,t){let n=this.element(this.shapes,this.shapeIndex,t[0],t[1]);yv(n,`techn`,t[2]),yv(n,`descr`,t[3]),this.finishShape(n,e,t,4)}addComponent(e,t){this.addContainer(e,t)}finishShape(e,t,n,r){vv(e,`sprite`,n[r]),vv(e,`tags`,n[r+1]),vv(e,`link`,n[r+2]),e.kind=t,e.parent=this.current}boundary(e,t){let n=this.element(this.boundaries,this.boundaryIndex,e[0],e[1]);return e[2]===void 0?n.type=t:vv(n,`type`,e[2]),n}open(e){e.parent=this.current,this.stack.push(this.current),this.current=e}addPersonOrSystemBoundary(e,t=`system`){let n=this.boundary(e,t);vv(n,`tags`,e[3]),vv(n,`link`,e[4]),this.open(n)}addContainerBoundary(e){this.addPersonOrSystemBoundary(e,`container`)}addDeploymentNode(e,t){let n=this.boundary(t,`node`);yv(n,`descr`,t[3]),vv(n,`sprite`,t[4]),vv(n,`tags`,t[5]),vv(n,`link`,t[6]),n.nodeType=e,this.open(n)}popBoundaryParseStack(){this.current=this.stack.pop()??this.boundaries[0]}addRel(e,t){let n=t[0],r=t[1];if(n===void 0||r===void 0||t[2]===void 0)return;let i=typeof n==`string`&&typeof r==`string`,a=i?this.relIndex.get(n)?.get(r):void 0;if(a===void 0){if(a={type:e,from:``,to:``,label:``},this.rels.push(a),i){let e=this.relIndex.get(n);e===void 0&&this.relIndex.set(n,e=new Map),e.set(r,a)}typeof n==`string`?a.from=n:a.fromAttr=n,typeof r==`string`?a.to=r:a.toAttr=r}a.type=e,bv(a,t[2]),yv(a,`techn`,t[3]),yv(a,`descr`,t[4]),vv(a,`sprite`,t[5]),vv(a,`tags`,t[6]),vv(a,`link`,t[7])}getC4Shape(e){return this.shapeIndex.get(e)??this.boundaryIndex.get(e)}updateElStyle(e,t){let n=typeof t[0]==`string`?this.getC4Shape(t[0]):void 0;n!==void 0&&(vv(n,`bgColor`,t[1]),vv(n,`fontColor`,t[2]),vv(n,`borderColor`,t[3]),vv(n,`shadowing`,t[4]),vv(n,`shape`,t[5]),vv(n,`sprite`,t[6]),vv(n,`techn`,t[7]),vv(n,`legendText`,t[8]),vv(n,`legendSprite`,t[9]))}updateRelStyle(e,t){let n=t[0],r=t[1],i=typeof n==`string`&&typeof r==`string`?this.relIndex.get(n)?.get(r):void 0;if(i===void 0)return;vv(i,`textColor`,t[2]),vv(i,`lineColor`,t[3]);let a=t[4],o=t[5];typeof a==`string`?i.offsetX=parseInt(a):a!==void 0&&_v(i,a),typeof o==`string`?i.offsetY=parseInt(o):o!==void 0&&_v(i,o)}updateLayoutConfig(e,t){let n=e=>e===void 0?NaN:parseInt(typeof e==`string`?e:e.value),r=n(t[0]),i=n(t[1]);r>=1&&(this.shapeInRow=r),i>=1&&(this.boundaryInRow=i)}},Sv=`$end.INVALID.direction_tb.direction_bt.direction_rl.direction_lr.title.accDescription.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.NEWLINE.C4_CONTEXT.C4_CONTAINER.C4_COMPONENT.C4_DYNAMIC.C4_DEPLOYMENT.PERSON.PERSON_EXT.SYSTEM.SYSTEM_DB.SYSTEM_QUEUE.SYSTEM_EXT.SYSTEM_EXT_DB.SYSTEM_EXT_QUEUE.CONTAINER.CONTAINER_DB.CONTAINER_QUEUE.CONTAINER_EXT.CONTAINER_EXT_DB.CONTAINER_EXT_QUEUE.COMPONENT.COMPONENT_DB.COMPONENT_QUEUE.COMPONENT_EXT.COMPONENT_EXT_DB.COMPONENT_EXT_QUEUE.ENTERPRISE_BOUNDARY.SYSTEM_BOUNDARY.BOUNDARY.CONTAINER_BOUNDARY.NODE.NODE_L.NODE_R.REL.BIREL.REL_U.REL_D.REL_L.REL_R.REL_B.REL_INDEX.UPDATE_EL_STYLE.UPDATE_REL_STYLE.UPDATE_LAYOUT_CONFIG.EOF_IN_STRUCT.ATTRIBUTE_EMPTY.STR.STR_KEY.STR_VALUE.LBRACE.RBRACE.EOF`.split(`.`),Cv=new Map([[`C4Context`,14],[`C4Container`,15],[`C4Component`,16],[`C4Dynamic`,17],[`C4Deployment`,18],[`Person`,19],[`Person_Ext`,20],[`System`,21],[`SystemDb`,22],[`SystemQueue`,23],[`System_Ext`,24],[`SystemDb_Ext`,25],[`SystemQueue_Ext`,26],[`Container`,27],[`ContainerDb`,28],[`ContainerQueue`,29],[`Container_Ext`,30],[`ContainerDb_Ext`,31],[`ContainerQueue_Ext`,32],[`Component`,33],[`ComponentDb`,34],[`ComponentQueue`,35],[`Component_Ext`,36],[`ComponentDb_Ext`,37],[`ComponentQueue_Ext`,38],[`Enterprise_Boundary`,39],[`System_Boundary`,40],[`Boundary`,41],[`Container_Boundary`,42],[`Deployment_Node`,43],[`Node`,43],[`Node_L`,44],[`Node_R`,45],[`Rel`,46],[`BiRel`,47],[`Rel_Up`,48],[`Rel_U`,48],[`Rel_Down`,49],[`Rel_D`,49],[`Rel_Left`,50],[`Rel_L`,50],[`Rel_Right`,51],[`Rel_R`,51],[`Rel_Back`,52],[`RelIndex`,53],[`UpdateElementStyle`,54],[`UpdateRelStyle`,55],[`UpdateLayoutConfig`,56]]),wv=[/.*direction\s+TB[^\n]*/y,/.*direction\s+BT[^\n]*/y,/.*direction\s+RL[^\n]*/y,/.*direction\s+LR[^\n]*/y],Tv=/[\n\r\u2028\u2029]/g,Ev=/title[^\S\r\n]*(?=[\r\n]|$)\s*/y;function Dv(e){let t=e.length,n=[],r=[],i=[],a=0,o=9,s=0,c=!1,l=-2,u=-1,d=0,f=(e,t,a)=>{n.push(e),r.push(t),i.push(a),s=a},p=n=>{for(;n<t&&J(e.charCodeAt(n));)n++;return n},m=(n,r)=>{let i=e.indexOf(n,r);return i===-1?t:i},h=(n,r)=>{let i=s+n.length;if(!e.startsWith(n,s)||!J(e.charCodeAt(i)))return!1;let a=++i;for(;i<t;){let t=e.charCodeAt(i);if(t===35||t===10||t===59)break;i++}return i!==a&&(f(r,s,i),!0)};for(;;){if(c){f(0,t,t);break}s>=t&&(c=!0);let n=e.charCodeAt(s);if(a===0){if(s>=t){f(64,t,t);continue}if(l!==-1&&s>=d&&(l<s&&(l=e.indexOf(`direction`,s)),l!==-1&&(u<s&&(Tv.lastIndex=s,u=Tv.test(e)?Tv.lastIndex-1:t),l<u))){let t=!1;for(let n=0;n<4&&!t;n++)wv[n].lastIndex=s,wv[n].test(e)&&(f(2+n,s,wv[n].lastIndex),t=!0);if(t)continue;d=u}if(n===116){if(Ev.lastIndex=s,Ev.test(e)){s=Ev.lastIndex;continue}if(h(`title`,6))continue}if(n===97){if(h(`accDescription`,7))continue;let t=e.startsWith(`accTitle`,s);if(t||e.startsWith(`accDescr`,s)){let n=p(s+8),r=e.charCodeAt(n);if(r===58){f(t?8:10,s,p(n+1)),o=t?9:11,a=7;continue}if(r===123&&!t){s=p(n+1),a=8;continue}}}if(n===37&&e.charCodeAt(s+1)===37){let n=m(`
|
|
84
|
+
`,s+2);for(;n<t&&(e.charCodeAt(n)===10||e.charCodeAt(n)===13);)n++;s=n;continue}if(J(n)){let n=s,r=-1;for(;n<t;){let t=e.charCodeAt(n);if(!J(t))break;t===10&&(r=n),n++}r===-1?s=n:f(13,s,r+1);continue}if(n===123){f(62,s,s+1);continue}if(n===125){f(63,s,s+1);continue}if(Ls(n)){let n=s+1;for(;n<t&&Ls(e.charCodeAt(n));)n++;let r=n-s<=19?Cv.get(e.slice(s,n)):void 0;if(r!==void 0){r>18&&(a=1),f(r,s,n);continue}}f(1,s,s);break}if(a===1){if(s>=t)f(57,t,t);else if(n===40){let t=s+1;for(;e.charCodeAt(t)===32;)t++;e.charCodeAt(t)===44?f(58,s,t+1):s++,a=2}else if(n===41)s++,a=0;else{f(1,s,s);break}}else if(a===2){if(s>=t)continue;if(n===41)s++,a=0;else if(n===44)e.charCodeAt(s+1)===44?f(58,s,s+2):s++;else{let t=s;for(;e.charCodeAt(t)===32;)t++;let n=e.charCodeAt(t);n===34?e.charCodeAt(t+1)===34?f(58,s,t+2):(s=t+1,a=3):n===36?(s=t+1,a=4):f(59,s,m(`,`,s))}}else if(a===3)n===34?(s++,a=2):f(59,s,m(`"`,s));else if(a===4)f(60,s,m(`=`,s)),a=5;else if(a===5){if(s>=t)continue;let r=s+1;if(n===61)for(;e.charCodeAt(r)===32;)r++;if(n!==61||e.charCodeAt(r)!==34){f(1,s,s);break}s=r+1,a=6}else if(a===6){if(s>=t)continue;n===34?(s++,a=2):f(61,s,m(`"`,s))}else a===7?(f(o,s,m(`
|
|
85
|
+
`,s)),a=0):n===125?(s++,a=0):f(12,s,m(`}`,s))}return{types:n,starts:r,ends:i}}var Ov=[`person`,`external_person`,`system`,`system_db`,`system_queue`,`external_system`,`external_system_db`,`external_system_queue`,`container`,`container_db`,`container_queue`,`external_container`,`external_container_db`,`external_container_queue`,`component`,`component_db`,`component_queue`,`external_component`,`external_component_db`,`external_component_queue`],kv=[`rel`,`birel`,`rel_u`,`rel_d`,`rel_l`,`rel_r`,`rel_b`,`rel`],Av=[`node`,`nodeL`,`nodeR`],jv=`'direction_tb', 'direction_bt', 'direction_rl', 'direction_lr', 'C4_CONTEXT', 'C4_CONTAINER', 'C4_COMPONENT', 'C4_DYNAMIC', 'C4_DEPLOYMENT'`,Mv=`'STR', 'STR_KEY', 'ATTRIBUTE', 'ATTRIBUTE_EMPTY'`;function Nv(e){return e===6||e===7||e===8||e===10||e===12}function Pv(e){return e>=19&&e<=56}function Fv(e,t){let{types:n,starts:r,ends:i}=Dv(e),a=0,o=t=>e.slice(r[t],i[t]),s=t=>{let i=n[a];throw i===1?zo(`c4`,e,r[a],``,!0):zo(`c4`,e,r[a],`Expecting ${t}, got '${Sv[i]}'`)},c=e=>{n[a]!==e&&s(`'${Sv[e]}'`),a++},l=()=>{let e=[];for(;;){let t=n[a];if(t===59)e.push(o(a++).trim());else if(t===58)e.push(``),a++;else if(t===60)a++,n[a]!==61&&s(`'STR_VALUE'`),e.push({key:o(a-1).trim(),value:o(a).trim()}),a++;else break}return e.length===0&&s(Mv),e},u=e=>{e===6?t.setTitle(o(a++).substring(6)):e===7?t.setAccDescription(o(a++).substring(15)):e===12?t.setAccDescription(o(a++).trim()):(a++,e===8?(n[a]!==9&&s(`'acc_title_value'`),t.setTitle(o(a++).trim())):(n[a]!==11&&s(`'acc_descr_value'`),t.setAccDescription(o(a++).trim())))},d=e=>{a++;let r=l();if(e<=26)t.addPersonOrSystem(Ov[e-19],r);else if(e<=32)t.addContainer(Ov[e-19],r);else if(e<=38)t.addComponent(Ov[e-19],r);else{if(e<=45)return e===39?r.splice(2,0,`ENTERPRISE`):e===40?r.splice(2,0,`SYSTEM`):e===42&&r.splice(2,0,`CONTAINER`),e>=43?t.addDeploymentNode(Av[e-43],r):e===42?t.addContainerBoundary(r):t.addPersonOrSystemBoundary(r),n[a]===62?(a++,c(13)):n[a]===13?(a++,c(62),n[a]===13&&a++):s(`'NEWLINE', 'LBRACE'`),!0;e<=53?(e===53&&r.splice(0,1),t.addRel(kv[e-46],r)):e===54?t.updateElStyle(`update_el_style`,r):e===55?t.updateRelStyle(`update_rel_style`,r):t.updateLayoutConfig(`update_layout_config`,r)}return!1},f=n[a];(f<14||f>18)&&s(jv),a++,c(13);let p=0,m=0;for(;;){let e=n[a];if(m===3||m===4){if(e===13){a++,m=2;continue}if(m===3&&Pv(e)){m=1;continue}}else if(Pv(e)){d(e)?(p++,m=1):m=4;continue}else if(Nv(e)&&m!==1){u(e),m=3;continue}else m!==2&&s(`'title', 'accDescription', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'PERSON', 'REL'`);if(p>0)e!==63&&s(`'NEWLINE', 'RBRACE'`),a++,t.popBoundaryParseStack(),p--,m=4;else{e!==64&&s(`'NEWLINE', 'EOF'`),a++,c(0),t.setC4Type(o(0));return}}}var Iv=/\s/;function Lv(e,t,n,r,i=0){let a=[];for(let o of e.split(`
|
|
86
|
+
`)){let e=Array.from(o);e.length===0&&a.push(``);let s=0;for(;s<e.length;){let o=a=>t.width(e.slice(s,s+a).join(``),n,i)<=r,c=1;for(;c<e.length-s&&o(c);)c=Math.min(e.length-s,c*2);let l=1;for(;l<c;){let e=Math.ceil((l+c)/2);o(e)?l=e:c=e-1}let u=l,d=s+u<e.length;if(d&&!Iv.test(e[s+u])){for(let t=u-1;t>0;t--)if(Iv.test(e[s+t])){u=t+1;break}}let f=e.slice(s,s+u).join(``);for(a.push(d&&f.trimEnd()||f),s+=u;d&&s<e.length&&Iv.test(e[s]);)s++}}e===``&&(a.length=0);let o=a.map(e=>t.width(e,n,i)),s=0;for(let e of o)s=Math.max(s,e);let c=Math.round(n*1.5);return{lines:a.map((e,t)=>[{text:e,style:i,width:o[t]}]),widths:o,width:s,height:a.length*c,size:n,lineHeight:c}}function Rv(e,t,n){if(e.width<=n)return e;let r=[],i=[];for(let a=0;a<e.lines.length;a++){if(e.widths[a]<=n){r.push(e.lines[a]),i.push(e.widths[a]);continue}let o=[],s=0,c=()=>{r.push(o),i.push(s),o=[],s=0};for(let r of e.lines[a])if(r.icon!==void 0||r.math)o.length&&s+r.width>n&&c(),o.push(r),s+=r.width;else for(let i of Array.from(r.text)){let a=o[o.length-1],l=a&&a.icon===void 0&&a.math===void 0&&a.style===r.style,u=t.width(l?a.text+i:i,e.size,r.style)-(l?a.width:0);o.length&&s+u>n&&(c(),a=void 0,u=t.width(i,e.size,r.style)),a&&a.icon===void 0&&a.math===void 0&&a.style===r.style?(a.text+=i,a.width+=u):o.push({text:i,style:r.style,width:u}),s+=u}(o.length||!e.lines[a].length)&&c()}let a=0;for(let e of i)a=Math.max(a,e);let o={...e,lines:r,widths:i,width:a,height:r.length*e.lineHeight};return e.heights?vh(o):o}function zv(e,t,n,r){let i=Hc(e),a=`<text`+Uc(r,i),o=``;for(let s=0;s<e.lines.length;s++){let c=e.lines[s],l=n+(s+.5)*e.lineHeight;if(c.some(e=>e.icon!==void 0)){let n=e.widths[s];o+=Z({...e,lines:[c],widths:[n],width:n,height:e.lineHeight},t+n/2,l,r);continue}let u=``;for(let e of c){let t=Vc(e.style&~i);u+=t?`<tspan${t}>${Ec(e.text)}</tspan>`:Ec(e.text)}u!==``&&(o+=`${a} x="${X(t)}" y="${X(l+e.size*.35)}" text-anchor="start" xml:space="preserve">${u}</text>`)}return o}var Bv=28,Vv=20,Hv=7,Uv=8,Wv=30,Gv=88,Kv=160,qv=8,Jv=26,Yv=e=>Math.min(12,Math.max(6,e/14)),Xv=e=>Math.min(12,e/4);function Zv(e,t,n,r,i,a,o,s){let c=0,l=1;if(o===0){if(i<e||i>n)return 1/0}else{let t=(e-i)/o,r=(n-i)/o;c=Math.max(c,Math.min(t,r)),l=Math.min(l,Math.max(t,r))}if(s===0){if(a<t||a>r)return 1/0}else{let e=(t-a)/s,n=(r-a)/s;c=Math.max(c,Math.min(e,n)),l=Math.min(l,Math.max(e,n))}return c<=l?c:1/0}function Qv(e,t,n,r,i,a,o,s){let c=o/n,l=s/r,u=(i-e)/n,d=(a-t)/r,f=c*c+l*l,p=2*(c*u+l*d),m=u*u+d*d-1,h=p*p-4*f*m;if(f===0||h<0)return 1/0;let g=(-p-Math.sqrt(h))/(2*f);return g>=0&&g<=1?g:m<=0?0:1/0}function $v(e,t,n,r,i){let{x:a,y:o,w:s,h:c}=e,l=r-t,u=i-n;if(e.form===`person`)return Math.min(Zv(a,o+Jv,a+s,o+c,t,n,l,u),Qv(a+s/2,o+14,13,13,t,n,l,u));if(e.form===`cyl`){let e=Yv(s);return Math.min(Zv(a,o+e,a+s,o+c-e,t,n,l,u),Qv(a+s/2,o+e,s/2,e,t,n,l,u),Qv(a+s/2,o+c-e,s/2,e,t,n,l,u))}if(e.form===`h-cyl`){let e=Xv(c);return Math.min(Zv(a+e,o,a+s-e,o+c,t,n,l,u),Qv(a+e,o+c/2,e,c/2,t,n,l,u),Qv(a+s-e,o+c/2,e,c/2,t,n,l,u))}return Zv(a,o,a+s,o+c,t,n,l,u)}function ey(e,t,n,r,i){for(let a=2;a<e.length;a+=2){let o=e[a-2],s=e[a-1];if(Zv(t,n,r,i,o,s,e[a]-o,e[a+1]-s)<=1)return!0}return!1}function ty(e,t){return e.x<=t.x&&e.y<=t.y&&e.x+e.w>=t.x+t.w&&e.y+e.h>=t.y+t.h}function ny(e,t,n){let r=e.x+e.w/2,i=e.y+e.h/2,a=t.x+t.w/2,o=t.y+t.h/2,s=ty(e,t);if(s||ty(t,e)){let n=s?e:t,r=s?t:e,i=r.x+r.w/2,a=r.y+r.h/2,o=r.x-n.x,c=n.x+n.w-r.x-r.w,l=r.y-n.y,u=n.y+n.h-r.y-r.h,d=Math.min(o,c,l,u),f=d===o?n.x:d===c?n.x+n.w:i,p=d===o||d===c?a:d===u?n.y+n.h:n.y,m=Math.min($v(r,f,p,i,a),1),h=f+(i-f)*m,g=p+(a-p)*m;return s?[f,p,h,g]:[h,g,f,p]}let c=r,l=i,u=a,d=o,f=Math.max(e.x,t.x),p=Math.min(e.x+e.w,t.x+t.w),m=Math.max(e.y,t.y),h=Math.min(e.y+e.h,t.y+t.h);f<p?c=u=(f+p)/2:m<h&&(l=d=(m+h)/2);let g=Math.hypot(u-c,d-l)||1,_=-(d-l)/g*n,v=(u-c)/g*n,y=$v(e,u+_,d+v,c+_,l+v),b=$v(t,c+_,l+v,u+_,d+v);return y<=1&&b<=1?(c+=_,l+=v,u+=_,d+=v):(c=r,l=i,u=a,d=o,y=Math.min($v(e,u,d,c,l),1),b=Math.min($v(t,c,l,u,d),1)),[u+(c-u)*y,d+(l-d)*y,c+(u-c)*b,l+(d-l)*b]}var ry=6,iy=3,ay=12,oy=class{upright=[];level=[];frames=[[],[]];taken=new Map;squeezed=0;free(e,t,n,r){let i=Math.min(n,r),a=Math.max(n,r),o=(e,n)=>{for(let r=0;r<e.length;r+=3)if(Math.abs(e[r]-t)<n&&e[r+1]<a&&e[r+2]>i)return!0;return!1};return!o(e?this.upright:this.level,ry)&&!o(this.frames[+!e],iy)}crossings(e){let t=0;for(let n=2;n<e.length;n+=2){let r=e[n]===e[n-2],i=r?e[n]:e[n+1],a=Math.min(r?e[n-1]:e[n-2],r?e[n+1]:e[n]),o=Math.max(r?e[n-1]:e[n-2],r?e[n+1]:e[n]),s=r?this.level:this.upright;for(let e=0;e<s.length;e+=3)s[e]>a&&s[e]<o&&s[e+1]<i&&s[e+2]>i&&t++}return t}frame(e){this.frames[0].push(e.x,e.y,e.y+e.h,e.x+e.w,e.y,e.y+e.h),this.frames[1].push(e.y,e.x,e.x+e.w,e.y+e.h,e.x,e.x+e.w)}take(e){for(let t=2;t<e.length;t+=2)e[t]===e[t-2]?this.upright.push(e[t],Math.min(e[t-1],e[t+1]),Math.max(e[t-1],e[t+1])):e[t+1]===e[t-1]&&this.level.push(e[t+1],Math.min(e[t-2],e[t]),Math.max(e[t-2],e[t]))}ports(e,t,n,r,i){let a=this.taken.get(e)??[],o=[];for(let e=0;e<9&&o.length<4;e++){let s=n+(e&1?1:-1)*Math.ceil(e/2)*ay;if(s<r||s>i)continue;let c=!0;for(let e=0;e<a.length;e+=2)a[e]===t&&Math.abs(a[e+1]-s)<ay&&(c=!1);c&&o.push(s)}return o.length?o:[n]}claim(e,t,n){let r=this.taken.get(e);r?r.push(t,n):this.taken.set(e,[t,n])}};function sy(e,t,n){let r=e.length,i=Math.sign(e[2]-e[0]),a=Math.sign(e[3]-e[1]),o=`M${X(e[0]+i*t)},${X(e[1]+a*t)}`;for(let t=2;t<r-2;t+=2){let n=e[t],r=e[t+1],i=Math.sign(n-e[t-2]),a=Math.sign(r-e[t-1]),s=Math.sign(e[t+2]-n),c=Math.sign(e[t+3]-r),l=Math.min(Uv,Math.abs(n-e[t-2]+r-e[t-1])/2,Math.abs(e[t+2]-n+e[t+3]-r)/2);o+=`${i?`H`+X(n-i*l):`V`+X(r-a*l)}Q${X(n)},${X(r)} ${X(n+s*l)},${X(r+c*l)}`}let s=Math.sign(e[r-2]-e[r-4]),c=Math.sign(e[r-1]-e[r-3]);return o+(s?`H`+X(e[r-2]-s*n):`V`+X(e[r-1]-c*n))}function cy(e,t,n,r){for(let i of t)if(i!==n&&i!==r&&ey(e,i.x,i.y,i.x+i.w,i.y+i.h))return!1;return!0}function ly(e,t,n,r,i){let a=e.length;return{d:sy(e,n,r),sx:e[0],sy:e[1],sdx:-Math.sign(e[2]-e[0]),sdy:-Math.sign(e[3]-e[1]),ex:e[a-2],ey:e[a-1],edx:Math.sign(e[a-2]-e[a-4]),edy:Math.sign(e[a-1]-e[a-3]),x0:e[t],y0:e[t+1],x1:e[t+2],y1:e[t+3],nx:0,ny:0,lean:0,room:Kv,...i,points:e}}function uy(e,t){let n=[],r=(e+t)/2,i=Math.max(Hv,(t-e)/4);for(let a=0;a<9;a++){let o=r+(a&1?1:-1)*Math.ceil(a/2)*i;o>=e+ry&&o<=t-ry&&n.push(o)}return n}function dy(e,t,n,r,i,a){let o=e.x+e.w/2,s=e.y+e.h/2,c=t.x+t.w/2,l=t.y+t.h/2,u,d=(i,a,o)=>{if(!cy(i,n,e,t))return;for(let e=2;e<i.length;e+=2){let t=i[e]===i[e-2];if(!r.free(t,t?i[e]:i[e+1],t?i[e-1]:i[e-2],t?i[e+1]:i[e]))return}let s=r.crossings(i)*1e6;for(let e=2;e<i.length;e+=2)s+=Math.abs(i[e]-i[e-2])+Math.abs(i[e+1]-i[e-1]);(!u||s<u.cost)&&(u={points:i,cost:s,upright:a,sides:o})};if(e.x+e.w<=t.x||t.x+t.w<=e.x){let n=c>o,i=Math.sign(l-s),a=n?[1,0]:[0,1],f=uy(n?e.x+e.w:t.x+t.w,n?t.x:e.x);e:for(let n of r.ports(e,a[0],s+i*e.h/4,e.y+8,e.y+e.h-8))for(let s of r.ports(t,a[1],l-i*t.h/4,t.y+8,t.y+t.h-8))for(let r of f){let i=r+(o-r)*Math.min($v(e,r,n,o,n),1),l=r+(c-r)*Math.min($v(t,r,s,c,s),1),f=u;if(d([i,n,r,n,r,s,l,s],!0,a),u!==f)break e}}if(e.y+e.h<=t.y||t.y+t.h<=e.y){let n=l>s,i=Math.sign(c-o),a=n?[3,2]:[2,3],f=uy(n?e.y+e.h:t.y+t.h,n?t.y:e.y);e:for(let n of r.ports(e,a[0],o+i*e.w/4,e.x+8,e.x+e.w-8))for(let o of r.ports(t,a[1],c-i*t.w/4,t.x+8,t.x+t.w-8))for(let r of f){let i=r+(s-r)*Math.min($v(e,n,r,n,s),1),c=r+(l-r)*Math.min($v(t,o,r,o,l),1),f=u;if(d([n,i,n,r,o,r,o,c],!1,a),u!==f)break e}}if(!u)return;let{points:f,upright:p,sides:m}=u;return r.take(f),r.claim(e,m[0],p?f[1]:f[0]),r.claim(t,m[1],p?f[7]:f[6]),ly(f,2,i,a,{room:p?Gv:Kv})}function fy(e,t,n,r,i,a,o){if(e===t){let t=Math.min(e.h/2-4,10),n=Math.hypot(Bv,t),r=e.x+e.w,i=e.y+e.h/2,s=Bv/n,c=t/n;return{d:`M${X(r+s*a)},${X(i-t-c*a)}C${X(r+Bv)},${X(i-t*2)} ${X(r+Bv)},${X(i+t*2)} ${X(r+s*o)},${X(i+t+c*o)}`,sx:r,sy:i-t,sdx:-s,sdy:c,ex:r,ey:i+t,edx:-s,edy:-c,x0:r+Bv+4,y0:i,x1:r+Bv+4,y1:i,nx:1,ny:0,lean:0,room:64,points:[]}}let[s,c,l,u]=ny(e,t,n),d=s===l,f=!1;if(r&&!ty(e,t)&&!ty(t,e))for(let n of r)n!==e&&n!==t&&Zv(n.x,n.y,n.x+n.w,n.y+n.h,s,c,l-s,u-c)<=1&&(f=!0);if(r&&f&&!d&&c!==u){let n=dy(e,t,r,i,a,o);if(n)return n;i.squeezed++}if(r&&f&&(d||c===u)){let n=n=>{let i=n?-1/0:1/0,a=e=>{let t=d?e.x:e.y;i=n?Math.max(i,t+(d?e.w:e.h)):Math.min(i,t)};a(e),a(t);for(let n of r)n!==e&&n!==t&&Zv(n.x,n.y,n.x+n.w,n.y+n.h,s,c,l-s,u-c)<=1&&a(n);return i},f=d?Math.min(e.y,t.y):Math.min(e.x,t.x),p=d?Math.max(e.y+e.h,t.y+t.h):Math.max(e.x+e.w,t.x+t.w),m=(n,i)=>{for(let a of r){if(a===e||a===t)continue;let r=d?a.y<p&&a.y+a.h>f:a.x<p&&a.x+a.w>f,o=d?a.x:a.y,s=o+(d?a.w:a.h);if(r&&(n?s>i:o<i))return!1}return!0},h=e.x+e.w/2,g=e.y+e.h/2,_=t.x+t.w/2,v=t.y+t.h/2,y=Math.sign(d?v-g:_-h),b=a=>{let o=n(a),s=a?1:-1,c=d?+!!a:a?3:2,l=d?i.ports(e,c,g+y*e.h/4,e.y+8,e.y+e.h-8)[0]:i.ports(e,c,h+y*e.w/4,e.x+8,e.x+e.w-8)[0],u=d?i.ports(t,c,v-y*t.h/4,t.y+8,t.y+t.h-8)[0]:i.ports(t,c,_-y*t.w/4,t.x+8,t.x+t.w-8)[0],f=n=>{if(d){let r=n+(h-n)*Math.min($v(e,n,l,h,l),1),i=n+(_-n)*Math.min($v(t,n,u,_,u),1);return[r,l,n,l,n,u,i,u]}let r=n+(g-n)*Math.min($v(e,l,n,l,g),1),i=n+(v-n)*Math.min($v(t,u,n,u,v),1);return[l,r,l,n,u,n,u,i]},p=f(o+s*Vv);for(let n=0;n<=4;n++){let a=o+s*(Vv+n*Hv),m=f(a);if(cy(m,r,e,t)&&(p=m,i.free(d,a,l,u)))return{points:p,side:c,p0:l,p1:u,step:n}}return{points:p,side:c,p0:l,p1:u,step:5}},x=d?u>c:l<s,S=m(x,n(x)),C=m(!x,n(!x)),w=b(x),T=S===C?b(!x):void 0,E=e=>i.crossings(e.points)*8+e.step,D=C&&!S||T&&E(T)<E(w)?!x:x,{points:O,side:k,p0:A,p1:j,step:M}=D===x?w:T??b(!x),N=D?1:-1;return M>4&&i.squeezed++,i.take(O),i.claim(e,k,A),i.claim(t,k,j),ly(O,2,a,o,d?{nx:N,lean:Wv,room:Gv}:{room:Kv})}let p=Math.hypot(l-s,u-c)||1,m=(l-s)/p,h=(u-c)/p;return(d||c===u)&&i.take([s,c,l,u]),{d:`M${X(s+m*a)},${X(c+h*a)}L${X(l-m*o)},${X(u-h*o)}`,sx:s,sy:c,sdx:-m,sdy:-h,ex:l,ey:u,edx:m,edy:h,x0:s,y0:c,x1:l,y1:u,nx:n?-h:0,ny:n?m:0,lean:0,room:Math.abs(m)>Math.abs(h)?Gv:Kv,points:[s,c,l,u]}}var py=216,my=64,hy=14,gy=12,_y=Gv+qv+3*mp,vy=88,yy=Vv+8,by=48,xy=16,Sy=10,Cy=new Map([[`person`,`person`],[`box`,`rect`],[`rounded`,`rect`],[`component`,`rect`],[`cylinder`,`cyl`],[`database`,`cyl`],[`db`,`cyl`],[`queue`,`h-cyl`],[`pipe`,`h-cyl`]]);function wy(e){let t=Cy.get((e.shape??``).toLowerCase())??Cy.get((e.sprite??``).toLowerCase());if(t)return t;if(e.tags)for(let t of e.tags.split(`,`)){let e=Cy.get(t.trim().toLowerCase());if(e)return e}let n=e.kind;return n.endsWith(`person`)?`person`:n.endsWith(`_db`)?`cyl`:n.endsWith(`_queue`)?`h-cyl`:`rect`}function Ty(e,t,n,r,i=py){let a=wy(e),o=a===`h-cyl`?36:0,s=a===`person`?Jv:a===`cyl`?24:0,c=i-2*hy-o,l=[Q(`«`+e.kind.replace(/_/g,` `)+`»`,!1,t,r-1,c),Q(e.label,!1,t,n,c,1),Q(e.techn?`[${e.techn}]`:void 0,!1,t,r,c),Q(e.descr,!1,t,r,c)],u=0,d=l[3].height>0?4:0;for(let e of l)u=Math.max(u,e.width),d+=e.height;return{shape:e,form:a,labels:l,textH:d,x:0,y:0,w:Math.max(i,u+2*hy+o),h:Math.max(my,d+2*gy+s)}}function Ey(e,t,n,r,i){let a=0,o=0;for(let s=0;s<e.length;s+=t){let c=Math.min(e.length,s+t),l=0,u=0;for(let t=s;t<c;t++)u=Math.max(u,e[t].h);for(let t=s;t<c;t++){let r=e[t];r.x=l,r.y=o,i&&(r.h=u),l+=r.w+n}a=Math.max(a,l-n),o+=u+r}return[a,e.length>0?o-r:0]}function Dy(e,t,n,r,i,a){let o=i===void 0?yy:12,s=new Map;for(let a of e.boundaries){let e=i===void 0?4e3:Math.max(80,i-2*xy-2*yy*2),c=a.parent?[Q(a.label,!1,t,n,e,1),Q(a.type?`[${a.type}]`:void 0,!1,t,r,e),Q(a.descr,!1,t,r,e)]:[],l=0,u=0;for(let e of c)l+=e.height,u=Math.max(u,e.width);s.set(a,{boundary:a,kids:[],nodes:[],labels:c,head:l>0?l+Sy+6+Vv:o,headW:u,headX:xy,x:0,y:0,w:0,h:0,form:`rect`})}let c=s.get(e.boundaries[0]);for(let e of s.values()){let t=e.boundary.parent;t&&s.get(t)?.kids.push(e)}let l=[c],u=new Map([[c.boundary,0]]);for(let e=0;e<l.length;e++)for(let t of l[e].kids)u.set(t.boundary,u.get(l[e].boundary)+1),l.push(t);for(let a of e.shapes)if(a.parent){let e=u.get(a.parent)??0,c=i===void 0?py:Math.max(100,Math.min(py,i-2*e*o-32));s.get(a.parent)?.nodes.push(Ty(a,t,n,r,c))}let d=Math.max(1,e.shapeInRow),f=Math.max(1,e.boundaryInRow),p=new Map;for(let e=l.length-1;e>=0;e--){let t=l[e],n=i===void 0?_y:a,r=(e,t,n)=>{if(i===void 0)return t;let r=1;for(let t of e)r=Math.max(r,t.w);return Math.max(1,Math.min(t,Math.floor((i+n-2*o)/(r+n))))},[s,u]=Ey(t.nodes,r(t.nodes,d,n),n,vy,!0),[m,h]=Ey(t.kids,r(t.kids,f,by),by,by,!1),g=u>0&&h>0?by:0,_=t===c?0:o;p.set(t,u+g),t.w=Math.max(s,m,t.headW+2*xy-2*_)+2*_,t.h=(_&&t.head)+u+g+h+_}let m=new Map;for(let e of l){let t=e.x+(e===c?0:o),n=e.y+(e===c?0:e.head);for(let r of e.nodes)r.x+=t,r.y+=n,m.set(r.shape,r);for(let r of e.kids)r.x+=t,r.y+=n+p.get(e);e!==c&&m.set(e.boundary,e)}return{order:l,boxes:m}}var Oy=7,ky=36,Ay=24,jy=2e3,My=8,Ny=[.5,.4,.6,.3,.7,.2,.8],Py=2e6;function Fy(e,t,n){let r=[];return e&&r.push(`fill:`+e),t&&r.push(`stroke:`+t),n&&r.push(`color:`+n),nm(r)}function Iy(e,t,n,r,i){return t?Iu(e,wu(t.includes(`¶ß`)?t.replace(/\ufb02\u00b0\u00b0?/g,`#`).replace(/\u00b6\u00df/g,`;`):t),n,r,i):e}function Ly(e,t,n){return Oh(n,r=>{if(!r)return Ry(e,t,n,!1)[0];let[i,a]=Ry(e,t,n,!0,ky);for(let r=ky+Ay;a>0&&r<=ky+3*Ay;r+=Ay){let[o,s]=Ry(e,t,n,!0,r);s<a&&([i,a]=[o,s])}return i})}function Ry(e,t,n,r,i=ky){let a=n.fontSize??16,o=Math.round(a*.8125),s=n.measurer??bc(n.fontFamily,n.fontFamilyMono),c=n.padding??8,l=[],{order:u,boxes:d}=Dy(e,s,a,o,r?Math.max(80,(n.maxWidth??320)-2*c):void 0,i),f=u[0],p=0,m=0,h=f.w,g=f.h,_=(e,t,n,r)=>{p=Math.min(p,e),m=Math.min(m,t),h=Math.max(h,n),g=Math.max(g,r)},v=[],y=new Map;for(let t of e.rels){let n=t.fromAttr?void 0:e.getC4Shape(t.from),r=t.toAttr?void 0:e.getC4Shape(t.to),i=n&&d.get(n),a=r&&d.get(r);if(!i||!a)throw new jo(`C4 rel "${t.from}" -> "${t.to}" references an unknown shape or boundary`,`semantic`,{type:`c4`});v.push(i,a);let o=y.get(i);o||y.set(i,o=new Set),o.add(a)}let b=[],x=[];for(let e of u)for(let t of e.nodes)b.push(t),x.push(t.x+My,t.y+My,t.x+t.w-My,t.y+t.h-My);let S=e.rels.length*(b.length+u.length+3*e.rels.length)<=Py,C=(e,t,n,r)=>{let i=0;for(let a=0;a<x.length;a+=4){let o=Math.min(n,x[a+2])-Math.max(e,x[a]);if(o<=0)continue;let s=Math.min(r,x[a+3])-Math.max(t,x[a+1]);s>0&&(i+=o*s)}return i},w=e=>e?Math.max(-jy,Math.min(jy,e)):0,T=``,E=``,D=bp(`arrow_point`),O=[];for(let e of u){if(e===f)continue;let t=Fy(e.boundary.bgColor,void 0,void 0).shape;fl(t)&&O.push({box:[e.x,e.y,e.x+e.w,e.y+e.h],shape:t})}let k=new oy;for(let e of u)e!==f&&k.frame(e);let A=e.rels.map((e,t)=>{let n=v[t*2],r=v[t*2+1],i=Fy(void 0,e.lineColor,void 0),a=e.type===`birel`||e.type===`rel_b`,o=e.type!==`rel_b`,s=fy(n,r,n!==r&&y.get(r)?.has(n)===!0?Oy:0,S?b:void 0,k,a?D:0,o?D:0);_(Math.min(s.x0,s.x1),Math.min(s.y0,s.y1),Math.max(s.x0,s.x1),Math.max(s.y0,s.y1)),a&&S&&x.push(s.sx-mp,s.sy-mp,s.sx+mp,s.sy+mp),o&&S&&x.push(s.ex-mp,s.ey-mp,s.ex+mp,s.ey+mp);let c=Np(s.d,[s.sx,s.sy,s.ex,s.ey],O,i.line),l=c||(i.stroke?Ec(i.stroke):`var(--_l)`);return c===``&&(T+=Ip(s,a?`arrow_point`:`none`,o?`arrow_point`:`none`,i.line)),E+=`<g class="pele-edge" data-id="${Y(e.from+`-`+e.to)}"${c?` stroke="${c}"`:``}${i.line}><path d="${s.d}"/>`+(a?xp(`arrow_point`,s.sx,s.sy,s.sdx,s.sdy,l):``)+(o?xp(`arrow_point`,s.ex,s.ey,s.edx,s.edy,l):``)+`</g>`,s});for(let e of u){if(!S||e.headW===0)continue;let t=e.y+Sy,n=e.y+e.head-Vv,r=1/0;for(let i of[xy,(e.w-e.headW)/2,e.w-xy-e.headW]){let a=0;for(let r of A)ey(r.points,e.x+i-4,t,e.x+i+e.headW+4,n)&&a++;if(a<r&&(r=a,e.headX=i),a===0)break}x.push(e.x+e.headX-4,t,e.x+e.headX+e.headW+4,n)}let j=``;e.rels.forEach((t,i)=>{let a=A[i],c=t.from+`-`+t.to,u=Fy(void 0,void 0,t.textColor),d=Q((e.c4Type===`C4Dynamic`?i+1+`: `:``)+t.label,!1,s,o,a.room),f=Q(t.techn?`[${t.techn}]`:void 0,!1,s,o,a.room,2),p=Math.max(d.width,f.width)+qv,m=d.height+f.height;if(m===0)return;let h=Math.abs(a.nx)*(p/2)+Math.abs(a.ny)*(m/2)+2,g=a.lean?Math.max(0,Math.min(a.lean,h-14)):h,v=a.nx*g+(r?0:w(t.offsetX)),y=a.ny*g+(r?0:w(t.offsetY)),b=.5;if(S){let e=1/0,t=v!==a.nx*g||y!==a.ny*g;for(let n=0;n<(t?2:1)&&e>0;n++){let t=n?a.nx*g:v,r=n?a.ny*g:y;for(let n of Ny){let i=a.x0+(a.x1-a.x0)*n+t,o=a.y0+(a.y1-a.y0)*n+r,s=C(i-p/2,o-m/2,i+p/2,o+m/2);if(s<e&&(e=s,b=n,v=t,y=r),s===0)break}}}let T=a.x0+(a.x1-a.x0)*b+v,E=a.y0+(a.y1-a.y0)*b+y-m/2;S&&x.push(T-p/2,E,T+p/2,E+m),_(T-p/2,E,T+p/2,E+m),j+=`<g class="pele-edge-label" data-id="${Y(c)}">`+(t.descr?`<title>${Y(t.descr)}</title>`:``)+`<rect x="${X(T-p/2)}" y="${X(E)}" width="${X(p)}" height="${X(m)}" rx="3" fill="var(--_bg)"/>`+Iy(Z(d,T,E+d.height/2,u.text)+Z(f,T,E+d.height+f.height/2,` class="pele-c4-techn" fill="var(--_m)"${u.text}`),t.link,c,l,n)+`</g>`});let M=``,N=``;for(let e of u){if(e!==f){let t=e.boundary,r=Fy(t.bgColor,t.borderColor,t.fontColor),i=e.x+e.headX,a=e.y+Sy,s=pl(r)+r.text,c=pl(r,`var(--_m)`)+r.text,u=zv(e.labels[0],i,a,` class="pele-cluster-label" font-weight="var(--_hw)"${s}`);a+=e.labels[0].height,u+=zv(e.labels[1],i,a,` class="pele-c4-type" font-size="${o}"${c}`),a+=e.labels[1].height,u+=zv(e.labels[2],i,a,` class="pele-c4-descr" font-size="${o}"${c}`),M+=`<g class="pele-cluster pele-c4-${t.nodeType?`node`:`boundary`}" data-id="${Y(t.alias)}"><rect x="${X(e.x)}" y="${X(e.y)}" width="${X(e.w)}" height="${X(e.h)}" fill="none" stroke="var(--_b)"${t.nodeType?``:` stroke-dasharray="6 4"`}${Kp(r.shape)}/>`+Iy(u,t.link,t.alias,l,n)+`</g>`}for(let t of e.nodes){let e=t.shape,r=e.kind.startsWith(`external`),i=Fy(e.bgColor,e.borderColor,e.fontColor),a=` stroke="var(--_b)"`+(r?` stroke-dasharray="4 3"`:``),{w:s,h:c,form:u,labels:d}=t,f=u===`h-cyl`?-Xv(c)/2:0,p=u===`person`?Jv/2:u===`cyl`?Yv(s)/2:0,m=pl(i)+i.text,h=pl(i,`var(--_m)`)+i.text,g=p-t.textH/2,_=Z(d[0],f,g+d[0].height/2,` class="pele-c4-type" font-size="${o-1}"${h}`);g+=d[0].height,_+=Z(d[1],f,g+d[1].height/2,` class="pele-label" font-weight="var(--_hw)"${m}`),g+=d[1].height,_+=Z(d[2],f,g+d[2].height/2,` class="pele-c4-techn" font-size="${o}"${h}`),g+=d[2].height+4,_+=Z(d[3],f,g+d[3].height/2,` class="pele-c4-descr" font-size="${o}"${m}`),N+=`<g class="pele-node pele-shape-${u} pele-c4-${e.kind}${r?` pele-c4-external`:``}" data-id="${Y(e.alias)}" transform="translate(${X(t.x+s/2)},${X(t.y+c/2)})">`+Iy(Mm(u,s,c,` fill="var(${r?`--_bg`:`--_s`})"${a}${i.shape}`,a+i.line)+_,e.link,e.alias,l,n)+`</g>`}}let P=Q(e.title,!1,s,a,r?Ch(n):4e3,1),F=P.height>0?P.height+12:0,I=Math.max(h-p,P.width),L=Math.ceil(I+2*c),R=Math.ceil(g-m+F+2*c),z=c-p+(I-(h-p))/2,B=c+F-m;return[{svg:lm(`c4`,L,R,a,n,e,Z(P,L/2,c+P.height/2,` class="pele-title" font-weight="var(--_tw)"`)+`<g transform="translate(${X(z)},${X(B)})">`+(M?`<g class="pele-clusters">${M}</g>`:``)+Lp(T)+(E?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${E}</g>`:``)+(N?`<g class="pele-nodes">${N}</g>`:``)+(j?`<g class="pele-edge-labels" font-size="${o}">${j}</g>`:``)+`</g>`),width:L,height:R,links:l},k.squeezed]}var zy={type:`c4`,parse(e,t,n){let r=new xv;return n&&(r.title=n),Fv(e,r),r},render:Ly};function By(e){let t=0;for(let n=e.indexOf(`~`);n!==-1;n=e.indexOf(`~`,n+1))t++;return t}function Vy(e){let t=By(e);if(t<=1)return e;let n=t%2!=0&&e.startsWith(`~`),r=e.split(``),i=[];for(let e=+!!n;e<r.length;e++)r[e]===`~`&&i.push(e);for(let e=0,t=i.length-1;e<t;e++,t--)r[i[e]]=`<`,r[i[t]]=`>`;return r.join(``)}function Hy(e){if(!e.includes(`~`))return e;let t=e.split(/(,)/),n=[];for(let e=0;e<t.length;e++){let r=t[e];r===`,`&&e>0&&e+1<t.length&&By(t[e-1])===1&&By(t[e+1])===1&&(r=t[e-1]+`,`+t[e+1],e++,n.pop()),n.push(Vy(r))}return n.join(``)}function Uy(e){return e===`#`||e===`+`||e===`~`||e===`-`}var Wy=class{id=``;memberType;visibility=``;classifier=``;parameters=``;returnType=``;constructor(e,t){this.memberType=t,t===`method`&&this.parseMethod(e)||this.parseAttribute(e),this.id=this.id.startsWith(` `)?` `+this.id.trim():this.id.trim()}parseMethod(e){let t=e.length;for(let n=0;n<t;){let r=n;for(;r<t&&!Ns(e.charCodeAt(r));)r++;let i=r-1;for(;i>n&&e.charCodeAt(i)!==41;)i--;let a=i-1;for(;a>n&&e.charCodeAt(a)!==40;)a--;if(a>n){let r=e[n],o=Uy(r)&&a>n+1;o&&(this.visibility=r),this.id=e.slice(o?n+1:n,a),this.parameters=e.slice(a+1,i).trim();let s=i+1,c=``;if(s<t){let t=e[s];(t===`$`||t===`*`||t.trim()===``)&&(c=t.trim(),s++)}let l=s;for(;l<t&&!Ns(e.charCodeAt(l));)l++;if(this.returnType=e.slice(s,l).trim(),c===``){let e=this.returnType.slice(-1);(e===`$`||e===`*`)&&(c=e,this.returnType=this.returnType.slice(0,-1))}return this.classifier=c,!0}n=r+1}return this.memberType=`attribute`,!1}parseAttribute(e){let t=e.slice(0,1),n=e.slice(-1);Uy(t)&&(this.visibility=t),(n===`$`||n===`*`)&&(this.classifier=n),this.id=e.substring(this.visibility===``?0:1,this.classifier===``?e.length:e.length-1)}getDisplayDetails(){let e=this.visibility+Hy(this.id);return this.memberType===`method`&&(e+=`(${Hy(this.parameters.trim())})`,this.returnType&&(e+=` : `+Hy(this.returnType))),{displayText:e.trim(),cssStyle:this.parseClassifier()}}parseClassifier(){return this.classifier===`*`?`font-style:italic;`:this.classifier===`$`?`text-decoration:underline;`:``}},Gy={LINE:0,DOTTED_LINE:1},Ky={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3,LOLLIPOP:4},qy=`classId-`;function Jy(e){let t=e.indexOf(`~`);if(t<=0)return{className:e,type:``};let n=e.indexOf(`~`,t+1);return{className:e.slice(0,t),type:e.slice(t+1,n===-1?e.length:n)}}function Yy(e){let t=e.charCodeAt(0);return Jy(t>=48&&t<=57?qy+e:e).className}var Xy=class{type=`class`;lineType=Gy;relationType=Ky;direction=`TB`;classes=new Map;relations=[];notes=new Map;namespaces=new Map;interfaces=[];styleClasses=new Map;title;accTitle;accDescr;namespaceStack=[];withCssClass=new Map;addClass(e){let{className:t,type:n}=Jy(e);if(this.classes.has(t))return;let r={id:t,type:n,label:t,cssClasses:`default`,methods:[],members:[],annotations:[],styles:[]};this.classes.set(t,r),this.tag(r,`default`)}tag(e,t){let n=this.withCssClass.get(t);n?n.add(e):this.withCssClass.set(t,new Set([e]))}ensure(e){return this.addClass(e),this.classes.get(Jy(e).className)}setClassLabel(e,t){this.ensure(e).label=t}addRelation(e){let{type1:t,type2:n}=e.relation;t===Ky.LOLLIPOP&&n===`none`?(this.addClass(e.id2),e.id1=this.addInterface(e.id1,e.id2)):n===Ky.LOLLIPOP&&t===`none`?(this.addClass(e.id1),e.id2=this.addInterface(e.id2,e.id1)):(this.addClass(e.id1),this.addClass(e.id2)),e.id1=Jy(e.id1).className,e.id2=Jy(e.id2).className,e.relationTitle1=e.relationTitle1.trim(),e.relationTitle2=e.relationTitle2.trim(),this.relations.push(e)}addInterface(e,t){let n=`interface${this.interfaces.length}`;return this.interfaces.push({id:n,label:e,classId:t}),n}addAnnotation(e,t){this.ensure(e).annotations.push(t)}addMember(e,t){let n=this.ensure(e);if(typeof t!=`string`)return;let r=t.trim();if(r.startsWith(`<<`)&&r.endsWith(`>>`))n.annotations.push(r.substring(2,r.length-2));else if(r.indexOf(`)`)>0){let e=new Wy(r,`method`);(e.memberType===`method`?n.methods:n.members).push(e)}else r&&n.members.push(new Wy(r,`attribute`))}addMembers(e,t){if(Array.isArray(t)){t.reverse();for(let n of t)this.addMember(e,n)}}addNote(e,t){let n=this.notes.size,r=`note${n}`;return this.notes.set(r,{id:r,class:t,text:e,index:n}),r}cleanupLabel(e){return(e.startsWith(`:`)?e.substring(1):e).trim()}setCssClass(e,t){for(let n of e.split(`,`)){let e=this.classes.get(Yy(n));if(e!==void 0){e.cssClasses+=` `+t;for(let n of t.split(` `))this.tag(e,n)}}}defineClass(e,t){for(let n of e){let e=this.styleClasses.get(n);if(e===void 0&&(e={id:n,styles:[],textStyles:[]},this.styleClasses.set(n,e)),!t)continue;for(let n of t)n.includes(`color`)&&e.textStyles.push(n.replace(`fill`,`bgFill`)),e.styles.push(n);let r=this.withCssClass.get(n);if(r===void 0)continue;let i=t.flatMap(e=>e.split(`,`));for(let e of r)for(let t of i)e.styles.push(t)}}setTooltip(e,t){if(t!==void 0)for(let n of e.split(`,`)){let e=this.classes.get(Jy(n).className);e&&(e.tooltip=t)}}setLink(e,t,n){let r=Xo(t).trim();for(let t of e.split(`,`)){let e=this.classes.get(Yy(t));e&&(e.link=r?wu(r):void 0,e.linkTarget=typeof n==`string`?n:`_blank`)}this.setCssClass(e,`clickable`)}setClickEvent(e,t,n){for(let t of e.split(`,`)){let e=this.classes.get(Jy(t).className);e&&(e.haveCallback=!0)}this.setCssClass(e,`clickable`)}setDirection(e){this.direction=e}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
87
|
+
`)}addNamespace(e,t){let n=this.namespaceStack[this.namespaceStack.length-1],r=n?`${n}.${e}`:e;this.namespaceStack.push(r);let i=this.namespaces.get(r);if(i)return i.explicit=!0,t&&(i.label=t),r;let a=n||void 0,o=n?n.length+1:0;for(;;){let e=r.indexOf(`.`,o),n=e===-1,i=n?r:r.slice(0,e),s=this.namespaces.get(i);if(s===void 0){let c=r.slice(o,n?r.length:e);s={id:i,label:n&&t?t:c,classes:new Map,notes:new Map,children:new Map,parent:a,explicit:n},this.namespaces.set(i,s)}else n&&(s.explicit=!0);let c=a?this.namespaces.get(a):void 0;if(c&&(c.children.has(i)||c.children.set(i,s),s.parent??=a),n)return r;a=i,o=e+1}}popNamespace(){this.namespaceStack.pop()}addClassesToNamespace(e,t,n){let r=this.namespaces.get(e);if(r!==void 0){for(let n of t){let{className:t}=Jy(n),i=this.classes.get(t);i!==void 0&&(i.parent=e,r.classes.set(t,i))}for(let t of n){let n=this.notes.get(t);n!==void 0&&(n.parent=e,r.notes.set(t,n))}}}setCssStyle(e,t){let n=this.classes.get(e);if(t&&n)for(let e of t)for(let t of e.split(`,`))n.styles.push(t)}},Zy=`$end.INVALID.CLASS_DIAGRAM.NEWLINE.EOF.SQS.STR.SQE.DOT.GENERICTYPE.LABEL.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.STRUCT_START.STRUCT_STOP.NAMESPACE.STYLE_SEPARATOR.ANNOTATION_START.ANNOTATION_END.CLASS.MEMBER.NOTE_FOR.NOTE.CLASSDEF.ALPHA.COMMA.direction_tb.direction_bt.direction_rl.direction_lr.AGGREGATION.EXTENSION.COMPOSITION.DEPENDENCY.LOLLIPOP.LINE.DOTTED_LINE.CALLBACK.LINK.LINK_TARGET.CLICK.CALLBACK_NAME.CALLBACK_ARGS.HREF.STYLE.CSSCLASS.COLON.BRKT.PCT.MINUS.UNICODE_TEXT.BQUOTE_STR.EDGE_STATE.EOF_IN_STRUCT.OPEN_IN_STRUCT.PLUS.EQUALS.PUNCTUATION`.split(`.`),Qy=[4,6,4,9,44,45,12,14,15,4,56,4,56],$y=[/.*direction\s+TB[^\n]*/y,/.*direction\s+BT[^\n]*/y,/.*direction\s+RL[^\n]*/y,/.*direction\s+LR[^\n]*/y],eb=/[\n\r\u2028\u2029]/g;function tb(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c=e.indexOf(`direction`),l=-1,u=0,d=(t,a,o)=>(n.push(t),r.push(e.slice(a,o)),i.push(a),s=o,!0),f=e=>{a.push(o),o=e},p=()=>{a.length>0&&(o=a.pop())},m=t=>e.startsWith(t,s)&&!Ls(e.charCodeAt(s+t.length)),h=n=>{for(;n<t&&J(e.charCodeAt(n));)n++;return n},g=n=>{let r=e.indexOf(n,s);return r===-1?t:r},_=n=>{let r=s,i=-1;for(let n=e.charCodeAt(r);r<t&&J(n);n=e.charCodeAt(++r))n===10&&(i=r);i<0?s=r:(n&&p(),d(3,s,i+1))},v=t=>{switch(t){case 99:if(m(`cssClass`))return d(48,s,s+8);if(m(`callback`))return d(40,s,s+8);if(m(`click`))return d(43,s,s+5);break;case 108:if(m(`link`))return d(41,s,s+4);break;case 110:if(m(`note for`))return d(24,s,s+8);if(m(`note`))return d(25,s,s+4);break;case 60:if(e.charCodeAt(s+1)===60)return d(20,s,s+2);break;case 62:if(e.charCodeAt(s+1)===62)return d(21,s,s+2);break;case 104:if(m(`href`))return d(46,s,s+4)}return!1},y=n=>{if(v(n))return!0;let r=e.charCodeAt(s+1);switch(n){case 34:return f(1),s++,!0;case 126:return f(3),s++,!0;case 96:return f(2),s++,!0;case 95:if(m(`_self`))return d(42,s,s+5);if(m(`_blank`))return d(42,s,s+6);if(m(`_parent`))return d(42,s,s+7);if(m(`_top`))return d(42,s,s+4);break;case 60:return r===124?d(34,s,s+2):d(36,s,s+1);case 124:return r===62&&d(34,s,s+2);case 62:return d(36,s,s+1);case 42:return d(35,s,s+1);case 111:if(!Ls(r))return d(33,s,s+1);break;case 40:return r===41&&d(37,s,s+2);case 45:return r===45?d(38,s,s+2):d(52,s,s+1);case 46:return r===46?d(39,s,s+2):d(8,s,s+1);case 58:{let n=s+1;for(;n<t;){let t=e.charCodeAt(n);if(t===58||t===10||t===59)break;n++}return n>s+1?d(10,s,n):r===58&&e.charCodeAt(s+2)===58&&d(19,s,s+3)}case 43:return d(58,s,s+1);case 37:return d(51,s,s+1);case 61:return d(59,s,s+1);case 91:return d(5,s,s+1);case 93:return d(7,s,s+1);case 33:case 35:case 36:case 38:case 39:case 44:case 63:case 92:case 47:return d(60,s,s+1)}if(Ls(n)){let t=s+1;for(;Ls(e.charCodeAt(t));)t++;return d(27,s,t)}return hd(n)&&d(53,s,s+1)},b=()=>{if(c===-1||s<u||(c<s&&(c=e.indexOf(`direction`,s)),c===-1)||(l<s&&(eb.lastIndex=s,l=eb.test(e)?eb.lastIndex-1:t),c>=l))return!1;for(let t=0;t<4;t++){let n=$y[t];if(n.lastIndex=s,n.test(e))return d(29+t,s,n.lastIndex)}return u=l,!1},x=n=>{if(b())return!0;if(J(n))return _(!1),!0;switch(n){case 37:if(e.charCodeAt(s+1)===37){let n=g(`
|
|
88
|
+
`);for(;n<t&&(e.charCodeAt(n)===10||e.charCodeAt(n)===13);)n++;return s=n,!0}break;case 97:{let t=e.startsWith(`accTitle`,s);if(!t&&!e.startsWith(`accDescr`,s))break;let n=h(s+8),r=e.charCodeAt(n);if(r===58)return d(t?11:13,s,h(n+1)),f(t?6:7),!0;if(r===123&&!t)return s=h(n+1),f(8),!0;break}case 99:if(m(`classDiagram-v2`))return d(2,s,s+15);if(m(`classDiagram`))return d(2,s,s+12);if(e.startsWith(`call`,s)&&J(e.charCodeAt(s+4)))return s=h(s+4),f(4),!0;if(m(`classDef`))return d(26,s,s+8);if(m(`class`))return f(9),d(22,s,s+5);break;case 91:if(e.startsWith(`*]`,s+1))return d(55,s,s+3);break;case 115:if(m(`style`))return d(47,s,s+5);break;case 110:if(m(`namespace`))return f(11),d(18,s,s+9);break;case 44:return d(28,s,s+1);case 35:return d(50,s,s+1)}return y(n)||n===58&&d(49,s,s+1)};for(;;){if(s>=t){n.push(Qy[o]),r.push(``),i.push(t);break}let a=e.charCodeAt(s),c=!0;switch(o){case 0:c=x(a);break;case 9:J(a)?_(!0):a===125?(p(),p(),d(17,s,s+1)):a===123?(f(10),d(16,s,s+1)):c=y(a);break;case 10:if(a===34)f(1),s++;else if(a===125)p(),d(17,s,s+1);else if(a===91&&e.startsWith(`*]`,s+1))d(55,s,s+3);else if(a===123)d(57,s,s+1);else if(a===10)s++;else{let n=s+1;for(;n<t;){let t=e.charCodeAt(n);if(t===123||t===125||t===10)break;n++}d(23,s,n)}break;case 11:J(a)?_(!0):a===123?(f(12),d(16,s,s+1)):a===125?p():a===110&&m(`namespace`)?(f(11),d(18,s,s+9)):c=y(a);break;case 12:J(a)?_(!1):a===125?(p(),d(17,s,s+1)):a===110&&m(`namespace`)?(f(11),d(18,s,s+9)):a===91&&e.startsWith(`*]`,s+1)?d(55,s,s+3):a===99&&m(`class`)?(f(9),d(22,s,s+5)):c=y(a);break;case 1:a===34?(p(),s++):d(6,s,g(`"`));break;case 3:if(a===34)f(1),s++;else{if(v(a))break;a===126?(p(),s++):d(9,s,g(`~`))}break;case 2:if(a===34)f(1),s++;else{if(v(a))break;a===126?(f(3),s++):a===96?(p(),s++):d(54,s,g("`"))}break;case 4:if(a===40){let t=h(s+1);p(),e.charCodeAt(t)===41?s=t+1:(f(5),s++)}else d(44,s,g(`(`));break;case 5:a===41?(p(),s++):d(45,s,g(`)`));break;case 6:case 7:d(o===6?12:14,s,g(`
|
|
89
|
+
`)),p();break;case 8:a===125?(p(),s++):d(15,s,g(`}`))}if(!c)return n.push(1),r.push(``),i.push(s),{types:n,texts:r,starts:i}}return n.push(0),r.push(``),i.push(t),{types:n,texts:r,starts:i}}var nb=61,rb=new Uint8Array(nb);for(let e of[53,27,52])rb[e]=1;var ib=new Uint8Array(nb);for(let e of[27,49,50,47,51,10])ib[e]=1;var ab=new Uint8Array(nb);ab[33]=1,ab[34]=2,ab[35]=3,ab[36]=4,ab[37]=5;var ob=`'UNICODE_TEXT', 'NUM', 'ALPHA', 'MINUS', 'BQUOTE_STR'`;function sb(e,t){let{types:n,texts:r,starts:i}=tb(e),a=0,o=t=>{let r=n[a];throw r===1?zo(`class`,e,i[a],``,!0):zo(`class`,e,i[a],`Expecting ${t}, got '${Zy[r]}'`)},s=e=>(n[a]!==e&&o(`'${Zy[e]}'`),r[a++]),c=()=>(rb[n[a]]===0&&o(`'UNICODE_TEXT', 'NUM', 'ALPHA', 'MINUS'`),r[a++]),l=e=>{let t=``;for(;;){if(n[a]===54){t+=r[a++];break}rb[n[a]]===0&&o(ob),t+=r[a++];let e=n[a];if(e===8)t+=`.`,a++;else if(rb[e]===0&&e!==54)break}return e&&n[a]===9&&(t+=`~`+r[a++]+`~`),t},u=()=>{a++;let e=s(6);return s(7),e},d=()=>{n[a]!==23&&o(`'STRUCT_STOP', 'MEMBER'`);let e=[];for(;n[a]===23;)e.push(r[a++]);return s(17),e.reverse()},f=()=>{a++;let e=l(!0);switch(t.addClass(e),n[a]===5&&t.setClassLabel(e,u()),n[a]){case 19:{a++;let r=c();t.setCssClass(e,r),n[a]===16&&(a++,t.addMembers(e,d()));break}case 16:a++,n[a]===17?a++:t.addMembers(e,d());break;case 20:{a++;let r=c();s(21),t.addAnnotation(e,r),n[a]===16&&(a++,n[a]===17?a++:t.addMembers(e,d()));break}}return e},p=()=>{if(n[a++]===25)return t.addNote(s(6));let e=l(!0);return t.addNote(s(6),e)},m=()=>{let e=[];for(;;){a++;let r=l(!1),i=n[a]===5?t.addNamespace(r,u()):t.addNamespace(r);s(16),n[a]===3&&a++,e.push({id:i,classes:[],notes:[]});let c=!0;for(;c;){let r=e[e.length-1],i=n[a];if(i===18)break;for(i===22?r.classes.push(f()):i===25||i===24?r.notes.push(p()):o(`'NAMESPACE', 'CLASS', 'NOTE_FOR', 'NOTE'`);;){if(n[a]===3){let e=n[a+1];if(e===18||e===22||e===25||e===24){a++;break}a++}s(17);let r=e.pop();if(t.addClassesToNamespace(r.id,r.classes,r.notes),t.popNamespace(),e.length===0){c=!1;break}}}if(e.length===0)return}},h=()=>{let e=ab[n[a]];return e===0?`none`:(a++,e-1)},g=()=>{let e=l(!0),i=n[a];if(i===10){t.addMember(e,t.cleanupLabel(r[a++]));return}let s=`none`;if(i===6)s=r[a++],i=n[a];else if(ab[i]===0&&i!==38&&i!==39)return;let c=h();i=n[a],i!==38&&i!==39&&o(`'AGGREGATION', 'EXTENSION', 'COMPOSITION', 'DEPENDENCY', 'LOLLIPOP', 'LINE', 'DOTTED_LINE'`),a++;let u=h(),d=n[a]===6?r[a++]:`none`,f={id1:e,id2:l(!0),relation:{type1:c,type2:u,lineType:i===38?0:1},relationTitle1:s,relationTitle2:d};n[a]===10&&(f.title=t.cleanupLabel(r[a++])),t.addRelation(f)},_=()=>{let e=[];for(;;){ib[n[a]]===0&&o(`'ALPHA', 'NUM', 'COLON', 'UNIT', 'SPACE', 'BRKT', 'STYLE', 'PCT', 'LABEL'`);let t=r[a++];for(;ib[n[a]]===1;)t+=r[a++];if(e.push(t),n[a]!==28)return e;a++}},v=e=>{n[a]===6&&t.setTooltip(e,r[a++])},y=e=>{let i=s(6),o=n[a]===6?r[a++]:void 0;n[a]===42?t.setLink(e,i,r[a++]):t.setLink(e,i),o!==void 0&&t.setTooltip(e,o)},b=()=>{let e=n[a];switch(e){case 53:case 27:case 52:case 54:g();return;case 18:m();return;case 22:f();return;case 23:a++;return;case 20:{a++;let e=c();s(21),t.addAnnotation(l(!0),e);return}case 40:{a++;let e=l(!0);t.setClickEvent(e,s(6)),v(e);return}case 41:a++,y(l(!0));return;case 43:{a++;let e=l(!0);if(n[a]===46){a++,y(e);return}let i=s(44);n[a]===45?t.setClickEvent(e,i,r[a++]):t.setClickEvent(e,i),v(e);return}case 47:{a++;let e=s(27);t.setCssStyle(e,_());return}case 48:{a++;let e=s(6);t.setCssClass(e,s(27));return}case 25:case 24:p();return;case 26:{a++;let e=[s(27)];for(;n[a]===28;)a++,e.push(s(27));t.defineClass(e,_());return}case 29:case 30:case 31:case 32:a++,t.setDirection(e===29?`TB`:e===30?`BT`:e===31?`RL`:`LR`);return;case 11:a++,t.setAccTitle(s(12).trim());return;case 13:a++,t.setAccDescription(s(14).trim());return;case 15:t.setAccDescription(r[a++].trim());return}o(`'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'NAMESPACE', 'ANNOTATION_START', 'CLASS', 'MEMBER', 'NOTE_FOR', 'NOTE', 'CLASSDEF', 'direction_tb', 'CALLBACK', 'LINK', 'CLICK', 'STYLE', 'CSSCLASS', 'ALPHA', 'MINUS', 'BQUOTE_STR'`)},x=n[a]===2;for(x&&(a++,s(3));b(),!(n[a]!==3||(a++,n[a]===4||n[a]===0)););x&&s(4),s(0)}function cb(e,t,n,r){let i=Int32Array.from(e,(e,t)=>t),a=e=>{for(;i[e]!==e;)i[e]=i[i[e]],e=i[e];return e},o=(e,t)=>{i[a(e)]=a(t)};for(let t=0;t<e.length;t++)e[t].parent>=0&&o(t,e[t].parent);for(let e of t)o(e.src,e.dst);let s=new Map,c=(e,t,n,r=0,i=0)=>{e.left=Math.min(e.left,t-r/2),e.top=Math.min(e.top,n-i/2),e.right=Math.max(e.right,t+r/2),e.bottom=Math.max(e.bottom,n+i/2)};for(let t=0;t<e.length;t++){let n=a(t),r=s.get(n);r||(r={nodes:[],edges:[],left:1/0,top:1/0,right:-1/0,bottom:-1/0},s.set(n,r));let i=e[t];r.nodes.push(i),c(r,i.x,i.y,i.w,i.h)}if(s.size<2)return;for(let e of t){let t=s.get(a(e.src));t.edges.push(e);for(let n=0;n<e.route.length;n+=3)c(t,e.route[n],e.route[n+1]);e.labelW>0&&c(t,e.labelX,e.labelY,e.labelW,e.labelH)}let l=0,u=0,d=0,f=0,p=1/0,m=-1/0,h=[];for(let e of s.values()){let t=e.right-e.left,i=e.bottom-e.top;l>0&&l+t>n&&(u+=d+r,l=0,d=0),h.push(l-e.left,u-e.top),p=Math.min(p,e.left),m=Math.max(m,e.right),f=Math.max(f,l+t),d=Math.max(d,i),l+=t+r}if(f>=m-p)return;let g=0;for(let e of s.values())ap(e.nodes,e.edges,h[g++],h[g++]);return{width:f,height:u+d}}var lb=[`aggregation`,`extension`,`composition`,`dependency`,`lollipop`];function ub(e){return typeof e==`number`&&lb[e]||`none`}function db(e,t=!0){let n=[],r=[],i=new Map,a=new Map,o=new Map,s=new Map,c=n=>{if(t||n===void 0)return n;let r=[],i=n,a;for(;i;){if(s.has(i)){a=s.get(i);break}let t=e.namespaces.get(i);if(t===void 0)break;if(t.explicit){a=i;break}r.push(i),i=t.parent}for(let e of r)s.set(e,a);return a},l=e=>e===void 0?-1:i.get(e)??-1;for(let r of e.namespaces.values())!t&&!r.explicit||(i.set(r.id,n.length),n.push({id:r.id,label:t?r.label:r.id,isGroup:!0,shape:`rect`,parentId:t?r.parent:void 0,parent:-1}));for(let e of n)e.parent=l(e.parentId);let u=0;for(let t of e.classes.values()){let e=c(t.parent);a.set(t.id,n.length),n.push({id:t.id,label:t.label,isGroup:!1,shape:`classBox`,parentId:e,parent:l(e),classNode:t,colorIndex:u++})}for(let t of e.notes.values()){let e=c(t.parent),i=t.class===void 0?void 0:a.get(t.class);i!==void 0&&r.push({id:`edgeNote${t.index}`,start:t.id,end:n[i].id,source:n.length,target:i,label:void 0,arrowTypeStart:`none`,arrowTypeEnd:`none`,startLabelRight:``,endLabelLeft:``,pattern:`dotted`,classes:`relation`}),n.push({id:t.id,label:t.text,isGroup:!1,shape:`note`,parentId:e,parent:l(e)})}for(let t of e.interfaces){let e=a.get(t.classId);o.set(t.id,n.length),n.push({id:t.id,label:t.label,isGroup:!1,shape:`interface`,parentId:void 0,parent:e===void 0?-1:n[e].parent})}let d=0;for(let t of e.relations){d++;let{type1:e,type2:n}=t.relation,i=e===Ky.LOLLIPOP&&n===`none`?o:a,s=i===a&&n===Ky.LOLLIPOP&&e===`none`?o:a;r.push({id:`id_${t.id1}_${t.id2}_${d}`,start:t.id1,end:t.id2,source:i.get(t.id1)??-1,target:s.get(t.id2)??-1,label:t.title,arrowTypeStart:ub(e),arrowTypeEnd:ub(n),startLabelRight:t.relationTitle1===`none`?``:t.relationTitle1,endLabelLeft:t.relationTitle2===`none`?``:t.relationTitle2,pattern:t.relation.lineType===1?`dashed`:`solid`,classes:`relation`})}return{nodes:n,edges:r}}var fb=12,pb=16,mb=6,hb=5;function gb(e){switch(e){case`extension`:return fb;case`composition`:case`aggregation`:return pb;case`lollipop`:return 2*hb;case`dependency`:return bp(`arrow_point`)}return 0}function _b(e,t,n,r,i,a){let o=-i,s=r;switch(e){case`extension`:{let e=t-r*fb,a=n-i*fb;return`<path class="pele-marker" d="M${X(t)},${X(n)}L${X(e+o*mb)},${X(a+s*mb)}L${X(e-o*mb)},${X(a-s*mb)}Z" stroke-linejoin="round"/>`}case`composition`:case`aggregation`:{let c=t-r*pb/2,l=n-i*pb/2,u=mb-1;return`<path class="pele-marker" d="M${X(t)},${X(n)}L${X(c+o*u)},${X(l+s*u)}L${X(t-r*pb)},${X(n-i*pb)}L${X(c-o*u)},${X(l-s*u)}Z" stroke-linejoin="round"${e===`composition`?` fill="${a}"`:``}/>`}case`lollipop`:return`<circle class="pele-marker" cx="${X(t-r*hb)}" cy="${X(n-i*hb)}" r="${hb}"/>`;case`dependency`:return xp(`arrow_point`,t,n,r,i,a)}return``}var vb=40,yb=16,bb=56,xb=20,Sb=26,Cb=12,wb=8,Tb=6,Eb=10,Db=64,Ob=8,kb=`var(--_l)`,Ab=new Set([`_self`,`_blank`,`_parent`,`_top`]);function jb(e,t,n){let r=e[t];return typeof r==`number`&&r>0?Math.min(r,2e3):n}var Mb=[],Nb=[];function Pb(e,t,n,r){let i=Xo(e.getDisplayDetails().displayText).trim(),a=(e.classifier===`*`?2:0)|(r?4:0);return{text:i,width:t.width(i,n,a),classifier:e.classifier}}function Fb(e,t,n){let r=r=>Oh(n,i=>Ib(e,t,n,r,i));return Dh(e.direction)?Eh(n,r):r(!1)}function Ib(e,t,n,r,i){let a=t.class??{},o=db(e,a.hierarchicalNamespaces!==!1),s=a.hideEmptyMembersBox===!0,c=Array.isArray(n.monospace)&&n.monospace.includes(`members`),l=e=>c&&!/[";]font-family:/.test(e.text),u=n.fontSize??16,d=Math.round(u*.875),f=Math.round(u*.8),p=Math.round(f*1.4),m=n.measurer??bc(n.fontFamily,n.fontFamilyMono),h=n.padding??8,g=(e,t)=>{if(!e.includes(`$$`))return;let n=Q(e,!1,m,t,4e3);return n.lines.some(yh)?n:void 0},_=e=>e?g(e,f)?.width??m.width(Xo(e),f,0):0,v=r?`TB`:Vf(e.direction),y=new Map,b=new Map,x=new Map,S=e=>{let t=y.get(e);if(t===void 0){let n=nm([e]);t=n.shape===``&&n.text===``?``:e.slice(0,e.indexOf(`:`)).trim().toLowerCase(),y.set(e,t)}t!==``&&x.set(t,e)},C=t=>{x.clear();let n=b.get(t.cssClasses);if(n===void 0){for(let n of t.cssClasses.split(` `)){let t=e.styleClasses.get(n);if(t)for(let e of t.styles)for(let t of e.split(`,`))S(t)}n=[...x],b.set(t.cssClasses,n)}else for(let[e,t]of n)x.set(e,t);for(let e of t.styles)S(e);return nm(x.size===0?Nb:[...x.values()])},w=new Int32Array(o.nodes.length);for(let e of o.nodes)e.parent>=0&&w[e.parent]++;let T=new Uint8Array(o.nodes.length);for(let e of o.edges){if(e.source<0||e.target<0)continue;let t=o.nodes[e.source].parent,n=o.nodes[e.target].parent;if(t!==n){for(let e=t;e>=0&&T[e]===0;e=o.nodes[e].parent)T[e]=1;for(let e=n;e>=0&&T[e]===0;e=o.nodes[e].parent)T[e]=1}}let E=[],D=[];o.nodes.forEach((e,t)=>{let n,r;if(e.isGroup){let a=Q(e.label,!1,m,u,4e3);n=O(e,a,0,0,u),w[t]>0?(r=op(0,0),r.isGroup=!0,r.padX=xb,r.padTop=a.height>0?a.height+16:xb,r.padBottom=xb,r.minW=a.width+2*xb-12+(T[t]===1&&!i?Math.min(a.width+24,240):0)):(n.w=Math.max(a.width+2*xb,80),n.h=a.height+2*xb,r=op(n.w,n.h))}else if(e.classNode)n=k(e,e.classNode),r=op(n.w,n.h);else if(e.shape===`note`){let t=Q(e.label,!0,m,d,260);n=O(e,t,Math.max(t.width+2*Cb,40),t.height+2*wb,d),r=op(n.w,n.h)}else{let t=Q(e.label,!1,m,d,200);n=O(e,t,Math.max(t.width,12)+4,Math.max(t.height,12),d),r=op(n.w,n.h)}r.parent=e.parent,r.seq=t,E.push(n),D.push(r)});function O(e,t,n,r,i){return{node:e,style:nm(Nb),label:t,w:n,h:r,loops:0,annotations:Nb,attributes:Mb,methods:Mb,titleH:0,attributesH:0,fontSize:i}}function k(e,t){let n=C(t),r=n.fontSize??u,i=Math.round(r*.875),a=Math.round(i*1.5),o=t.type?`<`+Hy(t.type).replace(/</g,`<`).replace(/>/g,`>`)+`>`:``,c=Q(t.label+o,!1,m,r,4e3,1|(n.italic?2:0)),d=t.annotations.length>0?t.annotations.map(e=>g(`«${e.trim()}»`,f)??`«${Xo(e).trim()}»`):Nb,h=t.members.length>0?t.members.map(e=>Pb(e,m,i,l(n))):Mb,_=t.methods.length>0?t.methods.map(e=>Pb(e,m,i,l(n))):Mb,v=c.width,y=0;for(let e of d)v=Math.max(v,typeof e==`string`?m.width(e,f,0):e.width),y+=typeof e==`string`?p:Math.max(p,e.height);for(let e of h)v=Math.max(v,e.width);for(let e of _)v=Math.max(v,e.width);let b=!(s&&h.length===0&&_.length===0),x=e=>b?e>0?2*Tb+e*a:Eb:0,S=2*wb+y+Math.max(c.height,Math.round(r*1.5)),w=x(h.length);return{node:e,style:n,label:c,w:Math.max(v+2*Cb,Db),h:S+w+x(_.length),loops:0,annotations:d,attributes:h,methods:_,titleH:S,attributesH:w,fontSize:r}}let A=[],j=[],M=[],N=[],P=[],F=new Float64Array(E.length*4),I=(e,t,n)=>{F[e*4+t]++,n>F[e*4+t+1]&&(F[e*4+t+1]=n)};for(let e of o.edges){if(e.source<0||e.target<0)continue;let t=Q(e.label,!0,m,d,200),n=_(e.startLabelRight),r=_(e.endLabelLeft);e.source===e.target?(E[e.source].loops++,D[e.source].w+=2*(Sb+(t.width>0?t.width+12:0))):(I(e.source,0,n),I(e.target,2,r)),N.push(n),P.push(r),j.push(e),M.push(t),A.push({src:e.source,dst:e.target,minlen:1,labelW:t.width>0?t.width+12:0,labelH:t.height>0?t.height+4:0,route:[],labelX:0,labelY:0})}if(v===`TB`||v===`BT`)for(let e=0;e<E.length;e++){if(!E[e].node.classNode)continue;let t=0;for(let n=0;n<4;n+=2){let r=F[e*4+n],i=F[e*4+n+1];r>1&&(t=Math.max(t,(r-1)*(i>0?i+24:14)+24))}t=Math.min(t,480),t>E[e].w&&(D[e].w+=t-E[e].w,E[e].w=t)}let L=!1;for(let e=0;e<j.length&&!L;e++)L=N[e]>0||P[e]>0;let R=0;if(v===`TB`||v===`BT`){let e=e=>e?Math.max(p,g(e,f)?.height??0):0;for(let t of j)R=Math.max(R,e(t.startLabelRight)+e(t.endLabelLeft)-2*p)}let z=lp(D,A,v,{nodeSep:jb(a,`nodeSpacing`,vb),edgeSep:yb,rankSep:jb(a,`rankSpacing`,L?bb+16:bb)+R,portSep:20,apart:!0}),B=new Map,V=[],H=(e,t,n,r,i)=>{let a=e.route,o=D[n],s=Lm(a,t,o);if(s<0)return;let c=(o.w-E[n].w)/2;s===1?a[t]-=c:s===3&&(a[t]+=c);let l=s&1,u=a[(t===0?3:t-3)+l],d=u-a[t+l],f={route:a,at:t,toward:u,order:i,room:r,side:s,after:l?d>0:d>=0},p=n*4+s,m=B.get(p);return m?m.push(f):B.set(p,[f]),f},U=[],ee=[];for(let e=0;e<A.length;e++){let t=A[e],n=t.src!==t.dst&&t.route.length>=6;U.push(n?H(t,0,t.src,N[e],e):void 0),ee.push(n?H(t,t.route.length-3,t.dst,P[e],e):void 0)}let te=(e,t,n)=>{for(let r=D[e].parent,i=0;r>=0&&i<1e4;r=D[r].parent,i++){let e=D[r],i=Math.abs(t-e.x),a=Math.abs(n-e.y);if(Math.abs(a-e.h/2)<.5&&i<=e.w/2+.5||Math.abs(i-e.w/2)<.5&&a<=e.h/2+.5)return!0}return!1},W=[];for(let[e,t]of B){if(t.length<2)continue;let n=e>>2,r=e&1,i=r?E[n].h:E[n].w;t.sort((e,t)=>e.toward-t.toward||e.order-t.order);let a=0;for(let e=0;e+1<t.length;e++){let n=t[e],i=t[e+1],o=r?20:24;n.room>0&&n.after&&(o+=r?p+6:n.room),i.room>0&&!i.after&&(o+=r?p+6:i.room),W[e]=o,a+=o}let o=Math.min(1,(i-24)/a);if(o<=0)continue;let s=(r?D[n].y:D[n].x)-a*o/2;for(let e=0;e<t.length;e++){let{route:i,at:a}=t[e],c=a===0?3:-3,l=a+c,u=-1;for(let e=l;e>=0&&e<i.length&&Math.abs(i[e+r]-i[l+r])<.5;e+=c)if(te(n,i[e],i[e+1])){u=e;break}if(u>=0&&Math.abs(i[l+r]-s)<=24)for(let e=l;e!==u+c;e+=c)i[e+r]=s;i[a+r]=s,s+=W[e]*o}}let ne=(e,t,n,r)=>{if(t===void 0||n<=0)return;let i=t.side&1,a=r?0:e.length-3,o=a+1-i,s=Math.abs(e[(r?3:a-3)+1-i]-e[o]),c=Math.min(i?n+10:p+6,s*.35);if(c<4)return;let l=[e[a],e[a+1],e[a+2]];l[1-i]+=(t.side===0||t.side===3?-1:1)*c,e.splice(r?3:a,0,l[0],l[1],l[2])};for(let e=0;e<A.length;e++)ne(A[e].route,U[e],N[e],!0),ne(A[e].route,ee[e],P[e],!1);let G=0,re=0,K=z.width,ie=z.height,q=(e,t,n,r,i,a,o)=>{if(!t)return;let s=g(t,f),c=s?Math.max(p,s.height):p,l=r,u=i;a&1?(l+=(a===3?-1:1)*(5+n/2),u+=(o?1:-1)*(7+c/2)):(l+=(o?1:-1)*(9+n/2),u+=(a===0?-1:1)*(3+c/2)),V.push({text:Xo(t),math:s,x:l,y:u,w:n,h:c,parent:e}),G=Math.min(G,l-n/2),K=Math.max(K,l+n/2),re=Math.min(re,u-c/2),ie=Math.max(ie,u+c/2)},ae=new Map,oe=new Int32Array(A.length);for(let e=0;e<A.length;e++){let t=A[e],n=j[e],r=t.route;if(t.src===t.dst){let r=ae.get(t.src)??0;ae.set(t.src,r+1),oe[e]=r;let i=D[t.src],a=E[t.src],o=i.x+a.w/2,s=Math.min(a.h/2-4,8+r*6);q(t.src,n.startLabelRight,N[e],o,i.y-s,1,!1),q(t.dst,n.endLabelLeft,P[e],o,i.y+s,1,!0),t.labelX=i.x+a.w/2+Sb+r*8+4+t.labelW/2,t.labelY=i.y}else if(r.length>=6){let i=r.length-3,a=U[e],o=ee[e];q(t.src,n.startLabelRight,N[e],r[0],r[1],a?a.side:2,!a||a.after),q(t.dst,n.endLabelLeft,P[e],r[i],r[i+1],o?o.side:0,!o||o.after)}}let se=n.maxWidth;if(se!==void 0&&se>0&&K-G+2*h>se){let e=V.map(e=>({...op(e.w,e.h,e.parent),x:e.x,y:e.y})),t=cb(D.concat(e),A,Math.max(1,se-2*h),jb(a,`nodeSpacing`,vb));t&&(V.forEach((t,n)=>{t.x=e[n].x,t.y=e[n].y}),G=re=0,K=t.width,ie=t.height)}let ce=h-G,le=h-re,ue=Math.ceil(K-G+2*h),de=Math.ceil(ie-re+2*h),fe=[],pe=new Map;if(o.nodes.length>0&&o.nodes[0].isGroup)for(let e of A)up(pe,e.route);let me=``,he=``,ge=``;for(let e=0;e<E.length;e++){let t=E[e],r=D[e],i=t.node,a=r.x+ce,s=r.y+le,c=Y(i.id),l=r.isGroup?r.w:t.w,u=r.isGroup?r.h:t.h;if(i.isGroup){let n=r.isGroup?dp(r,t.label.width,pe,xb):r.x,i=s-u/2+8+t.label.height/2,d=` class="pele-cluster-label" fill="var(--_m)"`,f=r.isGroup&&fp(r,t.label.width,n,pe);f&&(he+=pp(t.label,n+ce,i,d,c,o.nodes,e)),me+=`<g class="pele-cluster pele-namespace" data-id="${c}"><rect x="${X(a-l/2)}" y="${X(s-u/2)}" width="${X(l)}" height="${X(u)}" fill="var(--_a)" fill-opacity="0.5" stroke="var(--_b)"${Up}/>`+(f?``:Z(t.label,n+ce,i,d))+`</g>`;continue}let f=` transform="translate(${X(a)},${X(s)})"`;if(i.classNode)ge+=_e(t,i.classNode,c,f);else if(i.shape===`note`){let e=l/2,r=-u/2;ge+=`<g class="pele-node pele-note" data-id="${c}"${f}><path d="M${X(-e)},${X(r)}H${X(e-Ob)}L${X(e)},${X(r+Ob)}V${X(-r)}H${X(-e)}Z" fill="var(--_a)" stroke="var(--_b)" stroke-linejoin="round"/><path d="M${X(e-Ob)},${X(r)}V${X(r+Ob)}H${X(e)}" fill="none" stroke="var(--_b)" stroke-linejoin="round"/>`+Z(t.label,0,0,` class="pele-label" font-size="${d}"`,n.icons)+`</g>`}else ge+=`<g class="pele-node pele-interface" data-id="${c}"${f}>`+Z(t.label,0,0,` class="pele-label" font-size="${d}"`,n.icons)+`</g>`}function _e(e,t,r,i){let{w:a,h:o,style:s}=e,c=-a/2,d=-o/2,m=Math.round(e.fontSize*.875),h=Math.round(m*1.5),g=`<rect x="${X(c)}" y="${X(d)}" width="${X(a)}" height="${X(o)}" fill="var(--_s)" stroke="var(--_b)"${Kp(s.shape)}/>`,_=pl(s),v=d+e.titleH,y=v+e.attributesH;if(o>e.titleH){let e=s.stroke?` style="stroke:${Ec(s.stroke)}"`:``;g+=`<path class="pele-divider" d="M${X(c)},${X(v)}H${X(-c)}M${X(c)},${X(y)}H${X(-c)}" fill="none" stroke="var(--_b)"${e}/>`}let b=d+wb;for(let t of e.annotations)if(typeof t==`string`)g+=`<text class="pele-annotation" x="0" y="${X(b+p/2+f*.35)}" text-anchor="middle" font-size="${f}"${_||` fill="var(--_m)"`}>${Ec(t)}</text>`,b+=p;else{let e=Math.max(p,t.height);g+=Z(t,0,b+e/2,` class="pele-annotation" font-size="${f}"${_||` fill="var(--_m)"`}`,n.icons),b+=e}let x=e.fontSize===u?``:` font-size="${X(e.fontSize)}"`;g+=Z(e.label,0,(b+v-wb)/2,` class="pele-label"${x} font-weight="var(--_hw)"${_}${s.text}`,n.icons);let S=(e,t,n)=>{let r=``,i=n+Tb+h/2+m*.35;for(let n of e){let e=n.classifier===`$`?` pele-static"${s.text?s.text.slice(0,-1)+`text-decoration:underline"`:` style="text-decoration:underline"`}`:n.classifier===`*`?` pele-abstract" font-style="italic"${s.text}`:`"${s.text}`;r+=`<text class="pele-member pele-${t}${e} x="${X(c+Cb)}" y="${X(i)}">${Ec(n.text)}</text>`,i+=h}return r};return(e.attributes.length>0||e.methods.length>0)&&(g+=`<g class="pele-members" font-size="${m}"${_}${l(s)?` font-family="${Vp}"`:``}>${S(e.attributes,`attribute`,v)}${S(e.methods,`method`,y)}</g>`),t.tooltip&&(g=`<title>${Y(t.tooltip)}</title>`+g),t.link&&(g=Iu(g,t.link,t.id,fe,n,t.linkTarget&&Ab.has(t.linkTarget)?` target="${t.linkTarget}"`:``)),`<g class="pele-node pele-class${im(t.cssClasses.replace(/^default\s?/,``))}" data-id="${r}"${i}>${g}</g>`}let ve=``,ye=``;for(let e=0;e<A.length;e++){let t=A[e],r=j[e],i=M[e],a=r.arrowTypeStart,o=r.arrowTypeEnd,s=gb(a),c=gb(o),l;if(t.src===t.dst){let n=D[t.src],r=E[t.src],i=oe[e],a=n.x+ce+r.w/2,o=n.y+le,u=Math.min(r.h/2-4,8+i*6),d=Sb+i*8;l={d:`M${X(a+s)},${X(o-u)}C${X(a+d+s)},${X(o-u)} ${X(a+d+c)},${X(o+u)} ${X(a+c)},${X(o+u)}`,sx:a,sy:o-u,sdx:-1,sdy:0,ex:a,ey:o+u,edx:-1,edy:0}}else{let e=t.route;for(let t=0;t<e.length;t+=3)e[t]+=ce,e[t+1]+=le;l=yp(e,void 0,s,c)}let u=r.pattern===`dashed`?` stroke-dasharray="6 4"`:r.pattern===`dotted`?` stroke-dasharray="2 4"`:``;if(ve+=`<g class="pele-edge${r.pattern===`dotted`?` pele-note-edge`:` pele-relation`}" data-id="${Y(r.id)}"><path d="${l.d}"${u}/>`+_b(a,l.sx,l.sy,l.sdx,l.sdy,kb)+_b(o,l.ex,l.ey,l.edx,l.edy,kb)+`</g>`,i.width>0){let e=t.labelX+ce,a=t.labelY+le;ye+=Rp(r.id,i,e,a,``,n.icons)}}let be=``;for(let e of V)be+=e.math?Z(e.math,e.x+ce,e.y+le,` class="pele-cardinality"`,n.icons):`<text class="pele-cardinality" x="${X(e.x+ce)}" y="${X(e.y+le+f*.35)}" text-anchor="middle">${Ec(e.text)}</text>`;let xe=__(e.title,m,u,h,ue,de,(me?`<g class="pele-clusters">${me}</g>`:``)+(ve?`<g class="pele-edges" fill="none" stroke="${kb}" stroke-linecap="round">${ve}</g>`:``)+(he?`<g class="pele-cluster-titles">${he}</g>`:``)+(ye?`<g class="pele-edge-labels" font-size="${d}">${ye}</g>`:``)+(be?`<g class="pele-cardinalities" font-size="${f}" fill="var(--_m)">${be}</g>`:``)+`<g class="pele-nodes">${ge}</g>`);return{svg:lm(`class`,xe.width,xe.height,u,n,e,xe.content),width:xe.width,height:xe.height,links:fe}}var Lb={type:`class`,math:!0,parse(e,t,n){let r=new Xy;return n&&(r.title=n),sb(e,r),r},render:Fb},Rb=class{domains=new Map;transitions=[];setDomains(e){if(e)for(let t of e){let e=t.domain;this.domains.set(e,{name:e,items:(t.items??[]).map(e=>({label:e.label}))})}}setTransitions(e){e&&(this.transitions=e.filter(e=>e.from!==e.to).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))}};function zb(e,t){let n=new Rb;return n.setDomains(e.domains),n.setTransitions(e.transitions),{type:`cynefin`,title:e.title||t,accTitle:e.accTitle?e.accTitle.replace(/^\s+/g,``):void 0,accDescr:e.accDescr?e.accDescr.replace(/\n\s+/g,`
|
|
90
|
+
`):void 0,domains:n.domains,transitions:n.transitions}}var Bb=[{name:`cynefin-beta:`,pattern:`cynefin-beta:`},mg(`cynefin-beta`),{name:`-->`,pattern:`-->`},{name:`:`,pattern:`:`},{name:`DOMAIN_NAME`,pattern:/complex|complicated|clear|chaotic|confusion/y},ig,ag,og,cg,lg,ug,dg,fg,pg];function Vb(e){let t=new wg(rg(e,Bb,`cynefin`),Bb,`cynefin`),n={$type:`Cynefin`,domains:[],transitions:[]},r=()=>{for(;t.kinds[t.i]===9;)t.i++},i=()=>{t.kind!==-1&&(t.kind!==9&&t.fail(`a line break or the end of input`),r())};for(r(),t.kind!==1&&t.kind!==0&&t.fail(`'cynefin-beta'`),t.i++;t.kind!==-1;)switch(t.kind){case 9:t.i++;break;case 5:n.accDescr=xg(t.take()),i();break;case 6:n.accTitle=bg(t.take()),i();break;case 7:n.title=yg(t.take()),i();break;case 4:{let e=t.take();if(t.accept(2)){let r={$type:`Transition`,from:e,to:t.expect(4)};t.accept(3)&&(r.label=Cg(t.expect(8))),i(),n.transitions.push(r);break}let a={$type:`DomainBlock`,domain:e,items:[]};for(r();t.kinds[t.i]===8;)a.items.push({$type:`DomainItem`,label:Cg(t.take())}),r();n.domains.push(a);break}default:t.fail(`a domain, a transition, a title, or a line break`)}return n}function Hb(e){let t=e+1831565813|0;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Ub(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t}function Wb(e,t){return typeof e==`number`&&Number.isFinite(e)&&e!==0?e:Ub(t)}var Gb={segments:7,vertical:!0,pointStep:17,controlStep:31,controlShift:7},Kb={segments:7,vertical:!1,pointStep:23,controlStep:37,controlShift:11};function qb(e,t,n,r,i,a){let o=(t-e)/a.segments,s=[],c=[];for(let t=0;t<=a.segments;t++){let l=t===0&&a.pinStart||t===a.segments&&a.pinEnd;s.push(e+t*o),c.push(l?n:n+Hb(r+t*a.pointStep)*i*2-i)}let l=a.vertical?[c[0],s[0]]:[s[0],c[0]];for(let e=0;e<a.segments;e++){let t=(s[e]+s[e+1])/2,n=i*1.5*(e%2==0?1:-1)*Hb(r+e*a.controlStep+a.controlShift);a.vertical?l.push(c[e]+n,t,c[e+1]-n,t,c[e+1],s[e+1]):l.push(t,c[e]+n,t,c[e+1]-n,s[e+1],c[e+1])}return l}function Jb(e,t,n,r){let i=n-t;return[e,t,e+r,t+i*.2,e-r*1.5,t+i*.55,e+r*.5,t+i*.75,e-r,t+i*.85,e+r*.3,t+i*.95,e,n]}function Yb(e){let t=``;for(let n=2;n<e.length;n+=6)t+=`C${X(e[n])},${X(e[n+1])} ${X(e[n+2])},${X(e[n+3])} ${X(e[n+4])},${X(e[n+5])}`;return t}function Xb(e){let t=``;for(let n=e.length-6;n>=2;n-=6)t+=`C${X(e[n+2])},${X(e[n+3])} ${X(e[n])},${X(e[n+1])} ${X(e[n-2])},${X(e[n-1])}`;return t}function Zb(e){return`M${X(e[0])},${X(e[1])}${Yb(e)}`}function Qb(e,t,n,r){let i=`${X(n)},${X(r)}`;return`M${X(e-n)},${X(t)}A${i} 0 1,1 ${X(e+n)},${X(t)}A${i} 0 1,1 ${X(e-n)},${X(t)}Z`}var $b=[[`complex`,0,0,0],[`complicated`,1,0,1],[`chaotic`,0,1,3],[`clear`,1,1,2]],ex=4,tx=new Map([[`complex`,[`Complex`,`Probe → Sense → Respond`,`Emergent Practices`]],[`complicated`,[`Complicated`,`Sense → Analyse → Respond`,`Good Practices`]],[`clear`,[`Clear`,`Sense → Categorise → Respond`,`Best Practices`]],[`chaotic`,[`Chaotic`,`Act → Sense → Respond`,`Novel Practices`]],[`confusion`,[`Confusion`,``,`Disorder`]]]),nx=3,rx=200,ix=10,ax=4,ox=6,sx=10,cx=20,lx=10;function ux(e,t,n,r,i){let a=e.cynefin?.[t];return typeof a==`number`&&a>=r&&a<=i?a:n}function dx(e,t,n){let r=n.fontSize??16,i=Math.round(r*.8125),a=Math.round(r*.875),o=n.measurer??bc(n.fontFamily,n.fontFamilyMono),s=n.padding??8,c=n.icons,l=t.cynefin?.showDomainDescriptions!==!1,u=ux(t,`boundaryAmplitude`,8,0,50),d=Wb(ux(t,`seed`,0,-0x38d7ea4c68000,0x38d7ea4c68000),n.idPrefix??`pele`),f=Math.round(a*1.5),p=(e,t)=>{let n=Q(e,!1,o,a,rx);return{text:e,label:n,w:n.width+2*ix,h:Math.max(n.height,f)+2*ax,overflow:t}},m=t=>{let n=tx.get(t),a=Q(n[0],!1,o,r,4e3,1),s=[];if(l)for(let e of[n[1],n[2]])e&&s.push(Q(e,!1,o,i,4e3,2));let c=e.domains.get(t)?.items??[],u=t===`confusion`&&c.length>nx?nx:c.length,d=[];for(let e=0;e<u;e++)d.push(p(c[e].label,!1));u<c.length&&d.push(p(`+${c.length-u} more`,!0));let f=a.width,m=a.height;for(let e of s)f=Math.max(f,e.width),m+=e.height;d.length>0&&(m+=sx-ox);for(let e of d)f=Math.max(f,e.w),m+=ox+e.h;return{name:t,title:a,subtitles:s,badges:d,w:f,h:m,cx:0,cy:0}},h=$b.map(([e])=>m(e)),g=m(`confusion`),_=Math.max(88,g.w*.71+8),v=Math.max(64,g.h*.71+6),y=ux(t,`width`,640,100,1e4)/2,b=ux(t,`height`,440,100,1e4)/2;for(let e of h)y=Math.max(y,e.w+2*cx),b=Math.max(b,e.h+2*cx);for(let e of h){let t=(y-e.w)/2,n=(b-e.h)/2;if((t/(_+lx))**2+(n/(v+lx))**2>=1)continue;let r=e.w+2*(_+lx),i=e.h+2*(v+lx);r*b<=y*i?y=Math.max(y,r):b=Math.max(b,i)}let x=Q(e.title,!1,o,r,4e3,1),S=x.height>0?x.height+12:0,C=2*y,w=2*b,T=s,E=s+S,D=T+y,O=E+b,k=T+C,A=E+w,j=qb(E,O,D,d,u,{...Gb,segments:4,pinEnd:!0}),M=qb(T,D,O,d+100,u,{...Kb,segments:4,pinEnd:!0}),N=qb(D,k,O,d+200,u,{...Kb,segments:4,pinStart:!0}),P=Jb(D,O,A,C*.03),F=(e,t)=>t?`${X(e[e.length-2])},${X(e[e.length-1])}`:`${X(e[0])},${X(e[1])}`,I=new Map([[`complex`,`M${X(T)},${X(E)}L${F(j,!1)}${Yb(j)}${Xb(M)}Z`],[`complicated`,`M${F(j,!1)}L${X(k)},${X(E)}L${F(N,!0)}${Xb(N)}${Xb(j)}Z`],[`chaotic`,`M${F(M,!1)}${Yb(M)}${Yb(P)}L${X(T)},${X(A)}Z`],[`clear`,`M${F(N,!1)}${Yb(N)}L${X(k)},${X(A)}L${F(P,!0)}${Xb(P)}Z`]]),L=``;for(let[e,,,t]of $b)L+=`<path class="pele-cynefin-region" data-id="${e}" d="${I.get(e)}" fill="${om(t)}" fill-opacity="0.14"/>`;let R=`<g class="pele-cynefin-boundaries" fill="none" stroke="var(--_b)" stroke-dasharray="6 3"><path d="${Zb(j)}"/><path d="${Zb(M)}"/><path d="${Zb(N)}"/><path class="pele-cynefin-cliff" d="${Zb(P)}" stroke="var(--_l)" stroke-width="2" stroke-dasharray="none" stroke-linecap="round"/></g>`,z=Qb(D,O,_,v),B=`<path d="${z}" fill="var(--_bg)"/><path class="pele-cynefin-region" data-id="confusion" d="${z}" fill="${om(ex)}" fill-opacity="0.18" stroke="var(--_b)" stroke-dasharray="4 2"/>`,V=e=>{let t=e.cy-e.h/2,n=Z(e.title,e.cx,t+e.title.height/2,` class="pele-label" font-weight="var(--_hw)"`);t+=e.title.height;for(let r of e.subtitles)n+=Z(r,e.cx,t+r.height/2,` class="pele-cynefin-subtitle" font-size="${i}" font-style="italic" fill="var(--_m)"`),t+=r.height;t+=sx-ox;for(let r of e.badges)t+=ox,n+=`<g class="pele-node${r.overflow?` pele-cynefin-overflow`:``}"${r.overflow?``:` data-id="${Y(r.text)}"`}><rect x="${X(e.cx-r.w/2)}" y="${X(t)}" width="${X(r.w)}" height="${X(r.h)}" fill="var(--_bg)" stroke="var(--_b)"${r.overflow?` stroke-dasharray="3 2"`:``}${Up}/>`+Z(r.label,e.cx,t+r.h/2,` class="pele-label" font-size="${a}"${r.overflow?` fill="var(--_m)"`:``}`,c)+`</g>`,t+=r.h;return`<g class="pele-cynefin-domain" data-id="${e.name}">${n}</g>`},H=new Map,U=``;$b.forEach(([e,t,n],r)=>{let i=h[r];i.cx=T+y*(t+.5),i.cy=E+b*(n+.5),H.set(e,i),U+=V(i)}),g.cx=D,g.cy=O,H.set(`confusion`,g),U+=V(g);let ee=(e,t,n)=>e===g?((t-D)/(_+4))**2+((n-O)/(v+4))**2<=1:Math.abs(t-e.cx)<=e.w/2+8&&Math.abs(n-e.cy)<=e.h/2+8,te=``,W=new Map;for(let t of e.transitions){let e=H.get(t.from),n=H.get(t.to);if(!e||!n||e===n)continue;let r=t.from<t.to?`${t.from} ${t.to}`:`${t.to} ${t.from}`,a=W.get(r)??0;W.set(r,a+1);let s=n.cx-e.cx,l=n.cy-e.cy,u=Math.hypot(s,l)||1,d=(e.cx+n.cx)/2,f=(e.cy+n.cy)/2,p=-l*(d-D)+s*(f-O)>=0?1:-1,m=-l/u*p,h=s/u*p,y=(e!==g&&n!==g&&Math.abs(s)>1&&Math.abs(l)>1?2*(Math.hypot(_*m,v*h)+16):u*.15)+a*56,b=d+m*y,x=f+h*y,S=t=>{let r=1-t;return[r*r*e.cx+2*r*t*b+t*t*n.cx,r*r*e.cy+2*r*t*x+t*t*n.cy]},C=(e,t,n,r)=>{for(let i=0;i<16;i++){let i=(t+n)/2;ee(e,...S(i))===r?t=i:n=i}return(t+n)/2},w=1;for(;w<=48&&ee(e,...S(w/48));)w++;if(w>48)continue;let E=C(e,(w-1)/48,w/48,!0);for(;w<=48&&!ee(n,...S(w/48));)w++;let A=w>48?1:C(n,(w-1)/48,w/48,!1),[j,M]=S(E),[N,P]=S(A),F=(e,t,n)=>(1-E)*(1-A)*e+((1-E)*A+E*(1-A))*t+E*A*n,I=F(e.cx,b,n.cx),L=F(e.cy,x,n.cy),R=Math.hypot(N-I,P-L)||1,z=(N-I)/R,B=(P-L)/R,V=xp(`arrow_point`,N,P,z,B,`var(--_l)`);N-=z*bp(`arrow_point`),P-=B*bp(`arrow_point`);let U=``;if(t.label){let e=Q(t.label,!1,o,i,rx),[n,r]=S((E+A)/2),a=Math.abs(m)*e.width/2+Math.abs(h)*e.height/2+6,s=e.width/2+4;U=Z(e,Math.min(Math.max(n+m*a,T+s),Math.max(k-s,T+s)),r+h*a,` class="pele-edge-label" font-size="${i}"`,c)}te+=`<g class="pele-edge" data-id="${t.from}-${t.to}"><path d="M${X(j)},${X(M)}Q${X(I)},${X(L)} ${X(N)},${X(P)}" fill="none" stroke="var(--_l)"/>`+V+U+`</g>`}let ne=Math.ceil(Math.max(C,x.width)+2*s),G=Math.ceil(w+S+2*s);return{svg:lm(`cynefin`,ne,G,r,n,e,Z(x,T+C/2,s+x.height/2,` class="pele-title" font-weight="var(--_tw)"`)+`<g class="pele-cynefin-regions">${L}</g>`+R+B+U+(te?`<g class="pele-edges">${te}</g>`:``)),width:ne,height:G,links:[]}}var fx={type:`cynefin`,parse:(e,t,n)=>zb(Vb(e),n),render:dx};function px(e){return e===`markdown`||e===`string`||e===`text`?e:`markdown`}var mx=class{type=`er`;direction=`TB`;entities=new Map;relationships=[];classes=new Map;subgraphs=[];title;accTitle;accDescr;subgraphLookup=new Map;claimed=new Set;addEntity(e,t=``){let n=this.entities.get(e);return n===void 0?(n={id:`entity-${e}-${this.entities.size}`,label:e,alias:t,attributes:[],cssClasses:`default`,cssStyles:[]},this.entities.set(e,n)):!n.alias&&t&&(n.alias=t),n}addAttributes(e,t){let n=this.addEntity(e);for(let e=t.length-1;e>=0;e--){let r=t[e];r.keys??=[],r.comment??=``,n.attributes.push(r)}}addRelationship(e,t,n,r){let i=this.subgraphLookup.has(e)?e:this.addEntity(e).id,a=this.subgraphLookup.has(n)?n:this.addEntity(n).id;this.relationships.push({entityA:i,roleA:t,entityB:a,relSpec:r})}setDirection(e){this.direction=e}addCssStyles(e,t){if(t)for(let n of e){let e=this.entities.get(n);if(e)for(let n of t)e.cssStyles.push(n);let r=this.subgraphLookup.get(n);if(r)for(let e of t)r.cssStyles.push(e)}}addClass(e,t){for(let n of e){let e=this.classes.get(n);if(e===void 0&&(e={id:n,styles:[],textStyles:[]},this.classes.set(n,e)),t)for(let n of t)n.includes(`color`)&&e.textStyles.push(n.replace(`fill`,`bgFill`)),e.styles.push(n)}}setClass(e,t){for(let n of e){let e=this.entities.get(n);if(e)for(let n of t)e.cssClasses+=` `+n;let r=this.subgraphLookup.get(n);if(r)for(let e of t)r.classes.push(e)}}addSubGraph(e,t,n){let r=e.text.trim(),i=new Set,a=[],o;for(let e of t.flat()){if(typeof e!=`string`){e?.stmt===`dir`&&(o=e.value);continue}let t=e.trim();t===``||i.has(t)||(i.add(t),this.claimed.has(e)||a.push(e))}for(let e of a)this.claimed.add(e);let s={id:r,nodes:a,title:(n.text||``).trim(),classes:[],cssStyles:[],dir:o,labelType:px(n.type)};return this.subgraphs.push(s),this.subgraphLookup.set(r,s),r}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
91
|
+
`)}},hx=`$end.INVALID.ER_DIAGRAM.EOF.NEWLINE.COLON.STYLE_SEPARATOR.BLOCK_START.BLOCK_STOP.SQS.SQE.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.END.SUBGRAPH.direction_tb.direction_bt.direction_rl.direction_lr.CLASSDEF.UNICODE_TEXT.STYLE_TEXT.COMMA.CLASS.STYLE.SEMI.NUM.BRKT.ENTITY_NAME.DECIMAL_NUM.ENTITY_ONE.ATTRIBUTE_WORD.ATTRIBUTE_KEY.COMMENT.ZERO_OR_ONE.ZERO_OR_MORE.ONE_OR_MORE.ONLY_ONE.MD_PARENT.NON_IDENTIFYING.IDENTIFYING.WORD.CHAR`.split(`.`),gx=1,_x=2,vx=4,yx=8,bx=new Uint8Array(128);for(let e=0;e<128;e++){let t=e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95,n=t&&(e<48||e>57);t&&(bx[e]|=gx|_x|yx),n&&(bx[e]|=vx)}for(let e of`-*`)bx[e.charCodeAt(0)]|=gx|_x|yx;bx[46]|=gx|yx,bx[42]|=vx;for(let e of`[](),`)bx[e.charCodeAt(0)]|=yx;var xx=/accTitle\s*:\s*/iy,Sx=/accDescr\s*:\s*/iy,Cx=/accDescr\s*\{\s*/iy,wx=[/.*direction\s+TB[^\n]*/iy,/.*direction\s+BT[^\n]*/iy,/.*direction\s+RL[^\n]*/iy,/.*direction\s+LR[^\n]*/iy],Tx=/direction/gi,Ex=/[\n\r\u2028\u2029]/g;function Dx(e,t){return e<128?(bx[e]&t)!==0:e>=192||e===181}function Ox(e){let t=e.length,n=[],r=[],i=[],a=0,o=0,s=-2,c=0,l=-1,u=-2,d=-1,f=-1,p=-1,m=(t,a,s)=>{n.push(t),r.push(e.slice(a,s)),i.push(a),o=s},h=(t,n)=>(t.lastIndex=n,t.test(e)?t.lastIndex:-1),g=t=>{for(let n=0;n<t.length;n++){let r=t.charCodeAt(n),i=e.charCodeAt(o+n);if(i!==r&&(r<97||r>122||(i|32)!==r))return!1}return!0},_=t=>g(t)&&!Ls(e.charCodeAt(o+t.length)),v=t=>{let n=e.charCodeAt(t);return n>=65&&n<=90?n+32:n},y=n=>(Ex.lastIndex=n,Ex.test(e)?Ex.lastIndex-1:t),b=t=>{for(;Ps(e.charCodeAt(t));)t++;return t},x=()=>{if(s===-1||s<o&&(Tx.lastIndex=o,s=Tx.test(e)?Tx.lastIndex-9:-1,s===-1)||o<c||(l<o&&(l=y(o)),s>=l))return!1;for(let e=0;e<4;e++){let t=h(wx[e],o);if(t>=0)return m(18+e,o,t),!0}return c=l,!1},S=()=>{let t=e.indexOf(`"`,o+1);if(t===-1){m(45,o,o+1);return}let n=t>o+1;for(let r=o+1;n&&r<t;r++){let t=e.charCodeAt(r);(t===37||t===92||t===13||t===10||t===11||t===8)&&(n=!1)}m(n?31:44,o,t+1)},C=t=>{let n=e.charCodeAt(o+1);if(n===43&&(t===49||t===48)){m(t===49?39:38,o,o+2);return}let r=b(o+1);if(e.charCodeAt(r)===46&&Ps(e.charCodeAt(r+1)))m(32,o,b(r+2));else{if(t===49){if(J(n)){let t=o+2;for(;J(e.charCodeAt(t));)t++;let n=e.charCodeAt(t);if(Ls(n)||n===34||n===39){m(40,o,o+1);return}}else if(n===45||n===46){let t=e.charCodeAt(o+2);if(t===45||t===46){m(40,o,o+1);return}}if(!Ls(n)){m(33,o,o+1);return}}m(29,o,r)}},w=t=>{let n=e.charCodeAt(o+1);switch(t){case 101:if(_(`erdiagram`))m(2,o,o+9);else if(_(`end`)){let t=o+3;for(;J(e.charCodeAt(t));)t++;m(16,o,t)}else return!1;return!0;case 115:if(_(`style`))a=6,m(27,o,o+5);else if(_(`subgraph`))m(17,o,o+8);else return!1;return!0;case 99:if(_(`classdef`))a=6,m(22,o,o+8);else if(_(`class`))m(26,o,o+5);else return!1;return!0;case 111:if(_(`one or zero`))m(37,o,o+11);else if(_(`one or more`)||_(`one or many`))m(39,o,o+11);else if(_(`one`))m(40,o,o+3);else if(_(`only one`))m(40,o,o+8);else if(n===124)m(37,o,o+2);else if(n===123)m(38,o,o+2);else if(_(`optionally to`))m(42,o,o+13);else return!1;return!0;case 122:if(_(`zero or one`))m(37,o,o+11);else if(_(`zero or more`)||_(`zero or many`))m(38,o,o+12);else return!1;return!0;case 109:if(g(`many(0)`))m(38,o,o+7);else if(g(`many(1)`))m(39,o,o+7);else if(_(`many`))m(38,o,o+4);else return!1;return!0;case 116:return _(`to`)?(m(43,o,o+2),!0):!1;case 117:return n!==46&&n!==45&&n!==124?!1:(m(41,o,o+1),!0);case 124:if(v(o+1)===111&&!Ls(e.charCodeAt(o+2)))m(37,o,o+2);else if(n===124)m(40,o,o+2);else if(n===123)m(39,o,o+2);else return!1;return!0;case 125:if(v(o+1)===111&&!Ls(e.charCodeAt(o+2)))m(38,o,o+2);else if(n===124)m(39,o,o+2);else return!1;return!0;case 46:return n!==46&&n!==45?!1:(m(42,o,o+2),!0);case 45:if(n===45)m(43,o,o+2);else if(n===46)m(42,o,o+2);else return!1;return!0}return!1},T=t=>{let n;if((t===97||t===65)&&g(`acc`)){if((n=h(xx,o))>=0){a=3,m(11,o,n);return}if((n=h(Sx,o))>=0){a=4,m(13,o,n);return}if((n=h(Cx,o))>=0){a=5,o=n;return}}if(!x()){switch(t){case 32:case 9:case 13:n=o+1;for(let t=e.charCodeAt(n);t===32||t===9||t===13;t=e.charCodeAt(n))n++;o=n;return;case 10:for(n=o+1;e.charCodeAt(n)===10;)n++;m(4,o,n);return;case 34:S();return;case 123:a=1,m(7,o,o+1);return;case 35:m(30,o,o+1);return;case 44:m(25,o,o+1);return;case 58:e.charCodeAt(o+1)===58&&e.charCodeAt(o+2)===58?m(6,o,o+3):m(5,o,o+1);return;case 91:m(9,o,o+1);return;case 93:m(10,o,o+1);return}if(Ps(t)){C(t);return}if(!w(t>=65&&t<=90?t+32:t)){if(t>=128||(bx[t]&gx)!==0){n=o+1;for(let t=e.charCodeAt(n);t>=128||(bx[t]&gx)!==0;t=e.charCodeAt(n))n++;m(23,o,n);return}m(45,o,o+1)}}},E=()=>{if(u===-1||u<o&&(u=e.indexOf(`~`,o),u===-1))return!1;if(p<o){let n=o;for(;n<t&&!J(e.charCodeAt(n));)n++;p=n}if(u>=p||(d<o&&(d=y(o),f=e.lastIndexOf(`~`,d-1)),f<=u))return!1;let n=f+1;for(;n<t&&!J(e.charCodeAt(n));)n++;return m(34,o,n),!0},D=n=>{if(J(n)){for(o++;J(e.charCodeAt(o));)o++;return}let r=n|32;if((r===112||r===102||r===117)&&(e.charCodeAt(o+1)|32)==107&&!Ls(e.charCodeAt(o+2)))m(35,o,o+2);else if(!E()){if(Dx(n,vx)){let n=o+1;for(;n<t&&Dx(e.charCodeAt(n),yx);)n++;m(34,o,n);return}if(n===96){a=2,o++;return}if(n===34){let t=e.indexOf(`"`,o+1);if(t!==-1){m(36,o,t+1);return}}else if(n===125){a=0,m(8,o,o+1);return}m(45,o,o+1)}};for(;o<t;){let s=e.charCodeAt(o),c;switch(a){case 0:T(s);break;case 1:D(s);break;case 2:s===96?(a=1,o++):(c=e.indexOf("`",o),m(34,o,c===-1?t:c));break;case 3:case 4:c=e.indexOf(`
|
|
92
|
+
`,o),m(a===3?12:14,o,c===-1?t:c),a=0;break;case 5:s===125?(a=0,o++):(c=e.indexOf(`}`,o),m(15,o,c===-1?t:c));break;case 6:if(s===10){for(c=o+1;e.charCodeAt(c)===10;)c++;a=0,m(4,o,c)}else if(J(s))for(o++;J(e.charCodeAt(o));)o++;else if(s===58)m(5,o,o+1);else if(s===44)m(25,o,o+1);else if(s===35)m(30,o,o+1);else if(s===59)m(28,o,o+1);else if(s>=128||(bx[s]&_x)!==0){c=o+1;for(let t=e.charCodeAt(c);t>=128||(bx[t]&_x)!==0;t=e.charCodeAt(c))c++;m(24,o,c)}else return n.push(1),r.push(``),i.push(o),{types:n,texts:r,starts:i}}}let O=a===0?3:a===3?12:a===4?14:a===5?15:-1;return O!==-1&&(n.push(O),r.push(``),i.push(t)),n.push(0),r.push(``),i.push(t),{types:n,texts:r,starts:i}}var kx=new Map([[37,`ZERO_OR_ONE`],[38,`ZERO_OR_MORE`],[39,`ONE_OR_MORE`],[40,`ONLY_ONE`],[41,`MD_PARENT`]]),Ax=[`TB`,`BT`,`RL`,`LR`],jx=`'UNICODE_TEXT', 'NUM', 'ENTITY_NAME', 'DECIMAL_NUM', 'ENTITY_ONE'`,Mx=`'ZERO_OR_ONE', 'ZERO_OR_MORE', 'ONE_OR_MORE', 'ONLY_ONE', 'MD_PARENT'`,Nx=`'EOF', 'NEWLINE', 'title', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'SUBGRAPH', 'direction_tb', 'direction_bt', 'direction_rl', 'direction_lr', 'CLASSDEF', 'CLASS', 'STYLE', `+jx;function Px(e,t){let{types:n,texts:r,starts:i}=Ox(e),a=0,o=t=>{let o=n[a];throw o===1?zo(`er`,e,i[a],``,!0):zo(`er`,e,i[a],`Expecting ${t}, got '${o===45?r[a]:hx[o]}'`)},s=e=>(n[a]!==e&&o(`'${hx[e]}'`),r[a++]),c=()=>{let e=n[a];e!==4&&e!==28&&e!==3&&o(`'EOF', 'NEWLINE', 'SEMI'`),a++},l=e=>e===23||e===31||e===29||e===32||e===33,u=()=>{let e=n[a];l(e)||o(jx);let t=r[a++];return e===31?t.slice(1,-1):t},d=()=>{let e=[];for(;;){let t=n[a];if(t!==23&&t!==24&&o(`'UNICODE_TEXT', 'STYLE_TEXT'`),e.push(r[a++]),n[a]!==25)return e;a++}},f=e=>e===24||e===29||e===5||e===30,p=()=>{let e=[];for(;;){f(n[a])||o(`'STYLE_TEXT', 'COLON', 'NUM', 'BRKT'`);let t=r[a++];for(;f(n[a]);)t+=r[a++];if(e.push(t),n[a]!==25)return e;a++}},m=()=>{let e=kx.get(n[a++]),t=n[a];t!==43&&t!==42&&o(`'NON_IDENTIFYING', 'IDENTIFYING'`);let r=t===43?`IDENTIFYING`:`NON_IDENTIFYING`;a++;let i=kx.get(n[a]);return i===void 0?o(Mx):(a++,{cardA:i,relType:r,cardB:e})},h=()=>{let e=n[a];e!==44&&e!==31&&e!==23&&o(`'UNICODE_TEXT', 'ENTITY_NAME', 'WORD'`);let t=r[a++];return e===23?t:t.slice(1,-1)},g=e=>n[a]===45&&r[a]===e,_=()=>{let e=[];do{let t=s(34);g(`?`)&&(t+=r[a++]),n[a]!==34&&o(t.endsWith(`?`)?`'ATTRIBUTE_WORD'`:`'ATTRIBUTE_WORD', '?'`);let i={type:t,name:r[a++]};if(n[a]===35){let e=[r[a++]];for(;g(`,`);)a++,e.push(s(35));i.keys=e}n[a]===36&&(i.comment=r[a++].slice(1,-1)),e.push(i)}while(n[a]!==8);return e.reverse()},v=()=>{if(n[a]!==7)return;if(a++,n[a]===8){a++;return}let e=_();return a++,e},y=()=>{let e=u(),r=n[a];if(r===9){a++;let r=u();s(10);let i;n[a]===6&&(a++,i=d());let o=v();return t.addEntity(e,r),o&&t.addAttributes(e,o),i&&t.setClass([e],i),[e]}let i;if(r===6&&(a++,i=d(),r=n[a]),kx.has(r)){let r=m(),o=u(),c;n[a]===6&&(a++,c=d()),s(5);let l=h();return t.addEntity(e),t.addEntity(o),t.addRelationship(e,l,o,r),i&&t.setClass([e],i),c&&t.setClass([o],c),[e,o]}let o=v();return t.addEntity(e),o&&t.addAttributes(e,o),i&&t.setClass([e],i),[e]};s(2);let b=[{id:``,title:``,list:[]}],x=b[0],S=!1;for(;;){let e=n[a];switch(e){case 4:a++;break;case 3:a++,S&&o(`'END', ${Nx}`);return;case 16:{S||o(Nx),a++;let e=t.addSubGraph({text:x.id},x.list,{text:x.title});b.pop(),x=b[b.length-1],S=b.length>1,S&&x.list.push(e);break}case 17:{a++;let e=u(),t=e;if(n[a]===9){for(a++,t=u();l(n[a]);)t+=` `+u();s(10)}c(),x={id:e,title:t,list:[]},b.push(x),S=!0;break}case 11:{a++;let e=s(12).trim();t.setAccTitle(e),S&&x.list.push(e);break}case 13:{a++;let e=s(14).trim();t.setAccDescription(e),S&&x.list.push(e);break}case 15:{let e=r[a++].trim();t.setAccDescription(e),S&&x.list.push(e);break}case 18:case 19:case 20:case 21:{a++;let n=Ax[e-18];S?x.list.push({stmt:`dir`,value:n}):t.setDirection(n);break}case 22:{let e=r[a++],n=d(),i=p();c(),t.addClass(n,i),S&&x.list.push(e);break}case 26:{let e=r[a++],n=d();t.setClass(n,d()),S&&x.list.push(e);break}case 27:{let e=r[a++],n=d(),i=p();c(),t.addCssStyles(n,i),S&&x.list.push(e);break}default:{l(e)||o(S?`'END', ${Nx}`:Nx);let t=y();if(S)for(let e of t)x.list.push(e)}}}}var Fx=[];function Ix(e){let t=[],n=[],r=e.subgraphs,i=t=>{let n=[];for(let r of t){let t=e.classes.get(r);if(t!==void 0){for(let e of t.styles)n.push(e.trim());for(let e of t.textStyles)n.push(e.trim())}}return n},a=new Map,o=new Set;for(let e=r.length-1;e>=0;e--){let t=r[e];o.add(t.id);for(let e of t.nodes)a.set(e,t.id)}for(let e=r.length-1;e>=0;e--){let n=r[e];t.push({id:n.id,label:n.title,alias:``,attributes:Fx,isGroup:!0,parentId:a.get(n.id),cssStyles:n.cssStyles,cssCompiledStyles:i(n.classes),cssClasses:n.classes.join(` `),dir:n.dir,labelType:n.labelType})}let s=new Map;for(let[n,r]of e.entities)o.has(n)?s.set(r.id,n):t.push({id:r.id,label:r.label,alias:r.alias,attributes:r.attributes,isGroup:!1,parentId:a.get(n),cssStyles:r.cssStyles,cssCompiledStyles:i(r.cssClasses.split(` `)),cssClasses:r.cssClasses,dir:void 0,labelType:`markdown`});return e.relationships.forEach((e,t)=>{n.push({id:`id_${e.entityA}_${e.entityB}_${t}`,start:s.get(e.entityA)??e.entityA,end:s.get(e.entityB)??e.entityB,label:e.roleA,arrowTypeStart:e.relSpec.cardB.toLowerCase(),arrowTypeEnd:e.relSpec.cardA.toLowerCase(),pattern:e.relSpec.relType===`IDENTIFYING`?`solid`:`dashed`})}),{nodes:t,edges:n}}var Lx=18,Rx=5,zx=6,Bx=10,Vx=3.5;function Hx(e,t,n,r,i){let a=(e,a)=>X(t-r*e-i*a)+`,`+X(n-i*e+r*a),o=e=>`M${a(e,-Rx)}L${a(e,Rx)}`,s=`M${a(0,-zx)}L${a(Bx,0)}L${a(0,zx)}`,c=e=>`<circle class="pele-marker" cx="${X(t-r*e)}" cy="${X(n-i*e)}" r="${Vx}" fill="var(--_bg)"/>`,l=e=>`<path class="pele-marker" d="${e}"/>`;switch(e){case`only_one`:return l(o(6)+o(10));case`zero_or_one`:return l(o(6))+c(13.5);case`one_or_more`:return l(s+o(Bx+3.5));case`zero_or_more`:return l(s)+c(Bx+Vx+.5);case`md_parent`:return`<path class="pele-marker" d="M${a(0,0)}L${a(6,4)}L${a(12,0)}L${a(6,-4)}Z" fill="var(--_bg)"/>`}return``}var Ux=48,Wx=20,Gx=64,Kx=20,qx=28,Jx=38,Yx=96,Xx=18,Zx=12,Qx=9,$x=12,eS=16,tS=9,nS=260,rS=1e6,iS=[],aS=18,oS=14,sS=` fill="var(--_s)" stroke="var(--_b)"`;function cS(e,t,n){let r=e.er?.[t];return typeof r==`number`&&r>0?Math.min(r,2e3):n}function lS(e,t,n,r,i,a=0){let o=e.lines;if(o.length===0)return``;let s=o.length===1&&o[0].length===1?o[0][0]:void 0;if(s&&s.icon===void 0&&s.math===void 0&&s.style===a&&!(a&&s.text.includes(` `)))return`<text${Uc(r,a)} x="${X(t)}" y="${X(n)}">${Ec(s.text)}</text>`;let c=Hc(e),l=e.size*.35,u=n-l-e.lineHeight/2,d=``,f=``;for(let a=0;a<o.length;a++){let s=o[a],p=u+bh(e,a);if(yh(s)){f+=Z(xh(e,a),t+e.widths[a]/2,p,r,i);continue}n=p+l;let m=!1;for(let e of s)e.icon!==void 0&&(m=!0);let h=t,g=!1;for(let t of s){if(t.icon!==void 0){let r=e.size*1.1;f+=`<svg class="pele-icon" data-icon="${Y(t.icon)}" x="${X(h)}" y="${X(n-e.size*.35-r/2)}" width="${X(r)}" height="${X(r)}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${i?.(t.icon)??``}</svg>`}else if(t.text!==``){let e=m||!g?` x="${X(h)}" y="${X(n)}"`:``;d+=`<tspan${e}${Vc(t.style&~c)}>${Ec(t.text)}</tspan>`,g=!0}h+=t.width}}return`<text${Uc(r,c)} xml:space="preserve">${d}</text>${f}`}function uS(e){let t=Hy(e);return t===e?e:t.replace(/</g,`<`).replace(/>/g,`>`)}function dS(e,t,n){return Dh(e.direction)?Eh(n,r=>fS(e,t,n,r)):fS(e,t,n,!1)}function fS(e,t,n,r){let i=Ix(e),a=Array.isArray(n.monospace)&&n.monospace.includes(`attributes`),o=n.fontSize??16,s=Math.round(o*.875),c=n.measurer??bc(n.fontFamily,n.fontFamilyMono),l=n.padding??8,u=n.icons,d=new Map,f=[],p=[];i.nodes.forEach((e,t)=>d.set(e.id,t));let m=[],h=[],g=[],_=new Map,v=[];for(let e of i.edges){let t=d.get(e.start),n=d.get(e.end);if(t===void 0||n===void 0)continue;let r=Q(e.label,!0,c,s,200),i;if(t===n){i={label:r,band:0,at:0};let e=_.get(t);e?e.push(i):_.set(t,[i])}v.push(i),g.push(e),h.push(r),m.push({src:t,dst:n,minlen:1,labelW:r.width>0?r.width+12:0,labelH:r.height>0?r.height+4:0,route:[],labelX:0,labelY:0})}let y=t=>{let n=t;for(let e=0;e<i.nodes.length;e++){let e=i.nodes[n].parentId,t=e===void 0?void 0:d.get(e);if(t===void 0)break;let r=i.nodes[t].dir;if(r)return r===`LR`||r===`RL`;n=t}return e.direction===`LR`||e.direction===`RL`};for(let e=0;e<i.nodes.length;e++){let t=i.nodes[e],n=nm(t.cssStyles.length>0?t.cssCompiledStyles.concat(t.cssStyles):t.cssCompiledStyles),r=+!!n.bold|(n.italic?2:0),l=a&&!/[";]font-family:/.test(n.text)?4:0,u=n.fontSize??o,d=n.fontSize??s,m=n.fontSize??Math.round(o*.75),h=t.isGroup?Q(t.label,!0,c,u,4e3,r):Q(t.alias||t.label,!0,c,u,240,r),g=_.get(e)??iS,v=g.length>0&&!t.isGroup&&y(e),b={node:t,style:n,label:h,w:0,h:0,headH:0,rows:[],cols:[],rowSize:d,keySize:m,mono:l,below:v},x=0,S=0;for(let e of g)e.band=Math.max(Jx,v?e.label.width+12:e.label.height+6),S+=e.band,x=Math.max(x,v?e.label.height:e.label.width);let C=Math.max(Yx,v?S+8:0),w;if(t.isGroup)w=op(0,0),w.isGroup=!0,w.dir=t.dir?Vf(t.dir):void 0,w.padX=Kx,w.padTop=b.label.height>0?b.label.height+16:Kx,w.padBottom=Kx,w.minW=Math.max(b.label.width+2*Kx-12,Yx);else{let e=Math.max(h.height,Math.round(u*1.5));if(t.attributes.length===0)b.w=Math.max(h.width+2*Xx,C),b.h=Math.max(e+2*Zx,v?0:S+8);else{let n=Math.round(d*1.5),i=[0,0,0,0];for(let e of t.attributes){let t=[Q(uS(e.type),!0,c,d,rS,r|l),Q(uS(e.name),!0,c,d,rS,r|l),Q(e.keys.join(`, `),!1,c,m,rS,r|l),Q(uS(e.comment),!0,c,d,nS,r)],a=n;for(let e=0;e<4;e++)t[e].width>i[e]&&(i[e]=t[e].width),t[e].height>a&&(a=t[e].height);b.rows.push({cells:t,h:a+tS}),b.h+=a+tS}let a=0,o=0;for(let e of i)e!==0&&(o+=e+(a>0?eS:0),a++);b.w=Math.max(o+2*$x,h.width+2*Xx,C);let s=a>0?(b.w-o-2*$x)/a:0,u=$x;for(let e of i)b.cols.push(u),e>0&&(u+=e+s+eS);b.headH=e+2*Qx,b.h+=b.headH}let n=g.length>0?2*(Lx+qx*.75+10+x):0;w=v?op(b.w,b.h+n):op(b.w+n,b.h)}w.seq=f.length,f.push(b),p.push(w)}i.nodes.forEach((e,t)=>{p[t].parent=e.parentId===void 0?-1:d.get(e.parentId)??-1});let b=lp(p,m,r?`TB`:Vf(e.direction),{nodeSep:cS(t,`nodeSpacing`,Ux),edgeSep:Wx,rankSep:cS(t,`rankSpacing`,Gx),portSep:24});mS(m,p,f);let x=b.width;for(let[e,t]of _){let n=p[e];if(!n.isGroup)continue;let r=0;for(let e of t)r=Math.max(r,e.label.width);x=Math.max(x,n.x+n.w/2+Lx+qx*.75+10+r)}let S=g_(e.title,c,o,4e3),C=S.height>0?S.height+12:0,w=Math.max(x,S.width);ap(p,m,l+(w-x)/2,l+C);let T=Math.ceil(w+2*l),E=Math.ceil(b.height+C+2*l),D=[],O=new Map,k=!1;for(let e of p)e.isGroup&&(k=!0);if(k)for(let e of m)up(O,e.route);let A=``,j=[],M=``;for(let e=0;e<f.length;e++){let t=f[e],r=p[e],i=t.node,a=im(i.cssClasses.replace(/^default\s?/,``));if(r.isGroup){t.w=r.w,t.h=r.h;let e=r.x-r.w/2,n=r.y-r.h/2,o=dp(r,t.label.width,O,Kx);fl(t.style.shape)&&j.push({box:[e,n,e+r.w,n+r.h],shape:t.style.shape}),A+=`<g class="pele-cluster${a}" data-id="${Y(i.id)}"><rect x="${X(e)}" y="${X(n)}" width="${X(r.w)}" height="${X(r.h)}" fill="var(--_a)"${Gp(t.style.shape)?``:` fill-opacity="0.5"`} stroke="var(--_b)"${Kp(t.style.shape)}/>`+Z(t.label,o,n+8+t.label.height/2,` class="pele-cluster-label"${pl(t.style,`var(--_m)`)}${t.style.text}`,u)+`</g>`;continue}let o=t.w,s=t.h,c=-o/2,l=-s/2,d=t.style.text,m=pl(t.style),h=m||` fill="var(--_m)"`,g=`x="${X(c)}" y="${X(l)}" width="${X(o)}" height="${X(s)}"`,_=Z(t.label,0,t.rows.length>0?l+t.headH/2:0,` class="pele-label"${m}${d}`,u),v=Xo(i.alias||i.label);if(/ internal-link(?: |$)/.test(a+` `)&&_!==``&&n.links!==!1){let e=Fu(v,n),t=Ec(v);_=`<a class="internal-link"${e?` href="${t}"${Lu(n)}`:``} data-href="${t}">${_}</a>`,D.push({id:i.label,href:v,internal:!0})}let y;if(t.rows.length===0)y=`<rect ${g}${Kp(sS+t.style.shape)}/>`+_;else{let e=Math.round(t.rowSize*1.5),n=t.style.stroke?Ec(t.style.stroke):`var(--_b)`,r=``,i=``,a=l+t.headH;for(let n=0;n<t.rows.length;n++){let s=t.rows[n];if(n%2==0){let e=`x="${X(c)}" width="${X(o)}"`;n===t.rows.length-1?r+=`<rect ${e} y="${X(a)}" height="${X(s.h)}"${Up}/><rect ${e} y="${X(a)}" height="${X(s.h/2)}"/>`:r+=`<rect ${e} y="${X(a)}" height="${X(s.h)}"/>`}let l=a+tS/2+e/2+t.rowSize*.35,[f,p,g,_]=s.cells;i+=lS(f,c+t.cols[0],l,` class="pele-er-type"${h}${d}`,u,t.mono)+lS(p,c+t.cols[1],l,` class="pele-er-name"${m}${d}`,u,t.mono)+lS(g,c+t.cols[2],l,` class="pele-er-keys" font-size="${t.keySize}"${h}${d}`,u,t.mono)+lS(_,c+t.cols[3],l,` class="pele-er-comment"${h}${d}`,u),a+=s.h}let s=X(l+t.headH),f=ul(t.style.shape),p=f===Kc?qc:f===qc?Kc:`var(--_bg)`;y=`<rect ${g}${Kp(sS+t.style.shape)}/><g class="pele-er-stripes" fill="${p}"${t.style.shape.includes(`fill:`)?` opacity="0.6"`:``}>${r}</g><path class="pele-er-divider" d="M${X(c)},${s}H${X(c+o)}" stroke="${n}"/><rect ${g} fill="none" stroke="var(--_b)"${Kp(t.style.line)}/>`+_+`<g class="pele-er-attributes" font-size="${t.rowSize}">${i}</g>`}M+=`<g class="pele-node pele-entity${a}" data-id="${Y(i.label)}" transform="translate(${X(r.x)},${X(r.y)})">${y}</g>`}for(let[e,t]of _){let n=f[e],r=0;for(let e of t)r+=e.band;let i=Math.min(1,Math.max((n.below?n.w:n.h)-8,0)/r),a=-r*i/2;for(let e of t)e.band*=i,e.at=a+e.band/2,a+=e.band}let N=``,P=``,F=``;for(let e=0;e<m.length;e++){let t=m[e],n=g[e],r=h[e],i,a,o,s=v[e];if(s){let e=p[t.src],c=f[t.src],l=Math.max(Math.min(s.band/2-6,13),1),u=Lx+qx*.75+6;if(c.below){let d=e.x+s.at,f=e.y+c.h/2,p=X(f+Lx),m=X(f+Lx+qx);i=`M${X(d-l)},${X(f)}V${p}C${X(d-l)},${m} ${X(d+l)},${m} ${X(d+l)},${p}V${X(f)}`,a=Hx(n.arrowTypeStart,d-l,f,0,-1),o=Hx(n.arrowTypeEnd,d+l,f,0,-1),t.labelX=d,t.labelY=f+u+r.height/2}else{let d=e.x+c.w/2,f=e.y+s.at,p=X(d+Lx),m=X(d+Lx+qx);i=`M${X(d)},${X(f-l)}H${p}C${m},${X(f-l)} ${m},${X(f+l)} ${p},${X(f+l)}H${X(d)}`,a=Hx(n.arrowTypeStart,d,f-l,-1,0),o=Hx(n.arrowTypeEnd,d,f+l,-1,0),t.labelX=d+u+r.width/2,t.labelY=f}}else{let e=pS(t.route);if(e.length<6)continue;hS(e,0,f[t.src],p[t.src]),hS(e,e.length-3,f[t.dst],p[t.dst]);let r=Math.abs(e[e.length-3]-e[0]),s=Math.abs(e[e.length-2]-e[1]),c=e.length===6&&(r<.01||s<.01||Math.hypot(r,s)<=3*Lx)?0:Lx,l=yp(e,void 0,c,c);i=c>0?`M${X(l.sx)},${X(l.sy)}L${l.d.slice(1)}L${X(l.ex)},${X(l.ey)}`:l.d,a=Hx(n.arrowTypeStart,l.sx,l.sy,l.sdx,l.sdy),o=Hx(n.arrowTypeEnd,l.ex,l.ey,l.edx,l.edy)}let c=Ap(i,[],j),l=c&&jp(c);l===``&&(P+=Fp(i,a+o)),c&&l&&(a=Mp(a,c),o=Mp(o,c));let d=n.pattern===`dashed`;if(N+=`<g class="pele-edge pele-er-${d?`non-identifying`:`identifying`}" data-id="${Y(n.id)}"${l?` stroke="${l}"`:``}><path d="${i}"${d?` stroke-dasharray="4 3"`:``}/>`+a+o+`</g>`,r.width>0){let e=t.labelX,i=t.labelY;F+=Rp(n.id,r,e,i,``,u)}}return{svg:lm(`er`,T,E,o,n,e,Z(S,T/2,l+S.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(A?`<g class="pele-clusters">${A}</g>`:``)+Lp(P)+(N?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${N}</g>`:``)+(F?`<g class="pele-edge-labels" font-size="${s}">${F}</g>`:``)+`<g class="pele-nodes">${M}</g>`),width:T,height:E,links:D}}function pS(e){let t=e.slice(0,3);for(let n=3;n<e.length;n+=3){let r=t.length-3,i=i=>Math.abs(t[r+i]-e[n+i])<.01&&Math.abs(e[n+i]-e[n+3+i])<.01;n+3<e.length&&(i(0)||i(1))||t.push(e[n],e[n+1],e[n+2])}return t}function mS(e,t,n){let r=new Map,i=(e,n,i,a)=>{let o=t[e],s=n[i]-o.x,c=n[i+1]-o.y,l;if(Math.abs(Math.abs(c)-o.h/2)<.5)l=c<0?0:2;else if(Math.abs(Math.abs(s)-o.w/2)<.5)l=s<0?3:1;else return;let u=e*4+l,d={route:n,at:i,toward:n[a+(l&1?1:0)]},f=r.get(u);f?f.push(d):r.set(u,[d])};for(let t of e){let e=t.route.length-3;t.src===t.dst||e<3||(i(t.src,t.route,0,3),i(t.dst,t.route,e,e-3))}for(let[e,i]of r){if(i.length<2)continue;let r=e>>2,a=(e&1)==1,o=t[r].isGroup?t[r]:n[r],s=a?o.h:o.w,c=Math.max(Math.min(aS,(s-2*oS)/(i.length-1)),0),l=a?t[r].y:t[r].x;i.sort((e,t)=>e.toward-t.toward);for(let e=0;e<i.length;e++)i[e].route[i[e].at+ +!!a]=l+(e-(i.length-1)/2)*c}}function hS(e,t,n,r){if(r.isGroup)return;let i=e[t]-r.x,a=e[t+1]-r.y;r.w!==n.w&&Math.abs(Math.abs(i)-r.w/2)<.5&&(e[t]-=Math.sign(i)*(r.w-n.w)/2),r.h!==n.h&&Math.abs(Math.abs(a)-r.h/2)<.5&&(e[t+1]-=Math.sign(a)*(r.h-n.h)/2)}var gS={type:`er`,math:!0,parse(e,t,n){let r=new mx;return n&&(r.title=n),Px(e,r),r},render:dS},_S=new Map([[`ui`,`ui`],[`pcr`,`processor`],[`processor`,`processor`],[`rmo`,`readmodel`],[`readmodel`,`readmodel`],[`cmd`,`command`],[`command`,`command`],[`evt`,`event`],[`event`,`event`]]),vS=new Map([[`trigger`,[0,`UI/Automation`,`UI/A: `]],[`state`,[100,`Command/Read Model`,`C/RM: `]],[`stream`,[200,`Events`,`Stream: `]]]);function yS(e){return e===`ui`||e===`processor`?`trigger`:e===`event`?`stream`:`state`}function bS(e){let t=e.indexOf(`{`),n=e.lastIndexOf(`}`),r=(t!==-1&&n>t?e.slice(t+1,n):t===-1&&e.length>=2?e.slice(1,-1):``).replace(/\r/g,``).split(`
|
|
93
|
+
`);for(;r.length>0&&r[0].trim()===``;)r.shift();for(;r.length>0&&r[r.length-1].trim()===``;)r.pop();let i=1/0;for(let e of r)e.trim()!==``&&(i=Math.min(i,e.length-e.trimStart().length));return r.map(e=>e.slice(Math.min(i,e.length)).trimEnd()).join(`
|
|
94
|
+
`)}function xS(e,t){let n=new Set;for(let t of e.frames){if(n.has(t.name)){let n=Ro(e.$source,t.$offset).line;throw new jo(`Duplicate event modeling frame ID "${t.name}" on line ${n}`,`semantic`,{type:`eventmodeling`,line:n})}n.add(t.name)}let r=new Map;for(let t of e.dataEntities)r.has(t.name)||r.set(t.name,t.dataBlockValue);let i=new Map,a=new Map,o=(e,t)=>{let n=yS(e),r=t===void 0?n:`${n} ${t}`,o=i.get(r);if(!o){let[e,s,c]=vS.get(n),l=e;t!==void 0&&(l=a.get(n)??e+1,a.set(n,l+1)),o={index:l,label:t===void 0?s:c+t,group:n,namespace:t},i.set(r,o)}return o},s=[],c=new Map,l=[];e.frames.forEach((e,t)=>{let n=e.entityIdentifier.split(`.`),i=n.length===2?n[0]:void 0,a=_S.get(e.modelEntityType)??`event`,u=e.dataInlineValue===void 0?void 0:bS(e.dataInlineValue);if(e.dataReference){let t=r.get(e.dataReference.$refText);t!==void 0&&(u=bS(t))}let d={id:e.name,kind:a,entity:e.entityIdentifier,name:n.length===2?n[1]:e.entityIdentifier,namespace:i,reset:e.$type===`EmResetFrame`,lane:o(a,i),data:u,dataType:e.dataType};if(s.push(d),c.set(d.id,d),e.sourceFrames.length>0){let t=new Set(e.sourceFrames.map(e=>e.$refText));for(let e of s)t.has(e.id)&&l.push({source:e,target:d})}else if(t>0&&!d.reset){for(let e=t-1;e>=0;e--)if(s[e].lane!==d.lane){l.push({source:s[e],target:d});break}}});let u=e=>e.map(e=>e.entityIdentifier.$refText);return{type:`eventmodeling`,title:e.title&&yg(e.title)||t,accTitle:e.accTitle?bg(e.accTitle).replace(/^\s+/g,``):void 0,accDescr:e.accDescr?xg(e.accDescr).replace(/\n\s+/g,`
|
|
95
|
+
`):void 0,boxes:s,lanes:[...i.values()].sort((e,t)=>e.index-t.index),relations:l,notes:e.noteEntities.map(e=>({frame:e.sourceFrame.$refText,text:bS(e.dataBlockValue),dataType:e.dataType})),specifications:e.gwtEntities.map(e=>({frame:e.sourceFrame.$refText,given:u(e.givenStatements),when:u(e.whenStatements),then:u(e.thenStatements)})),entities:e.modelEntities.map(e=>e.name)}}var SS=/[\t ]*accDescr(?:[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)|\s*({))/y;function CS(){let e=!1;return(t,n)=>{SS.lastIndex=n;let r=SS.exec(t);if(r===null)return-1;let i=SS.lastIndex;if(r[1]===void 0)return i;if(e)return-1;let a=t.indexOf(`}`,i);return e=a===-1,a+1||-1}}function wS(e=`ACC_DESCR`){return{...ig,name:e,scanner:CS}}var TS={name:`EM_ID`,pattern:/[_a-zA-Z][\w_]*/y},ES=e=>({name:e,pattern:e,longer:[TS]}),DS=e=>({name:e,pattern:e}),OS=[`resetframe`,`readmodel`,`processor`,`timeframe`,`command`,`entity`,`event`,`jsobj`,`figma`,`given`,`json`,`salt`,`html`,`text`,`data`,`note`,`when`,`then`,`rmo`,`cmd`,`evt`,`pcr`,`uri`],kS=[{...mg(`eventmodeling`),longer:[TS]},...OS.map(ES),DS(`->>`),ES(`gwt`),ES(`ui`),ES(`md`),ES(`tf`),DS(`[[`),DS(`]]`),ES(`rf`),DS("`"),DS(`.`),TS,{name:`EM_FID`,pattern:/\d{1,3}/y},{name:`EM_DATA_INLINE`,pattern:/\{(.*)\}|"(.*)"|'(.*)'/y},{name:`EM_DATA_BLOCK`,pattern:/\{[\t ]*\r?\n(?:[\S\s]*?\r?\n)?\}(?:\r?\n|(?!\S))/y},wS(`EM_ACC_DESCR`),{...ag,name:`EM_ACC_TITLE`},{...sg(String.raw`\w`),name:`EM_TITLE`},{name:`EM_WS`,pattern:/\s+/y,hidden:!0},{...dg,name:`EM_YAML`},{...fg,name:`EM_DIRECTIVE`},{...pg,name:`EM_SINGLE_LINE_COMMENT`},{name:`EM_ML_COMMENT`,pattern:/\/\*[\s\S]*?\*\//y,hidden:!0},{name:`EM_SL_COMMENT`,pattern:/\/\/[^\n\r]*/y,hidden:!0}],AS=e=>kS.findIndex(t=>t.name===e),jS=e=>new Set(e.map(AS)),MS={keyword:0,arrow:AS(`->>`),open:AS(`[[`),close:AS(`]]`),tick:AS("`"),dot:AS(`.`),id:AS(`EM_ID`),frameId:AS(`EM_FID`),inline:AS(`EM_DATA_INLINE`),block:AS(`EM_DATA_BLOCK`),accDescr:AS(`EM_ACC_DESCR`),accTitle:AS(`EM_ACC_TITLE`),title:AS(`EM_TITLE`),entity:AS(`entity`),data:AS(`data`),note:AS(`note`),gwt:AS(`gwt`),given:AS(`given`),when:AS(`when`),then:AS(`then`)},NS=jS([`tf`,`timeframe`]),PS=jS([`rf`,`resetframe`]),FS=jS([`rmo`,`readmodel`,`ui`,`cmd`,`command`,`evt`,`event`,`pcr`,`processor`]),IS=jS([`json`,`jsobj`,`figma`,`salt`,`uri`,`md`,`html`,`text`]);function LS(e){let t=new wg(rg(e,kS,`eventmodeling`),kS,`eventmodeling`),n={$type:`EventModel`,modelEntities:[],frames:[],dataEntities:[],noteEntities:[],gwtEntities:[],$source:e},r=e=>t.kinds[t.i]===e,i=(e,n)=>e.has(t.kinds[t.i])?t.take():t.fail(n),a=()=>{let e=t.expect(MS.id);for(;t.accept(MS.dot);)e+=`.`+t.expect(MS.id);return e},o=()=>{if(!t.accept(MS.tick))return;let e=i(IS,`a data type`);return t.expect(MS.tick),e},s=()=>{let e=[];do i(FS,`an entity type`),e.push({$type:`EmGwtStatement`,entityIdentifier:{$refText:t.expect(MS.id)}});while(FS.has(t.kinds[t.i]));return e};for(t.expect(MS.keyword);!r(-1);){let e=t.kinds[t.i];if(e===MS.accDescr)n.accDescr=t.take();else if(e===MS.accTitle)n.accTitle=t.take();else if(e===MS.title)n.title=t.take();else if(e===MS.entity)t.i++,n.modelEntities.push({$type:`EmModelEntity`,name:a()});else if(NS.has(e)||PS.has(e)){let s={$type:NS.has(e)?`EmTimeFrame`:`EmResetFrame`,name:``,modelEntityType:``,entityIdentifier:``,sourceFrames:[],$offset:t.tokens.starts[t.i]};for(t.i++,s.name=t.expect(MS.frameId),s.modelEntityType=i(FS,`an entity type`),s.entityIdentifier=a();t.accept(MS.arrow);)s.sourceFrames.push({$refText:t.expect(MS.frameId)});if(t.accept(MS.open)&&(s.dataReference={$refText:t.expect(MS.id)},t.expect(MS.close)),r(MS.tick)||r(MS.inline)){let e=o();e!==void 0&&(s.dataType=e),s.dataInlineValue=t.expect(MS.inline)}n.frames.push(s)}else if(e===MS.data){t.i++;let e={$type:`EmDataEntity`,name:t.expect(MS.id),dataBlockValue:``},r=o();r!==void 0&&(e.dataType=r),e.dataBlockValue=t.expect(MS.block),n.dataEntities.push(e)}else if(e===MS.note){t.i++;let e={$type:`EmNoteEntity`,sourceFrame:{$refText:t.expect(MS.frameId)},dataBlockValue:``},r=o();r!==void 0&&(e.dataType=r),e.dataBlockValue=t.expect(MS.block),n.noteEntities.push(e)}else if(e===MS.gwt){t.i++;let e={$type:`EmGwt`,sourceFrame:{$refText:t.expect(MS.frameId)},givenStatements:[],whenStatements:[],thenStatements:[]};t.expect(MS.given),e.givenStatements=s(),t.accept(MS.when)&&(e.whenStatements=s()),t.expect(MS.then),e.thenStatements=s(),n.gwtEntities.push(e)}else t.fail(`a frame, an entity, a data block, a note, or a specification`)}return n}var RS=new Map([[`command`,0],[`event`,1],[`readmodel`,2],[`processor`,6]]),zS=12,BS=10,VS=96,HS=16,US=80,WS=12,GS=8,KS=48,qS=80,JS=8;function YS(e,t){let n=[];for(let r of Xo(e).split(`
|
|
96
|
+
`)){let e=r.length<=t?void 0:Array.from(r);if(e===void 0||e.length<=t)n.push(r);else for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t).join(``))}return n}function XS(e,t,n,r,i){let a=``;for(let i=0;i<e.length;i++)e[i]!==``&&(a+=`<tspan x="${X(t)}" y="${X(n+i*r)}">${Ec(e[i])}</tspan>`);return a===``?``:`<text${i} xml:space="preserve">${a}</text>`}function ZS(e,t,n){return Eh(n,r=>QS(e,t,n,r))}function QS(e,t,n,r){if(r)return nC(e,n);let i=n.fontSize??16,a=Math.round(i*.875),o=Math.round(i*.8125),s=Math.round(i*.75),c=Math.round(s*1.4),l=Math.round(o*1.5),u=n.measurer??bc(n.fontFamily,n.fontFamilyMono),d=n.padding??8,f=(e,t,n)=>{let r=0;for(let i of e)r=Math.max(r,u.width(i,t,n));return r},p=new Map,m=0;for(let t of e.lanes){let e=Q(t.label,!1,u,o,4e3,1);m=Math.max(m,e.width),p.set(t,{lane:t,label:e,right:-1/0,y:0,h:0})}m+=2*WS;let h=[],g=new Map,_;for(let t of e.boxes){let e=p.get(t.lane),n=Q(t.name,!1,u,a,4e3,1),r=t.data?YS(t.data,KS):[],i=Math.max(VS,Math.max(n.width,f(r,s,4))+2*zS),o=2*BS+n.height+(r.length>0?6+r.length*c:0),l=0;if(_){let n=_.x+Math.max(_.w/2,_.w-US);l=_.box.lane===t.lane?e.right+HS:Math.max(n,e.right+HS)}let d={box:t,name:n,data:r,x:l,y:0,w:i,h:o};e.right=l+i,e.h=Math.max(e.h,o),h.push(d),g.set(t,d),_=d}let v=0;for(let e of h)v=Math.max(v,e.x+e.w);let y=m+v+WS,b=Q(e.title,!1,u,i,4e3,1),x=b.height>0?b.height+12:0,S=d,C=d+x,w=C,T=``;for(let e of p.values())e.y=w,e.h+=2*WS,T+=`<g class="pele-cluster pele-em-lane" data-id="${Y(e.lane.label)}"><rect x="${X(S)}" y="${X(w)}" width="${X(y)}" height="${X(e.h)}" fill="var(--_s)"${Up}/>`+Z(e.label,S+WS+e.label.width/2,w+e.h/2,` class="pele-cluster-label" font-size="${o}" font-weight="var(--_hw)" fill="var(--_m)"`)+`</g>`,w+=e.h+GS;let E=p.size>0?w-GS:C,D=``;for(let e of h){let t=p.get(e.box.lane);e.x+=S+m,e.y=t.y+(t.h-e.h)/2;let n=RS.get(e.box.kind),r=`x="${X(e.x)}" y="${X(e.y)}" width="${X(e.w)}" height="${X(e.h)}"`,i=n===void 0?`<rect ${r} fill="var(--_bg)" stroke="var(--_b)"${Up}/>`:`<rect ${r} fill="var(--_bg)"${Up}/><rect ${r} fill="${om(n)}" fill-opacity="0.22" stroke="${om(n)}"${Up}/>`,o=e.y+BS+e.name.height/2,l=Z(e.name,e.x+e.w/2,o,` class="pele-label" font-size="${a}" font-weight="var(--_hw)"`)+XS(e.data,e.x+zS,e.y+BS+e.name.height+6+c/2+s*.35,c,` class="pele-em-data" font-family="${Vp}" font-size="${s}"`);D+=`<g class="pele-node pele-em-${e.box.kind}${e.box.reset?` pele-em-reset`:``}" data-id="${Y(e.box.id)}">${i}${l}</g>`}let O=``,k=bp(`arrow_point`);for(let t of e.relations){let e=g.get(t.source),n=g.get(t.target);if(!e||!n||e===n)continue;let r,i;if(e.box.lane===n.box.lane){let t=n.x>=e.x,a=t?e.x+e.w:e.x,o=t?n.x:n.x+n.w,s=e.y+e.h/2,c=n.y+n.h/2,l=o>=a?1:-1;r=`M${X(a)},${X(s)}L${X(o-l*k)},${X(c)}`,i=xp(`arrow_point`,o,c,l,0,`var(--_l)`)}else{let t=n.y>e.y,a=Math.max(e.x,n.x),o=Math.min(e.x+e.w,n.x+n.w),s=e=>Math.min(24,e/4),c=o-a>=16?(a+o)/2:n.x>e.x?e.x+e.w-s(e.w):e.x+s(e.w),l=o-a>=16?c:n.x>e.x?n.x+s(n.w):n.x+n.w-s(n.w),u=t?e.y+e.h:e.y,d=t?n.y:n.y+n.h,f=t?1:-1,p=d-f*k,m=(u+p)/2;r=c===l?`M${X(c)},${X(u)}V${X(p)}`:`M${X(c)},${X(u)}C${X(c)},${X(m)} ${X(l)},${X(m)} ${X(l)},${X(p)}`,i=xp(`arrow_point`,l,d,0,f,`var(--_l)`)}O+=`<g class="pele-edge" data-id="${Y(t.source.id)}-${Y(t.target.id)}"><path d="${r}" fill="none" stroke="var(--_l)"/>${i}</g>`}let A=new Map;for(let t of e.boxes)A.set(t.id,t.name);let j=``,M=0,N=(e,t,n,r)=>{let i=Q(`${t} · ${n}${A.has(n)?` `+A.get(n):``}`,!1,u,o,4e3,1),a=Math.max(i.width,f(r,o,0))+2*zS,s=2*BS+i.height+r.length*l,c=E+(j===``&&p.size===0?0:JS);j+=`<g class="pele-em-${e}" data-id="${Y(n)}"><rect x="${X(S)}" y="${X(c)}" width="${X(a)}" height="${X(s)}" fill="var(--_bg)" stroke="var(--_b)"${Up}/>`+Z(i,S+zS+i.width/2,c+BS+i.height/2,` font-size="${o}" font-weight="var(--_hw)"`)+XS(r,S+zS,c+BS+i.height+l/2+o*.35,l,` font-size="${o}"`)+`</g>`,E=c+s,M=Math.max(M,a)};for(let t of e.notes)N(`note`,`Note`,t.frame,YS(t.text,qS));for(let t of e.specifications){let e=[`Given ${t.given.join(`, `)}`];t.when.length>0&&e.push(`When ${t.when.join(`, `)}`),e.push(`Then ${t.then.join(`, `)}`),N(`specification`,`Given / When / Then`,t.frame,e.flatMap(e=>YS(e,qS)))}let P=Math.max(p.size>0?y:0,M,b.width),F=Math.ceil(P+2*d),I=Math.ceil(E+d);return{svg:lm(`eventmodeling`,F,I,i,n,e,Z(b,F/2,d+b.height/2,` class="pele-title" font-weight="var(--_tw)"`)+T+O+D+j),width:F,height:I,links:[]}}var $S=8,eC=120,tC=20;function nC(e,t){let n=t.fontSize??16,r=Math.round(n*.875),i=Math.round(n*.75),a=t.padding??8,o=t.measurer??bc(t.fontFamily,t.fontFamilyMono),s=Math.max(160,(t.maxWidth??320)-2*a),c=new Map(e.boxes.map((e,t)=>[e,t])),l=new Map,u=new Set;for(let t of e.relations){let n=c.get(t.source),r=c.get(t.target);if(n===void 0||r===void 0||n===r)continue;if(Math.abs(n-r)<2){u.add(e.boxes[Math.max(n,r)]);continue}let i=l.get(t.target);i?(i[0]=Math.min(i[0],n),i[1]=Math.max(i[1],n)):l.set(t.target,[Math.min(n,r),Math.max(n,r)])}let d=new Map,f=[];for(let[e,[t,n]]of[...l].sort((e,t)=>e[1][0]-t[1][0])){let r=f.findIndex(e=>e<t);r<0&&(r=f.length),f[r]=n,d.set(e,r)}let p=24+$S*Math.max(0,f.length-1),m=Math.max(eC,s-p),h=m-2*zS,g=Q(e.title,!1,o,n,s,1),_=a+(g.height?g.height+12:0),v=a+g.height,y=Math.max(g.width,m+p),b=``,x=``,S=``,C=new Map,w=(e,t,n=0)=>Lv(Xo(e),o,t,h,n);e.boxes.forEach((e,t)=>{let n=u.has(e)?h-tC:h,s=Rv(Q(e.lane.label,!1,o,r,n,1),o,n),c=Q(e.name,!1,o,r,h-36,1),l=e.data?w(e.data,i,4):void 0,d=Math.max(m,s.width+2*zS,c.width+2*zS+36,(l?.width??0)+2*zS),f=s.height+12,g=2*BS+c.height+(l?l.height+6:0),x=RS.get(e.kind),S=_+f,T=`x="${X(a)}" y="${X(S)}" width="${X(d)}" height="${X(g)}"`;b+=`<g class="pele-cluster pele-em-lane" data-id="${Y(e.lane.label)}">`+zv(s,a+zS,_,` class="pele-cluster-label" font-size="${r}" font-weight="var(--_hw)" fill="var(--_m)"`)+`<g class="pele-node pele-em-${e.kind}${e.reset?` pele-em-reset`:``}" data-id="${Y(e.id)}"><rect ${T} fill="var(--_bg)" stroke="var(--_b)"${Up}/>`+(x===void 0?``:`<rect ${T} fill="${om(x)}" fill-opacity="0.22" stroke="${om(x)}"${Up}/>`)+Z(c,a+zS+c.width/2,S+BS+c.height/2,` class="pele-label" font-size="${r}" font-weight="var(--_hw)"`)+`<text class="pele-em-frame" x="${X(a+d-zS)}" y="${X(S+BS+r)}" text-anchor="end" font-size="${i}" fill="var(--_m)">${Ec(e.id)}</text>`+(l?XS(l.lines.map(e=>e.map(e=>e.text).join(``)),a+zS,S+BS+c.height+6+l.lineHeight/2+i*.35,l.lineHeight,` class="pele-em-data" font-family="${Vp}" font-size="${i}"`):``)+`</g></g>`,C.set(e,{y:S,h:g,w:d,index:t,lane:s.width}),y=Math.max(y,d+p),v=S+g,_=v+28});for(let t of e.relations){let e=C.get(t.source),n=C.get(t.target);if(!e||!n||e===n)continue;let r=n.y>e.y,i=r?1:-1,o=r?e.y+e.h:e.y,s=r?n.y:n.y+n.h,c,l;if(Math.abs(e.index-n.index)===1){let t=a+Math.max(Math.min(e.w,n.w)/2,zS+(r?n:e).lane+16);c=`M${X(t)},${X(o)}V${X(s-i*bp(`arrow_point`))}`,l=xp(`arrow_point`,t,s,0,i,`var(--_l)`)}else{let r=a+y-p+12+$S*(d.get(t.target)??0),i=e.y+e.h/2-5,o=n.y+n.h/2+5;c=`M${X(a+e.w)},${X(i)}H${X(r)}V${X(o)}H${X(a+n.w+bp(`arrow_point`))}`,l=xp(`arrow_point`,a+n.w,o,-1,0,`var(--_l)`)}x+=`<g class="pele-edge" data-id="${Y(t.source.id)}-${Y(t.target.id)}"><path d="${c}" fill="none" stroke="var(--_l)"/>${l}</g>`}let T=new Map(e.boxes.map(e=>[e.id,e.name])),E=(e,t,n,i)=>{let s=Q(`${t} · ${n}${T.has(n)?` `+T.get(n):``}`,!1,o,r,h,1),c=w(i,r),l=Math.max(m,s.width+2*zS,c.width+2*zS),u=2*BS+s.height+c.height;S+=`<g class="pele-em-${e}" data-id="${Y(n)}"><rect x="${X(a)}" y="${X(_)}" width="${X(l)}" height="${X(u)}" fill="var(--_bg)" stroke="var(--_b)"${Up}/>`+Z(s,a+zS+s.width/2,_+BS+s.height/2,` font-size="${r}" font-weight="var(--_hw)"`)+XS(c.lines.map(e=>e.map(e=>e.text).join(``)),a+zS,_+BS+s.height+c.lineHeight/2+r*.35,c.lineHeight,` font-size="${r}"`)+`</g>`,v=_+u,_=v+JS,y=Math.max(y,l)};for(let t of e.notes)E(`note`,`Note`,t.frame,t.text);for(let t of e.specifications){let e=[`Given ${t.given.join(`, `)}`];t.when.length&&e.push(`When ${t.when.join(`, `)}`),e.push(`Then ${t.then.join(`, `)}`),E(`specification`,`Given / When / Then`,t.frame,e.join(`
|
|
97
|
+
`))}let D=Math.ceil(y+2*a),O=Math.ceil(v+a);return{svg:lm(`eventmodeling`,D,O,n,t,e,Z(g,D/2,a+g.height/2,` class="pele-title" font-weight="var(--_tw)"`)+x+b+S),width:D,height:O,links:[]}}var rC={type:`eventmodeling`,keepComments:!0,parse:(e,t,n)=>xS(LS(e),n),render:ZS};function iC(e){return e===`markdown`||e===`string`||e===`text`?e:`markdown`}function aC(e){return e.startsWith(`"`)&&e.endsWith(`"`)?e.substring(1,e.length-1):e}function oC(e,t){let n=0;for(let r=0;r<t.length;r++)t[r]===e&&n++;return n}function sC(e){let t=e.trim(),n=`arrow_open`;switch(t[0]){case`<`:n=`arrow_point`,t=t.slice(1);break;case`x`:n=`arrow_cross`,t=t.slice(1);break;case`o`:n=`arrow_circle`,t=t.slice(1)}let r=`normal`;return t.includes(`=`)&&(r=`thick`),t.includes(`.`)&&(r=`dotted`),{type:n,stroke:r}}function cC(e){let t=e.trim(),n=t.slice(0,-1),r=`arrow_open`;switch(t.slice(-1)){case`x`:r=`arrow_cross`,t.startsWith(`x`)&&(r=`double_`+r,n=n.slice(1));break;case`>`:r=`arrow_point`,t.startsWith(`<`)&&(r=`double_`+r,n=n.slice(1));break;case`o`:r=`arrow_circle`,t.startsWith(`o`)&&(r=`double_`+r,n=n.slice(1))}let i=`normal`,a=n.length-1;n.startsWith(`=`)&&(i=`thick`),n.startsWith(`~`)&&(i=`invisible`);let o=oC(`.`,n);return o&&(i=`dotted`,a=o),{type:r,stroke:i,length:a}}var lC=class{type=`flowchart`;direction;nodes=new Map;edges=[];subgraphs=[];classes=new Map;tooltips=new Map;defaultEdgeStyle;defaultInterpolate;title;accTitle;accDescr;subgraphLookup=new Map;members=new Set;edgeById=new Map;pairCount=new Map;subCount=0;options;constructor(e={}){this.options=e}addVertex(e,t,n,r,i,a,o,s){if(!e||e.trim().length===0)return;let c;if(s!==void 0){let t=s.includes(`
|
|
98
|
+
`)?s+`
|
|
99
|
+
`:`{
|
|
100
|
+
`+s+`
|
|
101
|
+
}`,n;try{n=js(t)}catch(t){throw new jo(`Metadata of "${e}" is not valid YAML. ${t.message}`,`syntax`,{type:`flowchart`})}c=typeof n==`object`&&n&&!Array.isArray(n)?n:void 0}let l=this.subgraphLookup.get(e);if(l&&c){l.metadata={...l.metadata,...c};return}let u=this.edgeById.get(e);if(u){c?.animate!==void 0&&(u.animate=c.animate),c?.animation!==void 0&&(u.animation=c.animation),c?.curve!==void 0&&(u.interpolate=c.curve);return}let d=this.nodes.get(e);if(d===void 0&&(t===void 0&&n===void 0&&r!=null&&this.options.warn?.(`Style applied to unknown node "${e}". This may indicate a typo. The node will be created automatically.`),d={id:e,labelType:`text`,styles:[],classes:[]},this.nodes.set(e,d)),t===void 0?d.text===void 0&&(d.text=e):(d.labelType=t.type,d.text=aC(t.text.trim())),n!==void 0&&(d.type=n),r!=null)for(let e of r)d.styles.push(e);if(i!=null)for(let e of i)d.classes.push(e);if(a!==void 0&&(d.dir=a),d.props===void 0?d.props=o??{}:o!==void 0&&Object.assign(d.props,o),c===void 0)return;if(c.shape){let e=String(c.shape);if(e!==e.toLowerCase()||e.includes(`_`))throw new jo(`No such shape: ${e}. Shape names should be lowercase.`,`semantic`,{type:`flowchart`});if(!Hu(e))throw new jo(`No such shape: ${e}.`,`semantic`,{type:`flowchart`});d.type=e}let f=typeof c.label==`string`?c.label:void 0;c.label&&(d.text=String(c.label),d.labelType=iC(c.labelType)),c.icon&&(d.icon=String(c.icon),!f?.trim()&&d.text===e&&(d.text=``)),c.form&&(d.form=String(c.form)),c.pos&&(d.pos=String(c.pos)),c.img&&(d.img=String(c.img),!f?.trim()&&d.text===e&&(d.text=``)),c.constraint&&(d.constraint=String(c.constraint)),c.w&&(d.assetWidth=Number(c.w)),c.h&&(d.assetHeight=Number(c.h))}addSingleLink(e,t,n,r){let i={start:e,end:t,type:void 0,text:``,labelType:`text`,classes:[],isUserDefinedId:!1,interpolate:this.defaultInterpolate},a=n?.text;a!==void 0&&(i.text=aC(a.text.trim()),i.labelType=iC(a.type)),n!==void 0&&(i.type=n.type,i.stroke=n.stroke,i.length=n.length>10?10:n.length);let o=e+`\0`+t,s=this.pairCount.get(o)??0;r&&!this.edgeById.has(r)?(i.id=r,i.isUserDefinedId=!0):i.id=`L_${e}_${t}_${s===0?0:s+1}`;let c=this.options.maxEdges;if(c!==void 0&&this.edges.length>=c)throw new jo(`Edge limit exceeded. The limit is ${c}.`,`limit`,{type:`flowchart`});this.edges.push(i),this.pairCount.set(o,s+1),this.edgeById.has(i.id)||this.edgeById.set(i.id,i)}addLink(e,t,n){let r=typeof n?.id==`string`?n.id.replace(`@`,``):void 0,i=e[e.length-1],a=t[0];for(let o of e)for(let e of t)this.addSingleLink(o,e,n,o===i&&e===a?r:void 0)}updateLinkInterpolate(e,t){for(let n of e)n==="default"?this.defaultInterpolate=t:this.edgeAt(n).interpolate=t}updateLink(e,t){for(let n of e){if(n==="default"){this.defaultEdgeStyle=t;continue}let e=this.edgeAt(n);e.style=t,t.length>0&&!t.some(e=>e?.startsWith(`fill`))&&t.push(`fill:none`)}}edgeAt(e){let t=this.edges[Number(e)];if(t===void 0)throw new jo(`The index ${e} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${this.edges.length-1}. (Help: Ensure that the index is within the range of existing edges.)`,`semantic`,{type:`flowchart`});return t}addClass(e,t){let n=t.join().replace(/\\,/g,`§§§`).replace(/,/g,`;`).replace(/§§§/g,`,`).split(`;`);for(let t of e.split(`,`)){let e=this.classes.get(t);e===void 0&&(e={id:t,styles:[],textStyles:[]},this.classes.set(t,e));for(let t of n)t.includes(`color`)&&e.textStyles.push(t.replace(`fill`,`bgFill`)),e.styles.push(t)}}setDirection(e){let t=e.trim();t.includes(`<`)&&(t=`RL`),t.includes(`^`)&&(t=`BT`),t.includes(`>`)&&(t=`LR`),t.includes(`v`)&&(t=`TB`),t===`TD`&&(t=`TB`),this.direction=t}setClass(e,t){for(let n of e.split(`,`))this.nodes.get(n)?.classes.push(t),this.edgeById.get(n)?.classes.push(t),this.subgraphLookup.get(n)?.classes.push(t)}setTooltip(e,t){if(t!==void 0)for(let n of e.split(`,`))this.tooltips.set(n,t)}setLink(e,t,n){let r=t.trim();for(let t of e.split(`,`)){let e=this.nodes.get(t);e!==void 0&&(e.link=r?Tu(r):void 0,e.linkTarget=n)}this.setClass(e,`clickable`)}setClickEvent(e,t,n){this.setClass(e,`clickable`)}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
102
|
+
`)}addSubGraph(e,t,n){let r=e?.text.trim(),i=n?.text??``;e!==void 0&&e===n&&/\s/.test(i)&&(r=void 0);let a=new Set,o=[],s;for(let e of t)if(typeof e==`string`)e.trim()!==``&&!a.has(e)&&(a.add(e),o.push(e));else if(Array.isArray(e))for(let t of e)t.trim()!==``&&!a.has(t)&&(a.add(t),o.push(t));else s=e.value;s??=this.options.inheritDir?this.direction??this.options.direction:void 0,r??=`subGraph`+this.subCount,i||=``,this.subCount++;let c={id:r,nodes:o,title:i.trim(),classes:[],dir:s,labelType:iC(n?.type)},l=this.members;c.nodes=o.filter(e=>!l.has(e)&&e!==r);for(let e of c.nodes)l.add(e);let u=this.subgraphLookup.get(r);if(u)for(let e of c.nodes)u.nodes.push(e);else this.subgraphs.push(c);return this.subgraphLookup.set(r,u??c),r}exists(e,t){for(let n of e)if(n.nodes.includes(t))return!0;return!1}makeUniq(e,t){let n=new Set;for(let e of t)for(let t of e.nodes)n.add(t);return{nodes:e.nodes.filter(e=>!n.has(e))}}destructLink(e,t){let n=cC(e);if(!t)return n;let r=sC(t);if(r.stroke!==n.stroke)return{type:`INVALID`,stroke:`INVALID`};if(r.type===`arrow_open`)r.type=n.type;else{if(r.type!==n.type)return{type:`INVALID`,stroke:`INVALID`};r.type=`double_`+r.type}return r.type===`double_arrow`&&(r.type=`double_arrow_point`),r.length=n.length,r}subgraph(e){return this.subgraphLookup.get(e)}},uC=`$end.INVALID.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.SHAPE_DATA.CALLBACKNAME.CALLBACKARGS.MD_STR.STR.STYLE.DEFAULT.LINKSTYLE.INTERPOLATE.CLASSDEF.CLASS.HREF.CLICK.GRAPH.subgraph.end.LINK_TARGET.NODIR.DIR.direction_tb.direction_bt.direction_rl.direction_lr.direction_td.LINK_ID.NUM.BRKT.STYLE_SEPARATOR.COLON.AMP.SEMI.COMMA.MULT.LINK.START_LINK.EDGE_TEXT.-).TEXT.(-.STADIUMEND.STADIUMSTART.SUBROUTINEEND.SUBROUTINESTART.VERTEX_WITH_PROPS_START.TAGEND.CYLINDEREND.CYLINDERSTART.DOUBLECIRCLEEND.DOUBLECIRCLESTART.TRAPEND.INVTRAPEND.TRAPSTART.INVTRAPSTART.TAGSTART.UP.SEP.DOWN.NODE_STRING.MINUS.UNICODE_TEXT.PIPE.PE.PS.SQE.SQS.DIAMOND_STOP.DIAMOND_START.NEWLINE.SPACE.EOF`.split(`.`),dC=new Uint8Array(128);for(let e of`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!"#$%&'*+.\`?\\_/`)dC[e.charCodeAt(0)]=1;var fC=/accTitle\s*:\s*/y,pC=/accDescr\s*:\s*/y,mC=/accDescr\s*\{\s*/y,hC=/call\s+/y,gC=/click\s+/y,_C=/(?:\r?\n)*\s*\n/y,vC=/\s*(?:LR|RL|TB|BT|TD|BR)\b/y,yC=/\s*[<>^]/y,bC=/\s*v\b/y,xC=[/.*direction\s+TB[^\n]*/y,/.*direction\s+BT[^\n]*/y,/.*direction\s+RL[^\n]*/y,/.*direction\s+LR[^\n]*/y,/.*direction\s+TD[^\n]*/y],SC=/[\n\r\u2028\u2029]/g,CC=/\s*[xo<]?--+[-xo>]\s*/y,wC=/\s*[xo<]?--\s*/y,TC=/\s*[xo<]?==+[=xo>]\s*/y,EC=/\s*[xo<]?==\s*/y,DC=/\s*[xo<]?-?\.+-[xo>]?\s*/y,OC=/\s*[xo<]?-\.\s*/y,kC=/\s*~~~+\s*/y,AC=/(?:\r?\n)+/y,jC=/[^\S\n\r]+/y,MC=/\(\s*\)/y,NC=/\n\s*/g;function PC(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c=!0,l=e.indexOf(`direction`),u=e.indexOf(`@`),d=-1,f=0,p=0,m=-1,h=-1,g=-1,_=(t,a,o)=>{n.push(t),r.push(e.slice(a,o)),i.push(a),s=o},v=e=>{a.push(o),o=e},y=()=>{a.length>0&&(o=a.pop())},b=(t,n)=>(t.lastIndex=n,t.test(e)?t.lastIndex:-1),x=t=>e.startsWith(t,s)&&!Ls(e.charCodeAt(s+t.length)),S=n=>{let r=n;if(n>=h&&n<=g)r=g;else if(J(e.charCodeAt(n))){for(;r<t&&J(e.charCodeAt(r));)r++;h=n,g=r}let i=e.charCodeAt(r);return i===120||i===111||i===60?e.charCodeAt(r+1):i},C=n=>{let r=n;if(n>=h&&n<=g)r=g;else if(J(e.charCodeAt(n))){for(;r<t&&J(e.charCodeAt(r));)r++;h=n,g=r}return e.charCodeAt(r)===126},w=()=>{e.charCodeAt(s+1)===96?(v(2),s+=2):(v(1),s++)},T=()=>{if(!C(s))return!1;let e=b(kC,s);return e<0?!1:(_(40,s,e),!0)},E=t=>{let n=e.charCodeAt(s+1);return t===40?(n===45?(v(8),_(45,s,s+2)):n===91?(v(7),_(47,s,s+2)):n===40&&e.charCodeAt(s+2)===40?(v(7),_(55,s,s+3)):(v(7),_(69,s,s+1)),!0):t===91?(n===91?(v(7),_(49,s,s+2)):n===40?(v(7),_(53,s,s+2)):n===47?(v(9),_(58,s,s+2)):n===92?(v(9),_(59,s,s+2)):(v(7),_(71,s,s+1)),!0):t===124?(v(7),_(67,s,s+1),!0):t===123&&(v(7),_(73,s,s+1),!0)},D=e=>{c&&(c=!1,v(6)),_(20,s,s+e)},O=()=>{let n=s;for(;n<t;){let r=e.charCodeAt(n);if(r<128&&dC[r]===1)n++;else if(r===45&&n+1<t){let t=e.charCodeAt(n+1);if(t===62||t===45||t===46)break;n++}else break}return n!==s&&(_(64,s,n),!0)},k=e=>{let t=S(s),n;if(t===45){if((n=b(CC,s))>=0)return _(40,s,n),!0;if((n=b(wC,s))>=0)return v(10),_(41,s,n),!0;if((n=b(DC,s))>=0)return _(40,s,n),!0;if((n=b(OC,s))>=0)return v(12),_(41,s,n),!0}else if(t===61){if((n=b(TC,s))>=0)return _(40,s,n),!0;if((n=b(EC,s))>=0)return v(11),_(41,s,n),!0}else if(t===46&&(n=b(DC,s))>=0)return _(40,s,n),!0;return e!==45&&e!==61&&e!==46&&T()},A=a=>{let o;switch(a){case 97:if(e.startsWith(`acc`,s)){if((o=b(fC,s))>=0)return v(3),_(2,s,o),!0;if((o=b(pC,s))>=0)return v(4),_(4,s,o),!0;if((o=b(mC,s))>=0)return v(5),s=o,!0}break;case 64:if(e.charCodeAt(s+1)===123)return v(16),n.push(7),r.push(``),i.push(s),s+=2,!0;break;case 99:if((o=b(hC,s))>=0)return v(14),s=o,!0;if(x(`classDef`))return _(16,s,s+8),!0;if(x(`class`))return _(17,s,s+5),!0;if((o=b(gC,s))>=0)return v(13),s=o,!0;break;case 34:return w(),!0;case 115:if(x(`style`))return _(12,s,s+5),!0;if(x(`swimlane-beta`))return D(13),!0;if(x(`subgraph`))return _(21,s,s+8),!0;break;case 100:if(x(`default`))return _(13,s,s+7),!0;break;case 108:if(x(`linkStyle`))return _(14,s,s+9),!0;break;case 105:if(x(`interpolate`))return _(15,s,s+11),!0;break;case 104:if(e.startsWith(`href`,s)&&J(e.charCodeAt(s+4)))return _(18,s,s+5),!0;break;case 102:if(x(`flowchart-elk`))return D(13),!0;if(x(`flowchart`))return D(9),!0;break;case 103:if(x(`graph`))return D(5),!0;break;case 101:if(x(`end`)){for(o=s+3;o<t&&J(e.charCodeAt(o));)o++;return _(22,s,o),!0}break;case 95:if(x(`_self`))return _(23,s,s+5),!0;if(x(`_blank`))return _(23,s,s+6),!0;if(x(`_parent`))return _(23,s,s+7),!0;if(x(`_top`))return _(23,s,s+4),!0}if(l!==-1&&s>=f&&(l<s&&(l=e.indexOf(`direction`,s)),l!==-1&&(d<s&&(SC.lastIndex=s,d=SC.test(e)?SC.lastIndex-1:t),l<d))){for(let e=0;e<5;e++)if((o=b(xC[e],s))>=0)return _(26+e,s,o),!0;f=d}if(u!==-1&&a!==34&&!J(a)){if(s>=p){u<s&&(u=e.indexOf(`@`,s));let n=s;for(;n<t;){let t=e.charCodeAt(n);if(t===34||J(t))break;n++}if(p=n,m=-1,u!==-1&&u<n)for(let r=Math.min(n,t-1)-1;r>=u;r--){if(e.charCodeAt(r)!==64)continue;let t=e.charCodeAt(r+1);if(t!==123&&t!==34){m=r;break}}}if(m>s)return _(31,s,m+1),!0}if(a>=48&&a<=57){let n=s+1;for(;n<t;){let t=e.charCodeAt(n);if(t<48||t>57)break;n++}return _(32,s,n),!0}switch(a){case 35:return _(33,s,s+1),!0;case 58:return e.charCodeAt(s+1)===58&&e.charCodeAt(s+2)===58?_(34,s,s+3):_(35,s,s+1),!0;case 38:return _(36,s,s+1),!0;case 59:return _(37,s,s+1),!0;case 44:return _(38,s,s+1),!0;case 42:return _(39,s,s+1),!0;case 120:case 111:return k(a)||O();case 60:return k(a)||_(60,s,s+1),!0;case 45:return k(a)||O()||_(65,s,s+1),!0;case 61:return k(a);case 46:return k(a)||O();case 126:return T();case 40:return E(a);case 91:return e.charCodeAt(s+1)===124?(_(50,s,s+2),!0):E(a);case 124:case 123:return E(a);case 62:return v(7),_(51,s,s+1),!0;case 94:return _(61,s,s+1),!0;case 92:return e.charCodeAt(s+1)===124?(_(62,s,s+2),!0):O();case 118:return Ls(e.charCodeAt(s+1))?O():(_(63,s,s+1),!0)}return J(a)?k(a)?!0:(o=b(AC,s))>=0?(_(74,s,o),!0):(o=b(jC,s))>=0&&(_(75,s,o),!0):a<128?O():hd(a)?(_(66,s,s+1),!0):!1},j=(n,r,i,a)=>{if(n===34)return w(),!0;let o=S(s);if(o===i||o===a){let e=b(r,s);if(e>=0)return y(),_(40,s,e),!0}if(n===i&&(i!==45||e.charCodeAt(s+1)===45))return!1;let c=s+1;for(;c<t;){let t=e.charCodeAt(c);if(t===34)break;if(t===i){if(i!==45||e.charCodeAt(c+1)===45)break}else if(t===120||t===111||t===60||t===a||J(t)){let e=S(c);if((e===i||e===a)&&b(r,c)>=0)break}c++}return _(42,s,c),!0};e:for(;;){if(s>=t){let e=-1;switch(o){case 0:e=76;break;case 3:e=3;break;case 4:e=5;break;case 5:e=6;break;case 13:e=19;break;case 14:e=8;break;case 15:e=9}e!==-1&&_(e,t,t);break}let a=e.charCodeAt(s),c=!0;switch(o){case 0:c=A(a);break;case 1:if(a===34)e.charCodeAt(s+1)===96?(v(2),s+=2):(y(),s++);else{let n=e.indexOf(`"`,s);_(11,s,n===-1?t:n)}break;case 2:if(a===96)e.charCodeAt(s+1)===34?(y(),s+=2):c=!1;else if(a===34)w();else{let n=s+1;for(;n<t;){let t=e.charCodeAt(n);if(t===96||t===34)break;n++}_(10,s,n)}break;case 3:case 4:{let n=e.indexOf(`
|
|
103
|
+
`,s);n===-1&&(n=t);let r=o===3?3:5;y(),_(r,s,n);break}case 5:if(a===125)y(),s++;else{let n=e.indexOf(`}`,s);n===-1&&(n=t),_(6,s,n)}break;case 6:{let e;a===34?w():(e=b(_C,s))>=0?(y(),_(24,s,e)):(e=b(vC,s))>=0||(e=b(yC,s))>=0||(e=b(bC,s))>=0?(y(),_(25,s,e)):c=T()||E(a);break}case 7:{let n=e.charCodeAt(s+1);switch(a){case 34:w();break;case 40:case 91:case 123:E(a);break;case 93:y(),n===41?_(46,s,s+2):n===93?_(48,s,s+2):_(70,s,s+1);break;case 41:y(),n===93?_(52,s,s+2):n===41&&e.charCodeAt(s+2)===41?_(54,s,s+3):_(68,s,s+1);break;case 124:y(),_(67,s,s+1);break;case 125:y(),_(72,s,s+1);break;default:{if((a===126||J(a))&&T())break;let n=s+1;for(;n<t;){let t=e.charCodeAt(n);if(t===91||t===93||t===40||t===41||t===123||t===125||t===124||t===34)break;n++}_(44,s,n)}}break}case 8:{let n=e.charCodeAt(s+1);if(a===34)w();else{if((a===126||J(a))&&T())break;if((a===45||a===47||a===41)&&n===41)y(),_(43,s,s+2);else if(a===40||a===91||a===123)E(a);else if(a===41||a===93||a===125)c=!1;else{let n=s+1;for(;n<t;){let t=e.charCodeAt(n);if(t===34||t===40||t===41||t===91||t===93||t===123||t===125||(t===45||t===47)&&e.charCodeAt(n+1)===41||(t===126||J(t))&&C(n)&&b(kC,n)>=0)break;n++}_(44,s,n)}}break}case 9:{let n=e.charCodeAt(s+1);if(a===34){w();break}if((a===126||J(a))&&T())break;switch(a){case 40:n===45||n===91||n===40&&e.charCodeAt(s+2)===40?E(a):n===93?(y(),_(56,s,s+2)):E(a);break;case 91:case 123:E(a);break;case 92:n===93?(y(),_(56,s,s+2)):_(44,s,s+1);break;case 47:n===93?(y(),_(57,s,s+2)):_(44,s,s+1);break;case 93:case 41:n===93?(y(),_(56,s,s+2)):c=!1;break;case 125:c=!1;break;default:{if((a===63||a===61)&&n===93){y(),_(56,s,s+2);break}let r=s+1;for(;r<t;){let t=e.charCodeAt(r);if(t===92||t===91||t===93||t===40||t===41||t===123||t===125||t===47)break;r++}_(44,s,r)}}break}case 10:c=j(a,CC,45,-1);break;case 11:c=j(a,TC,61,-1);break;case 12:c=j(a,DC,46,45);break;case 13:if(a===34)w();else if(J(a))y(),s++;else{let n=s+1;for(;n<t&&!J(e.charCodeAt(n));)n++;_(19,s,n)}break;case 14:if(a===40){let e=b(MC,s);y(),e>=0?s=e:(v(15),s++)}else{let n=e.indexOf(`(`,s);n===-1&&(n=t),_(8,s,n)}break;case 15:if(a===41)y(),s++;else{let n=e.indexOf(`)`,s);n===-1&&(n=t),_(9,s,n)}break;case 16:if(a===34)v(17),_(7,s,s+1);else if(a===125)y(),s++;else if(a===94)c=!1;else{let n=s+1;for(;n<t;){let t=e.charCodeAt(n);if(t===125||t===94||t===34)break;n++}_(7,s,n)}break;case 17:if(a===34)y(),_(7,s,s+1);else{let a=e.indexOf(`"`,s);a===-1&&(a=t),n.push(7),r.push(e.slice(s,a).replace(NC,`<br/>`)),i.push(s),s=a}}if(!c)return n.push(1),r.push(``),i.push(s),{types:n,texts:r,starts:i};continue e}return n.push(0),r.push(``),i.push(t),{types:n,texts:r,starts:i}}var FC=new Uint8Array(77);for(let e of[32,64,63,65,13,38,35,36,33,39,66])FC[e]=1;var IC=new Uint8Array(77);for(let e of[32,66,64,25,63,65,38,35,36,33,39])IC[e]=1;var LC=new Uint8Array(77);for(let e of[32,64,75,65,36,66,35,39,33,12,14,16,17,19,20,25,21,22,63,61,41])LC[e]=1;var RC=new Uint8Array(77);for(let e of[32,64,35,75,33,12])RC[e]=1;var zC=`'UNICODE_TEXT', 'TEXT', 'TAGSTART'`,BC=[],VC=/}\s*\n/g;function HC(e,t){let n=e.includes(`}`)?e.replace(VC,`}
|
|
104
|
+
`):e,{types:r,texts:i,starts:a}=PC(n),o=0,s,c=t=>{let i=r[o],s=n===e?a[o]:Po([Mo(e,VC,2)],a[o]);throw i===1?zo(`flowchart`,e,s,``,!0):zo(`flowchart`,e,s,`Expecting ${t}, got '${uC[i]}'`)},l=(e,t=``)=>(r[o]!==e&&c(`'${uC[e]}'${t?`, `+t:``}`),i[o++]),u=()=>{let e=r[o];e!==74&&e!==37&&e!==76&&c(`'SEMI', 'NEWLINE', 'EOF'`),o++},d=()=>{FC[r[o]]===0&&c(`'NODE_STRING'`);let e=i[o++];for(;FC[r[o]]===1;)e+=i[o++];return e},f=()=>{IC[r[o]]===0&&c(`'NODE_STRING'`);let e=i[o++];for(;IC[r[o]]===1;)e+=i[o++];return e},p=()=>{let e=r[o],t;if(e===11)t=`string`;else if(e===10)t=`markdown`;else if(e===44||e===60||e===51||e===66)t=`text`;else return c(`${zC}, 'TAGEND', 'STR', 'MD_STR'`);let n=i[o++];for(;;){let e=r[o];if(e!==44&&e!==60&&e!==51&&e!==66)break;n+=i[o++]}return{text:n,type:t}},m=e=>{l(e,zC)},h=()=>{let e=r[o],t;if(e===11)t=`string`;else if(e===10)t=`markdown`;else if(e===42||e===66)t=`text`;else return c(`'EDGE_TEXT', 'STR', 'MD_STR'`);let n=i[o++];for(;r[o]===42||r[o]===66;)n+=i[o++];return{text:n,type:t}},g=()=>{let e=r[o],t;if(e===11)t=`text`;else if(e===10)t=`markdown`;else if(LC[e]===1)t=`text`;else return c(`'NODE_STRING', 'STR', 'MD_STR'`);let n=i[o++];for(;LC[r[o]]===1;)n+=i[o++];return{text:n,type:t}},_=()=>{let e=i[o++];for(;r[o]===7;)e+=i[o++];return e},v=()=>{let e=d(),n;switch(r[o]){case 71:o++,n=p(),m(70),t.addVertex(e,n,`square`);break;case 55:o++,n=p(),m(54),t.addVertex(e,n,`doublecircle`);break;case 69:o++,r[o]===69?(o++,n=p(),m(68),l(68),t.addVertex(e,n,`circle`)):(n=p(),m(68),t.addVertex(e,n,`round`));break;case 45:o++,n=p(),m(43),t.addVertex(e,n,`ellipse`);break;case 47:o++,n=p(),m(46),t.addVertex(e,n,`stadium`);break;case 49:o++,n=p(),m(48),t.addVertex(e,n,`subroutine`);break;case 50:{o++;let r=l(64);l(35);let i=l(64);l(67),n=p(),m(70),t.addVertex(e,n,`rect`,void 0,void 0,void 0,{[r]:i});break}case 53:o++,n=p(),m(52),t.addVertex(e,n,`cylinder`);break;case 73:o++,r[o]===73?(o++,n=p(),m(72),l(72),t.addVertex(e,n,`hexagon`)):(n=p(),m(72),t.addVertex(e,n,`diamond`));break;case 51:o++,n=p(),m(70),t.addVertex(e,n,`odd`);break;case 58:o++,n=p(),r[o]===57?(o++,t.addVertex(e,n,`lean_right`)):(m(56),t.addVertex(e,n,`trapezoid`));break;case 59:o++,n=p(),r[o]===56?(o++,t.addVertex(e,n,`lean_left`)):(m(57),t.addVertex(e,n,`inv_trapezoid`));break;default:t.addVertex(e)}return e},y=()=>{let e=v();return r[o]===34&&(o++,t.setClass(e,d())),e},b=()=>{let e=[y()];for(s=void 0;;){let n=r[o]===7?_():void 0;if(r[o]!==75)return s=n,e;do o++;while(r[o]===75);if(r[o]!==36)return n!==void 0&&c(`'AMP'`),e;o++,r[o]!==75&&c(`'SPACE'`);do o++;while(r[o]===75);let i=y();n!==void 0&&t.addVertex(e[e.length-1],void 0,void 0,void 0,void 0,void 0,void 0,n),e.push(i)}},x=()=>{let e;if(r[o]===31&&(e=i[o++]),r[o]===40){let n=t.destructLink(i[o++]);return e!==void 0&&(n.id=e),r[o]===67&&(o++,n.text=p(),m(67),r[o]===75&&o++),n}if(r[o]===41){let n=i[o++],r=h(),a=l(40,`'EDGE_TEXT'`),s=t.destructLink(a,n);return s.text=r,e!==void 0&&(s.id=e),s}return c(`'LINK', 'START_LINK'`)},S=e=>{let n=b();s!==void 0&&t.addVertex(n[n.length-1],void 0,void 0,void 0,void 0,void 0,void 0,s);let i=n;for(;;){let a=r[o];if(a!==40&&a!==41&&a!==31)return i;let c=x(),l=b();s!==void 0&&t.addVertex(l[l.length-1],void 0,void 0,void 0,void 0,void 0,void 0,s),t.addLink(n,l,c),e&&(i=l.concat(i)),n=l}},C=()=>{RC[r[o]]===0&&c(`'NODE_STRING', 'NUM', 'COLON', 'BRKT'`);let e=i[o++];for(;RC[r[o]]===1;)e+=i[o++];return e},w=()=>{let e=[C()];for(;r[o]===38;)o++,e.push(C());return e},T=()=>{o++,l(75);let e;if(r[o]===13)e=[i[o++]];else for(e=[l(32,`'DEFAULT'`)];r[o]===38;)o++,e.push(l(32));if(l(75),r[o]!==15){t.updateLink(e,w());return}o++,l(75);let n=f();if(r[o]===75){o++;let r=w();t.updateLinkInterpolate(e,n),t.updateLink(e,r)}else t.updateLinkInterpolate(e,n)},E=(e,n)=>{if(r[o]!==75){t.setLink(e,n);return}if(o++,r[o]===23){t.setLink(e,n,i[o++]);return}let a=l(11,`'LINK_TARGET'`);r[o]===75?(o++,t.setLink(e,n,l(23))):t.setLink(e,n),t.setTooltip(e,a)},D=()=>{let e=i[o++];switch(r[o]){case 8:{let n=i[o++],a=r[o]===9,s=a?i[o++]:void 0,c;r[o]===75&&(o++,c=l(11)),a?t.setClickEvent(e,n,s):t.setClickEvent(e,n),c!==void 0&&t.setTooltip(e,c);return}case 18:o++,E(e,l(11));return;case 11:E(e,i[o++]);return;default:{let n=f();if(r[o]===75){o++;let r=l(11);t.setClickEvent(e,n),t.setTooltip(e,r)}else t.setClickEvent(e,n)}}},O=()=>{o++;let e=r[o];if(e===74||e===37||e===76)return o++,{id:void 0,title:void 0,list:[],collect:!1};l(75,`'SEMI', 'NEWLINE', 'EOF'`);let t=g(),n=t;return r[o]===71&&(o++,n=p(),m(70)),e=r[o],e!==74&&e!==37&&e!==76&&c(`'SEMI', 'NEWLINE', 'EOF', 'SQS'`),o++,{id:t,title:n,list:[],collect:!1}},k=e=>{let n=r[o];switch(n){case 12:{o++,l(75);let e=d();return l(75),t.addVertex(e,void 0,void 0,w()),u(),BC}case 14:return T(),u(),BC;case 16:{o++,l(75);let e=d();return l(75),t.addClass(e,w()),u(),BC}case 17:{o++,l(75);let e=d();return l(75),t.setClass(e,d()),u(),BC}case 19:return D(),u(),BC;case 26:case 27:case 28:case 29:case 30:return o++,{stmt:`dir`,value:UC[n-26]};case 2:{o++;let e=l(3).trim();return t.setAccTitle(e),e}case 4:{o++;let e=l(5).trim();return t.setAccDescription(e),e}case 6:{let e=i[o++].trim();return t.setAccDescription(e),e}default:{FC[n]===0&&c(WC);let t=S(e);return u(),t}}},A=()=>{let e=[],n=[],a=!1;for(;;){let s=r[o];if(s===0)break;if(s===22){let r=e.pop();if(r===void 0)break;o++;let i=t.addSubGraph(r.id,n,r.title);n=r.list,a=r.collect,a&&n.push(i)}else if(s===37||s===74||s===75||s===76)a&&n.push(i[o]),o++;else if(s===21){let t=O();t.list=n,t.collect=a,e.push(t),n=[],a=!0}else{let e=k(a);a&&(!Array.isArray(e)||e.length>0)&&n.push(e)}}e.length>0&&c(`'end'`)};for(;r[o]===75||r[o]===74;)o++;if(l(20,`'SPACE', 'NEWLINE'`),r[o]===24)o++,t.setDirection(`TB`);else{let e=l(25,`'NODIR'`),n=r[o];if(n===75){do o++;while(r[o]===75);n=r[o],n!==74&&c(`'NEWLINE', 'SPACE'`)}else n!==37&&n!==74&&c(`'SEMI', 'NEWLINE', 'SPACE'`);o++,t.setDirection(e)}A(),r[o]!==0&&c(WC)}var UC=[`TB`,`BT`,`RL`,`LR`,`TD`],WC=`'SEMI', 'NEWLINE', 'SPACE', 'EOF', 'subgraph', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'STYLE', 'LINKSTYLE', 'CLASSDEF', 'CLASS', 'CLICK', 'NODE_STRING'`;function GC(e){if(e.img)return`imageSquare`;if(e.icon)return e.form===`circle`?`iconCircle`:e.form===`square`?`iconSquare`:e.form===`rounded`?`iconRounded`:`icon`;switch(e.type){case`square`:case void 0:return`squareRect`;case`round`:return`roundedRect`;default:return e.type}}function KC(e){switch(e){case`arrow_point`:case`arrow_circle`:case`arrow_cross`:return[`none`,e];case`double_arrow_point`:case`double_arrow_circle`:case`double_arrow_cross`:{let t=e.replace(`double_`,``);return[t,t]}}return[`none`,`arrow_point`]}function qC(e,t){let n=[],r=[],i=e.subgraphs,a=t=>{let n=[];for(let r of t){let t=e.classes.get(r);if(t!==void 0){for(let e of t.styles)n.push(e.trim());for(let e of t.textStyles)n.push(e.trim())}}return n},o=new Map;for(let t of i)for(let n of t.nodes)e.subgraph(n)&&o.set(n,t.id);let s=new Map,c=new Map;for(let e of i){let t=o.get(e.id);if(t===void 0)continue;let n=c.get(t);n?n.push(e.id):c.set(t,[e.id])}let l=0;for(let e of i){if(o.has(e.id))continue;let t=[e.id];for(;t.length>0;){let e=t.pop();if(s.has(e))continue;s.set(e,l++);let n=c.get(e);if(n)for(let e=n.length-1;e>=0;e--)t.push(n[e])}}let u=t=>e.subgraph(t)?.metadata?.view===`collapsed`,d=!1;for(let e of i)e.metadata?.view===`collapsed`&&(d=!0);let f=new Map,p=e=>{let t=[],n=new Set,r=e;for(;r!==void 0&&!f.has(r)&&!n.has(r);)n.add(r),t.push(r),r=o.get(r);let i=r===void 0?void 0:f.get(r);for(let e=t.length-1;e>=0;e--)i===void 0&&u(t[e])&&(i=t[e]),f.set(t[e],i);return i},m=new Set,h=new Map;for(let e of d?i:[]){let t=p(e.id);if(t!==void 0){e.id!==t&&(m.add(e.id),h.set(e.id,t));for(let n of e.nodes)n!==t&&(m.add(n),h.set(n,t))}}let g=new Map,_=new Set;for(let e=i.length-1;e>=0;e--){let t=i[e];if(!m.has(t.id)){t.nodes.length>0&&_.add(t.id);for(let e of t.nodes)g.set(e,t.id)}}let v=new Map;for(let e=i.length-1;e>=0;e--){let t=i[e];if(m.has(t.id))continue;let r=t.metadata?.view===`collapsed`,o={id:t.id,label:t.title,labelType:t.labelType,parentId:g.get(t.id),cssStyles:[],cssCompiledStyles:a(t.classes),cssClasses:t.classes.join(` `),shape:r?`collapsedGroup`:`rect`,dir:t.dir,isGroup:!r,colorIndex:s.get(t.id)};r||(o.metadata=t.metadata),n.push(o),v.set(t.id,o)}for(let t of e.nodes.values()){if(m.has(t.id))continue;let r=v.get(t.id);if(r){r.cssStyles=t.styles,r.cssCompiledStyles=a(t.classes),r.cssClasses=t.classes.join(` `);continue}let i=_.has(t.id),o={id:t.id,label:t.text,labelType:t.labelType,parentId:g.get(t.id),cssStyles:t.styles,cssCompiledStyles:a([`default`,`node`,...t.classes]),cssClasses:`default `+t.classes.join(` `),dir:t.dir,link:t.link,linkTarget:t.linkTarget,tooltip:e.tooltips.get(t.id),icon:t.icon,pos:t.pos,img:t.img,assetWidth:t.assetWidth,assetHeight:t.assetHeight,constraint:t.constraint,isGroup:i,shape:i?`rect`:GC(t)};n.push(o)}return e.edges.forEach((n,i)=>{let o=h.get(n.start)??n.start,s=h.get(n.end)??n.end;if(o===s&&(h.has(n.start)||h.has(n.end)))return;let[c,l]=KC(n.type),u=[...e.defaultEdgeStyle??[]];n.style&&u.push(...n.style);let d=n.stroke===`invisible`||n.type===`arrow_open`;r.push({id:n.id||`L_${o}_${s}_${i}`,isUserDefinedId:n.isUserDefinedId,start:o,end:s,type:n.type??`normal`,label:n.text,labelType:n.labelType,thickness:n.stroke,pattern:n.stroke,minlen:n.length,classes:n.stroke===`invisible`?``:`edge-thickness-normal edge-pattern-solid flowchart-link`,arrowTypeStart:d?`none`:c,arrowTypeEnd:d?`none`:l,cssCompiledStyles:a(n.classes),style:u,animate:n.animate,animation:n.animation,curve:n.interpolate||e.defaultInterpolate||t})}),{nodes:n,edges:r}}var JC=40,YC=16,XC=48,ZC=20,QC=26,$C=` fill="var(--_s)" stroke="var(--_b)"`,ew=` stroke="var(--_b)"`;function tw(e,t,n){let r=e[t];return typeof r==`number`&&r>0?Math.min(r,2e3):n}function nw(e,t){return e!==void 0&&e>0&&e<=4e3?e:t}function rw(e,t,n,r){let i=i=>Oh(n,a=>iw(e,t,n,r,i,a));return Dh(e.direction)?Eh(n,i):i(!1)}function iw(e,t,n,r,i,a){let o=a?12:ZC,s=r?t[r.type]:void 0,c=typeof s==`object`&&s&&!Array.isArray(s)?s:t.flowchart??{},l=qC(e,typeof c.curve==`string`?c.curve:void 0);r?.prepare(l);let u=n.fontSize??16,d=Math.round(u*.875),f=n.measurer??bc(n.fontFamily,n.fontFamilyMono),p=Math.min(tw(c,`wrappingWidth`,200),r&&a?100:1/0),m=n.padding??8,h=n.icons,g=new Map,_=[],v=[];l.nodes.forEach((e,t)=>g.set(e.id,t));for(let e of l.nodes){let t=nm(e.cssStyles.length>0?e.cssCompiledStyles.concat(e.cssStyles):e.cssCompiledStyles),i=+!!t.bold|(t.italic?2:0),s=e.labelType===`markdown`,c=t.fontSize??u,l,d;if(e.isGroup){let u=Q(e.label,s,f,c,r&&a?Math.max(80,Ch(n)/2):4e3,i);l={node:e,style:t,label:u,shape:`group`,w:0,h:0,dy:0,loops:0},d=op(0,0),d.isGroup=!0,d.dir=e.dir?Vf(e.dir):void 0,d.padX=o,d.padTop=u.height>0?u.height+16:ZC,d.padBottom=o,d.minW=u.width+2*o-12}else{let n=Uu(e.shape),r=Q(e.img||e.icon||Fm(n)?e.label:void 0,s,f,c,p,i),a,o,u=0;if(e.img||e.icon){let t=e.img?80:48,n=nw(e.assetWidth,t),i=nw(e.assetHeight,t);a=Math.max(n,r.width+8),o=i+(r.height>0?r.height+6:0),u=e.pos===`t`?-i/2:i/2,r.height===0&&(u=0)}else{let e=jm(n,r.width,r.height);a=e.w,o=e.h,u=e.dy}l={node:e,style:t,label:r,shape:n,w:a,h:o,dy:u,loops:0},d=op(a,o)}d.seq=_.length,_.push(l),v.push(d)}l.nodes.forEach((e,t)=>{v[t].parent=e.parentId===void 0?-1:g.get(e.parentId)??-1}),ip(v,l.edges.map(e=>[g.get(e.start)??-1,g.get(e.end)??-1]));let y=i?`TB`:Vf(e.direction),b=e=>{let t;for(let n=v[e].parent,r=0;n>=0&&t===void 0&&r<1e4;n=v[n].parent,r++)t=v[n].dir;return t??=y,t===`LR`||t===`RL`};_.forEach((e,t)=>{e.node.isGroup?v[t].span=1/0:!e.node.img&&!e.node.icon&&(v[t].span=Pm(e.shape,e.w,e.h,b(t)))});let x=[],S=[],C=[];for(let e of l.edges){let t=g.get(e.start),n=g.get(e.end);if(t===void 0||n===void 0)continue;let r=Q(e.label,e.labelType===`markdown`,f,d,p);t===n&&(_[t].loops++,b(t)?v[t].h+=2*(QC+(r.height>0?r.height+8:0)):v[t].w+=2*(QC+(r.width>0?r.width+12:0))),C.push(e),S.push(r),x.push({src:t,dst:n,minlen:e.minlen??1,labelW:r.width>0?r.width+12:0,labelH:r.height>0?r.height+4:0,route:[],labelX:0,labelY:0})}let w={nodeSep:tw(c,`nodeSpacing`,JC)*(a?.5:1),edgeSep:YC,rankSep:tw(c,`rankSpacing`,XC)*(a?.75:1),portSep:20,tracks:typeof c.curve==`string`&&/^step/.test(c.curve),straight:c.curve===`linear`,headRoom:bp(`arrow_point`)},T=r?r.layout(v,x,y,w,a):lp(v,x,y,w),E=g_(e.title,f,u,a?Ch(n):4e3),D=E.height>0?E.height+12:0,O=Math.max(T.width,E.width);ap(v,x,m+(O-T.width)/2,m+D);let k=Math.ceil(O+2*m),A=Math.ceil(T.height+D+2*m),j=[],M=new Map,N=!1;for(let e of v)e.isGroup&&(N=!0);if(N)for(let e of x)up(M,e.route);let P=``,F=``,I=``,L=[];for(let e=0;e<_.length;e++){let t=_[e],i=v[e],a=t.node,s=i.x,c=i.y,l=im(a.cssClasses.replace(/^default\s?/,``)),u=Y(a.id);if(i.isGroup&&r?.drawGroup&&i.parent<0){fl(t.style.shape)&&r.filledBox&&L.push({box:r.filledBox(i,y),shape:t.style.shape}),P+=r.drawGroup(i,t.label,t.style,l,u,y,h);continue}if(i.isGroup){fl(t.style.shape)&&L.push({box:[s-i.w/2,c-i.h/2,s+i.w/2,c+i.h/2],shape:t.style.shape});let n=dp(i,t.label.width,M,o),r=c-i.h/2+8+t.label.height/2,a=fp(i,t.label.width,n,M),d=` class="pele-cluster-label"${a?` fill="var(--_m)"`:pl(t.style,`var(--_m)`)}${t.style.text}`;a&&(F+=pp(t.label,n,r,d,u,v,e,h)),P+=`<g class="pele-cluster${l}" data-id="${u}"><rect x="${X(s-i.w/2)}" y="${X(c-i.h/2)}" width="${X(i.w)}" height="${X(i.h)}" fill="var(--_a)"${Gp(t.style.shape)?``:` fill-opacity="0.5"`} stroke="var(--_b)"${Kp(t.style.shape)}/>`+(a?``:Z(t.label,n,r,d,h))+`</g>`;continue}let d=t.w,f=t.h,p,m=``;if(a.img){let e=nw(a.assetWidth,80),r=nw(a.assetHeight,80),i=t.label.height>0?a.pos===`t`?f/2-r:-f/2:-r/2,o=Nu(Tu(a.img),n);p=o===void 0?``:`<image href="${Ec(o)}" x="${X(-e/2)}" y="${X(i)}" width="${X(e)}" height="${X(r)}" preserveAspectRatio="${a.constraint===`on`?`xMidYMid meet`:`none`}"/>`}else if(a.icon){let e=nw(a.assetHeight,48),n=t.label.height>0?a.pos===`t`?f/2-e:-f/2:-e/2,r=a.shape===`icon`?``:a.shape===`iconCircle`?`<circle cy="${X(n+e/2)}" r="${X(e/2)}"${$C}${t.style.shape}/>`:`<rect x="${X(-e/2)}" y="${X(n)}" width="${X(e)}" height="${X(e)}" rx="${a.shape===`iconRounded`?8:0}"${$C}${t.style.shape}/>`,i=e*.6;p=r+`<svg class="pele-icon" data-icon="${Y(a.icon)}" x="${X(-i/2)}" y="${X(n+(e-i)/2)}" width="${X(i)}" height="${X(i)}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${h?.(a.icon)??``}</svg>`}else p=Mm(t.shape,d,f,$C+t.style.shape,ew+t.style.line),Im(t.shape)&&(m=pl(t.style));let g=Z(t.label,0,t.dy,` class="pele-label"${m}${t.style.text}`,h);if(/ internal-link(?: |$)/.test(l+` `)&&a.label&&n.links!==!1){let e=Xo(a.label),t=Fu(e,n),r=Ec(e);g=`<a class="internal-link"${t?` href="${r}"${Lu(n)}`:``} data-href="${r}">${g}</a>`,j.push({id:a.id,href:e,internal:!0})}let b=p+g;a.tooltip&&(b=`<title>${Y(a.tooltip)}</title>`+b),a.link&&(b=Iu(b,a.link,a.id,j,n,a.linkTarget?` target="${Ec(a.linkTarget)}"`:``)),I+=`<g class="pele-node pele-shape-${t.shape}${l}" data-id="${u}" transform="translate(${X(s)},${X(c)})">${b}</g>`}let R=vp();for(let e=0;e<x.length;e++){let t=x[e];t.src===t.dst||C[e].thickness===`invisible`||t.route.length<6||(R.add(t.src,Lm(t.route,0,v[t.src]),C[e].arrowTypeStart),R.add(t.dst,Lm(t.route,t.route.length-3,v[t.dst]),C[e].arrowTypeEnd))}let z=``,B=``,V=``,H=new Map;for(let e=0;e<x.length;e++){let t=x[e],n=C[e],r=S[e],i=n.style.length>0||n.cssCompiledStyles.length>0?nm(n.cssCompiledStyles.concat(n.style)):void 0;if(n.thickness!==`invisible`){let e=n.arrowTypeStart,r=n.arrowTypeEnd,a;if(t.src===t.dst){let e=_[t.src],n=H.get(t.src)??0;H.set(t.src,n+1),a=zp(v[t.src],e.w,e.h,n,b(t.src),QC,bp(r),t)}else{let i=t.route.slice(),o=R.of(t.src,Lm(i,0,v[t.src])),s=R.of(t.dst,Lm(i,i.length-3,v[t.dst]));Rm(i,0,_[t.src],v[t.src]),Rm(i,i.length-3,_[t.dst],v[t.dst]),a=yp(i,n.curve,bp(e),bp(r),o,s)}let o=Np(a.d,[a.sx,a.sy,a.ex,a.ey],L,i?.line,a.tokens),s=o||(i?.stroke&&n.thickness!==`invisible`?Ec(i.stroke):`var(--_l)`),c=``;n.thickness===`thick`?c+=` stroke-width="2.5"`:n.thickness===`dotted`&&(c+=` stroke-dasharray="3 4"`);let l=im(n.classes.replace(/edge-thickness-normal|edge-pattern-solid|flowchart-link/g,``));o===``&&(z+=Ip(a,e,r,i?.line,n.thickness===`thick`)),B+=`<g class="pele-edge${l}" data-id="${Y(n.id)}"${o?` stroke="${o}"`:``}${i?.line??``}><path d="${a.d}"${c}/>`+xp(e,a.sx,a.sy,a.sdx,a.sdy,s)+xp(r,a.ex,a.ey,a.edx,a.edy,s)+`</g>`}if(r.width>0){let e=t.labelX,a=t.labelY;V+=Rp(n.id,r,e,a,i?.text??``,h)}}return{svg:lm(r?.type??`flowchart`,k,A,u,n,e,Z(E,k/2,m+E.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(P?`<g class="pele-clusters">${P}</g>`:``)+Lp(z)+(B?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${B}</g>`:``)+(F?`<g class="pele-cluster-titles">${F}</g>`:``)+(V?`<g class="pele-edge-labels" font-size="${d}">${V}</g>`:``)+`<g class="pele-nodes">${I}</g>`),width:k,height:A,links:j}}var aw={type:`flowchart`,math:!0,parse(e,t,n,r,i){let a=new lC({inheritDir:(t.flowchart??{}).inheritDir===!0,maxEdges:i.maxEdges});return n&&(a.title=n),HC(e,a),a},render:rw},ow=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],sw=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function cw(e){return!Number.isNaN(e.getTime())}function lw(e,t){let n=String(e);return n.length>=t?n:`0`.repeat(t-n.length)+n}function uw(e){let t=[`th`,`st`,`nd`,`rd`],n=e%100;return e+(t[(n-20)%10]||t[n]||t[0])}function dw(e){let t=-Math.round(e.getTimezoneOffset()/15)*15;return t===0?0:t}function fw(e){let t=dw(e),n=Math.abs(t);return(t>=0?`+`:`-`)+lw(Math.floor(n/60),2)+`:`+lw(n%60,2)}function pw(e){return e.getDay()||7}function mw(e,t){let n=new Date(e);return n.setDate(n.getDate()+t),n}function hw(e){let t=new Date(e.getFullYear(),e.getMonth()+1,0);return t.setHours(23,59,59,999),t.getDate()}function gw(e,t){let n=new Date(e);return n.setDate(1),t(n),n.setDate(Math.min(e.getDate(),hw(n))),n}function _w(e,t,n){switch(n){case`M`:return gw(e,n=>n.setMonth(e.getMonth()+t));case`y`:return gw(e,n=>n.setFullYear(e.getFullYear()+t));case`d`:return mw(e,Math.round(t));case`w`:return mw(e,Math.round(7*t));case`h`:return new Date(e.getTime()+t*36e5);case`m`:return new Date(e.getTime()+t*6e4);case`s`:return new Date(e.getTime()+t*1e3);default:return new Date(e.getTime()+t)}}function vw(e){return mw(e,4-pw(e))}function yw(e){let t=vw(e),n=new Date(t.getFullYear(),0,1),r=pw(n),i=mw(n,4-r+(r>4?7:0)),a=(dw(i)-dw(t))*6e4,o=(t.getTime()-i.getTime()-a)/6048e5;return(o<0?Math.ceil(o)||0:Math.floor(o))+1}var bw=/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,xw=/\[([^\]]+)]|YYYY|YY|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,Sw=`YYYY-MM-DDTHH:mm:ssZ`;function Cw(e,t){if(!cw(e))return`Invalid Date`;let n=t||Sw;if(n===`YYYY-MM-DD`)return ww(e);let r=!1,i=n.replace(bw,t=>{switch(t){case`Q`:return String(Math.ceil((e.getMonth()+1)/3));case`Do`:return`[`+uw(e.getDate())+`]`;case`GGGG`:return String(vw(e).getFullYear());case`W`:return String(yw(e));case`WW`:return lw(yw(e),2);case`k`:return String(e.getHours()||24);case`kk`:return lw(e.getHours()||24,2);case`X`:return String(Math.floor(e.getTime()/1e3));case`x`:return String(e.getTime());case`gggg`:case`wo`:case`w`:case`ww`:case`z`:case`zzz`:return r=!0,t;default:return t}});if(r)return;let a=e.getHours();return i.replace(xw,(t,n)=>{if(n)return n;switch(t){case`YY`:return String(e.getFullYear()).slice(-2);case`YYYY`:return lw(e.getFullYear(),4);case`M`:return String(e.getMonth()+1);case`MM`:return lw(e.getMonth()+1,2);case`MMM`:return ow[e.getMonth()].slice(0,3);case`MMMM`:return ow[e.getMonth()];case`D`:return String(e.getDate());case`DD`:return lw(e.getDate(),2);case`d`:return String(e.getDay());case`dd`:return sw[e.getDay()].slice(0,2);case`ddd`:return sw[e.getDay()].slice(0,3);case`dddd`:return sw[e.getDay()];case`H`:return String(a);case`HH`:return lw(a,2);case`h`:return String(a%12||12);case`hh`:return lw(a%12||12,2);case`a`:return a<12?`am`:`pm`;case`A`:return a<12?`AM`:`PM`;case`m`:return String(e.getMinutes());case`mm`:return lw(e.getMinutes(),2);case`s`:return String(e.getSeconds());case`ss`:return lw(e.getSeconds(),2);case`SSS`:return lw(e.getMilliseconds(),3);case`Z`:return fw(e);default:return fw(e).replace(`:`,``)}})}function ww(e){let t=e.getFullYear(),n=e.getMonth()+1,r=e.getDate();return(t>=1e3&&t<=9999?t:lw(t,4))+(n<10?`-0`:`-`)+n+(r<10?`-0`:`-`)+r}var Tw=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,Ew=/\[[^\]]+]/g,Dw=/\d/,Ow=/\d\d/,kw=/\d{3}/,Aw=/\d{4}/,jw=/\d\d?/,Mw=/[+-]?\d+/,Nw=/[+-]\d\d:?(\d\d)?|Z/,Pw=/\d*[^-_:/,()\s\d]+/;function Fw(e){return(t,n)=>(t[e]=+n,!0)}var Iw=(e,t)=>{if(t===`Z`)return e.offset=0,!0;let n=t.match(/([+-]|\d\d)/g),r=n[1]*60+(+n[2]||0);return e.offset=r===0?0:n[0]===`+`?-r:r,!0};function Lw(e){return(t,n)=>{let r=e.indexOf(n)+1;return r<1?!1:(t.month=r%12||r,!0)}}var Rw=new Map([[`A`,{re:Pw,read:(e,t)=>(e.afternoon=t===`PM`,!0)}],[`a`,{re:Pw,read:(e,t)=>(e.afternoon=t===`pm`,!0)}],[`Q`,{re:Dw,read:(e,t)=>(e.month=(t-1)*3+1,!0)}],[`S`,{re:Dw,read:(e,t)=>(e.milliseconds=t*100,!0)}],[`SS`,{re:Ow,read:(e,t)=>(e.milliseconds=t*10,!0)}],[`SSS`,{re:kw,read:(e,t)=>(e.milliseconds=+t,!0)}],[`s`,{re:jw,read:Fw(`seconds`)}],[`ss`,{re:jw,read:Fw(`seconds`)}],[`m`,{re:jw,read:Fw(`minutes`)}],[`mm`,{re:jw,read:Fw(`minutes`)}],[`H`,{re:jw,read:Fw(`hours`)}],[`h`,{re:jw,read:Fw(`hours`)}],[`HH`,{re:jw,read:Fw(`hours`)}],[`hh`,{re:jw,read:Fw(`hours`)}],[`D`,{re:jw,read:Fw(`day`)}],[`DD`,{re:Ow,read:Fw(`day`)}],[`Do`,{re:Pw,read:(e,t)=>{let n=t.match(/\d+/);if(!n)return!1;e.day=+n[0],e.dayGiven=!0;for(let n=1;n<=31;n++)uw(n)===t&&(e.day=n);return!0}}],[`w`,{re:jw,read:Fw(`week`)}],[`ww`,{re:Ow,read:Fw(`week`)}],[`M`,{re:jw,read:Fw(`month`)}],[`MM`,{re:Ow,read:Fw(`month`)}],[`MMM`,{re:Pw,read:Lw(ow.map(e=>e.slice(0,3)))}],[`MMMM`,{re:Pw,read:Lw(ow)}],[`Y`,{re:Mw,read:Fw(`year`)}],[`YY`,{re:Ow,read:(e,t)=>(e.year=+t+(+t>68?1900:2e3),!0)}],[`YYYY`,{re:Aw,read:Fw(`year`)}],[`Z`,{re:Nw,read:Iw}],[`ZZ`,{re:Nw,read:Iw}]]),zw,Bw=null;function Vw(e){if(e===zw)return Bw;if(zw=e,Bw=null,/[Ll]/.test(e.replace(Ew,``)))return null;let t=e.match(Tw);return t?(Bw=t.map(e=>Rw.get(e)??e.replace(/^\[|\]$/g,``)),Bw):null}function Hw(e,t,n){if(t===`x`||t===`X`)return new Date((t===`X`?1e3:1)*Number(e));let r=Vw(t);if(!r)return;let i={},a=e,o=0;for(let e of r){if(typeof e==`string`){o+=e.length;continue}let t=e.re.exec(a.slice(o));if(!t||!e.read(i,t[0]))return;a=a.replace(t[0],``)}i.afternoon!==void 0&&i.hours!==void 0&&(i.afternoon?i.hours<12&&(i.hours+=12):i.hours===12&&(i.hours=0));let s=i.dayGiven||i.day?i.day:!i.year&&!i.month?n.getDate():1,c=i.year||n.getFullYear(),l=0;i.year&&!i.month||(l=i.month>0?i.month-1:n.getMonth());let u=i.hours||0,d=i.minutes||0,f=i.seconds||0,p=i.milliseconds||0;if(i.offset!==void 0)return new Date(Date.UTC(c,l,s,u,d,f,p+i.offset*6e4));if(!i.week)return new Date(c,l,s,u,d,f,p)}function Uw(e,t,n){let r=Hw(e,t,n);return r&&cw(r)&&Cw(r,t)===e?r:void 0}var Ww=/^[YMDHhmsSZXx\-/.:, T]*$/,Gw=/^\s*(active|done|crit|milestone|vert)\s*$/,Kw=/^after\s+([\d\w- ]+)/,qw=/^until\s+([\d\w- ]+)/,Jw=/^(\d+(?:\.\d+)?)([Mdhmswy]|ms)$/,Yw=/[\s,]+/,Xw=/^\d+$/,Zw=new Set(sw.map(e=>e.toLowerCase())),Qw=4e8,$w=400,eT=200,tT=400;function nT(e){let t=e===void 0?NaN:+e;return Number.isFinite(t)?t:Date.now()}function rT(e){let t=Jw.exec(e.trim());return t?[Number.parseFloat(t[1]),t[2]]:[NaN,`ms`]}function iT(e,t){let n=new Set(e);for(let e of t.toLowerCase().split(Yw))e!==``&&n.add(e);return[...n]}var aT=class{type=`gantt`;title;accTitle;accDescr;dateFormat=``;axisFormat=``;tickInterval;todayMarker=``;includes=[];excludes=[];inclusiveEndDates=!1;topAxis=!1;displayMode=``;weekday;weekend=`saturday`;sections=[];links=new Map;tasks=[];byId=new Map;currentSection=``;taskCount=0;lastOrder=0;lastTaskId;options;now=0;work=0;includeSet=new Set;excludeSet=new Set;excludedDays=[];datedTokens=!1;constructor(e={}){this.options=e}setDateFormat(e){this.dateFormat=e}enableInclusiveEndDates(){this.inclusiveEndDates=!0}TopAxis(){this.topAxis=!0}setAxisFormat(e){this.axisFormat=e}setTickInterval(e){this.tickInterval=e}setTodayMarker(e){this.todayMarker=e}setIncludes(e){this.includes=iT(this.includes,e)}setExcludes(e){this.excludes=iT(this.excludes,e)}setWeekday(e){this.weekday=e}setWeekend(e){this.weekend=e}setDiagramTitle(e){this.title=e}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
105
|
+
`)}addSection(e){this.currentSection=e,this.sections.push(e)}addTask(e,t){let n=(t.startsWith(`:`)?t.slice(1):t).split(`,`),r={id:``,task:e,section:this.currentSection,startTime:void 0,endTime:void 0,renderEndTime:null,manualEndTime:!1,processed:!1,active:!1,done:!1,crit:!1,milestone:!1,vert:!1,order:-1,classes:[],prevTaskId:this.lastTaskId,raw:{data:t,start:void 0,end:``}},i;for(;n.length>0&&(i=Gw.exec(n[0]))!==null;)r[i[1]]=!0,n.shift();if(n.length===0)throw new jo(`Task "${e.trim()}" needs a duration or an end date.`,`semantic`,{type:`gantt`});if(n.length>3)throw new jo(`Task "${e.trim()}" has too many fields. A task takes an id, a start, and an end or duration.`,`semantic`,{type:`gantt`});for(let e=0;e<n.length;e++)n[e]=n[e].trim();n.length===3?r.id=n[0]:(this.taskCount++,r.id=`task`+this.taskCount),n.length>1&&(r.raw.start=n[n.length-2]),r.raw.end=n[n.length-1],r.vert||(r.order=this.lastOrder++),this.tasks.push(r),this.lastTaskId=r.id,this.byId.set(r.id,r)}setLink(e,t){let n=Tu(t);for(let t of e.split(`,`))this.byId.has(t)&&this.links.set(t,n);this.setClass(e,`clickable`)}setClickEvent(e,t,n){this.setClass(e,`clickable`)}setClass(e,t){for(let n of e.split(`,`))this.byId.get(n)?.classes.push(t)}getTasks(e){this.now=nT(e),this.work=0,this.includeSet=new Set(this.includes),this.excludeSet=new Set(this.excludes);let t=this.weekend===`friday`?5:this.weekend===`saturday`?6:NaN,n=this.excludeSet.has(`weekends`);this.excludedDays=sw.map((e,r)=>{let i=r||7;return n&&(i===t||i===t+1)||this.excludeSet.has(e.toLowerCase())}),this.datedTokens=this.includes.length>0||!Ww.test(this.dateFormat.trim());for(let e of this.excludes)e!==`weekends`&&!Zw.has(e)&&(this.datedTokens=!0);for(let e of this.tasks)e.startTime=e.endTime=void 0,e.renderEndTime=null,e.processed=e.manualEndTime=!1;let r=this.compileTasks();for(let e=0;!r&&e<10;e++)r=this.compileTasks();return this.tasks}isInvalidDate(e){let t=this.excludedDays[e.getDay()];if(!this.datedTokens)return t;let n=this.dateFormat.trim(),r=ww(e),i=r;this.spend(eT),n!==`YYYY-MM-DD`&&(this.spend(tT+n.length*8),i=Cw(e,n));let a=e=>e.has(r)||i!==void 0&&e.has(i);return a(this.includeSet)?!1:t||a(this.excludeSet)}spend(e){if(this.work+=e,this.work>Qw)throw new jo(`The gantt chart takes too much work to schedule.`,`limit`,{type:`gantt`})}parse(e,t){return this.spend((t.length+1)*(e.length+1)),Uw(e,t,new Date(this.now))}today(){let e=new Date(this.now);return e.setHours(0,0,0,0),e}warn(e){this.options.warn&&this.options.warn(e())}compileTasks(){let e=!0;for(let t of this.tasks)this.compileTask(t),e&&=t.processed;return e}compileTask(e){let t=e.raw.start;if(t===void 0){let t=e.prevTaskId===void 0?void 0:this.byId.get(e.prevTaskId);e.startTime=t?t.endTime:this.today()}else{let n=this.getStartDate(t);n&&(e.startTime=n)}e.startTime&&(e.endTime=this.getEndDate(e.startTime,e.raw.end),e.endTime&&(e.processed=!0,e.manualEndTime=this.parse(e.raw.end,`YYYY-MM-DD`)!==void 0,this.checkTaskDates(e)))}references(e,t){let n=[],r;for(let e of t.split(` `)){if(e===``)continue;let t=this.byId.get(e);t?n.push(t):(r??=[]).push(e)}if(r){let t=r;this.warn(()=>`Gantt: "${e}" refers to task ids that do not exist: ${t.join(`, `)}.`)}return n}getStartDate(e){let t=e.trim(),n=this.dateFormat.trim();if((n===`x`||n===`X`)&&Xw.test(t))return this.checked(new Date(Number(t)),t);let r=Kw.exec(t);if(r!==null){let e=this.references(`after`,r[1]),t;for(let n of e)(!t||n.endTime>t.endTime)&&(t=n);return t?t.endTime:this.today()}let i=this.parse(t,n);if(i)return i;let a=new Date(t);if(!cw(a)||a.getFullYear()<-1e4||a.getFullYear()>1e4)throw new jo(`Invalid date:`+t,`semantic`,{type:`gantt`});return a}checked(e,t){if(!cw(e))throw new jo(`Invalid date:`+t,`semantic`,{type:`gantt`});return e}getEndDate(e,t){let n=t.trim(),r=qw.exec(n);if(r!==null){let e=this.references(`until`,r[1]),t;for(let n of e)(!t||n.startTime<t.startTime)&&(t=n);return t?t.startTime:this.today()}let i=this.dateFormat.trim(),a=this.parse(n,i);if(a)return this.inclusiveEndDates?mw(a,1):a;let[o,s]=rT(n);if(Number.isNaN(o))return this.warn(()=>`Gantt: "${n}" is neither a date in the "${i}" format nor a duration such as "3d", so the task gets no duration.`),new Date(e);let c=_w(e,o,s);return cw(c)?c:new Date(e)}checkTaskDates(e){if(this.excludes.length===0||e.manualEndTime)return;let t=mw(e.startTime,1),n=new Date(e.endTime),r=+mw(n,1e4),i=!1,a=null;for(;+t<=+n;){if(this.spend($w),i||(a=+n),i=this.isInvalidDate(t),i&&(n.setDate(n.getDate()+1),+n>r))throw new jo("Failed to find a valid date that was not excluded by `excludes` after 10,000 iterations.",`semantic`,{type:`gantt`});t.setDate(t.getDate()+1)}e.endTime=n,e.renderEndTime=a===null?null:new Date(a)}},oT=`$end.INVALID.open_directive.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.NL.href.callbackname.callbackargs.click.gantt.dateFormat.inclusiveEndDates.topAxis.axisFormat.tickInterval.includes.excludes.todayMarker.weekday_monday.weekday_tuesday.weekday_wednesday.weekday_thursday.weekday_friday.weekday_saturday.weekday_sunday.weekend_friday.weekend_saturday.date.title.accDescription.section.taskTxt.taskData.:.EOF`.split(`.`),sT=/accTitle\s*:\s*/iy,cT=/accDescr\s*:\s*/iy,lT=/accDescr\s*\{\s*/iy,uT=/href\s+"/iy,dT=/call\s+/iy,fT=/click\s+/iy,pT=/\(\s*\)/y,mT=/weekday\s+(monday|tuesday|wednesday|thursday|friday|saturday|sunday)\b/iy,hT=[`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`,`sunday`],gT=/weekend\s+(?:(friday)|saturday)\b/iy,_T=/\d\d\d\d-\d\d-\d\d\b/y,vT=/title[^\S\r\n]*(?=[\r\n]|$)/iy,yT=new Map([[97,[[/axisFormat\s[^#\n;]+/iy,17],[/accDescription\s[^#\n;]+/iy,33]]],[103,[[/gantt\b/iy,13]]],[100,[[/dateFormat\s[^#\n;]+/iy,14]]],[105,[[/inclusiveEndDates\b/iy,15],[/includes\s[^#\n;]+/iy,19]]],[116,[[/topAxis\b/iy,16],[/tickInterval\s[^#\n;]+/iy,18],[/todayMarker\s[^\n;]+/iy,21],[/title[^\S\r\n][^\n]+/iy,32]]],[101,[[/excludes\s[^#\n;]+/iy,20]]],[115,[[/section\s[^\n]+/iy,34]]]]);function bT(e){let t=e.length,n=[],r=[],i=[],a=0,o=0,s=(t,a,s)=>{n.push(t),r.push(e.slice(a,s)),i.push(a),o=s},c=t=>(t.lastIndex=o,t.test(e)?t.lastIndex:-1),l=(n,r)=>{let i=e.indexOf(n,r);return i===-1?t:i},u=t=>{let n;switch(t|32){case 97:if((n=c(sT))>=0)return a=1,s(3,o,n),!0;if((n=c(cT))>=0)return a=2,s(5,o,n),!0;if((n=c(lT))>=0)return a=3,o=n,!0;break;case 104:if((n=c(uT))>=0)return a=4,o=n,!0;break;case 99:if((n=c(dT))>=0)return a=5,o=n,!0;if((n=c(fT))>=0)return a=7,o=n,!0;break;case 116:if((n=c(vT))>=0)return o=n,!0;break;case 119:{mT.lastIndex=o;let t=mT.exec(e);if(t)return s(22+hT.indexOf(t[1].toLowerCase()),o,mT.lastIndex),!0;if(gT.lastIndex=o,t=gT.exec(e),t)return s(t[1]===void 0?30:29,o,gT.lastIndex),!0;break}}let r=yT.get(t|32);if(r){for(let[e,t]of r)if((n=c(e))>=0)return s(t,o,n),!0}return!1};for(;;){if(o>=t){let e=38;switch(a){case 1:e=4;break;case 2:e=6;break;case 3:e=7;break;case 4:e=9;break;case 5:e=10;break;case 6:e=11;break;case 7:e=12}s(e,t,t);break}let d=e.charCodeAt(o);switch(a){case 0:{let a=e.charCodeAt(o+1);if(d===37){if(a!==37){let t=l(`
|
|
106
|
+
`,o+1);for(;e.charCodeAt(t)===10;)t++;o=t}else{if(e.charCodeAt(o+2)===123)return s(2,o,o+3),s(1,o,o),{types:n,texts:r,starts:i};o=l(`
|
|
107
|
+
`,o+2)}}else if(d===10){let t=o+1;for(;e.charCodeAt(t)===10;)t++;s(8,o,t)}else if(J(d))for(o++;o<t&&J(e.charCodeAt(o));)o++;else{if(u(d))break;if(d>=48&&d<=57&&c(_T)>=0)s(31,o,o+10);else if(d!==58){let n=o+1;for(;n<t;){let t=e.charCodeAt(n);if(t===58||t===10)break;n++}s(35,o,n)}else{let n=o+1;for(;n<t;){let t=e.charCodeAt(n);if(t===35||t===10||t===59)break;n++}s(n>o+1?36:37,o,n)}}break}case 1:case 2:{let e=a===1?4:6;a=0,s(e,o,l(`
|
|
108
|
+
`,o));break}case 3:d===125?(a=0,o++):s(7,o,l(`}`,o));break;case 4:d===34?(a=0,o++):s(9,o,l(`"`,o));break;case 5:if(d===40){let e=c(pT);e>=0?(a=0,o=e):(a=6,o++)}else s(10,o,l(`(`,o));break;case 6:d===41?(a=0,o++):s(11,o,l(`)`,o));break;case 7:if(J(d))a=0,o++;else{let n=o+1;for(;n<t&&!J(e.charCodeAt(n));)n++;s(12,o,n)}}}return n.push(0),r.push(``),i.push(t),{types:n,texts:r,starts:i}}var xT=[`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`,`sunday`],ST=`'EOF', 'SPACE', 'NL', 'weekday_monday', 'weekday_tuesday', 'weekday_wednesday', 'weekday_thursday', 'weekday_friday', 'weekday_saturday', 'weekday_sunday', 'weekend_friday', 'weekend_saturday', 'dateFormat', 'inclusiveEndDates', 'topAxis', 'axisFormat', 'tickInterval', 'excludes', 'includes', 'todayMarker', 'title', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'section', 'taskTxt', 'click'`,CT=new Uint8Array(39);for(let e=22;e<=30;e++)CT[e]=1;for(let e of[38,8,14,15,16,17,18,20,19,21,32,3,5,7,34,35,12])CT[e]=1;function wT(e,t){let{types:n,texts:r,starts:i}=bT(e),a=0,o=t=>{let r=n[a];throw zo(`gantt`,e,i[a],`Expecting ${t}, got '${r===0?`1`:oT[r]}'`)},s=(e=``)=>{CT[n[a]]!==1&&o(ST+e)};for(n[a]!==13&&o(`'gantt'`),a++;;){let e=n[a],i=r[a];switch(CT[e]!==1&&o(ST),a++,e){case 38:if(n[a]===0)return;s();break;case 8:break;case 14:s(),t.setDateFormat(i.slice(11));break;case 15:s(),t.enableInclusiveEndDates();break;case 16:s(),t.TopAxis();break;case 17:s(),t.setAxisFormat(i.slice(11));break;case 18:s(),t.setTickInterval(i.slice(13));break;case 20:s(),t.setExcludes(i.slice(9));break;case 19:s(),t.setIncludes(i.slice(9));break;case 21:s(),t.setTodayMarker(i.slice(12));break;case 29:s(),t.setWeekend(`friday`);break;case 30:s(),t.setWeekend(`saturday`);break;case 32:s(),t.setDiagramTitle(i.slice(6));break;case 3:{n[a]!==4&&o(`'acc_title_value'`);let e=r[a++];s(),t.setAccTitle(e.trim());break}case 5:{n[a]!==6&&o(`'acc_descr_value'`);let e=r[a++];s(),t.setAccDescription(e.trim());break}case 7:s(),t.setAccDescription(i.trim());break;case 34:s(),t.addSection(i.slice(8));break;case 35:{n[a]!==36&&o(`'taskData'`);let e=r[a++];s(),t.addTask(i,e);break}case 12:{let e,c=null,l;n[a]===10?(e=r[a++],n[a]===11&&(c=r[a++]),n[a]===9?(l=r[a++],s()):s(c===null?`, 'callbackargs', 'href'`:`, 'href'`)):n[a]===9?(l=r[a++],n[a]===10?(e=r[a++],n[a]===11?(c=r[a++],s()):s(`, 'callbackargs'`)):s(`, 'callbackname'`)):o(`'callbackname', 'href'`),e!==void 0&&t.setClickEvent(i,e,c),l!==void 0&&t.setLink(i,l);break}default:s(),t.setWeekday(xT[e-22])}}}var TT=1e3,ET=60*TT,DT=60*ET,OT=24*DT,kT=7*OT,AT=30*OT,jT=365*OT;function MT(e){e.setHours(0,0,0,0)}function NT(e){return{floor(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),MT(t)},offset:(e,t)=>e.setDate(e.getDate()+t*7),cycle:1/0,ms:kT}}var PT={millisecond:{floor:()=>{},offset:(e,t)=>e.setTime(+e+t),cycle:1/0,ms:1},second:{floor:e=>e.setTime(+e-e.getMilliseconds()),offset:(e,t)=>e.setTime(+e+t*TT),field:e=>e.getUTCSeconds(),cycle:60,ms:TT},minute:{floor:e=>e.setTime(+e-e.getMilliseconds()-e.getSeconds()*TT),offset:(e,t)=>e.setTime(+e+t*ET),field:e=>e.getMinutes(),cycle:60,ms:ET},hour:{floor:e=>e.setTime(+e-e.getMilliseconds()-e.getSeconds()*TT-e.getMinutes()*ET),offset:(e,t)=>e.setTime(+e+t*DT),field:e=>e.getHours(),cycle:24,ms:DT},day:{floor:MT,offset:(e,t)=>e.setDate(e.getDate()+t),field:e=>e.getDate()-1,cycle:31,ms:OT},month:{floor(e){e.setDate(1),MT(e)},offset:(e,t)=>e.setMonth(e.getMonth()+t),field:e=>e.getMonth(),cycle:12,ms:AT},year:{floor(e){e.setMonth(0,1),MT(e)},offset:(e,t)=>e.setFullYear(e.getFullYear()+t),cycle:1/0,ms:jT}};function FT(e,t,n){return Math.floor((+t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*ET)/n)}function IT(e,t){return(e%t+t)%t}function LT(e,t,n){let r=e===`week`?NT(n):PT[e];if(t<=1)return r;if(e===`millisecond`)return{...r,floor:e=>e.setTime(Math.floor(+e/t)*t),offset:(e,n)=>e.setTime(+e+n*t)};if(e===`year`)return{...r,floor(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),r.floor(e)},offset:(e,n)=>e.setFullYear(e.getFullYear()+n*t)};if(e===`week`){let e=new Date(0);return r.floor(e),{...r,floor(n){r.floor(n),r.offset(n,-IT(FT(e,n,kT),t))},offset:(e,n)=>r.offset(e,n*t)}}let i=r.field,a=e=>i(e)%t===0;return{...r,floor(e){for(r.floor(e);Number.isFinite(+e)&&!a(e);r.floor(e))e.setTime(e-1)},offset(e,t){for(let n=0;n<t&&Number.isFinite(+e);n++)do r.offset(e,1);while(Number.isFinite(+e)&&!a(e))}}}function RT(e,t,n,r){let i=new Date(t-1);e.floor(i),e.offset(i,1),e.floor(i);let a=[],o=-1/0;for(;+i<=n&&+i>o;){if(a.length>=r)return;o=+i,a.push(o),e.offset(i,1),e.floor(i)}return a}function zT(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i;return 10**i*(a>=Math.sqrt(50)?10:a>=Math.sqrt(10)?5:a>=Math.SQRT2?2:1)}var BT=[[`second`,1,TT],[`second`,5,5*TT],[`second`,15,15*TT],[`second`,30,30*TT],[`minute`,1,ET],[`minute`,5,5*ET],[`minute`,15,15*ET],[`minute`,30,30*ET],[`hour`,1,DT],[`hour`,3,3*DT],[`hour`,6,6*DT],[`hour`,12,12*DT],[`day`,1,OT],[`day`,2,2*OT],[`week`,1,kT],[`month`,1,AT],[`month`,3,3*AT],[`year`,1,jT]];function VT(e,t,n){let r=(t-e)/n,i=0;for(;i<BT.length&&BT[i][2]<=r;)i++;let a;if(i===BT.length)a=LT(`year`,Math.max(1,zT(e/jT,t/jT,n)),0);else if(i===0)a=LT(`millisecond`,Math.max(zT(e,t,n),1),0);else{let[e,t]=BT[r/BT[i-1][2]<BT[i][2]/r?i-1:i];a=LT(e,t,0)}return RT(a,e,t,4*n+8)??[]}var HT=/^([1-9]\d*)(millisecond|second|minute|hour|day|week|month)$/,UT=[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`];function WT(e,t,n,r,i){let a=HT.exec(e);if(!a)return;let o=parseInt(a[1],10),s=a[2],c=LT(s,o,Math.max(0,UT.indexOf(t)));if(!((r-n)/(Math.min(o,c.cycle)*c.ms)>i))return RT(c,n,r,i)}function GT(e,t,n){let r=e<0?`-`:``,i=String(r?-e:e);return r+(i.length<n?t.repeat(n-i.length)+i:i)}function KT(e,t){let n=new Date(+e);return t.floor(n),n}function qT(e,t){let n=NT(t),r=KT(e,PT.year);return FT(KT(new Date(r-1),n),KT(e,n),kT)}function JT(e){let t=NT(4),n=e.getDay(),r=KT(n>=4||n===0?e:new Date(e-1),t);return n>=4||n===0||(t.offset(r,1),t.floor(r)),r}var YT=new Map([[`-`,``],[`_`,` `],[`0`,`0`]]);function XT(e,t){let n=``,r=0,i=e.length;for(let a=0;a<i;a++){if(e.charCodeAt(a)!==37)continue;n+=e.slice(r,a);let i=e.charAt(++a),o=YT.get(i);o===void 0?o=i===`e`?` `:`0`:i=e.charAt(++a),n+=ZT(i,t,o),r=a+1}return n+e.slice(r)}function ZT(e,t,n){switch(e){case`a`:return sw[t.getDay()].slice(0,3);case`A`:return sw[t.getDay()];case`b`:return ow[t.getMonth()].slice(0,3);case`B`:return ow[t.getMonth()];case`c`:return XT(`%x, %X`,t);case`d`:case`e`:return GT(t.getDate(),n,2);case`f`:return GT(t.getMilliseconds(),n,3)+`000`;case`g`:return GT(JT(t).getFullYear()%100,n,2);case`G`:return GT(JT(t).getFullYear()%1e4,n,4);case`H`:return GT(t.getHours(),n,2);case`I`:return GT(t.getHours()%12||12,n,2);case`j`:return GT(1+FT(KT(t,PT.year),KT(t,PT.day),OT),n,3);case`L`:return GT(t.getMilliseconds(),n,3);case`m`:return GT(t.getMonth()+1,n,2);case`M`:return GT(t.getMinutes(),n,2);case`p`:return t.getHours()>=12?`PM`:`AM`;case`q`:return String(1+Math.floor(t.getMonth()/3));case`Q`:return String(+t);case`s`:return String(Math.floor(t/1e3));case`S`:return GT(t.getSeconds(),n,2);case`u`:return String(t.getDay()||7);case`U`:return GT(qT(t,0),n,2);case`V`:{let e=JT(t),r=KT(e,PT.year);return GT(FT(KT(r,NT(4)),e,kT)+ +(r.getDay()===4),n,2)}case`w`:return String(t.getDay());case`W`:return GT(qT(t,1),n,2);case`x`:return XT(`%-m/%-d/%Y`,t);case`X`:return XT(`%-I:%M:%S %p`,t);case`y`:return GT(t.getFullYear()%100,n,2);case`Y`:return GT(t.getFullYear()%1e4,n,4);case`Z`:{let e=t.getTimezoneOffset(),n=Math.abs(e);return(e>0?`-`:`+`)+GT(Math.floor(n/60),`0`,2)+GT(n%60,`0`,2)}case`%`:return`%`;default:return e}}var QT=800,$T=240,eE=8,tE=/<br\s*\/?>/gi;function nE(e,t,n,r){let i=e.gantt?.[t];return typeof i==`number`&&Number.isFinite(i)?Math.min(r,Math.max(n,i)):void 0}function rE(e,t){let n=e.gantt?.[t];return typeof n==`string`?n:void 0}function iE(e,t){return e.gantt?.[t]===!0}function aE(e,t,n){let r=Q(e.replace(tE,` `),!1,t,n,4e3);return r.lines.length<=1?r:{...r,lines:[r.lines[0]],widths:[r.widths[0]],width:r.widths[0],height:r.lineHeight}}function oE(e){return Number.isFinite(+e.startTime)&&Number.isFinite(+e.endTime)}function sE(e,t,n){let r=e.filter(oE).sort((e,t)=>+e.startTime-t.startTime||e.order-t.order),i=[];for(let e of r){let r=+e.startTime,a=0;for(;a<i.length&&r<i[a];)a++;i[a]=+e.endTime,n.set(e,t+a)}let a=i.length;for(let r of e)n.has(r)||n.set(r,t+a++);return Math.max(a,1)}function cE(e,t,n){let r=n.fontSize??16,i=n.measurer??bc(n.fontFamily,n.fontFamilyMono),a=n.padding??8,o=nT(n.now),s=nE(t,`fontSize`,4,72)??Math.round(r*.8125),c=nE(t,`sectionFontSize`,4,72)??s,l=Math.round(r*.75),u=nE(t,`barHeight`,4,400)??Math.round(s*1.85),d=u+(nE(t,`barGap`,0,400)??Math.round(u/4)),f=Math.round(nE(t,`numberSectionStyles`,1,1e3)??4),p=e.displayMode===`compact`,m=e.topAxis||iE(t,`topAxis`),h=e.getTasks(o),g=h.filter(e=>!e.vert),_=h.filter(e=>e.vert&&oE(e)),v=new Map;for(let e of g)v.has(e.section)||v.set(e.section,v.size);let y=new Map,b=[];if(p){let e=new Map;for(let t of g){let n=e.get(t.section);n?n.push(t):e.set(t.section,[t])}for(let[t,n]of e){let e=sE(n,b.length,y);for(let n=0;n<e;n++)b.push(t)}}else for(let e of g)y.set(e,b.length),b.push(e.section);let x=b.length,S=1/0,C=-1/0;for(let e of h)oE(e)&&(S=Math.min(S,+e.startTime),C=Math.max(C,+e.endTime));let w=S<=C,T=Q(e.title,!1,i,r,4e3,1),E=T.height>0?T.height+16:0;if(!w){let t=Math.ceil(Math.max(T.width,1)+2*a),i=Math.ceil(Math.max(T.height,1)+2*a);return{svg:lm(`gantt`,t,i,r,n,e,Z(T,t/2,a+T.height/2,` class="pele-title" font-weight="var(--_tw)"`)),width:t,height:i,links:[]}}let D=new Map,O=0;for(let e of v.keys()){let t=Q(e,!1,i,c,180);D.set(e,t),O=Math.max(O,t.width)}let k=e.axisFormat||(e.dateFormat===`D`?`%d`:rE(t,`axisFormat`)??`%Y-%m-%d`),A=e=>XT(k,new Date(e)),j=Math.max(i.width(A(S),l,0),i.width(A(C),l,0)),M=a+(nE(t,`leftPadding`,0,2e3)??Math.max(O>0?O+24:0,j/2)),N=nE(t,`rightPadding`,0,2e3)??Math.max(16,j/2),P=wh(n,nE(t,`useWidth`,100,2e4)??QT,280),F=Math.max($T,P-M-N-a),I=M+F,L=C>S?F/(C-S):0,R=e=>L===0?M+F/2:M+(e-S)*L,z=Math.round(l*1.75),B=nE(t,`topPadding`,0,2e3),V=nE(t,`gridLineStartPadding`,0,2e3),H=a+E+(m?z:0),U=Math.max(H,B??0),ee=B!==void 0&&V!==void 0?Math.max(0,Math.min(B-V,U-H)):0,te=Math.max(x,1)*d,W=U+te,ne=[],G=I+N;for(let e of g){let t=aE(e.task,i,s),n=y.get(e);if(!oE(e)){let r=M+eE+t.width/2;G=Math.max(G,r+t.width/2),ne.push({task:e,label:t,row:n,x0:NaN,x1:NaN,labelX:r,inside:!1});continue}let r=R(+e.startTime),a=Math.max(R(+(e.renderEndTime??e.endTime)),r+(e.milestone?0:2));if(e.milestone){let t=r+(R(+e.endTime)-r)/2;r=t-u/2,a=t+u/2}let o=!e.milestone&&t.width+2*eE<=a-r,c=(r+a)/2;if(!o){let e=a+eE+t.width<=I+N,n=r-eE-t.width>=M;c=e||!n?a+eE+t.width/2:r-eE-t.width/2,G=Math.max(G,c+t.width/2)}ne.push({task:e,label:t,row:n,x0:r,x1:a,labelX:c,inside:o})}let re=e.tickInterval||rE(t,`tickInterval`)||``,K=e.weekday??rE(t,`weekday`)??`sunday`,ie=Math.max(2,Math.min(10,Math.floor(F/(j+24)))),q=WT(re,K,S,C,Math.ceil(F/3))??VT(S,C,ie),ae=``,oe=``,se=``,ce=-1/0,le=``,ue=W+z/2+2,de=U-ee-z/2-2;for(let e of q){let t=R(e);ae+=`M${X(t)},${X(U-ee)}V${X(W)}`;let n=A(e),r=i.width(n,l,0);if(t-r/2<ce+8||n===le)continue;ce=t+r/2,le=n,G=Math.max(G,ce);let a=`text-anchor="middle">${Ec(n)}</text>`;oe+=`<text x="${X(t)}" y="${X(ue+l*.35)}" ${a}`,m&&(se+=`<text x="${X(t)}" y="${X(de+l*.35)}" ${a}`)}let fe=``,pe=``,me=[],he=W+z+4,ge=Math.round(s*1.5);for(let e of[..._].sort((e,t)=>+e.startTime-t.startTime)){let t=R(+e.startTime),n=aE(e.task,i,s),r=Math.max(a+n.width/2,t),o=0;for(;o<me.length&&r-n.width/2<me[o]+8;)o++;me[o]=r+n.width/2,G=Math.max(G,me[o]),fe+=`<path class="pele-vert" data-id="${Y(e.id)}" d="M${X(t)},${X(U-ee)}V${X(W)}"/>`,pe+=Z(n,r,he+o*ge+ge/2,` class="pele-vert-label" data-id="${Y(e.id)}"`)}let _e=Math.ceil(Math.max(G,a+T.width)+a),ve=Math.ceil(W+z+(me.length>0?4+me.length*ge:0)+a),ye=``,be=``;for(let e=0;e<x;){let t=b[e],r=e+1;for(;r<x&&b[r]===t;)r++;let i=v.get(t)%f,o=U+e*d,s=(r-e)*d;(v.size>1||t!==``)&&(ye+=`<rect class="pele-section pele-section-${i}" x="0" y="${X(o)}" width="${_e}" height="${X(s)}" fill="${i%2==0?`var(--_s)`:`none`}"/>`);let c=D.get(t);be+=Z(c,a+8+c.width/2,o+s/2,` class="pele-section-label" data-id="${Y(t)}"`,n.icons),e=r}let xe=``;if((e.excludes.length>0||e.includes.length>0)&&+_w(new Date(S),6,`y`)>C){let t,n,r=()=>{if(!t||!n)return;let e=new Date(t);e.setHours(0,0,0,0);let r=new Date(n);r.setHours(23,59,59,999);let i=Math.max(M,R(+e)),a=Math.min(I,R(+r));a>i&&(xe+=`<rect x="${X(i)}" y="${X(U)}" width="${X(a-i)}" height="${X(te)}"/>`),t=n=void 0};for(let i=new Date(S);+i<=C;i=mw(i,1))e.isInvalidDate(i)?(t??=i,n=i):r();r()}let Se=[],Ce=``;for(let t of ne){let r=t.task,i=U+t.row*d+d/2,a=r.active?`active`:r.done?`done`:``,o=`pele-task`;a&&(o+=` pele-`+a),r.crit&&(o+=` pele-crit`),r.milestone&&(o+=` pele-milestone`),r.classes.includes(`clickable`)&&(o+=` pele-clickable`);let s=``,c=``;if(Number.isNaN(t.x0))o+=` pele-unscheduled`,c=` fill="var(--_m)"`;else{let e=r.crit?qp:`var(--_c)`,n=a===`done`?`fill="var(--_a)"`:a===`active`?`fill="${e}" fill-opacity="0.25"`:`fill="${e}"`,o=`stroke="${a===`done`&&!r.crit?`var(--_b)`:e}"`;if(r.milestone){let e=(t.x0+t.x1)/2,r=u/2;s=`<path d="M${X(e)},${X(i-r)}L${X(e+r)},${X(i)}L${X(e)},${X(i+r)}L${X(e-r)},${X(i)}Z" ${n} ${o} stroke-linejoin="round"/>`}else s=`<rect x="${X(t.x0)}" y="${X(i-u/2)}" width="${X(t.x1-t.x0)}" height="${X(u)}" ${n} ${o}${Up}/>`;t.inside?c=a===``?` fill="var(--_bg)"`:``:a===`done`&&(c=` fill="var(--_m)"`)}let l=s+Z(t.label,t.labelX,i,` class="pele-label"${c}`),f=e.links.get(r.id);f!==void 0&&(l=Iu(l,f,r.id,Se,n)),Ce+=`<g class="${o}" data-id="${Y(r.id)}">${l}</g>`}let we=``;if(e.todayMarker!==`off`&&o>=S&&o<=C&&C>S){let t=R(o),n=U-ee,r=e.todayMarker?nm(e.todayMarker.split(`,`)).line:``;we=`<g class="pele-today"><path d="M${X(t)},${X(n)}V${X(W)}" fill="none" stroke="var(--_c)" stroke-width="2"${r}/>`+(r?``:`<path d="M${X(t-4)},${X(n-5)}H${X(t+4)}L${X(t)},${X(n+1)}Z" fill="var(--_c)"/>`)+`</g>`}let Te=`M${X(M)},${X(W)}H${X(I)}`+(m?`M${X(M)},${X(U-ee)}H${X(I)}`:``);return{svg:lm(`gantt`,_e,ve,r,n,e,Z(T,_e/2,a+T.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(ye?`<g class="pele-sections">${ye}</g>`:``)+(xe?`<g class="pele-excluded" fill="var(--_a)">${xe}</g>`:``)+`<g class="pele-grid" fill="none"><path d="${ae}" stroke="var(--_b)" stroke-dasharray="1 3"/><path d="${Te}" stroke="var(--_b)"/></g>`+(fe?`<g class="pele-verts" fill="none" stroke="var(--_l)" stroke-width="1.5" stroke-dasharray="4 3">${fe}</g>`:``)+we+`<g class="pele-tasks" font-size="${X(s)}">${Ce}</g><g class="pele-section-labels" font-size="${X(c)}">${be}</g><g class="pele-axis" font-size="${l}" fill="var(--_m)">${oe}${se}</g>`+(pe?`<g class="pele-vert-labels" font-size="${X(s)}">${pe}</g>`:``)),width:_e,height:ve,links:Se}}var lE={type:`gantt`,parse(e,t,n){let r=new aT;n&&(r.title=n);let i=t.gantt?.displayMode;return typeof i==`string`&&(r.displayMode=i),wT(e,r),r},render:cE},uE={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4};function dE(e){throw new jo(e,`semantic`,{type:`gitGraph`})}function fE(e){return e===`REVERSE`?uE.REVERSE:e===`HIGHLIGHT`?uE.HIGHLIGHT:uE.NORMAL}function pE(e,t){e.dir&&t.setDirection(e.dir);for(let n of e.statements)mE(n,t)}function mE(e,t){switch(e.$type){case`Commit`:t.commit({id:e.id,msg:e.message??``,type:e.type===void 0?uE.NORMAL:fE(e.type),tags:e.tags??void 0});break;case`Branch`:t.branch({name:e.name,order:e.order??0});break;case`Merge`:t.merge({branch:e.branch,id:e.id??``,type:e.type===void 0?void 0:fE(e.type),tags:e.tags??void 0});break;case`Checkout`:t.checkout(e.branch);break;case`CherryPicking`:t.cherryPick({id:e.id,targetId:``,tags:e.tags?.length===0?void 0:e.tags,parent:e.parent})}}function hE(e,t,n){let r=t.gitGraph,i=typeof r?.mainBranchName==`string`?r.mainBranchName:`main`,a=typeof r?.mainBranchOrder==`number`?r.mainBranchOrder:0,o=new Map,s=new Map([[i,null]]),c=new Map([[i,a]]),l=[],u=null,d=i,f=`LR`,p=0,m=()=>{for(let e=p+1;;e+=2654435761){let t=`${p}-${(Math.imul(e,2654435761)>>>0).toString(16).padStart(8,`0`).slice(0,7)}`;if(!o.has(t))return t}},h=e=>{u=e,o.set(e.id,e),s.set(d,e.id)},g=e=>{s.has(e)||dE(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`),d=e;let t=s.get(e);u=t?o.get(t)??null:null};pE(e,{setDirection(e){f=e},commit({msg:e,id:t,type:n,tags:r}){let i={id:t||m(),message:e,seq:p++,type:n??uE.NORMAL,tags:r?[...r]:[],parents:u===null?[]:[u.id],branch:d};o.has(i.id)&&l.push(`Commit ID ${i.id} already exists`),h(i)},branch({name:e,order:t}){s.has(e)&&dE(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${e}")`),s.set(e,u===null?null:u.id),c.set(e,t),g(e)},merge({branch:e,id:t,type:n,tags:r}){let i=s.get(d),a=s.get(e),c=i?o.get(i):void 0,l=a?o.get(a):void 0;c&&l&&c.branch===e&&dE(`Cannot merge branch '${e}' into itself.`),d===e&&dE(`Incorrect usage of "merge". Cannot merge a branch to itself`),c===void 0&&dE(`Incorrect usage of "merge". Current branch (${d})has no commits`),s.has(e)||dE(`Incorrect usage of "merge". Branch to be merged (${e}) does not exist`),l===void 0&&dE(`Incorrect usage of "merge". Branch to be merged (${e}) has no commits`),c===l&&dE(`Incorrect usage of "merge". Both branches have same head`),t&&o.has(t)&&dE(`Incorrect usage of "merge". Commit with id:${t} already exists, use different custom id`),h({id:t||m(),message:`merged branch ${e} into ${d}`,seq:p++,parents:u===null?[]:[u.id,a||``],branch:d,type:uE.MERGE,customType:n,customId:!!t,tags:r?[...r]:[]})},cherryPick({id:e,targetId:t,tags:n,parent:r}){let i=e?o.get(e):void 0;if(i===void 0&&dE(`Incorrect usage of "cherryPick". Source commit id should exist and provided`),r&&!i.parents.includes(r)&&dE(`Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.`),i.type===uE.MERGE&&!r&&dE(`Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.`),t&&o.has(t))return;i.branch===d&&dE(`Incorrect usage of "cherryPick". Source commit is already on current branch`);let a=s.get(d);a&&o.has(a)||dE(`Incorrect usage of "cherry-pick". Current branch (${d})has no commits`),h({id:m(),message:`cherry-picked ${i.message} into ${d}`,seq:p++,parents:u===null?[]:[u.id,i.id],branch:d,type:uE.CHERRY_PICK,tags:n?n.filter(Boolean):[`cherry-pick:${i.id}${i.type===uE.MERGE?`|parent:${r}`:``}`]})},checkout:g});let _=[...c].map(([e,t],n)=>({name:e,order:t??parseFloat(`0.${n}`)})).sort((e,t)=>e.order-t.order).map(e=>e.name);return{type:`gitGraph`,title:e.title||n,accTitle:e.accTitle?e.accTitle.replace(/^\s+/g,``):void 0,accDescr:e.accDescr?e.accDescr.replace(/\n\s+/g,`
|
|
109
|
+
`):void 0,direction:f,commits:o,branches:s,lanes:_,currentBranch:d,head:u,warnings:l}}var gE={name:`REFERENCE`,pattern:/\w([-\./\w]*[-\w])?/y},_E=[gE];function vE(e){return{name:e,pattern:e,longer:_E}}var yE=[vE(`cherry-pick`),{name:`gitGraph:`,pattern:`gitGraph:`},vE(`HIGHLIGHT`),{...mg(`gitGraph`),longer:_E},vE(`checkout`),vE(`REVERSE`),{name:`parent:`,pattern:`parent:`},vE(`commit`),vE(`NORMAL`),vE(`branch`),{name:`order:`,pattern:`order:`},vE(`switch`),{name:`type:`,pattern:`type:`},vE(`merge`),{name:`msg:`,pattern:`msg:`},{name:`tag:`,pattern:`tag:`},{name:`id:`,pattern:`id:`},vE(`LR`),vE(`TB`),vE(`BT`),{name:`:`,pattern:`:`},{...ig,opener:/[\t ]*accDescr\s*{/y},ag,sg(String.raw`[-./\w]*[-\w]`),{name:`INT`,pattern:/0|[1-9][0-9]*(?!\.)/y},cg,lg,ug,dg,fg,pg,gE];function bE(e){let t=new wg(rg(e,yE,`gitGraph`),yE,`gitGraph`),n={$type:`GitGraph`,statements:[]},r=()=>{if(t.kind!==-1)for(t.kind!==26&&t.fail(`a line break or the end of input`);t.kind===26;)t.i++},i=()=>t.kind===31?t.take():t.kind===25?Cg(t.take()):t.fail(`a branch name`),a=()=>Cg(t.expect(25)),o=()=>(t.kind!==8&&t.kind!==5&&t.kind!==2&&t.fail(`NORMAL, REVERSE, or HIGHLIGHT`),t.take());for(;t.kind===26;)t.i++;if(!t.accept(1)){t.expect(3);let e=t.kinds[t.i+1];(t.kind===17||t.kind===18||t.kind===19)&&e===20?(n.$type=`Direction`,n.dir=t.take(),t.i++):t.accept(20)}for(;t.kind!==-1;)switch(t.kind){case 26:t.i++;break;case 21:n.accDescr=xg(t.take()),r();break;case 22:n.accTitle=bg(t.take()),r();break;case 23:n.title=yg(t.take()),r();break;case 7:{t.i++;let e={$type:`Commit`,tags:[]};for(;;)if(t.accept(16))e.id=a();else if(t.accept(15))e.tags.push(a());else if(t.accept(12))e.type=o();else if(t.accept(14)||t.kinds[t.i]===25)e.message=a();else break;r(),n.statements.push(e);break}case 9:{t.i++;let e={$type:`Branch`,name:i()};t.accept(10)&&(e.order=parseInt(t.expect(24))),r(),n.statements.push(e);break}case 13:{t.i++;let e={$type:`Merge`,branch:i(),tags:[]};for(;;)if(t.accept(16))e.id=a();else if(t.accept(15))e.tags.push(a());else if(t.accept(12))e.type=o();else break;r(),n.statements.push(e);break}case 4:case 11:{t.i++;let e={$type:`Checkout`,branch:i()};r(),n.statements.push(e);break}case 0:{t.i++;let e={$type:`CherryPicking`,tags:[]};for(;;)if(t.accept(16))e.id=a();else if(t.accept(15))e.tags.push(a());else if(t.accept(6))e.parent=a();else break;r(),n.statements.push(e);break}default:t.fail(`a statement, a title, or a line break`)}return n}var xE=/<(?!br\s*\/?>)/gi,SE=/:fa-/g,CE=/<br\s*\/?>|fl°°?\w+¶ß|&#?\w+;|[\ud800-\udbff][\udc00-\udfff]|[\s\S]/gi;function wE(e,t,n,r,i=0){let a=e;return a!==void 0&&(a.includes(`<`)&&(a=a.replace(xE,`<`)),a.includes(`:fa-`)&&(a=a.replace(SE,`:fa-`))),Q(a,!1,t,n,r,i)}function TE(e,t,n,r,i=0){let a=wE(e,t,n,r,i);if(e===void 0||a.width<=r)return a;let o=``,s=0;for(let a of e.match(CE)??[]){if(a.trim()===``||a.length>2&&a[0]===`<`)s=0;else{let e=t.width(a.length>2?`x`:a,n,i);s>0&&s+e>r&&(o+=`
|
|
110
|
+
`,s=0),s+=e}o+=a}return wE(o,t,n,r,i)}var EE=7,DE=44,OE=44,kE=36,AE=8,jE=20,ME=20,NE=7,PE=6,FE=Math.SQRT1_2,IE=[`normal`,`reverse`,`highlight`,`merge`,`cherry-pick`];function LE(e,t,n){let r=e.gitGraph?.[t];return typeof r==`boolean`?r:n}function RE(e){return NE+4+e.width+6}function zE(e,t,n,r){let i=`cx="${X(t)}" cy="${X(n)}"`;if(e===uE.HIGHLIGHT)return`<rect x="${X(t-EE-1)}" y="${X(n-EE-1)}" width="${2*EE+2}" height="${2*EE+2}" rx="2" fill="${r}"/>`;if(e===uE.MERGE)return`<circle ${i} r="${EE-1}" fill="var(--_bg)" stroke="${r}" stroke-width="2"/><circle ${i} r="2.5" fill="${r}"/>`;let a=`<circle ${i} r="${EE}" fill="${r}"/>`;return e===uE.REVERSE?a+`<path d="M${X(t-3)},${X(n-3)}l6,6M${X(t-3)},${X(n+3)}l6,-6" fill="none" stroke="var(--_bg)" stroke-width="1.5" stroke-linecap="round"/>`:e===uE.CHERRY_PICK?a+`<path d="M${X(t-2.6)},${X(n+1)}L${X(t+.8)},${X(n-4.2)}L${X(t+2.6)},${X(n+1)}" fill="none" stroke="var(--_bg)" stroke-linejoin="round"/><circle cx="${X(t-2.6)}" cy="${X(n+2.2)}" r="1.8" fill="var(--_bg)"/><circle cx="${X(t+2.6)}" cy="${X(n+2.2)}" r="1.8" fill="var(--_bg)"/>`:a}function BE(e,t,n){return e.direction===`LR`?Eh(n,r=>VE(e,t,n,r?`TB`:`LR`)):VE(e,t,n,e.direction)}function VE(e,t,n,r){let i=n.fontSize??16,a=Math.round(i*.75),o=n.measurer??bc(n.fontFamily,n.fontFamilyMono),s=n.padding??8,c=LE(t,`showBranches`,!0),l=LE(t,`showCommitLabel`,!0),u=LE(t,`rotateCommitLabel`,!0),d=LE(t,`parallelCommits`,!1),f=r!==`LR`,p=r===`BT`,m=new Map;e.lanes.forEach((e,t)=>m.set(e,t));let h=e.lanes.length,g=Math.round(i*.875),_=e.lanes.map(e=>wE(c?e:``,o,g,4e3)),v=[],y=new Map;for(let t of[...e.commits.values()].sort((e,t)=>e.seq-t.seq)){let e=l&&t.type!==uE.CHERRY_PICK&&(t.type!==uE.MERGE||t.customId===!0),n=[];for(let e of t.tags){let t=wE(e,o,a,4e3);t.lines.length>0&&n.push(t)}let r={commit:t,index:v.length,lane:m.get(t.branch)??0,m:0,label:e?wE(t.id,o,a,4e3):void 0,tags:n};v.push(r),y.set(t.id,r)}let b=new Float64Array(v.length),x=new Float64Array(v.length),S=new Float64Array(h).fill(EE),C=new Float64Array(h).fill(EE);v.forEach((e,t)=>{let{label:n,tags:r}=e,i=0,a=0;for(let e of r){let t=RE(e);f?(i=Math.max(i,e.height),a+=t+4):(i=Math.max(i,t),a+=e.height+3)}let o=0,s=0;n!==void 0&&n.lines.length>0&&(u?s=3+FE*(n.width+n.height):(o=f?n.height:n.width,s=6+(f?n.width:n.height))),b[t]=Math.max(EE,i/2,o/2),x[t]=i/2;let c=EE+(r.length>0?PE+a:0),l=EE+s,d=e.lane;S[d]=Math.max(S[d],f?l:c),C[d]=Math.max(C[d],f?c:l)});let w=new Float64Array(v.length);f||v.forEach((e,t)=>{if(x[t]!==0)for(let n of e.commit.parents){let r=y.get(n);r!==void 0&&r.lane<e.lane&&(w[t]=x[t]+4)}});let T=(e,t)=>Math.max(DE,b[e]+b[t]+AE,w[t]>0?b[e]+kE+w[t]:0);v.forEach((e,t)=>{if(!d){e.m=t===0?0:v[t-1].m+T(t-1,t);return}let n=0;for(let r of e.commit.parents){let e=y.get(r);e===void 0||e.index>=t||(n=Math.max(n,e.m+T(e.index,t)))}e.m=n});let E=0;for(let e of v)E=Math.max(E,e.m);let D=new Float64Array(h);for(let e=0;e<h;e++){let t=_[e],n=t.lines.length===0?0:f?t.width/2+8:t.height/2+2;S[e]=Math.max(S[e],n),C[e]=Math.max(C[e],n),e>0&&(D[e]=D[e-1]+Math.max(OE,C[e-1]+S[e]+AE))}let O=(e,t)=>f?t:e,k=(e,t)=>f?p?-e:e:t,A=(e,t)=>`${X(O(e,t))},${X(k(e,t))}`,j=1/0,M=1/0,N=-1/0,P=-1/0,F=(e,t,n,r)=>{e<j&&(j=e),t<M&&(M=t),n>N&&(N=n),r>P&&(P=r)},I=``;if(c)for(let t=0;t<h;t++){let n=_[t],r=om(t),i=D[t],a=n.width+16,o=n.height+4,s=n.lines.length===0?-jE:-jE-(f?o:a),c=O(s+(f?o:a)/2,i),l=k(s+(f?o:a)/2,i);F(O(-jE,i),k(-jE,i),O(-jE,i),k(-jE,i)),F(O(E+ME,i),k(E+ME,i),O(E+ME,i),k(E+ME,i)),I+=`<g class="pele-branch" data-id="${Y(e.lanes[t])}"><path class="pele-lane" d="M${A(-jE,i)}L${A(E+ME,i)}" stroke="${r}" stroke-dasharray="2 4"/>`,n.lines.length>0&&(F(c-a/2,l-o/2,c+a/2,l+o/2),I+=`<rect x="${X(c-a/2)}" y="${X(l-o/2)}" width="${X(a)}" height="${X(o)}" fill="${r}"${Up}/>`+Z(n,c,l,` class="pele-label"`+(kl(t)||` fill="var(--_bg)"`))),I+=`</g>`}let L=Array.from({length:h},()=>[]);for(let e of v)L[e.lane].push(e.m);if(d)for(let e of L)e.sort((e,t)=>e-t);let R=(e,t,n)=>{let r=L[e],i=0,a=r.length;for(;i<a;){let e=i+a>>1;r[e]<=t?i=e+1:a=e}return i<r.length&&r[i]<n},z=``,B=``;for(let e of v){let{commit:t}=e,n=D[e.lane],r=e.m;for(let i=0;i<t.parents.length;i++){let a=y.get(t.parents[i]);if(a===void 0||a===e)continue;let o=D[a.lane],s=a.m;if(a.lane===e.lane){B+=`<path class="pele-edge" d="M${A(s,o)}L${A(r,n)}" stroke="${om(e.lane)}"/>`;continue}let c=i>0&&t.type===uE.MERGE,l=i>0&&!c,u=`M${A(s,o)}`;if(r<=s){let e=(s+r)/2;u+=`C${A(e,o)} ${A(e,n)} ${A(r,n)}`}else if(!c&&!R(e.lane,s,r)){let e=Math.min(kE,r-s);u+=`C${A(s+e/2,o)} ${A(s+e/2,n)} ${A(s+e,n)}L${A(r,n)}`}else{let t=a.lane<e.lane&&r-w[e.index]>s?r-w[e.index]:r,i=Math.min(kE,t-s),l=o;(!c||R(a.lane,s,r))&&(l=o>n?n+C[e.lane]+AE/2:n-S[e.lane]-AE/2,i=Math.min(kE,(t-s)/2),u+=`C${A(s+i/2,o)} ${A(s+i/2,l)} ${A(s+i,l)}`),u+=`L${A(t-i,l)}C${A(t-i/2,l)} ${A(t-i/2,n)} ${A(t,n)}`,t<r&&(u+=`L${A(r,n)}`)}z+=`<path class="pele-edge${c?` pele-edge-merge`:l?` pele-edge-cherry-pick`:``}" d="${u}" stroke="${om(c?a.lane:e.lane)}"${l?` stroke-dasharray="4 3"`:``}/>`}}let V=``;for(let e of v){let{commit:t,label:n,tags:r}=e,i=O(e.m,D[e.lane]),a=k(e.m,D[e.lane]),o=t.customType??t.type;F(i-EE-1,a-EE-1,i+EE+1,a+EE+1);let s=t.type<uE.MERGE&&t.message!==``?`<title>${Y(t.message)}</title>`:``;if(s+=zE(o,i,a,om(e.lane)),n!==void 0&&n.lines.length>0){let e=n.width,t=n.height,r=(n,r)=>`<rect x="${X(n-e/2-2)}" y="${X(r-t/2+2)}" width="${X(e+4)}" height="${X(t-4)}" rx="3" fill="var(--_bg)"/>`;if(u){let o=FE*t/2,c=f?i-EE-3-o:i+3,l=f?a:a+EE+3+o,u=FE*e+o;F(c-u,p?l-u:l-o,c+o,p?l+o:l+u),s+=`<g class="pele-commit-label" transform="rotate(${p?45:-45} ${X(c)} ${X(l)})">`+r(c-e/2,l)+Z(n,c-e/2,l,``)+`</g>`}else{let o=f?i-EE-6-e/2:i,c=f?a:a+EE+6+t/2;F(o-e/2,c-t/2,o+e/2,c+t/2),s+=`<g class="pele-commit-label">${r(o,c)}${Z(n,o,c,``)}</g>`}}let c=EE+PE;for(let e=f?0:r.length-1;e>=0&&e<r.length;e+=f?1:-1){let t=r[e],n=RE(t),o=t.height,l=f?i+c:i-n/2,u=f?a:a-c-o/2;c+=f?n+4:o+3,F(l,u-o/2,l+n,u+o/2),s+=`<g class="pele-tag"><path d="M${X(l)},${X(u)}L${X(l+NE)},${X(u-o/2)}H${X(l+n)}V${X(u+o/2)}H${X(l+NE)}Z" fill="var(--_s)" stroke="var(--_b)" stroke-linejoin="round"/><circle cx="${X(l+NE)}" cy="${X(u)}" r="1.5" fill="var(--_b)"/>`+Z(t,l+NE+4+t.width/2,u,` fill="var(--_fg)"`)+`</g>`}let l=t.type===uE.MERGE&&o!==uE.MERGE?` pele-commit-merge`:``;V+=`<g class="pele-commit pele-commit-${IE[o]??IE[0]}${l}" data-id="${Y(t.id)}">${s}</g>`}j>N&&F(0,0,0,0);let H=Q(e.title,!1,o,i,4e3,1),U=H.height>0?H.height+16:0,ee=Math.max(N-j,H.width),te=Math.ceil(ee+2*s),W=Math.ceil(P-M+U+2*s),ne=s-j+(ee-(N-j))/2,G=s+U-M;return{svg:lm(`gitGraph`,te,W,i,n,e,Z(H,te/2,s+H.height/2,` class="pele-title" font-weight="var(--_tw)"`)+`<g transform="translate(${X(ne)},${X(G)})">`+(I?`<g class="pele-branches" fill="none" font-size="${g}">${I}</g>`:``)+(z||B?`<g class="pele-edges" fill="none" stroke-width="2" stroke-linecap="round">${z}${B}</g>`:``)+(V?`<g class="pele-commits" font-size="${a}" fill="var(--_m)">${V}</g>`:``)+`</g>`),width:te,height:W,links:[]}}var HE={type:`gitGraph`,parse:(e,t,n)=>hE(bE(e),t,n),render:BE};function UE(e,t){return{type:`info`,title:e.title||t,accTitle:e.accTitle?e.accTitle.replace(/^\s+/g,``):void 0,accDescr:e.accDescr?e.accDescr.replace(/\n\s+/g,`
|
|
111
|
+
`):void 0}}var WE=[mg(`showInfo`),mg(`info`),ig,ag,og,lg,ug,dg,fg,pg];function GE(e){let t=new wg(rg(e,WE,`info`),WE,`info`),n={$type:`Info`};for(;t.kind===5;)t.i++;for(t.expect(1);t.kind===5;)t.i++;if(t.accept(0))for(;t.kind===5;)t.i++;for(;t.kind!==-1;){let e=t.kind;if(e===2?n.accDescr=xg(t.take()):e===3?n.accTitle=bg(t.take()):e===4?n.title=yg(t.take()):t.fail(`a title or the end of input`),t.kind===-1)break;for(t.kind!==5&&t.fail(`a line break or the end of input`);t.kind===5;)t.i++}return n}var KE=`1.13.0`;function qE(e,t,n){let r=n.fontSize??16,i=n.measurer??bc(n.fontFamily,n.fontFamilyMono),a=n.padding??8,o=Q(e.title,!1,i,r,4e3,1),s=o.height>0?o.height+8:0,c=Q(`Pele v${KE}`,!1,i,r,4e3),l=Math.ceil(Math.max(o.width,c.width)+2*a),u=Math.ceil(s+c.height+2*a);return{svg:lm(`info`,l,u,r,n,e,Z(o,l/2,a+o.height/2,` class="pele-title" font-weight="var(--_tw)"`)+Z(c,l/2,a+s+c.height/2,` class="pele-version" fill="var(--_m)"`)),width:l,height:u,links:[]}}var JE={type:`info`,parse:(e,t,n)=>UE(GE(e),n),render:qE},YE=class{type=`ishikawa`;title;root;stack=[];baseLevel;addNode(e,t){let n={text:t,children:[]};if(!this.root){this.root=n,this.stack=[{level:0,node:n}];return}this.baseLevel??=e;let r=Math.max(e-this.baseLevel+1,1),i=this.stack;for(;i.length>1&&i[i.length-1].level>=r;)i.pop();i[i.length-1].node.children.push(n),i.push({level:r,node:n})}},XE=[`$end`,`EOF`,`SPACELINE`,`NL`,`ISHIKAWA`,`SPACELIST`,`TEXT`];function ZE(e,t){let n=0;for(;n<13;){let r=e.charCodeAt(t+n),i=`ishikawa-beta`.charCodeAt(n);if(r!==i&&(r+32!==i||r<65||r>90))break;n++}return n===13&&!Ls(e.charCodeAt(t+13))?13:n>=8&&!Ls(e.charCodeAt(t+8))?8:0}function QE(e){let t=[],n=[],r=[],i=e.length,a=0;for(;a<i;){let o=a,s=-1;for(;o<i&&J(e.charCodeAt(o));)e.charCodeAt(o)===10&&(s=o),o++;let c,l;if(e.charCodeAt(o)===37&&e.charCodeAt(o+1)===37)for(c=2,l=o+2;l<i;){let t=e.charCodeAt(l);if(t===10||t===13||t===8232||t===8233)break;l++}else if(o===a){let t=ZE(e,a);t>0?(c=4,l=a+t):(c=6,l=e.indexOf(`
|
|
112
|
+
`,a),l===-1&&(l=i))}else s>a?(c=2,l=s+1):s===a?(c=3,l=a+1):(c=5,l=o);t.push(c),n.push(a),r.push(l),a=l}return t.push(1,0),n.push(i,i),r.push(i,i),{types:t,starts:n,ends:r}}var $E=`'SPACELINE', 'NL', 'EOF'`;function eD(e,t){let{types:n,starts:r,ends:i}=QE(e),a=0,o=t=>{throw zo(`ishikawa`,e,r[a],`Expecting ${t}, got '${XE[n[a]]}'`)};if(n[a]===2){for(a++;n[a]===2||n[a]===3;)a++;n[a]!==4&&o(`'SPACELINE', 'NL', 'ISHIKAWA'`)}else n[a]!==4&&o(`'SPACELINE', 'ISHIKAWA'`);for(a++,n[a]===3&&a++;;){let s=n[a];if(s===6||s===5&&n[a+1]===6){let c=s===6?a:a+1;a=c+1,n[a]!==2&&n[a]!==3&&n[a]!==1&&o($E),t.addNode(s===6?0:i[c-1]-r[c-1],e.slice(r[c],i[c]).trim())}else s===2||s===5?(a++,n[a]!==2&&n[a]!==3&&n[a]!==1&&o(s===5?`${$E}, 'TEXT'`:$E)):o(`'SPACELINE', 'SPACELIST', 'TEXT'`);for(a++;n[a]===3||n[a]===1;)a++;if(n[a]===0)return}}var tD=.5,nD=Math.hypot(tD,1),rD=14,iD=6,aD=8,oD=22,sD=18,cD=5,lD=26,uD=34,dD=28,fD=10,pD=5;function mD(e,t,n,r,i){let a=Q(e.text,!1,n,r,180),o=Math.round(i*1.5),s=[],c=[],l=[],u=(e,n,r)=>{let i=e.length;for(let a=i-1;a>=0;a--)l.push({node:e[t?i-1-a:a],depth:n,parent:r,slot:a,bone:-1})};for(u(e.children,2,-1);l.length>0;){let e=l.pop();if(e.bone!==-1){c.push(e.bone);continue}let t=s.length;s.push({label:Q(e.node.text,!1,n,i,200),depth:e.depth,parent:e.parent,slot:e.slot,kids:e.node.children.length,rise:0,at:0,textEnd:0}),e.depth%2==0?c.push(t):(e.bone=t,l.push(e)),u(e.node.children,e.depth+1,t)}let d=rD;for(let e of c){let t=Math.max(s[e].label.height,o)+iD;s[e].rise=d+t/2,d+=t}let f=a.width+2*fD,p=f/2;for(let e of s){let t=e.parent===-1?void 0:s[e.parent];e.depth%2==0?(e.at=t?t.at:0,e.textEnd=e.at-(e.kids>0?(e.kids+1)*oD:sD)-cD):(e.at=t.at-(t.kids-e.slot)*oD,e.textEnd=e.at-cD),p=Math.max(p,e.label.width-e.textEnd)}return{node:e,label:a,boxW:f,boxH:a.height+2*pD,bones:s,rise:d+aD,reach:p}}function hD(e,t,n){return Eh(n,r=>gD(e,t,n,r))}function gD(e,t,n,r){let i=n.fontSize??16,a=Math.round(i*.875),o=n.measurer??bc(n.fontFamily,n.fontFamilyMono),s=n.padding??8;if(r)return _D(e,n);let c=e.root,l=Q(e.title,!1,o,i,4e3,1),u=l.height>0?l.height+12:0,d=``,f=0,p=0,m=0,h=0;if(c){let e=Q(c.text,!1,o,i,200,1),t=Math.max(e.height+24,48),n=e.width+24+t/2,r=c.children.map((e,t)=>mD(e,t%2==0,o,i,a));for(let e of r)e.rise=Math.max(e.rise,t/2+14);let s=[],l=-uD;for(let e=0;e<r.length;e+=2){if(e>0){let t=0;for(let n=0;n<2;n++){let i=r[e-2+n],a=r[e+n];i&&(t=Math.max(t,i.reach+(a?a.boxW/2:0)))}l-=t+lD}s.push(l,l)}let u=r.length>0?l-dD:-uD;p=n,f=u,m=-t/2,h=t/2;let g=``;r.forEach((e,t)=>{let n=t%2==0?-1:1,r=s[t],i=(e,t)=>r+e-t*tD,o=i(0,e.rise),c=n*e.rise,l=mp-1,u=`M${X(r-tD/nD*l)},${X(n*l/nD)}L${X(o)},${X(c)}`,d=``;for(let t of e.bones){let r=n*t.rise;if(t.depth%2==0)u+=`M${X(i(t.at,t.rise))},${X(r)}H${X(i(t.textEnd+cD,t.rise))}`;else{let a=e.bones[t.parent].rise;u+=`M${X(i(t.at,a))},${X(n*a)}L${X(i(t.at,t.rise))},${X(r)}`}let a=i(t.textEnd,t.rise);d+=Z(t.label,a-t.label.width/2,r,t.depth>2?` fill="var(--_m)"`:``),f=Math.min(f,a-t.label.width)}let _=c+n*(e.boxH/2);f=Math.min(f,o-e.boxW/2),p=Math.max(p,o+e.boxW/2),m=Math.min(m,_-e.boxH/2),h=Math.max(h,_+e.boxH/2),g+=`<g class="pele-ishikawa-category" data-id="${Y(e.node.text)}"><path class="pele-ishikawa-bones" d="${u}" fill="none" stroke="var(--_l)"/>`+xp(`arrow_point`,r,0,tD/nD,-n/nD,`var(--_l)`)+`<rect x="${X(o-e.boxW/2)}" y="${X(_-e.boxH/2)}" width="${X(e.boxW)}" height="${X(e.boxH)}" fill="var(--_s)" stroke="var(--_b)"${Up}/>`+Z(e.label,o,_,` class="pele-label"`)+(d?`<g class="pele-ishikawa-causes" font-size="${a}">${d}</g>`:``)+`</g>`});let _=t/2;d=`<path class="pele-ishikawa-spine" d="M${X(u)},0H${X(-(mp-1))}" fill="none" stroke="var(--_l)"/>`+xp(`arrow_point`,0,0,1,0,`var(--_l)`)+g+`<g class="pele-ishikawa-head" data-id="${Y(c.text)}"><path d="M0,${X(-_)}H${X(n-_)}A${X(_)},${X(_)} 0 0 1 ${X(n-_)},${X(_)}H0Z" fill="var(--_s)" stroke="var(--_b)" stroke-linejoin="round"/>`+Z(e,12+e.width/2,0,` class="pele-label" font-weight="var(--_hw)"`)+`</g>`}let g=Math.max(p-f,l.width),_=Math.ceil(g+2*s),v=Math.ceil(h-m+u+2*s),y=s+(g-(p-f))/2-f,b=s+u-m;return{svg:lm(`ishikawa`,_,v,i,n,{},Z(l,_/2,s+l.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(d?`<g transform="translate(${X(y)},${X(b)})">${d}</g>`:``)),width:_,height:v,links:[]}}function _D(e,t){let n=t.fontSize??16,r=Math.round(n*.875),i=t.measurer??bc(t.fontFamily,t.fontFamilyMono),a=t.padding??8,o=Math.max(140,(t.maxWidth??320)-2*a),s=Q(e.title,!1,i,n,Ch(t),1),c=[],l=e.root?[{node:e.root,depth:0,parent:-1}]:[],u=0;for(;l.length;){let e=l.pop(),t=c.length;c.push({...e,x:0,y:0,w:0,h:0}),u=Math.max(u,e.depth);for(let n=e.node.children.length-1;n>=0;n--)l.push({node:e.node.children[n],depth:e.depth+1,parent:t})}let d=Math.min(20,Math.max(2,(o-120)/Math.max(1,u))),f=a+(s.height?s.height+12:0),p=s.width,m=``,h=``;for(let e of c){e.x=a+e.depth*d;let t=Math.max(60,o-e.depth*d-20);e.label=Rv(Q(e.node.text,!1,i,e.depth<2?n:r,t,+(e.depth<2)),i,t),e.w=e.label.width+20,e.h=e.label.height+12,e.y=f,f+=e.h+12,p=Math.max(p,e.x-a+e.w);let s=e.depth<2;if(m+=`<g class="pele-node ${e.depth===0?`pele-ishikawa-head`:e.depth===1?`pele-ishikawa-category`:`pele-ishikawa-cause`}" data-id="${Y(e.node.text)}">`+(s?`<rect x="${X(e.x)}" y="${X(e.y)}" width="${X(e.w)}" height="${X(e.h)}" rx="${e.depth===0?12:4}" fill="var(--_s)" stroke="var(--_b)"/>`:``)+Z(e.label,e.x+e.w/2,e.y+e.h/2,` class="pele-label"${e.depth<2?` font-weight="var(--_hw)"`:``}${e.depth>1?` font-size="${r}"`:``}`)+`</g>`,e.parent>=0){let t=c[e.parent],n=t.x+d/2;h+=`<path class="pele-edge" d="M${X(n)},${X(t.y+t.h)}V${X(e.y+e.h/2)}H${X(e.x)}" fill="none" stroke="var(--_b)"/>`}}let g=Math.ceil(p+2*a),_=Math.ceil(Math.max(a+s.height,f-12)+a);return{svg:lm(`ishikawa`,g,_,n,t,{},Z(s,g/2,a+s.height/2,` class="pele-title" font-weight="var(--_tw)"`)+h+m),width:g,height:_,links:[]}}var vD={type:`ishikawa`,parse(e,t,n){let r=new YE;return r.title=n,eD(e,r),r},render:hD};function yD(e){let t=new Set;for(let n of e)for(let e of n.people)t.add(e);return[...t].sort()}var bD=class{type=`journey`;title;accTitle;accDescr;sections=[];tasks=[];currentSection=``;setDiagramTitle(e){this.title=e}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
113
|
+
`)}addSection(e){this.currentSection=e,this.sections.push(e)}addTask(e,t){let n=t.substring(1).split(`:`),r=n.length===1?[]:n[1].split(`,`).map(e=>e.trim());this.tasks.push({task:e,score:Number(n[0]),people:r,section:this.currentSection})}getActors(){return yD(this.tasks)}};function xD(e,t){let n=e.indexOf(`
|
|
114
|
+
`,t);return n===-1?e.length:n}function SD(e,t,n){for(let r=0;r<n.length;r++)if((e.charCodeAt(t+r)|32)!==n.charCodeAt(r))return!1;return!0}function CD(e,t){let n=e.length,r=t;for(;r<n;){let t=e.charCodeAt(r);if(t===37&&e.charCodeAt(r+1)!==123)r=xD(e,r);else{if(t===10)return r;if(J(t))do r++;while(r<n&&J(e.charCodeAt(r)));else if(t===35)r=xD(e,r);else return r}}return r}function wD(e,t){let n=t;for(;J(e.charCodeAt(n));)n++;return n}function TD(e,t,n,r){let i=SD(e,t,`accdescr`);if(!i&&!SD(e,t,`acctitle`))return t;let a=e.length,o=wD(e,t+8),s=e.charCodeAt(o),c=(t,r,i)=>{n.types.push(t),n.texts.push(e.slice(r,i)),n.starts.push(r)};if(s===58){o=wD(e,o+1);let n=xD(e,o);return c(i?r+2:r,t,o),c(i?r+3:r+1,o,n),n}if(!i||s!==123)return t;for(o=wD(e,o+1);e.charCodeAt(o)!==125;){let t=e.indexOf(`}`,o);if(t===-1&&(t=a),c(r+4,o,t),o===a)return a;o=t}return o+1}var ED=[`$end`,`EOF`,`INVALID`,`NEWLINE`,`journey`,`title`,`acc_title`,`acc_title_value`,`acc_descr`,`acc_descr_value`,`acc_descr_multiline_value`,`section`,`taskName`,`taskData`,`:`];function DD(e,t,n){let r=e.length,i=t;for(;i<r;i++){let t=e.charCodeAt(i);if(t===35||t===10||t===59||n&&t===58)break}return i}function OD(e){let t=e.length,n=[],r=[],i=[],a={types:n,texts:r,starts:i},o=0,s=(t,a)=>{n.push(t),r.push(e.slice(o,a)),i.push(o),o=a};for(;o=CD(e,o),!(o>=t);){let n=e.charCodeAt(o),r=o+1;if(n===10){for(;e.charCodeAt(r)===10;)r++;s(3,r)}else if(SD(e,o,`journey`)&&!Ls(e.charCodeAt(o+7)))s(4,o+7);else{if(SD(e,o,`title`)){for(r=o+5;e.charCodeAt(r)!==10&&J(e.charCodeAt(r));)r++;if(r===t||e.charCodeAt(r)===10){o=r;continue}let n=e.charCodeAt(o+5);if(n!==13&&J(n)&&(r=DD(e,o+6,!1),r>o+6)){s(5,r);continue}}r=TD(e,o,a,6),r===o?SD(e,o,`section`)&&J(e.charCodeAt(o+7))&&(r=DD(e,o+8,!0),r>o+8)?s(11,r):n===58?(r=DD(e,o+1,!1),s(r>o+1?13:14,r>o+1?r:o+1)):n===59?s(2,o+1):s(12,DD(e,o+1,!0)):o=r}}return(i.length===0||i[i.length-1]<t)&&s(1,t),s(0,t),a}var kD=`'EOF', 'SPACE', 'NEWLINE', 'title', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'section', 'taskName'`;function AD(e,t){let{types:n,texts:r,starts:i}=OD(e),a=(t,r)=>{let a=n[t]===0?`1`:ED[n[t]];throw zo(`journey`,e,i[t],`Expecting ${r}, got '${a}'`)};n[0]!==4&&a(0,`'journey'`);for(let e=1;;e++){let i=r[e];switch(n[e]){case 3:break;case 5:t.setDiagramTitle(i.substring(6));break;case 6:t.setAccTitle(r[++e].trim());break;case 8:t.setAccDescription(r[++e].trim());break;case 10:t.setAccDescription(i.trim());break;case 11:t.addSection(i.substring(8));break;case 12:n[++e]!==13&&a(e,`'taskData'`),t.addTask(i,r[e]);break;case 1:return;default:a(e,kD)}}}var jD=10,MD=8,ND=124,PD=200,FD=12,ID=6,LD=24,RD=26,zD=11,BD=5,VD=13,HD=20,UD=`<circle cx="-3.6" cy="-2.8" r="1.3"/><circle cx="3.6" cy="-2.8" r="1.3"/>`,WD={happy:`M-5,2A6,6 0 0 0 5,2`,neutral:`M-4.5,4.5H4.5`,sad:`M-5,6.5A6,6 0 0 1 5,6.5`};function GD(e,t,n){return`<g class="pele-face pele-face-${n}" transform="translate(${X(e)},${X(t)})"><circle r="${zD}" fill="var(--_bg)" stroke="var(--_l)"/><g fill="var(--_l)">${UD}</g><path d="${WD[n]}" fill="none" stroke="var(--_l)" stroke-linecap="round"/></g>`}function KD(e,t,n){return Eh(n,r=>qD(e,t,n,r))}function qD(e,t,n,r){let i=n.fontSize??16,a=Math.round(i*.875),o=Math.round(i*.75),s=n.measurer??bc(n.fontFamily,n.fontFamilyMono),c=n.padding??8;if(r)return JD(e,n);let l=e.tasks,u=l.length,d=yD(l).filter(e=>e!==``),f=new Map;d.forEach((e,t)=>f.set(e,t));let p=ND,m=l.map(e=>wE(e.task,s,a,p)),h=0;for(let e of m)h=Math.max(h,e.width);h>p&&(p=Math.min(Math.ceil(h),PD),m=l.map(e=>TE(e.task,s,a,p)));let g=p+2*jD,_=g+FD,v=u>0?u*_-FD:0,y=Math.round(a*1.5),b=Math.max(v,240),x=[],S=0,C=0,w=0;for(let e of d){let t=TE(e,s,a,b-2*BD-6),n=2*BD+6+t.width;w>0&&w+n>b&&(w=0,C+=4);let r=w>0?x[x.length-1].y:C,i=Math.max(t.height,y);x.push({name:e,label:t,x:w,y:r,h:i}),w+=n,S=Math.max(S,w),C=Math.max(C,r+i),w+=HD}let T=u>0?LD+v:0,E=TE(e.title,s,i,Math.max(T,320),1),D=E.height>0?E.height+16:0,O=Math.max(T,E.width,u>0?LD+S:0),k=c+(O-T)/2+LD,A=c+D,j=[],M=0;for(let e=0;e<u;){let t=e+1;for(;t<u&&l[t].section===l[e].section;)t++;let n;l[e].section!==``&&(n=TE(l[e].section,s,a,(t-e)*_-FD-2*jD,1),M=Math.max(M,Math.max(n.height,y)+2*ID)),j.push({start:e,count:t-e,label:n}),e=t}let N=y;for(let e of m)N=Math.max(N,e.height);let P=d.length>0?2*BD+6:0,F=N+P+2*MD,I=A+(M>0?M+ID:0),L=I+F+zD+16,R=L+4*RD,z=k+v,B=``,V=A;if(u>0){let e=``,t=``;for(let n=5;n>=1;n--){let r=L+(5-n)*RD;e+=`M${X(k-6)},${X(r)}H${X(z)}`,t+=`<text x="${X(k-12)}" y="${X(r+o*.35)}">${n}</text>`}B+=`<path class="pele-grid" d="${e}" fill="none" stroke="var(--_a)"/><g class="pele-scale" font-size="${o}" text-anchor="end" fill="var(--_m)">${t}</g>`;let n=``,r=``,i=``,s=[];l.forEach((e,t)=>{let o=k+t*_,c=o+g/2,l=e.score,u=L+(5-(Number.isNaN(l)?3:Math.min(5,Math.max(1,l))))*RD;n+=`${t===0?`M`:`L`}${X(c)},${X(u)}`,r+=`M${X(c)},${X(I+F)}V${X(u-zD)}`,i+=GD(c,u,l>3?`happy`:l<3?`sad`:`neutral`);let d=``,p=e.people.filter(e=>e!==``),h=Math.min(VD,(g-2*jD-2*BD)/Math.max(p.length-1,1));p.forEach((e,t)=>{d+=`<circle class="pele-actor" cx="${X(c+(t-(p.length-1)/2)*h)}" cy="${X(I+F-MD-BD)}" r="${BD}" fill="${om(f.get(e)??0)}" stroke="var(--_s)"><title>${Y(e)}</title></circle>`}),s.push(`<g class="pele-node pele-task" data-id="${Y(e.task.trim())}"><rect x="${X(o)}" y="${X(I)}" width="${X(g)}" height="${X(F)}" fill="var(--_s)" stroke="var(--_b)"${Up}/>`+Z(m[t],c,I+MD+N/2,` font-size="${a}"`)+d+`</g>`)}),B+=`<path class="pele-stems" d="${r}" fill="none" stroke="var(--_b)" stroke-dasharray="2 3"/>`+(u>1?`<path class="pele-edge" d="${n}" fill="none" stroke="var(--_l)" stroke-linejoin="round"/>`:``)+i;for(let e of j){let t=s.slice(e.start,e.start+e.count).join(``);if(!e.label){B+=t;continue}let n=k+e.start*_,r=e.count*_-FD;B+=`<g class="pele-cluster pele-section" data-id="${Y(l[e.start].section.trim())}"><rect x="${X(n)}" y="${X(A)}" width="${X(r)}" height="${X(M)}" fill="var(--_a)"${Up}/>`+Z(e.label,n+r/2,A+M/2,` font-size="${a}" font-weight="var(--_hw)"`)+t+`</g>`}if(V=R+zD,x.length>0){let e=k+(v-S)/2,t=V+16,n=``;for(let r of x){let i=t+r.y+r.h/2;n+=`<g class="pele-legend-item" data-id="${Y(r.name)}"><circle cx="${X(e+r.x+BD)}" cy="${X(i)}" r="${BD}" fill="${om(f.get(r.name)??0)}"/>`+Z(r.label,e+r.x+2*BD+6+r.label.width/2,i,``)+`</g>`}B+=`<g class="pele-legend" font-size="${a}">${n}</g>`,V=t+C}}let H=Math.ceil(O+2*c),U=Math.ceil(Math.max(V,c)+c);return{svg:lm(`journey`,H,U,i,n,e,Z(E,c+O/2,c+E.height/2,` class="pele-title" font-weight="var(--_tw)"`)+B),width:H,height:U,links:[]}}function JD(e,t){let n=t.fontSize??16,r=Math.round(n*.875),i=t.measurer??bc(t.fontFamily,t.fontFamilyMono),a=t.padding??8,o=Math.max(140,(t.maxWidth??320)-2*a),s=TE(e.title,i,n,o,1),c=yD(e.tasks).filter(e=>e!==``),l=new Map(c.map((e,t)=>[e,t])),u=a+(s.height?s.height+16:0),d,f=``,p=s.width;e.tasks.forEach((t,s)=>{if(t.section!==d){d=t.section;let e=TE(d,i,n,o-16,1);e.height&&(f+=Z(e,a+8+e.width/2,u+e.height/2,` class="pele-cluster-label" font-weight="var(--_hw)"`),p=Math.max(p,e.width+16),u+=e.height+8)}let c=TE(t.task,i,r,o-72),m=t.people.filter(e=>e!==``).map(e=>({name:e,label:TE(e,i,r,o-44)})),h=Math.max(c.height,42),g=2*MD+h;for(let e of m)g+=Math.max(16,e.label.height)+4;let _=Math.max(o,c.width+72);f+=`<g class="pele-node pele-journey-step" data-id="${s}"><rect x="${X(a)}" y="${X(u)}" width="${X(_)}" height="${X(g)}" fill="var(--_s)" stroke="var(--_b)"${Up}/>`,f+=Z(c,a+jD+c.width/2,u+MD+c.height/2,` class="pele-label"`);let v=a+_-28;f+=GD(v,u+MD+zD,t.score>3?`happy`:t.score<3?`sad`:`neutral`),Number.isNaN(t.score)||(f+=`<text class="pele-journey-score" x="${X(v)}" y="${X(u+MD+2*zD+r)}" font-size="${r}" text-anchor="middle">${X(Math.min(5,Math.max(1,t.score)))}</text>`);let y=u+MD+h+4;for(let e of m){let t=Math.max(16,e.label.height);f+=`<circle class="pele-actor" cx="${X(a+16)}" cy="${X(y+t/2)}" r="${BD}" fill="${om(l.get(e.name))}"/>`+Z(e.label,a+28+e.label.width/2,y+t/2,` class="pele-journey-actor" font-size="${r}"`),y+=t+4}f+=`</g>`,u+=g,s+1<e.tasks.length&&(f+=`<path class="pele-edge" d="M${X(a+_/2)},${X(u)}v16" fill="none" stroke="var(--_l)"/>`),u+=16,p=Math.max(p,_)});let m=Math.ceil(p+2*a),h=Math.ceil(Math.max(a+s.height,u-(e.tasks.length?16:0))+a);return{svg:lm(`journey`,m,h,n,t,e,Z(s,m/2,a+s.height/2,` class="pele-title" font-weight="var(--_tw)"`)+f),width:m,height:h,links:[]}}var YD={type:`journey`,parse(e,t,n){let r=new bD;return r.title=n,AD(e,r),r},render:KD},XD=[`1`,`INVALID`,`SPACELINE`,`NL`,`EOF`,``,`SPACELIST`,`ICON`,`CLASS`,`NODE_DSTART`,`NODE_ID`,`NODE_DESCR`,`NODE_DEND`,`SHAPE_DATA`];function ZD(e,t){return e===5?t?`KANBAN`:`MINDMAP`:XD[e]}var QD={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6};function $D(e,t){switch(e){case`[`:return QD.RECT;case`(`:return t===`)`?QD.ROUNDED_RECT:QD.CLOUD;case`((`:return QD.CIRCLE;case`)`:return QD.CLOUD;case`))`:return QD.BANG;case`{{`:return QD.HEXAGON;default:return QD.DEFAULT}}var eO=/\s+/y,tO=/.+/y,nO=/[^([\n){}]+/y,rO=/[^([\n){}@]+/y,iO=/[^)\](}]+/y,aO=/[^`"]+/y,oO=/[^}^"]+/y,sO=/\n\s*/g;function cO(e,t,n){for(let r=0;r<n.length;r++)if((e.charCodeAt(t+r)|32)!==n.charCodeAt(r))return!1;return!0}function lO(e,t){let n=e.length,r=[],i=[],a=[],o=t?`kanban`:`mindmap`,s=t?rO:nO,c=0,l=0,u=-1,d=(e,t,n)=>{r.push(e),i.push(t),a.push(l),l=n},f=(t,n,r)=>{d(t,e.slice(l,n),n),c=r},p=(t,n)=>(t.lastIndex=n,t.test(e)?t.lastIndex:-1),m=t=>{let r=e.indexOf(t,l);return r===-1?n:r};for(;l<n;){let n=e.charCodeAt(l),r=e.charCodeAt(l+1),i;if(c===0){let a=n<=32||n>=160?Math.max(p(eO,l),l):l;if(t&&n===64&&r===123)d(13,``,l+2),c=6;else if(e.charCodeAt(a)===37&&e.charCodeAt(a+1)===37)f(2,p(tO,a),0);else if(a>l)u<l&&(u=m(`
|
|
115
|
+
`)),u>=a?f(6,a,0):(i=e.lastIndexOf(`
|
|
116
|
+
`,a-1))>l?f(2,i+1,0):f(3,l+1,0);else if(cO(e,l,o)&&!Ls(e.charCodeAt(l+o.length)))f(5,l+o.length,0);else if(n===58&&r===58&&e.charCodeAt(l+2)===58)l+=3,c=1;else if(n===58&&r===58&&cO(e,l+2,`icon`)&&e.charCodeAt(l+6)===40)l+=7,c=2;else if(n===45&&r===41||n===40&&(r===45||r===40)||(n===41||n===123)&&r===n)f(9,l+2,3);else if(n===41||n===40||n===91)f(9,l+1,3);else if((i=p(s,l))!==-1)f(10,i,0);else break}else if(c===3)n===34?(c=r===96?5:4,l+=r===96?2:1):n===41||n===40?f(12,r===n||n===40&&r===45?l+2:l+1,0):n===93?f(12,l+1,0):n===125&&r===125||n===45&&r===41?f(12,l+2,0):f(11,p(n===125?tO:iO,l),3);else if(c===4)n===34?(l++,c=3):f(11,m(`"`),4);else if(c===5){if(n===96&&r===34)l+=2,c=3;else if((i=p(aO,l))!==-1)f(11,i,5);else break}else if(c===1){if((i=p(tO,l))!==-1)f(8,i,0);else if(n===10)l++,c=0;else break}else if(c===2)n===41?(l++,c=0):f(7,m(`)`),2);else if(c===6){if(n===34)f(13,l+1,7);else if(n===125)l++,c=0;else if((i=p(oO,l))!==-1)f(13,i,6);else break}else n===34?f(13,l+1,6):(i=m(`"`),d(13,e.slice(l,i).replace(sO,`<br/>`),i))}return l<n?d(1,``,l):(c===0&&d(4,``,n),d(0,``,n)),{types:r,texts:i,starts:a}}var uO=`'SPACELINE', 'NL', 'EOF'`,dO=new Uint8Array(14);for(let e of[2,6,7,8,9,10])dO[e]=1;function fO(e){return e===2||e===3||e===4}function pO(e,t,n){let r=n?`kanban`:`mindmap`,{types:i,texts:a,starts:o}=lO(e,n),s=n?`, 'SHAPE_DATA'`:``,c=0,l=t=>{let a=i[c];throw a===1?zo(r,e,o[c],``,!0):zo(r,e,o[c],`Expecting ${t}, got '${ZD(a,n)}'`)},u=`'${ZD(5,n)}'`;if(i[c]===2){for(c++;i[c]===2||i[c]===3;)c++;i[c]!==5&&l(`'SPACELINE', 'NL', ${u}`)}else i[c]!==5&&l(`'SPACELINE', ${u}`);c++;let d=`'SPACELINE', 'NL', 'SPACELIST', 'ICON', 'CLASS', 'NODE_DSTART', 'NODE_ID'`;for(i[c]===3&&(c++,d=`'SPACELINE', 'SPACELIST', 'ICON', 'CLASS', 'NODE_DSTART', 'NODE_ID'`);;){let e=i[c],n=0,r=e===6;if(r&&(n=a[c++].length,e=i[c]),e===10||e===9){let r,o,u=0;if(e===10&&(r=a[c++]),i[c]===9){let e=a[c++];i[c]!==11&&l(`'NODE_DESCR'`),o=a[c++],i[c]!==12&&l(`'NODE_DEND'`);let n=a[c++];!fO(i[c])&&i[c]!==13&&l(uO+s),u=t.getType(e,n)}else!fO(i[c])&&i[c]!==13&&l(uO+`, 'NODE_DSTART'`+s),o=r;if(i[c]===13){let e=a[c++];for(;i[c]===13;)e+=a[c++];fO(i[c])||l(uO+s),t.addNode(n,r??o,o,u,e)}else t.addNode(n,r??o,o,u)}else if(e===7||e===8){let n=a[c++];fO(i[c])||l(uO),t.decorateNode(e===7?{icon:n}:{class:n})}else r?fO(e)||l(uO+`, 'ICON', 'CLASS', 'NODE_DSTART', 'NODE_ID'`):e===2?fO(i[++c])||l(uO):l(d);for(c++;i[c]===3||i[c]===4;)c++;if(i[c]===0)return;dO[i[c]]===0&&l(uO+`, 'SPACELIST', 'ICON', 'CLASS', 'NODE_DSTART', 'NODE_ID'`)}}var mO=class{type=`kanban`;title;sections=[];getType=$D;last;sectionLevel=0;misplaced;addNode(e,t,n,r,i){let a={id:t,level:e,label:n};if(i!==void 0){let e=i.includes(`
|
|
117
|
+
`)?i+`
|
|
118
|
+
`:`{
|
|
119
|
+
`+i+`
|
|
120
|
+
}`,t;try{t=js(e)}catch(e){throw new jo(`Metadata of "${a.id}" is not valid YAML. ${e.message}`,`syntax`,{type:`kanban`})}if(typeof t==`object`&&t&&!Array.isArray(t)){let e=t.shape?String(t.shape):``;if(e!==e.toLowerCase()||e.includes(`_`))throw new jo(`No such shape: ${e}. Shape names should be lowercase.`,`semantic`,{type:`kanban`});t.label&&(a.label=String(t.label)),t.icon&&(a.icon=String(t.icon)),t.assigned&&(a.assigned=String(t.assigned)),t.ticket&&(a.ticket=String(t.ticket)),t.priority&&(a.priority=String(t.priority))}}if(this.misplaced)throw new jo(`Items without section detected, found section ("${this.misplaced.label}")`,`semantic`,{type:`kanban`});let o=this.sections;if(o.length===0&&(this.sectionLevel=e),this.last=a,e===this.sectionLevel){let e=a;e.items=[],o.push(e)}else o[o.length-1].items.push(a),e<this.sectionLevel&&(this.misplaced=a)}decorateNode(e){let t=this.last;!e||!t||(e.icon&&(t.icon=e.icon),e.class&&(t.cssClasses=e.class))}};function hO(e,t){pO(e,t,!0)}function gO(e,t,n,r,i){return`<svg class="pele-icon" data-icon="${Y(e)}" x="${X(t)}" y="${X(n)}" width="${X(r)}" height="${X(r)}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${i?.(e)??``}</svg>`}var _O=12,vO=8,yO=10,bO=8,xO=4,SO=6,CO=new Map([[`very high`,`stroke="${qp}"`],[`high`,`stroke="${qp}" opacity="0.5"`],[`low`,`stroke="var(--_m)" opacity="0.5"`],[`very low`,`stroke="var(--_m)"`]]);function wO(e,t,n,r,i,a=0){let o=Q(e,t,n,r,i,a);if(o.width<=i)return o;let s=[],c=[],l=0,u=[],d=0,f=()=>{s.push(u),c.push(d),l=Math.max(l,d),u=[],d=0};for(let e=0;e<o.lines.length;e++)if(o.widths[e]<=i)u=o.lines[e],d=o.widths[e],f();else{for(let t of o.lines[e]){if(t.icon!==void 0||t.math){d>0&&d+t.width>i&&f(),u.push(t),d+=t.width;continue}let e=``,a=d;for(let o of t.text){let s=n.width(o,r,t.style);d>0&&d+s>i&&(e&&u.push({text:e,style:t.style,width:d-a}),f(),e=``,a=0),e+=o,d+=s}e&&u.push({text:e,style:t.style,width:d-a})}f()}let p={...o,lines:s,widths:c,width:l,height:s.length*o.lineHeight};return o.heights?vh(p):p}function TO(e,t,n,r,i,a=!1){let o=``;for(let s=0;s<e.lines.length;s++){let c=e.lines[s],l=n+bh(e,s);if(c.length===1&&c[0].icon===void 0&&c[0].math===void 0&&!(c[0].style&56))o+=`<text${Uc(r,c[0].style)} x="${X(t)}" y="${X(l+e.size*.35)}"${a?` text-anchor="end"`:``}>${Ec(c[0].text)}</text>`;else{let n=e.widths[s];o+=Z(xh(e,s),t+(a?-n:n)/2,l,r,i)}}return o}var EO=e=>!!e&&es(e)!==``;function DO(e,t,n){let r=n.fontSize??16,i=Math.round(r*.875),a=Math.round(r*1.5),o=Math.round(i*1.5),s=n.measurer??bc(n.fontFamily,n.fontFamilyMono),c=n.padding??8,l=n.icons,u=t.kanban??{},d=u.sectionWidth,f=i*1.25,p=0,m=(e,t,n)=>{if(e&&e.includes(`$$`))for(let r of Q(e,!0,s,t,1/0).lines)for(let e of r)e.math&&(p=Math.max(p,e.math.width+n))};for(let t of e.sections){let e=s.width(String(t.items.length),i,0);m(t.label,r,2*vO+8+e+12+(EO(t.icon)?f+SO:0));for(let e of t.items){let t=2*(vO+yO);m(e.label,i,t+(EO(e.icon)?f+SO:0)),m(e.ticket,i,t),m(e.assigned,i,t)}}let h=Math.max(typeof d==`number`&&d>0?Math.min(Math.max(d,80),2e3):200,Math.ceil(p)),g=n.maxWidth!==void 0&&n.maxWidth>0?n.maxWidth-2*c:1/0,_=e.sections.length,v=_*(h+_O)-_O<=g,y=v?Math.max(_,1):Math.max(1,Math.floor((g+_O)/(h+_O))),b=v?h:Math.max(Math.min(h,g),Math.min(Math.floor((g+_O)/y)-_O,h*2),Math.ceil(p)),x=typeof u.ticketBaseUrl==`string`?u.ticketBaseUrl:``,S=b-2*vO,C=S-2*yO,w=[],T=e.sections,E=[],D=[],O=[],k=a,A=[];for(let e of T){let t=s.width(String(e.items.length),i,0),n=t+12+(EO(e.icon)?f+SO:0),a=wO(e.label,!0,s,r,S-8-n,1);k=Math.max(k,a.height),D.push(t),E.push(a);let c=[],l=0;for(let t of e.items){let e=wO(t.label,!0,s,i,C-(EO(t.icon)?f+SO:0)),n=wO(t.ticket,!1,s,i,C),r=wO(t.assigned,!1,s,i,C),a=n.width+r.width+8>C?n.height+r.height:Math.max(n.height,r.height),u=2*yO+Math.max(e.height,o)+(a?xO+a:0);c.push({item:t,label:e,ticket:n,assigned:r,meta:a,height:u}),l+=u+bO}O.push(c),A.push(l)}k+=2*vO;let j=[],M=[];for(let e=0,t=0;e<T.length;e+=y){let n=bO;for(let t=e;t<Math.min(e+y,T.length);t++)n=Math.max(n,A[t]);M.push(t),j.push(k+n),t+=k+n+_O}let N=j.length>0?M[M.length-1]+j[j.length-1]:0,P=g_(e.title,s,r,Ch(n)),F=P.height>0?P.height+16:0,I=Math.max(Math.min(T.length,y)*(b+_O)-_O,0),L=Math.max(I,P.width),R=c+(L-I)/2,z=b-vO-4,B=``;for(let e=0;e<T.length;e++){let t=T[e],r=Math.floor(e/y),s=`<rect width="${b}" height="${X(j[r])}" fill="var(--_s)"${Up}/>`+TO(E[e],vO+4,vO,` class="pele-cluster-label" font-weight="var(--_hw)"`,l)+`<text class="pele-count" x="${z}" y="${X(vO+a/2+i*.35)}" text-anchor="end" font-size="${i}" fill="var(--_m)">${t.items.length}</text>`;EO(t.icon)&&(s+=gO(t.icon,z-D[e]-SO-f,vO+(a-f)/2,f,l));let u=k;for(let t of O[e]){let e=t.item,r=(e.priority??``).trim().toLowerCase(),a=CO.get(r),c=`<rect width="${S}" height="${X(t.height)}" fill="var(--_bg)" stroke="var(--_b)"${Up}/>`;a!==void 0&&(c+=`<path class="pele-priority" d="M2.5,5V${X(t.height-5)}" fill="none" ${a} stroke-width="3" stroke-linecap="round"/>`),c+=TO(t.label,yO,yO,` class="pele-label"`,l),EO(e.icon)&&(c+=gO(e.icon,S-yO-f,yO+(o-f)/2,f,l));let d=t.height-yO;if(e.ticket){let r=d-t.meta,i=x?Mu(Tu(x.replace(`#TICKET#`,()=>e.ticket)),n):void 0;i===void 0?c+=TO(t.ticket,yO,r,` class="pele-ticket" fill="var(--_m)"`,l):(c+=`<a href="${Ec(i)}" target="_blank"${Lu(n)}>`+TO(t.ticket,yO,r,` class="pele-ticket" fill="var(--_c)"`,l)+`</a>`,w.push({id:e.id,href:i,internal:!1}))}e.assigned&&(c+=TO(t.assigned,S-yO,d-t.assigned.height,` class="pele-assigned" fill="var(--_m)"`,l,!0)),s+=`<g class="pele-node pele-card${a===void 0?``:` pele-priority-`+r.replace(` `,`-`)}${im(e.cssClasses??``)}" data-id="${Y(e.id)}" transform="translate(${vO},${X(u)})" font-size="${i}">${c}</g>`,u+=t.height+bO}B+=`<g class="pele-cluster pele-column${im(t.cssClasses??``)}" data-id="${Y(t.id)}" transform="translate(${X(R+e%y*(b+_O))},${X(c+F+M[r])})">${s}</g>`}let V=Math.ceil(L+2*c),H=Math.ceil(N+F+2*c);return{svg:lm(`kanban`,V,H,r,n,{},Z(P,V/2,c+P.height/2,` class="pele-title" font-weight="var(--_tw)"`)+B),width:V,height:H,links:w}}var OO={type:`kanban`,math:!0,parse(e,t,n){let r=new mO;return r.title=n,hO(e,r),r},render:DO},kO=11,AO=class{type=`mindmap`;title;nodes=[];getType=$D;baseLevel=0;open=[];addNode(e,t,n,r){let i=this.nodes.length===0;i&&(this.baseLevel=e),e-=this.baseLevel;let a=this.open,o=a.length;for(;o>0&&a[o-1].level>=e;)o--;let s=a[o-1];if(!s&&!i)throw new jo(`There can be only one root. No parent could be found for ("${n}")`,`semantic`,{type:`mindmap`});let c={id:this.nodes.length,nodeId:t,level:e,descr:n,type:r,children:[],isRoot:i};s&&(c.section=s.isRoot?s.children.length%kO:s.section,s.children.push(c)),a.length=o,a.push(c),this.nodes.push(c)}decorateNode(e){let t=this.nodes[this.nodes.length-1];!e||!t||(e.icon&&(t.icon=e.icon),e.class&&(t.class=e.class))}};function jO(e,t){pO(e,t,!1)}var MO=[``,`rounded`,`rect`,`circle`,`cloud`,`bang`,`hex`],NO=`stadium`,PO=36,FO=8,IO=18,LO=52,RO=28,zO=6,BO=12,VO=.22,HO=6,UO=28,WO=12,GO=8,KO=10;function qO(e,t,n,r){if(e.lines.length<2)return Z(e,t+e.width/2,n,` class="pele-label"`,r);let i=``,a=n-e.height/2;for(let n=0;n<e.lines.length;n++)i+=Z(xh(e,n),t+e.widths[n]/2,a+bh(e,n),` class="pele-label"`,r);return i}function JO(e,t,n){return Eh(n,r=>YO(e,t,n,r))}function YO(e,t,n,r){let i=n.fontSize??16,a=n.measurer??bc(n.fontFamily,n.fontFamilyMono),o=n.padding??8,s=n.icons,c=t.mindmap?.maxNodeWidth,l=typeof c==`number`&&c>0?Math.min(c,2e3):200,u=i*1.25,d=e.nodes,f=d.length,p=new Int32Array(f),m=new Int32Array(f);for(let e=0;e<f;e++)for(let t of d[e].children)p[t.id]=e,m[t.id]=m[e]+1;let h=r&&n.maxWidth!==void 0&&n.maxWidth>0?n.maxWidth-2*o:1/0,g=Array(f),_=Array(f),v=new Float64Array(f),y=new Float64Array(f),b=new Float64Array(f),x=new Float64Array(f),S=new Uint8Array(f);for(let e=0;e<f;e++){let t=d[e];S[e]=+(t.icon!==void 0&&es(t.icon)!==``);let n=Math.min(l,Math.max(72,h-m[e]*UO-2*zO-(S[e]?u+HO:0))),o=g[e]=Q(t.descr,!0,a,i,n),s=o.width+(S[e]?u+(o.width>0?HO:0):0),c=Math.max(o.height,Math.round(i*1.5)),f=MO[t.type]||(e===0?NO:``);if(r&&e===0&&f!==`rect`&&f!==`rounded`&&(f=NO),_[e]=f,f===``){let n=t.children.length>0;v[e]=s+2*(n?BO:zO),y[e]=c+(n?6:0),x[e]=y[e]/2}else{let t=jm(f,s,c);v[e]=t.w,y[e]=t.h,b[e]=t.dy,x[e]=t.h/2}}let C=new Float64Array(f),w=new Float64Array(f),T=new Float64Array(f),E=new Float64Array(f),D=0,O=(e,t,n,r)=>{let i=0,a=0;for(let o=t;o<n;o++){let t=e[o].id;w[t]=i,a=e[o].children.length>0||o+1<n&&e[o+1].children.length>0?Math.max(r,IO):r,i+=C[t]+a}D=i-a;let o=e[t].id,s=e[n-1].id;return(w[o]+T[o]+x[o]+w[s]+T[s]+x[s])/2};for(let e=f-1;e>0;e--){let t=d[e].children;if(t.length===0){C[e]=y[e];continue}let n=O(t,0,t.length,FO)-x[e],r=Math.min(0,n);C[e]=Math.max(D,n+y[e])-r,T[e]=n-r,E[e]=-r}let k=new Float64Array(f),A=new Float64Array(f),j=new Float64Array(f),M=new Int8Array(f),N=new Float64Array(f);if(r){let e=0;for(let t=0;t<f;t++)t>0&&p[t]===0&&(e+=KO),k[t]=m[t]*UO+v[t]/2,A[t]=e,e+=y[t]+KO}else if(f>0){let e=d[0].children,t=e.length,n=0;for(let t of e)n+=C[t.id];let r=t,i=1/0,a=0;for(let o=1;o<t;o++){a+=C[e[o-1].id];let s=Math.abs(2*a-n+(2*o-t)*RO);s<i&&(i=s,r=o)}for(let n=0,i=r,a=1;n<t;n=i,i=t,a=-1){let t=O(e,n,i,RO);for(let r=n;r<i;r++){let n=e[r].id;j[n]=w[n]-t,M[n]=a}}A[0]=-y[0]/2;for(let e=0;e<f;e++){e>0&&(A[e]=j[e]+T[e]);for(let t of d[e].children){let n=t.id;e>0&&(M[n]=M[e],j[n]=j[e]+E[e]+w[n]),k[n]=k[e]+M[n]*(v[e]/2+(e>0?PO:LO)+v[n]/2)}}}let P=0,F=0,I=0,L=0,R=``,z=``,B=``,V=``,H=e=>{B!==``&&(R+=`<g class="pele-branch pele-section-${e??0}"><g class="pele-edges" fill="none" stroke="${V}" stroke-width="1.5">${z}</g>${B}</g>`,z=B=``)};for(let e=1;e<=f;e++){let t=e%f,n=d[t],i=_[t],a=g[t],o=k[t],c=A[t];if(P=Math.min(P,o-v[t]/2),F=Math.max(F,o+v[t]/2),I=Math.min(I,c),L=Math.max(L,c+y[t]),(t===0||p[t]===0)&&H(d[e-1].section),t>0&&r){p[t]===0&&(V=om(n.section??0));let e=p[t],r=e===0?Math.min(Math.max(WO,y[0]/2),UO-GO):WO,a=k[e]-v[e]/2+Math.min(r,v[e]/2),s=N[e]||A[e]+y[e],l=o-v[t]/2+(i?Nm(i,v[t],y[t],3):0),u=c+x[t],d=Math.max(0,Math.min(GO,l-a,u-s));N[e]=u-d,z+=`<path class="pele-edge" d="M${X(a)},${X(s)}V${X(u-d)}Q${X(a)},${X(u)} ${X(a+d)},${X(u)}H${X(l)}"/>`}else if(t>0){p[t]===0&&(V=om(n.section??0));let e=p[t],r=M[t],a=r>0?1:3,s=k[e]+r*(v[e]/2-(_[e]?Nm(_[e],v[e],y[e],a):0)),l=A[e]+x[e],u=o-r*v[t]/2+(i?r*Nm(i,v[t],y[t],4-a):0),d=c+x[t],f=X((s+u)/2);z+=`<path class="pele-edge" d="M${X(s)},${X(l)}C${f},${X(l)} ${f},${X(d)} ${X(u)},${X(d)}"/>`}let l=!i&&n.children.length>0,m=` fill="${V}" fill-opacity="${VO}" stroke="${V}"`,h=``;i?h=t>0?Mm(i,v[t],y[t],m,` stroke="${V}"`):Mm(i,v[t],y[t],` fill="var(--_s)" stroke="var(--_b)"`,` stroke="var(--_b)"`):l&&(h=`<rect x="${X(-v[t]/2)}" y="${X(-y[t]/2)}" width="${X(v[t])}" height="${X(y[t])}" rx="${X(y[t]/2)}"${m}/>`);let C=0;n.icon&&S[t]&&(C=(u+(a.width>0?HO:0))/2,h+=gO(n.icon,-C-a.width/2,b[t]-u/2,u,s));let w=`<g class="pele-node pele-shape-${i||(l?`branch`:`text`)}${t>0?``:` pele-root`}${im(n.class??``)}" data-id="${Y(n.nodeId)}" transform="translate(${X(o)},${X(c+y[t]/2)})">`+h+(r&&!i?qO(a,C-a.width/2,b[t],s):Z(a,C,b[t],` class="pele-label"`,s))+`</g>`;t>0?B+=w:R+=w}let U=g_(e.title,a,i,Ch(n)),ee=U.height>0?U.height+16:0,te=Math.max(F-P,U.width),W=Math.ceil(te+2*o),ne=Math.ceil(L-I+ee+2*o);return{svg:lm(`mindmap`,W,ne,i,n,{},Z(U,W/2,o+U.height/2,` class="pele-title" font-weight="var(--_tw)"`)+`<g transform="translate(${X(o-P+(te-F+P)/2)},${X(o+ee-I)})">${R}</g>`),width:W,height:ne,links:[]}}var XO={type:`mindmap`,math:!0,parse(e,t,n){let r=new AO;return r.title=n,jO(e,r),r},render:JO},ZO=1e4;function QO(e,t,n,r,i){let a=e.packet?.[t];return typeof a==`number`&&a>=r?Math.min(a,i):n}function $O(e){return new jo(e,`semantic`,{type:`packet`})}function ek(e,t,n){let r=Math.floor(QO(t,`bitsPerRow`,32,1,4096)),i=[],a=-1,o=[],s=1;for(let t of e.blocks){let{start:e,end:n,bits:c}=t;if(e!==void 0&&n!==void 0&&n<e)throw $O(`Packet block ${e} - ${n} is invalid. End must be greater than start.`);if(e??=a+1,e!==a+1)throw $O(`Packet block ${e} - ${n??e} is not contiguous. It should start from ${a+1}.`);if(c===0)throw $O(`Packet block ${e} is invalid. Cannot have a zero bit field.`);for(n??=e+(c??1)-1,c??=n-e+1,a=n;o.length<=r+1&&i.length<ZO;){let a=s*r-1;if(n<=a){o.push({start:e,end:n,bits:c,label:t.label}),n===a&&(i.push(o),o=[],s++);break}o.push({start:e,end:a,bits:a-e,label:t.label}),i.push(o),o=[],s++,e=a+1,c=n-e}}return o.length>0&&i.push(o),{type:`packet`,title:e.title||n,accTitle:e.accTitle?e.accTitle.replace(/^\s+/g,``):void 0,accDescr:e.accDescr?e.accDescr.replace(/\n\s+/g,`
|
|
121
|
+
`):void 0,bitsPerRow:r,rows:i}}var tk=[{name:`packet-beta`,pattern:`packet-beta`},mg(`packet`),{name:`-`,pattern:`-`,longer:[dg]},{name:`+`,pattern:`+`},{name:`:`,pattern:`:`},ig,ag,og,{name:`INT`,pattern:/0|[1-9][0-9]*(?!\.)/y},cg,lg,ug,dg,fg,pg];function nk(e){let t=new wg(rg(e,tk,`packet`),tk,`packet`),n={$type:`Packet`,blocks:[]},r=()=>{if(t.kind!==-1)for(t.kind!==10&&t.fail(`a line break or the end of input`);t.kind===10;)t.i++};for(;t.kind===10;)t.i++;for(t.accept(0)||t.expect(1);t.kind!==-1;)switch(t.kind){case 10:t.i++;break;case 5:n.accDescr=xg(t.take()),r();break;case 6:n.accTitle=bg(t.take()),r();break;case 7:n.title=yg(t.take()),r();break;case 8:case 3:{let e={$type:`PacketBlock`,label:``};t.accept(3)?e.bits=Number(t.expect(8)):(e.start=Number(t.take()),t.accept(2)&&(e.end=Number(t.expect(8)))),t.expect(4),e.label=Cg(t.expect(9)),n.blocks.push(e),r();break}default:t.fail(`a field, a title, or a line break`)}return n}function rk(e,t,n,r,i,a=0){if(e===``||t<=0)return;let o=i.width(e,n,a);if(o<=t)return{text:e,size:n,width:o};let s=Math.max(r,Math.floor(n*t/o));for(;s>=r;){if(o=i.width(e,s,a),o<=t)return{text:e,size:s,width:o};s--}let c=Array.from(e),l=0,u=c.length-1;for(;l<u;){let e=l+u+1>>1;i.width(c.slice(0,e).join(``).trimEnd()+`…`,r,a)<=t?l=e:u=e-1}if(l===0)return;let d=c.slice(0,l).join(``).trimEnd()+`…`;return o=i.width(d,r,a),o<=t?{text:d,size:r,width:o}:void 0}function ik(e,t,n){return Eh(n,r=>ak(e,t,n,r))}function ak(e,t,n,r){let i=n.fontSize??16,a=Math.round(i*.875),o=Math.round(i*.625),s=n.measurer??bc(n.fontFamily,n.fontFamilyMono),c=n.padding??8,l=t.packet??{},u=QO(t,`rowHeight`,32,1,400),d=QO(t,`bitWidth`,32,1,400),f=QO(t,`paddingX`,5,0,400),p=QO(t,`paddingY`,5,0,400),m=l.showBits!==!1,h=l.bitOrder===`descending`,g=e.bitsPerRow,_=e.rows;if(r){let t=Math.max(1,Math.floor(((n.maxWidth??320)-2*c)/Math.min(d,18)));g=Math.min(g,Math.max(8,2**Math.floor(Math.log2(t))));let r=e.rows[e.rows.length-1],i=r?.[r.length-1]?.end??0;Math.ceil((i+1)/g)>1e4&&(g=e.bitsPerRow),d=Math.min(d,Math.max(18,((n.maxWidth??320)-2*c)/g));let a=e=>e.bits===e.end-e.start,o=[];for(let t of e.rows)for(let n of t){let t=o[o.length-1];t&&a(t)&&a(n)&&t.label===n.label&&n.start===t.end+1&&n.start%e.bitsPerRow===0?(t.end=n.end,t.bits=t.end-t.start):o.push({...n})}_=[];for(let e of o)for(let t=e.start;t<=e.end;){let n=Math.min(e.end,(Math.floor(t/g)+1)*g-1),r=Math.floor(t/g);(_[r]??(_[r]=[])).push({...e,start:t,end:n}),t=n+1}}let v=new Map;if(r)for(let e of _)for(let t of e){let e=Math.max(1,(t.end-t.start+1)*d-Math.min(f,d-1)-6),n=Lv(Xo(t.label).trim(),s,a,e);v.set(t,n)}let y=m?o+4:0,b=_.map(e=>{let t=u;if(r)for(let n of e)t=Math.max(t,v.get(n).height+10);return t}),x=[],S=0;for(let e of b)x.push(S),S+=y+e+p;_.length&&(S-=p);let C=Math.min(f,d-1),w=_.length>0?g*d-C:0,T=Q(e.title,!1,s,i,r?Ch(n):4e3,1),E=T.height>0?T.height+(S>0?12:0):0,D=new Map,O=(e,t)=>{let n=D.get(e);return n||D.set(e,n=new Map),n.has(t)||n.set(t,rk(Xo(e).trim(),t,a,Math.round(i*.5),s)),n.get(t)},k=c+Math.max(0,(T.width-w)/2),A=``,j=``;_.forEach((e,t)=>{let n=c+x[t]+y,i=b[t];for(let t of e){let e=t.end-t.start+1,o=t.start%g,s=k+(h?g-o-e:o)*d,c=e*d-C,l=r?void 0:O(t.label,c-6);if(A+=`<g class="pele-node" data-id="${t.start}-${t.end}"><rect x="${X(s)}" y="${X(n)}" width="${X(c)}" height="${X(i)}" fill="var(--_s)" stroke="var(--_b)"${Up}/>`+(r?Z(v.get(t),s+c/2,n+i/2,``):l&&l.size<=i?`<text x="${X(s+c/2)}" y="${X(n+i/2+l.size*.35)}"${l.size===a?``:` font-size="${X(l.size)}"`}>${Ec(l.text)}</text>`:``)+`</g>`,!m)continue;let u=h?t.end:t.start,f=h?t.start:t.end;j+=e===1?`<text x="${X(s+c/2)}" y="${X(n-4)}" text-anchor="middle">${u}</text>`:`<text x="${X(s)}" y="${X(n-4)}">${u}</text><text x="${X(s+c)}" y="${X(n-4)}" text-anchor="end">${f}</text>`}});let M=Math.ceil(Math.max(w,T.width)+2*c),N=Math.ceil(S+E+2*c);return{svg:lm(`packet`,M,N,i,n,e,(A?`<g class="pele-packet-fields" font-size="${a}" text-anchor="middle">${A}</g>`:``)+(j?`<g class="pele-packet-bits" font-size="${o}" fill="var(--_m)">${j}</g>`:``)+Z(T,M/2,N-c-T.height/2,` class="pele-title" font-weight="var(--_tw)"`)),width:M,height:N,links:[]}}var ok={type:`packet`,parse:(e,t,n)=>ek(nk(e),t,n),render:ik};function sk(e,t){let n=new Map;for(let{label:t,value:r}of e.sections){if(r<0)throw new jo(`"${t}" has invalid value: ${r}. Negative values are not allowed in pie charts. All slice values must be >= 0.`,`semantic`,{type:`pie`});n.has(t)||n.set(t,r)}return{type:`pie`,title:e.title||t,accTitle:e.accTitle?e.accTitle.replace(/^\s+/g,``):void 0,accDescr:e.accDescr?e.accDescr.replace(/\n\s+/g,`
|
|
122
|
+
`):void 0,showData:e.showData,sections:n}}function ck(e,t){let n=t;for(let t=e.charCodeAt(n);t>=48&&t<=57;t=e.charCodeAt(n))n++;return n}function lk(){let e=0,t=0,n=-1;return(r,i)=>{let a=r.charCodeAt(i)===45?i+1:i;if((a<e||a>=t)&&(e=a,t=ck(r,a),n=-1,t>a&&r.charCodeAt(t)===46)){let e=ck(r,t+1),i=e-t-1;i>0&&r.charCodeAt(e)!==46?n=e:i>1&&(n=e-1)}return t===a?-1:n>=0?n:r.charCodeAt(a)===48?r.charCodeAt(a+1)===46?-1:a+1:r.charCodeAt(t)===46?t-1>a?t-1:-1:t}}var uk=[mg(`showData`),mg(`pie`),{name:`:`,pattern:`:`},{name:`NUMBER_PIE`,pattern:/(?:-?[0-9]+\.[0-9]+(?!\.))|(?:-?(0|[1-9][0-9]*)(?!\.))/y,scanner:lk,first:`-0123456789`},ig,ag,og,cg,lg,ug,dg,fg,pg];function dk(e){let t=new wg(rg(e,uk,`pie`),uk,`pie`),n={$type:`Pie`,showData:!1,sections:[]},r=()=>{if(t.kind!==-1)for(t.kind!==8&&t.fail(`a line break or the end of input`);t.kind===8;)t.i++};for(;t.kind===8;)t.i++;for(t.expect(1),n.showData=t.accept(0);t.kind!==-1;)switch(t.kind){case 8:t.i++;break;case 4:n.accDescr=xg(t.take()),r();break;case 5:n.accTitle=bg(t.take()),r();break;case 6:n.title=yg(t.take()),r();break;case 7:{let e=Cg(t.take());t.expect(2);let i=Number(t.expect(3));n.sections.push({$type:`PieSection`,label:e,value:i}),r();break}default:t.fail(`a section, a title, or a line break`)}return n}var fk=120,pk=12,mk=26,hk=32,gk=28;function _k(e,t){return e.pie?.[t]}function vk(e,t){return`${X(Math.sin(e)*t)},${X(-Math.cos(e)*t)}`}function yk(e,t,n,r){if(t-e>=Math.PI*2-1e-9){let e=(e,t)=>`M0,${X(-e)}A${X(e)},${X(e)} 0 1 ${t} 0,${X(e)}A${X(e)},${X(e)} 0 1 ${t} 0,${X(-e)}Z`;return e(n,1)+(r>0?e(r,0):``)}let i=+(t-e>Math.PI);return r<=0?`M0,0L${vk(e,n)}A${X(n)},${X(n)} 0 ${i} 1 ${vk(t,n)}Z`:`M${vk(e,n)}A${X(n)},${X(n)} 0 ${i} 1 ${vk(t,n)}L${vk(t,r)}A${X(r)},${X(r)} 0 ${i} 0 ${vk(e,r)}Z`}function bk(e,t,n){return Sh(n,fk*2,140,(r,i)=>xk(e,t,n,r/2,i))}function xk(e,t,n,r,i){let a=n.fontSize??16,o=Math.round(a*.875),s=n.measurer??bc(n.fontFamily,n.fontFamilyMono),c=n.padding??8,l=_k(t,`textPosition`),u=typeof l==`number`&&l>=0&&l<=1?l:.75,d=_k(t,`donutHole`),f=typeof d==`number`&&d>0&&d<=.9?d*r:0,p=String(_k(t,`legendPosition`)??`right`),m=i&&(p===`left`||p===`right`)?`bottom`:p,h=[...e.sections],g=0;for(let[,e]of h)g+=e;let _=h.map(([t,n])=>Q(e.showData?`${t} [${n}]`:t,!1,s,o,4e3)),v=0;for(let e of _)v=Math.max(v,e.width);v+=_.length>0?pk+8:0;let y=_.length*mk,b=Q(e.title,!1,s,a,Ch(n),1),x=b.height>0?b.height+16:0,S=h.map(([,e])=>{let t=g>0?e/g:0;return t*100>=1&&(t*100).toFixed(0)!==`0`?t:0}),C=S.map(e=>e===0||e>=.5?!1:2*r*u*Math.sin(e*Math.PI)<s.width((e*100).toFixed(0)+`%`,o,0)+6),w=C.includes(!0)?gk:0,T=m===`left`||m===`right`||m===`center`?m:``,E=m===`top`||m===`bottom`,D=(r+w)*2,O=D,k=D;T===`left`||T===`right`?(O+=v>0?hk+v:0,k=Math.max(k,y)):E&&(O=Math.max(O,v),k+=y>0?20+y:0),O=Math.max(O,b.width);let A=c+(T===`left`?v+hk+D/2:T===`right`?D/2:O/2),j=c+x,M=j+(m===`top`?y+20+D/2:E?D/2:k/2),N=``,P=``,F=``,I=0,L=r+gk/2,R=[],z=(e,t,n)=>R.every(r=>Math.abs(e-r.x)>=(n+r.width)/2+2||Math.abs(t-r.y)>=o+2);h.forEach(([e],t)=>{let n=S[t];if(n===0)return;let i=I+n*Math.PI*2;N+=`<path class="pele-slice" data-id="${Y(e)}" d="${yk(I,i,r,f)}" fill="${om(t)}"/>`;let a=(I+i)/2,c=(n*100).toFixed(0)+`%`;if(C[t]){let e=s.width(c,o,0),t=a;for(let n=0;n<360&&!z(Math.sin(t)*L,-Math.cos(t)*L,e);n++)t+=2/L;let n=Math.sin(t)*L,r=-Math.cos(t)*L;R.push({x:n,y:r,width:e}),F+=`<text x="${X(n)}" y="${X(r+o*.35)}">${c}</text>`}else{let e=r*u;P+=`<text x="${X(Math.sin(a)*e)}" y="${X(-Math.cos(a)*e+o*.35)}"${kl(t)}>${c}</text>`}I=i}),N===``&&(N=`<circle class="pele-slice" r="${r}" fill="none" stroke="var(--_b)"/>`);let B=``,V,H;T===`right`?(V=A+D/2+hk,H=j+(k-y)/2):T===`left`?(V=c,H=j+(k-y)/2):T===`center`?(V=A-v/2,H=M-y/2):(V=c+(O-v)/2,H=m===`top`?j:j+D+20),_.forEach((e,t)=>{let n=H+t*mk+mk/2;B+=`<g class="pele-legend-item" data-id="${Y(h[t][0])}"><rect x="${X(V)}" y="${X(n-pk/2)}" width="${pk}" height="${pk}" rx="2" fill="${om(t)}"/>`+Z(e,V+pk+8+e.width/2,n,``)+`</g>`});let U=Math.ceil(O+2*c),ee=Math.ceil(k+x+2*c);return{svg:lm(`pie`,U,ee,a,n,e,Z(b,U/2,c+b.height/2,` class="pele-title" font-weight="var(--_tw)"`)+`<g class="pele-slices" transform="translate(${X(A)},${X(M)})" stroke="var(--_bg)" stroke-width="1" stroke-linejoin="round">${N}</g>`+(P?`<g class="pele-slice-labels" transform="translate(${X(A)},${X(M)})" font-size="${o}" text-anchor="middle" fill="var(--_bg)">${P}</g>`:``)+(F?`<g class="pele-slice-labels" transform="translate(${X(A)},${X(M)})" font-size="${o}" text-anchor="middle">${F}</g>`:``)+(B?`<g class="pele-legend" font-size="${o}">${B}</g>`:``)),width:U,height:ee,links:[]}}var Sk={type:`pie`,parse:(e,t,n)=>sk(dk(e),n),render:bk},Ck=/^\d+$/,wk=/^#?([\dA-Fa-f]{6}|[\dA-Fa-f]{3})$/,Tk=/^\d+px$/;function Ek(e,t,n){return new jo(`value for ${e} ${t} is invalid, please use a valid ${n}`,`semantic`,{type:`quadrantChart`})}function Dk(e){let t=e.trim(),n=t.indexOf(`:`);if(n===-1)return[t,`undefined`];let r=t.slice(n+1).trimStart(),i=r.indexOf(`:`);return[t.slice(0,n).trimEnd(),i===-1?r:r.slice(0,i).trimEnd()]}function Ok(e){let t={};for(let n of e){let[e,r]=Dk(n);if(e===`radius`){if(!Ck.test(r))throw Ek(e,r,`number`);t.radius=parseInt(r)}else if(e===`color`){if(!wk.test(r))throw Ek(e,r,`hex code`);t.color=r}else if(e===`stroke-color`){if(!wk.test(r))throw Ek(e,r,`hex code`);t.strokeColor=r}else if(e===`stroke-width`){if(!Tk.test(r))throw Ek(e,r,`number of pixels (eg. 10px)`);t.strokeWidth=r}else throw new jo(`style named ${e} is not supported.`,`semantic`,{type:`quadrantChart`})}return t}function kk(e){return{text:e.text.trim(),type:e.type}}var Ak=class{type=`quadrantChart`;title;accTitle;accDescr;quadrants=[void 0,void 0,void 0,void 0];xAxisLeft;xAxisRight;yAxisBottom;yAxisTop;points=[];classes=new Map;setQuadrant1Text(e){this.quadrants[0]=kk(e)}setQuadrant2Text(e){this.quadrants[1]=kk(e)}setQuadrant3Text(e){this.quadrants[2]=kk(e)}setQuadrant4Text(e){this.quadrants[3]=kk(e)}setXAxisLeftText(e){this.xAxisLeft=kk(e)}setXAxisRightText(e){this.xAxisRight=kk(e)}setYAxisBottomText(e){this.yAxisBottom=kk(e)}setYAxisTopText(e){this.yAxisTop=kk(e)}addPoint(e,t,n,r,i){this.points.push({x:Number(n),y:Number(r),text:kk(e),className:t,...Ok(i)})}addClass(e,t){this.classes.set(e,Ok(t))}setDiagramTitle(e){this.title=e}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
123
|
+
`)}};function jk(e,t,n){for(let r=0;r<n.length;r++){let i=e.charCodeAt(t+r),a=n.charCodeAt(r);if(i!==a&&!(a>=97&&a<=122&&i===a-32))return!1}return!0}var Mk=`$end.INVALID.NEWLINE.title.title_value.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.X-AXIS.Y-AXIS.AXIS-TEXT-DELIMITER.QUADRANT_1.QUADRANT_2.QUADRANT_3.QUADRANT_4.CLASSDEF.MD_STR.STR.class_name.point_start.point_x.point_y.QUADRANT.ALPHA.UNICODE_TEXT.COLON.PLUS.COMMA.EQUALS.MULT.BRKT.UNDERSCORE.DOT.AMP.MINUS.NUM.SPACE.SEMI.PUNCTUATION.EOF`.split(`.`),Nk=[41,4,6,8,9,19],Pk=new Uint8Array(128);for(let[e,t]of[[`:`,27],[`+`,28],[`,`,29],[`=`,30],[`*`,31],[`#`,32],[`_`,33],[`.`,34],[`&`,35],[`-`,36],[` \v\f`,38],[`;`,39],["!$%'`?\\/",40]])for(let n=0;n<e.length;n++)Pk[e.charCodeAt(n)]=t;function Fk(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=(t,a,o)=>{n.push(t),r.push(e.slice(a,o)),i.push(a),s=o},_=e=>{a.push(o),o=e},v=()=>{a.length>0&&(o=a.pop())},y=n=>{let r=e.indexOf(`
|
|
124
|
+
`,n);return r===-1?t:r},b=t=>{for(;e.charCodeAt(t)===32;)t++;return t},x=n=>{for(;n<t&&J(e.charCodeAt(n));)n++;return n},S=n=>{let r=e.charCodeAt(n);if(r===49)return n+1;if(r!==48)return-1;let i=n+1;if(i<t&&!Ns(e.charCodeAt(i))&&Ps(e.charCodeAt(i+1)))for(i+=2;Ps(e.charCodeAt(i));)i++;return i};e:for(;s<t;){let n=e.charCodeAt(s),r=e.charCodeAt(s+1);switch(o){case 0:break;case 1:case 2:case 3:g(Nk[o],s,y(s)),v();continue;case 4:if(n===125)s++,v();else{let n=e.indexOf(`}`,s);g(9,s,n===-1?t:n)}continue;case 5:if(n===34)s++,v();else{let n=e.indexOf(`"`,s);g(19,s,n===-1?t:n)}continue;case 6:if(n===96&&r===34){s+=2,v();continue}if(n!==96&&n!==34){let n=s+1;for(let r=e.charCodeAt(n);n<t&&r!==96&&r!==34;r=e.charCodeAt(++n));g(18,s,n);continue}break e;case 7:if(Ls(n)){let t=s+1;for(;Ls(e.charCodeAt(t));)t++;g(20,s,t),v();continue}break e;case 8:{let t=S(s);if(t!==-1){g(22,s,t),_(9);continue}let n=x(s);if(e.charCodeAt(n)===93){s=b(n+1),v();continue}break e}case 9:{let t=x(s);if(e.charCodeAt(t)===44){s=x(t+1),o=10;continue}break e}case 10:{let e=S(s);if(e!==-1){g(23,s,e),v();continue}break e}}if(n===37&&r===37){s=y(s+2);continue}if(n===10||n===13){let t=s+1;for(let n=e.charCodeAt(t);n===10||n===13;n=e.charCodeAt(++t));g(2,s,t);continue}let i=n|32;if(i===116&&jk(e,s,`title`)&&!Ls(e.charCodeAt(s+5))){g(3,s,s+5),_(1);continue}if(i===97&&jk(e,s,`acc`)){let t=jk(e,s+3,`descr`);if(t||jk(e,s+3,`title`)){let n=x(s+8),r=e.charCodeAt(n);if(r===58){g(t?7:5,s,x(n+1)),_(t?3:2);continue}if(r===123&&t){s=x(n+1),_(4);continue}}}let a=s;n===32&&((s<c||s>=l)&&(c=s,l=b(s)),a=l);let C=e.charCodeAt(a),w=C|32,T=0,E=0;if(w===120&&jk(e,a,`x-axis`))T=10,E=a+6;else if(w===121&&jk(e,a,`y-axis`))T=11,E=a+6;else if(C===45){if(a<u||a>=d)for(u=a,d=a;e.charCodeAt(d)===45;)d++;d-a>=2&&e.charCodeAt(d)===62&&(T=12,E=d+1)}else if(w===113&&jk(e,a,`quadrant`)){let t=e.charCodeAt(a+9);e.charCodeAt(a+8)===45&&t>=49&&t<=52?(T=13+t-49,E=a+10):jk(e,a+8,`chart`)&&(T=24,E=a+13)}if(T!==0)g(T,s,b(E));else if(i===99&&jk(e,s,`classdef`)&&!Ls(e.charCodeAt(s+8)))g(17,s,s+8);else if(n===34)r===96?(s+=2,_(6)):(s++,_(5));else if(n===58&&r===58&&e.charCodeAt(s+2)===58)s+=3,_(7);else{if(n===58||J(n)){let t=s;if(n!==58&&((s<f||s>=p)&&(f=s,p=x(s)),t=p),e.charCodeAt(t)===58&&((t+1<m||t+1>=h)&&(m=t+1,h=x(t+1)),e.charCodeAt(h)===91)){g(21,s,x(h+1)),_(8);continue}}if(Fs(n)){let t=s+1;for(;Fs(e.charCodeAt(t));)t++;g(25,s,t)}else if(n>=128){let t=s+1;for(;e.charCodeAt(t)>=128;)t++;g(26,s,t)}else if(Ps(n)){let t=s+1;for(;Ps(e.charCodeAt(t));)t++;g(37,s,t)}else if(Pk[n]!==0)g(Pk[n],s,s+1);else break}}return s<t?(n.push(1),r.push(``),i.push(s),{types:n,texts:r,starts:i}):(o<Nk.length&&(n.push(Nk[o]),r.push(``),i.push(t)),n.push(0),r.push(``),i.push(t),{types:n,texts:r,starts:i})}function Ik(...e){let t=new Uint8Array(42);for(let n of e)t[n]=1;return t}var Lk=Ik(40,35,37,25,29,28,30,31,34,32,33,26),Rk=Ik(25,37,36,29,27,35,32,31,26),zk=Ik(25,37,27,38,32,36),Bk=Ik(2,39,41),Vk=[`setQuadrant1Text`,`setQuadrant2Text`,`setQuadrant3Text`,`setQuadrant4Text`],Hk=`'STR', 'MD_STR', 'ALPHA', 'NUM', 'UNICODE_TEXT', 'PUNCTUATION'`;function Uk(e,t){let{types:n,texts:r,starts:i}=Fk(e),a=0,o=t=>{let r=n[a];throw r===1?zo(`quadrantChart`,e,i[a],``,!0):zo(`quadrantChart`,e,i[a],`Expecting ${t}, got '${Mk[r]}'`)},s=e=>(n[a]!==e&&o(`'${Mk[e]}'`),r[a++]),c=e=>e===19||e===18||Lk[e]===1,l=()=>{let e=n[a];c(e)||o(Hk);let t=r[a++];for(;Lk[n[a]]===1||n[a]===38||n[a]===36;)t+=r[a++];return{text:t,type:e===18?`markdown`:`text`}},u=()=>{let e=[];for(;;){zk[n[a]]===0&&o(`'ALPHA', 'NUM', 'COLON', 'SPACE', 'BRKT', 'MINUS'`);let t=r[a++];for(;zk[n[a]]===1;)t+=r[a++];if(e.push(t.trim()),n[a]!==29)return e;a++}};for(;Bk[n[a]]===1||n[a]===38;)a++;for(s(24);n[a]!==0;){for(;n[a]===38;)a++;let e=n[a];switch(e){case 17:{a++,s(38),Rk[n[a]]===0&&o(`'ALPHA', 'NUM', 'UNICODE_TEXT'`);let e=r[a++];for(;Rk[n[a]]===1;)e+=r[a++];s(38),t.addClass(e,u());break}case 10:case 11:{a++;let r=l(),i;n[a]===12&&(a++,c(n[a])?i=l():r.text+=` ⟶ `),e===10?(t.setXAxisLeftText(r),i&&t.setXAxisRightText(i)):(t.setYAxisBottomText(r),i&&t.setYAxisTopText(i));break}case 13:case 14:case 15:case 16:a++,t[Vk[e-13]](l());break;case 3:a++,t.setDiagramTitle(s(4).trim());break;case 5:a++,t.setAccTitle(s(6).trim());break;case 7:a++,t.setAccDescription(s(8).trim());break;case 9:t.setAccDescription(r[a++].trim());break;default:if(c(e)){let e=l(),i=n[a]===20?r[a++]:``;s(21);let o=s(22),c=s(23);t.addPoint(e,i,o,c,zk[n[a]]===1?u():[])}}Bk[n[a]]===0&&o(`'NEWLINE', 'SEMI', 'EOF'`),a++}}var Wk=4,Gk=300;function Kk(e,t){return e.quadrantChart?.[t]}function qk(e,t,n,r){let i=Kk(e,t);return typeof i==`number`&&i>=0?Math.min(i,r):n}function Jk(e,t,n){let r=Kk(e,t);return typeof r==`number`&&Number.isFinite(r)?Math.min(72,Math.max(4,r)):n}function Yk(e){return e.startsWith(`#`)?e:`#`+e}function Xk(e,t,n){let r=n.fontSize??16,i=Jk(t,`titleFontSize`,r),a=Jk(t,`quadrantLabelFontSize`,r),o=Jk(t,`xAxisLabelFontSize`,Math.round(r*.875)),s=Jk(t,`yAxisLabelFontSize`,Math.round(r*.875)),c=Jk(t,`pointLabelFontSize`,Math.round(r*.75)),l=(e,t)=>e===t?``:` font-size="${e}"`,u=n.measurer??bc(n.fontFamily,n.fontFamilyMono),d=Math.round(Math.max(100,qk(t,`chartWidth`,500,4e3))),f=Math.round(wh(n,d,280)),p=Math.round(Math.max(100,qk(t,`chartHeight`,500,4e3))*f/d),m=qk(t,`quadrantPadding`,n.padding??8,200),h=qk(t,`xAxisLabelPadding`,5,200),g=qk(t,`yAxisLabelPadding`,5,200),_=e.points.length>0,v=(e,t,n)=>Q(e?.text,e?.type===`markdown`,u,t,Math.max(n,40)),y=Q(e.title,!1,u,i,Math.max(f-2*m,40),1),b=qk(t,`titlePadding`,10,200),x=y.height>0?y.height+b:0,S=!!(e.xAxisLeft?.text||e.xAxisRight?.text),C=!!(e.yAxisBottom?.text||e.yAxisTop?.text),w=_||Kk(t,`xAxisPosition`)===`bottom`,T=Kk(t,`yAxisPosition`)===`right`,E=f-2*m,D=v(e.xAxisLeft,o,e.xAxisRight?E/2-16:E),O=v(e.xAxisRight,o,E/2-16),k=Math.max(D.height,O.height),A=S?k+h:0,j=p-2*m-x-A,M=v(e.yAxisBottom,s,e.yAxisTop?j/2-16:j),N=v(e.yAxisTop,s,j/2-16),P=Math.max(M.height,N.height),F=C?P+g:0,I=m+(T?0:F),L=m+x+(w?0:A),R=Math.max(0,E-F),z=Math.max(0,j),B=Math.max(0,(R-Wk)/2),V=Math.max(0,(z-Wk)/2),H=[I+B,L,I+R-B,L+z,I,L+V,I+R,L+z-V],U=(e,t,n,r,i)=>{for(let a=e;a<H.length;a+=4)if(!(H[a]>=H[a+2]||H[a+1]>=H[a+3])&&t<H[a+2]&&r>H[a]&&n<H[a+3]&&i>H[a+1])return!1;return!0},ee=qk(t,`quadrantTextTopPadding`,5,200),te=``;for(let t=0;t<4;t++){let n=t===0||t===3?I+R-B:I,i=t<2?L:L+z-V,o=v(e.quadrants[t],a,B-16),s=n+B/2,c=_?i+ee+o.height/2:i+V/2;H.push(s-o.width/2,c-o.height/2,s+o.width/2,c+o.height/2),te+=`<g class="pele-quadrant" data-id="${t+1}"><rect x="${X(n)}" y="${X(i)}" width="${X(B)}" height="${X(V)}"${Up}/>`+Z(o,s,c,` class="pele-label"${l(a,r)} fill="var(--_fg)" stroke="none"`)+`</g>`}let W=``;if(S){let e=w?L+z+h+k/2:L-h-k/2;W+=Z(D,O.height>0?I+R/4:I+D.width/2,e,``)+Z(O,I+R*3/4,e,``)}if(C){let e=T?I+R+g+P/2:I-g-P/2,t=(t,n)=>t.height>0?`<g transform="translate(${X(e)},${X(n)}) rotate(-90)"${l(s,o)}>${Z(t,0,0,``)}</g>`:``;W+=t(M,N.height>0?L+z*3/4:L+z-M.width/2)+t(N,L+z/4)}let ne=qk(t,`pointRadius`,5,200),G=qk(t,`pointTextPadding`,5,200),re=om(0),K=[],ie=[];for(let t of e.points){if(!(t.x>=0&&t.x<=1&&t.y>=0&&t.y<=1))continue;let n=e.classes.get(t.className),r=Math.min(t.radius??n?.radius??ne,2e3),i=t.color??n?.color,a=t.strokeColor??n?.strokeColor,o=t.strokeWidth??n?.strokeWidth,s=[];i&&s.push(`fill:`+Yk(i)),o&&(a&&s.push(`stroke:`+Yk(a)),s.push(`stroke-width:`+o));let l=I+t.x*R,u=L+(1-t.y)*z;K.push({cx:l,cy:u,reach:r+(o?Math.min(parseInt(o),400)/2:0),text:v(t.text,c,R)}),ie.push(`<circle class="pele-point${im(t.className)}" data-id="${Y(t.text.text)}" cx="${X(l)}" cy="${X(u)}" r="${X(r)}"${o&&!a?` stroke="${re}"`:``}${nm(s).shape}/>`)}let q=K.length<=Gk;if(q)for(let{cx:e,cy:t,reach:n}of K)H.push(e-n,t-n,e+n,t+n);let ae=``;for(let{cx:e,cy:t,reach:n,text:r}of K){let i=r.width/2,a=r.size*.6+(r.height-r.lineHeight)/2,o=n+G,s=Math.min(o,Math.max(0,(B-r.width)/2)),c=8+4*(e<I+R/2?t<L+z/2?1:2:t<L+z/2?0:3),l=Math.max(t+o,H[c+3]+G)+a,u=[e,t+o+a,e,t-o-a,e+o+i,t,e-o-i,t,e,l],d=e,f=u[1],p=!1;for(let e=0;e<20;e+=2){let t=e%10,n=t===8?s:0,o=(t<4||t===8)&&r.width<R?Math.min(Math.max(u[t],I+i+n),I+R-i-n):u[t],c=u[t+1];if(o-i<I||o+i>I+R||c-a<L||c+a>L+z)continue;let l=!q||U(e<10?0:8,o-i,c-a,o+i,c+a);if((!p||l)&&(d=o,f=c,p=!0),l)break}q&&H.push(d-i,f-a,d+i,f+a),ae+=Z(r,d,f,` class="pele-label"`)}return{svg:lm(`quadrantChart`,f,p,r,n,e,Z(y,f/2,b/2+y.height/2,` class="pele-title"${l(i,r)} font-weight="var(--_tw)"`)+`<g class="pele-quadrants" fill="var(--_s)" stroke="var(--_b)">${te}</g>`+(W?`<g class="pele-axis-labels" font-size="${o}" fill="var(--_m)">${W}</g>`:``)+(K.length>0?`<g class="pele-points" fill="${re}">${ie.reverse().join(``)}</g><g class="pele-point-labels" font-size="${c}">${ae}</g>`:``)),width:f,height:p,links:[]}}var Zk={type:`quadrantChart`,parse(e,t,n){let r=new Ak;return r.title=n,Uk(e,r),r},render:Xk},Qk=32;function $k(e){return new jo(e,`semantic`,{type:`radar`})}function eA(e,t){let n=e.axes.map(e=>({name:e.name,label:e.label??e.name})),r=e.curves.map(e=>{let t;if(e.entries[0].axis===void 0)t=e.entries.map(e=>e.value);else{if(n.length===0)throw $k(`Axes must be populated before curves for reference entries`);let r=new Map;for(let t of e.entries)t.axis!==void 0&&!r.has(t.axis.$refText)&&r.set(t.axis.$refText,t.value);t=n.map(e=>{let t=r.get(e.name);if(t===void 0)throw $k(`Missing entry for axis `+e.label);return t})}return{name:e.name,label:e.label??e.name,entries:t}}),i={showLegend:!0,ticks:5,max:null,min:0,graticule:`circle`};for(let t of e.options)t.name===`showLegend`?i.showLegend=t.value:t.name===`graticule`?i.graticule=t.value:i[t.name]=t.value;return i.ticks>Qk&&(i.ticks=Qk),{type:`radar`,title:e.title||t,accTitle:e.accTitle?e.accTitle.replace(/^\s+/g,``):void 0,accDescr:e.accDescr?e.accDescr.replace(/\n\s+/g,`
|
|
125
|
+
`):void 0,axes:n,curves:r,options:i}}var tA=0,nA=0;function rA(e,t){let n=t;for(let t=e.charCodeAt(n);t>=48&&t<=57;t=e.charCodeAt(n))n++;return n}function iA(e,t){(t<tA||t>=nA)&&(tA=t,nA=rA(e,t));let n=nA;if(n===t)return-1;let r=e.charCodeAt(n)===46;if(r){let t=rA(e,n+1),r=t-n-1;if(r>0&&e.charCodeAt(t)!==46)return t;if(r>1)return t-1}return e.charCodeAt(t)===48?t+1:r?n-1>t?n-1:-1:n}var aA=ig.pattern,oA=/[\t ]*accDescr\s*{/y,sA=-2;function cA(e,t){return oA.lastIndex=t,oA.test(e)&&(sA===-2&&(sA=e.lastIndexOf(`}`)),oA.lastIndex>sA)?-1:(aA.lastIndex=t,aA.test(e)?aA.lastIndex:-1)}var lA={name:`ID`,pattern:/[\w]([-\w]*\w)?/y},uA=/[-\w]*\w/y;function dA(e,t){return(n,r,i)=>{if(e.lastIndex=r,!e.test(n))return-1;let a=e.lastIndex;return i===t?a:(uA.lastIndex=a,uA.test(n)?-1:a)}}var fA=e=>({name:e,pattern:e,longer:[lA]}),pA=e=>({name:e,pattern:e}),mA=[pA(`radar-beta:`),{...mg(`radar-beta`),longer:[lA]},fA(`showLegend`),fA(`graticule`),fA(`curve`),fA(`ticks`),fA(`axis`),fA(`max`),fA(`min`),pA(`:`),pA(`,`),pA(`[`),pA(`]`),pA(`{`),pA(`}`),{name:`GRATICULE`,pattern:/circle|polygon/y,match:dA(/circle|polygon/y,3)},{name:`BOOLEAN`,pattern:/true|false/y,match:dA(/true|false/y,2)},{...ig,match:cA},ag,sg(String.raw`[-\w]*\w`),{name:`NUMBER`,pattern:/(?:[0-9]+\.[0-9]+(?!\.))|(?:0|[1-9][0-9]*(?!\.))/y,match:iA},cg,lA,lg,ug,dg,fg,pg];function hA(e){return tA=nA=0,sA=-2,rg(e,mA,`radar`)}function gA(e){let t=new wg(hA(e),mA,`radar`),n={$type:`Radar`,axes:[],curves:[],options:[]},r=()=>{for(;t.kind===23;)t.i++},i=()=>{t.kind!==-1&&(t.kind!==23&&t.fail(`a line break or the end of input`),r())},a=()=>{if(!t.accept(11))return;let e=Cg(t.expect(21));return t.expect(12),e},o=e=>{if(!e)return{$type:`Entry`,value:Number(t.expect(20))};let n={$refText:t.expect(22)};return t.accept(9),{$type:`Entry`,axis:n,value:Number(t.expect(20))}},s=()=>{let e=t.expect(22),n=a(),i={$type:`Curve`,name:e,entries:[]};n!==void 0&&(i.label=n),t.expect(13),r(),t.kind!==20&&t.kind!==22&&t.fail(`a number or an axis name`);let s=t.kind===22;for(i.entries.push(o(s));t.accept(10);)r(),i.entries.push(o(s));return r(),t.expect(14),i},c=()=>{let e={$type:`Axis`,name:t.expect(22)},n=a();return n!==void 0&&(e.label=n),e},l=()=>{let e=t.kind,n=t.take(),r;return r=e===2?t.expect(16)===`true`:e===3?t.expect(15):Number(t.expect(20)),{$type:`Option`,name:n,value:r}},u=()=>t.kind===2||t.kind===5||t.kind===7||t.kind===8||t.kind===3;for(r(),t.accept(0)||(t.expect(1),t.accept(9)),r();t.kind!==-1;)switch(t.kind){case 23:t.i++;break;case 17:n.accDescr=xg(t.take()),i();break;case 18:n.accTitle=bg(t.take()),i();break;case 19:n.title=yg(t.take()),i();break;case 6:t.i++;do n.axes.push(c());while(t.accept(10));break;case 4:t.i++;do n.curves.push(s());while(t.accept(10));break;default:for(u()||t.fail(`an axis, a curve, an option, a title, or a line break`),n.options.push(l());t.accept(10);)u()||t.fail(`an option`),n.options.push(l())}return n}var _A=12,vA=26,yA=24;function bA(e,t,n,r,i){let a=e.radar?.[t];return typeof a==`number`&&a>=r?Math.min(a,i):n}function xA(e,t,n,r){let i=Math.min(Math.max(e,t),n),a=r*(i-t);return Number.isFinite(a)?a/(n-t):r*((i-t)/(n-t))}function SA(e,t){let n=e.length,r=`M${X(e[0].x)},${X(e[0].y)}`;for(let i=0;i<n;i++){let a=e[(i-1+n)%n],o=e[i],s=e[(i+1)%n],c=e[(i+2)%n];r+=` C${X(o.x+(s.x-a.x)*t)},${X(o.y+(s.y-a.y)*t)} ${X(s.x-(c.x-o.x)*t)},${X(s.y-(c.y-o.y)*t)} ${X(s.x)},${X(s.y)}`}return r+` Z`}function CA(e){let t=``;for(let n of e)t+=(t?` `:``)+X(n.x)+`,`+X(n.y);return t}function wA(e,t,n){let r=bA(t,`width`,320,1,4e3);return Sh(n,r,160,(i,a)=>TA(e,t,n,i,bA(t,`height`,320,1,4e3)*i/r,a))}function TA(e,t,n,r,i,a){let o=n.fontSize??16,s=Math.round(o*.875),c=n.measurer??bc(n.fontFamily,n.fontFamilyMono),l=n.padding??8,u=bA(t,`axisScaleFactor`,1,0,10),d=bA(t,`axisLabelFactor`,1.05,0,10),f=bA(t,`curveTension`,.17,0,1),p=Math.min(r,i)/2,{axes:m,curves:h}=e,{ticks:g,graticule:_,min:v}=e.options,y=m.length,b=m.map((e,t)=>{let n=2*Math.PI*t/y-Math.PI/2;return{x:Math.cos(n),y:Math.sin(n)}}),x=e.options.max;if(x===null){x=-1/0;for(let e of h)for(let t of e.entries)t>x&&(x=t)}let S=-r/2-bA(t,`marginLeft`,16,0,2e3),C=r/2+bA(t,`marginRight`,16,0,2e3),w=-i/2-bA(t,`marginTop`,16,0,2e3),T=i/2+bA(t,`marginBottom`,16,0,2e3),E=``;for(let e=0;e<g;e++){let t=Math.min(p,p*(e+1)/g);E+=_===`circle`?`<circle r="${X(t)}"/>`:`<polygon points="${CA(b.map(e=>({x:e.x*t,y:e.y*t})))}"/>`}let D=``,O=``;b.forEach((e,t)=>{let n=p*u;D+=`M0,0L${X(e.x*n)},${X(e.y*n)}`;let r=Q(m[t].label,!1,c,s,4e3),i=p*d+6,a=e.x*i+(e.x>.01?r.width/2:e.x<-.01?-r.width/2:0),o=e.y*i+(e.y>.01?r.height/2:e.y<-.01?-r.height/2:0);O+=`<g class="pele-axis-label" data-id="${Y(m[t].name)}">${Z(r,a,o,``)}</g>`,S=Math.min(S,a-r.width/2),C=Math.max(C,a+r.width/2),w=Math.min(w,o-r.height/2),T=Math.max(T,o+r.height/2)});let k=``;h.forEach((e,t)=>{if(e.entries.length!==y)return;let n=e.entries.map((e,t)=>{let n=xA(e,v,x,p),r=Number.isFinite(n)?n:0;return{x:b[t].x*r,y:b[t].y*r}}),r=om(t),i=` class="pele-curve" data-id="${Y(e.name)}" fill="${r}" stroke="${r}"`;k+=_===`circle`?`<path${i} d="${SA(n,f)}"/>`:`<polygon${i} points="${CA(n)}"/>`});let A=e.options.showLegend?h.map(e=>Q(e.label,!1,c,s,4e3)):[],j=0;for(let e of A)j=Math.max(j,e.width);let M=A.length*vA,N=a?-(_A+8+j)/2:C+yA,P=a?T+yA/2:-M/2;A.length>0&&a?(S=Math.min(S,N),C=Math.max(C,-N),T=P+M):A.length>0&&(C=N+_A+8+j,w=Math.min(w,-M/2),T=Math.max(T,M/2));let F=``;A.forEach((e,t)=>{let n=P+t*vA+vA/2,r=om(t);F+=`<g class="pele-legend-item" data-id="${Y(h[t].name)}"><rect x="${X(N)}" y="${X(n-_A/2)}" width="${_A}" height="${_A}" rx="2" fill="${r}" fill-opacity="0.4" stroke="${r}"/>`+Z(e,N+_A+8+e.width/2,n,``)+`</g>`});let I=Q(e.title,!1,c,o,Ch(n),1),L=I.height>0?I.height+8:0,R=Math.max(C-S,I.width),z=Math.ceil(R+2*l),B=Math.ceil(T-w+L+2*l),V=`translate(${X(l+(R-(C-S))/2-S)},${X(l+L-w)})`;return{svg:lm(`radar`,z,B,o,n,e,Z(I,z/2,l+I.height/2,` class="pele-title" font-weight="var(--_tw)"`)+`<g transform="${V}">`+(E?`<g class="pele-graticule" fill="none" stroke="var(--_a)">${E}</g>`:``)+(D?`<path class="pele-axes" d="${D}" fill="none" stroke="var(--_b)"/>`:``)+(k?`<g class="pele-curves" fill-opacity="0.2" stroke-width="1.5" stroke-linejoin="round">${k}</g>`:``)+(O?`<g class="pele-axis-labels" font-size="${s}">${O}</g>`:``)+(F?`<g class="pele-legend" font-size="${s}">${F}</g>`:``)+`</g>`),width:z,height:B,links:[]}}var EA={type:`radar`,parse:(e,t,n)=>eA(gA(e),n),render:wA};function DA(e){return e===32||e>=9&&e<=13||e>127&&/\s/.test(String.fromCharCode(e))}function OA(){let e=1/0;return(t,n)=>{if(!t.startsWith(`accDescr`,n))return-1;let r=t.length,i=n+8;for(;i<r&&(t.charCodeAt(i)===32||t.charCodeAt(i)===9);)i++;if(t.charCodeAt(i)===58){for(i++;i<r;i++){let e=t.charCodeAt(i);if(e===10||e===13||e===37&&t.charCodeAt(i+1)===37)break}return i}for(;i<r&&DA(t.charCodeAt(i));)i++;if(t.charCodeAt(i)!==123||i>=e)return-1;let a=t.indexOf(`}`,i+1);return a===-1&&(e=i),a+1||-1}}var kA=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`;function AA(e){return{name:`TITLE`,pattern:new RegExp(String.raw`title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|(?!${e}))`,`y`),first:`t`}}var jA={name:`ACC_TITLE`,pattern:/accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/y,first:`a`},MA={name:`ACC_DESCR`,pattern:/accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/y,first:`a`,scanner:OA};function NA(e,t){return{name:e,pattern:e,longer:t}}function PA(e,t){return{...mg(e),longer:[t]}}function FA(e){return{name:e,pattern:/[A-Z_a-z][\w-]*/y,first:kA+`_`}}function IA(e){return{name:e,pattern:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/y,first:`"'`}}function LA(e){return[{name:e+`_WHITESPACE`,pattern:/[\t \r\n]+/y,hidden:!0,first:` \r
|
|
126
|
+
`},{...dg,name:e+`_YAML`,first:`-`},{...fg,name:e+`_DIRECTIVE`,first:` %`},{...pg,name:e+`_SINGLE_LINE_COMMENT`,first:` %`}]}function RA(e){if(!e.includes(`\\`))return e.slice(1,-1);let t=e.length-1,n=``;for(let r=1;r<t;r++){let i=e[r];i===`\\`&&r+1<t?(i=e[++r],n+=i===`n`?`
|
|
127
|
+
`:i===`r`?`\r`:i===`t`?` `:i):n+=i}return n}function zA(e,t,n,r,i,a){let o=new wg(rg(e,t,`railroad`),t,`railroad`),s={$type:n,rules:[]};for(o.expect(0);;){let e=o.kind;if(e===r){let e=yg(o.take()),t=e[0];s.title=(t===`"`||t===`'`)&&e.endsWith(t)?i(e):e}else if(e===r+1)s.accTitle=bg(o.take());else if(e===r+2)s.accDescr=xg(o.take());else break}for(;o.kind!==-1;)s.rules.push(a(o));return s}var BA=[];function VA(e){let t=e,n=t.element??t.primary??t.suffix,r=t.alternatives??t.elements??(n?[n]:BA);if(t.base){r=[t.base];for(let e of t.postfixes)e.except&&r.push(e.except)}return r}var HA=e=>({type:`terminal`,value:e}),UA=e=>({type:`nonterminal`,name:e}),WA=e=>({type:`special`,text:e}),GA=e=>({type:`optional`,element:e}),KA=(e,t,n=1/0)=>({type:`repetition`,element:e,min:t,max:n});function qA(e){return e.length===1?e[0]:{type:`sequence`,elements:e}}function JA(e){return e.length===1?e[0]:{type:`choice`,alternatives:e}}function YA(e,t){return e.rules.map(e=>({name:e.name,definition:XA(e.definition,VA,t)}))}function XA(e,t,n){let r=[e],i=[t(e)],a=[[]];for(;;){let e=r.length-1,o=a[e];if(o.length<i[e].length){let n=i[e][o.length];r.push(n),i.push(t(n)),a.push([])}else{let t=n(r[e],o);if(e===0)return t;r.pop(),i.pop(),a.pop(),a[e-1].push(t)}}}var ZA=`0123456789`,QA={name:`ABNF_RULENAME`,pattern:/[A-Za-z][A-Za-z0-9-]*/y,first:kA},$A={name:`ABNF_COMMENT`,pattern:/;[^\n\r]*/y,hidden:!0,first:`;`},ej=[PA(`railroad-abnf-beta`,QA),NA(`=`),NA(`;`,[$A]),NA(`/`),NA(`(`),NA(`)`),NA(`[`),NA(`]`),AA(String.raw`[A-Za-z0-9-]`),jA,MA,QA,{name:`ABNF_STRING`,pattern:/"[^"]*"/y,first:`"`},{name:`ABNF_NUMVAL`,pattern:/%[xXdDbB][0-9A-Fa-f]+(?:-[0-9A-Fa-f]+|\.[0-9A-Fa-f]+)*/y,first:`%`},{name:`ABNF_REPEAT`,pattern:/[0-9]*\*[0-9]*/y,first:ZA+`*`},{name:`ABNF_EXACT_REPEAT`,pattern:/[0-9]+/y,first:ZA},...LA(`ABNF`),$A];function tj(e,t,n,r){let i={$type:`AbnfConcatenation`,elements:[]};return t.alternatives.push(i),{alternation:t,concatenation:i,node:e,close:n,repeat:r}}function nj(e){let t=[],n=tj(void 0,{$type:`AbnfAlternation`,alternatives:[]},-2,void 0);for(;;){let r=e.kind===14||e.kind===15?e.take():void 0,i,a=e.kind;switch(a){case 12:i={$type:`AbnfStringLiteral`,value:e.take().slice(1,-1)};break;case 13:i={$type:`AbnfNumVal`,value:e.take()};break;case 11:i={$type:`AbnfRuleName`,name:e.take()};break;case 4:case 6:{e.i++;let i={$type:`AbnfAlternation`,alternatives:[]};t.push(n),n=tj({$type:a===4?`AbnfGroup`:`AbnfOptionalGroup`,element:i},i,a+1,r);continue}default:e.fail(`a string, a number, a name, or an opening bracket`)}for(;;){n.concatenation.elements.push(r===void 0?{$type:`AbnfElement`,primary:i}:{$type:`AbnfElement`,repeat:r,primary:i});let a=e.kind;if(a===n.close)e.i++,i=n.node,r=n.repeat,n=t.pop();else{if(a===3)e.i++,n.concatenation={$type:`AbnfConcatenation`,elements:[]},n.alternation.alternatives.push(n.concatenation);else if(a!==12&&a!==13&&a!==11&&a!==4&&a!==6&&a!==14&&a!==15){if(t.length===0)return n.alternation;e.fail(`token of type '${ej[n.close].name}'`)}break}}}}function rj(e){return zA(e,ej,`RailroadAbnf`,8,e=>e.slice(1,-1),e=>{let t=e.expect(11);e.expect(1);let n=nj(e);return e.expect(2),{$type:`AbnfRule`,name:t,definition:n}})}function ij(e,t){switch(e.$type){case`AbnfAlternation`:return JA(t);case`AbnfConcatenation`:return qA(t);case`AbnfElement`:{let n=e.repeat;if(!n)return t[0];let r=n.indexOf(`*`),i=r===-1,a=r>0||i?parseInt(n,10):0,o=i?a:r<n.length-1?parseInt(n.slice(r+1),10):1/0;return a===0&&o===1?GA(t[0]):KA(t[0],a,o)}case`AbnfStringLiteral`:case`AbnfNumVal`:return HA(e.value);case`AbnfRuleName`:return UA(e.name);case`AbnfGroup`:return t[0];case`AbnfOptionalGroup`:return GA(t[0])}}var aj=e=>YA(e,ij);function oj(e,t){if(e.charCodeAt(t)!==63)return-1;let n=!1;for(let r=t+1;r<e.length;r++){let t=e.charCodeAt(r);if(t===63)return n?r+1:-1;if(t===59)return-1;n||=!DA(t)}return-1}var sj=FA(`EBNF_ID`),cj={name:`EBNF_SPECIAL_SEQUENCE`,pattern:/\?(?=[^?;]*[^?\s;][^?;]*\?)[^?;]*\?/y,first:`?`,scanner:()=>oj},lj=LA(`EBNF`),uj={name:`EBNF_ISO_COMMENT`,pattern:/\(\*[\s\S]*?\*\)/y,hidden:!0,first:`(`,opener:/\(\*/y},dj=[PA(`railroad-ebnf-beta`,sj),NA(`::=`),NA(`=`),NA(`;`),NA(`|`),NA(`,`),NA(`(`,[uj]),NA(`)`),NA(`[`),NA(`]`),NA(`{`),NA(`}`),NA(`?`,[cj]),NA(`*`),NA(`+`),NA(`-`,[lj[1]]),AA(String.raw`[\w-]`),jA,MA,sj,IA(`EBNF_STRING`),cj,...lj,{name:`EBNF_BLOCK_COMMENT`,pattern:/\/\*[\s\S]*?\*\//y,hidden:!0,first:`/`,opener:/\/\*/y},uj];function fj(e,t,n,r){let i={$type:`EbnfSequence`,elements:[]};return t.alternatives.push(i),{choice:t,sequence:i,term:void 0,node:e,close:n,except:r}}var pj=[`EbnfGroup`,`EbnfOptional`,`EbnfRepetition`];function mj(e){let t=[],n=fj(void 0,{$type:`EbnfChoice`,alternatives:[]},-2,!1),r=!1;for(;;){let i,a=e.kind;switch(a){case 20:i={$type:`EbnfTerminal`,value:RA(e.take())};break;case 19:i={$type:`EbnfNonTerminal`,name:e.take()};break;case 21:i={$type:`EbnfSpecial`,text:e.take().slice(1,-1).trim()};break;case 6:case 8:case 10:{e.i++;let i={$type:`EbnfChoice`,alternatives:[]};t.push(n),n=fj({$type:pj[a-6>>1],element:i},i,a+1,r),r=!1;continue}default:e.fail(`a terminal, a name, or an opening bracket`)}for(;;){r?(n.term.postfixes.push({$type:`EbnfExceptionPostfix`,except:i}),r=!1):(n.term={$type:`EbnfTerm`,base:i,postfixes:[]},n.sequence.elements.push(n.term));let a=n.term.postfixes;for(;;){let t=e.kind;if(t===12)a.push({$type:`EbnfOptionalPostfix`,operator:e.take()});else if(t===13)a.push({$type:`EbnfZeroOrMorePostfix`,operator:e.take()});else if(t===14)a.push({$type:`EbnfOneOrMorePostfix`,operator:e.take()});else break}let o=e.kind;if(o===n.close)e.i++,i=n.node,r=n.except,n=t.pop();else{if(o===15)e.i++,r=!0;else if(o===5)e.i++;else if(o===4)e.i++,n.sequence={$type:`EbnfSequence`,elements:[]},n.choice.alternatives.push(n.sequence);else if(o!==20&&o!==19&&o!==21&&o!==6&&o!==8&&o!==10){if(t.length===0)return n.choice;e.fail(`token of type '${dj[n.close].name}'`)}break}}}}function hj(e){return zA(e,dj,`RailroadEbnf`,16,RA,e=>{let t=e.expect(19);e.accept(2)||e.expect(1);let n={$type:`EbnfRule`,name:t,definition:mj(e)};return e.expect(3),n})}function gj(e,t){switch(e.$type){case`EbnfChoice`:return JA(t);case`EbnfSequence`:return qA(t);case`EbnfTerm`:{let n=t[0],r=1;for(let i of e.postfixes)n=i.$type===`EbnfOptionalPostfix`?GA(n):i.$type===`EbnfExceptionPostfix`?{type:`sequence`,elements:[n,HA(`-`),t[r++]]}:KA(n,+(i.$type===`EbnfOneOrMorePostfix`));return n}case`EbnfTerminal`:return HA(e.value);case`EbnfNonTerminal`:return UA(e.name);case`EbnfSpecial`:return WA(e.text);case`EbnfGroup`:return t[0];case`EbnfOptional`:return GA(t[0]);case`EbnfRepetition`:return KA(t[0],0)}}var _j=e=>YA(e,gj),vj=FA(`RR_ID`),yj=e=>NA(e,[vj]),bj=[PA(`railroad-beta`,vj),yj(`nonterminal`),yj(`zeroOrMore`),yj(`oneOrMore`),yj(`sequence`),yj(`optional`),yj(`terminal`),yj(`special`),yj(`choice`),NA(`=`),NA(`;`),NA(`(`),NA(`,`),NA(`)`),AA(String.raw`[\w-]`),jA,MA,vj,IA(`RR_STRING`),...LA(`RR`),{name:`RR_BLOCK_COMMENT`,pattern:/\/\*[\s\S]*?\*\//y,hidden:!0,first:`/`,opener:/\/\*/y}];function xj(e){e.i++,e.expect(11);let t=RA(e.expect(18));return e.expect(13),t}function Sj(e){return{$type:e,element:void 0}}function Cj(e){let t=[];for(;;){let n;switch(e.kind){case 6:n={$type:`RailroadTerminalExpr`,value:xj(e)};break;case 1:n={$type:`RailroadNonTerminalExpr`,name:xj(e)};break;case 7:n={$type:`RailroadSpecialExpr`,text:xj(e)};break;case 4:n={$type:`RailroadSequenceExpr`,elements:[]};break;case 8:n={$type:`RailroadChoiceExpr`,alternatives:[]};break;case 5:n=Sj(`RailroadOptionalExpr`);break;case 3:n=Sj(`RailroadOneOrMoreExpr`);break;case 2:n=Sj(`RailroadZeroOrMoreExpr`);break;default:e.fail(`an expression`)}if(`elements`in n||`alternatives`in n||`element`in n)e.i++,e.expect(11),t.push(n);else for(;;){let r=t[t.length-1];if(r===void 0)return n;if(`element`in r)r.element=n;else if((`elements`in r?r.elements:r.alternatives).push(n),e.accept(12))break;e.expect(13),t.pop(),n=r}}}function wj(e){return zA(e,bj,`Railroad`,14,RA,e=>{let t=e.expect(17);e.expect(9);let n=Cj(e);return e.expect(10),{$type:`RailroadRule`,name:t,definition:n}})}function Tj(e,t){switch(e.$type){case`RailroadTerminalExpr`:return HA(e.value);case`RailroadNonTerminalExpr`:return UA(e.name);case`RailroadSpecialExpr`:return WA(e.text);case`RailroadSequenceExpr`:return qA(t);case`RailroadChoiceExpr`:return JA(t);case`RailroadOptionalExpr`:return GA(t[0]);default:return KA(t[0],+(e.$type===`RailroadOneOrMoreExpr`))}}var Ej=e=>YA(e,Tj),Dj=FA(`PEG_ID`),Oj=[PA(`railroad-peg-beta`,Dj),NA(`<-`),NA(`;`),NA(`/`),NA(`&`),NA(`!`),NA(`?`),NA(`*`),NA(`+`),NA(`(`),NA(`)`),NA(`.`),AA(String.raw`[\w-]`),jA,MA,Dj,IA(`PEG_STRING`),...LA(`PEG`),{name:`PEG_LINE_COMMENT`,pattern:/#[^\n\r]*/y,hidden:!0,first:`#`}];function kj(e,t,n){let r={$type:`PegSequence`,elements:[]};return t.alternatives.push(r),{choice:t,sequence:r,node:e,operator:n}}function Aj(e){let t=[],n=kj(void 0,{$type:`PegOrderedChoice`,alternatives:[]},void 0);for(;;){let r=e.kind===4||e.kind===5?e.take():void 0,i;switch(e.kind){case 16:i={$type:`PegLiteral`,value:RA(e.take())};break;case 15:i={$type:`PegIdentifier`,name:e.take()};break;case 11:i={$type:`PegAny`,dot:e.take()};break;case 9:{e.i++;let i={$type:`PegOrderedChoice`,alternatives:[]};t.push(n),n=kj({$type:`PegGroup`,element:i},i,r);continue}default:e.fail(`a literal, a name, a dot, or an opening parenthesis`)}for(;;){let a={$type:`PegSuffix`,primary:i};(e.kind===6||e.kind===7||e.kind===8)&&(a.operator=e.take()),n.sequence.elements.push(r===void 0?{$type:`PegPrefix`,suffix:a}:{$type:`PegPrefix`,operator:r,suffix:a});let o=e.kind;if(o===10&&t.length>0)e.i++,i=n.node,r=n.operator,n=t.pop();else{if(o===3)e.i++,n.sequence={$type:`PegSequence`,elements:[]},n.choice.alternatives.push(n.sequence);else if(o!==4&&o!==5&&o!==16&&o!==15&&o!==11&&o!==9){if(t.length===0)return n.choice;e.fail(`token of type ')'`)}break}}}}function jj(e){return zA(e,Oj,`RailroadPeg`,12,RA,e=>{let t=e.expect(15);e.expect(1);let n={$type:`PegRule`,name:t,definition:Aj(e)};return e.expect(2),n})}function Mj(e){switch(e.type){case`terminal`:return`"${e.value}"`;case`nonterminal`:return e.name;case`special`:return e.text;default:return`(...)`}}function Nj(e,t){let n=t[0];switch(e.$type){case`PegOrderedChoice`:return JA(t);case`PegSequence`:return qA(t);case`PegPrefix`:return e.operator?WA(e.operator+Mj(n)):n;case`PegSuffix`:return e.operator?e.operator===`?`?GA(n):KA(n,+(e.operator===`+`)):n;case`PegLiteral`:return HA(e.value);case`PegIdentifier`:return UA(e.name);case`PegAny`:return WA(e.dot);case`PegGroup`:return n}}var Pj=e=>YA(e,Nj),Fj=class{type=`railroad`;notation=`railroad`;title;accTitle;accDescr;rules=[];byName=new Map;setTitle(e){this.title=e}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
128
|
+
`)}addRule(e){this.rules.push(e),this.byName.set(e.name,e)}getRule(e){return this.byName.get(e)}},Ij=/^\s*railroad-(ebnf-|abnf-|peg-)?beta/i;function Lj(e){let t=Ij.exec(e);if(t===null)return;let n=t[1]?.toLowerCase();return n===`ebnf-`?`ebnf`:n===`abnf-`?`abnf`:n===`peg-`?`peg`:`railroad`}function Rj(e,t){switch(t){case`ebnf`:{let t=hj(e);return[t,_j(t)]}case`abnf`:{let t=rj(e);return[t,aj(t)]}case`peg`:{let t=jj(e);return[t,Pj(t)]}default:{let t=wj(e);return[t,Ej(t)]}}}function zj(e,t,n){let[r,i]=Rj(t,n);e.notation=n,r.accDescr&&e.setAccDescription(r.accDescr),r.accTitle&&e.setAccTitle(r.accTitle),r.title&&e.setTitle(r.title);for(let t of i)e.addRule(t)}function Bj(e,t){let n=Lj(e);if(n===void 0)throw new jo(`No railroad diagram keyword found.`,`syntax`,{type:`railroad`});let r=new Fj;return t&&(r.title=t),zj(r,e,n),r}var Vj=12,Hj=6,Uj=18,Wj=12,Gj=7;function Kj(e,t,n,r){let i=e.railroad?.[t];return typeof i==`number`&&i>=0?Math.min(i,r):n}var qj=/[\n\r\t]/g;function Jj(e){return(e.includes(`¶ß`)?Xo(e.replace(/&/g,`&`)):e).replace(qj,e=>e===`
|
|
129
|
+
`?`\\n`:e===`\r`?`\\r`:`\\t`)}function Yj(e,t){for(let n=t,r=e.length-1;n<r;n++,r--){let t=e[n];e[n]=e[r],e[r]=t}}function Xj(e){return Math.ceil(e/2)*2}function Zj(e,t,n,r,i){let a=i.height/2;return{kind:e,width:Math.max(Xj(i.measurer.width(t,i.size,r)+2*i.padding),i.height),up:a,down:a,kids:BA,text:t,id:n,reach:0}}function Qj(e,t){if(t===1/0&&e<=1)return``;let n=e=>Number.isFinite(e)?String(e):`∞`;return e===t?n(e)+`×`:t===1/0?`≥`+n(e)+`×`:e===0?`≤`+n(t)+`×`:n(e)+`–`+n(t)+`×`}function $j(e,t,n,r){return Math.max(e+t.down+r.sep+n.up,2*r.arc)}function eM(e,t){let n=Math.max(e.up+t.sep,2*t.arc);return{kind:5,width:e.width+4*t.arc,up:n,down:e.down,kids:[e],text:``,id:``,reach:n}}function tM(e,t,n=1/0){let r=new Map,i=[[e,n]];for(let e=0;n!==1/0&&e<i.length;e++){let[n,a]=i[e];r.set(n,a);let o=n.type===`choice`||n.type===`optional`?4*t.arc:n.type===`repetition`?(n.min===0?6:2)*t.arc:n.type===`sequence`?6*t.arc:0;for(let e of VA(n))i.push([e,Math.max(40,a-o)])}return XA(e,VA,(e,n)=>{let i=r.get(e)??1/0;switch(e.type){case`terminal`:{let n=Jj(e.value);return Zj(0,/^ +$/.test(n)?`␣`.repeat(n.length):n,``,4,t)}case`nonterminal`:return Zj(1,Jj(e.name),e.name,0,t);case`special`:return Zj(2,`? `+Jj(e.text)+` ?`,``,2,t);case`sequence`:{let e=Math.max(0,n.length-1)*t.gap,r=0,a=0;for(let t of n)e+=t.width,r=Math.max(r,t.up),a=Math.max(a,t.down);let o={kind:3,width:e,up:r,down:a,kids:n,text:``,id:``,reach:0};if(e<=i||n.length<2)return o;let s=[],c=[],l=0,u=()=>{let e=0,t=0;for(let n of c)e=Math.max(e,n.up),t=Math.max(t,n.down);s.push({kind:3,width:l,up:e,down:t,kids:c,text:``,id:``,reach:0}),c=[],l=0};for(let e of n)c.length&&l+t.gap+e.width>Math.max(40,i-6*t.arc)&&u(),l+=(c.length?t.gap:0)+e.width,c.push(e);if(u(),s.length<2)return o;let d=0,f=0;for(let e=0;e<s.length;e++)d=Math.max(d,s[e].width),e&&(f+=s[e-1].down+Math.max(t.sep,2*t.arc)+s[e].up);return{kind:7,width:d+6*t.arc,up:s[0].up,down:f+s[s.length-1].down,kids:s,text:``,id:``,reach:0}}case`choice`:{let e=0,r=0;for(let i=0;i<n.length;i++)e=Math.max(e,n[i].width),i>0&&(r=$j(r,n[i-1],n[i],t));let i=n[n.length-1];return{kind:4,width:e+4*t.arc,up:n.length>0?n[0].up:0,down:i?r+i.down:0,kids:n,text:``,id:``,reach:0}}case`optional`:return eM(n[0],t);case`repetition`:{let{min:r,max:i}=e,a=n[0];if(r===1&&i===1)return a;let o=Qj(r,i),s=Math.max(a.down+t.sep,2*t.arc),c=o===``?0:Xj(t.measurer.width(o,Wj,0)),l={kind:6,width:Math.max(a.width,c)+2*t.arc,up:a.up,down:s+(o===``?Gj/2+1:Wj+6),kids:[a],text:o,id:``,reach:s};return r===0?eM(l,t):l}}})}function nM(e,t,n){return Oh(n,r=>rM(e,t,n,r))}function rM(e,t,n,r){let i=n.fontSize??16,a=Kj(t,`fontSize`,0,200),o=a||Math.round(i*.875),s=a||i,c=Kj(t,`padding`,-1,200),l=Math.round(o*1.5),u={measurer:n.measurer??bc(n.fontFamily,n.fontFamilyMono),size:o,padding:c<0?12:c,height:Xj(l+(c<0?9:2*c)),gap:Math.min(Kj(t,`horizontalSeparation`,16,500),r?12:1/0),sep:Kj(t,`verticalSeparation`,10,500),arc:Math.min(Kj(t,`arcRadius`,10,200),r?6:1/0)},d=t.railroad?.showMarkers===!1?0:Kj(t,`markerRadius`,4,50),f=Kj(t,`strokeWidth`,0,20),p=f>0?` stroke-width="${X(f)}"`:``,m=n.padding??8,{arc:h}=u,g=X(h),_=(e,t,n)=>`a${g},${g} 0 0 ${e} ${t}${g},${n}${g}`,v=_(1,``,``),y=_(0,``,``),b=_(0,``,`-`),x=_(1,``,`-`),S=_(0,`-`,``),C=_(0,`-`,`-`),w=Q(e.title,!1,u.measurer,i,r?Ch(n):4e3,1),T=w.height>0?w.height+16:0,E=Math.round(s*1.5),D=o*.35,O=u.height/2,k=``,A=``,j=``,M=(e,t,n)=>{n>e&&(k+=`M${X(e)},${X(t)}H${X(n)}`)},N=(e,t,n)=>{let r=[e],i=[t,n];for(;r.length>0;){let e=r.pop(),t=i.pop(),n=i.pop(),a=e.kids,o=n+e.width;switch(e.kind){case 3:{let e=o;for(let n=a.length-1;n>=0;n--)e-=a[n].width,r.push(a[n]),i.push(e,t),n>0&&M(e-u.gap,t,e),e-=u.gap;break}case 7:{let e=n+2*h,s=r.length,c=0;M(n,t,e);for(let s=0;s<a.length;s++){let l=a[s],d=t+c;if(r.push(l),i.push(d,e),s+1<a.length){let r=a[s+1],i=c+l.down+Math.max(u.sep,2*h)+r.up,f=t+c+l.down+Math.max(u.sep,2*h)/2;k+=`M${X(e+l.width)},${X(d)}H${X(o-2*h)}V${X(f)}H${X(n+h)}V${X(t+i)}H${X(e)}`,A+=`M${X(e-Gj)},${X(t+i-Gj/2)}l${Gj},${Gj/2}l${-Gj},${Gj/2}z`,c=i}else k+=`M${X(e+l.width)},${X(d)}H${X(o-h)}V${X(t)}H${X(o)}`}Yj(r,s),Yj(i,2*s);break}case 4:{let s=e.width-4*h,c=n+h,l=o-h,d=r.length,f=0;for(let e=0;e<a.length;e++){let d=a[e];e>0&&(f=$j(f,a[e-1],d,u));let p=t+f,m=n+2*h+(s-d.width)/2,g=e===a.length-1;e===0?(M(n,t,m),M(m+d.width,t,o)):k+=(g?`M${X(n)},${X(t)}${v}V${X(p-h)}`:`M${X(c)},${X(p-h)}`)+y+(m>c+h?`H${X(m)}`:``)+`M${X(m+d.width)},${X(p)}`+(m>c+h?`H${X(l-h)}`:``)+b+(g?`V${X(t+h)}${x}`:``),r.push(d),i.push(p,m)}Yj(r,d),Yj(i,2*d);break}case 5:{let s=a[0],c=n+2*h;M(n,t,c),M(c+s.width,t,o),k+=`M${X(n)},${X(t)}${b}V${X(t-e.reach+h)}${x}H${X(o-2*h)}${v}V${X(t-h)}${y}`,r.push(s),i.push(c,t);break}case 6:{let s=a[0],c=n+(e.width-s.width)/2,l=t+e.reach,u=n+e.width/2;M(n,t,c),M(c+s.width,t,o),k+=`M${X(n+h)},${X(t)}${S}V${X(l-h)}${y}H${X(o-h)}${b}V${X(t+h)}${C}`,A+=`M${X(u-Gj/2)},${X(l)}l${Gj},${-Gj/2}v${Gj}z`,e.text!==``&&(j+=`<text class="pele-edge-label pele-count" x="${X(u)}" y="${X(l+Wj+3)}" font-size="${Wj}" fill="var(--_m)">${Ec(e.text)}</text>`),r.push(s),i.push(c,t);break}default:{let r=e.text,i=r.startsWith(` `)||r.endsWith(` `)||r.includes(` `)?` xml:space="preserve"`:``,a=`<rect x="${X(n)}" y="${X(t-O)}" width="${X(e.width)}" height="${X(u.height)}"`,o=`<text x="${X(n+e.width/2)}" y="${X(t+D)}"${i}`;e.kind===0?j+=`<g class="pele-node pele-terminal">${a} rx="${X(O)}" fill="var(--_s)" stroke="var(--_b)"${p}/>${o} font-family="${Vp}">${Ec(r)}</text></g>`:e.kind===1?j+=`<g class="pele-node pele-nonterminal" data-id="${Y(e.id)}">${a} fill="var(--_bg)" stroke="var(--_b)"${p}${Up}/>${o}>${Ec(r)}</text></g>`:j+=`<g class="pele-node pele-special">${a} fill="var(--_bg)" stroke="var(--_b)" stroke-dasharray="4 3"${p}${Up}/>${o} font-style="italic"><tspan fill="var(--_m)">? </tspan>${Ec(r.slice(2,-2))}<tspan fill="var(--_m)"> ?</tspan></text></g>`}}}},P=``,F=w.width,I=m+T,L=m+w.height;for(let t of e.rules){let e=tM(t.definition,u,r?Math.max(80,(n.maxWidth??320)-2*m-4*d-2*Vj-1):1/0),i=Jj(t.name),a=I+E+Hj+e.up,o=m+2*d,c=o+Vj,l=c+e.width+Vj;k=``,A=``,j=``,M(o,a,c),M(c+e.width,a,l),N(e,c,a);let f=d>0?`<circle class="pele-marker pele-start" cx="${X(m+d)}" cy="${X(a)}" r="${X(d)}" fill="var(--_l)"/><circle class="pele-marker pele-end" cx="${X(l+d)}" cy="${X(a)}" r="${X(d)}" fill="var(--_l)"/>`:``;P+=`<g class="pele-rule" data-id="${Y(t.name)}"><text class="pele-rule-name" x="${X(m)}" y="${X(I+E/2+s*.35)}" font-size="${X(s)}" font-weight="var(--_hw)" text-anchor="start">${Ec(i)}</text><path class="pele-edge pele-track" d="${k}" fill="none" stroke="var(--_l)"${p}/>`+(A?`<path class="pele-marker" d="${A}" fill="var(--_l)"/>`:``)+f+j+`</g>`,F=Math.max(F,l+2*d-m,u.measurer.width(i,s,1)),L=a+e.down,I=L+u.sep+Uj}let R=Math.ceil(F+2*m),z=Math.ceil(L+m);return{svg:lm(`railroad`,R,z,i,n,e,Z(w,R/2,m+w.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(P?`<g class="pele-rules" transform="translate(0.5,0.5)" font-size="${X(o)}" text-anchor="middle">${P}</g>`:``)),width:R,height:z,links:[]}}var iM={type:`railroad`,parse:(e,t,n)=>Bj(e,n),render:nM},aM={REQUIREMENT:`Requirement`,FUNCTIONAL_REQUIREMENT:`Functional Requirement`,INTERFACE_REQUIREMENT:`Interface Requirement`,PERFORMANCE_REQUIREMENT:`Performance Requirement`,PHYSICAL_REQUIREMENT:`Physical Requirement`,DESIGN_CONSTRAINT:`Design Constraint`},oM={LOW_RISK:`Low`,MED_RISK:`Medium`,HIGH_RISK:`High`},sM={VERIFY_ANALYSIS:`Analysis`,VERIFY_DEMONSTRATION:`Demonstration`,VERIFY_INSPECTION:`Inspection`,VERIFY_TEST:`Test`},cM={CONTAINS:`contains`,COPIES:`copies`,DERIVES:`derives`,SATISFIES:`satisfies`,VERIFIES:`verifies`,REFINES:`refines`,TRACES:`traces`},lM=1e6,uM=class{type=`requirement`;direction=`TB`;requirements=new Map;elements=new Map;relations=[];classes=new Map;title;accTitle;accDescr;newId=``;newText=``;newRisk=``;newVerifyMethod=``;newElementType=``;newDocRef=``;styleCopies=0;copy(e,t){if(this.styleCopies+=t.length,this.styleCopies>lM)throw new jo(`Requirement diagram applies too many style declarations.`,`limit`,{type:`requirement`});for(let n of t)e.push(n)}setDirection(e){this.direction=e}addRequirement(e,t){let n=this.requirements.get(e);return n===void 0&&(n={name:e,type:t,requirementId:this.newId,text:this.newText,risk:this.newRisk,verifyMethod:this.newVerifyMethod,cssStyles:[],classes:[`default`]},this.requirements.set(e,n)),this.newId=this.newText=this.newRisk=this.newVerifyMethod=``,n}setNewReqId(e){this.newId=e}setNewReqText(e){this.newText=e}setNewReqRisk(e){this.newRisk=e}setNewReqVerifyMethod(e){this.newVerifyMethod=e}addElement(e){let t=this.elements.get(e);return t===void 0&&(t={name:e,type:this.newElementType,docRef:this.newDocRef,cssStyles:[],classes:[`default`]},this.elements.set(e,t)),this.newElementType=this.newDocRef=``,t}setNewElementType(e){this.newElementType=e}setNewElementDocRef(e){this.newDocRef=e}addRelationship(e,t,n){this.relations.push({type:e,src:t,dst:n})}node(e){return this.requirements.get(e)??this.elements.get(e)}setCssStyle(e,t){for(let n of e){let e=this.node(n);if(!t||!e)return;for(let n of t)this.copy(e.cssStyles,n.includes(`,`)?n.split(`,`):[n])}}setClass(e,t){for(let n of e){let e=this.node(n);if(e)for(let n of t){e.classes.push(n);let t=this.classes.get(n)?.styles;t&&this.copy(e.cssStyles,t)}}}defineClass(e,t){for(let n of e){let e=this.classes.get(n);e===void 0&&(e={id:n,styles:[],textStyles:[]},this.classes.set(n,e));for(let n of t)n.includes(`color`)&&e.textStyles.push(n.replace(`fill`,`bgFill`)),e.styles.push(n);let r=t.flatMap(e=>e.split(`,`));for(let e of this.requirements.values())e.classes.includes(n)&&this.copy(e.cssStyles,r);for(let e of this.elements.values())e.classes.includes(n)&&this.copy(e.cssStyles,r)}}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
130
|
+
`)}},dM=`$end.INVALID.title.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.direction_tb.direction_bt.direction_rl.direction_lr.NEWLINE.EOF.RD.STRUCT_START.STRUCT_STOP.STYLE_SEPARATOR.COLONSEP.ID.TEXT.RISK.VERIFYMTHD.REQUIREMENT.FUNCTIONAL_REQUIREMENT.INTERFACE_REQUIREMENT.PERFORMANCE_REQUIREMENT.PHYSICAL_REQUIREMENT.DESIGN_CONSTRAINT.LOW_RISK.MED_RISK.HIGH_RISK.VERIFY_ANALYSIS.VERIFY_DEMONSTRATION.VERIFY_INSPECTION.VERIFY_TEST.ELEMENT.CONTAINS.COPIES.DERIVES.SATISFIES.VERIFIES.REFINES.TRACES.TYPE.DOCREF.STYLE.CLASSDEF.CLASS.ALPHA.COLON.SEMICOLON.PERCENT.MINUS.BRKT.END_ARROW_L.END_ARROW_R.LINE.qString.unqString.COMMA`.split(`.`),fM=new Map([[`requirementdiagram`,14],[`id`,19],[`text`,20],[`risk`,21],[`verifymethod`,22],[`requirement`,23],[`functionalrequirement`,24],[`interfacerequirement`,25],[`performancerequirement`,26],[`physicalrequirement`,27],[`designconstraint`,28],[`low`,29],[`medium`,30],[`high`,31],[`analysis`,32],[`demonstration`,33],[`inspection`,34],[`test`,35],[`element`,36],[`contains`,37],[`copies`,38],[`derives`,39],[`satisfies`,40],[`verifies`,41],[`refines`,42],[`traces`,43],[`type`,44],[`docref`,45],[`style`,46],[`classdef`,47],[`class`,48]]),pM=/accTitle\s*:\s*/iy,mM=/accDescr\s*:\s*/iy,hM=/accDescr\s*\{\s*/iy,gM=/direction\s+(?:(TB)|(BT)|(RL)|LR)/gi,_M=/[\n\r\u2028\u2029]/g,vM=22,yM=new Uint8Array(128);for(let e of`:,\r
|
|
131
|
+
{<>-=`)yM[e.charCodeAt(0)]=1;function bM(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c=[[],[],[],[]],l=[[],[],[],[]],u=[0,0,0,0],d=!1,f=-1;gM.lastIndex=0;for(let t=gM.exec(e);t!==null;t=gM.exec(e)){let e=t[1]===void 0?t[2]===void 0?t[3]===void 0?3:2:1:0;c[e].push(t.index),l[e].push(gM.lastIndex),d=!0}let p=(t,a,o)=>{n.push(t),r.push(e.slice(a,o)),i.push(a),s=o},m=e=>{a.push(o),o=e},h=()=>{a.length>0&&(o=a.pop())},g=(t,n)=>(t.lastIndex=n,t.test(e)?t.lastIndex:-1),_=n=>{let r=e.indexOf(`
|
|
132
|
+
`,n);return r===-1?t:r},v=()=>{if(f<s){_M.lastIndex=s,f=_M.test(e)?_M.lastIndex-1:t;for(let e=0;e<4;e++){let t=c[e],n=u[e];for(;n<t.length&&t[n]<=f;)n++;u[e]=n}}for(let e=0;e<4;e++){let t=u[e]-1;if(t>=0&&c[e][t]>=s)return p(8+e,s,_(l[e][t])),!0}return!1},y=a=>{let o=a|32;if(o===116&&e.slice(s+1,s+5).toLowerCase()===`itle`&&J(e.charCodeAt(s+5))){let n=s+6;for(;n<t;){let t=e.charCodeAt(n);if(t===35||t===10||t===59)break;n++}if(n>s+6)return p(2,s,n),!0}if(o===97&&(e.charCodeAt(s+1)|32)==99&&(e.charCodeAt(s+2)|32)==99){let e;if((e=g(pM,s))>=0)return m(3),p(3,s,e),!0;if((e=g(mM,s))>=0)return m(4),p(5,s,e),!0;if((e=g(hM,s))>=0)return m(5),s=e,!0}if(d&&!Ns(a)&&v())return!0;if(a===10||a===13&&e.charCodeAt(s+1)===10){let n=s;for(;n<t;){let t=e.charCodeAt(n);if(t===10)n++;else if(t===13&&e.charCodeAt(n+1)===10)n+=2;else break}return p(12,s,n),!0}if(J(a)){for(s++;s<t&&J(e.charCodeAt(s));)s++;return!0}if(a===35||a===37)return s=_(s),!0;if(Ls(a)){let a=s+1;for(;a<t&&Ls(e.charCodeAt(a));)a++;if(a-s<=vM){let t=fM.get(e.slice(s,a).toLowerCase());if(t!==void 0)return(t===46||t===47||t===48)&&m(2),p(t,s,a),!0}for(;a<t;){let t=e.charCodeAt(a);if(t<128&&yM[t]===1)break;a++}return n.push(59),r.push(e.slice(s,a).trim()),i.push(s),s=a,!0}switch(a){case 123:return p(15,s,s+1),!0;case 125:return p(16,s,s+1),!0;case 58:return e.charCodeAt(s+1)===58&&e.charCodeAt(s+2)===58?p(17,s,s+3):p(18,s,s+1),!0;case 60:return e.charCodeAt(s+1)===45&&(p(55,s,s+2),!0);case 45:return e.charCodeAt(s+1)===62?p(56,s,s+2):p(57,s,s+1),!0;case 34:return m(1),s++,!0;case 44:return p(60,s,s+1),!0}return!1},b=n=>{if(Ls(n)){let n=s+1;for(;n<t&&Ls(e.charCodeAt(n));)n++;return p(49,s,n),!0}switch(n){case 58:return p(50,s,s+1),!0;case 59:return p(51,s,s+1),!0;case 37:return p(52,s,s+1),!0;case 45:return p(53,s,s+1),!0;case 35:return p(54,s,s+1),!0;case 32:return s++,!0;case 34:return m(1),s++,!0;case 10:return h(),s++,!0;case 44:return p(60,s,s+1),!0}return!1};for(;s<t;){let a=e.charCodeAt(s),c=!0;switch(o){case 0:c=y(a);break;case 2:c=b(a);break;case 1:if(a===34)h(),s++;else{let n=e.indexOf(`"`,s);p(58,s,n===-1?t:n)}break;case 3:h(),p(4,s,_(s));break;case 4:h(),p(6,s,_(s));break;case 5:if(a===125)h(),s++;else{let n=e.indexOf(`}`,s);p(7,s,n===-1?t:n)}}if(!c)return n.push(1),r.push(``),i.push(s),{types:n,texts:r,starts:i}}let x=o===0?13:o===1?58:o===3?4:o===4?6:o===5?7:-1;return x!==-1&&p(x,t,t),p(0,t,t),{types:n,texts:r,starts:i}}var xM=[aM.REQUIREMENT,aM.FUNCTIONAL_REQUIREMENT,aM.INTERFACE_REQUIREMENT,aM.PERFORMANCE_REQUIREMENT,aM.PHYSICAL_REQUIREMENT,aM.DESIGN_CONSTRAINT,oM.LOW_RISK,oM.MED_RISK,oM.HIGH_RISK,sM.VERIFY_ANALYSIS,sM.VERIFY_DEMONSTRATION,sM.VERIFY_INSPECTION,sM.VERIFY_TEST,``,cM.CONTAINS,cM.COPIES,cM.DERIVES,cM.SATISFIES,cM.VERIFIES,cM.REFINES,cM.TRACES];function SM(e){return e===49||e===50||e===54||e===53||e===51}function CM(e,t){let{types:n,texts:r,starts:i}=bM(e),a=0,o=[],s=[],c=(t,r=t,...o)=>{let s=n[a];if(s===1)throw zo(`requirement`,e,i[a],``,!0);for(let e=r;e>=t;e--)o.unshift(e);let c=o.map(e=>`'${dM[e]}'`).join(`, `);throw zo(`requirement`,e,i[a],`Expecting ${c}, got '${dM[s]}'`)},l=e=>(n[a]!==e&&c(e),r[a++]),u=(e,t)=>{let r=n[a];return(r<e||r>t)&&c(e,t),a++,xM[r-23]},d=()=>{let e=n[a];return e!==59&&e!==58&&c(58,59),r[a++]},f=()=>{let e=n[a];if(e===3)a++,t.setAccTitle(l(4).trim());else if(e===5)a++,t.setAccDescription(l(6).trim());else if(e===7)t.setAccDescription(r[a++].trim());else return!1;return!0},p=()=>{let e=[];for(;;){let t=n[a];if(t!==49&&t!==59&&t!==58&&c(58,59,49),e.push(r[a++]),n[a]!==60)return e;a++}},m=()=>{let e=[];for(;;){SM(n[a])||c(49,51,53,54);let t=r[a++];for(;SM(n[a]);)t+=r[a++];if(e.push(t),n[a]!==60)return e;a++}},h=()=>{let e;return n[a]===17?(a++,e=p(),l(15)):n[a]===15?a++:c(15,15,17),l(12),e},g=e=>{for(o.length=0,s.length=0;;){let t=n[a];if(t===16){a++;break}t===12?a++:((e?t<19||t>22:t!==44&&t!==45)&&(e&&c(19,22,12,16),c(44,45,12,16)),a++,l(18),s.push(t===21?u(29,31):t===22?u(32,35):d()),o.push(t),l(12))}for(let e=o.length-1;e>=0;e--){let n=s[e];switch(o[e]){case 19:t.setNewReqId(n);break;case 20:t.setNewReqText(n);break;case 21:t.setNewReqRisk(n);break;case 22:t.setNewReqVerifyMethod(n);break;case 44:t.setNewElementType(n);break;default:t.setNewElementDocRef(n)}}};for(;f();)n[a]===12&&a++;for(n[a]!==14&&c(14,14,3,5,7),a++,l(12);;){let e=n[a];if(e===13)return;if(e===12)a++;else{if(f())continue;if(e>=8&&e<=11)a++,t.setDirection(e===8?`TB`:e===9?`BT`:e===10?`RL`:`LR`);else if(e>=23&&e<=28){let e=u(23,28),n=d(),r=h();g(!0),t.addRequirement(n,e),r&&t.setClass([n],r)}else if(e===36){a++;let e=d(),n=h();g(!1),t.addElement(e),n&&t.setClass([e],n)}else if(e===46){a++;let e=p();t.setCssStyle(e,m())}else if(e===47){a++;let e=p();t.defineClass(e,m())}else if(e===48){a++;let e=p();t.setClass(e,p())}else if(e===59||e===58){let e=r[a++],i=n[a];if(i===17)a++,t.setClass([e],p());else if(i===55||i===57){a++;let n=u(37,43);l(i===57?56:57);let r=d();i===57?t.addRelationship(n,e,r):t.addRelationship(n,r,e)}else c(17,17,55,57)}else c(12,13,3,5,7,8,9,10,11,23,24,25,26,27,28,36,47,48,46,59,58)}}}function wM(e){let t=[];for(let n of e.requirements.values())t.push({id:n.name,requirement:n,element:void 0,cssStyles:n.cssStyles,cssClasses:n.classes.join(` `)});for(let n of e.elements.values())t.push({id:n.name,requirement:void 0,element:n,cssStyles:n.cssStyles,cssClasses:n.classes.join(` `)});let n=t=>e.requirements.has(t)||e.elements.has(t)?t:void 0;return{nodes:t,edges:e.relations.map((e,t)=>({id:`${e.src}-${e.dst}-${t}`,start:n(e.src),end:n(e.dst),type:e.type,contains:e.type===cM.CONTAINS})),direction:e.direction}}var TM=40,EM=16,DM=56,OM=14,kM=10,AM=2,jM=12,MM=120,NM=280,PM=240,FM=26,IM=6,LM=9,RM=4.5,zM=28,BM=14;function VM(e,t,n){if(t===0||e.lines.length===0)return e;let r=0,i=[],a=e.lines.map(a=>{let o=0,s=a.map(r=>{let i=r.style|t,a=r.icon!==void 0||r.math?r.width:n.width(r.text,e.size,i);return o+=a,{...r,style:i,width:a}});return i.push(o),o>r&&(r=o),s});return{...e,lines:a,widths:i,width:r}}function HM(e,t,n,r){let i=Hc(e),a=``,o=``;for(let s=0;s<e.lines.length;s++){let c=e.lines[s],l=n+bh(e,s);if(yh(c)){o+=Z(xh(e,s),t+e.widths[s]/2,l,r);continue}let u=l+e.size*.35,d=!0;for(let e of c)e.icon!==void 0||e.text===``||(a+=`<tspan${d?` x="${X(t)}" y="${X(u)}"`:``}${Vc(e.style&~i)}>${Ec(e.text)}</tspan>`,d=!1)}return(a===``?``:`<text${Uc(r,i)} text-anchor="start" xml:space="preserve">${a}</text>`)+o}function UM(e,t,n,r){let i=IM,a=e-n*i,o=t-r*i;return`<circle class="pele-marker" cx="${X(a)}" cy="${X(o)}" r="${i}"/><path class="pele-marker" d="M${X(a-n*i)},${X(o-r*i)}L${X(a+n*i)},${X(o+r*i)}M${X(a+r*i)},${X(o-n*i)}L${X(a-r*i)},${X(o+n*i)}"/>`}function WM(e,t,n,r){let i=e-n*LM,a=t-r*LM;return`<path class="pele-marker" d="M${X(i-r*RM)},${X(a+n*RM)}L${X(e)},${X(t)}L${X(i+r*RM)},${X(a-n*RM)}" stroke-linejoin="round"/>`}function GM(e,t,n){let r=new Map;for(let n of t){let t=n.route;if(!(n.src===n.dst||t.length<6))for(let i of[0,t.length-3]){let a=i===0?n.src:n.dst,o=e[a],s=t[i]-o.x,c=t[i+1]-o.y,l=i===0?3:i-3,u;if(Math.abs(Math.abs(c)-o.h/2)<.5)u=c<0?0:2;else if(Math.abs(Math.abs(s)-o.w/2)<.5)u=s<0?3:1;else continue;let d=a*4+u,f={route:t,at:i,toward:t[u%2==0?l:l+1]},p=r.get(d);p?p.push(f):r.set(d,[f])}}for(let[t,i]of r){if(i.length<2)continue;let r=t>>2,a=t%2==1,o=(a?n[r].h:n[r].w)-2*BM,s=Math.max(0,Math.min(zM,o/(i.length-1)));i.sort((e,t)=>e.toward-t.toward);for(let t=0;t<i.length;t++){let n=(t-(i.length-1)/2)*s;a?i[t].route[i[t].at+1]=e[r].y+n:i[t].route[i[t].at]=e[r].x+n}}}function KM(e,t,n){return Dh(e.direction)?Eh(n,r=>qM(e,t,n,r)):qM(e,t,n,!1)}function qM(e,t,n,r){let i=wM(e),a=n.fontSize??16,o=Math.round(a*.875),s=n.measurer??bc(n.fontFamily,n.fontFamilyMono),c=n.padding??8,l=new Map,u=[],d=[];for(let e of i.nodes){let t=nm(e.cssStyles),n=+!!t.bold|(t.italic?2:0),r=t.fontSize??a,i=t.fontSize??o,c=e.requirement,f=e.element,p=VM(Q(`«${c?c.type:`Element`}»`,!1,s,i,4e3),n,s),m=VM(Q(e.id,!0,s,r,NM),n|1,s),h=c?[[`ID`,c.requirementId],[`Text`,c.text],[`Risk`,c.risk],[`Verification`,c.verifyMethod]]:[[`Type`,f.type],[`Doc Ref`,f.docRef]],g=[],_=0,v=0,y=0;for(let[e,t]of h){if(!t)continue;let r=VM(Q(e,!1,s,i,4e3),n,s),a=VM(Q(t,!0,s,i,PM),n,s),o=Math.max(r.height,a.height);g.push({key:r,value:a,height:o}),_=Math.max(_,r.width),v=Math.max(v,a.width),y+=o+AM}g.length>0&&(y+=2*kM-AM);let b=2*kM+p.height+m.height,x=Math.max(MM,Math.max(p.width,m.width)+2*OM,g.length>0?_+jM+v+2*OM:0);l.has(e.id)||l.set(e.id,u.length);let S=op(x,b+y);S.seq=u.length,u.push({node:e,style:t,kind:p,name:m,rows:g,keyWidth:_,headHeight:b,w:x,h:b+y}),d.push(S)}let f=r?`TB`:Vf(i.direction),p=f===`LR`||f===`RL`,m=[],h=[],g=[];for(let e of i.edges){let t=e.start===void 0?void 0:l.get(e.start),n=e.end===void 0?void 0:l.get(e.end);if(t===void 0||n===void 0)continue;let r=Q(`«${e.type}»`,!1,s,o,4e3);t===n&&(p?d[t].h+=2*(FM+r.height+8):d[t].w+=2*(FM+r.width+12)),g.push(e),h.push(r),m.push({src:t,dst:n,minlen:1,labelW:r.width+12,labelH:r.height+4,route:[],labelX:0,labelY:0})}let _=lp(d,m,f,{nodeSep:TM,edgeSep:EM,rankSep:DM,portSep:20});GM(d,m,u);let v=g_(e.title,s,a,4e3),y=v.height>0?v.height+12:0,b=Math.max(_.width,v.width),x=c+(b-_.width)/2,S=c+y,C=Math.ceil(b+2*c),w=Math.ceil(_.height+y+2*c),T=``;for(let e=0;e<u.length;e++){let t=u[e],{w:n,h:r,style:i}=t,a=pl(i),o=a||` fill="var(--_m)"`,s=-n/2,c=-r/2,l=`<rect x="${X(s)}" y="${X(c)}" width="${X(n)}" height="${X(r)}" fill="var(--_s)" stroke="var(--_b)"${Kp(i.shape)}/>`+Z(t.kind,0,c+kM+t.kind.height/2,` class="pele-stereotype" font-size="${t.kind.size}"${o}${i.text}`)+Z(t.name,0,c+kM+t.kind.height+t.name.height/2,` class="pele-label" font-size="${t.name.size}" font-weight="var(--_hw)"${a}${i.text}`);if(t.rows.length>0){let e=c+t.headHeight;l+=`<path class="pele-divider" d="M${X(s)},${X(e)}H${X(-s)}" stroke="var(--_b)"${i.line}/>`;let n=e+kM,r=``;for(let e of t.rows)r+=HM(e.key,s+OM,n,` class="pele-field"${o}${i.text}`)+HM(e.value,s+OM+t.keyWidth+jM,n,` class="pele-value"${a}${i.text}`),n+=e.height+AM;l+=`<g class="pele-fields" font-size="${t.rows[0].key.size}">${r}</g>`}T+=`<g class="pele-node ${t.node.requirement?`pele-requirement`:`pele-element`}${im(t.node.cssClasses.replace(/^default\s?/,``))}" data-id="${Y(t.node.id)}" transform="translate(${X(d[e].x+x)},${X(d[e].y+S)})">${l}</g>`}let E=``,D=``,O=new Map;for(let e=0;e<m.length;e++){let t=m[e],n=g[e],r=h[e],i=n.contains?2*IM:0,a,o=t.labelX+x,s=t.labelY+S;if(t.src===t.dst){let e=u[t.src],n=d[t.src].x+x,r=d[t.src].y+S,c=O.get(t.src)??0;O.set(t.src,c+1);let l=(p?e.w:e.h)/2,f=Math.min(l-4,12+c*6),m=FM+c*8,h=(t,i)=>p?`${X(n+i)},${X(r+e.h/2+t)}`:`${X(n+e.w/2+t)},${X(r+i)}`,g=m/.75;a={d:`M${h(i,-f)}C${h(g,-f)} ${h(g,f)} ${h(0,f)}`,sx:p?n-f:n+e.w/2,sy:p?r+e.h/2:r-f,sdx:p?0:-1,sdy:p?-1:0,ex:p?n+f:n+e.w/2,ey:p?r+e.h/2:r+f,edx:p?0:-1,edy:p?-1:0},p?(o=n,s=r+e.h/2+m+4+t.labelH/2):(o=n+e.w/2+m+4+t.labelW/2,s=r)}else{let e=t.route.slice();for(let t=0;t<e.length;t+=3)e[t]+=x,e[t+1]+=S;a=yp(e,void 0,i,0)}E+=`<g class="pele-edge pele-relationship-${n.contains?`contains`:`arrow`}" data-id="${Y(n.id)}"><path d="${a.d}"${n.contains?``:` stroke-dasharray="5 4"`}/>`+(n.contains?UM(a.sx,a.sy,a.sdx,a.sdy):WM(a.ex,a.ey,a.edx,a.edy))+`</g>`,D+=Rp(n.id,r,o,s,``)}return{svg:lm(`requirement`,C,w,a,n,e,Z(v,C/2,c+v.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(E?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${E}</g>`:``)+(D?`<g class="pele-edge-labels" font-size="${o}" fill="var(--_m)">${D}</g>`:``)+`<g class="pele-nodes">${T}</g>`),width:C,height:w,links:[]}}var JM={type:`requirement`,math:!0,parse(e,t,n){let r=new uM;return n&&(r.title=n),CM(e,r),r},render:KM},YM=class{type=`sankey`;nodes=[];links=[];title;accTitle;accDescr;lookup=new Map;findOrCreateNode(e){let t=this.lookup.get(e);return t===void 0&&(t={id:e,index:this.nodes.length},this.lookup.set(e,t),this.nodes.push(t)),t}addLink(e,t,n){this.links.push({source:e,target:t,value:n})}},XM=[`$end`,`STUCK`,`SANKEY`,`NEWLINE`,`COMMA`,`DQUOTE`,`NON_ESCAPED_TEXT`,`ESCAPED_TEXT`,`EOF`];function ZM(e){return e>=32&&e<=126&&e!==34&&e!==44||e>=160&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}function QM(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c=(t,a,o)=>{n.push(t),r.push(e.slice(a,o)),i.push(a),s=o},l=t=>e.slice(s,s+t.length).toLowerCase()===t&&!Ls(e.charCodeAt(s+t.length));for(;s<t;){let u=e.charCodeAt(s),d=s,f=s;if(o===2){if(u===34&&e.charCodeAt(s+1)!==34){a.length>0&&(o=a.pop()),c(5,s,s+1);continue}for(;f<t;){let t=e.codePointAt(f);if(ZM(t)||t===44||t===13||t===10)f+=t>65535?2:1;else if(t===34&&e.charCodeAt(f+1)===34)f+=2;else break}c(7,s,f)}else{if(o===0&&(u|32)==115){let e=l(`sankey-beta`)?11:l(`sankey`)?6:0;if(e>0){a.push(o),o=1,c(2,s,s+e);continue}}if(u===10||u===13&&e.charCodeAt(s+1)===10){c(3,s,u===10?s+1:s+2);continue}if(u===44){c(4,s,s+1);continue}if(u===34){a.push(o),o=2,c(5,s,s+1);continue}for(;f<t;){let t=e.codePointAt(f);if(!ZM(t))break;f+=t>65535?2:1}c(6,s,f)}if(f===d)return c(1,s,s),{types:n,texts:r,starts:i}}return c(o===2?7:8,t,t),c(0,t,t),{types:n,texts:r,starts:i}}var $M=/[\n\r]+/g,eN=/[\x00-\x08\x0b\x0c\x0e-\x1f\ud800-\udfff\ufffe\uffff]/u;function tN(e){return e===10||e===13?!1:e<128?e===32||e===9||e===11||e===12:e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288||e===65279}function nN(e,t){let n=e.length;for(;n>0&&tN(e.charCodeAt(n-1));)n--;let r=``,i=0,a=!1;for(let o=0;o<n;){let n=e.charCodeAt(o);if(a)n===34&&(e.charCodeAt(o+1)===34?o++:a=!1),o++;else if(n===34)a=!0,o++;else if(tN(n)){let n=o+1;for(;tN(e.charCodeAt(n));)n++;let a=e.charCodeAt(o-1),s=e.charCodeAt(n);(o===0||s===10||s===13||(a===10||a===13)&&s!==44)&&(r+=e.slice(i,o),t.push([o,n,0]),i=n),o=n}else o++}return n<e.length&&t.push([n,e.length,0]),r+e.slice(i,n)}function rN(e,t){let n=[],r=nN(e,n),i=r.replace($M,`
|
|
133
|
+
`),a=i.trim();if(t!==void 0){let e=i.length-i.trimStart().length;t.push(n,Mo(r,$M,1),[[0,e,0],[e+a.length,i.length,0]])}return a}function iN(e,t,n=e){let{types:r,texts:i,starts:a}=QM(e),o=0,s=(t,r)=>{let i=[];return n!==e&&rN(n,i),zo(`sankey`,n,t>0&&t>=e.length?Po(i,e.length-1)+1:Po(i,t),r)},c=e=>{let t=r[o],n=t===1?XM[r[o-1]]:XM[t];throw s(a[o],`Expecting ${e}, got '${n}'`)},l=(e,t=``)=>{r[o]!==e&&c(`'${XM[e]}'${t}`),o++},u=()=>{if(r[o]===6)return i[o++];r[o]!==5&&c(`'DQUOTE', 'NON_ESCAPED_TEXT'`),o++,r[o]!==7&&c(`'ESCAPED_TEXT'`);let e=i[o++];return l(5),e},d=()=>{let e=a[o],t=u().trim().replaceAll(`""`,`"`);if(eN.test(Xo(t)))throw s(e,`Invalid XML character in node name`);return t};for(l(2),l(3);;){let e=d();l(4,`, 'NEWLINE', 'EOF'`);let n=d();l(4,`, 'NEWLINE', 'EOF'`);let i=a[o],c=parseFloat(u());if(!Number.isFinite(c))throw s(i,`Expecting a number`);let f=t.findOrCreateNode(e),p=t.findOrCreateNode(n);if(t.addLink(f,p,c),r[o]!==3)break;o++}r[o]===8&&o++,r[o]!==0&&c(`'NEWLINE', 'EOF'`)}var aN=6;function oN(e,t){if(e.length>8)e.sort(t);else for(let n=1;n<e.length;n++){let r=e[n],i=n-1;for(;i>=0&&t(e[i],r)>0;)e[i+1]=e[i],i--;e[i+1]=r}}function sN(e,t){let n=e.nodes.length,r=e.links.map(e=>({source:e.source.index,target:e.target.index,value:Number.isFinite(e.value)&&e.value>0?e.value:0,thickness:0,sourceY:0,targetY:0})),i=[],a=[];for(let e=0;e<n;e++)i.push([]),a.push([]);r.forEach((e,t)=>{i[e.source].push(t),a[e.target].push(t)});let o=new Int32Array(n),s=new Int32Array(n),c=[];for(let e=0;e<n;e++)s[e]=a[e].length,s[e]===0&&c.push(e);for(let e=0;e<c.length;e++){let t=c[e];for(let e of i[t]){let n=r[e].target;o[n]<o[t]+1&&(o[n]=o[t]+1),--s[n]===0&&c.push(n)}}if(c.length<n){let t=0;for(;s[t]===0;)t++;let i=new Uint8Array(n);for(;i[t]===0;){i[t]=1;for(let e of a[t])if(s[r[e].source]>0){t=r[e].source;break}}throw new jo(`Sankey diagrams cannot have circular links, and "${e.nodes[t].id}" is part of one.`,`semantic`,{type:`sankey`})}let l=1;for(let e=0;e<n;e++)o[e]+1>l&&(l=o[e]+1);let u=new Int32Array(n);for(let e=n-1;e>=0;e--){let t=c[e];for(let e of i[t])u[t]<u[r[e].target]+1&&(u[t]=u[r[e].target]+1)}let d=0;for(let e of r)e.value>d&&(d=e.value);let f=d>0?1/d:0,p=[],m=new Float64Array(n),h=[];for(let e=0;e<l;e++)h.push([]);let g=l>1?(t.width-t.nodeWidth)/(l-1):0;for(let e=0;e<n;e++){let n;if(t.alignment===`left`)n=o[e];else if(t.alignment===`right`)n=l-1-u[e];else if(t.alignment===`center`){if(n=o[e],a[e].length===0&&i[e].length>0){n=l;for(let t of i[e])o[r[t].target]-1<n&&(n=o[r[t].target]-1)}}else n=i[e].length>0?o[e]:l-1;let s=0,c=0,d=0,_=0;for(let t of a[e])s+=r[t].value*f,d+=r[t].value;for(let t of i[e])c+=r[t].value*f,_+=r[t].value;m[e]=Math.max(s,c),p.push({layer:n,value:Math.max(d,_),x:n*g,y:0,height:0}),h[n].push(e)}let _=1;for(let e of h)e.length>_&&(_=e.length);let v=_>1?Math.min(t.nodePadding,t.height/(_-1)):t.nodePadding,y=1/0;for(let e of h){let n=0;for(let t of e)n+=m[t];n>0&&(y=Math.min(y,(t.height-(e.length-1)*v)/n))}(!Number.isFinite(y)||y<0)&&(y=0);let b=Math.max(0,t.labelHeight-v),x=e=>{for(let n of h){let r=(n.length-1)*v;for(let t of n)r+=Math.max(m[t]*e,b);if(r>t.height+1e-6)return!1}return!0};if(b>0&&!x(y)){if(x(0)){let e=0;for(let t=0;t<40;t++){let t=(e+y)/2;x(t)?e=t:y=t}y=e}else b=0}let S=new Float64Array(n);for(let e of r)e.thickness=e.value*f*y;for(let e of h){let n=0;for(let t of e)p[t].height=m[t]*y,S[t]=Math.max(0,b-p[t].height)/2,p[t].y=n+S[t],n+=p[t].height+2*S[t]+v;let r=(t.height-n+v)/(e.length+1);e.forEach((e,t)=>p[e].y+=r*(t+1))}let C=e=>p[e].y+p[e].height/2,w=new Float64Array(r.length),T=new Float64Array(r.length),E=(e,t)=>C(r[e].target)-C(r[t].target)||e-t,D=(e,t)=>C(r[e].source)-C(r[t].source)||e-t,O=(e,t)=>C(e)-C(t)||e-t,k=e=>{let t=0;oN(i[e],E);for(let n of i[e])w[n]=t+r[n].thickness/2,t+=r[n].thickness},A=e=>{let t=0;oN(a[e],D);for(let n of a[e])T[n]=t+r[n].thickness/2,t+=r[n].thickness},j=()=>{for(let e=0;e<n;e++)k(e),A(e)},M=(e,n,o)=>{for(let t of e){let e=o?a[t]:i[t];if(e.length===0)continue;o?A(t):k(t);let s=0,c=0,l=0;for(let n of e){let e=o?p[r[n].source].y+w[n]-T[n]:p[r[n].target].y+T[n]-w[n];s+=e*r[n].thickness,c+=r[n].thickness,l+=C(o?r[n].source:r[n].target)-p[t].height/2}let u=c>0?s/c:l/e.length;p[t].y+=(u-p[t].y)*n}oN(e,O);let s=0;for(let t of e)p[t].y-S[t]<s&&(p[t].y=s+S[t]),s=p[t].y+p[t].height+S[t]+v;s=t.height;for(let t=e.length-1;t>=0;t--){let n=e[t];p[n].y+p[n].height+S[n]>s&&(p[n].y=s-p[n].height-S[n]),s=p[n].y-S[n]-v}};j();for(let e=0;e<aN;e++){let t=.99**e;for(let e=l-2;e>=0;e--)M(h[e],t,!1);j();for(let e=1;e<l;e++)M(h[e],t,!0);j()}for(let e=0;e<r.length;e++)r[e].sourceY=p[r[e].source].y+w[e],r[e].targetY=p[r[e].target].y+T[e];return{nodes:p,links:r}}var cN=6,lN=15,uN=1.8,dN=300;function fN(e){let t=2166136261,n=5381;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);t=Math.imul(t^i,16777619),n=Math.imul(n,33)+i|0}return(t>>>0).toString(36)+(n>>>0).toString(36)}function pN(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function mN(e,t,n,r,i){let a=e[t];return typeof a==`number`&&a>=r?Math.min(a,i):n}function hN(e,t){let n=e[t];return typeof n==`string`||typeof n==`number`&&Number.isFinite(n)?String(n):``}function gN(e){return Math.abs(e)<0x38d7ea4c68000?Math.round(e*100)/100:e}function _N(e){return typeof e==`string`?nm([`fill:${e}`]).shape:``}function vN(e,t,n){let r=pN(t.sankey)?t.sankey:{},i=mN(r,`width`,600,1,1e4);return Sh(n,i,160,t=>yN(e,r,n,t,i))}function yN(e,t,n,r,i){let a=n.fontSize??16,o=Math.round(a*.625),s=Math.max(o,Math.round(a*.875*Math.min(1,r/i))),c=n.measurer??bc(n.fontFamily,n.fontFamilyMono),l=n.padding??8,u=mN(t,`height`,400,1,1e4),d=Math.min(mN(t,`nodeWidth`,10,1,200),r),f=t.showValues!==!1,p=Xo(hN(t,`prefix`)),m=Xo(hN(t,`suffix`)),h=t.labelStyle===`outlined`,g=t.nodeAlignment===`left`||t.nodeAlignment===`right`||t.nodeAlignment===`center`?t.nodeAlignment:`justify`,_=typeof t.linkColor==`string`?t.linkColor:`gradient`,v=n=>sN(e,{width:r,height:u,nodeWidth:d,nodePadding:mN(t,`nodePadding`,12,0,200)+(f?lN:0),labelHeight:n*1.15,alignment:g}),y=v(s),b=new Map,x=1;for(let e of y.nodes){let t=(b.get(e.layer)??0)+1;b.set(e.layer,t),t>x&&(x=t)}let S=Math.max(o,Math.round(u/x/uN));S<s&&(s=S,y=v(s));let{nodes:C,links:w}=y,T=s*1.5,E=new Map;if(pN(t.nodeColors))for(let[e,n]of Object.entries(t.nodeColors)){let t=_N(n);t&&E.set(e,t)}let D=t=>E.get(e.nodes[t].id)??``,O=e=>/^ style="fill:(.*);"$/.exec(D(e))?.[1]??om(e),k=0,A=0;C.forEach(e=>{e.value>A&&(A=e.value,k=e.layer)});let j=0,M=r,N=0,P=u,F=C.map((t,n)=>{let i=Xo(e.nodes[n].id),a=f?`${p}${gN(t.value)}${m}`:``,o=c.width(a?`${i} ${a}`:i,s,0),l=h?t.layer>=k:t.x<r/2,u=l?t.x+d+cN:t.x-cN,g=t.y+t.height/2;return j=Math.min(j,l?u:u-o),M=Math.max(M,l?u+o:u),N=Math.min(N,g-s*.75),P=Math.max(P,g+s*.75),{value:a,width:o,after:l,left:l?u:u-o,y:g}}),I=new Map;if(C.length<=dN)for(let e of F){let t=Math.floor(e.y/T);for(let n of[t-2,t-1,t,t+1,t+2]){let t=I.get(n);t?t.push(e):I.set(n,[e])}}let L=``,R=``;C.forEach((t,n)=>{let r=e.nodes[n].id,i=Xo(r),a=Math.max(t.height,1);R+=`<rect class="pele-sankey-node" data-id="${Y(r)}" x="${X(t.x)}" y="${X(t.y)}" width="${X(d)}" height="${X(a)}" rx="${X(Math.min(2,a/2))}" fill="${om(n)}"${D(n)}/>`;let o=F[n],c=(e,t)=>(I.get(Math.floor(t/T))??[]).some(n=>n!==o&&Math.abs(n.y-t)<T&&e<n.left+n.width+cN&&e+o.width>n.left-cN);if(C.length<=dN&&c(o.left,o.y))e:for(let e of[0,-T,T])for(let r of[o.after,!o.after]){let i=r?t.x+d+cN:t.x-cN-o.width,a=o.y+e;if(c(i,a)||i<j||i+o.width>M||a-s*.75<N||a+s*.75>P||C.some((e,t)=>t!==n&&i<e.x+d+cN&&i+o.width>e.x-cN&&a-s*.75<e.y+e.height&&a+s*.75>e.y))continue;let l=Math.max(0,t.y-a,a-t.y-t.height);if(!C.some((e,r)=>r!==n&&e.x===t.x&&Math.max(0,e.y-a,a-e.y-e.height)<=l)){o.left=i,o.y=a,o.after=r;break e}}let{value:l,after:u,y:f}=o,p=` x="${X(u?t.x+d+cN:t.x-cN)}" y="${X(f+s*.35)}" text-anchor="${u?`start`:`end`}"`,m=Ec(i)+(l?` <tspan class="pele-sankey-value" fill="var(--_m)">${Ec(l)}</tspan>`:``);L+=`<g class="pele-label" data-id="${Y(r)}">`+(h?`<text${p} fill="none" stroke="var(--_bg)" stroke-width="3" stroke-linejoin="round">${Ec(i)}${l?` `+Ec(l):``}</text>`:``)+`<text${p}>${m}</text></g>`});let z=_===`gradient`||_===`source`||_===`target`?``:_N(_),B=n.idPrefix??``,V=_===`gradient`&&/^[\w-]+$/.test(B),H=new Map,U=``;for(let t of w){let n=_===`target`?t.target:t.source,r=Math.max(t.thickness,1)/2,i=C[t.source].x+d,a=C[t.target].x,o=`fill="${om(n)}"${z||D(n)}`;if(V){let e=`x1="${X(i)}" x2="${X(a)}"><stop offset="0" stop-color="${O(t.source)}"/><stop offset="1" stop-color="${O(t.target)}"/>`,n=`${B}-sankey-${fN(e)}`;H.set(n,`<linearGradient id="${n}" gradientUnits="userSpaceOnUse" ${e}</linearGradient>`),o=`fill="url(#${n}) ${O(t.source)}"`}let s=X((i+a)/2),c=Y(e.nodes[t.source].id),l=Y(e.nodes[t.target].id);U+=`<path class="pele-sankey-link" data-id="${c}->${l}" d="M${X(i)},${X(t.sourceY-r)}C${s},${X(t.sourceY-r)} ${s},${X(t.targetY-r)} ${X(a)},${X(t.targetY-r)}L${X(a)},${X(t.targetY+r)}C${s},${X(t.targetY+r)} ${s},${X(t.sourceY+r)} ${X(i)},${X(t.sourceY+r)}Z" ${o}><title>${c} → ${l}: ${Ec(p)}${gN(t.value)}${Ec(m)}</title></path>`}let ee=Q(e.title,!1,c,a,Ch(n),1),te=ee.height>0?ee.height+12:0,W=Math.max(M-j,ee.width),ne=l-j+(W-(M-j))/2,G=l+te-N,re=Math.ceil(W+2*l),K=Math.ceil(P-N+te+2*l);return{svg:lm(`sankey`,re,K,a,n,e,Z(ee,re/2,l+ee.height/2,` class="pele-title" font-weight="var(--_tw)"`)+`<g transform="translate(${X(ne)},${X(G)})">`+(H.size>0?`<defs>${[...H.values()].join(``)}</defs>`:``)+`<g class="pele-sankey-links" fill-opacity="0.4">${U}</g><g class="pele-sankey-nodes">${R}</g><g class="pele-labels" font-size="${s}">${L}</g></g>`),width:re,height:K,links:[]}}var bN={type:`sankey`,parse(e,t,n){let r=new YM;return n&&(r.title=n),iN(rN(e),r,e),r},render:vN},xN=`aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple rebeccapurple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen transparent currentcolor inherit initial unset revert accentcolor accentcolortext activetext buttonborder buttonface buttontext canvas canvastext field fieldtext graytext highlight highlighttext linktext mark marktext selecteditem selecteditemtext visitedtext activeborder activecaption appworkspace background buttonhighlight buttonshadow captiontext inactiveborder inactivecaption inactivecaptiontext infobackground infotext menu menutext scrollbar threeddarkshadow threedface threedhighlight threedlightshadow threedshadow window windowframe windowtext`,SN,CN=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?(%|deg|grad|rad|turn)?$/i;function wN(e){if(e.toLowerCase()===`none`)return 4;let t=CN.exec(e);return t?t[1]===void 0?1:t[1]===`%`?2:3:0}function TN(e,t){let n=wN(e);return n===1||n===2||t&&n===4}function EN(e){let t=e.startsWith(`hsl`),n=e.indexOf(`(`),r=e.slice(0,n);if(r!==`rgb`&&r!==`rgba`&&r!==`hsl`&&r!==`hsla`||e.length>120||e.indexOf(`)`)!==e.length-1)return!1;let i=e.slice(n+1,-1).trim(),a,o,s=i.includes(`,`);if(s)a=i.split(`,`).map(e=>e.trim()),a.length===4&&(o=a.pop());else{let e=i.split(`/`);if(e.length>2)return!1;a=e[0].trim().split(/\s+/),e.length===2&&(o=e[1].trim())}if(a.length!==3||o!==void 0&&!TN(o,!s))return!1;let c=a.map(wN);if(s)return t?(c[0]===1||c[0]===3)&&c[1]===2&&c[2]===2:(c[0]===1||c[0]===2)&&c[1]===c[0]&&c[2]===c[0];for(let e=0;e<3;e++){let n=c[e];if(!(n===1||n===4||(t&&e===0?n===3:n===2)))return!1}return!0}function DN(e){return e.includes(`(`)?EN(e):(SN??=new Set(xN.split(` `)),SN.has(e.toLowerCase()))}var ON=/^:?wrap:/,kN=/^:?nowrap:/,AN=/^:?(?:no)?wrap:/,jN=/^(?:rgba?|hsla?)\s*\(/,MN=/[\r\u2028\u2029]/,NN=/^\w*/;function PN(e){throw new jo(e,`semantic`,{type:`sequence`})}function FN(e){let t=e.trim(),n=ON.test(t)?!0:!kN.test(t)&&void 0;return{text:(n===void 0?t:t.replace(AN,``)).trim(),wrap:n}}function IN(e){let t=jN.exec(e);if(t){let n=e.lastIndexOf(`)`);if(n>=t[0].length)return MN.test(e.slice(t[0].length))?void 0:[e.slice(0,n+1),e.slice(n+1)]}if(MN.test(e))return;let n=NN.exec(e)[0];return[n,e.slice(n.length)]}function LN(e){return typeof e==`string`?[...e].map((e,t)=>[String(t),e]):typeof e==`object`&&e?Object.entries(e):[]}var RN=class{type=`sequence`;actors=new Map;createdActors=new Map;destroyedActors=new Map;boxes=[];messages=[];notes=[];title;accTitle;accDescr;prevActor;currentBox;lastCreated;lastDestroyed;wrapEnabled;sequenceWrap;active=new Map;constructor(e={}){this.wrapEnabled=e.wrap,this.sequenceWrap=e.sequenceWrap??!1}autoWrap(){return this.wrapEnabled??this.sequenceWrap}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
134
|
+
`)}setDiagramTitle(e){this.title=e}parseMessage(e){return FN(e)}parseBoxData(e){let t=IN(e),n=t?.[0]?t[0].trim():`transparent`,r=t?.[1]?t[1].trim():void 0;if(DN(n)||(n=`transparent`,r=e.trim()),r===void 0)return{text:void 0,color:n,wrap:void 0};let{text:i,wrap:a}=FN(r);return{text:i||void 0,color:n,wrap:a}}addBox(e){this.currentBox={name:e.text,wrap:e.wrap??this.autoWrap(),fill:e.color,actorKeys:[]},this.boxes.push(this.currentBox)}addActor(e,t,n,r,i){let a=this.currentBox,o;if(i!==void 0){let t;try{t=js(i.includes(`
|
|
135
|
+
`)?i+`
|
|
136
|
+
`:`{
|
|
137
|
+
`+i+`
|
|
138
|
+
}`)}catch(t){throw new jo(`Config of participant "${e}" is not valid YAML. ${t.message}`,`syntax`,{type:`sequence`})}typeof t==`object`&&t&&!Array.isArray(t)&&(o=t)}let s=o&&Object.prototype.hasOwnProperty.call(o,`type`)?o.type:void 0,c=o&&Object.prototype.hasOwnProperty.call(o,`alias`)?o.alias:void 0;s!=null&&(r=String(s)),c&&(!n||n.text===t)&&(n={text:String(c),wrap:n?.wrap,type:r});let l=this.actors.get(e);if(!(l&&(this.currentBox&&l.box&&this.currentBox!==l.box&&PN(`A same participant should only be defined in one Box: ${l.name} can't be in '${l.box.name}' and in '${this.currentBox.name}' at the same time.`),a=l.box?l.box:this.currentBox,l.box=a,t===l.name&&n==null))){if((n?.text==null||r==null)&&(n={text:t,type:r}),this.actors.set(e,{box:a,name:t,description:n.text,wrap:n.wrap??this.autoWrap(),prevActor:this.prevActor,links:new Map,properties:new Map,type:r??`participant`}),this.prevActor){let t=this.actors.get(this.prevActor);t&&(t.nextActor=e)}this.currentBox&&this.currentBox.actorKeys.push(e),this.prevActor=e}}addMessage(e,t,n,r){this.messages.push({id:String(this.messages.length),from:e,to:t,message:n.text,wrap:n.wrap??this.autoWrap(),answer:r})}addSignal(e,t,n,r,i=!1,a){if(r===18){let t=e?this.active.get(e)??0:0;t<1&&PN(`Trying to inactivate an inactive participant (${e})`),this.active.set(e,t-1)}else r===17&&e&&this.active.set(e,(this.active.get(e)??0)+1);return this.messages.push({id:String(this.messages.length),from:e,to:t,message:n?.text??``,wrap:n?.wrap??this.autoWrap(),type:r,activate:i,centralConnection:a??0}),!0}addNote(e,t,n){let r=n.wrap??this.autoWrap(),i={actor:e,placement:t,message:n.text,wrap:r},a=typeof e==`string`?[e,e]:e;this.notes.push(i),this.messages.push({id:String(this.messages.length),from:a[0],to:a[1],message:n.text,wrap:r,type:2,placement:t})}addLinks(e,t){let n=this.actors.get(e);if(n)try{let e=JSON.parse(t.text);for(let[t,r]of LN(e))n.links.set(t,r)}catch{return}}addALink(e,t){let n=this.actors.get(e);if(!n)return;let r=t.text.indexOf(`@`);n.links.set(t.text.slice(0,r-1).trim(),t.text.slice(r+1).trim())}addProperties(e,t){let n=this.actors.get(e);if(n)try{let e=JSON.parse(t.text);for(let[t,r]of LN(e))n.properties.set(t,r)}catch{return}}addDetails(e,t){let n=this.actors.get(e);n&&(n.details=t.text)}apply(e){let t=[],n=[],r=e;for(;;){r!==void 0&&(Array.isArray(r)?(t.push(r),n.push(0)):typeof r!=`string`&&this.applyOne(r));let e=t.length-1;if(e<0)return;let i=t[e];n[e]<i.length?r=i[n[e]++]:(t.pop(),n.pop(),r=void 0)}}applyOne(e){let t=e.actor;switch(e.type){case`sequenceIndex`:this.messages.push({id:String(this.messages.length),from:void 0,to:void 0,message:{start:e.sequenceIndex,step:e.sequenceIndexStep,visible:e.sequenceVisible===!0},wrap:!1,type:e.signalType});break;case`addParticipant`:this.addActor(t,t,e.description,e.draw,e.config);break;case`createParticipant`:this.actors.has(t)&&PN(`It is not possible to have actors with the same id, even if one is destroyed before the next is created. Use 'AS' aliases to simulate the behavior`),this.lastCreated=t,this.addActor(t,t,e.description,e.draw,e.config),this.createdActors.set(t,this.messages.length);break;case`destroyParticipant`:this.lastDestroyed=t,this.destroyedActors.set(t,this.messages.length);break;case`activeStart`:case`activeEnd`:case`centralConnection`:case`centralConnectionReverse`:this.addSignal(t,void 0,void 0,e.signalType);break;case`addNote`:this.addNote(e.actor,e.placement,e.text);break;case`addLinks`:this.addLinks(t,e.text);break;case`addALink`:this.addALink(t,e.text);break;case`addProperties`:this.addProperties(t,e.text);break;case`addDetails`:this.addDetails(t,e.text);break;case`addMessage`:this.lastCreated?(e.to!==this.lastCreated&&PN(`The created participant ${this.lastCreated} does not have an associated creating message after its declaration. Please check the sequence diagram.`),this.lastCreated=void 0):this.lastDestroyed&&=(e.to!==this.lastDestroyed&&e.from!==this.lastDestroyed&&PN(`The destroyed participant ${this.lastDestroyed} does not have an associated destroying message after its declaration. Please check the sequence diagram.`),void 0),this.addSignal(e.from,e.to,e.msg,e.signalType,e.activate,e.centralConnection);break;case`boxStart`:this.addBox(e.boxData);break;case`boxEnd`:this.currentBox=void 0;break;case`loopStart`:this.addSignal(void 0,void 0,e.loopText,e.signalType);break;case`rectStart`:this.addSignal(void 0,void 0,e.color,e.signalType);break;case`optStart`:this.addSignal(void 0,void 0,e.optText,e.signalType);break;case`altStart`:case`else`:this.addSignal(void 0,void 0,e.altText,e.signalType);break;case`parStart`:case`and`:this.addSignal(void 0,void 0,e.parText,e.signalType);break;case`criticalStart`:this.addSignal(void 0,void 0,e.criticalText,e.signalType);break;case`option`:this.addSignal(void 0,void 0,e.optionText,e.signalType);break;case`breakStart`:this.addSignal(void 0,void 0,e.breakText,e.signalType);break;case`loopEnd`:case`rectEnd`:case`optEnd`:case`altEnd`:case`parEnd`:case`criticalEnd`:case`breakEnd`:this.addSignal(void 0,void 0,void 0,e.signalType)}}},zN=`$end.INVALID.INVALID.NEWLINE.SD.create.box.restOfLine.end.autonumber.NUM.off.activate.deactivate.title.legacy_title.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.loop.rect.opt.alt.par.par_over.critical.break.option.and.else.participant.AS.participant_actor.destroy.note.over.links.link.properties.details.,.left_of.right_of.+.-.().ACTOR.CONFIG_START.CONFIG_CONTENT.CONFIG_END.TXT.SOLID_OPEN_ARROW.DOTTED_OPEN_ARROW.SOLID_ARROW.BIDIRECTIONAL_SOLID_ARROW.DOTTED_ARROW.BIDIRECTIONAL_DOTTED_ARROW.SOLID_CROSS.DOTTED_CROSS.SOLID_POINT.DOTTED_POINT.SOLID_ARROW_TOP.SOLID_ARROW_BOTTOM.STICK_ARROW_TOP.STICK_ARROW_BOTTOM.SOLID_ARROW_TOP_DOTTED.SOLID_ARROW_BOTTOM_DOTTED.STICK_ARROW_TOP_DOTTED.STICK_ARROW_BOTTOM_DOTTED.SOLID_ARROW_TOP_REVERSE.SOLID_ARROW_BOTTOM_REVERSE.STICK_ARROW_TOP_REVERSE.STICK_ARROW_BOTTOM_REVERSE.SOLID_ARROW_TOP_REVERSE_DOTTED.SOLID_ARROW_BOTTOM_REVERSE_DOTTED.STICK_ARROW_TOP_REVERSE_DOTTED.STICK_ARROW_BOTTOM_REVERSE_DOTTED`.split(`.`),BN=new Uint8Array(128);for(let e=0;e<128;e++){let t=String.fromCharCode(e),n=e===32||e>=9&&e<=13,r=0;`/\\+()<->:
|
|
139
|
+
,;`.includes(t)||(r|=1),`+<->:
|
|
140
|
+
,;`.includes(t)||(r|=2),`<>:
|
|
141
|
+
,;@`.includes(t)||(r|=8|(n?0:4)),`#
|
|
142
|
+
;`.includes(t)||(r|=16),!`/\\+()<>:
|
|
143
|
+
,;-`.includes(t)&&!n&&(r|=32),BN[e]=r}function VN(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c=-1,l=(t,a,o)=>{n.push(t),r.push(e.slice(a,o)),i.push(a),s=o},u=(e,t,a,o)=>{n.push(e),r.push(o),i.push(t),s=a},d=e=>{a.push(o),o=e},f=()=>{a.length>0&&(o=a.pop())},p=n=>(c<n&&(c=e.indexOf(`
|
|
144
|
+
`,n),c===-1&&(c=t)),c),m=(t,n)=>{let r=e.charCodeAt(t);return r<128?(BN[r]&n)!==0:n===4||n===32?!J(r):!0},h=(t,n)=>{for(let r=0;r<n.length;r++){let i=n.charCodeAt(r),a=e.charCodeAt(t+r);if(i>=97&&i<=122?(a|32)!==i:a!==i)return!1}return!0},g=t=>h(s,t)&&!Ls(e.charCodeAt(s+t.length)),_=n=>{for(;n<t&&J(e.charCodeAt(n));)n++;return n},v=()=>{let n=s;for(;n<t;){let t=e.charCodeAt(n);if(t===10||!J(t))break;n++}return n!==s&&(s=n,!0)},y=e=>{for(;e<t&&m(e,16);)e++;return e},b=(e,t,n)=>{l(e,s,s+t),d(n)},x=(e,t,n=-1)=>g(e)?(l(t,s,s+e.length),n>=0&&d(n),!0):!1,S=(n,r)=>{if(!h(s,n))return!1;let i=s+n.length,a=e.charCodeAt(i);if(a!==32&&a!==9)return!1;for(;a===32||a===9;)a=e.charCodeAt(++i);return i>=t||!m(i,32)?!1:(l(r,s,s+n.length),!0)},C=t=>{let n=e.charCodeAt(t),r=e.charCodeAt(t+1);if(n===45){if(r===120||r===88||r===41||r===92||r===47||r===45)return!0;let n=e.charCodeAt(t+2);return r===124&&(n===92||n===47)}return n===47||n===92?(r===124||r===n)&&e.charCodeAt(t+2)===45:n===40&&r===41},w=()=>{let n=s+1;for(;n<t&&m(n,1);)n++;for(;n<t&&!C(n);){let r=n;for(;e.charCodeAt(r)===45;)r++;if(r>=t||!m(r,2))break;for(r++;r<t&&m(r,2);)r++;n=r}u(48,s,n,e.slice(s,n).trim())},T=()=>{let t=s;for(;Ps(e.charCodeAt(t));)t++;let n=t>s;if(e.charCodeAt(t)===46&&Ps(e.charCodeAt(t+1))){let n=Ps(e.charCodeAt(t+2))?t+3:t+2,r=e.charCodeAt(n);if(r===32||r===10)return l(10,s,n),!0}let r=e.charCodeAt(t);return n&&(r===32||r===10)?(l(10,s,t),!0):!1},E=()=>{let t=e.charCodeAt(s+1),n=e.charCodeAt(s+2);if(t===62)l(n===62?55:53,s,s+(n===62?3:2));else if(t===120||t===88)l(59,s,s+2);else if(t===41)l(61,s,s+2);else if(t===124&&n===92)l(63,s,s+3);else if(t===124&&n===47)l(64,s,s+3);else if(t===92&&n===92)l(65,s,s+3);else if(t===47&&n===47)l(66,s,s+3);else if(t===45){let t=e.charCodeAt(s+3);n===62?l(t===62?57:54,s,s+(t===62?4:3)):n===120||n===88?l(60,s,s+3):n===41?l(62,s,s+3):n===124&&t===92?l(67,s,s+4):n===124&&t===47?l(68,s,s+4):n===92&&t===92?l(69,s,s+4):n===47&&t===47?l(70,s,s+4):l(46,s,s+1)}else l(46,s,s+1)},D=t=>{let n=e.charCodeAt(s+1);if(n!==124&&n!==t||e.charCodeAt(s+2)!==45)return!1;let r=e.charCodeAt(s+3)===45,i=t===47,a;return a=n===124?r?i?75:76:i?71:72:r?i?77:78:i?73:74,l(a,s,s+(r?4:3)),!0},O=()=>{if(!h(s,`title`))return!1;let n=s+5,r=e.charCodeAt(n)===58;r&&n++;let i=n;for(;i<t&&e.charCodeAt(i)!==10&&J(e.charCodeAt(i));)i++;if(i===t||e.charCodeAt(i)===10)return s=i,!0;let a=e.charCodeAt(n);return!J(a)||a===13||!m(n+1,16)?!1:(l(r?15:14,s,y(n+1)),!0)},k=()=>{let t=h(s,`accdescr`);if(!t&&!h(s,`acctitle`))return!1;let n=_(s+8),r=e.charCodeAt(n);return r===58?(l(t?18:16,s,_(n+1)),d(t?6:5),!0):t&&r===123?(s=_(n+1),d(7),!0):!1},A=e=>{switch(e|32){case 97:return x(`actor`,34,1)||x(`alt`,24,3)||x(`and`,30,3)||x(`activate`,12,1)||k()||x(`autonumber`,9);case 98:return x(`box`,6,3)||x(`break`,28,3);case 99:return x(`create`,5)||x(`critical`,27,3);case 100:return x(`destroy`,35,1)||S(`details`,41)||x(`deactivate`,13,1);case 101:return x(`else`,31,3)||x(`end`,8);case 108:return x(`loop`,21,3)||x(`left of`,43)||S(`links`,38)||S(`link`,39);case 110:return x(`note`,36);case 111:return x(`opt`,23,3)||x(`option`,29,3)||x(`over`,37)||x(`off`,11);case 112:return x(`participant`,32,1)||x(`par`,25,3)||x(`par_over`,26,3)||S(`properties`,40);case 114:return x(`rect`,22,3)||x(`right of`,44);case 115:return x(`sequencediagram`,4);case 116:return O();default:return!1}},j=()=>{let t=e.charCodeAt(s);if(t===10){let t=s+1;for(;e.charCodeAt(t)===10;)t++;l(3,s,t)}else if(J(t))s=_(s+1);else if(t===35||t===37&&e.charCodeAt(s+1)!==123)s=p(s);else if((!Ps(t)&&t!==46||!T())&&!(t<128&&(t|32)>=97&&(t|32)<=122&&A(t))){if(t===44)l(42,s,s+1);else if(t===59)l(3,s,s+1);else if(m(s,1))w();else if(t===45)E();else if(t===60&&e.startsWith(`<<->>`,s))l(56,s,s+5);else if(t===60&&e.startsWith(`<<-->>`,s))l(58,s,s+6);else{if((t===47||t===92)&&D(t))return;t===58?l(52,s,y(s+1)):t===43?l(45,s,s+1):t===40&&e.charCodeAt(s+1)===41?l(47,s,s+2):l(2,s,s+1)}}},M=()=>{if(v())return!0;let n=e.charCodeAt(s);if(n===35)return s=p(s),!0;if(n===64&&e.charCodeAt(s+1)===123)return b(49,2,4),!0;let r=s;for(;r<t&&m(r,4);)r++;if(r>s){let t=_(r);if(e.charCodeAt(t)===64&&e.charCodeAt(t+1)===123)return l(48,s,r),!0;if(t>r&&h(t,`as`)&&J(e.charCodeAt(t+2)))return l(48,s,r),d(2),!0}let i=r;for(;i<t&&m(i,8);)i++;if(i>s){let n=e.charCodeAt(i),r=i;if(i<t&&n!==10&&n!==59)for(r--;r>s&&e.charCodeAt(r)!==35;)r--;if(r>s)return u(48,s,r,e.slice(s,r).trim()),f(),!0}if(e.charCodeAt(i)===60)return l(2,s,p(s)),f(),!0;if(n!==10){let t=p(s);return u(2,s,t,e.slice(s,t).trim()),f(),!0}return!1},N=()=>{switch(o){case 0:return j(),!0;case 1:return M();case 2:return v()?!0:e.charCodeAt(s)===35?(s=p(s),!0):(f(),f(),g(`as`)?b(33,2,3):l(3,s,s),!0);case 3:return v()?!0:e.charCodeAt(s)===35?(s=p(s),!0):(l(7,s,y(s)),f(),!0);case 4:if(e.charCodeAt(s)!==125){let n=e.indexOf(`}`,s);return n===-1&&(n=t),l(50,s,n),!0}{let t=_(s+1),n=t>s+1&&h(t,`as`)&&J(e.charCodeAt(t+2));return l(51,s,s+1),f(),n?d(2):f(),!0}case 5:case 6:return l(o===5?17:19,s,p(s)),f(),!0;default:if(e.charCodeAt(s)===125)s++,f();else{let n=e.indexOf(`}`,s);n===-1&&(n=t),l(20,s,n)}return!0}};for(;s<t;)if(!N())return n.push(1),r.push(``),i.push(s),{types:n,texts:r,starts:i};return o===0||o===2?l(3,t,t):o===3?l(7,t,t):o===5?l(17,t,t):o===6?l(19,t,t):o===7&&l(20,t,t),n.push(0),r.push(``),i.push(t),{types:n,texts:r,starts:i}}var HN=new Int8Array(79).fill(-1);HN[53]=5,HN[54]=6,HN[55]=0,HN[57]=1,HN[56]=33,HN[58]=34,HN[59]=3,HN[60]=4,HN[61]=24,HN[62]=25,HN[63]=41,HN[64]=42,HN[65]=43,HN[66]=44,HN[67]=51,HN[68]=52,HN[69]=53,HN[70]=54,HN[71]=45,HN[72]=46,HN[73]=47,HN[74]=48,HN[75]=55,HN[76]=56,HN[77]=57,HN[78]=58;var UN=new Int8Array(79).fill(-1);UN[21]=2,UN[22]=3,UN[23]=4,UN[28]=5,UN[24]=6,UN[25]=7,UN[26]=7,UN[27]=8,UN[6]=1;var WN=`'SOLID_OPEN_ARROW', 'DOTTED_OPEN_ARROW', 'SOLID_ARROW', 'DOTTED_ARROW', 'SOLID_CROSS', 'DOTTED_CROSS', 'SOLID_POINT', 'DOTTED_POINT'`;function GN(e,t){let{types:n,texts:r,starts:i}=VN(e),a=0,o=t=>{let r=n[a];throw r===1?zo(`sequence`,e,i[a],``,!0):zo(`sequence`,e,i[a],`Expecting ${t}, got '${zN[r]}'`)},s=e=>(n[a]!==e&&o(`'${zN[e]}'`),r[a++]),c=()=>{let e=n[a];return e!==48&&e!==39&&o(`'ACTOR'`),{type:`addParticipant`,actor:r[a++]}},l=()=>t.parseMessage(s(52).trim().substring(1)),u=()=>{let e=n[a++];if(e===35){let e=c();return s(3),e.type=`destroyParticipant`,e}let r=c();if(n[a]===49&&n[a-1]===48){a++;let e=s(50);s(51),r.config=e.trim()}if(r.draw=e===32?`participant`:`actor`,n[a]===33){a++;let e=s(7);s(3),r.description=t.parseMessage(e)}else n[a]===3?a++:o(`'AS', 'NEWLINE'`);return r},d=e=>{let t=!1;n[a]===47&&(t=!0,a++);let r=HN[n[a]];r<0&&o(WN),a++;let i=n[a];i!==47&&(t||i!==45&&i!==46)||a++;let s=c(),u=l(),d={type:`addMessage`,from:e.actor,to:s.actor,signalType:r,msg:u},f=[e,s,d];if(t){let t=i===47;d.activate=t,d.centralConnection=t?61:60,t&&f.push({type:`centralConnection`,signalType:59,actor:s.actor}),f.push({type:`centralConnectionReverse`,signalType:60,actor:e.actor})}else i===45?(d.activate=!0,f.push({type:`activeStart`,signalType:17,actor:s.actor})):i===46?f.push({type:`activeEnd`,signalType:18,actor:e.actor}):i===47&&(d.activate=!0,d.centralConnection=59,f.push({type:`centralConnection`,signalType:59,actor:s.actor}));return f},f=e=>{a++;let t=c();return[t,{type:e,actor:t.actor,text:l()}]},p=()=>{a++;let e=n[a];if(e===37){a++;let e=c(),t=e,r=[e.actor,e.actor];if(n[a]===42){a++;let n=c();t=[e,n],r=[e.actor,n.actor]}return[t,{type:`addNote`,placement:2,actor:r,text:l()}]}e!==43&&e!==44&&o(`'over', 'left_of', 'right_of'`),a++;let t=c();return[t,{type:`addNote`,placement:e===43?0:1,actor:t.actor,text:l()}]},m=()=>{a++;let e={type:`sequenceIndex`,sequenceVisible:!0,signalType:26};return n[a]===10?(e.sequenceIndex=Number(r[a++]),e.sequenceIndexStep=n[a]===10?Number(r[a++]):1):n[a]===11&&(a++,e.sequenceVisible=!1),n[a]!==3&&o(`'NEWLINE', 'NUM', 'off'`),a++,e},h=(e,n,r,i)=>{let a=e.list,o=e.sections;if(o)for(let e=o.length-2;e>=0;e-=2){let s={type:n,signalType:i};s[r]=t.parseMessage(o[e+1]),a=o[e].concat([s,a])}return a},g=e=>{let n=e.text,r=e.list;switch(e.kind){case 1:r[0]={type:`boxStart`,boxData:t.parseBoxData(n)},r.push({type:`boxEnd`,boxText:n});break;case 2:r[0]={type:`loopStart`,loopText:t.parseMessage(n),signalType:10},r.push({type:`loopEnd`,loopText:n,signalType:11});break;case 3:r[0]={type:`rectStart`,color:t.parseMessage(n),signalType:22},r.push({type:`rectEnd`,color:t.parseMessage(n),signalType:23});break;case 4:r[0]={type:`optStart`,optText:t.parseMessage(n),signalType:15},r.push({type:`optEnd`,optText:t.parseMessage(n),signalType:16});break;case 5:r[0]={type:`breakStart`,breakText:t.parseMessage(n),signalType:30},r.push({type:`breakEnd`,optText:t.parseMessage(n),signalType:31});break;case 6:r=h(e,`else`,`altText`,13),r[0]={type:`altStart`,altText:t.parseMessage(n),signalType:12},r.push({type:`altEnd`,signalType:14});break;case 7:r=h(e,`and`,`parText`,20),r[0]={type:`parStart`,parText:t.parseMessage(n),signalType:e.startType},r.push({type:`parEnd`,signalType:21});break;default:r=h(e,`option`,`optionText`,28),r[0]={type:`criticalStart`,criticalText:t.parseMessage(n),signalType:27},r.push({type:`criticalEnd`,signalType:29})}return r};for(;n[a]===3;)a++;s(4);let _=[],v={kind:0,text:``,startType:0,list:[],sections:void 0};for(;;){let e=n[a],i=v.list;if(v.kind===1){if(e===32||e===34||e===35)i.push(u());else if(e===3)i.push([]),a++;else if(e===8){a++;let e=g(v);v=_.pop(),v.list.push(e)}else o(`'end', 'NEWLINE', 'participant', 'participant_actor', 'destroy'`)}else switch(e){case 3:case 2:i.push([]),a++;break;case 32:case 34:case 35:i.push(u());break;case 5:{a++;let e=n[a];e!==32&&e!==34&&e!==35&&o(`'participant', 'participant_actor', 'destroy'`);let t=u();t.type=`createParticipant`,i.push(t);break}case 48:i.push(d(c())),s(3);break;case 39:{let e=n[a+1];i.push(e===48||e===39?f(`addALink`):d(c())),s(3);break}case 38:i.push(f(`addLinks`)),s(3);break;case 40:i.push(f(`addProperties`)),s(3);break;case 41:i.push(f(`addDetails`)),s(3);break;case 36:i.push(p()),s(3);break;case 9:i.push(m());break;case 12:case 13:{a++;let t=c();s(3),i.push(e===12?{type:`activeStart`,signalType:17,actor:t.actor}:{type:`activeEnd`,signalType:18,actor:t.actor});break}case 14:case 15:{let n=r[a++].substring(e===14?6:7);t.setDiagramTitle(n),i.push(n);break}case 16:{a++;let e=s(17).trim();t.setAccTitle(e),i.push(e);break}case 18:{a++;let e=s(19).trim();t.setAccDescription(e),i.push(e);break}case 20:{let e=r[a++].trim();t.setAccDescription(e),i.push(e);break}case 21:case 22:case 23:case 28:case 24:case 25:case 26:case 27:case 6:{a++;let t=s(7);_.push(v),v={kind:UN[e],text:t,startType:e===26?32:19,list:[[]],sections:void 0};break}case 31:case 30:case 29:{v.kind!==(e===31?6:e===30?7:8)&&o(`'end'`),a++;let t=s(7);(v.sections??=[]).push(i,t),v.list=[];break}case 8:{v.kind===0&&o(`'NEWLINE', 'EOF'`),a++;let e=g(v);v=_.pop(),v.list.push(e);break}case 0:v.kind!==0&&o(`'end'`),t.apply(i);return;default:o(`'NEWLINE', 'ACTOR', 'participant', 'note', 'end'`)}}}var KN=16,qN=10,JN=34,YN=4,XN=5,ZN=6,QN=` fill="var(--_s)" stroke="var(--_b)"`,$N=` fill="none" stroke="var(--_b)"`,eP=new Set([`participant`,`actor`,`boundary`,`control`,`entity`,`database`,`collections`,`queue`]),tP=new Set([`actor`,`boundary`,`control`,`entity`,`database`]);function nP(e){return eP.has(e)?e:`participant`}function rP(e){return tP.has(e)}function iP(e,t,n,r,i=KN){if(rP(e))return{w:Math.max(40,t.width+8),h:JN+(t.height>0?YN+t.height:0)};let a=e===`collections`?XN:e===`queue`?2*ZN:0;return{w:Math.max(n,t.width+2*i)+a,h:Math.max(r,t.height+2*qN)+(e===`collections`?XN:0)}}function aP(e,t,n){let r=X(t),i=e=>X(n+e);switch(e){case`actor`:return`<circle cx="${r}" cy="${i(7)}" r="6"${QN}/><path d="M${r},${i(13)}V${i(24)}M${X(t-10)},${i(17)}H${X(t+10)}M${X(t-8)},${i(34)}L${r},${i(24)}L${X(t+8)},${i(34)}"${$N}/>`;case`boundary`:return`<path d="M${X(t-19)},${i(6)}V${i(28)}M${X(t-19)},${i(17)}H${X(t-8)}"${$N}/><circle cx="${X(t+3)}" cy="${i(17)}" r="11"${QN}/>`;case`control`:return`<circle cx="${r}" cy="${i(21)}" r="11"${QN}/><path d="M${X(t+5)},${i(5)}L${X(t-1)},${i(10)}L${X(t+5)},${i(15)}"${$N}/>`;case`entity`:return`<circle cx="${r}" cy="${i(15)}" r="11"${QN}/><path d="M${X(t-11)},${i(30)}H${X(t+11)}"${$N}/>`;default:{let e=X(t-14),n=X(t+14);return`<path d="M${e},${i(7)}V${i(27)}A14,5 0 0 0 ${n},${i(27)}V${i(7)}A14,5 0 0 0 ${e},${i(7)}Z"${QN}/><path d="M${e},${i(7)}A14,5 0 0 0 ${n},${i(7)}"${$N}/>`}}}function oP(e,t,n,r,i,a,o=``){let{w:s,h:c}=r,l=` class="pele-label"`;if(rP(e))return aP(e,t,n)+Z(i,t,n+JN+YN+i.height/2,l+o,a);let u=t-s/2;if(e===`collections`){let e=s-XN,t=c-XN;return`<rect x="${X(u+XN)}" y="${X(n)}" width="${X(e)}" height="${X(t)}"${QN}${Up}/><rect x="${X(u)}" y="${X(n+XN)}" width="${X(e)}" height="${X(t)}"${QN}${Up}/>`+Z(i,u+e/2,n+XN+t/2,l,a)}if(e===`queue`){let e=X(u+ZN),r=X(u+s-ZN),o=X(n+c),d=X(c/2);return`<path d="M${e},${X(n)}H${r}A${ZN},${d} 0 0 1 ${r},${o}H${e}A${ZN},${d} 0 0 1 ${e},${X(n)}Z"${QN}/><path d="M${r},${X(n)}A${ZN},${d} 0 0 0 ${r},${o}"${$N}/>`+Z(i,t-ZN/2,n+c/2,l,a)}return`<rect x="${X(u)}" y="${X(n)}" width="${X(s)}" height="${X(c)}"${QN}${Up}/>`+Z(i,t,n+c/2,l,a)}var sP=[];function cP(e,t,n,r=1,i=!1){sP[e]={dotted:t,head:n,atStart:r!==1,atEnd:r!==0,bottom:i}}cP(0,!1,1),cP(1,!0,1),cP(3,!1,2),cP(4,!0,2),cP(5,!1,0),cP(6,!0,0),cP(24,!1,3),cP(25,!0,3),cP(33,!1,1,2),cP(34,!0,1,2);for(let e of[!1,!0]){let t=e?10:0;cP(41+t,e,4),cP(42+t,e,4,1,!0),cP(43+t,e,5),cP(44+t,e,5,1,!0),cP(45+t,e,4,0),cP(46+t,e,4,0,!0),cP(47+t,e,5,0),cP(48+t,e,5,0,!0)}var lP=new Map([[10,`loop`],[12,`alt`],[15,`opt`],[19,`par`],[32,`par`],[27,`critical`],[30,`break`],[22,`rect`]]),uP=12,dP=28,fP=22,pP=10,mP=4,hP=14,gP=10,_P=16,vP=20,yP=10,bP=20,xP=240,SP=16,CP=4,wP=` stroke-dasharray="4 4"`;function TP(e){return e!==void 0&&sP[e]!==void 0}function EP(e,t){let n=Array(e.length),r=Array(e.length),i=1,a=1,o=!1;for(let s=0;s<e.length;s++){let c=e[s];if(n[s]=NaN,r[s]=!1,c.type===26){let e=c.message;i=e.start||i,a=e.step||a,o=e.visible}else TP(c.type)&&(n[s]=i,r[s]=o||t,i=Math.round((i+a)*100)/100)}return{index:n,shown:r,visible:o}}var DP={lines:[],widths:[],width:0,height:0,size:0,lineHeight:0};function OP(e,t,n){let r=e[t];return typeof r==`number`&&r>=0&&r<=2e3?r:n}function kP(e,t,n,r,i,a){let o=X(e-n*mp);return i?`<path class="pele-marker" d="M${X(e)},${X(t)}L${o},${X(t+r*5)}"/>`:`<path class="pele-marker" d="M${X(e)},${X(t)}L${o},${X(t+r*4.5)}V${X(t)}Z" fill="${a}" stroke="none"/>`}function AP(e,t,n,r,i,a){switch(e){case 1:return xp(`arrow_point`,t,n,r,0,a);case 2:return xp(`arrow_cross`,t,n,r,0,a);case 3:return`<path class="pele-marker" d="M${X(t-r*mp)},${X(n-4.5)}L${X(t)},${X(n)}L${X(t-r*mp)},${X(n+4.5)}" stroke-linejoin="round"/>`;case 4:return kP(t,n,r,i,!1,a);case 5:return kP(t,n,r,i,!0,a);default:return``}}function jP(e){return e===1?mp-1:e===2?4:0}function MP(e,t,n){return Oh(n,r=>NP(e,t,n,r))}function NP(e,t,n,r,i=0,a=!0){let o=t.sequence??{},s=n.fontSize??16,c=Math.round(s*.875),l=Math.round(s*.75),u=n.measurer??bc(n.fontFamily,n.fontFamilyMono),d=Array.isArray(n.monospace)&&n.monospace.includes(`messages`),f=d?{width:(e,t,n)=>u.width(e,t,n|4)}:u,p=n.icons,m=n.padding??8,h=o.mirrorActors!==!1,g=o.rightAngles===!0,_=Math.min(OP(o,`actorMargin`,40),r?8:1/0),v=Math.min(OP(o,`width`,64),r?48:1/0),y=OP(o,`height`,Math.round(s*1.5)+20),b=Math.min(OP(o,`width`,160),r?Math.max(32,((n.maxWidth??320)-2*m)/Math.max(1,e.actors.size)-_-24):1/0),x=Math.max(4,14+OP(o,`messageMargin`,35)-35),S=Math.min(OP(o,`noteMargin`,10),r?6:1/0),C=Math.min(OP(o,`boxMargin`,10),r?6:1/0),w=o.messageAlign===`left`?-1:+(o.messageAlign===`right`),T=r?6:uP,E=r?8:_P,D=r?12:vP,O=r?6:yP,k=e.messages,A=k.length,j=EP(k,o.showSequenceNumbers===!0),M=(e,t,n,i=b,a=u)=>{let o=Q(e,!1,a,t,r||n?i:1/0);return r?Rv(o,a,Math.max(120,i)):o},N=(e,t,n=b)=>M(e,c,t,n,f),P;if(o.hideUnusedParticipants===!0){P=new Set;for(let e of k)P.add(e.from).add(e.to)}let F=new Int32Array(A+1);F[A]=-1;for(let e=A-1;e>=0;e--)F[e]=TP(k[e].type)?e:F[e+1];let I=[],L=new Map;for(let[t,n]of e.actors){if(P&&!P.has(t))continue;let i=nP(n.type),a=M(n.description,s,n.wrap),o=e.createdActors.get(t),c=e.destroyedActors.get(t),l=o===void 0?-1:F[Math.min(o,A)];l>=0&&k[l].to!==t&&(l=-1);let u=c===void 0?-1:F[Math.min(c,A)];u>=0&&k[u].to!==t&&k[u].from!==t&&(u=-1),L.set(t,I.length),I.push({id:t,actor:n,kind:i,label:a,size:iP(i,a,v,y,r?8:void 0),x:0,createAt:l,destroyAt:u,top:0,lifeStart:0,lifeEnd:-1,activations:[]})}let R=I.length-1,z=new Map,B=(e,t,n)=>{if(e<0||t>R)return;let r=e*I.length+t;(z.get(r)??0)<n&&z.set(r,n)},V=e=>j.shown[e]?Math.max(SP,u.width(String(j.index[e]),l,0)+8):0,H=Array(A),U=Array(A),ee=(e,t)=>{let n=U[e];if(!n){if(t===b)return H[e].label;U[e]=n=new Map([[b,H[e].label]])}let r=n.get(t);return r||n.set(t,r=N(k[e].message,!0,t)),r};for(let e=0;e<A;e++){let t=k[e],n=t.from===void 0?void 0:L.get(t.from),i=t.to===void 0?void 0:L.get(t.to);if(n!==void 0&&i!==void 0&&typeof t.message==`string`){if(t.type===2){let r=M(t.message,c,t.wrap),a=r.width+2*S;t.placement===0?B(n-1,n,a+2*gP+pP):t.placement===1?B(n,n+1,a+2*gP+pP):n===i?(B(n-1,n,a/2+gP),B(n,n+1,a/2+gP)):B(Math.min(n,i),Math.max(n,i),a-2*E),H[e]={kind:2,a:n,b:i,label:r,x:0,w:a}}else if(TP(t.type)){let a=N(t.message,t.wrap),o=V(e);if(n===i)B(n,n+1,dP+8+a.width+16+pP+o),H[e]={kind:1,a:n,b:i,label:a,x:0,w:0};else{let s=I[i].createAt===e?I[i].size.w/2:0,c=t.centralConnection?4*CP:0;B(Math.min(n,i),Math.max(n,i),(r?Math.min(a.width,Math.max(16,b-16)):a.width)+2*T+pP+o+s+c),H[e]={kind:0,a:n,b:i,label:a,x:0,w:0}}}}}let te=[];for(let e=0;e<=R;e++){let t=I[e].actor.box,n=te[te.length-1];t&&n&&n.box===t&&n.last===e-1?n.last=e:t&&te.push({box:t,first:e,last:e,title:M(t.name,c,t.wrap),grow:0})}let W=Array(Math.max(R,0));for(let e=0;e<R;e++){let t=I[e],n=I[e+1],r=t.actor.box===n.actor.box?0:(t.actor.box?C:0)+(n.actor.box?C:0);W[e]=Math.max(t.size.w/2+n.size.w/2+_+r,z.get(e*I.length+e+1)??0)}let ne=[];for(let[e,t]of z){let n=Math.floor(e/I.length),r=e%I.length;r-n>1&&ne.push([n,r,t])}ne.sort((e,t)=>e[1]-e[0]-(t[1]-t[0])||e[0]-t[0]);for(let[e,t,n]of ne){let r=0;for(let n=e;n<t;n++)r+=W[n];if(r>=n)continue;let i=(n-r)/(t-e);for(let n=e;n<t;n++)W[n]+=i}let G=()=>{for(let e=1;e<=R;e++)I[e].x=I[e-1].x+W[e-1]};G();for(let e of te){let t=I[e.last].x+I[e.last].size.w/2-(I[e.first].x-I[e.first].size.w/2);e.grow=Math.max(0,(e.title.width-t)/2),e.grow!==0&&(e.first>0&&(W[e.first-1]+=e.grow),e.last<R&&(W[e.last]+=e.grow))}let re=1/0,K=-1/0,ie=(e,t)=>{e<re&&(re=e),t>K&&(K=t)},q=e=>[I[e.first].x-I[e.first].size.w/2-C-e.grow,I[e.last].x+I[e.last].size.w/2+C+e.grow],ae=Array(A),oe=()=>{G(),re=1/0,K=-1/0;for(let e of I)ie(e.x-e.size.w/2,e.x+e.size.w/2);for(let e of te)ie(...q(e));let e=[],t=()=>R<0?[0,120]:[I[0].x-D,I[R].x+D];for(let n=0;n<A;n++){let i=k[n],a=i.type,o=a===void 0?void 0:lP.get(a),s=H[n];if(o!==void 0){let t={kind:o,x0:1/0,x1:-1/0,top:0,title:DP,tabW:0,fill:o===`rect`&&typeof i.message==`string`?i.message:``,dividers:[n],dividerY:[],dividerLabels:[]};ae[n]=t,e.push(t)}else if(a===13||a===20||a===28)e[e.length-1]?.dividers.push(n);else if(a===11||a===14||a===16||a===21||a===29||a===31||a===23){let i=e.pop();if(!i)continue;if(ae[n]=i,i.x0>i.x1&&([i.x0,i.x1]=t()),i.kind!==`rect`){i.tabW=u.width(i.kind,l,1)+14;for(let e=0;e<i.dividers.length;e++){let t=k[i.dividers[e]].message,n=e===0?i.tabW+8:0,a=i.x1-i.x0-16-n,o=t?M(`[${t}]`,c,!0,Math.max(a,r?Math.min(xP,b):xP)):DP;o.width>a&&(i.x1+=o.width-a),e===0?i.title=o:i.dividerLabels.push(o)}}ie(i.x0,i.x1);let a=e[e.length-1];a&&(a.x0=Math.min(a.x0,i.x0-O),a.x1=Math.max(a.x1,i.x1+O))}else if(s){let t=I[s.a],a=I[s.b],o,l;if(s.kind===2){if(i.placement===0)s.x=t.x-gP-s.w;else if(i.placement===1)s.x=t.x+gP;else if(s.a===s.b)s.x=t.x-s.w/2;else{let e=Math.min(t.x,a.x)-E,n=Math.max(t.x,a.x)+E;(r||i.wrap)&&(s.label=M(i.message,c,!0,Math.max(b,n-e-2*S))),s.w=Math.max(n-e,s.label.width+2*S),s.x=(e+n-s.w)/2}o=s.x,l=s.x+s.w}else s.kind===1?(o=t.x,l=t.x+pP+dP+8+s.label.width+V(n)):(o=Math.min(t.x,a.x),l=Math.max(t.x,a.x),(r||i.wrap)&&(s.label=ee(n,Math.max(b,l-o-2*T-pP))),a.createAt===n&&(a.x>t.x?l+=a.size.w/2:o-=a.size.w/2));ie(o,l);let u=e[e.length-1];u&&(u.x0=Math.min(u.x0,o-D),u.x1=Math.max(u.x1,l+D))}}};oe();let se=!1,ce=!1;if(r&&n.maxWidth!==void 0){let e=Math.floor(n.maxWidth)-Math.ceil(K-re+2*m)-i,t=new Int32Array(I.length),r=Array(W.length).fill(0),o=[],s=0;for(let n=0;e>0&&n<H.length;n++){let e=H[n];if(e?.kind!==0)continue;let i=N(k[n].message,!1,1/0);if(e.label.lines.length<=i.lines.length)continue;o.push(n),s+=e.label.lines.length;let a=Math.min(e.a,e.b),c=Math.max(e.a,e.b);t[a]++,t[c]--;let l=(i.width-(I[c].x-I[a].x-2*T-pP))/(c-a);for(let e=a;e<c;e++)r[e]=Math.max(r[e],l)}let c=0,l=0;for(let e=0;e<W.length;e++)c+=t[e],t[e]=+(c>0),l+=t[e];if(l>0){let n=W.slice(),i=e=>{for(let t=0;t<W.length;t++)W[t]=n[t]+e(t);return oe(),o.map(e=>H[e].label.lines.length)},c=e=>e.reduce((e,t)=>e+t,0),u=n=>t[n]*e/l,d=i(u),f=c(r),p=t=>r[t]*(e-.01)/f;if(a&&l>1&&f>0&&W.some((e,t)=>p(t)>u(t))){let e=d;d=i(p),ce=c(d)<c(e)&&d.every((t,n)=>t<=e[n]),ce||(d=i(u))}se=c(d)<s,se||(W.splice(0,W.length,...n),oe())}}let le=0;for(let e of te)le=Math.max(le,e.title.height);let ue=te.length>0?C+(le>0?le+4:0):0,de=0;for(let e of I)e.createAt<0&&(de=Math.max(de,e.size.h));let fe=ue+de;for(let e of I)e.top=fe-e.size.h,e.lifeStart=fe;let pe=I.map(e=>e.x),me=(e,t)=>{let n=0,r=pe.length;for(;n<r;){let t=n+r>>1;pe[t]<=e?n=t+1:r=t}return n<pe.length&&pe[n]<t},he=[],ge=new Map,_e=e=>{if(e)return ge.has(e)||ge.set(e,ul(nm([`fill:${e}`]).shape)),ge.get(e)},ve=e=>{let t=_e(e);return t?` fill="${t}"`:``},ye=(e,t)=>{for(let e=he.length-1;e>=0;e--)if(he[e].kind===`rect`)return he[e].fill;for(let n of te){let[r,i]=q(n);if(e>=r&&t<=i)return n.box.fill}},be=(e,t)=>ve(ye(e,t)),xe=(e,t,n,r=!1)=>{if(e.width===0)return``;let i=t-e.width/2,a=me(i,i+e.width),o=a?`<rect x="${X(i-3)}" y="${X(n-e.height/2+2)}" width="${X(e.width+6)}" height="${X(e.height-4)}" rx="3" fill="var(--_bg)" stroke="none"/>`:``,s=a?``:be(i,i+e.width);return o+Z(e,t,n,r?` class="pele-frame-label"${s||` fill="var(--_m)"`} stroke="none"`:s,p)},Se=(e,t=0)=>e.activations.length+t>0?e.x-pP/2:e.x,Ce=(e,t=0)=>{let n=e.activations.length+t;return n>0?e.x+pP/2+(n-1)*mP:e.x},we=[],Te=[],Ee=``,De=``,Oe=``,ke=``,Ae=``,je=``,Me=(e,t)=>{let n=e.activations.pop(),r=Math.max(t,n+hP),i=e.x-pP/2+e.activations.length*mP;return ie(i,i+pP),Te.push(`<rect class="pele-activation" data-id="${Y(e.id)}" x="${X(i)}" y="${X(n)}" width="${pP}" height="${X(r-n)}" rx="2"/>`),r},Ne=(e,t)=>{let n=e.x,r=t+16;return e.lifeEnd=r,je+=`<path class="pele-destroy" data-id="${Y(e.id)}" d="M${X(n-6)},${X(r-6)}L${X(n+6)},${X(r+6)}M${X(n+6)},${X(r-6)}L${X(n-6)},${X(r+6)}"/>`,r+6},Pe=(e,t,n)=>{let r=e.actor.properties.get(`class`);return`<g class="pele-node pele-actor pele-actor-${e.kind}${n?` pele-actor-footer`:``}${typeof r==`string`?im(r):``}" data-id="${Y(e.id)}">`+oP(e.kind,e.x,t,e.size,e.label,p,rP(e.kind)?ve(e.actor.box?.fill):``)+`</g>`},Fe=(e,t,n,r)=>`<g class="pele-sequence-number"><rect x="${X(t-r/2)}" y="${X(n-SP/2)}" width="${X(r)}" height="${SP}" rx="${SP/2}" fill="var(--_l)" stroke="none"/><text x="${X(t)}" y="${X(n+l*.35)}" text-anchor="middle" font-size="${l}" fill="var(--_bg)" stroke="none">${Ec(String(j.index[e]))}</text></g>`,Ie=fe+6;for(let e=0;e<A;e++){let t=k[e],n=t.type,r=H[e],i=ae[e];if(n===17){let e=t.from===void 0?void 0:L.get(t.from);e!==void 0&&I[e].activations.push(Ie)}else if(n===18){let e=t.from===void 0?void 0:L.get(t.from);e!==void 0&&I[e].activations.length>0&&(Ie=Math.max(Ie,Me(I[e],Ie)))}else if(i&&i.dividers[0]===e)he.push(i),i.kind===`rect`?(i.top=Ie+8,Ie=i.top):(i.top=Ie+12,Ie=i.top+Math.max(bP,i.title.height+2));else if(i){he.pop();let e=Ie+12,t=X(i.x0),n=X(i.x1-i.x0);if(i.kind===`rect`){let r=i.fill?nm([`fill:${i.fill}`]).shape:``;we.push(`<rect class="pele-rect" x="${t}" y="${X(i.top)}" width="${n}" height="${X(e-i.top)}"${Kp((r?``:` fill-opacity="0.5"`)+r)}/>`)}else{let r=`<rect x="${t}" y="${X(i.top)}" width="${n}" height="${X(e-i.top)}" fill="none"${Up}/>`;for(let e=0;e<i.dividerY.length;e++){let n=i.dividerY[e],a=i.dividerLabels[e];r+=`<path d="M${t},${X(n)}H${X(i.x1)}"${wP}/>`+xe(a,i.x0+8+a.width/2,n+2+a.height/2,!0)}r+=`<rect x="${t}" y="${X(i.top)}" width="${X(i.tabW)}" height="${bP}" fill="var(--_s)"${Up}/><text class="pele-frame-kind" x="${X(i.x0+i.tabW/2)}" y="${X(i.top+bP/2+l*.35)}" text-anchor="middle" font-size="${l}" font-weight="var(--_hw)" fill="var(--_m)" stroke="none">${i.kind}</text>`+xe(i.title,i.x0+i.tabW+8+i.title.width/2,i.top+Math.max(bP,i.title.height)/2,!0),Ee+=`<g class="pele-frame pele-frame-${i.kind}">${r}</g>`}Ie=e}else if(n===13||n===20||n===28){let e=he[he.length-1];if(e){let t=e.dividerLabels[e.dividerY.length];e.dividerY.push(Ie+12),Ie+=12+(t.height>0?t.height:0)}}else if(r&&r.kind===2){let e=I[r.a],n=r.label.height+2*Math.max(4,S-4),i=Ie+10,a=r.x;t.placement===1?a+=Ce(e)-e.x:t.placement===0&&(a+=Se(e)-e.x),ie(a,a+r.w),ke+=`<g class="pele-note" data-id="i${Y(t.id)}"><rect x="${X(a)}" y="${X(i)}" width="${X(r.w)}" height="${X(n)}"${Up}/>`+Z(r.label,a+r.w/2,i+n/2,` class="pele-label" stroke="none" fill="var(--_fg)"`,p)+`</g>`,Ie=i+n}else if(r){let i=sP[n],a=I[r.a],o=I[r.b],s=r.label,c=V(e),l=0;for(let n=e+1;n<A;n++){let e=k[n].type;if(e===17)k[n].from===t.to&&l++;else if(e!==18&&e!==59&&e!==60)break}let u=i.bottom?1:-1,d=i.dotted?wP:``,f=t.centralConnection,m=f===59||f===61,h=f===60||f===61,_,v=`var(--_l)`,y=(e,t)=>`<circle class="pele-central" cx="${X(e)}" cy="${X(t)}" r="${CP}" fill="${v}" stroke="none"/>`,b=i.atStart&&!i.atEnd,S=jP(i.head),C=``,E;if(r.kind===1){let n=Ie+x+Math.max(0,(s.height-fP)/2),r=n+fP,o=h?a.x+CP:Ce(a),f=m?a.x+CP:Ce(a,l),w=Math.max(o,f)+dP+c/2;_=_e(ye(a.x,w)),v=_??v,h&&(C+=y(a.x,n)),m&&(C+=y(a.x,r)),c>0&&(C+=Fe(e,b?f:o,b?r:n,c),b?f+=c/2:o+=c/2);let T=(i.atStart?AP(i.head,o,n,-1,u,v):``)+(i.atEnd?AP(i.head,f,r,-1,-u,v):``),D=X(o+(i.atStart?S:0)),O=X(f+(i.atEnd?S:0));C=`<path d="${g?`M${D},${X(n)}H${X(w)}V${X(r)}H${O}`:`M${D},${X(n)}H${X(w-6)}A6,6 0 0 1 ${X(w)},${X(n+6)}V${X(r-6)}A6,6 0 0 1 ${X(w-6)},${X(r)}H${O}`}"${d}/>`+T+C,ie(a.x,w+8+s.width),s.width>0&&(Oe+=`<g class="pele-edge-label" data-id="i${Y(t.id)}">${Z(s,w+8+s.width/2,(n+r)/2,be(w+8,w+8+s.width),p)}</g>`),E=Math.max(r,(n+r)/2+s.height/2)}else{let n=o.x>a.x?1:-1,r=o.createAt===e;_=_e(ye(Math.min(a.x,o.x),Math.max(a.x,o.x))),v=_??v,E=Ie+x+Math.max(s.height>0?s.height+2:6,r?o.size.h/2-x+6:0);let f=n>0?Ce(a):Se(a),p=n>0?Se(o,l):Ce(o,l);if(r&&(o.top=E-o.size.h/2,o.lifeStart=o.top+o.size.h,p=o.x-n*(rP(o.kind)?18:o.size.w/2+1)),h&&(C+=y(a.x,E),f=a.x+n*CP),m&&(C+=y(o.x,E),p=o.x-n*CP),c>0){if(b){let t=m?p-n*(c/2+2):p;C+=Fe(e,t,E,c),p=t-n*c/2}else{let t=h?f+n*(c/2+2):f;C+=Fe(e,t,E,c),f=t+n*c/2}}let g=(i.atStart?AP(i.head,f,E,-n,u*n,v):``)+(i.atEnd?AP(i.head,p,E,n,u*n,v):``),D=f+(i.atStart?n*S:0),O=p-(i.atEnd?n*S:0);if(C=`<path d="M${X(D)},${X(E)}H${X(O)}"${d}/>`+g+C,s.width>0){let e=Math.min(f,p),n=Math.max(f,p),r=w<0?e+T+s.width/2:w>0?n-T-s.width/2:(e+n)/2;ie(r-s.width/2,r+s.width/2),Oe+=`<g class="pele-edge-label" data-id="i${Y(t.id)}">${xe(s,r,E-4-s.height/2)}</g>`}r&&(Ie=E+o.size.h/2-6)}De+=`<g class="pele-edge pele-message" data-id="i${Y(t.id)}"${_?` stroke="${_}"`:``}>${C}</g>`,Ie=Math.max(Ie,E),a.destroyAt===e&&(Ie=Math.max(Ie,Ne(a,E))),o.destroyAt===e&&o!==a&&(Ie=Math.max(Ie,Ne(o,E)))}}Ie+=20;for(let e of I)for(;e.activations.length>0;)Me(e,Ie);let Le=Ie;if(h){let e=0;for(let t of I)t.lifeEnd>=0||(e=Math.max(e,t.size.h),Ae+=Pe(t,Ie,!0));Le=Ie+e}let Re=``;for(let e of I){Ae+=Pe(e,e.top,!1);let t=e.lifeEnd>=0?e.lifeEnd:Ie;t>e.lifeStart&&(Re+=`<path class="pele-lifeline" data-id="${Y(e.id)}" d="M${X(e.x)},${X(e.lifeStart)}V${X(t)}"/>`)}let ze=``;for(let e of te){let[t,n]=q(e),r=e.box.fill===`transparent`?``:nm([`fill:${e.box.fill}`]).shape;ze+=`<g class="pele-cluster pele-box"${e.box.name?` data-id="${Y(e.box.name)}"`:``}><rect x="${X(t)}" y="0" width="${X(n-t)}" height="${X(Le+C)}" fill="var(--_a)" stroke="var(--_b)"${Kp((r?``:` fill-opacity="0.5"`)+r)}/>`+Z(e.title,(t+n)/2,C/2+2+e.title.height/2,` class="pele-cluster-label"${ve(e.box.fill)||` fill="var(--_m)"`}`,p)+`</g>`}te.length>0&&(Le+=C);let Be=0,Ve=``,He=Ch(n),Ue=g_(e.title,u,s,r?He:1/0),We=r?Rv(Ue,u,Math.max(120,He)):Ue;if(re>K&&ie(0,Math.max(We.width,40)),We.width>0){let e=(re+K)/2;ie(e-We.width/2,e+We.width/2),Be=-We.height-12,Ve=Z(We,e,Be+We.height/2,` class="pele-title" font-weight="var(--_tw)"`,p)}let Ge=Math.ceil(K-re+2*m);if(se&&Ge>n.maxWidth)return NP(e,t,n,r,ce?i:i>0?1/0:Ge-Math.floor(n.maxWidth),!1);let Ke=Math.ceil(Le-Be+2*m);return{svg:lm(`sequence`,Ge,Ke,s,n,e,`<g transform="translate(${X(m-re)},${X(m-Be)})">`+Ve+(ze?`<g class="pele-boxes" font-size="${c}">${ze}</g>`:``)+(we.length>0?`<g class="pele-rects" fill="var(--_a)">${we.reverse().join(``)}</g>`:``)+(Re?`<g class="pele-lifelines" fill="none" stroke="var(--_b)">${Re}</g>`:``)+(Te.length>0?`<g class="pele-activations" fill="var(--_s)" stroke="var(--_b)">${Te.reverse().join(``)}</g>`:``)+(Ee?`<g class="pele-frames" font-size="${c}" stroke="var(--_b)">${Ee}</g>`:``)+(De?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${De}</g>`:``)+(je?`<g class="pele-destroys" fill="none" stroke="var(--_l)" stroke-width="1.5" stroke-linecap="round">${je}</g>`:``)+(Oe?`<g class="pele-edge-labels" font-size="${c}"${d?` font-family="${Vp}"`:``}>${Oe}</g>`:``)+(ke?`<g class="pele-notes" font-size="${c}" fill="var(--_a)" stroke="var(--_b)">${ke}</g>`:``)+(Ae?`<g class="pele-nodes">${Ae}</g>`:``)+`</g>`),width:Ge,height:Ke,links:[]}}var PP={type:`sequence`,math:!0,parse(e,t,n){let r=t.sequence??{},i=new RN({wrap:typeof t.wrap==`boolean`?t.wrap:void 0,sequenceWrap:r.wrap===!0});return n&&i.setDiagramTitle(n),GN(e,i),i},render:MP};function FP(e){let t=`TB`;for(let n of e)typeof n!=`string`&&n.stmt===`dir`&&(t=n.value);return t}function IP(e,t,n){let r=[],i=[],a=new Map,o=new Map,s=new Map,c=0,l=0,u=e=>{if(!e.id||e.id===`</join></fork>`||e.id===`</choice>`)return;if(e.cssClasses){let t;for(let r of e.cssClasses.split(` `)){let i=n.get(r);if(i){t??=e.cssCompiledStyles.slice();for(let e of i.styles)t.push(e)}}t&&(e.cssCompiledStyles=t)}let t=a.get(e.id);if(t){let n=e.parentId??t.parentId;Object.assign(t,e),n!==void 0&&(t.parentId=n)}else a.set(e.id,e),r.push(e)},d=(e,n,r)=>{let a=n.id;if(a===`root`)return;let d=t.get(a),f=d?.classes?.join(` `)??``,p=d?.styles??[],m=o.get(a);if(!m){let e=`rect`;n.start===!0?e=`stateStart`:n.start===!1&&(e=`stateEnd`),n.type!=="default"&&(e=n.type),m={shape:e,description:a,cssClasses:`${f} statediagram-state`,cssStyles:p,type:void 0,dir:void 0,colorIndex:void 0},o.set(a,m)}if(n.description&&(Array.isArray(m.description)?(m.shape=`rectWithTitle`,m.description=m.description.concat(n.description)):m.description.length>0?(m.shape=`rectWithTitle`,m.description=m.description===a?[n.description].flat():[m.description,n.description].flat()):(m.shape=`rect`,m.description=Array.isArray(n.description)?n.description.slice():n.description)),m.description.length===1&&m.shape===`rectWithTitle`&&(m.shape=m.type===`group`?`roundedWithTitle`:`rect`),!m.type&&n.doc){if(m.type=`group`,m.dir=FP(n.doc),m.shape=n.type===`divider`?`divider`:`roundedWithTitle`,m.shape===`divider`&&e?.id!==void 0&&s.has(e.id))m.colorIndex=s.get(e.id);else{let e=l++;m.colorIndex=f.trim()!==``||p.length>0?void 0:e}s.set(a,m.colorIndex),m.cssClasses=`${m.cssClasses} statediagram-cluster ${r?`statediagram-cluster-alt`:``}`}let h=m.description,g={id:a,shape:m.shape,label:Array.isArray(h)?h[0]:h,description:Array.isArray(h)?h.slice(1):[],cssClasses:m.cssClasses,cssCompiledStyles:[],cssStyles:m.cssStyles,type:m.type,isGroup:m.type===`group`,dir:m.dir,colorIndex:m.colorIndex};g.shape===`divider`&&(g.label=``),e&&e.id!==`root`&&(g.parentId=e.id);let _=n.note;if(!_){u(g);return}let v=(e,t,n,r)=>({id:e,shape:t,label:_.text,description:[],cssClasses:n,cssCompiledStyles:[],cssStyles:[],type:r?`group`:`node`,isGroup:r,dir:void 0,position:_.position}),y=v(`${a}----note-${c++}`,`note`,`statediagram-note`,!1);y.parentId=`${a}----parent`,y.noteFor=a,u(v(y.parentId,`noteGroup`,m.cssClasses,!0)),u(y),u(g);let b=_.position===`left of`,x=b?y.id:a,S=b?a:y.id;i.push({id:`${x}-${S}`,start:x,end:S,label:``,classes:`transition note-edge`,pattern:`dashed`})},f=[{item:void 0,doc:e,at:0,alt:!0}];for(;f.length>0;){let e=f[f.length-1];if(e.at>=e.doc.length){f.pop();continue}let t=e.doc[e.at++];typeof t!=`string`&&(t.stmt===`state`?(d(e.item,t,e.alt),t.doc&&f.push({item:t,doc:t.doc,at:0,alt:!e.alt})):t.stmt===`relation`&&(d(e.item,t.state1,e.alt),d(e.item,t.state2,e.alt),i.push({id:`edge${c++}`,start:t.state1.id,end:t.state2.id,label:t.description??``,classes:`transition`})))}for(let e of r)if(e.isGroup&&e.description.length>0)throw new jo(`Group nodes can only have label. Remove the additional description for node [${e.id}]`,`semantic`,{type:`state`});return{nodes:r,edges:i}}var LP=class{type=`state`;rootDoc=[];states=new Map;relations=[];classes=new Map;links=new Map;graph={nodes:[],edges:[]};title;accTitle;accDescr;dividerCount=0;get direction(){let e=`TB`;for(let t of this.rootDoc)typeof t!=`string`&&t.stmt===`dir`&&(e=t.value);return e}setRootDoc(e){this.rootDoc=e,this.translate(),this.extract(e)}extract(e){this.states=new Map,this.relations=[],this.classes=new Map;let t=Array.isArray(e)?e:e.doc;for(let e of t)if(typeof e!=`string`)switch(e.stmt){case`state`:this.addState(e.id.trim(),e.type,e.doc,e.description,e.note);break;case`relation`:this.addRelation(e.state1,e.state2,e.description);break;case`classDef`:this.addStyleClass(e.id.trim(),e.classes);break;case`style`:{let t=e.styleClass.split(`,`).map(e=>e.replace(/;/g,``).trim());for(let n of this.named(e.id.trim()))n.styles=t.slice();break}case`applyClass`:this.setCssClass(e.id.trim(),e.styleClass);break;case`click`:this.addLink(typeof e.id==`string`?e.id:e.id.id,e.url,e.tooltip)}this.graph=IP(t,this.states,this.classes)}translate(){let e=[[`root`,{stmt:`root`,id:`root`,doc:this.rootDoc},!0]];for(;e.length>0;){let[t,n,r]=e.pop();if(typeof n==`string`)continue;if(n.stmt===`relation`){e.push([t,n.state2,!1],[t,n.state1,!0]);continue}if(n.stmt===`state`)n.id===`[*]`?(n.id=t+(r?`_start`:`_end`),n.start=r):n.id=n.id.trim();else if(n.stmt!==`root`)continue;if(!n.doc)continue;let i=[],a=[];for(let e of n.doc)typeof e!=`string`&&e.stmt===`state`&&e.type===`divider`&&!e.doc?(i.push({...e,doc:a}),a=[]):a.push(e);i.length>0&&(a.length>0&&i.push({stmt:`state`,id:this.getDividerId(),type:`divider`,doc:a}),n.doc=i);for(let t=n.doc.length-1;t>=0;t--)e.push([n.id,n.doc[t],!0])}}addState(e,t=`default`,n,r,i,a){let o=e.trim(),s=this.states.get(o);if(s?(s.doc||(s.doc=n),s.type||(s.type=t)):(s={stmt:`state`,id:o,descriptions:[],type:t,doc:n,note:i,classes:[],styles:[],textStyles:[]},this.states.set(o,s)),r)for(let e of Array.isArray(r)?r:[r])this.addDescription(o,e.trim());if(i&&(s.note=i),a)for(let e of a)this.setCssClass(o,e.trim())}getState(e){return this.states.get(e)}addLink(e,t,n){this.links.set(e,{url:t,tooltip:n})}addRelation(e,t,n=``){for(let n of[e,t])this.addState(n.id,n.type,n.doc,n.description,n.note,n.classes);this.relations.push({id1:e.id.trim(),id2:t.id.trim(),relationTitle:n})}addDescription(e,t){this.states.get(e)?.descriptions?.push(t.startsWith(`:`)?t.replace(`:`,``).trim():t)}getDividerId(){return`divider-id-${++this.dividerCount}`}addStyleClass(e,t=``){let n=this.classes.get(e);if(n||(n={id:e,styles:[],textStyles:[]},this.classes.set(e,n)),t)for(let e of t.split(`,`)){let t=e.replace(`;`,``).trim();e.includes(`color`)&&n.textStyles.push(t.replace(`fill`,`bgFill`).replace(`color`,`fill`)),n.styles.push(t)}}setCssClass(e,t){for(let n of this.named(e))n.classes?.push(t)}getDirection(){for(let e of this.rootDoc)if(typeof e!=`string`&&e.stmt===`dir`)return e.value;return`TB`}setDirection(e){for(let t of this.rootDoc)if(typeof t!=`string`&&t.stmt===`dir`){t.value=e;return}this.rootDoc.unshift({stmt:`dir`,value:e})}trimColon(e){return e.startsWith(`:`)?e.slice(1).trim():e.trim()}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
145
|
+
`)}named(e){let t=[];for(let n of e.split(`,`)){let e=this.states.get(n);e||=(this.addState(n),this.states.get(n.trim())),e&&t.push(e)}return t}},RP=`$end.INVALID.NL.SD.DESCR.-->.HIDE_EMPTY.scale.WIDTH.COMPOSIT_STATE.STRUCT_START.STRUCT_STOP.STATE_DESCR.AS.ID.FORK.JOIN.CHOICE.CONCURRENT.note.NOTE_TEXT.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.CLICK.STRING.HREF.classDef.CLASSDEF_ID.DEFAULT_CLASSDEF_ID.CLASSDEF_STYLEOPTS.DEFAULT.style.STYLE_IDS.STYLEDEF_STYLEOPTS.class.CLASSENTITY_IDS.STYLECLASS.direction_tb.direction_bt.direction_rl.direction_lr.EDGE_STATE.STYLE_SEPARATOR.left_of.right_of.INVALID`.split(`.`),zP=/direction/gi,BP=/<<(?:fork|join|choice)>>|\[\[(?:fork|join|choice)\]\]/gi,VP=/[\n\r\u2028\u2029]/g,HP=/%%/g,UP=/\{/g;function WP(e,t){let n=0,r=-2;return i=>{if(r===-2||i<n||r!==-1&&i>r){e.lastIndex=i;let a=e.exec(t);r=a?a.index:-1,n=i}return r}}function GP(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c,l=WP(zP,e),u=WP(BP,e),d=WP(VP,e),f=WP(HP,e),p=WP(UP,e),m=-1,h=-1,g=[-1,-1,-1,-1],_=[0,0,0,0],v=-1,y=-1,b=[-1,-1,-1,-1,-1,-1],x=(t,a,o)=>{n.push(t),r.push(e.slice(a,o)),i.push(a),s=o},S=(e,t,a,o)=>{n.push(e),r.push(t),i.push(a),s=o},C=e=>{a.push(o),o=e},w=()=>{a.length>0&&(o=a.pop())},T=(t,n)=>{for(let r=0;r<t.length;r++){let i=t.charCodeAt(r),a=e.charCodeAt(n+r);if(a!==i&&!(i>=97&&i<=122&&a===i-32))return!1}return!0},E=n=>{let r=n;for(;r<t&&J(e.charCodeAt(r));)r++;return r},D=n=>{let r=n;for(;r<t&&Ls(e.charCodeAt(r));)r++;return r},O=n=>{let r=e.indexOf(`
|
|
146
|
+
`,n);return r===-1?t:r},k=e=>{let n=d(e);return n===-1?t:n},A=e=>{if(e<m||e>h){let n=l(e),r=n===-1?t:k(e);m=e,h=r,g[0]=g[1]=g[2]=g[3]=-1;for(let e=n;e!==-1&&e<r;e=l(e+1)){let t=E(e+9);if(t===e+9)continue;let n=T(`tb`,t)?0:T(`bt`,t)?1:T(`rl`,t)?2:T(`lr`,t)?3:-1;n!==-1&&(g[n]=e,_[n]=t+2)}}for(let t=0;t<4;t++)if(g[t]>=e)return t;return-1},j=n=>{if(n<v||n>y){let r=u(n),i=r===-1?t:k(n);v=n,y=i,b.fill(-1);for(let t=r;t!==-1&&t<i;t=u(t+1)){let n=e.charCodeAt(t+2)|32;b[(e.charCodeAt(t)===60?0:3)+(n===102?0:n===106?1:2)]=t}}for(let e=0;e<6;e++)if(b[e]>=n)return e;return-1},M=(e,t)=>{let n=f(e);return n===-1||n+2>t?(x(14,e,t),!0):n===e?(s=t,!1):(x(14,e,n),!0)},N=e=>(n.push(e),r.push(``),i.push(s),{types:n,texts:r,starts:i,error:c});for(;;){if(s>=t){switch(o){case 0:x(2,t,t);break;case 6:x(22,t,t);break;case 7:x(24,t,t);break;case 8:x(25,t,t);break;case 10:x(32,t,t);break;case 12:x(39,t,t);break;case 14:x(36,t,t);break;case 3:x(12,t,t);break;case 18:x(20,t,t);break;case 4:case 19:x(14,t,t)}return N(0)}let n=e.charCodeAt(s);switch(o){case 0:case 1:{let r=o===0,i=n|32;if(r){if(i===99&&T(`click`,s)&&!Ls(e.charCodeAt(s+5))){x(26,s,s+5);continue}if(i===104&&T(`href`,s)&&!Ls(e.charCodeAt(s+4))){x(28,s,s+4);continue}if(n===34){let t=e.indexOf(`"`,s+1);if(t!==-1){x(27,s,t+1);continue}}if(i===100&&T(`default`,s)&&!Ls(e.charCodeAt(s+7))){x(33,s,s+7);continue}let t=A(s);if(t!==-1){x(40+t,s,O(_[t]));continue}if(n===10){let t=s+1;for(;e.charCodeAt(t)===10;)t++;x(2,s,t);continue}if(J(n)){s=E(s);continue}}else if(n!==10&&J(n)){let n=s+1;for(;n<t&&e.charCodeAt(n)!==10&&J(e.charCodeAt(n));)n++;s=n;continue}if(n===35||n===37&&e.charCodeAt(s+1)===37&&e.charCodeAt(s+2)!==123){s=O(s);continue}if(i===115){if(r&&T(`scale`,s)){let e=E(s+5);if(e>s+5){x(7,s,e),C(5);continue}}if(T(`style`,s)){let e=E(s+5);if(e>s+5){x(34,s,e),C(13);continue}}if(T(`state`,s)){let e=E(s+5);if(e>s+5){s=e,C(2);continue}if(r&&T(`diagram`,s+5)){let t=T(`-v2`,s+12)?s+15:s+12;if(e=E(t),e>t){x(3,s,e);continue}}}}else if(i===99){if(T(`class`,s)){let e=T(`def`,s+5),t=e?s+8:s+5,n=E(t);if(n>t){x(e?29:37,s,n),C(e?9:11);continue}}}else if(i===97&&r&&(T(`acctitle`,s)||T(`accdescr`,s))){let t=(e.charCodeAt(s+3)|32)==116,n=E(s+8),r=e.charCodeAt(n);if(r===58){x(t?21:23,s,E(n+1)),C(t?6:7);continue}if(r===123&&!t){s=E(n+1),C(8);continue}}if(r){if(n===123){x(10,s,s+1),C(1);continue}}else{let e=A(s);if(e!==-1){x(40+e,s,O(_[e]));continue}if(n===125){x(11,s,s+1),w();continue}if(n===10){s++;continue}}if(i===110&&T(`note`,s)){let e=E(s+4);if(e>s+4){x(19,s,e),C(15);continue}}if(r&&i===104&&T(`hide empty description`,s)&&!Ls(e.charCodeAt(s+22))){x(6,s,s+22);continue}if(n===91&&e.charCodeAt(s+1)===42&&e.charCodeAt(s+2)===93){x(44,s,s+3);continue}let a=s;for(;a<t;){let t=e.charCodeAt(a);if(t===58||t===45||t===123||J(t))break;a++}if(a>s){M(s,a);continue}if(n===58){for(a=s+1;a<t;){let n=e.charCodeAt(a);if(n===10||n===59)break;if(n===58){let n=e.charCodeAt(a+1);if(a+1>=t||n===58||n===10||n===59)break;a++}a++}if(a>s+1){S(4,e.slice(s,a).trim(),s,a);continue}if(e.charCodeAt(s+1)===58&&e.charCodeAt(s+2)===58){x(45,s,s+3);continue}}else if(n===45&&e.charCodeAt(s+1)===45){if(e.charCodeAt(s+2)===62){x(5,s,s+3);continue}if(!r){x(18,s,s+2);continue}}if(!r)return N(1);x(48,s,s+1);continue}case 2:{if(n!==10&&J(n)){let n=s+1;for(;n<t&&e.charCodeAt(n)!==10&&J(e.charCodeAt(n));)n++;s=n;continue}if(n===35||n===37&&e.charCodeAt(s+1)===37&&e.charCodeAt(s+2)!==123){s=O(s);continue}let r=j(s);if(r!==-1){let t=b[r],n=r===2||r===5;S(n?17:r%3==0?15:16,e.slice(s,t).trim(),s,t+(n?10:8)),w();continue}if(n===34){s++,C(3);continue}let i=n===10?E(s):s;if(T(`as`,i)){let e=E(i+2);if(e>i+2){x(13,s,e),C(4);continue}}if(n===10){s++,w();continue}if(n===123){x(10,s,s+1),w(),C(1);continue}if(Ls(n)){let t=D(s),n=E(t);if(n>t&&Ls(e.charCodeAt(n))){let t=p(n+1);if(t!==-1&&t<k(n))return c=`Error: State name must be a single word. Found: "${e.slice(s,t+1).trim()}"`,N(1)}}let a=s+1;for(;a<t;){let t=e.charCodeAt(a);if(t===123||J(t))break;a++}x(9,s,a);continue}case 3:{if(n===34){s++,w();continue}let r=e.indexOf(`"`,s);x(12,s,r===-1?t:r);continue}case 4:{let n=s;for(;n<t;){let t=e.charCodeAt(n);if(t===10||t===123)break;n++}M(s,n)&&w();continue}case 5:{if(n>=48&&n<=57){let n=s+1;for(;n<t&&e.charCodeAt(n)>=48&&e.charCodeAt(n)<=57;)n++;x(8,s,n);continue}let r=E(s);if(r>s&&T(`width`,r)&&!Ls(e.charCodeAt(r+5))){s=r+5,w();continue}return N(1)}case 6:x(22,s,O(s)),w();continue;case 7:x(24,s,O(s)),w();continue;case 8:{if(n===125){s++,w();continue}let r=e.indexOf(`}`,s);x(25,s,r===-1?t:r);continue}case 9:{let e=T(`default`,s)&&E(s+7)>s+7,t=e?s+7:D(s),n=E(t);if(t===s||n===t)return N(1);x(e?31:30,s,n),w(),C(10);continue}case 10:x(32,s,O(s)),w();continue;case 11:{let t=D(s);if(t===s)return N(1);for(;e.charCodeAt(t)===44;){let e=E(t+1),n=D(e);if(n===e)break;t=n}x(38,s,t),w(),C(12);continue}case 12:x(39,s,O(s)),w();continue;case 13:{let n=s;for(;n<t&&(Ls(e.charCodeAt(n))||e.charCodeAt(n)===44);)n++;let r=E(n);if(n===s||r===n)return N(1);x(35,s,r),w(),C(14);continue}case 14:x(36,s,O(s)),w();continue;case 15:if(T(`left of`,s)&&!Ls(e.charCodeAt(s+7))){x(46,s,s+7),w(),C(16);continue}if(T(`right of`,s)&&!Ls(e.charCodeAt(s+8))){x(47,s,s+8),w(),C(16);continue}if(n===34){s++,w(),C(18);continue}return N(1);case 16:{let n=E(s),r=n;for(;r<t;){let t=e.charCodeAt(r);if(t===58||t===45||J(t))break;r++}if(r===n)return N(1);M(s,r)&&(w(),C(17));continue}case 17:{let n=E(s);if(e.charCodeAt(n)===58){let r=n+1;for(;r<t;){let t=e.charCodeAt(r);if(t===58||t===10||t===59)break;r++}if(r>n+1){S(20,e.slice(s+2,r).trim(),s,r),w();continue}}let r=e.indexOf(`
|
|
147
|
+
`,s),i=-1;for(;r!==-1&&(i=E(r),!T(`end note`,i)||Ls(e.charCodeAt(i+8)));)r=e.indexOf(`
|
|
148
|
+
`,i);if(r===-1)return N(1);S(20,e.slice(s,i).trim(),s,i+8),w();continue}case 18:{let r=E(s);if(T(`as`,r)){x(13,s,E(r+2)),w(),C(19);continue}if(n===34){s++;continue}let i=e.indexOf(`"`,s);x(20,s,i===-1?t:i);continue}case 19:M(s,O(s))&&w();continue}}}var KP=[`TB`,`BT`,`RL`,`LR`],qP=`'NL', 'ID', 'HIDE_EMPTY', 'scale', 'COMPOSIT_STATE', 'STATE_DESCR', 'FORK', 'JOIN', 'CHOICE', 'CONCURRENT', 'note', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'CLICK', 'classDef', 'style', 'class', 'direction_tb', 'direction_bt', 'direction_rl', 'direction_lr', 'EDGE_STATE'`;function JP(e,t){let{types:n,texts:r,starts:i,error:a}=GP(e),o=0,s=t=>{let r=n[o];throw r===1?a===void 0?zo(`state`,e,i[o],``,!0):new jo(a,`syntax`,{type:`state`,...Ro(e,i[o])}):zo(`state`,e,i[o],`Expecting ${t}, got '${RP[r]}'`)},c=e=>(n[o]!==e&&s(`'${RP[e]}'`),r[o++]),l=()=>{let e=n[o];e!==14&&e!==44&&s(`'ID', 'EDGE_STATE'`);let t=r[o++].trim();return n[o]===45?(o++,{stmt:`state`,id:t,classes:[c(14).trim()],type:`default`,description:``}):{stmt:`state`,id:t,type:`default`,description:``}};for(;n[o]===2;)o++;n[o]!==3&&s(`'NL', 'SD'`),o++;let u=[],d=[],f=e=>{e!==`nl`&&u.push(e)},p=(e,t)=>{o++;let n=[];u.push({stmt:`state`,id:e,type:`default`,description:t,doc:n}),d.push(u),u=n};for(;;){let e=n[o];switch(e){case 2:o++;break;case 14:case 44:{let e=l();if(n[o]===4)e.description=t.trimColon(r[o++]),f(e);else if(n[o]===5){o++;let i=l();n[o]===4?f({stmt:`relation`,state1:e,state2:i,description:t.trimColon(r[o++])}):f({stmt:`relation`,state1:e,state2:i})}else f(e);break}case 6:f(r[o++]);break;case 7:o++,c(8),f(r[o-2]);break;case 9:n[o+1]===10?p(r[o++],``):f(r[o++]);break;case 12:{let e=r[o++];c(13);let t=c(14);if(n[o]===10)p(t,e);else if(t.includes(`:`)){let n=t.split(`:`);f({stmt:`state`,id:n[0],type:`default`,description:[e.trim(),n[1]]})}else f({stmt:`state`,id:t,type:`default`,description:e.trim()});break}case 15:f({stmt:`state`,id:r[o++],type:`fork`});break;case 16:f({stmt:`state`,id:r[o++],type:`join`});break;case 17:f({stmt:`state`,id:r[o++],type:`choice`});break;case 18:o++,f({stmt:`state`,id:t.getDividerId(),type:`divider`});break;case 19:{let e=r[o++];if(n[o]===46||n[o]===47){let e=r[o++].trim();f({stmt:`state`,id:c(14).trim(),note:{position:e,text:c(20).trim()}})}else n[o]!==20&&s(`'NOTE_TEXT', 'left_of', 'right_of'`),o++,c(13),c(14),f(e);break}case 40:case 41:case 42:case 43:{let n=KP[e-40];o++,t.setDirection(n),f({stmt:`dir`,value:n});break}case 21:{o++;let e=c(22).trim();t.setAccTitle(e),f(e);break}case 23:{o++;let e=c(24).trim();t.setAccDescription(e),f(e);break}case 25:{let e=r[o++].trim();t.setAccDescription(e),f(e);break}case 26:{o++;let e=l(),t,i=``;n[o]===28?(o++,t=c(27)):(n[o]!==27&&s(`'STRING', 'HREF'`),t=r[o++],i=c(27)),c(2),f({stmt:`click`,id:e,url:t,tooltip:i});break}case 29:o++,f({stmt:`classDef`,id:c(30).trim(),classes:c(32).trim()});break;case 34:o++,f({stmt:`style`,id:c(35).trim(),styleClass:c(36).trim()});break;case 37:o++,f({stmt:`applyClass`,id:c(38).trim(),styleClass:c(39).trim()});break;case 11:d.length===0&&s(`'$end', ${qP}`),o++,u=d.pop();break;case 0:return d.length>0&&s(`'STRUCT_STOP', ${qP}`),t.setRootDoc(u),u;default:s(d.length>0?`'STRUCT_STOP', ${qP}`:`'$end', ${qP}`)}}}var YP=40,XP=16,ZP=44,QP=16,$P=10,eF=16,tF=10,nF=26,rF=8,iF=320,aF=10,oF=8,sF=` fill="var(--_s)" stroke="var(--_b)"`,cF=` fill="none" stroke="var(--_b)"`,lF=/(?:^| )statediagram-(?:state|cluster-alt|cluster|note)(?= |$)/g,uF=new Map([[`rectWithTitle`,1],[`stateStart`,2],[`stateEnd`,3],[`choice`,4],[`fork`,5],[`join`,6],[`note`,7],[`divider`,10]]),dF=[`pele-node pele-state`,`pele-node pele-state`,`pele-node pele-state-start`,`pele-node pele-state-end`,`pele-node pele-state-choice`,`pele-node pele-state-fork`,`pele-node pele-state-join`,`pele-note`,`pele-cluster pele-state-composite`];function fF(e){return e===`TB`||e===`BT`}function pF(e,t,n){let r=e.state?.[t];return typeof r==`number`&&r>0?Math.min(r,2e3):n}function mF(e){let t=0,n=e.length;for(;t<n&&e.charCodeAt(t)===34;)t++;for(;n>t&&e.charCodeAt(n-1)===34;)n--;return e.slice(t,n)}function hF(e,t,n){return e<t?t:e>n?n:e}function gF(e,t,n,r,i){return`<rect x="${X(e)}" y="${X(t)}" width="${X(n)}" height="${X(r)}"${i}/>`}function _F(e,t,n,r){let i=op(0,0);return i.isGroup=!0,i.dir=e,i.padX=t,i.padTop=n,i.padBottom=r,i}function vF(e,t,n){return Dh(e.direction)?Eh(n,r=>yF(e,t,n,r)):yF(e,t,n,!1)}function yF(e,t,n,r){let i=e.graph,a=t.flowchart?.curve,o=n.fontSize??16,s=Math.round(o*.875),c=n.measurer??bc(n.fontFamily,n.fontFamilyMono),l=pF(t,`wrappingWidth`,200),u=n.padding??8,d=n.icons,f=r?`TB`:Vf(e.direction),p=Q(void 0,!1,c,o,0),m=(e,t,n,r=0)=>Q(e,!0,c,t,n,r),h=new Map,g=[],_=[],v=(e,t,n)=>(g.push({node:e,kind:t,style:void 0,label:p,lines:[],w:0,h:0,titleH:0}),n&&_.push(n),g.length-1);for(let e of i.nodes){if(e.shape===`noteGroup`)continue;let t=e.isGroup?e.shape===`divider`?9:8:uF.get(e.shape)??0;h.set(e.id,v(e,t,void 0))}let y=g.length,b=[];for(let e=0;e<y;e++){let t=g[e].node.parentId,n=t===void 0?void 0:h.get(t);b.push(n!==void 0&&n!==e&&g[n].node.isGroup?n:-1)}{let e=[];for(let t=0;t<y;t++)e.push([]);let t=[],n=new Uint8Array(y);for(let r=0;r<y;r++)b[r]===-1?(n[r]=1,t.push(r)):e[b[r]].push(r);let r=0,i=()=>{for(;r<t.length;r++)for(let i of e[t[r]])n[i]||(n[i]=1,t.push(i))};i();let a=new Int32Array(y).fill(-1);for(let e=0;e<y;e++){if(n[e])continue;let r=e;for(;a[r]!==e;)a[r]=e,r=b[r];b[r]=-1,n[r]=1,t.push(r),i()}}let x=new Int32Array(y).fill(-1);for(let e=0;e<y;e++){let t=g[e].node.noteFor,n=t===void 0?void 0:h.get(t);n!==void 0&&(x[e]=n,b[e]=b[n])}let S=e=>Vf(g[e].node.dir),C=e=>fF(b[e]===-1?f:S(b[e])),w=new Int32Array(y),T=new Uint8Array(y),E=Array(y).fill(1/0),D=0,O=new Int32Array(2*y);for(let e of i.edges){let t=h.get(e.start),n=h.get(e.end);if(t!==void 0&&n!==void 0){if(e.pattern===`dashed`){T[g[t].kind===7?n:t]=1;continue}w[t]=Math.max(w[t],++O[2*t]),w[n]=Math.max(w[n],++O[2*n+1]),E[t]===1/0&&(E[t]=D++),E[n]===1/0&&(E[n]=D++)}}for(let e=0;e<y;e++){let t=g[e],n=t.node,r=nm(n.cssStyles.length>0?n.cssCompiledStyles.concat(n.cssStyles):n.cssCompiledStyles),i=+!!r.bold|(r.italic?2:0),a=r.fontSize??o;t.style=r;let c;switch(t.kind){case 8:t.label=m(n.label,a,4e3,i),t.titleH=t.label.height>0?t.label.height+12:0,c=_F(S(e),QP,t.titleH+QP,QP),c.minW=t.label.width+2*QP;break;case 9:c=_F(S(e),$P,$P,$P);break;case 2:t.w=t.h=14;break;case 3:t.w=t.h=18;break;case 4:t.w=t.h=30;break;case 5:case 6:{let n=hF(40*w[e]+16,72,320);t.w=C(e)?n:oF,t.h=C(e)?oF:n;break}case 10:break;case 7:t.label=m(n.label,s,Math.max(l,iF)),t.w=t.label.width+24,t.h=t.label.height+16;break;default:{t.label=m(n.label,a,l,i);let e=t.label.width,r=t.label.height+2*tF;if(t.kind===1){r+=14;for(let a of n.description){let n=m(a===``?` `:a,s,l,i);t.lines.push(n),n.width>e&&(e=n.width),r+=n.height}}t.w=Math.max(e+2*eF,56),t.h=r}}c??=op(t.w,t.h),(t.kind===0||t.kind===1)&&(c.span=(C(e)?t.w:t.h)-24),_.push(c)}let k=[],A=[],j=[],M=new Int32Array(y),N=new Float64Array(y),P=new Float64Array(y),F=new Map,I=(e,t)=>{if(!_[e].isGroup)return!1;for(let n=b[t];n!==-1;n=b[n])if(n===e)return!0;return!1},L=(e,t)=>(F.set(k.length,e),E.push(t?-1:1/0),v(void 0,10,op(0,0,e)));for(let e of i.edges){let t=h.get(e.start),n=h.get(e.end);if(t===void 0||n===void 0)continue;let r=m(e.label,s,l),i=r.width>0?r.width+12:0;t===n?(M[t]++,N[t]=Math.max(N[t],i),P[t]+=r.height):I(t,n)?t=L(t,!0):I(n,t)&&(n=L(n,!1)),j.push(e),A.push(r),k.push({src:t,dst:n,minlen:1,labelW:i,labelH:r.height>0?r.height+4:0,route:[],labelX:0,labelY:0})}for(let e=0;e<y;e++){if(x[e]!==-1)continue;let t=_[e],n=0;if(M[e]>0){let r=nF+(M[e]-1)*8;n=C(e)?r+N[e]:r*.75+4+P[e],t.isGroup||(C(e)?(t.w+=2*n,t.h=Math.max(t.h,P[e])):(t.h+=2*n,t.w=Math.max(t.w,N[e])),n=0)}if(!T[e]&&n===0){t.parent=b[e];continue}let r=C(e)?_F(`LR`,n,0,0):_F(`TB`,0,n,n);r.parent=b[e],E.push(E[e]),_[e].parent=v(void 0,10,r)}for(let e=0;e<y;e++)x[e]!==-1&&(_[e].parent=_[x[e]].parent);{let e=[];for(let t=0;t<_.length;t++)e.push([]);let t=[];for(let n=0;n<_.length;n++){let r=_[n].parent;r>=0?e[r].push(n):t.push(n)}let n=e=>g[e].kind===2?0:1,r=(e,t)=>n(e)-n(t)||(E[e]===E[t]?0:E[e]<E[t]?-1:1)||e-t,i=0,a=t.sort(r).reverse();for(;a.length>0;){let t=a.pop();_[t].seq=i++;let n=e[t].sort(r);for(let e=n.length-1;e>=0;e--)a.push(n[e])}}let R=lp(_,k,f,{nodeSep:pF(t,`nodeSpacing`,YP),edgeSep:XP,rankSep:pF(t,`rankSpacing`,ZP),portSep:20,tracks:a===`step`||a===`stepBefore`||a===`stepAfter`,straight:a===`linear`,headRoom:bp(`arrow_point`)}),z=Math.ceil(R.width+2*u),B=Math.ceil(R.height+2*u),V=[],H=new Map;for(let e of k){let t=e.route;for(let e=3;e<t.length-3;e+=3){let n=Math.round(t[e+1]),r=H.get(n);r?r.push(t[e]):H.set(n,[t[e]])}}let U=[];for(let e=0;e<_.length;e++)U.push([]);let ee=[];for(let e=0;e<_.length;e++){let t=_[e].parent;t>=0?U[t].push(e):ee.push(e)}let te=ee.slice();for(let e=0;e<ee.length;e++)for(let t of U[ee[e]])ee.push(t);let W=``,ne=[],G=``,re=``,K=``,ie=(e,t,n,r,i)=>{let a=e.filter(e=>g[e].kind===9);if(a.length<2)return;let o=(e,t)=>t?_[e].x-_[e].w/2:_[e].y-_[e].h/2,s=(e,t)=>t?_[e].x+_[e].w/2:_[e].y+_[e].h/2;for(let e of[!0,!1]){let c=a.slice().sort((t,n)=>o(t,e)-o(n,e)||t-n),l=!0;for(let t=1;t<c.length;t++)s(c[t-1],e)>o(c[t],e)+.5&&(l=!1);if(l){for(let a=1;a<c.length;a++){let l=X((s(c[a-1],e)+o(c[a],e))/2+u);G+=`<path class="pele-divider" d="M${e?`${l},${X(n)}V${X(i)}`:`${X(t)},${l}H${X(r)}`}"/>`}return}}for(let e of a){let t=_[e];G+=gF(t.x-t.w/2+u,t.y-t.h/2+u,t.w,t.h,` class="pele-divider" rx="${aF}"`)}};ie(te,u/2,u/2,z-u/2,B-u/2);for(let t of ee){let r=g[t],i=r.node,a=r.style;if(i===void 0||a===void 0||r.kind>=9)continue;let o=_[t],c=o.x+u,l=o.y+u,f=r.w,p=r.h,m=pl(a),h=` class="pele-label"${m}${a.text}`,v;switch(r.kind){case 8:{let e=c-o.w/2,n=l-o.h/2;fl(a.shape)&&ne.push({box:[e,n,e+o.w,n+o.h],shape:a.shape}),v=gF(e,n,o.w,o.h,` rx="${aF}" fill="var(--_a)"${Gp(a.shape)?``:` fill-opacity="0.5"`} stroke="var(--_b)"${a.shape}`),r.titleH>0&&(v+=`<path d="M${X(e)},${X(n+r.titleH)}H${X(e+o.w)}"${cF}${a.line}/>`+Z(r.label,bF(o,r.label.width,H)+u,n+r.titleH/2,` class="pele-cluster-label"${m}${a.text}`,d)),ie(U[t],e,n+r.titleH,e+o.w,n+o.h);break}case 2:v=`<circle r="7" fill="var(--_l)"${a.shape}/>`;break;case 3:v=`<circle r="8.5" fill="var(--_bg)" stroke="var(--_l)"${a.line}/><circle r="5" fill="var(--_l)"${a.shape}/>`;break;case 4:v=`<polygon points="0,${X(-p/2)} ${X(f/2)},0 0,${X(p/2)} ${X(-f/2)},0"${sF}${a.shape}/>`;break;case 5:case 6:v=gF(-f/2,-p/2,f,p,` rx="2" fill="var(--_l)"${a.shape}`);break;case 7:{let e=X(f/2),t=X(p/2),n=X(f/2-rF),i=X(rF-p/2);v=`<path d="M-${e},-${t}H${n}L${e},${i}V${t}H-${e}Z" fill="var(--_bg)" stroke="var(--_b)"/><path d="M${n},-${t}V${i}H${e}"${cF}/>`+Z(r.label,0,0,` class="pele-label" font-size="${s}" fill="var(--_m)"`,d);break}default:{if(v=gF(-f/2,-p/2,f,p,` rx="${X(Math.min(aF,p/2))}"${sF}${a.shape}`),r.kind===0){v+=Z(r.label,0,0,h,d);break}let e=tF-p/2+r.label.height;v+=`<path d="M${X(-f/2)},${X(e+6)}H${X(f/2)}"${cF}${a.line}/>`+Z(r.label,0,e-r.label.height/2,h,d),e+=14;for(let t of r.lines)v+=Z(t,0,e+t.height/2,` class="pele-state-description" font-size="${s}"${m}${a.text}`,d),e+=t.height}}let y=e.links.get(i.id);if(y){let e=Xo(mF(y.tooltip));e&&(v=`<title>${Ec(e)}</title>`+v),v=Iu(v,Tu(mF(y.url)),i.id,V,n,` target="_blank"`)}let b=`<g class="${dF[r.kind]}${im(i.cssClasses.replace(lF,``))}" data-id="${Y(i.id)}"`;r.kind===8?W+=`${b}>${v}</g>`:r.kind===7?K+=`${b} transform="translate(${X(c)},${X(l)})">${v}</g>`:re+=`${b} transform="translate(${X(c)},${X(l)})">${v}</g>`}let q=(e,t,n)=>{let r=_[n];if(r.isGroup)return;let i=g[n],a=i.kind===5||i.kind===6,o=t===0?3:t-3;for(let n of[1,0]){let s=n?r.h:r.w,c=n?i.h:i.w,l=n?i.w:i.h,d=(n?r.y:r.x)+u,f=(n?r.x:r.y)+u,p=e[t+n]-d;if(!(Math.abs(Math.abs(p)-s/2)>=.5)){e[t+n]-=Math.sign(p)*(s-c)/2,a&&l>c&&(e[t+1-n]=hF(e[o+1-n],f-l/2+6,f+l/2-6));return}}},ae=vp();for(let e=0;e<k.length;e++){let t=k[e];t.src===t.dst||t.route.length<6||j[e].pattern===`dashed`||ae.add(t.dst,Lm(t.route,t.route.length-3,_[t.dst]),`arrow_point`)}let oe=``,se=``,ce=``,le=new Int32Array(y),ue=new Float64Array(y);for(let e=0;e<k.length;e++){let t=k[e],n=j[e],r=A[e],i=n.pattern===`dashed`,o=i?`none`:`arrow_point`,s;if(t.src===t.dst){let e=_[t.src],n=g[t.src],i=le[t.src]++,a=C(t.src),c=e.isGroup?e.w:n.w,l=e.isGroup?e.h:n.h,d=(a?c:l)/2,f=Math.max(Math.min((a?l:c)/2-4,8+i*6),2),p=nF+i*8,m=bp(o)/(Math.hypot(p,f)||1),h=(t,n)=>e.x+u+(a?d+t:-n),v=(t,n)=>e.y+u+(a?n:d+t),y=(e,t)=>`${X(h(e,t))},${X(v(e,t))}`;s={d:`M${y(0,-f)}C${y(p,-2*f)} ${y(p,2*f)} ${y(p*m,f+f*m)}`,sx:0,sy:0,sdx:0,sdy:0,ex:h(0,f),ey:v(0,f),edx:h(-p,-f)-h(0,0),edy:v(-p,-f)-v(0,0)};let b=Math.hypot(s.edx,s.edy)||1;s.edx/=b,s.edy/=b;let x=nF+(M[t.src]-1)*8,S=ue[t.src]+r.height/2;ue[t.src]+=r.height,t.labelX=a?e.x+d+x+4+t.labelW/2:e.x,t.labelY=a?e.y-P[t.src]/2+S:e.y+d+x*.75+4+S}else{let n=t.route.slice(),r=ae.of(t.src,Lm(n,0,_[t.src])),i=ae.of(t.dst,Lm(n,n.length-3,_[t.dst]));for(let e=0;e<n.length;e+=3)n[e]+=u,n[e+1]+=u;q(n,0,t.src),q(n,n.length-3,t.dst);let c=F.get(e);if(c!==void 0&&n.length>=6){let e=_[c],r=g[t.src].kind===10,i=r?0:n.length-3,a=(e.dir===`TB`||e.dir===`LR`)===r,o=fF(e.dir)?[n[i],e.y+u+(a?g[c].titleH-e.h/2:e.h/2),0]:[e.x+u+(a?-e.w/2:e.w/2),n[i+1],1];n=r?o.concat(n):n.concat(o)}s=yp(n,typeof a==`string`?a:void 0,0,bp(o),r,i)}let c=Np(s.d,[s.ex,s.ey],ne,``,s.tokens);c===``&&(oe+=Ip(s,`none`,o));let l=i?`pele-note-edge" stroke="${c||`var(--_b)`}" stroke-dasharray="3 4`:c?`pele-transition" stroke="${c}`:`pele-transition`;if(se+=`<g class="pele-edge ${l}" data-id="${Y(n.id)}"><path d="${s.d}"/>`+xp(o,s.ex,s.ey,s.edx,s.edy,c||`var(--_l)`)+`</g>`,r.width>0){let e=t.labelX+u,i=t.labelY+u;ce+=Rp(n.id,r,e,i,``,d)}}let de=__(e.title,c,o,u,z,B,(W?`<g class="pele-clusters">${W}</g>`:``)+(G?`<g class="pele-dividers" stroke-dasharray="4 4"${cF}>${G}</g>`:``)+Lp(oe)+(se?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${se}</g>`:``)+(ce?`<g class="pele-edge-labels" font-size="${s}">${ce}</g>`:``)+`<g class="pele-nodes">${re}${K}</g>`);return{svg:lm(`state`,de.width,de.height,o,n,e,de.content),width:de.width,height:de.height,links:V}}function bF(e,t,n){let r=n.get(Math.round(e.y-e.h/2));if(r===void 0||t===0)return e.x;let i=e.x-e.w/2,a=t/2,o=e.x,s=-1;for(let t of[e.x,i+QP+a,i+e.w-QP-a]){let n=1/0;for(let o of r)o>i&&o<i+e.w&&(n=Math.min(n,Math.abs(o-t)-a));if(n>=6)return t;n>s+.5&&(s=n,o=t)}return o}var xF={type:`state`,math:!0,parse(e,t,n){let r=new LP;return n&&(r.title=n),JP(e,r),r},render:vF},SF=34,CF=24,wF=8,TF=2e4,EF=1e4,DF=2e6,OF=4,kF=3,AF=8,jF=20,MF=20,NF=14,PF=3;function FF(e,t,n,r,i=CF){let a=e.length;if(a===0)return{width:0,height:0};let o=n===`LR`||n===`RL`,s=n===`BT`||n===`RL`,c=[];for(let t=a-1;t>=0;t--)e[t].parent<0&&e[t].isGroup&&c.push(t);let l=Math.max(1,c.length),u=new Int32Array(a).fill(-1);c.forEach((e,t)=>u[e]=t);let d=new Uint8Array(a);for(let t=0;t<a;t++)e[t].parent>=0&&(d[e[t].parent]=1);let f=new Float64Array(l).fill(i),p=i,m=t=>{let n=t,r=i;for(let t=0;e[n].parent>=0&&t<EF;t++)n=e[n].parent,u[n]<0&&(r+=Math.max(e[n].padX,e[n].padTop,e[n].padBottom));let a=Math.max(0,u[n]);return r>f[a]&&(f[a]=r),r>p&&(p=r),a},h=new Int32Array(a).fill(-1),g=[];for(let t=0;t<a;t++)u[t]>=0||e[t].isGroup&&d[t]||(h[t]=g.length,g.push(t));let _=e=>o?e.w:e.h,v=e=>o?e.h:e.w,y=g.map(t=>Gd(v(e[t]),_(e[t]))),b=[],x=[],S=1;{let e=new Set;for(let n=0;n<t.length;n++){let r=t[n],i=h[r.src],a=h[r.dst];if(i<0||a<0||i===a)continue;let s=Math.min(i,a)*g.length+Math.max(i,a);(r.labelW>0||e.has(s))&&(S=2),e.add(s),b.push(Kd(i,a,r.minlen,o?r.labelH:r.labelW,o?r.labelW:r.labelH)),x.push(n)}}Cf(y,b),wf(y,b,S);let C=b.length,w=Int32Array.from(g,m),T=(n,i)=>{let d=f.map((e,t)=>i[t]?Math.max(e,MF):e),m=new Uint8Array(l),_=0,v=new Int32Array(C);for(let e=0;e<C;e++)v[e]=Math.abs(y[b[e].head].rank-y[b[e].tail].rank),n[e]||(_+=v[e]-1);let T=_>TF,E=g.length+(T?0:_),D=new Int32Array(E),O=new Int32Array(E),k=new Float64Array(E),A=new Float64Array(E),j=new Uint8Array(E),M=0;for(let e=0;e<g.length;e++)D[e]=y[e].rank,O[e]=w[e],k[e]=y[e].w,A[e]=y[e].h,D[e]>M&&(M=D[e]);let N=new Int32Array(C).fill(-1),P=new Int32Array(C).fill(-1),F=[];{let e=g.length;for(let t=0;t<C;t++){let r=b[t],i=r.reversed?r.head:r.tail,a=r.reversed?r.tail:r.head;if(T||v[t]<2||n[t]){F.push(i,a);continue}let o=D[i],s=D[a],c=-1;r.labelW>0&&(c=o+(s-o>>1),S===2&&!(c&1)&&c--),N[t]=e;let l=i;for(let n=o+1;n<s;n++){let u=e++;D[u]=n,O[u]=O[i]+Math.round((O[a]-O[i])*(n-o)/(s-o)),j[u]=1,n===c&&(k[u]=r.labelW,A[u]=r.labelH,P[t]=u),F.push(l,u),l=u}F.push(l,a)}}let I=new Int32Array(E+1),L=new Int32Array(E+1);for(let e=0;e<F.length;e+=2)L[F[e]+1]++,I[F[e+1]+1]++;for(let e=0;e<E;e++)I[e+1]+=I[e],L[e+1]+=L[e];let R=new Int32Array(F.length/2),z=new Int32Array(F.length/2);{let e=I.slice(0,E),t=L.slice(0,E);for(let n=0;n<F.length;n+=2)z[t[F[n]]++]=F[n+1],R[e[F[n+1]]++]=F[n]}let B=[];for(let e=0;e<=M;e++)B.push([]);for(let e=0;e<E;e++)B[D[e]].push(e);let V=new Float64Array(E),H=new Float64Array(E),U=e=>{e.sort((e,t)=>O[e]-O[t]||H[e]-H[t]||e-t);for(let t=0;t<e.length;t++)V[e[t]]=t};for(let e of B){for(let t=0;t<e.length;t++)H[e[t]]=t;U(e)}for(let e=0;e<wF&&M>0;e++){let t=!(e&1);for(let e=1;e<=M;e++){let n=B[t?e:M-e],r=t?I:L,i=t?R:z;for(let e of n){let t=0,n=r[e+1]-r[e];for(let n=r[e];n<r[e+1];n++)t+=V[i[n]];H[e]=n>0?t/n:V[e]}U(n)}}let ee=(e,t)=>j[e]||j[t]?r.edgeSep:r.nodeSep,te=(e,t)=>{let n=0;for(;n<e.length;){let r=n;for(;r+1<e.length&&O[e[r+1]]===O[e[n]];)r++;t(e,n,r),n=r+1}},W=(e,t,n)=>{let r=k[e[t]];for(let i=t;i<n;i++)r+=ee(e[i],e[i+1])+k[e[i+1]];return r},ne=new Float64Array(l),G=c.length>0?SF:0;for(let t=0;t<c.length;t++){let n=e[c[t]];ne[t]=Math.max(0,n.minW-2*d[t]),n.padTop>G&&(G=n.padTop)}for(let e of B)te(e,(t,n,r)=>{let i=W(e,n,r);i>ne[O[e[n]]]&&(ne[O[e[n]]]=i)});let re=new Float64Array(l+1);for(let e=0;e<l;e++)re[e+1]=re[e]+ne[e]+2*d[e];let K=new Float64Array(E),ie=new Float64Array(E),q=(e,t,n)=>{let r=O[e[t]],i=(re[r]+d[r]+(re[r+1]-d[r])-W(e,t,n))/2;for(let r=t;r<=n;r++)K[e[r]]=i+k[e[r]]/2,r<n&&(i+=k[e[r]]+ee(e[r],e[r+1]))},ae=(e,t,n)=>{let r=O[e[t]],i=re[r]+d[r];for(let r=t;r<=n;r++){let t=e[r];K[t]=Math.max(ie[t],i+k[t]/2),r<n&&(i=K[t]+k[t]/2+ee(t,e[r+1]))}let a=re[r+1]-d[r];for(let r=n;r>=t;r--){let n=e[r];K[n]=Math.min(K[n],a-k[n]/2),r>t&&(a=K[n]-k[n]/2-ee(e[r-1],n))}};for(let e of B)te(e,q);for(let e=0;e<4&&M>0;e++){let t=!(e&1);for(let e=1;e<=M;e++){let n=B[t?e:M-e],r=t?I:L,i=t?R:z;for(let e of n){let t=0,n=0;for(let a=r[e];a<r[e+1];a++)O[i[a]]===O[e]&&(t+=K[i[a]],n++);ie[e]=n>0?t/n:K[e]}te(n,ae)}}let oe=new Float64Array(M+1),se=new Float64Array(M+1),ce=new Float64Array(M+1).fill(r.rankSep/S);if(n.some(e=>e===1)){let e=r.rankSep/S;ce.fill(e/PF);for(let t=0;t<C;t++){let r=b[t],i=r.reversed?r.head:r.tail,a=r.reversed?r.tail:r.head;if(n[t]){if(r.labelH<=0||v[t]>S)continue;let n=Math.min(e,(r.labelH+2*jF-Math.min(A[i],A[a])/2)/v[t]);for(let e=D[i];e<D[a];e++)n>ce[e]&&(ce[e]=n);continue}let o=N[t];if(o<0||v[t]<=S*r.minlen)for(let t=D[i];t<D[a];t++)ce[t]=e;else for(let n=o-1;n<o+v[t]-1;n++){let r=n<o?i:n,s=n+1<o+v[t]-1?n+1:a;(O[r]!==O[s]||Math.abs(K[r]-K[s])>=.5)&&(ce[D[r]]=e)}}}let le=G+p;for(let e=0;e<=M;e++){let t=0;for(let n of B[e])A[n]>t&&(t=A[n]);oe[e]=le,se[e]=le+t,le+=t+(e===M?0:ce[e])}let ue=le+p,de=re[l],fe=e=>s?G+ue-e:e,pe=(e,t)=>o?fe(t):e,me=(e,t)=>o?e:fe(t),he=+!!o;for(let t=0;t<g.length;t++){let n=e[g[t]],r=(oe[D[t]]+se[D[t]])/2;n.x=pe(K[t],r),n.y=me(K[t],r)}for(let t=0;t<c.length;t++){let n=e[c[t]],r=(re[t]+re[t+1])/2,i=re[t+1]-re[t];n.x=o?ue/2:r,n.y=o?r:ue/2,n.w=o?ue:i,n.h=o?i:ue,n.padTop=G}let ge=new Int32Array(a),_e=[];for(let t=0;t<a;t++){if(!e[t].isGroup||u[t]>=0||h[t]>=0)continue;let n=0;for(let r=e[t].parent;r>=0&&n<EF;r=e[r].parent)n++;ge[t]=n,_e.push(t)}_e.sort((e,t)=>ge[t]-ge[e]||e-t);let ve=new Float64Array(a*4);for(let e=0;e<a;e++)ve[e*4]=1/0,ve[e*4+1]=1/0,ve[e*4+2]=-1/0,ve[e*4+3]=-1/0;let ye=(e,t)=>{t.x-t.w/2<ve[e*4]&&(ve[e*4]=t.x-t.w/2),t.y-t.h/2<ve[e*4+1]&&(ve[e*4+1]=t.y-t.h/2),t.x+t.w/2>ve[e*4+2]&&(ve[e*4+2]=t.x+t.w/2),t.y+t.h/2>ve[e*4+3]&&(ve[e*4+3]=t.y+t.h/2)};for(let t of g)e[t].parent>=0&&u[e[t].parent]<0&&ye(e[t].parent,e[t]);for(let t of _e){let n=e[t];if(ve[t*4]===1/0)continue;let r=Math.max(ve[t*4+2]-ve[t*4]+2*n.padX,n.minW);n.x=(ve[t*4]+ve[t*4+2])/2,n.w=r,n.y=(ve[t*4+1]-n.padTop+ve[t*4+3]+n.padBottom)/2,n.h=ve[t*4+3]-ve[t*4+1]+n.padTop+n.padBottom,n.parent>=0&&u[n.parent]<0&&ye(n.parent,n)}for(let e of t)e.route=[];for(let e=0;e<C;e++){let n=b[e],r=t[x[e]],i=n.reversed?n.head:n.tail,a=n.reversed?n.tail:n.head,o=[K[i],se[D[i]]-(se[D[i]]-oe[D[i]]-A[i])/2],s=N[e];if(s>=0)for(let t=s;t<s+v[e]-1;t++)o.push(K[t],oe[D[t]]),se[D[t]]>oe[D[t]]&&o.push(K[t],se[D[t]]);o.push(K[a],oe[D[a]]+(se[D[a]]-oe[D[a]]-A[a])/2);let c=[];for(let e=0;e<o.length;e+=2)c.push(pe(o[e],o[e+1]),me(o[e],o[e+1]),he);if(n.reversed)for(let e=0,t=c.length-3;e<t;e+=3,t-=3)for(let n=0;n<2;n++){let r=c[e+n];c[e+n]=c[t+n],c[t+n]=r}r.route=c;let l=P[e];if(l>=0){let e=(oe[D[l]]+se[D[l]])/2;r.labelX=pe(K[l],e),r.labelY=me(K[l],e)}else r.labelX=(c[0]+c[c.length-3])/2,r.labelY=(c[1]+c[c.length-2])/2}for(let n of t){if(n.route.length>0||n.src===n.dst)continue;let t=e[n.src],r=e[n.dst],[i,a]=IF(t,r),[o,s]=IF(r,t),c=+(Math.abs(o-i)>Math.abs(s-a));n.route=[i,a,c,o,s,c],n.labelX=(i+o)/2,n.labelY=(a+s)/2}let be=new Uint8Array(C),xe=t.reduce((e,t)=>e+t.route.length/3,0),Se=C*(g.length+t.length+xe);if(Se<=DF){let e=e=>(oe[D[e]]+se[D[e]])/2,n=t.map(e=>[o?e.labelY:e.labelX,fe(o?e.labelX:e.labelY)]),r=(e,t,n,r,i,a,o,s)=>n>i-o/2&&e<i+o/2&&r>a-s/2&&t<a+s/2,i=(i,a,s,c,l,u,d)=>{for(let t=0;t<g.length;t++)if(t!==l&&t!==u&&r(i,a,s,c,K[t],e(t),k[t]+8,A[t]+8))return!1;for(let e=0;e<t.length;e++){let l=t[e];if(e!==d&&l.labelW>0&&l.src!==l.dst&&r(i,a,s,c,n[e][0],n[e][1],o?l.labelH:l.labelW,o?l.labelW:l.labelH))return!1}return!0},a=(e,n,r,i,a)=>{let o=0;for(let s=0;s<t.length;s++){if(s===a)continue;let c=t[s].route;for(let t=3;t<c.length;t+=3)if(Math.max(c[t-3],c[t])>e&&Math.min(c[t-3],c[t])<r&&Math.max(c[t-2],c[t+1])>n&&Math.min(c[t-2],c[t+1])<i){o++;break}}return o},s=(e,n,r)=>{let i=0;for(let a=0;a<t.length;a++){let o=t[a].route;if(a===r||o.length===0)continue;let s=o.length-3;(Math.abs(o[0]-e)<1&&Math.abs(o[1]-n)<1||Math.abs(o[s]-e)<1&&Math.abs(o[s+1]-n)<1)&&i++}return i},c=(e,n,r,i,a)=>{let o=Math.abs(r-e)<.5,s=o?Math.min(n,i):Math.min(e,r),c=o?Math.max(n,i):Math.max(e,r),l=o?e:n;for(let e=0;e<t.length;e++){let n=t[e];if(e===a||n.src===t[a].src||n.dst===t[a].dst)continue;let r=n.route;for(let e=3;e<r.length;e+=3){let t=r[e-3+ +!o],n=r[e+ +!o];if(Math.abs(t-l)>=OF||Math.abs(n-l)>=OF)continue;let i=r[e-3+ +!!o],a=r[e+ +!!o];if(Math.min(c,Math.max(i,a))-Math.max(s,Math.min(i,a))>1)return!0}}return!1};for(let r=0;r<C;r++){let o=b[r],l=x[r],u=t[l],f=o.tail,p=o.head;if(O[f]===O[p]||Math.abs(K[p]-K[f])<1)continue;let h=K[f],g=K[p],_=e(f),v=e(p),y=Math.sign(g-h),S=Math.sign(v-_),C=(e,t)=>{for(let n=2;n<e.length;n+=2)if(!i(Math.min(e[n-2],e[n])-t,Math.min(e[n-1],e[n+1])-t,Math.max(e[n-2],e[n])+t,Math.max(e[n-1],e[n+1])+t,f,p,l)||c(pe(e[n-2],e[n-1]),me(e[n-2],e[n-1]),pe(e[n],e[n+1]),me(e[n],e[n+1]),l))return!1;let s=0,d=0,m=-1;if(u.labelW>0){let t=o.labelW,n=o.labelH;for(let r=2;r<e.length;r+=2){let o=(e[r-2]+e[r])/2,c=(e[r-1]+e[r+1])/2,f=Math.abs(e[r]-e[r-2]),p=Math.abs(e[r+1]-e[r-1]),h=f+p;if(h<=m||(f>0?f<t+8:p<n+8)||o-t/2<0||o+t/2>de||c-n/2<0||c+n/2>ue||!i(o-t/2,c-n/2,o+t/2,c+n/2,-1,-1,l))continue;let g=pe(o,c),_=me(o,c);a(g-u.labelW/2,_-u.labelH/2,g+u.labelW/2,_+u.labelH/2,l)>0||(s=o,d=c,m=h)}if(m<0)return!1}let h=[e[0],e[1]];for(let t=2;t<e.length;t+=2){let n=e[t]-e[t-2],r=e[t+1]-e[t-1],i=Math.abs(n)+Math.abs(r),a=t>2?jF:0,o=t+2<e.length?jF:0;i>a+o+1&&(a&&h.push(e[t-2]+n/i*a,e[t-1]+r/i*a),o&&h.push(e[t]-n/i*o,e[t+1]-r/i*o)),h.push(e[t],e[t+1])}u.route=[];for(let e=0;e<h.length;e+=2){let t=e===0?h[0]!==h[2]:h[e]!==h[e-2];u.route.push(pe(h[e],h[e+1]),me(h[e],h[e+1]),t?1-he:he)}return u.labelW>0&&(u.labelX=pe(s,d),u.labelY=me(s,d),n[l]=[s,d]),be[r]=1,!0};if(C([h+y*k[f]/2,_,g,_,g,v-S*A[p]/2],2)||C([h,_+S*A[f]/2,h,v,g-y*k[p]/2,v],2)||Se>DF/AF)continue;let w=[];for(let e of O[f]<O[p]?[O[p],O[f]]:[O[f],O[p]]){let t=Math.max(d[e]-NF,Math.min(d[e]/2,MF-NF));for(let n of[re[e]+t,re[e+1]-t]){if(Math.abs(n-h)<k[f]/2+4||Math.abs(n-g)<k[p]/2+4)continue;let t=[h+Math.sign(n-h)*k[f]/2,_,n,_,n,v,g+Math.sign(n-g)*k[p]/2,v],r=(s(pe(t[0],t[1]),me(t[0],t[1]),l)+s(pe(t[6],t[7]),me(t[6],t[7]),l))*1e6;for(let e=2;e<t.length;e+=2){let n=pe(t[e-2],t[e-1]),i=me(t[e-2],t[e-1]),o=pe(t[e],t[e+1]),s=me(t[e],t[e+1]);r+=a(Math.min(n,o),Math.min(i,s),Math.max(n,o),Math.max(i,s),l)*1e6+Math.abs(o-n)+Math.abs(s-i)}w.push({pts:t,cost:r,lane:e})}}w.sort((e,t)=>e.cost-t.cost);for(let e of w)if(C(e.pts,1)){m[e.lane]=1;break}}}return{width:o?ue:de,height:o?de:ue,routed:be,margins:m,work:Se}},E=new Uint8Array(C),D=new Uint8Array(l),O=T(E,D);for(let e=0;e<kF&&O.work<=DF/AF;e++){let t=e===0?O.routed:E.map((e,t)=>e&O.routed[t]);if(t.every((e,t)=>e===E[t])&&O.margins.every((e,t)=>e===D[t]))break;E=t,D=O.margins,O=T(E,D)}return E.some((e,t)=>e&&!O.routed[t])&&(O=T(new Uint8Array(C),new Uint8Array(l))),{width:O.width,height:O.height}}function IF(e,t){let n=t.x-e.x,r=t.y-e.y,i=Math.max(e.w/2,.5),a=Math.max(e.h/2,.5);if(Math.abs(n)<i&&Math.abs(r)<a)return i-Math.abs(n)<a-Math.abs(r)?[e.x+(n<0?-i:i),t.y]:[t.x,e.y+(r<0?-a:a)];let o=Math.min(n===0?1/0:i/Math.abs(n),r===0?1/0:a/Math.abs(r));return[e.x+n*o,e.y+r*o]}var LF=`__swimlane_default__`;function RF(e){let t=!1;for(let n of e.nodes)n.isGroup?n.dir=void 0:n.parentId===void 0&&(t=!0);if(t){for(let t of e.nodes)!t.isGroup&&t.parentId===void 0&&(t.parentId=LF);e.nodes.push({id:LF,label:void 0,labelType:`text`,shape:`rect`,isGroup:!0,parentId:void 0,cssStyles:[],cssCompiledStyles:[],cssClasses:``,dir:void 0})}}function zF(e,t,n,r,i,a,o){let s=e.x-e.w/2,c=e.y-e.h/2,l=a===`LR`||a===`RL`,u=l?s+e.padTop/2:e.x,d=l?e.y:c+e.padTop/2,f=Z(t,u,d,` class="pele-cluster-label"${pl(n,`var(--_m)`)}${n.text}`,o);return`<g class="pele-cluster pele-lane${r}" data-id="${i}"><rect x="${X(s)}" y="${X(c)}" width="${X(e.w)}" height="${X(e.h)}" fill="none" stroke="var(--_b)"/><rect x="${X(s)}" y="${X(c)}" width="${X(l?e.padTop:e.w)}" height="${X(l?e.h:e.padTop)}" fill="var(--_a)" stroke="var(--_b)"${n.shape}/>`+(l&&f?`<g transform="rotate(-90 ${X(u)} ${X(d)})">${f}</g>`:f)+`</g>`}function BF(e,t){let n=e.x-e.w/2,r=e.y-e.h/2;return t===`LR`||t===`RL`?[n,r,n+e.padTop,r+e.h]:[n,r,n+e.w,r+e.padTop]}var VF={type:`swimlane`,prepare:RF,layout:(e,t,n,r,i)=>FF(e,t,n,r,i?12:void 0),drawGroup:zF,filledBox:BF},HF={type:`swimlane`,math:!0,parse:aw.parse,render:(e,t,n)=>rw(e,t,n,VF)},UF=class{type=`timeline`;title;accTitle;accDescr;direction=`LR`;sections=[];periods=[];currentSection=``;getCommonDb(){return this}setDiagramTitle(e){this.title=e}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
149
|
+
`)}setDirection(e){this.direction=e}addSection(e){this.currentSection=e,this.sections.push(e)}addTask(e,t,n){this.periods.push({text:e,events:n?[n]:[],section:this.currentSection,sectionIndex:this.sections.length-1})}addEvent(e){let t=this.periods[this.periods.length-1];if(!t)throw new jo(`An event needs a time period before it.`,`semantic`,{type:`timeline`});t.events.push(e)}},WF=[`$end`,`EOF`,`INVALID`,`NEWLINE`,`timeline`,`timeline_lr`,`timeline_td`,`title`,`acc_title`,`acc_title_value`,`acc_descr`,`acc_descr_value`,`acc_descr_multiline_value`,`section`,`period`,`event`];function GF(e){let t=e.length,n=[],r=[],i=[],a={types:n,texts:r,starts:i},o=0,s=(t,a)=>{n.push(t),r.push(e.slice(o,a)),i.push(o),o=a};for(;o=CD(e,o),!(o>=t);){let n=e.charCodeAt(o),r=o+1;if(n===10){for(;e.charCodeAt(r)===10;)r++;s(3,r)}else{if(SD(e,o,`timeline`)){for(r=o+8;e.charCodeAt(r)===32||e.charCodeAt(r)===9;)r++;let t=SD(e,r,`lr`);if(r>o+8&&(t||SD(e,r,`td`))&&!Ls(e.charCodeAt(r+2))){s(t?5:6,r+2);continue}if(!Ls(e.charCodeAt(o+8))){s(4,o+8);continue}}if(SD(e,o,`title`)){for(r=o+5;e.charCodeAt(r)!==10&&J(e.charCodeAt(r));)r++;if(r===t||e.charCodeAt(r)===10){o=r;continue}let n=e.charCodeAt(o+5);if(n!==13&&J(n)){s(7,xD(e,o+6));continue}}if(r=TD(e,o,a,8),r!==o)o=r;else{if(SD(e,o,`section`)&&J(e.charCodeAt(o+7))){for(r=o+8;r<t&&e.charCodeAt(r)!==58&&e.charCodeAt(r)!==10;)r++;if(r>o+8){s(13,r);continue}}if(n!==58){r=o+1;for(let n=e.charCodeAt(r);r<t&&n!==35&&n!==58&&n!==10;n=e.charCodeAt(++r));s(14,r)}else{if(J(e.charCodeAt(o+1))){for(r=o+2;r<t;r++){let t=e.charCodeAt(r);if(t===10||t===58&&J(e.charCodeAt(r+1)))break}if(r>o+2){s(15,r);continue}}s(2,o+1)}}}}return(i.length===0||i[i.length-1]<t)&&s(1,t),s(0,t),a}var KF=`'EOF', 'SPACE', 'NEWLINE', 'title', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'section', 'period', 'event'`;function qF(e,t){let{types:n,texts:r,starts:i}=GF(e),a=(t,r)=>{let a=n[t]===0?`1`:WF[n[t]];throw zo(`timeline`,e,i[t],`Expecting ${r}, got '${a}'`)},o=n[0];o!==4&&o!==5&&o!==6&&a(0,`'timeline', 'timeline_lr', 'timeline_td'`),o!==4&&t.setDirection(o===5?`LR`:`TD`);for(let e=1;;e++){let i=r[e];switch(n[e]){case 3:break;case 7:t.getCommonDb().setDiagramTitle(i.substring(6));break;case 8:t.getCommonDb().setAccTitle(r[++e].trim());break;case 10:t.getCommonDb().setAccDescription(r[++e].trim());break;case 12:t.getCommonDb().setAccDescription(i.trim());break;case 13:t.addSection(i.substring(8));break;case 14:t.addTask(i,0,``);break;case 15:t.addEvent(i.substring(2));break;case 1:return;default:a(e,KF)}}}var JF=12,YF=8,XF=152,ZF=216,QF=264,$F=20,eI=20,tI=14,nI=8,rI=8,iI=12,aI=` fill="var(--_bg)"`,oI=` fill="none" stroke="var(--_b)"`;function sI(e,t,n,r,i){return`<rect x="${X(e)}" y="${X(t)}" width="${X(n)}" height="${X(r)}"${Kp(i)}/>`}function cI(e,t,n){return e.direction===`TD`?lI(e,t,n,!0):Eh(n,r=>lI(e,t,n,r))}function lI(e,t,n,r){let i=n.fontSize??16,a=Math.round(i*.875),o=n.measurer??bc(n.fontFamily,n.fontFamilyMono),s=n.padding??8,c=t.timeline?.disableMulticolor!==!0,l=e.periods,u=e.sections.length>0,d=e.sections.map((e,t)=>({section:t,periods:[]})),f={section:-1,periods:[]};l.forEach((e,t)=>(d[e.sectionIndex]??f).periods.push(t)),f.periods.length>0&&d.unshift(f);let p=r&&n.maxWidth!==void 0&&n.maxWidth>0?n.maxWidth-2*s:1/0,m=eI+tI*2+4*JF,h=Math.min(XF,Math.max(80,Math.round((p-m)*.38))),g=Math.min(QF,Math.max(110,p-m-h)),_=h,v=()=>r?g:_,y=l.map(e=>wE(e.text,o,i,_)),b=l.map(e=>e.events.map(e=>wE(e,o,a,v()))),x=0;for(let e of y)x=Math.max(x,e.width);if(!r)for(let e of b)for(let t of e)x=Math.max(x,t.width);let S=x>_;if(r)for(let e of b)for(let t of e)S||=t.width>g;S&&(_=Math.min(Math.max(Math.ceil(x),h),p===1/0?ZF:h),y=l.map(e=>TE(e.text,o,i,_)),b=l.map(e=>e.events.map(e=>TE(e,o,a,v()))));let C=Math.round(i*1.5),w=_+2*JF,T=v()+2*JF,E=e=>Math.max(e.height,C)+2*YF,D=e=>Math.max(e.height,Math.round(a*1.5))+2*YF,O=(e,t)=>e.section>=0?e.section:u?void 0:c?t:0,k=(e,t)=>{let n=O(e,t);return n===void 0?`var(--_m)`:om(n)},A=e=>(e===void 0?``:kl(e))||aI,j=!1;for(let e of b)e.length>0&&(j=!0);let M=0;for(let e of d)M+=Math.max(e.periods.length,1);let N=w+$F,P=l.length>0,F=r?w+(j?eI+tI*2+T:P?eI+iI:0):M>0?M*N-$F+(P?iI+mp:0):0,I=TE(e.title,o,i,Math.max(F,320),1),L=I.height>0?I.height+16:0,R=Math.max(F,I.width),z=s+(R-F)/2,B=s+L,V=(t,n)=>TE(e.sections[t.section],o,i,n-2*JF,1),H=(e,t,n,r,i,a)=>sI(n,r,i,a,` fill="${om(e.section)}"`)+Z(t,n+i/2,r+a/2,` font-weight="var(--_hw)"`+A(e.section)),U=(e,t,n,r,i,a)=>sI(r,i,w,a,` fill="${n}"`)+Z(y[e],r+w/2,i+a/2,A(O(t,e))),ee=(e,t,n,r,i)=>`<g class="pele-node pele-event">`+sI(n,r,T,i,` fill="${t}" fill-opacity="0.16"`)+Z(e,n+T/2,r+i/2,` font-size="${a}"`)+`</g>`,te=(e,t,n)=>`<circle class="pele-dot" cx="${X(e)}" cy="${X(t)}" r="4" fill="${n}" stroke="var(--_bg)" stroke-width="2"/>`,W=t=>t.section>=0?`<g class="pele-cluster pele-section" data-id="${Y(e.sections[t.section].trim())}">`:``,ne=e=>`<g class="pele-node pele-period" data-id="${Y(l[e].text.trim())}">`,G=``,re;if(r){let e=z+w+eI,t=e+tI,n=t+tI,r=B;for(let i of d){if(G+=W(i),i.section>=0){let e=V(i,F),t=E(e);G+=H(i,e,z,r,F,t),r+=t+rI+4}for(let a of i.periods){let o=k(i,a),s=E(y[a]),c=b[a].length>0?D(b[a][0]):s,l=r+Math.max(s,c)/2,u=`M${X(z+w)},${X(l)}H${X(e)}`,d=``,f=l-c/2,p=l;for(let e of b[a]){let r=D(e);p=f+r/2,u+=`M${X(t)},${X(p)}H${X(n)}`,d+=ee(e,o,n,f,r),f+=r+nI}d&&(u+=`M${X(e)},${X(l)}H${X(t)}V${X(p)}`),G+=ne(a)+U(a,i,o,z,l-s/2,s)+`<path class="pele-edge" d="${u}"${oI}/>`+te(e,l,o)+d+`</g>`,r=Math.max(l+s/2,f-nI)+$F}i.periods.length===0&&(r+=$F-rI-4),i.section>=0&&(G+=`</g>`)}if(d.length>0&&(r-=$F),P){let t=r+iI+mp;G=`<path class="pele-axis" d="M${X(e)},${X(B)}V${X(t-mp+1)}" fill="none" stroke="var(--_l)"/>`+xp(`arrow_point`,e,t,0,1,`var(--_l)`)+G,r=t}re=r+s}else{let e=0,t=d.map(t=>{if(t.section<0)return;let n=V(t,Math.max(t.periods.length,1)*N-$F);return e=Math.max(e,E(n)),n}),n=0;for(let e of y)n=Math.max(n,E(e));let r=B+(u?e+rI:0),i=r+n+(n>0?eI:0),a=i+eI,o=P?i+iI:B+e,c=0;if(d.forEach((s,l)=>{let u=Math.max(s.periods.length,1),d=z+c*N;G+=W(s);let f=t[l];f&&(G+=H(s,f,d,B,u*N-$F,e)),s.periods.forEach((e,t)=>{let c=k(s,e),l=d+t*N,u=l+w/2,f=`M${X(u)},${X(r+n)}V${X(b[e].length>0?a:i)}`,p=``,m=a;for(let t of b[e]){let e=D(t);m>a&&(f+=`M${X(u)},${X(m-nI)}V${X(m)}`),p+=ee(t,c,l,m,e),m+=e+nI}o=Math.max(o,m-nI),G+=ne(e)+U(e,s,c,l,r,n)+`<path class="pele-edge" d="${f}"${oI}/>`+te(u,i,c)+p+`</g>`}),s.section>=0&&(G+=`</g>`),c+=u}),P){let e=z+F;G=`<path class="pele-axis" d="M${X(z)},${X(i)}H${X(e-mp+1)}" fill="none" stroke="var(--_l)"/>`+xp(`arrow_point`,e,i,1,0,`var(--_l)`)+G}re=o+s}let K=Math.ceil(R+2*s),ie=Math.ceil(Math.max(re,s*2));return{svg:lm(`timeline`,K,ie,i,n,e,Z(I,K/2,s+I.height/2,` class="pele-title" font-weight="var(--_tw)"`)+G),width:K,height:ie,links:[]}}var uI={type:`timeline`,parse(e,t,n){let r=new UF;return r.title=n,qF(e,r),r},render:cI},dI=/[─━│┃└┗├┣]/,fI=/[└┗├┣]/,pI=/[─━]/,mI=/^[\s│┃]+$/,hI=/^[\s─━│┃└┗├┣]+$/,gI=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,_I=/^\s*%%/,vI=` `;function yI(e){return e.some(e=>dI.test(e))}function bI(e){for(let t of e){let e=fI.exec(t);if(e?.index&&e.index>0)return e.index}return 4}function xI(e,t){return e.replace(/\bline\s+(\d+)\b/gi,(e,n)=>{let r=t.get(parseInt(n,10));return r?`line ${r}`:e})}function SI(e,t){let n=0;for(let r=1;r<t;r++)n=e.indexOf(`
|
|
150
|
+
`,n)+1;return n}function CI(e,t,n){let{line:r}=Ro(e,SI(e,t+1));throw new jo(`Line ${r}: ${n}`,`syntax`,{type:`treeView`,line:r})}function wI(e,t){let n=0;for(let r=0;n<e.length&&r<t;n++)r+=e[n]===` `?4:1;return n}function TI(e){let t=new Map,n=new Map;if(!dI.test(e))return{text:e,lineMap:t,columns:n};let r=e.split(`
|
|
151
|
+
`),i=-1;for(let e=0;e<r.length;e++)if(r[e].trim()===`treeView-beta`){i=e;break}if(i===-1)return{text:e,lineMap:t,columns:n};let a=e=>e.trim()===``||_I.test(e)||gI.test(e),o=[];for(let e=i+1;e<r.length;e++){let t=r[e];a(t)||mI.test(t)||o.push(t.replace(/\t/g,` `))}if(!yI(o))return{text:e,lineMap:t,columns:n};let s=bI(o),c=[],l=(e,r,i)=>{c.push(e),t.set(c.length,r+1),i&&n.set(c.length,i)};for(let e=0;e<=i;e++)l(r[e],e);for(let t=i+1;t<r.length;t++){let n=r[t];if(a(n)){l(n,t);continue}if(mI.test(n))continue;let i=n.replace(/\t/g,` `),o=fI.exec(i);if(o){let r=Math.round(o.index/s)+1,a=o.index+1;for(;a<i.length&&pI.test(i[a]);)a++;for(;a<i.length&&i[a]===` `;)a++;let c=i.slice(a).trimEnd();c||CI(e,t,`Empty node — expected a filename or directory name after the box-drawing prefix`);let u=vI.repeat(r);l(u+c,t,e=>wI(n,a+Math.max(e-u.length,0)))}else{if(hI.test(i))continue;dI.test(i)?l(n,t):/^\s+/.test(i)?CI(e,t,`Unexpected indentation without box-drawing characters. In box-drawing format, use ├── or └── prefixes for indented nodes.`):l(n,t)}}return{text:c.join(`
|
|
152
|
+
`),lineMap:t,columns:n}}function EI(e,t){if(e.startsWith(`##`,t)||e.startsWith(`icon(`,t))return!0;if(!e.startsWith(`:::`,t))return!1;let n=t+3;for(;Ms(e.charCodeAt(n));)n++;let r=e.charCodeAt(n);return r>=65&&r<=90||r>=97&&r<=122||r===95}function DI(e,t){let n=e.charCodeAt(t);if(Ms(n)||n===10||n===13||n===34||n===39||e.startsWith(`:::`,t)||e.startsWith(`icon(`,t)||e.startsWith(`##`,t))return-1;let r=e.length,i=t+1;for(;i<r;){let t=e.charCodeAt(i);if(t===10||t===13)break;if(Ms(t)){let t=i+1;for(;Ms(e.charCodeAt(t));)t++;if(EI(e,t))break;i=t}else i++}return i}var OI={name:`BARE_NAME`,pattern:/(?!:::|icon\(|##)[^ \t\n\r"'](?:(?![ \t]+:::[ \t]*[A-Za-z_]|[ \t]+icon\(|[ \t]+##)[^\n\r])*/y,match:DI},kI=[{...mg(`treeView-beta`),longer:[OI]},wS(),ag,sg(String.raw`(?!%%)[^\n\r]`),{name:`CLASS_ANNOTATION`,pattern:/[ \t]+:::[ \t]*[A-Za-z_][\w-]*/y},{name:`ICON_ANNOTATION`,pattern:/[ \t]+icon\([\w-]*(?::[\w-]+)?\)/y},{name:`DESC_ANNOTATION`,pattern:/[ \t]+##[^\n\r]*/y},{name:`INDENTATION`,pattern:/[ \t]{1,}/y},{name:`QUOTED_NAME`,pattern:/"[^"]*"|'[^']*'/y},{name:`WS`,pattern:/[ \t]+/y,hidden:!0},{name:`ML_COMMENT`,pattern:/\%\%[^\n]*/y,hidden:!0},{name:`NL`,pattern:/\r?\n/y,hidden:!0},OI];function AI(e){let t=e.length;for(;t>0&&Ms(e.charCodeAt(t-1));)t--;return t===e.length?e:e.slice(0,t)}function jI(e,t){switch(e){case`INDENTATION`:return t?.length||0;case`QUOTED_NAME`:return t.substring(1,t.length-1);case`BARE_NAME`:return AI(t);case`CLASS_ANNOTATION`:return t.trim().substring(3).trim();case`ICON_ANNOTATION`:{let e=t.trim();return e.substring(5,e.length-1)}case`DESC_ANNOTATION`:return t.trim().substring(2).trim();default:return}}function MI(e){let t=new wg(rg(e,kI,`treeView`),kI,`treeView`),n={$type:`TreeView`,nodes:[]};for(t.expect(0);;)if(t.kind===1)n.accDescr=xg(t.take());else if(t.kind===2)n.accTitle=bg(t.take());else if(t.kind===3)n.title=yg(t.take());else break;for(;t.kind!==-1;){let e={$type:`TreeNode`,name:``};if(t.kind===7&&(e.indent=t.take().length),t.kind===8){let n=t.take();e.name=n.substring(1,n.length-1)}else t.kind===12?e.name=AI(t.take()):t.fail(`a name`);for(;;)if(t.kind===4)e.classAnnotation=jI(`CLASS_ANNOTATION`,t.take());else if(t.kind===5)e.iconAnnotation=jI(`ICON_ANNOTATION`,t.take());else if(t.kind===6)e.descAnnotation=jI(`DESC_ANNOTATION`,t.take());else break;n.nodes.push(e)}return n}var NI=class{count=1;root={id:0,level:-1,name:`/`,nodeType:`directory`,children:[]};stack=[this.root];addNode(e,t,n,r,i,a){let o=this.stack;for(;e<=o[o.length-1].level;)o.pop();let s={id:this.count++,level:e,name:t,nodeType:n,icon:i,cssClass:r,description:a,children:[]};o[o.length-1].children.push(s),o.push(s)}};function PI(e,t){for(let n of e.nodes){let e=typeof n.indent==`number`?n.indent:0,r=n.name,i=r.endsWith(`/`);i&&(r=r.slice(0,-1));let a=n.iconAnnotation;t.addNode(e,r,i?`directory`:`file`,n.classAnnotation||void 0,a===void 0?void 0:a||`none`,n.descAnnotation||void 0)}}function FI(e){let{text:t,lineMap:n,columns:r}=TI(e);try{return MI(t)}catch(i){if(!(i instanceof jo)||t===e)throw i;let a=n.get(i.line);if(a===void 0)throw i;let o=i.column>0?r.get(i.line)?.(i.column-1)??i.column-1:0,s=Ro(e,SI(e,a)+o),c=i.message.includes(`
|
|
153
|
+
`)?i.message.indexOf(`
|
|
154
|
+
`):i.message.length,l=i.message.slice(c);throw new jo(xI(i.message.slice(0,c),new Map([[i.line,s.line]]))+(i.snippet?l.replace(i.snippet,()=>s.snippet):l),i.code,{type:i.type,line:s.line,column:i.column>0?s.column:0,snippet:i.snippet?s.snippet:``})}}function II(e,t){let n=new NI;return PI(e,n),{type:`treeView`,title:e.title||t,accTitle:e.accTitle?e.accTitle.replace(/^\s+/g,``):void 0,accDescr:e.accDescr?e.accDescr.replace(/\n\s+/g,`
|
|
155
|
+
`):void 0,root:n.root,count:n.count}}var LI=`mermaid-treeview`,RI=new Map([[`folder`,`M3 6.5A1.5 1.5 0 0 1 4.5 5h4.6l2.4 2.5h8A1.5 1.5 0 0 1 21 9v9a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 18z`],[`file`,`M6.5 3h7L19 8.5v11a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 5 19.5v-15A1.5 1.5 0 0 1 6.5 3zM13.5 3v5.5H19`]]);function zI(e,t){if(e===void 0||!Object.prototype.hasOwnProperty.call(e,t))return;let n=e[t];return typeof n==`string`?n:void 0}function BI(e,t){let n=zI(t?.filenameIcons,e);if(n)return n;let r=e.lastIndexOf(`.`);if(r>0){let n=e.substring(r).toLowerCase();return zI(t?.extensionIcons,n)??zI(t?.extensionIcons,n.slice(1))}}function VI(e,t){return e.includes(`:`)?e:RI.has(e)||!t?`${LI}:${e}`:`${t}:${e}`}function HI(e,t){if(e.icon!==`none`){if(e.icon)return VI(e.icon,t.defaultIconPack);if(t.showIcons){if(e.nodeType===`file`){let n=BI(e.name,t);if(n===`none`)return;if(n)return VI(n,t.defaultIconPack)}return`${LI}:${e.nodeType===`directory`?`folder`:`file`}`}}}function UI(e){let t=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:void 0,n=t(e.treeView)??{};return{showIcons:!!n.showIcons,defaultIconPack:typeof n.defaultIconPack==`string`?n.defaultIconPack:``,filenameIcons:t(n.filenameIcons),extensionIcons:t(n.extensionIcons)}}var WI=6,GI=16,KI=7,qI=4,JI=4;function YI(e,t,n,r,i){let a=e.treeView?.[t];return typeof a==`number`&&a>=r&&a<=i?a:n}function XI(e){return{paddingX:YI(e,`paddingX`,5,0,100),paddingY:YI(e,`paddingY`,2,0,100),rowIndent:YI(e,`rowIndent`,15,0,400),lineThickness:YI(e,`lineThickness`,1,.25,12)}}function ZI(e,t,n){return Oh(n,r=>QI(e,t,n,r))}function QI(e,t,n,r){let i=n.fontSize??16,a=n.measurer??bc(n.fontFamily,n.fontFamilyMono),o=n.padding??8,s=UI(t),c=Array.isArray(n.monospace)&&n.monospace.includes(`files`),l=c?` font-family="${Vp}"`:``,{paddingX:u,paddingY:d,rowIndent:f,lineThickness:p}=XI(t),m=0,h=e.root.children.map(e=>[e,0]);for(let e=0;r&&e<h.length;e++){let[t,n]=h[e];m=Math.max(m,n);for(let e of t.children)h.push([e,n+1])}let g=r?Math.min(f+u,Math.max(2,((n.maxWidth??320)-120)/Math.max(1,m))):f+u,_=Math.round(i*1.5)+2*d,v=i,y=Q(e.title,!1,a,i,r?Ch(n):4e3,1),b=y.height>0?y.height+12:0,x=e=>e.some(e=>HI(e,s)!==void 0),S=[],C=new Map,w=[],T=(e,t)=>{let n=x(e);for(let r=e.length-1;r>=0;r--)w.push([e[r],t,n])};T(e.root.children,0);let E=0,D=!1,O=0;for(;w.length>0;){let[e,t,l]=w.pop(),u=t*g,f=Xo(e.name),p=u+(l?v+WI:0),m=Math.max(40,(n.maxWidth??320)-2*o-2*JI-p),h=e.nodeType===`directory`|(c?4:0),y=r?Lv(f,a,i,m,h):void 0,b=r&&e.description?Lv(Xo(e.description),a,i,m,2):void 0,x=y?y.width:a.width(f,i,h);p+x>E&&(E=p+x);let k=e.cssClass!==void 0&&e.cssClass.split(/\s+/).includes(`highlight`);k&&(D=!0);let A=r?Math.max(_,(y?.height??0)+(b?.height??0)+2*d):_,j={node:e,x:u,cy:O+(r?d+Math.max(v,y?.height??0)/2:A/2),icon:HI(e,s),text:f,labelX:p,highlighted:k,label:y,description:b,top:O,height:A};O+=A,S.push(j),C.set(e,j),T(e.children,t+1)}let k=E+GI,A=E;for(let e of S){let t=e.node.description;if(!t)continue;let n=e.description?e.description.width:a.width(Xo(t),i,2);A=Math.max(A,(r?e.labelX:k)+n)}A=Math.max(A,y.width);let j=o+(D?JI:0),M=o+b,N=Math.ceil(A+2*j),P=Math.ceil(M+O+o),F=``;for(let e of S){let t=e.node.children;if(t.length===0)continue;let n=j+e.x+KI,r=Math.max(n,j+e.x+g-u),i=M+C.get(t[t.length-1]).cy,a=Math.min(qI,r-n),o=`M${X(n)},${X(M+e.top+e.height-2)}V${X(i-a)}`;a>0&&(o+=`Q${X(n)},${X(i)} ${X(n+a)},${X(i)}H${X(r)}`);for(let e=0;e<t.length-1&&r>n;e++)o+=`M${X(n)},${X(M+C.get(t[e]).cy)}H${X(r)}`;F+=`<path d="${o}"/>`}let I=i*.35,L=``;for(let e of S){let t=e.node,r=M+e.cy,i=t.nodeType===`directory`,a=``;if(e.highlighted){let t=j+e.x-JI;a+=`<rect class="pele-tree-highlight" x="${X(t)}" y="${X(M+e.top+1)}" width="${X(N-j+JI-t)}" height="${X(e.height-2)}" fill="var(--_c)" fill-opacity="0.14"${Up}/>`}if(e.icon!==void 0){let t=e.icon.startsWith(LI+`:`)?e.icon.slice(LI.length+1):``,o=RI.get(t)??RI.get(i?`folder`:`file`),s=n.icons?.(e.icon)??`<path d="${o}" stroke="var(--_m)" stroke-width="1.5"/>`;a+=`<svg class="pele-icon" data-icon="${Y(e.icon)}" x="${X(j+e.x)}" y="${X(r-v/2)}" width="${X(v)}" height="${X(v)}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${s}</svg>`}e.label?a+=zv(e.label,j+e.labelX,M+e.top+d,` class="pele-label"${i?` font-weight="var(--_hw)"`:``}${l}`):e.text!==``&&(a+=`<text class="pele-label" x="${X(j+e.labelX)}" y="${X(r+I)}"${i?` font-weight="var(--_hw)"`:``}${l} xml:space="preserve">${Ec(e.text)}</text>`),e.description?a+=zv(e.description,j+e.labelX,M+e.top+d+(e.label?.height??0),` class="pele-tree-description" font-style="italic" fill="var(--_m)"`):t.description&&(a+=`<text class="pele-tree-description" x="${X(j+k)}" y="${X(r+I)}" font-style="italic" fill="var(--_m)" xml:space="preserve">${Ec(Xo(t.description))}</text>`),L+=`<g class="pele-node pele-tree-${i?`dir`:`file`}${im(t.cssClass??``)}" data-id="${Y(t.name)}">${a}</g>`}return{svg:lm(`treeView`,N,P,i,n,e,Z(y,N/2,o+y.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(F?`<g class="pele-tree-guides" fill="none" stroke="var(--_b)" stroke-width="${X(p)}">${F}</g>`:``)+L),width:N,height:P,links:[]}}var $I={type:`treeView`,parse:(e,t,n)=>II(FI(e),n),render:ZI};function eL(e){let t=[],n=[];for(let r of e){let e=r.type===`Leaf`,i={name:r.name,children:e?void 0:[]};for(i.classSelector=r.classSelector,r.cssCompiledStyles&&(i.cssCompiledStyles=r.cssCompiledStyles),e&&r.value!==void 0&&(i.value=r.value);n.length>0&&n[n.length-1].level>=r.level;)n.pop();n.length===0?t.push(i):n[n.length-1].node.children.push(i),e||n.push({node:i,level:r.level})}return t}function tL(e,t){let n=new Map;for(let t of e.TreemapRows){if(t.$type!==`ClassDefStatement`)continue;let e=n.get(t.className);e||n.set(t.className,e=[]);let r=(t.styleText??``).replace(/\\,/g,`§§§`).replace(/,/g,`;`).replace(/§§§/g,`,`);for(let t of r.split(`;`))e.push(t)}let r=[];for(let t of e.TreemapRows){if(t.$type!==`TreemapRow`)continue;let e=t.item,i=e.classSelector?n.get(e.classSelector):void 0;r.push({level:t.indent??0,name:e.name,type:e.$type,value:e.$type===`Leaf`?e.value:void 0,classSelector:e.classSelector,cssCompiledStyles:i&&i.length>0?i:void 0})}return{type:`treemap`,title:e.title||t,accTitle:e.accTitle?e.accTitle.replace(/^\s+/g,``):void 0,accDescr:e.accDescr?e.accDescr.replace(/\n\s+/g,`
|
|
156
|
+
`):void 0,roots:eL(r),classes:n}}var nL=[ig,ag,sg(String.raw`\w`),{name:`TREEMAP_KEYWORD`,pattern:/treemap-beta|treemap/y},{name:`CLASS_DEF`,pattern:/classDef\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\s+([^;\r\n]*))?(?:;)?/y},{name:`STYLE_SEPARATOR`,pattern:/:::/y},{name:`SEPARATOR`,pattern:/:/y},{name:`COMMA`,pattern:/,/y},{name:`INDENTATION`,pattern:/[ \t]{1,}/y},{name:`WS`,pattern:/[ \t]+/y,hidden:!0},{name:`ML_COMMENT`,pattern:/\%\%[^\n]*/y,hidden:!0},{name:`NL`,pattern:/\r?\n/y,hidden:!0},{name:`ID2`,pattern:/[a-zA-Z_][a-zA-Z0-9_]*/y},{name:`NUMBER2`,pattern:/[0-9_\.\,]+/y},{name:`STRING2`,pattern:/"[^"]*"|'[^']*'/y}],rL=/classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/;function iL(e){let t=new wg(rg(e,nL,`treemap`),nL,`treemap`),n=t.kinds,r={$type:`Treemap`,TreemapRows:[]},i=()=>t.accept(5)?t.expect(12):void 0;for(t.expect(3);t.kind!==-1;){let e=t.kind;if(e===0){r.accDescr=xg(t.take());continue}if(e===1){r.accTitle=bg(t.take());continue}if(e===2){r.title=yg(t.take());continue}e!==8&&e!==14&&e!==4&&t.fail(`a node, a class definition, or a title`);let a=e===8?t.take().length:void 0;if(t.kind===4){let e=rL.exec(t.take()),n={$type:`ClassDefStatement`,className:e[1]};e[2]&&(n.styleText=e[2]),a!==void 0&&(n.indent=a),r.TreemapRows.push(n);continue}let o=t.expect(14).slice(1,-1),s=n[t.i]===8?t.i+1:t.i,c;n[s]===6||n[s]===7?(t.i=s+1,t.accept(8),c={$type:`Leaf`,name:o,value:parseFloat(t.expect(13).replace(/,/g,``))}):c={$type:`Section`,name:o};let l=i();l!==void 0&&(c.classSelector=l);let u={$type:`TreemapRow`,item:c};a!==void 0&&(u.indent=a),r.TreemapRows.push(u)}return r}var aL=/^(?:.?[<>=^])?([-+( ])?(\$)?0?\d*(,)?(?:\.(\d+))?(~)?([a-zA-Z%])?$/;function oL(e){let t=``;for(let n=e.length;n>0;n-=3)t=e.slice(Math.max(0,n-3),n)+(t?`,`+t:``);return t}function sL(e){let t=aL.exec(e===`$0,0`?`$,`:e)??aL.exec(`,`),n=t[1]===`+`,r=t[3]!==void 0,i=t[4]===void 0?void 0:Math.min(Number(t[4]),20),a=t[6]??``;return e=>{let o=Math.abs(e),s,c=``;if(a===`f`?s=o.toFixed(i??6):a===`%`?(s=(o*100).toFixed(i??6),c=`%`):s=a===`d`?Math.round(o).toFixed(0):a===`e`?o.toExponential(i??6):String(Number(o.toPrecision(Math.max(1,i??12)))),t[5]&&s.includes(`.`)&&!s.includes(`e`)&&(s=s.replace(/\.?0+$/,``)),r&&!s.includes(`e`)){let e=s.indexOf(`.`);s=e===-1?oL(s):oL(s.slice(0,e))+s.slice(e)}return(e<0?`-`:n?`+`:``)+(t[2]??``)+s+c}}function cL(e,t,n){return{node:e,parent:t,series:n,value:e.children===void 0&&Number.isFinite(e.value)&&e.value>0?e.value:0,children:[],headed:!1,header:0,x:0,y:0,w:0,h:0}}var lL=(e,t,n)=>e>=t?Math.min(e,n):t;function uL(e,t,n,r,i,a,o){let s=t,c=0;for(;c<e.length;){let t=i*a/s,l=Math.min(i,a),u=e[c].value*t,d=u,f=Math.max(l*l*d/(u*u),u*u/(l*l*d)),p=c+1;for(;p<e.length;){let n=e[p].value*t,r=u+n,i=Math.max(l*l*d/(r*r),r*r/(l*l*n));if(i>f)break;f=i,u=r,p++}let m=u/l,h=0;for(let u=c;u<p;u++){let c=e[u],d=u===p-1?l-h:c.value*t/m,f=i>=a?n:n+h,g=i>=a?r+h:r,_=i>=a?m:d,v=i>=a?d:m,y=Math.round(f+_-o/2)>Math.round(f+o/2)?o/2:0,b=Math.round(g+v-o/2)>Math.round(g+o/2)?o/2:0;c.x=Math.round(f+y),c.y=Math.round(g+b),c.w=Math.round(f+_-y)-c.x,c.h=Math.round(g+v-b)-c.y,h+=d,s-=c.value}i>=a?(n+=m,i-=m):(r+=m,a-=m),c=p}}function dL(e,t,n,r){let i=e.map((e,t)=>cL(e,void 0,t)),a=i.slice();for(let e=0;e<a.length;e++){let t=a[e];for(let e of t.node.children??[]){let n=cL(e,t,t.series);t.children.push(n),a.push(n)}}for(let e=a.length-1;e>=0;e--){let t=a[e];t.parent&&(t.parent.value+=t.value)}let{gap:o,header:s,short:c,side:l}=r,u=[],d=(e,t,n,r,i)=>{let a=e.filter(e=>e.value>0).sort((e,t)=>t.value-e.value),s=0;for(let e of a)s+=e.value;if(a.length!==0&&Number.isFinite(s)){r=Math.max(0,r),i=Math.max(0,i),r>0&&i>0&&uL(a,s,t-o/2,n-o/2,r+o,i+o,o);for(let e of a){let a=lL(e.x,t,t+r),o=lL(e.y,n,n+i);e.w=lL(e.x+e.w,a,t+r)-a,e.h=lL(e.y+e.h,o,n+i)-o,e.x=a,e.y=o,u.push(e)}}};d(i,0,0,t,n);for(let e=0;e<u.length;e++){let t=u[e];if(t.children.length===0)continue;let n=t.h-s-l>=12?s:c;t.headed=t.w>Math.max(24,2*l)&&t.h-n-l>=8,t.header=t.headed?n:0,t.headed?d(t.children,t.x+l,t.y+n,t.w-2*l,t.h-n-l):d(t.children,t.x,t.y,t.w,t.h)}return u}var fL=28,pL=18,mL=6,hL=1.25,gL=e=>Ec(Xo(e).trim()).trim();function _L(e){let t=0,n=e.slice();for(;n.length>0;){let e=n.pop();e.children===void 0?Number.isFinite(e.value)&&e.value>0&&t++:n.push(...e.children)}return t}function vL(e,t){let n=Math.min(t.w,t.h)/4;return n<4?Kp(e).replace(`rx:var(--_r)`,`rx:min(var(--_r),${X(n)}px)`):Kp(e)}function yL(e,t,n,r,i){let a=e.treemap?.[t];return typeof a==`number`&&a>=r?Math.min(a,i):n}function bL(e,t,n){let r=n.fontSize??16,i=Math.round(r*.875),a=Math.round(r*.75),o=Math.round(r*.5625),s=n.measurer??bc(n.fontFamily,n.fontFamilyMono),c=t.treemap??{},l=n.padding??yL(t,`diagramPadding`,8,0,2e3),u=Math.round(wh(n,yL(t,`nodeWidth`,64,1,400)*10,200,2*l)),d=Math.round(yL(t,`nodeHeight`,40,1,400)*10),f=c.showValues!==!1,p=sL(typeof c.valueFormat==`string`?c.valueFormat:`,`),m=Math.min(1,Math.max(0,Math.log10(u*d/Math.max(1,_L(e.roots))/800))),h=dL(e.roots,u,d,{gap:yL(t,`padding`,Math.round(2+2*m),0,200),header:fL,short:pL,side:Math.round(3+3*m)}),g=Q(e.title,!1,s,r,Ch(n),1),_=g.height>0?g.height+8:0,v=l+Math.max(0,(g.width-u)/2),y=l+_,b=``,x=``;for(let e of h){let t=e.node,n=nm(t.cssCompiledStyles??[]),c=om(e.series),l=v+e.x,u=y+e.y,d=Xo(t.name).trim(),m=f?p(e.value):``,h=`data-id="${Y(t.name)}">`,g=gL(t.name),_=g===``?[]:[g];for(let t=e.parent;t!==void 0&&!t.headed;t=t.parent){let e=gL(t.node.name);e!==``&&_.unshift(e)}let S=_.join(` › `),C=e=>S===``||e===d&&S===g?``:`<title>${S}</title>`,w=`<rect x="${X(l)}" y="${X(u)}" width="${X(e.w)}" height="${X(e.h)}" fill="${c}"`,T=n.fontSize,E=+!!n.bold|(n.italic?2:0),D=Gp(n.shape)?pl(n):kl(e.series);if(t.children!==void 0){let r=``,o;if(e.headed){let t=e.header<fL,c=T??(t?a:i),f=T??a,p=e.w-2*mL-4,h=m?s.width(m,f,E):0,g=!t&&h>0&&p-h-12>=3*c,_=c*hL<e.header?rk(d,g?p-h-12:p,c,c,s,E|1):void 0,v=u+e.header/2+1;o=_?.text,_&&(r+=`<text x="${X(l+mL+2)}" y="${X(v+c*.35)}" font-weight="var(--_hw)"${t?` font-size="${c}"`:``}${D}${n.text}>${Ec(_.text)}</text>`),g&&f*hL<=fL&&(r+=`<text class="pele-value" x="${X(l+e.w-mL-2)}" y="${X(v+f*.35)}" font-size="${a}" text-anchor="end"${D||` fill="var(--_m)"`}${n.text}>${Ec(m)}</text>`)}let f=/[";]fill:/.test(n.shape)?``:` fill-opacity="0.12"`,p=e.headed?`${w}${vL(`${f} stroke="${c}"${n.shape}`,e)}/>`:`<rect x="${X(l)}" y="${X(u)}" width="${X(e.w)}" height="${X(e.h)}" fill="none"/>`;b+=`<g class="pele-node pele-section${im(t.classSelector??``)}" ${h}${C(o)}${p}${r}</g>`;continue}let O=``,k=e.w-8,A=T??o,j=T===void 0?Math.min(r,Math.floor((e.h-4)/hL)):T*hL<=e.h-4?T:0,M=j>=A?rk(d,k,j,A,s,E):void 0;if(M){let t=X(l+e.w/2),r=u+e.h/2,i=T??Math.max(o,Math.round(M.size*.8)),a=(M.size+i)*hL;if(m&&a<=e.h-4&&s.width(m,i,E)<=k){let e=r-a/2+M.size*hL/2,o=r+a/2-i*hL/2;O=`<text x="${t}" y="${X(e+M.size*.35)}" font-size="${X(M.size)}"${D}${n.text}>${Ec(M.text)}</text><text class="pele-value" x="${t}" y="${X(o+i*.35)}" font-size="${X(i)}"${D}${n.text}>${Ec(m)}</text>`}else O=`<text x="${t}" y="${X(r+M.size*.35)}" font-size="${X(M.size)}"${D}${n.text}>${Ec(M.text)}</text>`}x+=`<g class="pele-node pele-leaf${im(t.classSelector??``)}" ${h}${C(M?.text)}${w}${vL(n.shape,e)}/>${O}</g>`}let S=Math.ceil(Math.max(u,g.width)+2*l),C=Math.ceil(d+_+2*l);return{svg:lm(`treemap`,S,C,r,n,e,Z(g,S/2,l+g.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(b?`<g class="pele-sections" font-size="${i}">${b}</g>`:``)+(x?`<g class="pele-leaves" text-anchor="middle" fill="var(--_bg)">${x}</g>`:``)),width:S,height:C,links:[]}}var xL={type:`treemap`,parse:(e,t,n)=>tL(iL(e),n),render:bL},SL=`EOF USECASE ACTOR SYSTEM_BOUNDARY END DIRECTION TD TB BT LR RL NOTE FOR JSON CLASS_DEF CLASS STYLE INCLUDE EXTEND TRUE FALSE IDENTIFIER NUMBER AT COMMA COLON HASH_COLOR CSS_IDENTIFIER CSS_ESCAPED_COMMA DASH DOT PERCENT CSS_PUNCTUATION LABEL_PUNCTUATION LABEL_SYMBOL PLAIN_STRING MARKDOWN_STRING UNCLOSED_MARKDOWN_STRING COMMENT NEWLINE ACC_DESCR_BLOCK ACC_TITLE_LINE ACC_DESCR_LINE JSON_DECLARATION_START JSON_OBJECT_LITERAL UNCLOSED_JSON_OBJECT_LITERAL GENERALIZATION DEPENDENCY_ARROW STEREOTYPE_START STEREOTYPE_END STEREOTYPE_TEXT UNCLOSED_STEREOTYPE_TEXT CLASS_SEPARATOR FORWARD_SOLID BACKWARD_SOLID FORWARD_CIRCLE BACKWARD_CIRCLE FORWARD_CROSS BACKWARD_CROSS MARKERLESS_SOLID METADATA_START LBRACE RBRACE LBRACKET RBRACKET LPAREN RPAREN`.split(` `),CL=1,wL=2,TL=new Uint8Array(128);for(let e=48;e<=57;e++)TL[e]=CL;for(let e=65;e<=90;e++)TL[e]=TL[e+32]=CL;TL[95]=CL;for(let e of`!#$&*+/=?^|~`)TL[e.charCodeAt(0)]=wL;var EL=[0,12,5,14,3,9,2,2,2,2,2,4,3,4,8,5,5,7,6,4,5];function DL(e){return e<128&&(TL[e]&CL)!==0}function OL(e,t,n){for(let r=0;r<n.length;r++)if((e.charCodeAt(t+r)|32)!==n.charCodeAt(r))return!1;return!0}function kL(e,t,n){switch(n){case 97:return e.startsWith(`actor`,t)?2:0;case 115:return e.startsWith(`systemBoundary`,t)?3:e.startsWith(`style`,t)?16:0;case 101:return e.startsWith(`end`,t)?4:OL(e,t,`extend`)?18:0;case 69:return OL(e,t,`extend`)?18:0;case 100:return e.startsWith(`direction`,t)?5:0;case 84:return e.startsWith(`TD`,t)?6:e.startsWith(`TB`,t)?7:0;case 66:return e.startsWith(`BT`,t)?8:0;case 76:return e.startsWith(`LR`,t)?9:0;case 82:return e.startsWith(`RL`,t)?10:0;case 110:return e.startsWith(`note`,t)?11:0;case 102:return e.startsWith(`for`,t)?12:e.startsWith(`false`,t)?20:0;case 106:return e.startsWith(`json`,t)?13:0;case 99:return e.startsWith(`classDef`,t)?14:e.startsWith(`class`,t)?15:0;case 105:case 73:return OL(e,t,`include`)?17:0;case 116:return e.startsWith(`true`,t)?19:0;case 117:return+!!e.startsWith(`usecase-beta`,t);default:return 0}}function AL(e,t){[e,t]=Lo(e,t);let n=1,r=0;for(let i=0;i<t;i++){let a=e.charCodeAt(i);a!==10&&a!==13||(a===13&&i+1<t&&e.charCodeAt(i+1)===10&&i++,n++,r=i+1)}return[n,t-r+1]}function jL(e,t,n){let[r,i]=AL(e,t);return`line ${r}, column ${i} [${Lo(e,t)[1]},${Lo(e,n)[1]})`}function ML(e,t,n){for(let r=t+1;r<e.length;r++){let t=e.charCodeAt(r);if(t===n)return r+1;if(t===10||t===13)return-1}return-1}function NL(e,t){let n=e.charCodeAt(t);return n!==34&&n!==39||n===34&&e.charCodeAt(t+1)===96||ML(e,t,n)!==-1}function PL(e,t,n){let[r,i]=AL(e,t),[a,o]=[Lo(e,t)[1],Lo(e,t+n)[1]];return new jo(`Error lexing usecase diagram: unexpected character: ->${e.charAt(t)}<- at offset: ${a}, skipped ${o-a} characters. at line ${r}, column ${i} [${a},${o})`,`syntax`,{type:`usecase`,line:r,column:i})}function FL(e){let t=[],n=[],r=[],i=e.length,a=0,o=!0,s=!1;for(;a<i;){let c=e.charCodeAt(a);if(c===32||c===9){a++;continue}let l,u=a+1,d=!1;if(c<128&&(TL[c]&CL)!==0){if(l=0,c===97&&o&&e.startsWith(`acc`,a)){let t=e.startsWith(`Descr`,a+3);if(t||e.startsWith(`Title`,a+3)){let n=a+8;for(;Ms(e.charCodeAt(n));)n++;let r=e.charCodeAt(n);if(r===58)for(l=t?42:41,u=n+1;u<i&&e.charCodeAt(u)!==10&&e.charCodeAt(u)!==13;)u++;else if(r===123&&t&&!s){let t=e.indexOf(`}`,n+1);t===-1?s=!0:(l=40,u=t+1)}}}else if(c===106&&e.startsWith(`json`,a)&&Ms(e.charCodeAt(a+4))){let s=a+5;for(;Ms(e.charCodeAt(s));)s++;let c=s;for(;DL(e.charCodeAt(s));)s++;if(s>c){for(;Ms(e.charCodeAt(s));)s++;if(e.charCodeAt(s)===64){for(s++;Ms(e.charCodeAt(s));)s++;if(e.charCodeAt(s)===123){t.push(43),n.push(a),r.push(s),a=s;let c=0,l=!1,u=!1,d=s;for(;d<i;d++){let t=e.charCodeAt(d);if(l)u?u=!1:t===92?u=!0:t===34&&(l=!1);else if(t===34)l=!0;else if(t===123)c++;else if(t===125&&--c===0)break}t.push(d<i?44:45),n.push(s),a=d<i?d+1:i,r.push(a),o=!1;continue}}}}if(l===0){for(;u<i&&DL(e.charCodeAt(u));)u++;let t=kL(e,a,c);if(t!==0)t===1||u-a===EL[t]?(l=t,u=a+EL[t]):l=21;else if((c===111||c===120)&&e.charCodeAt(a+1)===45&&e.charCodeAt(a+2)===45)l=c===111?56:58,u=a+3;else if(Ps(c)){let t=a+1;for(;Ps(e.charCodeAt(t));)t++;if(e.charCodeAt(t)===46&&Ps(e.charCodeAt(t+1))){for(l=22,u=t+2;Ps(e.charCodeAt(u));)u++;for(;Fs(e.charCodeAt(u));)u++}else l=21}else for(l=21;e.charCodeAt(u)===45&&DL(e.charCodeAt(u+1));)for(l=27,u+=2;DL(e.charCodeAt(u));)u++}}else if(c===10)l=39,d=!0;else if(c===13)l=39,d=!0,e.charCodeAt(u)===10&&u++;else if(c===34||c===39){if(c===34&&e.charCodeAt(a+1)===96){let t=e.indexOf('`"',a+2);l=t===-1?37:36,u=t===-1?i:t+2}else if(l=35,u=ML(e,a,c),u===-1){let t=a+1;for(;t<i&&!NL(e,t);)t++;throw PL(e,a,t-a)}}else if(c===37){if(o&&e.charCodeAt(u)===37)for(l=38;u<i&&e.charCodeAt(u)!==10&&e.charCodeAt(u)!==13;)u++;else l=31}else if(c===45){if(e.charCodeAt(u)!==45)l=29;else{for(;e.charCodeAt(u)===45;)u++;let t=e.charCodeAt(u),n=u-a===2;n&&t===124&&e.charCodeAt(u+1)===62?(l=46,u+=2):t===62?(l=53,u++):n&&(t===111||t===120)?(l=t===111?55:57,u++):l=59}}else if(c===46){let t=e.charCodeAt(u);if(t===46&&e.charCodeAt(u+1)===62)l=47,u+=2;else if(Ps(t)){for(l=22;Ps(e.charCodeAt(u));)u++;for(;Fs(e.charCodeAt(u));)u++}else l=30}else if(c===60){if(e.charCodeAt(u)===60){if(t.push(48),n.push(a),r.push(a+2),o=!1,a+=2,a>=i)break;if(e.charCodeAt(a)===62&&e.charCodeAt(a+1)===62)l=49,u=a+2;else{let o=a,s=!1;for(;o<i;o++){let t=e.charCodeAt(o);if(t===10||t===13)break;if(t===62&&e.charCodeAt(o+1)===62){s=!0;break}}if(s&&e.slice(a,o).trim()!==``)t.push(50),n.push(a),r.push(o),l=49,a=o,u=o+2;else{for(;o<i&&e.charCodeAt(o)!==10&&e.charCodeAt(o)!==13;)o++;if(o===a){for(;o<i&&(e.charCodeAt(o)===10||e.charCodeAt(o)===13);)o++;throw PL(e,a,o-a)}l=51,u=o}}}else if(e.charCodeAt(u)===45&&e.charCodeAt(u+1)===45)for(l=54,u+=2;e.charCodeAt(u)===45;)u++;else l=33}else if(c===58)e.charCodeAt(u)===58&&e.charCodeAt(u+1)===58?(l=52,u+=2):l=25;else if(c===64)e.charCodeAt(u)===123?(l=60,u++):l=23;else if(c===123)l=61;else if(c===125)l=62;else if(c===91)l=63;else if(c===93)l=64;else if(c===40)l=65;else if(c===41)l=66;else if(c===44)l=24;else if(c===35){for(;Is(e.charCodeAt(u));)u++;l=u>a+1?26:32}else if(c===92)e.charCodeAt(u)===44?(l=28,u++):l=33;else if(c<127&&c>32)l=(TL[c]&wL)===0?33:32;else for(l=34;u<i;){let t=e.charCodeAt(u);if(t>=32&&t<127||t===9||t===10||t===13)break;u++}t.push(l),n.push(a),r.push(u),a=u,o=d}for(let e=0;e<3;e++)t.push(0),n.push(i),r.push(i);return{types:t,starts:n,ends:r}}function IL(){return{type:`usecase`,actors:new Map,useCases:new Map,systemBoundaries:new Map,relationships:[],notes:new Map,jsonNodes:new Map,classDefs:new Map,direction:`LR`,title:void 0,accTitle:``,accDescr:``,accDescription:``,source:``,headerSpan:[0,0],statements:[]}}function LL(){return{elements:[],boundaries:[],jsons:[],relationships:[],notes:[],metadata:[],classes:[],styles:[],classDefs:[],direction:void 0,accTitle:``,accDescription:``}}function RL(e,t){if(t.length===0)return;let n=new Set(e);for(let r of t)n.has(r)||(n.add(r),e.push(r))}function zL(e){let t=new Set([`actor`,`usecase`,`boundary`,`edge`]);for(let{key:n,value:r}of e)if(n===`icon`)t.clear(),t.add(`actor`);else if(n===`animate`||n===`animation`)t.clear(),t.add(`edge`);else if(n===`type`)t.clear(),r===`rect`||r===`package`?t.add(`boundary`):(r===`normal`||r===`hollow`||r===`awesome`)&&t.add(`actor`);else if(n===`business`)t.delete(`boundary`),t.delete(`edge`);else return;return t.size===1?[...t][0]:void 0}function BL(e,t,n,r,i){let a=IL(),{actors:o,useCases:s,systemBoundaries:c}=a,l=new Map,u=new Map,d=new Map,f=new Map,p=new Map,m=t=>jL(e,t[0],t[1]),h=(t,n)=>{let[r,i]=AL(e,n[0]);return new jo(t,`semantic`,{type:`usecase`,line:r,column:i})},g=(e,t)=>{throw h(`${e} at ${m(t)}`,t)},_=(e,t,n,r,i)=>{let a=e=>e===void 0?``:` (label "${e}")`;throw h(`${e} at ${m(t)}${a(r)}; previous declaration at ${m(n)}${a(i)}`,t)},v=(e,t,n)=>g(`Metadata property '${n.key}' is invalid for ${t} '${e}'`,n.keySpan),y=(e,t)=>{let n=p.get(e);(n===void 0||t<n)&&p.set(e,t)},b=e=>[...e].sort((e,t)=>(p.get(e.id)??0)-(p.get(t.id)??0)),x=(e,t)=>{l.set(e.id,{kind:t,span:e.span,generated:e.generated,label:e.label.text})},S=(e,t)=>{let n=l.get(e.id);if(!n)return;let r=e.generated?e.label.text:void 0,i=n.generated?n.label:void 0;n.kind!==t&&_(`ID '${e.id}' is declared as both ${n.kind} and ${t}`,e.span,n.span,r,i),(n.generated||e.generated)&&_(`Generated ID '${e.id}' collides with another declaration`,e.span,n.span,r,i)},C=(e,t,n)=>{let r=l.get(e);r&&_(`ID '${e}' is declared more than once (${r.kind} and ${t})`,n,r.span,void 0,r.generated?r.label:void 0),l.set(e,{kind:t,span:n,generated:!1})},w=(e,t,n)=>{let{key:r,value:i}=t,a=a=>{!n&&a!==void 0&&a!==i&&_(`Actor '${e.id}' has conflicting ${r} metadata`,t.keySpan,e.span)};r===`type`&&(i===`normal`||i===`hollow`||i===`awesome`)?(a(e.actorType),e.actorType=i):r===`icon`&&typeof i==`string`?(a(e.icon),e.icon=i):r===`business`&&typeof i==`boolean`?(a(e.business),e.business=i):v(e.id,`actor`,t)},T=(e,t,n)=>{for(let r of t??[])e.kind===`actor`?w(e,r,n):r.key===`business`&&typeof r.value==`boolean`?(!n&&e.business!==void 0&&e.business!==r.value&&_(`Use case '${e.id}' has conflicting business metadata`,r.keySpan,e.span),e.business=r.value):v(e.id,`usecase`,r)},E=e=>{let t;if(e.kind===`actor`){s.delete(e.id);let n={id:e.id,label:e.label.text,labelType:e.label.type,business:e.business??!1,classes:[...e.classes],type:e.icon?`icon`:e.actorType??`normal`,styles:o.get(e.id)?.styles??[]};e.icon&&(n.icon=e.icon),o.set(e.id,n),t=n}else o.delete(e.id),t={id:e.id,label:e.label.text,labelType:e.label.type,business:e.business??!1,classes:[...e.classes],shape:e.shape??`ellipse`,styles:s.get(e.id)?.styles??[]},s.set(e.id,t);e.stereotype&&(t.stereotype=e.stereotype),e.parent?.id&&(t.parentId=e.parent.id)},D=e=>{S(e,e.kind);let t=e.parent?.id?e.parent:void 0,n=u.get(e.id);if(n)(n.label.text!==e.label.text||n.label.type!==e.label.type)&&_(`ID '${e.id}' has conflicting labels`,e.span,n.span),e.shape&&n.shape&&e.shape!==n.shape&&_(`Use case '${e.id}' has conflicting shapes`,e.span,n.span),t&&n.parent?.id&&t.id!==n.parent.id&&_(`Element '${e.id}' belongs to more than one system boundary`,t.span,n.parent.span),e.stereotype&&n.stereotype&&e.stereotype!==n.stereotype&&_(`Element '${e.id}' has conflicting stereotypes`,e.span,n.stereotypeSpan??n.span),n.shape??=e.shape,n.parent??=e.parent,n.stereotype??=e.stereotype,n.stereotypeSpan??=e.stereotype?e.span:void 0,RL(n.classes,e.classes),T(n,e.metadata,!1);else{let n={kind:e.kind,id:e.id,label:e.label,span:e.span,generated:e.generated,classes:[...e.classes],parent:t,shape:e.shape,stereotype:e.stereotype,stereotypeSpan:e.stereotype?e.span:void 0};T(n,e.metadata,!1),u.set(e.id,n),x(e,e.kind)}},O=e=>{S(e,`boundary`);let t=d.get(e.id);t?((t.label.text!==e.label.text||t.label.type!==e.label.type)&&_(`Boundary '${e.id}' has conflicting titles`,e.span,t.span),RL(t.classes,e.classes)):(d.set(e.id,{...e,classes:[...e.classes],members:[]}),x(e,`boundary`))},k=e=>{e.classed&&!e.declares&&g(`Relationship endpoint '${e.id}' uses ::: without declaring the node`,e.span);let t=l.get(e.id);return t?t.kind:(u.set(e.id,{...e,kind:`usecase`,shape:`ellipse`,classes:[]}),x(e,`usecase`),y(e.id,e.span[0]),`usecase`)},A=(e,t)=>{let n=l.get(e)?.kind;return(n===`actor`?o.get(e):n===`usecase`?s.get(e):n===`boundary`?c.get(e):n===`json`?a.jsonNodes.get(e):f.get(e))??g(`Class/style target '${e}' is unresolved or anonymous`,t)},j=[];for(let{source:e,target:n}of t.relationships)y(e.id,e.span[0]),y(n.id,n.span[0]);for(let e of t.elements)y(e.id,e.span[0]),j.push({offset:e.span[0],run:()=>D(e)});for(let e of t.boundaries)y(e.id,e.span[0]),j.push({offset:e.span[0],run:()=>O(e)});for(let e of t.jsons)y(e.id,e.span[0]),j.push({offset:e.span[0],run:()=>C(e.id,`json`,e.span)});for(let{id:e,idSpan:n}of t.relationships)e&&n&&j.push({offset:n[0],run:()=>C(e,`edge`,n)});j.sort((e,t)=>e.offset-t.offset);for(let e of j)e.run();for(let e of b(u.values()))E(e);for(let e of b(d.values()))c.set(e.id,{id:e.id,label:e.label.text,labelType:e.label.type,type:`rect`,members:[],classes:[],styles:[]});for(let e of b(t.jsons))a.jsonNodes.set(e.id,{id:e.id,value:e.value,propertyOrder:e.propertyOrder,classes:[...e.classes],styles:[]});let M=0;for(let e of t.relationships){let{source:t,target:n,type:r}=e,i=k(t),o=k(n),s=e=>e===`actor`||e===`usecase`||e===`json`;s(i)||_(`Relationship source '${t.id}' cannot be ${i}`,t.span,l.get(t.id).span),s(o)||_(`Relationship target '${n.id}' cannot be ${o}`,n.span,l.get(n.id).span),r!==`include`&&r!==`extend`||i===`usecase`&&o===`usecase`||g(`${r} relationship requires use-case endpoints`,e.span),r===`generalization`&&(i===`json`||i!==o)&&g(`Generalization requires actor-to-actor or use-case-to-use-case endpoints`,e.span),r===`association`&&(i===`json`||o===`json`)&&e.arrowType>2&&g(`JSON relationship '${t.id}' to '${n.id}' permits only point, reversed-point, or markerless solid association`,e.span);let c=e.id??`edge-${M++}`,u={id:c,explicitId:!!e.id,source:t.id,target:n.id,type:r,arrowType:e.arrowType,minlen:e.minlen,classes:[],styles:[],animate:!1};e.label&&(u.label=e.label.text,u.labelType=e.label.type),a.relationships.push(u),f.set(c,u)}let N=new Map(o),P=new Map(s);o.clear(),s.clear();for(let e of b(u.values())){let t=N.get(e.id),n=P.get(e.id);t?o.set(e.id,t):n?s.set(e.id,n):E(e)}for(let{target:e,span:n,properties:r,statement:i}of t.metadata){let t=l.get(e);if(!t){let t=zL(r);return g(`Metadata target '${e}' is unresolved${t?` (metadata implies ${t})`:``}`,n)}let a=t.kind;a===`actor`||a===`usecase`?T(u.get(e),r,!0):a===`edge`&&(i.kind=`edgeMetadata`,i.edges=[{id:e,span:i.span,idSpan:n,metadata:i.metadata}],delete i.nodes);let o=d.get(e),s=f.get(e);for(let t of a===`actor`||a===`usecase`?[]:r){let{key:n,value:r}=t;a===`boundary`&&o&&n===`type`&&(r===`rect`||r===`package`)?o.type=r:a===`edge`&&s&&n===`animate`&&typeof r==`boolean`?s.animate=r:a===`edge`&&s&&n===`animation`&&(r===`fast`||r===`slow`)?(s.animation=r,s.animate=!0):v(e,a,t)}}for(let e of a.relationships)e.animation&&(e.animate=!0);for(let e of u.values())e.kind===`actor`?(e.icon&&e.actorType&&e.actorType!==`normal`&&g(`Actor '${e.id}' cannot combine icon with type '${e.actorType}'`,e.span),e.business&&(e.icon||e.actorType===`awesome`)&&g(`Business actor '${e.id}' must use normal or hollow geometry`,e.span)):e.shape===`rect`&&e.business&&g(`Rectangular use case '${e.id}' cannot be a business use case`,e.span),E(e);for(let e of[...t.elements].sort((e,t)=>e.span[0]-t.span[0])){if(!e.parent?.id)continue;let t=d.get(e.parent.id).members;t.includes(e.id)||t.push(e.id)}for(let e of d.values()){let t=c.get(e.id);t.type=e.type??`rect`,t.members=e.members,t.classes=[...e.classes]}let F=0;for(let e of t.notes){let t=l.get(e.target);if(!t)return g(`Note target '${e.target}' is unresolved`,e.span);t.kind!==`actor`&&t.kind!==`usecase`&&_(`Note target '${e.target}' must be an actor or use case, not ${t.kind}`,e.span,t.span);let n=`note-${F++}`;a.notes.set(n,{id:n,target:e.target,label:e.label.text,labelType:e.label.type})}for(let e of t.classDefs)for(let t of e.ids)a.classDefs.set(t,{id:t,styles:[...e.styles]});for(let e of t.classes)for(let t of e.targets)RL(A(t.id,t.span).classes,e.classes);for(let e of t.styles)A(e.target,e.span).styles.push(...e.styles);return a.direction=t.direction??a.direction,a.title=i,a.accTitle=t.accTitle,a.accDescription=t.accDescription,a.accDescr=t.accDescription.replace(/\n\s+/g,`
|
|
157
|
+
`),a.source=e,a.headerSpan=n,a.statements=r,a}var VL=class extends Error{constructor(e){super(`Invalid JSON token`),this.offset=e}offset};function HL(e){let t=new Map,n=[],r=[],i=e.length,a=0,o=``,s=0,c=()=>{for(;a<i;){let t=e.charCodeAt(a);if(t!==32&&t!==9&&t!==10&&t!==13)return;a++}},l=t=>{a++;let n=``;for(;a<i;){let r=a,i=e[a++];if(i===`"`)return n;if(i.charCodeAt(0)<32)throw new VL(r);if(i!==`\\`){t&&(n+=i);continue}let o=a,s=e[a++],c;if(s===`"`||s===`\\`||s===`/`)c=s;else if(s===`b`)c=`\b`;else if(s===`f`)c=`\f`;else if(s===`n`)c=`
|
|
158
|
+
`;else if(s===`r`)c=`\r`;else if(s===`t`)c=` `;else if(s===`u`){let t=e.slice(a,a+4);if(!/^[\dA-Fa-f]{4}$/.test(t))throw new VL(a);c=String.fromCharCode(parseInt(t,16)),a+=4}else throw new VL(o);t&&(n+=c)}throw new VL(a)},u=t=>{for(let n=0;n<t.length;n++)if(e[a+n]!==t[n])throw new VL(a+n);a+=t.length},d=()=>{if(e.charCodeAt(a)===45&&a++,e.charCodeAt(a)===48)a++;else if(Ps(e.charCodeAt(a)))for(;Ps(e.charCodeAt(a));)a++;else throw new VL(a);if(e.charCodeAt(a)===46){if(a++,!Ps(e.charCodeAt(a)))throw new VL(a);for(;Ps(e.charCodeAt(a));)a++}if((e.charCodeAt(a)|32)==101){if(a++,(e.charCodeAt(a)===43||e.charCodeAt(a)===45)&&a++,!Ps(e.charCodeAt(a)))throw new VL(a);for(;Ps(e.charCodeAt(a));)a++}};for(c();;)if(s===0){c();let i=e.charCodeAt(a);if(s=2,i===123){a++;let i=[];t.set(o,i),n.push(o),c(),e.charCodeAt(a)===125?a++:(r.push({object:!0,pointer:o,keys:i,ranges:new Map,key:``,from:0,index:0}),s=1)}else if(i===91)a++,c(),e.charCodeAt(a)===93?a++:(r.push({object:!1,pointer:o,keys:[],ranges:new Map,key:``,from:0,index:0}),o+=`/0`,s=0);else if(i===34)l(!1);else if(i===116)u(`true`);else if(i===102)u(`false`);else if(i===110)u(`null`);else if(i===45||Ps(i))d();else throw new VL(a)}else if(s===1){let i=r[r.length-1];if(e.charCodeAt(a)!==34)throw new VL(a);let u=l(!0),d=i.ranges.get(u);if(d===void 0)i.keys.push(u);else for(let e=d[0];e<d[1];e++)t.delete(n[e]);if(i.key=u,i.from=n.length,c(),e.charCodeAt(a)!==58)throw new VL(a);a++,o=`${i.pointer}/${u.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}`,s=0}else{let t=r[r.length-1];if(t===void 0)break;t.object?t.ranges.set(t.key,[t.from,n.length]):t.index++,c();let i=e.charCodeAt(a);if(i===(t.object?125:93))a++,r.pop();else{if(i!==44)throw new VL(a);a++,c(),o=`${t.pointer}/${t.index}`,s=+!!t.object}}if(c(),a!==i)throw new VL(a);return t}function UL(e,t,n,r){let i=Math.min(Math.max(t,0),e.length);for(let t=0;t<i;t++){let i=e.charCodeAt(t);i===13?(n++,r=1):i===10?(t===0||e.charCodeAt(t-1)!==13)&&(n++,r=1):r++}return[n,r]}function WL(e,t,n,r){let i=/\bposition (\d+)\b/.exec(e);if(i)return UL(t,parseInt(i[1],10),n,r);let a=/\bline (\d+) column (\d+)\b/.exec(e);if(a){let e=parseInt(a[1],10),t=parseInt(a[2],10);return[n+e-1,e===1?r+t-1:t]}if(/unexpected end|end of json input/i.test(e))return UL(t,t.length,n,r)}function GL(e,t,n){return new jo(`${e} (line ${t}, column ${n})`,`syntax`,{type:`usecase`,line:t,column:n})}function KL(e,t){let n;try{n=JSON.parse(e)}catch(n){let r=n instanceof Error?n.message:String(n),i=Yo(e);if(i!==e)try{JSON.parse(i)}catch(e){e instanceof Error&&(r=e.message)}let[a,o]=t(),s=WL(r,i,a,o);if(!s){let e=0;try{HL(i)}catch(t){t instanceof VL&&(e=t.offset)}s=UL(i,e,a,o)}throw GL(`Invalid JSON: ${r}`,s[0],s[1])}if(typeof n!=`object`||!n||Array.isArray(n)){let[e,n]=t();throw GL(`JSON value must have an object root`,e,n)}return{value:n,propertyOrder:HL(e)}}var qL=1,JL=2,YL=4,XL=8,ZL=16,QL=32,$L=64,eR=`DEPENDENCY_ARROW|GENERALIZATION|FORWARD_SOLID|BACKWARD_SOLID|MARKERLESS_SOLID|FORWARD_CIRCLE|BACKWARD_CIRCLE|FORWARD_CROSS|BACKWARD_CROSS`,tR=`IDENTIFIER|PLAIN_STRING|MARKDOWN_STRING`,nR=`PLAIN_STRING|MARKDOWN_STRING|LABEL_TEXT`,rR=`ACC_TITLE_LINE|ACC_DESCR_LINE|ACC_DESCR_BLOCK|DIRECTION|ACTOR|SYSTEM_BOUNDARY|NOTE|JSON_DECLARATION_START|CLASS_DEF|CLASS|STYLE`,iR=`WORD|PLAIN_STRING|NUMBER|HASH_COLOR|CSS_IDENTIFIER|CSS_ESCAPED_COMMA|DASH|DOT|PERCENT|CSS_PUNCTUATION|COLON|LPAREN|RPAREN|LBRACKET|RBRACKET|LBRACE|RBRACE|AT|MARKERLESS_SOLID`,aR=new Uint8Array(67);function oR(e,t){for(let n of e.split(`|`))if(n===`WORD`)for(let e=1;e<=21;e++)aR[e]|=t;else aR[SL.indexOf(n)]|=t}oR(`NEWLINE|COMMENT|${rR}|${tR}`,qL),oR(`IDENTIFIER|${eR}`,JL),oR(iR,YL),oR(`STEREOTYPE_START|CLASS_SEPARATOR|IDENTIFIER|${eR}|NEWLINE|EOF`,XL),oR(`NEWLINE|COMMENT|ACTOR|${tR}`,ZL),oR(`FORWARD_SOLID|MARKERLESS_SOLID|FORWARD_CIRCLE|FORWARD_CROSS`,QL),oR(`NEWLINE|IDENTIFIER|PLAIN_STRING|RBRACE`,$L);var sR=new Set([`allowmixing`,`newpage`,`package`,`rectangle`,`skinparam`]),cR=``,lR=[],uR=[],dR=[],$=0,fR=0,pR,mR,hR=[],gR=0,_R=0;function vR(e){return cR.slice(uR[e],dR[e])}function yR(e){return[uR[e],dR[e]]}function bR(e){let[t,n]=AL(cR,uR[$]);throw new jo(`Error parsing usecase diagram: ${e} at ${jL(cR,uR[$],dR[$])}`,`syntax`,{type:`usecase`,line:t,column:n})}function xR(e){bR(`Expecting token of type --> ${e} <-- but found --> '${vR($)}' <--`)}function SR(e){return lR[$]!==e&&xR(SL[e]),$++}function CR(e){bR(`Expecting: one of these possible Token sequences:
|
|
159
|
+
${e.split(`|`).map((e,t)=>` ${t+1}. [${e}]`).join(`
|
|
160
|
+
`)}
|
|
161
|
+
but found: '${vR($)}'`)}function wR(){let e=tR.split(`|`),t=e.flatMap(e=>[`NEWLINE`,`IDENTIFIER`,`PLAIN_STRING`,`RBRACE`].map(t=>`${e}, METADATA_START, ${t}`)),n=`STEREOTYPE_START|CLASS_SEPARATOR|IDENTIFIER|${eR}|NEWLINE|EOF`.split(`|`),r=e.flatMap((e,t)=>(t===0?[`LPAREN`,`LBRACKET`,...n]:n).map(t=>`${e}, ${t}`));return[rR,...t,...r,...t].join(`|`)}function TR(e){return e>=1&&e<=21}function ER(e){return e>=1&&e<=34}function DR(){fR=dR[$-1],lR[$]===39?$++:lR[$]!==0&&CR(`NEWLINE|EOF`)}function OR(e){let t=lR[e]===36?2:+(lR[e]===35);return[uR[e]+t,dR[e]-t]}function kR(e){let t=OR(e);return{text:cR.slice(t[0],t[1]),type:lR[e]===36?`markdown`:`text`,span:t}}function AR(e){return e.replace(/\W/g,`_`)}function jR(){let e=lR[$];if(e===35||e===36)return kR($++);ER(e)||CR(nR);let t=$;for(;ER(lR[$]);)$++;let n=[uR[t],dR[$-1]];return{text:cR.slice(n[0],n[1]),type:`text`,span:n}}function MR(e){return e===21||e===35}function NR(){let e=$;MR(lR[$])||CR(`IDENTIFIER|PLAIN_STRING`),$++,SR(25);let t=$,n=lR[$];!MR(n)&&n!==19&&n!==20&&CR(`IDENTIFIER|PLAIN_STRING|TRUE|FALSE`),$++;let r=OR(e),i=OR(t);return{key:cR.slice(r[0],r[1]),value:n===19||n!==20&&cR.slice(i[0],i[1]),span:[uR[e],dR[t]],keySpan:r,valueSpan:i}}function PR(){let e=lR[$],t=lR[$+1],n=lR[$+2];return e===24?MR(t)||t===39&&(n===39||MR(n)):e===39?t===24||MR(t)||t===39&&(n===39||n===24||MR(n)):!1}function FR(){SR(60);let e=[];for(;lR[$]===39;)$++;if(MR(lR[$])){for(e.push(NR());PR();){if(lR[$]===24)$++;else{for(;lR[$]===39;)$++;lR[$]===24&&$++}for(;lR[$]===39;)$++;e.push(NR())}for(lR[$]===24&&$++;lR[$]===39;)$++}return SR(62),e}function IR(e){return e.map(({key:e,span:t,keySpan:n,valueSpan:r})=>({key:e,span:t,keySpan:n,valueSpan:r}))}function LR(e,t){do{$++;let n=SR(21);e.push(vR(n)),t.push(yR(n))}while(lR[$]===24)}function RR(e){let t=$,n=lR[$],r={id:``,label:void 0,span:OR(t),generated:n!==21,classes:[],classSpans:[],explicit:!1,nodeSpan:[0,0]};if(n===21){$++,r.id=vR(t);let n=lR[$];n===65||e&&n===63?($++,r.label=jR(),SR(n===65?66:64),r.shape=n===65?`ellipse`:`rect`):r.label=kR(t)}else n===35||n===36?($++,r.label=kR(t),r.id=AR(r.label.text)):CR(tR);return r}function zR(e){let t=$,n=RR(!e);if(e&&(n.shape=void 0),lR[$]===60&&(n.metadata=FR()),lR[$]===48){$++;let e=SR(50);SR(49),n.stereotype=vR(e).trim(),n.stereotypeSpan=yR(e)}return lR[$]===52&&LR(n.classes,n.classSpans),n.explicit=!!(n.shape||n.metadata||n.stereotype),n.nodeSpan=[uR[t],dR[$-1]],n}function BR(e,t){return{id:e.id,kind:t,label:e.label,span:e.span,generated:e.generated,parent:mR,shape:e.shape,metadata:e.metadata,stereotype:e.stereotype,classes:e.classes}}function VR(e,t){return{id:e.id,label:e.label,span:e.span,generated:e.generated,declares:t,classed:e.classes.length>0}}function HR(e,t){let n={id:e.id,span:e.nodeSpan,idSpan:e.span,labelSpan:e.label.span};return t&&(n.defines=!0),e.stereotypeSpan&&(n.stereotypeSpan=e.stereotypeSpan),e.metadata&&(n.metadata=IR(e.metadata)),e.classSpans.length>0&&(n.classSpans=e.classSpans),n}function UR(e){if(lR[$]<1||lR[$]>36)return!1;for(let t=$+1;;t++){let n=lR[t];if(n===59||(aR[n]&e)!==0)return!0;if(n<1||n>36)return!1}}function WR(e){let t=dR[e]-uR[e]-(lR[e]===59?0:1);return Math.max(1,t-1)}function GR(){let e=$,t={type:`association`,arrowType:0,minlen:1,target:void 0,span:[0,0]};lR[$]===21&&lR[$+1]===23&&(t.explicitId=vR($),t.explicitIdSpan=yR($),$+=2);let n=$,r=lR[$++];if(r===47)SR(25),lR[$]!==17&&lR[$]!==18&&CR(`INCLUDE|EXTEND`),t.type=lR[$]===17?`include`:`extend`,t.label={text:t.type,type:`text`,span:yR($)},$++;else if(r===46)t.type=`generalization`;else if(r===53)t.minlen=WR(n);else if(r===54)t.arrowType=1,dR[n]-uR[n]===3&&UR(0)?(t.label=jR(),t.minlen=WR(SR(59))):t.minlen=WR(n);else if(r===59){if(t.arrowType=2,dR[n]-uR[n]===2&&UR(QL)){t.label=jR();let e=lR[$];e===53?t.arrowType=0:e===55?t.arrowType=3:e===57?t.arrowType=4:e!==59&&CR(`FORWARD_SOLID|MARKERLESS_SOLID|FORWARD_CIRCLE|FORWARD_CROSS`),(t.arrowType===0||t.arrowType===2)&&(t.minlen=WR($)),$++}else t.minlen=WR(n)}else r===55?t.arrowType=3:r===57?t.arrowType=4:r===56||r===58?(t.arrowType=r===56?5:6,UR(0)&&(t.label=jR(),SR(59))):($--,CR(eR));return t.target=zR(!1),t.span=[uR[e],dR[$-1]],t}function KR(e){return{kind:e,span:[0,0]}}function qR(e,t,n,r){let i=n.target;i.explicit&&pR.elements.push(BR(i,`usecase`)),pR.relationships.push({source:VR(e,t),target:VR(i,i.explicit),span:n.span,id:n.explicitId,idSpan:n.explicitIdSpan,type:n.type,arrowType:n.arrowType,label:n.label,minlen:n.minlen}),r.push(HR(i,i.explicit));let a=KR(`edge`);return a.nodes=r,a.edges=[{id:n.explicitId??`edge-${gR++}`,span:a.span}],n.explicitIdSpan&&(a.edges[0].idSpan=n.explicitIdSpan),n.label&&(a.edges[0].labelSpan=n.label.span),a}function JR(e){let t=KR(`node`);return t.nodes=e,t}function YR(e){$++;let t=[zR(!0)],n;if(lR[$]===24)do $++,t.push(zR(!0));while(lR[$]===24);else e&&(aR[lR[$]]&JL)!==0&&(n=GR());DR();for(let e of t)pR.elements.push(BR(e,`actor`));let r=t.map(e=>HR(e,!0));return n?qR(t[0],!0,n,r):JR(r)}function XR(e){let t=zR(!1),n=e&&(aR[lR[$]]&JL)!==0?GR():void 0;DR(),n||(t.explicit=!0,t.shape??=`ellipse`),t.explicit&&pR.elements.push(BR(t,`usecase`));let r=[HR(t,t.explicit)];return n?qR(t,t.explicit,n,r):JR(r)}function ZR(){$++;let e=RR(!0),t={id:e.id,label:e.label,span:e.span,generated:e.generated,classes:e.classes},n=lR[$]===60?FR():void 0;lR[$]===52&&LR(e.classes,e.classSpans),DR(),pR.boundaries.push(t),mR=t;let r=[];for(;(aR[lR[$]]&ZL)!==0;)r.push(rz(!1));mR=void 0;let i=SR(4);DR();let a=KR(`group`);return a.group=t.id,a.idSpan=t.span,a.titleSpan=t.label.span,a.endSpan=yR(i),a.classSpans=e.classSpans,r.length>0&&(a.children=r),n&&(a.metadata=IR(n),pR.metadata.push({target:t.id,span:t.span,properties:n,statement:a})),a}function QR(){let e=$,t=lR[$];for(TR(t)||t===27?$++:t===59?($++,TR(lR[$])||xR(`WORD`),$++):CR(`WORD|CSS_IDENTIFIER|MARKERLESS_SOLID`),SR(25),(aR[lR[$]]&YL)===0&&bR(`Expecting: expecting at least one iteration which starts with one of these possible Token sequences::
|
|
162
|
+
<[${iR.replaceAll(`|`,`] ,[`)}]>
|
|
163
|
+
but found: '${vR($)}'`);(aR[lR[$]]&YL)!==0;)$++;return cR.slice(uR[e],dR[$-1]).replaceAll(`\\,`,`,`)}function $R(){let e=[QR()];for(;lR[$]===24;)$++,e.push(QR());return e}function ez(){let e=[SR(21)];for(;lR[$]===24;)$++,e.push(SR(21));return e}function tz(e){let t=OR(e);return{id:vR(e),span:t,idSpan:t}}function nz(){let e=$,t=lR[$],n;if(t===41||t===42||t===40){$++;let r=vR(e);t===40?pR.accDescription=r.slice(r.indexOf(`{`)+1,r.lastIndexOf(`}`)).trim():t===42?pR.accDescription=r.slice(r.indexOf(`:`)+1).trim():pR.accTitle=r.slice(r.indexOf(`:`)+1).trim(),n=KR(t===41?`accTitle`:`accDescr`)}else if(t===5){$++;let e=lR[$];(e<6||e>10)&&CR(`TD|TB|BT|LR|RL`),pR.direction=e===6?`TB`:vR($),$++,n=KR(`direction`)}else{if(t===2)return YR(!0);if(t===3)return ZR();if(t===11){$++,SR(12);let e=SR(21),t=jR();pR.notes.push({target:vR(e),span:yR(e),label:t}),n=KR(`note`),n.ref=`note-${_R++}`,n.refSpan=t.span,n.nodes=[tz(e)]}else if(t===43){$++;let t=SR(44),r=[],i=[];lR[$]===52&&LR(r,i);let a=uR[e]+4;for(;cR.charCodeAt(a)===32||cR.charCodeAt(a)===9;)a++;let o=a;for(;/\w/.test(cR.charAt(o));)o++;let s={id:cR.slice(a,o),value:{},propertyOrder:new Map,span:[a,o],classes:r};pR.jsons.push(s),hR.push([s,t]),n=KR(`json`),n.nodes=[{id:s.id,span:s.span,idSpan:s.span,defines:!0,classSpans:i}],n.classSpans=i}else if(t===14){$++;let e=ez();pR.classDefs.push({ids:e.map(vR),styles:$R()}),n=KR(`classDef`),n.ref=vR(e[0]),n.refSpan=yR(e[0])}else if(t===15){$++;let e=ez(),t=ez();pR.classes.push({targets:e.map(e=>({id:vR(e),span:yR(e)})),classes:t.map(vR)}),n=KR(`classAssign`),n.ref=vR(t[0]),n.refSpan=yR(t[0]),n.nodes=e.map(tz)}else if(t===16){$++;let e=SR(21);pR.styles.push({target:vR(e),span:yR(e),styles:$R()}),n=KR(`style`),n.nodes=[tz(e)]}else{let r=lR[$+1];if(r===60){(aR[lR[$+2]]&$L)===0&&CR(wR()),$++;let r=tz(e);t!==21&&(r.id=AR(cR.slice(r.span[0],r.span[1])));let i=FR();n=KR(`metadata`),n.nodes=[r],n.metadata=IR(i),pR.metadata.push({target:r.id,span:r.span,properties:i,statement:n})}else return((aR[r]&XL)===0&&(t!==21||r!==65&&r!==63)||t===21&&sR.has(vR(e).toLowerCase()))&&CR(wR()),XR(!0)}}return DR(),n}function rz(e){let t=$,n=lR[$];if(n===39)return $++,{kind:`blank`,span:yR(t)};if(n===38)return $++,DR(),{kind:`comment`,span:yR(t)};let r=e?nz():n===2?YR(!1):XR(!1);if(r.span=[uR[t],fR],r.edges)for(let e of r.edges)e.span=r.span;return r}function iz(e,t){cR=e,{types:lR,starts:uR,ends:dR}=FL(e),$=0,pR=LL(),mR=void 0,hR=[],gR=0,_R=0;try{let n=SR(1);DR();let r=[];for(;(aR[lR[$]]&qL)!==0;)r.push(rz(!0));lR[$]!==0&&bR(`Redundant input, expecting EOF but found: ${vR($)}`);for(let[t,n]of hR){let r=KL(vR(n),()=>AL(e,uR[n]));t.value=r.value,t.propertyOrder=r.propertyOrder}return BL(e,pR,yR(n),r,t)}finally{cR=``,lR=uR=dR=hR=[]}}var az={normal:`usecaseActor`,hollow:`usecaseActorHollow`,awesome:`usecaseActorAwesome`,icon:`usecaseActorIcon`},oz=[[`none`,`arrow_point`],[`arrow_point`,`none`],[`none`,`none`],[`none`,`arrow_circle`],[`none`,`arrow_cross`],[`arrow_circle`,`none`],[`arrow_cross`,`none`]];function sz(e){return typeof e==`string`?e:e===null?`null`:String(e)}function cz(e){let t=[],n=[[e.value,``,``]],r=[];for(;n.length>0;){let[i,a,o]=n.pop();if(r.length=0,Array.isArray(i))i.length===0?t.push({key:a,accessibleKey:a,value:`[]`}):i.every(e=>typeof e!=`object`||!e)?i.forEach((e,n)=>t.push({key:n===0?a:``,accessibleKey:a,value:sz(e)})):i.forEach((e,t)=>r.push([e,`${a}[${t}]`,`${o}/${t}`]));else if(typeof i==`object`&&i){let n=i,s=e.propertyOrder.get(o)??Object.keys(n);s.length===0&&t.push({key:a,accessibleKey:a,value:`{}`});for(let e of s)r.push([Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0,a?`${a}.${e}`:e,`${o}/${e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}`])}else t.push({key:a,accessibleKey:a,value:sz(i)});for(let e=r.length-1;e>=0;e--)n.push(r[e])}return t}function lz(...e){return e.filter(Boolean).join(` `)}function uz(e){return e.type===`generalization`?[`none`,`extension`]:e.type===`association`?oz[e.arrowType]??oz[2]:oz[0]}function dz(e){let t=[],n=[],r=t=>{let n=new Map;for(let r of[`default`,...t]){let t=e.classDefs.get(r);if(t)for(let e of t.styles){let t=e.trim(),r=t.indexOf(`:`),i=(r===-1?t:t.slice(0,r)).trim();i&&n.set(i,t)}}return[...n.values()]};for(let n of e.actors.values())t.push({id:n.id,label:n.label,labelType:n.labelType,shape:az[n.type],isGroup:!1,padding:10,cssClasses:lz(`default`,`usecase-actor`,`usecase-actor-${n.type}`,n.business&&`usecase-business`,...n.classes),cssStyles:[...n.styles],cssCompiledStyles:r(n.classes),actorType:n.type,business:n.business,icon:n.icon||void 0,stereotype:n.stereotype||void 0,parentId:n.parentId||void 0});for(let n of e.useCases.values()){let e=n.shape===`ellipse`;t.push({id:n.id,label:n.label,labelType:n.labelType,shape:e?n.business?`usecaseBusiness`:`usecaseEllipse`:`rect`,isGroup:!1,padding:e?20:10,cssClasses:lz(`default`,`usecase-element`,`usecase-${n.shape}`,n.business&&`usecase-business`,...n.classes),cssStyles:[...n.styles],cssCompiledStyles:r(n.classes),business:n.business,stereotype:n.stereotype||void 0,parentId:n.parentId||void 0})}for(let n of e.notes.values())t.push({id:n.id,label:n.label,labelType:n.labelType,shape:`note`,isGroup:!1,padding:10,cssClasses:`default usecase-note`,cssStyles:[],cssCompiledStyles:r([]),noteTarget:n.target});for(let n of e.jsonNodes.values())t.push({id:n.id,label:n.id,labelType:`text`,shape:`usecaseJsonTable`,isGroup:!1,padding:10,cssClasses:lz(`default`,`usecase-json-table`,...n.classes),cssStyles:[...n.styles],cssCompiledStyles:r(n.classes),jsonRows:cz(n)});for(let n of e.systemBoundaries.values())t.push({id:n.id,label:n.label,labelType:n.labelType,shape:`usecaseSystemBoundary`,isGroup:!0,padding:20,cssClasses:lz(`default`,`system-boundary`,`system-boundary-${n.type}`,...n.classes),cssStyles:[...n.styles],cssCompiledStyles:r(n.classes),boundaryType:n.type});for(let t of e.relationships){let e=t.type===`include`||t.type===`extend`,[i,a]=uz(t),o=t.animate||t.animation!==void 0,s={id:t.id,start:t.source,end:t.target,relationshipType:t.type,pattern:e?`dotted`:`solid`,arrowTypeStart:i,arrowTypeEnd:a,classes:lz(`default`,`relationship`,`relationship-${t.type}`,...t.classes,o&&`edge-animation-${t.animation??`fast`}`),style:[...t.styles],cssCompiledStyles:r(t.classes),animate:t.animate,animation:t.animation,minlen:t.minlen,explicitId:t.explicitId,internal:!1};e?(s.label=t.type,s.labelType=`text`):t.type===`association`&&(t.label&&(s.label=t.label),t.labelType&&(s.labelType=t.labelType)),n.push(s)}for(let t of e.notes.values())n.push({id:`${t.id}-edge`,start:t.id,end:t.target,relationshipType:`note`,pattern:`dotted`,arrowTypeStart:`none`,arrowTypeEnd:`none`,classes:`default relationship relationship-note`,style:[],cssCompiledStyles:r([]),animate:!1,minlen:1,explicitId:!1,internal:!0});return{nodes:t,edges:n}}var fz=32,pz=16,mz=72,hz=20,gz=26,_z=40,vz=60,yz=6,bz=6,xz=10,Sz=8,Cz=9,wz=12,Tz=14,Ez=` fill="var(--_s)" stroke="var(--_b)"`;function Dz(e,t,n){let r=e.usecase?.[t];return typeof r==`number`&&r>0?Math.min(r,2e3):n}function Oz(e){return e.replace(/[&<>\\]/g,e=>`&#${e.charCodeAt(0)};`)}function kz(e,t,n,r,i,a=0){return Q(e&&!t?Oz(e):e,t,n,r,i,a)}function Az(e,t,n,r){let i=n===1||n===2?1:-1,a=n===1||n===3,o=(a?e.w:e.h)/2,s=0;if(e.kind===0)a?(o=_z/2+3,s=(vz-e.h)/2):o+=2;else if(e.kind===1){let t=(a?e.h:e.w)/2;o*=Math.sqrt(Math.max(1-(r/t)**2,0))}return a?[t.x+i*o,t.y+s+r]:[t.x+r,t.y+i*o]}function jz(e,t){let n=t===1||t===3;if(e.kind===0)return n?vz*.5:_z*.6;let r=n?e.h:e.w;return e.kind===1?r*.6:r-16}function Mz(e,t,n){let r=new Map,i=(e,n,i,a)=>{let o=t[e];if(o.isGroup)return;let s=n[i]-o.x,c=n[i+1]-o.y,l;if(Math.abs(Math.abs(c)-o.h/2)<.5)l=c<0?0:2;else if(Math.abs(Math.abs(s)-o.w/2)<.5)l=s<0?3:1;else return;let u=e*4+l,d={route:n,at:i,toward:n[a+(l&1?1:0)]},f=r.get(u);f?f.push(d):r.set(u,[d])};for(let t of e){let e=t.route.length-3;t.src===t.dst||e<3||(i(t.src,t.route,0,3),i(t.dst,t.route,e,e-3))}for(let[e,i]of r){let r=e>>2,a=e&3,o=n[r],s=i.length>1?Math.min(Tz,jz(o,a)/(i.length-1)):0;i.sort((e,t)=>e.toward-t.toward);for(let e=0;e<i.length;e++){let[n,c]=Az(o,t[r],a,(e-(i.length-1)/2)*s);i[e].route[i[e].at]=n,i[e].route[i[e].at+1]=c}}}function Nz(e,t,n,r,i){let a=e-n*wz,o=t-r*wz,s=wz*.5;return`<path class="pele-marker" d="M${X(e)},${X(t)}L${X(a-r*s)},${X(o+n*s)}L${X(a+r*s)},${X(o-n*s)}Z" fill="var(--_bg)" stroke="${i}" stroke-linejoin="round"/>`}function Pz(e){return e===`extension`?wz:bp(e)}function Fz(e,t,n,r,i,a,o){return e===`extension`?Nz(t,n,r,i,a):xp(e,t,n,r,i,a,o)}function Iz(e,t){let n=e.node,r=e.style.shape,i=` fill="none" stroke="var(--_b)"${e.style.line}`,a=-21,o=9,s;return n.actorType===`hollow`?(o=8,s=`<circle cy="-21" r="8" fill="var(--_bg)" stroke="var(--_b)"${r}/><path d="M-20,-9H20V0H5.5L20,15.5L12,25.5L0,12L-12,25.5L-20,15.5L-5.5,0H-20Z" fill="var(--_bg)" stroke="var(--_b)" stroke-linejoin="round"${r}/>`):n.actorType===`awesome`?s=`<path d="M0,-30A11,11 0 1 1 0,-8A11,11 0 1 1 0,-30ZM-20,25C-20,9 -12,-3 0,-3C12,-3 20,9 20,25C20,28 18,30 15,30H-15C-18,30 -20,28 -20,25Z" fill="var(--_b)"${r}/>`:n.actorType===`icon`?(a=-14,o=12,s=`<rect x="-22" y="-26" width="44" height="44"${Kp(Ez+r)}/><svg class="pele-icon" data-icon="${Y(n.icon??``)}" x="-14" y="-18" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${t?.(n.icon??``)??``}</svg>`):s=`<circle cy="-21" r="9"${Ez}${r}/><path d="M0,-12V10M-14,-3H14M0,10L-12,30M0,10L12,30"${i}/>`,n.business&&(s+=`<path class="pele-business" d="M${X(.12*o)},${X(a+.99*o)}L${X(.92*o)},${X(a-.39*o)}"${i}/>`),s}function Lz(e,t,n){return Dh(e.direction)?Eh(n,r=>Rz(e,t,n,r)):Rz(e,t,n,!1)}function Rz(e,t,n,r){let i=dz(e),a=n.fontSize??16,o=Math.round(a*.875),s=Math.round(a*.8125),c=n.measurer??bc(n.fontFamily,n.fontFamilyMono),l=n.padding??8,u=n.icons,d=r?`TB`:Vf(e.direction),f=d===`LR`||d===`RL`,p=new Map,m=[],h=[];i.nodes.forEach((e,t)=>p.set(e.id,t));for(let e of i.nodes){let t=nm(e.cssStyles.length>0?e.cssCompiledStyles.concat(e.cssStyles):e.cssCompiledStyles),n=+!!t.bold|(t.italic?2:0),r=t.fontSize??a,i=e.labelType===`markdown`,l=kz(e.stereotype&&`«${e.stereotype}»`,!1,c,s,200,n),u={node:e,kind:2,style:t,label:l,stereotype:l,w:0,h:0,rows:[],keyW:0,headH:0,loops:0},d;if(e.isGroup){u.kind=4,u.label=kz(e.label,i,c,r,4e3,n);let t=u.label.height;d=op(0,0),d.isGroup=!0,d.padX=hz,d.padBottom=hz,d.padTop=e.boundaryType===`package`?t+2*bz+16:t>0?t+16:hz,d.minW=u.label.width+2*hz}else{if(e.jsonRows){u.kind=3,u.label=kz(e.label,!1,c,r,4e3,n|1);let t=0;for(let r of e.jsonRows){let e=kz(r.key,!1,c,o,4e3,n),i=kz(r.value,!1,c,o,260,n);u.rows.push([e,i]),u.keyW=Math.max(u.keyW,e.width),t=Math.max(t,i.width),u.h+=Math.max(e.height,i.height,Math.round(o*1.5))+Sz}u.keyW>0&&(u.keyW+=2*xz),u.headH=Math.max(u.label.height,Math.round(r*1.5))+Sz,u.w=Math.max(u.label.width+2*xz,u.rows.length>0?u.keyW+t+2*xz:0,72),u.h+=u.headH}else if(e.actorType)u.kind=0,u.label=kz(e.label,i,c,r,140,n),u.w=Math.max(_z,u.label.width,l.width),u.h=vz+yz+l.height+u.label.height;else{u.label=kz(e.label,i,c,e.shape===`note`?o:r,180,n);let t=Math.max(u.label.width,l.width),a=u.label.height+l.height;e.shape===`usecaseEllipse`||e.shape===`usecaseBusiness`?(u.kind=1,u.w=Math.max(t+2*e.padding+(e.business?16:4),88),u.h=Math.max(a+28,48)):e.shape===`note`?(u.w=t+2*e.padding+6,u.h=a+18):(u.w=Math.max(t+2*e.padding+12,80),u.h=Math.max(a+24,44))}d=op(u.w,u.h)}d.seq=m.length,m.push(u),h.push(d)}i.nodes.forEach((e,t)=>{h[t].parent=e.parentId===void 0?-1:p.get(e.parentId)??-1});let g=[],_=[],v=[];for(let e of i.edges){let t=p.get(e.start),n=p.get(e.end);if(t===void 0||n===void 0)continue;let r=kz(e.relationshipType===`include`||e.relationshipType===`extend`?`«${e.label}»`:e.label,e.labelType===`markdown`,c,o,200);t===n&&(m[t].loops++,f?h[t].h+=2*(gz+(r.height>0?r.height+8:0)):h[t].w+=2*(gz+(r.width>0?r.width+12:0))),v.push(e),_.push(r),g.push({src:t,dst:n,minlen:e.minlen,labelW:r.width>0?r.width+12:0,labelH:r.height>0?r.height+4:0,route:[],labelX:0,labelY:0})}let y=lp(h,g,d,{nodeSep:Dz(t,`nodeSpacing`,fz),edgeSep:pz,rankSep:Dz(t,`rankSpacing`,mz),portSep:20}),b=g_(e.title,c,a,4e3),x=b.height>0?b.height+12:0,S=Math.max(y.width,b.width);ap(h,g,l+(S-y.width)/2,l+x);let C=Math.ceil(S+2*l),w=Math.ceil(y.height+x+2*l),T=new Map;for(let e of g)up(T,e.route);Mz(g,h,m);let E=``,D=[],O=``;for(let e=0;e<m.length;e++){let t=m[e],n=h[e],r=t.node,i=im(r.cssClasses.replace(/^default\s?/,``)),a=Y(r.id),c=t.style.text,l=t.style.shape,d=pl(t.style),f=d||` fill="var(--_m)"`,p=t.w,g=t.h;if(t.kind===4){let e=n.x-n.w/2,o=n.y-n.h/2;fl(l)&&D.push({box:[e,o,e+n.w,o+n.h],shape:l});let s=` fill="var(--_a)"${Gp(l)?``:` fill-opacity="0.5"`} stroke="var(--_b)"${l}`,d=` class="pele-cluster-label"${f}${c}`,p;if(r.boundaryType===`package`){let r=Math.min(t.label.width+2*bz+8,n.w),i=t.label.height+2*bz;p=`<rect class="pele-boundary-tab" x="${X(e)}" y="${X(o)}" width="${X(r)}" height="${X(i)}"${s}/><rect x="${X(e)}" y="${X(o+i)}" width="${X(n.w)}" height="${X(n.h-i)}"${s}/>`+Z(t.label,e+r/2,o+i/2,d,u)}else p=`<rect x="${X(e)}" y="${X(o)}" width="${X(n.w)}" height="${X(n.h)}"${Kp(s)}/>`+Z(t.label,zz(n,t.label.width,T),o+8+t.label.height/2,d,u);E+=`<g class="pele-cluster pele-boundary${i}" data-id="${a}">${p}</g>`;continue}let _,v;if(t.kind===0){v=`pele-actor`;let e=-g/2,n=e+vz+yz+t.stereotype.height/2;_=`<g class="pele-actor-figure" transform="translate(0,${X(e+vz/2)})">${Iz(t,u)}</g>`+Z(t.stereotype,0,n,` class="pele-stereotype" font-size="${s}" fill="var(--_m)"`,u)+Z(t.label,0,g/2-t.label.height/2,` class="pele-label"${c}`,u)}else if(t.kind===3){v=`pele-json`;let e=-p/2,n=-g/2+t.headH,r=``,i=`M${X(e)},${X(n)}H${X(e+p)}`;t.keyW>0&&(i+=`M${X(e+t.keyW)},${X(n)}V${X(g/2)}`);for(let[i,a]of t.rows){let s=Math.max(i.height,a.height,Math.round(o*1.5))+Sz;r+=Z(i,e+xz+i.width/2,n+s/2,` class="pele-json-key"${f}`,u)+Bz(a,e+t.keyW+xz,n+s/2,` class="pele-json-value"${d}${c}`,u),n+=s}_=`<rect x="${X(e)}" y="${X(-g/2)}" width="${X(p)}" height="${X(g)}"${Kp(Ez+l)}/><path class="pele-json-lines" d="${i}" fill="none" stroke="var(--_b)"${t.style.line}/>`+Z(t.label,0,-g/2+t.headH/2,` class="pele-label" font-weight="var(--_hw)"${d}${c}`,u)+`<g font-size="${o}">${r}</g>`}else{let e=t.stereotype.height/2,n;if(t.kind===1){if(v=`pele-usecase`,n=`<ellipse rx="${X(p/2)}" ry="${X(g/2)}"${Ez}${l}/>`,r.business){let e=p/2-15,r=p/2-5,i=e=>g/2*Math.sqrt(1-(e/(p/2))**2);n+=`<path class="pele-business" d="M${X(e)},${X(i(e))}L${X(r)},${X(-i(r))}" fill="none" stroke="var(--_b)"${t.style.line}/>`}}else if(r.shape===`note`){v=`pele-note`;let e=p/2,r=g/2;n=`<path d="M${X(-e)},${X(-r)}H${X(e-Cz)}L${X(e)},${X(Cz-r)}V${X(r)}H${X(-e)}Z" fill="var(--_a)" stroke="var(--_b)" stroke-linejoin="round"${l}/><path d="M${X(e-Cz)},${X(-r)}V${X(Cz-r)}H${X(e)}" fill="none" stroke="var(--_b)" stroke-linejoin="round"${t.style.line}/>`}else v=`pele-usecase`,n=`<rect x="${X(-p/2)}" y="${X(-g/2)}" width="${X(p)}" height="${X(g)}"${Kp(Ez+l)}/>`;_=n+Z(t.stereotype,0,-t.label.height/2,` class="pele-stereotype" font-size="${s}"${f}`,u)+Z(t.label,0,e,` class="pele-label"${r.shape===`note`?` font-size="${o}"`:``}${d}${c}`,u)}O+=`<g class="pele-node ${v}${i}" data-id="${a}" transform="translate(${X(n.x)},${X(n.y)})">${_}</g>`}let k=``,A=``,j=``,M=new Map;for(let e=0;e<g.length;e++){let t=g[e],n=v[e],r=_[e],i=n.style.length>0||n.cssCompiledStyles.length>0?nm(n.cssCompiledStyles.concat(n.style)):void 0,a=n.arrowTypeStart,o=n.arrowTypeEnd,s;if(t.src===t.dst){let e=h[t.src],n=m[t.src],i=M.get(t.src)??0;M.set(t.src,i+1);let c=f?2:1,l=Math.min(jz(n,c)/2,8+i*6),u=gz+i*8,[d,p]=Az(n,e,c,-l),[g,_]=Az(n,e,c,l),v=Math.hypot(u,l)||1,y=f?l/v:u/v,b=f?u/v:l/v,x=Pz(a),S=Pz(o),C=(e,t,n,r)=>f?`${X(e+n*l*+!!r)},${X(t+r)}`:`${X(e+r)},${X(t+n*l*+!!r)}`,w=f?d-y*x:d+y*x,T=f?p+b*x:p-b*x,E=g+y*S,D=_+b*S;s={d:`M${X(w)},${X(T)}C${C(d,p,-1,u)} ${C(g,_,1,u)} ${X(E)},${X(D)}`,sx:d,sy:p,sdx:f?y:-y,sdy:f?-b:b,ex:g,ey:_,edx:-y,edy:-b},f?(t.labelX=e.x,t.labelY=Math.max(p,_)+u*.75+6+r.height/2):(t.labelX=Math.max(d,g)+u*.75+8+r.width/2,t.labelY=e.y)}else{if(t.route.length<6)continue;s=yp(t.route,void 0,Pz(a),Pz(o))}let c=Ap(s.d,[s.sx,s.sy,s.ex,s.ey],D,s.tokens),l=c&&jp(c,i?.line),d=l||(i?.stroke?Ec(i.stroke):`var(--_l)`);if(l===``){let e=`var(--_bg)`;k+=Fp(s.d,Fz(a,s.sx,s.sy,s.sdx,s.sdy,e,e)+Fz(o,s.ex,s.ey,s.edx,s.edy,e,e),i?.line)}let p=n.internal?`2 3`:n.pattern===`dotted`?`5 4`:n.animate?`9 5`:``,y=Fz(a,s.sx,s.sy,s.sdx,s.sdy,d)+Fz(o,s.ex,s.ey,s.edx,s.edy,d);if(A+=`<g class="pele-edge pele-${n.relationshipType}${im(n.classes.replace(/^default relationship relationship-\S+\s?/,``))}" data-id="${Y(n.id)}"${l?` stroke="${l}"`:``}${i?.line??``}><path d="${s.d}"${p?` stroke-dasharray="${p}"`:``}/>`+(c&&l?Mp(y,c):y)+`</g>`,r.width>0){let e=t.labelX,a=t.labelY,o=n.relationshipType===`include`||n.relationshipType===`extend`;j+=Rp(n.id,r,e,a,(o?` fill="var(--_m)"`:``)+(i?.text??``),u)}}return{svg:lm(`usecase`,C,w,a,n,e,Z(b,C/2,l+b.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(E?`<g class="pele-clusters">${E}</g>`:``)+Lp(k)+(A?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${A}</g>`:``)+(j?`<g class="pele-edge-labels" font-size="${o}">${j}</g>`:``)+`<g class="pele-nodes">${O}</g>`),width:C,height:w,links:[]}}function zz(e,t,n){let r=n.get(Math.round(e.y-e.h/2));if(t===0||r===void 0)return e.x;let i=e.x-e.w/2+6,a=e.x+e.w/2-6,o=r.filter(e=>e>i&&e<a).sort((e,t)=>e-t);o.push(a);let s=t/2+6,c=e.x,l=1/0,u=0,d=i;for(let t of o){if(t-d>=2*s){let n=Math.min(Math.max(e.x,d+s),t-s);Math.abs(n-e.x)<l&&(l=Math.abs(n-e.x),c=n)}else l===1/0&&t-d>u&&(u=t-d,c=(d+t)/2);d=t}return c}function Bz(e,t,n,r,i){if(e.lines.length<2)return Z(e,t+e.width/2,n,r,i);let a=``;for(let o=0;o<e.lines.length;o++)a+=Z(xh(e,o),t+e.widths[o]/2,n-e.height/2+bh(e,o),r,i);return a}var Vz={type:`usecase`,math:!0,parse:(e,t,n)=>iz(e,n),render:Lz};function Hz(e){let t=e.trim();return t.length>=2&&t.startsWith(`"`)&&t.endsWith(`"`)?t.slice(1,-1):t}function Uz(e){return e.map(Hz).sort()}var Wz=class{type=`venn`;title;subsets=[];textNodes=[];styles=[];known=new Set;current;indent=!1;setDiagramTitle(e){this.title=e}addSubsetData(e,t,n){let r=Uz(e);this.current=r,r.length===1&&this.known.add(r[0]),this.subsets.push({sets:r,size:n??10/e.length**2,label:t?Hz(t):void 0})}addTextData(e,t,n){this.textNodes.push({sets:Uz(e),id:Hz(t),label:n?Hz(n):void 0})}addStyleData(e,t){let n=new Map;for(let[e,r]of t)n.set(e,r&&Hz(r));this.styles.push({targets:Uz(e),styles:n})}validateUnionIdentifiers(e){let t=e.map(Hz).filter(e=>!this.known.has(e));if(t.length>0)throw new jo(`unknown set identifier: ${t.join(`, `)}`,`semantic`,{type:`venn`})}getCurrentSets(){return this.current}getIndentMode(){return this.indent}setIndentMode(e){this.indent=e}},Gz=[`$end`,`INVALID`,`EOF`,`NEWLINE`,`VENN`,`TITLE`,`SET`,`UNION`,`TEXT`,`INDENT_TEXT`,`STYLE`,`BRACKET_LABEL`,`NUMERIC`,`HEXCOLOR`,`RGBCOLOR`,`RGBACOLOR`,`IDENTIFIER`,`STRING`,`COMMA`,`COLON`],Kz=[[`venn-beta`,4],[`set`,6],[`union`,7],[`text`,8],[`style`,10]],qz=class{constructor(e,t){this.src=e,this.host=t}src;host;text=``;start=0;at=0;lineStart=!1;ended=!1;word(e,t){let n=this.src;for(let r=0;r<t.length;r++){let i=n.charCodeAt(e+r),a=t.charCodeAt(r);if(i!==a&&(i+32!==a||i<65||i>90))return!1}return!0}keyword(e,t){return this.word(e,t)&&!Ls(this.src.charCodeAt(e+t.length))}color(e,t){let n=this.src,r=e+1;for(let e=0;e<t;e++){for(;J(n.charCodeAt(r));)r++;let i=r;for(;Ps(n.charCodeAt(r))||n.charCodeAt(r)===46;)r++;if(r===i)return-1;for(;J(n.charCodeAt(r));)r++;if(n.charCodeAt(r)!==(e===t-1?41:44))return-1;r++}return r}afterLineFeed(e){let t=e-1;for(;this.src.charCodeAt(t)===32||this.src.charCodeAt(t)===9;)t--;return this.src.charCodeAt(t)===10}lineEnd(e){let t=this.src.indexOf(`
|
|
164
|
+
`,e);return t===-1?this.src.length:t}next(){let e=this.src,t=e.length;for(;;){let n=this.at;if(this.start=n,this.text=``,n>=t)return this.ended?0:(this.ended=!0,2);let r=e.charCodeAt(n);if(r===37&&e.charCodeAt(n+1)===37&&e.charCodeAt(n+2)!==123)this.at=this.lineEnd(n+2);else if(this.lineStart&&this.word(n,`title`)&&this.afterLineFeed(n)&&e.slice(n+5,this.lineEnd(n+5)).trim()===``){let t=this.lineEnd(n+5);for(;e.charCodeAt(t)===10||e.charCodeAt(t)===13;)t++;this.at=t}else{if(this.lineStart){if(r===32||r===9){let t=n+1;for(;e.charCodeAt(t)===32||e.charCodeAt(t)===9;)t++;if(this.at=t,this.keyword(t,`text`)&&this.host.getIndentMode())return this.at=t+4,this.lineStart=!1,this.text=e.slice(n,t),9;continue}r!==10&&r!==13&&(this.host.setIndentMode(!1),this.lineStart=!1)}if(r===10||r===13){for(n++;e.charCodeAt(n)===10||e.charCodeAt(n)===13;)n++;return this.lineStart=!0,this.token(3,n)}if(r===37&&e.charCodeAt(n+1)===37)this.at=this.lineEnd(n);else if(r===32||r===9){for(n++;e.charCodeAt(n)===32||e.charCodeAt(n)===9;)n++;this.at=n}else{if((r|32)>=97&&(r|32)<=122||r===95){let r=e.charCodeAt(n+5);if(this.word(n,`title`)&&J(r)&&r!==10&&r!==13){let r=n+6;for(;r<t;){let t=e.charCodeAt(r);if(t===35||t===10||t===59)break;r++}if(r>n+6)return this.token(5,r)}for(let[t,r]of Kz)if(this.keyword(n,t)&&e.charCodeAt(n+t.length)!==45)return this.token(r,n+t.length);if(this.word(n,`rgb`)){let t=(e.charCodeAt(n+3)|32)==97,r=n+(t?4:3),i=e.charCodeAt(r)===40?this.color(r,t?4:3):-1;if(i!==-1)return this.token(t?15:14,i)}for(n++;Ls(e.charCodeAt(n))||e.charCodeAt(n)===45;)n++;return this.token(16,n)}if(r===91){if(e.charCodeAt(n+1)===34){let t=e.indexOf(`"`,n+2);return t===-1||e.charCodeAt(t+1)!==93?1:(this.at=t+2,this.text=e.slice(n+2,t),11)}let r=n+1;for(;r<t&&e.charCodeAt(r)!==93&&e.charCodeAt(r)!==34;)r++;return r===n+1||e.charCodeAt(r)!==93?1:(this.at=r+1,this.text=e.slice(n+1,r).trim(),11)}if(Ps(r)||r===46||r===43||r===45){(r===43||r===45)&&n++;let t=n;for(;Ps(e.charCodeAt(n));)n++;if(n>t){if(e.charCodeAt(n)===46&&Ps(e.charCodeAt(n+1)))for(n+=2;Ps(e.charCodeAt(n));)n++}else if(e.charCodeAt(n)===46&&Ps(e.charCodeAt(n+1)))for(n+=2;Ps(e.charCodeAt(n));)n++;else return 1;return this.token(12,n)}if(r===35){let t=n+1;for(;t<n+9&&Is(e.charCodeAt(t));)t++;return t>=n+4?this.token(13,t):1}if(r===34){let t=e.indexOf(`"`,n+1);return t===-1?1:this.token(17,t+1)}return r===44?this.token(18,n+1):r===58?this.token(19,n+1):1}}}}token(e,t){return this.text=this.src.slice(this.at,t),this.at=t,e}},Jz=`'EOF', 'NEWLINE', 'TITLE', 'SET', 'UNION', 'TEXT', 'INDENT_TEXT', 'STYLE'`,Yz=`'NUMERIC', 'IDENTIFIER', 'STRING', 'HEXCOLOR', 'RGBCOLOR', 'RGBACOLOR'`;function Xz(e,t){let n=new qz(e,t),r=-1,i=()=>r===-1?r=n.next():r,a=t=>{throw i()===1?zo(`venn`,e,n.start,``,!0):zo(`venn`,e,n.start,`Expecting ${t}, got '${Gz[r]}'`)},o=()=>(r=-1,n.text),s=e=>(i()!==e&&a(`'${Gz[e]}'`),o()),c=()=>(i()!==16&&r!==17&&a(`'IDENTIFIER', 'STRING'`),o()),l=()=>{let e=[c()];for(;i()===18;)o(),e.push(c());return e},u=(e,n)=>{let r=i()===11?o():void 0,a;if(i()===19&&(o(),a=parseFloat(s(12))),n){if(e.length<2)throw new jo(`union requires multiple identifiers`,`semantic`,{type:`venn`});t.validateUnionIdentifiers(e)}t.addSubsetData(e,r,a),t.setIndentMode(!0)},d=e=>{let n=i();n!==16&&n!==17&&n!==12&&a(`'NUMERIC', 'IDENTIFIER', 'STRING'`);let r=o(),s=n!==12&&i()===11?o():void 0;t.addTextData(e(),r,s)},f=()=>{let e=l(),n=[];for(;;){let e=s(16);s(19);let t;if(i()===17)t=o();else{let e=[];for(;i()===16||r>=12&&r<=15;)e.push(o());e.length===0&&a(Yz),t=e.join(` `)}if(n.push([e,t]),i()!==18)break;o()}t.addStyleData(e,n)};for(;i()===3;)o();for(s(4);;){let e=i();if(e===2)return;if((e<3||e>10||e===4)&&a(Jz),o(),e===5)t.setDiagramTitle(n.text.slice(6));else if(e===6)u([c()],!1);else if(e===7)u(l(),!0);else if(e===8){let e=l();d(()=>e)}else e===9?d(()=>{let e=t.getCurrentSets();if(!e)throw new jo(`text requires set`,`semantic`,{type:`venn`});return e}):e===10&&f()}}var Zz=Math.PI*2;function Qz(e){let t=new Set,n=new Map;for(let r of e)t.add(JSON.stringify([...r.sets].sort())),r.sets.length===1&&n.set(r.sets[0],r.size);let r=[];for(let i of e){if(i.sets.length<3)continue;let e=[...i.sets].sort();for(let i=0;i<e.length-1;i++)for(let a=i+1;a<e.length;a++){let o=[e[i],e[a]],s=JSON.stringify(o);if(t.has(s))continue;t.add(s);let c=n.get(o[0]),l=n.get(o[1]);r.push({sets:o,size:c!==void 0&&l!==void 0?Math.min(c,l)/4:2.5,label:``})}}return r.length>0?[...e,...r]:e}function $z(e,t,n){if(n>=e+t)return 0;let r=Math.min(e,t);if(n<=Math.abs(e-t))return Math.PI*r*r;let i=e*e*Math.acos((n*n+e*e-t*t)/(2*n*e)),a=t*t*Math.acos((n*n+t*t-e*e)/(2*n*t)),o=.5*Math.sqrt(Math.max((-n+e+t)*(n+e-t)*(n-e+t)*(n+e+t),0));return i+a-o}function eB(e,t,n){let r=Math.abs(e-t),i=e+t;if(!(n>0))return i;if(n>=Math.PI*Math.min(e,t)**2)return r;for(let a=0;a<48;a++){let a=(r+i)/2;$z(e,t,a)>n?r=a:i=a}return(r+i)/2}function tB(e,t,n,r,i,a){let o=1/0;for(let n of t){let t=e[n],s=r-t.x,c=i-t.y,l=t.r-Math.sqrt(s*s+c*c);if(l<o){if(l<a)return l;o=l}}for(let t of n){let n=e[t],s=r-n.x,c=i-n.y,l=Math.sqrt(s*s+c*c)-n.r;if(l<o){if(l<a)return l;o=l}}return o}function nB(e,t,n){let r=0,i=0,a=e[t[0]];for(let n of t){let o=e[n];r+=o.x/t.length,i+=o.y/t.length,o.r<a.r&&(a=o)}let o=a.r,s=r,c=i,l=tB(e,t,n,s,c,-1/0),u=0,d=(a,d)=>{let f=tB(e,t,n,a,d,l-o*1e-9);if(!(f>l-o*1e-9))return!1;let p=Math.hypot(a-r,d-i);return f>l+o*1e-9||p<u-o*1e-9?(l=f,u=p,s=a,c=d,!0):!1};for(let e=-10;e<=10;e++)for(let t=-10;t<=10;t++)t*t+e*e<=100&&d(a.x+t*o/10,a.y+e*o/10);let f=o/10;for(let e=0;e<40&&f>o*1e-6;e++){let e=!1;for(let t=0;t<8;t++){let n=t*Zz/8;d(s+Math.cos(n)*f,c+Math.sin(n)*f)&&(e=!0)}e||(f/=2)}return{x:s,y:c,margin:l}}function rB(e){let t=new Map;for(let n of e)for(let e of n.sets)t.has(e)||t.set(e,10);for(let n of e)n.sets.length===1&&t.set(n.sets[0],n.size);let n=new Map,r=[],i=0;for(let e of t.values())Number.isFinite(e)&&e>i&&(i=e);i===0&&(i=10);let a=Math.sqrt(i/Math.PI);for(let[e,i]of t){n.set(e,r.length);let t=Number.isFinite(i)&&i>0?Math.sqrt(i/Math.PI):0;r.push({id:e,x:0,y:0,r:Math.max(t,a*.3)})}let o=r.length;if(o<2)return r;let s=new Map;for(let t of Qz(e)){if(t.sets.length!==2)continue;let e=n.get(t.sets[0]),r=n.get(t.sets[1]);e!==r&&s.set(Math.min(e,r)*o+Math.max(e,r),t.size)}let c=new Map;for(let[e,t]of s)c.set(e,eB(r[Math.floor(e/o)].r,r[e%o].r,t));let l=a*.15,u=(e,t)=>c.get(e*o+t)??r[e].r+r[t].r+l;if(o===2)return r[1].x=u(0,1),r;if(o===3){let t=u(0,1),n=u(0,2),i=u(1,2),o=e.some(e=>new Set(e.sets).size===3);for(let e=0;e<40;e++){let e=t>0?(t*t+n*n-i*i)/(2*t):0;if(r[1].x=t,r[2].x=Math.max(-n,Math.min(n,e)),r[2].y=Math.sqrt(Math.max(n*n-e*e,0)),!o||nB(r,[0,1,2],[]).margin>a*.12)break;t*=.94,n*=.94,i*=.94}return r}let d=0;for(let e of r)d+=2*e.r+l;let f=Math.min(300,Math.floor(3e6/(o*o)));if(o<=64){let e=d/Zz;r.forEach((t,n)=>{let r=n*Zz/o-Math.PI/2;t.x=Math.cos(r)*e,t.y=Math.sin(r)*e})}else{let e=Math.ceil(Math.sqrt(o)),t=2*a+l;r.forEach((n,r)=>{n.x=r%e*t,n.y=Math.floor(r/e)*t})}let p=new Float64Array(o),m=new Float64Array(o),h=new Int32Array(o);for(let e=0;e<f;e++){p.fill(0),m.fill(0),h.fill(0);for(let e=0;e<o;e++)for(let t=e+1;t<o;t++){let n=c.get(e*o+t),i=r[e].r+r[t].r+l,a=r[t].x-r[e].x,s=r[t].y-r[e].y,u=Math.hypot(a,s);if(n===void 0&&u>=i)continue;u<1e-9&&(a=Math.cos(e+t),s=Math.sin(e+t),u=1);let d=(u-(n??i))/2/u;p[e]+=a*d,m[e]+=s*d,p[t]-=a*d,m[t]-=s*d,h[e]++,h[t]++}for(let e=0;e<o;e++)h[e]!==0&&(r[e].x+=p[e]/h[e],r[e].y+=m[e]/h[e])}return r}function iB(e,t){let n=e=>`M${t(e.x-e.r)},${t(e.y)}A${t(e.r)},${t(e.r)} 0 1 1 ${t(e.x+e.r)},${t(e.y)}A${t(e.r)},${t(e.r)} 0 1 1 ${t(e.x-e.r)},${t(e.y)}Z`;if(e.length===1)return n(e[0]);let r=(t,n,r,i)=>{for(let a of e)if(a!==r&&a!==i&&Math.hypot(t-a.x,n-a.y)>a.r*(1+1e-9))return!1;return!0},i=[];for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++){let a=e[t],o=e[n],s=Math.hypot(o.x-a.x,o.y-a.y);if(s>=a.r+o.r||s<=Math.abs(a.r-o.r)||s===0)continue;let c=(a.r*a.r-o.r*o.r+s*s)/(2*s),l=Math.sqrt(Math.max(a.r*a.r-c*c,0)),u=a.x+(o.x-a.x)*c/s,d=a.y+(o.y-a.y)*c/s;for(let e of[1,-1]){let t=u+e*l*(o.y-a.y)/s,n=d-e*l*(o.x-a.x)/s;r(t,n,a,o)&&i.push({x:t,y:n,a,b:o})}}if(i.length<2){let t=e[0];for(let n of e)n.r<t.r&&(t=n);for(let n of e)if(n!==t&&Math.hypot(n.x-t.x,n.y-t.y)+t.r>n.r*(1+1e-9))return``;return n(t)}let a=0,o=0;for(let e of i)a+=e.x/i.length,o+=e.y/i.length;i.sort((e,t)=>Math.atan2(e.y-o,e.x-a)-Math.atan2(t.y-o,t.x-a));let s=``;for(let e=0;e<i.length;e++){let n=i[e],r=i[(e+1)%i.length];e===0&&(s=`M${t(n.x)},${t(n.y)}`);let a,o=0,c=1/0;for(let e of[n.a,n.b]){if(e!==r.a&&e!==r.b)continue;let t=Math.atan2(n.y-e.y,n.x-e.x),i=Math.atan2(r.y-e.y,r.x-e.x)-t;i<=0&&(i+=Zz);let s=e.x+e.r*Math.cos(t+i/2),l=e.y+e.r*Math.sin(t+i/2),u=Math.hypot(s-(n.x+r.x)/2,l-(n.y+r.y)/2);u<c&&(c=u,a=e,o=+(i>Math.PI))}s+=a===void 0?`L${t(r.x)},${t(r.y)}`:`A${t(a.r)},${t(a.r)} 0 ${o} 1 ${t(r.x)},${t(r.y)}`}return s+`Z`}var aB=100,oB=1.6,sB=nm([]);function cB(e){return e.length===1?e[0]:JSON.stringify(e)}function lB(e,t,n){let r=n.fontSize??16,i=Math.round(r*.875),a=Math.round(r*.8125),o=n.measurer??bc(n.fontFamily,n.fontFamilyMono),s=n.padding??8,c=rB(e.subsets),l=new Map;c.forEach((e,t)=>l.set(e.id,t));let u=new Map;for(let{targets:t,styles:n}of e.styles){let e=cB(t),r=u.get(e);r||u.set(e,r=new Map);for(let[e,t]of n)r.set(e,t)}let d=e=>{let t=u.get(e);if(!t)return sB;let n=[];for(let[e,r]of t)n.push(`${e}:${r}`);return nm(n)},f=c.map(()=>[]);for(let e=0;e<c.length;e++)for(let t=e+1;t<c.length;t++)Math.hypot(c[e].x-c[t].x,c[e].y-c[t].y)<c[e].r+c[t].r&&(f[e].push(t),f[t].push(e));let p=new Map;for(let t of e.subsets)p.set(cB(t.sets),t);let m=new Map;for(let[e,t]of p){let n=[...new Set(t.sets)],a=n.map(e=>l.get(e)),s=new Set(a),u=a[0];for(let e of a)c[e].r<c[u].r&&(u=e);let p=d(e),h=t.label??(t.sets.length===1?t.sets[0]:void 0),g=+!!p.bold|(p.italic?2:0),_=f[u].filter(e=>!s.has(e)),v=nB(c,a,_),y=_.length>0&&v.margin<c[u].r*.2;y&&(v=nB(c,a,[]));let b={sets:n,inside:a,spot:v,lines:[],style:p,across:y};if(h){let e=n.length===1?r:i;b.lines.push({id:void 0,raw:h,size:e,base:g,label:Q(h,!1,o,e,4e3,g)})}m.set(e,b)}for(let t of e.textNodes){let e=t.label??t.id;m.get(cB(t.sets))?.lines.push({id:t.id,raw:e,size:a,base:0,label:Q(e,!1,o,a,4e3)})}let h=0;for(let e of c)e.r>h&&(h=e.r);let g=h>0?aB/h:1,_=1;for(let e of m.values()){if(e.spot.margin<=0)continue;let t=0,n=0;for(let r of e.lines)t=Math.max(t,r.label.width),n+=r.label.height;let r=Math.hypot(t,n)/2+4;_=Math.max(_,Math.min(r/(e.spot.margin*g),oB))}g*=_;for(let e of m.values()){let t=Math.max(e.spot.margin*g*1.8,72);for(let n of e.lines)n.label.width>t&&(n.label=Q(n.raw,!1,o,n.size,t,n.base))}let v=1/0,y=1/0,b=-1/0,x=-1/0;for(let e of c)v=Math.min(v,(e.x-e.r)*g),y=Math.min(y,(e.y-e.r)*g),b=Math.max(b,(e.x+e.r)*g),x=Math.max(x,(e.y+e.r)*g);for(let e of m.values()){let t=0,n=0;for(let r of e.lines)t=Math.max(t,r.label.width),n+=r.label.height;v=Math.min(v,e.spot.x*g-t/2),b=Math.max(b,e.spot.x*g+t/2),y=Math.min(y,e.spot.y*g-n/2),x=Math.max(x,e.spot.y*g+n/2)}c.length===0&&(v=y=b=x=0);let S=Q(e.title&&Hz(e.title),!1,o,r,4e3,1),C=S.height>0?S.height+12:0,w=Math.max(b-v,S.width),T=s+(w-(b-v))/2-v,E=s+C-y,D=Math.ceil(w+2*s),O=Math.ceil(x-y+C+2*s),k=c.map(e=>({id:e.id,x:e.x*g+T,y:e.y*g+E,r:e.r*g})),A=``;k.forEach((e,t)=>{let n=om(t),r=m.get(e.id)?.style??sB;A+=`<circle class="pele-venn-set" data-id="${Y(e.id)}" cx="${X(e.x)}" cy="${X(e.y)}" r="${X(e.r)}" fill="${n}" fill-opacity="0.2" stroke="${n}"${r.shape}/>`});let j=[...m.values()].filter(e=>e.sets.length>1&&e.style.shape!==``),M=e=>{if(e.across)return``;let t=e.sets.length===1&&/[";]fill-opacity:/.test(e.style.shape)?e.style.shape:``;for(let n of j)n.sets.every(t=>e.sets.includes(t))&&(t=n.style.shape);return t},N=``,P=``;for(let e of m.values()){let t=Y(e.sets.join(`|`));if(e.sets.length>1&&e.style.shape!==``){let n=iB(e.inside.map(e=>k[e]),X);n!==``&&(N+=`<path class="pele-venn-overlap" data-id="${t}" d="${n}" fill="none"${e.style.shape}/>`)}let n=0;for(let t of e.lines)n+=t.label.height;if(n===0)continue;let i=e.spot.x*g+T,o=e.spot.y*g+E-n/2,s=M(e),c=``;for(let t of e.lines){let n=t.id===void 0?e.style.text:d(t.id).text,l=ul(s,n),u=t.id===void 0?` class="pele-label"${t.size===r?``:` font-size="${t.size}"`}${l?` fill="${l}"`:``}${n}`:` class="pele-venn-text" data-id="${Y(t.id)}" font-size="${a}" fill="${l??`var(--_m)`}"${n}`;c+=Z(t.label,i,o+t.label.height/2,u),o+=t.label.height}P+=`<g class="pele-venn-region" data-id="${t}">${c}</g>`}return{svg:lm(`venn`,D,O,r,n,{},Z(S,D/2,s+S.height/2,` class="pele-title" font-weight="var(--_tw)"`)+`<g class="pele-venn-sets">${A}</g>`+(N?`<g class="pele-venn-overlaps">${N}</g>`:``)+(P?`<g class="pele-venn-labels">${P}</g>`:``)),width:D,height:O,links:[]}}var uB={type:`venn`,parse(e,t,n){let r=new Wz;return n&&(r.title=n),Xz(e,r),r},render:lB},dB=class{nodes=new Map;labels;links=[];trends=new Map;pipelines=new Map;annotations=[];notes=[];accelerators=[];deaccelerators=[];annotationsBox;axes={};size;addNode(e){let t=this.nodes.get(e.id)??{id:e.id,label:e.label};this.nodes.set(e.id,{...t,...e,className:e.className??t.className,labelOffsetX:e.labelOffsetX??t.labelOffsetX,labelOffsetY:e.labelOffsetY??t.labelOffsetY}),this.labels=void 0}addLink(e){this.links.push(e)}addTrend(e){this.trends.set(e.nodeId,e)}startPipeline(e){this.pipelines.set(e,{nodeId:e,componentIds:[]});let t=this.nodes.get(e);t&&(t.isPipelineParent=!0)}addPipelineComponent(e,t){this.pipelines.get(e)?.componentIds.push(t);let n=this.nodes.get(t);n&&(n.inPipeline=!0)}addAnnotation(e){this.annotations.push(e)}addNote(e){this.notes.push(e)}addAccelerator(e){this.accelerators.push(e)}addDeaccelerator(e){this.deaccelerators.push(e)}setAnnotationsBox(e,t){this.annotationsBox={x:e,y:t}}setAxes(e){this.axes={...this.axes,...e}}setSize(e,t){this.size={width:e,height:t}}getNode(e){return this.nodes.get(e)}resolveNodeId(e){if(this.nodes.has(e))return e;if(!this.labels){this.labels=new Map;for(let[e,t]of this.nodes)this.labels.has(t.label)||this.labels.set(t.label,e)}return this.labels.get(e)??e}build(){let e=[];for(let t of this.nodes.values()){if(typeof t.x!=`number`||typeof t.y!=`number`)throw new jo(`Node "${t.label}" is missing coordinates`,`semantic`,{type:`wardley`});e.push(t)}return{nodes:e,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}};function fB(e,t){let n=e<=1?e*100:e;if(n<0||n>100)throw new jo(`${t} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${e}`,`semantic`,{type:`wardley`});return n}function pB(e,t,n){return{x:fB(t,`${n} evolution`),y:fB(e,`${n} visibility`)}}function mB(e){return e===`+<>`?`bidirectional`:e===`+<`?`backward`:e===`+>`?`forward`:void 0}function hB(e){if(!e?.startsWith(`+`))return{};let t=e.indexOf(`'`,2),n=e[1]===`'`&&t!==-1?e.slice(2,t):void 0;return e.includes(`<>`)?{flow:`bidirectional`,label:n}:e.includes(`<`)?{flow:`backward`,label:n}:e.includes(`>`)?{flow:`forward`,label:n}:{label:n}}function gB(e){return e?[(e.negX?-1:1)*e.offsetX,(e.negY?-1:1)*e.offsetY]:[void 0,void 0]}function _B(e,t){e.size&&t.setSize(e.size.width,e.size.height),e.evolution&&t.setAxes({stages:e.evolution.stages.map(e=>e.secondName?`${e.name.trim()} / ${e.secondName.trim()}`:e.name.trim()),stageBoundaries:e.evolution.stages.filter(e=>e.boundary!==void 0).map(e=>e.boundary)});for(let n of e.anchors){let e=pB(n.visibility,n.evolution,`Anchor "${n.name}"`);t.addNode({id:n.name,label:n.name,x:e.x,y:e.y,className:`anchor`})}for(let n of e.components){let e=pB(n.visibility,n.evolution,`Component "${n.name}"`),[r,i]=gB(n.label);t.addNode({id:n.name,label:n.name,x:e.x,y:e.y,className:`component`,labelOffsetX:r,labelOffsetY:i,inertia:n.inertia,sourceStrategy:n.decorator?.strategy})}for(let n of e.notes){let e=pB(n.visibility,n.evolution,`Note "${n.text}"`);t.addNote({text:n.text,x:e.x,y:e.y})}for(let n of e.pipelines){let e=t.getNode(n.parent);if(!e||typeof e.y!=`number`)throw new jo(`Pipeline "${n.parent}" must reference an existing component with coordinates.`,`semantic`,{type:`wardley`});let r=e.y;t.startPipeline(n.parent);for(let e of n.components){let i=`${n.parent}_${e.name}`,[a,o]=gB(e.label),s=fB(e.evolution,`Pipeline component "${e.name}" evolution`);t.addNode({id:i,label:e.name,x:s,y:r,className:`pipeline-component`,labelOffsetX:a,labelOffsetY:o,inertia:void 0,sourceStrategy:void 0}),t.addPipelineComponent(n.parent,i)}}for(let n of e.links){let e=!!n.arrow&&(n.arrow.includes(`-.->`)||n.arrow.includes(`.-.`)),r=hB(n.arrow),i=mB(n.fromPort)??mB(n.toPort)??r.flow;t.addLink({source:t.resolveNodeId(n.from),target:t.resolveNodeId(n.to),dashed:e,label:r.label??n.linkLabel,flow:i})}for(let n of e.evolves){let e=t.getNode(n.component);e?.y!==void 0&&t.addTrend({nodeId:n.component,targetX:fB(n.target,`Evolve target for "${n.component}"`),targetY:e.y})}if(e.annotations.length>0){let n=pB(e.annotations[0].x,e.annotations[0].y,`Annotations box`);t.setAnnotationsBox(n.x,n.y)}for(let n of e.annotation){let e=pB(n.x,n.y,`Annotation ${n.number}`);t.addAnnotation({number:n.number,coordinates:[{x:e.x,y:e.y}],text:n.text})}for(let n of e.accelerators){let e=pB(n.x,n.y,`Accelerator "${n.name}"`);t.addAccelerator({name:n.name,x:e.x,y:e.y})}for(let n of e.deaccelerators){let e=pB(n.x,n.y,`Deaccelerator "${n.name}"`);t.addDeaccelerator({name:n.name,x:e.x,y:e.y})}}function vB(e,t){let n=new dB;return _B(e,n),{type:`wardley`,title:e.title||t,accTitle:e.accTitle?e.accTitle.replace(/^\s+/g,``):void 0,accDescr:e.accDescr?e.accDescr.replace(/\n\s+/g,`
|
|
165
|
+
`):void 0,...n.build()}}function yB(e,t){let n=t;for(let t=e.charCodeAt(n);t>=48&&t<=57;t=e.charCodeAt(n))n++;return n}function bB(){let e=0,t=0;return(n,r)=>{if((r<e||r>=t)&&(e=r,t=yB(n,r)),t===r||n.charCodeAt(t)!==46)return-1;let i=yB(n,t+1);return i>t+1?i:-1}}var xB={name:`ARROW`,pattern:/->/y,first:`-`},SB={name:`LINK_ARROW`,pattern:/-->|-\.->|>|\+'[^']*'<>|\+'[^']*'<|\+'[^']*'>/y,first:`->+`},CB=(e,t)=>({name:e,pattern:new RegExp(t,`y`),first:t[0]}),wB=[{name:`[`,pattern:`[`},{name:`,`,pattern:`,`},{name:`]`,pattern:`]`},{name:`@`,pattern:`@`},{name:`/`,pattern:`/`},{name:`(`,pattern:`(`},{name:`)`,pattern:`)`},{name:`-`,pattern:`-`,longer:[xB,SB,dg]},{name:`{`,pattern:`{`},{name:`}`,pattern:`}`},{name:`WARDLEY_NUMBER`,pattern:/[0-9]+\.[0-9]+/y,first:`0123456789`,scanner:bB},xB,{name:`LINK_PORT`,pattern:/\+<>|\+>|\+</y,first:`+`},SB,{name:`LINK_LABEL`,pattern:/;[^\n\r]+/y,first:`;`},{name:`STRATEGY`,pattern:/build|buy|outsource|market/y,first:`bom`},CB(`KW_WARDLEY`,`wardley-beta`),CB(`KW_SIZE`,`size`),CB(`KW_EVOLUTION`,`evolution`),CB(`KW_ANCHOR`,`anchor`),CB(`KW_COMPONENT`,`component`),CB(`KW_LABEL`,`label`),CB(`KW_INERTIA`,`inertia`),CB(`KW_EVOLVE`,`evolve`),CB(`KW_PIPELINE`,`pipeline`),CB(`KW_NOTE`,`note`),CB(`KW_ANNOTATIONS`,`annotations`),CB(`KW_ANNOTATION`,`annotation`),CB(`KW_ACCELERATOR`,`accelerator`),CB(`KW_DEACCELERATOR`,`deaccelerator`),{name:`NAME_WITH_SPACES`,pattern:/(?!title\s|accTitle|accDescr)[A-Za-z](?:[A-Za-z0-9_()&]|-(?!>))*(?:[ \t]+[A-Za-z(](?:[A-Za-z0-9_()&]|-(?!>))*)*/y,first:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`},{name:`WS`,pattern:/[ \t]+/y,hidden:!0,first:` `},wS(),ag,og,{name:`INT`,pattern:/0|[1-9][0-9]*(?!\.)/y,first:`0123456789`},cg,{name:`ID`,pattern:/[\w]([-\w]*\w)?/y,first:`_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`},lg,ug,dg,fg,pg];function TB(e){let t=new wg(rg(e,wB,`wardley`),wB,`wardley`),n={$type:`Wardley`,anchors:[],components:[],links:[],evolves:[],pipelines:[],notes:[],annotations:[],annotation:[],accelerators:[],deaccelerators:[]},r=e=>t.kinds[t.i]===e,i=()=>r(36)||r(37)||r(30),a=()=>r(36)?Cg(t.take()):r(37)||r(30)?t.take():t.fail(`a name`),o=()=>Number(t.expect(10)),s=()=>parseInt(t.expect(35)),c=()=>r(10)?Number(t.take()):parseInt(t.expect(35)),l=()=>{if(!r(-1))for(r(38)||t.fail(`a line break or the end of input`);r(38);)t.i++},u=e=>{t.expect(0);let n=e();t.expect(1);let r=e();return t.expect(2),[n,r]},d=()=>{t.expect(21),t.expect(0);let e=t.accept(7),n=s();t.expect(1);let r=t.accept(7),i=s();return t.expect(2),{$type:`Label`,negX:e,offsetX:n,negY:r,offsetY:i}},f=()=>{let e={$type:`EvolutionStage`,name:a()};return t.accept(3)&&(e.boundary=o()),t.accept(4)&&(e.secondName=a()),e};for(;r(38);)t.i++;for(t.expect(16);!r(-1);)switch(t.kind){case 38:t.i++;break;case 32:n.accDescr=xg(t.take()),l();break;case 33:n.accTitle=bg(t.take()),l();break;case 34:n.title=yg(t.take()),l();break;case 17:{t.i++;let[e,r]=u(s);l(),n.size={$type:`Size`,width:e,height:r};break}case 18:{t.i++;let e=[f()];for(t.expect(11),e.push(f());t.accept(11);)e.push(f());l(),n.evolution={$type:`Evolution`,stages:e};break}case 19:{t.i++;let e=a(),[r,i]=u(o);l(),n.anchors.push({$type:`Anchor`,name:e,visibility:r,evolution:i});break}case 20:{t.i++;let e={$type:`Component`,name:a(),visibility:0,evolution:0,inertia:!1};[e.visibility,e.evolution]=u(o),r(21)&&(e.label=d()),r(5)&&t.kinds[t.i+1]===15&&(t.i++,e.decorator={$type:`Decorator`,strategy:t.take()},t.expect(6)),t.accept(22)?e.inertia=!0:t.accept(5)&&(t.expect(22),t.expect(6),e.inertia=!0),l(),n.components.push(e);break}case 23:{t.i++;let e=a(),r=o();l(),n.evolves.push({$type:`Evolve`,component:e,target:r});break}case 24:{t.i++;let e=a();for(t.expect(8),t.expect(38);r(38);)t.i++;let i=[];do{t.expect(20);let e={$type:`PipelineComponent`,name:a(),evolution:0};t.expect(0),e.evolution=o(),t.expect(2),r(21)&&(e.label=d()),l(),i.push(e)}while(r(20));t.expect(9),l(),n.pipelines.push({$type:`Pipeline`,parent:e,components:i});break}case 25:{t.i++;let e=Cg(t.expect(36)),[r,i]=u(o);l(),n.notes.push({$type:`Note`,text:e,visibility:r,evolution:i});break}case 26:{t.i++;let[e,r]=u(c);l(),n.annotations.push({$type:`Annotations`,x:e,y:r});break}case 27:{t.i++;let e=s();t.expect(1);let[r,i]=u(c),a=Cg(t.expect(36));l(),n.annotation.push({$type:`Annotation`,number:e,x:r,y:i,text:a});break}case 28:case 29:{let e=t.kind===29;t.i++;let r=a(),[i,s]=u(o);l(),e?n.deaccelerators.push({$type:`Deaccelerator`,name:r,x:i,y:s}):n.accelerators.push({$type:`Accelerator`,name:r,x:i,y:s});break}default:{i()||t.fail(`a statement`);let e={$type:`Link`,from:a(),to:``};r(12)&&(e.fromPort=t.take()),(r(13)||r(11))&&(e.arrow=t.take()),e.to=a(),r(12)&&(e.toPort=t.take()),r(14)&&(e.linkLabel=t.take().substring(1).trim()),l(),n.links.push(e)}}return n}var EB=[`Genesis`,`Custom Built`,`Product`,`Commodity`],DB=48,OB=6,kB=10,AB=8,jB=15,MB=60,NB=30,PB=20,FB=`var(--_c)`,IB=`var(--_l)`;function LB(e,t,n,r,i){let a=e[`wardley-beta`]?.[t];return typeof a==`number`&&a>=r&&a<=i?a:n}function RB(e,t,n){return e<t?t:e>n?n:e}function zB(e,t,n,r){let i=Hc(e),a=``,o=n;for(let n of e.lines){let r=!0;for(let e of n){if(e.icon!==void 0)continue;let n=Vc(e.style&~i);a+=`<tspan${r?` x="${X(t)}" y="${X(o)}"`:``}${n}>${Ec(e.text)}</tspan>`,r=!1}o+=e.lineHeight}return a===``?``:`<text${Uc(r,i)} xml:space="preserve">${a}</text>`}function BB(e,t,n,r){return RB(typeof t==`number`&&Number.isFinite(t)?t:LB(e,n,r,1,1e6),200,1e4)-2*DB}function VB(e,t,n){let r=BB(t,e.size?.width,`width`,900);return Sh(n,r,160,(i,a)=>HB(e,t,n,i,r,a))}function HB(e,t,n,r,i,a){let o=n.fontSize??16,s=Math.round(o*.8125),c=Math.round(o*.6875),l=n.measurer??bc(n.fontFamily,n.fontFamilyMono),u=n.padding??8,d=BB(t,e.size?.height,`height`,600)*Math.max(.75,r/i),f=t[`wardley-beta`]?.showGrid===!0,p=0,m=0,h=r,g=d,_=(e,t,n,r)=>{e<p&&(p=e),t<m&&(m=t),n>h&&(h=n),r>g&&(g=r)},v=(e,t,r,i)=>(_(t-e.width/2,r-e.height/2,t+e.width/2,r+e.height/2),Z(e,t,r,i,n.icons)),y=(e,t,n,r)=>(_(t,n-e.size,t+e.width,n-e.size+e.height+4),zB(e,t,n,r)),b=(e,t,n=a?Math.max(64,Math.min(120,r/2)):4e3,i=0)=>Q(e,!1,l,t,n,i),x=e=>e/100*r,S=e=>d-e/100*d,C=e.axes.stages&&e.axes.stages.length>0?e.axes.stages:EB,w=e.axes.stageBoundaries,T=w!==void 0&&w.length===C.length,E=``,D=``,O=d,k=0;if(C.forEach((e,t)=>{let n=T?k:t/C.length,i=T?RB(w[t],0,1):(t+1)/C.length;k=i,t>0&&(E+=`<path class="pele-wardley-stage" d="M${X(n*r)},0V${X(d)}" stroke="var(--_b)" stroke-dasharray="4 4"/>`);let a=b(e,s,Math.max(48,Math.abs(i-n)*r-12));D+=v(a,(n+i)/2*r,d+8+a.height/2,` class="pele-wardley-stage-label" font-size="${s}" fill="var(--_m)"`),O=Math.max(O,d+8+a.height)}),f)for(let e=1;e<4;e++)E+=`<path class="pele-wardley-grid" d="M${X(r*e/4)},0V${X(d)}M0,${X(d*e/4)}H${X(r)}" stroke="var(--_b)" stroke-dasharray="2 6"/>`;E+=`<path class="pele-wardley-axis" d="M0,0V${X(d)}H${X(r)}" stroke="${IB}"/>`;let A=b(e.axes.xLabel??`Evolution`,s),j=b(e.axes.yLabel??`Visibility`,s),M=` class="pele-wardley-axis-label" font-size="${s}" font-weight="var(--_hw)"`,N=v(A,r/2,O+6+A.height/2,M)+Z(j,-16,d/2,`${M} transform="rotate(-90 -16 ${X(d/2)})"`);_(-16-j.height/2,0,0,0);let P=O+6+A.height+10,F=new Map;for(let t of e.nodes)F.set(t.id,{x:x(t.x),y:S(t.y),node:t});let I=``,L=new Map;for(let t of e.pipelines){L.set(t.nodeId,new Set(t.componentIds));let e=[];for(let n of t.componentIds){let t=F.get(n);t&&e.push(t)}if(e.length===0)continue;e.sort((e,t)=>e.x-t.x);let n=e[0].x,r=e[e.length-1].x,i=e[0].y,a=i-2*OB,o=F.get(t.nodeId);o&&(o.x=(n+r)/2,o.y=a-kB/6),_(n-jB,a,r+jB,a+4*OB),I+=`<g class="pele-wardley-pipeline" data-id="${Y(t.nodeId)}"><rect x="${X(n-jB)}" y="${X(a)}" width="${X(r-n+2*jB)}" height="${X(4*OB)}" fill="var(--_s)" stroke="var(--_b)"${Up}/>`+(e.length>1?`<path d="M${X(n)},${X(i)}H${X(r)}" stroke="${IB}" stroke-dasharray="4 4"/>`:``)+`</g>`}let R=new Map,z=(e,t,n)=>{let i=e.node;if(i.className===`anchor`){let e=R.get(i);return e||R.set(i,e=b(i.label,s,a?Math.max(64,r/2):4e3,1)),1/Math.hypot(t/(e.width/2+5),n/(s*.8))}return i.isPipelineParent?kB/Math.SQRT2:i.sourceStrategy?2*OB:OB},B=new Map,V=(e,t,n)=>{Math.abs(t)<.25||Math.abs(n)<.25||B.set(e,(B.get(e)??0)|(t>0?n<0?1:2:n<0?4:8))},H=``;for(let t of e.links){let e=F.get(t.source),n=F.get(t.target);if(!e||!n||e===n||L.get(t.target)?.has(t.source))continue;let r=n.x-e.x,i=n.y-e.y,a=Math.hypot(r,i);if(a<.01)continue;let o=r/a,s=i/a,l=z(e,o,s),u=z(n,o,s);if(l+u>=a)continue;V(e,o,s),V(n,-o,-s);let d=e.x+o*l,f=e.y+s*l,p=n.x-o*u,m=n.y-s*u,h=``;(t.flow===`forward`||t.flow===`bidirectional`)&&(h+=xp(`arrow_point`,p,m,o,s,IB),p-=o*bp(`arrow_point`),m-=s*bp(`arrow_point`)),(t.flow===`backward`||t.flow===`bidirectional`)&&(h+=xp(`arrow_point`,d,f,-o,-s,IB),d+=o*bp(`arrow_point`),f+=s*bp(`arrow_point`));let g=``;if(t.label){let r=b(t.label,c+1,200),i=o>=0?1:-1,a=s*i,l=-o*i,u=5+Math.abs(a)*r.width/2+Math.abs(l)*r.height/2;g=v(r,(e.x+n.x)/2+a*u,(e.y+n.y)/2+l*u,` class="pele-edge-label" font-size="${c+1}" fill="var(--_m)"`)}H+=`<g class="pele-edge${t.dashed?` pele-wardley-dashed`:``}" data-id="${Y(t.source)}-${Y(t.target)}"><path d="M${X(d)},${X(f)}L${X(p)},${X(m)}" stroke="${IB}"${t.dashed?` stroke-dasharray="6 6"`:``}/>`+h+g+`</g>`}let U=``;for(let t of e.trends){let e=F.get(t.nodeId);if(!e)continue;let n=x(t.targetX),r=S(t.targetY),i=n-e.x,a=r-e.y,o=Math.hypot(i,a),s=``,c=o>0?z(e,i/o,a/o):0;if(o>c+OB+4){let t=i/o,l=a/o,u=n-t*(OB+2),d=r-l*(OB+2);s=`<path d="M${X(e.x+t*c)},${X(e.y+l*c)}L${X(u-t*bp(`arrow_point`))},${X(d-l*bp(`arrow_point`))}" stroke="${FB}" stroke-dasharray="4 4"/>`+xp(`arrow_point`,u,d,t,l,FB)}_(n-OB,r-OB,n+OB,r+OB),U+=`<g class="pele-wardley-trend" data-id="${Y(t.nodeId)}">${s}<circle cx="${X(n)}" cy="${X(r)}" r="${OB}" fill="var(--_bg)" stroke="${FB}"/></g>`}let ee=``,te=1.2*OB,W=.7*OB;for(let e of F.values()){let t=e.node,{x:n,y:i}=e,o=t.className===`anchor`,c=t.sourceStrategy,l=``;if(c){let e=c===`outsource`?`var(--_m)`:c===`buy`?`var(--_a)`:c===`build`?`var(--_s)`:`var(--_bg)`;l+=`<circle class="pele-wardley-${c}" cx="${X(n)}" cy="${X(i)}" r="${2*OB}" fill="${e}" stroke="${IB}"/>`}if(c===`market`){let e=te*Math.cos(Math.PI/6),t=i+te*Math.sin(Math.PI/6);l+=`<path d="M${X(n)},${X(i-te)}L${X(n-e)},${X(t)}H${X(n+e)}Z" fill="none" stroke="${IB}"/>`;for(let[r,a]of[[n,i-te],[n-e,t],[n+e,t]])l+=`<circle cx="${X(r)}" cy="${X(a)}" r="${X(W)}" fill="var(--_bg)" stroke="${IB}"/>`}else t.isPipelineParent?l+=`<rect x="${X(n-kB/2)}" y="${X(i-kB/2)}" width="${kB}" height="${kB}" fill="var(--_bg)" stroke="${IB}"/>`:o||(l+=`<circle cx="${X(n)}" cy="${X(i)}" r="${OB}" fill="var(--_bg)" stroke="${IB}"/>`);if(t.inertia===!0){let e=(t.isPipelineParent?kB/2:OB)+10+(c?OB+4:0);l+=`<rect class="pele-wardley-inertia" x="${X(n+e)}" y="${X(i-OB)}" width="4" height="${2*OB}" fill="${IB}"/>`}let u=t.labelOffsetX===void 0?void 0:RB(t.labelOffsetX,-5e3,5e3),d=t.labelOffsetY===void 0?void 0:RB(t.labelOffsetY,-5e3,5e3),f;if(o)f=v(R.get(t)??b(t.label,s,a?Math.max(64,r/2):4e3,1),n+(u??0),i+(d??-3),` class="pele-label" font-size="${s}" font-weight="var(--_hw)"`);else{let r=b(t.label,s),a=` class="pele-label" font-size="${s}"`,o=AB+(c?10:0);if(u!==void 0||d!==void 0)f=y(r,n+(u??o),i+(d??-o),a);else if(t.inPipeline)f=v(r,n,i+2*OB+4+r.height/2,a);else{let t=B.get(e)??0,c=t&1?t&2?t&4?t&8?1:8:4:2:1,l=c===1||c===2,u=c===1||c===4;f=y(r,l?n+o:n-o-r.width,u?i-o:i+o+s*.75,a)}}_(n-2*OB,i-2*OB,n+2*OB+20,i+2*OB),ee+=`<g class="pele-node pele-wardley-${o?`anchor`:t.isPipelineParent?`pipeline-parent`:t.inPipeline?`pipeline-component`:`component`}" data-id="${Y(t.id)}">${l}${f}</g>`}let ne=``;for(let t of e.annotations){let e=b(String(t.number),c,4e3,1),n=``;for(let r of t.coordinates){let t=x(r.x),i=S(r.y),a=Math.max(10,e.width/2+4);_(t-a,i-a,t+a,i+a),n+=`<circle cx="${X(t)}" cy="${X(i)}" r="${X(a)}" fill="var(--_bg)" stroke="${IB}"/>`+Z(e,t,i,` font-size="${c}" font-weight="var(--_hw)"`)}ne+=`<g class="pele-wardley-annotation" data-id="${Y(String(t.number))}">${n}</g>`}let G=e.annotations.filter(e=>e.text).sort((e,t)=>e.number-t.number);if(G.length>0){let t=G.map(e=>b(`${e.number}. ${e.text}`,s,a?Math.max(80,r-20):320)),n=0,i=0;for(let e of t)n=Math.max(n,e.width),i+=e.height;n+=20,i+=14;let o=e.annotationsBox,c=o?RB(x(o.x),0,Math.max(0,r-n)):0,l=o?RB(S(o.y),0,Math.max(0,d-i)):P;_(c,l,c+n,l+i);let u=``,f=l+7;for(let e of t)u+=zB(e,c+10,f+e.lineHeight/2+s*.35,` font-size="${s}"`),f+=e.height;ne+=`<g class="pele-wardley-annotations"><rect x="${X(c)}" y="${X(l)}" width="${X(n)}" height="${X(i)}" fill="var(--_bg)" stroke="var(--_b)"${Up}/>${u}</g>`}let re=``;for(let t of e.notes)re+=y(b(t.text,s,Math.min(360,r*.6),1),x(t.x),S(t.y),` class="pele-wardley-note" font-size="${s}" font-weight="var(--_hw)"`);let K=``,ie=(e,t,n,r)=>{let i=x(t),a=S(n),o=NB/2,s=r?i+MB:i,l=r?i:i+MB,u=r?i+MB-PB:i+PB,d=`M${X(l)},${X(a-o)}H${X(u)}V${X(a-o-8)}L${X(s)},${X(a)}L${X(u)},${X(a+o+8)}V${X(a+o)}H${X(l)}Z`;_(i,a-o-8,i+MB,a+o+8),K+=`<g class="pele-wardley-${r?`accelerator`:`deaccelerator`}" data-id="${Y(e)}"><path d="${d}" fill="var(--_s)" stroke="${IB}"/>`+v(b(e,c+1,160,1),i+MB/2,a+o+8+12,` font-size="${c+1}" font-weight="var(--_hw)"`)+`</g>`};for(let t of e.accelerators)ie(t.name,t.x,t.y,!0);for(let t of e.deaccelerators)ie(t.name,t.x,t.y,!1);let q=Q(e.title,!1,l,o,a?Math.max(80,r):4e3,1),ae=q.height>0?q.height+12:0,oe=Math.min(p,r/2-q.width/2),se=Math.max(h,r/2+q.width/2),ce=u-oe,le=u+ae-m,ue=Math.ceil(se-oe+2*u),de=Math.ceil(g-m+ae+2*u);return{svg:lm(`wardley`,ue,de,o,n,e,Z(q,ce+r/2,u+q.height/2,` class="pele-title" font-weight="var(--_tw)"`)+`<g transform="translate(${X(ce)},${X(le)})"><g class="pele-wardley-frame" fill="none">${E}</g>`+D+N+I+(H?`<g class="pele-edges" fill="none">${H}</g>`:``)+(U?`<g class="pele-wardley-trends" fill="none">${U}</g>`:``)+ee+ne+re+K+`</g>`),width:ue,height:de,links:[]}}var UB={type:`wardley`,section:`wardley-beta`,parse:(e,t,n)=>vB(TB(e),n),render:VB},WB=class{type=`xychart`;title;accTitle;accDescr;orientation;xAxis={type:`band`,title:``,categories:[]};yAxis={type:`linear`,title:``,min:1/0,max:-1/0};hasSetXAxis=!1;hasSetYAxis=!1;plots=[];setOrientation(e){this.orientation=e===`horizontal`?`horizontal`:`vertical`}setXAxisTitle(e){this.xAxis.title=e.text.trim()}setXAxisRangeData(e,t){this.xAxis={type:`linear`,title:this.xAxis.title,min:e,max:t},this.hasSetXAxis=!0}setXAxisBand(e){this.xAxis={type:`band`,title:this.xAxis.title,categories:e.map(e=>e.text.trim())},this.hasSetXAxis=!0}setYAxisTitle(e){this.yAxis.title=e.text.trim()}setYAxisRangeData(e,t){this.yAxis={type:`linear`,title:this.yAxis.title,min:e,max:t},this.hasSetYAxis=!0}plotData(e){if(e.length===0)return[];this.hasSetXAxis||this.setXAxisRangeData(1,e.length);let t=this.xAxis;if(t.type===`band`&&e.length>t.categories.length&&(e=e.slice(0,t.categories.length)),!this.hasSetYAxis){let{min:t,max:n}=this.yAxis;for(let r of e)r<t&&(t=r),r>n&&(n=r);this.yAxis={type:`linear`,title:this.yAxis.title,min:t,max:n}}if(t.type===`band`)return t.categories.map((t,n)=>[t,e[n]]);if(e.length===1)return[[`${t.min}`,e[0]]];let n=(t.max-t.min)/(e.length-1);return e.map((e,r)=>[`${t.min+r*n}`,e])}addPlot(e,t,n){let r={type:e,title:t.text.trim(),data:this.plotData(n.map(e=>e.value))};e===`line`&&n.some(e=>e.label.trim()!==``)&&(r.pointLabels=n.map(e=>e.label.trim())),this.plots.push(r)}setLineData(e,t){this.addPlot(`line`,e,t)}setBarData(e,t){this.addPlot(`bar`,e,t)}setDiagramTitle(e){this.title=e}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
166
|
+
`)}},GB=`$end.INVALID.NEWLINE.title.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.XYCHART.CHART_ORIENTATION.X_AXIS.Y_AXIS.ARROW_DELIMITER.LINE.BAR.NUMBER_WITH_DECIMAL.SQUARE_BRACES_START.SQUARE_BRACES_END.STR.ALPHA.COLON.PLUS.COMMA.EQUALS.MULT.BRKT.UNDERSCORE.DOT.AMP.MINUS.NUM.SEMI.EOF`.split(`.`),KB=[33,33,33,33,33,19,5,7,8],qB="`)"+` `.repeat(36)+`{ this.pushstate(md_string); }
|
|
167
|
+
<md_string>(?:(?!\`").)+`+` `.repeat(18)+`{ return md_str; }
|
|
168
|
+
<md_string>(?:\``,JB=new Uint8Array(128);for(let[e,t]of[[`:`,21],[`+`,22],[`,`,23],[`=`,24],[`*`,25],[`#`,26],[`_`,27],[`.`,28],[`&`,29],[`-`,30],[`;`,32]])JB[e.charCodeAt(0)]=t;function YB(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c=(t,a,o)=>{n.push(t),r.push(e.slice(a,o)),i.push(a),s=o},l=e=>{a.push(o),o=e},u=()=>{a.length>0&&(o=a.pop())},d=n=>{let r=e.indexOf(`
|
|
169
|
+
`,n);return r===-1?t:r},f=n=>{for(;n<t&&J(e.charCodeAt(n));)n++;return n},p=t=>{for(;Ps(e.charCodeAt(t));)t++;return t},m=t=>jk(e,s,t)&&!Ls(e.charCodeAt(s+t.length));for(;s<t;){let n=e.charCodeAt(s);if(o===5){if(n===34)s++,u();else{let n=e.indexOf(`"`,s);c(19,s,n===-1?t:n)}continue}if(o===6||o===7){c(KB[o],s,d(s)),u();continue}if(o===8){if(n===125)s++,u();else{let n=e.indexOf(`}`,s);c(8,s,n===-1?t:n)}continue}let r=e.charCodeAt(s+1);if(n===37&&r===37)s=d(s+2);else if(n===10||n===13){if((o===1||o===3)&&(n===10||r===10)){c(2,s,n===10?s+1:s+2),u();continue}let t=s+1;for(let n=e.charCodeAt(t);n===10||n===13;n=e.charCodeAt(++t));c(2,s,t)}else{switch(n|32){case 116:if(m(`title`)){c(3,s,s+5);continue}break;case 97:if(jk(e,s,`acc`)){let t=jk(e,s+3,`descr`);if(t||jk(e,s+3,`title`)){let n=f(s+8),r=e.charCodeAt(n);if(r===58){c(t?6:4,s,f(n+1)),l(t?7:6);continue}if(r===123&&t){s=f(n+1),l(8);continue}}}break;case 120:if(m(`xychart-beta`)){c(9,s,s+12);continue}if(m(`xychart`)){c(9,s,s+7);continue}if(m(`x-axis`)){c(11,s,s+6),l(1);continue}break;case 121:if(m(`y-axis`)){c(12,s,s+6),l(1);continue}break;case 118:if(jk(e,s,`vertical`)){c(10,s,s+8);continue}break;case 104:if(jk(e,s,`horizontal`)){c(10,s,s+10);continue}break;case 108:if(m(`line`)){c(14,s,s+4),l(3);continue}break;case 98:if(m(`bar`)){c(15,s,s+3),l(3);continue}}if(n===91)o===1?l(2):o===3&&l(4),c(17,s,s+1);else if(n===93)(o===4||o===2)&&u(),c(18,s,s+1);else if(o===1&&n===45&&r===45&&e.charCodeAt(s+2)===62)c(13,s,s+3);else{if(o===1||o===4){let t=n===43||n===45?s+1:s,r=e.charCodeAt(t),i=-1;if(Ps(r)?(i=p(t+1),e.charCodeAt(i)===46&&Ps(e.charCodeAt(i+1))&&(i=p(i+2))):r===46&&Ps(e.charCodeAt(t+1))&&(i=p(t+2)),i!==-1){c(16,s,i);continue}}if(n===96&&jk(e,s,qB))s+=qB.length,u();else if(n===34)s++,l(5);else if(Fs(n)){let t=s+1;for(;Fs(e.charCodeAt(t));)t++;c(20,s,t)}else if(Ps(n))c(31,s,p(s+1));else if(J(n))s=f(s+1);else if(n<128&&JB[n]!==0)c(JB[n],s,s+1);else break}}}return s<t?(n.push(1),r.push(``),i.push(s),{types:n,texts:r,starts:i}):(n.push(KB[o]),r.push(``),i.push(t),n.push(0),r.push(``),i.push(t),{types:n,texts:r,starts:i})}function XB(...e){let t=new Uint8Array(34);for(let n of e)t[n]=1;return t}var ZB=XB(29,31,20,22,24,25,28,26,30,27),QB=XB(2,32,33);function $B(e,t){let{types:n,texts:r,starts:i}=YB(e),a=0,o=t=>{let r=n[a];throw r===1?zo(`xychart`,e,i[a],``,!0):zo(`xychart`,e,i[a],`Expecting ${t}, got '${GB[r]}'`)},s=e=>(n[a]!==e&&o(`'${GB[e]}'`),r[a++]),c=e=>e===19||ZB[e]===1,l=()=>{c(n[a])||o(`'STR', 'ALPHA', 'NUM'`);let e=r[a++];if(n[a-1]!==19)for(;ZB[n[a]]===1;)e+=r[a++];return{text:e,type:`text`}},u=()=>{let e=Number(s(16));return s(13),[e,Number(s(16))]},d=()=>{let e=[];for(s(17);;){let t=Number(s(16));if(e.push({value:t,label:n[a]===19?r[a++]:``}),n[a]!==23)break;a++}return s(18),e};for(;;)if(QB[n[a]]===1)a++;else{if(n[a]!==9)break;n[++a]===10&&t.setOrientation(r[a++])}for(;n[a]!==0;){let e=n[a++];switch(e){case 3:t.setDiagramTitle(l().text.trim());break;case 11:case 12:{let r=c(n[a])?l():void 0;if(e===11&&n[a]===17){let e=[];do a++,e.push(l());while(n[a]===23);s(18),t.setXAxisBand(e)}else if(n[a]===16||r===void 0){let[n,r]=u();e===11?t.setXAxisRangeData(n,r):t.setYAxisRangeData(n,r)}e===11?t.setXAxisTitle(r??{type:`text`,text:``}):t.setYAxisTitle(r??{type:`text`,text:``});break}case 14:case 15:{let r=n[a]===17?{text:``,type:`text`}:l(),i=d();e===14?t.setLineData(r,i):t.setBarData(r,i);break}case 4:t.setAccTitle(s(5).trim());break;case 6:t.setAccDescription(s(7).trim());break;case 8:t.setAccDescription(r[a-1].trim());break;default:a--,o(`'title', 'X_AXIS', 'Y_AXIS', 'LINE', 'BAR', 'acc_title', 'acc_descr', 'acc_descr_multiline_value'`)}for(;QB[n[a]]===1;)a++}}function eV(e,t){let n=e/Math.max(t,1),r=Math.floor(Math.log10(n)),i=n/10**r,a=i>=7.07?10:i>=3.16?5:i>=1.41?2:1;return r<0?-(10**-r)/a:a*10**r}function tV(e,t){return e>0?t/e:t*-e}function nV(e,t){return e>0?t*e:t/-e}function rV(e,t,n){let r=Math.round(tV(n,e));nV(n,r)<e&&r++;let i=Math.round(tV(n,t));nV(n,i)>t&&i--;let a=[];for(let e=r;e<=i&&a.length<100;e++)a.push(nV(n,e));return a}var iV=4,aV=12,oV=26,sV=24,cV=1e300;function lV(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function uV(e,t,n=!0){let r=e[t];return typeof r==`boolean`?r:n}function dV(e,t){return typeof e==`number`&&e>0?Math.round(Math.min(Math.max(e,100),4e3)):t}function fV(e){return typeof e==`number`&&isFinite(e)?Math.min(Math.max(e,-cV),cV):void 0}function pV(e){let t=0;for(let n of e)t=Math.max(t,n.label.width);return t}function mV(e,t,n,r){let i=e.lines.length===1?e.lines[0]:void 0;return i&&i.length===1&&i[0].icon===void 0&&i[0].style===0?`<text x="${X(t)}" y="${X(n+e.size*.35)}" text-anchor="${r}">${Ec(i[0].text)}</text>`:Z(e,t+(r===`start`?e.width/2:r===`end`?-e.width/2:0),n,``)}function hV(e,t,n){if(e.plots.length===0)throw new jo(`No Plot to render, please provide a plot with some data`,`semantic`,{type:`xychart`});let r=lV(t.xyChart),i=n.fontSize??16,a=Math.round(i*.875),o=Math.round(i*.75),s=n.measurer??bc(n.fontFamily,n.fontFamilyMono),c=n.padding??8,l=dV(r.width,700),u=wh(n,l,240),d=Math.round(dV(r.height,500)*Math.max(.6,u/l)),f=(e.orientation??r.chartOrientation)===`horizontal`,p=uV(r,`showDataLabel`,!1),m=e.xAxis,h=e.plots,g=(e,t,n)=>Q(e,!1,s,t,n),_=g(`0`,a,4e3).height,v=g(`0`,o,4e3).height,y=Q(uV(r,`showTitle`)?e.title:void 0,!1,s,i,u-2*c,1),b=y.height>0?y.height+12:0,x=[],S=0;uV(r,`showLegend`)&&h.forEach((e,t)=>{if(e.title===``)return;let n=g(e.title,a,u*.3);x.push({index:t,label:n}),S=Math.max(S,n.width+aV+8)});let C=x.length>0?S+sV:0,w=h.filter(e=>e.type===`bar`).length,T=fV(e.yAxis.min)??1/0,E=fV(e.yAxis.max)??-1/0,D=e.hasSetYAxis&&isFinite(T)&&isFinite(E)&&T!==E;if(!D){T=1/0,E=-1/0;for(let e of h)for(let[,t]of e.data){let e=fV(t);e!==void 0&&(e<T&&(T=e),e>E&&(E=e))}T>E&&(T=E=0),w>0&&(T=Math.min(T,0),E=Math.max(E,0)),T===E&&(T===0?E=1:(T-=Math.abs(T)/2,E+=Math.abs(E)/2))}let O=(e,t)=>{let n=eV(Math.abs(E-T),Math.max(2,Math.min(10,Math.floor(e/t))));return D||(T=nV(n,Math.floor(tV(n,T)+1e-9)),E=nV(n,Math.ceil(tV(n,E)-1e-9))),rV(Math.min(T,E),Math.max(T,E),n).map(e=>({at:(e-T)/(E-T),label:g(String(e),a,4e3)}))},k=1;if(m.type===`band`)k=Math.max(m.categories.length,1);else for(let e of h)k=Math.max(k,e.data.length);let A=1/k,j=m.type===`band`||w>0?A/2:0,M=fV(m.type===`linear`?m.min:void 0),N=fV(m.type===`linear`?m.max:void 0),P=M!==void 0&&N!==void 0&&M!==N,F=(e,t)=>m.type===`band`?(e+.5)*A:j+(t>1?e/(t-1):P?0:.5)*(1-2*j),I=lV(r.xAxis),L=lV(r.yAxis),R=f?I:L,z=f?L:I,B=g(uV(R,`showTitle`)?f?m.title:e.yAxis.title:void 0,a,d*.8),V=g(uV(z,`showTitle`)?f?e.yAxis.title:m.title:void 0,a,u*.8),H=uV(R,`showTick`)?iV:0,U=uV(z,`showTick`)?iV:0,ee=uV(R,`showLabel`),te=uV(z,`showLabel`),W=f?u*.3:Math.max(48,(u-2*c-64-C)*A-8),ne=m.type===`band`&&uV(I,`showLabel`)?m.categories.map(e=>g(e,a,W)):[],G=0,re=0;for(let e of ne)G=Math.max(G,e.width),re=Math.max(re,e.height);let K=e=>{let t=[];if(m.type===`band`){let n=ne.length===0?8:f?re:G+12,r=Math.max(1,Math.ceil(n/(e*A)));for(let e=0;e<m.categories.length;e+=r)t.push({at:(e+.5)*A,label:ne[e]??g(void 0,a,0)})}else if(P){let n=eV(Math.abs(N-M),Math.max(2,Math.min(10,Math.floor(e/(f?32:80)))));for(let e of rV(Math.min(M,N),Math.max(M,N),n))t.push({at:j+(e-M)/(N-M)*(1-2*j),label:g(String(e),a,4e3)})}else M!==void 0&&t.push({at:.5,label:g(String(M),a,4e3)});return t},ie=0,q=0;for(let e of h){for(let t of e.pointLabels??[])ie=Math.max(ie,s.width(t,o,0));if(p&&f&&e.type===`bar`)for(let[,t]of e.data)q=Math.max(q,s.width(String(fV(t)??``),o,0))}let ae=te?f||m.type!==`band`?_:re:0,oe=U+(ae>0?ae+4:0)+(V.height>0?V.height+4:0),se=f?0:ie>0||p?v+4:ee?_/2:0,ce=c+b+se,le=Math.max(1,d-c-oe-ce),ue=ce+le,de=f?K(le):O(le,56),fe=ee?pV(de):0,pe=c+(B.height>0?B.height+6:0)+(fe>0?fe+6:0)+H,me=Math.max(ie>0?ie+12:0,q>0?q+8:0),he=f?Math.min(u*.25,me):0,ge=Math.max(1,u-c-pe-C-he),_e=f?O(ge,80):K(ge);if(te&&C+he===0){let e=0;for(let t of _e)e=Math.max(e,t.at*ge+t.label.width/2-ge);ge=Math.max(1,ge-e)}let ve=pe+ge,ye=(e,t)=>f?pe+t*ge:pe+e*ge,be=(e,t)=>f?ce+e*le:ue-t*le,xe=e=>(e-T)/(E-T),Se=e=>Math.min(Math.max(e,0),1),Ce=e=>f?`M${X(ye(0,e))},${X(ce)}V${X(ue)}`:`M${X(pe)},${X(be(0,e))}H${X(ve)}`,we=``;for(let e of f?_e:de)we+=Ce(e.at);let Te=``,Ee=``;uV(R,`showAxisLine`)&&(Te+=`M${X(pe)},${X(ce)}V${X(ue)}`),uV(z,`showAxisLine`)&&(Te+=`M${X(pe)},${X(ue)}H${X(ve)}`);for(let e of de){let t=f?ce+e.at*le:ue-e.at*le;H&&(Te+=`M${X(pe)},${X(t)}h${-H}`),ee&&(Ee+=mV(e.label,pe-H-6,t,`end`))}for(let e of _e){let t=pe+e.at*ge;U&&(Te+=`M${X(t)},${X(ue)}v${U}`),te&&(Ee+=mV(e.label,t,ue+U+4+e.label.height/2,`middle`))}let De=(f?le:ge)*A,Oe=De*.7/Math.max(w,1),ke=w>1?Math.min(2,Oe*.2):0,Ae=Se(xe(0));w>0&&Ae>0&&Ae<1&&(Te+=Ce(Ae));let je=``,Me=``,Ne=``,Pe=``,Fe=0;h.forEach((e,t)=>{let n=om(t),r=e.title?` data-id="${Y(e.title)}"`:``,i=m.type===`band`?Math.min(e.data.length,k):e.data.length;if(e.type===`bar`){let t=(Fe++-(w-1)/2)*Oe-(Oe-ke)/2,a=``;for(let n=0;n<i;n++){let r=fV(e.data[n][1]);if(r===void 0)continue;let c=F(n,i),l=Se(xe(r)),u=Math.min(Ae,l),d=Math.max(Ae,l),m=f?ye(c,u):ye(c,0)+t,h=f?be(c,0)+t:be(c,d),g=f?(d-u)*ge:Oe-ke,_=f?Oe-ke:(d-u)*le;if(a+=`<rect x="${X(m)}" y="${X(h)}" width="${X(g)}" height="${X(_)}"/>`,!p)continue;let y=String(r),b=s.width(y,o,0),x=l>=Ae?1:-1,S=m+g/2,C=h+_/2,T=`middle`;if(f){if(_<o)continue;S=(x>0?m+g:m)+x*6,T=x>0?`start`:`end`}else{if(b+2>De/w)continue;C=(x>0?h:h+_)-x*(v/2+2)}Ne+=`<text x="${X(S)}" y="${X(C+o*.35)}" text-anchor="${T}">${y}</text>`}je+=`<g class="pele-series pele-bars"${r} fill="${n}">${a}</g>`;return}let a=``,c=``,l=!1,u=0,d=NaN;for(let t=0;t<i;t++){let n=fV(e.data[t][1]);if(n===void 0){d=NaN;continue}let r=F(t,i),s=xe(n),p=s>=0&&s<=1;if(d!==d)p&&(a+=`M${X(ye(r,s))},${X(be(r,s))}`),l=p;else{let e=s-d,t=0,n=1;if(e!==0){let r=-d/e,i=(1-d)/e;t=Math.max(t,Math.min(r,i)),n=Math.min(n,Math.max(r,i))}else p||(t=2);if(t<=n){let i=u+(r-u)*t,o=d+e*t,s=u+(r-u)*n,c=d+e*n;(!l||t>0)&&(a+=`M${X(ye(i,o))},${X(be(i,o))}`),a+=`L${X(ye(s,c))},${X(be(s,c))}`}l=p}if(u=r,d=s,!p)continue;let m=ye(r,s),h=be(r,s);De>=12&&(c+=`<circle cx="${X(m)}" cy="${X(h)}" r="3"/>`);let _=g(e.pointLabels?.[t],o,4e3);if(_.height>0){let e=_.width/2;Pe+=f?mV(_,m+10,h,`start`):mV(_,Math.max(Math.min(m,ve-e),pe+e),h-6-_.height/2,`middle`)}}Me+=`<g class="pele-series pele-line"${r} fill="${n}">`+(a?`<path d="${a}" fill="none" stroke="${n}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>`:``)+c+`</g>`});let Ie=``;B.height>0&&(Ie+=`<g transform="translate(${X(c+B.height/2)},${X(ce+le/2)}) rotate(-90)">${Z(B,0,0,``)}</g>`),Ie+=Z(V,pe+ge/2,d-c-V.height/2,``);let Le=``,Re=0;for(let e of x)Re+=Math.max(oV,e.label.height+6);let ze=ce+Math.max(0,(le-Re)/2),Be=ve+he+sV;for(let{index:e,label:t}of x){let n=Math.max(oV,t.height+6);if(ze+n>d)break;let r=ze+n/2,i=om(e);Le+=`<g class="pele-legend-item" data-id="${Y(h[e].title)}">`+(h[e].type===`bar`?`<rect x="${X(Be)}" y="${X(r-aV/2)}" width="${aV}" height="${aV}" rx="2" fill="${i}"/>`:`<path d="M${X(Be)},${X(r)}h${aV}" stroke="${i}" stroke-width="2" stroke-linecap="round"/>`)+Z(t,Be+aV+8+t.width/2,r,``)+`</g>`,ze+=n}return{svg:lm(`xychart`,u,d,i,n,e,Z(y,u/2,c+y.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(we?`<path class="pele-grid" d="${we}" stroke="var(--_a)"/>`:``)+`<g class="pele-plot">${je}${Me}</g>`+(Te?`<path class="pele-axis" d="${Te}" fill="none" stroke="var(--_b)"/>`:``)+(Ee?`<g class="pele-axis-labels" font-size="${a}" fill="var(--_m)">${Ee}</g>`:``)+(Ie?`<g class="pele-axis-titles" font-size="${a}">${Ie}</g>`:``)+(Ne?`<g class="pele-data-labels" font-size="${o}">${Ne}</g>`:``)+(Pe?`<g class="pele-point-labels" font-size="${o}">${Pe}</g>`:``)+(Le?`<g class="pele-legend" font-size="${a}">${Le}</g>`:``)),width:u,height:d,links:[]}}nu(aw,Sk,gS,XO,OO,uI,YD,Lb,Zk,{type:`xychart`,section:`xyChart`,parse(e,t,n){let r=new WB;return r.title=n,$B(e,r),r},render:hV},xF,lE,e_,JM,bN,ok,EA,xL,JE,PP,HE,zy,mv,iM,Zh,$I,fx,UB,rC,Vz,uB,vD,HF);function gV(e,t,n){let r=document.createElement(`button`);return r.type=`button`,r.className=`mermaid-action`,r.title=e,r.setAttribute(`aria-label`,e),r.innerHTML=`<svg viewBox="0 0 24 24" aria-hidden="true">${t}</svg>`,r.addEventListener(`click`,n),r}function _V(e,t={expand:()=>{}}){let n=document.createElement(`figure`);n.className=`mermaid-diagram`,n.dataset.mermaidSource=e,n.contentEditable=`false`;let r=document.createElement(`div`);r.className=`mermaid-toolbar`;let i=document.createElement(`span`);i.textContent=`Mermaid`,r.append(i),t.source&&r.append(gV(`Редактировать исходный код`,`<path d="m8 6-6 6 6 6M16 6l6 6-6 6M14 4l-4 16"/>`,t.source)),r.append(gV(`Раскрыть диаграмму`,`<path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/>`,t.expand));let a=document.createElement(`div`);a.className=`mermaid-canvas`,a.setAttribute(`role`,`img`),a.setAttribute(`aria-label`,`Диаграмма Mermaid`),a.addEventListener(`click`,e=>{e.target instanceof Element&&e.target.closest(`a, button, input`)||t.expand()}),n.append(r,a);let o=mu(a,e,{zoom:`auto`,sanitize:e=>Co.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0},RETURN_DOM:!0})});return{element:n,destroy(){o.destroy()}}}var vV={"--pele-bg":`--bg`,"--pele-fg":`--text`,"--pele-muted":`--muted`,"--pele-line":`--text-2`,"--pele-surface":`--bg-2`,"--pele-surface-alt":`--bg-3`,"--pele-border":`--line-strong`,"--pele-accent":`--info`,"--pele-critical":`--err`,"--pele-error":`--err`,"--pele-font":`--sans`,"--pele-font-mono":`--mono`};function yV(e){let t=pu(e,{responsive:!1}),n=Co.sanitize(t.svg,{USE_PROFILES:{svg:!0,svgFilters:!0},RETURN_DOM:!0}),r=n instanceof SVGSVGElement?n:n.querySelector(`svg`);if(!r)throw Error(`Pele returned no SVG`);for(let[e,t]of Object.entries(vV))r.style.setProperty(e,`var(${t})`);return{svg:r.outerHTML,width:t.width,height:t.height}}var bV=o({__name:`MermaidModal`,props:{source:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=f(()=>yV(n.source));return(e,t)=>(p(),x(Oo,{svg:i.value.svg,width:i.value.width,height:i.value.height,alt:`Диаграмма Mermaid`,onClose:t[0]||=e=>r(`close`)},null,8,[`svg`,`width`,`height`]))}}),xV={"+1":`+1`,"-1":`-1`,laugh:`smile`,hooray:`tada`,confused:`confused`,heart:`heart`,rocket:`rocket`,eyes:`eyes`},SV={"+1":`Нравится`,"-1":`Не нравится`,laugh:`Смех`,hooray:`Ура`,confused:`Недоумение`,heart:`Сердце`,rocket:`Ракета`,eyes:`Глаза`},CV=l({}),wV;function TV(){return wV??=fetch(`/api/integrations/github/emojis`).then(e=>e.ok?e.json():Promise.reject(Error(`emojis`))).then(e=>CV.value=e).catch(()=>(wV=void 0,CV.value)),wV}function EV(){return TV(),CV}var DV=/:([a-z0-9_+-]+):/gi;function OV(e,t){let n=[],r=0;for(let i of e.matchAll(DV)){let a=i[1].toLowerCase(),o=Object.hasOwn(t,a)?t[a]:void 0;o&&(i.index>r&&n.push(e.slice(r,i.index)),n.push({name:a,url:o}),r=i.index+i[0].length)}return r<e.length&&n.push(e.slice(r)),n}export{F as _,EV as a,k as b,Oo as c,Me as d,H as f,A as g,z as h,OV as i,Co as l,P as m,SV as n,bV as o,I as p,TV as r,_V as s,xV as t,qi as u,V as v,D as x,L as y};
|